Class: TonClient::Processing

Inherits:
Object
  • Object
show all
Includes:
CommonInstanceHelpers
Defined in:
lib/everscale-client-ruby/Client/Processing.rb

Constant Summary collapse

MODULE =
self.to_s.downcase.gsub(/^(.+::|)(\w+)$/, '\2').freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from CommonInstanceHelpers

#base64?, #encode_to_base64, #full_method_name

Constructor Details

#initialize(context: nil, request_id: nil, requests: nil) ⇒ Processing



9
10
11
12
13
# File 'lib/everscale-client-ruby/Client/Processing.rb', line 9

def initialize(context: nil, request_id: nil, requests: nil)
  @context = context
  @request_id = request_id
  @requests = requests
end

Instance Attribute Details

#contextObject (readonly)

Returns the value of attribute context.



6
7
8
# File 'lib/everscale-client-ruby/Client/Processing.rb', line 6

def context
  @context
end

#request_idObject (readonly)

Returns the value of attribute request_id.



6
7
8
# File 'lib/everscale-client-ruby/Client/Processing.rb', line 6

def request_id
  @request_id
end

#requestsObject (readonly)

Returns the value of attribute requests.



6
7
8
# File 'lib/everscale-client-ruby/Client/Processing.rb', line 6

def requests
  @requests
end

Instance Method Details

#process_message(payload, &block) ⇒ Object

INPUT: ParamsOfProcessMessage message_encode_params: ParamsOfEncodeMessage - # # Message encode parameters. send_events: Boolean - # # Flag for requesting events sending RESPONSE: ResultOfProcessMessage transaction: Value - # # Parsed transaction. # # In addition to the regular transaction fields there is a`boc` field encoded with base64 which contains sourcetransaction BOC. out_messages: Array - # # List of output messages’ BOCs. # # Encoded as base64 decoded: DecodedOutput<Optional> - # # Optional decoded message bodies according to the optional abi parameter. fees: TransactionFees - # # Transaction fees



54
55
56
# File 'lib/everscale-client-ruby/Client/Processing.rb', line 54

def process_message(payload, &block)
  TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
end

#send_message(payload, &block) ⇒ Object

INPUT: ParamsOfSendMessage message: String - # # Message BOC. 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. The ‘message already expired` error will be returned in thiscase. Note, that specifying abi for ABI compliant contracts isstrongly recommended, so that proper processing strategy can bechosen. send_events: Boolean - # # Flag for requesting events sending RESPONSE: ResultOfSendMessage 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`. 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`.



24
25
26
# File 'lib/everscale-client-ruby/Client/Processing.rb', line 24

def send_message(payload, &block)
  TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
end

#wait_for_transaction(payload, &block) ⇒ Object

INPUT: ParamsOfWaitForTransaction 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. The abi_decoded result field will be filled out. message: String - # # Message BOC. # # Encoded with base64. 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. send_events: Boolean - # # Flag that enables/disables intermediate events sending_endpoints: Array<Optional> - # # The list of endpoints to which the message was sent. # # Use this field to get more informative errors. Provide the same value as the send_message has returned. If the message was not delivered (expired), SDK will log the endpoint URLs, used for its sending. RESPONSE: ResultOfProcessMessage transaction: Value - # # Parsed transaction. # # In addition to the regular transaction fields there is a`boc` field encoded with base64 which contains sourcetransaction BOC. out_messages: Array - # # List of output messages’ BOCs. # # Encoded as base64 decoded: DecodedOutput<Optional> - # # Optional decoded message bodies according to the optional abi parameter. fees: TransactionFees - # # Transaction fees



42
43
44
# File 'lib/everscale-client-ruby/Client/Processing.rb', line 42

def wait_for_transaction(payload, &block)
  TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
end