@glacislabs/stablegenie-zerodelta 4.2.0 → 4.2.1
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/dist/{chunk-ZBUK7ULN.js → chunk-FDCSZ3OY.js} +28 -5
- package/dist/{chunk-KETGKV7Y.js → chunk-OOESQYM3.js} +1 -1
- package/dist/core/index.cjs +28 -5
- package/dist/core/index.js +1 -1
- package/dist/index.cjs +28 -5
- package/dist/index.js +2 -2
- package/dist/mount.cjs +28 -5
- package/dist/mount.js +2 -2
- package/dist/standalone.global.js +6 -6
- package/package.json +1 -1
|
@@ -1666,6 +1666,8 @@ function isTransientQuoteError(error) {
|
|
|
1666
1666
|
function wait(ms) {
|
|
1667
1667
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
1668
1668
|
}
|
|
1669
|
+
var PAGE_LIMIT = 500;
|
|
1670
|
+
var MAX_PAGES = 10;
|
|
1669
1671
|
function createApiClient(cfg) {
|
|
1670
1672
|
const cache = {
|
|
1671
1673
|
chains: null,
|
|
@@ -1677,7 +1679,7 @@ function createApiClient(cfg) {
|
|
|
1677
1679
|
const screenCache = /* @__PURE__ */ new Map();
|
|
1678
1680
|
const screenInflight = /* @__PURE__ */ new Map();
|
|
1679
1681
|
const apiBase = cfg.apiBase.replace(/\/$/, "");
|
|
1680
|
-
async function
|
|
1682
|
+
async function requestJson(path, init = {}) {
|
|
1681
1683
|
const apiKey = await cfg.getApiKey();
|
|
1682
1684
|
const headers = { "Content-Type": "application/json", ...init.headers || {} };
|
|
1683
1685
|
if (apiKey) headers["x-api-key"] = apiKey;
|
|
@@ -1713,8 +1715,30 @@ function createApiClient(cfg) {
|
|
|
1713
1715
|
reasons: json?.error?.reasons || json?.reasons
|
|
1714
1716
|
});
|
|
1715
1717
|
}
|
|
1718
|
+
return json;
|
|
1719
|
+
}
|
|
1720
|
+
async function apiRequest(path, init = {}) {
|
|
1721
|
+
const json = await requestJson(path, init);
|
|
1716
1722
|
return json?.data ?? json;
|
|
1717
1723
|
}
|
|
1724
|
+
async function requestAllPages(path) {
|
|
1725
|
+
const rows = [];
|
|
1726
|
+
let firstRow = "";
|
|
1727
|
+
for (let page = 0; page < MAX_PAGES; page += 1) {
|
|
1728
|
+
const json = await requestJson(`${path}${toQuery({ limit: PAGE_LIMIT, offset: rows.length || void 0 })}`);
|
|
1729
|
+
const envelope = json && !Array.isArray(json) ? json : {};
|
|
1730
|
+
const data = Array.isArray(json) ? json : envelope.data;
|
|
1731
|
+
const pageRows = Array.isArray(data) ? data : [];
|
|
1732
|
+
const head = pageRows.length ? JSON.stringify(pageRows[0]) : "";
|
|
1733
|
+
if (page === 0) firstRow = head;
|
|
1734
|
+
else if (head && head === firstRow) throw apiError(`ZeroDelta paging ignored the offset (${path}, offset ${rows.length}).`, { code: "bad_response" });
|
|
1735
|
+
rows.push(...pageRows);
|
|
1736
|
+
const total = envelope.meta?.totalCount;
|
|
1737
|
+
if (!envelope.paging?.next || typeof total === "number" && rows.length >= total) return rows;
|
|
1738
|
+
if (!pageRows.length) throw apiError(`ZeroDelta paging did not advance (${path}, offset ${rows.length}).`, { code: "bad_response" });
|
|
1739
|
+
}
|
|
1740
|
+
throw apiError(`ZeroDelta still had rows after ${MAX_PAGES} pages (${path}).`, { code: "bad_response" });
|
|
1741
|
+
}
|
|
1718
1742
|
async function fetchChains() {
|
|
1719
1743
|
if (nowFresh(cache.chains)) return cache.chains.value;
|
|
1720
1744
|
const chains = await apiRequest(`/chains${toQuery({ enabledOnly: true, limit: 500 })}`);
|
|
@@ -1727,16 +1751,15 @@ function createApiClient(cfg) {
|
|
|
1727
1751
|
}
|
|
1728
1752
|
async function fetchTokens() {
|
|
1729
1753
|
if (nowFresh(cache.tokens)) return cache.tokens.value;
|
|
1730
|
-
const tokens = await
|
|
1731
|
-
const normalized =
|
|
1754
|
+
const tokens = await requestAllPages("/tokens");
|
|
1755
|
+
const normalized = tokens.map((token) => ({ ...token, chainId: Number(token.chainId) }));
|
|
1732
1756
|
cache.tokens = { at: Date.now(), value: normalized };
|
|
1733
1757
|
return normalized;
|
|
1734
1758
|
}
|
|
1735
1759
|
async function fetchRoutes() {
|
|
1736
1760
|
if (nowFresh(cache.routes)) return cache.routes.value;
|
|
1737
1761
|
try {
|
|
1738
|
-
const
|
|
1739
|
-
const normalized = Array.isArray(routes) ? routes : [];
|
|
1762
|
+
const normalized = await requestAllPages("/routes");
|
|
1740
1763
|
cache.routes = { at: Date.now(), value: normalized };
|
|
1741
1764
|
return normalized;
|
|
1742
1765
|
} catch {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CHAIN_DISPLAY_NAMES, EXECUTABLE_STABLE_ASSETS, STABLE_ASSETS, SUPPORTED_ASSETS, complianceView, complianceChecks, DIRECT_CHECK_IDS, complianceTagOf, symbolKey, normalizeDecimalText, parseUnitsDecimal, assetDecimals, findToken, counterpartTokens, assetClassOf, brokenLaneFor, brokenLaneReason, destinationAvailability, tokenTicker, tickerOn, SUPPORTED_CHAIN_IDS, formatUnits, unattributedComplianceReasons, distinctScreenedWallets, humanizeComplianceReason, DIRECT_SCOPE_NOTE, categoryLabel, SCREENING_BUCKETS, createEngine, routeNativeValue, checkNativeFee, nativeFeeShortLabel, nativeSymbol, nativeFeeShortMessage, allowanceCovers, validatePlannedTransaction, foldTicker, BUNDLED_RPC } from './chunk-
|
|
1
|
+
import { CHAIN_DISPLAY_NAMES, EXECUTABLE_STABLE_ASSETS, STABLE_ASSETS, SUPPORTED_ASSETS, complianceView, complianceChecks, DIRECT_CHECK_IDS, complianceTagOf, symbolKey, normalizeDecimalText, parseUnitsDecimal, assetDecimals, findToken, counterpartTokens, assetClassOf, brokenLaneFor, brokenLaneReason, destinationAvailability, tokenTicker, tickerOn, SUPPORTED_CHAIN_IDS, formatUnits, unattributedComplianceReasons, distinctScreenedWallets, humanizeComplianceReason, DIRECT_SCOPE_NOTE, categoryLabel, SCREENING_BUCKETS, createEngine, routeNativeValue, checkNativeFee, nativeFeeShortLabel, nativeSymbol, nativeFeeShortMessage, allowanceCovers, validatePlannedTransaction, foldTicker, BUNDLED_RPC } from './chunk-FDCSZ3OY.js';
|
|
2
2
|
import { createContext, useState, useRef, useEffect, useMemo, useCallback, useId, createElement, useContext } from 'react';
|
|
3
3
|
import { createRoot } from 'react-dom/client';
|
|
4
4
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
package/dist/core/index.cjs
CHANGED
|
@@ -1668,6 +1668,8 @@ function isTransientQuoteError(error) {
|
|
|
1668
1668
|
function wait(ms) {
|
|
1669
1669
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
1670
1670
|
}
|
|
1671
|
+
var PAGE_LIMIT = 500;
|
|
1672
|
+
var MAX_PAGES = 10;
|
|
1671
1673
|
function createApiClient(cfg) {
|
|
1672
1674
|
const cache = {
|
|
1673
1675
|
chains: null,
|
|
@@ -1679,7 +1681,7 @@ function createApiClient(cfg) {
|
|
|
1679
1681
|
const screenCache = /* @__PURE__ */ new Map();
|
|
1680
1682
|
const screenInflight = /* @__PURE__ */ new Map();
|
|
1681
1683
|
const apiBase = cfg.apiBase.replace(/\/$/, "");
|
|
1682
|
-
async function
|
|
1684
|
+
async function requestJson(path, init = {}) {
|
|
1683
1685
|
const apiKey = await cfg.getApiKey();
|
|
1684
1686
|
const headers = { "Content-Type": "application/json", ...init.headers || {} };
|
|
1685
1687
|
if (apiKey) headers["x-api-key"] = apiKey;
|
|
@@ -1715,8 +1717,30 @@ function createApiClient(cfg) {
|
|
|
1715
1717
|
reasons: json?.error?.reasons || json?.reasons
|
|
1716
1718
|
});
|
|
1717
1719
|
}
|
|
1720
|
+
return json;
|
|
1721
|
+
}
|
|
1722
|
+
async function apiRequest(path, init = {}) {
|
|
1723
|
+
const json = await requestJson(path, init);
|
|
1718
1724
|
return json?.data ?? json;
|
|
1719
1725
|
}
|
|
1726
|
+
async function requestAllPages(path) {
|
|
1727
|
+
const rows = [];
|
|
1728
|
+
let firstRow = "";
|
|
1729
|
+
for (let page = 0; page < MAX_PAGES; page += 1) {
|
|
1730
|
+
const json = await requestJson(`${path}${toQuery({ limit: PAGE_LIMIT, offset: rows.length || void 0 })}`);
|
|
1731
|
+
const envelope = json && !Array.isArray(json) ? json : {};
|
|
1732
|
+
const data = Array.isArray(json) ? json : envelope.data;
|
|
1733
|
+
const pageRows = Array.isArray(data) ? data : [];
|
|
1734
|
+
const head = pageRows.length ? JSON.stringify(pageRows[0]) : "";
|
|
1735
|
+
if (page === 0) firstRow = head;
|
|
1736
|
+
else if (head && head === firstRow) throw apiError(`ZeroDelta paging ignored the offset (${path}, offset ${rows.length}).`, { code: "bad_response" });
|
|
1737
|
+
rows.push(...pageRows);
|
|
1738
|
+
const total = envelope.meta?.totalCount;
|
|
1739
|
+
if (!envelope.paging?.next || typeof total === "number" && rows.length >= total) return rows;
|
|
1740
|
+
if (!pageRows.length) throw apiError(`ZeroDelta paging did not advance (${path}, offset ${rows.length}).`, { code: "bad_response" });
|
|
1741
|
+
}
|
|
1742
|
+
throw apiError(`ZeroDelta still had rows after ${MAX_PAGES} pages (${path}).`, { code: "bad_response" });
|
|
1743
|
+
}
|
|
1720
1744
|
async function fetchChains() {
|
|
1721
1745
|
if (nowFresh(cache.chains)) return cache.chains.value;
|
|
1722
1746
|
const chains = await apiRequest(`/chains${toQuery({ enabledOnly: true, limit: 500 })}`);
|
|
@@ -1729,16 +1753,15 @@ function createApiClient(cfg) {
|
|
|
1729
1753
|
}
|
|
1730
1754
|
async function fetchTokens() {
|
|
1731
1755
|
if (nowFresh(cache.tokens)) return cache.tokens.value;
|
|
1732
|
-
const tokens = await
|
|
1733
|
-
const normalized =
|
|
1756
|
+
const tokens = await requestAllPages("/tokens");
|
|
1757
|
+
const normalized = tokens.map((token) => ({ ...token, chainId: Number(token.chainId) }));
|
|
1734
1758
|
cache.tokens = { at: Date.now(), value: normalized };
|
|
1735
1759
|
return normalized;
|
|
1736
1760
|
}
|
|
1737
1761
|
async function fetchRoutes() {
|
|
1738
1762
|
if (nowFresh(cache.routes)) return cache.routes.value;
|
|
1739
1763
|
try {
|
|
1740
|
-
const
|
|
1741
|
-
const normalized = Array.isArray(routes) ? routes : [];
|
|
1764
|
+
const normalized = await requestAllPages("/routes");
|
|
1742
1765
|
cache.routes = { at: Date.now(), value: normalized };
|
|
1743
1766
|
return normalized;
|
|
1744
1767
|
} catch {
|
package/dist/core/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { API_CACHE_TTL_MS, BLOCK_LABEL_DEFAULT, BUNDLED_NATIVE_SYMBOL, BUNDLED_RPC, CANONICAL_DECIMALS, CANONICAL_ESCROW, CANONICAL_INBOUND_BRIDGE, CHAIN_DISPLAY_NAMES, COMPLIANCE_CHECK_ORDER, COMPLIANCE_DENY_LABEL, DEFAULT_WIDGET_API_BASE, DIRECT_CHECK_IDS, DIRECT_SCOPE_NOTE, ERC20_ALLOWANCE_SELECTOR, ERC20_APPROVE_SELECTOR, ERC20_BALANCEOF_SELECTOR, ERC20_TRANSFER_SELECTOR, EXECUTABLE_STABLE_ASSETS, FLOOR_CATEGORIES, LZ_FEE_BUFFER_BPS, MAX_LZ_MSG_VALUE_WEI, MAX_LZ_MSG_VALUE_WEI_BY_CHAIN, MAX_QUOTE_CANDIDATES, MAX_SAME_CLASS_PAY_BPS, MAX_UINT64, NO_PARTNER_ID, PREVIEW_OWNER, QUOTE_BUFFER_BPS, SAME_CLASS_STABLE, SCREENING_BUCKETS, SCREEN_CACHE_TTL_MS, STABLEGENIE_INTENT_TTL_MS, STABLEGENIE_INTENT_VERSION, STABLEGENIE_SUPPORTED_ASSETS, STABLEGENIE_SUPPORTED_CHAIN_IDS, STABLE_ASSETS, SUBMIT_ORDER_SELECTOR, SUPPORTED_ASSETS, SUPPORTED_CHAIN_IDS, TRADEABLE_RWA_ASSETS, TUNABLE_CATEGORIES, ZERO_ADDRESS, addressWord, allowanceCovers, apiError, applyLayerZeroBuffer, assertAddress, assertQuoteMatchesSelection, assetClassOf, assetDecimals, blockLabelFor, brokenLaneFor, brokenLaneReason, buildCatalogue, buildPayOptions, buildRoute, buildSwapPlan, bytes32Word, bytesPayload, canAttachApiKey, categoryLabel, chainById, chainNameOf, chainSelectable, checkEscrow, checkNativeFee, classifyQuoteError, complianceChecks, complianceControlsEvaluated, complianceControlsLine, complianceReasonHead, complianceReasonTag, complianceTagOf, complianceView, counterpartTokens, createApiClient, createEngine, createVerifier, decodeSubmitOrderCalldata, destinationAvailability, destinationKeys, directComplianceFromScreens, distinctScreenedWallets, encodeAllowance, encodeApprove, encodeBalanceOf, encodeSubmitOrder, encodeTransfer, executableRoutes, executionChainIds, fetchPaymentPlan, finalOf, findToken, foldTicker, formatNative, formatUnits, hasReachableDestination, hubDeliverableSymbols, humanizeComplianceReason, isAddress, isDeliverable, isExecutableBridge, isHexAddress, isHexData, isHexQuantity, isKnownUnbridgeable, isLayerZeroRoute, isSourceToken, laneKey, laneKeys, maxNativeFeeWei, nativeFeeShortLabel, nativeFeeShortMessage, nativeSymbol, normalizeAddress, normalizeDecimalText, normalizeOrderRequest, normalizeOrderRequests, parseAllowedApiBase, parseUnitsDecimal, planErrorSummary, planMsgValueHex, productAssets, quoteSwapPreview, registryRpc, requiresNativeBridgeFee, resolveApiBase, resolveConfig, resolveSwapReceiver, resolveVaultIcon, routeNativeValue, safeTicker, scaleDecimals, screeningOutcomeOf, solveExactIn, solveExactOut, sourceKeys, stableGenieIntentSchema, strip0x, suppressedLanes, symbolKey, tickerOn, toHexQuantity, tokenEnabled, tokenKey, tokenTicker, txMatchesPlan, uint64Word, uintWord, unattributedComplianceReasons, validateDestination, validatePlannedTransaction, validateSwap, vaultIconsBySymbol, withVaultArtwork } from '../chunk-
|
|
1
|
+
export { API_CACHE_TTL_MS, BLOCK_LABEL_DEFAULT, BUNDLED_NATIVE_SYMBOL, BUNDLED_RPC, CANONICAL_DECIMALS, CANONICAL_ESCROW, CANONICAL_INBOUND_BRIDGE, CHAIN_DISPLAY_NAMES, COMPLIANCE_CHECK_ORDER, COMPLIANCE_DENY_LABEL, DEFAULT_WIDGET_API_BASE, DIRECT_CHECK_IDS, DIRECT_SCOPE_NOTE, ERC20_ALLOWANCE_SELECTOR, ERC20_APPROVE_SELECTOR, ERC20_BALANCEOF_SELECTOR, ERC20_TRANSFER_SELECTOR, EXECUTABLE_STABLE_ASSETS, FLOOR_CATEGORIES, LZ_FEE_BUFFER_BPS, MAX_LZ_MSG_VALUE_WEI, MAX_LZ_MSG_VALUE_WEI_BY_CHAIN, MAX_QUOTE_CANDIDATES, MAX_SAME_CLASS_PAY_BPS, MAX_UINT64, NO_PARTNER_ID, PREVIEW_OWNER, QUOTE_BUFFER_BPS, SAME_CLASS_STABLE, SCREENING_BUCKETS, SCREEN_CACHE_TTL_MS, STABLEGENIE_INTENT_TTL_MS, STABLEGENIE_INTENT_VERSION, STABLEGENIE_SUPPORTED_ASSETS, STABLEGENIE_SUPPORTED_CHAIN_IDS, STABLE_ASSETS, SUBMIT_ORDER_SELECTOR, SUPPORTED_ASSETS, SUPPORTED_CHAIN_IDS, TRADEABLE_RWA_ASSETS, TUNABLE_CATEGORIES, ZERO_ADDRESS, addressWord, allowanceCovers, apiError, applyLayerZeroBuffer, assertAddress, assertQuoteMatchesSelection, assetClassOf, assetDecimals, blockLabelFor, brokenLaneFor, brokenLaneReason, buildCatalogue, buildPayOptions, buildRoute, buildSwapPlan, bytes32Word, bytesPayload, canAttachApiKey, categoryLabel, chainById, chainNameOf, chainSelectable, checkEscrow, checkNativeFee, classifyQuoteError, complianceChecks, complianceControlsEvaluated, complianceControlsLine, complianceReasonHead, complianceReasonTag, complianceTagOf, complianceView, counterpartTokens, createApiClient, createEngine, createVerifier, decodeSubmitOrderCalldata, destinationAvailability, destinationKeys, directComplianceFromScreens, distinctScreenedWallets, encodeAllowance, encodeApprove, encodeBalanceOf, encodeSubmitOrder, encodeTransfer, executableRoutes, executionChainIds, fetchPaymentPlan, finalOf, findToken, foldTicker, formatNative, formatUnits, hasReachableDestination, hubDeliverableSymbols, humanizeComplianceReason, isAddress, isDeliverable, isExecutableBridge, isHexAddress, isHexData, isHexQuantity, isKnownUnbridgeable, isLayerZeroRoute, isSourceToken, laneKey, laneKeys, maxNativeFeeWei, nativeFeeShortLabel, nativeFeeShortMessage, nativeSymbol, normalizeAddress, normalizeDecimalText, normalizeOrderRequest, normalizeOrderRequests, parseAllowedApiBase, parseUnitsDecimal, planErrorSummary, planMsgValueHex, productAssets, quoteSwapPreview, registryRpc, requiresNativeBridgeFee, resolveApiBase, resolveConfig, resolveSwapReceiver, resolveVaultIcon, routeNativeValue, safeTicker, scaleDecimals, screeningOutcomeOf, solveExactIn, solveExactOut, sourceKeys, stableGenieIntentSchema, strip0x, suppressedLanes, symbolKey, tickerOn, toHexQuantity, tokenEnabled, tokenKey, tokenTicker, txMatchesPlan, uint64Word, uintWord, unattributedComplianceReasons, validateDestination, validatePlannedTransaction, validateSwap, vaultIconsBySymbol, withVaultArtwork } from '../chunk-FDCSZ3OY.js';
|
package/dist/index.cjs
CHANGED
|
@@ -1678,6 +1678,8 @@ function isTransientQuoteError(error) {
|
|
|
1678
1678
|
function wait(ms) {
|
|
1679
1679
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
1680
1680
|
}
|
|
1681
|
+
var PAGE_LIMIT = 500;
|
|
1682
|
+
var MAX_PAGES = 10;
|
|
1681
1683
|
function createApiClient(cfg) {
|
|
1682
1684
|
const cache = {
|
|
1683
1685
|
chains: null,
|
|
@@ -1689,7 +1691,7 @@ function createApiClient(cfg) {
|
|
|
1689
1691
|
const screenCache = /* @__PURE__ */ new Map();
|
|
1690
1692
|
const screenInflight = /* @__PURE__ */ new Map();
|
|
1691
1693
|
const apiBase = cfg.apiBase.replace(/\/$/, "");
|
|
1692
|
-
async function
|
|
1694
|
+
async function requestJson(path, init = {}) {
|
|
1693
1695
|
const apiKey = await cfg.getApiKey();
|
|
1694
1696
|
const headers = { "Content-Type": "application/json", ...init.headers || {} };
|
|
1695
1697
|
if (apiKey) headers["x-api-key"] = apiKey;
|
|
@@ -1725,8 +1727,30 @@ function createApiClient(cfg) {
|
|
|
1725
1727
|
reasons: json?.error?.reasons || json?.reasons
|
|
1726
1728
|
});
|
|
1727
1729
|
}
|
|
1730
|
+
return json;
|
|
1731
|
+
}
|
|
1732
|
+
async function apiRequest(path, init = {}) {
|
|
1733
|
+
const json = await requestJson(path, init);
|
|
1728
1734
|
return json?.data ?? json;
|
|
1729
1735
|
}
|
|
1736
|
+
async function requestAllPages(path) {
|
|
1737
|
+
const rows = [];
|
|
1738
|
+
let firstRow = "";
|
|
1739
|
+
for (let page = 0; page < MAX_PAGES; page += 1) {
|
|
1740
|
+
const json = await requestJson(`${path}${toQuery({ limit: PAGE_LIMIT, offset: rows.length || void 0 })}`);
|
|
1741
|
+
const envelope = json && !Array.isArray(json) ? json : {};
|
|
1742
|
+
const data = Array.isArray(json) ? json : envelope.data;
|
|
1743
|
+
const pageRows = Array.isArray(data) ? data : [];
|
|
1744
|
+
const head = pageRows.length ? JSON.stringify(pageRows[0]) : "";
|
|
1745
|
+
if (page === 0) firstRow = head;
|
|
1746
|
+
else if (head && head === firstRow) throw apiError(`ZeroDelta paging ignored the offset (${path}, offset ${rows.length}).`, { code: "bad_response" });
|
|
1747
|
+
rows.push(...pageRows);
|
|
1748
|
+
const total = envelope.meta?.totalCount;
|
|
1749
|
+
if (!envelope.paging?.next || typeof total === "number" && rows.length >= total) return rows;
|
|
1750
|
+
if (!pageRows.length) throw apiError(`ZeroDelta paging did not advance (${path}, offset ${rows.length}).`, { code: "bad_response" });
|
|
1751
|
+
}
|
|
1752
|
+
throw apiError(`ZeroDelta still had rows after ${MAX_PAGES} pages (${path}).`, { code: "bad_response" });
|
|
1753
|
+
}
|
|
1730
1754
|
async function fetchChains() {
|
|
1731
1755
|
if (nowFresh(cache.chains)) return cache.chains.value;
|
|
1732
1756
|
const chains = await apiRequest(`/chains${toQuery({ enabledOnly: true, limit: 500 })}`);
|
|
@@ -1739,16 +1763,15 @@ function createApiClient(cfg) {
|
|
|
1739
1763
|
}
|
|
1740
1764
|
async function fetchTokens() {
|
|
1741
1765
|
if (nowFresh(cache.tokens)) return cache.tokens.value;
|
|
1742
|
-
const tokens = await
|
|
1743
|
-
const normalized =
|
|
1766
|
+
const tokens = await requestAllPages("/tokens");
|
|
1767
|
+
const normalized = tokens.map((token) => ({ ...token, chainId: Number(token.chainId) }));
|
|
1744
1768
|
cache.tokens = { at: Date.now(), value: normalized };
|
|
1745
1769
|
return normalized;
|
|
1746
1770
|
}
|
|
1747
1771
|
async function fetchRoutes() {
|
|
1748
1772
|
if (nowFresh(cache.routes)) return cache.routes.value;
|
|
1749
1773
|
try {
|
|
1750
|
-
const
|
|
1751
|
-
const normalized = Array.isArray(routes) ? routes : [];
|
|
1774
|
+
const normalized = await requestAllPages("/routes");
|
|
1752
1775
|
cache.routes = { at: Date.now(), value: normalized };
|
|
1753
1776
|
return normalized;
|
|
1754
1777
|
} catch {
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { CompliancePanel, PaymentIsland, StableGenieExchange, StableGeniePay, StableGenieProvider, StableGenieRwaExchange, StableGenieSwap, darkTheme, lightTheme, mount, resolveTheme } from './chunk-
|
|
2
|
-
export { EXECUTABLE_STABLE_ASSETS, STABLE_ASSETS, SUPPORTED_ASSETS, SUPPORTED_CHAIN_IDS, TRADEABLE_RWA_ASSETS, assetClassOf, brokenLaneReason, complianceChecks, complianceControlsLine, complianceView, counterpartTokens, createEngine, destinationAvailability, humanizeComplianceReason, symbolKey } from './chunk-
|
|
1
|
+
export { CompliancePanel, PaymentIsland, StableGenieExchange, StableGeniePay, StableGenieProvider, StableGenieRwaExchange, StableGenieSwap, darkTheme, lightTheme, mount, resolveTheme } from './chunk-OOESQYM3.js';
|
|
2
|
+
export { EXECUTABLE_STABLE_ASSETS, STABLE_ASSETS, SUPPORTED_ASSETS, SUPPORTED_CHAIN_IDS, TRADEABLE_RWA_ASSETS, assetClassOf, brokenLaneReason, complianceChecks, complianceControlsLine, complianceView, counterpartTokens, createEngine, destinationAvailability, humanizeComplianceReason, symbolKey } from './chunk-FDCSZ3OY.js';
|
package/dist/mount.cjs
CHANGED
|
@@ -1659,6 +1659,8 @@ function isTransientQuoteError(error) {
|
|
|
1659
1659
|
function wait(ms) {
|
|
1660
1660
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
1661
1661
|
}
|
|
1662
|
+
var PAGE_LIMIT = 500;
|
|
1663
|
+
var MAX_PAGES = 10;
|
|
1662
1664
|
function createApiClient(cfg) {
|
|
1663
1665
|
const cache = {
|
|
1664
1666
|
chains: null,
|
|
@@ -1670,7 +1672,7 @@ function createApiClient(cfg) {
|
|
|
1670
1672
|
const screenCache = /* @__PURE__ */ new Map();
|
|
1671
1673
|
const screenInflight = /* @__PURE__ */ new Map();
|
|
1672
1674
|
const apiBase = cfg.apiBase.replace(/\/$/, "");
|
|
1673
|
-
async function
|
|
1675
|
+
async function requestJson(path, init = {}) {
|
|
1674
1676
|
const apiKey = await cfg.getApiKey();
|
|
1675
1677
|
const headers = { "Content-Type": "application/json", ...init.headers || {} };
|
|
1676
1678
|
if (apiKey) headers["x-api-key"] = apiKey;
|
|
@@ -1706,8 +1708,30 @@ function createApiClient(cfg) {
|
|
|
1706
1708
|
reasons: json?.error?.reasons || json?.reasons
|
|
1707
1709
|
});
|
|
1708
1710
|
}
|
|
1711
|
+
return json;
|
|
1712
|
+
}
|
|
1713
|
+
async function apiRequest(path, init = {}) {
|
|
1714
|
+
const json = await requestJson(path, init);
|
|
1709
1715
|
return json?.data ?? json;
|
|
1710
1716
|
}
|
|
1717
|
+
async function requestAllPages(path) {
|
|
1718
|
+
const rows = [];
|
|
1719
|
+
let firstRow = "";
|
|
1720
|
+
for (let page = 0; page < MAX_PAGES; page += 1) {
|
|
1721
|
+
const json = await requestJson(`${path}${toQuery({ limit: PAGE_LIMIT, offset: rows.length || void 0 })}`);
|
|
1722
|
+
const envelope = json && !Array.isArray(json) ? json : {};
|
|
1723
|
+
const data = Array.isArray(json) ? json : envelope.data;
|
|
1724
|
+
const pageRows = Array.isArray(data) ? data : [];
|
|
1725
|
+
const head = pageRows.length ? JSON.stringify(pageRows[0]) : "";
|
|
1726
|
+
if (page === 0) firstRow = head;
|
|
1727
|
+
else if (head && head === firstRow) throw apiError(`ZeroDelta paging ignored the offset (${path}, offset ${rows.length}).`, { code: "bad_response" });
|
|
1728
|
+
rows.push(...pageRows);
|
|
1729
|
+
const total = envelope.meta?.totalCount;
|
|
1730
|
+
if (!envelope.paging?.next || typeof total === "number" && rows.length >= total) return rows;
|
|
1731
|
+
if (!pageRows.length) throw apiError(`ZeroDelta paging did not advance (${path}, offset ${rows.length}).`, { code: "bad_response" });
|
|
1732
|
+
}
|
|
1733
|
+
throw apiError(`ZeroDelta still had rows after ${MAX_PAGES} pages (${path}).`, { code: "bad_response" });
|
|
1734
|
+
}
|
|
1711
1735
|
async function fetchChains() {
|
|
1712
1736
|
if (nowFresh(cache.chains)) return cache.chains.value;
|
|
1713
1737
|
const chains = await apiRequest(`/chains${toQuery({ enabledOnly: true, limit: 500 })}`);
|
|
@@ -1720,16 +1744,15 @@ function createApiClient(cfg) {
|
|
|
1720
1744
|
}
|
|
1721
1745
|
async function fetchTokens() {
|
|
1722
1746
|
if (nowFresh(cache.tokens)) return cache.tokens.value;
|
|
1723
|
-
const tokens = await
|
|
1724
|
-
const normalized =
|
|
1747
|
+
const tokens = await requestAllPages("/tokens");
|
|
1748
|
+
const normalized = tokens.map((token) => ({ ...token, chainId: Number(token.chainId) }));
|
|
1725
1749
|
cache.tokens = { at: Date.now(), value: normalized };
|
|
1726
1750
|
return normalized;
|
|
1727
1751
|
}
|
|
1728
1752
|
async function fetchRoutes() {
|
|
1729
1753
|
if (nowFresh(cache.routes)) return cache.routes.value;
|
|
1730
1754
|
try {
|
|
1731
|
-
const
|
|
1732
|
-
const normalized = Array.isArray(routes) ? routes : [];
|
|
1755
|
+
const normalized = await requestAllPages("/routes");
|
|
1733
1756
|
cache.routes = { at: Date.now(), value: normalized };
|
|
1734
1757
|
return normalized;
|
|
1735
1758
|
} catch {
|
package/dist/mount.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { mount } from './chunk-
|
|
2
|
-
import './chunk-
|
|
1
|
+
export { mount } from './chunk-OOESQYM3.js';
|
|
2
|
+
import './chunk-FDCSZ3OY.js';
|