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.
arkaneConnect.flows.getAccount('ETHEREUM')
const arkaneConnect = new ArkaneConnect('YOUR_CLIENT_ID');arkaneConnect.flows.getAccount('ETHEREUM').then((account) => {console.log('User name:', account.auth.tokenParsed.name);console.log('User email:', account.auth.tokenParsed.email);console.log('First wallet address:', account.wallets[0].address);console.log('First wallet balance:', account.wallets[0].balance.balance);});
{auth: {tokenParsed: {email: "[email protected]"email_verified: truefamily_name: "Striegel"given_name: "Karel"name: "Karel Striegel"preferred_username: "[email protected]"{wallets: [] {0: {address: "0x6156174Da796228b376e3e58506194543cfBCA38"archived: falsebalance: {available: truebalance: 0.0012decimals: 18gasBalance: 0.0012gasSymbol: "ETH"rawBalance: "1200000000000000"rawGasBalance: "1200000000000000"secretType: "ETHEREUM"symbol: "ETH"}createdAt: "2020-04-24T08:35:08.566735"description: "Kovan Test Wallet"id: "1909c484-0dae-4841-89d3-ee9a313c426c"secretType: "ETHEREUM"}}}
The function reference describes the different functions that are available in the Widget. For each function you can find the signature, its parameters, and possible options documented.