import { Ecanna, Buffer } from "ecanna/dist" import { TKNVMAPI } from "ecanna/dist/apis/tknvm" import { UTXOSet, UTXO } from "ecanna/dist/apis/stakevm" import { Output } from "ecanna/dist/common" // Change the networkID to affect the HRP of the bech32 encoded address // NetworkID - Bech32 Address - ChainPrefix-HRP1AddressChecksum // 0 - TKN-custom19rknw8l0grnfunjrzwxlxync6zrlu33yeg5dya // 1 - TKN-ecna19rknw8l0grnfunjrzwxlxync6zrlu33y2jxhrg // 2 - TKN-cascade19rknw8l0grnfunjrzwxlxync6zrlu33ypmtvnh // 3 - TKN-denali19rknw8l0grnfunjrzwxlxync6zrlu33yhc357h // 4 - TKN-everest19rknw8l0grnfunjrzwxlxync6zrlu33yn44wty // 5 - TKN-fuji19rknw8l0grnfunjrzwxlxync6zrlu33yxqzg0h // 1337 - TKN-custom19rknw8l0grnfunjrzwxlxync6zrlu33yeg5dya // 12345 - TKN-local19rknw8l0grnfunjrzwxlxync6zrlu33ynpm3qq const networkID: number = 12345 const ecanna: Ecanna = new Ecanna(undefined, undefined, undefined, networkID) const tknchain: TKNVMAPI = ecanna.TKNChain() const main = async (): Promise => { const utxoset: UTXOSet = new UTXOSet() utxoset.addArray([ "11Zf8cc55Qy1rVgy3t87MJVCSEu539whRSwpdbrtHS6oh5Hnwv1gz8G3BtLJ73MPspLkD93cygZufT4TPYZCmuxW5cRdPrVMbZAHfb6uyGM1jNGBhBiQAgQ6V1yceYf825g27TT6WU4bTdbniWdECDWdGdi84hdiqSJH2y", "11Zf8cc55Qy1rVgy3t87MJVCSEu539whRSwpdbrtHS6oh5Hnwv1NjNhqZnievVs2kBD9qTrayBYRs91emGTtmnu2wzqpLstbAPJDdVjf3kjwGWywNCdjV6TPGojVR5vHpJhBVRtHTQXR9VP9MBdHXge8zEBsQJAoZhTbr2" ]) const utxos: UTXO[] = utxoset.getAllUTXOs() utxos.map((utxo: UTXO): void => { const output: Output = utxo.getOutput() const addresses: string[] = output .getAddresses() .map((x: Buffer): string => { const addy: string = tknchain.addressFromBuffer(x) return addy }) console.log(addresses) }) } main()