@odatano/core 2.0.0-rc.3 → 2.0.0-rc.30

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.
Files changed (162) hide show
  1. package/@cds-models/CardanoAgentService/index.d.ts +251 -0
  2. package/@cds-models/CardanoAgentService/index.js +36 -0
  3. package/@cds-models/CardanoBackendService/index.d.ts +357 -0
  4. package/@cds-models/CardanoBackendService/index.js +40 -0
  5. package/@cds-models/CardanoIndexerService/index.d.ts +194 -2
  6. package/@cds-models/CardanoIndexerService/index.js +25 -0
  7. package/@cds-models/CardanoODataService/index.d.ts +294 -7
  8. package/@cds-models/CardanoODataService/index.js +33 -0
  9. package/@cds-models/CardanoSignService/index.d.ts +28 -3
  10. package/@cds-models/CardanoSignService/index.js +3 -0
  11. package/@cds-models/CardanoTransactionService/index.d.ts +52 -19
  12. package/@cds-models/CardanoTransactionService/index.js +4 -0
  13. package/@cds-models/index.d.ts +18 -0
  14. package/@cds-models/index.js +3 -0
  15. package/@cds-models/odatano/cardano/index.d.ts +408 -7
  16. package/@cds-models/odatano/cardano/index.js +42 -0
  17. package/README.md +64 -5
  18. package/db/schema.cds +677 -13
  19. package/db/types.cds +27 -0
  20. package/package.json +182 -173
  21. package/scripts/migrate-slot-leader.mjs +104 -0
  22. package/scripts/migrate-txseq.mjs +147 -0
  23. package/src/index.d.ts +11 -10
  24. package/src/index.js +28 -14
  25. package/src/plugin.js +39 -52
  26. package/srv/blockchain/backends/blockfrost-backend.d.ts +29 -131
  27. package/srv/blockchain/backends/blockfrost-backend.js +49 -160
  28. package/srv/blockchain/backends/cardano-backend.d.ts +104 -158
  29. package/srv/blockchain/backends/cardano-backend.js +19 -5
  30. package/srv/blockchain/backends/koios-backend.d.ts +126 -60
  31. package/srv/blockchain/backends/koios-backend.js +356 -217
  32. package/srv/blockchain/backends/odatano-backend.d.ts +64 -0
  33. package/srv/blockchain/backends/odatano-backend.js +170 -0
  34. package/srv/blockchain/backends/ogmios-backend.d.ts +162 -94
  35. package/srv/blockchain/backends/ogmios-backend.js +548 -197
  36. package/srv/blockchain/backends/ogmios-frame-guard.d.ts +32 -0
  37. package/srv/blockchain/backends/ogmios-frame-guard.js +142 -0
  38. package/srv/blockchain/cardano-client.d.ts +78 -205
  39. package/srv/blockchain/cardano-client.js +186 -242
  40. package/srv/blockchain/cardano-indexer.d.ts +302 -242
  41. package/srv/blockchain/cardano-indexer.js +1191 -362
  42. package/srv/blockchain/cardano-tx-builder.d.ts +43 -81
  43. package/srv/blockchain/cardano-tx-builder.js +177 -132
  44. package/srv/blockchain/crawler/certificate-backfill.d.ts +67 -0
  45. package/srv/blockchain/crawler/certificate-backfill.js +169 -0
  46. package/srv/blockchain/crawler/crawler.d.ts +139 -54
  47. package/srv/blockchain/crawler/crawler.js +478 -96
  48. package/srv/blockchain/crawler/hooks.d.ts +3 -14
  49. package/srv/blockchain/crawler/index.d.ts +5 -0
  50. package/srv/blockchain/crawler/index.js +35 -7
  51. package/srv/blockchain/crawler/sync-state.d.ts +46 -28
  52. package/srv/blockchain/crawler/sync-state.js +128 -43
  53. package/srv/blockchain/crawler/transaction-backfill.d.ts +52 -0
  54. package/srv/blockchain/crawler/transaction-backfill.js +283 -0
  55. package/srv/blockchain/crawler/utxo-set-import.d.ts +78 -0
  56. package/srv/blockchain/crawler/utxo-set-import.js +363 -0
  57. package/srv/blockchain/ledger-state.d.ts +101 -0
  58. package/srv/blockchain/ledger-state.js +432 -0
  59. package/srv/blockchain/pending-spends.d.ts +28 -0
  60. package/srv/blockchain/pending-spends.js +89 -0
  61. package/srv/blockchain/signing/cose-verifier.d.ts +5 -12
  62. package/srv/blockchain/signing/cose-verifier.js +6 -12
  63. package/srv/blockchain/signing/external-signer.d.ts +16 -113
  64. package/srv/blockchain/signing/external-signer.js +19 -122
  65. package/srv/blockchain/signing/hsm-signer.d.ts +13 -45
  66. package/srv/blockchain/signing/hsm-signer.js +23 -63
  67. package/srv/blockchain/signing/signature-verifier.d.ts +8 -44
  68. package/srv/blockchain/signing/signature-verifier.js +13 -54
  69. package/srv/blockchain/signing/submission-finalizer.d.ts +9 -36
  70. package/srv/blockchain/signing/submission-finalizer.js +16 -49
  71. package/srv/blockchain/stored-chain.d.ts +33 -0
  72. package/srv/blockchain/stored-chain.js +234 -0
  73. package/srv/blockchain/transaction-building/buildooor-tx.d.ts +108 -160
  74. package/srv/blockchain/transaction-building/buildooor-tx.js +620 -285
  75. package/srv/blockchain/transaction-building/caller-datums.d.ts +17 -0
  76. package/srv/blockchain/transaction-building/caller-datums.js +50 -0
  77. package/srv/blockchain/transaction-building/cardano-tx.d.ts +10 -35
  78. package/srv/blockchain/transaction-rows.d.ts +12 -0
  79. package/srv/blockchain/transaction-rows.js +43 -0
  80. package/srv/blockchain/wallet-worker/build-request.d.ts +4 -17
  81. package/srv/blockchain/wallet-worker/build-request.js +48 -24
  82. package/srv/blockchain/wallet-worker/confirmation-tracker.d.ts +25 -17
  83. package/srv/blockchain/wallet-worker/confirmation-tracker.js +87 -41
  84. package/srv/blockchain/wallet-worker/index.js +2 -8
  85. package/srv/blockchain/wallet-worker/job-store.d.ts +36 -103
  86. package/srv/blockchain/wallet-worker/job-store.js +0 -0
  87. package/srv/blockchain/wallet-worker/lease-heartbeat.d.ts +4 -20
  88. package/srv/blockchain/wallet-worker/lease-heartbeat.js +4 -20
  89. package/srv/blockchain/wallet-worker/signers.d.ts +6 -19
  90. package/srv/blockchain/wallet-worker/signers.js +3 -8
  91. package/srv/blockchain/wallet-worker/wallet-worker.d.ts +15 -71
  92. package/srv/blockchain/wallet-worker/wallet-worker.js +40 -91
  93. package/srv/cardano-agent-service.cds +146 -0
  94. package/srv/cardano-agent-service.d.ts +2 -0
  95. package/srv/cardano-agent-service.js +12 -0
  96. package/srv/cardano-backend-service.cds +52 -0
  97. package/srv/cardano-backend-service.d.ts +2 -0
  98. package/srv/cardano-backend-service.js +244 -0
  99. package/srv/cardano-indexer-service.cds +201 -73
  100. package/srv/cardano-indexer-service.js +280 -11
  101. package/srv/cardano-service.cds +56 -1
  102. package/srv/cardano-service.js +52 -113
  103. package/srv/cardano-sign-service.cds +200 -180
  104. package/srv/cardano-sign-service.js +55 -173
  105. package/srv/cardano-tx-service.cds +439 -364
  106. package/srv/cardano-tx-service.js +305 -209
  107. package/srv/cardano-ui.cds +16 -16
  108. package/srv/cardano-worker-service.js +7 -15
  109. package/srv/cbor/parse.js +13 -1
  110. package/srv/server.d.ts +28 -86
  111. package/srv/server.js +127 -135
  112. package/srv/utils/agent-grants-config.d.ts +37 -0
  113. package/srv/utils/agent-grants-config.js +138 -0
  114. package/srv/utils/agent-grants.d.ts +262 -0
  115. package/srv/utils/agent-grants.js +922 -0
  116. package/srv/utils/agent-token-auth.d.ts +16 -0
  117. package/srv/utils/agent-token-auth.js +78 -0
  118. package/srv/utils/backend-request-handler.d.ts +2 -16
  119. package/srv/utils/backend-request-handler.js +3 -18
  120. package/srv/utils/collections.d.ts +4 -8
  121. package/srv/utils/collections.js +4 -8
  122. package/srv/utils/const.d.ts +30 -67
  123. package/srv/utils/const.js +32 -72
  124. package/srv/utils/crypto.d.ts +3 -12
  125. package/srv/utils/crypto.js +5 -18
  126. package/srv/utils/db-indexes.d.ts +25 -0
  127. package/srv/utils/db-indexes.js +94 -0
  128. package/srv/utils/db-sanitize.d.ts +27 -0
  129. package/srv/utils/db-sanitize.js +85 -0
  130. package/srv/utils/epoch-slots.d.ts +13 -0
  131. package/srv/utils/epoch-slots.js +25 -0
  132. package/srv/utils/error-codes.d.ts +20 -73
  133. package/srv/utils/error-codes.js +19 -70
  134. package/srv/utils/errors.d.ts +50 -177
  135. package/srv/utils/errors.js +94 -218
  136. package/srv/utils/liveness.d.ts +16 -0
  137. package/srv/utils/liveness.js +40 -0
  138. package/srv/utils/mappers.d.ts +128 -214
  139. package/srv/utils/mappers.js +354 -299
  140. package/srv/utils/network-context.js +2 -11
  141. package/srv/utils/pg-inline-json.d.ts +8 -0
  142. package/srv/utils/pg-inline-json.js +62 -0
  143. package/srv/utils/pg-order-nulls.d.ts +14 -0
  144. package/srv/utils/pg-order-nulls.js +56 -0
  145. package/srv/utils/plutus-placeholders.d.ts +23 -16
  146. package/srv/utils/plutus-placeholders.js +63 -27
  147. package/srv/utils/rate-limiter.d.ts +46 -0
  148. package/srv/utils/rate-limiter.js +116 -0
  149. package/srv/utils/service-events.d.ts +2 -22
  150. package/srv/utils/service-events.js +3 -23
  151. package/srv/utils/signing-helper.d.ts +3 -18
  152. package/srv/utils/signing-helper.js +10 -32
  153. package/srv/utils/tx-build-helper.d.ts +26 -92
  154. package/srv/utils/tx-build-helper.js +68 -123
  155. package/srv/utils/tx-request-parsers.d.ts +107 -21
  156. package/srv/utils/tx-request-parsers.js +433 -34
  157. package/srv/utils/tx-utils.d.ts +4 -23
  158. package/srv/utils/tx-utils.js +12 -41
  159. package/srv/utils/types.d.ts +238 -169
  160. package/srv/utils/types.js +2 -6
  161. package/srv/utils/validators.d.ts +24 -90
  162. package/srv/utils/validators.js +50 -147
@@ -1,364 +1,439 @@
1
- using {odatano.cardano as db} from '../db/schema';
2
- using {Bech32, Lovelace} from '../db/types';
3
-
4
-
5
- /**
6
- * Cardano Transaction Service
7
- *
8
- * Handles transaction building and submission operations.
9
- * Separate from the read-only CardanoODataService to provide
10
- * clear separation between general query and command operations.
11
- *
12
- * Security note: see CardanoODataService (cardano-service.cds) for the rationale
13
- * on service-level auth without per-resource ownership enforcement.
14
- */
15
- @requires: 'authenticated-user'
16
- service CardanoTransactionService @(impl: './cardano-tx-service') {
17
- // ---------------------------------------------------------------------------
18
- // Entity Projections - Transaction Building & Submission
19
- // ---------------------------------------------------------------------------
20
-
21
- @readonly
22
- @title : 'Transaction Builds'
23
- @description: 'Projection for Transaction Builds'
24
- entity TransactionBuilds as projection on db.TransactionBuilds;
25
-
26
- @readonly
27
- @title : 'Transaction Build Inputs'
28
- @description: 'Projection for Transaction Build Inputs'
29
- entity TransactionBuildInputs as projection on db.TransactionBuildInputs;
30
-
31
- @readonly
32
- @title : 'Transaction Build Outputs'
33
- @description: 'Projection for Transaction Build Outputs'
34
- entity TransactionBuildOutputs as projection on db.TransactionBuildOutputs;
35
-
36
- @readonly
37
- @title : 'Transaction Build Input Assets'
38
- @description: 'Projection for Transaction Build Input Assets'
39
- entity TransactionBuildInputAssets as projection on db.TransactionBuildInputAssets;
40
-
41
- @readonly
42
- @title : 'Transaction Build Output Assets'
43
- @description: 'Projection for Transaction Build Output Assets'
44
- entity TransactionBuildOutputAssets as projection on db.TransactionBuildOutputAssets;
45
-
46
- @readonly
47
- @title : 'Transaction Submissions'
48
- @description: 'Projection for Transaction Submissions'
49
- entity TransactionSubmissions as projection on db.TransactionSubmissions
50
- actions {
51
- @title : 'Check Submission Status'
52
- @description: 'Check the status of a submitted transaction by querying the blockchain for confirmation'
53
- action CheckSubmissionStatus() returns TransactionSubmissions;
54
- };
55
- /**
56
- * TransactionSubmissions status flow:
57
- * pending ──[submit to chain]──→ submitted (internal, in SubmitTransaction handler)
58
- * submitted ──[CheckSubmissionStatus]──→ confirmed | stays submitted (conditional)
59
- * pending | submitted ──→ failed (blockchain error)
60
- */
61
- annotate CardanoTransactionService.TransactionSubmissions with @flow.status: status actions {
62
- CheckSubmissionStatus @from : [ #submitted];
63
- };
64
-
65
- @readonly
66
- @title : 'Transaction Submission Errors'
67
- @description: 'Projection for Transaction Submission Errors'
68
- entity TransactionSubmissionErrors as projection on db.TransactionSubmissionErrors;
69
-
70
- @readonly
71
- @title : 'Address Transaction Builds'
72
- @description: 'Projection for retrieving transaction builds by address'
73
- entity AddressTransactionBuilds as projection on db.AddressTransactionBuilds;
74
-
75
- // ---------------------------------------------------------------------------
76
- // Transaction Building Actions
77
- // ---------------------------------------------------------------------------
78
-
79
- @title : 'Build Simple ADA Transaction'
80
- @description: 'Build a simple ADA transfer transaction from sender to recipient with specified amount and change address'
81
- action BuildSimpleAdaTransaction(
82
- @title: 'Sender Address'
83
- @description: 'The Bech32 encoded address of the sender'
84
- senderAddress: Bech32,
85
- @title: 'Recipient Address'
86
- @description: 'The Bech32 encoded address of the recipient'
87
- recipientAddress: Bech32,
88
- @title: 'Lovelace Amount'
89
- @description: 'The amount of ADA to send in lovelace'
90
- lovelaceAmount: Lovelace,
91
- @title: 'Change Address'
92
- @description: 'The Bech32 encoded address for returning change - defaults to sender address if not specified'
93
- changeAddress: Bech32,
94
- @title: 'Output Datum JSON'
95
- @description: 'Optional inline datum to attach to the recipient output (JSON, cardano-cli DetailedSchema format). Required when sending to a script address.'
96
- outputDatumJson: String,
97
- @title: 'Assets JSON'
98
- @description: 'Optional JSON array of native assets to include in the output ([{"unit":"policyId+assetName","quantity":"amount"}]). Use when locking tokens at a script address.'
99
- assetsJson: String,
100
- @title: 'Force Inputs JSON'
101
- @description: 'Optional JSON array of {txHash, outputIndex} UTxOs that MUST be consumed as inputs. Added before coin selection. Use for one-shot minting seeds, token-carrying UTxOs, or deterministic input control.'
102
- forceInputsJson: String,
103
- @title: 'Validator Script'
104
- @description: 'Optional Plutus validator CBOR hex. Required when lockOnScript=true. Used only to derive the target script address — the script itself is not attached to the transaction.'
105
- validatorScript: String,
106
- @title: 'Script Parameters JSON'
107
- @description: 'Optional JSON array of PlutusData parameters to apply to validatorScript before deriving the script address. For parameterized validators.'
108
- scriptParamsJson: String,
109
- @title: 'Lock on Script Address'
110
- @description: 'When true, validatorScript is required. Derives the enterprise script address from the (optionally param-applied) script and routes the output there instead of recipientAddress. Returns scriptAddress and scriptHash in the response.'
111
- lockOnScript: Boolean,
112
- @title: 'Reference Script Hex'
113
- @description: 'Optional Plutus V3 validator CBOR hex to attach as referenceScript on the primary recipient output (CIP-33 reference script deploy). Significantly increases the output min-ADA — lovelaceAmount must cover the inflated requirement.'
114
- referenceScriptHex: String,
115
- @title: 'Validity Start (Posix ms)'
116
- @description: 'Optional. Validity-interval start in Posix milliseconds. Passed through to the builder only; for non-script transfers the builder leaves bounds unset unless provided.'
117
- validityStartMs: String,
118
- @title: 'Validity End (Posix ms)'
119
- @description: 'Optional. Validity-interval end in Posix milliseconds. Passed through to the builder only; for non-script transfers the builder leaves bounds unset unless provided.'
120
- validityEndMs: String) returns TransactionBuilds;
121
-
122
- @title : 'Build Transaction with Metadata'
123
- @description: 'Build a transaction with custom metadata from sender to recipient with specified amount and change address'
124
- action BuildTransactionWithMetadata(
125
- @title: 'Sender Address'
126
- @description: 'The Bech32 encoded address of the sender'
127
- senderAddress: Bech32,
128
- @title: 'Recipient Address'
129
- @description: 'The Bech32 encoded address of the recipient'
130
- recipientAddress: Bech32,
131
- @title: 'Lovelace Amount'
132
- @description: 'The amount of ADA to send in lovelace'
133
- lovelaceAmount: Lovelace,
134
- @title: 'Change Address'
135
- @description: 'The Bech32 encoded address for returning change -defaults to sender address if not specified'
136
- changeAddress: Bech32,
137
- @title: 'Metadata JSON'
138
- @description: 'The JSON representation of the transaction metadata as string'
139
- metadataJson: String) returns TransactionBuilds;
140
-
141
- @title : 'Build Multi-Asset Transaction'
142
- @description: 'Build a transaction to send native assets (tokens) along with ADA'
143
- action BuildMultiAssetTransaction(
144
- @title: 'Sender Address'
145
- @description: 'The Bech32 encoded address of the sender'
146
- senderAddress: Bech32,
147
- @title: 'Recipient Address'
148
- @description: 'The Bech32 encoded address of the recipient'
149
- recipientAddress: Bech32,
150
- @title: 'Lovelace Amount'
151
- @description: 'The amount of ADA to send in lovelace'
152
- lovelaceAmount: Lovelace,
153
- @title: 'Assets JSON'
154
- @description: 'JSON array of assets to send (format: [{"unit":"policyId+assetName","quantity":"amount"}])'
155
- assetsJson: String,
156
- @title: 'Change Address'
157
- @description: 'The Bech32 encoded address for returning change -defaults to sender address if not specified'
158
- changeAddress: Bech32,
159
- @title: 'Output Datum JSON'
160
- @description: 'Optional inline datum to attach to the recipient output (JSON, DetailedSchema). Required when sending to a script address.'
161
- outputDatumJson: String,
162
- @title: 'Reference Script Hex'
163
- @description: 'Optional Plutus V3 validator CBOR hex to attach as referenceScript on the primary recipient output (CIP-33 reference script deploy). Significantly increases the output min-ADA — lovelaceAmount must cover the inflated requirement.'
164
- referenceScriptHex: String,
165
- @title: 'Validity Start (Posix ms)'
166
- @description: 'Optional. Validity-interval start in Posix milliseconds. Passed through to the builder only; for non-script transfers the builder leaves bounds unset unless provided.'
167
- validityStartMs: String,
168
- @title: 'Validity End (Posix ms)'
169
- @description: 'Optional. Validity-interval end in Posix milliseconds. Passed through to the builder only; for non-script transfers the builder leaves bounds unset unless provided.'
170
- validityEndMs: String) returns TransactionBuilds;
171
-
172
- @title : 'Build Minting Transaction'
173
- @description: 'Build a transaction to mint or burn native assets'
174
- action BuildMintTransaction(
175
- @title: 'Sender Address'
176
- @description: 'The Bech32 encoded address of the sender (pays fees)'
177
- senderAddress: Bech32,
178
- @title: 'Recipient Address'
179
- @description: 'The Bech32 encoded address to receive minted assets'
180
- recipientAddress: Bech32,
181
- @title: 'Lovelace Amount'
182
- @description: 'The amount of ADA to send with minted assets in lovelace'
183
- lovelaceAmount: Lovelace,
184
- @title: 'Mint Actions JSON'
185
- @description: 'JSON array of mint/burn actions (format: [{"assetUnit":"policyId+assetName","quantity":"amount"}])'
186
- mintActionsJson: String,
187
- @title: 'Minting Policy Script'
188
- @description: 'The minting policy script in CBOR hex format'
189
- mintingPolicyScript: String,
190
- @title: 'Change Address'
191
- @description: 'The Bech32 encoded address for returning change -defaults to sender address if not specified'
192
- changeAddress: Bech32,
193
- @title: 'Required Signers JSON'
194
- @description: 'Optional JSON array of Ed25519 key hashes (hex, 28 bytes each) that must sign the transaction. Required for Plutus validators checking extra_signatories.'
195
- requiredSignersJson: String,
196
- @title: 'Script Parameters JSON'
197
- @description: 'Optional JSON array of PlutusData parameters to apply to the minting policy script before building. For parameterized validators.'
198
- scriptParamsJson: String,
199
- @title: 'Output Inline Datum JSON'
200
- @description: 'Optional PlutusData JSON to attach as inline datum on the recipient output. Used when minted tokens must carry on-chain state.'
201
- inlineDatumJson: String,
202
- @title: 'Mint Redeemer JSON'
203
- @description: 'Optional PlutusData JSON for the minting policy redeemer. Defaults to integer 0 if not specified.'
204
- mintRedeemerJson: String,
205
- @title: 'Lock on Script Address'
206
- @description: 'When true and scriptParamsJson is provided, routes the output to the enterprise script address derived from the applied script hash instead of recipientAddress. Returns scriptAddress in the response.'
207
- lockOnScript: Boolean,
208
- @title: 'Force Inputs JSON'
209
- @description: 'Optional JSON array of {txHash, outputIndex} UTxOs that MUST be consumed as inputs. Added before coin selection. Use for one-shot minting seeds, token-carrying UTxOs, or deterministic input control.'
210
- forceInputsJson: String,
211
- @title: 'Reference Inputs JSON'
212
- @description: 'Optional JSON array of {txHash, outputIndex} UTxOs to include as CIP-31 reference inputs (read-only, not consumed). Use for oracle feeds, shared config UTxOs, or script reference UTxOs. Buildooor builder only.'
213
- referenceInputsJson: String,
214
- @title: 'Metadata JSON'
215
- @description: 'Optional transaction metadata as JSON (CIP-20 / label-674 etc.). Object keyed by numeric label string. Attached as auxiliary_data to the mint tx so chain-watchers can correlate off-chain context (receipt IDs, free-form notes).'
216
- metadataJson: String,
217
- @title: 'Reference Script Hex'
218
- @description: 'Optional Plutus V3 validator CBOR hex to attach as referenceScript on the primary recipient output (CIP-33 reference script deploy). Significantly increases the output min-ADA — lovelaceAmount must cover the inflated requirement.'
219
- referenceScriptHex: String,
220
- @title: 'Validity Start (Posix ms)'
221
- @description: 'Optional. Sets the transaction validity-interval start in Posix milliseconds. Required finite value for Plutus validators that call expect Finite(lower) on tx.validity_range.lower_bound. Defaults to now − 120 000 ms when omitted.'
222
- validityStartMs: String,
223
- @title: 'Validity End (Posix ms)'
224
- @description: 'Optional. Sets the transaction validity-interval end in Posix milliseconds. Required finite value for Plutus validators that call expect Finite(upper) on tx.validity_range.upper_bound. Defaults to now + 3 600 000 ms when omitted.'
225
- validityEndMs: String) returns TransactionBuilds;
226
-
227
- @title : 'Get Build Details'
228
- @description: 'Retrieve transaction build details using the Build Id'
229
- action GetBuildDetails(
230
- @title: 'Build Id'
231
- @description: 'The unique identifier of the transaction build'
232
- buildId: UUID) returns TransactionBuilds;
233
-
234
- @title : 'Submit Transaction'
235
- @description: 'Submit a transaction to the Cardano network using a build ID and signed CBOR'
236
- action SubmitTransaction(
237
- @title: 'Build Id'
238
- @description: 'The unique identifier of the transaction build'
239
- buildId: UUID,
240
- @title: 'Signed Transaction CBOR'
241
- @description: 'The CBOR of the signed transaction'
242
- signedTxCbor: String) returns TransactionSubmissions;
243
-
244
- @title : 'Submit Signed Transaction'
245
- @description: 'Submit a signed transaction to the Cardano network'
246
- action SubmitSignedTransaction(
247
- @title: 'Signed Transaction CBOR'
248
- @description: 'The CBOR of the signed transaction'
249
- signedTxCbor: String,
250
- @title: 'Network'
251
- @description: 'The Cardano network to submit the transaction to (e.g., mainnet, testnet)'
252
- network: String(10)) returns TransactionSubmissions;
253
-
254
- @title : 'Build Plutus Spend Transaction'
255
- @description: 'Build a transaction to spend a UTxO locked at a Plutus script address'
256
- action BuildPlutusSpendTransaction(
257
- @title: 'Sender Address'
258
- @description: 'The Bech32 encoded address of the sender (pays fees)'
259
- senderAddress: Bech32,
260
- @title: 'Recipient Address'
261
- @description: 'The Bech32 encoded address to receive the unlocked funds'
262
- recipientAddress: Bech32,
263
- @title: 'Lovelace Amount'
264
- @description: 'The amount of ADA to send to the recipient in lovelace'
265
- lovelaceAmount: Lovelace,
266
- @title: 'Validator Script'
267
- @description: 'The Plutus validator script in CBOR hex format'
268
- validatorScript: String,
269
- @title: 'Script UTxO Transaction Hash'
270
- @description: 'The transaction hash of the UTxO locked at the script address (64-char hex)'
271
- scriptTxHash: String,
272
- @title: 'Script UTxO Output Index'
273
- @description: 'The output index of the UTxO locked at the script address'
274
- scriptOutputIndex: Integer,
275
- @title: 'Redeemer JSON'
276
- @description: 'The redeemer data as JSON string (will be converted to PlutusData)'
277
- redeemerJson: String,
278
- @title: 'Datum JSON'
279
- @description: 'The datum data as JSON string (optional, for hash-based datums)'
280
- datumJson: String,
281
- @title: 'Change Address'
282
- @description: 'The Bech32 encoded address for returning change - defaults to sender address if not specified'
283
- changeAddress: Bech32,
284
- @title: 'Required Signers JSON'
285
- @description: 'Optional JSON array of Ed25519 key hashes (hex, 28 bytes each) that must sign the transaction. Required for Plutus validators checking extra_signatories.'
286
- requiredSignersJson: String,
287
- @title: 'Script Parameters JSON'
288
- @description: 'Optional JSON array of PlutusData parameters to apply to the validator script before building. For parameterized validators.'
289
- scriptParamsJson: String,
290
- @title: 'Output Inline Datum JSON'
291
- @description: 'Optional PlutusData JSON to attach as inline datum on the recipient output. Used for state-machine validators that require continuing output datum.'
292
- inlineDatumJson: String,
293
- @title: 'Lock on Script Address'
294
- @description: 'When true and scriptParamsJson is provided, routes the output to the enterprise script address derived from the applied script hash instead of recipientAddress. Returns scriptAddress in the response.'
295
- lockOnScript: Boolean,
296
- @title: 'Force Inputs JSON'
297
- @description: 'Optional JSON array of {txHash, outputIndex} UTxOs that MUST be consumed as inputs. Added before coin selection. Use for one-shot minting seeds, token-carrying UTxOs, or deterministic input control.'
298
- forceInputsJson: String,
299
- @title: 'Extra Outputs JSON'
300
- @description: 'Optional JSON array of additional outputs appended after the primary recipient output, before change. Each entry: {address, lovelaceAmount, assets?: [{unit, quantity}], inlineDatumJson?, referenceScriptHex?}. Use for multi-output state-machine transitions (counter updates + batch NFT outputs) or per-output CIP-33 ref-script deploy. Each extra output is independently min-ADA checked.'
301
- extraOutputsJson: String,
302
- @title: 'Mint Actions JSON'
303
- @description: 'Optional JSON array of mint/burn actions ([{"assetUnit", "quantity"}]). When provided, triggers a combined spend+mint transaction in a single atomic step. Required together with mintingPolicyScript.'
304
- mintActionsJson: String,
305
- @title: 'Minting Policy Script'
306
- @description: 'Optional Plutus minting policy CBOR hex. Required when mintActionsJson is provided. If byte-equal to validatorScript, scriptParamsJson is applied to it as well (multi-purpose script).'
307
- mintingPolicyScript: String,
308
- @title: 'Mint Redeemer JSON'
309
- @description: 'Optional PlutusData JSON for the minting policy redeemer. Defaults to integer 0 if not specified. Supports __INPUT_IDX:txHash#n__ placeholders (Buildooor only).'
310
- mintRedeemerJson: String,
311
- @title: 'Reference Inputs JSON'
312
- @description: 'Optional JSON array of {txHash, outputIndex} UTxOs to include as CIP-31 reference inputs (read-only, not consumed). Use for oracle feeds, shared config UTxOs, or script reference UTxOs. Buildooor builder only.'
313
- referenceInputsJson: String,
314
- @title: 'Reference Script Hex'
315
- @description: 'Optional Plutus V3 validator CBOR hex to attach as referenceScript on the primary recipient output (CIP-33 reference script deploy). Combines with the spend in one atomic tx. Significantly increases the output min-ADA — lovelaceAmount must cover the inflated requirement.'
316
- referenceScriptHex: String,
317
- @title: 'Validity Start (Posix ms)'
318
- @description: 'Optional. Sets the transaction validity-interval start in Posix milliseconds. Required finite value for Plutus validators that call expect Finite(lower) on tx.validity_range.lower_bound. Defaults to now − 120 000 ms when omitted.'
319
- validityStartMs: String,
320
- @title: 'Validity End (Posix ms)'
321
- @description: 'Optional. Sets the transaction validity-interval end in Posix milliseconds. Required finite value for Plutus validators that call expect Finite(upper) on tx.validity_range.upper_bound. Defaults to now + 3 600 000 ms when omitted.'
322
- validityEndMs: String) returns TransactionBuilds;
323
-
324
- @title : 'Set Collateral'
325
- @description: 'Ensure a dedicated ADA-only collateral UTxO exists for Plutus transactions. Checks if the address has at least 2 UTxOs with >= 5 ADA each. If not, builds a self-send transaction to create a 5 ADA collateral UTxO.'
326
- action SetCollateral(
327
- @title: 'Address'
328
- @description: 'The Bech32 encoded address to check and set up collateral for'
329
- address: Bech32) returns TransactionBuilds;
330
- @title : 'Address Transaction Builds'
331
- @description: 'Projection for retrieving transaction builds by address'
332
- action GetTransactionBuildsByAddress(
333
- @title: 'Bech32 Address'
334
- @description: 'The Bech32 encoded address to retrieve transaction builds for'
335
- address: Bech32) returns array of AddressTransactionBuilds;
336
-
337
- @title : 'Derive Script Address'
338
- @description: 'Utility: Apply optional PlutusData parameters to a validator script and return its enterprise script address (bech32) and script hash (28-byte hex). Pure derivation, no transaction built, no blockchain call.'
339
- action DeriveScriptAddress(
340
- @title: 'Validator Script'
341
- @description: 'The Plutus validator script in CBOR hex format'
342
- validatorScript: String,
343
- @title: 'Script Parameters JSON'
344
- @description: 'Optional JSON array of PlutusData parameters to apply to the script before hashing. For parameterized validators.'
345
- scriptParamsJson: String,
346
- @title: 'Network'
347
- @description: 'Optional network override (mainnet, preview, preprod). Defaults to the configured network.'
348
- network: String(10)) returns {
349
- scriptAddress: String(120);
350
- scriptHash: String(56);
351
- };
352
-
353
- @title : 'Extract Payment Key Hash'
354
- @description: 'Utility: Decode a Bech32 Cardano address and return its 28-byte payment credential hash (hex). Pure bech32 decoding — no blockchain call. Use to obtain the key hash for requiredSignersJson on Plutus actions.'
355
- action ExtractPaymentKeyHash(
356
- @title: 'Address'
357
- @description: 'The Bech32 encoded Cardano address (addr / addr_test)'
358
- address: Bech32) returns {
359
- paymentKeyHash: String(56);
360
- };
361
-
362
- }
363
-
364
-
1
+ using {odatano.cardano as db} from '../db/schema';
2
+ using {
3
+ Bech32,
4
+ Lovelace
5
+ } from '../db/types';
6
+
7
+
8
+ /**
9
+ * Cardano Transaction Service
10
+ *
11
+ * Handles transaction building and submission operations.
12
+ * Separate from the read-only CardanoODataService to provide
13
+ * clear separation between general query and command operations.
14
+ *
15
+ * Security note: see CardanoODataService (cardano-service.cds) for the rationale
16
+ * on service-level auth without per-resource ownership enforcement.
17
+ */
18
+ @requires: 'authenticated-user'
19
+ service CardanoTransactionService @(impl: './cardano-tx-service') {
20
+ // ---------------------------------------------------------------------------
21
+ // Entity Projections - Transaction Building & Submission
22
+ // ---------------------------------------------------------------------------
23
+
24
+ @readonly
25
+ @title : 'Transaction Builds'
26
+ @description: 'Projection for Transaction Builds'
27
+ entity TransactionBuilds as projection on db.TransactionBuilds;
28
+
29
+ @readonly
30
+ @title : 'Transaction Build Inputs'
31
+ @description: 'Projection for Transaction Build Inputs'
32
+ entity TransactionBuildInputs as projection on db.TransactionBuildInputs;
33
+
34
+ @readonly
35
+ @title : 'Transaction Build Outputs'
36
+ @description: 'Projection for Transaction Build Outputs'
37
+ entity TransactionBuildOutputs as projection on db.TransactionBuildOutputs;
38
+
39
+ @readonly
40
+ @title : 'Transaction Build Redeemers'
41
+ @description: 'Projection for the redeemers of a script build with their execution units'
42
+ entity TransactionBuildRedeemers as projection on db.TransactionBuildRedeemers;
43
+
44
+ @readonly
45
+ @title : 'Transaction Build Input Assets'
46
+ @description: 'Projection for Transaction Build Input Assets'
47
+ entity TransactionBuildInputAssets as projection on db.TransactionBuildInputAssets;
48
+
49
+ @readonly
50
+ @title : 'Transaction Build Output Assets'
51
+ @description: 'Projection for Transaction Build Output Assets'
52
+ entity TransactionBuildOutputAssets as projection on db.TransactionBuildOutputAssets;
53
+
54
+ @readonly
55
+ @title : 'Transaction Submissions'
56
+ @description: 'Projection for Transaction Submissions'
57
+ entity TransactionSubmissions as projection on db.TransactionSubmissions
58
+ actions {
59
+ @title : 'Check Submission Status'
60
+ @description: 'Check the status of a submitted transaction by querying the blockchain for confirmation'
61
+ action CheckSubmissionStatus() returns TransactionSubmissions;
62
+ };
63
+
64
+ /**
65
+ * TransactionSubmissions status flow:
66
+ * pending -> [submit to chain] -> submitted (internal, in SubmitTransaction handler)
67
+ * submitted -> [CheckSubmissionStatus] confirmed | stays submitted (conditional)
68
+ * pending | submitted -> failed (blockchain error)
69
+ */
70
+ annotate CardanoTransactionService.TransactionSubmissions with @flow.status: status actions {
71
+ CheckSubmissionStatus @from : [ #submitted];
72
+ };
73
+
74
+ @readonly
75
+ @title : 'Transaction Submission Errors'
76
+ @description: 'Projection for Transaction Submission Errors'
77
+ entity TransactionSubmissionErrors as projection on db.TransactionSubmissionErrors;
78
+
79
+ @readonly
80
+ @title : 'Address Transaction Builds'
81
+ @description: 'Projection for retrieving transaction builds by address'
82
+ entity AddressTransactionBuilds as projection on db.AddressTransactionBuilds;
83
+
84
+ // ---------------------------------------------------------------------------
85
+ // Transaction Building Actions
86
+ // ---------------------------------------------------------------------------
87
+
88
+ @title : 'Build Simple ADA Transaction'
89
+ @description: 'Build a simple ADA transfer transaction from sender to recipient with specified amount and change address'
90
+ action BuildSimpleAdaTransaction(
91
+ @title: 'Sender Address'
92
+ @description: 'The Bech32 encoded address of the sender'
93
+ senderAddress: Bech32,
94
+ @title: 'Recipient Address'
95
+ @description: 'The Bech32 encoded address of the recipient'
96
+ recipientAddress: Bech32,
97
+ @title: 'Lovelace Amount'
98
+ @description: 'The amount of ADA to send in lovelace'
99
+ lovelaceAmount: Lovelace,
100
+ @title: 'Change Address'
101
+ @description: 'The Bech32 encoded address for returning change - defaults to sender address if not specified'
102
+ changeAddress: Bech32,
103
+ @title: 'Output Datum JSON'
104
+ @description: 'Optional inline datum to attach to the recipient output (JSON, cardano-cli DetailedSchema format). Required when sending to a script address.'
105
+ outputDatumJson: String,
106
+ @title: 'Output Datum CBOR'
107
+ @description: 'Optional inline datum for the recipient output as PlutusData CBOR hex, written byte for byte. Use instead of outputDatumJson when the datum bytes must match exactly.'
108
+ outputDatumCbor: String,
109
+ @title: 'Ensure Min-ADA'
110
+ @description: 'Optional. When true, a lovelaceAmount below the recipient output min-ADA is raised to it; otherwise such a request is rejected with the required amount.'
111
+ ensureMinAda: Boolean,
112
+ @title: 'Assets JSON'
113
+ @description: 'Optional JSON array of native assets to include in the output ([{"unit":"policyId+assetName","quantity":"amount"}]). Use when locking tokens at a script address.'
114
+ assetsJson: String,
115
+ @title: 'Force Inputs JSON'
116
+ @description: 'Optional JSON array of {txHash, outputIndex} UTxOs that MUST be consumed as inputs. Added before coin selection. Use for one-shot minting seeds, token-carrying UTxOs, or deterministic input control.'
117
+ forceInputsJson: String,
118
+ @title: 'Protect Inputs JSON'
119
+ @description: 'Optional JSON array of {txHash, outputIndex} UTxOs of the sender that must never be spent: left out of coin selection and collateral.'
120
+ protectInputsJson: String,
121
+ @title: 'Validator Script'
122
+ @description: 'Optional Plutus validator CBOR hex. Required when lockOnScript=true. Used only to derive the target script address — the script itself is not attached to the transaction.'
123
+ validatorScript: String,
124
+ @title: 'Script Parameters JSON'
125
+ @description: 'Optional JSON array of PlutusData parameters to apply to validatorScript before deriving the script address. For parameterized validators.'
126
+ scriptParamsJson: String,
127
+ @title: 'Lock on Script Address'
128
+ @description: 'When true, validatorScript is required. Derives the enterprise script address from the (optionally param-applied) script and routes the output there instead of recipientAddress. Returns scriptAddress and scriptHash in the response.'
129
+ lockOnScript: Boolean,
130
+ @title: 'Reference Script Hex'
131
+ @description: 'Optional Plutus V3 validator CBOR hex to attach as referenceScript on the primary recipient output (CIP-33 reference script deploy). Significantly increases the output min-ADA — lovelaceAmount must cover the inflated requirement.'
132
+ referenceScriptHex: String,
133
+ @title: 'Validity Start (Posix ms)'
134
+ @description: 'Optional. Validity-interval start in Posix milliseconds. Passed through to the builder only; for non-script transfers the builder leaves bounds unset unless provided.'
135
+ validityStartMs: String,
136
+ @title: 'Validity End (Posix ms)'
137
+ @description: 'Optional. Validity-interval end in Posix milliseconds. Passed through to the builder only; for non-script transfers the builder leaves bounds unset unless provided.'
138
+ validityEndMs: String) returns TransactionBuilds;
139
+
140
+ @title : 'Build Transaction with Metadata'
141
+ @description: 'Build a transaction with custom metadata from sender to recipient with specified amount and change address'
142
+ action BuildTransactionWithMetadata(
143
+ @title: 'Sender Address'
144
+ @description: 'The Bech32 encoded address of the sender'
145
+ senderAddress: Bech32,
146
+ @title: 'Recipient Address'
147
+ @description: 'The Bech32 encoded address of the recipient'
148
+ recipientAddress: Bech32,
149
+ @title: 'Lovelace Amount'
150
+ @description: 'The amount of ADA to send in lovelace'
151
+ lovelaceAmount: Lovelace,
152
+ @title: 'Change Address'
153
+ @description: 'The Bech32 encoded address for returning change -defaults to sender address if not specified'
154
+ changeAddress: Bech32,
155
+ @title: 'Metadata JSON'
156
+ @description: 'The JSON representation of the transaction metadata as string'
157
+ metadataJson: String) returns TransactionBuilds;
158
+
159
+ @title : 'Build Multi-Asset Transaction'
160
+ @description: 'Build a transaction to send native assets (tokens) along with ADA'
161
+ action BuildMultiAssetTransaction(
162
+ @title: 'Sender Address'
163
+ @description: 'The Bech32 encoded address of the sender'
164
+ senderAddress: Bech32,
165
+ @title: 'Recipient Address'
166
+ @description: 'The Bech32 encoded address of the recipient'
167
+ recipientAddress: Bech32,
168
+ @title: 'Lovelace Amount'
169
+ @description: 'The amount of ADA to send in lovelace'
170
+ lovelaceAmount: Lovelace,
171
+ @title: 'Assets JSON'
172
+ @description: 'JSON array of assets to send (format: [{"unit":"policyId+assetName","quantity":"amount"}])'
173
+ assetsJson: String,
174
+ @title: 'Change Address'
175
+ @description: 'The Bech32 encoded address for returning change -defaults to sender address if not specified'
176
+ changeAddress: Bech32,
177
+ @title: 'Output Datum JSON'
178
+ @description: 'Optional inline datum to attach to the recipient output (JSON, DetailedSchema). Required when sending to a script address.'
179
+ outputDatumJson: String,
180
+ @title: 'Output Datum CBOR'
181
+ @description: 'Optional inline datum for the recipient output as PlutusData CBOR hex, written byte for byte. Use instead of outputDatumJson when the datum bytes must match exactly.'
182
+ outputDatumCbor: String,
183
+ @title: 'Ensure Min-ADA'
184
+ @description: 'Optional. When true, a lovelaceAmount below the recipient output min-ADA is raised to it; otherwise such a request is rejected with the required amount.'
185
+ ensureMinAda: Boolean,
186
+ @title: 'Reference Script Hex'
187
+ @description: 'Optional Plutus V3 validator CBOR hex to attach as referenceScript on the primary recipient output (CIP-33 reference script deploy). Significantly increases the output min-ADA — lovelaceAmount must cover the inflated requirement.'
188
+ referenceScriptHex: String,
189
+ @title: 'Validity Start (Posix ms)'
190
+ @description: 'Optional. Validity-interval start in Posix milliseconds. Passed through to the builder only; for non-script transfers the builder leaves bounds unset unless provided.'
191
+ validityStartMs: String,
192
+ @title: 'Validity End (Posix ms)'
193
+ @description: 'Optional. Validity-interval end in Posix milliseconds. Passed through to the builder only; for non-script transfers the builder leaves bounds unset unless provided.'
194
+ validityEndMs: String) returns TransactionBuilds;
195
+
196
+ @title : 'Build Minting Transaction'
197
+ @description: 'Build a transaction to mint or burn native assets'
198
+ action BuildMintTransaction(
199
+ @title: 'Sender Address'
200
+ @description: 'The Bech32 encoded address of the sender (pays fees)'
201
+ senderAddress: Bech32,
202
+ @title: 'Recipient Address'
203
+ @description: 'The Bech32 encoded address to receive minted assets'
204
+ recipientAddress: Bech32,
205
+ @title: 'Lovelace Amount'
206
+ @description: 'The amount of ADA to send with minted assets in lovelace'
207
+ lovelaceAmount: Lovelace,
208
+ @title: 'Mint Actions JSON'
209
+ @description: 'JSON array of mint/burn actions (format: [{"assetUnit":"policyId+assetName","quantity":"amount"}]). Multi-policy mints: each action may additionally carry its own "mintingPolicyScript" (CBOR hex, pre-applied) and "redeemerJson" (JSON-encoded PlutusData string), overriding the top-level policy/redeemer for that action. Actions resolving to the same policy must agree on their redeemer (the ledger carries one redeemer per policy).'
210
+ mintActionsJson: String,
211
+ @title: 'Minting Policy Script'
212
+ @description: 'The minting policy script in CBOR hex format. Actions without a per-action mintingPolicyScript mint under this script.'
213
+ mintingPolicyScript: String,
214
+ @title: 'Change Address'
215
+ @description: 'The Bech32 encoded address for returning change -defaults to sender address if not specified'
216
+ changeAddress: Bech32,
217
+ @title: 'Required Signers JSON'
218
+ @description: 'Optional JSON array of Ed25519 key hashes (hex, 28 bytes each) that must sign the transaction. Required for Plutus validators checking extra_signatories.'
219
+ requiredSignersJson: String,
220
+ @title: 'Script Parameters JSON'
221
+ @description: 'Optional JSON array of PlutusData parameters to apply to the minting policy script before building. For parameterized validators.'
222
+ scriptParamsJson: String,
223
+ @title: 'Output Inline Datum JSON'
224
+ @description: 'Optional PlutusData JSON to attach as inline datum on the recipient output. Used when minted tokens must carry on-chain state.'
225
+ inlineDatumJson: String,
226
+ @title: 'Mint Redeemer JSON'
227
+ @description: 'Optional PlutusData JSON for the minting policy redeemer. Defaults to integer 0 if not specified.'
228
+ mintRedeemerJson: String,
229
+ @title: 'Lock on Script Address'
230
+ @description: 'When true and scriptParamsJson is provided, routes the output to the enterprise script address derived from the applied script hash instead of recipientAddress. Returns scriptAddress in the response.'
231
+ lockOnScript: Boolean,
232
+ @title: 'Force Inputs JSON'
233
+ @description: 'Optional JSON array of {txHash, outputIndex} UTxOs that MUST be consumed as inputs. Added before coin selection. Use for one-shot minting seeds, token-carrying UTxOs, or deterministic input control.'
234
+ forceInputsJson: String,
235
+ @title: 'Protect Inputs JSON'
236
+ @description: 'Optional JSON array of {txHash, outputIndex} UTxOs of the sender that must never be spent: left out of coin selection and collateral.'
237
+ protectInputsJson: String,
238
+ @title: 'Reference Inputs JSON'
239
+ @description: 'Optional JSON array of {txHash, outputIndex} UTxOs to include as CIP-31 reference inputs (read-only, not consumed). Use for oracle feeds, shared config UTxOs, or script reference UTxOs. Buildooor builder only.'
240
+ referenceInputsJson: String,
241
+ @title: 'Extra Outputs JSON'
242
+ @description: 'Optional JSON array of additional outputs [{address, lovelaceAmount, assets?, inlineDatumJson?, referenceScriptHex?}] appended after the primary recipient output. When present, the extra outputs carry the minted assets (declare each minted unit in an entry''s assets) and the primary output stays ADA-only — to place each minted token on its own output with its own inline datum (e.g. datum-bound predicate tokens). Each entry is independently min-ADA checked.'
243
+ extraOutputsJson: String,
244
+ @title: 'Metadata JSON'
245
+ @description: 'Optional transaction metadata as JSON (CIP-20 / label-674 etc.). Object keyed by numeric label string. Attached as auxiliary_data to the mint tx so chain-watchers can correlate off-chain context (receipt IDs, free-form notes).'
246
+ metadataJson: String,
247
+ @title: 'Reference Script Hex'
248
+ @description: 'Optional Plutus V3 validator CBOR hex to attach as referenceScript on the primary recipient output (CIP-33 reference script deploy). Significantly increases the output min-ADA — lovelaceAmount must cover the inflated requirement.'
249
+ referenceScriptHex: String,
250
+ @title: 'Validity Start (Posix ms)'
251
+ @description: 'Optional. Sets the transaction validity-interval start in Posix milliseconds. Required finite value for Plutus validators that call expect Finite(lower) on tx.validity_range.lower_bound. Defaults to now − 120 000 ms when omitted.'
252
+ validityStartMs: String,
253
+ @title: 'Validity End (Posix ms)'
254
+ @description: 'Optional. Sets the transaction validity-interval end in Posix milliseconds. Required finite value for Plutus validators that call expect Finite(upper) on tx.validity_range.upper_bound. Defaults to now + 3 600 000 ms when omitted.'
255
+ validityEndMs: String) returns TransactionBuilds;
256
+
257
+ @title : 'Get Build Details'
258
+ @description: 'Retrieve transaction build details using the Build Id'
259
+ action GetBuildDetails(
260
+ @title: 'Build Id'
261
+ @description: 'The unique identifier of the transaction build'
262
+ buildId: UUID) returns TransactionBuilds;
263
+
264
+ @title : 'Submit Transaction'
265
+ @description: 'Submit a transaction to the Cardano network using a build ID and signed CBOR'
266
+ action SubmitTransaction(
267
+ @title: 'Build Id'
268
+ @description: 'The unique identifier of the transaction build'
269
+ buildId: UUID,
270
+ @title: 'Signed Transaction CBOR'
271
+ @description: 'The CBOR of the signed transaction'
272
+ signedTxCbor: String) returns TransactionSubmissions;
273
+
274
+ @title : 'Submit Signed Transaction'
275
+ @description: 'Submit a signed transaction to the Cardano network'
276
+ action SubmitSignedTransaction(
277
+ @title: 'Signed Transaction CBOR'
278
+ @description: 'The CBOR of the signed transaction'
279
+ signedTxCbor: String,
280
+ @title: 'Network'
281
+ @description: 'The Cardano network to submit the transaction to (e.g., mainnet, testnet)'
282
+ network: String(10)) returns TransactionSubmissions;
283
+
284
+ @title : 'Build Plutus Spend Transaction'
285
+ @description: 'Build a transaction to spend a UTxO locked at a Plutus script address'
286
+ action BuildPlutusSpendTransaction(
287
+ @title: 'Sender Address'
288
+ @description: 'The Bech32 encoded address of the sender (pays fees)'
289
+ senderAddress: Bech32,
290
+ @title: 'Recipient Address'
291
+ @description: 'The Bech32 encoded address to receive the unlocked funds'
292
+ recipientAddress: Bech32,
293
+ @title: 'Lovelace Amount'
294
+ @description: 'The amount of ADA to send to the recipient in lovelace'
295
+ lovelaceAmount: Lovelace,
296
+ @title: 'Validator Script'
297
+ @description: 'The Plutus validator script in CBOR hex format'
298
+ validatorScript: String,
299
+ @title: 'Script UTxO Transaction Hash'
300
+ @description: 'The transaction hash of the UTxO locked at the script address (64-char hex)'
301
+ scriptTxHash: String,
302
+ @title: 'Script UTxO Output Index'
303
+ @description: 'The output index of the UTxO locked at the script address'
304
+ scriptOutputIndex: Integer,
305
+ @title: 'Redeemer JSON'
306
+ @description: 'The redeemer data as JSON string (will be converted to PlutusData)'
307
+ redeemerJson: String,
308
+ @title: 'Datum JSON'
309
+ @description: 'The datum data as JSON string (optional, for hash-based datums)'
310
+ datumJson: String,
311
+ @title: 'Change Address'
312
+ @description: 'The Bech32 encoded address for returning change - defaults to sender address if not specified'
313
+ changeAddress: Bech32,
314
+ @title: 'Required Signers JSON'
315
+ @description: 'Optional JSON array of Ed25519 key hashes (hex, 28 bytes each) that must sign the transaction. Required for Plutus validators checking extra_signatories.'
316
+ requiredSignersJson: String,
317
+ @title: 'Script Parameters JSON'
318
+ @description: 'Optional JSON array of PlutusData parameters to apply to the validator script before building. For parameterized validators.'
319
+ scriptParamsJson: String,
320
+ @title: 'Output Inline Datum JSON'
321
+ @description: 'Optional PlutusData JSON to attach as inline datum on the recipient output. Used for state-machine validators that require continuing output datum.'
322
+ inlineDatumJson: String,
323
+ @title: 'Lock on Script Address'
324
+ @description: 'When true and scriptParamsJson is provided, routes the output to the enterprise script address derived from the applied script hash instead of recipientAddress. Returns scriptAddress in the response.'
325
+ lockOnScript: Boolean,
326
+ @title: 'Force Inputs JSON'
327
+ @description: 'Optional JSON array of {txHash, outputIndex} UTxOs that MUST be consumed as inputs. Added before coin selection. Use for one-shot minting seeds, token-carrying UTxOs, or deterministic input control.'
328
+ forceInputsJson: String,
329
+ @title: 'Protect Inputs JSON'
330
+ @description: 'Optional JSON array of {txHash, outputIndex} UTxOs of the sender that must never be spent: left out of coin selection and collateral.'
331
+ protectInputsJson: String,
332
+ @title: 'Extra Outputs JSON'
333
+ @description: 'Optional JSON array of additional outputs appended after the primary recipient output, before change. Each entry: {address, lovelaceAmount, assets?: [{unit, quantity}], inlineDatumJson?, referenceScriptHex?}. Use for multi-output state-machine transitions (counter updates + batch NFT outputs) or per-output CIP-33 ref-script deploy. Each extra output is independently min-ADA checked.'
334
+ extraOutputsJson: String,
335
+ @title: 'Mint Actions JSON'
336
+ @description: 'Optional JSON array of mint/burn actions ([{"assetUnit", "quantity"}]). When provided, triggers a combined spend+mint transaction in a single atomic step. Required together with mintingPolicyScript.'
337
+ mintActionsJson: String,
338
+ @title: 'Minting Policy Script'
339
+ @description: 'Optional Plutus minting policy CBOR hex. Required when mintActionsJson is provided. If byte-equal to validatorScript, scriptParamsJson is applied to it as well (multi-purpose script).'
340
+ mintingPolicyScript: String,
341
+ @title: 'Mint Redeemer JSON'
342
+ @description: 'Optional PlutusData JSON for the minting policy redeemer. Defaults to integer 0 if not specified. Supports __INPUT_IDX:txHash#n__ placeholders (Buildooor only).'
343
+ mintRedeemerJson: String,
344
+ @title: 'Reference Inputs JSON'
345
+ @description: 'Optional JSON array of {txHash, outputIndex} UTxOs to include as CIP-31 reference inputs (read-only, not consumed). Use for oracle feeds, shared config UTxOs, or script reference UTxOs. Buildooor builder only.'
346
+ referenceInputsJson: String,
347
+ @title: 'Reference Script Hex'
348
+ @description: 'Optional Plutus V3 validator CBOR hex to attach as referenceScript on the primary recipient output (CIP-33 reference script deploy). Combines with the spend in one atomic tx. Significantly increases the output min-ADA — lovelaceAmount must cover the inflated requirement.'
349
+ referenceScriptHex: String,
350
+ @title: 'Validity Start (Posix ms)'
351
+ @description: 'Optional. Sets the transaction validity-interval start in Posix milliseconds. Required finite value for Plutus validators that call expect Finite(lower) on tx.validity_range.lower_bound. Defaults to now − 120 000 ms when omitted.'
352
+ validityStartMs: String,
353
+ @title: 'Validity End (Posix ms)'
354
+ @description: 'Optional. Sets the transaction validity-interval end in Posix milliseconds. Required finite value for Plutus validators that call expect Finite(upper) on tx.validity_range.upper_bound. Defaults to now + 3 600 000 ms when omitted.'
355
+ validityEndMs: String) returns TransactionBuilds;
356
+
357
+ @title : 'Build Plutus Transaction'
358
+ @description: 'Spend several script UTxOs in one transaction, each with its own redeemer (inline validator or a reference-script UTxO). The outputs are built exactly in the given order, change comes after them. The execution units of every redeemer are returned under redeemers.'
359
+ action BuildPlutusTransaction(
360
+ @title: 'Sender Address'
361
+ @description: 'Pays the fee, funds the rest and provides the ADA-only collateral'
362
+ senderAddress: Bech32,
363
+ @title: 'Change Address'
364
+ @description: 'Receives the change; defaults to senderAddress'
365
+ changeAddress: Bech32,
366
+ @title: 'Script Inputs JSON'
367
+ @description: 'Required JSON array, 1..16 entries: {txHash, outputIndex, validatorScript (CBOR hex) | referenceScript: {txHash, outputIndex}, scriptParamsJson?, redeemerJson | redeemerCbor, datumJson | datumCbor (hash datums only)}. The *Cbor forms take PlutusData CBOR hex byte for byte. In any redeemer or datum JSON, __INPUT_IDX:<txHash>#<n>__ resolves to the index in the final sorted inputs, __REF_IDX:<txHash>#<n>__ to the index in the sorted reference inputs (reference-script UTxOs included) and __WDRL_IDX:<credential hash>__ to the index in the withdrawals in ledger order.'
368
+ scriptInputsJson: String,
369
+ @title: 'Outputs JSON'
370
+ @description: 'Required JSON array of outputs in this order: {address, lovelaceAmount, assets?: [{unit, quantity}], inlineDatumJson? | inlineDatumCbor? | datumHash?, referenceScriptHex?}. Each is min-ADA checked; change is appended after them and never merged into one.'
371
+ outputsJson: String,
372
+ @title: 'Reference Inputs JSON'
373
+ @description: 'Optional JSON array of {txHash, outputIndex} read-only reference inputs; reference-script UTxOs of scriptInputsJson are added automatically.'
374
+ referenceInputsJson: String,
375
+ @title: 'Force Inputs JSON'
376
+ @description: 'Optional JSON array of {txHash, outputIndex} UTxOs that must be consumed. A UTxO of another key address needs that address''s payment key hash in requiredSignersJson, and every unit it brings must be spent by outputsJson (nothing of it goes to the change); it is never collateral.'
377
+ forceInputsJson: String,
378
+ @title: 'Protect Inputs JSON'
379
+ @description: 'Optional JSON array of {txHash, outputIndex} UTxOs of the sender that must never be spent: left out of coin selection and collateral.'
380
+ protectInputsJson: String,
381
+ @title: 'Withdrawals JSON'
382
+ @description: 'Optional JSON array, 1..16 entries: {rewardAddress, lovelace (0 allowed), stakingScript (CBOR hex) | referenceScript: {txHash, outputIndex}, scriptParamsJson?, redeemerJson | redeemerCbor}. With a script the withdrawal runs it under the Reward purpose (withdraw-zero pattern), without one the stake key signs. The reward account must be registered on chain.'
383
+ withdrawalsJson: String,
384
+ @title: 'Certificates JSON'
385
+ @description: 'Optional JSON array, 1..16 entries: {type: registerStake | deregisterStake, stakeAddress, deposit?, stakingScript (CBOR hex) | referenceScript: {txHash, outputIndex}, scriptParamsJson?, redeemerJson | redeemerCbor}. A registration without a script needs no witness (key or script credential); with a script it is the Conway deposit form and the script runs under the Certifying purpose. A deregistration of a script credential needs the script; of a key credential the key''s witness. The deposit is balanced by the builder.'
386
+ certificatesJson: String,
387
+ @title: 'Required Signers JSON'
388
+ @description: 'Optional JSON array of Ed25519 key hashes (hex, 28 bytes each) that must sign the transaction.'
389
+ requiredSignersJson: String,
390
+ @title: 'Mint Actions JSON'
391
+ @description: 'Optional JSON array of [{assetUnit, quantity, mintingPolicyScript | referenceScript: {txHash, outputIndex}, redeemerJson?}]; every action names its own policy. With referenceScript the assetUnit is policyId+assetName and the policy id must be the hash of that script. Minted assets go where outputsJson puts them.'
392
+ mintActionsJson: String,
393
+ @title: 'Validity Start (Posix ms)'
394
+ @description: 'Optional validity-interval start in Posix milliseconds; defaults to now - 120 000 ms.'
395
+ validityStartMs: String,
396
+ @title: 'Validity End (Posix ms)'
397
+ @description: 'Optional validity-interval end in Posix milliseconds; defaults to now + 3 600 000 ms.'
398
+ validityEndMs: String) returns TransactionBuilds;
399
+
400
+ @title : 'Set Collateral'
401
+ @description: 'Ensure a dedicated ADA-only collateral UTxO exists for Plutus transactions. Checks if the address has at least 2 UTxOs with >= 5 ADA each. If not, builds a self-send transaction to create a 5 ADA collateral UTxO.'
402
+ action SetCollateral(
403
+ @title: 'Address'
404
+ @description: 'The Bech32 encoded address to check and set up collateral for'
405
+ address: Bech32) returns TransactionBuilds;
406
+
407
+ @title : 'Address Transaction Builds'
408
+ @description: 'Projection for retrieving transaction builds by address'
409
+ action GetTransactionBuildsByAddress(
410
+ @title: 'Bech32 Address'
411
+ @description: 'The Bech32 encoded address to retrieve transaction builds for'
412
+ address: Bech32) returns array of AddressTransactionBuilds;
413
+
414
+ @title : 'Derive Script Address'
415
+ @description: 'Utility: Apply optional PlutusData parameters to a validator script and return its enterprise script address (bech32) and script hash (28-byte hex). Pure derivation, no transaction built, no blockchain call.'
416
+ action DeriveScriptAddress(
417
+ @title: 'Validator Script'
418
+ @description: 'The Plutus validator script in CBOR hex format'
419
+ validatorScript: String,
420
+ @title: 'Script Parameters JSON'
421
+ @description: 'Optional JSON array of PlutusData parameters to apply to the script before hashing. For parameterized validators.'
422
+ scriptParamsJson: String,
423
+ @title: 'Network'
424
+ @description: 'Optional network override (mainnet, preview, preprod). Defaults to the configured network.'
425
+ network: String(10)) returns {
426
+ scriptAddress : String(120);
427
+ scriptHash : String(56);
428
+ };
429
+
430
+ @title : 'Extract Payment Key Hash'
431
+ @description: 'Utility: Decode a Bech32 Cardano address and return its 28-byte payment credential hash (hex). Pure bech32 decoding — no blockchain call. Use to obtain the key hash for requiredSignersJson on Plutus actions.'
432
+ action ExtractPaymentKeyHash(
433
+ @title: 'Address'
434
+ @description: 'The Bech32 encoded Cardano address (addr / addr_test)'
435
+ address: Bech32) returns {
436
+ paymentKeyHash : String(56);
437
+ };
438
+
439
+ }