OneBalance is a framework for setting up Credible Accounts for users, that allow them to use their balance on any EVM chain for transactions on any other EVM chain. This allows your app to abstract away the concept of “chains” for end users, and makes it significantly simpler to use balances across multiple EVM chains without the UX friction of explicitly bridging between them.You can easily integrate OneBalance with Privy to abstract users’ embedded wallet balances across the various chains that your app might support.Get started with the steps below, or check out the sample app for a full walkthrough!
To start, create OneBalance accounts for your users and deposit any user assets to the account to set it up for executing transactions.Follow the guide here to create your OneBalance API key and instantiate your users’ accounts and deposit their assets to it.You can also use your OneBalance API key to fetch an aggregated balance across all the chains your app supports.
When executing a transaction, first fetch a quote from the OneBalance API for the transaction per this guide.OneBalance supports swaps, transfers, and arbitrary calldata execution, supporting any transaction use case that your app might have.
Lastly, after fetching a quote for the transaction, sign the transaction using the user’s embedded wallet by requesting an EIP-712 typed data signature, like so:
Once you have successfully signed the transaction, you can execute the transaction with the OneBalance API and track its execution status.That’s it! Your users can now transact on any chain with a unified balance!