@bitgo/wasm-utxo 1.40.0 → 1.42.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/js/fixedScriptWallet/BitGoPsbt.d.ts +64 -8
- package/dist/cjs/js/fixedScriptWallet/BitGoPsbt.js +67 -9
- package/dist/cjs/js/fixedScriptWallet/index.d.ts +2 -1
- package/dist/cjs/js/index.d.ts +1 -1
- package/dist/cjs/js/psbt.d.ts +12 -0
- package/dist/cjs/js/wasm/wasm_utxo.d.ts +29 -0
- package/dist/cjs/js/wasm/wasm_utxo.js +82 -0
- package/dist/cjs/js/wasm/wasm_utxo_bg.wasm +0 -0
- package/dist/cjs/js/wasm/wasm_utxo_bg.wasm.d.ts +125 -120
- package/dist/esm/js/fixedScriptWallet/BitGoPsbt.d.ts +64 -8
- package/dist/esm/js/fixedScriptWallet/BitGoPsbt.js +68 -10
- package/dist/esm/js/fixedScriptWallet/index.d.ts +2 -1
- package/dist/esm/js/index.d.ts +1 -1
- package/dist/esm/js/index.js +1 -1
- package/dist/esm/js/psbt.d.ts +12 -0
- package/dist/esm/js/wasm/wasm_utxo.d.ts +29 -0
- package/dist/esm/js/wasm/wasm_utxo_bg.js +82 -0
- package/dist/esm/js/wasm/wasm_utxo_bg.wasm +0 -0
- package/dist/esm/js/wasm/wasm_utxo_bg.wasm.d.ts +125 -120
- package/package.json +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { BitGoPsbt as WasmBitGoPsbt } from "../wasm/wasm_utxo.js";
|
|
1
|
+
import { BitGoPsbt as WasmBitGoPsbt, type PsbtInputData, type PsbtOutputData, type PsbtOutputDataWithAddress } from "../wasm/wasm_utxo.js";
|
|
2
|
+
import type { IPsbtIntrospectionWithAddress } from "../psbt.js";
|
|
2
3
|
import { type WalletKeysArg } from "./RootWalletKeys.js";
|
|
3
4
|
import { type ReplayProtectionArg } from "./ReplayProtection.js";
|
|
4
5
|
import { type BIP32Arg } from "../bip32.js";
|
|
@@ -90,7 +91,14 @@ export type AddWalletOutputOptions = {
|
|
|
90
91
|
/** Value in satoshis */
|
|
91
92
|
value: bigint;
|
|
92
93
|
};
|
|
93
|
-
export
|
|
94
|
+
export type ParseTransactionOptions = {
|
|
95
|
+
replayProtection: ReplayProtectionArg;
|
|
96
|
+
payGoPubkeys?: ECPairArg[];
|
|
97
|
+
};
|
|
98
|
+
export type ParseOutputsOptions = {
|
|
99
|
+
payGoPubkeys?: ECPairArg[];
|
|
100
|
+
};
|
|
101
|
+
export declare class BitGoPsbt implements IPsbtIntrospectionWithAddress {
|
|
94
102
|
protected _wasm: WasmBitGoPsbt;
|
|
95
103
|
protected constructor(_wasm: WasmBitGoPsbt);
|
|
96
104
|
/**
|
|
@@ -305,11 +313,12 @@ export declare class BitGoPsbt {
|
|
|
305
313
|
/**
|
|
306
314
|
* Parse transaction with wallet keys to identify wallet inputs/outputs
|
|
307
315
|
* @param walletKeys - The wallet keys to use for identification
|
|
308
|
-
* @param
|
|
309
|
-
* @param
|
|
316
|
+
* @param options - Options for parsing
|
|
317
|
+
* @param options.replayProtection - Scripts that are allowed as inputs without wallet validation
|
|
318
|
+
* @param options.payGoPubkeys - Optional public keys for PayGo attestation verification
|
|
310
319
|
* @returns Parsed transaction information
|
|
311
320
|
*/
|
|
312
|
-
parseTransactionWithWalletKeys(walletKeys: WalletKeysArg,
|
|
321
|
+
parseTransactionWithWalletKeys(walletKeys: WalletKeysArg, options: ParseTransactionOptions): ParsedTransaction;
|
|
313
322
|
/**
|
|
314
323
|
* Parse outputs with wallet keys to identify which outputs belong to a wallet
|
|
315
324
|
* with the given wallet keys.
|
|
@@ -318,11 +327,12 @@ export declare class BitGoPsbt {
|
|
|
318
327
|
* wallet than the inputs.
|
|
319
328
|
*
|
|
320
329
|
* @param walletKeys - The wallet keys to use for identification
|
|
321
|
-
* @param
|
|
330
|
+
* @param options - Optional options for parsing
|
|
331
|
+
* @param options.payGoPubkeys - Optional public keys for PayGo attestation verification
|
|
322
332
|
* @returns Array of parsed outputs
|
|
323
333
|
* @note This method does NOT validate wallet inputs. It only parses outputs.
|
|
324
334
|
*/
|
|
325
|
-
parseOutputsWithWalletKeys(walletKeys: WalletKeysArg,
|
|
335
|
+
parseOutputsWithWalletKeys(walletKeys: WalletKeysArg, options?: ParseOutputsOptions): ParsedOutput[];
|
|
326
336
|
/**
|
|
327
337
|
* Add a PayGo attestation to a PSBT output
|
|
328
338
|
*
|
|
@@ -502,7 +512,7 @@ export declare class BitGoPsbt {
|
|
|
502
512
|
* const counterpartyPsbt = BitGoPsbt.fromBytes(counterpartyPsbtBytes, network);
|
|
503
513
|
* psbt.combineMusig2Nonces(counterpartyPsbt);
|
|
504
514
|
* // Sign MuSig2 key path inputs
|
|
505
|
-
* const parsed = psbt.parseTransactionWithWalletKeys(walletKeys, replayProtection);
|
|
515
|
+
* const parsed = psbt.parseTransactionWithWalletKeys(walletKeys, { replayProtection });
|
|
506
516
|
* for (let i = 0; i < parsed.inputs.length; i++) {
|
|
507
517
|
* if (parsed.inputs[i].scriptType === "p2trMusig2KeyPath") {
|
|
508
518
|
* psbt.sign(i, userXpriv);
|
|
@@ -570,4 +580,50 @@ export declare class BitGoPsbt {
|
|
|
570
580
|
* ```
|
|
571
581
|
*/
|
|
572
582
|
getHalfSignedLegacyFormat(): Uint8Array;
|
|
583
|
+
/**
|
|
584
|
+
* Get the number of inputs in the PSBT
|
|
585
|
+
* @returns The number of inputs
|
|
586
|
+
*/
|
|
587
|
+
get inputCount(): number;
|
|
588
|
+
/**
|
|
589
|
+
* Get the number of outputs in the PSBT
|
|
590
|
+
* @returns The number of outputs
|
|
591
|
+
*/
|
|
592
|
+
get outputCount(): number;
|
|
593
|
+
/**
|
|
594
|
+
* Get all PSBT inputs as an array
|
|
595
|
+
*
|
|
596
|
+
* Returns raw PSBT input data including witness_utxo and derivation info.
|
|
597
|
+
* For parsed transaction data with address identification, use
|
|
598
|
+
* parseTransactionWithWalletKeys() instead.
|
|
599
|
+
*
|
|
600
|
+
* @returns Array of PsbtInputData objects
|
|
601
|
+
*/
|
|
602
|
+
getInputs(): PsbtInputData[];
|
|
603
|
+
/**
|
|
604
|
+
* Get all PSBT outputs as an array
|
|
605
|
+
*
|
|
606
|
+
* Returns raw PSBT output data without address resolution.
|
|
607
|
+
* For output data with addresses, use getOutputsWithAddress().
|
|
608
|
+
*
|
|
609
|
+
* @returns Array of PsbtOutputData objects
|
|
610
|
+
*/
|
|
611
|
+
getOutputs(): PsbtOutputData[];
|
|
612
|
+
/**
|
|
613
|
+
* Get all PSBT outputs with resolved address strings
|
|
614
|
+
*
|
|
615
|
+
* Unlike the generic Psbt class which requires a coin parameter,
|
|
616
|
+
* BitGoPsbt automatically uses the network it was created with to resolve addresses.
|
|
617
|
+
*
|
|
618
|
+
* @returns Array of PsbtOutputDataWithAddress objects
|
|
619
|
+
*
|
|
620
|
+
* @example
|
|
621
|
+
* ```typescript
|
|
622
|
+
* const outputs = psbt.getOutputsWithAddress();
|
|
623
|
+
* for (const output of outputs) {
|
|
624
|
+
* console.log(`${output.address}: ${output.value} satoshis`);
|
|
625
|
+
* }
|
|
626
|
+
* ```
|
|
627
|
+
*/
|
|
628
|
+
getOutputsWithAddress(): PsbtOutputDataWithAddress[];
|
|
573
629
|
}
|
|
@@ -221,14 +221,15 @@ class BitGoPsbt {
|
|
|
221
221
|
/**
|
|
222
222
|
* Parse transaction with wallet keys to identify wallet inputs/outputs
|
|
223
223
|
* @param walletKeys - The wallet keys to use for identification
|
|
224
|
-
* @param
|
|
225
|
-
* @param
|
|
224
|
+
* @param options - Options for parsing
|
|
225
|
+
* @param options.replayProtection - Scripts that are allowed as inputs without wallet validation
|
|
226
|
+
* @param options.payGoPubkeys - Optional public keys for PayGo attestation verification
|
|
226
227
|
* @returns Parsed transaction information
|
|
227
228
|
*/
|
|
228
|
-
parseTransactionWithWalletKeys(walletKeys,
|
|
229
|
+
parseTransactionWithWalletKeys(walletKeys, options) {
|
|
229
230
|
const keys = RootWalletKeys_js_1.RootWalletKeys.from(walletKeys);
|
|
230
|
-
const rp = ReplayProtection_js_1.ReplayProtection.from(replayProtection, this._wasm.network());
|
|
231
|
-
const pubkeys = payGoPubkeys?.map((arg) => ecpair_js_1.ECPair.from(arg).wasm);
|
|
231
|
+
const rp = ReplayProtection_js_1.ReplayProtection.from(options.replayProtection, this._wasm.network());
|
|
232
|
+
const pubkeys = options.payGoPubkeys?.map((arg) => ecpair_js_1.ECPair.from(arg).wasm);
|
|
232
233
|
return this._wasm.parse_transaction_with_wallet_keys(keys.wasm, rp.wasm, pubkeys);
|
|
233
234
|
}
|
|
234
235
|
/**
|
|
@@ -239,13 +240,14 @@ class BitGoPsbt {
|
|
|
239
240
|
* wallet than the inputs.
|
|
240
241
|
*
|
|
241
242
|
* @param walletKeys - The wallet keys to use for identification
|
|
242
|
-
* @param
|
|
243
|
+
* @param options - Optional options for parsing
|
|
244
|
+
* @param options.payGoPubkeys - Optional public keys for PayGo attestation verification
|
|
243
245
|
* @returns Array of parsed outputs
|
|
244
246
|
* @note This method does NOT validate wallet inputs. It only parses outputs.
|
|
245
247
|
*/
|
|
246
|
-
parseOutputsWithWalletKeys(walletKeys,
|
|
248
|
+
parseOutputsWithWalletKeys(walletKeys, options) {
|
|
247
249
|
const keys = RootWalletKeys_js_1.RootWalletKeys.from(walletKeys);
|
|
248
|
-
const pubkeys = payGoPubkeys?.map((arg) => ecpair_js_1.ECPair.from(arg).wasm);
|
|
250
|
+
const pubkeys = options?.payGoPubkeys?.map((arg) => ecpair_js_1.ECPair.from(arg).wasm);
|
|
249
251
|
return this._wasm.parse_outputs_with_wallet_keys(keys.wasm, pubkeys);
|
|
250
252
|
}
|
|
251
253
|
/**
|
|
@@ -447,7 +449,7 @@ class BitGoPsbt {
|
|
|
447
449
|
* const counterpartyPsbt = BitGoPsbt.fromBytes(counterpartyPsbtBytes, network);
|
|
448
450
|
* psbt.combineMusig2Nonces(counterpartyPsbt);
|
|
449
451
|
* // Sign MuSig2 key path inputs
|
|
450
|
-
* const parsed = psbt.parseTransactionWithWalletKeys(walletKeys, replayProtection);
|
|
452
|
+
* const parsed = psbt.parseTransactionWithWalletKeys(walletKeys, { replayProtection });
|
|
451
453
|
* for (let i = 0; i < parsed.inputs.length; i++) {
|
|
452
454
|
* if (parsed.inputs[i].scriptType === "p2trMusig2KeyPath") {
|
|
453
455
|
* psbt.sign(i, userXpriv);
|
|
@@ -535,5 +537,61 @@ class BitGoPsbt {
|
|
|
535
537
|
getHalfSignedLegacyFormat() {
|
|
536
538
|
return this._wasm.extract_half_signed_legacy_tx();
|
|
537
539
|
}
|
|
540
|
+
/**
|
|
541
|
+
* Get the number of inputs in the PSBT
|
|
542
|
+
* @returns The number of inputs
|
|
543
|
+
*/
|
|
544
|
+
get inputCount() {
|
|
545
|
+
return this._wasm.input_count();
|
|
546
|
+
}
|
|
547
|
+
/**
|
|
548
|
+
* Get the number of outputs in the PSBT
|
|
549
|
+
* @returns The number of outputs
|
|
550
|
+
*/
|
|
551
|
+
get outputCount() {
|
|
552
|
+
return this._wasm.output_count();
|
|
553
|
+
}
|
|
554
|
+
/**
|
|
555
|
+
* Get all PSBT inputs as an array
|
|
556
|
+
*
|
|
557
|
+
* Returns raw PSBT input data including witness_utxo and derivation info.
|
|
558
|
+
* For parsed transaction data with address identification, use
|
|
559
|
+
* parseTransactionWithWalletKeys() instead.
|
|
560
|
+
*
|
|
561
|
+
* @returns Array of PsbtInputData objects
|
|
562
|
+
*/
|
|
563
|
+
getInputs() {
|
|
564
|
+
return this._wasm.get_inputs();
|
|
565
|
+
}
|
|
566
|
+
/**
|
|
567
|
+
* Get all PSBT outputs as an array
|
|
568
|
+
*
|
|
569
|
+
* Returns raw PSBT output data without address resolution.
|
|
570
|
+
* For output data with addresses, use getOutputsWithAddress().
|
|
571
|
+
*
|
|
572
|
+
* @returns Array of PsbtOutputData objects
|
|
573
|
+
*/
|
|
574
|
+
getOutputs() {
|
|
575
|
+
return this._wasm.get_outputs();
|
|
576
|
+
}
|
|
577
|
+
/**
|
|
578
|
+
* Get all PSBT outputs with resolved address strings
|
|
579
|
+
*
|
|
580
|
+
* Unlike the generic Psbt class which requires a coin parameter,
|
|
581
|
+
* BitGoPsbt automatically uses the network it was created with to resolve addresses.
|
|
582
|
+
*
|
|
583
|
+
* @returns Array of PsbtOutputDataWithAddress objects
|
|
584
|
+
*
|
|
585
|
+
* @example
|
|
586
|
+
* ```typescript
|
|
587
|
+
* const outputs = psbt.getOutputsWithAddress();
|
|
588
|
+
* for (const output of outputs) {
|
|
589
|
+
* console.log(`${output.address}: ${output.value} satoshis`);
|
|
590
|
+
* }
|
|
591
|
+
* ```
|
|
592
|
+
*/
|
|
593
|
+
getOutputsWithAddress() {
|
|
594
|
+
return this._wasm.get_outputs_with_address();
|
|
595
|
+
}
|
|
538
596
|
}
|
|
539
597
|
exports.BitGoPsbt = BitGoPsbt;
|
|
@@ -5,8 +5,9 @@ export { outputScript, address } from "./address.js";
|
|
|
5
5
|
export { Dimensions } from "./Dimensions.js";
|
|
6
6
|
export { outputScriptTypes, inputScriptTypes, type OutputScriptType, type InputScriptType, type ScriptType, } from "./scriptType.js";
|
|
7
7
|
export { ChainCode, chainCodes, assertChainCode, type Scope } from "./chains.js";
|
|
8
|
-
export { BitGoPsbt, type NetworkName, type ScriptId, type ParsedInput, type ParsedOutput, type ParsedTransaction, type SignPath, type CreateEmptyOptions, type AddInputOptions, type AddOutputOptions, type AddWalletInputOptions, type AddWalletOutputOptions, } from "./BitGoPsbt.js";
|
|
8
|
+
export { BitGoPsbt, type NetworkName, type ScriptId, type ParsedInput, type ParsedOutput, type ParsedTransaction, type SignPath, type CreateEmptyOptions, type AddInputOptions, type AddOutputOptions, type AddWalletInputOptions, type AddWalletOutputOptions, type ParseTransactionOptions, type ParseOutputsOptions, } from "./BitGoPsbt.js";
|
|
9
9
|
export { ZcashBitGoPsbt, type ZcashNetworkName, type CreateEmptyZcashOptions, } from "./ZcashBitGoPsbt.js";
|
|
10
|
+
export type { PsbtBip32Derivation, PsbtInputData, PsbtOutputData, PsbtOutputDataWithAddress, PsbtWitnessUtxo, } from "../wasm/wasm_utxo.js";
|
|
10
11
|
import type { ScriptType } from "./scriptType.js";
|
|
11
12
|
/**
|
|
12
13
|
* Check if a network supports a given fixed-script wallet script type
|
package/dist/cjs/js/index.d.ts
CHANGED
|
@@ -91,4 +91,4 @@ export { WrapDescriptor as Descriptor } from "./wasm/wasm_utxo.js";
|
|
|
91
91
|
export { WrapMiniscript as Miniscript } from "./wasm/wasm_utxo.js";
|
|
92
92
|
export { WrapPsbt as Psbt } from "./wasm/wasm_utxo.js";
|
|
93
93
|
export { DashTransaction, Transaction, ZcashTransaction } from "./transaction.js";
|
|
94
|
-
export { hasPsbtMagic } from "./psbt.js";
|
|
94
|
+
export { hasPsbtMagic, type IPsbtIntrospection, type IPsbtIntrospectionWithAddress, } from "./psbt.js";
|
package/dist/cjs/js/psbt.d.ts
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
import type { PsbtInputData, PsbtOutputData, PsbtOutputDataWithAddress } from "./wasm/wasm_utxo.js";
|
|
2
|
+
/** Common interface for PSBT introspection methods */
|
|
3
|
+
export interface IPsbtIntrospection {
|
|
4
|
+
readonly inputCount: number;
|
|
5
|
+
readonly outputCount: number;
|
|
6
|
+
getInputs(): PsbtInputData[];
|
|
7
|
+
getOutputs(): PsbtOutputData[];
|
|
8
|
+
}
|
|
9
|
+
/** Extended introspection with address resolution (no coin parameter needed) */
|
|
10
|
+
export interface IPsbtIntrospectionWithAddress extends IPsbtIntrospection {
|
|
11
|
+
getOutputsWithAddress(): PsbtOutputDataWithAddress[];
|
|
12
|
+
}
|
|
1
13
|
/**
|
|
2
14
|
* Check if a byte array has the PSBT magic bytes
|
|
3
15
|
*
|
|
@@ -384,6 +384,13 @@ export class BitGoPsbt {
|
|
|
384
384
|
* generated for security. Custom session_id is only allowed on testnets for testing purposes.
|
|
385
385
|
*/
|
|
386
386
|
generate_musig2_nonces(xpriv: WasmBIP32, session_id_bytes?: Uint8Array | null): void;
|
|
387
|
+
/**
|
|
388
|
+
* Get all PSBT inputs as an array of PsbtInputData
|
|
389
|
+
*
|
|
390
|
+
* Returns an array with witness_utxo, bip32_derivation, and tap_bip32_derivation
|
|
391
|
+
* for each input.
|
|
392
|
+
*/
|
|
393
|
+
get_inputs(): any;
|
|
387
394
|
/**
|
|
388
395
|
* Get the network type for transaction extraction
|
|
389
396
|
*
|
|
@@ -391,6 +398,24 @@ export class BitGoPsbt {
|
|
|
391
398
|
* wrapper class should be used in TypeScript.
|
|
392
399
|
*/
|
|
393
400
|
get_network_type(): string;
|
|
401
|
+
/**
|
|
402
|
+
* Get all PSBT outputs as an array of PsbtOutputData
|
|
403
|
+
*
|
|
404
|
+
* Returns an array with script, value, bip32_derivation, and tap_bip32_derivation
|
|
405
|
+
* for each output.
|
|
406
|
+
*/
|
|
407
|
+
get_outputs(): any;
|
|
408
|
+
/**
|
|
409
|
+
* Get all PSBT outputs with resolved address strings.
|
|
410
|
+
*
|
|
411
|
+
* Unlike the generic WrapPsbt which requires a coin parameter, BitGoPsbt
|
|
412
|
+
* uses the network it was created/deserialized with to resolve addresses.
|
|
413
|
+
*/
|
|
414
|
+
get_outputs_with_address(): any;
|
|
415
|
+
/**
|
|
416
|
+
* Get the number of inputs in the PSBT
|
|
417
|
+
*/
|
|
418
|
+
input_count(): number;
|
|
394
419
|
/**
|
|
395
420
|
* Check if an input is a MuSig2 keypath input.
|
|
396
421
|
*
|
|
@@ -413,6 +438,10 @@ export class BitGoPsbt {
|
|
|
413
438
|
* Get the network of the PSBT
|
|
414
439
|
*/
|
|
415
440
|
network(): string;
|
|
441
|
+
/**
|
|
442
|
+
* Get the number of outputs in the PSBT
|
|
443
|
+
*/
|
|
444
|
+
output_count(): number;
|
|
416
445
|
/**
|
|
417
446
|
* Parse outputs with wallet keys to identify which outputs belong to a wallet
|
|
418
447
|
*
|
|
@@ -1015,6 +1015,28 @@ class BitGoPsbt {
|
|
|
1015
1015
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1016
1016
|
}
|
|
1017
1017
|
}
|
|
1018
|
+
/**
|
|
1019
|
+
* Get all PSBT inputs as an array of PsbtInputData
|
|
1020
|
+
*
|
|
1021
|
+
* Returns an array with witness_utxo, bip32_derivation, and tap_bip32_derivation
|
|
1022
|
+
* for each input.
|
|
1023
|
+
* @returns {any}
|
|
1024
|
+
*/
|
|
1025
|
+
get_inputs() {
|
|
1026
|
+
try {
|
|
1027
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1028
|
+
wasm.bitgopsbt_get_inputs(retptr, this.__wbg_ptr);
|
|
1029
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1030
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1031
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1032
|
+
if (r2) {
|
|
1033
|
+
throw takeObject(r1);
|
|
1034
|
+
}
|
|
1035
|
+
return takeObject(r0);
|
|
1036
|
+
} finally {
|
|
1037
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1038
|
+
}
|
|
1039
|
+
}
|
|
1018
1040
|
/**
|
|
1019
1041
|
* Get the network type for transaction extraction
|
|
1020
1042
|
*
|
|
@@ -1038,6 +1060,58 @@ class BitGoPsbt {
|
|
|
1038
1060
|
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
1039
1061
|
}
|
|
1040
1062
|
}
|
|
1063
|
+
/**
|
|
1064
|
+
* Get all PSBT outputs as an array of PsbtOutputData
|
|
1065
|
+
*
|
|
1066
|
+
* Returns an array with script, value, bip32_derivation, and tap_bip32_derivation
|
|
1067
|
+
* for each output.
|
|
1068
|
+
* @returns {any}
|
|
1069
|
+
*/
|
|
1070
|
+
get_outputs() {
|
|
1071
|
+
try {
|
|
1072
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1073
|
+
wasm.bitgopsbt_get_outputs(retptr, this.__wbg_ptr);
|
|
1074
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1075
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1076
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1077
|
+
if (r2) {
|
|
1078
|
+
throw takeObject(r1);
|
|
1079
|
+
}
|
|
1080
|
+
return takeObject(r0);
|
|
1081
|
+
} finally {
|
|
1082
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1083
|
+
}
|
|
1084
|
+
}
|
|
1085
|
+
/**
|
|
1086
|
+
* Get all PSBT outputs with resolved address strings.
|
|
1087
|
+
*
|
|
1088
|
+
* Unlike the generic WrapPsbt which requires a coin parameter, BitGoPsbt
|
|
1089
|
+
* uses the network it was created/deserialized with to resolve addresses.
|
|
1090
|
+
* @returns {any}
|
|
1091
|
+
*/
|
|
1092
|
+
get_outputs_with_address() {
|
|
1093
|
+
try {
|
|
1094
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1095
|
+
wasm.bitgopsbt_get_outputs_with_address(retptr, this.__wbg_ptr);
|
|
1096
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1097
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1098
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1099
|
+
if (r2) {
|
|
1100
|
+
throw takeObject(r1);
|
|
1101
|
+
}
|
|
1102
|
+
return takeObject(r0);
|
|
1103
|
+
} finally {
|
|
1104
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1105
|
+
}
|
|
1106
|
+
}
|
|
1107
|
+
/**
|
|
1108
|
+
* Get the number of inputs in the PSBT
|
|
1109
|
+
* @returns {number}
|
|
1110
|
+
*/
|
|
1111
|
+
input_count() {
|
|
1112
|
+
const ret = wasm.bitgopsbt_input_count(this.__wbg_ptr);
|
|
1113
|
+
return ret >>> 0;
|
|
1114
|
+
}
|
|
1041
1115
|
/**
|
|
1042
1116
|
* Check if an input is a MuSig2 keypath input.
|
|
1043
1117
|
*
|
|
@@ -1085,6 +1159,14 @@ class BitGoPsbt {
|
|
|
1085
1159
|
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
1086
1160
|
}
|
|
1087
1161
|
}
|
|
1162
|
+
/**
|
|
1163
|
+
* Get the number of outputs in the PSBT
|
|
1164
|
+
* @returns {number}
|
|
1165
|
+
*/
|
|
1166
|
+
output_count() {
|
|
1167
|
+
const ret = wasm.bitgopsbt_output_count(this.__wbg_ptr);
|
|
1168
|
+
return ret >>> 0;
|
|
1169
|
+
}
|
|
1088
1170
|
/**
|
|
1089
1171
|
* Parse outputs with wallet keys to identify which outputs belong to a wallet
|
|
1090
1172
|
*
|
|
Binary file
|