Writing an adapter
An adapter is an ES module. The runner imports it and calls the functions below. Every function may return a value or a promise. Leave out a function your signer does not implement: the cases that need it are reported as not run, and a run with anything not run does not pass.
The adapter reports and never judges. Return what your signer did, even when it looks wrong. The runner makes every comparison, and where it has to look inside your signer's output (a signed PSBT, a BBQr frame, a QR symbol) it parses that output itself.
Adapter functions must not throw for input the signer rejects. A rejection is a
refuse verdict. A thrown error is reported as a failure of the case.
Exports
| Export | Arguments | Returns |
|---|---|---|
name |
A string naming the implementation and version. Optional. | |
changeSearchBound |
A number: how many addresses on each change branch the signer re-derives when it looks for change. Used by the change-at-index-* cases. The profile requires the bound to be documented (SP-REV-6). |
|
diceToSeed(rolls) |
rolls: the string exactly as a user typed it |
{ verdict: 'accept', entropyHex, mnemonic, seedHex } or { verdict: 'refuse' }. seedHex is the BIP-39 seed with an empty passphrase. |
diceBitsShown(count) |
count: a number of valid rolls |
The integer number of bits the signer displays after that many rolls. |
reviewPsbt(psbt, context) |
psbt: base64 PSBT; context: see below |
A review result, see below. |
signPsbt(psbt, context, options) |
as above; options.override is true only in sign-override.json, where it is the explicit single-use override SP-REV-22 describes |
{ verdict: 'signed', psbtBase64 } or { verdict: 'refuse' }. |
buildManifest(files) |
files: [{ path, bytes }], bytes a Uint8Array, in no particular order |
{ manifest, root }: the manifest text exactly, and its root as lowercase hex. |
urJoin(frames) |
frames: scanned UR strings, in scan order |
{ verdict: 'complete', type, data } with type the UR type (crypto-psbt or psbt) and data the binary PSBT, or { verdict: 'refuse' }, or { verdict: 'incomplete' }. Optional: only for a signer that implements UR (SP-TX-7). |
bbqrJoin(frames) |
frames: the scanned strings, in scan order |
{ verdict: 'complete', fileType, data } with fileType the BBQr letter and data a Uint8Array, or { verdict: 'refuse' }, or { verdict: 'incomplete' }. |
bbqrEncodePsbt(psbt) |
psbt: base64 PSBT |
{ frames: [{ text, modules }] }: every frame the signer would display, in order. modules is the QR symbol as an array of strings of 1 (dark) and 0, one per row, without the quiet zone. |
The context for review and signing names the wallet the signer holds:
{ "mnemonic": "abandon ... about", "passphrase": "", "network": "mainnet", "masterFingerprint": "73c5da0a" }
It is the BIP-84 and BIP-86 test mnemonic. The funds in these PSBTs exist only on a regtest chain that no longer exists, and the keys are public.
Review results
reviewPsbt returns an object. verdict is required. Report every other field
your signer shows; a case fails if it checks a field you left out.
| Field | Meaning |
|---|---|
verdict |
allow: the user can sign. block-until-override: signing is disabled until an explicit single-use override. refuse: the transaction cannot be signed at all, including with an override. |
feeSats |
The fee shown, in satoshis, as a decimal string. |
outputs |
[{ index, address, amountSats, kind, changePath }]. kind is payment or change. address is the full address or null. changePath is the path shown beside change, such as m/84'/0'/0'/1/0. |
claimedOutputs |
Indices of outputs the review says the transaction claimed were the wallet's, and which did not re-derive. |
sighash |
{ outputs, otherInputsMayBeAdded }. outputs is all, none, one or unrecognised: which outputs the signature commits to, as the review describes it. |
locktime |
{ kind, value }. kind is none (nLockTime is 0), height or time as the review presents it, or not-enforced when nLockTime is set and every input's nSequence is 0xffffffff, so consensus ignores it. |
replaceable |
Whether the review says the transaction signals BIP-125 replaceability. |
unknownFieldsReported |
How many key-value pairs the review says it does not model. |
warnings |
Warning codes shown. The only code the vectors look for is high-fee. |
Where a case accepts more than one verdict, the vector lists them in
verdictIn. For example, a sighash other than ALL must be a blocking condition,
and SP-REV-22 lets a signer refuse outright instead of offering an override, so
both block-until-override and refuse pass.
Rendered from conformance/README.md, the same bytes that ship with the code. SHA-256 d0c681a5e7b7f55bcc96ecd33bb0ab07dd944b4fe2bb50f640ee79a85db3917e