@bitgo/wasm-utxo 1.15.0 → 1.17.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/README.md +10 -1
- package/dist/cjs/js/fixedScriptWallet/BitGoPsbt.d.ts +5 -2
- package/dist/cjs/js/fixedScriptWallet/BitGoPsbt.js +2 -0
- package/dist/cjs/js/fixedScriptWallet/ZcashBitGoPsbt.d.ts +113 -0
- package/dist/cjs/js/fixedScriptWallet/ZcashBitGoPsbt.js +114 -0
- package/dist/cjs/js/fixedScriptWallet/index.d.ts +2 -1
- package/dist/cjs/js/fixedScriptWallet/index.js +5 -1
- package/dist/cjs/js/index.d.ts +1 -0
- package/dist/cjs/js/index.js +5 -1
- package/dist/cjs/js/transaction.d.ts +46 -0
- package/dist/cjs/js/transaction.js +76 -0
- package/dist/cjs/js/wasm/wasm_utxo.d.ts +109 -0
- package/dist/cjs/js/wasm/wasm_utxo.js +345 -0
- package/dist/cjs/js/wasm/wasm_utxo_bg.wasm +0 -0
- package/dist/cjs/js/wasm/wasm_utxo_bg.wasm.d.ts +54 -41
- package/dist/esm/js/fixedScriptWallet/BitGoPsbt.d.ts +5 -2
- package/dist/esm/js/fixedScriptWallet/BitGoPsbt.js +2 -0
- package/dist/esm/js/fixedScriptWallet/ZcashBitGoPsbt.d.ts +113 -0
- package/dist/esm/js/fixedScriptWallet/ZcashBitGoPsbt.js +110 -0
- package/dist/esm/js/fixedScriptWallet/index.d.ts +2 -1
- package/dist/esm/js/fixedScriptWallet/index.js +3 -0
- package/dist/esm/js/index.d.ts +1 -0
- package/dist/esm/js/index.js +1 -0
- package/dist/esm/js/transaction.d.ts +46 -0
- package/dist/esm/js/transaction.js +70 -0
- package/dist/esm/js/wasm/wasm_utxo.d.ts +109 -0
- package/dist/esm/js/wasm/wasm_utxo_bg.js +342 -0
- package/dist/esm/js/wasm/wasm_utxo_bg.wasm +0 -0
- package/dist/esm/js/wasm/wasm_utxo_bg.wasm.d.ts +54 -41
- package/package.json +1 -1
|
@@ -177,6 +177,10 @@ const WasmBIP32Finalization = (typeof FinalizationRegistry === 'undefined')
|
|
|
177
177
|
? { register: () => {}, unregister: () => {} }
|
|
178
178
|
: new FinalizationRegistry(ptr => wasm.__wbg_wasmbip32_free(ptr >>> 0, 1));
|
|
179
179
|
|
|
180
|
+
const WasmDashTransactionFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
181
|
+
? { register: () => {}, unregister: () => {} }
|
|
182
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_wasmdashtransaction_free(ptr >>> 0, 1));
|
|
183
|
+
|
|
180
184
|
const WasmECPairFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
181
185
|
? { register: () => {}, unregister: () => {} }
|
|
182
186
|
: new FinalizationRegistry(ptr => wasm.__wbg_wasmecpair_free(ptr >>> 0, 1));
|
|
@@ -189,6 +193,14 @@ const WasmRootWalletKeysFinalization = (typeof FinalizationRegistry === 'undefin
|
|
|
189
193
|
? { register: () => {}, unregister: () => {} }
|
|
190
194
|
: new FinalizationRegistry(ptr => wasm.__wbg_wasmrootwalletkeys_free(ptr >>> 0, 1));
|
|
191
195
|
|
|
196
|
+
const WasmTransactionFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
197
|
+
? { register: () => {}, unregister: () => {} }
|
|
198
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_wasmtransaction_free(ptr >>> 0, 1));
|
|
199
|
+
|
|
200
|
+
const WasmZcashTransactionFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
201
|
+
? { register: () => {}, unregister: () => {} }
|
|
202
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_wasmzcashtransaction_free(ptr >>> 0, 1));
|
|
203
|
+
|
|
192
204
|
const WrapDescriptorFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
193
205
|
? { register: () => {}, unregister: () => {} }
|
|
194
206
|
: new FinalizationRegistry(ptr => wasm.__wbg_wrapdescriptor_free(ptr >>> 0, 1));
|
|
@@ -384,6 +396,14 @@ class BitGoPsbt {
|
|
|
384
396
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
385
397
|
}
|
|
386
398
|
}
|
|
399
|
+
/**
|
|
400
|
+
* Get the Zcash expiry height (returns None for non-Zcash PSBTs)
|
|
401
|
+
* @returns {number | undefined}
|
|
402
|
+
*/
|
|
403
|
+
expiry_height() {
|
|
404
|
+
const ret = wasm.bitgopsbt_expiry_height(this.__wbg_ptr);
|
|
405
|
+
return ret === 0x100000001 ? undefined : ret;
|
|
406
|
+
}
|
|
387
407
|
/**
|
|
388
408
|
* Get the unsigned transaction ID
|
|
389
409
|
* @returns {string}
|
|
@@ -495,6 +515,14 @@ class BitGoPsbt {
|
|
|
495
515
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
496
516
|
}
|
|
497
517
|
}
|
|
518
|
+
/**
|
|
519
|
+
* Get the Zcash version group ID (returns None for non-Zcash PSBTs)
|
|
520
|
+
* @returns {number | undefined}
|
|
521
|
+
*/
|
|
522
|
+
version_group_id() {
|
|
523
|
+
const ret = wasm.bitgopsbt_version_group_id(this.__wbg_ptr);
|
|
524
|
+
return ret === 0x100000001 ? undefined : ret;
|
|
525
|
+
}
|
|
498
526
|
/**
|
|
499
527
|
* Add a wallet output with full PSBT metadata
|
|
500
528
|
*
|
|
@@ -566,6 +594,47 @@ class BitGoPsbt {
|
|
|
566
594
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
567
595
|
}
|
|
568
596
|
}
|
|
597
|
+
/**
|
|
598
|
+
* Create an empty Zcash PSBT with the required consensus branch ID
|
|
599
|
+
*
|
|
600
|
+
* This method is specifically for Zcash networks which require additional
|
|
601
|
+
* parameters for sighash computation.
|
|
602
|
+
*
|
|
603
|
+
* # Arguments
|
|
604
|
+
* * `network` - Network name (must be "zcash" or "zcashTest")
|
|
605
|
+
* * `wallet_keys` - The wallet's root keys (used to set global xpubs)
|
|
606
|
+
* * `consensus_branch_id` - Zcash consensus branch ID (e.g., 0xC2D6D0B4 for NU5)
|
|
607
|
+
* * `version` - Optional transaction version (default: 4 for Zcash Sapling+)
|
|
608
|
+
* * `lock_time` - Optional lock time (default: 0)
|
|
609
|
+
* * `version_group_id` - Optional version group ID (defaults to Sapling: 0x892F2085)
|
|
610
|
+
* * `expiry_height` - Optional expiry height
|
|
611
|
+
* @param {string} network
|
|
612
|
+
* @param {WasmRootWalletKeys} wallet_keys
|
|
613
|
+
* @param {number} consensus_branch_id
|
|
614
|
+
* @param {number | null} [version]
|
|
615
|
+
* @param {number | null} [lock_time]
|
|
616
|
+
* @param {number | null} [version_group_id]
|
|
617
|
+
* @param {number | null} [expiry_height]
|
|
618
|
+
* @returns {BitGoPsbt}
|
|
619
|
+
*/
|
|
620
|
+
static create_empty_zcash(network, wallet_keys, consensus_branch_id, version, lock_time, version_group_id, expiry_height) {
|
|
621
|
+
try {
|
|
622
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
623
|
+
const ptr0 = passStringToWasm0(network, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
624
|
+
const len0 = WASM_VECTOR_LEN;
|
|
625
|
+
_assertClass(wallet_keys, WasmRootWalletKeys);
|
|
626
|
+
wasm.bitgopsbt_create_empty_zcash(retptr, ptr0, len0, wallet_keys.__wbg_ptr, consensus_branch_id, isLikeNone(version) ? 0x100000001 : (version) >> 0, isLikeNone(lock_time) ? 0x100000001 : (lock_time) >>> 0, isLikeNone(version_group_id) ? 0x100000001 : (version_group_id) >>> 0, isLikeNone(expiry_height) ? 0x100000001 : (expiry_height) >>> 0);
|
|
627
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
628
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
629
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
630
|
+
if (r2) {
|
|
631
|
+
throw takeObject(r1);
|
|
632
|
+
}
|
|
633
|
+
return BitGoPsbt.__wrap(r0);
|
|
634
|
+
} finally {
|
|
635
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
636
|
+
}
|
|
637
|
+
}
|
|
569
638
|
/**
|
|
570
639
|
* Extract the final transaction from a finalized PSBT
|
|
571
640
|
*
|
|
@@ -842,6 +911,50 @@ class BitGoPsbt {
|
|
|
842
911
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
843
912
|
}
|
|
844
913
|
}
|
|
914
|
+
/**
|
|
915
|
+
* Create an empty Zcash PSBT with consensus branch ID determined from block height
|
|
916
|
+
*
|
|
917
|
+
* This method automatically determines the correct consensus branch ID based on
|
|
918
|
+
* the network and block height using the network upgrade activation heights.
|
|
919
|
+
*
|
|
920
|
+
* # Arguments
|
|
921
|
+
* * `network` - Network name (must be "zcash" or "zcashTest")
|
|
922
|
+
* * `wallet_keys` - The wallet's root keys (used to set global xpubs)
|
|
923
|
+
* * `block_height` - Block height to determine consensus rules
|
|
924
|
+
* * `version` - Optional transaction version (default: 4 for Zcash Sapling+)
|
|
925
|
+
* * `lock_time` - Optional lock time (default: 0)
|
|
926
|
+
* * `version_group_id` - Optional version group ID (defaults to Sapling: 0x892F2085)
|
|
927
|
+
* * `expiry_height` - Optional expiry height
|
|
928
|
+
*
|
|
929
|
+
* # Errors
|
|
930
|
+
* Returns error if block height is before Overwinter activation
|
|
931
|
+
* @param {string} network
|
|
932
|
+
* @param {WasmRootWalletKeys} wallet_keys
|
|
933
|
+
* @param {number} block_height
|
|
934
|
+
* @param {number | null} [version]
|
|
935
|
+
* @param {number | null} [lock_time]
|
|
936
|
+
* @param {number | null} [version_group_id]
|
|
937
|
+
* @param {number | null} [expiry_height]
|
|
938
|
+
* @returns {BitGoPsbt}
|
|
939
|
+
*/
|
|
940
|
+
static create_empty_zcash_at_height(network, wallet_keys, block_height, version, lock_time, version_group_id, expiry_height) {
|
|
941
|
+
try {
|
|
942
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
943
|
+
const ptr0 = passStringToWasm0(network, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
944
|
+
const len0 = WASM_VECTOR_LEN;
|
|
945
|
+
_assertClass(wallet_keys, WasmRootWalletKeys);
|
|
946
|
+
wasm.bitgopsbt_create_empty_zcash_at_height(retptr, ptr0, len0, wallet_keys.__wbg_ptr, block_height, isLikeNone(version) ? 0x100000001 : (version) >> 0, isLikeNone(lock_time) ? 0x100000001 : (lock_time) >>> 0, isLikeNone(version_group_id) ? 0x100000001 : (version_group_id) >>> 0, isLikeNone(expiry_height) ? 0x100000001 : (expiry_height) >>> 0);
|
|
947
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
948
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
949
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
950
|
+
if (r2) {
|
|
951
|
+
throw takeObject(r1);
|
|
952
|
+
}
|
|
953
|
+
return BitGoPsbt.__wrap(r0);
|
|
954
|
+
} finally {
|
|
955
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
956
|
+
}
|
|
957
|
+
}
|
|
845
958
|
/**
|
|
846
959
|
* Parse outputs with wallet keys to identify which outputs belong to a wallet
|
|
847
960
|
*
|
|
@@ -1553,6 +1666,75 @@ class WasmBIP32 {
|
|
|
1553
1666
|
if (Symbol.dispose) WasmBIP32.prototype[Symbol.dispose] = WasmBIP32.prototype.free;
|
|
1554
1667
|
exports.WasmBIP32 = WasmBIP32;
|
|
1555
1668
|
|
|
1669
|
+
/**
|
|
1670
|
+
* Dash transaction wrapper that supports Dash special transactions (EVO) by preserving extra payload.
|
|
1671
|
+
*/
|
|
1672
|
+
class WasmDashTransaction {
|
|
1673
|
+
static __wrap(ptr) {
|
|
1674
|
+
ptr = ptr >>> 0;
|
|
1675
|
+
const obj = Object.create(WasmDashTransaction.prototype);
|
|
1676
|
+
obj.__wbg_ptr = ptr;
|
|
1677
|
+
WasmDashTransactionFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
1678
|
+
return obj;
|
|
1679
|
+
}
|
|
1680
|
+
__destroy_into_raw() {
|
|
1681
|
+
const ptr = this.__wbg_ptr;
|
|
1682
|
+
this.__wbg_ptr = 0;
|
|
1683
|
+
WasmDashTransactionFinalization.unregister(this);
|
|
1684
|
+
return ptr;
|
|
1685
|
+
}
|
|
1686
|
+
free() {
|
|
1687
|
+
const ptr = this.__destroy_into_raw();
|
|
1688
|
+
wasm.__wbg_wasmdashtransaction_free(ptr, 0);
|
|
1689
|
+
}
|
|
1690
|
+
/**
|
|
1691
|
+
* Deserialize a Dash transaction from bytes (supports EVO special tx extra payload).
|
|
1692
|
+
* @param {Uint8Array} bytes
|
|
1693
|
+
* @returns {WasmDashTransaction}
|
|
1694
|
+
*/
|
|
1695
|
+
static from_bytes(bytes) {
|
|
1696
|
+
try {
|
|
1697
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1698
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
|
|
1699
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1700
|
+
wasm.wasmdashtransaction_from_bytes(retptr, ptr0, len0);
|
|
1701
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1702
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1703
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1704
|
+
if (r2) {
|
|
1705
|
+
throw takeObject(r1);
|
|
1706
|
+
}
|
|
1707
|
+
return WasmDashTransaction.__wrap(r0);
|
|
1708
|
+
} finally {
|
|
1709
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1710
|
+
}
|
|
1711
|
+
}
|
|
1712
|
+
/**
|
|
1713
|
+
* Serialize the Dash transaction to bytes (preserving tx_type and extra payload).
|
|
1714
|
+
* @returns {Uint8Array}
|
|
1715
|
+
*/
|
|
1716
|
+
to_bytes() {
|
|
1717
|
+
try {
|
|
1718
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1719
|
+
wasm.wasmdashtransaction_to_bytes(retptr, this.__wbg_ptr);
|
|
1720
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1721
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1722
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1723
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
1724
|
+
if (r3) {
|
|
1725
|
+
throw takeObject(r2);
|
|
1726
|
+
}
|
|
1727
|
+
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
1728
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
1729
|
+
return v1;
|
|
1730
|
+
} finally {
|
|
1731
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1732
|
+
}
|
|
1733
|
+
}
|
|
1734
|
+
}
|
|
1735
|
+
if (Symbol.dispose) WasmDashTransaction.prototype[Symbol.dispose] = WasmDashTransaction.prototype.free;
|
|
1736
|
+
exports.WasmDashTransaction = WasmDashTransaction;
|
|
1737
|
+
|
|
1556
1738
|
/**
|
|
1557
1739
|
* WASM wrapper for elliptic curve key pairs (always uses compressed keys)
|
|
1558
1740
|
*/
|
|
@@ -2001,6 +2183,169 @@ class WasmRootWalletKeys {
|
|
|
2001
2183
|
if (Symbol.dispose) WasmRootWalletKeys.prototype[Symbol.dispose] = WasmRootWalletKeys.prototype.free;
|
|
2002
2184
|
exports.WasmRootWalletKeys = WasmRootWalletKeys;
|
|
2003
2185
|
|
|
2186
|
+
/**
|
|
2187
|
+
* A Bitcoin-like transaction (for all networks except Zcash)
|
|
2188
|
+
*
|
|
2189
|
+
* This class provides basic transaction parsing and serialization for testing
|
|
2190
|
+
* compatibility with third-party transaction fixtures.
|
|
2191
|
+
*/
|
|
2192
|
+
class WasmTransaction {
|
|
2193
|
+
static __wrap(ptr) {
|
|
2194
|
+
ptr = ptr >>> 0;
|
|
2195
|
+
const obj = Object.create(WasmTransaction.prototype);
|
|
2196
|
+
obj.__wbg_ptr = ptr;
|
|
2197
|
+
WasmTransactionFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
2198
|
+
return obj;
|
|
2199
|
+
}
|
|
2200
|
+
__destroy_into_raw() {
|
|
2201
|
+
const ptr = this.__wbg_ptr;
|
|
2202
|
+
this.__wbg_ptr = 0;
|
|
2203
|
+
WasmTransactionFinalization.unregister(this);
|
|
2204
|
+
return ptr;
|
|
2205
|
+
}
|
|
2206
|
+
free() {
|
|
2207
|
+
const ptr = this.__destroy_into_raw();
|
|
2208
|
+
wasm.__wbg_wasmtransaction_free(ptr, 0);
|
|
2209
|
+
}
|
|
2210
|
+
/**
|
|
2211
|
+
* Deserialize a transaction from bytes
|
|
2212
|
+
*
|
|
2213
|
+
* # Arguments
|
|
2214
|
+
* * `bytes` - The serialized transaction bytes
|
|
2215
|
+
*
|
|
2216
|
+
* # Returns
|
|
2217
|
+
* A WasmTransaction instance
|
|
2218
|
+
*
|
|
2219
|
+
* # Errors
|
|
2220
|
+
* Returns an error if the bytes cannot be parsed as a valid transaction
|
|
2221
|
+
* @param {Uint8Array} bytes
|
|
2222
|
+
* @returns {WasmTransaction}
|
|
2223
|
+
*/
|
|
2224
|
+
static from_bytes(bytes) {
|
|
2225
|
+
try {
|
|
2226
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2227
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
|
|
2228
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2229
|
+
wasm.wasmtransaction_from_bytes(retptr, ptr0, len0);
|
|
2230
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2231
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2232
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
2233
|
+
if (r2) {
|
|
2234
|
+
throw takeObject(r1);
|
|
2235
|
+
}
|
|
2236
|
+
return WasmTransaction.__wrap(r0);
|
|
2237
|
+
} finally {
|
|
2238
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2239
|
+
}
|
|
2240
|
+
}
|
|
2241
|
+
/**
|
|
2242
|
+
* Serialize the transaction to bytes
|
|
2243
|
+
*
|
|
2244
|
+
* # Returns
|
|
2245
|
+
* The serialized transaction bytes
|
|
2246
|
+
* @returns {Uint8Array}
|
|
2247
|
+
*/
|
|
2248
|
+
to_bytes() {
|
|
2249
|
+
try {
|
|
2250
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2251
|
+
wasm.wasmtransaction_to_bytes(retptr, this.__wbg_ptr);
|
|
2252
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2253
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2254
|
+
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
2255
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
2256
|
+
return v1;
|
|
2257
|
+
} finally {
|
|
2258
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2259
|
+
}
|
|
2260
|
+
}
|
|
2261
|
+
}
|
|
2262
|
+
if (Symbol.dispose) WasmTransaction.prototype[Symbol.dispose] = WasmTransaction.prototype.free;
|
|
2263
|
+
exports.WasmTransaction = WasmTransaction;
|
|
2264
|
+
|
|
2265
|
+
/**
|
|
2266
|
+
* A Zcash transaction with network-specific fields
|
|
2267
|
+
*
|
|
2268
|
+
* This class provides basic transaction parsing and serialization for Zcash
|
|
2269
|
+
* transactions, which use the Overwinter transaction format.
|
|
2270
|
+
*/
|
|
2271
|
+
class WasmZcashTransaction {
|
|
2272
|
+
static __wrap(ptr) {
|
|
2273
|
+
ptr = ptr >>> 0;
|
|
2274
|
+
const obj = Object.create(WasmZcashTransaction.prototype);
|
|
2275
|
+
obj.__wbg_ptr = ptr;
|
|
2276
|
+
WasmZcashTransactionFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
2277
|
+
return obj;
|
|
2278
|
+
}
|
|
2279
|
+
__destroy_into_raw() {
|
|
2280
|
+
const ptr = this.__wbg_ptr;
|
|
2281
|
+
this.__wbg_ptr = 0;
|
|
2282
|
+
WasmZcashTransactionFinalization.unregister(this);
|
|
2283
|
+
return ptr;
|
|
2284
|
+
}
|
|
2285
|
+
free() {
|
|
2286
|
+
const ptr = this.__destroy_into_raw();
|
|
2287
|
+
wasm.__wbg_wasmzcashtransaction_free(ptr, 0);
|
|
2288
|
+
}
|
|
2289
|
+
/**
|
|
2290
|
+
* Deserialize a Zcash transaction from bytes
|
|
2291
|
+
*
|
|
2292
|
+
* # Arguments
|
|
2293
|
+
* * `bytes` - The serialized transaction bytes
|
|
2294
|
+
*
|
|
2295
|
+
* # Returns
|
|
2296
|
+
* A WasmZcashTransaction instance
|
|
2297
|
+
*
|
|
2298
|
+
* # Errors
|
|
2299
|
+
* Returns an error if the bytes cannot be parsed as a valid Zcash transaction
|
|
2300
|
+
* @param {Uint8Array} bytes
|
|
2301
|
+
* @returns {WasmZcashTransaction}
|
|
2302
|
+
*/
|
|
2303
|
+
static from_bytes(bytes) {
|
|
2304
|
+
try {
|
|
2305
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2306
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
|
|
2307
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2308
|
+
wasm.wasmzcashtransaction_from_bytes(retptr, ptr0, len0);
|
|
2309
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2310
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2311
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
2312
|
+
if (r2) {
|
|
2313
|
+
throw takeObject(r1);
|
|
2314
|
+
}
|
|
2315
|
+
return WasmZcashTransaction.__wrap(r0);
|
|
2316
|
+
} finally {
|
|
2317
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2318
|
+
}
|
|
2319
|
+
}
|
|
2320
|
+
/**
|
|
2321
|
+
* Serialize the transaction to bytes
|
|
2322
|
+
*
|
|
2323
|
+
* # Returns
|
|
2324
|
+
* The serialized transaction bytes
|
|
2325
|
+
* @returns {Uint8Array}
|
|
2326
|
+
*/
|
|
2327
|
+
to_bytes() {
|
|
2328
|
+
try {
|
|
2329
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2330
|
+
wasm.wasmzcashtransaction_to_bytes(retptr, this.__wbg_ptr);
|
|
2331
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2332
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2333
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
2334
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
2335
|
+
if (r3) {
|
|
2336
|
+
throw takeObject(r2);
|
|
2337
|
+
}
|
|
2338
|
+
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
2339
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
2340
|
+
return v1;
|
|
2341
|
+
} finally {
|
|
2342
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2343
|
+
}
|
|
2344
|
+
}
|
|
2345
|
+
}
|
|
2346
|
+
if (Symbol.dispose) WasmZcashTransaction.prototype[Symbol.dispose] = WasmZcashTransaction.prototype.free;
|
|
2347
|
+
exports.WasmZcashTransaction = WasmZcashTransaction;
|
|
2348
|
+
|
|
2004
2349
|
class WrapDescriptor {
|
|
2005
2350
|
static __wrap(ptr) {
|
|
2006
2351
|
ptr = ptr >>> 0;
|
|
Binary file
|
|
@@ -1,30 +1,7 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
-
export const __wbg_wasmbip32_free: (a: number, b: number) => void;
|
|
5
4
|
export const __wbg_wrapdescriptor_free: (a: number, b: number) => void;
|
|
6
|
-
export const __wbg_wrapminiscript_free: (a: number, b: number) => void;
|
|
7
|
-
export const __wbg_wrappsbt_free: (a: number, b: number) => void;
|
|
8
|
-
export const wasmbip32_chain_code: (a: number) => number;
|
|
9
|
-
export const wasmbip32_depth: (a: number) => number;
|
|
10
|
-
export const wasmbip32_derive: (a: number, b: number, c: number) => void;
|
|
11
|
-
export const wasmbip32_derive_hardened: (a: number, b: number, c: number) => void;
|
|
12
|
-
export const wasmbip32_derive_path: (a: number, b: number, c: number, d: number) => void;
|
|
13
|
-
export const wasmbip32_fingerprint: (a: number) => number;
|
|
14
|
-
export const wasmbip32_from_base58: (a: number, b: number, c: number) => void;
|
|
15
|
-
export const wasmbip32_from_bip32_interface: (a: number, b: number) => void;
|
|
16
|
-
export const wasmbip32_from_seed: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
17
|
-
export const wasmbip32_from_xprv: (a: number, b: number, c: number) => void;
|
|
18
|
-
export const wasmbip32_from_xpub: (a: number, b: number, c: number) => void;
|
|
19
|
-
export const wasmbip32_identifier: (a: number) => number;
|
|
20
|
-
export const wasmbip32_index: (a: number) => number;
|
|
21
|
-
export const wasmbip32_is_neutered: (a: number) => number;
|
|
22
|
-
export const wasmbip32_neutered: (a: number) => number;
|
|
23
|
-
export const wasmbip32_parent_fingerprint: (a: number) => number;
|
|
24
|
-
export const wasmbip32_private_key: (a: number) => number;
|
|
25
|
-
export const wasmbip32_public_key: (a: number) => number;
|
|
26
|
-
export const wasmbip32_to_base58: (a: number, b: number) => void;
|
|
27
|
-
export const wasmbip32_to_wif: (a: number, b: number) => void;
|
|
28
5
|
export const wrapdescriptor_atDerivationIndex: (a: number, b: number, c: number) => void;
|
|
29
6
|
export const wrapdescriptor_descType: (a: number, b: number) => void;
|
|
30
7
|
export const wrapdescriptor_encode: (a: number, b: number) => void;
|
|
@@ -36,28 +13,16 @@ export const wrapdescriptor_node: (a: number, b: number) => void;
|
|
|
36
13
|
export const wrapdescriptor_scriptPubkey: (a: number, b: number) => void;
|
|
37
14
|
export const wrapdescriptor_toAsmString: (a: number, b: number) => void;
|
|
38
15
|
export const wrapdescriptor_toString: (a: number, b: number) => void;
|
|
39
|
-
export const wrapminiscript_encode: (a: number, b: number) => void;
|
|
40
|
-
export const wrapminiscript_fromBitcoinScript: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
41
|
-
export const wrapminiscript_fromString: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
42
|
-
export const wrapminiscript_node: (a: number, b: number) => void;
|
|
43
|
-
export const wrapminiscript_toAsmString: (a: number, b: number) => void;
|
|
44
|
-
export const wrapminiscript_toString: (a: number, b: number) => void;
|
|
45
|
-
export const wrappsbt_clone: (a: number) => number;
|
|
46
|
-
export const wrappsbt_deserialize: (a: number, b: number, c: number) => void;
|
|
47
|
-
export const wrappsbt_finalize: (a: number, b: number) => void;
|
|
48
|
-
export const wrappsbt_serialize: (a: number, b: number) => void;
|
|
49
|
-
export const wrappsbt_signWithPrv: (a: number, b: number, c: number, d: number) => void;
|
|
50
|
-
export const wrappsbt_signWithXprv: (a: number, b: number, c: number, d: number) => void;
|
|
51
|
-
export const wrappsbt_updateInputWithDescriptor: (a: number, b: number, c: number, d: number) => void;
|
|
52
|
-
export const wrappsbt_updateOutputWithDescriptor: (a: number, b: number, c: number, d: number) => void;
|
|
53
|
-
export const wasmbip32_from_bip32_properties: (a: number, b: number) => void;
|
|
54
16
|
export const __wbg_addressnamespace_free: (a: number, b: number) => void;
|
|
55
17
|
export const __wbg_bitgopsbt_free: (a: number, b: number) => void;
|
|
56
18
|
export const __wbg_fixedscriptwalletnamespace_free: (a: number, b: number) => void;
|
|
57
|
-
export const
|
|
19
|
+
export const __wbg_wasmbip32_free: (a: number, b: number) => void;
|
|
58
20
|
export const __wbg_wasmecpair_free: (a: number, b: number) => void;
|
|
59
21
|
export const __wbg_wasmreplayprotection_free: (a: number, b: number) => void;
|
|
60
22
|
export const __wbg_wasmrootwalletkeys_free: (a: number, b: number) => void;
|
|
23
|
+
export const __wbg_wasmtransaction_free: (a: number, b: number) => void;
|
|
24
|
+
export const __wbg_wasmzcashtransaction_free: (a: number, b: number) => void;
|
|
25
|
+
export const __wbg_wrappsbt_free: (a: number, b: number) => void;
|
|
61
26
|
export const addressnamespace_from_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
62
27
|
export const addressnamespace_to_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
63
28
|
export const bitgopsbt_add_input: (a: number, b: number, c: number, d: number, e: number, f: bigint, g: number, h: number, i: number, j: number, k: number) => void;
|
|
@@ -68,6 +33,9 @@ export const bitgopsbt_add_wallet_input: (a: number, b: number, c: number, d: nu
|
|
|
68
33
|
export const bitgopsbt_add_wallet_output: (a: number, b: number, c: number, d: number, e: bigint, f: number) => void;
|
|
69
34
|
export const bitgopsbt_combine_musig2_nonces: (a: number, b: number, c: number) => void;
|
|
70
35
|
export const bitgopsbt_create_empty: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
36
|
+
export const bitgopsbt_create_empty_zcash: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
|
|
37
|
+
export const bitgopsbt_create_empty_zcash_at_height: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
|
|
38
|
+
export const bitgopsbt_expiry_height: (a: number) => number;
|
|
71
39
|
export const bitgopsbt_extract_transaction: (a: number, b: number) => void;
|
|
72
40
|
export const bitgopsbt_finalize_all_inputs: (a: number, b: number) => void;
|
|
73
41
|
export const bitgopsbt_from_bytes: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
@@ -84,10 +52,29 @@ export const bitgopsbt_verify_replay_protection_signature: (a: number, b: number
|
|
|
84
52
|
export const bitgopsbt_verify_signature_with_pub: (a: number, b: number, c: number, d: number) => void;
|
|
85
53
|
export const bitgopsbt_verify_signature_with_xpub: (a: number, b: number, c: number, d: number) => void;
|
|
86
54
|
export const bitgopsbt_version: (a: number) => number;
|
|
55
|
+
export const bitgopsbt_version_group_id: (a: number) => number;
|
|
87
56
|
export const fixedscriptwalletnamespace_address: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
88
57
|
export const fixedscriptwalletnamespace_output_script: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
89
|
-
export const
|
|
90
|
-
export const
|
|
58
|
+
export const wasmbip32_chain_code: (a: number) => number;
|
|
59
|
+
export const wasmbip32_depth: (a: number) => number;
|
|
60
|
+
export const wasmbip32_derive: (a: number, b: number, c: number) => void;
|
|
61
|
+
export const wasmbip32_derive_hardened: (a: number, b: number, c: number) => void;
|
|
62
|
+
export const wasmbip32_derive_path: (a: number, b: number, c: number, d: number) => void;
|
|
63
|
+
export const wasmbip32_fingerprint: (a: number) => number;
|
|
64
|
+
export const wasmbip32_from_base58: (a: number, b: number, c: number) => void;
|
|
65
|
+
export const wasmbip32_from_bip32_interface: (a: number, b: number) => void;
|
|
66
|
+
export const wasmbip32_from_seed: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
67
|
+
export const wasmbip32_from_xprv: (a: number, b: number, c: number) => void;
|
|
68
|
+
export const wasmbip32_from_xpub: (a: number, b: number, c: number) => void;
|
|
69
|
+
export const wasmbip32_identifier: (a: number) => number;
|
|
70
|
+
export const wasmbip32_index: (a: number) => number;
|
|
71
|
+
export const wasmbip32_is_neutered: (a: number) => number;
|
|
72
|
+
export const wasmbip32_neutered: (a: number) => number;
|
|
73
|
+
export const wasmbip32_parent_fingerprint: (a: number) => number;
|
|
74
|
+
export const wasmbip32_private_key: (a: number) => number;
|
|
75
|
+
export const wasmbip32_public_key: (a: number) => number;
|
|
76
|
+
export const wasmbip32_to_base58: (a: number, b: number) => void;
|
|
77
|
+
export const wasmbip32_to_wif: (a: number, b: number) => void;
|
|
91
78
|
export const wasmecpair_from_private_key: (a: number, b: number, c: number) => void;
|
|
92
79
|
export const wasmecpair_from_public_key: (a: number, b: number, c: number) => void;
|
|
93
80
|
export const wasmecpair_from_wif: (a: number, b: number, c: number) => void;
|
|
@@ -106,6 +93,32 @@ export const wasmrootwalletkeys_bitgo_key: (a: number) => number;
|
|
|
106
93
|
export const wasmrootwalletkeys_new: (a: number, b: number, c: number, d: number) => void;
|
|
107
94
|
export const wasmrootwalletkeys_user_key: (a: number) => number;
|
|
108
95
|
export const wasmrootwalletkeys_with_derivation_prefixes: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
|
|
96
|
+
export const wasmtransaction_from_bytes: (a: number, b: number, c: number) => void;
|
|
97
|
+
export const wasmtransaction_to_bytes: (a: number, b: number) => void;
|
|
98
|
+
export const wasmzcashtransaction_from_bytes: (a: number, b: number, c: number) => void;
|
|
99
|
+
export const wasmzcashtransaction_to_bytes: (a: number, b: number) => void;
|
|
100
|
+
export const wrappsbt_clone: (a: number) => number;
|
|
101
|
+
export const wrappsbt_deserialize: (a: number, b: number, c: number) => void;
|
|
102
|
+
export const wrappsbt_finalize: (a: number, b: number) => void;
|
|
103
|
+
export const wrappsbt_serialize: (a: number, b: number) => void;
|
|
104
|
+
export const wrappsbt_signWithPrv: (a: number, b: number, c: number, d: number) => void;
|
|
105
|
+
export const wrappsbt_signWithXprv: (a: number, b: number, c: number, d: number) => void;
|
|
106
|
+
export const wrappsbt_updateInputWithDescriptor: (a: number, b: number, c: number, d: number) => void;
|
|
107
|
+
export const wrappsbt_updateOutputWithDescriptor: (a: number, b: number, c: number, d: number) => void;
|
|
108
|
+
export const wasmbip32_from_bip32_properties: (a: number, b: number) => void;
|
|
109
|
+
export const __wbg_utxolibcompatnamespace_free: (a: number, b: number) => void;
|
|
110
|
+
export const __wbg_wasmdashtransaction_free: (a: number, b: number) => void;
|
|
111
|
+
export const __wbg_wrapminiscript_free: (a: number, b: number) => void;
|
|
112
|
+
export const utxolibcompatnamespace_from_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
113
|
+
export const utxolibcompatnamespace_to_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
114
|
+
export const wasmdashtransaction_from_bytes: (a: number, b: number, c: number) => void;
|
|
115
|
+
export const wasmdashtransaction_to_bytes: (a: number, b: number) => void;
|
|
116
|
+
export const wrapminiscript_encode: (a: number, b: number) => void;
|
|
117
|
+
export const wrapminiscript_fromBitcoinScript: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
118
|
+
export const wrapminiscript_fromString: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
119
|
+
export const wrapminiscript_node: (a: number, b: number) => void;
|
|
120
|
+
export const wrapminiscript_toAsmString: (a: number, b: number) => void;
|
|
121
|
+
export const wrapminiscript_toString: (a: number, b: number) => void;
|
|
109
122
|
export const rustsecp256k1_v0_10_0_context_create: (a: number) => number;
|
|
110
123
|
export const rustsecp256k1_v0_10_0_context_destroy: (a: number) => void;
|
|
111
124
|
export const rustsecp256k1_v0_10_0_default_error_callback_fn: (a: number, b: number) => void;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { BitGoPsbt as WasmBitGoPsbt } from "../wasm/wasm_utxo.js";
|
|
1
2
|
import { type WalletKeysArg } from "./RootWalletKeys.js";
|
|
2
3
|
import { type ReplayProtectionArg } from "./ReplayProtection.js";
|
|
3
4
|
import { type BIP32Arg } from "../bip32.js";
|
|
@@ -85,14 +86,16 @@ export type AddWalletOutputOptions = {
|
|
|
85
86
|
value: bigint;
|
|
86
87
|
};
|
|
87
88
|
export declare class BitGoPsbt {
|
|
88
|
-
|
|
89
|
-
|
|
89
|
+
protected wasm: WasmBitGoPsbt;
|
|
90
|
+
protected constructor(wasm: WasmBitGoPsbt);
|
|
90
91
|
/**
|
|
91
92
|
* Create an empty PSBT for the given network with wallet keys
|
|
92
93
|
*
|
|
93
94
|
* The wallet keys are used to set global xpubs in the PSBT, which identifies
|
|
94
95
|
* the keys that will be used for signing.
|
|
95
96
|
*
|
|
97
|
+
* For Zcash networks, use ZcashBitGoPsbt.createEmpty() instead.
|
|
98
|
+
*
|
|
96
99
|
* @param network - Network name (utxolib name like "bitcoin" or coin name like "btc")
|
|
97
100
|
* @param walletKeys - The wallet's root keys (sets global xpubs in the PSBT)
|
|
98
101
|
* @param options - Optional transaction parameters (version, lockTime)
|
|
@@ -14,6 +14,8 @@ export class BitGoPsbt {
|
|
|
14
14
|
* The wallet keys are used to set global xpubs in the PSBT, which identifies
|
|
15
15
|
* the keys that will be used for signing.
|
|
16
16
|
*
|
|
17
|
+
* For Zcash networks, use ZcashBitGoPsbt.createEmpty() instead.
|
|
18
|
+
*
|
|
17
19
|
* @param network - Network name (utxolib name like "bitcoin" or coin name like "btc")
|
|
18
20
|
* @param walletKeys - The wallet's root keys (sets global xpubs in the PSBT)
|
|
19
21
|
* @param options - Optional transaction parameters (version, lockTime)
|