@odatano/core 2.0.0-rc.5 → 2.0.0-rc.50

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 (208) hide show
  1. package/@cds-models/CardanoAgentService/index.d.ts +99 -51
  2. package/@cds-models/CardanoAgentService/index.js +15 -0
  3. package/@cds-models/CardanoBackendService/index.d.ts +347 -0
  4. package/@cds-models/CardanoBackendService/index.js +40 -0
  5. package/@cds-models/CardanoIndexerService/index.d.ts +496 -11
  6. package/@cds-models/CardanoIndexerService/index.js +64 -0
  7. package/@cds-models/CardanoODataService/index.d.ts +414 -57
  8. package/@cds-models/CardanoODataService/index.js +42 -0
  9. package/@cds-models/CardanoSignService/index.d.ts +32 -19
  10. package/@cds-models/CardanoSignService/index.js +3 -0
  11. package/@cds-models/CardanoTransactionService/index.d.ts +58 -44
  12. package/@cds-models/CardanoTransactionService/index.js +4 -0
  13. package/@cds-models/CardanoWorkerService/index.d.ts +7 -22
  14. package/@cds-models/index.d.ts +101 -1
  15. package/@cds-models/index.js +16 -1
  16. package/@cds-models/odatano/cardano/index.d.ts +437 -32
  17. package/@cds-models/odatano/cardano/index.js +48 -0
  18. package/README.md +207 -167
  19. package/db/schema.cds +2402 -1705
  20. package/db/types.cds +446 -295
  21. package/package.json +41 -16
  22. package/scripts/migrate-schema.mjs +334 -0
  23. package/scripts/migrate-slot-leader.mjs +96 -0
  24. package/src/index.d.ts +20 -21
  25. package/src/index.js +45 -31
  26. package/src/plugin.js +17 -35
  27. package/srv/blockchain/asset-decimals.d.ts +7 -0
  28. package/srv/blockchain/asset-decimals.js +91 -0
  29. package/srv/blockchain/backends/blockfrost-backend.d.ts +25 -135
  30. package/srv/blockchain/backends/blockfrost-backend.js +66 -172
  31. package/srv/blockchain/backends/cardano-backend.d.ts +94 -186
  32. package/srv/blockchain/backends/cardano-backend.js +29 -5
  33. package/srv/blockchain/backends/koios-backend.d.ts +103 -168
  34. package/srv/blockchain/backends/koios-backend.js +428 -360
  35. package/srv/blockchain/backends/odatano-backend.d.ts +54 -0
  36. package/srv/blockchain/backends/odatano-backend.js +169 -0
  37. package/srv/blockchain/backends/ogmios-backend.d.ts +123 -190
  38. package/srv/blockchain/backends/ogmios-backend.js +637 -315
  39. package/srv/blockchain/backends/ogmios-frame-guard.d.ts +14 -0
  40. package/srv/blockchain/backends/ogmios-frame-guard.js +89 -0
  41. package/srv/blockchain/cardano-client.d.ts +61 -241
  42. package/srv/blockchain/cardano-client.js +253 -293
  43. package/srv/blockchain/cardano-indexer.d.ts +282 -281
  44. package/srv/blockchain/cardano-indexer.js +1551 -484
  45. package/srv/blockchain/cardano-tx-builder.d.ts +25 -89
  46. package/srv/blockchain/cardano-tx-builder.js +164 -140
  47. package/srv/blockchain/circuit-breaker.d.ts +1 -13
  48. package/srv/blockchain/circuit-breaker.js +5 -15
  49. package/srv/blockchain/crawler/account-snapshots.d.ts +29 -0
  50. package/srv/blockchain/crawler/account-snapshots.js +153 -0
  51. package/srv/blockchain/crawler/asset-decimals-backfill.d.ts +15 -0
  52. package/srv/blockchain/crawler/asset-decimals-backfill.js +56 -0
  53. package/srv/blockchain/crawler/asset-registry-backfill.d.ts +43 -0
  54. package/srv/blockchain/crawler/asset-registry-backfill.js +153 -0
  55. package/srv/blockchain/crawler/certificate-backfill.d.ts +52 -0
  56. package/srv/blockchain/crawler/certificate-backfill.js +162 -0
  57. package/srv/blockchain/crawler/crawler.d.ts +104 -81
  58. package/srv/blockchain/crawler/crawler.js +532 -160
  59. package/srv/blockchain/crawler/credential-backfill.d.ts +28 -0
  60. package/srv/blockchain/crawler/credential-backfill.js +124 -0
  61. package/srv/blockchain/crawler/hooks.d.ts +2 -17
  62. package/srv/blockchain/crawler/index.d.ts +1 -8
  63. package/srv/blockchain/crawler/index.js +31 -17
  64. package/srv/blockchain/crawler/input-asset-copies.d.ts +34 -0
  65. package/srv/blockchain/crawler/input-asset-copies.js +171 -0
  66. package/srv/blockchain/crawler/metadata-position-backfill.d.ts +16 -0
  67. package/srv/blockchain/crawler/metadata-position-backfill.js +55 -0
  68. package/srv/blockchain/crawler/output-datum-backfill.d.ts +39 -0
  69. package/srv/blockchain/crawler/output-datum-backfill.js +110 -0
  70. package/srv/blockchain/crawler/sync-state.d.ts +27 -47
  71. package/srv/blockchain/crawler/sync-state.js +113 -63
  72. package/srv/blockchain/crawler/transaction-backfill.d.ts +44 -0
  73. package/srv/blockchain/crawler/transaction-backfill.js +278 -0
  74. package/srv/blockchain/crawler/utxo-set-import.d.ts +66 -0
  75. package/srv/blockchain/crawler/utxo-set-import.js +399 -0
  76. package/srv/blockchain/ledger-state.d.ts +62 -0
  77. package/srv/blockchain/ledger-state.js +419 -0
  78. package/srv/blockchain/pending-spends.d.ts +16 -0
  79. package/srv/blockchain/pending-spends.js +81 -0
  80. package/srv/blockchain/pool-metadata.d.ts +15 -0
  81. package/srv/blockchain/pool-metadata.js +132 -0
  82. package/srv/blockchain/request-coalescer.d.ts +2 -16
  83. package/srv/blockchain/request-coalescer.js +2 -16
  84. package/srv/blockchain/signing/cose-verifier.d.ts +3 -17
  85. package/srv/blockchain/signing/cose-verifier.js +146 -70
  86. package/srv/blockchain/signing/external-signer.d.ts +15 -115
  87. package/srv/blockchain/signing/external-signer.js +17 -126
  88. package/srv/blockchain/signing/hsm-signer.d.ts +10 -54
  89. package/srv/blockchain/signing/hsm-signer.js +28 -79
  90. package/srv/blockchain/signing/signature-verifier.d.ts +9 -47
  91. package/srv/blockchain/signing/signature-verifier.js +70 -83
  92. package/srv/blockchain/signing/submission-finalizer.d.ts +23 -45
  93. package/srv/blockchain/signing/submission-finalizer.js +219 -86
  94. package/srv/blockchain/stored-chain.d.ts +20 -0
  95. package/srv/blockchain/stored-chain.js +237 -0
  96. package/srv/blockchain/transaction-building/buildooor-tx.d.ts +31 -229
  97. package/srv/blockchain/transaction-building/buildooor-tx.js +652 -416
  98. package/srv/blockchain/transaction-building/cardano-tx.d.ts +9 -37
  99. package/srv/blockchain/transaction-presence.d.ts +5 -0
  100. package/srv/blockchain/transaction-presence.js +29 -0
  101. package/srv/blockchain/transaction-rows.d.ts +12 -0
  102. package/srv/blockchain/transaction-rows.js +44 -0
  103. package/srv/blockchain/wallet-worker/build-request.d.ts +5 -20
  104. package/srv/blockchain/wallet-worker/build-request.js +47 -30
  105. package/srv/blockchain/wallet-worker/confirmation-tracker.d.ts +5 -46
  106. package/srv/blockchain/wallet-worker/confirmation-tracker.js +25 -45
  107. package/srv/blockchain/wallet-worker/index.d.ts +1 -1
  108. package/srv/blockchain/wallet-worker/index.js +3 -11
  109. package/srv/blockchain/wallet-worker/job-store.d.ts +30 -148
  110. package/srv/blockchain/wallet-worker/job-store.js +101 -201
  111. package/srv/blockchain/wallet-worker/lease-heartbeat.d.ts +2 -26
  112. package/srv/blockchain/wallet-worker/lease-heartbeat.js +6 -28
  113. package/srv/blockchain/wallet-worker/signers.d.ts +5 -24
  114. package/srv/blockchain/wallet-worker/signers.js +4 -12
  115. package/srv/blockchain/wallet-worker/wallet-worker.d.ts +8 -80
  116. package/srv/blockchain/wallet-worker/wallet-worker.js +107 -155
  117. package/srv/cardano-agent-service.cds +122 -84
  118. package/srv/cardano-agent-service.js +4 -9
  119. package/srv/cardano-backend-service.cds +78 -0
  120. package/srv/cardano-backend-service.d.ts +2 -0
  121. package/srv/cardano-backend-service.js +242 -0
  122. package/srv/cardano-indexer-service.cds +387 -73
  123. package/srv/cardano-indexer-service.d.ts +5 -1
  124. package/srv/cardano-indexer-service.js +532 -16
  125. package/srv/cardano-service.cds +424 -269
  126. package/srv/cardano-service.js +289 -201
  127. package/srv/cardano-sign-service.cds +201 -180
  128. package/srv/cardano-sign-service.js +71 -201
  129. package/srv/cardano-tx-service.cds +451 -370
  130. package/srv/cardano-tx-service.js +271 -289
  131. package/srv/cardano-ui.cds +16 -16
  132. package/srv/cardano-worker-service.cds +118 -125
  133. package/srv/cardano-worker-service.js +52 -61
  134. package/srv/cbor/cip68.d.ts +13 -0
  135. package/srv/cbor/cip68.js +56 -0
  136. package/srv/cbor/index.d.ts +3 -1
  137. package/srv/cbor/index.js +9 -1
  138. package/srv/cbor/parse.d.ts +30 -18
  139. package/srv/cbor/parse.js +44 -9
  140. package/srv/cbor/plutus-data-json.d.ts +20 -0
  141. package/srv/cbor/plutus-data-json.js +32 -0
  142. package/srv/config.d.ts +113 -0
  143. package/srv/config.js +409 -0
  144. package/srv/server.d.ts +15 -110
  145. package/srv/server.js +84 -404
  146. package/srv/utils/agent-access.d.ts +9 -0
  147. package/srv/utils/agent-access.js +67 -0
  148. package/srv/utils/agent-grants-config.d.ts +0 -46
  149. package/srv/utils/agent-grants-config.js +17 -85
  150. package/srv/utils/agent-grants.d.ts +106 -122
  151. package/srv/utils/agent-grants.js +538 -236
  152. package/srv/utils/agent-token-auth.d.ts +4 -99
  153. package/srv/utils/agent-token-auth.js +18 -182
  154. package/srv/utils/backend-request-handler.d.ts +3 -17
  155. package/srv/utils/backend-request-handler.js +3 -18
  156. package/srv/utils/collections.d.ts +3 -10
  157. package/srv/utils/collections.js +3 -10
  158. package/srv/utils/const.d.ts +23 -74
  159. package/srv/utils/const.js +32 -79
  160. package/srv/utils/crypto.d.ts +3 -12
  161. package/srv/utils/crypto.js +6 -21
  162. package/srv/utils/db-indexes.d.ts +27 -0
  163. package/srv/utils/db-indexes.js +120 -0
  164. package/srv/utils/db-sanitize.d.ts +20 -0
  165. package/srv/utils/db-sanitize.js +80 -0
  166. package/srv/utils/deep-json.d.ts +6 -0
  167. package/srv/utils/deep-json.js +240 -0
  168. package/srv/utils/epoch-slots.d.ts +13 -0
  169. package/srv/utils/epoch-slots.js +38 -0
  170. package/srv/utils/error-codes.d.ts +22 -75
  171. package/srv/utils/error-codes.js +23 -72
  172. package/srv/utils/errors.d.ts +46 -187
  173. package/srv/utils/errors.js +114 -230
  174. package/srv/utils/liveness.d.ts +12 -0
  175. package/srv/utils/liveness.js +35 -0
  176. package/srv/utils/mappers.d.ts +102 -223
  177. package/srv/utils/mappers.js +387 -316
  178. package/srv/utils/network-context.js +2 -13
  179. package/srv/utils/paging.d.ts +31 -0
  180. package/srv/utils/paging.js +43 -0
  181. package/srv/utils/pg-inline-json.d.ts +8 -0
  182. package/srv/utils/pg-inline-json.js +58 -0
  183. package/srv/utils/pg-order-nulls.d.ts +14 -0
  184. package/srv/utils/pg-order-nulls.js +54 -0
  185. package/srv/utils/plutus-placeholders.d.ts +16 -22
  186. package/srv/utils/plutus-placeholders.js +62 -33
  187. package/srv/utils/rate-limiter.d.ts +2 -21
  188. package/srv/utils/rate-limiter.js +5 -17
  189. package/srv/utils/readiness.d.ts +12 -0
  190. package/srv/utils/readiness.js +29 -0
  191. package/srv/utils/reference-script.d.ts +19 -0
  192. package/srv/utils/reference-script.js +84 -0
  193. package/srv/utils/result-numbers.d.ts +15 -0
  194. package/srv/utils/result-numbers.js +61 -0
  195. package/srv/utils/service-events.d.ts +0 -24
  196. package/srv/utils/service-events.js +3 -25
  197. package/srv/utils/signing-helper.d.ts +3 -20
  198. package/srv/utils/signing-helper.js +35 -64
  199. package/srv/utils/tx-build-helper.d.ts +10 -105
  200. package/srv/utils/tx-build-helper.js +81 -144
  201. package/srv/utils/tx-request-parsers.d.ts +82 -33
  202. package/srv/utils/tx-request-parsers.js +401 -49
  203. package/srv/utils/tx-utils.d.ts +3 -27
  204. package/srv/utils/tx-utils.js +32 -50
  205. package/srv/utils/types.d.ts +261 -191
  206. package/srv/utils/types.js +2 -6
  207. package/srv/utils/validators.d.ts +22 -92
  208. package/srv/utils/validators.js +50 -149
@@ -1,17 +1,4 @@
1
1
  import type { WorkerSignerTypeValue } from './job-store';
2
- /**
3
- * Wallet-worker signers (v2.0).
4
- *
5
- * `WorkerSigner` is the signer-agnostic surface the worker engine executes against:
6
- * - `hsm` (production): thin wrapper around the already-initialized `HsmSigner`
7
- * (PKCS#11 — keys never leave the module).
8
- * - `software` (dev/test): operator-configured Ed25519 key from an environment
9
- * variable, either plain 64-char hex or AES-256-GCM encrypted
10
- * (`iv:authTag:ciphertext`, keyed by ENCRYPTION_KEY — see srv/utils/crypto.ts).
11
- *
12
- * Keys are NEVER accepted through the OData surface and never persisted; the
13
- * software key lives only in this process's memory.
14
- */
15
2
  export interface WorkerSigner {
16
3
  readonly type: WorkerSignerTypeValue;
17
4
  /** Bech32 enterprise address the wallet spends from. */
@@ -25,22 +12,16 @@ export interface WorkerSigner {
25
12
  export interface WorkerWalletConfig {
26
13
  walletId: string;
27
14
  signerType: WorkerSignerTypeValue;
28
- /**
29
- * software only: name of the environment variable holding the Ed25519 signing
30
- * key — plain 64-char hex, or AES-256-GCM `iv:authTag:ciphertext` (base64 parts).
31
- */
15
+ /** software only. Env var with the Ed25519 key as 64 hex chars or AES-256-GCM `iv:authTag:ciphertext` in base64. */
32
16
  keyEnv?: string;
17
+ /** Role a caller needs to queue jobs for this wallet. Absent = any authenticated user. */
18
+ requiresRole?: string;
33
19
  }
34
- /**
35
- * Merge a single VKey witness [publicKey, signature] into an unsigned transaction's
36
- * witness set at the raw CBOR level, preserving all non-vkey entries (scripts,
37
- * datums, redeemers) and encoding metadata. Same single-signer semantics as
38
- * HsmSigner.signTransaction — the worker wallet is the sole signer of its builds.
39
- */
20
+ /** Replaces the vkey witnesses in the raw CBOR witness set with this one. Other entries and encoding stay. */
40
21
  export declare function mergeVkeyWitness(unsignedTxCbor: string, publicKeyHex: string, signatureHex: string): string;
41
22
  /** Derive the bech32 enterprise key-hash address for a 28-byte key hash. */
42
23
  export declare function deriveEnterpriseAddress(publicKeyHash: Uint8Array, network: string): string;
43
- /** software — in-memory Ed25519 key (dev/test). */
24
+ /** In-memory Ed25519 key for development and tests. */
44
25
  export declare class SoftwareWorkerSigner implements WorkerSigner {
45
26
  readonly type: "software";
46
27
  private readonly privateKey;
@@ -16,12 +16,7 @@ const hsm_signer_1 = require("../signing/hsm-signer");
16
16
  const errors_1 = require("../../utils/errors");
17
17
  const crypto_2 = require("../../utils/crypto");
18
18
  const logger = cds_1.default.log('CardanoWalletWorker');
19
- /**
20
- * Merge a single VKey witness [publicKey, signature] into an unsigned transaction's
21
- * witness set at the raw CBOR level, preserving all non-vkey entries (scripts,
22
- * datums, redeemers) and encoding metadata. Same single-signer semantics as
23
- * HsmSigner.signTransaction — the worker wallet is the sole signer of its builds.
24
- */
19
+ /** Replaces the vkey witnesses in the raw CBOR witness set with this one. Other entries and encoding stay. */
25
20
  function mergeVkeyWitness(unsignedTxCbor, publicKeyHex, signatureHex) {
26
21
  const txObj = cbor_1.Cbor.parse((0, uint8array_utils_1.fromHex)(unsignedTxCbor));
27
22
  if (!(txObj instanceof cbor_1.CborArray) || txObj.array.length < 2) {
@@ -49,7 +44,7 @@ function deriveEnterpriseAddress(publicKeyHash, network) {
49
44
  const hrp = network === 'mainnet' ? 'addr' : 'addr_test';
50
45
  return bech32_1.bech32.encode(hrp, bech32_1.bech32.toWords(payload), 120);
51
46
  }
52
- /** hsm — delegates to the process-wide HsmSigner initialized at bootstrap. */
47
+ /** Delegates to the process-wide HsmSigner set up at bootstrap. */
53
48
  class HsmWorkerSigner {
54
49
  type = 'hsm';
55
50
  get signer() {
@@ -69,7 +64,7 @@ class HsmWorkerSigner {
69
64
  return this.signer.signTransaction(unsignedTxCbor, txBodyHash);
70
65
  }
71
66
  }
72
- /** software — in-memory Ed25519 key (dev/test). */
67
+ /** In-memory Ed25519 key for development and tests. */
73
68
  class SoftwareWorkerSigner {
74
69
  type = 'software';
75
70
  privateKey;
@@ -99,10 +94,7 @@ class SoftwareWorkerSigner {
99
94
  }
100
95
  }
101
96
  exports.SoftwareWorkerSigner = SoftwareWorkerSigner;
102
- /**
103
- * Resolve the software key material for a wallet: plain hex passes through,
104
- * the AES-256-GCM combined format (contains ':') is decrypted with ENCRYPTION_KEY.
105
- */
97
+ /** Plain hex passes through; the AES-256-GCM combined format (contains ':') is decrypted with ENCRYPTION_KEY. */
106
98
  function resolveSoftwareKey(wallet) {
107
99
  if (!wallet.keyEnv) {
108
100
  throw new errors_1.ConfigError(`Wallet worker: wallet "${wallet.walletId}" is signerType=software but has no keyEnv configured`);
@@ -1,34 +1,6 @@
1
1
  import type { CardanoClient } from '../cardano-client';
2
2
  import type { CardanoIndexer } from '../cardano-indexer';
3
3
  import { type WorkerSigner, type WorkerWalletConfig } from './signers';
4
- /**
5
- * Wallet worker engine (v2.0, design §6).
6
- *
7
- * Dispatch loop over `CardanoWalletJobs`: per tick, for every configured wallet
8
- * with pending work and NO active job (building or submitted — the queue stays
9
- * blocked until the previous job CONFIRMS, which makes per-wallet UTxO contention
10
- * impossible by construction), acquire the per-wallet DB lease and execute:
11
- *
12
- * building → CardanoIndexer.index<Kind>BuildResult (build + TransactionBuilds row)
13
- * → signer.signTransaction
14
- * submitting → signed CBOR + hash committed, THEN client.submitTransaction
15
- * submitted → hand to the ConfirmationTracker (crawler hook or polling)
16
- *
17
- * The `submitting` commit is what makes the submit boundary crash-safe: the exact
18
- * bytes that may be on-chain are durable before the network call, and the row stays
19
- * non-terminal, so it keeps holding its idempotency key. Anything that goes wrong
20
- * from there on is reconciled against the chain (`reconcileSubmitting`) — the same
21
- * transaction is re-submitted, never a rebuild.
22
- *
23
- * Transient failures BEFORE the signed tx exists (provider outages, rate limits,
24
- * HSM hiccups during build/sign) re-queue the job with exponential backoff up to
25
- * `maxAttempts`; deterministic rejections (validation, insufficient funds) fail
26
- * immediately.
27
- *
28
- * All DB access runs in short fresh transactions (ambient context cleared —
29
- * NIGHTGATE lesson 2) so the single pooled SQLite connection is never held
30
- * across build/submit round-trips.
31
- */
32
4
  export interface WalletWorkerConfig {
33
5
  enabled: boolean;
34
6
  wallets: WorkerWalletConfig[];
@@ -48,10 +20,7 @@ export interface WalletWorkerDeps {
48
20
  }
49
21
  /** Retry backoff: 5s · 2^(attempt-1), capped at 60s. */
50
22
  export declare function retryBackoffMs(attempt: number): number;
51
- /**
52
- * Transient errors are worth a bounded retry; everything else is deterministic
53
- * (a retry cannot change the outcome) and fails the job immediately.
54
- */
23
+ /** Transient errors get a bounded retry; everything else fails the job immediately. */
55
24
  export declare function isTransientJobError(err: unknown): boolean;
56
25
  export declare class CardanoWalletWorker {
57
26
  private readonly deps;
@@ -61,7 +30,7 @@ export declare class CardanoWalletWorker {
61
30
  private readonly tracker;
62
31
  private dispatchTimer;
63
32
  private running;
64
- private ticking;
33
+ private tickInFlight;
65
34
  constructor(deps: WalletWorkerDeps);
66
35
  isRunning(): boolean;
67
36
  /** Wallets this instance can sign for (signer init succeeded). */
@@ -79,66 +48,25 @@ export declare class CardanoWalletWorker {
79
48
  /** One dispatch round; serialized (overlapping timers collapse into one run). */
80
49
  private tickSafe;
81
50
  private tick;
82
- /**
83
- * Adopt `submitting` rows left behind by a dead executor (this process before a
84
- * restart, or another instance whose lease expired) and resolve them against the
85
- * chain. Runs per wallet under the same lease the executor would hold.
86
- */
51
+ /** Adopt `submitting` rows left by a dead executor and resolve them against the chain, under the wallet lease. */
87
52
  private reconcileOrphanedSubmissions;
88
53
  /** Run one wallet's work in the background, tracked for concurrency + shutdown. */
89
54
  private spawn;
90
55
  /** A heartbeat that keeps this instance's lease on `walletId` alive while it works. */
91
56
  private leaseHeartbeat;
92
- /**
93
- * Execute one job: building → (build → sign) → submitting → submit → submitted,
94
- * then hand to the tracker. The wallet lease is held for the duration — renewed by
95
- * a heartbeat, because build+sign can outlast its TTL — and released afterwards
96
- * (queue serialization continues via the job row, not the lease).
97
- *
98
- * Everything up to and including the `submitting` commit may fail freely — nothing
99
- * has been sent, so the job re-queues or fails normally. Past that commit the job
100
- * belongs to `reconcileSubmitting`.
101
- */
57
+ /** Builds, signs and submits one job under a renewed wallet lease. After the submitting commit, reconcileSubmitting owns it. */
102
58
  private executeJob;
103
- /**
104
- * Send a transaction that is already durable in its `submitting` row and advance
105
- * the job to `submitted`.
106
- *
107
- * A submit failure is NEVER propagated as a job failure here: a rejection from one
108
- * backend does not prove the tx is absent from every mempool (failover, timeouts,
109
- * a node that accepted before the connection dropped). The row simply stays
110
- * `submitting` and the next tick reconciles it against the chain.
111
- */
59
+ /** Sends the stored tx. A failed submit leaves the row submitting, since one rejection proves nothing. */
112
60
  private submitStoredTransaction;
113
61
  /** submitting → submitted + hand to the confirmation tracker. */
114
62
  private adoptSubmitted;
115
- /**
116
- * Resolve a `submitting` job whose submit outcome is unknown (process died around
117
- * the network call, or the call failed ambiguously). The stored transaction is the
118
- * only one this job may ever have — it is re-submitted verbatim, never rebuilt.
119
- *
120
- * 1. Re-submit the same CBOR: mempool/ledger dedup makes this a no-op if it was
121
- * accepted before, so success (or "already known") simply promotes the job.
122
- * 2. If that fails, ask the chain: found → the tx did make it, promote it.
123
- * 3. Only when the chain proves absence AND the node rejects the tx for good (or
124
- * it has been absent past the confirmation timeout) is the job failed —
125
- * failing releases the idempotency key, so it needs that proof.
126
- * Anything else leaves the row as-is; the next tick tries again.
127
- *
128
- * Runs under the same heartbeat-kept wallet lease as an execution: the chain
129
- * lookups here are slow enough to outlive the raw TTL. Losing the lease mid-way
130
- * is not dangerous (the re-submit is the same transaction, and every terminal
131
- * transition is row-guarded), so it only stops further work.
132
- */
133
63
  private reconcileSubmitting;
134
64
  private failReconciled;
65
+ /** The job's build, ready to run in a transaction. A malformed request throws 400 INVALID_INPUT here. */
66
+ private buildOf;
135
67
  /** Dispatch the job kind to the matching indexer build method. */
136
68
  private buildForKind;
137
- /**
138
- * Submit tolerant of "already known": after a crash between submit and the
139
- * `submitted` transition, the retry re-submits the same CBOR — mempool dedup
140
- * answers with an already-submitted error that IS our success case.
141
- */
69
+ /** Submit treating "already known" as success: a re-submit of the same CBOR after a crash hits mempool dedup. */
142
70
  private submitWithAlreadyKnownTolerance;
143
71
  private handleExecutionFailure;
144
72
  }