klaytn 0.0.8 → 0.1.1
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/Gemfile.lock +1 -1
- data/lib/klaytn/contract.rb +19 -6
- data/lib/klaytn/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d7771ed81d24129ae58f55b94a87ed18e8b6b1bd43fa174342acb7708a2de033
|
4
|
+
data.tar.gz: 5e7a878c2f6f7584cd81ef4c6fcdca8afd28ae702220f12567810519ca369fcf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e380aa08abbf8eb071e76911c2ad9fd4d77d08eb9b10d229a3a3c64bd6c5faa52ad3bf983a996e2872f10409511ebbb2787399f40409bcbacc3ecb52c05f5756
|
7
|
+
data.tar.gz: 54a213ea27fdf0f5d21663e304f241a986d777bfe2f1ce7074b3d8085c000cfb1165e6705d07b983ae831b4ba1584f8b7173a5d155f1d37c0fc3e7b58f1e2a12
|
data/Gemfile.lock
CHANGED
data/lib/klaytn/contract.rb
CHANGED
@@ -17,11 +17,11 @@ module Klaytn
|
|
17
17
|
super
|
18
18
|
end
|
19
19
|
|
20
|
-
def deploy(bytecode, submit: true)
|
20
|
+
def deploy(bytecode, submit: true, gas: 900000)
|
21
21
|
body = {
|
22
22
|
from: kas_account_wallet_address, # must be created inside KAS console > Account Pool, and MUST be capital version from Klaytn Scope!
|
23
23
|
input: bytecode,
|
24
|
-
gas:
|
24
|
+
gas: gas,
|
25
25
|
submit: submit
|
26
26
|
}
|
27
27
|
|
@@ -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,30 @@ 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
|
52
|
+
def raw_transaction(input_data, gas: 0)
|
53
|
+
raise MISSING_CONTRACT if contract_address.blank?
|
54
|
+
body = {
|
55
|
+
from: kas_account_wallet_address,
|
56
|
+
to: contract_address,
|
57
|
+
input: input_data,
|
58
|
+
gas: gas,
|
59
|
+
submit: true
|
60
|
+
}
|
61
|
+
resp = HTTParty.post(BASE_URL + '/execute', body: body.to_json, headers: headers.merge('x-krn' => kas_account_pool_krn), basic_auth: basic_auth)
|
62
|
+
JSON.parse(resp.body)
|
63
|
+
end
|
64
|
+
|
65
|
+
def function_body_builder(definition, inputs, params, gas)
|
53
66
|
{
|
54
67
|
from: kas_account_wallet_address,
|
55
68
|
to: contract_address,
|
56
69
|
input: encoder.encode_function(definition, inputs, params),
|
57
|
-
|
70
|
+
gas: gas,
|
58
71
|
submit: true
|
59
72
|
}
|
60
73
|
end
|
data/lib/klaytn/version.rb
CHANGED
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.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Kulp
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2022-03-
|
12
|
+
date: 2022-03-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|