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.

Flow sequence

Step 1: Authenticate

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.

Step 2: Fetch wallets

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.

Step 3: Resolving the promise

When the necessary checks have been fulfilled, the promise is resolved. If all checks passed, the user will not receive a pop-up.

Signature

venlyConnect.flows.getAccount(chain: SecretType): Promise<Account>

Returns

Promise<Account>

Parameters

Parameter

Type

Description

Example

chain

The requested chain of which it will return a user's wallets.

ETHEREUM

Example

// 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);
});

Object Types

pageAccountpageWallet

Last updated