ton_sdk_client 1.24.0 → 1.28.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -16,9 +16,9 @@ module TonSdk
16
16
 
17
17
  def to_h
18
18
  {
19
- message: @message,
20
- abi: @abi.nil? ? nil : @abi.to_h,
21
- send_events: @send_events
19
+ message: message,
20
+ abi: abi&.to_h,
21
+ send_events: send_events
22
22
  }
23
23
  end
24
24
  end
@@ -37,10 +37,10 @@ module TonSdk
37
37
 
38
38
  def to_h
39
39
  {
40
- abi: @abi.nil? ? nil : @abi.to_h,
41
- message: @message,
42
- shard_block_id: @shard_block_id,
43
- send_events: @send_events
40
+ abi: abi&.to_h,
41
+ message: message,
42
+ shard_block_id: shard_block_id,
43
+ send_events: send_events
44
44
  }
45
45
  end
46
46
  end
@@ -57,10 +57,10 @@ module TonSdk
57
57
 
58
58
  def to_h
59
59
  {
60
- transaction: @transaction,
61
- out_messages: @out_messages,
62
- decoded: @decoded,
63
- fees: @fees
60
+ transaction: transaction,
61
+ out_messages: out_messages,
62
+ decoded: decoded,
63
+ fees: fees
64
64
  }
65
65
  end
66
66
  end
@@ -136,6 +136,10 @@ module TonSdk
136
136
  end
137
137
 
138
138
  ParamsOfProcessMessage = KwStruct.new(:message_encode_params, :send_events) do
139
+ def initialize(message_encode_params:, send_events:)
140
+ super
141
+ end
142
+
139
143
  def to_h
140
144
  {
141
145
  message_encode_params: message_encode_params.to_h,
@@ -162,7 +166,7 @@ module TonSdk
162
166
  is_single_thread_only: false
163
167
  ) do |resp|
164
168
  if resp.success?
165
- yield NativeLibResponsetResult.new(
169
+ yield NativeLibResponseResult.new(
166
170
  result: ResultOfSendMessage.new(shard_block_id: resp.result["shard_block_id"])
167
171
  )
168
172
  else
@@ -184,12 +188,15 @@ module TonSdk
184
188
  is_single_thread_only: false
185
189
  ) do |resp|
186
190
  if resp.success?
187
- yield NativeLibResponsetResult.new(
191
+ yield NativeLibResponseResult.new(
188
192
  result: ResultOfProcessMessage.new(
189
193
  transaction: resp.result["transaction"],
190
194
  out_messages: resp.result["out_messages"],
191
- decoded: resp.result["decoded"],
192
- fees: resp.result["fees"]
195
+ decoded: DecodedOutput.new(
196
+ out_messages: resp.result.dig("decoded", "out_messages"),
197
+ output: resp.result.dig("decoded", "output")
198
+ ),
199
+ fees: Tvm::TransactionFees.new(**resp.result["fees"].transform_keys(&:to_sym))
193
200
  )
194
201
  )
195
202
  else
@@ -211,12 +218,15 @@ module TonSdk
211
218
  is_single_thread_only: false
212
219
  ) do |resp|
213
220
  if resp.success?
214
- yield NativeLibResponsetResult.new(
221
+ yield NativeLibResponseResult.new(
215
222
  result: ResultOfProcessMessage.new(
216
223
  transaction: resp.result["transaction"],
217
224
  out_messages: resp.result["out_messages"],
218
- decoded: resp.result["decoded"],
219
- fees: resp.result["fees"]
225
+ decoded: DecodedOutput.new(
226
+ out_messages: resp.result.dig("decoded", "out_messages"),
227
+ output: resp.result.dig("decoded", "output")
228
+ ),
229
+ fees: Tvm::TransactionFees.new(**resp.result["fees"].transform_keys(&:to_sym))
220
230
  )
221
231
  )
222
232
  else
@@ -0,0 +1,61 @@
1
+ module TonSdk
2
+ module Proofs
3
+
4
+ #
5
+ # types
6
+ #
7
+
8
+ module ErrorCode
9
+ INVALID_DATA = 901
10
+ PROOF_CHECK_FAILED = 902
11
+ INTERNAL_ERROR = 903
12
+ DATA_DIFFERS_FROM_PROVEN = 904
13
+ end
14
+
15
+ ParamsOfProofBlockData = KwStruct.new(:block)
16
+
17
+ ParamsOfProofTransactionData = KwStruct.new(:transaction)
18
+
19
+ ParamsOfProofMessageData = KwStruct.new(:message)
20
+
21
+ #
22
+ # functions
23
+ #
24
+
25
+ def self.proof_block_data(ctx, params)
26
+ Interop::request_to_native_lib(ctx, "proofs.proof_block_data", params) do |resp|
27
+ if resp.success?
28
+ yield NativeLibResponseResult.new(
29
+ result: ""
30
+ )
31
+ else
32
+ yield resp
33
+ end
34
+ end
35
+ end
36
+
37
+ def self.proof_transaction_data(ctx, params)
38
+ Interop::request_to_native_lib(ctx, "proofs.proof_transaction_data", params) do |resp|
39
+ if resp.success?
40
+ yield NativeLibResponseResult.new(
41
+ result: ""
42
+ )
43
+ else
44
+ yield resp
45
+ end
46
+ end
47
+ end
48
+
49
+ def self.proof_message_data(ctx, params)
50
+ Interop::request_to_native_lib(ctx, "proofs.proof_message_data", params) do |resp|
51
+ if resp.success?
52
+ yield NativeLibResponseResult.new(
53
+ result: ""
54
+ )
55
+ else
56
+ yield resp
57
+ end
58
+ end
59
+ end
60
+ end
61
+ end
@@ -189,7 +189,7 @@ module TonSdk
189
189
  is_single_thread_only: false
190
190
  ) do |resp|
191
191
  if resp.success?
192
- yield NativeLibResponsetResult.new(
192
+ yield NativeLibResponseResult.new(
193
193
  result: ResultOfRunExecutor.new(
194
194
  transaction: resp.result["transaction"],
195
195
  out_messages: resp.result["out_messages"],
@@ -212,7 +212,7 @@ module TonSdk
212
212
  is_single_thread_only: false
213
213
  ) do |resp|
214
214
  if resp.success?
215
- yield NativeLibResponsetResult.new(
215
+ yield NativeLibResponseResult.new(
216
216
  result: ResultOfRunTvm.new(
217
217
  out_messages: resp.result["out_messages"],
218
218
  decoded: resp.result["decoded"],
@@ -233,7 +233,7 @@ module TonSdk
233
233
  is_single_thread_only: false
234
234
  ) do |resp|
235
235
  if resp.success?
236
- yield NativeLibResponsetResult.new(
236
+ yield NativeLibResponseResult.new(
237
237
  result: ResultOfRunGet.new(output: resp.result["output"])
238
238
  )
239
239
  else
@@ -17,7 +17,7 @@ module TonSdk
17
17
  end
18
18
  end
19
19
 
20
- class NativeLibResponsetResult
20
+ class NativeLibResponseResult
21
21
  attr_reader :result, :error
22
22
 
23
23
  def initialize(result: nil, error: nil)
@@ -62,7 +62,7 @@ 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 NativeLibResponsetResult.new(
65
+ yield NativeLibResponseResult.new(
66
66
  result: ResultOfConvertAddress.new(address: resp.result["address"])
67
67
  )
68
68
  else
@@ -74,7 +74,7 @@ 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 NativeLibResponsetResult.new(
77
+ yield NativeLibResponseResult.new(
78
78
  result: ResultOfCalcStorageFee.new(fee: resp.result["fee"])
79
79
  )
80
80
  else
@@ -86,7 +86,7 @@ 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 NativeLibResponsetResult.new(
89
+ yield NativeLibResponseResult.new(
90
90
  result: ResultOfCompressZstd.new(compressed: resp.result["compressed"])
91
91
  )
92
92
  else
@@ -98,7 +98,7 @@ 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 NativeLibResponsetResult.new(
101
+ yield NativeLibResponseResult.new(
102
102
  result: ResultOfDecompressZstd.new(decompressed: resp.result["decompressed"])
103
103
  )
104
104
  else
@@ -110,7 +110,7 @@ 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 NativeLibResponsetResult.new(
113
+ yield NativeLibResponseResult.new(
114
114
  result: ResultOfGetAddressType.new(address_type: resp.result["address_type"])
115
115
  )
116
116
  else
@@ -1,4 +1,4 @@
1
1
  module TonSdk
2
- VERSION = "1.24.0"
3
- NATIVE_SDK_VERSION = "1.24.0"
2
+ VERSION = "1.28.0"
3
+ NATIVE_SDK_VERSION = "1.28.0"
4
4
  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.24.0
4
+ version: 1.28.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Maslakov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-11-02 00:00:00.000000000 Z
11
+ date: 2022-01-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi
@@ -105,6 +105,7 @@ files:
105
105
  - lib/ton_sdk_client/kw_struct.rb
106
106
  - lib/ton_sdk_client/net.rb
107
107
  - lib/ton_sdk_client/processing.rb
108
+ - lib/ton_sdk_client/proofs.rb
108
109
  - lib/ton_sdk_client/tvm.rb
109
110
  - lib/ton_sdk_client/types.rb
110
111
  - lib/ton_sdk_client/utils.rb