@odatano/core 2.0.0-rc.5 → 2.0.0-rc.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/@cds-models/CardanoAgentService/index.d.ts +99 -51
- package/@cds-models/CardanoAgentService/index.js +15 -0
- package/@cds-models/CardanoBackendService/index.d.ts +347 -0
- package/@cds-models/CardanoBackendService/index.js +40 -0
- package/@cds-models/CardanoIndexerService/index.d.ts +496 -11
- package/@cds-models/CardanoIndexerService/index.js +64 -0
- package/@cds-models/CardanoODataService/index.d.ts +414 -57
- package/@cds-models/CardanoODataService/index.js +42 -0
- package/@cds-models/CardanoSignService/index.d.ts +32 -19
- package/@cds-models/CardanoSignService/index.js +3 -0
- package/@cds-models/CardanoTransactionService/index.d.ts +58 -44
- package/@cds-models/CardanoTransactionService/index.js +4 -0
- package/@cds-models/CardanoWorkerService/index.d.ts +7 -22
- package/@cds-models/index.d.ts +101 -1
- package/@cds-models/index.js +16 -1
- package/@cds-models/odatano/cardano/index.d.ts +437 -32
- package/@cds-models/odatano/cardano/index.js +48 -0
- package/README.md +207 -167
- package/db/schema.cds +2402 -1705
- package/db/types.cds +446 -295
- package/package.json +41 -16
- package/scripts/migrate-schema.mjs +334 -0
- package/scripts/migrate-slot-leader.mjs +96 -0
- package/src/index.d.ts +20 -21
- package/src/index.js +45 -31
- package/src/plugin.js +17 -35
- package/srv/blockchain/asset-decimals.d.ts +7 -0
- package/srv/blockchain/asset-decimals.js +91 -0
- package/srv/blockchain/backends/blockfrost-backend.d.ts +25 -135
- package/srv/blockchain/backends/blockfrost-backend.js +66 -172
- package/srv/blockchain/backends/cardano-backend.d.ts +94 -186
- package/srv/blockchain/backends/cardano-backend.js +29 -5
- package/srv/blockchain/backends/koios-backend.d.ts +103 -168
- package/srv/blockchain/backends/koios-backend.js +428 -360
- package/srv/blockchain/backends/odatano-backend.d.ts +54 -0
- package/srv/blockchain/backends/odatano-backend.js +169 -0
- package/srv/blockchain/backends/ogmios-backend.d.ts +123 -190
- package/srv/blockchain/backends/ogmios-backend.js +637 -315
- package/srv/blockchain/backends/ogmios-frame-guard.d.ts +14 -0
- package/srv/blockchain/backends/ogmios-frame-guard.js +89 -0
- package/srv/blockchain/cardano-client.d.ts +61 -241
- package/srv/blockchain/cardano-client.js +253 -293
- package/srv/blockchain/cardano-indexer.d.ts +282 -281
- package/srv/blockchain/cardano-indexer.js +1551 -484
- package/srv/blockchain/cardano-tx-builder.d.ts +25 -89
- package/srv/blockchain/cardano-tx-builder.js +164 -140
- package/srv/blockchain/circuit-breaker.d.ts +1 -13
- package/srv/blockchain/circuit-breaker.js +5 -15
- package/srv/blockchain/crawler/account-snapshots.d.ts +29 -0
- package/srv/blockchain/crawler/account-snapshots.js +153 -0
- package/srv/blockchain/crawler/asset-decimals-backfill.d.ts +15 -0
- package/srv/blockchain/crawler/asset-decimals-backfill.js +56 -0
- package/srv/blockchain/crawler/asset-registry-backfill.d.ts +43 -0
- package/srv/blockchain/crawler/asset-registry-backfill.js +153 -0
- package/srv/blockchain/crawler/certificate-backfill.d.ts +52 -0
- package/srv/blockchain/crawler/certificate-backfill.js +162 -0
- package/srv/blockchain/crawler/crawler.d.ts +104 -81
- package/srv/blockchain/crawler/crawler.js +532 -160
- package/srv/blockchain/crawler/credential-backfill.d.ts +28 -0
- package/srv/blockchain/crawler/credential-backfill.js +124 -0
- package/srv/blockchain/crawler/hooks.d.ts +2 -17
- package/srv/blockchain/crawler/index.d.ts +1 -8
- package/srv/blockchain/crawler/index.js +31 -17
- package/srv/blockchain/crawler/input-asset-copies.d.ts +34 -0
- package/srv/blockchain/crawler/input-asset-copies.js +171 -0
- package/srv/blockchain/crawler/metadata-position-backfill.d.ts +16 -0
- package/srv/blockchain/crawler/metadata-position-backfill.js +55 -0
- package/srv/blockchain/crawler/output-datum-backfill.d.ts +39 -0
- package/srv/blockchain/crawler/output-datum-backfill.js +110 -0
- package/srv/blockchain/crawler/sync-state.d.ts +27 -47
- package/srv/blockchain/crawler/sync-state.js +113 -63
- package/srv/blockchain/crawler/transaction-backfill.d.ts +44 -0
- package/srv/blockchain/crawler/transaction-backfill.js +278 -0
- package/srv/blockchain/crawler/utxo-set-import.d.ts +66 -0
- package/srv/blockchain/crawler/utxo-set-import.js +399 -0
- package/srv/blockchain/ledger-state.d.ts +62 -0
- package/srv/blockchain/ledger-state.js +419 -0
- package/srv/blockchain/pending-spends.d.ts +16 -0
- package/srv/blockchain/pending-spends.js +81 -0
- package/srv/blockchain/pool-metadata.d.ts +15 -0
- package/srv/blockchain/pool-metadata.js +132 -0
- 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 +3 -17
- package/srv/blockchain/signing/cose-verifier.js +146 -70
- package/srv/blockchain/signing/external-signer.d.ts +15 -115
- package/srv/blockchain/signing/external-signer.js +17 -126
- package/srv/blockchain/signing/hsm-signer.d.ts +10 -54
- package/srv/blockchain/signing/hsm-signer.js +28 -79
- package/srv/blockchain/signing/signature-verifier.d.ts +9 -47
- package/srv/blockchain/signing/signature-verifier.js +70 -83
- package/srv/blockchain/signing/submission-finalizer.d.ts +23 -45
- package/srv/blockchain/signing/submission-finalizer.js +219 -86
- package/srv/blockchain/stored-chain.d.ts +20 -0
- package/srv/blockchain/stored-chain.js +237 -0
- package/srv/blockchain/transaction-building/buildooor-tx.d.ts +31 -229
- package/srv/blockchain/transaction-building/buildooor-tx.js +652 -416
- package/srv/blockchain/transaction-building/cardano-tx.d.ts +9 -37
- package/srv/blockchain/transaction-presence.d.ts +5 -0
- package/srv/blockchain/transaction-presence.js +29 -0
- package/srv/blockchain/transaction-rows.d.ts +12 -0
- package/srv/blockchain/transaction-rows.js +44 -0
- package/srv/blockchain/wallet-worker/build-request.d.ts +5 -20
- package/srv/blockchain/wallet-worker/build-request.js +47 -30
- package/srv/blockchain/wallet-worker/confirmation-tracker.d.ts +5 -46
- package/srv/blockchain/wallet-worker/confirmation-tracker.js +25 -45
- package/srv/blockchain/wallet-worker/index.d.ts +1 -1
- package/srv/blockchain/wallet-worker/index.js +3 -11
- package/srv/blockchain/wallet-worker/job-store.d.ts +30 -148
- package/srv/blockchain/wallet-worker/job-store.js +101 -201
- package/srv/blockchain/wallet-worker/lease-heartbeat.d.ts +2 -26
- package/srv/blockchain/wallet-worker/lease-heartbeat.js +6 -28
- package/srv/blockchain/wallet-worker/signers.d.ts +5 -24
- package/srv/blockchain/wallet-worker/signers.js +4 -12
- package/srv/blockchain/wallet-worker/wallet-worker.d.ts +8 -80
- package/srv/blockchain/wallet-worker/wallet-worker.js +107 -155
- package/srv/cardano-agent-service.cds +122 -84
- package/srv/cardano-agent-service.js +4 -9
- package/srv/cardano-backend-service.cds +78 -0
- package/srv/cardano-backend-service.d.ts +2 -0
- package/srv/cardano-backend-service.js +242 -0
- package/srv/cardano-indexer-service.cds +387 -73
- package/srv/cardano-indexer-service.d.ts +5 -1
- package/srv/cardano-indexer-service.js +532 -16
- package/srv/cardano-service.cds +424 -269
- package/srv/cardano-service.js +289 -201
- package/srv/cardano-sign-service.cds +201 -180
- package/srv/cardano-sign-service.js +71 -201
- package/srv/cardano-tx-service.cds +451 -370
- package/srv/cardano-tx-service.js +271 -289
- package/srv/cardano-ui.cds +16 -16
- package/srv/cardano-worker-service.cds +118 -125
- package/srv/cardano-worker-service.js +52 -61
- package/srv/cbor/cip68.d.ts +13 -0
- package/srv/cbor/cip68.js +56 -0
- package/srv/cbor/index.d.ts +3 -1
- package/srv/cbor/index.js +9 -1
- package/srv/cbor/parse.d.ts +30 -18
- package/srv/cbor/parse.js +44 -9
- package/srv/cbor/plutus-data-json.d.ts +20 -0
- package/srv/cbor/plutus-data-json.js +32 -0
- package/srv/config.d.ts +113 -0
- package/srv/config.js +409 -0
- package/srv/server.d.ts +15 -110
- package/srv/server.js +84 -404
- package/srv/utils/agent-access.d.ts +9 -0
- package/srv/utils/agent-access.js +67 -0
- package/srv/utils/agent-grants-config.d.ts +0 -46
- package/srv/utils/agent-grants-config.js +17 -85
- package/srv/utils/agent-grants.d.ts +106 -122
- package/srv/utils/agent-grants.js +538 -236
- package/srv/utils/agent-token-auth.d.ts +4 -99
- package/srv/utils/agent-token-auth.js +18 -182
- package/srv/utils/backend-request-handler.d.ts +3 -17
- package/srv/utils/backend-request-handler.js +3 -18
- package/srv/utils/collections.d.ts +3 -10
- package/srv/utils/collections.js +3 -10
- package/srv/utils/const.d.ts +23 -74
- package/srv/utils/const.js +32 -79
- package/srv/utils/crypto.d.ts +3 -12
- package/srv/utils/crypto.js +6 -21
- package/srv/utils/db-indexes.d.ts +27 -0
- package/srv/utils/db-indexes.js +120 -0
- package/srv/utils/db-sanitize.d.ts +20 -0
- package/srv/utils/db-sanitize.js +80 -0
- package/srv/utils/deep-json.d.ts +6 -0
- package/srv/utils/deep-json.js +240 -0
- package/srv/utils/epoch-slots.d.ts +13 -0
- package/srv/utils/epoch-slots.js +38 -0
- package/srv/utils/error-codes.d.ts +22 -75
- package/srv/utils/error-codes.js +23 -72
- package/srv/utils/errors.d.ts +46 -187
- package/srv/utils/errors.js +114 -230
- package/srv/utils/liveness.d.ts +12 -0
- package/srv/utils/liveness.js +35 -0
- package/srv/utils/mappers.d.ts +102 -223
- package/srv/utils/mappers.js +387 -316
- package/srv/utils/network-context.js +2 -13
- package/srv/utils/paging.d.ts +31 -0
- package/srv/utils/paging.js +43 -0
- package/srv/utils/pg-inline-json.d.ts +8 -0
- package/srv/utils/pg-inline-json.js +58 -0
- package/srv/utils/pg-order-nulls.d.ts +14 -0
- package/srv/utils/pg-order-nulls.js +54 -0
- package/srv/utils/plutus-placeholders.d.ts +16 -22
- package/srv/utils/plutus-placeholders.js +62 -33
- package/srv/utils/rate-limiter.d.ts +2 -21
- package/srv/utils/rate-limiter.js +5 -17
- package/srv/utils/readiness.d.ts +12 -0
- package/srv/utils/readiness.js +29 -0
- package/srv/utils/reference-script.d.ts +19 -0
- package/srv/utils/reference-script.js +84 -0
- package/srv/utils/result-numbers.d.ts +15 -0
- package/srv/utils/result-numbers.js +61 -0
- package/srv/utils/service-events.d.ts +0 -24
- package/srv/utils/service-events.js +3 -25
- package/srv/utils/signing-helper.d.ts +3 -20
- package/srv/utils/signing-helper.js +35 -64
- package/srv/utils/tx-build-helper.d.ts +10 -105
- package/srv/utils/tx-build-helper.js +81 -144
- package/srv/utils/tx-request-parsers.d.ts +82 -33
- package/srv/utils/tx-request-parsers.js +401 -49
- package/srv/utils/tx-utils.d.ts +3 -27
- package/srv/utils/tx-utils.js +32 -50
- package/srv/utils/types.d.ts +261 -191
- package/srv/utils/types.js +2 -6
- package/srv/utils/validators.d.ts +22 -92
- package/srv/utils/validators.js +50 -149
package/srv/utils/types.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SigningStatus = exports.ExternalSignerType = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Supported external signer types
|
|
6
|
-
*/
|
|
4
|
+
/** Supported external signer types */
|
|
7
5
|
var ExternalSignerType;
|
|
8
6
|
(function (ExternalSignerType) {
|
|
9
7
|
/** Cardano CLI - Reference implementation for signing */
|
|
@@ -17,9 +15,7 @@ var ExternalSignerType;
|
|
|
17
15
|
/** Hardware Security Module (server-side PKCS#11) */
|
|
18
16
|
ExternalSignerType["HSM"] = "hsm";
|
|
19
17
|
})(ExternalSignerType || (exports.ExternalSignerType = ExternalSignerType = {}));
|
|
20
|
-
/**
|
|
21
|
-
* Signing request status
|
|
22
|
-
*/
|
|
18
|
+
/** Signing request status */
|
|
23
19
|
var SigningStatus;
|
|
24
20
|
(function (SigningStatus) {
|
|
25
21
|
/** Request created, awaiting signing */
|
|
@@ -1,115 +1,50 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Result of JSON validation with limits
|
|
3
|
-
*/
|
|
1
|
+
/** Result of JSON validation with limits */
|
|
4
2
|
interface JsonValidationResult {
|
|
5
3
|
valid: boolean;
|
|
6
4
|
error?: string;
|
|
7
5
|
parsed?: unknown;
|
|
8
6
|
}
|
|
9
|
-
/**
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Transaction hash: 64-character hexadecimal string
|
|
18
|
-
* @param s - The raw value to validate against transaction hash format
|
|
19
|
-
* @returns { boolean } true if s is a valid transaction hash false otherwise
|
|
20
|
-
*/
|
|
7
|
+
/** Parse a JSON string under size and complexity limits (DoS prevention); `fieldName` is for messages. */
|
|
8
|
+
export declare function validateJsonWithLimits(jsonString: string, fieldName: string, maxDepth?: number): JsonValidationResult;
|
|
9
|
+
/** PlutusData JSON (redeemer, datum, script params): the same limits with PLUTUS_DATA_MAX_DEPTH. */
|
|
10
|
+
export declare function validatePlutusJson(jsonString: string, fieldName: string): JsonValidationResult;
|
|
11
|
+
/** Request fields that carry PlutusData JSON. */
|
|
12
|
+
export declare const PLUTUS_JSON_FIELDS: ReadonlySet<string>;
|
|
13
|
+
/** Transaction hash: 64-character hex string */
|
|
21
14
|
export declare function isTxHash(s: unknown): s is string;
|
|
22
|
-
/**
|
|
23
|
-
* Asset unit: concatenation of policy ID (56 hex chars) + asset name (0-128 hex chars)
|
|
24
|
-
* @param s - The raw value to validate against asset unit format
|
|
25
|
-
* @returns { boolean } true if v is a valid asset unit false otherwise
|
|
26
|
-
*/
|
|
15
|
+
/** Asset unit: policy ID (56 hex chars) + asset name (0-64 hex chars, even length) */
|
|
27
16
|
export declare function isAssetUnit(s: unknown): s is string;
|
|
28
|
-
/**
|
|
29
|
-
* Block hash: 64-character hexadecimal string
|
|
30
|
-
* @param s - The raw value to validate against block hash format
|
|
31
|
-
* @returns { boolean } true if s is a valid block hash false otherwise
|
|
32
|
-
*/
|
|
17
|
+
/** Block hash: 64-character hex string */
|
|
33
18
|
export declare function isBlockHash(s: unknown): s is string;
|
|
34
|
-
/**
|
|
35
|
-
* Payment credential: 28-byte hash (key hash or script hash) as 56-char lowercase hex.
|
|
36
|
-
* Used for credential-based UTxO queries (Indigo CDPs, Liqwid positions, etc.).
|
|
37
|
-
* @param s - The raw value to validate against credential format
|
|
38
|
-
* @returns { boolean } true if s is a valid 56-char lowercase hex string
|
|
39
|
-
*/
|
|
19
|
+
/** Payment credential: 28-byte key or script hash as 56-char lowercase hex (credential-keyed UTxO queries). */
|
|
40
20
|
export declare function isValidCredential(s: unknown): s is string;
|
|
41
|
-
/**
|
|
42
|
-
* Pool ID: must be bech32-decodable, HRP=pool, payload length 28 bytes.
|
|
43
|
-
* @param poolIdRaw - The raw value to validate against pool ID format
|
|
44
|
-
* @returns { boolean } true if valid pool ID false otherwise
|
|
45
|
-
*/
|
|
21
|
+
/** Pool ID: bech32 with HRP "pool" and a 28-byte payload. */
|
|
46
22
|
export declare function isValidPoolId(poolIdRaw: unknown): poolIdRaw is string;
|
|
47
|
-
/**
|
|
48
|
-
* DRep ID: must be bech32-decodable, HRP=drep.
|
|
49
|
-
* @param drepRaw - The raw value to validate against drep ID format
|
|
50
|
-
* @returns { boolean } true if valid drep ID false otherwise
|
|
51
|
-
*/
|
|
23
|
+
/** DRep ID: bech32 with HRP "drep" and a 29-byte payload. */
|
|
52
24
|
export declare function isValidDrepId(drepRaw: unknown): drepRaw is string;
|
|
53
|
-
/**
|
|
54
|
-
* Validate Bech32 address: must be bech32-decodable, HRP based on network config.
|
|
55
|
-
* @param addrRaw - The raw value to validate against bech32 address format
|
|
56
|
-
* @returns { boolean } true if valid bech32 address false otherwise
|
|
57
|
-
*/
|
|
25
|
+
/** Bech32 address with the HRP of the active network; false before the app context is ready. */
|
|
58
26
|
export declare function isValidBech32Address(addrRaw: unknown): addrRaw is string;
|
|
59
|
-
/**
|
|
60
|
-
* Validate Bech32 stake address: must be bech32-decodable, HRP based on network config.
|
|
61
|
-
* @param stakeRaw - The raw value to validate against stake address format
|
|
62
|
-
* @returns { boolean } true if valid bech32 stake address false otherwise
|
|
63
|
-
*/
|
|
27
|
+
/** Bech32 stake address with the HRP of the active network; false before the app context is ready. */
|
|
64
28
|
export declare function isValidBech32StakeAddress(stakeRaw: unknown): stakeRaw is string;
|
|
65
|
-
/**
|
|
66
|
-
* Epoch number: non-negative integer within reasonable bounds
|
|
67
|
-
* @param s - The parameter value to validate as epoch number
|
|
68
|
-
* @returns { boolean } true if s is a valid epoch number false otherwise
|
|
69
|
-
*/
|
|
29
|
+
/** Epoch number: non-negative integer up to MAX_EPOCH */
|
|
70
30
|
export declare function isEpochNumber(s: unknown): s is number;
|
|
71
|
-
/**
|
|
72
|
-
* Validate CBOR string: must be a non-empty even-length hexadecimal string
|
|
73
|
-
* @param cborRaw - The raw value to validate against CBOR format
|
|
74
|
-
* @returns { boolean } true if valid CBOR false otherwise
|
|
75
|
-
*/
|
|
31
|
+
/** CBOR hex: non-empty, even-length hex string */
|
|
76
32
|
export declare function isValidCbor(cborRaw: unknown): cborRaw is string;
|
|
77
|
-
/**
|
|
78
|
-
* Validate a transaction CBOR hex string for the ParseTransactionCbor action.
|
|
79
|
-
* Combines `isValidCbor` with a hard length limit to block memory-exhaustion
|
|
80
|
-
* attacks on the server-side CBOR parser.
|
|
81
|
-
* @param cborRaw - The raw value to validate
|
|
82
|
-
* @returns { boolean } true if valid hex AND within MAX_TX_CBOR_HEX_LENGTH
|
|
83
|
-
*/
|
|
33
|
+
/** `isValidCbor` plus the MAX_TX_CBOR_HEX_LENGTH cap (ParseTransactionCbor memory bound). */
|
|
84
34
|
export declare function isValidTxCborHex(cborRaw: unknown): cborRaw is string;
|
|
85
|
-
/**
|
|
86
|
-
* Extract the payment credential from a Shelley bech32 address.
|
|
87
|
-
* Returns the 28-byte credential hash (hex) plus whether it is a SCRIPT
|
|
88
|
-
* credential (address type bit 0 of the header high nibble), or null when the
|
|
89
|
-
* address cannot be decoded / carries no payment part (stake addresses).
|
|
90
|
-
*/
|
|
91
35
|
export declare function extractPaymentCredential(address: string): {
|
|
92
36
|
hash: string;
|
|
93
37
|
isScript: boolean;
|
|
94
38
|
} | null;
|
|
95
|
-
/**
|
|
96
|
-
* Validate an array of Ed25519 key hashes (hex, 28 bytes / 56 hex chars each).
|
|
97
|
-
* @param signers - The parsed JSON array to validate
|
|
98
|
-
* @returns validated string array
|
|
99
|
-
* @throws Error if any signer is invalid
|
|
100
|
-
*/
|
|
39
|
+
/** Validate an array of Ed25519 key hashes (56 hex chars each); throws on any invalid entry. */
|
|
101
40
|
export declare function validateRequiredSigners(signers: unknown): string[];
|
|
102
|
-
/**
|
|
103
|
-
* Validation error details for transaction input validation
|
|
104
|
-
*/
|
|
41
|
+
/** Validation error details for transaction input validation */
|
|
105
42
|
export interface ValidationError {
|
|
106
43
|
type: 'missing' | 'invalid';
|
|
107
44
|
field: string;
|
|
108
45
|
message: string;
|
|
109
46
|
}
|
|
110
|
-
/**
|
|
111
|
-
* Transaction input fields for validation
|
|
112
|
-
*/
|
|
47
|
+
/** Transaction input fields for validation */
|
|
113
48
|
export interface TransactionInputs {
|
|
114
49
|
senderAddress?: string;
|
|
115
50
|
recipientAddress?: string;
|
|
@@ -134,12 +69,7 @@ export interface TransactionInputs {
|
|
|
134
69
|
validityStartMs?: string;
|
|
135
70
|
validityEndMs?: string;
|
|
136
71
|
}
|
|
137
|
-
/**
|
|
138
|
-
* Validate transaction build inputs and return validation errors if any
|
|
139
|
-
* @param inputs - Transaction input fields to validate
|
|
140
|
-
* @param requiredFields - List of required field names
|
|
141
|
-
* @returns Array of validation errors, empty if all valid
|
|
142
|
-
*/
|
|
72
|
+
/** Validate transaction build inputs; returns the validation errors (empty when all valid). */
|
|
143
73
|
export declare function validateTransactionInputs(inputs: TransactionInputs, requiredFields: (keyof TransactionInputs)[]): ValidationError[];
|
|
144
74
|
export {};
|
|
145
75
|
//# sourceMappingURL=validators.d.ts.map
|
package/srv/utils/validators.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PLUTUS_JSON_FIELDS = void 0;
|
|
3
4
|
exports.validateJsonWithLimits = validateJsonWithLimits;
|
|
5
|
+
exports.validatePlutusJson = validatePlutusJson;
|
|
4
6
|
exports.isTxHash = isTxHash;
|
|
5
7
|
exports.isAssetUnit = isAssetUnit;
|
|
6
8
|
exports.isBlockHash = isBlockHash;
|
|
@@ -17,27 +19,16 @@ exports.validateRequiredSigners = validateRequiredSigners;
|
|
|
17
19
|
exports.validateTransactionInputs = validateTransactionInputs;
|
|
18
20
|
const bech32_1 = require("bech32");
|
|
19
21
|
const const_1 = require("./const");
|
|
20
|
-
//
|
|
21
|
-
// importing server here would pull the whole server → indexer graph (which
|
|
22
|
-
// accesses cds.ql at module load) into every consumer of a validator.
|
|
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
|
-
/**
|
|
25
|
-
* Safely trim a string value
|
|
26
|
-
* @param s - The value to trim
|
|
27
|
-
* @returns { string | null } trimmed string or null if input is not a string or empty after trim
|
|
28
|
-
*/
|
|
24
|
+
/** Trimmed string, or null when not a string or empty after trim. */
|
|
29
25
|
function safeTrimString(s) {
|
|
30
26
|
if (typeof s !== "string")
|
|
31
27
|
return null;
|
|
32
28
|
const t = s.trim();
|
|
33
29
|
return t.length > 0 ? t : null;
|
|
34
30
|
}
|
|
35
|
-
/**
|
|
36
|
-
* Strict bech32 decode with HRP allowlist.
|
|
37
|
-
* @param value - bech32 encoded string
|
|
38
|
-
* @param allowedHrp - list of allowed HRP prefixes
|
|
39
|
-
* @returns { prefix: string; words: number[] } decoded bech32 parts or null if invalid
|
|
40
|
-
*/
|
|
31
|
+
/** Strict bech32 decode with HRP allowlist; null when invalid. */
|
|
41
32
|
function tryDecodeBech32WithHrp(value, allowedHrp) {
|
|
42
33
|
try {
|
|
43
34
|
const decoded = bech32_1.bech32.decode(value, const_1.BECH32_MAX_LENGTH);
|
|
@@ -50,27 +41,16 @@ function tryDecodeBech32WithHrp(value, allowedHrp) {
|
|
|
50
41
|
return null;
|
|
51
42
|
}
|
|
52
43
|
}
|
|
53
|
-
/**
|
|
54
|
-
* Convert bech32 words to byte length
|
|
55
|
-
* @param words - bech32 decoded words
|
|
56
|
-
* @returns { number } byte length of decoded words
|
|
57
|
-
*/
|
|
44
|
+
/** Byte length of decoded bech32 words (fromWords validates the word range). */
|
|
58
45
|
function wordsToBytesLen(words) {
|
|
59
|
-
// bech32.fromWords validates word range and converts 5-bit words -> bytes
|
|
60
46
|
return Buffer.from(bech32_1.bech32.fromWords(words)).length;
|
|
61
47
|
}
|
|
62
|
-
/**
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
* @param fieldName - Name of the field (for error messages)
|
|
66
|
-
* @returns JsonValidationResult with parsed value or error message
|
|
67
|
-
*/
|
|
68
|
-
function validateJsonWithLimits(jsonString, fieldName) {
|
|
69
|
-
// Check size limit first (before parsing)
|
|
48
|
+
/** Parse a JSON string under size and complexity limits (DoS prevention); `fieldName` is for messages. */
|
|
49
|
+
function validateJsonWithLimits(jsonString, fieldName, maxDepth = const_1.MAX_DEPTH) {
|
|
50
|
+
// Size limit before parsing
|
|
70
51
|
if (jsonString.length > const_1.MAX_JSON_SIZE) {
|
|
71
52
|
return { valid: false, error: `${fieldName} exceeds maximum size of ${const_1.MAX_JSON_SIZE} bytes` };
|
|
72
53
|
}
|
|
73
|
-
// Parse JSON
|
|
74
54
|
let parsed;
|
|
75
55
|
try {
|
|
76
56
|
parsed = JSON.parse(jsonString);
|
|
@@ -78,105 +58,79 @@ function validateJsonWithLimits(jsonString, fieldName) {
|
|
|
78
58
|
catch {
|
|
79
59
|
return { valid: false, error: `Invalid JSON in ${fieldName}` };
|
|
80
60
|
}
|
|
81
|
-
|
|
82
|
-
const complexityError = checkJsonComplexity(parsed, 0);
|
|
61
|
+
const complexityError = checkJsonComplexity(parsed, 0, maxDepth);
|
|
83
62
|
if (complexityError) {
|
|
84
63
|
return { valid: false, error: `${fieldName}: ${complexityError}` };
|
|
85
64
|
}
|
|
86
65
|
return { valid: true, parsed };
|
|
87
66
|
}
|
|
88
|
-
/**
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
67
|
+
/** PlutusData JSON (redeemer, datum, script params): the same limits with PLUTUS_DATA_MAX_DEPTH. */
|
|
68
|
+
function validatePlutusJson(jsonString, fieldName) {
|
|
69
|
+
return validateJsonWithLimits(jsonString, fieldName, const_1.PLUTUS_DATA_MAX_DEPTH);
|
|
70
|
+
}
|
|
71
|
+
/** Request fields that carry PlutusData JSON. */
|
|
72
|
+
exports.PLUTUS_JSON_FIELDS = new Set([
|
|
73
|
+
'redeemerJson', 'datumJson', 'inlineDatumJson', 'outputDatumJson', 'mintRedeemerJson', 'scriptParamsJson',
|
|
74
|
+
]);
|
|
75
|
+
/** Recursive complexity check (depth, keys, array length, string length); error message or null. */
|
|
76
|
+
function checkJsonComplexity(value, depth, maxDepth) {
|
|
77
|
+
if (depth > maxDepth) {
|
|
78
|
+
return `Maximum nesting depth of ${maxDepth} exceeded`;
|
|
98
79
|
}
|
|
99
80
|
if (value === null || typeof value !== 'object') {
|
|
100
|
-
// Check string length for primitive strings
|
|
101
81
|
if (typeof value === 'string' && value.length > const_1.MAX_STRING_LENGTH) {
|
|
102
82
|
return `String value exceeds maximum length of ${const_1.MAX_STRING_LENGTH}`;
|
|
103
83
|
}
|
|
104
84
|
return null;
|
|
105
85
|
}
|
|
106
86
|
if (Array.isArray(value)) {
|
|
107
|
-
// Check array length
|
|
108
87
|
if (value.length > const_1.MAX_ARRAY_LENGTH) {
|
|
109
88
|
return `Array exceeds maximum length of ${const_1.MAX_ARRAY_LENGTH}`;
|
|
110
89
|
}
|
|
111
|
-
// Recursively check array elements
|
|
112
90
|
for (const item of value) {
|
|
113
|
-
const error = checkJsonComplexity(item, depth + 1);
|
|
91
|
+
const error = checkJsonComplexity(item, depth + 1, maxDepth);
|
|
114
92
|
if (error)
|
|
115
93
|
return error;
|
|
116
94
|
}
|
|
117
95
|
}
|
|
118
96
|
else {
|
|
119
|
-
// Check object key count
|
|
120
97
|
const keys = Object.keys(value);
|
|
121
98
|
if (keys.length > const_1.MAX_KEYS) {
|
|
122
99
|
return `Object exceeds maximum key count of ${const_1.MAX_KEYS}`;
|
|
123
100
|
}
|
|
124
|
-
// Recursively check object values
|
|
125
101
|
for (const key of keys) {
|
|
126
|
-
const error = checkJsonComplexity(value[key], depth + 1);
|
|
102
|
+
const error = checkJsonComplexity(value[key], depth + 1, maxDepth);
|
|
127
103
|
if (error)
|
|
128
104
|
return error;
|
|
129
105
|
}
|
|
130
106
|
}
|
|
131
107
|
return null;
|
|
132
108
|
}
|
|
133
|
-
/**
|
|
134
|
-
* Transaction hash: 64-character hexadecimal string
|
|
135
|
-
* @param s - The raw value to validate against transaction hash format
|
|
136
|
-
* @returns { boolean } true if s is a valid transaction hash false otherwise
|
|
137
|
-
*/
|
|
109
|
+
/** Transaction hash: 64-character hex string */
|
|
138
110
|
function isTxHash(s) {
|
|
139
111
|
return typeof s === "string" && const_1.TX_HASH_REGEX.test(s);
|
|
140
112
|
}
|
|
141
|
-
/**
|
|
142
|
-
* Asset unit: concatenation of policy ID (56 hex chars) + asset name (0-128 hex chars)
|
|
143
|
-
* @param s - The raw value to validate against asset unit format
|
|
144
|
-
* @returns { boolean } true if v is a valid asset unit false otherwise
|
|
145
|
-
*/
|
|
113
|
+
/** Asset unit: policy ID (56 hex chars) + asset name (0-64 hex chars, even length) */
|
|
146
114
|
function isAssetUnit(s) {
|
|
147
115
|
if (typeof s !== "string")
|
|
148
116
|
return false;
|
|
149
117
|
const t = s.trim();
|
|
150
|
-
// Regex ensures: 56-192 hex chars, even length, valid hex
|
|
151
118
|
return const_1.ASSET_UNIT_REGEX.test(t);
|
|
152
119
|
}
|
|
153
|
-
/**
|
|
154
|
-
* Block hash: 64-character hexadecimal string
|
|
155
|
-
* @param s - The raw value to validate against block hash format
|
|
156
|
-
* @returns { boolean } true if s is a valid block hash false otherwise
|
|
157
|
-
*/
|
|
120
|
+
/** Block hash: 64-character hex string */
|
|
158
121
|
function isBlockHash(s) {
|
|
159
122
|
return typeof s === "string" && const_1.HEX_64_REGEX.test(s);
|
|
160
123
|
}
|
|
161
|
-
/**
|
|
162
|
-
* Payment credential: 28-byte hash (key hash or script hash) as 56-char lowercase hex.
|
|
163
|
-
* Used for credential-based UTxO queries (Indigo CDPs, Liqwid positions, etc.).
|
|
164
|
-
* @param s - The raw value to validate against credential format
|
|
165
|
-
* @returns { boolean } true if s is a valid 56-char lowercase hex string
|
|
166
|
-
*/
|
|
124
|
+
/** Payment credential: 28-byte key or script hash as 56-char lowercase hex (credential-keyed UTxO queries). */
|
|
167
125
|
function isValidCredential(s) {
|
|
168
126
|
return typeof s === "string" && const_1.HEX_56_REGEX.test(s);
|
|
169
127
|
}
|
|
170
|
-
/**
|
|
171
|
-
* Pool ID: must be bech32-decodable, HRP=pool, payload length 28 bytes.
|
|
172
|
-
* @param poolIdRaw - The raw value to validate against pool ID format
|
|
173
|
-
* @returns { boolean } true if valid pool ID false otherwise
|
|
174
|
-
*/
|
|
128
|
+
/** Pool ID: bech32 with HRP "pool" and a 28-byte payload. */
|
|
175
129
|
function isValidPoolId(poolIdRaw) {
|
|
176
130
|
const poolId = safeTrimString(poolIdRaw);
|
|
177
131
|
if (!poolId)
|
|
178
132
|
return false;
|
|
179
|
-
//
|
|
133
|
+
// cheap prefilter
|
|
180
134
|
if (!const_1.POOL_ID_REGEX.test(poolId))
|
|
181
135
|
return false;
|
|
182
136
|
const decoded = tryDecodeBech32WithHrp(poolId, ["pool"]);
|
|
@@ -184,16 +138,12 @@ function isValidPoolId(poolIdRaw) {
|
|
|
184
138
|
return wordsToBytesLen(decoded.words) === const_1.POOL_ID_BYTES;
|
|
185
139
|
return false;
|
|
186
140
|
}
|
|
187
|
-
/**
|
|
188
|
-
* DRep ID: must be bech32-decodable, HRP=drep.
|
|
189
|
-
* @param drepRaw - The raw value to validate against drep ID format
|
|
190
|
-
* @returns { boolean } true if valid drep ID false otherwise
|
|
191
|
-
*/
|
|
141
|
+
/** DRep ID: bech32 with HRP "drep" and a 29-byte payload. */
|
|
192
142
|
function isValidDrepId(drepRaw) {
|
|
193
143
|
const drepId = safeTrimString(drepRaw);
|
|
194
144
|
if (!drepId)
|
|
195
145
|
return false;
|
|
196
|
-
//
|
|
146
|
+
// cheap prefilter
|
|
197
147
|
if (!const_1.DREP_ID_REGEX.test(drepId))
|
|
198
148
|
return false;
|
|
199
149
|
const decoded = tryDecodeBech32WithHrp(drepId, ["drep"]);
|
|
@@ -201,49 +151,36 @@ function isValidDrepId(drepRaw) {
|
|
|
201
151
|
return wordsToBytesLen(decoded.words) === const_1.DREP_ID_BYTES;
|
|
202
152
|
return false;
|
|
203
153
|
}
|
|
204
|
-
/**
|
|
205
|
-
* Validate Bech32 address: must be bech32-decodable, HRP based on network config.
|
|
206
|
-
* @param addrRaw - The raw value to validate against bech32 address format
|
|
207
|
-
* @returns { boolean } true if valid bech32 address false otherwise
|
|
208
|
-
*/
|
|
154
|
+
/** Bech32 address with the HRP of the active network; false before the app context is ready. */
|
|
209
155
|
function isValidBech32Address(addrRaw) {
|
|
210
156
|
const addr = safeTrimString(addrRaw);
|
|
211
157
|
if (!addr)
|
|
212
158
|
return false;
|
|
213
|
-
//
|
|
214
|
-
// ready yet (e.g., a backend init failure left it uninitialized) the network
|
|
215
|
-
// is null — return false so the handler responds with a clean 400 "Invalid
|
|
216
|
-
// bech32 address format" instead of leaking an init error to the client. The
|
|
217
|
-
// actual init failure is surfaced via stderr in server.ts.
|
|
159
|
+
// No network yet (app context not initialized): a clean 400 instead of a leaked init error
|
|
218
160
|
const network = (0, network_context_1.getActiveNetwork)();
|
|
219
161
|
if (!network)
|
|
220
162
|
return false;
|
|
221
|
-
//
|
|
163
|
+
// network HRP prefilter
|
|
222
164
|
if (!const_1.HRP[network].addr.test(addr))
|
|
223
165
|
return false;
|
|
224
166
|
const allowed = ["addr", "addr_test"];
|
|
225
167
|
const decoded = tryDecodeBech32WithHrp(addr, allowed);
|
|
226
168
|
if (decoded) {
|
|
227
|
-
//
|
|
169
|
+
// 29 bytes (enterprise/reward) to 57 bytes (base address)
|
|
228
170
|
const len = wordsToBytesLen(decoded.words);
|
|
229
171
|
return len >= 29 && len <= 57;
|
|
230
172
|
}
|
|
231
173
|
return false;
|
|
232
174
|
}
|
|
233
|
-
/**
|
|
234
|
-
* Validate Bech32 stake address: must be bech32-decodable, HRP based on network config.
|
|
235
|
-
* @param stakeRaw - The raw value to validate against stake address format
|
|
236
|
-
* @returns { boolean } true if valid bech32 stake address false otherwise
|
|
237
|
-
*/
|
|
175
|
+
/** Bech32 stake address with the HRP of the active network; false before the app context is ready. */
|
|
238
176
|
function isValidBech32StakeAddress(stakeRaw) {
|
|
239
177
|
const stake = safeTrimString(stakeRaw);
|
|
240
178
|
if (!stake)
|
|
241
179
|
return false;
|
|
242
|
-
// Defensive against unset app context — same rationale as isValidBech32Address.
|
|
243
180
|
const network = (0, network_context_1.getActiveNetwork)();
|
|
244
181
|
if (!network)
|
|
245
182
|
return false;
|
|
246
|
-
//
|
|
183
|
+
// network HRP prefilter
|
|
247
184
|
if (!const_1.HRP[network].stake.test(stake))
|
|
248
185
|
return false;
|
|
249
186
|
const allowed = ["stake", "stake_test"];
|
|
@@ -253,44 +190,25 @@ function isValidBech32StakeAddress(stakeRaw) {
|
|
|
253
190
|
const len = wordsToBytesLen(decoded.words);
|
|
254
191
|
return len >= 1 && len <= 64;
|
|
255
192
|
}
|
|
256
|
-
/**
|
|
257
|
-
* Epoch number: non-negative integer within reasonable bounds
|
|
258
|
-
* @param s - The parameter value to validate as epoch number
|
|
259
|
-
* @returns { boolean } true if s is a valid epoch number false otherwise
|
|
260
|
-
*/
|
|
193
|
+
/** Epoch number: non-negative integer up to MAX_EPOCH */
|
|
261
194
|
function isEpochNumber(s) {
|
|
262
195
|
return typeof s === "number" && s >= 0 && s <= const_1.MAX_EPOCH && Number.isInteger(s);
|
|
263
196
|
}
|
|
264
|
-
/**
|
|
265
|
-
* Validate CBOR string: must be a non-empty even-length hexadecimal string
|
|
266
|
-
* @param cborRaw - The raw value to validate against CBOR format
|
|
267
|
-
* @returns { boolean } true if valid CBOR false otherwise
|
|
268
|
-
*/
|
|
197
|
+
/** CBOR hex: non-empty, even-length hex string */
|
|
269
198
|
function isValidCbor(cborRaw) {
|
|
270
199
|
const cbor = safeTrimString(cborRaw);
|
|
271
200
|
if (!cbor)
|
|
272
201
|
return false;
|
|
273
|
-
// basic validation: must be even-length hex string
|
|
274
202
|
return /^[a-f0-9]+$/i.test(cbor) && cbor.length % 2 === 0;
|
|
275
203
|
}
|
|
276
|
-
/**
|
|
277
|
-
* Validate a transaction CBOR hex string for the ParseTransactionCbor action.
|
|
278
|
-
* Combines `isValidCbor` with a hard length limit to block memory-exhaustion
|
|
279
|
-
* attacks on the server-side CBOR parser.
|
|
280
|
-
* @param cborRaw - The raw value to validate
|
|
281
|
-
* @returns { boolean } true if valid hex AND within MAX_TX_CBOR_HEX_LENGTH
|
|
282
|
-
*/
|
|
204
|
+
/** `isValidCbor` plus the MAX_TX_CBOR_HEX_LENGTH cap (ParseTransactionCbor memory bound). */
|
|
283
205
|
function isValidTxCborHex(cborRaw) {
|
|
284
206
|
if (!isValidCbor(cborRaw))
|
|
285
207
|
return false;
|
|
286
208
|
return cborRaw.trim().length <= const_1.MAX_TX_CBOR_HEX_LENGTH;
|
|
287
209
|
}
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
* Returns the 28-byte credential hash (hex) plus whether it is a SCRIPT
|
|
291
|
-
* credential (address type bit 0 of the header high nibble), or null when the
|
|
292
|
-
* address cannot be decoded / carries no payment part (stake addresses).
|
|
293
|
-
*/
|
|
210
|
+
// Payment credential hash of a Shelley address and whether it is a script credential.
|
|
211
|
+
// Null for undecodable or stake addresses.
|
|
294
212
|
function extractPaymentCredential(address) {
|
|
295
213
|
try {
|
|
296
214
|
const decoded = bech32_1.bech32.decode(address, const_1.BECH32_MAX_LENGTH);
|
|
@@ -311,12 +229,7 @@ function extractPaymentCredential(address) {
|
|
|
311
229
|
return null;
|
|
312
230
|
}
|
|
313
231
|
}
|
|
314
|
-
/**
|
|
315
|
-
* Validate an array of Ed25519 key hashes (hex, 28 bytes / 56 hex chars each).
|
|
316
|
-
* @param signers - The parsed JSON array to validate
|
|
317
|
-
* @returns validated string array
|
|
318
|
-
* @throws Error if any signer is invalid
|
|
319
|
-
*/
|
|
232
|
+
/** Validate an array of Ed25519 key hashes (56 hex chars each); throws on any invalid entry. */
|
|
320
233
|
function validateRequiredSigners(signers) {
|
|
321
234
|
if (!Array.isArray(signers)) {
|
|
322
235
|
throw new Error('requiredSignersJson must be a JSON array');
|
|
@@ -328,15 +241,9 @@ function validateRequiredSigners(signers) {
|
|
|
328
241
|
}
|
|
329
242
|
return signers;
|
|
330
243
|
}
|
|
331
|
-
/**
|
|
332
|
-
* Validate transaction build inputs and return validation errors if any
|
|
333
|
-
* @param inputs - Transaction input fields to validate
|
|
334
|
-
* @param requiredFields - List of required field names
|
|
335
|
-
* @returns Array of validation errors, empty if all valid
|
|
336
|
-
*/
|
|
244
|
+
/** Validate transaction build inputs; returns the validation errors (empty when all valid). */
|
|
337
245
|
function validateTransactionInputs(inputs, requiredFields) {
|
|
338
246
|
const errors = [];
|
|
339
|
-
// Check required fields
|
|
340
247
|
for (const field of requiredFields) {
|
|
341
248
|
if (inputs[field] === undefined || inputs[field] === null || inputs[field] === '') {
|
|
342
249
|
errors.push({
|
|
@@ -346,10 +253,8 @@ function validateTransactionInputs(inputs, requiredFields) {
|
|
|
346
253
|
});
|
|
347
254
|
}
|
|
348
255
|
}
|
|
349
|
-
// If required fields are missing, return early
|
|
350
256
|
if (errors.length > 0)
|
|
351
257
|
return errors;
|
|
352
|
-
// Validate address formats
|
|
353
258
|
if (inputs.senderAddress && !isValidBech32Address(inputs.senderAddress)) {
|
|
354
259
|
errors.push({
|
|
355
260
|
type: 'invalid',
|
|
@@ -371,7 +276,7 @@ function validateTransactionInputs(inputs, requiredFields) {
|
|
|
371
276
|
message: 'Invalid change address format'
|
|
372
277
|
});
|
|
373
278
|
}
|
|
374
|
-
//
|
|
279
|
+
// String-based positive-integer check avoids precision loss for large values
|
|
375
280
|
if (inputs.lovelaceAmount !== undefined && inputs.lovelaceAmount !== null) {
|
|
376
281
|
const s = String(inputs.lovelaceAmount);
|
|
377
282
|
if (!/^\d+$/.test(s) || s === '0') {
|
|
@@ -382,7 +287,7 @@ function validateTransactionInputs(inputs, requiredFields) {
|
|
|
382
287
|
});
|
|
383
288
|
}
|
|
384
289
|
}
|
|
385
|
-
//
|
|
290
|
+
// 65536 hex chars = 32 KB binary
|
|
386
291
|
const MAX_CBOR_HEX_LENGTH = 65536;
|
|
387
292
|
if (inputs.signedTxCbor && !isValidCbor(inputs.signedTxCbor)) {
|
|
388
293
|
errors.push({
|
|
@@ -435,7 +340,6 @@ function validateTransactionInputs(inputs, requiredFields) {
|
|
|
435
340
|
});
|
|
436
341
|
}
|
|
437
342
|
}
|
|
438
|
-
// Validate JSON fields with size and complexity limits
|
|
439
343
|
if (inputs.metadataJson) {
|
|
440
344
|
const result = validateJsonWithLimits(inputs.metadataJson, 'metadataJson');
|
|
441
345
|
if (!result.valid) {
|
|
@@ -467,7 +371,7 @@ function validateTransactionInputs(inputs, requiredFields) {
|
|
|
467
371
|
}
|
|
468
372
|
}
|
|
469
373
|
if (inputs.redeemerJson) {
|
|
470
|
-
const result =
|
|
374
|
+
const result = validatePlutusJson(inputs.redeemerJson, 'redeemerJson');
|
|
471
375
|
if (!result.valid) {
|
|
472
376
|
errors.push({
|
|
473
377
|
type: 'invalid',
|
|
@@ -477,7 +381,7 @@ function validateTransactionInputs(inputs, requiredFields) {
|
|
|
477
381
|
}
|
|
478
382
|
}
|
|
479
383
|
if (inputs.datumJson) {
|
|
480
|
-
const result =
|
|
384
|
+
const result = validatePlutusJson(inputs.datumJson, 'datumJson');
|
|
481
385
|
if (!result.valid) {
|
|
482
386
|
errors.push({
|
|
483
387
|
type: 'invalid',
|
|
@@ -503,10 +407,7 @@ function validateTransactionInputs(inputs, requiredFields) {
|
|
|
503
407
|
}
|
|
504
408
|
return errors;
|
|
505
409
|
}
|
|
506
|
-
/**
|
|
507
|
-
* Validate a Posix-ms string field: must be a non-negative integer with at most
|
|
508
|
-
* MAX_POSIX_MS_DIGITS digits. Returns null if valid or absent.
|
|
509
|
-
*/
|
|
410
|
+
/** Posix-ms string field: non-negative integer with at most MAX_POSIX_MS_DIGITS digits; null when valid or absent. */
|
|
510
411
|
function validatePosixMsField(value, field) {
|
|
511
412
|
if (value === undefined || value === null || value === '')
|
|
512
413
|
return null;
|