@glacislabs/stablegenie-zerodelta 3.4.0 → 4.1.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/README.md +52 -20
- package/dist/{chunk-Q3YSX4D5.js → chunk-DXUESKNC.js} +557 -51
- package/dist/{chunk-TYQF2L5C.js → chunk-YEYFEQWS.js} +566 -26
- package/dist/core/index.cjs +591 -25
- package/dist/core/index.d.cts +42 -4
- package/dist/core/index.d.ts +42 -4
- package/dist/core/index.js +1 -1
- package/dist/index.cjs +1134 -83
- package/dist/index.d.cts +22 -3
- package/dist/index.d.ts +22 -3
- package/dist/index.js +2 -2
- package/dist/{mount-BT2NejVt.d.ts → mount-BFa37j1u.d.ts} +1 -1
- package/dist/{mount-D8NmWtqV.d.cts → mount-DssudKQ7.d.cts} +1 -1
- package/dist/mount.cjs +1113 -83
- 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 +156 -8
- package/dist/{verify-34voZYj1.d.cts → verify-Ce6ZtDhi.d.cts} +290 -1
- package/dist/{verify-34voZYj1.d.ts → verify-Ce6ZtDhi.d.ts} +290 -1
- package/package.json +1 -1
package/dist/mount.cjs
CHANGED
|
@@ -36,6 +36,7 @@ var TRADEABLE_RWA_ASSETS = /* @__PURE__ */ new Set([
|
|
|
36
36
|
]);
|
|
37
37
|
var SUPPORTED_ASSETS = /* @__PURE__ */ new Set([...STABLE_ASSETS, ...TRADEABLE_RWA_ASSETS]);
|
|
38
38
|
var API_CACHE_TTL_MS = 6e4;
|
|
39
|
+
var SCREEN_CACHE_TTL_MS = 5 * 6e4;
|
|
39
40
|
var MAX_QUOTE_CANDIDATES = 8;
|
|
40
41
|
var QUOTE_BUFFER_BPS = 50;
|
|
41
42
|
var LZ_FEE_BUFFER_BPS = 1500n;
|
|
@@ -596,7 +597,7 @@ function buildCatalogue(input) {
|
|
|
596
597
|
);
|
|
597
598
|
const byId = new Map(enabledChains.map((c) => [Number(c.chainId), c]));
|
|
598
599
|
for (const id of chainIds) if (!byId.has(id)) byId.set(id, { chainId: id, isEnabled: true });
|
|
599
|
-
return { ...ctx, product, tokens: catalogue, sources, chainIds, chains: [...byId.values()], ready };
|
|
600
|
+
return { ...ctx, product, tokens: catalogue, sources, chainIds, chains: [...byId.values()], ready, vaultIcons: input.vaultIcons ?? /* @__PURE__ */ new Map() };
|
|
600
601
|
}
|
|
601
602
|
|
|
602
603
|
// src/core/options.ts
|
|
@@ -721,10 +722,10 @@ function nativeFeeShortLabel(check, symbol) {
|
|
|
721
722
|
if (!check.short) return null;
|
|
722
723
|
return `Need ${formatNative(check.required)} ${symbol} for the bridge fee`;
|
|
723
724
|
}
|
|
724
|
-
function nativeFeeShortMessage(check, symbol,
|
|
725
|
+
function nativeFeeShortMessage(check, symbol, chainName3) {
|
|
725
726
|
const need = formatNative(check.required);
|
|
726
727
|
const have = formatNative(check.balance ?? 0n);
|
|
727
|
-
const where =
|
|
728
|
+
const where = chainName3 ? ` on ${chainName3}` : "";
|
|
728
729
|
return `This route bridges via LayerZero, which charges a ${need} ${symbol} network fee paid as part of the transaction. Your wallet holds ${have} ${symbol}${where}. Add ${symbol}${where} and try again \u2014 gas is owed on top of this fee.`;
|
|
729
730
|
}
|
|
730
731
|
|
|
@@ -758,6 +759,350 @@ function brokenLaneReason(lane) {
|
|
|
758
759
|
}
|
|
759
760
|
}
|
|
760
761
|
|
|
762
|
+
// src/core/rwa-icons.ts
|
|
763
|
+
var GATEWAY_ICON_PREFIX = "/api/v1/rwa/icons/";
|
|
764
|
+
var ICON_FILE = /^[A-Za-z0-9][A-Za-z0-9._-]{0,127}\.(?:png|jpg|jpeg|webp|gif)$/;
|
|
765
|
+
function resolveVaultIcon(apiBase, iconPath) {
|
|
766
|
+
if (typeof iconPath !== "string" || !iconPath.startsWith(GATEWAY_ICON_PREFIX)) return void 0;
|
|
767
|
+
const file = iconPath.slice(GATEWAY_ICON_PREFIX.length);
|
|
768
|
+
if (!ICON_FILE.test(file)) return void 0;
|
|
769
|
+
return `${apiBase.replace(/\/$/, "")}/rwa/icons/${file}`;
|
|
770
|
+
}
|
|
771
|
+
function vaultIconsBySymbol(apiBase, vaults) {
|
|
772
|
+
const out = /* @__PURE__ */ new Map();
|
|
773
|
+
for (const vault of vaults) {
|
|
774
|
+
const key = symbolKey(vault?.symbol);
|
|
775
|
+
if (!key || out.has(key)) continue;
|
|
776
|
+
const url = resolveVaultIcon(apiBase, vault?.iconMiniUrl) ?? resolveVaultIcon(apiBase, vault?.iconUrl);
|
|
777
|
+
if (url) out.set(key, url);
|
|
778
|
+
}
|
|
779
|
+
return out;
|
|
780
|
+
}
|
|
781
|
+
function withVaultArtwork(tokens, icons) {
|
|
782
|
+
if (!icons.size) return tokens;
|
|
783
|
+
return tokens.map((token) => {
|
|
784
|
+
if (token.logoUrl) return token;
|
|
785
|
+
const url = icons.get(symbolKey(token.symbol));
|
|
786
|
+
return url ? { ...token, logoUrl: url } : token;
|
|
787
|
+
});
|
|
788
|
+
}
|
|
789
|
+
|
|
790
|
+
// src/core/compliance.ts
|
|
791
|
+
var COMPLIANCE_DENY_LABEL = "Compliance check failed";
|
|
792
|
+
function complianceView(compliance, hasQuote = true) {
|
|
793
|
+
if (!hasQuote) {
|
|
794
|
+
return {
|
|
795
|
+
tone: "neutral",
|
|
796
|
+
label: "Compliance checks run with your quote",
|
|
797
|
+
headline: "No compliance decision for this payment yet",
|
|
798
|
+
blocked: false,
|
|
799
|
+
needsAction: false,
|
|
800
|
+
screened: false
|
|
801
|
+
};
|
|
802
|
+
}
|
|
803
|
+
const decision = compliance?.decision;
|
|
804
|
+
const screened = compliance?.status === "SCREENED";
|
|
805
|
+
if (decision === "DENY") {
|
|
806
|
+
return {
|
|
807
|
+
tone: "blocked",
|
|
808
|
+
label: COMPLIANCE_DENY_LABEL,
|
|
809
|
+
headline: "Blocked by compliance policy",
|
|
810
|
+
blocked: true,
|
|
811
|
+
needsAction: false,
|
|
812
|
+
screened
|
|
813
|
+
};
|
|
814
|
+
}
|
|
815
|
+
if (decision === "REVIEW" || decision === "REMEDIATE") {
|
|
816
|
+
const word = decision.toLowerCase();
|
|
817
|
+
return {
|
|
818
|
+
tone: "warn",
|
|
819
|
+
label: `Compliance: ${word} required`,
|
|
820
|
+
headline: `Manual ${word} required`,
|
|
821
|
+
blocked: false,
|
|
822
|
+
needsAction: true,
|
|
823
|
+
screened
|
|
824
|
+
};
|
|
825
|
+
}
|
|
826
|
+
if (decision === "ALLOW") {
|
|
827
|
+
return {
|
|
828
|
+
tone: "ok",
|
|
829
|
+
label: screened ? "Compliance checks passed" : "Allowed \u2014 wallets not screened",
|
|
830
|
+
headline: screened ? "Wallets screened and allowed" : "Allowed \u2014 wallets not screened",
|
|
831
|
+
blocked: false,
|
|
832
|
+
needsAction: false,
|
|
833
|
+
screened
|
|
834
|
+
};
|
|
835
|
+
}
|
|
836
|
+
return {
|
|
837
|
+
tone: "neutral",
|
|
838
|
+
label: screened ? "Screened \u2014 no policy decision returned" : "No compliance decision returned",
|
|
839
|
+
headline: screened ? "Screened \u2014 no policy decision returned" : "No compliance decision returned",
|
|
840
|
+
blocked: false,
|
|
841
|
+
needsAction: false,
|
|
842
|
+
screened
|
|
843
|
+
};
|
|
844
|
+
}
|
|
845
|
+
var CATEGORY_PHRASES = {
|
|
846
|
+
SANCTIONS: "sanctions",
|
|
847
|
+
TERRORISM_FINANCING: "terrorism financing",
|
|
848
|
+
STOLEN_FUNDS: "stolen funds",
|
|
849
|
+
RANSOMWARE: "ransomware",
|
|
850
|
+
SCAM: "scam activity",
|
|
851
|
+
DARKNET: "darknet activity",
|
|
852
|
+
MIXER: "mixer usage",
|
|
853
|
+
HIGH_RISK_ENTITY: "a high-risk entity",
|
|
854
|
+
PEP: "a politically-exposed person",
|
|
855
|
+
INDIRECT_EXPOSURE: "indirect exposure",
|
|
856
|
+
UNCLASSIFIED: "an unrecognized risk",
|
|
857
|
+
UNKNOWN: "an unrecognized risk"
|
|
858
|
+
};
|
|
859
|
+
function categoryLabel(code) {
|
|
860
|
+
const key = code.trim().toUpperCase();
|
|
861
|
+
const LABELS = {
|
|
862
|
+
SANCTIONS: "Sanctions",
|
|
863
|
+
TERRORISM_FINANCING: "Terrorist financing",
|
|
864
|
+
STOLEN_FUNDS: "Stolen funds",
|
|
865
|
+
RANSOMWARE: "Ransomware",
|
|
866
|
+
SCAM: "Scam",
|
|
867
|
+
DARKNET: "Darknet services",
|
|
868
|
+
MIXER: "Mixer",
|
|
869
|
+
HIGH_RISK_ENTITY: "High-risk entity",
|
|
870
|
+
PEP: "Politically exposed person (PEP)",
|
|
871
|
+
INDIRECT_EXPOSURE: "Indirect exposure",
|
|
872
|
+
UNCLASSIFIED: "Unclassified risk",
|
|
873
|
+
UNKNOWN: "Unclassified risk"
|
|
874
|
+
};
|
|
875
|
+
return LABELS[key] ?? key.toLowerCase().replace(/_/g, " ");
|
|
876
|
+
}
|
|
877
|
+
function cleanJurisdiction(code) {
|
|
878
|
+
return code.replace(/^(OFAC|TIER\d+|SANCTIONED)_/i, "").trim();
|
|
879
|
+
}
|
|
880
|
+
function stripBundlePrefix(head) {
|
|
881
|
+
if (head.startsWith("policy_")) return { head: head.slice("policy_".length), source: "policy" };
|
|
882
|
+
if (head.startsWith("legislation_")) return { head: head.slice("legislation_".length), source: "legislation" };
|
|
883
|
+
return { head, source: null };
|
|
884
|
+
}
|
|
885
|
+
function complianceReasonHead(raw) {
|
|
886
|
+
return stripBundlePrefix((raw.split(":")[0] ?? "").trim()).head;
|
|
887
|
+
}
|
|
888
|
+
function usd(raw) {
|
|
889
|
+
const n = Number(raw);
|
|
890
|
+
if (!Number.isFinite(n)) return `$${raw}`;
|
|
891
|
+
return `$${n.toLocaleString("en-US", { maximumFractionDigits: 2 })}`;
|
|
892
|
+
}
|
|
893
|
+
function capFromDetail(detail) {
|
|
894
|
+
const m = detail.match(/>([\d.]+)/);
|
|
895
|
+
return m ? ` (${usd(m[1])})` : "";
|
|
896
|
+
}
|
|
897
|
+
function categoryPhrase(detail) {
|
|
898
|
+
const cat = detail.replace(/\s*\(.*\)$/, "").toUpperCase();
|
|
899
|
+
return CATEGORY_PHRASES[cat] ?? cat.toLowerCase().replace(/_/g, " ");
|
|
900
|
+
}
|
|
901
|
+
function humanizeComplianceReason(raw) {
|
|
902
|
+
const [headRaw, ...restParts] = raw.split(":");
|
|
903
|
+
const detail = restParts.join(":").trim();
|
|
904
|
+
const { head, source } = stripBundlePrefix((headRaw ?? "").trim());
|
|
905
|
+
const scope = source === "legislation" ? "applicable regulations" : "the applicable policy";
|
|
906
|
+
switch (head) {
|
|
907
|
+
case "asset_pair_not_allowed": {
|
|
908
|
+
const m = detail.match(/^(\S+)->(\S+)\s+in\s+(\S+)/);
|
|
909
|
+
if (m) return `${m[1]} \u2192 ${m[2]} isn't available in your region (${cleanJurisdiction(m[3])}).`;
|
|
910
|
+
return "This asset pair isn't available in your region.";
|
|
911
|
+
}
|
|
912
|
+
case "asset_not_allowed": {
|
|
913
|
+
const m = detail.match(/^(\S+?)->(\S+?)(?::|$)/);
|
|
914
|
+
if (m) return `${m[1]} \u2192 ${m[2]} isn't permitted under ${scope}.`;
|
|
915
|
+
return `This asset pair isn't permitted under ${scope}.`;
|
|
916
|
+
}
|
|
917
|
+
case "blocked_jurisdiction":
|
|
918
|
+
return `Your region (${cleanJurisdiction(detail)}) isn't supported.`;
|
|
919
|
+
case "blocked_destination_jurisdiction":
|
|
920
|
+
return `The destination region (${cleanJurisdiction(detail)}) isn't supported.`;
|
|
921
|
+
case "jurisdiction_out_of_scope":
|
|
922
|
+
return `Not covered by ${scope}.`;
|
|
923
|
+
case "ui_block":
|
|
924
|
+
return `Payments aren't available in your region (${cleanJurisdiction(detail)}).`;
|
|
925
|
+
case "blocked_corridor_mode":
|
|
926
|
+
return "This route isn't currently open for payments.";
|
|
927
|
+
case "blocked_category":
|
|
928
|
+
return `Flagged for ${categoryPhrase(detail)}.`;
|
|
929
|
+
case "amount_exceeds_max_order_usd":
|
|
930
|
+
case "amount_exceeds_max":
|
|
931
|
+
return `Amount exceeds the maximum order size${capFromDetail(detail)}.`;
|
|
932
|
+
case "amount_exceeds_actor_cap":
|
|
933
|
+
return `Amount exceeds the limit for your account type${capFromDetail(detail)}.`;
|
|
934
|
+
case "amount_exceeds_jurisdiction_max":
|
|
935
|
+
return `Amount exceeds the limit for your region${capFromDetail(detail)}.`;
|
|
936
|
+
case "source_chain_not_allowed":
|
|
937
|
+
return `The source chain isn't permitted under ${scope}.`;
|
|
938
|
+
case "dest_chain_not_allowed":
|
|
939
|
+
return `The destination chain isn't permitted under ${scope}.`;
|
|
940
|
+
default:
|
|
941
|
+
return detail ? `${head.replace(/_/g, " ")} \u2014 ${detail}` : head.replace(/_/g, " ");
|
|
942
|
+
}
|
|
943
|
+
}
|
|
944
|
+
var COMPLIANCE_CHECK_ORDER = [
|
|
945
|
+
"location",
|
|
946
|
+
"screening",
|
|
947
|
+
"risk",
|
|
948
|
+
"asset",
|
|
949
|
+
"limits"
|
|
950
|
+
];
|
|
951
|
+
var CHECK_LABELS = {
|
|
952
|
+
location: "Location and corridor permitted",
|
|
953
|
+
screening: "Both wallets screened",
|
|
954
|
+
risk: "Risk policy passed",
|
|
955
|
+
asset: "Asset and amount allowed",
|
|
956
|
+
limits: "Transaction limits verified"
|
|
957
|
+
};
|
|
958
|
+
var CHECK_HEADS = {
|
|
959
|
+
location: [
|
|
960
|
+
"blocked_jurisdiction",
|
|
961
|
+
"blocked_destination_jurisdiction",
|
|
962
|
+
"ui_block",
|
|
963
|
+
"blocked_corridor_mode",
|
|
964
|
+
"jurisdiction_out_of_scope"
|
|
965
|
+
],
|
|
966
|
+
screening: [],
|
|
967
|
+
risk: ["blocked_category"],
|
|
968
|
+
asset: ["asset_pair_not_allowed", "asset_not_allowed", "source_chain_not_allowed", "dest_chain_not_allowed"],
|
|
969
|
+
limits: [
|
|
970
|
+
"amount_exceeds_max_order_usd",
|
|
971
|
+
"amount_exceeds_max",
|
|
972
|
+
"amount_exceeds_actor_cap",
|
|
973
|
+
"amount_exceeds_jurisdiction_max"
|
|
974
|
+
]
|
|
975
|
+
};
|
|
976
|
+
function distinctScreenedWallets(compliance) {
|
|
977
|
+
const seen = /* @__PURE__ */ new Set();
|
|
978
|
+
const wallets = [];
|
|
979
|
+
for (const raw of compliance?.screenedWallets ?? []) {
|
|
980
|
+
const address = raw?.trim();
|
|
981
|
+
if (!address) continue;
|
|
982
|
+
const key = /^0x[0-9a-fA-F]+$/.test(address) ? address.toLowerCase() : address;
|
|
983
|
+
if (seen.has(key)) continue;
|
|
984
|
+
seen.add(key);
|
|
985
|
+
wallets.push(address);
|
|
986
|
+
}
|
|
987
|
+
return wallets;
|
|
988
|
+
}
|
|
989
|
+
function shortAddress(a) {
|
|
990
|
+
return a.length > 12 ? `${a.slice(0, 6)}\u2026${a.slice(-4)}` : a;
|
|
991
|
+
}
|
|
992
|
+
function screeningLabel(wallets) {
|
|
993
|
+
if (wallets === 1) return "Wallet screened";
|
|
994
|
+
if (wallets === 2) return CHECK_LABELS.screening;
|
|
995
|
+
return "Wallets screened";
|
|
996
|
+
}
|
|
997
|
+
function complianceChecks(compliance, cv = complianceView(compliance)) {
|
|
998
|
+
if (cv.tone === "neutral") return [];
|
|
999
|
+
const byControl = /* @__PURE__ */ new Map();
|
|
1000
|
+
for (const raw of compliance?.reasons ?? []) {
|
|
1001
|
+
const head = complianceReasonHead(raw);
|
|
1002
|
+
const id = COMPLIANCE_CHECK_ORDER.find((c) => CHECK_HEADS[c].includes(head));
|
|
1003
|
+
if (!id) continue;
|
|
1004
|
+
byControl.set(id, [...byControl.get(id) ?? [], raw]);
|
|
1005
|
+
}
|
|
1006
|
+
const screenedWallets = distinctScreenedWallets(compliance);
|
|
1007
|
+
const wallets = screenedWallets.length;
|
|
1008
|
+
const blocking = compliance?.blockingCategories?.length ?? 0;
|
|
1009
|
+
return COMPLIANCE_CHECK_ORDER.map((id) => {
|
|
1010
|
+
if (id === "screening") {
|
|
1011
|
+
const ok2 = cv.screened || wallets > 0;
|
|
1012
|
+
const note = wallets === 1 ? shortAddress(screenedWallets[0]) : wallets > 1 ? `${wallets} wallets screened` : void 0;
|
|
1013
|
+
return { id, label: ok2 ? screeningLabel(wallets) : "Wallets not screened", ok: ok2, reasons: [], note };
|
|
1014
|
+
}
|
|
1015
|
+
const reasons = byControl.get(id) ?? [];
|
|
1016
|
+
const ok = reasons.length === 0 && !(id === "risk" && blocking > 0);
|
|
1017
|
+
return { id, label: CHECK_LABELS[id], ok, reasons };
|
|
1018
|
+
});
|
|
1019
|
+
}
|
|
1020
|
+
function unattributedComplianceReasons(compliance, cv = complianceView(compliance)) {
|
|
1021
|
+
const claimed = new Set(complianceChecks(compliance, cv).flatMap((c) => c.reasons));
|
|
1022
|
+
return (compliance?.reasons ?? []).filter((r) => !claimed.has(r));
|
|
1023
|
+
}
|
|
1024
|
+
function directComplianceFromScreens(screens) {
|
|
1025
|
+
const blockedAny = screens.some((s) => s.blocked);
|
|
1026
|
+
const cats = (pick) => [
|
|
1027
|
+
...new Set(screens.flatMap((s) => pick(s) ?? []))
|
|
1028
|
+
];
|
|
1029
|
+
return {
|
|
1030
|
+
status: "SCREENED",
|
|
1031
|
+
decision: blockedAny ? "DENY" : "ALLOW",
|
|
1032
|
+
screenedWallets: screens.map((s) => s.address),
|
|
1033
|
+
riskCategories: cats((s) => s.riskCategories),
|
|
1034
|
+
flaggedCategories: cats((s) => s.flaggedCategories),
|
|
1035
|
+
blockingCategories: cats((s) => s.blockingCategories),
|
|
1036
|
+
reasons: blockedAny ? cats((s) => s.blockingCategories).map((c) => `blocked_category:${c}`) : []
|
|
1037
|
+
};
|
|
1038
|
+
}
|
|
1039
|
+
var DIRECT_CHECK_IDS = ["screening", "risk"];
|
|
1040
|
+
var DIRECT_SCOPE_NOTE = "Direct settlement moves your funds straight to the recipient, so wallet screening applies. Jurisdiction, corridor and amount policy are evaluated on routed payments.";
|
|
1041
|
+
var BLOCK_CATEGORY_LABELS = {
|
|
1042
|
+
STOLEN_FUNDS: "flagged as associated with stolen funds",
|
|
1043
|
+
SANCTIONS: "on a sanctions list",
|
|
1044
|
+
SANCTIONED: "on a sanctions list",
|
|
1045
|
+
OFAC: "on a sanctions list",
|
|
1046
|
+
TERRORIST_FINANCING: "flagged for terrorist financing",
|
|
1047
|
+
TERRORISM_FINANCING: "flagged for terrorist financing",
|
|
1048
|
+
FRAUD: "flagged for fraud",
|
|
1049
|
+
SCAM: "flagged as a scam address"
|
|
1050
|
+
};
|
|
1051
|
+
var BLOCK_LABEL_DEFAULT = "flagged by compliance screening";
|
|
1052
|
+
function blockLabelFor(categories) {
|
|
1053
|
+
for (const raw of categories) {
|
|
1054
|
+
const label = BLOCK_CATEGORY_LABELS[String(raw || "").trim().toUpperCase()];
|
|
1055
|
+
if (label) return label;
|
|
1056
|
+
}
|
|
1057
|
+
return BLOCK_LABEL_DEFAULT;
|
|
1058
|
+
}
|
|
1059
|
+
var REASON_TAGS = {
|
|
1060
|
+
blocked_jurisdiction: "Restricted country",
|
|
1061
|
+
ui_block: "Restricted country",
|
|
1062
|
+
blocked_destination_jurisdiction: "Restricted destination",
|
|
1063
|
+
blocked_corridor_mode: "Corridor closed",
|
|
1064
|
+
blocked_category: "Risk flag",
|
|
1065
|
+
amount_exceeds_max_order_usd: "Limit exceeded",
|
|
1066
|
+
amount_exceeds_max: "Limit exceeded",
|
|
1067
|
+
amount_exceeds_actor_cap: "Limit exceeded",
|
|
1068
|
+
amount_exceeds_jurisdiction_max: "Limit exceeded",
|
|
1069
|
+
asset_pair_not_allowed: "Asset not allowed",
|
|
1070
|
+
asset_not_allowed: "Asset not allowed",
|
|
1071
|
+
source_chain_not_allowed: "Chain not allowed",
|
|
1072
|
+
dest_chain_not_allowed: "Chain not allowed",
|
|
1073
|
+
jurisdiction_out_of_scope: "Out of scope"
|
|
1074
|
+
};
|
|
1075
|
+
function complianceReasonTag(raw) {
|
|
1076
|
+
const head = complianceReasonHead(raw);
|
|
1077
|
+
return REASON_TAGS[head] ?? head.replace(/_/g, " ");
|
|
1078
|
+
}
|
|
1079
|
+
function complianceTagOf(compliance) {
|
|
1080
|
+
const first = (compliance?.reasons ?? [])[0];
|
|
1081
|
+
return first ? complianceReasonTag(first) : "";
|
|
1082
|
+
}
|
|
1083
|
+
var FLOOR_CATEGORIES = ["SANCTIONS", "TERRORISM_FINANCING", "STOLEN_FUNDS", "RANSOMWARE"];
|
|
1084
|
+
var TUNABLE_CATEGORIES = ["SCAM", "DARKNET", "MIXER", "HIGH_RISK_ENTITY", "PEP", "INDIRECT_EXPOSURE", "UNCLASSIFIED"];
|
|
1085
|
+
var TUNED_OUTCOMES = {
|
|
1086
|
+
SCAM: "blocked",
|
|
1087
|
+
DARKNET: "blocked",
|
|
1088
|
+
MIXER: "flagged",
|
|
1089
|
+
HIGH_RISK_ENTITY: "flagged",
|
|
1090
|
+
PEP: "flagged",
|
|
1091
|
+
INDIRECT_EXPOSURE: "flagged",
|
|
1092
|
+
UNCLASSIFIED: "flagged"
|
|
1093
|
+
};
|
|
1094
|
+
function screeningOutcomeOf(category) {
|
|
1095
|
+
const key = category.trim().toUpperCase();
|
|
1096
|
+
if (FLOOR_CATEGORIES.includes(key)) return "always-blocked";
|
|
1097
|
+
return TUNED_OUTCOMES[key] ?? null;
|
|
1098
|
+
}
|
|
1099
|
+
var labelsFor = (outcome) => [...FLOOR_CATEGORIES, ...TUNABLE_CATEGORIES].filter((c) => screeningOutcomeOf(c) === outcome).map(categoryLabel);
|
|
1100
|
+
var SCREENING_BUCKETS = [
|
|
1101
|
+
{ outcome: "always-blocked", title: "Always blocked", detail: "Cannot be changed or disabled.", categories: labelsFor("always-blocked") },
|
|
1102
|
+
{ outcome: "blocked", title: "Blocked under this policy", detail: "The current policy stops the order.", categories: labelsFor("blocked") },
|
|
1103
|
+
{ outcome: "flagged", title: "Flagged", detail: "A warning is shown.", categories: labelsFor("flagged") }
|
|
1104
|
+
];
|
|
1105
|
+
|
|
761
1106
|
// src/core/solve.ts
|
|
762
1107
|
async function solveExactOut({ option, destination, destinationToken, payer, fetchQuote }) {
|
|
763
1108
|
const destDecimals = assetDecimals(destinationToken);
|
|
@@ -994,7 +1339,63 @@ function routeLabelFor(option, destinationToken, result) {
|
|
|
994
1339
|
const bridge = result.quote.bridge ? ` via ${result.quote.bridge}` : "";
|
|
995
1340
|
return `Swap ${option.symbol} to ${destinationToken.symbol} and settle on ZeroDelta${bridge}.`;
|
|
996
1341
|
}
|
|
997
|
-
|
|
1342
|
+
function tokenAt(tokens, chainId, address) {
|
|
1343
|
+
const wanted = normalizeAddress(address);
|
|
1344
|
+
if (!wanted || !tokens?.length) return void 0;
|
|
1345
|
+
return tokens.find((t) => Number(t.chainId) === Number(chainId) && normalizeAddress(t.address) === wanted);
|
|
1346
|
+
}
|
|
1347
|
+
function legAmount(raw, decimals) {
|
|
1348
|
+
if (decimals === void 0) return "";
|
|
1349
|
+
try {
|
|
1350
|
+
return formatUnits(raw || "0", decimals);
|
|
1351
|
+
} catch {
|
|
1352
|
+
return "";
|
|
1353
|
+
}
|
|
1354
|
+
}
|
|
1355
|
+
function buildLegs(orders, ctx) {
|
|
1356
|
+
const legs = [];
|
|
1357
|
+
let fromChainId = ctx.option.chainId;
|
|
1358
|
+
let fromAsset = ctx.option.symbol;
|
|
1359
|
+
let fromDecimals = ctx.option.decimals;
|
|
1360
|
+
for (let index = 0; index < orders.length; index += 1) {
|
|
1361
|
+
const order = orders[index];
|
|
1362
|
+
const isLast = index === orders.length - 1;
|
|
1363
|
+
const toChainId = Number(order.destinationChainId);
|
|
1364
|
+
const askToken = isLast ? ctx.destinationToken : tokenAt(ctx.tokens, toChainId, order.askToken);
|
|
1365
|
+
const toAsset = isLast ? ctx.destinationToken.symbol : askToken?.symbol ?? "";
|
|
1366
|
+
const toDecimals = askToken ? assetDecimals(askToken) : void 0;
|
|
1367
|
+
const executionChainId = Number(order.executionChainId);
|
|
1368
|
+
legs.push({
|
|
1369
|
+
index: index + 1,
|
|
1370
|
+
fromAsset,
|
|
1371
|
+
fromChainId,
|
|
1372
|
+
fromChainName: chainNameOf(fromChainId, ctx.chains),
|
|
1373
|
+
fromAmount: legAmount(order.bidTokenAmount, fromDecimals),
|
|
1374
|
+
toAsset,
|
|
1375
|
+
toChainId,
|
|
1376
|
+
toChainName: chainNameOf(toChainId, ctx.chains),
|
|
1377
|
+
toAmount: legAmount(order.askTokenAmount, toDecimals),
|
|
1378
|
+
executionChainId,
|
|
1379
|
+
executionChainName: chainNameOf(executionChainId, ctx.chains)
|
|
1380
|
+
});
|
|
1381
|
+
fromChainId = toChainId;
|
|
1382
|
+
fromAsset = toAsset;
|
|
1383
|
+
fromDecimals = toDecimals;
|
|
1384
|
+
}
|
|
1385
|
+
return legs;
|
|
1386
|
+
}
|
|
1387
|
+
async function buildRoute({
|
|
1388
|
+
option,
|
|
1389
|
+
destination,
|
|
1390
|
+
destinationToken,
|
|
1391
|
+
chains,
|
|
1392
|
+
tokens,
|
|
1393
|
+
payer,
|
|
1394
|
+
fetchQuote,
|
|
1395
|
+
solve = solveExactOut,
|
|
1396
|
+
amountInRaw,
|
|
1397
|
+
compliance
|
|
1398
|
+
}) {
|
|
998
1399
|
const result = await solve({ option, destination, destinationToken, payer, fetchQuote, amountInRaw });
|
|
999
1400
|
const quote = result.quote;
|
|
1000
1401
|
const destDecimals = assetDecimals(destinationToken);
|
|
@@ -1024,6 +1425,23 @@ async function buildRoute({ option, destination, destinationToken, chains, payer
|
|
|
1024
1425
|
},
|
|
1025
1426
|
routeLabel: routeLabelFor(option, destinationToken, result),
|
|
1026
1427
|
deltaLabel: routeDeltaLabel(result, quote),
|
|
1428
|
+
// A direct transfer submits no order at all, but it is still ONE hop and history renders the
|
|
1429
|
+
// same shape for it — an empty `legs` would leave "one order or two?" unanswerable for it alone.
|
|
1430
|
+
legs: [
|
|
1431
|
+
{
|
|
1432
|
+
index: 1,
|
|
1433
|
+
fromAsset: option.symbol,
|
|
1434
|
+
fromChainId: option.chainId,
|
|
1435
|
+
fromChainName: option.chainName,
|
|
1436
|
+
fromAmount: sourceAmount,
|
|
1437
|
+
toAsset: destinationToken.symbol,
|
|
1438
|
+
toChainId: Number(destination.chainId),
|
|
1439
|
+
toChainName: chainNameOf(Number(destination.chainId), chains),
|
|
1440
|
+
toAmount: receiveAmount,
|
|
1441
|
+
executionChainId: option.chainId,
|
|
1442
|
+
executionChainName: option.chainName
|
|
1443
|
+
}
|
|
1444
|
+
],
|
|
1027
1445
|
transactions: [
|
|
1028
1446
|
{
|
|
1029
1447
|
id: "transfer",
|
|
@@ -1041,7 +1459,11 @@ async function buildRoute({ option, destination, destinationToken, chains, payer
|
|
|
1041
1459
|
bridge: quote.bridge,
|
|
1042
1460
|
feeBps: quote.feeBps,
|
|
1043
1461
|
estimatedDuration: quote.estimatedDuration,
|
|
1044
|
-
iterations: result.iterations
|
|
1462
|
+
iterations: result.iterations,
|
|
1463
|
+
// A direct transfer never reaches /quote (solve.ts short-circuits it), so there is no
|
|
1464
|
+
// gateway decision to carry. The caller screens both parties itself and passes the
|
|
1465
|
+
// synthesized verdict in — see plan.ts and compliance.ts::directComplianceFromScreens.
|
|
1466
|
+
compliance
|
|
1045
1467
|
}
|
|
1046
1468
|
};
|
|
1047
1469
|
}
|
|
@@ -1093,6 +1515,7 @@ async function buildRoute({ option, destination, destinationToken, chains, payer
|
|
|
1093
1515
|
},
|
|
1094
1516
|
routeLabel: routeLabelFor(option, destinationToken, result),
|
|
1095
1517
|
deltaLabel: routeDeltaLabel(result, quote),
|
|
1518
|
+
legs: buildLegs(orders, { option, destinationToken, chains, tokens }),
|
|
1096
1519
|
transactions: [
|
|
1097
1520
|
{
|
|
1098
1521
|
id: "approve",
|
|
@@ -1125,7 +1548,11 @@ async function buildRoute({ option, destination, destinationToken, chains, payer
|
|
|
1125
1548
|
gasCostSource: quote.gasCostSource,
|
|
1126
1549
|
msgValue: valueRaw.toString(),
|
|
1127
1550
|
deadline: order.deadline,
|
|
1128
|
-
iterations: result.iterations
|
|
1551
|
+
iterations: result.iterations,
|
|
1552
|
+
// Carried verbatim from the gateway's decision on THIS wallet pair. The projection used to
|
|
1553
|
+
// drop it, which is why the widget could show a price with no evidence of the control that
|
|
1554
|
+
// produced it.
|
|
1555
|
+
compliance: quote.compliance
|
|
1129
1556
|
}
|
|
1130
1557
|
};
|
|
1131
1558
|
}
|
|
@@ -1161,25 +1588,20 @@ function apiMessage(json, fallback) {
|
|
|
1161
1588
|
}
|
|
1162
1589
|
return sanitizeMessage(err?.message, fallback);
|
|
1163
1590
|
}
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
TERRORIST_FINANCING: "flagged for terrorist financing",
|
|
1170
|
-
FRAUD: "flagged for fraud",
|
|
1171
|
-
SCAM: "flagged as a scam address"
|
|
1172
|
-
};
|
|
1173
|
-
var BLOCK_LABEL_DEFAULT = "flagged by compliance screening";
|
|
1591
|
+
function isStructuredComplianceBlock(error) {
|
|
1592
|
+
const code = String(error?.code || "").toUpperCase();
|
|
1593
|
+
if (code === "COMPLIANCE_BLOCKED" || code === "COMPLIANCE_BLOCK") return true;
|
|
1594
|
+
return error?.status === 422 && Array.isArray(error?.reasons) && error.reasons.length > 0;
|
|
1595
|
+
}
|
|
1174
1596
|
function classifyQuoteError(error) {
|
|
1175
1597
|
if (!error) return null;
|
|
1176
1598
|
const reasons = Array.isArray(error.reasons) ? error.reasons : [];
|
|
1177
1599
|
const haystack = `${error.message || ""} ${reasons.join(" ")}`;
|
|
1178
1600
|
const catMatch = /blocked_category:\s*([A-Za-z_]+)/i.exec(haystack);
|
|
1179
|
-
const isBlock = !!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);
|
|
1601
|
+
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);
|
|
1180
1602
|
if (!isBlock) return null;
|
|
1181
1603
|
const category = (catMatch?.[1] || "").toUpperCase() || "COMPLIANCE";
|
|
1182
|
-
const label =
|
|
1604
|
+
const label = blockLabelFor([category]);
|
|
1183
1605
|
return {
|
|
1184
1606
|
blocked: true,
|
|
1185
1607
|
category,
|
|
@@ -1201,8 +1623,11 @@ function createApiClient(cfg) {
|
|
|
1201
1623
|
chains: null,
|
|
1202
1624
|
tokens: null,
|
|
1203
1625
|
routes: null,
|
|
1204
|
-
health: null
|
|
1626
|
+
health: null,
|
|
1627
|
+
vaults: null
|
|
1205
1628
|
};
|
|
1629
|
+
const screenCache = /* @__PURE__ */ new Map();
|
|
1630
|
+
const screenInflight = /* @__PURE__ */ new Map();
|
|
1206
1631
|
const apiBase = cfg.apiBase.replace(/\/$/, "");
|
|
1207
1632
|
async function apiRequest(path, init = {}) {
|
|
1208
1633
|
const apiKey = await cfg.getApiKey();
|
|
@@ -1283,6 +1708,19 @@ function createApiClient(cfg) {
|
|
|
1283
1708
|
cache.health = { at: Date.now(), value };
|
|
1284
1709
|
return value;
|
|
1285
1710
|
}
|
|
1711
|
+
async function fetchRwaVaults() {
|
|
1712
|
+
if (nowFresh(cache.vaults)) return cache.vaults.value;
|
|
1713
|
+
let value = [];
|
|
1714
|
+
try {
|
|
1715
|
+
const payload = await apiRequest("/rwa/vaults?status=active,coming_soon", { timeoutMs: 8e3 });
|
|
1716
|
+
const rows = Array.isArray(payload) ? payload : payload?.vaults;
|
|
1717
|
+
value = Array.isArray(rows) ? rows.filter((v) => !!v && typeof v === "object") : [];
|
|
1718
|
+
} catch {
|
|
1719
|
+
value = [];
|
|
1720
|
+
}
|
|
1721
|
+
cache.vaults = { at: Date.now(), value };
|
|
1722
|
+
return value;
|
|
1723
|
+
}
|
|
1286
1724
|
async function fetchQuote(body, retries = 1) {
|
|
1287
1725
|
let lastError;
|
|
1288
1726
|
for (let attempt = 0; attempt <= retries; attempt += 1) {
|
|
@@ -1297,7 +1735,32 @@ function createApiClient(cfg) {
|
|
|
1297
1735
|
}
|
|
1298
1736
|
throw lastError;
|
|
1299
1737
|
}
|
|
1300
|
-
|
|
1738
|
+
async function screenWallet(address, chainId) {
|
|
1739
|
+
const addr = String(address || "").trim();
|
|
1740
|
+
if (!addr) throw apiError("An address is required to screen a wallet.", { code: "bad_request" });
|
|
1741
|
+
const key = `${/^0x[0-9a-fA-F]+$/.test(addr) ? addr.toLowerCase() : addr}|${chainId ?? ""}`;
|
|
1742
|
+
const hit = screenCache.get(key);
|
|
1743
|
+
if (hit && Date.now() - hit.at < SCREEN_CACHE_TTL_MS) return hit.value;
|
|
1744
|
+
const inflight = screenInflight.get(key);
|
|
1745
|
+
if (inflight) return inflight;
|
|
1746
|
+
const request = apiRequest("/screen/wallet", {
|
|
1747
|
+
method: "POST",
|
|
1748
|
+
body: JSON.stringify(chainId == null ? { address: addr } : { address: addr, chainId }),
|
|
1749
|
+
timeoutMs: 12e3
|
|
1750
|
+
}).then((screen) => {
|
|
1751
|
+
if (!screen || typeof screen !== "object" || typeof screen.blocked !== "boolean") {
|
|
1752
|
+
throw apiError("Compliance screening returned an unusable result.", { code: "bad_response" });
|
|
1753
|
+
}
|
|
1754
|
+
const value = { ...screen, address: screen.address || addr };
|
|
1755
|
+
screenCache.set(key, { at: Date.now(), value });
|
|
1756
|
+
return value;
|
|
1757
|
+
}).finally(() => {
|
|
1758
|
+
screenInflight.delete(key);
|
|
1759
|
+
});
|
|
1760
|
+
screenInflight.set(key, request);
|
|
1761
|
+
return request;
|
|
1762
|
+
}
|
|
1763
|
+
return { apiRequest, fetchChains, fetchTokens, fetchRoutes, fetchRouteHealth, fetchRwaVaults, fetchQuote, screenWallet, apiBase };
|
|
1301
1764
|
}
|
|
1302
1765
|
|
|
1303
1766
|
// src/core/plan.ts
|
|
@@ -1365,7 +1828,36 @@ async function fetchPaymentPlan(api, request, payer, wallet = {}, readBalances)
|
|
|
1365
1828
|
balanceTargets.push({ chainId: option.chainId, tokenAddress: option.address, decimals: option.decimals });
|
|
1366
1829
|
}
|
|
1367
1830
|
const walletBalances = readBalances ? await readBalances(payer, balanceTargets).catch(() => ({})) : {};
|
|
1368
|
-
const
|
|
1831
|
+
const directOptions = options.filter((option) => option.direct);
|
|
1832
|
+
let directCompliance = null;
|
|
1833
|
+
if (directOptions.length) {
|
|
1834
|
+
const parties = [];
|
|
1835
|
+
const seenParty = /* @__PURE__ */ new Set();
|
|
1836
|
+
for (const raw of [payer, destination.address]) {
|
|
1837
|
+
const addr = String(raw || "").trim();
|
|
1838
|
+
if (!addr) continue;
|
|
1839
|
+
const key = /^0x[0-9a-fA-F]+$/.test(addr) ? addr.toLowerCase() : addr;
|
|
1840
|
+
if (seenParty.has(key)) continue;
|
|
1841
|
+
seenParty.add(key);
|
|
1842
|
+
parties.push(addr);
|
|
1843
|
+
}
|
|
1844
|
+
try {
|
|
1845
|
+
const screens = await Promise.all(parties.map((address) => api.screenWallet(address, destination.chainId)));
|
|
1846
|
+
const blocked = screens.filter((screen) => screen.blocked);
|
|
1847
|
+
if (blocked.length) {
|
|
1848
|
+
const who = blocked.some((s) => s.address.toLowerCase() === payer.toLowerCase()) ? "your wallet" : "the recipient";
|
|
1849
|
+
const categories = [...new Set(blocked.flatMap((s) => s.blockingCategories ?? []))];
|
|
1850
|
+
throw apiError(
|
|
1851
|
+
`This payment was blocked by compliance screening \u2014 ${who} is ${blockLabelFor(categories)}. Choose a different recipient or connect a different wallet.`,
|
|
1852
|
+
{ blocked: true, blockedCategory: categories[0] || "COMPLIANCE", blockedReason: categories.join(", ") }
|
|
1853
|
+
);
|
|
1854
|
+
}
|
|
1855
|
+
directCompliance = directComplianceFromScreens(screens);
|
|
1856
|
+
} catch (error) {
|
|
1857
|
+
if (error?.blocked) throw error;
|
|
1858
|
+
}
|
|
1859
|
+
}
|
|
1860
|
+
const candidates = directCompliance ? directOptions : [];
|
|
1369
1861
|
const heldOptions = options.filter((option) => !option.direct && hasPositiveBalance(option, walletBalances));
|
|
1370
1862
|
const heldKeys = new Set(heldOptions.map(optionBalanceKey));
|
|
1371
1863
|
const seenChains = /* @__PURE__ */ new Set();
|
|
@@ -1385,7 +1877,16 @@ async function fetchPaymentPlan(api, request, payer, wallet = {}, readBalances)
|
|
|
1385
1877
|
}
|
|
1386
1878
|
const routeErrors = [];
|
|
1387
1879
|
const routePromises = candidates.map(
|
|
1388
|
-
(option) => buildRoute({
|
|
1880
|
+
(option) => buildRoute({
|
|
1881
|
+
option,
|
|
1882
|
+
destination,
|
|
1883
|
+
destinationToken,
|
|
1884
|
+
chains,
|
|
1885
|
+
tokens,
|
|
1886
|
+
payer,
|
|
1887
|
+
fetchQuote: api.fetchQuote,
|
|
1888
|
+
compliance: option.direct ? directCompliance ?? void 0 : void 0
|
|
1889
|
+
}).catch((error) => {
|
|
1389
1890
|
routeErrors.push(error);
|
|
1390
1891
|
return null;
|
|
1391
1892
|
})
|
|
@@ -1498,7 +1999,7 @@ async function buildSwapPlan(api, swap, payer, wallet = {}) {
|
|
|
1498
1999
|
direct: false
|
|
1499
2000
|
};
|
|
1500
2001
|
const destination = { address: receiver, chainId: v.toChainId, asset: destToken.symbol };
|
|
1501
|
-
const route = await buildRoute({ option, destination, destinationToken: destToken, chains, payer: account, fetchQuote: api.fetchQuote, solve: solveExactIn, amountInRaw });
|
|
2002
|
+
const route = await buildRoute({ option, destination, destinationToken: destToken, chains, tokens, payer: account, fetchQuote: api.fetchQuote, solve: solveExactIn, amountInRaw });
|
|
1502
2003
|
if (route.state === "SHORT") throw new Error("ZeroDelta could not price this swap right now.");
|
|
1503
2004
|
route.recommended = true;
|
|
1504
2005
|
return {
|
|
@@ -1853,6 +2354,24 @@ function resolveConfig(config = {}) {
|
|
|
1853
2354
|
}
|
|
1854
2355
|
|
|
1855
2356
|
// src/core/index.ts
|
|
2357
|
+
function sanitizeLegs(legs) {
|
|
2358
|
+
if (!Array.isArray(legs) || !legs.length) return void 0;
|
|
2359
|
+
const text = (v, max) => String(v ?? "").slice(0, max);
|
|
2360
|
+
const chain = (v) => Number(v) || 0;
|
|
2361
|
+
return legs.slice(0, 8).map((leg, i) => ({
|
|
2362
|
+
index: Number(leg?.index) || i + 1,
|
|
2363
|
+
fromAsset: text(leg?.fromAsset, 12),
|
|
2364
|
+
fromChainId: chain(leg?.fromChainId),
|
|
2365
|
+
fromChainName: text(leg?.fromChainName, 40),
|
|
2366
|
+
fromAmount: text(leg?.fromAmount, 40),
|
|
2367
|
+
toAsset: text(leg?.toAsset, 12),
|
|
2368
|
+
toChainId: chain(leg?.toChainId),
|
|
2369
|
+
toChainName: text(leg?.toChainName, 40),
|
|
2370
|
+
toAmount: text(leg?.toAmount, 40),
|
|
2371
|
+
executionChainId: chain(leg?.executionChainId),
|
|
2372
|
+
executionChainName: text(leg?.executionChainName, 40)
|
|
2373
|
+
}));
|
|
2374
|
+
}
|
|
1856
2375
|
function sanitizeTxEntry(entry) {
|
|
1857
2376
|
return {
|
|
1858
2377
|
kind: entry.kind === "swap" ? "swap" : "payment",
|
|
@@ -1868,7 +2387,8 @@ function sanitizeTxEntry(entry) {
|
|
|
1868
2387
|
recipient: isAddress(entry.recipient) ? normalizeAddress(entry.recipient) : "",
|
|
1869
2388
|
settlement: entry.settlement === "direct" ? "direct" : "escrow",
|
|
1870
2389
|
status: entry.status && ["confirmed", "unconfirmed", "error"].includes(entry.status) ? entry.status : "submitted",
|
|
1871
|
-
at: (/* @__PURE__ */ new Date()).toISOString()
|
|
2390
|
+
at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2391
|
+
legs: sanitizeLegs(entry.legs)
|
|
1872
2392
|
};
|
|
1873
2393
|
}
|
|
1874
2394
|
function createEngine(config = {}) {
|
|
@@ -1885,12 +2405,15 @@ function createEngine(config = {}) {
|
|
|
1885
2405
|
fetchRouteHealth: api.fetchRouteHealth,
|
|
1886
2406
|
fetchQuote: api.fetchQuote,
|
|
1887
2407
|
fetchCatalogue: async (allowedAssets, product) => {
|
|
1888
|
-
const [chains,
|
|
2408
|
+
const [chains, registryTokens, routes, health, vaults] = await Promise.all([
|
|
1889
2409
|
api.fetchChains().catch(() => []),
|
|
1890
2410
|
api.fetchTokens().catch(() => []),
|
|
1891
2411
|
api.fetchRoutes().catch(() => []),
|
|
1892
|
-
api.fetchRouteHealth()
|
|
2412
|
+
api.fetchRouteHealth(),
|
|
2413
|
+
api.fetchRwaVaults()
|
|
1893
2414
|
]);
|
|
2415
|
+
const vaultIcons = vaultIconsBySymbol(api.apiBase, vaults);
|
|
2416
|
+
const tokens = withVaultArtwork(registryTokens, vaultIcons);
|
|
1894
2417
|
const allowed = allowedAssets?.length ? new Set([...allowedAssets].map(symbolKey).filter((a) => SUPPORTED_ASSETS.has(a))) : void 0;
|
|
1895
2418
|
return buildCatalogue({
|
|
1896
2419
|
chains,
|
|
@@ -1899,7 +2422,8 @@ function createEngine(config = {}) {
|
|
|
1899
2422
|
product,
|
|
1900
2423
|
...allowed ? { allowedAssets: allowed } : {},
|
|
1901
2424
|
supportedChainIds: SUPPORTED_CHAIN_IDS,
|
|
1902
|
-
brokenLanes: suppressedLanes(health)
|
|
2425
|
+
brokenLanes: suppressedLanes(health),
|
|
2426
|
+
vaultIcons
|
|
1903
2427
|
});
|
|
1904
2428
|
},
|
|
1905
2429
|
fetchPaymentPlan: (request, payer, wallet) => fetchPaymentPlan(api, request, payer, wallet, verifier.readBalances),
|
|
@@ -2363,7 +2887,10 @@ function useFlow(args) {
|
|
|
2363
2887
|
account,
|
|
2364
2888
|
recipient,
|
|
2365
2889
|
settlement: route.state === "DIRECT" ? "direct" : "escrow",
|
|
2366
|
-
status: v.status === "confirmed" ? "confirmed" : v.status === "mismatch" || v.status === "reverted" ? "error" : "unconfirmed"
|
|
2890
|
+
status: v.status === "confirmed" ? "confirmed" : v.status === "mismatch" || v.status === "reverted" ? "error" : "unconfirmed",
|
|
2891
|
+
// One signature can be several orders. Record them, or the history of a chained RWA trade
|
|
2892
|
+
// reads as a single hop that skipped a chain it demonstrably went through.
|
|
2893
|
+
legs: route.legs
|
|
2367
2894
|
});
|
|
2368
2895
|
setLastTxEntry(entry.hash ? entry : null);
|
|
2369
2896
|
appendTxHistory(account, entry);
|
|
@@ -2584,6 +3111,12 @@ var WIDGET_CSS = `
|
|
|
2584
3111
|
@keyframes sg-shimmer{0%{background-position:100% 0}100%{background-position:-100% 0}}
|
|
2585
3112
|
|
|
2586
3113
|
.sg-foot{margin-top:14px;display:flex;align-items:center;justify-content:center;gap:6px;font-size:11px;color:var(--sg-text-muted);text-align:center}
|
|
3114
|
+
/* display:inline-block is load-bearing, not tidiness. A host running a CSS reset \u2014 Tailwind
|
|
3115
|
+
preflight, which most integrators use and which this repo's own playground applies \u2014 sets
|
|
3116
|
+
svg{display:block}, and the padlock then takes a line of its own above the sentence. Every other
|
|
3117
|
+
glyph in the widget sits in a flex or absolute box where that is harmless; this is the one that
|
|
3118
|
+
lives in normal text flow. (WIDGET_CSS is a template literal: no backticks in these comments.) */
|
|
3119
|
+
.sg-foot svg{display:inline-block;vertical-align:-1px;margin-right:5px}
|
|
2587
3120
|
|
|
2588
3121
|
/* fixed-height variant \u2014 head/foot pinned, body scrolls */
|
|
2589
3122
|
.sg-widget[data-sg-fixed="true"]{display:flex;flex-direction:column}
|
|
@@ -2603,6 +3136,7 @@ var WIDGET_CSS = `
|
|
|
2603
3136
|
.sg-tile:disabled{cursor:default}
|
|
2604
3137
|
.sg-tile-label{font-size:12px;color:var(--sg-text-muted)}
|
|
2605
3138
|
.sg-tile-main{display:flex;align-items:center;gap:10px;min-width:0}
|
|
3139
|
+
.sg-tile-text{display:block;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
2606
3140
|
.sg-tile-sym{font-size:16px;font-weight:700;line-height:1.15;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
|
2607
3141
|
.sg-tile-chain{font-size:11px;color:var(--sg-text-muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
|
2608
3142
|
.sg-tile-empty{color:var(--sg-text-muted);font-size:15px;font-weight:600}
|
|
@@ -2637,7 +3171,9 @@ img.sg-tok-badge{width:16px;padding:0;object-fit:cover;background:var(--sg-bg)}
|
|
|
2637
3171
|
.sg-sel-head{display:flex;align-items:center;margin-bottom:14px}
|
|
2638
3172
|
.sg-back{width:32px;height:32px;flex:0 0 auto;border:none;border-radius:999px;background:transparent;color:var(--sg-text);cursor:pointer;font:inherit;display:flex;align-items:center;justify-content:center;transition:background 120ms ease}
|
|
2639
3173
|
.sg-back:hover{background:var(--sg-surface)}
|
|
2640
|
-
.sg-sel-title{flex:1 1 auto;text-align:center;font-size:15px;font-weight:600;margin-right:32px}
|
|
3174
|
+
.sg-sel-title{flex:1 1 auto;min-width:0;text-align:center;font-size:15px;font-weight:600;margin-right:32px}
|
|
3175
|
+
/* Whose transactions these are \u2014 history is per wallet, and the takeover hides the header's pill. */
|
|
3176
|
+
.sg-sel-sub{display:block;font-size:11px;font-weight:600;color:var(--sg-text-muted);margin-top:1px}
|
|
2641
3177
|
/* Scrolls at ~2.5 rows. The catalogue's destination chains outnumber its source chains three to one
|
|
2642
3178
|
(9 escrow chains, ~37 total), so an ungated grid was eight rows tall and pushed the token list \u2014
|
|
2643
3179
|
the thing the panel exists for \u2014 below the fold. The fade is a scroll affordance, not decoration. */
|
|
@@ -2696,6 +3232,53 @@ img.sg-tok-badge{width:16px;padding:0;object-fit:cover;background:var(--sg-bg)}
|
|
|
2696
3232
|
.sg-hist{width:32px;height:32px;flex:0 0 auto;border:1px solid var(--sg-border);border-radius:999px;background:transparent;color:var(--sg-text-muted);cursor:pointer;font:inherit;display:flex;align-items:center;justify-content:center;transition:color 120ms ease,border-color 120ms ease}
|
|
2697
3233
|
.sg-hist:hover{color:var(--sg-accent);border-color:var(--sg-accent)}
|
|
2698
3234
|
|
|
3235
|
+
/* transaction history row. NOT the picker's flex row: at 390px that layout wrapped the pair onto two
|
|
3236
|
+
lines and then ellipsised the whole meta line down to "\u2026". A 3-column grid instead, where the meta
|
|
3237
|
+
spans the badge column so it always has the full card width to wrap into. */
|
|
3238
|
+
.sg-txrow{display:grid;grid-template-columns:auto minmax(0,1fr);column-gap:11px;row-gap:3px;align-items:center;width:100%;padding:10px 8px;border:none;border-radius:var(--sg-radius-control);background:transparent;color:var(--sg-text);cursor:pointer;font:inherit;text-align:left;transition:background 120ms ease}
|
|
3239
|
+
.sg-txrow:hover{background:var(--sg-surface)}
|
|
3240
|
+
/* Both ends of the trade, side by side \u2014 the RWA gets a mark of its own. NOT overlapped: each disc
|
|
3241
|
+
carries a chain badge at its bottom-right, and an overlap parks that badge on top of its neighbour. */
|
|
3242
|
+
.sg-txrow-glyphs{grid-column:1;grid-row:1 / span 2;display:flex;align-items:center;gap:9px}
|
|
3243
|
+
/* Each side is its own nowrap span, so a narrow card breaks the line AT THE ARROW, never mid-symbol. */
|
|
3244
|
+
.sg-txrow-pair{grid-column:2;grid-row:1;display:flex;flex-wrap:wrap;align-items:baseline;gap:0 6px;font-size:14px;font-weight:700;line-height:1.35;min-width:0}
|
|
3245
|
+
.sg-txrow-side{white-space:nowrap;display:inline-flex;align-items:center;gap:5px}
|
|
3246
|
+
.sg-txrow-arrow{display:inline-flex;color:var(--sg-text-muted)}
|
|
3247
|
+
/* Meta and status share line 2. The badge sat beside the pair until it squeezed the pair onto two
|
|
3248
|
+
lines at 390px; down here the pair gets the card's full width and the badge still reads at a glance. */
|
|
3249
|
+
/* flex-start, not center: on a phone the meta wraps to two lines, and a centred badge then floats
|
|
3250
|
+
between them. Pinned to the first line it reads as the row's status rather than as a third line. */
|
|
3251
|
+
.sg-txrow-meta{grid-column:2;grid-row:2;display:flex;align-items:flex-start;gap:8px;font-size:11.5px;color:var(--sg-text-muted);line-height:1.4}
|
|
3252
|
+
.sg-txrow-when{flex:1 1 auto;min-width:0;display:flex;flex-wrap:wrap;column-gap:8px}
|
|
3253
|
+
/* The kind+chain+orders unit WRAPS; only the timestamp is unbreakable. Holding both as nowrap made
|
|
3254
|
+
the express card (the narrowest surface) overflow its text straight under the status pill. */
|
|
3255
|
+
.sg-txrow-time{white-space:nowrap}
|
|
3256
|
+
.sg-txrow-what{display:flex;flex-wrap:wrap;column-gap:5px;min-width:0}
|
|
3257
|
+
.sg-txrow-what>span{white-space:nowrap}
|
|
3258
|
+
/* The separator is the literal character, never a CSS unicode escape. WIDGET_CSS is a JS template
|
|
3259
|
+
literal, so a backslash-zero-zero escape in here is a legacy octal sequence and esbuild refuses to
|
|
3260
|
+
build the package at all \u2014 including inside a comment like this one. */
|
|
3261
|
+
.sg-txrow-what>span:not(:last-child)::after{content:"\xB7";margin-left:5px}
|
|
3262
|
+
.sg-txrow-end{flex:0 0 auto;margin-left:auto}
|
|
3263
|
+
|
|
3264
|
+
/* transaction detail: the route, one row per ORDER. A chained (RWA) trade is ONE signature and TWO
|
|
3265
|
+
orders; the numbered rail is what makes the middle hop visible instead of merely implied. */
|
|
3266
|
+
/* The pair's artwork above the anchor amount, same marks the pickers draw. */
|
|
3267
|
+
.sg-panel > .sg-txrow-glyphs{margin-bottom:10px}
|
|
3268
|
+
.sg-legs{margin-top:14px}
|
|
3269
|
+
.sg-legs-head{display:flex;align-items:center;justify-content:space-between;gap:8px;font-size:13px;margin-bottom:6px}
|
|
3270
|
+
.sg-leg-list{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:2px}
|
|
3271
|
+
.sg-leg{display:flex;align-items:flex-start;gap:10px;padding:8px 0;border-bottom:1px solid var(--sg-border)}
|
|
3272
|
+
.sg-leg:last-child{border-bottom:none}
|
|
3273
|
+
/* The step number doubles as the rail: a pseudo-element joins consecutive orders, so two legs read as
|
|
3274
|
+
one continuous path rather than as two unrelated rows. */
|
|
3275
|
+
.sg-leg-n{position:relative;flex:0 0 auto;display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;margin-top:1px;border-radius:999px;background:color-mix(in srgb,var(--sg-accent) 14%,transparent);color:var(--sg-accent);font-size:10px;font-weight:700;font-variant-numeric:tabular-nums}
|
|
3276
|
+
.sg-leg:not(:last-child) .sg-leg-n::after{content:"";position:absolute;top:19px;left:50%;width:1px;height:calc(100% + 6px);background:var(--sg-border)}
|
|
3277
|
+
.sg-leg-body{min-width:0;flex:1 1 auto}
|
|
3278
|
+
.sg-leg-line{display:flex;align-items:center;gap:7px;flex-wrap:wrap;font-size:13px;font-weight:600}
|
|
3279
|
+
.sg-leg-arrow{display:inline-flex;color:var(--sg-text-muted)}
|
|
3280
|
+
.sg-leg-sub{margin-top:2px;font-size:11.5px;color:var(--sg-text-muted);line-height:1.45}
|
|
3281
|
+
|
|
2699
3282
|
/* transaction detail: copyable hash row (no external links \u2014 everything stays in-widget) */
|
|
2700
3283
|
.sg-txd-hash{display:flex;align-items:center;gap:8px;margin-top:12px;font-size:13px}
|
|
2701
3284
|
.sg-txd-hash .sg-mono{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
@@ -2846,6 +3429,98 @@ img.sg-tok-badge{width:16px;padding:0;object-fit:cover;background:var(--sg-bg)}
|
|
|
2846
3429
|
.sg-island .sg-spinner{display:none!important}
|
|
2847
3430
|
.sg-island .sg-rm-dot{display:inline-block}
|
|
2848
3431
|
}
|
|
3432
|
+
|
|
3433
|
+
/* \u2500\u2500 compliance disclosure \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
3434
|
+
Mirrors the dApp's compliance row + details dialog. The row is a quiet affordance in the payment
|
|
3435
|
+
summary; the details open a sheet that fills the widget's own card, because a page-level modal
|
|
3436
|
+
inside somebody else's checkout is a z-index fight we would lose.
|
|
3437
|
+
|
|
3438
|
+
Tone note, carried over from the dApp: a PASS reads in body ink, not in green. The shield tick is
|
|
3439
|
+
already green, so colouring the sentence too says the same thing twice and spends the accent on
|
|
3440
|
+
the half that carries no information. A DENY still shouts. */
|
|
3441
|
+
/* NOT positioned. The sheet is inset:0 against the WIDGET CARD, so this wrapper must not become
|
|
3442
|
+
the containing block: when it carried position:relative the sheet collapsed to the height of
|
|
3443
|
+
this one row and drew straight through the CTA beneath it.
|
|
3444
|
+
NB this stylesheet is a JS template literal - never write a backtick in these comments. */
|
|
3445
|
+
.sg-cp{margin-top:10px}
|
|
3446
|
+
.sg-cp-row{display:flex;align-items:center;justify-content:space-between;gap:8px;width:100%;padding:9px 12px;border:1px solid var(--sg-border);border-radius:var(--sg-radius-control);background:var(--sg-surface);color:inherit;font:inherit;text-align:left;cursor:pointer;transition:border-color 120ms ease,background 120ms ease}
|
|
3447
|
+
.sg-cp-row:hover{border-color:color-mix(in srgb,var(--sg-accent) 40%,var(--sg-border))}
|
|
3448
|
+
.sg-cp-row:focus-visible{outline:2px solid var(--sg-accent);outline-offset:2px}
|
|
3449
|
+
.sg-cp-row-main{display:flex;align-items:center;gap:8px;min-width:0}
|
|
3450
|
+
.sg-cp-row-glyph{display:flex;flex:0 0 auto;color:var(--sg-success)}
|
|
3451
|
+
.sg-cp-row[data-tone="neutral"] .sg-cp-row-glyph{color:var(--sg-text-muted);opacity:.55}
|
|
3452
|
+
.sg-cp-row[data-tone="blocked"] .sg-cp-row-glyph,.sg-cp-row[data-tone="warn"] .sg-cp-row-glyph{color:var(--sg-danger)}
|
|
3453
|
+
.sg-cp-row-label{font-size:13px;font-weight:500;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
3454
|
+
.sg-cp-row[data-tone="neutral"] .sg-cp-row-label{color:var(--sg-text-muted)}
|
|
3455
|
+
.sg-cp-row[data-tone="blocked"] .sg-cp-row-label,.sg-cp-row[data-tone="warn"] .sg-cp-row-label{color:var(--sg-danger)}
|
|
3456
|
+
.sg-cp-row-chev{display:flex;flex:0 0 auto;color:var(--sg-text-muted)}
|
|
3457
|
+
.sg-cp-row-tag{display:block;margin:4px 0 0 32px;font-size:11px;text-transform:uppercase;letter-spacing:.04em;color:var(--sg-text-muted)}
|
|
3458
|
+
|
|
3459
|
+
/* the sheet \u2014 fills the widget card */
|
|
3460
|
+
.sg-cp-sheet{display:flex;flex-direction:column;padding:14px;background:var(--sg-bg);border:1px solid var(--sg-border);border-radius:var(--sg-radius-control);animation:sg-cp-in var(--sg-motion-fast) var(--sg-ease-out-soft) both}
|
|
3461
|
+
@keyframes sg-cp-in{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}
|
|
3462
|
+
.sg-cp-sheet:focus{outline:none}
|
|
3463
|
+
.sg-cp-sheet-head{display:flex;align-items:center;justify-content:space-between;gap:8px;flex:0 0 auto}
|
|
3464
|
+
.sg-cp-sheet-title{margin:0;font-size:15px;font-weight:600}
|
|
3465
|
+
.sg-cp-close{display:flex;align-items:center;justify-content:center;width:28px;height:28px;flex:0 0 auto;border:0;border-radius:8px;background:transparent;color:var(--sg-text-muted);cursor:pointer;transition:background 120ms ease,color 120ms ease}
|
|
3466
|
+
.sg-cp-close:hover{background:var(--sg-surface);color:var(--sg-text)}
|
|
3467
|
+
.sg-cp-close:focus-visible{outline:2px solid var(--sg-accent);outline-offset:2px}
|
|
3468
|
+
.sg-cp-tabs{display:flex;align-items:center;gap:4px;flex:0 0 auto;margin-top:10px;padding:4px;border:1px solid var(--sg-border);border-radius:14px}
|
|
3469
|
+
.sg-cp-tab{flex:1 1 0;min-width:0;padding:7px 8px;border:0;border-radius:11px;background:transparent;color:var(--sg-text-muted);font:inherit;font-size:10px;font-weight:700;text-transform:uppercase;letter-spacing:.5px;cursor:pointer;transition:background 120ms ease,color 120ms ease}
|
|
3470
|
+
.sg-cp-tab[data-active="true"]{background:color-mix(in srgb,var(--sg-accent) 10%,transparent);color:var(--sg-accent)}
|
|
3471
|
+
.sg-cp-tab:focus-visible{outline:2px solid var(--sg-accent);outline-offset:-2px}
|
|
3472
|
+
.sg-cp-sheet-body{margin-top:10px}
|
|
3473
|
+
.sg-cp-tabpanel{display:flex;flex-direction:column;gap:8px}
|
|
3474
|
+
|
|
3475
|
+
/* cards */
|
|
3476
|
+
.sg-cp-card{display:flex;flex-direction:column;gap:12px;padding:14px;border:1px solid var(--sg-border);border-radius:16px}
|
|
3477
|
+
.sg-cp-card-head{display:flex;align-items:center;gap:8px}
|
|
3478
|
+
.sg-cp-card-glyph{display:flex;flex:0 0 auto;color:var(--sg-accent)}
|
|
3479
|
+
.sg-cp-card-title{margin:0;font-size:14px;font-weight:600}
|
|
3480
|
+
.sg-cp-summary{display:flex;flex-direction:column;gap:3px}
|
|
3481
|
+
.sg-cp-summary-head{display:flex;align-items:center;gap:8px;color:var(--sg-success)}
|
|
3482
|
+
.sg-cp-summary-head[data-tone="neutral"]{color:var(--sg-text-muted)}
|
|
3483
|
+
.sg-cp-summary-head[data-tone="blocked"],.sg-cp-summary-head[data-tone="warn"]{color:var(--sg-danger)}
|
|
3484
|
+
.sg-cp-summary-title{font-size:14px;font-weight:600;color:var(--sg-text)}
|
|
3485
|
+
.sg-cp-summary-head[data-tone="blocked"] .sg-cp-summary-title,.sg-cp-summary-head[data-tone="warn"] .sg-cp-summary-title{color:var(--sg-danger)}
|
|
3486
|
+
.sg-cp-summary-sub{margin:0;padding-left:24px;font-size:12px;line-height:1.35;color:var(--sg-text-muted)}
|
|
3487
|
+
|
|
3488
|
+
/* per-control rows */
|
|
3489
|
+
.sg-cp-checks{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:11px}
|
|
3490
|
+
.sg-cp-check-head{display:flex;flex-wrap:wrap;align-items:center;gap:6px 14px}
|
|
3491
|
+
.sg-cp-check-label{display:flex;align-items:center;gap:8px;min-width:0;font-size:13.5px;line-height:1.25}
|
|
3492
|
+
.sg-cp-check[data-ok="false"] .sg-cp-check-label{color:var(--sg-danger)}
|
|
3493
|
+
.sg-cp-check-mark{display:flex;flex:0 0 auto;color:var(--sg-success)}
|
|
3494
|
+
.sg-cp-check-mark[data-ok="false"]{color:var(--sg-danger)}
|
|
3495
|
+
.sg-cp-check-note,.sg-cp-check-reason{display:block;padding-left:20px;margin-top:3px;font-size:11.5px;line-height:1.4;color:var(--sg-text-muted);overflow-wrap:anywhere}
|
|
3496
|
+
.sg-cp-check-reason{color:var(--sg-danger)}
|
|
3497
|
+
.sg-cp-link{display:inline-flex;align-items:center;gap:5px;padding:0;border:0;background:transparent;color:var(--sg-accent);font:inherit;font-size:12px;font-weight:500;cursor:pointer}
|
|
3498
|
+
.sg-cp-link:hover{text-decoration:underline}
|
|
3499
|
+
.sg-cp-link:focus-visible{outline:2px solid var(--sg-accent);outline-offset:2px;border-radius:4px}
|
|
3500
|
+
.sg-cp-orphans{list-style:none;margin:0;padding:0 0 0 20px;display:flex;flex-direction:column;gap:3px;font-size:11.5px;line-height:1.4;color:var(--sg-danger)}
|
|
3501
|
+
.sg-cp-scope{margin:0;font-size:11.5px;line-height:1.45;color:var(--sg-text-muted)}
|
|
3502
|
+
.sg-cp-flags{margin:0;font-size:13px}
|
|
3503
|
+
|
|
3504
|
+
/* quote details */
|
|
3505
|
+
.sg-cp-facts{margin:0;display:flex;flex-direction:column;gap:9px}
|
|
3506
|
+
.sg-cp-fact{display:grid;grid-template-columns:78px minmax(0,1fr);align-items:center;gap:10px}
|
|
3507
|
+
.sg-cp-fact dt{font-size:12px;color:var(--sg-text-muted)}
|
|
3508
|
+
.sg-cp-fact dd{margin:0;font-size:13px;min-width:0;overflow-wrap:anywhere}
|
|
3509
|
+
|
|
3510
|
+
/* screening policy */
|
|
3511
|
+
.sg-cp-policy-head{display:flex;flex-wrap:wrap;align-items:flex-start;justify-content:space-between;gap:8px;padding-bottom:2px}
|
|
3512
|
+
.sg-cp-policy-id{font-size:11px;color:var(--sg-text-muted);overflow-wrap:anywhere}
|
|
3513
|
+
.sg-cp-policy-facts{padding:2px 0 8px}
|
|
3514
|
+
.sg-cp-buckets{display:flex;flex-direction:column;gap:8px}
|
|
3515
|
+
.sg-cp-bucket{gap:10px;padding:12px 14px}
|
|
3516
|
+
.sg-cp-bucket-head{display:flex;flex-wrap:wrap;align-items:baseline;justify-content:space-between;gap:4px 10px}
|
|
3517
|
+
.sg-cp-bucket-detail{font-size:11.5px;color:var(--sg-text-muted)}
|
|
3518
|
+
.sg-cp-cats{list-style:none;margin:0;padding:0 0 0 4px;display:flex;flex-direction:column;gap:5px}
|
|
3519
|
+
.sg-cp-cats li{display:flex;align-items:center;gap:10px;font-size:12.5px;line-height:1.35}
|
|
3520
|
+
.sg-cp-dot{flex:0 0 auto;width:4px;height:4px;border-radius:999px;background:var(--sg-accent);opacity:.8}
|
|
3521
|
+
|
|
3522
|
+
/* express (PaymentIsland) trims the card padding, so the sheet follows */
|
|
3523
|
+
@media (prefers-reduced-motion:reduce){.sg-cp-sheet{animation:none}}
|
|
2849
3524
|
`;
|
|
2850
3525
|
var injected = false;
|
|
2851
3526
|
function injectStyles() {
|
|
@@ -2993,13 +3668,13 @@ function WidgetShell(props) {
|
|
|
2993
3668
|
] })
|
|
2994
3669
|
] }),
|
|
2995
3670
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-body", children: props.children }),
|
|
2996
|
-
/* @__PURE__ */ jsxRuntime.
|
|
3671
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-foot", children: /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
2997
3672
|
/* @__PURE__ */ jsxRuntime.jsx(LockGlyph, {}),
|
|
2998
3673
|
" Your wallet signs every transaction \xB7 Powered by ZeroDelta"
|
|
2999
|
-
] })
|
|
3674
|
+
] }) })
|
|
3000
3675
|
] });
|
|
3001
3676
|
}
|
|
3002
|
-
function
|
|
3677
|
+
function shortAddress2(a) {
|
|
3003
3678
|
if (!a) return "";
|
|
3004
3679
|
return `${a.slice(0, 6)}\u2026${a.slice(-4)}`;
|
|
3005
3680
|
}
|
|
@@ -3211,6 +3886,251 @@ function RouteList(props) {
|
|
|
3211
3886
|
] }) : null
|
|
3212
3887
|
] });
|
|
3213
3888
|
}
|
|
3889
|
+
function ShieldTick({ size = 16 }) {
|
|
3890
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: [
|
|
3891
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 2.5 4.5 5.5v6c0 4.4 3.1 8.5 7.5 10 4.4-1.5 7.5-5.6 7.5-10v-6L12 2.5Z", fill: "currentColor", opacity: ".14" }),
|
|
3892
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 2.5 4.5 5.5v6c0 4.4 3.1 8.5 7.5 10 4.4-1.5 7.5-5.6 7.5-10v-6L12 2.5Z", stroke: "currentColor", strokeWidth: "1.6", strokeLinejoin: "round" }),
|
|
3893
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "m8.6 11.9 2.3 2.3 4.5-4.5", stroke: "currentColor", strokeWidth: "1.9", strokeLinecap: "round", strokeLinejoin: "round" })
|
|
3894
|
+
] });
|
|
3895
|
+
}
|
|
3896
|
+
function TickCircle({ size = 16 }) {
|
|
3897
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: [
|
|
3898
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "12", r: "10", fill: "currentColor" }),
|
|
3899
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "m7.8 12.2 2.7 2.7 5.7-5.8", stroke: "var(--sg-bg)", strokeWidth: "2.1", strokeLinecap: "round", strokeLinejoin: "round" })
|
|
3900
|
+
] });
|
|
3901
|
+
}
|
|
3902
|
+
function CloseCircle({ size = 16 }) {
|
|
3903
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: [
|
|
3904
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "12", r: "10", fill: "currentColor" }),
|
|
3905
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "m8.7 8.7 6.6 6.6M15.3 8.7l-6.6 6.6", stroke: "var(--sg-bg)", strokeWidth: "2.1", strokeLinecap: "round" })
|
|
3906
|
+
] });
|
|
3907
|
+
}
|
|
3908
|
+
function PendingCircle({ size = 16 }) {
|
|
3909
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: [
|
|
3910
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "12", r: "9.2", stroke: "currentColor", strokeWidth: "1.6", strokeDasharray: "3 3" }),
|
|
3911
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M8.5 12h7", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round" })
|
|
3912
|
+
] });
|
|
3913
|
+
}
|
|
3914
|
+
function Tick({ size = 12 }) {
|
|
3915
|
+
return /* @__PURE__ */ jsxRuntime.jsx("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "m4.5 12.8 5 5L19.5 6.5", stroke: "currentColor", strokeWidth: "3", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
3916
|
+
}
|
|
3917
|
+
function Cross({ size = 12 }) {
|
|
3918
|
+
return /* @__PURE__ */ jsxRuntime.jsx("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "m5.5 5.5 13 13M18.5 5.5l-13 13", stroke: "currentColor", strokeWidth: "3", strokeLinecap: "round" }) });
|
|
3919
|
+
}
|
|
3920
|
+
function Chevron({ size = 16 }) {
|
|
3921
|
+
return /* @__PURE__ */ jsxRuntime.jsx("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "m9 5 7 7-7 7", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
3922
|
+
}
|
|
3923
|
+
function Info({ size = 16 }) {
|
|
3924
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: [
|
|
3925
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "12", r: "10", fill: "currentColor" }),
|
|
3926
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 10.6v6", stroke: "var(--sg-bg)", strokeWidth: "2.1", strokeLinecap: "round" }),
|
|
3927
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "7.6", r: "1.25", fill: "var(--sg-bg)" })
|
|
3928
|
+
] });
|
|
3929
|
+
}
|
|
3930
|
+
function Lock({ size = 16 }) {
|
|
3931
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: [
|
|
3932
|
+
/* @__PURE__ */ jsxRuntime.jsx("rect", { x: "4.5", y: "10.5", width: "15", height: "9.5", rx: "2.2", stroke: "currentColor", strokeWidth: "1.7" }),
|
|
3933
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M8 10.5V7.8a4 4 0 0 1 8 0v2.7", stroke: "currentColor", strokeWidth: "1.7", strokeLinecap: "round" })
|
|
3934
|
+
] });
|
|
3935
|
+
}
|
|
3936
|
+
function ShieldOutline({ size = 16 }) {
|
|
3937
|
+
return /* @__PURE__ */ jsxRuntime.jsx("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 2.5 4.5 5.5v6c0 4.4 3.1 8.5 7.5 10 4.4-1.5 7.5-5.6 7.5-10v-6L12 2.5Z", stroke: "currentColor", strokeWidth: "1.7", strokeLinejoin: "round" }) });
|
|
3938
|
+
}
|
|
3939
|
+
function WarningFilled({ size = 16 }) {
|
|
3940
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: [
|
|
3941
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 3.2 21.4 19.4H2.6L12 3.2Z", fill: "currentColor" }),
|
|
3942
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 9.4v4.3", stroke: "var(--sg-bg)", strokeWidth: "1.9", strokeLinecap: "round" }),
|
|
3943
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "16.4", r: "1.05", fill: "var(--sg-bg)" })
|
|
3944
|
+
] });
|
|
3945
|
+
}
|
|
3946
|
+
function CornerArrow({ size = 12 }) {
|
|
3947
|
+
return /* @__PURE__ */ jsxRuntime.jsx("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M7 17 17 7M9 7h8v8", stroke: "currentColor", strokeWidth: "2.2", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
3948
|
+
}
|
|
3949
|
+
var POLICY_GLYPH = {
|
|
3950
|
+
"always-blocked": Lock,
|
|
3951
|
+
blocked: ShieldOutline,
|
|
3952
|
+
flagged: WarningFilled
|
|
3953
|
+
};
|
|
3954
|
+
var POLICY_DETAIL = {
|
|
3955
|
+
"always-blocked": "Cannot be changed or disabled",
|
|
3956
|
+
blocked: "Stops the payment",
|
|
3957
|
+
flagged: "Does not automatically block"
|
|
3958
|
+
};
|
|
3959
|
+
function shortAddr(a) {
|
|
3960
|
+
return a.length > 14 ? `${a.slice(0, 6)}\u2026${a.slice(-4)}` : a;
|
|
3961
|
+
}
|
|
3962
|
+
function TriggerGlyph({ cv }) {
|
|
3963
|
+
if (cv.tone === "blocked" || cv.tone === "warn") return /* @__PURE__ */ jsxRuntime.jsx(CloseCircle, {});
|
|
3964
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ShieldTick, {});
|
|
3965
|
+
}
|
|
3966
|
+
function CheckRow({ check, onViewPolicy }) {
|
|
3967
|
+
const label = check.id === "risk" ? check.ok ? "Risk screening passed" : "Risk screening failed" : check.label;
|
|
3968
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("li", { className: "sg-cp-check", "data-ok": check.ok, children: [
|
|
3969
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-check-head", children: [
|
|
3970
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-cp-check-label", children: [
|
|
3971
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-check-mark", "data-ok": check.ok, children: check.ok ? /* @__PURE__ */ jsxRuntime.jsx(Tick, {}) : /* @__PURE__ */ jsxRuntime.jsx(Cross, {}) }),
|
|
3972
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: label }),
|
|
3973
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-sr-only", children: check.ok ? " \u2014 passed" : " \u2014 failed" })
|
|
3974
|
+
] }),
|
|
3975
|
+
check.id === "risk" ? /* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", className: "sg-cp-link", onClick: onViewPolicy, children: [
|
|
3976
|
+
"View policy",
|
|
3977
|
+
/* @__PURE__ */ jsxRuntime.jsx(CornerArrow, {})
|
|
3978
|
+
] }) : null
|
|
3979
|
+
] }),
|
|
3980
|
+
check.note ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-check-note", children: check.note }) : null,
|
|
3981
|
+
check.reasons.map((reason) => /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-check-reason", children: humanizeComplianceReason(reason) }, reason))
|
|
3982
|
+
] });
|
|
3983
|
+
}
|
|
3984
|
+
function QuoteChecks({
|
|
3985
|
+
compliance,
|
|
3986
|
+
cv,
|
|
3987
|
+
checks,
|
|
3988
|
+
direct,
|
|
3989
|
+
onViewPolicy
|
|
3990
|
+
}) {
|
|
3991
|
+
const allPassed = cv.tone === "ok" && checks.length > 0 && checks.every((c) => c.ok);
|
|
3992
|
+
const summary = allPassed ? "All checks passed" : cv.label;
|
|
3993
|
+
const orphans = unattributedComplianceReasons(compliance, cv);
|
|
3994
|
+
const wallets = distinctScreenedWallets(compliance);
|
|
3995
|
+
const jurisdiction = compliance?.sourceJurisdiction?.trim();
|
|
3996
|
+
const hasDetails = Boolean(jurisdiction || wallets.length || compliance?.checkId);
|
|
3997
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-tabpanel", role: "tabpanel", "aria-label": "Quote checks", children: [
|
|
3998
|
+
/* @__PURE__ */ jsxRuntime.jsxs("section", { className: "sg-cp-card", children: [
|
|
3999
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-summary", children: [
|
|
4000
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-cp-summary-head", "data-tone": cv.tone, children: [
|
|
4001
|
+
cv.tone === "blocked" || cv.tone === "warn" ? /* @__PURE__ */ jsxRuntime.jsx(CloseCircle, {}) : cv.tone === "neutral" ? /* @__PURE__ */ jsxRuntime.jsx(PendingCircle, {}) : /* @__PURE__ */ jsxRuntime.jsx(TickCircle, {}),
|
|
4002
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-summary-title", children: summary })
|
|
4003
|
+
] }),
|
|
4004
|
+
checks.length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "sg-cp-summary-sub", children: [
|
|
4005
|
+
checks.length,
|
|
4006
|
+
" check",
|
|
4007
|
+
checks.length === 1 ? " was" : "s were",
|
|
4008
|
+
" completed for this payment"
|
|
4009
|
+
] }) : (
|
|
4010
|
+
// No decision was issued. Listing the controls here would be ticks for a verdict nobody
|
|
4011
|
+
// gave, and an unconfigured gate is not a set of passed checks.
|
|
4012
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "sg-cp-summary-sub", children: "The gateway returned no compliance decision for this quote, so there is nothing to show. It is not a failed check." })
|
|
4013
|
+
)
|
|
4014
|
+
] }),
|
|
4015
|
+
checks.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "sg-cp-checks", children: checks.map((check) => /* @__PURE__ */ jsxRuntime.jsx(CheckRow, { check, onViewPolicy }, check.id)) }) : null,
|
|
4016
|
+
orphans.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "sg-cp-orphans", children: orphans.map((reason) => /* @__PURE__ */ jsxRuntime.jsx("li", { children: humanizeComplianceReason(reason) }, reason)) }) : null,
|
|
4017
|
+
direct && checks.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "sg-cp-scope", children: DIRECT_SCOPE_NOTE }) : null
|
|
4018
|
+
] }),
|
|
4019
|
+
compliance?.flaggedCategories?.length ? /* @__PURE__ */ jsxRuntime.jsxs("section", { className: "sg-cp-card", children: [
|
|
4020
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-card-head", children: [
|
|
4021
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-card-glyph", children: /* @__PURE__ */ jsxRuntime.jsx(WarningFilled, {}) }),
|
|
4022
|
+
/* @__PURE__ */ jsxRuntime.jsx("h5", { className: "sg-cp-card-title", children: "Flagged, not blocking" })
|
|
4023
|
+
] }),
|
|
4024
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "sg-cp-flags", children: compliance.flaggedCategories.map(categoryLabel).join(" \xB7 ") }),
|
|
4025
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "sg-cp-scope", children: "The policy records these and still allows the payment. They do not stop settlement." })
|
|
4026
|
+
] }) : null,
|
|
4027
|
+
hasDetails ? /* @__PURE__ */ jsxRuntime.jsxs("section", { className: "sg-cp-card", children: [
|
|
4028
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-card-head", children: [
|
|
4029
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-card-glyph", children: /* @__PURE__ */ jsxRuntime.jsx(Info, {}) }),
|
|
4030
|
+
/* @__PURE__ */ jsxRuntime.jsx("h5", { className: "sg-cp-card-title", children: "Quote details" })
|
|
4031
|
+
] }),
|
|
4032
|
+
/* @__PURE__ */ jsxRuntime.jsxs("dl", { className: "sg-cp-facts", children: [
|
|
4033
|
+
jurisdiction ? /* @__PURE__ */ jsxRuntime.jsx(Fact, { label: "Jurisdiction", value: jurisdiction }) : null,
|
|
4034
|
+
wallets.map((w, i) => /* @__PURE__ */ jsxRuntime.jsx(Fact, { label: wallets.length > 1 ? i === 0 ? "Payer" : "Recipient" : "Wallet", value: shortAddr(w), title: w, mono: true }, w)),
|
|
4035
|
+
compliance?.checkId ? /* @__PURE__ */ jsxRuntime.jsx(Fact, { label: "Check ID", value: compliance.checkId, mono: true }) : null
|
|
4036
|
+
] })
|
|
4037
|
+
] }) : null
|
|
4038
|
+
] });
|
|
4039
|
+
}
|
|
4040
|
+
function Fact({ label, value, title, mono = false }) {
|
|
4041
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-fact", children: [
|
|
4042
|
+
/* @__PURE__ */ jsxRuntime.jsx("dt", { children: label }),
|
|
4043
|
+
/* @__PURE__ */ jsxRuntime.jsx("dd", { title, className: mono ? "sg-mono" : void 0, children: value })
|
|
4044
|
+
] });
|
|
4045
|
+
}
|
|
4046
|
+
function ScreeningPolicy({ compliance }) {
|
|
4047
|
+
const policyId = compliance?.policyVersion?.trim();
|
|
4048
|
+
const applied = Boolean(compliance?.decision || policyId || compliance?.appliedPolicyNames?.length);
|
|
4049
|
+
const names = [...compliance?.appliedPolicyNames ?? [], ...compliance?.appliedLegislation ?? []];
|
|
4050
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-tabpanel", role: "tabpanel", "aria-label": "Screening policy", children: [
|
|
4051
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-policy-head", children: [
|
|
4052
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-summary", children: [
|
|
4053
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-cp-summary-head", "data-tone": applied ? "ok" : "neutral", children: [
|
|
4054
|
+
applied ? /* @__PURE__ */ jsxRuntime.jsx(TickCircle, {}) : /* @__PURE__ */ jsxRuntime.jsx(PendingCircle, {}),
|
|
4055
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-summary-title", children: "Transaction screening policy" })
|
|
4056
|
+
] }),
|
|
4057
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "sg-cp-summary-sub", children: applied ? "Applied to this payment" : "No policy decision was returned" })
|
|
4058
|
+
] }),
|
|
4059
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-policy-id sg-mono", children: policyId ? `Policy ${policyId}` : "Policy ID unavailable" })
|
|
4060
|
+
] }),
|
|
4061
|
+
names.length ? /* @__PURE__ */ jsxRuntime.jsxs("dl", { className: "sg-cp-facts sg-cp-policy-facts", children: [
|
|
4062
|
+
compliance?.appliedPolicyNames?.length ? /* @__PURE__ */ jsxRuntime.jsx(Fact, { label: "Policy", value: compliance.appliedPolicyNames.join(", ") }) : null,
|
|
4063
|
+
compliance?.appliedLegislation?.length ? /* @__PURE__ */ jsxRuntime.jsx(Fact, { label: "Legislation", value: compliance.appliedLegislation.join(", ") }) : null
|
|
4064
|
+
] }) : null,
|
|
4065
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-cp-buckets", children: SCREENING_BUCKETS.map((bucket) => {
|
|
4066
|
+
const Glyph = POLICY_GLYPH[bucket.outcome];
|
|
4067
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("section", { className: "sg-cp-card sg-cp-bucket", children: [
|
|
4068
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-bucket-head", children: [
|
|
4069
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-cp-card-head", children: [
|
|
4070
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-card-glyph", children: /* @__PURE__ */ jsxRuntime.jsx(Glyph, {}) }),
|
|
4071
|
+
/* @__PURE__ */ jsxRuntime.jsx("h5", { className: "sg-cp-card-title", children: bucket.title })
|
|
4072
|
+
] }),
|
|
4073
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-bucket-detail", children: POLICY_DETAIL[bucket.outcome] })
|
|
4074
|
+
] }),
|
|
4075
|
+
/* @__PURE__ */ jsxRuntime.jsx("ul", { className: "sg-cp-cats", children: bucket.categories.map((category) => /* @__PURE__ */ jsxRuntime.jsxs("li", { children: [
|
|
4076
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-dot", "aria-hidden": "true" }),
|
|
4077
|
+
category
|
|
4078
|
+
] }, category)) })
|
|
4079
|
+
] }, bucket.outcome);
|
|
4080
|
+
}) })
|
|
4081
|
+
] });
|
|
4082
|
+
}
|
|
4083
|
+
function CompliancePanel(props) {
|
|
4084
|
+
const [open, setOpen] = react.useState(false);
|
|
4085
|
+
const [tab, setTab] = react.useState("checks");
|
|
4086
|
+
const triggerRef = react.useRef(null);
|
|
4087
|
+
const sheetRef = react.useRef(null);
|
|
4088
|
+
const compliance = props.compliance ?? null;
|
|
4089
|
+
const cv = complianceView(compliance, props.hasQuote ?? true);
|
|
4090
|
+
const allChecks = complianceChecks(compliance, cv);
|
|
4091
|
+
const checks = props.direct ? allChecks.filter((c) => DIRECT_CHECK_IDS.includes(c.id)) : allChecks;
|
|
4092
|
+
const tag = complianceTagOf(compliance);
|
|
4093
|
+
react.useEffect(() => {
|
|
4094
|
+
if (!open) return;
|
|
4095
|
+
sheetRef.current?.focus();
|
|
4096
|
+
const onKey = (e) => {
|
|
4097
|
+
if (e.key === "Escape") {
|
|
4098
|
+
e.stopPropagation();
|
|
4099
|
+
setOpen(false);
|
|
4100
|
+
triggerRef.current?.focus();
|
|
4101
|
+
}
|
|
4102
|
+
};
|
|
4103
|
+
document.addEventListener("keydown", onKey, true);
|
|
4104
|
+
return () => document.removeEventListener("keydown", onKey, true);
|
|
4105
|
+
}, [open]);
|
|
4106
|
+
const close = () => {
|
|
4107
|
+
setOpen(false);
|
|
4108
|
+
triggerRef.current?.focus();
|
|
4109
|
+
};
|
|
4110
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp", "data-tone": cv.tone, children: [
|
|
4111
|
+
open ? null : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4112
|
+
/* @__PURE__ */ jsxRuntime.jsxs("button", { ref: triggerRef, type: "button", className: "sg-cp-row", "data-tone": cv.tone, onClick: () => setOpen(true), "aria-haspopup": "dialog", children: [
|
|
4113
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-cp-row-main", children: [
|
|
4114
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-row-glyph", children: /* @__PURE__ */ jsxRuntime.jsx(TriggerGlyph, { cv }) }),
|
|
4115
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-row-label", children: cv.label })
|
|
4116
|
+
] }),
|
|
4117
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-row-chev", children: /* @__PURE__ */ jsxRuntime.jsx(Chevron, {}) })
|
|
4118
|
+
] }),
|
|
4119
|
+
(cv.blocked || cv.needsAction) && tag ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-row-tag sg-mono", children: tag }) : null
|
|
4120
|
+
] }),
|
|
4121
|
+
open ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-sheet", role: "dialog", "aria-modal": "true", "aria-label": "Compliance details", ref: sheetRef, tabIndex: -1, children: [
|
|
4122
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-sheet-head", children: [
|
|
4123
|
+
/* @__PURE__ */ jsxRuntime.jsx("h4", { className: "sg-cp-sheet-title", children: "Compliance details" }),
|
|
4124
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "sg-cp-close", onClick: close, "aria-label": "Close compliance details", children: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "m6 6 12 12M18 6 6 18", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }) }) })
|
|
4125
|
+
] }),
|
|
4126
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-tabs", role: "tablist", "aria-label": "Compliance details sections", children: [
|
|
4127
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", role: "tab", "aria-selected": tab === "checks", "data-active": tab === "checks", className: "sg-cp-tab", onClick: () => setTab("checks"), children: "Quote checks" }),
|
|
4128
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", role: "tab", "aria-selected": tab === "policy", "data-active": tab === "policy", className: "sg-cp-tab", onClick: () => setTab("policy"), children: "Screening policy" })
|
|
4129
|
+
] }),
|
|
4130
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-cp-sheet-body", children: tab === "checks" ? /* @__PURE__ */ jsxRuntime.jsx(QuoteChecks, { compliance, cv, checks, direct: !!props.direct, onViewPolicy: () => setTab("policy") }) : /* @__PURE__ */ jsxRuntime.jsx(ScreeningPolicy, { compliance }) })
|
|
4131
|
+
] }) : null
|
|
4132
|
+
] });
|
|
4133
|
+
}
|
|
3214
4134
|
|
|
3215
4135
|
// src/react/ui/chain-logos.ts
|
|
3216
4136
|
var BUNDLED_CHAIN_LOGO = {
|
|
@@ -3247,9 +4167,15 @@ var BUNDLED_TOKEN_LOGO = {
|
|
|
3247
4167
|
function isHttpsUrl(u) {
|
|
3248
4168
|
return typeof u === "string" && /^https:\/\//i.test(u);
|
|
3249
4169
|
}
|
|
4170
|
+
function isSameOriginPath2(u) {
|
|
4171
|
+
return typeof u === "string" && u.startsWith("/") && !u.startsWith("//") && !u.startsWith("/\\");
|
|
4172
|
+
}
|
|
4173
|
+
function isDisplayableImageSrc(u) {
|
|
4174
|
+
return isHttpsUrl(u) || isSameOriginPath2(u);
|
|
4175
|
+
}
|
|
3250
4176
|
function tokenLogoCandidates(symbol, logoUrl) {
|
|
3251
4177
|
const out = [];
|
|
3252
|
-
if (
|
|
4178
|
+
if (isDisplayableImageSrc(logoUrl)) out.push(logoUrl);
|
|
3253
4179
|
const bundled = BUNDLED_TOKEN_LOGO[symbolKey(symbol)];
|
|
3254
4180
|
if (bundled && !out.includes(bundled)) out.push(bundled);
|
|
3255
4181
|
return out;
|
|
@@ -3296,7 +4222,7 @@ function TokenTile(props) {
|
|
|
3296
4222
|
const shown = props.token?.symbol ?? props.pick?.symbol ?? "";
|
|
3297
4223
|
const glyph = props.pick ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
3298
4224
|
/* @__PURE__ */ jsxRuntime.jsx(TokenGlyph, { symbol: props.pick.symbol, logoUrl: props.token?.logoUrl, chainId: props.pick.chainId }),
|
|
3299
|
-
/* @__PURE__ */ jsxRuntime.jsxs("span", {
|
|
4225
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-tile-text", children: [
|
|
3300
4226
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-tile-sym", children: shown }),
|
|
3301
4227
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-tile-chain", children: CHAIN_LABELS[props.pick.chainId] || `Chain ${props.pick.chainId}` })
|
|
3302
4228
|
] })
|
|
@@ -3484,6 +4410,59 @@ function HistoryButton(props) {
|
|
|
3484
4410
|
function chainLabel(entry) {
|
|
3485
4411
|
return entry.chainId != null && CHAIN_LABELS[entry.chainId] || entry.chainName || (entry.chainId != null ? `Chain ${entry.chainId}` : "Unknown chain");
|
|
3486
4412
|
}
|
|
4413
|
+
function chainName(chainId, fallback) {
|
|
4414
|
+
return CHAIN_LABELS[chainId] || fallback || (chainId ? `Chain ${chainId}` : "Unknown chain");
|
|
4415
|
+
}
|
|
4416
|
+
function legsOf(entry) {
|
|
4417
|
+
if (entry.legs?.length) return entry.legs;
|
|
4418
|
+
const leg = {
|
|
4419
|
+
index: 1,
|
|
4420
|
+
fromAsset: entry.fromAsset,
|
|
4421
|
+
fromChainId: entry.chainId ?? 0,
|
|
4422
|
+
fromChainName: entry.chainName,
|
|
4423
|
+
fromAmount: entry.payAmount,
|
|
4424
|
+
toAsset: entry.toAsset,
|
|
4425
|
+
toChainId: 0,
|
|
4426
|
+
toChainName: "",
|
|
4427
|
+
toAmount: entry.receiveAmount,
|
|
4428
|
+
executionChainId: 0,
|
|
4429
|
+
executionChainName: ""
|
|
4430
|
+
};
|
|
4431
|
+
return [leg];
|
|
4432
|
+
}
|
|
4433
|
+
function ordersLabel(count) {
|
|
4434
|
+
return count === 1 ? "1 order" : `${count} orders`;
|
|
4435
|
+
}
|
|
4436
|
+
function LegArrowGlyph() {
|
|
4437
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.6", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
|
|
4438
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M5 12h14" }),
|
|
4439
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "m13 6 6 6-6 6" })
|
|
4440
|
+
] });
|
|
4441
|
+
}
|
|
4442
|
+
function TxLegs(props) {
|
|
4443
|
+
const multi = props.legs.length > 1;
|
|
4444
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-legs", "data-multi": multi || void 0, children: [
|
|
4445
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-legs-head", children: [
|
|
4446
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-meta-label", children: "Route" }),
|
|
4447
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-badge", children: ordersLabel(props.legs.length) })
|
|
4448
|
+
] }),
|
|
4449
|
+
/* @__PURE__ */ jsxRuntime.jsx("ol", { className: "sg-leg-list", children: props.legs.map((leg) => /* @__PURE__ */ jsxRuntime.jsxs("li", { className: "sg-leg", children: [
|
|
4450
|
+
multi ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-leg-n", "aria-hidden": "true", children: leg.index }) : null,
|
|
4451
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-leg-body", children: [
|
|
4452
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-leg-line", children: [
|
|
4453
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-mono", children: `${leg.fromAmount ? `${leg.fromAmount} ` : ""}${leg.fromAsset || "\u2014"}` }),
|
|
4454
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-leg-arrow", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx(LegArrowGlyph, {}) }),
|
|
4455
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-mono", children: `${leg.toAmount ? `${leg.toAmount} ` : ""}${leg.toAsset || "\u2014"}` })
|
|
4456
|
+
] }),
|
|
4457
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-leg-sub", children: [
|
|
4458
|
+
chainName(leg.fromChainId, leg.fromChainName),
|
|
4459
|
+
leg.toChainId ? ` \u2192 ${chainName(leg.toChainId, leg.toChainName)}` : "",
|
|
4460
|
+
leg.executionChainId && leg.executionChainId !== leg.fromChainId ? ` \xB7 filled on ${chainName(leg.executionChainId, leg.executionChainName)}` : ""
|
|
4461
|
+
] })
|
|
4462
|
+
] })
|
|
4463
|
+
] }, `${leg.index}:${leg.fromChainId}:${leg.toChainId}`)) })
|
|
4464
|
+
] });
|
|
4465
|
+
}
|
|
3487
4466
|
function statusBadge(status) {
|
|
3488
4467
|
if (status === "confirmed")
|
|
3489
4468
|
return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-badge", "data-tone": "ok", children: "Confirmed" });
|
|
@@ -3493,40 +4472,73 @@ function statusBadge(status) {
|
|
|
3493
4472
|
}
|
|
3494
4473
|
function whenLabel(at) {
|
|
3495
4474
|
const d = new Date(at);
|
|
3496
|
-
|
|
4475
|
+
if (Number.isNaN(d.getTime())) return "";
|
|
4476
|
+
const sameYear = d.getFullYear() === (/* @__PURE__ */ new Date()).getFullYear();
|
|
4477
|
+
try {
|
|
4478
|
+
return d.toLocaleString(void 0, { day: "numeric", month: "short", year: sameYear ? void 0 : "numeric", hour: "2-digit", minute: "2-digit" });
|
|
4479
|
+
} catch {
|
|
4480
|
+
return d.toLocaleString();
|
|
4481
|
+
}
|
|
4482
|
+
}
|
|
4483
|
+
function endpoints(entry) {
|
|
4484
|
+
const legs = entry.legs;
|
|
4485
|
+
return {
|
|
4486
|
+
fromChainId: entry.chainId ?? legs?.[0]?.fromChainId ?? void 0,
|
|
4487
|
+
toChainId: legs?.length ? legs[legs.length - 1].toChainId || void 0 : void 0
|
|
4488
|
+
};
|
|
4489
|
+
}
|
|
4490
|
+
function TxPairGlyphs(props) {
|
|
4491
|
+
const e = props.entry;
|
|
4492
|
+
const { fromChainId, toChainId } = endpoints(e);
|
|
4493
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-txrow-glyphs", children: [
|
|
4494
|
+
/* @__PURE__ */ jsxRuntime.jsx(TokenGlyph, { symbol: e.fromAsset || "?", logoUrl: logoFor(props.art, e.fromAsset, fromChainId ?? null), chainId: fromChainId, size: "sm" }),
|
|
4495
|
+
/* @__PURE__ */ jsxRuntime.jsx(TokenGlyph, { symbol: e.toAsset || "?", logoUrl: logoFor(props.art, e.toAsset, toChainId ?? null), chainId: toChainId, size: "sm" })
|
|
4496
|
+
] });
|
|
4497
|
+
}
|
|
4498
|
+
function TxPair(props) {
|
|
4499
|
+
const e = props.entry;
|
|
4500
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-txrow-pair", children: [
|
|
4501
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-txrow-side sg-mono", children: `${e.payAmount} ${e.fromAsset}` }),
|
|
4502
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-txrow-side sg-mono", children: [
|
|
4503
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-txrow-arrow", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx(LegArrowGlyph, {}) }),
|
|
4504
|
+
`${e.receiveAmount} ${e.toAsset}`
|
|
4505
|
+
] })
|
|
4506
|
+
] });
|
|
3497
4507
|
}
|
|
3498
|
-
function logoFor(
|
|
3499
|
-
if (!tokens?.length) return void 0;
|
|
4508
|
+
function logoFor(art, symbol, chainId) {
|
|
3500
4509
|
const key = symbolKey(symbol);
|
|
3501
4510
|
if (!key) return void 0;
|
|
3502
|
-
const
|
|
3503
|
-
|
|
4511
|
+
const tokens = art.tokens;
|
|
4512
|
+
if (tokens?.length) {
|
|
4513
|
+
const sameChain = chainId == null ? void 0 : tokens.find((t) => Number(t.chainId) === chainId && symbolKey(t.symbol) === key);
|
|
4514
|
+
const found = (sameChain ?? tokens.find((t) => symbolKey(t.symbol) === key))?.logoUrl;
|
|
4515
|
+
if (found) return found;
|
|
4516
|
+
}
|
|
4517
|
+
return art.vaultIcons?.get(key);
|
|
3504
4518
|
}
|
|
3505
4519
|
function TxHistoryList(props) {
|
|
3506
4520
|
if (!props.entries.length) {
|
|
3507
4521
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-sel-empty", children: "No transactions yet \u2014 activity from this wallet will appear here." });
|
|
3508
4522
|
}
|
|
3509
|
-
return /* @__PURE__ */ jsxRuntime.jsx("section", { className: "sg-toklist", "aria-label": "Transaction history", children: props.entries.map((e) =>
|
|
3510
|
-
|
|
3511
|
-
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
"
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
|
|
3520
|
-
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
|
|
3525
|
-
whenLabel(e.at) ? ` \xB7 ${whenLabel(e.at)}` : ""
|
|
4523
|
+
return /* @__PURE__ */ jsxRuntime.jsx("section", { className: "sg-toklist", "aria-label": "Transaction history", children: props.entries.map((e) => (
|
|
4524
|
+
// A GRID, not the picker's flex row: the meta line spans the badge column too, so at 390px it
|
|
4525
|
+
// has the full card width to wrap into instead of being ellipsised away to "…".
|
|
4526
|
+
/* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", className: "sg-txrow", onClick: () => props.onPick(e), children: [
|
|
4527
|
+
/* @__PURE__ */ jsxRuntime.jsx(TxPairGlyphs, { entry: e, art: props }),
|
|
4528
|
+
/* @__PURE__ */ jsxRuntime.jsx(TxPair, { entry: e }),
|
|
4529
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-txrow-meta", children: [
|
|
4530
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-txrow-when", children: [
|
|
4531
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-txrow-what", children: [
|
|
4532
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: e.kind === "payment" ? "Payment" : "Swap" }),
|
|
4533
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: chainLabel(e) }),
|
|
4534
|
+
(e.legs?.length ?? 1) > 1 ? /* @__PURE__ */ jsxRuntime.jsx("span", { children: ordersLabel(e.legs.length) }) : null
|
|
4535
|
+
] }),
|
|
4536
|
+
whenLabel(e.at) ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-txrow-time", children: whenLabel(e.at) }) : null
|
|
4537
|
+
] }),
|
|
4538
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-txrow-end", children: statusBadge(e.status) })
|
|
3526
4539
|
] })
|
|
3527
|
-
] })
|
|
3528
|
-
|
|
3529
|
-
] }, `${e.hash}:${e.at}`)) });
|
|
4540
|
+
] }, `${e.hash}:${e.at}`)
|
|
4541
|
+
)) });
|
|
3530
4542
|
}
|
|
3531
4543
|
function TxDetail(props) {
|
|
3532
4544
|
const e = props.entry;
|
|
@@ -3549,6 +4561,7 @@ function TxDetail(props) {
|
|
|
3549
4561
|
}
|
|
3550
4562
|
};
|
|
3551
4563
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-panel", children: [
|
|
4564
|
+
/* @__PURE__ */ jsxRuntime.jsx(TxPairGlyphs, { entry: e, art: props }),
|
|
3552
4565
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-anchor sg-mono", children: [
|
|
3553
4566
|
e.receiveAmount,
|
|
3554
4567
|
" ",
|
|
@@ -3558,6 +4571,7 @@ function TxDetail(props) {
|
|
|
3558
4571
|
e.kind === "payment" ? "Payment" : "Swap",
|
|
3559
4572
|
whenLabel(e.at) ? ` \xB7 ${whenLabel(e.at)}` : ""
|
|
3560
4573
|
] }),
|
|
4574
|
+
/* @__PURE__ */ jsxRuntime.jsx(TxLegs, { legs: legsOf(e) }),
|
|
3561
4575
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-meta", children: [
|
|
3562
4576
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-meta-row", children: [
|
|
3563
4577
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-meta-label", children: "Status" }),
|
|
@@ -3572,12 +4586,12 @@ function TxDetail(props) {
|
|
|
3572
4586
|
] })
|
|
3573
4587
|
] }),
|
|
3574
4588
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-meta-row", children: [
|
|
3575
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-meta-label", children: "
|
|
4589
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-meta-label", children: "Signed on" }),
|
|
3576
4590
|
/* @__PURE__ */ jsxRuntime.jsx("b", { children: chainLabel(e) })
|
|
3577
4591
|
] }),
|
|
3578
4592
|
e.recipient ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-meta-row", children: [
|
|
3579
4593
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-meta-label", children: "Recipient" }),
|
|
3580
|
-
/* @__PURE__ */ jsxRuntime.jsx("b", { className: "sg-mono", children:
|
|
4594
|
+
/* @__PURE__ */ jsxRuntime.jsx("b", { className: "sg-mono", children: shortAddress2(e.recipient) })
|
|
3581
4595
|
] }) : null,
|
|
3582
4596
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-meta-row", children: [
|
|
3583
4597
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-meta-label", children: "Settlement" }),
|
|
@@ -3591,14 +4605,17 @@ function TxDetail(props) {
|
|
|
3591
4605
|
] })
|
|
3592
4606
|
] });
|
|
3593
4607
|
}
|
|
3594
|
-
function displayableHistory(entries) {
|
|
3595
|
-
|
|
4608
|
+
function displayableHistory(entries, account) {
|
|
4609
|
+
const owner = typeof account === "string" ? account.toLowerCase() : "";
|
|
4610
|
+
return entries.filter((e) => e.txKind !== "approve" && (!e.account || !owner || e.account.toLowerCase() === owner));
|
|
3596
4611
|
}
|
|
3597
4612
|
function TxHistoryPanel(props) {
|
|
3598
|
-
const
|
|
3599
|
-
const
|
|
4613
|
+
const account = props.account;
|
|
4614
|
+
const entries = displayableHistory(useTxHistory(account), account);
|
|
4615
|
+
const deepLink = props.initialEntry && displayableHistory([props.initialEntry], account).length ? props.initialEntry : null;
|
|
4616
|
+
const [selected, setSelected] = react.useState(deepLink);
|
|
3600
4617
|
const backRef = react.useRef(null);
|
|
3601
|
-
react.useEffect(() => setSelected(
|
|
4618
|
+
react.useEffect(() => setSelected(deepLink), [deepLink]);
|
|
3602
4619
|
const pick = (entry) => {
|
|
3603
4620
|
setSelected(entry);
|
|
3604
4621
|
requestAnimationFrame(() => backRef.current?.focus());
|
|
@@ -3606,9 +4623,12 @@ function TxHistoryPanel(props) {
|
|
|
3606
4623
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
3607
4624
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-sel-head", children: [
|
|
3608
4625
|
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", autoFocus: true, ref: backRef, className: "sg-back", onClick: selected ? () => setSelected(null) : props.onBack, "aria-label": "Back", children: /* @__PURE__ */ jsxRuntime.jsx(BackGlyph2, {}) }),
|
|
3609
|
-
/* @__PURE__ */ jsxRuntime.
|
|
4626
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-sel-title", children: [
|
|
4627
|
+
selected ? "Transaction" : "Transaction history",
|
|
4628
|
+
account ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-sel-sub sg-mono", children: shortAddress2(account) }) : null
|
|
4629
|
+
] })
|
|
3610
4630
|
] }),
|
|
3611
|
-
selected ? /* @__PURE__ */ jsxRuntime.jsx(TxDetail, { entry: selected }) : /* @__PURE__ */ jsxRuntime.jsx(TxHistoryList, { entries, tokens: props.tokens, onPick: pick })
|
|
4631
|
+
selected ? /* @__PURE__ */ jsxRuntime.jsx(TxDetail, { entry: selected, tokens: props.tokens, vaultIcons: props.vaultIcons }) : /* @__PURE__ */ jsxRuntime.jsx(TxHistoryList, { entries, tokens: props.tokens, vaultIcons: props.vaultIcons, onPick: pick })
|
|
3612
4632
|
] });
|
|
3613
4633
|
}
|
|
3614
4634
|
var IDENTITY_KEY_PREFIX = "sg:link:v1:";
|
|
@@ -3671,7 +4691,7 @@ function forgetIdentity(account) {
|
|
|
3671
4691
|
}
|
|
3672
4692
|
}
|
|
3673
4693
|
var addrEq = (a, b) => String(a || "").toLowerCase() === String(b || "").toLowerCase();
|
|
3674
|
-
var
|
|
4694
|
+
var chainName2 = (id) => id != null ? CHAIN_LABELS[id] || `Chain ${id}` : "";
|
|
3675
4695
|
var STABLES = EXECUTABLE_STABLE_ASSETS;
|
|
3676
4696
|
function BankGlyph() {
|
|
3677
4697
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -3891,7 +4911,7 @@ function IdentityLine(props) {
|
|
|
3891
4911
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-link-id", children: [
|
|
3892
4912
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-link-id-icon", children: /* @__PURE__ */ jsxRuntime.jsx(WalletGlyph, {}) }),
|
|
3893
4913
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-link-id-text", children: [
|
|
3894
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-link-id-primary", children: props.account ?
|
|
4914
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-link-id-primary", children: props.account ? shortAddress2(props.account) : "ZeroDelta Link" }),
|
|
3895
4915
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-link-id-secondary", children: props.email ? props.email : props.account ? "Connected wallet" : "Connect your wallet to continue" })
|
|
3896
4916
|
] }),
|
|
3897
4917
|
props.account ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-wallet-dot", "aria-hidden": "true" }) : null
|
|
@@ -4187,6 +5207,7 @@ function PaymentIsland(props) {
|
|
|
4187
5207
|
const [expanded, setExpanded] = react.useState(() => Boolean(props.defaultExpanded) || rampMode);
|
|
4188
5208
|
const [view, setView] = react.useState("main");
|
|
4189
5209
|
const [hist, setHist] = react.useState(null);
|
|
5210
|
+
const histBtnRef = react.useRef(null);
|
|
4190
5211
|
const pillRef = react.useRef(null);
|
|
4191
5212
|
const methodRowRef = react.useRef(null);
|
|
4192
5213
|
const exFromTileRef = react.useRef(null);
|
|
@@ -4194,6 +5215,7 @@ function PaymentIsland(props) {
|
|
|
4194
5215
|
const regionRef = react.useRef(null);
|
|
4195
5216
|
const panelId = react.useId();
|
|
4196
5217
|
react.useEffect(() => setView("main"), [wallet.account, payParamsKey]);
|
|
5218
|
+
react.useEffect(() => setHist(null), [wallet.account]);
|
|
4197
5219
|
const firstRender = react.useRef(true);
|
|
4198
5220
|
react.useEffect(() => {
|
|
4199
5221
|
if (firstRender.current) {
|
|
@@ -4217,7 +5239,7 @@ function PaymentIsland(props) {
|
|
|
4217
5239
|
};
|
|
4218
5240
|
const closeHistory = () => {
|
|
4219
5241
|
setHist(null);
|
|
4220
|
-
requestAnimationFrame(() => (methodRowRef.current ?? regionRef.current)?.focus());
|
|
5242
|
+
requestAnimationFrame(() => (histBtnRef.current ?? methodRowRef.current ?? regionRef.current)?.focus());
|
|
4221
5243
|
};
|
|
4222
5244
|
const pickFunding = (pick) => {
|
|
4223
5245
|
const r = visibleRoutes.find((x) => x.source.chainId === pick.chainId && symbolKey(x.source.asset) === symbolKey(pick.symbol));
|
|
@@ -4279,7 +5301,11 @@ function PaymentIsland(props) {
|
|
|
4279
5301
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-link-word", children: "ZeroDelta" }),
|
|
4280
5302
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-badge", "data-tone": "accent", children: "Link" })
|
|
4281
5303
|
] });
|
|
4282
|
-
const
|
|
5304
|
+
const linkMenu = menuItems.length ? /* @__PURE__ */ jsxRuntime.jsx(LinkMenu, { items: menuItems }) : null;
|
|
5305
|
+
const walletSlot = wallet.account || linkMenu ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-head-tools", children: [
|
|
5306
|
+
wallet.account ? /* @__PURE__ */ jsxRuntime.jsx(HistoryButton, { btnRef: histBtnRef, disabled: submitting, onClick: () => setHist({}) }) : null,
|
|
5307
|
+
linkMenu
|
|
5308
|
+
] }) : void 0;
|
|
4283
5309
|
const activeStep = flow.steps.find((s) => s.state === "active");
|
|
4284
5310
|
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" ? flow.verdict?.status === "confirmed" ? isPay ? "Payment confirmed on-chain \u2014 the merchant has been settled." : `${verb.past} \u2014 confirmed on-chain.` : isPay ? "Payment sent \u2014 confirmation is still pending." : "Submitted \u2014 confirmation is still pending." : "";
|
|
4285
5311
|
const loading = flow.status === "loading";
|
|
@@ -4313,7 +5339,7 @@ function PaymentIsland(props) {
|
|
|
4313
5339
|
] });
|
|
4314
5340
|
let body;
|
|
4315
5341
|
if (hist && wallet.account) {
|
|
4316
|
-
body = /* @__PURE__ */ jsxRuntime.jsx(TxHistoryPanel, { account: wallet.account, tokens: registryTokens, initialEntry: hist.entry ?? null, onBack: closeHistory });
|
|
5342
|
+
body = /* @__PURE__ */ jsxRuntime.jsx(TxHistoryPanel, { account: wallet.account, tokens: registryTokens, vaultIcons: catalogue?.vaultIcons, initialEntry: hist.entry ?? null, onBack: closeHistory });
|
|
4317
5343
|
} else if (isPay && view === "select" && wallet.account) {
|
|
4318
5344
|
body = /* @__PURE__ */ jsxRuntime.jsx(
|
|
4319
5345
|
TokenSelect,
|
|
@@ -4396,7 +5422,7 @@ function PaymentIsland(props) {
|
|
|
4396
5422
|
] }),
|
|
4397
5423
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-receipt-sub", children: [
|
|
4398
5424
|
confirmed ? "Confirmed on-chain" : "Confirmation pending",
|
|
4399
|
-
isPay && props.recipient ? ` \xB7 ${
|
|
5425
|
+
isPay && props.recipient ? ` \xB7 ${shortAddress2(props.recipient)}` : ""
|
|
4400
5426
|
] })
|
|
4401
5427
|
] }),
|
|
4402
5428
|
!identityMatchesWallet ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-remember", children: [
|
|
@@ -4492,7 +5518,7 @@ function PaymentIsland(props) {
|
|
|
4492
5518
|
] }),
|
|
4493
5519
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-anchor-sub", children: [
|
|
4494
5520
|
"on ",
|
|
4495
|
-
|
|
5521
|
+
chainName2(sel.source.chainId),
|
|
4496
5522
|
selBal ? ` \xB7 balance ${selBal.formatted}` : ""
|
|
4497
5523
|
] })
|
|
4498
5524
|
] }) : null,
|
|
@@ -4505,9 +5531,10 @@ function PaymentIsland(props) {
|
|
|
4505
5531
|
] }),
|
|
4506
5532
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-anchor-sub", children: [
|
|
4507
5533
|
"on ",
|
|
4508
|
-
|
|
5534
|
+
chainName2(sel.source.chainId)
|
|
4509
5535
|
] })
|
|
4510
5536
|
] }) : null,
|
|
5537
|
+
sel && !loading && !quoteError ? /* @__PURE__ */ jsxRuntime.jsx(CompliancePanel, { compliance: sel.quote.compliance, direct: sel.state === "DIRECT" }) : null,
|
|
4511
5538
|
quoteError ? /* @__PURE__ */ jsxRuntime.jsx(StatusPanel, { tone: "error", children: flow.error || "Couldn't get a price right now." }) : null,
|
|
4512
5539
|
walletError ? /* @__PURE__ */ jsxRuntime.jsx(StatusPanel, { tone: "error", children: flow.error || "The wallet could not complete this payment." }) : null,
|
|
4513
5540
|
submitting || walletError ? /* @__PURE__ */ jsxRuntime.jsx(StepList, { variant: "rich", steps: flow.steps, verdict: flow.verdict }) : null,
|
|
@@ -4776,7 +5803,7 @@ function StableGeniePay(props) {
|
|
|
4776
5803
|
] })
|
|
4777
5804
|
] }) : void 0;
|
|
4778
5805
|
if (props.variant === "pill") return /* @__PURE__ */ jsxRuntime.jsx(PaymentIsland, { kind: "pay", ...props });
|
|
4779
|
-
return /* @__PURE__ */ jsxRuntime.jsx(WidgetShell, { title: config.title || "Complete payment", theme: config.theme, heightPx: props.heightPx, walletSlot, children: hist && wallet.account ? /* @__PURE__ */ jsxRuntime.jsx(TxHistoryPanel, { account: wallet.account, tokens: registryTokens, initialEntry: hist.entry ?? null, onBack: closeHistory }) : view === "select" && wallet.account ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
5806
|
+
return /* @__PURE__ */ jsxRuntime.jsx(WidgetShell, { title: config.title || "Complete payment", theme: config.theme, heightPx: props.heightPx, walletSlot, 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(
|
|
4780
5807
|
TokenSelect,
|
|
4781
5808
|
{
|
|
4782
5809
|
title: "Pay with",
|
|
@@ -4801,7 +5828,7 @@ function StableGeniePay(props) {
|
|
|
4801
5828
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-success-sub", children: [
|
|
4802
5829
|
flow.verdict?.status === "confirmed" ? "Confirmed on-chain" : "Submitted \u2014 awaiting confirmation",
|
|
4803
5830
|
" \xB7 ",
|
|
4804
|
-
|
|
5831
|
+
shortAddress2(props.recipient)
|
|
4805
5832
|
] })
|
|
4806
5833
|
] }),
|
|
4807
5834
|
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
|
|
@@ -4844,6 +5871,7 @@ function StableGeniePay(props) {
|
|
|
4844
5871
|
scannedEmpty ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-note", children: "None of your balances can cover this yet \u2014 pick a different asset to fund with." }) : null,
|
|
4845
5872
|
flow.status === "ready" && !visibleRoutes.length ? /* @__PURE__ */ jsxRuntime.jsx(StatusPanel, { children: "No funding route matches the accepted assets for this payment." }) : null
|
|
4846
5873
|
] }),
|
|
5874
|
+
sel && flow.status !== "loading" ? /* @__PURE__ */ jsxRuntime.jsx(CompliancePanel, { compliance: sel.quote.compliance, direct: sel.state === "DIRECT" }) : null,
|
|
4847
5875
|
submitting ? /* @__PURE__ */ jsxRuntime.jsx(StepList, { steps: flow.steps }) : null,
|
|
4848
5876
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-cta-wrap", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4849
5877
|
Button,
|
|
@@ -4948,7 +5976,7 @@ function StableGenieSwap(props) {
|
|
|
4948
5976
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-brand", children: "ZeroDelta" })
|
|
4949
5977
|
] }) : void 0;
|
|
4950
5978
|
if (hist && wallet.account) {
|
|
4951
|
-
return /* @__PURE__ */ jsxRuntime.jsx(WidgetShell, { title: config.title || "Swap", theme: config.theme, walletSlot, children: /* @__PURE__ */ jsxRuntime.jsx(TxHistoryPanel, { account: wallet.account, tokens: registryTokens, initialEntry: hist.entry ?? null, onBack: closeHistory }) });
|
|
5979
|
+
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 }) });
|
|
4952
5980
|
}
|
|
4953
5981
|
if (flow.status === "success" || flow.status === "pending") {
|
|
4954
5982
|
return /* @__PURE__ */ jsxRuntime.jsxs(WidgetShell, { title: config.title || "Swap", theme: config.theme, walletSlot, children: [
|
|
@@ -4961,7 +5989,7 @@ function StableGenieSwap(props) {
|
|
|
4961
5989
|
] }),
|
|
4962
5990
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-success-sub", children: [
|
|
4963
5991
|
flow.verdict?.status === "confirmed" ? "Confirmed on-chain" : "Submitted \u2014 awaiting confirmation",
|
|
4964
|
-
props.recipient ? ` \xB7 ${
|
|
5992
|
+
props.recipient ? ` \xB7 ${shortAddress2(props.recipient)}` : ""
|
|
4965
5993
|
] })
|
|
4966
5994
|
] }),
|
|
4967
5995
|
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
|
|
@@ -4987,6 +6015,7 @@ function StableGenieSwap(props) {
|
|
|
4987
6015
|
] }),
|
|
4988
6016
|
flow.status === "error" && flow.error ? /* @__PURE__ */ jsxRuntime.jsx(StatusPanel, { tone: "error", children: flow.error }) : null,
|
|
4989
6017
|
flow.routes.length ? /* @__PURE__ */ jsxRuntime.jsx(RouteList, { routes: flow.routes, selectedId: flow.selected?.id ?? null, onSelect: flow.selectRoute }) : null,
|
|
6018
|
+
flow.selected && flow.status !== "loading" ? /* @__PURE__ */ jsxRuntime.jsx(CompliancePanel, { compliance: flow.selected.quote.compliance, direct: flow.selected.state === "DIRECT" }) : null,
|
|
4990
6019
|
submitting ? /* @__PURE__ */ jsxRuntime.jsx(StepList, { steps: flow.steps }) : null,
|
|
4991
6020
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cta-wrap", children: [
|
|
4992
6021
|
!wallet.account ? /* @__PURE__ */ jsxRuntime.jsx(Button, { onClick: wallet.connect, busy: wallet.connecting, children: "Connect wallet" }) : /* @__PURE__ */ jsxRuntime.jsx(Button, { onClick: flow.submit, busy: submitting, disabled: !flow.selected || flow.insufficient || !!flow.nativeShortfall || !enabled || flow.status === "loading", children: swapLabel }),
|
|
@@ -5185,7 +6214,7 @@ function StableGenieExchange(props) {
|
|
|
5185
6214
|
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "sg-wallet", "data-connected": connected || void 0, onClick: connected ? void 0 : wallet.connect, disabled: wallet.connecting, children: connected ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
5186
6215
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-wallet-dot", "aria-hidden": "true" }),
|
|
5187
6216
|
" ",
|
|
5188
|
-
|
|
6217
|
+
shortAddress2(wallet.account)
|
|
5189
6218
|
] }) : wallet.connecting ? "Connecting\u2026" : "Connect wallet" })
|
|
5190
6219
|
] });
|
|
5191
6220
|
const fromTileRef = react.useRef(null);
|
|
@@ -5197,7 +6226,7 @@ function StableGenieExchange(props) {
|
|
|
5197
6226
|
if (props.variant === "pill") return /* @__PURE__ */ jsxRuntime.jsx(PaymentIsland, { kind: "exchange", ...props });
|
|
5198
6227
|
let body;
|
|
5199
6228
|
if (hist && connected) {
|
|
5200
|
-
body = /* @__PURE__ */ jsxRuntime.jsx(TxHistoryPanel, { account: wallet.account, tokens, initialEntry: hist.entry ?? null, onBack: closeHistory });
|
|
6229
|
+
body = /* @__PURE__ */ jsxRuntime.jsx(TxHistoryPanel, { account: wallet.account, tokens, vaultIcons: catalogue?.vaultIcons, initialEntry: hist.entry ?? null, onBack: closeHistory });
|
|
5201
6230
|
} else if (view === "from" || view === "to") {
|
|
5202
6231
|
const isFrom = view === "from";
|
|
5203
6232
|
body = /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -5227,7 +6256,7 @@ function StableGenieExchange(props) {
|
|
|
5227
6256
|
] }),
|
|
5228
6257
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-success-sub", children: [
|
|
5229
6258
|
flow.verdict?.status === "confirmed" ? "Confirmed on-chain" : "Submitted \u2014 awaiting confirmation",
|
|
5230
|
-
props.recipient ? ` \xB7 ${
|
|
6259
|
+
props.recipient ? ` \xB7 ${shortAddress2(props.recipient)}` : ""
|
|
5231
6260
|
] })
|
|
5232
6261
|
] }),
|
|
5233
6262
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cta-wrap", children: [
|
|
@@ -5274,6 +6303,7 @@ function StableGenieExchange(props) {
|
|
|
5274
6303
|
meta.duration ? ` \xB7 ~${meta.duration}s` : ""
|
|
5275
6304
|
] }) : null
|
|
5276
6305
|
] }) : null,
|
|
6306
|
+
connected && flow.selected && flow.status !== "loading" ? /* @__PURE__ */ jsxRuntime.jsx(CompliancePanel, { compliance: flow.selected.quote.compliance, direct: flow.selected.state === "DIRECT" }) : null,
|
|
5277
6307
|
submitting ? /* @__PURE__ */ jsxRuntime.jsx(StepList, { steps: flow.steps }) : null,
|
|
5278
6308
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cta-wrap", children: [
|
|
5279
6309
|
!connected && !rampMode ? /* @__PURE__ */ jsxRuntime.jsx(Button, { onClick: wallet.connect, busy: wallet.connecting, children: "Connect wallet" }) : /* @__PURE__ */ jsxRuntime.jsx(Button, { onClick: rampMode ? void 0 : flow.submit, busy: submitting, disabled: rampMode || !quotable || !cryptoReady || connected && (!flow.selected || flow.insufficient || !!flow.nativeShortfall || flow.status === "loading"), children: ctaLabel }),
|