MCPcopy Create free account
hub / github.com/NoteProtocol/NoteWallet / buildPayloadTransaction

Method buildPayloadTransaction

src/btc/btc-wallet.ts:304–337  ·  view source on GitHub ↗
(
    data: any,
    toAddress?: string,
    noteUtxo?: IUtxo,
    payUtxos?: IUtxo[],
    feeRate?: number,
    locktime?: number,
    extOutputs?: ISendToAddress[]
  )

Source from the content-addressed store, hash-verified

302 }
303
304 async buildPayloadTransaction(
305 data: any,
306 toAddress?: string,
307 noteUtxo?: IUtxo,
308 payUtxos?: IUtxo[],
309 feeRate?: number,
310 locktime?: number,
311 extOutputs?: ISendToAddress[]
312 ) {
313 const payload = buildNotePayload(data);
314 noteUtxo = noteUtxo ?? (await this.buildEmptyTokenUTXO());
315 payUtxos = payUtxos ?? (await this.fetchAllAccountUtxos());
316 payUtxos = payUtxos?.filter(
317 (utxo) => utxo.scriptHash !== noteUtxo!.scriptHash
318 );
319
320 const toAddresses: ISendToAddress[] = [
321 {address: toAddress!, amount: MIN_SATOSHIS},
322 ];
323
324 const result = await this.buildNoteTransaction(
325 payload,
326 toAddresses.concat(extOutputs ?? []),
327 [noteUtxo],
328 payUtxos,
329 feeRate,
330 locktime
331 );
332
333 return {
334 ...result,
335 noteUtxo: result.noteUtxos ? result.noteUtxos[0] : undefined,
336 };
337 }
338
339 async buildCommitDataTransaction(
340 data: any,

Callers 3

mintMethod · 0.80
deployMethod · 0.80
mintMethod · 0.80

Calls 3

buildEmptyTokenUTXOMethod · 0.95
buildNoteTransactionMethod · 0.95
buildNotePayloadFunction · 0.90

Tested by

no test coverage detected