SDK Methods for <v0.1.13
Compatible Networks
Ethereum Goerli
Polygon Mumbai
Instance creation and imports
Developers can directly get access to Banana module through our SDK just by importing the banana module from banana-wallet-sdk
Once you successfully imported Banana Module, you can start accessing the methods it exposes just by creating an instance of it by specifying the appropriate chain. Currently, we are on Georli Testnet and polygon Mumbai.
You can create a banana Instance as:
Methods by Banana Module
Once the instance is ready, developers can access multiple methods the banana module provides.
Methods offered by the banana module are:
getWalletName
isWalletNameUnique
getWalletAddress
getAAProvider
execute
getWalletName
getWalletName
the method enables developers to read user cookies and get the wallet name saved into the cookie for display purposes and get a smart contract wallet address. If this method doesn't return anything, then it surely means the user might have cleared the cookies. In this case, the developers should manually prompt the user for the wallet name.
Usage
isWalletNameUnique
isWalletNameUnique
the method enables developers to check whether the wallet name their user suggests is unique. We had kept the wallet name as the primary key in the wallet credentials database on our server. (Suggestion: users can keep their Gmail account username as their wallet name as it's always unique).
Usage
getWalletAddress
getWalletAddress
is one of the most critical methods for our banana SDK as it enables developers to fetch the smart contract wallet Address for their user additionally it setups multiple entities at the SDK core.
It handles two cases.
The user has already created a wallet.
In this case, our SDK will fetch the wallet address of the deployed smart contract wallet from the passed wallet name.
The user hasn't created any wallet.
In this case, our SDK will initialize a smart contract wallet for the user and will require biometric / passcode-based authentication for the process. Once initialization completes, it will return the deterministic smart contract wallet address, which users can further fund and start making transactions.
Usage
getAAProvider
getAAProvider
getAAProvider
enables developers to get ERC 4337-based providers for their smart contract wallet, which developers can use in multiple ways. This includes signing transactions (Work in progress), creating contract instances with signers, etc.
Usage
signMessage
signMessage
Developers can utilize signMessage method of bananaInstance to enable users to sign messages using their wallet. While signing, The message passed will be hashed and then signed by the wallet.
Usage
execute
execute
Developers can utilize the execute method of banana to execute a transaction via users' smart contract wallet. To use this method, developers must pass on callData
a function (call data of function which user wants to call), destination address (contract address whose function is getting called), and value (in case of payable function is called).
For now, we are supporting single transaction execution bundling is under development.
Please don't use this method for view function calls. For just to read any contract data you can directly call it from your contract instance.
Usage
PS: if after following this documentation you are experiencing webpack polyfill issue please refer to this page
If you have any questions please post them Banana SDK Discord forum.
Last updated