SDK Methods

Compatible Networks

  • Optimism Goerli

  • Ethereum Goerli

  • Polygon Mumbai

  • Gnosis

  • Chiado Gnosis Testnet

  • Shibuya Testnet

  • Astar

  • Polygon Mainnet

Installation

Dev can install the sdk with the package manager of their choice via yarn or npm.

npm install @bananahq/banana-sdk

Or via yarn as

yarn add @bananahq/banana-sdk

Instance creation and imports

Developers can directly get access to Banana module through our SDK just by importing the banana module from banana-sdk

import { Banana } from '@bananahq/banana-sdk'

Once you successfully import Banana Module, you can start accessing the methods it exposes just by creating an instance of it by specifying the appropriate chain.

You can create a banana Instance as:

// importing chains and banana module from banana wallet sdk
import { Banana, Chains } from '@bananahq/banana-sdk'

// creating chain specific instance of banana module
const bananaInstance = new Banana(Chains.mumbai)

For initializing Banana SDK with paymaster please see below docs

💸pagePaymaster Support

Methods by Banana Module

Once the instance is ready, developers can access methods the banana module provides.

Methods offered by the banana module are:

  • connectWallet

connectWallet

connectWallet this method enables developers to create a wallet for their users. The SDK takes in metamask EOA account which is currently active in the metamask wallet and creates a smart contract wallet for it and assign it as owner of the wallet which would be responsible for signing transactions.

Usage

import { Wallet } from '@bananahq/banana-sdk';
   
const walletInstanace: Wallet = await bananaInstance.connectWallet()

// fetching wallet address
const SCWAddress = walletInstance.walletAddress;

PS: if after following this documentation you are experiencing webpack polyfill issue please refer to this page

🧊pageWebpack 5 Polyfill Issue

If you have any questions please post them Banana SDK Discord forum.

Last updated