# ICRC-1 ledger

An explorer for an ICRC-1 ledger, built on `@ic-reactor/core`,
`@ic-reactor/react` and `@ic-reactor/vite-plugin` with TanStack Query's own
hooks.

- **Mainnet:** a client built with `createClient({ network: "ic", identity: "anonymous" })`
  reads the ICP ledger: name, symbol, decimals, fee, total supply, metadata,
  the minting account and the balance of a principal you type. It also reads
  the block log, following the archive callbacks the ledger's reply carries
  with `client.func`. Certified reads can be switched on.
- **Sandbox:** `createTestClient()` from `@ic-reactor/core/testing` runs a real
  client against an in-memory replica with a mocked ledger. Sign in, switch
  accounts, and send transfers with a fault armed (a canister reject, a lost
  reply, HTTP 429) to see what the client reports: whether the transfer may
  have executed, the re-read of the balance, and the single re-send after a
  failure that proves the transfer never arrived.

The generated modules come from the ledger's `.did` files through the Vite
plugin, which runs `candid-core-cli gen`.

The guides this example shows at work: [Reads](https://ic-reactor.b3pay.net/v4/guides/reads/) (the
balance, certified reads), [The client](https://ic-reactor.b3pay.net/v4/guides/client/) (`client.func` for
archive callbacks), [Writes](https://ic-reactor.b3pay.net/v4/guides/writes/) and
[Errors and mayHaveExecuted](https://ic-reactor.b3pay.net/v4/guides/errors/) (the transfer and its
faults), and [Testing](https://ic-reactor.b3pay.net/v4/guides/testing/) (the sandbox).

[Open in StackBlitz](https://stackblitz.com/github/b3pay/ic-reactor/tree/v4/examples/icrc-ledger?file=src/App.tsx)
  [View on GitHub](https://github.com/b3pay/ic-reactor/tree/v4/examples/icrc-ledger)