ton-client-ruby 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/ton-client-ruby +38 -0
- data/lib/ton-client-ruby.rb +3 -0
- data/lib/ton-client-ruby/Binding/binding.rb +3 -6
- data/lib/ton-client-ruby/Client/Abi.rb +88 -6
- data/lib/ton-client-ruby/Client/Boc.rb +53 -6
- data/lib/ton-client-ruby/Client/Client.rb +41 -25
- data/lib/ton-client-ruby/Client/Context.rb +7 -2
- data/lib/ton-client-ruby/Client/Crypto.rb +200 -30
- data/lib/ton-client-ruby/Client/Debot.rb +22 -6
- data/lib/ton-client-ruby/Client/Net.rb +62 -12
- data/lib/ton-client-ruby/Client/Processing.rb +31 -6
- data/lib/ton-client-ruby/Client/Tvm.rb +36 -6
- data/lib/ton-client-ruby/Client/Utils.rb +21 -6
- data/lib/ton-client-ruby/Helpers/CommonHelpers.rb +8 -0
- data/lib/ton-client-ruby/version.rb +1 -1
- metadata +7 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d7dfd053a1c976028bc40dfe2cf9bb4750beee2688428ae7b8cfc9ff7e3c4d8d
|
4
|
+
data.tar.gz: 651588ea67891811a9a847dda130c5cc2c6d1aac770213254b16c47ce4384238
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 30e93f4c4d28c0b0d8af0766a5d9f632b1a3263ff63ac0edb312bb552b28404f5a2c5129fc418b9a18c440e7a6e6be8e18886c8377d83b28d58157d9052572e1
|
7
|
+
data.tar.gz: 88ea3e6773d2d005a48ffdc7cb1ca4992f4a0955606814ceaed33c9f391b4842fac02d8043c35496fd69feb9eea70c34080b6c0b4f6b73eddf10122818c4dc46
|
data/bin/ton-client-ruby
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require File.dirname(__FILE__) + '/../code_generator/api_converter.rb'
|
4
|
+
require File.dirname(__FILE__) + '/../code_generator/code_generator.rb'
|
5
|
+
|
6
|
+
GEM_DIR = File.dirname(__FILE__) + '/..'
|
7
|
+
|
8
|
+
if ARGV[0] == 'update'
|
9
|
+
if !ARGV[1]
|
10
|
+
puts ''
|
11
|
+
puts ''
|
12
|
+
p "PLEASE DOWNLOAD api.json from https://github.com/tonlabs/TON-SDK/blob/master/tools/api.json and pass as second parameter."
|
13
|
+
p "Example: ton-client-ruby update ./api.json"
|
14
|
+
puts ''
|
15
|
+
return
|
16
|
+
end
|
17
|
+
api_json_path = ARGV[1]
|
18
|
+
json = ''
|
19
|
+
if File.exists?(api_json_path)
|
20
|
+
json = File.read(api_json_path)
|
21
|
+
else
|
22
|
+
p "Current directory: #{Dir.pwd}. File #{api_json_path} is not exist"
|
23
|
+
exit 0
|
24
|
+
end
|
25
|
+
converter = ApiConverter.new(json)
|
26
|
+
types = converter.convert
|
27
|
+
generator = CodeGenerator.new(types, GEM_DIR)
|
28
|
+
generator.generate_self_code
|
29
|
+
elsif ARGV[0] == 'update' && ARGV[1] == nil
|
30
|
+
p 'soon from github'
|
31
|
+
elsif ARGV[0] == 'setup'
|
32
|
+
raise "\nPLEASE INSTALL RUST TO YOUR SYSTEM. \nTry this command: \ncurl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh" if `which rustc`.strip.empty?
|
33
|
+
system("cd #{GEM_DIR} && git clone https://github.com/tonlabs/TON-SDK ./TON-SDK")
|
34
|
+
system("cd #{GEM_DIR}/TON-SDK && git pull --ff-only")
|
35
|
+
system("cd #{GEM_DIR}/TON-SDK && cargo update")
|
36
|
+
system("cd #{GEM_DIR}/TON-SDK && cargo build --release")
|
37
|
+
puts "PATH TO YOR DYNAMIC LIBRARY IS: #{GEM_DIR}/TON-SDK/target/release/libton_client.dylib"
|
38
|
+
end
|
data/lib/ton-client-ruby.rb
CHANGED
@@ -1,8 +1,11 @@
|
|
1
|
+
require 'bundler/setup'
|
2
|
+
Bundler.setup
|
1
3
|
require 'ffi'
|
2
4
|
require "base64"
|
3
5
|
require 'json'
|
4
6
|
require 'byebug'
|
5
7
|
require 'dotenv'
|
8
|
+
require 'fileutils'
|
6
9
|
require 'ton-client-ruby/Helpers/CommonHelpers.rb'
|
7
10
|
require 'ton-client-ruby/Binding/struct.rb'
|
8
11
|
require 'ton-client-ruby/Binding/binding.rb'
|
@@ -147,14 +147,11 @@ module TonClient
|
|
147
147
|
end
|
148
148
|
|
149
149
|
if string[:content].address > 1
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
return string[:content].read_string(string[:len]).force_encoding('UTF-8') + ''
|
150
|
+
string = string[:content].read_string(string[:len]).force_encoding('UTF-8') + ''
|
151
|
+
tc_destroy_string(tc_string_handle) if is_ref
|
152
|
+
return string
|
154
153
|
end
|
155
154
|
nil
|
156
|
-
ensure
|
157
|
-
tc_destroy_string(tc_string_handle) if is_ref
|
158
155
|
end
|
159
156
|
|
160
157
|
def self.read_string_to_hash(tc_string_handle_t_ref)
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module TonClient
|
2
|
-
|
2
|
+
|
3
3
|
class Abi
|
4
4
|
include CommonInstanceHelpers
|
5
5
|
|
@@ -11,42 +11,124 @@ module TonClient
|
|
11
11
|
@core = core
|
12
12
|
end
|
13
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`.
|
14
28
|
def encode_message_body(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: 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 -
|
18
39
|
def attach_signature_to_message_body(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: 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.
|
22
60
|
def encode_message(payload, &block)
|
23
61
|
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
24
62
|
end
|
25
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.
|
26
78
|
def encode_internal_message(payload, &block)
|
27
79
|
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
28
80
|
end
|
29
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
|
30
90
|
def attach_signature(payload, &block)
|
31
91
|
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
32
92
|
end
|
33
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.
|
34
102
|
def decode_message(payload, &block)
|
35
103
|
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
36
104
|
end
|
37
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.
|
38
115
|
def decode_message_body(payload, &block)
|
39
116
|
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
40
117
|
end
|
41
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`.
|
42
128
|
def encode_account(payload, &block)
|
43
129
|
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
44
130
|
end
|
131
|
+
|
45
132
|
end
|
46
133
|
end
|
47
134
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module TonClient
|
2
|
-
|
2
|
+
|
3
3
|
class Boc
|
4
4
|
include CommonInstanceHelpers
|
5
5
|
|
@@ -11,58 +11,105 @@ module TonClient
|
|
11
11
|
@core = core
|
12
12
|
end
|
13
13
|
|
14
|
+
# INPUT: ParamsOfParse
|
15
|
+
# boc: String - # # BOC encoded as base64
|
16
|
+
# RESPONSE: ResultOfParse
|
17
|
+
# parsed: Value - # # JSON containing parsed BOC
|
14
18
|
def parse_message(payload, &block)
|
15
19
|
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
16
20
|
end
|
17
21
|
|
22
|
+
# INPUT: ParamsOfParse
|
23
|
+
# boc: String - # # BOC encoded as base64
|
24
|
+
# RESPONSE: ResultOfParse
|
25
|
+
# parsed: Value - # # JSON containing parsed BOC
|
18
26
|
def parse_transaction(payload, &block)
|
19
27
|
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
20
28
|
end
|
21
29
|
|
30
|
+
# INPUT: ParamsOfParse
|
31
|
+
# boc: String - # # BOC encoded as base64
|
32
|
+
# RESPONSE: ResultOfParse
|
33
|
+
# parsed: Value - # # JSON containing parsed BOC
|
22
34
|
def parse_account(payload, &block)
|
23
35
|
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
24
36
|
end
|
25
37
|
|
38
|
+
# INPUT: ParamsOfParse
|
39
|
+
# boc: String - # # BOC encoded as base64
|
40
|
+
# RESPONSE: ResultOfParse
|
41
|
+
# parsed: Value - # # JSON containing parsed BOC
|
26
42
|
def parse_block(payload, &block)
|
27
43
|
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
28
44
|
end
|
29
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
|
30
52
|
def parse_shardstate(payload, &block)
|
31
53
|
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
32
54
|
end
|
33
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
|
34
60
|
def get_blockchain_config(payload, &block)
|
35
61
|
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
36
62
|
end
|
37
63
|
|
64
|
+
# INPUT: ParamsOfGetBocHash
|
65
|
+
# boc: String - # # BOC encoded as base64
|
66
|
+
# RESPONSE: ResultOfGetBocHash
|
67
|
+
# hash: String - # # BOC root hash encoded with hex
|
38
68
|
def get_boc_hash(payload, &block)
|
39
69
|
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
40
70
|
end
|
41
71
|
|
72
|
+
# INPUT: ParamsOfGetCodeFromTvc
|
73
|
+
# tvc: String - # # Contract TVC image encoded as base64
|
74
|
+
# RESPONSE: ResultOfGetCodeFromTvc
|
75
|
+
# code: String - # # Contract code encoded as base64
|
42
76
|
def get_code_from_tvc(payload, &block)
|
43
77
|
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
44
78
|
end
|
45
79
|
|
80
|
+
# INPUT: ParamsOfBocCacheGet
|
81
|
+
# boc_ref: String - # # Reference to the cached BOC
|
82
|
+
# RESPONSE: ResultOfBocCacheGet
|
83
|
+
# boc: String<Optional> - # # BOC encoded as base64.
|
46
84
|
def cache_get(payload, &block)
|
47
85
|
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
48
86
|
end
|
49
87
|
|
88
|
+
# INPUT: ParamsOfBocCacheSet
|
89
|
+
# boc: String - # # BOC encoded as base64 or BOC reference
|
90
|
+
# cache_type: BocCacheType - # # Cache type
|
91
|
+
# RESPONSE: ResultOfBocCacheSet
|
92
|
+
# boc_ref: String - # # Reference to the cached BOC
|
50
93
|
def cache_set(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
|
|
97
|
+
# INPUT: ParamsOfBocCacheUnpin
|
98
|
+
# pin: String - # # Pinned name
|
99
|
+
# boc_ref: String<Optional> - # # Reference to the cached BOC. # # If it is provided then only referenced BOC is unpinned
|
54
100
|
def cache_unpin(payload, &block)
|
55
101
|
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
56
102
|
end
|
57
103
|
|
104
|
+
# INPUT: ParamsOfEncodeBoc
|
105
|
+
# builder: Array - # # Cell builder operations.
|
106
|
+
# boc_cache: BocCacheType<Optional> - # # Cache type to put the result. The BOC itself returned if no cache type provided.
|
107
|
+
# RESPONSE: ResultOfEncodeBoc
|
108
|
+
# boc: String - # # Encoded cell BOC or BOC cache key.
|
58
109
|
def encode_boc(payload, &block)
|
59
110
|
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
60
111
|
end
|
112
|
+
|
61
113
|
end
|
62
114
|
end
|
63
115
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
@@ -1,10 +1,10 @@
|
|
1
1
|
module TonClient
|
2
|
-
|
2
|
+
|
3
3
|
class Client
|
4
4
|
include CommonInstanceHelpers
|
5
5
|
|
6
6
|
attr_reader :core, :context
|
7
|
-
private_accessor :_crypto, :_abi, :_boc, :
|
7
|
+
private_accessor :_crypto, :_abi, :_boc, :_processing, :_utils, :_tvm, :_net, :_debot
|
8
8
|
MODULE = self.to_s.downcase.gsub(/^(.+::|)(\w+)$/, '\2').freeze
|
9
9
|
|
10
10
|
def initialize(context: Context.new, core: TonClient::TonBinding)
|
@@ -12,22 +12,6 @@ module TonClient
|
|
12
12
|
@core = core
|
13
13
|
end
|
14
14
|
|
15
|
-
def version(&block)
|
16
|
-
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: {}, &block)
|
17
|
-
end
|
18
|
-
|
19
|
-
def get_api_reference(&block)
|
20
|
-
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: {}, &block)
|
21
|
-
end
|
22
|
-
|
23
|
-
def build_info(&block)
|
24
|
-
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: {}, &block)
|
25
|
-
end
|
26
|
-
|
27
|
-
def resolve_app_request(&block)
|
28
|
-
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: {}, &block)
|
29
|
-
end
|
30
|
-
|
31
15
|
def destroy_context
|
32
16
|
core.tc_destroy_context(context.id)
|
33
17
|
end
|
@@ -44,20 +28,52 @@ module TonClient
|
|
44
28
|
_boc ||= Boc.new(context: context)
|
45
29
|
end
|
46
30
|
|
47
|
-
def net
|
48
|
-
_net ||= Net.new(context: context)
|
49
|
-
end
|
50
|
-
|
51
31
|
def processing
|
52
32
|
_processing ||= Processing.new(context: context)
|
53
33
|
end
|
54
34
|
|
35
|
+
def utils
|
36
|
+
_utils ||= Utils.new(context: context)
|
37
|
+
end
|
38
|
+
|
55
39
|
def tvm
|
56
40
|
_tvm ||= Tvm.new(context: context)
|
57
41
|
end
|
58
42
|
|
59
|
-
def
|
60
|
-
|
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
|
+
# RESPONSE: ResultOfGetApiReference
|
52
|
+
# api: Value -
|
53
|
+
def get_api_reference(&block)
|
54
|
+
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: {}, &block)
|
61
55
|
end
|
56
|
+
|
57
|
+
# RESPONSE: ResultOfVersion
|
58
|
+
# version: String - # # Core Library version
|
59
|
+
def version(&block)
|
60
|
+
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: {}, &block)
|
61
|
+
end
|
62
|
+
|
63
|
+
# RESPONSE: ResultOfBuildInfo
|
64
|
+
# build_number: Number - # # Build number assigned to this build by the CI.
|
65
|
+
# dependencies: Array - # # Fingerprint of the most important dependencies.
|
66
|
+
def build_info(&block)
|
67
|
+
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: {}, &block)
|
68
|
+
end
|
69
|
+
|
70
|
+
# INPUT: ParamsOfResolveAppRequest
|
71
|
+
# app_request_id: Number - # # Request ID received from SDK
|
72
|
+
# result: AppRequestResult - # # Result of request processing
|
73
|
+
def resolve_app_request(payload, &block)
|
74
|
+
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
75
|
+
end
|
76
|
+
|
62
77
|
end
|
63
|
-
end
|
78
|
+
end
|
79
|
+
|
@@ -8,6 +8,7 @@ module TonClient
|
|
8
8
|
@config = TonBinding.make_string(config.to_json)
|
9
9
|
context = TonBinding.tc_create_context(@config)
|
10
10
|
@id = TonBinding.read_string_to_hash(context)['result']
|
11
|
+
ObjectSpace.define_finalizer(self, self.class.finalize(@id))
|
11
12
|
end
|
12
13
|
|
13
14
|
def config=(value = {})
|
@@ -22,8 +23,12 @@ module TonClient
|
|
22
23
|
TonBinding.tc_destroy_context(id)
|
23
24
|
end
|
24
25
|
|
25
|
-
def self.finalize
|
26
|
-
|
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
|
27
32
|
end
|
28
33
|
end
|
29
34
|
end
|