Blockend
HomeLive Demo
BlockEnd Labs
BlockEnd Labs
  • About BlockEnd
    • Overview
    • 🎯Thesis
    • 🧭Compass
    • 🌊LEX Protocol
  • ⚡Compass Widgets
    • Widget Pro
      • Install Widget Pro
      • Customise Widget Pro
    • Widget Lite
  • 👨‍💻Compass API
    • API Reference
      • Getting Started
      • Authentication
      • Fetching Quotes
      • Create Transaction
      • Get Raw Transaction To Execute
      • Check Transaction Status
      • Gasless Swaps
      • Type Definations
      • Get Supported Chains & Tokens
    • Quick Swap API
    • SDK
      • Getting Started
      • Configuration
      • Core Methods
        • getQuotes
        • Create Transaction
        • getNextTxn
        • Check Status
        • pollTransactionStatus
        • executeQuote
        • executeTransaction
      • Gasless Transactions
      • Tokens and Chains
    • Supported Chains
    • Liquidity Sources
  • Code Examples
    • EVM Swaps
    • EVM to SOL Bridge
    • SOLANA Swaps
    • Solana to EVM Bridge
  • Resources
    • Brand Assets
  • Troubleshooting
    • React issues
    • Next js issues
Powered by GitBook
On this page

Was this helpful?

  1. Compass API
  2. SDK
  3. Core Methods

executeTransaction

Executes a single transaction step with the provided transaction data. This method is used internally by executeQuote but can also be used directly for more granular control over transaction execution.

interface ExecuteTransactionParams {
  txDataResponse: TransactionDataResponse;
  quote: Quote;
  step: TransactionStep;
  provider: BrowserProvider | WalletClient;
  walletAdapter: WalletAdapter;
  cosmosClient: SigningStargateClient | SigningCosmWasmClient;
  solanaRpcUrl?: string;
}

// Example implementation
const txnResponse = await getNextTxn({
  routeId: quote.routeId,
  stepId: step.stepId,
});
// Example implementation
const txHash = await executeTransaction({
  txDataResponse,
  quote,
  step,
  provider: ethersProvider,
  walletAdapter: solanaWallet,
  cosmosClient: cosmosClient,
  solanaRpcUrl: "https://api.mainnet-beta.solana.com",
});

The method handles different transaction types based on the network:

  • For EVM chains: Supports regular transactions for on chain transactions, EIP-712 typed data signing for gasless transactions, and untyped message signing for meson finance transactions.

  • For Solana: Handles Solana-specific transaction formats

  • For Cosmos: Manages Cosmos SDK transaction types

The provider, walletAdapter, and cosmosClient parameters are mutually exclusive - you should provide the appropriate one based on the chain you're interacting with:

  • For EVM chains: provide the provider parameter

  • For Solana: provide the walletAdapter parameter

  • For Cosmos chains: provide the cosmosClient parameter

The method returns the transaction hash of the executed transaction, which can be used to monitor its status using checkStatus or pollTransactionStatus.

PreviousexecuteQuoteNextGasless Transactions

Last updated 1 month ago

Was this helpful?

👨‍💻