ton_sdk_client 1.22.0 → 1.27.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/CHANGELOG.md +17 -0
- data/README.md +2 -2
- data/lib/ton_sdk_client/abi.rb +263 -78
- data/lib/ton_sdk_client/boc.rb +213 -63
- data/lib/ton_sdk_client/client.rb +17 -19
- data/lib/ton_sdk_client/client_context.rb +3 -1
- data/lib/ton_sdk_client/config.rb +7 -9
- data/lib/ton_sdk_client/crypto.rb +183 -225
- data/lib/ton_sdk_client/debot.rb +19 -20
- data/lib/ton_sdk_client/interop.rb +4 -4
- data/lib/ton_sdk_client/kw_struct.rb +7 -0
- data/lib/ton_sdk_client/net.rb +65 -67
- data/lib/ton_sdk_client/processing.rb +10 -10
- data/lib/ton_sdk_client/proofs.rb +61 -0
- data/lib/ton_sdk_client/tvm.rb +13 -15
- data/lib/ton_sdk_client/types.rb +3 -2
- data/lib/ton_sdk_client/utils.rb +23 -23
- data/lib/ton_sdk_client/version.rb +2 -2
- metadata +7 -5
data/lib/ton_sdk_client/tvm.rb
CHANGED
@@ -22,7 +22,7 @@ module TonSdk
|
|
22
22
|
CONTRACT_EXECUTION_ERROR = 414
|
23
23
|
end
|
24
24
|
|
25
|
-
ExecutionOptions =
|
25
|
+
ExecutionOptions = KwStruct.new(:blockchain_config, :block_time, :block_lt, :transaction_lt) do
|
26
26
|
def initialize(blockchain_config: nil, block_time: nil, block_lt: nil, transaction_lt: nil)
|
27
27
|
super
|
28
28
|
end
|
@@ -64,15 +64,14 @@ module TonSdk
|
|
64
64
|
end
|
65
65
|
end
|
66
66
|
|
67
|
-
ParamsOfRunExecutor =
|
67
|
+
ParamsOfRunExecutor = KwStruct.new(
|
68
68
|
:message,
|
69
69
|
:account,
|
70
70
|
:execution_options,
|
71
71
|
:abi,
|
72
72
|
:skip_transaction_check,
|
73
73
|
:boc_cache,
|
74
|
-
:return_updated_account
|
75
|
-
keyword_init: true
|
74
|
+
:return_updated_account
|
76
75
|
) do
|
77
76
|
def initialize(
|
78
77
|
message:,
|
@@ -96,7 +95,7 @@ module TonSdk
|
|
96
95
|
end
|
97
96
|
end
|
98
97
|
|
99
|
-
ResultOfRunExecutor =
|
98
|
+
ResultOfRunExecutor = KwStruct.new(:transaction, :out_messages, :decoded, :account, :fees) do
|
100
99
|
def initialize(transaction:, out_messages:, decoded: nil, account:, fees:)
|
101
100
|
super
|
102
101
|
end
|
@@ -127,7 +126,7 @@ module TonSdk
|
|
127
126
|
end
|
128
127
|
end
|
129
128
|
|
130
|
-
ResultOfRunTvm =
|
129
|
+
ResultOfRunTvm = KwStruct.new(:out_messages, :decoded, :account) do
|
131
130
|
def initialize(out_messages:, decoded: nil, account:)
|
132
131
|
super
|
133
132
|
end
|
@@ -155,16 +154,15 @@ module TonSdk
|
|
155
154
|
end
|
156
155
|
end
|
157
156
|
|
158
|
-
ResultOfRunGet =
|
157
|
+
ResultOfRunGet = KwStruct.new(:output)
|
159
158
|
|
160
|
-
TransactionFees =
|
159
|
+
TransactionFees = KwStruct.new(
|
161
160
|
:in_msg_fwd_fee,
|
162
161
|
:storage_fee,
|
163
162
|
:gas_fee,
|
164
163
|
:out_msgs_fwd_fee,
|
165
164
|
:total_account_fees,
|
166
|
-
:total_output
|
167
|
-
keyword_init: true
|
165
|
+
:total_output
|
168
166
|
) do
|
169
167
|
def initialize(
|
170
168
|
in_msg_fwd_fee:,
|
@@ -191,7 +189,7 @@ module TonSdk
|
|
191
189
|
is_single_thread_only: false
|
192
190
|
) do |resp|
|
193
191
|
if resp.success?
|
194
|
-
yield
|
192
|
+
yield NativeLibResponseResult.new(
|
195
193
|
result: ResultOfRunExecutor.new(
|
196
194
|
transaction: resp.result["transaction"],
|
197
195
|
out_messages: resp.result["out_messages"],
|
@@ -214,7 +212,7 @@ module TonSdk
|
|
214
212
|
is_single_thread_only: false
|
215
213
|
) do |resp|
|
216
214
|
if resp.success?
|
217
|
-
yield
|
215
|
+
yield NativeLibResponseResult.new(
|
218
216
|
result: ResultOfRunTvm.new(
|
219
217
|
out_messages: resp.result["out_messages"],
|
220
218
|
decoded: resp.result["decoded"],
|
@@ -235,8 +233,8 @@ module TonSdk
|
|
235
233
|
is_single_thread_only: false
|
236
234
|
) do |resp|
|
237
235
|
if resp.success?
|
238
|
-
yield
|
239
|
-
result: ResultOfRunGet.new(resp.result["output"])
|
236
|
+
yield NativeLibResponseResult.new(
|
237
|
+
result: ResultOfRunGet.new(output: resp.result["output"])
|
240
238
|
)
|
241
239
|
else
|
242
240
|
yield resp
|
@@ -244,4 +242,4 @@ module TonSdk
|
|
244
242
|
end
|
245
243
|
end
|
246
244
|
end
|
247
|
-
end
|
245
|
+
end
|
data/lib/ton_sdk_client/types.rb
CHANGED
@@ -17,7 +17,7 @@ module TonSdk
|
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
|
-
class
|
20
|
+
class NativeLibResponseResult
|
21
21
|
attr_reader :result, :error
|
22
22
|
|
23
23
|
def initialize(result: nil, error: nil)
|
@@ -32,6 +32,7 @@ module TonSdk
|
|
32
32
|
data: error["data"]
|
33
33
|
)
|
34
34
|
else
|
35
|
+
# Some methods like unsubscribe will trigger this error. Should be refactored
|
35
36
|
raise ArgumentError.new('some arguments are wrong; provide either result or error')
|
36
37
|
end
|
37
38
|
|
@@ -41,4 +42,4 @@ module TonSdk
|
|
41
42
|
def success? = !@result.nil?
|
42
43
|
def failure? = !@error.nil?
|
43
44
|
end
|
44
|
-
end
|
45
|
+
end
|
data/lib/ton_sdk_client/utils.rb
CHANGED
@@ -32,27 +32,27 @@ module TonSdk
|
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
|
-
ParamsOfConvertAddress =
|
35
|
+
ParamsOfConvertAddress = KwStruct.new(:address, :output_format) do
|
36
36
|
def to_h
|
37
37
|
{
|
38
|
-
address:
|
39
|
-
output_format:
|
38
|
+
address: address,
|
39
|
+
output_format: output_format.to_h
|
40
40
|
}
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
44
|
-
ResultOfConvertAddress =
|
45
|
-
ParamsOfCalcStorageFee =
|
46
|
-
ResultOfCalcStorageFee =
|
44
|
+
ResultOfConvertAddress = KwStruct.new(:address)
|
45
|
+
ParamsOfCalcStorageFee = KwStruct.new(:account, :period)
|
46
|
+
ResultOfCalcStorageFee = KwStruct.new(:fee)
|
47
47
|
|
48
|
-
ParamsOfCompressZstd =
|
49
|
-
ResultOfCompressZstd =
|
48
|
+
ParamsOfCompressZstd = KwStruct.new(:uncompressed, :level)
|
49
|
+
ResultOfCompressZstd = KwStruct.new(:compressed)
|
50
50
|
|
51
|
-
ParamsOfDecompressZstd =
|
52
|
-
ResultOfDecompressZstd =
|
51
|
+
ParamsOfDecompressZstd = KwStruct.new(:compressed)
|
52
|
+
ResultOfDecompressZstd = KwStruct.new(:decompressed)
|
53
53
|
|
54
|
-
ParamsOfGetAddressType =
|
55
|
-
ResultOfGetAddressType =
|
54
|
+
ParamsOfGetAddressType = KwStruct.new(:address)
|
55
|
+
ResultOfGetAddressType = KwStruct.new(:address_type)
|
56
56
|
|
57
57
|
|
58
58
|
#
|
@@ -62,8 +62,8 @@ module TonSdk
|
|
62
62
|
def self.convert_address(ctx, params)
|
63
63
|
Interop::request_to_native_lib(ctx, "utils.convert_address", params) do |resp|
|
64
64
|
if resp.success?
|
65
|
-
yield
|
66
|
-
result: ResultOfConvertAddress.new(resp.result["address"])
|
65
|
+
yield NativeLibResponseResult.new(
|
66
|
+
result: ResultOfConvertAddress.new(address: resp.result["address"])
|
67
67
|
)
|
68
68
|
else
|
69
69
|
yield resp
|
@@ -74,8 +74,8 @@ module TonSdk
|
|
74
74
|
def self.calc_storage_fee(ctx, params)
|
75
75
|
Interop::request_to_native_lib(ctx, "utils.calc_storage_fee", params) do |resp|
|
76
76
|
if resp.success?
|
77
|
-
yield
|
78
|
-
result: ResultOfCalcStorageFee.new(resp.result["fee"])
|
77
|
+
yield NativeLibResponseResult.new(
|
78
|
+
result: ResultOfCalcStorageFee.new(fee: resp.result["fee"])
|
79
79
|
)
|
80
80
|
else
|
81
81
|
yield resp
|
@@ -86,8 +86,8 @@ module TonSdk
|
|
86
86
|
def self.compress_zstd(ctx, params)
|
87
87
|
Interop::request_to_native_lib(ctx, "utils.compress_zstd", params) do |resp|
|
88
88
|
if resp.success?
|
89
|
-
yield
|
90
|
-
result: ResultOfCompressZstd.new(resp.result["compressed"])
|
89
|
+
yield NativeLibResponseResult.new(
|
90
|
+
result: ResultOfCompressZstd.new(compressed: resp.result["compressed"])
|
91
91
|
)
|
92
92
|
else
|
93
93
|
yield resp
|
@@ -98,8 +98,8 @@ module TonSdk
|
|
98
98
|
def self.decompress_zstd(ctx, params)
|
99
99
|
Interop::request_to_native_lib(ctx, "utils.decompress_zstd", params) do |resp|
|
100
100
|
if resp.success?
|
101
|
-
yield
|
102
|
-
result:
|
101
|
+
yield NativeLibResponseResult.new(
|
102
|
+
result: ResultOfDecompressZstd.new(decompressed: resp.result["decompressed"])
|
103
103
|
)
|
104
104
|
else
|
105
105
|
yield resp
|
@@ -110,8 +110,8 @@ module TonSdk
|
|
110
110
|
def self.get_address_type(ctx, params)
|
111
111
|
Interop::request_to_native_lib(ctx, "utils.get_address_type", params) do |resp|
|
112
112
|
if resp.success?
|
113
|
-
yield
|
114
|
-
result: ResultOfGetAddressType.new(resp.result["address_type"])
|
113
|
+
yield NativeLibResponseResult.new(
|
114
|
+
result: ResultOfGetAddressType.new(address_type: resp.result["address_type"])
|
115
115
|
)
|
116
116
|
else
|
117
117
|
yield resp
|
@@ -119,4 +119,4 @@ module TonSdk
|
|
119
119
|
end
|
120
120
|
end
|
121
121
|
end
|
122
|
-
end
|
122
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ton_sdk_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.27.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Maslakov
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-12-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffi
|
@@ -102,8 +102,10 @@ files:
|
|
102
102
|
- lib/ton_sdk_client/debot.rb
|
103
103
|
- lib/ton_sdk_client/helper.rb
|
104
104
|
- lib/ton_sdk_client/interop.rb
|
105
|
+
- lib/ton_sdk_client/kw_struct.rb
|
105
106
|
- lib/ton_sdk_client/net.rb
|
106
107
|
- lib/ton_sdk_client/processing.rb
|
108
|
+
- lib/ton_sdk_client/proofs.rb
|
107
109
|
- lib/ton_sdk_client/tvm.rb
|
108
110
|
- lib/ton_sdk_client/types.rb
|
109
111
|
- lib/ton_sdk_client/utils.rb
|
@@ -112,7 +114,7 @@ homepage: https://github.com/radianceteam/ton-client-ruby
|
|
112
114
|
licenses:
|
113
115
|
- MIT
|
114
116
|
metadata: {}
|
115
|
-
post_install_message:
|
117
|
+
post_install_message:
|
116
118
|
rdoc_options: []
|
117
119
|
require_paths:
|
118
120
|
- lib
|
@@ -128,7 +130,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
128
130
|
version: '0'
|
129
131
|
requirements: []
|
130
132
|
rubygems_version: 3.2.22
|
131
|
-
signing_key:
|
133
|
+
signing_key:
|
132
134
|
specification_version: 4
|
133
135
|
summary: TON SDK client library, in Ruby and for Ruby
|
134
136
|
test_files: []
|