How-To GuidesRelay Transactions
Aptos
Submit and track a relay transaction on Aptos.
Aptos is a Move-based Layer 1 blockchain. Applications expose Move entry functions, identified by a module address, module name, and function name, with typed arguments supplied in the transaction payload.
Follow these steps to submit and track a simple transaction on Aptos.
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: 88888888, // Aptos chain ID
to: '0x09ebf332aa3e4edad203aff521bd8a47597119de1956885711223ec157eac219',
value: '1',
callData: '0x',
gasLimit: '100', // Required for Aptos
label: 'My Aptos 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 Function
Build an Aptos function payload as JSON, base64-encode it into callData, and use the module account as to.
import { Tachyon } from '@rathfi/tachyon'
const tachyon = new Tachyon({ apiKey: 'YOUR_API_KEY' })
const moduleAddress = '0x3690a8173c5f738234d3772621db2923cf283029d0b9a7795038fde6f3fcdabd'
const functionPayload = {
function: `${moduleAddress}::hello_tachyon_v2::preview_message`,
typeArguments: [],
functionArguments: ['GM Tachyon!'],
}
const callData = Buffer.from(JSON.stringify(functionPayload)).toString('base64')
const txId = await tachyon.relay({
chainId: 88888888,
to: moduleAddress,
value: '0',
callData,
label: 'call-contract-aptos',
gasLimit: '5000',
})curl -X POST https://tachyon.rath.fi/api/submit-tx \
-H "api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"chainId": 88888888,
"to": "0x3690a8173c5f738234d3772621db2923cf283029d0b9a7795038fde6f3fcdabd",
"value": "0",
"callData": "eyJmdW5jdGlvbiI6IjB4MzY5MGE4MTczYzVmNzM4MjM0ZDM3NzI2MjFkYjI5MjNjZjI4MzAyOWQwYjlhNzc5NTAzOGZkZTZmM2ZjZGFiZDo6aGVsbG9fdGFjaHlvbl92Mjo6cHJldmlld19tZXNzYWdlIiwidHlwZUFyZ3VtZW50cyI6W10sImZ1bmN0aW9uQXJndW1lbnRzIjpbIkdNIFRhY2h5b24hIl19",
"label": "call-contract-aptos",
"gasLimit": "5000"
}'