The getWallet function in the SDK returns the public wallet of the user. The user might be asked to go through a verification process before the wallet is returned.
This function returns the same response as the /v3/getWallet API endpoint.
{
"status": "SUCCESS",
"wallet": {
"ethAddress": "0xD570518061287E79f137fca98D56902e086f95CB",
"solAddress": "B4H5koiRxUuGz7YKALucvxUAc81k4b9Xf3aGTFXQ42mF",
"eosAddress": "EOS8cfYwFefRy1pEeiWhvP5K5H3TV9514jyvuYeHEz1sqXbywGc2f"
}
}
Use/v3/getWalletAPI endpoint insteadFor lower user friction, we recommend using the
/v3/getWalletAPI endpoint instead of the SDK. The/v3/getWalletAPI endpoint doesn't require user verification.SDK
getWalletwill always require user verification unless you provide a user when initializing the SDK
Calling getWallet
getWalletgetWallet return a promise that resolves when the user verification is complete. Here's what the call will look like:
wallet = await sdk.getWallet();The response looks like this:
{
"status": "SUCCESS",
"wallet": {
"ethAddress": "0xD570518061287E79f137fca98D56902e086f95CB",
"solAddress": "B4H5koiRxUuGz7YKALucvxUAc81k4b9Xf3aGTFXQ42mF",
"eosAddress": "EOS8cfYwFefRy1pEeiWhvP5K5H3TV9514jyvuYeHEz1sqXbywGc2f"
}
}Here's a reference implementation of this code: https://jsfiddle.net/passbird/7xe3k24p/
Error status
getWallet returns a promise which throws an error when the consent operation is unsuccessful. The error object looks like so-
{
status: "USER_REQUEST_DENIED"
}Here's a table of all possible error status returned by the SDK
Status | Description |
|---|---|
USER_REQUEST_DENIED | The user has denied the get wallet request. |
INVALID_EMAIL | SDK has been initialized with an invalid user email. |
APP_ID_REQUIRED | No app id was provided when initializing the SDK. |
APP_NOT_FOUND | Provided app id is invalid. |
SOMETHING_WENT_WRONG | An unknown error occurred. |
© Copyright 2024, Passbird Research Inc.
