From 5919e67c2ae408db4a744c645d823727a03ab8e8 Mon Sep 17 00:00:00 2001 From: Vyacheslav Tsurka Date: Wed, 28 Oct 2020 17:38:39 +0300 Subject: [PATCH] fix: broken inner instruction struct validator (#13231) * add-inner-trx * add compiled instructions * remove type parsed inner instruction mistake * add fix import & struct union for InnerInstruction * import type connection Co-authored-by: Viacheslav Tsurka --- web3.js/src/connection.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/web3.js/src/connection.js b/web3.js/src/connection.js index 0ae653b033..9ffbce2a89 100644 --- a/web3.js/src/connection.js +++ b/web3.js/src/connection.js @@ -20,6 +20,7 @@ import type {Blockhash} from './blockhash'; import type {FeeCalculator} from './fee-calculator'; import type {Account} from './account'; import type {TransactionSignature} from './transaction'; +import type {CompiledInstruction} from './message'; import {AgentManager} from './agent-manager'; export const BLOCKHASH_CACHE_TIMEOUT_MS = 30 * 1000; @@ -1163,7 +1164,7 @@ const ConfirmedTransactionMetaResult = struct.union([ struct.pick({ err: TransactionErrorResult, fee: 'number', - innerInstructions: struct.union( + innerInstructions: struct.union([ struct.array([ struct({ index: 'number', @@ -1178,7 +1179,7 @@ const ConfirmedTransactionMetaResult = struct.union([ ]), 'null', 'undefined', - ), + ]), preBalances: struct.array(['number']), postBalances: struct.array(['number']), logMessages: struct.union([struct.array(['string']), 'null', 'undefined']), @@ -1192,7 +1193,7 @@ const ParsedConfirmedTransactionMetaResult = struct.union([ struct.pick({ err: TransactionErrorResult, fee: 'number', - innerInstructions: struct.union( + innerInstructions: struct.union([ struct.array([ struct({ index: 'number', @@ -1214,7 +1215,7 @@ const ParsedConfirmedTransactionMetaResult = struct.union([ ]), 'null', 'undefined', - ), + ]), preBalances: struct.array(['number']), postBalances: struct.array(['number']), logMessages: struct.union([struct.array(['string']), 'null', 'undefined']),