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/account
yarn add @biconomy/account
pnpm add @biconomy/account
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 { createSmartAccountClient } from "@biconomy/account";
const biconomySmartAccount = await createSmartAccountClient(
{
signer: signer,
chainId: 80002
bundlerUrl:
"https://docs.biconomy.io/dashboard#bundler-url", // <-- Read about this here
biconomyPaymasterApiKey: "", // <-- Read about at https://docs.biconomy.io/dashboard/paymaster
}
);
If you wish to pass "strictMode" to your Paymaster you need to create the instance.
import { createSmartAccountClient, IPaymaster, createPaymaster } from "@biconomy/account";
const paymaster: IPaymaster = await createPaymaster({
paymasterUrl: "", // <-- Read about at https://docs.biconomy.io/dashboard/paymaster
strictMode: true
});
const biconomySmartAccount = await createSmartAccountClient(
{
signer: signer,
chainId: 80002
paymaster,
bundlerUrl:
"https://bundler.biconomy.io/api/v2/{chain-id-here}/nJPK7B3ru.dd7f7861-190d-41bd-af80-6877f74b8f44" }
);
You have now assigned the Paymaster to the smart account. See our tutorials for in depth integrations of the Smart Account and Paymaster.