The FuseBox Web SDK gives you a TypeScript-first interface to Fuse’s account abstraction infrastructure. With a singleDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/fuseio/fuse-docs/llms.txt
Use this file to discover all available pages before exploring further.
FuseSDK.init() call you get a smart contract wallet scoped to each user’s credentials, and every subsequent operation — token transfers, NFT sends, swaps, staking — is relayed on-chain with gas fees covered by the paymaster. This page covers installation through all core operations, with a troubleshooting reference and migration guide at the end.
Installation
Install the package from npm using your preferred package manager.Initialization
Get an API key
Create a project in the Fuse Developer Console and copy your API key.
Initialize the SDK instance
Call
FuseSDK.init() with your API key and an ethers.Wallet constructed from the user’s private key. Pass withPaymaster: true to have gas fees sponsored automatically.FuseSDK.init() authenticates the supplied credentials against the Fuse API and sets up the underlying smart wallet. No separate wallet-creation request is needed.Core operations
Send a token transfer
UsetransferToken() to relay an ERC-20 or native FUSE transfer. The method covers gas on behalf of the user. It returns a user operation handle you can await to get the final transaction hash.
| Parameter | Type | Description |
|---|---|---|
tokenAddress | address | Contract address of the ERC-20 token, or 0xEeee…EEEE for native FUSE |
recipientAddress | address | Recipient wallet address |
amount | BigInt | Amount in wei |
Send batch transactions
executeBatch() groups multiple calls into a single user operation. A common pattern is an ERC-20 approve followed immediately by a contract call — both land atomically on-chain.
| Parameter | Type | Description |
|---|---|---|
to | address | Target contract address |
value | number | Native value to send |
data | bytes | ABI-encoded call data |
Transfer an NFT
UsetransferNFT() to relay an ERC-721 transfer. Provide the collection contract address, the recipient, and the token ID.
| Parameter | Type | Description |
|---|---|---|
nftContractAddress | address | ERC-721 contract address |
recipientAddress | address | Recipient wallet address |
tokenId | number | ID of the token to transfer |
Swap tokens
UseswapTokens() to exchange one token for another at the current market price. The method accepts a TradeRequest object and relays the swap transaction on behalf of the user.
| Parameter | Type | Description |
|---|---|---|
inputToken | address | Contract address of the token to sell |
outputToken | address | Contract address of the token to buy |
inputAmount | number | Amount of the input token to trade |
exactIn | boolean | true for exact-input trades, false for exact-output |
Get tokens owned by an address
explorerModule.getTokenList() returns the full list of ERC-20 tokens — with name, symbol, and balance — held by any address.
Staking
Get staking options
Retrieve available staking pools from the staking module.Stake tokens
CallstakeToken() with a StakeRequestBody specifying the account, amount, and token. The native token address 0xEeee…EEEE stakes FUSE.
Unstake tokens
CallunstakeToken() with an UnstakeRequestBody and the staking contract address.
Non-blocking transactions
By default each user operation uses a sequential 1D nonce, meaning you must wait for one transaction to land on-chain before submitting the next. For higher-throughput use cases — such as submitting an approve, unstake, withdraw, and transfer in one burst — passuseNonceSequence: true in TxOptions. This activates the 2D nonce manager, which assigns each operation its own nonce key so all four can enter the mempool simultaneously without blocking each other.
You can optionally supply a customNonceKey to pin a specific key.
Troubleshooting
User op cannot be replaced: fee too low
User op cannot be replaced: fee too low
This error means the mempool already contains a pending user operation with the same nonce key and the replacement does not meet the 10% fee bump requirement. To replace a queued user operation, the new operation must set both
maxFeePerGas and maxPriorityFeePerGas at least 10% higher than the existing one.Pass withRetry: true and feeIncrementPercentage: 11 in TxOptions to have the SDK handle the bump automatically:Migration guide
Migrating to v0.2 (EIP-4337 account abstraction)
Version 0.2 aligns the SDK with EIP-4337 and introduces a single-step initialization that replaces the previous multi-step wallet creation flow. What changed- Smart wallet creation now happens automatically during
FuseSDK.init(). You no longer need a separate authenticate-then-create-wallet sequence. - The top-level class is renamed from
FuseWalletSDKtoFuseSDK. - The wallet address accessor changes from
fuseWalletSDK.smartWallet.smartWalletAddresstofuseSDK.wallet.getSender().
Remove the old initialization and wallet-creation code
Delete the following calls from your existing code:
await fuseWalletSDK.authenticate(credentials);await fuseWalletSDK.createWallet();- The
onSmartWalletEventlistener and all associated event handlers.
Migrating from Charge Wallet SDK to Smart Wallets SDK
The Smart Wallets SDK shares the same underlying smart contract wallet architecture as the Charge Wallet SDK, so existing wallets are automatically accessible once a user re-imports their private key credentials. The following breaking changes apply. Field name changes| Old field | New field | Notes |
|---|---|---|
accountAddress | ownerAddress | Value is now EIP-55 checksummed |
walletAddress | smartWalletAddress | — |
backup, balancesOnForeign, apy.
Deprecated APIs
| API | Replacement |
|---|---|
| Job API | SDK events (transactionHash, transactionSucceeded, transactionFailed) |
| Sign-up / Login APIs | Implement your own auth and map wallets to users on your backend |
| Backup API | Implement private key backup in your own app |
| Contacts API | Implement contacts logic in your own app |
FuseSDK.init(). The SDK will derive the same smart wallet address as before.