Skip to content

serializeUnsignedTx

serializeUnsignedTx(unsignedTx): string

Defined in: ootle/src/transaction.ts:44

Serialize an unsigned transaction to the JSON string handed to WASM (addTransactionSigner, sealTransaction) and to one-time stealth-signature hashing.

Identical to JSON.stringify(unsignedTx) for any fragment-free transaction — so existing transaction hashes do not shift — but a stealth statement is carried as a RawJsonFragment whose byte-exact toCompactJson() string must survive verbatim. Its u64 amounts are bare JSON numbers exceeding 2^53; JSON.stringify cannot emit them losslessly. We therefore stringify each carrier as a unique placeholder, then splice the raw fragment in place of the quoted placeholder, never round-tripping the amounts through a JS number.

Any bigint field (e.g. a large nonce) is emitted as a decimal string, matching the Tari clients’ wire encoding: every 64-bit field on these APIs accepts a string as well as a number, and a string is the only lossless encoding above Number.MAX_SAFE_INTEGER. Plain JSON.stringify throws on a bigint, and the global BigInt.prototype.toJSON patch the client packages used to install was removed in 0.39.

UnsignedTransactionV1

string