-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfacestatic final recordstatic final recordstatic final recordstatic final recordstatic final recordstatic final recordstatic final recordstatic final record -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Tvm.ResultOfRunExecutorrunExecutor(Context ctx, String message, Tvm.AccountForExecutor account, Tvm.ExecutionOptions executionOptions, Abi.ABI abi, Boolean skipTransactionCheck, Boc.BocCacheType bocCache, Boolean returnUpdatedAccount) tvm.run_executor Emulates all the phases of contract execution locally Performs all the phases of contract execution on Transaction Executor -the same component that is used on Validator Nodes.static Tvm.ResultOfRunGetrunGet(Context ctx, String account, String functionName, Map<String, Object> input, Tvm.ExecutionOptions executionOptions, Boolean tupleListAsArray) tvm.run_get Executes a get-method of FIFT contract Executes a get-method of FIFT contract that fulfills the smc-guidelines https://test.ton.org/smc-guidelines.txtand returns the result data from TVM's stackstatic Tvm.ResultOfRunTvmrunTvm(Context ctx, String message, String account, Tvm.ExecutionOptions executionOptions, Abi.ABI abi, Boc.BocCacheType bocCache, Boolean returnUpdatedAccount) tvm.run_tvm Executes get-methods of ABI-compatible contracts Performs only a part of compute phase of transaction executionthat is used to run get-methods of ABI-compatible contracts.
-
Constructor Details
-
Tvm
public Tvm()
-
-
Method Details
-
runExecutor
public static Tvm.ResultOfRunExecutor runExecutor(Context ctx, String message, Tvm.AccountForExecutor account, Tvm.ExecutionOptions executionOptions, Abi.ABI abi, Boolean skipTransactionCheck, Boc.BocCacheType bocCache, Boolean returnUpdatedAccount) throws EverSdkException tvm.run_executor Emulates all the phases of contract execution locally Performs all the phases of contract execution on Transaction Executor -the same component that is used on Validator Nodes.Can be used for contract debugging, to find out the reason why a message was not delivered successfully.Validators throw away the failed external inbound messages (if they failed bedore `ACCEPT`) in the real network.This is why these messages are impossible to debug in the real network.With the help of run_executor you can do that. In fact, `process_message` functionperforms local check with `run_executor` if there was no transaction as a result of processingand returns the error, if there is one.
Another use case to use `run_executor` is to estimate fees for message execution.Set `AccountForExecutor::Account.unlimited_balance`to `true` so that emulation will not depend on the actual balance.This may be needed to calculate deploy fees for an account that does not exist yet.JSON with fees is in `fees` field of the result.
One more use case - you can produce the sequence of operations,thus emulating the sequential contract calls locally.And so on.
Transaction executor requires account BOC (bag of cells) as a parameter.To get the account BOC - use `net.query` method to download it from GraphQL API(field `boc` of `account`) or generate it with `abi.encode_account` method.
Also it requires message BOC. To get the message BOC - use `abi.encode_message` or `abi.encode_internal_message`.
If you need this emulation to be as precise as possible (for instance - emulate transactionwith particular lt in particular block or use particular blockchain config,downloaded from a particular key block - then specify `execution_options` parameter.
If you need to see the aborted transaction as a result, not as an error, set `skip_transaction_check` to `true`.
- Parameters:
message- Input message BOC. Must be encoded as base64.account- Account to run on executorexecutionOptions- Execution options.abi- Contract ABI for decoding output messagesskipTransactionCheck- Skip transaction check flagbocCache- Cache type to put the result. The BOC itself returned if no cache type providedreturnUpdatedAccount- Return updated account flag. Empty string is returned if the flag is `false`- Returns:
Tvm.ResultOfRunExecutor- Throws:
EverSdkException
-
runTvm
public static Tvm.ResultOfRunTvm runTvm(Context ctx, String message, String account, Tvm.ExecutionOptions executionOptions, Abi.ABI abi, Boc.BocCacheType bocCache, Boolean returnUpdatedAccount) throws EverSdkException tvm.run_tvm Executes get-methods of ABI-compatible contracts Performs only a part of compute phase of transaction executionthat is used to run get-methods of ABI-compatible contracts.If you try to run get-methods with `run_executor` you will get an error, because it checks ACCEPT and exitsif there is none, which is actually true for get-methods.
To get the account BOC (bag of cells) - use `net.query` method to download it from GraphQL API(field `boc` of `account`) or generate it with `abi.encode_account method`.To get the message BOC - use `abi.encode_message` or prepare it any other way, for instance, with FIFT script.
Attention! Updated account state is produces as well, but only`account_state.storage.state.data` part of the BOC is updated.
- Parameters:
message- Input message BOC. Must be encoded as base64.account- Account BOC. Must be encoded as base64.executionOptions- Execution options.abi- Contract ABI for decoding output messagesbocCache- Cache type to put the result. The BOC itself returned if no cache type providedreturnUpdatedAccount- Return updated account flag. Empty string is returned if the flag is `false`- Returns:
Tvm.ResultOfRunTvm- Throws:
EverSdkException
-
runGet
public static Tvm.ResultOfRunGet runGet(Context ctx, String account, String functionName, Map<String, Object> input, Tvm.ExecutionOptions executionOptions, Boolean tupleListAsArray) throws EverSdkExceptiontvm.run_get Executes a get-method of FIFT contract Executes a get-method of FIFT contract that fulfills the smc-guidelines https://test.ton.org/smc-guidelines.txtand returns the result data from TVM's stack- Parameters:
account- Account BOC in `base64`functionName- Function nameinput- Input parametersexecutionOptions- Execution optionstupleListAsArray- 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- Returns:
Tvm.ResultOfRunGet- Throws:
EverSdkException
-