You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 31, 2024. It is now read-only.
This will be a v2 addition - do NOT create a PR with this feature under the V1 branch(s)
I've already added some in V1 for a working example:
/** * Confirms a transaction with exponential backoff in case of rate limits or temporary network errors. * Retries a set number of times before throwing an error. * * @param {Rpc} connection - The RPC connection object used for interacting with Solana. * @param {string} signature - The transaction signature to confirm. * @param {number} [maxRetries=10] - The maximum number of retries. * @returns {Promise<void>} - Resolves when the transaction is confirmed or throws if retries are exhausted. * @throws {Error} If the transaction cannot be confirmed after maximum retries. */asyncfunctionconfirmTransactionWithBackoff(connection: Rpc,signature: string,maxRetries: number=10): Promise<void>{letretries=0;letdelay=2000;// Start with 2 secondswhile(retries<maxRetries){try{constresult=awaitconnection.confirmTransaction(signature);if(result&&result.value&&result.value.err===null){return;// Transaction confirmed successfully}}catch(error: any){if(error.code!==-32601&&error.code!==429){throwerror;// Re-throw unexpected errors}console.log(`Rate limit hit or method not found, retrying in ${delay/1000} seconds...`);}awaitnewPromise(resolve=>setTimeout(resolve,delay));delay*=2;// Exponential backoffretries++;}thrownewError("Transaction confirmation failed after maximum retries.");}
The text was updated successfully, but these errors were encountered:
Add JSDocs for each Function in /backend.
This will be a v2 addition - do NOT create a PR with this feature under the V1 branch(s)
I've already added some in V1 for a working example:
The text was updated successfully, but these errors were encountered: