Write an issuer adapter
An issuer adapter turns a rail's own payout record into a Nokto income claim, ready to be recorded against a recipient's account — see Accounts and the Receive operation in Operations.
import { defineIssuerAdapter } from '@nokto-protocol/plugin-kit';
const adapter = defineIssuerAdapter<Payout>({
name: 'my-rail',
tier: 1, // the tier you are REGISTERED at
toClaim: (p) => ({
recipientId: p.accountId,
amount: p.minorUnits,
currency: 'USD',
occurredAt: p.settledAt,
}),
});
const message = adapter.build(payout, { claimNonce, issuerKeyId });
const claim = await adapter.sign(message, mySigner);
What build and sign do, and don't do
build projects your rail-specific payout onto the protocol's fields and
validates them: amount must fit in 128 bits and be non-negative,
occurredAt must fit in 64 bits, and currency must be 1 to 8 ASCII bytes.
These are the exact bounds the signed message layout requires — see
Signed message — so a payout that fails
here would fail signature verification on-chain regardless.
sign does not hold your signing key. The kit never takes it — you inject
a signer function, because the signing key belongs to the issuer's own
infrastructure, and a kit that asked every integrator to hand over their
key would be asking for exactly the wrong thing.
The tier is not a claim the adapter gets to make
tier is the tier you are registered at in the protocol's issuer
registry, not a claim your adapter is free to assert. The contract that
records an income event compares the tier your signature carries against
your registry entry and rejects a mismatch — so setting tier higher here
does not upgrade your claims, it only stops them from being accepted. See
Assurance tiers for what each tier value
means and why the registry, not the signer, governs it.
claimNonce must be unique per claim — required rather than generated
internally, because a duplicate makes the claim unusable (the contract
spends a nonce once) and a kit that silently generated randomness would
make your own claims irreproducible for reconciliation.
Building any of this yourself requires building from source — the packages are not published.