@glacislabs/stablegenie-zerodelta 4.13.0 → 4.13.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/LICENSE +21 -21
- package/README.md +223 -223
- package/dist/{chunk-52MY5D3D.js → chunk-6WFIFKZ4.js} +198 -28
- package/dist/{chunk-BYAKXZ5E.js → chunk-M55J3P64.js} +211 -49
- package/dist/core/index.cjs +208 -27
- package/dist/core/index.d.cts +85 -3
- package/dist/core/index.d.ts +85 -3
- package/dist/core/index.js +1 -1
- package/dist/index.cjs +421 -87
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -2
- package/dist/{mount-bKSKIGmW.d.ts → mount-B6soKC-9.d.ts} +1 -1
- package/dist/{mount-BR3wWmjt.d.cts → mount-CEy4Nqky.d.cts} +1 -1
- package/dist/mount.cjs +421 -87
- 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 +10 -9
- package/dist/{verify-DdSA23GJ.d.cts → verify-Y9jZ83T5.d.cts} +3 -0
- package/dist/{verify-DdSA23GJ.d.ts → verify-Y9jZ83T5.d.ts} +3 -0
- package/package.json +134 -134
package/dist/index.cjs
CHANGED
|
@@ -573,6 +573,134 @@ var init_ed255192 = __esm({
|
|
|
573
573
|
"src/core/ed25519.ts"() {
|
|
574
574
|
}
|
|
575
575
|
});
|
|
576
|
+
|
|
577
|
+
// src/core/delivery.ts
|
|
578
|
+
var FAILED = /* @__PURE__ */ new Set(["cancelled", "fill_failed", "delivery_failed", "expired", "failed"]);
|
|
579
|
+
var ATTENTION = /* @__PURE__ */ new Set(["cancel_pending", "awaiting_claim"]);
|
|
580
|
+
var TRACKING = Object.freeze({ phase: "tracking", status: "", steps: [] });
|
|
581
|
+
var word = (v) => typeof v === "string" ? v.trim().toLowerCase() : "";
|
|
582
|
+
function normalizeDelivery(raw2) {
|
|
583
|
+
const row = raw2 && typeof raw2 === "object" && !Array.isArray(raw2) ? raw2.data ?? raw2 : null;
|
|
584
|
+
if (!row || typeof row !== "object" || Array.isArray(row)) return TRACKING;
|
|
585
|
+
const r = row;
|
|
586
|
+
const chained = r.isChained === true || Array.isArray(r.legs) && r.legs.length > 1;
|
|
587
|
+
const journey = word(r.journeyStatus);
|
|
588
|
+
const own = word(r.status);
|
|
589
|
+
const status = journey || own;
|
|
590
|
+
const rawSteps = Array.isArray(r.steps) ? r.steps : [];
|
|
591
|
+
const steps = rawSteps.filter((s) => s && typeof s === "object" && typeof s.stepName === "string").sort((a, b) => Number(a.stepNumber ?? 0) - Number(b.stepNumber ?? 0)).slice(0, 8).map((s) => ({ name: String(s.stepName).slice(0, 32), done: s.stepStatus === "completed" }));
|
|
592
|
+
if (!status) return TRACKING;
|
|
593
|
+
if (FAILED.has(status)) return { phase: "failed", status, steps };
|
|
594
|
+
if (ATTENTION.has(status)) return { phase: "attention", status, steps };
|
|
595
|
+
if (status === "delivered" && !(chained && !journey)) return { phase: "delivered", status, steps: steps.map((s) => ({ ...s, done: true })) };
|
|
596
|
+
return { phase: "in-progress", status: status === "delivered" ? "continuing" : status, steps };
|
|
597
|
+
}
|
|
598
|
+
var HASH = /^(?:0x[0-9a-fA-F]{64}|[1-9A-HJ-NP-Za-km-z]{64,88})$/;
|
|
599
|
+
function sameOrder(raw2, hash2) {
|
|
600
|
+
const row = raw2 && typeof raw2 === "object" ? raw2.data ?? raw2 : null;
|
|
601
|
+
const got = row && typeof row === "object" ? row.txHash : void 0;
|
|
602
|
+
if (typeof got !== "string" || !got) return false;
|
|
603
|
+
return hash2.startsWith("0x") ? got.toLowerCase() === hash2.toLowerCase() : got === hash2;
|
|
604
|
+
}
|
|
605
|
+
async function fetchDelivery(api, hash2) {
|
|
606
|
+
if (typeof hash2 !== "string" || !HASH.test(hash2)) return TRACKING;
|
|
607
|
+
try {
|
|
608
|
+
const raw2 = await api.apiRequest(`/transactions/${hash2}`, { timeoutMs: 8e3 });
|
|
609
|
+
return sameOrder(raw2, hash2) ? normalizeDelivery(raw2) : TRACKING;
|
|
610
|
+
} catch {
|
|
611
|
+
return TRACKING;
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
// src/react/hooks/useDelivery.ts
|
|
616
|
+
function deliveryPollDelay(elapsedMs) {
|
|
617
|
+
if (elapsedMs < 6e4) return 5e3;
|
|
618
|
+
if (elapsedMs < 11 * 6e4) return 15e3;
|
|
619
|
+
return 3e4;
|
|
620
|
+
}
|
|
621
|
+
var DELIVERY_GIVE_UP_MS = 2 * 60 * 60 * 1e3;
|
|
622
|
+
var UNANSWERED_LIMIT = 20;
|
|
623
|
+
var UNAVAILABLE = Object.freeze({ phase: "unavailable", status: "", steps: [] });
|
|
624
|
+
var hidden = () => typeof document !== "undefined" && document.visibilityState === "hidden";
|
|
625
|
+
function useDelivery(engine, hash2) {
|
|
626
|
+
const [state, setState] = react.useState({ hash: null, value: TRACKING });
|
|
627
|
+
react.useEffect(() => {
|
|
628
|
+
if (!hash2) return;
|
|
629
|
+
let alive = true;
|
|
630
|
+
let timer2;
|
|
631
|
+
let answered = false;
|
|
632
|
+
let unanswered = 0;
|
|
633
|
+
const started2 = Date.now();
|
|
634
|
+
setState({ hash: hash2, value: TRACKING });
|
|
635
|
+
const schedule = () => {
|
|
636
|
+
if (Date.now() - started2 > DELIVERY_GIVE_UP_MS) return setState({ hash: hash2, value: UNAVAILABLE });
|
|
637
|
+
timer2 = setTimeout(tick, deliveryPollDelay(Date.now() - started2));
|
|
638
|
+
};
|
|
639
|
+
const tick = async () => {
|
|
640
|
+
timer2 = void 0;
|
|
641
|
+
if (hidden()) return schedule();
|
|
642
|
+
const next = await engine.trackDelivery(hash2);
|
|
643
|
+
if (!alive) return;
|
|
644
|
+
if (next.phase === "tracking") {
|
|
645
|
+
if (!answered && ++unanswered >= UNANSWERED_LIMIT) return setState({ hash: hash2, value: UNAVAILABLE });
|
|
646
|
+
return schedule();
|
|
647
|
+
}
|
|
648
|
+
answered = true;
|
|
649
|
+
setState({ hash: hash2, value: next });
|
|
650
|
+
if (next.phase === "delivered" || next.phase === "failed") return;
|
|
651
|
+
schedule();
|
|
652
|
+
};
|
|
653
|
+
const onVisible2 = () => {
|
|
654
|
+
if (!alive || hidden() || !timer2) return;
|
|
655
|
+
clearTimeout(timer2);
|
|
656
|
+
void tick();
|
|
657
|
+
};
|
|
658
|
+
void tick();
|
|
659
|
+
if (typeof document !== "undefined") document.addEventListener("visibilitychange", onVisible2);
|
|
660
|
+
return () => {
|
|
661
|
+
alive = false;
|
|
662
|
+
if (timer2) clearTimeout(timer2);
|
|
663
|
+
if (typeof document !== "undefined") document.removeEventListener("visibilitychange", onVisible2);
|
|
664
|
+
};
|
|
665
|
+
}, [engine, hash2]);
|
|
666
|
+
return state.hash === hash2 ? state.value : TRACKING;
|
|
667
|
+
}
|
|
668
|
+
var STEP_LABEL = {
|
|
669
|
+
submitted: "Submitted",
|
|
670
|
+
arrived: "Arrived",
|
|
671
|
+
filled: "Filled",
|
|
672
|
+
outbound_bridging: "Bridging",
|
|
673
|
+
delivered: "Delivered"
|
|
674
|
+
};
|
|
675
|
+
var label = (name) => STEP_LABEL[name] ?? name.replace(/_/g, " ");
|
|
676
|
+
function deliveryHeadline(delivery, sourceConfirmed, direct = false) {
|
|
677
|
+
if (direct) return sourceConfirmed ? "Delivered" : "Submitted \u2014 awaiting confirmation";
|
|
678
|
+
switch (delivery.phase) {
|
|
679
|
+
case "delivered":
|
|
680
|
+
return "Delivered";
|
|
681
|
+
case "failed":
|
|
682
|
+
return delivery.status === "cancelled" ? "Cancelled \u2014 not delivered" : `Not delivered (${delivery.status.replace(/_/g, " ")}) \u2014 open the transaction for details`;
|
|
683
|
+
case "attention":
|
|
684
|
+
return delivery.status === "cancel_pending" ? "Being cancelled \u2014 not delivered" : "Waiting to be claimed \u2014 open the transaction";
|
|
685
|
+
case "in-progress": {
|
|
686
|
+
if (delivery.status === "continuing") return "On its way \u2014 final leg next";
|
|
687
|
+
const next = delivery.steps.find((s) => !s.done);
|
|
688
|
+
return next ? `On its way \u2014 ${label(next.name).toLowerCase()} next` : "On its way";
|
|
689
|
+
}
|
|
690
|
+
case "unavailable":
|
|
691
|
+
return sourceConfirmed ? "Sent \u2014 open the transaction to follow delivery" : "Submitted \u2014 awaiting confirmation";
|
|
692
|
+
default:
|
|
693
|
+
return sourceConfirmed ? "Sent \u2014 tracking delivery" : "Submitted \u2014 awaiting confirmation";
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
function isDelivered(delivery, sourceConfirmed, direct = false) {
|
|
697
|
+
return direct ? sourceConfirmed : delivery.phase === "delivered";
|
|
698
|
+
}
|
|
699
|
+
function DeliverySteps(props) {
|
|
700
|
+
const { steps, phase } = props.delivery;
|
|
701
|
+
if (!steps.length || phase === "failed") return null;
|
|
702
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-success-steps", "data-testid": "delivery-steps", "data-phase": phase, children: steps.map((s) => `${label(s.name)}${s.done ? " \u2713" : ""}`).join(" \xB7 ") });
|
|
703
|
+
}
|
|
576
704
|
var ConfigContext = react.createContext({});
|
|
577
705
|
function StableGenieProvider({ children, ...config }) {
|
|
578
706
|
return /* @__PURE__ */ jsxRuntime.jsx(ConfigContext.Provider, { value: config, children });
|
|
@@ -1048,9 +1176,9 @@ function normalizeAddress(value) {
|
|
|
1048
1176
|
if (!isAddress(value)) return null;
|
|
1049
1177
|
return String(value).toLowerCase();
|
|
1050
1178
|
}
|
|
1051
|
-
function assertAddress(value,
|
|
1179
|
+
function assertAddress(value, label2) {
|
|
1052
1180
|
const normalized = normalizeAddress(value);
|
|
1053
|
-
if (!normalized || normalized === ZERO_ADDRESS) throw new Error(`${
|
|
1181
|
+
if (!normalized || normalized === ZERO_ADDRESS) throw new Error(`${label2} is not a valid EVM address.`);
|
|
1054
1182
|
return normalized;
|
|
1055
1183
|
}
|
|
1056
1184
|
function resolveSwapReceiver(recipient2, payer, destinationChainId) {
|
|
@@ -1068,8 +1196,8 @@ function chainAddressKey(chainId, value) {
|
|
|
1068
1196
|
const text = String(value || "");
|
|
1069
1197
|
return isSolanaChainId(chainId) ? text.trim() : text.toLowerCase();
|
|
1070
1198
|
}
|
|
1071
|
-
function assertChainAddress(chainId, value,
|
|
1072
|
-
if (!isSolanaChainId(chainId)) return assertAddress(value,
|
|
1199
|
+
function assertChainAddress(chainId, value, label2) {
|
|
1200
|
+
if (!isSolanaChainId(chainId)) return assertAddress(value, label2);
|
|
1073
1201
|
if (!String(value || "").trim()) throw new Error("Connect a Solana wallet or enter a Solana recipient address.");
|
|
1074
1202
|
if (!isSolanaAddress(value)) throw new Error("Not a valid Solana address.");
|
|
1075
1203
|
return String(value).trim();
|
|
@@ -1145,9 +1273,9 @@ function encodeSubmitOrder(orders, partnerId = NO_PARTNER_ID) {
|
|
|
1145
1273
|
const tuples = orders.map(encodeOrderTuple);
|
|
1146
1274
|
let offset = 32n * BigInt(tuples.length);
|
|
1147
1275
|
const offsets = tuples.map((tuple) => {
|
|
1148
|
-
const
|
|
1276
|
+
const word2 = uintWord(offset);
|
|
1149
1277
|
offset += BigInt(tuple.length / 2);
|
|
1150
|
-
return
|
|
1278
|
+
return word2;
|
|
1151
1279
|
}).join("");
|
|
1152
1280
|
return `0x${SUBMIT_ORDER_SELECTOR.slice(2)}${uintWord(64)}${bytes32Word(partnerId)}${uintWord(tuples.length)}${offsets}${tuples.join("")}`;
|
|
1153
1281
|
}
|
|
@@ -1158,21 +1286,21 @@ function decodeSubmitOrderCalldata(data) {
|
|
|
1158
1286
|
if (`0x${hex.slice(0, 8)}` !== SUBMIT_ORDER_SELECTOR) return null;
|
|
1159
1287
|
const body = hex.slice(8);
|
|
1160
1288
|
const totalBytes = body.length / 2;
|
|
1161
|
-
const
|
|
1289
|
+
const word2 = (byteOffset) => {
|
|
1162
1290
|
if (!Number.isSafeInteger(byteOffset) || byteOffset < 0 || byteOffset + 32 > totalBytes) return null;
|
|
1163
1291
|
return BigInt(`0x${body.slice(byteOffset * 2, byteOffset * 2 + 64)}`);
|
|
1164
1292
|
};
|
|
1165
1293
|
const addressAt = (byteOffset) => {
|
|
1166
|
-
const w =
|
|
1294
|
+
const w = word2(byteOffset);
|
|
1167
1295
|
if (w === null || w >= 1n << 160n) return null;
|
|
1168
1296
|
return `0x${w.toString(16).padStart(40, "0")}`;
|
|
1169
1297
|
};
|
|
1170
1298
|
const uint64At = (byteOffset) => {
|
|
1171
|
-
const w =
|
|
1299
|
+
const w = word2(byteOffset);
|
|
1172
1300
|
return w === null || w > MAX_UINT64 ? null : w;
|
|
1173
1301
|
};
|
|
1174
1302
|
const keyBytesAt = (byteOffset) => {
|
|
1175
|
-
const len =
|
|
1303
|
+
const len = word2(byteOffset);
|
|
1176
1304
|
if (len !== 20n && len !== 32n) return null;
|
|
1177
1305
|
const length = Number(len);
|
|
1178
1306
|
const padded = Math.ceil(length / 32) * 32;
|
|
@@ -1180,25 +1308,25 @@ function decodeSubmitOrderCalldata(data) {
|
|
|
1180
1308
|
if (content.length !== padded * 2 || content.slice(length * 2) !== "0".repeat((padded - length) * 2)) return null;
|
|
1181
1309
|
return { value: `0x${content.slice(0, length * 2)}`, size: 32 + padded };
|
|
1182
1310
|
};
|
|
1183
|
-
if (
|
|
1184
|
-
if (
|
|
1311
|
+
if (word2(0) !== 64n) return null;
|
|
1312
|
+
if (word2(32) === null) return null;
|
|
1185
1313
|
const partnerId = `0x${body.slice(64, 128)}`;
|
|
1186
|
-
const count =
|
|
1314
|
+
const count = word2(64);
|
|
1187
1315
|
if (count === null || count < 1n || count > BigInt(MAX_DECODED_ORDERS)) return null;
|
|
1188
1316
|
const n = Number(count);
|
|
1189
1317
|
const arrayBase = 96;
|
|
1190
1318
|
let next = arrayBase + 32 * n;
|
|
1191
1319
|
const orders = [];
|
|
1192
1320
|
for (let i = 0; i < n; i += 1) {
|
|
1193
|
-
const rel =
|
|
1321
|
+
const rel = word2(arrayBase + i * 32);
|
|
1194
1322
|
if (rel === null || rel !== BigInt(next - arrayBase)) return null;
|
|
1195
1323
|
const base = next;
|
|
1196
1324
|
const owner = addressAt(base);
|
|
1197
1325
|
const bidToken = addressAt(base + 32);
|
|
1198
|
-
const bidTokenAmount =
|
|
1199
|
-
const askOffset =
|
|
1200
|
-
const askTokenAmount =
|
|
1201
|
-
const receiverOffset =
|
|
1326
|
+
const bidTokenAmount = word2(base + 64);
|
|
1327
|
+
const askOffset = word2(base + 96);
|
|
1328
|
+
const askTokenAmount = word2(base + 128);
|
|
1329
|
+
const receiverOffset = word2(base + 160);
|
|
1202
1330
|
const destinationChainId = uint64At(base + 192);
|
|
1203
1331
|
const executionChainId = uint64At(base + 224);
|
|
1204
1332
|
const deadline = uint64At(base + 256);
|
|
@@ -1821,8 +1949,8 @@ function freeze(value) {
|
|
|
1821
1949
|
}
|
|
1822
1950
|
return value;
|
|
1823
1951
|
}
|
|
1824
|
-
function raw(value,
|
|
1825
|
-
if (typeof value !== "string" || !/^\d+$/.test(value) || positive && BigInt(value) <= 0n || BigInt(value) >= 1n << 256n) throw new Error(`Invalid ${
|
|
1952
|
+
function raw(value, label2, positive = false) {
|
|
1953
|
+
if (typeof value !== "string" || !/^\d+$/.test(value) || positive && BigInt(value) <= 0n || BigInt(value) >= 1n << 256n) throw new Error(`Invalid ${label2}.`);
|
|
1826
1954
|
return value;
|
|
1827
1955
|
}
|
|
1828
1956
|
function chain(value) {
|
|
@@ -1935,6 +2063,12 @@ async function previewSolanaSource(api, input) {
|
|
|
1935
2063
|
nativeFeeRaw: "0"
|
|
1936
2064
|
};
|
|
1937
2065
|
}
|
|
2066
|
+
function solanaQuoteCompliance(quote) {
|
|
2067
|
+
for (const value of [quote?.complianceDecision, quote?.compliance]) {
|
|
2068
|
+
if (value && typeof value === "object" && !Array.isArray(value)) return value;
|
|
2069
|
+
}
|
|
2070
|
+
return void 0;
|
|
2071
|
+
}
|
|
1938
2072
|
function denied(value) {
|
|
1939
2073
|
return typeof value === "string" ? value.toUpperCase() === "DENY" : !!value && typeof value === "object" && denied(value.decision);
|
|
1940
2074
|
}
|
|
@@ -2052,6 +2186,7 @@ function createSolanaRpc(api) {
|
|
|
2052
2186
|
body: JSON.stringify({ jsonrpc: "2.0", id: 1, method, params }),
|
|
2053
2187
|
timeoutMs: 15e3
|
|
2054
2188
|
});
|
|
2189
|
+
if (body.error && solanaLamportShortfall(body.error.data?.logs) !== null) throw new Error(SOL_SHORTFALL_MESSAGE);
|
|
2055
2190
|
if (body.error || body.result === void 0) throw new Error(body.error?.message || "Invalid Solana RPC response.");
|
|
2056
2191
|
return body.result;
|
|
2057
2192
|
};
|
|
@@ -2216,18 +2351,141 @@ async function readSolanaBalance(rpc, owner, mint) {
|
|
|
2216
2351
|
return void 0;
|
|
2217
2352
|
}
|
|
2218
2353
|
}
|
|
2354
|
+
function solanaLamportShortfall(logs) {
|
|
2355
|
+
if (!Array.isArray(logs)) return null;
|
|
2356
|
+
for (const line of logs) {
|
|
2357
|
+
const m = /insufficient lamports (\d+), need (\d+)/.exec(String(line));
|
|
2358
|
+
if (m) {
|
|
2359
|
+
const need = Number(m[2]);
|
|
2360
|
+
return Number.isSafeInteger(need) && need > 0 ? need : null;
|
|
2361
|
+
}
|
|
2362
|
+
}
|
|
2363
|
+
return null;
|
|
2364
|
+
}
|
|
2365
|
+
var SOL_SHORTFALL_MESSAGE = "Not enough SOL in this wallet for the Solana network fee and account rent. Add a little SOL and try again.";
|
|
2219
2366
|
async function simulateSolanaCost(rpc, plan) {
|
|
2220
2367
|
checkSolanaPlan(plan.txData);
|
|
2221
2368
|
const signer = plan.expected.signer;
|
|
2222
2369
|
const before = await rpc("getAccountInfo", [signer, { encoding: "base64", commitment: "confirmed" }]);
|
|
2223
2370
|
const sim = await rpc("simulateTransaction", [plan.txData[0].transaction, { encoding: "base64", sigVerify: false, replaceRecentBlockhash: true, accounts: { addresses: [signer], encoding: "base64" } }]);
|
|
2224
|
-
if (sim.value?.err) throw new Error(`Simulation failed: ${JSON.stringify(sim.value.err)}`);
|
|
2225
2371
|
const balanceLamports = before.value?.lamports ?? 0, post = sim.value?.accounts?.[0]?.lamports;
|
|
2372
|
+
if (sim.value?.err) {
|
|
2373
|
+
const need = solanaLamportShortfall(sim.value.logs);
|
|
2374
|
+
if (need !== null && Number.isSafeInteger(balanceLamports)) return { lamports: need, balanceLamports, sufficient: false };
|
|
2375
|
+
throw new Error(`Simulation failed: ${JSON.stringify(sim.value.err)}`);
|
|
2376
|
+
}
|
|
2226
2377
|
if (!Number.isSafeInteger(balanceLamports) || balanceLamports < 0 || post !== void 0 && (!Number.isSafeInteger(post) || post < 0)) throw new Error("Invalid simulation lamports.");
|
|
2227
2378
|
const lamports = typeof post === "number" ? Math.max(0, balanceLamports - post) : 0;
|
|
2228
2379
|
return { lamports, balanceLamports, sufficient: balanceLamports >= lamports };
|
|
2229
2380
|
}
|
|
2230
2381
|
|
|
2382
|
+
// src/core/history.ts
|
|
2383
|
+
var WALLET_HISTORY_LIMIT = 50;
|
|
2384
|
+
var HASH2 = /^(?:0x[0-9a-fA-F]{64}|[1-9A-HJ-NP-Za-km-z]{64,88})$/;
|
|
2385
|
+
var WALLET = /^(?:0x[0-9a-fA-F]{40}|[1-9A-HJ-NP-Za-km-z]{32,44})$/;
|
|
2386
|
+
function historyKey(value) {
|
|
2387
|
+
return value.startsWith("0x") ? value.toLowerCase() : value;
|
|
2388
|
+
}
|
|
2389
|
+
var str = (v) => typeof v === "string" ? v : typeof v === "number" ? String(v) : "";
|
|
2390
|
+
function tokenAt(tokens, chainId, address) {
|
|
2391
|
+
if (!address) return void 0;
|
|
2392
|
+
const key = historyKey(address);
|
|
2393
|
+
return tokens.find((t) => Number(t.chainId) === chainId && historyKey(String(t.address)) === key);
|
|
2394
|
+
}
|
|
2395
|
+
function amountOf(raw2, token, rowDecimals, rowAmount) {
|
|
2396
|
+
const decimals = token ? Number(token.decimals) : Number(rowDecimals);
|
|
2397
|
+
if (/^\d{1,78}$/.test(raw2) && Number.isInteger(decimals) && decimals > 0 && decimals <= 36) return formatUnits(raw2, decimals);
|
|
2398
|
+
return Number(rowDecimals) > 0 && /^\d+(?:\.\d+)?$/.test(rowAmount) ? rowAmount.slice(0, 40) : "";
|
|
2399
|
+
}
|
|
2400
|
+
function historyEntryFromOrder(raw2, tokens) {
|
|
2401
|
+
if (!raw2 || typeof raw2 !== "object" || Array.isArray(raw2)) return null;
|
|
2402
|
+
const r = raw2;
|
|
2403
|
+
const hash2 = str(r.txHash);
|
|
2404
|
+
if (!HASH2.test(hash2)) return null;
|
|
2405
|
+
const fromChainId = Number(r.sourceChainId) || 0;
|
|
2406
|
+
const toChainId = Number(r.finalDestChainId ?? r.destChainId) || 0;
|
|
2407
|
+
const from = tokenAt(tokens, fromChainId, str(r.fromTokenAddress));
|
|
2408
|
+
const toAddress = str(r.finalToTokenAddress) || str(r.toTokenAddress);
|
|
2409
|
+
const to = tokenAt(tokens, toChainId, toAddress);
|
|
2410
|
+
const fromAsset = (from?.symbol ?? str(r.fromTokenSymbol)).slice(0, 10);
|
|
2411
|
+
const toAsset = (to?.symbol ?? (str(r.finalToTokenSymbol) || str(r.toTokenSymbol))).slice(0, 10);
|
|
2412
|
+
const payAmount = amountOf(str(r.fromTokenRawAmount), from, r.fromTokenDecimals, str(r.fromTokenAmount));
|
|
2413
|
+
const receiveAmount = str(r.finalToTokenRawAmount) ? amountOf(str(r.finalToTokenRawAmount), to, r.finalToTokenDecimals, str(r.finalToTokenAmount)) : amountOf(str(r.toTokenRawAmount), to, r.toTokenDecimals, str(r.toTokenAmount));
|
|
2414
|
+
const delivery = normalizeDelivery(r).phase;
|
|
2415
|
+
const wallet = str(r.wallet);
|
|
2416
|
+
const receiver = str(r.destinationReceiver);
|
|
2417
|
+
const at = str(r.createdAt) || str(r.submittedAt);
|
|
2418
|
+
return {
|
|
2419
|
+
kind: "swap",
|
|
2420
|
+
hash: hash2,
|
|
2421
|
+
txKind: "submitOrder",
|
|
2422
|
+
chainId: fromChainId || null,
|
|
2423
|
+
chainName: "",
|
|
2424
|
+
fromAsset,
|
|
2425
|
+
toAsset,
|
|
2426
|
+
fromTicker: from ? tokenTicker(from).slice(0, 12) : void 0,
|
|
2427
|
+
toTicker: to ? tokenTicker(to).slice(0, 12) : void 0,
|
|
2428
|
+
payAmount,
|
|
2429
|
+
receiveAmount,
|
|
2430
|
+
account: WALLET.test(wallet) ? historyKey(wallet) : "",
|
|
2431
|
+
recipient: WALLET.test(receiver) ? receiver : "",
|
|
2432
|
+
settlement: "escrow",
|
|
2433
|
+
status: "submitted",
|
|
2434
|
+
at: Number.isNaN(Date.parse(at)) ? (/* @__PURE__ */ new Date(0)).toISOString() : new Date(at).toISOString(),
|
|
2435
|
+
delivery: delivery === "tracking" || delivery === "unavailable" ? void 0 : delivery,
|
|
2436
|
+
legs: [
|
|
2437
|
+
{
|
|
2438
|
+
index: 1,
|
|
2439
|
+
fromAsset,
|
|
2440
|
+
fromTicker: from ? tokenTicker(from).slice(0, 12) : void 0,
|
|
2441
|
+
fromChainId,
|
|
2442
|
+
fromChainName: "",
|
|
2443
|
+
fromAmount: payAmount,
|
|
2444
|
+
toAsset,
|
|
2445
|
+
toTicker: to ? tokenTicker(to).slice(0, 12) : void 0,
|
|
2446
|
+
toChainId,
|
|
2447
|
+
toChainName: "",
|
|
2448
|
+
toAmount: receiveAmount,
|
|
2449
|
+
executionChainId: Number(r.executionChainId) || 0,
|
|
2450
|
+
executionChainName: ""
|
|
2451
|
+
}
|
|
2452
|
+
]
|
|
2453
|
+
};
|
|
2454
|
+
}
|
|
2455
|
+
async function fetchWalletHistory(api, wallets) {
|
|
2456
|
+
const asked = [...new Set(wallets.filter((w) => WALLET.test(w)).map(historyKey))];
|
|
2457
|
+
if (!asked.length) return [];
|
|
2458
|
+
const tokens = await api.fetchTokens().catch(() => []);
|
|
2459
|
+
const reads = await Promise.all(
|
|
2460
|
+
asked.map(async (wallet) => {
|
|
2461
|
+
try {
|
|
2462
|
+
const rows = await api.apiRequest(`/transactions?wallet=${encodeURIComponent(wallet)}&limit=${WALLET_HISTORY_LIMIT}`, { timeoutMs: 1e4 });
|
|
2463
|
+
if (!Array.isArray(rows)) return null;
|
|
2464
|
+
return rows.filter((row) => historyKey(str(row?.wallet)) === wallet).map((row) => historyEntryFromOrder(row, tokens));
|
|
2465
|
+
} catch {
|
|
2466
|
+
return null;
|
|
2467
|
+
}
|
|
2468
|
+
})
|
|
2469
|
+
);
|
|
2470
|
+
if (reads.every((read) => read === null)) return null;
|
|
2471
|
+
return reads.flatMap((read) => read ?? []).filter((e) => e !== null);
|
|
2472
|
+
}
|
|
2473
|
+
function mergeHistory(local, remote, limit = WALLET_HISTORY_LIMIT) {
|
|
2474
|
+
const byHash = /* @__PURE__ */ new Map();
|
|
2475
|
+
for (const entry of remote ?? []) if (!byHash.has(historyKey(entry.hash))) byHash.set(historyKey(entry.hash), entry);
|
|
2476
|
+
const out = [];
|
|
2477
|
+
const seen = /* @__PURE__ */ new Set();
|
|
2478
|
+
for (const entry of local) {
|
|
2479
|
+
const key = historyKey(entry.hash);
|
|
2480
|
+
if (seen.has(key)) continue;
|
|
2481
|
+
seen.add(key);
|
|
2482
|
+
const known = byHash.get(key);
|
|
2483
|
+
out.push(known ? { ...entry, delivery: known.delivery, legs: entry.legs ?? known.legs } : entry);
|
|
2484
|
+
}
|
|
2485
|
+
for (const [key, entry] of byHash) if (!seen.has(key)) out.push(entry);
|
|
2486
|
+
return out.sort((a, b) => Date.parse(b.at) - Date.parse(a.at)).slice(0, limit);
|
|
2487
|
+
}
|
|
2488
|
+
|
|
2231
2489
|
// src/core/escrow.ts
|
|
2232
2490
|
function checkEscrow(chainId, quoteEscrow, chainsEscrow) {
|
|
2233
2491
|
const fromQuote = normalizeAddress(quoteEscrow);
|
|
@@ -2482,11 +2740,11 @@ function complianceView(compliance, hasQuote = true) {
|
|
|
2482
2740
|
};
|
|
2483
2741
|
}
|
|
2484
2742
|
if (decision === "REVIEW" || decision === "REMEDIATE") {
|
|
2485
|
-
const
|
|
2743
|
+
const word2 = decision.toLowerCase();
|
|
2486
2744
|
return {
|
|
2487
2745
|
tone: "warn",
|
|
2488
|
-
label: `Compliance: ${
|
|
2489
|
-
headline: `Manual ${
|
|
2746
|
+
label: `Compliance: ${word2} required`,
|
|
2747
|
+
headline: `Manual ${word2} required`,
|
|
2490
2748
|
blocked: false,
|
|
2491
2749
|
needsAction: true,
|
|
2492
2750
|
screened
|
|
@@ -2736,8 +2994,8 @@ var BLOCK_CATEGORY_LABELS = {
|
|
|
2736
2994
|
var BLOCK_LABEL_DEFAULT = "flagged by compliance screening";
|
|
2737
2995
|
function blockLabelFor(categories) {
|
|
2738
2996
|
for (const raw2 of categories) {
|
|
2739
|
-
const
|
|
2740
|
-
if (
|
|
2997
|
+
const label2 = BLOCK_CATEGORY_LABELS[String(raw2 || "").trim().toUpperCase()];
|
|
2998
|
+
if (label2) return label2;
|
|
2741
2999
|
}
|
|
2742
3000
|
return BLOCK_LABEL_DEFAULT;
|
|
2743
3001
|
}
|
|
@@ -2937,8 +3195,8 @@ function normalizeOrderRequest(order, payer, destination, fallbackExecutionChain
|
|
|
2937
3195
|
const executionChainId = String(order.executionChainId || fallbackExecutionChainId || "0");
|
|
2938
3196
|
if (!/^\d+$/.test(executionChainId) || BigInt(executionChainId) <= 0n) throw new Error("ZeroDelta quote did not include an execution chain.");
|
|
2939
3197
|
const solana = isSolanaChainId(order.destinationChainId || destination.chainId);
|
|
2940
|
-
const keyBytes2 = (value,
|
|
2941
|
-
if (!/^0x[0-9a-fA-F]{64}$/.test(String(value || ""))) throw new Error(`${
|
|
3198
|
+
const keyBytes2 = (value, label2) => {
|
|
3199
|
+
if (!/^0x[0-9a-fA-F]{64}$/.test(String(value || ""))) throw new Error(`${label2} is not a valid 32-byte Solana key.`);
|
|
2942
3200
|
return String(value).toLowerCase();
|
|
2943
3201
|
};
|
|
2944
3202
|
return {
|
|
@@ -3057,7 +3315,7 @@ function routeLabelFor(option, destinationToken, result) {
|
|
|
3057
3315
|
const bridge = result.quote.bridge ? ` via ${result.quote.bridge}` : "";
|
|
3058
3316
|
return `Swap ${optionTicker(option)} to ${tokenTicker(destinationToken)} and settle on ZeroDelta${bridge}.`;
|
|
3059
3317
|
}
|
|
3060
|
-
function
|
|
3318
|
+
function tokenAt2(tokens, chainId, address) {
|
|
3061
3319
|
const key = isSolanaChainId(chainId) ? hexToSolanaKey(address) || address : address;
|
|
3062
3320
|
const wanted = isChainAddress(chainId, key) ? chainAddressKey(chainId, key) : null;
|
|
3063
3321
|
if (!wanted || !tokens?.length) return void 0;
|
|
@@ -3081,7 +3339,7 @@ function buildLegs(orders, ctx) {
|
|
|
3081
3339
|
const order = orders[index];
|
|
3082
3340
|
const isLast = index === orders.length - 1;
|
|
3083
3341
|
const toChainId = Number(order.destinationChainId);
|
|
3084
|
-
const askToken = isLast ? ctx.destinationToken :
|
|
3342
|
+
const askToken = isLast ? ctx.destinationToken : tokenAt2(ctx.tokens, toChainId, order.askToken);
|
|
3085
3343
|
const toAsset = isLast ? ctx.destinationToken.symbol : askToken?.symbol ?? "";
|
|
3086
3344
|
const toTicker = askToken ? tokenTicker(askToken) : "";
|
|
3087
3345
|
const toDecimals = askToken ? assetDecimals(askToken) : void 0;
|
|
@@ -3299,7 +3557,7 @@ var CHANNEL_HEADER = "x-zd-channel";
|
|
|
3299
3557
|
var CHANNEL_VERSION_HEADER = "x-zd-channel-version";
|
|
3300
3558
|
var CHANNEL_ORIGIN_HEADER = "x-zd-channel-origin";
|
|
3301
3559
|
var WIDGET_CHANNEL = "widget";
|
|
3302
|
-
var WIDGET_VERSION = "4.13.
|
|
3560
|
+
var WIDGET_VERSION = "4.13.1" ;
|
|
3303
3561
|
var MAX_CHANNEL_VERSION_LEN = 32;
|
|
3304
3562
|
function sanitizeVersion(raw2) {
|
|
3305
3563
|
const v = String(raw2).trim();
|
|
@@ -3380,12 +3638,12 @@ function classifyQuoteError(error) {
|
|
|
3380
3638
|
const isBlock = isStructuredComplianceBlock(error) || !!catMatch || error.code === "blocked" || error.code === "compliance_block" || /\b(stolen|sanction(?:s|ed|ing)?|block(?:ed|list)|screen(?:ed|ing)?|compliance|ofac|denylist|blacklist)\b/i.test(haystack);
|
|
3381
3639
|
if (!isBlock) return null;
|
|
3382
3640
|
const category = (catMatch?.[1] || "").toUpperCase() || "COMPLIANCE";
|
|
3383
|
-
const
|
|
3641
|
+
const label2 = blockLabelFor([category]);
|
|
3384
3642
|
return {
|
|
3385
3643
|
blocked: true,
|
|
3386
3644
|
category,
|
|
3387
3645
|
reason: reasons.join(", ") || error.message || "",
|
|
3388
|
-
message: `This payment was blocked by compliance screening \u2014 the recipient is ${
|
|
3646
|
+
message: `This payment was blocked by compliance screening \u2014 the recipient is ${label2}. Choose a different recipient or connect a different wallet.`
|
|
3389
3647
|
};
|
|
3390
3648
|
}
|
|
3391
3649
|
function amountFieldError(error) {
|
|
@@ -3958,16 +4216,16 @@ function isHexQuantity(value) {
|
|
|
3958
4216
|
return /^0x[0-9a-fA-F]+$/.test(String(value));
|
|
3959
4217
|
}
|
|
3960
4218
|
function dataWord(data, index) {
|
|
3961
|
-
const
|
|
3962
|
-
return /^[a-fA-F0-9]{64}$/.test(
|
|
4219
|
+
const word2 = String(data || "").slice(10 + index * 64, 10 + (index + 1) * 64);
|
|
4220
|
+
return /^[a-fA-F0-9]{64}$/.test(word2) ? word2 : "";
|
|
3963
4221
|
}
|
|
3964
4222
|
function dataAddress(data, index) {
|
|
3965
|
-
const
|
|
3966
|
-
return
|
|
4223
|
+
const word2 = dataWord(data, index);
|
|
4224
|
+
return word2 ? `0x${word2.slice(24)}` : "";
|
|
3967
4225
|
}
|
|
3968
4226
|
function dataUint(data, index) {
|
|
3969
|
-
const
|
|
3970
|
-
return
|
|
4227
|
+
const word2 = dataWord(data, index);
|
|
4228
|
+
return word2 ? BigInt(`0x${word2}`) : null;
|
|
3971
4229
|
}
|
|
3972
4230
|
function rawEquals(value, expected) {
|
|
3973
4231
|
try {
|
|
@@ -4385,6 +4643,8 @@ function createEngine(config = {}) {
|
|
|
4385
4643
|
executeSolanaPlan: (input) => executeSolanaPlan({ ...input, rpc: input.rpc ?? solanaRpc }),
|
|
4386
4644
|
executeSolanaPlanStaged: (input) => executeSolanaPlanStaged({ ...input, rpc: input.rpc ?? solanaRpc }),
|
|
4387
4645
|
previewSolanaSource: (input) => previewSolanaSource(api, input),
|
|
4646
|
+
trackDelivery: (hash2) => fetchDelivery(api, hash2),
|
|
4647
|
+
fetchWalletHistory: (wallets) => fetchWalletHistory(api, wallets),
|
|
4388
4648
|
readSolanaBalance: (owner, mint) => readSolanaBalance(solanaRpc, owner, mint),
|
|
4389
4649
|
simulateSolanaCost: (plan) => simulateSolanaCost(solanaRpc, plan),
|
|
4390
4650
|
payerNonceBaseline: verifier.payerNonceBaseline,
|
|
@@ -5258,6 +5518,7 @@ var WIDGET_CSS = `
|
|
|
5258
5518
|
.sg-success-check{width:40px;height:40px;border-radius:999px;background:var(--sg-accent);color:var(--sg-accent-text);display:inline-flex;align-items:center;justify-content:center;margin-bottom:8px}
|
|
5259
5519
|
/* Broadcast but not receipt-confirmed: mute the disc so a pending settlement never wears the
|
|
5260
5520
|
accent-coloured "paid" affordance. Mirrors .sg-settle-disc[data-pending] in the island. */
|
|
5521
|
+
.sg-success-steps{font-size:12px;color:var(--sg-text-muted);margin-top:6px;text-align:center}
|
|
5261
5522
|
.sg-success-check[data-pending="true"]{background:var(--sg-surface);color:var(--sg-text-muted);border:1px solid var(--sg-border)}
|
|
5262
5523
|
.sg-success-amt{font-size:20px;font-weight:700;font-variant-numeric:tabular-nums}
|
|
5263
5524
|
.sg-success-sub{font-size:12px;color:var(--sg-text-muted);margin-top:2px}
|
|
@@ -6148,7 +6409,7 @@ function StepList(props) {
|
|
|
6148
6409
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: s.state === "done" ? "sg-muted" : "", children: s.label }),
|
|
6149
6410
|
rich ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-sr-only", children: ` \u2014 ${STEP_STATE_WORD[s.state]}` }) : null
|
|
6150
6411
|
] }, s.id)) }),
|
|
6151
|
-
rich && props.verdict && verifyDone ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-step-verdict", children: props.verdict.status === "confirmed" ? "Confirmed on-chain \u2014
|
|
6412
|
+
rich && props.verdict && verifyDone ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-step-verdict", children: props.verdict.status === "confirmed" ? "Confirmed on-chain \u2014 on its way to the merchant." : props.verdict.status === "mismatch" ? "The submitted transaction did not match the reviewed plan." : "Payment sent \u2014 confirmation is still pending." }) : null
|
|
6152
6413
|
] });
|
|
6153
6414
|
}
|
|
6154
6415
|
var SHOW_ROADMAP_METHODS = true;
|
|
@@ -6488,8 +6749,8 @@ var CHAIN_ALIASES = {
|
|
|
6488
6749
|
137: ["matic"],
|
|
6489
6750
|
43114: ["avax"]
|
|
6490
6751
|
};
|
|
6491
|
-
function labelForms(
|
|
6492
|
-
const lower2 =
|
|
6752
|
+
function labelForms(label2) {
|
|
6753
|
+
const lower2 = label2.trim().toLowerCase();
|
|
6493
6754
|
if (!lower2) return [];
|
|
6494
6755
|
const compact = lower2.replace(/[^a-z0-9]/g, "");
|
|
6495
6756
|
return compact && compact !== lower2 ? [lower2, compact] : [lower2];
|
|
@@ -6500,8 +6761,8 @@ function buildChainSearchTerms(chains) {
|
|
|
6500
6761
|
for (const id of ids) {
|
|
6501
6762
|
const chain2 = chains.find((c) => Number(c.chainId) === id);
|
|
6502
6763
|
const terms = /* @__PURE__ */ new Set();
|
|
6503
|
-
for (const
|
|
6504
|
-
if (
|
|
6764
|
+
for (const label2 of [chain2?.displayName, chain2?.name, typeof chain2?.slug === "string" ? chain2.slug : void 0, CHAIN_LABELS[id]]) {
|
|
6765
|
+
if (label2) for (const form of labelForms(label2)) terms.add(form);
|
|
6505
6766
|
}
|
|
6506
6767
|
for (const alias of CHAIN_ALIASES[id] ?? []) terms.add(alias);
|
|
6507
6768
|
byId.set(id, [...terms]);
|
|
@@ -6873,7 +7134,7 @@ function TokenSelect(props) {
|
|
|
6873
7134
|
const members = g.deployments;
|
|
6874
7135
|
const multi = members.length > 1;
|
|
6875
7136
|
const single = members[0];
|
|
6876
|
-
const
|
|
7137
|
+
const label2 = multi ? g.symbol : tokenTicker(single.token);
|
|
6877
7138
|
const blocked = !!g.unavailable;
|
|
6878
7139
|
const opensNetworks = multi || blocked;
|
|
6879
7140
|
const zero = showBalances && g.amount === 0 || blocked;
|
|
@@ -6897,7 +7158,7 @@ function TokenSelect(props) {
|
|
|
6897
7158
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-pk-left", children: [
|
|
6898
7159
|
/* @__PURE__ */ jsxRuntime.jsx(TokenPlate, { symbol: g.symbol, logoUrl: g.logoUrl }),
|
|
6899
7160
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-pk-text", children: [
|
|
6900
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-pk-label", children:
|
|
7161
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-pk-label", children: label2 }),
|
|
6901
7162
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-pk-line", children: [
|
|
6902
7163
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-pk-sub", children: multi ? showBalances ? "Total across" : "Available on" : `On ${chainName3(Number(single.token.chainId))}` }),
|
|
6903
7164
|
/* @__PURE__ */ jsxRuntime.jsx(ChainMarks, { chainIds: members.map((m) => Number(m.token.chainId)), chainById: chainById2, decorative: !multi }),
|
|
@@ -6906,7 +7167,7 @@ function TokenSelect(props) {
|
|
|
6906
7167
|
!multi && single.hint ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-pk-note", "data-testid": "lane-limit", children: single.hint }) : null
|
|
6907
7168
|
] })
|
|
6908
7169
|
] }),
|
|
6909
|
-
showBalances ? /* @__PURE__ */ jsxRuntime.jsx(BalanceColumn, { amount: g.amount, usd: g.usd, symbol:
|
|
7170
|
+
showBalances ? /* @__PURE__ */ jsxRuntime.jsx(BalanceColumn, { amount: g.amount, usd: g.usd, symbol: label2 }) : opensNetworks ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-pk-chev", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx(ChevronGlyph, {}) }) : null
|
|
6910
7171
|
]
|
|
6911
7172
|
},
|
|
6912
7173
|
g.key
|
|
@@ -7192,12 +7453,12 @@ function TriggerGlyph({ cv }) {
|
|
|
7192
7453
|
return /* @__PURE__ */ jsxRuntime.jsx(ShieldTick, {});
|
|
7193
7454
|
}
|
|
7194
7455
|
function CheckRow({ check: check2, onViewPolicy }) {
|
|
7195
|
-
const
|
|
7456
|
+
const label2 = check2.id === "risk" ? check2.ok ? "Risk screening passed" : "Risk screening failed" : check2.label;
|
|
7196
7457
|
return /* @__PURE__ */ jsxRuntime.jsxs("li", { className: "sg-cp-check", "data-ok": check2.ok, children: [
|
|
7197
7458
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-check-head", children: [
|
|
7198
7459
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-cp-check-label", children: [
|
|
7199
7460
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-check-mark", "data-ok": check2.ok, children: check2.ok ? /* @__PURE__ */ jsxRuntime.jsx(Tick, {}) : /* @__PURE__ */ jsxRuntime.jsx(Cross, {}) }),
|
|
7200
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { children:
|
|
7461
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: label2 }),
|
|
7201
7462
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-sr-only", children: check2.ok ? " \u2014 passed" : " \u2014 failed" })
|
|
7202
7463
|
] }),
|
|
7203
7464
|
check2.id === "risk" ? /* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", className: "sg-cp-link", onClick: onViewPolicy, children: [
|
|
@@ -7265,9 +7526,9 @@ function QuoteChecks({
|
|
|
7265
7526
|
] }) : null
|
|
7266
7527
|
] });
|
|
7267
7528
|
}
|
|
7268
|
-
function Fact({ label, value, title, mono = false }) {
|
|
7529
|
+
function Fact({ label: label2, value, title, mono = false }) {
|
|
7269
7530
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-fact", children: [
|
|
7270
|
-
/* @__PURE__ */ jsxRuntime.jsx("dt", { children:
|
|
7531
|
+
/* @__PURE__ */ jsxRuntime.jsx("dt", { children: label2 }),
|
|
7271
7532
|
/* @__PURE__ */ jsxRuntime.jsx("dd", { title, className: mono ? "sg-mono" : void 0, children: value })
|
|
7272
7533
|
] });
|
|
7273
7534
|
}
|
|
@@ -7396,6 +7657,39 @@ function useTxHistory(account) {
|
|
|
7396
7657
|
}, [account]);
|
|
7397
7658
|
return entries;
|
|
7398
7659
|
}
|
|
7660
|
+
var WALLET_HISTORY_REFRESH_MS = 3e4;
|
|
7661
|
+
var hidden2 = () => typeof document !== "undefined" && document.visibilityState === "hidden";
|
|
7662
|
+
var travelling = (entries) => !!entries?.some((e) => e.delivery === "in-progress" || e.delivery === "attention");
|
|
7663
|
+
function useWalletHistory(engine, wallets) {
|
|
7664
|
+
const [entries, setEntries] = react.useState(null);
|
|
7665
|
+
const key = wallets.filter((w) => !!w).join("|");
|
|
7666
|
+
react.useEffect(() => {
|
|
7667
|
+
setEntries(null);
|
|
7668
|
+
if (!engine || !key) return;
|
|
7669
|
+
let alive = true;
|
|
7670
|
+
let timer2;
|
|
7671
|
+
const read = async () => {
|
|
7672
|
+
if (timer2) clearTimeout(timer2);
|
|
7673
|
+
timer2 = void 0;
|
|
7674
|
+
if (!hidden2()) {
|
|
7675
|
+
const next = await engine.fetchWalletHistory(key.split("|"));
|
|
7676
|
+
if (!alive) return;
|
|
7677
|
+
if (next) setEntries(next);
|
|
7678
|
+
if (!travelling(next)) return;
|
|
7679
|
+
}
|
|
7680
|
+
timer2 = setTimeout(read, WALLET_HISTORY_REFRESH_MS);
|
|
7681
|
+
};
|
|
7682
|
+
void read();
|
|
7683
|
+
const onRecorded = () => void read();
|
|
7684
|
+
if (typeof window !== "undefined") window.addEventListener(TX_HISTORY_EVENT, onRecorded);
|
|
7685
|
+
return () => {
|
|
7686
|
+
alive = false;
|
|
7687
|
+
if (timer2) clearTimeout(timer2);
|
|
7688
|
+
if (typeof window !== "undefined") window.removeEventListener(TX_HISTORY_EVENT, onRecorded);
|
|
7689
|
+
};
|
|
7690
|
+
}, [engine, key]);
|
|
7691
|
+
return entries;
|
|
7692
|
+
}
|
|
7399
7693
|
function BackGlyph() {
|
|
7400
7694
|
return /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "17", height: "17", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.4", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
|
|
7401
7695
|
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M19 12H5" }),
|
|
@@ -7479,7 +7773,15 @@ function TxLegs(props) {
|
|
|
7479
7773
|
] }, `${leg.index}:${leg.fromChainId}:${leg.toChainId}`)) })
|
|
7480
7774
|
] });
|
|
7481
7775
|
}
|
|
7482
|
-
function statusBadge(
|
|
7776
|
+
function statusBadge(entry) {
|
|
7777
|
+
if (entry.delivery === "delivered")
|
|
7778
|
+
return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-badge", "data-tone": "ok", children: "Delivered" });
|
|
7779
|
+
if (entry.delivery === "failed")
|
|
7780
|
+
return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-badge", "data-tone": "warn", children: "Not delivered" });
|
|
7781
|
+
if (entry.delivery === "attention")
|
|
7782
|
+
return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-badge", "data-tone": "warn", children: "Needs action" });
|
|
7783
|
+
if (entry.delivery === "in-progress") return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-badge", children: "On its way" });
|
|
7784
|
+
const status = entry.status;
|
|
7483
7785
|
if (status === "confirmed")
|
|
7484
7786
|
return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-badge", "data-tone": "ok", children: "Confirmed" });
|
|
7485
7787
|
if (status === "error")
|
|
@@ -7551,7 +7853,7 @@ function TxHistoryList(props) {
|
|
|
7551
7853
|
] }),
|
|
7552
7854
|
whenLabel(e.at) ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-txrow-time", children: whenLabel(e.at) }) : null
|
|
7553
7855
|
] }),
|
|
7554
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-txrow-end", children: statusBadge(e
|
|
7856
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-txrow-end", children: statusBadge(e) })
|
|
7555
7857
|
] })
|
|
7556
7858
|
] }, `${e.hash}:${e.at}`)
|
|
7557
7859
|
)) });
|
|
@@ -7591,7 +7893,7 @@ function TxDetail(props) {
|
|
|
7591
7893
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-meta", children: [
|
|
7592
7894
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-meta-row", children: [
|
|
7593
7895
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-meta-label", children: "Status" }),
|
|
7594
|
-
statusBadge(e
|
|
7896
|
+
statusBadge(e)
|
|
7595
7897
|
] }),
|
|
7596
7898
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-meta-row", children: [
|
|
7597
7899
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-meta-label", children: "You sent" }),
|
|
@@ -7627,18 +7929,21 @@ function displayableHistory(entries, account) {
|
|
|
7627
7929
|
}
|
|
7628
7930
|
function TxHistoryPanel(props) {
|
|
7629
7931
|
const account = props.account;
|
|
7630
|
-
const
|
|
7631
|
-
const
|
|
7632
|
-
const
|
|
7932
|
+
const stored = useTxHistory(account);
|
|
7933
|
+
const remote = useWalletHistory(props.engine, [account, props.solanaAccount]);
|
|
7934
|
+
const entries = react.useMemo(() => mergeHistory(displayableHistory(stored, account), remote), [stored, account, remote]);
|
|
7935
|
+
const linked = props.initialEntry && displayableHistory([props.initialEntry], account).length ? props.initialEntry : null;
|
|
7936
|
+
const [selectedHash, setSelectedHash] = react.useState(linked?.hash ?? null);
|
|
7937
|
+
const selected = selectedHash ? entries.find((e) => e.hash === selectedHash) ?? (linked?.hash === selectedHash ? linked : null) : null;
|
|
7633
7938
|
const backRef = react.useRef(null);
|
|
7634
|
-
react.useEffect(() =>
|
|
7939
|
+
react.useEffect(() => setSelectedHash(linked?.hash ?? null), [linked?.hash]);
|
|
7635
7940
|
const pick = (entry) => {
|
|
7636
|
-
|
|
7941
|
+
setSelectedHash(entry.hash);
|
|
7637
7942
|
requestAnimationFrame(() => backRef.current?.focus());
|
|
7638
7943
|
};
|
|
7639
7944
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
7640
7945
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-sel-head", children: [
|
|
7641
|
-
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", autoFocus: true, ref: backRef, className: "sg-back", onClick: selected ? () =>
|
|
7946
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", autoFocus: true, ref: backRef, className: "sg-back", onClick: selected ? () => setSelectedHash(null) : props.onBack, "aria-label": "Back", children: /* @__PURE__ */ jsxRuntime.jsx(BackGlyph, {}) }),
|
|
7642
7947
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-sel-title", children: [
|
|
7643
7948
|
selected ? "Transaction" : "Transaction history",
|
|
7644
7949
|
account ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-sel-sub sg-mono", children: shortAddress2(account) }) : null
|
|
@@ -8727,6 +9032,9 @@ function PaymentIsland(props) {
|
|
|
8727
9032
|
const selectedVisible = Boolean(sel && visibleRoutes.some((r) => r.id === sel.id));
|
|
8728
9033
|
const selBal = sel ? holdings.balances[balanceKey(sel.source.chainId, sel.source.tokenAddress)] : void 0;
|
|
8729
9034
|
const lastTxOwned = Boolean(flow.lastTxEntry?.hash && wallet.account && flow.lastTxEntry.account === wallet.account.toLowerCase());
|
|
9035
|
+
const evmDirect = flow.lastTxEntry?.settlement === "direct";
|
|
9036
|
+
const evmConfirmed = flow.verdict?.status === "confirmed";
|
|
9037
|
+
const evmDelivery = useDelivery(engine, (flow.status === "success" || flow.status === "pending") && !evmDirect ? flow.txHash : null);
|
|
8730
9038
|
const mismatch = flow.status === "error" && flow.verdict?.status === "mismatch";
|
|
8731
9039
|
const destTicker = isPay ? tickerOn(registryTokens, props.toChainId, props.toAsset ?? "") : exToToken ? tokenTicker(exToToken) : exToAsset ?? "";
|
|
8732
9040
|
const exFromTicker = exFromToken ? tokenTicker(exFromToken) : exFromAsset ?? "";
|
|
@@ -8784,7 +9092,11 @@ function PaymentIsland(props) {
|
|
|
8784
9092
|
linkMenu
|
|
8785
9093
|
] }) : void 0;
|
|
8786
9094
|
const activeStep = flow.steps.find((s) => s.state === "active");
|
|
8787
|
-
const liveMsg = flow.status === "loading" ? isPay ? "Finding the best way to pay." : "Finding the best route." : flow.status === "submitting" ? `${activeStep?.label ?? (isPay ? "Processing your payment" : `Processing your ${verb.present.toLowerCase()}`)} \u2014 in progress.` : flow.status === "success" || flow.status === "pending" ?
|
|
9095
|
+
const liveMsg = flow.status === "loading" ? isPay ? "Finding the best way to pay." : "Finding the best route." : flow.status === "submitting" ? `${activeStep?.label ?? (isPay ? "Processing your payment" : `Processing your ${verb.present.toLowerCase()}`)} \u2014 in progress.` : flow.status === "success" || flow.status === "pending" ? (
|
|
9096
|
+
// Announces what the receipt shows: delivery from the tracker, never settlement on the
|
|
9097
|
+
// source receipt alone (review 2026-10-28).
|
|
9098
|
+
`${isPay ? "Payment" : verb.past}: ${deliveryHeadline(evmDelivery, evmConfirmed, evmDirect)}.`
|
|
9099
|
+
) : "";
|
|
8788
9100
|
const loading = flow.status === "loading";
|
|
8789
9101
|
const payReady = isPay ? Boolean(sel && selectedVisible) : Boolean(sel) && !needsRecipient;
|
|
8790
9102
|
const ctaLabel = submitting ? isPay ? "Paying\u2026" : kind === "swap" ? "Swapping\u2026" : "Exchanging\u2026" : flow.quoteStale ? flow.quotePaused ? "Refresh quote" : "Refreshing quote\u2026" : flow.insufficient ? "Insufficient balance" : flow.nativeShortfall ? flow.nativeShortfall : loading ? "Getting a price\u2026" : isPay ? sel && selectedVisible ? `Pay ${sel.source.payAmount} ${sel.source.ticker || sel.source.asset}` : "Pay" : kind === "swap" ? "Swap" : "Exchange";
|
|
@@ -8829,7 +9141,7 @@ function PaymentIsland(props) {
|
|
|
8829
9141
|
] });
|
|
8830
9142
|
let body;
|
|
8831
9143
|
if (hist && wallet.account) {
|
|
8832
|
-
body = /* @__PURE__ */ jsxRuntime.jsx(TxHistoryPanel, { account: wallet.account, tokens: registryTokens, vaultIcons: catalogue?.vaultIcons, initialEntry: hist.entry ?? null, onBack: closeHistory });
|
|
9144
|
+
body = /* @__PURE__ */ jsxRuntime.jsx(TxHistoryPanel, { account: wallet.account, engine, tokens: registryTokens, vaultIcons: catalogue?.vaultIcons, initialEntry: hist.entry ?? null, onBack: closeHistory });
|
|
8833
9145
|
} else if (isPay && view === "select" && wallet.account) {
|
|
8834
9146
|
body = /* @__PURE__ */ jsxRuntime.jsx(
|
|
8835
9147
|
TokenSelect,
|
|
@@ -8907,7 +9219,7 @@ function PaymentIsland(props) {
|
|
|
8907
9219
|
] })
|
|
8908
9220
|
] });
|
|
8909
9221
|
} else if (paid || settling) {
|
|
8910
|
-
const confirmed =
|
|
9222
|
+
const confirmed = isDelivered(evmDelivery, evmConfirmed, evmDirect);
|
|
8911
9223
|
body = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
8912
9224
|
/* @__PURE__ */ jsxRuntime.jsx(IdentityLine, { account: wallet.account, email: identity?.email }),
|
|
8913
9225
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-receipt", children: [
|
|
@@ -8919,9 +9231,10 @@ function PaymentIsland(props) {
|
|
|
8919
9231
|
destTicker
|
|
8920
9232
|
] }),
|
|
8921
9233
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-receipt-sub", children: [
|
|
8922
|
-
|
|
9234
|
+
deliveryHeadline(evmDelivery, evmConfirmed, evmDirect),
|
|
8923
9235
|
(flow.lastTxEntry?.recipient || recipient2) && (isPay || recipientState.recipientFamily === "solana") ? ` \xB7 ${shortAddress2(flow.lastTxEntry?.recipient || recipient2)}` : ""
|
|
8924
|
-
] })
|
|
9236
|
+
] }),
|
|
9237
|
+
evmDirect ? null : /* @__PURE__ */ jsxRuntime.jsx(DeliverySteps, { delivery: evmDelivery })
|
|
8925
9238
|
] }),
|
|
8926
9239
|
!identityMatchesWallet ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-remember", children: [
|
|
8927
9240
|
/* @__PURE__ */ jsxRuntime.jsxs("label", { className: "sg-remember-top", children: [
|
|
@@ -9346,6 +9659,9 @@ function PayCard(props) {
|
|
|
9346
9659
|
};
|
|
9347
9660
|
react.useEffect(() => setHist(null), [wallet.account]);
|
|
9348
9661
|
const lastTxOwned = Boolean(flow.lastTxEntry?.hash && wallet.account && flow.lastTxEntry.account === wallet.account.toLowerCase());
|
|
9662
|
+
const evmDirect = flow.lastTxEntry?.settlement === "direct";
|
|
9663
|
+
const evmConfirmed = flow.verdict?.status === "confirmed";
|
|
9664
|
+
const evmDelivery = useDelivery(engine, (flow.status === "success" || flow.status === "pending") && !evmDirect ? flow.txHash : null);
|
|
9349
9665
|
const pickFunding = (pick) => {
|
|
9350
9666
|
setPickError(null);
|
|
9351
9667
|
const r = visibleRoutes.find((x) => x.source.chainId === pick.chainId && symbolKey(x.source.asset) === symbolKey(pick.symbol));
|
|
@@ -9405,7 +9721,7 @@ function PayCard(props) {
|
|
|
9405
9721
|
...durationLabel(sel.quote.estimatedDuration) ? [{ label: "Estimated time", value: durationLabel(sel.quote.estimatedDuration) }] : []
|
|
9406
9722
|
] : [];
|
|
9407
9723
|
const loadingPlan = flow.status === "loading" || holdings.loading && !sel || pricing !== null;
|
|
9408
|
-
return /* @__PURE__ */ jsxRuntime.jsx(WidgetShell, { title: config.title || "Complete payment", theme: config.theme, heightPx: props.heightPx, walletSlot, onClose: props.onClose, children: hist && wallet.account ? /* @__PURE__ */ jsxRuntime.jsx(TxHistoryPanel, { account: wallet.account, tokens: registryTokens, vaultIcons: catalogue?.vaultIcons, initialEntry: hist.entry ?? null, onBack: closeHistory }) : view === "select" && wallet.account ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
9724
|
+
return /* @__PURE__ */ jsxRuntime.jsx(WidgetShell, { title: config.title || "Complete payment", theme: config.theme, heightPx: props.heightPx, walletSlot, onClose: props.onClose, children: hist && wallet.account ? /* @__PURE__ */ jsxRuntime.jsx(TxHistoryPanel, { account: wallet.account, engine, tokens: registryTokens, vaultIcons: catalogue?.vaultIcons, initialEntry: hist.entry ?? null, onBack: closeHistory }) : view === "select" && wallet.account ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
9409
9725
|
TokenSelect,
|
|
9410
9726
|
{
|
|
9411
9727
|
title: "Pay with",
|
|
@@ -9427,17 +9743,18 @@ function PayCard(props) {
|
|
|
9427
9743
|
] })
|
|
9428
9744
|
] }) : flow.status === "success" || flow.status === "pending" ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
9429
9745
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-success", children: [
|
|
9430
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-success-check", "data-pending":
|
|
9746
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-success-check", "data-pending": !isDelivered(evmDelivery, evmConfirmed, evmDirect), children: /* @__PURE__ */ jsxRuntime.jsx(CheckGlyph3, {}) }),
|
|
9431
9747
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-success-amt sg-mono", children: [
|
|
9432
9748
|
props.amount,
|
|
9433
9749
|
" ",
|
|
9434
9750
|
tickerOn(registryTokens, props.toChainId, props.toAsset)
|
|
9435
9751
|
] }),
|
|
9436
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-success-sub", children: [
|
|
9437
|
-
|
|
9752
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-success-sub", role: "status", "aria-live": "polite", children: [
|
|
9753
|
+
deliveryHeadline(evmDelivery, evmConfirmed, evmDirect),
|
|
9438
9754
|
" \xB7 ",
|
|
9439
9755
|
shortAddress2(props.recipient)
|
|
9440
|
-
] })
|
|
9756
|
+
] }),
|
|
9757
|
+
evmDirect ? null : /* @__PURE__ */ jsxRuntime.jsx(DeliverySteps, { delivery: evmDelivery })
|
|
9441
9758
|
] }),
|
|
9442
9759
|
lastTxOwned ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-cta-wrap", children: /* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "ghost", onClick: () => setHist({ entry: flow.lastTxEntry }), children: "View transaction" }) }) : null
|
|
9443
9760
|
] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
@@ -9589,28 +9906,32 @@ function StableGenieSwap(props) {
|
|
|
9589
9906
|
};
|
|
9590
9907
|
}, [engine, props.variant, hist]);
|
|
9591
9908
|
const lastTxOwned = Boolean(flow.lastTxEntry?.hash && wallet.account && flow.lastTxEntry.account === wallet.account.toLowerCase());
|
|
9909
|
+
const evmDirect = flow.lastTxEntry?.settlement === "direct";
|
|
9910
|
+
const evmConfirmed = flow.verdict?.status === "confirmed";
|
|
9911
|
+
const evmDelivery = useDelivery(engine, (flow.status === "success" || flow.status === "pending") && !evmDirect ? flow.txHash : null);
|
|
9592
9912
|
if (props.variant === "pill") return /* @__PURE__ */ jsxRuntime.jsx(PaymentIsland, { kind: "swap", ...props });
|
|
9593
9913
|
const walletSlot = wallet.account ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-head-tools", children: [
|
|
9594
9914
|
/* @__PURE__ */ jsxRuntime.jsx(HistoryButton, { btnRef: histBtnRef, disabled: submitting, onClick: () => setHist({}) }),
|
|
9595
9915
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-brand", children: "ZeroDelta" })
|
|
9596
9916
|
] }) : void 0;
|
|
9597
9917
|
if (hist && wallet.account) {
|
|
9598
|
-
return /* @__PURE__ */ jsxRuntime.jsx(WidgetShell, { title: config.title || "Swap", theme: config.theme, walletSlot, children: /* @__PURE__ */ jsxRuntime.jsx(TxHistoryPanel, { account: wallet.account, tokens: registryTokens, vaultIcons: catalogue?.vaultIcons, initialEntry: hist.entry ?? null, onBack: closeHistory }) });
|
|
9918
|
+
return /* @__PURE__ */ jsxRuntime.jsx(WidgetShell, { title: config.title || "Swap", theme: config.theme, walletSlot, children: /* @__PURE__ */ jsxRuntime.jsx(TxHistoryPanel, { account: wallet.account, engine, tokens: registryTokens, vaultIcons: catalogue?.vaultIcons, initialEntry: hist.entry ?? null, onBack: closeHistory }) });
|
|
9599
9919
|
}
|
|
9600
9920
|
if (recipientState.open) return /* @__PURE__ */ jsxRuntime.jsx(WidgetShell, { title: config.title || "Swap", theme: config.theme, walletSlot, children: /* @__PURE__ */ jsxRuntime.jsx(RecipientSheet, { state: recipientState, symbol: toAsset }) });
|
|
9601
9921
|
if (flow.status === "success" || flow.status === "pending") {
|
|
9602
9922
|
return /* @__PURE__ */ jsxRuntime.jsxs(WidgetShell, { title: config.title || "Swap", theme: config.theme, walletSlot, children: [
|
|
9603
9923
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-success", children: [
|
|
9604
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-success-check", "data-pending":
|
|
9924
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-success-check", "data-pending": !isDelivered(evmDelivery, evmConfirmed, evmDirect), children: /* @__PURE__ */ jsxRuntime.jsx(CheckGlyph4, {}) }),
|
|
9605
9925
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-success-amt sg-mono", children: [
|
|
9606
9926
|
receive,
|
|
9607
9927
|
" ",
|
|
9608
9928
|
tickerOn(registryTokens, toChainId, toAsset)
|
|
9609
9929
|
] }),
|
|
9610
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-success-sub", children: [
|
|
9611
|
-
|
|
9930
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-success-sub", role: "status", "aria-live": "polite", children: [
|
|
9931
|
+
deliveryHeadline(evmDelivery, evmConfirmed, evmDirect),
|
|
9612
9932
|
recipientState.recipientFamily === "solana" ? ` \xB7 ${shortAddress2(flow.lastTxEntry?.recipient || recipient2)}` : props.recipient ? ` \xB7 ${shortAddress2(props.recipient)}` : ""
|
|
9613
|
-
] })
|
|
9933
|
+
] }),
|
|
9934
|
+
evmDirect ? null : /* @__PURE__ */ jsxRuntime.jsx(DeliverySteps, { delivery: evmDelivery })
|
|
9614
9935
|
] }),
|
|
9615
9936
|
lastTxOwned ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-cta-wrap", children: /* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "ghost", onClick: () => setHist({ entry: flow.lastTxEntry }), children: "View transaction" }) }) : null
|
|
9616
9937
|
] });
|
|
@@ -10121,6 +10442,10 @@ function ExchangeCard(props) {
|
|
|
10121
10442
|
const addressed = connected2 && !needsRecipient;
|
|
10122
10443
|
const submitting = solActive ? solFlow.status === "preparing" || solFlow.status === "submitting" : flow.status === "submitting";
|
|
10123
10444
|
const lastTxOwned = Boolean(flow.lastTxEntry?.hash && wallet.account && flow.lastTxEntry.account === wallet.account.toLowerCase());
|
|
10445
|
+
const evmDirect = flow.lastTxEntry?.settlement === "direct";
|
|
10446
|
+
const evmConfirmed = flow.verdict?.status === "confirmed";
|
|
10447
|
+
const evmDelivery = useDelivery(engine, (flow.status === "success" || flow.status === "pending") && !evmDirect ? flow.txHash : null);
|
|
10448
|
+
const solDelivery = useDelivery(engine, solActive && solFlow.status === "sent" ? solFlow.signature : null);
|
|
10124
10449
|
const quoting = solActive ? solFlow.status === "quoting" : addressed ? flow.status === "loading" : preview.status === "loading";
|
|
10125
10450
|
const quoteError = !quotable ? null : solActive ? solFlow.status === "error" || solFlow.status === "failed" ? solFlow.error : null : addressed ? flow.status === "error" ? flow.error : null : preview.status === "error" ? preview.error ?? "No route." : null;
|
|
10126
10451
|
const gatewayAmountError = !quoteError || solActive ? null : addressed ? flow.fieldError : preview.fieldError ?? null;
|
|
@@ -10165,8 +10490,8 @@ function ExchangeCard(props) {
|
|
|
10165
10490
|
const rateRows = hasQuote ? [{ label: "Network fee", value: networkFee }, ...eta ? [{ label: "Estimated time", value: eta }] : []] : [];
|
|
10166
10491
|
const via = selected ? selected.legs.length > 1 ? selected.legs[0]?.toTicker || selected.legs[0]?.toAsset || "" : null : preview.data?.via ?? null;
|
|
10167
10492
|
const routeShape = via === null ? "Direct" : via ? `Via ${via}` : "Two steps";
|
|
10168
|
-
const compliance = selected?.quote.compliance;
|
|
10169
|
-
const complianceHasQuote = Boolean(selected && flow.status !== "loading");
|
|
10493
|
+
const compliance = solActive ? solanaQuoteCompliance(solFlow.plan?.preview.quote) : selected?.quote.compliance;
|
|
10494
|
+
const complianceHasQuote = solActive ? Boolean(solFlow.plan && solFlow.status !== "quoting") : Boolean(selected && flow.status !== "loading");
|
|
10170
10495
|
const fromUsd = usdOf2(normalizedAmount, prices[from?.symbol ?? ""]);
|
|
10171
10496
|
const toUsd = usdOf2(receive, prices[to?.symbol ?? ""]);
|
|
10172
10497
|
const flippable = !rampMode && !submitting && Boolean(to && sourceTokens.some((t) => Number(t.chainId) === to.chainId && symbolKey(t.symbol) === to.symbol));
|
|
@@ -10266,10 +10591,17 @@ function ExchangeCard(props) {
|
|
|
10266
10591
|
children: solFlow.status === "preparing" ? "Preparing order\u2026" : solFlow.status === "submitting" ? "Submitting\u2026" : solFlow.insufficient ? "Insufficient balance" : solFlow.solShort ? "Not enough SOL for network fees" : solFlow.status === "failed" ? "Try again" : !solFlow.plan ? "Exchange" : solFlow.needsPreparation ? "Continue in wallet" : "Submit"
|
|
10267
10592
|
}
|
|
10268
10593
|
);
|
|
10269
|
-
const solanaSteps = solActive && solFlow.plan && connected2 && solanaWallet.address ? /* @__PURE__ */ jsxRuntime.
|
|
10594
|
+
const solanaSteps = solActive && solFlow.plan && connected2 && solanaWallet.address && solFlow.solShort && solFlow.cost ? /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "sg-cp-summary-sub", style: { textAlign: "center", margin: "0 0 8px" }, "data-testid": "sol-shortfall", children: [
|
|
10595
|
+
"This order needs about ",
|
|
10596
|
+
(solFlow.cost.lamports / 1e9).toFixed(4),
|
|
10597
|
+
" SOL for network fees and rent; the wallet holds",
|
|
10598
|
+
" ",
|
|
10599
|
+
(solFlow.cost.balanceLamports / 1e9).toFixed(4),
|
|
10600
|
+
" SOL."
|
|
10601
|
+
] }) : null;
|
|
10270
10602
|
let body;
|
|
10271
10603
|
if (hist && connected2) {
|
|
10272
|
-
body = /* @__PURE__ */ jsxRuntime.jsx(TxHistoryPanel, { account: wallet.account, tokens, vaultIcons: catalogue?.vaultIcons, initialEntry: hist.entry ?? null, onBack: closeHistory });
|
|
10604
|
+
body = /* @__PURE__ */ jsxRuntime.jsx(TxHistoryPanel, { account: wallet.account, engine, solanaAccount: solanaWallet.address, tokens, vaultIcons: catalogue?.vaultIcons, initialEntry: hist.entry ?? null, onBack: closeHistory });
|
|
10273
10605
|
} else if (view === "from" || view === "to") {
|
|
10274
10606
|
const isFrom = view === "from";
|
|
10275
10607
|
body = /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -10296,16 +10628,17 @@ function ExchangeCard(props) {
|
|
|
10296
10628
|
} else if (solActive && solFlow.status === "sent") {
|
|
10297
10629
|
body = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
10298
10630
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-success", children: [
|
|
10299
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-success-check", "data-pending":
|
|
10631
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-success-check", "data-pending": !isDelivered(solDelivery, false), children: /* @__PURE__ */ jsxRuntime.jsx(CheckGlyph5, {}) }),
|
|
10300
10632
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-success-amt sg-mono", children: [
|
|
10301
10633
|
solFlow.sent?.receive ?? receive,
|
|
10302
10634
|
" ",
|
|
10303
10635
|
solFlow.sent?.toTicker ?? toTicker
|
|
10304
10636
|
] }),
|
|
10305
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-success-sub", children: [
|
|
10306
|
-
"Submitted on Solana \u2014
|
|
10637
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-success-sub", role: "status", "aria-live": "polite", children: [
|
|
10638
|
+
solDelivery.phase === "tracking" ? "Submitted on Solana \u2014 tracking delivery" : deliveryHeadline(solDelivery, true),
|
|
10307
10639
|
solFlow.sent?.recipient ? ` \xB7 ${shortAddress2(solFlow.sent.recipient)}` : ""
|
|
10308
|
-
] })
|
|
10640
|
+
] }),
|
|
10641
|
+
/* @__PURE__ */ jsxRuntime.jsx(DeliverySteps, { delivery: solDelivery })
|
|
10309
10642
|
] }),
|
|
10310
10643
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cta-wrap", children: [
|
|
10311
10644
|
solFlow.signature ? /* @__PURE__ */ jsxRuntime.jsx("a", { className: "sg-btn sg-btn-ghost", href: `https://solscan.io/tx/${solFlow.signature}`, target: "_blank", rel: "noopener noreferrer", children: "View on Solscan" }) : null,
|
|
@@ -10316,16 +10649,17 @@ function ExchangeCard(props) {
|
|
|
10316
10649
|
} else if (flow.status === "success" || flow.status === "pending") {
|
|
10317
10650
|
body = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
10318
10651
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-success", children: [
|
|
10319
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-success-check", "data-pending":
|
|
10652
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-success-check", "data-pending": !isDelivered(evmDelivery, evmConfirmed, evmDirect), children: /* @__PURE__ */ jsxRuntime.jsx(CheckGlyph5, {}) }),
|
|
10320
10653
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-success-amt sg-mono", children: [
|
|
10321
10654
|
receive,
|
|
10322
10655
|
" ",
|
|
10323
10656
|
toTicker
|
|
10324
10657
|
] }),
|
|
10325
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-success-sub", children: [
|
|
10326
|
-
|
|
10658
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-success-sub", role: "status", "aria-live": "polite", children: [
|
|
10659
|
+
deliveryHeadline(evmDelivery, evmConfirmed, evmDirect),
|
|
10327
10660
|
recipientState.recipientFamily === "solana" ? ` \xB7 ${shortAddress2(flow.lastTxEntry?.recipient || recipient2)}` : props.recipient ? ` \xB7 ${shortAddress2(props.recipient)}` : ""
|
|
10328
|
-
] })
|
|
10661
|
+
] }),
|
|
10662
|
+
evmDirect ? null : /* @__PURE__ */ jsxRuntime.jsx(DeliverySteps, { delivery: evmDelivery })
|
|
10329
10663
|
] }),
|
|
10330
10664
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cta-wrap", children: [
|
|
10331
10665
|
lastTxOwned ? /* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "ghost", onClick: () => setHist({ entry: flow.lastTxEntry }), children: "View transaction" }) : null,
|