Get Address

import { ByzanlinkAASdk } from '@byzanlink-tech/aa-sdk';

async function main() {

  // Initializating sdk
  const byzanlinkAASdk = new ByzanlinkAASdk(
    { privateKey: process.env.PRIVATE_KEY }, // Get the private key using any wallet provider
    {
      chainId: Number(process.env.CHAIN_ID), // Ex: 80002
      policyId: process.env.GAS_MANAGER_POLICY_ID, // Optional - Get the Policy ID from Byzanlink dashboard
      apiKey: process.env.BYZANLINK_API_KEY // Get API key from Byzanlink dashboard
    })

  // Get Byzanlink Wallet address
  const address: string = await byzanlinkAASdk.getCounterFactualAddress();
  console.log(`ByzanLink Wallet address: ${address}`);
  
  // Get Balance
  const balance: string = await byzanlinkAASdk.getNativeBalance();
  console.log(`Byzanlink Wallet native balance: ${balance}`);
}

main()
  .catch(console.error)
  .finally(() => process.exit());

Last updated