@bitgo/wasm-utxo 4.30.0 → 4.32.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/ZcashBitGoPsbt.d.ts +11 -0
- package/dist/cjs/js/fixedScriptWallet/ZcashBitGoPsbt.js +17 -2
- package/dist/cjs/js/fixedScriptWallet/ZcashIronwoodBitGoPsbt.d.ts +172 -0
- package/dist/cjs/js/fixedScriptWallet/ZcashIronwoodBitGoPsbt.js +180 -0
- package/dist/cjs/js/fixedScriptWallet/index.d.ts +2 -1
- package/dist/cjs/js/fixedScriptWallet/index.js +6 -1
- package/dist/cjs/js/wasm/wasm_utxo.d.ts +67 -0
- package/dist/cjs/js/wasm/wasm_utxo.js +226 -0
- package/dist/cjs/js/wasm/wasm_utxo_bg.wasm +0 -0
- package/dist/cjs/js/wasm/wasm_utxo_bg.wasm.d.ts +34 -26
- package/dist/esm/js/fixedScriptWallet/ZcashBitGoPsbt.d.ts +11 -0
- package/dist/esm/js/fixedScriptWallet/ZcashBitGoPsbt.js +17 -2
- package/dist/esm/js/fixedScriptWallet/ZcashIronwoodBitGoPsbt.d.ts +172 -0
- package/dist/esm/js/fixedScriptWallet/ZcashIronwoodBitGoPsbt.js +175 -0
- package/dist/esm/js/fixedScriptWallet/index.d.ts +2 -1
- package/dist/esm/js/fixedScriptWallet/index.js +3 -1
- package/dist/esm/js/wasm/wasm_utxo.d.ts +67 -0
- package/dist/esm/js/wasm/wasm_utxo.js +1 -1
- package/dist/esm/js/wasm/wasm_utxo_bg.js +225 -0
- package/dist/esm/js/wasm/wasm_utxo_bg.wasm +0 -0
- package/dist/esm/js/wasm/wasm_utxo_bg.wasm.d.ts +34 -26
- package/package.json +1 -1
|
@@ -469,6 +469,70 @@ class BitGoPsbt {
|
|
|
469
469
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
470
470
|
}
|
|
471
471
|
}
|
|
472
|
+
/**
|
|
473
|
+
* Constructor: add the shielded Ironwood output as an orchard PCZT stored in the PSBT.
|
|
474
|
+
*
|
|
475
|
+
* * `recipient` - raw Orchard/Ironwood address ([`ORCHARD_ADDRESS_SIZE`] bytes)
|
|
476
|
+
* * `amount` - note value in zatoshi
|
|
477
|
+
* * `ovk` - optional outgoing viewing key ([`OVK_SIZE`] bytes; `None` for a keyless build)
|
|
478
|
+
* * `anchor` - Ironwood note-commitment-tree root ([`ANCHOR_SIZE`] bytes)
|
|
479
|
+
* * `memo` - ZIP-302 memo field ([`MEMO_SIZE`] bytes)
|
|
480
|
+
*
|
|
481
|
+
* [`ORCHARD_ADDRESS_SIZE`]: crate::zcash::ironwood_build::ORCHARD_ADDRESS_SIZE
|
|
482
|
+
* [`OVK_SIZE`]: crate::zcash::ironwood_build::OVK_SIZE
|
|
483
|
+
* [`ANCHOR_SIZE`]: crate::zcash::ironwood_build::ANCHOR_SIZE
|
|
484
|
+
* [`MEMO_SIZE`]: crate::zcash::ironwood_build::MEMO_SIZE
|
|
485
|
+
* @param {Uint8Array} recipient
|
|
486
|
+
* @param {bigint} amount
|
|
487
|
+
* @param {Uint8Array | null | undefined} ovk
|
|
488
|
+
* @param {Uint8Array} anchor
|
|
489
|
+
* @param {Uint8Array} memo
|
|
490
|
+
*/
|
|
491
|
+
add_ironwood_output(recipient, amount, ovk, anchor, memo) {
|
|
492
|
+
try {
|
|
493
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
494
|
+
const ptr0 = passArray8ToWasm0(recipient, wasm.__wbindgen_export);
|
|
495
|
+
const len0 = WASM_VECTOR_LEN;
|
|
496
|
+
var ptr1 = isLikeNone(ovk) ? 0 : passArray8ToWasm0(ovk, wasm.__wbindgen_export);
|
|
497
|
+
var len1 = WASM_VECTOR_LEN;
|
|
498
|
+
const ptr2 = passArray8ToWasm0(anchor, wasm.__wbindgen_export);
|
|
499
|
+
const len2 = WASM_VECTOR_LEN;
|
|
500
|
+
const ptr3 = passArray8ToWasm0(memo, wasm.__wbindgen_export);
|
|
501
|
+
const len3 = WASM_VECTOR_LEN;
|
|
502
|
+
wasm.bitgopsbt_add_ironwood_output(retptr, this.__wbg_ptr, ptr0, len0, amount, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
503
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
504
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
505
|
+
if (r1) {
|
|
506
|
+
throw takeObject(r0);
|
|
507
|
+
}
|
|
508
|
+
} finally {
|
|
509
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
/**
|
|
513
|
+
* Ingest a transparent-input signature (`sig`: DER ECDSA with the trailing SIGHASH_ALL byte)
|
|
514
|
+
* after verifying it against `ironwood_v6_transparent_sighash(index)`.
|
|
515
|
+
* @param {number} index
|
|
516
|
+
* @param {Uint8Array} pubkey
|
|
517
|
+
* @param {Uint8Array} sig
|
|
518
|
+
*/
|
|
519
|
+
add_ironwood_v6_signature(index, pubkey, sig) {
|
|
520
|
+
try {
|
|
521
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
522
|
+
const ptr0 = passArray8ToWasm0(pubkey, wasm.__wbindgen_export);
|
|
523
|
+
const len0 = WASM_VECTOR_LEN;
|
|
524
|
+
const ptr1 = passArray8ToWasm0(sig, wasm.__wbindgen_export);
|
|
525
|
+
const len1 = WASM_VECTOR_LEN;
|
|
526
|
+
wasm.bitgopsbt_add_ironwood_v6_signature(retptr, this.__wbg_ptr, index, ptr0, len0, ptr1, len1);
|
|
527
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
528
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
529
|
+
if (r1) {
|
|
530
|
+
throw takeObject(r0);
|
|
531
|
+
}
|
|
532
|
+
} finally {
|
|
533
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
534
|
+
}
|
|
535
|
+
}
|
|
472
536
|
/**
|
|
473
537
|
* @param {Uint8Array} script
|
|
474
538
|
* @param {bigint} value
|
|
@@ -798,6 +862,38 @@ class BitGoPsbt {
|
|
|
798
862
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
799
863
|
}
|
|
800
864
|
}
|
|
865
|
+
/**
|
|
866
|
+
* Transaction Extractor: given the external prover's `proof` bytes, finalize the transparent
|
|
867
|
+
* inputs, apply the shielded binding signature, and return the broadcast-ready v6 transaction
|
|
868
|
+
* bytes. Requires the transparent inputs to be signed (via `add_ironwood_v6_signature`).
|
|
869
|
+
*
|
|
870
|
+
* Terminal: on success the stored PCZT is dropped, so a second call — or any other Ironwood
|
|
871
|
+
* operation, including after a `serialize`/`from_bytes` round-trip — fails rather than silently
|
|
872
|
+
* re-running against already-extracted state. Build a fresh PSBT instead. On failure nothing is
|
|
873
|
+
* dropped, so a call that errors (bad proof, unsigned input) leaves the PSBT retryable.
|
|
874
|
+
* @param {Uint8Array} proof
|
|
875
|
+
* @returns {Uint8Array}
|
|
876
|
+
*/
|
|
877
|
+
combine_ironwood_proof(proof) {
|
|
878
|
+
try {
|
|
879
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
880
|
+
const ptr0 = passArray8ToWasm0(proof, wasm.__wbindgen_export);
|
|
881
|
+
const len0 = WASM_VECTOR_LEN;
|
|
882
|
+
wasm.bitgopsbt_combine_ironwood_proof(retptr, this.__wbg_ptr, ptr0, len0);
|
|
883
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
884
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
885
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
886
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
887
|
+
if (r3) {
|
|
888
|
+
throw takeObject(r2);
|
|
889
|
+
}
|
|
890
|
+
var v2 = getArrayU8FromWasm0(r0, r1).slice();
|
|
891
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
892
|
+
return v2;
|
|
893
|
+
} finally {
|
|
894
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
895
|
+
}
|
|
896
|
+
}
|
|
801
897
|
/**
|
|
802
898
|
* Combine/merge data from another PSBT into this one
|
|
803
899
|
*
|
|
@@ -954,6 +1050,69 @@ class BitGoPsbt {
|
|
|
954
1050
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
955
1051
|
}
|
|
956
1052
|
}
|
|
1053
|
+
/**
|
|
1054
|
+
* Create an empty Zcash **v6 (Ironwood)** shielding PSBT with an explicit consensus branch id.
|
|
1055
|
+
*
|
|
1056
|
+
* The version group id is fixed by the v6 format, but the consensus branch id tracks the active
|
|
1057
|
+
* network upgrade and stays caller-supplied — the v6 analogue of `create_empty_zcash`. Prefer
|
|
1058
|
+
* `create_empty_zcash_v6_at_height`, which derives it from a block height and rejects heights
|
|
1059
|
+
* before NU6.3 activation; this is the escape hatch for callers that already know the value.
|
|
1060
|
+
* @param {string} network
|
|
1061
|
+
* @param {WasmRootWalletKeys} wallet_keys
|
|
1062
|
+
* @param {number} consensus_branch_id
|
|
1063
|
+
* @param {number | null} [lock_time]
|
|
1064
|
+
* @param {number | null} [expiry_height]
|
|
1065
|
+
* @returns {BitGoPsbt}
|
|
1066
|
+
*/
|
|
1067
|
+
static create_empty_zcash_v6(network, wallet_keys, consensus_branch_id, lock_time, expiry_height) {
|
|
1068
|
+
try {
|
|
1069
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1070
|
+
const ptr0 = passStringToWasm0(network, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1071
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1072
|
+
_assertClass(wallet_keys, WasmRootWalletKeys);
|
|
1073
|
+
wasm.bitgopsbt_create_empty_zcash_v6(retptr, ptr0, len0, wallet_keys.__wbg_ptr, consensus_branch_id, isLikeNone(lock_time) ? 0x100000001 : (lock_time) >>> 0, isLikeNone(expiry_height) ? 0x100000001 : (expiry_height) >>> 0);
|
|
1074
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1075
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1076
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1077
|
+
if (r2) {
|
|
1078
|
+
throw takeObject(r1);
|
|
1079
|
+
}
|
|
1080
|
+
return BitGoPsbt.__wrap(r0);
|
|
1081
|
+
} finally {
|
|
1082
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1083
|
+
}
|
|
1084
|
+
}
|
|
1085
|
+
/**
|
|
1086
|
+
* Create an empty Zcash **v6 (Ironwood)** shielding PSBT, with the consensus branch id
|
|
1087
|
+
* resolved from `block_height`. Transparent inputs/outputs are added with the usual
|
|
1088
|
+
* `add_wallet_input` / `add_wallet_output`; the shielded output and the v6 sign/combine
|
|
1089
|
+
* steps use the dedicated `add_ironwood_output` / `ironwood_v6_*` / `combine_ironwood_proof`
|
|
1090
|
+
* methods.
|
|
1091
|
+
* @param {string} network
|
|
1092
|
+
* @param {WasmRootWalletKeys} wallet_keys
|
|
1093
|
+
* @param {number} block_height
|
|
1094
|
+
* @param {number | null} [lock_time]
|
|
1095
|
+
* @param {number | null} [expiry_height]
|
|
1096
|
+
* @returns {BitGoPsbt}
|
|
1097
|
+
*/
|
|
1098
|
+
static create_empty_zcash_v6_at_height(network, wallet_keys, block_height, lock_time, expiry_height) {
|
|
1099
|
+
try {
|
|
1100
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1101
|
+
const ptr0 = passStringToWasm0(network, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1102
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1103
|
+
_assertClass(wallet_keys, WasmRootWalletKeys);
|
|
1104
|
+
wasm.bitgopsbt_create_empty_zcash_v6_at_height(retptr, ptr0, len0, wallet_keys.__wbg_ptr, block_height, isLikeNone(lock_time) ? 0x100000001 : (lock_time) >>> 0, isLikeNone(expiry_height) ? 0x100000001 : (expiry_height) >>> 0);
|
|
1105
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1106
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1107
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1108
|
+
if (r2) {
|
|
1109
|
+
throw takeObject(r1);
|
|
1110
|
+
}
|
|
1111
|
+
return BitGoPsbt.__wrap(r0);
|
|
1112
|
+
} finally {
|
|
1113
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1114
|
+
}
|
|
1115
|
+
}
|
|
957
1116
|
/**
|
|
958
1117
|
* @param {number} index
|
|
959
1118
|
* @param {any} key
|
|
@@ -1633,6 +1792,59 @@ class BitGoPsbt {
|
|
|
1633
1792
|
const ret = wasm.bitgopsbt_input_count(this.__wbg_ptr);
|
|
1634
1793
|
return ret >>> 0;
|
|
1635
1794
|
}
|
|
1795
|
+
/**
|
|
1796
|
+
* The ZIP-244 per-input transparent sighash (32 bytes) that the key controlling transparent
|
|
1797
|
+
* input `index` must sign.
|
|
1798
|
+
* @param {number} index
|
|
1799
|
+
* @returns {Uint8Array}
|
|
1800
|
+
*/
|
|
1801
|
+
ironwood_v6_transparent_sighash(index) {
|
|
1802
|
+
try {
|
|
1803
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1804
|
+
wasm.bitgopsbt_ironwood_v6_transparent_sighash(retptr, this.__wbg_ptr, index);
|
|
1805
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1806
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1807
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1808
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
1809
|
+
if (r3) {
|
|
1810
|
+
throw takeObject(r2);
|
|
1811
|
+
}
|
|
1812
|
+
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
1813
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
1814
|
+
return v1;
|
|
1815
|
+
} finally {
|
|
1816
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1817
|
+
}
|
|
1818
|
+
}
|
|
1819
|
+
/**
|
|
1820
|
+
* The canonical (display-order) ZIP-244 v6 txid as a lowercase hex string, matching the
|
|
1821
|
+
* `getId()` convention used elsewhere (see [`crate::wasm::zcash::ZcashV6Transaction::get_id`]).
|
|
1822
|
+
* @returns {string}
|
|
1823
|
+
*/
|
|
1824
|
+
ironwood_v6_txid() {
|
|
1825
|
+
let deferred2_0;
|
|
1826
|
+
let deferred2_1;
|
|
1827
|
+
try {
|
|
1828
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1829
|
+
wasm.bitgopsbt_ironwood_v6_txid(retptr, this.__wbg_ptr);
|
|
1830
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1831
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1832
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1833
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
1834
|
+
var ptr1 = r0;
|
|
1835
|
+
var len1 = r1;
|
|
1836
|
+
if (r3) {
|
|
1837
|
+
ptr1 = 0; len1 = 0;
|
|
1838
|
+
throw takeObject(r2);
|
|
1839
|
+
}
|
|
1840
|
+
deferred2_0 = ptr1;
|
|
1841
|
+
deferred2_1 = len1;
|
|
1842
|
+
return getStringFromWasm0(ptr1, len1);
|
|
1843
|
+
} finally {
|
|
1844
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1845
|
+
wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
|
|
1846
|
+
}
|
|
1847
|
+
}
|
|
1636
1848
|
/**
|
|
1637
1849
|
* Check if an input is a MuSig2 keypath input.
|
|
1638
1850
|
*
|
|
@@ -6731,6 +6943,20 @@ function zcash_branch_id_for_height(network, height) {
|
|
|
6731
6943
|
}
|
|
6732
6944
|
exports.zcash_branch_id_for_height = zcash_branch_id_for_height;
|
|
6733
6945
|
|
|
6946
|
+
/**
|
|
6947
|
+
* The Zcash v6 (Ironwood / NU6.3) version group id.
|
|
6948
|
+
*
|
|
6949
|
+
* Exported so the TypeScript layer can derive its `IRONWOOD_VERSION_GROUP_ID` from the Rust
|
|
6950
|
+
* constant instead of hard-coding a second copy: the two are used together to tell v6 PSBTs from
|
|
6951
|
+
* v4/Sapling ones, and a silent divergence would route v6 bytes down the v4 path.
|
|
6952
|
+
* @returns {number}
|
|
6953
|
+
*/
|
|
6954
|
+
function zcash_ironwood_version_group_id() {
|
|
6955
|
+
const ret = wasm.zcash_ironwood_version_group_id();
|
|
6956
|
+
return ret >>> 0;
|
|
6957
|
+
}
|
|
6958
|
+
exports.zcash_ironwood_version_group_id = zcash_ironwood_version_group_id;
|
|
6959
|
+
|
|
6734
6960
|
function __wbg_get_imports() {
|
|
6735
6961
|
const import0 = {
|
|
6736
6962
|
__proto__: null,
|
|
Binary file
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
+
export const __wbg_addressnamespace_free: (a: number, b: number) => void;
|
|
4
5
|
export const __wbg_inscriptionsnamespace_free: (a: number, b: number) => void;
|
|
6
|
+
export const __wbg_utxolibcompatnamespace_free: (a: number, b: number) => void;
|
|
5
7
|
export const __wbg_wasmdashtransaction_free: (a: number, b: number) => void;
|
|
6
8
|
export const __wbg_wasmecpair_free: (a: number, b: number) => void;
|
|
7
9
|
export const __wbg_wasmtransaction_free: (a: number, b: number) => void;
|
|
@@ -9,8 +11,12 @@ export const __wbg_wasmzcashtransaction_free: (a: number, b: number) => void;
|
|
|
9
11
|
export const __wbg_wrappsbt_free: (a: number, b: number) => void;
|
|
10
12
|
export const __wbg_zcashunifiedaddress_free: (a: number, b: number) => void;
|
|
11
13
|
export const __wbg_zcashv6transaction_free: (a: number, b: number) => void;
|
|
14
|
+
export const addressnamespace_from_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
15
|
+
export const addressnamespace_to_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
12
16
|
export const inscriptionsnamespace_create_inscription_reveal_data: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
13
17
|
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;
|
|
18
|
+
export const utxolibcompatnamespace_from_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
19
|
+
export const utxolibcompatnamespace_to_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
14
20
|
export const wasmdashtransaction_from_bytes: (a: number, b: number, c: number) => void;
|
|
15
21
|
export const wasmdashtransaction_get_inputs: (a: number, b: number) => void;
|
|
16
22
|
export const wasmdashtransaction_get_outputs: (a: number, b: number) => void;
|
|
@@ -93,6 +99,7 @@ export const wrappsbt_update_output_with_descriptor: (a: number, b: number, c: n
|
|
|
93
99
|
export const wrappsbt_validate_signature_at_input: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
94
100
|
export const wrappsbt_verify_signature_with_key: (a: number, b: number, c: number, d: number) => void;
|
|
95
101
|
export const zcash_branch_id_for_height: (a: number, b: number, c: number, d: number) => void;
|
|
102
|
+
export const zcash_ironwood_version_group_id: () => number;
|
|
96
103
|
export const zcashunifiedaddress_contains: (a: number, b: number, c: number, d: number) => void;
|
|
97
104
|
export const zcashunifiedaddress_orchardReceiver: (a: number, b: number) => void;
|
|
98
105
|
export const zcashunifiedaddress_parse: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
@@ -118,36 +125,12 @@ export const wasmzcashtransaction_lock_time: (a: number) => number;
|
|
|
118
125
|
export const wasmzcashtransaction_version: (a: number) => number;
|
|
119
126
|
export const wrappsbt_lock_time: (a: number) => number;
|
|
120
127
|
export const wrappsbt_version: (a: number) => number;
|
|
121
|
-
export const __wbg_addressnamespace_free: (a: number, b: number) => void;
|
|
122
|
-
export const __wbg_utxolibcompatnamespace_free: (a: number, b: number) => void;
|
|
123
|
-
export const __wbg_wasmdimensions_free: (a: number, b: number) => void;
|
|
124
128
|
export const __wbg_wasmutxonamespace_free: (a: number, b: number) => void;
|
|
125
|
-
export const
|
|
126
|
-
export const
|
|
129
|
+
export const __wbg_wrapdescriptor_free: (a: number, b: number) => void;
|
|
130
|
+
export const __wbg_wrapminiscript_free: (a: number, b: number) => void;
|
|
127
131
|
export const isInspectEnabled: () => number;
|
|
128
132
|
export const parsePsbtRawToJson: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
129
|
-
export const utxolibcompatnamespace_from_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
130
|
-
export const utxolibcompatnamespace_to_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
131
|
-
export const wasmdimensions_empty: () => number;
|
|
132
|
-
export const wasmdimensions_from_input: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
133
|
-
export const wasmdimensions_from_input_script_type: (a: number, b: number, c: number, d: number) => void;
|
|
134
|
-
export const wasmdimensions_from_output_script_length: (a: number) => number;
|
|
135
|
-
export const wasmdimensions_from_output_script_type: (a: number, b: number, c: number) => void;
|
|
136
|
-
export const wasmdimensions_from_psbt: (a: number, b: number) => void;
|
|
137
|
-
export const wasmdimensions_get_input_vsize: (a: number, b: number, c: number) => number;
|
|
138
|
-
export const wasmdimensions_get_input_weight: (a: number, b: number, c: number) => number;
|
|
139
|
-
export const wasmdimensions_get_output_vsize: (a: number) => number;
|
|
140
|
-
export const wasmdimensions_get_output_weight: (a: number) => number;
|
|
141
|
-
export const wasmdimensions_get_vsize: (a: number, b: number, c: number) => number;
|
|
142
|
-
export const wasmdimensions_get_weight: (a: number, b: number, c: number) => number;
|
|
143
|
-
export const wasmdimensions_has_segwit: (a: number) => number;
|
|
144
|
-
export const wasmdimensions_plus: (a: number, b: number) => number;
|
|
145
|
-
export const wasmdimensions_times: (a: number, b: number) => number;
|
|
146
133
|
export const wasmutxonamespace_get_wasm_utxo_version: (a: number) => void;
|
|
147
|
-
export const parsePsbtToJson: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
148
|
-
export const parseTxToJson: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
149
|
-
export const __wbg_wrapdescriptor_free: (a: number, b: number) => void;
|
|
150
|
-
export const __wbg_wrapminiscript_free: (a: number, b: number) => void;
|
|
151
134
|
export const wrapdescriptor_atDerivationIndex: (a: number, b: number, c: number) => void;
|
|
152
135
|
export const wrapdescriptor_descType: (a: number, b: number) => void;
|
|
153
136
|
export const wrapdescriptor_encode: (a: number, b: number) => void;
|
|
@@ -168,11 +151,14 @@ export const wrapminiscript_fromStringExt: (a: number, b: number, c: number, d:
|
|
|
168
151
|
export const wrapminiscript_node: (a: number, b: number) => void;
|
|
169
152
|
export const wrapminiscript_toAsmString: (a: number, b: number) => void;
|
|
170
153
|
export const wrapminiscript_toString: (a: number, b: number) => void;
|
|
154
|
+
export const parsePsbtToJson: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
155
|
+
export const parseTxToJson: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
171
156
|
export const __wbg_bip322namespace_free: (a: number, b: number) => void;
|
|
172
157
|
export const __wbg_bitgopsbt_free: (a: number, b: number) => void;
|
|
173
158
|
export const __wbg_fixedscriptwalletnamespace_free: (a: number, b: number) => void;
|
|
174
159
|
export const __wbg_messagenamespace_free: (a: number, b: number) => void;
|
|
175
160
|
export const __wbg_wasmbip32_free: (a: number, b: number) => void;
|
|
161
|
+
export const __wbg_wasmdimensions_free: (a: number, b: number) => void;
|
|
176
162
|
export const __wbg_wasmreplayprotection_free: (a: number, b: number) => void;
|
|
177
163
|
export const __wbg_wasmrootwalletkeys_free: (a: number, b: number) => void;
|
|
178
164
|
export const bip322namespace_add_bip322_input: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number) => void;
|
|
@@ -183,6 +169,8 @@ export const bip322namespace_verify_bip322_tx_input: (a: number, b: number, c: n
|
|
|
183
169
|
export const bip322namespace_verify_bip322_tx_input_with_pubkeys: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number) => void;
|
|
184
170
|
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;
|
|
185
171
|
export const bitgopsbt_add_input_at_index: (a: number, b: number, c: number, d: number, e: number, f: number, g: bigint, h: number, i: number, j: number, k: number, l: number) => void;
|
|
172
|
+
export const bitgopsbt_add_ironwood_output: (a: number, b: number, c: number, d: number, e: bigint, f: number, g: number, h: number, i: number, j: number, k: number) => void;
|
|
173
|
+
export const bitgopsbt_add_ironwood_v6_signature: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
186
174
|
export const bitgopsbt_add_output: (a: number, b: number, c: number, d: number, e: bigint) => void;
|
|
187
175
|
export const bitgopsbt_add_output_at_index: (a: number, b: number, c: number, d: number, e: number, f: bigint) => void;
|
|
188
176
|
export const bitgopsbt_add_output_with_address: (a: number, b: number, c: number, d: number, e: bigint) => void;
|
|
@@ -195,11 +183,14 @@ export const bitgopsbt_add_wallet_input_at_index: (a: number, b: number, c: numb
|
|
|
195
183
|
export const bitgopsbt_add_wallet_output: (a: number, b: number, c: number, d: number, e: bigint, f: number) => void;
|
|
196
184
|
export const bitgopsbt_add_wallet_output_at_index: (a: number, b: number, c: number, d: number, e: number, f: bigint, g: number) => void;
|
|
197
185
|
export const bitgopsbt_combine_inputs: (a: number, b: number, c: number, d: number) => void;
|
|
186
|
+
export const bitgopsbt_combine_ironwood_proof: (a: number, b: number, c: number, d: number) => void;
|
|
198
187
|
export const bitgopsbt_combine_musig2_nonces: (a: number, b: number, c: number) => void;
|
|
199
188
|
export const bitgopsbt_consensus_branch_id: (a: number) => number;
|
|
200
189
|
export const bitgopsbt_create_empty: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
201
190
|
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;
|
|
202
191
|
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;
|
|
192
|
+
export const bitgopsbt_create_empty_zcash_v6: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
193
|
+
export const bitgopsbt_create_empty_zcash_v6_at_height: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
203
194
|
export const bitgopsbt_delete_input_kv: (a: number, b: number, c: number, d: number) => void;
|
|
204
195
|
export const bitgopsbt_delete_kv: (a: number, b: number, c: number) => void;
|
|
205
196
|
export const bitgopsbt_delete_output_kv: (a: number, b: number, c: number, d: number) => void;
|
|
@@ -228,6 +219,8 @@ export const bitgopsbt_get_outputs: (a: number, b: number) => void;
|
|
|
228
219
|
export const bitgopsbt_get_outputs_with_address: (a: number, b: number) => void;
|
|
229
220
|
export const bitgopsbt_get_unsigned_tx: (a: number, b: number) => void;
|
|
230
221
|
export const bitgopsbt_input_count: (a: number) => number;
|
|
222
|
+
export const bitgopsbt_ironwood_v6_transparent_sighash: (a: number, b: number, c: number) => void;
|
|
223
|
+
export const bitgopsbt_ironwood_v6_txid: (a: number, b: number) => void;
|
|
231
224
|
export const bitgopsbt_is_musig2_input: (a: number, b: number) => number;
|
|
232
225
|
export const bitgopsbt_lock_time: (a: number) => number;
|
|
233
226
|
export const bitgopsbt_network: (a: number, b: number) => void;
|
|
@@ -288,6 +281,21 @@ export const wasmbip32_private_key: (a: number) => number;
|
|
|
288
281
|
export const wasmbip32_public_key: (a: number) => number;
|
|
289
282
|
export const wasmbip32_to_base58: (a: number, b: number) => void;
|
|
290
283
|
export const wasmbip32_to_wif: (a: number, b: number) => void;
|
|
284
|
+
export const wasmdimensions_empty: () => number;
|
|
285
|
+
export const wasmdimensions_from_input: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
286
|
+
export const wasmdimensions_from_input_script_type: (a: number, b: number, c: number, d: number) => void;
|
|
287
|
+
export const wasmdimensions_from_output_script_length: (a: number) => number;
|
|
288
|
+
export const wasmdimensions_from_output_script_type: (a: number, b: number, c: number) => void;
|
|
289
|
+
export const wasmdimensions_from_psbt: (a: number, b: number) => void;
|
|
290
|
+
export const wasmdimensions_get_input_vsize: (a: number, b: number, c: number) => number;
|
|
291
|
+
export const wasmdimensions_get_input_weight: (a: number, b: number, c: number) => number;
|
|
292
|
+
export const wasmdimensions_get_output_vsize: (a: number) => number;
|
|
293
|
+
export const wasmdimensions_get_output_weight: (a: number) => number;
|
|
294
|
+
export const wasmdimensions_get_vsize: (a: number, b: number, c: number) => number;
|
|
295
|
+
export const wasmdimensions_get_weight: (a: number, b: number, c: number) => number;
|
|
296
|
+
export const wasmdimensions_has_segwit: (a: number) => number;
|
|
297
|
+
export const wasmdimensions_plus: (a: number, b: number) => number;
|
|
298
|
+
export const wasmdimensions_times: (a: number, b: number) => number;
|
|
291
299
|
export const wasmreplayprotection_from_addresses: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
292
300
|
export const wasmreplayprotection_from_output_scripts: (a: number, b: number) => number;
|
|
293
301
|
export const wasmreplayprotection_from_public_keys: (a: number, b: number, c: number) => void;
|
|
@@ -3,6 +3,15 @@ import { BitGoPsbt, type CreateEmptyOptions, type HydrationUnspent } from "./Bit
|
|
|
3
3
|
import { ZcashTransaction, type ITransaction } from "../transaction.js";
|
|
4
4
|
/** Zcash network names */
|
|
5
5
|
export type ZcashNetworkName = "zcash" | "zcashTest" | "zec" | "tzec";
|
|
6
|
+
/**
|
|
7
|
+
* Zcash v6 (Ironwood) version group id (0xd884b698). Its presence marks a PSBT as v6 — see
|
|
8
|
+
* `ZcashIronwoodBitGoPsbt`.
|
|
9
|
+
*
|
|
10
|
+
* Read from the wasm layer rather than hard-coded, so it cannot drift from
|
|
11
|
+
* `ZCASH_IRONWOOD_VERSION_GROUP_ID` in `src/zcash/transaction.rs`: a divergence would make the
|
|
12
|
+
* v4/v6 discrimination in {@link ZcashBitGoPsbt.fromBytes} silently classify v6 bytes as v4.
|
|
13
|
+
*/
|
|
14
|
+
export declare const IRONWOOD_VERSION_GROUP_ID: number;
|
|
6
15
|
/** Options for creating an empty Zcash PSBT (preferred method using block height) */
|
|
7
16
|
export type CreateEmptyZcashOptions = CreateEmptyOptions & {
|
|
8
17
|
/** Block height to determine consensus branch ID automatically */
|
|
@@ -98,6 +107,8 @@ export declare class ZcashBitGoPsbt extends BitGoPsbt {
|
|
|
98
107
|
*
|
|
99
108
|
* @param bytes - The PSBT bytes
|
|
100
109
|
* @param network - Zcash network name ("zcash", "zcashTest", "zec", "tzec")
|
|
110
|
+
* @throws Error if the deserialized PSBT is a v6 (Ironwood) PSBT — use
|
|
111
|
+
* {@link ZcashIronwoodBitGoPsbt.fromBytes} instead
|
|
101
112
|
* @returns A ZcashBitGoPsbt instance
|
|
102
113
|
*/
|
|
103
114
|
static fromBytes(bytes: Uint8Array, network: ZcashNetworkName): ZcashBitGoPsbt;
|
|
@@ -1,7 +1,16 @@
|
|
|
1
|
-
import { BitGoPsbt as WasmBitGoPsbt, zcash_branch_id_for_height } from "../wasm/wasm_utxo.js";
|
|
1
|
+
import { BitGoPsbt as WasmBitGoPsbt, zcash_branch_id_for_height, zcash_ironwood_version_group_id, } from "../wasm/wasm_utxo.js";
|
|
2
2
|
import { RootWalletKeys } from "./RootWalletKeys.js";
|
|
3
3
|
import { BitGoPsbt } from "./BitGoPsbt.js";
|
|
4
4
|
import { ZcashTransaction } from "../transaction.js";
|
|
5
|
+
/**
|
|
6
|
+
* Zcash v6 (Ironwood) version group id (0xd884b698). Its presence marks a PSBT as v6 — see
|
|
7
|
+
* `ZcashIronwoodBitGoPsbt`.
|
|
8
|
+
*
|
|
9
|
+
* Read from the wasm layer rather than hard-coded, so it cannot drift from
|
|
10
|
+
* `ZCASH_IRONWOOD_VERSION_GROUP_ID` in `src/zcash/transaction.rs`: a divergence would make the
|
|
11
|
+
* v4/v6 discrimination in {@link ZcashBitGoPsbt.fromBytes} silently classify v6 bytes as v4.
|
|
12
|
+
*/
|
|
13
|
+
export const IRONWOOD_VERSION_GROUP_ID = zcash_ironwood_version_group_id();
|
|
5
14
|
/**
|
|
6
15
|
* Zcash-specific PSBT implementation
|
|
7
16
|
*
|
|
@@ -87,11 +96,17 @@ export class ZcashBitGoPsbt extends BitGoPsbt {
|
|
|
87
96
|
*
|
|
88
97
|
* @param bytes - The PSBT bytes
|
|
89
98
|
* @param network - Zcash network name ("zcash", "zcashTest", "zec", "tzec")
|
|
99
|
+
* @throws Error if the deserialized PSBT is a v6 (Ironwood) PSBT — use
|
|
100
|
+
* {@link ZcashIronwoodBitGoPsbt.fromBytes} instead
|
|
90
101
|
* @returns A ZcashBitGoPsbt instance
|
|
91
102
|
*/
|
|
92
103
|
static fromBytes(bytes, network) {
|
|
93
104
|
const wasm = WasmBitGoPsbt.from_bytes(bytes, network);
|
|
94
|
-
|
|
105
|
+
const psbt = new ZcashBitGoPsbt(wasm);
|
|
106
|
+
if (psbt.versionGroupId === IRONWOOD_VERSION_GROUP_ID) {
|
|
107
|
+
throw new Error("this is a v6 (Ironwood) PSBT: use ZcashIronwoodBitGoPsbt.fromBytes instead");
|
|
108
|
+
}
|
|
109
|
+
return psbt;
|
|
95
110
|
}
|
|
96
111
|
/**
|
|
97
112
|
* Reconstruct a Zcash PSBT from a network-format transaction (unsigned, half-signed, or fully-signed).
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { type WalletKeysArg } from "./RootWalletKeys.js";
|
|
2
|
+
import { ZcashBitGoPsbt, type ZcashNetworkName } from "./ZcashBitGoPsbt.js";
|
|
3
|
+
/**
|
|
4
|
+
* Options for creating an empty Zcash v6 (Ironwood) shielding PSBT.
|
|
5
|
+
*
|
|
6
|
+
* Deliberately narrower than `CreateEmptyZcashOptions`: `version` and `versionGroupId` are fixed by
|
|
7
|
+
* the v6 format, so accepting them would only let a caller ask for something that is then ignored.
|
|
8
|
+
*/
|
|
9
|
+
export type CreateEmptyIronwoodOptions = {
|
|
10
|
+
/** Block height to determine the consensus branch ID automatically (at/after NU6.3 activation) */
|
|
11
|
+
blockHeight: number;
|
|
12
|
+
/** Lock time (default: 0) */
|
|
13
|
+
lockTime?: number;
|
|
14
|
+
/** Zcash transaction expiry height */
|
|
15
|
+
expiryHeight?: number;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Options for creating an empty Zcash v6 (Ironwood) shielding PSBT with an explicit consensus
|
|
19
|
+
* branch ID.
|
|
20
|
+
*
|
|
21
|
+
* Like {@link CreateEmptyIronwoodOptions}, this omits `version` and `versionGroupId` — both are
|
|
22
|
+
* fixed by the v6 format. The consensus branch ID is *not* fixed: it tracks the active network
|
|
23
|
+
* upgrade, so it stays a caller-supplied parameter exactly as it is for v4.
|
|
24
|
+
*/
|
|
25
|
+
export type CreateEmptyIronwoodWithConsensusBranchIdOptions = {
|
|
26
|
+
/** Zcash consensus branch ID (e.g. the NU6.3 branch ID) */
|
|
27
|
+
consensusBranchId: number;
|
|
28
|
+
/** Lock time (default: 0) */
|
|
29
|
+
lockTime?: number;
|
|
30
|
+
/** Zcash transaction expiry height */
|
|
31
|
+
expiryHeight?: number;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* A fresh ZIP-302 "no memo" memo field: the `0xf6` marker byte followed by 511 zero bytes. The
|
|
35
|
+
* default for {@link ZcashIronwoodBitGoPsbt.addShieldedOutput}'s `memo` option.
|
|
36
|
+
*
|
|
37
|
+
* Not the same as an all-zeros memo, which decodes as a *text* memo holding the empty string and is
|
|
38
|
+
* rendered as such by wallets. Exported so callers can pass it explicitly, and so the distinction is
|
|
39
|
+
* visible rather than buried in a default.
|
|
40
|
+
*
|
|
41
|
+
* A function rather than a shared constant: a module-level `Uint8Array` is mutable, so one caller
|
|
42
|
+
* writing into it would silently change the default memo for every later output.
|
|
43
|
+
*/
|
|
44
|
+
export declare function zip302NoMemo(): Uint8Array;
|
|
45
|
+
/**
|
|
46
|
+
* A Zcash **v6 (Ironwood / NU6.3)** shielding PSBT.
|
|
47
|
+
*
|
|
48
|
+
* Distinct from the generic `ZcashBitGoPsbt` (v4/Sapling-shaped transactions): a v6 PSBT carries
|
|
49
|
+
* its shielded side as an orchard PCZT in the proprietary map rather than Sapling fields, and its
|
|
50
|
+
* lifecycle mirrors the microservice build → sign → combine flow rather than the v4 ZIP-243
|
|
51
|
+
* signing path.
|
|
52
|
+
*
|
|
53
|
+
* Method names carry no `ironwood` prefix — the class name already says it. They follow the base
|
|
54
|
+
* `BitGoPsbt` vocabulary (`createEmpty`, `fromBytes`, `addOutput`-style adders, `getId`) so the v6
|
|
55
|
+
* surface reads the same as the v4 one; the wasm bindings keep their `ironwood_v6_*` names because
|
|
56
|
+
* they live on the single flat `BitGoPsbt` struct, where the prefix is what disambiguates them.
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```typescript
|
|
60
|
+
* const psbt = ZcashIronwoodBitGoPsbt.createEmpty("zcash", walletKeys, { blockHeight });
|
|
61
|
+
* psbt.addWalletInput(...);
|
|
62
|
+
* psbt.addWalletOutput(...);
|
|
63
|
+
* psbt.addShieldedOutput(recipient, amount, { anchor });
|
|
64
|
+
* const sighash = psbt.transparentSighash(0);
|
|
65
|
+
* // ... sign sighash externally, then:
|
|
66
|
+
* psbt.addTransparentSignature(0, pubkey, sig);
|
|
67
|
+
* const tx = psbt.combineProof(proof);
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
export declare class ZcashIronwoodBitGoPsbt extends ZcashBitGoPsbt {
|
|
71
|
+
/**
|
|
72
|
+
* Create an empty Zcash **v6 (Ironwood)** shielding PSBT, with the consensus branch ID
|
|
73
|
+
* determined from block height.
|
|
74
|
+
*
|
|
75
|
+
* Add transparent inputs/outputs with the usual `addWalletInput` / `addWalletOutput`, the
|
|
76
|
+
* shielded output with {@link addShieldedOutput}, then sign the transparent inputs over
|
|
77
|
+
* {@link transparentSighash} and finish with {@link combineProof}.
|
|
78
|
+
*
|
|
79
|
+
* @param network - Zcash network name ("zcash", "zcashTest", "zec", "tzec")
|
|
80
|
+
* @param walletKeys - The wallet's root keys (sets global xpubs in the PSBT)
|
|
81
|
+
* @param options - Options including blockHeight (at/after NU6.3 activation)
|
|
82
|
+
*/
|
|
83
|
+
static createEmpty(network: ZcashNetworkName, walletKeys: WalletKeysArg, options: CreateEmptyIronwoodOptions): ZcashIronwoodBitGoPsbt;
|
|
84
|
+
/**
|
|
85
|
+
* Create an empty Zcash **v6 (Ironwood)** shielding PSBT with an explicit consensus branch ID.
|
|
86
|
+
*
|
|
87
|
+
* **Advanced use only.** Prefer {@link createEmpty}, which derives the branch ID from a block
|
|
88
|
+
* height and rejects heights before NU6.3 activation. Reach for this only when you already know
|
|
89
|
+
* the branch ID — regtest, a future upgrade, or replaying a known-good value.
|
|
90
|
+
*
|
|
91
|
+
* Only the *version group ID* is fixed by the v6 format; the consensus branch ID tracks the active
|
|
92
|
+
* network upgrade and remains caller-supplied, exactly as for v4.
|
|
93
|
+
*
|
|
94
|
+
* @param network - Zcash network name ("zcash", "zcashTest", "zec", "tzec")
|
|
95
|
+
* @param walletKeys - The wallet's root keys (sets global xpubs in the PSBT)
|
|
96
|
+
* @param options - Options including the required consensusBranchId
|
|
97
|
+
*/
|
|
98
|
+
static createEmptyWithConsensusBranchId(network: ZcashNetworkName, walletKeys: WalletKeysArg, options: CreateEmptyIronwoodWithConsensusBranchIdOptions): ZcashIronwoodBitGoPsbt;
|
|
99
|
+
/**
|
|
100
|
+
* Not applicable to v6, and not implementable: a broadcast v6 transaction carries the shielded
|
|
101
|
+
* side as a proof plus a binding signature, while every v6 operation here needs the PCZT — which
|
|
102
|
+
* holds witness data (`rseed`, `rcv`, `alpha`, the note plaintext) that is deliberately *not*
|
|
103
|
+
* recoverable from the transaction. Decoding the transparent skeleton alone would yield a PSBT
|
|
104
|
+
* that `getId`, `transparentSighash`, `combineProof`, and even `serialize`/{@link fromBytes} all
|
|
105
|
+
* reject. Inherited only because JS statics are inherited.
|
|
106
|
+
*/
|
|
107
|
+
static fromNetworkFormat(): never;
|
|
108
|
+
/**
|
|
109
|
+
* Not applicable to v6: the legacy half-signed format is a v4-era p2ms encoding with no way to
|
|
110
|
+
* carry the PCZT, and no v6 transaction has ever been produced in it. Inherited only because JS
|
|
111
|
+
* statics are inherited.
|
|
112
|
+
*/
|
|
113
|
+
static fromHalfSignedLegacyTransaction(): never;
|
|
114
|
+
/**
|
|
115
|
+
* Deserialize a v6 (Ironwood) Zcash PSBT from bytes.
|
|
116
|
+
*
|
|
117
|
+
* @param bytes - The PSBT bytes
|
|
118
|
+
* @param network - Zcash network name ("zcash", "zcashTest", "zec", "tzec")
|
|
119
|
+
* @throws Error if the deserialized PSBT is not a v6 (Ironwood) PSBT
|
|
120
|
+
* @returns A ZcashIronwoodBitGoPsbt instance
|
|
121
|
+
*/
|
|
122
|
+
static fromBytes(bytes: Uint8Array, network: ZcashNetworkName): ZcashIronwoodBitGoPsbt;
|
|
123
|
+
/**
|
|
124
|
+
* Add the shielded output (Constructor role). Stores the orchard PCZT in the PSBT.
|
|
125
|
+
*
|
|
126
|
+
* Named for the shielded/transparent split rather than the note type, leaving room for a
|
|
127
|
+
* transparent-output variant alongside the inherited `addOutput` / `addWalletOutput`.
|
|
128
|
+
*
|
|
129
|
+
* @param recipient - 43-byte raw Orchard/Ironwood address
|
|
130
|
+
* @param amount - note value in zatoshi
|
|
131
|
+
* @param options.anchor - 32-byte Ironwood note-commitment-tree root
|
|
132
|
+
* @param options.memo - optional 512-byte memo (defaults to the ZIP-302 "no memo" encoding)
|
|
133
|
+
* @param options.ovk - optional 32-byte outgoing viewing key (omit for a keyless build)
|
|
134
|
+
*/
|
|
135
|
+
addShieldedOutput(recipient: Uint8Array, amount: bigint, options: {
|
|
136
|
+
anchor: Uint8Array;
|
|
137
|
+
memo?: Uint8Array;
|
|
138
|
+
ovk?: Uint8Array;
|
|
139
|
+
}): void;
|
|
140
|
+
/**
|
|
141
|
+
* The canonical (display-order) ZIP-244 v6 txid as a lowercase hex string, matching
|
|
142
|
+
* `ITransaction.getId()`. Defined once the transparent inputs/outputs and the shielded output are
|
|
143
|
+
* in place; unchanged by signing or proving.
|
|
144
|
+
*/
|
|
145
|
+
getId(): string;
|
|
146
|
+
/**
|
|
147
|
+
* The ZIP-244 per-input transparent sighash (32 bytes) the key controlling transparent input
|
|
148
|
+
* `index` must sign.
|
|
149
|
+
*/
|
|
150
|
+
transparentSighash(index: number): Uint8Array;
|
|
151
|
+
/**
|
|
152
|
+
* Ingest a transparent-input signature returned by the client/HSM, after verifying it against
|
|
153
|
+
* {@link transparentSighash} for that input.
|
|
154
|
+
*
|
|
155
|
+
* @param index - transparent input index
|
|
156
|
+
* @param pubkey - the signing public key
|
|
157
|
+
* @param sig - DER ECDSA signature with the trailing SIGHASH_ALL byte (as in a scriptSig)
|
|
158
|
+
*/
|
|
159
|
+
addTransparentSignature(index: number, pubkey: Uint8Array, sig: Uint8Array): void;
|
|
160
|
+
/**
|
|
161
|
+
* Transaction Extractor role: given the external prover's `proof` bytes, finalize the
|
|
162
|
+
* transparent inputs, apply the shielded binding signature, and return the broadcast-ready v6
|
|
163
|
+
* transaction bytes. Requires every transparent input to be signed via
|
|
164
|
+
* {@link addTransparentSignature}.
|
|
165
|
+
*
|
|
166
|
+
* Terminal: the wasm binding drops the stored PCZT on success, so any later v6 call on this PSBT
|
|
167
|
+
* throws — including after a `serialize`/{@link fromBytes} round-trip, since the PCZT is gone
|
|
168
|
+
* from the bytes too. Build a fresh PSBT instead. On failure nothing is dropped, so a call that
|
|
169
|
+
* errors (bad proof, unsigned input) leaves the PSBT retryable.
|
|
170
|
+
*/
|
|
171
|
+
combineProof(proof: Uint8Array): Uint8Array;
|
|
172
|
+
}
|