@odatano/core 2.0.0-rc.2 → 2.0.0-rc.20

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.
Files changed (132) hide show
  1. package/@cds-models/CardanoAgentService/index.d.ts +251 -0
  2. package/@cds-models/CardanoAgentService/index.js +36 -0
  3. package/@cds-models/CardanoIndexerService/index.d.ts +139 -2
  4. package/@cds-models/CardanoIndexerService/index.js +18 -0
  5. package/@cds-models/CardanoODataService/index.d.ts +224 -0
  6. package/@cds-models/CardanoODataService/index.js +27 -0
  7. package/@cds-models/CardanoSignService/index.d.ts +5 -2
  8. package/@cds-models/CardanoTransactionService/index.d.ts +9 -9
  9. package/@cds-models/odatano/cardano/index.d.ts +316 -0
  10. package/@cds-models/odatano/cardano/index.js +33 -0
  11. package/README.md +195 -136
  12. package/db/schema.cds +2121 -1633
  13. package/package.json +179 -173
  14. package/src/index.d.ts +10 -10
  15. package/src/index.js +24 -14
  16. package/src/plugin.js +39 -52
  17. package/srv/blockchain/backends/blockfrost-backend.d.ts +29 -131
  18. package/srv/blockchain/backends/blockfrost-backend.js +45 -158
  19. package/srv/blockchain/backends/cardano-backend.d.ts +78 -158
  20. package/srv/blockchain/backends/cardano-backend.js +14 -5
  21. package/srv/blockchain/backends/koios-backend.d.ts +126 -60
  22. package/srv/blockchain/backends/koios-backend.js +292 -202
  23. package/srv/blockchain/backends/ogmios-backend.d.ts +59 -96
  24. package/srv/blockchain/backends/ogmios-backend.js +241 -153
  25. package/srv/blockchain/backends/ogmios-frame-guard.d.ts +32 -0
  26. package/srv/blockchain/backends/ogmios-frame-guard.js +142 -0
  27. package/srv/blockchain/cardano-client.d.ts +50 -205
  28. package/srv/blockchain/cardano-client.js +80 -224
  29. package/srv/blockchain/cardano-indexer.d.ts +146 -244
  30. package/srv/blockchain/cardano-indexer.js +442 -285
  31. package/srv/blockchain/cardano-tx-builder.d.ts +19 -84
  32. package/srv/blockchain/cardano-tx-builder.js +21 -107
  33. package/srv/blockchain/crawler/certificate-backfill.d.ts +45 -0
  34. package/srv/blockchain/crawler/certificate-backfill.js +150 -0
  35. package/srv/blockchain/crawler/crawler.d.ts +121 -53
  36. package/srv/blockchain/crawler/crawler.js +402 -82
  37. package/srv/blockchain/crawler/hooks.d.ts +3 -14
  38. package/srv/blockchain/crawler/index.d.ts +5 -0
  39. package/srv/blockchain/crawler/index.js +35 -7
  40. package/srv/blockchain/crawler/sync-state.d.ts +44 -28
  41. package/srv/blockchain/crawler/sync-state.js +115 -43
  42. package/srv/blockchain/crawler/utxo-set-import.d.ts +69 -0
  43. package/srv/blockchain/crawler/utxo-set-import.js +269 -0
  44. package/srv/blockchain/ledger-state.d.ts +80 -0
  45. package/srv/blockchain/ledger-state.js +383 -0
  46. package/srv/blockchain/signing/cose-verifier.d.ts +5 -12
  47. package/srv/blockchain/signing/cose-verifier.js +6 -12
  48. package/srv/blockchain/signing/external-signer.d.ts +16 -113
  49. package/srv/blockchain/signing/external-signer.js +19 -122
  50. package/srv/blockchain/signing/hsm-signer.d.ts +13 -45
  51. package/srv/blockchain/signing/hsm-signer.js +23 -63
  52. package/srv/blockchain/signing/signature-verifier.d.ts +8 -44
  53. package/srv/blockchain/signing/signature-verifier.js +13 -54
  54. package/srv/blockchain/signing/submission-finalizer.d.ts +9 -36
  55. package/srv/blockchain/signing/submission-finalizer.js +16 -48
  56. package/srv/blockchain/transaction-building/buildooor-tx.d.ts +71 -160
  57. package/srv/blockchain/transaction-building/buildooor-tx.js +185 -260
  58. package/srv/blockchain/transaction-building/cardano-tx.d.ts +8 -34
  59. package/srv/blockchain/wallet-worker/build-request.d.ts +4 -17
  60. package/srv/blockchain/wallet-worker/build-request.js +39 -23
  61. package/srv/blockchain/wallet-worker/confirmation-tracker.d.ts +25 -17
  62. package/srv/blockchain/wallet-worker/confirmation-tracker.js +87 -41
  63. package/srv/blockchain/wallet-worker/index.js +2 -8
  64. package/srv/blockchain/wallet-worker/job-store.d.ts +36 -103
  65. package/srv/blockchain/wallet-worker/job-store.js +0 -0
  66. package/srv/blockchain/wallet-worker/lease-heartbeat.d.ts +4 -20
  67. package/srv/blockchain/wallet-worker/lease-heartbeat.js +4 -20
  68. package/srv/blockchain/wallet-worker/signers.d.ts +6 -19
  69. package/srv/blockchain/wallet-worker/signers.js +3 -8
  70. package/srv/blockchain/wallet-worker/wallet-worker.d.ts +15 -71
  71. package/srv/blockchain/wallet-worker/wallet-worker.js +34 -90
  72. package/srv/cardano-agent-service.cds +146 -0
  73. package/srv/cardano-agent-service.d.ts +2 -0
  74. package/srv/cardano-agent-service.js +12 -0
  75. package/srv/cardano-indexer-service.cds +164 -73
  76. package/srv/cardano-indexer-service.js +156 -11
  77. package/srv/cardano-service.cds +45 -0
  78. package/srv/cardano-service.js +38 -96
  79. package/srv/cardano-sign-service.cds +200 -180
  80. package/srv/cardano-sign-service.js +55 -173
  81. package/srv/cardano-tx-service.cds +32 -26
  82. package/srv/cardano-tx-service.js +133 -195
  83. package/srv/cardano-worker-service.js +7 -15
  84. package/srv/server.d.ts +28 -86
  85. package/srv/server.js +95 -128
  86. package/srv/utils/agent-grants-config.d.ts +37 -0
  87. package/srv/utils/agent-grants-config.js +138 -0
  88. package/srv/utils/agent-grants.d.ts +262 -0
  89. package/srv/utils/agent-grants.js +914 -0
  90. package/srv/utils/agent-token-auth.d.ts +16 -0
  91. package/srv/utils/agent-token-auth.js +78 -0
  92. package/srv/utils/backend-request-handler.d.ts +2 -16
  93. package/srv/utils/backend-request-handler.js +3 -18
  94. package/srv/utils/collections.d.ts +4 -8
  95. package/srv/utils/collections.js +4 -8
  96. package/srv/utils/const.d.ts +19 -68
  97. package/srv/utils/const.js +20 -69
  98. package/srv/utils/crypto.d.ts +3 -12
  99. package/srv/utils/crypto.js +5 -18
  100. package/srv/utils/db-indexes.d.ts +25 -0
  101. package/srv/utils/db-indexes.js +89 -0
  102. package/srv/utils/db-sanitize.d.ts +27 -0
  103. package/srv/utils/db-sanitize.js +85 -0
  104. package/srv/utils/error-codes.d.ts +18 -73
  105. package/srv/utils/error-codes.js +17 -70
  106. package/srv/utils/errors.d.ts +34 -178
  107. package/srv/utils/errors.js +55 -217
  108. package/srv/utils/liveness.d.ts +16 -0
  109. package/srv/utils/liveness.js +41 -0
  110. package/srv/utils/mappers.d.ts +82 -210
  111. package/srv/utils/mappers.js +272 -293
  112. package/srv/utils/network-context.js +2 -11
  113. package/srv/utils/pg-order-nulls.d.ts +14 -0
  114. package/srv/utils/pg-order-nulls.js +57 -0
  115. package/srv/utils/plutus-placeholders.d.ts +6 -18
  116. package/srv/utils/plutus-placeholders.js +6 -20
  117. package/srv/utils/rate-limiter.d.ts +46 -0
  118. package/srv/utils/rate-limiter.js +116 -0
  119. package/srv/utils/service-events.d.ts +2 -22
  120. package/srv/utils/service-events.js +3 -23
  121. package/srv/utils/signing-helper.d.ts +3 -18
  122. package/srv/utils/signing-helper.js +10 -32
  123. package/srv/utils/tx-build-helper.d.ts +18 -92
  124. package/srv/utils/tx-build-helper.js +32 -123
  125. package/srv/utils/tx-request-parsers.d.ts +14 -20
  126. package/srv/utils/tx-request-parsers.js +33 -20
  127. package/srv/utils/tx-utils.d.ts +4 -23
  128. package/srv/utils/tx-utils.js +12 -41
  129. package/srv/utils/types.d.ts +112 -169
  130. package/srv/utils/types.js +2 -6
  131. package/srv/utils/validators.d.ts +19 -89
  132. package/srv/utils/validators.js +31 -138
@@ -0,0 +1,89 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.DB_INDEXES = void 0;
7
+ exports.indexStatement = indexStatement;
8
+ exports.ensureDbIndexes = ensureDbIndexes;
9
+ /**
10
+ * Secondary indexes the CDS model cannot declare (temporal keys start with `validFrom`, so business-key
11
+ * lookups would scan). Created at start with CREATE INDEX IF NOT EXISTS, unquoted identifiers so Postgres
12
+ * folds them like @cap-js does; failures are logged, never fatal. HANA is skipped (column store, no IF NOT EXISTS).
13
+ */
14
+ const cds_1 = __importDefault(require("@sap/cds"));
15
+ const logger = cds_1.default.log('DbIndexes');
16
+ /** Every entry answers a query the service or the crawler actually runs. */
17
+ exports.DB_INDEXES = Object.freeze([
18
+ // Blocks: latest (ORDER BY height DESC), byHeight, crawler `height in`, rollback `slot >`, epoch filters
19
+ { name: 'odatano_cardano_blocks_height', table: 'odatano_cardano_Blocks', columns: 'height' },
20
+ // CAP renders `$orderby=height desc` as DESC NULLS LAST, which the plain ASC NULLS LAST
21
+ // index cannot serve backwards; the plain one stays for ASC and equality.
22
+ { name: 'odatano_cardano_blocks_height_desc', table: 'odatano_cardano_Blocks', columns: 'height DESC', postgres: 'height DESC NULLS LAST' },
23
+ { name: 'odatano_cardano_blocks_slot', table: 'odatano_cardano_Blocks', columns: 'slot' },
24
+ { name: 'odatano_cardano_blocks_epoch', table: 'odatano_cardano_Blocks', columns: 'epochNumber' },
25
+ // Transactions of a block (rollback `blockHash in`, OData filters by block / height)
26
+ { name: 'odatano_cardano_transactions_block', table: 'odatano_cardano_Transactions', columns: 'blockHash' },
27
+ { name: 'odatano_cardano_transactions_height', table: 'odatano_cardano_Transactions', columns: 'blockHeight' },
28
+ // GetMetadataByTxHash, rollback
29
+ { name: 'odatano_cardano_transactionmetadata_tx', table: 'odatano_cardano_TransactionMetadata', columns: 'tx_hash' },
30
+ // rollback `txHash in` (key is unit, txHash)
31
+ { name: 'odatano_cardano_assethistory_tx', table: 'odatano_cardano_AssetHistory', columns: 'txHash' },
32
+ // temporal entities: the business key behind validFrom
33
+ { name: 'odatano_cardano_assets_unit', table: 'odatano_cardano_Assets', columns: 'unit' },
34
+ { name: 'odatano_cardano_addresses_address', table: 'odatano_cardano_Addresses', columns: 'address' },
35
+ { name: 'odatano_cardano_addressutxos_address', table: 'odatano_cardano_AddressUTxOs', columns: 'address_address' },
36
+ { name: 'odatano_cardano_addressassets_address', table: 'odatano_cardano_AddressAssets', columns: 'address_address' },
37
+ { name: 'odatano_cardano_utxoassets_address', table: 'odatano_cardano_UTxOAssets', columns: 'utxo_address_address' },
38
+ { name: 'odatano_cardano_addresstransactions_tx', table: 'odatano_cardano_AddressTransactions', columns: 'tx_hash' },
39
+ { name: 'odatano_cardano_accounts_stake', table: 'odatano_cardano_Accounts', columns: 'stakeAddress' },
40
+ { name: 'odatano_cardano_pools_poolid', table: 'odatano_cardano_Pools', columns: 'poolId' },
41
+ { name: 'odatano_cardano_dreps_drepid', table: 'odatano_cardano_Dreps', columns: 'drepId' },
42
+ // agent token lane: one lookup by token hash per request
43
+ { name: 'odatano_cardano_cardanoagentgrants_token', table: 'odatano_cardano_CardanoAgentGrants', columns: 'tokenHash' },
44
+ // crawler-fed ledger state: "who spent this output" and delegation per stake key / pool / DRep
45
+ { name: 'odatano_cardano_transactioninputs_spent', table: 'odatano_cardano_TransactionInputs', columns: 'spentTxHash, spentOutputIndex' },
46
+ { name: 'odatano_cardano_transactioncertificates_stake', table: 'odatano_cardano_TransactionCertificates', columns: 'stakeAddress' },
47
+ { name: 'odatano_cardano_transactioncertificates_pool', table: 'odatano_cardano_TransactionCertificates', columns: 'poolId' },
48
+ { name: 'odatano_cardano_transactioncertificates_drep', table: 'odatano_cardano_TransactionCertificates', columns: 'drepId' },
49
+ { name: 'odatano_cardano_transactionwithdrawals_stake', table: 'odatano_cardano_TransactionWithdrawals', columns: 'stakeAddress' },
50
+ // crawler-fed UTxO set: open rows per address, "who spent", stake-key rollups, asset holders
51
+ { name: 'odatano_cardano_ledgerutxos_address', table: 'odatano_cardano_LedgerUTxOs', columns: 'address, spentTxHash' },
52
+ { name: 'odatano_cardano_ledgerutxos_spent', table: 'odatano_cardano_LedgerUTxOs', columns: 'spentTxHash' },
53
+ { name: 'odatano_cardano_ledgeraddresses_stake', table: 'odatano_cardano_LedgerAddresses', columns: 'stakeAddress' },
54
+ { name: 'odatano_cardano_ledgerutxoassets_unit', table: 'odatano_cardano_LedgerUTxOAssets', columns: 'unit' },
55
+ { name: 'odatano_cardano_ledgeraddressassets_unit', table: 'odatano_cardano_LedgerAddressAssets', columns: 'unit' },
56
+ ]);
57
+ /** The statement for one entry; exported so tests pin the shape. */
58
+ function indexStatement(spec, kind = 'sqlite') {
59
+ const columns = kind === 'postgres' && spec.postgres ? spec.postgres : spec.columns;
60
+ return `CREATE INDEX IF NOT EXISTS ${spec.name} ON ${spec.table} (${columns})`;
61
+ }
62
+ /** Creates every missing index; a failing statement is logged and skipped, the others still run. */
63
+ async function ensureDbIndexes(runner = cds_1.default.db) {
64
+ const ensured = [];
65
+ const failed = [];
66
+ if (!runner) {
67
+ logger.debug('no database service connected, indexes skipped');
68
+ return { ensured, failed };
69
+ }
70
+ const kind = String(runner.kind ?? 'sqlite');
71
+ if (kind === 'hana') {
72
+ logger.info('HANA: secondary indexes not created (column store, no IF NOT EXISTS)');
73
+ return { ensured, failed };
74
+ }
75
+ for (const spec of exports.DB_INDEXES) {
76
+ try {
77
+ await runner.run(indexStatement(spec, kind));
78
+ ensured.push(spec.name);
79
+ }
80
+ catch (err) {
81
+ failed.push(spec.name);
82
+ logger.warn(`index ${spec.name} on ${spec.table} not ensured: ${String(err?.message ?? err)}`);
83
+ }
84
+ }
85
+ if (failed.length === 0)
86
+ logger.info(`${ensured.length} indexes ensured`);
87
+ return { ensured, failed };
88
+ }
89
+ //# sourceMappingURL=db-indexes.js.map
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Strips U+0000 from every row this plugin writes: PostgreSQL cannot store NUL in `text`, and
3
+ * @cap-js/postgres bulk rows go through a JSON parser that rejects the NUL escape, failing the whole write.
4
+ */
5
+ /** Remove U+0000 from every string value of the row (nested objects included); same row when unchanged. */
6
+ export declare function stripNulStrings<T>(row: T): T;
7
+ /** Sanitise a row array for the database; cheap when nothing needs changing. */
8
+ export declare function sanitizeRows<T>(rows: T[]): T[];
9
+ /** The slice of a db-service request the sanitizer looks at (structural, so tests can fake it). */
10
+ export interface DbWriteRequest {
11
+ query?: unknown;
12
+ target?: {
13
+ name?: string;
14
+ } | null;
15
+ }
16
+ /** `before` handler for the db service: strips U+0000 from INSERT / UPSERT / UPDATE rows in place. */
17
+ export declare function sanitizeDbRequest(req: DbWriteRequest): void;
18
+ interface HookableService {
19
+ before(event: string | string[], handler: (req: DbWriteRequest) => void): unknown;
20
+ }
21
+ /**
22
+ * Hook the sanitizer into the database service (idempotent per instance; no-op without a db).
23
+ * @returns true when the hook was installed by this call
24
+ */
25
+ export declare function installDbSanitizer(db?: HookableService | undefined): boolean;
26
+ export {};
27
+ //# sourceMappingURL=db-sanitize.d.ts.map
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.stripNulStrings = stripNulStrings;
7
+ exports.sanitizeRows = sanitizeRows;
8
+ exports.sanitizeDbRequest = sanitizeDbRequest;
9
+ exports.installDbSanitizer = installDbSanitizer;
10
+ const cds_1 = __importDefault(require("@sap/cds"));
11
+ /**
12
+ * Strips U+0000 from every row this plugin writes: PostgreSQL cannot store NUL in `text`, and
13
+ * @cap-js/postgres bulk rows go through a JSON parser that rejects the NUL escape, failing the whole write.
14
+ */
15
+ /** Remove U+0000 from every string value of the row (nested objects included); same row when unchanged. */
16
+ function stripNulStrings(row) {
17
+ if (typeof row === 'string')
18
+ return (row.includes('\u0000') ? row.replaceAll('\u0000', '') : row);
19
+ if (row === null || typeof row !== 'object' || Buffer.isBuffer(row))
20
+ return row;
21
+ if (Array.isArray(row)) {
22
+ let out = null;
23
+ for (let i = 0; i < row.length; i++) {
24
+ const v = stripNulStrings(row[i]);
25
+ if (v !== row[i]) {
26
+ out ??= [...row];
27
+ out[i] = v;
28
+ }
29
+ }
30
+ return (out ?? row);
31
+ }
32
+ let out = null;
33
+ for (const [k, v] of Object.entries(row)) {
34
+ const nv = stripNulStrings(v);
35
+ if (nv !== v) {
36
+ out ??= { ...row };
37
+ out[k] = nv;
38
+ }
39
+ }
40
+ return (out ?? row);
41
+ }
42
+ /** Sanitise a row array for the database; cheap when nothing needs changing. */
43
+ function sanitizeRows(rows) {
44
+ let out = null;
45
+ for (let i = 0; i < rows.length; i++) {
46
+ const r = stripNulStrings(rows[i]);
47
+ if (r !== rows[i]) {
48
+ out ??= [...rows];
49
+ out[i] = r;
50
+ }
51
+ }
52
+ return out ?? rows;
53
+ }
54
+ /** Only this plugin's entities are rewritten; a consumer's own data is never touched. */
55
+ const OWN_NAMESPACE = 'odatano.cardano.';
56
+ /** `before` handler for the db service: strips U+0000 from INSERT / UPSERT / UPDATE rows in place. */
57
+ function sanitizeDbRequest(req) {
58
+ if (!req.target?.name?.startsWith(OWN_NAMESPACE))
59
+ return;
60
+ const q = req.query;
61
+ if (!q || typeof q !== 'object')
62
+ return;
63
+ const ins = q.INSERT;
64
+ if (ins && Array.isArray(ins.entries))
65
+ ins.entries = sanitizeRows(ins.entries);
66
+ const ups = q.UPSERT;
67
+ if (ups && Array.isArray(ups.entries))
68
+ ups.entries = sanitizeRows(ups.entries);
69
+ const upd = q.UPDATE;
70
+ if (upd?.data && typeof upd.data === 'object')
71
+ upd.data = stripNulStrings(upd.data);
72
+ }
73
+ const installed = new WeakSet();
74
+ /**
75
+ * Hook the sanitizer into the database service (idempotent per instance; no-op without a db).
76
+ * @returns true when the hook was installed by this call
77
+ */
78
+ function installDbSanitizer(db = cds_1.default.db) {
79
+ if (!db || typeof db.before !== 'function' || installed.has(db))
80
+ return false;
81
+ db.before(['CREATE', 'UPSERT', 'UPDATE'], sanitizeDbRequest);
82
+ installed.add(db);
83
+ return true;
84
+ }
85
+ //# sourceMappingURL=db-sanitize.js.map
@@ -1,94 +1,39 @@
1
- /**
2
- * Error codes used throughout the ODATANO backend
3
- */
1
+ /** Error codes used throughout the backend. */
4
2
  export declare const ERROR_CODES: {
5
- /**
6
- * 400 – Invalid input
7
- * Indicates that the input provided by the client is invalid (malformed address, invalid transaction hash, etc.)
8
- */
3
+ /** 400: malformed client input (address, tx hash, ...). */
9
4
  readonly INVALID_INPUT: "ODATANO_INVALID_INPUT";
10
- /**
11
- * 403 – Caller lacks the required role
12
- * Indicates the caller is authenticated but not authorized for the operation
13
- * (e.g. HSM-backed signing without the configured hsm.requiresRole)
14
- */
5
+ /** 403: authenticated but lacking the required role (e.g. hsm.requiresRole). */
15
6
  readonly FORBIDDEN: "ODATANO_FORBIDDEN";
16
- /**
17
- * 404 – Data not found
18
- * Indicates that the requested resource could not be found (Empty result set Address with no UTxOs, Transaction hash not found, etc.)
19
- */
7
+ /** 404: requested resource not found (unknown tx hash, address without UTxOs, ...). */
20
8
  readonly NOT_FOUND: "ODATANO_NOT_FOUND";
21
- /**
22
- * 400 – Insufficient funds/assets
23
- * Indicates that the address does not have enough funds or assets to complete the transaction
24
- */
9
+ /** 400: address lacks the funds or assets for the transaction. */
25
10
  readonly INSUFFICIENT_FUNDS: "ODATANO_INSUFFICIENT_FUNDS";
26
- /**
27
- * 400 – Transaction validation failed
28
- * Indicates that the transaction failed validation (wrong signature, tampered CBOR, etc.)
29
- */
11
+ /** 400: decoded transaction failed validation (wrong signature, tampered CBOR, ...). */
30
12
  readonly TX_VALIDATION_FAILED: "ODATANO_TX_VALIDATION_FAILED";
31
- /**
32
- * 400 – Transaction CBOR parse failed
33
- * Indicates that the provided transaction CBOR could not be decoded
34
- * (malformed bytes, truncated, not a Cardano Conway tx). Distinct from
35
- * TX_VALIDATION_FAILED which applies to decoded-but-invalid transactions.
36
- */
13
+ /** 400: transaction CBOR could not be decoded (malformed, truncated, not a Conway tx). */
37
14
  readonly TX_PARSE_FAILED: "ODATANO_TX_PARSE_FAILED";
38
- /**
39
- * 400 – Plutus script validation failed
40
- * Indicates that the ledger cleanly rejected the transaction due to script
41
- * evaluation — e.g. PlutusFailure, CekError, overspent budget, script hash
42
- * mismatch. Distinct from provider outages (503) and generic tx validation.
43
- */
15
+ /** 400: ledger rejected the tx on script evaluation (PlutusFailure, CekError, budget, hash mismatch). */
44
16
  readonly SCRIPT_VALIDATION_FAILURE: "ODATANO_SCRIPT_VALIDATION_FAILURE";
45
- /**
46
- * 409 – Transaction already submitted
47
- * Indicates that the transaction has already been submitted (duplicate/replay)
48
- */
17
+ /** 409: transaction already submitted (duplicate / replay). */
49
18
  readonly TX_ALREADY_SUBMITTED: "ODATANO_TX_ALREADY_SUBMITTED";
50
- /**
51
- * 429 – Rate limiting
52
- * indicates temporary unavailability
53
- */
19
+ /** 429: provider rate limit hit. */
54
20
  readonly PROVIDER_RATE_LIMITED: "ODATANO_PROVIDER_RATE_LIMITED";
55
- /**
56
- * 503 – Upstream / connectivity
57
- * Indicates that the Cardano data provider is currently unavailable
58
- */
21
+ /** 503: Cardano data provider unavailable. */
59
22
  readonly PROVIDER_UNAVAILABLE: "ODATANO_PROVIDER_UNAVAILABLE";
60
- /**
61
- * 500 – Internal fallback
62
- * Indicates an unexpected internal error
63
- */
23
+ /** 500: unexpected internal error. */
64
24
  readonly INTERNAL_ERROR: "ODATANO_INTERNAL_ERROR";
65
- /**
66
- * 503 – HSM unavailable
67
- * Indicates the HSM device or session is not available
68
- */
25
+ /** 503: HSM device or session not available. */
69
26
  readonly HSM_UNAVAILABLE: "ODATANO_HSM_UNAVAILABLE";
70
- /**
71
- * 500 – HSM signing failed
72
- * Indicates the HSM signing operation failed
73
- */
27
+ /** 500: HSM signing operation failed. */
74
28
  readonly HSM_SIGNING_FAILED: "ODATANO_HSM_SIGNING_FAILED";
75
- /**
76
- * 400 – HSM not configured
77
- * Indicates HSM signing was requested but HSM is not configured
78
- */
29
+ /** 400: HSM signing requested but HSM not configured. */
79
30
  readonly HSM_NOT_CONFIGURED: "ODATANO_HSM_NOT_CONFIGURED";
80
31
  /**
81
- * 503 – Detached transaction could not begin in time
82
- * The sign-service could not acquire a pooled DB connection for one of its
83
- * detached bookkeeping transactions. Most common cause: an in-process
84
- * consumer awaits SubmitVerifiedTransaction/SignAndSubmitWithHsm while its
85
- * own request transaction holds the (single) pooled sqlite connection —
86
- * see docs/KNOWN_ISSUES.md issue 11.
32
+ * 503: a detached bookkeeping transaction could not acquire a pooled DB connection in time,
33
+ * typically because an in-process caller awaits the action while its own request tx holds the single sqlite connection.
87
34
  */
88
35
  readonly NESTED_TX_TIMEOUT: "ODATANO_NESTED_TX_TIMEOUT";
89
36
  };
90
- /**
91
- * EnumType representing all possible error codes
92
- */
37
+ /** Union of all error code values. */
93
38
  export type ErrorCode = (typeof ERROR_CODES)[keyof typeof ERROR_CODES];
94
39
  //# sourceMappingURL=error-codes.d.ts.map
@@ -1,92 +1,39 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ERROR_CODES = void 0;
4
- /**
5
- * Error codes used throughout the ODATANO backend
6
- */
4
+ /** Error codes used throughout the backend. */
7
5
  exports.ERROR_CODES = {
8
- /**
9
- * 400 – Invalid input
10
- * Indicates that the input provided by the client is invalid (malformed address, invalid transaction hash, etc.)
11
- */
6
+ /** 400: malformed client input (address, tx hash, ...). */
12
7
  INVALID_INPUT: 'ODATANO_INVALID_INPUT',
13
- /**
14
- * 403 – Caller lacks the required role
15
- * Indicates the caller is authenticated but not authorized for the operation
16
- * (e.g. HSM-backed signing without the configured hsm.requiresRole)
17
- */
8
+ /** 403: authenticated but lacking the required role (e.g. hsm.requiresRole). */
18
9
  FORBIDDEN: 'ODATANO_FORBIDDEN',
19
- /**
20
- * 404 – Data not found
21
- * Indicates that the requested resource could not be found (Empty result set Address with no UTxOs, Transaction hash not found, etc.)
22
- */
10
+ /** 404: requested resource not found (unknown tx hash, address without UTxOs, ...). */
23
11
  NOT_FOUND: 'ODATANO_NOT_FOUND',
24
- /**
25
- * 400 – Insufficient funds/assets
26
- * Indicates that the address does not have enough funds or assets to complete the transaction
27
- */
12
+ /** 400: address lacks the funds or assets for the transaction. */
28
13
  INSUFFICIENT_FUNDS: 'ODATANO_INSUFFICIENT_FUNDS',
29
- /**
30
- * 400 – Transaction validation failed
31
- * Indicates that the transaction failed validation (wrong signature, tampered CBOR, etc.)
32
- */
14
+ /** 400: decoded transaction failed validation (wrong signature, tampered CBOR, ...). */
33
15
  TX_VALIDATION_FAILED: 'ODATANO_TX_VALIDATION_FAILED',
34
- /**
35
- * 400 – Transaction CBOR parse failed
36
- * Indicates that the provided transaction CBOR could not be decoded
37
- * (malformed bytes, truncated, not a Cardano Conway tx). Distinct from
38
- * TX_VALIDATION_FAILED which applies to decoded-but-invalid transactions.
39
- */
16
+ /** 400: transaction CBOR could not be decoded (malformed, truncated, not a Conway tx). */
40
17
  TX_PARSE_FAILED: 'ODATANO_TX_PARSE_FAILED',
41
- /**
42
- * 400 – Plutus script validation failed
43
- * Indicates that the ledger cleanly rejected the transaction due to script
44
- * evaluation — e.g. PlutusFailure, CekError, overspent budget, script hash
45
- * mismatch. Distinct from provider outages (503) and generic tx validation.
46
- */
18
+ /** 400: ledger rejected the tx on script evaluation (PlutusFailure, CekError, budget, hash mismatch). */
47
19
  SCRIPT_VALIDATION_FAILURE: 'ODATANO_SCRIPT_VALIDATION_FAILURE',
48
- /**
49
- * 409 – Transaction already submitted
50
- * Indicates that the transaction has already been submitted (duplicate/replay)
51
- */
20
+ /** 409: transaction already submitted (duplicate / replay). */
52
21
  TX_ALREADY_SUBMITTED: 'ODATANO_TX_ALREADY_SUBMITTED',
53
- /**
54
- * 429 – Rate limiting
55
- * indicates temporary unavailability
56
- */
22
+ /** 429: provider rate limit hit. */
57
23
  PROVIDER_RATE_LIMITED: 'ODATANO_PROVIDER_RATE_LIMITED',
58
- /**
59
- * 503 – Upstream / connectivity
60
- * Indicates that the Cardano data provider is currently unavailable
61
- */
24
+ /** 503: Cardano data provider unavailable. */
62
25
  PROVIDER_UNAVAILABLE: 'ODATANO_PROVIDER_UNAVAILABLE',
63
- /**
64
- * 500 – Internal fallback
65
- * Indicates an unexpected internal error
66
- */
26
+ /** 500: unexpected internal error. */
67
27
  INTERNAL_ERROR: 'ODATANO_INTERNAL_ERROR',
68
- /**
69
- * 503 – HSM unavailable
70
- * Indicates the HSM device or session is not available
71
- */
28
+ /** 503: HSM device or session not available. */
72
29
  HSM_UNAVAILABLE: 'ODATANO_HSM_UNAVAILABLE',
73
- /**
74
- * 500 – HSM signing failed
75
- * Indicates the HSM signing operation failed
76
- */
30
+ /** 500: HSM signing operation failed. */
77
31
  HSM_SIGNING_FAILED: 'ODATANO_HSM_SIGNING_FAILED',
78
- /**
79
- * 400 – HSM not configured
80
- * Indicates HSM signing was requested but HSM is not configured
81
- */
32
+ /** 400: HSM signing requested but HSM not configured. */
82
33
  HSM_NOT_CONFIGURED: 'ODATANO_HSM_NOT_CONFIGURED',
83
34
  /**
84
- * 503 – Detached transaction could not begin in time
85
- * The sign-service could not acquire a pooled DB connection for one of its
86
- * detached bookkeeping transactions. Most common cause: an in-process
87
- * consumer awaits SubmitVerifiedTransaction/SignAndSubmitWithHsm while its
88
- * own request transaction holds the (single) pooled sqlite connection —
89
- * see docs/KNOWN_ISSUES.md issue 11.
35
+ * 503: a detached bookkeeping transaction could not acquire a pooled DB connection in time,
36
+ * typically because an in-process caller awaits the action while its own request tx holds the single sqlite connection.
90
37
  */
91
38
  NESTED_TX_TIMEOUT: 'ODATANO_NESTED_TX_TIMEOUT',
92
39
  };