@odatano/core 2.0.0-rc.19 → 2.0.0-rc.20
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 +1 -5
- package/@cds-models/CardanoIndexerService/index.d.ts +51 -2
- package/@cds-models/CardanoIndexerService/index.js +7 -0
- package/package.json +1 -1
- package/src/index.d.ts +4 -10
- package/src/index.js +6 -16
- package/src/plugin.js +11 -27
- package/srv/blockchain/backends/blockfrost-backend.d.ts +29 -131
- package/srv/blockchain/backends/blockfrost-backend.js +39 -150
- package/srv/blockchain/backends/cardano-backend.d.ts +53 -171
- package/srv/blockchain/backends/cardano-backend.js +1 -5
- package/srv/blockchain/backends/koios-backend.d.ts +26 -71
- package/srv/blockchain/backends/koios-backend.js +50 -132
- package/srv/blockchain/backends/ogmios-backend.d.ts +43 -124
- package/srv/blockchain/backends/ogmios-backend.js +71 -179
- package/srv/blockchain/backends/ogmios-frame-guard.d.ts +12 -57
- package/srv/blockchain/backends/ogmios-frame-guard.js +27 -66
- package/srv/blockchain/cardano-client.d.ts +43 -216
- package/srv/blockchain/cardano-client.js +49 -234
- package/srv/blockchain/cardano-indexer.d.ts +79 -357
- package/srv/blockchain/cardano-indexer.js +98 -406
- package/srv/blockchain/cardano-tx-builder.d.ts +19 -84
- package/srv/blockchain/cardano-tx-builder.js +21 -107
- package/srv/blockchain/crawler/certificate-backfill.d.ts +45 -0
- package/srv/blockchain/crawler/certificate-backfill.js +150 -0
- package/srv/blockchain/crawler/crawler.d.ts +41 -145
- package/srv/blockchain/crawler/crawler.js +57 -172
- package/srv/blockchain/crawler/hooks.d.ts +3 -14
- package/srv/blockchain/crawler/index.d.ts +2 -6
- package/srv/blockchain/crawler/index.js +4 -9
- package/srv/blockchain/crawler/sync-state.d.ts +17 -39
- package/srv/blockchain/crawler/sync-state.js +23 -55
- package/srv/blockchain/crawler/utxo-set-import.d.ts +5 -22
- package/srv/blockchain/crawler/utxo-set-import.js +8 -28
- package/srv/blockchain/ledger-state.d.ts +3 -12
- package/srv/blockchain/signing/cose-verifier.d.ts +5 -12
- package/srv/blockchain/signing/cose-verifier.js +6 -12
- package/srv/blockchain/signing/external-signer.d.ts +16 -113
- package/srv/blockchain/signing/external-signer.js +19 -122
- package/srv/blockchain/signing/hsm-signer.d.ts +13 -45
- package/srv/blockchain/signing/hsm-signer.js +23 -63
- package/srv/blockchain/signing/signature-verifier.d.ts +8 -44
- package/srv/blockchain/signing/signature-verifier.js +13 -54
- package/srv/blockchain/signing/submission-finalizer.d.ts +9 -36
- package/srv/blockchain/signing/submission-finalizer.js +16 -48
- package/srv/blockchain/transaction-building/buildooor-tx.d.ts +65 -174
- package/srv/blockchain/transaction-building/buildooor-tx.js +107 -266
- package/srv/blockchain/transaction-building/cardano-tx.d.ts +8 -34
- package/srv/blockchain/wallet-worker/build-request.d.ts +4 -17
- package/srv/blockchain/wallet-worker/build-request.js +9 -22
- package/srv/blockchain/wallet-worker/confirmation-tracker.d.ts +12 -35
- package/srv/blockchain/wallet-worker/confirmation-tracker.js +16 -32
- package/srv/blockchain/wallet-worker/index.js +2 -8
- package/srv/blockchain/wallet-worker/job-store.d.ts +33 -111
- package/srv/blockchain/wallet-worker/job-store.js +0 -0
- package/srv/blockchain/wallet-worker/lease-heartbeat.d.ts +4 -20
- package/srv/blockchain/wallet-worker/lease-heartbeat.js +4 -20
- package/srv/blockchain/wallet-worker/signers.d.ts +6 -19
- package/srv/blockchain/wallet-worker/signers.js +3 -8
- package/srv/blockchain/wallet-worker/wallet-worker.d.ts +15 -71
- package/srv/blockchain/wallet-worker/wallet-worker.js +34 -90
- package/srv/cardano-agent-service.cds +1 -5
- package/srv/cardano-agent-service.js +3 -7
- package/srv/cardano-indexer-service.cds +32 -4
- package/srv/cardano-indexer-service.js +83 -15
- package/srv/cardano-service.js +36 -98
- package/srv/cardano-sign-service.cds +1 -1
- package/srv/cardano-sign-service.js +55 -173
- package/srv/cardano-tx-service.cds +1 -1
- package/srv/cardano-tx-service.js +54 -174
- package/srv/cardano-worker-service.js +7 -15
- package/srv/server.d.ts +27 -86
- package/srv/server.js +52 -148
- package/srv/utils/agent-grants-config.d.ts +11 -50
- package/srv/utils/agent-grants-config.js +12 -45
- package/srv/utils/agent-grants.d.ts +34 -123
- package/srv/utils/agent-grants.js +57 -156
- package/srv/utils/agent-token-auth.d.ts +2 -5
- package/srv/utils/agent-token-auth.js +2 -5
- package/srv/utils/backend-request-handler.d.ts +2 -16
- package/srv/utils/backend-request-handler.js +3 -18
- package/srv/utils/collections.d.ts +4 -8
- package/srv/utils/collections.js +4 -8
- package/srv/utils/const.d.ts +19 -68
- package/srv/utils/const.js +20 -69
- package/srv/utils/crypto.d.ts +3 -12
- package/srv/utils/crypto.js +5 -18
- package/srv/utils/db-indexes.d.ts +2 -7
- package/srv/utils/db-indexes.js +7 -34
- package/srv/utils/db-sanitize.d.ts +5 -18
- package/srv/utils/db-sanitize.js +6 -19
- package/srv/utils/error-codes.d.ts +18 -73
- package/srv/utils/error-codes.js +17 -70
- package/srv/utils/errors.d.ts +29 -191
- package/srv/utils/errors.js +44 -229
- package/srv/utils/liveness.d.ts +2 -9
- package/srv/utils/liveness.js +3 -11
- package/srv/utils/mappers.d.ts +50 -298
- package/srv/utils/mappers.js +80 -386
- package/srv/utils/network-context.js +2 -11
- package/srv/utils/pg-order-nulls.js +4 -23
- package/srv/utils/plutus-placeholders.d.ts +6 -18
- package/srv/utils/plutus-placeholders.js +6 -20
- package/srv/utils/rate-limiter.d.ts +6 -17
- package/srv/utils/rate-limiter.js +5 -15
- package/srv/utils/service-events.d.ts +2 -22
- package/srv/utils/service-events.js +3 -23
- package/srv/utils/signing-helper.d.ts +3 -18
- package/srv/utils/signing-helper.js +10 -32
- package/srv/utils/tx-build-helper.d.ts +18 -92
- package/srv/utils/tx-build-helper.js +32 -123
- package/srv/utils/tx-request-parsers.d.ts +7 -26
- package/srv/utils/tx-request-parsers.js +7 -26
- package/srv/utils/tx-utils.d.ts +4 -23
- package/srv/utils/tx-utils.js +12 -41
- package/srv/utils/types.d.ts +67 -206
- package/srv/utils/types.js +2 -6
- package/srv/utils/validators.d.ts +19 -89
- package/srv/utils/validators.js +31 -138
package/srv/utils/types.d.ts
CHANGED
|
@@ -1,30 +1,18 @@
|
|
|
1
1
|
import { LedgerProtocolParameter } from "#cds-models/odatano/cardano";
|
|
2
|
-
/**
|
|
3
|
-
* Hex-encoded string (lower/upper-case depending on source)
|
|
4
|
-
*/
|
|
2
|
+
/** Hex-encoded string (case depends on source) */
|
|
5
3
|
export type Hex = string;
|
|
6
|
-
/**
|
|
7
|
-
* Lovelace amount (integer) - represented as string to preserve precision for values > Number.MAX_SAFE_INTEGER.
|
|
8
|
-
* Cardano max supply = 45B ADA = 45,000,000,000,000,000 lovelace (exceeds MAX_SAFE_INTEGER).
|
|
9
|
-
* Provider APIs (Blockfrost, Koios) return lovelace as strings. Harmonic Labs uses bigint internally.
|
|
10
|
-
*/
|
|
4
|
+
/** Lovelace amount; a string preserves precision above Number.MAX_SAFE_INTEGER (max supply is 4.5e16). */
|
|
11
5
|
export type Lovelace = number | string;
|
|
12
|
-
/**
|
|
13
|
-
* JSON Value Type - Represents any valid JSON value
|
|
14
|
-
*/
|
|
6
|
+
/** Any valid JSON value */
|
|
15
7
|
export type JSONValue = string | number | boolean | {
|
|
16
8
|
[key: string]: JSONValue;
|
|
17
9
|
} | JSONValue[] | null;
|
|
18
|
-
/**
|
|
19
|
-
* Amount Data Structure Type - Multi-asset amount line as returned by common Cardano APIs
|
|
20
|
-
*/
|
|
10
|
+
/** Multi-asset amount line as returned by common Cardano APIs */
|
|
21
11
|
export interface Amount {
|
|
22
12
|
unit: string;
|
|
23
13
|
quantity: string;
|
|
24
14
|
}
|
|
25
|
-
/**
|
|
26
|
-
* Transaction Input Data Structure Type
|
|
27
|
-
*/
|
|
15
|
+
/** Transaction input */
|
|
28
16
|
export interface TxInputLine {
|
|
29
17
|
address: string;
|
|
30
18
|
amount: Amount[];
|
|
@@ -36,9 +24,7 @@ export interface TxInputLine {
|
|
|
36
24
|
isCollateral?: boolean;
|
|
37
25
|
isReference?: boolean;
|
|
38
26
|
}
|
|
39
|
-
/**
|
|
40
|
-
* Transaction Output Data Structure Type
|
|
41
|
-
*/
|
|
27
|
+
/** Transaction output */
|
|
42
28
|
export interface TxOutputLine {
|
|
43
29
|
address: string;
|
|
44
30
|
amount: Amount[];
|
|
@@ -50,11 +36,8 @@ export interface TxOutputLine {
|
|
|
50
36
|
referenceScriptHash?: Hex | null;
|
|
51
37
|
}
|
|
52
38
|
/**
|
|
53
|
-
* Normalized certificate kinds
|
|
54
|
-
*
|
|
55
|
-
* A Conway stake+vote delegation is SPLIT into a `pool_delegation` and a `vote_delegation`
|
|
56
|
-
* entry sharing one `certIndex` — Koios (db-sync) reports it that way natively, the
|
|
57
|
-
* Ogmios mapper splits to match, so both sources yield identical rows.
|
|
39
|
+
* Normalized certificate kinds; unknown types pass through as the raw source string. A Conway
|
|
40
|
+
* stake+vote delegation is split into `pool_delegation` + `vote_delegation` sharing one `certIndex`.
|
|
58
41
|
*/
|
|
59
42
|
export type CertificateKind = 'stake_registration' | 'stake_deregistration' | 'pool_delegation' | 'vote_delegation' | 'pool_registration' | 'pool_retirement' | 'drep_registration' | 'drep_update' | 'drep_retirement' | 'committee_hot_auth' | 'committee_resign' | 'genesis_delegation' | 'treasury_mir' | 'reserve_mir' | 'pot_transfer' | 'param_proposal' | (string & {});
|
|
60
43
|
/** One certificate of a transaction (crawler ledger-state coverage). */
|
|
@@ -79,42 +62,29 @@ export interface TxWithdrawal {
|
|
|
79
62
|
/** Lovelace as string. */
|
|
80
63
|
amount: Lovelace | string;
|
|
81
64
|
}
|
|
82
|
-
/**
|
|
83
|
-
* Transaction Data Structure Type - Normalized transaction structure
|
|
84
|
-
*/
|
|
65
|
+
/** Normalized transaction */
|
|
85
66
|
export interface Transaction {
|
|
86
67
|
hash: Hex;
|
|
87
68
|
blockHash: Hex;
|
|
88
69
|
blockHeight: number;
|
|
89
70
|
slot: number;
|
|
90
71
|
index: number;
|
|
91
|
-
/**
|
|
92
|
-
* What the ledger charged. For an ordinary transaction that is the fee declared in the
|
|
93
|
-
* body; for a phase-2 failure (`spendsCollaterals`) it is the collateral consumed, which
|
|
94
|
-
* is what the sender actually paid — the declared fee was never collected.
|
|
95
|
-
*/
|
|
72
|
+
/** What the ledger charged: the declared fee, or on a phase-2 failure the collateral consumed. */
|
|
96
73
|
fee: Lovelace | string;
|
|
97
74
|
deposit: Lovelace | string;
|
|
98
75
|
/**
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
* only the collateral return was produced. Reported by the Ogmios chain-sync path
|
|
102
|
-
* (`spends`) and by Blockfrost (`valid_contract`); Koios leaves it undefined.
|
|
76
|
+
* True when phase-2 failed: inputs/outputs not applied, collateral consumed, only the collateral
|
|
77
|
+
* return produced. Ogmios (`spends`) and Blockfrost (`valid_contract`) report it; Koios leaves it undefined.
|
|
103
78
|
*/
|
|
104
79
|
spendsCollaterals?: boolean;
|
|
105
80
|
/**
|
|
106
|
-
* `total_collateral` from the
|
|
107
|
-
*
|
|
108
|
-
* phase-2 failure without resolving a single input. Null when the body omits it — the
|
|
109
|
-
* charge then has to be derived from the resolved collateral inputs minus the return.
|
|
81
|
+
* `total_collateral` from the body when declared; equals the collateral consumed on a phase-2 failure.
|
|
82
|
+
* Null when omitted, the charge is then derived from the resolved collateral inputs minus the return.
|
|
110
83
|
*/
|
|
111
84
|
totalCollateral?: Lovelace | string | null;
|
|
112
85
|
/**
|
|
113
|
-
*
|
|
114
|
-
*
|
|
115
|
-
* such field and leaves it undefined, so the indexer derives the delta from the transaction's
|
|
116
|
-
* (fully resolved) input and output assets instead — which needs `isReference`/`isCollateral`
|
|
117
|
-
* and `spendsCollaterals` to be set on that path too. Never carries `lovelace`.
|
|
86
|
+
* Signed net mint/burn per unit (negative = burn), never `lovelace`. Ogmios and Koios report it;
|
|
87
|
+
* Blockfrost leaves it undefined and the indexer derives it from resolved input/output assets.
|
|
118
88
|
*/
|
|
119
89
|
mint?: Amount[];
|
|
120
90
|
/** Tx size in bytes; null when the source cannot provide it (Ogmios chain-sync). */
|
|
@@ -124,18 +94,12 @@ export interface Transaction {
|
|
|
124
94
|
inputs: TxInputLine[];
|
|
125
95
|
outputs: TxOutputLine[];
|
|
126
96
|
metadata?: MetadataLabelTx[];
|
|
127
|
-
/**
|
|
128
|
-
* Certificates as the source reports them; `[]` when the transaction carries none,
|
|
129
|
-
* undefined when the source does not report the field at all (Blockfrost — a per-tx
|
|
130
|
-
* enumeration would cost six extra calls per transaction, so it stays unreported there).
|
|
131
|
-
*/
|
|
97
|
+
/** Certificates; `[]` when the tx has none, undefined when the source does not report them (Blockfrost). */
|
|
132
98
|
certificates?: TxCertificate[];
|
|
133
99
|
/** Reward-account withdrawals; same `[]` vs undefined convention as `certificates`. */
|
|
134
100
|
withdrawals?: TxWithdrawal[];
|
|
135
101
|
}
|
|
136
|
-
/**
|
|
137
|
-
* Address Data Structure Type - Address view, including current value and known UTxOs
|
|
138
|
-
*/
|
|
102
|
+
/** Address view with current value and known UTxOs */
|
|
139
103
|
export interface Address {
|
|
140
104
|
address: string;
|
|
141
105
|
stakeAddress: string | null;
|
|
@@ -145,9 +109,7 @@ export interface Address {
|
|
|
145
109
|
utxos: UTxO[];
|
|
146
110
|
transactions?: Transaction[];
|
|
147
111
|
}
|
|
148
|
-
/**
|
|
149
|
-
* UTxO Data Structure Type - Unspent transaction outputs (UTxOs)
|
|
150
|
-
*/
|
|
112
|
+
/** Unspent transaction output */
|
|
151
113
|
export interface UTxO {
|
|
152
114
|
txHash: Hex;
|
|
153
115
|
outputIndex: number;
|
|
@@ -158,9 +120,7 @@ export interface UTxO {
|
|
|
158
120
|
scriptRef?: Hex | null;
|
|
159
121
|
inlineDatum?: string | null;
|
|
160
122
|
}
|
|
161
|
-
/**
|
|
162
|
-
* Block Data Structure Type - Basic block information structure
|
|
163
|
-
*/
|
|
123
|
+
/** Basic block information */
|
|
164
124
|
export interface BlockData {
|
|
165
125
|
time: number;
|
|
166
126
|
height: number | null;
|
|
@@ -173,9 +133,7 @@ export interface BlockData {
|
|
|
173
133
|
txCount: number;
|
|
174
134
|
fees?: string | null;
|
|
175
135
|
}
|
|
176
|
-
/**
|
|
177
|
-
* Supply Data Structure Type - Network supply information
|
|
178
|
-
*/
|
|
136
|
+
/** Network supply */
|
|
179
137
|
export interface Supply {
|
|
180
138
|
max: string;
|
|
181
139
|
total: string;
|
|
@@ -184,23 +142,17 @@ export interface Supply {
|
|
|
184
142
|
treasury: string;
|
|
185
143
|
reserves: string;
|
|
186
144
|
}
|
|
187
|
-
/**
|
|
188
|
-
* Stake Data Structure Type - Network stake information
|
|
189
|
-
*/
|
|
145
|
+
/** Network stake */
|
|
190
146
|
export interface Stake {
|
|
191
147
|
live: string;
|
|
192
148
|
active: string;
|
|
193
149
|
}
|
|
194
|
-
/**
|
|
195
|
-
* Network Information Data Structure Type - Network supply and stake information
|
|
196
|
-
*/
|
|
150
|
+
/** Network supply and stake */
|
|
197
151
|
export interface NetworkInformation {
|
|
198
152
|
supply: Supply;
|
|
199
153
|
stake: Stake;
|
|
200
154
|
}
|
|
201
|
-
/**
|
|
202
|
-
* Epoch Data Structure Type - Epoch information
|
|
203
|
-
*/
|
|
155
|
+
/** Epoch information */
|
|
204
156
|
export interface EpochData {
|
|
205
157
|
epoch: number;
|
|
206
158
|
start_time: number;
|
|
@@ -213,17 +165,13 @@ export interface EpochData {
|
|
|
213
165
|
fees: string;
|
|
214
166
|
active_stake: string | null;
|
|
215
167
|
}
|
|
216
|
-
/**
|
|
217
|
-
* Metadata Label Transaction Data Structure Type - Transaction metadata under a specific label
|
|
218
|
-
*/
|
|
168
|
+
/** Transaction metadata under one label */
|
|
219
169
|
export interface MetadataLabelTx {
|
|
220
170
|
txHash: Hex;
|
|
221
171
|
label: number | string;
|
|
222
172
|
json?: JSONValue;
|
|
223
173
|
}
|
|
224
|
-
/**
|
|
225
|
-
* Account Data Structure Type - Stake account information
|
|
226
|
-
*/
|
|
174
|
+
/** Stake account information */
|
|
227
175
|
export interface AccountData {
|
|
228
176
|
stakeaddress: string;
|
|
229
177
|
active: boolean;
|
|
@@ -238,9 +186,7 @@ export interface AccountData {
|
|
|
238
186
|
drepId: string | null;
|
|
239
187
|
addresses: Address[];
|
|
240
188
|
}
|
|
241
|
-
/**
|
|
242
|
-
* Pool Data Structure Type - Pool information
|
|
243
|
-
*/
|
|
189
|
+
/** Pool information */
|
|
244
190
|
export interface PoolData {
|
|
245
191
|
poolId: string;
|
|
246
192
|
vrfKeyHash: string;
|
|
@@ -259,9 +205,7 @@ export interface PoolData {
|
|
|
259
205
|
fixedCost: string;
|
|
260
206
|
rewardAccount: string;
|
|
261
207
|
}
|
|
262
|
-
/**
|
|
263
|
-
* Drep Data Structure Type - Drep information
|
|
264
|
-
*/
|
|
208
|
+
/** DRep information */
|
|
265
209
|
export interface DrepData {
|
|
266
210
|
drepId: string;
|
|
267
211
|
hex: string;
|
|
@@ -271,11 +215,7 @@ export interface DrepData {
|
|
|
271
215
|
retired: boolean;
|
|
272
216
|
expired: boolean;
|
|
273
217
|
}
|
|
274
|
-
/**
|
|
275
|
-
* Asset Info Data Structure Type - Normalized native-asset metadata + supply.
|
|
276
|
-
* Backends provide overlapping but non-identical fields; the mapper produces
|
|
277
|
-
* this canonical shape. Fields that one backend doesn't expose are null.
|
|
278
|
-
*/
|
|
218
|
+
/** Normalized native-asset metadata and supply; fields a backend does not expose are null. */
|
|
279
219
|
export interface AssetInfo {
|
|
280
220
|
unit: string;
|
|
281
221
|
policyId: string;
|
|
@@ -294,10 +234,7 @@ export interface AssetInfo {
|
|
|
294
234
|
registryUrl: string | null;
|
|
295
235
|
registryLogo: string | null;
|
|
296
236
|
}
|
|
297
|
-
/**
|
|
298
|
-
* Asset History Entry - single mint or burn event.
|
|
299
|
-
* `quantity` is always the ABSOLUTE amount; sign info lives in `action`.
|
|
300
|
-
*/
|
|
237
|
+
/** One mint or burn event; `quantity` is absolute, the sign lives in `action`. */
|
|
301
238
|
export interface AssetHistoryEntry {
|
|
302
239
|
unit: string;
|
|
303
240
|
txHash: string;
|
|
@@ -306,9 +243,7 @@ export interface AssetHistoryEntry {
|
|
|
306
243
|
blockTime: number | null;
|
|
307
244
|
blockHeight: number | null;
|
|
308
245
|
}
|
|
309
|
-
/**
|
|
310
|
-
* Ledger Protocol Parameters Data Structure Type - Current protocol parameters
|
|
311
|
-
*/
|
|
246
|
+
/** Current protocol parameters */
|
|
312
247
|
export type LedgerProtocolParameters = {
|
|
313
248
|
network: string;
|
|
314
249
|
epoch: number;
|
|
@@ -345,35 +280,26 @@ export type LedgerProtocolParameters = {
|
|
|
345
280
|
fetchedAt: string;
|
|
346
281
|
source: string;
|
|
347
282
|
};
|
|
348
|
-
/**
|
|
349
|
-
* Mint/Burn Asset Action Type
|
|
350
|
-
*/
|
|
283
|
+
/** Mint/burn action */
|
|
351
284
|
export type MintAction = {
|
|
352
285
|
/** Asset unit to mint/burn (policyId + assetName) */
|
|
353
286
|
assetUnit: string;
|
|
354
|
-
/**
|
|
287
|
+
/** Positive to mint, negative to burn */
|
|
355
288
|
quantity: bigint;
|
|
356
|
-
/** Optional
|
|
289
|
+
/** Optional integer redeemer, default 0 */
|
|
357
290
|
redeemer?: number;
|
|
358
291
|
/**
|
|
359
|
-
*
|
|
360
|
-
*
|
|
361
|
-
* mintingPolicyScript, enabling multiple policies in one transaction.
|
|
362
|
-
* Passed as-is (a parameterized script must be pre-applied); the action's
|
|
363
|
-
* assetUnit must carry this script's policyId.
|
|
292
|
+
* Per-action minting policy (CBOR hex, applied as-is) for multi-policy transactions; overrides the
|
|
293
|
+
* top-level mintingPolicyScript. The assetUnit must carry this script's policyId.
|
|
364
294
|
*/
|
|
365
295
|
mintingPolicyScript?: string;
|
|
366
296
|
/**
|
|
367
|
-
*
|
|
368
|
-
*
|
|
369
|
-
* mintRedeemer when absent. Actions resolving to the SAME policy must
|
|
370
|
-
* agree on their redeemer (the ledger carries one redeemer per policy).
|
|
297
|
+
* Per-action redeemer (parsed PlutusData JSON), only with mintingPolicyScript; falls back to mintRedeemer.
|
|
298
|
+
* Actions on the same policy must agree (one redeemer per policy in the ledger).
|
|
371
299
|
*/
|
|
372
300
|
redeemerJson?: JSONValue;
|
|
373
301
|
};
|
|
374
|
-
/**
|
|
375
|
-
* Plutus Script Execution Type - For spending from script addresses
|
|
376
|
-
*/
|
|
302
|
+
/** Plutus script execution for spending from a script address */
|
|
377
303
|
export type PlutusScriptExecution = {
|
|
378
304
|
/** Validator script (CBOR hex) */
|
|
379
305
|
validatorScript: string;
|
|
@@ -384,12 +310,10 @@ export type PlutusScriptExecution = {
|
|
|
384
310
|
};
|
|
385
311
|
/** Redeemer data (JSON value that will be converted to PlutusData) */
|
|
386
312
|
redeemer: JSONValue;
|
|
387
|
-
/** Datum
|
|
313
|
+
/** Datum (JSON value), required for hash-based datums */
|
|
388
314
|
datum?: JSONValue;
|
|
389
315
|
};
|
|
390
|
-
/**
|
|
391
|
-
* Transaction Build Request Type - Parameters for building a transaction, including optional minting and Plutus execution details
|
|
392
|
-
*/
|
|
316
|
+
/** Parameters for building a transaction, with optional minting and Plutus execution */
|
|
393
317
|
export type TxBuildRequest = {
|
|
394
318
|
network: 'mainnet' | 'preprod' | 'preview';
|
|
395
319
|
senderAddress: string;
|
|
@@ -409,7 +333,7 @@ export type TxBuildRequest = {
|
|
|
409
333
|
outputDatum?: JSONValue;
|
|
410
334
|
/** Required signers - Ed25519 key hashes (hex, 28 bytes each) */
|
|
411
335
|
requiredSigners?: string[];
|
|
412
|
-
/** Script parameters
|
|
336
|
+
/** Script parameters (PlutusData JSON array) applied to the script before building */
|
|
413
337
|
scriptParams?: JSONValue[];
|
|
414
338
|
/** Optional inline datum for minted token output (PlutusData JSON, parsed) */
|
|
415
339
|
inlineDatum?: JSONValue;
|
|
@@ -418,29 +342,19 @@ export type TxBuildRequest = {
|
|
|
418
342
|
/** When true, route output to enterprise script address derived from applied script hash */
|
|
419
343
|
lockOnScript?: boolean;
|
|
420
344
|
/**
|
|
421
|
-
*
|
|
422
|
-
*
|
|
423
|
-
* Deduplicated against plutusScriptExecution.scriptUtxo in spend transactions.
|
|
424
|
-
* Primary use case: one-shot minting seeds (policy parameterized with a specific TxOutRef).
|
|
345
|
+
* UTxOs that must be consumed, added before coin selection (one-shot minting seeds);
|
|
346
|
+
* deduplicated against plutusScriptExecution.scriptUtxo.
|
|
425
347
|
*/
|
|
426
348
|
forceInputs?: Array<{
|
|
427
349
|
txHash: string;
|
|
428
350
|
outputIndex: number;
|
|
429
351
|
}>;
|
|
430
|
-
/**
|
|
431
|
-
* Optional CIP-31 reference inputs (read-only, not consumed). Resolved to full UTxOs
|
|
432
|
-
* and passed as readonlyRefInputs to Buildooor. The validator can read these UTxOs'
|
|
433
|
-
* datums/values without consuming them (e.g., oracle feeds, shared config).
|
|
434
|
-
*/
|
|
352
|
+
/** CIP-31 reference inputs (read-only, not consumed), passed as readonlyRefInputs to Buildooor. */
|
|
435
353
|
referenceInputs?: Array<{
|
|
436
354
|
txHash: string;
|
|
437
355
|
outputIndex: number;
|
|
438
356
|
}>;
|
|
439
|
-
/**
|
|
440
|
-
* Optional additional outputs appended after the primary recipient output, before change.
|
|
441
|
-
* Each extra output is independently min-ADA checked. Used for multi-output state-machine
|
|
442
|
-
* transitions (e.g. counter update + batch NFT outputs in a single transaction).
|
|
443
|
-
*/
|
|
357
|
+
/** Additional outputs after the primary recipient output, before change; each min-ADA checked. */
|
|
444
358
|
extraOutputs?: Array<{
|
|
445
359
|
address: string;
|
|
446
360
|
lovelaceAmount: string;
|
|
@@ -451,52 +365,28 @@ export type TxBuildRequest = {
|
|
|
451
365
|
inlineDatum?: JSONValue;
|
|
452
366
|
referenceScript?: string;
|
|
453
367
|
}>;
|
|
454
|
-
/**
|
|
455
|
-
* Optional Plutus V3 validator CBOR hex to attach as a referenceScript on the primary
|
|
456
|
-
* recipient output (CIP-33). Adding a ref script significantly increases the output's
|
|
457
|
-
* min-ADA — consumers must provide enough lovelaceAmount to cover it.
|
|
458
|
-
*/
|
|
368
|
+
/** Plutus V3 validator CBOR hex attached as CIP-33 reference script on the recipient output; raises its min-ADA. */
|
|
459
369
|
referenceScript?: string;
|
|
460
|
-
/**
|
|
461
|
-
* Optional validity-interval start in Posix milliseconds. Sets `invalidBefore`
|
|
462
|
-
* on the built transaction so that Plutus validators checking
|
|
463
|
-
* `expect Finite(lower) = tx.validity_range.lower_bound.bound_type` see a finite bound.
|
|
464
|
-
* Defaults inside the builder to `Date.now() - 120_000` (script builds only).
|
|
465
|
-
*/
|
|
370
|
+
/** Validity start in Posix ms (`invalidBefore`); builder default `now - 120_000` for script builds. */
|
|
466
371
|
validityStartMs?: string;
|
|
467
|
-
/**
|
|
468
|
-
* Optional validity-interval end in Posix milliseconds. Sets `invalidAfter` (ledger TTL).
|
|
469
|
-
* Defaults inside the builder to `Date.now() + 3_600_000` (script builds only).
|
|
470
|
-
*/
|
|
372
|
+
/** Validity end in Posix ms (`invalidAfter`, ledger TTL); builder default `now + 3_600_000` for script builds. */
|
|
471
373
|
validityEndMs?: string;
|
|
472
374
|
};
|
|
473
|
-
/**
|
|
474
|
-
* Transaction Build Request for Mint/Burn operations - requires mintActions and mintingPolicyScript
|
|
475
|
-
*/
|
|
375
|
+
/** Mint/burn build request: mintActions and mintingPolicyScript required */
|
|
476
376
|
export type TxBuildMintRequest = TxBuildRequest & {
|
|
477
377
|
mintActions: MintAction[];
|
|
478
378
|
mintingPolicyScript: string;
|
|
479
379
|
};
|
|
480
|
-
/**
|
|
481
|
-
* Transaction Build Request for Plutus spending - requires plutusScriptExecution
|
|
482
|
-
*/
|
|
380
|
+
/** Plutus spend build request: plutusScriptExecution required */
|
|
483
381
|
export type TxBuildPlutusSpendRequest = TxBuildRequest & {
|
|
484
382
|
plutusScriptExecution: PlutusScriptExecution;
|
|
485
383
|
};
|
|
486
|
-
/**
|
|
487
|
-
* Execution Budget for Plutus scripts
|
|
488
|
-
*/
|
|
384
|
+
/** Execution budget for Plutus scripts */
|
|
489
385
|
export type ExecutionBudget = {
|
|
490
386
|
memory: number;
|
|
491
387
|
cpu: number;
|
|
492
388
|
};
|
|
493
|
-
/**
|
|
494
|
-
* Script evaluation result from Ogmios
|
|
495
|
-
*/
|
|
496
|
-
/**
|
|
497
|
-
* Ogmios validator descriptor — `purpose:index` (e.g., "spend:0", "mint:1")
|
|
498
|
-
* or a structured object with purpose + index fields depending on Ogmios version.
|
|
499
|
-
*/
|
|
389
|
+
/** Ogmios validator descriptor: `purpose:index` (e.g. "spend:0") or `{ purpose, index }` depending on version */
|
|
500
390
|
export type ScriptValidator = string | {
|
|
501
391
|
purpose: string;
|
|
502
392
|
index: number;
|
|
@@ -505,13 +395,9 @@ export type ScriptEvaluationResult = {
|
|
|
505
395
|
validator: ScriptValidator;
|
|
506
396
|
budget: ExecutionBudget;
|
|
507
397
|
};
|
|
508
|
-
/**
|
|
509
|
-
* Transaction evaluator function type - evaluates script execution units
|
|
510
|
-
*/
|
|
398
|
+
/** Evaluates script execution units of an unsigned tx */
|
|
511
399
|
export type TxEvaluator = (unsignedTxCbor: string) => Promise<ScriptEvaluationResult[]>;
|
|
512
|
-
/**
|
|
513
|
-
* Transaction Build Context Type - Context for building a transaction
|
|
514
|
-
*/
|
|
400
|
+
/** Context for building a transaction */
|
|
515
401
|
export type TxBuildContext = {
|
|
516
402
|
utxos: UTxO[];
|
|
517
403
|
protocolParameters: LedgerProtocolParameter;
|
|
@@ -520,9 +406,7 @@ export type TxBuildContext = {
|
|
|
520
406
|
/** CIP-31 reference input UTxOs (read-only, not consumed). Resolved from referenceInputs refs. */
|
|
521
407
|
referenceInputUtxos?: UTxO[];
|
|
522
408
|
};
|
|
523
|
-
/**
|
|
524
|
-
* Transaction Build Result Type
|
|
525
|
-
*/
|
|
409
|
+
/** Transaction build result */
|
|
526
410
|
export type TxBuildResult = {
|
|
527
411
|
senderAddress?: string;
|
|
528
412
|
network?: 'mainnet' | 'preprod' | 'preview';
|
|
@@ -557,9 +441,7 @@ export type TxBuildResult = {
|
|
|
557
441
|
/** Number of CIP-31 reference inputs included in the built transaction (0 if referenceInputs was not used). */
|
|
558
442
|
referenceInputsUsed?: number;
|
|
559
443
|
};
|
|
560
|
-
/**
|
|
561
|
-
* Supported external signer types
|
|
562
|
-
*/
|
|
444
|
+
/** Supported external signer types */
|
|
563
445
|
export declare enum ExternalSignerType {
|
|
564
446
|
/** Cardano CLI - Reference implementation for signing */
|
|
565
447
|
CARDANO_CLI = "cardano-cli",
|
|
@@ -572,9 +454,7 @@ export declare enum ExternalSignerType {
|
|
|
572
454
|
/** Hardware Security Module (server-side PKCS#11) */
|
|
573
455
|
HSM = "hsm"
|
|
574
456
|
}
|
|
575
|
-
/**
|
|
576
|
-
* Signing request status
|
|
577
|
-
*/
|
|
457
|
+
/** Signing request status */
|
|
578
458
|
export declare enum SigningStatus {
|
|
579
459
|
/** Request created, awaiting signing */
|
|
580
460
|
PENDING = "pending",
|
|
@@ -589,9 +469,7 @@ export declare enum SigningStatus {
|
|
|
589
469
|
/** Request expired (not signed within TTL) */
|
|
590
470
|
EXPIRED = "expired"
|
|
591
471
|
}
|
|
592
|
-
/**
|
|
593
|
-
* Instructions for external signers
|
|
594
|
-
*/
|
|
472
|
+
/** Instructions for external signers */
|
|
595
473
|
export interface SigningInstructions {
|
|
596
474
|
/** Signer type hint (which tool/wallet to use) */
|
|
597
475
|
signerTypeHint: ExternalSignerType;
|
|
@@ -609,12 +487,7 @@ export interface SigningInstructions {
|
|
|
609
487
|
/** Copy-pasteable cardano-cli signing recipe (for CLI/hardware signers) */
|
|
610
488
|
cardanoCliCommand?: string;
|
|
611
489
|
}
|
|
612
|
-
/**
|
|
613
|
-
* Unsigned transaction export payload for external signers
|
|
614
|
-
*
|
|
615
|
-
* This is the standardized format returned by BuildTransaction actions.
|
|
616
|
-
* External signers use this payload to sign the transaction.
|
|
617
|
-
*/
|
|
490
|
+
/** Unsigned transaction payload returned by the Build actions for external signers */
|
|
618
491
|
export interface UnsignedTxExportPayload {
|
|
619
492
|
/** Unique identifier for this signing request */
|
|
620
493
|
signingRequestId: string;
|
|
@@ -635,9 +508,7 @@ export interface UnsignedTxExportPayload {
|
|
|
635
508
|
/** Signing instructions for the external signer */
|
|
636
509
|
signingInstructions: SigningInstructions;
|
|
637
510
|
}
|
|
638
|
-
/**
|
|
639
|
-
* Signed transaction submission payload
|
|
640
|
-
*/
|
|
511
|
+
/** Signed transaction submission payload */
|
|
641
512
|
export interface SignedTxPayload {
|
|
642
513
|
/** Original signing request ID */
|
|
643
514
|
signingRequestId: string;
|
|
@@ -650,9 +521,7 @@ export interface SignedTxPayload {
|
|
|
650
521
|
/** Optional: Signer identification (wallet name, etc.) */
|
|
651
522
|
signerInfo?: string;
|
|
652
523
|
}
|
|
653
|
-
/**
|
|
654
|
-
* Signing workflow state
|
|
655
|
-
*/
|
|
524
|
+
/** Signing workflow state */
|
|
656
525
|
export interface SigningWorkflowState {
|
|
657
526
|
/** Current status of the signing workflow */
|
|
658
527
|
status: SigningStatus;
|
|
@@ -675,9 +544,7 @@ export interface SigningWorkflowState {
|
|
|
675
544
|
failed?: string;
|
|
676
545
|
};
|
|
677
546
|
}
|
|
678
|
-
/**
|
|
679
|
-
* Result of signature verification
|
|
680
|
-
*/
|
|
547
|
+
/** Result of signature verification */
|
|
681
548
|
export interface SignatureVerificationResult {
|
|
682
549
|
/** Whether the signature is valid */
|
|
683
550
|
isValid: boolean;
|
|
@@ -692,9 +559,7 @@ export interface SignatureVerificationResult {
|
|
|
692
559
|
/** Error message if verification failed */
|
|
693
560
|
errorMessage?: string;
|
|
694
561
|
}
|
|
695
|
-
/**
|
|
696
|
-
* Options for signature verification
|
|
697
|
-
*/
|
|
562
|
+
/** Options for signature verification */
|
|
698
563
|
export interface VerificationOptions {
|
|
699
564
|
/** Expected transaction body hash (from the build) */
|
|
700
565
|
expectedTxBodyHash?: string;
|
|
@@ -703,9 +568,7 @@ export interface VerificationOptions {
|
|
|
703
568
|
/** List of required signer key hashes (public key hashes) */
|
|
704
569
|
requiredSigners?: string[];
|
|
705
570
|
}
|
|
706
|
-
/**
|
|
707
|
-
* HSM Configuration for PKCS#11 integration
|
|
708
|
-
*/
|
|
571
|
+
/** HSM configuration for PKCS#11 integration */
|
|
709
572
|
export interface HsmConfig {
|
|
710
573
|
/** Whether HSM signing is enabled */
|
|
711
574
|
enabled: boolean;
|
|
@@ -719,12 +582,10 @@ export interface HsmConfig {
|
|
|
719
582
|
keyId?: string;
|
|
720
583
|
/** Key label for CKA_LABEL lookup */
|
|
721
584
|
keyLabel?: string;
|
|
722
|
-
/**
|
|
585
|
+
/** CDS role required for the HSM actions (SignWithHsm, SignAndSubmitWithHsm, GetHsmStatus) */
|
|
723
586
|
requiresRole?: string;
|
|
724
587
|
}
|
|
725
|
-
/**
|
|
726
|
-
* HSM signing result
|
|
727
|
-
*/
|
|
588
|
+
/** HSM signing result */
|
|
728
589
|
export interface HsmSignResult {
|
|
729
590
|
/** Ed25519 signature (64 bytes, hex) */
|
|
730
591
|
signatureHex: string;
|
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 */
|