@odatano/core 2.0.0-rc.44 → 2.0.0-rc.46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/@cds-models/CardanoAgentService/index.d.ts +0 -46
- package/@cds-models/CardanoBackendService/index.d.ts +0 -10
- package/@cds-models/CardanoIndexerService/index.d.ts +5 -20
- package/@cds-models/CardanoODataService/index.d.ts +18 -47
- package/@cds-models/CardanoSignService/index.d.ts +3 -18
- package/@cds-models/CardanoTransactionService/index.d.ts +9 -31
- package/@cds-models/CardanoWorkerService/index.d.ts +3 -19
- package/@cds-models/index.d.ts +17 -0
- package/@cds-models/index.js +2 -0
- package/@cds-models/odatano/cardano/index.d.ts +0 -34
- package/README.md +20 -20
- package/db/schema.cds +25 -44
- package/db/types.cds +22 -5
- package/package.json +3 -1
- package/scripts/migrate-slot-leader.mjs +3 -11
- package/scripts/migrate-txseq.mjs +3 -12
- package/src/index.d.ts +0 -4
- package/src/index.js +3 -5
- package/src/plugin.js +4 -8
- package/srv/blockchain/asset-decimals.d.ts +0 -9
- package/srv/blockchain/asset-decimals.js +21 -16
- package/srv/blockchain/backends/blockfrost-backend.d.ts +2 -10
- package/srv/blockchain/backends/blockfrost-backend.js +15 -21
- package/srv/blockchain/backends/cardano-backend.d.ts +12 -71
- package/srv/blockchain/backends/koios-backend.d.ts +14 -147
- package/srv/blockchain/backends/koios-backend.js +43 -166
- package/srv/blockchain/backends/odatano-backend.d.ts +1 -11
- package/srv/blockchain/backends/odatano-backend.js +11 -12
- package/srv/blockchain/backends/ogmios-backend.d.ts +19 -160
- package/srv/blockchain/backends/ogmios-backend.js +96 -175
- package/srv/blockchain/backends/ogmios-frame-guard.d.ts +2 -18
- package/srv/blockchain/backends/ogmios-frame-guard.js +8 -20
- package/srv/blockchain/cardano-client.d.ts +12 -80
- package/srv/blockchain/cardano-client.js +36 -88
- package/srv/blockchain/cardano-indexer.d.ts +14 -192
- package/srv/blockchain/cardano-indexer.js +136 -222
- package/srv/blockchain/cardano-tx-builder.d.ts +1 -28
- package/srv/blockchain/cardano-tx-builder.js +17 -34
- package/srv/blockchain/circuit-breaker.d.ts +1 -13
- package/srv/blockchain/circuit-breaker.js +5 -15
- package/srv/blockchain/crawler/asset-decimals-backfill.d.ts +0 -5
- package/srv/blockchain/crawler/asset-decimals-backfill.js +2 -5
- package/srv/blockchain/crawler/certificate-backfill.d.ts +0 -17
- package/srv/blockchain/crawler/certificate-backfill.js +8 -22
- package/srv/blockchain/crawler/crawler.d.ts +16 -93
- package/srv/blockchain/crawler/crawler.js +85 -160
- package/srv/blockchain/crawler/credential-backfill.d.ts +0 -10
- package/srv/blockchain/crawler/credential-backfill.js +2 -4
- package/srv/blockchain/crawler/hooks.d.ts +1 -5
- package/srv/blockchain/crawler/index.d.ts +0 -12
- package/srv/blockchain/crawler/index.js +6 -20
- package/srv/blockchain/crawler/sync-state.d.ts +6 -44
- package/srv/blockchain/crawler/sync-state.js +18 -53
- package/srv/blockchain/crawler/transaction-backfill.d.ts +0 -11
- package/srv/blockchain/crawler/transaction-backfill.js +11 -30
- package/srv/blockchain/crawler/utxo-set-import.d.ts +1 -30
- package/srv/blockchain/crawler/utxo-set-import.js +27 -53
- package/srv/blockchain/ledger-state.d.ts +10 -54
- package/srv/blockchain/ledger-state.js +11 -27
- package/srv/blockchain/pending-spends.d.ts +0 -12
- package/srv/blockchain/pending-spends.js +4 -12
- package/srv/blockchain/request-coalescer.d.ts +2 -16
- package/srv/blockchain/request-coalescer.js +2 -16
- package/srv/blockchain/signing/cose-verifier.d.ts +0 -9
- package/srv/blockchain/signing/cose-verifier.js +4 -10
- package/srv/blockchain/signing/external-signer.d.ts +1 -4
- package/srv/blockchain/signing/external-signer.js +2 -8
- package/srv/blockchain/signing/hsm-signer.d.ts +6 -18
- package/srv/blockchain/signing/hsm-signer.js +16 -28
- package/srv/blockchain/signing/signature-verifier.d.ts +1 -8
- package/srv/blockchain/signing/signature-verifier.js +9 -19
- package/srv/blockchain/signing/submission-finalizer.d.ts +10 -16
- package/srv/blockchain/signing/submission-finalizer.js +53 -19
- package/srv/blockchain/stored-chain.d.ts +1 -14
- package/srv/blockchain/stored-chain.js +3 -8
- package/srv/blockchain/transaction-building/buildooor-fee-patch.d.ts +0 -4
- package/srv/blockchain/transaction-building/buildooor-fee-patch.js +4 -9
- package/srv/blockchain/transaction-building/buildooor-tx.d.ts +7 -150
- package/srv/blockchain/transaction-building/buildooor-tx.js +91 -196
- package/srv/blockchain/transaction-building/caller-datums.d.ts +0 -14
- package/srv/blockchain/transaction-building/caller-datums.js +3 -9
- package/srv/blockchain/transaction-building/cardano-tx.d.ts +1 -4
- package/srv/blockchain/wallet-worker/build-request.d.ts +0 -5
- package/srv/blockchain/wallet-worker/build-request.js +6 -9
- package/srv/blockchain/wallet-worker/confirmation-tracker.d.ts +5 -23
- package/srv/blockchain/wallet-worker/confirmation-tracker.js +16 -20
- package/srv/blockchain/wallet-worker/index.d.ts +1 -1
- package/srv/blockchain/wallet-worker/index.js +3 -5
- package/srv/blockchain/wallet-worker/job-store.d.ts +15 -65
- package/srv/blockchain/wallet-worker/job-store.js +0 -0
- package/srv/blockchain/wallet-worker/lease-heartbeat.d.ts +2 -10
- package/srv/blockchain/wallet-worker/lease-heartbeat.js +6 -12
- package/srv/blockchain/wallet-worker/signers.d.ts +3 -11
- package/srv/blockchain/wallet-worker/signers.js +3 -6
- package/srv/blockchain/wallet-worker/wallet-worker.d.ts +3 -21
- package/srv/blockchain/wallet-worker/wallet-worker.js +47 -54
- package/srv/cardano-agent-service.cds +123 -146
- package/srv/cardano-agent-service.js +2 -5
- package/srv/cardano-backend-service.cds +10 -17
- package/srv/cardano-backend-service.js +7 -12
- package/srv/cardano-indexer-service.cds +16 -37
- package/srv/cardano-indexer-service.d.ts +5 -1
- package/srv/cardano-indexer-service.js +44 -35
- package/srv/cardano-service.cds +56 -40
- package/srv/cardano-service.js +42 -69
- package/srv/cardano-sign-service.cds +14 -23
- package/srv/cardano-sign-service.js +18 -24
- package/srv/cardano-tx-service.cds +27 -29
- package/srv/cardano-tx-service.js +60 -122
- package/srv/cardano-worker-service.cds +109 -125
- package/srv/cardano-worker-service.js +21 -31
- package/srv/cbor/cip68.d.ts +0 -4
- package/srv/cbor/cip68.js +2 -4
- package/srv/cbor/parse.d.ts +3 -18
- package/srv/cbor/parse.js +2 -7
- package/srv/cbor/plutus-data-json.d.ts +0 -4
- package/srv/server.d.ts +5 -36
- package/srv/server.js +30 -51
- package/srv/utils/agent-grants-config.d.ts +0 -18
- package/srv/utils/agent-grants-config.js +6 -13
- package/srv/utils/agent-grants.d.ts +14 -68
- package/srv/utils/agent-grants.js +42 -60
- package/srv/utils/agent-token-auth.d.ts +0 -5
- package/srv/utils/agent-token-auth.js +2 -5
- package/srv/utils/backend-request-handler.d.ts +1 -1
- package/srv/utils/collections.d.ts +1 -4
- package/srv/utils/collections.js +1 -4
- package/srv/utils/const.d.ts +0 -18
- package/srv/utils/const.js +7 -18
- package/srv/utils/crypto.js +3 -5
- package/srv/utils/db-indexes.d.ts +2 -0
- package/srv/utils/db-indexes.js +22 -9
- package/srv/utils/db-sanitize.d.ts +1 -8
- package/srv/utils/db-sanitize.js +3 -8
- package/srv/utils/epoch-slots.d.ts +1 -8
- package/srv/utils/epoch-slots.js +3 -8
- package/srv/utils/error-codes.d.ts +0 -4
- package/srv/utils/error-codes.js +2 -4
- package/srv/utils/errors.d.ts +2 -22
- package/srv/utils/errors.js +13 -27
- package/srv/utils/liveness.d.ts +0 -4
- package/srv/utils/liveness.js +2 -4
- package/srv/utils/mappers.d.ts +0 -37
- package/srv/utils/mappers.js +19 -39
- package/srv/utils/network-context.js +2 -4
- package/srv/utils/paging.d.ts +31 -0
- package/srv/utils/paging.js +43 -0
- package/srv/utils/pg-inline-json.js +3 -7
- package/srv/utils/pg-order-nulls.js +2 -5
- package/srv/utils/plutus-placeholders.d.ts +0 -13
- package/srv/utils/plutus-placeholders.js +6 -13
- package/srv/utils/rate-limiter.d.ts +0 -8
- package/srv/utils/rate-limiter.js +2 -4
- package/srv/utils/reference-script.d.ts +0 -18
- package/srv/utils/reference-script.js +8 -19
- package/srv/utils/service-events.d.ts +0 -4
- package/srv/utils/service-events.js +2 -4
- package/srv/utils/signing-helper.d.ts +1 -8
- package/srv/utils/signing-helper.js +3 -8
- package/srv/utils/tx-build-helper.d.ts +2 -32
- package/srv/utils/tx-build-helper.js +26 -40
- package/srv/utils/tx-request-parsers.d.ts +1 -25
- package/srv/utils/tx-request-parsers.js +10 -25
- package/srv/utils/tx-utils.d.ts +0 -8
- package/srv/utils/tx-utils.js +10 -13
- package/srv/utils/types.d.ts +2 -37
- package/srv/utils/validators.d.ts +0 -4
- 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
|
|
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
|
|
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
|
|
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
|
|
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}"
|
|
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}"
|
|
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}"
|
|
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}
|
|
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
|
|
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}"
|
|
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}"
|
|
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}
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
827
|
-
srv.on(
|
|
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
|
-
|
|
833
|
-
|
|
834
|
-
|
|
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)(
|
|
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 !==
|
|
842
|
-
|
|
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
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
|
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
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
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
|
|
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
|
-
|
|
959
|
-
|
|
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
|
|
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
|
|
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 {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
@
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
@
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
@
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
@title: 'Job
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
) returns
|
|
99
|
-
|
|
100
|
-
@title : '
|
|
101
|
-
@description: '
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
@
|
|
107
|
-
@
|
|
108
|
-
|
|
109
|
-
|
|
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
|
+
}
|