@buildonspark/spark-sdk 0.3.5 → 0.3.7
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/CHANGELOG.md +14 -0
- package/dist/bare/index.cjs +4079 -4662
- package/dist/bare/index.d.cts +689 -89
- package/dist/bare/index.d.ts +689 -89
- package/dist/bare/index.js +5565 -5972
- package/dist/{chunk-JE73HB26.js → chunk-KDEVNW7C.js} +12671 -13161
- package/dist/chunk-P4HYYSMU.js +7 -0
- package/dist/chunk-SRPKOCG4.js +139 -0
- package/dist/chunk-UYTT3C6H.js +605 -0
- package/dist/{client-DWml6sjL.d.cts → client-Bcb7TUIp.d.cts} +12 -10
- package/dist/{client-DBZ43pJT.d.ts → client-D9T58OY8.d.ts} +12 -10
- package/dist/debug.cjs +9248 -9782
- package/dist/debug.d.cts +8 -8
- package/dist/debug.d.ts +8 -8
- package/dist/debug.js +5 -3
- package/dist/graphql/objects/index.d.cts +3 -3
- package/dist/graphql/objects/index.d.ts +3 -3
- package/dist/index.cjs +695 -1286
- package/dist/index.d.cts +7 -18
- package/dist/index.d.ts +7 -18
- package/dist/index.js +5 -4
- package/dist/index.node.cjs +1365 -1496
- package/dist/index.node.d.cts +6 -7
- package/dist/index.node.d.ts +6 -7
- package/dist/index.node.js +7 -66
- package/dist/{logging-Dt2ooQiP.d.ts → logging-JIaZZIbR.d.ts} +3 -3
- package/dist/{logging-BUpzk4Z6.d.cts → logging-zkr4UlOi.d.cts} +3 -3
- package/dist/native/{chunk-D3SZRO65.js → chunk-X2QXUON7.js} +15 -0
- package/dist/native/{index.cjs → index.react-native.cjs} +875 -1274
- package/dist/native/{index.d.cts → index.react-native.d.cts} +1124 -520
- package/dist/native/{index.d.ts → index.react-native.d.ts} +1124 -520
- package/dist/native/{index.js → index.react-native.js} +870 -1100
- package/dist/native/{wasm-KT5NZXRN.js → wasm-GKEDPGTM.js} +1 -2
- package/dist/proto/spark.d.cts +1 -1
- package/dist/proto/spark.d.ts +1 -1
- package/dist/proto/spark_token.d.cts +1 -1
- package/dist/proto/spark_token.d.ts +1 -1
- package/dist/{spark-DasxuVfm.d.cts → spark-WA_4wcBr.d.cts} +1 -1
- package/dist/{spark-DasxuVfm.d.ts → spark-WA_4wcBr.d.ts} +1 -1
- package/dist/{spark-wallet-jlC0XN5f.d.ts → spark-wallet-BuFrUWeE.d.cts} +107 -75
- package/dist/{spark-wallet-BoMIOPWW.d.cts → spark-wallet-CE5PYiIb.d.ts} +107 -75
- package/dist/spark-wallet.browser-BwYkkOBU.d.ts +26 -0
- package/dist/spark-wallet.browser-DC3jdQPW.d.cts +26 -0
- package/dist/spark-wallet.node-C9d2W-Nb.d.ts +90 -0
- package/dist/spark-wallet.node-CR_zNxmy.d.cts +90 -0
- package/dist/tests/test-utils.cjs +17563 -7501
- package/dist/tests/test-utils.d.cts +8 -22
- package/dist/tests/test-utils.d.ts +8 -22
- package/dist/tests/test-utils.js +30 -4
- package/dist/{token-transactions-DscJaJOE.d.ts → token-transactions-BZoJuvuE.d.ts} +2 -2
- package/dist/{token-transactions-BDzCrQSk.d.cts → token-transactions-I_OFIoNH.d.cts} +2 -2
- package/dist/types/index.d.cts +2 -2
- package/dist/types/index.d.ts +2 -2
- package/package.json +20 -16
- package/src/bare/index.ts +1 -1
- package/src/debug.ts +1 -1
- package/src/graphql/client.ts +6 -9
- package/src/graphql/mutations/CompleteCoopExit.ts +1 -1
- package/src/graphql/mutations/RequestCoopExit.ts +3 -1
- package/src/graphql/mutations/RequestLightningSend.ts +3 -1
- package/src/graphql/objects/CompleteCoopExitInput.ts +22 -33
- package/src/graphql/objects/RequestCoopExitInput.ts +39 -45
- package/src/graphql/objects/RequestLightningSendInput.ts +31 -39
- package/src/index.node.ts +2 -1
- package/src/index.react-native.ts +21 -0
- package/src/index.ts +2 -1
- package/src/services/config.ts +2 -2
- package/src/services/connection/connection.browser.ts +130 -0
- package/src/services/connection/connection.node.ts +158 -0
- package/src/services/{connection.ts → connection/connection.ts} +58 -259
- package/src/services/coop-exit.ts +8 -4
- package/src/services/deposit.ts +1 -1
- package/src/services/index.ts +1 -1
- package/src/services/lightning.ts +1 -1
- package/src/services/token-transactions.ts +9 -9
- package/src/services/transfer.ts +1 -1
- package/src/spark-wallet/spark-wallet.bare.ts +12 -0
- package/src/spark-wallet/spark-wallet.browser.ts +9 -24
- package/src/spark-wallet/spark-wallet.node.ts +4 -24
- package/src/spark-wallet/spark-wallet.react-native.ts +17 -0
- package/src/spark-wallet/spark-wallet.ts +130 -82
- package/src/spark-wallet/types.ts +4 -2
- package/src/tests/integration/coop-exit.test.ts +5 -3
- package/src/tests/integration/lightning.test.ts +9 -5
- package/src/tests/integration/ssp/coop-exit-validation.test.ts +8 -11
- package/src/tests/integration/ssp/coop-exit.test.ts +3 -5
- package/src/tests/integration/ssp/lightning.test.ts +1 -1
- package/src/tests/integration/ssp/static-deposit-validation.test.ts +2 -2
- package/src/tests/integration/ssp/static_deposit.test.ts +94 -101
- package/src/tests/integration/ssp/swap.test.ts +4 -5
- package/src/tests/integration/ssp/transfers.test.ts +10 -11
- package/src/tests/integration/static_deposit.test.ts +4 -4
- package/src/tests/integration/token-output.test.ts +2 -2
- package/src/tests/integration/transfer.test.ts +30 -26
- package/src/tests/integration/watchtower.test.ts +3 -3
- package/src/tests/optimize.test.ts +45 -0
- package/src/tests/spark-wallet/queryNodes.test.ts +1 -2
- package/src/tests/test-utils.ts +3 -3
- package/src/tests/token-outputs.test.ts +61 -2
- package/src/tests/utils/spark-testing-wallet.ts +18 -58
- package/src/tests/utils/test-faucet.ts +12 -8
- package/src/tests/utils/utils.ts +63 -0
- package/src/tests/wrapWithOtelSpan.test.ts +7 -0
- package/src/utils/network.ts +11 -10
- package/src/utils/optimize.ts +226 -0
- package/dist/bare/xhr-transport-EEEC7FYA.js +0 -165
- package/dist/chunk-DIXXHATX.js +0 -70
- package/dist/native/chunk-C3WN3D4O.js +0 -19
- package/dist/native/xhr-transport-TNCG4HTW.js +0 -168
- package/dist/spark-wallet.node-07PksUHH.d.cts +0 -12
- package/dist/spark-wallet.node-CdWkKMSq.d.ts +0 -12
- package/dist/xhr-transport-IWJPYF7F.js +0 -167
- package/src/native/index.ts +0 -20
package/dist/index.cjs
CHANGED
|
@@ -235,14 +235,14 @@ function passArrayJsValueToWasm0(array, malloc) {
|
|
|
235
235
|
WASM_VECTOR_LEN = array.length;
|
|
236
236
|
return ptr;
|
|
237
237
|
}
|
|
238
|
-
var imports, wasm, TextEncoder2,
|
|
238
|
+
var imports, wasm, TextEncoder2, TextDecoder, WASM_VECTOR_LEN, cachedUint8ArrayMemory0, cachedTextEncoder, encodeString, cachedDataViewMemory0, cachedTextDecoder, frost_nonce, wasm_sign_frost, wasm_aggregate_frost, construct_node_tx, construct_refund_tx, construct_split_tx, construct_direct_refund_tx, create_dummy_tx, encrypt_ecies, decrypt_ecies, get_taproot_pubkey, DummyTxFinalization, DummyTxSrc, DummyTx, KeyPackageFinalization, KeyPackageSrc, KeyPackage, NonceResultFinalization, NonceResultSrc, NonceResult, SigningCommitmentFinalization, SigningCommitmentSrc, SigningCommitment2, SigningNonceFinalization, SigningNonceSrc, SigningNonce, TransactionResultFinalization, TransactionResultSrc, TransactionResult, __wbg_String_8f0eb39a4a4c2f66, __wbg_buffer_609cc3eee51ed158, __wbg_call_672a4d21634d4a24, __wbg_call_7cccdd69e0791ae2, __wbg_crypto_dd1b8f71596b161a, __wbg_done_769e5ede4b31c67b, __wbg_entries_3265d4158b33e5dc, __wbg_getRandomValues_760c8e927227643e, __wbg_get_67b2ba62fc30de12, __wbg_get_b9b93047fe3cf45b, __wbg_getwithrefkey_1dc361bd10053bfe, __wbg_instanceof_ArrayBuffer_e14585432e3737fc, __wbg_instanceof_Uint8Array_17156bcf118086a9, __wbg_isArray_a1eab7e0d067391b, __wbg_isSafeInteger_343e2beeeece1bb0, __wbg_iterator_9a24c88df860dc65, __wbg_length_a446193dc22c12f8, __wbg_length_e2d2a49132c1b256, __wbg_msCrypto_60a4979188f6b80b, __wbg_new_a12002a7f91c75be, __wbg_newnoargs_105ed471475aaf50, __wbg_newwithbyteoffsetandlength_d97e637ebe145a9a, __wbg_newwithlength_a381634e90c276d4, __wbg_next_25feadfc0913fea9, __wbg_next_6574e1a8a62d1055, __wbg_node_0deadde112ce24bb, __wbg_process_0caa4f154b97e834, __wbg_randomFillSync_82e8b56b81896e30, __wbg_require_1a22b236558b5786, __wbg_set_65595bdd868b3009, __wbg_static_accessor_GLOBAL_88a902d13a557d07, __wbg_static_accessor_GLOBAL_THIS_56578be7e9f832b0, __wbg_static_accessor_SELF_37c5d418e4bf5819, __wbg_static_accessor_WINDOW_5de37043a91a9c40, __wbg_subarray_aa9065fa9dc5df96, __wbg_value_cd1ffa7b1ab794f1, __wbg_versions_134d8f3c6de79566, __wbindgen_as_number, __wbindgen_boolean_get, __wbindgen_debug_string, __wbindgen_error_new, __wbindgen_in, __wbindgen_init_externref_table, __wbindgen_is_function, __wbindgen_is_object, __wbindgen_is_string, __wbindgen_is_undefined, __wbindgen_jsval_loose_eq, __wbindgen_memory, __wbindgen_number_get, __wbindgen_string_get, __wbindgen_string_new, __wbindgen_throw, __toBinary, bytes, wasmModule, wasmInstance, __wasm;
|
|
239
239
|
var init_spark_bindings = __esm({
|
|
240
240
|
"src/wasm/spark_bindings.js"() {
|
|
241
241
|
"use strict";
|
|
242
242
|
init_buffer();
|
|
243
243
|
imports = {};
|
|
244
244
|
imports["__wbindgen_placeholder__"] = imports;
|
|
245
|
-
({ TextEncoder: TextEncoder2, TextDecoder
|
|
245
|
+
({ TextEncoder: TextEncoder2, TextDecoder } = globalThis);
|
|
246
246
|
WASM_VECTOR_LEN = 0;
|
|
247
247
|
cachedUint8ArrayMemory0 = null;
|
|
248
248
|
cachedTextEncoder = new TextEncoder2("utf-8");
|
|
@@ -257,7 +257,7 @@ var init_spark_bindings = __esm({
|
|
|
257
257
|
};
|
|
258
258
|
};
|
|
259
259
|
cachedDataViewMemory0 = null;
|
|
260
|
-
cachedTextDecoder = new
|
|
260
|
+
cachedTextDecoder = new TextDecoder("utf-8", { ignoreBOM: true, fatal: true });
|
|
261
261
|
cachedTextDecoder.decode();
|
|
262
262
|
frost_nonce = imports.frost_nonce = function(key_package) {
|
|
263
263
|
_assertClass(key_package, KeyPackage);
|
|
@@ -308,10 +308,10 @@ var init_spark_bindings = __esm({
|
|
|
308
308
|
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
309
309
|
return v7;
|
|
310
310
|
};
|
|
311
|
-
construct_node_tx = imports.construct_node_tx = function(tx, vout,
|
|
311
|
+
construct_node_tx = imports.construct_node_tx = function(tx, vout, address, locktime) {
|
|
312
312
|
const ptr0 = passArray8ToWasm0(tx, wasm.__wbindgen_malloc);
|
|
313
313
|
const len0 = WASM_VECTOR_LEN;
|
|
314
|
-
const ptr1 = passStringToWasm0(
|
|
314
|
+
const ptr1 = passStringToWasm0(address, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
315
315
|
const len1 = WASM_VECTOR_LEN;
|
|
316
316
|
const ret = wasm.construct_node_tx(ptr0, len0, vout, ptr1, len1, locktime);
|
|
317
317
|
if (ret[2]) {
|
|
@@ -356,8 +356,8 @@ var init_spark_bindings = __esm({
|
|
|
356
356
|
}
|
|
357
357
|
return TransactionResult.__wrap(ret[0]);
|
|
358
358
|
};
|
|
359
|
-
create_dummy_tx = imports.create_dummy_tx = function(
|
|
360
|
-
const ptr0 = passStringToWasm0(
|
|
359
|
+
create_dummy_tx = imports.create_dummy_tx = function(address, amount_sats) {
|
|
360
|
+
const ptr0 = passStringToWasm0(address, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
361
361
|
const len0 = WASM_VECTOR_LEN;
|
|
362
362
|
const ret = wasm.create_dummy_tx(ptr0, len0, amount_sats);
|
|
363
363
|
if (ret[2]) {
|
|
@@ -1213,10 +1213,10 @@ function aggregateFrost({
|
|
|
1213
1213
|
return result;
|
|
1214
1214
|
}
|
|
1215
1215
|
function createDummyTx({
|
|
1216
|
-
address
|
|
1216
|
+
address,
|
|
1217
1217
|
amountSats
|
|
1218
1218
|
}) {
|
|
1219
|
-
return create_dummy_tx(
|
|
1219
|
+
return create_dummy_tx(address, amountSats);
|
|
1220
1220
|
}
|
|
1221
1221
|
function encryptEcies({
|
|
1222
1222
|
msg,
|
|
@@ -1241,185 +1241,12 @@ var init_wasm = __esm({
|
|
|
1241
1241
|
}
|
|
1242
1242
|
});
|
|
1243
1243
|
|
|
1244
|
-
// src/services/xhr-transport.ts
|
|
1245
|
-
var xhr_transport_exports = {};
|
|
1246
|
-
__export(xhr_transport_exports, {
|
|
1247
|
-
XHRTransport: () => XHRTransport
|
|
1248
|
-
});
|
|
1249
|
-
async function xhrPost(url, metadata, requestBody, config) {
|
|
1250
|
-
const callData = new GrpcCallData();
|
|
1251
|
-
return new Promise(function(resolve, reject) {
|
|
1252
|
-
const xhr = new XMLHttpRequest();
|
|
1253
|
-
xhr.open("POST", url, true);
|
|
1254
|
-
xhr.withCredentials = config?.credentials ?? true;
|
|
1255
|
-
xhr.responseType = "arraybuffer";
|
|
1256
|
-
for (const [key, values] of metadata) {
|
|
1257
|
-
for (const value of values) {
|
|
1258
|
-
xhr.setRequestHeader(
|
|
1259
|
-
key,
|
|
1260
|
-
typeof value === "string" ? value : import_js_base64.Base64.fromUint8Array(value)
|
|
1261
|
-
);
|
|
1262
|
-
}
|
|
1263
|
-
}
|
|
1264
|
-
xhr.onreadystatechange = function() {
|
|
1265
|
-
if (xhr.readyState === XMLHttpRequest.HEADERS_RECEIVED) {
|
|
1266
|
-
callData.responseHeaders = headersToMetadata(
|
|
1267
|
-
xhr.getAllResponseHeaders()
|
|
1268
|
-
);
|
|
1269
|
-
} else if (xhr.readyState === XMLHttpRequest.DONE) {
|
|
1270
|
-
resolve(callData);
|
|
1271
|
-
}
|
|
1272
|
-
};
|
|
1273
|
-
xhr.onerror = function() {
|
|
1274
|
-
callData.statusMessage = getErrorDetailsFromHttpResponse(
|
|
1275
|
-
xhr.status,
|
|
1276
|
-
xhr.statusText
|
|
1277
|
-
);
|
|
1278
|
-
};
|
|
1279
|
-
xhr.onloadend = function() {
|
|
1280
|
-
callData.responseChunks.push(new Uint8Array(xhr.response));
|
|
1281
|
-
callData.grpcStatus = getStatusFromHttpCode(xhr.status);
|
|
1282
|
-
};
|
|
1283
|
-
xhr.send(requestBody);
|
|
1284
|
-
});
|
|
1285
|
-
}
|
|
1286
|
-
function concatenateChunks(chunks) {
|
|
1287
|
-
let totalSize = 0;
|
|
1288
|
-
for (const chunk of chunks) {
|
|
1289
|
-
totalSize += chunk.length;
|
|
1290
|
-
}
|
|
1291
|
-
const newData = new Uint8Array(totalSize);
|
|
1292
|
-
let setIndex = 0;
|
|
1293
|
-
for (const chunk of chunks) {
|
|
1294
|
-
newData.set(chunk, setIndex);
|
|
1295
|
-
setIndex += chunk.length;
|
|
1296
|
-
}
|
|
1297
|
-
return newData;
|
|
1298
|
-
}
|
|
1299
|
-
function XHRTransport(config) {
|
|
1300
|
-
return async function* fetchTransport({
|
|
1301
|
-
url,
|
|
1302
|
-
body,
|
|
1303
|
-
metadata,
|
|
1304
|
-
signal,
|
|
1305
|
-
method
|
|
1306
|
-
}) {
|
|
1307
|
-
let requestBody;
|
|
1308
|
-
if (!method.requestStream) {
|
|
1309
|
-
let bodyBuffer;
|
|
1310
|
-
for await (const chunk of body) {
|
|
1311
|
-
bodyBuffer = chunk;
|
|
1312
|
-
break;
|
|
1313
|
-
}
|
|
1314
|
-
requestBody = bodyBuffer.slice();
|
|
1315
|
-
} else {
|
|
1316
|
-
let iterator;
|
|
1317
|
-
requestBody = new ReadableStream({
|
|
1318
|
-
// @ts-ignore
|
|
1319
|
-
type: "bytes",
|
|
1320
|
-
start() {
|
|
1321
|
-
iterator = body[Symbol.asyncIterator]();
|
|
1322
|
-
},
|
|
1323
|
-
async pull(controller) {
|
|
1324
|
-
const { done, value } = await iterator.next();
|
|
1325
|
-
if (done) {
|
|
1326
|
-
controller.close();
|
|
1327
|
-
} else {
|
|
1328
|
-
controller.enqueue(value.slice());
|
|
1329
|
-
}
|
|
1330
|
-
},
|
|
1331
|
-
async cancel() {
|
|
1332
|
-
await iterator.return?.();
|
|
1333
|
-
}
|
|
1334
|
-
});
|
|
1335
|
-
}
|
|
1336
|
-
const xhrData = await xhrPost(url, metadata, requestBody, config);
|
|
1337
|
-
yield {
|
|
1338
|
-
type: "header",
|
|
1339
|
-
header: xhrData.responseHeaders
|
|
1340
|
-
};
|
|
1341
|
-
if (xhrData.grpcStatus !== import_nice_grpc_common.Status.OK) {
|
|
1342
|
-
const decoder = new TextDecoder();
|
|
1343
|
-
const message = decoder.decode(concatenateChunks(xhrData.responseChunks));
|
|
1344
|
-
console.warn(message, xhrData.statusMessage);
|
|
1345
|
-
throw new import_nice_grpc_common.ClientError(
|
|
1346
|
-
method.path,
|
|
1347
|
-
xhrData.grpcStatus,
|
|
1348
|
-
`status=${xhrData.statusMessage}, message=${message}`
|
|
1349
|
-
);
|
|
1350
|
-
}
|
|
1351
|
-
(0, import_abort_controller_x.throwIfAborted)(signal);
|
|
1352
|
-
try {
|
|
1353
|
-
for (const xhrChunk of xhrData.responseChunks) {
|
|
1354
|
-
if (xhrChunk != null) {
|
|
1355
|
-
yield {
|
|
1356
|
-
type: "data",
|
|
1357
|
-
data: xhrChunk
|
|
1358
|
-
};
|
|
1359
|
-
}
|
|
1360
|
-
}
|
|
1361
|
-
} finally {
|
|
1362
|
-
(0, import_abort_controller_x.throwIfAborted)(signal);
|
|
1363
|
-
}
|
|
1364
|
-
};
|
|
1365
|
-
}
|
|
1366
|
-
function headersToMetadata(headers) {
|
|
1367
|
-
const metadata = new import_nice_grpc_common.Metadata();
|
|
1368
|
-
const arr = headers.trim().split(/[\r\n]+/);
|
|
1369
|
-
arr.forEach((line) => {
|
|
1370
|
-
const parts = line.split(": ");
|
|
1371
|
-
const header = parts.shift() ?? "";
|
|
1372
|
-
const value = parts.join(": ");
|
|
1373
|
-
metadata.set(header, value);
|
|
1374
|
-
});
|
|
1375
|
-
return metadata;
|
|
1376
|
-
}
|
|
1377
|
-
function getStatusFromHttpCode(statusCode) {
|
|
1378
|
-
switch (statusCode) {
|
|
1379
|
-
case 200:
|
|
1380
|
-
return import_nice_grpc_common.Status.OK;
|
|
1381
|
-
case 400:
|
|
1382
|
-
return import_nice_grpc_common.Status.INTERNAL;
|
|
1383
|
-
case 401:
|
|
1384
|
-
return import_nice_grpc_common.Status.UNAUTHENTICATED;
|
|
1385
|
-
case 403:
|
|
1386
|
-
return import_nice_grpc_common.Status.PERMISSION_DENIED;
|
|
1387
|
-
case 404:
|
|
1388
|
-
return import_nice_grpc_common.Status.UNIMPLEMENTED;
|
|
1389
|
-
case 429:
|
|
1390
|
-
case 502:
|
|
1391
|
-
case 503:
|
|
1392
|
-
case 504:
|
|
1393
|
-
return import_nice_grpc_common.Status.UNAVAILABLE;
|
|
1394
|
-
default:
|
|
1395
|
-
return import_nice_grpc_common.Status.UNKNOWN;
|
|
1396
|
-
}
|
|
1397
|
-
}
|
|
1398
|
-
function getErrorDetailsFromHttpResponse(statusCode, responseText) {
|
|
1399
|
-
return `Received HTTP ${statusCode} response: ` + (responseText.length > 1e3 ? responseText.slice(0, 1e3) + "... (truncated)" : responseText);
|
|
1400
|
-
}
|
|
1401
|
-
var import_abort_controller_x, import_js_base64, import_nice_grpc_common, GrpcCallData;
|
|
1402
|
-
var init_xhr_transport = __esm({
|
|
1403
|
-
"src/services/xhr-transport.ts"() {
|
|
1404
|
-
"use strict";
|
|
1405
|
-
init_buffer();
|
|
1406
|
-
import_abort_controller_x = require("abort-controller-x");
|
|
1407
|
-
import_js_base64 = require("js-base64");
|
|
1408
|
-
import_nice_grpc_common = require("nice-grpc-common");
|
|
1409
|
-
GrpcCallData = class {
|
|
1410
|
-
responseHeaders = new import_nice_grpc_common.Metadata();
|
|
1411
|
-
responseChunks = [];
|
|
1412
|
-
grpcStatus = import_nice_grpc_common.Status.UNKNOWN;
|
|
1413
|
-
statusMessage = "";
|
|
1414
|
-
};
|
|
1415
|
-
}
|
|
1416
|
-
});
|
|
1417
|
-
|
|
1418
1244
|
// src/index.ts
|
|
1419
1245
|
var index_exports = {};
|
|
1420
1246
|
__export(index_exports, {
|
|
1421
1247
|
AuthenticationError: () => AuthenticationError,
|
|
1422
1248
|
ConfigurationError: () => ConfigurationError,
|
|
1249
|
+
ConnectionManager: () => ConnectionManagerBrowser,
|
|
1423
1250
|
DEFAULT_FEE_SATS: () => DEFAULT_FEE_SATS,
|
|
1424
1251
|
DIRECT_TIMELOCK_OFFSET: () => DIRECT_TIMELOCK_OFFSET,
|
|
1425
1252
|
DefaultSparkSigner: () => DefaultSparkSigner,
|
|
@@ -1428,7 +1255,6 @@ __export(index_exports, {
|
|
|
1428
1255
|
InternalValidationError: () => InternalValidationError,
|
|
1429
1256
|
KeyDerivationType: () => KeyDerivationType,
|
|
1430
1257
|
LOGGER_NAMES: () => LOGGER_NAMES,
|
|
1431
|
-
LRC_WALLET_NETWORK: () => LRC_WALLET_NETWORK,
|
|
1432
1258
|
Network: () => Network2,
|
|
1433
1259
|
NetworkError: () => NetworkError,
|
|
1434
1260
|
NetworkToProto: () => NetworkToProto,
|
|
@@ -17490,16 +17316,16 @@ function encodeSparkAddressWithSignature(payload, signature) {
|
|
|
17490
17316
|
);
|
|
17491
17317
|
}
|
|
17492
17318
|
}
|
|
17493
|
-
function decodeSparkAddress(
|
|
17319
|
+
function decodeSparkAddress(address, network) {
|
|
17494
17320
|
try {
|
|
17495
|
-
if (network !== getNetworkFromSparkAddress(
|
|
17321
|
+
if (network !== getNetworkFromSparkAddress(address)) {
|
|
17496
17322
|
throw new ValidationError("Invalid Spark address prefix", {
|
|
17497
17323
|
field: "address",
|
|
17498
|
-
value:
|
|
17324
|
+
value: address,
|
|
17499
17325
|
expected: `prefix='${AddressNetwork[network]}' or '${LegacyAddressNetwork[network]}'`
|
|
17500
17326
|
});
|
|
17501
17327
|
}
|
|
17502
|
-
const decoded = bech32mDecode(
|
|
17328
|
+
const decoded = bech32mDecode(address);
|
|
17503
17329
|
const payload = SparkAddress.decode(import_base2.bech32m.fromWords(decoded.words));
|
|
17504
17330
|
const { identityPublicKey, sparkInvoiceFields, signature } = payload;
|
|
17505
17331
|
const identityPubkeyHex = (0, import_utils3.bytesToHex)(identityPublicKey);
|
|
@@ -17537,7 +17363,7 @@ function decodeSparkAddress(address2, network) {
|
|
|
17537
17363
|
"Failed to decode Spark address",
|
|
17538
17364
|
{
|
|
17539
17365
|
field: "address",
|
|
17540
|
-
value:
|
|
17366
|
+
value: address
|
|
17541
17367
|
},
|
|
17542
17368
|
error
|
|
17543
17369
|
);
|
|
@@ -17549,30 +17375,30 @@ var PrefixToNetwork = Object.fromEntries(
|
|
|
17549
17375
|
var LegacyPrefixToNetwork = Object.fromEntries(
|
|
17550
17376
|
Object.entries(LegacyAddressNetwork).map(([k, v]) => [v, k])
|
|
17551
17377
|
);
|
|
17552
|
-
function getNetworkFromSparkAddress(
|
|
17553
|
-
const { prefix } = bech32mDecode(
|
|
17378
|
+
function getNetworkFromSparkAddress(address) {
|
|
17379
|
+
const { prefix } = bech32mDecode(address);
|
|
17554
17380
|
const network = PrefixToNetwork[prefix] ?? LegacyPrefixToNetwork[prefix];
|
|
17555
17381
|
if (!network) {
|
|
17556
17382
|
throw new ValidationError("Invalid Spark address prefix", {
|
|
17557
17383
|
field: "network",
|
|
17558
|
-
value:
|
|
17384
|
+
value: address,
|
|
17559
17385
|
expected: "prefix='spark1', 'sparkt1', 'sparkrt1', 'sparks1', 'sparkl1' or legacy ('sp1', 'spt1', 'sprt1', 'sps1', 'spl1')"
|
|
17560
17386
|
});
|
|
17561
17387
|
}
|
|
17562
17388
|
return network;
|
|
17563
17389
|
}
|
|
17564
|
-
function isLegacySparkAddress(
|
|
17390
|
+
function isLegacySparkAddress(address) {
|
|
17565
17391
|
try {
|
|
17566
|
-
const { prefix } = bech32mDecode(
|
|
17392
|
+
const { prefix } = bech32mDecode(address);
|
|
17567
17393
|
return prefix in LegacyPrefixToNetwork;
|
|
17568
17394
|
} catch (error) {
|
|
17569
17395
|
return false;
|
|
17570
17396
|
}
|
|
17571
17397
|
}
|
|
17572
|
-
function isValidSparkAddress(
|
|
17398
|
+
function isValidSparkAddress(address) {
|
|
17573
17399
|
try {
|
|
17574
|
-
const network = getNetworkFromSparkAddress(
|
|
17575
|
-
decodeSparkAddress(
|
|
17400
|
+
const network = getNetworkFromSparkAddress(address);
|
|
17401
|
+
decodeSparkAddress(address, network);
|
|
17576
17402
|
return true;
|
|
17577
17403
|
} catch (error) {
|
|
17578
17404
|
if (error instanceof ValidationError) {
|
|
@@ -17582,7 +17408,7 @@ function isValidSparkAddress(address2) {
|
|
|
17582
17408
|
"Invalid Spark address",
|
|
17583
17409
|
{
|
|
17584
17410
|
field: "address",
|
|
17585
|
-
value:
|
|
17411
|
+
value: address
|
|
17586
17412
|
},
|
|
17587
17413
|
error
|
|
17588
17414
|
);
|
|
@@ -17775,9 +17601,9 @@ function assertBech32(s) {
|
|
|
17775
17601
|
const i = s.lastIndexOf("1");
|
|
17776
17602
|
if (i <= 0 || i >= s.length - 1) throw new Error("invalid bech32 string");
|
|
17777
17603
|
}
|
|
17778
|
-
function bech32mDecode(
|
|
17779
|
-
assertBech32(
|
|
17780
|
-
return import_base2.bech32m.decode(
|
|
17604
|
+
function bech32mDecode(address) {
|
|
17605
|
+
assertBech32(address);
|
|
17606
|
+
return import_base2.bech32m.decode(address, BECH32M_LIMIT);
|
|
17781
17607
|
}
|
|
17782
17608
|
function bech32mEncode(prefix, words) {
|
|
17783
17609
|
return import_base2.bech32m.encode(prefix, words, BECH32M_LIMIT);
|
|
@@ -17952,7 +17778,7 @@ var btc2 = __toESM(require("@scure/btc-signer"), 1);
|
|
|
17952
17778
|
// src/utils/network.ts
|
|
17953
17779
|
init_buffer();
|
|
17954
17780
|
var btc = __toESM(require("@scure/btc-signer"), 1);
|
|
17955
|
-
var
|
|
17781
|
+
var import_base3 = require("@scure/base");
|
|
17956
17782
|
|
|
17957
17783
|
// src/graphql/objects/BitcoinNetwork.ts
|
|
17958
17784
|
init_buffer();
|
|
@@ -18004,16 +17830,16 @@ var NetworkConfig = {
|
|
|
18004
17830
|
[4 /* LOCAL */]: { ...btc.TEST_NETWORK, bech32: "bcrt" }
|
|
18005
17831
|
};
|
|
18006
17832
|
var getNetwork = (network) => NetworkConfig[network];
|
|
18007
|
-
|
|
18008
|
-
[0 /* MAINNET */]: bitcoin.networks.bitcoin,
|
|
18009
|
-
[1 /* TESTNET */]: bitcoin.networks.testnet,
|
|
18010
|
-
[2 /* SIGNET */]: bitcoin.networks.testnet,
|
|
18011
|
-
[3 /* REGTEST */]: bitcoin.networks.regtest,
|
|
18012
|
-
[4 /* LOCAL */]: bitcoin.networks.regtest
|
|
18013
|
-
});
|
|
18014
|
-
function getNetworkFromAddress(address2) {
|
|
17833
|
+
function getNetworkFromAddress(address) {
|
|
18015
17834
|
try {
|
|
18016
|
-
const
|
|
17835
|
+
const bechAddress = address;
|
|
17836
|
+
const decoded = (() => {
|
|
17837
|
+
try {
|
|
17838
|
+
return import_base3.bech32.decode(bechAddress);
|
|
17839
|
+
} catch (_) {
|
|
17840
|
+
return import_base3.bech32m.decode(bechAddress);
|
|
17841
|
+
}
|
|
17842
|
+
})();
|
|
18017
17843
|
if (decoded.prefix === "bc") {
|
|
18018
17844
|
return "MAINNET" /* MAINNET */;
|
|
18019
17845
|
} else if (decoded.prefix === "bcrt") {
|
|
@@ -18024,7 +17850,7 @@ function getNetworkFromAddress(address2) {
|
|
|
18024
17850
|
"Invalid Bitcoin address",
|
|
18025
17851
|
{
|
|
18026
17852
|
field: "address",
|
|
18027
|
-
value:
|
|
17853
|
+
value: address,
|
|
18028
17854
|
expected: "Valid Bech32 address with prefix 'bc' or 'bcrt'"
|
|
18029
17855
|
},
|
|
18030
17856
|
err instanceof Error ? err : void 0
|
|
@@ -18087,18 +17913,18 @@ function getP2TRAddressFromPublicKey(pubKey, network) {
|
|
|
18087
17913
|
});
|
|
18088
17914
|
}
|
|
18089
17915
|
const internalKey = import_secp256k13.secp256k1.Point.fromHex(pubKey);
|
|
18090
|
-
const
|
|
17916
|
+
const address = btc2.p2tr(
|
|
18091
17917
|
internalKey.toBytes().slice(1, 33),
|
|
18092
17918
|
void 0,
|
|
18093
17919
|
getNetwork(network)
|
|
18094
17920
|
).address;
|
|
18095
|
-
if (!
|
|
17921
|
+
if (!address) {
|
|
18096
17922
|
throw new ValidationError("Failed to get P2TR address", {
|
|
18097
17923
|
field: "address",
|
|
18098
17924
|
value: "null"
|
|
18099
17925
|
});
|
|
18100
17926
|
}
|
|
18101
|
-
return
|
|
17927
|
+
return address;
|
|
18102
17928
|
}
|
|
18103
17929
|
function getP2TRAddressFromPkScript(pkScript, network) {
|
|
18104
17930
|
if (pkScript.length !== 34 || pkScript[0] !== 81 || pkScript[1] !== 32) {
|
|
@@ -18119,14 +17945,14 @@ function getP2WPKHAddressFromPublicKey(pubKey, network) {
|
|
|
18119
17945
|
expected: 33
|
|
18120
17946
|
});
|
|
18121
17947
|
}
|
|
18122
|
-
const
|
|
18123
|
-
if (!
|
|
17948
|
+
const address = btc2.p2wpkh(pubKey, getNetwork(network)).address;
|
|
17949
|
+
if (!address) {
|
|
18124
17950
|
throw new ValidationError("Failed to get P2WPKH address", {
|
|
18125
17951
|
field: "address",
|
|
18126
17952
|
value: "null"
|
|
18127
17953
|
});
|
|
18128
17954
|
}
|
|
18129
|
-
return
|
|
17955
|
+
return address;
|
|
18130
17956
|
}
|
|
18131
17957
|
function getTxFromRawTxHex(rawTxHex) {
|
|
18132
17958
|
const txBytes = (0, import_utils5.hexToBytes)(rawTxHex);
|
|
@@ -18247,8 +18073,8 @@ function addPrivateKeys(a, b) {
|
|
|
18247
18073
|
}
|
|
18248
18074
|
const privA = import_secp256k14.secp256k1.utils.normPrivateKeyToScalar(a);
|
|
18249
18075
|
const privB = import_secp256k14.secp256k1.utils.normPrivateKeyToScalar(b);
|
|
18250
|
-
const
|
|
18251
|
-
return (0, import_utils6.numberToBytesBE)(
|
|
18076
|
+
const sum2 = (privA + privB) % import_secp256k14.secp256k1.CURVE.n;
|
|
18077
|
+
return (0, import_utils6.numberToBytesBE)(sum2, 32);
|
|
18252
18078
|
}
|
|
18253
18079
|
function subtractPrivateKeys(a, b) {
|
|
18254
18080
|
if (a.length !== 32 || b.length !== 32) {
|
|
@@ -18260,11 +18086,11 @@ function subtractPrivateKeys(a, b) {
|
|
|
18260
18086
|
}
|
|
18261
18087
|
const privA = import_secp256k14.secp256k1.utils.normPrivateKeyToScalar(a);
|
|
18262
18088
|
const privB = import_secp256k14.secp256k1.utils.normPrivateKeyToScalar(b);
|
|
18263
|
-
const
|
|
18264
|
-
return (0, import_utils6.numberToBytesBE)(
|
|
18089
|
+
const sum2 = (import_secp256k14.secp256k1.CURVE.n - privB + privA) % import_secp256k14.secp256k1.CURVE.n;
|
|
18090
|
+
return (0, import_utils6.numberToBytesBE)(sum2, 32);
|
|
18265
18091
|
}
|
|
18266
18092
|
function sumOfPrivateKeys(keys) {
|
|
18267
|
-
return keys.reduce((
|
|
18093
|
+
return keys.reduce((sum2, key) => {
|
|
18268
18094
|
if (key.length !== 32) {
|
|
18269
18095
|
throw new ValidationError("Private keys must be 32 bytes", {
|
|
18270
18096
|
field: "privateKey",
|
|
@@ -18272,7 +18098,7 @@ function sumOfPrivateKeys(keys) {
|
|
|
18272
18098
|
expected: 32
|
|
18273
18099
|
});
|
|
18274
18100
|
}
|
|
18275
|
-
return addPrivateKeys(
|
|
18101
|
+
return addPrivateKeys(sum2, key);
|
|
18276
18102
|
});
|
|
18277
18103
|
}
|
|
18278
18104
|
function lastKeyWithTarget(target, keys) {
|
|
@@ -18283,8 +18109,8 @@ function lastKeyWithTarget(target, keys) {
|
|
|
18283
18109
|
expected: 32
|
|
18284
18110
|
});
|
|
18285
18111
|
}
|
|
18286
|
-
const
|
|
18287
|
-
return subtractPrivateKeys(target,
|
|
18112
|
+
const sum2 = sumOfPrivateKeys(keys);
|
|
18113
|
+
return subtractPrivateKeys(target, sum2);
|
|
18288
18114
|
}
|
|
18289
18115
|
|
|
18290
18116
|
// src/utils/mempool.ts
|
|
@@ -19514,9 +19340,9 @@ var getFetch = () => {
|
|
|
19514
19340
|
};
|
|
19515
19341
|
|
|
19516
19342
|
// src/utils/mempool.ts
|
|
19517
|
-
async function getLatestDepositTxId(
|
|
19343
|
+
async function getLatestDepositTxId(address) {
|
|
19518
19344
|
const { fetch, Headers: Headers2 } = getFetch();
|
|
19519
|
-
const network = getNetworkFromAddress(
|
|
19345
|
+
const network = getNetworkFromAddress(address);
|
|
19520
19346
|
const baseUrl = network === BitcoinNetwork_default.REGTEST ? getElectrsUrl("REGTEST") : getElectrsUrl("MAINNET");
|
|
19521
19347
|
const headers = new Headers2();
|
|
19522
19348
|
if (network === BitcoinNetwork_default.REGTEST) {
|
|
@@ -19525,14 +19351,14 @@ async function getLatestDepositTxId(address2) {
|
|
|
19525
19351
|
);
|
|
19526
19352
|
headers.set("Authorization", `Basic ${auth}`);
|
|
19527
19353
|
}
|
|
19528
|
-
const response = await fetch(`${baseUrl}/address/${
|
|
19354
|
+
const response = await fetch(`${baseUrl}/address/${address}/txs`, {
|
|
19529
19355
|
headers
|
|
19530
19356
|
});
|
|
19531
19357
|
const addressTxs = await response.json();
|
|
19532
19358
|
if (addressTxs && addressTxs.length > 0) {
|
|
19533
19359
|
const latestTx = addressTxs[0];
|
|
19534
19360
|
const outputIndex = latestTx.vout.findIndex(
|
|
19535
|
-
(output) => output.scriptpubkey_address ===
|
|
19361
|
+
(output) => output.scriptpubkey_address === address
|
|
19536
19362
|
);
|
|
19537
19363
|
if (outputIndex === -1) {
|
|
19538
19364
|
return null;
|
|
@@ -19886,7 +19712,7 @@ function decodeBytesToSigningCommitment(bytes2) {
|
|
|
19886
19712
|
|
|
19887
19713
|
// src/utils/token-identifier.ts
|
|
19888
19714
|
init_buffer();
|
|
19889
|
-
var
|
|
19715
|
+
var import_base4 = require("@scure/base");
|
|
19890
19716
|
var Bech32mTokenIdentifierTokenIdentifierNetworkPrefix = {
|
|
19891
19717
|
MAINNET: "btkn",
|
|
19892
19718
|
REGTEST: "btknrt",
|
|
@@ -19896,7 +19722,7 @@ var Bech32mTokenIdentifierTokenIdentifierNetworkPrefix = {
|
|
|
19896
19722
|
};
|
|
19897
19723
|
function encodeBech32mTokenIdentifier(payload) {
|
|
19898
19724
|
try {
|
|
19899
|
-
const words =
|
|
19725
|
+
const words = import_base4.bech32m.toWords(payload.tokenIdentifier);
|
|
19900
19726
|
if (!payload.network) {
|
|
19901
19727
|
throw new ValidationError(
|
|
19902
19728
|
"Network is required to encode bech32m encoded token identifier",
|
|
@@ -19906,7 +19732,7 @@ function encodeBech32mTokenIdentifier(payload) {
|
|
|
19906
19732
|
}
|
|
19907
19733
|
);
|
|
19908
19734
|
}
|
|
19909
|
-
return
|
|
19735
|
+
return import_base4.bech32m.encode(
|
|
19910
19736
|
Bech32mTokenIdentifierTokenIdentifierNetworkPrefix[payload.network],
|
|
19911
19737
|
words,
|
|
19912
19738
|
500
|
|
@@ -19924,7 +19750,7 @@ function encodeBech32mTokenIdentifier(payload) {
|
|
|
19924
19750
|
}
|
|
19925
19751
|
function decodeBech32mTokenIdentifier(bech32mTokenIdentifier, network) {
|
|
19926
19752
|
try {
|
|
19927
|
-
const decoded =
|
|
19753
|
+
const decoded = import_base4.bech32m.decode(
|
|
19928
19754
|
bech32mTokenIdentifier,
|
|
19929
19755
|
500
|
|
19930
19756
|
);
|
|
@@ -19938,7 +19764,7 @@ function decodeBech32mTokenIdentifier(bech32mTokenIdentifier, network) {
|
|
|
19938
19764
|
}
|
|
19939
19765
|
);
|
|
19940
19766
|
}
|
|
19941
|
-
const tokenIdentifier =
|
|
19767
|
+
const tokenIdentifier = import_base4.bech32m.fromWords(decoded.words);
|
|
19942
19768
|
return {
|
|
19943
19769
|
tokenIdentifier,
|
|
19944
19770
|
network: network ?? getNetworkFromBech32mTokenIdentifier(bech32mTokenIdentifier)
|
|
@@ -19988,7 +19814,7 @@ var import_utils9 = require("@noble/curves/utils");
|
|
|
19988
19814
|
function sumAvailableTokens(outputs) {
|
|
19989
19815
|
try {
|
|
19990
19816
|
return outputs.reduce(
|
|
19991
|
-
(
|
|
19817
|
+
(sum2, output) => sum2 + BigInt((0, import_utils9.bytesToNumberBE)(output.output.tokenAmount)),
|
|
19992
19818
|
BigInt(0)
|
|
19993
19819
|
);
|
|
19994
19820
|
} catch (error) {
|
|
@@ -20918,7 +20744,7 @@ var isWebExtension = (
|
|
|
20918
20744
|
"chrome" in globalThis && globalThis.chrome.runtime?.id
|
|
20919
20745
|
);
|
|
20920
20746
|
var userAgent = "navigator" in globalThis ? globalThis.navigator.userAgent || "unknown-user-agent" : void 0;
|
|
20921
|
-
var packageVersion = true ? "0.3.
|
|
20747
|
+
var packageVersion = true ? "0.3.7" : "unknown";
|
|
20922
20748
|
var baseEnvStr = "unknown";
|
|
20923
20749
|
if (isBun) {
|
|
20924
20750
|
const bunVersion = "version" in globalThis.Bun ? globalThis.Bun.version : "unknown-version";
|
|
@@ -21591,7 +21417,7 @@ fragment CoopExitRequestFragment on CoopExitRequest {
|
|
|
21591
21417
|
var CompleteCoopExit = `
|
|
21592
21418
|
mutation CompleteCoopExit(
|
|
21593
21419
|
$user_outbound_transfer_external_id: UUID!
|
|
21594
|
-
$coop_exit_request_id: ID
|
|
21420
|
+
$coop_exit_request_id: ID
|
|
21595
21421
|
) {
|
|
21596
21422
|
complete_coop_exit(input: {
|
|
21597
21423
|
user_outbound_transfer_external_id: $user_outbound_transfer_external_id
|
|
@@ -21669,11 +21495,12 @@ var RequestCoopExit = `
|
|
|
21669
21495
|
mutation RequestCoopExit(
|
|
21670
21496
|
$leaf_external_ids: [UUID!]!
|
|
21671
21497
|
$withdrawal_address: String!
|
|
21672
|
-
$idempotency_key: String
|
|
21498
|
+
$idempotency_key: String
|
|
21673
21499
|
$exit_speed: ExitSpeed!
|
|
21674
21500
|
$withdraw_all: Boolean
|
|
21675
21501
|
$fee_leaf_external_ids: [UUID!]
|
|
21676
21502
|
$fee_quote_id: ID
|
|
21503
|
+
$user_outbound_transfer_external_id: UUID
|
|
21677
21504
|
) {
|
|
21678
21505
|
request_coop_exit(
|
|
21679
21506
|
input: {
|
|
@@ -21684,6 +21511,7 @@ var RequestCoopExit = `
|
|
|
21684
21511
|
withdraw_all: $withdraw_all
|
|
21685
21512
|
fee_leaf_external_ids: $fee_leaf_external_ids
|
|
21686
21513
|
fee_quote_id: $fee_quote_id
|
|
21514
|
+
user_outbound_transfer_external_id: $user_outbound_transfer_external_id
|
|
21687
21515
|
}
|
|
21688
21516
|
) {
|
|
21689
21517
|
request {
|
|
@@ -21732,13 +21560,15 @@ init_buffer();
|
|
|
21732
21560
|
var RequestLightningSend = `
|
|
21733
21561
|
mutation RequestLightningSend(
|
|
21734
21562
|
$encoded_invoice: String!
|
|
21735
|
-
$idempotency_key: String
|
|
21563
|
+
$idempotency_key: String
|
|
21736
21564
|
$amount_sats: Long
|
|
21565
|
+
$user_outbound_transfer_external_id: UUID
|
|
21737
21566
|
) {
|
|
21738
21567
|
request_lightning_send(input: {
|
|
21739
21568
|
encoded_invoice: $encoded_invoice
|
|
21740
21569
|
idempotency_key: $idempotency_key
|
|
21741
21570
|
amount_sats: $amount_sats
|
|
21571
|
+
user_outbound_transfer_external_id: $user_outbound_transfer_external_id
|
|
21742
21572
|
}) {
|
|
21743
21573
|
request {
|
|
21744
21574
|
...LightningSendRequestFragment
|
|
@@ -22188,14 +22018,12 @@ var SspClient = class {
|
|
|
22188
22018
|
throw new Error("Not implemented");
|
|
22189
22019
|
}
|
|
22190
22020
|
async completeCoopExit({
|
|
22191
|
-
userOutboundTransferExternalId
|
|
22192
|
-
coopExitRequestId
|
|
22021
|
+
userOutboundTransferExternalId
|
|
22193
22022
|
}) {
|
|
22194
22023
|
return await this.executeRawQuery({
|
|
22195
22024
|
queryPayload: CompleteCoopExit,
|
|
22196
22025
|
variables: {
|
|
22197
|
-
user_outbound_transfer_external_id: userOutboundTransferExternalId
|
|
22198
|
-
coop_exit_request_id: coopExitRequestId
|
|
22026
|
+
user_outbound_transfer_external_id: userOutboundTransferExternalId
|
|
22199
22027
|
},
|
|
22200
22028
|
constructObject: (response) => {
|
|
22201
22029
|
return CoopExitRequestFromJson(response.complete_coop_exit.request);
|
|
@@ -22205,29 +22033,28 @@ var SspClient = class {
|
|
|
22205
22033
|
async requestCoopExit({
|
|
22206
22034
|
leafExternalIds,
|
|
22207
22035
|
withdrawalAddress,
|
|
22208
|
-
idempotencyKey,
|
|
22209
22036
|
exitSpeed,
|
|
22210
22037
|
feeLeafExternalIds,
|
|
22211
22038
|
feeQuoteId,
|
|
22212
|
-
withdrawAll
|
|
22039
|
+
withdrawAll,
|
|
22040
|
+
userOutboundTransferExternalId
|
|
22213
22041
|
}) {
|
|
22214
22042
|
return await this.executeRawQuery({
|
|
22215
22043
|
queryPayload: RequestCoopExit,
|
|
22216
22044
|
variables: {
|
|
22217
22045
|
leaf_external_ids: leafExternalIds,
|
|
22218
22046
|
withdrawal_address: withdrawalAddress,
|
|
22219
|
-
idempotency_key: idempotencyKey,
|
|
22220
22047
|
exit_speed: exitSpeed,
|
|
22221
22048
|
fee_leaf_external_ids: feeLeafExternalIds,
|
|
22222
22049
|
fee_quote_id: feeQuoteId,
|
|
22223
|
-
withdraw_all: withdrawAll
|
|
22050
|
+
withdraw_all: withdrawAll,
|
|
22051
|
+
user_outbound_transfer_external_id: userOutboundTransferExternalId
|
|
22224
22052
|
},
|
|
22225
22053
|
constructObject: (response) => {
|
|
22226
22054
|
return CoopExitRequestFromJson(response.request_coop_exit.request);
|
|
22227
22055
|
}
|
|
22228
22056
|
});
|
|
22229
22057
|
}
|
|
22230
|
-
// TODO: Lets name this better
|
|
22231
22058
|
async requestLightningReceive({
|
|
22232
22059
|
amountSats,
|
|
22233
22060
|
network,
|
|
@@ -22259,15 +22086,15 @@ var SspClient = class {
|
|
|
22259
22086
|
}
|
|
22260
22087
|
async requestLightningSend({
|
|
22261
22088
|
encodedInvoice,
|
|
22262
|
-
|
|
22263
|
-
|
|
22089
|
+
amountSats,
|
|
22090
|
+
userOutboundTransferExternalId
|
|
22264
22091
|
}) {
|
|
22265
22092
|
return await this.executeRawQuery({
|
|
22266
22093
|
queryPayload: RequestLightningSend,
|
|
22267
22094
|
variables: {
|
|
22268
22095
|
encoded_invoice: encodedInvoice,
|
|
22269
|
-
|
|
22270
|
-
|
|
22096
|
+
amount_sats: amountSats,
|
|
22097
|
+
user_outbound_transfer_external_id: userOutboundTransferExternalId
|
|
22271
22098
|
},
|
|
22272
22099
|
constructObject: (response) => {
|
|
22273
22100
|
return LightningSendRequestFromJson(
|
|
@@ -22612,13 +22439,13 @@ var WalletConfigService = class {
|
|
|
22612
22439
|
config;
|
|
22613
22440
|
signer;
|
|
22614
22441
|
sspClientOptions;
|
|
22615
|
-
constructor(options, signer) {
|
|
22442
|
+
constructor(options = {}, signer) {
|
|
22616
22443
|
const network = options?.network ?? "REGTEST";
|
|
22617
22444
|
this.config = {
|
|
22618
22445
|
...this.getDefaultConfig(Network2[network]),
|
|
22619
22446
|
...options
|
|
22620
22447
|
};
|
|
22621
|
-
this.signer = signer
|
|
22448
|
+
this.signer = signer;
|
|
22622
22449
|
this.sspClientOptions = this.config.sspClientOptions;
|
|
22623
22450
|
}
|
|
22624
22451
|
getDefaultConfig(network) {
|
|
@@ -22701,450 +22528,19 @@ var WalletConfigService = class {
|
|
|
22701
22528
|
}
|
|
22702
22529
|
};
|
|
22703
22530
|
|
|
22704
|
-
// src/services/connection.ts
|
|
22531
|
+
// src/services/connection/connection.ts
|
|
22705
22532
|
init_buffer();
|
|
22706
22533
|
var import_core12 = require("@lightsparkdev/core");
|
|
22707
22534
|
var import_sha28 = require("@noble/hashes/sha2");
|
|
22708
|
-
var import_nice_grpc_client_middleware_retry = require("nice-grpc-client-middleware-retry");
|
|
22709
|
-
var import_nice_grpc_common2 = require("nice-grpc-common");
|
|
22710
|
-
var import_nice_grpc_web = require("nice-grpc-web");
|
|
22711
|
-
|
|
22712
|
-
// src/proto/mock.ts
|
|
22713
|
-
init_buffer();
|
|
22714
|
-
var import_wire6 = require("@bufbuild/protobuf/wire");
|
|
22715
|
-
function interruptTransferRequest_InterruptTransferActionFromJSON(object) {
|
|
22716
|
-
switch (object) {
|
|
22717
|
-
case 0:
|
|
22718
|
-
case "NONE":
|
|
22719
|
-
return 0 /* NONE */;
|
|
22720
|
-
case 1:
|
|
22721
|
-
case "INTERRUPT":
|
|
22722
|
-
return 1 /* INTERRUPT */;
|
|
22723
|
-
case 2:
|
|
22724
|
-
case "RESUME":
|
|
22725
|
-
return 2 /* RESUME */;
|
|
22726
|
-
case -1:
|
|
22727
|
-
case "UNRECOGNIZED":
|
|
22728
|
-
default:
|
|
22729
|
-
return -1 /* UNRECOGNIZED */;
|
|
22730
|
-
}
|
|
22731
|
-
}
|
|
22732
|
-
function interruptTransferRequest_InterruptTransferActionToJSON(object) {
|
|
22733
|
-
switch (object) {
|
|
22734
|
-
case 0 /* NONE */:
|
|
22735
|
-
return "NONE";
|
|
22736
|
-
case 1 /* INTERRUPT */:
|
|
22737
|
-
return "INTERRUPT";
|
|
22738
|
-
case 2 /* RESUME */:
|
|
22739
|
-
return "RESUME";
|
|
22740
|
-
case -1 /* UNRECOGNIZED */:
|
|
22741
|
-
default:
|
|
22742
|
-
return "UNRECOGNIZED";
|
|
22743
|
-
}
|
|
22744
|
-
}
|
|
22745
|
-
function interruptCoopExitRequest_InterruptCoopExitActionFromJSON(object) {
|
|
22746
|
-
switch (object) {
|
|
22747
|
-
case 0:
|
|
22748
|
-
case "NONE":
|
|
22749
|
-
return 0 /* NONE */;
|
|
22750
|
-
case 1:
|
|
22751
|
-
case "INTERRUPT":
|
|
22752
|
-
return 1 /* INTERRUPT */;
|
|
22753
|
-
case 2:
|
|
22754
|
-
case "RESUME":
|
|
22755
|
-
return 2 /* RESUME */;
|
|
22756
|
-
case -1:
|
|
22757
|
-
case "UNRECOGNIZED":
|
|
22758
|
-
default:
|
|
22759
|
-
return -1 /* UNRECOGNIZED */;
|
|
22760
|
-
}
|
|
22761
|
-
}
|
|
22762
|
-
function interruptCoopExitRequest_InterruptCoopExitActionToJSON(object) {
|
|
22763
|
-
switch (object) {
|
|
22764
|
-
case 0 /* NONE */:
|
|
22765
|
-
return "NONE";
|
|
22766
|
-
case 1 /* INTERRUPT */:
|
|
22767
|
-
return "INTERRUPT";
|
|
22768
|
-
case 2 /* RESUME */:
|
|
22769
|
-
return "RESUME";
|
|
22770
|
-
case -1 /* UNRECOGNIZED */:
|
|
22771
|
-
default:
|
|
22772
|
-
return "UNRECOGNIZED";
|
|
22773
|
-
}
|
|
22774
|
-
}
|
|
22775
|
-
function createBaseCleanUpPreimageShareRequest() {
|
|
22776
|
-
return { paymentHash: new Uint8Array(0) };
|
|
22777
|
-
}
|
|
22778
|
-
var CleanUpPreimageShareRequest = {
|
|
22779
|
-
encode(message, writer = new import_wire6.BinaryWriter()) {
|
|
22780
|
-
if (message.paymentHash.length !== 0) {
|
|
22781
|
-
writer.uint32(10).bytes(message.paymentHash);
|
|
22782
|
-
}
|
|
22783
|
-
return writer;
|
|
22784
|
-
},
|
|
22785
|
-
decode(input, length) {
|
|
22786
|
-
const reader = input instanceof import_wire6.BinaryReader ? input : new import_wire6.BinaryReader(input);
|
|
22787
|
-
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
22788
|
-
const message = createBaseCleanUpPreimageShareRequest();
|
|
22789
|
-
while (reader.pos < end) {
|
|
22790
|
-
const tag = reader.uint32();
|
|
22791
|
-
switch (tag >>> 3) {
|
|
22792
|
-
case 1: {
|
|
22793
|
-
if (tag !== 10) {
|
|
22794
|
-
break;
|
|
22795
|
-
}
|
|
22796
|
-
message.paymentHash = reader.bytes();
|
|
22797
|
-
continue;
|
|
22798
|
-
}
|
|
22799
|
-
}
|
|
22800
|
-
if ((tag & 7) === 4 || tag === 0) {
|
|
22801
|
-
break;
|
|
22802
|
-
}
|
|
22803
|
-
reader.skip(tag & 7);
|
|
22804
|
-
}
|
|
22805
|
-
return message;
|
|
22806
|
-
},
|
|
22807
|
-
fromJSON(object) {
|
|
22808
|
-
return { paymentHash: isSet4(object.paymentHash) ? bytesFromBase643(object.paymentHash) : new Uint8Array(0) };
|
|
22809
|
-
},
|
|
22810
|
-
toJSON(message) {
|
|
22811
|
-
const obj = {};
|
|
22812
|
-
if (message.paymentHash.length !== 0) {
|
|
22813
|
-
obj.paymentHash = base64FromBytes3(message.paymentHash);
|
|
22814
|
-
}
|
|
22815
|
-
return obj;
|
|
22816
|
-
},
|
|
22817
|
-
create(base) {
|
|
22818
|
-
return CleanUpPreimageShareRequest.fromPartial(base ?? {});
|
|
22819
|
-
},
|
|
22820
|
-
fromPartial(object) {
|
|
22821
|
-
const message = createBaseCleanUpPreimageShareRequest();
|
|
22822
|
-
message.paymentHash = object.paymentHash ?? new Uint8Array(0);
|
|
22823
|
-
return message;
|
|
22824
|
-
}
|
|
22825
|
-
};
|
|
22826
|
-
function createBaseInterruptTransferRequest() {
|
|
22827
|
-
return { action: 0 };
|
|
22828
|
-
}
|
|
22829
|
-
var InterruptTransferRequest = {
|
|
22830
|
-
encode(message, writer = new import_wire6.BinaryWriter()) {
|
|
22831
|
-
if (message.action !== 0) {
|
|
22832
|
-
writer.uint32(8).int32(message.action);
|
|
22833
|
-
}
|
|
22834
|
-
return writer;
|
|
22835
|
-
},
|
|
22836
|
-
decode(input, length) {
|
|
22837
|
-
const reader = input instanceof import_wire6.BinaryReader ? input : new import_wire6.BinaryReader(input);
|
|
22838
|
-
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
22839
|
-
const message = createBaseInterruptTransferRequest();
|
|
22840
|
-
while (reader.pos < end) {
|
|
22841
|
-
const tag = reader.uint32();
|
|
22842
|
-
switch (tag >>> 3) {
|
|
22843
|
-
case 1: {
|
|
22844
|
-
if (tag !== 8) {
|
|
22845
|
-
break;
|
|
22846
|
-
}
|
|
22847
|
-
message.action = reader.int32();
|
|
22848
|
-
continue;
|
|
22849
|
-
}
|
|
22850
|
-
}
|
|
22851
|
-
if ((tag & 7) === 4 || tag === 0) {
|
|
22852
|
-
break;
|
|
22853
|
-
}
|
|
22854
|
-
reader.skip(tag & 7);
|
|
22855
|
-
}
|
|
22856
|
-
return message;
|
|
22857
|
-
},
|
|
22858
|
-
fromJSON(object) {
|
|
22859
|
-
return {
|
|
22860
|
-
action: isSet4(object.action) ? interruptTransferRequest_InterruptTransferActionFromJSON(object.action) : 0
|
|
22861
|
-
};
|
|
22862
|
-
},
|
|
22863
|
-
toJSON(message) {
|
|
22864
|
-
const obj = {};
|
|
22865
|
-
if (message.action !== 0) {
|
|
22866
|
-
obj.action = interruptTransferRequest_InterruptTransferActionToJSON(message.action);
|
|
22867
|
-
}
|
|
22868
|
-
return obj;
|
|
22869
|
-
},
|
|
22870
|
-
create(base) {
|
|
22871
|
-
return InterruptTransferRequest.fromPartial(base ?? {});
|
|
22872
|
-
},
|
|
22873
|
-
fromPartial(object) {
|
|
22874
|
-
const message = createBaseInterruptTransferRequest();
|
|
22875
|
-
message.action = object.action ?? 0;
|
|
22876
|
-
return message;
|
|
22877
|
-
}
|
|
22878
|
-
};
|
|
22879
|
-
function createBaseUpdateNodesStatusRequest() {
|
|
22880
|
-
return { nodeIds: [], status: "" };
|
|
22881
|
-
}
|
|
22882
|
-
var UpdateNodesStatusRequest = {
|
|
22883
|
-
encode(message, writer = new import_wire6.BinaryWriter()) {
|
|
22884
|
-
for (const v of message.nodeIds) {
|
|
22885
|
-
writer.uint32(10).string(v);
|
|
22886
|
-
}
|
|
22887
|
-
if (message.status !== "") {
|
|
22888
|
-
writer.uint32(18).string(message.status);
|
|
22889
|
-
}
|
|
22890
|
-
return writer;
|
|
22891
|
-
},
|
|
22892
|
-
decode(input, length) {
|
|
22893
|
-
const reader = input instanceof import_wire6.BinaryReader ? input : new import_wire6.BinaryReader(input);
|
|
22894
|
-
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
22895
|
-
const message = createBaseUpdateNodesStatusRequest();
|
|
22896
|
-
while (reader.pos < end) {
|
|
22897
|
-
const tag = reader.uint32();
|
|
22898
|
-
switch (tag >>> 3) {
|
|
22899
|
-
case 1: {
|
|
22900
|
-
if (tag !== 10) {
|
|
22901
|
-
break;
|
|
22902
|
-
}
|
|
22903
|
-
message.nodeIds.push(reader.string());
|
|
22904
|
-
continue;
|
|
22905
|
-
}
|
|
22906
|
-
case 2: {
|
|
22907
|
-
if (tag !== 18) {
|
|
22908
|
-
break;
|
|
22909
|
-
}
|
|
22910
|
-
message.status = reader.string();
|
|
22911
|
-
continue;
|
|
22912
|
-
}
|
|
22913
|
-
}
|
|
22914
|
-
if ((tag & 7) === 4 || tag === 0) {
|
|
22915
|
-
break;
|
|
22916
|
-
}
|
|
22917
|
-
reader.skip(tag & 7);
|
|
22918
|
-
}
|
|
22919
|
-
return message;
|
|
22920
|
-
},
|
|
22921
|
-
fromJSON(object) {
|
|
22922
|
-
return {
|
|
22923
|
-
nodeIds: globalThis.Array.isArray(object?.nodeIds) ? object.nodeIds.map((e) => globalThis.String(e)) : [],
|
|
22924
|
-
status: isSet4(object.status) ? globalThis.String(object.status) : ""
|
|
22925
|
-
};
|
|
22926
|
-
},
|
|
22927
|
-
toJSON(message) {
|
|
22928
|
-
const obj = {};
|
|
22929
|
-
if (message.nodeIds?.length) {
|
|
22930
|
-
obj.nodeIds = message.nodeIds;
|
|
22931
|
-
}
|
|
22932
|
-
if (message.status !== "") {
|
|
22933
|
-
obj.status = message.status;
|
|
22934
|
-
}
|
|
22935
|
-
return obj;
|
|
22936
|
-
},
|
|
22937
|
-
create(base) {
|
|
22938
|
-
return UpdateNodesStatusRequest.fromPartial(base ?? {});
|
|
22939
|
-
},
|
|
22940
|
-
fromPartial(object) {
|
|
22941
|
-
const message = createBaseUpdateNodesStatusRequest();
|
|
22942
|
-
message.nodeIds = object.nodeIds?.map((e) => e) || [];
|
|
22943
|
-
message.status = object.status ?? "";
|
|
22944
|
-
return message;
|
|
22945
|
-
}
|
|
22946
|
-
};
|
|
22947
|
-
function createBaseTriggerTaskRequest() {
|
|
22948
|
-
return { taskName: "" };
|
|
22949
|
-
}
|
|
22950
|
-
var TriggerTaskRequest = {
|
|
22951
|
-
encode(message, writer = new import_wire6.BinaryWriter()) {
|
|
22952
|
-
if (message.taskName !== "") {
|
|
22953
|
-
writer.uint32(10).string(message.taskName);
|
|
22954
|
-
}
|
|
22955
|
-
return writer;
|
|
22956
|
-
},
|
|
22957
|
-
decode(input, length) {
|
|
22958
|
-
const reader = input instanceof import_wire6.BinaryReader ? input : new import_wire6.BinaryReader(input);
|
|
22959
|
-
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
22960
|
-
const message = createBaseTriggerTaskRequest();
|
|
22961
|
-
while (reader.pos < end) {
|
|
22962
|
-
const tag = reader.uint32();
|
|
22963
|
-
switch (tag >>> 3) {
|
|
22964
|
-
case 1: {
|
|
22965
|
-
if (tag !== 10) {
|
|
22966
|
-
break;
|
|
22967
|
-
}
|
|
22968
|
-
message.taskName = reader.string();
|
|
22969
|
-
continue;
|
|
22970
|
-
}
|
|
22971
|
-
}
|
|
22972
|
-
if ((tag & 7) === 4 || tag === 0) {
|
|
22973
|
-
break;
|
|
22974
|
-
}
|
|
22975
|
-
reader.skip(tag & 7);
|
|
22976
|
-
}
|
|
22977
|
-
return message;
|
|
22978
|
-
},
|
|
22979
|
-
fromJSON(object) {
|
|
22980
|
-
return { taskName: isSet4(object.taskName) ? globalThis.String(object.taskName) : "" };
|
|
22981
|
-
},
|
|
22982
|
-
toJSON(message) {
|
|
22983
|
-
const obj = {};
|
|
22984
|
-
if (message.taskName !== "") {
|
|
22985
|
-
obj.taskName = message.taskName;
|
|
22986
|
-
}
|
|
22987
|
-
return obj;
|
|
22988
|
-
},
|
|
22989
|
-
create(base) {
|
|
22990
|
-
return TriggerTaskRequest.fromPartial(base ?? {});
|
|
22991
|
-
},
|
|
22992
|
-
fromPartial(object) {
|
|
22993
|
-
const message = createBaseTriggerTaskRequest();
|
|
22994
|
-
message.taskName = object.taskName ?? "";
|
|
22995
|
-
return message;
|
|
22996
|
-
}
|
|
22997
|
-
};
|
|
22998
|
-
function createBaseInterruptCoopExitRequest() {
|
|
22999
|
-
return { action: 0, targetOperator: "" };
|
|
23000
|
-
}
|
|
23001
|
-
var InterruptCoopExitRequest = {
|
|
23002
|
-
encode(message, writer = new import_wire6.BinaryWriter()) {
|
|
23003
|
-
if (message.action !== 0) {
|
|
23004
|
-
writer.uint32(8).int32(message.action);
|
|
23005
|
-
}
|
|
23006
|
-
if (message.targetOperator !== "") {
|
|
23007
|
-
writer.uint32(18).string(message.targetOperator);
|
|
23008
|
-
}
|
|
23009
|
-
return writer;
|
|
23010
|
-
},
|
|
23011
|
-
decode(input, length) {
|
|
23012
|
-
const reader = input instanceof import_wire6.BinaryReader ? input : new import_wire6.BinaryReader(input);
|
|
23013
|
-
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
23014
|
-
const message = createBaseInterruptCoopExitRequest();
|
|
23015
|
-
while (reader.pos < end) {
|
|
23016
|
-
const tag = reader.uint32();
|
|
23017
|
-
switch (tag >>> 3) {
|
|
23018
|
-
case 1: {
|
|
23019
|
-
if (tag !== 8) {
|
|
23020
|
-
break;
|
|
23021
|
-
}
|
|
23022
|
-
message.action = reader.int32();
|
|
23023
|
-
continue;
|
|
23024
|
-
}
|
|
23025
|
-
case 2: {
|
|
23026
|
-
if (tag !== 18) {
|
|
23027
|
-
break;
|
|
23028
|
-
}
|
|
23029
|
-
message.targetOperator = reader.string();
|
|
23030
|
-
continue;
|
|
23031
|
-
}
|
|
23032
|
-
}
|
|
23033
|
-
if ((tag & 7) === 4 || tag === 0) {
|
|
23034
|
-
break;
|
|
23035
|
-
}
|
|
23036
|
-
reader.skip(tag & 7);
|
|
23037
|
-
}
|
|
23038
|
-
return message;
|
|
23039
|
-
},
|
|
23040
|
-
fromJSON(object) {
|
|
23041
|
-
return {
|
|
23042
|
-
action: isSet4(object.action) ? interruptCoopExitRequest_InterruptCoopExitActionFromJSON(object.action) : 0,
|
|
23043
|
-
targetOperator: isSet4(object.targetOperator) ? globalThis.String(object.targetOperator) : ""
|
|
23044
|
-
};
|
|
23045
|
-
},
|
|
23046
|
-
toJSON(message) {
|
|
23047
|
-
const obj = {};
|
|
23048
|
-
if (message.action !== 0) {
|
|
23049
|
-
obj.action = interruptCoopExitRequest_InterruptCoopExitActionToJSON(message.action);
|
|
23050
|
-
}
|
|
23051
|
-
if (message.targetOperator !== "") {
|
|
23052
|
-
obj.targetOperator = message.targetOperator;
|
|
23053
|
-
}
|
|
23054
|
-
return obj;
|
|
23055
|
-
},
|
|
23056
|
-
create(base) {
|
|
23057
|
-
return InterruptCoopExitRequest.fromPartial(base ?? {});
|
|
23058
|
-
},
|
|
23059
|
-
fromPartial(object) {
|
|
23060
|
-
const message = createBaseInterruptCoopExitRequest();
|
|
23061
|
-
message.action = object.action ?? 0;
|
|
23062
|
-
message.targetOperator = object.targetOperator ?? "";
|
|
23063
|
-
return message;
|
|
23064
|
-
}
|
|
23065
|
-
};
|
|
23066
|
-
var MockServiceDefinition = {
|
|
23067
|
-
name: "MockService",
|
|
23068
|
-
fullName: "mock.MockService",
|
|
23069
|
-
methods: {
|
|
23070
|
-
clean_up_preimage_share: {
|
|
23071
|
-
name: "clean_up_preimage_share",
|
|
23072
|
-
requestType: CleanUpPreimageShareRequest,
|
|
23073
|
-
requestStream: false,
|
|
23074
|
-
responseType: Empty,
|
|
23075
|
-
responseStream: false,
|
|
23076
|
-
options: {}
|
|
23077
|
-
},
|
|
23078
|
-
interrupt_transfer: {
|
|
23079
|
-
name: "interrupt_transfer",
|
|
23080
|
-
requestType: InterruptTransferRequest,
|
|
23081
|
-
requestStream: false,
|
|
23082
|
-
responseType: Empty,
|
|
23083
|
-
responseStream: false,
|
|
23084
|
-
options: {}
|
|
23085
|
-
},
|
|
23086
|
-
interrupt_coop_exit: {
|
|
23087
|
-
name: "interrupt_coop_exit",
|
|
23088
|
-
requestType: InterruptCoopExitRequest,
|
|
23089
|
-
requestStream: false,
|
|
23090
|
-
responseType: Empty,
|
|
23091
|
-
responseStream: false,
|
|
23092
|
-
options: {}
|
|
23093
|
-
},
|
|
23094
|
-
update_nodes_status: {
|
|
23095
|
-
name: "update_nodes_status",
|
|
23096
|
-
requestType: UpdateNodesStatusRequest,
|
|
23097
|
-
requestStream: false,
|
|
23098
|
-
responseType: Empty,
|
|
23099
|
-
responseStream: false,
|
|
23100
|
-
options: {}
|
|
23101
|
-
},
|
|
23102
|
-
/** Triggers the execution of a scheduled task immediately by name. Used by hermetic tests */
|
|
23103
|
-
trigger_task: {
|
|
23104
|
-
name: "trigger_task",
|
|
23105
|
-
requestType: TriggerTaskRequest,
|
|
23106
|
-
requestStream: false,
|
|
23107
|
-
responseType: Empty,
|
|
23108
|
-
responseStream: false,
|
|
23109
|
-
options: {}
|
|
23110
|
-
}
|
|
23111
|
-
}
|
|
23112
|
-
};
|
|
23113
|
-
function bytesFromBase643(b64) {
|
|
23114
|
-
if (globalThis.Buffer) {
|
|
23115
|
-
return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));
|
|
23116
|
-
} else {
|
|
23117
|
-
const bin = globalThis.atob(b64);
|
|
23118
|
-
const arr = new Uint8Array(bin.length);
|
|
23119
|
-
for (let i = 0; i < bin.length; ++i) {
|
|
23120
|
-
arr[i] = bin.charCodeAt(i);
|
|
23121
|
-
}
|
|
23122
|
-
return arr;
|
|
23123
|
-
}
|
|
23124
|
-
}
|
|
23125
|
-
function base64FromBytes3(arr) {
|
|
23126
|
-
if (globalThis.Buffer) {
|
|
23127
|
-
return globalThis.Buffer.from(arr).toString("base64");
|
|
23128
|
-
} else {
|
|
23129
|
-
const bin = [];
|
|
23130
|
-
arr.forEach((byte) => {
|
|
23131
|
-
bin.push(globalThis.String.fromCharCode(byte));
|
|
23132
|
-
});
|
|
23133
|
-
return globalThis.btoa(bin.join(""));
|
|
23134
|
-
}
|
|
23135
|
-
}
|
|
23136
|
-
function isSet4(value) {
|
|
23137
|
-
return value !== null && value !== void 0;
|
|
23138
|
-
}
|
|
23139
22535
|
|
|
23140
22536
|
// src/proto/spark_authn.ts
|
|
23141
22537
|
init_buffer();
|
|
23142
|
-
var
|
|
22538
|
+
var import_wire6 = require("@bufbuild/protobuf/wire");
|
|
23143
22539
|
function createBaseChallenge() {
|
|
23144
22540
|
return { version: 0, timestamp: 0, nonce: new Uint8Array(0), publicKey: new Uint8Array(0) };
|
|
23145
22541
|
}
|
|
23146
22542
|
var Challenge = {
|
|
23147
|
-
encode(message, writer = new
|
|
22543
|
+
encode(message, writer = new import_wire6.BinaryWriter()) {
|
|
23148
22544
|
if (message.version !== 0) {
|
|
23149
22545
|
writer.uint32(8).int32(message.version);
|
|
23150
22546
|
}
|
|
@@ -23160,7 +22556,7 @@ var Challenge = {
|
|
|
23160
22556
|
return writer;
|
|
23161
22557
|
},
|
|
23162
22558
|
decode(input, length) {
|
|
23163
|
-
const reader = input instanceof
|
|
22559
|
+
const reader = input instanceof import_wire6.BinaryReader ? input : new import_wire6.BinaryReader(input);
|
|
23164
22560
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
23165
22561
|
const message = createBaseChallenge();
|
|
23166
22562
|
while (reader.pos < end) {
|
|
@@ -23204,10 +22600,10 @@ var Challenge = {
|
|
|
23204
22600
|
},
|
|
23205
22601
|
fromJSON(object) {
|
|
23206
22602
|
return {
|
|
23207
|
-
version:
|
|
23208
|
-
timestamp:
|
|
23209
|
-
nonce:
|
|
23210
|
-
publicKey:
|
|
22603
|
+
version: isSet4(object.version) ? globalThis.Number(object.version) : 0,
|
|
22604
|
+
timestamp: isSet4(object.timestamp) ? globalThis.Number(object.timestamp) : 0,
|
|
22605
|
+
nonce: isSet4(object.nonce) ? bytesFromBase643(object.nonce) : new Uint8Array(0),
|
|
22606
|
+
publicKey: isSet4(object.publicKey) ? bytesFromBase643(object.publicKey) : new Uint8Array(0)
|
|
23211
22607
|
};
|
|
23212
22608
|
},
|
|
23213
22609
|
toJSON(message) {
|
|
@@ -23219,10 +22615,10 @@ var Challenge = {
|
|
|
23219
22615
|
obj.timestamp = Math.round(message.timestamp);
|
|
23220
22616
|
}
|
|
23221
22617
|
if (message.nonce.length !== 0) {
|
|
23222
|
-
obj.nonce =
|
|
22618
|
+
obj.nonce = base64FromBytes3(message.nonce);
|
|
23223
22619
|
}
|
|
23224
22620
|
if (message.publicKey.length !== 0) {
|
|
23225
|
-
obj.publicKey =
|
|
22621
|
+
obj.publicKey = base64FromBytes3(message.publicKey);
|
|
23226
22622
|
}
|
|
23227
22623
|
return obj;
|
|
23228
22624
|
},
|
|
@@ -23242,7 +22638,7 @@ function createBaseProtectedChallenge() {
|
|
|
23242
22638
|
return { version: 0, challenge: void 0, serverHmac: new Uint8Array(0) };
|
|
23243
22639
|
}
|
|
23244
22640
|
var ProtectedChallenge = {
|
|
23245
|
-
encode(message, writer = new
|
|
22641
|
+
encode(message, writer = new import_wire6.BinaryWriter()) {
|
|
23246
22642
|
if (message.version !== 0) {
|
|
23247
22643
|
writer.uint32(8).int32(message.version);
|
|
23248
22644
|
}
|
|
@@ -23255,7 +22651,7 @@ var ProtectedChallenge = {
|
|
|
23255
22651
|
return writer;
|
|
23256
22652
|
},
|
|
23257
22653
|
decode(input, length) {
|
|
23258
|
-
const reader = input instanceof
|
|
22654
|
+
const reader = input instanceof import_wire6.BinaryReader ? input : new import_wire6.BinaryReader(input);
|
|
23259
22655
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
23260
22656
|
const message = createBaseProtectedChallenge();
|
|
23261
22657
|
while (reader.pos < end) {
|
|
@@ -23292,9 +22688,9 @@ var ProtectedChallenge = {
|
|
|
23292
22688
|
},
|
|
23293
22689
|
fromJSON(object) {
|
|
23294
22690
|
return {
|
|
23295
|
-
version:
|
|
23296
|
-
challenge:
|
|
23297
|
-
serverHmac:
|
|
22691
|
+
version: isSet4(object.version) ? globalThis.Number(object.version) : 0,
|
|
22692
|
+
challenge: isSet4(object.challenge) ? Challenge.fromJSON(object.challenge) : void 0,
|
|
22693
|
+
serverHmac: isSet4(object.serverHmac) ? bytesFromBase643(object.serverHmac) : new Uint8Array(0)
|
|
23298
22694
|
};
|
|
23299
22695
|
},
|
|
23300
22696
|
toJSON(message) {
|
|
@@ -23306,7 +22702,7 @@ var ProtectedChallenge = {
|
|
|
23306
22702
|
obj.challenge = Challenge.toJSON(message.challenge);
|
|
23307
22703
|
}
|
|
23308
22704
|
if (message.serverHmac.length !== 0) {
|
|
23309
|
-
obj.serverHmac =
|
|
22705
|
+
obj.serverHmac = base64FromBytes3(message.serverHmac);
|
|
23310
22706
|
}
|
|
23311
22707
|
return obj;
|
|
23312
22708
|
},
|
|
@@ -23325,14 +22721,14 @@ function createBaseGetChallengeRequest() {
|
|
|
23325
22721
|
return { publicKey: new Uint8Array(0) };
|
|
23326
22722
|
}
|
|
23327
22723
|
var GetChallengeRequest = {
|
|
23328
|
-
encode(message, writer = new
|
|
22724
|
+
encode(message, writer = new import_wire6.BinaryWriter()) {
|
|
23329
22725
|
if (message.publicKey.length !== 0) {
|
|
23330
22726
|
writer.uint32(10).bytes(message.publicKey);
|
|
23331
22727
|
}
|
|
23332
22728
|
return writer;
|
|
23333
22729
|
},
|
|
23334
22730
|
decode(input, length) {
|
|
23335
|
-
const reader = input instanceof
|
|
22731
|
+
const reader = input instanceof import_wire6.BinaryReader ? input : new import_wire6.BinaryReader(input);
|
|
23336
22732
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
23337
22733
|
const message = createBaseGetChallengeRequest();
|
|
23338
22734
|
while (reader.pos < end) {
|
|
@@ -23354,12 +22750,12 @@ var GetChallengeRequest = {
|
|
|
23354
22750
|
return message;
|
|
23355
22751
|
},
|
|
23356
22752
|
fromJSON(object) {
|
|
23357
|
-
return { publicKey:
|
|
22753
|
+
return { publicKey: isSet4(object.publicKey) ? bytesFromBase643(object.publicKey) : new Uint8Array(0) };
|
|
23358
22754
|
},
|
|
23359
22755
|
toJSON(message) {
|
|
23360
22756
|
const obj = {};
|
|
23361
22757
|
if (message.publicKey.length !== 0) {
|
|
23362
|
-
obj.publicKey =
|
|
22758
|
+
obj.publicKey = base64FromBytes3(message.publicKey);
|
|
23363
22759
|
}
|
|
23364
22760
|
return obj;
|
|
23365
22761
|
},
|
|
@@ -23376,14 +22772,14 @@ function createBaseGetChallengeResponse() {
|
|
|
23376
22772
|
return { protectedChallenge: void 0 };
|
|
23377
22773
|
}
|
|
23378
22774
|
var GetChallengeResponse = {
|
|
23379
|
-
encode(message, writer = new
|
|
22775
|
+
encode(message, writer = new import_wire6.BinaryWriter()) {
|
|
23380
22776
|
if (message.protectedChallenge !== void 0) {
|
|
23381
22777
|
ProtectedChallenge.encode(message.protectedChallenge, writer.uint32(10).fork()).join();
|
|
23382
22778
|
}
|
|
23383
22779
|
return writer;
|
|
23384
22780
|
},
|
|
23385
22781
|
decode(input, length) {
|
|
23386
|
-
const reader = input instanceof
|
|
22782
|
+
const reader = input instanceof import_wire6.BinaryReader ? input : new import_wire6.BinaryReader(input);
|
|
23387
22783
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
23388
22784
|
const message = createBaseGetChallengeResponse();
|
|
23389
22785
|
while (reader.pos < end) {
|
|
@@ -23406,7 +22802,7 @@ var GetChallengeResponse = {
|
|
|
23406
22802
|
},
|
|
23407
22803
|
fromJSON(object) {
|
|
23408
22804
|
return {
|
|
23409
|
-
protectedChallenge:
|
|
22805
|
+
protectedChallenge: isSet4(object.protectedChallenge) ? ProtectedChallenge.fromJSON(object.protectedChallenge) : void 0
|
|
23410
22806
|
};
|
|
23411
22807
|
},
|
|
23412
22808
|
toJSON(message) {
|
|
@@ -23429,7 +22825,7 @@ function createBaseVerifyChallengeRequest() {
|
|
|
23429
22825
|
return { protectedChallenge: void 0, signature: new Uint8Array(0), publicKey: new Uint8Array(0) };
|
|
23430
22826
|
}
|
|
23431
22827
|
var VerifyChallengeRequest = {
|
|
23432
|
-
encode(message, writer = new
|
|
22828
|
+
encode(message, writer = new import_wire6.BinaryWriter()) {
|
|
23433
22829
|
if (message.protectedChallenge !== void 0) {
|
|
23434
22830
|
ProtectedChallenge.encode(message.protectedChallenge, writer.uint32(10).fork()).join();
|
|
23435
22831
|
}
|
|
@@ -23442,7 +22838,7 @@ var VerifyChallengeRequest = {
|
|
|
23442
22838
|
return writer;
|
|
23443
22839
|
},
|
|
23444
22840
|
decode(input, length) {
|
|
23445
|
-
const reader = input instanceof
|
|
22841
|
+
const reader = input instanceof import_wire6.BinaryReader ? input : new import_wire6.BinaryReader(input);
|
|
23446
22842
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
23447
22843
|
const message = createBaseVerifyChallengeRequest();
|
|
23448
22844
|
while (reader.pos < end) {
|
|
@@ -23479,9 +22875,9 @@ var VerifyChallengeRequest = {
|
|
|
23479
22875
|
},
|
|
23480
22876
|
fromJSON(object) {
|
|
23481
22877
|
return {
|
|
23482
|
-
protectedChallenge:
|
|
23483
|
-
signature:
|
|
23484
|
-
publicKey:
|
|
22878
|
+
protectedChallenge: isSet4(object.protectedChallenge) ? ProtectedChallenge.fromJSON(object.protectedChallenge) : void 0,
|
|
22879
|
+
signature: isSet4(object.signature) ? bytesFromBase643(object.signature) : new Uint8Array(0),
|
|
22880
|
+
publicKey: isSet4(object.publicKey) ? bytesFromBase643(object.publicKey) : new Uint8Array(0)
|
|
23485
22881
|
};
|
|
23486
22882
|
},
|
|
23487
22883
|
toJSON(message) {
|
|
@@ -23490,10 +22886,10 @@ var VerifyChallengeRequest = {
|
|
|
23490
22886
|
obj.protectedChallenge = ProtectedChallenge.toJSON(message.protectedChallenge);
|
|
23491
22887
|
}
|
|
23492
22888
|
if (message.signature.length !== 0) {
|
|
23493
|
-
obj.signature =
|
|
22889
|
+
obj.signature = base64FromBytes3(message.signature);
|
|
23494
22890
|
}
|
|
23495
22891
|
if (message.publicKey.length !== 0) {
|
|
23496
|
-
obj.publicKey =
|
|
22892
|
+
obj.publicKey = base64FromBytes3(message.publicKey);
|
|
23497
22893
|
}
|
|
23498
22894
|
return obj;
|
|
23499
22895
|
},
|
|
@@ -23512,7 +22908,7 @@ function createBaseVerifyChallengeResponse() {
|
|
|
23512
22908
|
return { sessionToken: "", expirationTimestamp: 0 };
|
|
23513
22909
|
}
|
|
23514
22910
|
var VerifyChallengeResponse = {
|
|
23515
|
-
encode(message, writer = new
|
|
22911
|
+
encode(message, writer = new import_wire6.BinaryWriter()) {
|
|
23516
22912
|
if (message.sessionToken !== "") {
|
|
23517
22913
|
writer.uint32(10).string(message.sessionToken);
|
|
23518
22914
|
}
|
|
@@ -23522,7 +22918,7 @@ var VerifyChallengeResponse = {
|
|
|
23522
22918
|
return writer;
|
|
23523
22919
|
},
|
|
23524
22920
|
decode(input, length) {
|
|
23525
|
-
const reader = input instanceof
|
|
22921
|
+
const reader = input instanceof import_wire6.BinaryReader ? input : new import_wire6.BinaryReader(input);
|
|
23526
22922
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
23527
22923
|
const message = createBaseVerifyChallengeResponse();
|
|
23528
22924
|
while (reader.pos < end) {
|
|
@@ -23552,8 +22948,8 @@ var VerifyChallengeResponse = {
|
|
|
23552
22948
|
},
|
|
23553
22949
|
fromJSON(object) {
|
|
23554
22950
|
return {
|
|
23555
|
-
sessionToken:
|
|
23556
|
-
expirationTimestamp:
|
|
22951
|
+
sessionToken: isSet4(object.sessionToken) ? globalThis.String(object.sessionToken) : "",
|
|
22952
|
+
expirationTimestamp: isSet4(object.expirationTimestamp) ? globalThis.Number(object.expirationTimestamp) : 0
|
|
23557
22953
|
};
|
|
23558
22954
|
},
|
|
23559
22955
|
toJSON(message) {
|
|
@@ -23600,7 +22996,7 @@ var SparkAuthnServiceDefinition = {
|
|
|
23600
22996
|
}
|
|
23601
22997
|
}
|
|
23602
22998
|
};
|
|
23603
|
-
function
|
|
22999
|
+
function bytesFromBase643(b64) {
|
|
23604
23000
|
if (globalThis.Buffer) {
|
|
23605
23001
|
return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));
|
|
23606
23002
|
} else {
|
|
@@ -23612,7 +23008,7 @@ function bytesFromBase644(b64) {
|
|
|
23612
23008
|
return arr;
|
|
23613
23009
|
}
|
|
23614
23010
|
}
|
|
23615
|
-
function
|
|
23011
|
+
function base64FromBytes3(arr) {
|
|
23616
23012
|
if (globalThis.Buffer) {
|
|
23617
23013
|
return globalThis.Buffer.from(arr).toString("base64");
|
|
23618
23014
|
} else {
|
|
@@ -23633,13 +23029,13 @@ function longToNumber3(int64) {
|
|
|
23633
23029
|
}
|
|
23634
23030
|
return num;
|
|
23635
23031
|
}
|
|
23636
|
-
function
|
|
23032
|
+
function isSet4(value) {
|
|
23637
23033
|
return value !== null && value !== void 0;
|
|
23638
23034
|
}
|
|
23639
23035
|
|
|
23640
23036
|
// src/proto/spark_token.ts
|
|
23641
23037
|
init_buffer();
|
|
23642
|
-
var
|
|
23038
|
+
var import_wire7 = require("@bufbuild/protobuf/wire");
|
|
23643
23039
|
function commitStatusFromJSON(object) {
|
|
23644
23040
|
switch (object) {
|
|
23645
23041
|
case 0:
|
|
@@ -23724,7 +23120,7 @@ function createBaseTokenOutputToSpend2() {
|
|
|
23724
23120
|
return { prevTokenTransactionHash: new Uint8Array(0), prevTokenTransactionVout: 0 };
|
|
23725
23121
|
}
|
|
23726
23122
|
var TokenOutputToSpend2 = {
|
|
23727
|
-
encode(message, writer = new
|
|
23123
|
+
encode(message, writer = new import_wire7.BinaryWriter()) {
|
|
23728
23124
|
if (message.prevTokenTransactionHash.length !== 0) {
|
|
23729
23125
|
writer.uint32(10).bytes(message.prevTokenTransactionHash);
|
|
23730
23126
|
}
|
|
@@ -23734,7 +23130,7 @@ var TokenOutputToSpend2 = {
|
|
|
23734
23130
|
return writer;
|
|
23735
23131
|
},
|
|
23736
23132
|
decode(input, length) {
|
|
23737
|
-
const reader = input instanceof
|
|
23133
|
+
const reader = input instanceof import_wire7.BinaryReader ? input : new import_wire7.BinaryReader(input);
|
|
23738
23134
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
23739
23135
|
const message = createBaseTokenOutputToSpend2();
|
|
23740
23136
|
while (reader.pos < end) {
|
|
@@ -23764,14 +23160,14 @@ var TokenOutputToSpend2 = {
|
|
|
23764
23160
|
},
|
|
23765
23161
|
fromJSON(object) {
|
|
23766
23162
|
return {
|
|
23767
|
-
prevTokenTransactionHash:
|
|
23768
|
-
prevTokenTransactionVout:
|
|
23163
|
+
prevTokenTransactionHash: isSet5(object.prevTokenTransactionHash) ? bytesFromBase644(object.prevTokenTransactionHash) : new Uint8Array(0),
|
|
23164
|
+
prevTokenTransactionVout: isSet5(object.prevTokenTransactionVout) ? globalThis.Number(object.prevTokenTransactionVout) : 0
|
|
23769
23165
|
};
|
|
23770
23166
|
},
|
|
23771
23167
|
toJSON(message) {
|
|
23772
23168
|
const obj = {};
|
|
23773
23169
|
if (message.prevTokenTransactionHash.length !== 0) {
|
|
23774
|
-
obj.prevTokenTransactionHash =
|
|
23170
|
+
obj.prevTokenTransactionHash = base64FromBytes4(message.prevTokenTransactionHash);
|
|
23775
23171
|
}
|
|
23776
23172
|
if (message.prevTokenTransactionVout !== 0) {
|
|
23777
23173
|
obj.prevTokenTransactionVout = Math.round(message.prevTokenTransactionVout);
|
|
@@ -23792,14 +23188,14 @@ function createBaseTokenTransferInput2() {
|
|
|
23792
23188
|
return { outputsToSpend: [] };
|
|
23793
23189
|
}
|
|
23794
23190
|
var TokenTransferInput2 = {
|
|
23795
|
-
encode(message, writer = new
|
|
23191
|
+
encode(message, writer = new import_wire7.BinaryWriter()) {
|
|
23796
23192
|
for (const v of message.outputsToSpend) {
|
|
23797
23193
|
TokenOutputToSpend2.encode(v, writer.uint32(10).fork()).join();
|
|
23798
23194
|
}
|
|
23799
23195
|
return writer;
|
|
23800
23196
|
},
|
|
23801
23197
|
decode(input, length) {
|
|
23802
|
-
const reader = input instanceof
|
|
23198
|
+
const reader = input instanceof import_wire7.BinaryReader ? input : new import_wire7.BinaryReader(input);
|
|
23803
23199
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
23804
23200
|
const message = createBaseTokenTransferInput2();
|
|
23805
23201
|
while (reader.pos < end) {
|
|
@@ -23845,7 +23241,7 @@ function createBaseTokenMintInput2() {
|
|
|
23845
23241
|
return { issuerPublicKey: new Uint8Array(0), tokenIdentifier: void 0 };
|
|
23846
23242
|
}
|
|
23847
23243
|
var TokenMintInput2 = {
|
|
23848
|
-
encode(message, writer = new
|
|
23244
|
+
encode(message, writer = new import_wire7.BinaryWriter()) {
|
|
23849
23245
|
if (message.issuerPublicKey.length !== 0) {
|
|
23850
23246
|
writer.uint32(10).bytes(message.issuerPublicKey);
|
|
23851
23247
|
}
|
|
@@ -23855,7 +23251,7 @@ var TokenMintInput2 = {
|
|
|
23855
23251
|
return writer;
|
|
23856
23252
|
},
|
|
23857
23253
|
decode(input, length) {
|
|
23858
|
-
const reader = input instanceof
|
|
23254
|
+
const reader = input instanceof import_wire7.BinaryReader ? input : new import_wire7.BinaryReader(input);
|
|
23859
23255
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
23860
23256
|
const message = createBaseTokenMintInput2();
|
|
23861
23257
|
while (reader.pos < end) {
|
|
@@ -23885,17 +23281,17 @@ var TokenMintInput2 = {
|
|
|
23885
23281
|
},
|
|
23886
23282
|
fromJSON(object) {
|
|
23887
23283
|
return {
|
|
23888
|
-
issuerPublicKey:
|
|
23889
|
-
tokenIdentifier:
|
|
23284
|
+
issuerPublicKey: isSet5(object.issuerPublicKey) ? bytesFromBase644(object.issuerPublicKey) : new Uint8Array(0),
|
|
23285
|
+
tokenIdentifier: isSet5(object.tokenIdentifier) ? bytesFromBase644(object.tokenIdentifier) : void 0
|
|
23890
23286
|
};
|
|
23891
23287
|
},
|
|
23892
23288
|
toJSON(message) {
|
|
23893
23289
|
const obj = {};
|
|
23894
23290
|
if (message.issuerPublicKey.length !== 0) {
|
|
23895
|
-
obj.issuerPublicKey =
|
|
23291
|
+
obj.issuerPublicKey = base64FromBytes4(message.issuerPublicKey);
|
|
23896
23292
|
}
|
|
23897
23293
|
if (message.tokenIdentifier !== void 0) {
|
|
23898
|
-
obj.tokenIdentifier =
|
|
23294
|
+
obj.tokenIdentifier = base64FromBytes4(message.tokenIdentifier);
|
|
23899
23295
|
}
|
|
23900
23296
|
return obj;
|
|
23901
23297
|
},
|
|
@@ -23921,7 +23317,7 @@ function createBaseTokenCreateInput2() {
|
|
|
23921
23317
|
};
|
|
23922
23318
|
}
|
|
23923
23319
|
var TokenCreateInput2 = {
|
|
23924
|
-
encode(message, writer = new
|
|
23320
|
+
encode(message, writer = new import_wire7.BinaryWriter()) {
|
|
23925
23321
|
if (message.issuerPublicKey.length !== 0) {
|
|
23926
23322
|
writer.uint32(10).bytes(message.issuerPublicKey);
|
|
23927
23323
|
}
|
|
@@ -23946,7 +23342,7 @@ var TokenCreateInput2 = {
|
|
|
23946
23342
|
return writer;
|
|
23947
23343
|
},
|
|
23948
23344
|
decode(input, length) {
|
|
23949
|
-
const reader = input instanceof
|
|
23345
|
+
const reader = input instanceof import_wire7.BinaryReader ? input : new import_wire7.BinaryReader(input);
|
|
23950
23346
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
23951
23347
|
const message = createBaseTokenCreateInput2();
|
|
23952
23348
|
while (reader.pos < end) {
|
|
@@ -24011,19 +23407,19 @@ var TokenCreateInput2 = {
|
|
|
24011
23407
|
},
|
|
24012
23408
|
fromJSON(object) {
|
|
24013
23409
|
return {
|
|
24014
|
-
issuerPublicKey:
|
|
24015
|
-
tokenName:
|
|
24016
|
-
tokenTicker:
|
|
24017
|
-
decimals:
|
|
24018
|
-
maxSupply:
|
|
24019
|
-
isFreezable:
|
|
24020
|
-
creationEntityPublicKey:
|
|
23410
|
+
issuerPublicKey: isSet5(object.issuerPublicKey) ? bytesFromBase644(object.issuerPublicKey) : new Uint8Array(0),
|
|
23411
|
+
tokenName: isSet5(object.tokenName) ? globalThis.String(object.tokenName) : "",
|
|
23412
|
+
tokenTicker: isSet5(object.tokenTicker) ? globalThis.String(object.tokenTicker) : "",
|
|
23413
|
+
decimals: isSet5(object.decimals) ? globalThis.Number(object.decimals) : 0,
|
|
23414
|
+
maxSupply: isSet5(object.maxSupply) ? bytesFromBase644(object.maxSupply) : new Uint8Array(0),
|
|
23415
|
+
isFreezable: isSet5(object.isFreezable) ? globalThis.Boolean(object.isFreezable) : false,
|
|
23416
|
+
creationEntityPublicKey: isSet5(object.creationEntityPublicKey) ? bytesFromBase644(object.creationEntityPublicKey) : void 0
|
|
24021
23417
|
};
|
|
24022
23418
|
},
|
|
24023
23419
|
toJSON(message) {
|
|
24024
23420
|
const obj = {};
|
|
24025
23421
|
if (message.issuerPublicKey.length !== 0) {
|
|
24026
|
-
obj.issuerPublicKey =
|
|
23422
|
+
obj.issuerPublicKey = base64FromBytes4(message.issuerPublicKey);
|
|
24027
23423
|
}
|
|
24028
23424
|
if (message.tokenName !== "") {
|
|
24029
23425
|
obj.tokenName = message.tokenName;
|
|
@@ -24035,13 +23431,13 @@ var TokenCreateInput2 = {
|
|
|
24035
23431
|
obj.decimals = Math.round(message.decimals);
|
|
24036
23432
|
}
|
|
24037
23433
|
if (message.maxSupply.length !== 0) {
|
|
24038
|
-
obj.maxSupply =
|
|
23434
|
+
obj.maxSupply = base64FromBytes4(message.maxSupply);
|
|
24039
23435
|
}
|
|
24040
23436
|
if (message.isFreezable !== false) {
|
|
24041
23437
|
obj.isFreezable = message.isFreezable;
|
|
24042
23438
|
}
|
|
24043
23439
|
if (message.creationEntityPublicKey !== void 0) {
|
|
24044
|
-
obj.creationEntityPublicKey =
|
|
23440
|
+
obj.creationEntityPublicKey = base64FromBytes4(message.creationEntityPublicKey);
|
|
24045
23441
|
}
|
|
24046
23442
|
return obj;
|
|
24047
23443
|
},
|
|
@@ -24073,7 +23469,7 @@ function createBaseTokenOutput2() {
|
|
|
24073
23469
|
};
|
|
24074
23470
|
}
|
|
24075
23471
|
var TokenOutput2 = {
|
|
24076
|
-
encode(message, writer = new
|
|
23472
|
+
encode(message, writer = new import_wire7.BinaryWriter()) {
|
|
24077
23473
|
if (message.id !== void 0) {
|
|
24078
23474
|
writer.uint32(10).string(message.id);
|
|
24079
23475
|
}
|
|
@@ -24101,7 +23497,7 @@ var TokenOutput2 = {
|
|
|
24101
23497
|
return writer;
|
|
24102
23498
|
},
|
|
24103
23499
|
decode(input, length) {
|
|
24104
|
-
const reader = input instanceof
|
|
23500
|
+
const reader = input instanceof import_wire7.BinaryReader ? input : new import_wire7.BinaryReader(input);
|
|
24105
23501
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
24106
23502
|
const message = createBaseTokenOutput2();
|
|
24107
23503
|
while (reader.pos < end) {
|
|
@@ -24173,14 +23569,14 @@ var TokenOutput2 = {
|
|
|
24173
23569
|
},
|
|
24174
23570
|
fromJSON(object) {
|
|
24175
23571
|
return {
|
|
24176
|
-
id:
|
|
24177
|
-
ownerPublicKey:
|
|
24178
|
-
revocationCommitment:
|
|
24179
|
-
withdrawBondSats:
|
|
24180
|
-
withdrawRelativeBlockLocktime:
|
|
24181
|
-
tokenPublicKey:
|
|
24182
|
-
tokenIdentifier:
|
|
24183
|
-
tokenAmount:
|
|
23572
|
+
id: isSet5(object.id) ? globalThis.String(object.id) : void 0,
|
|
23573
|
+
ownerPublicKey: isSet5(object.ownerPublicKey) ? bytesFromBase644(object.ownerPublicKey) : new Uint8Array(0),
|
|
23574
|
+
revocationCommitment: isSet5(object.revocationCommitment) ? bytesFromBase644(object.revocationCommitment) : void 0,
|
|
23575
|
+
withdrawBondSats: isSet5(object.withdrawBondSats) ? globalThis.Number(object.withdrawBondSats) : void 0,
|
|
23576
|
+
withdrawRelativeBlockLocktime: isSet5(object.withdrawRelativeBlockLocktime) ? globalThis.Number(object.withdrawRelativeBlockLocktime) : void 0,
|
|
23577
|
+
tokenPublicKey: isSet5(object.tokenPublicKey) ? bytesFromBase644(object.tokenPublicKey) : void 0,
|
|
23578
|
+
tokenIdentifier: isSet5(object.tokenIdentifier) ? bytesFromBase644(object.tokenIdentifier) : void 0,
|
|
23579
|
+
tokenAmount: isSet5(object.tokenAmount) ? bytesFromBase644(object.tokenAmount) : new Uint8Array(0)
|
|
24184
23580
|
};
|
|
24185
23581
|
},
|
|
24186
23582
|
toJSON(message) {
|
|
@@ -24189,10 +23585,10 @@ var TokenOutput2 = {
|
|
|
24189
23585
|
obj.id = message.id;
|
|
24190
23586
|
}
|
|
24191
23587
|
if (message.ownerPublicKey.length !== 0) {
|
|
24192
|
-
obj.ownerPublicKey =
|
|
23588
|
+
obj.ownerPublicKey = base64FromBytes4(message.ownerPublicKey);
|
|
24193
23589
|
}
|
|
24194
23590
|
if (message.revocationCommitment !== void 0) {
|
|
24195
|
-
obj.revocationCommitment =
|
|
23591
|
+
obj.revocationCommitment = base64FromBytes4(message.revocationCommitment);
|
|
24196
23592
|
}
|
|
24197
23593
|
if (message.withdrawBondSats !== void 0) {
|
|
24198
23594
|
obj.withdrawBondSats = Math.round(message.withdrawBondSats);
|
|
@@ -24201,13 +23597,13 @@ var TokenOutput2 = {
|
|
|
24201
23597
|
obj.withdrawRelativeBlockLocktime = Math.round(message.withdrawRelativeBlockLocktime);
|
|
24202
23598
|
}
|
|
24203
23599
|
if (message.tokenPublicKey !== void 0) {
|
|
24204
|
-
obj.tokenPublicKey =
|
|
23600
|
+
obj.tokenPublicKey = base64FromBytes4(message.tokenPublicKey);
|
|
24205
23601
|
}
|
|
24206
23602
|
if (message.tokenIdentifier !== void 0) {
|
|
24207
|
-
obj.tokenIdentifier =
|
|
23603
|
+
obj.tokenIdentifier = base64FromBytes4(message.tokenIdentifier);
|
|
24208
23604
|
}
|
|
24209
23605
|
if (message.tokenAmount.length !== 0) {
|
|
24210
|
-
obj.tokenAmount =
|
|
23606
|
+
obj.tokenAmount = base64FromBytes4(message.tokenAmount);
|
|
24211
23607
|
}
|
|
24212
23608
|
return obj;
|
|
24213
23609
|
},
|
|
@@ -24240,7 +23636,7 @@ function createBaseTokenTransaction2() {
|
|
|
24240
23636
|
};
|
|
24241
23637
|
}
|
|
24242
23638
|
var TokenTransaction2 = {
|
|
24243
|
-
encode(message, writer = new
|
|
23639
|
+
encode(message, writer = new import_wire7.BinaryWriter()) {
|
|
24244
23640
|
if (message.version !== 0) {
|
|
24245
23641
|
writer.uint32(8).uint32(message.version);
|
|
24246
23642
|
}
|
|
@@ -24276,7 +23672,7 @@ var TokenTransaction2 = {
|
|
|
24276
23672
|
return writer;
|
|
24277
23673
|
},
|
|
24278
23674
|
decode(input, length) {
|
|
24279
|
-
const reader = input instanceof
|
|
23675
|
+
const reader = input instanceof import_wire7.BinaryReader ? input : new import_wire7.BinaryReader(input);
|
|
24280
23676
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
24281
23677
|
const message = createBaseTokenTransaction2();
|
|
24282
23678
|
while (reader.pos < end) {
|
|
@@ -24365,13 +23761,13 @@ var TokenTransaction2 = {
|
|
|
24365
23761
|
},
|
|
24366
23762
|
fromJSON(object) {
|
|
24367
23763
|
return {
|
|
24368
|
-
version:
|
|
24369
|
-
tokenInputs:
|
|
23764
|
+
version: isSet5(object.version) ? globalThis.Number(object.version) : 0,
|
|
23765
|
+
tokenInputs: isSet5(object.mintInput) ? { $case: "mintInput", mintInput: TokenMintInput2.fromJSON(object.mintInput) } : isSet5(object.transferInput) ? { $case: "transferInput", transferInput: TokenTransferInput2.fromJSON(object.transferInput) } : isSet5(object.createInput) ? { $case: "createInput", createInput: TokenCreateInput2.fromJSON(object.createInput) } : void 0,
|
|
24370
23766
|
tokenOutputs: globalThis.Array.isArray(object?.tokenOutputs) ? object.tokenOutputs.map((e) => TokenOutput2.fromJSON(e)) : [],
|
|
24371
|
-
sparkOperatorIdentityPublicKeys: globalThis.Array.isArray(object?.sparkOperatorIdentityPublicKeys) ? object.sparkOperatorIdentityPublicKeys.map((e) =>
|
|
24372
|
-
expiryTime:
|
|
24373
|
-
network:
|
|
24374
|
-
clientCreatedTimestamp:
|
|
23767
|
+
sparkOperatorIdentityPublicKeys: globalThis.Array.isArray(object?.sparkOperatorIdentityPublicKeys) ? object.sparkOperatorIdentityPublicKeys.map((e) => bytesFromBase644(e)) : [],
|
|
23768
|
+
expiryTime: isSet5(object.expiryTime) ? fromJsonTimestamp2(object.expiryTime) : void 0,
|
|
23769
|
+
network: isSet5(object.network) ? networkFromJSON(object.network) : 0,
|
|
23770
|
+
clientCreatedTimestamp: isSet5(object.clientCreatedTimestamp) ? fromJsonTimestamp2(object.clientCreatedTimestamp) : void 0,
|
|
24375
23771
|
invoiceAttachments: globalThis.Array.isArray(object?.invoiceAttachments) ? object.invoiceAttachments.map((e) => InvoiceAttachment.fromJSON(e)) : []
|
|
24376
23772
|
};
|
|
24377
23773
|
},
|
|
@@ -24391,7 +23787,7 @@ var TokenTransaction2 = {
|
|
|
24391
23787
|
obj.tokenOutputs = message.tokenOutputs.map((e) => TokenOutput2.toJSON(e));
|
|
24392
23788
|
}
|
|
24393
23789
|
if (message.sparkOperatorIdentityPublicKeys?.length) {
|
|
24394
|
-
obj.sparkOperatorIdentityPublicKeys = message.sparkOperatorIdentityPublicKeys.map((e) =>
|
|
23790
|
+
obj.sparkOperatorIdentityPublicKeys = message.sparkOperatorIdentityPublicKeys.map((e) => base64FromBytes4(e));
|
|
24395
23791
|
}
|
|
24396
23792
|
if (message.expiryTime !== void 0) {
|
|
24397
23793
|
obj.expiryTime = message.expiryTime.toISOString();
|
|
@@ -24455,14 +23851,14 @@ function createBaseInvoiceAttachment() {
|
|
|
24455
23851
|
return { sparkInvoice: "" };
|
|
24456
23852
|
}
|
|
24457
23853
|
var InvoiceAttachment = {
|
|
24458
|
-
encode(message, writer = new
|
|
23854
|
+
encode(message, writer = new import_wire7.BinaryWriter()) {
|
|
24459
23855
|
if (message.sparkInvoice !== "") {
|
|
24460
23856
|
writer.uint32(10).string(message.sparkInvoice);
|
|
24461
23857
|
}
|
|
24462
23858
|
return writer;
|
|
24463
23859
|
},
|
|
24464
23860
|
decode(input, length) {
|
|
24465
|
-
const reader = input instanceof
|
|
23861
|
+
const reader = input instanceof import_wire7.BinaryReader ? input : new import_wire7.BinaryReader(input);
|
|
24466
23862
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
24467
23863
|
const message = createBaseInvoiceAttachment();
|
|
24468
23864
|
while (reader.pos < end) {
|
|
@@ -24484,7 +23880,7 @@ var InvoiceAttachment = {
|
|
|
24484
23880
|
return message;
|
|
24485
23881
|
},
|
|
24486
23882
|
fromJSON(object) {
|
|
24487
|
-
return { sparkInvoice:
|
|
23883
|
+
return { sparkInvoice: isSet5(object.sparkInvoice) ? globalThis.String(object.sparkInvoice) : "" };
|
|
24488
23884
|
},
|
|
24489
23885
|
toJSON(message) {
|
|
24490
23886
|
const obj = {};
|
|
@@ -24506,7 +23902,7 @@ function createBaseSignatureWithIndex2() {
|
|
|
24506
23902
|
return { signature: new Uint8Array(0), inputIndex: 0 };
|
|
24507
23903
|
}
|
|
24508
23904
|
var SignatureWithIndex2 = {
|
|
24509
|
-
encode(message, writer = new
|
|
23905
|
+
encode(message, writer = new import_wire7.BinaryWriter()) {
|
|
24510
23906
|
if (message.signature.length !== 0) {
|
|
24511
23907
|
writer.uint32(10).bytes(message.signature);
|
|
24512
23908
|
}
|
|
@@ -24516,7 +23912,7 @@ var SignatureWithIndex2 = {
|
|
|
24516
23912
|
return writer;
|
|
24517
23913
|
},
|
|
24518
23914
|
decode(input, length) {
|
|
24519
|
-
const reader = input instanceof
|
|
23915
|
+
const reader = input instanceof import_wire7.BinaryReader ? input : new import_wire7.BinaryReader(input);
|
|
24520
23916
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
24521
23917
|
const message = createBaseSignatureWithIndex2();
|
|
24522
23918
|
while (reader.pos < end) {
|
|
@@ -24546,14 +23942,14 @@ var SignatureWithIndex2 = {
|
|
|
24546
23942
|
},
|
|
24547
23943
|
fromJSON(object) {
|
|
24548
23944
|
return {
|
|
24549
|
-
signature:
|
|
24550
|
-
inputIndex:
|
|
23945
|
+
signature: isSet5(object.signature) ? bytesFromBase644(object.signature) : new Uint8Array(0),
|
|
23946
|
+
inputIndex: isSet5(object.inputIndex) ? globalThis.Number(object.inputIndex) : 0
|
|
24551
23947
|
};
|
|
24552
23948
|
},
|
|
24553
23949
|
toJSON(message) {
|
|
24554
23950
|
const obj = {};
|
|
24555
23951
|
if (message.signature.length !== 0) {
|
|
24556
|
-
obj.signature =
|
|
23952
|
+
obj.signature = base64FromBytes4(message.signature);
|
|
24557
23953
|
}
|
|
24558
23954
|
if (message.inputIndex !== 0) {
|
|
24559
23955
|
obj.inputIndex = Math.round(message.inputIndex);
|
|
@@ -24574,7 +23970,7 @@ function createBaseInputTtxoSignaturesPerOperator() {
|
|
|
24574
23970
|
return { ttxoSignatures: [], operatorIdentityPublicKey: new Uint8Array(0) };
|
|
24575
23971
|
}
|
|
24576
23972
|
var InputTtxoSignaturesPerOperator = {
|
|
24577
|
-
encode(message, writer = new
|
|
23973
|
+
encode(message, writer = new import_wire7.BinaryWriter()) {
|
|
24578
23974
|
for (const v of message.ttxoSignatures) {
|
|
24579
23975
|
SignatureWithIndex2.encode(v, writer.uint32(10).fork()).join();
|
|
24580
23976
|
}
|
|
@@ -24584,7 +23980,7 @@ var InputTtxoSignaturesPerOperator = {
|
|
|
24584
23980
|
return writer;
|
|
24585
23981
|
},
|
|
24586
23982
|
decode(input, length) {
|
|
24587
|
-
const reader = input instanceof
|
|
23983
|
+
const reader = input instanceof import_wire7.BinaryReader ? input : new import_wire7.BinaryReader(input);
|
|
24588
23984
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
24589
23985
|
const message = createBaseInputTtxoSignaturesPerOperator();
|
|
24590
23986
|
while (reader.pos < end) {
|
|
@@ -24615,7 +24011,7 @@ var InputTtxoSignaturesPerOperator = {
|
|
|
24615
24011
|
fromJSON(object) {
|
|
24616
24012
|
return {
|
|
24617
24013
|
ttxoSignatures: globalThis.Array.isArray(object?.ttxoSignatures) ? object.ttxoSignatures.map((e) => SignatureWithIndex2.fromJSON(e)) : [],
|
|
24618
|
-
operatorIdentityPublicKey:
|
|
24014
|
+
operatorIdentityPublicKey: isSet5(object.operatorIdentityPublicKey) ? bytesFromBase644(object.operatorIdentityPublicKey) : new Uint8Array(0)
|
|
24619
24015
|
};
|
|
24620
24016
|
},
|
|
24621
24017
|
toJSON(message) {
|
|
@@ -24624,7 +24020,7 @@ var InputTtxoSignaturesPerOperator = {
|
|
|
24624
24020
|
obj.ttxoSignatures = message.ttxoSignatures.map((e) => SignatureWithIndex2.toJSON(e));
|
|
24625
24021
|
}
|
|
24626
24022
|
if (message.operatorIdentityPublicKey.length !== 0) {
|
|
24627
|
-
obj.operatorIdentityPublicKey =
|
|
24023
|
+
obj.operatorIdentityPublicKey = base64FromBytes4(message.operatorIdentityPublicKey);
|
|
24628
24024
|
}
|
|
24629
24025
|
return obj;
|
|
24630
24026
|
},
|
|
@@ -24647,7 +24043,7 @@ function createBaseStartTransactionRequest() {
|
|
|
24647
24043
|
};
|
|
24648
24044
|
}
|
|
24649
24045
|
var StartTransactionRequest = {
|
|
24650
|
-
encode(message, writer = new
|
|
24046
|
+
encode(message, writer = new import_wire7.BinaryWriter()) {
|
|
24651
24047
|
if (message.identityPublicKey.length !== 0) {
|
|
24652
24048
|
writer.uint32(10).bytes(message.identityPublicKey);
|
|
24653
24049
|
}
|
|
@@ -24663,7 +24059,7 @@ var StartTransactionRequest = {
|
|
|
24663
24059
|
return writer;
|
|
24664
24060
|
},
|
|
24665
24061
|
decode(input, length) {
|
|
24666
|
-
const reader = input instanceof
|
|
24062
|
+
const reader = input instanceof import_wire7.BinaryReader ? input : new import_wire7.BinaryReader(input);
|
|
24667
24063
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
24668
24064
|
const message = createBaseStartTransactionRequest();
|
|
24669
24065
|
while (reader.pos < end) {
|
|
@@ -24707,16 +24103,16 @@ var StartTransactionRequest = {
|
|
|
24707
24103
|
},
|
|
24708
24104
|
fromJSON(object) {
|
|
24709
24105
|
return {
|
|
24710
|
-
identityPublicKey:
|
|
24711
|
-
partialTokenTransaction:
|
|
24106
|
+
identityPublicKey: isSet5(object.identityPublicKey) ? bytesFromBase644(object.identityPublicKey) : new Uint8Array(0),
|
|
24107
|
+
partialTokenTransaction: isSet5(object.partialTokenTransaction) ? TokenTransaction2.fromJSON(object.partialTokenTransaction) : void 0,
|
|
24712
24108
|
partialTokenTransactionOwnerSignatures: globalThis.Array.isArray(object?.partialTokenTransactionOwnerSignatures) ? object.partialTokenTransactionOwnerSignatures.map((e) => SignatureWithIndex2.fromJSON(e)) : [],
|
|
24713
|
-
validityDurationSeconds:
|
|
24109
|
+
validityDurationSeconds: isSet5(object.validityDurationSeconds) ? globalThis.Number(object.validityDurationSeconds) : 0
|
|
24714
24110
|
};
|
|
24715
24111
|
},
|
|
24716
24112
|
toJSON(message) {
|
|
24717
24113
|
const obj = {};
|
|
24718
24114
|
if (message.identityPublicKey.length !== 0) {
|
|
24719
|
-
obj.identityPublicKey =
|
|
24115
|
+
obj.identityPublicKey = base64FromBytes4(message.identityPublicKey);
|
|
24720
24116
|
}
|
|
24721
24117
|
if (message.partialTokenTransaction !== void 0) {
|
|
24722
24118
|
obj.partialTokenTransaction = TokenTransaction2.toJSON(message.partialTokenTransaction);
|
|
@@ -24747,7 +24143,7 @@ function createBaseStartTransactionResponse() {
|
|
|
24747
24143
|
return { finalTokenTransaction: void 0, keyshareInfo: void 0 };
|
|
24748
24144
|
}
|
|
24749
24145
|
var StartTransactionResponse = {
|
|
24750
|
-
encode(message, writer = new
|
|
24146
|
+
encode(message, writer = new import_wire7.BinaryWriter()) {
|
|
24751
24147
|
if (message.finalTokenTransaction !== void 0) {
|
|
24752
24148
|
TokenTransaction2.encode(message.finalTokenTransaction, writer.uint32(10).fork()).join();
|
|
24753
24149
|
}
|
|
@@ -24757,7 +24153,7 @@ var StartTransactionResponse = {
|
|
|
24757
24153
|
return writer;
|
|
24758
24154
|
},
|
|
24759
24155
|
decode(input, length) {
|
|
24760
|
-
const reader = input instanceof
|
|
24156
|
+
const reader = input instanceof import_wire7.BinaryReader ? input : new import_wire7.BinaryReader(input);
|
|
24761
24157
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
24762
24158
|
const message = createBaseStartTransactionResponse();
|
|
24763
24159
|
while (reader.pos < end) {
|
|
@@ -24787,8 +24183,8 @@ var StartTransactionResponse = {
|
|
|
24787
24183
|
},
|
|
24788
24184
|
fromJSON(object) {
|
|
24789
24185
|
return {
|
|
24790
|
-
finalTokenTransaction:
|
|
24791
|
-
keyshareInfo:
|
|
24186
|
+
finalTokenTransaction: isSet5(object.finalTokenTransaction) ? TokenTransaction2.fromJSON(object.finalTokenTransaction) : void 0,
|
|
24187
|
+
keyshareInfo: isSet5(object.keyshareInfo) ? SigningKeyshare.fromJSON(object.keyshareInfo) : void 0
|
|
24792
24188
|
};
|
|
24793
24189
|
},
|
|
24794
24190
|
toJSON(message) {
|
|
@@ -24820,7 +24216,7 @@ function createBaseCommitTransactionRequest() {
|
|
|
24820
24216
|
};
|
|
24821
24217
|
}
|
|
24822
24218
|
var CommitTransactionRequest = {
|
|
24823
|
-
encode(message, writer = new
|
|
24219
|
+
encode(message, writer = new import_wire7.BinaryWriter()) {
|
|
24824
24220
|
if (message.finalTokenTransaction !== void 0) {
|
|
24825
24221
|
TokenTransaction2.encode(message.finalTokenTransaction, writer.uint32(10).fork()).join();
|
|
24826
24222
|
}
|
|
@@ -24836,7 +24232,7 @@ var CommitTransactionRequest = {
|
|
|
24836
24232
|
return writer;
|
|
24837
24233
|
},
|
|
24838
24234
|
decode(input, length) {
|
|
24839
|
-
const reader = input instanceof
|
|
24235
|
+
const reader = input instanceof import_wire7.BinaryReader ? input : new import_wire7.BinaryReader(input);
|
|
24840
24236
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
24841
24237
|
const message = createBaseCommitTransactionRequest();
|
|
24842
24238
|
while (reader.pos < end) {
|
|
@@ -24880,10 +24276,10 @@ var CommitTransactionRequest = {
|
|
|
24880
24276
|
},
|
|
24881
24277
|
fromJSON(object) {
|
|
24882
24278
|
return {
|
|
24883
|
-
finalTokenTransaction:
|
|
24884
|
-
finalTokenTransactionHash:
|
|
24279
|
+
finalTokenTransaction: isSet5(object.finalTokenTransaction) ? TokenTransaction2.fromJSON(object.finalTokenTransaction) : void 0,
|
|
24280
|
+
finalTokenTransactionHash: isSet5(object.finalTokenTransactionHash) ? bytesFromBase644(object.finalTokenTransactionHash) : new Uint8Array(0),
|
|
24885
24281
|
inputTtxoSignaturesPerOperator: globalThis.Array.isArray(object?.inputTtxoSignaturesPerOperator) ? object.inputTtxoSignaturesPerOperator.map((e) => InputTtxoSignaturesPerOperator.fromJSON(e)) : [],
|
|
24886
|
-
ownerIdentityPublicKey:
|
|
24282
|
+
ownerIdentityPublicKey: isSet5(object.ownerIdentityPublicKey) ? bytesFromBase644(object.ownerIdentityPublicKey) : new Uint8Array(0)
|
|
24887
24283
|
};
|
|
24888
24284
|
},
|
|
24889
24285
|
toJSON(message) {
|
|
@@ -24892,7 +24288,7 @@ var CommitTransactionRequest = {
|
|
|
24892
24288
|
obj.finalTokenTransaction = TokenTransaction2.toJSON(message.finalTokenTransaction);
|
|
24893
24289
|
}
|
|
24894
24290
|
if (message.finalTokenTransactionHash.length !== 0) {
|
|
24895
|
-
obj.finalTokenTransactionHash =
|
|
24291
|
+
obj.finalTokenTransactionHash = base64FromBytes4(message.finalTokenTransactionHash);
|
|
24896
24292
|
}
|
|
24897
24293
|
if (message.inputTtxoSignaturesPerOperator?.length) {
|
|
24898
24294
|
obj.inputTtxoSignaturesPerOperator = message.inputTtxoSignaturesPerOperator.map(
|
|
@@ -24900,7 +24296,7 @@ var CommitTransactionRequest = {
|
|
|
24900
24296
|
);
|
|
24901
24297
|
}
|
|
24902
24298
|
if (message.ownerIdentityPublicKey.length !== 0) {
|
|
24903
|
-
obj.ownerIdentityPublicKey =
|
|
24299
|
+
obj.ownerIdentityPublicKey = base64FromBytes4(message.ownerIdentityPublicKey);
|
|
24904
24300
|
}
|
|
24905
24301
|
return obj;
|
|
24906
24302
|
},
|
|
@@ -24920,7 +24316,7 @@ function createBaseCommitProgress() {
|
|
|
24920
24316
|
return { committedOperatorPublicKeys: [], uncommittedOperatorPublicKeys: [] };
|
|
24921
24317
|
}
|
|
24922
24318
|
var CommitProgress = {
|
|
24923
|
-
encode(message, writer = new
|
|
24319
|
+
encode(message, writer = new import_wire7.BinaryWriter()) {
|
|
24924
24320
|
for (const v of message.committedOperatorPublicKeys) {
|
|
24925
24321
|
writer.uint32(10).bytes(v);
|
|
24926
24322
|
}
|
|
@@ -24930,7 +24326,7 @@ var CommitProgress = {
|
|
|
24930
24326
|
return writer;
|
|
24931
24327
|
},
|
|
24932
24328
|
decode(input, length) {
|
|
24933
|
-
const reader = input instanceof
|
|
24329
|
+
const reader = input instanceof import_wire7.BinaryReader ? input : new import_wire7.BinaryReader(input);
|
|
24934
24330
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
24935
24331
|
const message = createBaseCommitProgress();
|
|
24936
24332
|
while (reader.pos < end) {
|
|
@@ -24960,17 +24356,17 @@ var CommitProgress = {
|
|
|
24960
24356
|
},
|
|
24961
24357
|
fromJSON(object) {
|
|
24962
24358
|
return {
|
|
24963
|
-
committedOperatorPublicKeys: globalThis.Array.isArray(object?.committedOperatorPublicKeys) ? object.committedOperatorPublicKeys.map((e) =>
|
|
24964
|
-
uncommittedOperatorPublicKeys: globalThis.Array.isArray(object?.uncommittedOperatorPublicKeys) ? object.uncommittedOperatorPublicKeys.map((e) =>
|
|
24359
|
+
committedOperatorPublicKeys: globalThis.Array.isArray(object?.committedOperatorPublicKeys) ? object.committedOperatorPublicKeys.map((e) => bytesFromBase644(e)) : [],
|
|
24360
|
+
uncommittedOperatorPublicKeys: globalThis.Array.isArray(object?.uncommittedOperatorPublicKeys) ? object.uncommittedOperatorPublicKeys.map((e) => bytesFromBase644(e)) : []
|
|
24965
24361
|
};
|
|
24966
24362
|
},
|
|
24967
24363
|
toJSON(message) {
|
|
24968
24364
|
const obj = {};
|
|
24969
24365
|
if (message.committedOperatorPublicKeys?.length) {
|
|
24970
|
-
obj.committedOperatorPublicKeys = message.committedOperatorPublicKeys.map((e) =>
|
|
24366
|
+
obj.committedOperatorPublicKeys = message.committedOperatorPublicKeys.map((e) => base64FromBytes4(e));
|
|
24971
24367
|
}
|
|
24972
24368
|
if (message.uncommittedOperatorPublicKeys?.length) {
|
|
24973
|
-
obj.uncommittedOperatorPublicKeys = message.uncommittedOperatorPublicKeys.map((e) =>
|
|
24369
|
+
obj.uncommittedOperatorPublicKeys = message.uncommittedOperatorPublicKeys.map((e) => base64FromBytes4(e));
|
|
24974
24370
|
}
|
|
24975
24371
|
return obj;
|
|
24976
24372
|
},
|
|
@@ -24988,7 +24384,7 @@ function createBaseCommitTransactionResponse() {
|
|
|
24988
24384
|
return { commitStatus: 0, commitProgress: void 0 };
|
|
24989
24385
|
}
|
|
24990
24386
|
var CommitTransactionResponse = {
|
|
24991
|
-
encode(message, writer = new
|
|
24387
|
+
encode(message, writer = new import_wire7.BinaryWriter()) {
|
|
24992
24388
|
if (message.commitStatus !== 0) {
|
|
24993
24389
|
writer.uint32(8).int32(message.commitStatus);
|
|
24994
24390
|
}
|
|
@@ -24998,7 +24394,7 @@ var CommitTransactionResponse = {
|
|
|
24998
24394
|
return writer;
|
|
24999
24395
|
},
|
|
25000
24396
|
decode(input, length) {
|
|
25001
|
-
const reader = input instanceof
|
|
24397
|
+
const reader = input instanceof import_wire7.BinaryReader ? input : new import_wire7.BinaryReader(input);
|
|
25002
24398
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
25003
24399
|
const message = createBaseCommitTransactionResponse();
|
|
25004
24400
|
while (reader.pos < end) {
|
|
@@ -25028,8 +24424,8 @@ var CommitTransactionResponse = {
|
|
|
25028
24424
|
},
|
|
25029
24425
|
fromJSON(object) {
|
|
25030
24426
|
return {
|
|
25031
|
-
commitStatus:
|
|
25032
|
-
commitProgress:
|
|
24427
|
+
commitStatus: isSet5(object.commitStatus) ? commitStatusFromJSON(object.commitStatus) : 0,
|
|
24428
|
+
commitProgress: isSet5(object.commitProgress) ? CommitProgress.fromJSON(object.commitProgress) : void 0
|
|
25033
24429
|
};
|
|
25034
24430
|
},
|
|
25035
24431
|
toJSON(message) {
|
|
@@ -25056,7 +24452,7 @@ function createBaseQueryTokenMetadataRequest() {
|
|
|
25056
24452
|
return { tokenIdentifiers: [], issuerPublicKeys: [] };
|
|
25057
24453
|
}
|
|
25058
24454
|
var QueryTokenMetadataRequest = {
|
|
25059
|
-
encode(message, writer = new
|
|
24455
|
+
encode(message, writer = new import_wire7.BinaryWriter()) {
|
|
25060
24456
|
for (const v of message.tokenIdentifiers) {
|
|
25061
24457
|
writer.uint32(10).bytes(v);
|
|
25062
24458
|
}
|
|
@@ -25066,7 +24462,7 @@ var QueryTokenMetadataRequest = {
|
|
|
25066
24462
|
return writer;
|
|
25067
24463
|
},
|
|
25068
24464
|
decode(input, length) {
|
|
25069
|
-
const reader = input instanceof
|
|
24465
|
+
const reader = input instanceof import_wire7.BinaryReader ? input : new import_wire7.BinaryReader(input);
|
|
25070
24466
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
25071
24467
|
const message = createBaseQueryTokenMetadataRequest();
|
|
25072
24468
|
while (reader.pos < end) {
|
|
@@ -25096,17 +24492,17 @@ var QueryTokenMetadataRequest = {
|
|
|
25096
24492
|
},
|
|
25097
24493
|
fromJSON(object) {
|
|
25098
24494
|
return {
|
|
25099
|
-
tokenIdentifiers: globalThis.Array.isArray(object?.tokenIdentifiers) ? object.tokenIdentifiers.map((e) =>
|
|
25100
|
-
issuerPublicKeys: globalThis.Array.isArray(object?.issuerPublicKeys) ? object.issuerPublicKeys.map((e) =>
|
|
24495
|
+
tokenIdentifiers: globalThis.Array.isArray(object?.tokenIdentifiers) ? object.tokenIdentifiers.map((e) => bytesFromBase644(e)) : [],
|
|
24496
|
+
issuerPublicKeys: globalThis.Array.isArray(object?.issuerPublicKeys) ? object.issuerPublicKeys.map((e) => bytesFromBase644(e)) : []
|
|
25101
24497
|
};
|
|
25102
24498
|
},
|
|
25103
24499
|
toJSON(message) {
|
|
25104
24500
|
const obj = {};
|
|
25105
24501
|
if (message.tokenIdentifiers?.length) {
|
|
25106
|
-
obj.tokenIdentifiers = message.tokenIdentifiers.map((e) =>
|
|
24502
|
+
obj.tokenIdentifiers = message.tokenIdentifiers.map((e) => base64FromBytes4(e));
|
|
25107
24503
|
}
|
|
25108
24504
|
if (message.issuerPublicKeys?.length) {
|
|
25109
|
-
obj.issuerPublicKeys = message.issuerPublicKeys.map((e) =>
|
|
24505
|
+
obj.issuerPublicKeys = message.issuerPublicKeys.map((e) => base64FromBytes4(e));
|
|
25110
24506
|
}
|
|
25111
24507
|
return obj;
|
|
25112
24508
|
},
|
|
@@ -25133,7 +24529,7 @@ function createBaseTokenMetadata() {
|
|
|
25133
24529
|
};
|
|
25134
24530
|
}
|
|
25135
24531
|
var TokenMetadata = {
|
|
25136
|
-
encode(message, writer = new
|
|
24532
|
+
encode(message, writer = new import_wire7.BinaryWriter()) {
|
|
25137
24533
|
if (message.issuerPublicKey.length !== 0) {
|
|
25138
24534
|
writer.uint32(10).bytes(message.issuerPublicKey);
|
|
25139
24535
|
}
|
|
@@ -25161,7 +24557,7 @@ var TokenMetadata = {
|
|
|
25161
24557
|
return writer;
|
|
25162
24558
|
},
|
|
25163
24559
|
decode(input, length) {
|
|
25164
|
-
const reader = input instanceof
|
|
24560
|
+
const reader = input instanceof import_wire7.BinaryReader ? input : new import_wire7.BinaryReader(input);
|
|
25165
24561
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
25166
24562
|
const message = createBaseTokenMetadata();
|
|
25167
24563
|
while (reader.pos < end) {
|
|
@@ -25233,20 +24629,20 @@ var TokenMetadata = {
|
|
|
25233
24629
|
},
|
|
25234
24630
|
fromJSON(object) {
|
|
25235
24631
|
return {
|
|
25236
|
-
issuerPublicKey:
|
|
25237
|
-
tokenName:
|
|
25238
|
-
tokenTicker:
|
|
25239
|
-
decimals:
|
|
25240
|
-
maxSupply:
|
|
25241
|
-
isFreezable:
|
|
25242
|
-
creationEntityPublicKey:
|
|
25243
|
-
tokenIdentifier:
|
|
24632
|
+
issuerPublicKey: isSet5(object.issuerPublicKey) ? bytesFromBase644(object.issuerPublicKey) : new Uint8Array(0),
|
|
24633
|
+
tokenName: isSet5(object.tokenName) ? globalThis.String(object.tokenName) : "",
|
|
24634
|
+
tokenTicker: isSet5(object.tokenTicker) ? globalThis.String(object.tokenTicker) : "",
|
|
24635
|
+
decimals: isSet5(object.decimals) ? globalThis.Number(object.decimals) : 0,
|
|
24636
|
+
maxSupply: isSet5(object.maxSupply) ? bytesFromBase644(object.maxSupply) : new Uint8Array(0),
|
|
24637
|
+
isFreezable: isSet5(object.isFreezable) ? globalThis.Boolean(object.isFreezable) : false,
|
|
24638
|
+
creationEntityPublicKey: isSet5(object.creationEntityPublicKey) ? bytesFromBase644(object.creationEntityPublicKey) : void 0,
|
|
24639
|
+
tokenIdentifier: isSet5(object.tokenIdentifier) ? bytesFromBase644(object.tokenIdentifier) : new Uint8Array(0)
|
|
25244
24640
|
};
|
|
25245
24641
|
},
|
|
25246
24642
|
toJSON(message) {
|
|
25247
24643
|
const obj = {};
|
|
25248
24644
|
if (message.issuerPublicKey.length !== 0) {
|
|
25249
|
-
obj.issuerPublicKey =
|
|
24645
|
+
obj.issuerPublicKey = base64FromBytes4(message.issuerPublicKey);
|
|
25250
24646
|
}
|
|
25251
24647
|
if (message.tokenName !== "") {
|
|
25252
24648
|
obj.tokenName = message.tokenName;
|
|
@@ -25258,16 +24654,16 @@ var TokenMetadata = {
|
|
|
25258
24654
|
obj.decimals = Math.round(message.decimals);
|
|
25259
24655
|
}
|
|
25260
24656
|
if (message.maxSupply.length !== 0) {
|
|
25261
|
-
obj.maxSupply =
|
|
24657
|
+
obj.maxSupply = base64FromBytes4(message.maxSupply);
|
|
25262
24658
|
}
|
|
25263
24659
|
if (message.isFreezable !== false) {
|
|
25264
24660
|
obj.isFreezable = message.isFreezable;
|
|
25265
24661
|
}
|
|
25266
24662
|
if (message.creationEntityPublicKey !== void 0) {
|
|
25267
|
-
obj.creationEntityPublicKey =
|
|
24663
|
+
obj.creationEntityPublicKey = base64FromBytes4(message.creationEntityPublicKey);
|
|
25268
24664
|
}
|
|
25269
24665
|
if (message.tokenIdentifier.length !== 0) {
|
|
25270
|
-
obj.tokenIdentifier =
|
|
24666
|
+
obj.tokenIdentifier = base64FromBytes4(message.tokenIdentifier);
|
|
25271
24667
|
}
|
|
25272
24668
|
return obj;
|
|
25273
24669
|
},
|
|
@@ -25291,14 +24687,14 @@ function createBaseQueryTokenMetadataResponse() {
|
|
|
25291
24687
|
return { tokenMetadata: [] };
|
|
25292
24688
|
}
|
|
25293
24689
|
var QueryTokenMetadataResponse = {
|
|
25294
|
-
encode(message, writer = new
|
|
24690
|
+
encode(message, writer = new import_wire7.BinaryWriter()) {
|
|
25295
24691
|
for (const v of message.tokenMetadata) {
|
|
25296
24692
|
TokenMetadata.encode(v, writer.uint32(10).fork()).join();
|
|
25297
24693
|
}
|
|
25298
24694
|
return writer;
|
|
25299
24695
|
},
|
|
25300
24696
|
decode(input, length) {
|
|
25301
|
-
const reader = input instanceof
|
|
24697
|
+
const reader = input instanceof import_wire7.BinaryReader ? input : new import_wire7.BinaryReader(input);
|
|
25302
24698
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
25303
24699
|
const message = createBaseQueryTokenMetadataResponse();
|
|
25304
24700
|
while (reader.pos < end) {
|
|
@@ -25344,7 +24740,7 @@ function createBaseQueryTokenOutputsRequest2() {
|
|
|
25344
24740
|
return { ownerPublicKeys: [], issuerPublicKeys: [], tokenIdentifiers: [], network: 0, pageRequest: void 0 };
|
|
25345
24741
|
}
|
|
25346
24742
|
var QueryTokenOutputsRequest2 = {
|
|
25347
|
-
encode(message, writer = new
|
|
24743
|
+
encode(message, writer = new import_wire7.BinaryWriter()) {
|
|
25348
24744
|
for (const v of message.ownerPublicKeys) {
|
|
25349
24745
|
writer.uint32(10).bytes(v);
|
|
25350
24746
|
}
|
|
@@ -25363,7 +24759,7 @@ var QueryTokenOutputsRequest2 = {
|
|
|
25363
24759
|
return writer;
|
|
25364
24760
|
},
|
|
25365
24761
|
decode(input, length) {
|
|
25366
|
-
const reader = input instanceof
|
|
24762
|
+
const reader = input instanceof import_wire7.BinaryReader ? input : new import_wire7.BinaryReader(input);
|
|
25367
24763
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
25368
24764
|
const message = createBaseQueryTokenOutputsRequest2();
|
|
25369
24765
|
while (reader.pos < end) {
|
|
@@ -25414,23 +24810,23 @@ var QueryTokenOutputsRequest2 = {
|
|
|
25414
24810
|
},
|
|
25415
24811
|
fromJSON(object) {
|
|
25416
24812
|
return {
|
|
25417
|
-
ownerPublicKeys: globalThis.Array.isArray(object?.ownerPublicKeys) ? object.ownerPublicKeys.map((e) =>
|
|
25418
|
-
issuerPublicKeys: globalThis.Array.isArray(object?.issuerPublicKeys) ? object.issuerPublicKeys.map((e) =>
|
|
25419
|
-
tokenIdentifiers: globalThis.Array.isArray(object?.tokenIdentifiers) ? object.tokenIdentifiers.map((e) =>
|
|
25420
|
-
network:
|
|
25421
|
-
pageRequest:
|
|
24813
|
+
ownerPublicKeys: globalThis.Array.isArray(object?.ownerPublicKeys) ? object.ownerPublicKeys.map((e) => bytesFromBase644(e)) : [],
|
|
24814
|
+
issuerPublicKeys: globalThis.Array.isArray(object?.issuerPublicKeys) ? object.issuerPublicKeys.map((e) => bytesFromBase644(e)) : [],
|
|
24815
|
+
tokenIdentifiers: globalThis.Array.isArray(object?.tokenIdentifiers) ? object.tokenIdentifiers.map((e) => bytesFromBase644(e)) : [],
|
|
24816
|
+
network: isSet5(object.network) ? networkFromJSON(object.network) : 0,
|
|
24817
|
+
pageRequest: isSet5(object.pageRequest) ? PageRequest.fromJSON(object.pageRequest) : void 0
|
|
25422
24818
|
};
|
|
25423
24819
|
},
|
|
25424
24820
|
toJSON(message) {
|
|
25425
24821
|
const obj = {};
|
|
25426
24822
|
if (message.ownerPublicKeys?.length) {
|
|
25427
|
-
obj.ownerPublicKeys = message.ownerPublicKeys.map((e) =>
|
|
24823
|
+
obj.ownerPublicKeys = message.ownerPublicKeys.map((e) => base64FromBytes4(e));
|
|
25428
24824
|
}
|
|
25429
24825
|
if (message.issuerPublicKeys?.length) {
|
|
25430
|
-
obj.issuerPublicKeys = message.issuerPublicKeys.map((e) =>
|
|
24826
|
+
obj.issuerPublicKeys = message.issuerPublicKeys.map((e) => base64FromBytes4(e));
|
|
25431
24827
|
}
|
|
25432
24828
|
if (message.tokenIdentifiers?.length) {
|
|
25433
|
-
obj.tokenIdentifiers = message.tokenIdentifiers.map((e) =>
|
|
24829
|
+
obj.tokenIdentifiers = message.tokenIdentifiers.map((e) => base64FromBytes4(e));
|
|
25434
24830
|
}
|
|
25435
24831
|
if (message.network !== 0) {
|
|
25436
24832
|
obj.network = networkToJSON(message.network);
|
|
@@ -25465,7 +24861,7 @@ function createBaseQueryTokenTransactionsRequest2() {
|
|
|
25465
24861
|
};
|
|
25466
24862
|
}
|
|
25467
24863
|
var QueryTokenTransactionsRequest2 = {
|
|
25468
|
-
encode(message, writer = new
|
|
24864
|
+
encode(message, writer = new import_wire7.BinaryWriter()) {
|
|
25469
24865
|
for (const v of message.outputIds) {
|
|
25470
24866
|
writer.uint32(10).string(v);
|
|
25471
24867
|
}
|
|
@@ -25490,7 +24886,7 @@ var QueryTokenTransactionsRequest2 = {
|
|
|
25490
24886
|
return writer;
|
|
25491
24887
|
},
|
|
25492
24888
|
decode(input, length) {
|
|
25493
|
-
const reader = input instanceof
|
|
24889
|
+
const reader = input instanceof import_wire7.BinaryReader ? input : new import_wire7.BinaryReader(input);
|
|
25494
24890
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
25495
24891
|
const message = createBaseQueryTokenTransactionsRequest2();
|
|
25496
24892
|
while (reader.pos < end) {
|
|
@@ -25556,12 +24952,12 @@ var QueryTokenTransactionsRequest2 = {
|
|
|
25556
24952
|
fromJSON(object) {
|
|
25557
24953
|
return {
|
|
25558
24954
|
outputIds: globalThis.Array.isArray(object?.outputIds) ? object.outputIds.map((e) => globalThis.String(e)) : [],
|
|
25559
|
-
ownerPublicKeys: globalThis.Array.isArray(object?.ownerPublicKeys) ? object.ownerPublicKeys.map((e) =>
|
|
25560
|
-
issuerPublicKeys: globalThis.Array.isArray(object?.issuerPublicKeys) ? object.issuerPublicKeys.map((e) =>
|
|
25561
|
-
tokenIdentifiers: globalThis.Array.isArray(object?.tokenIdentifiers) ? object.tokenIdentifiers.map((e) =>
|
|
25562
|
-
tokenTransactionHashes: globalThis.Array.isArray(object?.tokenTransactionHashes) ? object.tokenTransactionHashes.map((e) =>
|
|
25563
|
-
limit:
|
|
25564
|
-
offset:
|
|
24955
|
+
ownerPublicKeys: globalThis.Array.isArray(object?.ownerPublicKeys) ? object.ownerPublicKeys.map((e) => bytesFromBase644(e)) : [],
|
|
24956
|
+
issuerPublicKeys: globalThis.Array.isArray(object?.issuerPublicKeys) ? object.issuerPublicKeys.map((e) => bytesFromBase644(e)) : [],
|
|
24957
|
+
tokenIdentifiers: globalThis.Array.isArray(object?.tokenIdentifiers) ? object.tokenIdentifiers.map((e) => bytesFromBase644(e)) : [],
|
|
24958
|
+
tokenTransactionHashes: globalThis.Array.isArray(object?.tokenTransactionHashes) ? object.tokenTransactionHashes.map((e) => bytesFromBase644(e)) : [],
|
|
24959
|
+
limit: isSet5(object.limit) ? globalThis.Number(object.limit) : 0,
|
|
24960
|
+
offset: isSet5(object.offset) ? globalThis.Number(object.offset) : 0
|
|
25565
24961
|
};
|
|
25566
24962
|
},
|
|
25567
24963
|
toJSON(message) {
|
|
@@ -25570,16 +24966,16 @@ var QueryTokenTransactionsRequest2 = {
|
|
|
25570
24966
|
obj.outputIds = message.outputIds;
|
|
25571
24967
|
}
|
|
25572
24968
|
if (message.ownerPublicKeys?.length) {
|
|
25573
|
-
obj.ownerPublicKeys = message.ownerPublicKeys.map((e) =>
|
|
24969
|
+
obj.ownerPublicKeys = message.ownerPublicKeys.map((e) => base64FromBytes4(e));
|
|
25574
24970
|
}
|
|
25575
24971
|
if (message.issuerPublicKeys?.length) {
|
|
25576
|
-
obj.issuerPublicKeys = message.issuerPublicKeys.map((e) =>
|
|
24972
|
+
obj.issuerPublicKeys = message.issuerPublicKeys.map((e) => base64FromBytes4(e));
|
|
25577
24973
|
}
|
|
25578
24974
|
if (message.tokenIdentifiers?.length) {
|
|
25579
|
-
obj.tokenIdentifiers = message.tokenIdentifiers.map((e) =>
|
|
24975
|
+
obj.tokenIdentifiers = message.tokenIdentifiers.map((e) => base64FromBytes4(e));
|
|
25580
24976
|
}
|
|
25581
24977
|
if (message.tokenTransactionHashes?.length) {
|
|
25582
|
-
obj.tokenTransactionHashes = message.tokenTransactionHashes.map((e) =>
|
|
24978
|
+
obj.tokenTransactionHashes = message.tokenTransactionHashes.map((e) => base64FromBytes4(e));
|
|
25583
24979
|
}
|
|
25584
24980
|
if (message.limit !== 0) {
|
|
25585
24981
|
obj.limit = Math.round(message.limit);
|
|
@@ -25608,7 +25004,7 @@ function createBaseQueryTokenTransactionsResponse2() {
|
|
|
25608
25004
|
return { tokenTransactionsWithStatus: [], offset: 0 };
|
|
25609
25005
|
}
|
|
25610
25006
|
var QueryTokenTransactionsResponse2 = {
|
|
25611
|
-
encode(message, writer = new
|
|
25007
|
+
encode(message, writer = new import_wire7.BinaryWriter()) {
|
|
25612
25008
|
for (const v of message.tokenTransactionsWithStatus) {
|
|
25613
25009
|
TokenTransactionWithStatus2.encode(v, writer.uint32(10).fork()).join();
|
|
25614
25010
|
}
|
|
@@ -25618,7 +25014,7 @@ var QueryTokenTransactionsResponse2 = {
|
|
|
25618
25014
|
return writer;
|
|
25619
25015
|
},
|
|
25620
25016
|
decode(input, length) {
|
|
25621
|
-
const reader = input instanceof
|
|
25017
|
+
const reader = input instanceof import_wire7.BinaryReader ? input : new import_wire7.BinaryReader(input);
|
|
25622
25018
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
25623
25019
|
const message = createBaseQueryTokenTransactionsResponse2();
|
|
25624
25020
|
while (reader.pos < end) {
|
|
@@ -25649,7 +25045,7 @@ var QueryTokenTransactionsResponse2 = {
|
|
|
25649
25045
|
fromJSON(object) {
|
|
25650
25046
|
return {
|
|
25651
25047
|
tokenTransactionsWithStatus: globalThis.Array.isArray(object?.tokenTransactionsWithStatus) ? object.tokenTransactionsWithStatus.map((e) => TokenTransactionWithStatus2.fromJSON(e)) : [],
|
|
25652
|
-
offset:
|
|
25048
|
+
offset: isSet5(object.offset) ? globalThis.Number(object.offset) : 0
|
|
25653
25049
|
};
|
|
25654
25050
|
},
|
|
25655
25051
|
toJSON(message) {
|
|
@@ -25678,7 +25074,7 @@ function createBaseOutputWithPreviousTransactionData2() {
|
|
|
25678
25074
|
return { output: void 0, previousTransactionHash: new Uint8Array(0), previousTransactionVout: 0 };
|
|
25679
25075
|
}
|
|
25680
25076
|
var OutputWithPreviousTransactionData2 = {
|
|
25681
|
-
encode(message, writer = new
|
|
25077
|
+
encode(message, writer = new import_wire7.BinaryWriter()) {
|
|
25682
25078
|
if (message.output !== void 0) {
|
|
25683
25079
|
TokenOutput2.encode(message.output, writer.uint32(10).fork()).join();
|
|
25684
25080
|
}
|
|
@@ -25691,7 +25087,7 @@ var OutputWithPreviousTransactionData2 = {
|
|
|
25691
25087
|
return writer;
|
|
25692
25088
|
},
|
|
25693
25089
|
decode(input, length) {
|
|
25694
|
-
const reader = input instanceof
|
|
25090
|
+
const reader = input instanceof import_wire7.BinaryReader ? input : new import_wire7.BinaryReader(input);
|
|
25695
25091
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
25696
25092
|
const message = createBaseOutputWithPreviousTransactionData2();
|
|
25697
25093
|
while (reader.pos < end) {
|
|
@@ -25728,9 +25124,9 @@ var OutputWithPreviousTransactionData2 = {
|
|
|
25728
25124
|
},
|
|
25729
25125
|
fromJSON(object) {
|
|
25730
25126
|
return {
|
|
25731
|
-
output:
|
|
25732
|
-
previousTransactionHash:
|
|
25733
|
-
previousTransactionVout:
|
|
25127
|
+
output: isSet5(object.output) ? TokenOutput2.fromJSON(object.output) : void 0,
|
|
25128
|
+
previousTransactionHash: isSet5(object.previousTransactionHash) ? bytesFromBase644(object.previousTransactionHash) : new Uint8Array(0),
|
|
25129
|
+
previousTransactionVout: isSet5(object.previousTransactionVout) ? globalThis.Number(object.previousTransactionVout) : 0
|
|
25734
25130
|
};
|
|
25735
25131
|
},
|
|
25736
25132
|
toJSON(message) {
|
|
@@ -25739,7 +25135,7 @@ var OutputWithPreviousTransactionData2 = {
|
|
|
25739
25135
|
obj.output = TokenOutput2.toJSON(message.output);
|
|
25740
25136
|
}
|
|
25741
25137
|
if (message.previousTransactionHash.length !== 0) {
|
|
25742
|
-
obj.previousTransactionHash =
|
|
25138
|
+
obj.previousTransactionHash = base64FromBytes4(message.previousTransactionHash);
|
|
25743
25139
|
}
|
|
25744
25140
|
if (message.previousTransactionVout !== 0) {
|
|
25745
25141
|
obj.previousTransactionVout = Math.round(message.previousTransactionVout);
|
|
@@ -25761,7 +25157,7 @@ function createBaseQueryTokenOutputsResponse2() {
|
|
|
25761
25157
|
return { outputsWithPreviousTransactionData: [], pageResponse: void 0 };
|
|
25762
25158
|
}
|
|
25763
25159
|
var QueryTokenOutputsResponse2 = {
|
|
25764
|
-
encode(message, writer = new
|
|
25160
|
+
encode(message, writer = new import_wire7.BinaryWriter()) {
|
|
25765
25161
|
for (const v of message.outputsWithPreviousTransactionData) {
|
|
25766
25162
|
OutputWithPreviousTransactionData2.encode(v, writer.uint32(10).fork()).join();
|
|
25767
25163
|
}
|
|
@@ -25771,7 +25167,7 @@ var QueryTokenOutputsResponse2 = {
|
|
|
25771
25167
|
return writer;
|
|
25772
25168
|
},
|
|
25773
25169
|
decode(input, length) {
|
|
25774
|
-
const reader = input instanceof
|
|
25170
|
+
const reader = input instanceof import_wire7.BinaryReader ? input : new import_wire7.BinaryReader(input);
|
|
25775
25171
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
25776
25172
|
const message = createBaseQueryTokenOutputsResponse2();
|
|
25777
25173
|
while (reader.pos < end) {
|
|
@@ -25804,7 +25200,7 @@ var QueryTokenOutputsResponse2 = {
|
|
|
25804
25200
|
fromJSON(object) {
|
|
25805
25201
|
return {
|
|
25806
25202
|
outputsWithPreviousTransactionData: globalThis.Array.isArray(object?.outputsWithPreviousTransactionData) ? object.outputsWithPreviousTransactionData.map((e) => OutputWithPreviousTransactionData2.fromJSON(e)) : [],
|
|
25807
|
-
pageResponse:
|
|
25203
|
+
pageResponse: isSet5(object.pageResponse) ? PageResponse.fromJSON(object.pageResponse) : void 0
|
|
25808
25204
|
};
|
|
25809
25205
|
},
|
|
25810
25206
|
toJSON(message) {
|
|
@@ -25833,7 +25229,7 @@ function createBaseSpentTokenOutputMetadata2() {
|
|
|
25833
25229
|
return { outputId: "", revocationSecret: new Uint8Array(0) };
|
|
25834
25230
|
}
|
|
25835
25231
|
var SpentTokenOutputMetadata2 = {
|
|
25836
|
-
encode(message, writer = new
|
|
25232
|
+
encode(message, writer = new import_wire7.BinaryWriter()) {
|
|
25837
25233
|
if (message.outputId !== "") {
|
|
25838
25234
|
writer.uint32(10).string(message.outputId);
|
|
25839
25235
|
}
|
|
@@ -25843,7 +25239,7 @@ var SpentTokenOutputMetadata2 = {
|
|
|
25843
25239
|
return writer;
|
|
25844
25240
|
},
|
|
25845
25241
|
decode(input, length) {
|
|
25846
|
-
const reader = input instanceof
|
|
25242
|
+
const reader = input instanceof import_wire7.BinaryReader ? input : new import_wire7.BinaryReader(input);
|
|
25847
25243
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
25848
25244
|
const message = createBaseSpentTokenOutputMetadata2();
|
|
25849
25245
|
while (reader.pos < end) {
|
|
@@ -25873,8 +25269,8 @@ var SpentTokenOutputMetadata2 = {
|
|
|
25873
25269
|
},
|
|
25874
25270
|
fromJSON(object) {
|
|
25875
25271
|
return {
|
|
25876
|
-
outputId:
|
|
25877
|
-
revocationSecret:
|
|
25272
|
+
outputId: isSet5(object.outputId) ? globalThis.String(object.outputId) : "",
|
|
25273
|
+
revocationSecret: isSet5(object.revocationSecret) ? bytesFromBase644(object.revocationSecret) : new Uint8Array(0)
|
|
25878
25274
|
};
|
|
25879
25275
|
},
|
|
25880
25276
|
toJSON(message) {
|
|
@@ -25883,7 +25279,7 @@ var SpentTokenOutputMetadata2 = {
|
|
|
25883
25279
|
obj.outputId = message.outputId;
|
|
25884
25280
|
}
|
|
25885
25281
|
if (message.revocationSecret.length !== 0) {
|
|
25886
|
-
obj.revocationSecret =
|
|
25282
|
+
obj.revocationSecret = base64FromBytes4(message.revocationSecret);
|
|
25887
25283
|
}
|
|
25888
25284
|
return obj;
|
|
25889
25285
|
},
|
|
@@ -25901,14 +25297,14 @@ function createBaseTokenTransactionConfirmationMetadata2() {
|
|
|
25901
25297
|
return { spentTokenOutputsMetadata: [] };
|
|
25902
25298
|
}
|
|
25903
25299
|
var TokenTransactionConfirmationMetadata2 = {
|
|
25904
|
-
encode(message, writer = new
|
|
25300
|
+
encode(message, writer = new import_wire7.BinaryWriter()) {
|
|
25905
25301
|
for (const v of message.spentTokenOutputsMetadata) {
|
|
25906
25302
|
SpentTokenOutputMetadata2.encode(v, writer.uint32(10).fork()).join();
|
|
25907
25303
|
}
|
|
25908
25304
|
return writer;
|
|
25909
25305
|
},
|
|
25910
25306
|
decode(input, length) {
|
|
25911
|
-
const reader = input instanceof
|
|
25307
|
+
const reader = input instanceof import_wire7.BinaryReader ? input : new import_wire7.BinaryReader(input);
|
|
25912
25308
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
25913
25309
|
const message = createBaseTokenTransactionConfirmationMetadata2();
|
|
25914
25310
|
while (reader.pos < end) {
|
|
@@ -25959,7 +25355,7 @@ function createBaseTokenTransactionWithStatus2() {
|
|
|
25959
25355
|
};
|
|
25960
25356
|
}
|
|
25961
25357
|
var TokenTransactionWithStatus2 = {
|
|
25962
|
-
encode(message, writer = new
|
|
25358
|
+
encode(message, writer = new import_wire7.BinaryWriter()) {
|
|
25963
25359
|
if (message.tokenTransaction !== void 0) {
|
|
25964
25360
|
TokenTransaction2.encode(message.tokenTransaction, writer.uint32(10).fork()).join();
|
|
25965
25361
|
}
|
|
@@ -25975,7 +25371,7 @@ var TokenTransactionWithStatus2 = {
|
|
|
25975
25371
|
return writer;
|
|
25976
25372
|
},
|
|
25977
25373
|
decode(input, length) {
|
|
25978
|
-
const reader = input instanceof
|
|
25374
|
+
const reader = input instanceof import_wire7.BinaryReader ? input : new import_wire7.BinaryReader(input);
|
|
25979
25375
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
25980
25376
|
const message = createBaseTokenTransactionWithStatus2();
|
|
25981
25377
|
while (reader.pos < end) {
|
|
@@ -26019,10 +25415,10 @@ var TokenTransactionWithStatus2 = {
|
|
|
26019
25415
|
},
|
|
26020
25416
|
fromJSON(object) {
|
|
26021
25417
|
return {
|
|
26022
|
-
tokenTransaction:
|
|
26023
|
-
status:
|
|
26024
|
-
confirmationMetadata:
|
|
26025
|
-
tokenTransactionHash:
|
|
25418
|
+
tokenTransaction: isSet5(object.tokenTransaction) ? TokenTransaction2.fromJSON(object.tokenTransaction) : void 0,
|
|
25419
|
+
status: isSet5(object.status) ? tokenTransactionStatusFromJSON2(object.status) : 0,
|
|
25420
|
+
confirmationMetadata: isSet5(object.confirmationMetadata) ? TokenTransactionConfirmationMetadata2.fromJSON(object.confirmationMetadata) : void 0,
|
|
25421
|
+
tokenTransactionHash: isSet5(object.tokenTransactionHash) ? bytesFromBase644(object.tokenTransactionHash) : new Uint8Array(0)
|
|
26026
25422
|
};
|
|
26027
25423
|
},
|
|
26028
25424
|
toJSON(message) {
|
|
@@ -26037,7 +25433,7 @@ var TokenTransactionWithStatus2 = {
|
|
|
26037
25433
|
obj.confirmationMetadata = TokenTransactionConfirmationMetadata2.toJSON(message.confirmationMetadata);
|
|
26038
25434
|
}
|
|
26039
25435
|
if (message.tokenTransactionHash.length !== 0) {
|
|
26040
|
-
obj.tokenTransactionHash =
|
|
25436
|
+
obj.tokenTransactionHash = base64FromBytes4(message.tokenTransactionHash);
|
|
26041
25437
|
}
|
|
26042
25438
|
return obj;
|
|
26043
25439
|
},
|
|
@@ -26065,7 +25461,7 @@ function createBaseFreezeTokensPayload2() {
|
|
|
26065
25461
|
};
|
|
26066
25462
|
}
|
|
26067
25463
|
var FreezeTokensPayload2 = {
|
|
26068
|
-
encode(message, writer = new
|
|
25464
|
+
encode(message, writer = new import_wire7.BinaryWriter()) {
|
|
26069
25465
|
if (message.version !== 0) {
|
|
26070
25466
|
writer.uint32(8).uint32(message.version);
|
|
26071
25467
|
}
|
|
@@ -26090,7 +25486,7 @@ var FreezeTokensPayload2 = {
|
|
|
26090
25486
|
return writer;
|
|
26091
25487
|
},
|
|
26092
25488
|
decode(input, length) {
|
|
26093
|
-
const reader = input instanceof
|
|
25489
|
+
const reader = input instanceof import_wire7.BinaryReader ? input : new import_wire7.BinaryReader(input);
|
|
26094
25490
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
26095
25491
|
const message = createBaseFreezeTokensPayload2();
|
|
26096
25492
|
while (reader.pos < end) {
|
|
@@ -26155,13 +25551,13 @@ var FreezeTokensPayload2 = {
|
|
|
26155
25551
|
},
|
|
26156
25552
|
fromJSON(object) {
|
|
26157
25553
|
return {
|
|
26158
|
-
version:
|
|
26159
|
-
ownerPublicKey:
|
|
26160
|
-
tokenPublicKey:
|
|
26161
|
-
tokenIdentifier:
|
|
26162
|
-
issuerProvidedTimestamp:
|
|
26163
|
-
operatorIdentityPublicKey:
|
|
26164
|
-
shouldUnfreeze:
|
|
25554
|
+
version: isSet5(object.version) ? globalThis.Number(object.version) : 0,
|
|
25555
|
+
ownerPublicKey: isSet5(object.ownerPublicKey) ? bytesFromBase644(object.ownerPublicKey) : new Uint8Array(0),
|
|
25556
|
+
tokenPublicKey: isSet5(object.tokenPublicKey) ? bytesFromBase644(object.tokenPublicKey) : void 0,
|
|
25557
|
+
tokenIdentifier: isSet5(object.tokenIdentifier) ? bytesFromBase644(object.tokenIdentifier) : void 0,
|
|
25558
|
+
issuerProvidedTimestamp: isSet5(object.issuerProvidedTimestamp) ? globalThis.Number(object.issuerProvidedTimestamp) : 0,
|
|
25559
|
+
operatorIdentityPublicKey: isSet5(object.operatorIdentityPublicKey) ? bytesFromBase644(object.operatorIdentityPublicKey) : new Uint8Array(0),
|
|
25560
|
+
shouldUnfreeze: isSet5(object.shouldUnfreeze) ? globalThis.Boolean(object.shouldUnfreeze) : false
|
|
26165
25561
|
};
|
|
26166
25562
|
},
|
|
26167
25563
|
toJSON(message) {
|
|
@@ -26170,19 +25566,19 @@ var FreezeTokensPayload2 = {
|
|
|
26170
25566
|
obj.version = Math.round(message.version);
|
|
26171
25567
|
}
|
|
26172
25568
|
if (message.ownerPublicKey.length !== 0) {
|
|
26173
|
-
obj.ownerPublicKey =
|
|
25569
|
+
obj.ownerPublicKey = base64FromBytes4(message.ownerPublicKey);
|
|
26174
25570
|
}
|
|
26175
25571
|
if (message.tokenPublicKey !== void 0) {
|
|
26176
|
-
obj.tokenPublicKey =
|
|
25572
|
+
obj.tokenPublicKey = base64FromBytes4(message.tokenPublicKey);
|
|
26177
25573
|
}
|
|
26178
25574
|
if (message.tokenIdentifier !== void 0) {
|
|
26179
|
-
obj.tokenIdentifier =
|
|
25575
|
+
obj.tokenIdentifier = base64FromBytes4(message.tokenIdentifier);
|
|
26180
25576
|
}
|
|
26181
25577
|
if (message.issuerProvidedTimestamp !== 0) {
|
|
26182
25578
|
obj.issuerProvidedTimestamp = Math.round(message.issuerProvidedTimestamp);
|
|
26183
25579
|
}
|
|
26184
25580
|
if (message.operatorIdentityPublicKey.length !== 0) {
|
|
26185
|
-
obj.operatorIdentityPublicKey =
|
|
25581
|
+
obj.operatorIdentityPublicKey = base64FromBytes4(message.operatorIdentityPublicKey);
|
|
26186
25582
|
}
|
|
26187
25583
|
if (message.shouldUnfreeze !== false) {
|
|
26188
25584
|
obj.shouldUnfreeze = message.shouldUnfreeze;
|
|
@@ -26208,7 +25604,7 @@ function createBaseFreezeTokensRequest2() {
|
|
|
26208
25604
|
return { freezeTokensPayload: void 0, issuerSignature: new Uint8Array(0) };
|
|
26209
25605
|
}
|
|
26210
25606
|
var FreezeTokensRequest2 = {
|
|
26211
|
-
encode(message, writer = new
|
|
25607
|
+
encode(message, writer = new import_wire7.BinaryWriter()) {
|
|
26212
25608
|
if (message.freezeTokensPayload !== void 0) {
|
|
26213
25609
|
FreezeTokensPayload2.encode(message.freezeTokensPayload, writer.uint32(10).fork()).join();
|
|
26214
25610
|
}
|
|
@@ -26218,7 +25614,7 @@ var FreezeTokensRequest2 = {
|
|
|
26218
25614
|
return writer;
|
|
26219
25615
|
},
|
|
26220
25616
|
decode(input, length) {
|
|
26221
|
-
const reader = input instanceof
|
|
25617
|
+
const reader = input instanceof import_wire7.BinaryReader ? input : new import_wire7.BinaryReader(input);
|
|
26222
25618
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
26223
25619
|
const message = createBaseFreezeTokensRequest2();
|
|
26224
25620
|
while (reader.pos < end) {
|
|
@@ -26248,8 +25644,8 @@ var FreezeTokensRequest2 = {
|
|
|
26248
25644
|
},
|
|
26249
25645
|
fromJSON(object) {
|
|
26250
25646
|
return {
|
|
26251
|
-
freezeTokensPayload:
|
|
26252
|
-
issuerSignature:
|
|
25647
|
+
freezeTokensPayload: isSet5(object.freezeTokensPayload) ? FreezeTokensPayload2.fromJSON(object.freezeTokensPayload) : void 0,
|
|
25648
|
+
issuerSignature: isSet5(object.issuerSignature) ? bytesFromBase644(object.issuerSignature) : new Uint8Array(0)
|
|
26253
25649
|
};
|
|
26254
25650
|
},
|
|
26255
25651
|
toJSON(message) {
|
|
@@ -26258,7 +25654,7 @@ var FreezeTokensRequest2 = {
|
|
|
26258
25654
|
obj.freezeTokensPayload = FreezeTokensPayload2.toJSON(message.freezeTokensPayload);
|
|
26259
25655
|
}
|
|
26260
25656
|
if (message.issuerSignature.length !== 0) {
|
|
26261
|
-
obj.issuerSignature =
|
|
25657
|
+
obj.issuerSignature = base64FromBytes4(message.issuerSignature);
|
|
26262
25658
|
}
|
|
26263
25659
|
return obj;
|
|
26264
25660
|
},
|
|
@@ -26276,7 +25672,7 @@ function createBaseFreezeTokensResponse2() {
|
|
|
26276
25672
|
return { impactedOutputIds: [], impactedTokenAmount: new Uint8Array(0) };
|
|
26277
25673
|
}
|
|
26278
25674
|
var FreezeTokensResponse2 = {
|
|
26279
|
-
encode(message, writer = new
|
|
25675
|
+
encode(message, writer = new import_wire7.BinaryWriter()) {
|
|
26280
25676
|
for (const v of message.impactedOutputIds) {
|
|
26281
25677
|
writer.uint32(10).string(v);
|
|
26282
25678
|
}
|
|
@@ -26286,7 +25682,7 @@ var FreezeTokensResponse2 = {
|
|
|
26286
25682
|
return writer;
|
|
26287
25683
|
},
|
|
26288
25684
|
decode(input, length) {
|
|
26289
|
-
const reader = input instanceof
|
|
25685
|
+
const reader = input instanceof import_wire7.BinaryReader ? input : new import_wire7.BinaryReader(input);
|
|
26290
25686
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
26291
25687
|
const message = createBaseFreezeTokensResponse2();
|
|
26292
25688
|
while (reader.pos < end) {
|
|
@@ -26317,7 +25713,7 @@ var FreezeTokensResponse2 = {
|
|
|
26317
25713
|
fromJSON(object) {
|
|
26318
25714
|
return {
|
|
26319
25715
|
impactedOutputIds: globalThis.Array.isArray(object?.impactedOutputIds) ? object.impactedOutputIds.map((e) => globalThis.String(e)) : [],
|
|
26320
|
-
impactedTokenAmount:
|
|
25716
|
+
impactedTokenAmount: isSet5(object.impactedTokenAmount) ? bytesFromBase644(object.impactedTokenAmount) : new Uint8Array(0)
|
|
26321
25717
|
};
|
|
26322
25718
|
},
|
|
26323
25719
|
toJSON(message) {
|
|
@@ -26326,7 +25722,7 @@ var FreezeTokensResponse2 = {
|
|
|
26326
25722
|
obj.impactedOutputIds = message.impactedOutputIds;
|
|
26327
25723
|
}
|
|
26328
25724
|
if (message.impactedTokenAmount.length !== 0) {
|
|
26329
|
-
obj.impactedTokenAmount =
|
|
25725
|
+
obj.impactedTokenAmount = base64FromBytes4(message.impactedTokenAmount);
|
|
26330
25726
|
}
|
|
26331
25727
|
return obj;
|
|
26332
25728
|
},
|
|
@@ -26402,7 +25798,7 @@ var SparkTokenServiceDefinition = {
|
|
|
26402
25798
|
}
|
|
26403
25799
|
}
|
|
26404
25800
|
};
|
|
26405
|
-
function
|
|
25801
|
+
function bytesFromBase644(b64) {
|
|
26406
25802
|
if (globalThis.Buffer) {
|
|
26407
25803
|
return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));
|
|
26408
25804
|
} else {
|
|
@@ -26414,7 +25810,7 @@ function bytesFromBase645(b64) {
|
|
|
26414
25810
|
return arr;
|
|
26415
25811
|
}
|
|
26416
25812
|
}
|
|
26417
|
-
function
|
|
25813
|
+
function base64FromBytes4(arr) {
|
|
26418
25814
|
if (globalThis.Buffer) {
|
|
26419
25815
|
return globalThis.Buffer.from(arr).toString("base64");
|
|
26420
25816
|
} else {
|
|
@@ -26454,11 +25850,11 @@ function longToNumber4(int64) {
|
|
|
26454
25850
|
}
|
|
26455
25851
|
return num;
|
|
26456
25852
|
}
|
|
26457
|
-
function
|
|
25853
|
+
function isSet5(value) {
|
|
26458
25854
|
return value !== null && value !== void 0;
|
|
26459
25855
|
}
|
|
26460
25856
|
|
|
26461
|
-
// src/services/connection.ts
|
|
25857
|
+
// src/services/connection/connection.ts
|
|
26462
25858
|
var ConnectionManager = class {
|
|
26463
25859
|
config;
|
|
26464
25860
|
clients = /* @__PURE__ */ new Map();
|
|
@@ -26488,127 +25884,70 @@ var ConnectionManager = class {
|
|
|
26488
25884
|
);
|
|
26489
25885
|
this.clients.clear();
|
|
26490
25886
|
}
|
|
26491
|
-
|
|
26492
|
-
|
|
26493
|
-
|
|
26494
|
-
|
|
26495
|
-
|
|
26496
|
-
|
|
26497
|
-
|
|
26498
|
-
|
|
26499
|
-
|
|
26500
|
-
|
|
26501
|
-
|
|
26502
|
-
|
|
26503
|
-
|
|
26504
|
-
|
|
26505
|
-
|
|
26506
|
-
|
|
26507
|
-
}
|
|
26508
|
-
}
|
|
26509
|
-
async createChannelWithTLS(address2, certPath) {
|
|
26510
|
-
try {
|
|
26511
|
-
if (import_core12.isNode && !isBun) {
|
|
26512
|
-
const grpcModule = await import("nice-grpc");
|
|
26513
|
-
const { ChannelCredentials, createChannel } = "default" in grpcModule ? grpcModule.default : grpcModule;
|
|
26514
|
-
if (certPath) {
|
|
26515
|
-
try {
|
|
26516
|
-
const fs = await import("fs");
|
|
26517
|
-
const cert = fs.readFileSync(certPath);
|
|
26518
|
-
return createChannel(address2, ChannelCredentials.createSsl(cert));
|
|
26519
|
-
} catch (error) {
|
|
26520
|
-
console.error("Error reading certificate:", error);
|
|
26521
|
-
return createChannel(
|
|
26522
|
-
address2,
|
|
26523
|
-
ChannelCredentials.createSsl(null, null, null, {
|
|
26524
|
-
rejectUnauthorized: false
|
|
26525
|
-
})
|
|
26526
|
-
);
|
|
26527
|
-
}
|
|
26528
|
-
} else {
|
|
26529
|
-
return createChannel(
|
|
26530
|
-
address2,
|
|
26531
|
-
ChannelCredentials.createSsl(null, null, null, {
|
|
26532
|
-
rejectUnauthorized: false
|
|
26533
|
-
})
|
|
26534
|
-
);
|
|
26535
|
-
}
|
|
26536
|
-
} else {
|
|
26537
|
-
const grpcModule = await import("nice-grpc-web");
|
|
26538
|
-
const { createChannel, FetchTransport } = "default" in grpcModule ? grpcModule.default : grpcModule;
|
|
26539
|
-
const { XHRTransport: XHRTransport2 } = await Promise.resolve().then(() => (init_xhr_transport(), xhr_transport_exports));
|
|
26540
|
-
return createChannel(
|
|
26541
|
-
address2,
|
|
26542
|
-
import_core12.isBare ? (0, import_nice_grpc_web.NodeHttpTransport)() : isReactNative ? XHRTransport2() : FetchTransport()
|
|
26543
|
-
);
|
|
26544
|
-
}
|
|
26545
|
-
} catch (error) {
|
|
26546
|
-
console.error("Channel creation error:", error);
|
|
26547
|
-
throw new NetworkError(
|
|
26548
|
-
"Failed to create channel",
|
|
26549
|
-
{
|
|
26550
|
-
url: address2,
|
|
26551
|
-
operation: "createChannel",
|
|
26552
|
-
errorCount: 1,
|
|
26553
|
-
errors: error instanceof Error ? error.message : String(error)
|
|
26554
|
-
},
|
|
26555
|
-
error
|
|
26556
|
-
);
|
|
26557
|
-
}
|
|
26558
|
-
}
|
|
26559
|
-
async createSparkStreamClient(address2, certPath) {
|
|
26560
|
-
if (this.streamClients.has(address2)) {
|
|
26561
|
-
return this.streamClients.get(address2).client;
|
|
25887
|
+
createChannelWithTLS(address, certPath) {
|
|
25888
|
+
throw new Error("createChannelWithTLS: Not implemented");
|
|
25889
|
+
}
|
|
25890
|
+
async createSparkStreamClient(address, certPath) {
|
|
25891
|
+
if (this.streamClients.has(address)) {
|
|
25892
|
+
return this.streamClients.get(address).client;
|
|
25893
|
+
}
|
|
25894
|
+
const authToken = await this.authenticate(address);
|
|
25895
|
+
const channel = await this.createChannelWithTLS(address, certPath);
|
|
25896
|
+
if (!channel) {
|
|
25897
|
+
throw new NetworkError("Failed to create channel", {
|
|
25898
|
+
url: address,
|
|
25899
|
+
operation: "createChannel",
|
|
25900
|
+
errorCount: 1,
|
|
25901
|
+
errors: "Channel is undefined"
|
|
25902
|
+
});
|
|
26562
25903
|
}
|
|
26563
|
-
const
|
|
26564
|
-
const channel = await this.createChannelWithTLS(address2, certPath);
|
|
26565
|
-
const middleware = this.createMiddleware(address2, authToken);
|
|
25904
|
+
const middleware = this.createMiddleware(address, authToken);
|
|
26566
25905
|
const client = await this.createGrpcClient(
|
|
26567
25906
|
SparkServiceDefinition,
|
|
26568
25907
|
channel,
|
|
26569
25908
|
true,
|
|
26570
25909
|
middleware
|
|
26571
25910
|
);
|
|
26572
|
-
this.streamClients.set(
|
|
25911
|
+
this.streamClients.set(address, { client, authToken, channel });
|
|
26573
25912
|
return client;
|
|
26574
25913
|
}
|
|
26575
|
-
async createSparkClient(
|
|
26576
|
-
if (this.clients.has(
|
|
26577
|
-
return this.clients.get(
|
|
25914
|
+
async createSparkClient(address, certPath) {
|
|
25915
|
+
if (this.clients.has(address)) {
|
|
25916
|
+
return this.clients.get(address).client;
|
|
26578
25917
|
}
|
|
26579
|
-
const authToken = await this.authenticate(
|
|
26580
|
-
const channel = await this.createChannelWithTLS(
|
|
26581
|
-
const middleware = this.createMiddleware(
|
|
25918
|
+
const authToken = await this.authenticate(address);
|
|
25919
|
+
const channel = await this.createChannelWithTLS(address, certPath);
|
|
25920
|
+
const middleware = this.createMiddleware(address, authToken);
|
|
26582
25921
|
const client = await this.createGrpcClient(
|
|
26583
25922
|
SparkServiceDefinition,
|
|
26584
25923
|
channel,
|
|
26585
25924
|
true,
|
|
26586
25925
|
middleware
|
|
26587
25926
|
);
|
|
26588
|
-
this.clients.set(
|
|
25927
|
+
this.clients.set(address, { client, authToken });
|
|
26589
25928
|
return client;
|
|
26590
25929
|
}
|
|
26591
|
-
async createSparkTokenClient(
|
|
26592
|
-
if (this.tokenClients.has(
|
|
26593
|
-
return this.tokenClients.get(
|
|
25930
|
+
async createSparkTokenClient(address, certPath) {
|
|
25931
|
+
if (this.tokenClients.has(address)) {
|
|
25932
|
+
return this.tokenClients.get(address).client;
|
|
26594
25933
|
}
|
|
26595
|
-
const authToken = await this.authenticate(
|
|
26596
|
-
const channel = await this.createChannelWithTLS(
|
|
26597
|
-
const middleware = this.createMiddleware(
|
|
25934
|
+
const authToken = await this.authenticate(address);
|
|
25935
|
+
const channel = await this.createChannelWithTLS(address, certPath);
|
|
25936
|
+
const middleware = this.createMiddleware(address, authToken);
|
|
26598
25937
|
const tokenClient = await this.createGrpcClient(
|
|
26599
25938
|
SparkTokenServiceDefinition,
|
|
26600
25939
|
channel,
|
|
26601
25940
|
true,
|
|
26602
25941
|
middleware
|
|
26603
25942
|
);
|
|
26604
|
-
this.tokenClients.set(
|
|
25943
|
+
this.tokenClients.set(address, { client: tokenClient, authToken });
|
|
26605
25944
|
return tokenClient;
|
|
26606
25945
|
}
|
|
26607
|
-
async getStreamChannel(
|
|
26608
|
-
return this.streamClients.get(
|
|
25946
|
+
async getStreamChannel(address) {
|
|
25947
|
+
return this.streamClients.get(address)?.channel;
|
|
26609
25948
|
}
|
|
26610
|
-
async authenticate(
|
|
26611
|
-
const existing = this.authPromises.get(
|
|
25949
|
+
async authenticate(address, certPath) {
|
|
25950
|
+
const existing = this.authPromises.get(address);
|
|
26612
25951
|
if (existing) {
|
|
26613
25952
|
return existing;
|
|
26614
25953
|
}
|
|
@@ -26620,7 +25959,7 @@ var ConnectionManager = class {
|
|
|
26620
25959
|
try {
|
|
26621
25960
|
const identityPublicKey = await this.config.signer.getIdentityPublicKey();
|
|
26622
25961
|
sparkAuthnClient = await this.createSparkAuthnGrpcConnection(
|
|
26623
|
-
|
|
25962
|
+
address,
|
|
26624
25963
|
certPath
|
|
26625
25964
|
);
|
|
26626
25965
|
const challengeResp = await sparkAuthnClient.get_challenge({
|
|
@@ -26654,6 +25993,13 @@ var ConnectionManager = class {
|
|
|
26654
25993
|
lastError = error;
|
|
26655
25994
|
continue;
|
|
26656
25995
|
}
|
|
25996
|
+
if (error.message.includes("UNAVAILABLE: No connection established.")) {
|
|
25997
|
+
console.warn(
|
|
25998
|
+
`Authentication attempt ${attempt + 1} failed due to unavailable status, retrying...`
|
|
25999
|
+
);
|
|
26000
|
+
lastError = error;
|
|
26001
|
+
continue;
|
|
26002
|
+
}
|
|
26657
26003
|
throw new AuthenticationError(
|
|
26658
26004
|
"Authentication failed",
|
|
26659
26005
|
{
|
|
@@ -26678,15 +26024,15 @@ var ConnectionManager = class {
|
|
|
26678
26024
|
lastError
|
|
26679
26025
|
);
|
|
26680
26026
|
})();
|
|
26681
|
-
this.authPromises.set(
|
|
26027
|
+
this.authPromises.set(address, authPromise);
|
|
26682
26028
|
try {
|
|
26683
26029
|
return await authPromise;
|
|
26684
26030
|
} finally {
|
|
26685
|
-
this.authPromises.delete(
|
|
26031
|
+
this.authPromises.delete(address);
|
|
26686
26032
|
}
|
|
26687
26033
|
}
|
|
26688
|
-
async createSparkAuthnGrpcConnection(
|
|
26689
|
-
const channel = await this.createChannelWithTLS(
|
|
26034
|
+
async createSparkAuthnGrpcConnection(address, certPath) {
|
|
26035
|
+
const channel = await this.createChannelWithTLS(address, certPath);
|
|
26690
26036
|
const authnMiddleware = this.createAuthnMiddleware();
|
|
26691
26037
|
return this.createGrpcClient(
|
|
26692
26038
|
SparkAuthnServiceDefinition,
|
|
@@ -26696,41 +26042,20 @@ var ConnectionManager = class {
|
|
|
26696
26042
|
);
|
|
26697
26043
|
}
|
|
26698
26044
|
createAuthnMiddleware() {
|
|
26699
|
-
|
|
26700
|
-
return
|
|
26701
|
-
|
|
26702
|
-
"X-Client-Env",
|
|
26703
|
-
clientEnv
|
|
26704
|
-
);
|
|
26705
|
-
return yield* call.next(call.request, {
|
|
26706
|
-
...options,
|
|
26707
|
-
metadata
|
|
26708
|
-
});
|
|
26709
|
-
}.bind(this);
|
|
26710
|
-
} else {
|
|
26711
|
-
return async function* (call, options) {
|
|
26712
|
-
const metadata = (0, import_nice_grpc_common2.Metadata)(options.metadata).set("X-Requested-With", "XMLHttpRequest").set("X-Grpc-Web", "1").set("X-Client-Env", clientEnv).set("Content-Type", "application/grpc-web+proto");
|
|
26713
|
-
return yield* call.next(call.request, {
|
|
26714
|
-
...options,
|
|
26715
|
-
metadata
|
|
26716
|
-
});
|
|
26717
|
-
}.bind(this);
|
|
26718
|
-
}
|
|
26045
|
+
return async function* (call, options) {
|
|
26046
|
+
return yield* call.next(call.request, options);
|
|
26047
|
+
}.bind(this);
|
|
26719
26048
|
}
|
|
26720
|
-
createMiddleware(
|
|
26721
|
-
|
|
26722
|
-
return this.createNodeMiddleware(address2, authToken);
|
|
26723
|
-
} else {
|
|
26724
|
-
return this.createBrowserMiddleware(address2, authToken);
|
|
26725
|
-
}
|
|
26049
|
+
createMiddleware(address, authToken) {
|
|
26050
|
+
return void 0;
|
|
26726
26051
|
}
|
|
26727
|
-
async *handleMiddlewareError(error,
|
|
26052
|
+
async *handleMiddlewareError(error, address, call, metadata, options) {
|
|
26728
26053
|
if ((0, import_core12.isError)(error)) {
|
|
26729
26054
|
if (error.message.includes("token has expired")) {
|
|
26730
|
-
const newAuthToken = await this.authenticate(
|
|
26731
|
-
const clientData = this.clients.get(
|
|
26055
|
+
const newAuthToken = await this.authenticate(address);
|
|
26056
|
+
const clientData = this.clients.get(address);
|
|
26732
26057
|
if (!clientData) {
|
|
26733
|
-
throw new Error(`No client found for address: ${
|
|
26058
|
+
throw new Error(`No client found for address: ${address}`);
|
|
26734
26059
|
}
|
|
26735
26060
|
clientData.authToken = newAuthToken;
|
|
26736
26061
|
return yield* call.next(call.request, {
|
|
@@ -26741,101 +26066,8 @@ var ConnectionManager = class {
|
|
|
26741
26066
|
}
|
|
26742
26067
|
throw error;
|
|
26743
26068
|
}
|
|
26744
|
-
createNodeMiddleware(address2, initialAuthToken) {
|
|
26745
|
-
return async function* (call, options) {
|
|
26746
|
-
const metadata = (0, import_nice_grpc_common2.Metadata)(options.metadata).set(
|
|
26747
|
-
"X-Client-Env",
|
|
26748
|
-
clientEnv
|
|
26749
|
-
);
|
|
26750
|
-
try {
|
|
26751
|
-
return yield* call.next(call.request, {
|
|
26752
|
-
...options,
|
|
26753
|
-
metadata: metadata.set(
|
|
26754
|
-
"Authorization",
|
|
26755
|
-
`Bearer ${this.clients.get(address2)?.authToken || initialAuthToken}`
|
|
26756
|
-
)
|
|
26757
|
-
});
|
|
26758
|
-
} catch (error) {
|
|
26759
|
-
return yield* this.handleMiddlewareError(
|
|
26760
|
-
error,
|
|
26761
|
-
address2,
|
|
26762
|
-
call,
|
|
26763
|
-
metadata,
|
|
26764
|
-
options
|
|
26765
|
-
);
|
|
26766
|
-
}
|
|
26767
|
-
}.bind(this);
|
|
26768
|
-
}
|
|
26769
|
-
createBrowserMiddleware(address2, initialAuthToken) {
|
|
26770
|
-
return async function* (call, options) {
|
|
26771
|
-
const metadata = (0, import_nice_grpc_common2.Metadata)(options.metadata).set("X-Requested-With", "XMLHttpRequest").set("X-Grpc-Web", "1").set("X-Client-Env", clientEnv).set("Content-Type", "application/grpc-web+proto");
|
|
26772
|
-
try {
|
|
26773
|
-
return yield* call.next(call.request, {
|
|
26774
|
-
...options,
|
|
26775
|
-
metadata: metadata.set(
|
|
26776
|
-
"Authorization",
|
|
26777
|
-
`Bearer ${this.clients.get(address2)?.authToken || initialAuthToken}`
|
|
26778
|
-
)
|
|
26779
|
-
});
|
|
26780
|
-
} catch (error) {
|
|
26781
|
-
return yield* this.handleMiddlewareError(
|
|
26782
|
-
error,
|
|
26783
|
-
address2,
|
|
26784
|
-
call,
|
|
26785
|
-
metadata,
|
|
26786
|
-
options
|
|
26787
|
-
);
|
|
26788
|
-
}
|
|
26789
|
-
}.bind(this);
|
|
26790
|
-
}
|
|
26791
26069
|
async createGrpcClient(defintion, channel, withRetries, middleware) {
|
|
26792
|
-
|
|
26793
|
-
const retryOptions = {
|
|
26794
|
-
retry: true,
|
|
26795
|
-
retryMaxAttempts: 3
|
|
26796
|
-
};
|
|
26797
|
-
let options = {};
|
|
26798
|
-
const isNodeChannel = "close" in channel;
|
|
26799
|
-
if (import_core12.isNode && isNodeChannel && !isBun) {
|
|
26800
|
-
const grpcModule = await import("nice-grpc");
|
|
26801
|
-
const { openTelemetryClientMiddleware } = await import("nice-grpc-opentelemetry");
|
|
26802
|
-
const { createClientFactory } = "default" in grpcModule ? grpcModule.default : grpcModule;
|
|
26803
|
-
clientFactory = createClientFactory();
|
|
26804
|
-
if (withRetries) {
|
|
26805
|
-
options = retryOptions;
|
|
26806
|
-
clientFactory = clientFactory.use(openTelemetryClientMiddleware()).use(import_nice_grpc_client_middleware_retry.retryMiddleware);
|
|
26807
|
-
}
|
|
26808
|
-
if (middleware) {
|
|
26809
|
-
clientFactory = clientFactory.use(middleware);
|
|
26810
|
-
}
|
|
26811
|
-
const client = clientFactory.create(defintion, channel, {
|
|
26812
|
-
"*": options
|
|
26813
|
-
});
|
|
26814
|
-
return {
|
|
26815
|
-
...client,
|
|
26816
|
-
close: channel.close.bind(channel)
|
|
26817
|
-
};
|
|
26818
|
-
} else if (!isNodeChannel) {
|
|
26819
|
-
const grpcModule = await import("nice-grpc-web");
|
|
26820
|
-
const { createClientFactory } = "default" in grpcModule ? grpcModule.default : grpcModule;
|
|
26821
|
-
clientFactory = createClientFactory();
|
|
26822
|
-
if (withRetries) {
|
|
26823
|
-
options = retryOptions;
|
|
26824
|
-
clientFactory = clientFactory.use(import_nice_grpc_client_middleware_retry.retryMiddleware);
|
|
26825
|
-
}
|
|
26826
|
-
if (middleware) {
|
|
26827
|
-
clientFactory = clientFactory.use(middleware);
|
|
26828
|
-
}
|
|
26829
|
-
const client = clientFactory.create(defintion, channel, {
|
|
26830
|
-
"*": options
|
|
26831
|
-
});
|
|
26832
|
-
return {
|
|
26833
|
-
...client,
|
|
26834
|
-
close: void 0
|
|
26835
|
-
};
|
|
26836
|
-
} else {
|
|
26837
|
-
throw new Error("Channel does not have close in NodeJS environment");
|
|
26838
|
-
}
|
|
26070
|
+
throw new Error("createGrpcClient: Not implemented");
|
|
26839
26071
|
}
|
|
26840
26072
|
};
|
|
26841
26073
|
|
|
@@ -28317,7 +27549,8 @@ var CoopExitService = class extends BaseTransferService {
|
|
|
28317
27549
|
leaves,
|
|
28318
27550
|
exitTxId,
|
|
28319
27551
|
connectorOutputs,
|
|
28320
|
-
receiverPubKey
|
|
27552
|
+
receiverPubKey,
|
|
27553
|
+
transferId
|
|
28321
27554
|
}) {
|
|
28322
27555
|
const {
|
|
28323
27556
|
transfer,
|
|
@@ -28328,7 +27561,8 @@ var CoopExitService = class extends BaseTransferService {
|
|
|
28328
27561
|
leaves,
|
|
28329
27562
|
exitTxId,
|
|
28330
27563
|
connectorOutputs,
|
|
28331
|
-
receiverPubKey
|
|
27564
|
+
receiverPubKey,
|
|
27565
|
+
transferId
|
|
28332
27566
|
);
|
|
28333
27567
|
const transferTweak = await this.deliverTransferPackage(
|
|
28334
27568
|
transfer,
|
|
@@ -28409,7 +27643,7 @@ var CoopExitService = class extends BaseTransferService {
|
|
|
28409
27643
|
directFromCpfpRefundTx
|
|
28410
27644
|
};
|
|
28411
27645
|
}
|
|
28412
|
-
async signCoopExitRefunds(leaves, exitTxId, connectorOutputs, receiverPubKey) {
|
|
27646
|
+
async signCoopExitRefunds(leaves, exitTxId, connectorOutputs, receiverPubKey, transferId) {
|
|
28413
27647
|
if (leaves.length !== connectorOutputs.length) {
|
|
28414
27648
|
throw new ValidationError(
|
|
28415
27649
|
"Mismatch between leaves and connector outputs",
|
|
@@ -28513,12 +27747,12 @@ var CoopExitService = class extends BaseTransferService {
|
|
|
28513
27747
|
try {
|
|
28514
27748
|
response = await sparkClient.cooperative_exit_v2({
|
|
28515
27749
|
transfer: {
|
|
28516
|
-
transferId
|
|
27750
|
+
transferId,
|
|
28517
27751
|
leavesToSend: signingJobs,
|
|
28518
27752
|
ownerIdentityPublicKey: await this.config.signer.getIdentityPublicKey(),
|
|
28519
27753
|
receiverIdentityPublicKey: receiverPubKey,
|
|
28520
|
-
expiryTime: this.config.getNetwork() == 0 /* MAINNET */ ? new Date(Date.now() +
|
|
28521
|
-
//
|
|
27754
|
+
expiryTime: this.config.getNetwork() == 0 /* MAINNET */ ? new Date(Date.now() + 7 * 24 * 60 * 60 * 1e3 + 5 * 60 * 1e3) : new Date(Date.now() + 35 * 60 * 1e3)
|
|
27755
|
+
// 1 week 5 min for mainnet, 35 min otherwise
|
|
28522
27756
|
},
|
|
28523
27757
|
exitId: (0, import_uuidv73.uuidv7)(),
|
|
28524
27758
|
exitTxid: exitTxId
|
|
@@ -28582,24 +27816,24 @@ var DepositService = class {
|
|
|
28582
27816
|
this.connectionManager = connectionManager;
|
|
28583
27817
|
}
|
|
28584
27818
|
async validateDepositAddress({
|
|
28585
|
-
address
|
|
27819
|
+
address,
|
|
28586
27820
|
userPubkey,
|
|
28587
27821
|
verifyCoordinatorProof = false
|
|
28588
27822
|
}) {
|
|
28589
|
-
if (!
|
|
27823
|
+
if (!address.depositAddressProof || !address.depositAddressProof.proofOfPossessionSignature || !address.depositAddressProof.addressSignatures) {
|
|
28590
27824
|
throw new ValidationError(
|
|
28591
27825
|
"Proof of possession signature or address signatures is null",
|
|
28592
27826
|
{
|
|
28593
27827
|
field: "depositAddressProof",
|
|
28594
|
-
value:
|
|
27828
|
+
value: address.depositAddressProof
|
|
28595
27829
|
}
|
|
28596
27830
|
);
|
|
28597
27831
|
}
|
|
28598
|
-
const operatorPubkey = subtractPublicKeys(
|
|
27832
|
+
const operatorPubkey = subtractPublicKeys(address.verifyingKey, userPubkey);
|
|
28599
27833
|
const msg = proofOfPossessionMessageHashForDepositAddress(
|
|
28600
27834
|
await this.config.signer.getIdentityPublicKey(),
|
|
28601
27835
|
operatorPubkey,
|
|
28602
|
-
|
|
27836
|
+
address.address
|
|
28603
27837
|
);
|
|
28604
27838
|
const taprootKey = (0, import_btc_signer4.p2tr)(
|
|
28605
27839
|
operatorPubkey.slice(1, 33),
|
|
@@ -28607,7 +27841,7 @@ var DepositService = class {
|
|
|
28607
27841
|
getNetwork(this.config.getNetwork())
|
|
28608
27842
|
).tweakedPubkey;
|
|
28609
27843
|
const isVerified = import_secp256k110.schnorr.verify(
|
|
28610
|
-
|
|
27844
|
+
address.depositAddressProof.proofOfPossessionSignature,
|
|
28611
27845
|
msg,
|
|
28612
27846
|
taprootKey
|
|
28613
27847
|
);
|
|
@@ -28616,17 +27850,17 @@ var DepositService = class {
|
|
|
28616
27850
|
"Proof of possession signature verification failed",
|
|
28617
27851
|
{
|
|
28618
27852
|
field: "proofOfPossessionSignature",
|
|
28619
|
-
value:
|
|
27853
|
+
value: address.depositAddressProof.proofOfPossessionSignature
|
|
28620
27854
|
}
|
|
28621
27855
|
);
|
|
28622
27856
|
}
|
|
28623
|
-
const addrHash = (0, import_sha210.sha256)(
|
|
27857
|
+
const addrHash = (0, import_sha210.sha256)(address.address);
|
|
28624
27858
|
for (const operator of Object.values(this.config.getSigningOperators())) {
|
|
28625
27859
|
if (operator.identifier === this.config.getCoordinatorIdentifier() && !verifyCoordinatorProof) {
|
|
28626
27860
|
continue;
|
|
28627
27861
|
}
|
|
28628
27862
|
const operatorPubkey2 = (0, import_utils16.hexToBytes)(operator.identityPublicKey);
|
|
28629
|
-
const operatorSig =
|
|
27863
|
+
const operatorSig = address.depositAddressProof.addressSignatures[operator.identifier];
|
|
28630
27864
|
if (!operatorSig) {
|
|
28631
27865
|
throw new ValidationError("Operator signature not found", {
|
|
28632
27866
|
field: "addressSignatures",
|
|
@@ -29582,7 +28816,7 @@ var import_utils20 = require("@noble/hashes/utils");
|
|
|
29582
28816
|
// src/utils/token-hashing.ts
|
|
29583
28817
|
init_buffer();
|
|
29584
28818
|
var import_sha212 = require("@noble/hashes/sha2");
|
|
29585
|
-
var
|
|
28819
|
+
var import_base5 = require("@scure/base");
|
|
29586
28820
|
function hashTokenTransaction(tokenTransaction, partialHash = false) {
|
|
29587
28821
|
switch (tokenTransaction.version) {
|
|
29588
28822
|
case 1:
|
|
@@ -29993,7 +29227,7 @@ function hashTokenTransactionV1(tokenTransaction, partialHash = false) {
|
|
|
29993
29227
|
}
|
|
29994
29228
|
const finalHashObj = import_sha212.sha256.create();
|
|
29995
29229
|
const concatenatedHashes = new Uint8Array(
|
|
29996
|
-
allHashes.reduce((
|
|
29230
|
+
allHashes.reduce((sum2, hash) => sum2 + hash.length, 0)
|
|
29997
29231
|
);
|
|
29998
29232
|
let offset = 0;
|
|
29999
29233
|
for (const hash of allHashes) {
|
|
@@ -30424,8 +29658,8 @@ function hashTokenTransactionV2(tokenTransaction, partialHash = false) {
|
|
|
30424
29658
|
const invoice = attachment.sparkInvoice;
|
|
30425
29659
|
let idBytes;
|
|
30426
29660
|
try {
|
|
30427
|
-
const decoded =
|
|
30428
|
-
const payload = SparkAddress.decode(
|
|
29661
|
+
const decoded = import_base5.bech32m.decode(invoice, 500);
|
|
29662
|
+
const payload = SparkAddress.decode(import_base5.bech32m.fromWords(decoded.words));
|
|
30429
29663
|
if (!payload.sparkInvoiceFields || !payload.sparkInvoiceFields.id) {
|
|
30430
29664
|
throw new Error("missing spark invoice fields or id");
|
|
30431
29665
|
}
|
|
@@ -30466,7 +29700,7 @@ function hashTokenTransactionV2(tokenTransaction, partialHash = false) {
|
|
|
30466
29700
|
}
|
|
30467
29701
|
const finalHashObj = import_sha212.sha256.create();
|
|
30468
29702
|
const concatenatedHashes = new Uint8Array(
|
|
30469
|
-
allHashes.reduce((
|
|
29703
|
+
allHashes.reduce((sum2, hash) => sum2 + hash.length, 0)
|
|
30470
29704
|
);
|
|
30471
29705
|
let offset = 0;
|
|
30472
29706
|
for (const hash of allHashes) {
|
|
@@ -30514,7 +29748,7 @@ function hashOperatorSpecificTokenTransactionSignablePayload(payload) {
|
|
|
30514
29748
|
allHashes.push(hashObj.digest());
|
|
30515
29749
|
const finalHashObj = import_sha212.sha256.create();
|
|
30516
29750
|
const concatenatedHashes = new Uint8Array(
|
|
30517
|
-
allHashes.reduce((
|
|
29751
|
+
allHashes.reduce((sum2, hash) => sum2 + hash.length, 0)
|
|
30518
29752
|
);
|
|
30519
29753
|
let offset = 0;
|
|
30520
29754
|
for (const hash of allHashes) {
|
|
@@ -30841,7 +30075,7 @@ var TokenTransactionService = class {
|
|
|
30841
30075
|
});
|
|
30842
30076
|
}
|
|
30843
30077
|
const totalTokenAmount = receiverOutputs.reduce(
|
|
30844
|
-
(
|
|
30078
|
+
(sum2, transfer) => sum2 + transfer.tokenAmount,
|
|
30845
30079
|
0n
|
|
30846
30080
|
);
|
|
30847
30081
|
let outputsToUse;
|
|
@@ -30929,7 +30163,7 @@ var TokenTransactionService = class {
|
|
|
30929
30163
|
);
|
|
30930
30164
|
const availableTokenAmount = sumAvailableTokens(selectedOutputs);
|
|
30931
30165
|
const totalRequestedAmount = tokenOutputData.reduce(
|
|
30932
|
-
(
|
|
30166
|
+
(sum2, output) => sum2 + output.tokenAmount,
|
|
30933
30167
|
0n
|
|
30934
30168
|
);
|
|
30935
30169
|
const tokenOutputs = tokenOutputData.map(
|
|
@@ -31305,15 +30539,15 @@ var TokenTransactionService = class {
|
|
|
31305
30539
|
sortTokenOutputsByStrategy(tokenOutputs, strategy) {
|
|
31306
30540
|
if (strategy === "SMALL_FIRST") {
|
|
31307
30541
|
tokenOutputs.sort((a, b) => {
|
|
31308
|
-
|
|
31309
|
-
|
|
31310
|
-
|
|
30542
|
+
const amountA = (0, import_utils19.bytesToNumberBE)(a.output.tokenAmount);
|
|
30543
|
+
const amountB = (0, import_utils19.bytesToNumberBE)(b.output.tokenAmount);
|
|
30544
|
+
return amountA < amountB ? -1 : amountA > amountB ? 1 : 0;
|
|
31311
30545
|
});
|
|
31312
30546
|
} else {
|
|
31313
30547
|
tokenOutputs.sort((a, b) => {
|
|
31314
|
-
|
|
31315
|
-
|
|
31316
|
-
|
|
30548
|
+
const amountA = (0, import_utils19.bytesToNumberBE)(a.output.tokenAmount);
|
|
30549
|
+
const amountB = (0, import_utils19.bytesToNumberBE)(b.output.tokenAmount);
|
|
30550
|
+
return amountB < amountA ? -1 : amountB > amountA ? 1 : 0;
|
|
31317
30551
|
});
|
|
31318
30552
|
}
|
|
31319
30553
|
}
|
|
@@ -31416,7 +30650,7 @@ var import_sha213 = require("@noble/hashes/sha2");
|
|
|
31416
30650
|
var import_api = require("@opentelemetry/api");
|
|
31417
30651
|
var import_sdk_trace_base = require("@opentelemetry/sdk-trace-base");
|
|
31418
30652
|
var import_eventemitter3 = require("eventemitter3");
|
|
31419
|
-
var
|
|
30653
|
+
var import_nice_grpc_common = require("nice-grpc-common");
|
|
31420
30654
|
|
|
31421
30655
|
// src/services/signing.ts
|
|
31422
30656
|
init_buffer();
|
|
@@ -31602,7 +30836,7 @@ var COIN_AMOUNT = 10000000n;
|
|
|
31602
30836
|
var FEE_AMOUNT = 1000n;
|
|
31603
30837
|
var TARGET_NUM_COINS = 20;
|
|
31604
30838
|
var BitcoinFaucet = class _BitcoinFaucet {
|
|
31605
|
-
constructor(url
|
|
30839
|
+
constructor(url, username, password) {
|
|
31606
30840
|
this.url = url;
|
|
31607
30841
|
this.username = username;
|
|
31608
30842
|
this.password = password;
|
|
@@ -31615,8 +30849,11 @@ var BitcoinFaucet = class _BitcoinFaucet {
|
|
|
31615
30849
|
static instance = null;
|
|
31616
30850
|
miningAddress;
|
|
31617
30851
|
lock = Promise.resolve();
|
|
31618
|
-
static getInstance(
|
|
30852
|
+
static getInstance() {
|
|
31619
30853
|
if (!_BitcoinFaucet.instance) {
|
|
30854
|
+
const url = process.env.BITCOIN_RPC_URL || (process.env.MINIKUBE_IP ? `http://${process.env.MINIKUBE_IP}:8332` : "http://127.0.0.1:8332");
|
|
30855
|
+
const username = process.env.BITCOIN_RPC_USER || "testutil";
|
|
30856
|
+
const password = process.env.BITCOIN_RPC_PASSWORD || "testutilpassword";
|
|
31620
30857
|
_BitcoinFaucet.instance = new _BitcoinFaucet(url, username, password);
|
|
31621
30858
|
}
|
|
31622
30859
|
return _BitcoinFaucet.instance;
|
|
@@ -31647,15 +30884,15 @@ var BitcoinFaucet = class _BitcoinFaucet {
|
|
|
31647
30884
|
}
|
|
31648
30885
|
async refill() {
|
|
31649
30886
|
const minerPubKey = import_secp256k112.secp256k1.getPublicKey(STATIC_MINING_KEY);
|
|
31650
|
-
const
|
|
30887
|
+
const address = getP2TRAddressFromPublicKey(minerPubKey, 4 /* LOCAL */);
|
|
31651
30888
|
const scanResult = await this.call("scantxoutset", [
|
|
31652
30889
|
"start",
|
|
31653
|
-
[`addr(${
|
|
30890
|
+
[`addr(${address})`]
|
|
31654
30891
|
]);
|
|
31655
30892
|
let selectedUtxo;
|
|
31656
30893
|
let selectedUtxoAmountSats;
|
|
31657
30894
|
if (!scanResult.success || scanResult.unspents.length === 0) {
|
|
31658
|
-
const blockHash = await this.generateToAddress(1,
|
|
30895
|
+
const blockHash = await this.generateToAddress(1, address);
|
|
31659
30896
|
const block = await this.getBlock(blockHash[0]);
|
|
31660
30897
|
const fundingTx = import_btc_signer5.Transaction.fromRaw((0, import_utils22.hexToBytes)(block.tx[0].hex), {
|
|
31661
30898
|
allowUnknownOutputs: true
|
|
@@ -31828,8 +31065,8 @@ var BitcoinFaucet = class _BitcoinFaucet {
|
|
|
31828
31065
|
);
|
|
31829
31066
|
}
|
|
31830
31067
|
}
|
|
31831
|
-
async generateToAddress(numBlocks,
|
|
31832
|
-
return await this.call("generatetoaddress", [numBlocks,
|
|
31068
|
+
async generateToAddress(numBlocks, address) {
|
|
31069
|
+
return await this.call("generatetoaddress", [numBlocks, address]);
|
|
31833
31070
|
}
|
|
31834
31071
|
async getBlock(blockHash) {
|
|
31835
31072
|
return await this.call("getblock", [blockHash, 2]);
|
|
@@ -31843,7 +31080,7 @@ var BitcoinFaucet = class _BitcoinFaucet {
|
|
|
31843
31080
|
const pubKey = import_secp256k112.secp256k1.getPublicKey(key);
|
|
31844
31081
|
return getP2TRAddressFromPublicKey(pubKey, 4 /* LOCAL */);
|
|
31845
31082
|
}
|
|
31846
|
-
async sendToAddress(
|
|
31083
|
+
async sendToAddress(address, amount, blocksToGenerate = 1) {
|
|
31847
31084
|
const coin = await this.fund();
|
|
31848
31085
|
if (!coin) {
|
|
31849
31086
|
throw new Error("No coins available");
|
|
@@ -31852,7 +31089,7 @@ var BitcoinFaucet = class _BitcoinFaucet {
|
|
|
31852
31089
|
tx.addInput(coin.outpoint);
|
|
31853
31090
|
const availableAmount = COIN_AMOUNT - FEE_AMOUNT;
|
|
31854
31091
|
const destinationAddress = (0, import_btc_signer5.Address)(getNetwork(4 /* LOCAL */)).decode(
|
|
31855
|
-
|
|
31092
|
+
address
|
|
31856
31093
|
);
|
|
31857
31094
|
const destinationScript = import_btc_signer5.OutScript.encode(destinationAddress);
|
|
31858
31095
|
tx.addOutput({
|
|
@@ -31899,6 +31136,76 @@ function chunkArray(arr, size) {
|
|
|
31899
31136
|
return chunks;
|
|
31900
31137
|
}
|
|
31901
31138
|
|
|
31139
|
+
// src/utils/optimize.ts
|
|
31140
|
+
init_buffer();
|
|
31141
|
+
var DENOMINATIONS = Array.from({ length: 28 }, (_, i) => 2 ** i);
|
|
31142
|
+
function assert(condition, message) {
|
|
31143
|
+
if (!condition) {
|
|
31144
|
+
throw new InternalValidationError(message || "Assertion failed");
|
|
31145
|
+
}
|
|
31146
|
+
}
|
|
31147
|
+
function sum(arr) {
|
|
31148
|
+
return arr.reduce((a, b) => a + b, 0);
|
|
31149
|
+
}
|
|
31150
|
+
function sorted(arr) {
|
|
31151
|
+
return [...arr].sort((a, b) => a - b);
|
|
31152
|
+
}
|
|
31153
|
+
function equals(a, b) {
|
|
31154
|
+
return a.length === b.length && a.every((val, index) => val === b[index]);
|
|
31155
|
+
}
|
|
31156
|
+
function greedyLeaves(amount) {
|
|
31157
|
+
const leaves = [];
|
|
31158
|
+
let remaining = amount;
|
|
31159
|
+
for (let i = DENOMINATIONS.length - 1; i >= 0; i--) {
|
|
31160
|
+
const leaf = DENOMINATIONS[i];
|
|
31161
|
+
if (typeof leaf === "number" && leaf > 0) {
|
|
31162
|
+
while (remaining >= leaf) {
|
|
31163
|
+
remaining -= leaf;
|
|
31164
|
+
leaves.push(leaf);
|
|
31165
|
+
}
|
|
31166
|
+
}
|
|
31167
|
+
}
|
|
31168
|
+
assert(sum(leaves) === amount, "greedy_leaves: sum mismatch");
|
|
31169
|
+
return sorted(leaves);
|
|
31170
|
+
}
|
|
31171
|
+
var Swap = class {
|
|
31172
|
+
inLeaves;
|
|
31173
|
+
outLeaves;
|
|
31174
|
+
constructor(inLeaves, outLeaves) {
|
|
31175
|
+
this.inLeaves = [...inLeaves];
|
|
31176
|
+
this.outLeaves = [...outLeaves];
|
|
31177
|
+
assert(
|
|
31178
|
+
sum(this.inLeaves) === sum(this.outLeaves),
|
|
31179
|
+
"Swap in/out leaves must sum to same value for swap: " + this.toString()
|
|
31180
|
+
);
|
|
31181
|
+
}
|
|
31182
|
+
toString() {
|
|
31183
|
+
return `Swap(in=${JSON.stringify(this.inLeaves)}, out=${JSON.stringify(this.outLeaves)})`;
|
|
31184
|
+
}
|
|
31185
|
+
};
|
|
31186
|
+
function maximizeUnilateralExit(inputLeaves, maxLeavesPerSwap = 64) {
|
|
31187
|
+
const swaps = [];
|
|
31188
|
+
let batch = [];
|
|
31189
|
+
let leaves = sorted(inputLeaves);
|
|
31190
|
+
while (leaves.length > 0) {
|
|
31191
|
+
batch.push(leaves.shift());
|
|
31192
|
+
const target = greedyLeaves(sum(batch));
|
|
31193
|
+
if (batch.length >= maxLeavesPerSwap || target.length >= maxLeavesPerSwap) {
|
|
31194
|
+
if (!equals(target, batch)) {
|
|
31195
|
+
swaps.push(new Swap([...batch], target));
|
|
31196
|
+
}
|
|
31197
|
+
batch = [];
|
|
31198
|
+
}
|
|
31199
|
+
}
|
|
31200
|
+
if (batch.length > 0) {
|
|
31201
|
+
const target = greedyLeaves(sum(batch));
|
|
31202
|
+
if (!equals(target, batch)) {
|
|
31203
|
+
swaps.push(new Swap([...batch], target));
|
|
31204
|
+
}
|
|
31205
|
+
}
|
|
31206
|
+
return swaps;
|
|
31207
|
+
}
|
|
31208
|
+
|
|
31902
31209
|
// src/utils/retry.ts
|
|
31903
31210
|
init_buffer();
|
|
31904
31211
|
var DEFAULT_RETRY_CONFIG = {
|
|
@@ -31978,7 +31285,7 @@ var SparkWalletEvent = {
|
|
|
31978
31285
|
};
|
|
31979
31286
|
|
|
31980
31287
|
// src/spark-wallet/spark-wallet.ts
|
|
31981
|
-
var SparkWallet = class
|
|
31288
|
+
var SparkWallet = class extends import_eventemitter3.EventEmitter {
|
|
31982
31289
|
config;
|
|
31983
31290
|
connectionManager;
|
|
31984
31291
|
transferService;
|
|
@@ -32002,10 +31309,11 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
32002
31309
|
// Add this property near the top of the class with other private properties
|
|
32003
31310
|
claimTransfersInterval = null;
|
|
32004
31311
|
tracer = null;
|
|
32005
|
-
constructor(options,
|
|
31312
|
+
constructor(options, signerArg) {
|
|
32006
31313
|
super();
|
|
31314
|
+
const signer = signerArg || this.buildSigner();
|
|
32007
31315
|
this.config = new WalletConfigService(options, signer);
|
|
32008
|
-
this.connectionManager =
|
|
31316
|
+
this.connectionManager = this.buildConnectionManager(this.config);
|
|
32009
31317
|
this.signingService = new SigningService(this.config);
|
|
32010
31318
|
this.depositService = new DepositService(
|
|
32011
31319
|
this.config,
|
|
@@ -32032,28 +31340,18 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
32032
31340
|
);
|
|
32033
31341
|
this.tracer = import_api.trace.getTracer(this.tracerId);
|
|
32034
31342
|
this.wrapSparkWalletMethodsWithTracing();
|
|
31343
|
+
this.initializeTracer(this);
|
|
31344
|
+
}
|
|
31345
|
+
static async initialize({ mnemonicOrSeed, accountNumber, signer, options = {} }) {
|
|
31346
|
+
const wallet = new this(options, signer);
|
|
31347
|
+
const initWalletResponse = await wallet.initWallet(
|
|
31348
|
+
mnemonicOrSeed,
|
|
31349
|
+
accountNumber,
|
|
31350
|
+
options
|
|
31351
|
+
);
|
|
31352
|
+
return initWalletResponse;
|
|
32035
31353
|
}
|
|
32036
|
-
|
|
32037
|
-
mnemonicOrSeed,
|
|
32038
|
-
accountNumber,
|
|
32039
|
-
signer,
|
|
32040
|
-
options
|
|
32041
|
-
}) {
|
|
32042
|
-
const wallet = new _SparkWallet(options, signer);
|
|
32043
|
-
wallet.initializeTracer(wallet);
|
|
32044
|
-
if (options && options.signerWithPreExistingKeys) {
|
|
32045
|
-
await wallet.initWalletWithoutSeed();
|
|
32046
|
-
return {
|
|
32047
|
-
wallet
|
|
32048
|
-
};
|
|
32049
|
-
}
|
|
32050
|
-
const initResponse = await wallet.initWallet(mnemonicOrSeed, accountNumber);
|
|
32051
|
-
return {
|
|
32052
|
-
wallet,
|
|
32053
|
-
...initResponse
|
|
32054
|
-
};
|
|
32055
|
-
}
|
|
32056
|
-
async initializeWallet() {
|
|
31354
|
+
async createClientsAndSyncWallet() {
|
|
32057
31355
|
this.sspClient = new SspClient(this.config);
|
|
32058
31356
|
await this.connectionManager.createClients();
|
|
32059
31357
|
if (isReactNative) {
|
|
@@ -32071,6 +31369,12 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
32071
31369
|
}
|
|
32072
31370
|
return this.sspClient;
|
|
32073
31371
|
}
|
|
31372
|
+
buildSigner() {
|
|
31373
|
+
return new DefaultSparkSigner();
|
|
31374
|
+
}
|
|
31375
|
+
buildConnectionManager(config) {
|
|
31376
|
+
return new ConnectionManager(config);
|
|
31377
|
+
}
|
|
32074
31378
|
async handleStreamEvent({ event }) {
|
|
32075
31379
|
try {
|
|
32076
31380
|
if (event?.$case === "transfer" && event.transfer.transfer && event.transfer.transfer.type !== 40 /* COUNTER_SWAP */) {
|
|
@@ -32125,9 +31429,9 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
32125
31429
|
let retryCount = 0;
|
|
32126
31430
|
while (retryCount <= MAX_RETRIES) {
|
|
32127
31431
|
try {
|
|
32128
|
-
const
|
|
32129
|
-
const sparkClient = await this.connectionManager.createSparkStreamClient(
|
|
32130
|
-
const channel = await this.connectionManager.getStreamChannel(
|
|
31432
|
+
const address = this.config.getCoordinatorAddress();
|
|
31433
|
+
const sparkClient = await this.connectionManager.createSparkStreamClient(address);
|
|
31434
|
+
const channel = await this.connectionManager.getStreamChannel(address);
|
|
32131
31435
|
const stream = sparkClient.subscribe_to_events(
|
|
32132
31436
|
{
|
|
32133
31437
|
identityPublicKey: await this.config.signer.getIdentityPublicKey()
|
|
@@ -32429,8 +31733,34 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
32429
31733
|
await this.withLeaves(async () => {
|
|
32430
31734
|
this.optimizationInProgress = true;
|
|
32431
31735
|
try {
|
|
32432
|
-
|
|
32433
|
-
|
|
31736
|
+
this.leaves = await this.getLeaves();
|
|
31737
|
+
const swaps = maximizeUnilateralExit(
|
|
31738
|
+
this.leaves.map((leaf) => leaf.value)
|
|
31739
|
+
);
|
|
31740
|
+
const valueToNodes = /* @__PURE__ */ new Map();
|
|
31741
|
+
this.leaves.forEach((leaf) => {
|
|
31742
|
+
if (!valueToNodes.has(leaf.value)) {
|
|
31743
|
+
valueToNodes.set(leaf.value, []);
|
|
31744
|
+
}
|
|
31745
|
+
valueToNodes.get(leaf.value).push(leaf);
|
|
31746
|
+
});
|
|
31747
|
+
for (const swap of swaps) {
|
|
31748
|
+
const leavesToSend = [];
|
|
31749
|
+
for (const leafValue of swap.inLeaves) {
|
|
31750
|
+
const nodes = valueToNodes.get(leafValue);
|
|
31751
|
+
if (nodes && nodes.length > 0) {
|
|
31752
|
+
const node = nodes.shift();
|
|
31753
|
+
leavesToSend.push(node);
|
|
31754
|
+
} else {
|
|
31755
|
+
throw new InternalValidationError(
|
|
31756
|
+
`No unused leaf with value ${leafValue} found in leaves`
|
|
31757
|
+
);
|
|
31758
|
+
}
|
|
31759
|
+
}
|
|
31760
|
+
await this.requestLeavesSwap({
|
|
31761
|
+
leaves: leavesToSend,
|
|
31762
|
+
targetAmounts: swap.outLeaves
|
|
31763
|
+
});
|
|
32434
31764
|
}
|
|
32435
31765
|
this.leaves = await this.getLeaves();
|
|
32436
31766
|
} finally {
|
|
@@ -32533,11 +31863,17 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
32533
31863
|
*
|
|
32534
31864
|
* @returns {Promise<Object>} Object containing:
|
|
32535
31865
|
* - mnemonic: The mnemonic if one was generated (undefined for raw seed)
|
|
32536
|
-
* -
|
|
32537
|
-
* - tokenBalance: Map of token balances
|
|
31866
|
+
* - wallet: The wallet instance
|
|
32538
31867
|
* @private
|
|
32539
31868
|
*/
|
|
32540
|
-
async initWallet(mnemonicOrSeed, accountNumber) {
|
|
31869
|
+
async initWallet(mnemonicOrSeed, accountNumber, options = {}) {
|
|
31870
|
+
if (options.signerWithPreExistingKeys) {
|
|
31871
|
+
await this.initWalletWithoutSeed();
|
|
31872
|
+
return {
|
|
31873
|
+
wallet: this,
|
|
31874
|
+
mnemonic: void 0
|
|
31875
|
+
};
|
|
31876
|
+
}
|
|
32541
31877
|
if (accountNumber === void 0) {
|
|
32542
31878
|
if (this.config.getNetwork() === 3 /* REGTEST */) {
|
|
32543
31879
|
accountNumber = 0;
|
|
@@ -32563,7 +31899,8 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
32563
31899
|
}
|
|
32564
31900
|
await this.initWalletFromSeed(seed, accountNumber);
|
|
32565
31901
|
return {
|
|
32566
|
-
mnemonic
|
|
31902
|
+
mnemonic,
|
|
31903
|
+
wallet: this
|
|
32567
31904
|
};
|
|
32568
31905
|
}
|
|
32569
31906
|
/**
|
|
@@ -32571,7 +31908,7 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
32571
31908
|
* @private
|
|
32572
31909
|
*/
|
|
32573
31910
|
async initWalletWithoutSeed() {
|
|
32574
|
-
await this.
|
|
31911
|
+
await this.createClientsAndSyncWallet();
|
|
32575
31912
|
const identityPublicKey = await this.config.signer.getIdentityPublicKey();
|
|
32576
31913
|
if (!identityPublicKey || identityPublicKey.length === 0) {
|
|
32577
31914
|
throw new ValidationError("Identity public key not found in signer", {
|
|
@@ -32594,7 +31931,7 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
32594
31931
|
*/
|
|
32595
31932
|
async initWalletFromSeed(seed, accountNumber) {
|
|
32596
31933
|
const identityPublicKey = await this.config.signer.createSparkWalletFromSeed(seed, accountNumber);
|
|
32597
|
-
await this.
|
|
31934
|
+
await this.createClientsAndSyncWallet();
|
|
32598
31935
|
this.sparkAddress = encodeSparkAddress({
|
|
32599
31936
|
identityPublicKey,
|
|
32600
31937
|
network: this.config.getNetworkType()
|
|
@@ -32994,6 +32331,10 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
32994
32331
|
directSignatureMap,
|
|
32995
32332
|
directFromCpfpSignatureMap
|
|
32996
32333
|
);
|
|
32334
|
+
const leavesToRemove = new Set(leavesBatch.map((leaf) => leaf.id));
|
|
32335
|
+
this.leaves = [
|
|
32336
|
+
...this.leaves.filter((leaf) => !leavesToRemove.has(leaf.id))
|
|
32337
|
+
];
|
|
32997
32338
|
const completeResponse = await sspClient.completeLeaveSwap({
|
|
32998
32339
|
adaptorSecretKey: (0, import_utils24.bytesToHex)(cpfpAdaptorPrivateKey),
|
|
32999
32340
|
directAdaptorSecretKey: (0, import_utils24.bytesToHex)(directAdaptorPrivateKey),
|
|
@@ -33141,16 +32482,16 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
33141
32482
|
*/
|
|
33142
32483
|
async getStaticDepositAddress() {
|
|
33143
32484
|
const signingPubkey = await this.config.signer.getStaticDepositSigningKey(0);
|
|
33144
|
-
const
|
|
32485
|
+
const address = await this.depositService.generateStaticDepositAddress({
|
|
33145
32486
|
signingPubkey
|
|
33146
32487
|
});
|
|
33147
|
-
if (!
|
|
32488
|
+
if (!address.depositAddress) {
|
|
33148
32489
|
throw new RPCError("Failed to generate static deposit address", {
|
|
33149
32490
|
method: "generateStaticDepositAddress",
|
|
33150
32491
|
params: { signingPubkey }
|
|
33151
32492
|
});
|
|
33152
32493
|
}
|
|
33153
|
-
return
|
|
32494
|
+
return address.depositAddress.address;
|
|
33154
32495
|
}
|
|
33155
32496
|
/**
|
|
33156
32497
|
* Generates a deposit address for receiving funds.
|
|
@@ -33163,17 +32504,17 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
33163
32504
|
type: "leaf" /* LEAF */,
|
|
33164
32505
|
path: leafId
|
|
33165
32506
|
});
|
|
33166
|
-
const
|
|
32507
|
+
const address = await this.depositService.generateDepositAddress({
|
|
33167
32508
|
signingPubkey,
|
|
33168
32509
|
leafId
|
|
33169
32510
|
});
|
|
33170
|
-
if (!
|
|
32511
|
+
if (!address.depositAddress) {
|
|
33171
32512
|
throw new RPCError("Failed to generate deposit address", {
|
|
33172
32513
|
method: "generateDepositAddress",
|
|
33173
32514
|
params: { signingPubkey, leafId }
|
|
33174
32515
|
});
|
|
33175
32516
|
}
|
|
33176
|
-
return
|
|
32517
|
+
return address.depositAddress.address;
|
|
33177
32518
|
}
|
|
33178
32519
|
async queryStaticDepositAddresses() {
|
|
33179
32520
|
const sparkClient = await this.connectionManager.createSparkClient(
|
|
@@ -33582,7 +32923,7 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
33582
32923
|
creditAmountView.setUint32(4, upperHalf, true);
|
|
33583
32924
|
parts.push(new Uint8Array(creditAmountBuffer));
|
|
33584
32925
|
parts.push((0, import_utils24.hexToBytes)(sspSignature));
|
|
33585
|
-
const totalLength = parts.reduce((
|
|
32926
|
+
const totalLength = parts.reduce((sum2, part) => sum2 + part.length, 0);
|
|
33586
32927
|
const payload = new Uint8Array(totalLength);
|
|
33587
32928
|
let offset = 0;
|
|
33588
32929
|
for (const part of parts) {
|
|
@@ -33608,10 +32949,10 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
33608
32949
|
continue;
|
|
33609
32950
|
}
|
|
33610
32951
|
const parsedScript = import_btc_signer6.OutScript.decode(output.script);
|
|
33611
|
-
const
|
|
32952
|
+
const address = (0, import_btc_signer6.Address)(getNetwork(this.config.getNetwork())).encode(
|
|
33612
32953
|
parsedScript
|
|
33613
32954
|
);
|
|
33614
|
-
if (staticDepositAddresses.has(
|
|
32955
|
+
if (staticDepositAddresses.has(address)) {
|
|
33615
32956
|
vout = i;
|
|
33616
32957
|
break;
|
|
33617
32958
|
}
|
|
@@ -33814,12 +33155,12 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
33814
33155
|
continue;
|
|
33815
33156
|
}
|
|
33816
33157
|
const parsedScript = import_btc_signer6.OutScript.decode(output.script);
|
|
33817
|
-
const
|
|
33158
|
+
const address = (0, import_btc_signer6.Address)(getNetwork(this.config.getNetwork())).encode(
|
|
33818
33159
|
parsedScript
|
|
33819
33160
|
);
|
|
33820
|
-
if (unusedDepositAddresses.has(
|
|
33161
|
+
if (unusedDepositAddresses.has(address)) {
|
|
33821
33162
|
vout = i;
|
|
33822
|
-
depositAddress = unusedDepositAddresses.get(
|
|
33163
|
+
depositAddress = unusedDepositAddresses.get(address);
|
|
33823
33164
|
break;
|
|
33824
33165
|
}
|
|
33825
33166
|
}
|
|
@@ -33875,10 +33216,10 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
33875
33216
|
continue;
|
|
33876
33217
|
}
|
|
33877
33218
|
const parsedScript = import_btc_signer6.OutScript.decode(output.script);
|
|
33878
|
-
const
|
|
33219
|
+
const address = (0, import_btc_signer6.Address)(getNetwork(this.config.getNetwork())).encode(
|
|
33879
33220
|
parsedScript
|
|
33880
33221
|
);
|
|
33881
|
-
const unusedDepositAddress = unusedDepositAddresses.get(
|
|
33222
|
+
const unusedDepositAddress = unusedDepositAddresses.get(address);
|
|
33882
33223
|
if (unusedDepositAddress) {
|
|
33883
33224
|
vout = i;
|
|
33884
33225
|
let keyDerivation;
|
|
@@ -34012,7 +33353,7 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
34012
33353
|
}
|
|
34013
33354
|
amountSatsArray.push(amountSats);
|
|
34014
33355
|
}
|
|
34015
|
-
|
|
33356
|
+
return await this.withLeaves(async () => {
|
|
34016
33357
|
const selectLeavesToSendMap = await this.selectLeaves(amountSatsArray);
|
|
34017
33358
|
for (const [amount, selection] of selectLeavesToSendMap) {
|
|
34018
33359
|
for (let groupIndex = 0; groupIndex < selection.length; groupIndex++) {
|
|
@@ -34048,47 +33389,46 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
34048
33389
|
if (idsToRemove.size > 0) {
|
|
34049
33390
|
this.leaves = this.leaves.filter((leaf) => !idsToRemove.has(leaf.id));
|
|
34050
33391
|
}
|
|
34051
|
-
|
|
34052
|
-
|
|
34053
|
-
|
|
34054
|
-
|
|
34055
|
-
|
|
34056
|
-
|
|
34057
|
-
|
|
34058
|
-
|
|
34059
|
-
|
|
34060
|
-
|
|
34061
|
-
|
|
34062
|
-
|
|
34063
|
-
signerIdentityPublicKey,
|
|
34064
|
-
job.receiverIdentityPubkey
|
|
34065
|
-
);
|
|
34066
|
-
if (isSelfTransfer) {
|
|
34067
|
-
const pending = await this.transferService.queryTransfer(
|
|
34068
|
-
transfer.id
|
|
33392
|
+
const signerIdentityPublicKey = await this.config.signer.getIdentityPublicKey();
|
|
33393
|
+
const outcomes = await Promise.all(
|
|
33394
|
+
jobs.map(async (job) => {
|
|
33395
|
+
try {
|
|
33396
|
+
const transfer = await this.transferService.sendTransferWithKeyTweaks(
|
|
33397
|
+
job.leafKeyTweaks,
|
|
33398
|
+
job.receiverIdentityPubkey,
|
|
33399
|
+
job.sparkInvoice
|
|
33400
|
+
);
|
|
33401
|
+
const isSelfTransfer = (0, import_utils24.equalBytes)(
|
|
33402
|
+
signerIdentityPublicKey,
|
|
33403
|
+
job.receiverIdentityPubkey
|
|
34069
33404
|
);
|
|
34070
|
-
if (
|
|
34071
|
-
await this.
|
|
33405
|
+
if (isSelfTransfer) {
|
|
33406
|
+
const pending = await this.transferService.queryTransfer(
|
|
33407
|
+
transfer.id
|
|
33408
|
+
);
|
|
33409
|
+
if (pending) {
|
|
33410
|
+
await this.claimTransfer({ transfer: pending, optimize: true });
|
|
33411
|
+
}
|
|
34072
33412
|
}
|
|
33413
|
+
return {
|
|
33414
|
+
ok: true,
|
|
33415
|
+
transfer: mapTransferToWalletTransfer(
|
|
33416
|
+
transfer,
|
|
33417
|
+
(0, import_utils24.bytesToHex)(await this.config.signer.getIdentityPublicKey())
|
|
33418
|
+
),
|
|
33419
|
+
param: job.param
|
|
33420
|
+
};
|
|
33421
|
+
} catch (error) {
|
|
33422
|
+
return {
|
|
33423
|
+
ok: false,
|
|
33424
|
+
error: error instanceof Error ? error : new Error(String(error)),
|
|
33425
|
+
param: job.param
|
|
33426
|
+
};
|
|
34073
33427
|
}
|
|
34074
|
-
|
|
34075
|
-
|
|
34076
|
-
|
|
34077
|
-
|
|
34078
|
-
(0, import_utils24.bytesToHex)(await this.config.signer.getIdentityPublicKey())
|
|
34079
|
-
),
|
|
34080
|
-
param: job.param
|
|
34081
|
-
};
|
|
34082
|
-
} catch (error) {
|
|
34083
|
-
return {
|
|
34084
|
-
ok: false,
|
|
34085
|
-
error: error instanceof Error ? error : new Error(String(error)),
|
|
34086
|
-
param: job.param
|
|
34087
|
-
};
|
|
34088
|
-
}
|
|
34089
|
-
})
|
|
34090
|
-
);
|
|
34091
|
-
return outcomes;
|
|
33428
|
+
})
|
|
33429
|
+
);
|
|
33430
|
+
return outcomes;
|
|
33431
|
+
});
|
|
34092
33432
|
}
|
|
34093
33433
|
buildTweaksByAmount(selectedByAmount) {
|
|
34094
33434
|
const tweaksByAmount = /* @__PURE__ */ new Map();
|
|
@@ -34293,7 +33633,7 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
34293
33633
|
}) {
|
|
34294
33634
|
const onError = async (context) => {
|
|
34295
33635
|
const error = context.error;
|
|
34296
|
-
if (error instanceof RPCError && error.originalError instanceof
|
|
33636
|
+
if (error instanceof RPCError && error.originalError instanceof import_nice_grpc_common.ClientError && error.originalError.code === import_nice_grpc_common.Status.ALREADY_EXISTS) {
|
|
34297
33637
|
const transferToUse = context.data || transfer;
|
|
34298
33638
|
const updatedTransfer = await this.transferService.queryTransfer(
|
|
34299
33639
|
transferToUse.id
|
|
@@ -34679,8 +34019,8 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
34679
34019
|
);
|
|
34680
34020
|
const sspResponse = await sspClient.requestLightningSend({
|
|
34681
34021
|
encodedInvoice: invoice,
|
|
34682
|
-
|
|
34683
|
-
|
|
34022
|
+
amountSats: isZeroAmountInvoice ? amountSatsToSend : void 0,
|
|
34023
|
+
userOutboundTransferExternalId: swapResponse.transfer.id
|
|
34684
34024
|
});
|
|
34685
34025
|
if (!sspResponse) {
|
|
34686
34026
|
throw new Error("Failed to contact SSP");
|
|
@@ -34986,12 +34326,13 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
34986
34326
|
}
|
|
34987
34327
|
}))
|
|
34988
34328
|
);
|
|
34329
|
+
const transferId = (0, import_uuidv75.uuidv7)();
|
|
34989
34330
|
const requestCoopExitParams = {
|
|
34990
34331
|
leafExternalIds: leavesToSendToSsp.map((leaf) => leaf.id),
|
|
34991
34332
|
withdrawalAddress: onchainAddress,
|
|
34992
|
-
idempotencyKey: (0, import_uuidv75.uuidv7)(),
|
|
34993
34333
|
exitSpeed,
|
|
34994
|
-
withdrawAll: deductFeeFromWithdrawalAmount
|
|
34334
|
+
withdrawAll: deductFeeFromWithdrawalAmount,
|
|
34335
|
+
userOutboundTransferExternalId: transferId
|
|
34995
34336
|
};
|
|
34996
34337
|
if (!deductFeeFromWithdrawalAmount) {
|
|
34997
34338
|
requestCoopExitParams.feeQuoteId = feeEstimate.id;
|
|
@@ -35026,11 +34367,11 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
35026
34367
|
leaves: leafKeyTweaks,
|
|
35027
34368
|
exitTxId: coopExitTxId,
|
|
35028
34369
|
connectorOutputs,
|
|
35029
|
-
receiverPubKey: sspPubIdentityKey
|
|
34370
|
+
receiverPubKey: sspPubIdentityKey,
|
|
34371
|
+
transferId
|
|
35030
34372
|
});
|
|
35031
34373
|
const completeResponse = await sspClient.completeCoopExit({
|
|
35032
|
-
userOutboundTransferExternalId: transfer.transfer.id
|
|
35033
|
-
coopExitRequestId: coopExitRequest.id
|
|
34374
|
+
userOutboundTransferExternalId: transfer.transfer.id
|
|
35034
34375
|
});
|
|
35035
34376
|
return completeResponse;
|
|
35036
34377
|
}
|
|
@@ -35712,11 +35053,11 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
35712
35053
|
this.leaves.push(...leavesToAdd);
|
|
35713
35054
|
}
|
|
35714
35055
|
async queryNodes(baseRequest, sparkClientAddress, pageSize = 100) {
|
|
35715
|
-
const
|
|
35056
|
+
const address = sparkClientAddress ?? this.config.getCoordinatorAddress();
|
|
35716
35057
|
const aggregatedNodes = {};
|
|
35717
35058
|
let offset = 0;
|
|
35718
35059
|
while (true) {
|
|
35719
|
-
const sparkClient = await this.connectionManager.createSparkClient(
|
|
35060
|
+
const sparkClient = await this.connectionManager.createSparkClient(address);
|
|
35720
35061
|
const response = await sparkClient.query_nodes({
|
|
35721
35062
|
...baseRequest,
|
|
35722
35063
|
limit: pageSize,
|
|
@@ -35752,7 +35093,6 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
35752
35093
|
const consoleOptions = wallet.config.getConsoleOptions();
|
|
35753
35094
|
const spanProcessors = [];
|
|
35754
35095
|
if (consoleOptions.otel) {
|
|
35755
|
-
console.log("OpenTelemetry client logging enabled.");
|
|
35756
35096
|
spanProcessors.push(new import_sdk_trace_base.SimpleSpanProcessor(new import_sdk_trace_base.ConsoleSpanExporter()));
|
|
35757
35097
|
}
|
|
35758
35098
|
const traceUrls = this.getOtelTraceUrls();
|
|
@@ -35851,27 +35191,96 @@ var import_instrumentation = require("@opentelemetry/instrumentation");
|
|
|
35851
35191
|
var import_instrumentation_fetch = require("@opentelemetry/instrumentation-fetch");
|
|
35852
35192
|
var import_core14 = require("@opentelemetry/core");
|
|
35853
35193
|
var import_api2 = require("@opentelemetry/api");
|
|
35854
|
-
|
|
35855
|
-
|
|
35856
|
-
|
|
35857
|
-
|
|
35858
|
-
|
|
35859
|
-
|
|
35860
|
-
|
|
35861
|
-
|
|
35862
|
-
|
|
35863
|
-
|
|
35864
|
-
|
|
35865
|
-
|
|
35866
|
-
|
|
35867
|
-
|
|
35194
|
+
|
|
35195
|
+
// src/services/connection/connection.browser.ts
|
|
35196
|
+
init_buffer();
|
|
35197
|
+
var import_nice_grpc_web = require("nice-grpc-web");
|
|
35198
|
+
var import_nice_grpc_common2 = require("nice-grpc-common");
|
|
35199
|
+
var import_nice_grpc_client_middleware_retry = require("nice-grpc-client-middleware-retry");
|
|
35200
|
+
var ConnectionManagerBrowser = class extends ConnectionManager {
|
|
35201
|
+
transport;
|
|
35202
|
+
constructor(config, transport = (0, import_nice_grpc_web.FetchTransport)()) {
|
|
35203
|
+
super(config);
|
|
35204
|
+
this.transport = transport;
|
|
35205
|
+
}
|
|
35206
|
+
async createChannelWithTLS(address, certPath) {
|
|
35207
|
+
try {
|
|
35208
|
+
return (0, import_nice_grpc_web.createChannel)(address, this.transport);
|
|
35209
|
+
} catch (error) {
|
|
35210
|
+
console.error("Channel creation error:", error);
|
|
35211
|
+
throw new NetworkError(
|
|
35212
|
+
"Failed to create channel",
|
|
35213
|
+
{
|
|
35214
|
+
url: address,
|
|
35215
|
+
operation: "createChannel",
|
|
35216
|
+
errorCount: 1,
|
|
35217
|
+
errors: error instanceof Error ? error.message : String(error)
|
|
35218
|
+
},
|
|
35219
|
+
error
|
|
35220
|
+
);
|
|
35221
|
+
}
|
|
35222
|
+
}
|
|
35223
|
+
createAuthnMiddleware() {
|
|
35224
|
+
return async function* (call, options) {
|
|
35225
|
+
const metadata = (0, import_nice_grpc_common2.Metadata)(options.metadata).set("X-Requested-With", "XMLHttpRequest").set("X-Grpc-Web", "1").set("X-Client-Env", clientEnv).set("Content-Type", "application/grpc-web+proto");
|
|
35226
|
+
return yield* call.next(call.request, {
|
|
35227
|
+
...options,
|
|
35228
|
+
metadata
|
|
35229
|
+
});
|
|
35230
|
+
}.bind(this);
|
|
35231
|
+
}
|
|
35232
|
+
createMiddleware(address, initialAuthToken) {
|
|
35233
|
+
return async function* (call, options) {
|
|
35234
|
+
const metadata = (0, import_nice_grpc_common2.Metadata)(options.metadata).set("X-Requested-With", "XMLHttpRequest").set("X-Grpc-Web", "1").set("X-Client-Env", clientEnv).set("Content-Type", "application/grpc-web+proto");
|
|
35235
|
+
try {
|
|
35236
|
+
return yield* call.next(call.request, {
|
|
35237
|
+
...options,
|
|
35238
|
+
metadata: metadata.set(
|
|
35239
|
+
"Authorization",
|
|
35240
|
+
`Bearer ${this.clients.get(address)?.authToken || initialAuthToken}`
|
|
35241
|
+
)
|
|
35242
|
+
});
|
|
35243
|
+
} catch (error) {
|
|
35244
|
+
return yield* this.handleMiddlewareError(
|
|
35245
|
+
error,
|
|
35246
|
+
address,
|
|
35247
|
+
call,
|
|
35248
|
+
metadata,
|
|
35249
|
+
options
|
|
35250
|
+
);
|
|
35251
|
+
}
|
|
35252
|
+
}.bind(this);
|
|
35253
|
+
}
|
|
35254
|
+
async createGrpcClient(defintion, channel, withRetries, middleware) {
|
|
35255
|
+
let clientFactory;
|
|
35256
|
+
const retryOptions = {
|
|
35257
|
+
retry: true,
|
|
35258
|
+
retryMaxAttempts: 3
|
|
35259
|
+
};
|
|
35260
|
+
let options = {};
|
|
35261
|
+
clientFactory = (0, import_nice_grpc_web.createClientFactory)();
|
|
35262
|
+
if (withRetries) {
|
|
35263
|
+
options = retryOptions;
|
|
35264
|
+
clientFactory = clientFactory.use(import_nice_grpc_client_middleware_retry.retryMiddleware);
|
|
35868
35265
|
}
|
|
35869
|
-
|
|
35266
|
+
if (middleware) {
|
|
35267
|
+
clientFactory = clientFactory.use(middleware);
|
|
35268
|
+
}
|
|
35269
|
+
const client = clientFactory.create(defintion, channel, {
|
|
35270
|
+
"*": options
|
|
35271
|
+
});
|
|
35870
35272
|
return {
|
|
35871
|
-
|
|
35872
|
-
|
|
35273
|
+
...client,
|
|
35274
|
+
close: void 0
|
|
35873
35275
|
};
|
|
35874
35276
|
}
|
|
35277
|
+
};
|
|
35278
|
+
|
|
35279
|
+
// src/spark-wallet/spark-wallet.browser.ts
|
|
35280
|
+
var SparkWalletBrowser = class extends SparkWallet {
|
|
35281
|
+
buildConnectionManager(config) {
|
|
35282
|
+
return new ConnectionManagerBrowser(config);
|
|
35283
|
+
}
|
|
35875
35284
|
initializeTracerEnv({
|
|
35876
35285
|
spanProcessors,
|
|
35877
35286
|
traceUrls
|
|
@@ -35909,6 +35318,7 @@ setCrypto(cryptoImpl2);
|
|
|
35909
35318
|
0 && (module.exports = {
|
|
35910
35319
|
AuthenticationError,
|
|
35911
35320
|
ConfigurationError,
|
|
35321
|
+
ConnectionManager,
|
|
35912
35322
|
DEFAULT_FEE_SATS,
|
|
35913
35323
|
DIRECT_TIMELOCK_OFFSET,
|
|
35914
35324
|
DefaultSparkSigner,
|
|
@@ -35917,7 +35327,6 @@ setCrypto(cryptoImpl2);
|
|
|
35917
35327
|
InternalValidationError,
|
|
35918
35328
|
KeyDerivationType,
|
|
35919
35329
|
LOGGER_NAMES,
|
|
35920
|
-
LRC_WALLET_NETWORK,
|
|
35921
35330
|
Network,
|
|
35922
35331
|
NetworkError,
|
|
35923
35332
|
NetworkToProto,
|