From 2ad58bb8aa9de03d0b7ca975aa4cf6e3660d5d9c Mon Sep 17 00:00:00 2001 From: steveluscher Date: Fri, 22 Jul 2022 00:54:55 -0700 Subject: [PATCH] fix: add `maxSupportedTransactionVersion` config to remaining `getTransaction` calls --- web3.js/src/connection.ts | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/web3.js/src/connection.ts b/web3.js/src/connection.ts index 7bc37a6fdc4ee2..18a8b90cb8cc7a 100644 --- a/web3.js/src/connection.ts +++ b/web3.js/src/connection.ts @@ -3739,12 +3739,15 @@ export class Connection { */ async getParsedTransaction( signature: TransactionSignature, - commitment?: Finality, + commitmentOrConfig?: GetTransactionConfig | Finality, ): Promise { + const {commitment, config} = + extractCommitmentFromConfig(commitmentOrConfig); const args = this._buildArgsAtLeastConfirmed( [signature], - commitment, + commitment as Finality, 'jsonParsed', + config, ); const unsafeRes = await this._rpcRequest('getTransaction', args); const res = create(unsafeRes, GetParsedTransactionRpcResult); @@ -3759,13 +3762,16 @@ export class Connection { */ async getParsedTransactions( signatures: TransactionSignature[], - commitment?: Finality, + commitmentOrConfig?: GetTransactionConfig | Finality, ): Promise<(ParsedConfirmedTransaction | null)[]> { + const {commitment, config} = + extractCommitmentFromConfig(commitmentOrConfig); const batch = signatures.map(signature => { const args = this._buildArgsAtLeastConfirmed( [signature], - commitment, + commitment as Finality, 'jsonParsed', + config, ); return { methodName: 'getTransaction', @@ -3791,10 +3797,17 @@ export class Connection { */ async getTransactions( signatures: TransactionSignature[], - commitment?: Finality, + commitmentOrConfig?: GetTransactionConfig | Finality, ): Promise<(TransactionResponse | null)[]> { + const {commitment, config} = + extractCommitmentFromConfig(commitmentOrConfig); const batch = signatures.map(signature => { - const args = this._buildArgsAtLeastConfirmed([signature], commitment); + const args = this._buildArgsAtLeastConfirmed( + [signature], + commitment as Finality, + undefined /* encoding */, + config, + ); return { methodName: 'getTransaction', args,