getAccount
Authenticate, and get the wallets of a user for a specific chain.
This function will return the wallets of a user for a specific chain and if needed to authenticate the user and create a wallet.
venlyConnect.flows.getAccount('ETHEREUM');
This function will trigger a flow of events in order to return a certain state. In this case, fetch the wallets of a user for a specific chain.
Note that the
getAccount
flow will always be triggered in a POPUP. A redirect-flow is not possible for this flow.Verify if a user is logged in, and if so the flow continues, otherwise the user will be prompted to log in or create a new account.
Retrieve the wallets linked to the application's Client ID for a certain chain. When no wallets have been linked, prompt the user to link a wallet with the application. If the user doesn't possess a wallet on the required chain, a new wallet will be created and immediately linked to the application.
When the necessary checks have been fulfilled, the promise is resolved. If all checks passed, the user will not receive a pop-up.
venlyConnect.flows.getAccount(chain: SecretType): Promise<Account>
Promise<Account>
Parameter | Type | Description | Example |
chain | The requested chain of which it will return a user's wallets. | ETHEREUM |
// Authenticate, and get the ethereum wallets of current user.
venlyConnect.flows.getAccount('ETHEREUM').then((account: Account) => {
if(account.isAuthenticated) {
console.log('wallets', account.wallets);
console.log('name', account.auth.tokenParsed.name);
}
}).catch((e) => {
console.log('user closed window, or an error occurred', e);
});
Last modified 6mo ago