@odatano/core 1.8.0 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/@cds-models/CardanoODataService/index.d.ts +66 -42
- package/@cds-models/CardanoODataService/index.d.ts.map +1 -1
- package/@cds-models/CardanoODataService/index.js.map +1 -1
- package/@cds-models/CardanoODataService/index.ts +11 -7
- package/@cds-models/odatano/cardano/index.d.ts +70 -46
- package/@cds-models/odatano/cardano/index.d.ts.map +1 -1
- package/@cds-models/odatano/cardano/index.js +2 -2
- package/@cds-models/odatano/cardano/index.js.map +1 -1
- package/@cds-models/odatano/cardano/index.ts +13 -13
- package/db/schema.cds +18 -18
- package/db/types.cds +3 -3
- package/package.json +17 -2
- package/src/index.d.ts +29 -0
- package/src/index.js +1 -0
- package/src/plugin.d.ts +2 -0
- package/src/plugin.js +6 -0
- package/srv/blockchain/backends/blockfrost-backend.d.ts +155 -0
- package/srv/blockchain/backends/blockfrost-backend.js +19 -8
- package/srv/blockchain/backends/cardano-backend.d.ts +182 -0
- package/srv/blockchain/backends/koios-backend.d.ts +171 -0
- package/srv/blockchain/backends/koios-backend.js +69 -27
- package/srv/blockchain/backends/ogmios-backend.d.ts +188 -0
- package/srv/blockchain/backends/ogmios-backend.js +175 -108
- package/srv/blockchain/cardano-client.d.ts +279 -0
- package/srv/blockchain/cardano-client.js +134 -33
- package/srv/blockchain/cardano-indexer.d.ts +330 -0
- package/srv/blockchain/cardano-indexer.js +51 -8
- package/srv/blockchain/cardano-tx-builder.d.ts +113 -0
- package/srv/blockchain/cardano-tx-builder.js +61 -54
- package/srv/blockchain/circuit-breaker.d.ts +37 -0
- package/srv/blockchain/circuit-breaker.js +11 -2
- package/srv/blockchain/request-coalescer.d.ts +23 -0
- package/srv/blockchain/signing/external-signer.d.ts +146 -0
- package/srv/blockchain/signing/external-signer.js +23 -0
- package/srv/blockchain/signing/hsm-signer.d.ts +74 -0
- package/srv/blockchain/signing/hsm-signer.js +20 -5
- package/srv/blockchain/signing/signature-verifier.d.ts +56 -0
- package/srv/blockchain/signing/signature-verifier.js +11 -2
- package/srv/blockchain/transaction-building/buildooor-tx.d.ts +236 -0
- package/srv/blockchain/transaction-building/buildooor-tx.js +626 -187
- package/srv/blockchain/transaction-building/cardano-tx.d.ts +47 -0
- package/srv/cardano-service.cds +23 -3
- package/srv/cardano-service.d.ts +2 -0
- package/srv/cardano-service.js +25 -5
- package/srv/cardano-sign-service.d.ts +2 -0
- package/srv/cardano-sign-service.js +219 -131
- package/srv/cardano-tx-service.d.ts +12 -0
- package/srv/cardano-tx-service.js +152 -110
- package/srv/cbor/index.d.ts +2 -0
- package/srv/cbor/parse.d.ts +64 -0
- package/srv/server.d.ts +90 -0
- package/srv/server.js +27 -9
- package/srv/utils/backend-request-handler.d.ts +20 -0
- package/srv/utils/const.d.ts +183 -0
- package/srv/utils/const.js +13 -6
- package/srv/utils/error-codes.d.ts +79 -0
- package/srv/utils/errors.d.ts +259 -0
- package/srv/utils/errors.js +22 -7
- package/srv/utils/mappers.d.ts +260 -0
- package/srv/utils/mappers.js +34 -10
- package/srv/utils/plutus-placeholders.d.ts +35 -0
- package/srv/utils/plutus-placeholders.js +5 -15
- package/srv/utils/signing-helper.d.ts +23 -0
- package/srv/utils/signing-helper.js +5 -2
- package/srv/utils/tx-build-helper.d.ts +76 -0
- package/srv/utils/tx-build-helper.js +10 -37
- package/srv/utils/types.d.ts +653 -0
- package/srv/utils/validators.d.ts +145 -0
- package/srv/utils/validators.js +28 -1
- package/@cds-models/CardanoWatcherAdminService/index.js +0 -109
- package/@cds-models/CardanoWatcherAdminService/index.js.map +0 -1
- package/@cds-models/CardanoWatcherAdminService/index.ts +0 -263
- package/@cds-models/cds/outbox/index.js.map +0 -1
- package/@cds-models/cds/xt/MTXServices/index.js +0 -8
- package/@cds-models/cds/xt/MTXServices/index.js.map +0 -1
- package/@cds-models/cds/xt/MTXServices/index.ts +0 -4
- package/@cds-models/odatano/reeve/index.js +0 -77
- package/@cds-models/odatano/reeve/index.js.map +0 -1
- package/@cds-models/odatano/reeve/index.ts +0 -57
- package/@cds-models/odatano/transactions/index.js +0 -55
- package/@cds-models/odatano/transactions/index.js.map +0 -1
- package/@cds-models/odatano/transactions/index.ts +0 -18
- package/@cds-models/odatano/watch/index.js +0 -114
- package/@cds-models/odatano/watch/index.js.map +0 -1
- package/@cds-models/odatano/watch/index.ts +0 -110
- package/config/preview/cardano-node/alonzo-genesis.json +0 -196
- package/config/preview/cardano-node/byron-genesis.json +0 -117
- package/config/preview/cardano-node/config.json +0 -117
- package/config/preview/cardano-node/conway-genesis.json +0 -297
- package/config/preview/cardano-node/peer-snapshot.json +0 -890
- package/config/preview/cardano-node/shelley-genesis.json +0 -68
- package/config/preview/cardano-node/topology.json +0 -24
- package/output/sora/iter0_base.json +0 -32
- package/output/sora/iter0_base.mp4 +0 -0
- package/output/sora/logo_ref_1280x720.png +0 -0
- package/output/sora/odatano_full_logo_sky_ref_1280x720.png +0 -0
- package/output/sora/odatano_full_logo_transparent.png +0 -0
- package/output/sora/odatano_full_logo_transparent_dark.png +0 -0
- package/output/sora/odatano_full_logo_v4_8s.json +0 -32
- package/output/sora/odatano_full_logo_v4_8s.mp4 +0 -0
- package/output/sora/odatano_full_logo_v5_create.json +0 -15
- package/output/sora/odatano_full_logo_v5_fixes.json +0 -15
- package/output/sora/odatano_full_logo_v5_fixes.mp4 +0 -0
- package/output/sora/odatano_logo_v1.json +0 -32
- package/output/sora/odatano_logo_v1.mp4 +0 -0
- package/output/sora/odatano_o_only_clean.png +0 -0
- package/output/sora/odatano_o_sky_ref_1280x720.png +0 -0
- package/output/sora/odatano_o_sky_v2_8s.json +0 -32
- package/output/sora/odatano_o_sky_v2_8s.mp4 +0 -0
- package/output/sora/odatano_o_sky_v3_create.json +0 -15
- package/output/sora/odatano_o_sky_v3_splash_text.json +0 -15
- package/output/sora/odatano_o_sky_v3_splash_text.mp4 +0 -0
- package/output/sora/odatano_v6_composite_exact_logo.mp4 +0 -0
- package/output/sora/odatano_v6_composite_exact_logo_clean.mp4 +0 -0
- package/output/sora/odatano_v6_composite_exact_logo_final.mp4 +0 -0
- package/output/sora/odatano_v6_endframe.jpg +0 -0
- package/output/sora/odatano_v6_endframe_clean.jpg +0 -0
- package/output/sora/odatano_v6_endframe_final.jpg +0 -0
- package/output/sora/odatano_v7_1_earlylogo_fadeoldtext.mp4 +0 -0
- package/output/sora/odatano_v7_1_end.jpg +0 -0
- package/output/sora/odatano_v7_1_transition.jpg +0 -0
- package/output/sora/odatano_v7_2_original2d_keep_sky.mp4 +0 -0
- package/output/sora/odatano_v7_endframe_nobg.jpg +0 -0
- package/output/sora/odatano_v7_endframe_nobg_cleanend.jpg +0 -0
- package/output/sora/odatano_v7_spin_splash_logo_nobg.mp4 +0 -0
- package/output/sora/odatano_v7_spin_splash_logo_nobg_cleanend.mp4 +0 -0
- package/prod.mtaext +0 -17
- package/prod.mtaext.example +0 -27
- package/review.md +0 -42
- package/src/index.d.ts.map +0 -1
- package/src/index.js.map +0 -1
- package/src/plugin.d.ts.map +0 -1
- package/src/plugin.js.map +0 -1
- package/srv/blockchain/backends/blockfrost-backend.d.ts.map +0 -1
- package/srv/blockchain/backends/blockfrost-backend.js.map +0 -1
- package/srv/blockchain/backends/cardano-backend.d.ts.map +0 -1
- package/srv/blockchain/backends/cardano-backend.js.map +0 -1
- package/srv/blockchain/backends/koios-backend.d.ts.map +0 -1
- package/srv/blockchain/backends/koios-backend.js.map +0 -1
- package/srv/blockchain/backends/ogmios-backend.d.ts.map +0 -1
- package/srv/blockchain/backends/ogmios-backend.js.map +0 -1
- package/srv/blockchain/cardano-client.d.ts.map +0 -1
- package/srv/blockchain/cardano-client.js.map +0 -1
- package/srv/blockchain/cardano-indexer.d.ts.map +0 -1
- package/srv/blockchain/cardano-indexer.js.map +0 -1
- package/srv/blockchain/cardano-tx-builder.d.ts.map +0 -1
- package/srv/blockchain/cardano-tx-builder.js.map +0 -1
- package/srv/blockchain/circuit-breaker.d.ts.map +0 -1
- package/srv/blockchain/circuit-breaker.js.map +0 -1
- package/srv/blockchain/request-coalescer.d.ts.map +0 -1
- package/srv/blockchain/request-coalescer.js.map +0 -1
- package/srv/blockchain/signing/external-signer.d.ts.map +0 -1
- package/srv/blockchain/signing/external-signer.js.map +0 -1
- package/srv/blockchain/signing/hsm-signer.d.ts.map +0 -1
- package/srv/blockchain/signing/hsm-signer.js.map +0 -1
- package/srv/blockchain/signing/signature-verifier.d.ts.map +0 -1
- package/srv/blockchain/signing/signature-verifier.js.map +0 -1
- package/srv/blockchain/transaction-building/buildooor-tx.d.ts.map +0 -1
- package/srv/blockchain/transaction-building/buildooor-tx.js.map +0 -1
- package/srv/blockchain/transaction-building/cardano-tx.d.ts.map +0 -1
- package/srv/blockchain/transaction-building/cardano-tx.js.map +0 -1
- package/srv/cardano-service.d.ts.map +0 -1
- package/srv/cardano-service.js.map +0 -1
- package/srv/cardano-sign-service.d.ts.map +0 -1
- package/srv/cardano-sign-service.js.map +0 -1
- package/srv/cardano-tx-service.d.ts.map +0 -1
- package/srv/cardano-tx-service.js.map +0 -1
- package/srv/cbor/index.d.ts.map +0 -1
- package/srv/cbor/index.js.map +0 -1
- package/srv/cbor/parse.d.ts.map +0 -1
- package/srv/cbor/parse.js.map +0 -1
- package/srv/server.d.ts.map +0 -1
- package/srv/server.js.map +0 -1
- package/srv/utils/backend-request-handler.d.ts.map +0 -1
- package/srv/utils/backend-request-handler.js.map +0 -1
- package/srv/utils/const.d.ts.map +0 -1
- package/srv/utils/const.js.map +0 -1
- package/srv/utils/error-codes.d.ts.map +0 -1
- package/srv/utils/error-codes.js.map +0 -1
- package/srv/utils/errors.d.ts.map +0 -1
- package/srv/utils/errors.js.map +0 -1
- package/srv/utils/mappers.d.ts.map +0 -1
- package/srv/utils/mappers.js.map +0 -1
- package/srv/utils/plutus-placeholders.d.ts.map +0 -1
- package/srv/utils/plutus-placeholders.js.map +0 -1
- package/srv/utils/signing-helper.d.ts.map +0 -1
- package/srv/utils/signing-helper.js.map +0 -1
- package/srv/utils/tx-build-helper.d.ts.map +0 -1
- package/srv/utils/tx-build-helper.js.map +0 -1
- package/srv/utils/types.d.ts.map +0 -1
- package/srv/utils/types.js.map +0 -1
- package/srv/utils/validators.d.ts.map +0 -1
- package/srv/utils/validators.js.map +0 -1
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { TxBuildRequest, TxBuildMintRequest, TxBuildPlutusSpendRequest, TxBuildContext, TxBuildResult, LedgerProtocolParameters } from "../../utils/types";
|
|
2
|
+
import { CardanoClient } from "../cardano-client";
|
|
3
|
+
/**
|
|
4
|
+
* CardanoTxBuilder - Interface Definition for the Cardano transaction builder (Buildooor)
|
|
5
|
+
* Defines the standard methods that any Cardano transaction builder must implement to be used interchangeably.
|
|
6
|
+
*/
|
|
7
|
+
export interface CardanoTxBuilder {
|
|
8
|
+
/**
|
|
9
|
+
* Builder name
|
|
10
|
+
*/
|
|
11
|
+
name: string;
|
|
12
|
+
/**
|
|
13
|
+
* Initialize the builder
|
|
14
|
+
* @param client - The CardanoClient instance
|
|
15
|
+
* @param protocolParams - Optional protocol parameters (if not provided, fetched from backend)
|
|
16
|
+
*/
|
|
17
|
+
init(client: CardanoClient, protocolParams?: LedgerProtocolParameters): Promise<void>;
|
|
18
|
+
/**
|
|
19
|
+
* Build unsigned transfer transaction (ADA-only or with native assets)
|
|
20
|
+
* @param req transaction build request
|
|
21
|
+
* @param ctx transaction build context
|
|
22
|
+
* @returns {Promise<TxBuildResult>} transaction build result
|
|
23
|
+
*/
|
|
24
|
+
buildUnsignedTransfer(req: TxBuildRequest, ctx: TxBuildContext): Promise<TxBuildResult>;
|
|
25
|
+
/**
|
|
26
|
+
* Build unsigned transaction with metadata
|
|
27
|
+
* @param req transaction build request
|
|
28
|
+
* @param ctx transaction build context
|
|
29
|
+
* @returns {Promise<TxBuildResult>} transaction build result
|
|
30
|
+
*/
|
|
31
|
+
buildUnsignedTransactionWithMetadata(req: TxBuildRequest, ctx: TxBuildContext): Promise<TxBuildResult>;
|
|
32
|
+
/**
|
|
33
|
+
* Build unsigned Plutus SC transaction
|
|
34
|
+
* @param req transaction build request
|
|
35
|
+
* @param ctx transaction build context
|
|
36
|
+
* @returns {Promise<TxBuildResult>} transaction build result
|
|
37
|
+
*/
|
|
38
|
+
buildUnsignedMintTransaction(req: TxBuildMintRequest, ctx: TxBuildContext): Promise<TxBuildResult>;
|
|
39
|
+
/**
|
|
40
|
+
* Build unsigned Plutus spending transaction (consume UTxO at script address)
|
|
41
|
+
* @param req transaction build request with plutusScriptExecution
|
|
42
|
+
* @param ctx transaction build context
|
|
43
|
+
* @returns {Promise<TxBuildResult>} transaction build result
|
|
44
|
+
*/
|
|
45
|
+
buildUnsignedPlutusSpendTransaction(req: TxBuildPlutusSpendRequest, ctx: TxBuildContext): Promise<TxBuildResult>;
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=cardano-tx.d.ts.map
|
package/srv/cardano-service.cds
CHANGED
|
@@ -37,82 +37,102 @@ service CardanoODataService @(impl: './cardano-service') {
|
|
|
37
37
|
// Entity Projections
|
|
38
38
|
// ---------------------------------------------------------------------------
|
|
39
39
|
|
|
40
|
+
@readonly
|
|
40
41
|
@title : 'Network Information'
|
|
41
42
|
@description: 'Projection for Network Information'
|
|
42
43
|
entity NetworkInformation as projection on db.NetworkInformation;
|
|
43
44
|
|
|
45
|
+
@readonly
|
|
44
46
|
@title : 'Blocks'
|
|
45
47
|
@description: 'Projection for Blocks'
|
|
46
48
|
entity Blocks as projection on db.Blocks;
|
|
47
49
|
|
|
50
|
+
@readonly
|
|
48
51
|
@title : 'Epochs'
|
|
49
52
|
@description: 'Projection for Epochs'
|
|
50
53
|
entity Epochs as projection on db.Epochs;
|
|
51
54
|
|
|
55
|
+
@readonly
|
|
52
56
|
@title : 'Pools'
|
|
53
57
|
@description: 'Projection for Pools'
|
|
54
58
|
entity Pools as projection on db.Pools;
|
|
55
59
|
|
|
60
|
+
@readonly
|
|
56
61
|
@title : 'Dreps'
|
|
57
62
|
@description: 'Projection for Dreps'
|
|
58
63
|
entity Dreps as projection on db.Dreps;
|
|
59
64
|
|
|
65
|
+
@readonly
|
|
60
66
|
@title : 'Assets'
|
|
61
67
|
@description: 'Projection for Native-Asset Information'
|
|
62
68
|
entity Assets as projection on db.Assets;
|
|
63
69
|
|
|
70
|
+
@readonly
|
|
64
71
|
@title : 'Asset History'
|
|
65
72
|
@description: 'Projection for Native-Asset Mint/Burn History'
|
|
66
73
|
entity AssetHistory as projection on db.AssetHistory;
|
|
67
74
|
|
|
75
|
+
@readonly
|
|
68
76
|
@title : 'Transactions'
|
|
69
77
|
@description: 'Projection for Transactions'
|
|
70
78
|
entity Transactions as projection on db.Transactions;
|
|
71
79
|
|
|
80
|
+
@readonly
|
|
72
81
|
@title : 'Transaction Inputs'
|
|
73
82
|
@description: 'Projection for Transaction Inputs'
|
|
74
83
|
entity TransactionInputs as projection on db.TransactionInputs;
|
|
75
84
|
|
|
85
|
+
@readonly
|
|
76
86
|
@title : 'Transaction Outputs'
|
|
77
87
|
@description: 'Projection for Transaction Outputs'
|
|
78
88
|
entity TransactionOutputs as projection on db.TransactionOutputs;
|
|
79
89
|
|
|
90
|
+
@readonly
|
|
80
91
|
@title : 'Transaction Input Assets'
|
|
81
92
|
@description: 'Projection for Transaction Input Assets'
|
|
82
93
|
entity TransactionInputAssets as projection on db.TransactionInputAssets;
|
|
83
94
|
|
|
95
|
+
@readonly
|
|
84
96
|
@title : 'Transaction Output Assets'
|
|
85
97
|
@description: 'Projection for Transaction Output Assets'
|
|
86
98
|
entity TransactionOutputAssets as projection on db.TransactionOutputAssets;
|
|
87
99
|
|
|
100
|
+
@readonly
|
|
88
101
|
@title : 'Accounts'
|
|
89
102
|
@description: 'Projection for Accounts'
|
|
90
103
|
entity Accounts as projection on db.Accounts;
|
|
91
104
|
|
|
105
|
+
@readonly
|
|
92
106
|
@title : 'Addresses'
|
|
93
107
|
@description: 'Projection for Addresses'
|
|
94
108
|
entity Addresses as projection on db.Addresses;
|
|
95
109
|
|
|
110
|
+
@readonly
|
|
96
111
|
@title : 'Address Assets'
|
|
97
112
|
@description: 'Projection for Address Assets'
|
|
98
113
|
entity AddressAssets as projection on db.AddressAssets;
|
|
99
114
|
|
|
115
|
+
@readonly
|
|
100
116
|
@title : 'Address UTxOs'
|
|
101
117
|
@description: 'Projection for Address UTxOs'
|
|
102
118
|
entity AddressUTxOs as projection on db.AddressUTxOs;
|
|
103
119
|
|
|
120
|
+
@readonly
|
|
104
121
|
@title : 'Address Transactions'
|
|
105
122
|
@description: 'Projection for Address Transactions'
|
|
106
123
|
entity AddressTransactions as projection on db.AddressTransactions;
|
|
107
124
|
|
|
125
|
+
@readonly
|
|
108
126
|
@title : 'UTxO Assets'
|
|
109
127
|
@description: 'Projection for UTxO Assets'
|
|
110
128
|
entity UTxOAssets as projection on db.UTxOAssets;
|
|
111
129
|
|
|
130
|
+
@readonly
|
|
112
131
|
@title : 'Transaction Metadata'
|
|
113
132
|
@description: 'Projection for Transaction Metadata'
|
|
114
133
|
entity TransactionMetadata as projection on db.TransactionMetadata;
|
|
115
134
|
|
|
135
|
+
@readonly
|
|
116
136
|
@title : 'Ledger Protocol Parameters'
|
|
117
137
|
@description: 'Projection for Ledger Protocol Parameters'
|
|
118
138
|
entity LedgerProtocolParameters as projection on db.LedgerProtocolParameters;
|
|
@@ -156,17 +176,17 @@ service CardanoODataService @(impl: './cardano-service') {
|
|
|
156
176
|
@description: 'Retrieve native-asset information (supply, mint history, CIP-25 + CIP-26 metadata) by unit. Multi-backend (Blockfrost, Koios). Field availability differs slightly per backend — see entity description.'
|
|
157
177
|
action GetAssetInfo(
|
|
158
178
|
@title: 'Asset Unit'
|
|
159
|
-
@description: 'Concatenation of policyId (56 hex) and assetNameHex (0-
|
|
179
|
+
@description: 'Concatenation of policyId (56 hex) and assetNameHex (0-64 hex; ledger caps asset names at 32 bytes)'
|
|
160
180
|
unit: AssetUnit) returns Assets;
|
|
161
181
|
|
|
162
182
|
@title : 'Get Asset Mint/Burn History'
|
|
163
183
|
@description: 'Retrieve recent mint/burn events for a native asset (most recent first). Koios is preferred (provides block timestamps); Blockfrost is the fallback (timestamps null). Always-fresh fetch — UPSERTs entries by (unit, txHash). For full pagination, query the AssetHistory entity directly with $top/$skip after seeding.'
|
|
164
184
|
action GetAssetHistory(
|
|
165
185
|
@title: 'Asset Unit'
|
|
166
|
-
@description: 'Concatenation of policyId (56 hex) and assetNameHex (0-
|
|
186
|
+
@description: 'Concatenation of policyId (56 hex) and assetNameHex (0-64 hex; ledger caps asset names at 32 bytes)'
|
|
167
187
|
unit: AssetUnit,
|
|
168
188
|
@title: 'Limit'
|
|
169
|
-
@description: 'Maximum number of recent events to fetch (default 100)'
|
|
189
|
+
@description: 'Maximum number of recent events to fetch (default 100, clamped to 1-100)'
|
|
170
190
|
limit: Integer) returns many AssetHistory;
|
|
171
191
|
|
|
172
192
|
@title : 'Get Accounts by Stake Address'
|
package/srv/cardano-service.js
CHANGED
|
@@ -21,7 +21,9 @@ function indexOnMissRead(entity, reqKeyField, validate, indexFn, options) {
|
|
|
21
21
|
const errMsg = options?.errorMessage || `Invalid ${reqKeyField} format`;
|
|
22
22
|
return async (req) => {
|
|
23
23
|
const key = req.data?.[reqKeyField];
|
|
24
|
-
|
|
24
|
+
// explicit null/undefined check — `key &&` skipped validation for falsy keys
|
|
25
|
+
// like epoch=0 or an empty string (the latter then hit the backend unvalidated)
|
|
26
|
+
if (key !== undefined && key !== null && validate && !validate(key))
|
|
25
27
|
(0, errors_1.rejectInvalid)(req, dbKey, errMsg, reqKeyField);
|
|
26
28
|
return (0, backend_request_handler_1.handleRequest)(req, async (db) => {
|
|
27
29
|
if (key !== undefined && key !== null) {
|
|
@@ -126,7 +128,7 @@ module.exports = (srv) => {
|
|
|
126
128
|
// must call GetAssetHistory(unit) first to seed entries for a given asset,
|
|
127
129
|
// then page via $top/$skip on the AssetHistory entity.
|
|
128
130
|
srv.on('READ', AssetHistory, async (req) => {
|
|
129
|
-
return
|
|
131
|
+
return (0, backend_request_handler_1.handleRequest)(req, async (db) => db.run(req.query));
|
|
130
132
|
});
|
|
131
133
|
/**
|
|
132
134
|
* Action: GetAssetHistory - Always-fresh fetch of recent mint/burn events.
|
|
@@ -139,7 +141,8 @@ module.exports = (srv) => {
|
|
|
139
141
|
if (!(0, validators_1.isAssetUnit)(unit)) {
|
|
140
142
|
return (0, errors_1.rejectInvalid)(req, 'GetAssetHistory', 'Invalid asset unit format', 'unit');
|
|
141
143
|
}
|
|
142
|
-
|
|
144
|
+
// clamp like GetLatestTransactionsByAddress — unbounded limits page the upstream backend indefinitely
|
|
145
|
+
const effectiveLimit = Math.min(Math.max(typeof limit === 'number' ? limit : 100, 1), 100);
|
|
143
146
|
return (0, backend_request_handler_1.handleRequest)(req, async (db) => {
|
|
144
147
|
return await indexer().indexAssetHistory(db, unit, effectiveLimit);
|
|
145
148
|
});
|
|
@@ -185,8 +188,25 @@ module.exports = (srv) => {
|
|
|
185
188
|
return (0, backend_request_handler_1.handleRequest)(req, async (db) => {
|
|
186
189
|
const existing = await db.run(SELECT.from(AddressUTxOs).where({ address_address: address }));
|
|
187
190
|
if (!existing || existing.length === 0) {
|
|
188
|
-
// No valid cached data — re-index fresh (UPSERT is idempotent, no DELETE needed)
|
|
189
|
-
|
|
191
|
+
// No valid cached data — re-index fresh (UPSERT is idempotent, no DELETE needed).
|
|
192
|
+
// Prefer getAddress-based full indexing (richer: also captures address detail and
|
|
193
|
+
// returns NotFound for unknown addresses on Blockfrost/Koios). But GetUTxOsByAddress
|
|
194
|
+
// only needs the UTxO set, which Ogmios serves via getAddressUtxos even though it
|
|
195
|
+
// doesn't support getAddress — so when NO configured backend can serve getAddress
|
|
196
|
+
// (AllBackendsFailedError with zero collected errors == every backend skipped it),
|
|
197
|
+
// fall back to a UTxO-only index instead of failing. getAddress is indexAddress's
|
|
198
|
+
// first call, so nothing is persisted before this throws — the fallback is clean.
|
|
199
|
+
try {
|
|
200
|
+
await indexer().indexAddress(db, address);
|
|
201
|
+
}
|
|
202
|
+
catch (err) {
|
|
203
|
+
if (err instanceof errors_1.AllBackendsFailedError && err.errors.length === 0) {
|
|
204
|
+
await indexer().indexAddressUtxos(db, address);
|
|
205
|
+
}
|
|
206
|
+
else {
|
|
207
|
+
throw err;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
190
210
|
const fresh = await db.run(SELECT.from(AddressUTxOs).where({ address_address: address }));
|
|
191
211
|
return fresh;
|
|
192
212
|
}
|