diff --git a/CHANGELOG.md b/CHANGELOG.md index 3ae1288a..58c41d35 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. Version changes are pinned to SDK releases. +## [1.46.1] + +- Change RPC to use getSignatureStatuses for compatibility with Agave 2.0. ([#420](https://github.com/zetamarkets/sdk/pull/420)) + ## [1.46.0] - New asset EIGEN. ([#421](https://github.com/zetamarkets/sdk/pull/421)) diff --git a/package.json b/package.json index 597ef1f4..447a3efe 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@zetamarkets/sdk", "repository": "https://github.com/zetamarkets/sdk/", - "version": "1.46.0", + "version": "1.46.1", "description": "Zeta SDK", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/src/utils.ts b/src/utils.ts index 1ca1fecf..aaa1cf8d 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -1016,24 +1016,24 @@ export async function processTransactionBloxroute( let currentBlockHeight = 0; if (!skipConfirmation) { while (currentBlockHeight < recentBlockhash.lastValidBlockHeight) { - let status = await anchorProvider.connection.getSignatureStatus( - txSig - ); + let status = await anchorProvider.connection.getSignatureStatuses([ + txSig, + ]); currentBlockHeight = await anchorProvider.connection.getBlockHeight( anchorProvider.connection.commitment ); - if (status.value != null) { - if (status.value.err != null) { + if (status.value[0] != null) { + if (status.value[0].err != null) { // Gets caught and parsed in the later catch let err = parseInt( - status.value.err["InstructionError"][1]["Custom"] + status.value[0].err["InstructionError"][1]["Custom"] ); throw err; } if ( txConfirmationCheck( "confirmed", - status.value.confirmationStatus.toString() + status.value[0].confirmationStatus.toString() ) ) { return txSig; @@ -1121,21 +1121,23 @@ export async function processVersionedTransactionJito( maxRetries: 0, }); - let status = await provider.connection.getSignatureStatus(txSig); + let status = await provider.connection.getSignatureStatuses([txSig]); currentBlockHeight = await provider.connection.getBlockHeight( provider.connection.commitment ); - if (status.value != null) { - if (status.value.err != null) { + if (status.value[0] != null) { + if (status.value[0].err != null) { // Gets caught and parsed in the later catch - let err = parseInt(status.value.err["InstructionError"][1]["Custom"]); + let err = parseInt( + status.value[0].err["InstructionError"][1]["Custom"] + ); let parsedErr = parseError(err); throw parsedErr; } if ( txConfirmationCheck( txOpts.commitment ? txOpts.commitment.toString() : "confirmed", - status.value.confirmationStatus.toString() + status.value[0].confirmationStatus.toString() ) ) { return txSig; @@ -1238,21 +1240,23 @@ export async function processTransactionJito( maxRetries: 0, }); - let status = await provider.connection.getSignatureStatus(txSig); + let status = await provider.connection.getSignatureStatuses([txSig]); currentBlockHeight = await provider.connection.getBlockHeight( provider.connection.commitment ); - if (status.value != null) { - if (status.value.err != null) { + if (status.value[0] != null) { + if (status.value[0].err != null) { // Gets caught and parsed in the later catch - let err = parseInt(status.value.err["InstructionError"][1]["Custom"]); + let err = parseInt( + status.value[0].err["InstructionError"][1]["Custom"] + ); let parsedErr = parseError(err); throw parsedErr; } if ( txConfirmationCheck( txOpts.commitment ? txOpts.commitment.toString() : "confirmed", - status.value.confirmationStatus.toString() + status.value[0].confirmationStatus.toString() ) ) { return txSig; @@ -1383,22 +1387,22 @@ export async function processVersionedTransaction( await Promise.race(promises); } - let status = await provider.connection.getSignatureStatus(txSig); + let status = await provider.connection.getSignatureStatuses([txSig]); currentBlockHeight = await provider.connection.getBlockHeight( provider.connection.commitment ); - if (status.value != null) { - if (status.value.err != null) { + if (status.value[0] != null) { + if (status.value[0].err != null) { // Gets caught and parsed in the later catch let err = parseInt( - status.value.err["InstructionError"][1]["Custom"] + status.value[0].err["InstructionError"][1]["Custom"] ); throw err; } if ( txConfirmationCheck( txOpts.commitment ? txOpts.commitment.toString() : "confirmed", - status.value.confirmationStatus.toString() + status.value[0].confirmationStatus.toString() ) ) { return txSig; @@ -1576,22 +1580,22 @@ export async function processTransaction( await Promise.race(promises); } - let status = await provider.connection.getSignatureStatus(txSig); + let status = await provider.connection.getSignatureStatuses([txSig]); currentBlockHeight = await provider.connection.getBlockHeight( provider.connection.commitment ); - if (status.value != null) { - if (status.value.err != null) { + if (status.value[0] != null) { + if (status.value[0].err != null) { // Gets caught and parsed in the later catch let err = parseInt( - status.value.err["InstructionError"][1]["Custom"] + status.value[0].err["InstructionError"][1]["Custom"] ); throw err; } if ( txConfirmationCheck( txOpts.commitment ? txOpts.commitment.toString() : "confirmed", - status.value.confirmationStatus.toString() + status.value[0].confirmationStatus.toString() ) ) { return txSig;