@bitgo/wasm-utxo 4.4.0 → 4.6.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/BitGoPsbt.d.ts +8 -3
- package/dist/cjs/js/fixedScriptWallet/BitGoPsbt.js +22 -3
- package/dist/cjs/js/fixedScriptWallet/ZcashBitGoPsbt.d.ts +47 -2
- package/dist/cjs/js/fixedScriptWallet/ZcashBitGoPsbt.js +54 -0
- package/dist/cjs/js/psbt.d.ts +3 -0
- package/dist/cjs/js/psbtBase.d.ts +6 -0
- package/dist/cjs/js/psbtBase.js +9 -0
- package/dist/cjs/js/transaction.d.ts +18 -0
- package/dist/cjs/js/transaction.js +28 -1
- package/dist/cjs/js/wasm/wasm_utxo.d.ts +41 -2
- package/dist/cjs/js/wasm/wasm_utxo.js +210 -7
- package/dist/cjs/js/wasm/wasm_utxo_bg.wasm +0 -0
- package/dist/cjs/js/wasm/wasm_utxo_bg.wasm.d.ts +166 -157
- package/dist/esm/js/fixedScriptWallet/BitGoPsbt.d.ts +8 -3
- package/dist/esm/js/fixedScriptWallet/BitGoPsbt.js +22 -3
- package/dist/esm/js/fixedScriptWallet/ZcashBitGoPsbt.d.ts +47 -2
- package/dist/esm/js/fixedScriptWallet/ZcashBitGoPsbt.js +54 -0
- package/dist/esm/js/psbt.d.ts +3 -0
- package/dist/esm/js/psbtBase.d.ts +6 -0
- package/dist/esm/js/psbtBase.js +9 -0
- package/dist/esm/js/transaction.d.ts +18 -0
- package/dist/esm/js/transaction.js +28 -1
- package/dist/esm/js/wasm/wasm_utxo.d.ts +41 -2
- package/dist/esm/js/wasm/wasm_utxo_bg.js +210 -7
- package/dist/esm/js/wasm/wasm_utxo_bg.wasm +0 -0
- package/dist/esm/js/wasm/wasm_utxo_bg.wasm.d.ts +166 -157
- package/package.json +1 -1
|
@@ -24,11 +24,19 @@ export interface ITransaction extends ITransactionCommon<TxInputData, TxOutputDa
|
|
|
24
24
|
*/
|
|
25
25
|
export declare class Transaction extends TransactionBase<WasmTransaction> {
|
|
26
26
|
private constructor();
|
|
27
|
+
/**
|
|
28
|
+
* Check if a coin is supported by this transaction class.
|
|
29
|
+
* Bitcoin-like transactions support all coins except Zcash and Dash.
|
|
30
|
+
*/
|
|
31
|
+
static supportsCoin(coin: CoinName): boolean;
|
|
27
32
|
/**
|
|
28
33
|
* Create an empty transaction (version 1, locktime 0)
|
|
29
34
|
*/
|
|
30
35
|
static create(): Transaction;
|
|
31
36
|
static fromBytes(bytes: Uint8Array): Transaction;
|
|
37
|
+
static fromBytes(bytes: Uint8Array, coin: "zec" | "tzec"): ZcashTransaction;
|
|
38
|
+
static fromBytes(bytes: Uint8Array, coin: "dash" | "tdash"): DashTransaction;
|
|
39
|
+
static fromBytes(bytes: Uint8Array, coin: CoinName): Transaction | ZcashTransaction | DashTransaction;
|
|
32
40
|
/** @internal Create from WASM instance directly (avoids re-parsing bytes) */
|
|
33
41
|
static fromWasm(wasm: WasmTransaction): Transaction;
|
|
34
42
|
/**
|
|
@@ -60,6 +68,11 @@ export declare class Transaction extends TransactionBase<WasmTransaction> {
|
|
|
60
68
|
*/
|
|
61
69
|
export declare class ZcashTransaction extends TransactionBase<WasmZcashTransaction> {
|
|
62
70
|
private constructor();
|
|
71
|
+
/**
|
|
72
|
+
* Check if a coin is supported by this transaction class.
|
|
73
|
+
* Zcash transactions support Zcash mainnet and testnet.
|
|
74
|
+
*/
|
|
75
|
+
static supportsCoin(coin: CoinName): boolean;
|
|
63
76
|
static fromBytes(bytes: Uint8Array): ZcashTransaction;
|
|
64
77
|
/** @internal Create from WASM instance directly (avoids re-parsing bytes) */
|
|
65
78
|
static fromWasm(wasm: WasmZcashTransaction): ZcashTransaction;
|
|
@@ -73,6 +86,11 @@ export declare class ZcashTransaction extends TransactionBase<WasmZcashTransacti
|
|
|
73
86
|
*/
|
|
74
87
|
export declare class DashTransaction extends TransactionBase<WasmDashTransaction> {
|
|
75
88
|
private constructor();
|
|
89
|
+
/**
|
|
90
|
+
* Check if a coin is supported by this transaction class.
|
|
91
|
+
* Dash transactions support Dash mainnet and testnet.
|
|
92
|
+
*/
|
|
93
|
+
static supportsCoin(coin: CoinName): boolean;
|
|
76
94
|
static fromBytes(bytes: Uint8Array): DashTransaction;
|
|
77
95
|
/** @internal Create from WASM instance directly (avoids re-parsing bytes) */
|
|
78
96
|
static fromWasm(wasm: WasmDashTransaction): DashTransaction;
|
|
@@ -9,13 +9,26 @@ export class Transaction extends TransactionBase {
|
|
|
9
9
|
constructor(wasm) {
|
|
10
10
|
super(wasm);
|
|
11
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* Check if a coin is supported by this transaction class.
|
|
14
|
+
* Bitcoin-like transactions support all coins except Zcash and Dash.
|
|
15
|
+
*/
|
|
16
|
+
static supportsCoin(coin) {
|
|
17
|
+
return !ZcashTransaction.supportsCoin(coin) && !DashTransaction.supportsCoin(coin);
|
|
18
|
+
}
|
|
12
19
|
/**
|
|
13
20
|
* Create an empty transaction (version 1, locktime 0)
|
|
14
21
|
*/
|
|
15
22
|
static create() {
|
|
16
23
|
return new Transaction(WasmTransaction.create());
|
|
17
24
|
}
|
|
18
|
-
static fromBytes(bytes) {
|
|
25
|
+
static fromBytes(bytes, coin) {
|
|
26
|
+
if (coin !== undefined) {
|
|
27
|
+
if (ZcashTransaction.supportsCoin(coin))
|
|
28
|
+
return ZcashTransaction.fromBytes(bytes);
|
|
29
|
+
if (DashTransaction.supportsCoin(coin))
|
|
30
|
+
return DashTransaction.fromBytes(bytes);
|
|
31
|
+
}
|
|
19
32
|
return new Transaction(WasmTransaction.from_bytes(bytes));
|
|
20
33
|
}
|
|
21
34
|
/** @internal Create from WASM instance directly (avoids re-parsing bytes) */
|
|
@@ -65,6 +78,13 @@ export class ZcashTransaction extends TransactionBase {
|
|
|
65
78
|
constructor(wasm) {
|
|
66
79
|
super(wasm);
|
|
67
80
|
}
|
|
81
|
+
/**
|
|
82
|
+
* Check if a coin is supported by this transaction class.
|
|
83
|
+
* Zcash transactions support Zcash mainnet and testnet.
|
|
84
|
+
*/
|
|
85
|
+
static supportsCoin(coin) {
|
|
86
|
+
return coin === "zec" || coin === "tzec";
|
|
87
|
+
}
|
|
68
88
|
static fromBytes(bytes) {
|
|
69
89
|
return new ZcashTransaction(WasmZcashTransaction.from_bytes(bytes));
|
|
70
90
|
}
|
|
@@ -86,6 +106,13 @@ export class DashTransaction extends TransactionBase {
|
|
|
86
106
|
constructor(wasm) {
|
|
87
107
|
super(wasm);
|
|
88
108
|
}
|
|
109
|
+
/**
|
|
110
|
+
* Check if a coin is supported by this transaction class.
|
|
111
|
+
* Dash transactions support Dash mainnet and testnet.
|
|
112
|
+
*/
|
|
113
|
+
static supportsCoin(coin) {
|
|
114
|
+
return coin === "dash" || coin === "tdash";
|
|
115
|
+
}
|
|
89
116
|
static fromBytes(bytes) {
|
|
90
117
|
return new DashTransaction(WasmDashTransaction.from_bytes(bytes));
|
|
91
118
|
}
|
|
@@ -221,6 +221,9 @@ export class BitGoPsbt {
|
|
|
221
221
|
* Returns error if block height is before Overwinter activation
|
|
222
222
|
*/
|
|
223
223
|
static create_empty_zcash_at_height(network: string, wallet_keys: WasmRootWalletKeys, block_height: number, version?: number | null, lock_time?: number | null, version_group_id?: number | null, expiry_height?: number | null): BitGoPsbt;
|
|
224
|
+
delete_input_kv(index: number, key: any): void;
|
|
225
|
+
delete_kv(key: any): void;
|
|
226
|
+
delete_output_kv(index: number, key: any): void;
|
|
224
227
|
/**
|
|
225
228
|
* Get the Zcash expiry height (returns None for non-Zcash PSBTs)
|
|
226
229
|
*/
|
|
@@ -298,12 +301,45 @@ export class BitGoPsbt {
|
|
|
298
301
|
* Convert a half-signed legacy transaction to a psbt-lite.
|
|
299
302
|
*
|
|
300
303
|
* # Arguments
|
|
301
|
-
* * `
|
|
304
|
+
* * `tx` - The decoded half-signed legacy transaction
|
|
302
305
|
* * `network` - Network name (utxolib or coin name)
|
|
303
306
|
* * `wallet_keys` - The wallet's root keys
|
|
304
307
|
* * `unspents` - Array of `{ chain: number, index: number, value: bigint }` for each input
|
|
305
308
|
*/
|
|
306
|
-
static from_half_signed_legacy_transaction(
|
|
309
|
+
static from_half_signed_legacy_transaction(tx: WasmTransaction, network: string, wallet_keys: WasmRootWalletKeys, unspents: any): BitGoPsbt;
|
|
310
|
+
/**
|
|
311
|
+
* Convert a half-signed legacy Dash transaction to a psbt-lite.
|
|
312
|
+
*
|
|
313
|
+
* # Arguments
|
|
314
|
+
* * `tx` - The decoded Dash transaction
|
|
315
|
+
* * `network` - Network name ("dash" or "tdash")
|
|
316
|
+
* * `wallet_keys` - The wallet's root keys
|
|
317
|
+
* * `unspents` - Array of `{ chain: number, index: number, value: bigint }` for each input
|
|
318
|
+
*/
|
|
319
|
+
static from_half_signed_legacy_transaction_dash(tx: WasmDashTransaction, network: string, wallet_keys: WasmRootWalletKeys, unspents: any): BitGoPsbt;
|
|
320
|
+
/**
|
|
321
|
+
* Convert a half-signed legacy Zcash transaction to a psbt-lite (with block height).
|
|
322
|
+
* Thin wrapper: resolves block_height → consensus_branch_id and delegates to the explicit variant.
|
|
323
|
+
*
|
|
324
|
+
* # Arguments
|
|
325
|
+
* * `tx` - The decoded Zcash transaction
|
|
326
|
+
* * `network` - Network name ("zec" or "tzec")
|
|
327
|
+
* * `wallet_keys` - The wallet's root keys
|
|
328
|
+
* * `unspents` - Array of `{ chain: number, index: number, value: bigint }` for each input
|
|
329
|
+
* * `block_height` - Block height to determine consensus branch ID
|
|
330
|
+
*/
|
|
331
|
+
static from_half_signed_legacy_transaction_zcash_with_block_height(tx: WasmZcashTransaction, network: string, wallet_keys: WasmRootWalletKeys, unspents: any, block_height: number): BitGoPsbt;
|
|
332
|
+
/**
|
|
333
|
+
* Convert a half-signed legacy Zcash transaction to a psbt-lite (with consensus branch ID).
|
|
334
|
+
*
|
|
335
|
+
* # Arguments
|
|
336
|
+
* * `tx` - The decoded Zcash transaction
|
|
337
|
+
* * `network` - Network name ("zec" or "tzec")
|
|
338
|
+
* * `wallet_keys` - The wallet's root keys
|
|
339
|
+
* * `unspents` - Array of `{ chain: number, index: number, value: bigint }` for each input
|
|
340
|
+
* * `consensus_branch_id` - Zcash consensus branch ID
|
|
341
|
+
*/
|
|
342
|
+
static from_half_signed_legacy_transaction_zcash_with_branch_id(tx: WasmZcashTransaction, network: string, wallet_keys: WasmRootWalletKeys, unspents: any, consensus_branch_id: number): BitGoPsbt;
|
|
307
343
|
/**
|
|
308
344
|
* Generate and store MuSig2 nonces for all MuSig2 inputs
|
|
309
345
|
*
|
|
@@ -1363,6 +1399,9 @@ export class WrapPsbt {
|
|
|
1363
1399
|
*/
|
|
1364
1400
|
add_output_at_index(index: number, script: Uint8Array, value: bigint): number;
|
|
1365
1401
|
clone(): WrapPsbt;
|
|
1402
|
+
delete_input_kv(index: number, key: any): void;
|
|
1403
|
+
delete_kv(key: any): void;
|
|
1404
|
+
delete_output_kv(index: number, key: any): void;
|
|
1366
1405
|
static deserialize(psbt: Uint8Array): WrapPsbt;
|
|
1367
1406
|
/**
|
|
1368
1407
|
* Extract the final transaction from a finalized PSBT
|
|
@@ -916,6 +916,56 @@ export class BitGoPsbt {
|
|
|
916
916
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
917
917
|
}
|
|
918
918
|
}
|
|
919
|
+
/**
|
|
920
|
+
* @param {number} index
|
|
921
|
+
* @param {any} key
|
|
922
|
+
*/
|
|
923
|
+
delete_input_kv(index, key) {
|
|
924
|
+
try {
|
|
925
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
926
|
+
wasm.bitgopsbt_delete_input_kv(retptr, this.__wbg_ptr, index, addHeapObject(key));
|
|
927
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
928
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
929
|
+
if (r1) {
|
|
930
|
+
throw takeObject(r0);
|
|
931
|
+
}
|
|
932
|
+
} finally {
|
|
933
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
934
|
+
}
|
|
935
|
+
}
|
|
936
|
+
/**
|
|
937
|
+
* @param {any} key
|
|
938
|
+
*/
|
|
939
|
+
delete_kv(key) {
|
|
940
|
+
try {
|
|
941
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
942
|
+
wasm.bitgopsbt_delete_kv(retptr, this.__wbg_ptr, addHeapObject(key));
|
|
943
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
944
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
945
|
+
if (r1) {
|
|
946
|
+
throw takeObject(r0);
|
|
947
|
+
}
|
|
948
|
+
} finally {
|
|
949
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
950
|
+
}
|
|
951
|
+
}
|
|
952
|
+
/**
|
|
953
|
+
* @param {number} index
|
|
954
|
+
* @param {any} key
|
|
955
|
+
*/
|
|
956
|
+
delete_output_kv(index, key) {
|
|
957
|
+
try {
|
|
958
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
959
|
+
wasm.bitgopsbt_delete_output_kv(retptr, this.__wbg_ptr, index, addHeapObject(key));
|
|
960
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
961
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
962
|
+
if (r1) {
|
|
963
|
+
throw takeObject(r0);
|
|
964
|
+
}
|
|
965
|
+
} finally {
|
|
966
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
967
|
+
}
|
|
968
|
+
}
|
|
919
969
|
/**
|
|
920
970
|
* Get the Zcash expiry height (returns None for non-Zcash PSBTs)
|
|
921
971
|
* @returns {number | undefined}
|
|
@@ -1108,25 +1158,128 @@ export class BitGoPsbt {
|
|
|
1108
1158
|
* Convert a half-signed legacy transaction to a psbt-lite.
|
|
1109
1159
|
*
|
|
1110
1160
|
* # Arguments
|
|
1111
|
-
* * `
|
|
1161
|
+
* * `tx` - The decoded half-signed legacy transaction
|
|
1112
1162
|
* * `network` - Network name (utxolib or coin name)
|
|
1113
1163
|
* * `wallet_keys` - The wallet's root keys
|
|
1114
1164
|
* * `unspents` - Array of `{ chain: number, index: number, value: bigint }` for each input
|
|
1115
|
-
* @param {
|
|
1165
|
+
* @param {WasmTransaction} tx
|
|
1116
1166
|
* @param {string} network
|
|
1117
1167
|
* @param {WasmRootWalletKeys} wallet_keys
|
|
1118
1168
|
* @param {any} unspents
|
|
1119
1169
|
* @returns {BitGoPsbt}
|
|
1120
1170
|
*/
|
|
1121
|
-
static from_half_signed_legacy_transaction(
|
|
1171
|
+
static from_half_signed_legacy_transaction(tx, network, wallet_keys, unspents) {
|
|
1122
1172
|
try {
|
|
1123
1173
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1124
|
-
|
|
1174
|
+
_assertClass(tx, WasmTransaction);
|
|
1175
|
+
const ptr0 = passStringToWasm0(network, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1125
1176
|
const len0 = WASM_VECTOR_LEN;
|
|
1126
|
-
const ptr1 = passStringToWasm0(network, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1127
|
-
const len1 = WASM_VECTOR_LEN;
|
|
1128
1177
|
_assertClass(wallet_keys, WasmRootWalletKeys);
|
|
1129
|
-
wasm.bitgopsbt_from_half_signed_legacy_transaction(retptr, ptr0, len0,
|
|
1178
|
+
wasm.bitgopsbt_from_half_signed_legacy_transaction(retptr, tx.__wbg_ptr, ptr0, len0, wallet_keys.__wbg_ptr, addHeapObject(unspents));
|
|
1179
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1180
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1181
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1182
|
+
if (r2) {
|
|
1183
|
+
throw takeObject(r1);
|
|
1184
|
+
}
|
|
1185
|
+
return BitGoPsbt.__wrap(r0);
|
|
1186
|
+
} finally {
|
|
1187
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1188
|
+
}
|
|
1189
|
+
}
|
|
1190
|
+
/**
|
|
1191
|
+
* Convert a half-signed legacy Dash transaction to a psbt-lite.
|
|
1192
|
+
*
|
|
1193
|
+
* # Arguments
|
|
1194
|
+
* * `tx` - The decoded Dash transaction
|
|
1195
|
+
* * `network` - Network name ("dash" or "tdash")
|
|
1196
|
+
* * `wallet_keys` - The wallet's root keys
|
|
1197
|
+
* * `unspents` - Array of `{ chain: number, index: number, value: bigint }` for each input
|
|
1198
|
+
* @param {WasmDashTransaction} tx
|
|
1199
|
+
* @param {string} network
|
|
1200
|
+
* @param {WasmRootWalletKeys} wallet_keys
|
|
1201
|
+
* @param {any} unspents
|
|
1202
|
+
* @returns {BitGoPsbt}
|
|
1203
|
+
*/
|
|
1204
|
+
static from_half_signed_legacy_transaction_dash(tx, network, wallet_keys, unspents) {
|
|
1205
|
+
try {
|
|
1206
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1207
|
+
_assertClass(tx, WasmDashTransaction);
|
|
1208
|
+
const ptr0 = passStringToWasm0(network, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1209
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1210
|
+
_assertClass(wallet_keys, WasmRootWalletKeys);
|
|
1211
|
+
wasm.bitgopsbt_from_half_signed_legacy_transaction_dash(retptr, tx.__wbg_ptr, ptr0, len0, wallet_keys.__wbg_ptr, addHeapObject(unspents));
|
|
1212
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1213
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1214
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1215
|
+
if (r2) {
|
|
1216
|
+
throw takeObject(r1);
|
|
1217
|
+
}
|
|
1218
|
+
return BitGoPsbt.__wrap(r0);
|
|
1219
|
+
} finally {
|
|
1220
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1221
|
+
}
|
|
1222
|
+
}
|
|
1223
|
+
/**
|
|
1224
|
+
* Convert a half-signed legacy Zcash transaction to a psbt-lite (with block height).
|
|
1225
|
+
* Thin wrapper: resolves block_height → consensus_branch_id and delegates to the explicit variant.
|
|
1226
|
+
*
|
|
1227
|
+
* # Arguments
|
|
1228
|
+
* * `tx` - The decoded Zcash transaction
|
|
1229
|
+
* * `network` - Network name ("zec" or "tzec")
|
|
1230
|
+
* * `wallet_keys` - The wallet's root keys
|
|
1231
|
+
* * `unspents` - Array of `{ chain: number, index: number, value: bigint }` for each input
|
|
1232
|
+
* * `block_height` - Block height to determine consensus branch ID
|
|
1233
|
+
* @param {WasmZcashTransaction} tx
|
|
1234
|
+
* @param {string} network
|
|
1235
|
+
* @param {WasmRootWalletKeys} wallet_keys
|
|
1236
|
+
* @param {any} unspents
|
|
1237
|
+
* @param {number} block_height
|
|
1238
|
+
* @returns {BitGoPsbt}
|
|
1239
|
+
*/
|
|
1240
|
+
static from_half_signed_legacy_transaction_zcash_with_block_height(tx, network, wallet_keys, unspents, block_height) {
|
|
1241
|
+
try {
|
|
1242
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1243
|
+
_assertClass(tx, WasmZcashTransaction);
|
|
1244
|
+
const ptr0 = passStringToWasm0(network, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1245
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1246
|
+
_assertClass(wallet_keys, WasmRootWalletKeys);
|
|
1247
|
+
wasm.bitgopsbt_from_half_signed_legacy_transaction_zcash_with_block_height(retptr, tx.__wbg_ptr, ptr0, len0, wallet_keys.__wbg_ptr, addHeapObject(unspents), block_height);
|
|
1248
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1249
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1250
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1251
|
+
if (r2) {
|
|
1252
|
+
throw takeObject(r1);
|
|
1253
|
+
}
|
|
1254
|
+
return BitGoPsbt.__wrap(r0);
|
|
1255
|
+
} finally {
|
|
1256
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1257
|
+
}
|
|
1258
|
+
}
|
|
1259
|
+
/**
|
|
1260
|
+
* Convert a half-signed legacy Zcash transaction to a psbt-lite (with consensus branch ID).
|
|
1261
|
+
*
|
|
1262
|
+
* # Arguments
|
|
1263
|
+
* * `tx` - The decoded Zcash transaction
|
|
1264
|
+
* * `network` - Network name ("zec" or "tzec")
|
|
1265
|
+
* * `wallet_keys` - The wallet's root keys
|
|
1266
|
+
* * `unspents` - Array of `{ chain: number, index: number, value: bigint }` for each input
|
|
1267
|
+
* * `consensus_branch_id` - Zcash consensus branch ID
|
|
1268
|
+
* @param {WasmZcashTransaction} tx
|
|
1269
|
+
* @param {string} network
|
|
1270
|
+
* @param {WasmRootWalletKeys} wallet_keys
|
|
1271
|
+
* @param {any} unspents
|
|
1272
|
+
* @param {number} consensus_branch_id
|
|
1273
|
+
* @returns {BitGoPsbt}
|
|
1274
|
+
*/
|
|
1275
|
+
static from_half_signed_legacy_transaction_zcash_with_branch_id(tx, network, wallet_keys, unspents, consensus_branch_id) {
|
|
1276
|
+
try {
|
|
1277
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1278
|
+
_assertClass(tx, WasmZcashTransaction);
|
|
1279
|
+
const ptr0 = passStringToWasm0(network, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1280
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1281
|
+
_assertClass(wallet_keys, WasmRootWalletKeys);
|
|
1282
|
+
wasm.bitgopsbt_from_half_signed_legacy_transaction_zcash_with_branch_id(retptr, tx.__wbg_ptr, ptr0, len0, wallet_keys.__wbg_ptr, addHeapObject(unspents), consensus_branch_id);
|
|
1130
1283
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1131
1284
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1132
1285
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -5029,6 +5182,56 @@ export class WrapPsbt {
|
|
|
5029
5182
|
const ret = wasm.wrappsbt_clone(this.__wbg_ptr);
|
|
5030
5183
|
return WrapPsbt.__wrap(ret);
|
|
5031
5184
|
}
|
|
5185
|
+
/**
|
|
5186
|
+
* @param {number} index
|
|
5187
|
+
* @param {any} key
|
|
5188
|
+
*/
|
|
5189
|
+
delete_input_kv(index, key) {
|
|
5190
|
+
try {
|
|
5191
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
5192
|
+
wasm.wrappsbt_delete_input_kv(retptr, this.__wbg_ptr, index, addHeapObject(key));
|
|
5193
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
5194
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
5195
|
+
if (r1) {
|
|
5196
|
+
throw takeObject(r0);
|
|
5197
|
+
}
|
|
5198
|
+
} finally {
|
|
5199
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
5200
|
+
}
|
|
5201
|
+
}
|
|
5202
|
+
/**
|
|
5203
|
+
* @param {any} key
|
|
5204
|
+
*/
|
|
5205
|
+
delete_kv(key) {
|
|
5206
|
+
try {
|
|
5207
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
5208
|
+
wasm.wrappsbt_delete_kv(retptr, this.__wbg_ptr, addHeapObject(key));
|
|
5209
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
5210
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
5211
|
+
if (r1) {
|
|
5212
|
+
throw takeObject(r0);
|
|
5213
|
+
}
|
|
5214
|
+
} finally {
|
|
5215
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
5216
|
+
}
|
|
5217
|
+
}
|
|
5218
|
+
/**
|
|
5219
|
+
* @param {number} index
|
|
5220
|
+
* @param {any} key
|
|
5221
|
+
*/
|
|
5222
|
+
delete_output_kv(index, key) {
|
|
5223
|
+
try {
|
|
5224
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
5225
|
+
wasm.wrappsbt_delete_output_kv(retptr, this.__wbg_ptr, index, addHeapObject(key));
|
|
5226
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
5227
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
5228
|
+
if (r1) {
|
|
5229
|
+
throw takeObject(r0);
|
|
5230
|
+
}
|
|
5231
|
+
} finally {
|
|
5232
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
5233
|
+
}
|
|
5234
|
+
}
|
|
5032
5235
|
/**
|
|
5033
5236
|
* @param {Uint8Array} psbt
|
|
5034
5237
|
* @returns {WrapPsbt}
|
|
Binary file
|