@bitgo/wasm-utxo 4.25.0 → 4.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/js/fixedScriptWallet/ZcashUnifiedAddress.d.ts +57 -0
- package/dist/cjs/js/fixedScriptWallet/ZcashUnifiedAddress.js +74 -0
- package/dist/cjs/js/fixedScriptWallet/ZcashV6Transaction.d.ts +45 -0
- package/dist/cjs/js/fixedScriptWallet/ZcashV6Transaction.js +73 -0
- package/dist/cjs/js/fixedScriptWallet/index.d.ts +2 -0
- package/dist/cjs/js/fixedScriptWallet/index.js +7 -1
- package/dist/cjs/js/wasm/wasm_utxo.d.ts +98 -0
- package/dist/cjs/js/wasm/wasm_utxo.js +324 -0
- package/dist/cjs/js/wasm/wasm_utxo_bg.wasm +0 -0
- package/dist/cjs/js/wasm/wasm_utxo_bg.wasm.d.ts +61 -44
- package/dist/esm/js/fixedScriptWallet/ZcashUnifiedAddress.d.ts +57 -0
- package/dist/esm/js/fixedScriptWallet/ZcashUnifiedAddress.js +70 -0
- package/dist/esm/js/fixedScriptWallet/ZcashV6Transaction.d.ts +45 -0
- package/dist/esm/js/fixedScriptWallet/ZcashV6Transaction.js +69 -0
- package/dist/esm/js/fixedScriptWallet/index.d.ts +2 -0
- package/dist/esm/js/fixedScriptWallet/index.js +4 -0
- package/dist/esm/js/wasm/wasm_utxo.d.ts +98 -0
- package/dist/esm/js/wasm/wasm_utxo.js +1 -1
- package/dist/esm/js/wasm/wasm_utxo_bg.js +322 -0
- package/dist/esm/js/wasm/wasm_utxo_bg.wasm +0 -0
- package/dist/esm/js/wasm/wasm_utxo_bg.wasm.d.ts +61 -44
- package/package.json +1 -1
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { ZcashV6Transaction as WasmZcashV6Transaction } from "../wasm/wasm_utxo.js";
|
|
2
|
+
/**
|
|
3
|
+
* A parsed Zcash v6 (Ironwood / NU6.3) transaction — for inspection and txid.
|
|
4
|
+
*
|
|
5
|
+
* The transaction id is an instance method ({@link getId}) returning the canonical
|
|
6
|
+
* display-order hex, consistent with the `getId()` convention on the other
|
|
7
|
+
* transaction/PSBT wrappers. Callers never pass raw bytes to a txid function or have
|
|
8
|
+
* to reverse internal byte order themselves.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* const tx = ZcashV6Transaction.fromBytes(rawV6Bytes);
|
|
13
|
+
* tx.getId(); // canonical (display-order) txid hex
|
|
14
|
+
* tx.ironwoodActionCount; // 0 when the Ironwood slot is empty
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export declare class ZcashV6Transaction {
|
|
18
|
+
private _wasm;
|
|
19
|
+
private constructor();
|
|
20
|
+
/**
|
|
21
|
+
* Decode a v6 transaction from raw wire bytes.
|
|
22
|
+
* @throws If the bytes are not a valid v6 (Ironwood) transaction
|
|
23
|
+
*/
|
|
24
|
+
static fromBytes(bytes: Uint8Array): ZcashV6Transaction;
|
|
25
|
+
/** Serialize back to raw v6 wire bytes. */
|
|
26
|
+
toBytes(): Uint8Array;
|
|
27
|
+
/** The canonical (display-order) ZIP-244 txid as a lowercase hex string. */
|
|
28
|
+
getId(): string;
|
|
29
|
+
/** The ZIP-244 txid in internal (non-reversed) byte order. */
|
|
30
|
+
txidBytes(): Uint8Array;
|
|
31
|
+
/** Consensus branch id carried in the v6 header. */
|
|
32
|
+
get consensusBranchId(): number;
|
|
33
|
+
/** Expiry height. */
|
|
34
|
+
get expiryHeight(): number;
|
|
35
|
+
/** Number of Ironwood actions (0 when the Ironwood slot is empty). */
|
|
36
|
+
get ironwoodActionCount(): number;
|
|
37
|
+
/** Net value crossing the Ironwood pool boundary (0 when there is no bundle). */
|
|
38
|
+
get ironwoodValueBalance(): bigint;
|
|
39
|
+
/** The Ironwood bundle flag byte, or `undefined` when there is no bundle. */
|
|
40
|
+
get ironwoodFlags(): number | undefined;
|
|
41
|
+
/** The Ironwood note-commitment tree anchor (32 bytes), or `undefined`. */
|
|
42
|
+
get ironwoodAnchor(): Uint8Array | undefined;
|
|
43
|
+
/** @internal */
|
|
44
|
+
get wasm(): WasmZcashV6Transaction;
|
|
45
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { ZcashV6Transaction as WasmZcashV6Transaction } from "../wasm/wasm_utxo.js";
|
|
2
|
+
/**
|
|
3
|
+
* A parsed Zcash v6 (Ironwood / NU6.3) transaction — for inspection and txid.
|
|
4
|
+
*
|
|
5
|
+
* The transaction id is an instance method ({@link getId}) returning the canonical
|
|
6
|
+
* display-order hex, consistent with the `getId()` convention on the other
|
|
7
|
+
* transaction/PSBT wrappers. Callers never pass raw bytes to a txid function or have
|
|
8
|
+
* to reverse internal byte order themselves.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* const tx = ZcashV6Transaction.fromBytes(rawV6Bytes);
|
|
13
|
+
* tx.getId(); // canonical (display-order) txid hex
|
|
14
|
+
* tx.ironwoodActionCount; // 0 when the Ironwood slot is empty
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export class ZcashV6Transaction {
|
|
18
|
+
_wasm;
|
|
19
|
+
constructor(_wasm) {
|
|
20
|
+
this._wasm = _wasm;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Decode a v6 transaction from raw wire bytes.
|
|
24
|
+
* @throws If the bytes are not a valid v6 (Ironwood) transaction
|
|
25
|
+
*/
|
|
26
|
+
static fromBytes(bytes) {
|
|
27
|
+
return new ZcashV6Transaction(WasmZcashV6Transaction.fromBytes(bytes));
|
|
28
|
+
}
|
|
29
|
+
/** Serialize back to raw v6 wire bytes. */
|
|
30
|
+
toBytes() {
|
|
31
|
+
return this._wasm.toBytes();
|
|
32
|
+
}
|
|
33
|
+
/** The canonical (display-order) ZIP-244 txid as a lowercase hex string. */
|
|
34
|
+
getId() {
|
|
35
|
+
return this._wasm.getId();
|
|
36
|
+
}
|
|
37
|
+
/** The ZIP-244 txid in internal (non-reversed) byte order. */
|
|
38
|
+
txidBytes() {
|
|
39
|
+
return this._wasm.txidBytes();
|
|
40
|
+
}
|
|
41
|
+
/** Consensus branch id carried in the v6 header. */
|
|
42
|
+
get consensusBranchId() {
|
|
43
|
+
return this._wasm.consensusBranchId;
|
|
44
|
+
}
|
|
45
|
+
/** Expiry height. */
|
|
46
|
+
get expiryHeight() {
|
|
47
|
+
return this._wasm.expiryHeight;
|
|
48
|
+
}
|
|
49
|
+
/** Number of Ironwood actions (0 when the Ironwood slot is empty). */
|
|
50
|
+
get ironwoodActionCount() {
|
|
51
|
+
return this._wasm.ironwoodActionCount;
|
|
52
|
+
}
|
|
53
|
+
/** Net value crossing the Ironwood pool boundary (0 when there is no bundle). */
|
|
54
|
+
get ironwoodValueBalance() {
|
|
55
|
+
return this._wasm.ironwoodValueBalance;
|
|
56
|
+
}
|
|
57
|
+
/** The Ironwood bundle flag byte, or `undefined` when there is no bundle. */
|
|
58
|
+
get ironwoodFlags() {
|
|
59
|
+
return this._wasm.ironwoodFlags;
|
|
60
|
+
}
|
|
61
|
+
/** The Ironwood note-commitment tree anchor (32 bytes), or `undefined`. */
|
|
62
|
+
get ironwoodAnchor() {
|
|
63
|
+
return this._wasm.ironwoodAnchor;
|
|
64
|
+
}
|
|
65
|
+
/** @internal */
|
|
66
|
+
get wasm() {
|
|
67
|
+
return this._wasm;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
@@ -9,6 +9,8 @@ export { requiresPrevTxForP2sh } from "./prevTx.js";
|
|
|
9
9
|
export { BitGoPsbt, getWalletKeysFromPsbt, type NetworkName, type ScriptId, type ParsedInput, type ParsedOutput, type ParsedTransaction, type SignPath, type CreateEmptyOptions, type AddInputOptions, type AddOutputOptions, type AddWalletInputOptions, type AddWalletOutputOptions, type ParseTransactionOptions, type ParseOutputsOptions, type HydrationUnspent, } from "./BitGoPsbt.js";
|
|
10
10
|
export { BitGoKeySubtype, type PsbtKvKey } from "./BitGoKeySubtype.js";
|
|
11
11
|
export { ZcashBitGoPsbt, type ZcashNetworkName, type CreateEmptyZcashOptions, } from "./ZcashBitGoPsbt.js";
|
|
12
|
+
export { ZcashUnifiedAddress } from "./ZcashUnifiedAddress.js";
|
|
13
|
+
export { ZcashV6Transaction } from "./ZcashV6Transaction.js";
|
|
12
14
|
import type { ScriptType } from "./scriptType.js";
|
|
13
15
|
/**
|
|
14
16
|
* Check if a network supports a given fixed-script wallet script type
|
|
@@ -12,6 +12,10 @@ export { BitGoPsbt, getWalletKeysFromPsbt, } from "./BitGoPsbt.js";
|
|
|
12
12
|
export { BitGoKeySubtype } from "./BitGoKeySubtype.js";
|
|
13
13
|
// Zcash-specific PSBT subclass
|
|
14
14
|
export { ZcashBitGoPsbt, } from "./ZcashBitGoPsbt.js";
|
|
15
|
+
// Zcash ZIP-316 Unified Address
|
|
16
|
+
export { ZcashUnifiedAddress } from "./ZcashUnifiedAddress.js";
|
|
17
|
+
// Zcash v6 (Ironwood / NU6.3) transaction
|
|
18
|
+
export { ZcashV6Transaction } from "./ZcashV6Transaction.js";
|
|
15
19
|
/**
|
|
16
20
|
* Check if a network supports a given fixed-script wallet script type
|
|
17
21
|
*
|
|
@@ -1584,6 +1584,101 @@ export class WrapPsbt {
|
|
|
1584
1584
|
version(): number;
|
|
1585
1585
|
}
|
|
1586
1586
|
|
|
1587
|
+
/**
|
|
1588
|
+
* A parsed ZIP-316 Unified Address.
|
|
1589
|
+
*
|
|
1590
|
+
* Decode once with [`ZcashUnifiedAddress::parse`], then read each component through
|
|
1591
|
+
* its accessor (returns `undefined` when absent). Ironwood reuses the Orchard
|
|
1592
|
+
* receiver, so `orchardReceiver` is the shielded receiver for Ironwood output notes.
|
|
1593
|
+
*/
|
|
1594
|
+
export class ZcashUnifiedAddress {
|
|
1595
|
+
private constructor();
|
|
1596
|
+
free(): void;
|
|
1597
|
+
[Symbol.dispose](): void;
|
|
1598
|
+
/**
|
|
1599
|
+
* Whether `candidate` (another Unified Address, or a transparent Zcash address
|
|
1600
|
+
* on the same network) is a receiver of this Unified Address.
|
|
1601
|
+
*/
|
|
1602
|
+
contains(candidate: string): boolean;
|
|
1603
|
+
/**
|
|
1604
|
+
* Parse a Unified Address for `network` ("zcash"/"zec" or "zcashTest"/"tzec").
|
|
1605
|
+
*
|
|
1606
|
+
* All receiver components are resolved and validated eagerly, so the accessors
|
|
1607
|
+
* below are infallible. Throws if the address is malformed or on the wrong network.
|
|
1608
|
+
*/
|
|
1609
|
+
static parse(address: string, network: string): ZcashUnifiedAddress;
|
|
1610
|
+
/**
|
|
1611
|
+
* The Orchard/Ironwood receiver's raw 43 bytes (diversifier + pk_d), or `undefined`.
|
|
1612
|
+
*/
|
|
1613
|
+
readonly orchardReceiver: Uint8Array | undefined;
|
|
1614
|
+
/**
|
|
1615
|
+
* The Sapling receiver's raw 43 bytes (diversifier + pk_d), or `undefined`.
|
|
1616
|
+
*/
|
|
1617
|
+
readonly saplingReceiver: Uint8Array | undefined;
|
|
1618
|
+
/**
|
|
1619
|
+
* The transparent receiver as scriptPubKey bytes (P2PKH/P2SH), or `undefined`.
|
|
1620
|
+
*/
|
|
1621
|
+
readonly transparentScript: Uint8Array | undefined;
|
|
1622
|
+
}
|
|
1623
|
+
|
|
1624
|
+
/**
|
|
1625
|
+
* A parsed Zcash v6 (Ironwood / NU6.3) transaction — for inspection and txid.
|
|
1626
|
+
*
|
|
1627
|
+
* This wraps the raw v6 wire codec. The transaction id is exposed as an instance
|
|
1628
|
+
* method [`ZcashV6Transaction::get_id`] (canonical display-order hex), matching the
|
|
1629
|
+
* `getId()` convention used by the other transaction/PSBT wrappers, so callers never
|
|
1630
|
+
* pass raw bytes to a txid function or juggle internal vs display byte order.
|
|
1631
|
+
*/
|
|
1632
|
+
export class ZcashV6Transaction {
|
|
1633
|
+
private constructor();
|
|
1634
|
+
free(): void;
|
|
1635
|
+
[Symbol.dispose](): void;
|
|
1636
|
+
/**
|
|
1637
|
+
* Decode a v6 transaction from raw wire bytes. Throws if the bytes are not a
|
|
1638
|
+
* valid v6 (Ironwood) transaction.
|
|
1639
|
+
*/
|
|
1640
|
+
static fromBytes(bytes: Uint8Array): ZcashV6Transaction;
|
|
1641
|
+
/**
|
|
1642
|
+
* The canonical (display-order) ZIP-244 txid as a lowercase hex string.
|
|
1643
|
+
*
|
|
1644
|
+
* `Txid`'s `Display` emits display-order (byte-reversed) hex, matching how a
|
|
1645
|
+
* transaction id is printed everywhere else in the codebase.
|
|
1646
|
+
*/
|
|
1647
|
+
getId(): string;
|
|
1648
|
+
/**
|
|
1649
|
+
* Serialize back to raw v6 wire bytes.
|
|
1650
|
+
*/
|
|
1651
|
+
toBytes(): Uint8Array;
|
|
1652
|
+
/**
|
|
1653
|
+
* The ZIP-244 txid in internal (non-reversed) byte order.
|
|
1654
|
+
*/
|
|
1655
|
+
txidBytes(): Uint8Array;
|
|
1656
|
+
/**
|
|
1657
|
+
* Consensus branch id carried in the v6 header.
|
|
1658
|
+
*/
|
|
1659
|
+
readonly consensusBranchId: number;
|
|
1660
|
+
/**
|
|
1661
|
+
* Expiry height.
|
|
1662
|
+
*/
|
|
1663
|
+
readonly expiryHeight: number;
|
|
1664
|
+
/**
|
|
1665
|
+
* Number of Ironwood actions (0 when the Ironwood slot is empty).
|
|
1666
|
+
*/
|
|
1667
|
+
readonly ironwoodActionCount: number;
|
|
1668
|
+
/**
|
|
1669
|
+
* The Ironwood note-commitment tree anchor (32 bytes), or `undefined`.
|
|
1670
|
+
*/
|
|
1671
|
+
readonly ironwoodAnchor: Uint8Array | undefined;
|
|
1672
|
+
/**
|
|
1673
|
+
* The Ironwood bundle flag byte, or `undefined` when there is no bundle.
|
|
1674
|
+
*/
|
|
1675
|
+
readonly ironwoodFlags: number | undefined;
|
|
1676
|
+
/**
|
|
1677
|
+
* Net value crossing the Ironwood pool boundary (0 when there is no bundle).
|
|
1678
|
+
*/
|
|
1679
|
+
readonly ironwoodValueBalance: bigint;
|
|
1680
|
+
}
|
|
1681
|
+
|
|
1587
1682
|
/**
|
|
1588
1683
|
* Check if the inspect feature is enabled.
|
|
1589
1684
|
*
|
|
@@ -1661,5 +1756,8 @@ export function parseTxToJson(tx_bytes: Uint8Array, coin_name: string): string;
|
|
|
1661
1756
|
* `network`: "zcash" / "zec" for mainnet, "zcashTest" / "tzec" for testnet.
|
|
1662
1757
|
* Returns `None` if `height` is before Overwinter activation.
|
|
1663
1758
|
* Throws if `network` is not a recognised Zcash network name.
|
|
1759
|
+
*
|
|
1760
|
+
* Errors are thrown as the crate-standard [`WasmUtxoError`] (a marked `js_sys::Error`
|
|
1761
|
+
* with `.message` and `.code`), not a bare string.
|
|
1664
1762
|
*/
|
|
1665
1763
|
export function zcash_branch_id_for_height(network: string, height: number): number | undefined;
|
|
@@ -5,5 +5,5 @@ import { __wbg_set_wasm } from "./wasm_utxo_bg.js";
|
|
|
5
5
|
__wbg_set_wasm(wasm);
|
|
6
6
|
|
|
7
7
|
export {
|
|
8
|
-
AddressNamespace, Bip322Namespace, BitGoPsbt, FixedScriptWalletNamespace, InscriptionsNamespace, MessageNamespace, UtxolibCompatNamespace, WasmBIP32, WasmDashTransaction, WasmDimensions, WasmECPair, WasmReplayProtection, WasmRootWalletKeys, WasmTransaction, WasmUtxoNamespace, WasmZcashTransaction, WrapDescriptor, WrapMiniscript, WrapPsbt, isInspectEnabled, parsePsbtRawToJson, parsePsbtToJson, parseTxToJson, zcash_branch_id_for_height
|
|
8
|
+
AddressNamespace, Bip322Namespace, BitGoPsbt, FixedScriptWalletNamespace, InscriptionsNamespace, MessageNamespace, UtxolibCompatNamespace, WasmBIP32, WasmDashTransaction, WasmDimensions, WasmECPair, WasmReplayProtection, WasmRootWalletKeys, WasmTransaction, WasmUtxoNamespace, WasmZcashTransaction, WrapDescriptor, WrapMiniscript, WrapPsbt, ZcashUnifiedAddress, ZcashV6Transaction, isInspectEnabled, parsePsbtRawToJson, parsePsbtToJson, parseTxToJson, zcash_branch_id_for_height
|
|
9
9
|
} from "./wasm_utxo_bg.js";
|
|
@@ -6194,6 +6194,319 @@ export class WrapPsbt {
|
|
|
6194
6194
|
}
|
|
6195
6195
|
if (Symbol.dispose) WrapPsbt.prototype[Symbol.dispose] = WrapPsbt.prototype.free;
|
|
6196
6196
|
|
|
6197
|
+
/**
|
|
6198
|
+
* A parsed ZIP-316 Unified Address.
|
|
6199
|
+
*
|
|
6200
|
+
* Decode once with [`ZcashUnifiedAddress::parse`], then read each component through
|
|
6201
|
+
* its accessor (returns `undefined` when absent). Ironwood reuses the Orchard
|
|
6202
|
+
* receiver, so `orchardReceiver` is the shielded receiver for Ironwood output notes.
|
|
6203
|
+
*/
|
|
6204
|
+
export class ZcashUnifiedAddress {
|
|
6205
|
+
static __wrap(ptr) {
|
|
6206
|
+
ptr = ptr >>> 0;
|
|
6207
|
+
const obj = Object.create(ZcashUnifiedAddress.prototype);
|
|
6208
|
+
obj.__wbg_ptr = ptr;
|
|
6209
|
+
ZcashUnifiedAddressFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
6210
|
+
return obj;
|
|
6211
|
+
}
|
|
6212
|
+
__destroy_into_raw() {
|
|
6213
|
+
const ptr = this.__wbg_ptr;
|
|
6214
|
+
this.__wbg_ptr = 0;
|
|
6215
|
+
ZcashUnifiedAddressFinalization.unregister(this);
|
|
6216
|
+
return ptr;
|
|
6217
|
+
}
|
|
6218
|
+
free() {
|
|
6219
|
+
const ptr = this.__destroy_into_raw();
|
|
6220
|
+
wasm.__wbg_zcashunifiedaddress_free(ptr, 0);
|
|
6221
|
+
}
|
|
6222
|
+
/**
|
|
6223
|
+
* Whether `candidate` (another Unified Address, or a transparent Zcash address
|
|
6224
|
+
* on the same network) is a receiver of this Unified Address.
|
|
6225
|
+
* @param {string} candidate
|
|
6226
|
+
* @returns {boolean}
|
|
6227
|
+
*/
|
|
6228
|
+
contains(candidate) {
|
|
6229
|
+
try {
|
|
6230
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
6231
|
+
const ptr0 = passStringToWasm0(candidate, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
6232
|
+
const len0 = WASM_VECTOR_LEN;
|
|
6233
|
+
wasm.zcashunifiedaddress_contains(retptr, this.__wbg_ptr, ptr0, len0);
|
|
6234
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
6235
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
6236
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
6237
|
+
if (r2) {
|
|
6238
|
+
throw takeObject(r1);
|
|
6239
|
+
}
|
|
6240
|
+
return r0 !== 0;
|
|
6241
|
+
} finally {
|
|
6242
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
6243
|
+
}
|
|
6244
|
+
}
|
|
6245
|
+
/**
|
|
6246
|
+
* The Orchard/Ironwood receiver's raw 43 bytes (diversifier + pk_d), or `undefined`.
|
|
6247
|
+
* @returns {Uint8Array | undefined}
|
|
6248
|
+
*/
|
|
6249
|
+
get orchardReceiver() {
|
|
6250
|
+
try {
|
|
6251
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
6252
|
+
wasm.zcashunifiedaddress_orchardReceiver(retptr, this.__wbg_ptr);
|
|
6253
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
6254
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
6255
|
+
let v1;
|
|
6256
|
+
if (r0 !== 0) {
|
|
6257
|
+
v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
6258
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
6259
|
+
}
|
|
6260
|
+
return v1;
|
|
6261
|
+
} finally {
|
|
6262
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
6263
|
+
}
|
|
6264
|
+
}
|
|
6265
|
+
/**
|
|
6266
|
+
* Parse a Unified Address for `network` ("zcash"/"zec" or "zcashTest"/"tzec").
|
|
6267
|
+
*
|
|
6268
|
+
* All receiver components are resolved and validated eagerly, so the accessors
|
|
6269
|
+
* below are infallible. Throws if the address is malformed or on the wrong network.
|
|
6270
|
+
* @param {string} address
|
|
6271
|
+
* @param {string} network
|
|
6272
|
+
* @returns {ZcashUnifiedAddress}
|
|
6273
|
+
*/
|
|
6274
|
+
static parse(address, network) {
|
|
6275
|
+
try {
|
|
6276
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
6277
|
+
const ptr0 = passStringToWasm0(address, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
6278
|
+
const len0 = WASM_VECTOR_LEN;
|
|
6279
|
+
const ptr1 = passStringToWasm0(network, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
6280
|
+
const len1 = WASM_VECTOR_LEN;
|
|
6281
|
+
wasm.zcashunifiedaddress_parse(retptr, ptr0, len0, ptr1, len1);
|
|
6282
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
6283
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
6284
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
6285
|
+
if (r2) {
|
|
6286
|
+
throw takeObject(r1);
|
|
6287
|
+
}
|
|
6288
|
+
return ZcashUnifiedAddress.__wrap(r0);
|
|
6289
|
+
} finally {
|
|
6290
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
6291
|
+
}
|
|
6292
|
+
}
|
|
6293
|
+
/**
|
|
6294
|
+
* The Sapling receiver's raw 43 bytes (diversifier + pk_d), or `undefined`.
|
|
6295
|
+
* @returns {Uint8Array | undefined}
|
|
6296
|
+
*/
|
|
6297
|
+
get saplingReceiver() {
|
|
6298
|
+
try {
|
|
6299
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
6300
|
+
wasm.zcashunifiedaddress_saplingReceiver(retptr, this.__wbg_ptr);
|
|
6301
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
6302
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
6303
|
+
let v1;
|
|
6304
|
+
if (r0 !== 0) {
|
|
6305
|
+
v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
6306
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
6307
|
+
}
|
|
6308
|
+
return v1;
|
|
6309
|
+
} finally {
|
|
6310
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
6311
|
+
}
|
|
6312
|
+
}
|
|
6313
|
+
/**
|
|
6314
|
+
* The transparent receiver as scriptPubKey bytes (P2PKH/P2SH), or `undefined`.
|
|
6315
|
+
* @returns {Uint8Array | undefined}
|
|
6316
|
+
*/
|
|
6317
|
+
get transparentScript() {
|
|
6318
|
+
try {
|
|
6319
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
6320
|
+
wasm.zcashunifiedaddress_transparentScript(retptr, this.__wbg_ptr);
|
|
6321
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
6322
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
6323
|
+
let v1;
|
|
6324
|
+
if (r0 !== 0) {
|
|
6325
|
+
v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
6326
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
6327
|
+
}
|
|
6328
|
+
return v1;
|
|
6329
|
+
} finally {
|
|
6330
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
6331
|
+
}
|
|
6332
|
+
}
|
|
6333
|
+
}
|
|
6334
|
+
if (Symbol.dispose) ZcashUnifiedAddress.prototype[Symbol.dispose] = ZcashUnifiedAddress.prototype.free;
|
|
6335
|
+
|
|
6336
|
+
/**
|
|
6337
|
+
* A parsed Zcash v6 (Ironwood / NU6.3) transaction — for inspection and txid.
|
|
6338
|
+
*
|
|
6339
|
+
* This wraps the raw v6 wire codec. The transaction id is exposed as an instance
|
|
6340
|
+
* method [`ZcashV6Transaction::get_id`] (canonical display-order hex), matching the
|
|
6341
|
+
* `getId()` convention used by the other transaction/PSBT wrappers, so callers never
|
|
6342
|
+
* pass raw bytes to a txid function or juggle internal vs display byte order.
|
|
6343
|
+
*/
|
|
6344
|
+
export class ZcashV6Transaction {
|
|
6345
|
+
static __wrap(ptr) {
|
|
6346
|
+
ptr = ptr >>> 0;
|
|
6347
|
+
const obj = Object.create(ZcashV6Transaction.prototype);
|
|
6348
|
+
obj.__wbg_ptr = ptr;
|
|
6349
|
+
ZcashV6TransactionFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
6350
|
+
return obj;
|
|
6351
|
+
}
|
|
6352
|
+
__destroy_into_raw() {
|
|
6353
|
+
const ptr = this.__wbg_ptr;
|
|
6354
|
+
this.__wbg_ptr = 0;
|
|
6355
|
+
ZcashV6TransactionFinalization.unregister(this);
|
|
6356
|
+
return ptr;
|
|
6357
|
+
}
|
|
6358
|
+
free() {
|
|
6359
|
+
const ptr = this.__destroy_into_raw();
|
|
6360
|
+
wasm.__wbg_zcashv6transaction_free(ptr, 0);
|
|
6361
|
+
}
|
|
6362
|
+
/**
|
|
6363
|
+
* Consensus branch id carried in the v6 header.
|
|
6364
|
+
* @returns {number}
|
|
6365
|
+
*/
|
|
6366
|
+
get consensusBranchId() {
|
|
6367
|
+
const ret = wasm.zcashv6transaction_consensusBranchId(this.__wbg_ptr);
|
|
6368
|
+
return ret >>> 0;
|
|
6369
|
+
}
|
|
6370
|
+
/**
|
|
6371
|
+
* Expiry height.
|
|
6372
|
+
* @returns {number}
|
|
6373
|
+
*/
|
|
6374
|
+
get expiryHeight() {
|
|
6375
|
+
const ret = wasm.zcashv6transaction_expiryHeight(this.__wbg_ptr);
|
|
6376
|
+
return ret >>> 0;
|
|
6377
|
+
}
|
|
6378
|
+
/**
|
|
6379
|
+
* Decode a v6 transaction from raw wire bytes. Throws if the bytes are not a
|
|
6380
|
+
* valid v6 (Ironwood) transaction.
|
|
6381
|
+
* @param {Uint8Array} bytes
|
|
6382
|
+
* @returns {ZcashV6Transaction}
|
|
6383
|
+
*/
|
|
6384
|
+
static fromBytes(bytes) {
|
|
6385
|
+
try {
|
|
6386
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
6387
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
|
|
6388
|
+
const len0 = WASM_VECTOR_LEN;
|
|
6389
|
+
wasm.zcashv6transaction_fromBytes(retptr, ptr0, len0);
|
|
6390
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
6391
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
6392
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
6393
|
+
if (r2) {
|
|
6394
|
+
throw takeObject(r1);
|
|
6395
|
+
}
|
|
6396
|
+
return ZcashV6Transaction.__wrap(r0);
|
|
6397
|
+
} finally {
|
|
6398
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
6399
|
+
}
|
|
6400
|
+
}
|
|
6401
|
+
/**
|
|
6402
|
+
* The canonical (display-order) ZIP-244 txid as a lowercase hex string.
|
|
6403
|
+
*
|
|
6404
|
+
* `Txid`'s `Display` emits display-order (byte-reversed) hex, matching how a
|
|
6405
|
+
* transaction id is printed everywhere else in the codebase.
|
|
6406
|
+
* @returns {string}
|
|
6407
|
+
*/
|
|
6408
|
+
getId() {
|
|
6409
|
+
let deferred1_0;
|
|
6410
|
+
let deferred1_1;
|
|
6411
|
+
try {
|
|
6412
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
6413
|
+
wasm.zcashv6transaction_getId(retptr, this.__wbg_ptr);
|
|
6414
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
6415
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
6416
|
+
deferred1_0 = r0;
|
|
6417
|
+
deferred1_1 = r1;
|
|
6418
|
+
return getStringFromWasm0(r0, r1);
|
|
6419
|
+
} finally {
|
|
6420
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
6421
|
+
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
6422
|
+
}
|
|
6423
|
+
}
|
|
6424
|
+
/**
|
|
6425
|
+
* Number of Ironwood actions (0 when the Ironwood slot is empty).
|
|
6426
|
+
* @returns {number}
|
|
6427
|
+
*/
|
|
6428
|
+
get ironwoodActionCount() {
|
|
6429
|
+
const ret = wasm.zcashv6transaction_ironwoodActionCount(this.__wbg_ptr);
|
|
6430
|
+
return ret >>> 0;
|
|
6431
|
+
}
|
|
6432
|
+
/**
|
|
6433
|
+
* The Ironwood note-commitment tree anchor (32 bytes), or `undefined`.
|
|
6434
|
+
* @returns {Uint8Array | undefined}
|
|
6435
|
+
*/
|
|
6436
|
+
get ironwoodAnchor() {
|
|
6437
|
+
try {
|
|
6438
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
6439
|
+
wasm.zcashv6transaction_ironwoodAnchor(retptr, this.__wbg_ptr);
|
|
6440
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
6441
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
6442
|
+
let v1;
|
|
6443
|
+
if (r0 !== 0) {
|
|
6444
|
+
v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
6445
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
6446
|
+
}
|
|
6447
|
+
return v1;
|
|
6448
|
+
} finally {
|
|
6449
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
6450
|
+
}
|
|
6451
|
+
}
|
|
6452
|
+
/**
|
|
6453
|
+
* The Ironwood bundle flag byte, or `undefined` when there is no bundle.
|
|
6454
|
+
* @returns {number | undefined}
|
|
6455
|
+
*/
|
|
6456
|
+
get ironwoodFlags() {
|
|
6457
|
+
const ret = wasm.zcashv6transaction_ironwoodFlags(this.__wbg_ptr);
|
|
6458
|
+
return ret === 0xFFFFFF ? undefined : ret;
|
|
6459
|
+
}
|
|
6460
|
+
/**
|
|
6461
|
+
* Net value crossing the Ironwood pool boundary (0 when there is no bundle).
|
|
6462
|
+
* @returns {bigint}
|
|
6463
|
+
*/
|
|
6464
|
+
get ironwoodValueBalance() {
|
|
6465
|
+
const ret = wasm.zcashv6transaction_ironwoodValueBalance(this.__wbg_ptr);
|
|
6466
|
+
return ret;
|
|
6467
|
+
}
|
|
6468
|
+
/**
|
|
6469
|
+
* Serialize back to raw v6 wire bytes.
|
|
6470
|
+
* @returns {Uint8Array}
|
|
6471
|
+
*/
|
|
6472
|
+
toBytes() {
|
|
6473
|
+
try {
|
|
6474
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
6475
|
+
wasm.zcashv6transaction_toBytes(retptr, this.__wbg_ptr);
|
|
6476
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
6477
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
6478
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
6479
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
6480
|
+
if (r3) {
|
|
6481
|
+
throw takeObject(r2);
|
|
6482
|
+
}
|
|
6483
|
+
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
6484
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
6485
|
+
return v1;
|
|
6486
|
+
} finally {
|
|
6487
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
6488
|
+
}
|
|
6489
|
+
}
|
|
6490
|
+
/**
|
|
6491
|
+
* The ZIP-244 txid in internal (non-reversed) byte order.
|
|
6492
|
+
* @returns {Uint8Array}
|
|
6493
|
+
*/
|
|
6494
|
+
txidBytes() {
|
|
6495
|
+
try {
|
|
6496
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
6497
|
+
wasm.zcashv6transaction_txidBytes(retptr, this.__wbg_ptr);
|
|
6498
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
6499
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
6500
|
+
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
6501
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
6502
|
+
return v1;
|
|
6503
|
+
} finally {
|
|
6504
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
6505
|
+
}
|
|
6506
|
+
}
|
|
6507
|
+
}
|
|
6508
|
+
if (Symbol.dispose) ZcashV6Transaction.prototype[Symbol.dispose] = ZcashV6Transaction.prototype.free;
|
|
6509
|
+
|
|
6197
6510
|
/**
|
|
6198
6511
|
* Check if the inspect feature is enabled.
|
|
6199
6512
|
*
|
|
@@ -6365,6 +6678,9 @@ export function parseTxToJson(tx_bytes, coin_name) {
|
|
|
6365
6678
|
* `network`: "zcash" / "zec" for mainnet, "zcashTest" / "tzec" for testnet.
|
|
6366
6679
|
* Returns `None` if `height` is before Overwinter activation.
|
|
6367
6680
|
* Throws if `network` is not a recognised Zcash network name.
|
|
6681
|
+
*
|
|
6682
|
+
* Errors are thrown as the crate-standard [`WasmUtxoError`] (a marked `js_sys::Error`
|
|
6683
|
+
* with `.message` and `.code`), not a bare string.
|
|
6368
6684
|
* @param {string} network
|
|
6369
6685
|
* @param {number} height
|
|
6370
6686
|
* @returns {number | undefined}
|
|
@@ -6675,6 +6991,12 @@ const WrapMiniscriptFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
|
6675
6991
|
const WrapPsbtFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
6676
6992
|
? { register: () => {}, unregister: () => {} }
|
|
6677
6993
|
: new FinalizationRegistry(ptr => wasm.__wbg_wrappsbt_free(ptr >>> 0, 1));
|
|
6994
|
+
const ZcashUnifiedAddressFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
6995
|
+
? { register: () => {}, unregister: () => {} }
|
|
6996
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_zcashunifiedaddress_free(ptr >>> 0, 1));
|
|
6997
|
+
const ZcashV6TransactionFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
6998
|
+
? { register: () => {}, unregister: () => {} }
|
|
6999
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_zcashv6transaction_free(ptr >>> 0, 1));
|
|
6678
7000
|
|
|
6679
7001
|
function addHeapObject(obj) {
|
|
6680
7002
|
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
Binary file
|