Skip to content

Latest commit

 

History

History
34 lines (23 loc) · 1.56 KB

1-installation-and-setup.mdx

File metadata and controls

34 lines (23 loc) · 1.56 KB
title sidebar_position
Installation And Setup
1

To get started with the Flutter SDK, add the following dependency to your project's pubspec.yamlfile:

flutter pub add fuse_wallet_sdk

Once you have installed the package, you can import it into your Dart code:

import 'package:fuse_wallet_sdk/fuse_wallet_sdk.dart';

Usage

To use the Fuse Flutter SDK in your project, you must create an instance of the FuseSDK class. This class is the key to interacting with the Fuse API using the SDK. Fortunately, the FuseSDK class provides a range of instance methods, allowing you to execute various operations with the API.

Whether you aim to fetch or create a smart wallet, relay an ERC20/FUSE transfer, relay an ERC721 transfer, relay a generic transaction, swap tokens, or stake tokens, the FuseSDK class has you covered. Additionally, the SDK provides data features that allow you to get the list of tokens owned by an address, get token details, and get a smart wallet's token balance.

The following code initializes the Fuse SDK and creates an instance of the FuseSDK class. The apiKey variable should be set to your own API key.

import 'package:fuse_wallet_sdk/fuse_wallet_sdk.dart';

final apiKey = 'API_KEY';
final privateKey = EthPrivateKey.fromHex('YOUR_PRIVATE_KEY');
final fuseSDK = await FuseSDK.init(apiKey, privateKey);

Once you have created an instance of the FuseSDK class, you can use its instance methods to interact with the Fuse API. In the following section, we will cover the available methods of the SDK.