ImportantTo keep things short, this guide will show you a simple example of single-chain orchestration with cross-chain gas. However, the Biconomy MEE stack supports multi-chain orchestration cases. If you’re looking to build a multi-chain DeFi strategy - read this guide.
Project Setup
Create your project using Vite:package.json:
main.tsx:
wagmi.ts:
Get the Embedded Wallet Instance
After logging in the user with Privy, you can find the embedded wallet as follows:Authorizing with EIP-7702
To install the Biconomy Nexus 1.2.0 smart account on the address of your Privy embedded wallet EOA, you need to sign the following authorization. Note: This is using thesignAuthorization method exposed by the useSignAuthorization Privy hook.
Execute a Cross-Chain Gas Abstracted Transaction
After signing, you can submit a transaction through Biconomy MEE Relayers. Notice few things for this transaction:- Gas is paid with USDC
- Gas is paid on a different chain than the instruction being executed
- The
amountarg in the ERC-20transfercall is not fixed to a value, but usesruntimeERC20BalanceOfwhich will inject the full amount of USDC available
- Gas abstraction / gas sponsorship
- Multi-chain execution/orchestration
- Runtime parameter injection enabling multi-transaction composability