A modified version of the AbstractionKit library to enable support for data-dependent user operations.
For full detailed documentation visit the Candide docs page.
npm install abstractionkit
The kit is used exaclty as the original one, refer to the original readme for a quickstart.
The only difference is the management of data dependent user operations. If a contract the user is interacting with requires data, the kit will make use of contract calls and special bundler endpoints to manage that. Make sure that the bundler you're connecting to supports data-dependency.
const transaction : MetaTransaction = {
to: yourDataDepndentContract,
value: 0n,
data: transactionCallData,
}
// bundler will provide gas estimation on data-dependent endpoints
// the userOperation object is also containing the data requirements
const userOperation = await smartAccount.createUserOperation(
[transaction],
jsonRpcNodeProvider, // regular ethereum rpc for your chain
bundlerUrl, // must be a dd-bundler
)
userOperation.signature = smartAccount.signUserOperation(
userOperation,
[ownerPrivateKey],
chainId,
)
// correct bundler endpoint will be used according to data-dependecy
const sendUserOperationResponse = await smartAccount.sendUserOperation(
userOperation, bundlerUrl
)
MIT