RathRath Finance
SDK Reference

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

NameTypeRequiredDescription
txRelayParamsYesTransaction payload. Uses the same fields as relay().
optionsRelaySyncOptionalFieldsNoControls timeout and optional response enrichment.

RelayParams

The RelayParams object defines the transaction fields accepted by relaySync():

NameTypeRequiredDescription
chainIdnumberYesThe blockchain network ID where the transaction will be executed. Must be a supported chain.
tostringYesThe 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.
callDatastringYesEncoded transaction data in hexadecimal format (use '0x' for simple transfers).
valuestringNo (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.
labelstringNoHuman-readable label for easier transaction identification and tracking.
gasLimitstringNoGas limit for the transaction. If not specified, it will be estimated automatically. Required for Aptos transactions.
gasPricestringNoGas price for legacy transactions. Cannot be used with maxFeePerGas or maxPriorityFeePerGas.
maxFeePerGasstringNoMaximum fee per gas for EIP-1559 transactions. Must be provided together with maxPriorityFeePerGas.
maxPriorityFeePerGasstringNoMaximum priority fee per gas for EIP-1559 transactions. Must be provided together with maxFeePerGas.
maxUSDnumberNoMaximum USD cost limit for the transaction. Transaction will fail if estimated cost exceeds this value.
retriesnumberNo (default: 0)Number of retry attempts for failed transactions.
shouldBatchInMulticallbooleanNoWhether to batch this transaction in a multicall for gas optimization.
isAuthenticatedTxbooleanNo (default: false)Enable authenticated relay mode for additional security and verification.
derivationPathstringNoHD 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).
authorizationListAuthorizationListItem[]NoList of authorization entries for delegated transactions or batched operations. Not allowed for "flash-blocks" transactions.

RelaySyncOptionalFields

NameTypeRequiredDescription
timeoutMsnumberNo (default: 30000)Maximum time to wait before returning. Minimum 1000, maximum 120000.
includeReceiptbooleanNo (default: false)Include the transaction receipt when available.
includeRevertInfobooleanNo (default: false)Include decoded revert information for failed transactions when available.

Important Behavior

  • relaySync() returns the terminal transaction status when it reaches EXECUTED or FAILED within 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) or tachyon.waitForExecutionHash(result.id).

Response

Returns: Promise<RelayStatusBase>

The returned object includes the same core fields as getRelayStatus(), including:

PropertyTypeDescription
idstringUnique transaction ID.
statusTransactionStatusCurrent transaction status.
executionTxHashstring | nullOn-chain transaction hash when available.
latencynumber | nullTime taken for execution in milliseconds.
costUSDnumberTransaction cost in USD.
errorstring | nullError message if the transaction failed.

Depending on the options passed and the transaction outcome, the runtime response may also include:

PropertyTypeDescription
timedOutbooleanPresent when the timeout expires before a terminal state is reached.
receiptobjectPresent when includeReceipt is enabled and a receipt is available.
revertobjectPresent when includeRevertInfo is enabled and revert data is available.

On this page