Integration
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 Paymaster.
- npm
- yarn
- pnpm
npm install @biconomy/paymaster
yarn add @biconomy/paymaster
pnpm add @biconomy/paymaster
Integration
Set up a paymaster for the smart account by providing only the paymaster API key. The default mode used is Sponsored
mode in this case.
info
Click here to learn more about our dashboard and how to get your Paymaster api key.
import { BiconomySmartAccountV2 } from "@biconomy/account";
const biconomySmartAccount = await BiconomySmartAccountV2.create(
{
signer: signer,
chainId: 80002
biconomyPaymasterApiKey: "https://docs.biconomy.io/dashboard/paymaster"
bundlerUrl: "bundler url"
}
);
If you wish to pass "strictMode" to your Paymaster you need to create the instace.
import { IPaymaster, BiconomyPaymaster } from "@biconomy/paymaster";
import { BiconomySmartAccountV2 } from "@biconomy/account";
const paymaster: IPaymaster = new BiconomyPaymaster({
//https://dashboard.biconomy.io/ get paymaster urls from your dashboard
paymasterUrl: "",
strictMode: true
});
const biconomySmartAccount = await BiconomySmartAccountV2.create(
{
signer: signer,
chainId: 80002
paymaster,
bundlerUrl: "bundler url"
}
);
You have now assigned the Paymaster to the smart account. See our tutorials for in depth integrations of the Smart Account and Paymaster.