@odatano/core 2.0.0-rc.42 → 2.0.0-rc.44
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/@cds-models/CardanoIndexerService/index.d.ts +78 -0
- package/@cds-models/CardanoIndexerService/index.js +11 -0
- package/@cds-models/CardanoODataService/index.d.ts +36 -0
- package/@cds-models/CardanoODataService/index.js +4 -0
- package/@cds-models/CardanoSignService/index.d.ts +1 -0
- package/@cds-models/CardanoTransactionService/index.d.ts +1 -0
- package/@cds-models/index.d.ts +1 -0
- package/@cds-models/odatano/cardano/index.d.ts +25 -0
- package/@cds-models/odatano/cardano/index.js +3 -0
- package/README.md +195 -195
- package/db/schema.cds +27 -0
- package/db/types.cds +421 -417
- package/package.json +1 -1
- package/srv/blockchain/asset-decimals.d.ts +16 -0
- package/srv/blockchain/asset-decimals.js +86 -0
- package/srv/blockchain/backends/ogmios-backend.js +1 -0
- package/srv/blockchain/cardano-indexer.js +10 -1
- package/srv/blockchain/crawler/asset-decimals-backfill.d.ts +20 -0
- package/srv/blockchain/crawler/asset-decimals-backfill.js +59 -0
- package/srv/blockchain/crawler/credential-backfill.d.ts +38 -0
- package/srv/blockchain/crawler/credential-backfill.js +126 -0
- package/srv/blockchain/crawler/transaction-backfill.d.ts +3 -2
- package/srv/blockchain/crawler/transaction-backfill.js +8 -4
- package/srv/blockchain/ledger-state.d.ts +1 -0
- package/srv/blockchain/ledger-state.js +1 -0
- package/srv/blockchain/stored-chain.js +5 -1
- package/srv/blockchain/transaction-rows.d.ts +1 -1
- package/srv/blockchain/transaction-rows.js +2 -1
- package/srv/cardano-indexer-service.cds +48 -2
- package/srv/cardano-indexer-service.js +47 -2
- package/srv/cardano-service.cds +344 -332
- package/srv/cardano-service.js +9 -0
- package/srv/cbor/cip68.d.ts +17 -0
- package/srv/cbor/cip68.js +58 -0
- package/srv/cbor/index.d.ts +2 -0
- package/srv/cbor/index.js +9 -1
- package/srv/cbor/plutus-data-json.d.ts +24 -0
- package/srv/cbor/plutus-data-json.js +32 -0
- package/srv/utils/agent-grants.js +1 -1
- package/srv/utils/db-indexes.js +5 -0
- package/srv/utils/mappers.d.ts +6 -2
- package/srv/utils/mappers.js +16 -0
- package/srv/utils/types.d.ts +9 -0
|
@@ -11,6 +11,8 @@ const sync_state_1 = require("./blockchain/crawler/sync-state");
|
|
|
11
11
|
const utxo_set_import_1 = require("./blockchain/crawler/utxo-set-import");
|
|
12
12
|
const certificate_backfill_1 = require("./blockchain/crawler/certificate-backfill");
|
|
13
13
|
const transaction_backfill_1 = require("./blockchain/crawler/transaction-backfill");
|
|
14
|
+
const credential_backfill_1 = require("./blockchain/crawler/credential-backfill");
|
|
15
|
+
const asset_decimals_backfill_1 = require("./blockchain/crawler/asset-decimals-backfill");
|
|
14
16
|
const validators_1 = require("./utils/validators");
|
|
15
17
|
const server_1 = require("./server");
|
|
16
18
|
const liveness_1 = require("./utils/liveness");
|
|
@@ -27,9 +29,15 @@ let certificateBackfill = {
|
|
|
27
29
|
};
|
|
28
30
|
let transactionBackfillStarting = false;
|
|
29
31
|
let transactionBackfill = {
|
|
30
|
-
status: 'none', fromSlot: 0, toSlot: 0, atSlot: 0, blocks: 0, transactions: 0, inputs: 0, redeemers: 0, rewritten: 0, skipped: 0,
|
|
32
|
+
status: 'none', fromSlot: 0, toSlot: 0, atSlot: 0, blocks: 0, transactions: 0, inputs: 0, redeemers: 0, datums: 0, rewritten: 0, skipped: 0,
|
|
31
33
|
startedAt: null, finishedAt: null, error: null,
|
|
32
34
|
};
|
|
35
|
+
let credentialBackfill = {
|
|
36
|
+
status: 'none', table: null, outputs: 0, inputs: 0, ledgerUtxos: 0, startedAt: null, finishedAt: null, error: null,
|
|
37
|
+
};
|
|
38
|
+
let decimalsBackfill = {
|
|
39
|
+
status: 'none', scanned: 0, candidates: 0, filled: 0, startedAt: null, finishedAt: null, error: null,
|
|
40
|
+
};
|
|
33
41
|
/** Slot range of a backfill: defaults to crawl start .. cursor, never past the cursor. */
|
|
34
42
|
async function backfillRange(db, data) {
|
|
35
43
|
const cursor = await (0, sync_state_1.readCursor)(db);
|
|
@@ -125,12 +133,15 @@ module.exports = (srv) => {
|
|
|
125
133
|
transactions: transactionBackfill.transactions,
|
|
126
134
|
inputs: transactionBackfill.inputs,
|
|
127
135
|
redeemers: transactionBackfill.redeemers,
|
|
136
|
+
datums: transactionBackfill.datums,
|
|
128
137
|
rewritten: transactionBackfill.rewritten,
|
|
129
138
|
skipped: transactionBackfill.skipped,
|
|
130
139
|
startedAt: transactionBackfill.startedAt,
|
|
131
140
|
finishedAt: transactionBackfill.finishedAt,
|
|
132
141
|
error: transactionBackfill.error,
|
|
133
142
|
},
|
|
143
|
+
credentialBackfill: { ...credentialBackfill },
|
|
144
|
+
decimalsBackfill: { ...decimalsBackfill },
|
|
134
145
|
epochSnapshots: {
|
|
135
146
|
enabled: epochSnapshotsConfigured(),
|
|
136
147
|
source: epochSnapshotSource(),
|
|
@@ -204,7 +215,7 @@ module.exports = (srv) => {
|
|
|
204
215
|
return await (0, backend_request_handler_1.handleRequest)(req, async (db) => {
|
|
205
216
|
const { fromSlot, toSlot } = await backfillRange(db, data);
|
|
206
217
|
transactionBackfill = {
|
|
207
|
-
status: 'running', fromSlot, toSlot, atSlot: fromSlot, blocks: 0, transactions: 0, inputs: 0, redeemers: 0, rewritten: 0, skipped: 0,
|
|
218
|
+
status: 'running', fromSlot, toSlot, atSlot: fromSlot, blocks: 0, transactions: 0, inputs: 0, redeemers: 0, datums: 0, rewritten: 0, skipped: 0,
|
|
208
219
|
startedAt: new Date().toISOString(), finishedAt: null, error: null,
|
|
209
220
|
};
|
|
210
221
|
void (0, transaction_backfill_1.backfillTransactions)({
|
|
@@ -233,6 +244,40 @@ module.exports = (srv) => {
|
|
|
233
244
|
transactionBackfillStarting = false;
|
|
234
245
|
}
|
|
235
246
|
});
|
|
247
|
+
// backfillPaymentCredentials — walks the UTxO-shaped tables once and fills the credential
|
|
248
|
+
// from the stored address. No backend; runs detached, progress via getStatus().credentialBackfill.
|
|
249
|
+
srv.on('backfillPaymentCredentials', async (req) => {
|
|
250
|
+
if (credentialBackfill.status === 'running')
|
|
251
|
+
return (0, errors_1.rejectInvalid)(req, 'backfillPaymentCredentials', 'A payment-credential backfill is already running');
|
|
252
|
+
credentialBackfill = { status: 'running', table: null, outputs: 0, inputs: 0, ledgerUtxos: 0, startedAt: new Date().toISOString(), finishedAt: null, error: null };
|
|
253
|
+
void (0, credential_backfill_1.backfillUtxoCredentials)({
|
|
254
|
+
onProgress: (p) => { Object.assign(credentialBackfill, p); },
|
|
255
|
+
})
|
|
256
|
+
.then((r) => { Object.assign(credentialBackfill, r, { status: 'done', finishedAt: new Date().toISOString() }); })
|
|
257
|
+
.catch((err) => {
|
|
258
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
259
|
+
Object.assign(credentialBackfill, { status: 'failed', finishedAt: new Date().toISOString(), error: message.slice(0, 500) });
|
|
260
|
+
logger.error(`Payment-credential backfill failed: ${message}`);
|
|
261
|
+
});
|
|
262
|
+
return { accepted: true, message: 'Payment-credential backfill started; poll getStatus().credentialBackfill.' };
|
|
263
|
+
});
|
|
264
|
+
// backfillAssetDecimals — resolves the CIP-68 reference datum of every label-333/444 catalogue
|
|
265
|
+
// unit from the crawled chain. No backend; runs detached, progress via getStatus().decimalsBackfill.
|
|
266
|
+
srv.on('backfillAssetDecimals', async (req) => {
|
|
267
|
+
if (decimalsBackfill.status === 'running')
|
|
268
|
+
return (0, errors_1.rejectInvalid)(req, 'backfillAssetDecimals', 'An asset-decimals backfill is already running');
|
|
269
|
+
decimalsBackfill = { status: 'running', scanned: 0, candidates: 0, filled: 0, startedAt: new Date().toISOString(), finishedAt: null, error: null };
|
|
270
|
+
void (0, asset_decimals_backfill_1.backfillAssetDecimals)({
|
|
271
|
+
onProgress: (p) => { Object.assign(decimalsBackfill, p); },
|
|
272
|
+
})
|
|
273
|
+
.then((r) => { Object.assign(decimalsBackfill, r, { status: 'done', finishedAt: new Date().toISOString() }); })
|
|
274
|
+
.catch((err) => {
|
|
275
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
276
|
+
Object.assign(decimalsBackfill, { status: 'failed', finishedAt: new Date().toISOString(), error: message.slice(0, 500) });
|
|
277
|
+
logger.error(`Asset-decimals backfill failed: ${message}`);
|
|
278
|
+
});
|
|
279
|
+
return { accepted: true, message: 'Asset-decimals backfill started; poll getStatus().decimalsBackfill.' };
|
|
280
|
+
});
|
|
236
281
|
// importUtxoSet — one-off snapshot import that anchors crawler.utxoSet. Validates, then
|
|
237
282
|
// runs detached; progress via getStatus().utxoSet.
|
|
238
283
|
srv.on('importUtxoSet', async (req) => {
|