import { | |
Avalanche, | |
BinTools, | |
Buffer | |
} from "avalanche" | |
import { | |
AVMAPI, | |
KeyChain, | |
KeyPair | |
} from "avalanche/dist/apis/avm" | |
const ip: string = 'localhost' | |
const port: number = 9650 | |
const protocol: string = 'http' | |
const networkID: number = 12345 | |
const avalanche: Avalanche = new Avalanche(ip, port, protocol, networkID) | |
const xchain: AVMAPI = avalanche.XChain() | |
const bintools: BinTools = BinTools.getInstance() | |
const xKeychain: KeyChain = xchain.keyChain() | |
const key: KeyPair = xKeychain.makeKey() | |
console.log(key.getAddressString()) | |
const pubkey: Buffer = key.getPublicKey() | |
console.log(bintools.addressToString("local", "X", key.addressFromPublicKey(pubkey))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment