chaingate
Version:
Multi-chain cryptocurrency SDK for TypeScript — unified API for Bitcoin, Ethereum, Litecoin, Dogecoin, Bitcoin Cash, Polygon, Arbitrum, and any EVM-compatible chain. Create wallets, query balances, send transactions, and manage tokens and NFTs across UTXO
20 lines (19 loc) • 788 B
TypeScript
/**
* In-memory cache of the next nonce to use per (chainId, address).
*
* Bridges the gap between broadcasting a transaction and the network
* reflecting it: when we send tx N, the cache records that the next nonce is
* `N + 1` so a follow-up build does not collide even if the node
* has not yet observed the broadcast.
*/
export declare class EvmNonceCache {
private nextNonce;
private key;
/** Returns the cached next nonce for an address, or `undefined` if untracked. */
get(chainId: number, address: string): bigint | undefined;
/**
* Records that `usedNonce` was just consumed by a broadcast. The cache
* advances to `usedNonce + 1` but never goes backwards.
*/
recordUsed(chainId: number, address: string, usedNonce: bigint): void;
}