@orbinum/sdk 0.12.0 → 0.13.0
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/index.d.mts +1 -532
- package/dist/index.d.ts +1 -532
- package/dist/index.js +2 -404
- package/dist/index.mjs +2 -403
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -35,7 +35,6 @@ __export(index_exports, {
|
|
|
35
35
|
EncryptedMemo: () => EncryptedMemo,
|
|
36
36
|
EvmClient: () => EvmClient,
|
|
37
37
|
EvmExplorer: () => EvmExplorer,
|
|
38
|
-
IndexerClient: () => IndexerClient,
|
|
39
38
|
KNOWN_PRECOMPILES: () => KNOWN_PRECOMPILES,
|
|
40
39
|
Keccak256: () => import_substrate_bindings3.Keccak256,
|
|
41
40
|
NoteBuilder: () => NoteBuilder,
|
|
@@ -1151,397 +1150,6 @@ var EvmExplorer = class _EvmExplorer {
|
|
|
1151
1150
|
}
|
|
1152
1151
|
};
|
|
1153
1152
|
|
|
1154
|
-
// src/indexer/IndexerClient.ts
|
|
1155
|
-
var LOCAL_HOSTS = /* @__PURE__ */ new Set(["localhost", "127.0.0.1", "[::1]", "::1"]);
|
|
1156
|
-
function normalizeBaseUrl(baseUrl) {
|
|
1157
|
-
let url;
|
|
1158
|
-
try {
|
|
1159
|
-
url = new URL(baseUrl);
|
|
1160
|
-
} catch {
|
|
1161
|
-
throw new Error(`IndexerClient: invalid baseUrl ${JSON.stringify(baseUrl)}`);
|
|
1162
|
-
}
|
|
1163
|
-
const isLocal = LOCAL_HOSTS.has(url.hostname);
|
|
1164
|
-
if (url.protocol !== "https:" && !(url.protocol === "http:" && isLocal)) {
|
|
1165
|
-
throw new Error(
|
|
1166
|
-
`IndexerClient: baseUrl must use https:// (got ${url.protocol}//${url.hostname}). Plain http is only allowed for localhost.`
|
|
1167
|
-
);
|
|
1168
|
-
}
|
|
1169
|
-
return baseUrl.replace(/\/$/, "");
|
|
1170
|
-
}
|
|
1171
|
-
var IndexerClient = class _IndexerClient {
|
|
1172
|
-
baseUrl;
|
|
1173
|
-
timeoutMs;
|
|
1174
|
-
constructor(config) {
|
|
1175
|
-
this.baseUrl = normalizeBaseUrl(config.baseUrl);
|
|
1176
|
-
this.timeoutMs = config.timeoutMs ?? 1e4;
|
|
1177
|
-
}
|
|
1178
|
-
// ─── Internal helpers ──────────────────────────────────────────────────────
|
|
1179
|
-
async _fetchResponse(path) {
|
|
1180
|
-
const controller = new AbortController();
|
|
1181
|
-
const timer = setTimeout(() => controller.abort(), this.timeoutMs);
|
|
1182
|
-
try {
|
|
1183
|
-
return await fetch(`${this.baseUrl}${path}`, { signal: controller.signal });
|
|
1184
|
-
} finally {
|
|
1185
|
-
clearTimeout(timer);
|
|
1186
|
-
}
|
|
1187
|
-
}
|
|
1188
|
-
async get(path) {
|
|
1189
|
-
const res = await this._fetchResponse(path);
|
|
1190
|
-
if (!res.ok) {
|
|
1191
|
-
throw new Error(`IndexerClient: HTTP ${res.status} for ${path}`);
|
|
1192
|
-
}
|
|
1193
|
-
return res.json();
|
|
1194
|
-
}
|
|
1195
|
-
async getOrNull(path) {
|
|
1196
|
-
const res = await this._fetchResponse(path);
|
|
1197
|
-
if (res.status === 404) return null;
|
|
1198
|
-
if (!res.ok) {
|
|
1199
|
-
throw new Error(`IndexerClient: HTTP ${res.status} for ${path}`);
|
|
1200
|
-
}
|
|
1201
|
-
return res.json();
|
|
1202
|
-
}
|
|
1203
|
-
buildQuery(params) {
|
|
1204
|
-
const entries = Object.entries(params).filter(([, v]) => v !== void 0);
|
|
1205
|
-
if (entries.length === 0) return "";
|
|
1206
|
-
const qs = entries.map(([k, v]) => `${encodeURIComponent(k)}=${encodeURIComponent(String(v))}`).join("&");
|
|
1207
|
-
return `?${qs}`;
|
|
1208
|
-
}
|
|
1209
|
-
// ─── Commitments ───────────────────────────────────────────────────────────
|
|
1210
|
-
/** Returns the total count of shielded commitments. */
|
|
1211
|
-
async getCommitmentsCount() {
|
|
1212
|
-
const res = await this.get("/shielded/commitments/count");
|
|
1213
|
-
return res.total;
|
|
1214
|
-
}
|
|
1215
|
-
/** Returns a paginated list of shielded commitments. */
|
|
1216
|
-
async getCommitments(params) {
|
|
1217
|
-
const qs = this.buildQuery({
|
|
1218
|
-
page: params?.page,
|
|
1219
|
-
limit: params?.limit,
|
|
1220
|
-
since_leaf_index: params?.sinceLeafIndex
|
|
1221
|
-
});
|
|
1222
|
-
return this.get(`/shielded/commitments${qs}`);
|
|
1223
|
-
}
|
|
1224
|
-
/** Returns a single commitment by its hex string, or null if not found. */
|
|
1225
|
-
async getCommitmentByHex(hex) {
|
|
1226
|
-
return this.getOrNull(
|
|
1227
|
-
`/shielded/commitments/${encodeURIComponent(hex)}`
|
|
1228
|
-
);
|
|
1229
|
-
}
|
|
1230
|
-
/**
|
|
1231
|
-
* Returns a paginated list of stealth scan hints ordered ascending by leafIndex.
|
|
1232
|
-
* Each hint contains only the fields required for ECDH triage and decryption:
|
|
1233
|
-
* leafIndex, commitmentHex, assetId, ephPkHex, encryptedMemo, circuitVersion.
|
|
1234
|
-
*
|
|
1235
|
-
* Use `sinceLeafIndex` for incremental scans (cursor = last seen leafIndex + 1).
|
|
1236
|
-
*/
|
|
1237
|
-
async getScanHints(params) {
|
|
1238
|
-
const qs = this.buildQuery({
|
|
1239
|
-
page: params?.page,
|
|
1240
|
-
limit: params?.limit,
|
|
1241
|
-
since_leaf_index: params?.sinceLeafIndex
|
|
1242
|
-
});
|
|
1243
|
-
return this.get(`/shielded/scan-hints${qs}`);
|
|
1244
|
-
}
|
|
1245
|
-
// ─── Nullifiers ────────────────────────────────────────────────────────────
|
|
1246
|
-
/** Returns a paginated list of spent nullifiers. */
|
|
1247
|
-
async getNullifiers(params) {
|
|
1248
|
-
const qs = this.buildQuery({ page: params?.page, limit: params?.limit });
|
|
1249
|
-
return this.get(`/shielded/nullifiers${qs}`);
|
|
1250
|
-
}
|
|
1251
|
-
/** Returns the spent/unspent status of a nullifier. */
|
|
1252
|
-
async getNullifierStatus(hex) {
|
|
1253
|
-
return this.get(
|
|
1254
|
-
`/shielded/nullifier/${encodeURIComponent(hex)}/status`
|
|
1255
|
-
);
|
|
1256
|
-
}
|
|
1257
|
-
/**
|
|
1258
|
-
* Downloads the full spent nullifier set and returns it as a Set of lowercase hex strings.
|
|
1259
|
-
*
|
|
1260
|
-
* The server sees an identical GET request regardless of which notes the wallet holds —
|
|
1261
|
-
* the intersection is computed locally (PIR-A privacy model).
|
|
1262
|
-
*
|
|
1263
|
-
* Kept as the FALLBACK for readers that don't serve sealed chunks yet (and for
|
|
1264
|
-
* small sets). New integrations should prefer the incremental chunk flow:
|
|
1265
|
-
* `getNullifierManifest` → `getNullifierChunk` for missing chunks →
|
|
1266
|
-
* `getNullifierTail`, persisting the set locally between rescans.
|
|
1267
|
-
*/
|
|
1268
|
-
async getAllSpentNullifiers() {
|
|
1269
|
-
const res = await this.get("/shielded/nullifiers/all");
|
|
1270
|
-
return new Set(res.data.map((h) => h.toLowerCase()));
|
|
1271
|
-
}
|
|
1272
|
-
/**
|
|
1273
|
-
* Universal index of the sealed nullifier chunks — identical request and
|
|
1274
|
-
* response for every caller (no client-supplied position: PIR-A preserved).
|
|
1275
|
-
*
|
|
1276
|
-
* Returns `null` when the reader does not serve chunks yet (404) — the
|
|
1277
|
-
* caller should fall back to `getAllSpentNullifiers`.
|
|
1278
|
-
*/
|
|
1279
|
-
async getNullifierManifest() {
|
|
1280
|
-
return this.getOrNull("/shielded/nullifiers/manifest");
|
|
1281
|
-
}
|
|
1282
|
-
/**
|
|
1283
|
-
* One sealed, immutable chunk of the spent-nullifier set (ascending hex,
|
|
1284
|
-
* lowercased). The digest comes from the manifest and lives in the URL, so
|
|
1285
|
-
* a corrected chunk is a different URL — safe to cache forever client-side.
|
|
1286
|
-
*/
|
|
1287
|
-
async getNullifierChunk(idx, digest) {
|
|
1288
|
-
const res = await this.get(
|
|
1289
|
-
`/shielded/nullifiers/chunks/${idx}/${encodeURIComponent(digest)}`
|
|
1290
|
-
);
|
|
1291
|
-
return res.data.map((h) => h.toLowerCase());
|
|
1292
|
-
}
|
|
1293
|
-
/**
|
|
1294
|
-
* The mutable remainder of the nullifier set after the last sealed chunk.
|
|
1295
|
-
* Identical request for every caller (no input). `afterChunks` lets the
|
|
1296
|
-
* client detect a chunk sealed between its manifest fetch and this one.
|
|
1297
|
-
*/
|
|
1298
|
-
async getNullifierTail() {
|
|
1299
|
-
const res = await this.get("/shielded/nullifiers/tail");
|
|
1300
|
-
return { afterChunks: res.afterChunks, data: res.data.map((h) => h.toLowerCase()) };
|
|
1301
|
-
}
|
|
1302
|
-
// ─── Private transfers ─────────────────────────────────────────────────────
|
|
1303
|
-
/** Server-enforced max items per by-nullifiers / by-commitments request. */
|
|
1304
|
-
static TRANSFER_LOOKUP_CHUNK = 50;
|
|
1305
|
-
/**
|
|
1306
|
-
* Chunked fetch for the transfer timestamp lookups. The reader silently
|
|
1307
|
-
* truncates each request to 50 items, so larger inputs MUST be split or
|
|
1308
|
-
* results are silently lost. Responses are merged per extrinsic
|
|
1309
|
-
* (`blockNumber:extrinsicIndex`), concatenating the matched arrays, and
|
|
1310
|
-
* sorted by block descending.
|
|
1311
|
-
*
|
|
1312
|
-
* Privacy note: these lookups send the wallet's own note identifiers to
|
|
1313
|
-
* the indexer — a bounded, documented linkage tradeoff for timestamp
|
|
1314
|
-
* recovery. They are NEVER used for spent-STATUS checks (PIR-A: status
|
|
1315
|
-
* comes from the anonymous full-set `/shielded/nullifiers/all` download).
|
|
1316
|
-
*/
|
|
1317
|
-
async fetchTransfersChunked(path, param, items, matchedField) {
|
|
1318
|
-
if (items.length === 0) return [];
|
|
1319
|
-
const normalized = items.map((i) => i.toLowerCase());
|
|
1320
|
-
const chunks = [];
|
|
1321
|
-
for (let i = 0; i < normalized.length; i += _IndexerClient.TRANSFER_LOOKUP_CHUNK) {
|
|
1322
|
-
chunks.push(normalized.slice(i, i + _IndexerClient.TRANSFER_LOOKUP_CHUNK));
|
|
1323
|
-
}
|
|
1324
|
-
const responses = await Promise.all(
|
|
1325
|
-
chunks.map((chunk) => {
|
|
1326
|
-
const qs = this.buildQuery({ [param]: chunk.join(",") });
|
|
1327
|
-
return this.get(
|
|
1328
|
-
`${path}${qs}`
|
|
1329
|
-
);
|
|
1330
|
-
})
|
|
1331
|
-
);
|
|
1332
|
-
const byExtrinsic = /* @__PURE__ */ new Map();
|
|
1333
|
-
for (const res of responses) {
|
|
1334
|
-
for (const transfer of res.data) {
|
|
1335
|
-
const key = `${transfer.blockNumber}:${transfer.extrinsicIndex ?? "null"}`;
|
|
1336
|
-
const existing = byExtrinsic.get(key);
|
|
1337
|
-
if (!existing) {
|
|
1338
|
-
byExtrinsic.set(key, transfer);
|
|
1339
|
-
continue;
|
|
1340
|
-
}
|
|
1341
|
-
const merged = /* @__PURE__ */ new Set([
|
|
1342
|
-
...existing[matchedField] ?? [],
|
|
1343
|
-
...transfer[matchedField] ?? []
|
|
1344
|
-
]);
|
|
1345
|
-
existing[matchedField] = [...merged];
|
|
1346
|
-
}
|
|
1347
|
-
}
|
|
1348
|
-
return [...byExtrinsic.values()].sort((a, b) => b.blockNumber - a.blockNumber);
|
|
1349
|
-
}
|
|
1350
|
-
/**
|
|
1351
|
-
* Returns temporal metadata for private transfers that spent any of the given nullifiers.
|
|
1352
|
-
* Only blockNumber, extrinsicIndex, timestampMs, and hash are returned — no cross-link
|
|
1353
|
-
* between inputs and outputs to prevent graph reconstruction.
|
|
1354
|
-
* Inputs of any size are transparently chunked into requests of 50 (the server cap)
|
|
1355
|
-
* and merged per extrinsic.
|
|
1356
|
-
*/
|
|
1357
|
-
async getTransfersByNullifiers(nullifiers) {
|
|
1358
|
-
return this.fetchTransfersChunked(
|
|
1359
|
-
"/shielded/transfers/by-nullifiers",
|
|
1360
|
-
"nullifiers",
|
|
1361
|
-
nullifiers,
|
|
1362
|
-
"matchedNullifiers"
|
|
1363
|
-
);
|
|
1364
|
-
}
|
|
1365
|
-
/**
|
|
1366
|
-
* Returns temporal metadata for private transfers that produced any of the given commitments.
|
|
1367
|
-
* Only blockNumber, extrinsicIndex, timestampMs, and hash are returned — no cross-link
|
|
1368
|
-
* between outputs and inputs to prevent graph reconstruction.
|
|
1369
|
-
* Inputs of any size are transparently chunked into requests of 50 (the server cap)
|
|
1370
|
-
* and merged per extrinsic.
|
|
1371
|
-
*/
|
|
1372
|
-
async getTransfersByCommitments(commitments) {
|
|
1373
|
-
return this.fetchTransfersChunked(
|
|
1374
|
-
"/shielded/transfers/by-commitments",
|
|
1375
|
-
"commitments",
|
|
1376
|
-
commitments,
|
|
1377
|
-
"matchedCommitments"
|
|
1378
|
-
);
|
|
1379
|
-
}
|
|
1380
|
-
// ─── Unshields ─────────────────────────────────────────────────────────────
|
|
1381
|
-
/** Returns a paginated list of unshield events. */
|
|
1382
|
-
async getUnshields(params) {
|
|
1383
|
-
const qs = this.buildQuery({ page: params?.page, limit: params?.limit });
|
|
1384
|
-
return this.get(`/shielded/unshields${qs}`);
|
|
1385
|
-
}
|
|
1386
|
-
// ─── Merkle roots ──────────────────────────────────────────────────────────
|
|
1387
|
-
/** Returns a paginated list of Merkle root checkpoints. */
|
|
1388
|
-
async getMerkleRoots(params) {
|
|
1389
|
-
const qs = this.buildQuery({ page: params?.page, limit: params?.limit });
|
|
1390
|
-
return this.get(`/shielded/merkle-roots${qs}`);
|
|
1391
|
-
}
|
|
1392
|
-
/** Returns the latest Merkle root, or null if none exists. */
|
|
1393
|
-
async getLatestMerkleRoot() {
|
|
1394
|
-
return this.getOrNull("/shielded/merkle-roots/latest");
|
|
1395
|
-
}
|
|
1396
|
-
// ─── Address activity ──────────────────────────────────────────────────────
|
|
1397
|
-
/** Returns a paginated list of extrinsics signed by the given address. */
|
|
1398
|
-
async getAddressExtrinsics(address, params) {
|
|
1399
|
-
const qs = this.buildQuery({ page: params?.page, limit: params?.limit });
|
|
1400
|
-
return this.get(
|
|
1401
|
-
`/address/${encodeURIComponent(address.toLowerCase())}/extrinsics${qs}`
|
|
1402
|
-
);
|
|
1403
|
-
}
|
|
1404
|
-
/** Returns a paginated list of EVM transactions filtered by address and/or block number. */
|
|
1405
|
-
async getEvmTransactions(params) {
|
|
1406
|
-
const qs = this.buildQuery({
|
|
1407
|
-
page: params?.page,
|
|
1408
|
-
limit: params?.limit,
|
|
1409
|
-
address: params?.address?.toLowerCase(),
|
|
1410
|
-
blockNumber: params?.blockNumber
|
|
1411
|
-
});
|
|
1412
|
-
return this.get(`/evm/transactions${qs}`);
|
|
1413
|
-
}
|
|
1414
|
-
/** Returns a single EVM transaction by hash, or null if not found. */
|
|
1415
|
-
async getEvmTransactionByHash(hash) {
|
|
1416
|
-
return this.getOrNull(
|
|
1417
|
-
`/evm/transactions/${encodeURIComponent(hash.toLowerCase())}`
|
|
1418
|
-
);
|
|
1419
|
-
}
|
|
1420
|
-
// ─── Blocks ────────────────────────────────────────────────────────────────
|
|
1421
|
-
/** Returns a paginated list of indexed blocks. */
|
|
1422
|
-
async getBlocks(params) {
|
|
1423
|
-
const qs = this.buildQuery({ page: params?.page, limit: params?.limit });
|
|
1424
|
-
return this.get(`/blocks${qs}`);
|
|
1425
|
-
}
|
|
1426
|
-
/** Returns a single block by number or hash, or null if not found. */
|
|
1427
|
-
async getBlock(numberOrHash) {
|
|
1428
|
-
return this.getOrNull(`/blocks/${encodeURIComponent(String(numberOrHash))}`);
|
|
1429
|
-
}
|
|
1430
|
-
// ─── Address-scoped shielded activity ─────────────────────────────────────
|
|
1431
|
-
/**
|
|
1432
|
-
* Returns a paginated list of unshield events where the given address is the recipient.
|
|
1433
|
-
* Accepts a 0x-prefixed EVM address or an SS58 Substrate address.
|
|
1434
|
-
*/
|
|
1435
|
-
async getAddressUnshields(address, params) {
|
|
1436
|
-
const qs = this.buildQuery({ page: params?.page, limit: params?.limit });
|
|
1437
|
-
return this.get(
|
|
1438
|
-
`/address/${encodeURIComponent(address)}/unshields${qs}`
|
|
1439
|
-
);
|
|
1440
|
-
}
|
|
1441
|
-
/**
|
|
1442
|
-
* Returns the shielded-pool BOUNDARY activity for an address: shields it
|
|
1443
|
-
* deposited and unshields it received, tagged `kind: 'shield' | 'unshield'`.
|
|
1444
|
-
* Only boundary fields are returned (block, asset, amount for unshields,
|
|
1445
|
-
* timestamp, tx hash) — note internals are never served per-address, and
|
|
1446
|
-
* private transfers carry no address at all (PIR-A).
|
|
1447
|
-
*/
|
|
1448
|
-
async getAddressShieldedActivity(address, params) {
|
|
1449
|
-
const qs = this.buildQuery({ page: params?.page, limit: params?.limit });
|
|
1450
|
-
return this.get(
|
|
1451
|
-
`/shielded/address/${encodeURIComponent(address)}${qs}`
|
|
1452
|
-
);
|
|
1453
|
-
}
|
|
1454
|
-
// ─── Relayers ──────────────────────────────────────────────────────────────
|
|
1455
|
-
/** Returns a paginated list of relayers. Filter by active status with `active`. */
|
|
1456
|
-
async getRelayers(params) {
|
|
1457
|
-
const qs = this.buildQuery({
|
|
1458
|
-
page: params?.page,
|
|
1459
|
-
limit: params?.limit,
|
|
1460
|
-
active: params?.active === void 0 ? void 0 : params.active ? "true" : "false"
|
|
1461
|
-
});
|
|
1462
|
-
return this.get(`/relayers${qs}`);
|
|
1463
|
-
}
|
|
1464
|
-
/** Returns a single relayer by EVM address, or null if not found. */
|
|
1465
|
-
async getRelayer(evmAddress) {
|
|
1466
|
-
return this.getOrNull(`/relayers/${encodeURIComponent(evmAddress.toLowerCase())}`);
|
|
1467
|
-
}
|
|
1468
|
-
/** Returns a paginated list of relay fee events. */
|
|
1469
|
-
async getRelayFees(params) {
|
|
1470
|
-
const qs = this.buildQuery({
|
|
1471
|
-
page: params?.page,
|
|
1472
|
-
limit: params?.limit,
|
|
1473
|
-
relayer: params?.relayer,
|
|
1474
|
-
type: params?.type
|
|
1475
|
-
});
|
|
1476
|
-
return this.get(`/relayers/fees${qs}`);
|
|
1477
|
-
}
|
|
1478
|
-
/** Returns aggregated relay fee balances per asset for a given relayer account. */
|
|
1479
|
-
async getRelayFeesSummary(relayer) {
|
|
1480
|
-
return this.get(
|
|
1481
|
-
`/relayers/fees/summary/${encodeURIComponent(relayer)}`
|
|
1482
|
-
);
|
|
1483
|
-
}
|
|
1484
|
-
// ─── Registered assets ─────────────────────────────────────────────────────
|
|
1485
|
-
/** Returns a paginated list of assets registered via register_asset. */
|
|
1486
|
-
async getRegisteredAssets(params) {
|
|
1487
|
-
const qs = this.buildQuery({ page: params?.page, limit: params?.limit });
|
|
1488
|
-
return this.get(`/shielded/assets${qs}`);
|
|
1489
|
-
}
|
|
1490
|
-
/** Returns a single registered asset by its ID, or null if not found. */
|
|
1491
|
-
async getRegisteredAsset(assetId) {
|
|
1492
|
-
return this.getOrNull(`/shielded/assets/${encodeURIComponent(assetId)}`);
|
|
1493
|
-
}
|
|
1494
|
-
// ─── Validators ────────────────────────────────────────────────────────────
|
|
1495
|
-
/** Returns a paginated list of validators. Filter by lifecycle status with `status`. */
|
|
1496
|
-
async getValidators(params) {
|
|
1497
|
-
const qs = this.buildQuery({
|
|
1498
|
-
page: params?.page,
|
|
1499
|
-
limit: params?.limit,
|
|
1500
|
-
status: params?.status
|
|
1501
|
-
});
|
|
1502
|
-
return this.get(`/validators${qs}`);
|
|
1503
|
-
}
|
|
1504
|
-
/** Returns a single validator by account address, or null if not found. */
|
|
1505
|
-
async getValidator(account) {
|
|
1506
|
-
return this.getOrNull(`/validators/${encodeURIComponent(account)}`);
|
|
1507
|
-
}
|
|
1508
|
-
// ─── Sessions ──────────────────────────────────────────────────────────────
|
|
1509
|
-
/** Returns a paginated list of session rotations, ordered by most recent first. */
|
|
1510
|
-
async getSessions(params) {
|
|
1511
|
-
const qs = this.buildQuery({ page: params?.page, limit: params?.limit });
|
|
1512
|
-
return this.get(`/sessions${qs}`);
|
|
1513
|
-
}
|
|
1514
|
-
// ─── Stats & Health ────────────────────────────────────────────────────────
|
|
1515
|
-
/** Returns aggregated indexer statistics. */
|
|
1516
|
-
async getStats() {
|
|
1517
|
-
return this.get("/stats");
|
|
1518
|
-
}
|
|
1519
|
-
/**
|
|
1520
|
-
* Returns transaction activity bucketed per hour over the last `hours` hours
|
|
1521
|
-
* of chain time (default 24, max 168). For sparklines / activity charts.
|
|
1522
|
-
*/
|
|
1523
|
-
async getActivity(hours = 24) {
|
|
1524
|
-
return this.get(`/stats/activity?hours=${hours}`);
|
|
1525
|
-
}
|
|
1526
|
-
/** Returns true if the indexer health endpoint responds OK. */
|
|
1527
|
-
async isHealthy() {
|
|
1528
|
-
try {
|
|
1529
|
-
const controller = new AbortController();
|
|
1530
|
-
const timer = setTimeout(() => controller.abort(), this.timeoutMs);
|
|
1531
|
-
try {
|
|
1532
|
-
const res = await fetch(`${this.baseUrl}/health`, {
|
|
1533
|
-
signal: controller.signal
|
|
1534
|
-
});
|
|
1535
|
-
return res.ok;
|
|
1536
|
-
} finally {
|
|
1537
|
-
clearTimeout(timer);
|
|
1538
|
-
}
|
|
1539
|
-
} catch {
|
|
1540
|
-
return false;
|
|
1541
|
-
}
|
|
1542
|
-
}
|
|
1543
|
-
};
|
|
1544
|
-
|
|
1545
1153
|
// src/shielded-pool/pallet/ShieldedPoolModule.ts
|
|
1546
1154
|
var import_polkadot_api2 = require("polkadot-api");
|
|
1547
1155
|
|
|
@@ -3640,12 +3248,6 @@ var OrbinumClient = class _OrbinumClient {
|
|
|
3640
3248
|
* `null` when `evmRpc` is not configured.
|
|
3641
3249
|
*/
|
|
3642
3250
|
evmExplorer;
|
|
3643
|
-
/**
|
|
3644
|
-
* HTTP client for the Orbinum indexer REST API.
|
|
3645
|
-
* Provides paginated access to indexed blocks, extrinsics, shielded events, and nullifiers.
|
|
3646
|
-
* `null` when `indexerUrl` is not configured.
|
|
3647
|
-
*/
|
|
3648
|
-
indexer;
|
|
3649
3251
|
/** Shielded-pool extrinsics and Merkle tree queries (`shield`, `unshield`, `privateTransfer`, …). */
|
|
3650
3252
|
shieldedPool;
|
|
3651
3253
|
/** Account-mapping extrinsics: aliases, chain links, metadata, marketplace, and identity. */
|
|
@@ -3669,11 +3271,10 @@ var OrbinumClient = class _OrbinumClient {
|
|
|
3669
3271
|
*/
|
|
3670
3272
|
precompiles;
|
|
3671
3273
|
/** @internal Use `OrbinumClient.connect()` to obtain an instance. */
|
|
3672
|
-
constructor(substrate, evm,
|
|
3274
|
+
constructor(substrate, evm, circuitsBaseUrl) {
|
|
3673
3275
|
this.substrate = substrate;
|
|
3674
3276
|
this.evm = evm;
|
|
3675
3277
|
this.evmExplorer = evm ? new EvmExplorer(evm) : null;
|
|
3676
|
-
this.indexer = indexer;
|
|
3677
3278
|
this.shieldedPool = new ShieldedPoolModule(substrate);
|
|
3678
3279
|
this.accountMapping = new AccountMappingModule(substrate);
|
|
3679
3280
|
this.privacy = new PrivacyModule(substrate);
|
|
@@ -3699,8 +3300,7 @@ var OrbinumClient = class _OrbinumClient {
|
|
|
3699
3300
|
config.connectTimeoutMs ?? 15e3
|
|
3700
3301
|
);
|
|
3701
3302
|
const evm = config.evmRpc ? new EvmClient(config.evmRpc) : null;
|
|
3702
|
-
|
|
3703
|
-
return new _OrbinumClient(substrate, evm, indexer, config.circuitsBaseUrl);
|
|
3303
|
+
return new _OrbinumClient(substrate, evm, config.circuitsBaseUrl);
|
|
3704
3304
|
}
|
|
3705
3305
|
/** Closes the underlying Substrate WebSocket connection and releases all resources. */
|
|
3706
3306
|
destroy() {
|
|
@@ -3821,7 +3421,6 @@ var OrbinumClientProvider = class {
|
|
|
3821
3421
|
substrateWs: this.config.substrateWs
|
|
3822
3422
|
};
|
|
3823
3423
|
if (this.config.evmRpc) connectConfig.evmRpc = this.config.evmRpc;
|
|
3824
|
-
if (this.config.indexerUrl) connectConfig.indexerUrl = this.config.indexerUrl;
|
|
3825
3424
|
if (this.config.circuitsBaseUrl)
|
|
3826
3425
|
connectConfig.circuitsBaseUrl = this.config.circuitsBaseUrl;
|
|
3827
3426
|
const clientPromise = OrbinumClient.connect(connectConfig);
|
|
@@ -5643,7 +5242,6 @@ var import_polkadot_api4 = require("polkadot-api");
|
|
|
5643
5242
|
EncryptedMemo,
|
|
5644
5243
|
EvmClient,
|
|
5645
5244
|
EvmExplorer,
|
|
5646
|
-
IndexerClient,
|
|
5647
5245
|
KNOWN_PRECOMPILES,
|
|
5648
5246
|
Keccak256,
|
|
5649
5247
|
NoteBuilder,
|