Read the register without trusting anyone, including us.
Resolve a ticker to the one contract that means it, replay corporate actions with their flags intact, and read balances at a block. Every call is public RPC.
No API key, no endpoint of ours. The only dependency is
@stockledger/core, which is pure arithmetic. If this package vanished, the same answers would still be onecurlaway - that is what makes them worth something.
npm install @stockledger/sdkconst { LedgerClient } = require('@stockledger/sdk');
const client = new LedgerClient();
const r = await client.resolveTicker('AAPL');
// { searched: 1127, branded: 4, resolved: '0xaf3d76f1834a1d425780943c99ea8a608f8a93f9' }resolved is null when the answer is not unique. That is a result, not an
error: on a chain where 346 contracts copy the naming scheme, an honest null
beats a confident guess.
const r = await client.register('0xaf3d76f1834a1d425780943c99ea8a608f8a93f9');
r.absolute; // 1000566080000000000n the last `to` value <- trust this
r.composed; // every step multiplied together <- not this
r.agree; // true here, false for CRWD and WEEK
r.entries[0].flags; // [] , or [{ kind: 'duplicate', of: 978630 }]| Call | Returns |
|---|---|
token(address) |
name, symbol, decimals, supply, live multiplier, implementsScaledUI |
identify(address) |
genuine / impostor / no-code, decided by bytecode |
resolveTicker(ticker) |
every candidate with a verdict, plus resolved or null |
events({ address }) |
decoded UIMultiplierUpdated logs |
register(address) |
entries with flags, plus both readings and whether they agree |
balanceOf(address, holder, block) |
raw balance, unscaled, on purpose |
balanceOf returns the raw balance and never the UI amount. Scaling is a
decision, and the SDK makes you make it: applying the multiplier twice, once
here and once on a Chainlink price that already includes it, is the single most
common way to get this wrong.
rpc.js JSON-RPC + explorer transport, fetch-injectable for tests
abi.js five selectors and one event, hand-encoded, no coder dependency
client.js the read surface, built on @stockledger/core for the arithmetic
npm test # 13 tests, stubbed transport, no network
node examples/resolve.js AAPL # live: 1127 candidates, 1 genuine
node examples/register.js 0xaf3d...93f9 # live: the Apple dividend, both readingsMIT. See LICENSE.
Part of Stock Ledger - the register of record for tokenized equities.