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
  1. OneBalance Toolkit
  2. Get Started with OneBalance SCA
  3. Setup OneBalance Toolkit with Privy

Step 3: Initializing and Depositing onto the OneBalance Smart Account

PreviousStep 2: Setting configurationsNextStep 4: Displaying Chain-Aggregated Balances

Last updated 1 month ago

At this step, the application will display the Smart Contract Account (SCA) address for the user. This address is used for deposits on the supported chains in the application; for more details, see this section.

Currently, only EVM chains are supported, so the address remains the same across all chains. The SCA address is determined in advance using counterfactual address calculation, meaning it can be known before deployment.

To retrieve the SCA address, you can use this . Here’s an example API call:

 fetch('https://be.onebalance.io/api/account/predict-address', {
    method: "post",
    body: JSON.stringify({
      sessionAddress: "<USER SIGNING ROLE KEY ADDRESS HERE>",
      adminAddress: "<ADMIN-ROLE KEY ADDRESS HERE>",
    }),
    headers: {
      "x-api-key": '<YOUR ONEBALANCE API KEY HERE>',
      "Content-Type": "application/json",
    },
  })

Note: At this point, the application must provide both the initial user signing key and the admin key every time to retrieve the deposit address.

For a full implementation, see .

Automatic Deployment: The SCA deployment will occur automatically via the 4337 UserOp initCode field, together with the first spending transaction, so app developers do not need to handle it manually.

API endpoint
our sample client-side application