How-To GuidesRelay Transactions
Sui
Submit and track a relay transaction on Sui.
Sui is an object-centric Layer 1 blockchain built with Move. Contract interactions are programmable transaction blocks that can call Move functions and operate on owned or shared objects.
Follow these steps to submit and track a simple transaction on Sui.
Import the SDK
import { Tachyon, ChainId } from '@rathfi/tachyon'Initialize the Tachyon Client
const tachyon = new Tachyon({
apiKey: 'API-KEY',
})Submit a Transaction
const txId = await tachyon.relay({
chainId: 897796746, // Sui chain ID
to: '0xf78da4499004aa2d594143d69a7804f6f989ab8152de59d3726def827c9fe1f0',
value: '1000',
callData: '0x',
gasLimit: '3000000', // Required for Sui
label: 'My Sui Transaction',
})
console.log('Transaction submitted with ID:', txId)Check Transaction Status
const status = await tachyon.getRelayStatus(txId)
console.log('Transaction status:', status.status)Wait for Execution
const executedTx = await tachyon.waitForExecutionHash(txId)
console.log('Execution hash:', executedTx.executionTxHash)Call a Move Contract
Build and serialize a Sui transaction, base64-encode the bytes into callData, and relay it to the package address.
import { Tachyon } from '@rathfi/tachyon'
import { Transaction as SuiTransaction } from '@mysten/sui/transactions'
const packageId = '0xb4ce9c7b45e665ec8a310b7f5507123fa3de79f53917f20b9408cdcb159dcc70'
const tx = new SuiTransaction()
tx.moveCall({
target: `${packageId}::greeting::new`,
arguments: [],
})
const callData = Buffer.from(tx.serialize()).toString('base64')
const tachyon = new Tachyon({ apiKey: 'YOUR_API_KEY' })
const txId = await tachyon.relay({
chainId: 897796746,
to: packageId,
value: '0',
callData,
label: 'call-contract-sui',
gasLimit: '1000000',
})curl -X POST https://tachyon.rath.fi/api/submit-tx \
-H "api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"chainId": 897796746,
"to": "0xb4ce9c7b45e665ec8a310b7f5507123fa3de79f53917f20b9408cdcb159dcc70",
"value": "0",
"callData": "BASE64_SERIALIZED_SUI_TRANSACTION",
"label": "call-contract-sui",
"gasLimit": "1000000"
}'