Retrieve a user account
How to retrieve a user account
The function to retrieve a user account getAccount is one of the most powerful functions that the widget has to offer. Not only does it provide a ton of information, it also takes care of prerequisites, such as authentication and wallet creation.
The function returns the user's profile and the user's wallet(s) all in one response. It will also make sure to authenticate the user and create a wallet for him if needed.

Function

1
venlyConnect.flows.getAccount('ETHEREUM')
Copied!

Example

1
const venlyConnect = new VenlyConnect('YOUR_CLIENT_ID');
2
venlyConnect.flows.getAccount('ETHEREUM').then((account) => {
3
console.log('User name:', account.auth.tokenParsed.name);
4
console.log('User email:', account.auth.tokenParsed.email);
5
console.log('First wallet address:', account.wallets[0].address);
6
console.log('First wallet balance:', account.wallets[0].balance.balance);
7
});
Copied!

Returns

1
{
2
auth: {
3
tokenParsed: {
5
email_verified: true
6
family_name: "Striegel"
7
given_name: "Karel"
8
name: "Karel Striegel"
9
preferred_username: "[email protected]"
10
{
11
wallets: [] {
12
0: {
13
address: "0x6156174Da796228b376e3e58506194543cfBCA38"
14
archived: false
15
balance: {
16
available: true
17
balance: 0.0012
18
decimals: 18
19
gasBalance: 0.0012
20
gasSymbol: "ETH"
21
rawBalance: "1200000000000000"
22
rawGasBalance: "1200000000000000"
23
secretType: "ETHEREUM"
24
symbol: "ETH"
25
}
26
createdAt: "2020-04-24T08:35:08.566735"
27
description: "Kovan Test Wallet"
28
id: "1909c484-0dae-4841-89d3-ee9a313c426c"
29
secretType: "ETHEREUM"
30
}
31
}
32
}
Copied!

Function Reference

The function reference describes the different functions that are available in the Widget. For each function you can find the signature, it's parameters, and possible options documented.
​
Last modified 1mo ago