Integration
This guide soley focuses on the code to integrate the Bundler. To see how this interacts with other packages in the sdk you can view the Smart Accounts Integration page.
Installation
First, install the required packages for initializing the Bundler and Smart Account.
- npm
- yarn
- pnpm
npm install @biconomy/bundler @biconomy/account
yarn add @biconomy/bundler @biconomy/account
pnpm add @biconomy/bundler @biconomy/account
Integration
Simply pass a bundler url as a parameter for the smart account.
info
Click here to learn more about our dashboard and how to get your own bundler url.
import { BiconomySmartAccountV2 } from "@biconomy/account";
const biconomySmartAccountConfig = {
signer: signer,
chainId: 80002,
bundlerUrl: "",
};
const biconomySmartAccount = await BiconomySmartAccountV2.create(
biconomySmartAccountConfig
);
Or you can create your own instance of the Bundler if you wish to pass more params to it like:
- userOpReceiptIntervals
- userOpWaitForTxHashIntervals
- userOpReceiptMaxDurationIntervals
- userOpWaitForTxHashMaxDurationIntervals
import { Bundler } from "@biconomy/bundler";
import { BiconomySmartAccountV2 } from "@biconomy/account";
import { ChainId } from "@biconomy/core-types";
const userOpReceiptMaxDurationIntervals: { [key in ChainId]?: number } = {
[ChainId.POLYGON_MAINNET]: 60000,
};
const bundler = new Bundler({
bundlerUrl: "", // <-- Read about this at https://legacy-docs.biconomy.io/dashboard#bundler-url
chainId: 80002,
userOpReceiptMaxDurationIntervals,
});
const biconomySmartAccountConfig = {
signer: signer,
bundler,
};
const biconomySmartAccount = await BiconomySmartAccountV2.create(
biconomySmartAccountConfig
);
Once initialized you will be able to pass this Bundler instance to the Smart Account configuration to use in conjunction with our Smart Accounts. See our tutorials for in depth integrations of the Smart Account and Bundler.