@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
package/srv/utils/types.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { LedgerProtocolParameter } from "#cds-models/odatano/cardano";
|
|
2
2
|
import type { ReferenceScriptType } from "./reference-script";
|
|
3
|
+
import type { SigningStatus } from '../../@cds-models';
|
|
3
4
|
export type { ReferenceScriptType };
|
|
4
5
|
/** Hex-encoded string (case depends on source) */
|
|
5
6
|
export type Hex = string;
|
|
@@ -159,22 +160,25 @@ export interface BlockData {
|
|
|
159
160
|
size: number;
|
|
160
161
|
txCount: number;
|
|
161
162
|
fees?: string | null;
|
|
163
|
+
/** Hash of the block before this one; undefined when the source does not report it. */
|
|
164
|
+
previousHash?: string | null;
|
|
162
165
|
/** Header fields only (ledger tip): size, txCount, fees and slotLeader are placeholders, not block data. */
|
|
163
166
|
headerOnly?: boolean;
|
|
164
167
|
}
|
|
165
168
|
/** Network supply */
|
|
169
|
+
/** Network supply in lovelace; null = the backend does not report the figure. */
|
|
166
170
|
export interface Supply {
|
|
167
171
|
max: string;
|
|
168
|
-
total: string;
|
|
169
|
-
circulating: string;
|
|
170
|
-
locked: string;
|
|
171
|
-
treasury: string;
|
|
172
|
-
reserves: string;
|
|
172
|
+
total: string | null;
|
|
173
|
+
circulating: string | null;
|
|
174
|
+
locked: string | null;
|
|
175
|
+
treasury: string | null;
|
|
176
|
+
reserves: string | null;
|
|
173
177
|
}
|
|
174
|
-
/** Network stake */
|
|
178
|
+
/** Network stake in lovelace; null = the backend does not report the figure. */
|
|
175
179
|
export interface Stake {
|
|
176
|
-
live: string;
|
|
177
|
-
active: string;
|
|
180
|
+
live: string | null;
|
|
181
|
+
active: string | null;
|
|
178
182
|
}
|
|
179
183
|
/** Network supply and stake */
|
|
180
184
|
export interface NetworkInformation {
|
|
@@ -186,12 +190,12 @@ export interface EpochData {
|
|
|
186
190
|
epoch: number;
|
|
187
191
|
start_time: number;
|
|
188
192
|
end_time: number;
|
|
189
|
-
first_block_time: number;
|
|
193
|
+
first_block_time: number | null;
|
|
190
194
|
last_block_time: number;
|
|
191
|
-
block_count: number;
|
|
192
|
-
tx_count: number;
|
|
193
|
-
output: string;
|
|
194
|
-
fees: string;
|
|
195
|
+
block_count: number | null;
|
|
196
|
+
tx_count: number | null;
|
|
197
|
+
output: string | null;
|
|
198
|
+
fees: string | null;
|
|
195
199
|
active_stake: string | null;
|
|
196
200
|
}
|
|
197
201
|
/** Transaction metadata under one label */
|
|
@@ -204,33 +208,36 @@ export interface MetadataLabelTx {
|
|
|
204
208
|
export interface AccountData {
|
|
205
209
|
stakeaddress: string;
|
|
206
210
|
active: boolean;
|
|
207
|
-
activeEpoch: number;
|
|
208
|
-
controlledAmount: string;
|
|
211
|
+
activeEpoch: number | null;
|
|
212
|
+
controlledAmount: string | null;
|
|
209
213
|
rewardsSum: string | null;
|
|
210
|
-
withdrawalsSum: string;
|
|
211
|
-
reservesSum: string;
|
|
212
|
-
treasurySum: string;
|
|
214
|
+
withdrawalsSum: string | null;
|
|
215
|
+
reservesSum: string | null;
|
|
216
|
+
treasurySum: string | null;
|
|
213
217
|
withdrawableAmount: string | null;
|
|
214
218
|
poolId: string | null;
|
|
215
219
|
drepId: string | null;
|
|
216
|
-
addresses
|
|
220
|
+
/** Bech32 addresses under the stake key, as the backend lists them; their UTxOs are read separately. */
|
|
221
|
+
addresses: string[];
|
|
217
222
|
}
|
|
218
223
|
/** Pool information */
|
|
219
224
|
export interface PoolData {
|
|
220
225
|
poolId: string;
|
|
221
226
|
vrfKeyHash: string;
|
|
222
|
-
|
|
227
|
+
/** Null when the source does not count blocks (Ogmios ledger state). */
|
|
228
|
+
blocksMinted: number | null;
|
|
223
229
|
/** Blocks minted in the current epoch; null when the backend has no such figure (Koios). */
|
|
224
230
|
blocksEpoch: number | null;
|
|
225
231
|
liveStake: string;
|
|
226
232
|
/** Share of the total live stake; null when the backend has no such figure (Koios). */
|
|
227
233
|
liveSize: number | null;
|
|
228
|
-
/** Fraction of the ideal (saturated) pool size, NOT percent: 0.7542 = 75.42 %. */
|
|
229
|
-
liveSaturation: number;
|
|
234
|
+
/** Fraction of the ideal (saturated) pool size, NOT percent: 0.7542 = 75.42 %. Null when unknown. */
|
|
235
|
+
liveSaturation: number | null;
|
|
230
236
|
/** Null when the source cannot count delegators (Ogmios ledger state). */
|
|
231
237
|
liveDelegators: number | null;
|
|
232
|
-
|
|
233
|
-
|
|
238
|
+
/** Null when the source has no active stake (the node's live pool view). */
|
|
239
|
+
activeStake: string | null;
|
|
240
|
+
activeSize: number | null;
|
|
234
241
|
pledge: string;
|
|
235
242
|
margin: number;
|
|
236
243
|
fixedCost: string;
|
|
@@ -419,7 +426,7 @@ export type TxBuildRequest = {
|
|
|
419
426
|
referenceScript?: string;
|
|
420
427
|
/** Validity start in Posix ms (`invalidBefore`); builder default `now - 120_000` for script builds. */
|
|
421
428
|
validityStartMs?: string;
|
|
422
|
-
/** Validity end in Posix ms (`invalidAfter`, ledger TTL); builder default `now + 3_600_000
|
|
429
|
+
/** Validity end in Posix ms (`invalidAfter`, ledger TTL); builder default `now + 3_600_000`, at most 24 h ahead. */
|
|
423
430
|
validityEndMs?: string;
|
|
424
431
|
};
|
|
425
432
|
/** Mint/burn build request: mintActions and mintingPolicyScript required */
|
|
@@ -542,10 +549,8 @@ export type TxBuildResult = {
|
|
|
542
549
|
lovelace: string;
|
|
543
550
|
}>;
|
|
544
551
|
metaDataCborHex?: string;
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
lovelace: string;
|
|
548
|
-
};
|
|
552
|
+
/** Address the builder sent the change to: the request's changeAddress, else the sender. */
|
|
553
|
+
changeAddress?: string;
|
|
549
554
|
warnings: string[];
|
|
550
555
|
/** Blake2b-224 hash of the script (= policy ID for minting), if a script was provided */
|
|
551
556
|
scriptHash?: string;
|
|
@@ -578,21 +583,8 @@ export declare enum ExternalSignerType {
|
|
|
578
583
|
/** Hardware Security Module (server-side PKCS#11) */
|
|
579
584
|
HSM = "hsm"
|
|
580
585
|
}
|
|
581
|
-
/** Signing request status */
|
|
582
|
-
export
|
|
583
|
-
/** Request created, awaiting signing */
|
|
584
|
-
PENDING = "pending",
|
|
585
|
-
/** Transaction has been signed */
|
|
586
|
-
SIGNED = "signed",
|
|
587
|
-
/** Signature verified, ready for submission */
|
|
588
|
-
VERIFIED = "verified",
|
|
589
|
-
/** Transaction submitted to network */
|
|
590
|
-
SUBMITTED = "submitted",
|
|
591
|
-
/** Signing or verification failed */
|
|
592
|
-
FAILED = "failed",
|
|
593
|
-
/** Request expired (not signed within TTL) */
|
|
594
|
-
EXPIRED = "expired"
|
|
595
|
-
}
|
|
586
|
+
/** Signing request status: the generated enum type of the model. */
|
|
587
|
+
export type { SigningStatus } from '../../@cds-models';
|
|
596
588
|
/** Instructions for external signers */
|
|
597
589
|
export interface SigningInstructions {
|
|
598
590
|
/** Signer type hint (which tool/wallet to use) */
|
package/srv/utils/types.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.ExternalSignerType = void 0;
|
|
4
4
|
/** Supported external signer types */
|
|
5
5
|
var ExternalSignerType;
|
|
6
6
|
(function (ExternalSignerType) {
|
|
@@ -15,20 +15,4 @@ var ExternalSignerType;
|
|
|
15
15
|
/** Hardware Security Module (server-side PKCS#11) */
|
|
16
16
|
ExternalSignerType["HSM"] = "hsm";
|
|
17
17
|
})(ExternalSignerType || (exports.ExternalSignerType = ExternalSignerType = {}));
|
|
18
|
-
/** Signing request status */
|
|
19
|
-
var SigningStatus;
|
|
20
|
-
(function (SigningStatus) {
|
|
21
|
-
/** Request created, awaiting signing */
|
|
22
|
-
SigningStatus["PENDING"] = "pending";
|
|
23
|
-
/** Transaction has been signed */
|
|
24
|
-
SigningStatus["SIGNED"] = "signed";
|
|
25
|
-
/** Signature verified, ready for submission */
|
|
26
|
-
SigningStatus["VERIFIED"] = "verified";
|
|
27
|
-
/** Transaction submitted to network */
|
|
28
|
-
SigningStatus["SUBMITTED"] = "submitted";
|
|
29
|
-
/** Signing or verification failed */
|
|
30
|
-
SigningStatus["FAILED"] = "failed";
|
|
31
|
-
/** Request expired (not signed within TTL) */
|
|
32
|
-
SigningStatus["EXPIRED"] = "expired";
|
|
33
|
-
})(SigningStatus || (exports.SigningStatus = SigningStatus = {}));
|
|
34
18
|
//# sourceMappingURL=types.js.map
|
|
@@ -22,9 +22,9 @@ export declare function isValidCredential(s: unknown): s is string;
|
|
|
22
22
|
export declare function isValidPoolId(poolIdRaw: unknown): poolIdRaw is string;
|
|
23
23
|
/** DRep ID: bech32 with HRP "drep" and a 29-byte payload. */
|
|
24
24
|
export declare function isValidDrepId(drepRaw: unknown): drepRaw is string;
|
|
25
|
-
/** Bech32 address with the HRP of the active network
|
|
25
|
+
/** Bech32 address with the HRP of the active network. */
|
|
26
26
|
export declare function isValidBech32Address(addrRaw: unknown): addrRaw is string;
|
|
27
|
-
/** Bech32 stake address with the HRP of the active network
|
|
27
|
+
/** Bech32 stake address with the HRP of the active network. */
|
|
28
28
|
export declare function isValidBech32StakeAddress(stakeRaw: unknown): stakeRaw is string;
|
|
29
29
|
/** Epoch number: non-negative integer up to MAX_EPOCH */
|
|
30
30
|
export declare function isEpochNumber(s: unknown): s is number;
|
package/srv/utils/validators.js
CHANGED
|
@@ -21,6 +21,7 @@ const bech32_1 = require("bech32");
|
|
|
21
21
|
const const_1 = require("./const");
|
|
22
22
|
// Leaf module, not `../server`: importing server would pull the whole server/indexer graph in here.
|
|
23
23
|
const network_context_1 = require("./network-context");
|
|
24
|
+
const mappers_1 = require("./mappers");
|
|
24
25
|
/** Trimmed string, or null when not a string or empty after trim. */
|
|
25
26
|
function safeTrimString(s) {
|
|
26
27
|
if (typeof s !== "string")
|
|
@@ -151,12 +152,11 @@ function isValidDrepId(drepRaw) {
|
|
|
151
152
|
return wordsToBytesLen(decoded.words) === const_1.DREP_ID_BYTES;
|
|
152
153
|
return false;
|
|
153
154
|
}
|
|
154
|
-
/** Bech32 address with the HRP of the active network
|
|
155
|
+
/** Bech32 address with the HRP of the active network. */
|
|
155
156
|
function isValidBech32Address(addrRaw) {
|
|
156
157
|
const addr = safeTrimString(addrRaw);
|
|
157
158
|
if (!addr)
|
|
158
159
|
return false;
|
|
159
|
-
// No network yet (app context not initialized): a clean 400 instead of a leaked init error
|
|
160
160
|
const network = (0, network_context_1.getActiveNetwork)();
|
|
161
161
|
if (!network)
|
|
162
162
|
return false;
|
|
@@ -172,7 +172,7 @@ function isValidBech32Address(addrRaw) {
|
|
|
172
172
|
}
|
|
173
173
|
return false;
|
|
174
174
|
}
|
|
175
|
-
/** Bech32 stake address with the HRP of the active network
|
|
175
|
+
/** Bech32 stake address with the HRP of the active network. */
|
|
176
176
|
function isValidBech32StakeAddress(stakeRaw) {
|
|
177
177
|
const stake = safeTrimString(stakeRaw);
|
|
178
178
|
if (!stake)
|
|
@@ -210,24 +210,8 @@ function isValidTxCborHex(cborRaw) {
|
|
|
210
210
|
// Payment credential hash of a Shelley address and whether it is a script credential.
|
|
211
211
|
// Null for undecodable or stake addresses.
|
|
212
212
|
function extractPaymentCredential(address) {
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
const bytes = Buffer.from(bech32_1.bech32.fromWords(decoded.words));
|
|
216
|
-
// 1 header byte + 28-byte payment credential (+ optional 28-byte stake part)
|
|
217
|
-
if (bytes.length < 29)
|
|
218
|
-
return null;
|
|
219
|
-
const addrType = bytes[0] >> 4;
|
|
220
|
-
// types 0-7 are payment addresses; 14/15 are stake addresses (no payment part)
|
|
221
|
-
if (addrType > 7)
|
|
222
|
-
return null;
|
|
223
|
-
return {
|
|
224
|
-
hash: bytes.subarray(1, 29).toString('hex'),
|
|
225
|
-
isScript: (addrType & 0x1) === 1,
|
|
226
|
-
};
|
|
227
|
-
}
|
|
228
|
-
catch {
|
|
229
|
-
return null;
|
|
230
|
-
}
|
|
213
|
+
const decoded = (0, mappers_1.decodeShelleyAddress)(address);
|
|
214
|
+
return decoded.paymentCredential ? { hash: decoded.paymentCredential, isScript: decoded.isScript } : null;
|
|
231
215
|
}
|
|
232
216
|
/** Validate an array of Ed25519 key hashes (56 hex chars each); throws on any invalid entry. */
|
|
233
217
|
function validateRequiredSigners(signers) {
|
|
@@ -287,8 +271,6 @@ function validateTransactionInputs(inputs, requiredFields) {
|
|
|
287
271
|
});
|
|
288
272
|
}
|
|
289
273
|
}
|
|
290
|
-
// 65536 hex chars = 32 KB binary
|
|
291
|
-
const MAX_CBOR_HEX_LENGTH = 65536;
|
|
292
274
|
if (inputs.signedTxCbor && !isValidCbor(inputs.signedTxCbor)) {
|
|
293
275
|
errors.push({
|
|
294
276
|
type: 'invalid',
|
|
@@ -296,11 +278,11 @@ function validateTransactionInputs(inputs, requiredFields) {
|
|
|
296
278
|
message: 'Invalid signedTxCbor format'
|
|
297
279
|
});
|
|
298
280
|
}
|
|
299
|
-
else if (inputs.signedTxCbor && typeof inputs.signedTxCbor === 'string' && inputs.signedTxCbor.length >
|
|
281
|
+
else if (inputs.signedTxCbor && typeof inputs.signedTxCbor === 'string' && inputs.signedTxCbor.length > const_1.MAX_TX_CBOR_HEX_LENGTH) {
|
|
300
282
|
errors.push({
|
|
301
283
|
type: 'invalid',
|
|
302
284
|
field: 'signedTxCbor',
|
|
303
|
-
message: `signedTxCbor exceeds maximum size of ${
|
|
285
|
+
message: `signedTxCbor exceeds maximum size of ${const_1.MAX_TX_CBOR_HEX_LENGTH} hex characters`
|
|
304
286
|
});
|
|
305
287
|
}
|
|
306
288
|
if (inputs.mintingPolicyScript && !isValidCbor(inputs.mintingPolicyScript)) {
|
|
@@ -405,6 +387,13 @@ function validateTransactionInputs(inputs, requiredFields) {
|
|
|
405
387
|
});
|
|
406
388
|
}
|
|
407
389
|
}
|
|
390
|
+
if (!validityEndErr && inputs.validityEndMs && Number(inputs.validityEndMs) > Date.now() + const_1.MAX_VALIDITY_MS) {
|
|
391
|
+
errors.push({
|
|
392
|
+
type: 'invalid',
|
|
393
|
+
field: 'validityEndMs',
|
|
394
|
+
message: `validityEndMs may be at most ${const_1.MAX_VALIDITY_MS / 3_600_000} hours from now`
|
|
395
|
+
});
|
|
396
|
+
}
|
|
408
397
|
return errors;
|
|
409
398
|
}
|
|
410
399
|
/** Posix-ms string field: non-negative integer with at most MAX_POSIX_MS_DIGITS digits; null when valid or absent. */
|