nervosnetwork/ckb-demo-ruby

undefined method `unpack1'

Closed this issue · 4 comments

u2 commented
[10] pry(main)> conf = asw.install_mruby_cell!("/home/u2/nervos/ckb-binary-to-script/script/processed_argv_source_entry")
NoMethodError: undefined method `unpack1' for #<String:0x00000000ca7380>
Did you mean?  unpack
from /home/u2/nervos/ckb-demo-ruby-sdk/lib/ckb/utils.rb:16:in `bin_to_hex'
➜  ckb-demo-ruby-sdk git:(master) ✗ ruby -v
mruby 1.4.1 (2018-4-27) 

This requires ruby (not mruby) 2.4 and above.

u2 commented
➜  ckb-demo-ruby-sdk git:(master) ✗ ruby -v       
ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux]
➜  ckb-demo-ruby-sdk git:(master) ✗ rbenv versions   
  system
* 2.5.1 (set by /home/u2/nervos/ckb-demo-ruby-sdk/.ruby-version)
  mruby-1.4.1
➜  ckb-demo-ruby-sdk git:(master) ✗ bundle exec pry -r ./lib/ckb/wallet.rb
[1] pry(main)> api = Ckb::Api.new
=> #<API@http://localhost:8114>
[2] pry(main)> asw = Ckb::AlwaysSuccessWallet.new(api)
=> #<Ckb::AlwaysSuccessWallet:0x00000002e3de68 @api=#<API@http://localhost:8114>>
[3] pry(main)> conf = asw.install_mruby_cell!("/home/u2/nervos/ckb-binary-to-script/script/processed_argv_source_entry")
NoMethodError: undefined method `unpack1' for #<String:0x00000002df16a8>
Did you mean?  unpack
from /home/u2/nervos/ckb-demo-ruby-sdk/lib/ckb/utils.rb:16:in `bin_to_hex'
[4] pry(main)> 

@u2 I'm pretty sure ruby 2.5.1 has this method. Could you print out Ruby version from the wallet.rb session:

puts RUBY_VERSION
u2 commented

It's ok now. Thanks.