Reading the registry
Three kinds of consumer, three shapes of the same data: a venue that needs marks and events, a pool or basket that needs allocations, and an interface that needs to tell a user what happened to their position.
Status. The registry is being seeded contract by contract, starting with the nine that have already received an action. The interfaces described here are the published shape of the product: field names and semantics are stable, coverage is not yet complete. Where a page describes behaviour that is not live for a given name, it says so.
There is no endpoint of ours
You do not integrate against a service we run. You take the code, point it at a public RPC node, and get the same answers we get. That is the whole design: a register nobody can quietly edit is worth more than an API nobody can audit.
Everything lives on GitHub, MIT licensed.
What to take
- ledger-sdk is the one most people want. Resolve a ticker to the single contract that means it, replay the register with its flags intact, read balances at a block. One dependency, no key.
- ledger-core is the arithmetic underneath: bytecode identity, event register, holder snapshot, largest-remainder allocation. BigInt throughout, no network at all.
- erc8056-checks reproduces every figure on this site. Zero dependencies. Run it before believing us.
- corporate-actions-log is the append-only sweep record: one file per day, never edited, with a verifier beside it.
- ledger-contracts is the on-chain surface expressed as interfaces. Nothing is deployed, and the repository says so.
Install
The packages are not on npm yet. Install them from the repository:
npm install github:usestockledger/ledger-sdk
Resolve the contract before anything else
A ticker is not an identifier on this chain and neither is a name. The SDK does the resolution and
returns null rather than a guess when the answer is not unique:
const { LedgerClient } = require('@stockledger/sdk');
const r = await new LedgerClient().resolveTicker('AAPL');
// { searched: 1130, branded: 4, resolved: '0xaf3d…93f9' }
If you would rather not take the dependency, run the same test it runs. It is two lines:
const code = await rpc('eth_getCode', [address, 'latest']);
const real = (code.length - 2) / 2 === 283 &&
code.toLowerCase().includes('e10b6f6b275de231345c20d14ab812db62151b00');
A venue
Call register(address) for the names you list. It hands back both readings of the log,
the absolute one and the composed one, and tells you whether they agree. Three things matter, and each
of them has already bitten someone on this chain:
- Do not apply the multiplier twice. The Chainlink feed already includes it. Multiplying the
oracle price by
uiMultiplier()double counts the dividend. - Read absolute values. Take
absolute, nevercomposed. Deltas compound wrongly when an event is emitted twice, and two of the fifteen events on this chain are repeats. That is exactly whereagreecomes back false. - Use the effective time, not the emission block. They differ, sometimes by a lot.
A pool or a basket
A pool holding wrappers accrues value it cannot attribute. The allocation arithmetic, including the
largest-remainder split, is in ledger-core: book who the step belonged to at the moment it
applied, rather than discovering the drift against the benchmark at the end of the quarter.
An interface
The smallest useful integration is one line in a position view: the current factor, the last event that moved it, and the date. That single row is the whole product from the user's side.
Conventions
- Factors and amounts are decimal strings. Do not parse them into floats.
- Timestamps are UTC. Dates without a time are calendar dates in the listing venue's time zone.
- Records are versioned and corrections are re-emitted; treat
idplusversionas the key. balanceOfreturns the raw balance and never the UI amount. Scaling is a decision, and the SDK makes you make it.- There are no rate limits and no API keys, because there is no service to rate limit.
Found something wrong? Open an issue against the repository that produced it. A register that argues with its own users in public is worth more than one that is merely quiet.