Class: TonClient::Net
- Includes:
- CommonInstanceHelpers
- Defined in:
- lib/ton-client-ruby/Client/Net.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.
-
#core ⇒ Object
readonly
Returns the value of attribute core.
Instance Method Summary collapse
-
#aggregate_collection(payload, &block) ⇒ Object
INPUT: ParamsOfAggregateCollection collection: String - # # Collection name (accounts, blocks, transactions, messages, block_signatures) filter: Value - # # Collection filter fields: Array
- # # Projection (result) string RESPONSE: ResultOfAggregateCollection values: Value - # # Values for requested fields. -
#batch_query(payload, &block) ⇒ Object
INPUT: ParamsOfBatchQuery operations: Array - # # List of query operations that must be performed per single fetch.
-
#create_block_iterator(payload, &block) ⇒ Object
INPUT: ParamsOfCreateBlockIterator start_time: Number
- # # Starting time to iterate from. -
#create_transaction_iterator(payload, &block) ⇒ Object
INPUT: ParamsOfCreateTransactionIterator start_time: Number
- # # Starting time to iterate from. -
#fetch_endpoints(&block) ⇒ Object
RESPONSE: EndpointsSet endpoints: Array - # # List of endpoints provided by server.
-
#find_last_shard_block(payload, &block) ⇒ Object
INPUT: ParamsOfFindLastShardBlock address: String - # # Account address RESPONSE: ResultOfFindLastShardBlock block_id: String - # # Account shard last block ID.
-
#get_endpoints(&block) ⇒ Object
RESPONSE: ResultOfGetEndpoints query: String - # # Current query endpoint endpoints: Array - # # List of all endpoints used by client.
-
#initialize(context: Context.new, core: TonClient::TonBinding) ⇒ Net
constructor
A new instance of Net.
-
#iterator_next(payload, &block) ⇒ Object
INPUT: ParamsOfIteratorNext iterator: Number - # # Iterator handle limit: Number
- # # Maximum count of the returned items. -
#query(payload, &block) ⇒ Object
INPUT: ParamsOfQuery query: String - # # GraphQL query text.
-
#query_collection(payload, &block) ⇒ Object
INPUT: ParamsOfQueryCollection collection: String - # # Collection name (accounts, blocks, transactions, messages, block_signatures) filter: Value - # # Collection filter result: String - # # Projection (result) string order: Array
- # # Sorting order limit: Number - # # Number of documents to return RESPONSE: ResultOfQueryCollection result: Array - # # Objects that match the provided criteria. -
#query_counterparties(payload, &block) ⇒ Object
INPUT: ParamsOfQueryCounterparties account: String - # # Account address result: String - # # Projection (result) string first: Number
- # # Number of counterparties to return after: String - # # cursorfield of the last received result RESPONSE: ResultOfQueryCollection result: Array - # # Objects that match the provided criteria. -
#query_transaction_tree(payload, &block) ⇒ Object
INPUT: ParamsOfQueryTransactionTree in_msg: String - # # Input message id.
-
#remove_iterator(payload, &block) ⇒ Object
INPUT: RegisteredIterator handle: Number - # # Iterator handle.
- #resume(&block) ⇒ Object
-
#resume_block_iterator(payload, &block) ⇒ Object
INPUT: ParamsOfResumeBlockIterator resume_state: Value - # # Iterator state from which to resume.
-
#resume_transaction_iterator(payload, &block) ⇒ Object
INPUT: ParamsOfResumeTransactionIterator resume_state: Value - # # Iterator state from which to resume.
-
#set_endpoints(payload, &block) ⇒ Object
INPUT: EndpointsSet endpoints: Array - # # List of endpoints provided by server.
-
#subscribe_collection(payload, &block) ⇒ Object
INPUT: ParamsOfSubscribeCollection collection: String - # # Collection name (accounts, blocks, transactions, messages, block_signatures) filter: Value - # # Collection filter result: String - # # Projection (result) string RESPONSE: ResultOfSubscribeCollection handle: Number - # # Subscription handle.
- #suspend(&block) ⇒ Object
-
#unsubscribe(payload, &block) ⇒ Object
INPUT: ResultOfSubscribeCollection handle: Number - # # Subscription handle.
-
#wait_for_collection(payload, &block) ⇒ Object
INPUT: ParamsOfWaitForCollection collection: String - # # Collection name (accounts, blocks, transactions, messages, block_signatures) filter: Value - # # Collection filter result: String - # # Projection (result) string timeout: Number
- # # Query timeout RESPONSE: ResultOfWaitForCollection result: Value - # # First found object that matches the provided criteria.
Methods included from CommonInstanceHelpers
#base64?, #encode_to_base64, #full_method_name
Constructor Details
#initialize(context: Context.new, core: TonClient::TonBinding) ⇒ Net
Returns a new instance of Net.
9 10 11 12 |
# File 'lib/ton-client-ruby/Client/Net.rb', line 9 def initialize(context: Context.new, core: TonClient::TonBinding) @context = context @core = core end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
6 7 8 |
# File 'lib/ton-client-ruby/Client/Net.rb', line 6 def context @context end |
#core ⇒ Object (readonly)
Returns the value of attribute core.
6 7 8 |
# File 'lib/ton-client-ruby/Client/Net.rb', line 6 def core @core end |
Instance Method Details
#aggregate_collection(payload, &block) ⇒ Object
INPUT: ParamsOfAggregateCollection
collection: String - # # Collection name (accounts, blocks, transactions, messages, block_signatures)
filter: Value - # # Collection filter
fields: Arrayfields item.
Numeric value is returned as a decimal string representations.
50 51 52 |
# File 'lib/ton-client-ruby/Client/Net.rb', line 50 def aggregate_collection(payload, &block) core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block) end |
#batch_query(payload, &block) ⇒ Object
INPUT: ParamsOfBatchQuery
operations: Array - # # List of query operations that must be performed per single fetch.
RESPONSE: ResultOfBatchQuery
results: Array - # # Result values for batched queries. # # Returns an array of values. Each value corresponds to queries item.
27 28 29 |
# File 'lib/ton-client-ruby/Client/Net.rb', line 27 def batch_query(payload, &block) core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block) end |
#create_block_iterator(payload, &block) ⇒ Object
INPUT: ParamsOfCreateBlockIterator
start_time: Numbergen_utime >= start_time.
Otherwise the iteration starts from zero state.
Must be specified in seconds.
end_time: Numbergen_utime < end_time.
Otherwise the iteration never stops.
Must be specified in seconds.
shard_filter: Arrayworkchain is a signed integer and the prefix if a hexadecimalrepresentation if the 64-bit unsigned integer with tagged shard prefix.
For example: "0:3800000000000000".
result: Stringresult parameter ofthe query_collection function.
Note that iterated items can contains additional fields that arenot requested in the result.
RESPONSE: RegisteredIterator
handle: Number - # # Iterator handle. # # Must be removed using remove_iteratorwhen it is no more needed for the application.
155 156 157 |
# File 'lib/ton-client-ruby/Client/Net.rb', line 155 def create_block_iterator(payload, &block) core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block) end |
#create_transaction_iterator(payload, &block) ⇒ Object
INPUT: ParamsOfCreateTransactionIterator
start_time: Numbergen_utime >= start_time.
Otherwise the iteration starts from zero state.
Must be specified in seconds.
end_time: Numbergen_utime < end_time.
Otherwise the iteration never stops.
Must be specified in seconds.
shard_filter: Arrayworkchain is a signed integer and the prefix if a hexadecimalrepresentation if the 64-bit unsigned integer with tagged shard prefix.
For example: "0:3800000000000000".
Account address conforms to the shard filter ifit belongs to the filter workchain and the first bits of address match tothe shard prefix. Only transactions with suitable account addresses are iterated.
accounts_filter: Arrayresult parameter ofthe query_collection function.
Note that iterated items can contain additional fields that arenot requested in the result.
include_transfers: Booleantransfers field in iterated transactions. # # If this parameter is true then each transaction contains fieldtransfers with list of transfer. See more about this structure in function description.
RESPONSE: RegisteredIterator
handle: Number - # # Iterator handle. # # Must be removed using remove_iteratorwhen it is no more needed for the application.
189 190 191 |
# File 'lib/ton-client-ruby/Client/Net.rb', line 189 def create_transaction_iterator(payload, &block) core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block) end |
#fetch_endpoints(&block) ⇒ Object
RESPONSE: EndpointsSet endpoints: Array - # # List of endpoints provided by server
99 100 101 |
# File 'lib/ton-client-ruby/Client/Net.rb', line 99 def fetch_endpoints(&block) core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: {}, &block) end |
#find_last_shard_block(payload, &block) ⇒ Object
INPUT: ParamsOfFindLastShardBlock address: String - # # Account address RESPONSE: ResultOfFindLastShardBlock block_id: String - # # Account shard last block ID
93 94 95 |
# File 'lib/ton-client-ruby/Client/Net.rb', line 93 def find_last_shard_block(payload, &block) core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block) end |
#get_endpoints(&block) ⇒ Object
RESPONSE: ResultOfGetEndpoints query: String - # # Current query endpoint endpoints: Array - # # List of all endpoints used by client
112 113 114 |
# File 'lib/ton-client-ruby/Client/Net.rb', line 112 def get_endpoints(&block) core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: {}, &block) end |
#iterator_next(payload, &block) ⇒ Object
INPUT: ParamsOfIteratorNext
iterator: Number - # # Iterator handle
limit: Numberiterator_next can return an empty items and has_more equals to true.
In this case the application have to continue iteration.
Such situation can take place when there is no data yet butthe requested end_time is not reached.
has_more: Boolean - # # Indicates that there are more available items in iterated range.
resume_state: Valuereturn_resume_state parameteris specified.
Note that resume_state corresponds to the iteration positionafter the returned items.
216 217 218 |
# File 'lib/ton-client-ruby/Client/Net.rb', line 216 def iterator_next(payload, &block) core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block) end |
#query(payload, &block) ⇒ Object
INPUT: ParamsOfQuery query: String - # # GraphQL query text. variables: Value - # # Variables used in query. # # Must be a map with named values that can be used in query. RESPONSE: ResultOfQuery result: Value - # # Result provided by DAppServer.
19 20 21 |
# File 'lib/ton-client-ruby/Client/Net.rb', line 19 def query(payload, &block) core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block) end |
#query_collection(payload, &block) ⇒ Object
INPUT: ParamsOfQueryCollection
collection: String - # # Collection name (accounts, blocks, transactions, messages, block_signatures)
filter: Value - # # Collection filter
result: String - # # Projection (result) string
order: Array
39 40 41 |
# File 'lib/ton-client-ruby/Client/Net.rb', line 39 def query_collection(payload, &block) core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block) end |
#query_counterparties(payload, &block) ⇒ Object
INPUT: ParamsOfQueryCounterparties
account: String - # # Account address
result: String - # # Projection (result) string
first: Numbercursor field of the last received result
RESPONSE: ResultOfQueryCollection
result: Array - # # Objects that match the provided criteria
123 124 125 |
# File 'lib/ton-client-ruby/Client/Net.rb', line 123 def query_counterparties(payload, &block) core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block) end |
#query_transaction_tree(payload, &block) ⇒ Object
INPUT: ParamsOfQueryTransactionTree
in_msg: String - # # Input message id.
abi_registry: Array
135 136 137 |
# File 'lib/ton-client-ruby/Client/Net.rb', line 135 def query_transaction_tree(payload, &block) core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block) end |
#remove_iterator(payload, &block) ⇒ Object
INPUT: RegisteredIterator
handle: Number - # # Iterator handle. # # Must be removed using remove_iteratorwhen it is no more needed for the application.
222 223 224 |
# File 'lib/ton-client-ruby/Client/Net.rb', line 222 def remove_iterator(payload, &block) core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block) end |
#resume(&block) ⇒ Object
85 86 87 |
# File 'lib/ton-client-ruby/Client/Net.rb', line 85 def resume(&block) core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: {}, &block) end |
#resume_block_iterator(payload, &block) ⇒ Object
INPUT: ParamsOfResumeBlockIterator
resume_state: Value - # # Iterator state from which to resume. # # Same as value returned from iterator_next.
RESPONSE: RegisteredIterator
handle: Number - # # Iterator handle. # # Must be removed using remove_iteratorwhen it is no more needed for the application.
163 164 165 |
# File 'lib/ton-client-ruby/Client/Net.rb', line 163 def resume_block_iterator(payload, &block) core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block) end |
#resume_transaction_iterator(payload, &block) ⇒ Object
INPUT: ParamsOfResumeTransactionIterator
resume_state: Value - # # Iterator state from which to resume. # # Same as value returned from iterator_next.
accounts_filter: Arrayremove_iteratorwhen it is no more needed for the application.
201 202 203 |
# File 'lib/ton-client-ruby/Client/Net.rb', line 201 def resume_transaction_iterator(payload, &block) core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block) end |
#set_endpoints(payload, &block) ⇒ Object
INPUT: EndpointsSet endpoints: Array - # # List of endpoints provided by server
105 106 107 |
# File 'lib/ton-client-ruby/Client/Net.rb', line 105 def set_endpoints(payload, &block) core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block) end |
#subscribe_collection(payload, &block) ⇒ Object
INPUT: ParamsOfSubscribeCollection
collection: String - # # Collection name (accounts, blocks, transactions, messages, block_signatures)
filter: Value - # # Collection filter
result: String - # # Projection (result) string
RESPONSE: ResultOfSubscribeCollection
handle: Number - # # Subscription handle. # # Must be closed with unsubscribe
77 78 79 |
# File 'lib/ton-client-ruby/Client/Net.rb', line 77 def subscribe_collection(payload, &block) core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block) end |
#suspend(&block) ⇒ Object
81 82 83 |
# File 'lib/ton-client-ruby/Client/Net.rb', line 81 def suspend(&block) core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: {}, &block) end |
#unsubscribe(payload, &block) ⇒ Object
INPUT: ResultOfSubscribeCollection
handle: Number - # # Subscription handle. # # Must be closed with unsubscribe
67 68 69 |
# File 'lib/ton-client-ruby/Client/Net.rb', line 67 def unsubscribe(payload, &block) core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block) end |
#wait_for_collection(payload, &block) ⇒ Object
INPUT: ParamsOfWaitForCollection
collection: String - # # Collection name (accounts, blocks, transactions, messages, block_signatures)
filter: Value - # # Collection filter
result: String - # # Projection (result) string
timeout: Number
61 62 63 |
# File 'lib/ton-client-ruby/Client/Net.rb', line 61 def wait_for_collection(payload, &block) core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block) end |