Skip to main content

Create Smart Contract Wallet

Initialization

The init method is a fundamental feature of the SDK that enables you to setup a wallet & authenticate the user's provided credentials. The method requires the use of a PRIVATE_KEY which you can get in the Fuse Developer Console here. When you send a request to the server using this method, it verifies the credentials and if the credentials are valid, developers can use the getSender() to return an address.

import { ethers } from "ethers";
import { FuseSDK } from "@fuseio/fusebox-web-sdk";

const apiKey = "API_KEY";
const credentials = new ethers.Wallet("PRIVATE_KEY");
const fuse = await FuseSDK.init(apiKey, credentials);

Access the wallet

// Create Wallet
const smartContractAddress = fuseSDK.wallet.getSender();
console.log(`Sender Address is ${smartContractAddress}`);