getNextTxn

Retrieves the raw transaction data for the next pending step in the transaction sequence. The response format varies based on the blockchain network:

interface TransactionDataParams {
  routeId: string; // Route ID from createTransaction
  stepId: string; // Step ID from the transaction steps array
}

//Example implementation
const nextTxn = await getNextTxn({
  routeId: transaction.routeId,
  stepId: transaction.steps[0].id,
});

// Example Response (shortened)
{
  "status": "success",
  "data": {
    "routeId": "01J2WB1NY6MD3F25CJTTB01D8F",
    "stepId": "01J2WB1NY64MKVCM8FM994WMZV",
    "networkType": "evm",
    "txnData": {
      "txnType": "on-chain" | "sign-typed" | "sign-untyped"
      "txnEvm": {
        "to": "0x...",
        "value": "420000000000000000",
        // ... other transaction details
      }
    }
  }
}

Transaction Types

The SDK supports multiple transaction types that are automatically handled based on the protocol and requirements:

  1. On-chain Transactions (txnType: "on-chain"):

    • Regular blockchain transactions that require gas fees

    • Used for standard token transfers and swaps

  2. EIP-712 Typed Data Signing (txnType: "sign-typed"):

    • Implements EIP-712 for structured data signing on EVM chains

    • Used for permit-style approvals and meta-transactions (for gasless)

  3. Untyped Message Signing (txnType: "sign-untyped"):

    • Used for protocols like Meson.fi that require message signing

    • Supports cross-chain message verification

The transaction type is automatically determined based on the quote and protocol being used. The SDK handles all the necessary signing logic internally, including:

  • Proper formatting of typed and untyped data

  • Chain-specific signature requirements

  • Protocol-specific message formatting

  • Gasless transaction handling

Transaction Data Response Examples

Send txnEvm or txnSol or txnCosmos to the appropriate wallet/provider based on the networkType and get the transaction hash to monitor the status of the transaction.

EVM Chain Response

Solana Chain Response

Cosmos Chain Response

View full getNextTxn response example

Last updated

Was this helpful?