@odatano/core 2.0.0-rc.5 → 2.0.0-rc.51
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 +99 -51
- package/@cds-models/CardanoAgentService/index.js +15 -0
- package/@cds-models/CardanoBackendService/index.d.ts +358 -0
- package/@cds-models/CardanoBackendService/index.js +41 -0
- package/@cds-models/CardanoIndexerService/index.d.ts +594 -11
- package/@cds-models/CardanoIndexerService/index.js +74 -0
- package/@cds-models/CardanoODataService/index.d.ts +417 -57
- package/@cds-models/CardanoODataService/index.js +42 -0
- package/@cds-models/CardanoSignService/index.d.ts +45 -19
- package/@cds-models/CardanoSignService/index.js +4 -0
- package/@cds-models/CardanoTransactionService/index.d.ts +70 -44
- package/@cds-models/CardanoTransactionService/index.js +5 -0
- package/@cds-models/CardanoWorkerService/index.d.ts +35 -22
- package/@cds-models/CardanoWorkerService/index.js +2 -0
- package/@cds-models/index.d.ts +114 -4
- package/@cds-models/index.js +20 -4
- package/@cds-models/odatano/cardano/index.d.ts +451 -32
- package/@cds-models/odatano/cardano/index.js +48 -0
- package/README.md +103 -167
- package/db/schema.cds +2455 -1705
- package/db/types.cds +456 -295
- package/package.json +41 -53
- package/scripts/deploy-schema.mjs +113 -0
- package/scripts/migrate-schema.mjs +528 -0
- package/scripts/migrate-slot-leader.mjs +96 -0
- package/src/index.d.ts +20 -21
- package/src/index.js +45 -31
- package/src/plugin.js +17 -35
- package/srv/blockchain/asset-decimals.d.ts +7 -0
- package/srv/blockchain/asset-decimals.js +91 -0
- package/srv/blockchain/backends/blockfrost-backend.d.ts +25 -137
- package/srv/blockchain/backends/blockfrost-backend.js +125 -215
- package/srv/blockchain/backends/call-signal.d.ts +7 -0
- package/srv/blockchain/backends/call-signal.js +22 -0
- package/srv/blockchain/backends/cardano-backend.d.ts +100 -189
- package/srv/blockchain/backends/cardano-backend.js +29 -5
- package/srv/blockchain/backends/koios-backend.d.ts +108 -170
- package/srv/blockchain/backends/koios-backend.js +488 -482
- package/srv/blockchain/backends/odatano-backend.d.ts +55 -0
- package/srv/blockchain/backends/odatano-backend.js +211 -0
- package/srv/blockchain/backends/ogmios-backend.d.ts +122 -190
- package/srv/blockchain/backends/ogmios-backend.js +683 -327
- package/srv/blockchain/backends/ogmios-frame-guard.d.ts +14 -0
- package/srv/blockchain/backends/ogmios-frame-guard.js +89 -0
- package/srv/blockchain/cardano-client.d.ts +71 -241
- package/srv/blockchain/cardano-client.js +354 -322
- package/srv/blockchain/cardano-indexer.d.ts +295 -283
- package/srv/blockchain/cardano-indexer.js +1690 -502
- package/srv/blockchain/cardano-tx-builder.d.ts +25 -89
- package/srv/blockchain/cardano-tx-builder.js +164 -140
- package/srv/blockchain/circuit-breaker.d.ts +2 -13
- package/srv/blockchain/circuit-breaker.js +11 -15
- package/srv/blockchain/crawler/account-snapshots.d.ts +29 -0
- package/srv/blockchain/crawler/account-snapshots.js +173 -0
- package/srv/blockchain/crawler/asset-decimals-backfill.d.ts +17 -0
- package/srv/blockchain/crawler/asset-decimals-backfill.js +56 -0
- package/srv/blockchain/crawler/asset-registry-backfill.d.ts +46 -0
- package/srv/blockchain/crawler/asset-registry-backfill.js +157 -0
- package/srv/blockchain/crawler/asset-slice-backfill.d.ts +35 -0
- package/srv/blockchain/crawler/asset-slice-backfill.js +149 -0
- package/srv/blockchain/crawler/certificate-backfill.d.ts +56 -0
- package/srv/blockchain/crawler/certificate-backfill.js +174 -0
- package/srv/blockchain/crawler/crawler.d.ts +125 -81
- package/srv/blockchain/crawler/crawler.js +738 -167
- package/srv/blockchain/crawler/credential-backfill.d.ts +30 -0
- package/srv/blockchain/crawler/credential-backfill.js +101 -0
- package/srv/blockchain/crawler/hooks.d.ts +2 -17
- package/srv/blockchain/crawler/index.d.ts +1 -8
- package/srv/blockchain/crawler/index.js +31 -17
- package/srv/blockchain/crawler/input-asset-copies.d.ts +34 -0
- package/srv/blockchain/crawler/input-asset-copies.js +161 -0
- package/srv/blockchain/crawler/key-pages.d.ts +12 -0
- package/srv/blockchain/crawler/key-pages.js +48 -0
- package/srv/blockchain/crawler/metadata-position-backfill.d.ts +22 -0
- package/srv/blockchain/crawler/metadata-position-backfill.js +59 -0
- package/srv/blockchain/crawler/output-datum-backfill.d.ts +41 -0
- package/srv/blockchain/crawler/output-datum-backfill.js +100 -0
- package/srv/blockchain/crawler/sync-state.d.ts +31 -47
- package/srv/blockchain/crawler/sync-state.js +135 -128
- package/srv/blockchain/crawler/transaction-backfill.d.ts +46 -0
- package/srv/blockchain/crawler/transaction-backfill.js +271 -0
- package/srv/blockchain/crawler/utxo-set-import.d.ts +66 -0
- package/srv/blockchain/crawler/utxo-set-import.js +399 -0
- package/srv/blockchain/crawler/window-plan.d.ts +31 -0
- package/srv/blockchain/crawler/window-plan.js +59 -0
- package/srv/blockchain/ledger-state.d.ts +62 -0
- package/srv/blockchain/ledger-state.js +521 -0
- package/srv/blockchain/pending-spends.d.ts +16 -0
- package/srv/blockchain/pending-spends.js +81 -0
- package/srv/blockchain/pool-metadata.d.ts +15 -0
- package/srv/blockchain/pool-metadata.js +132 -0
- package/srv/blockchain/request-coalescer.d.ts +2 -16
- package/srv/blockchain/request-coalescer.js +2 -16
- package/srv/blockchain/signing/cose-verifier.d.ts +3 -17
- package/srv/blockchain/signing/cose-verifier.js +146 -70
- package/srv/blockchain/signing/external-signer.d.ts +15 -115
- package/srv/blockchain/signing/external-signer.js +22 -131
- package/srv/blockchain/signing/failed-recheck.d.ts +17 -0
- package/srv/blockchain/signing/failed-recheck.js +135 -0
- package/srv/blockchain/signing/hsm-signer.d.ts +10 -54
- package/srv/blockchain/signing/hsm-signer.js +28 -79
- package/srv/blockchain/signing/landing-proof.d.ts +60 -0
- package/srv/blockchain/signing/landing-proof.js +224 -0
- package/srv/blockchain/signing/signature-verifier.d.ts +9 -47
- package/srv/blockchain/signing/signature-verifier.js +71 -87
- package/srv/blockchain/signing/submission-finalizer.d.ts +37 -45
- package/srv/blockchain/signing/submission-finalizer.js +280 -86
- package/srv/blockchain/stored-chain.d.ts +19 -0
- package/srv/blockchain/stored-chain.js +258 -0
- package/srv/blockchain/transaction-building/buildooor-tx.d.ts +31 -229
- package/srv/blockchain/transaction-building/buildooor-tx.js +663 -421
- package/srv/blockchain/transaction-building/cardano-tx.d.ts +9 -37
- package/srv/blockchain/transaction-presence.d.ts +12 -0
- package/srv/blockchain/transaction-presence.js +29 -0
- package/srv/blockchain/transaction-rows.d.ts +12 -0
- package/srv/blockchain/transaction-rows.js +44 -0
- package/srv/blockchain/wallet-worker/build-request.d.ts +8 -23
- package/srv/blockchain/wallet-worker/build-request.js +40 -353
- package/srv/blockchain/wallet-worker/confirmation-tracker.d.ts +27 -47
- package/srv/blockchain/wallet-worker/confirmation-tracker.js +158 -61
- package/srv/blockchain/wallet-worker/index.d.ts +1 -1
- package/srv/blockchain/wallet-worker/index.js +3 -11
- package/srv/blockchain/wallet-worker/invalidation.d.ts +35 -0
- package/srv/blockchain/wallet-worker/invalidation.js +128 -0
- package/srv/blockchain/wallet-worker/job-store.d.ts +58 -150
- package/srv/blockchain/wallet-worker/job-store.js +200 -273
- package/srv/blockchain/wallet-worker/lease-heartbeat.d.ts +2 -26
- package/srv/blockchain/wallet-worker/lease-heartbeat.js +6 -28
- package/srv/blockchain/wallet-worker/signers.d.ts +5 -24
- package/srv/blockchain/wallet-worker/signers.js +4 -12
- package/srv/blockchain/wallet-worker/wallet-worker.d.ts +29 -82
- package/srv/blockchain/wallet-worker/wallet-worker.js +334 -198
- package/srv/cardano-agent-service.cds +122 -84
- package/srv/cardano-agent-service.js +12 -9
- package/srv/cardano-backend-service.cds +81 -0
- package/srv/cardano-backend-service.d.ts +2 -0
- package/srv/cardano-backend-service.js +259 -0
- package/srv/cardano-indexer-service.cds +393 -18
- package/srv/cardano-indexer-service.d.ts +5 -1
- package/srv/cardano-indexer-service.js +477 -16
- package/srv/cardano-service.cds +426 -269
- package/srv/cardano-service.js +640 -217
- package/srv/cardano-sign-service.cds +211 -180
- package/srv/cardano-sign-service.js +210 -287
- package/srv/cardano-tx-service.cds +462 -370
- package/srv/cardano-tx-service.js +283 -800
- package/srv/cardano-ui.cds +16 -16
- package/srv/cardano-worker-service.cds +141 -125
- package/srv/cardano-worker-service.js +104 -61
- package/srv/cbor/cip68.d.ts +13 -0
- package/srv/cbor/cip68.js +56 -0
- package/srv/cbor/index.d.ts +3 -1
- package/srv/cbor/index.js +9 -1
- package/srv/cbor/parse.d.ts +30 -18
- package/srv/cbor/parse.js +44 -9
- package/srv/cbor/plutus-data-json.d.ts +20 -0
- package/srv/cbor/plutus-data-json.js +32 -0
- package/srv/config.d.ts +117 -0
- package/srv/config.js +419 -0
- package/srv/server.d.ts +15 -110
- package/srv/server.js +83 -405
- package/srv/utils/agent-access.d.ts +11 -0
- package/srv/utils/agent-access.js +86 -0
- package/srv/utils/agent-grants-config.d.ts +0 -46
- package/srv/utils/agent-grants-config.js +17 -85
- package/srv/utils/agent-grants.d.ts +106 -122
- package/srv/utils/agent-grants.js +538 -237
- package/srv/utils/agent-token-auth.d.ts +4 -99
- package/srv/utils/agent-token-auth.js +62 -186
- package/srv/utils/backend-request-handler.d.ts +3 -17
- package/srv/utils/backend-request-handler.js +3 -18
- package/srv/utils/build-request.d.ts +52 -0
- package/srv/utils/build-request.js +487 -0
- package/srv/utils/collections.d.ts +4 -10
- package/srv/utils/collections.js +14 -10
- package/srv/utils/const.d.ts +32 -75
- package/srv/utils/const.js +40 -80
- package/srv/utils/crypto.d.ts +3 -12
- package/srv/utils/crypto.js +11 -25
- package/srv/utils/db-indexes.d.ts +31 -0
- package/srv/utils/db-indexes.js +185 -0
- package/srv/utils/db-kind.d.ts +23 -0
- package/srv/utils/db-kind.js +42 -0
- package/srv/utils/db-sanitize.d.ts +20 -0
- package/srv/utils/db-sanitize.js +80 -0
- package/srv/utils/deep-json.d.ts +6 -0
- package/srv/utils/deep-json.js +240 -0
- package/srv/utils/detached-run.d.ts +41 -0
- package/srv/utils/detached-run.js +101 -0
- package/srv/utils/epoch-slots.d.ts +14 -0
- package/srv/utils/epoch-slots.js +45 -0
- package/srv/utils/error-codes.d.ts +26 -75
- package/srv/utils/error-codes.js +27 -72
- package/srv/utils/errors.d.ts +55 -187
- package/srv/utils/errors.js +161 -235
- package/srv/utils/lease.d.ts +20 -0
- package/srv/utils/lease.js +62 -0
- package/srv/utils/liveness.d.ts +12 -0
- package/srv/utils/liveness.js +35 -0
- package/srv/utils/mappers.d.ts +111 -223
- package/srv/utils/mappers.js +432 -371
- package/srv/utils/navigation.d.ts +17 -0
- package/srv/utils/navigation.js +52 -0
- package/srv/utils/network-context.d.ts +0 -1
- package/srv/utils/network-context.js +9 -15
- package/srv/utils/paging.d.ts +31 -0
- package/srv/utils/paging.js +43 -0
- package/srv/utils/pg-inline-json.d.ts +8 -0
- package/srv/utils/pg-inline-json.js +58 -0
- package/srv/utils/pg-order-nulls.d.ts +14 -0
- package/srv/utils/pg-order-nulls.js +54 -0
- package/srv/utils/plutus-placeholders.d.ts +16 -22
- package/srv/utils/plutus-placeholders.js +62 -33
- package/srv/utils/rate-limiter.d.ts +2 -21
- package/srv/utils/rate-limiter.js +5 -17
- package/srv/utils/readiness.d.ts +12 -0
- package/srv/utils/readiness.js +29 -0
- package/srv/utils/reference-script.d.ts +19 -0
- package/srv/utils/reference-script.js +84 -0
- package/srv/utils/resolution.d.ts +13 -0
- package/srv/utils/resolution.js +47 -0
- package/srv/utils/result-numbers.d.ts +15 -0
- package/srv/utils/result-numbers.js +61 -0
- package/srv/utils/row-values.d.ts +7 -0
- package/srv/utils/row-values.js +27 -0
- package/srv/utils/service-events.d.ts +0 -24
- package/srv/utils/service-events.js +3 -25
- package/srv/utils/signing-helper.d.ts +3 -20
- package/srv/utils/signing-helper.js +35 -64
- package/srv/utils/tx-build-helper.d.ts +25 -105
- package/srv/utils/tx-build-helper.js +108 -156
- package/srv/utils/tx-request-parsers.d.ts +82 -33
- package/srv/utils/tx-request-parsers.js +401 -49
- package/srv/utils/tx-utils.d.ts +3 -27
- package/srv/utils/tx-utils.js +32 -50
- package/srv/utils/types.d.ts +294 -232
- package/srv/utils/types.js +2 -22
- package/srv/utils/validators.d.ts +22 -92
- package/srv/utils/validators.js +60 -170
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.tryAcquireLease = tryAcquireLease;
|
|
7
|
+
exports.renewLease = renewLease;
|
|
8
|
+
exports.releaseLease = releaseLease;
|
|
9
|
+
const cds_1 = __importDefault(require("@sap/cds"));
|
|
10
|
+
const row_values_1 = require("./row-values");
|
|
11
|
+
const { SELECT, UPDATE } = cds_1.default.ql;
|
|
12
|
+
async function readLease(db, lease) {
|
|
13
|
+
const row = await db.run(SELECT.one.from(lease.entity).where(lease.key));
|
|
14
|
+
if (!row)
|
|
15
|
+
return null;
|
|
16
|
+
return { leaseOwner: row.leaseOwner ?? null, leaseUntil: (0, row_values_1.timestamp)(row.leaseUntil), row };
|
|
17
|
+
}
|
|
18
|
+
// True when `owner` holds the lease until at least `expectedMs`. One second of tolerance covers
|
|
19
|
+
// adapters that store the timestamp with less precision.
|
|
20
|
+
function heldUntil(stored, lease, owner, expectedMs) {
|
|
21
|
+
if (!stored || stored.leaseOwner !== owner || !stored.leaseUntil)
|
|
22
|
+
return false;
|
|
23
|
+
if (lease.holds && !lease.holds(stored.row))
|
|
24
|
+
return false;
|
|
25
|
+
const actualMs = Date.parse(stored.leaseUntil);
|
|
26
|
+
return Number.isFinite(actualMs) && actualMs >= expectedMs - 1_000;
|
|
27
|
+
}
|
|
28
|
+
// Takes a free or expired lease, or renews the caller's own. A foreign lease is taken only when the
|
|
29
|
+
// UPDATE itself still sees it expired, so a renewal that commits first wins. `admit` can refuse the row.
|
|
30
|
+
async function tryAcquireLease(db, lease, owner, timing, admit) {
|
|
31
|
+
const now = timing.now ?? new Date();
|
|
32
|
+
const stored = await readLease(db, lease);
|
|
33
|
+
if (!stored)
|
|
34
|
+
return false;
|
|
35
|
+
if ((lease.holds && !lease.holds(stored.row)) || (admit && !admit(stored.row)))
|
|
36
|
+
return false;
|
|
37
|
+
const deadline = stored.leaseUntil ? Date.parse(stored.leaseUntil) : Number.NEGATIVE_INFINITY;
|
|
38
|
+
const foreign = stored.leaseOwner != null && stored.leaseOwner !== owner;
|
|
39
|
+
if (foreign && deadline > now.getTime())
|
|
40
|
+
return false;
|
|
41
|
+
const where = { ...lease.key, ...lease.requires, leaseOwner: stored.leaseOwner };
|
|
42
|
+
if (foreign)
|
|
43
|
+
where.leaseUntil = stored.leaseUntil == null ? null : { '<': now.toISOString() };
|
|
44
|
+
const until = now.getTime() + timing.ttlMs;
|
|
45
|
+
await db.run(UPDATE.entity(lease.entity).set({ leaseOwner: owner, leaseUntil: new Date(until).toISOString() }).where(where));
|
|
46
|
+
return heldUntil(await readLease(db, lease), lease, owner, until);
|
|
47
|
+
}
|
|
48
|
+
/** Extends the caller's lease, with `set` written in the same statement. False when it is lost. */
|
|
49
|
+
async function renewLease(db, lease, owner, timing, set = {}) {
|
|
50
|
+
const until = (timing.now ?? new Date()).getTime() + timing.ttlMs;
|
|
51
|
+
await db.run(UPDATE.entity(lease.entity)
|
|
52
|
+
.set({ ...set, leaseUntil: new Date(until).toISOString() })
|
|
53
|
+
.where({ ...lease.key, ...lease.requires, leaseOwner: owner }));
|
|
54
|
+
return heldUntil(await readLease(db, lease), lease, owner, until);
|
|
55
|
+
}
|
|
56
|
+
/** Gives up only the caller's lease, so a former owner never clears its successor. */
|
|
57
|
+
async function releaseLease(db, lease, owner, set = {}) {
|
|
58
|
+
await db.run(UPDATE.entity(lease.entity)
|
|
59
|
+
.set({ ...set, leaseOwner: null, leaseUntil: null })
|
|
60
|
+
.where({ ...lease.key, leaseOwner: owner }));
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=lease.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface Liveness {
|
|
2
|
+
status: 'alive';
|
|
3
|
+
timestamp: string;
|
|
4
|
+
/** Seconds since the process started. */
|
|
5
|
+
uptime: number;
|
|
6
|
+
/** @odatano/core version; '' when package.json is not where the in-place build puts it. */
|
|
7
|
+
version: string;
|
|
8
|
+
/** Configured network (cds.requires.odatano-core.network, NETWORK, default preview). */
|
|
9
|
+
network: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function buildLiveness(now?: Date): Liveness;
|
|
12
|
+
//# sourceMappingURL=liveness.d.ts.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Liveness body for getLiveness(). It reports process facts only and never touches
|
|
3
|
+
// backends or the DB, so it answers while those start or fail.
|
|
4
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
5
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
6
|
+
};
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.buildLiveness = buildLiveness;
|
|
9
|
+
const path_1 = __importDefault(require("path"));
|
|
10
|
+
const config_1 = require("../config");
|
|
11
|
+
const processStartedAt = Date.now();
|
|
12
|
+
let cachedVersion = null;
|
|
13
|
+
function packageVersion() {
|
|
14
|
+
if (cachedVersion !== null)
|
|
15
|
+
return cachedVersion;
|
|
16
|
+
try {
|
|
17
|
+
// srv/utils → package root; the in-place build keeps this path in plugin mode too.
|
|
18
|
+
const pkg = require(path_1.default.resolve(__dirname, '..', '..', 'package.json'));
|
|
19
|
+
cachedVersion = String(pkg.version ?? '');
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
cachedVersion = '';
|
|
23
|
+
}
|
|
24
|
+
return cachedVersion;
|
|
25
|
+
}
|
|
26
|
+
function buildLiveness(now = new Date()) {
|
|
27
|
+
return {
|
|
28
|
+
status: 'alive',
|
|
29
|
+
timestamp: now.toISOString(),
|
|
30
|
+
uptime: Math.max(0, Math.floor((now.getTime() - processStartedAt) / 1000)),
|
|
31
|
+
version: packageVersion(),
|
|
32
|
+
network: (0, config_1.configuredNetworkName)(),
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=liveness.js.map
|
package/srv/utils/mappers.d.ts
CHANGED
|
@@ -1,260 +1,148 @@
|
|
|
1
|
-
import { Transaction as TransactionProviderData, Address as AddressProviderData, UTxO as UtxosProviderData, TxInputLine as TxInputProviderData, TxOutputLine as TxOutputProviderData, Amount as AmountProviderData, NetworkInformation as NetworkInfoProviderData, BlockData as BlockProviderData, EpochData as EpochProviderData, MetadataLabelTx as MetadataLabelTxProviderData, PoolData as PoolProviderData, DrepData as DrepProviderData, AccountData as AccountProviderData, AssetInfo as AssetInfoProviderData, AssetHistoryEntry as AssetHistoryEntryProviderData, TxBuildResult as TransactionBuildResult, LedgerProtocolParameters as ProtocolParameters } from './types';
|
|
2
|
-
import { Address as AddressRow, AddressAsset as AddressAssetRow, AddressUTxO as AddressUTxORow, UTxOAsset as UTxOAssetRow, Transaction as TransactionRow, TransactionInput as TransactionInputRow,
|
|
1
|
+
import { Transaction as TransactionProviderData, Address as AddressProviderData, UTxO as UtxosProviderData, TxInputLine as TxInputProviderData, TxOutputLine as TxOutputProviderData, TxCertificate as TxCertificateProviderData, TxWithdrawal as TxWithdrawalProviderData, TxRedeemer as TxRedeemerProviderData, TxDatum as TxDatumProviderData, Amount as AmountProviderData, NetworkInformation as NetworkInfoProviderData, BlockData as BlockProviderData, EpochData as EpochProviderData, MetadataLabelTx as MetadataLabelTxProviderData, PoolData as PoolProviderData, DrepData as DrepProviderData, AccountData as AccountProviderData, AssetInfo as AssetInfoProviderData, AssetHistoryEntry as AssetHistoryEntryProviderData, TxBuildResult as TransactionBuildResult, LedgerProtocolParameters as ProtocolParameters } from './types';
|
|
2
|
+
import { Address as AddressRow, AddressAsset as AddressAssetRow, AddressUTxO as AddressUTxORow, UTxOAsset as UTxOAssetRow, Transaction as TransactionRow, TransactionInput as TransactionInputRow, TransactionOutput as TransactionOutputRow, TransactionOutputAsset as TransactionOutputAssetRow, TransactionCertificate as TransactionCertificateRow, TransactionWithdrawal as TransactionWithdrawalRow, TransactionRedeemer as TransactionRedeemerRow, TransactionDatum as TransactionDatumRow, NetworkInformation as NetworkInfoRow, TransactionMetadata as TransactionMetadataRow, Block as BlockRow, Epoch as EpochRow, Pool as PoolRow, Drep as DrepRow, PoolEpochSnapshot as PoolEpochSnapshotRow, DrepEpochSnapshot as DrepEpochSnapshotRow, Asset as AssetRow, AssetHistory as AssetHistoryRow, Account as AccountRow, LedgerProtocolParameter as ProtocolParameterRow, AddressTransaction as AddressTransactionRow } from '#cds-models/CardanoODataService';
|
|
3
|
+
import type { TransactionInputAssetCopy as TransactionInputAssetRow } from '#cds-models/odatano/cardano';
|
|
3
4
|
import type { TransactionBuild as TransactionBuildRow, TransactionBuildInput as TransactionBuildInputRow, TransactionBuildOutput as TransactionBuildOutputRow, TransactionSubmission as TransactionSubmissionRow, AddressTransactionBuild as AddressTransactionBuildRow } from '#cds-models/CardanoTransactionService';
|
|
4
5
|
import type { AddressSigningRequest as AddressSigningRequestRow } from '#cds-models/CardanoSignService';
|
|
5
6
|
import type { Request } from '@sap/cds';
|
|
6
|
-
/**
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Map Transaction Data
|
|
11
|
-
* Converts provider transaction data into TransactionRow format
|
|
12
|
-
* @param providerTx
|
|
13
|
-
* @returns {TransactionRow} mapped transaction row
|
|
14
|
-
*/
|
|
7
|
+
/** Key of a transaction's input/output rows: chain position, ascending, below 2^53 for any real slot. */
|
|
8
|
+
export declare const TX_SEQ_SLOT_FACTOR = 65536;
|
|
9
|
+
export declare function txSeqOf(slot: number, txIndex: number): number;
|
|
10
|
+
/** Provider transaction to TransactionRow. */
|
|
15
11
|
export declare function mapTransaction(providerTx: TransactionProviderData): TransactionRow;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
*/
|
|
23
|
-
export declare function
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
export declare function
|
|
32
|
-
/**
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
*/
|
|
39
|
-
export declare function
|
|
40
|
-
/**
|
|
41
|
-
* Map Transaction Output Assets
|
|
42
|
-
* Converts provider transaction output asset data into TransactionOutputAssetRow format
|
|
43
|
-
* @param txHash transaction hash
|
|
44
|
-
* @param outputs transaction outputs from provider
|
|
45
|
-
* @returns {TransactionOutputAssetRow[]} mapped transaction output asset rows
|
|
46
|
-
*/
|
|
47
|
-
export declare function mapTransactionOutputAssets(txHash: string, outputs: TxOutputProviderData[]): TransactionOutputAssetRow[];
|
|
48
|
-
/**
|
|
49
|
-
* Map Address Data
|
|
50
|
-
* Converts provider address data into AddressRow format
|
|
51
|
-
* @param address address string
|
|
52
|
-
* @param addressData address data from provider
|
|
53
|
-
* @returns {AddressRow} mapped address row
|
|
54
|
-
*/
|
|
12
|
+
export declare function mapTransactionInputs(txSeq: number, txInputs: TxInputProviderData[], byReference?: boolean): TransactionInputRow[];
|
|
13
|
+
export declare function mapTransactionInputAssets(txSeq: number, inputs: TxInputProviderData[], byReference?: boolean): TransactionInputAssetRow[];
|
|
14
|
+
/** Normalized certificates to TransactionCertificateRows, one per (certIndex, kind). */
|
|
15
|
+
export declare function mapTransactionCertificates(txHash: string, certificates: TxCertificateProviderData[]): TransactionCertificateRow[];
|
|
16
|
+
/** Normalized withdrawals to TransactionWithdrawalRows, one per reward account. */
|
|
17
|
+
export declare function mapTransactionWithdrawals(txHash: string, withdrawals: TxWithdrawalProviderData[]): TransactionWithdrawalRow[];
|
|
18
|
+
/** Ledger order of output references: transaction hash bytewise, then output index. */
|
|
19
|
+
export declare function compareOutRef(a: {
|
|
20
|
+
txHash: string;
|
|
21
|
+
outputIndex: number;
|
|
22
|
+
}, b: {
|
|
23
|
+
txHash: string;
|
|
24
|
+
outputIndex: number;
|
|
25
|
+
}): number;
|
|
26
|
+
export declare function ledgerInputOrder(inputs: TxInputProviderData[]): TxInputProviderData[];
|
|
27
|
+
export declare function ledgerView<T extends TransactionProviderData>(tx: T): T;
|
|
28
|
+
/** Normalized redeemers to TransactionRedeemerRows, keyed (tx, purpose, index). */
|
|
29
|
+
export declare function mapTransactionRedeemers(txHash: string, redeemers: TxRedeemerProviderData[]): TransactionRedeemerRow[];
|
|
30
|
+
/** Witness-set datums to TransactionDatumRows, keyed (tx, dataHash). */
|
|
31
|
+
export declare function mapTransactionDatums(txHash: string, datums: TxDatumProviderData[]): TransactionDatumRow[];
|
|
32
|
+
/** Provider transaction outputs to TransactionOutputRows. */
|
|
33
|
+
export declare function mapTransactionOutputs(txSeq: number, txOutputs: TxOutputProviderData[]): TransactionOutputRow[];
|
|
34
|
+
/** Provider transaction output assets to TransactionOutputAssetRows. */
|
|
35
|
+
export declare function mapTransactionOutputAssets(txSeq: number, outputs: TxOutputProviderData[]): TransactionOutputAssetRow[];
|
|
36
|
+
/** Provider address to a temporal AddressRow valid for `maxAge` ms. */
|
|
55
37
|
export declare function mapAddress(address: string, addressData: AddressProviderData, maxAge: number): AddressRow;
|
|
56
|
-
/**
|
|
57
|
-
* Map Address Transactions
|
|
58
|
-
* Converts provider address transaction data into AddressTransactionRow format
|
|
59
|
-
* @param addr address string
|
|
60
|
-
* @param addressTxsData address transactions data from provider
|
|
61
|
-
* @returns {AddressTransactionRow[]} mapped address transaction rows
|
|
62
|
-
* */
|
|
38
|
+
/** Provider transactions to AddressTransactionRows with the address's net amounts; non-temporal. */
|
|
63
39
|
export declare function mapAddressTransactions(addr: string, addressTxsData: TransactionProviderData[]): AddressTransactionRow[];
|
|
64
|
-
/**
|
|
65
|
-
* Map Address UTxOs
|
|
66
|
-
* @param addr address string
|
|
67
|
-
* @param validFrom validFrom
|
|
68
|
-
* @param validTo validTo
|
|
69
|
-
* @param addressUtxosData address UTxOs data from provider
|
|
70
|
-
* @returns {AddressUTxORow[]} mapped address UTxO rows
|
|
71
|
-
*/
|
|
40
|
+
/** Provider UTxOs to temporal AddressUTxORows. */
|
|
72
41
|
export declare function mapAddressUtxos(addr: string, validFrom: string, validTo: string, addressUtxosData: UtxosProviderData[]): AddressUTxORow[];
|
|
73
|
-
/**
|
|
74
|
-
* Map Address Assets
|
|
75
|
-
* Converts provider address asset data into AddressAssetRow format
|
|
76
|
-
* @param addr address string
|
|
77
|
-
* @param validFrom validFrom
|
|
78
|
-
* @param validTo validTo
|
|
79
|
-
* @param AssetAssets address assets from provider
|
|
80
|
-
* @returns {AddressAssetRow[]} mapped address asset rows
|
|
81
|
-
*/
|
|
42
|
+
/** Provider address amounts (without lovelace) to temporal AddressAssetRows. */
|
|
82
43
|
export declare function mapAddressAssets(addr: string, validFrom: string, validTo: string, AssetAssets: AmountProviderData[]): AddressAssetRow[];
|
|
83
|
-
/**
|
|
84
|
-
* Map UTxO Assets
|
|
85
|
-
* Converts provider address UTxO asset data into UTxOAssetRow format
|
|
86
|
-
* @param addressUtxosData address UTxOs data from provider
|
|
87
|
-
* @param validFrom validFrom
|
|
88
|
-
* @param validTo validTo
|
|
89
|
-
* @returns {UTxOAssetRow[]} mapped UTxO asset rows
|
|
90
|
-
*/
|
|
44
|
+
/** Native assets of provider UTxOs to temporal UTxOAssetRows. */
|
|
91
45
|
export declare function mapAddressUtxoAssets(addressUtxosData: UtxosProviderData[], validFrom: string, validTo: string): UTxOAssetRow[];
|
|
92
|
-
/**
|
|
93
|
-
* Map Network Information
|
|
94
|
-
* Converts provider network information data into NetworkInfoRow format
|
|
95
|
-
* @param providerNetworkData
|
|
96
|
-
* @returns {NetworkInfoRow} mapped network information row
|
|
97
|
-
*/
|
|
46
|
+
/** Provider network information to a temporal NetworkInfoRow. */
|
|
98
47
|
export declare function mapNetworkInfo(providerNetworkData: NetworkInfoProviderData, max_age: number, network: string): NetworkInfoRow;
|
|
99
|
-
/**
|
|
100
|
-
* Map Block Data
|
|
101
|
-
* Converts provider block data into BlockRow format
|
|
102
|
-
* @param providerBlockData block data from provider
|
|
103
|
-
* @param epochData epoch data for the block's epoch
|
|
104
|
-
* @returns {BlockRow} mapped block row
|
|
105
|
-
*/
|
|
48
|
+
/** Provider block to BlockRow. */
|
|
106
49
|
export declare function mapBlock(providerBlockData: BlockProviderData, epochData?: EpochRow): BlockRow;
|
|
107
|
-
/**
|
|
108
|
-
* Map Epoch Data
|
|
109
|
-
* Converts provider epoch data into EpochRow format
|
|
110
|
-
* @param providerEpochData epoch data from provider
|
|
111
|
-
* @returns {EpochRow} mapped epoch row
|
|
112
|
-
*/
|
|
50
|
+
/** Provider epoch to EpochRow. */
|
|
113
51
|
export declare function mapEpoch(providerEpochData: EpochProviderData): EpochRow;
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
*/
|
|
52
|
+
export declare function mapTransactionMetadata(providerLabels: MetadataLabelTxProviderData[], txSeq?: number | null): TransactionMetadataRow[];
|
|
53
|
+
export declare function metadataIdFor(label: string | number): number | string | null;
|
|
54
|
+
/** Where an epoch snapshot came from; `hash` is the block the ledger state was read at (Ogmios only). */
|
|
55
|
+
export interface SnapshotOrigin {
|
|
56
|
+
source: 'ogmios' | 'koios';
|
|
57
|
+
hash?: string | null;
|
|
58
|
+
}
|
|
59
|
+
/** Pool observation at an epoch boundary to a non-temporal PoolEpochSnapshotRow dated by (epoch, snapshotSlot). */
|
|
60
|
+
export declare function mapPoolSnapshot(providerPoolData: PoolProviderData, epoch: number, at: {
|
|
61
|
+
slot: number;
|
|
62
|
+
time: number;
|
|
63
|
+
}, origin?: SnapshotOrigin): PoolEpochSnapshotRow;
|
|
64
|
+
/** DRep observation at an epoch boundary to a non-temporal DrepEpochSnapshotRow. */
|
|
65
|
+
export declare function mapDrepSnapshot(providerDrepData: DrepProviderData, epoch: number, at: {
|
|
66
|
+
slot: number;
|
|
67
|
+
time: number;
|
|
68
|
+
}, origin?: SnapshotOrigin): DrepEpochSnapshotRow;
|
|
69
|
+
/** Provider pool to a temporal PoolRow valid for `max_age` ms. */
|
|
127
70
|
export declare function mapPool(providerPoolData: PoolProviderData, max_age: number): PoolRow;
|
|
128
|
-
/**
|
|
129
|
-
* Map Asset Info Data
|
|
130
|
-
* Converts provider asset info into AssetRow format. Provider data is already
|
|
131
|
-
* normalized by the backend mapper into the canonical AssetInfo shape, so this
|
|
132
|
-
* function just stamps temporal validity and JSON-stringifies the on-chain metadata.
|
|
133
|
-
* @param providerAssetInfo canonical asset info from backend
|
|
134
|
-
* @param max_age TTL window in ms for the temporal validity
|
|
135
|
-
* @returns {AssetRow} mapped asset row
|
|
136
|
-
*/
|
|
71
|
+
/** Canonical asset info to a temporal AssetRow valid for `max_age` ms; on-chain metadata is JSON-stringified. */
|
|
137
72
|
export declare function mapAsset(providerAssetInfo: AssetInfoProviderData, max_age: number): AssetRow;
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
* @param entries asset history events from backend (already canonical)
|
|
142
|
-
* @returns {AssetHistoryRow[]} mapped rows
|
|
143
|
-
*/
|
|
73
|
+
export declare const BARE_ASSET_STAMP = "1970-01-01T00:00:00.000Z";
|
|
74
|
+
export declare function mapBareAsset(unit: string): AssetRow | null;
|
|
75
|
+
/** Asset history events to non-temporal AssetHistoryRows (immutable, keyed on unit + txHash). */
|
|
144
76
|
export declare function mapAssetHistory(entries: AssetHistoryEntryProviderData[]): AssetHistoryRow[];
|
|
145
|
-
/**
|
|
146
|
-
* Map Drep Data
|
|
147
|
-
* Converts provider drep data into DrepRow format
|
|
148
|
-
* @param providerDrepData drep data from provider
|
|
149
|
-
* @returns {DrepRow} mapped drep row
|
|
150
|
-
*/
|
|
77
|
+
/** Provider DRep to a temporal DrepRow valid for `max_age` ms. */
|
|
151
78
|
export declare function mapDrep(providerDrepData: DrepProviderData, max_age: number): DrepRow;
|
|
152
|
-
/**
|
|
153
|
-
* Map Account Data
|
|
154
|
-
* Converts provider account data into AccountRow format
|
|
155
|
-
* @param providerAccountData account data from provider
|
|
156
|
-
* @returns {AccountRow} mapped account row
|
|
157
|
-
*/
|
|
79
|
+
/** Provider account to a temporal AccountRow valid for `max_age` ms. */
|
|
158
80
|
export declare function mapAccount(providerAccountData: AccountProviderData, max_age: number): AccountRow;
|
|
159
|
-
/**
|
|
160
|
-
* Map Backend Error
|
|
161
|
-
* Converts BackendError or unknown error into OData request rejection
|
|
162
|
-
* @param req OData request
|
|
163
|
-
* @param err error object (BackendError or unknown)
|
|
164
|
-
* @param ctx context string for error message
|
|
165
|
-
*/
|
|
81
|
+
/** Rejects the OData request for a BackendError; unknown errors are logged and answered as a sanitized 500. */
|
|
166
82
|
export declare function mapError(req: Request, err: unknown, ctx: string): never;
|
|
167
|
-
/**
|
|
168
|
-
* Map Transaction Build Result
|
|
169
|
-
* Converts provider transaction build result into TransactionBuildRow format
|
|
170
|
-
* @param txbuildResult transaction build result from provider
|
|
171
|
-
* @returns {TransactionBuildRow} mapped transaction build row
|
|
172
|
-
*/
|
|
83
|
+
/** Build result to a temporal TransactionBuildRow with a fresh build id. */
|
|
173
84
|
export declare function mapBuildResult(txbuildResult: TransactionBuildResult, max_age: number): TransactionBuildRow;
|
|
174
|
-
/**
|
|
175
|
-
* Map Transaction Build Inputs
|
|
176
|
-
* Converts transaction build result inputs into TransactionBuildInputRow format
|
|
177
|
-
* @param buildId the transaction build ID
|
|
178
|
-
* @param inputs transaction build result inputs
|
|
179
|
-
* @returns {TransactionBuildInputRow[]} mapped transaction build input rows
|
|
180
|
-
*/
|
|
85
|
+
/** Build result inputs to TransactionBuildInputRows. */
|
|
181
86
|
export declare function mapBuildInputs(buildId: string, inputs: Array<{
|
|
182
87
|
txHash: string;
|
|
183
88
|
index: number;
|
|
184
89
|
lovelace: string;
|
|
185
90
|
address?: string;
|
|
186
91
|
}>): TransactionBuildInputRow[];
|
|
187
|
-
/**
|
|
188
|
-
* Map Transaction Build Outputs
|
|
189
|
-
* Converts transaction build result outputs into TransactionBuildOutputRow format
|
|
190
|
-
* @param buildId the transaction build ID
|
|
191
|
-
* @param outputs transaction build result outputs
|
|
192
|
-
* @param changeAddress the change address to identify change outputs
|
|
193
|
-
* @returns {TransactionBuildOutputRow[]} mapped transaction build output rows
|
|
194
|
-
*/
|
|
92
|
+
/** Build result outputs to TransactionBuildOutputRows; `changeAddress` marks the change output. */
|
|
195
93
|
export declare function mapBuildOutputs(buildId: string, outputs: Array<{
|
|
196
94
|
address: string;
|
|
197
95
|
lovelace: string;
|
|
198
96
|
}>, changeAddress?: string): TransactionBuildOutputRow[];
|
|
199
|
-
/**
|
|
200
|
-
* Map Protocol Parameters
|
|
201
|
-
* Converts provider protocol parameters into ProtocolParameterRow format
|
|
202
|
-
* @param providerParams protocol parameters from provider
|
|
203
|
-
* @returns {ProtocolParameterRow} mapped protocol parameter row
|
|
204
|
-
*/
|
|
97
|
+
/** Provider protocol parameters to ProtocolParameterRow. */
|
|
205
98
|
export declare function mapProtocolParameters(providerParams: ProtocolParameters): ProtocolParameterRow;
|
|
206
|
-
/**
|
|
207
|
-
* Map Transaction Submission
|
|
208
|
-
* Converts signed transaction CBOR and hash into TransactionSubmissionRow format
|
|
209
|
-
* @param signedTxCbor signed transaction in CBOR hex format
|
|
210
|
-
* @param txHash transaction hash
|
|
211
|
-
* @returns {TransactionSubmissionRow} mapped transaction submission row
|
|
212
|
-
*/
|
|
99
|
+
/** Signed tx CBOR and hash to a TransactionSubmissionRow stamped now (epoch seconds). */
|
|
213
100
|
export declare function mapTransactionSubmission(signedTxCbor: string, txHash: string): TransactionSubmissionRow;
|
|
214
|
-
/**
|
|
215
|
-
* Map Address Signing Requests
|
|
216
|
-
* Creates AddressSigningRequest row for address-signing request association
|
|
217
|
-
* @param addr bech32 address
|
|
218
|
-
* @param signingRequestId signing request UUID
|
|
219
|
-
* @returns {AddressSigningRequestRow} mapped address signing request row
|
|
220
|
-
*/
|
|
101
|
+
/** Address to signing-request association row. */
|
|
221
102
|
export declare function mapAddressSigningRequest(addr: string, signingRequestId: string): AddressSigningRequestRow;
|
|
222
|
-
/**
|
|
223
|
-
* Map Address Transaction Builds
|
|
224
|
-
* Creates AddressTransactionBuild row for address-build association
|
|
225
|
-
* @param addr bech32 address
|
|
226
|
-
* @param buildId transaction build UUID
|
|
227
|
-
* @returns {AddressTransactionBuildRow} mapped address transaction build row
|
|
228
|
-
*/
|
|
103
|
+
/** Address to transaction-build association row. */
|
|
229
104
|
export declare function mapAddressTransactionBuild(addr: string, buildId: string): AddressTransactionBuildRow;
|
|
230
|
-
/**
|
|
231
|
-
* Normalize cost models to array format in canonical Plutus parameter order.
|
|
232
|
-
*
|
|
233
|
-
* Blockfrost's cost_models (named keys) has known key-value mapping bugs for
|
|
234
|
-
* PlutusV3 (shifted values in the quotientInteger/remainderInteger region).
|
|
235
|
-
* The Blockfrost backend now prefers cost_models_raw (canonical arrays from the
|
|
236
|
-
* node) which bypasses this issue entirely.
|
|
237
|
-
*
|
|
238
|
-
* For V3 arrays: already in canonical order, just pad to 297 via toCostModelArrV3.
|
|
239
|
-
* For V3 objects (Ogmios named format): toCostModelArrV3(obj) maps via canonical keys.
|
|
240
|
-
* For V1/V2: alphabetical order IS the canonical order (no reordering needed).
|
|
241
|
-
*
|
|
242
|
-
* @param raw - Raw cost models from any backend (Blockfrost, Ogmios, Koios)
|
|
243
|
-
* @returns Object with all cost model values as number arrays in canonical order
|
|
244
|
-
*/
|
|
245
105
|
export declare function normalizeCostModels(raw: Record<string, unknown>): Record<string, number[]>;
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
106
|
+
export declare function decodeAssetName(hex: string): string;
|
|
107
|
+
/** The AssetSlice columns of one asset row, as every table that holds asset rows stores them. */
|
|
108
|
+
export interface AssetSliceColumns {
|
|
109
|
+
asset_quantity: string;
|
|
110
|
+
asset_policyId: string | null;
|
|
111
|
+
asset_assetNameHex: string | null;
|
|
112
|
+
asset_assetName: string | null;
|
|
113
|
+
asset_fingerprint: string | null;
|
|
114
|
+
}
|
|
115
|
+
export declare function assetSlice(unit: string, quantity: string | number | bigint): AssetSliceColumns;
|
|
116
|
+
/** CIP-14 fingerprint: bech32("asset", blake2b_160(policyId_bytes + assetName_bytes)). */
|
|
253
117
|
export declare function computeCip14Fingerprint(policyIdHex: string, assetNameHex: string): string;
|
|
254
|
-
/**
|
|
255
|
-
* Derive an enterprise script address from a script hash and network.
|
|
256
|
-
* Enterprise address = header_byte + 28-byte script hash, bech32-encoded.
|
|
257
|
-
* Header: 0x71 (mainnet, type 7 network 1) or 0x70 (testnet, type 7 network 0).
|
|
258
|
-
*/
|
|
118
|
+
/** Enterprise script address: header 0x71 (mainnet) / 0x70 (testnet) + 28-byte script hash, bech32. */
|
|
259
119
|
export declare function scriptHashToEnterpriseAddress(scriptHashHex: string, network: 'mainnet' | 'preprod' | 'preview'): string;
|
|
120
|
+
/** Stake credential to bech32 reward account; header nibbles 0xe key / 0xf script, network 1 mainnet / 0 testnets. */
|
|
121
|
+
export declare function credentialToStakeAddress(credentialHex: string, isScript: boolean, network: 'mainnet' | 'preprod' | 'preview'): string;
|
|
122
|
+
export interface DecodedAddress {
|
|
123
|
+
type: 'base' | 'pointer' | 'enterprise' | 'reward' | 'byron' | 'unknown';
|
|
124
|
+
/** Payment credential is a script hash. */
|
|
125
|
+
isScript: boolean;
|
|
126
|
+
/** Reward account (bech32) of a base address; null for every other type. */
|
|
127
|
+
stakeAddress: string | null;
|
|
128
|
+
/** Payment key/script hash (hex) of a base, pointer or enterprise address; null otherwise. */
|
|
129
|
+
paymentCredential: string | null;
|
|
130
|
+
/** Network nibble of the header (1 = mainnet, 0 = testnets); null when not a Shelley address. */
|
|
131
|
+
networkId: number | null;
|
|
132
|
+
}
|
|
133
|
+
export declare function decodeShelleyAddress(address: string): DecodedAddress;
|
|
134
|
+
/** Payment credential (hex) of a bech32 address; null for Byron, reward and unresolved ('') addresses. */
|
|
135
|
+
export declare function paymentCredentialOf(address: string | null | undefined): string | null;
|
|
136
|
+
/** DRep credential to CIP-129 DRep ID (29 bytes): header 0x22 key hash / 0x23 script hash. */
|
|
137
|
+
export declare function credentialToDrepId(credentialHex: string, isScript: boolean): string;
|
|
138
|
+
/** Address balance from its UTxOs: lovelace first, then every native asset summed per unit. */
|
|
139
|
+
export declare function sumUtxoAmounts(utxos: Array<{
|
|
140
|
+
amount: Array<{
|
|
141
|
+
unit: string;
|
|
142
|
+
quantity: string;
|
|
143
|
+
}>;
|
|
144
|
+
}>): Array<{
|
|
145
|
+
unit: string;
|
|
146
|
+
quantity: string;
|
|
147
|
+
}>;
|
|
260
148
|
//# sourceMappingURL=mappers.d.ts.map
|