Some checks failed
CI/CD Pipeline / Solidity Contracts (push) Failing after 1m3s
CI/CD Pipeline / Security Scanning (push) Successful in 2m18s
CI/CD Pipeline / Lint and Format (push) Failing after 34s
CI/CD Pipeline / Terraform Validation (push) Failing after 20s
CI/CD Pipeline / Kubernetes Validation (push) Successful in 22s
Deploy ChainID 138 / Deploy ChainID 138 (push) Failing after 40s
HYBX OMNL TypeScript & anchor / token-aggregation build + reconcile artifact (push) Failing after 49s
OMNL reconcile anchor / Run omnl:reconcile and upload artifacts (push) Failing after 21s
Validation / validate-genesis (push) Successful in 25s
Validation / validate-terraform (push) Failing after 21s
Validation / validate-kubernetes (push) Failing after 8s
Validation / validate-smart-contracts (push) Failing after 8s
Validation / validate-security (push) Failing after 1m11s
Validation / validate-documentation (push) Failing after 14s
Verify Deployment / Verify Deployment (push) Failing after 45s
Ship AddressActivityRegistry V1/V2, ISO20022IntakeGateway, Chain138ParticipantSurface, checkpoint hub contracts, checkpoint-core package, aggregator/indexer/sdk services, relay profile guards, M00 diamond bridge facet, and OMNL compliance contracts. Co-authored-by: Cursor <cursoragent@cursor.com>
40 lines
1.7 KiB
JavaScript
40 lines
1.7 KiB
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.enrichLeaves = enrichLeaves;
|
|
const checkpoint_core_1 = require("@dbis/checkpoint-core");
|
|
const config_1 = require("./config");
|
|
const usdEnrich_1 = require("./usdEnrich");
|
|
async function enrichLeaves(leaves, blockscoutApi) {
|
|
const api = blockscoutApi.replace(/\/$/, '');
|
|
const out = [];
|
|
for (const leaf of leaves) {
|
|
const copy = { ...leaf };
|
|
const txHash = String(leaf.txHash || '');
|
|
const needsToken = config_1.checkpointIndexerConfig.enrichTokenTransfers &&
|
|
/^0x[a-fA-F0-9]{64}$/.test(txHash) &&
|
|
!copy.token &&
|
|
BigInt(String(copy.value ?? copy.nativeValueWei ?? '0')) === 0n;
|
|
let allErc20 = [];
|
|
if (needsToken || (config_1.checkpointIndexerConfig.usdEnrichEnabled && /^0x[a-fA-F0-9]{64}$/.test(txHash))) {
|
|
allErc20 = await (0, checkpoint_core_1.fetchAllTokenTransfersForTx)(api, txHash);
|
|
if (needsToken) {
|
|
(0, checkpoint_core_1.applyPrimaryTransferToLeaf)(copy, (0, checkpoint_core_1.pickPrimaryFromSummaries)(allErc20));
|
|
}
|
|
}
|
|
const withUsd = await (0, usdEnrich_1.enrichLeafUsdRecord)(copy, {
|
|
apiBaseUrl: config_1.checkpointIndexerConfig.tokenAggregationApiUrl,
|
|
chainId: 138,
|
|
enabled: config_1.checkpointIndexerConfig.usdEnrichEnabled,
|
|
requestDelayMs: config_1.checkpointIndexerConfig.usdRequestDelayMs,
|
|
blockscoutApi: api,
|
|
preloadedErc20: allErc20,
|
|
});
|
|
out.push(withUsd);
|
|
await sleep(60);
|
|
}
|
|
return out;
|
|
}
|
|
function sleep(ms) {
|
|
return new Promise((r) => setTimeout(r, ms));
|
|
}
|