Class: TonClient::Client
- Includes:
- CommonInstanceHelpers
- Defined in:
- lib/everscale-client-ruby/Client/Client.rb
Constant Summary collapse
- MODULE =
self.to_s.downcase.gsub(/^(.+::|)(\w+)$/, '\2').freeze
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#context_config ⇒ Object
readonly
Returns the value of attribute context_config.
-
#monitor ⇒ Object
readonly
Returns the value of attribute monitor.
-
#request_id ⇒ Object
readonly
Returns the value of attribute request_id.
-
#requests ⇒ Object
readonly
Returns the value of attribute requests.
Class Method Summary collapse
Instance Method Summary collapse
- #abi ⇒ Object
- #boc ⇒ Object
-
#build_info(&block) ⇒ Object
RESPONSE: ResultOfBuildInfo build_number: Number - # # Build number assigned to this build by the CI.
-
#build_info_sync ⇒ Object
Sync.
-
#config(&block) ⇒ Object
RESPONSE: ClientConfig binding: BindingConfig<Optional> - network: NetworkConfig<Optional> - crypto: CryptoConfig<Optional> - abi: Value - boc: BocConfig<Optional> - proofs: ProofsConfig<Optional> - local_storage_path: String<Optional> - # # For file based storage is a folder name where SDK will store its data.
-
#config_sync ⇒ Object
Sync.
- #crypto ⇒ Object
- #debot ⇒ Object
-
#get_api_reference(&block) ⇒ Object
RESPONSE: ResultOfGetApiReference api: Value - Async.
-
#get_api_reference_sync ⇒ Object
Sync.
-
#initialize(context_config: {}) ⇒ Client
constructor
A new instance of Client.
- #net ⇒ Object
- #processing ⇒ Object
- #proofs ⇒ Object
-
#resolve_app_request(payload, &block) ⇒ Object
INPUT: ParamsOfResolveAppRequest app_request_id: Number - # # Request ID received from SDK result: AppRequestResult - # # Result of request processing Async.
-
#resolve_app_request_sync(payload) ⇒ Object
Sync.
- #tvm ⇒ Object
- #utils ⇒ Object
-
#version(&block) ⇒ Object
RESPONSE: ResultOfVersion version: String - # # Core Library version Async.
-
#version_sync ⇒ Object
Sync.
Methods included from CommonInstanceHelpers
#base64?, #encode_to_base64, #full_method_name
Constructor Details
#initialize(context_config: {}) ⇒ Client
Returns a new instance of Client.
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/everscale-client-ruby/Client/Client.rb', line 10 def initialize(context_config: {}) @context_config = context_config @request_id = RequestId.new @requests = Requests.new @monitor = Monitor.new config = TonBinding.make_string(context_config.to_json) context_ptr = TonBinding.tc_create_context(config) context_response = TonBinding.read_string_data_ref(context_ptr) @context = TonBinding.read_string_to_hash(context_response)['result'] ObjectSpace.define_finalizer(self, self.class.finalize(@context)) end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
6 7 8 |
# File 'lib/everscale-client-ruby/Client/Client.rb', line 6 def context @context end |
#context_config ⇒ Object (readonly)
Returns the value of attribute context_config.
6 7 8 |
# File 'lib/everscale-client-ruby/Client/Client.rb', line 6 def context_config @context_config end |
#monitor ⇒ Object (readonly)
Returns the value of attribute monitor.
6 7 8 |
# File 'lib/everscale-client-ruby/Client/Client.rb', line 6 def monitor @monitor end |
#request_id ⇒ Object (readonly)
Returns the value of attribute request_id.
6 7 8 |
# File 'lib/everscale-client-ruby/Client/Client.rb', line 6 def request_id @request_id end |
#requests ⇒ Object (readonly)
Returns the value of attribute requests.
6 7 8 |
# File 'lib/everscale-client-ruby/Client/Client.rb', line 6 def requests @requests end |
Class Method Details
.finalize(ctx) ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/everscale-client-ruby/Client/Client.rb', line 22 def self.finalize(ctx) Proc.new do if (ctx != nil) && (ctx > 0) TonBinding.tc_destroy_context(ctx) end end end |
Instance Method Details
#abi ⇒ Object
34 35 36 |
# File 'lib/everscale-client-ruby/Client/Client.rb', line 34 def abi _abi ||= Abi.new(context: context, request_id: request_id, requests: requests, monitor: monitor) end |
#boc ⇒ Object
38 39 40 |
# File 'lib/everscale-client-ruby/Client/Client.rb', line 38 def boc _boc ||= Boc.new(context: context, request_id: request_id, requests: requests, monitor: monitor) end |
#build_info(&block) ⇒ Object
RESPONSE: ResultOfBuildInfo build_number: Number - # # Build number assigned to this build by the CI. dependencies: Array - # # Fingerprint of the most important dependencies. Async
112 113 114 |
# File 'lib/everscale-client-ruby/Client/Client.rb', line 112 def build_info(&block) TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, monitor: monitor, method_name: full_method_name(MODULE, __method__.to_s), payload: {}, &block) end |
#build_info_sync ⇒ Object
Sync
117 118 119 |
# File 'lib/everscale-client-ruby/Client/Client.rb', line 117 def build_info_sync() TonBinding.send_request_sync(context: context, method_name: full_method_name(MODULE, __method__.to_s).sub(/_sync$/, ''), payload: {}) end |
#config(&block) ⇒ Object
RESPONSE: ClientConfig binding: BindingConfig<Optional> - network: NetworkConfig<Optional> - crypto: CryptoConfig<Optional> - abi: Value - boc: BocConfig<Optional> - proofs: ProofsConfig<Optional> - local_storage_path: String<Optional> - # # For file based storage is a folder name where SDK will store its data. For browser based is a browser async storage key prefix. Default (recommended) value is “~/.tonclient” for native environments and “.tonclient” for web-browser. Async
99 100 101 |
# File 'lib/everscale-client-ruby/Client/Client.rb', line 99 def config(&block) TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, monitor: monitor, method_name: full_method_name(MODULE, __method__.to_s), payload: {}, &block) end |
#config_sync ⇒ Object
Sync
104 105 106 |
# File 'lib/everscale-client-ruby/Client/Client.rb', line 104 def config_sync() TonBinding.send_request_sync(context: context, method_name: full_method_name(MODULE, __method__.to_s).sub(/_sync$/, ''), payload: {}) end |
#crypto ⇒ Object
30 31 32 |
# File 'lib/everscale-client-ruby/Client/Client.rb', line 30 def crypto _crypto ||= Crypto.new(context: context, request_id: request_id, requests: requests, monitor: monitor) end |
#debot ⇒ Object
58 59 60 |
# File 'lib/everscale-client-ruby/Client/Client.rb', line 58 def debot _debot ||= Debot.new(context: context, request_id: request_id, requests: requests, monitor: monitor) end |
#get_api_reference(&block) ⇒ Object
RESPONSE: ResultOfGetApiReference api: Value - Async
69 70 71 |
# File 'lib/everscale-client-ruby/Client/Client.rb', line 69 def get_api_reference(&block) TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, monitor: monitor, method_name: full_method_name(MODULE, __method__.to_s), payload: {}, &block) end |
#get_api_reference_sync ⇒ Object
Sync
74 75 76 |
# File 'lib/everscale-client-ruby/Client/Client.rb', line 74 def get_api_reference_sync() TonBinding.send_request_sync(context: context, method_name: full_method_name(MODULE, __method__.to_s).sub(/_sync$/, ''), payload: {}) end |
#net ⇒ Object
54 55 56 |
# File 'lib/everscale-client-ruby/Client/Client.rb', line 54 def net _net ||= Net.new(context: context, request_id: request_id, requests: requests, monitor: monitor) end |
#processing ⇒ Object
42 43 44 |
# File 'lib/everscale-client-ruby/Client/Client.rb', line 42 def processing _processing ||= Processing.new(context: context, request_id: request_id, requests: requests, monitor: monitor) end |
#proofs ⇒ Object
62 63 64 |
# File 'lib/everscale-client-ruby/Client/Client.rb', line 62 def proofs _proofs ||= Proofs.new(context: context, request_id: request_id, requests: requests, monitor: monitor) end |
#resolve_app_request(payload, &block) ⇒ Object
INPUT: ParamsOfResolveAppRequest app_request_id: Number - # # Request ID received from SDK result: AppRequestResult - # # Result of request processing Async
125 126 127 |
# File 'lib/everscale-client-ruby/Client/Client.rb', line 125 def resolve_app_request(payload, &block) TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, monitor: monitor, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block) end |
#resolve_app_request_sync(payload) ⇒ Object
Sync
130 131 132 |
# File 'lib/everscale-client-ruby/Client/Client.rb', line 130 def resolve_app_request_sync(payload) TonBinding.send_request_sync(context: context, method_name: full_method_name(MODULE, __method__.to_s).sub(/_sync$/, ''), payload: payload) end |
#tvm ⇒ Object
50 51 52 |
# File 'lib/everscale-client-ruby/Client/Client.rb', line 50 def tvm _tvm ||= Tvm.new(context: context, request_id: request_id, requests: requests, monitor: monitor) end |
#utils ⇒ Object
46 47 48 |
# File 'lib/everscale-client-ruby/Client/Client.rb', line 46 def utils _utils ||= Utils.new(context: context, request_id: request_id, requests: requests, monitor: monitor) end |
#version(&block) ⇒ Object
RESPONSE: ResultOfVersion version: String - # # Core Library version Async
81 82 83 |
# File 'lib/everscale-client-ruby/Client/Client.rb', line 81 def version(&block) TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, monitor: monitor, method_name: full_method_name(MODULE, __method__.to_s), payload: {}, &block) end |
#version_sync ⇒ Object
Sync
86 87 88 |
# File 'lib/everscale-client-ruby/Client/Client.rb', line 86 def version_sync() TonBinding.send_request_sync(context: context, method_name: full_method_name(MODULE, __method__.to_s).sub(/_sync$/, ''), payload: {}) end |