(
data: any,
toAddress?: string,
noteUtxo?: IUtxo,
payUtxos?: IUtxo[],
feeRate?: number,
locktime?: number,
extOutputs?: ISendToAddress[]
)
| 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, |
no test coverage detected