@bitgo/wasm-utxo 4.40.0 → 5.0.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/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/ZcashIronwoodWitness.d.ts +31 -0
- package/dist/cjs/js/fixedScriptWallet/ZcashIronwoodWitness.js +45 -0
- package/dist/cjs/js/fixedScriptWallet/ZcashUnifiedAddress.d.ts +16 -0
- package/dist/cjs/js/fixedScriptWallet/ZcashUnifiedAddress.js +20 -0
- package/dist/cjs/js/fixedScriptWallet/index.d.ts +1 -0
- package/dist/cjs/js/fixedScriptWallet/index.js +4 -1
- package/dist/cjs/js/index.d.ts +2 -0
- package/dist/cjs/js/index.js +4 -1
- package/dist/cjs/js/wasm/wasm_utxo.d.ts +87 -5
- package/dist/cjs/js/wasm/wasm_utxo.js +232 -7
- package/dist/cjs/js/wasm/wasm_utxo_bg.wasm +0 -0
- package/dist/cjs/js/wasm/wasm_utxo_bg.wasm.d.ts +72 -62
- 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/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/ZcashIronwoodWitness.d.ts +31 -0
- package/dist/esm/js/fixedScriptWallet/ZcashIronwoodWitness.js +41 -0
- package/dist/esm/js/fixedScriptWallet/ZcashUnifiedAddress.d.ts +16 -0
- package/dist/esm/js/fixedScriptWallet/ZcashUnifiedAddress.js +20 -0
- package/dist/esm/js/fixedScriptWallet/index.d.ts +1 -0
- package/dist/esm/js/fixedScriptWallet/index.js +2 -0
- package/dist/esm/js/index.d.ts +2 -0
- package/dist/esm/js/index.js +2 -0
- package/dist/esm/js/wasm/wasm_utxo.d.ts +87 -5
- package/dist/esm/js/wasm/wasm_utxo.js +1 -1
- package/dist/esm/js/wasm/wasm_utxo_bg.js +226 -7
- package/dist/esm/js/wasm/wasm_utxo_bg.wasm +0 -0
- package/dist/esm/js/wasm/wasm_utxo_bg.wasm.d.ts +72 -62
- 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);
|
|
@@ -3190,6 +3186,60 @@ class InscriptionsNamespace {
|
|
|
3190
3186
|
if (Symbol.dispose) InscriptionsNamespace.prototype[Symbol.dispose] = InscriptionsNamespace.prototype.free;
|
|
3191
3187
|
exports.InscriptionsNamespace = InscriptionsNamespace;
|
|
3192
3188
|
|
|
3189
|
+
/**
|
|
3190
|
+
* A validated Merkle witness for an Ironwood/Orchard note commitment, from
|
|
3191
|
+
* [`ironwood_build_witness`].
|
|
3192
|
+
*
|
|
3193
|
+
* Not yet installed anywhere — see [`ironwood_build_witness`]'s docs.
|
|
3194
|
+
*/
|
|
3195
|
+
class IronwoodWitness {
|
|
3196
|
+
static __wrap(ptr) {
|
|
3197
|
+
ptr = ptr >>> 0;
|
|
3198
|
+
const obj = Object.create(IronwoodWitness.prototype);
|
|
3199
|
+
obj.__wbg_ptr = ptr;
|
|
3200
|
+
IronwoodWitnessFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
3201
|
+
return obj;
|
|
3202
|
+
}
|
|
3203
|
+
__destroy_into_raw() {
|
|
3204
|
+
const ptr = this.__wbg_ptr;
|
|
3205
|
+
this.__wbg_ptr = 0;
|
|
3206
|
+
IronwoodWitnessFinalization.unregister(this);
|
|
3207
|
+
return ptr;
|
|
3208
|
+
}
|
|
3209
|
+
free() {
|
|
3210
|
+
const ptr = this.__destroy_into_raw();
|
|
3211
|
+
wasm.__wbg_ironwoodwitness_free(ptr, 0);
|
|
3212
|
+
}
|
|
3213
|
+
/**
|
|
3214
|
+
* The 32 sibling hashes (leaf-to-root order), flattened into a single 1024-byte array
|
|
3215
|
+
* (32 hashes × 32 bytes each).
|
|
3216
|
+
* @returns {Uint8Array}
|
|
3217
|
+
*/
|
|
3218
|
+
get auth_path() {
|
|
3219
|
+
try {
|
|
3220
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
3221
|
+
wasm.ironwoodwitness_auth_path(retptr, this.__wbg_ptr);
|
|
3222
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
3223
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
3224
|
+
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
3225
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
3226
|
+
return v1;
|
|
3227
|
+
} finally {
|
|
3228
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
3229
|
+
}
|
|
3230
|
+
}
|
|
3231
|
+
/**
|
|
3232
|
+
* The leaf's position in the note commitment tree.
|
|
3233
|
+
* @returns {number}
|
|
3234
|
+
*/
|
|
3235
|
+
get position() {
|
|
3236
|
+
const ret = wasm.ironwoodwitness_position(this.__wbg_ptr);
|
|
3237
|
+
return ret >>> 0;
|
|
3238
|
+
}
|
|
3239
|
+
}
|
|
3240
|
+
if (Symbol.dispose) IronwoodWitness.prototype[Symbol.dispose] = IronwoodWitness.prototype.free;
|
|
3241
|
+
exports.IronwoodWitness = IronwoodWitness;
|
|
3242
|
+
|
|
3193
3243
|
class MessageNamespace {
|
|
3194
3244
|
__destroy_into_raw() {
|
|
3195
3245
|
const ptr = this.__wbg_ptr;
|
|
@@ -6764,6 +6814,28 @@ class ZcashUnifiedAddress {
|
|
|
6764
6814
|
wasm.__wbindgen_export4(deferred4_0, deferred4_1, 1);
|
|
6765
6815
|
}
|
|
6766
6816
|
}
|
|
6817
|
+
/**
|
|
6818
|
+
* Whether this Unified Address carries an Orchard/Ironwood receiver.
|
|
6819
|
+
*
|
|
6820
|
+
* Equivalent to `orchardReceiver !== undefined`, without cloning the receiver bytes
|
|
6821
|
+
* when the caller only needs presence.
|
|
6822
|
+
* @returns {boolean}
|
|
6823
|
+
*/
|
|
6824
|
+
get hasOrchardReceiver() {
|
|
6825
|
+
const ret = wasm.zcashunifiedaddress_hasOrchardReceiver(this.__wbg_ptr);
|
|
6826
|
+
return ret !== 0;
|
|
6827
|
+
}
|
|
6828
|
+
/**
|
|
6829
|
+
* Whether this Unified Address carries a transparent (P2PKH/P2SH) receiver.
|
|
6830
|
+
*
|
|
6831
|
+
* Equivalent to `transparentScript !== undefined`, without cloning the script bytes
|
|
6832
|
+
* when the caller only needs presence.
|
|
6833
|
+
* @returns {boolean}
|
|
6834
|
+
*/
|
|
6835
|
+
get hasTransparentReceiver() {
|
|
6836
|
+
const ret = wasm.zcashunifiedaddress_hasTransparentReceiver(this.__wbg_ptr);
|
|
6837
|
+
return ret !== 0;
|
|
6838
|
+
}
|
|
6767
6839
|
/**
|
|
6768
6840
|
* The Orchard/Ironwood receiver's raw 43 bytes (diversifier + pk_d), or `undefined`.
|
|
6769
6841
|
* @returns {Uint8Array | undefined}
|
|
@@ -7068,6 +7140,45 @@ class ZcashV6Transaction {
|
|
|
7068
7140
|
if (Symbol.dispose) ZcashV6Transaction.prototype[Symbol.dispose] = ZcashV6Transaction.prototype.free;
|
|
7069
7141
|
exports.ZcashV6Transaction = ZcashV6Transaction;
|
|
7070
7142
|
|
|
7143
|
+
/**
|
|
7144
|
+
* Build and validate a Merkle witness for an Ironwood/Orchard note commitment.
|
|
7145
|
+
*
|
|
7146
|
+
* `cmx` is the note commitment being witnessed; `auth_path` must be exactly 32 sibling hashes (32
|
|
7147
|
+
* bytes each), leaf-to-root order; `anchor` is the expected note-commitment-tree root. Throws if
|
|
7148
|
+
* any input isn't a canonical field element, or if the witness doesn't recompute to `anchor`.
|
|
7149
|
+
*
|
|
7150
|
+
* This crate has no chain state, so the raw sibling-hash path must be supplied by the caller
|
|
7151
|
+
* (typically BitGo's backend, querying a Zcash-aware service). The returned witness is not yet
|
|
7152
|
+
* installed anywhere — hook it into a spend once real-spend construction exists.
|
|
7153
|
+
* @param {Uint8Array} cmx
|
|
7154
|
+
* @param {number} position
|
|
7155
|
+
* @param {Uint8Array[]} auth_path
|
|
7156
|
+
* @param {Uint8Array} anchor
|
|
7157
|
+
* @returns {IronwoodWitness}
|
|
7158
|
+
*/
|
|
7159
|
+
function ironwood_build_witness(cmx, position, auth_path, anchor) {
|
|
7160
|
+
try {
|
|
7161
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
7162
|
+
const ptr0 = passArray8ToWasm0(cmx, wasm.__wbindgen_export);
|
|
7163
|
+
const len0 = WASM_VECTOR_LEN;
|
|
7164
|
+
const ptr1 = passArrayJsValueToWasm0(auth_path, wasm.__wbindgen_export);
|
|
7165
|
+
const len1 = WASM_VECTOR_LEN;
|
|
7166
|
+
const ptr2 = passArray8ToWasm0(anchor, wasm.__wbindgen_export);
|
|
7167
|
+
const len2 = WASM_VECTOR_LEN;
|
|
7168
|
+
wasm.ironwood_build_witness(retptr, ptr0, len0, position, ptr1, len1, ptr2, len2);
|
|
7169
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
7170
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
7171
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
7172
|
+
if (r2) {
|
|
7173
|
+
throw takeObject(r1);
|
|
7174
|
+
}
|
|
7175
|
+
return IronwoodWitness.__wrap(r0);
|
|
7176
|
+
} finally {
|
|
7177
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
7178
|
+
}
|
|
7179
|
+
}
|
|
7180
|
+
exports.ironwood_build_witness = ironwood_build_witness;
|
|
7181
|
+
|
|
7071
7182
|
/**
|
|
7072
7183
|
* Check if the inspect feature is enabled.
|
|
7073
7184
|
*
|
|
@@ -7237,6 +7348,117 @@ function parseTxToJson(tx_bytes, coin_name) {
|
|
|
7237
7348
|
}
|
|
7238
7349
|
exports.parseTxToJson = parseTxToJson;
|
|
7239
7350
|
|
|
7351
|
+
/**
|
|
7352
|
+
* Whether `address` is a ZIP-316 unified address for `coin`'s network carrying an
|
|
7353
|
+
* Orchard/Ironwood receiver. `false` (never throws) for a malformed/wrong-network unified
|
|
7354
|
+
* address, an ordinary address, or a UA with no Orchard/Ironwood receiver.
|
|
7355
|
+
* @param {string} address
|
|
7356
|
+
* @param {string} coin
|
|
7357
|
+
* @returns {boolean}
|
|
7358
|
+
*/
|
|
7359
|
+
function zcashHasOrchardReceiver(address, coin) {
|
|
7360
|
+
const ptr0 = passStringToWasm0(address, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
7361
|
+
const len0 = WASM_VECTOR_LEN;
|
|
7362
|
+
const ptr1 = passStringToWasm0(coin, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
7363
|
+
const len1 = WASM_VECTOR_LEN;
|
|
7364
|
+
const ret = wasm.zcashHasOrchardReceiver(ptr0, len0, ptr1, len1);
|
|
7365
|
+
return ret !== 0;
|
|
7366
|
+
}
|
|
7367
|
+
exports.zcashHasOrchardReceiver = zcashHasOrchardReceiver;
|
|
7368
|
+
|
|
7369
|
+
/**
|
|
7370
|
+
* Whether `address` has a usable transparent receiver for `coin`'s network: either it's a
|
|
7371
|
+
* unified address carrying a transparent receiver, or it's itself a valid transparent address
|
|
7372
|
+
* for `coin`. `false` (never throws) otherwise.
|
|
7373
|
+
* @param {string} address
|
|
7374
|
+
* @param {string} coin
|
|
7375
|
+
* @returns {boolean}
|
|
7376
|
+
*/
|
|
7377
|
+
function zcashHasTransparentReceiver(address, coin) {
|
|
7378
|
+
const ptr0 = passStringToWasm0(address, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
7379
|
+
const len0 = WASM_VECTOR_LEN;
|
|
7380
|
+
const ptr1 = passStringToWasm0(coin, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
7381
|
+
const len1 = WASM_VECTOR_LEN;
|
|
7382
|
+
const ret = wasm.zcashHasTransparentReceiver(ptr0, len0, ptr1, len1);
|
|
7383
|
+
return ret !== 0;
|
|
7384
|
+
}
|
|
7385
|
+
exports.zcashHasTransparentReceiver = zcashHasTransparentReceiver;
|
|
7386
|
+
|
|
7387
|
+
/**
|
|
7388
|
+
* @param {string} address
|
|
7389
|
+
* @param {string} coin
|
|
7390
|
+
* @returns {Uint8Array}
|
|
7391
|
+
*/
|
|
7392
|
+
function zcashToShieldedReceiverWithCoin(address, coin) {
|
|
7393
|
+
try {
|
|
7394
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
7395
|
+
const ptr0 = passStringToWasm0(address, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
7396
|
+
const len0 = WASM_VECTOR_LEN;
|
|
7397
|
+
const ptr1 = passStringToWasm0(coin, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
7398
|
+
const len1 = WASM_VECTOR_LEN;
|
|
7399
|
+
wasm.zcashToShieldedReceiverWithCoin(retptr, ptr0, len0, ptr1, len1);
|
|
7400
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
7401
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
7402
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
7403
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
7404
|
+
if (r3) {
|
|
7405
|
+
throw takeObject(r2);
|
|
7406
|
+
}
|
|
7407
|
+
var v3 = getArrayU8FromWasm0(r0, r1).slice();
|
|
7408
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
7409
|
+
return v3;
|
|
7410
|
+
} finally {
|
|
7411
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
7412
|
+
}
|
|
7413
|
+
}
|
|
7414
|
+
exports.zcashToShieldedReceiverWithCoin = zcashToShieldedReceiverWithCoin;
|
|
7415
|
+
|
|
7416
|
+
/**
|
|
7417
|
+
* Resolve the Orchard/Ironwood receiver of a ZIP-316 unified address for `coin`'s network, as
|
|
7418
|
+
* its raw 43 bytes (diversifier + `pk_d`) — there is no scriptPubKey for a shielded output, so
|
|
7419
|
+
* this can't return script bytes uniformly and returns raw receiver bytes instead.
|
|
7420
|
+
*
|
|
7421
|
+
* A UA that has no Orchard/Ironwood receiver (e.g. Sapling-only) throws rather than falling back
|
|
7422
|
+
* to the transparent receiver. If `address` merely looks like a unified address for this coin's
|
|
7423
|
+
* network (right Bech32m HRP) but is malformed, this also throws. `address` must be a unified
|
|
7424
|
+
* address — an ordinary transparent address is rejected, since it can never carry a shielded
|
|
7425
|
+
* receiver; use {@link toOutputScriptWithCoin} in `js/address.ts` for the transparent case.
|
|
7426
|
+
* Resolve the transparent receiver of an `address` for `coin`'s network, as its scriptPubKey
|
|
7427
|
+
* bytes. When `address` is a ZIP-316 unified address, resolves its transparent receiver rather
|
|
7428
|
+
* than rejecting the UA string outright — a UA with no transparent receiver (e.g. Orchard-only)
|
|
7429
|
+
* throws rather than falling back to a shielded one. An ordinary (non-UA) address falls through
|
|
7430
|
+
* to the same transparent codec path as any other coin.
|
|
7431
|
+
*
|
|
7432
|
+
* This is the zcash-aware counterpart of `toOutputScriptWithCoin` in `js/address.ts`, which
|
|
7433
|
+
* dispatches here for zcash/tzec so that non-zcash coins never pay for a unified-address check.
|
|
7434
|
+
* @param {string} address
|
|
7435
|
+
* @param {string} coin
|
|
7436
|
+
* @returns {Uint8Array}
|
|
7437
|
+
*/
|
|
7438
|
+
function zcashToTransparentReceiverWithCoin(address, coin) {
|
|
7439
|
+
try {
|
|
7440
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
7441
|
+
const ptr0 = passStringToWasm0(address, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
7442
|
+
const len0 = WASM_VECTOR_LEN;
|
|
7443
|
+
const ptr1 = passStringToWasm0(coin, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
7444
|
+
const len1 = WASM_VECTOR_LEN;
|
|
7445
|
+
wasm.zcashToTransparentReceiverWithCoin(retptr, ptr0, len0, ptr1, len1);
|
|
7446
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
7447
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
7448
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
7449
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
7450
|
+
if (r3) {
|
|
7451
|
+
throw takeObject(r2);
|
|
7452
|
+
}
|
|
7453
|
+
var v3 = getArrayU8FromWasm0(r0, r1).slice();
|
|
7454
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
7455
|
+
return v3;
|
|
7456
|
+
} finally {
|
|
7457
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
7458
|
+
}
|
|
7459
|
+
}
|
|
7460
|
+
exports.zcashToTransparentReceiverWithCoin = zcashToTransparentReceiverWithCoin;
|
|
7461
|
+
|
|
7240
7462
|
/**
|
|
7241
7463
|
* Return the Zcash consensus branch ID active at `height` on `network`.
|
|
7242
7464
|
*
|
|
@@ -7544,6 +7766,9 @@ const FixedScriptWalletNamespaceFinalization = (typeof FinalizationRegistry ===
|
|
|
7544
7766
|
const InscriptionsNamespaceFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
7545
7767
|
? { register: () => {}, unregister: () => {} }
|
|
7546
7768
|
: new FinalizationRegistry(ptr => wasm.__wbg_inscriptionsnamespace_free(ptr >>> 0, 1));
|
|
7769
|
+
const IronwoodWitnessFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
7770
|
+
? { register: () => {}, unregister: () => {} }
|
|
7771
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_ironwoodwitness_free(ptr >>> 0, 1));
|
|
7547
7772
|
const MessageNamespaceFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
7548
7773
|
? { register: () => {}, unregister: () => {} }
|
|
7549
7774
|
: new FinalizationRegistry(ptr => wasm.__wbg_messagenamespace_free(ptr >>> 0, 1));
|
|
Binary file
|
|
@@ -1,11 +1,8 @@
|
|
|
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;
|
|
5
4
|
export const __wbg_utxolibcompatnamespace_free: (a: number, b: number) => void;
|
|
6
5
|
export const __wbg_wasmdimensions_free: (a: number, b: number) => void;
|
|
7
|
-
export const addressnamespace_from_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
8
|
-
export const addressnamespace_to_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
9
6
|
export const utxolibcompatnamespace_from_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
10
7
|
export const utxolibcompatnamespace_to_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
11
8
|
export const wasmdimensions_empty: () => number;
|
|
@@ -23,7 +20,20 @@ export const wasmdimensions_get_weight: (a: number, b: number, c: number) => num
|
|
|
23
20
|
export const wasmdimensions_has_segwit: (a: number) => number;
|
|
24
21
|
export const wasmdimensions_plus: (a: number, b: number) => number;
|
|
25
22
|
export const wasmdimensions_times: (a: number, b: number) => number;
|
|
26
|
-
export const
|
|
23
|
+
export const __wbg_bip322namespace_free: (a: number, b: number) => void;
|
|
24
|
+
export const __wbg_wasmrootwalletkeys_free: (a: number, b: number) => void;
|
|
25
|
+
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;
|
|
26
|
+
export const bip322namespace_get_bip322_message: (a: number, b: number, c: number) => void;
|
|
27
|
+
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;
|
|
28
|
+
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;
|
|
29
|
+
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;
|
|
30
|
+
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;
|
|
31
|
+
export const wasmrootwalletkeys_backup_key: (a: number) => number;
|
|
32
|
+
export const wasmrootwalletkeys_bitgo_key: (a: number) => number;
|
|
33
|
+
export const wasmrootwalletkeys_new: (a: number, b: number, c: number, d: number) => void;
|
|
34
|
+
export const wasmrootwalletkeys_user_key: (a: number) => number;
|
|
35
|
+
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;
|
|
36
|
+
export const __wbg_ironwoodwitness_free: (a: number, b: number) => void;
|
|
27
37
|
export const __wbg_wasmdashtransaction_free: (a: number, b: number) => void;
|
|
28
38
|
export const __wbg_wasmreplayprotection_free: (a: number, b: number) => void;
|
|
29
39
|
export const __wbg_wasmtransaction_free: (a: number, b: number) => void;
|
|
@@ -31,8 +41,9 @@ export const __wbg_wasmzcashtransaction_free: (a: number, b: number) => void;
|
|
|
31
41
|
export const __wbg_wrappsbt_free: (a: number, b: number) => void;
|
|
32
42
|
export const __wbg_zcashunifiedaddress_free: (a: number, b: number) => void;
|
|
33
43
|
export const __wbg_zcashv6transaction_free: (a: number, b: number) => void;
|
|
34
|
-
export const
|
|
35
|
-
export const
|
|
44
|
+
export const ironwood_build_witness: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
|
|
45
|
+
export const ironwoodwitness_auth_path: (a: number, b: number) => void;
|
|
46
|
+
export const ironwoodwitness_position: (a: number) => number;
|
|
36
47
|
export const wasmdashtransaction_from_bytes: (a: number, b: number, c: number) => void;
|
|
37
48
|
export const wasmdashtransaction_get_inputs: (a: number, b: number) => void;
|
|
38
49
|
export const wasmdashtransaction_get_outputs: (a: number, b: number) => void;
|
|
@@ -109,10 +120,16 @@ export const wrappsbt_update_input_with_descriptor: (a: number, b: number, c: nu
|
|
|
109
120
|
export const wrappsbt_update_output_with_descriptor: (a: number, b: number, c: number, d: number) => void;
|
|
110
121
|
export const wrappsbt_validate_signature_at_input: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
111
122
|
export const wrappsbt_verify_signature_with_key: (a: number, b: number, c: number, d: number) => void;
|
|
123
|
+
export const zcashHasOrchardReceiver: (a: number, b: number, c: number, d: number) => number;
|
|
124
|
+
export const zcashHasTransparentReceiver: (a: number, b: number, c: number, d: number) => number;
|
|
125
|
+
export const zcashToShieldedReceiverWithCoin: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
126
|
+
export const zcashToTransparentReceiverWithCoin: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
112
127
|
export const zcash_branch_id_for_height: (a: number, b: number, c: number, d: number) => void;
|
|
113
128
|
export const zcash_ironwood_version_group_id: () => number;
|
|
114
129
|
export const zcashunifiedaddress_contains: (a: number, b: number, c: number, d: number) => void;
|
|
115
130
|
export const zcashunifiedaddress_encodeOrchardReceiver: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
131
|
+
export const zcashunifiedaddress_hasOrchardReceiver: (a: number) => number;
|
|
132
|
+
export const zcashunifiedaddress_hasTransparentReceiver: (a: number) => number;
|
|
116
133
|
export const zcashunifiedaddress_orchardReceiver: (a: number, b: number) => void;
|
|
117
134
|
export const zcashunifiedaddress_parse: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
118
135
|
export const zcashunifiedaddress_saplingReceiver: (a: number, b: number) => void;
|
|
@@ -138,44 +155,33 @@ export const wasmzcashtransaction_lock_time: (a: number) => number;
|
|
|
138
155
|
export const wasmzcashtransaction_version: (a: number) => number;
|
|
139
156
|
export const wrappsbt_lock_time: (a: number) => number;
|
|
140
157
|
export const wrappsbt_version: (a: number) => number;
|
|
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
|
|
155
|
-
export const
|
|
156
|
-
export const
|
|
157
|
-
export const
|
|
158
|
-
export const
|
|
159
|
-
export const
|
|
160
|
-
export const
|
|
161
|
-
export const
|
|
162
|
-
export const
|
|
163
|
-
export const
|
|
164
|
-
export const wrapminiscript_toAsmString: (a: number, b: number) => void;
|
|
165
|
-
export const wrapminiscript_toString: (a: number, b: number) => void;
|
|
166
|
-
export const __wbg_bip322namespace_free: (a: number, b: number) => void;
|
|
167
|
-
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;
|
|
168
|
-
export const bip322namespace_get_bip322_message: (a: number, b: number, c: number) => void;
|
|
169
|
-
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;
|
|
170
|
-
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;
|
|
171
|
-
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;
|
|
172
|
-
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;
|
|
158
|
+
export const __wbg_addressnamespace_free: (a: number, b: number) => void;
|
|
159
|
+
export const __wbg_messagenamespace_free: (a: number, b: number) => void;
|
|
160
|
+
export const __wbg_wasmecpair_free: (a: number, b: number) => void;
|
|
161
|
+
export const __wbg_wasmutxonamespace_free: (a: number, b: number) => void;
|
|
162
|
+
export const addressnamespace_from_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
163
|
+
export const addressnamespace_to_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
164
|
+
export const messagenamespace_sign_message: (a: number, b: number, c: number, d: number) => void;
|
|
165
|
+
export const messagenamespace_verify_message: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
166
|
+
export const parsePsbtRawToJson: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
167
|
+
export const wasmecpair_from_private_key: (a: number, b: number, c: number) => void;
|
|
168
|
+
export const wasmecpair_from_public_key: (a: number, b: number, c: number) => void;
|
|
169
|
+
export const wasmecpair_from_wif: (a: number, b: number, c: number) => void;
|
|
170
|
+
export const wasmecpair_from_wif_mainnet: (a: number, b: number, c: number) => void;
|
|
171
|
+
export const wasmecpair_from_wif_testnet: (a: number, b: number, c: number) => void;
|
|
172
|
+
export const wasmecpair_private_key: (a: number) => number;
|
|
173
|
+
export const wasmecpair_public_key: (a: number) => number;
|
|
174
|
+
export const wasmecpair_to_wif: (a: number, b: number) => void;
|
|
175
|
+
export const wasmecpair_to_wif_mainnet: (a: number, b: number) => void;
|
|
176
|
+
export const wasmecpair_to_wif_testnet: (a: number, b: number) => void;
|
|
177
|
+
export const wasmutxonamespace_get_wasm_utxo_version: (a: number) => void;
|
|
178
|
+
export const isInspectEnabled: () => number;
|
|
179
|
+
export const parsePsbtToJson: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
180
|
+
export const parseTxToJson: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
173
181
|
export const __wbg_bitgopsbt_free: (a: number, b: number) => void;
|
|
174
182
|
export const __wbg_fixedscriptwalletnamespace_free: (a: number, b: number) => void;
|
|
183
|
+
export const __wbg_inscriptionsnamespace_free: (a: number, b: number) => void;
|
|
175
184
|
export const __wbg_wasmbip32_free: (a: number, b: number) => void;
|
|
176
|
-
export const __wbg_wasmecpair_free: (a: number, b: number) => void;
|
|
177
|
-
export const __wbg_wasmrootwalletkeys_free: (a: number, b: number) => void;
|
|
178
|
-
export const __wbg_wasmutxonamespace_free: (a: number, b: number) => void;
|
|
179
185
|
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;
|
|
180
186
|
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;
|
|
181
187
|
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;
|
|
@@ -272,8 +278,8 @@ export const fixedscriptwalletnamespace_output_script_with_network_str: (a: numb
|
|
|
272
278
|
export const fixedscriptwalletnamespace_p2sh_p2pk_output_script: (a: number, b: number, c: number) => void;
|
|
273
279
|
export const fixedscriptwalletnamespace_supports_script_type: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
274
280
|
export const fixedscriptwalletnamespace_to_wallet_keys: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
275
|
-
export const
|
|
276
|
-
export const
|
|
281
|
+
export const inscriptionsnamespace_create_inscription_reveal_data: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
282
|
+
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;
|
|
277
283
|
export const wasmbip32_chain_code: (a: number) => number;
|
|
278
284
|
export const wasmbip32_depth: (a: number) => number;
|
|
279
285
|
export const wasmbip32_derive: (a: number, b: number, c: number) => void;
|
|
@@ -296,28 +302,32 @@ export const wasmbip32_private_key: (a: number) => number;
|
|
|
296
302
|
export const wasmbip32_public_key: (a: number) => number;
|
|
297
303
|
export const wasmbip32_to_base58: (a: number, b: number) => void;
|
|
298
304
|
export const wasmbip32_to_wif: (a: number, b: number) => void;
|
|
299
|
-
export const wasmecpair_from_private_key: (a: number, b: number, c: number) => void;
|
|
300
|
-
export const wasmecpair_from_public_key: (a: number, b: number, c: number) => void;
|
|
301
|
-
export const wasmecpair_from_wif: (a: number, b: number, c: number) => void;
|
|
302
|
-
export const wasmecpair_from_wif_mainnet: (a: number, b: number, c: number) => void;
|
|
303
|
-
export const wasmecpair_from_wif_testnet: (a: number, b: number, c: number) => void;
|
|
304
|
-
export const wasmecpair_private_key: (a: number) => number;
|
|
305
|
-
export const wasmecpair_public_key: (a: number) => number;
|
|
306
|
-
export const wasmecpair_to_wif: (a: number, b: number) => void;
|
|
307
|
-
export const wasmecpair_to_wif_mainnet: (a: number, b: number) => void;
|
|
308
|
-
export const wasmecpair_to_wif_testnet: (a: number, b: number) => void;
|
|
309
|
-
export const wasmrootwalletkeys_backup_key: (a: number) => number;
|
|
310
|
-
export const wasmrootwalletkeys_bitgo_key: (a: number) => number;
|
|
311
|
-
export const wasmrootwalletkeys_new: (a: number, b: number, c: number, d: number) => void;
|
|
312
|
-
export const wasmrootwalletkeys_user_key: (a: number) => number;
|
|
313
|
-
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;
|
|
314
|
-
export const wasmutxonamespace_get_wasm_utxo_version: (a: number) => void;
|
|
315
305
|
export const wasmbip32_from_bip32_properties: (a: number, b: number) => void;
|
|
316
|
-
export const
|
|
317
|
-
export const parseTxToJson: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
306
|
+
export const bitgopsbt_sign_replay_protection_inputs: (a: number, b: number, c: number) => void;
|
|
318
307
|
export const bitgopsbt_sign_wallet_input: (a: number, b: number, c: number, d: number) => void;
|
|
319
308
|
export const bitgopsbt_sign_all_with_xpriv: (a: number, b: number, c: number) => void;
|
|
320
|
-
export const
|
|
309
|
+
export const __wbg_wrapdescriptor_free: (a: number, b: number) => void;
|
|
310
|
+
export const __wbg_wrapminiscript_free: (a: number, b: number) => void;
|
|
311
|
+
export const wrapdescriptor_atDerivationIndex: (a: number, b: number, c: number) => void;
|
|
312
|
+
export const wrapdescriptor_descType: (a: number, b: number) => void;
|
|
313
|
+
export const wrapdescriptor_encode: (a: number, b: number) => void;
|
|
314
|
+
export const wrapdescriptor_fromString: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
315
|
+
export const wrapdescriptor_fromStringDetectType: (a: number, b: number, c: number) => void;
|
|
316
|
+
export const wrapdescriptor_fromStringExt: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
317
|
+
export const wrapdescriptor_hasWildcard: (a: number) => number;
|
|
318
|
+
export const wrapdescriptor_maxWeightToSatisfy: (a: number, b: number) => void;
|
|
319
|
+
export const wrapdescriptor_node: (a: number, b: number) => void;
|
|
320
|
+
export const wrapdescriptor_scriptPubkey: (a: number, b: number) => void;
|
|
321
|
+
export const wrapdescriptor_toAsmString: (a: number, b: number) => void;
|
|
322
|
+
export const wrapdescriptor_toString: (a: number, b: number) => void;
|
|
323
|
+
export const wrapminiscript_encode: (a: number, b: number) => void;
|
|
324
|
+
export const wrapminiscript_fromBitcoinScript: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
325
|
+
export const wrapminiscript_fromBitcoinScriptExt: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
326
|
+
export const wrapminiscript_fromString: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
327
|
+
export const wrapminiscript_fromStringExt: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
328
|
+
export const wrapminiscript_node: (a: number, b: number) => void;
|
|
329
|
+
export const wrapminiscript_toAsmString: (a: number, b: number) => void;
|
|
330
|
+
export const wrapminiscript_toString: (a: number, b: number) => void;
|
|
321
331
|
export const rustsecp256k1_v0_10_0_context_create: (a: number) => number;
|
|
322
332
|
export const rustsecp256k1_v0_10_0_context_destroy: (a: number) => void;
|
|
323
333
|
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);
|