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 +4 -4
- data/lib/klaytn/contract.rb +4 -4
- data/lib/klaytn/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1b2ecedaa55657b6727db503cd9cd03aa8042da5bda490431c75be6739f2f957
|
4
|
+
data.tar.gz: 4dceec99b7cba5c3622e24fa93d2b7959213de6c687824a38395fd0dfc37f097
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5fb1d6e532804b44232fa1e889e95955987d18c043564a77c8e376be76317c749d8827f1a8427ffbcabcae6afdab01f26b9492617805758d4ed06c624b795d3a
|
7
|
+
data.tar.gz: 063c1e02aa2b2ad4e0c36182bd43b58459a2e80d56bdc80ef9410467378e1ef61061f61fe299cb716aa469dbbb35c311b92e1c88f6141f3b971ba78bc2b06e71
|
data/lib/klaytn/contract.rb
CHANGED
@@ -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
|
-
|
57
|
+
gas: gas,
|
58
58
|
submit: true
|
59
59
|
}
|
60
60
|
end
|
data/lib/klaytn/version.rb
CHANGED