getAccount

Function using for connect to web3 wallet

Good to know: This function is using to connect the wallet

Wallets supported:

  • MetaMask

  • WalletConnect EVM

  • CoinbaseWallet

  • Trust

  • TronLink

  • WalletConnect Tron

Input parameters:

MetaMask wallet:

// JavaScript

const data = {
    wallet: 'MetaMask', // required
    rpc: '', // option
}

WalletConnect EVM:

// JavaScript

const data = {
    wallet: 'WalletConnect', // required
    chains: ["eip155:1", "eip155:56"], // required
}

CoinbaseWallet:

// JavaScript

const data = {
    wallet: 'CoinbaseWallet', // required
    rpc: '', // option
}

Trust wallet:

// JavaScript

const data = {
    wallet: 'Trust', // required
    rpc: '', // option
}
// JavaScript

const data = {
    wallet: 'TronLink', // required
    websiteiconuri: 'https://wampi.ru/image/RtCMIut', // option
    websitename: 'kasatkin.io' // option
}

WalletConnect Tron:

// JavaScript

const data = {
    wallet: 'WalletConnectTronV1', // required
    network: '', // option
    relayUrl: 'wss://relay.walletconnect.com', // option
    projectId: '....', // option
    metadata: {
         name: 'JustLend',
         description: 'JustLend WalletConnect',
         url: 'https://app.justlend.org/',
         icons: ['https://app.justlend.org/mainLogo.svg']
    } // option
}

Using:

// JavaScript

const accounts = await getAccount(data)

Return:

EVM wallets:

// JavaScript

{
    accounts:[], // array of wallet addresses
    chainId:'', // number, selected chain in user wallet, only for EVM chains
}

Visit offitial doc for response code

// JavaScript

{
    accounts:[], // array of wallet addresses
    code:'', // number of request respons, visit offitial doc https://docs.tronlink.org/tronlink-wallet-extension/request-tronlink-extension/connect-website
    message:'' // string
}

Last updated