@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,279 @@
|
|
|
1
|
+
import { type CircuitBreakerConfig } from './circuit-breaker';
|
|
2
|
+
import { Transaction, Address, UTxO, NetworkInformation, BlockData, EpochData, MetadataLabelTx, PoolData, DrepData, AccountData, AssetInfo, AssetHistoryEntry, LedgerProtocolParameters, ScriptEvaluationResult } from '../utils/types';
|
|
3
|
+
export type Network = 'mainnet' | 'preview' | 'preprod';
|
|
4
|
+
export type BackendName = 'blockfrost' | 'koios' | 'ogmios';
|
|
5
|
+
export type TransactionBuilderName = 'buildooor';
|
|
6
|
+
export type CardanoClientConfig = {
|
|
7
|
+
network: Network;
|
|
8
|
+
backends: BackendName[];
|
|
9
|
+
blockfrostApiKey: string;
|
|
10
|
+
blockfrostCustomBackend?: string;
|
|
11
|
+
koiosApiKey: string;
|
|
12
|
+
ogmiosUrl: string;
|
|
13
|
+
transactionBuilders: TransactionBuilderName[];
|
|
14
|
+
primaryTimeoutMs: number;
|
|
15
|
+
fallbackTimeoutMs: number;
|
|
16
|
+
indexTtlMs: number;
|
|
17
|
+
circuitBreaker?: Partial<CircuitBreakerConfig>;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* CardanoClient - Smart Multi-backend Cardano Client
|
|
21
|
+
*
|
|
22
|
+
* Routes requests to appropriate backends:
|
|
23
|
+
* - Live/State queries → Ogmios (if available)
|
|
24
|
+
* - Historical queries → Blockfrost/Koios (if available)
|
|
25
|
+
* - Automatic fallback between backends
|
|
26
|
+
*/
|
|
27
|
+
export declare class CardanoClient {
|
|
28
|
+
private config;
|
|
29
|
+
private liveBackend?;
|
|
30
|
+
private historicalBackends;
|
|
31
|
+
private initialized;
|
|
32
|
+
private initPromise;
|
|
33
|
+
private circuitBreaker;
|
|
34
|
+
/** Backends whose init failed — kept in rotation and retried lazily per request */
|
|
35
|
+
private uninitializedBackends;
|
|
36
|
+
network: Network;
|
|
37
|
+
max_age_ms: number;
|
|
38
|
+
private protocolParamsCache?;
|
|
39
|
+
private protocolParamsFetchPromise;
|
|
40
|
+
private static readonly PROTOCOL_PARAMS_TTL_MS;
|
|
41
|
+
private txCoalescer;
|
|
42
|
+
private addrCoalescer;
|
|
43
|
+
private credCoalescer;
|
|
44
|
+
/**
|
|
45
|
+
* Constructor for CardanoClient
|
|
46
|
+
* @param liveBackend - Optional backend for live/state queries (typically Ogmios)
|
|
47
|
+
* @param historicalBackends - Optional backends for historical queries (typically Blockfrost/Koios)
|
|
48
|
+
*/
|
|
49
|
+
constructor(clientConfig: CardanoClientConfig);
|
|
50
|
+
/** Names of the configured backends (live + historical), for status reporting. */
|
|
51
|
+
listBackends(): string[];
|
|
52
|
+
/**
|
|
53
|
+
* Ensure backends are initialized.
|
|
54
|
+
* A REJECTED init promise is cleared so the next request retries — previously
|
|
55
|
+
* a transient startup failure (e.g. Ogmios briefly down) left the client
|
|
56
|
+
* permanently broken until process restart.
|
|
57
|
+
* @returns {Promise<void>}
|
|
58
|
+
*/
|
|
59
|
+
private ensureInitialized;
|
|
60
|
+
/**
|
|
61
|
+
* Initialize all backends from configuration.
|
|
62
|
+
* Backends that fail to initialize are KEPT (previously removed permanently)
|
|
63
|
+
* and tracked in `uninitializedBackends` — the request loops retry their
|
|
64
|
+
* init lazily, so a backend that comes back online recovers without a
|
|
65
|
+
* process restart. The circuit breaker bounds the retry cost.
|
|
66
|
+
* @returns {Promise<void>}
|
|
67
|
+
*/
|
|
68
|
+
private initBackends;
|
|
69
|
+
/**
|
|
70
|
+
* Lazily retry a backend's init when it failed at startup. Returns true when
|
|
71
|
+
* the backend is usable; false (after recording a breaker failure) when the
|
|
72
|
+
* retry failed.
|
|
73
|
+
*/
|
|
74
|
+
private ensureBackendInitialized;
|
|
75
|
+
/**
|
|
76
|
+
* Wrap a promise with a timeout
|
|
77
|
+
* @param promise - the promise to wrap
|
|
78
|
+
* @param ms - timeout in milliseconds
|
|
79
|
+
* @param backendName - name of the backend (for error context)
|
|
80
|
+
* @returns {Promise<T>} the result of the promise or a timeout error
|
|
81
|
+
*/
|
|
82
|
+
private withTimeout;
|
|
83
|
+
/**
|
|
84
|
+
* Get timeout for specific backend
|
|
85
|
+
* @param backend CardanoBackend instance
|
|
86
|
+
* @returns {number} timeout in milliseconds
|
|
87
|
+
*/
|
|
88
|
+
private getTimeoutForBackend;
|
|
89
|
+
/**
|
|
90
|
+
* Run a single-backend call with the same resilience contract as
|
|
91
|
+
* executeWithPriority: circuit-breaker gate, timeout, success/failure
|
|
92
|
+
* recording (4xx exempt). For the paths that cannot fail over (Koios-only,
|
|
93
|
+
* Ogmios-only, batch-capable loops) — these previously bypassed timeout AND
|
|
94
|
+
* breaker entirely, so a hanging socket blocked the caller indefinitely.
|
|
95
|
+
*/
|
|
96
|
+
private callWithResilience;
|
|
97
|
+
/**
|
|
98
|
+
* Execute with priority-based backend selection and automatic fallback
|
|
99
|
+
* @param fn function to execute on backend
|
|
100
|
+
* @param preferLive whether to prefer live backend over historical
|
|
101
|
+
* @returns {Promise<T>} result from backend
|
|
102
|
+
*/
|
|
103
|
+
private executeWithPriority;
|
|
104
|
+
/**
|
|
105
|
+
* Route method call to appropriate backend based on method routing configuration
|
|
106
|
+
* @param methodName name of the method being called
|
|
107
|
+
* @param fn function to execute on backend
|
|
108
|
+
* @returns {Promise<T>} result from backend
|
|
109
|
+
*/
|
|
110
|
+
private route;
|
|
111
|
+
/**
|
|
112
|
+
* Get transaction by hash with fallback between backends
|
|
113
|
+
* @param txHash transaction hash (hex)
|
|
114
|
+
* @returns {Promise<Transaction>} transaction data
|
|
115
|
+
*/
|
|
116
|
+
getTransaction(txHash: string): Promise<Transaction>;
|
|
117
|
+
/**
|
|
118
|
+
* Get address by bech32 address with fallback between backends
|
|
119
|
+
* @param address bech32 address
|
|
120
|
+
* @returns {Promise<Address>} address data
|
|
121
|
+
*/
|
|
122
|
+
getAddress(address: string): Promise<Address>;
|
|
123
|
+
/**
|
|
124
|
+
* Get address UTxOs with fallback between backends
|
|
125
|
+
* @param address bech32 address
|
|
126
|
+
* @returns {Promise<UTxO[]>} list of UTxOs
|
|
127
|
+
*/
|
|
128
|
+
getAddressUtxos(address: string): Promise<UTxO[]>;
|
|
129
|
+
/**
|
|
130
|
+
* Get UTxOs by 28-byte payment credential. Koios-only — bypasses generic
|
|
131
|
+
* failover because no other backend exposes a credential-keyed UTxO endpoint.
|
|
132
|
+
* Throws ProviderUnavailableError if Koios is not configured.
|
|
133
|
+
* @param credHash 28-byte payment credential as 56-char lowercase hex
|
|
134
|
+
* @returns {Promise<UTxO[]>} list of UTxOs across all bech32 forms sharing the credential
|
|
135
|
+
*/
|
|
136
|
+
getCredentialUtxos(credHash: string): Promise<UTxO[]>;
|
|
137
|
+
/**
|
|
138
|
+
* Get address transactions with fallback between backends
|
|
139
|
+
* @param address bech32 address
|
|
140
|
+
* @returns {Promise<Transaction[]>} list of transactions for this address
|
|
141
|
+
*/
|
|
142
|
+
getAddressTransactions(address: string, limit: number): Promise<Transaction[]>;
|
|
143
|
+
/**
|
|
144
|
+
* Get network information with fallback between backends
|
|
145
|
+
* @returns {Promise<Network>} network information
|
|
146
|
+
*/
|
|
147
|
+
getNetworkInformation(): Promise<NetworkInformation>;
|
|
148
|
+
/**
|
|
149
|
+
* Get transaction metadata with fallback between backends
|
|
150
|
+
* @param tx_hash transaction hash (hex)
|
|
151
|
+
* @returns {Promise<MetadataLabelTx[]>} transaction metadata
|
|
152
|
+
*/
|
|
153
|
+
getTransactionMetadata(tx_hash: string): Promise<MetadataLabelTx[]>;
|
|
154
|
+
/**
|
|
155
|
+
* Get block data with fallback between backends
|
|
156
|
+
* @param block_hash block hash (hex)
|
|
157
|
+
* @returns {Promise<BlockData>} block data
|
|
158
|
+
*/
|
|
159
|
+
getBlock(block_hash: string): Promise<BlockData>;
|
|
160
|
+
/**
|
|
161
|
+
* Get epoch data with fallback between backends
|
|
162
|
+
* @param epochNumber epoch number
|
|
163
|
+
* @returns {Promise<EpochData>} epoch data
|
|
164
|
+
*/
|
|
165
|
+
getEpoch(epochNumber: number): Promise<EpochData>;
|
|
166
|
+
/**
|
|
167
|
+
* Get Pool data with fallback between backends
|
|
168
|
+
* @param poolId pool id
|
|
169
|
+
* @returns {Promise<PoolData>} pool data
|
|
170
|
+
*/
|
|
171
|
+
getPool(poolId: string): Promise<PoolData>;
|
|
172
|
+
/**
|
|
173
|
+
* Get drep data with fallback between backends
|
|
174
|
+
* @param drepId drep id
|
|
175
|
+
* @returns {Promise<DrepData>} drep data
|
|
176
|
+
*/
|
|
177
|
+
getDrep(drepId: string): Promise<DrepData>;
|
|
178
|
+
/**
|
|
179
|
+
* Get account data with fallback between backends
|
|
180
|
+
* @param stakeAddress stake address
|
|
181
|
+
* @returns {Promise<AccountData>} account data
|
|
182
|
+
*/
|
|
183
|
+
getAccount(stakeAddress: string): Promise<AccountData>;
|
|
184
|
+
/**
|
|
185
|
+
* Get asset info (supply, mint history, CIP-25 + CIP-26 metadata) with fallback.
|
|
186
|
+
* Both Blockfrost and Koios implement; Ogmios throws "not supported".
|
|
187
|
+
* @param unit policyId + assetNameHex (concatenated hex)
|
|
188
|
+
* @returns {Promise<AssetInfo>} canonical asset info
|
|
189
|
+
*/
|
|
190
|
+
getAssetInfo(unit: string): Promise<AssetInfo>;
|
|
191
|
+
/**
|
|
192
|
+
* Get latest mint/burn events for an asset. Prefers Koios because it provides
|
|
193
|
+
* block timestamps; Blockfrost is the fallback (timestamps left null).
|
|
194
|
+
* Ogmios doesn't implement — fallback skips it via the optional method check.
|
|
195
|
+
* @param unit policyId + assetNameHex (concatenated hex)
|
|
196
|
+
* @param limit max number of events (default 100)
|
|
197
|
+
* @returns {Promise<AssetHistoryEntry[]>} list of mint/burn events (most recent first)
|
|
198
|
+
*/
|
|
199
|
+
getAssetHistory(unit: string, limit?: number): Promise<AssetHistoryEntry[]>;
|
|
200
|
+
/**
|
|
201
|
+
* Get transaction hashes for an address (lightweight — no full tx details).
|
|
202
|
+
* Uses getAddressTransactionHashes() if backend supports it, otherwise
|
|
203
|
+
* falls back to getAddressTransactions() and extracts hashes.
|
|
204
|
+
* @param address bech32 address
|
|
205
|
+
* @param limit maximum number of hashes
|
|
206
|
+
* @returns {Promise<string[]>} list of transaction hashes
|
|
207
|
+
*/
|
|
208
|
+
getAddressTransactionHashes(address: string, limit: number): Promise<string[]>;
|
|
209
|
+
/**
|
|
210
|
+
* Batch fetch multiple transactions by hash.
|
|
211
|
+
* Uses getTransactionsBatch() if backend supports it, otherwise
|
|
212
|
+
* falls back to individual getTransaction() calls (still coalesced).
|
|
213
|
+
* @param txHashes array of transaction hashes
|
|
214
|
+
* @returns {Promise<Map<string, Transaction>>} map of hash -> Transaction
|
|
215
|
+
*/
|
|
216
|
+
getTransactionsBatch(txHashes: string[]): Promise<Map<string, Transaction>>;
|
|
217
|
+
/**
|
|
218
|
+
* Backends in historical-first order. Used by the batch methods — both
|
|
219
|
+
* always prefer historical data, so the former preferLive parameter was a
|
|
220
|
+
* dead branch.
|
|
221
|
+
*/
|
|
222
|
+
private getOrderedBackends;
|
|
223
|
+
/**
|
|
224
|
+
* Get protocol parameters with caching (5 minute TTL)
|
|
225
|
+
* Protocol parameters rarely change (once per epoch at most), so caching improves performance
|
|
226
|
+
* @returns {Promise<LedgerProtocolParameters>} protocol parameters
|
|
227
|
+
*/
|
|
228
|
+
getProtocolParameters(): Promise<LedgerProtocolParameters>;
|
|
229
|
+
/**
|
|
230
|
+
* Shutdown all backends (for cleanup in tests)
|
|
231
|
+
*/
|
|
232
|
+
shutdown(): Promise<void>;
|
|
233
|
+
/**
|
|
234
|
+
* Get latest block data with fallback between backends
|
|
235
|
+
* @returns {Promise<BlockData>} latest block data
|
|
236
|
+
*/
|
|
237
|
+
getLatestBlock(): Promise<BlockData>;
|
|
238
|
+
/**
|
|
239
|
+
* Get latest epoch data with fallback between backends
|
|
240
|
+
* @returns {Promise<EpochData>} latest epoch data
|
|
241
|
+
*/
|
|
242
|
+
getLatestEpoch(): Promise<EpochData>;
|
|
243
|
+
/**
|
|
244
|
+
* Get the current chain slot with fallback between backends.
|
|
245
|
+
* @returns {Promise<number>} current chain slot
|
|
246
|
+
*/
|
|
247
|
+
getCurrentSlot(): Promise<number>;
|
|
248
|
+
/**
|
|
249
|
+
* Check whether a UTxO is still unspent with fallback between backends.
|
|
250
|
+
* @param txHash 64-char lowercase hex transaction hash
|
|
251
|
+
* @param outputIndex non-negative integer output index
|
|
252
|
+
* @returns {Promise<boolean>} true iff the UTxO exists and is unspent
|
|
253
|
+
*/
|
|
254
|
+
isUtxoUnspent(txHash: string, outputIndex: number): Promise<boolean>;
|
|
255
|
+
/**
|
|
256
|
+
* Submit transaction with fallback between backends
|
|
257
|
+
* @param signedTxCbor signed transaction in CBOR hex format
|
|
258
|
+
* @returns {Promise<string>} transaction hash
|
|
259
|
+
*
|
|
260
|
+
* NOTE on failover semantics: when the preferred backend ACCEPTS the tx but
|
|
261
|
+
* its response is lost (timeout), the failover resubmits on the next backend,
|
|
262
|
+
* which may answer 409 "already submitted". Callers should treat a
|
|
263
|
+
* TransactionAlreadySubmittedError after a submit attempt as success — the
|
|
264
|
+
* transaction IS in the mempool.
|
|
265
|
+
*/
|
|
266
|
+
submitTransaction(signedTxCbor: string): Promise<string>;
|
|
267
|
+
/**
|
|
268
|
+
* Check if Ogmios backend is available for transaction evaluation
|
|
269
|
+
* @returns {boolean} true if Ogmios is the live backend
|
|
270
|
+
*/
|
|
271
|
+
hasOgmiosBackend(): boolean;
|
|
272
|
+
/**
|
|
273
|
+
* Evaluate transaction script execution units (Ogmios only)
|
|
274
|
+
* @param unsignedTxCbor unsigned transaction in CBOR hex format
|
|
275
|
+
* @returns {Promise<ScriptEvaluationResult[]>} evaluation results
|
|
276
|
+
*/
|
|
277
|
+
evaluateTransaction(unsignedTxCbor: string): Promise<ScriptEvaluationResult[]>;
|
|
278
|
+
}
|
|
279
|
+
//# sourceMappingURL=cardano-client.d.ts.map
|
|
@@ -51,6 +51,8 @@ class CardanoClient {
|
|
|
51
51
|
initialized = false;
|
|
52
52
|
initPromise = null;
|
|
53
53
|
circuitBreaker;
|
|
54
|
+
/** Backends whose init failed — kept in rotation and retried lazily per request */
|
|
55
|
+
uninitializedBackends = new Set();
|
|
54
56
|
network;
|
|
55
57
|
max_age_ms = 60000; // default 1 minute for temporary caching
|
|
56
58
|
protocolParamsCache;
|
|
@@ -81,22 +83,46 @@ class CardanoClient {
|
|
|
81
83
|
throw new errors_1.ConfigError('No valid backends configured for CardanoClient');
|
|
82
84
|
}
|
|
83
85
|
this.circuitBreaker = new circuit_breaker_1.CircuitBreakerManager(clientConfig.circuitBreaker);
|
|
84
|
-
|
|
86
|
+
// Wire the configured cache TTL into the field the indexer actually reads.
|
|
87
|
+
// Previously max_age_ms stayed hardcoded at 60s and indexTtlMs was dead — the
|
|
88
|
+
// documented/configurable 1h default never took effect.
|
|
89
|
+
if (Number.isFinite(clientConfig.indexTtlMs) && clientConfig.indexTtlMs > 0) {
|
|
90
|
+
this.max_age_ms = clientConfig.indexTtlMs;
|
|
91
|
+
}
|
|
92
|
+
logger.info(`CardanoClient instance created (cache TTL ${this.max_age_ms} ms).`);
|
|
85
93
|
this.config = clientConfig;
|
|
86
94
|
}
|
|
95
|
+
/** Names of the configured backends (live + historical), for status reporting. */
|
|
96
|
+
listBackends() {
|
|
97
|
+
const names = [];
|
|
98
|
+
if (this.liveBackend)
|
|
99
|
+
names.push(this.liveBackend.name);
|
|
100
|
+
names.push(...this.historicalBackends.map(b => b.name));
|
|
101
|
+
return names;
|
|
102
|
+
}
|
|
87
103
|
/**
|
|
88
|
-
* Ensure backends are initialized
|
|
104
|
+
* Ensure backends are initialized.
|
|
105
|
+
* A REJECTED init promise is cleared so the next request retries — previously
|
|
106
|
+
* a transient startup failure (e.g. Ogmios briefly down) left the client
|
|
107
|
+
* permanently broken until process restart.
|
|
89
108
|
* @returns {Promise<void>}
|
|
90
109
|
*/
|
|
91
110
|
async ensureInitialized() {
|
|
92
111
|
if (this.initialized)
|
|
93
112
|
return;
|
|
94
113
|
// Use nullish coalescing assignment for atomic operation to prevent race conditions
|
|
95
|
-
this.initPromise ??= this.initBackends()
|
|
114
|
+
this.initPromise ??= this.initBackends().catch((err) => {
|
|
115
|
+
this.initPromise = null;
|
|
116
|
+
throw err;
|
|
117
|
+
});
|
|
96
118
|
await this.initPromise;
|
|
97
119
|
}
|
|
98
120
|
/**
|
|
99
|
-
* Initialize all backends from configuration
|
|
121
|
+
* Initialize all backends from configuration.
|
|
122
|
+
* Backends that fail to initialize are KEPT (previously removed permanently)
|
|
123
|
+
* and tracked in `uninitializedBackends` — the request loops retry their
|
|
124
|
+
* init lazily, so a backend that comes back online recovers without a
|
|
125
|
+
* process restart. The circuit breaker bounds the retry cost.
|
|
100
126
|
* @returns {Promise<void>}
|
|
101
127
|
*/
|
|
102
128
|
async initBackends() {
|
|
@@ -106,34 +132,57 @@ class CardanoClient {
|
|
|
106
132
|
try {
|
|
107
133
|
logger.debug(`Initializing live backend: ${this.liveBackend.name}`);
|
|
108
134
|
await this.liveBackend.init();
|
|
135
|
+
this.uninitializedBackends.delete(this.liveBackend);
|
|
109
136
|
logger.debug(`Live backend initialized: ${this.liveBackend.name}`);
|
|
110
137
|
}
|
|
111
138
|
catch (err) {
|
|
112
139
|
initErrors.push(new errors_1.BackendInitError(this.liveBackend.name, err));
|
|
113
|
-
logger.error(`Failed to initialize live backend: ${this.liveBackend.name}`, err);
|
|
114
|
-
this.liveBackend
|
|
140
|
+
logger.error(`Failed to initialize live backend: ${this.liveBackend.name} — kept for lazy retry`, err);
|
|
141
|
+
this.uninitializedBackends.add(this.liveBackend);
|
|
115
142
|
}
|
|
116
143
|
}
|
|
117
144
|
// Initialize historical backends
|
|
118
|
-
const initializedHistorical = [];
|
|
119
145
|
for (const backend of this.historicalBackends) {
|
|
120
146
|
try {
|
|
121
147
|
logger.debug(`Initializing historical backend: ${backend.name}`);
|
|
122
148
|
await backend.init();
|
|
123
|
-
|
|
149
|
+
this.uninitializedBackends.delete(backend);
|
|
124
150
|
logger.debug(`Historical backend initialized: ${backend.name}`);
|
|
125
151
|
}
|
|
126
152
|
catch (err) {
|
|
127
153
|
initErrors.push(new errors_1.BackendInitError(backend.name, err));
|
|
128
|
-
logger.error(`Failed to initialize historical backend: ${backend.name}`, err);
|
|
154
|
+
logger.error(`Failed to initialize historical backend: ${backend.name} — kept for lazy retry`, err);
|
|
155
|
+
this.uninitializedBackends.add(backend);
|
|
129
156
|
}
|
|
130
157
|
}
|
|
131
|
-
this.
|
|
132
|
-
if (
|
|
158
|
+
const totalBackends = (this.liveBackend ? 1 : 0) + this.historicalBackends.length;
|
|
159
|
+
if (initErrors.length >= totalBackends) {
|
|
133
160
|
throw new errors_1.AllBackendsInitFailedError(initErrors);
|
|
134
161
|
}
|
|
135
162
|
this.initialized = true;
|
|
136
163
|
}
|
|
164
|
+
/**
|
|
165
|
+
* Lazily retry a backend's init when it failed at startup. Returns true when
|
|
166
|
+
* the backend is usable; false (after recording a breaker failure) when the
|
|
167
|
+
* retry failed.
|
|
168
|
+
*/
|
|
169
|
+
async ensureBackendInitialized(backend, errors) {
|
|
170
|
+
if (!this.uninitializedBackends.has(backend))
|
|
171
|
+
return true;
|
|
172
|
+
try {
|
|
173
|
+
await backend.init();
|
|
174
|
+
this.uninitializedBackends.delete(backend);
|
|
175
|
+
logger.info(`Backend ${backend.name} recovered (lazy init succeeded)`);
|
|
176
|
+
return true;
|
|
177
|
+
}
|
|
178
|
+
catch (err) {
|
|
179
|
+
const initError = new errors_1.BackendInitError(backend.name, err);
|
|
180
|
+
errors?.push(initError);
|
|
181
|
+
this.circuitBreaker.recordFailure(backend.name);
|
|
182
|
+
logger.debug(`Lazy init retry for ${backend.name} failed: ${initError.message}`);
|
|
183
|
+
return false;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
137
186
|
/**
|
|
138
187
|
* Wrap a promise with a timeout
|
|
139
188
|
* @param promise - the promise to wrap
|
|
@@ -160,13 +209,42 @@ class CardanoClient {
|
|
|
160
209
|
return this.config.fallbackTimeoutMs;
|
|
161
210
|
return this.config.primaryTimeoutMs;
|
|
162
211
|
}
|
|
212
|
+
/**
|
|
213
|
+
* Run a single-backend call with the same resilience contract as
|
|
214
|
+
* executeWithPriority: circuit-breaker gate, timeout, success/failure
|
|
215
|
+
* recording (4xx exempt). For the paths that cannot fail over (Koios-only,
|
|
216
|
+
* Ogmios-only, batch-capable loops) — these previously bypassed timeout AND
|
|
217
|
+
* breaker entirely, so a hanging socket blocked the caller indefinitely.
|
|
218
|
+
*/
|
|
219
|
+
async callWithResilience(backend, fn) {
|
|
220
|
+
if (!this.circuitBreaker.shouldAttempt(backend.name)) {
|
|
221
|
+
throw new errors_1.ProviderUnavailableError(`Circuit open for ${backend.name}`, backend.name);
|
|
222
|
+
}
|
|
223
|
+
// fast-path sync check — keeps fn() synchronous for the request coalescers
|
|
224
|
+
if (this.uninitializedBackends.has(backend) && !(await this.ensureBackendInitialized(backend))) {
|
|
225
|
+
throw new errors_1.ProviderUnavailableError(`Backend ${backend.name} is not initialized (lazy retry failed)`, backend.name);
|
|
226
|
+
}
|
|
227
|
+
try {
|
|
228
|
+
const result = await this.withTimeout(fn(), this.getTimeoutForBackend(backend), backend.name);
|
|
229
|
+
this.circuitBreaker.recordSuccess(backend.name);
|
|
230
|
+
return result;
|
|
231
|
+
}
|
|
232
|
+
catch (err) {
|
|
233
|
+
const backendError = (0, errors_1.normalizeBackendError)(err, backend.name);
|
|
234
|
+
const isClientError = backendError.statusCode >= 400 && backendError.statusCode < 500;
|
|
235
|
+
if (!isClientError) {
|
|
236
|
+
this.circuitBreaker.recordFailure(backend.name);
|
|
237
|
+
}
|
|
238
|
+
throw backendError;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
163
241
|
/**
|
|
164
242
|
* Execute with priority-based backend selection and automatic fallback
|
|
165
243
|
* @param fn function to execute on backend
|
|
166
244
|
* @param preferLive whether to prefer live backend over historical
|
|
167
245
|
* @returns {Promise<T>} result from backend
|
|
168
246
|
*/
|
|
169
|
-
async executeWithPriority(fn, preferLive) {
|
|
247
|
+
async executeWithPriority(fn, preferLive, methodName) {
|
|
170
248
|
await this.ensureInitialized();
|
|
171
249
|
const errors = [];
|
|
172
250
|
// Determine backend order based on preference
|
|
@@ -179,10 +257,19 @@ class CardanoClient {
|
|
|
179
257
|
const allBackends = [...primaryBackends, ...fallbackBackends];
|
|
180
258
|
// Try each backend in order, respecting circuit breaker state
|
|
181
259
|
for (const backend of allBackends) {
|
|
260
|
+
// capability routing: declared non-support is a skip, not a failure
|
|
261
|
+
if (methodName && backend.unsupportedMethods?.has(methodName)) {
|
|
262
|
+
logger.debug(`${backend.name} does not support ${methodName}, skipping`);
|
|
263
|
+
continue;
|
|
264
|
+
}
|
|
182
265
|
if (!this.circuitBreaker.shouldAttempt(backend.name)) {
|
|
183
266
|
logger.debug(`Circuit open for ${backend.name}, skipping`);
|
|
184
267
|
continue;
|
|
185
268
|
}
|
|
269
|
+
// fast-path sync check — only await the init retry in the rare failure case
|
|
270
|
+
if (this.uninitializedBackends.has(backend) && !(await this.ensureBackendInitialized(backend, errors))) {
|
|
271
|
+
continue;
|
|
272
|
+
}
|
|
186
273
|
try {
|
|
187
274
|
const backendType = backend === this.liveBackend ? 'live' : 'historical';
|
|
188
275
|
logger.debug(`Calling backend: ${backend.name} (${backendType})`);
|
|
@@ -193,8 +280,12 @@ class CardanoClient {
|
|
|
193
280
|
catch (err) {
|
|
194
281
|
const backendError = (0, errors_1.normalizeBackendError)(err, backend.name);
|
|
195
282
|
errors.push(backendError);
|
|
196
|
-
//
|
|
197
|
-
|
|
283
|
+
// 4xx are definitive verdicts from a HEALTHY backend (bad input, not found,
|
|
284
|
+
// conflict, rate limit) — only 5xx/timeouts/transport errors indicate backend
|
|
285
|
+
// health and may open the circuit. Counting client errors opened the breaker
|
|
286
|
+
// on user mistakes and took working backends out of rotation.
|
|
287
|
+
const isClientError = backendError.statusCode >= 400 && backendError.statusCode < 500;
|
|
288
|
+
if (!isClientError) {
|
|
198
289
|
this.circuitBreaker.recordFailure(backend.name);
|
|
199
290
|
}
|
|
200
291
|
const logLevel = backendError.statusCode === 404 ? 'debug' : 'warn';
|
|
@@ -211,7 +302,7 @@ class CardanoClient {
|
|
|
211
302
|
*/
|
|
212
303
|
route(methodName, fn) {
|
|
213
304
|
const config = METHOD_ROUTING[methodName] ?? { preferLive: false };
|
|
214
|
-
return this.executeWithPriority(fn, config.preferLive);
|
|
305
|
+
return this.executeWithPriority(fn, config.preferLive, methodName);
|
|
215
306
|
}
|
|
216
307
|
/**
|
|
217
308
|
* Get transaction by hash with fallback between backends
|
|
@@ -250,7 +341,7 @@ class CardanoClient {
|
|
|
250
341
|
if (!koios) {
|
|
251
342
|
throw new errors_1.ProviderUnavailableError("getCredentialUtxos requires Koios backend. Configure 'koios' in cds.requires.odatano-core.backends.", 'koios');
|
|
252
343
|
}
|
|
253
|
-
return this.credCoalescer.get(credHash, () => koios.getCredentialUtxos(credHash));
|
|
344
|
+
return this.credCoalescer.get(credHash, () => this.callWithResilience(koios, () => koios.getCredentialUtxos(credHash)));
|
|
254
345
|
}
|
|
255
346
|
/**
|
|
256
347
|
* Get address transactions with fallback between backends
|
|
@@ -336,12 +427,12 @@ class CardanoClient {
|
|
|
336
427
|
const candidates = [...this.historicalBackends, this.liveBackend];
|
|
337
428
|
const koios = candidates.find(b => b?.name === 'koios' && typeof b.getAssetHistory === 'function');
|
|
338
429
|
if (koios)
|
|
339
|
-
return koios.getAssetHistory(unit, limit);
|
|
430
|
+
return this.callWithResilience(koios, () => koios.getAssetHistory(unit, limit));
|
|
340
431
|
const anyImpl = candidates.find(b => typeof b?.getAssetHistory === 'function');
|
|
341
432
|
if (!anyImpl) {
|
|
342
433
|
throw new errors_1.ProviderUnavailableError("getAssetHistory requires Blockfrost or Koios backend.", 'asset-history');
|
|
343
434
|
}
|
|
344
|
-
return anyImpl.getAssetHistory(unit, limit);
|
|
435
|
+
return this.callWithResilience(anyImpl, () => anyImpl.getAssetHistory(unit, limit));
|
|
345
436
|
}
|
|
346
437
|
//-----------------------------------------------------------------------------
|
|
347
438
|
// Batch Methods (N+1 Optimization)
|
|
@@ -356,13 +447,15 @@ class CardanoClient {
|
|
|
356
447
|
*/
|
|
357
448
|
async getAddressTransactionHashes(address, limit) {
|
|
358
449
|
// Try backends with getAddressTransactionHashes support
|
|
359
|
-
const allBackends = this.getOrderedBackends(
|
|
450
|
+
const allBackends = this.getOrderedBackends();
|
|
360
451
|
for (const backend of allBackends) {
|
|
361
452
|
if (backend.getAddressTransactionHashes) {
|
|
362
453
|
try {
|
|
363
|
-
return await backend.getAddressTransactionHashes(address, limit);
|
|
454
|
+
return await this.callWithResilience(backend, () => backend.getAddressTransactionHashes(address, limit));
|
|
455
|
+
}
|
|
456
|
+
catch (err) {
|
|
457
|
+
logger.debug(`getAddressTransactionHashes failed on ${backend.name}: ${err instanceof Error ? err.message : String(err)} — trying next backend`);
|
|
364
458
|
}
|
|
365
|
-
catch { /* fall through to next backend */ }
|
|
366
459
|
}
|
|
367
460
|
}
|
|
368
461
|
// Fallback: full fetch and extract hashes
|
|
@@ -378,13 +471,15 @@ class CardanoClient {
|
|
|
378
471
|
*/
|
|
379
472
|
async getTransactionsBatch(txHashes) {
|
|
380
473
|
// Try backends with batch support
|
|
381
|
-
const allBackends = this.getOrderedBackends(
|
|
474
|
+
const allBackends = this.getOrderedBackends();
|
|
382
475
|
for (const backend of allBackends) {
|
|
383
476
|
if (backend.getTransactionsBatch) {
|
|
384
477
|
try {
|
|
385
|
-
return await backend.getTransactionsBatch(txHashes);
|
|
478
|
+
return await this.callWithResilience(backend, () => backend.getTransactionsBatch(txHashes));
|
|
479
|
+
}
|
|
480
|
+
catch (err) {
|
|
481
|
+
logger.debug(`getTransactionsBatch failed on ${backend.name}: ${err instanceof Error ? err.message : String(err)} — trying next backend`);
|
|
386
482
|
}
|
|
387
|
-
catch { /* fall through to next backend */ }
|
|
388
483
|
}
|
|
389
484
|
}
|
|
390
485
|
// Fallback: individual coalesced calls
|
|
@@ -392,15 +487,13 @@ class CardanoClient {
|
|
|
392
487
|
return new Map(entries);
|
|
393
488
|
}
|
|
394
489
|
/**
|
|
395
|
-
*
|
|
396
|
-
*
|
|
490
|
+
* Backends in historical-first order. Used by the batch methods — both
|
|
491
|
+
* always prefer historical data, so the former preferLive parameter was a
|
|
492
|
+
* dead branch.
|
|
397
493
|
*/
|
|
398
|
-
getOrderedBackends(
|
|
399
|
-
const backends = [];
|
|
400
|
-
if (
|
|
401
|
-
backends.push(this.liveBackend);
|
|
402
|
-
backends.push(...this.historicalBackends);
|
|
403
|
-
if (!preferLive && this.liveBackend)
|
|
494
|
+
getOrderedBackends() {
|
|
495
|
+
const backends = [...this.historicalBackends];
|
|
496
|
+
if (this.liveBackend)
|
|
404
497
|
backends.push(this.liveBackend);
|
|
405
498
|
return backends;
|
|
406
499
|
}
|
|
@@ -496,6 +589,12 @@ class CardanoClient {
|
|
|
496
589
|
* Submit transaction with fallback between backends
|
|
497
590
|
* @param signedTxCbor signed transaction in CBOR hex format
|
|
498
591
|
* @returns {Promise<string>} transaction hash
|
|
592
|
+
*
|
|
593
|
+
* NOTE on failover semantics: when the preferred backend ACCEPTS the tx but
|
|
594
|
+
* its response is lost (timeout), the failover resubmits on the next backend,
|
|
595
|
+
* which may answer 409 "already submitted". Callers should treat a
|
|
596
|
+
* TransactionAlreadySubmittedError after a submit attempt as success — the
|
|
597
|
+
* transaction IS in the mempool.
|
|
499
598
|
*/
|
|
500
599
|
submitTransaction(signedTxCbor) {
|
|
501
600
|
return this.route('submitTransaction', b => b.submitTransaction(signedTxCbor));
|
|
@@ -518,7 +617,9 @@ class CardanoClient {
|
|
|
518
617
|
if (!this.liveBackend || !(0, cardano_backend_1.isEvaluatingBackend)(this.liveBackend)) {
|
|
519
618
|
throw new errors_1.ProviderUnavailableError('Transaction evaluation requires an evaluating backend (e.g., Ogmios)');
|
|
520
619
|
}
|
|
521
|
-
|
|
620
|
+
// timeout + breaker — a hanging Ogmios socket previously blocked Plutus builds indefinitely
|
|
621
|
+
const backend = this.liveBackend;
|
|
622
|
+
return this.callWithResilience(backend, () => backend.evaluateTransaction(unsignedTxCbor));
|
|
522
623
|
}
|
|
523
624
|
}
|
|
524
625
|
exports.CardanoClient = CardanoClient;
|