import { Lux, Buffer } from "../../src" import { PlatformVMAPI, Tx } from "../../src/apis/platformvm" const ip: string = "api.lux.network" const port: number = 443 const protocol: string = "https" const networkID: number = 1 const lux: Lux = new Lux(ip, port, protocol, networkID) const pchain: PlatformVMAPI = lux.PChain() const main = async (): Promise => { const txID: string = "7mnY7SqR1s8aTJShjvW1Yebe4snCzsjhonFrrXiWBE4L9x9A6" const hex = (await pchain.getTx(txID)) as string const buf: Buffer = new Buffer(hex.slice(2), "hex") const tx: Tx = new Tx() tx.fromBuffer(buf) const jsonStr: string = JSON.stringify(tx) console.log(jsonStr) const jsn: Object = JSON.parse(jsonStr) console.log(jsn) } main()