Class: TonClient::Tvm

Inherits:
Object show all
Includes:
CommonInstanceHelpers
Defined in:
lib/everscale-client-ruby/Client/Tvm.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, monitor: nil) ⇒ Tvm

Returns a new instance of Tvm.



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

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

Instance Attribute Details

#contextObject (readonly)

Returns the value of attribute context.



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

def context
  @context
end

#monitorObject (readonly)

Returns the value of attribute monitor.



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

def monitor
  @monitor
end

#request_idObject (readonly)

Returns the value of attribute request_id.



6
7
8
# File 'lib/everscale-client-ruby/Client/Tvm.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/Tvm.rb', line 6

def requests
  @requests
end

Instance Method Details

#run_executor(payload, &block) ⇒ Object

INPUT: ParamsOfRunExecutor message: String - # # Input message BOC. # # Must be encoded as base64. account: AccountForExecutor - # # Account to run on executor execution_options: ExecutionOptions<Optional> - # # Execution options. abi: Value<Optional> - # # Contract ABI for decoding output messages skip_transaction_check: Boolean<Optional> - # # Skip transaction check flag boc_cache: BocCacheType<Optional> - # # Cache type to put the result. # # The BOC itself returned if no cache type provided return_updated_account: Boolean<Optional> - # # Return updated account flag. # # Empty string is returned if the flag is ‘false` RESPONSE: ResultOfRunExecutor 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. account: String - # # Updated account state BOC. # # Encoded as `base64` fees: TransactionFees - # # Transaction fees Async



31
32
33
# File 'lib/everscale-client-ruby/Client/Tvm.rb', line 31

def run_executor(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

#run_executor_sync(payload) ⇒ Object

Sync



36
37
38
# File 'lib/everscale-client-ruby/Client/Tvm.rb', line 36

def run_executor_sync(payload)
  TonBinding.send_request_sync(context: context, method_name: full_method_name(MODULE, __method__.to_s).sub(/_sync$/, ''), payload: payload)
end

#run_get(payload, &block) ⇒ Object

INPUT: ParamsOfRunGet account: String - # # Account BOC in ‘base64` function_name: String - # # Function name input: Value - # # Input parameters execution_options: ExecutionOptions<Optional> - # # Execution options tuple_list_as_array: Boolean<Optional> - # # Convert lists based on nested tuples in the result into plain arrays. # # Default is `false`. Input parameters may use any of lists representationsIf you receive this error on Web: “Runtime error. Unreachable code should not be executed…”,set this flag to true. This may happen, for example, when elector contract contains too many participants RESPONSE: ResultOfRunGet output: Value - # # Values returned by get-method on stack Async



71
72
73
# File 'lib/everscale-client-ruby/Client/Tvm.rb', line 71

def run_get(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

#run_get_sync(payload) ⇒ Object

Sync



76
77
78
# File 'lib/everscale-client-ruby/Client/Tvm.rb', line 76

def run_get_sync(payload)
  TonBinding.send_request_sync(context: context, method_name: full_method_name(MODULE, __method__.to_s).sub(/_sync$/, ''), payload: payload)
end

#run_tvm(payload, &block) ⇒ Object

INPUT: ParamsOfRunTvm message: String - # # Input message BOC. # # Must be encoded as base64. account: String - # # Account BOC. # # Must be encoded as base64. execution_options: ExecutionOptions<Optional> - # # Execution options. abi: Value<Optional> - # # Contract ABI for decoding output messages boc_cache: BocCacheType<Optional> - # # Cache type to put the result. # # The BOC itself returned if no cache type provided return_updated_account: Boolean<Optional> - # # Return updated account flag. # # Empty string is returned if the flag is ‘false` RESPONSE: ResultOfRunTvm out_messages: Array - # # List of output messages’ BOCs. # # Encoded as ‘base64` decoded: DecodedOutput<Optional> - # # Optional decoded message bodies according to the optional `abi` parameter. account: String - # # Updated account state BOC. # # Encoded as `base64`. Attention! Only `account_state.storage.state.data` part of the BOC is updated. Async



52
53
54
# File 'lib/everscale-client-ruby/Client/Tvm.rb', line 52

def run_tvm(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

#run_tvm_sync(payload) ⇒ Object

Sync



57
58
59
# File 'lib/everscale-client-ruby/Client/Tvm.rb', line 57

def run_tvm_sync(payload)
  TonBinding.send_request_sync(context: context, method_name: full_method_name(MODULE, __method__.to_s).sub(/_sync$/, ''), payload: payload)
end