ton-client-ruby 1.0.0 → 1.0.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.
@@ -1,5 +1,5 @@
1
1
  module TonClient
2
-
2
+
3
3
  class Net
4
4
  include CommonInstanceHelpers
5
5
 
@@ -11,62 +11,112 @@ module TonClient
11
11
  @core = core
12
12
  end
13
13
 
14
+ # INPUT: ParamsOfQuery
15
+ # query: String - # # GraphQL query text.
16
+ # variables: Value - # # Variables used in query. # # Must be a map with named values that can be used in query.
17
+ # RESPONSE: ResultOfQuery
18
+ # result: Value - # # Result provided by DAppServer.
14
19
  def query(payload, &block)
15
20
  core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
16
21
  end
17
22
 
23
+ # INPUT: ParamsOfBatchQuery
24
+ # operations: Array - # # List of query operations that must be performed per single fetch.
25
+ # RESPONSE: ResultOfBatchQuery
26
+ # results: Array - # # Result values for batched queries. # # Returns an array of values. Each value corresponds to `queries` item.
18
27
  def batch_query(payload, &block)
19
28
  core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
20
29
  end
21
30
 
31
+ # INPUT: ParamsOfQueryCollection
32
+ # collection: String - # # Collection name (accounts, blocks, transactions, messages, block_signatures)
33
+ # filter: Value - # # Collection filter
34
+ # result: String - # # Projection (result) string
35
+ # order: Array<Optional> - # # Sorting order
36
+ # limit: Number<Optional> - # # Number of documents to return
37
+ # RESPONSE: ResultOfQueryCollection
38
+ # result: Array - # # Objects that match the provided criteria
22
39
  def query_collection(payload, &block)
23
40
  core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
24
41
  end
25
42
 
43
+ # INPUT: ParamsOfAggregateCollection
44
+ # collection: String - # # Collection name (accounts, blocks, transactions, messages, block_signatures)
45
+ # filter: Value - # # Collection filter
46
+ # fields: Array<Optional> - # # Projection (result) string
47
+ # RESPONSE: ResultOfAggregateCollection
48
+ # values: Value - # # Values for requested fields. # # Returns an array of strings. Each string refers to the corresponding `fields` item.
49
+ # Numeric value is returned as a decimal string representations.
26
50
  def aggregate_collection(payload, &block)
27
51
  core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
28
52
  end
29
53
 
54
+ # INPUT: ParamsOfWaitForCollection
55
+ # collection: String - # # Collection name (accounts, blocks, transactions, messages, block_signatures)
56
+ # filter: Value - # # Collection filter
57
+ # result: String - # # Projection (result) string
58
+ # timeout: Number<Optional> - # # Query timeout
59
+ # RESPONSE: ResultOfWaitForCollection
60
+ # result: Value - # # First found object that matches the provided criteria
30
61
  def wait_for_collection(payload, &block)
31
62
  core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
32
63
  end
33
64
 
65
+ # INPUT: ResultOfSubscribeCollection
66
+ # handle: Number - # # Subscription handle. # # Must be closed with `unsubscribe`
34
67
  def unsubscribe(payload, &block)
35
68
  core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
36
69
  end
37
70
 
71
+ # INPUT: ParamsOfSubscribeCollection
72
+ # collection: String - # # Collection name (accounts, blocks, transactions, messages, block_signatures)
73
+ # filter: Value - # # Collection filter
74
+ # result: String - # # Projection (result) string
75
+ # RESPONSE: ResultOfSubscribeCollection
76
+ # handle: Number - # # Subscription handle. # # Must be closed with `unsubscribe`
38
77
  def subscribe_collection(payload, &block)
39
78
  core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
40
79
  end
41
80
 
42
- def suspend(payload, &block)
43
- core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
81
+ def suspend(&block)
82
+ core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: {}, &block)
44
83
  end
45
84
 
46
- def resume(payload, &block)
47
- core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
85
+ def resume(&block)
86
+ core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: {}, &block)
48
87
  end
49
88
 
89
+ # INPUT: ParamsOfFindLastShardBlock
90
+ # address: String - # # Account address
91
+ # RESPONSE: ResultOfFindLastShardBlock
92
+ # block_id: String - # # Account shard last block ID
50
93
  def find_last_shard_block(payload, &block)
51
94
  core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
52
95
  end
53
96
 
54
- def fetch_endpoints(payload, &block)
55
- core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
97
+ # RESPONSE: EndpointsSet
98
+ # endpoints: Array - # # List of endpoints provided by server
99
+ def fetch_endpoints(&block)
100
+ core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: {}, &block)
56
101
  end
57
102
 
103
+ # INPUT: EndpointsSet
104
+ # endpoints: Array - # # List of endpoints provided by server
58
105
  def set_endpoints(payload, &block)
59
106
  core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
60
107
  end
61
108
 
109
+ # INPUT: ParamsOfQueryCounterparties
110
+ # account: String - # # Account address
111
+ # result: String - # # Projection (result) string
112
+ # first: Number<Optional> - # # Number of counterparties to return
113
+ # after: String<Optional> - # # `cursor` field of the last received result
114
+ # RESPONSE: ResultOfQueryCollection
115
+ # result: Array - # # Objects that match the provided criteria
62
116
  def query_counterparties(payload, &block)
63
117
  core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
64
118
  end
119
+
65
120
  end
66
121
  end
67
122
 
68
-
69
-
70
-
71
-
72
-
@@ -1,5 +1,5 @@
1
1
  module TonClient
2
-
2
+
3
3
  class Processing
4
4
  include CommonInstanceHelpers
5
5
 
@@ -11,22 +11,47 @@ module TonClient
11
11
  @core = core
12
12
  end
13
13
 
14
+ # INPUT: ParamsOfSendMessage
15
+ # message: String - # # Message BOC.
16
+ # abi: Value<Optional> - # # Optional message ABI. # # If this parameter is specified and the message has the`expire` header then expiration time will be checked againstthe current time to prevent unnecessary sending of already expired message.
17
+ # The `message already expired` error will be returned in thiscase.
18
+ # Note, that specifying `abi` for ABI compliant contracts isstrongly recommended, so that proper processing strategy can bechosen.
19
+ # send_events: Boolean - # # Flag for requesting events sending
20
+ # RESPONSE: ResultOfSendMessage
21
+ # shard_block_id: String - # # The last generated shard block of the message destination account before the message was sent. # # This block id must be used as a parameter of the`wait_for_transaction`.
22
+ # sending_endpoints: Array - # # The list of endpoints to which the message was sent. # # This list id must be used as a parameter of the`wait_for_transaction`.
14
23
  def send_message(payload, &block)
15
24
  core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
16
25
  end
17
26
 
27
+ # INPUT: ParamsOfWaitForTransaction
28
+ # abi: Value<Optional> - # # Optional ABI for decoding the transaction result. # # If it is specified, then the output messages' bodies will bedecoded according to this ABI.
29
+ # The `abi_decoded` result field will be filled out.
30
+ # message: String - # # Message BOC. # # Encoded with `base64`.
31
+ # shard_block_id: String - # # The last generated block id of the destination account shard before the message was sent. # # You must provide the same value as the `send_message` has returned.
32
+ # send_events: Boolean - # # Flag that enables/disables intermediate events
33
+ # sending_endpoints: Array<Optional> - # # The list of endpoints to which the message was sent. # # You must provide the same value as the `send_message` has returned.
34
+ # RESPONSE: ResultOfProcessMessage
35
+ # transaction: Value - # # Parsed transaction. # # In addition to the regular transaction fields there is a`boc` field encoded with `base64` which contains sourcetransaction BOC.
36
+ # out_messages: Array - # # List of output messages' BOCs. # # Encoded as `base64`
37
+ # decoded: DecodedOutput<Optional> - # # Optional decoded message bodies according to the optional `abi` parameter.
38
+ # fees: TransactionFees - # # Transaction fees
18
39
  def wait_for_transaction(payload, &block)
19
40
  core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
20
41
  end
21
42
 
43
+ # INPUT: ParamsOfProcessMessage
44
+ # message_encode_params: ParamsOfEncodeMessage - # # Message encode parameters.
45
+ # send_events: Boolean - # # Flag for requesting events sending
46
+ # RESPONSE: ResultOfProcessMessage
47
+ # transaction: Value - # # Parsed transaction. # # In addition to the regular transaction fields there is a`boc` field encoded with `base64` which contains sourcetransaction BOC.
48
+ # out_messages: Array - # # List of output messages' BOCs. # # Encoded as `base64`
49
+ # decoded: DecodedOutput<Optional> - # # Optional decoded message bodies according to the optional `abi` parameter.
50
+ # fees: TransactionFees - # # Transaction fees
22
51
  def process_message(payload, &block)
23
52
  core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
24
53
  end
54
+
25
55
  end
26
56
  end
27
57
 
28
-
29
-
30
-
31
-
32
-
@@ -1,5 +1,5 @@
1
1
  module TonClient
2
-
2
+
3
3
  class Tvm
4
4
  include CommonInstanceHelpers
5
5
 
@@ -11,22 +11,52 @@ module TonClient
11
11
  @core = core
12
12
  end
13
13
 
14
+ # INPUT: ParamsOfRunExecutor
15
+ # message: String - # # Input message BOC. # # Must be encoded as base64.
16
+ # account: AccountForExecutor - # # Account to run on executor
17
+ # execution_options: ExecutionOptions<Optional> - # # Execution options.
18
+ # abi: Value<Optional> - # # Contract ABI for decoding output messages
19
+ # skip_transaction_check: Boolean<Optional> - # # Skip transaction check flag
20
+ # boc_cache: BocCacheType<Optional> - # # Cache type to put the result. # # The BOC itself returned if no cache type provided
21
+ # return_updated_account: Boolean<Optional> - # # Return updated account flag. # # Empty string is returned if the flag is `false`
22
+ # RESPONSE: ResultOfRunExecutor
23
+ # transaction: Value - # # Parsed transaction. # # In addition to the regular transaction fields there is a`boc` field encoded with `base64` which contains sourcetransaction BOC.
24
+ # out_messages: Array - # # List of output messages' BOCs. # # Encoded as `base64`
25
+ # decoded: DecodedOutput<Optional> - # # Optional decoded message bodies according to the optional `abi` parameter.
26
+ # account: String - # # Updated account state BOC. # # Encoded as `base64`
27
+ # fees: TransactionFees - # # Transaction fees
14
28
  def run_executor(payload, &block)
15
29
  core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
16
30
  end
17
31
 
32
+ # INPUT: ParamsOfRunTvm
33
+ # message: String - # # Input message BOC. # # Must be encoded as base64.
34
+ # account: String - # # Account BOC. # # Must be encoded as base64.
35
+ # execution_options: ExecutionOptions<Optional> - # # Execution options.
36
+ # abi: Value<Optional> - # # Contract ABI for decoding output messages
37
+ # boc_cache: BocCacheType<Optional> - # # Cache type to put the result. # # The BOC itself returned if no cache type provided
38
+ # return_updated_account: Boolean<Optional> - # # Return updated account flag. # # Empty string is returned if the flag is `false`
39
+ # RESPONSE: ResultOfRunTvm
40
+ # out_messages: Array - # # List of output messages' BOCs. # # Encoded as `base64`
41
+ # decoded: DecodedOutput<Optional> - # # Optional decoded message bodies according to the optional `abi` parameter.
42
+ # account: String - # # Updated account state BOC. # # Encoded as `base64`. Attention! Only `account_state.storage.state.data` part of the BOC is updated.
18
43
  def run_tvm(payload, &block)
19
44
  core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
20
45
  end
21
46
 
47
+ # INPUT: ParamsOfRunGet
48
+ # account: String - # # Account BOC in `base64`
49
+ # function_name: String - # # Function name
50
+ # input: Value - # # Input parameters
51
+ # execution_options: ExecutionOptions<Optional> - # # Execution options
52
+ # tuple_list_as_array: Boolean<Optional> - # # Convert lists based on nested tuples in the **result** into plain arrays. # # Default is `false`. Input parameters may use any of lists representationsIf you receive this error on Web: "Runtime error. Unreachable code should not be executed...",set this flag to true.
53
+ # This may happen, for example, when elector contract contains too many participants
54
+ # RESPONSE: ResultOfRunGet
55
+ # output: Value - # # Values returned by get-method on stack
22
56
  def run_get(payload, &block)
23
57
  core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
24
58
  end
59
+
25
60
  end
26
61
  end
27
62
 
28
-
29
-
30
-
31
-
32
-
@@ -1,5 +1,5 @@
1
1
  module TonClient
2
-
2
+
3
3
  class Utils
4
4
  include CommonInstanceHelpers
5
5
 
@@ -11,26 +11,41 @@ module TonClient
11
11
  @core = core
12
12
  end
13
13
 
14
+ # INPUT: ParamsOfConvertAddress
15
+ # address: String - # # Account address in any TON format.
16
+ # output_format: AddressStringFormat - # # Specify the format to convert to.
17
+ # RESPONSE: ResultOfConvertAddress
18
+ # address: String - # # Address in the specified format
14
19
  def convert_address(payload, &block)
15
20
  core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
16
21
  end
17
22
 
23
+ # INPUT: ParamsOfCalcStorageFee
24
+ # account: String -
25
+ # period: Number -
26
+ # RESPONSE: ResultOfCalcStorageFee
27
+ # fee: String -
18
28
  def calc_storage_fee(payload, &block)
19
29
  core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
20
30
  end
21
31
 
32
+ # INPUT: ParamsOfCompressZstd
33
+ # uncompressed: String - # # Uncompressed data. # # Must be encoded as base64.
34
+ # level: Number<Optional> - # # Compression level, from 1 to 21. Where: 1 - lowest compression level (fastest compression); 21 - highest compression level (slowest compression). If level is omitted, the default compression level is used (currently `3`).
35
+ # RESPONSE: ResultOfCompressZstd
36
+ # compressed: String - # # Compressed data. # # Must be encoded as base64.
22
37
  def compress_zstd(payload, &block)
23
38
  core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
24
39
  end
25
40
 
41
+ # INPUT: ParamsOfDecompressZstd
42
+ # compressed: String - # # Compressed data. # # Must be encoded as base64.
43
+ # RESPONSE: ResultOfDecompressZstd
44
+ # decompressed: String - # # Decompressed data. # # Must be encoded as base64.
26
45
  def decompress_zstd(payload, &block)
27
46
  core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
28
47
  end
48
+
29
49
  end
30
50
  end
31
51
 
32
-
33
-
34
-
35
-
36
-
@@ -23,6 +23,14 @@ module CommonInstanceHelpers
23
23
  def full_method_name(module_name, method_name)
24
24
  "#{module_name}.#{method_name}"
25
25
  end
26
+
27
+ def base64?(value)
28
+ value.is_a?(String) && (Base64.encode64(Base64.decode64(value)).strip == value)
29
+ end
30
+
31
+ def encode_to_base64(message)
32
+ Base64.encode64(message.force_encoding('UTF-8')).strip
33
+ end
26
34
  end
27
35
 
28
36
  class << Object
@@ -1,3 +1,3 @@
1
1
  module TonClient
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ton-client-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - nerzh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-05-10 00:00:00.000000000 Z
11
+ date: 2021-05-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 1.13.1
19
+ version: 1.15.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 1.13.1
26
+ version: 1.15.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: dotenv
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -97,10 +97,12 @@ dependencies:
97
97
  description: Gem Ton Client Ruby for all ruby projects
98
98
  email:
99
99
  - emptystamp@gmail.com
100
- executables: []
100
+ executables:
101
+ - ton-client-ruby
101
102
  extensions: []
102
103
  extra_rdoc_files: []
103
104
  files:
105
+ - bin/ton-client-ruby
104
106
  - lib/ton-client-ruby.rb
105
107
  - lib/ton-client-ruby/Binding/binding.rb
106
108
  - lib/ton-client-ruby/Binding/struct.rb