@odatano/core 2.0.0-rc.50 → 2.0.0-rc.52
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/CardanoBackendService/index.d.ts +14 -3
- package/@cds-models/CardanoBackendService/index.js +1 -0
- package/@cds-models/CardanoIndexerService/index.d.ts +98 -0
- package/@cds-models/CardanoIndexerService/index.js +10 -0
- package/@cds-models/CardanoODataService/index.d.ts +3 -0
- package/@cds-models/CardanoSignService/index.d.ts +13 -0
- package/@cds-models/CardanoSignService/index.js +1 -0
- package/@cds-models/CardanoTransactionService/index.d.ts +12 -0
- package/@cds-models/CardanoTransactionService/index.js +1 -0
- package/@cds-models/CardanoWorkerService/index.d.ts +28 -0
- package/@cds-models/CardanoWorkerService/index.js +2 -0
- package/@cds-models/index.d.ts +13 -3
- package/@cds-models/index.js +4 -3
- package/@cds-models/odatano/cardano/index.d.ts +14 -0
- package/README.md +45 -149
- package/db/schema.cds +63 -10
- package/db/types.cds +10 -0
- package/package.json +7 -44
- package/scripts/deploy-schema.mjs +113 -0
- package/scripts/migrate-schema.mjs +209 -15
- package/srv/blockchain/backends/blockfrost-backend.d.ts +2 -4
- package/srv/blockchain/backends/blockfrost-backend.js +61 -45
- package/srv/blockchain/backends/call-signal.d.ts +7 -0
- package/srv/blockchain/backends/call-signal.js +22 -0
- package/srv/blockchain/backends/cardano-backend.d.ts +6 -3
- package/srv/blockchain/backends/koios-backend.d.ts +9 -6
- package/srv/blockchain/backends/koios-backend.js +145 -207
- package/srv/blockchain/backends/odatano-backend.d.ts +2 -1
- package/srv/blockchain/backends/odatano-backend.js +51 -9
- package/srv/blockchain/backends/ogmios-backend.d.ts +1 -2
- package/srv/blockchain/backends/ogmios-backend.js +82 -48
- package/srv/blockchain/cardano-client.d.ts +15 -5
- package/srv/blockchain/cardano-client.js +143 -71
- package/srv/blockchain/cardano-indexer.d.ts +27 -16
- package/srv/blockchain/cardano-indexer.js +223 -102
- package/srv/blockchain/circuit-breaker.d.ts +1 -0
- package/srv/blockchain/circuit-breaker.js +6 -0
- package/srv/blockchain/crawler/account-snapshots.js +22 -2
- package/srv/blockchain/crawler/asset-decimals-backfill.d.ts +2 -0
- package/srv/blockchain/crawler/asset-decimals-backfill.js +29 -29
- package/srv/blockchain/crawler/asset-registry-backfill.d.ts +3 -0
- package/srv/blockchain/crawler/asset-registry-backfill.js +4 -0
- package/srv/blockchain/crawler/asset-slice-backfill.d.ts +35 -0
- package/srv/blockchain/crawler/asset-slice-backfill.js +149 -0
- package/srv/blockchain/crawler/certificate-backfill.d.ts +4 -0
- package/srv/blockchain/crawler/certificate-backfill.js +15 -3
- package/srv/blockchain/crawler/crawler.d.ts +22 -1
- package/srv/blockchain/crawler/crawler.js +223 -24
- package/srv/blockchain/crawler/credential-backfill.d.ts +2 -0
- package/srv/blockchain/crawler/credential-backfill.js +43 -66
- package/srv/blockchain/crawler/input-asset-copies.d.ts +4 -4
- package/srv/blockchain/crawler/input-asset-copies.js +17 -27
- package/srv/blockchain/crawler/key-pages.d.ts +12 -0
- package/srv/blockchain/crawler/key-pages.js +48 -0
- package/srv/blockchain/crawler/metadata-position-backfill.d.ts +6 -0
- package/srv/blockchain/crawler/metadata-position-backfill.js +23 -19
- package/srv/blockchain/crawler/output-datum-backfill.d.ts +3 -1
- package/srv/blockchain/crawler/output-datum-backfill.js +8 -18
- package/srv/blockchain/crawler/sync-state.d.ts +5 -1
- package/srv/blockchain/crawler/sync-state.js +63 -106
- package/srv/blockchain/crawler/transaction-backfill.d.ts +2 -0
- package/srv/blockchain/crawler/transaction-backfill.js +6 -13
- package/srv/blockchain/crawler/utxo-set-import.js +2 -2
- package/srv/blockchain/crawler/window-plan.d.ts +31 -0
- package/srv/blockchain/crawler/window-plan.js +59 -0
- package/srv/blockchain/ledger-state.d.ts +2 -2
- package/srv/blockchain/ledger-state.js +139 -37
- package/srv/blockchain/signing/external-signer.js +5 -5
- package/srv/blockchain/signing/failed-recheck.d.ts +17 -0
- package/srv/blockchain/signing/failed-recheck.js +135 -0
- package/srv/blockchain/signing/landing-proof.d.ts +60 -0
- package/srv/blockchain/signing/landing-proof.js +224 -0
- package/srv/blockchain/signing/signature-verifier.js +10 -13
- package/srv/blockchain/signing/submission-finalizer.d.ts +17 -3
- package/srv/blockchain/signing/submission-finalizer.js +90 -29
- package/srv/blockchain/stored-chain.d.ts +1 -2
- package/srv/blockchain/stored-chain.js +36 -15
- package/srv/blockchain/transaction-building/buildooor-tx.js +16 -10
- package/srv/blockchain/transaction-presence.d.ts +8 -1
- package/srv/blockchain/transaction-presence.js +12 -12
- package/srv/blockchain/wallet-worker/build-request.d.ts +6 -6
- package/srv/blockchain/wallet-worker/build-request.js +35 -365
- package/srv/blockchain/wallet-worker/confirmation-tracker.d.ts +23 -2
- package/srv/blockchain/wallet-worker/confirmation-tracker.js +140 -23
- package/srv/blockchain/wallet-worker/invalidation.d.ts +35 -0
- package/srv/blockchain/wallet-worker/invalidation.js +128 -0
- package/srv/blockchain/wallet-worker/job-store.d.ts +28 -2
- package/srv/blockchain/wallet-worker/job-store.js +107 -80
- package/srv/blockchain/wallet-worker/wallet-worker.d.ts +21 -2
- package/srv/blockchain/wallet-worker/wallet-worker.js +241 -57
- package/srv/cardano-agent-service.cds +1 -1
- package/srv/cardano-agent-service.js +8 -0
- package/srv/cardano-backend-service.cds +4 -1
- package/srv/cardano-backend-service.js +26 -9
- package/srv/cardano-indexer-service.cds +448 -387
- package/srv/cardano-indexer-service.js +226 -281
- package/srv/cardano-service.cds +7 -5
- package/srv/cardano-service.js +404 -69
- package/srv/cardano-sign-service.cds +11 -1
- package/srv/cardano-sign-service.js +161 -108
- package/srv/cardano-tx-service.cds +23 -12
- package/srv/cardano-tx-service.js +105 -604
- package/srv/cardano-worker-service.cds +25 -2
- package/srv/cardano-worker-service.js +56 -4
- package/srv/config.d.ts +4 -0
- package/srv/config.js +10 -0
- package/srv/server.js +5 -7
- package/srv/utils/agent-access.d.ts +4 -2
- package/srv/utils/agent-access.js +26 -7
- package/srv/utils/agent-grants.d.ts +1 -1
- package/srv/utils/agent-grants.js +7 -8
- package/srv/utils/agent-token-auth.js +45 -5
- package/srv/utils/build-request.d.ts +52 -0
- package/srv/utils/build-request.js +487 -0
- package/srv/utils/collections.d.ts +1 -0
- package/srv/utils/collections.js +11 -0
- package/srv/utils/const.d.ts +10 -2
- package/srv/utils/const.js +13 -6
- package/srv/utils/crypto.js +5 -4
- package/srv/utils/db-indexes.d.ts +5 -1
- package/srv/utils/db-indexes.js +79 -14
- package/srv/utils/db-kind.d.ts +23 -0
- package/srv/utils/db-kind.js +42 -0
- package/srv/utils/detached-run.d.ts +41 -0
- package/srv/utils/detached-run.js +101 -0
- package/srv/utils/epoch-slots.d.ts +1 -0
- package/srv/utils/epoch-slots.js +7 -0
- package/srv/utils/error-codes.d.ts +4 -0
- package/srv/utils/error-codes.js +4 -0
- package/srv/utils/errors.d.ts +10 -1
- package/srv/utils/errors.js +51 -9
- package/srv/utils/lease.d.ts +20 -0
- package/srv/utils/lease.js +62 -0
- package/srv/utils/mappers.d.ts +9 -0
- package/srv/utils/mappers.js +57 -67
- package/srv/utils/navigation.d.ts +17 -0
- package/srv/utils/navigation.js +52 -0
- package/srv/utils/network-context.d.ts +0 -1
- package/srv/utils/network-context.js +8 -3
- package/srv/utils/pg-inline-json.js +3 -3
- package/srv/utils/pg-order-nulls.js +3 -3
- package/srv/utils/resolution.d.ts +13 -0
- package/srv/utils/resolution.js +47 -0
- package/srv/utils/row-values.d.ts +7 -0
- package/srv/utils/row-values.js +27 -0
- package/srv/utils/tx-build-helper.d.ts +15 -0
- package/srv/utils/tx-build-helper.js +28 -13
- package/srv/utils/types.d.ts +36 -44
- package/srv/utils/types.js +1 -17
- package/srv/utils/validators.d.ts +2 -2
- package/srv/utils/validators.js +14 -25
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const cds_1 = __importDefault(require("@sap/cds"));
|
|
7
7
|
const backend_request_handler_1 = require("./utils/backend-request-handler");
|
|
8
8
|
const errors_1 = require("./utils/errors");
|
|
9
|
+
const error_codes_1 = require("./utils/error-codes");
|
|
9
10
|
const mappers_1 = require("./utils/mappers");
|
|
10
11
|
const validators_1 = require("./utils/validators");
|
|
11
12
|
const cbor_1 = require("./cbor");
|
|
@@ -18,6 +19,9 @@ const tx_utils_1 = require("./utils/tx-utils");
|
|
|
18
19
|
const paging_1 = require("./utils/paging");
|
|
19
20
|
const result_numbers_1 = require("./utils/result-numbers");
|
|
20
21
|
const submission_finalizer_1 = require("./blockchain/signing/submission-finalizer");
|
|
22
|
+
const landing_proof_1 = require("./blockchain/signing/landing-proof");
|
|
23
|
+
const resolution_1 = require("./utils/resolution");
|
|
24
|
+
const cardano_1 = require("#cds-models/odatano/cardano");
|
|
21
25
|
const { SELECT, UPDATE } = cds_1.default.ql;
|
|
22
26
|
const logger = cds_1.default.log('CardanoSignService');
|
|
23
27
|
/** Load a build and, when an address is given, check it matches the build's senderAddress. */
|
|
@@ -71,9 +75,82 @@ async function resolveRequiredSigners(db, signingRequest, TransactionBuilds) {
|
|
|
71
75
|
function enforceHsmRole(req, actionName) {
|
|
72
76
|
const hsmConfig = (0, server_1.getHsmConfig)();
|
|
73
77
|
if (hsmConfig?.requiresRole && !req.user?.is(hsmConfig.requiresRole)) {
|
|
74
|
-
|
|
78
|
+
(0, mappers_1.mapError)(req, new errors_1.BackendError(`Action '${actionName}' requires role '${hsmConfig.requiresRole}'`, 403, error_codes_1.ERROR_CODES.FORBIDDEN), actionName);
|
|
75
79
|
}
|
|
76
80
|
}
|
|
81
|
+
/** The connected HSM signer. 503 when none is configured or connected: the request is valid, the server lacks the signer. */
|
|
82
|
+
function connectedHsm(req, actionName) {
|
|
83
|
+
const hsmSigner = (0, hsm_signer_1.getHsmSigner)();
|
|
84
|
+
if (!hsmSigner || !hsmSigner.isConnected()) {
|
|
85
|
+
(0, mappers_1.mapError)(req, new errors_1.BackendError('HSM is not configured or not connected', 503, error_codes_1.ERROR_CODES.HSM_NOT_CONFIGURED, undefined, undefined, 'hsm'), actionName);
|
|
86
|
+
}
|
|
87
|
+
return hsmSigner;
|
|
88
|
+
}
|
|
89
|
+
// Loads the signing request, runs `gate` on it, checks that the build belongs to `address` when one
|
|
90
|
+
// is given, and completes a CIP-30 witness set into the full transaction.
|
|
91
|
+
async function prepareExternalSignature(req, db, actionName, { signingRequestId, signedTxCbor, address }, SigningRequests, TransactionBuilds, gate) {
|
|
92
|
+
const signingRequest = await db.run(SELECT.one.from(SigningRequests).where({ id: signingRequestId }));
|
|
93
|
+
if (!signingRequest)
|
|
94
|
+
(0, errors_1.rejectInvalid)(req, actionName, 'Signing request not found', 'signingRequestId');
|
|
95
|
+
gate?.(signingRequest);
|
|
96
|
+
if (address && signingRequest.build_id) {
|
|
97
|
+
await verifyBuildOwnership(req, db, signingRequest.build_id, address, TransactionBuilds, actionName);
|
|
98
|
+
}
|
|
99
|
+
// A CIP-30 wallet returns only the witness set; cardano-cli a full signed tx.
|
|
100
|
+
const fullSignedTxCbor = (0, signing_helper_1.toSignedTransaction)(signingRequest.unsignedTxCbor, signedTxCbor);
|
|
101
|
+
// Verification is bound to the keys that must witness this tx.
|
|
102
|
+
const requiredSigners = await resolveRequiredSigners(db, signingRequest, TransactionBuilds);
|
|
103
|
+
return { signingRequest, fullSignedTxCbor, requiredSigners };
|
|
104
|
+
}
|
|
105
|
+
// The change of an HSM build must go back to the HSM, or the remainder goes to whoever built it.
|
|
106
|
+
// The stored outputs mark the change, and each must equal the output of the unsigned body at its index.
|
|
107
|
+
async function assertChangeToHsm(req, db, build, hsmAddress, actionName) {
|
|
108
|
+
const changeAddress = build.changeAddress ?? build.senderAddress;
|
|
109
|
+
if (changeAddress !== hsmAddress) {
|
|
110
|
+
(0, errors_1.rejectInvalid)(req, actionName, `Build change address '${changeAddress}' is not the HSM address '${hsmAddress}'`, 'buildId');
|
|
111
|
+
}
|
|
112
|
+
const stored = await db.run(SELECT.from(cardano_1.TransactionBuildOutputs).columns('outputIndex', 'address', 'isChange').where({ build_id: build.id }));
|
|
113
|
+
if (!stored.length)
|
|
114
|
+
return;
|
|
115
|
+
let body;
|
|
116
|
+
try {
|
|
117
|
+
body = (0, cbor_1.parseTransaction)(build.unsignedTxCbor).outputs;
|
|
118
|
+
}
|
|
119
|
+
catch {
|
|
120
|
+
return (0, errors_1.rejectInvalid)(req, actionName, 'The unsigned transaction of the build cannot be read', 'buildId');
|
|
121
|
+
}
|
|
122
|
+
for (const output of stored) {
|
|
123
|
+
if (body[output.outputIndex]?.address !== output.address) {
|
|
124
|
+
(0, errors_1.rejectInvalid)(req, actionName, `Stored output ${output.outputIndex} of the build does not match its transaction`, 'buildId');
|
|
125
|
+
}
|
|
126
|
+
if (output.isChange && output.address !== hsmAddress) {
|
|
127
|
+
(0, errors_1.rejectInvalid)(req, actionName, `Build change output ${output.outputIndex} goes to '${output.address}', not to the HSM address '${hsmAddress}'`, 'buildId');
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
// Signs a build with the HSM after checking that it spends from the HSM address and returns its
|
|
132
|
+
// change there. A signature that does not verify against the required signers rolls back.
|
|
133
|
+
async function signBuildWithHsm(req, db, hsmSigner, actionName, { buildId, address, message }, TransactionBuilds) {
|
|
134
|
+
const build = await verifyBuildOwnership(req, db, buildId, address, TransactionBuilds, actionName);
|
|
135
|
+
const hsmAddress = hsmSigner.getAddress();
|
|
136
|
+
if (build.senderAddress !== hsmAddress) {
|
|
137
|
+
(0, errors_1.rejectInvalid)(req, actionName, `Build sender '${build.senderAddress}' does not match HSM address '${hsmAddress}'`, 'buildId');
|
|
138
|
+
}
|
|
139
|
+
await assertChangeToHsm(req, db, build, hsmAddress, actionName);
|
|
140
|
+
const signerModule = (0, external_signer_1.getExternalSignerModule)();
|
|
141
|
+
const signingPayload = signerModule.createSigningRequest(build.id, build.unsignedTxCbor, build.txBodyHash, build.network, message);
|
|
142
|
+
const signingRequest = await (0, server_1.getCardanoIndexer)().persistSigningRequest(db, { buildId, signingPayload });
|
|
143
|
+
const signedTxCbor = hsmSigner.signTransaction(build.unsignedTxCbor, build.txBodyHash);
|
|
144
|
+
const requiredSigners = await resolveRequiredSigners(db, { unsignedTxCbor: build.unsignedTxCbor, build_id: build.id }, TransactionBuilds);
|
|
145
|
+
const verificationResult = signerModule.verifySignedTransaction(signedTxCbor, build.txBodyHash, { requiredSigners });
|
|
146
|
+
const hsmStatus = hsmSigner.getStatus();
|
|
147
|
+
const hsmKeyIdentifier = hsmStatus.keyLabel || hsmStatus.keyId || 'unknown';
|
|
148
|
+
if (!verificationResult.isValid) {
|
|
149
|
+
logger.error({ signingRequestId: signingRequest.id, hsmKey: hsmKeyIdentifier }, 'HSM signature verification failed');
|
|
150
|
+
(0, errors_1.rejectInvalid)(req, actionName, 'HSM signature verification failed', 'signedTxCbor');
|
|
151
|
+
}
|
|
152
|
+
return { build, signingRequestId: signingRequest.id, signedTxCbor, verificationResult, hsmKeyIdentifier };
|
|
153
|
+
}
|
|
77
154
|
/** CardanoSignService handlers: external and HSM signing, verification, submission. */
|
|
78
155
|
module.exports = (srv) => {
|
|
79
156
|
(0, result_numbers_1.answerNumbersAsText)(srv);
|
|
@@ -101,7 +178,10 @@ module.exports = (srv) => {
|
|
|
101
178
|
const build = await db.run(SELECT.one.from(TransactionBuilds).where({ id: buildId }));
|
|
102
179
|
if (!build)
|
|
103
180
|
(0, errors_1.rejectInvalid)(req, 'CreateSigningRequest', 'Build not found', 'buildId');
|
|
104
|
-
|
|
181
|
+
// a pending request past its TTL is expired first, so it is never handed out again
|
|
182
|
+
const now = new Date().toISOString();
|
|
183
|
+
await db.run(UPDATE.entity(SigningRequests).set({ status: 'expired' }).where({ build_id: buildId, status: 'pending', expiresAt: { '<=': now } }));
|
|
184
|
+
const existingRequest = await db.run(SELECT.one.from(SigningRequests).where({ build_id: buildId, status: 'pending', expiresAt: { '>': now } }));
|
|
105
185
|
if (existingRequest) {
|
|
106
186
|
logger.info({ buildId, signingRequestId: existingRequest.id }, 'Returning existing signing request');
|
|
107
187
|
return existingRequest;
|
|
@@ -141,13 +221,7 @@ module.exports = (srv) => {
|
|
|
141
221
|
if (address && !(0, validators_1.isValidBech32Address)(address))
|
|
142
222
|
(0, errors_1.rejectInvalid)(req, 'VerifySignature', 'Invalid bech32 address format', 'address');
|
|
143
223
|
return (0, backend_request_handler_1.handleRequest)(req, async (db) => {
|
|
144
|
-
const signingRequest = await db
|
|
145
|
-
if (!signingRequest)
|
|
146
|
-
(0, errors_1.rejectInvalid)(req, 'VerifySignature', 'Signing request not found', 'signingRequestId');
|
|
147
|
-
// Ownership check (defense in depth)
|
|
148
|
-
if (address && signingRequest.build_id) {
|
|
149
|
-
await verifyBuildOwnership(req, db, signingRequest.build_id, address, TransactionBuilds, 'VerifySignature');
|
|
150
|
-
}
|
|
224
|
+
const { signingRequest, fullSignedTxCbor, requiredSigners } = await prepareExternalSignature(req, db, 'VerifySignature', { signingRequestId, signedTxCbor, address }, SigningRequests, TransactionBuilds);
|
|
151
225
|
// Atomic claim (pending → 'signed') so concurrent verifies cannot both pass;
|
|
152
226
|
// persistSignatureVerification sets the final 'verified'/'failed'.
|
|
153
227
|
const now = new Date().toISOString();
|
|
@@ -163,10 +237,6 @@ module.exports = (srv) => {
|
|
|
163
237
|
}
|
|
164
238
|
(0, errors_1.rejectInvalid)(req, 'VerifySignature', `Signing request status is '${current?.status ?? 'unknown'}', expected 'pending'`, 'signingRequestId');
|
|
165
239
|
}
|
|
166
|
-
// A CIP-30 wallet returns only the witness set; cardano-cli a full signed tx.
|
|
167
|
-
const fullSignedTxCbor = (0, signing_helper_1.toSignedTransaction)(signingRequest.unsignedTxCbor, signedTxCbor);
|
|
168
|
-
// Verification is bound to the keys that must witness this tx.
|
|
169
|
-
const requiredSigners = await resolveRequiredSigners(db, signingRequest, TransactionBuilds);
|
|
170
240
|
const signerModule = (0, external_signer_1.getExternalSignerModule)();
|
|
171
241
|
const result = signerModule.verifySignedTransaction(fullSignedTxCbor, signingRequest.txBodyHash, { requiredSigners });
|
|
172
242
|
// Store the full signed tx for later submission
|
|
@@ -203,26 +273,22 @@ module.exports = (srv) => {
|
|
|
203
273
|
// so a verification failure swallowed by the caller never leaves a stranded claim behind.
|
|
204
274
|
const phase1 = async (db) => {
|
|
205
275
|
const now = new Date().toISOString();
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
await verifyBuildOwnership(req, db, signingRequest.build_id, address, TransactionBuilds, 'SubmitVerifiedTransaction');
|
|
217
|
-
}
|
|
218
|
-
if (!signingRequest.build_id) {
|
|
219
|
-
(0, errors_1.rejectInvalid)(req, 'SubmitVerifiedTransaction', 'Signing request has no associated build', 'signingRequestId');
|
|
220
|
-
}
|
|
221
|
-
// CIP-30 witness set or full signed tx
|
|
222
|
-
const fullSignedTxCbor = (0, signing_helper_1.toSignedTransaction)(signingRequest.unsignedTxCbor, signedTxCbor);
|
|
276
|
+
// the state of the request answers before the signed bytes are read
|
|
277
|
+
const { signingRequest, fullSignedTxCbor, requiredSigners } = await prepareExternalSignature(req, db, 'SubmitVerifiedTransaction', { signingRequestId, signedTxCbor, address }, SigningRequests, TransactionBuilds, (request) => {
|
|
278
|
+
if (request.expiresAt <= now)
|
|
279
|
+
(0, errors_1.rejectInvalid)(req, 'SubmitVerifiedTransaction', 'Signing request has expired', 'signingRequestId');
|
|
280
|
+
if (!['pending', 'verified'].includes(request.status)) {
|
|
281
|
+
(0, errors_1.rejectInvalid)(req, 'SubmitVerifiedTransaction', `Signing request status is '${request.status}', expected 'pending' or 'verified'`, 'signingRequestId');
|
|
282
|
+
}
|
|
283
|
+
if (!request.build_id)
|
|
284
|
+
(0, errors_1.rejectInvalid)(req, 'SubmitVerifiedTransaction', 'Signing request has no associated build', 'signingRequestId');
|
|
285
|
+
});
|
|
223
286
|
// Throws on failure; bound to the keys that must witness this tx.
|
|
224
|
-
const requiredSigners = await resolveRequiredSigners(db, signingRequest, TransactionBuilds);
|
|
225
287
|
const verificationResult = (0, external_signer_1.getExternalSignerModule)().verifyOrThrow(fullSignedTxCbor, signingRequest.txBodyHash, { requiredSigners });
|
|
288
|
+
// a build stored before every build had an expiry can still lack one
|
|
289
|
+
const problem = (0, landing_proof_1.sendProblem)(fullSignedTxCbor, (0, server_1.getCardanoClient)().network);
|
|
290
|
+
if (problem)
|
|
291
|
+
(0, errors_1.rejectInvalid)(req, 'SubmitVerifiedTransaction', problem, 'signingRequestId');
|
|
226
292
|
// Atomic claim. The signed CBOR, the signer and the claim time go with it, so an
|
|
227
293
|
// interrupted or unresolved submission can be resolved later.
|
|
228
294
|
const claimed = await db.run(UPDATE.entity(SigningRequests)
|
|
@@ -312,51 +378,20 @@ module.exports = (srv) => {
|
|
|
312
378
|
(0, errors_1.throwIfValidationErrors)(req, 'SignWithHsm', errors);
|
|
313
379
|
if (address && !(0, validators_1.isValidBech32Address)(address))
|
|
314
380
|
(0, errors_1.rejectInvalid)(req, 'SignWithHsm', 'Invalid bech32 address format', 'address');
|
|
315
|
-
const hsmSigner = (
|
|
316
|
-
if (!hsmSigner || !hsmSigner.isConnected()) {
|
|
317
|
-
(0, errors_1.rejectInvalid)(req, 'SignWithHsm', 'HSM is not configured or not connected', 'hsm');
|
|
318
|
-
}
|
|
381
|
+
const hsmSigner = connectedHsm(req, 'SignWithHsm');
|
|
319
382
|
return (0, backend_request_handler_1.handleRequest)(req, async (db) => {
|
|
320
|
-
const
|
|
321
|
-
// The HSM can only sign builds for its own address
|
|
322
|
-
const hsmAddress = hsmSigner.getAddress();
|
|
323
|
-
if (build.senderAddress !== hsmAddress) {
|
|
324
|
-
(0, errors_1.rejectInvalid)(req, 'SignWithHsm', `Build sender '${build.senderAddress}' does not match HSM address '${hsmAddress}'`, 'buildId');
|
|
325
|
-
}
|
|
326
|
-
const signerModule = (0, external_signer_1.getExternalSignerModule)();
|
|
327
|
-
const signingPayload = signerModule.createSigningRequest(build.id, build.unsignedTxCbor, build.txBodyHash, build.network, 'HSM signing');
|
|
328
|
-
const signingRequestRecord = await (0, server_1.getCardanoIndexer)().persistSigningRequest(db, {
|
|
329
|
-
buildId,
|
|
330
|
-
signingPayload,
|
|
331
|
-
});
|
|
332
|
-
const signedTxCbor = hsmSigner.signTransaction(build.unsignedTxCbor, build.txBodyHash);
|
|
333
|
-
// Same verification path as external signing
|
|
334
|
-
const verificationResult = signerModule.verifySignedTransaction(signedTxCbor, build.txBodyHash);
|
|
335
|
-
const hsmStatus = hsmSigner.getStatus();
|
|
336
|
-
const hsmKeyIdentifier = hsmStatus.keyLabel || hsmStatus.keyId || 'unknown';
|
|
337
|
-
// A failed HSM verification is a server fault: reject (rolls back) rather than 200 'failed'.
|
|
338
|
-
if (!verificationResult.isValid) {
|
|
339
|
-
logger.error({ signingRequestId: signingRequestRecord.id, hsmKey: hsmKeyIdentifier }, 'HSM signature verification failed');
|
|
340
|
-
(0, errors_1.rejectInvalid)(req, 'SignWithHsm', 'HSM signature verification failed', 'signedTxCbor');
|
|
341
|
-
}
|
|
383
|
+
const signed = await signBuildWithHsm(req, db, hsmSigner, 'SignWithHsm', { buildId, address, message: 'HSM signing' }, TransactionBuilds);
|
|
342
384
|
await (0, server_1.getCardanoIndexer)().persistSignatureVerification(db, {
|
|
343
|
-
signingRequestId:
|
|
344
|
-
signedTxCbor,
|
|
345
|
-
verificationResult,
|
|
385
|
+
signingRequestId: signed.signingRequestId,
|
|
386
|
+
signedTxCbor: signed.signedTxCbor,
|
|
387
|
+
verificationResult: signed.verificationResult,
|
|
346
388
|
signerType: 'hsm',
|
|
347
|
-
signerInfo: `HSM key: ${hsmKeyIdentifier}`,
|
|
389
|
+
signerInfo: `HSM key: ${signed.hsmKeyIdentifier}`,
|
|
348
390
|
});
|
|
349
391
|
// HSM audit field
|
|
350
|
-
await db.run(UPDATE.entity(SigningRequests)
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
logger.info({
|
|
354
|
-
buildId,
|
|
355
|
-
signingRequestId: signingRequestRecord.id,
|
|
356
|
-
isValid: verificationResult.isValid,
|
|
357
|
-
hsmKey: hsmKeyIdentifier,
|
|
358
|
-
}, 'Transaction signed with HSM');
|
|
359
|
-
return db.run(SELECT.one.from(SigningRequests).where({ id: signingRequestRecord.id }));
|
|
392
|
+
await db.run(UPDATE.entity(SigningRequests).set({ hsmKeyId: signed.hsmKeyIdentifier }).where({ id: signed.signingRequestId }));
|
|
393
|
+
logger.info({ buildId, signingRequestId: signed.signingRequestId, hsmKey: signed.hsmKeyIdentifier }, 'Transaction signed with HSM');
|
|
394
|
+
return db.run(SELECT.one.from(SigningRequests).where({ id: signed.signingRequestId }));
|
|
360
395
|
});
|
|
361
396
|
});
|
|
362
397
|
// SignAndSubmitWithHsm: create a signing request, sign, verify and submit in one call.
|
|
@@ -369,49 +404,31 @@ module.exports = (srv) => {
|
|
|
369
404
|
(0, errors_1.throwIfValidationErrors)(req, 'SignAndSubmitWithHsm', errors);
|
|
370
405
|
if (address && !(0, validators_1.isValidBech32Address)(address))
|
|
371
406
|
(0, errors_1.rejectInvalid)(req, 'SignAndSubmitWithHsm', 'Invalid bech32 address format', 'address');
|
|
372
|
-
const hsmSigner = (
|
|
373
|
-
if (!hsmSigner || !hsmSigner.isConnected()) {
|
|
374
|
-
(0, errors_1.rejectInvalid)(req, 'SignAndSubmitWithHsm', 'HSM is not configured or not connected', 'hsm');
|
|
375
|
-
}
|
|
407
|
+
const hsmSigner = connectedHsm(req, 'SignAndSubmitWithHsm');
|
|
376
408
|
try {
|
|
377
|
-
// Phase 1 (committed):
|
|
378
|
-
//
|
|
409
|
+
// Phase 1 (committed): sign, verify and claim as 'submitting' with the signed CBOR, so an
|
|
410
|
+
// interrupted or unresolved submission can be resolved later. A failure rolls the request back.
|
|
379
411
|
const phase1 = async (db) => {
|
|
380
|
-
const
|
|
381
|
-
//
|
|
382
|
-
const
|
|
383
|
-
if (
|
|
384
|
-
(0, errors_1.rejectInvalid)(req, 'SignAndSubmitWithHsm',
|
|
385
|
-
}
|
|
386
|
-
const signerModule = (0, external_signer_1.getExternalSignerModule)();
|
|
387
|
-
const signingPayload = signerModule.createSigningRequest(build.id, build.unsignedTxCbor, build.txBodyHash, build.network, 'HSM signing + submit');
|
|
388
|
-
const signingRequestRecord = await (0, server_1.getCardanoIndexer)().persistSigningRequest(db, { buildId, signingPayload });
|
|
389
|
-
const signedTxCbor = hsmSigner.signTransaction(build.unsignedTxCbor, build.txBodyHash);
|
|
390
|
-
// Reject (rolls back) on an invalid signature before submitting
|
|
391
|
-
const verificationResult = signerModule.verifySignedTransaction(signedTxCbor, build.txBodyHash);
|
|
392
|
-
const hsmStatus = hsmSigner.getStatus();
|
|
393
|
-
const hsmKeyIdentifier = hsmStatus.keyLabel || hsmStatus.keyId || 'unknown';
|
|
394
|
-
if (!verificationResult.isValid) {
|
|
395
|
-
logger.error({ signingRequestId: signingRequestRecord.id, hsmKey: hsmKeyIdentifier }, 'HSM signature verification failed, aborting submission');
|
|
396
|
-
(0, errors_1.rejectInvalid)(req, 'SignAndSubmitWithHsm', 'HSM signature verification failed', 'signedTxCbor');
|
|
397
|
-
}
|
|
398
|
-
// Claim as 'submitting' with the signed CBOR, the signer and the claim time, so an
|
|
399
|
-
// interrupted or unresolved submission can be resolved later.
|
|
412
|
+
const signed = await signBuildWithHsm(req, db, hsmSigner, 'SignAndSubmitWithHsm', { buildId, address, message: 'HSM signing + submit' }, TransactionBuilds);
|
|
413
|
+
// a build stored before every build had an expiry can still lack one
|
|
414
|
+
const problem = (0, landing_proof_1.sendProblem)(signed.signedTxCbor, (0, server_1.getCardanoClient)().network);
|
|
415
|
+
if (problem)
|
|
416
|
+
(0, errors_1.rejectInvalid)(req, 'SignAndSubmitWithHsm', problem, 'buildId');
|
|
400
417
|
await db.run(UPDATE.entity(SigningRequests).set({
|
|
401
418
|
status: 'submitting',
|
|
402
|
-
hsmKeyId: hsmKeyIdentifier,
|
|
403
|
-
signedTxCbor,
|
|
419
|
+
hsmKeyId: signed.hsmKeyIdentifier,
|
|
420
|
+
signedTxCbor: signed.signedTxCbor,
|
|
404
421
|
signerType: 'hsm',
|
|
405
|
-
signerInfo: `HSM key: ${hsmKeyIdentifier}`,
|
|
422
|
+
signerInfo: `HSM key: ${signed.hsmKeyIdentifier}`,
|
|
406
423
|
signedAt: new Date().toISOString(),
|
|
407
|
-
}).where({ id:
|
|
408
|
-
return
|
|
424
|
+
}).where({ id: signed.signingRequestId }));
|
|
425
|
+
return signed;
|
|
409
426
|
};
|
|
410
427
|
const finalizeParams = (prep) => ({
|
|
411
428
|
signingRequestId: prep.signingRequestId,
|
|
412
429
|
buildId,
|
|
413
430
|
fullSignedTxCbor: prep.signedTxCbor,
|
|
414
|
-
txHash: prep.
|
|
431
|
+
txHash: prep.build.txBodyHash,
|
|
415
432
|
verificationResult: prep.verificationResult,
|
|
416
433
|
signerType: 'hsm',
|
|
417
434
|
signerInfo: `HSM key: ${prep.hsmKeyIdentifier}`,
|
|
@@ -420,11 +437,11 @@ module.exports = (srv) => {
|
|
|
420
437
|
// Phase 1 on the caller's transaction; submit runs after its commit.
|
|
421
438
|
const prep = await phase1(cds_1.default.tx(req));
|
|
422
439
|
(0, submission_finalizer_1.scheduleDeferredSubmit)(req, SigningRequests, finalizeParams(prep));
|
|
423
|
-
logger.info({ signingRequestId: prep.signingRequestId, txHash: prep.
|
|
440
|
+
logger.info({ signingRequestId: prep.signingRequestId, txHash: prep.build.txBodyHash }, 'HSM-signed and claimed, submit deferred until after the caller commits');
|
|
424
441
|
return {
|
|
425
442
|
id: null,
|
|
426
443
|
build_id: buildId,
|
|
427
|
-
txHash: prep.
|
|
444
|
+
txHash: prep.build.txBodyHash,
|
|
428
445
|
signedTxCbor: prep.signedTxCbor,
|
|
429
446
|
status: 'pending',
|
|
430
447
|
submittedAt: null,
|
|
@@ -432,10 +449,10 @@ module.exports = (srv) => {
|
|
|
432
449
|
}
|
|
433
450
|
const prep = await (0, tx_utils_1.detachedTx)('HSM sign + claim signing request', phase1);
|
|
434
451
|
logger.info({ signingRequestId: prep.signingRequestId, witnessCount: prep.verificationResult.witnessCount, hsmKey: prep.hsmKeyIdentifier }, 'HSM signature verified, proceeding with submission');
|
|
435
|
-
// Phases 2+3: submit outside any DB tx, then finalize
|
|
436
|
-
// generic finalizer does not
|
|
452
|
+
// Phases 2+3: submit outside any DB tx, then finalize; hsmKeyId is set again because the
|
|
453
|
+
// generic finalizer does not write it
|
|
437
454
|
const submissionRecord = await (0, submission_finalizer_1.submitAndFinalize)(SigningRequests, finalizeParams(prep), (db) => db.run(UPDATE.entity(SigningRequests).set({ hsmKeyId: prep.hsmKeyIdentifier }).where({ id: prep.signingRequestId })).then(() => undefined));
|
|
438
|
-
logger.info({ signingRequestId: prep.signingRequestId, txHash: prep.
|
|
455
|
+
logger.info({ signingRequestId: prep.signingRequestId, txHash: prep.build.txBodyHash }, 'HSM-signed transaction submitted and all records updated');
|
|
439
456
|
return submissionRecord;
|
|
440
457
|
}
|
|
441
458
|
catch (e) {
|
|
@@ -443,6 +460,42 @@ module.exports = (srv) => {
|
|
|
443
460
|
return (0, mappers_1.mapError)(req, e, 'SignAndSubmitWithHsm');
|
|
444
461
|
}
|
|
445
462
|
});
|
|
463
|
+
// ResolveSigningRequest (Admin): settles an unresolved request as an operator read it on the chain.
|
|
464
|
+
// Confirmed writes the submission record a submit writes; failed ends the request.
|
|
465
|
+
srv.on('ResolveSigningRequest', async (req) => {
|
|
466
|
+
const { signingRequestId, outcome, txHash, note } = req.data;
|
|
467
|
+
return (0, backend_request_handler_1.handleRequest)(req, async (db) => {
|
|
468
|
+
// read and ask the chain before the request takes its connection
|
|
469
|
+
const request = await (0, tx_utils_1.readOutside)(db, (d) => d.run(SELECT.one.from(SigningRequests).where({ id: signingRequestId })));
|
|
470
|
+
if (!request)
|
|
471
|
+
throw new errors_1.NotFoundError(`Signing request '${signingRequestId}'`);
|
|
472
|
+
if (request.status !== 'unresolved') {
|
|
473
|
+
(0, errors_1.rejectInvalid)(req, 'ResolveSigningRequest', `Signing request status is '${request.status}': only an unresolved request can be resolved`, 'signingRequestId');
|
|
474
|
+
}
|
|
475
|
+
(0, resolution_1.checkResolvedTxHash)(req, 'ResolveSigningRequest', txHash, request.txBodyHash);
|
|
476
|
+
const resolved = outcome === 'confirmed' ? 'confirmed' : 'failed';
|
|
477
|
+
await (0, resolution_1.refuseFailedWhileItCanLand)('ResolveSigningRequest', resolved, request.signedTxCbor, (0, server_1.getCardanoClient)());
|
|
478
|
+
const resolution = (0, resolution_1.resolutionNote)(resolved, req.user?.id, note);
|
|
479
|
+
const won = await db.run(UPDATE.entity(SigningRequests)
|
|
480
|
+
.set(resolved === 'confirmed' ? { status: 'submitted', errorMessage: null, resolution } : { status: 'failed', resolution })
|
|
481
|
+
.where({ id: signingRequestId, status: 'unresolved' }));
|
|
482
|
+
if (won === 0)
|
|
483
|
+
throw (0, resolution_1.resolvedConcurrently)('ResolveSigningRequest');
|
|
484
|
+
if (resolved === 'confirmed') {
|
|
485
|
+
if (!request.signedTxCbor || !request.build_id) {
|
|
486
|
+
(0, errors_1.rejectInvalid)(req, 'ResolveSigningRequest', 'Signing request has no stored signed transaction or build', 'signingRequestId');
|
|
487
|
+
}
|
|
488
|
+
// the witness metadata the submission record keeps, from the stored bytes
|
|
489
|
+
const verificationResult = (0, external_signer_1.getExternalSignerModule)().verifyOrThrow(request.signedTxCbor, request.txBodyHash);
|
|
490
|
+
await (0, server_1.getCardanoIndexer)().indexVerifiedTransactionSubmission(db, {
|
|
491
|
+
signingRequestId, buildId: request.build_id, fullSignedTxCbor: request.signedTxCbor, txHash: request.txBodyHash,
|
|
492
|
+
verificationResult, signerType: request.signerType ?? undefined, signerInfo: request.signerInfo ?? undefined,
|
|
493
|
+
});
|
|
494
|
+
}
|
|
495
|
+
logger.warn({ signingRequestId, outcome: resolved, by: req.user?.id }, 'Unresolved signing request resolved by an operator');
|
|
496
|
+
return db.run(SELECT.one.from(SigningRequests).where({ id: signingRequestId }));
|
|
497
|
+
});
|
|
498
|
+
});
|
|
446
499
|
// GetHsmStatus: connection status and key info; null fields when no HSM is configured.
|
|
447
500
|
srv.on('GetHsmStatus', async (_req) => {
|
|
448
501
|
enforceHsmRole(_req, 'GetHsmStatus');
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
using { CardanoNetwork } from '../db/types';
|
|
1
|
+
using { CardanoNetwork, ResolvedOutcome } from '../db/types';
|
|
2
2
|
using {odatano.cardano as db} from '../db/schema';
|
|
3
3
|
using {
|
|
4
4
|
Bech32,
|
|
@@ -54,6 +54,17 @@ service CardanoTransactionService @(impl: './cardano-tx-service') {
|
|
|
54
54
|
action CheckSubmissionStatus() returns TransactionSubmissions;
|
|
55
55
|
};
|
|
56
56
|
|
|
57
|
+
@title : 'Resolve Submission'
|
|
58
|
+
@description: 'Settle an unresolved submission after reading the chain: confirmed when its transaction is on chain with passing scripts (it is then submitted, and CheckSubmissionStatus counts its depth), failed when it is not and can no longer land; failed is refused with 409 while the transaction is not expired and an input of it is unspent. txHash, when given, must be the submission transaction.'
|
|
59
|
+
@requires : 'Admin'
|
|
60
|
+
@odatano.agent: 'operator'
|
|
61
|
+
action ResolveSubmission(
|
|
62
|
+
@title: 'Submission ID' submissionId : UUID not null,
|
|
63
|
+
@title: 'Outcome' @assert.range outcome : ResolvedOutcome not null,
|
|
64
|
+
@title: 'Transaction Hash' txHash : String(64),
|
|
65
|
+
@title: 'Note' note : String(300)
|
|
66
|
+
) returns TransactionSubmissions;
|
|
67
|
+
|
|
57
68
|
// Status flow: pending, then submitted by SubmitTransaction, then confirmed by CheckSubmissionStatus at 3 blocks deep.
|
|
58
69
|
// A blockchain error moves pending or submitted to failed.
|
|
59
70
|
annotate CardanoTransactionService.TransactionSubmissions with @flow.status: status actions {
|
|
@@ -121,14 +132,14 @@ service CardanoTransactionService @(impl: './cardano-tx-service') {
|
|
|
121
132
|
@description: 'Optional Plutus V3 validator CBOR hex to attach as referenceScript on the primary recipient output (CIP-33 reference script deploy). Significantly increases the output min-ADA; lovelaceAmount must cover the inflated requirement.'
|
|
122
133
|
referenceScriptHex: String,
|
|
123
134
|
@title: 'Validity Start (Posix ms)'
|
|
124
|
-
@description: 'Optional. Validity-interval start in Posix milliseconds.
|
|
135
|
+
@description: 'Optional. Validity-interval start in Posix milliseconds. No start is set when omitted.'
|
|
125
136
|
validityStartMs: String,
|
|
126
137
|
@title: 'Validity End (Posix ms)'
|
|
127
|
-
@description: 'Optional. Validity-interval end in Posix milliseconds.
|
|
138
|
+
@description: 'Optional. Validity-interval end in Posix milliseconds. Defaults to now + 3 600 000 ms, or to validityStartMs + 3 600 000 ms when that start lies in the future. At most 24 hours ahead, else 400.'
|
|
128
139
|
validityEndMs: String) returns TransactionBuilds;
|
|
129
140
|
|
|
130
141
|
@title : 'Build Transaction with Metadata'
|
|
131
|
-
@description: 'Build a transaction with custom metadata from sender to recipient with specified amount and change address'
|
|
142
|
+
@description: 'Build a transaction with custom metadata from sender to recipient with specified amount and change address. The transaction expires one hour after the build.'
|
|
132
143
|
@odatano.agent: 'grant'
|
|
133
144
|
action BuildTransactionWithMetadata(
|
|
134
145
|
@title: 'Sender Address'
|
|
@@ -179,10 +190,10 @@ service CardanoTransactionService @(impl: './cardano-tx-service') {
|
|
|
179
190
|
@description: 'Optional Plutus V3 validator CBOR hex to attach as referenceScript on the primary recipient output (CIP-33 reference script deploy). Significantly increases the output min-ADA; lovelaceAmount must cover the inflated requirement.'
|
|
180
191
|
referenceScriptHex: String,
|
|
181
192
|
@title: 'Validity Start (Posix ms)'
|
|
182
|
-
@description: 'Optional. Validity-interval start in Posix milliseconds.
|
|
193
|
+
@description: 'Optional. Validity-interval start in Posix milliseconds. No start is set when omitted.'
|
|
183
194
|
validityStartMs: String,
|
|
184
195
|
@title: 'Validity End (Posix ms)'
|
|
185
|
-
@description: 'Optional. Validity-interval end in Posix milliseconds.
|
|
196
|
+
@description: 'Optional. Validity-interval end in Posix milliseconds. Defaults to now + 3 600 000 ms, or to validityStartMs + 3 600 000 ms when that start lies in the future. At most 24 hours ahead, else 400.'
|
|
186
197
|
validityEndMs: String) returns TransactionBuilds;
|
|
187
198
|
|
|
188
199
|
@title : 'Build Minting Transaction'
|
|
@@ -229,7 +240,7 @@ service CardanoTransactionService @(impl: './cardano-tx-service') {
|
|
|
229
240
|
@description: 'Optional JSON array of {txHash, outputIndex} UTxOs of the sender that must never be spent: left out of coin selection and collateral.'
|
|
230
241
|
protectInputsJson: String,
|
|
231
242
|
@title: 'Reference Inputs JSON'
|
|
232
|
-
@description: 'Optional JSON array of {txHash, outputIndex} UTxOs to include as CIP-31 reference inputs (read-only, not consumed). Use for oracle feeds, shared config UTxOs, or script reference UTxOs.
|
|
243
|
+
@description: 'Optional JSON array of {txHash, outputIndex} UTxOs to include as CIP-31 reference inputs (read-only, not consumed). Use for oracle feeds, shared config UTxOs, or script reference UTxOs.'
|
|
233
244
|
referenceInputsJson: String,
|
|
234
245
|
@title: 'Extra Outputs JSON'
|
|
235
246
|
@description: 'Optional JSON array of additional outputs [{address, lovelaceAmount, assets?, inlineDatumJson?, referenceScriptHex?}] appended after the primary recipient output. When present, the extra outputs carry the minted assets (declare each minted unit in an entry''s assets) and the primary output stays ADA-only. This places each minted token on its own output with its own inline datum (e.g. datum-bound predicate tokens). Each entry is independently min-ADA checked.'
|
|
@@ -244,7 +255,7 @@ service CardanoTransactionService @(impl: './cardano-tx-service') {
|
|
|
244
255
|
@description: 'Optional. Sets the transaction validity-interval start in Posix milliseconds. Required finite value for Plutus validators that call expect Finite(lower) on tx.validity_range.lower_bound. Defaults to now − 120 000 ms when omitted.'
|
|
245
256
|
validityStartMs: String,
|
|
246
257
|
@title: 'Validity End (Posix ms)'
|
|
247
|
-
@description: 'Optional. Sets the transaction validity-interval end in Posix milliseconds. Required finite value for Plutus validators that call expect Finite(upper) on tx.validity_range.upper_bound. Defaults to now + 3 600 000 ms when
|
|
258
|
+
@description: 'Optional. Sets the transaction validity-interval end in Posix milliseconds. Required finite value for Plutus validators that call expect Finite(upper) on tx.validity_range.upper_bound. Defaults to now + 3 600 000 ms, or to validityStartMs + 3 600 000 ms when that start lies in the future. At most 24 hours ahead, else 400.'
|
|
248
259
|
validityEndMs: String) returns TransactionBuilds;
|
|
249
260
|
|
|
250
261
|
@title : 'Get Build Details'
|
|
@@ -340,7 +351,7 @@ service CardanoTransactionService @(impl: './cardano-tx-service') {
|
|
|
340
351
|
@description: 'Optional PlutusData JSON for the minting policy redeemer. Defaults to integer 0 if not specified. Supports __INPUT_IDX:txHash#n__ placeholders (Buildooor only).'
|
|
341
352
|
mintRedeemerJson: String,
|
|
342
353
|
@title: 'Reference Inputs JSON'
|
|
343
|
-
@description: 'Optional JSON array of {txHash, outputIndex} UTxOs to include as CIP-31 reference inputs (read-only, not consumed). Use for oracle feeds, shared config UTxOs, or script reference UTxOs.
|
|
354
|
+
@description: 'Optional JSON array of {txHash, outputIndex} UTxOs to include as CIP-31 reference inputs (read-only, not consumed). Use for oracle feeds, shared config UTxOs, or script reference UTxOs.'
|
|
344
355
|
referenceInputsJson: String,
|
|
345
356
|
@title: 'Reference Script Hex'
|
|
346
357
|
@description: 'Optional Plutus V3 validator CBOR hex to attach as referenceScript on the primary recipient output (CIP-33 reference script deploy). Combines with the spend in one atomic tx. Significantly increases the output min-ADA; lovelaceAmount must cover the inflated requirement.'
|
|
@@ -349,7 +360,7 @@ service CardanoTransactionService @(impl: './cardano-tx-service') {
|
|
|
349
360
|
@description: 'Optional. Sets the transaction validity-interval start in Posix milliseconds. Required finite value for Plutus validators that call expect Finite(lower) on tx.validity_range.lower_bound. Defaults to now − 120 000 ms when omitted.'
|
|
350
361
|
validityStartMs: String,
|
|
351
362
|
@title: 'Validity End (Posix ms)'
|
|
352
|
-
@description: 'Optional. Sets the transaction validity-interval end in Posix milliseconds. Required finite value for Plutus validators that call expect Finite(upper) on tx.validity_range.upper_bound. Defaults to now + 3 600 000 ms when
|
|
363
|
+
@description: 'Optional. Sets the transaction validity-interval end in Posix milliseconds. Required finite value for Plutus validators that call expect Finite(upper) on tx.validity_range.upper_bound. Defaults to now + 3 600 000 ms, or to validityStartMs + 3 600 000 ms when that start lies in the future. At most 24 hours ahead, else 400.'
|
|
353
364
|
validityEndMs: String) returns TransactionBuilds;
|
|
354
365
|
|
|
355
366
|
@title : 'Build Plutus Transaction'
|
|
@@ -393,11 +404,11 @@ service CardanoTransactionService @(impl: './cardano-tx-service') {
|
|
|
393
404
|
@description: 'Optional validity-interval start in Posix milliseconds; defaults to now - 120 000 ms.'
|
|
394
405
|
validityStartMs: String,
|
|
395
406
|
@title: 'Validity End (Posix ms)'
|
|
396
|
-
@description: 'Optional validity-interval end in Posix milliseconds; defaults to now + 3 600 000 ms.'
|
|
407
|
+
@description: 'Optional validity-interval end in Posix milliseconds; defaults to now + 3 600 000 ms, or to validityStartMs + 3 600 000 ms when that start lies in the future. At most 24 hours ahead, else 400.'
|
|
397
408
|
validityEndMs: String) returns TransactionBuilds;
|
|
398
409
|
|
|
399
410
|
@title : 'Set Collateral'
|
|
400
|
-
@description: 'Ensure a dedicated ADA-only collateral UTxO exists for Plutus transactions. Checks if the address has
|
|
411
|
+
@description: 'Ensure a dedicated ADA-only collateral UTxO exists for Plutus transactions. Checks if the address has an ADA-only UTxO of at least 5 ADA without a reference script, and a second UTxO. If not, builds a self-send transaction to create a 5 ADA collateral UTxO.'
|
|
401
412
|
@odatano.agent: 'grant'
|
|
402
413
|
action SetCollateral(
|
|
403
414
|
@title: 'Address'
|