From f19bcf50cb4bdf1fbfe1e30bef7c1b768c40ec4d Mon Sep 17 00:00:00 2001 From: Will O'Beirne Date: Wed, 20 Mar 2019 14:52:47 -0400 Subject: [PATCH] Switch to getrawtransaction for... reasons? --- blockchain/src/node.ts | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/blockchain/src/node.ts b/blockchain/src/node.ts index c180e2d2..82c1935a 100644 --- a/blockchain/src/node.ts +++ b/blockchain/src/node.ts @@ -50,6 +50,27 @@ export interface Transaction { vjoinsplit: any[]; } +export interface RawTransaction { + txid: string; + hex: string; + overwintered: boolean; + version: number; + versiongroupid: number; + locktime: number; + expiryheight: string; + vin: VIn[]; + vout: VOut[]; + valueBalance: string; + blockhash: string; + blocktime: number; + confirmations: number; + time: number; + // unclear what these are + vjoinsplit: any[]; + vShieldedSpend: any[]; + vShieldedOutput: any[]; +} + export interface Block { hash: string; confirmations: number; @@ -120,6 +141,10 @@ interface ZCashNode { (numberOrHash: string | number, verbosity: 0): Promise; }; gettransaction: (txid: string) => Promise; + getrawtransaction: { + (numberOrHash: string | number, verbosity: 1): Promise; + (numberOrHash: string | number, verbosity?: 0): Promise; + }; validateaddress: (address: string) => Promise; z_getbalance: (address: string, minConf?: number) => Promise; z_getnewaddress: (type?: "sprout" | "sapling") => Promise; @@ -203,7 +228,7 @@ export function getNetwork() { export async function getBootstrapBlockHeight(txid: string | undefined) { if (txid) { try { - const tx = await node.gettransaction(txid); + const tx = await node.getrawtransaction(txid, 1); const block = await node.getblock(tx.blockhash); const height = block.height - parseInt(env.MINIMUM_BLOCK_CONFIRMATIONS, 10);