FuseSDK class

The main SDK class for interacting with FuseBox.

Provides methods for wallet interaction, calling contracts, and managing tokens.

Constructors

FuseSDK(String publicApiKey, {String baseUrl = Variables.BASE_URL})
Creates a new instance of the SDK.

Properties

client IClient
latefinal
explorerModule → ExplorerModule
Provides access to the explorer module.
no setter
graphQLModule → GraphQLModule
Provides access to the graphQL module.
no setter
hashCode int
The hash code for this object.
no setterinherited
nftModule → NftModule
Provides access to the NFT module.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
stakingModule → StakingModule
Provides access to the staking module.
no setter
tradeModule → TradeModule
Provides access to the trade module.
no setter
wallet EtherspotWallet
latefinal
webSocketConnection WebSocketConnection?
The WebSocket connection used by the Fuse Wallet SDK.
getter/setter pair

Methods

approveNFTToken(EthereumAddress nftContractAddress, EthereumAddress spender, BigInt tokenId, [TxOptions? options]) Future<ISendUserOperationResponse>
Approves a spender to transfer or withdraw a specific NFT tokenId on behalf of the user.
approveToken(EthereumAddress tokenAddress, EthereumAddress spender, BigInt amount, [TxOptions? options]) Future<ISendUserOperationResponse>
Approves the spender to withdraw or transfer a certain amount of tokens on behalf of the user's address.
approveTokenAndCallContract(EthereumAddress tokenAddress, EthereumAddress spender, BigInt value, Uint8List callData, [TxOptions? options]) Future<ISendUserOperationResponse>
Approves a token for spending and then calls a contract.
authenticate(EthPrivateKey credentials) Future<String>
Authenticates the user using the provided private key credentials.
callContract(EthereumAddress to, BigInt value, Uint8List data, [TxOptions? options]) Future<ISendUserOperationResponse>
Calls a contract with the specified parameters.
disconnectWebSocketClient() Future<void>?
Disconnects the WebSocket client.
executeBatch(List<Call> calls, [TxOptions? options]) Future<ISendUserOperationResponse>
Executes a batch of calls in a single transaction.
getAllowance(EthereumAddress tokenAddress, EthereumAddress spender) Future<BigInt>
Retrieves the allowance of tokens that a spender is allowed to withdraw from an owner.
getBalance(EthereumAddress tokenAddress, EthereumAddress address) Future<BigInt>
Retrieves the balance of a specified address for a given token.
getWalletActions({int page = 1, int limit = 10, String? tokenAddress}) Future<WalletActionResult>
Retrieves historical actions for a smart wallet, with optional filtering by token address and update time.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
reconnectWebSocketClient() Future<void>?
Reconnects the WebSocket client.
setWalletFees(BigInt fee) → void
Sets the maximum fee per gas and priority fee per gas for the wallet.
stakeToken(StakeRequestBody stakeRequestBody, [TxOptions? options]) Future<ISendUserOperationResponse>
Stakes tokens based on the provided stakeRequestBody.
subscribeToUserOp(String userOpHash) Stream<SmartWalletEvent>
Subscribes to a user operation with the provided userOpHash.
swapTokens(TradeRequest tradeRequest, [TxOptions? options]) Future<ISendUserOperationResponse>
Swaps tokens based on the provided TradeRequest.
toString() String
A string representation of this object.
inherited
transferNFT(EthereumAddress nftContractAddress, EthereumAddress recipientAddress, num tokenId, [TxOptions? options]) Future<ISendUserOperationResponse>
Transfers an NFT with a given tokenId to the recipientAddress.
transferToken(EthereumAddress tokenAddress, EthereumAddress recipientAddress, BigInt amount, [TxOptions? options]) Future<ISendUserOperationResponse>
Transfers a specified amount of tokens from the user's address to the recipientAddress.
unstakeToken(UnstakeRequestBody unstakeRequestBody, EthereumAddress unStakeTokenAddress, [TxOptions? options]) Future<ISendUserOperationResponse>
Unstakes tokens based on the provided unstakeRequestBody.

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

defaultTxOptions TxOptions
Default transaction options.
final

Static Methods

init(String publicApiKey, EthPrivateKey credentials, {String baseUrl = Variables.BASE_URL, String websocketServerURL = Variables.DEFAULT_SOCKET_SERVER_URL, bool withPaymaster = false, Map<String, dynamic>? paymasterContext, IPresetBuilderOpts? opts, IClientOpts? clientOpts}) Future<FuseSDK>
Initializes the SDK.