OptionalephemeralE: stringOptionalephemeralStaticcreateOptionalcustomSplit: AmountLike[]StaticcreateOptionalcustomSplit: AmountLike[]StaticcreateOptionalcustomSplit: AmountLike[]StaticcreateStaticcreateOptionaleBytes: Uint8Array<ArrayBufferLike>Optional fixed P2BK ephemeral key; batch callers pass one shared key for SIG_ALL. Omit for a fresh random key.
StaticcreateStaticdeserializeReconstructs concrete OutputData from its JSON-safe representation.
CTSError If any field fails validation: non-canonical or zero blindingFactor, malformed hex secret/ephemeralE, a secret that is not valid UTF-8, a B_ that does not match the secret and blindingFactor, or an Amount that cannot be parsed.
OutputData.serialize for the persist/restore lifecycle example.
StaticserializeConverts output data to a JSON-safe representation.
Pair with OutputData.deserialize to persist prepared melt change outputs (e.g. across a
NUT-06 async melt's pending window) and reconstruct spendable change proofs via
wallet.createMeltChangeProofs once the quote is paid.
// Save while async melt is pending:
const preview = await wallet.prepareMelt('bolt11', meltQuote, proofs);
const stored = JSON.stringify(preview.outputData.map((o) => OutputData.serialize(o)));
await wallet.completeMelt(preview, undefined, { preferAsync: true });
// ... time passes, quote pays ...
const restored = (JSON.parse(stored) as SerializedOutputData[]).map((s) =>
OutputData.deserialize(s),
);
// zero-value entries carry no ecash (NUT-08); Amount.from also covers a quote rehydrated from JSON
const sigs = (paidQuote.change ?? []).filter((s) => !Amount.from(s.amount).isZero());
await wallet.ensureOperableKeysets(sigs.map((s) => s.id)); // change may be on a rotated-in keyset
const change = wallet.createMeltChangeProofs(restored, sigs);
StaticsumCalculates the sum of amounts in an array of OutputDataLike objects.
Array of OutputDataLike objects.
The total sum of amounts.
Minimum interface for an output data object. OutputData helpers only require keyset
idandkeys. Custom implementations must satisfy this interface to be used with wallet operations.