@bitgo/wasm-utxo 4.34.0 → 4.36.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 +9 -1
- package/dist/cjs/js/address.js +10 -2
- package/dist/cjs/js/fixedScriptWallet/BitGoPsbt.d.ts +10 -0
- package/dist/cjs/js/fixedScriptWallet/ZcashIronwoodBitGoPsbt.d.ts +14 -0
- package/dist/cjs/js/fixedScriptWallet/ZcashIronwoodBitGoPsbt.js +16 -0
- package/dist/cjs/js/fixedScriptWallet/ZcashUnifiedAddress.d.ts +13 -0
- package/dist/cjs/js/fixedScriptWallet/ZcashUnifiedAddress.js +15 -0
- package/dist/cjs/js/fixedScriptWallet/ZcashV6Transaction.d.ts +9 -0
- package/dist/cjs/js/fixedScriptWallet/ZcashV6Transaction.js +11 -0
- package/dist/cjs/js/wasm/wasm_utxo.d.ts +44 -1
- package/dist/cjs/js/wasm/wasm_utxo.js +130 -2
- package/dist/cjs/js/wasm/wasm_utxo_bg.wasm +0 -0
- package/dist/cjs/js/wasm/wasm_utxo_bg.wasm.d.ts +166 -163
- package/dist/esm/js/address.d.ts +9 -1
- package/dist/esm/js/address.js +10 -2
- package/dist/esm/js/fixedScriptWallet/BitGoPsbt.d.ts +10 -0
- package/dist/esm/js/fixedScriptWallet/ZcashIronwoodBitGoPsbt.d.ts +14 -0
- package/dist/esm/js/fixedScriptWallet/ZcashIronwoodBitGoPsbt.js +16 -0
- package/dist/esm/js/fixedScriptWallet/ZcashUnifiedAddress.d.ts +13 -0
- package/dist/esm/js/fixedScriptWallet/ZcashUnifiedAddress.js +15 -0
- package/dist/esm/js/fixedScriptWallet/ZcashV6Transaction.d.ts +9 -0
- package/dist/esm/js/fixedScriptWallet/ZcashV6Transaction.js +11 -0
- package/dist/esm/js/wasm/wasm_utxo.d.ts +44 -1
- package/dist/esm/js/wasm/wasm_utxo_bg.js +130 -2
- package/dist/esm/js/wasm/wasm_utxo_bg.wasm +0 -0
- package/dist/esm/js/wasm/wasm_utxo_bg.wasm.d.ts +166 -163
- package/package.json +1 -1
package/dist/cjs/js/address.d.ts
CHANGED
|
@@ -4,5 +4,13 @@ import type { CoinName } from "./coinName.js";
|
|
|
4
4
|
* For Bitcoin Cash and eCash, we can select between base58check and cashaddr.
|
|
5
5
|
*/
|
|
6
6
|
export type AddressFormat = "default" | "cashaddr";
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* @param canBeShieldedOutput - When set and `address` is a ZIP-316 unified address carrying an
|
|
9
|
+
* Orchard/Ironwood receiver, returns that raw 43-byte receiver instead of a transparent
|
|
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.
|
|
14
|
+
*/
|
|
15
|
+
export declare function toOutputScriptWithCoin(address: string, coin: CoinName, canBeShieldedOutput?: boolean): Uint8Array;
|
|
8
16
|
export declare function fromOutputScriptWithCoin(script: Uint8Array, coin: CoinName, format?: AddressFormat): string;
|
package/dist/cjs/js/address.js
CHANGED
|
@@ -3,8 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.toOutputScriptWithCoin = toOutputScriptWithCoin;
|
|
4
4
|
exports.fromOutputScriptWithCoin = fromOutputScriptWithCoin;
|
|
5
5
|
const wasm_utxo_js_1 = require("./wasm/wasm_utxo.js");
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
/**
|
|
7
|
+
* @param canBeShieldedOutput - When set and `address` is a ZIP-316 unified address carrying an
|
|
8
|
+
* Orchard/Ironwood receiver, returns that raw 43-byte receiver instead of a transparent
|
|
9
|
+
* scriptPubKey (there is no scriptPubKey for a shielded output). `address` is only even
|
|
10
|
+
* attempted as a unified address when this is set. If `address` looks like a unified address for
|
|
11
|
+
* this coin's network but is malformed, or has no Orchard/Ironwood receiver (e.g. Sapling-only),
|
|
12
|
+
* this throws rather than falling back to the transparent path.
|
|
13
|
+
*/
|
|
14
|
+
function toOutputScriptWithCoin(address, coin, canBeShieldedOutput) {
|
|
15
|
+
return wasm_utxo_js_1.AddressNamespace.to_output_script_with_coin(address, coin, canBeShieldedOutput);
|
|
8
16
|
}
|
|
9
17
|
function fromOutputScriptWithCoin(script, coin, format) {
|
|
10
18
|
return wasm_utxo_js_1.AddressNamespace.from_output_script_with_coin(script, coin, format);
|
|
@@ -40,6 +40,16 @@ export type ParsedOutput = {
|
|
|
40
40
|
paygo: boolean;
|
|
41
41
|
/** Full BIP32 derivation path from the wallet xpub (e.g. "0/1"). Null for external outputs. */
|
|
42
42
|
derivationPath: string | null;
|
|
43
|
+
/**
|
|
44
|
+
* True for a shielded (Orchard/Ironwood) output. Such an output has no `unsigned_tx` entry of
|
|
45
|
+
* its own — it lives in the PSBT's proprietary-map PCZT, read from its plaintext (not
|
|
46
|
+
* encrypted/decrypted) recipient field. `address` is a single-receiver ZIP-316 unified address
|
|
47
|
+
* (`u1...`/`utest1...`) encoding that receiver — a real, usable Zcash address, though not
|
|
48
|
+
* necessarily byte-identical to whatever multi-receiver UA the sender originally pasted in (a
|
|
49
|
+
* UA with a transparent/Sapling receiver too would round-trip to a different string carrying
|
|
50
|
+
* only the Orchard one). `script` holds the same receiver as raw 43 bytes.
|
|
51
|
+
*/
|
|
52
|
+
isShielded: boolean;
|
|
43
53
|
};
|
|
44
54
|
export type ParsedTransaction = {
|
|
45
55
|
inputs: ParsedInput[];
|
|
@@ -230,4 +230,18 @@ export declare class ZcashIronwoodBitGoPsbt extends ZcashBitGoPsbt {
|
|
|
230
230
|
* errors (bad proof, unsigned input) leaves the PSBT retryable.
|
|
231
231
|
*/
|
|
232
232
|
combineProof(proof: Uint8Array): Uint8Array;
|
|
233
|
+
/**
|
|
234
|
+
* The raw serialized orchard PCZT (Partially Created Zcash Transaction) bundle stored in this
|
|
235
|
+
* PSBT, or `undefined` if none is present.
|
|
236
|
+
*
|
|
237
|
+
* A PCZT is the shielded-bundle counterpart to a PSBT: it accumulates the orchard action
|
|
238
|
+
* (spend + output), the ZIP-244-committed `out_ciphertext`, and — once {@link combineProof} has
|
|
239
|
+
* run — the Halo2 `zkproof` and binding signature, bridging this PSBT to the external proof
|
|
240
|
+
* service and back.
|
|
241
|
+
*
|
|
242
|
+
* Present only after {@link addShieldedOutput} has been called; `undefined` beforehand, and
|
|
243
|
+
* `undefined` again after {@link combineProof} succeeds, since that call drops the stored PCZT
|
|
244
|
+
* to make extraction terminal (see its doc comment).
|
|
245
|
+
*/
|
|
246
|
+
getPczt(): Uint8Array | undefined;
|
|
233
247
|
}
|
|
@@ -223,5 +223,21 @@ class ZcashIronwoodBitGoPsbt extends ZcashBitGoPsbt_js_1.ZcashBitGoPsbt {
|
|
|
223
223
|
combineProof(proof) {
|
|
224
224
|
return this.wasm.combine_ironwood_proof(proof);
|
|
225
225
|
}
|
|
226
|
+
/**
|
|
227
|
+
* The raw serialized orchard PCZT (Partially Created Zcash Transaction) bundle stored in this
|
|
228
|
+
* PSBT, or `undefined` if none is present.
|
|
229
|
+
*
|
|
230
|
+
* A PCZT is the shielded-bundle counterpart to a PSBT: it accumulates the orchard action
|
|
231
|
+
* (spend + output), the ZIP-244-committed `out_ciphertext`, and — once {@link combineProof} has
|
|
232
|
+
* run — the Halo2 `zkproof` and binding signature, bridging this PSBT to the external proof
|
|
233
|
+
* service and back.
|
|
234
|
+
*
|
|
235
|
+
* Present only after {@link addShieldedOutput} has been called; `undefined` beforehand, and
|
|
236
|
+
* `undefined` again after {@link combineProof} succeeds, since that call drops the stored PCZT
|
|
237
|
+
* to make extraction terminal (see its doc comment).
|
|
238
|
+
*/
|
|
239
|
+
getPczt() {
|
|
240
|
+
return this.wasm.ironwood_pczt_bytes();
|
|
241
|
+
}
|
|
226
242
|
}
|
|
227
243
|
exports.ZcashIronwoodBitGoPsbt = ZcashIronwoodBitGoPsbt;
|
|
@@ -52,6 +52,19 @@ export declare class ZcashUnifiedAddress {
|
|
|
52
52
|
* @throws If `candidate` is malformed or on the wrong network
|
|
53
53
|
*/
|
|
54
54
|
contains(candidate: string): boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Encode a raw 43-byte Orchard/Ironwood receiver as a single-receiver Unified Address.
|
|
57
|
+
*
|
|
58
|
+
* Deliberately narrower than a general UA encoder: this always produces exactly one receiver,
|
|
59
|
+
* so it can't reproduce a multi-receiver UA (transparent + Sapling + Orchard) a sender might
|
|
60
|
+
* have originally pasted in — it only gives back *a* valid, usable address for the
|
|
61
|
+
* Orchard/Ironwood receiver itself.
|
|
62
|
+
*
|
|
63
|
+
* @param receiver - 43-byte raw Orchard/Ironwood receiver
|
|
64
|
+
* @param network - Zcash network name ("zcash", "zcashTest", "zec", "tzec")
|
|
65
|
+
* @throws If `receiver` is not 43 bytes, or `network` is unrecognized
|
|
66
|
+
*/
|
|
67
|
+
static encodeOrchardReceiver(receiver: Uint8Array, network: ZcashNetworkName): string;
|
|
55
68
|
/** @internal */
|
|
56
69
|
get wasm(): WasmZcashUnifiedAddress;
|
|
57
70
|
}
|
|
@@ -66,6 +66,21 @@ class ZcashUnifiedAddress {
|
|
|
66
66
|
contains(candidate) {
|
|
67
67
|
return this._wasm.contains(candidate);
|
|
68
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* Encode a raw 43-byte Orchard/Ironwood receiver as a single-receiver Unified Address.
|
|
71
|
+
*
|
|
72
|
+
* Deliberately narrower than a general UA encoder: this always produces exactly one receiver,
|
|
73
|
+
* so it can't reproduce a multi-receiver UA (transparent + Sapling + Orchard) a sender might
|
|
74
|
+
* have originally pasted in — it only gives back *a* valid, usable address for the
|
|
75
|
+
* Orchard/Ironwood receiver itself.
|
|
76
|
+
*
|
|
77
|
+
* @param receiver - 43-byte raw Orchard/Ironwood receiver
|
|
78
|
+
* @param network - Zcash network name ("zcash", "zcashTest", "zec", "tzec")
|
|
79
|
+
* @throws If `receiver` is not 43 bytes, or `network` is unrecognized
|
|
80
|
+
*/
|
|
81
|
+
static encodeOrchardReceiver(receiver, network) {
|
|
82
|
+
return wasm_utxo_js_1.ZcashUnifiedAddress.encodeOrchardReceiver(receiver, network);
|
|
83
|
+
}
|
|
69
84
|
/** @internal */
|
|
70
85
|
get wasm() {
|
|
71
86
|
return this._wasm;
|
|
@@ -40,6 +40,15 @@ export declare class ZcashV6Transaction {
|
|
|
40
40
|
get ironwoodFlags(): number | undefined;
|
|
41
41
|
/** The Ironwood note-commitment tree anchor (32 bytes), or `undefined`. */
|
|
42
42
|
get ironwoodAnchor(): Uint8Array | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* The ZIP-244 per-input transparent sighash (32 bytes) for transparent input `index` —
|
|
45
|
+
* for a transaction inspected directly from its raw bytes rather than one built via a
|
|
46
|
+
* PSBT (e.g. independently verifying an already-broadcast transaction's signatures).
|
|
47
|
+
*
|
|
48
|
+
* `inputAmounts`/`inputScriptPubkeys` are the spent outputs' values (zatoshi) and
|
|
49
|
+
* scriptPubKeys for *every* transparent input of this transaction, in input order.
|
|
50
|
+
*/
|
|
51
|
+
transparentSighash(index: number, inputAmounts: bigint[], inputScriptPubkeys: Uint8Array[]): Uint8Array;
|
|
43
52
|
/** @internal */
|
|
44
53
|
get wasm(): WasmZcashV6Transaction;
|
|
45
54
|
}
|
|
@@ -65,6 +65,17 @@ class ZcashV6Transaction {
|
|
|
65
65
|
get ironwoodAnchor() {
|
|
66
66
|
return this._wasm.ironwoodAnchor;
|
|
67
67
|
}
|
|
68
|
+
/**
|
|
69
|
+
* The ZIP-244 per-input transparent sighash (32 bytes) for transparent input `index` —
|
|
70
|
+
* for a transaction inspected directly from its raw bytes rather than one built via a
|
|
71
|
+
* PSBT (e.g. independently verifying an already-broadcast transaction's signatures).
|
|
72
|
+
*
|
|
73
|
+
* `inputAmounts`/`inputScriptPubkeys` are the spent outputs' values (zatoshi) and
|
|
74
|
+
* scriptPubKeys for *every* transparent input of this transaction, in input order.
|
|
75
|
+
*/
|
|
76
|
+
transparentSighash(index, inputAmounts, inputScriptPubkeys) {
|
|
77
|
+
return this._wasm.transparentSighash(index, BigInt64Array.from(inputAmounts), inputScriptPubkeys);
|
|
78
|
+
}
|
|
68
79
|
/** @internal */
|
|
69
80
|
get wasm() {
|
|
70
81
|
return this._wasm;
|
|
@@ -6,7 +6,13 @@ export class AddressNamespace {
|
|
|
6
6
|
free(): void;
|
|
7
7
|
[Symbol.dispose](): void;
|
|
8
8
|
static from_output_script_with_coin(script: Uint8Array, coin: string, format?: string | null): string;
|
|
9
|
-
|
|
9
|
+
/**
|
|
10
|
+
* `can_be_shielded_output`: when set and `address` is a ZIP-316 unified address carrying an
|
|
11
|
+
* Orchard/Ironwood receiver, returns that raw 43-byte receiver instead of a transparent
|
|
12
|
+
* scriptPubKey. See [`to_output_script_or_shielded_receiver_with_coin`] for the exact
|
|
13
|
+
* fallback/error rules.
|
|
14
|
+
*/
|
|
15
|
+
static to_output_script_with_coin(address: string, coin: string, can_be_shielded_output?: boolean | null): Uint8Array;
|
|
10
16
|
}
|
|
11
17
|
|
|
12
18
|
/**
|
|
@@ -474,6 +480,21 @@ export class BitGoPsbt {
|
|
|
474
480
|
*/
|
|
475
481
|
get_unsigned_tx(): Uint8Array;
|
|
476
482
|
input_count(): number;
|
|
483
|
+
/**
|
|
484
|
+
* The raw serialized orchard PCZT (Partially Created Zcash Transaction) bundle stored in
|
|
485
|
+
* this v6 (Ironwood) PSBT's proprietary key-value map, or `undefined` if none is present.
|
|
486
|
+
*
|
|
487
|
+
* A PCZT is the shielded-bundle counterpart to a PSBT: it accumulates the orchard action
|
|
488
|
+
* (spend + output), the ZIP-244-committed `out_ciphertext`, and — once
|
|
489
|
+
* [`Self::combine_ironwood_proof`] has run — the Halo2 `zkproof` and binding signature,
|
|
490
|
+
* bridging this PSBT to the external proof service and back (see
|
|
491
|
+
* [`crate::zcash::ironwood_pczt`] / [`crate::zcash::ironwood_build`]).
|
|
492
|
+
*
|
|
493
|
+
* Present only after [`Self::add_ironwood_output`] has been called on a v6 PSBT; `undefined`
|
|
494
|
+
* beforehand, and `undefined` again after [`Self::combine_ironwood_proof`] succeeds, since
|
|
495
|
+
* that call drops the stored PCZT to make extraction terminal (see its doc comment).
|
|
496
|
+
*/
|
|
497
|
+
ironwood_pczt_bytes(): Uint8Array | undefined;
|
|
477
498
|
/**
|
|
478
499
|
* The ZIP-244 per-input transparent sighash (32 bytes) that the key controlling transparent
|
|
479
500
|
* input `index` must sign.
|
|
@@ -1689,6 +1710,16 @@ export class ZcashUnifiedAddress {
|
|
|
1689
1710
|
* on the same network) is a receiver of this Unified Address.
|
|
1690
1711
|
*/
|
|
1691
1712
|
contains(candidate: string): boolean;
|
|
1713
|
+
/**
|
|
1714
|
+
* Encode a raw 43-byte Orchard/Ironwood receiver as a single-receiver Unified Address for
|
|
1715
|
+
* `network` ("zcash"/"zec" or "zcashTest"/"tzec").
|
|
1716
|
+
*
|
|
1717
|
+
* Deliberately narrower than a general UA encoder: this always produces exactly one
|
|
1718
|
+
* receiver, so it can't reproduce a multi-receiver UA (transparent + Sapling + Orchard) a
|
|
1719
|
+
* sender might have originally pasted in — only give back *a* valid, usable address for the
|
|
1720
|
+
* Orchard/Ironwood receiver itself.
|
|
1721
|
+
*/
|
|
1722
|
+
static encodeOrchardReceiver(receiver: Uint8Array, network: string): string;
|
|
1692
1723
|
/**
|
|
1693
1724
|
* Parse a Unified Address for `network` ("zcash"/"zec" or "zcashTest"/"tzec").
|
|
1694
1725
|
*
|
|
@@ -1738,6 +1769,18 @@ export class ZcashV6Transaction {
|
|
|
1738
1769
|
* Serialize back to raw v6 wire bytes.
|
|
1739
1770
|
*/
|
|
1740
1771
|
toBytes(): Uint8Array;
|
|
1772
|
+
/**
|
|
1773
|
+
* The ZIP-244 per-input transparent sighash (32 bytes) for transparent input `index` of
|
|
1774
|
+
* this transaction — the free-standing counterpart to
|
|
1775
|
+
* `ZcashIronwoodBitGoPsbt.transparentSighash`, for a transaction inspected directly from
|
|
1776
|
+
* its raw bytes rather than one built via this codebase's PSBT flow (e.g. independently
|
|
1777
|
+
* verifying an already-broadcast transaction's signatures).
|
|
1778
|
+
*
|
|
1779
|
+
* `input_amounts`/`input_script_pubkeys` are the spent outputs' values (zatoshi) and
|
|
1780
|
+
* scriptPubKeys for *every* transparent input of this transaction, in input order — the
|
|
1781
|
+
* same data `add-input`/`addWalletInput` would have carried in a PSBT's `witness_utxo`.
|
|
1782
|
+
*/
|
|
1783
|
+
transparentSighash(index: number, input_amounts: BigInt64Array, input_script_pubkeys: Uint8Array[]): Uint8Array;
|
|
1741
1784
|
/**
|
|
1742
1785
|
* The ZIP-244 txid in internal (non-reversed) byte order.
|
|
1743
1786
|
*/
|
|
@@ -48,18 +48,23 @@ class AddressNamespace {
|
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
/**
|
|
51
|
+
* `can_be_shielded_output`: when set and `address` is a ZIP-316 unified address carrying an
|
|
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
55
|
* @param {string} address
|
|
52
56
|
* @param {string} coin
|
|
57
|
+
* @param {boolean | null} [can_be_shielded_output]
|
|
53
58
|
* @returns {Uint8Array}
|
|
54
59
|
*/
|
|
55
|
-
static to_output_script_with_coin(address, coin) {
|
|
60
|
+
static to_output_script_with_coin(address, coin, can_be_shielded_output) {
|
|
56
61
|
try {
|
|
57
62
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
58
63
|
const ptr0 = passStringToWasm0(address, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
59
64
|
const len0 = WASM_VECTOR_LEN;
|
|
60
65
|
const ptr1 = passStringToWasm0(coin, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
61
66
|
const len1 = WASM_VECTOR_LEN;
|
|
62
|
-
wasm.addressnamespace_to_output_script_with_coin(retptr, ptr0, len0, ptr1, len1);
|
|
67
|
+
wasm.addressnamespace_to_output_script_with_coin(retptr, ptr0, len0, ptr1, len1, isLikeNone(can_be_shielded_output) ? 0xFFFFFF : can_be_shielded_output ? 1 : 0);
|
|
63
68
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
64
69
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
65
70
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -1792,6 +1797,37 @@ class BitGoPsbt {
|
|
|
1792
1797
|
const ret = wasm.bitgopsbt_input_count(this.__wbg_ptr);
|
|
1793
1798
|
return ret >>> 0;
|
|
1794
1799
|
}
|
|
1800
|
+
/**
|
|
1801
|
+
* The raw serialized orchard PCZT (Partially Created Zcash Transaction) bundle stored in
|
|
1802
|
+
* this v6 (Ironwood) PSBT's proprietary key-value map, or `undefined` if none is present.
|
|
1803
|
+
*
|
|
1804
|
+
* A PCZT is the shielded-bundle counterpart to a PSBT: it accumulates the orchard action
|
|
1805
|
+
* (spend + output), the ZIP-244-committed `out_ciphertext`, and — once
|
|
1806
|
+
* [`Self::combine_ironwood_proof`] has run — the Halo2 `zkproof` and binding signature,
|
|
1807
|
+
* bridging this PSBT to the external proof service and back (see
|
|
1808
|
+
* [`crate::zcash::ironwood_pczt`] / [`crate::zcash::ironwood_build`]).
|
|
1809
|
+
*
|
|
1810
|
+
* Present only after [`Self::add_ironwood_output`] has been called on a v6 PSBT; `undefined`
|
|
1811
|
+
* beforehand, and `undefined` again after [`Self::combine_ironwood_proof`] succeeds, since
|
|
1812
|
+
* that call drops the stored PCZT to make extraction terminal (see its doc comment).
|
|
1813
|
+
* @returns {Uint8Array | undefined}
|
|
1814
|
+
*/
|
|
1815
|
+
ironwood_pczt_bytes() {
|
|
1816
|
+
try {
|
|
1817
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1818
|
+
wasm.bitgopsbt_ironwood_pczt_bytes(retptr, this.__wbg_ptr);
|
|
1819
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1820
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1821
|
+
let v1;
|
|
1822
|
+
if (r0 !== 0) {
|
|
1823
|
+
v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
1824
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
1825
|
+
}
|
|
1826
|
+
return v1;
|
|
1827
|
+
} finally {
|
|
1828
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1829
|
+
}
|
|
1830
|
+
}
|
|
1795
1831
|
/**
|
|
1796
1832
|
* The ZIP-244 per-input transparent sighash (32 bytes) that the key controlling transparent
|
|
1797
1833
|
* input `index` must sign.
|
|
@@ -6545,6 +6581,46 @@ class ZcashUnifiedAddress {
|
|
|
6545
6581
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
6546
6582
|
}
|
|
6547
6583
|
}
|
|
6584
|
+
/**
|
|
6585
|
+
* Encode a raw 43-byte Orchard/Ironwood receiver as a single-receiver Unified Address for
|
|
6586
|
+
* `network` ("zcash"/"zec" or "zcashTest"/"tzec").
|
|
6587
|
+
*
|
|
6588
|
+
* Deliberately narrower than a general UA encoder: this always produces exactly one
|
|
6589
|
+
* receiver, so it can't reproduce a multi-receiver UA (transparent + Sapling + Orchard) a
|
|
6590
|
+
* sender might have originally pasted in — only give back *a* valid, usable address for the
|
|
6591
|
+
* Orchard/Ironwood receiver itself.
|
|
6592
|
+
* @param {Uint8Array} receiver
|
|
6593
|
+
* @param {string} network
|
|
6594
|
+
* @returns {string}
|
|
6595
|
+
*/
|
|
6596
|
+
static encodeOrchardReceiver(receiver, network) {
|
|
6597
|
+
let deferred4_0;
|
|
6598
|
+
let deferred4_1;
|
|
6599
|
+
try {
|
|
6600
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
6601
|
+
const ptr0 = passArray8ToWasm0(receiver, wasm.__wbindgen_export);
|
|
6602
|
+
const len0 = WASM_VECTOR_LEN;
|
|
6603
|
+
const ptr1 = passStringToWasm0(network, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
6604
|
+
const len1 = WASM_VECTOR_LEN;
|
|
6605
|
+
wasm.zcashunifiedaddress_encodeOrchardReceiver(retptr, ptr0, len0, ptr1, len1);
|
|
6606
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
6607
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
6608
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
6609
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
6610
|
+
var ptr3 = r0;
|
|
6611
|
+
var len3 = r1;
|
|
6612
|
+
if (r3) {
|
|
6613
|
+
ptr3 = 0; len3 = 0;
|
|
6614
|
+
throw takeObject(r2);
|
|
6615
|
+
}
|
|
6616
|
+
deferred4_0 = ptr3;
|
|
6617
|
+
deferred4_1 = len3;
|
|
6618
|
+
return getStringFromWasm0(ptr3, len3);
|
|
6619
|
+
} finally {
|
|
6620
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
6621
|
+
wasm.__wbindgen_export4(deferred4_0, deferred4_1, 1);
|
|
6622
|
+
}
|
|
6623
|
+
}
|
|
6548
6624
|
/**
|
|
6549
6625
|
* The Orchard/Ironwood receiver's raw 43 bytes (diversifier + pk_d), or `undefined`.
|
|
6550
6626
|
* @returns {Uint8Array | undefined}
|
|
@@ -6791,6 +6867,43 @@ class ZcashV6Transaction {
|
|
|
6791
6867
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
6792
6868
|
}
|
|
6793
6869
|
}
|
|
6870
|
+
/**
|
|
6871
|
+
* The ZIP-244 per-input transparent sighash (32 bytes) for transparent input `index` of
|
|
6872
|
+
* this transaction — the free-standing counterpart to
|
|
6873
|
+
* `ZcashIronwoodBitGoPsbt.transparentSighash`, for a transaction inspected directly from
|
|
6874
|
+
* its raw bytes rather than one built via this codebase's PSBT flow (e.g. independently
|
|
6875
|
+
* verifying an already-broadcast transaction's signatures).
|
|
6876
|
+
*
|
|
6877
|
+
* `input_amounts`/`input_script_pubkeys` are the spent outputs' values (zatoshi) and
|
|
6878
|
+
* scriptPubKeys for *every* transparent input of this transaction, in input order — the
|
|
6879
|
+
* same data `add-input`/`addWalletInput` would have carried in a PSBT's `witness_utxo`.
|
|
6880
|
+
* @param {number} index
|
|
6881
|
+
* @param {BigInt64Array} input_amounts
|
|
6882
|
+
* @param {Uint8Array[]} input_script_pubkeys
|
|
6883
|
+
* @returns {Uint8Array}
|
|
6884
|
+
*/
|
|
6885
|
+
transparentSighash(index, input_amounts, input_script_pubkeys) {
|
|
6886
|
+
try {
|
|
6887
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
6888
|
+
const ptr0 = passArray64ToWasm0(input_amounts, wasm.__wbindgen_export);
|
|
6889
|
+
const len0 = WASM_VECTOR_LEN;
|
|
6890
|
+
const ptr1 = passArrayJsValueToWasm0(input_script_pubkeys, wasm.__wbindgen_export);
|
|
6891
|
+
const len1 = WASM_VECTOR_LEN;
|
|
6892
|
+
wasm.zcashv6transaction_transparentSighash(retptr, this.__wbg_ptr, index, ptr0, len0, ptr1, len1);
|
|
6893
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
6894
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
6895
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
6896
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
6897
|
+
if (r3) {
|
|
6898
|
+
throw takeObject(r2);
|
|
6899
|
+
}
|
|
6900
|
+
var v3 = getArrayU8FromWasm0(r0, r1).slice();
|
|
6901
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
6902
|
+
return v3;
|
|
6903
|
+
} finally {
|
|
6904
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
6905
|
+
}
|
|
6906
|
+
}
|
|
6794
6907
|
/**
|
|
6795
6908
|
* The ZIP-244 txid in internal (non-reversed) byte order.
|
|
6796
6909
|
* @returns {Uint8Array}
|
|
@@ -7445,6 +7558,14 @@ function getArrayU8FromWasm0(ptr, len) {
|
|
|
7445
7558
|
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
7446
7559
|
}
|
|
7447
7560
|
|
|
7561
|
+
let cachedBigUint64ArrayMemory0 = null;
|
|
7562
|
+
function getBigUint64ArrayMemory0() {
|
|
7563
|
+
if (cachedBigUint64ArrayMemory0 === null || cachedBigUint64ArrayMemory0.byteLength === 0) {
|
|
7564
|
+
cachedBigUint64ArrayMemory0 = new BigUint64Array(wasm.memory.buffer);
|
|
7565
|
+
}
|
|
7566
|
+
return cachedBigUint64ArrayMemory0;
|
|
7567
|
+
}
|
|
7568
|
+
|
|
7448
7569
|
let cachedDataViewMemory0 = null;
|
|
7449
7570
|
function getDataViewMemory0() {
|
|
7450
7571
|
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
@@ -7493,6 +7614,13 @@ function isLikeNone(x) {
|
|
|
7493
7614
|
return x === undefined || x === null;
|
|
7494
7615
|
}
|
|
7495
7616
|
|
|
7617
|
+
function passArray64ToWasm0(arg, malloc) {
|
|
7618
|
+
const ptr = malloc(arg.length * 8, 8) >>> 0;
|
|
7619
|
+
getBigUint64ArrayMemory0().set(arg, ptr / 8);
|
|
7620
|
+
WASM_VECTOR_LEN = arg.length;
|
|
7621
|
+
return ptr;
|
|
7622
|
+
}
|
|
7623
|
+
|
|
7496
7624
|
function passArray8ToWasm0(arg, malloc) {
|
|
7497
7625
|
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
7498
7626
|
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
Binary file
|