@glacislabs/stablegenie-zerodelta 4.4.0 → 4.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-53K3BXT5.js → chunk-447DEZ5S.js} +70 -2
- package/dist/{chunk-NYIORRFU.js → chunk-COBXR362.js} +14 -1
- package/dist/core/index.cjs +70 -2
- package/dist/core/index.d.cts +7 -2
- package/dist/core/index.d.ts +7 -2
- package/dist/core/index.js +1 -1
- package/dist/index.cjs +83 -2
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -2
- package/dist/{mount-D8hY-a-s.d.cts → mount-BnAD7hWX.d.cts} +1 -1
- package/dist/{mount-Blg-caPn.d.ts → mount-DcbU1gqd.d.ts} +1 -1
- package/dist/mount.cjs +83 -2
- package/dist/mount.d.cts +2 -2
- package/dist/mount.d.ts +2 -2
- package/dist/mount.js +2 -2
- package/dist/standalone.global.js +7 -7
- package/dist/{verify-C1VaWfiy.d.cts → verify-D722uRwZ.d.cts} +45 -0
- package/dist/{verify-C1VaWfiy.d.ts → verify-D722uRwZ.d.ts} +45 -0
- package/package.json +1 -1
|
@@ -1695,6 +1695,48 @@ async function buildRoute({
|
|
|
1695
1695
|
};
|
|
1696
1696
|
}
|
|
1697
1697
|
|
|
1698
|
+
// src/core/channel.ts
|
|
1699
|
+
var CHANNEL_HEADER = "x-zd-channel";
|
|
1700
|
+
var CHANNEL_VERSION_HEADER = "x-zd-channel-version";
|
|
1701
|
+
var CHANNEL_ORIGIN_HEADER = "x-zd-channel-origin";
|
|
1702
|
+
var WIDGET_CHANNEL = "widget";
|
|
1703
|
+
var WIDGET_VERSION = "4.5.0" ;
|
|
1704
|
+
var MAX_CHANNEL_VERSION_LEN = 32;
|
|
1705
|
+
function sanitizeVersion(raw) {
|
|
1706
|
+
const v = String(raw).trim();
|
|
1707
|
+
if (!v) return "";
|
|
1708
|
+
const capped = v.length > MAX_CHANNEL_VERSION_LEN ? v.slice(0, MAX_CHANNEL_VERSION_LEN) : v;
|
|
1709
|
+
return /^[\x20-\x7e]+$/.test(capped) ? capped : "";
|
|
1710
|
+
}
|
|
1711
|
+
function embeddingOrigin(loc) {
|
|
1712
|
+
const origin = ((typeof location !== "undefined" ? location : void 0))?.origin;
|
|
1713
|
+
const v = String(origin ?? "").trim();
|
|
1714
|
+
if (!v || v === "null") return "";
|
|
1715
|
+
try {
|
|
1716
|
+
const url = new URL(v);
|
|
1717
|
+
if (url.protocol !== "https:" && url.protocol !== "http:") return "";
|
|
1718
|
+
return url.origin;
|
|
1719
|
+
} catch {
|
|
1720
|
+
return "";
|
|
1721
|
+
}
|
|
1722
|
+
}
|
|
1723
|
+
function channelHeaders(version, loc) {
|
|
1724
|
+
const headers = { [CHANNEL_HEADER]: WIDGET_CHANNEL };
|
|
1725
|
+
const v = sanitizeVersion(version);
|
|
1726
|
+
if (v) headers[CHANNEL_VERSION_HEADER] = v;
|
|
1727
|
+
const origin = embeddingOrigin();
|
|
1728
|
+
if (origin) headers[CHANNEL_ORIGIN_HEADER] = origin;
|
|
1729
|
+
return headers;
|
|
1730
|
+
}
|
|
1731
|
+
function isReportableSubmission(report) {
|
|
1732
|
+
if (!report) return false;
|
|
1733
|
+
const { txHash, chainId, wallet } = report;
|
|
1734
|
+
if (typeof txHash !== "string") return false;
|
|
1735
|
+
if (!/^0x[0-9a-fA-F]{64}$/.test(txHash) && !/^[1-9A-HJ-NP-Za-km-z]{64,90}$/.test(txHash)) return false;
|
|
1736
|
+
if (typeof chainId !== "number" || !Number.isFinite(chainId) || chainId <= 0) return false;
|
|
1737
|
+
return typeof wallet === "string" && /^0x[0-9a-fA-F]{40}$/.test(wallet);
|
|
1738
|
+
}
|
|
1739
|
+
|
|
1698
1740
|
// src/core/api.ts
|
|
1699
1741
|
function apiError(message, props = {}) {
|
|
1700
1742
|
const err = new Error(message);
|
|
@@ -1777,9 +1819,14 @@ function createApiClient(cfg) {
|
|
|
1777
1819
|
const screenCache = /* @__PURE__ */ new Map();
|
|
1778
1820
|
const screenInflight = /* @__PURE__ */ new Map();
|
|
1779
1821
|
const apiBase = cfg.apiBase.replace(/\/$/, "");
|
|
1822
|
+
const channel = channelHeaders(WIDGET_VERSION);
|
|
1780
1823
|
async function requestJson(path, init = {}) {
|
|
1781
1824
|
const apiKey = await cfg.getApiKey();
|
|
1782
|
-
const headers = {
|
|
1825
|
+
const headers = {
|
|
1826
|
+
"Content-Type": "application/json",
|
|
1827
|
+
...channel,
|
|
1828
|
+
...init.headers || {}
|
|
1829
|
+
};
|
|
1783
1830
|
if (apiKey) headers["x-api-key"] = apiKey;
|
|
1784
1831
|
const controller = new AbortController();
|
|
1785
1832
|
const timeoutId = setTimeout(() => controller.abort(), init.timeoutMs || 15e3);
|
|
@@ -1930,7 +1977,27 @@ function createApiClient(cfg) {
|
|
|
1930
1977
|
screenInflight.set(key, request);
|
|
1931
1978
|
return request;
|
|
1932
1979
|
}
|
|
1933
|
-
|
|
1980
|
+
async function reportSubmission(report) {
|
|
1981
|
+
if (!isReportableSubmission(report)) return false;
|
|
1982
|
+
try {
|
|
1983
|
+
await apiRequest("/submissions", {
|
|
1984
|
+
method: "POST",
|
|
1985
|
+
body: JSON.stringify({
|
|
1986
|
+
txHash: report.txHash,
|
|
1987
|
+
chainId: report.chainId,
|
|
1988
|
+
wallet: report.wallet,
|
|
1989
|
+
// Absent reads as "submitted" at the gateway too; sent explicitly so
|
|
1990
|
+
// a reader of the wire does not have to know that.
|
|
1991
|
+
stage: report.stage ?? "submitted"
|
|
1992
|
+
}),
|
|
1993
|
+
timeoutMs: 5e3
|
|
1994
|
+
});
|
|
1995
|
+
return true;
|
|
1996
|
+
} catch {
|
|
1997
|
+
return false;
|
|
1998
|
+
}
|
|
1999
|
+
}
|
|
2000
|
+
return { apiRequest, fetchChains, fetchTokens, fetchRoutes, fetchRouteHealth, fetchRwaVaults, fetchQuote, screenWallet, reportSubmission, apiBase };
|
|
1934
2001
|
}
|
|
1935
2002
|
|
|
1936
2003
|
// src/core/plan.ts
|
|
@@ -2666,6 +2733,7 @@ function createEngine(config = {}) {
|
|
|
2666
2733
|
verifySubmittedTx: verifier.verifySubmittedTx,
|
|
2667
2734
|
readBalances: verifier.readBalances,
|
|
2668
2735
|
readNativeBalance: verifier.readNativeBalance,
|
|
2736
|
+
reportSubmission: api.reportSubmission,
|
|
2669
2737
|
recordTransaction: (entry) => {
|
|
2670
2738
|
const clean = sanitizeTxEntry(entry);
|
|
2671
2739
|
try {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CHAIN_DISPLAY_NAMES, EXECUTABLE_STABLE_ASSETS, STABLE_ASSETS, SUPPORTED_ASSETS, complianceView, complianceChecks, DIRECT_CHECK_IDS, complianceTagOf, symbolKey, normalizeDecimalText, findToken, laneLimitFor, laneLimitSymbol, tokenTicker, exceedsLaneLimit, assetDecimals, parseUnitsDecimal, counterpartTokens, assetClassOf, brokenLaneFor, brokenLaneReason, destinationAvailability, laneLimitHint, tickerOn, laneLimitError, amountFieldError, 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, findToken, laneLimitFor, laneLimitSymbol, tokenTicker, exceedsLaneLimit, assetDecimals, parseUnitsDecimal, counterpartTokens, assetClassOf, brokenLaneFor, brokenLaneReason, destinationAvailability, laneLimitHint, tickerOn, laneLimitError, amountFieldError, 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-447DEZ5S.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';
|
|
@@ -284,6 +284,13 @@ function appendTxHistory(account, entry, storage2 = defaultStorage()) {
|
|
|
284
284
|
}
|
|
285
285
|
|
|
286
286
|
// src/react/hooks/useFlow.ts
|
|
287
|
+
function reportQuietly(engine, report, stage) {
|
|
288
|
+
try {
|
|
289
|
+
void engine.reportSubmission?.({ ...report, stage })?.catch?.(() => {
|
|
290
|
+
});
|
|
291
|
+
} catch {
|
|
292
|
+
}
|
|
293
|
+
}
|
|
287
294
|
function useFlow(args) {
|
|
288
295
|
const { engine, wallet, kind, enabled, paramsKey, loadPlan, recipientFor, onQuote, onSuccess, onError } = args;
|
|
289
296
|
const [status, setStatus] = useState("idle");
|
|
@@ -438,11 +445,17 @@ function useFlow(args) {
|
|
|
438
445
|
settleTx = tx;
|
|
439
446
|
}
|
|
440
447
|
}
|
|
448
|
+
if (settleHash) {
|
|
449
|
+
reportQuietly(engine, { txHash: settleHash, chainId: Number(sourceChainId), wallet: account }, "submitted");
|
|
450
|
+
}
|
|
441
451
|
patch("verify", "active");
|
|
442
452
|
const v = settleHash ? await engine.verifySubmittedTx({ chainId: Number(sourceChainId), hash: settleHash, from: account, to: settleTx.to, data: settleTx.data, value: settleTx.value, minNonce: minNonce ?? void 0 }) : { status: "unconfirmed" };
|
|
443
453
|
setVerdict(v);
|
|
444
454
|
setTxHash(settleHash || null);
|
|
445
455
|
patch("verify", v.status === "confirmed" ? "done" : v.status === "mismatch" || v.status === "reverted" ? "error" : "active");
|
|
456
|
+
if (settleHash && v.status === "confirmed") {
|
|
457
|
+
reportQuietly(engine, { txHash: settleHash, chainId: Number(sourceChainId), wallet: account }, "confirmed");
|
|
458
|
+
}
|
|
446
459
|
const entry = engine.recordTransaction({
|
|
447
460
|
kind,
|
|
448
461
|
hash: settleHash,
|
package/dist/core/index.cjs
CHANGED
|
@@ -1697,6 +1697,48 @@ async function buildRoute({
|
|
|
1697
1697
|
};
|
|
1698
1698
|
}
|
|
1699
1699
|
|
|
1700
|
+
// src/core/channel.ts
|
|
1701
|
+
var CHANNEL_HEADER = "x-zd-channel";
|
|
1702
|
+
var CHANNEL_VERSION_HEADER = "x-zd-channel-version";
|
|
1703
|
+
var CHANNEL_ORIGIN_HEADER = "x-zd-channel-origin";
|
|
1704
|
+
var WIDGET_CHANNEL = "widget";
|
|
1705
|
+
var WIDGET_VERSION = "4.5.0" ;
|
|
1706
|
+
var MAX_CHANNEL_VERSION_LEN = 32;
|
|
1707
|
+
function sanitizeVersion(raw) {
|
|
1708
|
+
const v = String(raw).trim();
|
|
1709
|
+
if (!v) return "";
|
|
1710
|
+
const capped = v.length > MAX_CHANNEL_VERSION_LEN ? v.slice(0, MAX_CHANNEL_VERSION_LEN) : v;
|
|
1711
|
+
return /^[\x20-\x7e]+$/.test(capped) ? capped : "";
|
|
1712
|
+
}
|
|
1713
|
+
function embeddingOrigin(loc) {
|
|
1714
|
+
const origin = ((typeof location !== "undefined" ? location : void 0))?.origin;
|
|
1715
|
+
const v = String(origin ?? "").trim();
|
|
1716
|
+
if (!v || v === "null") return "";
|
|
1717
|
+
try {
|
|
1718
|
+
const url = new URL(v);
|
|
1719
|
+
if (url.protocol !== "https:" && url.protocol !== "http:") return "";
|
|
1720
|
+
return url.origin;
|
|
1721
|
+
} catch {
|
|
1722
|
+
return "";
|
|
1723
|
+
}
|
|
1724
|
+
}
|
|
1725
|
+
function channelHeaders(version, loc) {
|
|
1726
|
+
const headers = { [CHANNEL_HEADER]: WIDGET_CHANNEL };
|
|
1727
|
+
const v = sanitizeVersion(version);
|
|
1728
|
+
if (v) headers[CHANNEL_VERSION_HEADER] = v;
|
|
1729
|
+
const origin = embeddingOrigin();
|
|
1730
|
+
if (origin) headers[CHANNEL_ORIGIN_HEADER] = origin;
|
|
1731
|
+
return headers;
|
|
1732
|
+
}
|
|
1733
|
+
function isReportableSubmission(report) {
|
|
1734
|
+
if (!report) return false;
|
|
1735
|
+
const { txHash, chainId, wallet } = report;
|
|
1736
|
+
if (typeof txHash !== "string") return false;
|
|
1737
|
+
if (!/^0x[0-9a-fA-F]{64}$/.test(txHash) && !/^[1-9A-HJ-NP-Za-km-z]{64,90}$/.test(txHash)) return false;
|
|
1738
|
+
if (typeof chainId !== "number" || !Number.isFinite(chainId) || chainId <= 0) return false;
|
|
1739
|
+
return typeof wallet === "string" && /^0x[0-9a-fA-F]{40}$/.test(wallet);
|
|
1740
|
+
}
|
|
1741
|
+
|
|
1700
1742
|
// src/core/api.ts
|
|
1701
1743
|
function apiError(message, props = {}) {
|
|
1702
1744
|
const err = new Error(message);
|
|
@@ -1779,9 +1821,14 @@ function createApiClient(cfg) {
|
|
|
1779
1821
|
const screenCache = /* @__PURE__ */ new Map();
|
|
1780
1822
|
const screenInflight = /* @__PURE__ */ new Map();
|
|
1781
1823
|
const apiBase = cfg.apiBase.replace(/\/$/, "");
|
|
1824
|
+
const channel = channelHeaders(WIDGET_VERSION);
|
|
1782
1825
|
async function requestJson(path, init = {}) {
|
|
1783
1826
|
const apiKey = await cfg.getApiKey();
|
|
1784
|
-
const headers = {
|
|
1827
|
+
const headers = {
|
|
1828
|
+
"Content-Type": "application/json",
|
|
1829
|
+
...channel,
|
|
1830
|
+
...init.headers || {}
|
|
1831
|
+
};
|
|
1785
1832
|
if (apiKey) headers["x-api-key"] = apiKey;
|
|
1786
1833
|
const controller = new AbortController();
|
|
1787
1834
|
const timeoutId = setTimeout(() => controller.abort(), init.timeoutMs || 15e3);
|
|
@@ -1932,7 +1979,27 @@ function createApiClient(cfg) {
|
|
|
1932
1979
|
screenInflight.set(key, request);
|
|
1933
1980
|
return request;
|
|
1934
1981
|
}
|
|
1935
|
-
|
|
1982
|
+
async function reportSubmission(report) {
|
|
1983
|
+
if (!isReportableSubmission(report)) return false;
|
|
1984
|
+
try {
|
|
1985
|
+
await apiRequest("/submissions", {
|
|
1986
|
+
method: "POST",
|
|
1987
|
+
body: JSON.stringify({
|
|
1988
|
+
txHash: report.txHash,
|
|
1989
|
+
chainId: report.chainId,
|
|
1990
|
+
wallet: report.wallet,
|
|
1991
|
+
// Absent reads as "submitted" at the gateway too; sent explicitly so
|
|
1992
|
+
// a reader of the wire does not have to know that.
|
|
1993
|
+
stage: report.stage ?? "submitted"
|
|
1994
|
+
}),
|
|
1995
|
+
timeoutMs: 5e3
|
|
1996
|
+
});
|
|
1997
|
+
return true;
|
|
1998
|
+
} catch {
|
|
1999
|
+
return false;
|
|
2000
|
+
}
|
|
2001
|
+
}
|
|
2002
|
+
return { apiRequest, fetchChains, fetchTokens, fetchRoutes, fetchRouteHealth, fetchRwaVaults, fetchQuote, screenWallet, reportSubmission, apiBase };
|
|
1936
2003
|
}
|
|
1937
2004
|
|
|
1938
2005
|
// src/core/plan.ts
|
|
@@ -2668,6 +2735,7 @@ function createEngine(config = {}) {
|
|
|
2668
2735
|
verifySubmittedTx: verifier.verifySubmittedTx,
|
|
2669
2736
|
readBalances: verifier.readBalances,
|
|
2670
2737
|
readNativeBalance: verifier.readNativeBalance,
|
|
2738
|
+
reportSubmission: api.reportSubmission,
|
|
2671
2739
|
recordTransaction: (entry) => {
|
|
2672
2740
|
const clean = sanitizeTxEntry(entry);
|
|
2673
2741
|
try {
|
package/dist/core/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { T as Token, Q as Quote, N as NormalizedOrder, r as PayOption, h as RouteResult, b as Chain, R as Route, a as Catalogue, s as RwaVault, F as FetchQuoteFn, t as SolveResult, O as OrderRequest, C as Compliance, u as BalanceTarget, v as BalanceEntry, w as ApiClient, P as Plan, x as SwapInput, y as PlannedTx, z as Verifier, f as ExchangeProduct, i as TxHistoryEntry, S as SanitizedTxEntry, E as EngineConfig } from '../verify-
|
|
2
|
-
export { D as Address, G as ApiError, A as Availability, H as BLOCK_LABEL_DEFAULT, B as BrokenLane, I as COMPLIANCE_CHECK_ORDER, J as COMPLIANCE_DENY_LABEL, K as CatalogueContext, M as CatalogueInput, c as ComplianceCheck, U as ComplianceCheckId, X as ComplianceDecision, d as ComplianceTone, e as ComplianceView, Y as DIRECT_CHECK_IDS, Z as DIRECT_SCOPE_NOTE, _ as Destination, $ as FLOOR_CATEGORIES, a0 as Hex, a1 as LaneAvailabilityState, L as LaneLimit, a2 as PlannedTxKind, a3 as QuoteBlock, a4 as ResolvedConfig, a5 as RouteHealth, a6 as RouteHealthAvailability, a7 as RouteHealthLane, g as RouteLeg, a8 as SCREENING_BUCKETS, a9 as ScreenProvider, aa as ScreeningBucket, ab as ScreeningOutcome, ac as TUNABLE_CATEGORIES, ad as TxPlan, V as VerifyResult, W as WalletScreen, ae as amountFieldError, af as apiError, j as assetClassOf, ag as blockLabelFor, ah as brokenLaneFor, k as brokenLaneReason, ai as buildCatalogue, aj as canAttachApiKey, ak as categoryLabel, al as classifyQuoteError, l as complianceChecks, am as complianceControlsEvaluated, m as complianceControlsLine, an as complianceReasonHead, ao as complianceReasonTag, ap as complianceTagOf, n as complianceView, o as counterpartTokens, aq as createApiClient, ar as createVerifier, p as destinationAvailability, as as destinationKeys, at as directComplianceFromScreens, au as distinctScreenedWallets, av as exceedsLaneLimit, aw as executableRoutes, ax as executionChainIds, ay as hasReachableDestination, az as hubDeliverableSymbols, q as humanizeComplianceReason, aA as isExecutableBridge, aB as isKnownUnbridgeable, aC as isSourceToken, aD as laneAvailabilityState, aE as laneKey, aF as laneKeys, aG as laneLimitAmount, aH as laneLimitError, aI as laneLimitFor, aJ as laneLimitHint, aK as laneLimitSymbol, aL as limitedLanes, aM as parseAllowedApiBase, aN as productAssets, aO as registryRpc, aP as resolveApiBase, aQ as resolveConfig, aR as screeningOutcomeOf, aS as sourceKeys, aT as suppressedLanes, aU as tokenKey, aV as txMatchesPlan, aW as unattributedComplianceReasons } from '../verify-
|
|
1
|
+
import { T as Token, Q as Quote, N as NormalizedOrder, r as PayOption, h as RouteResult, b as Chain, R as Route, a as Catalogue, s as RwaVault, F as FetchQuoteFn, t as SolveResult, O as OrderRequest, C as Compliance, u as BalanceTarget, v as BalanceEntry, w as ApiClient, P as Plan, x as SwapInput, y as PlannedTx, z as Verifier, f as ExchangeProduct, i as TxHistoryEntry, S as SanitizedTxEntry, E as EngineConfig } from '../verify-D722uRwZ.cjs';
|
|
2
|
+
export { D as Address, G as ApiError, A as Availability, H as BLOCK_LABEL_DEFAULT, B as BrokenLane, I as COMPLIANCE_CHECK_ORDER, J as COMPLIANCE_DENY_LABEL, K as CatalogueContext, M as CatalogueInput, c as ComplianceCheck, U as ComplianceCheckId, X as ComplianceDecision, d as ComplianceTone, e as ComplianceView, Y as DIRECT_CHECK_IDS, Z as DIRECT_SCOPE_NOTE, _ as Destination, $ as FLOOR_CATEGORIES, a0 as Hex, a1 as LaneAvailabilityState, L as LaneLimit, a2 as PlannedTxKind, a3 as QuoteBlock, a4 as ResolvedConfig, a5 as RouteHealth, a6 as RouteHealthAvailability, a7 as RouteHealthLane, g as RouteLeg, a8 as SCREENING_BUCKETS, a9 as ScreenProvider, aa as ScreeningBucket, ab as ScreeningOutcome, ac as TUNABLE_CATEGORIES, ad as TxPlan, V as VerifyResult, W as WalletScreen, ae as amountFieldError, af as apiError, j as assetClassOf, ag as blockLabelFor, ah as brokenLaneFor, k as brokenLaneReason, ai as buildCatalogue, aj as canAttachApiKey, ak as categoryLabel, al as classifyQuoteError, l as complianceChecks, am as complianceControlsEvaluated, m as complianceControlsLine, an as complianceReasonHead, ao as complianceReasonTag, ap as complianceTagOf, n as complianceView, o as counterpartTokens, aq as createApiClient, ar as createVerifier, p as destinationAvailability, as as destinationKeys, at as directComplianceFromScreens, au as distinctScreenedWallets, av as exceedsLaneLimit, aw as executableRoutes, ax as executionChainIds, ay as hasReachableDestination, az as hubDeliverableSymbols, q as humanizeComplianceReason, aA as isExecutableBridge, aB as isKnownUnbridgeable, aC as isSourceToken, aD as laneAvailabilityState, aE as laneKey, aF as laneKeys, aG as laneLimitAmount, aH as laneLimitError, aI as laneLimitFor, aJ as laneLimitHint, aK as laneLimitSymbol, aL as limitedLanes, aM as parseAllowedApiBase, aN as productAssets, aO as registryRpc, aP as resolveApiBase, aQ as resolveConfig, aR as screeningOutcomeOf, aS as sourceKeys, aT as suppressedLanes, aU as tokenKey, aV as txMatchesPlan, aW as unattributedComplianceReasons } from '../verify-D722uRwZ.cjs';
|
|
3
3
|
|
|
4
4
|
/** Default request base for the widget: the same-origin keyless custody proxy (server injects the
|
|
5
5
|
* ZeroDelta key). A host may override to `/api/v1` + an apiKey for the demo-first fallback path. */
|
|
@@ -568,6 +568,11 @@ interface Engine {
|
|
|
568
568
|
readBalances: Verifier["readBalances"];
|
|
569
569
|
readNativeBalance: Verifier["readNativeBalance"];
|
|
570
570
|
recordTransaction: (entry: TxHistoryEntry) => SanitizedTxEntry;
|
|
571
|
+
/**
|
|
572
|
+
* Tell the gateway this widget submitted a transaction. Called on the HASH,
|
|
573
|
+
* never on the click; never throws and never blocks. See `api.ts`.
|
|
574
|
+
*/
|
|
575
|
+
reportSubmission?: ApiClient["reportSubmission"];
|
|
571
576
|
}
|
|
572
577
|
/** Create an engine bound to a config. The 60s resource cache is per-engine. */
|
|
573
578
|
declare function createEngine(config?: EngineConfig): Engine;
|
package/dist/core/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { T as Token, Q as Quote, N as NormalizedOrder, r as PayOption, h as RouteResult, b as Chain, R as Route, a as Catalogue, s as RwaVault, F as FetchQuoteFn, t as SolveResult, O as OrderRequest, C as Compliance, u as BalanceTarget, v as BalanceEntry, w as ApiClient, P as Plan, x as SwapInput, y as PlannedTx, z as Verifier, f as ExchangeProduct, i as TxHistoryEntry, S as SanitizedTxEntry, E as EngineConfig } from '../verify-
|
|
2
|
-
export { D as Address, G as ApiError, A as Availability, H as BLOCK_LABEL_DEFAULT, B as BrokenLane, I as COMPLIANCE_CHECK_ORDER, J as COMPLIANCE_DENY_LABEL, K as CatalogueContext, M as CatalogueInput, c as ComplianceCheck, U as ComplianceCheckId, X as ComplianceDecision, d as ComplianceTone, e as ComplianceView, Y as DIRECT_CHECK_IDS, Z as DIRECT_SCOPE_NOTE, _ as Destination, $ as FLOOR_CATEGORIES, a0 as Hex, a1 as LaneAvailabilityState, L as LaneLimit, a2 as PlannedTxKind, a3 as QuoteBlock, a4 as ResolvedConfig, a5 as RouteHealth, a6 as RouteHealthAvailability, a7 as RouteHealthLane, g as RouteLeg, a8 as SCREENING_BUCKETS, a9 as ScreenProvider, aa as ScreeningBucket, ab as ScreeningOutcome, ac as TUNABLE_CATEGORIES, ad as TxPlan, V as VerifyResult, W as WalletScreen, ae as amountFieldError, af as apiError, j as assetClassOf, ag as blockLabelFor, ah as brokenLaneFor, k as brokenLaneReason, ai as buildCatalogue, aj as canAttachApiKey, ak as categoryLabel, al as classifyQuoteError, l as complianceChecks, am as complianceControlsEvaluated, m as complianceControlsLine, an as complianceReasonHead, ao as complianceReasonTag, ap as complianceTagOf, n as complianceView, o as counterpartTokens, aq as createApiClient, ar as createVerifier, p as destinationAvailability, as as destinationKeys, at as directComplianceFromScreens, au as distinctScreenedWallets, av as exceedsLaneLimit, aw as executableRoutes, ax as executionChainIds, ay as hasReachableDestination, az as hubDeliverableSymbols, q as humanizeComplianceReason, aA as isExecutableBridge, aB as isKnownUnbridgeable, aC as isSourceToken, aD as laneAvailabilityState, aE as laneKey, aF as laneKeys, aG as laneLimitAmount, aH as laneLimitError, aI as laneLimitFor, aJ as laneLimitHint, aK as laneLimitSymbol, aL as limitedLanes, aM as parseAllowedApiBase, aN as productAssets, aO as registryRpc, aP as resolveApiBase, aQ as resolveConfig, aR as screeningOutcomeOf, aS as sourceKeys, aT as suppressedLanes, aU as tokenKey, aV as txMatchesPlan, aW as unattributedComplianceReasons } from '../verify-
|
|
1
|
+
import { T as Token, Q as Quote, N as NormalizedOrder, r as PayOption, h as RouteResult, b as Chain, R as Route, a as Catalogue, s as RwaVault, F as FetchQuoteFn, t as SolveResult, O as OrderRequest, C as Compliance, u as BalanceTarget, v as BalanceEntry, w as ApiClient, P as Plan, x as SwapInput, y as PlannedTx, z as Verifier, f as ExchangeProduct, i as TxHistoryEntry, S as SanitizedTxEntry, E as EngineConfig } from '../verify-D722uRwZ.js';
|
|
2
|
+
export { D as Address, G as ApiError, A as Availability, H as BLOCK_LABEL_DEFAULT, B as BrokenLane, I as COMPLIANCE_CHECK_ORDER, J as COMPLIANCE_DENY_LABEL, K as CatalogueContext, M as CatalogueInput, c as ComplianceCheck, U as ComplianceCheckId, X as ComplianceDecision, d as ComplianceTone, e as ComplianceView, Y as DIRECT_CHECK_IDS, Z as DIRECT_SCOPE_NOTE, _ as Destination, $ as FLOOR_CATEGORIES, a0 as Hex, a1 as LaneAvailabilityState, L as LaneLimit, a2 as PlannedTxKind, a3 as QuoteBlock, a4 as ResolvedConfig, a5 as RouteHealth, a6 as RouteHealthAvailability, a7 as RouteHealthLane, g as RouteLeg, a8 as SCREENING_BUCKETS, a9 as ScreenProvider, aa as ScreeningBucket, ab as ScreeningOutcome, ac as TUNABLE_CATEGORIES, ad as TxPlan, V as VerifyResult, W as WalletScreen, ae as amountFieldError, af as apiError, j as assetClassOf, ag as blockLabelFor, ah as brokenLaneFor, k as brokenLaneReason, ai as buildCatalogue, aj as canAttachApiKey, ak as categoryLabel, al as classifyQuoteError, l as complianceChecks, am as complianceControlsEvaluated, m as complianceControlsLine, an as complianceReasonHead, ao as complianceReasonTag, ap as complianceTagOf, n as complianceView, o as counterpartTokens, aq as createApiClient, ar as createVerifier, p as destinationAvailability, as as destinationKeys, at as directComplianceFromScreens, au as distinctScreenedWallets, av as exceedsLaneLimit, aw as executableRoutes, ax as executionChainIds, ay as hasReachableDestination, az as hubDeliverableSymbols, q as humanizeComplianceReason, aA as isExecutableBridge, aB as isKnownUnbridgeable, aC as isSourceToken, aD as laneAvailabilityState, aE as laneKey, aF as laneKeys, aG as laneLimitAmount, aH as laneLimitError, aI as laneLimitFor, aJ as laneLimitHint, aK as laneLimitSymbol, aL as limitedLanes, aM as parseAllowedApiBase, aN as productAssets, aO as registryRpc, aP as resolveApiBase, aQ as resolveConfig, aR as screeningOutcomeOf, aS as sourceKeys, aT as suppressedLanes, aU as tokenKey, aV as txMatchesPlan, aW as unattributedComplianceReasons } from '../verify-D722uRwZ.js';
|
|
3
3
|
|
|
4
4
|
/** Default request base for the widget: the same-origin keyless custody proxy (server injects the
|
|
5
5
|
* ZeroDelta key). A host may override to `/api/v1` + an apiKey for the demo-first fallback path. */
|
|
@@ -568,6 +568,11 @@ interface Engine {
|
|
|
568
568
|
readBalances: Verifier["readBalances"];
|
|
569
569
|
readNativeBalance: Verifier["readNativeBalance"];
|
|
570
570
|
recordTransaction: (entry: TxHistoryEntry) => SanitizedTxEntry;
|
|
571
|
+
/**
|
|
572
|
+
* Tell the gateway this widget submitted a transaction. Called on the HASH,
|
|
573
|
+
* never on the click; never throws and never blocks. See `api.ts`.
|
|
574
|
+
*/
|
|
575
|
+
reportSubmission?: ApiClient["reportSubmission"];
|
|
571
576
|
}
|
|
572
577
|
/** Create an engine bound to a config. The 60s resource cache is per-engine. */
|
|
573
578
|
declare function createEngine(config?: EngineConfig): Engine;
|
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, amountFieldError, 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, exceedsLaneLimit, executableRoutes, executionChainIds, fetchPaymentPlan, finalOf, findToken, foldTicker, formatNative, formatUnits, hasReachableDestination, hubDeliverableSymbols, humanizeComplianceReason, isAddress, isDeliverable, isExecutableBridge, isHexAddress, isHexData, isHexQuantity, isKnownUnbridgeable, isLayerZeroRoute, isSourceToken, laneAvailabilityState, laneKey, laneKeys, laneLimitAmount, laneLimitError, laneLimitFor, laneLimitHint, laneLimitSymbol, limitedLanes, maxDeadlineSeconds, maxNativeFeeWei, nativeFeeShortLabel, nativeFeeShortMessage, nativeSymbol, normalizeAddress, normalizeDecimalText, normalizeOrderRequest, normalizeOrderRequests, parseAllowedApiBase, parseUnitsDecimal, planErrorSummary, planMsgValueHex, productAssets, quoteSwapPreview, recommendedDeadlineSeconds, 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, amountFieldError, 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, exceedsLaneLimit, executableRoutes, executionChainIds, fetchPaymentPlan, finalOf, findToken, foldTicker, formatNative, formatUnits, hasReachableDestination, hubDeliverableSymbols, humanizeComplianceReason, isAddress, isDeliverable, isExecutableBridge, isHexAddress, isHexData, isHexQuantity, isKnownUnbridgeable, isLayerZeroRoute, isSourceToken, laneAvailabilityState, laneKey, laneKeys, laneLimitAmount, laneLimitError, laneLimitFor, laneLimitHint, laneLimitSymbol, limitedLanes, maxDeadlineSeconds, maxNativeFeeWei, nativeFeeShortLabel, nativeFeeShortMessage, nativeSymbol, normalizeAddress, normalizeDecimalText, normalizeOrderRequest, normalizeOrderRequests, parseAllowedApiBase, parseUnitsDecimal, planErrorSummary, planMsgValueHex, productAssets, quoteSwapPreview, recommendedDeadlineSeconds, 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-447DEZ5S.js';
|
package/dist/index.cjs
CHANGED
|
@@ -1707,6 +1707,48 @@ async function buildRoute({
|
|
|
1707
1707
|
};
|
|
1708
1708
|
}
|
|
1709
1709
|
|
|
1710
|
+
// src/core/channel.ts
|
|
1711
|
+
var CHANNEL_HEADER = "x-zd-channel";
|
|
1712
|
+
var CHANNEL_VERSION_HEADER = "x-zd-channel-version";
|
|
1713
|
+
var CHANNEL_ORIGIN_HEADER = "x-zd-channel-origin";
|
|
1714
|
+
var WIDGET_CHANNEL = "widget";
|
|
1715
|
+
var WIDGET_VERSION = "4.5.0" ;
|
|
1716
|
+
var MAX_CHANNEL_VERSION_LEN = 32;
|
|
1717
|
+
function sanitizeVersion(raw) {
|
|
1718
|
+
const v = String(raw).trim();
|
|
1719
|
+
if (!v) return "";
|
|
1720
|
+
const capped = v.length > MAX_CHANNEL_VERSION_LEN ? v.slice(0, MAX_CHANNEL_VERSION_LEN) : v;
|
|
1721
|
+
return /^[\x20-\x7e]+$/.test(capped) ? capped : "";
|
|
1722
|
+
}
|
|
1723
|
+
function embeddingOrigin(loc) {
|
|
1724
|
+
const origin = ((typeof location !== "undefined" ? location : void 0))?.origin;
|
|
1725
|
+
const v = String(origin ?? "").trim();
|
|
1726
|
+
if (!v || v === "null") return "";
|
|
1727
|
+
try {
|
|
1728
|
+
const url = new URL(v);
|
|
1729
|
+
if (url.protocol !== "https:" && url.protocol !== "http:") return "";
|
|
1730
|
+
return url.origin;
|
|
1731
|
+
} catch {
|
|
1732
|
+
return "";
|
|
1733
|
+
}
|
|
1734
|
+
}
|
|
1735
|
+
function channelHeaders(version, loc) {
|
|
1736
|
+
const headers = { [CHANNEL_HEADER]: WIDGET_CHANNEL };
|
|
1737
|
+
const v = sanitizeVersion(version);
|
|
1738
|
+
if (v) headers[CHANNEL_VERSION_HEADER] = v;
|
|
1739
|
+
const origin = embeddingOrigin();
|
|
1740
|
+
if (origin) headers[CHANNEL_ORIGIN_HEADER] = origin;
|
|
1741
|
+
return headers;
|
|
1742
|
+
}
|
|
1743
|
+
function isReportableSubmission(report) {
|
|
1744
|
+
if (!report) return false;
|
|
1745
|
+
const { txHash, chainId, wallet } = report;
|
|
1746
|
+
if (typeof txHash !== "string") return false;
|
|
1747
|
+
if (!/^0x[0-9a-fA-F]{64}$/.test(txHash) && !/^[1-9A-HJ-NP-Za-km-z]{64,90}$/.test(txHash)) return false;
|
|
1748
|
+
if (typeof chainId !== "number" || !Number.isFinite(chainId) || chainId <= 0) return false;
|
|
1749
|
+
return typeof wallet === "string" && /^0x[0-9a-fA-F]{40}$/.test(wallet);
|
|
1750
|
+
}
|
|
1751
|
+
|
|
1710
1752
|
// src/core/api.ts
|
|
1711
1753
|
function apiError(message, props = {}) {
|
|
1712
1754
|
const err = new Error(message);
|
|
@@ -1789,9 +1831,14 @@ function createApiClient(cfg) {
|
|
|
1789
1831
|
const screenCache = /* @__PURE__ */ new Map();
|
|
1790
1832
|
const screenInflight = /* @__PURE__ */ new Map();
|
|
1791
1833
|
const apiBase = cfg.apiBase.replace(/\/$/, "");
|
|
1834
|
+
const channel = channelHeaders(WIDGET_VERSION);
|
|
1792
1835
|
async function requestJson(path, init = {}) {
|
|
1793
1836
|
const apiKey = await cfg.getApiKey();
|
|
1794
|
-
const headers = {
|
|
1837
|
+
const headers = {
|
|
1838
|
+
"Content-Type": "application/json",
|
|
1839
|
+
...channel,
|
|
1840
|
+
...init.headers || {}
|
|
1841
|
+
};
|
|
1795
1842
|
if (apiKey) headers["x-api-key"] = apiKey;
|
|
1796
1843
|
const controller = new AbortController();
|
|
1797
1844
|
const timeoutId = setTimeout(() => controller.abort(), init.timeoutMs || 15e3);
|
|
@@ -1942,7 +1989,27 @@ function createApiClient(cfg) {
|
|
|
1942
1989
|
screenInflight.set(key, request);
|
|
1943
1990
|
return request;
|
|
1944
1991
|
}
|
|
1945
|
-
|
|
1992
|
+
async function reportSubmission(report) {
|
|
1993
|
+
if (!isReportableSubmission(report)) return false;
|
|
1994
|
+
try {
|
|
1995
|
+
await apiRequest("/submissions", {
|
|
1996
|
+
method: "POST",
|
|
1997
|
+
body: JSON.stringify({
|
|
1998
|
+
txHash: report.txHash,
|
|
1999
|
+
chainId: report.chainId,
|
|
2000
|
+
wallet: report.wallet,
|
|
2001
|
+
// Absent reads as "submitted" at the gateway too; sent explicitly so
|
|
2002
|
+
// a reader of the wire does not have to know that.
|
|
2003
|
+
stage: report.stage ?? "submitted"
|
|
2004
|
+
}),
|
|
2005
|
+
timeoutMs: 5e3
|
|
2006
|
+
});
|
|
2007
|
+
return true;
|
|
2008
|
+
} catch {
|
|
2009
|
+
return false;
|
|
2010
|
+
}
|
|
2011
|
+
}
|
|
2012
|
+
return { apiRequest, fetchChains, fetchTokens, fetchRoutes, fetchRouteHealth, fetchRwaVaults, fetchQuote, screenWallet, reportSubmission, apiBase };
|
|
1946
2013
|
}
|
|
1947
2014
|
|
|
1948
2015
|
// src/core/plan.ts
|
|
@@ -2623,6 +2690,7 @@ function createEngine(config = {}) {
|
|
|
2623
2690
|
verifySubmittedTx: verifier.verifySubmittedTx,
|
|
2624
2691
|
readBalances: verifier.readBalances,
|
|
2625
2692
|
readNativeBalance: verifier.readNativeBalance,
|
|
2693
|
+
reportSubmission: api.reportSubmission,
|
|
2626
2694
|
recordTransaction: (entry) => {
|
|
2627
2695
|
const clean = sanitizeTxEntry(entry);
|
|
2628
2696
|
try {
|
|
@@ -2908,6 +2976,13 @@ function appendTxHistory(account, entry, storage2 = defaultStorage()) {
|
|
|
2908
2976
|
}
|
|
2909
2977
|
|
|
2910
2978
|
// src/react/hooks/useFlow.ts
|
|
2979
|
+
function reportQuietly(engine, report, stage) {
|
|
2980
|
+
try {
|
|
2981
|
+
void engine.reportSubmission?.({ ...report, stage })?.catch?.(() => {
|
|
2982
|
+
});
|
|
2983
|
+
} catch {
|
|
2984
|
+
}
|
|
2985
|
+
}
|
|
2911
2986
|
function useFlow(args) {
|
|
2912
2987
|
const { engine, wallet, kind, enabled, paramsKey, loadPlan, recipientFor, onQuote, onSuccess, onError } = args;
|
|
2913
2988
|
const [status, setStatus] = react.useState("idle");
|
|
@@ -3062,11 +3137,17 @@ function useFlow(args) {
|
|
|
3062
3137
|
settleTx = tx;
|
|
3063
3138
|
}
|
|
3064
3139
|
}
|
|
3140
|
+
if (settleHash) {
|
|
3141
|
+
reportQuietly(engine, { txHash: settleHash, chainId: Number(sourceChainId), wallet: account }, "submitted");
|
|
3142
|
+
}
|
|
3065
3143
|
patch("verify", "active");
|
|
3066
3144
|
const v = settleHash ? await engine.verifySubmittedTx({ chainId: Number(sourceChainId), hash: settleHash, from: account, to: settleTx.to, data: settleTx.data, value: settleTx.value, minNonce: minNonce ?? void 0 }) : { status: "unconfirmed" };
|
|
3067
3145
|
setVerdict(v);
|
|
3068
3146
|
setTxHash(settleHash || null);
|
|
3069
3147
|
patch("verify", v.status === "confirmed" ? "done" : v.status === "mismatch" || v.status === "reverted" ? "error" : "active");
|
|
3148
|
+
if (settleHash && v.status === "confirmed") {
|
|
3149
|
+
reportQuietly(engine, { txHash: settleHash, chainId: Number(sourceChainId), wallet: account }, "confirmed");
|
|
3150
|
+
}
|
|
3070
3151
|
const entry = engine.recordTransaction({
|
|
3071
3152
|
kind,
|
|
3072
3153
|
hash: settleHash,
|
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { B as BankPayoutAccount, E as Eip1193Provider, a as ExchangeMode, L as LinkIdentity, M as MountConfig, P as PaymentIsland, b as PaymentIslandKind, c as PaymentIslandProps, S as SettlementMethod, d as StableGenieConfig, e as StableGenieExchange, f as StableGenieExchangeProps, g as StableGeniePay, h as StableGeniePayProps, i as StableGenieProvider, j as StableGenieRwaExchange, k as StableGenieSwap, l as StableGenieSwapProps, m as StableGenieTheme, n as SuccessInfo, o as SupportedAsset, p as darkTheme, q as lightTheme, r as mount, s as resolveTheme } from './mount-
|
|
1
|
+
export { B as BankPayoutAccount, E as Eip1193Provider, a as ExchangeMode, L as LinkIdentity, M as MountConfig, P as PaymentIsland, b as PaymentIslandKind, c as PaymentIslandProps, S as SettlementMethod, d as StableGenieConfig, e as StableGenieExchange, f as StableGenieExchangeProps, g as StableGeniePay, h as StableGeniePayProps, i as StableGenieProvider, j as StableGenieRwaExchange, k as StableGenieSwap, l as StableGenieSwapProps, m as StableGenieTheme, n as SuccessInfo, o as SupportedAsset, p as darkTheme, q as lightTheme, r as mount, s as resolveTheme } from './mount-BnAD7hWX.cjs';
|
|
2
2
|
import * as react from 'react';
|
|
3
|
-
import { C as Compliance } from './verify-
|
|
4
|
-
export { A as Availability, B as BrokenLane, a as Catalogue, b as Chain, c as ComplianceCheck, d as ComplianceTone, e as ComplianceView, E as EngineConfig, f as ExchangeProduct, L as LaneLimit, P as Plan, R as Route, g as RouteLeg, h as RouteResult, S as SanitizedTxEntry, T as Token, i as TxHistoryEntry, V as VerifyResult, W as WalletScreen, j as assetClassOf, k as brokenLaneReason, l as complianceChecks, m as complianceControlsLine, n as complianceView, o as counterpartTokens, p as destinationAvailability, q as humanizeComplianceReason } from './verify-
|
|
3
|
+
import { C as Compliance } from './verify-D722uRwZ.cjs';
|
|
4
|
+
export { A as Availability, B as BrokenLane, a as Catalogue, b as Chain, c as ComplianceCheck, d as ComplianceTone, e as ComplianceView, E as EngineConfig, f as ExchangeProduct, L as LaneLimit, P as Plan, R as Route, g as RouteLeg, h as RouteResult, S as SanitizedTxEntry, T as Token, i as TxHistoryEntry, V as VerifyResult, W as WalletScreen, j as assetClassOf, k as brokenLaneReason, l as complianceChecks, m as complianceControlsLine, n as complianceView, o as counterpartTokens, p as destinationAvailability, q as humanizeComplianceReason } from './verify-D722uRwZ.cjs';
|
|
5
5
|
export { EXECUTABLE_STABLE_ASSETS, Engine, STABLE_ASSETS, SUPPORTED_ASSETS, SUPPORTED_CHAIN_IDS, TRADEABLE_RWA_ASSETS, createEngine, symbolKey } from './core/index.cjs';
|
|
6
6
|
|
|
7
7
|
declare function CompliancePanel(props: {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { B as BankPayoutAccount, E as Eip1193Provider, a as ExchangeMode, L as LinkIdentity, M as MountConfig, P as PaymentIsland, b as PaymentIslandKind, c as PaymentIslandProps, S as SettlementMethod, d as StableGenieConfig, e as StableGenieExchange, f as StableGenieExchangeProps, g as StableGeniePay, h as StableGeniePayProps, i as StableGenieProvider, j as StableGenieRwaExchange, k as StableGenieSwap, l as StableGenieSwapProps, m as StableGenieTheme, n as SuccessInfo, o as SupportedAsset, p as darkTheme, q as lightTheme, r as mount, s as resolveTheme } from './mount-
|
|
1
|
+
export { B as BankPayoutAccount, E as Eip1193Provider, a as ExchangeMode, L as LinkIdentity, M as MountConfig, P as PaymentIsland, b as PaymentIslandKind, c as PaymentIslandProps, S as SettlementMethod, d as StableGenieConfig, e as StableGenieExchange, f as StableGenieExchangeProps, g as StableGeniePay, h as StableGeniePayProps, i as StableGenieProvider, j as StableGenieRwaExchange, k as StableGenieSwap, l as StableGenieSwapProps, m as StableGenieTheme, n as SuccessInfo, o as SupportedAsset, p as darkTheme, q as lightTheme, r as mount, s as resolveTheme } from './mount-DcbU1gqd.js';
|
|
2
2
|
import * as react from 'react';
|
|
3
|
-
import { C as Compliance } from './verify-
|
|
4
|
-
export { A as Availability, B as BrokenLane, a as Catalogue, b as Chain, c as ComplianceCheck, d as ComplianceTone, e as ComplianceView, E as EngineConfig, f as ExchangeProduct, L as LaneLimit, P as Plan, R as Route, g as RouteLeg, h as RouteResult, S as SanitizedTxEntry, T as Token, i as TxHistoryEntry, V as VerifyResult, W as WalletScreen, j as assetClassOf, k as brokenLaneReason, l as complianceChecks, m as complianceControlsLine, n as complianceView, o as counterpartTokens, p as destinationAvailability, q as humanizeComplianceReason } from './verify-
|
|
3
|
+
import { C as Compliance } from './verify-D722uRwZ.js';
|
|
4
|
+
export { A as Availability, B as BrokenLane, a as Catalogue, b as Chain, c as ComplianceCheck, d as ComplianceTone, e as ComplianceView, E as EngineConfig, f as ExchangeProduct, L as LaneLimit, P as Plan, R as Route, g as RouteLeg, h as RouteResult, S as SanitizedTxEntry, T as Token, i as TxHistoryEntry, V as VerifyResult, W as WalletScreen, j as assetClassOf, k as brokenLaneReason, l as complianceChecks, m as complianceControlsLine, n as complianceView, o as counterpartTokens, p as destinationAvailability, q as humanizeComplianceReason } from './verify-D722uRwZ.js';
|
|
5
5
|
export { EXECUTABLE_STABLE_ASSETS, Engine, STABLE_ASSETS, SUPPORTED_ASSETS, SUPPORTED_CHAIN_IDS, TRADEABLE_RWA_ASSETS, createEngine, symbolKey } from './core/index.js';
|
|
6
6
|
|
|
7
7
|
declare function CompliancePanel(props: {
|
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-COBXR362.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-447DEZ5S.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import { P as Plan, V as VerifyResult, h as RouteResult, S as SanitizedTxEntry, f as ExchangeProduct } from './verify-
|
|
3
|
+
import { P as Plan, V as VerifyResult, h as RouteResult, S as SanitizedTxEntry, f as ExchangeProduct } from './verify-D722uRwZ.cjs';
|
|
4
4
|
|
|
5
5
|
interface Eip1193Provider {
|
|
6
6
|
request(args: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import { P as Plan, V as VerifyResult, h as RouteResult, S as SanitizedTxEntry, f as ExchangeProduct } from './verify-
|
|
3
|
+
import { P as Plan, V as VerifyResult, h as RouteResult, S as SanitizedTxEntry, f as ExchangeProduct } from './verify-D722uRwZ.js';
|
|
4
4
|
|
|
5
5
|
interface Eip1193Provider {
|
|
6
6
|
request(args: {
|
package/dist/mount.cjs
CHANGED
|
@@ -1688,6 +1688,48 @@ async function buildRoute({
|
|
|
1688
1688
|
};
|
|
1689
1689
|
}
|
|
1690
1690
|
|
|
1691
|
+
// src/core/channel.ts
|
|
1692
|
+
var CHANNEL_HEADER = "x-zd-channel";
|
|
1693
|
+
var CHANNEL_VERSION_HEADER = "x-zd-channel-version";
|
|
1694
|
+
var CHANNEL_ORIGIN_HEADER = "x-zd-channel-origin";
|
|
1695
|
+
var WIDGET_CHANNEL = "widget";
|
|
1696
|
+
var WIDGET_VERSION = "4.5.0" ;
|
|
1697
|
+
var MAX_CHANNEL_VERSION_LEN = 32;
|
|
1698
|
+
function sanitizeVersion(raw) {
|
|
1699
|
+
const v = String(raw).trim();
|
|
1700
|
+
if (!v) return "";
|
|
1701
|
+
const capped = v.length > MAX_CHANNEL_VERSION_LEN ? v.slice(0, MAX_CHANNEL_VERSION_LEN) : v;
|
|
1702
|
+
return /^[\x20-\x7e]+$/.test(capped) ? capped : "";
|
|
1703
|
+
}
|
|
1704
|
+
function embeddingOrigin(loc) {
|
|
1705
|
+
const origin = ((typeof location !== "undefined" ? location : void 0))?.origin;
|
|
1706
|
+
const v = String(origin ?? "").trim();
|
|
1707
|
+
if (!v || v === "null") return "";
|
|
1708
|
+
try {
|
|
1709
|
+
const url = new URL(v);
|
|
1710
|
+
if (url.protocol !== "https:" && url.protocol !== "http:") return "";
|
|
1711
|
+
return url.origin;
|
|
1712
|
+
} catch {
|
|
1713
|
+
return "";
|
|
1714
|
+
}
|
|
1715
|
+
}
|
|
1716
|
+
function channelHeaders(version, loc) {
|
|
1717
|
+
const headers = { [CHANNEL_HEADER]: WIDGET_CHANNEL };
|
|
1718
|
+
const v = sanitizeVersion(version);
|
|
1719
|
+
if (v) headers[CHANNEL_VERSION_HEADER] = v;
|
|
1720
|
+
const origin = embeddingOrigin();
|
|
1721
|
+
if (origin) headers[CHANNEL_ORIGIN_HEADER] = origin;
|
|
1722
|
+
return headers;
|
|
1723
|
+
}
|
|
1724
|
+
function isReportableSubmission(report) {
|
|
1725
|
+
if (!report) return false;
|
|
1726
|
+
const { txHash, chainId, wallet } = report;
|
|
1727
|
+
if (typeof txHash !== "string") return false;
|
|
1728
|
+
if (!/^0x[0-9a-fA-F]{64}$/.test(txHash) && !/^[1-9A-HJ-NP-Za-km-z]{64,90}$/.test(txHash)) return false;
|
|
1729
|
+
if (typeof chainId !== "number" || !Number.isFinite(chainId) || chainId <= 0) return false;
|
|
1730
|
+
return typeof wallet === "string" && /^0x[0-9a-fA-F]{40}$/.test(wallet);
|
|
1731
|
+
}
|
|
1732
|
+
|
|
1691
1733
|
// src/core/api.ts
|
|
1692
1734
|
function apiError(message, props = {}) {
|
|
1693
1735
|
const err = new Error(message);
|
|
@@ -1770,9 +1812,14 @@ function createApiClient(cfg) {
|
|
|
1770
1812
|
const screenCache = /* @__PURE__ */ new Map();
|
|
1771
1813
|
const screenInflight = /* @__PURE__ */ new Map();
|
|
1772
1814
|
const apiBase = cfg.apiBase.replace(/\/$/, "");
|
|
1815
|
+
const channel = channelHeaders(WIDGET_VERSION);
|
|
1773
1816
|
async function requestJson(path, init = {}) {
|
|
1774
1817
|
const apiKey = await cfg.getApiKey();
|
|
1775
|
-
const headers = {
|
|
1818
|
+
const headers = {
|
|
1819
|
+
"Content-Type": "application/json",
|
|
1820
|
+
...channel,
|
|
1821
|
+
...init.headers || {}
|
|
1822
|
+
};
|
|
1776
1823
|
if (apiKey) headers["x-api-key"] = apiKey;
|
|
1777
1824
|
const controller = new AbortController();
|
|
1778
1825
|
const timeoutId = setTimeout(() => controller.abort(), init.timeoutMs || 15e3);
|
|
@@ -1923,7 +1970,27 @@ function createApiClient(cfg) {
|
|
|
1923
1970
|
screenInflight.set(key, request);
|
|
1924
1971
|
return request;
|
|
1925
1972
|
}
|
|
1926
|
-
|
|
1973
|
+
async function reportSubmission(report) {
|
|
1974
|
+
if (!isReportableSubmission(report)) return false;
|
|
1975
|
+
try {
|
|
1976
|
+
await apiRequest("/submissions", {
|
|
1977
|
+
method: "POST",
|
|
1978
|
+
body: JSON.stringify({
|
|
1979
|
+
txHash: report.txHash,
|
|
1980
|
+
chainId: report.chainId,
|
|
1981
|
+
wallet: report.wallet,
|
|
1982
|
+
// Absent reads as "submitted" at the gateway too; sent explicitly so
|
|
1983
|
+
// a reader of the wire does not have to know that.
|
|
1984
|
+
stage: report.stage ?? "submitted"
|
|
1985
|
+
}),
|
|
1986
|
+
timeoutMs: 5e3
|
|
1987
|
+
});
|
|
1988
|
+
return true;
|
|
1989
|
+
} catch {
|
|
1990
|
+
return false;
|
|
1991
|
+
}
|
|
1992
|
+
}
|
|
1993
|
+
return { apiRequest, fetchChains, fetchTokens, fetchRoutes, fetchRouteHealth, fetchRwaVaults, fetchQuote, screenWallet, reportSubmission, apiBase };
|
|
1927
1994
|
}
|
|
1928
1995
|
|
|
1929
1996
|
// src/core/plan.ts
|
|
@@ -2604,6 +2671,7 @@ function createEngine(config = {}) {
|
|
|
2604
2671
|
verifySubmittedTx: verifier.verifySubmittedTx,
|
|
2605
2672
|
readBalances: verifier.readBalances,
|
|
2606
2673
|
readNativeBalance: verifier.readNativeBalance,
|
|
2674
|
+
reportSubmission: api.reportSubmission,
|
|
2607
2675
|
recordTransaction: (entry) => {
|
|
2608
2676
|
const clean = sanitizeTxEntry(entry);
|
|
2609
2677
|
try {
|
|
@@ -2889,6 +2957,13 @@ function appendTxHistory(account, entry, storage2 = defaultStorage()) {
|
|
|
2889
2957
|
}
|
|
2890
2958
|
|
|
2891
2959
|
// src/react/hooks/useFlow.ts
|
|
2960
|
+
function reportQuietly(engine, report, stage) {
|
|
2961
|
+
try {
|
|
2962
|
+
void engine.reportSubmission?.({ ...report, stage })?.catch?.(() => {
|
|
2963
|
+
});
|
|
2964
|
+
} catch {
|
|
2965
|
+
}
|
|
2966
|
+
}
|
|
2892
2967
|
function useFlow(args) {
|
|
2893
2968
|
const { engine, wallet, kind, enabled, paramsKey, loadPlan, recipientFor, onQuote, onSuccess, onError } = args;
|
|
2894
2969
|
const [status, setStatus] = react.useState("idle");
|
|
@@ -3043,11 +3118,17 @@ function useFlow(args) {
|
|
|
3043
3118
|
settleTx = tx;
|
|
3044
3119
|
}
|
|
3045
3120
|
}
|
|
3121
|
+
if (settleHash) {
|
|
3122
|
+
reportQuietly(engine, { txHash: settleHash, chainId: Number(sourceChainId), wallet: account }, "submitted");
|
|
3123
|
+
}
|
|
3046
3124
|
patch("verify", "active");
|
|
3047
3125
|
const v = settleHash ? await engine.verifySubmittedTx({ chainId: Number(sourceChainId), hash: settleHash, from: account, to: settleTx.to, data: settleTx.data, value: settleTx.value, minNonce: minNonce ?? void 0 }) : { status: "unconfirmed" };
|
|
3048
3126
|
setVerdict(v);
|
|
3049
3127
|
setTxHash(settleHash || null);
|
|
3050
3128
|
patch("verify", v.status === "confirmed" ? "done" : v.status === "mismatch" || v.status === "reverted" ? "error" : "active");
|
|
3129
|
+
if (settleHash && v.status === "confirmed") {
|
|
3130
|
+
reportQuietly(engine, { txHash: settleHash, chainId: Number(sourceChainId), wallet: account }, "confirmed");
|
|
3131
|
+
}
|
|
3051
3132
|
const entry = engine.recordTransaction({
|
|
3052
3133
|
kind,
|
|
3053
3134
|
hash: settleHash,
|
package/dist/mount.d.cts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { M as MountConfig, r as mount } from './mount-
|
|
1
|
+
export { M as MountConfig, r as mount } from './mount-BnAD7hWX.cjs';
|
|
2
2
|
import 'react';
|
|
3
|
-
import './verify-
|
|
3
|
+
import './verify-D722uRwZ.cjs';
|