@buildonspark/spark-sdk 0.3.4 → 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 +12 -0
- package/dist/bare/index.cjs +547 -1238
- package/dist/bare/index.d.cts +676 -79
- package/dist/bare/index.d.ts +676 -79
- package/dist/bare/index.js +543 -1058
- package/dist/chunk-EHKP3Y65.js +140 -0
- package/dist/chunk-FJ7LTA2O.js +605 -0
- package/dist/chunk-LIZFXQWK.js +7 -0
- package/dist/{chunk-KIQTO4FX.js → chunk-XPHYQ2L6.js} +8128 -8727
- 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 +581 -1222
- 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 +531 -1231
- 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 +1200 -1441
- 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 +702 -1214
- package/dist/native/index.d.cts +1077 -477
- package/dist/native/index.d.ts +1077 -477
- package/dist/native/index.js +700 -1042
- 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 +87 -75
- 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-YH7MDVTT.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/debug.cjs
CHANGED
|
@@ -198,14 +198,14 @@ function passArrayJsValueToWasm0(array, malloc) {
|
|
|
198
198
|
WASM_VECTOR_LEN = array.length;
|
|
199
199
|
return ptr;
|
|
200
200
|
}
|
|
201
|
-
var imports, wasm, TextEncoder2,
|
|
201
|
+
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;
|
|
202
202
|
var init_spark_bindings = __esm({
|
|
203
203
|
"src/wasm/spark_bindings.js"() {
|
|
204
204
|
"use strict";
|
|
205
205
|
init_buffer();
|
|
206
206
|
imports = {};
|
|
207
207
|
imports["__wbindgen_placeholder__"] = imports;
|
|
208
|
-
({ TextEncoder: TextEncoder2, TextDecoder
|
|
208
|
+
({ TextEncoder: TextEncoder2, TextDecoder } = globalThis);
|
|
209
209
|
WASM_VECTOR_LEN = 0;
|
|
210
210
|
cachedUint8ArrayMemory0 = null;
|
|
211
211
|
cachedTextEncoder = new TextEncoder2("utf-8");
|
|
@@ -220,7 +220,7 @@ var init_spark_bindings = __esm({
|
|
|
220
220
|
};
|
|
221
221
|
};
|
|
222
222
|
cachedDataViewMemory0 = null;
|
|
223
|
-
cachedTextDecoder = new
|
|
223
|
+
cachedTextDecoder = new TextDecoder("utf-8", { ignoreBOM: true, fatal: true });
|
|
224
224
|
cachedTextDecoder.decode();
|
|
225
225
|
frost_nonce = imports.frost_nonce = function(key_package) {
|
|
226
226
|
_assertClass(key_package, KeyPackage);
|
|
@@ -271,10 +271,10 @@ var init_spark_bindings = __esm({
|
|
|
271
271
|
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
272
272
|
return v7;
|
|
273
273
|
};
|
|
274
|
-
construct_node_tx = imports.construct_node_tx = function(tx, vout,
|
|
274
|
+
construct_node_tx = imports.construct_node_tx = function(tx, vout, address, locktime) {
|
|
275
275
|
const ptr0 = passArray8ToWasm0(tx, wasm.__wbindgen_malloc);
|
|
276
276
|
const len0 = WASM_VECTOR_LEN;
|
|
277
|
-
const ptr1 = passStringToWasm0(
|
|
277
|
+
const ptr1 = passStringToWasm0(address, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
278
278
|
const len1 = WASM_VECTOR_LEN;
|
|
279
279
|
const ret = wasm.construct_node_tx(ptr0, len0, vout, ptr1, len1, locktime);
|
|
280
280
|
if (ret[2]) {
|
|
@@ -319,8 +319,8 @@ var init_spark_bindings = __esm({
|
|
|
319
319
|
}
|
|
320
320
|
return TransactionResult.__wrap(ret[0]);
|
|
321
321
|
};
|
|
322
|
-
create_dummy_tx = imports.create_dummy_tx = function(
|
|
323
|
-
const ptr0 = passStringToWasm0(
|
|
322
|
+
create_dummy_tx = imports.create_dummy_tx = function(address, amount_sats) {
|
|
323
|
+
const ptr0 = passStringToWasm0(address, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
324
324
|
const len0 = WASM_VECTOR_LEN;
|
|
325
325
|
const ret = wasm.create_dummy_tx(ptr0, len0, amount_sats);
|
|
326
326
|
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,180 +1241,6 @@ 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/debug.ts
|
|
1419
1245
|
var debug_exports = {};
|
|
1420
1246
|
__export(debug_exports, {
|
|
@@ -1423,6 +1249,9 @@ __export(debug_exports, {
|
|
|
1423
1249
|
module.exports = __toCommonJS(debug_exports);
|
|
1424
1250
|
init_buffer();
|
|
1425
1251
|
|
|
1252
|
+
// src/spark-wallet/spark-wallet.browser.ts
|
|
1253
|
+
init_buffer();
|
|
1254
|
+
|
|
1426
1255
|
// src/spark-wallet/spark-wallet.ts
|
|
1427
1256
|
init_buffer();
|
|
1428
1257
|
var import_core13 = require("@lightsparkdev/core");
|
|
@@ -19278,7 +19107,7 @@ var isWebExtension = (
|
|
|
19278
19107
|
"chrome" in globalThis && globalThis.chrome.runtime?.id
|
|
19279
19108
|
);
|
|
19280
19109
|
var userAgent = "navigator" in globalThis ? globalThis.navigator.userAgent || "unknown-user-agent" : void 0;
|
|
19281
|
-
var packageVersion = true ? "0.3.
|
|
19110
|
+
var packageVersion = true ? "0.3.6" : "unknown";
|
|
19282
19111
|
var baseEnvStr = "unknown";
|
|
19283
19112
|
if (isBun) {
|
|
19284
19113
|
const bunVersion = "version" in globalThis.Bun ? globalThis.Bun.version : "unknown-version";
|
|
@@ -20080,7 +19909,7 @@ var DefaultSparkSigner = class {
|
|
|
20080
19909
|
// src/utils/network.ts
|
|
20081
19910
|
init_buffer();
|
|
20082
19911
|
var btc = __toESM(require("@scure/btc-signer"), 1);
|
|
20083
|
-
var
|
|
19912
|
+
var import_base2 = require("@scure/base");
|
|
20084
19913
|
var Network2 = /* @__PURE__ */ ((Network5) => {
|
|
20085
19914
|
Network5[Network5["MAINNET"] = 0] = "MAINNET";
|
|
20086
19915
|
Network5[Network5["TESTNET"] = 1] = "TESTNET";
|
|
@@ -20118,16 +19947,16 @@ var NetworkConfig = {
|
|
|
20118
19947
|
[4 /* LOCAL */]: { ...btc.TEST_NETWORK, bech32: "bcrt" }
|
|
20119
19948
|
};
|
|
20120
19949
|
var getNetwork = (network) => NetworkConfig[network];
|
|
20121
|
-
|
|
20122
|
-
[0 /* MAINNET */]: bitcoin.networks.bitcoin,
|
|
20123
|
-
[1 /* TESTNET */]: bitcoin.networks.testnet,
|
|
20124
|
-
[2 /* SIGNET */]: bitcoin.networks.testnet,
|
|
20125
|
-
[3 /* REGTEST */]: bitcoin.networks.regtest,
|
|
20126
|
-
[4 /* LOCAL */]: bitcoin.networks.regtest
|
|
20127
|
-
});
|
|
20128
|
-
function getNetworkFromAddress(address2) {
|
|
19950
|
+
function getNetworkFromAddress(address) {
|
|
20129
19951
|
try {
|
|
20130
|
-
const
|
|
19952
|
+
const bechAddress = address;
|
|
19953
|
+
const decoded = (() => {
|
|
19954
|
+
try {
|
|
19955
|
+
return import_base2.bech32.decode(bechAddress);
|
|
19956
|
+
} catch (_) {
|
|
19957
|
+
return import_base2.bech32m.decode(bechAddress);
|
|
19958
|
+
}
|
|
19959
|
+
})();
|
|
20131
19960
|
if (decoded.prefix === "bc") {
|
|
20132
19961
|
return "MAINNET" /* MAINNET */;
|
|
20133
19962
|
} else if (decoded.prefix === "bcrt") {
|
|
@@ -20138,7 +19967,7 @@ function getNetworkFromAddress(address2) {
|
|
|
20138
19967
|
"Invalid Bitcoin address",
|
|
20139
19968
|
{
|
|
20140
19969
|
field: "address",
|
|
20141
|
-
value:
|
|
19970
|
+
value: address,
|
|
20142
19971
|
expected: "Valid Bech32 address with prefix 'bc' or 'bcrt'"
|
|
20143
19972
|
},
|
|
20144
19973
|
err instanceof Error ? err : void 0
|
|
@@ -20476,450 +20305,19 @@ var WalletConfigService = class {
|
|
|
20476
20305
|
}
|
|
20477
20306
|
};
|
|
20478
20307
|
|
|
20479
|
-
// src/services/connection.ts
|
|
20308
|
+
// src/services/connection/connection.ts
|
|
20480
20309
|
init_buffer();
|
|
20481
20310
|
var import_core12 = require("@lightsparkdev/core");
|
|
20482
20311
|
var import_sha23 = require("@noble/hashes/sha2");
|
|
20483
|
-
var import_nice_grpc_client_middleware_retry = require("nice-grpc-client-middleware-retry");
|
|
20484
|
-
var import_nice_grpc_common2 = require("nice-grpc-common");
|
|
20485
|
-
var import_nice_grpc_web = require("nice-grpc-web");
|
|
20486
|
-
|
|
20487
|
-
// src/proto/mock.ts
|
|
20488
|
-
init_buffer();
|
|
20489
|
-
var import_wire5 = require("@bufbuild/protobuf/wire");
|
|
20490
|
-
function interruptTransferRequest_InterruptTransferActionFromJSON(object) {
|
|
20491
|
-
switch (object) {
|
|
20492
|
-
case 0:
|
|
20493
|
-
case "NONE":
|
|
20494
|
-
return 0 /* NONE */;
|
|
20495
|
-
case 1:
|
|
20496
|
-
case "INTERRUPT":
|
|
20497
|
-
return 1 /* INTERRUPT */;
|
|
20498
|
-
case 2:
|
|
20499
|
-
case "RESUME":
|
|
20500
|
-
return 2 /* RESUME */;
|
|
20501
|
-
case -1:
|
|
20502
|
-
case "UNRECOGNIZED":
|
|
20503
|
-
default:
|
|
20504
|
-
return -1 /* UNRECOGNIZED */;
|
|
20505
|
-
}
|
|
20506
|
-
}
|
|
20507
|
-
function interruptTransferRequest_InterruptTransferActionToJSON(object) {
|
|
20508
|
-
switch (object) {
|
|
20509
|
-
case 0 /* NONE */:
|
|
20510
|
-
return "NONE";
|
|
20511
|
-
case 1 /* INTERRUPT */:
|
|
20512
|
-
return "INTERRUPT";
|
|
20513
|
-
case 2 /* RESUME */:
|
|
20514
|
-
return "RESUME";
|
|
20515
|
-
case -1 /* UNRECOGNIZED */:
|
|
20516
|
-
default:
|
|
20517
|
-
return "UNRECOGNIZED";
|
|
20518
|
-
}
|
|
20519
|
-
}
|
|
20520
|
-
function interruptCoopExitRequest_InterruptCoopExitActionFromJSON(object) {
|
|
20521
|
-
switch (object) {
|
|
20522
|
-
case 0:
|
|
20523
|
-
case "NONE":
|
|
20524
|
-
return 0 /* NONE */;
|
|
20525
|
-
case 1:
|
|
20526
|
-
case "INTERRUPT":
|
|
20527
|
-
return 1 /* INTERRUPT */;
|
|
20528
|
-
case 2:
|
|
20529
|
-
case "RESUME":
|
|
20530
|
-
return 2 /* RESUME */;
|
|
20531
|
-
case -1:
|
|
20532
|
-
case "UNRECOGNIZED":
|
|
20533
|
-
default:
|
|
20534
|
-
return -1 /* UNRECOGNIZED */;
|
|
20535
|
-
}
|
|
20536
|
-
}
|
|
20537
|
-
function interruptCoopExitRequest_InterruptCoopExitActionToJSON(object) {
|
|
20538
|
-
switch (object) {
|
|
20539
|
-
case 0 /* NONE */:
|
|
20540
|
-
return "NONE";
|
|
20541
|
-
case 1 /* INTERRUPT */:
|
|
20542
|
-
return "INTERRUPT";
|
|
20543
|
-
case 2 /* RESUME */:
|
|
20544
|
-
return "RESUME";
|
|
20545
|
-
case -1 /* UNRECOGNIZED */:
|
|
20546
|
-
default:
|
|
20547
|
-
return "UNRECOGNIZED";
|
|
20548
|
-
}
|
|
20549
|
-
}
|
|
20550
|
-
function createBaseCleanUpPreimageShareRequest() {
|
|
20551
|
-
return { paymentHash: new Uint8Array(0) };
|
|
20552
|
-
}
|
|
20553
|
-
var CleanUpPreimageShareRequest = {
|
|
20554
|
-
encode(message, writer = new import_wire5.BinaryWriter()) {
|
|
20555
|
-
if (message.paymentHash.length !== 0) {
|
|
20556
|
-
writer.uint32(10).bytes(message.paymentHash);
|
|
20557
|
-
}
|
|
20558
|
-
return writer;
|
|
20559
|
-
},
|
|
20560
|
-
decode(input, length) {
|
|
20561
|
-
const reader = input instanceof import_wire5.BinaryReader ? input : new import_wire5.BinaryReader(input);
|
|
20562
|
-
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
20563
|
-
const message = createBaseCleanUpPreimageShareRequest();
|
|
20564
|
-
while (reader.pos < end) {
|
|
20565
|
-
const tag = reader.uint32();
|
|
20566
|
-
switch (tag >>> 3) {
|
|
20567
|
-
case 1: {
|
|
20568
|
-
if (tag !== 10) {
|
|
20569
|
-
break;
|
|
20570
|
-
}
|
|
20571
|
-
message.paymentHash = reader.bytes();
|
|
20572
|
-
continue;
|
|
20573
|
-
}
|
|
20574
|
-
}
|
|
20575
|
-
if ((tag & 7) === 4 || tag === 0) {
|
|
20576
|
-
break;
|
|
20577
|
-
}
|
|
20578
|
-
reader.skip(tag & 7);
|
|
20579
|
-
}
|
|
20580
|
-
return message;
|
|
20581
|
-
},
|
|
20582
|
-
fromJSON(object) {
|
|
20583
|
-
return { paymentHash: isSet4(object.paymentHash) ? bytesFromBase643(object.paymentHash) : new Uint8Array(0) };
|
|
20584
|
-
},
|
|
20585
|
-
toJSON(message) {
|
|
20586
|
-
const obj = {};
|
|
20587
|
-
if (message.paymentHash.length !== 0) {
|
|
20588
|
-
obj.paymentHash = base64FromBytes3(message.paymentHash);
|
|
20589
|
-
}
|
|
20590
|
-
return obj;
|
|
20591
|
-
},
|
|
20592
|
-
create(base) {
|
|
20593
|
-
return CleanUpPreimageShareRequest.fromPartial(base ?? {});
|
|
20594
|
-
},
|
|
20595
|
-
fromPartial(object) {
|
|
20596
|
-
const message = createBaseCleanUpPreimageShareRequest();
|
|
20597
|
-
message.paymentHash = object.paymentHash ?? new Uint8Array(0);
|
|
20598
|
-
return message;
|
|
20599
|
-
}
|
|
20600
|
-
};
|
|
20601
|
-
function createBaseInterruptTransferRequest() {
|
|
20602
|
-
return { action: 0 };
|
|
20603
|
-
}
|
|
20604
|
-
var InterruptTransferRequest = {
|
|
20605
|
-
encode(message, writer = new import_wire5.BinaryWriter()) {
|
|
20606
|
-
if (message.action !== 0) {
|
|
20607
|
-
writer.uint32(8).int32(message.action);
|
|
20608
|
-
}
|
|
20609
|
-
return writer;
|
|
20610
|
-
},
|
|
20611
|
-
decode(input, length) {
|
|
20612
|
-
const reader = input instanceof import_wire5.BinaryReader ? input : new import_wire5.BinaryReader(input);
|
|
20613
|
-
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
20614
|
-
const message = createBaseInterruptTransferRequest();
|
|
20615
|
-
while (reader.pos < end) {
|
|
20616
|
-
const tag = reader.uint32();
|
|
20617
|
-
switch (tag >>> 3) {
|
|
20618
|
-
case 1: {
|
|
20619
|
-
if (tag !== 8) {
|
|
20620
|
-
break;
|
|
20621
|
-
}
|
|
20622
|
-
message.action = reader.int32();
|
|
20623
|
-
continue;
|
|
20624
|
-
}
|
|
20625
|
-
}
|
|
20626
|
-
if ((tag & 7) === 4 || tag === 0) {
|
|
20627
|
-
break;
|
|
20628
|
-
}
|
|
20629
|
-
reader.skip(tag & 7);
|
|
20630
|
-
}
|
|
20631
|
-
return message;
|
|
20632
|
-
},
|
|
20633
|
-
fromJSON(object) {
|
|
20634
|
-
return {
|
|
20635
|
-
action: isSet4(object.action) ? interruptTransferRequest_InterruptTransferActionFromJSON(object.action) : 0
|
|
20636
|
-
};
|
|
20637
|
-
},
|
|
20638
|
-
toJSON(message) {
|
|
20639
|
-
const obj = {};
|
|
20640
|
-
if (message.action !== 0) {
|
|
20641
|
-
obj.action = interruptTransferRequest_InterruptTransferActionToJSON(message.action);
|
|
20642
|
-
}
|
|
20643
|
-
return obj;
|
|
20644
|
-
},
|
|
20645
|
-
create(base) {
|
|
20646
|
-
return InterruptTransferRequest.fromPartial(base ?? {});
|
|
20647
|
-
},
|
|
20648
|
-
fromPartial(object) {
|
|
20649
|
-
const message = createBaseInterruptTransferRequest();
|
|
20650
|
-
message.action = object.action ?? 0;
|
|
20651
|
-
return message;
|
|
20652
|
-
}
|
|
20653
|
-
};
|
|
20654
|
-
function createBaseUpdateNodesStatusRequest() {
|
|
20655
|
-
return { nodeIds: [], status: "" };
|
|
20656
|
-
}
|
|
20657
|
-
var UpdateNodesStatusRequest = {
|
|
20658
|
-
encode(message, writer = new import_wire5.BinaryWriter()) {
|
|
20659
|
-
for (const v of message.nodeIds) {
|
|
20660
|
-
writer.uint32(10).string(v);
|
|
20661
|
-
}
|
|
20662
|
-
if (message.status !== "") {
|
|
20663
|
-
writer.uint32(18).string(message.status);
|
|
20664
|
-
}
|
|
20665
|
-
return writer;
|
|
20666
|
-
},
|
|
20667
|
-
decode(input, length) {
|
|
20668
|
-
const reader = input instanceof import_wire5.BinaryReader ? input : new import_wire5.BinaryReader(input);
|
|
20669
|
-
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
20670
|
-
const message = createBaseUpdateNodesStatusRequest();
|
|
20671
|
-
while (reader.pos < end) {
|
|
20672
|
-
const tag = reader.uint32();
|
|
20673
|
-
switch (tag >>> 3) {
|
|
20674
|
-
case 1: {
|
|
20675
|
-
if (tag !== 10) {
|
|
20676
|
-
break;
|
|
20677
|
-
}
|
|
20678
|
-
message.nodeIds.push(reader.string());
|
|
20679
|
-
continue;
|
|
20680
|
-
}
|
|
20681
|
-
case 2: {
|
|
20682
|
-
if (tag !== 18) {
|
|
20683
|
-
break;
|
|
20684
|
-
}
|
|
20685
|
-
message.status = reader.string();
|
|
20686
|
-
continue;
|
|
20687
|
-
}
|
|
20688
|
-
}
|
|
20689
|
-
if ((tag & 7) === 4 || tag === 0) {
|
|
20690
|
-
break;
|
|
20691
|
-
}
|
|
20692
|
-
reader.skip(tag & 7);
|
|
20693
|
-
}
|
|
20694
|
-
return message;
|
|
20695
|
-
},
|
|
20696
|
-
fromJSON(object) {
|
|
20697
|
-
return {
|
|
20698
|
-
nodeIds: globalThis.Array.isArray(object?.nodeIds) ? object.nodeIds.map((e) => globalThis.String(e)) : [],
|
|
20699
|
-
status: isSet4(object.status) ? globalThis.String(object.status) : ""
|
|
20700
|
-
};
|
|
20701
|
-
},
|
|
20702
|
-
toJSON(message) {
|
|
20703
|
-
const obj = {};
|
|
20704
|
-
if (message.nodeIds?.length) {
|
|
20705
|
-
obj.nodeIds = message.nodeIds;
|
|
20706
|
-
}
|
|
20707
|
-
if (message.status !== "") {
|
|
20708
|
-
obj.status = message.status;
|
|
20709
|
-
}
|
|
20710
|
-
return obj;
|
|
20711
|
-
},
|
|
20712
|
-
create(base) {
|
|
20713
|
-
return UpdateNodesStatusRequest.fromPartial(base ?? {});
|
|
20714
|
-
},
|
|
20715
|
-
fromPartial(object) {
|
|
20716
|
-
const message = createBaseUpdateNodesStatusRequest();
|
|
20717
|
-
message.nodeIds = object.nodeIds?.map((e) => e) || [];
|
|
20718
|
-
message.status = object.status ?? "";
|
|
20719
|
-
return message;
|
|
20720
|
-
}
|
|
20721
|
-
};
|
|
20722
|
-
function createBaseTriggerTaskRequest() {
|
|
20723
|
-
return { taskName: "" };
|
|
20724
|
-
}
|
|
20725
|
-
var TriggerTaskRequest = {
|
|
20726
|
-
encode(message, writer = new import_wire5.BinaryWriter()) {
|
|
20727
|
-
if (message.taskName !== "") {
|
|
20728
|
-
writer.uint32(10).string(message.taskName);
|
|
20729
|
-
}
|
|
20730
|
-
return writer;
|
|
20731
|
-
},
|
|
20732
|
-
decode(input, length) {
|
|
20733
|
-
const reader = input instanceof import_wire5.BinaryReader ? input : new import_wire5.BinaryReader(input);
|
|
20734
|
-
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
20735
|
-
const message = createBaseTriggerTaskRequest();
|
|
20736
|
-
while (reader.pos < end) {
|
|
20737
|
-
const tag = reader.uint32();
|
|
20738
|
-
switch (tag >>> 3) {
|
|
20739
|
-
case 1: {
|
|
20740
|
-
if (tag !== 10) {
|
|
20741
|
-
break;
|
|
20742
|
-
}
|
|
20743
|
-
message.taskName = reader.string();
|
|
20744
|
-
continue;
|
|
20745
|
-
}
|
|
20746
|
-
}
|
|
20747
|
-
if ((tag & 7) === 4 || tag === 0) {
|
|
20748
|
-
break;
|
|
20749
|
-
}
|
|
20750
|
-
reader.skip(tag & 7);
|
|
20751
|
-
}
|
|
20752
|
-
return message;
|
|
20753
|
-
},
|
|
20754
|
-
fromJSON(object) {
|
|
20755
|
-
return { taskName: isSet4(object.taskName) ? globalThis.String(object.taskName) : "" };
|
|
20756
|
-
},
|
|
20757
|
-
toJSON(message) {
|
|
20758
|
-
const obj = {};
|
|
20759
|
-
if (message.taskName !== "") {
|
|
20760
|
-
obj.taskName = message.taskName;
|
|
20761
|
-
}
|
|
20762
|
-
return obj;
|
|
20763
|
-
},
|
|
20764
|
-
create(base) {
|
|
20765
|
-
return TriggerTaskRequest.fromPartial(base ?? {});
|
|
20766
|
-
},
|
|
20767
|
-
fromPartial(object) {
|
|
20768
|
-
const message = createBaseTriggerTaskRequest();
|
|
20769
|
-
message.taskName = object.taskName ?? "";
|
|
20770
|
-
return message;
|
|
20771
|
-
}
|
|
20772
|
-
};
|
|
20773
|
-
function createBaseInterruptCoopExitRequest() {
|
|
20774
|
-
return { action: 0, targetOperator: "" };
|
|
20775
|
-
}
|
|
20776
|
-
var InterruptCoopExitRequest = {
|
|
20777
|
-
encode(message, writer = new import_wire5.BinaryWriter()) {
|
|
20778
|
-
if (message.action !== 0) {
|
|
20779
|
-
writer.uint32(8).int32(message.action);
|
|
20780
|
-
}
|
|
20781
|
-
if (message.targetOperator !== "") {
|
|
20782
|
-
writer.uint32(18).string(message.targetOperator);
|
|
20783
|
-
}
|
|
20784
|
-
return writer;
|
|
20785
|
-
},
|
|
20786
|
-
decode(input, length) {
|
|
20787
|
-
const reader = input instanceof import_wire5.BinaryReader ? input : new import_wire5.BinaryReader(input);
|
|
20788
|
-
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
20789
|
-
const message = createBaseInterruptCoopExitRequest();
|
|
20790
|
-
while (reader.pos < end) {
|
|
20791
|
-
const tag = reader.uint32();
|
|
20792
|
-
switch (tag >>> 3) {
|
|
20793
|
-
case 1: {
|
|
20794
|
-
if (tag !== 8) {
|
|
20795
|
-
break;
|
|
20796
|
-
}
|
|
20797
|
-
message.action = reader.int32();
|
|
20798
|
-
continue;
|
|
20799
|
-
}
|
|
20800
|
-
case 2: {
|
|
20801
|
-
if (tag !== 18) {
|
|
20802
|
-
break;
|
|
20803
|
-
}
|
|
20804
|
-
message.targetOperator = reader.string();
|
|
20805
|
-
continue;
|
|
20806
|
-
}
|
|
20807
|
-
}
|
|
20808
|
-
if ((tag & 7) === 4 || tag === 0) {
|
|
20809
|
-
break;
|
|
20810
|
-
}
|
|
20811
|
-
reader.skip(tag & 7);
|
|
20812
|
-
}
|
|
20813
|
-
return message;
|
|
20814
|
-
},
|
|
20815
|
-
fromJSON(object) {
|
|
20816
|
-
return {
|
|
20817
|
-
action: isSet4(object.action) ? interruptCoopExitRequest_InterruptCoopExitActionFromJSON(object.action) : 0,
|
|
20818
|
-
targetOperator: isSet4(object.targetOperator) ? globalThis.String(object.targetOperator) : ""
|
|
20819
|
-
};
|
|
20820
|
-
},
|
|
20821
|
-
toJSON(message) {
|
|
20822
|
-
const obj = {};
|
|
20823
|
-
if (message.action !== 0) {
|
|
20824
|
-
obj.action = interruptCoopExitRequest_InterruptCoopExitActionToJSON(message.action);
|
|
20825
|
-
}
|
|
20826
|
-
if (message.targetOperator !== "") {
|
|
20827
|
-
obj.targetOperator = message.targetOperator;
|
|
20828
|
-
}
|
|
20829
|
-
return obj;
|
|
20830
|
-
},
|
|
20831
|
-
create(base) {
|
|
20832
|
-
return InterruptCoopExitRequest.fromPartial(base ?? {});
|
|
20833
|
-
},
|
|
20834
|
-
fromPartial(object) {
|
|
20835
|
-
const message = createBaseInterruptCoopExitRequest();
|
|
20836
|
-
message.action = object.action ?? 0;
|
|
20837
|
-
message.targetOperator = object.targetOperator ?? "";
|
|
20838
|
-
return message;
|
|
20839
|
-
}
|
|
20840
|
-
};
|
|
20841
|
-
var MockServiceDefinition = {
|
|
20842
|
-
name: "MockService",
|
|
20843
|
-
fullName: "mock.MockService",
|
|
20844
|
-
methods: {
|
|
20845
|
-
clean_up_preimage_share: {
|
|
20846
|
-
name: "clean_up_preimage_share",
|
|
20847
|
-
requestType: CleanUpPreimageShareRequest,
|
|
20848
|
-
requestStream: false,
|
|
20849
|
-
responseType: Empty,
|
|
20850
|
-
responseStream: false,
|
|
20851
|
-
options: {}
|
|
20852
|
-
},
|
|
20853
|
-
interrupt_transfer: {
|
|
20854
|
-
name: "interrupt_transfer",
|
|
20855
|
-
requestType: InterruptTransferRequest,
|
|
20856
|
-
requestStream: false,
|
|
20857
|
-
responseType: Empty,
|
|
20858
|
-
responseStream: false,
|
|
20859
|
-
options: {}
|
|
20860
|
-
},
|
|
20861
|
-
interrupt_coop_exit: {
|
|
20862
|
-
name: "interrupt_coop_exit",
|
|
20863
|
-
requestType: InterruptCoopExitRequest,
|
|
20864
|
-
requestStream: false,
|
|
20865
|
-
responseType: Empty,
|
|
20866
|
-
responseStream: false,
|
|
20867
|
-
options: {}
|
|
20868
|
-
},
|
|
20869
|
-
update_nodes_status: {
|
|
20870
|
-
name: "update_nodes_status",
|
|
20871
|
-
requestType: UpdateNodesStatusRequest,
|
|
20872
|
-
requestStream: false,
|
|
20873
|
-
responseType: Empty,
|
|
20874
|
-
responseStream: false,
|
|
20875
|
-
options: {}
|
|
20876
|
-
},
|
|
20877
|
-
/** Triggers the execution of a scheduled task immediately by name. Used by hermetic tests */
|
|
20878
|
-
trigger_task: {
|
|
20879
|
-
name: "trigger_task",
|
|
20880
|
-
requestType: TriggerTaskRequest,
|
|
20881
|
-
requestStream: false,
|
|
20882
|
-
responseType: Empty,
|
|
20883
|
-
responseStream: false,
|
|
20884
|
-
options: {}
|
|
20885
|
-
}
|
|
20886
|
-
}
|
|
20887
|
-
};
|
|
20888
|
-
function bytesFromBase643(b64) {
|
|
20889
|
-
if (globalThis.Buffer) {
|
|
20890
|
-
return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));
|
|
20891
|
-
} else {
|
|
20892
|
-
const bin = globalThis.atob(b64);
|
|
20893
|
-
const arr = new Uint8Array(bin.length);
|
|
20894
|
-
for (let i = 0; i < bin.length; ++i) {
|
|
20895
|
-
arr[i] = bin.charCodeAt(i);
|
|
20896
|
-
}
|
|
20897
|
-
return arr;
|
|
20898
|
-
}
|
|
20899
|
-
}
|
|
20900
|
-
function base64FromBytes3(arr) {
|
|
20901
|
-
if (globalThis.Buffer) {
|
|
20902
|
-
return globalThis.Buffer.from(arr).toString("base64");
|
|
20903
|
-
} else {
|
|
20904
|
-
const bin = [];
|
|
20905
|
-
arr.forEach((byte) => {
|
|
20906
|
-
bin.push(globalThis.String.fromCharCode(byte));
|
|
20907
|
-
});
|
|
20908
|
-
return globalThis.btoa(bin.join(""));
|
|
20909
|
-
}
|
|
20910
|
-
}
|
|
20911
|
-
function isSet4(value) {
|
|
20912
|
-
return value !== null && value !== void 0;
|
|
20913
|
-
}
|
|
20914
20312
|
|
|
20915
20313
|
// src/proto/spark_authn.ts
|
|
20916
20314
|
init_buffer();
|
|
20917
|
-
var
|
|
20315
|
+
var import_wire5 = require("@bufbuild/protobuf/wire");
|
|
20918
20316
|
function createBaseChallenge() {
|
|
20919
20317
|
return { version: 0, timestamp: 0, nonce: new Uint8Array(0), publicKey: new Uint8Array(0) };
|
|
20920
20318
|
}
|
|
20921
20319
|
var Challenge = {
|
|
20922
|
-
encode(message, writer = new
|
|
20320
|
+
encode(message, writer = new import_wire5.BinaryWriter()) {
|
|
20923
20321
|
if (message.version !== 0) {
|
|
20924
20322
|
writer.uint32(8).int32(message.version);
|
|
20925
20323
|
}
|
|
@@ -20935,7 +20333,7 @@ var Challenge = {
|
|
|
20935
20333
|
return writer;
|
|
20936
20334
|
},
|
|
20937
20335
|
decode(input, length) {
|
|
20938
|
-
const reader = input instanceof
|
|
20336
|
+
const reader = input instanceof import_wire5.BinaryReader ? input : new import_wire5.BinaryReader(input);
|
|
20939
20337
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
20940
20338
|
const message = createBaseChallenge();
|
|
20941
20339
|
while (reader.pos < end) {
|
|
@@ -20979,10 +20377,10 @@ var Challenge = {
|
|
|
20979
20377
|
},
|
|
20980
20378
|
fromJSON(object) {
|
|
20981
20379
|
return {
|
|
20982
|
-
version:
|
|
20983
|
-
timestamp:
|
|
20984
|
-
nonce:
|
|
20985
|
-
publicKey:
|
|
20380
|
+
version: isSet4(object.version) ? globalThis.Number(object.version) : 0,
|
|
20381
|
+
timestamp: isSet4(object.timestamp) ? globalThis.Number(object.timestamp) : 0,
|
|
20382
|
+
nonce: isSet4(object.nonce) ? bytesFromBase643(object.nonce) : new Uint8Array(0),
|
|
20383
|
+
publicKey: isSet4(object.publicKey) ? bytesFromBase643(object.publicKey) : new Uint8Array(0)
|
|
20986
20384
|
};
|
|
20987
20385
|
},
|
|
20988
20386
|
toJSON(message) {
|
|
@@ -20994,10 +20392,10 @@ var Challenge = {
|
|
|
20994
20392
|
obj.timestamp = Math.round(message.timestamp);
|
|
20995
20393
|
}
|
|
20996
20394
|
if (message.nonce.length !== 0) {
|
|
20997
|
-
obj.nonce =
|
|
20395
|
+
obj.nonce = base64FromBytes3(message.nonce);
|
|
20998
20396
|
}
|
|
20999
20397
|
if (message.publicKey.length !== 0) {
|
|
21000
|
-
obj.publicKey =
|
|
20398
|
+
obj.publicKey = base64FromBytes3(message.publicKey);
|
|
21001
20399
|
}
|
|
21002
20400
|
return obj;
|
|
21003
20401
|
},
|
|
@@ -21017,7 +20415,7 @@ function createBaseProtectedChallenge() {
|
|
|
21017
20415
|
return { version: 0, challenge: void 0, serverHmac: new Uint8Array(0) };
|
|
21018
20416
|
}
|
|
21019
20417
|
var ProtectedChallenge = {
|
|
21020
|
-
encode(message, writer = new
|
|
20418
|
+
encode(message, writer = new import_wire5.BinaryWriter()) {
|
|
21021
20419
|
if (message.version !== 0) {
|
|
21022
20420
|
writer.uint32(8).int32(message.version);
|
|
21023
20421
|
}
|
|
@@ -21030,7 +20428,7 @@ var ProtectedChallenge = {
|
|
|
21030
20428
|
return writer;
|
|
21031
20429
|
},
|
|
21032
20430
|
decode(input, length) {
|
|
21033
|
-
const reader = input instanceof
|
|
20431
|
+
const reader = input instanceof import_wire5.BinaryReader ? input : new import_wire5.BinaryReader(input);
|
|
21034
20432
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
21035
20433
|
const message = createBaseProtectedChallenge();
|
|
21036
20434
|
while (reader.pos < end) {
|
|
@@ -21067,9 +20465,9 @@ var ProtectedChallenge = {
|
|
|
21067
20465
|
},
|
|
21068
20466
|
fromJSON(object) {
|
|
21069
20467
|
return {
|
|
21070
|
-
version:
|
|
21071
|
-
challenge:
|
|
21072
|
-
serverHmac:
|
|
20468
|
+
version: isSet4(object.version) ? globalThis.Number(object.version) : 0,
|
|
20469
|
+
challenge: isSet4(object.challenge) ? Challenge.fromJSON(object.challenge) : void 0,
|
|
20470
|
+
serverHmac: isSet4(object.serverHmac) ? bytesFromBase643(object.serverHmac) : new Uint8Array(0)
|
|
21073
20471
|
};
|
|
21074
20472
|
},
|
|
21075
20473
|
toJSON(message) {
|
|
@@ -21081,7 +20479,7 @@ var ProtectedChallenge = {
|
|
|
21081
20479
|
obj.challenge = Challenge.toJSON(message.challenge);
|
|
21082
20480
|
}
|
|
21083
20481
|
if (message.serverHmac.length !== 0) {
|
|
21084
|
-
obj.serverHmac =
|
|
20482
|
+
obj.serverHmac = base64FromBytes3(message.serverHmac);
|
|
21085
20483
|
}
|
|
21086
20484
|
return obj;
|
|
21087
20485
|
},
|
|
@@ -21100,14 +20498,14 @@ function createBaseGetChallengeRequest() {
|
|
|
21100
20498
|
return { publicKey: new Uint8Array(0) };
|
|
21101
20499
|
}
|
|
21102
20500
|
var GetChallengeRequest = {
|
|
21103
|
-
encode(message, writer = new
|
|
20501
|
+
encode(message, writer = new import_wire5.BinaryWriter()) {
|
|
21104
20502
|
if (message.publicKey.length !== 0) {
|
|
21105
20503
|
writer.uint32(10).bytes(message.publicKey);
|
|
21106
20504
|
}
|
|
21107
20505
|
return writer;
|
|
21108
20506
|
},
|
|
21109
20507
|
decode(input, length) {
|
|
21110
|
-
const reader = input instanceof
|
|
20508
|
+
const reader = input instanceof import_wire5.BinaryReader ? input : new import_wire5.BinaryReader(input);
|
|
21111
20509
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
21112
20510
|
const message = createBaseGetChallengeRequest();
|
|
21113
20511
|
while (reader.pos < end) {
|
|
@@ -21129,12 +20527,12 @@ var GetChallengeRequest = {
|
|
|
21129
20527
|
return message;
|
|
21130
20528
|
},
|
|
21131
20529
|
fromJSON(object) {
|
|
21132
|
-
return { publicKey:
|
|
20530
|
+
return { publicKey: isSet4(object.publicKey) ? bytesFromBase643(object.publicKey) : new Uint8Array(0) };
|
|
21133
20531
|
},
|
|
21134
20532
|
toJSON(message) {
|
|
21135
20533
|
const obj = {};
|
|
21136
20534
|
if (message.publicKey.length !== 0) {
|
|
21137
|
-
obj.publicKey =
|
|
20535
|
+
obj.publicKey = base64FromBytes3(message.publicKey);
|
|
21138
20536
|
}
|
|
21139
20537
|
return obj;
|
|
21140
20538
|
},
|
|
@@ -21151,14 +20549,14 @@ function createBaseGetChallengeResponse() {
|
|
|
21151
20549
|
return { protectedChallenge: void 0 };
|
|
21152
20550
|
}
|
|
21153
20551
|
var GetChallengeResponse = {
|
|
21154
|
-
encode(message, writer = new
|
|
20552
|
+
encode(message, writer = new import_wire5.BinaryWriter()) {
|
|
21155
20553
|
if (message.protectedChallenge !== void 0) {
|
|
21156
20554
|
ProtectedChallenge.encode(message.protectedChallenge, writer.uint32(10).fork()).join();
|
|
21157
20555
|
}
|
|
21158
20556
|
return writer;
|
|
21159
20557
|
},
|
|
21160
20558
|
decode(input, length) {
|
|
21161
|
-
const reader = input instanceof
|
|
20559
|
+
const reader = input instanceof import_wire5.BinaryReader ? input : new import_wire5.BinaryReader(input);
|
|
21162
20560
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
21163
20561
|
const message = createBaseGetChallengeResponse();
|
|
21164
20562
|
while (reader.pos < end) {
|
|
@@ -21181,7 +20579,7 @@ var GetChallengeResponse = {
|
|
|
21181
20579
|
},
|
|
21182
20580
|
fromJSON(object) {
|
|
21183
20581
|
return {
|
|
21184
|
-
protectedChallenge:
|
|
20582
|
+
protectedChallenge: isSet4(object.protectedChallenge) ? ProtectedChallenge.fromJSON(object.protectedChallenge) : void 0
|
|
21185
20583
|
};
|
|
21186
20584
|
},
|
|
21187
20585
|
toJSON(message) {
|
|
@@ -21204,7 +20602,7 @@ function createBaseVerifyChallengeRequest() {
|
|
|
21204
20602
|
return { protectedChallenge: void 0, signature: new Uint8Array(0), publicKey: new Uint8Array(0) };
|
|
21205
20603
|
}
|
|
21206
20604
|
var VerifyChallengeRequest = {
|
|
21207
|
-
encode(message, writer = new
|
|
20605
|
+
encode(message, writer = new import_wire5.BinaryWriter()) {
|
|
21208
20606
|
if (message.protectedChallenge !== void 0) {
|
|
21209
20607
|
ProtectedChallenge.encode(message.protectedChallenge, writer.uint32(10).fork()).join();
|
|
21210
20608
|
}
|
|
@@ -21217,7 +20615,7 @@ var VerifyChallengeRequest = {
|
|
|
21217
20615
|
return writer;
|
|
21218
20616
|
},
|
|
21219
20617
|
decode(input, length) {
|
|
21220
|
-
const reader = input instanceof
|
|
20618
|
+
const reader = input instanceof import_wire5.BinaryReader ? input : new import_wire5.BinaryReader(input);
|
|
21221
20619
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
21222
20620
|
const message = createBaseVerifyChallengeRequest();
|
|
21223
20621
|
while (reader.pos < end) {
|
|
@@ -21254,9 +20652,9 @@ var VerifyChallengeRequest = {
|
|
|
21254
20652
|
},
|
|
21255
20653
|
fromJSON(object) {
|
|
21256
20654
|
return {
|
|
21257
|
-
protectedChallenge:
|
|
21258
|
-
signature:
|
|
21259
|
-
publicKey:
|
|
20655
|
+
protectedChallenge: isSet4(object.protectedChallenge) ? ProtectedChallenge.fromJSON(object.protectedChallenge) : void 0,
|
|
20656
|
+
signature: isSet4(object.signature) ? bytesFromBase643(object.signature) : new Uint8Array(0),
|
|
20657
|
+
publicKey: isSet4(object.publicKey) ? bytesFromBase643(object.publicKey) : new Uint8Array(0)
|
|
21260
20658
|
};
|
|
21261
20659
|
},
|
|
21262
20660
|
toJSON(message) {
|
|
@@ -21265,10 +20663,10 @@ var VerifyChallengeRequest = {
|
|
|
21265
20663
|
obj.protectedChallenge = ProtectedChallenge.toJSON(message.protectedChallenge);
|
|
21266
20664
|
}
|
|
21267
20665
|
if (message.signature.length !== 0) {
|
|
21268
|
-
obj.signature =
|
|
20666
|
+
obj.signature = base64FromBytes3(message.signature);
|
|
21269
20667
|
}
|
|
21270
20668
|
if (message.publicKey.length !== 0) {
|
|
21271
|
-
obj.publicKey =
|
|
20669
|
+
obj.publicKey = base64FromBytes3(message.publicKey);
|
|
21272
20670
|
}
|
|
21273
20671
|
return obj;
|
|
21274
20672
|
},
|
|
@@ -21287,7 +20685,7 @@ function createBaseVerifyChallengeResponse() {
|
|
|
21287
20685
|
return { sessionToken: "", expirationTimestamp: 0 };
|
|
21288
20686
|
}
|
|
21289
20687
|
var VerifyChallengeResponse = {
|
|
21290
|
-
encode(message, writer = new
|
|
20688
|
+
encode(message, writer = new import_wire5.BinaryWriter()) {
|
|
21291
20689
|
if (message.sessionToken !== "") {
|
|
21292
20690
|
writer.uint32(10).string(message.sessionToken);
|
|
21293
20691
|
}
|
|
@@ -21297,7 +20695,7 @@ var VerifyChallengeResponse = {
|
|
|
21297
20695
|
return writer;
|
|
21298
20696
|
},
|
|
21299
20697
|
decode(input, length) {
|
|
21300
|
-
const reader = input instanceof
|
|
20698
|
+
const reader = input instanceof import_wire5.BinaryReader ? input : new import_wire5.BinaryReader(input);
|
|
21301
20699
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
21302
20700
|
const message = createBaseVerifyChallengeResponse();
|
|
21303
20701
|
while (reader.pos < end) {
|
|
@@ -21327,8 +20725,8 @@ var VerifyChallengeResponse = {
|
|
|
21327
20725
|
},
|
|
21328
20726
|
fromJSON(object) {
|
|
21329
20727
|
return {
|
|
21330
|
-
sessionToken:
|
|
21331
|
-
expirationTimestamp:
|
|
20728
|
+
sessionToken: isSet4(object.sessionToken) ? globalThis.String(object.sessionToken) : "",
|
|
20729
|
+
expirationTimestamp: isSet4(object.expirationTimestamp) ? globalThis.Number(object.expirationTimestamp) : 0
|
|
21332
20730
|
};
|
|
21333
20731
|
},
|
|
21334
20732
|
toJSON(message) {
|
|
@@ -21375,7 +20773,7 @@ var SparkAuthnServiceDefinition = {
|
|
|
21375
20773
|
}
|
|
21376
20774
|
}
|
|
21377
20775
|
};
|
|
21378
|
-
function
|
|
20776
|
+
function bytesFromBase643(b64) {
|
|
21379
20777
|
if (globalThis.Buffer) {
|
|
21380
20778
|
return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));
|
|
21381
20779
|
} else {
|
|
@@ -21387,7 +20785,7 @@ function bytesFromBase644(b64) {
|
|
|
21387
20785
|
return arr;
|
|
21388
20786
|
}
|
|
21389
20787
|
}
|
|
21390
|
-
function
|
|
20788
|
+
function base64FromBytes3(arr) {
|
|
21391
20789
|
if (globalThis.Buffer) {
|
|
21392
20790
|
return globalThis.Buffer.from(arr).toString("base64");
|
|
21393
20791
|
} else {
|
|
@@ -21408,13 +20806,13 @@ function longToNumber3(int64) {
|
|
|
21408
20806
|
}
|
|
21409
20807
|
return num;
|
|
21410
20808
|
}
|
|
21411
|
-
function
|
|
20809
|
+
function isSet4(value) {
|
|
21412
20810
|
return value !== null && value !== void 0;
|
|
21413
20811
|
}
|
|
21414
20812
|
|
|
21415
20813
|
// src/proto/spark_token.ts
|
|
21416
20814
|
init_buffer();
|
|
21417
|
-
var
|
|
20815
|
+
var import_wire6 = require("@bufbuild/protobuf/wire");
|
|
21418
20816
|
function commitStatusFromJSON(object) {
|
|
21419
20817
|
switch (object) {
|
|
21420
20818
|
case 0:
|
|
@@ -21499,7 +20897,7 @@ function createBaseTokenOutputToSpend2() {
|
|
|
21499
20897
|
return { prevTokenTransactionHash: new Uint8Array(0), prevTokenTransactionVout: 0 };
|
|
21500
20898
|
}
|
|
21501
20899
|
var TokenOutputToSpend2 = {
|
|
21502
|
-
encode(message, writer = new
|
|
20900
|
+
encode(message, writer = new import_wire6.BinaryWriter()) {
|
|
21503
20901
|
if (message.prevTokenTransactionHash.length !== 0) {
|
|
21504
20902
|
writer.uint32(10).bytes(message.prevTokenTransactionHash);
|
|
21505
20903
|
}
|
|
@@ -21509,7 +20907,7 @@ var TokenOutputToSpend2 = {
|
|
|
21509
20907
|
return writer;
|
|
21510
20908
|
},
|
|
21511
20909
|
decode(input, length) {
|
|
21512
|
-
const reader = input instanceof
|
|
20910
|
+
const reader = input instanceof import_wire6.BinaryReader ? input : new import_wire6.BinaryReader(input);
|
|
21513
20911
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
21514
20912
|
const message = createBaseTokenOutputToSpend2();
|
|
21515
20913
|
while (reader.pos < end) {
|
|
@@ -21539,14 +20937,14 @@ var TokenOutputToSpend2 = {
|
|
|
21539
20937
|
},
|
|
21540
20938
|
fromJSON(object) {
|
|
21541
20939
|
return {
|
|
21542
|
-
prevTokenTransactionHash:
|
|
21543
|
-
prevTokenTransactionVout:
|
|
20940
|
+
prevTokenTransactionHash: isSet5(object.prevTokenTransactionHash) ? bytesFromBase644(object.prevTokenTransactionHash) : new Uint8Array(0),
|
|
20941
|
+
prevTokenTransactionVout: isSet5(object.prevTokenTransactionVout) ? globalThis.Number(object.prevTokenTransactionVout) : 0
|
|
21544
20942
|
};
|
|
21545
20943
|
},
|
|
21546
20944
|
toJSON(message) {
|
|
21547
20945
|
const obj = {};
|
|
21548
20946
|
if (message.prevTokenTransactionHash.length !== 0) {
|
|
21549
|
-
obj.prevTokenTransactionHash =
|
|
20947
|
+
obj.prevTokenTransactionHash = base64FromBytes4(message.prevTokenTransactionHash);
|
|
21550
20948
|
}
|
|
21551
20949
|
if (message.prevTokenTransactionVout !== 0) {
|
|
21552
20950
|
obj.prevTokenTransactionVout = Math.round(message.prevTokenTransactionVout);
|
|
@@ -21567,14 +20965,14 @@ function createBaseTokenTransferInput2() {
|
|
|
21567
20965
|
return { outputsToSpend: [] };
|
|
21568
20966
|
}
|
|
21569
20967
|
var TokenTransferInput2 = {
|
|
21570
|
-
encode(message, writer = new
|
|
20968
|
+
encode(message, writer = new import_wire6.BinaryWriter()) {
|
|
21571
20969
|
for (const v of message.outputsToSpend) {
|
|
21572
20970
|
TokenOutputToSpend2.encode(v, writer.uint32(10).fork()).join();
|
|
21573
20971
|
}
|
|
21574
20972
|
return writer;
|
|
21575
20973
|
},
|
|
21576
20974
|
decode(input, length) {
|
|
21577
|
-
const reader = input instanceof
|
|
20975
|
+
const reader = input instanceof import_wire6.BinaryReader ? input : new import_wire6.BinaryReader(input);
|
|
21578
20976
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
21579
20977
|
const message = createBaseTokenTransferInput2();
|
|
21580
20978
|
while (reader.pos < end) {
|
|
@@ -21620,7 +21018,7 @@ function createBaseTokenMintInput2() {
|
|
|
21620
21018
|
return { issuerPublicKey: new Uint8Array(0), tokenIdentifier: void 0 };
|
|
21621
21019
|
}
|
|
21622
21020
|
var TokenMintInput2 = {
|
|
21623
|
-
encode(message, writer = new
|
|
21021
|
+
encode(message, writer = new import_wire6.BinaryWriter()) {
|
|
21624
21022
|
if (message.issuerPublicKey.length !== 0) {
|
|
21625
21023
|
writer.uint32(10).bytes(message.issuerPublicKey);
|
|
21626
21024
|
}
|
|
@@ -21630,7 +21028,7 @@ var TokenMintInput2 = {
|
|
|
21630
21028
|
return writer;
|
|
21631
21029
|
},
|
|
21632
21030
|
decode(input, length) {
|
|
21633
|
-
const reader = input instanceof
|
|
21031
|
+
const reader = input instanceof import_wire6.BinaryReader ? input : new import_wire6.BinaryReader(input);
|
|
21634
21032
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
21635
21033
|
const message = createBaseTokenMintInput2();
|
|
21636
21034
|
while (reader.pos < end) {
|
|
@@ -21660,17 +21058,17 @@ var TokenMintInput2 = {
|
|
|
21660
21058
|
},
|
|
21661
21059
|
fromJSON(object) {
|
|
21662
21060
|
return {
|
|
21663
|
-
issuerPublicKey:
|
|
21664
|
-
tokenIdentifier:
|
|
21061
|
+
issuerPublicKey: isSet5(object.issuerPublicKey) ? bytesFromBase644(object.issuerPublicKey) : new Uint8Array(0),
|
|
21062
|
+
tokenIdentifier: isSet5(object.tokenIdentifier) ? bytesFromBase644(object.tokenIdentifier) : void 0
|
|
21665
21063
|
};
|
|
21666
21064
|
},
|
|
21667
21065
|
toJSON(message) {
|
|
21668
21066
|
const obj = {};
|
|
21669
21067
|
if (message.issuerPublicKey.length !== 0) {
|
|
21670
|
-
obj.issuerPublicKey =
|
|
21068
|
+
obj.issuerPublicKey = base64FromBytes4(message.issuerPublicKey);
|
|
21671
21069
|
}
|
|
21672
21070
|
if (message.tokenIdentifier !== void 0) {
|
|
21673
|
-
obj.tokenIdentifier =
|
|
21071
|
+
obj.tokenIdentifier = base64FromBytes4(message.tokenIdentifier);
|
|
21674
21072
|
}
|
|
21675
21073
|
return obj;
|
|
21676
21074
|
},
|
|
@@ -21696,7 +21094,7 @@ function createBaseTokenCreateInput2() {
|
|
|
21696
21094
|
};
|
|
21697
21095
|
}
|
|
21698
21096
|
var TokenCreateInput2 = {
|
|
21699
|
-
encode(message, writer = new
|
|
21097
|
+
encode(message, writer = new import_wire6.BinaryWriter()) {
|
|
21700
21098
|
if (message.issuerPublicKey.length !== 0) {
|
|
21701
21099
|
writer.uint32(10).bytes(message.issuerPublicKey);
|
|
21702
21100
|
}
|
|
@@ -21721,7 +21119,7 @@ var TokenCreateInput2 = {
|
|
|
21721
21119
|
return writer;
|
|
21722
21120
|
},
|
|
21723
21121
|
decode(input, length) {
|
|
21724
|
-
const reader = input instanceof
|
|
21122
|
+
const reader = input instanceof import_wire6.BinaryReader ? input : new import_wire6.BinaryReader(input);
|
|
21725
21123
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
21726
21124
|
const message = createBaseTokenCreateInput2();
|
|
21727
21125
|
while (reader.pos < end) {
|
|
@@ -21786,19 +21184,19 @@ var TokenCreateInput2 = {
|
|
|
21786
21184
|
},
|
|
21787
21185
|
fromJSON(object) {
|
|
21788
21186
|
return {
|
|
21789
|
-
issuerPublicKey:
|
|
21790
|
-
tokenName:
|
|
21791
|
-
tokenTicker:
|
|
21792
|
-
decimals:
|
|
21793
|
-
maxSupply:
|
|
21794
|
-
isFreezable:
|
|
21795
|
-
creationEntityPublicKey:
|
|
21187
|
+
issuerPublicKey: isSet5(object.issuerPublicKey) ? bytesFromBase644(object.issuerPublicKey) : new Uint8Array(0),
|
|
21188
|
+
tokenName: isSet5(object.tokenName) ? globalThis.String(object.tokenName) : "",
|
|
21189
|
+
tokenTicker: isSet5(object.tokenTicker) ? globalThis.String(object.tokenTicker) : "",
|
|
21190
|
+
decimals: isSet5(object.decimals) ? globalThis.Number(object.decimals) : 0,
|
|
21191
|
+
maxSupply: isSet5(object.maxSupply) ? bytesFromBase644(object.maxSupply) : new Uint8Array(0),
|
|
21192
|
+
isFreezable: isSet5(object.isFreezable) ? globalThis.Boolean(object.isFreezable) : false,
|
|
21193
|
+
creationEntityPublicKey: isSet5(object.creationEntityPublicKey) ? bytesFromBase644(object.creationEntityPublicKey) : void 0
|
|
21796
21194
|
};
|
|
21797
21195
|
},
|
|
21798
21196
|
toJSON(message) {
|
|
21799
21197
|
const obj = {};
|
|
21800
21198
|
if (message.issuerPublicKey.length !== 0) {
|
|
21801
|
-
obj.issuerPublicKey =
|
|
21199
|
+
obj.issuerPublicKey = base64FromBytes4(message.issuerPublicKey);
|
|
21802
21200
|
}
|
|
21803
21201
|
if (message.tokenName !== "") {
|
|
21804
21202
|
obj.tokenName = message.tokenName;
|
|
@@ -21810,13 +21208,13 @@ var TokenCreateInput2 = {
|
|
|
21810
21208
|
obj.decimals = Math.round(message.decimals);
|
|
21811
21209
|
}
|
|
21812
21210
|
if (message.maxSupply.length !== 0) {
|
|
21813
|
-
obj.maxSupply =
|
|
21211
|
+
obj.maxSupply = base64FromBytes4(message.maxSupply);
|
|
21814
21212
|
}
|
|
21815
21213
|
if (message.isFreezable !== false) {
|
|
21816
21214
|
obj.isFreezable = message.isFreezable;
|
|
21817
21215
|
}
|
|
21818
21216
|
if (message.creationEntityPublicKey !== void 0) {
|
|
21819
|
-
obj.creationEntityPublicKey =
|
|
21217
|
+
obj.creationEntityPublicKey = base64FromBytes4(message.creationEntityPublicKey);
|
|
21820
21218
|
}
|
|
21821
21219
|
return obj;
|
|
21822
21220
|
},
|
|
@@ -21848,7 +21246,7 @@ function createBaseTokenOutput2() {
|
|
|
21848
21246
|
};
|
|
21849
21247
|
}
|
|
21850
21248
|
var TokenOutput2 = {
|
|
21851
|
-
encode(message, writer = new
|
|
21249
|
+
encode(message, writer = new import_wire6.BinaryWriter()) {
|
|
21852
21250
|
if (message.id !== void 0) {
|
|
21853
21251
|
writer.uint32(10).string(message.id);
|
|
21854
21252
|
}
|
|
@@ -21876,7 +21274,7 @@ var TokenOutput2 = {
|
|
|
21876
21274
|
return writer;
|
|
21877
21275
|
},
|
|
21878
21276
|
decode(input, length) {
|
|
21879
|
-
const reader = input instanceof
|
|
21277
|
+
const reader = input instanceof import_wire6.BinaryReader ? input : new import_wire6.BinaryReader(input);
|
|
21880
21278
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
21881
21279
|
const message = createBaseTokenOutput2();
|
|
21882
21280
|
while (reader.pos < end) {
|
|
@@ -21948,14 +21346,14 @@ var TokenOutput2 = {
|
|
|
21948
21346
|
},
|
|
21949
21347
|
fromJSON(object) {
|
|
21950
21348
|
return {
|
|
21951
|
-
id:
|
|
21952
|
-
ownerPublicKey:
|
|
21953
|
-
revocationCommitment:
|
|
21954
|
-
withdrawBondSats:
|
|
21955
|
-
withdrawRelativeBlockLocktime:
|
|
21956
|
-
tokenPublicKey:
|
|
21957
|
-
tokenIdentifier:
|
|
21958
|
-
tokenAmount:
|
|
21349
|
+
id: isSet5(object.id) ? globalThis.String(object.id) : void 0,
|
|
21350
|
+
ownerPublicKey: isSet5(object.ownerPublicKey) ? bytesFromBase644(object.ownerPublicKey) : new Uint8Array(0),
|
|
21351
|
+
revocationCommitment: isSet5(object.revocationCommitment) ? bytesFromBase644(object.revocationCommitment) : void 0,
|
|
21352
|
+
withdrawBondSats: isSet5(object.withdrawBondSats) ? globalThis.Number(object.withdrawBondSats) : void 0,
|
|
21353
|
+
withdrawRelativeBlockLocktime: isSet5(object.withdrawRelativeBlockLocktime) ? globalThis.Number(object.withdrawRelativeBlockLocktime) : void 0,
|
|
21354
|
+
tokenPublicKey: isSet5(object.tokenPublicKey) ? bytesFromBase644(object.tokenPublicKey) : void 0,
|
|
21355
|
+
tokenIdentifier: isSet5(object.tokenIdentifier) ? bytesFromBase644(object.tokenIdentifier) : void 0,
|
|
21356
|
+
tokenAmount: isSet5(object.tokenAmount) ? bytesFromBase644(object.tokenAmount) : new Uint8Array(0)
|
|
21959
21357
|
};
|
|
21960
21358
|
},
|
|
21961
21359
|
toJSON(message) {
|
|
@@ -21964,10 +21362,10 @@ var TokenOutput2 = {
|
|
|
21964
21362
|
obj.id = message.id;
|
|
21965
21363
|
}
|
|
21966
21364
|
if (message.ownerPublicKey.length !== 0) {
|
|
21967
|
-
obj.ownerPublicKey =
|
|
21365
|
+
obj.ownerPublicKey = base64FromBytes4(message.ownerPublicKey);
|
|
21968
21366
|
}
|
|
21969
21367
|
if (message.revocationCommitment !== void 0) {
|
|
21970
|
-
obj.revocationCommitment =
|
|
21368
|
+
obj.revocationCommitment = base64FromBytes4(message.revocationCommitment);
|
|
21971
21369
|
}
|
|
21972
21370
|
if (message.withdrawBondSats !== void 0) {
|
|
21973
21371
|
obj.withdrawBondSats = Math.round(message.withdrawBondSats);
|
|
@@ -21976,13 +21374,13 @@ var TokenOutput2 = {
|
|
|
21976
21374
|
obj.withdrawRelativeBlockLocktime = Math.round(message.withdrawRelativeBlockLocktime);
|
|
21977
21375
|
}
|
|
21978
21376
|
if (message.tokenPublicKey !== void 0) {
|
|
21979
|
-
obj.tokenPublicKey =
|
|
21377
|
+
obj.tokenPublicKey = base64FromBytes4(message.tokenPublicKey);
|
|
21980
21378
|
}
|
|
21981
21379
|
if (message.tokenIdentifier !== void 0) {
|
|
21982
|
-
obj.tokenIdentifier =
|
|
21380
|
+
obj.tokenIdentifier = base64FromBytes4(message.tokenIdentifier);
|
|
21983
21381
|
}
|
|
21984
21382
|
if (message.tokenAmount.length !== 0) {
|
|
21985
|
-
obj.tokenAmount =
|
|
21383
|
+
obj.tokenAmount = base64FromBytes4(message.tokenAmount);
|
|
21986
21384
|
}
|
|
21987
21385
|
return obj;
|
|
21988
21386
|
},
|
|
@@ -22015,7 +21413,7 @@ function createBaseTokenTransaction2() {
|
|
|
22015
21413
|
};
|
|
22016
21414
|
}
|
|
22017
21415
|
var TokenTransaction2 = {
|
|
22018
|
-
encode(message, writer = new
|
|
21416
|
+
encode(message, writer = new import_wire6.BinaryWriter()) {
|
|
22019
21417
|
if (message.version !== 0) {
|
|
22020
21418
|
writer.uint32(8).uint32(message.version);
|
|
22021
21419
|
}
|
|
@@ -22051,7 +21449,7 @@ var TokenTransaction2 = {
|
|
|
22051
21449
|
return writer;
|
|
22052
21450
|
},
|
|
22053
21451
|
decode(input, length) {
|
|
22054
|
-
const reader = input instanceof
|
|
21452
|
+
const reader = input instanceof import_wire6.BinaryReader ? input : new import_wire6.BinaryReader(input);
|
|
22055
21453
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
22056
21454
|
const message = createBaseTokenTransaction2();
|
|
22057
21455
|
while (reader.pos < end) {
|
|
@@ -22140,13 +21538,13 @@ var TokenTransaction2 = {
|
|
|
22140
21538
|
},
|
|
22141
21539
|
fromJSON(object) {
|
|
22142
21540
|
return {
|
|
22143
|
-
version:
|
|
22144
|
-
tokenInputs:
|
|
21541
|
+
version: isSet5(object.version) ? globalThis.Number(object.version) : 0,
|
|
21542
|
+
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,
|
|
22145
21543
|
tokenOutputs: globalThis.Array.isArray(object?.tokenOutputs) ? object.tokenOutputs.map((e) => TokenOutput2.fromJSON(e)) : [],
|
|
22146
|
-
sparkOperatorIdentityPublicKeys: globalThis.Array.isArray(object?.sparkOperatorIdentityPublicKeys) ? object.sparkOperatorIdentityPublicKeys.map((e) =>
|
|
22147
|
-
expiryTime:
|
|
22148
|
-
network:
|
|
22149
|
-
clientCreatedTimestamp:
|
|
21544
|
+
sparkOperatorIdentityPublicKeys: globalThis.Array.isArray(object?.sparkOperatorIdentityPublicKeys) ? object.sparkOperatorIdentityPublicKeys.map((e) => bytesFromBase644(e)) : [],
|
|
21545
|
+
expiryTime: isSet5(object.expiryTime) ? fromJsonTimestamp2(object.expiryTime) : void 0,
|
|
21546
|
+
network: isSet5(object.network) ? networkFromJSON(object.network) : 0,
|
|
21547
|
+
clientCreatedTimestamp: isSet5(object.clientCreatedTimestamp) ? fromJsonTimestamp2(object.clientCreatedTimestamp) : void 0,
|
|
22150
21548
|
invoiceAttachments: globalThis.Array.isArray(object?.invoiceAttachments) ? object.invoiceAttachments.map((e) => InvoiceAttachment.fromJSON(e)) : []
|
|
22151
21549
|
};
|
|
22152
21550
|
},
|
|
@@ -22166,7 +21564,7 @@ var TokenTransaction2 = {
|
|
|
22166
21564
|
obj.tokenOutputs = message.tokenOutputs.map((e) => TokenOutput2.toJSON(e));
|
|
22167
21565
|
}
|
|
22168
21566
|
if (message.sparkOperatorIdentityPublicKeys?.length) {
|
|
22169
|
-
obj.sparkOperatorIdentityPublicKeys = message.sparkOperatorIdentityPublicKeys.map((e) =>
|
|
21567
|
+
obj.sparkOperatorIdentityPublicKeys = message.sparkOperatorIdentityPublicKeys.map((e) => base64FromBytes4(e));
|
|
22170
21568
|
}
|
|
22171
21569
|
if (message.expiryTime !== void 0) {
|
|
22172
21570
|
obj.expiryTime = message.expiryTime.toISOString();
|
|
@@ -22230,14 +21628,14 @@ function createBaseInvoiceAttachment() {
|
|
|
22230
21628
|
return { sparkInvoice: "" };
|
|
22231
21629
|
}
|
|
22232
21630
|
var InvoiceAttachment = {
|
|
22233
|
-
encode(message, writer = new
|
|
21631
|
+
encode(message, writer = new import_wire6.BinaryWriter()) {
|
|
22234
21632
|
if (message.sparkInvoice !== "") {
|
|
22235
21633
|
writer.uint32(10).string(message.sparkInvoice);
|
|
22236
21634
|
}
|
|
22237
21635
|
return writer;
|
|
22238
21636
|
},
|
|
22239
21637
|
decode(input, length) {
|
|
22240
|
-
const reader = input instanceof
|
|
21638
|
+
const reader = input instanceof import_wire6.BinaryReader ? input : new import_wire6.BinaryReader(input);
|
|
22241
21639
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
22242
21640
|
const message = createBaseInvoiceAttachment();
|
|
22243
21641
|
while (reader.pos < end) {
|
|
@@ -22259,7 +21657,7 @@ var InvoiceAttachment = {
|
|
|
22259
21657
|
return message;
|
|
22260
21658
|
},
|
|
22261
21659
|
fromJSON(object) {
|
|
22262
|
-
return { sparkInvoice:
|
|
21660
|
+
return { sparkInvoice: isSet5(object.sparkInvoice) ? globalThis.String(object.sparkInvoice) : "" };
|
|
22263
21661
|
},
|
|
22264
21662
|
toJSON(message) {
|
|
22265
21663
|
const obj = {};
|
|
@@ -22281,7 +21679,7 @@ function createBaseSignatureWithIndex2() {
|
|
|
22281
21679
|
return { signature: new Uint8Array(0), inputIndex: 0 };
|
|
22282
21680
|
}
|
|
22283
21681
|
var SignatureWithIndex2 = {
|
|
22284
|
-
encode(message, writer = new
|
|
21682
|
+
encode(message, writer = new import_wire6.BinaryWriter()) {
|
|
22285
21683
|
if (message.signature.length !== 0) {
|
|
22286
21684
|
writer.uint32(10).bytes(message.signature);
|
|
22287
21685
|
}
|
|
@@ -22291,7 +21689,7 @@ var SignatureWithIndex2 = {
|
|
|
22291
21689
|
return writer;
|
|
22292
21690
|
},
|
|
22293
21691
|
decode(input, length) {
|
|
22294
|
-
const reader = input instanceof
|
|
21692
|
+
const reader = input instanceof import_wire6.BinaryReader ? input : new import_wire6.BinaryReader(input);
|
|
22295
21693
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
22296
21694
|
const message = createBaseSignatureWithIndex2();
|
|
22297
21695
|
while (reader.pos < end) {
|
|
@@ -22321,14 +21719,14 @@ var SignatureWithIndex2 = {
|
|
|
22321
21719
|
},
|
|
22322
21720
|
fromJSON(object) {
|
|
22323
21721
|
return {
|
|
22324
|
-
signature:
|
|
22325
|
-
inputIndex:
|
|
21722
|
+
signature: isSet5(object.signature) ? bytesFromBase644(object.signature) : new Uint8Array(0),
|
|
21723
|
+
inputIndex: isSet5(object.inputIndex) ? globalThis.Number(object.inputIndex) : 0
|
|
22326
21724
|
};
|
|
22327
21725
|
},
|
|
22328
21726
|
toJSON(message) {
|
|
22329
21727
|
const obj = {};
|
|
22330
21728
|
if (message.signature.length !== 0) {
|
|
22331
|
-
obj.signature =
|
|
21729
|
+
obj.signature = base64FromBytes4(message.signature);
|
|
22332
21730
|
}
|
|
22333
21731
|
if (message.inputIndex !== 0) {
|
|
22334
21732
|
obj.inputIndex = Math.round(message.inputIndex);
|
|
@@ -22349,7 +21747,7 @@ function createBaseInputTtxoSignaturesPerOperator() {
|
|
|
22349
21747
|
return { ttxoSignatures: [], operatorIdentityPublicKey: new Uint8Array(0) };
|
|
22350
21748
|
}
|
|
22351
21749
|
var InputTtxoSignaturesPerOperator = {
|
|
22352
|
-
encode(message, writer = new
|
|
21750
|
+
encode(message, writer = new import_wire6.BinaryWriter()) {
|
|
22353
21751
|
for (const v of message.ttxoSignatures) {
|
|
22354
21752
|
SignatureWithIndex2.encode(v, writer.uint32(10).fork()).join();
|
|
22355
21753
|
}
|
|
@@ -22359,7 +21757,7 @@ var InputTtxoSignaturesPerOperator = {
|
|
|
22359
21757
|
return writer;
|
|
22360
21758
|
},
|
|
22361
21759
|
decode(input, length) {
|
|
22362
|
-
const reader = input instanceof
|
|
21760
|
+
const reader = input instanceof import_wire6.BinaryReader ? input : new import_wire6.BinaryReader(input);
|
|
22363
21761
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
22364
21762
|
const message = createBaseInputTtxoSignaturesPerOperator();
|
|
22365
21763
|
while (reader.pos < end) {
|
|
@@ -22390,7 +21788,7 @@ var InputTtxoSignaturesPerOperator = {
|
|
|
22390
21788
|
fromJSON(object) {
|
|
22391
21789
|
return {
|
|
22392
21790
|
ttxoSignatures: globalThis.Array.isArray(object?.ttxoSignatures) ? object.ttxoSignatures.map((e) => SignatureWithIndex2.fromJSON(e)) : [],
|
|
22393
|
-
operatorIdentityPublicKey:
|
|
21791
|
+
operatorIdentityPublicKey: isSet5(object.operatorIdentityPublicKey) ? bytesFromBase644(object.operatorIdentityPublicKey) : new Uint8Array(0)
|
|
22394
21792
|
};
|
|
22395
21793
|
},
|
|
22396
21794
|
toJSON(message) {
|
|
@@ -22399,7 +21797,7 @@ var InputTtxoSignaturesPerOperator = {
|
|
|
22399
21797
|
obj.ttxoSignatures = message.ttxoSignatures.map((e) => SignatureWithIndex2.toJSON(e));
|
|
22400
21798
|
}
|
|
22401
21799
|
if (message.operatorIdentityPublicKey.length !== 0) {
|
|
22402
|
-
obj.operatorIdentityPublicKey =
|
|
21800
|
+
obj.operatorIdentityPublicKey = base64FromBytes4(message.operatorIdentityPublicKey);
|
|
22403
21801
|
}
|
|
22404
21802
|
return obj;
|
|
22405
21803
|
},
|
|
@@ -22422,7 +21820,7 @@ function createBaseStartTransactionRequest() {
|
|
|
22422
21820
|
};
|
|
22423
21821
|
}
|
|
22424
21822
|
var StartTransactionRequest = {
|
|
22425
|
-
encode(message, writer = new
|
|
21823
|
+
encode(message, writer = new import_wire6.BinaryWriter()) {
|
|
22426
21824
|
if (message.identityPublicKey.length !== 0) {
|
|
22427
21825
|
writer.uint32(10).bytes(message.identityPublicKey);
|
|
22428
21826
|
}
|
|
@@ -22438,7 +21836,7 @@ var StartTransactionRequest = {
|
|
|
22438
21836
|
return writer;
|
|
22439
21837
|
},
|
|
22440
21838
|
decode(input, length) {
|
|
22441
|
-
const reader = input instanceof
|
|
21839
|
+
const reader = input instanceof import_wire6.BinaryReader ? input : new import_wire6.BinaryReader(input);
|
|
22442
21840
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
22443
21841
|
const message = createBaseStartTransactionRequest();
|
|
22444
21842
|
while (reader.pos < end) {
|
|
@@ -22482,16 +21880,16 @@ var StartTransactionRequest = {
|
|
|
22482
21880
|
},
|
|
22483
21881
|
fromJSON(object) {
|
|
22484
21882
|
return {
|
|
22485
|
-
identityPublicKey:
|
|
22486
|
-
partialTokenTransaction:
|
|
21883
|
+
identityPublicKey: isSet5(object.identityPublicKey) ? bytesFromBase644(object.identityPublicKey) : new Uint8Array(0),
|
|
21884
|
+
partialTokenTransaction: isSet5(object.partialTokenTransaction) ? TokenTransaction2.fromJSON(object.partialTokenTransaction) : void 0,
|
|
22487
21885
|
partialTokenTransactionOwnerSignatures: globalThis.Array.isArray(object?.partialTokenTransactionOwnerSignatures) ? object.partialTokenTransactionOwnerSignatures.map((e) => SignatureWithIndex2.fromJSON(e)) : [],
|
|
22488
|
-
validityDurationSeconds:
|
|
21886
|
+
validityDurationSeconds: isSet5(object.validityDurationSeconds) ? globalThis.Number(object.validityDurationSeconds) : 0
|
|
22489
21887
|
};
|
|
22490
21888
|
},
|
|
22491
21889
|
toJSON(message) {
|
|
22492
21890
|
const obj = {};
|
|
22493
21891
|
if (message.identityPublicKey.length !== 0) {
|
|
22494
|
-
obj.identityPublicKey =
|
|
21892
|
+
obj.identityPublicKey = base64FromBytes4(message.identityPublicKey);
|
|
22495
21893
|
}
|
|
22496
21894
|
if (message.partialTokenTransaction !== void 0) {
|
|
22497
21895
|
obj.partialTokenTransaction = TokenTransaction2.toJSON(message.partialTokenTransaction);
|
|
@@ -22522,7 +21920,7 @@ function createBaseStartTransactionResponse() {
|
|
|
22522
21920
|
return { finalTokenTransaction: void 0, keyshareInfo: void 0 };
|
|
22523
21921
|
}
|
|
22524
21922
|
var StartTransactionResponse = {
|
|
22525
|
-
encode(message, writer = new
|
|
21923
|
+
encode(message, writer = new import_wire6.BinaryWriter()) {
|
|
22526
21924
|
if (message.finalTokenTransaction !== void 0) {
|
|
22527
21925
|
TokenTransaction2.encode(message.finalTokenTransaction, writer.uint32(10).fork()).join();
|
|
22528
21926
|
}
|
|
@@ -22532,7 +21930,7 @@ var StartTransactionResponse = {
|
|
|
22532
21930
|
return writer;
|
|
22533
21931
|
},
|
|
22534
21932
|
decode(input, length) {
|
|
22535
|
-
const reader = input instanceof
|
|
21933
|
+
const reader = input instanceof import_wire6.BinaryReader ? input : new import_wire6.BinaryReader(input);
|
|
22536
21934
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
22537
21935
|
const message = createBaseStartTransactionResponse();
|
|
22538
21936
|
while (reader.pos < end) {
|
|
@@ -22562,8 +21960,8 @@ var StartTransactionResponse = {
|
|
|
22562
21960
|
},
|
|
22563
21961
|
fromJSON(object) {
|
|
22564
21962
|
return {
|
|
22565
|
-
finalTokenTransaction:
|
|
22566
|
-
keyshareInfo:
|
|
21963
|
+
finalTokenTransaction: isSet5(object.finalTokenTransaction) ? TokenTransaction2.fromJSON(object.finalTokenTransaction) : void 0,
|
|
21964
|
+
keyshareInfo: isSet5(object.keyshareInfo) ? SigningKeyshare.fromJSON(object.keyshareInfo) : void 0
|
|
22567
21965
|
};
|
|
22568
21966
|
},
|
|
22569
21967
|
toJSON(message) {
|
|
@@ -22595,7 +21993,7 @@ function createBaseCommitTransactionRequest() {
|
|
|
22595
21993
|
};
|
|
22596
21994
|
}
|
|
22597
21995
|
var CommitTransactionRequest = {
|
|
22598
|
-
encode(message, writer = new
|
|
21996
|
+
encode(message, writer = new import_wire6.BinaryWriter()) {
|
|
22599
21997
|
if (message.finalTokenTransaction !== void 0) {
|
|
22600
21998
|
TokenTransaction2.encode(message.finalTokenTransaction, writer.uint32(10).fork()).join();
|
|
22601
21999
|
}
|
|
@@ -22611,7 +22009,7 @@ var CommitTransactionRequest = {
|
|
|
22611
22009
|
return writer;
|
|
22612
22010
|
},
|
|
22613
22011
|
decode(input, length) {
|
|
22614
|
-
const reader = input instanceof
|
|
22012
|
+
const reader = input instanceof import_wire6.BinaryReader ? input : new import_wire6.BinaryReader(input);
|
|
22615
22013
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
22616
22014
|
const message = createBaseCommitTransactionRequest();
|
|
22617
22015
|
while (reader.pos < end) {
|
|
@@ -22655,10 +22053,10 @@ var CommitTransactionRequest = {
|
|
|
22655
22053
|
},
|
|
22656
22054
|
fromJSON(object) {
|
|
22657
22055
|
return {
|
|
22658
|
-
finalTokenTransaction:
|
|
22659
|
-
finalTokenTransactionHash:
|
|
22056
|
+
finalTokenTransaction: isSet5(object.finalTokenTransaction) ? TokenTransaction2.fromJSON(object.finalTokenTransaction) : void 0,
|
|
22057
|
+
finalTokenTransactionHash: isSet5(object.finalTokenTransactionHash) ? bytesFromBase644(object.finalTokenTransactionHash) : new Uint8Array(0),
|
|
22660
22058
|
inputTtxoSignaturesPerOperator: globalThis.Array.isArray(object?.inputTtxoSignaturesPerOperator) ? object.inputTtxoSignaturesPerOperator.map((e) => InputTtxoSignaturesPerOperator.fromJSON(e)) : [],
|
|
22661
|
-
ownerIdentityPublicKey:
|
|
22059
|
+
ownerIdentityPublicKey: isSet5(object.ownerIdentityPublicKey) ? bytesFromBase644(object.ownerIdentityPublicKey) : new Uint8Array(0)
|
|
22662
22060
|
};
|
|
22663
22061
|
},
|
|
22664
22062
|
toJSON(message) {
|
|
@@ -22667,7 +22065,7 @@ var CommitTransactionRequest = {
|
|
|
22667
22065
|
obj.finalTokenTransaction = TokenTransaction2.toJSON(message.finalTokenTransaction);
|
|
22668
22066
|
}
|
|
22669
22067
|
if (message.finalTokenTransactionHash.length !== 0) {
|
|
22670
|
-
obj.finalTokenTransactionHash =
|
|
22068
|
+
obj.finalTokenTransactionHash = base64FromBytes4(message.finalTokenTransactionHash);
|
|
22671
22069
|
}
|
|
22672
22070
|
if (message.inputTtxoSignaturesPerOperator?.length) {
|
|
22673
22071
|
obj.inputTtxoSignaturesPerOperator = message.inputTtxoSignaturesPerOperator.map(
|
|
@@ -22675,7 +22073,7 @@ var CommitTransactionRequest = {
|
|
|
22675
22073
|
);
|
|
22676
22074
|
}
|
|
22677
22075
|
if (message.ownerIdentityPublicKey.length !== 0) {
|
|
22678
|
-
obj.ownerIdentityPublicKey =
|
|
22076
|
+
obj.ownerIdentityPublicKey = base64FromBytes4(message.ownerIdentityPublicKey);
|
|
22679
22077
|
}
|
|
22680
22078
|
return obj;
|
|
22681
22079
|
},
|
|
@@ -22695,7 +22093,7 @@ function createBaseCommitProgress() {
|
|
|
22695
22093
|
return { committedOperatorPublicKeys: [], uncommittedOperatorPublicKeys: [] };
|
|
22696
22094
|
}
|
|
22697
22095
|
var CommitProgress = {
|
|
22698
|
-
encode(message, writer = new
|
|
22096
|
+
encode(message, writer = new import_wire6.BinaryWriter()) {
|
|
22699
22097
|
for (const v of message.committedOperatorPublicKeys) {
|
|
22700
22098
|
writer.uint32(10).bytes(v);
|
|
22701
22099
|
}
|
|
@@ -22705,7 +22103,7 @@ var CommitProgress = {
|
|
|
22705
22103
|
return writer;
|
|
22706
22104
|
},
|
|
22707
22105
|
decode(input, length) {
|
|
22708
|
-
const reader = input instanceof
|
|
22106
|
+
const reader = input instanceof import_wire6.BinaryReader ? input : new import_wire6.BinaryReader(input);
|
|
22709
22107
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
22710
22108
|
const message = createBaseCommitProgress();
|
|
22711
22109
|
while (reader.pos < end) {
|
|
@@ -22735,17 +22133,17 @@ var CommitProgress = {
|
|
|
22735
22133
|
},
|
|
22736
22134
|
fromJSON(object) {
|
|
22737
22135
|
return {
|
|
22738
|
-
committedOperatorPublicKeys: globalThis.Array.isArray(object?.committedOperatorPublicKeys) ? object.committedOperatorPublicKeys.map((e) =>
|
|
22739
|
-
uncommittedOperatorPublicKeys: globalThis.Array.isArray(object?.uncommittedOperatorPublicKeys) ? object.uncommittedOperatorPublicKeys.map((e) =>
|
|
22136
|
+
committedOperatorPublicKeys: globalThis.Array.isArray(object?.committedOperatorPublicKeys) ? object.committedOperatorPublicKeys.map((e) => bytesFromBase644(e)) : [],
|
|
22137
|
+
uncommittedOperatorPublicKeys: globalThis.Array.isArray(object?.uncommittedOperatorPublicKeys) ? object.uncommittedOperatorPublicKeys.map((e) => bytesFromBase644(e)) : []
|
|
22740
22138
|
};
|
|
22741
22139
|
},
|
|
22742
22140
|
toJSON(message) {
|
|
22743
22141
|
const obj = {};
|
|
22744
22142
|
if (message.committedOperatorPublicKeys?.length) {
|
|
22745
|
-
obj.committedOperatorPublicKeys = message.committedOperatorPublicKeys.map((e) =>
|
|
22143
|
+
obj.committedOperatorPublicKeys = message.committedOperatorPublicKeys.map((e) => base64FromBytes4(e));
|
|
22746
22144
|
}
|
|
22747
22145
|
if (message.uncommittedOperatorPublicKeys?.length) {
|
|
22748
|
-
obj.uncommittedOperatorPublicKeys = message.uncommittedOperatorPublicKeys.map((e) =>
|
|
22146
|
+
obj.uncommittedOperatorPublicKeys = message.uncommittedOperatorPublicKeys.map((e) => base64FromBytes4(e));
|
|
22749
22147
|
}
|
|
22750
22148
|
return obj;
|
|
22751
22149
|
},
|
|
@@ -22763,7 +22161,7 @@ function createBaseCommitTransactionResponse() {
|
|
|
22763
22161
|
return { commitStatus: 0, commitProgress: void 0 };
|
|
22764
22162
|
}
|
|
22765
22163
|
var CommitTransactionResponse = {
|
|
22766
|
-
encode(message, writer = new
|
|
22164
|
+
encode(message, writer = new import_wire6.BinaryWriter()) {
|
|
22767
22165
|
if (message.commitStatus !== 0) {
|
|
22768
22166
|
writer.uint32(8).int32(message.commitStatus);
|
|
22769
22167
|
}
|
|
@@ -22773,7 +22171,7 @@ var CommitTransactionResponse = {
|
|
|
22773
22171
|
return writer;
|
|
22774
22172
|
},
|
|
22775
22173
|
decode(input, length) {
|
|
22776
|
-
const reader = input instanceof
|
|
22174
|
+
const reader = input instanceof import_wire6.BinaryReader ? input : new import_wire6.BinaryReader(input);
|
|
22777
22175
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
22778
22176
|
const message = createBaseCommitTransactionResponse();
|
|
22779
22177
|
while (reader.pos < end) {
|
|
@@ -22803,8 +22201,8 @@ var CommitTransactionResponse = {
|
|
|
22803
22201
|
},
|
|
22804
22202
|
fromJSON(object) {
|
|
22805
22203
|
return {
|
|
22806
|
-
commitStatus:
|
|
22807
|
-
commitProgress:
|
|
22204
|
+
commitStatus: isSet5(object.commitStatus) ? commitStatusFromJSON(object.commitStatus) : 0,
|
|
22205
|
+
commitProgress: isSet5(object.commitProgress) ? CommitProgress.fromJSON(object.commitProgress) : void 0
|
|
22808
22206
|
};
|
|
22809
22207
|
},
|
|
22810
22208
|
toJSON(message) {
|
|
@@ -22831,7 +22229,7 @@ function createBaseQueryTokenMetadataRequest() {
|
|
|
22831
22229
|
return { tokenIdentifiers: [], issuerPublicKeys: [] };
|
|
22832
22230
|
}
|
|
22833
22231
|
var QueryTokenMetadataRequest = {
|
|
22834
|
-
encode(message, writer = new
|
|
22232
|
+
encode(message, writer = new import_wire6.BinaryWriter()) {
|
|
22835
22233
|
for (const v of message.tokenIdentifiers) {
|
|
22836
22234
|
writer.uint32(10).bytes(v);
|
|
22837
22235
|
}
|
|
@@ -22841,7 +22239,7 @@ var QueryTokenMetadataRequest = {
|
|
|
22841
22239
|
return writer;
|
|
22842
22240
|
},
|
|
22843
22241
|
decode(input, length) {
|
|
22844
|
-
const reader = input instanceof
|
|
22242
|
+
const reader = input instanceof import_wire6.BinaryReader ? input : new import_wire6.BinaryReader(input);
|
|
22845
22243
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
22846
22244
|
const message = createBaseQueryTokenMetadataRequest();
|
|
22847
22245
|
while (reader.pos < end) {
|
|
@@ -22871,17 +22269,17 @@ var QueryTokenMetadataRequest = {
|
|
|
22871
22269
|
},
|
|
22872
22270
|
fromJSON(object) {
|
|
22873
22271
|
return {
|
|
22874
|
-
tokenIdentifiers: globalThis.Array.isArray(object?.tokenIdentifiers) ? object.tokenIdentifiers.map((e) =>
|
|
22875
|
-
issuerPublicKeys: globalThis.Array.isArray(object?.issuerPublicKeys) ? object.issuerPublicKeys.map((e) =>
|
|
22272
|
+
tokenIdentifiers: globalThis.Array.isArray(object?.tokenIdentifiers) ? object.tokenIdentifiers.map((e) => bytesFromBase644(e)) : [],
|
|
22273
|
+
issuerPublicKeys: globalThis.Array.isArray(object?.issuerPublicKeys) ? object.issuerPublicKeys.map((e) => bytesFromBase644(e)) : []
|
|
22876
22274
|
};
|
|
22877
22275
|
},
|
|
22878
22276
|
toJSON(message) {
|
|
22879
22277
|
const obj = {};
|
|
22880
22278
|
if (message.tokenIdentifiers?.length) {
|
|
22881
|
-
obj.tokenIdentifiers = message.tokenIdentifiers.map((e) =>
|
|
22279
|
+
obj.tokenIdentifiers = message.tokenIdentifiers.map((e) => base64FromBytes4(e));
|
|
22882
22280
|
}
|
|
22883
22281
|
if (message.issuerPublicKeys?.length) {
|
|
22884
|
-
obj.issuerPublicKeys = message.issuerPublicKeys.map((e) =>
|
|
22282
|
+
obj.issuerPublicKeys = message.issuerPublicKeys.map((e) => base64FromBytes4(e));
|
|
22885
22283
|
}
|
|
22886
22284
|
return obj;
|
|
22887
22285
|
},
|
|
@@ -22908,7 +22306,7 @@ function createBaseTokenMetadata() {
|
|
|
22908
22306
|
};
|
|
22909
22307
|
}
|
|
22910
22308
|
var TokenMetadata = {
|
|
22911
|
-
encode(message, writer = new
|
|
22309
|
+
encode(message, writer = new import_wire6.BinaryWriter()) {
|
|
22912
22310
|
if (message.issuerPublicKey.length !== 0) {
|
|
22913
22311
|
writer.uint32(10).bytes(message.issuerPublicKey);
|
|
22914
22312
|
}
|
|
@@ -22936,7 +22334,7 @@ var TokenMetadata = {
|
|
|
22936
22334
|
return writer;
|
|
22937
22335
|
},
|
|
22938
22336
|
decode(input, length) {
|
|
22939
|
-
const reader = input instanceof
|
|
22337
|
+
const reader = input instanceof import_wire6.BinaryReader ? input : new import_wire6.BinaryReader(input);
|
|
22940
22338
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
22941
22339
|
const message = createBaseTokenMetadata();
|
|
22942
22340
|
while (reader.pos < end) {
|
|
@@ -23008,20 +22406,20 @@ var TokenMetadata = {
|
|
|
23008
22406
|
},
|
|
23009
22407
|
fromJSON(object) {
|
|
23010
22408
|
return {
|
|
23011
|
-
issuerPublicKey:
|
|
23012
|
-
tokenName:
|
|
23013
|
-
tokenTicker:
|
|
23014
|
-
decimals:
|
|
23015
|
-
maxSupply:
|
|
23016
|
-
isFreezable:
|
|
23017
|
-
creationEntityPublicKey:
|
|
23018
|
-
tokenIdentifier:
|
|
22409
|
+
issuerPublicKey: isSet5(object.issuerPublicKey) ? bytesFromBase644(object.issuerPublicKey) : new Uint8Array(0),
|
|
22410
|
+
tokenName: isSet5(object.tokenName) ? globalThis.String(object.tokenName) : "",
|
|
22411
|
+
tokenTicker: isSet5(object.tokenTicker) ? globalThis.String(object.tokenTicker) : "",
|
|
22412
|
+
decimals: isSet5(object.decimals) ? globalThis.Number(object.decimals) : 0,
|
|
22413
|
+
maxSupply: isSet5(object.maxSupply) ? bytesFromBase644(object.maxSupply) : new Uint8Array(0),
|
|
22414
|
+
isFreezable: isSet5(object.isFreezable) ? globalThis.Boolean(object.isFreezable) : false,
|
|
22415
|
+
creationEntityPublicKey: isSet5(object.creationEntityPublicKey) ? bytesFromBase644(object.creationEntityPublicKey) : void 0,
|
|
22416
|
+
tokenIdentifier: isSet5(object.tokenIdentifier) ? bytesFromBase644(object.tokenIdentifier) : new Uint8Array(0)
|
|
23019
22417
|
};
|
|
23020
22418
|
},
|
|
23021
22419
|
toJSON(message) {
|
|
23022
22420
|
const obj = {};
|
|
23023
22421
|
if (message.issuerPublicKey.length !== 0) {
|
|
23024
|
-
obj.issuerPublicKey =
|
|
22422
|
+
obj.issuerPublicKey = base64FromBytes4(message.issuerPublicKey);
|
|
23025
22423
|
}
|
|
23026
22424
|
if (message.tokenName !== "") {
|
|
23027
22425
|
obj.tokenName = message.tokenName;
|
|
@@ -23033,16 +22431,16 @@ var TokenMetadata = {
|
|
|
23033
22431
|
obj.decimals = Math.round(message.decimals);
|
|
23034
22432
|
}
|
|
23035
22433
|
if (message.maxSupply.length !== 0) {
|
|
23036
|
-
obj.maxSupply =
|
|
22434
|
+
obj.maxSupply = base64FromBytes4(message.maxSupply);
|
|
23037
22435
|
}
|
|
23038
22436
|
if (message.isFreezable !== false) {
|
|
23039
22437
|
obj.isFreezable = message.isFreezable;
|
|
23040
22438
|
}
|
|
23041
22439
|
if (message.creationEntityPublicKey !== void 0) {
|
|
23042
|
-
obj.creationEntityPublicKey =
|
|
22440
|
+
obj.creationEntityPublicKey = base64FromBytes4(message.creationEntityPublicKey);
|
|
23043
22441
|
}
|
|
23044
22442
|
if (message.tokenIdentifier.length !== 0) {
|
|
23045
|
-
obj.tokenIdentifier =
|
|
22443
|
+
obj.tokenIdentifier = base64FromBytes4(message.tokenIdentifier);
|
|
23046
22444
|
}
|
|
23047
22445
|
return obj;
|
|
23048
22446
|
},
|
|
@@ -23066,14 +22464,14 @@ function createBaseQueryTokenMetadataResponse() {
|
|
|
23066
22464
|
return { tokenMetadata: [] };
|
|
23067
22465
|
}
|
|
23068
22466
|
var QueryTokenMetadataResponse = {
|
|
23069
|
-
encode(message, writer = new
|
|
22467
|
+
encode(message, writer = new import_wire6.BinaryWriter()) {
|
|
23070
22468
|
for (const v of message.tokenMetadata) {
|
|
23071
22469
|
TokenMetadata.encode(v, writer.uint32(10).fork()).join();
|
|
23072
22470
|
}
|
|
23073
22471
|
return writer;
|
|
23074
22472
|
},
|
|
23075
22473
|
decode(input, length) {
|
|
23076
|
-
const reader = input instanceof
|
|
22474
|
+
const reader = input instanceof import_wire6.BinaryReader ? input : new import_wire6.BinaryReader(input);
|
|
23077
22475
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
23078
22476
|
const message = createBaseQueryTokenMetadataResponse();
|
|
23079
22477
|
while (reader.pos < end) {
|
|
@@ -23119,7 +22517,7 @@ function createBaseQueryTokenOutputsRequest2() {
|
|
|
23119
22517
|
return { ownerPublicKeys: [], issuerPublicKeys: [], tokenIdentifiers: [], network: 0, pageRequest: void 0 };
|
|
23120
22518
|
}
|
|
23121
22519
|
var QueryTokenOutputsRequest2 = {
|
|
23122
|
-
encode(message, writer = new
|
|
22520
|
+
encode(message, writer = new import_wire6.BinaryWriter()) {
|
|
23123
22521
|
for (const v of message.ownerPublicKeys) {
|
|
23124
22522
|
writer.uint32(10).bytes(v);
|
|
23125
22523
|
}
|
|
@@ -23138,7 +22536,7 @@ var QueryTokenOutputsRequest2 = {
|
|
|
23138
22536
|
return writer;
|
|
23139
22537
|
},
|
|
23140
22538
|
decode(input, length) {
|
|
23141
|
-
const reader = input instanceof
|
|
22539
|
+
const reader = input instanceof import_wire6.BinaryReader ? input : new import_wire6.BinaryReader(input);
|
|
23142
22540
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
23143
22541
|
const message = createBaseQueryTokenOutputsRequest2();
|
|
23144
22542
|
while (reader.pos < end) {
|
|
@@ -23189,23 +22587,23 @@ var QueryTokenOutputsRequest2 = {
|
|
|
23189
22587
|
},
|
|
23190
22588
|
fromJSON(object) {
|
|
23191
22589
|
return {
|
|
23192
|
-
ownerPublicKeys: globalThis.Array.isArray(object?.ownerPublicKeys) ? object.ownerPublicKeys.map((e) =>
|
|
23193
|
-
issuerPublicKeys: globalThis.Array.isArray(object?.issuerPublicKeys) ? object.issuerPublicKeys.map((e) =>
|
|
23194
|
-
tokenIdentifiers: globalThis.Array.isArray(object?.tokenIdentifiers) ? object.tokenIdentifiers.map((e) =>
|
|
23195
|
-
network:
|
|
23196
|
-
pageRequest:
|
|
22590
|
+
ownerPublicKeys: globalThis.Array.isArray(object?.ownerPublicKeys) ? object.ownerPublicKeys.map((e) => bytesFromBase644(e)) : [],
|
|
22591
|
+
issuerPublicKeys: globalThis.Array.isArray(object?.issuerPublicKeys) ? object.issuerPublicKeys.map((e) => bytesFromBase644(e)) : [],
|
|
22592
|
+
tokenIdentifiers: globalThis.Array.isArray(object?.tokenIdentifiers) ? object.tokenIdentifiers.map((e) => bytesFromBase644(e)) : [],
|
|
22593
|
+
network: isSet5(object.network) ? networkFromJSON(object.network) : 0,
|
|
22594
|
+
pageRequest: isSet5(object.pageRequest) ? PageRequest.fromJSON(object.pageRequest) : void 0
|
|
23197
22595
|
};
|
|
23198
22596
|
},
|
|
23199
22597
|
toJSON(message) {
|
|
23200
22598
|
const obj = {};
|
|
23201
22599
|
if (message.ownerPublicKeys?.length) {
|
|
23202
|
-
obj.ownerPublicKeys = message.ownerPublicKeys.map((e) =>
|
|
22600
|
+
obj.ownerPublicKeys = message.ownerPublicKeys.map((e) => base64FromBytes4(e));
|
|
23203
22601
|
}
|
|
23204
22602
|
if (message.issuerPublicKeys?.length) {
|
|
23205
|
-
obj.issuerPublicKeys = message.issuerPublicKeys.map((e) =>
|
|
22603
|
+
obj.issuerPublicKeys = message.issuerPublicKeys.map((e) => base64FromBytes4(e));
|
|
23206
22604
|
}
|
|
23207
22605
|
if (message.tokenIdentifiers?.length) {
|
|
23208
|
-
obj.tokenIdentifiers = message.tokenIdentifiers.map((e) =>
|
|
22606
|
+
obj.tokenIdentifiers = message.tokenIdentifiers.map((e) => base64FromBytes4(e));
|
|
23209
22607
|
}
|
|
23210
22608
|
if (message.network !== 0) {
|
|
23211
22609
|
obj.network = networkToJSON(message.network);
|
|
@@ -23240,7 +22638,7 @@ function createBaseQueryTokenTransactionsRequest2() {
|
|
|
23240
22638
|
};
|
|
23241
22639
|
}
|
|
23242
22640
|
var QueryTokenTransactionsRequest2 = {
|
|
23243
|
-
encode(message, writer = new
|
|
22641
|
+
encode(message, writer = new import_wire6.BinaryWriter()) {
|
|
23244
22642
|
for (const v of message.outputIds) {
|
|
23245
22643
|
writer.uint32(10).string(v);
|
|
23246
22644
|
}
|
|
@@ -23265,7 +22663,7 @@ var QueryTokenTransactionsRequest2 = {
|
|
|
23265
22663
|
return writer;
|
|
23266
22664
|
},
|
|
23267
22665
|
decode(input, length) {
|
|
23268
|
-
const reader = input instanceof
|
|
22666
|
+
const reader = input instanceof import_wire6.BinaryReader ? input : new import_wire6.BinaryReader(input);
|
|
23269
22667
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
23270
22668
|
const message = createBaseQueryTokenTransactionsRequest2();
|
|
23271
22669
|
while (reader.pos < end) {
|
|
@@ -23331,12 +22729,12 @@ var QueryTokenTransactionsRequest2 = {
|
|
|
23331
22729
|
fromJSON(object) {
|
|
23332
22730
|
return {
|
|
23333
22731
|
outputIds: globalThis.Array.isArray(object?.outputIds) ? object.outputIds.map((e) => globalThis.String(e)) : [],
|
|
23334
|
-
ownerPublicKeys: globalThis.Array.isArray(object?.ownerPublicKeys) ? object.ownerPublicKeys.map((e) =>
|
|
23335
|
-
issuerPublicKeys: globalThis.Array.isArray(object?.issuerPublicKeys) ? object.issuerPublicKeys.map((e) =>
|
|
23336
|
-
tokenIdentifiers: globalThis.Array.isArray(object?.tokenIdentifiers) ? object.tokenIdentifiers.map((e) =>
|
|
23337
|
-
tokenTransactionHashes: globalThis.Array.isArray(object?.tokenTransactionHashes) ? object.tokenTransactionHashes.map((e) =>
|
|
23338
|
-
limit:
|
|
23339
|
-
offset:
|
|
22732
|
+
ownerPublicKeys: globalThis.Array.isArray(object?.ownerPublicKeys) ? object.ownerPublicKeys.map((e) => bytesFromBase644(e)) : [],
|
|
22733
|
+
issuerPublicKeys: globalThis.Array.isArray(object?.issuerPublicKeys) ? object.issuerPublicKeys.map((e) => bytesFromBase644(e)) : [],
|
|
22734
|
+
tokenIdentifiers: globalThis.Array.isArray(object?.tokenIdentifiers) ? object.tokenIdentifiers.map((e) => bytesFromBase644(e)) : [],
|
|
22735
|
+
tokenTransactionHashes: globalThis.Array.isArray(object?.tokenTransactionHashes) ? object.tokenTransactionHashes.map((e) => bytesFromBase644(e)) : [],
|
|
22736
|
+
limit: isSet5(object.limit) ? globalThis.Number(object.limit) : 0,
|
|
22737
|
+
offset: isSet5(object.offset) ? globalThis.Number(object.offset) : 0
|
|
23340
22738
|
};
|
|
23341
22739
|
},
|
|
23342
22740
|
toJSON(message) {
|
|
@@ -23345,16 +22743,16 @@ var QueryTokenTransactionsRequest2 = {
|
|
|
23345
22743
|
obj.outputIds = message.outputIds;
|
|
23346
22744
|
}
|
|
23347
22745
|
if (message.ownerPublicKeys?.length) {
|
|
23348
|
-
obj.ownerPublicKeys = message.ownerPublicKeys.map((e) =>
|
|
22746
|
+
obj.ownerPublicKeys = message.ownerPublicKeys.map((e) => base64FromBytes4(e));
|
|
23349
22747
|
}
|
|
23350
22748
|
if (message.issuerPublicKeys?.length) {
|
|
23351
|
-
obj.issuerPublicKeys = message.issuerPublicKeys.map((e) =>
|
|
22749
|
+
obj.issuerPublicKeys = message.issuerPublicKeys.map((e) => base64FromBytes4(e));
|
|
23352
22750
|
}
|
|
23353
22751
|
if (message.tokenIdentifiers?.length) {
|
|
23354
|
-
obj.tokenIdentifiers = message.tokenIdentifiers.map((e) =>
|
|
22752
|
+
obj.tokenIdentifiers = message.tokenIdentifiers.map((e) => base64FromBytes4(e));
|
|
23355
22753
|
}
|
|
23356
22754
|
if (message.tokenTransactionHashes?.length) {
|
|
23357
|
-
obj.tokenTransactionHashes = message.tokenTransactionHashes.map((e) =>
|
|
22755
|
+
obj.tokenTransactionHashes = message.tokenTransactionHashes.map((e) => base64FromBytes4(e));
|
|
23358
22756
|
}
|
|
23359
22757
|
if (message.limit !== 0) {
|
|
23360
22758
|
obj.limit = Math.round(message.limit);
|
|
@@ -23383,7 +22781,7 @@ function createBaseQueryTokenTransactionsResponse2() {
|
|
|
23383
22781
|
return { tokenTransactionsWithStatus: [], offset: 0 };
|
|
23384
22782
|
}
|
|
23385
22783
|
var QueryTokenTransactionsResponse2 = {
|
|
23386
|
-
encode(message, writer = new
|
|
22784
|
+
encode(message, writer = new import_wire6.BinaryWriter()) {
|
|
23387
22785
|
for (const v of message.tokenTransactionsWithStatus) {
|
|
23388
22786
|
TokenTransactionWithStatus2.encode(v, writer.uint32(10).fork()).join();
|
|
23389
22787
|
}
|
|
@@ -23393,7 +22791,7 @@ var QueryTokenTransactionsResponse2 = {
|
|
|
23393
22791
|
return writer;
|
|
23394
22792
|
},
|
|
23395
22793
|
decode(input, length) {
|
|
23396
|
-
const reader = input instanceof
|
|
22794
|
+
const reader = input instanceof import_wire6.BinaryReader ? input : new import_wire6.BinaryReader(input);
|
|
23397
22795
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
23398
22796
|
const message = createBaseQueryTokenTransactionsResponse2();
|
|
23399
22797
|
while (reader.pos < end) {
|
|
@@ -23424,7 +22822,7 @@ var QueryTokenTransactionsResponse2 = {
|
|
|
23424
22822
|
fromJSON(object) {
|
|
23425
22823
|
return {
|
|
23426
22824
|
tokenTransactionsWithStatus: globalThis.Array.isArray(object?.tokenTransactionsWithStatus) ? object.tokenTransactionsWithStatus.map((e) => TokenTransactionWithStatus2.fromJSON(e)) : [],
|
|
23427
|
-
offset:
|
|
22825
|
+
offset: isSet5(object.offset) ? globalThis.Number(object.offset) : 0
|
|
23428
22826
|
};
|
|
23429
22827
|
},
|
|
23430
22828
|
toJSON(message) {
|
|
@@ -23453,7 +22851,7 @@ function createBaseOutputWithPreviousTransactionData2() {
|
|
|
23453
22851
|
return { output: void 0, previousTransactionHash: new Uint8Array(0), previousTransactionVout: 0 };
|
|
23454
22852
|
}
|
|
23455
22853
|
var OutputWithPreviousTransactionData2 = {
|
|
23456
|
-
encode(message, writer = new
|
|
22854
|
+
encode(message, writer = new import_wire6.BinaryWriter()) {
|
|
23457
22855
|
if (message.output !== void 0) {
|
|
23458
22856
|
TokenOutput2.encode(message.output, writer.uint32(10).fork()).join();
|
|
23459
22857
|
}
|
|
@@ -23466,7 +22864,7 @@ var OutputWithPreviousTransactionData2 = {
|
|
|
23466
22864
|
return writer;
|
|
23467
22865
|
},
|
|
23468
22866
|
decode(input, length) {
|
|
23469
|
-
const reader = input instanceof
|
|
22867
|
+
const reader = input instanceof import_wire6.BinaryReader ? input : new import_wire6.BinaryReader(input);
|
|
23470
22868
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
23471
22869
|
const message = createBaseOutputWithPreviousTransactionData2();
|
|
23472
22870
|
while (reader.pos < end) {
|
|
@@ -23503,9 +22901,9 @@ var OutputWithPreviousTransactionData2 = {
|
|
|
23503
22901
|
},
|
|
23504
22902
|
fromJSON(object) {
|
|
23505
22903
|
return {
|
|
23506
|
-
output:
|
|
23507
|
-
previousTransactionHash:
|
|
23508
|
-
previousTransactionVout:
|
|
22904
|
+
output: isSet5(object.output) ? TokenOutput2.fromJSON(object.output) : void 0,
|
|
22905
|
+
previousTransactionHash: isSet5(object.previousTransactionHash) ? bytesFromBase644(object.previousTransactionHash) : new Uint8Array(0),
|
|
22906
|
+
previousTransactionVout: isSet5(object.previousTransactionVout) ? globalThis.Number(object.previousTransactionVout) : 0
|
|
23509
22907
|
};
|
|
23510
22908
|
},
|
|
23511
22909
|
toJSON(message) {
|
|
@@ -23514,7 +22912,7 @@ var OutputWithPreviousTransactionData2 = {
|
|
|
23514
22912
|
obj.output = TokenOutput2.toJSON(message.output);
|
|
23515
22913
|
}
|
|
23516
22914
|
if (message.previousTransactionHash.length !== 0) {
|
|
23517
|
-
obj.previousTransactionHash =
|
|
22915
|
+
obj.previousTransactionHash = base64FromBytes4(message.previousTransactionHash);
|
|
23518
22916
|
}
|
|
23519
22917
|
if (message.previousTransactionVout !== 0) {
|
|
23520
22918
|
obj.previousTransactionVout = Math.round(message.previousTransactionVout);
|
|
@@ -23536,7 +22934,7 @@ function createBaseQueryTokenOutputsResponse2() {
|
|
|
23536
22934
|
return { outputsWithPreviousTransactionData: [], pageResponse: void 0 };
|
|
23537
22935
|
}
|
|
23538
22936
|
var QueryTokenOutputsResponse2 = {
|
|
23539
|
-
encode(message, writer = new
|
|
22937
|
+
encode(message, writer = new import_wire6.BinaryWriter()) {
|
|
23540
22938
|
for (const v of message.outputsWithPreviousTransactionData) {
|
|
23541
22939
|
OutputWithPreviousTransactionData2.encode(v, writer.uint32(10).fork()).join();
|
|
23542
22940
|
}
|
|
@@ -23546,7 +22944,7 @@ var QueryTokenOutputsResponse2 = {
|
|
|
23546
22944
|
return writer;
|
|
23547
22945
|
},
|
|
23548
22946
|
decode(input, length) {
|
|
23549
|
-
const reader = input instanceof
|
|
22947
|
+
const reader = input instanceof import_wire6.BinaryReader ? input : new import_wire6.BinaryReader(input);
|
|
23550
22948
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
23551
22949
|
const message = createBaseQueryTokenOutputsResponse2();
|
|
23552
22950
|
while (reader.pos < end) {
|
|
@@ -23579,7 +22977,7 @@ var QueryTokenOutputsResponse2 = {
|
|
|
23579
22977
|
fromJSON(object) {
|
|
23580
22978
|
return {
|
|
23581
22979
|
outputsWithPreviousTransactionData: globalThis.Array.isArray(object?.outputsWithPreviousTransactionData) ? object.outputsWithPreviousTransactionData.map((e) => OutputWithPreviousTransactionData2.fromJSON(e)) : [],
|
|
23582
|
-
pageResponse:
|
|
22980
|
+
pageResponse: isSet5(object.pageResponse) ? PageResponse.fromJSON(object.pageResponse) : void 0
|
|
23583
22981
|
};
|
|
23584
22982
|
},
|
|
23585
22983
|
toJSON(message) {
|
|
@@ -23608,7 +23006,7 @@ function createBaseSpentTokenOutputMetadata2() {
|
|
|
23608
23006
|
return { outputId: "", revocationSecret: new Uint8Array(0) };
|
|
23609
23007
|
}
|
|
23610
23008
|
var SpentTokenOutputMetadata2 = {
|
|
23611
|
-
encode(message, writer = new
|
|
23009
|
+
encode(message, writer = new import_wire6.BinaryWriter()) {
|
|
23612
23010
|
if (message.outputId !== "") {
|
|
23613
23011
|
writer.uint32(10).string(message.outputId);
|
|
23614
23012
|
}
|
|
@@ -23618,7 +23016,7 @@ var SpentTokenOutputMetadata2 = {
|
|
|
23618
23016
|
return writer;
|
|
23619
23017
|
},
|
|
23620
23018
|
decode(input, length) {
|
|
23621
|
-
const reader = input instanceof
|
|
23019
|
+
const reader = input instanceof import_wire6.BinaryReader ? input : new import_wire6.BinaryReader(input);
|
|
23622
23020
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
23623
23021
|
const message = createBaseSpentTokenOutputMetadata2();
|
|
23624
23022
|
while (reader.pos < end) {
|
|
@@ -23648,8 +23046,8 @@ var SpentTokenOutputMetadata2 = {
|
|
|
23648
23046
|
},
|
|
23649
23047
|
fromJSON(object) {
|
|
23650
23048
|
return {
|
|
23651
|
-
outputId:
|
|
23652
|
-
revocationSecret:
|
|
23049
|
+
outputId: isSet5(object.outputId) ? globalThis.String(object.outputId) : "",
|
|
23050
|
+
revocationSecret: isSet5(object.revocationSecret) ? bytesFromBase644(object.revocationSecret) : new Uint8Array(0)
|
|
23653
23051
|
};
|
|
23654
23052
|
},
|
|
23655
23053
|
toJSON(message) {
|
|
@@ -23658,7 +23056,7 @@ var SpentTokenOutputMetadata2 = {
|
|
|
23658
23056
|
obj.outputId = message.outputId;
|
|
23659
23057
|
}
|
|
23660
23058
|
if (message.revocationSecret.length !== 0) {
|
|
23661
|
-
obj.revocationSecret =
|
|
23059
|
+
obj.revocationSecret = base64FromBytes4(message.revocationSecret);
|
|
23662
23060
|
}
|
|
23663
23061
|
return obj;
|
|
23664
23062
|
},
|
|
@@ -23676,14 +23074,14 @@ function createBaseTokenTransactionConfirmationMetadata2() {
|
|
|
23676
23074
|
return { spentTokenOutputsMetadata: [] };
|
|
23677
23075
|
}
|
|
23678
23076
|
var TokenTransactionConfirmationMetadata2 = {
|
|
23679
|
-
encode(message, writer = new
|
|
23077
|
+
encode(message, writer = new import_wire6.BinaryWriter()) {
|
|
23680
23078
|
for (const v of message.spentTokenOutputsMetadata) {
|
|
23681
23079
|
SpentTokenOutputMetadata2.encode(v, writer.uint32(10).fork()).join();
|
|
23682
23080
|
}
|
|
23683
23081
|
return writer;
|
|
23684
23082
|
},
|
|
23685
23083
|
decode(input, length) {
|
|
23686
|
-
const reader = input instanceof
|
|
23084
|
+
const reader = input instanceof import_wire6.BinaryReader ? input : new import_wire6.BinaryReader(input);
|
|
23687
23085
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
23688
23086
|
const message = createBaseTokenTransactionConfirmationMetadata2();
|
|
23689
23087
|
while (reader.pos < end) {
|
|
@@ -23734,7 +23132,7 @@ function createBaseTokenTransactionWithStatus2() {
|
|
|
23734
23132
|
};
|
|
23735
23133
|
}
|
|
23736
23134
|
var TokenTransactionWithStatus2 = {
|
|
23737
|
-
encode(message, writer = new
|
|
23135
|
+
encode(message, writer = new import_wire6.BinaryWriter()) {
|
|
23738
23136
|
if (message.tokenTransaction !== void 0) {
|
|
23739
23137
|
TokenTransaction2.encode(message.tokenTransaction, writer.uint32(10).fork()).join();
|
|
23740
23138
|
}
|
|
@@ -23750,7 +23148,7 @@ var TokenTransactionWithStatus2 = {
|
|
|
23750
23148
|
return writer;
|
|
23751
23149
|
},
|
|
23752
23150
|
decode(input, length) {
|
|
23753
|
-
const reader = input instanceof
|
|
23151
|
+
const reader = input instanceof import_wire6.BinaryReader ? input : new import_wire6.BinaryReader(input);
|
|
23754
23152
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
23755
23153
|
const message = createBaseTokenTransactionWithStatus2();
|
|
23756
23154
|
while (reader.pos < end) {
|
|
@@ -23794,10 +23192,10 @@ var TokenTransactionWithStatus2 = {
|
|
|
23794
23192
|
},
|
|
23795
23193
|
fromJSON(object) {
|
|
23796
23194
|
return {
|
|
23797
|
-
tokenTransaction:
|
|
23798
|
-
status:
|
|
23799
|
-
confirmationMetadata:
|
|
23800
|
-
tokenTransactionHash:
|
|
23195
|
+
tokenTransaction: isSet5(object.tokenTransaction) ? TokenTransaction2.fromJSON(object.tokenTransaction) : void 0,
|
|
23196
|
+
status: isSet5(object.status) ? tokenTransactionStatusFromJSON2(object.status) : 0,
|
|
23197
|
+
confirmationMetadata: isSet5(object.confirmationMetadata) ? TokenTransactionConfirmationMetadata2.fromJSON(object.confirmationMetadata) : void 0,
|
|
23198
|
+
tokenTransactionHash: isSet5(object.tokenTransactionHash) ? bytesFromBase644(object.tokenTransactionHash) : new Uint8Array(0)
|
|
23801
23199
|
};
|
|
23802
23200
|
},
|
|
23803
23201
|
toJSON(message) {
|
|
@@ -23812,7 +23210,7 @@ var TokenTransactionWithStatus2 = {
|
|
|
23812
23210
|
obj.confirmationMetadata = TokenTransactionConfirmationMetadata2.toJSON(message.confirmationMetadata);
|
|
23813
23211
|
}
|
|
23814
23212
|
if (message.tokenTransactionHash.length !== 0) {
|
|
23815
|
-
obj.tokenTransactionHash =
|
|
23213
|
+
obj.tokenTransactionHash = base64FromBytes4(message.tokenTransactionHash);
|
|
23816
23214
|
}
|
|
23817
23215
|
return obj;
|
|
23818
23216
|
},
|
|
@@ -23840,7 +23238,7 @@ function createBaseFreezeTokensPayload2() {
|
|
|
23840
23238
|
};
|
|
23841
23239
|
}
|
|
23842
23240
|
var FreezeTokensPayload2 = {
|
|
23843
|
-
encode(message, writer = new
|
|
23241
|
+
encode(message, writer = new import_wire6.BinaryWriter()) {
|
|
23844
23242
|
if (message.version !== 0) {
|
|
23845
23243
|
writer.uint32(8).uint32(message.version);
|
|
23846
23244
|
}
|
|
@@ -23865,7 +23263,7 @@ var FreezeTokensPayload2 = {
|
|
|
23865
23263
|
return writer;
|
|
23866
23264
|
},
|
|
23867
23265
|
decode(input, length) {
|
|
23868
|
-
const reader = input instanceof
|
|
23266
|
+
const reader = input instanceof import_wire6.BinaryReader ? input : new import_wire6.BinaryReader(input);
|
|
23869
23267
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
23870
23268
|
const message = createBaseFreezeTokensPayload2();
|
|
23871
23269
|
while (reader.pos < end) {
|
|
@@ -23930,13 +23328,13 @@ var FreezeTokensPayload2 = {
|
|
|
23930
23328
|
},
|
|
23931
23329
|
fromJSON(object) {
|
|
23932
23330
|
return {
|
|
23933
|
-
version:
|
|
23934
|
-
ownerPublicKey:
|
|
23935
|
-
tokenPublicKey:
|
|
23936
|
-
tokenIdentifier:
|
|
23937
|
-
issuerProvidedTimestamp:
|
|
23938
|
-
operatorIdentityPublicKey:
|
|
23939
|
-
shouldUnfreeze:
|
|
23331
|
+
version: isSet5(object.version) ? globalThis.Number(object.version) : 0,
|
|
23332
|
+
ownerPublicKey: isSet5(object.ownerPublicKey) ? bytesFromBase644(object.ownerPublicKey) : new Uint8Array(0),
|
|
23333
|
+
tokenPublicKey: isSet5(object.tokenPublicKey) ? bytesFromBase644(object.tokenPublicKey) : void 0,
|
|
23334
|
+
tokenIdentifier: isSet5(object.tokenIdentifier) ? bytesFromBase644(object.tokenIdentifier) : void 0,
|
|
23335
|
+
issuerProvidedTimestamp: isSet5(object.issuerProvidedTimestamp) ? globalThis.Number(object.issuerProvidedTimestamp) : 0,
|
|
23336
|
+
operatorIdentityPublicKey: isSet5(object.operatorIdentityPublicKey) ? bytesFromBase644(object.operatorIdentityPublicKey) : new Uint8Array(0),
|
|
23337
|
+
shouldUnfreeze: isSet5(object.shouldUnfreeze) ? globalThis.Boolean(object.shouldUnfreeze) : false
|
|
23940
23338
|
};
|
|
23941
23339
|
},
|
|
23942
23340
|
toJSON(message) {
|
|
@@ -23945,19 +23343,19 @@ var FreezeTokensPayload2 = {
|
|
|
23945
23343
|
obj.version = Math.round(message.version);
|
|
23946
23344
|
}
|
|
23947
23345
|
if (message.ownerPublicKey.length !== 0) {
|
|
23948
|
-
obj.ownerPublicKey =
|
|
23346
|
+
obj.ownerPublicKey = base64FromBytes4(message.ownerPublicKey);
|
|
23949
23347
|
}
|
|
23950
23348
|
if (message.tokenPublicKey !== void 0) {
|
|
23951
|
-
obj.tokenPublicKey =
|
|
23349
|
+
obj.tokenPublicKey = base64FromBytes4(message.tokenPublicKey);
|
|
23952
23350
|
}
|
|
23953
23351
|
if (message.tokenIdentifier !== void 0) {
|
|
23954
|
-
obj.tokenIdentifier =
|
|
23352
|
+
obj.tokenIdentifier = base64FromBytes4(message.tokenIdentifier);
|
|
23955
23353
|
}
|
|
23956
23354
|
if (message.issuerProvidedTimestamp !== 0) {
|
|
23957
23355
|
obj.issuerProvidedTimestamp = Math.round(message.issuerProvidedTimestamp);
|
|
23958
23356
|
}
|
|
23959
23357
|
if (message.operatorIdentityPublicKey.length !== 0) {
|
|
23960
|
-
obj.operatorIdentityPublicKey =
|
|
23358
|
+
obj.operatorIdentityPublicKey = base64FromBytes4(message.operatorIdentityPublicKey);
|
|
23961
23359
|
}
|
|
23962
23360
|
if (message.shouldUnfreeze !== false) {
|
|
23963
23361
|
obj.shouldUnfreeze = message.shouldUnfreeze;
|
|
@@ -23983,7 +23381,7 @@ function createBaseFreezeTokensRequest2() {
|
|
|
23983
23381
|
return { freezeTokensPayload: void 0, issuerSignature: new Uint8Array(0) };
|
|
23984
23382
|
}
|
|
23985
23383
|
var FreezeTokensRequest2 = {
|
|
23986
|
-
encode(message, writer = new
|
|
23384
|
+
encode(message, writer = new import_wire6.BinaryWriter()) {
|
|
23987
23385
|
if (message.freezeTokensPayload !== void 0) {
|
|
23988
23386
|
FreezeTokensPayload2.encode(message.freezeTokensPayload, writer.uint32(10).fork()).join();
|
|
23989
23387
|
}
|
|
@@ -23993,7 +23391,7 @@ var FreezeTokensRequest2 = {
|
|
|
23993
23391
|
return writer;
|
|
23994
23392
|
},
|
|
23995
23393
|
decode(input, length) {
|
|
23996
|
-
const reader = input instanceof
|
|
23394
|
+
const reader = input instanceof import_wire6.BinaryReader ? input : new import_wire6.BinaryReader(input);
|
|
23997
23395
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
23998
23396
|
const message = createBaseFreezeTokensRequest2();
|
|
23999
23397
|
while (reader.pos < end) {
|
|
@@ -24023,8 +23421,8 @@ var FreezeTokensRequest2 = {
|
|
|
24023
23421
|
},
|
|
24024
23422
|
fromJSON(object) {
|
|
24025
23423
|
return {
|
|
24026
|
-
freezeTokensPayload:
|
|
24027
|
-
issuerSignature:
|
|
23424
|
+
freezeTokensPayload: isSet5(object.freezeTokensPayload) ? FreezeTokensPayload2.fromJSON(object.freezeTokensPayload) : void 0,
|
|
23425
|
+
issuerSignature: isSet5(object.issuerSignature) ? bytesFromBase644(object.issuerSignature) : new Uint8Array(0)
|
|
24028
23426
|
};
|
|
24029
23427
|
},
|
|
24030
23428
|
toJSON(message) {
|
|
@@ -24033,7 +23431,7 @@ var FreezeTokensRequest2 = {
|
|
|
24033
23431
|
obj.freezeTokensPayload = FreezeTokensPayload2.toJSON(message.freezeTokensPayload);
|
|
24034
23432
|
}
|
|
24035
23433
|
if (message.issuerSignature.length !== 0) {
|
|
24036
|
-
obj.issuerSignature =
|
|
23434
|
+
obj.issuerSignature = base64FromBytes4(message.issuerSignature);
|
|
24037
23435
|
}
|
|
24038
23436
|
return obj;
|
|
24039
23437
|
},
|
|
@@ -24051,7 +23449,7 @@ function createBaseFreezeTokensResponse2() {
|
|
|
24051
23449
|
return { impactedOutputIds: [], impactedTokenAmount: new Uint8Array(0) };
|
|
24052
23450
|
}
|
|
24053
23451
|
var FreezeTokensResponse2 = {
|
|
24054
|
-
encode(message, writer = new
|
|
23452
|
+
encode(message, writer = new import_wire6.BinaryWriter()) {
|
|
24055
23453
|
for (const v of message.impactedOutputIds) {
|
|
24056
23454
|
writer.uint32(10).string(v);
|
|
24057
23455
|
}
|
|
@@ -24061,7 +23459,7 @@ var FreezeTokensResponse2 = {
|
|
|
24061
23459
|
return writer;
|
|
24062
23460
|
},
|
|
24063
23461
|
decode(input, length) {
|
|
24064
|
-
const reader = input instanceof
|
|
23462
|
+
const reader = input instanceof import_wire6.BinaryReader ? input : new import_wire6.BinaryReader(input);
|
|
24065
23463
|
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
24066
23464
|
const message = createBaseFreezeTokensResponse2();
|
|
24067
23465
|
while (reader.pos < end) {
|
|
@@ -24092,7 +23490,7 @@ var FreezeTokensResponse2 = {
|
|
|
24092
23490
|
fromJSON(object) {
|
|
24093
23491
|
return {
|
|
24094
23492
|
impactedOutputIds: globalThis.Array.isArray(object?.impactedOutputIds) ? object.impactedOutputIds.map((e) => globalThis.String(e)) : [],
|
|
24095
|
-
impactedTokenAmount:
|
|
23493
|
+
impactedTokenAmount: isSet5(object.impactedTokenAmount) ? bytesFromBase644(object.impactedTokenAmount) : new Uint8Array(0)
|
|
24096
23494
|
};
|
|
24097
23495
|
},
|
|
24098
23496
|
toJSON(message) {
|
|
@@ -24101,7 +23499,7 @@ var FreezeTokensResponse2 = {
|
|
|
24101
23499
|
obj.impactedOutputIds = message.impactedOutputIds;
|
|
24102
23500
|
}
|
|
24103
23501
|
if (message.impactedTokenAmount.length !== 0) {
|
|
24104
|
-
obj.impactedTokenAmount =
|
|
23502
|
+
obj.impactedTokenAmount = base64FromBytes4(message.impactedTokenAmount);
|
|
24105
23503
|
}
|
|
24106
23504
|
return obj;
|
|
24107
23505
|
},
|
|
@@ -24177,7 +23575,7 @@ var SparkTokenServiceDefinition = {
|
|
|
24177
23575
|
}
|
|
24178
23576
|
}
|
|
24179
23577
|
};
|
|
24180
|
-
function
|
|
23578
|
+
function bytesFromBase644(b64) {
|
|
24181
23579
|
if (globalThis.Buffer) {
|
|
24182
23580
|
return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));
|
|
24183
23581
|
} else {
|
|
@@ -24189,7 +23587,7 @@ function bytesFromBase645(b64) {
|
|
|
24189
23587
|
return arr;
|
|
24190
23588
|
}
|
|
24191
23589
|
}
|
|
24192
|
-
function
|
|
23590
|
+
function base64FromBytes4(arr) {
|
|
24193
23591
|
if (globalThis.Buffer) {
|
|
24194
23592
|
return globalThis.Buffer.from(arr).toString("base64");
|
|
24195
23593
|
} else {
|
|
@@ -24229,11 +23627,11 @@ function longToNumber4(int64) {
|
|
|
24229
23627
|
}
|
|
24230
23628
|
return num;
|
|
24231
23629
|
}
|
|
24232
|
-
function
|
|
23630
|
+
function isSet5(value) {
|
|
24233
23631
|
return value !== null && value !== void 0;
|
|
24234
23632
|
}
|
|
24235
23633
|
|
|
24236
|
-
// src/services/connection.ts
|
|
23634
|
+
// src/services/connection/connection.ts
|
|
24237
23635
|
var ConnectionManager = class {
|
|
24238
23636
|
config;
|
|
24239
23637
|
clients = /* @__PURE__ */ new Map();
|
|
@@ -24263,127 +23661,70 @@ var ConnectionManager = class {
|
|
|
24263
23661
|
);
|
|
24264
23662
|
this.clients.clear();
|
|
24265
23663
|
}
|
|
24266
|
-
|
|
24267
|
-
|
|
24268
|
-
|
|
24269
|
-
|
|
24270
|
-
|
|
24271
|
-
|
|
24272
|
-
|
|
24273
|
-
|
|
24274
|
-
|
|
24275
|
-
|
|
24276
|
-
|
|
24277
|
-
|
|
24278
|
-
|
|
24279
|
-
|
|
24280
|
-
|
|
24281
|
-
|
|
24282
|
-
}
|
|
24283
|
-
}
|
|
24284
|
-
async createChannelWithTLS(address2, certPath) {
|
|
24285
|
-
try {
|
|
24286
|
-
if (import_core12.isNode && !isBun) {
|
|
24287
|
-
const grpcModule = await import("nice-grpc");
|
|
24288
|
-
const { ChannelCredentials, createChannel } = "default" in grpcModule ? grpcModule.default : grpcModule;
|
|
24289
|
-
if (certPath) {
|
|
24290
|
-
try {
|
|
24291
|
-
const fs = await import("fs");
|
|
24292
|
-
const cert = fs.readFileSync(certPath);
|
|
24293
|
-
return createChannel(address2, ChannelCredentials.createSsl(cert));
|
|
24294
|
-
} catch (error) {
|
|
24295
|
-
console.error("Error reading certificate:", error);
|
|
24296
|
-
return createChannel(
|
|
24297
|
-
address2,
|
|
24298
|
-
ChannelCredentials.createSsl(null, null, null, {
|
|
24299
|
-
rejectUnauthorized: false
|
|
24300
|
-
})
|
|
24301
|
-
);
|
|
24302
|
-
}
|
|
24303
|
-
} else {
|
|
24304
|
-
return createChannel(
|
|
24305
|
-
address2,
|
|
24306
|
-
ChannelCredentials.createSsl(null, null, null, {
|
|
24307
|
-
rejectUnauthorized: false
|
|
24308
|
-
})
|
|
24309
|
-
);
|
|
24310
|
-
}
|
|
24311
|
-
} else {
|
|
24312
|
-
const grpcModule = await import("nice-grpc-web");
|
|
24313
|
-
const { createChannel, FetchTransport } = "default" in grpcModule ? grpcModule.default : grpcModule;
|
|
24314
|
-
const { XHRTransport: XHRTransport2 } = await Promise.resolve().then(() => (init_xhr_transport(), xhr_transport_exports));
|
|
24315
|
-
return createChannel(
|
|
24316
|
-
address2,
|
|
24317
|
-
import_core12.isBare ? (0, import_nice_grpc_web.NodeHttpTransport)() : isReactNative ? XHRTransport2() : FetchTransport()
|
|
24318
|
-
);
|
|
24319
|
-
}
|
|
24320
|
-
} catch (error) {
|
|
24321
|
-
console.error("Channel creation error:", error);
|
|
24322
|
-
throw new NetworkError(
|
|
24323
|
-
"Failed to create channel",
|
|
24324
|
-
{
|
|
24325
|
-
url: address2,
|
|
24326
|
-
operation: "createChannel",
|
|
24327
|
-
errorCount: 1,
|
|
24328
|
-
errors: error instanceof Error ? error.message : String(error)
|
|
24329
|
-
},
|
|
24330
|
-
error
|
|
24331
|
-
);
|
|
24332
|
-
}
|
|
24333
|
-
}
|
|
24334
|
-
async createSparkStreamClient(address2, certPath) {
|
|
24335
|
-
if (this.streamClients.has(address2)) {
|
|
24336
|
-
return this.streamClients.get(address2).client;
|
|
23664
|
+
createChannelWithTLS(address, certPath) {
|
|
23665
|
+
throw new Error("createChannelWithTLS: Not implemented");
|
|
23666
|
+
}
|
|
23667
|
+
async createSparkStreamClient(address, certPath) {
|
|
23668
|
+
if (this.streamClients.has(address)) {
|
|
23669
|
+
return this.streamClients.get(address).client;
|
|
23670
|
+
}
|
|
23671
|
+
const authToken = await this.authenticate(address);
|
|
23672
|
+
const channel = await this.createChannelWithTLS(address, certPath);
|
|
23673
|
+
if (!channel) {
|
|
23674
|
+
throw new NetworkError("Failed to create channel", {
|
|
23675
|
+
url: address,
|
|
23676
|
+
operation: "createChannel",
|
|
23677
|
+
errorCount: 1,
|
|
23678
|
+
errors: "Channel is undefined"
|
|
23679
|
+
});
|
|
24337
23680
|
}
|
|
24338
|
-
const
|
|
24339
|
-
const channel = await this.createChannelWithTLS(address2, certPath);
|
|
24340
|
-
const middleware = this.createMiddleware(address2, authToken);
|
|
23681
|
+
const middleware = this.createMiddleware(address, authToken);
|
|
24341
23682
|
const client = await this.createGrpcClient(
|
|
24342
23683
|
SparkServiceDefinition,
|
|
24343
23684
|
channel,
|
|
24344
23685
|
true,
|
|
24345
23686
|
middleware
|
|
24346
23687
|
);
|
|
24347
|
-
this.streamClients.set(
|
|
23688
|
+
this.streamClients.set(address, { client, authToken, channel });
|
|
24348
23689
|
return client;
|
|
24349
23690
|
}
|
|
24350
|
-
async createSparkClient(
|
|
24351
|
-
if (this.clients.has(
|
|
24352
|
-
return this.clients.get(
|
|
23691
|
+
async createSparkClient(address, certPath) {
|
|
23692
|
+
if (this.clients.has(address)) {
|
|
23693
|
+
return this.clients.get(address).client;
|
|
24353
23694
|
}
|
|
24354
|
-
const authToken = await this.authenticate(
|
|
24355
|
-
const channel = await this.createChannelWithTLS(
|
|
24356
|
-
const middleware = this.createMiddleware(
|
|
23695
|
+
const authToken = await this.authenticate(address);
|
|
23696
|
+
const channel = await this.createChannelWithTLS(address, certPath);
|
|
23697
|
+
const middleware = this.createMiddleware(address, authToken);
|
|
24357
23698
|
const client = await this.createGrpcClient(
|
|
24358
23699
|
SparkServiceDefinition,
|
|
24359
23700
|
channel,
|
|
24360
23701
|
true,
|
|
24361
23702
|
middleware
|
|
24362
23703
|
);
|
|
24363
|
-
this.clients.set(
|
|
23704
|
+
this.clients.set(address, { client, authToken });
|
|
24364
23705
|
return client;
|
|
24365
23706
|
}
|
|
24366
|
-
async createSparkTokenClient(
|
|
24367
|
-
if (this.tokenClients.has(
|
|
24368
|
-
return this.tokenClients.get(
|
|
23707
|
+
async createSparkTokenClient(address, certPath) {
|
|
23708
|
+
if (this.tokenClients.has(address)) {
|
|
23709
|
+
return this.tokenClients.get(address).client;
|
|
24369
23710
|
}
|
|
24370
|
-
const authToken = await this.authenticate(
|
|
24371
|
-
const channel = await this.createChannelWithTLS(
|
|
24372
|
-
const middleware = this.createMiddleware(
|
|
23711
|
+
const authToken = await this.authenticate(address);
|
|
23712
|
+
const channel = await this.createChannelWithTLS(address, certPath);
|
|
23713
|
+
const middleware = this.createMiddleware(address, authToken);
|
|
24373
23714
|
const tokenClient = await this.createGrpcClient(
|
|
24374
23715
|
SparkTokenServiceDefinition,
|
|
24375
23716
|
channel,
|
|
24376
23717
|
true,
|
|
24377
23718
|
middleware
|
|
24378
23719
|
);
|
|
24379
|
-
this.tokenClients.set(
|
|
23720
|
+
this.tokenClients.set(address, { client: tokenClient, authToken });
|
|
24380
23721
|
return tokenClient;
|
|
24381
23722
|
}
|
|
24382
|
-
async getStreamChannel(
|
|
24383
|
-
return this.streamClients.get(
|
|
23723
|
+
async getStreamChannel(address) {
|
|
23724
|
+
return this.streamClients.get(address)?.channel;
|
|
24384
23725
|
}
|
|
24385
|
-
async authenticate(
|
|
24386
|
-
const existing = this.authPromises.get(
|
|
23726
|
+
async authenticate(address, certPath) {
|
|
23727
|
+
const existing = this.authPromises.get(address);
|
|
24387
23728
|
if (existing) {
|
|
24388
23729
|
return existing;
|
|
24389
23730
|
}
|
|
@@ -24395,7 +23736,7 @@ var ConnectionManager = class {
|
|
|
24395
23736
|
try {
|
|
24396
23737
|
const identityPublicKey = await this.config.signer.getIdentityPublicKey();
|
|
24397
23738
|
sparkAuthnClient = await this.createSparkAuthnGrpcConnection(
|
|
24398
|
-
|
|
23739
|
+
address,
|
|
24399
23740
|
certPath
|
|
24400
23741
|
);
|
|
24401
23742
|
const challengeResp = await sparkAuthnClient.get_challenge({
|
|
@@ -24453,15 +23794,15 @@ var ConnectionManager = class {
|
|
|
24453
23794
|
lastError
|
|
24454
23795
|
);
|
|
24455
23796
|
})();
|
|
24456
|
-
this.authPromises.set(
|
|
23797
|
+
this.authPromises.set(address, authPromise);
|
|
24457
23798
|
try {
|
|
24458
23799
|
return await authPromise;
|
|
24459
23800
|
} finally {
|
|
24460
|
-
this.authPromises.delete(
|
|
23801
|
+
this.authPromises.delete(address);
|
|
24461
23802
|
}
|
|
24462
23803
|
}
|
|
24463
|
-
async createSparkAuthnGrpcConnection(
|
|
24464
|
-
const channel = await this.createChannelWithTLS(
|
|
23804
|
+
async createSparkAuthnGrpcConnection(address, certPath) {
|
|
23805
|
+
const channel = await this.createChannelWithTLS(address, certPath);
|
|
24465
23806
|
const authnMiddleware = this.createAuthnMiddleware();
|
|
24466
23807
|
return this.createGrpcClient(
|
|
24467
23808
|
SparkAuthnServiceDefinition,
|
|
@@ -24471,41 +23812,20 @@ var ConnectionManager = class {
|
|
|
24471
23812
|
);
|
|
24472
23813
|
}
|
|
24473
23814
|
createAuthnMiddleware() {
|
|
24474
|
-
|
|
24475
|
-
return
|
|
24476
|
-
|
|
24477
|
-
"X-Client-Env",
|
|
24478
|
-
clientEnv
|
|
24479
|
-
);
|
|
24480
|
-
return yield* call.next(call.request, {
|
|
24481
|
-
...options,
|
|
24482
|
-
metadata
|
|
24483
|
-
});
|
|
24484
|
-
}.bind(this);
|
|
24485
|
-
} else {
|
|
24486
|
-
return async function* (call, options) {
|
|
24487
|
-
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");
|
|
24488
|
-
return yield* call.next(call.request, {
|
|
24489
|
-
...options,
|
|
24490
|
-
metadata
|
|
24491
|
-
});
|
|
24492
|
-
}.bind(this);
|
|
24493
|
-
}
|
|
23815
|
+
return async function* (call, options) {
|
|
23816
|
+
return yield* call.next(call.request, options);
|
|
23817
|
+
}.bind(this);
|
|
24494
23818
|
}
|
|
24495
|
-
createMiddleware(
|
|
24496
|
-
|
|
24497
|
-
return this.createNodeMiddleware(address2, authToken);
|
|
24498
|
-
} else {
|
|
24499
|
-
return this.createBrowserMiddleware(address2, authToken);
|
|
24500
|
-
}
|
|
23819
|
+
createMiddleware(address, authToken) {
|
|
23820
|
+
return void 0;
|
|
24501
23821
|
}
|
|
24502
|
-
async *handleMiddlewareError(error,
|
|
23822
|
+
async *handleMiddlewareError(error, address, call, metadata, options) {
|
|
24503
23823
|
if ((0, import_core12.isError)(error)) {
|
|
24504
23824
|
if (error.message.includes("token has expired")) {
|
|
24505
|
-
const newAuthToken = await this.authenticate(
|
|
24506
|
-
const clientData = this.clients.get(
|
|
23825
|
+
const newAuthToken = await this.authenticate(address);
|
|
23826
|
+
const clientData = this.clients.get(address);
|
|
24507
23827
|
if (!clientData) {
|
|
24508
|
-
throw new Error(`No client found for address: ${
|
|
23828
|
+
throw new Error(`No client found for address: ${address}`);
|
|
24509
23829
|
}
|
|
24510
23830
|
clientData.authToken = newAuthToken;
|
|
24511
23831
|
return yield* call.next(call.request, {
|
|
@@ -24516,101 +23836,8 @@ var ConnectionManager = class {
|
|
|
24516
23836
|
}
|
|
24517
23837
|
throw error;
|
|
24518
23838
|
}
|
|
24519
|
-
createNodeMiddleware(address2, initialAuthToken) {
|
|
24520
|
-
return async function* (call, options) {
|
|
24521
|
-
const metadata = (0, import_nice_grpc_common2.Metadata)(options.metadata).set(
|
|
24522
|
-
"X-Client-Env",
|
|
24523
|
-
clientEnv
|
|
24524
|
-
);
|
|
24525
|
-
try {
|
|
24526
|
-
return yield* call.next(call.request, {
|
|
24527
|
-
...options,
|
|
24528
|
-
metadata: metadata.set(
|
|
24529
|
-
"Authorization",
|
|
24530
|
-
`Bearer ${this.clients.get(address2)?.authToken || initialAuthToken}`
|
|
24531
|
-
)
|
|
24532
|
-
});
|
|
24533
|
-
} catch (error) {
|
|
24534
|
-
return yield* this.handleMiddlewareError(
|
|
24535
|
-
error,
|
|
24536
|
-
address2,
|
|
24537
|
-
call,
|
|
24538
|
-
metadata,
|
|
24539
|
-
options
|
|
24540
|
-
);
|
|
24541
|
-
}
|
|
24542
|
-
}.bind(this);
|
|
24543
|
-
}
|
|
24544
|
-
createBrowserMiddleware(address2, initialAuthToken) {
|
|
24545
|
-
return async function* (call, options) {
|
|
24546
|
-
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");
|
|
24547
|
-
try {
|
|
24548
|
-
return yield* call.next(call.request, {
|
|
24549
|
-
...options,
|
|
24550
|
-
metadata: metadata.set(
|
|
24551
|
-
"Authorization",
|
|
24552
|
-
`Bearer ${this.clients.get(address2)?.authToken || initialAuthToken}`
|
|
24553
|
-
)
|
|
24554
|
-
});
|
|
24555
|
-
} catch (error) {
|
|
24556
|
-
return yield* this.handleMiddlewareError(
|
|
24557
|
-
error,
|
|
24558
|
-
address2,
|
|
24559
|
-
call,
|
|
24560
|
-
metadata,
|
|
24561
|
-
options
|
|
24562
|
-
);
|
|
24563
|
-
}
|
|
24564
|
-
}.bind(this);
|
|
24565
|
-
}
|
|
24566
23839
|
async createGrpcClient(defintion, channel, withRetries, middleware) {
|
|
24567
|
-
|
|
24568
|
-
const retryOptions = {
|
|
24569
|
-
retry: true,
|
|
24570
|
-
retryMaxAttempts: 3
|
|
24571
|
-
};
|
|
24572
|
-
let options = {};
|
|
24573
|
-
const isNodeChannel = "close" in channel;
|
|
24574
|
-
if (import_core12.isNode && isNodeChannel && !isBun) {
|
|
24575
|
-
const grpcModule = await import("nice-grpc");
|
|
24576
|
-
const { openTelemetryClientMiddleware } = await import("nice-grpc-opentelemetry");
|
|
24577
|
-
const { createClientFactory } = "default" in grpcModule ? grpcModule.default : grpcModule;
|
|
24578
|
-
clientFactory = createClientFactory();
|
|
24579
|
-
if (withRetries) {
|
|
24580
|
-
options = retryOptions;
|
|
24581
|
-
clientFactory = clientFactory.use(openTelemetryClientMiddleware()).use(import_nice_grpc_client_middleware_retry.retryMiddleware);
|
|
24582
|
-
}
|
|
24583
|
-
if (middleware) {
|
|
24584
|
-
clientFactory = clientFactory.use(middleware);
|
|
24585
|
-
}
|
|
24586
|
-
const client = clientFactory.create(defintion, channel, {
|
|
24587
|
-
"*": options
|
|
24588
|
-
});
|
|
24589
|
-
return {
|
|
24590
|
-
...client,
|
|
24591
|
-
close: channel.close.bind(channel)
|
|
24592
|
-
};
|
|
24593
|
-
} else if (!isNodeChannel) {
|
|
24594
|
-
const grpcModule = await import("nice-grpc-web");
|
|
24595
|
-
const { createClientFactory } = "default" in grpcModule ? grpcModule.default : grpcModule;
|
|
24596
|
-
clientFactory = createClientFactory();
|
|
24597
|
-
if (withRetries) {
|
|
24598
|
-
options = retryOptions;
|
|
24599
|
-
clientFactory = clientFactory.use(import_nice_grpc_client_middleware_retry.retryMiddleware);
|
|
24600
|
-
}
|
|
24601
|
-
if (middleware) {
|
|
24602
|
-
clientFactory = clientFactory.use(middleware);
|
|
24603
|
-
}
|
|
24604
|
-
const client = clientFactory.create(defintion, channel, {
|
|
24605
|
-
"*": options
|
|
24606
|
-
});
|
|
24607
|
-
return {
|
|
24608
|
-
...client,
|
|
24609
|
-
close: void 0
|
|
24610
|
-
};
|
|
24611
|
-
} else {
|
|
24612
|
-
throw new Error("Channel does not have close in NodeJS environment");
|
|
24613
|
-
}
|
|
23840
|
+
throw new Error("createGrpcClient: Not implemented");
|
|
24614
23841
|
}
|
|
24615
23842
|
};
|
|
24616
23843
|
|
|
@@ -24670,18 +23897,18 @@ function getP2TRAddressFromPublicKey(pubKey, network) {
|
|
|
24670
23897
|
});
|
|
24671
23898
|
}
|
|
24672
23899
|
const internalKey = import_secp256k16.secp256k1.Point.fromHex(pubKey);
|
|
24673
|
-
const
|
|
23900
|
+
const address = btc2.p2tr(
|
|
24674
23901
|
internalKey.toBytes().slice(1, 33),
|
|
24675
23902
|
void 0,
|
|
24676
23903
|
getNetwork(network)
|
|
24677
23904
|
).address;
|
|
24678
|
-
if (!
|
|
23905
|
+
if (!address) {
|
|
24679
23906
|
throw new ValidationError("Failed to get P2TR address", {
|
|
24680
23907
|
field: "address",
|
|
24681
23908
|
value: "null"
|
|
24682
23909
|
});
|
|
24683
23910
|
}
|
|
24684
|
-
return
|
|
23911
|
+
return address;
|
|
24685
23912
|
}
|
|
24686
23913
|
function getP2TRAddressFromPkScript(pkScript, network) {
|
|
24687
23914
|
if (pkScript.length !== 34 || pkScript[0] !== 81 || pkScript[1] !== 32) {
|
|
@@ -24702,14 +23929,14 @@ function getP2WPKHAddressFromPublicKey(pubKey, network) {
|
|
|
24702
23929
|
expected: 33
|
|
24703
23930
|
});
|
|
24704
23931
|
}
|
|
24705
|
-
const
|
|
24706
|
-
if (!
|
|
23932
|
+
const address = btc2.p2wpkh(pubKey, getNetwork(network)).address;
|
|
23933
|
+
if (!address) {
|
|
24707
23934
|
throw new ValidationError("Failed to get P2WPKH address", {
|
|
24708
23935
|
field: "address",
|
|
24709
23936
|
value: "null"
|
|
24710
23937
|
});
|
|
24711
23938
|
}
|
|
24712
|
-
return
|
|
23939
|
+
return address;
|
|
24713
23940
|
}
|
|
24714
23941
|
function getTxFromRawTxHex(rawTxHex) {
|
|
24715
23942
|
const txBytes = (0, import_utils7.hexToBytes)(rawTxHex);
|
|
@@ -26808,8 +26035,8 @@ var CoopExitService = class extends BaseTransferService {
|
|
|
26808
26035
|
leavesToSend: signingJobs,
|
|
26809
26036
|
ownerIdentityPublicKey: await this.config.signer.getIdentityPublicKey(),
|
|
26810
26037
|
receiverIdentityPublicKey: receiverPubKey,
|
|
26811
|
-
expiryTime: this.config.getNetwork() == 0 /* MAINNET */ ? new Date(Date.now() +
|
|
26812
|
-
//
|
|
26038
|
+
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)
|
|
26039
|
+
// 1 week 5 min for mainnet, 35 min otherwise
|
|
26813
26040
|
},
|
|
26814
26041
|
exitId: (0, import_uuidv72.uuidv7)(),
|
|
26815
26042
|
exitTxid: exitTxId
|
|
@@ -26889,24 +26116,24 @@ var DepositService = class {
|
|
|
26889
26116
|
this.connectionManager = connectionManager;
|
|
26890
26117
|
}
|
|
26891
26118
|
async validateDepositAddress({
|
|
26892
|
-
address
|
|
26119
|
+
address,
|
|
26893
26120
|
userPubkey,
|
|
26894
26121
|
verifyCoordinatorProof = false
|
|
26895
26122
|
}) {
|
|
26896
|
-
if (!
|
|
26123
|
+
if (!address.depositAddressProof || !address.depositAddressProof.proofOfPossessionSignature || !address.depositAddressProof.addressSignatures) {
|
|
26897
26124
|
throw new ValidationError(
|
|
26898
26125
|
"Proof of possession signature or address signatures is null",
|
|
26899
26126
|
{
|
|
26900
26127
|
field: "depositAddressProof",
|
|
26901
|
-
value:
|
|
26128
|
+
value: address.depositAddressProof
|
|
26902
26129
|
}
|
|
26903
26130
|
);
|
|
26904
26131
|
}
|
|
26905
|
-
const operatorPubkey = subtractPublicKeys(
|
|
26132
|
+
const operatorPubkey = subtractPublicKeys(address.verifyingKey, userPubkey);
|
|
26906
26133
|
const msg = proofOfPossessionMessageHashForDepositAddress(
|
|
26907
26134
|
await this.config.signer.getIdentityPublicKey(),
|
|
26908
26135
|
operatorPubkey,
|
|
26909
|
-
|
|
26136
|
+
address.address
|
|
26910
26137
|
);
|
|
26911
26138
|
const taprootKey = (0, import_btc_signer4.p2tr)(
|
|
26912
26139
|
operatorPubkey.slice(1, 33),
|
|
@@ -26914,7 +26141,7 @@ var DepositService = class {
|
|
|
26914
26141
|
getNetwork(this.config.getNetwork())
|
|
26915
26142
|
).tweakedPubkey;
|
|
26916
26143
|
const isVerified = import_secp256k18.schnorr.verify(
|
|
26917
|
-
|
|
26144
|
+
address.depositAddressProof.proofOfPossessionSignature,
|
|
26918
26145
|
msg,
|
|
26919
26146
|
taprootKey
|
|
26920
26147
|
);
|
|
@@ -26923,17 +26150,17 @@ var DepositService = class {
|
|
|
26923
26150
|
"Proof of possession signature verification failed",
|
|
26924
26151
|
{
|
|
26925
26152
|
field: "proofOfPossessionSignature",
|
|
26926
|
-
value:
|
|
26153
|
+
value: address.depositAddressProof.proofOfPossessionSignature
|
|
26927
26154
|
}
|
|
26928
26155
|
);
|
|
26929
26156
|
}
|
|
26930
|
-
const addrHash = (0, import_sha28.sha256)(
|
|
26157
|
+
const addrHash = (0, import_sha28.sha256)(address.address);
|
|
26931
26158
|
for (const operator of Object.values(this.config.getSigningOperators())) {
|
|
26932
26159
|
if (operator.identifier === this.config.getCoordinatorIdentifier() && !verifyCoordinatorProof) {
|
|
26933
26160
|
continue;
|
|
26934
26161
|
}
|
|
26935
26162
|
const operatorPubkey2 = (0, import_utils10.hexToBytes)(operator.identityPublicKey);
|
|
26936
|
-
const operatorSig =
|
|
26163
|
+
const operatorSig = address.depositAddressProof.addressSignatures[operator.identifier];
|
|
26937
26164
|
if (!operatorSig) {
|
|
26938
26165
|
throw new ValidationError("Operator signature not found", {
|
|
26939
26166
|
field: "addressSignatures",
|
|
@@ -27888,11 +27115,11 @@ var import_utils17 = require("@noble/hashes/utils");
|
|
|
27888
27115
|
|
|
27889
27116
|
// src/utils/address.ts
|
|
27890
27117
|
init_buffer();
|
|
27891
|
-
var
|
|
27118
|
+
var import_wire7 = require("@bufbuild/protobuf/wire");
|
|
27892
27119
|
var import_secp256k110 = require("@noble/curves/secp256k1");
|
|
27893
27120
|
var import_utils13 = require("@noble/curves/utils");
|
|
27894
27121
|
var import_utils14 = require("@noble/hashes/utils");
|
|
27895
|
-
var
|
|
27122
|
+
var import_base3 = require("@scure/base");
|
|
27896
27123
|
var import_uuidv74 = require("uuidv7");
|
|
27897
27124
|
|
|
27898
27125
|
// src/utils/invoice-hashing.ts
|
|
@@ -28090,7 +27317,7 @@ function encodeSparkAddressWithSignature(payload, signature) {
|
|
|
28090
27317
|
validateSparkInvoiceFields(payload.sparkInvoiceFields);
|
|
28091
27318
|
sparkInvoiceFields = payload.sparkInvoiceFields;
|
|
28092
27319
|
}
|
|
28093
|
-
const w = new
|
|
27320
|
+
const w = new import_wire7.BinaryWriter();
|
|
28094
27321
|
w.uint32(10).bytes(identityPublicKey);
|
|
28095
27322
|
if (sparkInvoiceFields) {
|
|
28096
27323
|
const inner = encodeSparkInvoiceFieldsV1Canonical(sparkInvoiceFields);
|
|
@@ -28100,7 +27327,7 @@ function encodeSparkAddressWithSignature(payload, signature) {
|
|
|
28100
27327
|
w.uint32(26).bytes(signature);
|
|
28101
27328
|
}
|
|
28102
27329
|
const serializedPayload = w.finish();
|
|
28103
|
-
const words =
|
|
27330
|
+
const words = import_base3.bech32m.toWords(serializedPayload);
|
|
28104
27331
|
return bech32mEncode(
|
|
28105
27332
|
LegacyAddressNetwork[payload.network],
|
|
28106
27333
|
words
|
|
@@ -28116,17 +27343,17 @@ function encodeSparkAddressWithSignature(payload, signature) {
|
|
|
28116
27343
|
);
|
|
28117
27344
|
}
|
|
28118
27345
|
}
|
|
28119
|
-
function decodeSparkAddress(
|
|
27346
|
+
function decodeSparkAddress(address, network) {
|
|
28120
27347
|
try {
|
|
28121
|
-
if (network !== getNetworkFromSparkAddress(
|
|
27348
|
+
if (network !== getNetworkFromSparkAddress(address)) {
|
|
28122
27349
|
throw new ValidationError("Invalid Spark address prefix", {
|
|
28123
27350
|
field: "address",
|
|
28124
|
-
value:
|
|
27351
|
+
value: address,
|
|
28125
27352
|
expected: `prefix='${AddressNetwork[network]}' or '${LegacyAddressNetwork[network]}'`
|
|
28126
27353
|
});
|
|
28127
27354
|
}
|
|
28128
|
-
const decoded = bech32mDecode(
|
|
28129
|
-
const payload = SparkAddress.decode(
|
|
27355
|
+
const decoded = bech32mDecode(address);
|
|
27356
|
+
const payload = SparkAddress.decode(import_base3.bech32m.fromWords(decoded.words));
|
|
28130
27357
|
const { identityPublicKey, sparkInvoiceFields, signature } = payload;
|
|
28131
27358
|
const identityPubkeyHex = (0, import_utils14.bytesToHex)(identityPublicKey);
|
|
28132
27359
|
const signatureHex = signature ? (0, import_utils14.bytesToHex)(signature) : void 0;
|
|
@@ -28163,7 +27390,7 @@ function decodeSparkAddress(address2, network) {
|
|
|
28163
27390
|
"Failed to decode Spark address",
|
|
28164
27391
|
{
|
|
28165
27392
|
field: "address",
|
|
28166
|
-
value:
|
|
27393
|
+
value: address
|
|
28167
27394
|
},
|
|
28168
27395
|
error
|
|
28169
27396
|
);
|
|
@@ -28175,30 +27402,30 @@ var PrefixToNetwork = Object.fromEntries(
|
|
|
28175
27402
|
var LegacyPrefixToNetwork = Object.fromEntries(
|
|
28176
27403
|
Object.entries(LegacyAddressNetwork).map(([k, v]) => [v, k])
|
|
28177
27404
|
);
|
|
28178
|
-
function getNetworkFromSparkAddress(
|
|
28179
|
-
const { prefix } = bech32mDecode(
|
|
27405
|
+
function getNetworkFromSparkAddress(address) {
|
|
27406
|
+
const { prefix } = bech32mDecode(address);
|
|
28180
27407
|
const network = PrefixToNetwork[prefix] ?? LegacyPrefixToNetwork[prefix];
|
|
28181
27408
|
if (!network) {
|
|
28182
27409
|
throw new ValidationError("Invalid Spark address prefix", {
|
|
28183
27410
|
field: "network",
|
|
28184
|
-
value:
|
|
27411
|
+
value: address,
|
|
28185
27412
|
expected: "prefix='spark1', 'sparkt1', 'sparkrt1', 'sparks1', 'sparkl1' or legacy ('sp1', 'spt1', 'sprt1', 'sps1', 'spl1')"
|
|
28186
27413
|
});
|
|
28187
27414
|
}
|
|
28188
27415
|
return network;
|
|
28189
27416
|
}
|
|
28190
|
-
function isLegacySparkAddress(
|
|
27417
|
+
function isLegacySparkAddress(address) {
|
|
28191
27418
|
try {
|
|
28192
|
-
const { prefix } = bech32mDecode(
|
|
27419
|
+
const { prefix } = bech32mDecode(address);
|
|
28193
27420
|
return prefix in LegacyPrefixToNetwork;
|
|
28194
27421
|
} catch (error) {
|
|
28195
27422
|
return false;
|
|
28196
27423
|
}
|
|
28197
27424
|
}
|
|
28198
|
-
function isValidSparkAddress(
|
|
27425
|
+
function isValidSparkAddress(address) {
|
|
28199
27426
|
try {
|
|
28200
|
-
const network = getNetworkFromSparkAddress(
|
|
28201
|
-
decodeSparkAddress(
|
|
27427
|
+
const network = getNetworkFromSparkAddress(address);
|
|
27428
|
+
decodeSparkAddress(address, network);
|
|
28202
27429
|
return true;
|
|
28203
27430
|
} catch (error) {
|
|
28204
27431
|
if (error instanceof ValidationError) {
|
|
@@ -28208,7 +27435,7 @@ function isValidSparkAddress(address2) {
|
|
|
28208
27435
|
"Invalid Spark address",
|
|
28209
27436
|
{
|
|
28210
27437
|
field: "address",
|
|
28211
|
-
value:
|
|
27438
|
+
value: address
|
|
28212
27439
|
},
|
|
28213
27440
|
error
|
|
28214
27441
|
);
|
|
@@ -28344,7 +27571,7 @@ function validateSparkInvoiceSignature(invoice) {
|
|
|
28344
27571
|
try {
|
|
28345
27572
|
const decoded = bech32mDecode(invoice);
|
|
28346
27573
|
const network = getNetworkFromSparkAddress(invoice);
|
|
28347
|
-
const payload = SparkAddress.decode(
|
|
27574
|
+
const payload = SparkAddress.decode(import_base3.bech32m.fromWords(decoded.words));
|
|
28348
27575
|
const { identityPublicKey, sparkInvoiceFields, signature } = payload;
|
|
28349
27576
|
if (!sparkInvoiceFields) {
|
|
28350
27577
|
throw new ValidationError("Spark invoice fields are required", {
|
|
@@ -28401,15 +27628,15 @@ function assertBech32(s2) {
|
|
|
28401
27628
|
const i = s2.lastIndexOf("1");
|
|
28402
27629
|
if (i <= 0 || i >= s2.length - 1) throw new Error("invalid bech32 string");
|
|
28403
27630
|
}
|
|
28404
|
-
function bech32mDecode(
|
|
28405
|
-
assertBech32(
|
|
28406
|
-
return
|
|
27631
|
+
function bech32mDecode(address) {
|
|
27632
|
+
assertBech32(address);
|
|
27633
|
+
return import_base3.bech32m.decode(address, BECH32M_LIMIT);
|
|
28407
27634
|
}
|
|
28408
27635
|
function bech32mEncode(prefix, words) {
|
|
28409
|
-
return
|
|
27636
|
+
return import_base3.bech32m.encode(prefix, words, BECH32M_LIMIT);
|
|
28410
27637
|
}
|
|
28411
27638
|
function encodeSparkInvoiceFieldsV1Canonical(f) {
|
|
28412
|
-
const w = new
|
|
27639
|
+
const w = new import_wire7.BinaryWriter();
|
|
28413
27640
|
if (f.version !== 0) w.uint32(8).uint32(f.version);
|
|
28414
27641
|
if (f.id && f.id.length) w.uint32(18).bytes(f.id);
|
|
28415
27642
|
if (f.memo !== void 0) w.uint32(42).string(f.memo);
|
|
@@ -28440,7 +27667,7 @@ function isSafeForNumber(bi) {
|
|
|
28440
27667
|
// src/utils/token-hashing.ts
|
|
28441
27668
|
init_buffer();
|
|
28442
27669
|
var import_sha211 = require("@noble/hashes/sha2");
|
|
28443
|
-
var
|
|
27670
|
+
var import_base4 = require("@scure/base");
|
|
28444
27671
|
function hashTokenTransaction(tokenTransaction, partialHash = false) {
|
|
28445
27672
|
switch (tokenTransaction.version) {
|
|
28446
27673
|
case 1:
|
|
@@ -29282,8 +28509,8 @@ function hashTokenTransactionV2(tokenTransaction, partialHash = false) {
|
|
|
29282
28509
|
const invoice = attachment.sparkInvoice;
|
|
29283
28510
|
let idBytes;
|
|
29284
28511
|
try {
|
|
29285
|
-
const decoded =
|
|
29286
|
-
const payload = SparkAddress.decode(
|
|
28512
|
+
const decoded = import_base4.bech32m.decode(invoice, 500);
|
|
28513
|
+
const payload = SparkAddress.decode(import_base4.bech32m.fromWords(decoded.words));
|
|
29287
28514
|
if (!payload.sparkInvoiceFields || !payload.sparkInvoiceFields.id) {
|
|
29288
28515
|
throw new Error("missing spark invoice fields or id");
|
|
29289
28516
|
}
|
|
@@ -29385,7 +28612,7 @@ function hashOperatorSpecificTokenTransactionSignablePayload(payload) {
|
|
|
29385
28612
|
|
|
29386
28613
|
// src/utils/token-identifier.ts
|
|
29387
28614
|
init_buffer();
|
|
29388
|
-
var
|
|
28615
|
+
var import_base5 = require("@scure/base");
|
|
29389
28616
|
var Bech32mTokenIdentifierTokenIdentifierNetworkPrefix = {
|
|
29390
28617
|
MAINNET: "btkn",
|
|
29391
28618
|
REGTEST: "btknrt",
|
|
@@ -29395,7 +28622,7 @@ var Bech32mTokenIdentifierTokenIdentifierNetworkPrefix = {
|
|
|
29395
28622
|
};
|
|
29396
28623
|
function encodeBech32mTokenIdentifier(payload) {
|
|
29397
28624
|
try {
|
|
29398
|
-
const words =
|
|
28625
|
+
const words = import_base5.bech32m.toWords(payload.tokenIdentifier);
|
|
29399
28626
|
if (!payload.network) {
|
|
29400
28627
|
throw new ValidationError(
|
|
29401
28628
|
"Network is required to encode bech32m encoded token identifier",
|
|
@@ -29405,7 +28632,7 @@ function encodeBech32mTokenIdentifier(payload) {
|
|
|
29405
28632
|
}
|
|
29406
28633
|
);
|
|
29407
28634
|
}
|
|
29408
|
-
return
|
|
28635
|
+
return import_base5.bech32m.encode(
|
|
29409
28636
|
Bech32mTokenIdentifierTokenIdentifierNetworkPrefix[payload.network],
|
|
29410
28637
|
words,
|
|
29411
28638
|
500
|
|
@@ -29423,7 +28650,7 @@ function encodeBech32mTokenIdentifier(payload) {
|
|
|
29423
28650
|
}
|
|
29424
28651
|
function decodeBech32mTokenIdentifier(bech32mTokenIdentifier, network) {
|
|
29425
28652
|
try {
|
|
29426
|
-
const decoded =
|
|
28653
|
+
const decoded = import_base5.bech32m.decode(
|
|
29427
28654
|
bech32mTokenIdentifier,
|
|
29428
28655
|
500
|
|
29429
28656
|
);
|
|
@@ -29437,7 +28664,7 @@ function decodeBech32mTokenIdentifier(bech32mTokenIdentifier, network) {
|
|
|
29437
28664
|
}
|
|
29438
28665
|
);
|
|
29439
28666
|
}
|
|
29440
|
-
const tokenIdentifier =
|
|
28667
|
+
const tokenIdentifier = import_base5.bech32m.fromWords(decoded.words);
|
|
29441
28668
|
return {
|
|
29442
28669
|
tokenIdentifier,
|
|
29443
28670
|
network: network ?? getNetworkFromBech32mTokenIdentifier(bech32mTokenIdentifier)
|
|
@@ -30552,7 +29779,7 @@ var import_sha212 = require("@noble/hashes/sha2");
|
|
|
30552
29779
|
var import_api = require("@opentelemetry/api");
|
|
30553
29780
|
var import_sdk_trace_base = require("@opentelemetry/sdk-trace-base");
|
|
30554
29781
|
var import_eventemitter3 = require("eventemitter3");
|
|
30555
|
-
var
|
|
29782
|
+
var import_nice_grpc_common = require("nice-grpc-common");
|
|
30556
29783
|
|
|
30557
29784
|
// src/services/signing.ts
|
|
30558
29785
|
init_buffer();
|
|
@@ -30783,15 +30010,15 @@ var BitcoinFaucet = class _BitcoinFaucet {
|
|
|
30783
30010
|
}
|
|
30784
30011
|
async refill() {
|
|
30785
30012
|
const minerPubKey = import_secp256k112.secp256k1.getPublicKey(STATIC_MINING_KEY);
|
|
30786
|
-
const
|
|
30013
|
+
const address = getP2TRAddressFromPublicKey(minerPubKey, 4 /* LOCAL */);
|
|
30787
30014
|
const scanResult = await this.call("scantxoutset", [
|
|
30788
30015
|
"start",
|
|
30789
|
-
[`addr(${
|
|
30016
|
+
[`addr(${address})`]
|
|
30790
30017
|
]);
|
|
30791
30018
|
let selectedUtxo;
|
|
30792
30019
|
let selectedUtxoAmountSats;
|
|
30793
30020
|
if (!scanResult.success || scanResult.unspents.length === 0) {
|
|
30794
|
-
const blockHash = await this.generateToAddress(1,
|
|
30021
|
+
const blockHash = await this.generateToAddress(1, address);
|
|
30795
30022
|
const block = await this.getBlock(blockHash[0]);
|
|
30796
30023
|
const fundingTx = import_btc_signer5.Transaction.fromRaw((0, import_utils20.hexToBytes)(block.tx[0].hex), {
|
|
30797
30024
|
allowUnknownOutputs: true
|
|
@@ -30964,8 +30191,8 @@ var BitcoinFaucet = class _BitcoinFaucet {
|
|
|
30964
30191
|
);
|
|
30965
30192
|
}
|
|
30966
30193
|
}
|
|
30967
|
-
async generateToAddress(numBlocks,
|
|
30968
|
-
return await this.call("generatetoaddress", [numBlocks,
|
|
30194
|
+
async generateToAddress(numBlocks, address) {
|
|
30195
|
+
return await this.call("generatetoaddress", [numBlocks, address]);
|
|
30969
30196
|
}
|
|
30970
30197
|
async getBlock(blockHash) {
|
|
30971
30198
|
return await this.call("getblock", [blockHash, 2]);
|
|
@@ -30979,7 +30206,7 @@ var BitcoinFaucet = class _BitcoinFaucet {
|
|
|
30979
30206
|
const pubKey = import_secp256k112.secp256k1.getPublicKey(key);
|
|
30980
30207
|
return getP2TRAddressFromPublicKey(pubKey, 4 /* LOCAL */);
|
|
30981
30208
|
}
|
|
30982
|
-
async sendToAddress(
|
|
30209
|
+
async sendToAddress(address, amount, blocksToGenerate = 1) {
|
|
30983
30210
|
const coin = await this.fund();
|
|
30984
30211
|
if (!coin) {
|
|
30985
30212
|
throw new Error("No coins available");
|
|
@@ -30988,7 +30215,7 @@ var BitcoinFaucet = class _BitcoinFaucet {
|
|
|
30988
30215
|
tx.addInput(coin.outpoint);
|
|
30989
30216
|
const availableAmount = COIN_AMOUNT - FEE_AMOUNT;
|
|
30990
30217
|
const destinationAddress = (0, import_btc_signer5.Address)(getNetwork(4 /* LOCAL */)).decode(
|
|
30991
|
-
|
|
30218
|
+
address
|
|
30992
30219
|
);
|
|
30993
30220
|
const destinationScript = import_btc_signer5.OutScript.encode(destinationAddress);
|
|
30994
30221
|
tx.addOutput({
|
|
@@ -31160,7 +30387,7 @@ var SparkWalletEvent = {
|
|
|
31160
30387
|
};
|
|
31161
30388
|
|
|
31162
30389
|
// src/spark-wallet/spark-wallet.ts
|
|
31163
|
-
var SparkWallet = class
|
|
30390
|
+
var SparkWallet = class extends import_eventemitter3.EventEmitter {
|
|
31164
30391
|
config;
|
|
31165
30392
|
connectionManager;
|
|
31166
30393
|
transferService;
|
|
@@ -31187,7 +30414,7 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
31187
30414
|
constructor(options, signer) {
|
|
31188
30415
|
super();
|
|
31189
30416
|
this.config = new WalletConfigService(options, signer);
|
|
31190
|
-
this.connectionManager =
|
|
30417
|
+
this.connectionManager = this.buildConnectionManager(this.config);
|
|
31191
30418
|
this.signingService = new SigningService(this.config);
|
|
31192
30419
|
this.depositService = new DepositService(
|
|
31193
30420
|
this.config,
|
|
@@ -31214,28 +30441,18 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
31214
30441
|
);
|
|
31215
30442
|
this.tracer = import_api.trace.getTracer(this.tracerId);
|
|
31216
30443
|
this.wrapSparkWalletMethodsWithTracing();
|
|
30444
|
+
this.initializeTracer(this);
|
|
30445
|
+
}
|
|
30446
|
+
static async initialize({ mnemonicOrSeed, accountNumber, signer, options = {} }) {
|
|
30447
|
+
const wallet = new this(options, signer);
|
|
30448
|
+
const initWalletResponse = await wallet.initWallet(
|
|
30449
|
+
mnemonicOrSeed,
|
|
30450
|
+
accountNumber,
|
|
30451
|
+
options
|
|
30452
|
+
);
|
|
30453
|
+
return initWalletResponse;
|
|
31217
30454
|
}
|
|
31218
|
-
|
|
31219
|
-
mnemonicOrSeed,
|
|
31220
|
-
accountNumber,
|
|
31221
|
-
signer,
|
|
31222
|
-
options
|
|
31223
|
-
}) {
|
|
31224
|
-
const wallet = new _SparkWallet(options, signer);
|
|
31225
|
-
wallet.initializeTracer(wallet);
|
|
31226
|
-
if (options && options.signerWithPreExistingKeys) {
|
|
31227
|
-
await wallet.initWalletWithoutSeed();
|
|
31228
|
-
return {
|
|
31229
|
-
wallet
|
|
31230
|
-
};
|
|
31231
|
-
}
|
|
31232
|
-
const initResponse = await wallet.initWallet(mnemonicOrSeed, accountNumber);
|
|
31233
|
-
return {
|
|
31234
|
-
wallet,
|
|
31235
|
-
...initResponse
|
|
31236
|
-
};
|
|
31237
|
-
}
|
|
31238
|
-
async initializeWallet() {
|
|
30455
|
+
async createClientsAndSyncWallet() {
|
|
31239
30456
|
this.sspClient = new SspClient(this.config);
|
|
31240
30457
|
await this.connectionManager.createClients();
|
|
31241
30458
|
if (isReactNative) {
|
|
@@ -31253,6 +30470,9 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
31253
30470
|
}
|
|
31254
30471
|
return this.sspClient;
|
|
31255
30472
|
}
|
|
30473
|
+
buildConnectionManager(config) {
|
|
30474
|
+
return new ConnectionManager(config);
|
|
30475
|
+
}
|
|
31256
30476
|
async handleStreamEvent({ event }) {
|
|
31257
30477
|
try {
|
|
31258
30478
|
if (event?.$case === "transfer" && event.transfer.transfer && event.transfer.transfer.type !== 40 /* COUNTER_SWAP */) {
|
|
@@ -31307,9 +30527,9 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
31307
30527
|
let retryCount = 0;
|
|
31308
30528
|
while (retryCount <= MAX_RETRIES) {
|
|
31309
30529
|
try {
|
|
31310
|
-
const
|
|
31311
|
-
const sparkClient = await this.connectionManager.createSparkStreamClient(
|
|
31312
|
-
const channel = await this.connectionManager.getStreamChannel(
|
|
30530
|
+
const address = this.config.getCoordinatorAddress();
|
|
30531
|
+
const sparkClient = await this.connectionManager.createSparkStreamClient(address);
|
|
30532
|
+
const channel = await this.connectionManager.getStreamChannel(address);
|
|
31313
30533
|
const stream = sparkClient.subscribe_to_events(
|
|
31314
30534
|
{
|
|
31315
30535
|
identityPublicKey: await this.config.signer.getIdentityPublicKey()
|
|
@@ -31715,11 +30935,17 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
31715
30935
|
*
|
|
31716
30936
|
* @returns {Promise<Object>} Object containing:
|
|
31717
30937
|
* - mnemonic: The mnemonic if one was generated (undefined for raw seed)
|
|
31718
|
-
* -
|
|
31719
|
-
* - tokenBalance: Map of token balances
|
|
30938
|
+
* - wallet: The wallet instance
|
|
31720
30939
|
* @private
|
|
31721
30940
|
*/
|
|
31722
|
-
async initWallet(mnemonicOrSeed, accountNumber) {
|
|
30941
|
+
async initWallet(mnemonicOrSeed, accountNumber, options = {}) {
|
|
30942
|
+
if (options.signerWithPreExistingKeys) {
|
|
30943
|
+
await this.initWalletWithoutSeed();
|
|
30944
|
+
return {
|
|
30945
|
+
wallet: this,
|
|
30946
|
+
mnemonic: void 0
|
|
30947
|
+
};
|
|
30948
|
+
}
|
|
31723
30949
|
if (accountNumber === void 0) {
|
|
31724
30950
|
if (this.config.getNetwork() === 3 /* REGTEST */) {
|
|
31725
30951
|
accountNumber = 0;
|
|
@@ -31745,7 +30971,8 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
31745
30971
|
}
|
|
31746
30972
|
await this.initWalletFromSeed(seed, accountNumber);
|
|
31747
30973
|
return {
|
|
31748
|
-
mnemonic
|
|
30974
|
+
mnemonic,
|
|
30975
|
+
wallet: this
|
|
31749
30976
|
};
|
|
31750
30977
|
}
|
|
31751
30978
|
/**
|
|
@@ -31753,7 +30980,7 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
31753
30980
|
* @private
|
|
31754
30981
|
*/
|
|
31755
30982
|
async initWalletWithoutSeed() {
|
|
31756
|
-
await this.
|
|
30983
|
+
await this.createClientsAndSyncWallet();
|
|
31757
30984
|
const identityPublicKey = await this.config.signer.getIdentityPublicKey();
|
|
31758
30985
|
if (!identityPublicKey || identityPublicKey.length === 0) {
|
|
31759
30986
|
throw new ValidationError("Identity public key not found in signer", {
|
|
@@ -31776,7 +31003,7 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
31776
31003
|
*/
|
|
31777
31004
|
async initWalletFromSeed(seed, accountNumber) {
|
|
31778
31005
|
const identityPublicKey = await this.config.signer.createSparkWalletFromSeed(seed, accountNumber);
|
|
31779
|
-
await this.
|
|
31006
|
+
await this.createClientsAndSyncWallet();
|
|
31780
31007
|
this.sparkAddress = encodeSparkAddress({
|
|
31781
31008
|
identityPublicKey,
|
|
31782
31009
|
network: this.config.getNetworkType()
|
|
@@ -32323,16 +31550,16 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
32323
31550
|
*/
|
|
32324
31551
|
async getStaticDepositAddress() {
|
|
32325
31552
|
const signingPubkey = await this.config.signer.getStaticDepositSigningKey(0);
|
|
32326
|
-
const
|
|
31553
|
+
const address = await this.depositService.generateStaticDepositAddress({
|
|
32327
31554
|
signingPubkey
|
|
32328
31555
|
});
|
|
32329
|
-
if (!
|
|
31556
|
+
if (!address.depositAddress) {
|
|
32330
31557
|
throw new RPCError("Failed to generate static deposit address", {
|
|
32331
31558
|
method: "generateStaticDepositAddress",
|
|
32332
31559
|
params: { signingPubkey }
|
|
32333
31560
|
});
|
|
32334
31561
|
}
|
|
32335
|
-
return
|
|
31562
|
+
return address.depositAddress.address;
|
|
32336
31563
|
}
|
|
32337
31564
|
/**
|
|
32338
31565
|
* Generates a deposit address for receiving funds.
|
|
@@ -32345,17 +31572,17 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
32345
31572
|
type: "leaf" /* LEAF */,
|
|
32346
31573
|
path: leafId
|
|
32347
31574
|
});
|
|
32348
|
-
const
|
|
31575
|
+
const address = await this.depositService.generateDepositAddress({
|
|
32349
31576
|
signingPubkey,
|
|
32350
31577
|
leafId
|
|
32351
31578
|
});
|
|
32352
|
-
if (!
|
|
31579
|
+
if (!address.depositAddress) {
|
|
32353
31580
|
throw new RPCError("Failed to generate deposit address", {
|
|
32354
31581
|
method: "generateDepositAddress",
|
|
32355
31582
|
params: { signingPubkey, leafId }
|
|
32356
31583
|
});
|
|
32357
31584
|
}
|
|
32358
|
-
return
|
|
31585
|
+
return address.depositAddress.address;
|
|
32359
31586
|
}
|
|
32360
31587
|
async queryStaticDepositAddresses() {
|
|
32361
31588
|
const sparkClient = await this.connectionManager.createSparkClient(
|
|
@@ -32790,10 +32017,10 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
32790
32017
|
continue;
|
|
32791
32018
|
}
|
|
32792
32019
|
const parsedScript = import_btc_signer6.OutScript.decode(output.script);
|
|
32793
|
-
const
|
|
32020
|
+
const address = (0, import_btc_signer6.Address)(getNetwork(this.config.getNetwork())).encode(
|
|
32794
32021
|
parsedScript
|
|
32795
32022
|
);
|
|
32796
|
-
if (staticDepositAddresses.has(
|
|
32023
|
+
if (staticDepositAddresses.has(address)) {
|
|
32797
32024
|
vout = i;
|
|
32798
32025
|
break;
|
|
32799
32026
|
}
|
|
@@ -32996,12 +32223,12 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
32996
32223
|
continue;
|
|
32997
32224
|
}
|
|
32998
32225
|
const parsedScript = import_btc_signer6.OutScript.decode(output.script);
|
|
32999
|
-
const
|
|
32226
|
+
const address = (0, import_btc_signer6.Address)(getNetwork(this.config.getNetwork())).encode(
|
|
33000
32227
|
parsedScript
|
|
33001
32228
|
);
|
|
33002
|
-
if (unusedDepositAddresses.has(
|
|
32229
|
+
if (unusedDepositAddresses.has(address)) {
|
|
33003
32230
|
vout = i;
|
|
33004
|
-
depositAddress = unusedDepositAddresses.get(
|
|
32231
|
+
depositAddress = unusedDepositAddresses.get(address);
|
|
33005
32232
|
break;
|
|
33006
32233
|
}
|
|
33007
32234
|
}
|
|
@@ -33057,10 +32284,10 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
33057
32284
|
continue;
|
|
33058
32285
|
}
|
|
33059
32286
|
const parsedScript = import_btc_signer6.OutScript.decode(output.script);
|
|
33060
|
-
const
|
|
32287
|
+
const address = (0, import_btc_signer6.Address)(getNetwork(this.config.getNetwork())).encode(
|
|
33061
32288
|
parsedScript
|
|
33062
32289
|
);
|
|
33063
|
-
const unusedDepositAddress = unusedDepositAddresses.get(
|
|
32290
|
+
const unusedDepositAddress = unusedDepositAddresses.get(address);
|
|
33064
32291
|
if (unusedDepositAddress) {
|
|
33065
32292
|
vout = i;
|
|
33066
32293
|
let keyDerivation;
|
|
@@ -33194,7 +32421,7 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
33194
32421
|
}
|
|
33195
32422
|
amountSatsArray.push(amountSats);
|
|
33196
32423
|
}
|
|
33197
|
-
|
|
32424
|
+
return await this.withLeaves(async () => {
|
|
33198
32425
|
const selectLeavesToSendMap = await this.selectLeaves(amountSatsArray);
|
|
33199
32426
|
for (const [amount, selection] of selectLeavesToSendMap) {
|
|
33200
32427
|
for (let groupIndex = 0; groupIndex < selection.length; groupIndex++) {
|
|
@@ -33230,47 +32457,46 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
33230
32457
|
if (idsToRemove.size > 0) {
|
|
33231
32458
|
this.leaves = this.leaves.filter((leaf) => !idsToRemove.has(leaf.id));
|
|
33232
32459
|
}
|
|
33233
|
-
|
|
33234
|
-
|
|
33235
|
-
|
|
33236
|
-
|
|
33237
|
-
|
|
33238
|
-
|
|
33239
|
-
|
|
33240
|
-
|
|
33241
|
-
job.receiverIdentityPubkey,
|
|
33242
|
-
job.sparkInvoice
|
|
33243
|
-
);
|
|
33244
|
-
const isSelfTransfer = (0, import_utils23.equalBytes)(
|
|
33245
|
-
signerIdentityPublicKey,
|
|
33246
|
-
job.receiverIdentityPubkey
|
|
33247
|
-
);
|
|
33248
|
-
if (isSelfTransfer) {
|
|
33249
|
-
const pending = await this.transferService.queryTransfer(
|
|
33250
|
-
transfer.id
|
|
32460
|
+
const signerIdentityPublicKey = await this.config.signer.getIdentityPublicKey();
|
|
32461
|
+
const outcomes = await Promise.all(
|
|
32462
|
+
jobs.map(async (job) => {
|
|
32463
|
+
try {
|
|
32464
|
+
const transfer = await this.transferService.sendTransferWithKeyTweaks(
|
|
32465
|
+
job.leafKeyTweaks,
|
|
32466
|
+
job.receiverIdentityPubkey,
|
|
32467
|
+
job.sparkInvoice
|
|
33251
32468
|
);
|
|
33252
|
-
|
|
33253
|
-
|
|
32469
|
+
const isSelfTransfer = (0, import_utils23.equalBytes)(
|
|
32470
|
+
signerIdentityPublicKey,
|
|
32471
|
+
job.receiverIdentityPubkey
|
|
32472
|
+
);
|
|
32473
|
+
if (isSelfTransfer) {
|
|
32474
|
+
const pending = await this.transferService.queryTransfer(
|
|
32475
|
+
transfer.id
|
|
32476
|
+
);
|
|
32477
|
+
if (pending) {
|
|
32478
|
+
await this.claimTransfer({ transfer: pending, optimize: true });
|
|
32479
|
+
}
|
|
33254
32480
|
}
|
|
32481
|
+
return {
|
|
32482
|
+
ok: true,
|
|
32483
|
+
transfer: mapTransferToWalletTransfer(
|
|
32484
|
+
transfer,
|
|
32485
|
+
(0, import_utils23.bytesToHex)(await this.config.signer.getIdentityPublicKey())
|
|
32486
|
+
),
|
|
32487
|
+
param: job.param
|
|
32488
|
+
};
|
|
32489
|
+
} catch (error) {
|
|
32490
|
+
return {
|
|
32491
|
+
ok: false,
|
|
32492
|
+
error: error instanceof Error ? error : new Error(String(error)),
|
|
32493
|
+
param: job.param
|
|
32494
|
+
};
|
|
33255
32495
|
}
|
|
33256
|
-
|
|
33257
|
-
|
|
33258
|
-
|
|
33259
|
-
|
|
33260
|
-
(0, import_utils23.bytesToHex)(await this.config.signer.getIdentityPublicKey())
|
|
33261
|
-
),
|
|
33262
|
-
param: job.param
|
|
33263
|
-
};
|
|
33264
|
-
} catch (error) {
|
|
33265
|
-
return {
|
|
33266
|
-
ok: false,
|
|
33267
|
-
error: error instanceof Error ? error : new Error(String(error)),
|
|
33268
|
-
param: job.param
|
|
33269
|
-
};
|
|
33270
|
-
}
|
|
33271
|
-
})
|
|
33272
|
-
);
|
|
33273
|
-
return outcomes;
|
|
32496
|
+
})
|
|
32497
|
+
);
|
|
32498
|
+
return outcomes;
|
|
32499
|
+
});
|
|
33274
32500
|
}
|
|
33275
32501
|
buildTweaksByAmount(selectedByAmount) {
|
|
33276
32502
|
const tweaksByAmount = /* @__PURE__ */ new Map();
|
|
@@ -33475,7 +32701,7 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
33475
32701
|
}) {
|
|
33476
32702
|
const onError = async (context) => {
|
|
33477
32703
|
const error = context.error;
|
|
33478
|
-
if (error instanceof RPCError && error.originalError instanceof
|
|
32704
|
+
if (error instanceof RPCError && error.originalError instanceof import_nice_grpc_common.ClientError && error.originalError.code === import_nice_grpc_common.Status.ALREADY_EXISTS) {
|
|
33479
32705
|
const transferToUse = context.data || transfer;
|
|
33480
32706
|
const updatedTransfer = await this.transferService.queryTransfer(
|
|
33481
32707
|
transferToUse.id
|
|
@@ -33661,7 +32887,14 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
33661
32887
|
expected: (0, import_utils23.bytesToHex)(paymentHash)
|
|
33662
32888
|
});
|
|
33663
32889
|
}
|
|
33664
|
-
if (decodedInvoice.amountMSats
|
|
32890
|
+
if (decodedInvoice.amountMSats === null && amountSats2 !== 0) {
|
|
32891
|
+
throw new ValidationError("Amount mismatch", {
|
|
32892
|
+
field: "amountMSats",
|
|
32893
|
+
value: "null",
|
|
32894
|
+
expected: amountSats2 * 1e3
|
|
32895
|
+
});
|
|
32896
|
+
}
|
|
32897
|
+
if (decodedInvoice.amountMSats !== null && decodedInvoice.amountMSats !== BigInt(amountSats2 * 1e3)) {
|
|
33665
32898
|
throw new ValidationError("Amount mismatch", {
|
|
33666
32899
|
field: "amountMSats",
|
|
33667
32900
|
value: decodedInvoice.amountMSats,
|
|
@@ -34887,11 +34120,11 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
34887
34120
|
this.leaves.push(...leavesToAdd);
|
|
34888
34121
|
}
|
|
34889
34122
|
async queryNodes(baseRequest, sparkClientAddress, pageSize = 100) {
|
|
34890
|
-
const
|
|
34123
|
+
const address = sparkClientAddress ?? this.config.getCoordinatorAddress();
|
|
34891
34124
|
const aggregatedNodes = {};
|
|
34892
34125
|
let offset = 0;
|
|
34893
34126
|
while (true) {
|
|
34894
|
-
const sparkClient = await this.connectionManager.createSparkClient(
|
|
34127
|
+
const sparkClient = await this.connectionManager.createSparkClient(address);
|
|
34895
34128
|
const response = await sparkClient.query_nodes({
|
|
34896
34129
|
...baseRequest,
|
|
34897
34130
|
limit: pageSize,
|
|
@@ -35020,6 +34253,133 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
35020
34253
|
}
|
|
35021
34254
|
};
|
|
35022
34255
|
|
|
34256
|
+
// src/spark-wallet/spark-wallet.browser.ts
|
|
34257
|
+
var import_sdk_trace_web = require("@opentelemetry/sdk-trace-web");
|
|
34258
|
+
var import_instrumentation = require("@opentelemetry/instrumentation");
|
|
34259
|
+
var import_instrumentation_fetch = require("@opentelemetry/instrumentation-fetch");
|
|
34260
|
+
var import_core14 = require("@opentelemetry/core");
|
|
34261
|
+
var import_api2 = require("@opentelemetry/api");
|
|
34262
|
+
|
|
34263
|
+
// src/services/connection/connection.browser.ts
|
|
34264
|
+
init_buffer();
|
|
34265
|
+
var import_nice_grpc_web = require("nice-grpc-web");
|
|
34266
|
+
var import_nice_grpc_common2 = require("nice-grpc-common");
|
|
34267
|
+
var import_nice_grpc_client_middleware_retry = require("nice-grpc-client-middleware-retry");
|
|
34268
|
+
var ConnectionManagerBrowser = class extends ConnectionManager {
|
|
34269
|
+
transport;
|
|
34270
|
+
constructor(config, transport = (0, import_nice_grpc_web.FetchTransport)()) {
|
|
34271
|
+
super(config);
|
|
34272
|
+
this.transport = transport;
|
|
34273
|
+
}
|
|
34274
|
+
async createChannelWithTLS(address, certPath) {
|
|
34275
|
+
try {
|
|
34276
|
+
return (0, import_nice_grpc_web.createChannel)(address, this.transport);
|
|
34277
|
+
} catch (error) {
|
|
34278
|
+
console.error("Channel creation error:", error);
|
|
34279
|
+
throw new NetworkError(
|
|
34280
|
+
"Failed to create channel",
|
|
34281
|
+
{
|
|
34282
|
+
url: address,
|
|
34283
|
+
operation: "createChannel",
|
|
34284
|
+
errorCount: 1,
|
|
34285
|
+
errors: error instanceof Error ? error.message : String(error)
|
|
34286
|
+
},
|
|
34287
|
+
error
|
|
34288
|
+
);
|
|
34289
|
+
}
|
|
34290
|
+
}
|
|
34291
|
+
createAuthnMiddleware() {
|
|
34292
|
+
return async function* (call, options) {
|
|
34293
|
+
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");
|
|
34294
|
+
return yield* call.next(call.request, {
|
|
34295
|
+
...options,
|
|
34296
|
+
metadata
|
|
34297
|
+
});
|
|
34298
|
+
}.bind(this);
|
|
34299
|
+
}
|
|
34300
|
+
createMiddleware(address, initialAuthToken) {
|
|
34301
|
+
return async function* (call, options) {
|
|
34302
|
+
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");
|
|
34303
|
+
try {
|
|
34304
|
+
return yield* call.next(call.request, {
|
|
34305
|
+
...options,
|
|
34306
|
+
metadata: metadata.set(
|
|
34307
|
+
"Authorization",
|
|
34308
|
+
`Bearer ${this.clients.get(address)?.authToken || initialAuthToken}`
|
|
34309
|
+
)
|
|
34310
|
+
});
|
|
34311
|
+
} catch (error) {
|
|
34312
|
+
return yield* this.handleMiddlewareError(
|
|
34313
|
+
error,
|
|
34314
|
+
address,
|
|
34315
|
+
call,
|
|
34316
|
+
metadata,
|
|
34317
|
+
options
|
|
34318
|
+
);
|
|
34319
|
+
}
|
|
34320
|
+
}.bind(this);
|
|
34321
|
+
}
|
|
34322
|
+
async createGrpcClient(defintion, channel, withRetries, middleware) {
|
|
34323
|
+
let clientFactory;
|
|
34324
|
+
const retryOptions = {
|
|
34325
|
+
retry: true,
|
|
34326
|
+
retryMaxAttempts: 3
|
|
34327
|
+
};
|
|
34328
|
+
let options = {};
|
|
34329
|
+
clientFactory = (0, import_nice_grpc_web.createClientFactory)();
|
|
34330
|
+
if (withRetries) {
|
|
34331
|
+
options = retryOptions;
|
|
34332
|
+
clientFactory = clientFactory.use(import_nice_grpc_client_middleware_retry.retryMiddleware);
|
|
34333
|
+
}
|
|
34334
|
+
if (middleware) {
|
|
34335
|
+
clientFactory = clientFactory.use(middleware);
|
|
34336
|
+
}
|
|
34337
|
+
const client = clientFactory.create(defintion, channel, {
|
|
34338
|
+
"*": options
|
|
34339
|
+
});
|
|
34340
|
+
return {
|
|
34341
|
+
...client,
|
|
34342
|
+
close: void 0
|
|
34343
|
+
};
|
|
34344
|
+
}
|
|
34345
|
+
};
|
|
34346
|
+
|
|
34347
|
+
// src/spark-wallet/spark-wallet.browser.ts
|
|
34348
|
+
var SparkWalletBrowser = class extends SparkWallet {
|
|
34349
|
+
buildConnectionManager(config) {
|
|
34350
|
+
return new ConnectionManagerBrowser(config);
|
|
34351
|
+
}
|
|
34352
|
+
initializeTracerEnv({
|
|
34353
|
+
spanProcessors,
|
|
34354
|
+
traceUrls
|
|
34355
|
+
}) {
|
|
34356
|
+
console.log("initializeTracerEnvBrowser");
|
|
34357
|
+
initializeTracerEnvBrowser({ spanProcessors, traceUrls });
|
|
34358
|
+
}
|
|
34359
|
+
};
|
|
34360
|
+
function initializeTracerEnvBrowser({
|
|
34361
|
+
spanProcessors,
|
|
34362
|
+
traceUrls
|
|
34363
|
+
}) {
|
|
34364
|
+
const provider = new import_sdk_trace_web.WebTracerProvider({ spanProcessors });
|
|
34365
|
+
provider.register();
|
|
34366
|
+
import_api2.propagation.setGlobalPropagator(new import_core14.W3CTraceContextPropagator());
|
|
34367
|
+
(0, import_instrumentation.registerInstrumentations)({
|
|
34368
|
+
instrumentations: [
|
|
34369
|
+
new import_instrumentation_fetch.FetchInstrumentation({
|
|
34370
|
+
ignoreUrls: [
|
|
34371
|
+
/* Since we're wrapping global fetch we should be careful to avoid
|
|
34372
|
+
adding headers for unrelated requests */
|
|
34373
|
+
new RegExp(
|
|
34374
|
+
`^(?!(${traceUrls.map((p) => p.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|")}))`
|
|
34375
|
+
)
|
|
34376
|
+
],
|
|
34377
|
+
propagateTraceHeaderCorsUrls: /.*/
|
|
34378
|
+
})
|
|
34379
|
+
]
|
|
34380
|
+
});
|
|
34381
|
+
}
|
|
34382
|
+
|
|
35023
34383
|
// src/utils/index.ts
|
|
35024
34384
|
var utils_exports = {};
|
|
35025
34385
|
__export(utils_exports, {
|
|
@@ -35028,7 +34388,6 @@ __export(utils_exports, {
|
|
|
35028
34388
|
INITIAL_DIRECT_SEQUENCE: () => INITIAL_DIRECT_SEQUENCE,
|
|
35029
34389
|
INITIAL_SEQUENCE: () => INITIAL_SEQUENCE,
|
|
35030
34390
|
LOGGER_NAMES: () => LOGGER_NAMES,
|
|
35031
|
-
LRC_WALLET_NETWORK: () => LRC_WALLET_NETWORK,
|
|
35032
34391
|
Network: () => Network2,
|
|
35033
34392
|
NetworkToProto: () => NetworkToProto,
|
|
35034
34393
|
SparkSdkLogger: () => SparkSdkLogger,
|
|
@@ -35133,9 +34492,9 @@ init_buffer();
|
|
|
35133
34492
|
init_buffer();
|
|
35134
34493
|
|
|
35135
34494
|
// src/utils/mempool.ts
|
|
35136
|
-
async function getLatestDepositTxId(
|
|
34495
|
+
async function getLatestDepositTxId(address) {
|
|
35137
34496
|
const { fetch, Headers: Headers2 } = getFetch();
|
|
35138
|
-
const network = getNetworkFromAddress(
|
|
34497
|
+
const network = getNetworkFromAddress(address);
|
|
35139
34498
|
const baseUrl = network === BitcoinNetwork_default.REGTEST ? getElectrsUrl("REGTEST") : getElectrsUrl("MAINNET");
|
|
35140
34499
|
const headers = new Headers2();
|
|
35141
34500
|
if (network === BitcoinNetwork_default.REGTEST) {
|
|
@@ -35144,14 +34503,14 @@ async function getLatestDepositTxId(address2) {
|
|
|
35144
34503
|
);
|
|
35145
34504
|
headers.set("Authorization", `Basic ${auth}`);
|
|
35146
34505
|
}
|
|
35147
|
-
const response = await fetch(`${baseUrl}/address/${
|
|
34506
|
+
const response = await fetch(`${baseUrl}/address/${address}/txs`, {
|
|
35148
34507
|
headers
|
|
35149
34508
|
});
|
|
35150
34509
|
const addressTxs = await response.json();
|
|
35151
34510
|
if (addressTxs && addressTxs.length > 0) {
|
|
35152
34511
|
const latestTx = addressTxs[0];
|
|
35153
34512
|
const outputIndex = latestTx.vout.findIndex(
|
|
35154
|
-
(output) => output.scriptpubkey_address ===
|
|
34513
|
+
(output) => output.scriptpubkey_address === address
|
|
35155
34514
|
);
|
|
35156
34515
|
if (outputIndex === -1) {
|
|
35157
34516
|
return null;
|
|
@@ -35706,7 +35065,7 @@ init_logging();
|
|
|
35706
35065
|
|
|
35707
35066
|
// src/debug.ts
|
|
35708
35067
|
var s = {
|
|
35709
|
-
SparkWallet,
|
|
35068
|
+
SparkWallet: SparkWalletBrowser,
|
|
35710
35069
|
WalletConfig,
|
|
35711
35070
|
utils: utils_exports
|
|
35712
35071
|
};
|