Overview
Authentication, rate limits, error handling, and sending to specific regions
See our JSON-RPC API overview doc for information on how to send toTokyo - apac1
Mainnet and US-East - us1
Mainnet or Testnet. The examples below use the US-East
region URL.
Write API
sui_devInspectTransactionBlock
DescriptionRuns the transaction in dev-inspect mode, which allows for nearly any transaction (or Move call) with any arguments. Detailed results are provided, including both the transaction effects and any return values Important note on Node usage and billing for this request:
devInspectTransactionBlock
can accept a TransactionBlock as input (as opposed to a string or byte-array representation of a TransactionBlock you’ve already called .build()
on). If you do this, it will call TransactionBlock.build() with the input block, which will lead to additional Node Service requests (because that’s what the build() method does). These requests count towards your access key’s rate limit and your daily request count (and thus your billing), just like when you explicitly call TransactionBlock.build()
with a SuiClient
using Shinami’s Node Service URL. For more information, see our TransactionBlock.build()
guide
Params
sender
:String
- the caller’s Sui addresstx_bytes
:String
-TransactionKind
bytes, as Base-64 encoded string. This includes only the bytes of the programmable transaction block, and not the gas data or sender address. If you want to run a test including the gas object that would be used in the transaction, seesui_dryRunTransactionBlock
.epoch
:String
- (Optional) The epoch to perform the call, e.g"211"
. Will be set from the system state object if not provided.gas_price
:String
- (Optional) Gas is not charged, but gas usage is still calculated. Default to use reference gas price.
US East - us1
region URL since it is currently the only region where we offer Testnet. To send to another region, see our our Node Service API Overview. The TypeScript example uses the Shinami Clients SDK, which you can install with:
Shell
{{name}}
with the actual value for that name
-
DevInspectResults
containing:- effects :
TransactionEffects
- Summary of effects that likely would be generated if the transaction is actually run.
Note however, that not all dev-inspect transactions are actually usable as transactions so it might not be possible actually generate these effects from a normal transaction.- error?:
string | null
- Execution error from executing the transaction commands - events :
SuiEvent[]
- Events that likely would be generated if the transaction is actually run. - results ?:
SuiExecutionResult[]
| null
- Execution results (including return values) from executing the transaction commands
- effects :
sui_dryRunTransactionBlock
DescriptionTest runs a transaction but does not execute it. Reports what the effects of executing the transaction would have been, including the gas cost summary. Params
tx_bytes
:TranasactionData
bytes, as Base-64 encoded string. This includes everything needed to actually run a transaction, including the sender address and a gas object. If you want to perform a test on a transaction without a gas object attached, seesui_devInspectTransactionBlock
.
US East - us1
region URL since it is currently the only region where we offer Testnet. To send to another region, see our our Node Service API Overview. The TypeScript example uses the Shinami Clients SDK, which you can install with:
Shell
{{name}}
with the actual value for that name
-
DryRunTransactionBlockResponse
including:- balanceChanges :
BalanceChange[]
- effects :
TransactionEffects
- events :
SuiEvent[]
- input:
TransactionBlockData
- objectChanges :
SuiObjectChange[]
- balanceChanges :
sui_executeTransactionBlock
DescriptionExecute a transaction using the transaction data and signature(s).
Note that building a transaction block ahead of executing it leads to additional Node Service requests that you’ll see in your Shinami dashboard.
-
tx_bytes
: BCS serialized transaction data bytes without its type tag, as base-64 encoded string -
signatures
: list of signatures (flag || signature || pubkey bytes, as base-64 encoded string). Signature is committed to the intent message of the transaction data -
options
:SuiTransactionBlockResponseOptions
- Optional. Sui options for specifying the transaction content to be returned. Values default to false if not provided. -
request_type
: Deprecated (see Appendix)ExecuteTransactionRequestType
- Optional.
US East - us1
region URL since it is currently the only region where we offer Testnet. To send to another region, see our our Node Service API Overview. The TypeScript example uses the Shinami Clients SDK, which you can install with:
Shell
{{name}}
with the actual value for that name
SuiTransactionBlockResponse
: SuiTransactionBlockResponse
Appendix
sui_executeTransactionBlock
request_type
deprecation
From Mysten: “In [Sui] version 1.33 (scheduled to be released on September 18th, 2024), JSON RPC will ignore the requestType: ‘WaitForLocalExecution’ option, and the JSON RPC API has been updated to support returning object and balance changes without the need for local execution. Many dapps have also used WaitForLocalExecution to ensure read-after-write consistency, which will no longer be possible through JSON RPC. To make this migration as painless as possible, we have updated the Typescript SDK to detect the requestType: ‘WaitForLocalExecution’ option, and automatically use client.waitForTransaction
to ensure that the transaction has been indexed after execution. This means that ensuring read-after-write consistency with the TypeScript SDK is as simple as updating the SDK to version @mysten/sui@1.6.0
or later, and setting requestType to WaitForLocalExecution. This option is marked as deprecated, and will be removed in the next major release, but we don’t anticipate a major release of the typescript SDK any time soon. Going forward, dapps should use client.waitForTransaction({ digest })
to ensure a transaction has been indexed when they need read-after-write consistency. This will allow dapps to opt in to the latency costs associated with this, while allowing more efficient execution for dapps and wallets that do not have those constraints.”
Request types (pre-behavior change): 1. 'WaitForEffectsCert'
: waits for TransactionEffectsCert and then return to client. This mode is a proxy for transaction finality. 2. 'WaitForLocalExecution'
: waits for TransactionEffectsCert and also makes sure the node executed the transaction locally before returning the client. The local execution makes sure this node is aware of this transaction when client fires subsequent queries (for read-after-write consistency). However if the node fails to execute the transaction locally in a timely manner, a bool type in the response is set to false to indicate the case. request_type
defaults to 'WaitForEffectsCert'
unless options.show_events
or options.show_effects
is true
.