@argonprotocol/bitcoin 1.3.26 → 1.3.27-dev.8f6b267e
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/browser/index.d.ts +20 -16
- package/browser/index.js +172 -174
- package/browser/index.js.map +1 -1
- package/lib/{bitcoin_bindings_bg-JD75G3Y4.wasm → bitcoin_bindings_bg-FPZNZLSB.wasm} +0 -0
- package/lib/index.d.ts +20 -16
- package/lib/index.js +174 -177
- package/package.json +3 -3
package/lib/index.js
CHANGED
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
var bitcoin_bindings_bg_exports = {};
|
|
20
20
|
__export(bitcoin_bindings_bg_exports, {
|
|
21
21
|
__externref_table_dealloc: () => __externref_table_dealloc,
|
|
22
|
-
|
|
22
|
+
__wbindgen_externrefs: () => __wbindgen_externrefs,
|
|
23
23
|
__wbindgen_free: () => __wbindgen_free,
|
|
24
24
|
__wbindgen_malloc: () => __wbindgen_malloc,
|
|
25
25
|
__wbindgen_realloc: () => __wbindgen_realloc,
|
|
@@ -29,7 +29,7 @@ __export(bitcoin_bindings_bg_exports, {
|
|
|
29
29
|
getCosignPsbt: () => getCosignPsbt2,
|
|
30
30
|
instance: () => instance,
|
|
31
31
|
memory: () => memory,
|
|
32
|
-
module: () =>
|
|
32
|
+
module: () => module,
|
|
33
33
|
rustsecp256k1_v0_10_0_context_create: () => rustsecp256k1_v0_10_0_context_create,
|
|
34
34
|
rustsecp256k1_v0_10_0_context_destroy: () => rustsecp256k1_v0_10_0_context_destroy,
|
|
35
35
|
rustsecp256k1_v0_10_0_default_error_callback_fn: () => rustsecp256k1_v0_10_0_default_error_callback_fn,
|
|
@@ -39,92 +39,45 @@ __export(bitcoin_bindings_bg_exports, {
|
|
|
39
39
|
});
|
|
40
40
|
|
|
41
41
|
// wasm-deferred:/home/runner/work/mainchain/mainchain/bitcoin/nodejs/ts/wasm/bitcoin_bindings_bg.wasm
|
|
42
|
-
var bitcoin_bindings_bg_default = "./bitcoin_bindings_bg-
|
|
42
|
+
var bitcoin_bindings_bg_default = "./bitcoin_bindings_bg-FPZNZLSB.wasm";
|
|
43
43
|
|
|
44
44
|
// ts/wasm/bitcoin_bindings_bg.js
|
|
45
|
-
var
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
} : function(arg, view) {
|
|
80
|
-
const buf = cachedTextEncoder.encode(arg);
|
|
81
|
-
view.set(buf);
|
|
82
|
-
return {
|
|
83
|
-
read: arg.length,
|
|
84
|
-
written: buf.length
|
|
85
|
-
};
|
|
86
|
-
};
|
|
87
|
-
function passStringToWasm0(arg, malloc, realloc) {
|
|
88
|
-
if (realloc === void 0) {
|
|
89
|
-
const buf = cachedTextEncoder.encode(arg);
|
|
90
|
-
const ptr2 = malloc(buf.length, 1) >>> 0;
|
|
91
|
-
getUint8ArrayMemory0().subarray(ptr2, ptr2 + buf.length).set(buf);
|
|
92
|
-
WASM_VECTOR_LEN = buf.length;
|
|
93
|
-
return ptr2;
|
|
94
|
-
}
|
|
95
|
-
let len = arg.length;
|
|
96
|
-
let ptr = malloc(len, 1) >>> 0;
|
|
97
|
-
const mem = getUint8ArrayMemory0();
|
|
98
|
-
let offset = 0;
|
|
99
|
-
for (; offset < len; offset++) {
|
|
100
|
-
const code = arg.charCodeAt(offset);
|
|
101
|
-
if (code > 127) break;
|
|
102
|
-
mem[ptr + offset] = code;
|
|
103
|
-
}
|
|
104
|
-
if (offset !== len) {
|
|
105
|
-
if (offset !== 0) {
|
|
106
|
-
arg = arg.slice(offset);
|
|
107
|
-
}
|
|
108
|
-
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
109
|
-
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
110
|
-
const ret = encodeString(arg, view);
|
|
111
|
-
offset += ret.written;
|
|
112
|
-
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
113
|
-
}
|
|
114
|
-
WASM_VECTOR_LEN = offset;
|
|
115
|
-
return ptr;
|
|
116
|
-
}
|
|
117
|
-
var cachedDataViewMemory0 = null;
|
|
118
|
-
function getDataViewMemory0() {
|
|
119
|
-
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || cachedDataViewMemory0.buffer.detached === void 0 && cachedDataViewMemory0.buffer !== wasm.memory.buffer) {
|
|
120
|
-
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
45
|
+
var BitcoinNetwork = Object.freeze({
|
|
46
|
+
/**
|
|
47
|
+
* Mainnet Bitcoin.
|
|
48
|
+
*/
|
|
49
|
+
Bitcoin: 0,
|
|
50
|
+
"0": "Bitcoin",
|
|
51
|
+
/**
|
|
52
|
+
* Bitcoin's testnet network.
|
|
53
|
+
*/
|
|
54
|
+
Testnet: 1,
|
|
55
|
+
"1": "Testnet",
|
|
56
|
+
/**
|
|
57
|
+
* Bitcoin's signet network
|
|
58
|
+
*/
|
|
59
|
+
Signet: 2,
|
|
60
|
+
"2": "Signet",
|
|
61
|
+
/**
|
|
62
|
+
* Bitcoin's regtest network.
|
|
63
|
+
*/
|
|
64
|
+
Regtest: 3,
|
|
65
|
+
"3": "Regtest"
|
|
66
|
+
});
|
|
67
|
+
function calculateFee(vault_pubkey_hex, vault_claim_pubkey_hex, owner_pubkey_hex, vault_claim_height, open_claim_height, created_at_height, bitcoin_network, fee_rate_sats_per_vb, to_script_pubkey) {
|
|
68
|
+
const ptr0 = passStringToWasm0(vault_pubkey_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
69
|
+
const len0 = WASM_VECTOR_LEN;
|
|
70
|
+
const ptr1 = passStringToWasm0(vault_claim_pubkey_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
71
|
+
const len1 = WASM_VECTOR_LEN;
|
|
72
|
+
const ptr2 = passStringToWasm0(owner_pubkey_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
73
|
+
const len2 = WASM_VECTOR_LEN;
|
|
74
|
+
const ptr3 = passStringToWasm0(to_script_pubkey, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
75
|
+
const len3 = WASM_VECTOR_LEN;
|
|
76
|
+
const ret = wasm.calculateFee(ptr0, len0, ptr1, len1, ptr2, len2, vault_claim_height, open_claim_height, created_at_height, bitcoin_network, fee_rate_sats_per_vb, ptr3, len3);
|
|
77
|
+
if (ret[2]) {
|
|
78
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
121
79
|
}
|
|
122
|
-
return
|
|
123
|
-
}
|
|
124
|
-
function takeFromExternrefTable0(idx) {
|
|
125
|
-
const value = wasm.__wbindgen_export_3.get(idx);
|
|
126
|
-
wasm.__externref_table_dealloc(idx);
|
|
127
|
-
return value;
|
|
80
|
+
return BigInt.asUintN(64, ret[0]);
|
|
128
81
|
}
|
|
129
82
|
function createCosignPubkey(vault_pubkey_hex, vault_claim_pubkey_hex, owner_pubkey_hex, vault_claim_height, open_claim_height, created_at_height, bitcoin_network) {
|
|
130
83
|
let deferred5_0;
|
|
@@ -151,44 +104,33 @@ function createCosignPubkey(vault_pubkey_hex, vault_claim_pubkey_hex, owner_pubk
|
|
|
151
104
|
wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
|
|
152
105
|
}
|
|
153
106
|
}
|
|
154
|
-
function
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
const ptr1 = passStringToWasm0(vault_claim_pubkey_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
158
|
-
const len1 = WASM_VECTOR_LEN;
|
|
159
|
-
const ptr2 = passStringToWasm0(owner_pubkey_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
160
|
-
const len2 = WASM_VECTOR_LEN;
|
|
161
|
-
const ptr3 = passStringToWasm0(to_script_pubkey, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
162
|
-
const len3 = WASM_VECTOR_LEN;
|
|
163
|
-
const ret = wasm.calculateFee(ptr0, len0, ptr1, len1, ptr2, len2, vault_claim_height, open_claim_height, created_at_height, bitcoin_network, fee_rate_sats_per_vb, ptr3, len3);
|
|
164
|
-
if (ret[2]) {
|
|
165
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
166
|
-
}
|
|
167
|
-
return BigInt.asUintN(64, ret[0]);
|
|
168
|
-
}
|
|
169
|
-
function signPsbtDerived(psbt_hex, xpriv_b58, xpriv_hd_path, finalize) {
|
|
170
|
-
let deferred5_0;
|
|
171
|
-
let deferred5_1;
|
|
107
|
+
function getCosignPsbt(txid, vout, satoshis, vault_pubkey_hex, vault_claim_pubkey_hex, owner_pubkey_hex, vault_claim_height, open_claim_height, created_at_height, bitcoin_network, to_script_pubkey_hex, bitcoin_network_fee) {
|
|
108
|
+
let deferred7_0;
|
|
109
|
+
let deferred7_1;
|
|
172
110
|
try {
|
|
173
|
-
const ptr0 = passStringToWasm0(
|
|
111
|
+
const ptr0 = passStringToWasm0(txid, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
174
112
|
const len0 = WASM_VECTOR_LEN;
|
|
175
|
-
const ptr1 = passStringToWasm0(
|
|
113
|
+
const ptr1 = passStringToWasm0(vault_pubkey_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
176
114
|
const len1 = WASM_VECTOR_LEN;
|
|
177
|
-
const ptr2 = passStringToWasm0(
|
|
115
|
+
const ptr2 = passStringToWasm0(vault_claim_pubkey_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
178
116
|
const len2 = WASM_VECTOR_LEN;
|
|
179
|
-
const
|
|
180
|
-
|
|
181
|
-
|
|
117
|
+
const ptr3 = passStringToWasm0(owner_pubkey_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
118
|
+
const len3 = WASM_VECTOR_LEN;
|
|
119
|
+
const ptr4 = passStringToWasm0(to_script_pubkey_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
120
|
+
const len4 = WASM_VECTOR_LEN;
|
|
121
|
+
const ret = wasm.getCosignPsbt(ptr0, len0, vout, satoshis, ptr1, len1, ptr2, len2, ptr3, len3, vault_claim_height, open_claim_height, created_at_height, bitcoin_network, ptr4, len4, bitcoin_network_fee);
|
|
122
|
+
var ptr6 = ret[0];
|
|
123
|
+
var len6 = ret[1];
|
|
182
124
|
if (ret[3]) {
|
|
183
|
-
|
|
184
|
-
|
|
125
|
+
ptr6 = 0;
|
|
126
|
+
len6 = 0;
|
|
185
127
|
throw takeFromExternrefTable0(ret[2]);
|
|
186
128
|
}
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
return getStringFromWasm0(
|
|
129
|
+
deferred7_0 = ptr6;
|
|
130
|
+
deferred7_1 = len6;
|
|
131
|
+
return getStringFromWasm0(ptr6, len6);
|
|
190
132
|
} finally {
|
|
191
|
-
wasm.__wbindgen_free(
|
|
133
|
+
wasm.__wbindgen_free(deferred7_0, deferred7_1, 1);
|
|
192
134
|
}
|
|
193
135
|
}
|
|
194
136
|
function signPsbt(psbt_hex, bitcoin_network, private_key_hex, finalize) {
|
|
@@ -214,57 +156,34 @@ function signPsbt(psbt_hex, bitcoin_network, private_key_hex, finalize) {
|
|
|
214
156
|
wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
|
|
215
157
|
}
|
|
216
158
|
}
|
|
217
|
-
function
|
|
218
|
-
let
|
|
219
|
-
let
|
|
159
|
+
function signPsbtDerived(psbt_hex, xpriv_b58, xpriv_hd_path, finalize) {
|
|
160
|
+
let deferred5_0;
|
|
161
|
+
let deferred5_1;
|
|
220
162
|
try {
|
|
221
|
-
const ptr0 = passStringToWasm0(
|
|
163
|
+
const ptr0 = passStringToWasm0(psbt_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
222
164
|
const len0 = WASM_VECTOR_LEN;
|
|
223
|
-
const ptr1 = passStringToWasm0(
|
|
165
|
+
const ptr1 = passStringToWasm0(xpriv_b58, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
224
166
|
const len1 = WASM_VECTOR_LEN;
|
|
225
|
-
const ptr2 = passStringToWasm0(
|
|
167
|
+
const ptr2 = passStringToWasm0(xpriv_hd_path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
226
168
|
const len2 = WASM_VECTOR_LEN;
|
|
227
|
-
const
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
const len4 = WASM_VECTOR_LEN;
|
|
231
|
-
const ret = wasm.getCosignPsbt(ptr0, len0, vout, satoshis, ptr1, len1, ptr2, len2, ptr3, len3, vault_claim_height, open_claim_height, created_at_height, bitcoin_network, ptr4, len4, bitcoin_network_fee);
|
|
232
|
-
var ptr6 = ret[0];
|
|
233
|
-
var len6 = ret[1];
|
|
169
|
+
const ret = wasm.signPsbtDerived(ptr0, len0, ptr1, len1, ptr2, len2, finalize);
|
|
170
|
+
var ptr4 = ret[0];
|
|
171
|
+
var len4 = ret[1];
|
|
234
172
|
if (ret[3]) {
|
|
235
|
-
|
|
236
|
-
|
|
173
|
+
ptr4 = 0;
|
|
174
|
+
len4 = 0;
|
|
237
175
|
throw takeFromExternrefTable0(ret[2]);
|
|
238
176
|
}
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
return getStringFromWasm0(
|
|
177
|
+
deferred5_0 = ptr4;
|
|
178
|
+
deferred5_1 = len4;
|
|
179
|
+
return getStringFromWasm0(ptr4, len4);
|
|
242
180
|
} finally {
|
|
243
|
-
wasm.__wbindgen_free(
|
|
181
|
+
wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
|
|
244
182
|
}
|
|
245
183
|
}
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
*/
|
|
250
|
-
Bitcoin: 0,
|
|
251
|
-
"0": "Bitcoin",
|
|
252
|
-
/**
|
|
253
|
-
* Bitcoin's testnet network.
|
|
254
|
-
*/
|
|
255
|
-
Testnet: 1,
|
|
256
|
-
"1": "Testnet",
|
|
257
|
-
/**
|
|
258
|
-
* Bitcoin's signet network
|
|
259
|
-
*/
|
|
260
|
-
Signet: 2,
|
|
261
|
-
"2": "Signet",
|
|
262
|
-
/**
|
|
263
|
-
* Bitcoin's regtest network.
|
|
264
|
-
*/
|
|
265
|
-
Regtest: 3,
|
|
266
|
-
"3": "Regtest"
|
|
267
|
-
});
|
|
184
|
+
function __wbg___wbindgen_throw_be289d5034ed271b(arg0, arg1) {
|
|
185
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
186
|
+
}
|
|
268
187
|
function __wbg_error_7534b8e9a36f1ab4(arg0, arg1) {
|
|
269
188
|
let deferred0_0;
|
|
270
189
|
let deferred0_1;
|
|
@@ -287,22 +206,100 @@ function __wbg_stack_0ed75d68575b0f3c(arg0, arg1) {
|
|
|
287
206
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
288
207
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
289
208
|
}
|
|
290
|
-
function
|
|
291
|
-
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
292
|
-
}
|
|
293
|
-
function __wbindgen_cast_2241b6af4c4b2941(arg0, arg1) {
|
|
209
|
+
function __wbindgen_cast_0000000000000001(arg0, arg1) {
|
|
294
210
|
const ret = getStringFromWasm0(arg0, arg1);
|
|
295
211
|
return ret;
|
|
296
212
|
}
|
|
297
213
|
function __wbindgen_init_externref_table() {
|
|
298
|
-
const table = wasm.
|
|
214
|
+
const table = wasm.__wbindgen_externrefs;
|
|
299
215
|
const offset = table.grow(4);
|
|
300
216
|
table.set(0, void 0);
|
|
301
217
|
table.set(offset + 0, void 0);
|
|
302
218
|
table.set(offset + 1, null);
|
|
303
219
|
table.set(offset + 2, true);
|
|
304
220
|
table.set(offset + 3, false);
|
|
305
|
-
|
|
221
|
+
}
|
|
222
|
+
var cachedDataViewMemory0 = null;
|
|
223
|
+
function getDataViewMemory0() {
|
|
224
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || cachedDataViewMemory0.buffer.detached === void 0 && cachedDataViewMemory0.buffer !== wasm.memory.buffer) {
|
|
225
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
226
|
+
}
|
|
227
|
+
return cachedDataViewMemory0;
|
|
228
|
+
}
|
|
229
|
+
function getStringFromWasm0(ptr, len) {
|
|
230
|
+
ptr = ptr >>> 0;
|
|
231
|
+
return decodeText(ptr, len);
|
|
232
|
+
}
|
|
233
|
+
var cachedUint8ArrayMemory0 = null;
|
|
234
|
+
function getUint8ArrayMemory0() {
|
|
235
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
236
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
237
|
+
}
|
|
238
|
+
return cachedUint8ArrayMemory0;
|
|
239
|
+
}
|
|
240
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
241
|
+
if (realloc === void 0) {
|
|
242
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
243
|
+
const ptr2 = malloc(buf.length, 1) >>> 0;
|
|
244
|
+
getUint8ArrayMemory0().subarray(ptr2, ptr2 + buf.length).set(buf);
|
|
245
|
+
WASM_VECTOR_LEN = buf.length;
|
|
246
|
+
return ptr2;
|
|
247
|
+
}
|
|
248
|
+
let len = arg.length;
|
|
249
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
250
|
+
const mem = getUint8ArrayMemory0();
|
|
251
|
+
let offset = 0;
|
|
252
|
+
for (; offset < len; offset++) {
|
|
253
|
+
const code = arg.charCodeAt(offset);
|
|
254
|
+
if (code > 127) break;
|
|
255
|
+
mem[ptr + offset] = code;
|
|
256
|
+
}
|
|
257
|
+
if (offset !== len) {
|
|
258
|
+
if (offset !== 0) {
|
|
259
|
+
arg = arg.slice(offset);
|
|
260
|
+
}
|
|
261
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
262
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
263
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
264
|
+
offset += ret.written;
|
|
265
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
266
|
+
}
|
|
267
|
+
WASM_VECTOR_LEN = offset;
|
|
268
|
+
return ptr;
|
|
269
|
+
}
|
|
270
|
+
function takeFromExternrefTable0(idx) {
|
|
271
|
+
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
272
|
+
wasm.__externref_table_dealloc(idx);
|
|
273
|
+
return value;
|
|
274
|
+
}
|
|
275
|
+
var cachedTextDecoder = new TextDecoder("utf-8", { ignoreBOM: true, fatal: true });
|
|
276
|
+
cachedTextDecoder.decode();
|
|
277
|
+
var MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
278
|
+
var numBytesDecoded = 0;
|
|
279
|
+
function decodeText(ptr, len) {
|
|
280
|
+
numBytesDecoded += len;
|
|
281
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
282
|
+
cachedTextDecoder = new TextDecoder("utf-8", { ignoreBOM: true, fatal: true });
|
|
283
|
+
cachedTextDecoder.decode();
|
|
284
|
+
numBytesDecoded = len;
|
|
285
|
+
}
|
|
286
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
287
|
+
}
|
|
288
|
+
var cachedTextEncoder = new TextEncoder();
|
|
289
|
+
if (!("encodeInto" in cachedTextEncoder)) {
|
|
290
|
+
cachedTextEncoder.encodeInto = function(arg, view) {
|
|
291
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
292
|
+
view.set(buf);
|
|
293
|
+
return {
|
|
294
|
+
read: arg.length,
|
|
295
|
+
written: buf.length
|
|
296
|
+
};
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
var WASM_VECTOR_LEN = 0;
|
|
300
|
+
var wasm;
|
|
301
|
+
function __wbg_set_wasm(val) {
|
|
302
|
+
wasm = val;
|
|
306
303
|
}
|
|
307
304
|
|
|
308
305
|
// wasm-module:/home/runner/work/mainchain/mainchain/bitcoin/nodejs/ts/wasm/bitcoin_bindings_bg.wasm
|
|
@@ -311,21 +308,21 @@ var imports = {
|
|
|
311
308
|
__wbg_new_8a6f238a6ece86ea,
|
|
312
309
|
__wbg_stack_0ed75d68575b0f3c,
|
|
313
310
|
__wbg_error_7534b8e9a36f1ab4,
|
|
314
|
-
|
|
311
|
+
__wbg___wbindgen_throw_be289d5034ed271b,
|
|
315
312
|
__wbindgen_init_externref_table,
|
|
316
|
-
|
|
313
|
+
__wbindgen_cast_0000000000000001
|
|
317
314
|
}
|
|
318
315
|
};
|
|
319
|
-
async function loadWasm(
|
|
320
|
-
if (typeof
|
|
321
|
-
if (
|
|
322
|
-
|
|
316
|
+
async function loadWasm(module2, imports2) {
|
|
317
|
+
if (typeof module2 === "string") {
|
|
318
|
+
if (module2.startsWith("./")) {
|
|
319
|
+
module2 = new URL(module2, import.meta.url).href;
|
|
323
320
|
}
|
|
324
|
-
if (
|
|
321
|
+
if (module2.startsWith("file://")) {
|
|
325
322
|
const fs = await import("fs");
|
|
326
|
-
|
|
323
|
+
module2 = await fs.promises.readFile(new URL(module2));
|
|
327
324
|
} else {
|
|
328
|
-
const moduleRequest = await fetch(
|
|
325
|
+
const moduleRequest = await fetch(module2);
|
|
329
326
|
if (typeof WebAssembly.instantiateStreaming === "function") {
|
|
330
327
|
try {
|
|
331
328
|
return await WebAssembly.instantiateStreaming(moduleRequest, imports2);
|
|
@@ -337,12 +334,12 @@ async function loadWasm(module3, imports2) {
|
|
|
337
334
|
}
|
|
338
335
|
}
|
|
339
336
|
}
|
|
340
|
-
|
|
337
|
+
module2 = await moduleRequest.arrayBuffer();
|
|
341
338
|
}
|
|
342
339
|
}
|
|
343
|
-
return await WebAssembly.instantiate(
|
|
340
|
+
return await WebAssembly.instantiate(module2, imports2);
|
|
344
341
|
}
|
|
345
|
-
var { instance, module
|
|
342
|
+
var { instance, module } = await loadWasm(bitcoin_bindings_bg_default, imports);
|
|
346
343
|
var memory = instance.exports.memory;
|
|
347
344
|
var createCosignPubkey2 = instance.exports.createCosignPubkey;
|
|
348
345
|
var calculateFee2 = instance.exports.calculateFee;
|
|
@@ -356,7 +353,7 @@ var rustsecp256k1_v0_10_0_default_error_callback_fn = instance.exports.rustsecp2
|
|
|
356
353
|
var __wbindgen_free = instance.exports.__wbindgen_free;
|
|
357
354
|
var __wbindgen_malloc = instance.exports.__wbindgen_malloc;
|
|
358
355
|
var __wbindgen_realloc = instance.exports.__wbindgen_realloc;
|
|
359
|
-
var
|
|
356
|
+
var __wbindgen_externrefs = instance.exports.__wbindgen_externrefs;
|
|
360
357
|
var __externref_table_dealloc = instance.exports.__externref_table_dealloc;
|
|
361
358
|
var __wbindgen_start = instance.exports.__wbindgen_start;
|
|
362
359
|
|
|
@@ -495,12 +492,12 @@ var CosignScript = class {
|
|
|
495
492
|
}
|
|
496
493
|
getCosignPsbt(args) {
|
|
497
494
|
const { lock, network } = this;
|
|
498
|
-
const { releaseRequest, utxoRef } = args;
|
|
495
|
+
const { releaseRequest, utxoRef, utxoSatoshis } = args;
|
|
499
496
|
releaseRequest.toScriptPubkey = addressBytesHex(releaseRequest.toScriptPubkey, network);
|
|
500
497
|
const psbtStr = getCosignPsbt(
|
|
501
498
|
utxoRef.txid,
|
|
502
499
|
utxoRef.vout,
|
|
503
|
-
lock.utxoSatoshis ?? lock.satoshis,
|
|
500
|
+
utxoSatoshis ?? lock.utxoSatoshis ?? lock.satoshis,
|
|
504
501
|
lock.vaultPubkey,
|
|
505
502
|
lock.vaultClaimPubkey,
|
|
506
503
|
lock.ownerPubkey,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@argonprotocol/bitcoin",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.27-dev.8f6b267e",
|
|
4
4
|
"description": "A client for interop with bitcoin in nodejs.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"./browser/index.js"
|
|
52
52
|
],
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@argonprotocol/mainchain": "1.3.
|
|
54
|
+
"@argonprotocol/mainchain": "1.3.27-dev.8f6b267e",
|
|
55
55
|
"@noble/secp256k1": "^2.3.0",
|
|
56
56
|
"@scure/bip32": "^1.7.0",
|
|
57
57
|
"@scure/bip39": "^1.6.0",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"bignumber.js": "^9.3.1"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
|
-
"@argonprotocol/testing": "1.3.
|
|
62
|
+
"@argonprotocol/testing": "1.3.27-dev.8f6b267e",
|
|
63
63
|
"@types/node": "22.17.1",
|
|
64
64
|
"esbuild-plugin-wasm": "^1.1.0",
|
|
65
65
|
"tsup": "^8.5.0",
|