← Book map

Chapter 11 · Tabs

The escape hatch

No typed details class — a JSON payload in a general-purpose VDXF object, with chain-time alignment and bigint arithmetic instead of floats.

Transaction signing — one general-purpose detail Instead of a typed details class, the transaction signing request carries a JSON payload in a general-purpose VDXF object keyed by a text key. type: tx-signing-template chain: VRSCTEST / VRSC hextx outputtotalsSats feeSats createdAt aligned to chain time optional signature verify before return QR No dedicated Details class — the payload is JSON inside a GeneralTypeOrdinalVDXFObject.

FIGURE 11.1 · The newest tab takes a different approach.

Why this tab is different

Every other tab has a purpose-built details class in the primitives library. Transaction signing does not: it sends a JSON payload describing a pre-built transaction, inside a general-purpose VDXF object keyed by a text key. That is the escape hatch the library provides for request types it does not model yet.

new GeneralTypeOrdinalVDXFObject({
  type: VDXF_OBJECT_RESERVED_BYTE_VDXF_ID_STRING,
  key: TX_SIGNING_TEMPLATE_VDXF_TEXT_KEY,
  data: Buffer.from(JSON.stringify({
    type: "tx-signing-template",
    chain: isTestnet ? "VRSCTEST" : "VRSC",
    signed, signingId,
    hextx,
    outputtotalsSats, feeSats
  }), "utf-8")
})

The details that show real care

What the payload promises

FieldMeaning
hextxThe exact transaction to sign
outputtotalsSatsPer-destination totals the wallet should verify against the transaction
feeSatsDeclared fee, so the wallet can refuse a mismatch
chainWhich network the transaction belongs to
General-purpose objects are how you ship a request type before the library models it. The cost is that nothing validates your JSON but your own code — which is why this file is 329 lines for one payload.

Reading the code

src/routes/requests/txSigning.ts
  parseFixedPointToSats / parseHexTransaction / parseOutputTotals
  buildTxSigningRequest / alignCreatedAtToChainTime
  verifySignedRequestSignature / applyOptionalSignature
  generateTxSigningQr