Skip to main content
Version: 11.x

Function: paymasterPlugin()

paymasterPlugin(options?): StarknetPlugin<Record<string, never>, PaymasterAccountMethods>

Defined in: src/plugins/paymaster/index.ts:35

Paymaster plugin: adds the SNIP-29 paymaster members to an Account. They are paymaster, buildPaymasterTransaction, estimatePaymasterTransactionFee, preparePaymasterTransaction and executePaymasterTransaction. It is a default plugin. It adds nothing to a provider.

The plugin does not add a method that the account already has: when a subclass of Account redefines a paymaster method, its method is kept.

Parameters​

options?​

PaymasterOptions | PaymasterInterface

The paymaster to use: the options of a PaymasterRpc, or a paymaster instance. Without them, the account uses a public paymaster service, and no message is logged.

Returns​

StarknetPlugin<Record<string, never>, PaymasterAccountMethods>

The plugin.

Example​

const myAccount = new Account({
provider: myProvider,
address: accountAddress,
signer: privateKey,
plugins: [fastExecute(), paymasterPlugin({ nodeUrl: 'https://sepolia.paymaster.avnu.fi' })],
});
// myAccount.paymaster.nodeUrl = 'https://sepolia.paymaster.avnu.fi'