@buildonspark/spark-sdk 0.3.5 → 0.3.6
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 +6 -0
- package/dist/bare/index.cjs +539 -1237
- package/dist/bare/index.d.cts +676 -79
- package/dist/bare/index.d.ts +676 -79
- package/dist/bare/index.js +535 -1057
- package/dist/chunk-EHKP3Y65.js +140 -0
- package/dist/chunk-FJ7LTA2O.js +605 -0
- package/dist/chunk-LIZFXQWK.js +7 -0
- package/dist/{chunk-JE73HB26.js → chunk-XPHYQ2L6.js} +8125 -8731
- package/dist/{client-DWml6sjL.d.cts → client-AHn11NHe.d.cts} +1 -1
- package/dist/{client-DBZ43pJT.d.ts → client-GOlkXliC.d.ts} +1 -1
- package/dist/debug.cjs +573 -1221
- 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 +523 -1230
- 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 +1192 -1440
- 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-BUpzk4Z6.d.cts → logging-CW3kwBaM.d.cts} +3 -3
- package/dist/{logging-Dt2ooQiP.d.ts → logging-D7ukPwRA.d.ts} +3 -3
- package/dist/native/{chunk-D3SZRO65.js → chunk-X2QXUON7.js} +15 -0
- package/dist/native/index.cjs +694 -1213
- package/dist/native/index.d.cts +1077 -477
- package/dist/native/index.d.ts +1077 -477
- package/dist/native/index.js +692 -1041
- 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-NxG55m7K.d.cts} +105 -74
- package/dist/{spark-wallet-BoMIOPWW.d.cts → spark-wallet-jwNvWvpK.d.ts} +105 -74
- package/dist/spark-wallet.browser-Cg4fB-Nm.d.ts +26 -0
- package/dist/spark-wallet.browser-Db7Y95Kt.d.cts +26 -0
- package/dist/spark-wallet.node-DB3ZqtJG.d.ts +90 -0
- package/dist/spark-wallet.node-HEG2ahNd.d.cts +90 -0
- package/dist/tests/test-utils.cjs +17560 -7615
- package/dist/tests/test-utils.d.cts +7 -21
- package/dist/tests/test-utils.d.ts +7 -21
- package/dist/tests/test-utils.js +30 -4
- package/dist/{token-transactions-DscJaJOE.d.ts → token-transactions-B2-BO7Oz.d.ts} +2 -2
- package/dist/{token-transactions-BDzCrQSk.d.cts → token-transactions-BAN68xwg.d.cts} +2 -2
- package/dist/types/index.d.cts +2 -2
- package/dist/types/index.d.ts +2 -2
- package/package.json +7 -13
- package/src/bare/index.ts +1 -1
- package/src/debug.ts +1 -1
- package/src/index.node.ts +2 -1
- package/src/index.ts +2 -1
- package/src/native/index.ts +3 -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} +48 -259
- package/src/services/coop-exit.ts +3 -3
- 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 +1 -1
- 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 +10 -24
- package/src/spark-wallet/spark-wallet.node.ts +4 -24
- package/src/spark-wallet/spark-wallet.react-native.ts +15 -0
- package/src/spark-wallet/spark-wallet.ts +75 -74
- package/src/spark-wallet/types.ts +4 -2
- package/src/tests/integration/coop-exit.test.ts +3 -3
- package/src/tests/integration/lightning.test.ts +4 -4
- package/src/tests/integration/ssp/coop-exit-validation.test.ts +3 -5
- 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 +49 -66
- 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/spark-wallet/queryNodes.test.ts +1 -2
- package/src/tests/test-utils.ts +3 -3
- package/src/tests/token-outputs.test.ts +1 -1
- package/src/tests/utils/spark-testing-wallet.ts +18 -58
- package/src/tests/utils/utils.ts +63 -0
- package/src/tests/wrapWithOtelSpan.test.ts +7 -0
- package/src/utils/network.ts +11 -10
- 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/dist/index.node.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.node.ts
|
|
1419
1245
|
var index_node_exports = {};
|
|
1420
1246
|
__export(index_node_exports, {
|
|
1421
1247
|
AuthenticationError: () => AuthenticationError,
|
|
1422
1248
|
ConfigurationError: () => ConfigurationError,
|
|
1249
|
+
ConnectionManager: () => ConnectionManagerNodeJS,
|
|
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_node_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,
|
|
@@ -17491,16 +17317,16 @@ function encodeSparkAddressWithSignature(payload, signature) {
|
|
|
17491
17317
|
);
|
|
17492
17318
|
}
|
|
17493
17319
|
}
|
|
17494
|
-
function decodeSparkAddress(
|
|
17320
|
+
function decodeSparkAddress(address, network) {
|
|
17495
17321
|
try {
|
|
17496
|
-
if (network !== getNetworkFromSparkAddress(
|
|
17322
|
+
if (network !== getNetworkFromSparkAddress(address)) {
|
|
17497
17323
|
throw new ValidationError("Invalid Spark address prefix", {
|
|
17498
17324
|
field: "address",
|
|
17499
|
-
value:
|
|
17325
|
+
value: address,
|
|
17500
17326
|
expected: `prefix='${AddressNetwork[network]}' or '${LegacyAddressNetwork[network]}'`
|
|
17501
17327
|
});
|
|
17502
17328
|
}
|
|
17503
|
-
const decoded = bech32mDecode(
|
|
17329
|
+
const decoded = bech32mDecode(address);
|
|
17504
17330
|
const payload = SparkAddress.decode(import_base2.bech32m.fromWords(decoded.words));
|
|
17505
17331
|
const { identityPublicKey, sparkInvoiceFields, signature } = payload;
|
|
17506
17332
|
const identityPubkeyHex = (0, import_utils3.bytesToHex)(identityPublicKey);
|
|
@@ -17538,7 +17364,7 @@ function decodeSparkAddress(address2, network) {
|
|
|
17538
17364
|
"Failed to decode Spark address",
|
|
17539
17365
|
{
|
|
17540
17366
|
field: "address",
|
|
17541
|
-
value:
|
|
17367
|
+
value: address
|
|
17542
17368
|
},
|
|
17543
17369
|
error
|
|
17544
17370
|
);
|
|
@@ -17550,30 +17376,30 @@ var PrefixToNetwork = Object.fromEntries(
|
|
|
17550
17376
|
var LegacyPrefixToNetwork = Object.fromEntries(
|
|
17551
17377
|
Object.entries(LegacyAddressNetwork).map(([k, v]) => [v, k])
|
|
17552
17378
|
);
|
|
17553
|
-
function getNetworkFromSparkAddress(
|
|
17554
|
-
const { prefix } = bech32mDecode(
|
|
17379
|
+
function getNetworkFromSparkAddress(address) {
|
|
17380
|
+
const { prefix } = bech32mDecode(address);
|
|
17555
17381
|
const network = PrefixToNetwork[prefix] ?? LegacyPrefixToNetwork[prefix];
|
|
17556
17382
|
if (!network) {
|
|
17557
17383
|
throw new ValidationError("Invalid Spark address prefix", {
|
|
17558
17384
|
field: "network",
|
|
17559
|
-
value:
|
|
17385
|
+
value: address,
|
|
17560
17386
|
expected: "prefix='spark1', 'sparkt1', 'sparkrt1', 'sparks1', 'sparkl1' or legacy ('sp1', 'spt1', 'sprt1', 'sps1', 'spl1')"
|
|
17561
17387
|
});
|
|
17562
17388
|
}
|
|
17563
17389
|
return network;
|
|
17564
17390
|
}
|
|
17565
|
-
function isLegacySparkAddress(
|
|
17391
|
+
function isLegacySparkAddress(address) {
|
|
17566
17392
|
try {
|
|
17567
|
-
const { prefix } = bech32mDecode(
|
|
17393
|
+
const { prefix } = bech32mDecode(address);
|
|
17568
17394
|
return prefix in LegacyPrefixToNetwork;
|
|
17569
17395
|
} catch (error) {
|
|
17570
17396
|
return false;
|
|
17571
17397
|
}
|
|
17572
17398
|
}
|
|
17573
|
-
function isValidSparkAddress(
|
|
17399
|
+
function isValidSparkAddress(address) {
|
|
17574
17400
|
try {
|
|
17575
|
-
const network = getNetworkFromSparkAddress(
|
|
17576
|
-
decodeSparkAddress(
|
|
17401
|
+
const network = getNetworkFromSparkAddress(address);
|
|
17402
|
+
decodeSparkAddress(address, network);
|
|
17577
17403
|
return true;
|
|
17578
17404
|
} catch (error) {
|
|
17579
17405
|
if (error instanceof ValidationError) {
|
|
@@ -17583,7 +17409,7 @@ function isValidSparkAddress(address2) {
|
|
|
17583
17409
|
"Invalid Spark address",
|
|
17584
17410
|
{
|
|
17585
17411
|
field: "address",
|
|
17586
|
-
value:
|
|
17412
|
+
value: address
|
|
17587
17413
|
},
|
|
17588
17414
|
error
|
|
17589
17415
|
);
|
|
@@ -17776,9 +17602,9 @@ function assertBech32(s) {
|
|
|
17776
17602
|
const i = s.lastIndexOf("1");
|
|
17777
17603
|
if (i <= 0 || i >= s.length - 1) throw new Error("invalid bech32 string");
|
|
17778
17604
|
}
|
|
17779
|
-
function bech32mDecode(
|
|
17780
|
-
assertBech32(
|
|
17781
|
-
return import_base2.bech32m.decode(
|
|
17605
|
+
function bech32mDecode(address) {
|
|
17606
|
+
assertBech32(address);
|
|
17607
|
+
return import_base2.bech32m.decode(address, BECH32M_LIMIT);
|
|
17782
17608
|
}
|
|
17783
17609
|
function bech32mEncode(prefix, words) {
|
|
17784
17610
|
return import_base2.bech32m.encode(prefix, words, BECH32M_LIMIT);
|
|
@@ -17953,7 +17779,7 @@ var btc2 = __toESM(require("@scure/btc-signer"), 1);
|
|
|
17953
17779
|
// src/utils/network.ts
|
|
17954
17780
|
init_buffer();
|
|
17955
17781
|
var btc = __toESM(require("@scure/btc-signer"), 1);
|
|
17956
|
-
var
|
|
17782
|
+
var import_base3 = require("@scure/base");
|
|
17957
17783
|
|
|
17958
17784
|
// src/graphql/objects/BitcoinNetwork.ts
|
|
17959
17785
|
init_buffer();
|
|
@@ -18005,16 +17831,16 @@ var NetworkConfig = {
|
|
|
18005
17831
|
[4 /* LOCAL */]: { ...btc.TEST_NETWORK, bech32: "bcrt" }
|
|
18006
17832
|
};
|
|
18007
17833
|
var getNetwork = (network) => NetworkConfig[network];
|
|
18008
|
-
|
|
18009
|
-
[0 /* MAINNET */]: bitcoin.networks.bitcoin,
|
|
18010
|
-
[1 /* TESTNET */]: bitcoin.networks.testnet,
|
|
18011
|
-
[2 /* SIGNET */]: bitcoin.networks.testnet,
|
|
18012
|
-
[3 /* REGTEST */]: bitcoin.networks.regtest,
|
|
18013
|
-
[4 /* LOCAL */]: bitcoin.networks.regtest
|
|
18014
|
-
});
|
|
18015
|
-
function getNetworkFromAddress(address2) {
|
|
17834
|
+
function getNetworkFromAddress(address) {
|
|
18016
17835
|
try {
|
|
18017
|
-
const
|
|
17836
|
+
const bechAddress = address;
|
|
17837
|
+
const decoded = (() => {
|
|
17838
|
+
try {
|
|
17839
|
+
return import_base3.bech32.decode(bechAddress);
|
|
17840
|
+
} catch (_) {
|
|
17841
|
+
return import_base3.bech32m.decode(bechAddress);
|
|
17842
|
+
}
|
|
17843
|
+
})();
|
|
18018
17844
|
if (decoded.prefix === "bc") {
|
|
18019
17845
|
return "MAINNET" /* MAINNET */;
|
|
18020
17846
|
} else if (decoded.prefix === "bcrt") {
|
|
@@ -18025,7 +17851,7 @@ function getNetworkFromAddress(address2) {
|
|
|
18025
17851
|
"Invalid Bitcoin address",
|
|
18026
17852
|
{
|
|
18027
17853
|
field: "address",
|
|
18028
|
-
value:
|
|
17854
|
+
value: address,
|
|
18029
17855
|
expected: "Valid Bech32 address with prefix 'bc' or 'bcrt'"
|
|
18030
17856
|
},
|
|
18031
17857
|
err instanceof Error ? err : void 0
|
|
@@ -18088,18 +17914,18 @@ function getP2TRAddressFromPublicKey(pubKey, network) {
|
|
|
18088
17914
|
});
|
|
18089
17915
|
}
|
|
18090
17916
|
const internalKey = import_secp256k13.secp256k1.Point.fromHex(pubKey);
|
|
18091
|
-
const
|
|
17917
|
+
const address = btc2.p2tr(
|
|
18092
17918
|
internalKey.toBytes().slice(1, 33),
|
|
18093
17919
|
void 0,
|
|
18094
17920
|
getNetwork(network)
|
|
18095
17921
|
).address;
|
|
18096
|
-
if (!
|
|
17922
|
+
if (!address) {
|
|
18097
17923
|
throw new ValidationError("Failed to get P2TR address", {
|
|
18098
17924
|
field: "address",
|
|
18099
17925
|
value: "null"
|
|
18100
17926
|
});
|
|
18101
17927
|
}
|
|
18102
|
-
return
|
|
17928
|
+
return address;
|
|
18103
17929
|
}
|
|
18104
17930
|
function getP2TRAddressFromPkScript(pkScript, network) {
|
|
18105
17931
|
if (pkScript.length !== 34 || pkScript[0] !== 81 || pkScript[1] !== 32) {
|
|
@@ -18120,14 +17946,14 @@ function getP2WPKHAddressFromPublicKey(pubKey, network) {
|
|
|
18120
17946
|
expected: 33
|
|
18121
17947
|
});
|
|
18122
17948
|
}
|
|
18123
|
-
const
|
|
18124
|
-
if (!
|
|
17949
|
+
const address = btc2.p2wpkh(pubKey, getNetwork(network)).address;
|
|
17950
|
+
if (!address) {
|
|
18125
17951
|
throw new ValidationError("Failed to get P2WPKH address", {
|
|
18126
17952
|
field: "address",
|
|
18127
17953
|
value: "null"
|
|
18128
17954
|
});
|
|
18129
17955
|
}
|
|
18130
|
-
return
|
|
17956
|
+
return address;
|
|
18131
17957
|
}
|
|
18132
17958
|
function getTxFromRawTxHex(rawTxHex) {
|
|
18133
17959
|
const txBytes = (0, import_utils5.hexToBytes)(rawTxHex);
|
|
@@ -19515,9 +19341,9 @@ var getFetch = () => {
|
|
|
19515
19341
|
};
|
|
19516
19342
|
|
|
19517
19343
|
// src/utils/mempool.ts
|
|
19518
|
-
async function getLatestDepositTxId(
|
|
19344
|
+
async function getLatestDepositTxId(address) {
|
|
19519
19345
|
const { fetch, Headers: Headers2 } = getFetch();
|
|
19520
|
-
const network = getNetworkFromAddress(
|
|
19346
|
+
const network = getNetworkFromAddress(address);
|
|
19521
19347
|
const baseUrl = network === BitcoinNetwork_default.REGTEST ? getElectrsUrl("REGTEST") : getElectrsUrl("MAINNET");
|
|
19522
19348
|
const headers = new Headers2();
|
|
19523
19349
|
if (network === BitcoinNetwork_default.REGTEST) {
|
|
@@ -19526,14 +19352,14 @@ async function getLatestDepositTxId(address2) {
|
|
|
19526
19352
|
);
|
|
19527
19353
|
headers.set("Authorization", `Basic ${auth}`);
|
|
19528
19354
|
}
|
|
19529
|
-
const response = await fetch(`${baseUrl}/address/${
|
|
19355
|
+
const response = await fetch(`${baseUrl}/address/${address}/txs`, {
|
|
19530
19356
|
headers
|
|
19531
19357
|
});
|
|
19532
19358
|
const addressTxs = await response.json();
|
|
19533
19359
|
if (addressTxs && addressTxs.length > 0) {
|
|
19534
19360
|
const latestTx = addressTxs[0];
|
|
19535
19361
|
const outputIndex = latestTx.vout.findIndex(
|
|
19536
|
-
(output) => output.scriptpubkey_address ===
|
|
19362
|
+
(output) => output.scriptpubkey_address === address
|
|
19537
19363
|
);
|
|
19538
19364
|
if (outputIndex === -1) {
|
|
19539
19365
|
return null;
|
|
@@ -19887,7 +19713,7 @@ function decodeBytesToSigningCommitment(bytes2) {
|
|
|
19887
19713
|
|
|
19888
19714
|
// src/utils/token-identifier.ts
|
|
19889
19715
|
init_buffer();
|
|
19890
|
-
var
|
|
19716
|
+
var import_base4 = require("@scure/base");
|
|
19891
19717
|
var Bech32mTokenIdentifierTokenIdentifierNetworkPrefix = {
|
|
19892
19718
|
MAINNET: "btkn",
|
|
19893
19719
|
REGTEST: "btknrt",
|
|
@@ -19897,7 +19723,7 @@ var Bech32mTokenIdentifierTokenIdentifierNetworkPrefix = {
|
|
|
19897
19723
|
};
|
|
19898
19724
|
function encodeBech32mTokenIdentifier(payload) {
|
|
19899
19725
|
try {
|
|
19900
|
-
const words =
|
|
19726
|
+
const words = import_base4.bech32m.toWords(payload.tokenIdentifier);
|
|
19901
19727
|
if (!payload.network) {
|
|
19902
19728
|
throw new ValidationError(
|
|
19903
19729
|
"Network is required to encode bech32m encoded token identifier",
|
|
@@ -19907,7 +19733,7 @@ function encodeBech32mTokenIdentifier(payload) {
|
|
|
19907
19733
|
}
|
|
19908
19734
|
);
|
|
19909
19735
|
}
|
|
19910
|
-
return
|
|
19736
|
+
return import_base4.bech32m.encode(
|
|
19911
19737
|
Bech32mTokenIdentifierTokenIdentifierNetworkPrefix[payload.network],
|
|
19912
19738
|
words,
|
|
19913
19739
|
500
|
|
@@ -19925,7 +19751,7 @@ function encodeBech32mTokenIdentifier(payload) {
|
|
|
19925
19751
|
}
|
|
19926
19752
|
function decodeBech32mTokenIdentifier(bech32mTokenIdentifier, network) {
|
|
19927
19753
|
try {
|
|
19928
|
-
const decoded =
|
|
19754
|
+
const decoded = import_base4.bech32m.decode(
|
|
19929
19755
|
bech32mTokenIdentifier,
|
|
19930
19756
|
500
|
|
19931
19757
|
);
|
|
@@ -19939,7 +19765,7 @@ function decodeBech32mTokenIdentifier(bech32mTokenIdentifier, network) {
|
|
|
19939
19765
|
}
|
|
19940
19766
|
);
|
|
19941
19767
|
}
|
|
19942
|
-
const tokenIdentifier =
|
|
19768
|
+
const tokenIdentifier = import_base4.bech32m.fromWords(decoded.words);
|
|
19943
19769
|
return {
|
|
19944
19770
|
tokenIdentifier,
|
|
19945
19771
|
network: network ?? getNetworkFromBech32mTokenIdentifier(bech32mTokenIdentifier)
|
|
@@ -20919,7 +20745,7 @@ var isWebExtension = (
|
|
|
20919
20745
|
"chrome" in globalThis && globalThis.chrome.runtime?.id
|
|
20920
20746
|
);
|
|
20921
20747
|
var userAgent = "navigator" in globalThis ? globalThis.navigator.userAgent || "unknown-user-agent" : void 0;
|
|
20922
|
-
var packageVersion = true ? "0.3.
|
|
20748
|
+
var packageVersion = true ? "0.3.6" : "unknown";
|
|
20923
20749
|
var baseEnvStr = "unknown";
|
|
20924
20750
|
if (isBun) {
|
|
20925
20751
|
const bunVersion = "version" in globalThis.Bun ? globalThis.Bun.version : "unknown-version";
|
|
@@ -22702,99 +22528,66 @@ var WalletConfigService = class {
|
|
|
22702
22528
|
}
|
|
22703
22529
|
};
|
|
22704
22530
|
|
|
22705
|
-
// src/services/connection.ts
|
|
22531
|
+
// src/services/connection/connection.ts
|
|
22706
22532
|
init_buffer();
|
|
22707
22533
|
var import_core12 = require("@lightsparkdev/core");
|
|
22708
22534
|
var import_sha28 = require("@noble/hashes/sha2");
|
|
22709
|
-
var import_nice_grpc_client_middleware_retry = require("nice-grpc-client-middleware-retry");
|
|
22710
|
-
var import_nice_grpc_common2 = require("nice-grpc-common");
|
|
22711
|
-
var import_nice_grpc_web = require("nice-grpc-web");
|
|
22712
22535
|
|
|
22713
|
-
// src/proto/
|
|
22536
|
+
// src/proto/spark_authn.ts
|
|
22714
22537
|
init_buffer();
|
|
22715
22538
|
var import_wire6 = require("@bufbuild/protobuf/wire");
|
|
22716
|
-
function
|
|
22717
|
-
|
|
22718
|
-
case 0:
|
|
22719
|
-
case "NONE":
|
|
22720
|
-
return 0 /* NONE */;
|
|
22721
|
-
case 1:
|
|
22722
|
-
case "INTERRUPT":
|
|
22723
|
-
return 1 /* INTERRUPT */;
|
|
22724
|
-
case 2:
|
|
22725
|
-
case "RESUME":
|
|
22726
|
-
return 2 /* RESUME */;
|
|
22727
|
-
case -1:
|
|
22728
|
-
case "UNRECOGNIZED":
|
|
22729
|
-
default:
|
|
22730
|
-
return -1 /* UNRECOGNIZED */;
|
|
22731
|
-
}
|
|
22732
|
-
}
|
|
22733
|
-
function interruptTransferRequest_InterruptTransferActionToJSON(object) {
|
|
22734
|
-
switch (object) {
|
|
22735
|
-
case 0 /* NONE */:
|
|
22736
|
-
return "NONE";
|
|
22737
|
-
case 1 /* INTERRUPT */:
|
|
22738
|
-
return "INTERRUPT";
|
|
22739
|
-
case 2 /* RESUME */:
|
|
22740
|
-
return "RESUME";
|
|
22741
|
-
case -1 /* UNRECOGNIZED */:
|
|
22742
|
-
default:
|
|
22743
|
-
return "UNRECOGNIZED";
|
|
22744
|
-
}
|
|
22745
|
-
}
|
|
22746
|
-
function interruptCoopExitRequest_InterruptCoopExitActionFromJSON(object) {
|
|
22747
|
-
switch (object) {
|
|
22748
|
-
case 0:
|
|
22749
|
-
case "NONE":
|
|
22750
|
-
return 0 /* NONE */;
|
|
22751
|
-
case 1:
|
|
22752
|
-
case "INTERRUPT":
|
|
22753
|
-
return 1 /* INTERRUPT */;
|
|
22754
|
-
case 2:
|
|
22755
|
-
case "RESUME":
|
|
22756
|
-
return 2 /* RESUME */;
|
|
22757
|
-
case -1:
|
|
22758
|
-
case "UNRECOGNIZED":
|
|
22759
|
-
default:
|
|
22760
|
-
return -1 /* UNRECOGNIZED */;
|
|
22761
|
-
}
|
|
22762
|
-
}
|
|
22763
|
-
function interruptCoopExitRequest_InterruptCoopExitActionToJSON(object) {
|
|
22764
|
-
switch (object) {
|
|
22765
|
-
case 0 /* NONE */:
|
|
22766
|
-
return "NONE";
|
|
22767
|
-
case 1 /* INTERRUPT */:
|
|
22768
|
-
return "INTERRUPT";
|
|
22769
|
-
case 2 /* RESUME */:
|
|
22770
|
-
return "RESUME";
|
|
22771
|
-
case -1 /* UNRECOGNIZED */:
|
|
22772
|
-
default:
|
|
22773
|
-
return "UNRECOGNIZED";
|
|
22774
|
-
}
|
|
22775
|
-
}
|
|
22776
|
-
function createBaseCleanUpPreimageShareRequest() {
|
|
22777
|
-
return { paymentHash: new Uint8Array(0) };
|
|
22539
|
+
function createBaseChallenge() {
|
|
22540
|
+
return { version: 0, timestamp: 0, nonce: new Uint8Array(0), publicKey: new Uint8Array(0) };
|
|
22778
22541
|
}
|
|
22779
|
-
var
|
|
22542
|
+
var Challenge = {
|
|
22780
22543
|
encode(message, writer = new import_wire6.BinaryWriter()) {
|
|
22781
|
-
if (message.
|
|
22782
|
-
writer.uint32(
|
|
22544
|
+
if (message.version !== 0) {
|
|
22545
|
+
writer.uint32(8).int32(message.version);
|
|
22546
|
+
}
|
|
22547
|
+
if (message.timestamp !== 0) {
|
|
22548
|
+
writer.uint32(16).int64(message.timestamp);
|
|
22549
|
+
}
|
|
22550
|
+
if (message.nonce.length !== 0) {
|
|
22551
|
+
writer.uint32(26).bytes(message.nonce);
|
|
22552
|
+
}
|
|
22553
|
+
if (message.publicKey.length !== 0) {
|
|
22554
|
+
writer.uint32(34).bytes(message.publicKey);
|
|
22783
22555
|
}
|
|
22784
22556
|
return writer;
|
|
22785
22557
|
},
|
|
22786
22558
|
decode(input, length) {
|
|
22787
22559
|
const reader = input instanceof import_wire6.BinaryReader ? input : new import_wire6.BinaryReader(input);
|
|
22788
22560
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
22789
|
-
const message =
|
|
22561
|
+
const message = createBaseChallenge();
|
|
22790
22562
|
while (reader.pos < end) {
|
|
22791
22563
|
const tag = reader.uint32();
|
|
22792
22564
|
switch (tag >>> 3) {
|
|
22793
22565
|
case 1: {
|
|
22794
|
-
if (tag !==
|
|
22566
|
+
if (tag !== 8) {
|
|
22795
22567
|
break;
|
|
22796
22568
|
}
|
|
22797
|
-
message.
|
|
22569
|
+
message.version = reader.int32();
|
|
22570
|
+
continue;
|
|
22571
|
+
}
|
|
22572
|
+
case 2: {
|
|
22573
|
+
if (tag !== 16) {
|
|
22574
|
+
break;
|
|
22575
|
+
}
|
|
22576
|
+
message.timestamp = longToNumber3(reader.int64());
|
|
22577
|
+
continue;
|
|
22578
|
+
}
|
|
22579
|
+
case 3: {
|
|
22580
|
+
if (tag !== 26) {
|
|
22581
|
+
break;
|
|
22582
|
+
}
|
|
22583
|
+
message.nonce = reader.bytes();
|
|
22584
|
+
continue;
|
|
22585
|
+
}
|
|
22586
|
+
case 4: {
|
|
22587
|
+
if (tag !== 34) {
|
|
22588
|
+
break;
|
|
22589
|
+
}
|
|
22590
|
+
message.publicKey = reader.bytes();
|
|
22798
22591
|
continue;
|
|
22799
22592
|
}
|
|
22800
22593
|
}
|
|
@@ -22806,38 +22599,61 @@ var CleanUpPreimageShareRequest = {
|
|
|
22806
22599
|
return message;
|
|
22807
22600
|
},
|
|
22808
22601
|
fromJSON(object) {
|
|
22809
|
-
return {
|
|
22602
|
+
return {
|
|
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)
|
|
22607
|
+
};
|
|
22810
22608
|
},
|
|
22811
22609
|
toJSON(message) {
|
|
22812
22610
|
const obj = {};
|
|
22813
|
-
if (message.
|
|
22814
|
-
obj.
|
|
22611
|
+
if (message.version !== 0) {
|
|
22612
|
+
obj.version = Math.round(message.version);
|
|
22613
|
+
}
|
|
22614
|
+
if (message.timestamp !== 0) {
|
|
22615
|
+
obj.timestamp = Math.round(message.timestamp);
|
|
22616
|
+
}
|
|
22617
|
+
if (message.nonce.length !== 0) {
|
|
22618
|
+
obj.nonce = base64FromBytes3(message.nonce);
|
|
22619
|
+
}
|
|
22620
|
+
if (message.publicKey.length !== 0) {
|
|
22621
|
+
obj.publicKey = base64FromBytes3(message.publicKey);
|
|
22815
22622
|
}
|
|
22816
22623
|
return obj;
|
|
22817
22624
|
},
|
|
22818
22625
|
create(base) {
|
|
22819
|
-
return
|
|
22626
|
+
return Challenge.fromPartial(base ?? {});
|
|
22820
22627
|
},
|
|
22821
22628
|
fromPartial(object) {
|
|
22822
|
-
const message =
|
|
22823
|
-
message.
|
|
22629
|
+
const message = createBaseChallenge();
|
|
22630
|
+
message.version = object.version ?? 0;
|
|
22631
|
+
message.timestamp = object.timestamp ?? 0;
|
|
22632
|
+
message.nonce = object.nonce ?? new Uint8Array(0);
|
|
22633
|
+
message.publicKey = object.publicKey ?? new Uint8Array(0);
|
|
22824
22634
|
return message;
|
|
22825
22635
|
}
|
|
22826
22636
|
};
|
|
22827
|
-
function
|
|
22828
|
-
return {
|
|
22637
|
+
function createBaseProtectedChallenge() {
|
|
22638
|
+
return { version: 0, challenge: void 0, serverHmac: new Uint8Array(0) };
|
|
22829
22639
|
}
|
|
22830
|
-
var
|
|
22640
|
+
var ProtectedChallenge = {
|
|
22831
22641
|
encode(message, writer = new import_wire6.BinaryWriter()) {
|
|
22832
|
-
if (message.
|
|
22833
|
-
writer.uint32(8).int32(message.
|
|
22642
|
+
if (message.version !== 0) {
|
|
22643
|
+
writer.uint32(8).int32(message.version);
|
|
22644
|
+
}
|
|
22645
|
+
if (message.challenge !== void 0) {
|
|
22646
|
+
Challenge.encode(message.challenge, writer.uint32(18).fork()).join();
|
|
22647
|
+
}
|
|
22648
|
+
if (message.serverHmac.length !== 0) {
|
|
22649
|
+
writer.uint32(26).bytes(message.serverHmac);
|
|
22834
22650
|
}
|
|
22835
22651
|
return writer;
|
|
22836
22652
|
},
|
|
22837
22653
|
decode(input, length) {
|
|
22838
22654
|
const reader = input instanceof import_wire6.BinaryReader ? input : new import_wire6.BinaryReader(input);
|
|
22839
22655
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
22840
|
-
const message =
|
|
22656
|
+
const message = createBaseProtectedChallenge();
|
|
22841
22657
|
while (reader.pos < end) {
|
|
22842
22658
|
const tag = reader.uint32();
|
|
22843
22659
|
switch (tag >>> 3) {
|
|
@@ -22845,7 +22661,21 @@ var InterruptTransferRequest = {
|
|
|
22845
22661
|
if (tag !== 8) {
|
|
22846
22662
|
break;
|
|
22847
22663
|
}
|
|
22848
|
-
message.
|
|
22664
|
+
message.version = reader.int32();
|
|
22665
|
+
continue;
|
|
22666
|
+
}
|
|
22667
|
+
case 2: {
|
|
22668
|
+
if (tag !== 18) {
|
|
22669
|
+
break;
|
|
22670
|
+
}
|
|
22671
|
+
message.challenge = Challenge.decode(reader, reader.uint32());
|
|
22672
|
+
continue;
|
|
22673
|
+
}
|
|
22674
|
+
case 3: {
|
|
22675
|
+
if (tag !== 26) {
|
|
22676
|
+
break;
|
|
22677
|
+
}
|
|
22678
|
+
message.serverHmac = reader.bytes();
|
|
22849
22679
|
continue;
|
|
22850
22680
|
}
|
|
22851
22681
|
}
|
|
@@ -22858,42 +22688,49 @@ var InterruptTransferRequest = {
|
|
|
22858
22688
|
},
|
|
22859
22689
|
fromJSON(object) {
|
|
22860
22690
|
return {
|
|
22861
|
-
|
|
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)
|
|
22862
22694
|
};
|
|
22863
22695
|
},
|
|
22864
22696
|
toJSON(message) {
|
|
22865
22697
|
const obj = {};
|
|
22866
|
-
if (message.
|
|
22867
|
-
obj.
|
|
22698
|
+
if (message.version !== 0) {
|
|
22699
|
+
obj.version = Math.round(message.version);
|
|
22700
|
+
}
|
|
22701
|
+
if (message.challenge !== void 0) {
|
|
22702
|
+
obj.challenge = Challenge.toJSON(message.challenge);
|
|
22703
|
+
}
|
|
22704
|
+
if (message.serverHmac.length !== 0) {
|
|
22705
|
+
obj.serverHmac = base64FromBytes3(message.serverHmac);
|
|
22868
22706
|
}
|
|
22869
22707
|
return obj;
|
|
22870
22708
|
},
|
|
22871
22709
|
create(base) {
|
|
22872
|
-
return
|
|
22710
|
+
return ProtectedChallenge.fromPartial(base ?? {});
|
|
22873
22711
|
},
|
|
22874
22712
|
fromPartial(object) {
|
|
22875
|
-
const message =
|
|
22876
|
-
message.
|
|
22713
|
+
const message = createBaseProtectedChallenge();
|
|
22714
|
+
message.version = object.version ?? 0;
|
|
22715
|
+
message.challenge = object.challenge !== void 0 && object.challenge !== null ? Challenge.fromPartial(object.challenge) : void 0;
|
|
22716
|
+
message.serverHmac = object.serverHmac ?? new Uint8Array(0);
|
|
22877
22717
|
return message;
|
|
22878
22718
|
}
|
|
22879
22719
|
};
|
|
22880
|
-
function
|
|
22881
|
-
return {
|
|
22720
|
+
function createBaseGetChallengeRequest() {
|
|
22721
|
+
return { publicKey: new Uint8Array(0) };
|
|
22882
22722
|
}
|
|
22883
|
-
var
|
|
22723
|
+
var GetChallengeRequest = {
|
|
22884
22724
|
encode(message, writer = new import_wire6.BinaryWriter()) {
|
|
22885
|
-
|
|
22886
|
-
writer.uint32(10).
|
|
22887
|
-
}
|
|
22888
|
-
if (message.status !== "") {
|
|
22889
|
-
writer.uint32(18).string(message.status);
|
|
22725
|
+
if (message.publicKey.length !== 0) {
|
|
22726
|
+
writer.uint32(10).bytes(message.publicKey);
|
|
22890
22727
|
}
|
|
22891
22728
|
return writer;
|
|
22892
22729
|
},
|
|
22893
22730
|
decode(input, length) {
|
|
22894
22731
|
const reader = input instanceof import_wire6.BinaryReader ? input : new import_wire6.BinaryReader(input);
|
|
22895
22732
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
22896
|
-
const message =
|
|
22733
|
+
const message = createBaseGetChallengeRequest();
|
|
22897
22734
|
while (reader.pos < end) {
|
|
22898
22735
|
const tag = reader.uint32();
|
|
22899
22736
|
switch (tag >>> 3) {
|
|
@@ -22901,14 +22738,58 @@ var UpdateNodesStatusRequest = {
|
|
|
22901
22738
|
if (tag !== 10) {
|
|
22902
22739
|
break;
|
|
22903
22740
|
}
|
|
22904
|
-
message.
|
|
22741
|
+
message.publicKey = reader.bytes();
|
|
22905
22742
|
continue;
|
|
22906
22743
|
}
|
|
22907
|
-
|
|
22908
|
-
|
|
22744
|
+
}
|
|
22745
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
22746
|
+
break;
|
|
22747
|
+
}
|
|
22748
|
+
reader.skip(tag & 7);
|
|
22749
|
+
}
|
|
22750
|
+
return message;
|
|
22751
|
+
},
|
|
22752
|
+
fromJSON(object) {
|
|
22753
|
+
return { publicKey: isSet4(object.publicKey) ? bytesFromBase643(object.publicKey) : new Uint8Array(0) };
|
|
22754
|
+
},
|
|
22755
|
+
toJSON(message) {
|
|
22756
|
+
const obj = {};
|
|
22757
|
+
if (message.publicKey.length !== 0) {
|
|
22758
|
+
obj.publicKey = base64FromBytes3(message.publicKey);
|
|
22759
|
+
}
|
|
22760
|
+
return obj;
|
|
22761
|
+
},
|
|
22762
|
+
create(base) {
|
|
22763
|
+
return GetChallengeRequest.fromPartial(base ?? {});
|
|
22764
|
+
},
|
|
22765
|
+
fromPartial(object) {
|
|
22766
|
+
const message = createBaseGetChallengeRequest();
|
|
22767
|
+
message.publicKey = object.publicKey ?? new Uint8Array(0);
|
|
22768
|
+
return message;
|
|
22769
|
+
}
|
|
22770
|
+
};
|
|
22771
|
+
function createBaseGetChallengeResponse() {
|
|
22772
|
+
return { protectedChallenge: void 0 };
|
|
22773
|
+
}
|
|
22774
|
+
var GetChallengeResponse = {
|
|
22775
|
+
encode(message, writer = new import_wire6.BinaryWriter()) {
|
|
22776
|
+
if (message.protectedChallenge !== void 0) {
|
|
22777
|
+
ProtectedChallenge.encode(message.protectedChallenge, writer.uint32(10).fork()).join();
|
|
22778
|
+
}
|
|
22779
|
+
return writer;
|
|
22780
|
+
},
|
|
22781
|
+
decode(input, length) {
|
|
22782
|
+
const reader = input instanceof import_wire6.BinaryReader ? input : new import_wire6.BinaryReader(input);
|
|
22783
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
22784
|
+
const message = createBaseGetChallengeResponse();
|
|
22785
|
+
while (reader.pos < end) {
|
|
22786
|
+
const tag = reader.uint32();
|
|
22787
|
+
switch (tag >>> 3) {
|
|
22788
|
+
case 1: {
|
|
22789
|
+
if (tag !== 10) {
|
|
22909
22790
|
break;
|
|
22910
22791
|
}
|
|
22911
|
-
message.
|
|
22792
|
+
message.protectedChallenge = ProtectedChallenge.decode(reader, reader.uint32());
|
|
22912
22793
|
continue;
|
|
22913
22794
|
}
|
|
22914
22795
|
}
|
|
@@ -22921,44 +22802,45 @@ var UpdateNodesStatusRequest = {
|
|
|
22921
22802
|
},
|
|
22922
22803
|
fromJSON(object) {
|
|
22923
22804
|
return {
|
|
22924
|
-
|
|
22925
|
-
status: isSet4(object.status) ? globalThis.String(object.status) : ""
|
|
22805
|
+
protectedChallenge: isSet4(object.protectedChallenge) ? ProtectedChallenge.fromJSON(object.protectedChallenge) : void 0
|
|
22926
22806
|
};
|
|
22927
22807
|
},
|
|
22928
22808
|
toJSON(message) {
|
|
22929
22809
|
const obj = {};
|
|
22930
|
-
if (message.
|
|
22931
|
-
obj.
|
|
22932
|
-
}
|
|
22933
|
-
if (message.status !== "") {
|
|
22934
|
-
obj.status = message.status;
|
|
22810
|
+
if (message.protectedChallenge !== void 0) {
|
|
22811
|
+
obj.protectedChallenge = ProtectedChallenge.toJSON(message.protectedChallenge);
|
|
22935
22812
|
}
|
|
22936
22813
|
return obj;
|
|
22937
22814
|
},
|
|
22938
22815
|
create(base) {
|
|
22939
|
-
return
|
|
22816
|
+
return GetChallengeResponse.fromPartial(base ?? {});
|
|
22940
22817
|
},
|
|
22941
22818
|
fromPartial(object) {
|
|
22942
|
-
const message =
|
|
22943
|
-
message.
|
|
22944
|
-
message.status = object.status ?? "";
|
|
22819
|
+
const message = createBaseGetChallengeResponse();
|
|
22820
|
+
message.protectedChallenge = object.protectedChallenge !== void 0 && object.protectedChallenge !== null ? ProtectedChallenge.fromPartial(object.protectedChallenge) : void 0;
|
|
22945
22821
|
return message;
|
|
22946
22822
|
}
|
|
22947
22823
|
};
|
|
22948
|
-
function
|
|
22949
|
-
return {
|
|
22824
|
+
function createBaseVerifyChallengeRequest() {
|
|
22825
|
+
return { protectedChallenge: void 0, signature: new Uint8Array(0), publicKey: new Uint8Array(0) };
|
|
22950
22826
|
}
|
|
22951
|
-
var
|
|
22827
|
+
var VerifyChallengeRequest = {
|
|
22952
22828
|
encode(message, writer = new import_wire6.BinaryWriter()) {
|
|
22953
|
-
if (message.
|
|
22954
|
-
writer.uint32(10).
|
|
22829
|
+
if (message.protectedChallenge !== void 0) {
|
|
22830
|
+
ProtectedChallenge.encode(message.protectedChallenge, writer.uint32(10).fork()).join();
|
|
22831
|
+
}
|
|
22832
|
+
if (message.signature.length !== 0) {
|
|
22833
|
+
writer.uint32(18).bytes(message.signature);
|
|
22834
|
+
}
|
|
22835
|
+
if (message.publicKey.length !== 0) {
|
|
22836
|
+
writer.uint32(26).bytes(message.publicKey);
|
|
22955
22837
|
}
|
|
22956
22838
|
return writer;
|
|
22957
22839
|
},
|
|
22958
22840
|
decode(input, length) {
|
|
22959
22841
|
const reader = input instanceof import_wire6.BinaryReader ? input : new import_wire6.BinaryReader(input);
|
|
22960
22842
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
22961
|
-
const message =
|
|
22843
|
+
const message = createBaseVerifyChallengeRequest();
|
|
22962
22844
|
while (reader.pos < end) {
|
|
22963
22845
|
const tag = reader.uint32();
|
|
22964
22846
|
switch (tag >>> 3) {
|
|
@@ -22966,7 +22848,21 @@ var TriggerTaskRequest = {
|
|
|
22966
22848
|
if (tag !== 10) {
|
|
22967
22849
|
break;
|
|
22968
22850
|
}
|
|
22969
|
-
message.
|
|
22851
|
+
message.protectedChallenge = ProtectedChallenge.decode(reader, reader.uint32());
|
|
22852
|
+
continue;
|
|
22853
|
+
}
|
|
22854
|
+
case 2: {
|
|
22855
|
+
if (tag !== 18) {
|
|
22856
|
+
break;
|
|
22857
|
+
}
|
|
22858
|
+
message.signature = reader.bytes();
|
|
22859
|
+
continue;
|
|
22860
|
+
}
|
|
22861
|
+
case 3: {
|
|
22862
|
+
if (tag !== 26) {
|
|
22863
|
+
break;
|
|
22864
|
+
}
|
|
22865
|
+
message.publicKey = reader.bytes();
|
|
22970
22866
|
continue;
|
|
22971
22867
|
}
|
|
22972
22868
|
}
|
|
@@ -22978,56 +22874,68 @@ var TriggerTaskRequest = {
|
|
|
22978
22874
|
return message;
|
|
22979
22875
|
},
|
|
22980
22876
|
fromJSON(object) {
|
|
22981
|
-
return {
|
|
22877
|
+
return {
|
|
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)
|
|
22881
|
+
};
|
|
22982
22882
|
},
|
|
22983
22883
|
toJSON(message) {
|
|
22984
22884
|
const obj = {};
|
|
22985
|
-
if (message.
|
|
22986
|
-
obj.
|
|
22885
|
+
if (message.protectedChallenge !== void 0) {
|
|
22886
|
+
obj.protectedChallenge = ProtectedChallenge.toJSON(message.protectedChallenge);
|
|
22887
|
+
}
|
|
22888
|
+
if (message.signature.length !== 0) {
|
|
22889
|
+
obj.signature = base64FromBytes3(message.signature);
|
|
22890
|
+
}
|
|
22891
|
+
if (message.publicKey.length !== 0) {
|
|
22892
|
+
obj.publicKey = base64FromBytes3(message.publicKey);
|
|
22987
22893
|
}
|
|
22988
22894
|
return obj;
|
|
22989
22895
|
},
|
|
22990
22896
|
create(base) {
|
|
22991
|
-
return
|
|
22897
|
+
return VerifyChallengeRequest.fromPartial(base ?? {});
|
|
22992
22898
|
},
|
|
22993
22899
|
fromPartial(object) {
|
|
22994
|
-
const message =
|
|
22995
|
-
message.
|
|
22900
|
+
const message = createBaseVerifyChallengeRequest();
|
|
22901
|
+
message.protectedChallenge = object.protectedChallenge !== void 0 && object.protectedChallenge !== null ? ProtectedChallenge.fromPartial(object.protectedChallenge) : void 0;
|
|
22902
|
+
message.signature = object.signature ?? new Uint8Array(0);
|
|
22903
|
+
message.publicKey = object.publicKey ?? new Uint8Array(0);
|
|
22996
22904
|
return message;
|
|
22997
22905
|
}
|
|
22998
22906
|
};
|
|
22999
|
-
function
|
|
23000
|
-
return {
|
|
22907
|
+
function createBaseVerifyChallengeResponse() {
|
|
22908
|
+
return { sessionToken: "", expirationTimestamp: 0 };
|
|
23001
22909
|
}
|
|
23002
|
-
var
|
|
22910
|
+
var VerifyChallengeResponse = {
|
|
23003
22911
|
encode(message, writer = new import_wire6.BinaryWriter()) {
|
|
23004
|
-
if (message.
|
|
23005
|
-
writer.uint32(
|
|
22912
|
+
if (message.sessionToken !== "") {
|
|
22913
|
+
writer.uint32(10).string(message.sessionToken);
|
|
23006
22914
|
}
|
|
23007
|
-
if (message.
|
|
23008
|
-
writer.uint32(
|
|
22915
|
+
if (message.expirationTimestamp !== 0) {
|
|
22916
|
+
writer.uint32(16).int64(message.expirationTimestamp);
|
|
23009
22917
|
}
|
|
23010
22918
|
return writer;
|
|
23011
22919
|
},
|
|
23012
22920
|
decode(input, length) {
|
|
23013
22921
|
const reader = input instanceof import_wire6.BinaryReader ? input : new import_wire6.BinaryReader(input);
|
|
23014
22922
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
23015
|
-
const message =
|
|
22923
|
+
const message = createBaseVerifyChallengeResponse();
|
|
23016
22924
|
while (reader.pos < end) {
|
|
23017
22925
|
const tag = reader.uint32();
|
|
23018
22926
|
switch (tag >>> 3) {
|
|
23019
22927
|
case 1: {
|
|
23020
|
-
if (tag !==
|
|
22928
|
+
if (tag !== 10) {
|
|
23021
22929
|
break;
|
|
23022
22930
|
}
|
|
23023
|
-
message.
|
|
22931
|
+
message.sessionToken = reader.string();
|
|
23024
22932
|
continue;
|
|
23025
22933
|
}
|
|
23026
22934
|
case 2: {
|
|
23027
|
-
if (tag !==
|
|
22935
|
+
if (tag !== 16) {
|
|
23028
22936
|
break;
|
|
23029
22937
|
}
|
|
23030
|
-
message.
|
|
22938
|
+
message.expirationTimestamp = longToNumber3(reader.int64());
|
|
23031
22939
|
continue;
|
|
23032
22940
|
}
|
|
23033
22941
|
}
|
|
@@ -23040,72 +22948,49 @@ var InterruptCoopExitRequest = {
|
|
|
23040
22948
|
},
|
|
23041
22949
|
fromJSON(object) {
|
|
23042
22950
|
return {
|
|
23043
|
-
|
|
23044
|
-
|
|
22951
|
+
sessionToken: isSet4(object.sessionToken) ? globalThis.String(object.sessionToken) : "",
|
|
22952
|
+
expirationTimestamp: isSet4(object.expirationTimestamp) ? globalThis.Number(object.expirationTimestamp) : 0
|
|
23045
22953
|
};
|
|
23046
22954
|
},
|
|
23047
22955
|
toJSON(message) {
|
|
23048
22956
|
const obj = {};
|
|
23049
|
-
if (message.
|
|
23050
|
-
obj.
|
|
22957
|
+
if (message.sessionToken !== "") {
|
|
22958
|
+
obj.sessionToken = message.sessionToken;
|
|
23051
22959
|
}
|
|
23052
|
-
if (message.
|
|
23053
|
-
obj.
|
|
22960
|
+
if (message.expirationTimestamp !== 0) {
|
|
22961
|
+
obj.expirationTimestamp = Math.round(message.expirationTimestamp);
|
|
23054
22962
|
}
|
|
23055
22963
|
return obj;
|
|
23056
22964
|
},
|
|
23057
22965
|
create(base) {
|
|
23058
|
-
return
|
|
22966
|
+
return VerifyChallengeResponse.fromPartial(base ?? {});
|
|
23059
22967
|
},
|
|
23060
22968
|
fromPartial(object) {
|
|
23061
|
-
const message =
|
|
23062
|
-
message.
|
|
23063
|
-
message.
|
|
22969
|
+
const message = createBaseVerifyChallengeResponse();
|
|
22970
|
+
message.sessionToken = object.sessionToken ?? "";
|
|
22971
|
+
message.expirationTimestamp = object.expirationTimestamp ?? 0;
|
|
23064
22972
|
return message;
|
|
23065
22973
|
}
|
|
23066
22974
|
};
|
|
23067
|
-
var
|
|
23068
|
-
name: "
|
|
23069
|
-
fullName: "
|
|
22975
|
+
var SparkAuthnServiceDefinition = {
|
|
22976
|
+
name: "SparkAuthnService",
|
|
22977
|
+
fullName: "spark_authn.SparkAuthnService",
|
|
23070
22978
|
methods: {
|
|
23071
|
-
|
|
23072
|
-
|
|
23073
|
-
|
|
23074
|
-
|
|
23075
|
-
responseType: Empty,
|
|
23076
|
-
responseStream: false,
|
|
23077
|
-
options: {}
|
|
23078
|
-
},
|
|
23079
|
-
interrupt_transfer: {
|
|
23080
|
-
name: "interrupt_transfer",
|
|
23081
|
-
requestType: InterruptTransferRequest,
|
|
23082
|
-
requestStream: false,
|
|
23083
|
-
responseType: Empty,
|
|
23084
|
-
responseStream: false,
|
|
23085
|
-
options: {}
|
|
23086
|
-
},
|
|
23087
|
-
interrupt_coop_exit: {
|
|
23088
|
-
name: "interrupt_coop_exit",
|
|
23089
|
-
requestType: InterruptCoopExitRequest,
|
|
23090
|
-
requestStream: false,
|
|
23091
|
-
responseType: Empty,
|
|
23092
|
-
responseStream: false,
|
|
23093
|
-
options: {}
|
|
23094
|
-
},
|
|
23095
|
-
update_nodes_status: {
|
|
23096
|
-
name: "update_nodes_status",
|
|
23097
|
-
requestType: UpdateNodesStatusRequest,
|
|
22979
|
+
/** Request a new authentication challenge for a public key */
|
|
22980
|
+
get_challenge: {
|
|
22981
|
+
name: "get_challenge",
|
|
22982
|
+
requestType: GetChallengeRequest,
|
|
23098
22983
|
requestStream: false,
|
|
23099
|
-
responseType:
|
|
22984
|
+
responseType: GetChallengeResponse,
|
|
23100
22985
|
responseStream: false,
|
|
23101
22986
|
options: {}
|
|
23102
22987
|
},
|
|
23103
|
-
/**
|
|
23104
|
-
|
|
23105
|
-
name: "
|
|
23106
|
-
requestType:
|
|
22988
|
+
/** Verify a signed challenge and return a session token */
|
|
22989
|
+
verify_challenge: {
|
|
22990
|
+
name: "verify_challenge",
|
|
22991
|
+
requestType: VerifyChallengeRequest,
|
|
23107
22992
|
requestStream: false,
|
|
23108
|
-
responseType:
|
|
22993
|
+
responseType: VerifyChallengeResponse,
|
|
23109
22994
|
responseStream: false,
|
|
23110
22995
|
options: {}
|
|
23111
22996
|
}
|
|
@@ -23134,496 +23019,6 @@ function base64FromBytes3(arr) {
|
|
|
23134
23019
|
return globalThis.btoa(bin.join(""));
|
|
23135
23020
|
}
|
|
23136
23021
|
}
|
|
23137
|
-
function isSet4(value) {
|
|
23138
|
-
return value !== null && value !== void 0;
|
|
23139
|
-
}
|
|
23140
|
-
|
|
23141
|
-
// src/proto/spark_authn.ts
|
|
23142
|
-
init_buffer();
|
|
23143
|
-
var import_wire7 = require("@bufbuild/protobuf/wire");
|
|
23144
|
-
function createBaseChallenge() {
|
|
23145
|
-
return { version: 0, timestamp: 0, nonce: new Uint8Array(0), publicKey: new Uint8Array(0) };
|
|
23146
|
-
}
|
|
23147
|
-
var Challenge = {
|
|
23148
|
-
encode(message, writer = new import_wire7.BinaryWriter()) {
|
|
23149
|
-
if (message.version !== 0) {
|
|
23150
|
-
writer.uint32(8).int32(message.version);
|
|
23151
|
-
}
|
|
23152
|
-
if (message.timestamp !== 0) {
|
|
23153
|
-
writer.uint32(16).int64(message.timestamp);
|
|
23154
|
-
}
|
|
23155
|
-
if (message.nonce.length !== 0) {
|
|
23156
|
-
writer.uint32(26).bytes(message.nonce);
|
|
23157
|
-
}
|
|
23158
|
-
if (message.publicKey.length !== 0) {
|
|
23159
|
-
writer.uint32(34).bytes(message.publicKey);
|
|
23160
|
-
}
|
|
23161
|
-
return writer;
|
|
23162
|
-
},
|
|
23163
|
-
decode(input, length) {
|
|
23164
|
-
const reader = input instanceof import_wire7.BinaryReader ? input : new import_wire7.BinaryReader(input);
|
|
23165
|
-
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
23166
|
-
const message = createBaseChallenge();
|
|
23167
|
-
while (reader.pos < end) {
|
|
23168
|
-
const tag = reader.uint32();
|
|
23169
|
-
switch (tag >>> 3) {
|
|
23170
|
-
case 1: {
|
|
23171
|
-
if (tag !== 8) {
|
|
23172
|
-
break;
|
|
23173
|
-
}
|
|
23174
|
-
message.version = reader.int32();
|
|
23175
|
-
continue;
|
|
23176
|
-
}
|
|
23177
|
-
case 2: {
|
|
23178
|
-
if (tag !== 16) {
|
|
23179
|
-
break;
|
|
23180
|
-
}
|
|
23181
|
-
message.timestamp = longToNumber3(reader.int64());
|
|
23182
|
-
continue;
|
|
23183
|
-
}
|
|
23184
|
-
case 3: {
|
|
23185
|
-
if (tag !== 26) {
|
|
23186
|
-
break;
|
|
23187
|
-
}
|
|
23188
|
-
message.nonce = reader.bytes();
|
|
23189
|
-
continue;
|
|
23190
|
-
}
|
|
23191
|
-
case 4: {
|
|
23192
|
-
if (tag !== 34) {
|
|
23193
|
-
break;
|
|
23194
|
-
}
|
|
23195
|
-
message.publicKey = reader.bytes();
|
|
23196
|
-
continue;
|
|
23197
|
-
}
|
|
23198
|
-
}
|
|
23199
|
-
if ((tag & 7) === 4 || tag === 0) {
|
|
23200
|
-
break;
|
|
23201
|
-
}
|
|
23202
|
-
reader.skip(tag & 7);
|
|
23203
|
-
}
|
|
23204
|
-
return message;
|
|
23205
|
-
},
|
|
23206
|
-
fromJSON(object) {
|
|
23207
|
-
return {
|
|
23208
|
-
version: isSet5(object.version) ? globalThis.Number(object.version) : 0,
|
|
23209
|
-
timestamp: isSet5(object.timestamp) ? globalThis.Number(object.timestamp) : 0,
|
|
23210
|
-
nonce: isSet5(object.nonce) ? bytesFromBase644(object.nonce) : new Uint8Array(0),
|
|
23211
|
-
publicKey: isSet5(object.publicKey) ? bytesFromBase644(object.publicKey) : new Uint8Array(0)
|
|
23212
|
-
};
|
|
23213
|
-
},
|
|
23214
|
-
toJSON(message) {
|
|
23215
|
-
const obj = {};
|
|
23216
|
-
if (message.version !== 0) {
|
|
23217
|
-
obj.version = Math.round(message.version);
|
|
23218
|
-
}
|
|
23219
|
-
if (message.timestamp !== 0) {
|
|
23220
|
-
obj.timestamp = Math.round(message.timestamp);
|
|
23221
|
-
}
|
|
23222
|
-
if (message.nonce.length !== 0) {
|
|
23223
|
-
obj.nonce = base64FromBytes4(message.nonce);
|
|
23224
|
-
}
|
|
23225
|
-
if (message.publicKey.length !== 0) {
|
|
23226
|
-
obj.publicKey = base64FromBytes4(message.publicKey);
|
|
23227
|
-
}
|
|
23228
|
-
return obj;
|
|
23229
|
-
},
|
|
23230
|
-
create(base) {
|
|
23231
|
-
return Challenge.fromPartial(base ?? {});
|
|
23232
|
-
},
|
|
23233
|
-
fromPartial(object) {
|
|
23234
|
-
const message = createBaseChallenge();
|
|
23235
|
-
message.version = object.version ?? 0;
|
|
23236
|
-
message.timestamp = object.timestamp ?? 0;
|
|
23237
|
-
message.nonce = object.nonce ?? new Uint8Array(0);
|
|
23238
|
-
message.publicKey = object.publicKey ?? new Uint8Array(0);
|
|
23239
|
-
return message;
|
|
23240
|
-
}
|
|
23241
|
-
};
|
|
23242
|
-
function createBaseProtectedChallenge() {
|
|
23243
|
-
return { version: 0, challenge: void 0, serverHmac: new Uint8Array(0) };
|
|
23244
|
-
}
|
|
23245
|
-
var ProtectedChallenge = {
|
|
23246
|
-
encode(message, writer = new import_wire7.BinaryWriter()) {
|
|
23247
|
-
if (message.version !== 0) {
|
|
23248
|
-
writer.uint32(8).int32(message.version);
|
|
23249
|
-
}
|
|
23250
|
-
if (message.challenge !== void 0) {
|
|
23251
|
-
Challenge.encode(message.challenge, writer.uint32(18).fork()).join();
|
|
23252
|
-
}
|
|
23253
|
-
if (message.serverHmac.length !== 0) {
|
|
23254
|
-
writer.uint32(26).bytes(message.serverHmac);
|
|
23255
|
-
}
|
|
23256
|
-
return writer;
|
|
23257
|
-
},
|
|
23258
|
-
decode(input, length) {
|
|
23259
|
-
const reader = input instanceof import_wire7.BinaryReader ? input : new import_wire7.BinaryReader(input);
|
|
23260
|
-
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
23261
|
-
const message = createBaseProtectedChallenge();
|
|
23262
|
-
while (reader.pos < end) {
|
|
23263
|
-
const tag = reader.uint32();
|
|
23264
|
-
switch (tag >>> 3) {
|
|
23265
|
-
case 1: {
|
|
23266
|
-
if (tag !== 8) {
|
|
23267
|
-
break;
|
|
23268
|
-
}
|
|
23269
|
-
message.version = reader.int32();
|
|
23270
|
-
continue;
|
|
23271
|
-
}
|
|
23272
|
-
case 2: {
|
|
23273
|
-
if (tag !== 18) {
|
|
23274
|
-
break;
|
|
23275
|
-
}
|
|
23276
|
-
message.challenge = Challenge.decode(reader, reader.uint32());
|
|
23277
|
-
continue;
|
|
23278
|
-
}
|
|
23279
|
-
case 3: {
|
|
23280
|
-
if (tag !== 26) {
|
|
23281
|
-
break;
|
|
23282
|
-
}
|
|
23283
|
-
message.serverHmac = reader.bytes();
|
|
23284
|
-
continue;
|
|
23285
|
-
}
|
|
23286
|
-
}
|
|
23287
|
-
if ((tag & 7) === 4 || tag === 0) {
|
|
23288
|
-
break;
|
|
23289
|
-
}
|
|
23290
|
-
reader.skip(tag & 7);
|
|
23291
|
-
}
|
|
23292
|
-
return message;
|
|
23293
|
-
},
|
|
23294
|
-
fromJSON(object) {
|
|
23295
|
-
return {
|
|
23296
|
-
version: isSet5(object.version) ? globalThis.Number(object.version) : 0,
|
|
23297
|
-
challenge: isSet5(object.challenge) ? Challenge.fromJSON(object.challenge) : void 0,
|
|
23298
|
-
serverHmac: isSet5(object.serverHmac) ? bytesFromBase644(object.serverHmac) : new Uint8Array(0)
|
|
23299
|
-
};
|
|
23300
|
-
},
|
|
23301
|
-
toJSON(message) {
|
|
23302
|
-
const obj = {};
|
|
23303
|
-
if (message.version !== 0) {
|
|
23304
|
-
obj.version = Math.round(message.version);
|
|
23305
|
-
}
|
|
23306
|
-
if (message.challenge !== void 0) {
|
|
23307
|
-
obj.challenge = Challenge.toJSON(message.challenge);
|
|
23308
|
-
}
|
|
23309
|
-
if (message.serverHmac.length !== 0) {
|
|
23310
|
-
obj.serverHmac = base64FromBytes4(message.serverHmac);
|
|
23311
|
-
}
|
|
23312
|
-
return obj;
|
|
23313
|
-
},
|
|
23314
|
-
create(base) {
|
|
23315
|
-
return ProtectedChallenge.fromPartial(base ?? {});
|
|
23316
|
-
},
|
|
23317
|
-
fromPartial(object) {
|
|
23318
|
-
const message = createBaseProtectedChallenge();
|
|
23319
|
-
message.version = object.version ?? 0;
|
|
23320
|
-
message.challenge = object.challenge !== void 0 && object.challenge !== null ? Challenge.fromPartial(object.challenge) : void 0;
|
|
23321
|
-
message.serverHmac = object.serverHmac ?? new Uint8Array(0);
|
|
23322
|
-
return message;
|
|
23323
|
-
}
|
|
23324
|
-
};
|
|
23325
|
-
function createBaseGetChallengeRequest() {
|
|
23326
|
-
return { publicKey: new Uint8Array(0) };
|
|
23327
|
-
}
|
|
23328
|
-
var GetChallengeRequest = {
|
|
23329
|
-
encode(message, writer = new import_wire7.BinaryWriter()) {
|
|
23330
|
-
if (message.publicKey.length !== 0) {
|
|
23331
|
-
writer.uint32(10).bytes(message.publicKey);
|
|
23332
|
-
}
|
|
23333
|
-
return writer;
|
|
23334
|
-
},
|
|
23335
|
-
decode(input, length) {
|
|
23336
|
-
const reader = input instanceof import_wire7.BinaryReader ? input : new import_wire7.BinaryReader(input);
|
|
23337
|
-
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
23338
|
-
const message = createBaseGetChallengeRequest();
|
|
23339
|
-
while (reader.pos < end) {
|
|
23340
|
-
const tag = reader.uint32();
|
|
23341
|
-
switch (tag >>> 3) {
|
|
23342
|
-
case 1: {
|
|
23343
|
-
if (tag !== 10) {
|
|
23344
|
-
break;
|
|
23345
|
-
}
|
|
23346
|
-
message.publicKey = reader.bytes();
|
|
23347
|
-
continue;
|
|
23348
|
-
}
|
|
23349
|
-
}
|
|
23350
|
-
if ((tag & 7) === 4 || tag === 0) {
|
|
23351
|
-
break;
|
|
23352
|
-
}
|
|
23353
|
-
reader.skip(tag & 7);
|
|
23354
|
-
}
|
|
23355
|
-
return message;
|
|
23356
|
-
},
|
|
23357
|
-
fromJSON(object) {
|
|
23358
|
-
return { publicKey: isSet5(object.publicKey) ? bytesFromBase644(object.publicKey) : new Uint8Array(0) };
|
|
23359
|
-
},
|
|
23360
|
-
toJSON(message) {
|
|
23361
|
-
const obj = {};
|
|
23362
|
-
if (message.publicKey.length !== 0) {
|
|
23363
|
-
obj.publicKey = base64FromBytes4(message.publicKey);
|
|
23364
|
-
}
|
|
23365
|
-
return obj;
|
|
23366
|
-
},
|
|
23367
|
-
create(base) {
|
|
23368
|
-
return GetChallengeRequest.fromPartial(base ?? {});
|
|
23369
|
-
},
|
|
23370
|
-
fromPartial(object) {
|
|
23371
|
-
const message = createBaseGetChallengeRequest();
|
|
23372
|
-
message.publicKey = object.publicKey ?? new Uint8Array(0);
|
|
23373
|
-
return message;
|
|
23374
|
-
}
|
|
23375
|
-
};
|
|
23376
|
-
function createBaseGetChallengeResponse() {
|
|
23377
|
-
return { protectedChallenge: void 0 };
|
|
23378
|
-
}
|
|
23379
|
-
var GetChallengeResponse = {
|
|
23380
|
-
encode(message, writer = new import_wire7.BinaryWriter()) {
|
|
23381
|
-
if (message.protectedChallenge !== void 0) {
|
|
23382
|
-
ProtectedChallenge.encode(message.protectedChallenge, writer.uint32(10).fork()).join();
|
|
23383
|
-
}
|
|
23384
|
-
return writer;
|
|
23385
|
-
},
|
|
23386
|
-
decode(input, length) {
|
|
23387
|
-
const reader = input instanceof import_wire7.BinaryReader ? input : new import_wire7.BinaryReader(input);
|
|
23388
|
-
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
23389
|
-
const message = createBaseGetChallengeResponse();
|
|
23390
|
-
while (reader.pos < end) {
|
|
23391
|
-
const tag = reader.uint32();
|
|
23392
|
-
switch (tag >>> 3) {
|
|
23393
|
-
case 1: {
|
|
23394
|
-
if (tag !== 10) {
|
|
23395
|
-
break;
|
|
23396
|
-
}
|
|
23397
|
-
message.protectedChallenge = ProtectedChallenge.decode(reader, reader.uint32());
|
|
23398
|
-
continue;
|
|
23399
|
-
}
|
|
23400
|
-
}
|
|
23401
|
-
if ((tag & 7) === 4 || tag === 0) {
|
|
23402
|
-
break;
|
|
23403
|
-
}
|
|
23404
|
-
reader.skip(tag & 7);
|
|
23405
|
-
}
|
|
23406
|
-
return message;
|
|
23407
|
-
},
|
|
23408
|
-
fromJSON(object) {
|
|
23409
|
-
return {
|
|
23410
|
-
protectedChallenge: isSet5(object.protectedChallenge) ? ProtectedChallenge.fromJSON(object.protectedChallenge) : void 0
|
|
23411
|
-
};
|
|
23412
|
-
},
|
|
23413
|
-
toJSON(message) {
|
|
23414
|
-
const obj = {};
|
|
23415
|
-
if (message.protectedChallenge !== void 0) {
|
|
23416
|
-
obj.protectedChallenge = ProtectedChallenge.toJSON(message.protectedChallenge);
|
|
23417
|
-
}
|
|
23418
|
-
return obj;
|
|
23419
|
-
},
|
|
23420
|
-
create(base) {
|
|
23421
|
-
return GetChallengeResponse.fromPartial(base ?? {});
|
|
23422
|
-
},
|
|
23423
|
-
fromPartial(object) {
|
|
23424
|
-
const message = createBaseGetChallengeResponse();
|
|
23425
|
-
message.protectedChallenge = object.protectedChallenge !== void 0 && object.protectedChallenge !== null ? ProtectedChallenge.fromPartial(object.protectedChallenge) : void 0;
|
|
23426
|
-
return message;
|
|
23427
|
-
}
|
|
23428
|
-
};
|
|
23429
|
-
function createBaseVerifyChallengeRequest() {
|
|
23430
|
-
return { protectedChallenge: void 0, signature: new Uint8Array(0), publicKey: new Uint8Array(0) };
|
|
23431
|
-
}
|
|
23432
|
-
var VerifyChallengeRequest = {
|
|
23433
|
-
encode(message, writer = new import_wire7.BinaryWriter()) {
|
|
23434
|
-
if (message.protectedChallenge !== void 0) {
|
|
23435
|
-
ProtectedChallenge.encode(message.protectedChallenge, writer.uint32(10).fork()).join();
|
|
23436
|
-
}
|
|
23437
|
-
if (message.signature.length !== 0) {
|
|
23438
|
-
writer.uint32(18).bytes(message.signature);
|
|
23439
|
-
}
|
|
23440
|
-
if (message.publicKey.length !== 0) {
|
|
23441
|
-
writer.uint32(26).bytes(message.publicKey);
|
|
23442
|
-
}
|
|
23443
|
-
return writer;
|
|
23444
|
-
},
|
|
23445
|
-
decode(input, length) {
|
|
23446
|
-
const reader = input instanceof import_wire7.BinaryReader ? input : new import_wire7.BinaryReader(input);
|
|
23447
|
-
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
23448
|
-
const message = createBaseVerifyChallengeRequest();
|
|
23449
|
-
while (reader.pos < end) {
|
|
23450
|
-
const tag = reader.uint32();
|
|
23451
|
-
switch (tag >>> 3) {
|
|
23452
|
-
case 1: {
|
|
23453
|
-
if (tag !== 10) {
|
|
23454
|
-
break;
|
|
23455
|
-
}
|
|
23456
|
-
message.protectedChallenge = ProtectedChallenge.decode(reader, reader.uint32());
|
|
23457
|
-
continue;
|
|
23458
|
-
}
|
|
23459
|
-
case 2: {
|
|
23460
|
-
if (tag !== 18) {
|
|
23461
|
-
break;
|
|
23462
|
-
}
|
|
23463
|
-
message.signature = reader.bytes();
|
|
23464
|
-
continue;
|
|
23465
|
-
}
|
|
23466
|
-
case 3: {
|
|
23467
|
-
if (tag !== 26) {
|
|
23468
|
-
break;
|
|
23469
|
-
}
|
|
23470
|
-
message.publicKey = reader.bytes();
|
|
23471
|
-
continue;
|
|
23472
|
-
}
|
|
23473
|
-
}
|
|
23474
|
-
if ((tag & 7) === 4 || tag === 0) {
|
|
23475
|
-
break;
|
|
23476
|
-
}
|
|
23477
|
-
reader.skip(tag & 7);
|
|
23478
|
-
}
|
|
23479
|
-
return message;
|
|
23480
|
-
},
|
|
23481
|
-
fromJSON(object) {
|
|
23482
|
-
return {
|
|
23483
|
-
protectedChallenge: isSet5(object.protectedChallenge) ? ProtectedChallenge.fromJSON(object.protectedChallenge) : void 0,
|
|
23484
|
-
signature: isSet5(object.signature) ? bytesFromBase644(object.signature) : new Uint8Array(0),
|
|
23485
|
-
publicKey: isSet5(object.publicKey) ? bytesFromBase644(object.publicKey) : new Uint8Array(0)
|
|
23486
|
-
};
|
|
23487
|
-
},
|
|
23488
|
-
toJSON(message) {
|
|
23489
|
-
const obj = {};
|
|
23490
|
-
if (message.protectedChallenge !== void 0) {
|
|
23491
|
-
obj.protectedChallenge = ProtectedChallenge.toJSON(message.protectedChallenge);
|
|
23492
|
-
}
|
|
23493
|
-
if (message.signature.length !== 0) {
|
|
23494
|
-
obj.signature = base64FromBytes4(message.signature);
|
|
23495
|
-
}
|
|
23496
|
-
if (message.publicKey.length !== 0) {
|
|
23497
|
-
obj.publicKey = base64FromBytes4(message.publicKey);
|
|
23498
|
-
}
|
|
23499
|
-
return obj;
|
|
23500
|
-
},
|
|
23501
|
-
create(base) {
|
|
23502
|
-
return VerifyChallengeRequest.fromPartial(base ?? {});
|
|
23503
|
-
},
|
|
23504
|
-
fromPartial(object) {
|
|
23505
|
-
const message = createBaseVerifyChallengeRequest();
|
|
23506
|
-
message.protectedChallenge = object.protectedChallenge !== void 0 && object.protectedChallenge !== null ? ProtectedChallenge.fromPartial(object.protectedChallenge) : void 0;
|
|
23507
|
-
message.signature = object.signature ?? new Uint8Array(0);
|
|
23508
|
-
message.publicKey = object.publicKey ?? new Uint8Array(0);
|
|
23509
|
-
return message;
|
|
23510
|
-
}
|
|
23511
|
-
};
|
|
23512
|
-
function createBaseVerifyChallengeResponse() {
|
|
23513
|
-
return { sessionToken: "", expirationTimestamp: 0 };
|
|
23514
|
-
}
|
|
23515
|
-
var VerifyChallengeResponse = {
|
|
23516
|
-
encode(message, writer = new import_wire7.BinaryWriter()) {
|
|
23517
|
-
if (message.sessionToken !== "") {
|
|
23518
|
-
writer.uint32(10).string(message.sessionToken);
|
|
23519
|
-
}
|
|
23520
|
-
if (message.expirationTimestamp !== 0) {
|
|
23521
|
-
writer.uint32(16).int64(message.expirationTimestamp);
|
|
23522
|
-
}
|
|
23523
|
-
return writer;
|
|
23524
|
-
},
|
|
23525
|
-
decode(input, length) {
|
|
23526
|
-
const reader = input instanceof import_wire7.BinaryReader ? input : new import_wire7.BinaryReader(input);
|
|
23527
|
-
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
23528
|
-
const message = createBaseVerifyChallengeResponse();
|
|
23529
|
-
while (reader.pos < end) {
|
|
23530
|
-
const tag = reader.uint32();
|
|
23531
|
-
switch (tag >>> 3) {
|
|
23532
|
-
case 1: {
|
|
23533
|
-
if (tag !== 10) {
|
|
23534
|
-
break;
|
|
23535
|
-
}
|
|
23536
|
-
message.sessionToken = reader.string();
|
|
23537
|
-
continue;
|
|
23538
|
-
}
|
|
23539
|
-
case 2: {
|
|
23540
|
-
if (tag !== 16) {
|
|
23541
|
-
break;
|
|
23542
|
-
}
|
|
23543
|
-
message.expirationTimestamp = longToNumber3(reader.int64());
|
|
23544
|
-
continue;
|
|
23545
|
-
}
|
|
23546
|
-
}
|
|
23547
|
-
if ((tag & 7) === 4 || tag === 0) {
|
|
23548
|
-
break;
|
|
23549
|
-
}
|
|
23550
|
-
reader.skip(tag & 7);
|
|
23551
|
-
}
|
|
23552
|
-
return message;
|
|
23553
|
-
},
|
|
23554
|
-
fromJSON(object) {
|
|
23555
|
-
return {
|
|
23556
|
-
sessionToken: isSet5(object.sessionToken) ? globalThis.String(object.sessionToken) : "",
|
|
23557
|
-
expirationTimestamp: isSet5(object.expirationTimestamp) ? globalThis.Number(object.expirationTimestamp) : 0
|
|
23558
|
-
};
|
|
23559
|
-
},
|
|
23560
|
-
toJSON(message) {
|
|
23561
|
-
const obj = {};
|
|
23562
|
-
if (message.sessionToken !== "") {
|
|
23563
|
-
obj.sessionToken = message.sessionToken;
|
|
23564
|
-
}
|
|
23565
|
-
if (message.expirationTimestamp !== 0) {
|
|
23566
|
-
obj.expirationTimestamp = Math.round(message.expirationTimestamp);
|
|
23567
|
-
}
|
|
23568
|
-
return obj;
|
|
23569
|
-
},
|
|
23570
|
-
create(base) {
|
|
23571
|
-
return VerifyChallengeResponse.fromPartial(base ?? {});
|
|
23572
|
-
},
|
|
23573
|
-
fromPartial(object) {
|
|
23574
|
-
const message = createBaseVerifyChallengeResponse();
|
|
23575
|
-
message.sessionToken = object.sessionToken ?? "";
|
|
23576
|
-
message.expirationTimestamp = object.expirationTimestamp ?? 0;
|
|
23577
|
-
return message;
|
|
23578
|
-
}
|
|
23579
|
-
};
|
|
23580
|
-
var SparkAuthnServiceDefinition = {
|
|
23581
|
-
name: "SparkAuthnService",
|
|
23582
|
-
fullName: "spark_authn.SparkAuthnService",
|
|
23583
|
-
methods: {
|
|
23584
|
-
/** Request a new authentication challenge for a public key */
|
|
23585
|
-
get_challenge: {
|
|
23586
|
-
name: "get_challenge",
|
|
23587
|
-
requestType: GetChallengeRequest,
|
|
23588
|
-
requestStream: false,
|
|
23589
|
-
responseType: GetChallengeResponse,
|
|
23590
|
-
responseStream: false,
|
|
23591
|
-
options: {}
|
|
23592
|
-
},
|
|
23593
|
-
/** Verify a signed challenge and return a session token */
|
|
23594
|
-
verify_challenge: {
|
|
23595
|
-
name: "verify_challenge",
|
|
23596
|
-
requestType: VerifyChallengeRequest,
|
|
23597
|
-
requestStream: false,
|
|
23598
|
-
responseType: VerifyChallengeResponse,
|
|
23599
|
-
responseStream: false,
|
|
23600
|
-
options: {}
|
|
23601
|
-
}
|
|
23602
|
-
}
|
|
23603
|
-
};
|
|
23604
|
-
function bytesFromBase644(b64) {
|
|
23605
|
-
if (globalThis.Buffer) {
|
|
23606
|
-
return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));
|
|
23607
|
-
} else {
|
|
23608
|
-
const bin = globalThis.atob(b64);
|
|
23609
|
-
const arr = new Uint8Array(bin.length);
|
|
23610
|
-
for (let i = 0; i < bin.length; ++i) {
|
|
23611
|
-
arr[i] = bin.charCodeAt(i);
|
|
23612
|
-
}
|
|
23613
|
-
return arr;
|
|
23614
|
-
}
|
|
23615
|
-
}
|
|
23616
|
-
function base64FromBytes4(arr) {
|
|
23617
|
-
if (globalThis.Buffer) {
|
|
23618
|
-
return globalThis.Buffer.from(arr).toString("base64");
|
|
23619
|
-
} else {
|
|
23620
|
-
const bin = [];
|
|
23621
|
-
arr.forEach((byte) => {
|
|
23622
|
-
bin.push(globalThis.String.fromCharCode(byte));
|
|
23623
|
-
});
|
|
23624
|
-
return globalThis.btoa(bin.join(""));
|
|
23625
|
-
}
|
|
23626
|
-
}
|
|
23627
23022
|
function longToNumber3(int64) {
|
|
23628
23023
|
const num = globalThis.Number(int64.toString());
|
|
23629
23024
|
if (num > globalThis.Number.MAX_SAFE_INTEGER) {
|
|
@@ -23634,13 +23029,13 @@ function longToNumber3(int64) {
|
|
|
23634
23029
|
}
|
|
23635
23030
|
return num;
|
|
23636
23031
|
}
|
|
23637
|
-
function
|
|
23032
|
+
function isSet4(value) {
|
|
23638
23033
|
return value !== null && value !== void 0;
|
|
23639
23034
|
}
|
|
23640
23035
|
|
|
23641
23036
|
// src/proto/spark_token.ts
|
|
23642
23037
|
init_buffer();
|
|
23643
|
-
var
|
|
23038
|
+
var import_wire7 = require("@bufbuild/protobuf/wire");
|
|
23644
23039
|
function commitStatusFromJSON(object) {
|
|
23645
23040
|
switch (object) {
|
|
23646
23041
|
case 0:
|
|
@@ -23725,7 +23120,7 @@ function createBaseTokenOutputToSpend2() {
|
|
|
23725
23120
|
return { prevTokenTransactionHash: new Uint8Array(0), prevTokenTransactionVout: 0 };
|
|
23726
23121
|
}
|
|
23727
23122
|
var TokenOutputToSpend2 = {
|
|
23728
|
-
encode(message, writer = new
|
|
23123
|
+
encode(message, writer = new import_wire7.BinaryWriter()) {
|
|
23729
23124
|
if (message.prevTokenTransactionHash.length !== 0) {
|
|
23730
23125
|
writer.uint32(10).bytes(message.prevTokenTransactionHash);
|
|
23731
23126
|
}
|
|
@@ -23735,7 +23130,7 @@ var TokenOutputToSpend2 = {
|
|
|
23735
23130
|
return writer;
|
|
23736
23131
|
},
|
|
23737
23132
|
decode(input, length) {
|
|
23738
|
-
const reader = input instanceof
|
|
23133
|
+
const reader = input instanceof import_wire7.BinaryReader ? input : new import_wire7.BinaryReader(input);
|
|
23739
23134
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
23740
23135
|
const message = createBaseTokenOutputToSpend2();
|
|
23741
23136
|
while (reader.pos < end) {
|
|
@@ -23765,14 +23160,14 @@ var TokenOutputToSpend2 = {
|
|
|
23765
23160
|
},
|
|
23766
23161
|
fromJSON(object) {
|
|
23767
23162
|
return {
|
|
23768
|
-
prevTokenTransactionHash:
|
|
23769
|
-
prevTokenTransactionVout:
|
|
23163
|
+
prevTokenTransactionHash: isSet5(object.prevTokenTransactionHash) ? bytesFromBase644(object.prevTokenTransactionHash) : new Uint8Array(0),
|
|
23164
|
+
prevTokenTransactionVout: isSet5(object.prevTokenTransactionVout) ? globalThis.Number(object.prevTokenTransactionVout) : 0
|
|
23770
23165
|
};
|
|
23771
23166
|
},
|
|
23772
23167
|
toJSON(message) {
|
|
23773
23168
|
const obj = {};
|
|
23774
23169
|
if (message.prevTokenTransactionHash.length !== 0) {
|
|
23775
|
-
obj.prevTokenTransactionHash =
|
|
23170
|
+
obj.prevTokenTransactionHash = base64FromBytes4(message.prevTokenTransactionHash);
|
|
23776
23171
|
}
|
|
23777
23172
|
if (message.prevTokenTransactionVout !== 0) {
|
|
23778
23173
|
obj.prevTokenTransactionVout = Math.round(message.prevTokenTransactionVout);
|
|
@@ -23793,14 +23188,14 @@ function createBaseTokenTransferInput2() {
|
|
|
23793
23188
|
return { outputsToSpend: [] };
|
|
23794
23189
|
}
|
|
23795
23190
|
var TokenTransferInput2 = {
|
|
23796
|
-
encode(message, writer = new
|
|
23191
|
+
encode(message, writer = new import_wire7.BinaryWriter()) {
|
|
23797
23192
|
for (const v of message.outputsToSpend) {
|
|
23798
23193
|
TokenOutputToSpend2.encode(v, writer.uint32(10).fork()).join();
|
|
23799
23194
|
}
|
|
23800
23195
|
return writer;
|
|
23801
23196
|
},
|
|
23802
23197
|
decode(input, length) {
|
|
23803
|
-
const reader = input instanceof
|
|
23198
|
+
const reader = input instanceof import_wire7.BinaryReader ? input : new import_wire7.BinaryReader(input);
|
|
23804
23199
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
23805
23200
|
const message = createBaseTokenTransferInput2();
|
|
23806
23201
|
while (reader.pos < end) {
|
|
@@ -23846,7 +23241,7 @@ function createBaseTokenMintInput2() {
|
|
|
23846
23241
|
return { issuerPublicKey: new Uint8Array(0), tokenIdentifier: void 0 };
|
|
23847
23242
|
}
|
|
23848
23243
|
var TokenMintInput2 = {
|
|
23849
|
-
encode(message, writer = new
|
|
23244
|
+
encode(message, writer = new import_wire7.BinaryWriter()) {
|
|
23850
23245
|
if (message.issuerPublicKey.length !== 0) {
|
|
23851
23246
|
writer.uint32(10).bytes(message.issuerPublicKey);
|
|
23852
23247
|
}
|
|
@@ -23856,7 +23251,7 @@ var TokenMintInput2 = {
|
|
|
23856
23251
|
return writer;
|
|
23857
23252
|
},
|
|
23858
23253
|
decode(input, length) {
|
|
23859
|
-
const reader = input instanceof
|
|
23254
|
+
const reader = input instanceof import_wire7.BinaryReader ? input : new import_wire7.BinaryReader(input);
|
|
23860
23255
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
23861
23256
|
const message = createBaseTokenMintInput2();
|
|
23862
23257
|
while (reader.pos < end) {
|
|
@@ -23886,17 +23281,17 @@ var TokenMintInput2 = {
|
|
|
23886
23281
|
},
|
|
23887
23282
|
fromJSON(object) {
|
|
23888
23283
|
return {
|
|
23889
|
-
issuerPublicKey:
|
|
23890
|
-
tokenIdentifier:
|
|
23284
|
+
issuerPublicKey: isSet5(object.issuerPublicKey) ? bytesFromBase644(object.issuerPublicKey) : new Uint8Array(0),
|
|
23285
|
+
tokenIdentifier: isSet5(object.tokenIdentifier) ? bytesFromBase644(object.tokenIdentifier) : void 0
|
|
23891
23286
|
};
|
|
23892
23287
|
},
|
|
23893
23288
|
toJSON(message) {
|
|
23894
23289
|
const obj = {};
|
|
23895
23290
|
if (message.issuerPublicKey.length !== 0) {
|
|
23896
|
-
obj.issuerPublicKey =
|
|
23291
|
+
obj.issuerPublicKey = base64FromBytes4(message.issuerPublicKey);
|
|
23897
23292
|
}
|
|
23898
23293
|
if (message.tokenIdentifier !== void 0) {
|
|
23899
|
-
obj.tokenIdentifier =
|
|
23294
|
+
obj.tokenIdentifier = base64FromBytes4(message.tokenIdentifier);
|
|
23900
23295
|
}
|
|
23901
23296
|
return obj;
|
|
23902
23297
|
},
|
|
@@ -23922,7 +23317,7 @@ function createBaseTokenCreateInput2() {
|
|
|
23922
23317
|
};
|
|
23923
23318
|
}
|
|
23924
23319
|
var TokenCreateInput2 = {
|
|
23925
|
-
encode(message, writer = new
|
|
23320
|
+
encode(message, writer = new import_wire7.BinaryWriter()) {
|
|
23926
23321
|
if (message.issuerPublicKey.length !== 0) {
|
|
23927
23322
|
writer.uint32(10).bytes(message.issuerPublicKey);
|
|
23928
23323
|
}
|
|
@@ -23947,7 +23342,7 @@ var TokenCreateInput2 = {
|
|
|
23947
23342
|
return writer;
|
|
23948
23343
|
},
|
|
23949
23344
|
decode(input, length) {
|
|
23950
|
-
const reader = input instanceof
|
|
23345
|
+
const reader = input instanceof import_wire7.BinaryReader ? input : new import_wire7.BinaryReader(input);
|
|
23951
23346
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
23952
23347
|
const message = createBaseTokenCreateInput2();
|
|
23953
23348
|
while (reader.pos < end) {
|
|
@@ -24012,19 +23407,19 @@ var TokenCreateInput2 = {
|
|
|
24012
23407
|
},
|
|
24013
23408
|
fromJSON(object) {
|
|
24014
23409
|
return {
|
|
24015
|
-
issuerPublicKey:
|
|
24016
|
-
tokenName:
|
|
24017
|
-
tokenTicker:
|
|
24018
|
-
decimals:
|
|
24019
|
-
maxSupply:
|
|
24020
|
-
isFreezable:
|
|
24021
|
-
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
|
|
24022
23417
|
};
|
|
24023
23418
|
},
|
|
24024
23419
|
toJSON(message) {
|
|
24025
23420
|
const obj = {};
|
|
24026
23421
|
if (message.issuerPublicKey.length !== 0) {
|
|
24027
|
-
obj.issuerPublicKey =
|
|
23422
|
+
obj.issuerPublicKey = base64FromBytes4(message.issuerPublicKey);
|
|
24028
23423
|
}
|
|
24029
23424
|
if (message.tokenName !== "") {
|
|
24030
23425
|
obj.tokenName = message.tokenName;
|
|
@@ -24036,13 +23431,13 @@ var TokenCreateInput2 = {
|
|
|
24036
23431
|
obj.decimals = Math.round(message.decimals);
|
|
24037
23432
|
}
|
|
24038
23433
|
if (message.maxSupply.length !== 0) {
|
|
24039
|
-
obj.maxSupply =
|
|
23434
|
+
obj.maxSupply = base64FromBytes4(message.maxSupply);
|
|
24040
23435
|
}
|
|
24041
23436
|
if (message.isFreezable !== false) {
|
|
24042
23437
|
obj.isFreezable = message.isFreezable;
|
|
24043
23438
|
}
|
|
24044
23439
|
if (message.creationEntityPublicKey !== void 0) {
|
|
24045
|
-
obj.creationEntityPublicKey =
|
|
23440
|
+
obj.creationEntityPublicKey = base64FromBytes4(message.creationEntityPublicKey);
|
|
24046
23441
|
}
|
|
24047
23442
|
return obj;
|
|
24048
23443
|
},
|
|
@@ -24074,7 +23469,7 @@ function createBaseTokenOutput2() {
|
|
|
24074
23469
|
};
|
|
24075
23470
|
}
|
|
24076
23471
|
var TokenOutput2 = {
|
|
24077
|
-
encode(message, writer = new
|
|
23472
|
+
encode(message, writer = new import_wire7.BinaryWriter()) {
|
|
24078
23473
|
if (message.id !== void 0) {
|
|
24079
23474
|
writer.uint32(10).string(message.id);
|
|
24080
23475
|
}
|
|
@@ -24102,7 +23497,7 @@ var TokenOutput2 = {
|
|
|
24102
23497
|
return writer;
|
|
24103
23498
|
},
|
|
24104
23499
|
decode(input, length) {
|
|
24105
|
-
const reader = input instanceof
|
|
23500
|
+
const reader = input instanceof import_wire7.BinaryReader ? input : new import_wire7.BinaryReader(input);
|
|
24106
23501
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
24107
23502
|
const message = createBaseTokenOutput2();
|
|
24108
23503
|
while (reader.pos < end) {
|
|
@@ -24174,14 +23569,14 @@ var TokenOutput2 = {
|
|
|
24174
23569
|
},
|
|
24175
23570
|
fromJSON(object) {
|
|
24176
23571
|
return {
|
|
24177
|
-
id:
|
|
24178
|
-
ownerPublicKey:
|
|
24179
|
-
revocationCommitment:
|
|
24180
|
-
withdrawBondSats:
|
|
24181
|
-
withdrawRelativeBlockLocktime:
|
|
24182
|
-
tokenPublicKey:
|
|
24183
|
-
tokenIdentifier:
|
|
24184
|
-
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)
|
|
24185
23580
|
};
|
|
24186
23581
|
},
|
|
24187
23582
|
toJSON(message) {
|
|
@@ -24190,10 +23585,10 @@ var TokenOutput2 = {
|
|
|
24190
23585
|
obj.id = message.id;
|
|
24191
23586
|
}
|
|
24192
23587
|
if (message.ownerPublicKey.length !== 0) {
|
|
24193
|
-
obj.ownerPublicKey =
|
|
23588
|
+
obj.ownerPublicKey = base64FromBytes4(message.ownerPublicKey);
|
|
24194
23589
|
}
|
|
24195
23590
|
if (message.revocationCommitment !== void 0) {
|
|
24196
|
-
obj.revocationCommitment =
|
|
23591
|
+
obj.revocationCommitment = base64FromBytes4(message.revocationCommitment);
|
|
24197
23592
|
}
|
|
24198
23593
|
if (message.withdrawBondSats !== void 0) {
|
|
24199
23594
|
obj.withdrawBondSats = Math.round(message.withdrawBondSats);
|
|
@@ -24202,13 +23597,13 @@ var TokenOutput2 = {
|
|
|
24202
23597
|
obj.withdrawRelativeBlockLocktime = Math.round(message.withdrawRelativeBlockLocktime);
|
|
24203
23598
|
}
|
|
24204
23599
|
if (message.tokenPublicKey !== void 0) {
|
|
24205
|
-
obj.tokenPublicKey =
|
|
23600
|
+
obj.tokenPublicKey = base64FromBytes4(message.tokenPublicKey);
|
|
24206
23601
|
}
|
|
24207
23602
|
if (message.tokenIdentifier !== void 0) {
|
|
24208
|
-
obj.tokenIdentifier =
|
|
23603
|
+
obj.tokenIdentifier = base64FromBytes4(message.tokenIdentifier);
|
|
24209
23604
|
}
|
|
24210
23605
|
if (message.tokenAmount.length !== 0) {
|
|
24211
|
-
obj.tokenAmount =
|
|
23606
|
+
obj.tokenAmount = base64FromBytes4(message.tokenAmount);
|
|
24212
23607
|
}
|
|
24213
23608
|
return obj;
|
|
24214
23609
|
},
|
|
@@ -24241,7 +23636,7 @@ function createBaseTokenTransaction2() {
|
|
|
24241
23636
|
};
|
|
24242
23637
|
}
|
|
24243
23638
|
var TokenTransaction2 = {
|
|
24244
|
-
encode(message, writer = new
|
|
23639
|
+
encode(message, writer = new import_wire7.BinaryWriter()) {
|
|
24245
23640
|
if (message.version !== 0) {
|
|
24246
23641
|
writer.uint32(8).uint32(message.version);
|
|
24247
23642
|
}
|
|
@@ -24277,7 +23672,7 @@ var TokenTransaction2 = {
|
|
|
24277
23672
|
return writer;
|
|
24278
23673
|
},
|
|
24279
23674
|
decode(input, length) {
|
|
24280
|
-
const reader = input instanceof
|
|
23675
|
+
const reader = input instanceof import_wire7.BinaryReader ? input : new import_wire7.BinaryReader(input);
|
|
24281
23676
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
24282
23677
|
const message = createBaseTokenTransaction2();
|
|
24283
23678
|
while (reader.pos < end) {
|
|
@@ -24366,13 +23761,13 @@ var TokenTransaction2 = {
|
|
|
24366
23761
|
},
|
|
24367
23762
|
fromJSON(object) {
|
|
24368
23763
|
return {
|
|
24369
|
-
version:
|
|
24370
|
-
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,
|
|
24371
23766
|
tokenOutputs: globalThis.Array.isArray(object?.tokenOutputs) ? object.tokenOutputs.map((e) => TokenOutput2.fromJSON(e)) : [],
|
|
24372
|
-
sparkOperatorIdentityPublicKeys: globalThis.Array.isArray(object?.sparkOperatorIdentityPublicKeys) ? object.sparkOperatorIdentityPublicKeys.map((e) =>
|
|
24373
|
-
expiryTime:
|
|
24374
|
-
network:
|
|
24375
|
-
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,
|
|
24376
23771
|
invoiceAttachments: globalThis.Array.isArray(object?.invoiceAttachments) ? object.invoiceAttachments.map((e) => InvoiceAttachment.fromJSON(e)) : []
|
|
24377
23772
|
};
|
|
24378
23773
|
},
|
|
@@ -24392,7 +23787,7 @@ var TokenTransaction2 = {
|
|
|
24392
23787
|
obj.tokenOutputs = message.tokenOutputs.map((e) => TokenOutput2.toJSON(e));
|
|
24393
23788
|
}
|
|
24394
23789
|
if (message.sparkOperatorIdentityPublicKeys?.length) {
|
|
24395
|
-
obj.sparkOperatorIdentityPublicKeys = message.sparkOperatorIdentityPublicKeys.map((e) =>
|
|
23790
|
+
obj.sparkOperatorIdentityPublicKeys = message.sparkOperatorIdentityPublicKeys.map((e) => base64FromBytes4(e));
|
|
24396
23791
|
}
|
|
24397
23792
|
if (message.expiryTime !== void 0) {
|
|
24398
23793
|
obj.expiryTime = message.expiryTime.toISOString();
|
|
@@ -24456,14 +23851,14 @@ function createBaseInvoiceAttachment() {
|
|
|
24456
23851
|
return { sparkInvoice: "" };
|
|
24457
23852
|
}
|
|
24458
23853
|
var InvoiceAttachment = {
|
|
24459
|
-
encode(message, writer = new
|
|
23854
|
+
encode(message, writer = new import_wire7.BinaryWriter()) {
|
|
24460
23855
|
if (message.sparkInvoice !== "") {
|
|
24461
23856
|
writer.uint32(10).string(message.sparkInvoice);
|
|
24462
23857
|
}
|
|
24463
23858
|
return writer;
|
|
24464
23859
|
},
|
|
24465
23860
|
decode(input, length) {
|
|
24466
|
-
const reader = input instanceof
|
|
23861
|
+
const reader = input instanceof import_wire7.BinaryReader ? input : new import_wire7.BinaryReader(input);
|
|
24467
23862
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
24468
23863
|
const message = createBaseInvoiceAttachment();
|
|
24469
23864
|
while (reader.pos < end) {
|
|
@@ -24485,7 +23880,7 @@ var InvoiceAttachment = {
|
|
|
24485
23880
|
return message;
|
|
24486
23881
|
},
|
|
24487
23882
|
fromJSON(object) {
|
|
24488
|
-
return { sparkInvoice:
|
|
23883
|
+
return { sparkInvoice: isSet5(object.sparkInvoice) ? globalThis.String(object.sparkInvoice) : "" };
|
|
24489
23884
|
},
|
|
24490
23885
|
toJSON(message) {
|
|
24491
23886
|
const obj = {};
|
|
@@ -24507,7 +23902,7 @@ function createBaseSignatureWithIndex2() {
|
|
|
24507
23902
|
return { signature: new Uint8Array(0), inputIndex: 0 };
|
|
24508
23903
|
}
|
|
24509
23904
|
var SignatureWithIndex2 = {
|
|
24510
|
-
encode(message, writer = new
|
|
23905
|
+
encode(message, writer = new import_wire7.BinaryWriter()) {
|
|
24511
23906
|
if (message.signature.length !== 0) {
|
|
24512
23907
|
writer.uint32(10).bytes(message.signature);
|
|
24513
23908
|
}
|
|
@@ -24517,7 +23912,7 @@ var SignatureWithIndex2 = {
|
|
|
24517
23912
|
return writer;
|
|
24518
23913
|
},
|
|
24519
23914
|
decode(input, length) {
|
|
24520
|
-
const reader = input instanceof
|
|
23915
|
+
const reader = input instanceof import_wire7.BinaryReader ? input : new import_wire7.BinaryReader(input);
|
|
24521
23916
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
24522
23917
|
const message = createBaseSignatureWithIndex2();
|
|
24523
23918
|
while (reader.pos < end) {
|
|
@@ -24547,14 +23942,14 @@ var SignatureWithIndex2 = {
|
|
|
24547
23942
|
},
|
|
24548
23943
|
fromJSON(object) {
|
|
24549
23944
|
return {
|
|
24550
|
-
signature:
|
|
24551
|
-
inputIndex:
|
|
23945
|
+
signature: isSet5(object.signature) ? bytesFromBase644(object.signature) : new Uint8Array(0),
|
|
23946
|
+
inputIndex: isSet5(object.inputIndex) ? globalThis.Number(object.inputIndex) : 0
|
|
24552
23947
|
};
|
|
24553
23948
|
},
|
|
24554
23949
|
toJSON(message) {
|
|
24555
23950
|
const obj = {};
|
|
24556
23951
|
if (message.signature.length !== 0) {
|
|
24557
|
-
obj.signature =
|
|
23952
|
+
obj.signature = base64FromBytes4(message.signature);
|
|
24558
23953
|
}
|
|
24559
23954
|
if (message.inputIndex !== 0) {
|
|
24560
23955
|
obj.inputIndex = Math.round(message.inputIndex);
|
|
@@ -24575,7 +23970,7 @@ function createBaseInputTtxoSignaturesPerOperator() {
|
|
|
24575
23970
|
return { ttxoSignatures: [], operatorIdentityPublicKey: new Uint8Array(0) };
|
|
24576
23971
|
}
|
|
24577
23972
|
var InputTtxoSignaturesPerOperator = {
|
|
24578
|
-
encode(message, writer = new
|
|
23973
|
+
encode(message, writer = new import_wire7.BinaryWriter()) {
|
|
24579
23974
|
for (const v of message.ttxoSignatures) {
|
|
24580
23975
|
SignatureWithIndex2.encode(v, writer.uint32(10).fork()).join();
|
|
24581
23976
|
}
|
|
@@ -24585,7 +23980,7 @@ var InputTtxoSignaturesPerOperator = {
|
|
|
24585
23980
|
return writer;
|
|
24586
23981
|
},
|
|
24587
23982
|
decode(input, length) {
|
|
24588
|
-
const reader = input instanceof
|
|
23983
|
+
const reader = input instanceof import_wire7.BinaryReader ? input : new import_wire7.BinaryReader(input);
|
|
24589
23984
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
24590
23985
|
const message = createBaseInputTtxoSignaturesPerOperator();
|
|
24591
23986
|
while (reader.pos < end) {
|
|
@@ -24616,7 +24011,7 @@ var InputTtxoSignaturesPerOperator = {
|
|
|
24616
24011
|
fromJSON(object) {
|
|
24617
24012
|
return {
|
|
24618
24013
|
ttxoSignatures: globalThis.Array.isArray(object?.ttxoSignatures) ? object.ttxoSignatures.map((e) => SignatureWithIndex2.fromJSON(e)) : [],
|
|
24619
|
-
operatorIdentityPublicKey:
|
|
24014
|
+
operatorIdentityPublicKey: isSet5(object.operatorIdentityPublicKey) ? bytesFromBase644(object.operatorIdentityPublicKey) : new Uint8Array(0)
|
|
24620
24015
|
};
|
|
24621
24016
|
},
|
|
24622
24017
|
toJSON(message) {
|
|
@@ -24625,7 +24020,7 @@ var InputTtxoSignaturesPerOperator = {
|
|
|
24625
24020
|
obj.ttxoSignatures = message.ttxoSignatures.map((e) => SignatureWithIndex2.toJSON(e));
|
|
24626
24021
|
}
|
|
24627
24022
|
if (message.operatorIdentityPublicKey.length !== 0) {
|
|
24628
|
-
obj.operatorIdentityPublicKey =
|
|
24023
|
+
obj.operatorIdentityPublicKey = base64FromBytes4(message.operatorIdentityPublicKey);
|
|
24629
24024
|
}
|
|
24630
24025
|
return obj;
|
|
24631
24026
|
},
|
|
@@ -24648,7 +24043,7 @@ function createBaseStartTransactionRequest() {
|
|
|
24648
24043
|
};
|
|
24649
24044
|
}
|
|
24650
24045
|
var StartTransactionRequest = {
|
|
24651
|
-
encode(message, writer = new
|
|
24046
|
+
encode(message, writer = new import_wire7.BinaryWriter()) {
|
|
24652
24047
|
if (message.identityPublicKey.length !== 0) {
|
|
24653
24048
|
writer.uint32(10).bytes(message.identityPublicKey);
|
|
24654
24049
|
}
|
|
@@ -24664,7 +24059,7 @@ var StartTransactionRequest = {
|
|
|
24664
24059
|
return writer;
|
|
24665
24060
|
},
|
|
24666
24061
|
decode(input, length) {
|
|
24667
|
-
const reader = input instanceof
|
|
24062
|
+
const reader = input instanceof import_wire7.BinaryReader ? input : new import_wire7.BinaryReader(input);
|
|
24668
24063
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
24669
24064
|
const message = createBaseStartTransactionRequest();
|
|
24670
24065
|
while (reader.pos < end) {
|
|
@@ -24708,16 +24103,16 @@ var StartTransactionRequest = {
|
|
|
24708
24103
|
},
|
|
24709
24104
|
fromJSON(object) {
|
|
24710
24105
|
return {
|
|
24711
|
-
identityPublicKey:
|
|
24712
|
-
partialTokenTransaction:
|
|
24106
|
+
identityPublicKey: isSet5(object.identityPublicKey) ? bytesFromBase644(object.identityPublicKey) : new Uint8Array(0),
|
|
24107
|
+
partialTokenTransaction: isSet5(object.partialTokenTransaction) ? TokenTransaction2.fromJSON(object.partialTokenTransaction) : void 0,
|
|
24713
24108
|
partialTokenTransactionOwnerSignatures: globalThis.Array.isArray(object?.partialTokenTransactionOwnerSignatures) ? object.partialTokenTransactionOwnerSignatures.map((e) => SignatureWithIndex2.fromJSON(e)) : [],
|
|
24714
|
-
validityDurationSeconds:
|
|
24109
|
+
validityDurationSeconds: isSet5(object.validityDurationSeconds) ? globalThis.Number(object.validityDurationSeconds) : 0
|
|
24715
24110
|
};
|
|
24716
24111
|
},
|
|
24717
24112
|
toJSON(message) {
|
|
24718
24113
|
const obj = {};
|
|
24719
24114
|
if (message.identityPublicKey.length !== 0) {
|
|
24720
|
-
obj.identityPublicKey =
|
|
24115
|
+
obj.identityPublicKey = base64FromBytes4(message.identityPublicKey);
|
|
24721
24116
|
}
|
|
24722
24117
|
if (message.partialTokenTransaction !== void 0) {
|
|
24723
24118
|
obj.partialTokenTransaction = TokenTransaction2.toJSON(message.partialTokenTransaction);
|
|
@@ -24748,7 +24143,7 @@ function createBaseStartTransactionResponse() {
|
|
|
24748
24143
|
return { finalTokenTransaction: void 0, keyshareInfo: void 0 };
|
|
24749
24144
|
}
|
|
24750
24145
|
var StartTransactionResponse = {
|
|
24751
|
-
encode(message, writer = new
|
|
24146
|
+
encode(message, writer = new import_wire7.BinaryWriter()) {
|
|
24752
24147
|
if (message.finalTokenTransaction !== void 0) {
|
|
24753
24148
|
TokenTransaction2.encode(message.finalTokenTransaction, writer.uint32(10).fork()).join();
|
|
24754
24149
|
}
|
|
@@ -24758,7 +24153,7 @@ var StartTransactionResponse = {
|
|
|
24758
24153
|
return writer;
|
|
24759
24154
|
},
|
|
24760
24155
|
decode(input, length) {
|
|
24761
|
-
const reader = input instanceof
|
|
24156
|
+
const reader = input instanceof import_wire7.BinaryReader ? input : new import_wire7.BinaryReader(input);
|
|
24762
24157
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
24763
24158
|
const message = createBaseStartTransactionResponse();
|
|
24764
24159
|
while (reader.pos < end) {
|
|
@@ -24788,8 +24183,8 @@ var StartTransactionResponse = {
|
|
|
24788
24183
|
},
|
|
24789
24184
|
fromJSON(object) {
|
|
24790
24185
|
return {
|
|
24791
|
-
finalTokenTransaction:
|
|
24792
|
-
keyshareInfo:
|
|
24186
|
+
finalTokenTransaction: isSet5(object.finalTokenTransaction) ? TokenTransaction2.fromJSON(object.finalTokenTransaction) : void 0,
|
|
24187
|
+
keyshareInfo: isSet5(object.keyshareInfo) ? SigningKeyshare.fromJSON(object.keyshareInfo) : void 0
|
|
24793
24188
|
};
|
|
24794
24189
|
},
|
|
24795
24190
|
toJSON(message) {
|
|
@@ -24821,7 +24216,7 @@ function createBaseCommitTransactionRequest() {
|
|
|
24821
24216
|
};
|
|
24822
24217
|
}
|
|
24823
24218
|
var CommitTransactionRequest = {
|
|
24824
|
-
encode(message, writer = new
|
|
24219
|
+
encode(message, writer = new import_wire7.BinaryWriter()) {
|
|
24825
24220
|
if (message.finalTokenTransaction !== void 0) {
|
|
24826
24221
|
TokenTransaction2.encode(message.finalTokenTransaction, writer.uint32(10).fork()).join();
|
|
24827
24222
|
}
|
|
@@ -24837,7 +24232,7 @@ var CommitTransactionRequest = {
|
|
|
24837
24232
|
return writer;
|
|
24838
24233
|
},
|
|
24839
24234
|
decode(input, length) {
|
|
24840
|
-
const reader = input instanceof
|
|
24235
|
+
const reader = input instanceof import_wire7.BinaryReader ? input : new import_wire7.BinaryReader(input);
|
|
24841
24236
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
24842
24237
|
const message = createBaseCommitTransactionRequest();
|
|
24843
24238
|
while (reader.pos < end) {
|
|
@@ -24881,10 +24276,10 @@ var CommitTransactionRequest = {
|
|
|
24881
24276
|
},
|
|
24882
24277
|
fromJSON(object) {
|
|
24883
24278
|
return {
|
|
24884
|
-
finalTokenTransaction:
|
|
24885
|
-
finalTokenTransactionHash:
|
|
24279
|
+
finalTokenTransaction: isSet5(object.finalTokenTransaction) ? TokenTransaction2.fromJSON(object.finalTokenTransaction) : void 0,
|
|
24280
|
+
finalTokenTransactionHash: isSet5(object.finalTokenTransactionHash) ? bytesFromBase644(object.finalTokenTransactionHash) : new Uint8Array(0),
|
|
24886
24281
|
inputTtxoSignaturesPerOperator: globalThis.Array.isArray(object?.inputTtxoSignaturesPerOperator) ? object.inputTtxoSignaturesPerOperator.map((e) => InputTtxoSignaturesPerOperator.fromJSON(e)) : [],
|
|
24887
|
-
ownerIdentityPublicKey:
|
|
24282
|
+
ownerIdentityPublicKey: isSet5(object.ownerIdentityPublicKey) ? bytesFromBase644(object.ownerIdentityPublicKey) : new Uint8Array(0)
|
|
24888
24283
|
};
|
|
24889
24284
|
},
|
|
24890
24285
|
toJSON(message) {
|
|
@@ -24893,7 +24288,7 @@ var CommitTransactionRequest = {
|
|
|
24893
24288
|
obj.finalTokenTransaction = TokenTransaction2.toJSON(message.finalTokenTransaction);
|
|
24894
24289
|
}
|
|
24895
24290
|
if (message.finalTokenTransactionHash.length !== 0) {
|
|
24896
|
-
obj.finalTokenTransactionHash =
|
|
24291
|
+
obj.finalTokenTransactionHash = base64FromBytes4(message.finalTokenTransactionHash);
|
|
24897
24292
|
}
|
|
24898
24293
|
if (message.inputTtxoSignaturesPerOperator?.length) {
|
|
24899
24294
|
obj.inputTtxoSignaturesPerOperator = message.inputTtxoSignaturesPerOperator.map(
|
|
@@ -24901,7 +24296,7 @@ var CommitTransactionRequest = {
|
|
|
24901
24296
|
);
|
|
24902
24297
|
}
|
|
24903
24298
|
if (message.ownerIdentityPublicKey.length !== 0) {
|
|
24904
|
-
obj.ownerIdentityPublicKey =
|
|
24299
|
+
obj.ownerIdentityPublicKey = base64FromBytes4(message.ownerIdentityPublicKey);
|
|
24905
24300
|
}
|
|
24906
24301
|
return obj;
|
|
24907
24302
|
},
|
|
@@ -24921,7 +24316,7 @@ function createBaseCommitProgress() {
|
|
|
24921
24316
|
return { committedOperatorPublicKeys: [], uncommittedOperatorPublicKeys: [] };
|
|
24922
24317
|
}
|
|
24923
24318
|
var CommitProgress = {
|
|
24924
|
-
encode(message, writer = new
|
|
24319
|
+
encode(message, writer = new import_wire7.BinaryWriter()) {
|
|
24925
24320
|
for (const v of message.committedOperatorPublicKeys) {
|
|
24926
24321
|
writer.uint32(10).bytes(v);
|
|
24927
24322
|
}
|
|
@@ -24931,7 +24326,7 @@ var CommitProgress = {
|
|
|
24931
24326
|
return writer;
|
|
24932
24327
|
},
|
|
24933
24328
|
decode(input, length) {
|
|
24934
|
-
const reader = input instanceof
|
|
24329
|
+
const reader = input instanceof import_wire7.BinaryReader ? input : new import_wire7.BinaryReader(input);
|
|
24935
24330
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
24936
24331
|
const message = createBaseCommitProgress();
|
|
24937
24332
|
while (reader.pos < end) {
|
|
@@ -24961,17 +24356,17 @@ var CommitProgress = {
|
|
|
24961
24356
|
},
|
|
24962
24357
|
fromJSON(object) {
|
|
24963
24358
|
return {
|
|
24964
|
-
committedOperatorPublicKeys: globalThis.Array.isArray(object?.committedOperatorPublicKeys) ? object.committedOperatorPublicKeys.map((e) =>
|
|
24965
|
-
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)) : []
|
|
24966
24361
|
};
|
|
24967
24362
|
},
|
|
24968
24363
|
toJSON(message) {
|
|
24969
24364
|
const obj = {};
|
|
24970
24365
|
if (message.committedOperatorPublicKeys?.length) {
|
|
24971
|
-
obj.committedOperatorPublicKeys = message.committedOperatorPublicKeys.map((e) =>
|
|
24366
|
+
obj.committedOperatorPublicKeys = message.committedOperatorPublicKeys.map((e) => base64FromBytes4(e));
|
|
24972
24367
|
}
|
|
24973
24368
|
if (message.uncommittedOperatorPublicKeys?.length) {
|
|
24974
|
-
obj.uncommittedOperatorPublicKeys = message.uncommittedOperatorPublicKeys.map((e) =>
|
|
24369
|
+
obj.uncommittedOperatorPublicKeys = message.uncommittedOperatorPublicKeys.map((e) => base64FromBytes4(e));
|
|
24975
24370
|
}
|
|
24976
24371
|
return obj;
|
|
24977
24372
|
},
|
|
@@ -24989,7 +24384,7 @@ function createBaseCommitTransactionResponse() {
|
|
|
24989
24384
|
return { commitStatus: 0, commitProgress: void 0 };
|
|
24990
24385
|
}
|
|
24991
24386
|
var CommitTransactionResponse = {
|
|
24992
|
-
encode(message, writer = new
|
|
24387
|
+
encode(message, writer = new import_wire7.BinaryWriter()) {
|
|
24993
24388
|
if (message.commitStatus !== 0) {
|
|
24994
24389
|
writer.uint32(8).int32(message.commitStatus);
|
|
24995
24390
|
}
|
|
@@ -24999,7 +24394,7 @@ var CommitTransactionResponse = {
|
|
|
24999
24394
|
return writer;
|
|
25000
24395
|
},
|
|
25001
24396
|
decode(input, length) {
|
|
25002
|
-
const reader = input instanceof
|
|
24397
|
+
const reader = input instanceof import_wire7.BinaryReader ? input : new import_wire7.BinaryReader(input);
|
|
25003
24398
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
25004
24399
|
const message = createBaseCommitTransactionResponse();
|
|
25005
24400
|
while (reader.pos < end) {
|
|
@@ -25029,8 +24424,8 @@ var CommitTransactionResponse = {
|
|
|
25029
24424
|
},
|
|
25030
24425
|
fromJSON(object) {
|
|
25031
24426
|
return {
|
|
25032
|
-
commitStatus:
|
|
25033
|
-
commitProgress:
|
|
24427
|
+
commitStatus: isSet5(object.commitStatus) ? commitStatusFromJSON(object.commitStatus) : 0,
|
|
24428
|
+
commitProgress: isSet5(object.commitProgress) ? CommitProgress.fromJSON(object.commitProgress) : void 0
|
|
25034
24429
|
};
|
|
25035
24430
|
},
|
|
25036
24431
|
toJSON(message) {
|
|
@@ -25057,7 +24452,7 @@ function createBaseQueryTokenMetadataRequest() {
|
|
|
25057
24452
|
return { tokenIdentifiers: [], issuerPublicKeys: [] };
|
|
25058
24453
|
}
|
|
25059
24454
|
var QueryTokenMetadataRequest = {
|
|
25060
|
-
encode(message, writer = new
|
|
24455
|
+
encode(message, writer = new import_wire7.BinaryWriter()) {
|
|
25061
24456
|
for (const v of message.tokenIdentifiers) {
|
|
25062
24457
|
writer.uint32(10).bytes(v);
|
|
25063
24458
|
}
|
|
@@ -25067,7 +24462,7 @@ var QueryTokenMetadataRequest = {
|
|
|
25067
24462
|
return writer;
|
|
25068
24463
|
},
|
|
25069
24464
|
decode(input, length) {
|
|
25070
|
-
const reader = input instanceof
|
|
24465
|
+
const reader = input instanceof import_wire7.BinaryReader ? input : new import_wire7.BinaryReader(input);
|
|
25071
24466
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
25072
24467
|
const message = createBaseQueryTokenMetadataRequest();
|
|
25073
24468
|
while (reader.pos < end) {
|
|
@@ -25097,17 +24492,17 @@ var QueryTokenMetadataRequest = {
|
|
|
25097
24492
|
},
|
|
25098
24493
|
fromJSON(object) {
|
|
25099
24494
|
return {
|
|
25100
|
-
tokenIdentifiers: globalThis.Array.isArray(object?.tokenIdentifiers) ? object.tokenIdentifiers.map((e) =>
|
|
25101
|
-
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)) : []
|
|
25102
24497
|
};
|
|
25103
24498
|
},
|
|
25104
24499
|
toJSON(message) {
|
|
25105
24500
|
const obj = {};
|
|
25106
24501
|
if (message.tokenIdentifiers?.length) {
|
|
25107
|
-
obj.tokenIdentifiers = message.tokenIdentifiers.map((e) =>
|
|
24502
|
+
obj.tokenIdentifiers = message.tokenIdentifiers.map((e) => base64FromBytes4(e));
|
|
25108
24503
|
}
|
|
25109
24504
|
if (message.issuerPublicKeys?.length) {
|
|
25110
|
-
obj.issuerPublicKeys = message.issuerPublicKeys.map((e) =>
|
|
24505
|
+
obj.issuerPublicKeys = message.issuerPublicKeys.map((e) => base64FromBytes4(e));
|
|
25111
24506
|
}
|
|
25112
24507
|
return obj;
|
|
25113
24508
|
},
|
|
@@ -25134,7 +24529,7 @@ function createBaseTokenMetadata() {
|
|
|
25134
24529
|
};
|
|
25135
24530
|
}
|
|
25136
24531
|
var TokenMetadata = {
|
|
25137
|
-
encode(message, writer = new
|
|
24532
|
+
encode(message, writer = new import_wire7.BinaryWriter()) {
|
|
25138
24533
|
if (message.issuerPublicKey.length !== 0) {
|
|
25139
24534
|
writer.uint32(10).bytes(message.issuerPublicKey);
|
|
25140
24535
|
}
|
|
@@ -25162,7 +24557,7 @@ var TokenMetadata = {
|
|
|
25162
24557
|
return writer;
|
|
25163
24558
|
},
|
|
25164
24559
|
decode(input, length) {
|
|
25165
|
-
const reader = input instanceof
|
|
24560
|
+
const reader = input instanceof import_wire7.BinaryReader ? input : new import_wire7.BinaryReader(input);
|
|
25166
24561
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
25167
24562
|
const message = createBaseTokenMetadata();
|
|
25168
24563
|
while (reader.pos < end) {
|
|
@@ -25234,20 +24629,20 @@ var TokenMetadata = {
|
|
|
25234
24629
|
},
|
|
25235
24630
|
fromJSON(object) {
|
|
25236
24631
|
return {
|
|
25237
|
-
issuerPublicKey:
|
|
25238
|
-
tokenName:
|
|
25239
|
-
tokenTicker:
|
|
25240
|
-
decimals:
|
|
25241
|
-
maxSupply:
|
|
25242
|
-
isFreezable:
|
|
25243
|
-
creationEntityPublicKey:
|
|
25244
|
-
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)
|
|
25245
24640
|
};
|
|
25246
24641
|
},
|
|
25247
24642
|
toJSON(message) {
|
|
25248
24643
|
const obj = {};
|
|
25249
24644
|
if (message.issuerPublicKey.length !== 0) {
|
|
25250
|
-
obj.issuerPublicKey =
|
|
24645
|
+
obj.issuerPublicKey = base64FromBytes4(message.issuerPublicKey);
|
|
25251
24646
|
}
|
|
25252
24647
|
if (message.tokenName !== "") {
|
|
25253
24648
|
obj.tokenName = message.tokenName;
|
|
@@ -25259,16 +24654,16 @@ var TokenMetadata = {
|
|
|
25259
24654
|
obj.decimals = Math.round(message.decimals);
|
|
25260
24655
|
}
|
|
25261
24656
|
if (message.maxSupply.length !== 0) {
|
|
25262
|
-
obj.maxSupply =
|
|
24657
|
+
obj.maxSupply = base64FromBytes4(message.maxSupply);
|
|
25263
24658
|
}
|
|
25264
24659
|
if (message.isFreezable !== false) {
|
|
25265
24660
|
obj.isFreezable = message.isFreezable;
|
|
25266
24661
|
}
|
|
25267
24662
|
if (message.creationEntityPublicKey !== void 0) {
|
|
25268
|
-
obj.creationEntityPublicKey =
|
|
24663
|
+
obj.creationEntityPublicKey = base64FromBytes4(message.creationEntityPublicKey);
|
|
25269
24664
|
}
|
|
25270
24665
|
if (message.tokenIdentifier.length !== 0) {
|
|
25271
|
-
obj.tokenIdentifier =
|
|
24666
|
+
obj.tokenIdentifier = base64FromBytes4(message.tokenIdentifier);
|
|
25272
24667
|
}
|
|
25273
24668
|
return obj;
|
|
25274
24669
|
},
|
|
@@ -25292,14 +24687,14 @@ function createBaseQueryTokenMetadataResponse() {
|
|
|
25292
24687
|
return { tokenMetadata: [] };
|
|
25293
24688
|
}
|
|
25294
24689
|
var QueryTokenMetadataResponse = {
|
|
25295
|
-
encode(message, writer = new
|
|
24690
|
+
encode(message, writer = new import_wire7.BinaryWriter()) {
|
|
25296
24691
|
for (const v of message.tokenMetadata) {
|
|
25297
24692
|
TokenMetadata.encode(v, writer.uint32(10).fork()).join();
|
|
25298
24693
|
}
|
|
25299
24694
|
return writer;
|
|
25300
24695
|
},
|
|
25301
24696
|
decode(input, length) {
|
|
25302
|
-
const reader = input instanceof
|
|
24697
|
+
const reader = input instanceof import_wire7.BinaryReader ? input : new import_wire7.BinaryReader(input);
|
|
25303
24698
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
25304
24699
|
const message = createBaseQueryTokenMetadataResponse();
|
|
25305
24700
|
while (reader.pos < end) {
|
|
@@ -25345,7 +24740,7 @@ function createBaseQueryTokenOutputsRequest2() {
|
|
|
25345
24740
|
return { ownerPublicKeys: [], issuerPublicKeys: [], tokenIdentifiers: [], network: 0, pageRequest: void 0 };
|
|
25346
24741
|
}
|
|
25347
24742
|
var QueryTokenOutputsRequest2 = {
|
|
25348
|
-
encode(message, writer = new
|
|
24743
|
+
encode(message, writer = new import_wire7.BinaryWriter()) {
|
|
25349
24744
|
for (const v of message.ownerPublicKeys) {
|
|
25350
24745
|
writer.uint32(10).bytes(v);
|
|
25351
24746
|
}
|
|
@@ -25364,7 +24759,7 @@ var QueryTokenOutputsRequest2 = {
|
|
|
25364
24759
|
return writer;
|
|
25365
24760
|
},
|
|
25366
24761
|
decode(input, length) {
|
|
25367
|
-
const reader = input instanceof
|
|
24762
|
+
const reader = input instanceof import_wire7.BinaryReader ? input : new import_wire7.BinaryReader(input);
|
|
25368
24763
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
25369
24764
|
const message = createBaseQueryTokenOutputsRequest2();
|
|
25370
24765
|
while (reader.pos < end) {
|
|
@@ -25415,23 +24810,23 @@ var QueryTokenOutputsRequest2 = {
|
|
|
25415
24810
|
},
|
|
25416
24811
|
fromJSON(object) {
|
|
25417
24812
|
return {
|
|
25418
|
-
ownerPublicKeys: globalThis.Array.isArray(object?.ownerPublicKeys) ? object.ownerPublicKeys.map((e) =>
|
|
25419
|
-
issuerPublicKeys: globalThis.Array.isArray(object?.issuerPublicKeys) ? object.issuerPublicKeys.map((e) =>
|
|
25420
|
-
tokenIdentifiers: globalThis.Array.isArray(object?.tokenIdentifiers) ? object.tokenIdentifiers.map((e) =>
|
|
25421
|
-
network:
|
|
25422
|
-
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
|
|
25423
24818
|
};
|
|
25424
24819
|
},
|
|
25425
24820
|
toJSON(message) {
|
|
25426
24821
|
const obj = {};
|
|
25427
24822
|
if (message.ownerPublicKeys?.length) {
|
|
25428
|
-
obj.ownerPublicKeys = message.ownerPublicKeys.map((e) =>
|
|
24823
|
+
obj.ownerPublicKeys = message.ownerPublicKeys.map((e) => base64FromBytes4(e));
|
|
25429
24824
|
}
|
|
25430
24825
|
if (message.issuerPublicKeys?.length) {
|
|
25431
|
-
obj.issuerPublicKeys = message.issuerPublicKeys.map((e) =>
|
|
24826
|
+
obj.issuerPublicKeys = message.issuerPublicKeys.map((e) => base64FromBytes4(e));
|
|
25432
24827
|
}
|
|
25433
24828
|
if (message.tokenIdentifiers?.length) {
|
|
25434
|
-
obj.tokenIdentifiers = message.tokenIdentifiers.map((e) =>
|
|
24829
|
+
obj.tokenIdentifiers = message.tokenIdentifiers.map((e) => base64FromBytes4(e));
|
|
25435
24830
|
}
|
|
25436
24831
|
if (message.network !== 0) {
|
|
25437
24832
|
obj.network = networkToJSON(message.network);
|
|
@@ -25466,7 +24861,7 @@ function createBaseQueryTokenTransactionsRequest2() {
|
|
|
25466
24861
|
};
|
|
25467
24862
|
}
|
|
25468
24863
|
var QueryTokenTransactionsRequest2 = {
|
|
25469
|
-
encode(message, writer = new
|
|
24864
|
+
encode(message, writer = new import_wire7.BinaryWriter()) {
|
|
25470
24865
|
for (const v of message.outputIds) {
|
|
25471
24866
|
writer.uint32(10).string(v);
|
|
25472
24867
|
}
|
|
@@ -25491,7 +24886,7 @@ var QueryTokenTransactionsRequest2 = {
|
|
|
25491
24886
|
return writer;
|
|
25492
24887
|
},
|
|
25493
24888
|
decode(input, length) {
|
|
25494
|
-
const reader = input instanceof
|
|
24889
|
+
const reader = input instanceof import_wire7.BinaryReader ? input : new import_wire7.BinaryReader(input);
|
|
25495
24890
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
25496
24891
|
const message = createBaseQueryTokenTransactionsRequest2();
|
|
25497
24892
|
while (reader.pos < end) {
|
|
@@ -25557,12 +24952,12 @@ var QueryTokenTransactionsRequest2 = {
|
|
|
25557
24952
|
fromJSON(object) {
|
|
25558
24953
|
return {
|
|
25559
24954
|
outputIds: globalThis.Array.isArray(object?.outputIds) ? object.outputIds.map((e) => globalThis.String(e)) : [],
|
|
25560
|
-
ownerPublicKeys: globalThis.Array.isArray(object?.ownerPublicKeys) ? object.ownerPublicKeys.map((e) =>
|
|
25561
|
-
issuerPublicKeys: globalThis.Array.isArray(object?.issuerPublicKeys) ? object.issuerPublicKeys.map((e) =>
|
|
25562
|
-
tokenIdentifiers: globalThis.Array.isArray(object?.tokenIdentifiers) ? object.tokenIdentifiers.map((e) =>
|
|
25563
|
-
tokenTransactionHashes: globalThis.Array.isArray(object?.tokenTransactionHashes) ? object.tokenTransactionHashes.map((e) =>
|
|
25564
|
-
limit:
|
|
25565
|
-
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
|
|
25566
24961
|
};
|
|
25567
24962
|
},
|
|
25568
24963
|
toJSON(message) {
|
|
@@ -25571,16 +24966,16 @@ var QueryTokenTransactionsRequest2 = {
|
|
|
25571
24966
|
obj.outputIds = message.outputIds;
|
|
25572
24967
|
}
|
|
25573
24968
|
if (message.ownerPublicKeys?.length) {
|
|
25574
|
-
obj.ownerPublicKeys = message.ownerPublicKeys.map((e) =>
|
|
24969
|
+
obj.ownerPublicKeys = message.ownerPublicKeys.map((e) => base64FromBytes4(e));
|
|
25575
24970
|
}
|
|
25576
24971
|
if (message.issuerPublicKeys?.length) {
|
|
25577
|
-
obj.issuerPublicKeys = message.issuerPublicKeys.map((e) =>
|
|
24972
|
+
obj.issuerPublicKeys = message.issuerPublicKeys.map((e) => base64FromBytes4(e));
|
|
25578
24973
|
}
|
|
25579
24974
|
if (message.tokenIdentifiers?.length) {
|
|
25580
|
-
obj.tokenIdentifiers = message.tokenIdentifiers.map((e) =>
|
|
24975
|
+
obj.tokenIdentifiers = message.tokenIdentifiers.map((e) => base64FromBytes4(e));
|
|
25581
24976
|
}
|
|
25582
24977
|
if (message.tokenTransactionHashes?.length) {
|
|
25583
|
-
obj.tokenTransactionHashes = message.tokenTransactionHashes.map((e) =>
|
|
24978
|
+
obj.tokenTransactionHashes = message.tokenTransactionHashes.map((e) => base64FromBytes4(e));
|
|
25584
24979
|
}
|
|
25585
24980
|
if (message.limit !== 0) {
|
|
25586
24981
|
obj.limit = Math.round(message.limit);
|
|
@@ -25609,7 +25004,7 @@ function createBaseQueryTokenTransactionsResponse2() {
|
|
|
25609
25004
|
return { tokenTransactionsWithStatus: [], offset: 0 };
|
|
25610
25005
|
}
|
|
25611
25006
|
var QueryTokenTransactionsResponse2 = {
|
|
25612
|
-
encode(message, writer = new
|
|
25007
|
+
encode(message, writer = new import_wire7.BinaryWriter()) {
|
|
25613
25008
|
for (const v of message.tokenTransactionsWithStatus) {
|
|
25614
25009
|
TokenTransactionWithStatus2.encode(v, writer.uint32(10).fork()).join();
|
|
25615
25010
|
}
|
|
@@ -25619,7 +25014,7 @@ var QueryTokenTransactionsResponse2 = {
|
|
|
25619
25014
|
return writer;
|
|
25620
25015
|
},
|
|
25621
25016
|
decode(input, length) {
|
|
25622
|
-
const reader = input instanceof
|
|
25017
|
+
const reader = input instanceof import_wire7.BinaryReader ? input : new import_wire7.BinaryReader(input);
|
|
25623
25018
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
25624
25019
|
const message = createBaseQueryTokenTransactionsResponse2();
|
|
25625
25020
|
while (reader.pos < end) {
|
|
@@ -25650,7 +25045,7 @@ var QueryTokenTransactionsResponse2 = {
|
|
|
25650
25045
|
fromJSON(object) {
|
|
25651
25046
|
return {
|
|
25652
25047
|
tokenTransactionsWithStatus: globalThis.Array.isArray(object?.tokenTransactionsWithStatus) ? object.tokenTransactionsWithStatus.map((e) => TokenTransactionWithStatus2.fromJSON(e)) : [],
|
|
25653
|
-
offset:
|
|
25048
|
+
offset: isSet5(object.offset) ? globalThis.Number(object.offset) : 0
|
|
25654
25049
|
};
|
|
25655
25050
|
},
|
|
25656
25051
|
toJSON(message) {
|
|
@@ -25679,7 +25074,7 @@ function createBaseOutputWithPreviousTransactionData2() {
|
|
|
25679
25074
|
return { output: void 0, previousTransactionHash: new Uint8Array(0), previousTransactionVout: 0 };
|
|
25680
25075
|
}
|
|
25681
25076
|
var OutputWithPreviousTransactionData2 = {
|
|
25682
|
-
encode(message, writer = new
|
|
25077
|
+
encode(message, writer = new import_wire7.BinaryWriter()) {
|
|
25683
25078
|
if (message.output !== void 0) {
|
|
25684
25079
|
TokenOutput2.encode(message.output, writer.uint32(10).fork()).join();
|
|
25685
25080
|
}
|
|
@@ -25692,7 +25087,7 @@ var OutputWithPreviousTransactionData2 = {
|
|
|
25692
25087
|
return writer;
|
|
25693
25088
|
},
|
|
25694
25089
|
decode(input, length) {
|
|
25695
|
-
const reader = input instanceof
|
|
25090
|
+
const reader = input instanceof import_wire7.BinaryReader ? input : new import_wire7.BinaryReader(input);
|
|
25696
25091
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
25697
25092
|
const message = createBaseOutputWithPreviousTransactionData2();
|
|
25698
25093
|
while (reader.pos < end) {
|
|
@@ -25729,9 +25124,9 @@ var OutputWithPreviousTransactionData2 = {
|
|
|
25729
25124
|
},
|
|
25730
25125
|
fromJSON(object) {
|
|
25731
25126
|
return {
|
|
25732
|
-
output:
|
|
25733
|
-
previousTransactionHash:
|
|
25734
|
-
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
|
|
25735
25130
|
};
|
|
25736
25131
|
},
|
|
25737
25132
|
toJSON(message) {
|
|
@@ -25740,7 +25135,7 @@ var OutputWithPreviousTransactionData2 = {
|
|
|
25740
25135
|
obj.output = TokenOutput2.toJSON(message.output);
|
|
25741
25136
|
}
|
|
25742
25137
|
if (message.previousTransactionHash.length !== 0) {
|
|
25743
|
-
obj.previousTransactionHash =
|
|
25138
|
+
obj.previousTransactionHash = base64FromBytes4(message.previousTransactionHash);
|
|
25744
25139
|
}
|
|
25745
25140
|
if (message.previousTransactionVout !== 0) {
|
|
25746
25141
|
obj.previousTransactionVout = Math.round(message.previousTransactionVout);
|
|
@@ -25762,7 +25157,7 @@ function createBaseQueryTokenOutputsResponse2() {
|
|
|
25762
25157
|
return { outputsWithPreviousTransactionData: [], pageResponse: void 0 };
|
|
25763
25158
|
}
|
|
25764
25159
|
var QueryTokenOutputsResponse2 = {
|
|
25765
|
-
encode(message, writer = new
|
|
25160
|
+
encode(message, writer = new import_wire7.BinaryWriter()) {
|
|
25766
25161
|
for (const v of message.outputsWithPreviousTransactionData) {
|
|
25767
25162
|
OutputWithPreviousTransactionData2.encode(v, writer.uint32(10).fork()).join();
|
|
25768
25163
|
}
|
|
@@ -25772,7 +25167,7 @@ var QueryTokenOutputsResponse2 = {
|
|
|
25772
25167
|
return writer;
|
|
25773
25168
|
},
|
|
25774
25169
|
decode(input, length) {
|
|
25775
|
-
const reader = input instanceof
|
|
25170
|
+
const reader = input instanceof import_wire7.BinaryReader ? input : new import_wire7.BinaryReader(input);
|
|
25776
25171
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
25777
25172
|
const message = createBaseQueryTokenOutputsResponse2();
|
|
25778
25173
|
while (reader.pos < end) {
|
|
@@ -25805,7 +25200,7 @@ var QueryTokenOutputsResponse2 = {
|
|
|
25805
25200
|
fromJSON(object) {
|
|
25806
25201
|
return {
|
|
25807
25202
|
outputsWithPreviousTransactionData: globalThis.Array.isArray(object?.outputsWithPreviousTransactionData) ? object.outputsWithPreviousTransactionData.map((e) => OutputWithPreviousTransactionData2.fromJSON(e)) : [],
|
|
25808
|
-
pageResponse:
|
|
25203
|
+
pageResponse: isSet5(object.pageResponse) ? PageResponse.fromJSON(object.pageResponse) : void 0
|
|
25809
25204
|
};
|
|
25810
25205
|
},
|
|
25811
25206
|
toJSON(message) {
|
|
@@ -25834,7 +25229,7 @@ function createBaseSpentTokenOutputMetadata2() {
|
|
|
25834
25229
|
return { outputId: "", revocationSecret: new Uint8Array(0) };
|
|
25835
25230
|
}
|
|
25836
25231
|
var SpentTokenOutputMetadata2 = {
|
|
25837
|
-
encode(message, writer = new
|
|
25232
|
+
encode(message, writer = new import_wire7.BinaryWriter()) {
|
|
25838
25233
|
if (message.outputId !== "") {
|
|
25839
25234
|
writer.uint32(10).string(message.outputId);
|
|
25840
25235
|
}
|
|
@@ -25844,7 +25239,7 @@ var SpentTokenOutputMetadata2 = {
|
|
|
25844
25239
|
return writer;
|
|
25845
25240
|
},
|
|
25846
25241
|
decode(input, length) {
|
|
25847
|
-
const reader = input instanceof
|
|
25242
|
+
const reader = input instanceof import_wire7.BinaryReader ? input : new import_wire7.BinaryReader(input);
|
|
25848
25243
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
25849
25244
|
const message = createBaseSpentTokenOutputMetadata2();
|
|
25850
25245
|
while (reader.pos < end) {
|
|
@@ -25874,8 +25269,8 @@ var SpentTokenOutputMetadata2 = {
|
|
|
25874
25269
|
},
|
|
25875
25270
|
fromJSON(object) {
|
|
25876
25271
|
return {
|
|
25877
|
-
outputId:
|
|
25878
|
-
revocationSecret:
|
|
25272
|
+
outputId: isSet5(object.outputId) ? globalThis.String(object.outputId) : "",
|
|
25273
|
+
revocationSecret: isSet5(object.revocationSecret) ? bytesFromBase644(object.revocationSecret) : new Uint8Array(0)
|
|
25879
25274
|
};
|
|
25880
25275
|
},
|
|
25881
25276
|
toJSON(message) {
|
|
@@ -25884,7 +25279,7 @@ var SpentTokenOutputMetadata2 = {
|
|
|
25884
25279
|
obj.outputId = message.outputId;
|
|
25885
25280
|
}
|
|
25886
25281
|
if (message.revocationSecret.length !== 0) {
|
|
25887
|
-
obj.revocationSecret =
|
|
25282
|
+
obj.revocationSecret = base64FromBytes4(message.revocationSecret);
|
|
25888
25283
|
}
|
|
25889
25284
|
return obj;
|
|
25890
25285
|
},
|
|
@@ -25902,14 +25297,14 @@ function createBaseTokenTransactionConfirmationMetadata2() {
|
|
|
25902
25297
|
return { spentTokenOutputsMetadata: [] };
|
|
25903
25298
|
}
|
|
25904
25299
|
var TokenTransactionConfirmationMetadata2 = {
|
|
25905
|
-
encode(message, writer = new
|
|
25300
|
+
encode(message, writer = new import_wire7.BinaryWriter()) {
|
|
25906
25301
|
for (const v of message.spentTokenOutputsMetadata) {
|
|
25907
25302
|
SpentTokenOutputMetadata2.encode(v, writer.uint32(10).fork()).join();
|
|
25908
25303
|
}
|
|
25909
25304
|
return writer;
|
|
25910
25305
|
},
|
|
25911
25306
|
decode(input, length) {
|
|
25912
|
-
const reader = input instanceof
|
|
25307
|
+
const reader = input instanceof import_wire7.BinaryReader ? input : new import_wire7.BinaryReader(input);
|
|
25913
25308
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
25914
25309
|
const message = createBaseTokenTransactionConfirmationMetadata2();
|
|
25915
25310
|
while (reader.pos < end) {
|
|
@@ -25960,7 +25355,7 @@ function createBaseTokenTransactionWithStatus2() {
|
|
|
25960
25355
|
};
|
|
25961
25356
|
}
|
|
25962
25357
|
var TokenTransactionWithStatus2 = {
|
|
25963
|
-
encode(message, writer = new
|
|
25358
|
+
encode(message, writer = new import_wire7.BinaryWriter()) {
|
|
25964
25359
|
if (message.tokenTransaction !== void 0) {
|
|
25965
25360
|
TokenTransaction2.encode(message.tokenTransaction, writer.uint32(10).fork()).join();
|
|
25966
25361
|
}
|
|
@@ -25976,7 +25371,7 @@ var TokenTransactionWithStatus2 = {
|
|
|
25976
25371
|
return writer;
|
|
25977
25372
|
},
|
|
25978
25373
|
decode(input, length) {
|
|
25979
|
-
const reader = input instanceof
|
|
25374
|
+
const reader = input instanceof import_wire7.BinaryReader ? input : new import_wire7.BinaryReader(input);
|
|
25980
25375
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
25981
25376
|
const message = createBaseTokenTransactionWithStatus2();
|
|
25982
25377
|
while (reader.pos < end) {
|
|
@@ -26020,10 +25415,10 @@ var TokenTransactionWithStatus2 = {
|
|
|
26020
25415
|
},
|
|
26021
25416
|
fromJSON(object) {
|
|
26022
25417
|
return {
|
|
26023
|
-
tokenTransaction:
|
|
26024
|
-
status:
|
|
26025
|
-
confirmationMetadata:
|
|
26026
|
-
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)
|
|
26027
25422
|
};
|
|
26028
25423
|
},
|
|
26029
25424
|
toJSON(message) {
|
|
@@ -26038,7 +25433,7 @@ var TokenTransactionWithStatus2 = {
|
|
|
26038
25433
|
obj.confirmationMetadata = TokenTransactionConfirmationMetadata2.toJSON(message.confirmationMetadata);
|
|
26039
25434
|
}
|
|
26040
25435
|
if (message.tokenTransactionHash.length !== 0) {
|
|
26041
|
-
obj.tokenTransactionHash =
|
|
25436
|
+
obj.tokenTransactionHash = base64FromBytes4(message.tokenTransactionHash);
|
|
26042
25437
|
}
|
|
26043
25438
|
return obj;
|
|
26044
25439
|
},
|
|
@@ -26066,7 +25461,7 @@ function createBaseFreezeTokensPayload2() {
|
|
|
26066
25461
|
};
|
|
26067
25462
|
}
|
|
26068
25463
|
var FreezeTokensPayload2 = {
|
|
26069
|
-
encode(message, writer = new
|
|
25464
|
+
encode(message, writer = new import_wire7.BinaryWriter()) {
|
|
26070
25465
|
if (message.version !== 0) {
|
|
26071
25466
|
writer.uint32(8).uint32(message.version);
|
|
26072
25467
|
}
|
|
@@ -26091,7 +25486,7 @@ var FreezeTokensPayload2 = {
|
|
|
26091
25486
|
return writer;
|
|
26092
25487
|
},
|
|
26093
25488
|
decode(input, length) {
|
|
26094
|
-
const reader = input instanceof
|
|
25489
|
+
const reader = input instanceof import_wire7.BinaryReader ? input : new import_wire7.BinaryReader(input);
|
|
26095
25490
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
26096
25491
|
const message = createBaseFreezeTokensPayload2();
|
|
26097
25492
|
while (reader.pos < end) {
|
|
@@ -26156,13 +25551,13 @@ var FreezeTokensPayload2 = {
|
|
|
26156
25551
|
},
|
|
26157
25552
|
fromJSON(object) {
|
|
26158
25553
|
return {
|
|
26159
|
-
version:
|
|
26160
|
-
ownerPublicKey:
|
|
26161
|
-
tokenPublicKey:
|
|
26162
|
-
tokenIdentifier:
|
|
26163
|
-
issuerProvidedTimestamp:
|
|
26164
|
-
operatorIdentityPublicKey:
|
|
26165
|
-
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
|
|
26166
25561
|
};
|
|
26167
25562
|
},
|
|
26168
25563
|
toJSON(message) {
|
|
@@ -26171,19 +25566,19 @@ var FreezeTokensPayload2 = {
|
|
|
26171
25566
|
obj.version = Math.round(message.version);
|
|
26172
25567
|
}
|
|
26173
25568
|
if (message.ownerPublicKey.length !== 0) {
|
|
26174
|
-
obj.ownerPublicKey =
|
|
25569
|
+
obj.ownerPublicKey = base64FromBytes4(message.ownerPublicKey);
|
|
26175
25570
|
}
|
|
26176
25571
|
if (message.tokenPublicKey !== void 0) {
|
|
26177
|
-
obj.tokenPublicKey =
|
|
25572
|
+
obj.tokenPublicKey = base64FromBytes4(message.tokenPublicKey);
|
|
26178
25573
|
}
|
|
26179
25574
|
if (message.tokenIdentifier !== void 0) {
|
|
26180
|
-
obj.tokenIdentifier =
|
|
25575
|
+
obj.tokenIdentifier = base64FromBytes4(message.tokenIdentifier);
|
|
26181
25576
|
}
|
|
26182
25577
|
if (message.issuerProvidedTimestamp !== 0) {
|
|
26183
25578
|
obj.issuerProvidedTimestamp = Math.round(message.issuerProvidedTimestamp);
|
|
26184
25579
|
}
|
|
26185
25580
|
if (message.operatorIdentityPublicKey.length !== 0) {
|
|
26186
|
-
obj.operatorIdentityPublicKey =
|
|
25581
|
+
obj.operatorIdentityPublicKey = base64FromBytes4(message.operatorIdentityPublicKey);
|
|
26187
25582
|
}
|
|
26188
25583
|
if (message.shouldUnfreeze !== false) {
|
|
26189
25584
|
obj.shouldUnfreeze = message.shouldUnfreeze;
|
|
@@ -26209,7 +25604,7 @@ function createBaseFreezeTokensRequest2() {
|
|
|
26209
25604
|
return { freezeTokensPayload: void 0, issuerSignature: new Uint8Array(0) };
|
|
26210
25605
|
}
|
|
26211
25606
|
var FreezeTokensRequest2 = {
|
|
26212
|
-
encode(message, writer = new
|
|
25607
|
+
encode(message, writer = new import_wire7.BinaryWriter()) {
|
|
26213
25608
|
if (message.freezeTokensPayload !== void 0) {
|
|
26214
25609
|
FreezeTokensPayload2.encode(message.freezeTokensPayload, writer.uint32(10).fork()).join();
|
|
26215
25610
|
}
|
|
@@ -26219,7 +25614,7 @@ var FreezeTokensRequest2 = {
|
|
|
26219
25614
|
return writer;
|
|
26220
25615
|
},
|
|
26221
25616
|
decode(input, length) {
|
|
26222
|
-
const reader = input instanceof
|
|
25617
|
+
const reader = input instanceof import_wire7.BinaryReader ? input : new import_wire7.BinaryReader(input);
|
|
26223
25618
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
26224
25619
|
const message = createBaseFreezeTokensRequest2();
|
|
26225
25620
|
while (reader.pos < end) {
|
|
@@ -26249,8 +25644,8 @@ var FreezeTokensRequest2 = {
|
|
|
26249
25644
|
},
|
|
26250
25645
|
fromJSON(object) {
|
|
26251
25646
|
return {
|
|
26252
|
-
freezeTokensPayload:
|
|
26253
|
-
issuerSignature:
|
|
25647
|
+
freezeTokensPayload: isSet5(object.freezeTokensPayload) ? FreezeTokensPayload2.fromJSON(object.freezeTokensPayload) : void 0,
|
|
25648
|
+
issuerSignature: isSet5(object.issuerSignature) ? bytesFromBase644(object.issuerSignature) : new Uint8Array(0)
|
|
26254
25649
|
};
|
|
26255
25650
|
},
|
|
26256
25651
|
toJSON(message) {
|
|
@@ -26259,7 +25654,7 @@ var FreezeTokensRequest2 = {
|
|
|
26259
25654
|
obj.freezeTokensPayload = FreezeTokensPayload2.toJSON(message.freezeTokensPayload);
|
|
26260
25655
|
}
|
|
26261
25656
|
if (message.issuerSignature.length !== 0) {
|
|
26262
|
-
obj.issuerSignature =
|
|
25657
|
+
obj.issuerSignature = base64FromBytes4(message.issuerSignature);
|
|
26263
25658
|
}
|
|
26264
25659
|
return obj;
|
|
26265
25660
|
},
|
|
@@ -26277,7 +25672,7 @@ function createBaseFreezeTokensResponse2() {
|
|
|
26277
25672
|
return { impactedOutputIds: [], impactedTokenAmount: new Uint8Array(0) };
|
|
26278
25673
|
}
|
|
26279
25674
|
var FreezeTokensResponse2 = {
|
|
26280
|
-
encode(message, writer = new
|
|
25675
|
+
encode(message, writer = new import_wire7.BinaryWriter()) {
|
|
26281
25676
|
for (const v of message.impactedOutputIds) {
|
|
26282
25677
|
writer.uint32(10).string(v);
|
|
26283
25678
|
}
|
|
@@ -26287,7 +25682,7 @@ var FreezeTokensResponse2 = {
|
|
|
26287
25682
|
return writer;
|
|
26288
25683
|
},
|
|
26289
25684
|
decode(input, length) {
|
|
26290
|
-
const reader = input instanceof
|
|
25685
|
+
const reader = input instanceof import_wire7.BinaryReader ? input : new import_wire7.BinaryReader(input);
|
|
26291
25686
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
26292
25687
|
const message = createBaseFreezeTokensResponse2();
|
|
26293
25688
|
while (reader.pos < end) {
|
|
@@ -26318,7 +25713,7 @@ var FreezeTokensResponse2 = {
|
|
|
26318
25713
|
fromJSON(object) {
|
|
26319
25714
|
return {
|
|
26320
25715
|
impactedOutputIds: globalThis.Array.isArray(object?.impactedOutputIds) ? object.impactedOutputIds.map((e) => globalThis.String(e)) : [],
|
|
26321
|
-
impactedTokenAmount:
|
|
25716
|
+
impactedTokenAmount: isSet5(object.impactedTokenAmount) ? bytesFromBase644(object.impactedTokenAmount) : new Uint8Array(0)
|
|
26322
25717
|
};
|
|
26323
25718
|
},
|
|
26324
25719
|
toJSON(message) {
|
|
@@ -26327,7 +25722,7 @@ var FreezeTokensResponse2 = {
|
|
|
26327
25722
|
obj.impactedOutputIds = message.impactedOutputIds;
|
|
26328
25723
|
}
|
|
26329
25724
|
if (message.impactedTokenAmount.length !== 0) {
|
|
26330
|
-
obj.impactedTokenAmount =
|
|
25725
|
+
obj.impactedTokenAmount = base64FromBytes4(message.impactedTokenAmount);
|
|
26331
25726
|
}
|
|
26332
25727
|
return obj;
|
|
26333
25728
|
},
|
|
@@ -26403,7 +25798,7 @@ var SparkTokenServiceDefinition = {
|
|
|
26403
25798
|
}
|
|
26404
25799
|
}
|
|
26405
25800
|
};
|
|
26406
|
-
function
|
|
25801
|
+
function bytesFromBase644(b64) {
|
|
26407
25802
|
if (globalThis.Buffer) {
|
|
26408
25803
|
return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));
|
|
26409
25804
|
} else {
|
|
@@ -26415,7 +25810,7 @@ function bytesFromBase645(b64) {
|
|
|
26415
25810
|
return arr;
|
|
26416
25811
|
}
|
|
26417
25812
|
}
|
|
26418
|
-
function
|
|
25813
|
+
function base64FromBytes4(arr) {
|
|
26419
25814
|
if (globalThis.Buffer) {
|
|
26420
25815
|
return globalThis.Buffer.from(arr).toString("base64");
|
|
26421
25816
|
} else {
|
|
@@ -26455,11 +25850,11 @@ function longToNumber4(int64) {
|
|
|
26455
25850
|
}
|
|
26456
25851
|
return num;
|
|
26457
25852
|
}
|
|
26458
|
-
function
|
|
25853
|
+
function isSet5(value) {
|
|
26459
25854
|
return value !== null && value !== void 0;
|
|
26460
25855
|
}
|
|
26461
25856
|
|
|
26462
|
-
// src/services/connection.ts
|
|
25857
|
+
// src/services/connection/connection.ts
|
|
26463
25858
|
var ConnectionManager = class {
|
|
26464
25859
|
config;
|
|
26465
25860
|
clients = /* @__PURE__ */ new Map();
|
|
@@ -26489,127 +25884,70 @@ var ConnectionManager = class {
|
|
|
26489
25884
|
);
|
|
26490
25885
|
this.clients.clear();
|
|
26491
25886
|
}
|
|
26492
|
-
|
|
26493
|
-
|
|
26494
|
-
|
|
26495
|
-
|
|
26496
|
-
|
|
26497
|
-
|
|
26498
|
-
|
|
26499
|
-
|
|
26500
|
-
|
|
26501
|
-
|
|
26502
|
-
|
|
26503
|
-
|
|
26504
|
-
|
|
26505
|
-
|
|
26506
|
-
|
|
26507
|
-
|
|
26508
|
-
}
|
|
26509
|
-
}
|
|
26510
|
-
async createChannelWithTLS(address2, certPath) {
|
|
26511
|
-
try {
|
|
26512
|
-
if (import_core12.isNode && !isBun) {
|
|
26513
|
-
const grpcModule = await import("nice-grpc");
|
|
26514
|
-
const { ChannelCredentials, createChannel } = "default" in grpcModule ? grpcModule.default : grpcModule;
|
|
26515
|
-
if (certPath) {
|
|
26516
|
-
try {
|
|
26517
|
-
const fs = await import("fs");
|
|
26518
|
-
const cert = fs.readFileSync(certPath);
|
|
26519
|
-
return createChannel(address2, ChannelCredentials.createSsl(cert));
|
|
26520
|
-
} catch (error) {
|
|
26521
|
-
console.error("Error reading certificate:", error);
|
|
26522
|
-
return createChannel(
|
|
26523
|
-
address2,
|
|
26524
|
-
ChannelCredentials.createSsl(null, null, null, {
|
|
26525
|
-
rejectUnauthorized: false
|
|
26526
|
-
})
|
|
26527
|
-
);
|
|
26528
|
-
}
|
|
26529
|
-
} else {
|
|
26530
|
-
return createChannel(
|
|
26531
|
-
address2,
|
|
26532
|
-
ChannelCredentials.createSsl(null, null, null, {
|
|
26533
|
-
rejectUnauthorized: false
|
|
26534
|
-
})
|
|
26535
|
-
);
|
|
26536
|
-
}
|
|
26537
|
-
} else {
|
|
26538
|
-
const grpcModule = await import("nice-grpc-web");
|
|
26539
|
-
const { createChannel, FetchTransport } = "default" in grpcModule ? grpcModule.default : grpcModule;
|
|
26540
|
-
const { XHRTransport: XHRTransport2 } = await Promise.resolve().then(() => (init_xhr_transport(), xhr_transport_exports));
|
|
26541
|
-
return createChannel(
|
|
26542
|
-
address2,
|
|
26543
|
-
import_core12.isBare ? (0, import_nice_grpc_web.NodeHttpTransport)() : isReactNative ? XHRTransport2() : FetchTransport()
|
|
26544
|
-
);
|
|
26545
|
-
}
|
|
26546
|
-
} catch (error) {
|
|
26547
|
-
console.error("Channel creation error:", error);
|
|
26548
|
-
throw new NetworkError(
|
|
26549
|
-
"Failed to create channel",
|
|
26550
|
-
{
|
|
26551
|
-
url: address2,
|
|
26552
|
-
operation: "createChannel",
|
|
26553
|
-
errorCount: 1,
|
|
26554
|
-
errors: error instanceof Error ? error.message : String(error)
|
|
26555
|
-
},
|
|
26556
|
-
error
|
|
26557
|
-
);
|
|
26558
|
-
}
|
|
26559
|
-
}
|
|
26560
|
-
async createSparkStreamClient(address2, certPath) {
|
|
26561
|
-
if (this.streamClients.has(address2)) {
|
|
26562
|
-
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
|
+
});
|
|
26563
25903
|
}
|
|
26564
|
-
const
|
|
26565
|
-
const channel = await this.createChannelWithTLS(address2, certPath);
|
|
26566
|
-
const middleware = this.createMiddleware(address2, authToken);
|
|
25904
|
+
const middleware = this.createMiddleware(address, authToken);
|
|
26567
25905
|
const client = await this.createGrpcClient(
|
|
26568
25906
|
SparkServiceDefinition,
|
|
26569
25907
|
channel,
|
|
26570
25908
|
true,
|
|
26571
25909
|
middleware
|
|
26572
25910
|
);
|
|
26573
|
-
this.streamClients.set(
|
|
25911
|
+
this.streamClients.set(address, { client, authToken, channel });
|
|
26574
25912
|
return client;
|
|
26575
25913
|
}
|
|
26576
|
-
async createSparkClient(
|
|
26577
|
-
if (this.clients.has(
|
|
26578
|
-
return this.clients.get(
|
|
25914
|
+
async createSparkClient(address, certPath) {
|
|
25915
|
+
if (this.clients.has(address)) {
|
|
25916
|
+
return this.clients.get(address).client;
|
|
26579
25917
|
}
|
|
26580
|
-
const authToken = await this.authenticate(
|
|
26581
|
-
const channel = await this.createChannelWithTLS(
|
|
26582
|
-
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);
|
|
26583
25921
|
const client = await this.createGrpcClient(
|
|
26584
25922
|
SparkServiceDefinition,
|
|
26585
25923
|
channel,
|
|
26586
25924
|
true,
|
|
26587
25925
|
middleware
|
|
26588
25926
|
);
|
|
26589
|
-
this.clients.set(
|
|
25927
|
+
this.clients.set(address, { client, authToken });
|
|
26590
25928
|
return client;
|
|
26591
25929
|
}
|
|
26592
|
-
async createSparkTokenClient(
|
|
26593
|
-
if (this.tokenClients.has(
|
|
26594
|
-
return this.tokenClients.get(
|
|
25930
|
+
async createSparkTokenClient(address, certPath) {
|
|
25931
|
+
if (this.tokenClients.has(address)) {
|
|
25932
|
+
return this.tokenClients.get(address).client;
|
|
26595
25933
|
}
|
|
26596
|
-
const authToken = await this.authenticate(
|
|
26597
|
-
const channel = await this.createChannelWithTLS(
|
|
26598
|
-
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);
|
|
26599
25937
|
const tokenClient = await this.createGrpcClient(
|
|
26600
25938
|
SparkTokenServiceDefinition,
|
|
26601
25939
|
channel,
|
|
26602
25940
|
true,
|
|
26603
25941
|
middleware
|
|
26604
25942
|
);
|
|
26605
|
-
this.tokenClients.set(
|
|
25943
|
+
this.tokenClients.set(address, { client: tokenClient, authToken });
|
|
26606
25944
|
return tokenClient;
|
|
26607
25945
|
}
|
|
26608
|
-
async getStreamChannel(
|
|
26609
|
-
return this.streamClients.get(
|
|
25946
|
+
async getStreamChannel(address) {
|
|
25947
|
+
return this.streamClients.get(address)?.channel;
|
|
26610
25948
|
}
|
|
26611
|
-
async authenticate(
|
|
26612
|
-
const existing = this.authPromises.get(
|
|
25949
|
+
async authenticate(address, certPath) {
|
|
25950
|
+
const existing = this.authPromises.get(address);
|
|
26613
25951
|
if (existing) {
|
|
26614
25952
|
return existing;
|
|
26615
25953
|
}
|
|
@@ -26621,7 +25959,7 @@ var ConnectionManager = class {
|
|
|
26621
25959
|
try {
|
|
26622
25960
|
const identityPublicKey = await this.config.signer.getIdentityPublicKey();
|
|
26623
25961
|
sparkAuthnClient = await this.createSparkAuthnGrpcConnection(
|
|
26624
|
-
|
|
25962
|
+
address,
|
|
26625
25963
|
certPath
|
|
26626
25964
|
);
|
|
26627
25965
|
const challengeResp = await sparkAuthnClient.get_challenge({
|
|
@@ -26679,15 +26017,15 @@ var ConnectionManager = class {
|
|
|
26679
26017
|
lastError
|
|
26680
26018
|
);
|
|
26681
26019
|
})();
|
|
26682
|
-
this.authPromises.set(
|
|
26020
|
+
this.authPromises.set(address, authPromise);
|
|
26683
26021
|
try {
|
|
26684
26022
|
return await authPromise;
|
|
26685
26023
|
} finally {
|
|
26686
|
-
this.authPromises.delete(
|
|
26024
|
+
this.authPromises.delete(address);
|
|
26687
26025
|
}
|
|
26688
26026
|
}
|
|
26689
|
-
async createSparkAuthnGrpcConnection(
|
|
26690
|
-
const channel = await this.createChannelWithTLS(
|
|
26027
|
+
async createSparkAuthnGrpcConnection(address, certPath) {
|
|
26028
|
+
const channel = await this.createChannelWithTLS(address, certPath);
|
|
26691
26029
|
const authnMiddleware = this.createAuthnMiddleware();
|
|
26692
26030
|
return this.createGrpcClient(
|
|
26693
26031
|
SparkAuthnServiceDefinition,
|
|
@@ -26697,41 +26035,20 @@ var ConnectionManager = class {
|
|
|
26697
26035
|
);
|
|
26698
26036
|
}
|
|
26699
26037
|
createAuthnMiddleware() {
|
|
26700
|
-
|
|
26701
|
-
return
|
|
26702
|
-
|
|
26703
|
-
"X-Client-Env",
|
|
26704
|
-
clientEnv
|
|
26705
|
-
);
|
|
26706
|
-
return yield* call.next(call.request, {
|
|
26707
|
-
...options,
|
|
26708
|
-
metadata
|
|
26709
|
-
});
|
|
26710
|
-
}.bind(this);
|
|
26711
|
-
} else {
|
|
26712
|
-
return async function* (call, options) {
|
|
26713
|
-
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");
|
|
26714
|
-
return yield* call.next(call.request, {
|
|
26715
|
-
...options,
|
|
26716
|
-
metadata
|
|
26717
|
-
});
|
|
26718
|
-
}.bind(this);
|
|
26719
|
-
}
|
|
26038
|
+
return async function* (call, options) {
|
|
26039
|
+
return yield* call.next(call.request, options);
|
|
26040
|
+
}.bind(this);
|
|
26720
26041
|
}
|
|
26721
|
-
createMiddleware(
|
|
26722
|
-
|
|
26723
|
-
return this.createNodeMiddleware(address2, authToken);
|
|
26724
|
-
} else {
|
|
26725
|
-
return this.createBrowserMiddleware(address2, authToken);
|
|
26726
|
-
}
|
|
26042
|
+
createMiddleware(address, authToken) {
|
|
26043
|
+
return void 0;
|
|
26727
26044
|
}
|
|
26728
|
-
async *handleMiddlewareError(error,
|
|
26045
|
+
async *handleMiddlewareError(error, address, call, metadata, options) {
|
|
26729
26046
|
if ((0, import_core12.isError)(error)) {
|
|
26730
26047
|
if (error.message.includes("token has expired")) {
|
|
26731
|
-
const newAuthToken = await this.authenticate(
|
|
26732
|
-
const clientData = this.clients.get(
|
|
26048
|
+
const newAuthToken = await this.authenticate(address);
|
|
26049
|
+
const clientData = this.clients.get(address);
|
|
26733
26050
|
if (!clientData) {
|
|
26734
|
-
throw new Error(`No client found for address: ${
|
|
26051
|
+
throw new Error(`No client found for address: ${address}`);
|
|
26735
26052
|
}
|
|
26736
26053
|
clientData.authToken = newAuthToken;
|
|
26737
26054
|
return yield* call.next(call.request, {
|
|
@@ -26742,101 +26059,8 @@ var ConnectionManager = class {
|
|
|
26742
26059
|
}
|
|
26743
26060
|
throw error;
|
|
26744
26061
|
}
|
|
26745
|
-
createNodeMiddleware(address2, initialAuthToken) {
|
|
26746
|
-
return async function* (call, options) {
|
|
26747
|
-
const metadata = (0, import_nice_grpc_common2.Metadata)(options.metadata).set(
|
|
26748
|
-
"X-Client-Env",
|
|
26749
|
-
clientEnv
|
|
26750
|
-
);
|
|
26751
|
-
try {
|
|
26752
|
-
return yield* call.next(call.request, {
|
|
26753
|
-
...options,
|
|
26754
|
-
metadata: metadata.set(
|
|
26755
|
-
"Authorization",
|
|
26756
|
-
`Bearer ${this.clients.get(address2)?.authToken || initialAuthToken}`
|
|
26757
|
-
)
|
|
26758
|
-
});
|
|
26759
|
-
} catch (error) {
|
|
26760
|
-
return yield* this.handleMiddlewareError(
|
|
26761
|
-
error,
|
|
26762
|
-
address2,
|
|
26763
|
-
call,
|
|
26764
|
-
metadata,
|
|
26765
|
-
options
|
|
26766
|
-
);
|
|
26767
|
-
}
|
|
26768
|
-
}.bind(this);
|
|
26769
|
-
}
|
|
26770
|
-
createBrowserMiddleware(address2, initialAuthToken) {
|
|
26771
|
-
return async function* (call, options) {
|
|
26772
|
-
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");
|
|
26773
|
-
try {
|
|
26774
|
-
return yield* call.next(call.request, {
|
|
26775
|
-
...options,
|
|
26776
|
-
metadata: metadata.set(
|
|
26777
|
-
"Authorization",
|
|
26778
|
-
`Bearer ${this.clients.get(address2)?.authToken || initialAuthToken}`
|
|
26779
|
-
)
|
|
26780
|
-
});
|
|
26781
|
-
} catch (error) {
|
|
26782
|
-
return yield* this.handleMiddlewareError(
|
|
26783
|
-
error,
|
|
26784
|
-
address2,
|
|
26785
|
-
call,
|
|
26786
|
-
metadata,
|
|
26787
|
-
options
|
|
26788
|
-
);
|
|
26789
|
-
}
|
|
26790
|
-
}.bind(this);
|
|
26791
|
-
}
|
|
26792
26062
|
async createGrpcClient(defintion, channel, withRetries, middleware) {
|
|
26793
|
-
|
|
26794
|
-
const retryOptions = {
|
|
26795
|
-
retry: true,
|
|
26796
|
-
retryMaxAttempts: 3
|
|
26797
|
-
};
|
|
26798
|
-
let options = {};
|
|
26799
|
-
const isNodeChannel = "close" in channel;
|
|
26800
|
-
if (import_core12.isNode && isNodeChannel && !isBun) {
|
|
26801
|
-
const grpcModule = await import("nice-grpc");
|
|
26802
|
-
const { openTelemetryClientMiddleware } = await import("nice-grpc-opentelemetry");
|
|
26803
|
-
const { createClientFactory } = "default" in grpcModule ? grpcModule.default : grpcModule;
|
|
26804
|
-
clientFactory = createClientFactory();
|
|
26805
|
-
if (withRetries) {
|
|
26806
|
-
options = retryOptions;
|
|
26807
|
-
clientFactory = clientFactory.use(openTelemetryClientMiddleware()).use(import_nice_grpc_client_middleware_retry.retryMiddleware);
|
|
26808
|
-
}
|
|
26809
|
-
if (middleware) {
|
|
26810
|
-
clientFactory = clientFactory.use(middleware);
|
|
26811
|
-
}
|
|
26812
|
-
const client = clientFactory.create(defintion, channel, {
|
|
26813
|
-
"*": options
|
|
26814
|
-
});
|
|
26815
|
-
return {
|
|
26816
|
-
...client,
|
|
26817
|
-
close: channel.close.bind(channel)
|
|
26818
|
-
};
|
|
26819
|
-
} else if (!isNodeChannel) {
|
|
26820
|
-
const grpcModule = await import("nice-grpc-web");
|
|
26821
|
-
const { createClientFactory } = "default" in grpcModule ? grpcModule.default : grpcModule;
|
|
26822
|
-
clientFactory = createClientFactory();
|
|
26823
|
-
if (withRetries) {
|
|
26824
|
-
options = retryOptions;
|
|
26825
|
-
clientFactory = clientFactory.use(import_nice_grpc_client_middleware_retry.retryMiddleware);
|
|
26826
|
-
}
|
|
26827
|
-
if (middleware) {
|
|
26828
|
-
clientFactory = clientFactory.use(middleware);
|
|
26829
|
-
}
|
|
26830
|
-
const client = clientFactory.create(defintion, channel, {
|
|
26831
|
-
"*": options
|
|
26832
|
-
});
|
|
26833
|
-
return {
|
|
26834
|
-
...client,
|
|
26835
|
-
close: void 0
|
|
26836
|
-
};
|
|
26837
|
-
} else {
|
|
26838
|
-
throw new Error("Channel does not have close in NodeJS environment");
|
|
26839
|
-
}
|
|
26063
|
+
throw new Error("createGrpcClient: Not implemented");
|
|
26840
26064
|
}
|
|
26841
26065
|
};
|
|
26842
26066
|
|
|
@@ -28518,8 +27742,8 @@ var CoopExitService = class extends BaseTransferService {
|
|
|
28518
27742
|
leavesToSend: signingJobs,
|
|
28519
27743
|
ownerIdentityPublicKey: await this.config.signer.getIdentityPublicKey(),
|
|
28520
27744
|
receiverIdentityPublicKey: receiverPubKey,
|
|
28521
|
-
expiryTime: this.config.getNetwork() == 0 /* MAINNET */ ? new Date(Date.now() +
|
|
28522
|
-
//
|
|
27745
|
+
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)
|
|
27746
|
+
// 1 week 5 min for mainnet, 35 min otherwise
|
|
28523
27747
|
},
|
|
28524
27748
|
exitId: (0, import_uuidv73.uuidv7)(),
|
|
28525
27749
|
exitTxid: exitTxId
|
|
@@ -28583,24 +27807,24 @@ var DepositService = class {
|
|
|
28583
27807
|
this.connectionManager = connectionManager;
|
|
28584
27808
|
}
|
|
28585
27809
|
async validateDepositAddress({
|
|
28586
|
-
address
|
|
27810
|
+
address,
|
|
28587
27811
|
userPubkey,
|
|
28588
27812
|
verifyCoordinatorProof = false
|
|
28589
27813
|
}) {
|
|
28590
|
-
if (!
|
|
27814
|
+
if (!address.depositAddressProof || !address.depositAddressProof.proofOfPossessionSignature || !address.depositAddressProof.addressSignatures) {
|
|
28591
27815
|
throw new ValidationError(
|
|
28592
27816
|
"Proof of possession signature or address signatures is null",
|
|
28593
27817
|
{
|
|
28594
27818
|
field: "depositAddressProof",
|
|
28595
|
-
value:
|
|
27819
|
+
value: address.depositAddressProof
|
|
28596
27820
|
}
|
|
28597
27821
|
);
|
|
28598
27822
|
}
|
|
28599
|
-
const operatorPubkey = subtractPublicKeys(
|
|
27823
|
+
const operatorPubkey = subtractPublicKeys(address.verifyingKey, userPubkey);
|
|
28600
27824
|
const msg = proofOfPossessionMessageHashForDepositAddress(
|
|
28601
27825
|
await this.config.signer.getIdentityPublicKey(),
|
|
28602
27826
|
operatorPubkey,
|
|
28603
|
-
|
|
27827
|
+
address.address
|
|
28604
27828
|
);
|
|
28605
27829
|
const taprootKey = (0, import_btc_signer4.p2tr)(
|
|
28606
27830
|
operatorPubkey.slice(1, 33),
|
|
@@ -28608,7 +27832,7 @@ var DepositService = class {
|
|
|
28608
27832
|
getNetwork(this.config.getNetwork())
|
|
28609
27833
|
).tweakedPubkey;
|
|
28610
27834
|
const isVerified = import_secp256k110.schnorr.verify(
|
|
28611
|
-
|
|
27835
|
+
address.depositAddressProof.proofOfPossessionSignature,
|
|
28612
27836
|
msg,
|
|
28613
27837
|
taprootKey
|
|
28614
27838
|
);
|
|
@@ -28617,17 +27841,17 @@ var DepositService = class {
|
|
|
28617
27841
|
"Proof of possession signature verification failed",
|
|
28618
27842
|
{
|
|
28619
27843
|
field: "proofOfPossessionSignature",
|
|
28620
|
-
value:
|
|
27844
|
+
value: address.depositAddressProof.proofOfPossessionSignature
|
|
28621
27845
|
}
|
|
28622
27846
|
);
|
|
28623
27847
|
}
|
|
28624
|
-
const addrHash = (0, import_sha210.sha256)(
|
|
27848
|
+
const addrHash = (0, import_sha210.sha256)(address.address);
|
|
28625
27849
|
for (const operator of Object.values(this.config.getSigningOperators())) {
|
|
28626
27850
|
if (operator.identifier === this.config.getCoordinatorIdentifier() && !verifyCoordinatorProof) {
|
|
28627
27851
|
continue;
|
|
28628
27852
|
}
|
|
28629
27853
|
const operatorPubkey2 = (0, import_utils16.hexToBytes)(operator.identityPublicKey);
|
|
28630
|
-
const operatorSig =
|
|
27854
|
+
const operatorSig = address.depositAddressProof.addressSignatures[operator.identifier];
|
|
28631
27855
|
if (!operatorSig) {
|
|
28632
27856
|
throw new ValidationError("Operator signature not found", {
|
|
28633
27857
|
field: "addressSignatures",
|
|
@@ -29583,7 +28807,7 @@ var import_utils20 = require("@noble/hashes/utils");
|
|
|
29583
28807
|
// src/utils/token-hashing.ts
|
|
29584
28808
|
init_buffer();
|
|
29585
28809
|
var import_sha212 = require("@noble/hashes/sha2");
|
|
29586
|
-
var
|
|
28810
|
+
var import_base5 = require("@scure/base");
|
|
29587
28811
|
function hashTokenTransaction(tokenTransaction, partialHash = false) {
|
|
29588
28812
|
switch (tokenTransaction.version) {
|
|
29589
28813
|
case 1:
|
|
@@ -30425,8 +29649,8 @@ function hashTokenTransactionV2(tokenTransaction, partialHash = false) {
|
|
|
30425
29649
|
const invoice = attachment.sparkInvoice;
|
|
30426
29650
|
let idBytes;
|
|
30427
29651
|
try {
|
|
30428
|
-
const decoded =
|
|
30429
|
-
const payload = SparkAddress.decode(
|
|
29652
|
+
const decoded = import_base5.bech32m.decode(invoice, 500);
|
|
29653
|
+
const payload = SparkAddress.decode(import_base5.bech32m.fromWords(decoded.words));
|
|
30430
29654
|
if (!payload.sparkInvoiceFields || !payload.sparkInvoiceFields.id) {
|
|
30431
29655
|
throw new Error("missing spark invoice fields or id");
|
|
30432
29656
|
}
|
|
@@ -31417,7 +30641,7 @@ var import_sha213 = require("@noble/hashes/sha2");
|
|
|
31417
30641
|
var import_api = require("@opentelemetry/api");
|
|
31418
30642
|
var import_sdk_trace_base = require("@opentelemetry/sdk-trace-base");
|
|
31419
30643
|
var import_eventemitter3 = require("eventemitter3");
|
|
31420
|
-
var
|
|
30644
|
+
var import_nice_grpc_common = require("nice-grpc-common");
|
|
31421
30645
|
|
|
31422
30646
|
// src/services/signing.ts
|
|
31423
30647
|
init_buffer();
|
|
@@ -31648,15 +30872,15 @@ var BitcoinFaucet = class _BitcoinFaucet {
|
|
|
31648
30872
|
}
|
|
31649
30873
|
async refill() {
|
|
31650
30874
|
const minerPubKey = import_secp256k112.secp256k1.getPublicKey(STATIC_MINING_KEY);
|
|
31651
|
-
const
|
|
30875
|
+
const address = getP2TRAddressFromPublicKey(minerPubKey, 4 /* LOCAL */);
|
|
31652
30876
|
const scanResult = await this.call("scantxoutset", [
|
|
31653
30877
|
"start",
|
|
31654
|
-
[`addr(${
|
|
30878
|
+
[`addr(${address})`]
|
|
31655
30879
|
]);
|
|
31656
30880
|
let selectedUtxo;
|
|
31657
30881
|
let selectedUtxoAmountSats;
|
|
31658
30882
|
if (!scanResult.success || scanResult.unspents.length === 0) {
|
|
31659
|
-
const blockHash = await this.generateToAddress(1,
|
|
30883
|
+
const blockHash = await this.generateToAddress(1, address);
|
|
31660
30884
|
const block = await this.getBlock(blockHash[0]);
|
|
31661
30885
|
const fundingTx = import_btc_signer5.Transaction.fromRaw((0, import_utils22.hexToBytes)(block.tx[0].hex), {
|
|
31662
30886
|
allowUnknownOutputs: true
|
|
@@ -31829,8 +31053,8 @@ var BitcoinFaucet = class _BitcoinFaucet {
|
|
|
31829
31053
|
);
|
|
31830
31054
|
}
|
|
31831
31055
|
}
|
|
31832
|
-
async generateToAddress(numBlocks,
|
|
31833
|
-
return await this.call("generatetoaddress", [numBlocks,
|
|
31056
|
+
async generateToAddress(numBlocks, address) {
|
|
31057
|
+
return await this.call("generatetoaddress", [numBlocks, address]);
|
|
31834
31058
|
}
|
|
31835
31059
|
async getBlock(blockHash) {
|
|
31836
31060
|
return await this.call("getblock", [blockHash, 2]);
|
|
@@ -31844,7 +31068,7 @@ var BitcoinFaucet = class _BitcoinFaucet {
|
|
|
31844
31068
|
const pubKey = import_secp256k112.secp256k1.getPublicKey(key);
|
|
31845
31069
|
return getP2TRAddressFromPublicKey(pubKey, 4 /* LOCAL */);
|
|
31846
31070
|
}
|
|
31847
|
-
async sendToAddress(
|
|
31071
|
+
async sendToAddress(address, amount, blocksToGenerate = 1) {
|
|
31848
31072
|
const coin = await this.fund();
|
|
31849
31073
|
if (!coin) {
|
|
31850
31074
|
throw new Error("No coins available");
|
|
@@ -31853,7 +31077,7 @@ var BitcoinFaucet = class _BitcoinFaucet {
|
|
|
31853
31077
|
tx.addInput(coin.outpoint);
|
|
31854
31078
|
const availableAmount = COIN_AMOUNT - FEE_AMOUNT;
|
|
31855
31079
|
const destinationAddress = (0, import_btc_signer5.Address)(getNetwork(4 /* LOCAL */)).decode(
|
|
31856
|
-
|
|
31080
|
+
address
|
|
31857
31081
|
);
|
|
31858
31082
|
const destinationScript = import_btc_signer5.OutScript.encode(destinationAddress);
|
|
31859
31083
|
tx.addOutput({
|
|
@@ -31979,7 +31203,7 @@ var SparkWalletEvent = {
|
|
|
31979
31203
|
};
|
|
31980
31204
|
|
|
31981
31205
|
// src/spark-wallet/spark-wallet.ts
|
|
31982
|
-
var SparkWallet = class
|
|
31206
|
+
var SparkWallet = class extends import_eventemitter3.EventEmitter {
|
|
31983
31207
|
config;
|
|
31984
31208
|
connectionManager;
|
|
31985
31209
|
transferService;
|
|
@@ -32006,7 +31230,7 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
32006
31230
|
constructor(options, signer) {
|
|
32007
31231
|
super();
|
|
32008
31232
|
this.config = new WalletConfigService(options, signer);
|
|
32009
|
-
this.connectionManager =
|
|
31233
|
+
this.connectionManager = this.buildConnectionManager(this.config);
|
|
32010
31234
|
this.signingService = new SigningService(this.config);
|
|
32011
31235
|
this.depositService = new DepositService(
|
|
32012
31236
|
this.config,
|
|
@@ -32033,28 +31257,18 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
32033
31257
|
);
|
|
32034
31258
|
this.tracer = import_api.trace.getTracer(this.tracerId);
|
|
32035
31259
|
this.wrapSparkWalletMethodsWithTracing();
|
|
31260
|
+
this.initializeTracer(this);
|
|
31261
|
+
}
|
|
31262
|
+
static async initialize({ mnemonicOrSeed, accountNumber, signer, options = {} }) {
|
|
31263
|
+
const wallet = new this(options, signer);
|
|
31264
|
+
const initWalletResponse = await wallet.initWallet(
|
|
31265
|
+
mnemonicOrSeed,
|
|
31266
|
+
accountNumber,
|
|
31267
|
+
options
|
|
31268
|
+
);
|
|
31269
|
+
return initWalletResponse;
|
|
32036
31270
|
}
|
|
32037
|
-
|
|
32038
|
-
mnemonicOrSeed,
|
|
32039
|
-
accountNumber,
|
|
32040
|
-
signer,
|
|
32041
|
-
options
|
|
32042
|
-
}) {
|
|
32043
|
-
const wallet = new _SparkWallet(options, signer);
|
|
32044
|
-
wallet.initializeTracer(wallet);
|
|
32045
|
-
if (options && options.signerWithPreExistingKeys) {
|
|
32046
|
-
await wallet.initWalletWithoutSeed();
|
|
32047
|
-
return {
|
|
32048
|
-
wallet
|
|
32049
|
-
};
|
|
32050
|
-
}
|
|
32051
|
-
const initResponse = await wallet.initWallet(mnemonicOrSeed, accountNumber);
|
|
32052
|
-
return {
|
|
32053
|
-
wallet,
|
|
32054
|
-
...initResponse
|
|
32055
|
-
};
|
|
32056
|
-
}
|
|
32057
|
-
async initializeWallet() {
|
|
31271
|
+
async createClientsAndSyncWallet() {
|
|
32058
31272
|
this.sspClient = new SspClient(this.config);
|
|
32059
31273
|
await this.connectionManager.createClients();
|
|
32060
31274
|
if (isReactNative) {
|
|
@@ -32072,6 +31286,9 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
32072
31286
|
}
|
|
32073
31287
|
return this.sspClient;
|
|
32074
31288
|
}
|
|
31289
|
+
buildConnectionManager(config) {
|
|
31290
|
+
return new ConnectionManager(config);
|
|
31291
|
+
}
|
|
32075
31292
|
async handleStreamEvent({ event }) {
|
|
32076
31293
|
try {
|
|
32077
31294
|
if (event?.$case === "transfer" && event.transfer.transfer && event.transfer.transfer.type !== 40 /* COUNTER_SWAP */) {
|
|
@@ -32126,9 +31343,9 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
32126
31343
|
let retryCount = 0;
|
|
32127
31344
|
while (retryCount <= MAX_RETRIES) {
|
|
32128
31345
|
try {
|
|
32129
|
-
const
|
|
32130
|
-
const sparkClient = await this.connectionManager.createSparkStreamClient(
|
|
32131
|
-
const channel = await this.connectionManager.getStreamChannel(
|
|
31346
|
+
const address = this.config.getCoordinatorAddress();
|
|
31347
|
+
const sparkClient = await this.connectionManager.createSparkStreamClient(address);
|
|
31348
|
+
const channel = await this.connectionManager.getStreamChannel(address);
|
|
32132
31349
|
const stream = sparkClient.subscribe_to_events(
|
|
32133
31350
|
{
|
|
32134
31351
|
identityPublicKey: await this.config.signer.getIdentityPublicKey()
|
|
@@ -32534,11 +31751,17 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
32534
31751
|
*
|
|
32535
31752
|
* @returns {Promise<Object>} Object containing:
|
|
32536
31753
|
* - mnemonic: The mnemonic if one was generated (undefined for raw seed)
|
|
32537
|
-
* -
|
|
32538
|
-
* - tokenBalance: Map of token balances
|
|
31754
|
+
* - wallet: The wallet instance
|
|
32539
31755
|
* @private
|
|
32540
31756
|
*/
|
|
32541
|
-
async initWallet(mnemonicOrSeed, accountNumber) {
|
|
31757
|
+
async initWallet(mnemonicOrSeed, accountNumber, options = {}) {
|
|
31758
|
+
if (options.signerWithPreExistingKeys) {
|
|
31759
|
+
await this.initWalletWithoutSeed();
|
|
31760
|
+
return {
|
|
31761
|
+
wallet: this,
|
|
31762
|
+
mnemonic: void 0
|
|
31763
|
+
};
|
|
31764
|
+
}
|
|
32542
31765
|
if (accountNumber === void 0) {
|
|
32543
31766
|
if (this.config.getNetwork() === 3 /* REGTEST */) {
|
|
32544
31767
|
accountNumber = 0;
|
|
@@ -32564,7 +31787,8 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
32564
31787
|
}
|
|
32565
31788
|
await this.initWalletFromSeed(seed, accountNumber);
|
|
32566
31789
|
return {
|
|
32567
|
-
mnemonic
|
|
31790
|
+
mnemonic,
|
|
31791
|
+
wallet: this
|
|
32568
31792
|
};
|
|
32569
31793
|
}
|
|
32570
31794
|
/**
|
|
@@ -32572,7 +31796,7 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
32572
31796
|
* @private
|
|
32573
31797
|
*/
|
|
32574
31798
|
async initWalletWithoutSeed() {
|
|
32575
|
-
await this.
|
|
31799
|
+
await this.createClientsAndSyncWallet();
|
|
32576
31800
|
const identityPublicKey = await this.config.signer.getIdentityPublicKey();
|
|
32577
31801
|
if (!identityPublicKey || identityPublicKey.length === 0) {
|
|
32578
31802
|
throw new ValidationError("Identity public key not found in signer", {
|
|
@@ -32595,7 +31819,7 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
32595
31819
|
*/
|
|
32596
31820
|
async initWalletFromSeed(seed, accountNumber) {
|
|
32597
31821
|
const identityPublicKey = await this.config.signer.createSparkWalletFromSeed(seed, accountNumber);
|
|
32598
|
-
await this.
|
|
31822
|
+
await this.createClientsAndSyncWallet();
|
|
32599
31823
|
this.sparkAddress = encodeSparkAddress({
|
|
32600
31824
|
identityPublicKey,
|
|
32601
31825
|
network: this.config.getNetworkType()
|
|
@@ -33142,16 +32366,16 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
33142
32366
|
*/
|
|
33143
32367
|
async getStaticDepositAddress() {
|
|
33144
32368
|
const signingPubkey = await this.config.signer.getStaticDepositSigningKey(0);
|
|
33145
|
-
const
|
|
32369
|
+
const address = await this.depositService.generateStaticDepositAddress({
|
|
33146
32370
|
signingPubkey
|
|
33147
32371
|
});
|
|
33148
|
-
if (!
|
|
32372
|
+
if (!address.depositAddress) {
|
|
33149
32373
|
throw new RPCError("Failed to generate static deposit address", {
|
|
33150
32374
|
method: "generateStaticDepositAddress",
|
|
33151
32375
|
params: { signingPubkey }
|
|
33152
32376
|
});
|
|
33153
32377
|
}
|
|
33154
|
-
return
|
|
32378
|
+
return address.depositAddress.address;
|
|
33155
32379
|
}
|
|
33156
32380
|
/**
|
|
33157
32381
|
* Generates a deposit address for receiving funds.
|
|
@@ -33164,17 +32388,17 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
33164
32388
|
type: "leaf" /* LEAF */,
|
|
33165
32389
|
path: leafId
|
|
33166
32390
|
});
|
|
33167
|
-
const
|
|
32391
|
+
const address = await this.depositService.generateDepositAddress({
|
|
33168
32392
|
signingPubkey,
|
|
33169
32393
|
leafId
|
|
33170
32394
|
});
|
|
33171
|
-
if (!
|
|
32395
|
+
if (!address.depositAddress) {
|
|
33172
32396
|
throw new RPCError("Failed to generate deposit address", {
|
|
33173
32397
|
method: "generateDepositAddress",
|
|
33174
32398
|
params: { signingPubkey, leafId }
|
|
33175
32399
|
});
|
|
33176
32400
|
}
|
|
33177
|
-
return
|
|
32401
|
+
return address.depositAddress.address;
|
|
33178
32402
|
}
|
|
33179
32403
|
async queryStaticDepositAddresses() {
|
|
33180
32404
|
const sparkClient = await this.connectionManager.createSparkClient(
|
|
@@ -33609,10 +32833,10 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
33609
32833
|
continue;
|
|
33610
32834
|
}
|
|
33611
32835
|
const parsedScript = import_btc_signer6.OutScript.decode(output.script);
|
|
33612
|
-
const
|
|
32836
|
+
const address = (0, import_btc_signer6.Address)(getNetwork(this.config.getNetwork())).encode(
|
|
33613
32837
|
parsedScript
|
|
33614
32838
|
);
|
|
33615
|
-
if (staticDepositAddresses.has(
|
|
32839
|
+
if (staticDepositAddresses.has(address)) {
|
|
33616
32840
|
vout = i;
|
|
33617
32841
|
break;
|
|
33618
32842
|
}
|
|
@@ -33815,12 +33039,12 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
33815
33039
|
continue;
|
|
33816
33040
|
}
|
|
33817
33041
|
const parsedScript = import_btc_signer6.OutScript.decode(output.script);
|
|
33818
|
-
const
|
|
33042
|
+
const address = (0, import_btc_signer6.Address)(getNetwork(this.config.getNetwork())).encode(
|
|
33819
33043
|
parsedScript
|
|
33820
33044
|
);
|
|
33821
|
-
if (unusedDepositAddresses.has(
|
|
33045
|
+
if (unusedDepositAddresses.has(address)) {
|
|
33822
33046
|
vout = i;
|
|
33823
|
-
depositAddress = unusedDepositAddresses.get(
|
|
33047
|
+
depositAddress = unusedDepositAddresses.get(address);
|
|
33824
33048
|
break;
|
|
33825
33049
|
}
|
|
33826
33050
|
}
|
|
@@ -33876,10 +33100,10 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
33876
33100
|
continue;
|
|
33877
33101
|
}
|
|
33878
33102
|
const parsedScript = import_btc_signer6.OutScript.decode(output.script);
|
|
33879
|
-
const
|
|
33103
|
+
const address = (0, import_btc_signer6.Address)(getNetwork(this.config.getNetwork())).encode(
|
|
33880
33104
|
parsedScript
|
|
33881
33105
|
);
|
|
33882
|
-
const unusedDepositAddress = unusedDepositAddresses.get(
|
|
33106
|
+
const unusedDepositAddress = unusedDepositAddresses.get(address);
|
|
33883
33107
|
if (unusedDepositAddress) {
|
|
33884
33108
|
vout = i;
|
|
33885
33109
|
let keyDerivation;
|
|
@@ -34013,7 +33237,7 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
34013
33237
|
}
|
|
34014
33238
|
amountSatsArray.push(amountSats);
|
|
34015
33239
|
}
|
|
34016
|
-
|
|
33240
|
+
return await this.withLeaves(async () => {
|
|
34017
33241
|
const selectLeavesToSendMap = await this.selectLeaves(amountSatsArray);
|
|
34018
33242
|
for (const [amount, selection] of selectLeavesToSendMap) {
|
|
34019
33243
|
for (let groupIndex = 0; groupIndex < selection.length; groupIndex++) {
|
|
@@ -34049,47 +33273,46 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
34049
33273
|
if (idsToRemove.size > 0) {
|
|
34050
33274
|
this.leaves = this.leaves.filter((leaf) => !idsToRemove.has(leaf.id));
|
|
34051
33275
|
}
|
|
34052
|
-
|
|
34053
|
-
|
|
34054
|
-
|
|
34055
|
-
|
|
34056
|
-
|
|
34057
|
-
|
|
34058
|
-
|
|
34059
|
-
|
|
34060
|
-
|
|
34061
|
-
|
|
34062
|
-
|
|
34063
|
-
|
|
34064
|
-
signerIdentityPublicKey,
|
|
34065
|
-
job.receiverIdentityPubkey
|
|
34066
|
-
);
|
|
34067
|
-
if (isSelfTransfer) {
|
|
34068
|
-
const pending = await this.transferService.queryTransfer(
|
|
34069
|
-
transfer.id
|
|
33276
|
+
const signerIdentityPublicKey = await this.config.signer.getIdentityPublicKey();
|
|
33277
|
+
const outcomes = await Promise.all(
|
|
33278
|
+
jobs.map(async (job) => {
|
|
33279
|
+
try {
|
|
33280
|
+
const transfer = await this.transferService.sendTransferWithKeyTweaks(
|
|
33281
|
+
job.leafKeyTweaks,
|
|
33282
|
+
job.receiverIdentityPubkey,
|
|
33283
|
+
job.sparkInvoice
|
|
33284
|
+
);
|
|
33285
|
+
const isSelfTransfer = (0, import_utils24.equalBytes)(
|
|
33286
|
+
signerIdentityPublicKey,
|
|
33287
|
+
job.receiverIdentityPubkey
|
|
34070
33288
|
);
|
|
34071
|
-
if (
|
|
34072
|
-
await this.
|
|
33289
|
+
if (isSelfTransfer) {
|
|
33290
|
+
const pending = await this.transferService.queryTransfer(
|
|
33291
|
+
transfer.id
|
|
33292
|
+
);
|
|
33293
|
+
if (pending) {
|
|
33294
|
+
await this.claimTransfer({ transfer: pending, optimize: true });
|
|
33295
|
+
}
|
|
34073
33296
|
}
|
|
33297
|
+
return {
|
|
33298
|
+
ok: true,
|
|
33299
|
+
transfer: mapTransferToWalletTransfer(
|
|
33300
|
+
transfer,
|
|
33301
|
+
(0, import_utils24.bytesToHex)(await this.config.signer.getIdentityPublicKey())
|
|
33302
|
+
),
|
|
33303
|
+
param: job.param
|
|
33304
|
+
};
|
|
33305
|
+
} catch (error) {
|
|
33306
|
+
return {
|
|
33307
|
+
ok: false,
|
|
33308
|
+
error: error instanceof Error ? error : new Error(String(error)),
|
|
33309
|
+
param: job.param
|
|
33310
|
+
};
|
|
34074
33311
|
}
|
|
34075
|
-
|
|
34076
|
-
|
|
34077
|
-
|
|
34078
|
-
|
|
34079
|
-
(0, import_utils24.bytesToHex)(await this.config.signer.getIdentityPublicKey())
|
|
34080
|
-
),
|
|
34081
|
-
param: job.param
|
|
34082
|
-
};
|
|
34083
|
-
} catch (error) {
|
|
34084
|
-
return {
|
|
34085
|
-
ok: false,
|
|
34086
|
-
error: error instanceof Error ? error : new Error(String(error)),
|
|
34087
|
-
param: job.param
|
|
34088
|
-
};
|
|
34089
|
-
}
|
|
34090
|
-
})
|
|
34091
|
-
);
|
|
34092
|
-
return outcomes;
|
|
33312
|
+
})
|
|
33313
|
+
);
|
|
33314
|
+
return outcomes;
|
|
33315
|
+
});
|
|
34093
33316
|
}
|
|
34094
33317
|
buildTweaksByAmount(selectedByAmount) {
|
|
34095
33318
|
const tweaksByAmount = /* @__PURE__ */ new Map();
|
|
@@ -34294,7 +33517,7 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
34294
33517
|
}) {
|
|
34295
33518
|
const onError = async (context) => {
|
|
34296
33519
|
const error = context.error;
|
|
34297
|
-
if (error instanceof RPCError && error.originalError instanceof
|
|
33520
|
+
if (error instanceof RPCError && error.originalError instanceof import_nice_grpc_common.ClientError && error.originalError.code === import_nice_grpc_common.Status.ALREADY_EXISTS) {
|
|
34298
33521
|
const transferToUse = context.data || transfer;
|
|
34299
33522
|
const updatedTransfer = await this.transferService.queryTransfer(
|
|
34300
33523
|
transferToUse.id
|
|
@@ -35713,11 +34936,11 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
35713
34936
|
this.leaves.push(...leavesToAdd);
|
|
35714
34937
|
}
|
|
35715
34938
|
async queryNodes(baseRequest, sparkClientAddress, pageSize = 100) {
|
|
35716
|
-
const
|
|
34939
|
+
const address = sparkClientAddress ?? this.config.getCoordinatorAddress();
|
|
35717
34940
|
const aggregatedNodes = {};
|
|
35718
34941
|
let offset = 0;
|
|
35719
34942
|
while (true) {
|
|
35720
|
-
const sparkClient = await this.connectionManager.createSparkClient(
|
|
34943
|
+
const sparkClient = await this.connectionManager.createSparkClient(address);
|
|
35721
34944
|
const response = await sparkClient.query_nodes({
|
|
35722
34945
|
...baseRequest,
|
|
35723
34946
|
limit: pageSize,
|
|
@@ -35852,26 +35075,555 @@ var import_context_async_hooks = require("@opentelemetry/context-async-hooks");
|
|
|
35852
35075
|
var import_core14 = require("@opentelemetry/core");
|
|
35853
35076
|
var import_instrumentation = require("@opentelemetry/instrumentation");
|
|
35854
35077
|
var import_instrumentation_undici = require("@opentelemetry/instrumentation-undici");
|
|
35855
|
-
|
|
35856
|
-
|
|
35857
|
-
|
|
35858
|
-
|
|
35859
|
-
|
|
35860
|
-
|
|
35861
|
-
|
|
35862
|
-
|
|
35863
|
-
|
|
35864
|
-
|
|
35865
|
-
|
|
35866
|
-
|
|
35867
|
-
|
|
35868
|
-
|
|
35078
|
+
|
|
35079
|
+
// src/services/connection/connection.node.ts
|
|
35080
|
+
init_buffer();
|
|
35081
|
+
var import_nice_grpc = require("nice-grpc");
|
|
35082
|
+
var import_nice_grpc_common2 = require("nice-grpc-common");
|
|
35083
|
+
|
|
35084
|
+
// src/proto/mock.ts
|
|
35085
|
+
init_buffer();
|
|
35086
|
+
var import_wire8 = require("@bufbuild/protobuf/wire");
|
|
35087
|
+
function interruptTransferRequest_InterruptTransferActionFromJSON(object) {
|
|
35088
|
+
switch (object) {
|
|
35089
|
+
case 0:
|
|
35090
|
+
case "NONE":
|
|
35091
|
+
return 0 /* NONE */;
|
|
35092
|
+
case 1:
|
|
35093
|
+
case "INTERRUPT":
|
|
35094
|
+
return 1 /* INTERRUPT */;
|
|
35095
|
+
case 2:
|
|
35096
|
+
case "RESUME":
|
|
35097
|
+
return 2 /* RESUME */;
|
|
35098
|
+
case -1:
|
|
35099
|
+
case "UNRECOGNIZED":
|
|
35100
|
+
default:
|
|
35101
|
+
return -1 /* UNRECOGNIZED */;
|
|
35102
|
+
}
|
|
35103
|
+
}
|
|
35104
|
+
function interruptTransferRequest_InterruptTransferActionToJSON(object) {
|
|
35105
|
+
switch (object) {
|
|
35106
|
+
case 0 /* NONE */:
|
|
35107
|
+
return "NONE";
|
|
35108
|
+
case 1 /* INTERRUPT */:
|
|
35109
|
+
return "INTERRUPT";
|
|
35110
|
+
case 2 /* RESUME */:
|
|
35111
|
+
return "RESUME";
|
|
35112
|
+
case -1 /* UNRECOGNIZED */:
|
|
35113
|
+
default:
|
|
35114
|
+
return "UNRECOGNIZED";
|
|
35115
|
+
}
|
|
35116
|
+
}
|
|
35117
|
+
function interruptCoopExitRequest_InterruptCoopExitActionFromJSON(object) {
|
|
35118
|
+
switch (object) {
|
|
35119
|
+
case 0:
|
|
35120
|
+
case "NONE":
|
|
35121
|
+
return 0 /* NONE */;
|
|
35122
|
+
case 1:
|
|
35123
|
+
case "INTERRUPT":
|
|
35124
|
+
return 1 /* INTERRUPT */;
|
|
35125
|
+
case 2:
|
|
35126
|
+
case "RESUME":
|
|
35127
|
+
return 2 /* RESUME */;
|
|
35128
|
+
case -1:
|
|
35129
|
+
case "UNRECOGNIZED":
|
|
35130
|
+
default:
|
|
35131
|
+
return -1 /* UNRECOGNIZED */;
|
|
35132
|
+
}
|
|
35133
|
+
}
|
|
35134
|
+
function interruptCoopExitRequest_InterruptCoopExitActionToJSON(object) {
|
|
35135
|
+
switch (object) {
|
|
35136
|
+
case 0 /* NONE */:
|
|
35137
|
+
return "NONE";
|
|
35138
|
+
case 1 /* INTERRUPT */:
|
|
35139
|
+
return "INTERRUPT";
|
|
35140
|
+
case 2 /* RESUME */:
|
|
35141
|
+
return "RESUME";
|
|
35142
|
+
case -1 /* UNRECOGNIZED */:
|
|
35143
|
+
default:
|
|
35144
|
+
return "UNRECOGNIZED";
|
|
35145
|
+
}
|
|
35146
|
+
}
|
|
35147
|
+
function createBaseCleanUpPreimageShareRequest() {
|
|
35148
|
+
return { paymentHash: new Uint8Array(0) };
|
|
35149
|
+
}
|
|
35150
|
+
var CleanUpPreimageShareRequest = {
|
|
35151
|
+
encode(message, writer = new import_wire8.BinaryWriter()) {
|
|
35152
|
+
if (message.paymentHash.length !== 0) {
|
|
35153
|
+
writer.uint32(10).bytes(message.paymentHash);
|
|
35154
|
+
}
|
|
35155
|
+
return writer;
|
|
35156
|
+
},
|
|
35157
|
+
decode(input, length) {
|
|
35158
|
+
const reader = input instanceof import_wire8.BinaryReader ? input : new import_wire8.BinaryReader(input);
|
|
35159
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
35160
|
+
const message = createBaseCleanUpPreimageShareRequest();
|
|
35161
|
+
while (reader.pos < end) {
|
|
35162
|
+
const tag = reader.uint32();
|
|
35163
|
+
switch (tag >>> 3) {
|
|
35164
|
+
case 1: {
|
|
35165
|
+
if (tag !== 10) {
|
|
35166
|
+
break;
|
|
35167
|
+
}
|
|
35168
|
+
message.paymentHash = reader.bytes();
|
|
35169
|
+
continue;
|
|
35170
|
+
}
|
|
35171
|
+
}
|
|
35172
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
35173
|
+
break;
|
|
35174
|
+
}
|
|
35175
|
+
reader.skip(tag & 7);
|
|
35176
|
+
}
|
|
35177
|
+
return message;
|
|
35178
|
+
},
|
|
35179
|
+
fromJSON(object) {
|
|
35180
|
+
return { paymentHash: isSet6(object.paymentHash) ? bytesFromBase645(object.paymentHash) : new Uint8Array(0) };
|
|
35181
|
+
},
|
|
35182
|
+
toJSON(message) {
|
|
35183
|
+
const obj = {};
|
|
35184
|
+
if (message.paymentHash.length !== 0) {
|
|
35185
|
+
obj.paymentHash = base64FromBytes5(message.paymentHash);
|
|
35186
|
+
}
|
|
35187
|
+
return obj;
|
|
35188
|
+
},
|
|
35189
|
+
create(base) {
|
|
35190
|
+
return CleanUpPreimageShareRequest.fromPartial(base ?? {});
|
|
35191
|
+
},
|
|
35192
|
+
fromPartial(object) {
|
|
35193
|
+
const message = createBaseCleanUpPreimageShareRequest();
|
|
35194
|
+
message.paymentHash = object.paymentHash ?? new Uint8Array(0);
|
|
35195
|
+
return message;
|
|
35196
|
+
}
|
|
35197
|
+
};
|
|
35198
|
+
function createBaseInterruptTransferRequest() {
|
|
35199
|
+
return { action: 0 };
|
|
35200
|
+
}
|
|
35201
|
+
var InterruptTransferRequest = {
|
|
35202
|
+
encode(message, writer = new import_wire8.BinaryWriter()) {
|
|
35203
|
+
if (message.action !== 0) {
|
|
35204
|
+
writer.uint32(8).int32(message.action);
|
|
35205
|
+
}
|
|
35206
|
+
return writer;
|
|
35207
|
+
},
|
|
35208
|
+
decode(input, length) {
|
|
35209
|
+
const reader = input instanceof import_wire8.BinaryReader ? input : new import_wire8.BinaryReader(input);
|
|
35210
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
35211
|
+
const message = createBaseInterruptTransferRequest();
|
|
35212
|
+
while (reader.pos < end) {
|
|
35213
|
+
const tag = reader.uint32();
|
|
35214
|
+
switch (tag >>> 3) {
|
|
35215
|
+
case 1: {
|
|
35216
|
+
if (tag !== 8) {
|
|
35217
|
+
break;
|
|
35218
|
+
}
|
|
35219
|
+
message.action = reader.int32();
|
|
35220
|
+
continue;
|
|
35221
|
+
}
|
|
35222
|
+
}
|
|
35223
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
35224
|
+
break;
|
|
35225
|
+
}
|
|
35226
|
+
reader.skip(tag & 7);
|
|
35869
35227
|
}
|
|
35870
|
-
|
|
35228
|
+
return message;
|
|
35229
|
+
},
|
|
35230
|
+
fromJSON(object) {
|
|
35871
35231
|
return {
|
|
35872
|
-
|
|
35873
|
-
...initResponse
|
|
35232
|
+
action: isSet6(object.action) ? interruptTransferRequest_InterruptTransferActionFromJSON(object.action) : 0
|
|
35874
35233
|
};
|
|
35234
|
+
},
|
|
35235
|
+
toJSON(message) {
|
|
35236
|
+
const obj = {};
|
|
35237
|
+
if (message.action !== 0) {
|
|
35238
|
+
obj.action = interruptTransferRequest_InterruptTransferActionToJSON(message.action);
|
|
35239
|
+
}
|
|
35240
|
+
return obj;
|
|
35241
|
+
},
|
|
35242
|
+
create(base) {
|
|
35243
|
+
return InterruptTransferRequest.fromPartial(base ?? {});
|
|
35244
|
+
},
|
|
35245
|
+
fromPartial(object) {
|
|
35246
|
+
const message = createBaseInterruptTransferRequest();
|
|
35247
|
+
message.action = object.action ?? 0;
|
|
35248
|
+
return message;
|
|
35249
|
+
}
|
|
35250
|
+
};
|
|
35251
|
+
function createBaseUpdateNodesStatusRequest() {
|
|
35252
|
+
return { nodeIds: [], status: "" };
|
|
35253
|
+
}
|
|
35254
|
+
var UpdateNodesStatusRequest = {
|
|
35255
|
+
encode(message, writer = new import_wire8.BinaryWriter()) {
|
|
35256
|
+
for (const v of message.nodeIds) {
|
|
35257
|
+
writer.uint32(10).string(v);
|
|
35258
|
+
}
|
|
35259
|
+
if (message.status !== "") {
|
|
35260
|
+
writer.uint32(18).string(message.status);
|
|
35261
|
+
}
|
|
35262
|
+
return writer;
|
|
35263
|
+
},
|
|
35264
|
+
decode(input, length) {
|
|
35265
|
+
const reader = input instanceof import_wire8.BinaryReader ? input : new import_wire8.BinaryReader(input);
|
|
35266
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
35267
|
+
const message = createBaseUpdateNodesStatusRequest();
|
|
35268
|
+
while (reader.pos < end) {
|
|
35269
|
+
const tag = reader.uint32();
|
|
35270
|
+
switch (tag >>> 3) {
|
|
35271
|
+
case 1: {
|
|
35272
|
+
if (tag !== 10) {
|
|
35273
|
+
break;
|
|
35274
|
+
}
|
|
35275
|
+
message.nodeIds.push(reader.string());
|
|
35276
|
+
continue;
|
|
35277
|
+
}
|
|
35278
|
+
case 2: {
|
|
35279
|
+
if (tag !== 18) {
|
|
35280
|
+
break;
|
|
35281
|
+
}
|
|
35282
|
+
message.status = reader.string();
|
|
35283
|
+
continue;
|
|
35284
|
+
}
|
|
35285
|
+
}
|
|
35286
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
35287
|
+
break;
|
|
35288
|
+
}
|
|
35289
|
+
reader.skip(tag & 7);
|
|
35290
|
+
}
|
|
35291
|
+
return message;
|
|
35292
|
+
},
|
|
35293
|
+
fromJSON(object) {
|
|
35294
|
+
return {
|
|
35295
|
+
nodeIds: globalThis.Array.isArray(object?.nodeIds) ? object.nodeIds.map((e) => globalThis.String(e)) : [],
|
|
35296
|
+
status: isSet6(object.status) ? globalThis.String(object.status) : ""
|
|
35297
|
+
};
|
|
35298
|
+
},
|
|
35299
|
+
toJSON(message) {
|
|
35300
|
+
const obj = {};
|
|
35301
|
+
if (message.nodeIds?.length) {
|
|
35302
|
+
obj.nodeIds = message.nodeIds;
|
|
35303
|
+
}
|
|
35304
|
+
if (message.status !== "") {
|
|
35305
|
+
obj.status = message.status;
|
|
35306
|
+
}
|
|
35307
|
+
return obj;
|
|
35308
|
+
},
|
|
35309
|
+
create(base) {
|
|
35310
|
+
return UpdateNodesStatusRequest.fromPartial(base ?? {});
|
|
35311
|
+
},
|
|
35312
|
+
fromPartial(object) {
|
|
35313
|
+
const message = createBaseUpdateNodesStatusRequest();
|
|
35314
|
+
message.nodeIds = object.nodeIds?.map((e) => e) || [];
|
|
35315
|
+
message.status = object.status ?? "";
|
|
35316
|
+
return message;
|
|
35317
|
+
}
|
|
35318
|
+
};
|
|
35319
|
+
function createBaseTriggerTaskRequest() {
|
|
35320
|
+
return { taskName: "" };
|
|
35321
|
+
}
|
|
35322
|
+
var TriggerTaskRequest = {
|
|
35323
|
+
encode(message, writer = new import_wire8.BinaryWriter()) {
|
|
35324
|
+
if (message.taskName !== "") {
|
|
35325
|
+
writer.uint32(10).string(message.taskName);
|
|
35326
|
+
}
|
|
35327
|
+
return writer;
|
|
35328
|
+
},
|
|
35329
|
+
decode(input, length) {
|
|
35330
|
+
const reader = input instanceof import_wire8.BinaryReader ? input : new import_wire8.BinaryReader(input);
|
|
35331
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
35332
|
+
const message = createBaseTriggerTaskRequest();
|
|
35333
|
+
while (reader.pos < end) {
|
|
35334
|
+
const tag = reader.uint32();
|
|
35335
|
+
switch (tag >>> 3) {
|
|
35336
|
+
case 1: {
|
|
35337
|
+
if (tag !== 10) {
|
|
35338
|
+
break;
|
|
35339
|
+
}
|
|
35340
|
+
message.taskName = reader.string();
|
|
35341
|
+
continue;
|
|
35342
|
+
}
|
|
35343
|
+
}
|
|
35344
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
35345
|
+
break;
|
|
35346
|
+
}
|
|
35347
|
+
reader.skip(tag & 7);
|
|
35348
|
+
}
|
|
35349
|
+
return message;
|
|
35350
|
+
},
|
|
35351
|
+
fromJSON(object) {
|
|
35352
|
+
return { taskName: isSet6(object.taskName) ? globalThis.String(object.taskName) : "" };
|
|
35353
|
+
},
|
|
35354
|
+
toJSON(message) {
|
|
35355
|
+
const obj = {};
|
|
35356
|
+
if (message.taskName !== "") {
|
|
35357
|
+
obj.taskName = message.taskName;
|
|
35358
|
+
}
|
|
35359
|
+
return obj;
|
|
35360
|
+
},
|
|
35361
|
+
create(base) {
|
|
35362
|
+
return TriggerTaskRequest.fromPartial(base ?? {});
|
|
35363
|
+
},
|
|
35364
|
+
fromPartial(object) {
|
|
35365
|
+
const message = createBaseTriggerTaskRequest();
|
|
35366
|
+
message.taskName = object.taskName ?? "";
|
|
35367
|
+
return message;
|
|
35368
|
+
}
|
|
35369
|
+
};
|
|
35370
|
+
function createBaseInterruptCoopExitRequest() {
|
|
35371
|
+
return { action: 0, targetOperator: "" };
|
|
35372
|
+
}
|
|
35373
|
+
var InterruptCoopExitRequest = {
|
|
35374
|
+
encode(message, writer = new import_wire8.BinaryWriter()) {
|
|
35375
|
+
if (message.action !== 0) {
|
|
35376
|
+
writer.uint32(8).int32(message.action);
|
|
35377
|
+
}
|
|
35378
|
+
if (message.targetOperator !== "") {
|
|
35379
|
+
writer.uint32(18).string(message.targetOperator);
|
|
35380
|
+
}
|
|
35381
|
+
return writer;
|
|
35382
|
+
},
|
|
35383
|
+
decode(input, length) {
|
|
35384
|
+
const reader = input instanceof import_wire8.BinaryReader ? input : new import_wire8.BinaryReader(input);
|
|
35385
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
35386
|
+
const message = createBaseInterruptCoopExitRequest();
|
|
35387
|
+
while (reader.pos < end) {
|
|
35388
|
+
const tag = reader.uint32();
|
|
35389
|
+
switch (tag >>> 3) {
|
|
35390
|
+
case 1: {
|
|
35391
|
+
if (tag !== 8) {
|
|
35392
|
+
break;
|
|
35393
|
+
}
|
|
35394
|
+
message.action = reader.int32();
|
|
35395
|
+
continue;
|
|
35396
|
+
}
|
|
35397
|
+
case 2: {
|
|
35398
|
+
if (tag !== 18) {
|
|
35399
|
+
break;
|
|
35400
|
+
}
|
|
35401
|
+
message.targetOperator = reader.string();
|
|
35402
|
+
continue;
|
|
35403
|
+
}
|
|
35404
|
+
}
|
|
35405
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
35406
|
+
break;
|
|
35407
|
+
}
|
|
35408
|
+
reader.skip(tag & 7);
|
|
35409
|
+
}
|
|
35410
|
+
return message;
|
|
35411
|
+
},
|
|
35412
|
+
fromJSON(object) {
|
|
35413
|
+
return {
|
|
35414
|
+
action: isSet6(object.action) ? interruptCoopExitRequest_InterruptCoopExitActionFromJSON(object.action) : 0,
|
|
35415
|
+
targetOperator: isSet6(object.targetOperator) ? globalThis.String(object.targetOperator) : ""
|
|
35416
|
+
};
|
|
35417
|
+
},
|
|
35418
|
+
toJSON(message) {
|
|
35419
|
+
const obj = {};
|
|
35420
|
+
if (message.action !== 0) {
|
|
35421
|
+
obj.action = interruptCoopExitRequest_InterruptCoopExitActionToJSON(message.action);
|
|
35422
|
+
}
|
|
35423
|
+
if (message.targetOperator !== "") {
|
|
35424
|
+
obj.targetOperator = message.targetOperator;
|
|
35425
|
+
}
|
|
35426
|
+
return obj;
|
|
35427
|
+
},
|
|
35428
|
+
create(base) {
|
|
35429
|
+
return InterruptCoopExitRequest.fromPartial(base ?? {});
|
|
35430
|
+
},
|
|
35431
|
+
fromPartial(object) {
|
|
35432
|
+
const message = createBaseInterruptCoopExitRequest();
|
|
35433
|
+
message.action = object.action ?? 0;
|
|
35434
|
+
message.targetOperator = object.targetOperator ?? "";
|
|
35435
|
+
return message;
|
|
35436
|
+
}
|
|
35437
|
+
};
|
|
35438
|
+
var MockServiceDefinition = {
|
|
35439
|
+
name: "MockService",
|
|
35440
|
+
fullName: "mock.MockService",
|
|
35441
|
+
methods: {
|
|
35442
|
+
clean_up_preimage_share: {
|
|
35443
|
+
name: "clean_up_preimage_share",
|
|
35444
|
+
requestType: CleanUpPreimageShareRequest,
|
|
35445
|
+
requestStream: false,
|
|
35446
|
+
responseType: Empty,
|
|
35447
|
+
responseStream: false,
|
|
35448
|
+
options: {}
|
|
35449
|
+
},
|
|
35450
|
+
interrupt_transfer: {
|
|
35451
|
+
name: "interrupt_transfer",
|
|
35452
|
+
requestType: InterruptTransferRequest,
|
|
35453
|
+
requestStream: false,
|
|
35454
|
+
responseType: Empty,
|
|
35455
|
+
responseStream: false,
|
|
35456
|
+
options: {}
|
|
35457
|
+
},
|
|
35458
|
+
interrupt_coop_exit: {
|
|
35459
|
+
name: "interrupt_coop_exit",
|
|
35460
|
+
requestType: InterruptCoopExitRequest,
|
|
35461
|
+
requestStream: false,
|
|
35462
|
+
responseType: Empty,
|
|
35463
|
+
responseStream: false,
|
|
35464
|
+
options: {}
|
|
35465
|
+
},
|
|
35466
|
+
update_nodes_status: {
|
|
35467
|
+
name: "update_nodes_status",
|
|
35468
|
+
requestType: UpdateNodesStatusRequest,
|
|
35469
|
+
requestStream: false,
|
|
35470
|
+
responseType: Empty,
|
|
35471
|
+
responseStream: false,
|
|
35472
|
+
options: {}
|
|
35473
|
+
},
|
|
35474
|
+
/** Triggers the execution of a scheduled task immediately by name. Used by hermetic tests */
|
|
35475
|
+
trigger_task: {
|
|
35476
|
+
name: "trigger_task",
|
|
35477
|
+
requestType: TriggerTaskRequest,
|
|
35478
|
+
requestStream: false,
|
|
35479
|
+
responseType: Empty,
|
|
35480
|
+
responseStream: false,
|
|
35481
|
+
options: {}
|
|
35482
|
+
}
|
|
35483
|
+
}
|
|
35484
|
+
};
|
|
35485
|
+
function bytesFromBase645(b64) {
|
|
35486
|
+
if (globalThis.Buffer) {
|
|
35487
|
+
return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));
|
|
35488
|
+
} else {
|
|
35489
|
+
const bin = globalThis.atob(b64);
|
|
35490
|
+
const arr = new Uint8Array(bin.length);
|
|
35491
|
+
for (let i = 0; i < bin.length; ++i) {
|
|
35492
|
+
arr[i] = bin.charCodeAt(i);
|
|
35493
|
+
}
|
|
35494
|
+
return arr;
|
|
35495
|
+
}
|
|
35496
|
+
}
|
|
35497
|
+
function base64FromBytes5(arr) {
|
|
35498
|
+
if (globalThis.Buffer) {
|
|
35499
|
+
return globalThis.Buffer.from(arr).toString("base64");
|
|
35500
|
+
} else {
|
|
35501
|
+
const bin = [];
|
|
35502
|
+
arr.forEach((byte) => {
|
|
35503
|
+
bin.push(globalThis.String.fromCharCode(byte));
|
|
35504
|
+
});
|
|
35505
|
+
return globalThis.btoa(bin.join(""));
|
|
35506
|
+
}
|
|
35507
|
+
}
|
|
35508
|
+
function isSet6(value) {
|
|
35509
|
+
return value !== null && value !== void 0;
|
|
35510
|
+
}
|
|
35511
|
+
|
|
35512
|
+
// src/services/connection/connection.node.ts
|
|
35513
|
+
var import_nice_grpc_opentelemetry = require("nice-grpc-opentelemetry");
|
|
35514
|
+
var import_nice_grpc_client_middleware_retry = require("nice-grpc-client-middleware-retry");
|
|
35515
|
+
var import_fs = __toESM(require("fs"), 1);
|
|
35516
|
+
var ConnectionManagerNodeJS = class extends ConnectionManager {
|
|
35517
|
+
constructor(config) {
|
|
35518
|
+
super(config);
|
|
35519
|
+
}
|
|
35520
|
+
async createMockClient(address) {
|
|
35521
|
+
const channel = await this.createChannelWithTLS(address);
|
|
35522
|
+
const client = (0, import_nice_grpc.createClient)(MockServiceDefinition, channel);
|
|
35523
|
+
return { ...client, close: () => channel.close() };
|
|
35524
|
+
}
|
|
35525
|
+
async createChannelWithTLS(address, certPath) {
|
|
35526
|
+
try {
|
|
35527
|
+
if (certPath) {
|
|
35528
|
+
try {
|
|
35529
|
+
const cert = import_fs.default.readFileSync(certPath);
|
|
35530
|
+
return (0, import_nice_grpc.createChannel)(address, import_nice_grpc.ChannelCredentials.createSsl(cert));
|
|
35531
|
+
} catch (error) {
|
|
35532
|
+
console.error("Error reading certificate:", error);
|
|
35533
|
+
return (0, import_nice_grpc.createChannel)(
|
|
35534
|
+
address,
|
|
35535
|
+
import_nice_grpc.ChannelCredentials.createSsl(null, null, null, {
|
|
35536
|
+
rejectUnauthorized: false
|
|
35537
|
+
})
|
|
35538
|
+
);
|
|
35539
|
+
}
|
|
35540
|
+
} else {
|
|
35541
|
+
return (0, import_nice_grpc.createChannel)(
|
|
35542
|
+
address,
|
|
35543
|
+
import_nice_grpc.ChannelCredentials.createSsl(null, null, null, {
|
|
35544
|
+
rejectUnauthorized: false
|
|
35545
|
+
})
|
|
35546
|
+
);
|
|
35547
|
+
}
|
|
35548
|
+
} catch (error) {
|
|
35549
|
+
console.error("Channel creation error:", error);
|
|
35550
|
+
throw new NetworkError(
|
|
35551
|
+
"Failed to create channel",
|
|
35552
|
+
{
|
|
35553
|
+
url: address,
|
|
35554
|
+
operation: "createChannel",
|
|
35555
|
+
errorCount: 1,
|
|
35556
|
+
errors: error instanceof Error ? error.message : String(error)
|
|
35557
|
+
},
|
|
35558
|
+
error
|
|
35559
|
+
);
|
|
35560
|
+
}
|
|
35561
|
+
}
|
|
35562
|
+
createAuthnMiddleware() {
|
|
35563
|
+
return async function* (call, options) {
|
|
35564
|
+
const metadata = (0, import_nice_grpc_common2.Metadata)(options.metadata).set(
|
|
35565
|
+
"X-Client-Env",
|
|
35566
|
+
clientEnv
|
|
35567
|
+
);
|
|
35568
|
+
return yield* call.next(call.request, {
|
|
35569
|
+
...options,
|
|
35570
|
+
metadata
|
|
35571
|
+
});
|
|
35572
|
+
}.bind(this);
|
|
35573
|
+
}
|
|
35574
|
+
createMiddleware(address, initialAuthToken) {
|
|
35575
|
+
return async function* (call, options) {
|
|
35576
|
+
const metadata = (0, import_nice_grpc_common2.Metadata)(options.metadata).set(
|
|
35577
|
+
"X-Client-Env",
|
|
35578
|
+
clientEnv
|
|
35579
|
+
);
|
|
35580
|
+
try {
|
|
35581
|
+
return yield* call.next(call.request, {
|
|
35582
|
+
...options,
|
|
35583
|
+
metadata: metadata.set(
|
|
35584
|
+
"Authorization",
|
|
35585
|
+
`Bearer ${this.clients.get(address)?.authToken || initialAuthToken}`
|
|
35586
|
+
)
|
|
35587
|
+
});
|
|
35588
|
+
} catch (error) {
|
|
35589
|
+
return yield* this.handleMiddlewareError(
|
|
35590
|
+
error,
|
|
35591
|
+
address,
|
|
35592
|
+
call,
|
|
35593
|
+
metadata,
|
|
35594
|
+
options
|
|
35595
|
+
);
|
|
35596
|
+
}
|
|
35597
|
+
}.bind(this);
|
|
35598
|
+
}
|
|
35599
|
+
async createGrpcClient(defintion, channel, withRetries, middleware) {
|
|
35600
|
+
const retryOptions = {
|
|
35601
|
+
retry: true,
|
|
35602
|
+
retryMaxAttempts: 3
|
|
35603
|
+
};
|
|
35604
|
+
let options = {};
|
|
35605
|
+
let clientFactory = (0, import_nice_grpc.createClientFactory)();
|
|
35606
|
+
if (withRetries) {
|
|
35607
|
+
options = retryOptions;
|
|
35608
|
+
clientFactory = clientFactory.use((0, import_nice_grpc_opentelemetry.openTelemetryClientMiddleware)()).use(import_nice_grpc_client_middleware_retry.retryMiddleware);
|
|
35609
|
+
}
|
|
35610
|
+
if (middleware) {
|
|
35611
|
+
clientFactory = clientFactory.use(middleware);
|
|
35612
|
+
}
|
|
35613
|
+
const client = clientFactory.create(defintion, channel, {
|
|
35614
|
+
"*": options
|
|
35615
|
+
});
|
|
35616
|
+
return {
|
|
35617
|
+
...client,
|
|
35618
|
+
close: channel.close.bind(channel)
|
|
35619
|
+
};
|
|
35620
|
+
}
|
|
35621
|
+
};
|
|
35622
|
+
|
|
35623
|
+
// src/spark-wallet/spark-wallet.node.ts
|
|
35624
|
+
var SparkWalletNodeJS = class extends SparkWallet {
|
|
35625
|
+
buildConnectionManager(config) {
|
|
35626
|
+
return new ConnectionManagerNodeJS(config);
|
|
35875
35627
|
}
|
|
35876
35628
|
initializeTracerEnv({
|
|
35877
35629
|
spanProcessors,
|
|
@@ -35913,6 +35665,7 @@ setCrypto(cryptoImpl2);
|
|
|
35913
35665
|
0 && (module.exports = {
|
|
35914
35666
|
AuthenticationError,
|
|
35915
35667
|
ConfigurationError,
|
|
35668
|
+
ConnectionManager,
|
|
35916
35669
|
DEFAULT_FEE_SATS,
|
|
35917
35670
|
DIRECT_TIMELOCK_OFFSET,
|
|
35918
35671
|
DefaultSparkSigner,
|
|
@@ -35921,7 +35674,6 @@ setCrypto(cryptoImpl2);
|
|
|
35921
35674
|
InternalValidationError,
|
|
35922
35675
|
KeyDerivationType,
|
|
35923
35676
|
LOGGER_NAMES,
|
|
35924
|
-
LRC_WALLET_NETWORK,
|
|
35925
35677
|
Network,
|
|
35926
35678
|
NetworkError,
|
|
35927
35679
|
NetworkToProto,
|