Relay Transactions - Sync
Submit a transaction and wait for a terminal status or timeout using the Tachyon SDK.
Relay Transactions - Sync
The relaySync() method submits a transaction to the relay network and waits until it either reaches a terminal state or the configured timeout expires. Unlike relay(), it returns the latest known transaction status object directly instead of only returning a transaction ID.
Quick Start
EVM Chains (Ethereum, Base, Polygon, etc.)
import { Tachyon, ChainId } from '@rathfi/tachyon'
const tachyon = new Tachyon({
apiKey: 'API-KEY',
})
const result = await tachyon.relaySync(
{
chainId: ChainId.BASE, // 8453
to: '0x3dbE34f2C21b3B2980d4dc53f3c7E51e39663F49',
value: '1',
callData: '0x',
label: 'My Base Transaction',
},
{
timeoutMs: 30000,
}
)
console.log('Transaction status:', result.status)
console.log('Execution hash:', result.executionTxHash)Aptos
import { Tachyon } from '@rathfi/tachyon'
const tachyon = new Tachyon({
apiKey: 'API-KEY',
})
const result = await tachyon.relaySync(
{
chainId: 88888888,
to: '0x09ebf332aa3e4edad203aff521bd8a47597119de1956885711223ec157eac219',
value: '1',
callData: '0x',
gasLimit: '100',
label: 'My Aptos Transaction',
},
{
timeoutMs: 30000,
}
)
console.log('Transaction status:', result.status)
console.log('Execution hash:', result.executionTxHash)Solana
import { Tachyon } from '@rathfi/tachyon'
const tachyon = new Tachyon({
apiKey: 'API-KEY',
})
const result = await tachyon.relaySync(
{
chainId: 10100000,
to: 'BSNsLtDDM1wN8rjEJQaZreVqRhibsUtsEq9m1G2deAm',
value: '1',
callData: '0x',
label: 'My Solana Transaction',
},
{
timeoutMs: 30000,
}
)
console.log('Transaction status:', result.status)
console.log('Execution hash:', result.executionTxHash)Sui
import { Tachyon, ChainId } from '@rathfi/tachyon'
const tachyon = new Tachyon({
apiKey: 'API-KEY',
})
const result = await tachyon.relaySync(
{
chainId: ChainId.SUI,
to: '0xf78da4499004aa2d594143d69a7804f6f989ab8152de59d3726def827c9fe1f0',
value: '100000000',
callData: '0x',
gasLimit: '3000000',
label: 'send-native-sui',
},
{
timeoutMs: 30000,
}
)
console.log('Transaction status:', result.status)
console.log('Execution hash:', result.executionTxHash)NEAR
import { Tachyon, ChainId } from '@rathfi/tachyon'
const tachyon = new Tachyon({
apiKey: 'API-KEY',
})
const result = await tachyon.relaySync(
{
chainId: ChainId.NEAR,
to: 'deeprice6887.near',
value: '1',
callData: '0x',
label: 'My NEAR Transaction',
},
{
timeoutMs: 30000,
}
)
console.log('Transaction status:', result.status)
console.log('Execution hash:', result.executionTxHash)Starknet
import { Tachyon } from '@rathfi/tachyon'
const tachyon = new Tachyon({
apiKey: 'API-KEY',
})
const result = await tachyon.relaySync(
{
to: '0x021Af6FEc4753c4C7C248Dc68d1B43ed721f0246e9dC8A9e5b7d74Ff3373764B',
callData: '0x',
value: '1',
chainId: 23448594291968334,
label: 'send strk',
retries: 0,
},
{
timeoutMs: 30000,
}
)
console.log('Transaction status:', result.status)
console.log('Execution hash:', result.executionTxHash)Example Output
When the transaction finishes within the timeout window, you'll receive a response like this:
{
"id": "68fa3450539a3c9d28bbca33",
"userId": "68c275846a6ba1c9a2198a8c",
"to": "0x3dbE34f2C21b3B2980d4dc53f3c7E51e39663F49",
"callData": "0x",
"value": "1",
"chainId": 8453,
"gasPrice": null,
"maxFeePerGas": null,
"maxPriorityFeePerGas": null,
"gasLimit": "21000",
"label": "My Base Transaction",
"status": "EXECUTED",
"executionTxHash": "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890",
"timestamp": "2025-10-24T12:34:56.789Z",
"latency": 2500,
"costUSD": 0.8400561743999754,
"retries": 0,
"isAccountCharged": true,
"extraData": null,
"transactionType": "flash"
}If the timeout expires first, the runtime response may include timedOut: true with the latest known status:
{
"id": "68fa3450539a3c9d28bbca33",
"userId": "68c275846a6ba1c9a2198a8c",
"to": "0x3dbE34f2C21b3B2980d4dc53f3c7E51e39663F49",
"callData": "0x",
"value": "1",
"chainId": 8453,
"gasPrice": null,
"maxFeePerGas": null,
"maxPriorityFeePerGas": null,
"gasLimit": "21000",
"label": "My Base Transaction",
"status": "PENDING",
"executionTxHash": null,
"timestamp": "2025-10-24T12:34:56.789Z",
"latency": null,
"costUSD": 0.8400561743999754,
"retries": 0,
"isAccountCharged": false,
"extraData": null,
"transactionType": "flash",
"timedOut": true
}Methods
relaySync(tx, options?)
Submits a transaction to the Tachyon relay network and waits for the latest known execution result. The method returns a status object rather than a txId, so it is useful when you want synchronous submit-and-wait behavior in a single SDK call.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
tx | RelayParams | Yes | Transaction payload. Uses the same fields as relay(). |
options | RelaySyncOptionalFields | No | Controls timeout and optional response enrichment. |
RelayParams
The RelayParams object defines the transaction fields accepted by relaySync():
| Name | Type | Required | Description |
|---|---|---|---|
chainId | number | Yes | The blockchain network ID where the transaction will be executed. Must be a supported chain. |
to | string | Yes | The recipient wallet address or smart contract address. Format varies by chain (hex for EVM, base58 for Solana, named for NEAR). Must be a valid address for the specified chain. |
callData | string | Yes | Encoded transaction data in hexadecimal format (use '0x' for simple transfers). |
value | string | No (default: '0') | Amount of native currency to send in the smallest unit (wei for EVM, lamports for Solana, yoctoNEAR for NEAR, MIST for Sui). Use '0' for contract calls with no value transfer. |
label | string | No | Human-readable label for easier transaction identification and tracking. |
gasLimit | string | No | Gas limit for the transaction. If not specified, it will be estimated automatically. Required for Aptos transactions. |
gasPrice | string | No | Gas price for legacy transactions. Cannot be used with maxFeePerGas or maxPriorityFeePerGas. |
maxFeePerGas | string | No | Maximum fee per gas for EIP-1559 transactions. Must be provided together with maxPriorityFeePerGas. |
maxPriorityFeePerGas | string | No | Maximum priority fee per gas for EIP-1559 transactions. Must be provided together with maxFeePerGas. |
maxUSD | number | No | Maximum USD cost limit for the transaction. Transaction will fail if estimated cost exceeds this value. |
retries | number | No (default: 0) | Number of retry attempts for failed transactions. |
shouldBatchInMulticall | boolean | No | Whether to batch this transaction in a multicall for gas optimization. |
isAuthenticatedTx | boolean | No (default: false) | Enable authenticated relay mode for additional security and verification. |
derivationPath | string | No | HD wallet derivation path for transaction signing (useful for multi-account setups). |
transactionType | "flash" | "authenticated" | "funding-signed" | "flash-blocks" | Optional (default: "flash") | Type of relay transaction. "flash-blocks" is only supported on Base (8453) and Base Sepolia (84532). |
authorizationList | AuthorizationListItem[] | No | List of authorization entries for delegated transactions or batched operations. Not allowed for "flash-blocks" transactions. |
RelaySyncOptionalFields
| Name | Type | Required | Description |
|---|---|---|---|
timeoutMs | number | No (default: 30000) | Maximum time to wait before returning. Minimum 1000, maximum 120000. |
includeReceipt | boolean | No (default: false) | Include the transaction receipt when available. |
includeRevertInfo | boolean | No (default: false) | Include decoded revert information for failed transactions when available. |
Important Behavior
relaySync()returns the terminal transaction status when it reachesEXECUTEDorFAILEDwithin the timeout window.- If the timeout expires first, the method returns the latest known transaction status. The runtime response may include
timedOut: true. - A transaction with
status: "FAILED"is still returned as a successful SDK response. The method throws only for request validation errors or API failures. - After a timeout, continue tracking with
tachyon.getRelayStatus(result.id)ortachyon.waitForExecutionHash(result.id).
Response
Returns: Promise<RelayStatusBase>
The returned object includes the same core fields as getRelayStatus(), including:
| Property | Type | Description |
|---|---|---|
id | string | Unique transaction ID. |
status | TransactionStatus | Current transaction status. |
executionTxHash | string | null | On-chain transaction hash when available. |
latency | number | null | Time taken for execution in milliseconds. |
costUSD | number | Transaction cost in USD. |
error | string | null | Error message if the transaction failed. |
Depending on the options passed and the transaction outcome, the runtime response may also include:
| Property | Type | Description |
|---|---|---|
timedOut | boolean | Present when the timeout expires before a terminal state is reached. |
receipt | object | Present when includeReceipt is enabled and a receipt is available. |
revert | object | Present when includeRevertInfo is enabled and revert data is available. |