@bitgo/wasm-utxo 4.41.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/ZcashUnifiedAddress.d.ts +16 -0
- package/dist/cjs/js/fixedScriptWallet/ZcashUnifiedAddress.js +20 -0
- 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 +53 -5
- package/dist/cjs/js/wasm/wasm_utxo.js +136 -7
- package/dist/cjs/js/wasm/wasm_utxo_bg.wasm +0 -0
- package/dist/cjs/js/wasm/wasm_utxo_bg.wasm.d.ts +80 -74
- 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/ZcashUnifiedAddress.d.ts +16 -0
- package/dist/esm/js/fixedScriptWallet/ZcashUnifiedAddress.js +20 -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 +53 -5
- package/dist/esm/js/wasm/wasm_utxo.js +1 -1
- package/dist/esm/js/wasm/wasm_utxo_bg.js +132 -7
- package/dist/esm/js/wasm/wasm_utxo_bg.wasm +0 -0
- package/dist/esm/js/wasm/wasm_utxo_bg.wasm.d.ts +80 -74
- package/dist/esm/js/zcashAddress.d.ts +44 -0
- package/dist/esm/js/zcashAddress.js +52 -0
- package/package.json +1 -1
|
@@ -1,15 +1,39 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
+
export const __wbg_utxolibcompatnamespace_free: (a: number, b: number) => void;
|
|
5
|
+
export const __wbg_wasmdimensions_free: (a: number, b: number) => void;
|
|
6
|
+
export const utxolibcompatnamespace_from_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
7
|
+
export const utxolibcompatnamespace_to_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
8
|
+
export const wasmdimensions_empty: () => number;
|
|
9
|
+
export const wasmdimensions_from_input: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
10
|
+
export const wasmdimensions_from_input_script_type: (a: number, b: number, c: number, d: number) => void;
|
|
11
|
+
export const wasmdimensions_from_output_script_length: (a: number) => number;
|
|
12
|
+
export const wasmdimensions_from_output_script_type: (a: number, b: number, c: number) => void;
|
|
13
|
+
export const wasmdimensions_from_psbt: (a: number, b: number) => void;
|
|
14
|
+
export const wasmdimensions_get_input_vsize: (a: number, b: number, c: number) => number;
|
|
15
|
+
export const wasmdimensions_get_input_weight: (a: number, b: number, c: number) => number;
|
|
16
|
+
export const wasmdimensions_get_output_vsize: (a: number) => number;
|
|
17
|
+
export const wasmdimensions_get_output_weight: (a: number) => number;
|
|
18
|
+
export const wasmdimensions_get_vsize: (a: number, b: number, c: number) => number;
|
|
19
|
+
export const wasmdimensions_get_weight: (a: number, b: number, c: number) => number;
|
|
20
|
+
export const wasmdimensions_has_segwit: (a: number) => number;
|
|
21
|
+
export const wasmdimensions_plus: (a: number, b: number) => number;
|
|
22
|
+
export const wasmdimensions_times: (a: number, b: number) => number;
|
|
4
23
|
export const __wbg_bip322namespace_free: (a: number, b: number) => void;
|
|
24
|
+
export const __wbg_wasmrootwalletkeys_free: (a: number, b: number) => void;
|
|
5
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;
|
|
6
26
|
export const bip322namespace_get_bip322_message: (a: number, b: number, c: number) => void;
|
|
7
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;
|
|
8
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;
|
|
9
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;
|
|
10
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;
|
|
11
36
|
export const __wbg_ironwoodwitness_free: (a: number, b: number) => void;
|
|
12
|
-
export const __wbg_messagenamespace_free: (a: number, b: number) => void;
|
|
13
37
|
export const __wbg_wasmdashtransaction_free: (a: number, b: number) => void;
|
|
14
38
|
export const __wbg_wasmreplayprotection_free: (a: number, b: number) => void;
|
|
15
39
|
export const __wbg_wasmtransaction_free: (a: number, b: number) => void;
|
|
@@ -20,8 +44,6 @@ export const __wbg_zcashv6transaction_free: (a: number, b: number) => void;
|
|
|
20
44
|
export const ironwood_build_witness: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
|
|
21
45
|
export const ironwoodwitness_auth_path: (a: number, b: number) => void;
|
|
22
46
|
export const ironwoodwitness_position: (a: number) => number;
|
|
23
|
-
export const messagenamespace_sign_message: (a: number, b: number, c: number, d: number) => void;
|
|
24
|
-
export const messagenamespace_verify_message: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
25
47
|
export const wasmdashtransaction_from_bytes: (a: number, b: number, c: number) => void;
|
|
26
48
|
export const wasmdashtransaction_get_inputs: (a: number, b: number) => void;
|
|
27
49
|
export const wasmdashtransaction_get_outputs: (a: number, b: number) => void;
|
|
@@ -98,10 +120,16 @@ export const wrappsbt_update_input_with_descriptor: (a: number, b: number, c: nu
|
|
|
98
120
|
export const wrappsbt_update_output_with_descriptor: (a: number, b: number, c: number, d: number) => void;
|
|
99
121
|
export const wrappsbt_validate_signature_at_input: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
100
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;
|
|
101
127
|
export const zcash_branch_id_for_height: (a: number, b: number, c: number, d: number) => void;
|
|
102
128
|
export const zcash_ironwood_version_group_id: () => number;
|
|
103
129
|
export const zcashunifiedaddress_contains: (a: number, b: number, c: number, d: number) => void;
|
|
104
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;
|
|
105
133
|
export const zcashunifiedaddress_orchardReceiver: (a: number, b: number) => void;
|
|
106
134
|
export const zcashunifiedaddress_parse: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
107
135
|
export const zcashunifiedaddress_saplingReceiver: (a: number, b: number) => void;
|
|
@@ -127,36 +155,33 @@ export const wasmzcashtransaction_lock_time: (a: number) => number;
|
|
|
127
155
|
export const wasmzcashtransaction_version: (a: number) => number;
|
|
128
156
|
export const wrappsbt_lock_time: (a: number) => number;
|
|
129
157
|
export const wrappsbt_version: (a: number) => number;
|
|
130
|
-
export const
|
|
131
|
-
export const
|
|
132
|
-
export const
|
|
133
|
-
export const
|
|
134
|
-
export const
|
|
135
|
-
export const
|
|
136
|
-
export const
|
|
137
|
-
export const
|
|
138
|
-
export const
|
|
139
|
-
export const
|
|
140
|
-
export const
|
|
141
|
-
export const
|
|
142
|
-
export const
|
|
143
|
-
export const
|
|
144
|
-
export const
|
|
145
|
-
export const
|
|
146
|
-
export const
|
|
147
|
-
export const
|
|
148
|
-
export const
|
|
149
|
-
export const
|
|
150
|
-
export const
|
|
151
|
-
export const
|
|
152
|
-
export const
|
|
153
|
-
export const wrapminiscript_toAsmString: (a: number, b: number) => void;
|
|
154
|
-
export const wrapminiscript_toString: (a: number, b: 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;
|
|
155
181
|
export const __wbg_bitgopsbt_free: (a: number, b: number) => void;
|
|
156
182
|
export const __wbg_fixedscriptwalletnamespace_free: (a: number, b: number) => void;
|
|
183
|
+
export const __wbg_inscriptionsnamespace_free: (a: number, b: number) => void;
|
|
157
184
|
export const __wbg_wasmbip32_free: (a: number, b: number) => void;
|
|
158
|
-
export const __wbg_wasmecpair_free: (a: number, b: number) => void;
|
|
159
|
-
export const __wbg_wasmrootwalletkeys_free: (a: number, b: number) => void;
|
|
160
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;
|
|
161
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;
|
|
162
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;
|
|
@@ -253,6 +278,8 @@ export const fixedscriptwalletnamespace_output_script_with_network_str: (a: numb
|
|
|
253
278
|
export const fixedscriptwalletnamespace_p2sh_p2pk_output_script: (a: number, b: number, c: number) => void;
|
|
254
279
|
export const fixedscriptwalletnamespace_supports_script_type: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
255
280
|
export const fixedscriptwalletnamespace_to_wallet_keys: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
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;
|
|
256
283
|
export const wasmbip32_chain_code: (a: number) => number;
|
|
257
284
|
export const wasmbip32_depth: (a: number) => number;
|
|
258
285
|
export const wasmbip32_derive: (a: number, b: number, c: number) => void;
|
|
@@ -275,53 +302,32 @@ export const wasmbip32_private_key: (a: number) => number;
|
|
|
275
302
|
export const wasmbip32_public_key: (a: number) => number;
|
|
276
303
|
export const wasmbip32_to_base58: (a: number, b: number) => void;
|
|
277
304
|
export const wasmbip32_to_wif: (a: number, b: number) => void;
|
|
278
|
-
export const wasmecpair_from_private_key: (a: number, b: number, c: number) => void;
|
|
279
|
-
export const wasmecpair_from_public_key: (a: number, b: number, c: number) => void;
|
|
280
|
-
export const wasmecpair_from_wif: (a: number, b: number, c: number) => void;
|
|
281
|
-
export const wasmecpair_from_wif_mainnet: (a: number, b: number, c: number) => void;
|
|
282
|
-
export const wasmecpair_from_wif_testnet: (a: number, b: number, c: number) => void;
|
|
283
|
-
export const wasmecpair_private_key: (a: number) => number;
|
|
284
|
-
export const wasmecpair_public_key: (a: number) => number;
|
|
285
|
-
export const wasmecpair_to_wif: (a: number, b: number) => void;
|
|
286
|
-
export const wasmecpair_to_wif_mainnet: (a: number, b: number) => void;
|
|
287
|
-
export const wasmecpair_to_wif_testnet: (a: number, b: number) => void;
|
|
288
|
-
export const wasmrootwalletkeys_backup_key: (a: number) => number;
|
|
289
|
-
export const wasmrootwalletkeys_bitgo_key: (a: number) => number;
|
|
290
|
-
export const wasmrootwalletkeys_new: (a: number, b: number, c: number, d: number) => void;
|
|
291
|
-
export const wasmrootwalletkeys_user_key: (a: number) => number;
|
|
292
|
-
export const wasmrootwalletkeys_with_derivation_prefixes: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
|
|
293
305
|
export const wasmbip32_from_bip32_properties: (a: number, b: number) => void;
|
|
306
|
+
export const bitgopsbt_sign_replay_protection_inputs: (a: number, b: number, c: number) => void;
|
|
294
307
|
export const bitgopsbt_sign_wallet_input: (a: number, b: number, c: number, d: number) => void;
|
|
295
308
|
export const bitgopsbt_sign_all_with_xpriv: (a: number, b: number, c: number) => void;
|
|
296
|
-
export const
|
|
297
|
-
export const
|
|
298
|
-
export const
|
|
299
|
-
export const
|
|
300
|
-
export const
|
|
301
|
-
export const
|
|
302
|
-
export const
|
|
303
|
-
export const
|
|
304
|
-
export const
|
|
305
|
-
export const
|
|
306
|
-
export const
|
|
307
|
-
export const
|
|
308
|
-
export const
|
|
309
|
-
export const
|
|
310
|
-
export const
|
|
311
|
-
export const
|
|
312
|
-
export const
|
|
313
|
-
export const
|
|
314
|
-
export const
|
|
315
|
-
export const
|
|
316
|
-
export const
|
|
317
|
-
export const
|
|
318
|
-
export const wasmdimensions_get_weight: (a: number, b: number, c: number) => number;
|
|
319
|
-
export const wasmdimensions_has_segwit: (a: number) => number;
|
|
320
|
-
export const wasmdimensions_plus: (a: number, b: number) => number;
|
|
321
|
-
export const wasmdimensions_times: (a: number, b: number) => number;
|
|
322
|
-
export const wasmutxonamespace_get_wasm_utxo_version: (a: number) => void;
|
|
323
|
-
export const parsePsbtToJson: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
324
|
-
export const parseTxToJson: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
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;
|
|
325
331
|
export const rustsecp256k1_v0_10_0_context_create: (a: number) => number;
|
|
326
332
|
export const rustsecp256k1_v0_10_0_context_destroy: (a: number) => void;
|
|
327
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);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { WasmDimensions } from "../wasm/wasm_utxo.js";
|
|
1
2
|
import type { BitGoPsbt, InputScriptType, SignPath } from "./BitGoPsbt.js";
|
|
2
3
|
import type { CoinName } from "../coinName.js";
|
|
3
4
|
import type { OutputScriptType } from "./scriptType.js";
|
|
@@ -17,16 +18,6 @@ export type FromInputOptions = {
|
|
|
17
18
|
*/
|
|
18
19
|
utxolibCompat?: boolean;
|
|
19
20
|
};
|
|
20
|
-
/**
|
|
21
|
-
* Options for output dimension calculation
|
|
22
|
-
*/
|
|
23
|
-
export type FromOutputOptions = {
|
|
24
|
-
/**
|
|
25
|
-
* Set when `address` may be a ZIP-316 Unified Address whose Orchard receiver should be sized
|
|
26
|
-
* as a shielded output. Forwarded to `toOutputScriptWithCoin`'s `canBeShieldedOutput`.
|
|
27
|
-
*/
|
|
28
|
-
isShielded?: boolean;
|
|
29
|
-
};
|
|
30
21
|
/**
|
|
31
22
|
* Dimensions class for estimating transaction virtual size.
|
|
32
23
|
*
|
|
@@ -37,7 +28,7 @@ export type FromOutputOptions = {
|
|
|
37
28
|
*/
|
|
38
29
|
export declare class Dimensions {
|
|
39
30
|
private _wasm;
|
|
40
|
-
|
|
31
|
+
protected constructor(_wasm: WasmDimensions);
|
|
41
32
|
/**
|
|
42
33
|
* Create empty dimensions (zero weight)
|
|
43
34
|
*/
|
|
@@ -62,12 +53,10 @@ export declare class Dimensions {
|
|
|
62
53
|
*/
|
|
63
54
|
static fromOutput(script: Uint8Array): Dimensions;
|
|
64
55
|
/**
|
|
65
|
-
* Create dimensions for a single output from an address
|
|
66
|
-
*
|
|
67
|
-
* Pass `{ isShielded: true }` when `address` may be a ZIP-316 Unified Address whose Orchard
|
|
68
|
-
* receiver should be sized as a shielded output
|
|
56
|
+
* Create dimensions for a single output from an address, decoded as an ordinary transparent
|
|
57
|
+
* address for `network`.
|
|
69
58
|
*/
|
|
70
|
-
static fromOutput(address: string, network: CoinName
|
|
59
|
+
static fromOutput(address: string, network: CoinName): Dimensions;
|
|
71
60
|
/**
|
|
72
61
|
* Create dimensions for a single output from script length only
|
|
73
62
|
*/
|
|
@@ -42,12 +42,12 @@ export class Dimensions {
|
|
|
42
42
|
}
|
|
43
43
|
return new Dimensions(WasmDimensions.from_input(params.chain, params.signPath?.signer, params.signPath?.cosigner, compat));
|
|
44
44
|
}
|
|
45
|
-
static fromOutput(params, network
|
|
45
|
+
static fromOutput(params, network) {
|
|
46
46
|
if (typeof params === "string") {
|
|
47
47
|
if (network === undefined) {
|
|
48
48
|
throw new Error("network is required when passing an address string");
|
|
49
49
|
}
|
|
50
|
-
const script = toOutputScriptWithCoin(params, network
|
|
50
|
+
const script = toOutputScriptWithCoin(params, network);
|
|
51
51
|
return new Dimensions(WasmDimensions.from_output_script_length(script.length));
|
|
52
52
|
}
|
|
53
53
|
if (typeof params === "object" && "scriptType" in params) {
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { CoinName } from "../coinName.js";
|
|
2
|
+
import type { OutputScriptType } from "./scriptType.js";
|
|
3
|
+
import { Dimensions } from "./Dimensions.js";
|
|
4
|
+
/**
|
|
5
|
+
* Options for {@link ZcashDimensions.fromOutput}.
|
|
6
|
+
*/
|
|
7
|
+
export type ZcashFromOutputOptions = {
|
|
8
|
+
/**
|
|
9
|
+
* Set when `address` may be a ZIP-316 Unified Address whose Orchard receiver should be sized
|
|
10
|
+
* as a shielded output. Forwarded to `zcashAddress.toShieldedReceiverWithCoin`; when unset,
|
|
11
|
+
* `zcashAddress.toTransparentReceiverWithCoin` is used instead.
|
|
12
|
+
*/
|
|
13
|
+
isShielded?: boolean;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Zcash-specific dimensions: resolves ZIP-316 Unified Addresses (transparent or Orchard/Ironwood
|
|
17
|
+
* shielded receiver) instead of the plain transparent-only decoding {@link Dimensions.fromOutput}
|
|
18
|
+
* does for every other coin.
|
|
19
|
+
*/
|
|
20
|
+
export declare class ZcashDimensions extends Dimensions {
|
|
21
|
+
/**
|
|
22
|
+
* Create dimensions for a single output from script bytes
|
|
23
|
+
*/
|
|
24
|
+
static fromOutput(script: Uint8Array): Dimensions;
|
|
25
|
+
/**
|
|
26
|
+
* Create dimensions for a single output from a Zcash address for `network`.
|
|
27
|
+
*
|
|
28
|
+
* Pass `{ isShielded: true }` when `address` may be a ZIP-316 Unified Address whose Orchard
|
|
29
|
+
* receiver should be sized as a shielded output; otherwise its transparent receiver is
|
|
30
|
+
* resolved (a UA with no transparent receiver throws rather than falling back to Orchard).
|
|
31
|
+
*/
|
|
32
|
+
static fromOutput(address: string, network: CoinName, options?: ZcashFromOutputOptions): Dimensions;
|
|
33
|
+
/**
|
|
34
|
+
* Create dimensions for a single output from script length only
|
|
35
|
+
*/
|
|
36
|
+
static fromOutput(params: {
|
|
37
|
+
length: number;
|
|
38
|
+
}): Dimensions;
|
|
39
|
+
/**
|
|
40
|
+
* Create dimensions for a single output from script type
|
|
41
|
+
*/
|
|
42
|
+
static fromOutput(params: {
|
|
43
|
+
scriptType: OutputScriptType;
|
|
44
|
+
}): Dimensions;
|
|
45
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { WasmDimensions } from "../wasm/wasm_utxo.js";
|
|
2
|
+
import { toShieldedReceiverWithCoin, toTransparentReceiverWithCoin } from "../zcashAddress.js";
|
|
3
|
+
import { Dimensions } from "./Dimensions.js";
|
|
4
|
+
/**
|
|
5
|
+
* Zcash-specific dimensions: resolves ZIP-316 Unified Addresses (transparent or Orchard/Ironwood
|
|
6
|
+
* shielded receiver) instead of the plain transparent-only decoding {@link Dimensions.fromOutput}
|
|
7
|
+
* does for every other coin.
|
|
8
|
+
*/
|
|
9
|
+
export class ZcashDimensions extends Dimensions {
|
|
10
|
+
static fromOutput(params, network, options) {
|
|
11
|
+
if (typeof params === "string") {
|
|
12
|
+
if (network === undefined) {
|
|
13
|
+
throw new Error("network is required when passing an address string");
|
|
14
|
+
}
|
|
15
|
+
const receiver = options?.isShielded
|
|
16
|
+
? toShieldedReceiverWithCoin(params, network)
|
|
17
|
+
: toTransparentReceiverWithCoin(params, network);
|
|
18
|
+
return new ZcashDimensions(WasmDimensions.from_output_script_length(receiver.length));
|
|
19
|
+
}
|
|
20
|
+
if (typeof params === "object" && "scriptType" in params) {
|
|
21
|
+
return Dimensions.fromOutput(params);
|
|
22
|
+
}
|
|
23
|
+
// Both Uint8Array and { length: number } have .length
|
|
24
|
+
return Dimensions.fromOutput(params);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -15,6 +15,8 @@ import type { ZcashNetworkName } from "./ZcashBitGoPsbt.js";
|
|
|
15
15
|
* const ua = ZcashUnifiedAddress.parse(uaString, "zec");
|
|
16
16
|
* const ironwood = ua.orchardReceiver; // 43 bytes, or undefined
|
|
17
17
|
* const script = ua.transparentScript; // scriptPubKey bytes, or undefined
|
|
18
|
+
* ua.hasOrchardReceiver; // true iff orchardReceiver is present
|
|
19
|
+
* ua.hasTransparentReceiver; // true iff transparentScript is present
|
|
18
20
|
* ua.contains(transparentAddress); // is it one of this UA's receivers?
|
|
19
21
|
* ```
|
|
20
22
|
*/
|
|
@@ -43,6 +45,20 @@ export declare class ZcashUnifiedAddress {
|
|
|
43
45
|
* a `TxOut.scriptPubKey`, or `undefined` if the UA has no transparent receiver.
|
|
44
46
|
*/
|
|
45
47
|
get transparentScript(): Uint8Array | undefined;
|
|
48
|
+
/**
|
|
49
|
+
* Whether this Unified Address carries an Orchard/Ironwood receiver.
|
|
50
|
+
*
|
|
51
|
+
* Equivalent to `orchardReceiver !== undefined`; prefer this when only presence
|
|
52
|
+
* matters, since it avoids copying the receiver bytes.
|
|
53
|
+
*/
|
|
54
|
+
get hasOrchardReceiver(): boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Whether this Unified Address carries a transparent (P2PKH/P2SH) receiver.
|
|
57
|
+
*
|
|
58
|
+
* Equivalent to `transparentScript !== undefined`; prefer this when only presence
|
|
59
|
+
* matters, since it avoids copying the script bytes.
|
|
60
|
+
*/
|
|
61
|
+
get hasTransparentReceiver(): boolean;
|
|
46
62
|
/**
|
|
47
63
|
* Whether `candidate` is a receiver of this unified address.
|
|
48
64
|
*
|
|
@@ -14,6 +14,8 @@ import { ZcashUnifiedAddress as WasmZcashUnifiedAddress } from "../wasm/wasm_utx
|
|
|
14
14
|
* const ua = ZcashUnifiedAddress.parse(uaString, "zec");
|
|
15
15
|
* const ironwood = ua.orchardReceiver; // 43 bytes, or undefined
|
|
16
16
|
* const script = ua.transparentScript; // scriptPubKey bytes, or undefined
|
|
17
|
+
* ua.hasOrchardReceiver; // true iff orchardReceiver is present
|
|
18
|
+
* ua.hasTransparentReceiver; // true iff transparentScript is present
|
|
17
19
|
* ua.contains(transparentAddress); // is it one of this UA's receivers?
|
|
18
20
|
* ```
|
|
19
21
|
*/
|
|
@@ -52,6 +54,24 @@ export class ZcashUnifiedAddress {
|
|
|
52
54
|
get transparentScript() {
|
|
53
55
|
return this._wasm.transparentScript;
|
|
54
56
|
}
|
|
57
|
+
/**
|
|
58
|
+
* Whether this Unified Address carries an Orchard/Ironwood receiver.
|
|
59
|
+
*
|
|
60
|
+
* Equivalent to `orchardReceiver !== undefined`; prefer this when only presence
|
|
61
|
+
* matters, since it avoids copying the receiver bytes.
|
|
62
|
+
*/
|
|
63
|
+
get hasOrchardReceiver() {
|
|
64
|
+
return this._wasm.hasOrchardReceiver;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Whether this Unified Address carries a transparent (P2PKH/P2SH) receiver.
|
|
68
|
+
*
|
|
69
|
+
* Equivalent to `transparentScript !== undefined`; prefer this when only presence
|
|
70
|
+
* matters, since it avoids copying the script bytes.
|
|
71
|
+
*/
|
|
72
|
+
get hasTransparentReceiver() {
|
|
73
|
+
return this._wasm.hasTransparentReceiver;
|
|
74
|
+
}
|
|
55
75
|
/**
|
|
56
76
|
* Whether `candidate` is a receiver of this unified address.
|
|
57
77
|
*
|
package/dist/esm/js/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export * as address from "./address.js";
|
|
2
|
+
export * as zcashAddress from "./zcashAddress.js";
|
|
2
3
|
export * as ast from "./ast/index.js";
|
|
3
4
|
export * as bip322 from "./bip322/index.js";
|
|
4
5
|
export * as inscriptions from "./inscriptions.js";
|
|
@@ -11,6 +12,7 @@ export * as ecpair from "./ecpair.js";
|
|
|
11
12
|
export { ECPair } from "./ecpair.js";
|
|
12
13
|
export { BIP32 } from "./bip32.js";
|
|
13
14
|
export { Dimensions } from "./fixedScriptWallet/Dimensions.js";
|
|
15
|
+
export { ZcashDimensions } from "./fixedScriptWallet/ZcashDimensions.js";
|
|
14
16
|
export type WasmUtxoVersionInfo = {
|
|
15
17
|
version: string;
|
|
16
18
|
gitHash: string;
|
package/dist/esm/js/index.js
CHANGED
|
@@ -6,6 +6,7 @@ void wasm;
|
|
|
6
6
|
// Most exports are namespaced to avoid polluting the top-level namespace
|
|
7
7
|
// and to make imports more explicit (e.g., `import { address } from '@bitgo/wasm-utxo'`)
|
|
8
8
|
export * as address from "./address.js";
|
|
9
|
+
export * as zcashAddress from "./zcashAddress.js";
|
|
9
10
|
export * as ast from "./ast/index.js";
|
|
10
11
|
export * as bip322 from "./bip322/index.js";
|
|
11
12
|
export * as inscriptions from "./inscriptions.js";
|
|
@@ -19,6 +20,7 @@ export * as ecpair from "./ecpair.js";
|
|
|
19
20
|
export { ECPair } from "./ecpair.js";
|
|
20
21
|
export { BIP32 } from "./bip32.js";
|
|
21
22
|
export { Dimensions } from "./fixedScriptWallet/Dimensions.js";
|
|
23
|
+
export { ZcashDimensions } from "./fixedScriptWallet/ZcashDimensions.js";
|
|
22
24
|
export function getWasmUtxoVersion() {
|
|
23
25
|
return WasmUtxoNamespace.get_wasm_utxo_version();
|
|
24
26
|
}
|