@odatano/core 2.0.0-rc.11 → 2.0.0-rc.13

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/db/schema.cds CHANGED
@@ -1,1738 +1,1844 @@
1
- using {temporal, } from '@sap/cds/common';
2
- using {Lovelace, Blake2b224, Blake2b256, HexBytes, Bech32, AssetUnit, AssetSlice, SigningStatus,SubmissionStatus, UTxODataSlice, MetadataLabel, CrawlSyncStatus, ReorgStatus, WalletJobStatus, WalletJobKind, WorkerSignerType} from '../db/types';
3
-
4
- namespace odatano.cardano;
5
-
6
- @title : 'Network Information Entity'
7
- @description: 'General information entity definition'
8
- entity NetworkInformation : temporal {
9
-
10
- @title : 'Network (key)'
11
- @description: 'The Cardano network type mainnet | preprod | preview'
12
- key network : String(10);
13
-
14
- @title : 'Max Supply'
15
- @description: 'The maximum supply of ADA'
16
- maxSupply : Lovelace;
17
-
18
- @title : 'Total Supply'
19
- @description: 'Current total supply of ADA'
20
- totalSupply : Lovelace;
21
-
22
- @title : 'Circulating Supply'
23
- @description: 'Current circulating supply of ADA'
24
- circulatingSupply : Lovelace;
25
-
26
- @title : 'Locked Supply'
27
- @description: 'Current locked supply of ADA'
28
- lockedSupply : Lovelace;
29
-
30
- @title : 'Treasury Supply'
31
- @description: 'Current treasury supply of ADA'
32
- treasurySupply : Lovelace;
33
-
34
- @title : 'Reserves Supply'
35
- @description: 'Current reserves supply of ADA'
36
- reservesSupply : Lovelace;
37
-
38
- @title : 'Live Stake'
39
- @description: 'Current live stake of ADA'
40
- liveStake : Lovelace;
41
-
42
- @title : 'Active Stake'
43
- @description: 'Current active stake of ADA'
44
- activeStake : Lovelace;
45
- }
46
-
47
- @title : 'Block Entity'
48
- @description: 'Block information entity definition'
49
- @readonly
50
- entity Blocks {
51
-
52
- @title : 'Block Hash (Key)'
53
- @description: 'Block hash as hex string'
54
- key hash : String(64);
55
-
56
- @title : 'Block Time'
57
- @description: 'Block time as ISO 8601 string'
58
- time : String;
59
-
60
- @title : 'Block Height'
61
- @description: 'Block height as integer'
62
- height : Integer;
63
-
64
- @title : 'Block SlotLeader'
65
- @description: 'Slot leader id as hex string'
66
- slotLeader : String;
67
-
68
- @title : 'Block Epoch Number'
69
- @description: 'Epoch number as integer'
70
- epochNumber : Integer;
71
-
72
- @title : 'Block epoch Association'
73
- @description: 'Association to Epochs entity'
74
- epoch : Association to Epochs
75
- on epoch.epoch = $self.epochNumber;
76
-
77
- @title : 'Block Absolute Slot'
78
- @description: 'Absolute slot number of the block'
79
- slot : Integer64;
80
-
81
- @title : 'Block Slot within Epoch'
82
- @description: 'Slot number within the epoch as integer'
83
- epochSlot : Integer;
84
-
85
- @title : 'Block Size'
86
- @description: 'Block size in bytes'
87
- size : Integer;
88
-
89
- @title : 'Block Transaction Count'
90
- @description: 'Number of transactions in the block'
91
- txCount : Integer;
92
-
93
- @title : 'Block Fees'
94
- @description: 'Total fees in the block'
95
- fees : Lovelace;
96
- }
97
-
98
- @title : 'Epoch Entity'
99
- @description: 'Epoch information entity definition'
100
- @readonly
101
- entity Epochs {
102
-
103
- @title : 'Epoch Number (Key)'
104
- @description: 'Epoch number as integer'
105
- key epoch : Integer;
106
-
107
- @title : 'Epoch Start Time'
108
- @description: 'Epoch start time as unix timestamp (seconds)'
109
- startTime : Integer64; // Integer (32-bit) overflows on 2038-01-19
110
-
111
- @title : 'Epoch End Time'
112
- @description: 'Epoch end time as unix timestamp (seconds)'
113
- endTime : Integer64;
114
-
115
- @title : 'First Block Time'
116
- @description: 'First block time as unix timestamp (seconds)'
117
- firstBlockTime : Integer64;
118
-
119
- @title : 'Last Block Time'
120
- @description: 'Last block time as unix timestamp (seconds)'
121
- lastBlockTime : Integer64;
122
-
123
- @title : 'Block Count'
124
- @description: 'Number of blocks in the epoch'
125
- blockCount : Integer;
126
-
127
- @title : 'Transaction Count'
128
- @description: 'Number of transactions in the epoch'
129
- txCount : Integer;
130
-
131
- @title : 'Total Output'
132
- @description: 'Total output in the epoch as string to avoid precision issues'
133
- output : String;
134
-
135
- @title : 'Total Fees'
136
- @description: 'Total fees in the epoch'
137
- fees : Lovelace;
138
-
139
- @title : 'Active Stake'
140
- @description: 'Total active stake in the epoch'
141
- activeStake : Lovelace;
142
- }
143
-
144
- @title : 'Pool Entity'
145
- @description: 'Stake pool information entity definition'
146
- entity Pools : temporal {
147
-
148
- @title : 'Pool Id (Key)'
149
- @description: 'Unique stake pool identifier'
150
- key poolId : Bech32;
151
-
152
- @title : 'VRF Key Hash'
153
- @description: 'Pool VRF key hash as hex string'
154
- vrfKeyHash : String;
155
-
156
- @title : 'Blocks Minted'
157
- @description: 'Total number of blocks minted by the pool'
158
- blocksMinted : Integer;
159
-
160
- @title : 'Blocks in Epoch'
161
- @description: 'Number of blocks minted in the current epoch'
162
- blocksEpoch : Integer;
163
-
164
- @title : 'Live Stake'
165
- @description: 'Current live stake delegated to the pool'
166
- liveStake : Lovelace;
167
-
168
- @title : 'Live Size'
169
- @description: 'Current live size as fraction of total active stake'
170
- liveSize : Decimal(5, 4);
171
-
172
- @title : 'Live Saturation'
173
- @description: 'Current live saturation as fraction of ideal size'
174
- liveSaturation : Decimal(5, 4);
175
-
176
- @title : 'Live Delegators'
177
- @description: 'Current number of live delegators'
178
- liveDelegators : Integer;
179
-
180
- @title : 'Active Stake'
181
- @description: 'Current active stake delegated to the pool'
182
- activeStake : Lovelace;
183
-
184
- @title : 'Active Size'
185
- @description: 'Current active size as fraction'
186
- activeSize : Decimal(5, 4);
187
-
188
- @title : 'Pledge'
189
- @description: 'Pool pledge in lovelace'
190
- pledge : Lovelace;
191
-
192
- @title : 'Margin'
193
- @description: 'Pool margin as fraction'
194
- margin : Decimal(5, 4);
195
-
196
- @title : 'Fixed Cost'
197
- @description: 'Pool fixed cost in lovelace'
198
- fixedCost : Lovelace;
199
-
200
- @title : 'Reward Account'
201
- @description: 'Pool reward account in bech32 format'
202
- rewardAccount : String;
203
- }
204
-
205
- @title : 'Asset Entity'
206
- @description: 'Native-asset information entity (supply, mint history, CIP-25 + CIP-26 metadata)'
207
- entity Assets : temporal {
208
-
209
- @title : 'Asset Unit (Key)'
210
- @description: 'Concatenation of policyId (56 hex) and assetNameHex (0-128 hex)'
211
- key unit : AssetUnit;
212
-
213
- @title : 'Policy ID'
214
- @description: 'Blake2b-224 hash of the minting policy script (56-char hex)'
215
- policyId : Blake2b224;
216
-
217
- @title : 'Asset Name Hex'
218
- @description: 'Asset name as hex string (0-32 bytes / 0-64 hex chars)'
219
- assetNameHex : String(64); // 32-byte ledger cap = 64 hex (was HexBytes=String(5000))
220
-
221
- @title : 'Asset Name'
222
- @description: 'Asset name as UTF-8 string when decodable'
223
- assetName : String(128);
224
-
225
- @title : 'Asset Fingerprint'
226
- @description: 'CIP-14 asset fingerprint (asset1...)'
227
- fingerprint : String(44);
228
-
229
- @title : 'Total Supply'
230
- @description: 'Current total supply (BigInt-safe decimal string)'
231
- totalSupply : String(40);
232
-
233
- @title : 'Mint or Burn Count'
234
- @description: 'Total number of mint/burn transactions for this asset'
235
- mintOrBurnCount : Integer;
236
-
237
- @title : 'Initial Mint Tx Hash'
238
- @description: 'Hash of the transaction that first minted this asset'
239
- initialMintTxHash : Blake2b256;
240
-
241
- @title : 'Initial Mint Time'
242
- @description: 'Unix timestamp of the initial mint (null when unavailable from backend, e.g. Blockfrost)'
243
- initialMintTime : Integer64;
244
-
245
- @title : 'On-Chain Metadata'
246
- @description: 'CIP-25 on-chain metadata as JSON string (varies per minter)'
247
- onchainMetadata : LargeString;
248
-
249
- @title : 'Registry Name'
250
- @description: 'CIP-26 off-chain registry: human-readable name'
251
- registryName : String(128);
252
-
253
- @title : 'Registry Ticker'
254
- @description: 'CIP-26 off-chain registry: ticker symbol'
255
- registryTicker : String(16);
256
-
257
- @title : 'Registry Decimals'
258
- @description: 'CIP-26 off-chain registry: decimal precision'
259
- registryDecimals : Integer;
260
-
261
- @title : 'Registry Description'
262
- @description: 'CIP-26 off-chain registry: human-readable description'
263
- registryDescription : LargeString;
264
-
265
- @title : 'Registry URL'
266
- @description: 'CIP-26 off-chain registry: project URL'
267
- registryUrl : String(256);
268
-
269
- @title : 'Registry Logo'
270
- @description: 'CIP-26 off-chain registry: base64-encoded logo or URL'
271
- registryLogo : LargeString;
272
- }
273
-
274
- @title : 'Asset History Entry'
275
- @description: 'Mint or burn event for a native asset. Immutable on-chain — entries are never updated, only inserted. Free-standing (not a Composition) so history can be queried before/without the parent Assets row.'
276
- @readonly
277
- entity AssetHistory {
278
-
279
- @title : 'Asset Unit (Key)'
280
- @description: 'policyId + assetNameHex (concatenated hex)'
281
- key unit : AssetUnit;
282
-
283
- @title : 'Transaction Hash (Key)'
284
- @description: 'Hash of the transaction that performed the mint or burn'
285
- key txHash : Blake2b256;
286
-
287
- @title : 'Action'
288
- @description: 'mint or burn'
289
- action : String(10);
290
-
291
- @title : 'Quantity'
292
- @description: 'Absolute mint/burn amount (BigInt-safe decimal string; always positive — sign info is in `action`)'
293
- quantity : String(40);
294
-
295
- @title : 'Block Time'
296
- @description: 'Unix timestamp of the containing block (null when backend does not provide, e.g. Blockfrost without extra tx fetch)'
297
- blockTime : Integer64;
298
-
299
- @title : 'Block Height'
300
- @description: 'Block height of the containing block (null when backend does not provide)'
301
- blockHeight : Integer;
302
- }
303
-
304
- @title : 'Drep Entity'
305
- @description: 'Drep information entity definition'
306
- entity Dreps : temporal {
307
-
308
- @title : 'Drep Id (Key)'
309
- @description: 'Unique drep identifier'
310
- key drepId : Bech32;
311
-
312
- @title : 'Drep VRF Key Hash'
313
- @description: 'Drep VRF key hash as hex string'
314
- hex : String;
315
-
316
- @title : 'Vote Power'
317
- @description: 'Amount of vote power in lovelace'
318
- amount : Lovelace;
319
-
320
- @title : 'Has Script'
321
- @description: 'Indicates if drep is a script drep'
322
- hasScript : Boolean;
323
-
324
- @title : 'Last Active Epoch'
325
- @description: 'Epoch number of last activity'
326
- lastActiveEpoch : Integer;
327
-
328
- @title : 'Retired'
329
- @description: 'Indicates if drep is retired'
330
- retired : Boolean;
331
-
332
- @title : 'Expired'
333
- @description: 'Indicates if drep is expired'
334
- expired : Boolean;
335
- }
336
-
337
- @title : 'Address Entity'
338
- @description: 'Address information entity definition'
339
- entity Addresses : temporal {
340
-
341
- @title : 'Bech32 Address (Key)'
342
- @description: 'The Bech32 encoded address string'
343
- key address : Bech32;
344
-
345
- @title : 'Associated Stake Address'
346
- @description: 'The associated stake address in bech32 format'
347
- stakeAddress : Bech32;
348
-
349
- @title : 'Address Type'
350
- @description: 'The type of address (base | enterprise | pointer | reward | script | unknown)'
351
- type : String(20);
352
-
353
- @title : 'Is Script Address'
354
- @description: 'Indicates if the address is a script address'
355
- isScript : Boolean;
356
-
357
- @title : 'Total Lovelace'
358
- @description: 'Total lovelace on this address'
359
- totalLovelace : Lovelace;
360
-
361
- @title : 'UTxO Count'
362
- @description: 'Number of UTxOs at this address (pre-aggregated, no UTxO scan needed for status checks)'
363
- utxoCount : Integer;
364
-
365
- @title : 'Address Transactions'
366
- @description : 'Composition of all transactions involving this address'
367
- transactions : Composition of many AddressTransactions
368
- on transactions.address = $self;
369
-
370
- @title : 'Address Assets'
371
- @description: 'Composition of all assets on this address'
372
- assets : Composition of many AddressAssets
373
- on assets.address = $self;
374
-
375
- @title : 'Address UTxOs'
376
- @description: 'Composition of all UTxOs on this address'
377
- utxos : Composition of many AddressUTxOs
378
- on utxos.address = $self;
379
-
380
- @title : 'Address Has Transactions'
381
- @description : 'Indicates if address has transactions'
382
- hasTransactions : Boolean;
383
-
384
- @title : 'Address Has Assets'
385
- @description: 'Indicates if address has native assets'
386
- hasAssets : Boolean;
387
-
388
- @title : 'Address Has UTxOs'
389
- @description: 'Indicates if address has UTxOs'
390
- hasUTxOs : Boolean;
391
-
392
-
393
- }
394
-
395
- @title : 'Address Assets'
396
- @description: 'Association entity for assets held by an address'
397
- entity AddressAssets : temporal {
398
-
399
- @title : 'Address (key)'
400
- @description: 'The Bech32 encoded address associated with the asset'
401
- key address : Association to Addresses;
402
-
403
- @title : 'Asset Unit (key)'
404
- @description: 'The unique identifier for the asset unit'
405
- key unit : AssetUnit;
406
-
407
- @title : 'Asset Details'
408
- @description: 'Structural slice for asset details'
409
- asset : AssetSlice;
410
- }
411
-
412
- @title : 'Address UTxOs'
413
- @description: 'Association entity for UTxOs held by an address'
414
- entity AddressUTxOs : temporal {
415
-
416
- @title : 'Address (key)'
417
- @description: 'The Bech32 encoded address associated with the UTxO'
418
- key address : Association to Addresses;
419
-
420
- @title : 'UTxO Key (key)'
421
- @description: 'The unique identifier for the UTxO (tx hash + index)'
422
- key hash : Blake2b256;
423
-
424
- @title : 'UTxO Index (key)'
425
- @description: 'The output index of the UTxO'
426
- key index : Integer;
427
-
428
- @title : 'Block Hash'
429
- @description: 'Block hash containing the UTxO'
430
- blockHash : Blake2b256;
431
-
432
- @title : 'UTxO Data'
433
- @description: 'UTxO specific data'
434
- utxodata : UTxODataSlice;
435
-
436
- @title : 'Lovelace Amount'
437
- @description: 'Lovelace amount in the UTxO'
438
- lovelace : Lovelace;
439
-
440
- @title : 'UTxO Assets'
441
- @description: 'Assets in this UTxO'
442
- assets : Composition of many UTxOAssets
443
- on assets.utxo = $self;
444
-
445
- @title : 'UTxO Has Assets'
446
- @description: 'Indicates if utxo has assets'
447
- hasAssets : Boolean;
448
- }
449
-
450
- @title : 'UTxO Assets'
451
- @description: 'Association entity for assets held by a UTxO'
452
- entity UTxOAssets : temporal {
453
-
454
- @title: 'UTxO (key)'
455
- key utxo : Association to AddressUTxOs; // utxo association
456
-
457
- @title : 'Asset Unit (key)'
458
- @description: 'The unique identifier for the asset unit'
459
- key unit : AssetUnit; // asset unit - must be key since one UTxO can hold multiple assets
460
-
461
- @title : 'Asset Details'
462
- @description: 'Structural slice for asset details'
463
- asset : AssetSlice; // asset details
464
- }
465
-
466
- @title : 'Accounts Entity'
467
- @description: 'Account information entity definition'
468
- entity Accounts : temporal {
469
-
470
- @title : 'Stake Address (Key)'
471
- @description: 'The Bech32 encoded stake address string'
472
- key stakeAddress : Bech32;
473
-
474
- @title : 'Active Status'
475
- @description: 'Indicates if the account is active'
476
- active : Boolean;
477
-
478
- @title : 'Last Active Epoch'
479
- @description: 'Epoch number of last activity'
480
- activeEpoch : Integer;
481
-
482
- @title : 'Controlled Amount'
483
- @description: 'Total controlled amount in lovelace'
484
- controlledAmount : Lovelace;
485
-
486
- @title : 'Rewards Sum'
487
- @description: 'Total rewards sum in lovelace'
488
- rewardsSum : Lovelace;
489
-
490
- @title : 'Withdrawals Sum'
491
- @description: 'Total withdrawals sum in lovelace'
492
- withdrawalsSum : Lovelace;
493
-
494
- @title : 'Reserves Sum'
495
- @description: 'Total reserves sum in lovelace'
496
- reservesSum : Lovelace;
497
-
498
- @title : 'Treasury Sum'
499
- @description: 'Total treasury sum in lovelace'
500
- treasurySum : Lovelace;
501
-
502
- @title : 'Withdrawable Amount'
503
- @description: 'Total withdrawable amount in lovelace'
504
- withdrawableAmount : Lovelace;
505
-
506
- @title : 'Pool ID'
507
- @description: 'Associated pool ID'
508
- poolId : Association to Pools;
509
-
510
- @title : 'DRep ID'
511
- @description: 'Associated DRep ID'
512
- drepId : Association to Dreps;
513
-
514
- @title : 'Addresses'
515
- @description: 'All addresses for this account'
516
- Address : Composition of many Addresses
517
- on Address.stakeAddress = $self.stakeAddress;
518
-
519
- @title : 'Has Addresses'
520
- @description: 'Indicates if account has associated addresses'
521
- hasAddresses : Boolean;
522
- }
523
-
524
- @title : 'Transaction Entity'
525
- @description: 'Transaction information entity definition'
526
- @readonly
527
- entity Transactions {
528
-
529
- @title : 'Transaction Hash (Key)'
530
- @description: 'The unique transaction identifier as hex string'
531
- key hash : Blake2b256;
532
-
533
- @title : 'Transaction Block Hash'
534
- @description: 'The block hash containing the transaction'
535
- blockHash : Blake2b256;
536
-
537
- @title : 'Transaction Block Height'
538
- @description: 'The block height containing the transaction'
539
- blockHeight : Integer;
540
-
541
- @title : 'Transaction Block Time'
542
- @description: 'The block time as integer unix timestamp'
543
- blockTime : Integer64;
544
-
545
- @title : 'Transaction Slot'
546
- @description: 'The slot number containing the transaction'
547
- slot : Integer64;
548
-
549
- @title : 'Transaction Index'
550
- @description: 'The transaction index within the block'
551
- txIndex : Integer;
552
-
553
- @title : 'Transaction Fee'
554
- @description: 'The transaction fee in lovelace'
555
- fee : Lovelace;
556
-
557
- @title : 'Transaction Deposit'
558
- @description: 'The deposit change in lovelace'
559
- deposit : Lovelace;
560
-
561
- @title : 'Transaction Size'
562
- @description: 'The transaction size in bytes'
563
- size : Integer;
564
-
565
- @title : 'Transaction Metadata'
566
- @description: 'The transaction metadata'
567
- metadata : Composition of many TransactionMetadata
568
- on metadata.tx = $self;
569
-
570
- @title : 'Transaction Inputs'
571
- @description: 'The transaction inputs composition'
572
- inputs : Composition of many TransactionInputs
573
- on inputs.tx = $self;
574
-
575
- @title : 'Transaction Outputs'
576
- @description: 'The transaction outputs composition'
577
- outputs : Composition of many TransactionOutputs
578
- on outputs.tx = $self;
579
-
580
- @title : 'Transaction Has Metadata'
581
- @description: 'Indicates if transaction has metadata'
582
- hasMetadata : Boolean;
583
-
584
- @title : 'Transaction Has Inputs'
585
- @description: 'Indicates if transaction has inputs'
586
- hasInputs : Boolean;
587
-
588
- @title : 'Transaction Has Outputs'
589
- @description: 'Indicates if transaction has outputs'
590
- hasOutputs : Boolean;
591
- }
592
-
593
- @title : 'Transaction Inputs'
594
- @description: 'Projection for Transaction Inputs'
595
- @readonly
596
- entity TransactionInputs {
597
-
598
- @title : 'Transaction (key)'
599
- @description: 'The associated transaction'
600
- key tx : Association to Transactions;
601
-
602
- @title : 'Input Index (key)'
603
- @description: 'The input index of the input utxo'
604
- key inputIndex : Integer;
605
-
606
- @title : 'Input Address'
607
- @description: 'The associated address of the input utxo'
608
- address : Association to Addresses;
609
-
610
- @title : 'Input UTxO Data'
611
- @description: 'The UTxO specific data of the input utxo'
612
- utxoData : UTxODataSlice; // input utxo data
613
-
614
- @title : 'Input Lovelace Amount'
615
- @description: 'The lovelace amount of the input utxo'
616
- isCollateral : Boolean;
617
-
618
- @title : 'Is Reference Input'
619
- @description: 'Indicates if the input is used as reference input'
620
- isReference : Boolean;
621
-
622
- @title : 'Input Assets'
623
- @description: 'Composed assets associated with the input utxo'
624
- assets : Composition of many TransactionInputAssets
625
- on assets.input = $self;
626
-
627
- @title : 'Input Has Addresses'
628
- @description: 'Indicates if input has associated addresses'
629
- hasAddresses : Boolean;
630
-
631
- @title : 'Input Has Assets'
632
- @description: 'Indicates if input has assets'
633
- hasAssets : Boolean;
634
- }
635
-
636
- @title : 'Transaction Input Assets'
637
- @description: 'Projection for Transaction Input Assets'
638
- @readonly
639
- entity TransactionInputAssets {
640
-
641
- @title : 'Transaction Input (key)'
642
- @description: 'The associated transaction input'
643
- key input : Association to TransactionInputs;
644
-
645
- @title : 'Asset Unit (key)'
646
- @description: 'The asset unit'
647
- key unit : AssetUnit;
648
-
649
- @title : 'Asset Details'
650
- @description: 'Structural slice for asset details'
651
- asset : AssetSlice;
652
- }
653
-
654
- @title : 'Transaction Outputs'
655
- @description: 'Projection for Transaction Outputs'
656
- @readonly
657
- entity TransactionOutputs {
658
-
659
- @title : 'Transaction (key)'
660
- @description: 'The associated transaction'
661
- key tx : Association to Transactions;
662
-
663
- @title : 'Output Index (key)'
664
- @description: 'The output index of the output utxo'
665
- key outputIndex : Integer;
666
-
667
- @title : 'Output Address'
668
- @description: 'The associated address of the output utxo'
669
- address : Association to Addresses;
670
-
671
- @title : 'UTxO Data'
672
- @description: 'The UTxO specific data of the output utxo'
673
- utxo : UTxODataSlice;
674
-
675
- @title : 'Transaction Output Assets'
676
- @description: 'Composed assets associated with the output utxo'
677
- assets : Composition of many TransactionOutputAssets
678
- on assets.output = $self;
679
-
680
- @title : 'Has Addresses'
681
- @description: 'Indicates if output has associated addresses'
682
- hasAddresses : Boolean;
683
-
684
- @title : 'Has Assets'
685
- @description: 'Indicates if output has assets'
686
- hasAssets : Boolean;
687
- }
688
-
689
- @title : 'Transaction Output Assets'
690
- @description: 'Projection for Transaction Output Assets'
691
- @readonly
692
- entity TransactionOutputAssets {
693
-
694
- @title : 'Transaction Output (key)'
695
- @description: 'The associated transaction output'
696
- key output : Association to TransactionOutputs;
697
-
698
- @title : 'Asset Unit (key)'
699
- @description: 'The asset unit'
700
- key unit : AssetUnit;
701
-
702
- @title : 'Asset Details'
703
- @description: 'Structural slice for asset details'
704
- asset : AssetSlice;
705
- }
706
-
707
- @title : 'Transaction Metadata'
708
- @description: 'Projection for Transaction Metadata'
709
- @readonly
710
- entity TransactionMetadata {
711
-
712
- @title : 'ID (key)'
713
- @description: 'The metadata label as a uint64 (also exposed as the string `label`)'
714
- key id : Integer64; // was Integer (32-bit): overflowed for labels > 2^31
715
-
716
- @title : 'Transaction (key)'
717
- @description: 'The associated transaction'
718
- key tx : Association to Transactions;
719
-
720
- @title : 'Label'
721
- @description: 'The metadata label as string'
722
- label : MetadataLabel;
723
-
724
- @title : 'Metadata Payload'
725
- @description: 'The metadata payload as JSON string'
726
- payload : LargeString;
727
- }
728
-
729
- //-----------------------------------------------------
730
- // M2 - transaction building and submission entities
731
- //-----------------------------------------------------
732
- @title : 'Ledger Protocol Parameters'
733
- @description: 'Entity for storing ledger protocol parameters for transaction building'
734
- entity LedgerProtocolParameters {
735
-
736
- @title : 'Network (key)'
737
- @description: 'The Cardano network type mainnet | preprod | preview'
738
- key network : String(16);
739
-
740
- @title : 'Epoch Number (key)'
741
- @description: 'The epoch number these parameters are valid for'
742
- key epoch : Integer;
743
-
744
- @title : 'Minimum Fee A'
745
- @description: 'The minimum fee factor a for transaction fee calculation'
746
- minFeeA : Integer;
747
-
748
- @title : 'Minimum Fee B'
749
- @description: 'The minimum fee constant b for transaction fee calculation'
750
- minFeeB : Integer;
751
-
752
- @title : 'Maximum Sizes'
753
- @description: 'Maximum sizes for blocks and transactions'
754
- maxBlockSize : Integer;
755
-
756
- @title : 'Maximum Transaction Size'
757
- @description: 'The maximum size for a transaction in bytes'
758
- maxTxSize : Integer;
759
-
760
- @title : 'Maximum Block Header Size'
761
- @description: 'The maximum size for a block header in bytes'
762
- maxBlockHeaderSize : Integer;
763
-
764
- @title : 'Key Deposit'
765
- @description: 'The key deposit amount in lovelace'
766
- keyDeposit : String(32);
767
-
768
- @title : 'Pool Deposit'
769
- @description: 'The pool deposit amount in lovelace'
770
- poolDeposit : String(32);
771
-
772
- @title : 'Epochs for Pool Retirement'
773
- @description: 'The number of epochs before a retiring pool is removed from the ledger'
774
- eMax : Integer;
775
-
776
- @title : 'nOpt Parameter'
777
- @description: 'Stake pool target number parameter nOpt'
778
- nOpt : Integer;
779
-
780
- @title : 'a0 Parameter'
781
- @description: 'Pool pledge influence parameter a0'
782
- a0 : Decimal(18, 10);
783
-
784
- @title : 'Rho Parameter'
785
- @description: 'Monetary expansion parameter rho'
786
- rho : Decimal(18, 10);
787
-
788
- @title : 'Tau Parameter'
789
- @description: 'Treasury cut parameter tau'
790
- tau : Decimal(18, 10);
791
-
792
- @title : 'Minimum Pool Cost'
793
- @description: 'The minimum pool cost in lovelace'
794
- minPoolCost : String(32);
795
-
796
- @title : 'Decentralisation Parameter'
797
- @description: 'The decentralisation parameter of the network'
798
- decentralisationParam : Decimal(18, 10);
799
-
800
- @title : 'Extra Entropy'
801
- @description: 'The extra entropy for pool key generation'
802
- extraEntropy : String(128);
803
-
804
- @title : 'Protocol Major Version'
805
- @description: 'The major version of the protocol'
806
- protocolMajorVer : Integer;
807
-
808
- @title : 'Protocol Minor Version'
809
- @description: 'The minor version of the protocol'
810
- protocolMinorVer : Integer;
811
-
812
- @title : 'Min UTxO Value'
813
- @description: 'The minimum UTxO value in lovelace'
814
- minUtxo : String(32);
815
-
816
- @title : 'Min Pool Cost'
817
- @description: 'The minimum pool cost in lovelace'
818
- nonce : String(128);
819
-
820
- @title : 'Cost Models'
821
- @description: 'The cost models for script execution as JSON blob'
822
- costModels : LargeString;
823
-
824
- @title : 'Execution Prices'
825
- @description: 'The execution prices for script execution'
826
- priceMem : Decimal(18, 10);
827
-
828
- @title : 'Execution Steps Price'
829
- @description: 'The execution steps price for script execution'
830
- priceStep : Decimal(18, 10);
831
-
832
- @title : 'Maximum Execution Units'
833
- @description: 'The maximum execution units for transactions and blocks'
834
- maxTxExMem : String(32);
835
-
836
- @title : 'Maximum Execution Steps'
837
- @description: 'The maximum execution steps for transactions and blocks'
838
- maxTxExSteps : String(32);
839
-
840
- @title : 'Maximum Block Execution Units'
841
- @description: 'The maximum execution units for blocks'
842
- maxBlockExMem : String(32);
843
-
844
- @title : 'Maximum Block Execution Steps'
845
- @description: 'The maximum execution steps for blocks'
846
- maxBlockExSteps : String(32);
847
-
848
- @title : 'Maximum Value Size'
849
- @description: 'The maximum size for a value in bytes'
850
- maxValSize : String(32);
851
-
852
- @title : 'Collateral Percent'
853
- @description: 'The required collateral percentage for script transactions'
854
- collateralPercent : Integer;
855
-
856
- @title : 'Maximum Collateral Inputs'
857
- @description: 'The maximum number of collateral inputs for script transactions'
858
- maxCollateralInputs : Integer;
859
-
860
- @title : 'Coins Per UTxO Size'
861
- @description: 'The coins per UTxO size parameter for calculating min UTxO value'
862
- coinsPerUtxoSize : String(32);
863
-
864
- @title : 'Coins Per UTxO Word'
865
- @description: 'The coins per UTxO word parameter for calculating min UTxO value (alonzo legacy)'
866
- coinsPerUtxoWord : String(32);
867
-
868
- @title : 'Fetched At'
869
- @description: 'Timestamp when these parameters were fetched'
870
- fetchedAt : Timestamp;
871
-
872
- @title : 'Source'
873
- @description: 'Source from which these parameters were fetched'
874
- source : String(32);
875
- }
876
-
877
- @title : 'Transaction Builds'
878
- @description: 'Entity for storing transaction build attempts and details'
879
- entity TransactionBuilds : temporal {
880
-
881
- @title : 'Build ID (key)'
882
- @description: 'Unique identifier for the transaction build attempt'
883
- key id : UUID;
884
-
885
- @title : 'Network'
886
- @description: 'The Cardano network type mainnet | preprod | preview'
887
- network : String(10);
888
-
889
- @title : 'Builder Engine'
890
- @description: 'The transaction builder engine used for this build'
891
- builderEngine : String(20);
892
-
893
- @title : 'Sender Address'
894
- @description: 'The sender/source address'
895
- senderAddress : Bech32;
896
-
897
- @title : 'Change Address'
898
- @description: 'The change address (defaults to sender address if not specified)'
899
- changeAddress : Bech32;
900
-
901
- @title : 'Unsigned Tx CBOR'
902
- @description: 'The unsigned transaction CBOR as hex string'
903
- unsignedTxCbor : LargeString;
904
-
905
- @title : 'Tx Body Hash'
906
- @description: 'The transaction body hash as hex string'
907
- txBodyHash : Blake2b256;
908
-
909
- @title : 'Estimated Fee'
910
- @description: 'The estimated transaction fee in lovelace'
911
- fee : Lovelace;
912
-
913
- @title : 'Transaction Size'
914
- @description: 'The transaction size in bytes'
915
- size : Integer;
916
-
917
- @title : 'Build Created At'
918
- @description: 'The timestamp when the build was created'
919
- createdAt : Integer64;
920
-
921
- @title : 'Build Inputs'
922
- @description: 'The inputs used in the transaction build'
923
- inputs : Composition of many TransactionBuildInputs
924
- on inputs.build = $self;
925
-
926
- @title : 'Build Outputs'
927
- @description: 'The outputs created in the transaction build'
928
- outputs : Composition of many TransactionBuildOutputs
929
- on outputs.build = $self;
930
-
931
- @title : 'Associated Submission'
932
- @description: 'Association to the transaction submission if submitted'
933
- submission : Association to one TransactionSubmissions
934
- on submission.build = $self;
935
-
936
- @title : 'Has Inputs'
937
- @description: 'Indicates if the build has inputs'
938
- hasInputs : Boolean;
939
-
940
- @title : 'Has Outputs'
941
- @description: 'Indicates if the build has outputs'
942
- hasOutputs : Boolean;
943
-
944
- @title : 'Was Submitted'
945
- @description: 'Indicates if the build was submitted'
946
- wasSubmitted : Boolean;
947
-
948
- @title : 'Script Hash'
949
- @description: 'Blake2b-224 hash of the Plutus script used (= policy ID for minting transactions)'
950
- scriptHash : String(56);
951
-
952
- @title : 'Mint Script Hash'
953
- @description: 'Blake2b-224 hash of the minting policy script (= policy ID) for combined spend+mint transactions. Only set when BuildPlutusSpendTransaction included mintActionsJson.'
954
- mintScriptHash : String(56);
955
-
956
- @title : 'Asset Fingerprint'
957
- @description: 'CIP-14 fingerprint of the first minted asset (e.g. asset1...). Convenience field for single-asset mints.'
958
- fingerprint : String(44);
959
-
960
- @title : 'Script Address'
961
- @description: 'Enterprise script address derived from the applied script hash (bech32). Only set when lockOnScript=true.'
962
- scriptAddress : String(120);
963
-
964
- @title : 'Forced Inputs Used'
965
- @description: 'Number of forced inputs (from forceInputsJson) actually included in the built transaction. 0 when forceInputsJson was not provided.'
966
- forcedInputsUsed : Integer;
967
-
968
- @title : 'Reference Inputs Used'
969
- @description: 'Number of CIP-31 reference inputs (from referenceInputsJson) included in the built transaction. 0 when referenceInputsJson was not provided.'
970
- referenceInputsUsed : Integer;
971
-
972
- @title : 'Collateral Available'
973
- @description: 'Indicates if collateral UTxOs were already available (SetCollateral only). When true, no transaction build was needed.'
974
- collateralAvailable : Boolean;
975
- }
976
-
977
- @title : 'Transaction Build Inputs'
978
- @description: 'Entity for storing transaction build input details'
979
- entity TransactionBuildInputs {
980
-
981
- @title : 'Build (key)'
982
- @description: 'Association to parent transaction build'
983
- key build : Association to TransactionBuilds;
984
-
985
- @title : 'Input Index (key)'
986
- @description: 'Index of the input in the transaction build'
987
- key inputIndex : Integer;
988
-
989
- @title : 'UTxO Transaction Hash'
990
- @description: 'UTxO transaction hash'
991
- txHash : Blake2b256;
992
-
993
- @title : 'UTxO Output Index'
994
- @description: 'UTxO output index'
995
- outputIndex : Integer;
996
-
997
- @title : 'Input Address'
998
- @description: 'UTxO address'
999
- address : Bech32;
1000
-
1001
- @title : 'Input Lovelace Amount'
1002
- @description: 'Lovelace amount of the input UTxO'
1003
- lovelace : Lovelace;
1004
-
1005
- @title : 'Input Assets'
1006
- @description: 'Assets associated with the input UTxO'
1007
- assets : Composition of many TransactionBuildInputAssets
1008
- on assets.input = $self;
1009
-
1010
- @title : 'Input Has Assets'
1011
- @description: 'Indicates if input has native assets'
1012
- hasAssets : Boolean;
1013
- }
1014
-
1015
- @title : 'Transaction Build Input Assets'
1016
- @description: 'Entity for storing assets associated with transaction build inputs'
1017
- entity TransactionBuildInputAssets {
1018
-
1019
- @title : 'Transaction Build Input (key)'
1020
- @description: 'Build input association'
1021
- key input : Association to TransactionBuildInputs;
1022
-
1023
- @title : 'Asset Unit (key)'
1024
- @description: 'Asset unit (policyId + assetNameHex)'
1025
- key unit : AssetUnit;
1026
-
1027
- @title : 'Asset Details'
1028
- @description: 'Structural slice for asset details'
1029
- asset : AssetSlice;
1030
- }
1031
-
1032
- @title : 'Transaction Build Outputs'
1033
- @description: 'Entity for storing transaction build output details'
1034
- entity TransactionBuildOutputs {
1035
-
1036
- @title : 'Build (key)'
1037
- @description: 'Association to parent transaction build'
1038
- key build : Association to TransactionBuilds;
1039
-
1040
- @title : 'Output Index (key)'
1041
- @description: 'Index in outputs array'
1042
- key outputIndex : Integer;
1043
-
1044
- @title : 'Recipient Address'
1045
- @description: 'Recipient address in bech32 format'
1046
- address : Bech32;
1047
-
1048
- @title : 'Lovelace Amount'
1049
- @description: 'Lovelace amount to send'
1050
- lovelace : Lovelace;
1051
-
1052
- @title : 'Is Change Output'
1053
- @description: 'Indicates if this is the change output'
1054
- isChange : Boolean;
1055
-
1056
- @title : 'Output Assets'
1057
- @description: 'Assets associated with this output'
1058
- assets : Composition of many TransactionBuildOutputAssets
1059
- on assets.output = $self;
1060
-
1061
- @title : 'Has Assets'
1062
- @description: 'Indicates if output has native assets'
1063
- hasAssets : Boolean;
1064
- }
1065
-
1066
- @title : 'Transaction Build Output Assets'
1067
- @description: 'Entity for storing assets associated with transaction build outputs'
1068
- entity TransactionBuildOutputAssets {
1069
-
1070
- @title : 'Transaction Build Output (key)'
1071
- @description: 'Association to parent transaction build output'
1072
- key output : Association to TransactionBuildOutputs;
1073
-
1074
- @title : 'Asset Unit (key)'
1075
- @description: 'Asset unit (policyId + assetNameHex)'
1076
- key unit : AssetUnit;
1077
-
1078
- @title : 'Asset Details'
1079
- @description: 'Structural slice for asset details'
1080
- asset : AssetSlice;
1081
-
1082
- }
1083
-
1084
- @title : 'Transaction Submissions'
1085
- @description: 'Entity for storing transaction submission attempts and status'
1086
- entity TransactionSubmissions {
1087
-
1088
- @title : 'Submission ID (key)'
1089
- @description: 'Unique identifier for the transaction submission'
1090
- key id : UUID;
1091
-
1092
- @title : 'Associated Build'
1093
- @description: 'Association to the transaction build being submitted'
1094
- build : Association to TransactionBuilds;
1095
-
1096
- @title : 'Signged Tx CBOR'
1097
- @description: 'The signed transaction CBOR as hex string'
1098
- signedTxCbor : LargeString;
1099
-
1100
- @title : 'Transaction Hash'
1101
- @description: 'Actual transaction hash after signing'
1102
- txHash : Blake2b256;
1103
-
1104
- @title : 'Submission Time'
1105
- @description: 'Submission time as unix timestamp'
1106
- submittedAt : Integer64;
1107
-
1108
- @title : 'Submission Status'
1109
- @description: 'Current status of the transaction submission (pending, submitted, confirmed, failed, rejected)'
1110
- status : SubmissionStatus default 'pending' @readonly;
1111
-
1112
- @title : 'Error Code'
1113
- @description: 'Error code if failed'
1114
- errorCode : String(50);
1115
-
1116
- @title : 'Error Message'
1117
- @description: 'Detailed error message if failed'
1118
- errorMessage : LargeString;
1119
-
1120
- @title : 'Retry Count'
1121
- @description: 'Number of retry attempts'
1122
- retryCount : Integer;
1123
-
1124
- @title : 'Submission Errors'
1125
- @description: 'Composition of errors associated with this submission'
1126
- errors : Composition of many TransactionSubmissionErrors
1127
- on errors.submission = $self;
1128
-
1129
- @title : 'Has Errors'
1130
- @description: 'Indicates if submission has errors'
1131
- hasErrors : Boolean;
1132
- }
1133
-
1134
- @title : 'Transaction Submission Errors'
1135
- @description: 'Entity for storing errors encountered during transaction submission'
1136
- entity TransactionSubmissionErrors {
1137
-
1138
- @title : 'Error ID (key)'
1139
- @description: 'Unique identifier for the submission error'
1140
- key id : UUID;
1141
-
1142
- @title : 'Associated Submission'
1143
- @description: 'Association to parent transaction submission'
1144
- submission : Association to TransactionSubmissions;
1145
-
1146
- @title : 'Error Occurred At'
1147
- @description: 'Timestamp when the error occurred as unix timestamp'
1148
- occurredAt : Integer64;
1149
-
1150
- @title : 'Error Type'
1151
- @description: 'Type/category of the error encountered'
1152
- errorType : String(50);
1153
-
1154
- @title : 'Error Code'
1155
- @description: 'Specific error code'
1156
- errorCode : String(50);
1157
-
1158
- @title : 'Error Message'
1159
- @description: 'Detailed error message'
1160
- errorMessage : LargeString;
1161
-
1162
- @title : 'Error Details'
1163
- @description: 'Additional error context as JSON'
1164
- errorDetails : LargeString;
1165
-
1166
- @title : 'Is Recoverable'
1167
- @description: 'Indicates if error is recoverable via retry'
1168
- isRecoverable : Boolean;
1169
- }
1170
-
1171
- //-----------------------------------------------------
1172
- // M3 - External Signing Workflow Entities & Address Additions
1173
- //-----------------------------------------------------
1174
-
1175
- @title : 'Address Transactions'
1176
- @description : 'Association entity for transactions involving an address'
1177
- entity AddressTransactions {
1178
-
1179
- @title : 'Address (key)'
1180
- @description: 'The Bech32 encoded address associated with the transaction'
1181
- key address : Association to Addresses;
1182
-
1183
- @title : 'Transaction (key)'
1184
- @description: 'The associated transaction'
1185
- key tx : Association to Transactions;
1186
-
1187
- @title : 'Net Amount (Lovelace)'
1188
- @description: 'Net lovelace change for this address in this transaction (positive = received, negative = sent)'
1189
- netAmount : Decimal(20, 0);
1190
-
1191
- @title : 'Block Time'
1192
- @description: 'Block time of the transaction (denormalized for sorting)'
1193
- blockTime : Integer64;
1194
-
1195
- @title : 'Net Assets'
1196
- @description: 'JSON array of net asset changes [{unit, policyId, assetName, quantity}] (positive = received, negative = sent)'
1197
- netAssets : LargeString;
1198
-
1199
- @title : 'Has Assets'
1200
- @description: 'Indicates if this transaction involves native assets for this address'
1201
- hasAssets : Boolean default false;
1202
- }
1203
-
1204
- @title : 'Address Signing Requests'
1205
- @description : 'Association entity for signing requests involving an address'
1206
- entity AddressSigningRequests {
1207
-
1208
- @title : 'Address (key)'
1209
- @description: 'The Bech32 encoded address associated with the signing request'
1210
- key address : Association to Addresses;
1211
-
1212
- @title : 'Signing Request (key)'
1213
- @description: 'The associated signing request'
1214
- key signingRequest : Association to SigningRequests;
1215
- }
1216
-
1217
- @title : 'Address Transaction Builds'
1218
- @description : 'Association entity for transaction builds involving an address'
1219
- entity AddressTransactionBuilds{
1220
-
1221
- @title : 'Address (key)'
1222
- @description: 'The Bech32 encoded address associated with the transaction build'
1223
- key address : Association to Addresses;
1224
-
1225
- @title : 'Transaction Build (key)'
1226
- @description: 'The associated transaction build'
1227
- key txBuild : Association to TransactionBuilds;
1228
- }
1229
-
1230
- @title : 'Signing Requests'
1231
- @description: 'Entity for tracking external signing requests and their workflow state'
1232
- entity SigningRequests {
1233
-
1234
- @title : 'Signing Request ID (key)'
1235
- @description: 'Unique identifier for the signing request'
1236
- key id : UUID;
1237
-
1238
- @title : 'Associated Build'
1239
- @description: 'Association to the transaction build being signed'
1240
- build : Association to TransactionBuilds;
1241
-
1242
- @title : 'Transaction Body Hash'
1243
- @description: 'The hash of the transaction body (data to be signed)'
1244
- txBodyHash : Blake2b256;
1245
-
1246
- @title : 'Unsigned Transaction CBOR'
1247
- @description: 'The unsigned transaction in CBOR hex format'
1248
- unsignedTxCbor : LargeString;
1249
-
1250
- @title : 'Network'
1251
- @description: 'Cardano network (mainnet | preprod | preview)'
1252
- network : String(10);
1253
-
1254
- @title : 'Status'
1255
- @description: 'Current status of the signing request'
1256
- status : SigningStatus default 'pending' @readonly;
1257
-
1258
- @title : 'Created At'
1259
- @description: 'Timestamp when the signing request was created'
1260
- createdAt : Timestamp;
1261
-
1262
- @title : 'Expires At'
1263
- @description: 'Timestamp when the signing request expires'
1264
- expiresAt : Timestamp;
1265
-
1266
- @title : 'Signed At'
1267
- @description: 'Timestamp when the transaction was signed'
1268
- signedAt : Timestamp;
1269
-
1270
- @title : 'Submitted At'
1271
- @description: 'Timestamp when the transaction was submitted'
1272
- submittedAt : Timestamp;
1273
-
1274
- @title : 'Cardano CLI Command'
1275
- @description: 'Example command to sign with Cardano CLI'
1276
- cardanoCliCommand : LargeString;
1277
-
1278
- @title : 'CIP-30 CBOR'
1279
- @description: 'Transaction CBOR for browser wallet signing (CIP-30)'
1280
- cip30TxCbor : LargeString;
1281
-
1282
- @title : 'Signed Transaction CBOR'
1283
- @description: 'The full signed transaction CBOR, persisted at claim time on the deferred-submit path so an interrupted submission can be re-driven after a restart (see SUBMIT_DETACH_DESIGN.md)'
1284
- signedTxCbor : LargeString;
1285
-
1286
- @title : 'Signer Type'
1287
- @description: 'Type of signer used (cardano-cli | browser-wallet | hardware-wallet | custom)'
1288
- signerType : String(20);
1289
-
1290
- @title : 'Signer Info'
1291
- @description: 'Additional information about the signer (wallet name, etc.)'
1292
- signerInfo : String(100);
1293
-
1294
- @title : 'HSM Key ID'
1295
- @description: 'PKCS#11 key identifier used for HSM signing (audit trail)'
1296
- hsmKeyId : String(40);
1297
-
1298
- @title : 'Signature Verifications'
1299
- @description: 'Composition of signature verification attempts'
1300
- verifications : Composition of many SignatureVerifications
1301
- on verifications.signingRequest = $self;
1302
-
1303
- @title : 'Associated Submission'
1304
- @description: 'Association to the transaction submission (if submitted)'
1305
- submission : Association to TransactionSubmissions;
1306
-
1307
- @title : 'Error Message'
1308
- @description: 'Error message if signing or verification failed'
1309
- errorMessage : LargeString;
1310
- }
1311
-
1312
- @title : 'Signature Verifications'
1313
- @description: 'Entity for storing signature verification results'
1314
- entity SignatureVerifications {
1315
-
1316
- @title : 'Verification ID (key)'
1317
- @description: 'Unique identifier for the verification attempt'
1318
- key id : UUID;
1319
-
1320
- @title : 'Associated Signing Request'
1321
- @description: 'Association to the parent signing request'
1322
- signingRequest : Association to SigningRequests;
1323
-
1324
- @title : 'Signed Transaction CBOR'
1325
- @description: 'The signed transaction CBOR that was verified'
1326
- signedTxCbor : LargeString;
1327
-
1328
- @title : 'Is Valid'
1329
- @description: 'Whether the signature is valid'
1330
- isValid : Boolean;
1331
-
1332
- @title : 'Transaction Body Hash'
1333
- @description: 'The verified transaction body hash'
1334
- txBodyHash : Blake2b256;
1335
-
1336
- @title : 'Witness Count'
1337
- @description: 'Number of signatures found'
1338
- witnessCount : Integer;
1339
-
1340
- @title : 'Signer Key Hashes'
1341
- @description: 'JSON array of public key hashes that signed the transaction'
1342
- signerKeyHashes : LargeString;
1343
-
1344
- @title : 'Error Message'
1345
- @description: 'Error message if verification failed'
1346
- errorMessage : LargeString;
1347
-
1348
- @title : 'Warnings'
1349
- @description: 'JSON array of warning messages'
1350
- warnings : LargeString;
1351
-
1352
- @title : 'Verified At'
1353
- @description: 'Timestamp when the verification was performed'
1354
- verifiedAt : Timestamp;
1355
- }
1356
-
1357
- // -----------------------------------------------------
1358
- // Chain Crawler / Pre-Sync (v2.0)
1359
- // -----------------------------------------------------
1360
-
1361
- @title : 'Cardano Sync State'
1362
- @description: 'Singleton crawl cursor tracking the pre-sync progress of the chain crawler'
1363
- entity CardanoSyncState {
1364
-
1365
- @title : 'Cursor Id (Key)'
1366
- @description: 'Singleton key — always the literal string SINGLETON'
1367
- key ID : String(10) default 'SINGLETON';
1368
-
1369
- @title : 'Network'
1370
- @description: 'The Cardano network this cursor tracks (mainnet | preprod | preview)'
1371
- network : String(10);
1372
-
1373
- @title : 'Start Slot'
1374
- @description: 'Absolute slot of the configured pre-sync origin (immutable once syncing starts)'
1375
- startSlot : Integer64;
1376
-
1377
- @title : 'Start Block Hash'
1378
- @description: 'Block hash of the configured pre-sync origin'
1379
- startBlockHash : Blake2b256;
1380
-
1381
- @title : 'Last Slot'
1382
- @description: 'Absolute slot of the last indexed block (resume point)'
1383
- lastSlot : Integer64 default 0;
1384
-
1385
- @title : 'Last Block Hash'
1386
- @description: 'Hash of the last indexed block — used for the reorg parent-hash check'
1387
- lastBlockHash : Blake2b256;
1388
-
1389
- @title : 'Last Height'
1390
- @description: 'Block height of the last indexed block'
1391
- lastHeight : Integer64 default 0;
1392
-
1393
- @title : 'Last Indexed At'
1394
- @description: 'Wall-clock timestamp of the last successful block persist'
1395
- lastIndexedAt : Timestamp;
1396
-
1397
- @title : 'Tip Slot'
1398
- @description: 'Latest known chain-tip slot, for lag/progress calculation'
1399
- tipSlot : Integer64;
1400
-
1401
- @title : 'Tip Height'
1402
- @description: 'Latest known chain-tip height'
1403
- tipHeight : Integer64;
1404
-
1405
- @title : 'Sync Status'
1406
- @description: 'Current crawler state (stopped | syncing | synced | error)'
1407
- syncStatus : CrawlSyncStatus default 'stopped';
1408
-
1409
- // NOTE: live progress is computed by CardanoIndexerService.getStatus from
1410
- // lastHeight/tipHeight — deliberately NOT persisted here (a stored copy went
1411
- // stale immediately and misled OData readers).
1412
-
1413
- @title : 'Last Error'
1414
- @description: 'Message of the most recent crawler error (null when healthy)'
1415
- lastError : String(500);
1416
-
1417
- @title : 'Last Error At'
1418
- @description: 'Timestamp of the most recent crawler error'
1419
- lastErrorAt : Timestamp;
1420
-
1421
- @title : 'Consecutive Errors'
1422
- @description: 'Count of back-to-back failures; trips the circuit breaker past its threshold'
1423
- consecutiveErrors : Integer default 0;
1424
-
1425
- @title : 'Crawler Desired Running State'
1426
- @description: 'Cluster-wide operator intent. False fences every crawler instance before its next write.'
1427
- desiredRunning : Boolean default true;
1428
-
1429
- @title : 'Crawler Lease Owner'
1430
- @description: 'Opaque process identifier of the single crawler instance currently allowed to write'
1431
- leaseOwner : String(128);
1432
-
1433
- @title : 'Crawler Lease Expiry'
1434
- @description: 'Lease deadline renewed by the active crawler; another instance may take over only after this time'
1435
- leaseUntil : Timestamp;
1436
- }
1437
-
1438
- @title : 'Cardano Reorg Log'
1439
- @description: 'Audit trail of chain rollbacks (reorgs) handled by the crawler'
1440
- entity CardanoReorgLog {
1441
-
1442
- @title : 'Reorg Id (Key)'
1443
- @description: 'Unique identifier of the reorg event'
1444
- key ID : UUID;
1445
-
1446
- @title : 'Detected At'
1447
- @description: 'Timestamp when the rollback was detected'
1448
- detectedAt : Timestamp;
1449
-
1450
- @title : 'Fork Slot'
1451
- @description: 'Absolute slot of the common ancestor the chain rolled back to'
1452
- forkSlot : Integer64;
1453
-
1454
- @title : 'Fork Height'
1455
- @description: 'Block height of the common ancestor the chain rolled back to'
1456
- forkHeight : Integer64;
1457
-
1458
- @title : 'Old Tip Hash'
1459
- @description: 'Hash of the abandoned tip before the rollback'
1460
- oldTipHash : Blake2b256;
1461
-
1462
- @title : 'New Tip Hash'
1463
- @description: 'Hash of the block the chain rolled back to'
1464
- newTipHash : Blake2b256;
1465
-
1466
- @title : 'Blocks Rolled Back'
1467
- @description: 'Number of blocks (and their child rows) deleted during rollback'
1468
- blocksRolledBack : Integer;
1469
-
1470
- @title : 'Status'
1471
- @description: 'Lifecycle of the reorg handling (detected | rolling_back | reindexing | completed)'
1472
- status : ReorgStatus;
1473
- }
1474
-
1475
- // -----------------------------------------------------
1476
- // Wallet Worker / Job Engine (v2.1)
1477
- // -----------------------------------------------------
1478
-
1479
- @title : 'Cardano Worker Wallets'
1480
- @description: 'Operator-registered server-side wallets the wallet worker executes jobs from. No key material is ever stored here.'
1481
- entity CardanoWorkerWallets {
1482
-
1483
- @title : 'Wallet Id (Key)'
1484
- @description: 'Stable operator-chosen handle used in job requests'
1485
- key walletId : String(50);
1486
-
1487
- @title : 'Signer Type'
1488
- @description: 'How this wallet signs (hsm | software)'
1489
- signerType : WorkerSignerType;
1490
-
1491
- @title : 'Address'
1492
- @description: 'Bech32 address derived from the signing key at worker init (informational)'
1493
- address : Bech32;
1494
-
1495
- @title : 'Public Key Hash'
1496
- @description: 'Blake2b-224 hash of the wallet verification key'
1497
- publicKeyHash : Blake2b224;
1498
-
1499
- @title : 'Enabled'
1500
- @description: 'Disabled wallets accept no new jobs and are skipped by the dispatch loop'
1501
- enabled : Boolean default true;
1502
-
1503
- @title : 'Wallet Lease Owner'
1504
- @description: 'Opaque process identifier of the single worker instance currently allowed to execute jobs for this wallet'
1505
- leaseOwner : String(128);
1506
-
1507
- @title : 'Wallet Lease Expiry'
1508
- @description: 'Lease deadline renewed by the executing worker; another instance may take over only after this time'
1509
- leaseUntil : Timestamp;
1510
-
1511
- @title : 'Last Job At'
1512
- @description: 'Timestamp of the most recent job execution for this wallet'
1513
- lastJobAt : Timestamp;
1514
-
1515
- @title : 'Jobs Confirmed'
1516
- @description: 'Rolling count of jobs that reached confirmed state'
1517
- jobsConfirmed : Integer64 default 0;
1518
-
1519
- @title : 'Jobs Failed'
1520
- @description: 'Rolling count of jobs that reached failed state'
1521
- jobsFailed : Integer64 default 0;
1522
- }
1523
-
1524
- @title : 'Cardano Wallet Jobs'
1525
- @description: 'Asynchronous transaction jobs executed by the wallet worker (build → sign → submit → confirm)'
1526
- // Idempotency is enforced by the DATABASE, not by a read-before-insert check:
1527
- // concurrent retries of the same key (two app instances, or two HANA sessions)
1528
- // can both find no existing job and both insert. The unique constraint makes one
1529
- // of them lose, and insertJob returns the winner's job to it. See `dedupKey`.
1530
- // Generates a table UNIQUE constraint on SQLite and a UNIQUE INVERTED INDEX on HANA.
1531
- @assert.unique.dedup: [
1532
- walletId,
1533
- kind,
1534
- dedupKey
1535
- ]
1536
- entity CardanoWalletJobs {
1537
-
1538
- @title : 'Job Id (Key)'
1539
- @description: 'Unique identifier of the job, returned by SubmitWalletJob'
1540
- key ID : UUID;
1541
-
1542
- @title : 'Wallet Id'
1543
- @description: 'The worker wallet this job executes from'
1544
- walletId : String(50);
1545
-
1546
- @title : 'Job Kind'
1547
- @description: 'Transaction kind (simpleAda | metadata | multiAsset | mint | plutusSpend | submitSigned)'
1548
- kind : WalletJobKind;
1549
-
1550
- @title : 'Status'
1551
- @description: 'Job lifecycle state (pending | building | submitting | submitted | confirmed | failed | cancelled)'
1552
- status : WalletJobStatus default 'pending';
1553
-
1554
- @title : 'Idempotency Key'
1555
- @description: 'Optional caller-supplied dedup key — a non-failed job with the same (walletId, kind, idempotencyKey) is returned instead of creating a new one'
1556
- idempotencyKey : String(100);
1557
-
1558
- @title : 'Dedup Key (internal)'
1559
- @description: 'Backing value of the unique (walletId, kind, dedupKey) constraint: the caller idempotency key while the job holds it, otherwise the job ID (unique by construction). Keyless jobs and terminated jobs therefore never collide — no reliance on NULL semantics, which differ across databases.'
1560
- dedupKey : String(100);
1561
-
1562
- @title : 'Request'
1563
- @description: 'The build-action payload as JSON, verbatim (validated before insert; never contains key material)'
1564
- request : LargeString;
1565
-
1566
- @title : 'Priority'
1567
- @description: 'Dispatch order within a wallet queue — lower runs sooner (default 100)'
1568
- priority : Integer default 100;
1569
-
1570
- @title : 'Not Before'
1571
- @description: 'Optional earliest execution time (one-shot scheduling)'
1572
- notBefore : Timestamp;
1573
-
1574
- @title : 'Attempt'
1575
- @description: 'Number of execution attempts made so far'
1576
- attempt : Integer default 0;
1577
-
1578
- @title : 'Max Attempts'
1579
- @description: 'Bound for transient-failure retries (build/submit); deterministic rejections fail immediately'
1580
- maxAttempts : Integer default 3;
1581
-
1582
- @title : 'Transaction Hash'
1583
- @description: 'Hash of the signed transaction — persisted before the submit call (status submitting), so a crash mid-submit stays reconcilable'
1584
- txHash : Blake2b256;
1585
-
1586
- @title : 'Unsigned Transaction CBOR'
1587
- @description: 'The built unsigned transaction, kept for diagnosis until the job confirms'
1588
- unsignedTxCbor : LargeString;
1589
-
1590
- @title : 'Signed Transaction CBOR'
1591
- @description: 'The signed transaction, stored before submission — reused verbatim for crash reconciliation and rollback re-submission (never rebuilt)'
1592
- signedTxCbor : LargeString;
1593
-
1594
- @title : 'Fee'
1595
- @description: 'Transaction fee in lovelace, from the build result'
1596
- fee : Lovelace;
1597
-
1598
- @title : 'Submitted At'
1599
- @description: 'Timestamp of the submission attempt (written with the signed tx, before it is sent) — the base for the confirmation timeout'
1600
- submittedAt : Timestamp;
1601
-
1602
- @title : 'Confirmed At'
1603
- @description: 'Timestamp when the configured confirmation depth was reached'
1604
- confirmedAt : Timestamp;
1605
-
1606
- @title : 'Confirmed Slot'
1607
- @description: 'Absolute slot of the block containing the transaction — used for reorg checks'
1608
- confirmedSlot : Integer64;
1609
-
1610
- @title : 'Confirmed Height'
1611
- @description: 'Block height of the block containing the transaction — used for depth calculation'
1612
- confirmedHeight : Integer64;
1613
-
1614
- @title : 'Error Code'
1615
- @description: 'Machine-readable code of the terminal failure (null while healthy)'
1616
- errorCode : String(50);
1617
-
1618
- @title : 'Error Message'
1619
- @description: 'Human-readable message of the terminal failure'
1620
- errorMessage : String(500);
1621
-
1622
- @title : 'Created At'
1623
- @description: 'Timestamp the job was accepted'
1624
- createdAt : Timestamp;
1625
-
1626
- @title : 'Created By'
1627
- @description: 'User id of the caller that submitted the job'
1628
- createdBy : String(100);
1629
-
1630
- @title : 'Finished At'
1631
- @description: 'Timestamp the job reached a terminal state (confirmed | failed | cancelled)'
1632
- finishedAt : Timestamp;
1633
- }
1634
-
1635
- /**
1636
- * Agent grants (v2.0): scoped bearer capabilities an Admin hands to an agent
1637
- * instead of a full user. The token is a capability, not an identity — it is
1638
- * stored as SHA-256 only, and a request carrying it runs as the principal
1639
- * `agent:<ID>` with the role `agent-grant`, never as the operator. Enforcement
1640
- * (allow list, wallet pinning, daily budget) lives in srv/utils/agent-grants.ts;
1641
- * the transport lane that admits `x-agent-token` in srv/utils/agent-token-auth.ts.
1642
- * Admin-only table: creation and revocation happen through CardanoAgentService
1643
- * actions, a token request may read its own row only.
1644
- */
1645
- @title : 'Agent Grants'
1646
- @description: 'Scoped, budgeted bearer capabilities for agents (token stored as SHA-256 only)'
1647
- entity CardanoAgentGrants {
1648
-
1649
- @title : 'Grant Id (Key)'
1650
- key ID : UUID;
1651
-
1652
- @title : 'Operator'
1653
- @description: 'User id of the Admin that issued the grant (audit; the token never runs as this user)'
1654
- userId : String(200) not null;
1655
-
1656
- @title : 'Agent Label'
1657
- @description: 'Human-readable agent name, informational'
1658
- agentLabel : String(100);
1659
-
1660
- @title : 'Token Hash'
1661
- @description: 'SHA-256 of the bearer token; the token itself is shown once and never stored'
1662
- tokenHash : String(64) not null;
1663
-
1664
- @title : 'Allowed Actions'
1665
- @description: 'JSON array of allow-listed action names (builds, signing-request lifecycle, submits, wallet jobs)'
1666
- allowedActions : LargeString not null;
1667
-
1668
- @title : 'Wallet Id'
1669
- @description: 'Worker wallet this grant is pinned to; required for SubmitWalletJob / CancelJob, injected into those requests'
1670
- walletId : String(50);
1671
-
1672
- @title : 'Allowed Job Kinds'
1673
- @description: 'JSON array of WalletJobKind values the grant may queue; null = every kind'
1674
- allowedJobKinds : LargeString;
1675
-
1676
- @title : 'Max Jobs Per Day'
1677
- @description: 'Daily budget of allow-listed action calls (UTC day); null = unlimited'
1678
- maxJobsPerDay : Integer;
1679
-
1680
- @title : 'Jobs Used Today'
1681
- @description: 'Budget consumed inside budgetWindow'
1682
- jobsUsedToday : Integer default 0;
1683
-
1684
- @title : 'Budget Window'
1685
- @description: 'UTC day YYYY-MM-DD the counter belongs to'
1686
- budgetWindow : String(10);
1687
-
1688
- @title : 'Valid Until'
1689
- @description: 'Expiry; null = no expiry'
1690
- validUntil : Timestamp;
1691
-
1692
- @title : 'Is Active'
1693
- @description: 'False once revoked; a revoked token is an unknown token'
1694
- isActive : Boolean default true;
1695
-
1696
- @title : 'Revoked At'
1697
- revokedAt : Timestamp;
1698
-
1699
- @title : 'Created At'
1700
- createdAt : Timestamp;
1701
-
1702
- @title : 'Last Used At'
1703
- @description: 'Last request admitted under this token (updated at most once a minute)'
1704
- lastUsedAt : Timestamp;
1705
- }
1706
-
1707
- /**
1708
- * Daily per-action counters of admitted calls under a grant (feeds
1709
- * CardanoAgentService.GetGrantUsage). Written by the enforcement hook next to
1710
- * the daily budget: `calls + 1` when a call is admitted, `refunded + 1` when the
1711
- * handler then refuses its input. Not exposed as an entity — the function is
1712
- * the contract. A few dozen rows per grant and day at most; no retention job yet.
1713
- */
1714
- entity CardanoAgentGrantUsage {
1715
-
1716
- @title : 'Grant'
1717
- key grant : Association to CardanoAgentGrants;
1718
-
1719
- @title : 'Day'
1720
- @description: 'UTC day YYYY-MM-DD the call was admitted on'
1721
- key day : String(10);
1722
-
1723
- @title : 'Service'
1724
- @description: 'CAP service name (CardanoTransactionService, CardanoSignService, ...)'
1725
- key service : String(60);
1726
-
1727
- @title : 'Action'
1728
- @description: 'Action name (BuildSimpleAdaTransaction, SubmitTransaction, ...)'
1729
- key action : String(100);
1730
-
1731
- @title : 'Calls'
1732
- @description: 'Admitted calls (budget charged where the grant has one)'
1733
- calls : Integer default 0;
1734
-
1735
- @title : 'Refunded'
1736
- @description: 'Admitted calls whose handler refused the input (400..428); their unit was given back'
1737
- refunded : Integer default 0;
1738
- }
1
+ using {temporal, } from '@sap/cds/common';
2
+ using {Lovelace, Blake2b224, Blake2b256, HexBytes, Bech32, AssetUnit, AssetSlice, SigningStatus,SubmissionStatus, UTxODataSlice, MetadataLabel, CrawlSyncStatus, ReorgStatus, WalletJobStatus, WalletJobKind, WorkerSignerType} from '../db/types';
3
+
4
+ namespace odatano.cardano;
5
+
6
+ @title : 'Network Information Entity'
7
+ @description: 'General information entity definition'
8
+ entity NetworkInformation : temporal {
9
+
10
+ @title : 'Network (key)'
11
+ @description: 'The Cardano network type mainnet | preprod | preview'
12
+ key network : String(10);
13
+
14
+ @title : 'Max Supply'
15
+ @description: 'The maximum supply of ADA'
16
+ maxSupply : Lovelace;
17
+
18
+ @title : 'Total Supply'
19
+ @description: 'Current total supply of ADA'
20
+ totalSupply : Lovelace;
21
+
22
+ @title : 'Circulating Supply'
23
+ @description: 'Current circulating supply of ADA'
24
+ circulatingSupply : Lovelace;
25
+
26
+ @title : 'Locked Supply'
27
+ @description: 'Current locked supply of ADA'
28
+ lockedSupply : Lovelace;
29
+
30
+ @title : 'Treasury Supply'
31
+ @description: 'Current treasury supply of ADA'
32
+ treasurySupply : Lovelace;
33
+
34
+ @title : 'Reserves Supply'
35
+ @description: 'Current reserves supply of ADA'
36
+ reservesSupply : Lovelace;
37
+
38
+ @title : 'Live Stake'
39
+ @description: 'Current live stake of ADA'
40
+ liveStake : Lovelace;
41
+
42
+ @title : 'Active Stake'
43
+ @description: 'Current active stake of ADA'
44
+ activeStake : Lovelace;
45
+ }
46
+
47
+ @title : 'Block Entity'
48
+ @description: 'Block information entity definition'
49
+ @readonly
50
+ entity Blocks {
51
+
52
+ @title : 'Block Hash (Key)'
53
+ @description: 'Block hash as hex string'
54
+ key hash : String(64);
55
+
56
+ @title : 'Block Time'
57
+ @description: 'Block time as ISO 8601 string'
58
+ time : String;
59
+
60
+ @title : 'Block Height'
61
+ @description: 'Block height as integer'
62
+ height : Integer;
63
+
64
+ @title : 'Block SlotLeader'
65
+ @description: 'Slot leader id as hex string'
66
+ slotLeader : String;
67
+
68
+ @title : 'Block Epoch Number'
69
+ @description: 'Epoch number as integer'
70
+ epochNumber : Integer;
71
+
72
+ @title : 'Block epoch Association'
73
+ @description: 'Association to Epochs entity'
74
+ epoch : Association to Epochs
75
+ on epoch.epoch = $self.epochNumber;
76
+
77
+ @title : 'Block Absolute Slot'
78
+ @description: 'Absolute slot number of the block'
79
+ slot : Integer64;
80
+
81
+ @title : 'Block Slot within Epoch'
82
+ @description: 'Slot number within the epoch as integer'
83
+ epochSlot : Integer;
84
+
85
+ @title : 'Block Size'
86
+ @description: 'Block size in bytes'
87
+ size : Integer;
88
+
89
+ @title : 'Block Transaction Count'
90
+ @description: 'Number of transactions in the block'
91
+ txCount : Integer;
92
+
93
+ @title : 'Block Fees'
94
+ @description: 'Total fees in the block'
95
+ fees : Lovelace;
96
+ }
97
+
98
+ @title : 'Epoch Entity'
99
+ @description: 'Epoch information entity definition'
100
+ @readonly
101
+ entity Epochs {
102
+
103
+ @title : 'Epoch Number (Key)'
104
+ @description: 'Epoch number as integer'
105
+ key epoch : Integer;
106
+
107
+ @title : 'Epoch Start Time'
108
+ @description: 'Epoch start time as unix timestamp (seconds)'
109
+ startTime : Integer64; // Integer (32-bit) overflows on 2038-01-19
110
+
111
+ @title : 'Epoch End Time'
112
+ @description: 'Epoch end time as unix timestamp (seconds)'
113
+ endTime : Integer64;
114
+
115
+ @title : 'First Block Time'
116
+ @description: 'First block time as unix timestamp (seconds)'
117
+ firstBlockTime : Integer64;
118
+
119
+ @title : 'Last Block Time'
120
+ @description: 'Last block time as unix timestamp (seconds)'
121
+ lastBlockTime : Integer64;
122
+
123
+ @title : 'Block Count'
124
+ @description: 'Number of blocks in the epoch'
125
+ blockCount : Integer;
126
+
127
+ @title : 'Transaction Count'
128
+ @description: 'Number of transactions in the epoch'
129
+ txCount : Integer;
130
+
131
+ @title : 'Total Output'
132
+ @description: 'Total output in the epoch as string to avoid precision issues'
133
+ output : String;
134
+
135
+ @title : 'Total Fees'
136
+ @description: 'Total fees in the epoch'
137
+ fees : Lovelace;
138
+
139
+ @title : 'Active Stake'
140
+ @description: 'Total active stake in the epoch'
141
+ activeStake : Lovelace;
142
+ }
143
+
144
+ @title : 'Pool Entity'
145
+ @description: 'Stake pool information entity definition'
146
+ entity Pools : temporal {
147
+
148
+ @title : 'Pool Id (Key)'
149
+ @description: 'Unique stake pool identifier'
150
+ key poolId : Bech32;
151
+
152
+ @title : 'VRF Key Hash'
153
+ @description: 'Pool VRF key hash as hex string'
154
+ vrfKeyHash : String;
155
+
156
+ @title : 'Blocks Minted'
157
+ @description: 'Total number of blocks minted by the pool'
158
+ blocksMinted : Integer;
159
+
160
+ @title : 'Blocks in Epoch'
161
+ @description: 'Number of blocks minted in the current epoch'
162
+ blocksEpoch : Integer;
163
+
164
+ @title : 'Live Stake'
165
+ @description: 'Current live stake delegated to the pool'
166
+ liveStake : Lovelace;
167
+
168
+ @title : 'Live Size'
169
+ @description: 'Current live size as fraction of total active stake'
170
+ liveSize : Decimal(5, 4);
171
+
172
+ @title : 'Live Saturation'
173
+ @description: 'Current live saturation as fraction of ideal size (1.0 = 100% saturated)'
174
+ liveSaturation : Decimal(5, 4);
175
+
176
+ @title : 'Live Delegators'
177
+ @description: 'Current number of live delegators'
178
+ liveDelegators : Integer;
179
+
180
+ @title : 'Active Stake'
181
+ @description: 'Current active stake delegated to the pool'
182
+ activeStake : Lovelace;
183
+
184
+ @title : 'Active Size'
185
+ @description: 'Current active size as fraction'
186
+ activeSize : Decimal(5, 4);
187
+
188
+ @title : 'Pledge'
189
+ @description: 'Pool pledge in lovelace'
190
+ pledge : Lovelace;
191
+
192
+ @title : 'Margin'
193
+ @description: 'Pool margin as fraction'
194
+ margin : Decimal(5, 4);
195
+
196
+ @title : 'Fixed Cost'
197
+ @description: 'Pool fixed cost in lovelace'
198
+ fixedCost : Lovelace;
199
+
200
+ @title : 'Reward Account'
201
+ @description: 'Pool reward account in bech32 format'
202
+ rewardAccount : String;
203
+ }
204
+
205
+ @title : 'Pool Epoch Snapshot Entity'
206
+ @description: 'Stake-pool state as observed once per epoch by the chain crawler. Non-temporal: each row is a dated observation, not a cached slice, so the crawled range is a true time series. Written only when the crawler runs with epochSnapshots enabled, an enumerating backend (Koios) is configured, and the crawl is at the chain tip — the provider reports the pool set as it is now, so an epoch passed during a backfill is skipped rather than filled with current figures.'
207
+ entity PoolEpochSnapshots {
208
+
209
+ @title : 'Pool Id (Key)'
210
+ @description: 'Unique stake pool identifier'
211
+ key poolId : Bech32;
212
+
213
+ @title : 'Epoch (Key)'
214
+ @description: 'Epoch the observation belongs to — the epoch running at snapshotSlot'
215
+ key epoch : Integer;
216
+
217
+ @title : 'Snapshot Slot'
218
+ @description: 'Absolute slot of the block that triggered the snapshot'
219
+ snapshotSlot : Integer64;
220
+
221
+ @title : 'Snapshot Time'
222
+ @description: 'Unix timestamp of the block that triggered the snapshot'
223
+ snapshotTime : Integer64;
224
+
225
+ @title : 'Blocks Minted'
226
+ @description: 'Total number of blocks minted by the pool'
227
+ blocksMinted : Integer;
228
+
229
+ @title : 'Blocks in Epoch'
230
+ @description: 'Number of blocks minted in the epoch that was running at snapshot time'
231
+ blocksEpoch : Integer;
232
+
233
+ @title : 'Live Stake'
234
+ @description: 'Live stake delegated to the pool'
235
+ liveStake : Lovelace;
236
+
237
+ @title : 'Live Size'
238
+ @description: 'Live size as fraction of total active stake'
239
+ liveSize : Decimal(5, 4);
240
+
241
+ @title : 'Live Saturation'
242
+ @description: 'Live saturation as fraction of ideal size (1.0 = 100% saturated)'
243
+ liveSaturation : Decimal(5, 4);
244
+
245
+ @title : 'Live Delegators'
246
+ @description: 'Number of live delegators'
247
+ liveDelegators : Integer;
248
+
249
+ @title : 'Active Stake'
250
+ @description: 'Active stake delegated to the pool'
251
+ activeStake : Lovelace;
252
+
253
+ @title : 'Active Size'
254
+ @description: 'Active size as fraction'
255
+ activeSize : Decimal(5, 4);
256
+
257
+ @title : 'Pledge'
258
+ @description: 'Pool pledge in lovelace'
259
+ pledge : Lovelace;
260
+
261
+ @title : 'Margin'
262
+ @description: 'Pool margin as fraction'
263
+ margin : Decimal(5, 4);
264
+
265
+ @title : 'Fixed Cost'
266
+ @description: 'Pool fixed cost in lovelace'
267
+ fixedCost : Lovelace;
268
+ }
269
+
270
+ @title : 'Drep Epoch Snapshot Entity'
271
+ @description: 'DRep state as observed once per epoch by the chain crawler. Non-temporal, tip-only, same reasoning as PoolEpochSnapshots.'
272
+ entity DrepEpochSnapshots {
273
+
274
+ @title : 'Drep Id (Key)'
275
+ @description: 'Unique drep identifier'
276
+ key drepId : Bech32;
277
+
278
+ @title : 'Epoch (Key)'
279
+ @description: 'Epoch the observation belongs to — the epoch running at snapshotSlot'
280
+ key epoch : Integer;
281
+
282
+ @title : 'Snapshot Slot'
283
+ @description: 'Absolute slot of the block that triggered the snapshot'
284
+ snapshotSlot : Integer64;
285
+
286
+ @title : 'Snapshot Time'
287
+ @description: 'Unix timestamp of the block that triggered the snapshot'
288
+ snapshotTime : Integer64;
289
+
290
+ @title : 'Vote Power'
291
+ @description: 'Amount of vote power in lovelace'
292
+ amount : Lovelace;
293
+
294
+ @title : 'Has Script'
295
+ @description: 'Indicates if drep is a script drep'
296
+ hasScript : Boolean;
297
+
298
+ @title : 'Last Active Epoch'
299
+ @description: 'Epoch number of last activity'
300
+ lastActiveEpoch : Integer;
301
+
302
+ @title : 'Retired'
303
+ @description: 'Indicates if drep is retired'
304
+ retired : Boolean;
305
+
306
+ @title : 'Expired'
307
+ @description: 'Indicates if drep is expired'
308
+ expired : Boolean;
309
+ }
310
+
311
+ @title : 'Asset Entity'
312
+ @description: 'Native-asset information entity (supply, mint history, CIP-25 + CIP-26 metadata)'
313
+ entity Assets : temporal {
314
+
315
+ @title : 'Asset Unit (Key)'
316
+ @description: 'Concatenation of policyId (56 hex) and assetNameHex (0-64 hex, the 32-byte ledger cap)'
317
+ key unit : AssetUnit;
318
+
319
+ @title : 'Policy ID'
320
+ @description: 'Blake2b-224 hash of the minting policy script (56-char hex)'
321
+ policyId : Blake2b224;
322
+
323
+ @title : 'Asset Name Hex'
324
+ @description: 'Asset name as hex string (0-32 bytes / 0-64 hex chars)'
325
+ assetNameHex : String(64); // 32-byte ledger cap = 64 hex (was HexBytes=String(5000))
326
+
327
+ @title : 'Asset Name'
328
+ @description: 'Asset name as UTF-8 string when decodable'
329
+ assetName : String(128);
330
+
331
+ @title : 'Asset Fingerprint'
332
+ @description: 'CIP-14 asset fingerprint (asset1...)'
333
+ fingerprint : String(44);
334
+
335
+ @title : 'Total Supply'
336
+ @description: 'Current total supply (BigInt-safe decimal string)'
337
+ totalSupply : String(40);
338
+
339
+ @title : 'Mint or Burn Count'
340
+ @description: 'Total number of mint/burn transactions for this asset'
341
+ mintOrBurnCount : Integer;
342
+
343
+ @title : 'Initial Mint Tx Hash'
344
+ @description: 'Hash of the transaction that first minted this asset'
345
+ initialMintTxHash : Blake2b256;
346
+
347
+ @title : 'Initial Mint Time'
348
+ @description: 'Unix timestamp of the initial mint (null when unavailable from backend, e.g. Blockfrost)'
349
+ initialMintTime : Integer64;
350
+
351
+ @title : 'On-Chain Metadata'
352
+ @description: 'CIP-25 on-chain metadata as JSON string (varies per minter)'
353
+ onchainMetadata : LargeString;
354
+
355
+ @title : 'Registry Name'
356
+ @description: 'CIP-26 off-chain registry: human-readable name'
357
+ registryName : String(128);
358
+
359
+ @title : 'Registry Ticker'
360
+ @description: 'CIP-26 off-chain registry: ticker symbol'
361
+ registryTicker : String(16);
362
+
363
+ @title : 'Registry Decimals'
364
+ @description: 'CIP-26 off-chain registry: decimal precision'
365
+ registryDecimals : Integer;
366
+
367
+ @title : 'Registry Description'
368
+ @description: 'CIP-26 off-chain registry: human-readable description'
369
+ registryDescription : LargeString;
370
+
371
+ @title : 'Registry URL'
372
+ @description: 'CIP-26 off-chain registry: project URL'
373
+ registryUrl : String(256);
374
+
375
+ @title : 'Registry Logo'
376
+ @description: 'CIP-26 off-chain registry: base64-encoded logo or URL'
377
+ registryLogo : LargeString;
378
+ }
379
+
380
+ @title : 'Asset History Entry'
381
+ @description: 'Mint or burn event for a native asset. Immutable on-chain — entries are never updated, only inserted. Free-standing (not a Composition) so history can be queried before/without the parent Assets row.'
382
+ @readonly
383
+ entity AssetHistory {
384
+
385
+ @title : 'Asset Unit (Key)'
386
+ @description: 'policyId + assetNameHex (concatenated hex)'
387
+ key unit : AssetUnit;
388
+
389
+ @title : 'Transaction Hash (Key)'
390
+ @description: 'Hash of the transaction that performed the mint or burn'
391
+ key txHash : Blake2b256;
392
+
393
+ @title : 'Action'
394
+ @description: 'mint or burn'
395
+ action : String(10);
396
+
397
+ @title : 'Quantity'
398
+ @description: 'Absolute mint/burn amount (BigInt-safe decimal string; always positive — sign info is in `action`)'
399
+ quantity : String(40);
400
+
401
+ @title : 'Block Time'
402
+ @description: 'Unix timestamp of the containing block (null when backend does not provide, e.g. Blockfrost without extra tx fetch)'
403
+ blockTime : Integer64;
404
+
405
+ @title : 'Block Height'
406
+ @description: 'Block height of the containing block (null when backend does not provide)'
407
+ blockHeight : Integer;
408
+ }
409
+
410
+ @title : 'Drep Entity'
411
+ @description: 'Drep information entity definition'
412
+ entity Dreps : temporal {
413
+
414
+ @title : 'Drep Id (Key)'
415
+ @description: 'Unique drep identifier'
416
+ key drepId : Bech32;
417
+
418
+ @title : 'Drep VRF Key Hash'
419
+ @description: 'Drep VRF key hash as hex string'
420
+ hex : String;
421
+
422
+ @title : 'Vote Power'
423
+ @description: 'Amount of vote power in lovelace'
424
+ amount : Lovelace;
425
+
426
+ @title : 'Has Script'
427
+ @description: 'Indicates if drep is a script drep'
428
+ hasScript : Boolean;
429
+
430
+ @title : 'Last Active Epoch'
431
+ @description: 'Epoch number of last activity'
432
+ lastActiveEpoch : Integer;
433
+
434
+ @title : 'Retired'
435
+ @description: 'Indicates if drep is retired'
436
+ retired : Boolean;
437
+
438
+ @title : 'Expired'
439
+ @description: 'Indicates if drep is expired'
440
+ expired : Boolean;
441
+ }
442
+
443
+ @title : 'Address Entity'
444
+ @description: 'Address information entity definition'
445
+ entity Addresses : temporal {
446
+
447
+ @title : 'Bech32 Address (Key)'
448
+ @description: 'The Bech32 encoded address string'
449
+ key address : Bech32;
450
+
451
+ @title : 'Associated Stake Address'
452
+ @description: 'The associated stake address in bech32 format'
453
+ stakeAddress : Bech32;
454
+
455
+ @title : 'Address Type'
456
+ @description: 'The type of address (base | enterprise | pointer | reward | script | unknown)'
457
+ type : String(20);
458
+
459
+ @title : 'Is Script Address'
460
+ @description: 'Indicates if the address is a script address'
461
+ isScript : Boolean;
462
+
463
+ @title : 'Total Lovelace'
464
+ @description: 'Total lovelace on this address'
465
+ totalLovelace : Lovelace;
466
+
467
+ @title : 'UTxO Count'
468
+ @description: 'Number of UTxOs at this address (pre-aggregated, no UTxO scan needed for status checks)'
469
+ utxoCount : Integer;
470
+
471
+ @title : 'Address Transactions'
472
+ @description : 'Composition of all transactions involving this address'
473
+ transactions : Composition of many AddressTransactions
474
+ on transactions.address = $self;
475
+
476
+ @title : 'Address Assets'
477
+ @description: 'Composition of all assets on this address'
478
+ assets : Composition of many AddressAssets
479
+ on assets.address = $self;
480
+
481
+ @title : 'Address UTxOs'
482
+ @description: 'Composition of all UTxOs on this address'
483
+ utxos : Composition of many AddressUTxOs
484
+ on utxos.address = $self;
485
+
486
+ @title : 'Address Has Transactions'
487
+ @description : 'Indicates if address has transactions'
488
+ hasTransactions : Boolean;
489
+
490
+ @title : 'Address Has Assets'
491
+ @description: 'Indicates if address has native assets'
492
+ hasAssets : Boolean;
493
+
494
+ @title : 'Address Has UTxOs'
495
+ @description: 'Indicates if address has UTxOs'
496
+ hasUTxOs : Boolean;
497
+
498
+
499
+ }
500
+
501
+ @title : 'Address Assets'
502
+ @description: 'Association entity for assets held by an address'
503
+ entity AddressAssets : temporal {
504
+
505
+ @title : 'Address (key)'
506
+ @description: 'The Bech32 encoded address associated with the asset'
507
+ key address : Association to Addresses;
508
+
509
+ @title : 'Asset Unit (key)'
510
+ @description: 'The unique identifier for the asset unit'
511
+ key unit : AssetUnit;
512
+
513
+ @title : 'Asset Details'
514
+ @description: 'Structural slice for asset details'
515
+ asset : AssetSlice;
516
+ }
517
+
518
+ @title : 'Address UTxOs'
519
+ @description: 'Association entity for UTxOs held by an address'
520
+ entity AddressUTxOs : temporal {
521
+
522
+ @title : 'Address (key)'
523
+ @description: 'The Bech32 encoded address associated with the UTxO'
524
+ key address : Association to Addresses;
525
+
526
+ @title : 'UTxO Key (key)'
527
+ @description: 'The unique identifier for the UTxO (tx hash + index)'
528
+ key hash : Blake2b256;
529
+
530
+ @title : 'UTxO Index (key)'
531
+ @description: 'The output index of the UTxO'
532
+ key index : Integer;
533
+
534
+ @title : 'Block Hash'
535
+ @description: 'Block hash containing the UTxO'
536
+ blockHash : Blake2b256;
537
+
538
+ @title : 'UTxO Data'
539
+ @description: 'UTxO specific data'
540
+ utxodata : UTxODataSlice;
541
+
542
+ @title : 'Lovelace Amount'
543
+ @description: 'Lovelace amount in the UTxO'
544
+ lovelace : Lovelace;
545
+
546
+ @title : 'UTxO Assets'
547
+ @description: 'Assets in this UTxO'
548
+ assets : Composition of many UTxOAssets
549
+ on assets.utxo = $self;
550
+
551
+ @title : 'UTxO Has Assets'
552
+ @description: 'Indicates if utxo has assets'
553
+ hasAssets : Boolean;
554
+ }
555
+
556
+ @title : 'UTxO Assets'
557
+ @description: 'Association entity for assets held by a UTxO'
558
+ entity UTxOAssets : temporal {
559
+
560
+ @title: 'UTxO (key)'
561
+ key utxo : Association to AddressUTxOs; // utxo association
562
+
563
+ @title : 'Asset Unit (key)'
564
+ @description: 'The unique identifier for the asset unit'
565
+ key unit : AssetUnit; // asset unit - must be key since one UTxO can hold multiple assets
566
+
567
+ @title : 'Asset Details'
568
+ @description: 'Structural slice for asset details'
569
+ asset : AssetSlice; // asset details
570
+ }
571
+
572
+ @title : 'Accounts Entity'
573
+ @description: 'Account information entity definition'
574
+ entity Accounts : temporal {
575
+
576
+ @title : 'Stake Address (Key)'
577
+ @description: 'The Bech32 encoded stake address string'
578
+ key stakeAddress : Bech32;
579
+
580
+ @title : 'Active Status'
581
+ @description: 'Indicates if the account is active'
582
+ active : Boolean;
583
+
584
+ @title : 'Last Active Epoch'
585
+ @description: 'Epoch number of last activity'
586
+ activeEpoch : Integer;
587
+
588
+ @title : 'Controlled Amount'
589
+ @description: 'Total controlled amount in lovelace'
590
+ controlledAmount : Lovelace;
591
+
592
+ @title : 'Rewards Sum'
593
+ @description: 'Total rewards sum in lovelace'
594
+ rewardsSum : Lovelace;
595
+
596
+ @title : 'Withdrawals Sum'
597
+ @description: 'Total withdrawals sum in lovelace'
598
+ withdrawalsSum : Lovelace;
599
+
600
+ @title : 'Reserves Sum'
601
+ @description: 'Total reserves sum in lovelace'
602
+ reservesSum : Lovelace;
603
+
604
+ @title : 'Treasury Sum'
605
+ @description: 'Total treasury sum in lovelace'
606
+ treasurySum : Lovelace;
607
+
608
+ @title : 'Withdrawable Amount'
609
+ @description: 'Total withdrawable amount in lovelace'
610
+ withdrawableAmount : Lovelace;
611
+
612
+ @title : 'Pool ID'
613
+ @description: 'Associated pool ID'
614
+ poolId : Association to Pools;
615
+
616
+ @title : 'DRep ID'
617
+ @description: 'Associated DRep ID'
618
+ drepId : Association to Dreps;
619
+
620
+ @title : 'Addresses'
621
+ @description: 'All addresses for this account'
622
+ Address : Composition of many Addresses
623
+ on Address.stakeAddress = $self.stakeAddress;
624
+
625
+ @title : 'Has Addresses'
626
+ @description: 'Indicates if account has associated addresses'
627
+ hasAddresses : Boolean;
628
+ }
629
+
630
+ @title : 'Transaction Entity'
631
+ @description: 'Transaction information entity definition'
632
+ @readonly
633
+ entity Transactions {
634
+
635
+ @title : 'Transaction Hash (Key)'
636
+ @description: 'The unique transaction identifier as hex string'
637
+ key hash : Blake2b256;
638
+
639
+ @title : 'Transaction Block Hash'
640
+ @description: 'The block hash containing the transaction'
641
+ blockHash : Blake2b256;
642
+
643
+ @title : 'Transaction Block Height'
644
+ @description: 'The block height containing the transaction'
645
+ blockHeight : Integer;
646
+
647
+ @title : 'Transaction Block Time'
648
+ @description: 'The block time as integer unix timestamp'
649
+ blockTime : Integer64;
650
+
651
+ @title : 'Transaction Slot'
652
+ @description: 'The slot number containing the transaction'
653
+ slot : Integer64;
654
+
655
+ @title : 'Transaction Index'
656
+ @description: 'The transaction index within the block'
657
+ txIndex : Integer;
658
+
659
+ @title : 'Transaction Fee'
660
+ @description: 'The transaction fee in lovelace'
661
+ fee : Lovelace;
662
+
663
+ @title : 'Transaction Deposit'
664
+ @description: 'The deposit change in lovelace'
665
+ deposit : Lovelace;
666
+
667
+ @title : 'Transaction Size'
668
+ @description: 'The transaction size in bytes'
669
+ size : Integer;
670
+
671
+ @title : 'Transaction Metadata'
672
+ @description: 'The transaction metadata'
673
+ metadata : Composition of many TransactionMetadata
674
+ on metadata.tx = $self;
675
+
676
+ @title : 'Transaction Inputs'
677
+ @description: 'The transaction inputs composition'
678
+ inputs : Composition of many TransactionInputs
679
+ on inputs.tx = $self;
680
+
681
+ @title : 'Transaction Outputs'
682
+ @description: 'The transaction outputs composition'
683
+ outputs : Composition of many TransactionOutputs
684
+ on outputs.tx = $self;
685
+
686
+ @title : 'Transaction Has Metadata'
687
+ @description: 'Indicates if transaction has metadata'
688
+ hasMetadata : Boolean;
689
+
690
+ @title : 'Transaction Has Inputs'
691
+ @description: 'Indicates if transaction has inputs'
692
+ hasInputs : Boolean;
693
+
694
+ @title : 'Transaction Has Outputs'
695
+ @description: 'Indicates if transaction has outputs'
696
+ hasOutputs : Boolean;
697
+ }
698
+
699
+ @title : 'Transaction Inputs'
700
+ @description: 'Projection for Transaction Inputs'
701
+ @readonly
702
+ entity TransactionInputs {
703
+
704
+ @title : 'Transaction (key)'
705
+ @description: 'The associated transaction'
706
+ key tx : Association to Transactions;
707
+
708
+ @title : 'Input Index (key)'
709
+ @description: 'The input index of the input utxo'
710
+ key inputIndex : Integer;
711
+
712
+ @title : 'Input Address'
713
+ @description: 'The associated address of the input utxo'
714
+ address : Association to Addresses;
715
+
716
+ @title : 'Input UTxO Data'
717
+ @description: 'The UTxO specific data of the input utxo'
718
+ utxoData : UTxODataSlice; // input utxo data
719
+
720
+ @title : 'Input Lovelace Amount'
721
+ @description: 'The lovelace amount of the input utxo'
722
+ isCollateral : Boolean;
723
+
724
+ @title : 'Is Reference Input'
725
+ @description: 'Indicates if the input is used as reference input'
726
+ isReference : Boolean;
727
+
728
+ @title : 'Input Assets'
729
+ @description: 'Composed assets associated with the input utxo'
730
+ assets : Composition of many TransactionInputAssets
731
+ on assets.input = $self;
732
+
733
+ @title : 'Input Has Addresses'
734
+ @description: 'Indicates if input has associated addresses'
735
+ hasAddresses : Boolean;
736
+
737
+ @title : 'Input Has Assets'
738
+ @description: 'Indicates if input has assets'
739
+ hasAssets : Boolean;
740
+ }
741
+
742
+ @title : 'Transaction Input Assets'
743
+ @description: 'Projection for Transaction Input Assets'
744
+ @readonly
745
+ entity TransactionInputAssets {
746
+
747
+ @title : 'Transaction Input (key)'
748
+ @description: 'The associated transaction input'
749
+ key input : Association to TransactionInputs;
750
+
751
+ @title : 'Asset Unit (key)'
752
+ @description: 'The asset unit'
753
+ key unit : AssetUnit;
754
+
755
+ @title : 'Asset Details'
756
+ @description: 'Structural slice for asset details'
757
+ asset : AssetSlice;
758
+ }
759
+
760
+ @title : 'Transaction Outputs'
761
+ @description: 'Projection for Transaction Outputs'
762
+ @readonly
763
+ entity TransactionOutputs {
764
+
765
+ @title : 'Transaction (key)'
766
+ @description: 'The associated transaction'
767
+ key tx : Association to Transactions;
768
+
769
+ @title : 'Output Index (key)'
770
+ @description: 'The output index of the output utxo'
771
+ key outputIndex : Integer;
772
+
773
+ @title : 'Output Address'
774
+ @description: 'The associated address of the output utxo'
775
+ address : Association to Addresses;
776
+
777
+ @title : 'UTxO Data'
778
+ @description: 'The UTxO specific data of the output utxo'
779
+ utxo : UTxODataSlice;
780
+
781
+ @title : 'Transaction Output Assets'
782
+ @description: 'Composed assets associated with the output utxo'
783
+ assets : Composition of many TransactionOutputAssets
784
+ on assets.output = $self;
785
+
786
+ @title : 'Has Addresses'
787
+ @description: 'Indicates if output has associated addresses'
788
+ hasAddresses : Boolean;
789
+
790
+ @title : 'Has Assets'
791
+ @description: 'Indicates if output has assets'
792
+ hasAssets : Boolean;
793
+ }
794
+
795
+ @title : 'Transaction Output Assets'
796
+ @description: 'Projection for Transaction Output Assets'
797
+ @readonly
798
+ entity TransactionOutputAssets {
799
+
800
+ @title : 'Transaction Output (key)'
801
+ @description: 'The associated transaction output'
802
+ key output : Association to TransactionOutputs;
803
+
804
+ @title : 'Asset Unit (key)'
805
+ @description: 'The asset unit'
806
+ key unit : AssetUnit;
807
+
808
+ @title : 'Asset Details'
809
+ @description: 'Structural slice for asset details'
810
+ asset : AssetSlice;
811
+ }
812
+
813
+ @title : 'Transaction Metadata'
814
+ @description: 'Projection for Transaction Metadata'
815
+ @readonly
816
+ entity TransactionMetadata {
817
+
818
+ @title : 'ID (key)'
819
+ @description: 'The metadata label as a uint64 (also exposed as the string `label`)'
820
+ key id : Integer64; // was Integer (32-bit): overflowed for labels > 2^31
821
+
822
+ @title : 'Transaction (key)'
823
+ @description: 'The associated transaction'
824
+ key tx : Association to Transactions;
825
+
826
+ @title : 'Label'
827
+ @description: 'The metadata label as string'
828
+ label : MetadataLabel;
829
+
830
+ @title : 'Metadata Payload'
831
+ @description: 'The metadata payload as JSON string'
832
+ payload : LargeString;
833
+ }
834
+
835
+ //-----------------------------------------------------
836
+ // M2 - transaction building and submission entities
837
+ //-----------------------------------------------------
838
+ @title : 'Ledger Protocol Parameters'
839
+ @description: 'Entity for storing ledger protocol parameters for transaction building'
840
+ entity LedgerProtocolParameters {
841
+
842
+ @title : 'Network (key)'
843
+ @description: 'The Cardano network type mainnet | preprod | preview'
844
+ key network : String(16);
845
+
846
+ @title : 'Epoch Number (key)'
847
+ @description: 'The epoch number these parameters are valid for'
848
+ key epoch : Integer;
849
+
850
+ @title : 'Minimum Fee A'
851
+ @description: 'The minimum fee factor a for transaction fee calculation'
852
+ minFeeA : Integer;
853
+
854
+ @title : 'Minimum Fee B'
855
+ @description: 'The minimum fee constant b for transaction fee calculation'
856
+ minFeeB : Integer;
857
+
858
+ @title : 'Maximum Sizes'
859
+ @description: 'Maximum sizes for blocks and transactions'
860
+ maxBlockSize : Integer;
861
+
862
+ @title : 'Maximum Transaction Size'
863
+ @description: 'The maximum size for a transaction in bytes'
864
+ maxTxSize : Integer;
865
+
866
+ @title : 'Maximum Block Header Size'
867
+ @description: 'The maximum size for a block header in bytes'
868
+ maxBlockHeaderSize : Integer;
869
+
870
+ @title : 'Key Deposit'
871
+ @description: 'The key deposit amount in lovelace'
872
+ keyDeposit : String(32);
873
+
874
+ @title : 'Pool Deposit'
875
+ @description: 'The pool deposit amount in lovelace'
876
+ poolDeposit : String(32);
877
+
878
+ @title : 'Epochs for Pool Retirement'
879
+ @description: 'The number of epochs before a retiring pool is removed from the ledger'
880
+ eMax : Integer;
881
+
882
+ @title : 'nOpt Parameter'
883
+ @description: 'Stake pool target number parameter nOpt'
884
+ nOpt : Integer;
885
+
886
+ @title : 'a0 Parameter'
887
+ @description: 'Pool pledge influence parameter a0'
888
+ a0 : Decimal(18, 10);
889
+
890
+ @title : 'Rho Parameter'
891
+ @description: 'Monetary expansion parameter rho'
892
+ rho : Decimal(18, 10);
893
+
894
+ @title : 'Tau Parameter'
895
+ @description: 'Treasury cut parameter tau'
896
+ tau : Decimal(18, 10);
897
+
898
+ @title : 'Minimum Pool Cost'
899
+ @description: 'The minimum pool cost in lovelace'
900
+ minPoolCost : String(32);
901
+
902
+ @title : 'Decentralisation Parameter'
903
+ @description: 'The decentralisation parameter of the network'
904
+ decentralisationParam : Decimal(18, 10);
905
+
906
+ @title : 'Extra Entropy'
907
+ @description: 'The extra entropy for pool key generation'
908
+ extraEntropy : String(128);
909
+
910
+ @title : 'Protocol Major Version'
911
+ @description: 'The major version of the protocol'
912
+ protocolMajorVer : Integer;
913
+
914
+ @title : 'Protocol Minor Version'
915
+ @description: 'The minor version of the protocol'
916
+ protocolMinorVer : Integer;
917
+
918
+ @title : 'Min UTxO Value'
919
+ @description: 'The minimum UTxO value in lovelace'
920
+ minUtxo : String(32);
921
+
922
+ @title : 'Min Pool Cost'
923
+ @description: 'The minimum pool cost in lovelace'
924
+ nonce : String(128);
925
+
926
+ @title : 'Cost Models'
927
+ @description: 'The cost models for script execution as JSON blob'
928
+ costModels : LargeString;
929
+
930
+ @title : 'Execution Prices'
931
+ @description: 'The execution prices for script execution'
932
+ priceMem : Decimal(18, 10);
933
+
934
+ @title : 'Execution Steps Price'
935
+ @description: 'The execution steps price for script execution'
936
+ priceStep : Decimal(18, 10);
937
+
938
+ @title : 'Maximum Execution Units'
939
+ @description: 'The maximum execution units for transactions and blocks'
940
+ maxTxExMem : String(32);
941
+
942
+ @title : 'Maximum Execution Steps'
943
+ @description: 'The maximum execution steps for transactions and blocks'
944
+ maxTxExSteps : String(32);
945
+
946
+ @title : 'Maximum Block Execution Units'
947
+ @description: 'The maximum execution units for blocks'
948
+ maxBlockExMem : String(32);
949
+
950
+ @title : 'Maximum Block Execution Steps'
951
+ @description: 'The maximum execution steps for blocks'
952
+ maxBlockExSteps : String(32);
953
+
954
+ @title : 'Maximum Value Size'
955
+ @description: 'The maximum size for a value in bytes'
956
+ maxValSize : String(32);
957
+
958
+ @title : 'Collateral Percent'
959
+ @description: 'The required collateral percentage for script transactions'
960
+ collateralPercent : Integer;
961
+
962
+ @title : 'Maximum Collateral Inputs'
963
+ @description: 'The maximum number of collateral inputs for script transactions'
964
+ maxCollateralInputs : Integer;
965
+
966
+ @title : 'Coins Per UTxO Size'
967
+ @description: 'The coins per UTxO size parameter for calculating min UTxO value'
968
+ coinsPerUtxoSize : String(32);
969
+
970
+ @title : 'Coins Per UTxO Word'
971
+ @description: 'The coins per UTxO word parameter for calculating min UTxO value (alonzo legacy)'
972
+ coinsPerUtxoWord : String(32);
973
+
974
+ @title : 'Fetched At'
975
+ @description: 'Timestamp when these parameters were fetched'
976
+ fetchedAt : Timestamp;
977
+
978
+ @title : 'Source'
979
+ @description: 'Source from which these parameters were fetched'
980
+ source : String(32);
981
+ }
982
+
983
+ @title : 'Transaction Builds'
984
+ @description: 'Entity for storing transaction build attempts and details'
985
+ entity TransactionBuilds : temporal {
986
+
987
+ @title : 'Build ID (key)'
988
+ @description: 'Unique identifier for the transaction build attempt'
989
+ key id : UUID;
990
+
991
+ @title : 'Network'
992
+ @description: 'The Cardano network type mainnet | preprod | preview'
993
+ network : String(10);
994
+
995
+ @title : 'Builder Engine'
996
+ @description: 'The transaction builder engine used for this build'
997
+ builderEngine : String(20);
998
+
999
+ @title : 'Sender Address'
1000
+ @description: 'The sender/source address'
1001
+ senderAddress : Bech32;
1002
+
1003
+ @title : 'Change Address'
1004
+ @description: 'The change address (defaults to sender address if not specified)'
1005
+ changeAddress : Bech32;
1006
+
1007
+ @title : 'Unsigned Tx CBOR'
1008
+ @description: 'The unsigned transaction CBOR as hex string'
1009
+ unsignedTxCbor : LargeString;
1010
+
1011
+ @title : 'Tx Body Hash'
1012
+ @description: 'The transaction body hash as hex string'
1013
+ txBodyHash : Blake2b256;
1014
+
1015
+ @title : 'Estimated Fee'
1016
+ @description: 'The estimated transaction fee in lovelace'
1017
+ fee : Lovelace;
1018
+
1019
+ @title : 'Transaction Size'
1020
+ @description: 'The transaction size in bytes'
1021
+ size : Integer;
1022
+
1023
+ @title : 'Build Created At'
1024
+ @description: 'The timestamp when the build was created'
1025
+ createdAt : Integer64;
1026
+
1027
+ @title : 'Build Inputs'
1028
+ @description: 'The inputs used in the transaction build'
1029
+ inputs : Composition of many TransactionBuildInputs
1030
+ on inputs.build = $self;
1031
+
1032
+ @title : 'Build Outputs'
1033
+ @description: 'The outputs created in the transaction build'
1034
+ outputs : Composition of many TransactionBuildOutputs
1035
+ on outputs.build = $self;
1036
+
1037
+ @title : 'Associated Submission'
1038
+ @description: 'Association to the transaction submission if submitted'
1039
+ submission : Association to one TransactionSubmissions
1040
+ on submission.build = $self;
1041
+
1042
+ @title : 'Has Inputs'
1043
+ @description: 'Indicates if the build has inputs'
1044
+ hasInputs : Boolean;
1045
+
1046
+ @title : 'Has Outputs'
1047
+ @description: 'Indicates if the build has outputs'
1048
+ hasOutputs : Boolean;
1049
+
1050
+ @title : 'Was Submitted'
1051
+ @description: 'Indicates if the build was submitted'
1052
+ wasSubmitted : Boolean;
1053
+
1054
+ @title : 'Script Hash'
1055
+ @description: 'Blake2b-224 hash of the Plutus script used (= policy ID for minting transactions)'
1056
+ scriptHash : String(56);
1057
+
1058
+ @title : 'Mint Script Hash'
1059
+ @description: 'Blake2b-224 hash of the minting policy script (= policy ID) for combined spend+mint transactions. Only set when BuildPlutusSpendTransaction included mintActionsJson.'
1060
+ mintScriptHash : String(56);
1061
+
1062
+ @title : 'Asset Fingerprint'
1063
+ @description: 'CIP-14 fingerprint of the first minted asset (e.g. asset1...). Convenience field for single-asset mints.'
1064
+ fingerprint : String(44);
1065
+
1066
+ @title : 'Script Address'
1067
+ @description: 'Enterprise script address derived from the applied script hash (bech32). Only set when lockOnScript=true.'
1068
+ scriptAddress : String(120);
1069
+
1070
+ @title : 'Forced Inputs Used'
1071
+ @description: 'Number of forced inputs (from forceInputsJson) actually included in the built transaction. 0 when forceInputsJson was not provided.'
1072
+ forcedInputsUsed : Integer;
1073
+
1074
+ @title : 'Reference Inputs Used'
1075
+ @description: 'Number of CIP-31 reference inputs (from referenceInputsJson) included in the built transaction. 0 when referenceInputsJson was not provided.'
1076
+ referenceInputsUsed : Integer;
1077
+
1078
+ @title : 'Collateral Available'
1079
+ @description: 'Indicates if collateral UTxOs were already available (SetCollateral only). When true, no transaction build was needed.'
1080
+ collateralAvailable : Boolean;
1081
+ }
1082
+
1083
+ @title : 'Transaction Build Inputs'
1084
+ @description: 'Entity for storing transaction build input details'
1085
+ entity TransactionBuildInputs {
1086
+
1087
+ @title : 'Build (key)'
1088
+ @description: 'Association to parent transaction build'
1089
+ key build : Association to TransactionBuilds;
1090
+
1091
+ @title : 'Input Index (key)'
1092
+ @description: 'Index of the input in the transaction build'
1093
+ key inputIndex : Integer;
1094
+
1095
+ @title : 'UTxO Transaction Hash'
1096
+ @description: 'UTxO transaction hash'
1097
+ txHash : Blake2b256;
1098
+
1099
+ @title : 'UTxO Output Index'
1100
+ @description: 'UTxO output index'
1101
+ outputIndex : Integer;
1102
+
1103
+ @title : 'Input Address'
1104
+ @description: 'UTxO address'
1105
+ address : Bech32;
1106
+
1107
+ @title : 'Input Lovelace Amount'
1108
+ @description: 'Lovelace amount of the input UTxO'
1109
+ lovelace : Lovelace;
1110
+
1111
+ @title : 'Input Assets'
1112
+ @description: 'Assets associated with the input UTxO'
1113
+ assets : Composition of many TransactionBuildInputAssets
1114
+ on assets.input = $self;
1115
+
1116
+ @title : 'Input Has Assets'
1117
+ @description: 'Indicates if input has native assets'
1118
+ hasAssets : Boolean;
1119
+ }
1120
+
1121
+ @title : 'Transaction Build Input Assets'
1122
+ @description: 'Entity for storing assets associated with transaction build inputs'
1123
+ entity TransactionBuildInputAssets {
1124
+
1125
+ @title : 'Transaction Build Input (key)'
1126
+ @description: 'Build input association'
1127
+ key input : Association to TransactionBuildInputs;
1128
+
1129
+ @title : 'Asset Unit (key)'
1130
+ @description: 'Asset unit (policyId + assetNameHex)'
1131
+ key unit : AssetUnit;
1132
+
1133
+ @title : 'Asset Details'
1134
+ @description: 'Structural slice for asset details'
1135
+ asset : AssetSlice;
1136
+ }
1137
+
1138
+ @title : 'Transaction Build Outputs'
1139
+ @description: 'Entity for storing transaction build output details'
1140
+ entity TransactionBuildOutputs {
1141
+
1142
+ @title : 'Build (key)'
1143
+ @description: 'Association to parent transaction build'
1144
+ key build : Association to TransactionBuilds;
1145
+
1146
+ @title : 'Output Index (key)'
1147
+ @description: 'Index in outputs array'
1148
+ key outputIndex : Integer;
1149
+
1150
+ @title : 'Recipient Address'
1151
+ @description: 'Recipient address in bech32 format'
1152
+ address : Bech32;
1153
+
1154
+ @title : 'Lovelace Amount'
1155
+ @description: 'Lovelace amount to send'
1156
+ lovelace : Lovelace;
1157
+
1158
+ @title : 'Is Change Output'
1159
+ @description: 'Indicates if this is the change output'
1160
+ isChange : Boolean;
1161
+
1162
+ @title : 'Output Assets'
1163
+ @description: 'Assets associated with this output'
1164
+ assets : Composition of many TransactionBuildOutputAssets
1165
+ on assets.output = $self;
1166
+
1167
+ @title : 'Has Assets'
1168
+ @description: 'Indicates if output has native assets'
1169
+ hasAssets : Boolean;
1170
+ }
1171
+
1172
+ @title : 'Transaction Build Output Assets'
1173
+ @description: 'Entity for storing assets associated with transaction build outputs'
1174
+ entity TransactionBuildOutputAssets {
1175
+
1176
+ @title : 'Transaction Build Output (key)'
1177
+ @description: 'Association to parent transaction build output'
1178
+ key output : Association to TransactionBuildOutputs;
1179
+
1180
+ @title : 'Asset Unit (key)'
1181
+ @description: 'Asset unit (policyId + assetNameHex)'
1182
+ key unit : AssetUnit;
1183
+
1184
+ @title : 'Asset Details'
1185
+ @description: 'Structural slice for asset details'
1186
+ asset : AssetSlice;
1187
+
1188
+ }
1189
+
1190
+ @title : 'Transaction Submissions'
1191
+ @description: 'Entity for storing transaction submission attempts and status'
1192
+ entity TransactionSubmissions {
1193
+
1194
+ @title : 'Submission ID (key)'
1195
+ @description: 'Unique identifier for the transaction submission'
1196
+ key id : UUID;
1197
+
1198
+ @title : 'Associated Build'
1199
+ @description: 'Association to the transaction build being submitted'
1200
+ build : Association to TransactionBuilds;
1201
+
1202
+ @title : 'Signged Tx CBOR'
1203
+ @description: 'The signed transaction CBOR as hex string'
1204
+ signedTxCbor : LargeString;
1205
+
1206
+ @title : 'Transaction Hash'
1207
+ @description: 'Actual transaction hash after signing'
1208
+ txHash : Blake2b256;
1209
+
1210
+ @title : 'Submission Time'
1211
+ @description: 'Submission time as unix timestamp'
1212
+ submittedAt : Integer64;
1213
+
1214
+ @title : 'Submission Status'
1215
+ @description: 'Current status of the transaction submission (pending, submitted, confirmed, failed, rejected)'
1216
+ status : SubmissionStatus default 'pending' @readonly;
1217
+
1218
+ @title : 'Error Code'
1219
+ @description: 'Error code if failed'
1220
+ errorCode : String(50);
1221
+
1222
+ @title : 'Error Message'
1223
+ @description: 'Detailed error message if failed'
1224
+ errorMessage : LargeString;
1225
+
1226
+ @title : 'Retry Count'
1227
+ @description: 'Number of retry attempts'
1228
+ retryCount : Integer;
1229
+
1230
+ @title : 'Submission Errors'
1231
+ @description: 'Composition of errors associated with this submission'
1232
+ errors : Composition of many TransactionSubmissionErrors
1233
+ on errors.submission = $self;
1234
+
1235
+ @title : 'Has Errors'
1236
+ @description: 'Indicates if submission has errors'
1237
+ hasErrors : Boolean;
1238
+ }
1239
+
1240
+ @title : 'Transaction Submission Errors'
1241
+ @description: 'Entity for storing errors encountered during transaction submission'
1242
+ entity TransactionSubmissionErrors {
1243
+
1244
+ @title : 'Error ID (key)'
1245
+ @description: 'Unique identifier for the submission error'
1246
+ key id : UUID;
1247
+
1248
+ @title : 'Associated Submission'
1249
+ @description: 'Association to parent transaction submission'
1250
+ submission : Association to TransactionSubmissions;
1251
+
1252
+ @title : 'Error Occurred At'
1253
+ @description: 'Timestamp when the error occurred as unix timestamp'
1254
+ occurredAt : Integer64;
1255
+
1256
+ @title : 'Error Type'
1257
+ @description: 'Type/category of the error encountered'
1258
+ errorType : String(50);
1259
+
1260
+ @title : 'Error Code'
1261
+ @description: 'Specific error code'
1262
+ errorCode : String(50);
1263
+
1264
+ @title : 'Error Message'
1265
+ @description: 'Detailed error message'
1266
+ errorMessage : LargeString;
1267
+
1268
+ @title : 'Error Details'
1269
+ @description: 'Additional error context as JSON'
1270
+ errorDetails : LargeString;
1271
+
1272
+ @title : 'Is Recoverable'
1273
+ @description: 'Indicates if error is recoverable via retry'
1274
+ isRecoverable : Boolean;
1275
+ }
1276
+
1277
+ //-----------------------------------------------------
1278
+ // M3 - External Signing Workflow Entities & Address Additions
1279
+ //-----------------------------------------------------
1280
+
1281
+ @title : 'Address Transactions'
1282
+ @description : 'Association entity for transactions involving an address'
1283
+ entity AddressTransactions {
1284
+
1285
+ @title : 'Address (key)'
1286
+ @description: 'The Bech32 encoded address associated with the transaction'
1287
+ key address : Association to Addresses;
1288
+
1289
+ @title : 'Transaction (key)'
1290
+ @description: 'The associated transaction'
1291
+ key tx : Association to Transactions;
1292
+
1293
+ @title : 'Net Amount (Lovelace)'
1294
+ @description: 'Net lovelace change for this address in this transaction (positive = received, negative = sent)'
1295
+ netAmount : Decimal(20, 0);
1296
+
1297
+ @title : 'Block Time'
1298
+ @description: 'Block time of the transaction (denormalized for sorting)'
1299
+ blockTime : Integer64;
1300
+
1301
+ @title : 'Net Assets'
1302
+ @description: 'JSON array of net asset changes [{unit, policyId, assetName, quantity}] (positive = received, negative = sent)'
1303
+ netAssets : LargeString;
1304
+
1305
+ @title : 'Has Assets'
1306
+ @description: 'Indicates if this transaction involves native assets for this address'
1307
+ hasAssets : Boolean default false;
1308
+ }
1309
+
1310
+ @title : 'Address Signing Requests'
1311
+ @description : 'Association entity for signing requests involving an address'
1312
+ entity AddressSigningRequests {
1313
+
1314
+ @title : 'Address (key)'
1315
+ @description: 'The Bech32 encoded address associated with the signing request'
1316
+ key address : Association to Addresses;
1317
+
1318
+ @title : 'Signing Request (key)'
1319
+ @description: 'The associated signing request'
1320
+ key signingRequest : Association to SigningRequests;
1321
+ }
1322
+
1323
+ @title : 'Address Transaction Builds'
1324
+ @description : 'Association entity for transaction builds involving an address'
1325
+ entity AddressTransactionBuilds{
1326
+
1327
+ @title : 'Address (key)'
1328
+ @description: 'The Bech32 encoded address associated with the transaction build'
1329
+ key address : Association to Addresses;
1330
+
1331
+ @title : 'Transaction Build (key)'
1332
+ @description: 'The associated transaction build'
1333
+ key txBuild : Association to TransactionBuilds;
1334
+ }
1335
+
1336
+ @title : 'Signing Requests'
1337
+ @description: 'Entity for tracking external signing requests and their workflow state'
1338
+ entity SigningRequests {
1339
+
1340
+ @title : 'Signing Request ID (key)'
1341
+ @description: 'Unique identifier for the signing request'
1342
+ key id : UUID;
1343
+
1344
+ @title : 'Associated Build'
1345
+ @description: 'Association to the transaction build being signed'
1346
+ build : Association to TransactionBuilds;
1347
+
1348
+ @title : 'Transaction Body Hash'
1349
+ @description: 'The hash of the transaction body (data to be signed)'
1350
+ txBodyHash : Blake2b256;
1351
+
1352
+ @title : 'Unsigned Transaction CBOR'
1353
+ @description: 'The unsigned transaction in CBOR hex format'
1354
+ unsignedTxCbor : LargeString;
1355
+
1356
+ @title : 'Network'
1357
+ @description: 'Cardano network (mainnet | preprod | preview)'
1358
+ network : String(10);
1359
+
1360
+ @title : 'Status'
1361
+ @description: 'Current status of the signing request'
1362
+ status : SigningStatus default 'pending' @readonly;
1363
+
1364
+ @title : 'Created At'
1365
+ @description: 'Timestamp when the signing request was created'
1366
+ createdAt : Timestamp;
1367
+
1368
+ @title : 'Expires At'
1369
+ @description: 'Timestamp when the signing request expires'
1370
+ expiresAt : Timestamp;
1371
+
1372
+ @title : 'Signed At'
1373
+ @description: 'Timestamp when the transaction was signed'
1374
+ signedAt : Timestamp;
1375
+
1376
+ @title : 'Submitted At'
1377
+ @description: 'Timestamp when the transaction was submitted'
1378
+ submittedAt : Timestamp;
1379
+
1380
+ @title : 'Cardano CLI Command'
1381
+ @description: 'Example command to sign with Cardano CLI'
1382
+ cardanoCliCommand : LargeString;
1383
+
1384
+ @title : 'CIP-30 CBOR'
1385
+ @description: 'Transaction CBOR for browser wallet signing (CIP-30)'
1386
+ cip30TxCbor : LargeString;
1387
+
1388
+ @title : 'Signed Transaction CBOR'
1389
+ @description: 'The full signed transaction CBOR, persisted at claim time on the deferred-submit path so an interrupted submission can be re-driven after a restart (see SUBMIT_DETACH_DESIGN.md)'
1390
+ signedTxCbor : LargeString;
1391
+
1392
+ @title : 'Signer Type'
1393
+ @description: 'Type of signer used (cardano-cli | browser-wallet | hardware-wallet | custom)'
1394
+ signerType : String(20);
1395
+
1396
+ @title : 'Signer Info'
1397
+ @description: 'Additional information about the signer (wallet name, etc.)'
1398
+ signerInfo : String(100);
1399
+
1400
+ @title : 'HSM Key ID'
1401
+ @description: 'PKCS#11 key identifier used for HSM signing (audit trail)'
1402
+ hsmKeyId : String(40);
1403
+
1404
+ @title : 'Signature Verifications'
1405
+ @description: 'Composition of signature verification attempts'
1406
+ verifications : Composition of many SignatureVerifications
1407
+ on verifications.signingRequest = $self;
1408
+
1409
+ @title : 'Associated Submission'
1410
+ @description: 'Association to the transaction submission (if submitted)'
1411
+ submission : Association to TransactionSubmissions;
1412
+
1413
+ @title : 'Error Message'
1414
+ @description: 'Error message if signing or verification failed'
1415
+ errorMessage : LargeString;
1416
+ }
1417
+
1418
+ @title : 'Signature Verifications'
1419
+ @description: 'Entity for storing signature verification results'
1420
+ entity SignatureVerifications {
1421
+
1422
+ @title : 'Verification ID (key)'
1423
+ @description: 'Unique identifier for the verification attempt'
1424
+ key id : UUID;
1425
+
1426
+ @title : 'Associated Signing Request'
1427
+ @description: 'Association to the parent signing request'
1428
+ signingRequest : Association to SigningRequests;
1429
+
1430
+ @title : 'Signed Transaction CBOR'
1431
+ @description: 'The signed transaction CBOR that was verified'
1432
+ signedTxCbor : LargeString;
1433
+
1434
+ @title : 'Is Valid'
1435
+ @description: 'Whether the signature is valid'
1436
+ isValid : Boolean;
1437
+
1438
+ @title : 'Transaction Body Hash'
1439
+ @description: 'The verified transaction body hash'
1440
+ txBodyHash : Blake2b256;
1441
+
1442
+ @title : 'Witness Count'
1443
+ @description: 'Number of signatures found'
1444
+ witnessCount : Integer;
1445
+
1446
+ @title : 'Signer Key Hashes'
1447
+ @description: 'JSON array of public key hashes that signed the transaction'
1448
+ signerKeyHashes : LargeString;
1449
+
1450
+ @title : 'Error Message'
1451
+ @description: 'Error message if verification failed'
1452
+ errorMessage : LargeString;
1453
+
1454
+ @title : 'Warnings'
1455
+ @description: 'JSON array of warning messages'
1456
+ warnings : LargeString;
1457
+
1458
+ @title : 'Verified At'
1459
+ @description: 'Timestamp when the verification was performed'
1460
+ verifiedAt : Timestamp;
1461
+ }
1462
+
1463
+ // -----------------------------------------------------
1464
+ // Chain Crawler / Pre-Sync (v2.0)
1465
+ // -----------------------------------------------------
1466
+
1467
+ @title : 'Cardano Sync State'
1468
+ @description: 'Singleton crawl cursor tracking the pre-sync progress of the chain crawler'
1469
+ entity CardanoSyncState {
1470
+
1471
+ @title : 'Cursor Id (Key)'
1472
+ @description: 'Singleton key — always the literal string SINGLETON'
1473
+ key ID : String(10) default 'SINGLETON';
1474
+
1475
+ @title : 'Network'
1476
+ @description: 'The Cardano network this cursor tracks (mainnet | preprod | preview)'
1477
+ network : String(10);
1478
+
1479
+ @title : 'Start Slot'
1480
+ @description: 'Absolute slot of the configured pre-sync origin (immutable once syncing starts)'
1481
+ startSlot : Integer64;
1482
+
1483
+ @title : 'Start Block Hash'
1484
+ @description: 'Block hash of the configured pre-sync origin'
1485
+ startBlockHash : Blake2b256;
1486
+
1487
+ @title : 'Last Slot'
1488
+ @description: 'Absolute slot of the last indexed block (resume point)'
1489
+ lastSlot : Integer64 default 0;
1490
+
1491
+ @title : 'Last Block Hash'
1492
+ @description: 'Hash of the last indexed block — used for the reorg parent-hash check'
1493
+ lastBlockHash : Blake2b256;
1494
+
1495
+ @title : 'Last Height'
1496
+ @description: 'Block height of the last indexed block'
1497
+ lastHeight : Integer64 default 0;
1498
+
1499
+ @title : 'Last Indexed At'
1500
+ @description: 'Wall-clock timestamp of the last successful block persist'
1501
+ lastIndexedAt : Timestamp;
1502
+
1503
+ @title : 'Tip Slot'
1504
+ @description: 'Latest known chain-tip slot, for lag/progress calculation'
1505
+ tipSlot : Integer64;
1506
+
1507
+ @title : 'Tip Height'
1508
+ @description: 'Latest known chain-tip height'
1509
+ tipHeight : Integer64;
1510
+
1511
+ @title : 'Sync Status'
1512
+ @description: 'Current crawler state (stopped | syncing | synced | error)'
1513
+ syncStatus : CrawlSyncStatus default 'stopped';
1514
+
1515
+ // NOTE: live progress is computed by CardanoIndexerService.getStatus from
1516
+ // lastHeight/tipHeight — deliberately NOT persisted here (a stored copy went
1517
+ // stale immediately and misled OData readers).
1518
+
1519
+ @title : 'Last Error'
1520
+ @description: 'Message of the most recent crawler error (null when healthy)'
1521
+ lastError : String(500);
1522
+
1523
+ @title : 'Last Error At'
1524
+ @description: 'Timestamp of the most recent crawler error'
1525
+ lastErrorAt : Timestamp;
1526
+
1527
+ @title : 'Consecutive Errors'
1528
+ @description: 'Count of back-to-back failures; trips the circuit breaker past its threshold'
1529
+ consecutiveErrors : Integer default 0;
1530
+
1531
+ @title : 'Crawler Desired Running State'
1532
+ @description: 'Cluster-wide operator intent. False fences every crawler instance before its next write.'
1533
+ desiredRunning : Boolean default true;
1534
+
1535
+ @title : 'Crawler Lease Owner'
1536
+ @description: 'Opaque process identifier of the single crawler instance currently allowed to write'
1537
+ leaseOwner : String(128);
1538
+
1539
+ @title : 'Crawler Lease Expiry'
1540
+ @description: 'Lease deadline renewed by the active crawler; another instance may take over only after this time'
1541
+ leaseUntil : Timestamp;
1542
+ }
1543
+
1544
+ @title : 'Cardano Reorg Log'
1545
+ @description: 'Audit trail of chain rollbacks (reorgs) handled by the crawler'
1546
+ entity CardanoReorgLog {
1547
+
1548
+ @title : 'Reorg Id (Key)'
1549
+ @description: 'Unique identifier of the reorg event'
1550
+ key ID : UUID;
1551
+
1552
+ @title : 'Detected At'
1553
+ @description: 'Timestamp when the rollback was detected'
1554
+ detectedAt : Timestamp;
1555
+
1556
+ @title : 'Fork Slot'
1557
+ @description: 'Absolute slot of the common ancestor the chain rolled back to'
1558
+ forkSlot : Integer64;
1559
+
1560
+ @title : 'Fork Height'
1561
+ @description: 'Block height of the common ancestor the chain rolled back to'
1562
+ forkHeight : Integer64;
1563
+
1564
+ @title : 'Old Tip Hash'
1565
+ @description: 'Hash of the abandoned tip before the rollback'
1566
+ oldTipHash : Blake2b256;
1567
+
1568
+ @title : 'New Tip Hash'
1569
+ @description: 'Hash of the block the chain rolled back to'
1570
+ newTipHash : Blake2b256;
1571
+
1572
+ @title : 'Blocks Rolled Back'
1573
+ @description: 'Number of blocks (and their child rows) deleted during rollback'
1574
+ blocksRolledBack : Integer;
1575
+
1576
+ @title : 'Status'
1577
+ @description: 'Lifecycle of the reorg handling (detected | rolling_back | reindexing | completed)'
1578
+ status : ReorgStatus;
1579
+ }
1580
+
1581
+ // -----------------------------------------------------
1582
+ // Wallet Worker / Job Engine (v2.1)
1583
+ // -----------------------------------------------------
1584
+
1585
+ @title : 'Cardano Worker Wallets'
1586
+ @description: 'Operator-registered server-side wallets the wallet worker executes jobs from. No key material is ever stored here.'
1587
+ entity CardanoWorkerWallets {
1588
+
1589
+ @title : 'Wallet Id (Key)'
1590
+ @description: 'Stable operator-chosen handle used in job requests'
1591
+ key walletId : String(50);
1592
+
1593
+ @title : 'Signer Type'
1594
+ @description: 'How this wallet signs (hsm | software)'
1595
+ signerType : WorkerSignerType;
1596
+
1597
+ @title : 'Address'
1598
+ @description: 'Bech32 address derived from the signing key at worker init (informational)'
1599
+ address : Bech32;
1600
+
1601
+ @title : 'Public Key Hash'
1602
+ @description: 'Blake2b-224 hash of the wallet verification key'
1603
+ publicKeyHash : Blake2b224;
1604
+
1605
+ @title : 'Enabled'
1606
+ @description: 'Disabled wallets accept no new jobs and are skipped by the dispatch loop'
1607
+ enabled : Boolean default true;
1608
+
1609
+ @title : 'Wallet Lease Owner'
1610
+ @description: 'Opaque process identifier of the single worker instance currently allowed to execute jobs for this wallet'
1611
+ leaseOwner : String(128);
1612
+
1613
+ @title : 'Wallet Lease Expiry'
1614
+ @description: 'Lease deadline renewed by the executing worker; another instance may take over only after this time'
1615
+ leaseUntil : Timestamp;
1616
+
1617
+ @title : 'Last Job At'
1618
+ @description: 'Timestamp of the most recent job execution for this wallet'
1619
+ lastJobAt : Timestamp;
1620
+
1621
+ @title : 'Jobs Confirmed'
1622
+ @description: 'Rolling count of jobs that reached confirmed state'
1623
+ jobsConfirmed : Integer64 default 0;
1624
+
1625
+ @title : 'Jobs Failed'
1626
+ @description: 'Rolling count of jobs that reached failed state'
1627
+ jobsFailed : Integer64 default 0;
1628
+ }
1629
+
1630
+ @title : 'Cardano Wallet Jobs'
1631
+ @description: 'Asynchronous transaction jobs executed by the wallet worker (build → sign → submit → confirm)'
1632
+ // Idempotency is enforced by the DATABASE, not by a read-before-insert check:
1633
+ // concurrent retries of the same key (two app instances, or two HANA sessions)
1634
+ // can both find no existing job and both insert. The unique constraint makes one
1635
+ // of them lose, and insertJob returns the winner's job to it. See `dedupKey`.
1636
+ // Generates a table UNIQUE constraint on SQLite and a UNIQUE INVERTED INDEX on HANA.
1637
+ @assert.unique.dedup: [
1638
+ walletId,
1639
+ kind,
1640
+ dedupKey
1641
+ ]
1642
+ entity CardanoWalletJobs {
1643
+
1644
+ @title : 'Job Id (Key)'
1645
+ @description: 'Unique identifier of the job, returned by SubmitWalletJob'
1646
+ key ID : UUID;
1647
+
1648
+ @title : 'Wallet Id'
1649
+ @description: 'The worker wallet this job executes from'
1650
+ walletId : String(50);
1651
+
1652
+ @title : 'Job Kind'
1653
+ @description: 'Transaction kind (simpleAda | metadata | multiAsset | mint | plutusSpend | submitSigned)'
1654
+ kind : WalletJobKind;
1655
+
1656
+ @title : 'Status'
1657
+ @description: 'Job lifecycle state (pending | building | submitting | submitted | confirmed | failed | cancelled)'
1658
+ status : WalletJobStatus default 'pending';
1659
+
1660
+ @title : 'Idempotency Key'
1661
+ @description: 'Optional caller-supplied dedup key — a non-failed job with the same (walletId, kind, idempotencyKey) is returned instead of creating a new one'
1662
+ idempotencyKey : String(100);
1663
+
1664
+ @title : 'Dedup Key (internal)'
1665
+ @description: 'Backing value of the unique (walletId, kind, dedupKey) constraint: the caller idempotency key while the job holds it, otherwise the job ID (unique by construction). Keyless jobs and terminated jobs therefore never collide — no reliance on NULL semantics, which differ across databases.'
1666
+ dedupKey : String(100);
1667
+
1668
+ @title : 'Request'
1669
+ @description: 'The build-action payload as JSON, verbatim (validated before insert; never contains key material)'
1670
+ request : LargeString;
1671
+
1672
+ @title : 'Priority'
1673
+ @description: 'Dispatch order within a wallet queue — lower runs sooner (default 100)'
1674
+ priority : Integer default 100;
1675
+
1676
+ @title : 'Not Before'
1677
+ @description: 'Optional earliest execution time (one-shot scheduling)'
1678
+ notBefore : Timestamp;
1679
+
1680
+ @title : 'Attempt'
1681
+ @description: 'Number of execution attempts made so far'
1682
+ attempt : Integer default 0;
1683
+
1684
+ @title : 'Max Attempts'
1685
+ @description: 'Bound for transient-failure retries (build/submit); deterministic rejections fail immediately'
1686
+ maxAttempts : Integer default 3;
1687
+
1688
+ @title : 'Transaction Hash'
1689
+ @description: 'Hash of the signed transaction — persisted before the submit call (status submitting), so a crash mid-submit stays reconcilable'
1690
+ txHash : Blake2b256;
1691
+
1692
+ @title : 'Unsigned Transaction CBOR'
1693
+ @description: 'The built unsigned transaction, kept for diagnosis until the job confirms'
1694
+ unsignedTxCbor : LargeString;
1695
+
1696
+ @title : 'Signed Transaction CBOR'
1697
+ @description: 'The signed transaction, stored before submission — reused verbatim for crash reconciliation and rollback re-submission (never rebuilt)'
1698
+ signedTxCbor : LargeString;
1699
+
1700
+ @title : 'Fee'
1701
+ @description: 'Transaction fee in lovelace, from the build result'
1702
+ fee : Lovelace;
1703
+
1704
+ @title : 'Submitted At'
1705
+ @description: 'Timestamp of the submission attempt (written with the signed tx, before it is sent) — the base for the confirmation timeout'
1706
+ submittedAt : Timestamp;
1707
+
1708
+ @title : 'Confirmed At'
1709
+ @description: 'Timestamp when the configured confirmation depth was reached'
1710
+ confirmedAt : Timestamp;
1711
+
1712
+ @title : 'Confirmed Slot'
1713
+ @description: 'Absolute slot of the block containing the transaction — used for reorg checks'
1714
+ confirmedSlot : Integer64;
1715
+
1716
+ @title : 'Confirmed Height'
1717
+ @description: 'Block height of the block containing the transaction — used for depth calculation'
1718
+ confirmedHeight : Integer64;
1719
+
1720
+ @title : 'Error Code'
1721
+ @description: 'Machine-readable code of the terminal failure (null while healthy)'
1722
+ errorCode : String(50);
1723
+
1724
+ @title : 'Error Message'
1725
+ @description: 'Human-readable message of the terminal failure'
1726
+ errorMessage : String(500);
1727
+
1728
+ @title : 'Created At'
1729
+ @description: 'Timestamp the job was accepted'
1730
+ createdAt : Timestamp;
1731
+
1732
+ @title : 'Created By'
1733
+ @description: 'User id of the caller that submitted the job'
1734
+ createdBy : String(100);
1735
+
1736
+ @title : 'Finished At'
1737
+ @description: 'Timestamp the job reached a terminal state (confirmed | failed | cancelled)'
1738
+ finishedAt : Timestamp;
1739
+ }
1740
+
1741
+ /**
1742
+ * Agent grants (v2.0): scoped bearer capabilities an Admin hands to an agent
1743
+ * instead of a full user. The token is a capability, not an identity — it is
1744
+ * stored as SHA-256 only, and a request carrying it runs as the principal
1745
+ * `agent:<ID>` with the role `agent-grant`, never as the operator. Enforcement
1746
+ * (allow list, wallet pinning, daily budget) lives in srv/utils/agent-grants.ts;
1747
+ * the transport lane that admits `x-agent-token` in srv/utils/agent-token-auth.ts.
1748
+ * Admin-only table: creation and revocation happen through CardanoAgentService
1749
+ * actions, a token request may read its own row only.
1750
+ */
1751
+ @title : 'Agent Grants'
1752
+ @description: 'Scoped, budgeted bearer capabilities for agents (token stored as SHA-256 only)'
1753
+ entity CardanoAgentGrants {
1754
+
1755
+ @title : 'Grant Id (Key)'
1756
+ key ID : UUID;
1757
+
1758
+ @title : 'Operator'
1759
+ @description: 'User id of the Admin that issued the grant (audit; the token never runs as this user)'
1760
+ userId : String(200) not null;
1761
+
1762
+ @title : 'Agent Label'
1763
+ @description: 'Human-readable agent name, informational'
1764
+ agentLabel : String(100);
1765
+
1766
+ @title : 'Token Hash'
1767
+ @description: 'SHA-256 of the bearer token; the token itself is shown once and never stored'
1768
+ tokenHash : String(64) not null;
1769
+
1770
+ @title : 'Allowed Actions'
1771
+ @description: 'JSON array of allow-listed action names (builds, signing-request lifecycle, submits, wallet jobs)'
1772
+ allowedActions : LargeString not null;
1773
+
1774
+ @title : 'Wallet Id'
1775
+ @description: 'Worker wallet this grant is pinned to; required for SubmitWalletJob / CancelJob, injected into those requests'
1776
+ walletId : String(50);
1777
+
1778
+ @title : 'Allowed Job Kinds'
1779
+ @description: 'JSON array of WalletJobKind values the grant may queue; null = every kind'
1780
+ allowedJobKinds : LargeString;
1781
+
1782
+ @title : 'Max Jobs Per Day'
1783
+ @description: 'Daily budget of allow-listed action calls (UTC day); null = unlimited'
1784
+ maxJobsPerDay : Integer;
1785
+
1786
+ @title : 'Jobs Used Today'
1787
+ @description: 'Budget consumed inside budgetWindow'
1788
+ jobsUsedToday : Integer default 0;
1789
+
1790
+ @title : 'Budget Window'
1791
+ @description: 'UTC day YYYY-MM-DD the counter belongs to'
1792
+ budgetWindow : String(10);
1793
+
1794
+ @title : 'Valid Until'
1795
+ @description: 'Expiry; null = no expiry'
1796
+ validUntil : Timestamp;
1797
+
1798
+ @title : 'Is Active'
1799
+ @description: 'False once revoked; a revoked token is an unknown token'
1800
+ isActive : Boolean default true;
1801
+
1802
+ @title : 'Revoked At'
1803
+ revokedAt : Timestamp;
1804
+
1805
+ @title : 'Created At'
1806
+ createdAt : Timestamp;
1807
+
1808
+ @title : 'Last Used At'
1809
+ @description: 'Last request admitted under this token (updated at most once a minute)'
1810
+ lastUsedAt : Timestamp;
1811
+ }
1812
+
1813
+ /**
1814
+ * Daily per-action counters of admitted calls under a grant (feeds
1815
+ * CardanoAgentService.GetGrantUsage). Written by the enforcement hook next to
1816
+ * the daily budget: `calls + 1` when a call is admitted, `refunded + 1` when the
1817
+ * handler then refuses its input. Not exposed as an entity — the function is
1818
+ * the contract. A few dozen rows per grant and day at most; no retention job yet.
1819
+ */
1820
+ entity CardanoAgentGrantUsage {
1821
+
1822
+ @title : 'Grant'
1823
+ key grant : Association to CardanoAgentGrants;
1824
+
1825
+ @title : 'Day'
1826
+ @description: 'UTC day YYYY-MM-DD the call was admitted on'
1827
+ key day : String(10);
1828
+
1829
+ @title : 'Service'
1830
+ @description: 'CAP service name (CardanoTransactionService, CardanoSignService, ...)'
1831
+ key service : String(60);
1832
+
1833
+ @title : 'Action'
1834
+ @description: 'Action name (BuildSimpleAdaTransaction, SubmitTransaction, ...)'
1835
+ key action : String(100);
1836
+
1837
+ @title : 'Calls'
1838
+ @description: 'Admitted calls (budget charged where the grant has one)'
1839
+ calls : Integer default 0;
1840
+
1841
+ @title : 'Refunded'
1842
+ @description: 'Admitted calls whose handler refused the input (400..428); their unit was given back'
1843
+ refunded : Integer default 0;
1844
+ }