AddressBalance | interface | { address, confirmedKoinu, unconfirmedKoinu, finalKoinu, totalReceivedKoinu, totalSentKoinu, txCount, unconfirmedTxCount } | Balance of one address as BlockCypher reports it (koinu; exact for any size). |
AddressTransactionsOptions | interface | { limit? } | Options for `getAddressTransactions`: how many transactions to return. |
AddressWatcher | class | class: getState(), poll() | Polls `backend.getAddressTransactions` and emits events. EventTarget based: use `on()` (returns an unsubscribe function) or `addEventListener` (events are WatchEvent with a typed `detail`). |
AddressWatchSource | interface | { name, capabilities, getAddressTransactions, getTipHeight, getTransaction? } | What the address watcher needs from a backend. Every `ChainBackend` fits, and so does the small `EsploraLiteBackend` from `@dogejs/backends/lite`. |
AgreementMethod | type | AgreementMethod = 'getTransaction' | 'getAddressUtxos' | 'getTipHeight' | 'getAddressTransactions' | 'getUtxo'; | Reads that can be cross-checked between backends. Raw transactions are self-verifying (hash == txid) and are never compared. |
AgreementOptions | interface | { quorum, critical?, tipHeightTolerance? } | Makes a FallbackBackend ask several backends and compare answers: how many must agree and which reads need it. |
assertNetwork | function | assertNetwork(backend: NetworkReporter, expected: Exclude<DogeNetwork, 'unknown'>, opts?: { signal?: AbortSignal; }): Promise<void>; | Throws a `BackendError` with code `WRONG_NETWORK` unless the backend reports `expected`. `expected` must be a real network ('mainnet', 'testnet' or 'regtest'). A backend that reports `unknown` (a genesis hash that is not one of the three) fails the check. A backend that cannot report its network at all fails with `UNSUPPORTED`: it never passes silently. |
BackendCapabilities | interface | { getTipHeight, getAddressUtxos, getAddressTransactions, getTransaction, getRawTransaction, broadcastTransaction, getFeeEstimates, getNetwork?, getUtxo? } | Which ChainBackend methods a backend can serve. `getTipHeight` and the rest are never silently emulated. |
BackendError | class | class: code, status, rpcCode, causes, expectedNetwork, actualNetwork, disagreement, retryAt, [Symbol.hasInstance](), [BRAND] | Error thrown by every backend. Messages never contain credentials, the Authorization header or URL user-info. |
BackendErrorCode | type | BackendErrorCode = 'NETWORK' | 'HTTP' | 'TIMEOUT' | 'BAD_RESPONSE' | 'UNSUPPORTED' | 'REJECTED' | 'WRONG_NETWORK' | 'RATE_LIMITED'; | Machine-readable reason codes for BackendError. |
BackendErrorDetails | interface | { status?, rpcCode?, causes?, cause?, expectedNetwork?, actualNetwork?, disagreement?, retryAt? } | Extra facts a BackendError can carry: HTTP status, JSON-RPC code, the errors of each backend tried and how backends disagreed. Never contains credentials. |
BackendMethod | type | BackendMethod = keyof BackendCapabilities; | Name of a data method a backend may serve (a key of BackendCapabilities). |
BLOCKCHAIR_DOGECOIN_URL | const | BLOCKCHAIR_DOGECOIN_URL = "https://api.blockchair.com/dogecoin" | The public Blockchair Dogecoin (mainnet) API. |
BLOCKCHAIR_FREE_LIMITS | const | BLOCKCHAIR_FREE_LIMITS: readonly BudgetWindow[] | Blockchair's documented keyless allowance (about 30 per minute and 1,440 per day per IP; not verified by DogeJS). |
BlockchairBackend | class | class: name, capabilities, http, budgetStatus(), getTip(), getTipHeight(), getRawTransaction(), getAddressUtxos(), getAddressTransactions(), getTransaction(), broadcastTransaction(), getFeeEstimates() | A second, independent free service with only two uses here: the chain tip (to cross-check BlockCypher's) and raw transactions (hash-checked, so a copy that comes from an indexer other than the one that listed your coins). It is a partial ChainBackend: the other methods are not offered (`capabilities` says so) and throw UNSUPPORTED. It cannot report its network from a genesis hash; its URL path names the chain. |
BLOCKCYPHER_FREE_LIMITS | const | BLOCKCYPHER_FREE_LIMITS: readonly BudgetWindow[] | BlockCypher's published free allowance (pricing page, per IP): 3 per second, 100 per hour, 1000 per day. |
BLOCKCYPHER_MAINNET_URL | const | BLOCKCYPHER_MAINNET_URL = "https://api.blockcypher.com/v1/doge/main" | The public BlockCypher Dogecoin mainnet API. |
BlockCypherBackend | class | class: name, capabilities, http, budgetStatus(), getTip(), getTipHeight(), getNetwork(), getAddressBalance(), getAddressBalances(), getAddressUtxos(), getAddressTransactions(), getTransaction(), getRawTransaction(), cachedTransaction(), cachedRawTransaction(), broadcastTransaction(), getFeeEstimates() | ChainBackend for the free BlockCypher Dogecoin API (mainnet only; BlockCypher has no Dogecoin test network). No API key: the browser calls it directly, so the limits apply to the visitor's IP. |
BlockCypherOptions | interface | { tipCacheMs? } | Settings of a BlockCypherBackend. |
BudgetStatus | interface | { windows, pausedUntil?, nextAt } | Snapshot of a budget: every window, a 429 pause if any, and when the next request may go. |
BudgetStore | interface | { get, set } | Where a RequestBudget keeps its counts between page loads (and between tabs of the same site, which share one IP address and so one allowance). `localStorage` fits: pass `{ get: () => localStorage.getItem(k), set: (v) => localStorage.setItem(k, v) }`. Both calls must be synchronous; failures are ignored (the budget then lives in memory only). |
BudgetWindow | interface | { ms, max, label } | One limit: at most `max` requests in any `ms` long window. |
BudgetWindowStatus | interface | { label, max, used, remaining, nextAt } | Remaining requests in one window, and when the next slot in it frees up. |
ChainBackend | interface | { name, capabilities, getTipHeight, getAddressUtxos, getAddressTransactions, getTransaction, getRawTransaction, broadcastTransaction, getFeeEstimates, getNetwork?, getUtxo? } | What every chain data client offers: tip height, address UTXOs and transactions, one transaction, broadcast and fee estimates. Methods a backend cannot serve are listed in `capabilities`; calling one throws a BackendError with code UNSUPPORTED. Amounts are koinu (bigint). |
ChainTip | interface | { height, hash } | A chain tip: height and block hash. |
ConfirmationDetail | interface | { txid, amountKoinu, confirmations } | Payload of the address watcher's `confirmation` event: the payment and its current confirmation count (amount in koinu). |
ConfirmedDetail | interface | { txid, txids, amountKoinu, confirmations } | Payload of the address watcher's `confirmed` event: the payments that satisfied the requirement and their total in koinu. |
CoreRpcBackend | class | class: name, capabilities, call(), callExact(), getTipHeight(), getNetwork(), getUtxo(), getAddressUtxos(), getAddressTransactions(), getTransaction(), getRawTransaction(), broadcastTransaction(), getFeeEstimates() | ChainBackend over Dogecoin Core's JSON-RPC. |
CoreRpcOptions | interface | { url, username?, password?, timeoutMs?, maxResponseBytes?, requireInputs?, fetch?, name? } | Settings of a CoreRpcBackend. `url` is required: there is no default endpoint. |
CrossCheck | interface | { at, agree, blockcypher?, blockchair? } | Last comparison of the two services' chain tips. |
DetectedDetail | interface | { txid, amountKoinu, confirmations, totalKoinu, satisfied, transaction } | Payload of the address watcher's `detected` event: a new payment (amount in koinu) and the running total. |
DisagreementGroup | interface | { backends, summary } | Which backends gave which answer when a FallbackBackend could not reach agreement. |
DogeNetwork | type | DogeNetwork = 'mainnet' | 'testnet' | 'regtest' | 'unknown'; | The Dogecoin networks this package can tell apart. `unknown` means a genesis hash that is none of the three embedded ones. |
ErrorDetail | interface | { error, consecutiveFailures, retryInMs } | Payload of a watcher's `error` event: the error, how many polls in a row failed and the delay before the next try. |
EsploraBackend | class | class: capabilities, getAddressUtxos(), getUtxo(), getRawTransaction(), broadcastTransaction(), getFeeEstimates() | ChainBackend for an Esplora-compatible REST API (electrs-doge). Extends EsploraLiteBackend (tip height, address history, single transactions, network check) with UTXOs, raw transactions, broadcast, fee estimates and outspend lookups. |
EsploraLiteBackend | class | class: name, capabilities, base, timeoutMs, maxBytes, pageSize, requireInputs, headers, fetchImpl, getTipHeight(), getNetwork(), getAddressTransactions(), getTransaction(), parseTxList(), getJson(), send(), expectOk() | The small Esplora client: only tip height, address history, single transactions and the network check. It is what `@dogejs/backends/lite` exports for web components such as a pay button. It uses the SAME parsers and validation as EsploraBackend (which extends it): nothing is weakened, the unused methods (UTXOs, raw transactions with SHA-256, broadcast, fee estimates, outspends) are just not here. It is not a full ChainBackend, but it is accepted by `watchAddress`. |
EsploraOptions | interface | { baseUrl, timeoutMs?, maxResponseBytes?, chainPageSize?, headers?, requireInputs?, fetch?, name? } | Settings of an EsploraBackend or EsploraLiteBackend. `baseUrl` is required: there is no default endpoint. |
FallbackBackend | class | class: name, capabilities, getTipHeight(), getAddressUtxos(), getAddressTransactions(), getTransaction(), getRawTransaction(), broadcastTransaction(), getFeeEstimates(), getUtxo(), getNetwork() | Wraps several backends. |
FallbackOptions | interface | { agreement?, verifyNetwork?, expectedNetwork?, name? } | Settings of a FallbackBackend: optional agreement between backends and network checking. |
FeeEstimateOptions | interface | { targets? } | Options for `getFeeEstimates`: the confirmation targets to ask for. |
FeeEstimates | interface | { koinuPerKb, source? } | Fee estimates by confirmation target in blocks, as koinu per 1000 bytes (bigint). |
GENESIS_HASHES | const | GENESIS_HASHES: Readonly<Record<'mainnet' | 'testnet' | 'regtest', string>> | Genesis block hash of each network, in the order `getblockhash 0` and Esplora's `/block-height/0` print it. |
isBackendError | function | isBackendError(e: unknown): e is BackendError; | True if `e` is a BackendError. Works for errors thrown by every backend in this package. |
JsonValue | type | JsonValue = null | boolean | string | RawNumber | JsonValue[] | { [key: string]: JsonValue; }; | A parsed JSON value. Numbers are kept as RawNumber so amounts are never rounded. |
networkFromGenesisHash | function | networkFromGenesisHash(hash: string): DogeNetwork; | Maps a genesis block hash (any case) to a network name. Anything else is `unknown`. |
NetworkReporter | interface | { name, getNetwork? } | Anything that can report its network (every ChainBackend in this package that implements `getNetwork`). |
PollDetail | interface | { at, durationMs } | Detail of the `poll` event, emitted after EVERY successful poll (also when nothing changed). |
PublicServiceBackend | class | class: name, capabilities, blockcypher, blockchair, lastCrossCheck, budget(), getNetwork(), getTipHeight(), crossCheck(), getAddressUtxos(), getAddressTransactions(), getTransaction(), getAddressBalance(), independentlySeen(), getRawTransaction(), crossFetchRawTransaction(), broadcastTransaction(), getFeeEstimates() | The free public service as one ChainBackend: BlockCypher serves everything (balances, unspent outputs, history, transactions, broadcast); Blockchair, a second independent service, is used to |
PublicServiceClientOptions | interface | { baseUrl?, timeoutMs?, maxResponseBytes?, budget?, budgetStore?, limits?, cacheMs?, fetch?, name?, now? } | Settings shared by the free public-service clients (BlockCypherBackend, BlockchairBackend). |
PublicServiceOptions | interface | { blockcypher?, blockchair?, tipTolerance?, crossCheckMs?, absentAfterConfirmations?, name?, now? } | Settings of a PublicServiceBackend. |
RawNumber | class | class: text | A JSON number kept as its exact source text. Dogecoin Core prints amounts as JSON numbers with 8 decimals (`ValueFromAmount`, src/rpc/server.cpp:137 formats "%d.%08d") and Esplora prints koinu as u64 numbers; `JSON.parse` would turn both into IEEE doubles and silently lose precision. This parser keeps the text. |
RECOMMENDED_FEE_KOINU_PER_KB | const | RECOMMENDED_FEE_KOINU_PER_KB = 1000000n | Dogecoin Core's recommended fee rate: RECOMMENDED_MIN_TX_FEE = COIN / 100 per 1000 bytes (src/policy/policy.h:23). |
ReorgedDetail | interface | { txid, reason, amountKoinu, previousConfirmations, confirmations } | Payload of the address watcher's `reorged` event: a payment that was lost or moved, why, and its confirmations before and after. |
ReorgReason | type | ReorgReason = 'disappeared' | 'unconfirmed' | 'block-changed'; | Why a watcher reports a reorg: the transaction `disappeared`, went back to `unconfirmed`, or its block changed (`block-changed`). |
RequestBudget | class | class: windows, status(), remaining(), whenFits(), canAfford(), acquire(), record(), pause(), ok() | Counts this device's requests to a free public service so it never goes over the published allowance. Every window is a SLIDING window (a log of request times), which is stricter than a refilling token bucket: a token bucket of 100 per hour lets up to 200 requests through in some hour-long spans (a full bucket, then the refill), a sliding window never more than 100. |
RequestBudgetOptions | interface | { windows?, store?, now?, maxWaitMs?, name? } | Settings of a RequestBudget. |
RequestOptions | interface | { signal? } | Chain data types shared by all backends. All amounts are bigint koinu (1 DOGE = 100_000_000 koinu); no floating point is used for money. |
Transaction | interface | { txid, outputs, inputs?, status, feeKoinu? } | A transaction as a backend reports it: txid, inputs, outputs (amounts in koinu), status and, when known, the fee. |
TransactionWatcher | class | class: getState(), poll() | Follows one transaction you sent until it has enough confirmations. |
TransactionWatchSource | interface | { name, capabilities, getTransaction, getTipHeight } | What the transaction watcher needs. Every `ChainBackend` fits, and so does the `EsploraLiteBackend` from `@dogejs/backends/lite`. |
TxConfirmationDetail | interface | { txid, confirmations } | Payload of the transaction watcher's `confirmation` event. |
TxConfirmedDetail | interface | { txid, confirmations, blockHeight, blockHash } | Payload of the transaction watcher's `confirmed` event, with the block when the backend reports it. |
TxInput | interface | { txid, vout, coinbase, sequence?, prevout? } | A transaction input as a backend reports it: the outpoint spent, whether it is a coinbase, and the previous output when the server supplies it. |
TxOutput | interface | { index, valueKoinu, address?, scriptPubKeyHex? } | A transaction output as a backend reports it: index, value in koinu, address (when it is a single standard address) and script. |
TxPrevout | interface | { valueKoinu, address?, scriptPubKeyHex? } | The output a transaction input spends, when the backend says what it was. |
TxReorgedDetail | interface | { txid, reason, previousConfirmations, confirmations } | Payload of the transaction watcher's `reorged` event. |
TxSeenDetail | interface | { txid, confirmations, transaction } | Payload of the transaction watcher's `seen` event: the transaction as the backend reports it. |
TxStatus | interface | { confirmed, blockHeight?, blockHash?, blockTime? } | Confirmation status of a transaction: whether it is confirmed and, if so, the block height, hash and time. |
TxWatchEventMap | interface | { seen, confirmation, confirmed, reorged, poll, error } | The events of a transaction watcher and their payloads: seen, confirmation, confirmed, reorged, poll, error. |
TxWatchOptions | interface | { txid, confirmations?, missingPolls?, stopWhenConfirmed? } | Options for watching one transaction: its txid, the confirmations that count as done, and polling settings. |
TxWatchState | interface | { txid, stopped, seen, confirmed, confirmations } | Snapshot of a transaction watcher: whether the transaction was seen and confirmed, and its confirmation count. |
Utxo | interface | { txid, vout, valueKoinu, status } | An unspent output: outpoint, value in koinu and the status of the transaction that created it. |
UtxoLookup | type | UtxoLookup = { state: 'unspent'; /** The output, with the confirmation status of the transaction that created it. */ utxo: Utxo & { address?: string; scriptPubKeyHex?: string; coinbase?: boolean; }; } | { state: 'spent'; /** The spending transaction and input index, when the backend says (Esplora does; Core does not). */ spentBy?: { txid: string; vin: number; confirmed: boolean; }; } | { /** Th... | Result of ChainBackend.getUtxo. `unknown` is returned instead of guessing. |
watchAddress | function | watchAddress(backend: AddressWatchSource, options: WatchOptions): AddressWatcher; | Starts watching an address. Returns immediately; the first poll runs on the next tick. |
WatchEvent | class | class: detail | The event object a watcher emits (a DOM `Event`); the payload is in `detail`. |
WatchEventMap | interface | { detected, confirmation, confirmed, reorged, poll, error } | The events of an address watcher and their payloads: detected, confirmation, confirmed, reorged, poll, error. |
WatchOptions | interface | { address, minAmountKoinu?, confirmations?, since?, historyLimit?, stopWhenConfirmed? } | Client-side payment detection. This is a CONVENIENCE for showing status in a page. It trusts whatever backend it is given and runs in a browser tab the visitor controls, so it must never be the only check before releasing goods of real value: confirm on the server side (your own node) as well. |
WatchState | interface | { address, stopped, confirmed, totalKoinu, payments } | Snapshot of an address watcher: the tracked payments (koinu), their total and whether the requirement is met. |
watchTransaction | function | watchTransaction(backend: TransactionWatchSource, options: TxWatchOptions): TransactionWatcher; | Starts watching one transaction. Returns immediately; the first poll runs on the next tick. |