@odatano/core 2.0.0-rc.19 → 2.0.0-rc.20
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/CardanoAgentService/index.d.ts +1 -5
- package/@cds-models/CardanoIndexerService/index.d.ts +51 -2
- package/@cds-models/CardanoIndexerService/index.js +7 -0
- package/package.json +1 -1
- package/src/index.d.ts +4 -10
- package/src/index.js +6 -16
- package/src/plugin.js +11 -27
- package/srv/blockchain/backends/blockfrost-backend.d.ts +29 -131
- package/srv/blockchain/backends/blockfrost-backend.js +39 -150
- package/srv/blockchain/backends/cardano-backend.d.ts +53 -171
- package/srv/blockchain/backends/cardano-backend.js +1 -5
- package/srv/blockchain/backends/koios-backend.d.ts +26 -71
- package/srv/blockchain/backends/koios-backend.js +50 -132
- package/srv/blockchain/backends/ogmios-backend.d.ts +43 -124
- package/srv/blockchain/backends/ogmios-backend.js +71 -179
- package/srv/blockchain/backends/ogmios-frame-guard.d.ts +12 -57
- package/srv/blockchain/backends/ogmios-frame-guard.js +27 -66
- package/srv/blockchain/cardano-client.d.ts +43 -216
- package/srv/blockchain/cardano-client.js +49 -234
- package/srv/blockchain/cardano-indexer.d.ts +79 -357
- package/srv/blockchain/cardano-indexer.js +98 -406
- package/srv/blockchain/cardano-tx-builder.d.ts +19 -84
- package/srv/blockchain/cardano-tx-builder.js +21 -107
- package/srv/blockchain/crawler/certificate-backfill.d.ts +45 -0
- package/srv/blockchain/crawler/certificate-backfill.js +150 -0
- package/srv/blockchain/crawler/crawler.d.ts +41 -145
- package/srv/blockchain/crawler/crawler.js +57 -172
- package/srv/blockchain/crawler/hooks.d.ts +3 -14
- package/srv/blockchain/crawler/index.d.ts +2 -6
- package/srv/blockchain/crawler/index.js +4 -9
- package/srv/blockchain/crawler/sync-state.d.ts +17 -39
- package/srv/blockchain/crawler/sync-state.js +23 -55
- package/srv/blockchain/crawler/utxo-set-import.d.ts +5 -22
- package/srv/blockchain/crawler/utxo-set-import.js +8 -28
- package/srv/blockchain/ledger-state.d.ts +3 -12
- package/srv/blockchain/signing/cose-verifier.d.ts +5 -12
- package/srv/blockchain/signing/cose-verifier.js +6 -12
- package/srv/blockchain/signing/external-signer.d.ts +16 -113
- package/srv/blockchain/signing/external-signer.js +19 -122
- package/srv/blockchain/signing/hsm-signer.d.ts +13 -45
- package/srv/blockchain/signing/hsm-signer.js +23 -63
- package/srv/blockchain/signing/signature-verifier.d.ts +8 -44
- package/srv/blockchain/signing/signature-verifier.js +13 -54
- package/srv/blockchain/signing/submission-finalizer.d.ts +9 -36
- package/srv/blockchain/signing/submission-finalizer.js +16 -48
- package/srv/blockchain/transaction-building/buildooor-tx.d.ts +65 -174
- package/srv/blockchain/transaction-building/buildooor-tx.js +107 -266
- package/srv/blockchain/transaction-building/cardano-tx.d.ts +8 -34
- package/srv/blockchain/wallet-worker/build-request.d.ts +4 -17
- package/srv/blockchain/wallet-worker/build-request.js +9 -22
- package/srv/blockchain/wallet-worker/confirmation-tracker.d.ts +12 -35
- package/srv/blockchain/wallet-worker/confirmation-tracker.js +16 -32
- package/srv/blockchain/wallet-worker/index.js +2 -8
- package/srv/blockchain/wallet-worker/job-store.d.ts +33 -111
- package/srv/blockchain/wallet-worker/job-store.js +0 -0
- package/srv/blockchain/wallet-worker/lease-heartbeat.d.ts +4 -20
- package/srv/blockchain/wallet-worker/lease-heartbeat.js +4 -20
- package/srv/blockchain/wallet-worker/signers.d.ts +6 -19
- package/srv/blockchain/wallet-worker/signers.js +3 -8
- package/srv/blockchain/wallet-worker/wallet-worker.d.ts +15 -71
- package/srv/blockchain/wallet-worker/wallet-worker.js +34 -90
- package/srv/cardano-agent-service.cds +1 -5
- package/srv/cardano-agent-service.js +3 -7
- package/srv/cardano-indexer-service.cds +32 -4
- package/srv/cardano-indexer-service.js +83 -15
- package/srv/cardano-service.js +36 -98
- package/srv/cardano-sign-service.cds +1 -1
- package/srv/cardano-sign-service.js +55 -173
- package/srv/cardano-tx-service.cds +1 -1
- package/srv/cardano-tx-service.js +54 -174
- package/srv/cardano-worker-service.js +7 -15
- package/srv/server.d.ts +27 -86
- package/srv/server.js +52 -148
- package/srv/utils/agent-grants-config.d.ts +11 -50
- package/srv/utils/agent-grants-config.js +12 -45
- package/srv/utils/agent-grants.d.ts +34 -123
- package/srv/utils/agent-grants.js +57 -156
- package/srv/utils/agent-token-auth.d.ts +2 -5
- package/srv/utils/agent-token-auth.js +2 -5
- package/srv/utils/backend-request-handler.d.ts +2 -16
- package/srv/utils/backend-request-handler.js +3 -18
- package/srv/utils/collections.d.ts +4 -8
- package/srv/utils/collections.js +4 -8
- package/srv/utils/const.d.ts +19 -68
- package/srv/utils/const.js +20 -69
- package/srv/utils/crypto.d.ts +3 -12
- package/srv/utils/crypto.js +5 -18
- package/srv/utils/db-indexes.d.ts +2 -7
- package/srv/utils/db-indexes.js +7 -34
- package/srv/utils/db-sanitize.d.ts +5 -18
- package/srv/utils/db-sanitize.js +6 -19
- package/srv/utils/error-codes.d.ts +18 -73
- package/srv/utils/error-codes.js +17 -70
- package/srv/utils/errors.d.ts +29 -191
- package/srv/utils/errors.js +44 -229
- package/srv/utils/liveness.d.ts +2 -9
- package/srv/utils/liveness.js +3 -11
- package/srv/utils/mappers.d.ts +50 -298
- package/srv/utils/mappers.js +80 -386
- package/srv/utils/network-context.js +2 -11
- package/srv/utils/pg-order-nulls.js +4 -23
- package/srv/utils/plutus-placeholders.d.ts +6 -18
- package/srv/utils/plutus-placeholders.js +6 -20
- package/srv/utils/rate-limiter.d.ts +6 -17
- package/srv/utils/rate-limiter.js +5 -15
- package/srv/utils/service-events.d.ts +2 -22
- package/srv/utils/service-events.js +3 -23
- package/srv/utils/signing-helper.d.ts +3 -18
- package/srv/utils/signing-helper.js +10 -32
- package/srv/utils/tx-build-helper.d.ts +18 -92
- package/srv/utils/tx-build-helper.js +32 -123
- package/srv/utils/tx-request-parsers.d.ts +7 -26
- package/srv/utils/tx-request-parsers.js +7 -26
- package/srv/utils/tx-utils.d.ts +4 -23
- package/srv/utils/tx-utils.js +12 -41
- package/srv/utils/types.d.ts +67 -206
- package/srv/utils/types.js +2 -6
- package/srv/utils/validators.d.ts +19 -89
- package/srv/utils/validators.js +31 -138
package/srv/utils/mappers.d.ts
CHANGED
|
@@ -3,358 +3,115 @@ import { Address as AddressRow, AddressAsset as AddressAssetRow, AddressUTxO as
|
|
|
3
3
|
import type { TransactionBuild as TransactionBuildRow, TransactionBuildInput as TransactionBuildInputRow, TransactionBuildOutput as TransactionBuildOutputRow, TransactionSubmission as TransactionSubmissionRow, AddressTransactionBuild as AddressTransactionBuildRow } from '#cds-models/CardanoTransactionService';
|
|
4
4
|
import type { AddressSigningRequest as AddressSigningRequestRow } from '#cds-models/CardanoSignService';
|
|
5
5
|
import type { Request } from '@sap/cds';
|
|
6
|
-
/**
|
|
7
|
-
* Maximum age for cached/indexed data in milliseconds
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
|
-
* Map Transaction Data
|
|
11
|
-
* Converts provider transaction data into TransactionRow format
|
|
12
|
-
* @param providerTx
|
|
13
|
-
* @returns {TransactionRow} mapped transaction row
|
|
14
|
-
*/
|
|
6
|
+
/** Provider transaction to TransactionRow. */
|
|
15
7
|
export declare function mapTransaction(providerTx: TransactionProviderData): TransactionRow;
|
|
16
|
-
/**
|
|
17
|
-
* Map Transaction Inputs
|
|
18
|
-
* Converts provider transaction input data into TransactionInputRow format
|
|
19
|
-
* @param txHash transaction hash
|
|
20
|
-
* @param txInputs transaction inputs from provider
|
|
21
|
-
* @returns {TransactionInputRow[]} mapped transaction input rows
|
|
22
|
-
*/
|
|
8
|
+
/** Provider transaction inputs to TransactionInputRows, keyed by position in the tx. */
|
|
23
9
|
export declare function mapTransactionInputs(txHash: string, txInputs: TxInputProviderData[]): TransactionInputRow[];
|
|
24
|
-
/**
|
|
25
|
-
* Map Transaction Input Assets
|
|
26
|
-
* Converts provider transaction input asset data into TransactionInputAssetRow format
|
|
27
|
-
* @param txHash transaction hash
|
|
28
|
-
* @param inputs transaction inputs from provider
|
|
29
|
-
* @returns {TransactionInputAssetRow[]} mapped transaction input asset rows
|
|
30
|
-
*/
|
|
10
|
+
/** Provider transaction input assets to TransactionInputAssetRows. */
|
|
31
11
|
export declare function mapTransactionInputAssets(txHash: string, inputs: TxInputProviderData[]): TransactionInputAssetRow[];
|
|
32
|
-
/**
|
|
33
|
-
* Map Transaction Certificates (crawler coverage, `crawler.certificates`).
|
|
34
|
-
* @param txHash transaction hash
|
|
35
|
-
* @param certificates normalized certificates from the source
|
|
36
|
-
* @returns {TransactionCertificateRow[]} one row per (certIndex, kind)
|
|
37
|
-
*/
|
|
12
|
+
/** Normalized certificates to TransactionCertificateRows, one per (certIndex, kind). */
|
|
38
13
|
export declare function mapTransactionCertificates(txHash: string, certificates: TxCertificateProviderData[]): TransactionCertificateRow[];
|
|
39
|
-
/**
|
|
40
|
-
* Map Transaction Withdrawals (crawler coverage, `crawler.certificates`).
|
|
41
|
-
* @param txHash transaction hash
|
|
42
|
-
* @param withdrawals normalized withdrawals from the source
|
|
43
|
-
* @returns {TransactionWithdrawalRow[]} one row per reward account
|
|
44
|
-
*/
|
|
14
|
+
/** Normalized withdrawals to TransactionWithdrawalRows, one per reward account. */
|
|
45
15
|
export declare function mapTransactionWithdrawals(txHash: string, withdrawals: TxWithdrawalProviderData[]): TransactionWithdrawalRow[];
|
|
46
|
-
/**
|
|
47
|
-
* Map Transaction Outputs
|
|
48
|
-
* Converts provider transaction output data into TransactionOutputRow format
|
|
49
|
-
* @param txHash transaction hash
|
|
50
|
-
* @param txOutputs transaction outputs from provider
|
|
51
|
-
* @returns {TransactionOutputRow[]} mapped transaction output rows
|
|
52
|
-
*/
|
|
16
|
+
/** Provider transaction outputs to TransactionOutputRows. */
|
|
53
17
|
export declare function mapTransactionOutputs(txHash: string, txOutputs: TxOutputProviderData[]): TransactionOutputRow[];
|
|
54
|
-
/**
|
|
55
|
-
* Map Transaction Output Assets
|
|
56
|
-
* Converts provider transaction output asset data into TransactionOutputAssetRow format
|
|
57
|
-
* @param txHash transaction hash
|
|
58
|
-
* @param outputs transaction outputs from provider
|
|
59
|
-
* @returns {TransactionOutputAssetRow[]} mapped transaction output asset rows
|
|
60
|
-
*/
|
|
18
|
+
/** Provider transaction output assets to TransactionOutputAssetRows. */
|
|
61
19
|
export declare function mapTransactionOutputAssets(txHash: string, outputs: TxOutputProviderData[]): TransactionOutputAssetRow[];
|
|
62
|
-
/**
|
|
63
|
-
* Map Address Data
|
|
64
|
-
* Converts provider address data into AddressRow format
|
|
65
|
-
* @param address address string
|
|
66
|
-
* @param addressData address data from provider
|
|
67
|
-
* @returns {AddressRow} mapped address row
|
|
68
|
-
*/
|
|
20
|
+
/** Provider address to a temporal AddressRow valid for `maxAge` ms. */
|
|
69
21
|
export declare function mapAddress(address: string, addressData: AddressProviderData, maxAge: number): AddressRow;
|
|
70
|
-
/**
|
|
71
|
-
* Map Address Transactions
|
|
72
|
-
* Converts provider address transaction data into AddressTransactionRow format
|
|
73
|
-
* @param addr address string
|
|
74
|
-
* @param addressTxsData address transactions data from provider
|
|
75
|
-
* @returns {AddressTransactionRow[]} mapped address transaction rows
|
|
76
|
-
* */
|
|
22
|
+
/** Provider transactions to AddressTransactionRows with the address's net amounts; non-temporal. */
|
|
77
23
|
export declare function mapAddressTransactions(addr: string, addressTxsData: TransactionProviderData[]): AddressTransactionRow[];
|
|
78
|
-
/**
|
|
79
|
-
* Map Address UTxOs
|
|
80
|
-
* @param addr address string
|
|
81
|
-
* @param validFrom validFrom
|
|
82
|
-
* @param validTo validTo
|
|
83
|
-
* @param addressUtxosData address UTxOs data from provider
|
|
84
|
-
* @returns {AddressUTxORow[]} mapped address UTxO rows
|
|
85
|
-
*/
|
|
24
|
+
/** Provider UTxOs to temporal AddressUTxORows. */
|
|
86
25
|
export declare function mapAddressUtxos(addr: string, validFrom: string, validTo: string, addressUtxosData: UtxosProviderData[]): AddressUTxORow[];
|
|
87
|
-
/**
|
|
88
|
-
* Map Address Assets
|
|
89
|
-
* Converts provider address asset data into AddressAssetRow format
|
|
90
|
-
* @param addr address string
|
|
91
|
-
* @param validFrom validFrom
|
|
92
|
-
* @param validTo validTo
|
|
93
|
-
* @param AssetAssets address assets from provider
|
|
94
|
-
* @returns {AddressAssetRow[]} mapped address asset rows
|
|
95
|
-
*/
|
|
26
|
+
/** Provider address amounts (without lovelace) to temporal AddressAssetRows. */
|
|
96
27
|
export declare function mapAddressAssets(addr: string, validFrom: string, validTo: string, AssetAssets: AmountProviderData[]): AddressAssetRow[];
|
|
97
|
-
/**
|
|
98
|
-
* Map UTxO Assets
|
|
99
|
-
* Converts provider address UTxO asset data into UTxOAssetRow format
|
|
100
|
-
* @param addressUtxosData address UTxOs data from provider
|
|
101
|
-
* @param validFrom validFrom
|
|
102
|
-
* @param validTo validTo
|
|
103
|
-
* @returns {UTxOAssetRow[]} mapped UTxO asset rows
|
|
104
|
-
*/
|
|
28
|
+
/** Native assets of provider UTxOs to temporal UTxOAssetRows. */
|
|
105
29
|
export declare function mapAddressUtxoAssets(addressUtxosData: UtxosProviderData[], validFrom: string, validTo: string): UTxOAssetRow[];
|
|
106
|
-
/**
|
|
107
|
-
* Map Network Information
|
|
108
|
-
* Converts provider network information data into NetworkInfoRow format
|
|
109
|
-
* @param providerNetworkData
|
|
110
|
-
* @returns {NetworkInfoRow} mapped network information row
|
|
111
|
-
*/
|
|
30
|
+
/** Provider network information to a temporal NetworkInfoRow. */
|
|
112
31
|
export declare function mapNetworkInfo(providerNetworkData: NetworkInfoProviderData, max_age: number, network: string): NetworkInfoRow;
|
|
113
|
-
/**
|
|
114
|
-
* Map Block Data
|
|
115
|
-
* Converts provider block data into BlockRow format
|
|
116
|
-
* @param providerBlockData block data from provider
|
|
117
|
-
* @param epochData epoch data for the block's epoch
|
|
118
|
-
* @returns {BlockRow} mapped block row
|
|
119
|
-
*/
|
|
32
|
+
/** Provider block to BlockRow. */
|
|
120
33
|
export declare function mapBlock(providerBlockData: BlockProviderData, epochData?: EpochRow): BlockRow;
|
|
121
|
-
/**
|
|
122
|
-
* Map Epoch Data
|
|
123
|
-
* Converts provider epoch data into EpochRow format
|
|
124
|
-
* @param providerEpochData epoch data from provider
|
|
125
|
-
* @returns {EpochRow} mapped epoch row
|
|
126
|
-
*/
|
|
34
|
+
/** Provider epoch to EpochRow. */
|
|
127
35
|
export declare function mapEpoch(providerEpochData: EpochProviderData): EpochRow;
|
|
128
|
-
/**
|
|
129
|
-
* Map Transaction Metadata
|
|
130
|
-
* Converts provider transaction metadata labels into TransactionMetadataRow format
|
|
131
|
-
* @param providerLabels array of metadata label data from provider
|
|
132
|
-
* @returns {TransactionMetadataRow[]} mapped transaction metadata rows
|
|
133
|
-
*/
|
|
36
|
+
/** Provider metadata labels to TransactionMetadataRows; non-uint64 labels are skipped. */
|
|
134
37
|
export declare function mapTransactionMetadata(providerLabels: MetadataLabelTxProviderData[]): TransactionMetadataRow[];
|
|
135
38
|
/**
|
|
136
|
-
*
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
* which PostgreSQL rejected as "out of range for type bigint" and halted the
|
|
140
|
-
* crawler. Beyond 2^53 the value is passed as a decimal string so that no
|
|
141
|
-
* precision is lost on the way to the database (CAP accepts strings for
|
|
142
|
-
* Integer64); `label` always keeps the original text.
|
|
143
|
-
*
|
|
144
|
-
* @returns the int64 key, or null when the label is not a non-negative integer
|
|
145
|
-
* (the caller skips the row — a NaN key would fail the whole bulk write)
|
|
39
|
+
* uint64 metadata label to the int64 `TransactionMetadata.id` key: labels >= 2^63 wrap via two's complement,
|
|
40
|
+
* values beyond 2^53 are passed as a decimal string (CAP accepts strings for Integer64).
|
|
41
|
+
* @returns the key, or null when the label is not a non-negative integer
|
|
146
42
|
*/
|
|
147
43
|
export declare function metadataIdFor(label: string | number): number | string | null;
|
|
148
|
-
/**
|
|
149
|
-
* Map a pool observation at an epoch boundary into a snapshot row. Unlike mapPool() this
|
|
150
|
-
* carries no temporal validity: the row is dated by (epoch, snapshotSlot) and stays valid
|
|
151
|
-
* forever, because it states what was true then, not what is cached now.
|
|
152
|
-
* @param providerPoolData pool data from provider
|
|
153
|
-
* @param epoch epoch the snapshot belongs to
|
|
154
|
-
* @param at slot and block time of the block that triggered the snapshot
|
|
155
|
-
* @returns {PoolEpochSnapshotRow} mapped snapshot row
|
|
156
|
-
*/
|
|
44
|
+
/** Pool observation at an epoch boundary to a non-temporal PoolEpochSnapshotRow dated by (epoch, snapshotSlot). */
|
|
157
45
|
export declare function mapPoolSnapshot(providerPoolData: PoolProviderData, epoch: number, at: {
|
|
158
46
|
slot: number;
|
|
159
47
|
time: number;
|
|
160
48
|
}): PoolEpochSnapshotRow;
|
|
161
|
-
/**
|
|
162
|
-
* Map a DRep observation at an epoch boundary into a snapshot row. Non-temporal, same
|
|
163
|
-
* reasoning as mapPoolSnapshot().
|
|
164
|
-
* @param providerDrepData drep data from provider
|
|
165
|
-
* @param epoch epoch the snapshot belongs to
|
|
166
|
-
* @param at slot and block time of the block that triggered the snapshot
|
|
167
|
-
* @returns {DrepEpochSnapshotRow} mapped snapshot row
|
|
168
|
-
*/
|
|
49
|
+
/** DRep observation at an epoch boundary to a non-temporal DrepEpochSnapshotRow. */
|
|
169
50
|
export declare function mapDrepSnapshot(providerDrepData: DrepProviderData, epoch: number, at: {
|
|
170
51
|
slot: number;
|
|
171
52
|
time: number;
|
|
172
53
|
}): DrepEpochSnapshotRow;
|
|
173
|
-
/**
|
|
174
|
-
* Map Pool Data
|
|
175
|
-
* Converts provider pool data into PoolRow format
|
|
176
|
-
* @param providerPoolData pool data from provider
|
|
177
|
-
* @returns {PoolRow} mapped pool row
|
|
178
|
-
*/
|
|
54
|
+
/** Provider pool to a temporal PoolRow valid for `max_age` ms. */
|
|
179
55
|
export declare function mapPool(providerPoolData: PoolProviderData, max_age: number): PoolRow;
|
|
180
|
-
/**
|
|
181
|
-
* Map Asset Info Data
|
|
182
|
-
* Converts provider asset info into AssetRow format. Provider data is already
|
|
183
|
-
* normalized by the backend mapper into the canonical AssetInfo shape, so this
|
|
184
|
-
* function just stamps temporal validity and JSON-stringifies the on-chain metadata.
|
|
185
|
-
* @param providerAssetInfo canonical asset info from backend
|
|
186
|
-
* @param max_age TTL window in ms for the temporal validity
|
|
187
|
-
* @returns {AssetRow} mapped asset row
|
|
188
|
-
*/
|
|
56
|
+
/** Canonical asset info to a temporal AssetRow valid for `max_age` ms; on-chain metadata is JSON-stringified. */
|
|
189
57
|
export declare function mapAsset(providerAssetInfo: AssetInfoProviderData, max_age: number): AssetRow;
|
|
190
58
|
/**
|
|
191
|
-
* Fixed validity stamp for a crawler-written bare `Assets` row
|
|
192
|
-
*
|
|
193
|
-
* collide with a real, wall-clock-stamped slice from mapAsset().
|
|
59
|
+
* Fixed validity stamp for a crawler-written bare `Assets` row: epoch zero, so the row is born expired
|
|
60
|
+
* (hidden by CAP's temporal filter) and its `(validFrom, unit)` key never collides with a mapAsset() slice.
|
|
194
61
|
*/
|
|
195
62
|
export declare const BARE_ASSET_STAMP = "1970-01-01T00:00:00.000Z";
|
|
196
63
|
/**
|
|
197
|
-
*
|
|
198
|
-
*
|
|
199
|
-
*
|
|
200
|
-
*
|
|
201
|
-
*
|
|
202
|
-
* The row is stamped as ALREADY EXPIRED (`validTo === validFrom`). That is deliberate: CAP's
|
|
203
|
-
* temporal filter hides it from OData reads, so the first keyed read still counts as a miss
|
|
204
|
-
* and the existing lazy path enriches it through indexAsset() with supply and registry data —
|
|
205
|
-
* while an analytics consumer reading the database directly already sees the full catalogue
|
|
206
|
-
* (and can exclude the placeholders with `validTo > validFrom`).
|
|
207
|
-
*
|
|
208
|
-
* Both stamps are the FIXED epoch sentinel, not `now`. `Assets` is temporal, so its primary
|
|
209
|
-
* key is `(validFrom, unit)`: a wall-clock stamp would make the same unit a new row on every
|
|
210
|
-
* sighting and could collide with a slice the lazy path writes in the same millisecond, which
|
|
211
|
-
* inside the crawler's block transaction means a failed block. With the sentinel the bare row
|
|
212
|
-
* is one fixed, idempotent row per unit that no `mapAsset()` slice can ever alias.
|
|
213
|
-
*
|
|
214
|
-
* @param unit asset unit (policyId + assetNameHex)
|
|
215
|
-
* @returns {AssetRow | null} bare row, or null when the unit is not a native asset unit
|
|
64
|
+
* Bare AssetRow from the unit alone (policyId, assetNameHex, decoded name, CIP-14 fingerprint), no provider call.
|
|
65
|
+
* Stamped `validTo === validFrom` with the fixed sentinel: hidden from OData reads, so the first keyed read
|
|
66
|
+
* still misses and the lazy path enriches it; one idempotent row per unit inside the crawler's block tx.
|
|
67
|
+
* @returns the row, or null when the unit is not a native asset unit
|
|
216
68
|
*/
|
|
217
69
|
export declare function mapBareAsset(unit: string): AssetRow | null;
|
|
218
|
-
/**
|
|
219
|
-
* Map Asset History entries to row format. No temporal stamping — mint/burn
|
|
220
|
-
* events are immutable; UPSERT keyed on (unit, txHash) is idempotent.
|
|
221
|
-
* @param entries asset history events from backend (already canonical)
|
|
222
|
-
* @returns {AssetHistoryRow[]} mapped rows
|
|
223
|
-
*/
|
|
70
|
+
/** Asset history events to non-temporal AssetHistoryRows (immutable, keyed on unit + txHash). */
|
|
224
71
|
export declare function mapAssetHistory(entries: AssetHistoryEntryProviderData[]): AssetHistoryRow[];
|
|
225
|
-
/**
|
|
226
|
-
* Map Drep Data
|
|
227
|
-
* Converts provider drep data into DrepRow format
|
|
228
|
-
* @param providerDrepData drep data from provider
|
|
229
|
-
* @returns {DrepRow} mapped drep row
|
|
230
|
-
*/
|
|
72
|
+
/** Provider DRep to a temporal DrepRow valid for `max_age` ms. */
|
|
231
73
|
export declare function mapDrep(providerDrepData: DrepProviderData, max_age: number): DrepRow;
|
|
232
|
-
/**
|
|
233
|
-
* Map Account Data
|
|
234
|
-
* Converts provider account data into AccountRow format
|
|
235
|
-
* @param providerAccountData account data from provider
|
|
236
|
-
* @returns {AccountRow} mapped account row
|
|
237
|
-
*/
|
|
74
|
+
/** Provider account to a temporal AccountRow valid for `max_age` ms. */
|
|
238
75
|
export declare function mapAccount(providerAccountData: AccountProviderData, max_age: number): AccountRow;
|
|
239
|
-
/**
|
|
240
|
-
* Map Backend Error
|
|
241
|
-
* Converts BackendError or unknown error into OData request rejection
|
|
242
|
-
* @param req OData request
|
|
243
|
-
* @param err error object (BackendError or unknown)
|
|
244
|
-
* @param ctx context string for error message
|
|
245
|
-
*/
|
|
76
|
+
/** Rejects the OData request for a BackendError; unknown errors are logged and answered as a sanitized 500. */
|
|
246
77
|
export declare function mapError(req: Request, err: unknown, ctx: string): never;
|
|
247
|
-
/**
|
|
248
|
-
* Map Transaction Build Result
|
|
249
|
-
* Converts provider transaction build result into TransactionBuildRow format
|
|
250
|
-
* @param txbuildResult transaction build result from provider
|
|
251
|
-
* @returns {TransactionBuildRow} mapped transaction build row
|
|
252
|
-
*/
|
|
78
|
+
/** Build result to a temporal TransactionBuildRow with a fresh build id. */
|
|
253
79
|
export declare function mapBuildResult(txbuildResult: TransactionBuildResult, max_age: number): TransactionBuildRow;
|
|
254
|
-
/**
|
|
255
|
-
* Map Transaction Build Inputs
|
|
256
|
-
* Converts transaction build result inputs into TransactionBuildInputRow format
|
|
257
|
-
* @param buildId the transaction build ID
|
|
258
|
-
* @param inputs transaction build result inputs
|
|
259
|
-
* @returns {TransactionBuildInputRow[]} mapped transaction build input rows
|
|
260
|
-
*/
|
|
80
|
+
/** Build result inputs to TransactionBuildInputRows. */
|
|
261
81
|
export declare function mapBuildInputs(buildId: string, inputs: Array<{
|
|
262
82
|
txHash: string;
|
|
263
83
|
index: number;
|
|
264
84
|
lovelace: string;
|
|
265
85
|
address?: string;
|
|
266
86
|
}>): TransactionBuildInputRow[];
|
|
267
|
-
/**
|
|
268
|
-
* Map Transaction Build Outputs
|
|
269
|
-
* Converts transaction build result outputs into TransactionBuildOutputRow format
|
|
270
|
-
* @param buildId the transaction build ID
|
|
271
|
-
* @param outputs transaction build result outputs
|
|
272
|
-
* @param changeAddress the change address to identify change outputs
|
|
273
|
-
* @returns {TransactionBuildOutputRow[]} mapped transaction build output rows
|
|
274
|
-
*/
|
|
87
|
+
/** Build result outputs to TransactionBuildOutputRows; `changeAddress` marks the change output. */
|
|
275
88
|
export declare function mapBuildOutputs(buildId: string, outputs: Array<{
|
|
276
89
|
address: string;
|
|
277
90
|
lovelace: string;
|
|
278
91
|
}>, changeAddress?: string): TransactionBuildOutputRow[];
|
|
279
|
-
/**
|
|
280
|
-
* Map Protocol Parameters
|
|
281
|
-
* Converts provider protocol parameters into ProtocolParameterRow format
|
|
282
|
-
* @param providerParams protocol parameters from provider
|
|
283
|
-
* @returns {ProtocolParameterRow} mapped protocol parameter row
|
|
284
|
-
*/
|
|
92
|
+
/** Provider protocol parameters to ProtocolParameterRow. */
|
|
285
93
|
export declare function mapProtocolParameters(providerParams: ProtocolParameters): ProtocolParameterRow;
|
|
286
|
-
/**
|
|
287
|
-
* Map Transaction Submission
|
|
288
|
-
* Converts signed transaction CBOR and hash into TransactionSubmissionRow format
|
|
289
|
-
* @param signedTxCbor signed transaction in CBOR hex format
|
|
290
|
-
* @param txHash transaction hash
|
|
291
|
-
* @returns {TransactionSubmissionRow} mapped transaction submission row
|
|
292
|
-
*/
|
|
94
|
+
/** Signed tx CBOR and hash to a TransactionSubmissionRow stamped now (epoch seconds). */
|
|
293
95
|
export declare function mapTransactionSubmission(signedTxCbor: string, txHash: string): TransactionSubmissionRow;
|
|
294
|
-
/**
|
|
295
|
-
* Map Address Signing Requests
|
|
296
|
-
* Creates AddressSigningRequest row for address-signing request association
|
|
297
|
-
* @param addr bech32 address
|
|
298
|
-
* @param signingRequestId signing request UUID
|
|
299
|
-
* @returns {AddressSigningRequestRow} mapped address signing request row
|
|
300
|
-
*/
|
|
96
|
+
/** Address to signing-request association row. */
|
|
301
97
|
export declare function mapAddressSigningRequest(addr: string, signingRequestId: string): AddressSigningRequestRow;
|
|
302
|
-
/**
|
|
303
|
-
* Map Address Transaction Builds
|
|
304
|
-
* Creates AddressTransactionBuild row for address-build association
|
|
305
|
-
* @param addr bech32 address
|
|
306
|
-
* @param buildId transaction build UUID
|
|
307
|
-
* @returns {AddressTransactionBuildRow} mapped address transaction build row
|
|
308
|
-
*/
|
|
98
|
+
/** Address to transaction-build association row. */
|
|
309
99
|
export declare function mapAddressTransactionBuild(addr: string, buildId: string): AddressTransactionBuildRow;
|
|
310
100
|
/**
|
|
311
|
-
*
|
|
312
|
-
*
|
|
313
|
-
* Blockfrost's cost_models (named keys) has known key-value mapping bugs for
|
|
314
|
-
* PlutusV3 (shifted values in the quotientInteger/remainderInteger region).
|
|
315
|
-
* The Blockfrost backend now prefers cost_models_raw (canonical arrays from the
|
|
316
|
-
* node) which bypasses this issue entirely.
|
|
317
|
-
*
|
|
318
|
-
* For V3 arrays: already in canonical order, just pad to 297 via toCostModelArrV3.
|
|
319
|
-
* For V3 objects (Ogmios named format): toCostModelArrV3(obj) maps via canonical keys.
|
|
320
|
-
* For V1/V2: alphabetical order IS the canonical order (no reordering needed).
|
|
321
|
-
*
|
|
322
|
-
* @param raw - Raw cost models from any backend (Blockfrost, Ogmios, Koios)
|
|
323
|
-
* @returns Object with all cost model values as number arrays in canonical order
|
|
101
|
+
* Cost models to number arrays in canonical Plutus parameter order. V3 goes through toCostModelArrV3
|
|
102
|
+
* (canonical keys, padded to 297); for V1/V2 alphabetical key order is the canonical order.
|
|
324
103
|
*/
|
|
325
104
|
export declare function normalizeCostModels(raw: Record<string, unknown>): Record<string, number[]>;
|
|
326
105
|
/**
|
|
327
|
-
*
|
|
328
|
-
*
|
|
329
|
-
* Asset names are arbitrary bytes. When they are not valid UTF-8, or when they
|
|
330
|
-
* contain U+0000, the hex form is returned unchanged: PostgreSQL rejects NUL in
|
|
331
|
-
* `text` and in the JSON documents @cap-js/postgres uses for bulk INSERT/UPSERT
|
|
332
|
-
* ("unsupported Unicode escape sequence"), which halted the crawler on preprod
|
|
333
|
-
* block 4281919 (asset name ending in 0x00). SQLite accepted the same bytes
|
|
334
|
-
* silently. `assetNameHex` always keeps the exact bytes, so nothing is lost.
|
|
335
|
-
*
|
|
336
|
-
* @param hex - asset name as hex string
|
|
337
|
-
* @returns UTF-8 text, or the hex string when the bytes are not clean text
|
|
106
|
+
* Asset name (hex bytes) to its display string; the hex is returned unchanged for invalid UTF-8 or
|
|
107
|
+
* names containing U+0000 (PostgreSQL rejects NUL in `text`). `assetNameHex` always keeps the exact bytes.
|
|
338
108
|
*/
|
|
339
109
|
export declare function decodeAssetName(hex: string): string;
|
|
340
|
-
/**
|
|
341
|
-
* Compute CIP-14 asset fingerprint from policyId and assetName.
|
|
342
|
-
* Algorithm: bech32_encode("asset", blake2b_160(policyId_bytes + assetName_bytes))
|
|
343
|
-
* @param policyIdHex - Policy ID as hex string (56 chars / 28 bytes)
|
|
344
|
-
* @param assetNameHex - Asset name as hex string (variable length)
|
|
345
|
-
* @returns CIP-14 fingerprint string (e.g. "asset1...")
|
|
346
|
-
*/
|
|
110
|
+
/** CIP-14 fingerprint: bech32("asset", blake2b_160(policyId_bytes + assetName_bytes)). */
|
|
347
111
|
export declare function computeCip14Fingerprint(policyIdHex: string, assetNameHex: string): string;
|
|
348
|
-
/**
|
|
349
|
-
* Derive an enterprise script address from a script hash and network.
|
|
350
|
-
* Enterprise address = header_byte + 28-byte script hash, bech32-encoded.
|
|
351
|
-
* Header: 0x71 (mainnet, type 7 network 1) or 0x70 (testnet, type 7 network 0).
|
|
352
|
-
*/
|
|
112
|
+
/** Enterprise script address: header 0x71 (mainnet) / 0x70 (testnet) + 28-byte script hash, bech32. */
|
|
353
113
|
export declare function scriptHashToEnterpriseAddress(scriptHashHex: string, network: 'mainnet' | 'preprod' | 'preview'): string;
|
|
354
|
-
/**
|
|
355
|
-
* Encode a stake credential as a bech32 reward account (stake address).
|
|
356
|
-
* Header: type nibble 0xe (key) / 0xf (script), network nibble 1 (mainnet) / 0 (testnets).
|
|
357
|
-
*/
|
|
114
|
+
/** Stake credential to bech32 reward account; header nibbles 0xe key / 0xf script, network 1 mainnet / 0 testnets. */
|
|
358
115
|
export declare function credentialToStakeAddress(credentialHex: string, isScript: boolean, network: 'mainnet' | 'preprod' | 'preview'): string;
|
|
359
116
|
export interface DecodedAddress {
|
|
360
117
|
type: 'base' | 'pointer' | 'enterprise' | 'reward' | 'byron' | 'unknown';
|
|
@@ -366,15 +123,10 @@ export interface DecodedAddress {
|
|
|
366
123
|
networkId: number | null;
|
|
367
124
|
}
|
|
368
125
|
/**
|
|
369
|
-
* Decode the
|
|
370
|
-
*
|
|
371
|
-
* Byron (base58) and anything unparseable come back as `byron` / `unknown` with no stake.
|
|
126
|
+
* Decode the CIP-19 Shelley address header: type, script flag and, for base addresses, the embedded
|
|
127
|
+
* stake credential as a reward account. Byron (base58) and unparseable input yield `byron` / `unknown`.
|
|
372
128
|
*/
|
|
373
129
|
export declare function decodeShelleyAddress(address: string): DecodedAddress;
|
|
374
|
-
/**
|
|
375
|
-
* Encode a DRep credential as a CIP-129 DRep ID (`drep1…`, 29 bytes).
|
|
376
|
-
* Header byte: high nibble 0x2 = DRep, low nibble 0x2 = key hash / 0x3 = script hash —
|
|
377
|
-
* the inverse of `decodeDrepId` in the Ogmios backend.
|
|
378
|
-
*/
|
|
130
|
+
/** DRep credential to CIP-129 DRep ID (29 bytes): header 0x22 key hash / 0x23 script hash. */
|
|
379
131
|
export declare function credentialToDrepId(credentialHex: string, isScript: boolean): string;
|
|
380
132
|
//# sourceMappingURL=mappers.d.ts.map
|