@bitgo/wasm-utxo 1.41.0 → 1.43.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 +15 -6
- package/dist/cjs/js/fixedScriptWallet/BitGoPsbt.js +12 -10
- package/dist/cjs/js/fixedScriptWallet/index.d.ts +8 -1
- package/dist/cjs/js/fixedScriptWallet/index.js +10 -0
- package/dist/cjs/js/transaction.d.ts +19 -0
- package/dist/cjs/js/transaction.js +25 -0
- package/dist/cjs/js/wasm/wasm_utxo.d.ts +38 -1
- package/dist/cjs/js/wasm/wasm_utxo.js +95 -2
- package/dist/cjs/js/wasm/wasm_utxo_bg.wasm +0 -0
- package/dist/cjs/js/wasm/wasm_utxo_bg.wasm.d.ts +33 -29
- package/dist/esm/js/fixedScriptWallet/BitGoPsbt.d.ts +15 -6
- package/dist/esm/js/fixedScriptWallet/BitGoPsbt.js +12 -10
- package/dist/esm/js/fixedScriptWallet/index.d.ts +8 -1
- package/dist/esm/js/fixedScriptWallet/index.js +9 -0
- package/dist/esm/js/transaction.d.ts +19 -0
- package/dist/esm/js/transaction.js +25 -0
- package/dist/esm/js/wasm/wasm_utxo.d.ts +38 -1
- package/dist/esm/js/wasm/wasm_utxo_bg.js +95 -2
- package/dist/esm/js/wasm/wasm_utxo_bg.wasm +0 -0
- package/dist/esm/js/wasm/wasm_utxo_bg.wasm.d.ts +33 -29
- package/package.json +2 -2
|
@@ -91,6 +91,13 @@ export type AddWalletOutputOptions = {
|
|
|
91
91
|
/** Value in satoshis */
|
|
92
92
|
value: bigint;
|
|
93
93
|
};
|
|
94
|
+
export type ParseTransactionOptions = {
|
|
95
|
+
replayProtection: ReplayProtectionArg;
|
|
96
|
+
payGoPubkeys?: ECPairArg[];
|
|
97
|
+
};
|
|
98
|
+
export type ParseOutputsOptions = {
|
|
99
|
+
payGoPubkeys?: ECPairArg[];
|
|
100
|
+
};
|
|
94
101
|
export declare class BitGoPsbt implements IPsbtIntrospectionWithAddress {
|
|
95
102
|
protected _wasm: WasmBitGoPsbt;
|
|
96
103
|
protected constructor(_wasm: WasmBitGoPsbt);
|
|
@@ -306,11 +313,12 @@ export declare class BitGoPsbt implements IPsbtIntrospectionWithAddress {
|
|
|
306
313
|
/**
|
|
307
314
|
* Parse transaction with wallet keys to identify wallet inputs/outputs
|
|
308
315
|
* @param walletKeys - The wallet keys to use for identification
|
|
309
|
-
* @param
|
|
310
|
-
* @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
|
|
311
319
|
* @returns Parsed transaction information
|
|
312
320
|
*/
|
|
313
|
-
parseTransactionWithWalletKeys(walletKeys: WalletKeysArg,
|
|
321
|
+
parseTransactionWithWalletKeys(walletKeys: WalletKeysArg, options: ParseTransactionOptions): ParsedTransaction;
|
|
314
322
|
/**
|
|
315
323
|
* Parse outputs with wallet keys to identify which outputs belong to a wallet
|
|
316
324
|
* with the given wallet keys.
|
|
@@ -319,11 +327,12 @@ export declare class BitGoPsbt implements IPsbtIntrospectionWithAddress {
|
|
|
319
327
|
* wallet than the inputs.
|
|
320
328
|
*
|
|
321
329
|
* @param walletKeys - The wallet keys to use for identification
|
|
322
|
-
* @param
|
|
330
|
+
* @param options - Optional options for parsing
|
|
331
|
+
* @param options.payGoPubkeys - Optional public keys for PayGo attestation verification
|
|
323
332
|
* @returns Array of parsed outputs
|
|
324
333
|
* @note This method does NOT validate wallet inputs. It only parses outputs.
|
|
325
334
|
*/
|
|
326
|
-
parseOutputsWithWalletKeys(walletKeys: WalletKeysArg,
|
|
335
|
+
parseOutputsWithWalletKeys(walletKeys: WalletKeysArg, options?: ParseOutputsOptions): ParsedOutput[];
|
|
327
336
|
/**
|
|
328
337
|
* Add a PayGo attestation to a PSBT output
|
|
329
338
|
*
|
|
@@ -503,7 +512,7 @@ export declare class BitGoPsbt implements IPsbtIntrospectionWithAddress {
|
|
|
503
512
|
* const counterpartyPsbt = BitGoPsbt.fromBytes(counterpartyPsbtBytes, network);
|
|
504
513
|
* psbt.combineMusig2Nonces(counterpartyPsbt);
|
|
505
514
|
* // Sign MuSig2 key path inputs
|
|
506
|
-
* const parsed = psbt.parseTransactionWithWalletKeys(walletKeys, replayProtection);
|
|
515
|
+
* const parsed = psbt.parseTransactionWithWalletKeys(walletKeys, { replayProtection });
|
|
507
516
|
* for (let i = 0; i < parsed.inputs.length; i++) {
|
|
508
517
|
* if (parsed.inputs[i].scriptType === "p2trMusig2KeyPath") {
|
|
509
518
|
* psbt.sign(i, userXpriv);
|
|
@@ -195,7 +195,7 @@ class BitGoPsbt {
|
|
|
195
195
|
*/
|
|
196
196
|
addReplayProtectionInput(inputOptions, key) {
|
|
197
197
|
const ecpair = ecpair_js_1.ECPair.from(key);
|
|
198
|
-
return this._wasm.add_replay_protection_input(ecpair.wasm, inputOptions.txid, inputOptions.vout, inputOptions.value, inputOptions.sequence);
|
|
198
|
+
return this._wasm.add_replay_protection_input(ecpair.wasm, inputOptions.txid, inputOptions.vout, inputOptions.value, inputOptions.sequence, inputOptions.prevTx);
|
|
199
199
|
}
|
|
200
200
|
/**
|
|
201
201
|
* Get the unsigned transaction ID
|
|
@@ -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);
|
|
@@ -5,7 +5,7 @@ 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
10
|
export type { PsbtBip32Derivation, PsbtInputData, PsbtOutputData, PsbtOutputDataWithAddress, PsbtWitnessUtxo, } from "../wasm/wasm_utxo.js";
|
|
11
11
|
import type { ScriptType } from "./scriptType.js";
|
|
@@ -52,3 +52,10 @@ export declare function supportsScriptType(coin: CoinName, scriptType: ScriptTyp
|
|
|
52
52
|
* ```
|
|
53
53
|
*/
|
|
54
54
|
export declare function createOpReturnScript(data?: Uint8Array): Uint8Array;
|
|
55
|
+
/**
|
|
56
|
+
* Get the P2SH-P2PK output script for a compressed public key
|
|
57
|
+
*
|
|
58
|
+
* @param pubkey - The compressed public key bytes (33 bytes)
|
|
59
|
+
* @returns The P2SH-P2PK output script as a Uint8Array
|
|
60
|
+
*/
|
|
61
|
+
export declare function p2shP2pkOutputScript(pubkey: Uint8Array): Uint8Array;
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ZcashBitGoPsbt = exports.BitGoPsbt = exports.assertChainCode = exports.chainCodes = exports.ChainCode = exports.inputScriptTypes = exports.outputScriptTypes = exports.Dimensions = exports.address = exports.outputScript = exports.ReplayProtection = exports.RootWalletKeys = void 0;
|
|
4
4
|
exports.supportsScriptType = supportsScriptType;
|
|
5
5
|
exports.createOpReturnScript = createOpReturnScript;
|
|
6
|
+
exports.p2shP2pkOutputScript = p2shP2pkOutputScript;
|
|
6
7
|
const wasm_utxo_js_1 = require("../wasm/wasm_utxo.js");
|
|
7
8
|
var RootWalletKeys_js_1 = require("./RootWalletKeys.js");
|
|
8
9
|
Object.defineProperty(exports, "RootWalletKeys", { enumerable: true, get: function () { return RootWalletKeys_js_1.RootWalletKeys; } });
|
|
@@ -73,3 +74,12 @@ function supportsScriptType(coin, scriptType) {
|
|
|
73
74
|
function createOpReturnScript(data) {
|
|
74
75
|
return wasm_utxo_js_1.FixedScriptWalletNamespace.create_op_return_script(data);
|
|
75
76
|
}
|
|
77
|
+
/**
|
|
78
|
+
* Get the P2SH-P2PK output script for a compressed public key
|
|
79
|
+
*
|
|
80
|
+
* @param pubkey - The compressed public key bytes (33 bytes)
|
|
81
|
+
* @returns The P2SH-P2PK output script as a Uint8Array
|
|
82
|
+
*/
|
|
83
|
+
function p2shP2pkOutputScript(pubkey) {
|
|
84
|
+
return wasm_utxo_js_1.FixedScriptWalletNamespace.p2sh_p2pk_output_script(pubkey);
|
|
85
|
+
}
|
|
@@ -14,11 +14,30 @@ export interface ITransaction {
|
|
|
14
14
|
export declare class Transaction implements ITransaction {
|
|
15
15
|
private _wasm;
|
|
16
16
|
private constructor();
|
|
17
|
+
/**
|
|
18
|
+
* Create an empty transaction (version 1, locktime 0)
|
|
19
|
+
*/
|
|
20
|
+
static create(): Transaction;
|
|
17
21
|
static fromBytes(bytes: Uint8Array): Transaction;
|
|
18
22
|
/**
|
|
19
23
|
* @internal Create from WASM instance directly (avoids re-parsing bytes)
|
|
20
24
|
*/
|
|
21
25
|
static fromWasm(wasm: WasmTransaction): Transaction;
|
|
26
|
+
/**
|
|
27
|
+
* Add an input to the transaction
|
|
28
|
+
* @param txid - Previous transaction ID (hex string)
|
|
29
|
+
* @param vout - Output index being spent
|
|
30
|
+
* @param sequence - Optional sequence number (default: 0xFFFFFFFF)
|
|
31
|
+
* @returns The index of the newly added input
|
|
32
|
+
*/
|
|
33
|
+
addInput(txid: string, vout: number, sequence?: number): number;
|
|
34
|
+
/**
|
|
35
|
+
* Add an output to the transaction
|
|
36
|
+
* @param script - Output script (scriptPubKey)
|
|
37
|
+
* @param value - Value in satoshis
|
|
38
|
+
* @returns The index of the newly added output
|
|
39
|
+
*/
|
|
40
|
+
addOutput(script: Uint8Array, value: bigint): number;
|
|
22
41
|
toBytes(): Uint8Array;
|
|
23
42
|
/**
|
|
24
43
|
* Get the transaction ID (txid)
|
|
@@ -12,6 +12,12 @@ class Transaction {
|
|
|
12
12
|
constructor(_wasm) {
|
|
13
13
|
this._wasm = _wasm;
|
|
14
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* Create an empty transaction (version 1, locktime 0)
|
|
17
|
+
*/
|
|
18
|
+
static create() {
|
|
19
|
+
return new Transaction(wasm_utxo_js_1.WasmTransaction.create());
|
|
20
|
+
}
|
|
15
21
|
static fromBytes(bytes) {
|
|
16
22
|
return new Transaction(wasm_utxo_js_1.WasmTransaction.from_bytes(bytes));
|
|
17
23
|
}
|
|
@@ -21,6 +27,25 @@ class Transaction {
|
|
|
21
27
|
static fromWasm(wasm) {
|
|
22
28
|
return new Transaction(wasm);
|
|
23
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* Add an input to the transaction
|
|
32
|
+
* @param txid - Previous transaction ID (hex string)
|
|
33
|
+
* @param vout - Output index being spent
|
|
34
|
+
* @param sequence - Optional sequence number (default: 0xFFFFFFFF)
|
|
35
|
+
* @returns The index of the newly added input
|
|
36
|
+
*/
|
|
37
|
+
addInput(txid, vout, sequence) {
|
|
38
|
+
return this._wasm.add_input(txid, vout, sequence);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Add an output to the transaction
|
|
42
|
+
* @param script - Output script (scriptPubKey)
|
|
43
|
+
* @param value - Value in satoshis
|
|
44
|
+
* @returns The index of the newly added output
|
|
45
|
+
*/
|
|
46
|
+
addOutput(script, value) {
|
|
47
|
+
return this._wasm.add_output(script, value);
|
|
48
|
+
}
|
|
24
49
|
toBytes() {
|
|
25
50
|
return this._wasm.to_bytes();
|
|
26
51
|
}
|
|
@@ -181,7 +181,7 @@ export class BitGoPsbt {
|
|
|
181
181
|
* # Returns
|
|
182
182
|
* The index of the newly added input
|
|
183
183
|
*/
|
|
184
|
-
add_replay_protection_input(ecpair: WasmECPair, txid: string, vout: number, value: bigint, sequence?: number | null): number;
|
|
184
|
+
add_replay_protection_input(ecpair: WasmECPair, txid: string, vout: number, value: bigint, sequence?: number | null, prev_tx?: Uint8Array | null): number;
|
|
185
185
|
/**
|
|
186
186
|
* Add a wallet input with full PSBT metadata
|
|
187
187
|
*
|
|
@@ -756,6 +756,16 @@ export class FixedScriptWalletNamespace {
|
|
|
756
756
|
static create_op_return_script(data?: Uint8Array | null): Uint8Array;
|
|
757
757
|
static output_script(keys: WasmRootWalletKeys, chain: number, index: number, network: any): Uint8Array;
|
|
758
758
|
static output_script_with_network_str(keys: WasmRootWalletKeys, chain: number, index: number, network: string): Uint8Array;
|
|
759
|
+
/**
|
|
760
|
+
* Get the P2SH-P2PK output script for a compressed public key
|
|
761
|
+
*
|
|
762
|
+
* # Arguments
|
|
763
|
+
* * `pubkey` - The compressed public key bytes (33 bytes)
|
|
764
|
+
*
|
|
765
|
+
* # Returns
|
|
766
|
+
* The P2SH-P2PK output script as bytes
|
|
767
|
+
*/
|
|
768
|
+
static p2sh_p2pk_output_script(pubkey: Uint8Array): Uint8Array;
|
|
759
769
|
/**
|
|
760
770
|
* Check if a network supports a given fixed-script wallet script type
|
|
761
771
|
*
|
|
@@ -1220,6 +1230,33 @@ export class WasmTransaction {
|
|
|
1220
1230
|
private constructor();
|
|
1221
1231
|
free(): void;
|
|
1222
1232
|
[Symbol.dispose](): void;
|
|
1233
|
+
/**
|
|
1234
|
+
* Add an input to the transaction
|
|
1235
|
+
*
|
|
1236
|
+
* # Arguments
|
|
1237
|
+
* * `txid` - The transaction ID (hex string) of the output being spent
|
|
1238
|
+
* * `vout` - The output index being spent
|
|
1239
|
+
* * `sequence` - Optional sequence number (default: 0xFFFFFFFF)
|
|
1240
|
+
*
|
|
1241
|
+
* # Returns
|
|
1242
|
+
* The index of the newly added input
|
|
1243
|
+
*/
|
|
1244
|
+
add_input(txid: string, vout: number, sequence?: number | null): number;
|
|
1245
|
+
/**
|
|
1246
|
+
* Add an output to the transaction
|
|
1247
|
+
*
|
|
1248
|
+
* # Arguments
|
|
1249
|
+
* * `script` - The output script (scriptPubKey)
|
|
1250
|
+
* * `value` - The value in satoshis
|
|
1251
|
+
*
|
|
1252
|
+
* # Returns
|
|
1253
|
+
* The index of the newly added output
|
|
1254
|
+
*/
|
|
1255
|
+
add_output(script: Uint8Array, value: bigint): number;
|
|
1256
|
+
/**
|
|
1257
|
+
* Create an empty transaction (version 1, locktime 0)
|
|
1258
|
+
*/
|
|
1259
|
+
static create(): WasmTransaction;
|
|
1223
1260
|
/**
|
|
1224
1261
|
* Deserialize a transaction from bytes
|
|
1225
1262
|
*
|
|
@@ -521,15 +521,18 @@ class BitGoPsbt {
|
|
|
521
521
|
* @param {number} vout
|
|
522
522
|
* @param {bigint} value
|
|
523
523
|
* @param {number | null} [sequence]
|
|
524
|
+
* @param {Uint8Array | null} [prev_tx]
|
|
524
525
|
* @returns {number}
|
|
525
526
|
*/
|
|
526
|
-
add_replay_protection_input(ecpair, txid, vout, value, sequence) {
|
|
527
|
+
add_replay_protection_input(ecpair, txid, vout, value, sequence, prev_tx) {
|
|
527
528
|
try {
|
|
528
529
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
529
530
|
_assertClass(ecpair, WasmECPair);
|
|
530
531
|
const ptr0 = passStringToWasm0(txid, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
531
532
|
const len0 = WASM_VECTOR_LEN;
|
|
532
|
-
|
|
533
|
+
var ptr1 = isLikeNone(prev_tx) ? 0 : passArray8ToWasm0(prev_tx, wasm.__wbindgen_export);
|
|
534
|
+
var len1 = WASM_VECTOR_LEN;
|
|
535
|
+
wasm.bitgopsbt_add_replay_protection_input(retptr, this.__wbg_ptr, ecpair.__wbg_ptr, ptr0, len0, vout, value, isLikeNone(sequence) ? 0x100000001 : (sequence) >>> 0, ptr1, len1);
|
|
533
536
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
534
537
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
535
538
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -1950,6 +1953,37 @@ class FixedScriptWalletNamespace {
|
|
|
1950
1953
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1951
1954
|
}
|
|
1952
1955
|
}
|
|
1956
|
+
/**
|
|
1957
|
+
* Get the P2SH-P2PK output script for a compressed public key
|
|
1958
|
+
*
|
|
1959
|
+
* # Arguments
|
|
1960
|
+
* * `pubkey` - The compressed public key bytes (33 bytes)
|
|
1961
|
+
*
|
|
1962
|
+
* # Returns
|
|
1963
|
+
* The P2SH-P2PK output script as bytes
|
|
1964
|
+
* @param {Uint8Array} pubkey
|
|
1965
|
+
* @returns {Uint8Array}
|
|
1966
|
+
*/
|
|
1967
|
+
static p2sh_p2pk_output_script(pubkey) {
|
|
1968
|
+
try {
|
|
1969
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1970
|
+
const ptr0 = passArray8ToWasm0(pubkey, wasm.__wbindgen_export);
|
|
1971
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1972
|
+
wasm.fixedscriptwalletnamespace_p2sh_p2pk_output_script(retptr, ptr0, len0);
|
|
1973
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1974
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1975
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1976
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
1977
|
+
if (r3) {
|
|
1978
|
+
throw takeObject(r2);
|
|
1979
|
+
}
|
|
1980
|
+
var v2 = getArrayU8FromWasm0(r0, r1).slice();
|
|
1981
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
1982
|
+
return v2;
|
|
1983
|
+
} finally {
|
|
1984
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1985
|
+
}
|
|
1986
|
+
}
|
|
1953
1987
|
/**
|
|
1954
1988
|
* Check if a network supports a given fixed-script wallet script type
|
|
1955
1989
|
*
|
|
@@ -3478,6 +3512,65 @@ class WasmTransaction {
|
|
|
3478
3512
|
const ptr = this.__destroy_into_raw();
|
|
3479
3513
|
wasm.__wbg_wasmtransaction_free(ptr, 0);
|
|
3480
3514
|
}
|
|
3515
|
+
/**
|
|
3516
|
+
* Add an input to the transaction
|
|
3517
|
+
*
|
|
3518
|
+
* # Arguments
|
|
3519
|
+
* * `txid` - The transaction ID (hex string) of the output being spent
|
|
3520
|
+
* * `vout` - The output index being spent
|
|
3521
|
+
* * `sequence` - Optional sequence number (default: 0xFFFFFFFF)
|
|
3522
|
+
*
|
|
3523
|
+
* # Returns
|
|
3524
|
+
* The index of the newly added input
|
|
3525
|
+
* @param {string} txid
|
|
3526
|
+
* @param {number} vout
|
|
3527
|
+
* @param {number | null} [sequence]
|
|
3528
|
+
* @returns {number}
|
|
3529
|
+
*/
|
|
3530
|
+
add_input(txid, vout, sequence) {
|
|
3531
|
+
try {
|
|
3532
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
3533
|
+
const ptr0 = passStringToWasm0(txid, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
3534
|
+
const len0 = WASM_VECTOR_LEN;
|
|
3535
|
+
wasm.wasmtransaction_add_input(retptr, this.__wbg_ptr, ptr0, len0, vout, isLikeNone(sequence) ? 0x100000001 : (sequence) >>> 0);
|
|
3536
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
3537
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
3538
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
3539
|
+
if (r2) {
|
|
3540
|
+
throw takeObject(r1);
|
|
3541
|
+
}
|
|
3542
|
+
return r0 >>> 0;
|
|
3543
|
+
} finally {
|
|
3544
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
3545
|
+
}
|
|
3546
|
+
}
|
|
3547
|
+
/**
|
|
3548
|
+
* Add an output to the transaction
|
|
3549
|
+
*
|
|
3550
|
+
* # Arguments
|
|
3551
|
+
* * `script` - The output script (scriptPubKey)
|
|
3552
|
+
* * `value` - The value in satoshis
|
|
3553
|
+
*
|
|
3554
|
+
* # Returns
|
|
3555
|
+
* The index of the newly added output
|
|
3556
|
+
* @param {Uint8Array} script
|
|
3557
|
+
* @param {bigint} value
|
|
3558
|
+
* @returns {number}
|
|
3559
|
+
*/
|
|
3560
|
+
add_output(script, value) {
|
|
3561
|
+
const ptr0 = passArray8ToWasm0(script, wasm.__wbindgen_export);
|
|
3562
|
+
const len0 = WASM_VECTOR_LEN;
|
|
3563
|
+
const ret = wasm.wasmtransaction_add_output(this.__wbg_ptr, ptr0, len0, value);
|
|
3564
|
+
return ret >>> 0;
|
|
3565
|
+
}
|
|
3566
|
+
/**
|
|
3567
|
+
* Create an empty transaction (version 1, locktime 0)
|
|
3568
|
+
* @returns {WasmTransaction}
|
|
3569
|
+
*/
|
|
3570
|
+
static create() {
|
|
3571
|
+
const ret = wasm.wasmtransaction_create();
|
|
3572
|
+
return WasmTransaction.__wrap(ret);
|
|
3573
|
+
}
|
|
3481
3574
|
/**
|
|
3482
3575
|
* Deserialize a transaction from bytes
|
|
3483
3576
|
*
|
|
Binary file
|
|
@@ -1,34 +1,6 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
-
export const __wbg_utxolibcompatnamespace_free: (a: number, b: number) => void;
|
|
5
|
-
export const __wbg_wasmdimensions_free: (a: number, b: number) => void;
|
|
6
|
-
export const __wbg_wasmtransaction_free: (a: number, b: number) => void;
|
|
7
|
-
export const __wbg_wasmzcashtransaction_free: (a: number, b: number) => void;
|
|
8
|
-
export const utxolibcompatnamespace_from_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
9
|
-
export const utxolibcompatnamespace_to_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
10
|
-
export const wasmdimensions_empty: () => number;
|
|
11
|
-
export const wasmdimensions_from_input: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
12
|
-
export const wasmdimensions_from_input_script_type: (a: number, b: number, c: number, d: number) => void;
|
|
13
|
-
export const wasmdimensions_from_output_script_length: (a: number) => number;
|
|
14
|
-
export const wasmdimensions_from_output_script_type: (a: number, b: number, c: number) => void;
|
|
15
|
-
export const wasmdimensions_from_psbt: (a: number, b: number) => void;
|
|
16
|
-
export const wasmdimensions_get_input_vsize: (a: number, b: number, c: number) => number;
|
|
17
|
-
export const wasmdimensions_get_input_weight: (a: number, b: number, c: number) => number;
|
|
18
|
-
export const wasmdimensions_get_output_vsize: (a: number) => number;
|
|
19
|
-
export const wasmdimensions_get_output_weight: (a: number) => number;
|
|
20
|
-
export const wasmdimensions_get_vsize: (a: number, b: number, c: number) => number;
|
|
21
|
-
export const wasmdimensions_get_weight: (a: number, b: number, c: number) => number;
|
|
22
|
-
export const wasmdimensions_has_segwit: (a: number) => number;
|
|
23
|
-
export const wasmdimensions_plus: (a: number, b: number) => number;
|
|
24
|
-
export const wasmdimensions_times: (a: number, b: number) => number;
|
|
25
|
-
export const wasmtransaction_from_bytes: (a: number, b: number, c: number) => void;
|
|
26
|
-
export const wasmtransaction_get_txid: (a: number, b: number) => void;
|
|
27
|
-
export const wasmtransaction_get_vsize: (a: number) => number;
|
|
28
|
-
export const wasmtransaction_to_bytes: (a: number, b: number) => void;
|
|
29
|
-
export const wasmzcashtransaction_from_bytes: (a: number, b: number, c: number) => void;
|
|
30
|
-
export const wasmzcashtransaction_get_txid: (a: number, b: number) => void;
|
|
31
|
-
export const wasmzcashtransaction_to_bytes: (a: number, b: number) => void;
|
|
32
4
|
export const __wbg_messagenamespace_free: (a: number, b: number) => void;
|
|
33
5
|
export const __wbg_wasmrootwalletkeys_free: (a: number, b: number) => void;
|
|
34
6
|
export const messagenamespace_sign_message: (a: number, b: number, c: number, d: number) => void;
|
|
@@ -54,7 +26,7 @@ export const bitgopsbt_add_input: (a: number, b: number, c: number, d: number, e
|
|
|
54
26
|
export const bitgopsbt_add_output: (a: number, b: number, c: number, d: number, e: bigint) => void;
|
|
55
27
|
export const bitgopsbt_add_output_with_address: (a: number, b: number, c: number, d: number, e: bigint) => void;
|
|
56
28
|
export const bitgopsbt_add_paygo_attestation: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
57
|
-
export const bitgopsbt_add_replay_protection_input: (a: number, b: number, c: number, d: number, e: number, f: number, g: bigint, h: number) => void;
|
|
29
|
+
export const bitgopsbt_add_replay_protection_input: (a: number, b: number, c: number, d: number, e: number, f: number, g: bigint, h: number, i: number, j: number) => void;
|
|
58
30
|
export const bitgopsbt_add_wallet_input: (a: number, b: number, c: number, d: number, e: number, f: bigint, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number) => void;
|
|
59
31
|
export const bitgopsbt_add_wallet_output: (a: number, b: number, c: number, d: number, e: bigint, f: number) => void;
|
|
60
32
|
export const bitgopsbt_combine_musig2_nonces: (a: number, b: number, c: number) => void;
|
|
@@ -102,6 +74,7 @@ export const fixedscriptwalletnamespace_chain_code_table: () => number;
|
|
|
102
74
|
export const fixedscriptwalletnamespace_create_op_return_script: (a: number, b: number, c: number) => void;
|
|
103
75
|
export const fixedscriptwalletnamespace_output_script: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
104
76
|
export const fixedscriptwalletnamespace_output_script_with_network_str: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
77
|
+
export const fixedscriptwalletnamespace_p2sh_p2pk_output_script: (a: number, b: number, c: number) => void;
|
|
105
78
|
export const fixedscriptwalletnamespace_supports_script_type: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
106
79
|
export const inscriptionsnamespace_create_inscription_reveal_data: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
107
80
|
export const inscriptionsnamespace_sign_reveal_transaction: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: bigint) => void;
|
|
@@ -137,6 +110,37 @@ export const wasmbip32_from_bip32_properties: (a: number, b: number) => void;
|
|
|
137
110
|
export const bitgopsbt_sign_wallet_input: (a: number, b: number, c: number, d: number) => void;
|
|
138
111
|
export const bitgopsbt_sign_all_with_xpriv: (a: number, b: number, c: number) => void;
|
|
139
112
|
export const bitgopsbt_sign_replay_protection_inputs: (a: number, b: number, c: number) => void;
|
|
113
|
+
export const __wbg_utxolibcompatnamespace_free: (a: number, b: number) => void;
|
|
114
|
+
export const __wbg_wasmdimensions_free: (a: number, b: number) => void;
|
|
115
|
+
export const __wbg_wasmtransaction_free: (a: number, b: number) => void;
|
|
116
|
+
export const __wbg_wasmzcashtransaction_free: (a: number, b: number) => void;
|
|
117
|
+
export const utxolibcompatnamespace_from_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
118
|
+
export const utxolibcompatnamespace_to_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
119
|
+
export const wasmdimensions_empty: () => number;
|
|
120
|
+
export const wasmdimensions_from_input: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
121
|
+
export const wasmdimensions_from_input_script_type: (a: number, b: number, c: number, d: number) => void;
|
|
122
|
+
export const wasmdimensions_from_output_script_length: (a: number) => number;
|
|
123
|
+
export const wasmdimensions_from_output_script_type: (a: number, b: number, c: number) => void;
|
|
124
|
+
export const wasmdimensions_from_psbt: (a: number, b: number) => void;
|
|
125
|
+
export const wasmdimensions_get_input_vsize: (a: number, b: number, c: number) => number;
|
|
126
|
+
export const wasmdimensions_get_input_weight: (a: number, b: number, c: number) => number;
|
|
127
|
+
export const wasmdimensions_get_output_vsize: (a: number) => number;
|
|
128
|
+
export const wasmdimensions_get_output_weight: (a: number) => number;
|
|
129
|
+
export const wasmdimensions_get_vsize: (a: number, b: number, c: number) => number;
|
|
130
|
+
export const wasmdimensions_get_weight: (a: number, b: number, c: number) => number;
|
|
131
|
+
export const wasmdimensions_has_segwit: (a: number) => number;
|
|
132
|
+
export const wasmdimensions_plus: (a: number, b: number) => number;
|
|
133
|
+
export const wasmdimensions_times: (a: number, b: number) => number;
|
|
134
|
+
export const wasmtransaction_add_input: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
135
|
+
export const wasmtransaction_add_output: (a: number, b: number, c: number, d: bigint) => number;
|
|
136
|
+
export const wasmtransaction_create: () => number;
|
|
137
|
+
export const wasmtransaction_from_bytes: (a: number, b: number, c: number) => void;
|
|
138
|
+
export const wasmtransaction_get_txid: (a: number, b: number) => void;
|
|
139
|
+
export const wasmtransaction_get_vsize: (a: number) => number;
|
|
140
|
+
export const wasmtransaction_to_bytes: (a: number, b: number) => void;
|
|
141
|
+
export const wasmzcashtransaction_from_bytes: (a: number, b: number, c: number) => void;
|
|
142
|
+
export const wasmzcashtransaction_get_txid: (a: number, b: number) => void;
|
|
143
|
+
export const wasmzcashtransaction_to_bytes: (a: number, b: number) => void;
|
|
140
144
|
export const __wbg_addressnamespace_free: (a: number, b: number) => void;
|
|
141
145
|
export const __wbg_wasmecpair_free: (a: number, b: number) => void;
|
|
142
146
|
export const __wbg_wrappsbt_free: (a: number, b: number) => void;
|
|
@@ -91,6 +91,13 @@ export type AddWalletOutputOptions = {
|
|
|
91
91
|
/** Value in satoshis */
|
|
92
92
|
value: bigint;
|
|
93
93
|
};
|
|
94
|
+
export type ParseTransactionOptions = {
|
|
95
|
+
replayProtection: ReplayProtectionArg;
|
|
96
|
+
payGoPubkeys?: ECPairArg[];
|
|
97
|
+
};
|
|
98
|
+
export type ParseOutputsOptions = {
|
|
99
|
+
payGoPubkeys?: ECPairArg[];
|
|
100
|
+
};
|
|
94
101
|
export declare class BitGoPsbt implements IPsbtIntrospectionWithAddress {
|
|
95
102
|
protected _wasm: WasmBitGoPsbt;
|
|
96
103
|
protected constructor(_wasm: WasmBitGoPsbt);
|
|
@@ -306,11 +313,12 @@ export declare class BitGoPsbt implements IPsbtIntrospectionWithAddress {
|
|
|
306
313
|
/**
|
|
307
314
|
* Parse transaction with wallet keys to identify wallet inputs/outputs
|
|
308
315
|
* @param walletKeys - The wallet keys to use for identification
|
|
309
|
-
* @param
|
|
310
|
-
* @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
|
|
311
319
|
* @returns Parsed transaction information
|
|
312
320
|
*/
|
|
313
|
-
parseTransactionWithWalletKeys(walletKeys: WalletKeysArg,
|
|
321
|
+
parseTransactionWithWalletKeys(walletKeys: WalletKeysArg, options: ParseTransactionOptions): ParsedTransaction;
|
|
314
322
|
/**
|
|
315
323
|
* Parse outputs with wallet keys to identify which outputs belong to a wallet
|
|
316
324
|
* with the given wallet keys.
|
|
@@ -319,11 +327,12 @@ export declare class BitGoPsbt implements IPsbtIntrospectionWithAddress {
|
|
|
319
327
|
* wallet than the inputs.
|
|
320
328
|
*
|
|
321
329
|
* @param walletKeys - The wallet keys to use for identification
|
|
322
|
-
* @param
|
|
330
|
+
* @param options - Optional options for parsing
|
|
331
|
+
* @param options.payGoPubkeys - Optional public keys for PayGo attestation verification
|
|
323
332
|
* @returns Array of parsed outputs
|
|
324
333
|
* @note This method does NOT validate wallet inputs. It only parses outputs.
|
|
325
334
|
*/
|
|
326
|
-
parseOutputsWithWalletKeys(walletKeys: WalletKeysArg,
|
|
335
|
+
parseOutputsWithWalletKeys(walletKeys: WalletKeysArg, options?: ParseOutputsOptions): ParsedOutput[];
|
|
327
336
|
/**
|
|
328
337
|
* Add a PayGo attestation to a PSBT output
|
|
329
338
|
*
|
|
@@ -503,7 +512,7 @@ export declare class BitGoPsbt implements IPsbtIntrospectionWithAddress {
|
|
|
503
512
|
* const counterpartyPsbt = BitGoPsbt.fromBytes(counterpartyPsbtBytes, network);
|
|
504
513
|
* psbt.combineMusig2Nonces(counterpartyPsbt);
|
|
505
514
|
* // Sign MuSig2 key path inputs
|
|
506
|
-
* const parsed = psbt.parseTransactionWithWalletKeys(walletKeys, replayProtection);
|
|
515
|
+
* const parsed = psbt.parseTransactionWithWalletKeys(walletKeys, { replayProtection });
|
|
507
516
|
* for (let i = 0; i < parsed.inputs.length; i++) {
|
|
508
517
|
* if (parsed.inputs[i].scriptType === "p2trMusig2KeyPath") {
|
|
509
518
|
* psbt.sign(i, userXpriv);
|
|
@@ -192,7 +192,7 @@ export class BitGoPsbt {
|
|
|
192
192
|
*/
|
|
193
193
|
addReplayProtectionInput(inputOptions, key) {
|
|
194
194
|
const ecpair = ECPair.from(key);
|
|
195
|
-
return this._wasm.add_replay_protection_input(ecpair.wasm, inputOptions.txid, inputOptions.vout, inputOptions.value, inputOptions.sequence);
|
|
195
|
+
return this._wasm.add_replay_protection_input(ecpair.wasm, inputOptions.txid, inputOptions.vout, inputOptions.value, inputOptions.sequence, inputOptions.prevTx);
|
|
196
196
|
}
|
|
197
197
|
/**
|
|
198
198
|
* Get the unsigned transaction ID
|
|
@@ -218,14 +218,15 @@ export class BitGoPsbt {
|
|
|
218
218
|
/**
|
|
219
219
|
* Parse transaction with wallet keys to identify wallet inputs/outputs
|
|
220
220
|
* @param walletKeys - The wallet keys to use for identification
|
|
221
|
-
* @param
|
|
222
|
-
* @param
|
|
221
|
+
* @param options - Options for parsing
|
|
222
|
+
* @param options.replayProtection - Scripts that are allowed as inputs without wallet validation
|
|
223
|
+
* @param options.payGoPubkeys - Optional public keys for PayGo attestation verification
|
|
223
224
|
* @returns Parsed transaction information
|
|
224
225
|
*/
|
|
225
|
-
parseTransactionWithWalletKeys(walletKeys,
|
|
226
|
+
parseTransactionWithWalletKeys(walletKeys, options) {
|
|
226
227
|
const keys = RootWalletKeys.from(walletKeys);
|
|
227
|
-
const rp = ReplayProtection.from(replayProtection, this._wasm.network());
|
|
228
|
-
const pubkeys = payGoPubkeys?.map((arg) => ECPair.from(arg).wasm);
|
|
228
|
+
const rp = ReplayProtection.from(options.replayProtection, this._wasm.network());
|
|
229
|
+
const pubkeys = options.payGoPubkeys?.map((arg) => ECPair.from(arg).wasm);
|
|
229
230
|
return this._wasm.parse_transaction_with_wallet_keys(keys.wasm, rp.wasm, pubkeys);
|
|
230
231
|
}
|
|
231
232
|
/**
|
|
@@ -236,13 +237,14 @@ export class BitGoPsbt {
|
|
|
236
237
|
* wallet than the inputs.
|
|
237
238
|
*
|
|
238
239
|
* @param walletKeys - The wallet keys to use for identification
|
|
239
|
-
* @param
|
|
240
|
+
* @param options - Optional options for parsing
|
|
241
|
+
* @param options.payGoPubkeys - Optional public keys for PayGo attestation verification
|
|
240
242
|
* @returns Array of parsed outputs
|
|
241
243
|
* @note This method does NOT validate wallet inputs. It only parses outputs.
|
|
242
244
|
*/
|
|
243
|
-
parseOutputsWithWalletKeys(walletKeys,
|
|
245
|
+
parseOutputsWithWalletKeys(walletKeys, options) {
|
|
244
246
|
const keys = RootWalletKeys.from(walletKeys);
|
|
245
|
-
const pubkeys = payGoPubkeys?.map((arg) => ECPair.from(arg).wasm);
|
|
247
|
+
const pubkeys = options?.payGoPubkeys?.map((arg) => ECPair.from(arg).wasm);
|
|
246
248
|
return this._wasm.parse_outputs_with_wallet_keys(keys.wasm, pubkeys);
|
|
247
249
|
}
|
|
248
250
|
/**
|
|
@@ -444,7 +446,7 @@ export class BitGoPsbt {
|
|
|
444
446
|
* const counterpartyPsbt = BitGoPsbt.fromBytes(counterpartyPsbtBytes, network);
|
|
445
447
|
* psbt.combineMusig2Nonces(counterpartyPsbt);
|
|
446
448
|
* // Sign MuSig2 key path inputs
|
|
447
|
-
* const parsed = psbt.parseTransactionWithWalletKeys(walletKeys, replayProtection);
|
|
449
|
+
* const parsed = psbt.parseTransactionWithWalletKeys(walletKeys, { replayProtection });
|
|
448
450
|
* for (let i = 0; i < parsed.inputs.length; i++) {
|
|
449
451
|
* if (parsed.inputs[i].scriptType === "p2trMusig2KeyPath") {
|
|
450
452
|
* psbt.sign(i, userXpriv);
|
|
@@ -5,7 +5,7 @@ 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
10
|
export type { PsbtBip32Derivation, PsbtInputData, PsbtOutputData, PsbtOutputDataWithAddress, PsbtWitnessUtxo, } from "../wasm/wasm_utxo.js";
|
|
11
11
|
import type { ScriptType } from "./scriptType.js";
|
|
@@ -52,3 +52,10 @@ export declare function supportsScriptType(coin: CoinName, scriptType: ScriptTyp
|
|
|
52
52
|
* ```
|
|
53
53
|
*/
|
|
54
54
|
export declare function createOpReturnScript(data?: Uint8Array): Uint8Array;
|
|
55
|
+
/**
|
|
56
|
+
* Get the P2SH-P2PK output script for a compressed public key
|
|
57
|
+
*
|
|
58
|
+
* @param pubkey - The compressed public key bytes (33 bytes)
|
|
59
|
+
* @returns The P2SH-P2PK output script as a Uint8Array
|
|
60
|
+
*/
|
|
61
|
+
export declare function p2shP2pkOutputScript(pubkey: Uint8Array): Uint8Array;
|
|
@@ -56,3 +56,12 @@ export function supportsScriptType(coin, scriptType) {
|
|
|
56
56
|
export function createOpReturnScript(data) {
|
|
57
57
|
return FixedScriptWalletNamespace.create_op_return_script(data);
|
|
58
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* Get the P2SH-P2PK output script for a compressed public key
|
|
61
|
+
*
|
|
62
|
+
* @param pubkey - The compressed public key bytes (33 bytes)
|
|
63
|
+
* @returns The P2SH-P2PK output script as a Uint8Array
|
|
64
|
+
*/
|
|
65
|
+
export function p2shP2pkOutputScript(pubkey) {
|
|
66
|
+
return FixedScriptWalletNamespace.p2sh_p2pk_output_script(pubkey);
|
|
67
|
+
}
|
|
@@ -14,11 +14,30 @@ export interface ITransaction {
|
|
|
14
14
|
export declare class Transaction implements ITransaction {
|
|
15
15
|
private _wasm;
|
|
16
16
|
private constructor();
|
|
17
|
+
/**
|
|
18
|
+
* Create an empty transaction (version 1, locktime 0)
|
|
19
|
+
*/
|
|
20
|
+
static create(): Transaction;
|
|
17
21
|
static fromBytes(bytes: Uint8Array): Transaction;
|
|
18
22
|
/**
|
|
19
23
|
* @internal Create from WASM instance directly (avoids re-parsing bytes)
|
|
20
24
|
*/
|
|
21
25
|
static fromWasm(wasm: WasmTransaction): Transaction;
|
|
26
|
+
/**
|
|
27
|
+
* Add an input to the transaction
|
|
28
|
+
* @param txid - Previous transaction ID (hex string)
|
|
29
|
+
* @param vout - Output index being spent
|
|
30
|
+
* @param sequence - Optional sequence number (default: 0xFFFFFFFF)
|
|
31
|
+
* @returns The index of the newly added input
|
|
32
|
+
*/
|
|
33
|
+
addInput(txid: string, vout: number, sequence?: number): number;
|
|
34
|
+
/**
|
|
35
|
+
* Add an output to the transaction
|
|
36
|
+
* @param script - Output script (scriptPubKey)
|
|
37
|
+
* @param value - Value in satoshis
|
|
38
|
+
* @returns The index of the newly added output
|
|
39
|
+
*/
|
|
40
|
+
addOutput(script: Uint8Array, value: bigint): number;
|
|
22
41
|
toBytes(): Uint8Array;
|
|
23
42
|
/**
|
|
24
43
|
* Get the transaction ID (txid)
|
|
@@ -9,6 +9,12 @@ export class Transaction {
|
|
|
9
9
|
constructor(_wasm) {
|
|
10
10
|
this._wasm = _wasm;
|
|
11
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* Create an empty transaction (version 1, locktime 0)
|
|
14
|
+
*/
|
|
15
|
+
static create() {
|
|
16
|
+
return new Transaction(WasmTransaction.create());
|
|
17
|
+
}
|
|
12
18
|
static fromBytes(bytes) {
|
|
13
19
|
return new Transaction(WasmTransaction.from_bytes(bytes));
|
|
14
20
|
}
|
|
@@ -18,6 +24,25 @@ export class Transaction {
|
|
|
18
24
|
static fromWasm(wasm) {
|
|
19
25
|
return new Transaction(wasm);
|
|
20
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* Add an input to the transaction
|
|
29
|
+
* @param txid - Previous transaction ID (hex string)
|
|
30
|
+
* @param vout - Output index being spent
|
|
31
|
+
* @param sequence - Optional sequence number (default: 0xFFFFFFFF)
|
|
32
|
+
* @returns The index of the newly added input
|
|
33
|
+
*/
|
|
34
|
+
addInput(txid, vout, sequence) {
|
|
35
|
+
return this._wasm.add_input(txid, vout, sequence);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Add an output to the transaction
|
|
39
|
+
* @param script - Output script (scriptPubKey)
|
|
40
|
+
* @param value - Value in satoshis
|
|
41
|
+
* @returns The index of the newly added output
|
|
42
|
+
*/
|
|
43
|
+
addOutput(script, value) {
|
|
44
|
+
return this._wasm.add_output(script, value);
|
|
45
|
+
}
|
|
21
46
|
toBytes() {
|
|
22
47
|
return this._wasm.to_bytes();
|
|
23
48
|
}
|
|
@@ -181,7 +181,7 @@ export class BitGoPsbt {
|
|
|
181
181
|
* # Returns
|
|
182
182
|
* The index of the newly added input
|
|
183
183
|
*/
|
|
184
|
-
add_replay_protection_input(ecpair: WasmECPair, txid: string, vout: number, value: bigint, sequence?: number | null): number;
|
|
184
|
+
add_replay_protection_input(ecpair: WasmECPair, txid: string, vout: number, value: bigint, sequence?: number | null, prev_tx?: Uint8Array | null): number;
|
|
185
185
|
/**
|
|
186
186
|
* Add a wallet input with full PSBT metadata
|
|
187
187
|
*
|
|
@@ -756,6 +756,16 @@ export class FixedScriptWalletNamespace {
|
|
|
756
756
|
static create_op_return_script(data?: Uint8Array | null): Uint8Array;
|
|
757
757
|
static output_script(keys: WasmRootWalletKeys, chain: number, index: number, network: any): Uint8Array;
|
|
758
758
|
static output_script_with_network_str(keys: WasmRootWalletKeys, chain: number, index: number, network: string): Uint8Array;
|
|
759
|
+
/**
|
|
760
|
+
* Get the P2SH-P2PK output script for a compressed public key
|
|
761
|
+
*
|
|
762
|
+
* # Arguments
|
|
763
|
+
* * `pubkey` - The compressed public key bytes (33 bytes)
|
|
764
|
+
*
|
|
765
|
+
* # Returns
|
|
766
|
+
* The P2SH-P2PK output script as bytes
|
|
767
|
+
*/
|
|
768
|
+
static p2sh_p2pk_output_script(pubkey: Uint8Array): Uint8Array;
|
|
759
769
|
/**
|
|
760
770
|
* Check if a network supports a given fixed-script wallet script type
|
|
761
771
|
*
|
|
@@ -1220,6 +1230,33 @@ export class WasmTransaction {
|
|
|
1220
1230
|
private constructor();
|
|
1221
1231
|
free(): void;
|
|
1222
1232
|
[Symbol.dispose](): void;
|
|
1233
|
+
/**
|
|
1234
|
+
* Add an input to the transaction
|
|
1235
|
+
*
|
|
1236
|
+
* # Arguments
|
|
1237
|
+
* * `txid` - The transaction ID (hex string) of the output being spent
|
|
1238
|
+
* * `vout` - The output index being spent
|
|
1239
|
+
* * `sequence` - Optional sequence number (default: 0xFFFFFFFF)
|
|
1240
|
+
*
|
|
1241
|
+
* # Returns
|
|
1242
|
+
* The index of the newly added input
|
|
1243
|
+
*/
|
|
1244
|
+
add_input(txid: string, vout: number, sequence?: number | null): number;
|
|
1245
|
+
/**
|
|
1246
|
+
* Add an output to the transaction
|
|
1247
|
+
*
|
|
1248
|
+
* # Arguments
|
|
1249
|
+
* * `script` - The output script (scriptPubKey)
|
|
1250
|
+
* * `value` - The value in satoshis
|
|
1251
|
+
*
|
|
1252
|
+
* # Returns
|
|
1253
|
+
* The index of the newly added output
|
|
1254
|
+
*/
|
|
1255
|
+
add_output(script: Uint8Array, value: bigint): number;
|
|
1256
|
+
/**
|
|
1257
|
+
* Create an empty transaction (version 1, locktime 0)
|
|
1258
|
+
*/
|
|
1259
|
+
static create(): WasmTransaction;
|
|
1223
1260
|
/**
|
|
1224
1261
|
* Deserialize a transaction from bytes
|
|
1225
1262
|
*
|
|
@@ -517,15 +517,18 @@ export class BitGoPsbt {
|
|
|
517
517
|
* @param {number} vout
|
|
518
518
|
* @param {bigint} value
|
|
519
519
|
* @param {number | null} [sequence]
|
|
520
|
+
* @param {Uint8Array | null} [prev_tx]
|
|
520
521
|
* @returns {number}
|
|
521
522
|
*/
|
|
522
|
-
add_replay_protection_input(ecpair, txid, vout, value, sequence) {
|
|
523
|
+
add_replay_protection_input(ecpair, txid, vout, value, sequence, prev_tx) {
|
|
523
524
|
try {
|
|
524
525
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
525
526
|
_assertClass(ecpair, WasmECPair);
|
|
526
527
|
const ptr0 = passStringToWasm0(txid, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
527
528
|
const len0 = WASM_VECTOR_LEN;
|
|
528
|
-
|
|
529
|
+
var ptr1 = isLikeNone(prev_tx) ? 0 : passArray8ToWasm0(prev_tx, wasm.__wbindgen_export);
|
|
530
|
+
var len1 = WASM_VECTOR_LEN;
|
|
531
|
+
wasm.bitgopsbt_add_replay_protection_input(retptr, this.__wbg_ptr, ecpair.__wbg_ptr, ptr0, len0, vout, value, isLikeNone(sequence) ? 0x100000001 : (sequence) >>> 0, ptr1, len1);
|
|
529
532
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
530
533
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
531
534
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -1945,6 +1948,37 @@ export class FixedScriptWalletNamespace {
|
|
|
1945
1948
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1946
1949
|
}
|
|
1947
1950
|
}
|
|
1951
|
+
/**
|
|
1952
|
+
* Get the P2SH-P2PK output script for a compressed public key
|
|
1953
|
+
*
|
|
1954
|
+
* # Arguments
|
|
1955
|
+
* * `pubkey` - The compressed public key bytes (33 bytes)
|
|
1956
|
+
*
|
|
1957
|
+
* # Returns
|
|
1958
|
+
* The P2SH-P2PK output script as bytes
|
|
1959
|
+
* @param {Uint8Array} pubkey
|
|
1960
|
+
* @returns {Uint8Array}
|
|
1961
|
+
*/
|
|
1962
|
+
static p2sh_p2pk_output_script(pubkey) {
|
|
1963
|
+
try {
|
|
1964
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1965
|
+
const ptr0 = passArray8ToWasm0(pubkey, wasm.__wbindgen_export);
|
|
1966
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1967
|
+
wasm.fixedscriptwalletnamespace_p2sh_p2pk_output_script(retptr, ptr0, len0);
|
|
1968
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1969
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1970
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1971
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
1972
|
+
if (r3) {
|
|
1973
|
+
throw takeObject(r2);
|
|
1974
|
+
}
|
|
1975
|
+
var v2 = getArrayU8FromWasm0(r0, r1).slice();
|
|
1976
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
1977
|
+
return v2;
|
|
1978
|
+
} finally {
|
|
1979
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1980
|
+
}
|
|
1981
|
+
}
|
|
1948
1982
|
/**
|
|
1949
1983
|
* Check if a network supports a given fixed-script wallet script type
|
|
1950
1984
|
*
|
|
@@ -3463,6 +3497,65 @@ export class WasmTransaction {
|
|
|
3463
3497
|
const ptr = this.__destroy_into_raw();
|
|
3464
3498
|
wasm.__wbg_wasmtransaction_free(ptr, 0);
|
|
3465
3499
|
}
|
|
3500
|
+
/**
|
|
3501
|
+
* Add an input to the transaction
|
|
3502
|
+
*
|
|
3503
|
+
* # Arguments
|
|
3504
|
+
* * `txid` - The transaction ID (hex string) of the output being spent
|
|
3505
|
+
* * `vout` - The output index being spent
|
|
3506
|
+
* * `sequence` - Optional sequence number (default: 0xFFFFFFFF)
|
|
3507
|
+
*
|
|
3508
|
+
* # Returns
|
|
3509
|
+
* The index of the newly added input
|
|
3510
|
+
* @param {string} txid
|
|
3511
|
+
* @param {number} vout
|
|
3512
|
+
* @param {number | null} [sequence]
|
|
3513
|
+
* @returns {number}
|
|
3514
|
+
*/
|
|
3515
|
+
add_input(txid, vout, sequence) {
|
|
3516
|
+
try {
|
|
3517
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
3518
|
+
const ptr0 = passStringToWasm0(txid, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
3519
|
+
const len0 = WASM_VECTOR_LEN;
|
|
3520
|
+
wasm.wasmtransaction_add_input(retptr, this.__wbg_ptr, ptr0, len0, vout, isLikeNone(sequence) ? 0x100000001 : (sequence) >>> 0);
|
|
3521
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
3522
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
3523
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
3524
|
+
if (r2) {
|
|
3525
|
+
throw takeObject(r1);
|
|
3526
|
+
}
|
|
3527
|
+
return r0 >>> 0;
|
|
3528
|
+
} finally {
|
|
3529
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
3530
|
+
}
|
|
3531
|
+
}
|
|
3532
|
+
/**
|
|
3533
|
+
* Add an output to the transaction
|
|
3534
|
+
*
|
|
3535
|
+
* # Arguments
|
|
3536
|
+
* * `script` - The output script (scriptPubKey)
|
|
3537
|
+
* * `value` - The value in satoshis
|
|
3538
|
+
*
|
|
3539
|
+
* # Returns
|
|
3540
|
+
* The index of the newly added output
|
|
3541
|
+
* @param {Uint8Array} script
|
|
3542
|
+
* @param {bigint} value
|
|
3543
|
+
* @returns {number}
|
|
3544
|
+
*/
|
|
3545
|
+
add_output(script, value) {
|
|
3546
|
+
const ptr0 = passArray8ToWasm0(script, wasm.__wbindgen_export);
|
|
3547
|
+
const len0 = WASM_VECTOR_LEN;
|
|
3548
|
+
const ret = wasm.wasmtransaction_add_output(this.__wbg_ptr, ptr0, len0, value);
|
|
3549
|
+
return ret >>> 0;
|
|
3550
|
+
}
|
|
3551
|
+
/**
|
|
3552
|
+
* Create an empty transaction (version 1, locktime 0)
|
|
3553
|
+
* @returns {WasmTransaction}
|
|
3554
|
+
*/
|
|
3555
|
+
static create() {
|
|
3556
|
+
const ret = wasm.wasmtransaction_create();
|
|
3557
|
+
return WasmTransaction.__wrap(ret);
|
|
3558
|
+
}
|
|
3466
3559
|
/**
|
|
3467
3560
|
* Deserialize a transaction from bytes
|
|
3468
3561
|
*
|
|
Binary file
|
|
@@ -1,34 +1,6 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
-
export const __wbg_utxolibcompatnamespace_free: (a: number, b: number) => void;
|
|
5
|
-
export const __wbg_wasmdimensions_free: (a: number, b: number) => void;
|
|
6
|
-
export const __wbg_wasmtransaction_free: (a: number, b: number) => void;
|
|
7
|
-
export const __wbg_wasmzcashtransaction_free: (a: number, b: number) => void;
|
|
8
|
-
export const utxolibcompatnamespace_from_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
9
|
-
export const utxolibcompatnamespace_to_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
10
|
-
export const wasmdimensions_empty: () => number;
|
|
11
|
-
export const wasmdimensions_from_input: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
12
|
-
export const wasmdimensions_from_input_script_type: (a: number, b: number, c: number, d: number) => void;
|
|
13
|
-
export const wasmdimensions_from_output_script_length: (a: number) => number;
|
|
14
|
-
export const wasmdimensions_from_output_script_type: (a: number, b: number, c: number) => void;
|
|
15
|
-
export const wasmdimensions_from_psbt: (a: number, b: number) => void;
|
|
16
|
-
export const wasmdimensions_get_input_vsize: (a: number, b: number, c: number) => number;
|
|
17
|
-
export const wasmdimensions_get_input_weight: (a: number, b: number, c: number) => number;
|
|
18
|
-
export const wasmdimensions_get_output_vsize: (a: number) => number;
|
|
19
|
-
export const wasmdimensions_get_output_weight: (a: number) => number;
|
|
20
|
-
export const wasmdimensions_get_vsize: (a: number, b: number, c: number) => number;
|
|
21
|
-
export const wasmdimensions_get_weight: (a: number, b: number, c: number) => number;
|
|
22
|
-
export const wasmdimensions_has_segwit: (a: number) => number;
|
|
23
|
-
export const wasmdimensions_plus: (a: number, b: number) => number;
|
|
24
|
-
export const wasmdimensions_times: (a: number, b: number) => number;
|
|
25
|
-
export const wasmtransaction_from_bytes: (a: number, b: number, c: number) => void;
|
|
26
|
-
export const wasmtransaction_get_txid: (a: number, b: number) => void;
|
|
27
|
-
export const wasmtransaction_get_vsize: (a: number) => number;
|
|
28
|
-
export const wasmtransaction_to_bytes: (a: number, b: number) => void;
|
|
29
|
-
export const wasmzcashtransaction_from_bytes: (a: number, b: number, c: number) => void;
|
|
30
|
-
export const wasmzcashtransaction_get_txid: (a: number, b: number) => void;
|
|
31
|
-
export const wasmzcashtransaction_to_bytes: (a: number, b: number) => void;
|
|
32
4
|
export const __wbg_messagenamespace_free: (a: number, b: number) => void;
|
|
33
5
|
export const __wbg_wasmrootwalletkeys_free: (a: number, b: number) => void;
|
|
34
6
|
export const messagenamespace_sign_message: (a: number, b: number, c: number, d: number) => void;
|
|
@@ -54,7 +26,7 @@ export const bitgopsbt_add_input: (a: number, b: number, c: number, d: number, e
|
|
|
54
26
|
export const bitgopsbt_add_output: (a: number, b: number, c: number, d: number, e: bigint) => void;
|
|
55
27
|
export const bitgopsbt_add_output_with_address: (a: number, b: number, c: number, d: number, e: bigint) => void;
|
|
56
28
|
export const bitgopsbt_add_paygo_attestation: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
57
|
-
export const bitgopsbt_add_replay_protection_input: (a: number, b: number, c: number, d: number, e: number, f: number, g: bigint, h: number) => void;
|
|
29
|
+
export const bitgopsbt_add_replay_protection_input: (a: number, b: number, c: number, d: number, e: number, f: number, g: bigint, h: number, i: number, j: number) => void;
|
|
58
30
|
export const bitgopsbt_add_wallet_input: (a: number, b: number, c: number, d: number, e: number, f: bigint, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number) => void;
|
|
59
31
|
export const bitgopsbt_add_wallet_output: (a: number, b: number, c: number, d: number, e: bigint, f: number) => void;
|
|
60
32
|
export const bitgopsbt_combine_musig2_nonces: (a: number, b: number, c: number) => void;
|
|
@@ -102,6 +74,7 @@ export const fixedscriptwalletnamespace_chain_code_table: () => number;
|
|
|
102
74
|
export const fixedscriptwalletnamespace_create_op_return_script: (a: number, b: number, c: number) => void;
|
|
103
75
|
export const fixedscriptwalletnamespace_output_script: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
104
76
|
export const fixedscriptwalletnamespace_output_script_with_network_str: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
77
|
+
export const fixedscriptwalletnamespace_p2sh_p2pk_output_script: (a: number, b: number, c: number) => void;
|
|
105
78
|
export const fixedscriptwalletnamespace_supports_script_type: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
106
79
|
export const inscriptionsnamespace_create_inscription_reveal_data: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
107
80
|
export const inscriptionsnamespace_sign_reveal_transaction: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: bigint) => void;
|
|
@@ -137,6 +110,37 @@ export const wasmbip32_from_bip32_properties: (a: number, b: number) => void;
|
|
|
137
110
|
export const bitgopsbt_sign_wallet_input: (a: number, b: number, c: number, d: number) => void;
|
|
138
111
|
export const bitgopsbt_sign_all_with_xpriv: (a: number, b: number, c: number) => void;
|
|
139
112
|
export const bitgopsbt_sign_replay_protection_inputs: (a: number, b: number, c: number) => void;
|
|
113
|
+
export const __wbg_utxolibcompatnamespace_free: (a: number, b: number) => void;
|
|
114
|
+
export const __wbg_wasmdimensions_free: (a: number, b: number) => void;
|
|
115
|
+
export const __wbg_wasmtransaction_free: (a: number, b: number) => void;
|
|
116
|
+
export const __wbg_wasmzcashtransaction_free: (a: number, b: number) => void;
|
|
117
|
+
export const utxolibcompatnamespace_from_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
118
|
+
export const utxolibcompatnamespace_to_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
119
|
+
export const wasmdimensions_empty: () => number;
|
|
120
|
+
export const wasmdimensions_from_input: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
121
|
+
export const wasmdimensions_from_input_script_type: (a: number, b: number, c: number, d: number) => void;
|
|
122
|
+
export const wasmdimensions_from_output_script_length: (a: number) => number;
|
|
123
|
+
export const wasmdimensions_from_output_script_type: (a: number, b: number, c: number) => void;
|
|
124
|
+
export const wasmdimensions_from_psbt: (a: number, b: number) => void;
|
|
125
|
+
export const wasmdimensions_get_input_vsize: (a: number, b: number, c: number) => number;
|
|
126
|
+
export const wasmdimensions_get_input_weight: (a: number, b: number, c: number) => number;
|
|
127
|
+
export const wasmdimensions_get_output_vsize: (a: number) => number;
|
|
128
|
+
export const wasmdimensions_get_output_weight: (a: number) => number;
|
|
129
|
+
export const wasmdimensions_get_vsize: (a: number, b: number, c: number) => number;
|
|
130
|
+
export const wasmdimensions_get_weight: (a: number, b: number, c: number) => number;
|
|
131
|
+
export const wasmdimensions_has_segwit: (a: number) => number;
|
|
132
|
+
export const wasmdimensions_plus: (a: number, b: number) => number;
|
|
133
|
+
export const wasmdimensions_times: (a: number, b: number) => number;
|
|
134
|
+
export const wasmtransaction_add_input: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
135
|
+
export const wasmtransaction_add_output: (a: number, b: number, c: number, d: bigint) => number;
|
|
136
|
+
export const wasmtransaction_create: () => number;
|
|
137
|
+
export const wasmtransaction_from_bytes: (a: number, b: number, c: number) => void;
|
|
138
|
+
export const wasmtransaction_get_txid: (a: number, b: number) => void;
|
|
139
|
+
export const wasmtransaction_get_vsize: (a: number) => number;
|
|
140
|
+
export const wasmtransaction_to_bytes: (a: number, b: number) => void;
|
|
141
|
+
export const wasmzcashtransaction_from_bytes: (a: number, b: number, c: number) => void;
|
|
142
|
+
export const wasmzcashtransaction_get_txid: (a: number, b: number) => void;
|
|
143
|
+
export const wasmzcashtransaction_to_bytes: (a: number, b: number) => void;
|
|
140
144
|
export const __wbg_addressnamespace_free: (a: number, b: number) => void;
|
|
141
145
|
export const __wbg_wasmecpair_free: (a: number, b: number) => void;
|
|
142
146
|
export const __wbg_wrappsbt_free: (a: number, b: number) => void;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bitgo/wasm-utxo",
|
|
3
3
|
"description": "WebAssembly wrapper for rust-bitcoin (beta)",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.43.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
],
|
|
45
45
|
"scripts": {
|
|
46
46
|
"test": "npm run test:mocha && npm run test:wasm-pack && npm run test:imports",
|
|
47
|
-
"test:mocha": "mocha --recursive test",
|
|
47
|
+
"test:mocha": "mocha --recursive 'test/**/*.ts'",
|
|
48
48
|
"test:benchmark": "mocha test/benchmark/signing.ts --timeout 600000",
|
|
49
49
|
"test:wasm-pack": "npm run test:wasm-pack-node && npm run test:wasm-pack-chrome",
|
|
50
50
|
"test:wasm-pack-node": "./scripts/wasm-pack-test.sh --node",
|