Skip to content

Commit

Permalink
Changed delay for whait methods
Browse files Browse the repository at this point in the history
  • Loading branch information
oable committed Feb 4, 2025
1 parent a0c3263 commit 818adae
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@neonevm/solana-sign",
"description": "Javascript Library for Execute Neon transactions with Solana's signature",
"version": "0.1.2",
"version": "0.1.3",
"private": true,
"workspaces": [
"packages/*"
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@neonevm/solana-sign",
"version": "0.1.2",
"version": "0.1.3",
"description": "Core API for the @neonevm/solana-signer project",
"main": "./dist/cjs/index.js",
"module": "./dist/esm/index.mjs",
Expand Down
12 changes: 6 additions & 6 deletions packages/core/src/api/neon-proxy-rpc.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,22 +75,22 @@ export class NeonProxyRpcApi {
return this.neonRpc<TransactionByHash>('eth_getTransactionByHash', [signature]);
}

async waitTransactionByHash(signature: string, timeout: number): Promise<TransactionByHash | null> {
async waitTransactionByHash(signature: string, duration: number, delayTimeout = 300): Promise<TransactionByHash | null> {
const start = Date.now();
while (timeout > Date.now() - start) {
while (duration > Date.now() - start) {
const { result } = await this.getTransactionByHash(signature);
if (result?.hash) {
return result;
}
await delay(100);
await delay(delayTimeout);
}
return null;
}

async waitTransactionTreeExecution(address: NeonAddress | SolanaAddress, nonce: number, timeout: number): Promise<ScheduledTransactionStatus[]> {
async waitTransactionTreeExecution(address: NeonAddress | SolanaAddress, nonce: number, duration: number, delayTimeout = 300): Promise<ScheduledTransactionStatus[]> {
const start = Date.now();
const trx: ScheduledTransactionStatus[] = [];
while (timeout > Date.now() - start) {
while (duration > Date.now() - start) {
const { result } = await this.getScheduledTreeAccount(address, nonce);
const { transactions } = result;
if (transactions.length > 0) {
Expand All @@ -105,7 +105,7 @@ export class NeonProxyRpcApi {
} else {
return trx;
}
await delay(100);
await delay(delayTimeout);
}
return trx;
}
Expand Down

0 comments on commit 818adae

Please sign in to comment.