klaytn 0.0.9 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8b56d3d48ae3828ec485ba078021c384df13a57a1d51005b0c11e8924ae92bff
4
- data.tar.gz: 270d7ac818859cb958d19f32e370d57cfc2435913044c7c595974fe65a8b29dc
3
+ metadata.gz: 1b2ecedaa55657b6727db503cd9cd03aa8042da5bda490431c75be6739f2f957
4
+ data.tar.gz: 4dceec99b7cba5c3622e24fa93d2b7959213de6c687824a38395fd0dfc37f097
5
5
  SHA512:
6
- metadata.gz: 00a4986d9e149c3bbef87dd2a723f90a4ffb33807014ec12d4fea5161956106f3bc6096001fbaebaff0d8b86d98133261a016f8a95427320827c82732139cdce
7
- data.tar.gz: 3764f35b1f3a2c8e18d8d6f535c26f0c8c7083d70f3a0d0708b1546db0529e314dcc1faa54b62f5108c5c6f9dc9c93a3b1672724ac426a80f5d11e03152d6f7d
6
+ metadata.gz: 5fb1d6e532804b44232fa1e889e95955987d18c043564a77c8e376be76317c749d8827f1a8427ffbcabcae6afdab01f26b9492617805758d4ed06c624b795d3a
7
+ data.tar.gz: 063c1e02aa2b2ad4e0c36182bd43b58459a2e80d56bdc80ef9410467378e1ef61061f61fe299cb716aa469dbbb35c311b92e1c88f6141f3b971ba78bc2b06e71
@@ -34,7 +34,7 @@ module Klaytn
34
34
  # inputs ex: [OpenStruct.new({ "internalType": "address", "name": "addr", "type": "address" })] - array of dot-notation object from ABI
35
35
  # params ex: ['0x0xxxx'] - array of arguments accepted by function
36
36
 
37
- def invoke_function(definition, params)
37
+ def invoke_function(definition, params, gas: 0)
38
38
  raise MISSING_CONTRACT if contract_address.blank?
39
39
  raise MISSING_ABI if abi.blank?
40
40
 
@@ -44,17 +44,17 @@ module Klaytn
44
44
  built_defintion = "#{definition}(#{found_function[:inputs].map {|i| i[:type]}.join(',')})"
45
45
  built_inputs = found_function[:inputs].map { |i| OpenStruct.new(i) }
46
46
 
47
- body = function_body_builder(built_defintion, built_inputs, params)
47
+ body = function_body_builder(built_defintion, built_inputs, params, gas)
48
48
  resp = HTTParty.post(BASE_URL + '/execute', body: body.to_json, headers: headers.merge('x-krn' => kas_account_pool_krn), basic_auth: basic_auth)
49
49
  JSON.parse(resp.body)
50
50
  end
51
51
 
52
- def function_body_builder(definition, inputs, params)
52
+ def function_body_builder(definition, inputs, params, gas)
53
53
  {
54
54
  from: kas_account_wallet_address,
55
55
  to: contract_address,
56
56
  input: encoder.encode_function(definition, inputs, params),
57
- # gas: 900000, # better to exclude, otherwise 'insufficient funds' error is common
57
+ gas: gas,
58
58
  submit: true
59
59
  }
60
60
  end
@@ -1,3 +1,3 @@
1
1
  module Klaytn
2
- VERSION = "0.0.9"
2
+ VERSION = "0.1.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: klaytn
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Kulp