UerOp-SDK Usage
This document introduces the use of userop-sdk, how dapp assembles userop, and the process of obtaining gas solutions by calling paymaster-rpc, and bundling on-chain.
Install package from github
Import into dapp project
Init build
Set platform apikey to paymaster
Init client(parameters same as build)
Construct builder's transaction data on actual business scenarios
Now get supported tokens
The above data depends on the strategies set by developers on the platform. The dapp analyzes tokens for users to choose gas options:
type=0 freegas. Developer sponsors gas fees, users do not need to pay ERC20.
type=1 prefund erc20. During the verification phase, the system first deducts the full amount of ERC20 from the user, and then returns the excess portion after executing the user operation.
type=2 postfund erc20. After the userop is executed, the system deducts the ERC20 from the user in one go. However, it’s possible that the deduction may fail due to the specific nature of the userop code.
then regenerates the transaction data, requests a signature from the paymaster and submits to the bundler for packaging and uploading to the blockchain.
Last updated