everscale-client-ruby 1.1.23
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/bin/ton-client-ruby +50 -0
- data/lib/code_generator/api.json +13837 -0
- data/lib/code_generator/api_converter.rb +400 -0
- data/lib/code_generator/code_generator.rb +339 -0
- data/lib/code_generator/helpers.rb +13 -0
- data/lib/code_generator/release.rb +48 -0
- data/lib/everscale-client-ruby/Binding/binding.rb +209 -0
- data/lib/everscale-client-ruby/Binding/struct.rb +21 -0
- data/lib/everscale-client-ruby/Client/Abi.rb +196 -0
- data/lib/everscale-client-ruby/Client/Boc.rb +196 -0
- data/lib/everscale-client-ruby/Client/Client.rb +83 -0
- data/lib/everscale-client-ruby/Client/Context.rb +34 -0
- data/lib/everscale-client-ruby/Client/Crypto.rb +465 -0
- data/lib/everscale-client-ruby/Client/Debot.rb +60 -0
- data/lib/everscale-client-ruby/Client/Net.rb +237 -0
- data/lib/everscale-client-ruby/Client/Processing.rb +59 -0
- data/lib/everscale-client-ruby/Client/Proofs.rb +34 -0
- data/lib/everscale-client-ruby/Client/Tvm.rb +62 -0
- data/lib/everscale-client-ruby/Client/Utils.rb +59 -0
- data/lib/everscale-client-ruby/Helpers/CommonHelpers.rb +70 -0
- data/lib/everscale-client-ruby/version.rb +4 -0
- data/lib/everscale-client-ruby.rb +44 -0
- metadata +164 -0
@@ -0,0 +1,196 @@
|
|
1
|
+
module TonClient
|
2
|
+
|
3
|
+
class Abi
|
4
|
+
include CommonInstanceHelpers
|
5
|
+
|
6
|
+
attr_reader :core, :context
|
7
|
+
MODULE = self.to_s.downcase.gsub(/^(.+::|)(\w+)$/, '\2').freeze
|
8
|
+
|
9
|
+
def initialize(context: Context.new, core: TonClient::TonBinding)
|
10
|
+
@context = context
|
11
|
+
@core = core
|
12
|
+
end
|
13
|
+
|
14
|
+
# INPUT: ParamsOfEncodeMessageBody
|
15
|
+
# abi: Value - # # Contract ABI.
|
16
|
+
# call_set: CallSet - # # Function call parameters. # # Must be specified in non deploy message.
|
17
|
+
# In case of deploy message contains parameters of constructor.
|
18
|
+
# is_internal: Boolean - # # True if internal message body must be encoded.
|
19
|
+
# signer: Signer - # # Signing parameters.
|
20
|
+
# processing_try_index: Number<Optional> - # # Processing try index. # # Used in message processing with retries.
|
21
|
+
# Encoder uses the provided try index to calculate messageexpiration time.
|
22
|
+
# Expiration timeouts will grow with every retry.
|
23
|
+
# Default value is 0.
|
24
|
+
# RESPONSE: ResultOfEncodeMessageBody
|
25
|
+
# body: String - # # Message body BOC encoded with `base64`.
|
26
|
+
# data_to_sign: String<Optional> - # # Optional data to sign. # # Encoded with `base64`.
|
27
|
+
# # Presents when `message` is unsigned. Can be used for externalmessage signing. Is this case you need to sing this data andproduce signed message using `abi.attach_signature`.
|
28
|
+
def encode_message_body(payload, &block)
|
29
|
+
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
30
|
+
end
|
31
|
+
|
32
|
+
# INPUT: ParamsOfAttachSignatureToMessageBody
|
33
|
+
# abi: Value - # # Contract ABI
|
34
|
+
# public_key: String - # # Public key. # # Must be encoded with `hex`.
|
35
|
+
# message: String - # # Unsigned message body BOC. # # Must be encoded with `base64`.
|
36
|
+
# signature: String - # # Signature. # # Must be encoded with `hex`.
|
37
|
+
# RESPONSE: ResultOfAttachSignatureToMessageBody
|
38
|
+
# body: String -
|
39
|
+
def attach_signature_to_message_body(payload, &block)
|
40
|
+
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
41
|
+
end
|
42
|
+
|
43
|
+
# INPUT: ParamsOfEncodeMessage
|
44
|
+
# abi: Value - # # Contract ABI.
|
45
|
+
# address: String<Optional> - # # Target address the message will be sent to. # # Must be specified in case of non-deploy message.
|
46
|
+
# deploy_set: DeploySet<Optional> - # # Deploy parameters. # # Must be specified in case of deploy message.
|
47
|
+
# call_set: CallSet<Optional> - # # Function call parameters. # # Must be specified in case of non-deploy message.
|
48
|
+
# In case of deploy message it is optional and contains parametersof the functions that will to be called upon deploy transaction.
|
49
|
+
# signer: Signer - # # Signing parameters.
|
50
|
+
# processing_try_index: Number<Optional> - # # Processing try index. # # Used in message processing with retries (if contract's ABI includes "expire" header).
|
51
|
+
# Encoder uses the provided try index to calculate messageexpiration time. The 1st message expiration time is specified inClient config.
|
52
|
+
# Expiration timeouts will grow with every retry.
|
53
|
+
# Retry grow factor is set in Client config:
|
54
|
+
# <.....add config parameter with default value here>Default value is 0.
|
55
|
+
# RESPONSE: ResultOfEncodeMessage
|
56
|
+
# message: String - # # Message BOC encoded with `base64`.
|
57
|
+
# data_to_sign: String<Optional> - # # Optional data to be signed encoded in `base64`. # # Returned in case of `Signer::External`. Can be used for externalmessage signing. Is this case you need to use this data to create signature andthen produce signed message using `abi.attach_signature`.
|
58
|
+
# address: String - # # Destination address.
|
59
|
+
# message_id: String - # # Message id.
|
60
|
+
def encode_message(payload, &block)
|
61
|
+
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
62
|
+
end
|
63
|
+
|
64
|
+
# INPUT: ParamsOfEncodeInternalMessage
|
65
|
+
# abi: Value<Optional> - # # Contract ABI. # # Can be None if both deploy_set and call_set are None.
|
66
|
+
# address: String<Optional> - # # Target address the message will be sent to. # # Must be specified in case of non-deploy message.
|
67
|
+
# src_address: String<Optional> - # # Source address of the message.
|
68
|
+
# deploy_set: DeploySet<Optional> - # # Deploy parameters. # # Must be specified in case of deploy message.
|
69
|
+
# call_set: CallSet<Optional> - # # Function call parameters. # # Must be specified in case of non-deploy message.
|
70
|
+
# In case of deploy message it is optional and contains parametersof the functions that will to be called upon deploy transaction.
|
71
|
+
# value: String - # # Value in nanotokens to be sent with message.
|
72
|
+
# bounce: Boolean<Optional> - # # Flag of bounceable message. # # Default is true.
|
73
|
+
# enable_ihr: Boolean<Optional> - # # Enable Instant Hypercube Routing for the message. # # Default is false.
|
74
|
+
# RESPONSE: ResultOfEncodeInternalMessage
|
75
|
+
# message: String - # # Message BOC encoded with `base64`.
|
76
|
+
# address: String - # # Destination address.
|
77
|
+
# message_id: String - # # Message id.
|
78
|
+
def encode_internal_message(payload, &block)
|
79
|
+
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
80
|
+
end
|
81
|
+
|
82
|
+
# INPUT: ParamsOfAttachSignature
|
83
|
+
# abi: Value - # # Contract ABI
|
84
|
+
# public_key: String - # # Public key encoded in `hex`.
|
85
|
+
# message: String - # # Unsigned message BOC encoded in `base64`.
|
86
|
+
# signature: String - # # Signature encoded in `hex`.
|
87
|
+
# RESPONSE: ResultOfAttachSignature
|
88
|
+
# message: String - # # Signed message BOC
|
89
|
+
# message_id: String - # # Message ID
|
90
|
+
def attach_signature(payload, &block)
|
91
|
+
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
92
|
+
end
|
93
|
+
|
94
|
+
# INPUT: ParamsOfDecodeMessage
|
95
|
+
# abi: Value - # # contract ABI
|
96
|
+
# message: String - # # Message BOC
|
97
|
+
# RESPONSE: DecodedMessageBody
|
98
|
+
# body_type: MessageBodyType - # # Type of the message body content.
|
99
|
+
# name: String - # # Function or event name.
|
100
|
+
# value: Value<Optional> - # # Parameters or result value.
|
101
|
+
# header: FunctionHeader<Optional> - # # Function header.
|
102
|
+
def decode_message(payload, &block)
|
103
|
+
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
104
|
+
end
|
105
|
+
|
106
|
+
# INPUT: ParamsOfDecodeMessageBody
|
107
|
+
# abi: Value - # # Contract ABI used to decode.
|
108
|
+
# body: String - # # Message body BOC encoded in `base64`.
|
109
|
+
# is_internal: Boolean - # # True if the body belongs to the internal message.
|
110
|
+
# RESPONSE: DecodedMessageBody
|
111
|
+
# body_type: MessageBodyType - # # Type of the message body content.
|
112
|
+
# name: String - # # Function or event name.
|
113
|
+
# value: Value<Optional> - # # Parameters or result value.
|
114
|
+
# header: FunctionHeader<Optional> - # # Function header.
|
115
|
+
def decode_message_body(payload, &block)
|
116
|
+
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
117
|
+
end
|
118
|
+
|
119
|
+
# INPUT: ParamsOfEncodeAccount
|
120
|
+
# state_init: StateInitSource - # # Source of the account state init.
|
121
|
+
# balance: BigInt<Optional> - # # Initial balance.
|
122
|
+
# last_trans_lt: BigInt<Optional> - # # Initial value for the `last_trans_lt`.
|
123
|
+
# last_paid: Number<Optional> - # # Initial value for the `last_paid`.
|
124
|
+
# boc_cache: BocCacheType<Optional> - # # Cache type to put the result. # # The BOC itself returned if no cache type provided
|
125
|
+
# RESPONSE: ResultOfEncodeAccount
|
126
|
+
# account: String - # # Account BOC encoded in `base64`.
|
127
|
+
# id: String - # # Account ID encoded in `hex`.
|
128
|
+
def encode_account(payload, &block)
|
129
|
+
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
130
|
+
end
|
131
|
+
|
132
|
+
# INPUT: ParamsOfDecodeAccountData
|
133
|
+
# abi: Value - # # Contract ABI
|
134
|
+
# data: String - # # Data BOC or BOC handle
|
135
|
+
# RESPONSE: ResultOfDecodeAccountData
|
136
|
+
# data: Value - # # Decoded data as a JSON structure.
|
137
|
+
def decode_account_data(payload, &block)
|
138
|
+
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
139
|
+
end
|
140
|
+
|
141
|
+
# INPUT: ParamsOfUpdateInitialData
|
142
|
+
# abi: Value<Optional> - # # Contract ABI
|
143
|
+
# data: String - # # Data BOC or BOC handle
|
144
|
+
# initial_data: Value - # # List of initial values for contract's static variables. # # `abi` parameter should be provided to set initial data
|
145
|
+
# initial_pubkey: String<Optional> - # # Initial account owner's public key to set into account data
|
146
|
+
# boc_cache: BocCacheType<Optional> - # # Cache type to put the result. The BOC itself returned if no cache type provided.
|
147
|
+
# RESPONSE: ResultOfUpdateInitialData
|
148
|
+
# data: String - # # Updated data BOC or BOC handle
|
149
|
+
def update_initial_data(payload, &block)
|
150
|
+
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
151
|
+
end
|
152
|
+
|
153
|
+
# INPUT: ParamsOfEncodeInitialData
|
154
|
+
# abi: Value<Optional> - # # Contract ABI
|
155
|
+
# initial_data: Value - # # List of initial values for contract's static variables. # # `abi` parameter should be provided to set initial data
|
156
|
+
# initial_pubkey: String<Optional> - # # Initial account owner's public key to set into account data
|
157
|
+
# boc_cache: BocCacheType<Optional> - # # Cache type to put the result. The BOC itself returned if no cache type provided.
|
158
|
+
# RESPONSE: ResultOfEncodeInitialData
|
159
|
+
# data: String - # # Updated data BOC or BOC handle
|
160
|
+
def encode_initial_data(payload, &block)
|
161
|
+
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
162
|
+
end
|
163
|
+
|
164
|
+
# INPUT: ParamsOfDecodeInitialData
|
165
|
+
# abi: Value<Optional> - # # Contract ABI. # # Initial data is decoded if this parameter is provided
|
166
|
+
# data: String - # # Data BOC or BOC handle
|
167
|
+
# RESPONSE: ResultOfDecodeInitialData
|
168
|
+
# initial_data: Value<Optional> - # # List of initial values of contract's public variables. # # Initial data is decoded if `abi` input parameter is provided
|
169
|
+
# initial_pubkey: String - # # Initial account owner's public key
|
170
|
+
def decode_initial_data(payload, &block)
|
171
|
+
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
172
|
+
end
|
173
|
+
|
174
|
+
# INPUT: ParamsOfDecodeBoc
|
175
|
+
# params: Array - # # Parameters to decode from BOC
|
176
|
+
# boc: String - # # Data BOC or BOC handle
|
177
|
+
# allow_partial: Boolean -
|
178
|
+
# RESPONSE: ResultOfDecodeBoc
|
179
|
+
# data: Value - # # Decoded data as a JSON structure.
|
180
|
+
def decode_boc(payload, &block)
|
181
|
+
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
182
|
+
end
|
183
|
+
|
184
|
+
# INPUT: ParamsOfAbiEncodeBoc
|
185
|
+
# params: Array - # # Parameters to encode into BOC
|
186
|
+
# data: Value - # # Parameters and values as a JSON structure
|
187
|
+
# boc_cache: BocCacheType<Optional> - # # Cache type to put the result. # # The BOC itself returned if no cache type provided
|
188
|
+
# RESPONSE: ResultOfAbiEncodeBoc
|
189
|
+
# boc: String - # # BOC encoded as base64
|
190
|
+
def encode_boc(payload, &block)
|
191
|
+
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
192
|
+
end
|
193
|
+
|
194
|
+
end
|
195
|
+
end
|
196
|
+
|
@@ -0,0 +1,196 @@
|
|
1
|
+
module TonClient
|
2
|
+
|
3
|
+
class Boc
|
4
|
+
include CommonInstanceHelpers
|
5
|
+
|
6
|
+
attr_reader :core, :context
|
7
|
+
MODULE = self.to_s.downcase.gsub(/^(.+::|)(\w+)$/, '\2').freeze
|
8
|
+
|
9
|
+
def initialize(context: Context.new, core: TonClient::TonBinding)
|
10
|
+
@context = context
|
11
|
+
@core = core
|
12
|
+
end
|
13
|
+
|
14
|
+
# INPUT: ParamsOfParse
|
15
|
+
# boc: String - # # BOC encoded as base64
|
16
|
+
# RESPONSE: ResultOfParse
|
17
|
+
# parsed: Value - # # JSON containing parsed BOC
|
18
|
+
def parse_message(payload, &block)
|
19
|
+
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
20
|
+
end
|
21
|
+
|
22
|
+
# INPUT: ParamsOfParse
|
23
|
+
# boc: String - # # BOC encoded as base64
|
24
|
+
# RESPONSE: ResultOfParse
|
25
|
+
# parsed: Value - # # JSON containing parsed BOC
|
26
|
+
def parse_transaction(payload, &block)
|
27
|
+
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
28
|
+
end
|
29
|
+
|
30
|
+
# INPUT: ParamsOfParse
|
31
|
+
# boc: String - # # BOC encoded as base64
|
32
|
+
# RESPONSE: ResultOfParse
|
33
|
+
# parsed: Value - # # JSON containing parsed BOC
|
34
|
+
def parse_account(payload, &block)
|
35
|
+
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
36
|
+
end
|
37
|
+
|
38
|
+
# INPUT: ParamsOfParse
|
39
|
+
# boc: String - # # BOC encoded as base64
|
40
|
+
# RESPONSE: ResultOfParse
|
41
|
+
# parsed: Value - # # JSON containing parsed BOC
|
42
|
+
def parse_block(payload, &block)
|
43
|
+
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
44
|
+
end
|
45
|
+
|
46
|
+
# INPUT: ParamsOfParseShardstate
|
47
|
+
# boc: String - # # BOC encoded as base64
|
48
|
+
# id: String - # # Shardstate identificator
|
49
|
+
# workchain_id: Number - # # Workchain shardstate belongs to
|
50
|
+
# RESPONSE: ResultOfParse
|
51
|
+
# parsed: Value - # # JSON containing parsed BOC
|
52
|
+
def parse_shardstate(payload, &block)
|
53
|
+
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
54
|
+
end
|
55
|
+
|
56
|
+
# INPUT: ParamsOfGetBlockchainConfig
|
57
|
+
# block_boc: String - # # Key block BOC or zerostate BOC encoded as base64
|
58
|
+
# RESPONSE: ResultOfGetBlockchainConfig
|
59
|
+
# config_boc: String - # # Blockchain config BOC encoded as base64
|
60
|
+
def get_blockchain_config(payload, &block)
|
61
|
+
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
62
|
+
end
|
63
|
+
|
64
|
+
# INPUT: ParamsOfGetBocHash
|
65
|
+
# boc: String - # # BOC encoded as base64 or BOC handle
|
66
|
+
# RESPONSE: ResultOfGetBocHash
|
67
|
+
# hash: String - # # BOC root hash encoded with hex
|
68
|
+
def get_boc_hash(payload, &block)
|
69
|
+
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
70
|
+
end
|
71
|
+
|
72
|
+
# INPUT: ParamsOfGetBocDepth
|
73
|
+
# boc: String - # # BOC encoded as base64 or BOC handle
|
74
|
+
# RESPONSE: ResultOfGetBocDepth
|
75
|
+
# depth: Number - # # BOC root cell depth
|
76
|
+
def get_boc_depth(payload, &block)
|
77
|
+
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
78
|
+
end
|
79
|
+
|
80
|
+
# INPUT: ParamsOfGetCodeFromTvc
|
81
|
+
# tvc: String - # # Contract TVC image or image BOC handle
|
82
|
+
# RESPONSE: ResultOfGetCodeFromTvc
|
83
|
+
# code: String - # # Contract code encoded as base64
|
84
|
+
def get_code_from_tvc(payload, &block)
|
85
|
+
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
86
|
+
end
|
87
|
+
|
88
|
+
# INPUT: ParamsOfBocCacheGet
|
89
|
+
# boc_ref: String - # # Reference to the cached BOC
|
90
|
+
# RESPONSE: ResultOfBocCacheGet
|
91
|
+
# boc: String<Optional> - # # BOC encoded as base64.
|
92
|
+
def cache_get(payload, &block)
|
93
|
+
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
94
|
+
end
|
95
|
+
|
96
|
+
# INPUT: ParamsOfBocCacheSet
|
97
|
+
# boc: String - # # BOC encoded as base64 or BOC reference
|
98
|
+
# cache_type: BocCacheType - # # Cache type
|
99
|
+
# RESPONSE: ResultOfBocCacheSet
|
100
|
+
# boc_ref: String - # # Reference to the cached BOC
|
101
|
+
def cache_set(payload, &block)
|
102
|
+
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
103
|
+
end
|
104
|
+
|
105
|
+
# INPUT: ParamsOfBocCacheUnpin
|
106
|
+
# pin: String - # # Pinned name
|
107
|
+
# boc_ref: String<Optional> - # # Reference to the cached BOC. # # If it is provided then only referenced BOC is unpinned
|
108
|
+
def cache_unpin(payload, &block)
|
109
|
+
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
110
|
+
end
|
111
|
+
|
112
|
+
# INPUT: ParamsOfEncodeBoc
|
113
|
+
# builder: Array - # # Cell builder operations.
|
114
|
+
# boc_cache: BocCacheType<Optional> - # # Cache type to put the result. The BOC itself returned if no cache type provided.
|
115
|
+
# RESPONSE: ResultOfEncodeBoc
|
116
|
+
# boc: String - # # Encoded cell BOC or BOC cache key.
|
117
|
+
def encode_boc(payload, &block)
|
118
|
+
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
119
|
+
end
|
120
|
+
|
121
|
+
# INPUT: ParamsOfGetCodeSalt
|
122
|
+
# code: String - # # Contract code BOC encoded as base64 or code BOC handle
|
123
|
+
# boc_cache: BocCacheType<Optional> - # # Cache type to put the result. The BOC itself returned if no cache type provided.
|
124
|
+
# RESPONSE: ResultOfGetCodeSalt
|
125
|
+
# salt: String<Optional> - # # Contract code salt if present. # # BOC encoded as base64 or BOC handle
|
126
|
+
def get_code_salt(payload, &block)
|
127
|
+
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
128
|
+
end
|
129
|
+
|
130
|
+
# INPUT: ParamsOfSetCodeSalt
|
131
|
+
# code: String - # # Contract code BOC encoded as base64 or code BOC handle
|
132
|
+
# salt: String - # # Code salt to set. # # BOC encoded as base64 or BOC handle
|
133
|
+
# boc_cache: BocCacheType<Optional> - # # Cache type to put the result. The BOC itself returned if no cache type provided.
|
134
|
+
# RESPONSE: ResultOfSetCodeSalt
|
135
|
+
# code: String - # # Contract code with salt set. # # BOC encoded as base64 or BOC handle
|
136
|
+
def set_code_salt(payload, &block)
|
137
|
+
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
138
|
+
end
|
139
|
+
|
140
|
+
# INPUT: ParamsOfDecodeTvc
|
141
|
+
# tvc: String - # # Contract TVC image BOC encoded as base64 or BOC handle
|
142
|
+
# boc_cache: BocCacheType<Optional> - # # Cache type to put the result. The BOC itself returned if no cache type provided.
|
143
|
+
# RESPONSE: ResultOfDecodeTvc
|
144
|
+
# code: String<Optional> - # # Contract code BOC encoded as base64 or BOC handle
|
145
|
+
# code_hash: String<Optional> - # # Contract code hash
|
146
|
+
# code_depth: Number<Optional> - # # Contract code depth
|
147
|
+
# data: String<Optional> - # # Contract data BOC encoded as base64 or BOC handle
|
148
|
+
# data_hash: String<Optional> - # # Contract data hash
|
149
|
+
# data_depth: Number<Optional> - # # Contract data depth
|
150
|
+
# library: String<Optional> - # # Contract library BOC encoded as base64 or BOC handle
|
151
|
+
# tick: Boolean<Optional> - # # `special.tick` field. # # Specifies the contract ability to handle tick transactions
|
152
|
+
# tock: Boolean<Optional> - # # `special.tock` field. # # Specifies the contract ability to handle tock transactions
|
153
|
+
# split_depth: Number<Optional> - # # Is present and non-zero only in instances of large smart contracts
|
154
|
+
# compiler_version: String<Optional> - # # Compiler version, for example 'sol 0.49.0'
|
155
|
+
def decode_tvc(payload, &block)
|
156
|
+
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
157
|
+
end
|
158
|
+
|
159
|
+
# INPUT: ParamsOfEncodeTvc
|
160
|
+
# code: String<Optional> - # # Contract code BOC encoded as base64 or BOC handle
|
161
|
+
# data: String<Optional> - # # Contract data BOC encoded as base64 or BOC handle
|
162
|
+
# library: String<Optional> - # # Contract library BOC encoded as base64 or BOC handle
|
163
|
+
# tick: Boolean<Optional> - # # `special.tick` field. # # Specifies the contract ability to handle tick transactions
|
164
|
+
# tock: Boolean<Optional> - # # `special.tock` field. # # Specifies the contract ability to handle tock transactions
|
165
|
+
# split_depth: Number<Optional> - # # Is present and non-zero only in instances of large smart contracts
|
166
|
+
# boc_cache: BocCacheType<Optional> - # # Cache type to put the result. The BOC itself returned if no cache type provided.
|
167
|
+
# RESPONSE: ResultOfEncodeTvc
|
168
|
+
# tvc: String - # # Contract TVC image BOC encoded as base64 or BOC handle of boc_cache parameter was specified
|
169
|
+
def encode_tvc(payload, &block)
|
170
|
+
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
171
|
+
end
|
172
|
+
|
173
|
+
# INPUT: ParamsOfEncodeExternalInMessage
|
174
|
+
# src: String<Optional> - # # Source address.
|
175
|
+
# dst: String - # # Destination address.
|
176
|
+
# init: String<Optional> - # # Bag of cells with state init (used in deploy messages).
|
177
|
+
# body: String<Optional> - # # Bag of cells with the message body encoded as base64.
|
178
|
+
# boc_cache: BocCacheType<Optional> - # # Cache type to put the result. # # The BOC itself returned if no cache type provided
|
179
|
+
# RESPONSE: ResultOfEncodeExternalInMessage
|
180
|
+
# message: String - # # Message BOC encoded with `base64`.
|
181
|
+
# message_id: String - # # Message id.
|
182
|
+
def encode_external_in_message(payload, &block)
|
183
|
+
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
184
|
+
end
|
185
|
+
|
186
|
+
# INPUT: ParamsOfGetCompilerVersion
|
187
|
+
# code: String - # # Contract code BOC encoded as base64 or code BOC handle
|
188
|
+
# RESPONSE: ResultOfGetCompilerVersion
|
189
|
+
# version: String<Optional> - # # Compiler version, for example 'sol 0.49.0'
|
190
|
+
def get_compiler_version(payload, &block)
|
191
|
+
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
192
|
+
end
|
193
|
+
|
194
|
+
end
|
195
|
+
end
|
196
|
+
|
@@ -0,0 +1,83 @@
|
|
1
|
+
module TonClient
|
2
|
+
|
3
|
+
class Client
|
4
|
+
include CommonInstanceHelpers
|
5
|
+
|
6
|
+
attr_reader :core, :context
|
7
|
+
private_accessor :_crypto, :_abi, :_boc, :_processing, :_utils, :_tvm, :_net, :_debot, :_proofs
|
8
|
+
MODULE = self.to_s.downcase.gsub(/^(.+::|)(\w+)$/, '\2').freeze
|
9
|
+
|
10
|
+
def initialize(context: Context.new, core: TonClient::TonBinding)
|
11
|
+
@context = context
|
12
|
+
@core = core
|
13
|
+
end
|
14
|
+
|
15
|
+
def destroy_context
|
16
|
+
core.tc_destroy_context(context.id)
|
17
|
+
end
|
18
|
+
|
19
|
+
def crypto
|
20
|
+
_crypto ||= Crypto.new(context: context)
|
21
|
+
end
|
22
|
+
|
23
|
+
def abi
|
24
|
+
_abi ||= Abi.new(context: context)
|
25
|
+
end
|
26
|
+
|
27
|
+
def boc
|
28
|
+
_boc ||= Boc.new(context: context)
|
29
|
+
end
|
30
|
+
|
31
|
+
def processing
|
32
|
+
_processing ||= Processing.new(context: context)
|
33
|
+
end
|
34
|
+
|
35
|
+
def utils
|
36
|
+
_utils ||= Utils.new(context: context)
|
37
|
+
end
|
38
|
+
|
39
|
+
def tvm
|
40
|
+
_tvm ||= Tvm.new(context: context)
|
41
|
+
end
|
42
|
+
|
43
|
+
def net
|
44
|
+
_net ||= Net.new(context: context)
|
45
|
+
end
|
46
|
+
|
47
|
+
def debot
|
48
|
+
_debot ||= Debot.new(context: context)
|
49
|
+
end
|
50
|
+
|
51
|
+
def proofs
|
52
|
+
_proofs ||= Proofs.new(context: context)
|
53
|
+
end
|
54
|
+
|
55
|
+
# RESPONSE: ResultOfGetApiReference
|
56
|
+
# api: Value -
|
57
|
+
def get_api_reference(&block)
|
58
|
+
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: {}, &block)
|
59
|
+
end
|
60
|
+
|
61
|
+
# RESPONSE: ResultOfVersion
|
62
|
+
# version: String - # # Core Library version
|
63
|
+
def version(&block)
|
64
|
+
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: {}, &block)
|
65
|
+
end
|
66
|
+
|
67
|
+
# RESPONSE: ResultOfBuildInfo
|
68
|
+
# build_number: Number - # # Build number assigned to this build by the CI.
|
69
|
+
# dependencies: Array - # # Fingerprint of the most important dependencies.
|
70
|
+
def build_info(&block)
|
71
|
+
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: {}, &block)
|
72
|
+
end
|
73
|
+
|
74
|
+
# INPUT: ParamsOfResolveAppRequest
|
75
|
+
# app_request_id: Number - # # Request ID received from SDK
|
76
|
+
# result: AppRequestResult - # # Result of request processing
|
77
|
+
def resolve_app_request(payload, &block)
|
78
|
+
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
79
|
+
end
|
80
|
+
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module TonClient
|
2
|
+
class Context
|
3
|
+
|
4
|
+
attr_reader :id
|
5
|
+
|
6
|
+
def initialize(config: {})
|
7
|
+
TonClient.check_configuration
|
8
|
+
@config = TonBinding.make_string(config.to_json)
|
9
|
+
context = TonBinding.tc_create_context(@config)
|
10
|
+
@id = TonBinding.read_string_to_hash(context)['result']
|
11
|
+
ObjectSpace.define_finalizer(self, self.class.finalize(@id))
|
12
|
+
end
|
13
|
+
|
14
|
+
def config=(value = {})
|
15
|
+
@config = TonBinding.make_string(value.to_json)
|
16
|
+
end
|
17
|
+
|
18
|
+
def config
|
19
|
+
TonBinding.read_string_to_hash(@config)
|
20
|
+
end
|
21
|
+
|
22
|
+
def destroy
|
23
|
+
TonBinding.tc_destroy_context(id)
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.finalize(id)
|
27
|
+
Proc.new do
|
28
|
+
if (id != nil) && (id > 0)
|
29
|
+
TonBinding.tc_destroy_context(id)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|