From 2d5ace244a41bc261d0b0888587d4ff9da3f6ba5 Mon Sep 17 00:00:00 2001 From: Tyera Eulberg Date: Tue, 26 Nov 2019 01:34:42 -0700 Subject: [PATCH] fix: getConfirmedBlock result pattern fixup --- web3.js/module.flow.js | 4 +++- web3.js/src/connection.js | 14 +++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/web3.js/module.flow.js b/web3.js/module.flow.js index 1695fd590b..dbf7adf624 100644 --- a/web3.js/module.flow.js +++ b/web3.js/module.flow.js @@ -75,7 +75,9 @@ declare module '@solana/web3.js' { blockhash: Blockhash, previousBlockhash: Blockhash, parentSlot: number, - transactions: Array<[Transaction, SignatureSuccess | TransactionError | null]>, + transactions: Array< + [Transaction, SignatureSuccess | TransactionError | null], + >, }; declare export type KeyedAccountInfo = { diff --git a/web3.js/src/connection.js b/web3.js/src/connection.js index 0caf172656..e8bc79488e 100644 --- a/web3.js/src/connection.js +++ b/web3.js/src/connection.js @@ -399,15 +399,15 @@ const GetVoteAccounts = jsonRpcResult( }), ); +const SignatureStatusResult = struct.union([ + 'null', + struct.union([struct({Ok: 'null'}), struct({Err: 'object'})]), +]); + /** * Expected JSON RPC response for the "getSignatureStatus" message */ -const GetSignatureStatusRpcResult = jsonRpcResult( - struct.union([ - 'null', - struct.union([struct({Ok: 'null'}), struct({Err: 'object'})]), - ]), -); +const GetSignatureStatusRpcResult = jsonRpcResult(SignatureStatusResult); /** * Expected JSON RPC response for the "getTransactionCount" message @@ -463,7 +463,7 @@ export const GetConfirmedBlockRpcResult = jsonRpcResult( struct.union([ 'null', struct({ - status: GetSignatureStatusRpcResult, + status: SignatureStatusResult, fee: 'number', }), ]),