Providers

dcrdata

Decred through the Insight API of explorer.dcrdata.org. Balances with totals and the mempool delta. History and details and blocks. Atoms. No key.
provider
create("dcrdata")
auth
none
chains
Decred
capabilities
balance, history, tx detail, block
endpoint
explorer.dcrdata.org/insight/api
default chain
decred

Address it

import { Dcrdata } from "@agntn/explorers/providers/dcrdata";

const dcrdata = new Dcrdata(); // or create("dcrdata"), or { baseUrl: "https://my.dcrdata/insight/api" }
await dcrdata.getBalance("Ds…", "decred");
await dcrdata.getBlockInfo(1000, "decred");

One chain, no key. baseUrl is the Insight root and defaults to https://explorer.dcrdata.org/insight/api, so a dcrdata you run yourself works too. Any other chain is an UnsupportedChainError, and an address that isn't a Decred mainnet address fails before a request goes out.

What it reads

/addr/:address?noTxList=1 for the balance, /addrs/:address/txs?from=&to= for history, /tx/:hash for one transaction, /block/:height for a block. Balances, history, details and blocks; no tokens, contracts, gas or unspent outputs.

Gotchas

  • Atoms, eight decimals. Insight quotes DCR as floating point numbers, sometimes in scientific notation, and the provider converts the decimal spelling to atoms without ever multiplying a float. balanceSat and friends come as integers and stay integers.
  • balance, funded and spent are confirmed. The signed mempool delta goes to unconfirmed, so a pending payment never shows up as money you can spend.
  • History pages with from and to, up to 250 rows a page, and startBlock and endBlock throw because Insight has no block filter. sort: "asc" costs a second request: the provider reads the total first, then the window from the other end, and refuses the page if the total moved in between.
  • confirmations decides the status: 0 is pending with block number 0, below zero is failed. Coinbase and treasurybase transactions get fee "0", everything else the fee Insight quotes or none.
  • Blocks come back with an empty miner and gas fields of "0", like every other chain without gas. The block's transaction count is the length of its tx list.
  • The Explorer has no live feed for Decred and no block transaction list. The feed only wraps Blockscout, Mempool and the Arweave gateway, so search works and the hub says there's no tip.

Where it lives

src/providers/dcrdata.ts.

@agntn/explorers·MIT license· Read-only. Addresses you type go to a public explorer API, never to a wallet.