Wallet SDK
This guide shows how to use standard web3 wallet functions
Every wallet needs to interact with the blockchain for carrying out various functions. Once the widget is embedded and the user connects their profile through their preferred auth method, a session is created for this user after which the standard wallet functions can be utilized.
AuthMethod
To create a wallet, user first needs to choose how do they want to create the wallet i.e. select their AuthMethod. Currently we support 3 auth methods (with support for more auth methods coming soon) i.e. gmail, email and metamask.
Once the user selects a certain auth method, a wallet is created in the network that makes sure that this wallet is accessible only with a valid login jwt of the selected auth method.
ProfileSession
After successful login of profile, a session is created that allows user to access the SDK functions. The session expires after a certain time or when the user logs out. Without valid session signatures, the MPC network will not allow for signature signing.
Wallet SDK
To access the wallet functions, the following import should be done on the page/component where the functions need to be called.
You can add/remove the types based on the functions you actually use on the page.
Once the application has access to a valid session i.e. the user has successfully logged in, the following wallet functions become accessible.
Get All Connected Accounts
Returns all connected accounts/addresses e.g. [0x123…, 0x456…].
Get Current Connected Account
Get current account connected
Get Signature
Gets the message signed using the connected account and returns the signature.
Verify Message Signature
Verify if the signature matches the message using the current connected account and returns boolean true or false.
Get Balance
Returns balance of the current account in wei. You need to convert it to the required denomination yourself.
Send Transaction
Send a certain amount (in ethers) to a certain address. Returns the transaction object.
Get Block Number
Returns the latest block number.
Get Transaction Count
Returns the transaction count of the given address
Read from contract
Returns the response of executing the given get method of the contract with the given parameters
Write to contract
Returns the transaction response of executing the given write method of the contract with the given parameters
Last updated
Was this helpful?