From 09ded9f616ff87b86b4f8628bc8ee5bf9fbe287c Mon Sep 17 00:00:00 2001 From: Igor Prokopev Date: Wed, 5 Feb 2025 00:42:52 +0700 Subject: [PATCH] Fixed waitTransactionTreeExecution method --- package.json | 2 +- packages/core/package.json | 2 +- packages/core/src/api/neon-proxy-rpc.api.ts | 7 ++++--- packages/core/src/models/api.ts | 2 +- packages/core/src/neon/transaction.ts | 8 ++++---- 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index bc3a998..fb25a13 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@neonevm/solana-sign", "description": "Javascript Library for Execute Neon transactions with Solana's signature", - "version": "0.1.3", + "version": "0.1.4", "private": true, "workspaces": [ "packages/*" diff --git a/packages/core/package.json b/packages/core/package.json index a77477a..cfcc7f1 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@neonevm/solana-sign", - "version": "0.1.3", + "version": "0.1.4", "description": "Core API for the @neonevm/solana-signer project", "main": "./dist/cjs/index.js", "module": "./dist/esm/index.mjs", diff --git a/packages/core/src/api/neon-proxy-rpc.api.ts b/packages/core/src/api/neon-proxy-rpc.api.ts index 9a51434..8dd062b 100644 --- a/packages/core/src/api/neon-proxy-rpc.api.ts +++ b/packages/core/src/api/neon-proxy-rpc.api.ts @@ -93,7 +93,7 @@ export class NeonProxyRpcApi { while (duration > Date.now() - start) { const { result } = await this.getScheduledTreeAccount(address, nonce); const { transactions } = result; - if (transactions.length > 0) { + if (result?.activeStatus) { for (const tx of transactions) { const index = trx.findIndex(i => i.transactionHash === tx.transactionHash); if (index === -1) { @@ -102,8 +102,9 @@ export class NeonProxyRpcApi { trx[index] = tx; } } - } else { - return trx; + if (['Success', 'Empty', 'Failed'].includes(result.activeStatus)) { + return trx; + } } await delay(delayTimeout); } diff --git a/packages/core/src/models/api.ts b/packages/core/src/models/api.ts index 90799fc..2e5676e 100644 --- a/packages/core/src/models/api.ts +++ b/packages/core/src/models/api.ts @@ -96,7 +96,7 @@ export interface TransactionTreeResponse { transactions: ScheduledTransactionStatusResponse[]; } -export type TransactionStatus = 'NotStarted' | 'InProgress' | 'Success' | 'Empty' | string; +export type TransactionStatus = 'NotStarted' | 'InProgress' | 'Success' | 'Empty' | 'Failed' | string; export interface ScheduledTransactionStatusResponse { status: TransactionStatus; diff --git a/packages/core/src/neon/transaction.ts b/packages/core/src/neon/transaction.ts index 3fe538c..569499f 100644 --- a/packages/core/src/neon/transaction.ts +++ b/packages/core/src/neon/transaction.ts @@ -30,8 +30,8 @@ import { bufferConcat, hexToBuffer, NeonChainId, numberToBuffer, toBytes16LE, to * callData: "0xCallData", * chainId: 245022927, * gasLimit: 50000, - * maxFeePerGas: 1100000002, - * maxPriorityFeePerGas: 1100000001 + * maxFeePerGas: 1250000001, + * maxPriorityFeePerGas: 1250000000 * }); * ``` */ @@ -43,8 +43,8 @@ export class ScheduledTransaction { value: '0x', chainId: toBeHex(NeonChainId.testnetSol), gasLimit: toBeHex(5e4), - maxFeePerGas: toBeHex(1100000002), - maxPriorityFeePerGas: toBeHex(1100000001) + maxFeePerGas: toBeHex(1250000001), + maxPriorityFeePerGas: toBeHex(1250000000) }; /**