solanaFetcher()
solanaFetcher(
params):Promise<void>
Defined in: trackers/solanaTracker.ts:97
A fetcher for initializePollingTracker from @tuwaio/pulsar-core that checks a Solana transaction once.
It sends getSignatureStatuses (with searchTransactionHistory, so transactions older than the node’s recent status
cache are found after a page reload) to tx.rpcUrl, or to the public endpoint of the cluster in tx.chainId,
through a client cached by createSolanaRPC from @tuwaio/orbit-solana. Until it has the fee, blockhash and
instructions (from tx, or fetched on an earlier tick of the same tracking run and cached in memory for the tx
object), it also sends getTransaction (commitment confirmed).
- Signature not found: keeps polling; one hour after
localTimestampcallsonFailure()and stops polling. - Found but
getTransactionreturns nothing yet: reports nothing this tick. - Otherwise calls
onIntervalTickwith the status, then: an on-chain error callsonFailurewith it;finalizedcallsonSuccess. A transaction not finalized one hour afterlocalTimestampcallsonFailurewith its status.
Every terminal outcome stops polling with withoutRemoving: true, so the transaction is never removed.
- RPC errors are thrown, so the polling tracker retries and gives up after
maxRetriesconsecutive errors.
Parameters
params
PollingFetcherParams<SolanaSignatureStatusResponse, SolanaFetcherTx>
The fetcher parameters provided by initializePollingTracker.
Returns
Promise<void>
A promise that resolves when the check is done.
Throws
Error when tx.adapter is not OrbitAdapter.SOLANA, and any RPC error.
Example
import { OrbitAdapter } from '@tuwaio/orbit-core';
import { initializePollingTracker } from '@tuwaio/pulsar-core';
import { solanaFetcher } from '@tuwaio/pulsar-solana';
initializePollingTracker({
tx: { adapter: OrbitAdapter.SOLANA, txKey: signature, chainId: 'solana:devnet', localTimestamp: now, pending: true },
fetcher: solanaFetcher,
onSuccess: (status) => console.log('Finalized in slot', status.slot),
onFailure: (status) => console.error('Failed', status?.err),
});