OneBalance
OneBalance
  • Welcome to OneBalance
  • OneBalance Toolkit
    • Introduction
    • Get Started with OneBalance SCA
      • Setup OneBalance Toolkit with Privy
        • Step 1: Setting up Privy
        • Step 2: Setting configurations
        • Step 3: Initializing and Depositing onto the OneBalance Smart Account
        • Step 4: Displaying Chain-Aggregated Balances
        • Step 5: Fetch a quote for transaction execution
        • Step 6: Signing transactions with Privy
        • Step 7: Executing transactions
        • Step 8: Getting execution status
      • Contract calls guide
        • Usage code samples
  • OneBalance vision
    • Our vision
      • Mission of OneBalance
      • Use Cases
      • Credible Accounts and Credible Stack
      • Fellowship of OneBalance
      • Glossary
    • Why resource locks?
      • Technical Details
        • Resource lock
        • Permissions
        • Credible accounts
        • Credible Commitment Machine (CCM)
        • FAQ
          • How does this relate to account abstraction and 4337?
          • Where does the OneBalance account live?
          • Are OneBalance accounts non-custodial?
      • Credible Stack Deep Dive
        • Apps
        • SDK providers
        • Wallets / WaaS
        • Solver Networks
        • Oracle Providers
        • Data Providers
  • Other
    • OneBalance Demo App
      • Roadmap
      • Privacy Policy
      • Terms and Conditions
    • OneBalance Brand Assets
Powered by GitBook
On this page
  • Supported Transaction Types
  • Execution Chain Selection
  1. OneBalance Toolkit
  2. Get Started with OneBalance SCA
  3. Setup OneBalance Toolkit with Privy

Step 5: Fetch a quote for transaction execution

Transaction initiation involves providing input parameters and receiving an execution quote.

Supported Transaction Types

  1. Swap

  2. Transfer

  3. Calldata Execution (coming soon)

All transaction types spend from the aggregated balance, enabling cross-chain functionality by accessing multiple chains simultaneously. Along with the quote, the application will receive the transactions for user signing.

Execution Chain Selection

At this stage, assets delivery or execution occurs on a single chain. The application can either set this chain explicitly or let routing logic determine it based on preferences and use cases.

Here’s an example of how to initiate a transaction and fetch the quote for a swap:

fetch('https://be.onebalance.io/api/quotes/swap-quote', {
    method: "post",
    body: JSON.stringify({
      account: {
        accountAddress: '<YOUR ONEBALANCE SCA ADDRESS HERE>',
        sessionAddress: '<USER SIGNING ROLE KEY ADDRESS HERE>',
        adminAddress: '<ADMIN-ROLE KEY ADDRESS HERE>',
      },
      fromTokenAmount: '1000000',
      fromAggregatedAssetId: 'ob:usdc',
      toAggregatedAssetId: 'ob:usdt',
    }),
    headers: {
      "Content-Type": "application/json",
      "x-api-key": '<YOUR ONEBALANCE API KEY HERE>',
    },
  })

Above is an example of a 1 USDC to USDT swap request. Note that accountAddress is the OneBalance SCA address, and that sessionAddress and adminAddress are the same addresses you have used to derive the OneBalance SCA address via the /predict-address endpoint.

PreviousStep 4: Displaying Chain-Aggregated BalancesNextStep 6: Signing transactions with Privy

Last updated 6 months ago

See this in more details in the sample application implementation .

here