Lower-level Calibur7702Account helpers. Most integrations do not need them: createUserOperation fetches the nonce and encodes the call data for you. To create the account from an existing EOA and send UserOperations, start with Calibur Account.
Methods at a Glance
| Method | Signature | Returns |
|---|
| getNonce | getNonce(providerRpc, sequenceKey?) | Promise<bigint> |
| createAccountCallData (static) | Calibur7702Account.createAccountCallData(transactions, revertOnFailure?) | string |
| wrapSignature (static) | Calibur7702Account.wrapSignature(keyHash, rawSignature, hookData?) | string |
| getUserOperationHash | getUserOperationHash(userOperation, chainId) | string |
| prependTokenPaymasterApproveToCallData | prependTokenPaymasterApproveToCallData(callData, tokenAddress, paymasterAddress, approveAmount) | string |
| prependTokenPaymasterApproveToCallDataStatic (static) | Calibur7702Account.prependTokenPaymasterApproveToCallDataStatic(callData, tokenAddress, paymasterAddress, approveAmount) | string |
| createInvalidateNonceMetaTransaction (static) | Calibur7702Account.createInvalidateNonceMetaTransaction(newNonce) | SimpleMetaTransaction |
Utility Methods
getNonce
Gets the account nonce from the EntryPoint. Supports parallel nonce channels via the optional sequenceKey parameter.
- example.ts
- Param Types
- Return Type
example.ts
const nonce = await smartAccount.getNonce(
"https://ethereum-sepolia-rpc.publicnode.com"
);
console.log("Nonce:", nonce);
const parallelNonce = await smartAccount.getNonce(
"https://ethereum-sepolia-rpc.publicnode.com",
1
);
| key | type | description |
|---|
providerRpc | string | Transport | JsonRpcNode | JSON-RPC endpoint for blockchain queries |
sequenceKey? | number | Optional sequence key for parallel nonce channels (default: 0) |
| key | type | description |
|---|
nonce | bigint | The fully constructed nonce (sequenceKey << 64) | seq |
Source code
getNonce
createAccountCallData
Static method. Encodes calldata for executeUserOp with BatchedCall format. All transactions (even single ones) go through the same BatchedCall path.
- example.ts
- Param Types
- Return Type
example.ts
import { Calibur7702Account } from "abstractionkit";
const transactions = [
{ to: "0x...", value: 0n, data: "0x..." },
{ to: "0x...", value: 1000000000000000000n, data: "0x" },
];
const callData = Calibur7702Account.createAccountCallData(transactions);
const callDataNoRevert = Calibur7702Account.createAccountCallData(transactions, false);
| key | type | description |
|---|
transactions | SimpleMetaTransaction[] | One or more transactions to encode into BatchedCall format |
revertOnFailure? | boolean | Whether to revert the entire batch if any call fails (default: true) |
| key | type | description |
|---|
callData | string | Encoded calldata for the executeUserOp function |
Source code
createAccountCallData
wrapSignature
Static method. Wraps a raw ECDSA signature in Calibur's signature format: abi.encode(bytes32 keyHash, bytes signature, bytes hookData). Use this when signing externally (e.g., with viem, hardware wallet, MPC) to avoid manually ABI-encoding the wrapped signature.
- example.ts
- Param Types
- Return Type
example.ts
import { Calibur7702Account } from "abstractionkit";
const ROOT_KEY_HASH = "0x0000000000000000000000000000000000000000000000000000000000000000";
const rawEcdsaSignature = "0x...";
const wrappedSignature = Calibur7702Account.wrapSignature(
ROOT_KEY_HASH,
rawEcdsaSignature,
);
const wrappedWithHook = Calibur7702Account.wrapSignature(
"0x...secondary-key-hash",
rawEcdsaSignature,
"0x...hook-data",
);
| key | type | description |
|---|
keyHash | string | The key hash (use 0x00...00 for the EOA root key) |
rawSignature | string | The raw ECDSA signature (65 bytes, hex-encoded) |
hookData? | string | Optional hook data (default: "0x") |
| key | type | description |
|---|
signature | string | Hex-encoded wrapped signature ready for userOp.signature |
Source code
wrapSignature
getUserOperationHash
Computes the UserOperation hash for this account's EntryPoint. Convenience wrapper that automatically uses this account's EntryPoint address.
- example.ts
- Param Types
- Return Type
example.ts
const userOpHash = smartAccount.getUserOperationHash(
userOperation,
11155111n
);
console.log("UserOperation hash:", userOpHash);
| key | type | description |
|---|
userOperation | object | The UserOperation to hash |
userOperation.sender | string | The account making the operation |
userOperation.nonce | bigint | Anti-replay parameter (see Semi-abstracted Nonce Support) |
userOperation.factory | string | null | Account factory address, only for new accounts (null if account already exists) |
userOperation.factoryData | string | null | Data for account factory (null if account already exists) |
userOperation.callData | string | The data to pass to the sender during the main execution call |
userOperation.callGasLimit | bigint | The amount of gas to allocate the main execution call |
userOperation.verificationGasLimit | bigint | The amount of gas to allocate for the verification step |
userOperation.preVerificationGas | bigint | The amount of gas to pay for to compensate the bundler for pre-verification execution and calldata |
userOperation.maxFeePerGas | bigint | Maximum fee per gas (similar to EIP-1559 max_fee_per_gas) |
userOperation.maxPriorityFeePerGas | bigint | Maximum priority fee per gas (similar to EIP-1559 max_priority_fee_per_gas) |
userOperation.paymaster | string | null | Address of paymaster contract (null if account pays for itself) |
userOperation.paymasterVerificationGasLimit | bigint | null | The amount of gas to allocate for the paymaster verification step (null if no paymaster) |
userOperation.paymasterPostOpGasLimit | bigint | null | The amount of gas to allocate for the paymaster post-operation code (null if no paymaster) |
userOperation.paymasterData | string | null | Data for paymaster (null if no paymaster) |
userOperation.eip7702Auth | Authorization7702Hex | null | EIP-7702 authorization data for EOA delegation (null if not using EIP-7702) |
userOperation.signature | string | Data passed into the account to verify authorization. Resolves to '0x' when the user did not provide their signature yet |
chainId | bigint | Target chain ID |
| key | type | description |
|---|
hash | string | The UserOperation hash as a hex string |
Source code
getUserOperationHash
prependTokenPaymasterApproveToCallData
Prepends a token approve call to existing calldata for a token paymaster. Decodes the existing BatchedCall, prepends an ERC-20 approve transaction, and re-encodes.
- example.ts
- Param Types
- Return Type
example.ts
const callDataWithApproval = smartAccount.prependTokenPaymasterApproveToCallData(
userOperation.callData,
"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"0x...",
1000000n
);
userOperation.callData = callDataWithApproval;
| key | type | description |
|---|
callData | string | Existing encoded calldata (executeUserOp format) |
tokenAddress | string | Address of the ERC-20 token contract to approve |
paymasterAddress | string | Address of the paymaster contract to approve as spender |
approveAmount | bigint | Amount of tokens to approve for the paymaster |
| key | type | description |
|---|
callData | string | Re-encoded calldata with the token approval prepended |
Source code
prependTokenPaymasterApproveToCallData
Static method. Creates a meta-transaction that invalidates Calibur nonces up to a given value. newNonce is laid out as (key << 64) | sequence, and every nonce of that key below the sequence becomes invalid. This acts on Calibur's own nonce, the one its signed batched calls use. It does not change the EntryPoint nonce that getNonce reads and UserOperations use, so it cannot cancel a signed UserOperation.
- example.ts
- Param Types
- Return Type
example.ts
import { Calibur7702Account } from "abstractionkit";
const invalidateTx = Calibur7702Account.createInvalidateNonceMetaTransaction(100n);
const userOperation = await smartAccount.createUserOperation(
[invalidateTx],
nodeRpc,
bundlerRpc,
);
| key | type | description |
|---|
newNonce | bigint | The new Calibur nonce, laid out as (key << 64) | sequence. Nonces of that key below the sequence are invalidated. EntryPoint nonces are not affected. |
| key | type | description |
|---|
transaction | object | A SimpleMetaTransaction that calls invalidateNonce(uint256) |
transaction.SimpleMetaTransaction | object | SimpleMetaTransaction is the type of transaction used with Calibur7702Account. |
transaction.SimpleMetaTransaction.to | string | Target contract address for the transaction |
transaction.SimpleMetaTransaction.value | bigint | Value transferred in the transaction (usually 0n for contract interactions) |
transaction.SimpleMetaTransaction.data | string | The call data for the transaction |
Source code
createInvalidateNonceMetaTransaction