A CandidePaymaster
is a class interacts with Candide's ERC-4337 Paymaster API.
Usage
Import
import { CandidePaymaster } from "abstractionkit";
How to use
Initialize a Paymaster with your RPC url. Get an API key from the dashboard
paymaster.ts
import { CandidePaymaster } from "abstractionkit";
const paymasterRpc = "https://api.candide.dev/paymaster/$version/$network/$apikey";
const paymaster: CandidePaymaster = new CandidePaymaster(paymasterRPC);
Then you can consume Paymaster methods:
const paymasterMetaData = await paymaster.getPaymasterMetaData();
Methods
Returns the metadata associated with the Paymaster, along with dummyPaymasterAndData useful for gas estimates
Usage
example.ts
import { paymaster } from "./paymaster";
const paymasterResult = await paymaster.getPaymasterMetaData();
Paramater | Type | paymasterMetadata | PaymasterMetadata Object
Key | Value Type | Description | name | string | Paymaster Name | description | string | A short description for the paymaster service | icons | string[] | icons associated with the paymaster service | address | string | Paymaster Contract Address | sponsoredEventTopic | string | Emmited topic event if a paymaster is being used | dummyPaymasterAndData | string | Dummy value to use for estimating userop gas before sponsorship |
|
Example Response
{
name: 'Candide Paymaster',
description: 'Candide Paymaster a fast, secure and feature-rich 4337 Paymaster',
icons: [],
address: '0x3fE285DcD76BCcE4Ac92d38A6F2F8E964041e020',
sponsoredEventTopic: '0xa050a122b4c0e369e3385eb6b7cccd8019638b2764de67bec0af99130ddf8471',
dummyPaymasterAndData: '0x3fE285DcD76BCcE4Ac92d38A6F2F8E964041e0207ddefa2f027691116d0a7aa6418246622d70b12a0100000000ffff000000000000000000000000000000000000000000000000000000000000ffff000000000000000000000000000000000000000000000000000000000000ffff010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101011c'
}
source code
getPaymasterMetaData
Returns the ERC-20 Tokens that the paymaster accepts as gas tokens on the current network, along with its metadata
Usage
example.ts
import { paymaster } from "./paymaster.ts";
const result = await paymaster.getSupportedERC20TokensAndPaymasterMetadata();
Paramater | Type | tokens | ERC20Token[] Object[]
Key | Value Type | Description | symbol | string | Token Symbol | address | string | Token contract address | decimal | number | Decimals of token | fee | bigint | Gas fee in unit of of the token | exchangeRate | bigint | Exchange rate of token |
|
paymasterMetadata | PaymasterMetadata Object
Key | Value Type | Description | name | string | Paymaster Name | description | string | A short description for the paymaster service | icons | string[] | icons associated with the paymaster service | address | string | Paymaster Contract Address | sponsoredEventTopic | string | Emmited topic event if a paymaster is being used | dummyPaymasterAndData | string | Dummy value to use for estimating userop gas before sponsorship |
|
Example Response
{
tokens: [
{
symbol: 'CTT',
address: '0xFa5854FBf9964330d761961F46565AB7326e5a3b',
decimal: 18,
fee: 0n,
exchangeRate: 1001219705870085130n
}
],
paymasterMetadata: {
name: 'CANDIDE Paymaster',
description: 'CANDIDE Paymaster a fast, secure and feature-rich 4337 Paymaster',
icons: [],
address: '0x3fE285DcD76BCcE4Ac92d38A6F2F8E964041e020',
sponsoredEventTopic: '0xa050a122b4c0e369e3385eb6b7cccd8019638b2764de67bec0af99130ddf8471',
dummyPaymasterAndData: '0x3fE285DcD76BCcE4Ac92d38A6F2F8E964041e020Fa5854FBf9964330d761961F46565AB7326e5a3b0100000000ffff000000000000000000000000000000000000000000000000000000000000ffff000000000000000000000000000000000000000000000000000000000000ffff010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101011c'
}
}
Source code
getSupportedERC20TokensAndPaymasterMetadata
getSupportedEntrypoint
Returns the supported Entrypoints by the paymaster
Usage
example.ts
import { paymaster } from "./paymaster";
const paymasterResult = await paymaster.getSupportedEntrypoint();
Key | Value Type | Description | entrypoint | string | EntryPoint Address that the paymaster is supporting |
Example Response
0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789
source code
getSupportedEntrypoint
isSupportedERC20Token
Checks if a particular ERC-20 token is accepted as gas payment by the paymaster. Returns a boolean
Usage
- example.ts
- Param Types
- Response Type
example.ts
import { paymaster } from "./paymaster";
const erc20TokenAddress = "0x7DdEFA2f027691116D0a7aa6418246622d70B12A";
const isSupported = await paymaster.isSupportedERC20Token(erc20TokenAddress);
Paramater | Type | Description | Token Address | string | Onchain ERC-20 Token Address |
Paramater | Type | Description | Checks for support | boolean | Returns true if the ERC-20 token is supported, returns false otherwise |
Example Response
getSupportedERC20TokenData
Returns the token data given an erc20 address
Usage
- example.ts
- Param Types
- Response Type
example.ts
import { paymaster } from "./paymaster";
const erc20TokenAddress = "0xFa5854FBf9964330d761961F46565AB7326e5a3b";
const erc20TokenData = await paymaster.getSupportedERC20TokenData(erc20TokenAddress);
Paramater | Type | Description | Token Address | string | Onchain ERC-20 Token Address |
Paramater | Type | tokens | ERC20Token[] Object[]
Key | Value Type | Description | symbol | string | Token Symbol | address | string | Token contract address | decimal | number | Decimals of token | fee | bigint | Gas fee in unit of of the token | exchangeRate | bigint | Exchange rate of token |
|
Details
{
symbol: 'CTT',
address: '0xFa5854FBf9964330d761961F46565AB7326e5a3b',
decimal: 18,
fee: 0n,
exchangeRate: 1001219705870085130n
}
Source code
getSupportedERC20TokenData
createPaymasterUserOperation
Estimates gas limits and set paymasterAndData. Returns a complete userOperation
Usage
- example.ts
- Param Types
- Response Type
import { UserOperation } from "abstractionkit";
const bundlerRPC = "https://sepolia.voltaire.candidewallet.com/rpc";
let userOperation = {
sender: '0xb8741a449d50ed0dcfe395287f85be152884c8d9',
nonce: 10n,
initCode: '0x',
callData: '0x541d63c800000000000000000000000038869bf66a61cf6bdb996a6ae40d5853fd43b52600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000001448d80ff0a000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000f2009a7af758ae5d7b6aae84fe4c5ba67c041dfe5336000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000246a627842000000000000000000000000b8741a449d50ed0dcfe395287f85be152884c8d9009a7af758ae5d7b6aae84fe4c5ba67c041dfe5336000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000246a627842000000000000000000000000b8741a449d50ed0dcfe395287f85be152884c8d9000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
callGasLimit: 0n,
verificationGasLimit: 0n,
preVerificationGas: 0n,
maxFeePerGas: 66195658616n,
maxPriorityFeePerGas: 120000n,
paymasterAndData: '0x',
signature: '0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff'
}
userOperation = createPaymasterUserOperation(userOperation, bundlerRPC);
Paramater | Type | userOperation | UserOperation object
Key | Value Type | Description | sender | string | The account making the operation | nonce | string | Anti-replay parameter (see “Semi-abstracted Nonce Support” ) | initCode | string | The initCode of the account (needed if and only if the account is not yet on-chain and needs to be created) | callData | string | The data to pass to the sender during the main execution call | callGasLimit | bigint | The amount of gas to allocate the main execution call | verificationGasLimit | bigint | The amount of gas to allocate for the verification step | preVerificationGas | bigint | The amount of gas to pay for to compensate the bundler for pre-verification execution and calldata | maxFeePerGas | bigint | Maximum fee per gas (similar to EIP-1559 max_fee_per_gas) | maxPriorityFeePerGas | bigint | Maximum priority fee per gas (similar to EIP-1559 max_priority_fee_per_gas) | paymasterAndData | string | Address of paymaster sponsoring the transaction, followed by extra data to send to the paymaster (empty for self-sponsored transaction). Revolves to '0x' if not using a paymaster, and a paymasterDummyData when estimating gas | signature | string | The signature for the userOperation. It is the data passed into the account along with the nonce during the verification step. Resolves to '0x' when the user did not provide their signature yet |
|
Bundler URL | Type | Description | string | The Bundler URL. It is used to fetch the gas limits |
|
context | Type | Description | CandidePaymasterContext object. (optional)
Key | Value Type | Description | token | string | ERC20 token address. (optional) |
| Context for information to pass to the paymaster |
|
StateOverrideSet | Type | Description | StateOverrideSet object. (optional)
Key | Value Type | Description | key | string | The key for the state override set. | value | AddressToState | The AddressToState value for the state override set. |
AddressToState object
Key | Value Type | Description | balance | bigint | undefined | The balance of the address. | nonce | bigint | undefined | The nonce of the address. | code | string | undefined | The code associated with the address. | state | Dictionary<string> | undefined | The state associated with the address. | stateDiff | Dictionary<string> | undefined | The state difference associated with the address. |
| Wrapper for state overrides for gas estimation |
|
Paramater | Type | userOperation | Promise<UserOperation> object Key | Value Type | Description | sender | string | The account making the operation | nonce | string | Anti-replay parameter (see “Semi-abstracted Nonce Support” ) | initCode | string | The initCode of the account (needed if and only if the account is not yet on-chain and needs to be created) | callData | string | The data to pass to the sender during the main execution call | callGasLimit | bigint | The amount of gas to allocate the main execution call | verificationGasLimit | bigint | The amount of gas to allocate for the verification step | preVerificationGas | bigint | The amount of gas to pay for to compensate the bundler for pre-verification execution and calldata | maxFeePerGas | bigint | Maximum fee per gas (similar to EIP-1559 max_fee_per_gas) | maxPriorityFeePerGas | bigint | Maximum priority fee per gas (similar to EIP-1559 max_priority_fee_per_gas) | paymasterAndData | string | Address of paymaster sponsoring the transaction, followed by extra data to send to the paymaster (empty for self-sponsored transaction). Revolves to '0x' if not using a paymaster, and a paymasterDummyData when estimating gas | signature | string | The signature for the userOperation. It is the data passed into the account along with the nonce during the verification step. Resolves to '0x' when the user did not provide their signature yet |
|
Details
{
sender: '0xb8741a449d50ed0dcfe395287f85be152884c8d9',
nonce: 10n,
initCode: '0x',
callData: '0x541d63c800000000000000000000000038869bf66a61cf6bdb996a6ae40d5853fd43b52600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000001e48d80ff0a0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000018b009a7af758ae5d7b6aae84fe4c5ba67c041dfe5336000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000246a627842000000000000000000000000b8741a449d50ed0dcfe395287f85be152884c8d9009a7af758ae5d7b6aae84fe4c5ba67c041dfe5336000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000246a627842000000000000000000000000b8741a449d50ed0dcfe395287f85be152884c8d900fa5854fbf9964330d761961f46565ab7326e5a3b00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000044095ea7b30000000000000000000000003fe285dcd76bcce4ac92d38a6f2f8e964041e02000000000000000000000000000000000000000000000000000a1d1b51fe47c5c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
callGasLimit: 116807n,
verificationGasLimit: 75441n,
preVerificationGas: 50444n,
maxFeePerGas: 66195658616n,
maxPriorityFeePerGas: 120000n,
paymasterAndData: '0x3fE285DcD76BCcE4Ac92d38A6F2F8E964041e020Fa5854FBf9964330d761961F46565AB7326e5a3b00000065bcd7fc00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000de84cb0d94beb10a4658077bd4ad19f4fdf94425ec730f342b8115d9907f6072f40bcea6a95bce74c29b84a7d4ee9fa67f4efb39e25a2e39a2ecb110b9a0af6b6a9589bfef7ec431b',
signature: '0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff'
}
Source code
createPaymasterUserOperation
Source code
createSponsorPaymasterUserOperation
createTokenPaymasterUserOperation
Estimates gas limits and set paymasterAndData
for ERC-20 Token Paymaster. Returns a complete userOperation
Usage
- example.ts
- Param Types
- Response Type
import { SmartAccount, CandidePaymaster } from "abstractionkit";
const paymasterRPC="https://api.candide.dev/paymaster/$version/$network/$apikey";
const erc20TokenAddress = "0xFa5854FBf9964330d761961F46565AB7326e5a3b";
const bundlerRPC = "https://sepolia.voltaire.candidewallet.com/rpc";
const ownerPublicAddress = "0x2Ef844456580b6e1E22e1D584EBbC2467D9298B2"
const smartAccount = SafeAccount.initializeNewAccount([ownerPublicAddress])
let userOperation = {
sender: '0xb8741a449d50ed0dcfe395287f85be152884c8d9',
nonce: 10n,
initCode: '0x',
callData: '0x541d63c800000000000000000000000038869bf66a61cf6bdb996a6ae40d5853fd43b52600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000001448d80ff0a000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000f2009a7af758ae5d7b6aae84fe4c5ba67c041dfe5336000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000246a627842000000000000000000000000b8741a449d50ed0dcfe395287f85be152884c8d9009a7af758ae5d7b6aae84fe4c5ba67c041dfe5336000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000246a627842000000000000000000000000b8741a449d50ed0dcfe395287f85be152884c8d9000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
callGasLimit: 0n,
verificationGasLimit: 0n,
preVerificationGas: 0n,
maxFeePerGas: 66195658616n,
maxPriorityFeePerGas: 120000n,
paymasterAndData: '0x',
signature: '0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff'
}
const paymaster: CandidePaymaster = new CandidePaymaster(paymasterRPC);
userOperation = await paymaster.createTokenPaymasterUserOperation(
smartAccount,
userOperation,
erc20TokenAddress,
bundlerUrl,
);
Paramater | Type | Smart Account | SmartAccount class
Key | Value Type | Description | accountAddress | string | The address of the smart account. | proxyByteCode | string | The bytecode of the proxy. | initializerFunctionSelector | string | The selector for the initializer function. | initializerFunctionInputAbi | string[] | The ABI for the initializer function input. | executorFunctionSelector | string | The selector for the executor function. | executorFunctionInputAbi | string[] | The ABI for the executor function input. |
|
userOperation | UserOperation object
Key | Value Type | Description | sender | string | The account making the operation | nonce | string | Anti-replay parameter (see “Semi-abstracted Nonce Support” ) | initCode | string | The initCode of the account (needed if and only if the account is not yet on-chain and needs to be created) | callData | string | The data to pass to the sender during the main execution call | callGasLimit | bigint | The amount of gas to allocate the main execution call | verificationGasLimit | bigint | The amount of gas to allocate for the verification step | preVerificationGas | bigint | The amount of gas to pay for to compensate the bundler for pre-verification execution and calldata | maxFeePerGas | bigint | Maximum fee per gas (similar to EIP-1559 max_fee_per_gas) | maxPriorityFeePerGas | bigint | Maximum priority fee per gas (similar to EIP-1559 max_priority_fee_per_gas) | paymasterAndData | string | Address of paymaster sponsoring the transaction, followed by extra data to send to the paymaster (empty for self-sponsored transaction). Revolves to '0x' if not using a paymaster, and a paymasterDummyData when estimating gas | signature | string | The signature for the userOperation. It is the data passed into the account along with the nonce during the verification step. Resolves to '0x' when the user did not provide their signature yet |
|
ERC20 Token Address | Type | Description | string | Onchain ERC-20 Token Address used for gas payment |
|
Bundler URL | Type | Description | string | The Bundler URL. It is used to fetch the gas limits |
|
Paramater | Type | userOperation | Promise<UserOperation> object Key | Value Type | Description | sender | string | The account making the operation | nonce | string | Anti-replay parameter (see “Semi-abstracted Nonce Support” ) | initCode | string | The initCode of the account (needed if and only if the account is not yet on-chain and needs to be created) | callData | string | The data to pass to the sender during the main execution call | callGasLimit | bigint | The amount of gas to allocate the main execution call | verificationGasLimit | bigint | The amount of gas to allocate for the verification step | preVerificationGas | bigint | The amount of gas to pay for to compensate the bundler for pre-verification execution and calldata | maxFeePerGas | bigint | Maximum fee per gas (similar to EIP-1559 max_fee_per_gas) | maxPriorityFeePerGas | bigint | Maximum priority fee per gas (similar to EIP-1559 max_priority_fee_per_gas) | paymasterAndData | string | Address of paymaster sponsoring the transaction, followed by extra data to send to the paymaster (empty for self-sponsored transaction). Revolves to '0x' if not using a paymaster, and a paymasterDummyData when estimating gas | signature | string | The signature for the userOperation. It is the data passed into the account along with the nonce during the verification step. Resolves to '0x' when the user did not provide their signature yet |
|
Details
{
sender: '0xb8741a449d50ed0dcfe395287f85be152884c8d9',
nonce: 10n,
initCode: '0x',
callData: '0x541d63c800000000000000000000000038869bf66a61cf6bdb996a6ae40d5853fd43b52600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000001e48d80ff0a0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000018b009a7af758ae5d7b6aae84fe4c5ba67c041dfe5336000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000246a627842000000000000000000000000b8741a449d50ed0dcfe395287f85be152884c8d9009a7af758ae5d7b6aae84fe4c5ba67c041dfe5336000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000246a627842000000000000000000000000b8741a449d50ed0dcfe395287f85be152884c8d900fa5854fbf9964330d761961f46565ab7326e5a3b00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000044095ea7b30000000000000000000000003fe285dcd76bcce4ac92d38a6f2f8e964041e02000000000000000000000000000000000000000000000000000a1d1b51fe47c5c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
callGasLimit: 116807n,
verificationGasLimit: 75441n,
preVerificationGas: 50444n,
maxFeePerGas: 66195658616n,
maxPriorityFeePerGas: 120000n,
paymasterAndData: '0x3fE285DcD76BCcE4Ac92d38A6F2F8E964041e020Fa5854FBf9964330d761961F46565AB7326e5a3b00000065bcd7fc00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000de84cb0d94beb10a4658077bd4ad19f4fdf94425ec730f342b8115d9907f6072f40bcea6a95bce74c29b84a7d4ee9fa67f4efb39e25a2e39a2ecb110b9a0af6b6a9589bfef7ec431b',
signature: '0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff'
}
Source code
createTokenPaymasterUserOperation
calculateUserOperationErc20TokenMaxGasCost
Calculates the maximum gas cost in ERC-20 tokens for a given userOperation
Usage
- example.ts
- Param Types
- Response Type
import { CandidePaymaster } from "abstractionkit";
const paymasterRPC="https://api.candide.dev/paymaster/$version/$network/$apikey";
const erc20TokenAddress = "0xFa5854FBf9964330d761961F46565AB7326e5a3b";
let userOperation = {
sender: '0xb8741a449d50ed0dcfe395287f85be152884c8d9',
nonce: 10n,
initCode: '0x',
callData: '0x541d63c800000000000000000000000038869bf66a61cf6bdb996a6ae40d5853fd43b52600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000001e48d80ff0a0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000018b009a7af758ae5d7b6aae84fe4c5ba67c041dfe5336000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000246a627842000000000000000000000000b8741a449d50ed0dcfe395287f85be152884c8d9009a7af758ae5d7b6aae84fe4c5ba67c041dfe5336000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000246a627842000000000000000000000000b8741a449d50ed0dcfe395287f85be152884c8d900fa5854fbf9964330d761961f46565ab7326e5a3b00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000044095ea7b30000000000000000000000003fe285dcd76bcce4ac92d38a6f2f8e964041e02000000000000000000000000000000000000000000000000000a1d1b51fe47c5c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
callGasLimit: 116807n,
verificationGasLimit: 75441n,
preVerificationGas: 50444n,
maxFeePerGas: 66195658616n,
maxPriorityFeePerGas: 120000n,
paymasterAndData: '0x3fE285DcD76BCcE4Ac92d38A6F2F8E964041e020Fa5854FBf9964330d761961F46565AB7326e5a3b00000065bcd7fc00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000de84cb0d94beb10a4658077bd4ad19f4fdf94425ec730f342b8115d9907f6072f40bcea6a95bce74c29b84a7d4ee9fa67f4efb39e25a2e39a2ecb110b9a0af6b6a9589bfef7ec431b',
signature: '0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff'
}
const paymaster: CandidePaymaster = new CandidePaymaster(paymasterRPC);
const cost = await paymaster.calculateUserOperationErc20TokenMaxGasCost(
userOperation,
erc20TokenAddress,
);
Paramater | Type | userOperation | UserOperation object
Key | Value Type | Description | sender | string | The account making the operation | nonce | string | Anti-replay parameter (see “Semi-abstracted Nonce Support” ) | initCode | string | The initCode of the account (needed if and only if the account is not yet on-chain and needs to be created) | callData | string | The data to pass to the sender during the main execution call | callGasLimit | bigint | The amount of gas to allocate the main execution call | verificationGasLimit | bigint | The amount of gas to allocate for the verification step | preVerificationGas | bigint | The amount of gas to pay for to compensate the bundler for pre-verification execution and calldata | maxFeePerGas | bigint | Maximum fee per gas (similar to EIP-1559 max_fee_per_gas) | maxPriorityFeePerGas | bigint | Maximum priority fee per gas (similar to EIP-1559 max_priority_fee_per_gas) | paymasterAndData | string | Address of paymaster sponsoring the transaction, followed by extra data to send to the paymaster (empty for self-sponsored transaction). Revolves to '0x' if not using a paymaster, and a paymasterDummyData when estimating gas | signature | string | The signature for the userOperation. It is the data passed into the account along with the nonce during the verification step. Resolves to '0x' when the user did not provide their signature yet |
|
ERC20 Token Address | Type | Description | string | Onchain ERC-20 Token Address used for gas payment |
|
Paramater | Type | Description | Cost | Promise<bigInt> | The maximum gas cost in ERC-20 tokens |
Details
Source code
calculateUserOperationErc20TokenMaxGasCost