@glacislabs/stablegenie-zerodelta 4.18.0 → 4.18.2
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-CWAEDN4I.js → chunk-LMK5C6VA.js} +86 -50
- package/dist/{chunk-AEAJKHPP.js → chunk-OIJN6SHV.js} +3 -3
- package/dist/core/index.cjs +3 -3
- package/dist/core/index.js +1 -1
- package/dist/index.cjs +88 -52
- package/dist/index.js +2 -2
- package/dist/mount.cjs +88 -52
- package/dist/mount.js +2 -2
- package/dist/standalone.global.js +10 -7
- package/package.json +1 -1
package/dist/mount.cjs
CHANGED
|
@@ -575,8 +575,8 @@ var init_ed255192 = __esm({
|
|
|
575
575
|
});
|
|
576
576
|
|
|
577
577
|
// src/core/delivery.ts
|
|
578
|
-
var FAILED = /* @__PURE__ */ new Set(["cancelled", "fill_failed", "delivery_failed", "
|
|
579
|
-
var ATTENTION = /* @__PURE__ */ new Set(["cancel_pending", "awaiting_claim"]);
|
|
578
|
+
var FAILED = /* @__PURE__ */ new Set(["cancelled", "fill_failed", "delivery_failed", "failed"]);
|
|
579
|
+
var ATTENTION = /* @__PURE__ */ new Set(["cancel_pending", "awaiting_claim", "expired"]);
|
|
580
580
|
var TRACKING = Object.freeze({ phase: "tracking", status: "", steps: [] });
|
|
581
581
|
var word = (v) => typeof v === "string" ? v.trim().toLowerCase() : "";
|
|
582
582
|
var STEP_ORDER = { submitted: 0, arrived: 1, filled: 2, delivered: 3 };
|
|
@@ -633,11 +633,15 @@ function useDelivery(engine, hash2) {
|
|
|
633
633
|
let alive = true;
|
|
634
634
|
let timer2;
|
|
635
635
|
let answered = false;
|
|
636
|
+
let waitsOnOwner = false;
|
|
636
637
|
let unanswered = 0;
|
|
637
638
|
const started2 = Date.now();
|
|
638
639
|
setState({ hash: hash2, value: TRACKING });
|
|
639
640
|
const schedule = () => {
|
|
640
|
-
if (Date.now() - started2 > DELIVERY_GIVE_UP_MS)
|
|
641
|
+
if (Date.now() - started2 > DELIVERY_GIVE_UP_MS) {
|
|
642
|
+
if (waitsOnOwner) return;
|
|
643
|
+
return setState({ hash: hash2, value: UNAVAILABLE });
|
|
644
|
+
}
|
|
641
645
|
timer2 = setTimeout(tick, deliveryPollDelay(Date.now() - started2));
|
|
642
646
|
};
|
|
643
647
|
const tick = async () => {
|
|
@@ -650,6 +654,7 @@ function useDelivery(engine, hash2) {
|
|
|
650
654
|
return schedule();
|
|
651
655
|
}
|
|
652
656
|
answered = true;
|
|
657
|
+
waitsOnOwner = next.phase === "attention";
|
|
653
658
|
setState({ hash: hash2, value: next });
|
|
654
659
|
if (next.phase === "delivered" || next.phase === "failed") return;
|
|
655
660
|
schedule();
|
|
@@ -3627,7 +3632,7 @@ var CHANNEL_HEADER = "x-zd-channel";
|
|
|
3627
3632
|
var CHANNEL_VERSION_HEADER = "x-zd-channel-version";
|
|
3628
3633
|
var CHANNEL_ORIGIN_HEADER = "x-zd-channel-origin";
|
|
3629
3634
|
var WIDGET_CHANNEL = "widget";
|
|
3630
|
-
var WIDGET_VERSION = "4.18.
|
|
3635
|
+
var WIDGET_VERSION = "4.18.2" ;
|
|
3631
3636
|
var MAX_CHANNEL_VERSION_LEN = 32;
|
|
3632
3637
|
function sanitizeVersion(raw2) {
|
|
3633
3638
|
const v = String(raw2).trim();
|
|
@@ -5357,6 +5362,40 @@ function useFlow(args) {
|
|
|
5357
5362
|
addRoute
|
|
5358
5363
|
};
|
|
5359
5364
|
}
|
|
5365
|
+
var RETRY_DELAYS_MS = [800, 2400, 6e3];
|
|
5366
|
+
function useCatalogue(engine, options = {}) {
|
|
5367
|
+
const { allowedAssets, product, solanaSources } = options;
|
|
5368
|
+
const enabled = options.enabled !== false;
|
|
5369
|
+
const [catalogue, setCatalogue] = react.useState(null);
|
|
5370
|
+
const [failed, setFailed] = react.useState(false);
|
|
5371
|
+
const [round, setRound] = react.useState(0);
|
|
5372
|
+
react.useEffect(() => {
|
|
5373
|
+
if (!enabled) return;
|
|
5374
|
+
let alive = true;
|
|
5375
|
+
let timer2;
|
|
5376
|
+
let attempt = 0;
|
|
5377
|
+
setFailed(false);
|
|
5378
|
+
const read = () => {
|
|
5379
|
+
engine.fetchCatalogue(allowedAssets, product, solanaSources ? { solanaSources: true } : void 0).then((next) => {
|
|
5380
|
+
if (!alive) return;
|
|
5381
|
+
setCatalogue(next);
|
|
5382
|
+
if (next.ready) return;
|
|
5383
|
+
if (attempt >= RETRY_DELAYS_MS.length) {
|
|
5384
|
+
setFailed(true);
|
|
5385
|
+
return;
|
|
5386
|
+
}
|
|
5387
|
+
timer2 = setTimeout(read, RETRY_DELAYS_MS[attempt++]);
|
|
5388
|
+
});
|
|
5389
|
+
};
|
|
5390
|
+
read();
|
|
5391
|
+
return () => {
|
|
5392
|
+
alive = false;
|
|
5393
|
+
if (timer2) clearTimeout(timer2);
|
|
5394
|
+
};
|
|
5395
|
+
}, [engine, allowedAssets, product, solanaSources, enabled, round]);
|
|
5396
|
+
const retry = react.useCallback(() => setRound((n) => n + 1), []);
|
|
5397
|
+
return { catalogue, loading: enabled && !catalogue?.ready && !failed, failed, retry };
|
|
5398
|
+
}
|
|
5360
5399
|
function balanceKey(chainId, tokenAddress) {
|
|
5361
5400
|
return `${Number(chainId)}:${String(tokenAddress || "").toLowerCase()}`;
|
|
5362
5401
|
}
|
|
@@ -5706,6 +5745,9 @@ img.sg-tok-badge{width:16px;padding:0;object-fit:cover;background:var(--sg-bg)}
|
|
|
5706
5745
|
.sg-sel-sub{display:block;font-size:11px;font-weight:600;color:var(--sg-text-muted);margin-top:1px}
|
|
5707
5746
|
.sg-toklist{display:flex;flex-direction:column;gap:2px;max-height:320px;overflow-y:auto;margin:0 -6px;padding:0 6px;scrollbar-width:thin}
|
|
5708
5747
|
.sg-sel-empty{padding:26px 10px;text-align:center;font-size:13px;color:var(--sg-text-muted)}
|
|
5748
|
+
/* retry beside the "did not load" message: a link, not a CTA \u2014 the primary action is still picking. */
|
|
5749
|
+
.sg-sel-retry{background:none;border:0;padding:0;font:inherit;font-weight:700;color:var(--sg-accent);cursor:pointer;text-decoration:underline}
|
|
5750
|
+
.sg-sel-retry:hover{opacity:.8}
|
|
5709
5751
|
|
|
5710
5752
|
/* Token picker, token first then network \u2014 the ZeroDelta dapp's TokenSelectModal (Figma 708:27430,
|
|
5711
5753
|
2517:52576), drawn in the widget's own theme: the dapp's brand tint is the accent, its green the
|
|
@@ -7351,7 +7393,13 @@ function TokenSelect(props) {
|
|
|
7351
7393
|
] })
|
|
7352
7394
|
] }) : null,
|
|
7353
7395
|
listed.length > 0 || visible.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "sg-pk-cap", children: side === "from" ? "Your tokens \xB7 All networks" : "Popular tokens \xB7 All networks" }) : null,
|
|
7354
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-pk-list", ref: listRef, role: "group", "aria-label": props.title, children: visible.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "sg-pk-empty", children:
|
|
7396
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-pk-list", ref: listRef, role: "group", "aria-label": props.title, children: visible.length === 0 ? props.loading ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "sg-pk-empty", children: "Loading the token list\u2026" }) : props.failed ? /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "sg-pk-empty", role: "alert", children: [
|
|
7397
|
+
"The token list did not load.",
|
|
7398
|
+
props.onRetry ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
7399
|
+
" ",
|
|
7400
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "sg-sel-retry", onClick: props.onRetry, children: "Retry" })
|
|
7401
|
+
] }) : null
|
|
7402
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsx("p", { className: "sg-pk-empty", children: "No tokens found." }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
7355
7403
|
listed.map((g) => renderRow(g, false)),
|
|
7356
7404
|
other.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "sg-pk-cap sg-pk-cap--section", "data-testid": "other-tokens-cap", children: "Other supported tokens" }) : null,
|
|
7357
7405
|
other.map((g) => renderRow(g, true))
|
|
@@ -7896,6 +7944,7 @@ function useWalletHistory(engine, wallets) {
|
|
|
7896
7944
|
if (!engine || !key) return;
|
|
7897
7945
|
let alive = true;
|
|
7898
7946
|
let timer2;
|
|
7947
|
+
let started2 = Date.now();
|
|
7899
7948
|
const read = async () => {
|
|
7900
7949
|
if (timer2) clearTimeout(timer2);
|
|
7901
7950
|
timer2 = void 0;
|
|
@@ -7905,10 +7954,14 @@ function useWalletHistory(engine, wallets) {
|
|
|
7905
7954
|
if (next) setEntries(next);
|
|
7906
7955
|
if (!travelling(next)) return;
|
|
7907
7956
|
}
|
|
7957
|
+
if (Date.now() - started2 > DELIVERY_GIVE_UP_MS) return;
|
|
7908
7958
|
timer2 = setTimeout(read, WALLET_HISTORY_REFRESH_MS);
|
|
7909
7959
|
};
|
|
7910
7960
|
void read();
|
|
7911
|
-
const onRecorded = () =>
|
|
7961
|
+
const onRecorded = () => {
|
|
7962
|
+
started2 = Date.now();
|
|
7963
|
+
void read();
|
|
7964
|
+
};
|
|
7912
7965
|
if (typeof window !== "undefined") window.addEventListener(TX_HISTORY_EVENT, onRecorded);
|
|
7913
7966
|
return () => {
|
|
7914
7967
|
alive = false;
|
|
@@ -9326,17 +9379,20 @@ function PaymentIsland(props) {
|
|
|
9326
9379
|
const exToAsset = exTo?.symbol;
|
|
9327
9380
|
const normEx = normalizeDecimalText(exAmount);
|
|
9328
9381
|
const exAmountValid = /^\d+(\.\d+)?$/.test(normEx) && Number(normEx) > 0 && Number(normEx) <= 1e9;
|
|
9329
|
-
const
|
|
9330
|
-
|
|
9331
|
-
|
|
9332
|
-
|
|
9333
|
-
|
|
9334
|
-
|
|
9335
|
-
|
|
9336
|
-
|
|
9337
|
-
|
|
9338
|
-
|
|
9339
|
-
|
|
9382
|
+
const {
|
|
9383
|
+
catalogue,
|
|
9384
|
+
loading: catalogueLoading,
|
|
9385
|
+
failed: catalogueFailed,
|
|
9386
|
+
retry: retryCatalogue
|
|
9387
|
+
} = useCatalogue(engine, {
|
|
9388
|
+
// Pay's funding picker draws from the FULL asset universe — the merchant's `fundingAssets` prop
|
|
9389
|
+
// is what narrows it, not this call — while the exchange pickers honour the host's `assets`.
|
|
9390
|
+
// Pay always builds the STABLE catalogue — its funding picker is bounded by the merchant's
|
|
9391
|
+
// `fundingAssets`, not by this call, and an RWA can never settle an invoice.
|
|
9392
|
+
allowedAssets: isPay ? void 0 : exAllowed,
|
|
9393
|
+
product: isPay ? "stable" : exProduct,
|
|
9394
|
+
enabled: !(bankSettlement || !isPay && rampMode)
|
|
9395
|
+
});
|
|
9340
9396
|
const chains = react.useMemo(() => {
|
|
9341
9397
|
const order = new Map(SUPPORTED_CHAINS.map((id, i) => [id, i]));
|
|
9342
9398
|
return [...catalogue?.chains ?? []].sort((a, b) => (order.get(Number(a.chainId)) ?? 99) - (order.get(Number(b.chainId)) ?? 99) || Number(a.chainId) - Number(b.chainId));
|
|
@@ -9787,7 +9843,9 @@ function PaymentIsland(props) {
|
|
|
9787
9843
|
tokens: isFrom ? exFromPicker : exToPicker,
|
|
9788
9844
|
balances: exBalances,
|
|
9789
9845
|
optionStates: isFrom ? void 0 : exDestinationStates,
|
|
9790
|
-
loading:
|
|
9846
|
+
loading: catalogueLoading,
|
|
9847
|
+
failed: catalogueFailed,
|
|
9848
|
+
onRetry: retryCatalogue,
|
|
9791
9849
|
onBack: () => closeSelector(openerRef),
|
|
9792
9850
|
onPick: (pick) => {
|
|
9793
9851
|
(isFrom ? setExFrom : setExTo)({ chainId: pick.chainId, symbol: symbolKey(pick.symbol) });
|
|
@@ -10192,22 +10250,12 @@ function PayCard(props) {
|
|
|
10192
10250
|
}
|
|
10193
10251
|
return map;
|
|
10194
10252
|
}, [annotated, holdings.loading, unquoted, listBalances]);
|
|
10195
|
-
const
|
|
10253
|
+
const { catalogue } = useCatalogue(engine, { enabled: props.variant !== "pill" });
|
|
10196
10254
|
const chains = react.useMemo(() => {
|
|
10197
10255
|
const order = new Map(SUPPORTED_CHAINS.map((id, i) => [id, i]));
|
|
10198
10256
|
return [...catalogue?.chains ?? []].sort((a, b) => (order.get(Number(a.chainId)) ?? 99) - (order.get(Number(b.chainId)) ?? 99) || Number(a.chainId) - Number(b.chainId));
|
|
10199
10257
|
}, [catalogue]);
|
|
10200
10258
|
const registryTokens = react.useMemo(() => catalogue?.tokens ?? [], [catalogue]);
|
|
10201
|
-
react.useEffect(() => {
|
|
10202
|
-
if (props.variant === "pill") return;
|
|
10203
|
-
let alive = true;
|
|
10204
|
-
engine.fetchCatalogue().then((next) => {
|
|
10205
|
-
if (alive) setCatalogue(next);
|
|
10206
|
-
});
|
|
10207
|
-
return () => {
|
|
10208
|
-
alive = false;
|
|
10209
|
-
};
|
|
10210
|
-
}, [engine, props.variant]);
|
|
10211
10259
|
const fundingTokens = react.useMemo(() => {
|
|
10212
10260
|
const seen = /* @__PURE__ */ new Set();
|
|
10213
10261
|
const list = [];
|
|
@@ -10449,17 +10497,8 @@ function StableGenieSwap(props) {
|
|
|
10449
10497
|
const recipientState = useRecipient(toChainId, props.recipient);
|
|
10450
10498
|
const recipient2 = recipientState.recipient;
|
|
10451
10499
|
const needsRecipient = recipientState.missing || !!recipientState.error;
|
|
10452
|
-
const
|
|
10453
|
-
|
|
10454
|
-
if (props.variant === "pill") return;
|
|
10455
|
-
let alive = true;
|
|
10456
|
-
engine.fetchCatalogue().then((next) => {
|
|
10457
|
-
if (alive && next.ready) setCatalogue(next);
|
|
10458
|
-
});
|
|
10459
|
-
return () => {
|
|
10460
|
-
alive = false;
|
|
10461
|
-
};
|
|
10462
|
-
}, [engine, props.variant]);
|
|
10500
|
+
const { catalogue: liveCatalogue } = useCatalogue(engine, { enabled: props.variant !== "pill" });
|
|
10501
|
+
const catalogue = liveCatalogue?.ready ? liveCatalogue : null;
|
|
10463
10502
|
const assetOptions = react.useMemo(() => {
|
|
10464
10503
|
if (!catalogue) return bundledAssetOptions;
|
|
10465
10504
|
const symbols = [...new Set(catalogue.tokens.map((t) => t.symbol.toUpperCase()))];
|
|
@@ -10921,17 +10960,12 @@ function ExchangeCard(props) {
|
|
|
10921
10960
|
const isPill = props.variant === "pill";
|
|
10922
10961
|
const product = props.product ?? "stable";
|
|
10923
10962
|
const allowed = react.useMemo(() => props.assets?.length ? props.assets.map((a) => symbolKey(a)) : void 0, [props.assets]);
|
|
10924
|
-
const
|
|
10925
|
-
|
|
10926
|
-
|
|
10927
|
-
|
|
10928
|
-
|
|
10929
|
-
|
|
10930
|
-
});
|
|
10931
|
-
return () => {
|
|
10932
|
-
alive = false;
|
|
10933
|
-
};
|
|
10934
|
-
}, [engine, allowed, product, isPill]);
|
|
10963
|
+
const { catalogue, loading: catalogueLoading, failed: catalogueFailed, retry: retryCatalogue } = useCatalogue(engine, {
|
|
10964
|
+
allowedAssets: allowed,
|
|
10965
|
+
product,
|
|
10966
|
+
solanaSources: true,
|
|
10967
|
+
enabled: !isPill
|
|
10968
|
+
});
|
|
10935
10969
|
const chains = react.useMemo(() => {
|
|
10936
10970
|
const order = new Map(SUPPORTED_CHAINS.map((id, i) => [id, i]));
|
|
10937
10971
|
return [...catalogue?.chains ?? []].sort((a, b) => (order.get(Number(a.chainId)) ?? 99) - (order.get(Number(b.chainId)) ?? 99) || Number(a.chainId) - Number(b.chainId));
|
|
@@ -11382,7 +11416,9 @@ function ExchangeCard(props) {
|
|
|
11382
11416
|
tokens: isFrom ? fromPickerTokens : toPickerVisible,
|
|
11383
11417
|
balances,
|
|
11384
11418
|
optionStates: isFrom ? void 0 : destinationStates,
|
|
11385
|
-
loading:
|
|
11419
|
+
loading: catalogueLoading,
|
|
11420
|
+
failed: catalogueFailed,
|
|
11421
|
+
onRetry: retryCatalogue,
|
|
11386
11422
|
walletMissing: (t) => isSolanaChainId(t.chainId) && !solanaWallet.address,
|
|
11387
11423
|
onBack: () => closeSelector(isFrom),
|
|
11388
11424
|
onPick: (pick) => {
|
package/dist/mount.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { mount } from './chunk-
|
|
2
|
-
import './chunk-
|
|
1
|
+
export { mount } from './chunk-LMK5C6VA.js';
|
|
2
|
+
import './chunk-OIJN6SHV.js';
|