Skip to content

Commit

Permalink
Bump some RPC calls for Agave 2.0 (#420)
Browse files Browse the repository at this point in the history
  • Loading branch information
filipzeta authored Oct 4, 2024
1 parent 1b3bfa9 commit fa30195
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 28 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
58 changes: 31 additions & 27 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit fa30195

Please sign in to comment.