@odatano/core 1.7.10 → 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/LICENSE +1 -24
- package/README.md +102 -96
- package/db/schema.cds +18 -18
- package/db/types.cds +3 -3
- package/package.json +25 -11
- 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 +64 -57
- 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 +79 -79
- package/srv/blockchain/transaction-building/buildooor-tx.d.ts +236 -0
- package/srv/blockchain/transaction-building/buildooor-tx.js +632 -173
- 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 +26 -6
- package/srv/cardano-sign-service.cds +5 -0
- package/srv/cardano-sign-service.d.ts +2 -0
- package/srv/cardano-sign-service.js +221 -134
- package/srv/cardano-tx-service.cds +8 -0
- package/srv/cardano-tx-service.d.ts +12 -0
- package/srv/cardano-tx-service.js +170 -111
- 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 +52 -41
- 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 +6 -17
- package/srv/utils/signing-helper.d.ts +23 -0
- package/srv/utils/signing-helper.js +11 -49
- package/srv/utils/tx-build-helper.d.ts +76 -0
- package/srv/utils/tx-build-helper.js +29 -80
- 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 -118
- package/config/preview/cardano-node/conway-genesis.json +0 -297
- package/config/preview/cardano-node/shelley-genesis.json +0 -68
- package/config/preview/cardano-node/topology.json +0 -19
- 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/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/gerolamo-backend.d.ts.map +0 -1
- package/srv/blockchain/backends/gerolamo-backend.js +0 -321
- package/srv/blockchain/backends/gerolamo-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/blockchain/transaction-building/csl-tx.d.ts.map +0 -1
- package/srv/blockchain/transaction-building/csl-tx.js +0 -922
- package/srv/blockchain/transaction-building/csl-tx.js.map +0 -1
- package/srv/blockchain/transaction-building/tx-builder-registry.d.ts.map +0 -1
- package/srv/blockchain/transaction-building/tx-builder-registry.js +0 -69
- package/srv/blockchain/transaction-building/tx-builder-registry.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
|
@@ -113,9 +113,12 @@ class BlockfrostBackend {
|
|
|
113
113
|
*/
|
|
114
114
|
async getTransaction(hash) {
|
|
115
115
|
return (0, backend_request_handler_1.handleBackendRequest)(async () => {
|
|
116
|
-
|
|
117
|
-
const txUtxos = await
|
|
118
|
-
|
|
116
|
+
// independent endpoints — fetch in parallel instead of 3 sequential roundtrips
|
|
117
|
+
const [tx, txUtxos, txMetadata] = await Promise.all([
|
|
118
|
+
this.api.txs(hash),
|
|
119
|
+
this.api.txsUtxos(hash),
|
|
120
|
+
this.api.txsMetadata(hash),
|
|
121
|
+
]);
|
|
119
122
|
const metadata = txMetadata.length > 0 ? txMetadata.map(md => ({
|
|
120
123
|
txHash: hash,
|
|
121
124
|
label: md.label,
|
|
@@ -182,7 +185,9 @@ class BlockfrostBackend {
|
|
|
182
185
|
async getAddress(address) {
|
|
183
186
|
return (0, backend_request_handler_1.handleBackendRequest)(async () => {
|
|
184
187
|
const address_data = await this.api.addresses(address);
|
|
185
|
-
|
|
188
|
+
// *All variant paginates internally — addressesUtxos caps at 100 entries,
|
|
189
|
+
// silently truncating larger wallets (wrong balances / spurious InsufficientFunds)
|
|
190
|
+
const address_utxos = await this.api.addressesUtxosAll(address);
|
|
186
191
|
return {
|
|
187
192
|
address: address_data.address,
|
|
188
193
|
stakeAddress: address_data.stake_address,
|
|
@@ -209,7 +214,9 @@ class BlockfrostBackend {
|
|
|
209
214
|
*/
|
|
210
215
|
async getAddressTransactions(address, limit) {
|
|
211
216
|
return (0, backend_request_handler_1.handleBackendRequest)(async () => {
|
|
212
|
-
|
|
217
|
+
// Blockfrost rejects count > 100 with a 400 — clamp instead
|
|
218
|
+
const count = limit === undefined ? undefined : Math.min(Math.max(limit, 1), 100);
|
|
219
|
+
const address_txs = await this.api.addressesTransactions(address, { order: 'desc', count });
|
|
213
220
|
const txHashes = address_txs.map(tx => tx.tx_hash);
|
|
214
221
|
// Batch fetch instead of N+1 individual calls
|
|
215
222
|
const batchResult = await this.getTransactionsBatch(txHashes);
|
|
@@ -230,7 +237,8 @@ class BlockfrostBackend {
|
|
|
230
237
|
*/
|
|
231
238
|
async getAddressUtxos(address) {
|
|
232
239
|
return (0, backend_request_handler_1.handleBackendRequest)(async () => {
|
|
233
|
-
|
|
240
|
+
// *All variant paginates internally (plain addressesUtxos caps at 100 entries)
|
|
241
|
+
const utxo_data = await this.api.addressesUtxosAll(address);
|
|
234
242
|
return utxo_data.map(utxo => ({
|
|
235
243
|
txHash: utxo.tx_hash,
|
|
236
244
|
outputIndex: utxo.output_index,
|
|
@@ -383,7 +391,8 @@ class BlockfrostBackend {
|
|
|
383
391
|
async getAccount(stakeAddress) {
|
|
384
392
|
return (0, backend_request_handler_1.handleBackendRequest)(async () => {
|
|
385
393
|
const accountData = await this.api.accounts(stakeAddress);
|
|
386
|
-
|
|
394
|
+
// *All variant paginates internally (plain accountsAddresses caps at 100 entries)
|
|
395
|
+
const addressData = await this.api.accountsAddressesAll(stakeAddress);
|
|
387
396
|
const addresses = [];
|
|
388
397
|
const concurrent = BlockfrostBackend.MAX_CONCURRENT;
|
|
389
398
|
for (let i = 0; i < addressData.length; i += concurrent) {
|
|
@@ -561,7 +570,9 @@ class BlockfrostBackend {
|
|
|
561
570
|
*/
|
|
562
571
|
async getAddressTransactionHashes(address, limit) {
|
|
563
572
|
return (0, backend_request_handler_1.handleBackendRequest)(async () => {
|
|
564
|
-
|
|
573
|
+
// Blockfrost rejects count > 100 with a 400 — clamp instead
|
|
574
|
+
const count = Math.min(Math.max(limit, 1), 100);
|
|
575
|
+
const txs = await this.api.addressesTransactions(address, { order: 'desc', count });
|
|
565
576
|
return txs.map(tx => tx.tx_hash);
|
|
566
577
|
}, this.name);
|
|
567
578
|
}
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { Transaction, Address, UTxO, NetworkInformation, BlockData, EpochData, MetadataLabelTx, PoolData, DrepData, AccountData, AssetInfo, AssetHistoryEntry, LedgerProtocolParameters, ScriptEvaluationResult } from '../../utils/types';
|
|
2
|
+
/**
|
|
3
|
+
* CardanoBackend - Interface Definition for multiple backends (Blockfrost, Koios, Ogmios, etc.)
|
|
4
|
+
*
|
|
5
|
+
* Defines the standard methods that any Cardano backend must implement to be used interchangeably.
|
|
6
|
+
*/
|
|
7
|
+
export interface CardanoBackend {
|
|
8
|
+
/**
|
|
9
|
+
* Backend name
|
|
10
|
+
*/
|
|
11
|
+
name: string;
|
|
12
|
+
/**
|
|
13
|
+
* Methods this backend declares as NOT supported. The orchestrator skips the
|
|
14
|
+
* backend for these without counting a circuit-breaker failure — previously
|
|
15
|
+
* Ogmios either fabricated placeholder data for them (which preferLive routing
|
|
16
|
+
* then preferred over correct historical data) or its thrown errors poisoned
|
|
17
|
+
* the breaker.
|
|
18
|
+
*/
|
|
19
|
+
readonly unsupportedMethods?: ReadonlySet<string>;
|
|
20
|
+
/**
|
|
21
|
+
* Initialize the backend
|
|
22
|
+
*/
|
|
23
|
+
init(): Promise<boolean>;
|
|
24
|
+
/**
|
|
25
|
+
* Get Transaction Data
|
|
26
|
+
* @param txHash transaction hash (hex)
|
|
27
|
+
* @returns {Promise<Transaction>} transaction data
|
|
28
|
+
*/
|
|
29
|
+
getTransaction(txHash: string): Promise<Transaction>;
|
|
30
|
+
/**
|
|
31
|
+
* Get Address Data
|
|
32
|
+
* @param address bech32 address
|
|
33
|
+
* @returns {Promise<Address>} address data
|
|
34
|
+
*/
|
|
35
|
+
getAddress(address: string): Promise<Address>;
|
|
36
|
+
/**
|
|
37
|
+
* Get Address UTxOs
|
|
38
|
+
* @param address bech32 address
|
|
39
|
+
* @returns {Promise<UTxO[]>} list of UTxOs
|
|
40
|
+
*/
|
|
41
|
+
getAddressUtxos(address: string): Promise<UTxO[]>;
|
|
42
|
+
/**
|
|
43
|
+
* Get Address Transactions (lightweight - only tx hashes and basic info)
|
|
44
|
+
* @param address bech32 address
|
|
45
|
+
* @returns {Promise<Transaction[]>} list of transactions involving this address
|
|
46
|
+
*/
|
|
47
|
+
getAddressTransactions(address: string, limit: number): Promise<Transaction[]>;
|
|
48
|
+
/**
|
|
49
|
+
* Get Network Information
|
|
50
|
+
* @returns {Promise<NetworkInformation>} network information
|
|
51
|
+
*/
|
|
52
|
+
getNetworkInformation(): Promise<NetworkInformation>;
|
|
53
|
+
/**
|
|
54
|
+
* Get Transaction Metadata
|
|
55
|
+
* @param txHash transaction hash (hex)
|
|
56
|
+
* @returns {Promise<MetadataLabelTx[]>} transaction metadata list
|
|
57
|
+
*/
|
|
58
|
+
getTransactionMetadata(txHash: string): Promise<MetadataLabelTx[]>;
|
|
59
|
+
/**
|
|
60
|
+
* Get Block Data
|
|
61
|
+
* @param blockHash block hash (hex)
|
|
62
|
+
* @returns {Promise<BlockData>} block data
|
|
63
|
+
*/
|
|
64
|
+
getBlock(blockHash: string): Promise<BlockData>;
|
|
65
|
+
/**
|
|
66
|
+
* Get Epoch Data
|
|
67
|
+
* @param epochNumber epoch number
|
|
68
|
+
* @returns {Promise<EpochData>} epoch data
|
|
69
|
+
*/
|
|
70
|
+
getEpoch(epochNumber: number): Promise<EpochData>;
|
|
71
|
+
/**
|
|
72
|
+
* Get Latest Epoch Data
|
|
73
|
+
* @returns {Promise<EpochData>} latest epoch data
|
|
74
|
+
*/
|
|
75
|
+
getLatestEpoch(): Promise<EpochData>;
|
|
76
|
+
/**
|
|
77
|
+
* Get Latest Block Data
|
|
78
|
+
* @returns {Promise<BlockData>} latest block data
|
|
79
|
+
*/
|
|
80
|
+
getLatestBlock(): Promise<BlockData>;
|
|
81
|
+
/**
|
|
82
|
+
* Get the latest chain tip slot.
|
|
83
|
+
* Throws ProviderUnavailableError when the backend's latest block has no slot.
|
|
84
|
+
* @returns {Promise<number>} current chain slot
|
|
85
|
+
*/
|
|
86
|
+
getCurrentSlot(): Promise<number>;
|
|
87
|
+
/**
|
|
88
|
+
* Check whether a UTxO is still unspent. Returns `false` for txs that don't
|
|
89
|
+
* exist on chain and for out-of-range output indices.
|
|
90
|
+
* @param txHash 64-char lowercase hex
|
|
91
|
+
* @param outputIndex non-negative integer
|
|
92
|
+
* @returns {Promise<boolean>} true iff the UTxO exists and is unspent
|
|
93
|
+
*/
|
|
94
|
+
isUtxoUnspent(txHash: string, outputIndex: number): Promise<boolean>;
|
|
95
|
+
/**
|
|
96
|
+
* Get Pool Data
|
|
97
|
+
* @param poolId pool id
|
|
98
|
+
* @returns {Promise<PoolData>} pool data
|
|
99
|
+
*/
|
|
100
|
+
getPool(poolId: string): Promise<PoolData>;
|
|
101
|
+
/**
|
|
102
|
+
* Get Drep Data
|
|
103
|
+
* @param drepId drep id
|
|
104
|
+
* @returns {Promise<DrepData>} drep data
|
|
105
|
+
*/
|
|
106
|
+
getDrep(drepId: string): Promise<DrepData>;
|
|
107
|
+
/**
|
|
108
|
+
* Get Account Data
|
|
109
|
+
* @param accountId account id
|
|
110
|
+
* @returns {Promise<AccountData>} account data
|
|
111
|
+
*/
|
|
112
|
+
getAccount(accountId: string): Promise<AccountData>;
|
|
113
|
+
/**
|
|
114
|
+
* Get Asset Info (supply, mint history, CIP-25 + CIP-26 metadata)
|
|
115
|
+
* @param unit policyId + assetNameHex (concatenated hex)
|
|
116
|
+
* @returns {Promise<AssetInfo>} canonical asset info
|
|
117
|
+
*/
|
|
118
|
+
getAssetInfo(unit: string): Promise<AssetInfo>;
|
|
119
|
+
/**
|
|
120
|
+
* Get latest mint/burn events for an asset (most recent first).
|
|
121
|
+
* Optional — Ogmios doesn't expose this. Blockfrost lacks block timestamps;
|
|
122
|
+
* Koios includes block_time per entry.
|
|
123
|
+
* @param unit policyId + assetNameHex (concatenated hex)
|
|
124
|
+
* @param limit max number of events (default 100)
|
|
125
|
+
* @returns {Promise<AssetHistoryEntry[]>} list of mint/burn events
|
|
126
|
+
*/
|
|
127
|
+
getAssetHistory?(unit: string, limit?: number): Promise<AssetHistoryEntry[]>;
|
|
128
|
+
/**
|
|
129
|
+
* Get Protocol Parameters
|
|
130
|
+
* @returns {Promise<LedgerProtocolParameters>} protocol parameters
|
|
131
|
+
*/
|
|
132
|
+
getProtocolParameters(): Promise<LedgerProtocolParameters>;
|
|
133
|
+
/**
|
|
134
|
+
* Submit a signed transaction to the network
|
|
135
|
+
* @param signedTxCbor signed transaction in CBOR hex format
|
|
136
|
+
* @returns {Promise<string>} transaction hash
|
|
137
|
+
*/
|
|
138
|
+
submitTransaction(signedTxCbor: string): Promise<string>;
|
|
139
|
+
/**
|
|
140
|
+
* Get transaction hashes for an address (lightweight — no full tx details).
|
|
141
|
+
* Used by the indexer to separate hash listing from detail fetching.
|
|
142
|
+
* Optional: falls back to getAddressTransactions() + map to hashes if not implemented.
|
|
143
|
+
* @param address bech32 address
|
|
144
|
+
* @param limit maximum number of transaction hashes to return
|
|
145
|
+
* @returns {Promise<string[]>} list of transaction hashes (most recent first)
|
|
146
|
+
*/
|
|
147
|
+
getAddressTransactionHashes?(address: string, limit: number): Promise<string[]>;
|
|
148
|
+
/**
|
|
149
|
+
* Batch fetch multiple transactions by hash.
|
|
150
|
+
* Koios implements natively via POST /tx_info; Blockfrost uses concurrency-limited parallel calls.
|
|
151
|
+
* Optional: falls back to individual getTransaction() calls if not implemented.
|
|
152
|
+
* @param txHashes array of transaction hashes (hex)
|
|
153
|
+
* @returns {Promise<Map<string, Transaction>>} map of txHash -> Transaction
|
|
154
|
+
*/
|
|
155
|
+
getTransactionsBatch?(txHashes: string[]): Promise<Map<string, Transaction>>;
|
|
156
|
+
/**
|
|
157
|
+
* Get UTxOs across all bech32 addresses sharing a 28-byte payment credential
|
|
158
|
+
* (key hash or script hash). Returns UTxOs with their owning bech32 address.
|
|
159
|
+
* Optional — only Koios implements this natively (`POST /credential_utxos`).
|
|
160
|
+
* @param credHash 28-byte payment credential as 56-char lowercase hex
|
|
161
|
+
* @returns {Promise<UTxO[]>} list of UTxOs across all bech32 forms
|
|
162
|
+
*/
|
|
163
|
+
getCredentialUtxos?(credHash: string): Promise<UTxO[]>;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Extended backend interface for backends that support transaction evaluation (e.g., Ogmios)
|
|
167
|
+
*/
|
|
168
|
+
export interface EvaluatingBackend extends CardanoBackend {
|
|
169
|
+
/**
|
|
170
|
+
* Evaluate transaction script execution units
|
|
171
|
+
* @param unsignedTxCbor unsigned transaction in CBOR hex format
|
|
172
|
+
* @returns evaluation results with validator and budget
|
|
173
|
+
*/
|
|
174
|
+
evaluateTransaction(unsignedTxCbor: string): Promise<ScriptEvaluationResult[]>;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Type guard to check if a backend supports transaction evaluation
|
|
178
|
+
* @param backend - The backend to check
|
|
179
|
+
* @returns true if the backend supports evaluateTransaction
|
|
180
|
+
*/
|
|
181
|
+
export declare function isEvaluatingBackend(backend: CardanoBackend): backend is EvaluatingBackend;
|
|
182
|
+
//# sourceMappingURL=cardano-backend.d.ts.map
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { CardanoBackend } from './cardano-backend';
|
|
2
|
+
import { Transaction, BlockData, Address, UTxO, NetworkInformation, EpochData, MetadataLabelTx, PoolData, DrepData, AccountData, AssetInfo, AssetHistoryEntry, LedgerProtocolParameters } from '../../utils/types';
|
|
3
|
+
import { Network } from '../cardano-client';
|
|
4
|
+
/**
|
|
5
|
+
* KoiosBackend Implementation for CardanoBackend Interface
|
|
6
|
+
* Implements the CardanoBackend interface using Koios API with Axios
|
|
7
|
+
*/
|
|
8
|
+
export declare class KoiosBackend implements CardanoBackend {
|
|
9
|
+
readonly name = "koios";
|
|
10
|
+
private api;
|
|
11
|
+
private network;
|
|
12
|
+
/**
|
|
13
|
+
* Constructor
|
|
14
|
+
*/
|
|
15
|
+
constructor(network: Network, timeoutMs: number, apiKey?: string);
|
|
16
|
+
/**
|
|
17
|
+
* Initialize the backend
|
|
18
|
+
*/
|
|
19
|
+
init(): Promise<boolean>;
|
|
20
|
+
/**
|
|
21
|
+
* Retry a Koios API call up to 3 times with exponential backoff if the
|
|
22
|
+
* result is an empty array. Koios sometimes returns [] transiently for
|
|
23
|
+
* valid queries — a single retry is not always sufficient for historical
|
|
24
|
+
* epoch lookups, so we retry with increasing delays (500 → 1000 → 2000 ms).
|
|
25
|
+
*/
|
|
26
|
+
private fetchWithRetryOnEmpty;
|
|
27
|
+
/**
|
|
28
|
+
* Get Transaction Data for specified transaction hash
|
|
29
|
+
* @param hash transaction hash (hex)
|
|
30
|
+
* @returns {Promise<Transaction>} transaction data
|
|
31
|
+
*/
|
|
32
|
+
getTransaction(hash: string): Promise<Transaction>;
|
|
33
|
+
/**
|
|
34
|
+
* Get Block Data for specified block hash
|
|
35
|
+
* @param blockHash block hash (hex)
|
|
36
|
+
* @returns {Promise<BlockData>} block data
|
|
37
|
+
*/
|
|
38
|
+
getBlock(blockHash: string): Promise<BlockData>;
|
|
39
|
+
/**
|
|
40
|
+
* Get Epoch Data for specified epoch number
|
|
41
|
+
* @param epochNumber epoch number
|
|
42
|
+
* @returns {Promise<EpochData>} epoch data
|
|
43
|
+
*/
|
|
44
|
+
getEpoch(epochNumber: number): Promise<EpochData>;
|
|
45
|
+
/**
|
|
46
|
+
* Get Address Data (without transactions - use getAddressTransactions() separately)
|
|
47
|
+
* @param address bech32 address
|
|
48
|
+
* @returns {Promise<Address>} address data
|
|
49
|
+
*/
|
|
50
|
+
getAddress(address: string): Promise<Address>;
|
|
51
|
+
/**
|
|
52
|
+
* Get Address Transactions
|
|
53
|
+
* @param address bech32 address
|
|
54
|
+
* @returns {Promise<Transaction[]>} list of transactions for this address
|
|
55
|
+
*/
|
|
56
|
+
getAddressTransactions(address: string, limit: number): Promise<Transaction[]>;
|
|
57
|
+
/**
|
|
58
|
+
* Get Address UTxOs for specified address
|
|
59
|
+
* @param address bech32 address
|
|
60
|
+
* @returns {Promise<UTxO[]>} list of UTxOs
|
|
61
|
+
*/
|
|
62
|
+
getAddressUtxos(address: string): Promise<UTxO[]>;
|
|
63
|
+
/**
|
|
64
|
+
* Get UTxOs by payment credential. Returns UTxOs across all bech32 addresses
|
|
65
|
+
* sharing the given 28-byte payment credential (key hash or script hash).
|
|
66
|
+
* Native Koios endpoint — single round-trip with inline-datum hydration.
|
|
67
|
+
* @param credHash 28-byte payment credential as 56-char lowercase hex
|
|
68
|
+
* @returns {Promise<UTxO[]>} list of UTxOs across all bech32 forms
|
|
69
|
+
*/
|
|
70
|
+
getCredentialUtxos(credHash: string): Promise<UTxO[]>;
|
|
71
|
+
/**
|
|
72
|
+
* Get Network Information
|
|
73
|
+
* @returns {Promise<Network>} network information
|
|
74
|
+
*/
|
|
75
|
+
getNetworkInformation(): Promise<NetworkInformation>;
|
|
76
|
+
/**
|
|
77
|
+
* Get Transaction Metadata for specified transaction hash
|
|
78
|
+
* @param tx_hash transaction hash (hex)
|
|
79
|
+
* @returns {Promise<MetadataLabelTx[]>} transaction metadata list
|
|
80
|
+
*/
|
|
81
|
+
getTransactionMetadata(tx_hash: string): Promise<MetadataLabelTx[]>;
|
|
82
|
+
/**
|
|
83
|
+
* Get Pool Data for specified pool id
|
|
84
|
+
* @param poolId pool id
|
|
85
|
+
* @returns {Promise<PoolData>} pool data
|
|
86
|
+
*/
|
|
87
|
+
getPool(poolId: string): Promise<PoolData>;
|
|
88
|
+
/**
|
|
89
|
+
* Get Asset Info (supply, mint history, CIP-25 + CIP-26 metadata).
|
|
90
|
+
* Koios's `asset_info` returns total_supply, mint/burn counts split,
|
|
91
|
+
* minting tx + creation_time, and both on-chain and registry metadata.
|
|
92
|
+
* @param unit policyId + assetNameHex (concatenated hex)
|
|
93
|
+
* @returns {Promise<AssetInfo>} canonical asset info
|
|
94
|
+
*/
|
|
95
|
+
getAssetInfo(unit: string): Promise<AssetInfo>;
|
|
96
|
+
/**
|
|
97
|
+
* Get latest mint/burn events for an asset.
|
|
98
|
+
* Koios's `asset_history` returns minting_txs[{ tx_hash, block_time, quantity }]
|
|
99
|
+
* with `quantity` SIGNED (negative = burn). Action is derived from sign;
|
|
100
|
+
* the canonical `quantity` field stores absolute value.
|
|
101
|
+
* @param unit policyId + assetNameHex (concatenated hex)
|
|
102
|
+
* @param limit max number of events (default 100). Note: Koios returns ALL events;
|
|
103
|
+
* limit is applied client-side after sort-by-block_time desc.
|
|
104
|
+
* @returns {Promise<AssetHistoryEntry[]>} list of mint/burn events (most recent first)
|
|
105
|
+
*/
|
|
106
|
+
getAssetHistory(unit: string, limit?: number): Promise<AssetHistoryEntry[]>;
|
|
107
|
+
/**
|
|
108
|
+
* Get Drep Data for specified drep id
|
|
109
|
+
* @param drepId drep id
|
|
110
|
+
* @returns {Promise<DrepData>} drep data
|
|
111
|
+
*/
|
|
112
|
+
getDrep(drepId: string): Promise<DrepData>;
|
|
113
|
+
/**
|
|
114
|
+
* Get Account Data for specified stake address
|
|
115
|
+
* @param accountId account id
|
|
116
|
+
* @returns {Promise<AccountData>} account data
|
|
117
|
+
*/
|
|
118
|
+
getAccount(accountId: string): Promise<AccountData>;
|
|
119
|
+
/**
|
|
120
|
+
* Submit Transaction
|
|
121
|
+
* @param signedTxCbor signed transaction in CBOR hex format
|
|
122
|
+
* @returns {Promise<string>} transaction hash
|
|
123
|
+
*/
|
|
124
|
+
submitTransaction(signedTxCbor: string): Promise<string>;
|
|
125
|
+
/**
|
|
126
|
+
* Get Protocol Parameters
|
|
127
|
+
* @returns {Promise<any>} protocol parameters
|
|
128
|
+
*/
|
|
129
|
+
getProtocolParameters(): Promise<LedgerProtocolParameters>;
|
|
130
|
+
/**
|
|
131
|
+
* Get Latest Block Data
|
|
132
|
+
* @returns {Promise<BlockData>} latest block data
|
|
133
|
+
*/
|
|
134
|
+
getLatestBlock(): Promise<BlockData>;
|
|
135
|
+
/**
|
|
136
|
+
* Get Latest Epoch Data
|
|
137
|
+
* @returns {Promise<EpochData>} latest epoch data
|
|
138
|
+
*/
|
|
139
|
+
getLatestEpoch(): Promise<EpochData>;
|
|
140
|
+
/**
|
|
141
|
+
* Get the latest chain tip slot.
|
|
142
|
+
* @returns {Promise<number>} current chain slot
|
|
143
|
+
*/
|
|
144
|
+
getCurrentSlot(): Promise<number>;
|
|
145
|
+
/**
|
|
146
|
+
* Check whether a UTxO is still unspent via Koios `POST /utxo_info`.
|
|
147
|
+
* @param txHash 64-char lowercase hex
|
|
148
|
+
* @param outputIndex non-negative integer
|
|
149
|
+
* @returns {Promise<boolean>} true iff the UTxO exists and is unspent
|
|
150
|
+
*/
|
|
151
|
+
isUtxoUnspent(txHash: string, outputIndex: number): Promise<boolean>;
|
|
152
|
+
/**
|
|
153
|
+
* Get transaction hashes for an address (lightweight — no full tx details).
|
|
154
|
+
* @param address bech32 address
|
|
155
|
+
* @param limit maximum number of hashes
|
|
156
|
+
* @returns {Promise<string[]>} most recent tx hashes
|
|
157
|
+
*/
|
|
158
|
+
getAddressTransactionHashes(address: string, limit: number): Promise<string[]>;
|
|
159
|
+
/**
|
|
160
|
+
* Batch fetch multiple transactions by hash using Koios POST /tx_info.
|
|
161
|
+
* Sends all hashes in one request (chunked at 100 per Koios limit).
|
|
162
|
+
* @param txHashes array of transaction hashes
|
|
163
|
+
* @returns {Promise<Map<string, Transaction>>} map of hash -> Transaction
|
|
164
|
+
*/
|
|
165
|
+
getTransactionsBatch(txHashes: string[]): Promise<Map<string, Transaction>>;
|
|
166
|
+
/**
|
|
167
|
+
* Map a Koios /tx_info response object to the normalized Transaction type.
|
|
168
|
+
*/
|
|
169
|
+
private _mapKoiosTx;
|
|
170
|
+
}
|
|
171
|
+
//# sourceMappingURL=koios-backend.d.ts.map
|
|
@@ -17,6 +17,38 @@ const KOIOS_URLS = {
|
|
|
17
17
|
preview: 'https://preview.koios.rest/api/v1',
|
|
18
18
|
preprod: 'https://preprod.koios.rest/api/v1',
|
|
19
19
|
};
|
|
20
|
+
/**
|
|
21
|
+
* Koios `reference_script` (with `_extended: true`) is an OBJECT
|
|
22
|
+
* `{ hash, size, type, bytes, value }` — the previous `as string` cast handed
|
|
23
|
+
* that object downstream and broke the v1.6.1 input-side refScript feature.
|
|
24
|
+
* Returns the full script CBOR bytes when present (what the local Plutus eval
|
|
25
|
+
* needs), falling back to the hash (resolved on-chain only).
|
|
26
|
+
*/
|
|
27
|
+
function koiosRefScriptBytes(ref) {
|
|
28
|
+
if (!ref)
|
|
29
|
+
return null;
|
|
30
|
+
if (typeof ref === 'string')
|
|
31
|
+
return ref;
|
|
32
|
+
const obj = ref;
|
|
33
|
+
return obj.bytes || obj.hash || null;
|
|
34
|
+
}
|
|
35
|
+
/** Like koiosRefScriptBytes, but strictly the script HASH (for *Hash fields). */
|
|
36
|
+
function koiosRefScriptHash(ref) {
|
|
37
|
+
if (!ref)
|
|
38
|
+
return null;
|
|
39
|
+
if (typeof ref === 'string')
|
|
40
|
+
return ref;
|
|
41
|
+
const obj = ref;
|
|
42
|
+
return obj.hash || null;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Sort Koios /address_txs rows newest-first. Koios gives no ordering guarantee —
|
|
46
|
+
* a bare `slice(0, limit)` returned ARBITRARY rather than recent transactions
|
|
47
|
+
* (Blockfrost requests `order: 'desc'` for the same data).
|
|
48
|
+
*/
|
|
49
|
+
function sortAddressTxsDesc(rows) {
|
|
50
|
+
return [...rows].sort((a, b) => Number(b.block_height ?? b.block_time ?? 0) - Number(a.block_height ?? a.block_time ?? 0));
|
|
51
|
+
}
|
|
20
52
|
/**
|
|
21
53
|
* KoiosBackend Implementation for CardanoBackend Interface
|
|
22
54
|
* Implements the CardanoBackend interface using Koios API with Axios
|
|
@@ -60,13 +92,13 @@ class KoiosBackend {
|
|
|
60
92
|
* valid queries — a single retry is not always sufficient for historical
|
|
61
93
|
* epoch lookups, so we retry with increasing delays (500 → 1000 → 2000 ms).
|
|
62
94
|
*/
|
|
63
|
-
//
|
|
64
|
-
//
|
|
65
|
-
//
|
|
66
|
-
//
|
|
67
|
-
|
|
68
|
-
// eslint-disable-
|
|
69
|
-
) {
|
|
95
|
+
// Type-agnostic retry helper: it only checks that `.data` is a non-empty
|
|
96
|
+
// array, so the element type is intentionally `any` to avoid forcing every
|
|
97
|
+
// Koios endpoint call site (block_info, epoch_info, account_info, …) to
|
|
98
|
+
// declare a row shape just for the empty-array retry path. Row narrowing
|
|
99
|
+
// happens at the use sites.
|
|
100
|
+
async fetchWithRetryOnEmpty(fn, // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
101
|
+
label) {
|
|
70
102
|
const maxRetries = 3;
|
|
71
103
|
const baseDelayMs = 500;
|
|
72
104
|
const result = await fn();
|
|
@@ -174,14 +206,12 @@ class KoiosBackend {
|
|
|
174
206
|
}
|
|
175
207
|
const addressData = data[0];
|
|
176
208
|
const addressUtxos = await this.getAddressUtxos(address);
|
|
209
|
+
// Sum balances from the already-mapped UTxOs instead of re-iterating
|
|
210
|
+
// address_info's utxo_set (whose asset_list can be null → crashed here).
|
|
177
211
|
const totals = new Map();
|
|
178
|
-
for (const u of
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
// add native assets
|
|
182
|
-
for (const a of u.asset_list) {
|
|
183
|
-
const unit = `${a.policy_id}${a.asset_name}`;
|
|
184
|
-
totals.set(unit, (totals.get(unit) ?? 0n) + BigInt(a.quantity));
|
|
212
|
+
for (const u of addressUtxos) {
|
|
213
|
+
for (const a of u.amount) {
|
|
214
|
+
totals.set(a.unit, (totals.get(a.unit) ?? 0n) + BigInt(a.quantity));
|
|
185
215
|
}
|
|
186
216
|
}
|
|
187
217
|
const amount = Array.from(totals.entries()).map(([unit, quantity]) => ({
|
|
@@ -206,11 +236,15 @@ class KoiosBackend {
|
|
|
206
236
|
async getAddressTransactions(address, limit) {
|
|
207
237
|
return (0, backend_request_handler_1.handleBackendRequest)(async () => {
|
|
208
238
|
const { data: addressTxs } = await this.api.post('/address_txs', { _addresses: [address] });
|
|
209
|
-
//
|
|
210
|
-
const limitedTxs = addressTxs.slice(0, limit);
|
|
211
|
-
const
|
|
212
|
-
|
|
213
|
-
|
|
239
|
+
// newest first, THEN limit (saves API calls); batch instead of unbounded Promise.all
|
|
240
|
+
const limitedTxs = sortAddressTxsDesc(addressTxs).slice(0, limit);
|
|
241
|
+
const batch = await this.getTransactionsBatch(limitedTxs.map(tx => tx.tx_hash));
|
|
242
|
+
const transactions = [];
|
|
243
|
+
for (const tx of limitedTxs) {
|
|
244
|
+
const resolved = batch.get(tx.tx_hash);
|
|
245
|
+
if (resolved)
|
|
246
|
+
transactions.push(resolved);
|
|
247
|
+
}
|
|
214
248
|
return transactions;
|
|
215
249
|
}, this.name);
|
|
216
250
|
}
|
|
@@ -242,7 +276,7 @@ class KoiosBackend {
|
|
|
242
276
|
amount: amount,
|
|
243
277
|
blockHash: utxo.block_hash,
|
|
244
278
|
datumHash: utxo.datum_hash || null,
|
|
245
|
-
scriptRef: utxo.reference_script
|
|
279
|
+
scriptRef: koiosRefScriptBytes(utxo.reference_script),
|
|
246
280
|
inlineDatum: (0, tx_build_helper_1.inlineDatumToHex)(utxo.inline_datum),
|
|
247
281
|
};
|
|
248
282
|
});
|
|
@@ -280,7 +314,7 @@ class KoiosBackend {
|
|
|
280
314
|
amount: amount,
|
|
281
315
|
blockHash: utxo.block_hash,
|
|
282
316
|
datumHash: utxo.datum_hash || null,
|
|
283
|
-
scriptRef: utxo.reference_script
|
|
317
|
+
scriptRef: koiosRefScriptBytes(utxo.reference_script),
|
|
284
318
|
inlineDatum: (0, tx_build_helper_1.inlineDatumToHex)(utxo.inline_datum),
|
|
285
319
|
};
|
|
286
320
|
});
|
|
@@ -382,7 +416,10 @@ class KoiosBackend {
|
|
|
382
416
|
poolId: poolData.pool_id_bech32 || poolData.pool_id_hex || poolId,
|
|
383
417
|
vrfKeyHash: poolData.vrf_key_hash,
|
|
384
418
|
blocksMinted: poolData.block_count,
|
|
385
|
-
|
|
419
|
+
// Koios pool_info has no blocks-in-current-epoch figure — epoch_no
|
|
420
|
+
// (the epoch NUMBER) was mapped here before, which is a different
|
|
421
|
+
// semantic than Blockfrost's blocks_epoch. 0 = not available.
|
|
422
|
+
blocksEpoch: 0,
|
|
386
423
|
liveStake: poolData.live_stake || '0',
|
|
387
424
|
liveSize: poolData.live_size || 0,
|
|
388
425
|
liveDelegators: poolData.live_delegators || 0,
|
|
@@ -733,7 +770,9 @@ class KoiosBackend {
|
|
|
733
770
|
async getAddressTransactionHashes(address, limit) {
|
|
734
771
|
return (0, backend_request_handler_1.handleBackendRequest)(async () => {
|
|
735
772
|
const { data } = await this.api.post('/address_txs', { _addresses: [address] });
|
|
736
|
-
return data
|
|
773
|
+
return sortAddressTxsDesc(data)
|
|
774
|
+
.slice(0, limit)
|
|
775
|
+
.map(tx => tx.tx_hash);
|
|
737
776
|
}, this.name);
|
|
738
777
|
}
|
|
739
778
|
/**
|
|
@@ -793,8 +832,11 @@ class KoiosBackend {
|
|
|
793
832
|
blockHeight: Number(tx.block_height),
|
|
794
833
|
blockTime: tx.tx_timestamp ?? tx.block_time ?? 0,
|
|
795
834
|
slot: tx.absolute_slot ?? tx.slot_no ?? 0,
|
|
796
|
-
|
|
797
|
-
|
|
835
|
+
// Koios /tx_info fields are `tx_block_index` and `fee` (verified against
|
|
836
|
+
// the live OpenAPI spec) — `tx_index`/`tx_fee` never existed, so the fee
|
|
837
|
+
// was always reported as '0'
|
|
838
|
+
index: tx.tx_block_index ?? 0,
|
|
839
|
+
fee: tx.fee || '0',
|
|
798
840
|
deposit: tx.deposit || '0',
|
|
799
841
|
size: tx.tx_size,
|
|
800
842
|
inputs: tx.inputs.map((input) => {
|
|
@@ -816,7 +858,7 @@ class KoiosBackend {
|
|
|
816
858
|
amount: amount,
|
|
817
859
|
dataHash: input.datum_hash || null,
|
|
818
860
|
inlineDatum: (0, tx_build_helper_1.inlineDatumToHex)(input.inline_datum),
|
|
819
|
-
referenceScriptHash: input.reference_script
|
|
861
|
+
referenceScriptHash: koiosRefScriptHash(input.reference_script),
|
|
820
862
|
};
|
|
821
863
|
}),
|
|
822
864
|
outputs: tx.outputs.map((output) => {
|
|
@@ -839,7 +881,7 @@ class KoiosBackend {
|
|
|
839
881
|
dataHash: output.datum_hash || null,
|
|
840
882
|
inlineDatum: (0, tx_build_helper_1.inlineDatumToHex)(output.inline_datum),
|
|
841
883
|
isCollateral: false,
|
|
842
|
-
referenceScriptHash: output.reference_script
|
|
884
|
+
referenceScriptHash: koiosRefScriptHash(output.reference_script),
|
|
843
885
|
};
|
|
844
886
|
}),
|
|
845
887
|
metadata: labels
|