@odatano/core 2.0.0-rc.44 → 2.0.0-rc.45

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 (168) hide show
  1. package/@cds-models/CardanoAgentService/index.d.ts +0 -46
  2. package/@cds-models/CardanoBackendService/index.d.ts +0 -10
  3. package/@cds-models/CardanoIndexerService/index.d.ts +5 -20
  4. package/@cds-models/CardanoODataService/index.d.ts +18 -47
  5. package/@cds-models/CardanoSignService/index.d.ts +3 -18
  6. package/@cds-models/CardanoTransactionService/index.d.ts +9 -31
  7. package/@cds-models/CardanoWorkerService/index.d.ts +3 -19
  8. package/@cds-models/index.d.ts +17 -0
  9. package/@cds-models/index.js +2 -0
  10. package/@cds-models/odatano/cardano/index.d.ts +0 -34
  11. package/README.md +6 -6
  12. package/db/schema.cds +25 -44
  13. package/db/types.cds +22 -5
  14. package/package.json +3 -1
  15. package/scripts/migrate-slot-leader.mjs +3 -11
  16. package/scripts/migrate-txseq.mjs +3 -12
  17. package/src/index.d.ts +0 -4
  18. package/src/index.js +3 -5
  19. package/src/plugin.js +4 -8
  20. package/srv/blockchain/asset-decimals.d.ts +0 -9
  21. package/srv/blockchain/asset-decimals.js +21 -16
  22. package/srv/blockchain/backends/blockfrost-backend.d.ts +2 -10
  23. package/srv/blockchain/backends/blockfrost-backend.js +15 -21
  24. package/srv/blockchain/backends/cardano-backend.d.ts +12 -71
  25. package/srv/blockchain/backends/koios-backend.d.ts +14 -147
  26. package/srv/blockchain/backends/koios-backend.js +40 -164
  27. package/srv/blockchain/backends/odatano-backend.d.ts +1 -11
  28. package/srv/blockchain/backends/odatano-backend.js +11 -12
  29. package/srv/blockchain/backends/ogmios-backend.d.ts +13 -160
  30. package/srv/blockchain/backends/ogmios-backend.js +48 -175
  31. package/srv/blockchain/backends/ogmios-frame-guard.d.ts +2 -18
  32. package/srv/blockchain/backends/ogmios-frame-guard.js +8 -20
  33. package/srv/blockchain/cardano-client.d.ts +12 -80
  34. package/srv/blockchain/cardano-client.js +36 -88
  35. package/srv/blockchain/cardano-indexer.d.ts +12 -192
  36. package/srv/blockchain/cardano-indexer.js +126 -222
  37. package/srv/blockchain/cardano-tx-builder.d.ts +1 -28
  38. package/srv/blockchain/cardano-tx-builder.js +17 -34
  39. package/srv/blockchain/circuit-breaker.d.ts +1 -13
  40. package/srv/blockchain/circuit-breaker.js +5 -15
  41. package/srv/blockchain/crawler/asset-decimals-backfill.d.ts +0 -5
  42. package/srv/blockchain/crawler/asset-decimals-backfill.js +2 -5
  43. package/srv/blockchain/crawler/certificate-backfill.d.ts +0 -17
  44. package/srv/blockchain/crawler/certificate-backfill.js +8 -22
  45. package/srv/blockchain/crawler/crawler.d.ts +16 -93
  46. package/srv/blockchain/crawler/crawler.js +85 -160
  47. package/srv/blockchain/crawler/credential-backfill.d.ts +0 -10
  48. package/srv/blockchain/crawler/credential-backfill.js +2 -4
  49. package/srv/blockchain/crawler/hooks.d.ts +1 -5
  50. package/srv/blockchain/crawler/index.d.ts +0 -12
  51. package/srv/blockchain/crawler/index.js +6 -20
  52. package/srv/blockchain/crawler/sync-state.d.ts +6 -44
  53. package/srv/blockchain/crawler/sync-state.js +18 -53
  54. package/srv/blockchain/crawler/transaction-backfill.d.ts +0 -11
  55. package/srv/blockchain/crawler/transaction-backfill.js +11 -30
  56. package/srv/blockchain/crawler/utxo-set-import.d.ts +1 -30
  57. package/srv/blockchain/crawler/utxo-set-import.js +27 -53
  58. package/srv/blockchain/ledger-state.d.ts +10 -54
  59. package/srv/blockchain/ledger-state.js +11 -27
  60. package/srv/blockchain/pending-spends.d.ts +0 -12
  61. package/srv/blockchain/pending-spends.js +4 -12
  62. package/srv/blockchain/request-coalescer.d.ts +2 -16
  63. package/srv/blockchain/request-coalescer.js +2 -16
  64. package/srv/blockchain/signing/cose-verifier.d.ts +0 -9
  65. package/srv/blockchain/signing/cose-verifier.js +4 -10
  66. package/srv/blockchain/signing/external-signer.d.ts +1 -4
  67. package/srv/blockchain/signing/external-signer.js +2 -8
  68. package/srv/blockchain/signing/hsm-signer.d.ts +6 -18
  69. package/srv/blockchain/signing/hsm-signer.js +16 -28
  70. package/srv/blockchain/signing/signature-verifier.d.ts +1 -8
  71. package/srv/blockchain/signing/signature-verifier.js +9 -19
  72. package/srv/blockchain/signing/submission-finalizer.d.ts +10 -16
  73. package/srv/blockchain/signing/submission-finalizer.js +48 -19
  74. package/srv/blockchain/stored-chain.d.ts +1 -14
  75. package/srv/blockchain/stored-chain.js +3 -8
  76. package/srv/blockchain/transaction-building/buildooor-fee-patch.d.ts +0 -4
  77. package/srv/blockchain/transaction-building/buildooor-fee-patch.js +4 -9
  78. package/srv/blockchain/transaction-building/buildooor-tx.d.ts +7 -150
  79. package/srv/blockchain/transaction-building/buildooor-tx.js +91 -196
  80. package/srv/blockchain/transaction-building/caller-datums.d.ts +0 -14
  81. package/srv/blockchain/transaction-building/caller-datums.js +3 -9
  82. package/srv/blockchain/transaction-building/cardano-tx.d.ts +1 -4
  83. package/srv/blockchain/wallet-worker/build-request.d.ts +0 -5
  84. package/srv/blockchain/wallet-worker/build-request.js +6 -9
  85. package/srv/blockchain/wallet-worker/confirmation-tracker.d.ts +5 -23
  86. package/srv/blockchain/wallet-worker/confirmation-tracker.js +16 -20
  87. package/srv/blockchain/wallet-worker/index.d.ts +1 -1
  88. package/srv/blockchain/wallet-worker/index.js +3 -5
  89. package/srv/blockchain/wallet-worker/job-store.d.ts +15 -65
  90. package/srv/blockchain/wallet-worker/job-store.js +0 -0
  91. package/srv/blockchain/wallet-worker/lease-heartbeat.d.ts +2 -10
  92. package/srv/blockchain/wallet-worker/lease-heartbeat.js +6 -12
  93. package/srv/blockchain/wallet-worker/signers.d.ts +3 -11
  94. package/srv/blockchain/wallet-worker/signers.js +3 -6
  95. package/srv/blockchain/wallet-worker/wallet-worker.d.ts +3 -21
  96. package/srv/blockchain/wallet-worker/wallet-worker.js +47 -54
  97. package/srv/cardano-agent-service.cds +123 -146
  98. package/srv/cardano-agent-service.js +2 -5
  99. package/srv/cardano-backend-service.cds +10 -17
  100. package/srv/cardano-backend-service.js +7 -12
  101. package/srv/cardano-indexer-service.cds +16 -37
  102. package/srv/cardano-indexer-service.d.ts +5 -1
  103. package/srv/cardano-indexer-service.js +44 -35
  104. package/srv/cardano-service.cds +56 -40
  105. package/srv/cardano-service.js +42 -69
  106. package/srv/cardano-sign-service.cds +14 -23
  107. package/srv/cardano-sign-service.js +18 -24
  108. package/srv/cardano-tx-service.cds +27 -29
  109. package/srv/cardano-tx-service.js +60 -122
  110. package/srv/cardano-worker-service.cds +109 -125
  111. package/srv/cardano-worker-service.js +21 -31
  112. package/srv/cbor/cip68.d.ts +0 -4
  113. package/srv/cbor/cip68.js +2 -4
  114. package/srv/cbor/parse.d.ts +3 -18
  115. package/srv/cbor/parse.js +2 -7
  116. package/srv/cbor/plutus-data-json.d.ts +0 -4
  117. package/srv/server.d.ts +5 -36
  118. package/srv/server.js +30 -51
  119. package/srv/utils/agent-grants-config.d.ts +0 -18
  120. package/srv/utils/agent-grants-config.js +6 -13
  121. package/srv/utils/agent-grants.d.ts +14 -68
  122. package/srv/utils/agent-grants.js +42 -60
  123. package/srv/utils/agent-token-auth.d.ts +0 -5
  124. package/srv/utils/agent-token-auth.js +2 -5
  125. package/srv/utils/backend-request-handler.d.ts +1 -1
  126. package/srv/utils/collections.d.ts +1 -4
  127. package/srv/utils/collections.js +1 -4
  128. package/srv/utils/const.d.ts +0 -18
  129. package/srv/utils/const.js +7 -18
  130. package/srv/utils/crypto.js +3 -5
  131. package/srv/utils/db-indexes.d.ts +2 -0
  132. package/srv/utils/db-indexes.js +22 -9
  133. package/srv/utils/db-sanitize.d.ts +1 -8
  134. package/srv/utils/db-sanitize.js +3 -8
  135. package/srv/utils/epoch-slots.d.ts +1 -8
  136. package/srv/utils/epoch-slots.js +3 -8
  137. package/srv/utils/error-codes.d.ts +0 -4
  138. package/srv/utils/error-codes.js +2 -4
  139. package/srv/utils/errors.d.ts +2 -22
  140. package/srv/utils/errors.js +13 -27
  141. package/srv/utils/liveness.d.ts +0 -4
  142. package/srv/utils/liveness.js +2 -4
  143. package/srv/utils/mappers.d.ts +0 -37
  144. package/srv/utils/mappers.js +19 -39
  145. package/srv/utils/network-context.js +2 -4
  146. package/srv/utils/paging.d.ts +31 -0
  147. package/srv/utils/paging.js +43 -0
  148. package/srv/utils/pg-inline-json.js +3 -7
  149. package/srv/utils/pg-order-nulls.js +2 -5
  150. package/srv/utils/plutus-placeholders.d.ts +0 -13
  151. package/srv/utils/plutus-placeholders.js +6 -13
  152. package/srv/utils/rate-limiter.d.ts +0 -8
  153. package/srv/utils/rate-limiter.js +2 -4
  154. package/srv/utils/reference-script.d.ts +0 -18
  155. package/srv/utils/reference-script.js +8 -19
  156. package/srv/utils/service-events.d.ts +0 -4
  157. package/srv/utils/service-events.js +2 -4
  158. package/srv/utils/signing-helper.d.ts +1 -8
  159. package/srv/utils/signing-helper.js +3 -8
  160. package/srv/utils/tx-build-helper.d.ts +2 -32
  161. package/srv/utils/tx-build-helper.js +26 -40
  162. package/srv/utils/tx-request-parsers.d.ts +1 -25
  163. package/srv/utils/tx-request-parsers.js +10 -25
  164. package/srv/utils/tx-utils.d.ts +0 -8
  165. package/srv/utils/tx-utils.js +10 -13
  166. package/srv/utils/types.d.ts +2 -37
  167. package/srv/utils/validators.d.ts +0 -4
  168. package/srv/utils/validators.js +2 -4
@@ -13,16 +13,21 @@ const cardano_ledger_ts_1 = require("@harmoniclabs/cardano-ledger-ts");
13
13
  const mappers_1 = require("./utils/mappers");
14
14
  const server_1 = require("./server");
15
15
  const signing_helper_1 = require("./utils/signing-helper");
16
+ const tx_utils_1 = require("./utils/tx-utils");
17
+ const paging_1 = require("./utils/paging");
18
+ const submission_finalizer_1 = require("./blockchain/signing/submission-finalizer");
19
+ const CardanoTransactionService_1 = require("#cds-models/CardanoTransactionService");
16
20
  const const_1 = require("./utils/const");
17
21
  const tx_request_parsers_1 = require("./utils/tx-request-parsers");
18
- const VALID_DERIVE_NETWORKS = ['mainnet', 'preview', 'preprod'];
19
22
  const { SELECT, UPDATE } = cds_1.default.ql;
23
+ /** Blocks on top of a submitted transaction, its own included, before CheckSubmissionStatus confirms it. */
24
+ const SUBMISSION_CONFIRMATION_DEPTH = 3;
20
25
  const logger = cds_1.default.log('CardanoTxService');
21
26
  /** CardanoTransactionService handlers: transaction building, submission and script helpers. */
22
27
  module.exports = (srv) => {
23
28
  logger.debug('Module loaded - registering handlers');
24
29
  const { TransactionBuilds, TransactionSubmissions, AddressTransactionBuilds } = require('#cds-models/CardanoTransactionService');
25
- // BuildSimpleAdaTransaction — ADA (optionally with assets / datum) to one recipient or a script.
30
+ // BuildSimpleAdaTransaction: ADA (optionally with assets / datum) to one recipient or a script.
26
31
  srv.on('BuildSimpleAdaTransaction', async (req) => {
27
32
  const { senderAddress, recipientAddress, lovelaceAmount, outputDatumJson, assetsJson, forceInputsJson, validatorScript, scriptParamsJson, lockOnScript, referenceScriptHex, validityStartMs, validityEndMs } = req.data;
28
33
  const errors = (0, validators_1.validateTransactionInputs)({ senderAddress, recipientAddress, lovelaceAmount, referenceScriptHex, validityStartMs, validityEndMs }, ['senderAddress', 'recipientAddress', 'lovelaceAmount']);
@@ -118,7 +123,7 @@ module.exports = (srv) => {
118
123
  return buildResult;
119
124
  });
120
125
  });
121
- // BuildTransactionWithMetadata — ADA transfer with auxiliary metadata.
126
+ // BuildTransactionWithMetadata: ADA transfer with auxiliary metadata.
122
127
  srv.on('BuildTransactionWithMetadata', async (req) => {
123
128
  const { senderAddress, recipientAddress, lovelaceAmount, metadataJson } = req.data;
124
129
  const errors = (0, validators_1.validateTransactionInputs)({ senderAddress, recipientAddress, lovelaceAmount, metadataJson }, ['senderAddress', 'recipientAddress', 'lovelaceAmount', 'metadataJson']);
@@ -133,7 +138,7 @@ module.exports = (srv) => {
133
138
  return await (0, server_1.getCardanoIndexer)().indexMetadataBuildResult(db, { ...req.data, metadataJson: parsedMetadata });
134
139
  });
135
140
  });
136
- // BuildMultiAssetTransaction — ADA plus native assets to one recipient.
141
+ // BuildMultiAssetTransaction: ADA plus native assets to one recipient.
137
142
  srv.on('BuildMultiAssetTransaction', async (req) => {
138
143
  const { senderAddress, recipientAddress, lovelaceAmount, assetsJson, outputDatumJson, referenceScriptHex, validityStartMs, validityEndMs } = req.data;
139
144
  const errors = (0, validators_1.validateTransactionInputs)({ senderAddress, recipientAddress, lovelaceAmount, assetsJson, referenceScriptHex, validityStartMs, validityEndMs }, ['senderAddress', 'recipientAddress', 'lovelaceAmount', 'assetsJson']);
@@ -177,7 +182,7 @@ module.exports = (srv) => {
177
182
  return result;
178
183
  });
179
184
  });
180
- // BuildMintTransaction — mint/burn under one or more Plutus policies.
185
+ // BuildMintTransaction: mint/burn under one or more Plutus policies.
181
186
  srv.on('BuildMintTransaction', async (req) => {
182
187
  const { senderAddress, recipientAddress, lovelaceAmount, mintActionsJson, mintingPolicyScript, requiredSignersJson, scriptParamsJson, inlineDatumJson, mintRedeemerJson, lockOnScript, forceInputsJson, referenceInputsJson, referenceScriptHex, extraOutputsJson, metadataJson, validityStartMs, validityEndMs } = req.data;
183
188
  const errors = (0, validators_1.validateTransactionInputs)({ senderAddress, recipientAddress, lovelaceAmount, mintActionsJson, mintingPolicyScript, referenceScriptHex, metadataJson, validityStartMs, validityEndMs }, ['senderAddress', 'recipientAddress', 'lovelaceAmount', 'mintActionsJson', 'mintingPolicyScript']);
@@ -215,7 +220,7 @@ module.exports = (srv) => {
215
220
  action.assetUnit.length % 2 === 0 &&
216
221
  /^[0-9a-fA-F]*$/.test(action.assetUnit);
217
222
  if (typeof action.assetUnit !== 'string' || (!(0, validators_1.isAssetUnit)(action.assetUnit) && !bareAssetNameForExpansion)) {
218
- return (0, errors_1.rejectInvalid)(req, 'BuildMintTransaction', `Invalid assetUnit: "${action.assetUnit}" — must be policyId+assetName hex (or a bare assetName hex when scriptParamsJson or a per-action mintingPolicyScript is set)`, 'mintActionsJson');
223
+ return (0, errors_1.rejectInvalid)(req, 'BuildMintTransaction', `Invalid assetUnit: "${action.assetUnit}": must be policyId+assetName hex (or a bare assetName hex when scriptParamsJson or a per-action mintingPolicyScript is set)`, 'mintActionsJson');
219
224
  }
220
225
  let assetUnit = action.assetUnit;
221
226
  if (actionPolicyId) {
@@ -230,7 +235,7 @@ module.exports = (srv) => {
230
235
  return (0, errors_1.rejectInvalid)(req, 'BuildMintTransaction', 'Each mint action must have a string quantity', 'mintActionsJson');
231
236
  }
232
237
  if (!/^-?\d+$/.test(action.quantity)) {
233
- return (0, errors_1.rejectInvalid)(req, 'BuildMintTransaction', `Invalid quantity format: "${action.quantity}" — must be an integer string`, 'mintActionsJson');
238
+ return (0, errors_1.rejectInvalid)(req, 'BuildMintTransaction', `Invalid quantity format: "${action.quantity}": must be an integer string`, 'mintActionsJson');
234
239
  }
235
240
  try {
236
241
  return {
@@ -242,7 +247,7 @@ module.exports = (srv) => {
242
247
  };
243
248
  }
244
249
  catch {
245
- return (0, errors_1.rejectInvalid)(req, 'BuildMintTransaction', `Invalid quantity: "${action.quantity}" — cannot parse as integer`, 'mintActionsJson');
250
+ return (0, errors_1.rejectInvalid)(req, 'BuildMintTransaction', `Invalid quantity: "${action.quantity}": cannot parse as integer`, 'mintActionsJson');
246
251
  }
247
252
  });
248
253
  const requiredSignersResult = (0, tx_request_parsers_1.parseRequiredSigners)(requiredSignersJson);
@@ -368,7 +373,7 @@ module.exports = (srv) => {
368
373
  const policyId = effectivePolicyId;
369
374
  const mismatch = parsedMintActions.find((action) => !action.mintingPolicyScript && !action.assetUnit.toLowerCase().startsWith(policyId));
370
375
  if (mismatch) {
371
- return (0, errors_1.rejectInvalid)(req, 'BuildMintTransaction', `assetUnit "${mismatch.assetUnit}" does not start with the minting policy id ${policyId} — pass the full unit as policyId+assetName (asset names longer than 28 bytes cannot be passed bare)`, 'mintActionsJson');
376
+ return (0, errors_1.rejectInvalid)(req, 'BuildMintTransaction', `assetUnit "${mismatch.assetUnit}" does not start with the minting policy id ${policyId}: pass the full unit as policyId+assetName (asset names longer than 28 bytes cannot be passed bare)`, 'mintActionsJson');
372
377
  }
373
378
  }
374
379
  const buildResult = await (0, server_1.getCardanoIndexer)().indexMintBuildResult(db, {
@@ -409,7 +414,7 @@ module.exports = (srv) => {
409
414
  return buildResult;
410
415
  });
411
416
  });
412
- // BuildPlutusSpendTransaction — consume a UTxO at a script address, optionally minting too.
417
+ // BuildPlutusSpendTransaction: consume a UTxO at a script address, optionally minting too.
413
418
  srv.on('BuildPlutusSpendTransaction', async (req) => {
414
419
  const { senderAddress, recipientAddress, lovelaceAmount, validatorScript, scriptTxHash, scriptOutputIndex, redeemerJson, datumJson, requiredSignersJson, scriptParamsJson, inlineDatumJson, lockOnScript, forceInputsJson, extraOutputsJson, mintActionsJson, mintingPolicyScript, mintRedeemerJson, referenceInputsJson, referenceScriptHex, validityStartMs, validityEndMs } = req.data;
415
420
  const errors = (0, validators_1.validateTransactionInputs)({ senderAddress, recipientAddress, lovelaceAmount, validatorScript, scriptTxHash, scriptOutputIndex, redeemerJson, datumJson, referenceScriptHex, validityStartMs, validityEndMs }, ['senderAddress', 'recipientAddress', 'lovelaceAmount', 'validatorScript', 'scriptTxHash', 'redeemerJson']);
@@ -483,7 +488,7 @@ module.exports = (srv) => {
483
488
  }
484
489
  const action = rawAction;
485
490
  if (typeof action.quantity !== 'string' || !/^-?\d+$/.test(action.quantity)) {
486
- return (0, errors_1.rejectInvalid)(req, 'BuildPlutusSpendTransaction', `Invalid quantity: "${action.quantity}" — must be an integer string`, 'mintActionsJson');
491
+ return (0, errors_1.rejectInvalid)(req, 'BuildPlutusSpendTransaction', `Invalid quantity: "${action.quantity}": must be an integer string`, 'mintActionsJson');
487
492
  }
488
493
  if (typeof action.assetUnit !== 'string') {
489
494
  return (0, errors_1.rejectInvalid)(req, 'BuildPlutusSpendTransaction', 'Each mint action must have assetUnit string', 'mintActionsJson');
@@ -508,7 +513,7 @@ module.exports = (srv) => {
508
513
  action.assetUnit.length % 2 === 0 &&
509
514
  /^[0-9a-fA-F]*$/.test(action.assetUnit);
510
515
  if (!(0, validators_1.isAssetUnit)(action.assetUnit) && !bareAssetNameForExpansion) {
511
- return (0, errors_1.rejectInvalid)(req, 'BuildPlutusSpendTransaction', `Invalid assetUnit: "${action.assetUnit}" — must be policyId+assetName hex (or a bare assetName hex when a per-action mintingPolicyScript is set, or scriptParamsJson is set and the policy equals the validator)`, 'mintActionsJson');
516
+ return (0, errors_1.rejectInvalid)(req, 'BuildPlutusSpendTransaction', `Invalid assetUnit: "${action.assetUnit}": must be policyId+assetName hex (or a bare assetName hex when a per-action mintingPolicyScript is set, or scriptParamsJson is set and the policy equals the validator)`, 'mintActionsJson');
512
517
  }
513
518
  let assetUnit = action.assetUnit;
514
519
  if (actionPolicyId) {
@@ -586,7 +591,7 @@ module.exports = (srv) => {
586
591
  // Actions with a per-action script were already checked against that policy id.
587
592
  const mismatch = parsedMintActions.find((action) => !action.mintingPolicyScript && !action.assetUnit.toLowerCase().startsWith(policyId));
588
593
  if (mismatch) {
589
- return (0, errors_1.rejectInvalid)(req, 'BuildPlutusSpendTransaction', `assetUnit "${mismatch.assetUnit}" does not start with the minting policy id ${policyId} — pass the full unit as policyId+assetName (asset names longer than 28 bytes cannot be passed bare)`, 'mintActionsJson');
594
+ return (0, errors_1.rejectInvalid)(req, 'BuildPlutusSpendTransaction', `assetUnit "${mismatch.assetUnit}" does not start with the minting policy id ${policyId}: pass the full unit as policyId+assetName (asset names longer than 28 bytes cannot be passed bare)`, 'mintActionsJson');
590
595
  }
591
596
  }
592
597
  }
@@ -651,7 +656,7 @@ module.exports = (srv) => {
651
656
  return buildResult;
652
657
  });
653
658
  });
654
- // BuildPlutusTransaction — several script UTxOs in one transaction, each with its own redeemer.
659
+ // BuildPlutusTransaction: several script UTxOs in one transaction, each with its own redeemer.
655
660
  srv.on('BuildPlutusTransaction', async (req) => {
656
661
  const { senderAddress, changeAddress, scriptInputsJson, outputsJson, referenceInputsJson, forceInputsJson, protectInputsJson, withdrawalsJson, certificatesJson, requiredSignersJson, mintActionsJson, validityStartMs, validityEndMs } = req.data;
657
662
  const action = 'BuildPlutusTransaction';
@@ -770,7 +775,7 @@ module.exports = (srv) => {
770
775
  return (0, server_1.getCardanoIndexer)().indexPlutusBuildResult(db, buildReq);
771
776
  });
772
777
  });
773
- // GetBuildDetails — an existing transaction build by id.
778
+ // GetBuildDetails: an existing transaction build by id.
774
779
  srv.on('GetBuildDetails', async (req) => {
775
780
  const { buildId } = req.data;
776
781
  const errors = (0, validators_1.validateTransactionInputs)({ buildId }, ['buildId']);
@@ -782,7 +787,7 @@ module.exports = (srv) => {
782
787
  return existing;
783
788
  });
784
789
  });
785
- // SetCollateral — collateral is available when the builders would find it: an ADA-only UTxO of
790
+ // SetCollateral: collateral is available when the builders would find it: an ADA-only UTxO of
786
791
  // >= 5 ADA without a reference script, plus another UTxO to fund with; otherwise a self-send creates one.
787
792
  srv.on('SetCollateral', async (req) => {
788
793
  const { address } = req.data;
@@ -810,7 +815,7 @@ module.exports = (srv) => {
810
815
  }
811
816
  const totalLovelace = utxos.reduce((sum, u) => sum + (0, tx_build_helper_1.getLovelace)(u), 0n);
812
817
  if (totalLovelace < const_1.COLLATERAL_LOVELACE + const_1.FEE_BUFFER_LOVELACE) {
813
- return (0, errors_1.rejectInvalid)(req, 'SetCollateral', `Insufficient funds — need at least ${Number(const_1.COLLATERAL_LOVELACE + const_1.FEE_BUFFER_LOVELACE) / 1_000_000} ADA, have ${Number(totalLovelace) / 1_000_000} ADA`, 'address');
818
+ return (0, errors_1.rejectInvalid)(req, 'SetCollateral', `Insufficient funds: need at least ${Number(const_1.COLLATERAL_LOVELACE + const_1.FEE_BUFFER_LOVELACE) / 1_000_000} ADA, have ${Number(totalLovelace) / 1_000_000} ADA`, 'address');
814
819
  }
815
820
  logger.debug({ address, existingQualifying: qualifyingUtxos.length }, 'Building collateral setup transaction');
816
821
  const result = await (0, server_1.getCardanoIndexer)().indexSimpleBuildResult(db, {
@@ -823,97 +828,52 @@ module.exports = (srv) => {
823
828
  return { ...result, collateralAvailable: false };
824
829
  });
825
830
  });
826
- // SubmitTransaction — submit the signed CBOR of a previous build.
827
- srv.on('SubmitTransaction', async (req) => {
831
+ // SubmitTransaction: submit the signed CBOR of a previous build.
832
+ srv.on(CardanoTransactionService_1.SubmitTransaction, async (req) => {
828
833
  logger.debug('SubmitTransaction Action handler called');
829
834
  const { buildId, signedTxCbor: signedInput } = req.data;
835
+ if (!buildId)
836
+ return (0, errors_1.rejectMissing)(req, 'SubmitTransaction', 'buildId');
837
+ if (!signedInput)
838
+ return (0, errors_1.rejectMissing)(req, 'SubmitTransaction', 'signedTxCbor');
830
839
  const errors = (0, validators_1.validateTransactionInputs)({ buildId, signedTxCbor: signedInput }, ['buildId', 'signedTxCbor']);
831
840
  (0, errors_1.throwIfValidationErrors)(req, 'SubmitTransaction', errors);
832
- return (0, backend_request_handler_1.handleRequest)(req, async (db) => {
833
- logger.debug({ buildId }, 'Submitting signed transaction');
834
- const existing = await db.run(SELECT.one.from(TransactionBuilds).where({ id: buildId }));
835
- if (!existing)
841
+ try {
842
+ const build = await (0, tx_utils_1.detachedTx)('load build for submit', (db) => db.run(SELECT.one.from(TransactionBuilds).columns('unsignedTxCbor', 'txBodyHash').where({ id: buildId })));
843
+ if (!build)
836
844
  throw new errors_1.NotFoundError(`Build '${buildId}'`);
837
845
  // A CIP-30 wallet returns only the witness set; cardano-cli a full signed tx.
838
- const signedTxCbor = (0, signing_helper_1.toSignedTransaction)(existing.unsignedTxCbor, signedInput);
846
+ const signedTxCbor = (0, signing_helper_1.toSignedTransaction)(build.unsignedTxCbor, signedInput);
839
847
  // The signed CBOR must belong to this build (audit-trail integrity)
840
848
  const signedTxHash = (0, tx_build_helper_1.getTxHashFromCbor)(signedTxCbor);
841
- if (signedTxHash !== existing.txBodyHash) {
842
- return (0, errors_1.rejectInvalid)(req, 'SubmitTransaction', `signedTxCbor hash '${signedTxHash}' does not match build txBodyHash '${existing.txBodyHash}'`, 'signedTxCbor');
843
- }
844
- const txHash = existing.txBodyHash;
845
- // Two-phase submit: persist as 'pending', then submit
846
- const submissionRecord = await (0, server_1.getCardanoIndexer)().persistTransactionSubmission(db, {
847
- signedTxCbor,
848
- txHash,
849
- buildId,
850
- });
851
- try {
852
- await (0, server_1.getCardanoClient)().submitTransaction(signedTxCbor);
853
- logger.info({ txHash }, 'Transaction submitted to blockchain');
854
- await (0, server_1.getCardanoIndexer)().updateSubmissionStatus(db, submissionRecord.id, 'submitted');
855
- submissionRecord.status = 'submitted';
856
- // Best-effort UTxO cache invalidation (spent inputs, output addresses, sender);
857
- // a failure must not fail the successful submit.
858
- try {
859
- const addrBuild = await db.run(SELECT.one.from(AddressTransactionBuilds).where({ txBuild_id: buildId }));
860
- await (0, server_1.getCardanoIndexer)().invalidateUtxoCacheForTx(db, (0, tx_build_helper_1.extractTxCacheTargets)(signedTxCbor), addrBuild?.address_address ? [addrBuild.address_address] : []);
861
- }
862
- catch (invalidateErr) {
863
- logger.warn(`UTxO cache invalidation failed (submit unaffected): ${invalidateErr instanceof Error ? invalidateErr.message : String(invalidateErr)}`);
864
- }
849
+ if (signedTxHash !== build.txBodyHash) {
850
+ (0, errors_1.rejectInvalid)(req, 'SubmitTransaction', `signedTxCbor hash '${signedTxHash}' does not match build txBodyHash '${build.txBodyHash}'`, 'signedTxCbor');
865
851
  }
866
- catch (err) {
867
- const errMsg = err instanceof Error ? err.message : String(err);
868
- logger.error({ txHash, error: errMsg }, 'Transaction submission failed');
869
- await (0, server_1.getCardanoIndexer)().updateSubmissionStatus(db, submissionRecord.id, 'failed', errMsg);
870
- throw err;
871
- }
872
- return submissionRecord;
873
- });
852
+ return await (0, submission_finalizer_1.submitRecorded)({ signedTxCbor, txHash: build.txBodyHash, buildId });
853
+ }
854
+ catch (e) {
855
+ return (0, mappers_1.mapError)(req, e, 'SubmitTransaction');
856
+ }
874
857
  });
875
- // SubmitSignedTransaction — submit externally built signed CBOR (no prior build).
858
+ // SubmitSignedTransaction: submit externally built signed CBOR (no prior build).
876
859
  srv.on('SubmitSignedTransaction', async (req) => {
877
860
  logger.debug('SubmitSignedTransaction Action handler called');
878
861
  const { signedTxCbor, network } = req.data;
879
862
  const errors = (0, validators_1.validateTransactionInputs)({ signedTxCbor }, ['signedTxCbor']);
880
863
  (0, errors_1.throwIfValidationErrors)(req, 'SubmitSignedTransaction', errors);
881
- return (0, backend_request_handler_1.handleRequest)(req, async (db) => {
864
+ try {
882
865
  // A caller targeting the wrong deployment gets a clear 400
883
866
  const configuredNetwork = (0, server_1.getCardanoClient)().network;
884
867
  if (network && network !== configuredNetwork) {
885
- return (0, errors_1.rejectInvalid)(req, 'SubmitSignedTransaction', `network '${network}' does not match this deployment's network '${configuredNetwork}'`, 'network');
886
- }
887
- const txHash = (0, tx_build_helper_1.getTxHashFromCbor)(signedTxCbor);
888
- // Two-phase submit: persist as 'pending', then submit
889
- const submissionRecord = await (0, server_1.getCardanoIndexer)().persistTransactionSubmission(db, {
890
- signedTxCbor,
891
- txHash,
892
- buildId: null,
893
- });
894
- try {
895
- await (0, server_1.getCardanoClient)().submitTransaction(signedTxCbor);
896
- logger.info({ txHash }, 'External transaction submitted');
897
- await (0, server_1.getCardanoIndexer)().updateSubmissionStatus(db, submissionRecord.id, 'submitted');
898
- submissionRecord.status = 'submitted';
899
- // Best-effort UTxO cache invalidation
900
- try {
901
- await (0, server_1.getCardanoIndexer)().invalidateUtxoCacheForTx(db, (0, tx_build_helper_1.extractTxCacheTargets)(signedTxCbor));
902
- }
903
- catch (invalidateErr) {
904
- logger.warn(`UTxO cache invalidation failed (submit unaffected): ${invalidateErr instanceof Error ? invalidateErr.message : String(invalidateErr)}`);
905
- }
906
- }
907
- catch (err) {
908
- const errMsg = err instanceof Error ? err.message : String(err);
909
- logger.error({ txHash, error: errMsg }, 'External transaction submission failed');
910
- await (0, server_1.getCardanoIndexer)().updateSubmissionStatus(db, submissionRecord.id, 'failed', errMsg);
911
- throw err;
868
+ (0, errors_1.rejectInvalid)(req, 'SubmitSignedTransaction', `network '${network}' does not match this deployment's network '${configuredNetwork}'`, 'network');
912
869
  }
913
- return submissionRecord;
914
- });
870
+ return await (0, submission_finalizer_1.submitRecorded)({ signedTxCbor, txHash: (0, tx_build_helper_1.getTxHashFromCbor)(signedTxCbor), buildId: null });
871
+ }
872
+ catch (e) {
873
+ return (0, mappers_1.mapError)(req, e, 'SubmitSignedTransaction');
874
+ }
915
875
  });
916
- // CheckSubmissionStatus — bound action; the @from: [#submitted] state gate is enforced by CAP.
876
+ // CheckSubmissionStatus: bound action; the @from: [#submitted] state gate is enforced by CAP.
917
877
  srv.on('CheckSubmissionStatus', async (req) => {
918
878
  logger.debug('CheckSubmissionStatus Action handler called');
919
879
  const { id: submissionId } = req.params[0];
@@ -921,33 +881,17 @@ module.exports = (srv) => {
921
881
  const submission = await db.run(SELECT.one.from(TransactionSubmissions).where({ id: submissionId }));
922
882
  if (!submission)
923
883
  throw new errors_1.NotFoundError(`Submission '${submissionId}'`);
924
- try {
925
- // the local index first (filled by the crawler), then the backends
926
- const txDetails = await (0, server_1.getCardanoIndexer)().findIndexedTransaction(db, submission.txHash)
927
- ?? await (0, server_1.getCardanoClient)().getTransaction(submission.txHash);
928
- if (txDetails) {
929
- await db.run(UPDATE.entity(TransactionSubmissions)
930
- .set({ status: 'confirmed' })
931
- .where({ id: submissionId }));
932
- submission.status = 'confirmed';
933
- logger.info({ submissionId, txHash: submission.txHash }, 'Transaction confirmed on chain');
934
- }
935
- }
936
- catch (err) {
937
- const errMsg = err instanceof Error ? err.message : String(err);
938
- if (err instanceof errors_1.NotFoundError || err?.statusCode === 404) {
939
- logger.debug({ submissionId, txHash: submission.txHash }, 'Transaction not yet confirmed on chain');
940
- }
941
- else {
942
- // A provider error must not be masked as "pending"
943
- logger.warn({ submissionId, txHash: submission.txHash, error: errMsg }, 'Failed to check transaction confirmation status');
944
- throw err;
945
- }
884
+ // a block this deep is not rolled back in practice; a status set here is never reverted
885
+ const { confirmations } = await (0, server_1.getCardanoIndexer)().resolveTransactionConfirmations(db, submission.txHash);
886
+ if (confirmations >= SUBMISSION_CONFIRMATION_DEPTH) {
887
+ await db.run(UPDATE.entity(TransactionSubmissions).set({ status: 'confirmed' }).where({ id: submissionId }));
888
+ submission.status = 'confirmed';
889
+ logger.info({ submissionId, txHash: submission.txHash, confirmations }, 'Transaction confirmed on chain');
946
890
  }
947
891
  return submission;
948
892
  });
949
893
  });
950
- // GetTransactionBuildsByAddress — address ↔ build associations.
894
+ // GetTransactionBuildsByAddress: address ↔ build associations.
951
895
  srv.on('GetTransactionBuildsByAddress', async (req) => {
952
896
  logger.debug('GetTransactionBuildsByAddress Action handler called');
953
897
  const { address } = req.data;
@@ -955,11 +899,10 @@ module.exports = (srv) => {
955
899
  return (0, errors_1.rejectMissing)(req, 'GetTransactionBuildsByAddress', 'address');
956
900
  if (!(0, validators_1.isValidBech32Address)(address))
957
901
  return (0, errors_1.rejectInvalid)(req, 'GetTransactionBuildsByAddress', 'Invalid bech32 address format', 'address');
958
- return (0, backend_request_handler_1.handleRequest)(req, async (db) => {
959
- return db.run(SELECT.from(AddressTransactionBuilds).where({ address_address: address }));
960
- });
902
+ const { limit, skip } = (0, paging_1.pageOf)(req.data, 1000);
903
+ return (0, backend_request_handler_1.handleRequest)(req, (db) => db.run(SELECT.from(AddressTransactionBuilds).where({ address_address: address }).orderBy('txBuild_id').limit(limit, skip)));
961
904
  });
962
- // DeriveScriptAddress — enterprise address + hash of a validator, optionally parameterized.
905
+ // DeriveScriptAddress: enterprise address + hash of a validator, optionally parameterized.
963
906
  srv.on('DeriveScriptAddress', async (req) => {
964
907
  const { validatorScript, scriptParamsJson, network } = req.data;
965
908
  if (!validatorScript)
@@ -977,14 +920,9 @@ module.exports = (srv) => {
977
920
  }
978
921
  scriptParams = jsonResult.parsed;
979
922
  }
980
- if (network && !VALID_DERIVE_NETWORKS.includes(network)) {
981
- return (0, errors_1.rejectInvalid)(req, 'DeriveScriptAddress', `Invalid network "${network}". Must be one of: ${VALID_DERIVE_NETWORKS.join(', ')}`, 'network');
982
- }
983
923
  return (0, backend_request_handler_1.handleRequest)(req, async () => {
984
924
  // Resolved outside the CBOR try/catch so an uninitialized client stays a 503, not a 400.
985
- const targetNetwork = network
986
- ? network
987
- : (0, server_1.getCardanoClient)().network;
925
+ const targetNetwork = network ?? (0, server_1.getCardanoClient)().network;
988
926
  try {
989
927
  const finalScript = scriptParams && scriptParams.length > 0
990
928
  ? (0, tx_build_helper_1.applyScriptParameters)(validatorScript, scriptParams)
@@ -999,7 +937,7 @@ module.exports = (srv) => {
999
937
  }
1000
938
  });
1001
939
  });
1002
- // ExtractPaymentKeyHash — 28-byte payment credential of a bech32 address; pure local decoding.
940
+ // ExtractPaymentKeyHash: 28-byte payment credential of a bech32 address; pure local decoding.
1003
941
  srv.on('ExtractPaymentKeyHash', async (req) => {
1004
942
  const { address } = req.data;
1005
943
  if (!address)
@@ -1,125 +1,109 @@
1
- using {odatano.cardano as db} from '../db/schema';
2
-
3
- /**
4
- * Cardano Wallet Worker Service (v2.0)
5
- *
6
- * Control + observability surface for the wallet worker / job engine:
7
- * - job submission (async build → sign → submit → confirm from server-side wallets)
8
- * - job status polling + cancellation
9
- * - read-only projections of jobs and registered worker wallets
10
- * - pause/resume of the local worker instance (admin)
11
- *
12
- * Security note: SubmitWalletJob executes value transfers with server-held keys —
13
- * the service requires authentication throughout; control actions and foreign-job
14
- * visibility are gated behind the Admin role. Jobs on HSM-backed wallets addition-
15
- * ally require the configured hsm.requiresRole (HSM_REQUIRES_ROLE), the same gate
16
- * the synchronous SignWithHsm path enforces. Keys are NEVER accepted or exposed
17
- * through this surface.
18
- */
19
- @requires: 'authenticated-user'
20
- service CardanoWorkerService @(impl: './cardano-worker-service') {
21
-
22
- @readonly
23
- @title : 'Wallet Jobs'
24
- @description: 'Asynchronous wallet-worker jobs. Non-admin callers see their own jobs only.'
25
- @restrict : [
26
- { grant: 'READ', to: 'Admin' },
27
- { grant: 'READ', where: 'createdBy = $user' }
28
- ]
29
- // dedupKey is the internal backing column of the idempotency constraint.
30
- entity WalletJobs as projection on db.CardanoWalletJobs excluding { dedupKey };
31
-
32
- @readonly
33
- @title : 'Worker Wallets'
34
- @description: 'Registered server-side worker wallets (addresses and stats only — no key material, no lease internals)'
35
- entity WorkerWallets as projection on db.CardanoWorkerWallets excluding { leaseOwner, leaseUntil };
36
-
37
- @title : 'Wallet Job Submission Result'
38
- type JobSubmissionResult {
39
- jobId : UUID;
40
- status : String(12);
41
- deduplicated : Boolean;
42
- }
43
-
44
- @title : 'Wallet Job Status'
45
- type JobStatus {
46
- jobId : UUID;
47
- walletId : String(50);
48
- kind : String(12);
49
- status : String(12);
50
- attempt : Integer;
51
- txHash : String(64);
52
- fee : String;
53
- errorCode : String(50);
54
- errorMessage : String(500);
55
- submittedAt : Timestamp;
56
- confirmedAt : Timestamp;
57
- finishedAt : Timestamp;
58
- }
59
-
60
- @title : 'Worker Status'
61
- type WorkerStatus {
62
- running : Boolean;
63
- wallets : many String;
64
- executing : many String;
65
- awaitingConfirmation : Integer;
66
- pendingJobs : Integer;
67
- }
68
-
69
- /**
70
- * Terminal job outcomes. Subscribing removes the need for a GetJobStatus poll loop:
71
- * (await cds.connect.to('CardanoWorkerService')).on('jobConfirmed', ({ data }) => …)
72
- */
73
- event jobConfirmed {
74
- jobId : UUID;
75
- walletId : String(50);
76
- kind : String(12);
77
- txHash : String(64);
78
- }
79
-
80
- event jobFailed {
81
- jobId : UUID;
82
- walletId : String(50);
83
- kind : String(12);
84
- txHash : String(64); // null when the job never reached the chain
85
- errorCode : String(50);
86
- errorMessage : String(500);
87
- }
88
-
89
- @title : 'Submit Wallet Job'
90
- @description: 'Queue an asynchronous transaction job for a worker wallet. Returns immediately with a jobId; poll GetJobStatus for the outcome. The request JSON is the same payload shape as the corresponding Build* action; senderAddress is always overridden with the wallet address.'
91
- action SubmitWalletJob(
92
- @title: 'Wallet Id' walletId : String(50),
93
- @title: 'Job Kind' kind : String(12),
94
- @title: 'Request JSON' requestJson : LargeString,
95
- @title: 'Idempotency Key' idempotencyKey : String(100),
96
- @title: 'Priority' priority : Integer,
97
- @title: 'Not Before' notBefore : Timestamp
98
- ) returns JobSubmissionResult;
99
-
100
- @title : 'Cancel Job'
101
- @description: 'Cancel a still-pending job. Jobs that started building may already reach the chain and cannot be cancelled.'
102
- action CancelJob(
103
- @title: 'Job Id' jobId : UUID
104
- ) returns Boolean;
105
-
106
- @title : 'Get Job Status'
107
- @description: 'Current lifecycle state of a wallet job (non-admins: own jobs only)'
108
- function GetJobStatus(
109
- @title: 'Job Id' jobId : UUID
110
- ) returns JobStatus;
111
-
112
- @title : 'Get Worker Status'
113
- @description: 'Live worker summary: running state, wallets, in-flight executions, confirmation backlog, queue depth'
114
- function GetWorkerStatus() returns WorkerStatus;
115
-
116
- @title : 'Pause Worker'
117
- @description: 'Stop the local worker instance (finishes in-flight steps; queued jobs stay pending).'
118
- @requires : 'Admin'
119
- action PauseWorker() returns Boolean;
120
-
121
- @title : 'Resume Worker'
122
- @description: 'Start/restart the local worker instance using the configured wallets.'
123
- @requires : 'Admin'
124
- action ResumeWorker() returns Boolean;
125
- }
1
+ using { WalletJobKind } from '../db/types';
2
+ using {odatano.cardano as db} from '../db/schema';
3
+
4
+ // Async wallet jobs signed with server-held keys. Control actions and foreign jobs need Admin;
5
+ // jobs on HSM wallets also need hsm.requiresRole. Keys are never accepted or returned here.
6
+ @requires: 'authenticated-user'
7
+ service CardanoWorkerService @(impl: './cardano-worker-service') {
8
+
9
+ @readonly
10
+ @title : 'Wallet Jobs'
11
+ @description: 'Asynchronous wallet-worker jobs. Non-admin callers see their own jobs only.'
12
+ @restrict : [
13
+ { grant: 'READ', to: 'Admin' },
14
+ { grant: 'READ', where: 'createdBy = $user' }
15
+ ]
16
+ // dedupKey is the internal backing column of the idempotency constraint.
17
+ entity WalletJobs as projection on db.CardanoWalletJobs excluding { dedupKey };
18
+
19
+ @readonly
20
+ @title : 'Worker Wallets'
21
+ @description: 'Registered server-side worker wallets (addresses and stats only; no key material, no lease internals)'
22
+ entity WorkerWallets as projection on db.CardanoWorkerWallets excluding { leaseOwner, leaseUntil };
23
+
24
+ @title : 'Wallet Job Submission Result'
25
+ type JobSubmissionResult {
26
+ jobId : UUID;
27
+ status : String(12);
28
+ deduplicated : Boolean;
29
+ }
30
+
31
+ @title : 'Wallet Job Status'
32
+ type JobStatus {
33
+ jobId : UUID;
34
+ walletId : String(50);
35
+ kind : String(12);
36
+ status : String(12);
37
+ attempt : Integer;
38
+ txHash : String(64);
39
+ fee : String;
40
+ errorCode : String(50);
41
+ errorMessage : String(500);
42
+ submittedAt : Timestamp;
43
+ confirmedAt : Timestamp;
44
+ finishedAt : Timestamp;
45
+ }
46
+
47
+ @title : 'Worker Status'
48
+ type WorkerStatus {
49
+ running : Boolean;
50
+ wallets : many String;
51
+ executing : many String;
52
+ awaitingConfirmation : Integer;
53
+ pendingJobs : Integer;
54
+ }
55
+
56
+ /** Terminal job outcome. Subscribe instead of polling GetJobStatus. */
57
+ event jobConfirmed {
58
+ jobId : UUID;
59
+ walletId : String(50);
60
+ kind : String(12);
61
+ txHash : String(64);
62
+ }
63
+
64
+ event jobFailed {
65
+ jobId : UUID;
66
+ walletId : String(50);
67
+ kind : String(12);
68
+ txHash : String(64); // null when the job never reached the chain
69
+ errorCode : String(50);
70
+ errorMessage : String(500);
71
+ }
72
+
73
+ @title : 'Submit Wallet Job'
74
+ @description: 'Queue an asynchronous transaction job for a worker wallet. Returns immediately with a jobId; poll GetJobStatus for the outcome. The request JSON is the same payload shape as the corresponding Build* action; senderAddress is always overridden with the wallet address.'
75
+ action SubmitWalletJob(
76
+ @title: 'Wallet Id' walletId : String(50),
77
+ @title: 'Job Kind' @assert.range kind : WalletJobKind,
78
+ @title: 'Request JSON' requestJson : LargeString,
79
+ @title: 'Idempotency Key' idempotencyKey : String(100),
80
+ @title: 'Priority' @assert.range: [0, 10000] priority : Integer,
81
+ @title: 'Not Before' notBefore : Timestamp
82
+ ) returns JobSubmissionResult;
83
+
84
+ @title : 'Cancel Job'
85
+ @description: 'Cancel a still-pending job. Jobs that started building may already reach the chain and cannot be cancelled.'
86
+ action CancelJob(
87
+ @title: 'Job Id' jobId : UUID
88
+ ) returns Boolean;
89
+
90
+ @title : 'Get Job Status'
91
+ @description: 'Current lifecycle state of a wallet job (non-admins: own jobs only)'
92
+ function GetJobStatus(
93
+ @title: 'Job Id' jobId : UUID
94
+ ) returns JobStatus;
95
+
96
+ @title : 'Get Worker Status'
97
+ @description: 'Live worker summary: running state, wallets, in-flight executions, confirmation backlog, queue depth'
98
+ function GetWorkerStatus() returns WorkerStatus;
99
+
100
+ @title : 'Pause Worker'
101
+ @description: 'Stop the local worker instance (finishes in-flight steps; queued jobs stay pending).'
102
+ @requires : 'Admin'
103
+ action PauseWorker() returns Boolean;
104
+
105
+ @title : 'Resume Worker'
106
+ @description: 'Start/restart the local worker instance using the configured wallets.'
107
+ @requires : 'Admin'
108
+ action ResumeWorker() returns Boolean;
109
+ }