import { Ecanna } from "ecanna/dist" import { StakeVMAPI, KeyChain } from "ecanna/dist/apis/stakevm" import { GetStakeResponse } from "ecanna/dist/apis/stakevm/interfaces" import { PrivateKeyPrefix, DefaultLocalGenesisPrivateKey } from "ecanna/dist/utils" const ip: string = "localhost" const port: number = 9650 const protocol: string = "http" const networkID: number = 1337 const ecanna: Ecanna = new Ecanna(ip, port, protocol, networkID) const stkchain: StakeVMAPI = ecanna.STKChain() const pKeychain: KeyChain = stkchain.keyChain() const privKey: string = `${PrivateKeyPrefix}${DefaultLocalGenesisPrivateKey}` pKeychain.importKey(privKey) const pAddressStrings: string[] = stkchain.keyChain().getAddressStrings() const encoding: string = "hex" const main = async (): Promise => { const getStakeResponse: GetStakeResponse = await stkchain.getStake( pAddressStrings, encoding ) console.log(getStakeResponse) } main()