Initialize SDK

import 'dotenv/config';
import { NetworkNames, initializeSdkGateway } from '@kanalabs/mirai';

(async () => {

    // initializating sdk...
    const sdk = await initializeSdkGateway(
      { privateKey: process.env.PRIVATE_KEY as string },
      {
        networks: [NetworkNames.Mumbai],
        bundlerApiKey: process.env.BUNDLER_API_KEY
      },
    );

    // set mumbai as default current instance
    const networkInstance = sdk.setCurrentInstance(NetworkNames.Mumbai);
    console.log("networkInstance: ", networkInstance);

    // get address of KanaWallet
    const address = await networkInstance.getCounterFactualAddress();

    // log the KanaWallet address
    console.log('\x1b[35m%s\x1b[0m', `KanaWallet address : ${address}`);
})()

Last updated