@arkade-os/sdk 0.4.64 → 0.4.65
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/dist/adapters/expo.cjs +5 -5
- package/dist/adapters/expo.js +3 -3
- package/dist/adapters/indexedDB.cjs +5 -5
- package/dist/adapters/indexedDB.js +4 -4
- package/dist/{chunk-HQ2DDMQN.js → chunk-3G5V564P.js} +141 -3
- package/dist/chunk-3G5V564P.js.map +1 -0
- package/dist/{chunk-WJN2BLEI.js → chunk-5YTSQSLE.js} +226 -353
- package/dist/chunk-5YTSQSLE.js.map +1 -0
- package/dist/{chunk-35YIP6OA.cjs → chunk-7X744EFF.cjs} +10 -10
- package/dist/{chunk-35YIP6OA.cjs.map → chunk-7X744EFF.cjs.map} +1 -1
- package/dist/{chunk-WXCVS6PD.cjs → chunk-BABJ77NG.cjs} +196 -57
- package/dist/chunk-BABJ77NG.cjs.map +1 -0
- package/dist/{chunk-FZFSGOTZ.cjs → chunk-G552MISJ.cjs} +3 -3
- package/dist/{chunk-FZFSGOTZ.cjs.map → chunk-G552MISJ.cjs.map} +1 -1
- package/dist/{chunk-LPEE2H2M.cjs → chunk-GFZNEMGL.cjs} +629 -748
- package/dist/chunk-GFZNEMGL.cjs.map +1 -0
- package/dist/{chunk-USXWE2EJ.js → chunk-RESN6QHP.js} +4 -4
- package/dist/{chunk-USXWE2EJ.js.map → chunk-RESN6QHP.js.map} +1 -1
- package/dist/{chunk-4N45WCSJ.cjs → chunk-SJQM5AVB.cjs} +17 -17
- package/dist/{chunk-4N45WCSJ.cjs.map → chunk-SJQM5AVB.cjs.map} +1 -1
- package/dist/{chunk-XJCBV4AA.js → chunk-TFSVXMTM.js} +3 -3
- package/dist/{chunk-XJCBV4AA.js.map → chunk-TFSVXMTM.js.map} +1 -1
- package/dist/{chunk-ZUEGFM3T.js → chunk-TYTPVPKD.js} +4 -4
- package/dist/{chunk-ZUEGFM3T.js.map → chunk-TYTPVPKD.js.map} +1 -1
- package/dist/{chunk-LN2VZP63.js → chunk-XMOIRDLF.js} +151 -12
- package/dist/chunk-XMOIRDLF.js.map +1 -0
- package/dist/{chunk-RXITDAV4.cjs → chunk-XN55B6EP.cjs} +155 -17
- package/dist/chunk-XN55B6EP.cjs.map +1 -0
- package/dist/contracts/handlers/index.cjs +9 -9
- package/dist/contracts/handlers/index.d.cts +1 -1
- package/dist/contracts/handlers/index.d.ts +1 -1
- package/dist/contracts/handlers/index.js +2 -2
- package/dist/{index-aZycGEsQ.d.cts → index-BtTtQFUX.d.cts} +109 -0
- package/dist/{index-Bxe9kBFs.d.ts → index-fDDiA1-L.d.ts} +109 -0
- package/dist/index.cjs +300 -268
- package/dist/index.d.cts +187 -13
- package/dist/index.d.ts +187 -13
- package/dist/index.js +4 -4
- package/dist/repositories/realm/index.cjs +19 -19
- package/dist/repositories/realm/index.js +5 -5
- package/dist/repositories/sqlite/index.cjs +18 -18
- package/dist/repositories/sqlite/index.js +5 -5
- package/dist/wallet/expo/background.cjs +14 -14
- package/dist/wallet/expo/background.js +6 -6
- package/dist/wallet/expo/index.cjs +14 -14
- package/dist/wallet/expo/index.js +5 -5
- package/dist/worker/expo/index.cjs +9 -9
- package/dist/worker/expo/index.js +5 -5
- package/package.json +1 -1
- package/dist/chunk-HQ2DDMQN.js.map +0 -1
- package/dist/chunk-LN2VZP63.js.map +0 -1
- package/dist/chunk-LPEE2H2M.cjs.map +0 -1
- package/dist/chunk-RXITDAV4.cjs.map +0 -1
- package/dist/chunk-WJN2BLEI.js.map +0 -1
- package/dist/chunk-WXCVS6PD.cjs.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkG552MISJ_cjs = require('./chunk-G552MISJ.cjs');
|
|
4
4
|
var chunk5BLDMQED_cjs = require('./chunk-5BLDMQED.cjs');
|
|
5
5
|
var base = require('@scure/base');
|
|
6
6
|
var secp256k1_js = require('@noble/curves/secp256k1.js');
|
|
@@ -9,6 +9,7 @@ var utils_js = require('@scure/btc-signer/utils.js');
|
|
|
9
9
|
// src/extension/asset/index.ts
|
|
10
10
|
var asset_exports = {};
|
|
11
11
|
chunk5BLDMQED_cjs.__export(asset_exports, {
|
|
12
|
+
ASSET_ID_VECTORS: () => ASSET_ID_VECTORS,
|
|
12
13
|
AssetGroup: () => AssetGroup,
|
|
13
14
|
AssetId: () => AssetId,
|
|
14
15
|
AssetInput: () => AssetInput,
|
|
@@ -1273,6 +1274,143 @@ var Packet = class _Packet {
|
|
|
1273
1274
|
return packet;
|
|
1274
1275
|
}
|
|
1275
1276
|
};
|
|
1277
|
+
|
|
1278
|
+
// src/extension/asset/assetIdVectors.json
|
|
1279
|
+
var assetIdVectors_default = {
|
|
1280
|
+
version: 1,
|
|
1281
|
+
note: "Source of truth for the Arkade Asset ID encodings. See ts-sdk plans/asset-id-shared-vectors.md.",
|
|
1282
|
+
txid_hex: "0102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20",
|
|
1283
|
+
script_txid_hex: "201f1e1d1c1b1a191817161514131211100f0e0d0c0b0a090807060504030201",
|
|
1284
|
+
valid: [
|
|
1285
|
+
{
|
|
1286
|
+
label: "group 0 (issuance mints this one)",
|
|
1287
|
+
group_index: 0,
|
|
1288
|
+
asset_id_hex: "0102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f200000",
|
|
1289
|
+
script_group_index_item_hex: ""
|
|
1290
|
+
},
|
|
1291
|
+
{
|
|
1292
|
+
label: "group 1 \u2014 high byte zero, so endianness bugs hide here",
|
|
1293
|
+
group_index: 1,
|
|
1294
|
+
asset_id_hex: "0102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f200100",
|
|
1295
|
+
script_group_index_item_hex: "01"
|
|
1296
|
+
},
|
|
1297
|
+
{
|
|
1298
|
+
label: "endianness discriminator (gidx 258 = 0x0102)",
|
|
1299
|
+
group_index: 258,
|
|
1300
|
+
asset_id_hex: "0102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f200201",
|
|
1301
|
+
script_group_index_item_hex: "0201"
|
|
1302
|
+
},
|
|
1303
|
+
{
|
|
1304
|
+
label: "upper bound \u2014 script number needs a third byte, the u16 blob does not",
|
|
1305
|
+
group_index: 65535,
|
|
1306
|
+
asset_id_hex: "0102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20ffff",
|
|
1307
|
+
script_group_index_item_hex: "ffff00"
|
|
1308
|
+
}
|
|
1309
|
+
],
|
|
1310
|
+
invalid_identity: [
|
|
1311
|
+
{
|
|
1312
|
+
label: "uppercase",
|
|
1313
|
+
value: "0102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F200201",
|
|
1314
|
+
why: "identity is lowercase-only",
|
|
1315
|
+
normalizes_to: "0102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f200201"
|
|
1316
|
+
},
|
|
1317
|
+
{
|
|
1318
|
+
label: "too short",
|
|
1319
|
+
value: "0102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f2002",
|
|
1320
|
+
why: "33 bytes; the identity is 34"
|
|
1321
|
+
},
|
|
1322
|
+
{
|
|
1323
|
+
label: "non-hex",
|
|
1324
|
+
value: "z102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f200201",
|
|
1325
|
+
why: "ASCII hex only"
|
|
1326
|
+
}
|
|
1327
|
+
],
|
|
1328
|
+
invalid_decode: [
|
|
1329
|
+
{
|
|
1330
|
+
label: "empty",
|
|
1331
|
+
value: "",
|
|
1332
|
+
expected_error: "missing asset id"
|
|
1333
|
+
},
|
|
1334
|
+
{
|
|
1335
|
+
label: "too short",
|
|
1336
|
+
value: "0102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f2002",
|
|
1337
|
+
expected_error: "invalid asset id length"
|
|
1338
|
+
},
|
|
1339
|
+
{
|
|
1340
|
+
label: "too long",
|
|
1341
|
+
value: "0102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f200201ff",
|
|
1342
|
+
expected_error: "invalid asset id length"
|
|
1343
|
+
},
|
|
1344
|
+
{
|
|
1345
|
+
label: "non-hex",
|
|
1346
|
+
value: "z102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f200201",
|
|
1347
|
+
expected_error: "invalid asset id format"
|
|
1348
|
+
},
|
|
1349
|
+
{
|
|
1350
|
+
label: "zero txid",
|
|
1351
|
+
value: "00000000000000000000000000000000000000000000000000000000000000000201",
|
|
1352
|
+
expected_error: "empty txid"
|
|
1353
|
+
}
|
|
1354
|
+
],
|
|
1355
|
+
invalid_construction: [
|
|
1356
|
+
{
|
|
1357
|
+
label: "missing txid",
|
|
1358
|
+
txid_hex: "",
|
|
1359
|
+
group_index: 0,
|
|
1360
|
+
expected_error: "missing txid"
|
|
1361
|
+
},
|
|
1362
|
+
{
|
|
1363
|
+
label: "non-hex txid",
|
|
1364
|
+
txid_hex: "z102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20",
|
|
1365
|
+
group_index: 0,
|
|
1366
|
+
expected_error: "invalid txid format"
|
|
1367
|
+
},
|
|
1368
|
+
{
|
|
1369
|
+
label: "txid too long",
|
|
1370
|
+
txid_hex: "0102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f2021",
|
|
1371
|
+
group_index: 0,
|
|
1372
|
+
expected_error: "invalid txid length"
|
|
1373
|
+
},
|
|
1374
|
+
{
|
|
1375
|
+
label: "txid too short",
|
|
1376
|
+
txid_hex: "0102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e",
|
|
1377
|
+
group_index: 0,
|
|
1378
|
+
expected_error: "invalid txid length"
|
|
1379
|
+
},
|
|
1380
|
+
{
|
|
1381
|
+
label: "zero txid",
|
|
1382
|
+
txid_hex: "0000000000000000000000000000000000000000000000000000000000000000",
|
|
1383
|
+
group_index: 0,
|
|
1384
|
+
expected_error: "empty txid"
|
|
1385
|
+
},
|
|
1386
|
+
{
|
|
1387
|
+
label: "gidx out of range",
|
|
1388
|
+
txid_hex: "0102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20",
|
|
1389
|
+
group_index: 65536,
|
|
1390
|
+
expected_error: "invalid group index",
|
|
1391
|
+
outside_uint16: true
|
|
1392
|
+
},
|
|
1393
|
+
{
|
|
1394
|
+
label: "gidx negative",
|
|
1395
|
+
txid_hex: "0102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20",
|
|
1396
|
+
group_index: -1,
|
|
1397
|
+
expected_error: "invalid group index",
|
|
1398
|
+
outside_uint16: true
|
|
1399
|
+
}
|
|
1400
|
+
]
|
|
1401
|
+
};
|
|
1402
|
+
|
|
1403
|
+
// src/extension/asset/assetIdVectors.ts
|
|
1404
|
+
function deepFreeze(value) {
|
|
1405
|
+
if (value !== null && typeof value === "object" && !Object.isFrozen(value)) {
|
|
1406
|
+
Object.freeze(value);
|
|
1407
|
+
for (const key of Object.getOwnPropertyNames(value)) {
|
|
1408
|
+
deepFreeze(value[key]);
|
|
1409
|
+
}
|
|
1410
|
+
}
|
|
1411
|
+
return value;
|
|
1412
|
+
}
|
|
1413
|
+
var ASSET_ID_VECTORS = deepFreeze(assetIdVectors_default);
|
|
1276
1414
|
var INDEXER_MAX_ATTEMPTS = 3;
|
|
1277
1415
|
var INDEXER_RETRY_BASE_MS = 250;
|
|
1278
1416
|
async function indexerFetch(input, init) {
|
|
@@ -1282,10 +1420,10 @@ async function indexerFetch(input, init) {
|
|
|
1282
1420
|
const lastAttempt = attempt >= maxAttempts;
|
|
1283
1421
|
let res;
|
|
1284
1422
|
try {
|
|
1285
|
-
res = await
|
|
1423
|
+
res = await chunkG552MISJ_cjs.rateGate.runHttp(input, () => chunkG552MISJ_cjs.baseFetch(input, init));
|
|
1286
1424
|
} catch (err) {
|
|
1287
|
-
const mapped =
|
|
1288
|
-
if (lastAttempt || !(mapped instanceof
|
|
1425
|
+
const mapped = chunkG552MISJ_cjs.toProviderUnavailable(err, "indexer");
|
|
1426
|
+
if (lastAttempt || !(mapped instanceof chunkG552MISJ_cjs.ProviderUnavailableError)) throw mapped;
|
|
1289
1427
|
await sleep(retryDelayMs(attempt));
|
|
1290
1428
|
continue;
|
|
1291
1429
|
}
|
|
@@ -1297,7 +1435,7 @@ async function indexerFetch(input, init) {
|
|
|
1297
1435
|
body = void 0;
|
|
1298
1436
|
}
|
|
1299
1437
|
try {
|
|
1300
|
-
|
|
1438
|
+
chunkG552MISJ_cjs.throwIfHttpUnavailable(res, "indexer", body);
|
|
1301
1439
|
} catch (err) {
|
|
1302
1440
|
if (lastAttempt) throw err;
|
|
1303
1441
|
await sleep(retryDelayMs(attempt));
|
|
@@ -1325,7 +1463,7 @@ var ChainTxType = /* @__PURE__ */ ((ChainTxType2) => {
|
|
|
1325
1463
|
return ChainTxType2;
|
|
1326
1464
|
})(ChainTxType || {});
|
|
1327
1465
|
var RestIndexerProvider = class {
|
|
1328
|
-
constructor(serverUrl =
|
|
1466
|
+
constructor(serverUrl = chunkG552MISJ_cjs.DEFAULT_ARKADE_SERVER_URL, options = {}) {
|
|
1329
1467
|
this.serverUrl = serverUrl;
|
|
1330
1468
|
this.eventSource = options.eventSource;
|
|
1331
1469
|
}
|
|
@@ -1461,8 +1599,8 @@ var RestIndexerProvider = class {
|
|
|
1461
1599
|
try {
|
|
1462
1600
|
while (!abortSignal?.aborted) {
|
|
1463
1601
|
try {
|
|
1464
|
-
const currentIterator =
|
|
1465
|
-
|
|
1602
|
+
const currentIterator = chunkG552MISJ_cjs.eventSourceIterator(
|
|
1603
|
+
chunkG552MISJ_cjs.resolveEventSource(override)(url)
|
|
1466
1604
|
);
|
|
1467
1605
|
iterator = currentIterator;
|
|
1468
1606
|
for await (const event of currentIterator) {
|
|
@@ -1473,9 +1611,9 @@ var RestIndexerProvider = class {
|
|
|
1473
1611
|
yield {
|
|
1474
1612
|
txid: data.event.txid,
|
|
1475
1613
|
scripts: data.event.scripts || [],
|
|
1476
|
-
newVtxos: (data.event.newVtxos || []).map(
|
|
1477
|
-
spentVtxos: (data.event.spentVtxos || []).map(
|
|
1478
|
-
sweptVtxos: (data.event.sweptVtxos || []).map(
|
|
1614
|
+
newVtxos: (data.event.newVtxos || []).map(chunkG552MISJ_cjs.convertVtxo),
|
|
1615
|
+
spentVtxos: (data.event.spentVtxos || []).map(chunkG552MISJ_cjs.convertVtxo),
|
|
1616
|
+
sweptVtxos: (data.event.sweptVtxos || []).map(chunkG552MISJ_cjs.convertVtxo),
|
|
1479
1617
|
tx: data.event.tx,
|
|
1480
1618
|
checkpointTxs: data.event.checkpointTxs
|
|
1481
1619
|
};
|
|
@@ -1489,14 +1627,14 @@ var RestIndexerProvider = class {
|
|
|
1489
1627
|
if (abortSignal?.aborted || error instanceof Error && error.name === "AbortError") {
|
|
1490
1628
|
break;
|
|
1491
1629
|
}
|
|
1492
|
-
if (
|
|
1630
|
+
if (chunkG552MISJ_cjs.isFetchTimeoutError(error)) {
|
|
1493
1631
|
console.debug("Timeout error ignored");
|
|
1494
1632
|
continue;
|
|
1495
1633
|
}
|
|
1496
|
-
if (
|
|
1634
|
+
if (chunkG552MISJ_cjs.isEventSourceError(error)) {
|
|
1497
1635
|
throw error;
|
|
1498
1636
|
}
|
|
1499
|
-
if (
|
|
1637
|
+
if (chunkG552MISJ_cjs.isEventSourceUnavailableError(error)) throw error;
|
|
1500
1638
|
console.error("Subscription error:", error);
|
|
1501
1639
|
throw error;
|
|
1502
1640
|
} finally {
|
|
@@ -1622,7 +1760,7 @@ var RestIndexerProvider = class {
|
|
|
1622
1760
|
throw new Error("Invalid vtxos data received");
|
|
1623
1761
|
}
|
|
1624
1762
|
return {
|
|
1625
|
-
vtxos: data.vtxos.map(
|
|
1763
|
+
vtxos: data.vtxos.map(chunkG552MISJ_cjs.convertVtxo),
|
|
1626
1764
|
page: data.page
|
|
1627
1765
|
};
|
|
1628
1766
|
}
|
|
@@ -1804,5 +1942,5 @@ exports.Metadata = Metadata;
|
|
|
1804
1942
|
exports.Packet = Packet;
|
|
1805
1943
|
exports.RestIndexerProvider = RestIndexerProvider;
|
|
1806
1944
|
exports.asset_exports = asset_exports;
|
|
1807
|
-
//# sourceMappingURL=chunk-
|
|
1808
|
-
//# sourceMappingURL=chunk-
|
|
1945
|
+
//# sourceMappingURL=chunk-XN55B6EP.cjs.map
|
|
1946
|
+
//# sourceMappingURL=chunk-XN55B6EP.cjs.map
|