@arkade-os/sdk 0.5.2 → 0.5.4
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/README.md +36 -34
- package/dist/adapters/expo.cjs +9 -5
- package/dist/adapters/expo.d.cts +11 -7
- package/dist/adapters/expo.d.ts +11 -7
- package/dist/adapters/expo.js +3 -3
- package/dist/{asyncStorageTaskQueue-DIn7bTqN.d.ts → asyncStorageTaskQueue-DHMIxY04.d.ts} +2 -2
- package/dist/{asyncStorageTaskQueue-BtEc3Qca.d.cts → asyncStorageTaskQueue-DTBa8EH7.d.cts} +2 -2
- package/dist/{chunk-LWRMSC4M.js → chunk-6CUP6ZIF.js} +4 -4
- package/dist/{chunk-LWRMSC4M.js.map → chunk-6CUP6ZIF.js.map} +1 -1
- package/dist/{chunk-HKG26NUT.js → chunk-AG4TFD6F.js} +140 -59
- package/dist/chunk-AG4TFD6F.js.map +1 -0
- package/dist/{chunk-PVFQFQBY.cjs → chunk-B6VNKGIH.cjs} +10 -10
- package/dist/chunk-B6VNKGIH.cjs.map +1 -0
- package/dist/{chunk-U5XG7SWA.js → chunk-BTRCN4JJ.js} +22 -19
- package/dist/chunk-BTRCN4JJ.js.map +1 -0
- package/dist/{chunk-TAIWH3HG.cjs → chunk-DNITZVNG.cjs} +28 -47
- package/dist/chunk-DNITZVNG.cjs.map +1 -0
- package/dist/{chunk-OM6FJ76H.cjs → chunk-E6OOJEHL.cjs} +49 -49
- package/dist/{chunk-OM6FJ76H.cjs.map → chunk-E6OOJEHL.cjs.map} +1 -1
- package/dist/{chunk-2OCYL6BJ.cjs → chunk-F3FAE7VJ.cjs} +850 -652
- package/dist/chunk-F3FAE7VJ.cjs.map +1 -0
- package/dist/{chunk-GGKR4O5X.cjs → chunk-GHUUT54D.cjs} +143 -58
- package/dist/chunk-GHUUT54D.cjs.map +1 -0
- package/dist/{chunk-MOBDJ7U2.js → chunk-MWVAWFX6.js} +4 -4
- package/dist/chunk-MWVAWFX6.js.map +1 -0
- package/dist/{chunk-2QRUQXLS.js → chunk-TUOLZBNC.js} +19 -39
- package/dist/chunk-TUOLZBNC.js.map +1 -0
- package/dist/{chunk-64R7CRKN.cjs → chunk-WXNSISXK.cjs} +37 -34
- package/dist/chunk-WXNSISXK.cjs.map +1 -0
- package/dist/{chunk-AJWXVQYG.js → chunk-ZJHLLDBP.js} +372 -177
- package/dist/chunk-ZJHLLDBP.js.map +1 -0
- package/dist/contracts/handlers/index.cjs +9 -9
- package/dist/contracts/handlers/index.d.cts +3 -3
- package/dist/contracts/handlers/index.d.ts +3 -3
- package/dist/contracts/handlers/index.js +2 -2
- package/dist/{delegate-CaL8EN4Q.d.cts → delegate-f4_t864Z.d.cts} +1 -1
- package/dist/{delegate-Jd4zs88Q.d.ts → delegate-xrSBNybC.d.ts} +1 -1
- package/dist/{index-D-xqVzf8.d.ts → index-BJDz15ms.d.ts} +5 -5
- package/dist/{index-BwdGzNSn.d.cts → index-BjiVGtp8.d.cts} +5 -5
- package/dist/{index-DdKxfC29.d.cts → index-DRwe0UDN.d.cts} +194 -114
- package/dist/{index-DdKxfC29.d.ts → index-DRwe0UDN.d.ts} +194 -114
- package/dist/index.cjs +333 -313
- package/dist/index.d.cts +80 -45
- package/dist/index.d.ts +80 -45
- package/dist/index.js +4 -4
- package/dist/repositories/realm/index.cjs +65 -36
- package/dist/repositories/realm/index.cjs.map +1 -1
- package/dist/repositories/realm/index.d.cts +7 -3
- package/dist/repositories/realm/index.d.ts +7 -3
- package/dist/repositories/realm/index.js +35 -6
- package/dist/repositories/realm/index.js.map +1 -1
- package/dist/repositories/sqlite/index.cjs +176 -110
- package/dist/repositories/sqlite/index.cjs.map +1 -1
- package/dist/repositories/sqlite/index.d.cts +23 -13
- package/dist/repositories/sqlite/index.d.ts +23 -13
- package/dist/repositories/sqlite/index.js +148 -83
- package/dist/repositories/sqlite/index.js.map +1 -1
- package/dist/{taskRunner-ZyGGjtIq.d.ts → taskRunner-BPPU-YHG.d.cts} +4 -4
- package/dist/{taskRunner-67YSEpsz.d.cts → taskRunner-CDlNeth0.d.ts} +4 -4
- package/dist/wallet/expo/background.cjs +14 -14
- package/dist/wallet/expo/background.cjs.map +1 -1
- package/dist/wallet/expo/background.d.cts +3 -3
- package/dist/wallet/expo/background.d.ts +3 -3
- package/dist/wallet/expo/background.js +7 -7
- package/dist/wallet/expo/background.js.map +1 -1
- package/dist/wallet/expo/index.cjs +18 -15
- package/dist/wallet/expo/index.cjs.map +1 -1
- package/dist/wallet/expo/index.d.cts +7 -6
- package/dist/wallet/expo/index.d.ts +7 -6
- package/dist/wallet/expo/index.js +9 -6
- package/dist/wallet/expo/index.js.map +1 -1
- package/dist/{wallet-bFS7VybL.d.ts → wallet-Oc3Wd5gv.d.ts} +27 -19
- package/dist/{wallet-B8LW7cV1.d.cts → wallet-jVBDQl6R.d.cts} +27 -19
- package/dist/worker/expo/index.cjs +9 -9
- package/dist/worker/expo/index.d.cts +4 -4
- package/dist/worker/expo/index.d.ts +4 -4
- package/dist/worker/expo/index.js +5 -5
- package/package.json +1 -1
- package/dist/chunk-2OCYL6BJ.cjs.map +0 -1
- package/dist/chunk-2QRUQXLS.js.map +0 -1
- package/dist/chunk-64R7CRKN.cjs.map +0 -1
- package/dist/chunk-AJWXVQYG.js.map +0 -1
- package/dist/chunk-GGKR4O5X.cjs.map +0 -1
- package/dist/chunk-HKG26NUT.js.map +0 -1
- package/dist/chunk-MOBDJ7U2.js.map +0 -1
- package/dist/chunk-PVFQFQBY.cjs.map +0 -1
- package/dist/chunk-TAIWH3HG.cjs.map +0 -1
- package/dist/chunk-U5XG7SWA.js.map +0 -1
|
@@ -41,7 +41,8 @@ var getNetwork = (network) => {
|
|
|
41
41
|
if (!found) throw new Error(`Unsupported network: ${network}`);
|
|
42
42
|
return found;
|
|
43
43
|
};
|
|
44
|
-
var
|
|
44
|
+
var networkFromOperatorInfo = (info) => getNetwork(info.network);
|
|
45
|
+
var networkFromArkadeInfo = networkFromOperatorInfo;
|
|
45
46
|
var networks = {
|
|
46
47
|
bitcoin: withArkPrefix(utils_js.NETWORK, "ark", "bitcoin"),
|
|
47
48
|
testnet: withArkPrefix(utils_js.TEST_NETWORK, "tark", "testnet"),
|
|
@@ -1193,32 +1194,8 @@ function checkKeyMatch(key, arkPsbtFieldKey, prefixOnly = false) {
|
|
|
1193
1194
|
return true;
|
|
1194
1195
|
}
|
|
1195
1196
|
|
|
1196
|
-
// src/providers/eventSource.ts
|
|
1197
|
-
var GUIDANCE = "Pass one with configureEventSource(url => new EventSource(url)) \u2014 in Node, from the `eventsource` package or by running with --experimental-eventsource. In React Native, use ExpoArkProvider / ExpoIndexerProvider instead.";
|
|
1198
|
-
var EventSourceUnavailableError = class extends Error {
|
|
1199
|
-
constructor() {
|
|
1200
|
-
super(`no EventSource is available, so server-sent events cannot be opened. ${GUIDANCE}`);
|
|
1201
|
-
this.name = "EventSourceUnavailableError";
|
|
1202
|
-
}
|
|
1203
|
-
};
|
|
1204
|
-
function isEventSourceUnavailableError(error) {
|
|
1205
|
-
return error instanceof EventSourceUnavailableError || error instanceof Error && error.name === "EventSourceUnavailableError";
|
|
1206
|
-
}
|
|
1207
|
-
var configured;
|
|
1208
|
-
function configureEventSource(factory) {
|
|
1209
|
-
configured = factory;
|
|
1210
|
-
}
|
|
1211
|
-
function getConfiguredEventSource() {
|
|
1212
|
-
return configured;
|
|
1213
|
-
}
|
|
1214
|
-
function resolveEventSource(override) {
|
|
1215
|
-
const factory = override ?? configured ?? (typeof EventSource === "undefined" ? void 0 : (url) => new EventSource(url));
|
|
1216
|
-
if (!factory) throw new EventSourceUnavailableError();
|
|
1217
|
-
return factory;
|
|
1218
|
-
}
|
|
1219
|
-
|
|
1220
1197
|
// package.json
|
|
1221
|
-
var version = "0.5.
|
|
1198
|
+
var version = "0.5.4";
|
|
1222
1199
|
|
|
1223
1200
|
// src/utils/fetch.ts
|
|
1224
1201
|
var buildVersion = "0.9.9";
|
|
@@ -1284,6 +1261,103 @@ function describeRequest(input, init) {
|
|
|
1284
1261
|
return { url, method };
|
|
1285
1262
|
}
|
|
1286
1263
|
|
|
1264
|
+
// src/providers/sseFrames.ts
|
|
1265
|
+
async function* readSseFrames(body) {
|
|
1266
|
+
const reader = body.getReader();
|
|
1267
|
+
const decoder = new TextDecoder();
|
|
1268
|
+
let buffer = "";
|
|
1269
|
+
let pendingCR = false;
|
|
1270
|
+
let event = "";
|
|
1271
|
+
let data = [];
|
|
1272
|
+
try {
|
|
1273
|
+
for (; ; ) {
|
|
1274
|
+
const { done, value: chunk } = await reader.read();
|
|
1275
|
+
if (done) return;
|
|
1276
|
+
const text = decoder.decode(chunk, { stream: true });
|
|
1277
|
+
if (!text) continue;
|
|
1278
|
+
const skipLF = pendingCR && text.startsWith("\n");
|
|
1279
|
+
pendingCR = text.endsWith("\r");
|
|
1280
|
+
buffer += (skipLF ? text.slice(1) : text).replace(/\r\n?/g, "\n");
|
|
1281
|
+
const lines = buffer.split("\n");
|
|
1282
|
+
buffer = lines.pop() ?? "";
|
|
1283
|
+
for (const line of lines) {
|
|
1284
|
+
if (line === "") {
|
|
1285
|
+
const joined = data.join("\n");
|
|
1286
|
+
if (joined) yield { event: event || "message", data: joined };
|
|
1287
|
+
event = "";
|
|
1288
|
+
data = [];
|
|
1289
|
+
continue;
|
|
1290
|
+
}
|
|
1291
|
+
const colon = line.indexOf(":");
|
|
1292
|
+
const field = colon === -1 ? line : line.slice(0, colon);
|
|
1293
|
+
const value = colon === -1 ? "" : line.slice(colon + 1).replace(/^ /, "");
|
|
1294
|
+
if (field === "event") event = value;
|
|
1295
|
+
else if (field === "data") data.push(value);
|
|
1296
|
+
}
|
|
1297
|
+
}
|
|
1298
|
+
} finally {
|
|
1299
|
+
await reader.cancel().catch(() => {
|
|
1300
|
+
});
|
|
1301
|
+
}
|
|
1302
|
+
}
|
|
1303
|
+
|
|
1304
|
+
// src/providers/eventSource.ts
|
|
1305
|
+
var GUIDANCE = "Pass one with configureEventSource(url => new EventSource(url)) \u2014 in Node, from the `eventsource` package or by running with --experimental-eventsource. In React Native, use ExpoOperatorProvider / ExpoIndexerProvider instead.";
|
|
1306
|
+
var EventSourceUnavailableError = class extends Error {
|
|
1307
|
+
constructor() {
|
|
1308
|
+
super(`no EventSource is available, so server-sent events cannot be opened. ${GUIDANCE}`);
|
|
1309
|
+
this.name = "EventSourceUnavailableError";
|
|
1310
|
+
}
|
|
1311
|
+
};
|
|
1312
|
+
function isEventSourceUnavailableError(error) {
|
|
1313
|
+
return error instanceof EventSourceUnavailableError || error instanceof Error && error.name === "EventSourceUnavailableError";
|
|
1314
|
+
}
|
|
1315
|
+
var configured;
|
|
1316
|
+
function configureEventSource(factory) {
|
|
1317
|
+
configured = factory;
|
|
1318
|
+
}
|
|
1319
|
+
function getConfiguredEventSource() {
|
|
1320
|
+
return configured;
|
|
1321
|
+
}
|
|
1322
|
+
function resolveEventSource(override) {
|
|
1323
|
+
const factory = override ?? configured ?? (typeof globalThis.fetch === "function" && typeof ReadableStream !== "undefined" ? (url, headers) => new FetchEventSource(url, headers) : void 0) ?? (typeof EventSource === "undefined" ? void 0 : (url) => new EventSource(url));
|
|
1324
|
+
if (!factory) throw new EventSourceUnavailableError();
|
|
1325
|
+
return factory;
|
|
1326
|
+
}
|
|
1327
|
+
var FetchEventSource = class {
|
|
1328
|
+
events = new EventTarget();
|
|
1329
|
+
controller = new AbortController();
|
|
1330
|
+
constructor(url, headers = {}) {
|
|
1331
|
+
this.read(url, headers).catch(() => {
|
|
1332
|
+
if (!this.controller.signal.aborted) this.events.dispatchEvent(new Event("error"));
|
|
1333
|
+
});
|
|
1334
|
+
}
|
|
1335
|
+
addEventListener(type, listener) {
|
|
1336
|
+
this.events.addEventListener(type, listener);
|
|
1337
|
+
}
|
|
1338
|
+
removeEventListener(type, listener) {
|
|
1339
|
+
this.events.removeEventListener(type, listener);
|
|
1340
|
+
}
|
|
1341
|
+
close() {
|
|
1342
|
+
this.controller.abort();
|
|
1343
|
+
}
|
|
1344
|
+
async read(url, headers) {
|
|
1345
|
+
const response = await baseFetch(url, {
|
|
1346
|
+
headers: { Accept: "text/event-stream", ...headers },
|
|
1347
|
+
signal: this.controller.signal
|
|
1348
|
+
});
|
|
1349
|
+
const type = response.headers.get("Content-Type") ?? "";
|
|
1350
|
+
if (response.status !== 200 || !response.body || !/^text\/event-stream\s*(;|$)/i.test(type)) {
|
|
1351
|
+
await response.body?.cancel();
|
|
1352
|
+
throw new Error(`SSE response ${response.status} ${type}`);
|
|
1353
|
+
}
|
|
1354
|
+
for await (const { event, data } of readSseFrames(response.body)) {
|
|
1355
|
+
this.events.dispatchEvent(new MessageEvent(event, { data }));
|
|
1356
|
+
}
|
|
1357
|
+
throw new Error("SSE stream ended");
|
|
1358
|
+
}
|
|
1359
|
+
};
|
|
1360
|
+
|
|
1287
1361
|
// src/providers/errors.ts
|
|
1288
1362
|
var ArkError = class extends Error {
|
|
1289
1363
|
constructor(code, message, name, metadata) {
|
|
@@ -1378,42 +1452,42 @@ function maybeArkError(error) {
|
|
|
1378
1452
|
function isMetadata(value) {
|
|
1379
1453
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1380
1454
|
}
|
|
1381
|
-
exports.
|
|
1382
|
-
((
|
|
1455
|
+
exports.Proof = void 0;
|
|
1456
|
+
((Proof2) => {
|
|
1383
1457
|
function create(message, ins, outputs = []) {
|
|
1384
1458
|
if (typeof message !== "string") {
|
|
1385
1459
|
message = encodeMessage(message);
|
|
1386
1460
|
}
|
|
1387
|
-
if (ins.length == 0) throw new Error("
|
|
1388
|
-
const inputs = ins.map(
|
|
1461
|
+
if (ins.length == 0) throw new Error("proof requires at least one input");
|
|
1462
|
+
const inputs = ins.map(prepareProofInput);
|
|
1389
1463
|
validateInputs(inputs);
|
|
1390
1464
|
validateOutputs(outputs);
|
|
1391
1465
|
const toSpend = craftToSpendTx(message, inputs[0].witnessUtxo.script);
|
|
1392
1466
|
return craftToSignTx(toSpend, inputs, outputs, message);
|
|
1393
1467
|
}
|
|
1394
|
-
|
|
1468
|
+
Proof2.create = create;
|
|
1395
1469
|
function fee(proof) {
|
|
1396
1470
|
let sumOfInputs = 0n;
|
|
1397
1471
|
for (let i = 0; i < proof.inputsLength; i++) {
|
|
1398
1472
|
const input = proof.getInput(i);
|
|
1399
1473
|
if (input.witnessUtxo === void 0)
|
|
1400
|
-
throw new Error("
|
|
1474
|
+
throw new Error("proof input requires witness utxo");
|
|
1401
1475
|
sumOfInputs += input.witnessUtxo.amount;
|
|
1402
1476
|
}
|
|
1403
1477
|
let sumOfOutputs = 0n;
|
|
1404
1478
|
for (let i = 0; i < proof.outputsLength; i++) {
|
|
1405
1479
|
const output = proof.getOutput(i);
|
|
1406
|
-
if (output.amount === void 0) throw new Error("
|
|
1480
|
+
if (output.amount === void 0) throw new Error("proof output requires amount");
|
|
1407
1481
|
sumOfOutputs += output.amount;
|
|
1408
1482
|
}
|
|
1409
1483
|
if (sumOfOutputs > sumOfInputs) {
|
|
1410
1484
|
throw new Error(
|
|
1411
|
-
`
|
|
1485
|
+
`proof output amount is greater than input amount: ${sumOfOutputs} > ${sumOfInputs}`
|
|
1412
1486
|
);
|
|
1413
1487
|
}
|
|
1414
1488
|
return Number(sumOfInputs - sumOfOutputs);
|
|
1415
1489
|
}
|
|
1416
|
-
|
|
1490
|
+
Proof2.fee = fee;
|
|
1417
1491
|
function encodeMessage(message) {
|
|
1418
1492
|
switch (message.type) {
|
|
1419
1493
|
case "register":
|
|
@@ -1436,31 +1510,31 @@ exports.Intent = void 0;
|
|
|
1436
1510
|
});
|
|
1437
1511
|
}
|
|
1438
1512
|
}
|
|
1439
|
-
|
|
1440
|
-
})(exports.
|
|
1513
|
+
Proof2.encodeMessage = encodeMessage;
|
|
1514
|
+
})(exports.Proof || (exports.Proof = {}));
|
|
1515
|
+
var Intent = exports.Proof;
|
|
1441
1516
|
var OP_RETURN_EMPTY_PKSCRIPT = new Uint8Array([btcSigner.OP.RETURN]);
|
|
1442
1517
|
var ZERO_32 = new Uint8Array(32).fill(0);
|
|
1443
1518
|
var MAX_INDEX = 4294967295;
|
|
1444
|
-
var
|
|
1519
|
+
var TAG_PROOF = "ark-intent-proof-message";
|
|
1445
1520
|
function validateInput(input) {
|
|
1446
|
-
if (input.index === void 0) throw new Error("
|
|
1447
|
-
if (input.txid === void 0) throw new Error("
|
|
1448
|
-
if (input.witnessUtxo === void 0)
|
|
1449
|
-
throw new Error("intent proof input requires witness utxo");
|
|
1521
|
+
if (input.index === void 0) throw new Error("proof input requires index");
|
|
1522
|
+
if (input.txid === void 0) throw new Error("proof input requires txid");
|
|
1523
|
+
if (input.witnessUtxo === void 0) throw new Error("proof input requires witness utxo");
|
|
1450
1524
|
return true;
|
|
1451
1525
|
}
|
|
1452
1526
|
function validateInputs(inputs) {
|
|
1453
1527
|
inputs.forEach(validateInput);
|
|
1454
1528
|
}
|
|
1455
1529
|
function validateOutput(output) {
|
|
1456
|
-
if (output.amount === void 0) throw new Error("
|
|
1457
|
-
if (output.script === void 0) throw new Error("
|
|
1530
|
+
if (output.amount === void 0) throw new Error("proof output requires amount");
|
|
1531
|
+
if (output.script === void 0) throw new Error("proof output requires script");
|
|
1458
1532
|
return true;
|
|
1459
1533
|
}
|
|
1460
1534
|
function validateOutputs(outputs) {
|
|
1461
1535
|
outputs.forEach(validateOutput);
|
|
1462
1536
|
}
|
|
1463
|
-
function craftToSpendTx(message, pkScript, tag =
|
|
1537
|
+
function craftToSpendTx(message, pkScript, tag = TAG_PROOF) {
|
|
1464
1538
|
const messageHash = hashMessage(message, tag);
|
|
1465
1539
|
const tx = new Transaction({
|
|
1466
1540
|
version: 0
|
|
@@ -1525,10 +1599,10 @@ function craftToSignTx(toSpend, inputs, outputs, message) {
|
|
|
1525
1599
|
tx.global.genericSignedMessage = new TextEncoder().encode(message);
|
|
1526
1600
|
return tx;
|
|
1527
1601
|
}
|
|
1528
|
-
function hashMessage(message, tag =
|
|
1602
|
+
function hashMessage(message, tag = TAG_PROOF) {
|
|
1529
1603
|
return secp256k1_js.schnorr.utils.taggedHash(tag, new TextEncoder().encode(message));
|
|
1530
1604
|
}
|
|
1531
|
-
function
|
|
1605
|
+
function prepareProofInput(coin) {
|
|
1532
1606
|
if (!("tapTree" in coin)) {
|
|
1533
1607
|
return coin;
|
|
1534
1608
|
}
|
|
@@ -1829,7 +1903,7 @@ function advertisedLimit(fromServer) {
|
|
|
1829
1903
|
const limit = BigInt(fromServer);
|
|
1830
1904
|
return limit > 0n ? limit : void 0;
|
|
1831
1905
|
}
|
|
1832
|
-
var
|
|
1906
|
+
var RestOperatorProvider = class {
|
|
1833
1907
|
constructor(serverUrl = DEFAULT_ARKADE_SERVER_URL, options = {}) {
|
|
1834
1908
|
this.serverUrl = serverUrl;
|
|
1835
1909
|
this.eventSource = options.eventSource;
|
|
@@ -1838,7 +1912,7 @@ var RestArkProvider = class {
|
|
|
1838
1912
|
/** Overrides {@link configureEventSource} for this provider's streams. */
|
|
1839
1913
|
eventSource;
|
|
1840
1914
|
/**
|
|
1841
|
-
* Last
|
|
1915
|
+
* Last operator info digest seen (from {@link getInfo}). Sent as `X-Digest`
|
|
1842
1916
|
* on outgoing requests so arkd can reject a client whose cached info is
|
|
1843
1917
|
* stale. Empty until the first {@link getInfo}.
|
|
1844
1918
|
*/
|
|
@@ -1847,7 +1921,7 @@ var RestArkProvider = class {
|
|
|
1847
1921
|
_suppressNextGetInfoChangeEmit = false;
|
|
1848
1922
|
_serverInfoListeners = /* @__PURE__ */ new Set();
|
|
1849
1923
|
/**
|
|
1850
|
-
* Subscribe to
|
|
1924
|
+
* Subscribe to operator info changes. Fired after a stale-info
|
|
1851
1925
|
* `DIGEST_MISMATCH` refresh or when {@link getInfo} observes a changed digest.
|
|
1852
1926
|
* Returns an unsubscribe function.
|
|
1853
1927
|
*/
|
|
@@ -1867,7 +1941,7 @@ var RestArkProvider = class {
|
|
|
1867
1941
|
}
|
|
1868
1942
|
}
|
|
1869
1943
|
/**
|
|
1870
|
-
* `fetch` wrapper for arkd requests that participates in
|
|
1944
|
+
* `fetch` wrapper for arkd requests that participates in operator info digest
|
|
1871
1945
|
* negotiation. Sends the cached `X-Digest`; when arkd rejects a request with
|
|
1872
1946
|
* `DIGEST_MISMATCH`, refreshes {@link getInfo} (updating the digest), fires
|
|
1873
1947
|
* {@link onServerInfoChanged}, and THROWS {@link DigestMismatchError} — it
|
|
@@ -2004,6 +2078,9 @@ var RestArkProvider = class {
|
|
|
2004
2078
|
(errorText) => `Failed to submit virtual transaction: ${errorText}`
|
|
2005
2079
|
);
|
|
2006
2080
|
const data = await response.json();
|
|
2081
|
+
if (typeof data.finalArkTx !== "string" || !data.finalArkTx) {
|
|
2082
|
+
throw new Error("Invalid submitTx response: missing finalArkTx");
|
|
2083
|
+
}
|
|
2007
2084
|
return {
|
|
2008
2085
|
arkTxid: data.arkTxid,
|
|
2009
2086
|
finalArkTx: data.finalArkTx,
|
|
@@ -2028,7 +2105,7 @@ var RestArkProvider = class {
|
|
|
2028
2105
|
{
|
|
2029
2106
|
intent: {
|
|
2030
2107
|
proof: intent.proof,
|
|
2031
|
-
message: exports.
|
|
2108
|
+
message: exports.Proof.encodeMessage(intent.message)
|
|
2032
2109
|
}
|
|
2033
2110
|
},
|
|
2034
2111
|
(errorText) => `Failed to register intent: ${errorText}`
|
|
@@ -2043,7 +2120,7 @@ var RestArkProvider = class {
|
|
|
2043
2120
|
{
|
|
2044
2121
|
intent: {
|
|
2045
2122
|
proof: intent.proof,
|
|
2046
|
-
message: exports.
|
|
2123
|
+
message: exports.Proof.encodeMessage(intent.message)
|
|
2047
2124
|
}
|
|
2048
2125
|
},
|
|
2049
2126
|
(errorText) => `Failed to delete intent: ${errorText}`
|
|
@@ -2106,7 +2183,10 @@ var RestArkProvider = class {
|
|
|
2106
2183
|
try {
|
|
2107
2184
|
while (!signal?.aborted) {
|
|
2108
2185
|
const currentIterator = eventSourceIterator(
|
|
2109
|
-
resolveEventSource(self.eventSource)(
|
|
2186
|
+
resolveEventSource(self.eventSource)(
|
|
2187
|
+
url + queryParams,
|
|
2188
|
+
ARKADE_VERSION_HEADERS
|
|
2189
|
+
)
|
|
2110
2190
|
);
|
|
2111
2191
|
iterator = currentIterator;
|
|
2112
2192
|
try {
|
|
@@ -2166,7 +2246,7 @@ var RestArkProvider = class {
|
|
|
2166
2246
|
while (!signal?.aborted) {
|
|
2167
2247
|
try {
|
|
2168
2248
|
const currentIterator = eventSourceIterator(
|
|
2169
|
-
resolveEventSource(self.eventSource)(url)
|
|
2249
|
+
resolveEventSource(self.eventSource)(url, ARKADE_VERSION_HEADERS)
|
|
2170
2250
|
);
|
|
2171
2251
|
iterator = currentIterator;
|
|
2172
2252
|
for await (const event of currentIterator) {
|
|
@@ -2220,7 +2300,7 @@ var RestArkProvider = class {
|
|
|
2220
2300
|
{
|
|
2221
2301
|
intent: {
|
|
2222
2302
|
proof: intent.proof,
|
|
2223
|
-
message: exports.
|
|
2303
|
+
message: exports.Proof.encodeMessage(intent.message)
|
|
2224
2304
|
}
|
|
2225
2305
|
},
|
|
2226
2306
|
(errorText) => `Failed to get pending transactions: ${errorText}`
|
|
@@ -2412,6 +2492,7 @@ function handleError(errorText, defaultMessage) {
|
|
|
2412
2492
|
const arkError = maybeArkError(error);
|
|
2413
2493
|
throw arkError ?? new Error(defaultMessage);
|
|
2414
2494
|
}
|
|
2495
|
+
var RestArkProvider = RestOperatorProvider;
|
|
2415
2496
|
|
|
2416
2497
|
// src/providers/availability.ts
|
|
2417
2498
|
function isRetryableProviderError(error) {
|
|
@@ -2600,6 +2681,7 @@ exports.EXPIRY_MIN_PLAUSIBLE_MS = EXPIRY_MIN_PLAUSIBLE_MS;
|
|
|
2600
2681
|
exports.EventSourceUnavailableError = EventSourceUnavailableError;
|
|
2601
2682
|
exports.FetchError = FetchError;
|
|
2602
2683
|
exports.INFO_FETCH_TIMEOUT_MS = INFO_FETCH_TIMEOUT_MS;
|
|
2684
|
+
exports.Intent = Intent;
|
|
2603
2685
|
exports.MUTINYNET_EMULATOR_PUBKEY = MUTINYNET_EMULATOR_PUBKEY;
|
|
2604
2686
|
exports.OP_RETURN_EMPTY_PKSCRIPT = OP_RETURN_EMPTY_PKSCRIPT;
|
|
2605
2687
|
exports.PrevArkTxField = PrevArkTxField;
|
|
@@ -2608,6 +2690,7 @@ exports.ProviderUnavailableError = ProviderUnavailableError;
|
|
|
2608
2690
|
exports.READ_TIMEOUT_MS = READ_TIMEOUT_MS;
|
|
2609
2691
|
exports.REGTEST_EMULATOR_PUBKEY = REGTEST_EMULATOR_PUBKEY;
|
|
2610
2692
|
exports.RestArkProvider = RestArkProvider;
|
|
2693
|
+
exports.RestOperatorProvider = RestOperatorProvider;
|
|
2611
2694
|
exports.SCRIPT_QUERY_CHUNK_SIZE = SCRIPT_QUERY_CHUNK_SIZE;
|
|
2612
2695
|
exports.ServerResponseMismatchError = ServerResponseMismatchError;
|
|
2613
2696
|
exports.SettlementEventType = SettlementEventType;
|
|
@@ -2650,9 +2733,11 @@ exports.isVirtualCoin = isVirtualCoin;
|
|
|
2650
2733
|
exports.isVtxoSpent = isVtxoSpent;
|
|
2651
2734
|
exports.maybeArkError = maybeArkError;
|
|
2652
2735
|
exports.networkFromArkadeInfo = networkFromArkadeInfo;
|
|
2736
|
+
exports.networkFromOperatorInfo = networkFromOperatorInfo;
|
|
2653
2737
|
exports.networks = networks;
|
|
2654
2738
|
exports.normalizeVtxo = normalizeVtxo;
|
|
2655
2739
|
exports.rateGate = rateGate;
|
|
2740
|
+
exports.readSseFrames = readSseFrames;
|
|
2656
2741
|
exports.requiresForfeit = requiresForfeit;
|
|
2657
2742
|
exports.resolveEmulatorPubkey = resolveEmulatorPubkey;
|
|
2658
2743
|
exports.resolveEventSource = resolveEventSource;
|
|
@@ -2668,5 +2753,5 @@ exports.timelockToSequence = timelockToSequence;
|
|
|
2668
2753
|
exports.toBIP371TapTree = toBIP371TapTree;
|
|
2669
2754
|
exports.toOffchainInputFeeParams = toOffchainInputFeeParams;
|
|
2670
2755
|
exports.toProviderUnavailable = toProviderUnavailable;
|
|
2671
|
-
//# sourceMappingURL=chunk-
|
|
2672
|
-
//# sourceMappingURL=chunk-
|
|
2756
|
+
//# sourceMappingURL=chunk-GHUUT54D.cjs.map
|
|
2757
|
+
//# sourceMappingURL=chunk-GHUUT54D.cjs.map
|