@bitgo/wasm-utxo 4.41.0 → 5.1.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/address.d.ts +3 -7
- package/dist/cjs/js/address.js +4 -8
- package/dist/cjs/js/descriptorWallet/psbt/findDescriptors.js +16 -12
- package/dist/cjs/js/fixedScriptWallet/Dimensions.d.ts +5 -16
- package/dist/cjs/js/fixedScriptWallet/Dimensions.js +2 -2
- package/dist/cjs/js/fixedScriptWallet/ZcashDimensions.d.ts +45 -0
- package/dist/cjs/js/fixedScriptWallet/ZcashDimensions.js +30 -0
- package/dist/cjs/js/fixedScriptWallet/ZcashUnifiedAddress.d.ts +16 -0
- package/dist/cjs/js/fixedScriptWallet/ZcashUnifiedAddress.js +20 -0
- package/dist/cjs/js/index.d.ts +18 -0
- package/dist/cjs/js/index.js +4 -1
- package/dist/cjs/js/psbt.d.ts +2 -1
- package/dist/cjs/js/psbtBase.d.ts +3 -1
- package/dist/cjs/js/psbtBase.js +3 -0
- package/dist/cjs/js/wasm/wasm_utxo.d.ts +55 -5
- package/dist/cjs/js/wasm/wasm_utxo.js +174 -7
- package/dist/cjs/js/wasm/wasm_utxo_bg.wasm +0 -0
- package/dist/cjs/js/wasm/wasm_utxo_bg.wasm.d.ts +93 -85
- package/dist/cjs/js/zcashAddress.d.ts +44 -0
- package/dist/cjs/js/zcashAddress.js +58 -0
- package/dist/esm/js/address.d.ts +3 -7
- package/dist/esm/js/address.js +4 -8
- package/dist/esm/js/descriptorWallet/psbt/findDescriptors.js +16 -12
- package/dist/esm/js/fixedScriptWallet/Dimensions.d.ts +5 -16
- package/dist/esm/js/fixedScriptWallet/Dimensions.js +2 -2
- package/dist/esm/js/fixedScriptWallet/ZcashDimensions.d.ts +45 -0
- package/dist/esm/js/fixedScriptWallet/ZcashDimensions.js +26 -0
- package/dist/esm/js/fixedScriptWallet/ZcashUnifiedAddress.d.ts +16 -0
- package/dist/esm/js/fixedScriptWallet/ZcashUnifiedAddress.js +20 -0
- package/dist/esm/js/index.d.ts +18 -0
- package/dist/esm/js/index.js +2 -0
- package/dist/esm/js/psbt.d.ts +2 -1
- package/dist/esm/js/psbtBase.d.ts +3 -1
- package/dist/esm/js/psbtBase.js +3 -0
- package/dist/esm/js/wasm/wasm_utxo.d.ts +55 -5
- package/dist/esm/js/wasm/wasm_utxo.js +1 -1
- package/dist/esm/js/wasm/wasm_utxo_bg.js +170 -7
- package/dist/esm/js/wasm/wasm_utxo_bg.wasm +0 -0
- package/dist/esm/js/wasm/wasm_utxo_bg.wasm.d.ts +93 -85
- package/dist/esm/js/zcashAddress.d.ts +44 -0
- package/dist/esm/js/zcashAddress.js +52 -0
- package/package.json +1 -1
|
@@ -48,23 +48,19 @@ class AddressNamespace {
|
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
/**
|
|
51
|
-
*
|
|
52
|
-
* Orchard/Ironwood receiver, returns that raw 43-byte receiver instead of a transparent
|
|
53
|
-
* scriptPubKey. See [`to_output_script_or_shielded_receiver_with_coin`] for the exact
|
|
54
|
-
* fallback/error rules.
|
|
51
|
+
* Convert `address` to its scriptPubKey bytes for `coin`.
|
|
55
52
|
* @param {string} address
|
|
56
53
|
* @param {string} coin
|
|
57
|
-
* @param {boolean | null} [can_be_shielded_output]
|
|
58
54
|
* @returns {Uint8Array}
|
|
59
55
|
*/
|
|
60
|
-
static to_output_script_with_coin(address, coin
|
|
56
|
+
static to_output_script_with_coin(address, coin) {
|
|
61
57
|
try {
|
|
62
58
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
63
59
|
const ptr0 = passStringToWasm0(address, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
64
60
|
const len0 = WASM_VECTOR_LEN;
|
|
65
61
|
const ptr1 = passStringToWasm0(coin, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
66
62
|
const len1 = WASM_VECTOR_LEN;
|
|
67
|
-
wasm.addressnamespace_to_output_script_with_coin(retptr, ptr0, len0, ptr1, len1
|
|
63
|
+
wasm.addressnamespace_to_output_script_with_coin(retptr, ptr0, len0, ptr1, len1);
|
|
68
64
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
69
65
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
70
66
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -1695,6 +1691,25 @@ class BitGoPsbt {
|
|
|
1695
1691
|
const ret = wasm.bitgopsbt_get_global_xpubs(this.__wbg_ptr);
|
|
1696
1692
|
return takeObject(ret);
|
|
1697
1693
|
}
|
|
1694
|
+
/**
|
|
1695
|
+
* @param {number} index
|
|
1696
|
+
* @returns {any}
|
|
1697
|
+
*/
|
|
1698
|
+
get_input_key_values(index) {
|
|
1699
|
+
try {
|
|
1700
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1701
|
+
wasm.bitgopsbt_get_input_key_values(retptr, this.__wbg_ptr, index);
|
|
1702
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1703
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1704
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1705
|
+
if (r2) {
|
|
1706
|
+
throw takeObject(r1);
|
|
1707
|
+
}
|
|
1708
|
+
return takeObject(r0);
|
|
1709
|
+
} finally {
|
|
1710
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1711
|
+
}
|
|
1712
|
+
}
|
|
1698
1713
|
/**
|
|
1699
1714
|
* @param {number} index
|
|
1700
1715
|
* @param {any} key
|
|
@@ -6109,6 +6124,25 @@ class WrapPsbt {
|
|
|
6109
6124
|
const ret = wasm.wrappsbt_get_global_xpubs(this.__wbg_ptr);
|
|
6110
6125
|
return takeObject(ret);
|
|
6111
6126
|
}
|
|
6127
|
+
/**
|
|
6128
|
+
* @param {number} index
|
|
6129
|
+
* @returns {any}
|
|
6130
|
+
*/
|
|
6131
|
+
get_input_key_values(index) {
|
|
6132
|
+
try {
|
|
6133
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
6134
|
+
wasm.wrappsbt_get_input_key_values(retptr, this.__wbg_ptr, index);
|
|
6135
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
6136
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
6137
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
6138
|
+
if (r2) {
|
|
6139
|
+
throw takeObject(r1);
|
|
6140
|
+
}
|
|
6141
|
+
return takeObject(r0);
|
|
6142
|
+
} finally {
|
|
6143
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
6144
|
+
}
|
|
6145
|
+
}
|
|
6112
6146
|
/**
|
|
6113
6147
|
* @param {number} index
|
|
6114
6148
|
* @param {any} key
|
|
@@ -6818,6 +6852,28 @@ class ZcashUnifiedAddress {
|
|
|
6818
6852
|
wasm.__wbindgen_export4(deferred4_0, deferred4_1, 1);
|
|
6819
6853
|
}
|
|
6820
6854
|
}
|
|
6855
|
+
/**
|
|
6856
|
+
* Whether this Unified Address carries an Orchard/Ironwood receiver.
|
|
6857
|
+
*
|
|
6858
|
+
* Equivalent to `orchardReceiver !== undefined`, without cloning the receiver bytes
|
|
6859
|
+
* when the caller only needs presence.
|
|
6860
|
+
* @returns {boolean}
|
|
6861
|
+
*/
|
|
6862
|
+
get hasOrchardReceiver() {
|
|
6863
|
+
const ret = wasm.zcashunifiedaddress_hasOrchardReceiver(this.__wbg_ptr);
|
|
6864
|
+
return ret !== 0;
|
|
6865
|
+
}
|
|
6866
|
+
/**
|
|
6867
|
+
* Whether this Unified Address carries a transparent (P2PKH/P2SH) receiver.
|
|
6868
|
+
*
|
|
6869
|
+
* Equivalent to `transparentScript !== undefined`, without cloning the script bytes
|
|
6870
|
+
* when the caller only needs presence.
|
|
6871
|
+
* @returns {boolean}
|
|
6872
|
+
*/
|
|
6873
|
+
get hasTransparentReceiver() {
|
|
6874
|
+
const ret = wasm.zcashunifiedaddress_hasTransparentReceiver(this.__wbg_ptr);
|
|
6875
|
+
return ret !== 0;
|
|
6876
|
+
}
|
|
6821
6877
|
/**
|
|
6822
6878
|
* The Orchard/Ironwood receiver's raw 43 bytes (diversifier + pk_d), or `undefined`.
|
|
6823
6879
|
* @returns {Uint8Array | undefined}
|
|
@@ -7330,6 +7386,117 @@ function parseTxToJson(tx_bytes, coin_name) {
|
|
|
7330
7386
|
}
|
|
7331
7387
|
exports.parseTxToJson = parseTxToJson;
|
|
7332
7388
|
|
|
7389
|
+
/**
|
|
7390
|
+
* Whether `address` is a ZIP-316 unified address for `coin`'s network carrying an
|
|
7391
|
+
* Orchard/Ironwood receiver. `false` (never throws) for a malformed/wrong-network unified
|
|
7392
|
+
* address, an ordinary address, or a UA with no Orchard/Ironwood receiver.
|
|
7393
|
+
* @param {string} address
|
|
7394
|
+
* @param {string} coin
|
|
7395
|
+
* @returns {boolean}
|
|
7396
|
+
*/
|
|
7397
|
+
function zcashHasOrchardReceiver(address, coin) {
|
|
7398
|
+
const ptr0 = passStringToWasm0(address, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
7399
|
+
const len0 = WASM_VECTOR_LEN;
|
|
7400
|
+
const ptr1 = passStringToWasm0(coin, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
7401
|
+
const len1 = WASM_VECTOR_LEN;
|
|
7402
|
+
const ret = wasm.zcashHasOrchardReceiver(ptr0, len0, ptr1, len1);
|
|
7403
|
+
return ret !== 0;
|
|
7404
|
+
}
|
|
7405
|
+
exports.zcashHasOrchardReceiver = zcashHasOrchardReceiver;
|
|
7406
|
+
|
|
7407
|
+
/**
|
|
7408
|
+
* Whether `address` has a usable transparent receiver for `coin`'s network: either it's a
|
|
7409
|
+
* unified address carrying a transparent receiver, or it's itself a valid transparent address
|
|
7410
|
+
* for `coin`. `false` (never throws) otherwise.
|
|
7411
|
+
* @param {string} address
|
|
7412
|
+
* @param {string} coin
|
|
7413
|
+
* @returns {boolean}
|
|
7414
|
+
*/
|
|
7415
|
+
function zcashHasTransparentReceiver(address, coin) {
|
|
7416
|
+
const ptr0 = passStringToWasm0(address, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
7417
|
+
const len0 = WASM_VECTOR_LEN;
|
|
7418
|
+
const ptr1 = passStringToWasm0(coin, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
7419
|
+
const len1 = WASM_VECTOR_LEN;
|
|
7420
|
+
const ret = wasm.zcashHasTransparentReceiver(ptr0, len0, ptr1, len1);
|
|
7421
|
+
return ret !== 0;
|
|
7422
|
+
}
|
|
7423
|
+
exports.zcashHasTransparentReceiver = zcashHasTransparentReceiver;
|
|
7424
|
+
|
|
7425
|
+
/**
|
|
7426
|
+
* @param {string} address
|
|
7427
|
+
* @param {string} coin
|
|
7428
|
+
* @returns {Uint8Array}
|
|
7429
|
+
*/
|
|
7430
|
+
function zcashToShieldedReceiverWithCoin(address, coin) {
|
|
7431
|
+
try {
|
|
7432
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
7433
|
+
const ptr0 = passStringToWasm0(address, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
7434
|
+
const len0 = WASM_VECTOR_LEN;
|
|
7435
|
+
const ptr1 = passStringToWasm0(coin, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
7436
|
+
const len1 = WASM_VECTOR_LEN;
|
|
7437
|
+
wasm.zcashToShieldedReceiverWithCoin(retptr, ptr0, len0, ptr1, len1);
|
|
7438
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
7439
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
7440
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
7441
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
7442
|
+
if (r3) {
|
|
7443
|
+
throw takeObject(r2);
|
|
7444
|
+
}
|
|
7445
|
+
var v3 = getArrayU8FromWasm0(r0, r1).slice();
|
|
7446
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
7447
|
+
return v3;
|
|
7448
|
+
} finally {
|
|
7449
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
7450
|
+
}
|
|
7451
|
+
}
|
|
7452
|
+
exports.zcashToShieldedReceiverWithCoin = zcashToShieldedReceiverWithCoin;
|
|
7453
|
+
|
|
7454
|
+
/**
|
|
7455
|
+
* Resolve the Orchard/Ironwood receiver of a ZIP-316 unified address for `coin`'s network, as
|
|
7456
|
+
* its raw 43 bytes (diversifier + `pk_d`) — there is no scriptPubKey for a shielded output, so
|
|
7457
|
+
* this can't return script bytes uniformly and returns raw receiver bytes instead.
|
|
7458
|
+
*
|
|
7459
|
+
* A UA that has no Orchard/Ironwood receiver (e.g. Sapling-only) throws rather than falling back
|
|
7460
|
+
* to the transparent receiver. If `address` merely looks like a unified address for this coin's
|
|
7461
|
+
* network (right Bech32m HRP) but is malformed, this also throws. `address` must be a unified
|
|
7462
|
+
* address — an ordinary transparent address is rejected, since it can never carry a shielded
|
|
7463
|
+
* receiver; use {@link toOutputScriptWithCoin} in `js/address.ts` for the transparent case.
|
|
7464
|
+
* Resolve the transparent receiver of an `address` for `coin`'s network, as its scriptPubKey
|
|
7465
|
+
* bytes. When `address` is a ZIP-316 unified address, resolves its transparent receiver rather
|
|
7466
|
+
* than rejecting the UA string outright — a UA with no transparent receiver (e.g. Orchard-only)
|
|
7467
|
+
* throws rather than falling back to a shielded one. An ordinary (non-UA) address falls through
|
|
7468
|
+
* to the same transparent codec path as any other coin.
|
|
7469
|
+
*
|
|
7470
|
+
* This is the zcash-aware counterpart of `toOutputScriptWithCoin` in `js/address.ts`, which
|
|
7471
|
+
* dispatches here for zcash/tzec so that non-zcash coins never pay for a unified-address check.
|
|
7472
|
+
* @param {string} address
|
|
7473
|
+
* @param {string} coin
|
|
7474
|
+
* @returns {Uint8Array}
|
|
7475
|
+
*/
|
|
7476
|
+
function zcashToTransparentReceiverWithCoin(address, coin) {
|
|
7477
|
+
try {
|
|
7478
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
7479
|
+
const ptr0 = passStringToWasm0(address, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
7480
|
+
const len0 = WASM_VECTOR_LEN;
|
|
7481
|
+
const ptr1 = passStringToWasm0(coin, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
7482
|
+
const len1 = WASM_VECTOR_LEN;
|
|
7483
|
+
wasm.zcashToTransparentReceiverWithCoin(retptr, ptr0, len0, ptr1, len1);
|
|
7484
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
7485
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
7486
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
7487
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
7488
|
+
if (r3) {
|
|
7489
|
+
throw takeObject(r2);
|
|
7490
|
+
}
|
|
7491
|
+
var v3 = getArrayU8FromWasm0(r0, r1).slice();
|
|
7492
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
7493
|
+
return v3;
|
|
7494
|
+
} finally {
|
|
7495
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
7496
|
+
}
|
|
7497
|
+
}
|
|
7498
|
+
exports.zcashToTransparentReceiverWithCoin = zcashToTransparentReceiverWithCoin;
|
|
7499
|
+
|
|
7333
7500
|
/**
|
|
7334
7501
|
* Return the Zcash consensus branch ID active at `height` on `network`.
|
|
7335
7502
|
*
|
|
Binary file
|
|
@@ -1,18 +1,57 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
-
export const
|
|
5
|
-
export const
|
|
6
|
-
export const
|
|
7
|
-
export const
|
|
8
|
-
export const
|
|
9
|
-
export const
|
|
10
|
-
export const
|
|
11
|
-
export const
|
|
4
|
+
export const __wbg_wrapdescriptor_free: (a: number, b: number) => void;
|
|
5
|
+
export const __wbg_wrapminiscript_free: (a: number, b: number) => void;
|
|
6
|
+
export const wrapdescriptor_atDerivationIndex: (a: number, b: number, c: number) => void;
|
|
7
|
+
export const wrapdescriptor_descType: (a: number, b: number) => void;
|
|
8
|
+
export const wrapdescriptor_encode: (a: number, b: number) => void;
|
|
9
|
+
export const wrapdescriptor_fromString: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
10
|
+
export const wrapdescriptor_fromStringDetectType: (a: number, b: number, c: number) => void;
|
|
11
|
+
export const wrapdescriptor_fromStringExt: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
12
|
+
export const wrapdescriptor_hasWildcard: (a: number) => number;
|
|
13
|
+
export const wrapdescriptor_maxWeightToSatisfy: (a: number, b: number) => void;
|
|
14
|
+
export const wrapdescriptor_node: (a: number, b: number) => void;
|
|
15
|
+
export const wrapdescriptor_scriptPubkey: (a: number, b: number) => void;
|
|
16
|
+
export const wrapdescriptor_toAsmString: (a: number, b: number) => void;
|
|
17
|
+
export const wrapdescriptor_toString: (a: number, b: number) => void;
|
|
18
|
+
export const wrapminiscript_encode: (a: number, b: number) => void;
|
|
19
|
+
export const wrapminiscript_fromBitcoinScript: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
20
|
+
export const wrapminiscript_fromBitcoinScriptExt: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
21
|
+
export const wrapminiscript_fromString: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
22
|
+
export const wrapminiscript_fromStringExt: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
23
|
+
export const wrapminiscript_node: (a: number, b: number) => void;
|
|
24
|
+
export const wrapminiscript_toAsmString: (a: number, b: number) => void;
|
|
25
|
+
export const wrapminiscript_toString: (a: number, b: number) => void;
|
|
26
|
+
export const __wbg_addressnamespace_free: (a: number, b: number) => void;
|
|
12
27
|
export const __wbg_messagenamespace_free: (a: number, b: number) => void;
|
|
13
|
-
export const
|
|
28
|
+
export const __wbg_wasmecpair_free: (a: number, b: number) => void;
|
|
14
29
|
export const __wbg_wasmreplayprotection_free: (a: number, b: number) => void;
|
|
30
|
+
export const addressnamespace_from_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
31
|
+
export const addressnamespace_to_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
32
|
+
export const isInspectEnabled: () => number;
|
|
33
|
+
export const messagenamespace_sign_message: (a: number, b: number, c: number, d: number) => void;
|
|
34
|
+
export const messagenamespace_verify_message: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
35
|
+
export const parsePsbtRawToJson: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
36
|
+
export const wasmecpair_from_private_key: (a: number, b: number, c: number) => void;
|
|
37
|
+
export const wasmecpair_from_public_key: (a: number, b: number, c: number) => void;
|
|
38
|
+
export const wasmecpair_from_wif: (a: number, b: number, c: number) => void;
|
|
39
|
+
export const wasmecpair_from_wif_mainnet: (a: number, b: number, c: number) => void;
|
|
40
|
+
export const wasmecpair_from_wif_testnet: (a: number, b: number, c: number) => void;
|
|
41
|
+
export const wasmecpair_private_key: (a: number) => number;
|
|
42
|
+
export const wasmecpair_public_key: (a: number) => number;
|
|
43
|
+
export const wasmecpair_to_wif: (a: number, b: number) => void;
|
|
44
|
+
export const wasmecpair_to_wif_mainnet: (a: number, b: number) => void;
|
|
45
|
+
export const wasmecpair_to_wif_testnet: (a: number, b: number) => void;
|
|
46
|
+
export const wasmreplayprotection_from_addresses: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
47
|
+
export const wasmreplayprotection_from_output_scripts: (a: number, b: number) => number;
|
|
48
|
+
export const wasmreplayprotection_from_public_keys: (a: number, b: number, c: number) => void;
|
|
49
|
+
export const parsePsbtToJson: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
50
|
+
export const parseTxToJson: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
51
|
+
export const __wbg_ironwoodwitness_free: (a: number, b: number) => void;
|
|
52
|
+
export const __wbg_wasmdashtransaction_free: (a: number, b: number) => void;
|
|
15
53
|
export const __wbg_wasmtransaction_free: (a: number, b: number) => void;
|
|
54
|
+
export const __wbg_wasmutxonamespace_free: (a: number, b: number) => void;
|
|
16
55
|
export const __wbg_wasmzcashtransaction_free: (a: number, b: number) => void;
|
|
17
56
|
export const __wbg_wrappsbt_free: (a: number, b: number) => void;
|
|
18
57
|
export const __wbg_zcashunifiedaddress_free: (a: number, b: number) => void;
|
|
@@ -20,8 +59,6 @@ export const __wbg_zcashv6transaction_free: (a: number, b: number) => void;
|
|
|
20
59
|
export const ironwood_build_witness: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
|
|
21
60
|
export const ironwoodwitness_auth_path: (a: number, b: number) => void;
|
|
22
61
|
export const ironwoodwitness_position: (a: number) => number;
|
|
23
|
-
export const messagenamespace_sign_message: (a: number, b: number, c: number, d: number) => void;
|
|
24
|
-
export const messagenamespace_verify_message: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
25
62
|
export const wasmdashtransaction_from_bytes: (a: number, b: number, c: number) => void;
|
|
26
63
|
export const wasmdashtransaction_get_inputs: (a: number, b: number) => void;
|
|
27
64
|
export const wasmdashtransaction_get_outputs: (a: number, b: number) => void;
|
|
@@ -32,9 +69,6 @@ export const wasmdashtransaction_lock_time: (a: number) => number;
|
|
|
32
69
|
export const wasmdashtransaction_output_count: (a: number) => number;
|
|
33
70
|
export const wasmdashtransaction_to_bytes: (a: number, b: number) => void;
|
|
34
71
|
export const wasmdashtransaction_version: (a: number) => number;
|
|
35
|
-
export const wasmreplayprotection_from_addresses: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
36
|
-
export const wasmreplayprotection_from_output_scripts: (a: number, b: number) => number;
|
|
37
|
-
export const wasmreplayprotection_from_public_keys: (a: number, b: number, c: number) => void;
|
|
38
72
|
export const wasmtransaction_add_input: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
39
73
|
export const wasmtransaction_add_input_at_index: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
40
74
|
export const wasmtransaction_add_output: (a: number, b: number, c: number, d: bigint) => number;
|
|
@@ -47,6 +81,7 @@ export const wasmtransaction_get_outputs_with_address: (a: number, b: number, c:
|
|
|
47
81
|
export const wasmtransaction_get_txid: (a: number, b: number) => void;
|
|
48
82
|
export const wasmtransaction_get_vsize: (a: number) => number;
|
|
49
83
|
export const wasmtransaction_to_bytes: (a: number, b: number) => void;
|
|
84
|
+
export const wasmutxonamespace_get_wasm_utxo_version: (a: number) => void;
|
|
50
85
|
export const wasmzcashtransaction_from_bytes: (a: number, b: number, c: number) => void;
|
|
51
86
|
export const wasmzcashtransaction_get_inputs: (a: number, b: number) => void;
|
|
52
87
|
export const wasmzcashtransaction_get_outputs: (a: number, b: number) => void;
|
|
@@ -69,6 +104,7 @@ export const wrappsbt_finalize_input: (a: number, b: number, c: number) => void;
|
|
|
69
104
|
export const wrappsbt_finalize_mut: (a: number, b: number) => void;
|
|
70
105
|
export const wrappsbt_finalize_mut_zcash: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
71
106
|
export const wrappsbt_get_global_xpubs: (a: number) => number;
|
|
107
|
+
export const wrappsbt_get_input_key_values: (a: number, b: number, c: number) => void;
|
|
72
108
|
export const wrappsbt_get_input_kv: (a: number, b: number, c: number, d: number) => void;
|
|
73
109
|
export const wrappsbt_get_inputs: (a: number, b: number) => void;
|
|
74
110
|
export const wrappsbt_get_kv: (a: number, b: number, c: number) => void;
|
|
@@ -98,10 +134,16 @@ export const wrappsbt_update_input_with_descriptor: (a: number, b: number, c: nu
|
|
|
98
134
|
export const wrappsbt_update_output_with_descriptor: (a: number, b: number, c: number, d: number) => void;
|
|
99
135
|
export const wrappsbt_validate_signature_at_input: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
100
136
|
export const wrappsbt_verify_signature_with_key: (a: number, b: number, c: number, d: number) => void;
|
|
137
|
+
export const zcashHasOrchardReceiver: (a: number, b: number, c: number, d: number) => number;
|
|
138
|
+
export const zcashHasTransparentReceiver: (a: number, b: number, c: number, d: number) => number;
|
|
139
|
+
export const zcashToShieldedReceiverWithCoin: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
140
|
+
export const zcashToTransparentReceiverWithCoin: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
101
141
|
export const zcash_branch_id_for_height: (a: number, b: number, c: number, d: number) => void;
|
|
102
142
|
export const zcash_ironwood_version_group_id: () => number;
|
|
103
143
|
export const zcashunifiedaddress_contains: (a: number, b: number, c: number, d: number) => void;
|
|
104
144
|
export const zcashunifiedaddress_encodeOrchardReceiver: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
145
|
+
export const zcashunifiedaddress_hasOrchardReceiver: (a: number) => number;
|
|
146
|
+
export const zcashunifiedaddress_hasTransparentReceiver: (a: number) => number;
|
|
105
147
|
export const zcashunifiedaddress_orchardReceiver: (a: number, b: number) => void;
|
|
106
148
|
export const zcashunifiedaddress_parse: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
107
149
|
export const zcashunifiedaddress_saplingReceiver: (a: number, b: number) => void;
|
|
@@ -127,36 +169,42 @@ export const wasmzcashtransaction_lock_time: (a: number) => number;
|
|
|
127
169
|
export const wasmzcashtransaction_version: (a: number) => number;
|
|
128
170
|
export const wrappsbt_lock_time: (a: number) => number;
|
|
129
171
|
export const wrappsbt_version: (a: number) => number;
|
|
130
|
-
export const
|
|
131
|
-
export const
|
|
132
|
-
export const
|
|
133
|
-
export const
|
|
134
|
-
export const
|
|
135
|
-
export const
|
|
136
|
-
export const
|
|
137
|
-
export const
|
|
138
|
-
export const
|
|
139
|
-
export const
|
|
140
|
-
export const
|
|
141
|
-
export const
|
|
142
|
-
export const
|
|
143
|
-
export const
|
|
144
|
-
export const
|
|
145
|
-
export const
|
|
146
|
-
export const
|
|
147
|
-
export const
|
|
148
|
-
export const
|
|
149
|
-
export const
|
|
150
|
-
export const
|
|
151
|
-
export const
|
|
152
|
-
export const
|
|
153
|
-
export const
|
|
154
|
-
export const
|
|
172
|
+
export const __wbg_utxolibcompatnamespace_free: (a: number, b: number) => void;
|
|
173
|
+
export const __wbg_wasmdimensions_free: (a: number, b: number) => void;
|
|
174
|
+
export const utxolibcompatnamespace_from_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
175
|
+
export const utxolibcompatnamespace_to_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
176
|
+
export const wasmdimensions_empty: () => number;
|
|
177
|
+
export const wasmdimensions_from_input: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
178
|
+
export const wasmdimensions_from_input_script_type: (a: number, b: number, c: number, d: number) => void;
|
|
179
|
+
export const wasmdimensions_from_output_script_length: (a: number) => number;
|
|
180
|
+
export const wasmdimensions_from_output_script_type: (a: number, b: number, c: number) => void;
|
|
181
|
+
export const wasmdimensions_from_psbt: (a: number, b: number) => void;
|
|
182
|
+
export const wasmdimensions_get_input_vsize: (a: number, b: number, c: number) => number;
|
|
183
|
+
export const wasmdimensions_get_input_weight: (a: number, b: number, c: number) => number;
|
|
184
|
+
export const wasmdimensions_get_output_vsize: (a: number) => number;
|
|
185
|
+
export const wasmdimensions_get_output_weight: (a: number) => number;
|
|
186
|
+
export const wasmdimensions_get_vsize: (a: number, b: number, c: number) => number;
|
|
187
|
+
export const wasmdimensions_get_weight: (a: number, b: number, c: number) => number;
|
|
188
|
+
export const wasmdimensions_has_segwit: (a: number) => number;
|
|
189
|
+
export const wasmdimensions_plus: (a: number, b: number) => number;
|
|
190
|
+
export const wasmdimensions_times: (a: number, b: number) => number;
|
|
191
|
+
export const __wbg_bip322namespace_free: (a: number, b: number) => void;
|
|
192
|
+
export const __wbg_wasmrootwalletkeys_free: (a: number, b: number) => void;
|
|
193
|
+
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;
|
|
194
|
+
export const bip322namespace_get_bip322_message: (a: number, b: number, c: number) => void;
|
|
195
|
+
export const bip322namespace_verify_bip322_psbt_input: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
|
|
196
|
+
export const bip322namespace_verify_bip322_psbt_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;
|
|
197
|
+
export const bip322namespace_verify_bip322_tx_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) => void;
|
|
198
|
+
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;
|
|
199
|
+
export const wasmrootwalletkeys_backup_key: (a: number) => number;
|
|
200
|
+
export const wasmrootwalletkeys_bitgo_key: (a: number) => number;
|
|
201
|
+
export const wasmrootwalletkeys_new: (a: number, b: number, c: number, d: number) => void;
|
|
202
|
+
export const wasmrootwalletkeys_user_key: (a: number) => number;
|
|
203
|
+
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;
|
|
155
204
|
export const __wbg_bitgopsbt_free: (a: number, b: number) => void;
|
|
156
205
|
export const __wbg_fixedscriptwalletnamespace_free: (a: number, b: number) => void;
|
|
206
|
+
export const __wbg_inscriptionsnamespace_free: (a: number, b: number) => void;
|
|
157
207
|
export const __wbg_wasmbip32_free: (a: number, b: number) => void;
|
|
158
|
-
export const __wbg_wasmecpair_free: (a: number, b: number) => void;
|
|
159
|
-
export const __wbg_wasmrootwalletkeys_free: (a: number, b: number) => void;
|
|
160
208
|
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;
|
|
161
209
|
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;
|
|
162
210
|
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, l: number, m: number) => void;
|
|
@@ -202,6 +250,7 @@ export const bitgopsbt_from_network_format_zcash_with_block_height: (a: number,
|
|
|
202
250
|
export const bitgopsbt_from_network_format_zcash_with_branch_id: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
203
251
|
export const bitgopsbt_generate_musig2_nonces: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
204
252
|
export const bitgopsbt_get_global_xpubs: (a: number) => number;
|
|
253
|
+
export const bitgopsbt_get_input_key_values: (a: number, b: number, c: number) => void;
|
|
205
254
|
export const bitgopsbt_get_input_kv: (a: number, b: number, c: number, d: number) => void;
|
|
206
255
|
export const bitgopsbt_get_inputs: (a: number, b: number) => void;
|
|
207
256
|
export const bitgopsbt_get_kv: (a: number, b: number, c: number) => void;
|
|
@@ -253,6 +302,8 @@ export const fixedscriptwalletnamespace_output_script_with_network_str: (a: numb
|
|
|
253
302
|
export const fixedscriptwalletnamespace_p2sh_p2pk_output_script: (a: number, b: number, c: number) => void;
|
|
254
303
|
export const fixedscriptwalletnamespace_supports_script_type: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
255
304
|
export const fixedscriptwalletnamespace_to_wallet_keys: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
305
|
+
export const inscriptionsnamespace_create_inscription_reveal_data: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
306
|
+
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;
|
|
256
307
|
export const wasmbip32_chain_code: (a: number) => number;
|
|
257
308
|
export const wasmbip32_depth: (a: number) => number;
|
|
258
309
|
export const wasmbip32_derive: (a: number, b: number, c: number) => void;
|
|
@@ -275,53 +326,10 @@ export const wasmbip32_private_key: (a: number) => number;
|
|
|
275
326
|
export const wasmbip32_public_key: (a: number) => number;
|
|
276
327
|
export const wasmbip32_to_base58: (a: number, b: number) => void;
|
|
277
328
|
export const wasmbip32_to_wif: (a: number, b: number) => void;
|
|
278
|
-
export const wasmecpair_from_private_key: (a: number, b: number, c: number) => void;
|
|
279
|
-
export const wasmecpair_from_public_key: (a: number, b: number, c: number) => void;
|
|
280
|
-
export const wasmecpair_from_wif: (a: number, b: number, c: number) => void;
|
|
281
|
-
export const wasmecpair_from_wif_mainnet: (a: number, b: number, c: number) => void;
|
|
282
|
-
export const wasmecpair_from_wif_testnet: (a: number, b: number, c: number) => void;
|
|
283
|
-
export const wasmecpair_private_key: (a: number) => number;
|
|
284
|
-
export const wasmecpair_public_key: (a: number) => number;
|
|
285
|
-
export const wasmecpair_to_wif: (a: number, b: number) => void;
|
|
286
|
-
export const wasmecpair_to_wif_mainnet: (a: number, b: number) => void;
|
|
287
|
-
export const wasmecpair_to_wif_testnet: (a: number, b: number) => void;
|
|
288
|
-
export const wasmrootwalletkeys_backup_key: (a: number) => number;
|
|
289
|
-
export const wasmrootwalletkeys_bitgo_key: (a: number) => number;
|
|
290
|
-
export const wasmrootwalletkeys_new: (a: number, b: number, c: number, d: number) => void;
|
|
291
|
-
export const wasmrootwalletkeys_user_key: (a: number) => number;
|
|
292
|
-
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;
|
|
293
329
|
export const wasmbip32_from_bip32_properties: (a: number, b: number) => void;
|
|
330
|
+
export const bitgopsbt_sign_replay_protection_inputs: (a: number, b: number, c: number) => void;
|
|
294
331
|
export const bitgopsbt_sign_wallet_input: (a: number, b: number, c: number, d: number) => void;
|
|
295
332
|
export const bitgopsbt_sign_all_with_xpriv: (a: number, b: number, c: number) => void;
|
|
296
|
-
export const bitgopsbt_sign_replay_protection_inputs: (a: number, b: number, c: number) => void;
|
|
297
|
-
export const __wbg_addressnamespace_free: (a: number, b: number) => void;
|
|
298
|
-
export const __wbg_utxolibcompatnamespace_free: (a: number, b: number) => void;
|
|
299
|
-
export const __wbg_wasmdimensions_free: (a: number, b: number) => void;
|
|
300
|
-
export const __wbg_wasmutxonamespace_free: (a: number, b: number) => void;
|
|
301
|
-
export const addressnamespace_from_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
302
|
-
export const addressnamespace_to_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
303
|
-
export const isInspectEnabled: () => number;
|
|
304
|
-
export const parsePsbtRawToJson: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
305
|
-
export const utxolibcompatnamespace_from_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
306
|
-
export const utxolibcompatnamespace_to_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
307
|
-
export const wasmdimensions_empty: () => number;
|
|
308
|
-
export const wasmdimensions_from_input: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
309
|
-
export const wasmdimensions_from_input_script_type: (a: number, b: number, c: number, d: number) => void;
|
|
310
|
-
export const wasmdimensions_from_output_script_length: (a: number) => number;
|
|
311
|
-
export const wasmdimensions_from_output_script_type: (a: number, b: number, c: number) => void;
|
|
312
|
-
export const wasmdimensions_from_psbt: (a: number, b: number) => void;
|
|
313
|
-
export const wasmdimensions_get_input_vsize: (a: number, b: number, c: number) => number;
|
|
314
|
-
export const wasmdimensions_get_input_weight: (a: number, b: number, c: number) => number;
|
|
315
|
-
export const wasmdimensions_get_output_vsize: (a: number) => number;
|
|
316
|
-
export const wasmdimensions_get_output_weight: (a: number) => number;
|
|
317
|
-
export const wasmdimensions_get_vsize: (a: number, b: number, c: number) => number;
|
|
318
|
-
export const wasmdimensions_get_weight: (a: number, b: number, c: number) => number;
|
|
319
|
-
export const wasmdimensions_has_segwit: (a: number) => number;
|
|
320
|
-
export const wasmdimensions_plus: (a: number, b: number) => number;
|
|
321
|
-
export const wasmdimensions_times: (a: number, b: number) => number;
|
|
322
|
-
export const wasmutxonamespace_get_wasm_utxo_version: (a: number) => void;
|
|
323
|
-
export const parsePsbtToJson: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
324
|
-
export const parseTxToJson: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
325
333
|
export const rustsecp256k1_v0_10_0_context_create: (a: number) => number;
|
|
326
334
|
export const rustsecp256k1_v0_10_0_context_destroy: (a: number) => void;
|
|
327
335
|
export const rustsecp256k1_v0_10_0_default_error_callback_fn: (a: number, b: number) => void;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { CoinName } from "./coinName.js";
|
|
2
|
+
/**
|
|
3
|
+
* Convert `address` to its scriptPubKey bytes for `coin`'s network. When `address` is a ZIP-316
|
|
4
|
+
* unified address, resolves its transparent receiver -- same as any other transparent address --
|
|
5
|
+
* rather than rejecting the UA string outright. A UA with no transparent receiver (e.g.
|
|
6
|
+
* Orchard-only) throws rather than falling back to a shielded one.
|
|
7
|
+
*
|
|
8
|
+
* `js/address.ts`'s `toOutputScriptWithCoin` dispatches here for zcash/tzec; call this directly
|
|
9
|
+
* only if you already know `coin` is a Zcash coin.
|
|
10
|
+
*/
|
|
11
|
+
export declare function toTransparentReceiverWithCoin(address: string, coin: CoinName): Uint8Array;
|
|
12
|
+
/**
|
|
13
|
+
* Resolve the Orchard/Ironwood receiver of a ZIP-316 unified address for `coin`'s network, as its
|
|
14
|
+
* raw 43 bytes (diversifier + `pk_d`) -- there is no scriptPubKey for a shielded output, so this
|
|
15
|
+
* returns raw receiver bytes rather than a scriptPubKey.
|
|
16
|
+
*
|
|
17
|
+
* `address` must be a unified address; an ordinary transparent address is rejected, since it can
|
|
18
|
+
* never carry a shielded receiver. A UA that has no Orchard/Ironwood receiver (e.g. Sapling-only)
|
|
19
|
+
* throws rather than falling back to the transparent receiver. If `address` merely looks like a
|
|
20
|
+
* unified address for this coin's network (right Bech32m HRP) but is malformed, this also throws.
|
|
21
|
+
* Use {@link toOutputScriptWithCoin} from `js/address.ts` for the transparent case.
|
|
22
|
+
*/
|
|
23
|
+
export declare function toShieldedReceiverWithCoin(address: string, coin: CoinName): Uint8Array;
|
|
24
|
+
/**
|
|
25
|
+
* Whether `address` is a ZIP-316 unified address for `coin`'s network carrying an
|
|
26
|
+
* Orchard/Ironwood receiver.
|
|
27
|
+
*
|
|
28
|
+
* A plain membership check, not a decoder: never throws. Returns `false` for a malformed or
|
|
29
|
+
* wrong-network unified address, an ordinary (non-UA) address, or a UA with no Orchard/Ironwood
|
|
30
|
+
* receiver (e.g. Sapling-only). Use {@link toShieldedReceiverWithCoin} when the raw receiver bytes
|
|
31
|
+
* are needed.
|
|
32
|
+
*/
|
|
33
|
+
export declare function hasOrchardReceiver(address: string, coin: CoinName): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Whether `address` has a usable transparent receiver for `coin`'s network: either `address` is
|
|
36
|
+
* a ZIP-316 unified address carrying a transparent receiver, or `address` is itself an ordinary
|
|
37
|
+
* transparent address that decodes for `coin`.
|
|
38
|
+
*
|
|
39
|
+
* A plain membership check, not a decoder: never throws. Returns `false` for a malformed or
|
|
40
|
+
* wrong-network unified address, a UA with no transparent receiver (e.g. Orchard-only), or an
|
|
41
|
+
* address that is neither a unified address nor a valid transparent address for `coin`. Use
|
|
42
|
+
* {@link toOutputScriptWithCoin} from `js/address.ts` when the scriptPubKey bytes are needed.
|
|
43
|
+
*/
|
|
44
|
+
export declare function hasTransparentReceiver(address: string, coin: CoinName): boolean;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toTransparentReceiverWithCoin = toTransparentReceiverWithCoin;
|
|
4
|
+
exports.toShieldedReceiverWithCoin = toShieldedReceiverWithCoin;
|
|
5
|
+
exports.hasOrchardReceiver = hasOrchardReceiver;
|
|
6
|
+
exports.hasTransparentReceiver = hasTransparentReceiver;
|
|
7
|
+
const wasm_utxo_js_1 = require("./wasm/wasm_utxo.js");
|
|
8
|
+
/**
|
|
9
|
+
* Convert `address` to its scriptPubKey bytes for `coin`'s network. When `address` is a ZIP-316
|
|
10
|
+
* unified address, resolves its transparent receiver -- same as any other transparent address --
|
|
11
|
+
* rather than rejecting the UA string outright. A UA with no transparent receiver (e.g.
|
|
12
|
+
* Orchard-only) throws rather than falling back to a shielded one.
|
|
13
|
+
*
|
|
14
|
+
* `js/address.ts`'s `toOutputScriptWithCoin` dispatches here for zcash/tzec; call this directly
|
|
15
|
+
* only if you already know `coin` is a Zcash coin.
|
|
16
|
+
*/
|
|
17
|
+
function toTransparentReceiverWithCoin(address, coin) {
|
|
18
|
+
return (0, wasm_utxo_js_1.zcashToTransparentReceiverWithCoin)(address, coin);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Resolve the Orchard/Ironwood receiver of a ZIP-316 unified address for `coin`'s network, as its
|
|
22
|
+
* raw 43 bytes (diversifier + `pk_d`) -- there is no scriptPubKey for a shielded output, so this
|
|
23
|
+
* returns raw receiver bytes rather than a scriptPubKey.
|
|
24
|
+
*
|
|
25
|
+
* `address` must be a unified address; an ordinary transparent address is rejected, since it can
|
|
26
|
+
* never carry a shielded receiver. A UA that has no Orchard/Ironwood receiver (e.g. Sapling-only)
|
|
27
|
+
* throws rather than falling back to the transparent receiver. If `address` merely looks like a
|
|
28
|
+
* unified address for this coin's network (right Bech32m HRP) but is malformed, this also throws.
|
|
29
|
+
* Use {@link toOutputScriptWithCoin} from `js/address.ts` for the transparent case.
|
|
30
|
+
*/
|
|
31
|
+
function toShieldedReceiverWithCoin(address, coin) {
|
|
32
|
+
return (0, wasm_utxo_js_1.zcashToShieldedReceiverWithCoin)(address, coin);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Whether `address` is a ZIP-316 unified address for `coin`'s network carrying an
|
|
36
|
+
* Orchard/Ironwood receiver.
|
|
37
|
+
*
|
|
38
|
+
* A plain membership check, not a decoder: never throws. Returns `false` for a malformed or
|
|
39
|
+
* wrong-network unified address, an ordinary (non-UA) address, or a UA with no Orchard/Ironwood
|
|
40
|
+
* receiver (e.g. Sapling-only). Use {@link toShieldedReceiverWithCoin} when the raw receiver bytes
|
|
41
|
+
* are needed.
|
|
42
|
+
*/
|
|
43
|
+
function hasOrchardReceiver(address, coin) {
|
|
44
|
+
return (0, wasm_utxo_js_1.zcashHasOrchardReceiver)(address, coin);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Whether `address` has a usable transparent receiver for `coin`'s network: either `address` is
|
|
48
|
+
* a ZIP-316 unified address carrying a transparent receiver, or `address` is itself an ordinary
|
|
49
|
+
* transparent address that decodes for `coin`.
|
|
50
|
+
*
|
|
51
|
+
* A plain membership check, not a decoder: never throws. Returns `false` for a malformed or
|
|
52
|
+
* wrong-network unified address, a UA with no transparent receiver (e.g. Orchard-only), or an
|
|
53
|
+
* address that is neither a unified address nor a valid transparent address for `coin`. Use
|
|
54
|
+
* {@link toOutputScriptWithCoin} from `js/address.ts` when the scriptPubKey bytes are needed.
|
|
55
|
+
*/
|
|
56
|
+
function hasTransparentReceiver(address, coin) {
|
|
57
|
+
return (0, wasm_utxo_js_1.zcashHasTransparentReceiver)(address, coin);
|
|
58
|
+
}
|
package/dist/esm/js/address.d.ts
CHANGED
|
@@ -5,12 +5,8 @@ import type { CoinName } from "./coinName.js";
|
|
|
5
5
|
*/
|
|
6
6
|
export type AddressFormat = "default" | "cashaddr";
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* scriptPubKey (there is no scriptPubKey for a shielded output). `address` is only even
|
|
11
|
-
* attempted as a unified address when this is set. If `address` looks like a unified address for
|
|
12
|
-
* this coin's network but is malformed, or has no Orchard/Ironwood receiver (e.g. Sapling-only),
|
|
13
|
-
* this throws rather than falling back to the transparent path.
|
|
8
|
+
* Convert `address` to its scriptPubKey bytes for `coin`, decoding it as an ordinary transparent
|
|
9
|
+
* address.
|
|
14
10
|
*/
|
|
15
|
-
export declare function toOutputScriptWithCoin(address: string, coin: CoinName
|
|
11
|
+
export declare function toOutputScriptWithCoin(address: string, coin: CoinName): Uint8Array;
|
|
16
12
|
export declare function fromOutputScriptWithCoin(script: Uint8Array, coin: CoinName, format?: AddressFormat): string;
|
package/dist/esm/js/address.js
CHANGED
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
import { AddressNamespace } from "./wasm/wasm_utxo.js";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* scriptPubKey (there is no scriptPubKey for a shielded output). `address` is only even
|
|
6
|
-
* attempted as a unified address when this is set. If `address` looks like a unified address for
|
|
7
|
-
* this coin's network but is malformed, or has no Orchard/Ironwood receiver (e.g. Sapling-only),
|
|
8
|
-
* this throws rather than falling back to the transparent path.
|
|
3
|
+
* Convert `address` to its scriptPubKey bytes for `coin`, decoding it as an ordinary transparent
|
|
4
|
+
* address.
|
|
9
5
|
*/
|
|
10
|
-
export function toOutputScriptWithCoin(address, coin
|
|
11
|
-
return AddressNamespace.to_output_script_with_coin(address, coin
|
|
6
|
+
export function toOutputScriptWithCoin(address, coin) {
|
|
7
|
+
return AddressNamespace.to_output_script_with_coin(address, coin);
|
|
12
8
|
}
|
|
13
9
|
export function fromOutputScriptWithCoin(script, coin, format) {
|
|
14
10
|
return AddressNamespace.from_output_script_with_coin(script, coin, format);
|