@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/index.cjs
CHANGED
|
@@ -39,6 +39,7 @@ var TRADEABLE_RWA_ASSETS = /* @__PURE__ */ new Set([
|
|
|
39
39
|
]);
|
|
40
40
|
var SUPPORTED_ASSETS = /* @__PURE__ */ new Set([...STABLE_ASSETS, ...TRADEABLE_RWA_ASSETS]);
|
|
41
41
|
var API_CACHE_TTL_MS = 6e4;
|
|
42
|
+
var SCREEN_CACHE_TTL_MS = 5 * 6e4;
|
|
42
43
|
var MAX_QUOTE_CANDIDATES = 8;
|
|
43
44
|
var QUOTE_BUFFER_BPS = 50;
|
|
44
45
|
var LZ_FEE_BUFFER_BPS = 1500n;
|
|
@@ -599,7 +600,7 @@ function buildCatalogue(input) {
|
|
|
599
600
|
);
|
|
600
601
|
const byId = new Map(enabledChains.map((c) => [Number(c.chainId), c]));
|
|
601
602
|
for (const id of chainIds) if (!byId.has(id)) byId.set(id, { chainId: id, isEnabled: true });
|
|
602
|
-
return { ...ctx, product, tokens: catalogue, sources, chainIds, chains: [...byId.values()], ready };
|
|
603
|
+
return { ...ctx, product, tokens: catalogue, sources, chainIds, chains: [...byId.values()], ready, vaultIcons: input.vaultIcons ?? /* @__PURE__ */ new Map() };
|
|
603
604
|
}
|
|
604
605
|
|
|
605
606
|
// src/core/options.ts
|
|
@@ -724,10 +725,10 @@ function nativeFeeShortLabel(check, symbol) {
|
|
|
724
725
|
if (!check.short) return null;
|
|
725
726
|
return `Need ${formatNative(check.required)} ${symbol} for the bridge fee`;
|
|
726
727
|
}
|
|
727
|
-
function nativeFeeShortMessage(check, symbol,
|
|
728
|
+
function nativeFeeShortMessage(check, symbol, chainName3) {
|
|
728
729
|
const need = formatNative(check.required);
|
|
729
730
|
const have = formatNative(check.balance ?? 0n);
|
|
730
|
-
const where =
|
|
731
|
+
const where = chainName3 ? ` on ${chainName3}` : "";
|
|
731
732
|
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.`;
|
|
732
733
|
}
|
|
733
734
|
|
|
@@ -761,6 +762,366 @@ function brokenLaneReason(lane) {
|
|
|
761
762
|
}
|
|
762
763
|
}
|
|
763
764
|
|
|
765
|
+
// src/core/rwa-icons.ts
|
|
766
|
+
var GATEWAY_ICON_PREFIX = "/api/v1/rwa/icons/";
|
|
767
|
+
var ICON_FILE = /^[A-Za-z0-9][A-Za-z0-9._-]{0,127}\.(?:png|jpg|jpeg|webp|gif)$/;
|
|
768
|
+
function resolveVaultIcon(apiBase, iconPath) {
|
|
769
|
+
if (typeof iconPath !== "string" || !iconPath.startsWith(GATEWAY_ICON_PREFIX)) return void 0;
|
|
770
|
+
const file = iconPath.slice(GATEWAY_ICON_PREFIX.length);
|
|
771
|
+
if (!ICON_FILE.test(file)) return void 0;
|
|
772
|
+
return `${apiBase.replace(/\/$/, "")}/rwa/icons/${file}`;
|
|
773
|
+
}
|
|
774
|
+
function vaultIconsBySymbol(apiBase, vaults) {
|
|
775
|
+
const out = /* @__PURE__ */ new Map();
|
|
776
|
+
for (const vault of vaults) {
|
|
777
|
+
const key = symbolKey(vault?.symbol);
|
|
778
|
+
if (!key || out.has(key)) continue;
|
|
779
|
+
const url = resolveVaultIcon(apiBase, vault?.iconMiniUrl) ?? resolveVaultIcon(apiBase, vault?.iconUrl);
|
|
780
|
+
if (url) out.set(key, url);
|
|
781
|
+
}
|
|
782
|
+
return out;
|
|
783
|
+
}
|
|
784
|
+
function withVaultArtwork(tokens, icons) {
|
|
785
|
+
if (!icons.size) return tokens;
|
|
786
|
+
return tokens.map((token) => {
|
|
787
|
+
if (token.logoUrl) return token;
|
|
788
|
+
const url = icons.get(symbolKey(token.symbol));
|
|
789
|
+
return url ? { ...token, logoUrl: url } : token;
|
|
790
|
+
});
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
// src/core/compliance.ts
|
|
794
|
+
var COMPLIANCE_DENY_LABEL = "Compliance check failed";
|
|
795
|
+
function complianceView(compliance, hasQuote = true) {
|
|
796
|
+
if (!hasQuote) {
|
|
797
|
+
return {
|
|
798
|
+
tone: "neutral",
|
|
799
|
+
label: "Compliance checks run with your quote",
|
|
800
|
+
headline: "No compliance decision for this payment yet",
|
|
801
|
+
blocked: false,
|
|
802
|
+
needsAction: false,
|
|
803
|
+
screened: false
|
|
804
|
+
};
|
|
805
|
+
}
|
|
806
|
+
const decision = compliance?.decision;
|
|
807
|
+
const screened = compliance?.status === "SCREENED";
|
|
808
|
+
if (decision === "DENY") {
|
|
809
|
+
return {
|
|
810
|
+
tone: "blocked",
|
|
811
|
+
label: COMPLIANCE_DENY_LABEL,
|
|
812
|
+
headline: "Blocked by compliance policy",
|
|
813
|
+
blocked: true,
|
|
814
|
+
needsAction: false,
|
|
815
|
+
screened
|
|
816
|
+
};
|
|
817
|
+
}
|
|
818
|
+
if (decision === "REVIEW" || decision === "REMEDIATE") {
|
|
819
|
+
const word = decision.toLowerCase();
|
|
820
|
+
return {
|
|
821
|
+
tone: "warn",
|
|
822
|
+
label: `Compliance: ${word} required`,
|
|
823
|
+
headline: `Manual ${word} required`,
|
|
824
|
+
blocked: false,
|
|
825
|
+
needsAction: true,
|
|
826
|
+
screened
|
|
827
|
+
};
|
|
828
|
+
}
|
|
829
|
+
if (decision === "ALLOW") {
|
|
830
|
+
return {
|
|
831
|
+
tone: "ok",
|
|
832
|
+
label: screened ? "Compliance checks passed" : "Allowed \u2014 wallets not screened",
|
|
833
|
+
headline: screened ? "Wallets screened and allowed" : "Allowed \u2014 wallets not screened",
|
|
834
|
+
blocked: false,
|
|
835
|
+
needsAction: false,
|
|
836
|
+
screened
|
|
837
|
+
};
|
|
838
|
+
}
|
|
839
|
+
return {
|
|
840
|
+
tone: "neutral",
|
|
841
|
+
label: screened ? "Screened \u2014 no policy decision returned" : "No compliance decision returned",
|
|
842
|
+
headline: screened ? "Screened \u2014 no policy decision returned" : "No compliance decision returned",
|
|
843
|
+
blocked: false,
|
|
844
|
+
needsAction: false,
|
|
845
|
+
screened
|
|
846
|
+
};
|
|
847
|
+
}
|
|
848
|
+
var CATEGORY_PHRASES = {
|
|
849
|
+
SANCTIONS: "sanctions",
|
|
850
|
+
TERRORISM_FINANCING: "terrorism financing",
|
|
851
|
+
STOLEN_FUNDS: "stolen funds",
|
|
852
|
+
RANSOMWARE: "ransomware",
|
|
853
|
+
SCAM: "scam activity",
|
|
854
|
+
DARKNET: "darknet activity",
|
|
855
|
+
MIXER: "mixer usage",
|
|
856
|
+
HIGH_RISK_ENTITY: "a high-risk entity",
|
|
857
|
+
PEP: "a politically-exposed person",
|
|
858
|
+
INDIRECT_EXPOSURE: "indirect exposure",
|
|
859
|
+
UNCLASSIFIED: "an unrecognized risk",
|
|
860
|
+
UNKNOWN: "an unrecognized risk"
|
|
861
|
+
};
|
|
862
|
+
function categoryLabel(code) {
|
|
863
|
+
const key = code.trim().toUpperCase();
|
|
864
|
+
const LABELS = {
|
|
865
|
+
SANCTIONS: "Sanctions",
|
|
866
|
+
TERRORISM_FINANCING: "Terrorist financing",
|
|
867
|
+
STOLEN_FUNDS: "Stolen funds",
|
|
868
|
+
RANSOMWARE: "Ransomware",
|
|
869
|
+
SCAM: "Scam",
|
|
870
|
+
DARKNET: "Darknet services",
|
|
871
|
+
MIXER: "Mixer",
|
|
872
|
+
HIGH_RISK_ENTITY: "High-risk entity",
|
|
873
|
+
PEP: "Politically exposed person (PEP)",
|
|
874
|
+
INDIRECT_EXPOSURE: "Indirect exposure",
|
|
875
|
+
UNCLASSIFIED: "Unclassified risk",
|
|
876
|
+
UNKNOWN: "Unclassified risk"
|
|
877
|
+
};
|
|
878
|
+
return LABELS[key] ?? key.toLowerCase().replace(/_/g, " ");
|
|
879
|
+
}
|
|
880
|
+
function cleanJurisdiction(code) {
|
|
881
|
+
return code.replace(/^(OFAC|TIER\d+|SANCTIONED)_/i, "").trim();
|
|
882
|
+
}
|
|
883
|
+
function stripBundlePrefix(head) {
|
|
884
|
+
if (head.startsWith("policy_")) return { head: head.slice("policy_".length), source: "policy" };
|
|
885
|
+
if (head.startsWith("legislation_")) return { head: head.slice("legislation_".length), source: "legislation" };
|
|
886
|
+
return { head, source: null };
|
|
887
|
+
}
|
|
888
|
+
function complianceReasonHead(raw) {
|
|
889
|
+
return stripBundlePrefix((raw.split(":")[0] ?? "").trim()).head;
|
|
890
|
+
}
|
|
891
|
+
function usd(raw) {
|
|
892
|
+
const n = Number(raw);
|
|
893
|
+
if (!Number.isFinite(n)) return `$${raw}`;
|
|
894
|
+
return `$${n.toLocaleString("en-US", { maximumFractionDigits: 2 })}`;
|
|
895
|
+
}
|
|
896
|
+
function capFromDetail(detail) {
|
|
897
|
+
const m = detail.match(/>([\d.]+)/);
|
|
898
|
+
return m ? ` (${usd(m[1])})` : "";
|
|
899
|
+
}
|
|
900
|
+
function categoryPhrase(detail) {
|
|
901
|
+
const cat = detail.replace(/\s*\(.*\)$/, "").toUpperCase();
|
|
902
|
+
return CATEGORY_PHRASES[cat] ?? cat.toLowerCase().replace(/_/g, " ");
|
|
903
|
+
}
|
|
904
|
+
function humanizeComplianceReason(raw) {
|
|
905
|
+
const [headRaw, ...restParts] = raw.split(":");
|
|
906
|
+
const detail = restParts.join(":").trim();
|
|
907
|
+
const { head, source } = stripBundlePrefix((headRaw ?? "").trim());
|
|
908
|
+
const scope = source === "legislation" ? "applicable regulations" : "the applicable policy";
|
|
909
|
+
switch (head) {
|
|
910
|
+
case "asset_pair_not_allowed": {
|
|
911
|
+
const m = detail.match(/^(\S+)->(\S+)\s+in\s+(\S+)/);
|
|
912
|
+
if (m) return `${m[1]} \u2192 ${m[2]} isn't available in your region (${cleanJurisdiction(m[3])}).`;
|
|
913
|
+
return "This asset pair isn't available in your region.";
|
|
914
|
+
}
|
|
915
|
+
case "asset_not_allowed": {
|
|
916
|
+
const m = detail.match(/^(\S+?)->(\S+?)(?::|$)/);
|
|
917
|
+
if (m) return `${m[1]} \u2192 ${m[2]} isn't permitted under ${scope}.`;
|
|
918
|
+
return `This asset pair isn't permitted under ${scope}.`;
|
|
919
|
+
}
|
|
920
|
+
case "blocked_jurisdiction":
|
|
921
|
+
return `Your region (${cleanJurisdiction(detail)}) isn't supported.`;
|
|
922
|
+
case "blocked_destination_jurisdiction":
|
|
923
|
+
return `The destination region (${cleanJurisdiction(detail)}) isn't supported.`;
|
|
924
|
+
case "jurisdiction_out_of_scope":
|
|
925
|
+
return `Not covered by ${scope}.`;
|
|
926
|
+
case "ui_block":
|
|
927
|
+
return `Payments aren't available in your region (${cleanJurisdiction(detail)}).`;
|
|
928
|
+
case "blocked_corridor_mode":
|
|
929
|
+
return "This route isn't currently open for payments.";
|
|
930
|
+
case "blocked_category":
|
|
931
|
+
return `Flagged for ${categoryPhrase(detail)}.`;
|
|
932
|
+
case "amount_exceeds_max_order_usd":
|
|
933
|
+
case "amount_exceeds_max":
|
|
934
|
+
return `Amount exceeds the maximum order size${capFromDetail(detail)}.`;
|
|
935
|
+
case "amount_exceeds_actor_cap":
|
|
936
|
+
return `Amount exceeds the limit for your account type${capFromDetail(detail)}.`;
|
|
937
|
+
case "amount_exceeds_jurisdiction_max":
|
|
938
|
+
return `Amount exceeds the limit for your region${capFromDetail(detail)}.`;
|
|
939
|
+
case "source_chain_not_allowed":
|
|
940
|
+
return `The source chain isn't permitted under ${scope}.`;
|
|
941
|
+
case "dest_chain_not_allowed":
|
|
942
|
+
return `The destination chain isn't permitted under ${scope}.`;
|
|
943
|
+
default:
|
|
944
|
+
return detail ? `${head.replace(/_/g, " ")} \u2014 ${detail}` : head.replace(/_/g, " ");
|
|
945
|
+
}
|
|
946
|
+
}
|
|
947
|
+
var COMPLIANCE_CHECK_ORDER = [
|
|
948
|
+
"location",
|
|
949
|
+
"screening",
|
|
950
|
+
"risk",
|
|
951
|
+
"asset",
|
|
952
|
+
"limits"
|
|
953
|
+
];
|
|
954
|
+
var CHECK_LABELS = {
|
|
955
|
+
location: "Location and corridor permitted",
|
|
956
|
+
screening: "Both wallets screened",
|
|
957
|
+
risk: "Risk policy passed",
|
|
958
|
+
asset: "Asset and amount allowed",
|
|
959
|
+
limits: "Transaction limits verified"
|
|
960
|
+
};
|
|
961
|
+
var CHECK_HEADS = {
|
|
962
|
+
location: [
|
|
963
|
+
"blocked_jurisdiction",
|
|
964
|
+
"blocked_destination_jurisdiction",
|
|
965
|
+
"ui_block",
|
|
966
|
+
"blocked_corridor_mode",
|
|
967
|
+
"jurisdiction_out_of_scope"
|
|
968
|
+
],
|
|
969
|
+
screening: [],
|
|
970
|
+
risk: ["blocked_category"],
|
|
971
|
+
asset: ["asset_pair_not_allowed", "asset_not_allowed", "source_chain_not_allowed", "dest_chain_not_allowed"],
|
|
972
|
+
limits: [
|
|
973
|
+
"amount_exceeds_max_order_usd",
|
|
974
|
+
"amount_exceeds_max",
|
|
975
|
+
"amount_exceeds_actor_cap",
|
|
976
|
+
"amount_exceeds_jurisdiction_max"
|
|
977
|
+
]
|
|
978
|
+
};
|
|
979
|
+
function distinctScreenedWallets(compliance) {
|
|
980
|
+
const seen = /* @__PURE__ */ new Set();
|
|
981
|
+
const wallets = [];
|
|
982
|
+
for (const raw of compliance?.screenedWallets ?? []) {
|
|
983
|
+
const address = raw?.trim();
|
|
984
|
+
if (!address) continue;
|
|
985
|
+
const key = /^0x[0-9a-fA-F]+$/.test(address) ? address.toLowerCase() : address;
|
|
986
|
+
if (seen.has(key)) continue;
|
|
987
|
+
seen.add(key);
|
|
988
|
+
wallets.push(address);
|
|
989
|
+
}
|
|
990
|
+
return wallets;
|
|
991
|
+
}
|
|
992
|
+
function shortAddress(a) {
|
|
993
|
+
return a.length > 12 ? `${a.slice(0, 6)}\u2026${a.slice(-4)}` : a;
|
|
994
|
+
}
|
|
995
|
+
function screeningLabel(wallets) {
|
|
996
|
+
if (wallets === 1) return "Wallet screened";
|
|
997
|
+
if (wallets === 2) return CHECK_LABELS.screening;
|
|
998
|
+
return "Wallets screened";
|
|
999
|
+
}
|
|
1000
|
+
function complianceChecks(compliance, cv = complianceView(compliance)) {
|
|
1001
|
+
if (cv.tone === "neutral") return [];
|
|
1002
|
+
const byControl = /* @__PURE__ */ new Map();
|
|
1003
|
+
for (const raw of compliance?.reasons ?? []) {
|
|
1004
|
+
const head = complianceReasonHead(raw);
|
|
1005
|
+
const id = COMPLIANCE_CHECK_ORDER.find((c) => CHECK_HEADS[c].includes(head));
|
|
1006
|
+
if (!id) continue;
|
|
1007
|
+
byControl.set(id, [...byControl.get(id) ?? [], raw]);
|
|
1008
|
+
}
|
|
1009
|
+
const screenedWallets = distinctScreenedWallets(compliance);
|
|
1010
|
+
const wallets = screenedWallets.length;
|
|
1011
|
+
const blocking = compliance?.blockingCategories?.length ?? 0;
|
|
1012
|
+
return COMPLIANCE_CHECK_ORDER.map((id) => {
|
|
1013
|
+
if (id === "screening") {
|
|
1014
|
+
const ok2 = cv.screened || wallets > 0;
|
|
1015
|
+
const note = wallets === 1 ? shortAddress(screenedWallets[0]) : wallets > 1 ? `${wallets} wallets screened` : void 0;
|
|
1016
|
+
return { id, label: ok2 ? screeningLabel(wallets) : "Wallets not screened", ok: ok2, reasons: [], note };
|
|
1017
|
+
}
|
|
1018
|
+
const reasons = byControl.get(id) ?? [];
|
|
1019
|
+
const ok = reasons.length === 0 && !(id === "risk" && blocking > 0);
|
|
1020
|
+
return { id, label: CHECK_LABELS[id], ok, reasons };
|
|
1021
|
+
});
|
|
1022
|
+
}
|
|
1023
|
+
function unattributedComplianceReasons(compliance, cv = complianceView(compliance)) {
|
|
1024
|
+
const claimed = new Set(complianceChecks(compliance, cv).flatMap((c) => c.reasons));
|
|
1025
|
+
return (compliance?.reasons ?? []).filter((r) => !claimed.has(r));
|
|
1026
|
+
}
|
|
1027
|
+
function complianceControlsEvaluated(compliance, cv = complianceView(compliance)) {
|
|
1028
|
+
const checks = complianceChecks(compliance, cv);
|
|
1029
|
+
if (checks.length === 0) return 0;
|
|
1030
|
+
const named = /* @__PURE__ */ new Set();
|
|
1031
|
+
for (const raw of [...compliance?.appliedPolicyNames ?? [], ...compliance?.appliedLegislation ?? []]) {
|
|
1032
|
+
const name = raw?.trim();
|
|
1033
|
+
if (name) named.add(name.toLowerCase());
|
|
1034
|
+
}
|
|
1035
|
+
return checks.length + named.size;
|
|
1036
|
+
}
|
|
1037
|
+
function complianceControlsLine(compliance, cv = complianceView(compliance)) {
|
|
1038
|
+
if (cv.blocked || cv.needsAction) return cv.headline;
|
|
1039
|
+
const n = complianceControlsEvaluated(compliance, cv);
|
|
1040
|
+
if (n === 0) return cv.headline;
|
|
1041
|
+
return `${n} compliance control${n === 1 ? "" : "s"} evaluated for this payment`;
|
|
1042
|
+
}
|
|
1043
|
+
function directComplianceFromScreens(screens) {
|
|
1044
|
+
const blockedAny = screens.some((s) => s.blocked);
|
|
1045
|
+
const cats = (pick) => [
|
|
1046
|
+
...new Set(screens.flatMap((s) => pick(s) ?? []))
|
|
1047
|
+
];
|
|
1048
|
+
return {
|
|
1049
|
+
status: "SCREENED",
|
|
1050
|
+
decision: blockedAny ? "DENY" : "ALLOW",
|
|
1051
|
+
screenedWallets: screens.map((s) => s.address),
|
|
1052
|
+
riskCategories: cats((s) => s.riskCategories),
|
|
1053
|
+
flaggedCategories: cats((s) => s.flaggedCategories),
|
|
1054
|
+
blockingCategories: cats((s) => s.blockingCategories),
|
|
1055
|
+
reasons: blockedAny ? cats((s) => s.blockingCategories).map((c) => `blocked_category:${c}`) : []
|
|
1056
|
+
};
|
|
1057
|
+
}
|
|
1058
|
+
var DIRECT_CHECK_IDS = ["screening", "risk"];
|
|
1059
|
+
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.";
|
|
1060
|
+
var BLOCK_CATEGORY_LABELS = {
|
|
1061
|
+
STOLEN_FUNDS: "flagged as associated with stolen funds",
|
|
1062
|
+
SANCTIONS: "on a sanctions list",
|
|
1063
|
+
SANCTIONED: "on a sanctions list",
|
|
1064
|
+
OFAC: "on a sanctions list",
|
|
1065
|
+
TERRORIST_FINANCING: "flagged for terrorist financing",
|
|
1066
|
+
TERRORISM_FINANCING: "flagged for terrorist financing",
|
|
1067
|
+
FRAUD: "flagged for fraud",
|
|
1068
|
+
SCAM: "flagged as a scam address"
|
|
1069
|
+
};
|
|
1070
|
+
var BLOCK_LABEL_DEFAULT = "flagged by compliance screening";
|
|
1071
|
+
function blockLabelFor(categories) {
|
|
1072
|
+
for (const raw of categories) {
|
|
1073
|
+
const label = BLOCK_CATEGORY_LABELS[String(raw || "").trim().toUpperCase()];
|
|
1074
|
+
if (label) return label;
|
|
1075
|
+
}
|
|
1076
|
+
return BLOCK_LABEL_DEFAULT;
|
|
1077
|
+
}
|
|
1078
|
+
var REASON_TAGS = {
|
|
1079
|
+
blocked_jurisdiction: "Restricted country",
|
|
1080
|
+
ui_block: "Restricted country",
|
|
1081
|
+
blocked_destination_jurisdiction: "Restricted destination",
|
|
1082
|
+
blocked_corridor_mode: "Corridor closed",
|
|
1083
|
+
blocked_category: "Risk flag",
|
|
1084
|
+
amount_exceeds_max_order_usd: "Limit exceeded",
|
|
1085
|
+
amount_exceeds_max: "Limit exceeded",
|
|
1086
|
+
amount_exceeds_actor_cap: "Limit exceeded",
|
|
1087
|
+
amount_exceeds_jurisdiction_max: "Limit exceeded",
|
|
1088
|
+
asset_pair_not_allowed: "Asset not allowed",
|
|
1089
|
+
asset_not_allowed: "Asset not allowed",
|
|
1090
|
+
source_chain_not_allowed: "Chain not allowed",
|
|
1091
|
+
dest_chain_not_allowed: "Chain not allowed",
|
|
1092
|
+
jurisdiction_out_of_scope: "Out of scope"
|
|
1093
|
+
};
|
|
1094
|
+
function complianceReasonTag(raw) {
|
|
1095
|
+
const head = complianceReasonHead(raw);
|
|
1096
|
+
return REASON_TAGS[head] ?? head.replace(/_/g, " ");
|
|
1097
|
+
}
|
|
1098
|
+
function complianceTagOf(compliance) {
|
|
1099
|
+
const first = (compliance?.reasons ?? [])[0];
|
|
1100
|
+
return first ? complianceReasonTag(first) : "";
|
|
1101
|
+
}
|
|
1102
|
+
var FLOOR_CATEGORIES = ["SANCTIONS", "TERRORISM_FINANCING", "STOLEN_FUNDS", "RANSOMWARE"];
|
|
1103
|
+
var TUNABLE_CATEGORIES = ["SCAM", "DARKNET", "MIXER", "HIGH_RISK_ENTITY", "PEP", "INDIRECT_EXPOSURE", "UNCLASSIFIED"];
|
|
1104
|
+
var TUNED_OUTCOMES = {
|
|
1105
|
+
SCAM: "blocked",
|
|
1106
|
+
DARKNET: "blocked",
|
|
1107
|
+
MIXER: "flagged",
|
|
1108
|
+
HIGH_RISK_ENTITY: "flagged",
|
|
1109
|
+
PEP: "flagged",
|
|
1110
|
+
INDIRECT_EXPOSURE: "flagged",
|
|
1111
|
+
UNCLASSIFIED: "flagged"
|
|
1112
|
+
};
|
|
1113
|
+
function screeningOutcomeOf(category) {
|
|
1114
|
+
const key = category.trim().toUpperCase();
|
|
1115
|
+
if (FLOOR_CATEGORIES.includes(key)) return "always-blocked";
|
|
1116
|
+
return TUNED_OUTCOMES[key] ?? null;
|
|
1117
|
+
}
|
|
1118
|
+
var labelsFor = (outcome) => [...FLOOR_CATEGORIES, ...TUNABLE_CATEGORIES].filter((c) => screeningOutcomeOf(c) === outcome).map(categoryLabel);
|
|
1119
|
+
var SCREENING_BUCKETS = [
|
|
1120
|
+
{ outcome: "always-blocked", title: "Always blocked", detail: "Cannot be changed or disabled.", categories: labelsFor("always-blocked") },
|
|
1121
|
+
{ outcome: "blocked", title: "Blocked under this policy", detail: "The current policy stops the order.", categories: labelsFor("blocked") },
|
|
1122
|
+
{ outcome: "flagged", title: "Flagged", detail: "A warning is shown.", categories: labelsFor("flagged") }
|
|
1123
|
+
];
|
|
1124
|
+
|
|
764
1125
|
// src/core/solve.ts
|
|
765
1126
|
async function solveExactOut({ option, destination, destinationToken, payer, fetchQuote }) {
|
|
766
1127
|
const destDecimals = assetDecimals(destinationToken);
|
|
@@ -997,7 +1358,63 @@ function routeLabelFor(option, destinationToken, result) {
|
|
|
997
1358
|
const bridge = result.quote.bridge ? ` via ${result.quote.bridge}` : "";
|
|
998
1359
|
return `Swap ${option.symbol} to ${destinationToken.symbol} and settle on ZeroDelta${bridge}.`;
|
|
999
1360
|
}
|
|
1000
|
-
|
|
1361
|
+
function tokenAt(tokens, chainId, address) {
|
|
1362
|
+
const wanted = normalizeAddress(address);
|
|
1363
|
+
if (!wanted || !tokens?.length) return void 0;
|
|
1364
|
+
return tokens.find((t) => Number(t.chainId) === Number(chainId) && normalizeAddress(t.address) === wanted);
|
|
1365
|
+
}
|
|
1366
|
+
function legAmount(raw, decimals) {
|
|
1367
|
+
if (decimals === void 0) return "";
|
|
1368
|
+
try {
|
|
1369
|
+
return formatUnits(raw || "0", decimals);
|
|
1370
|
+
} catch {
|
|
1371
|
+
return "";
|
|
1372
|
+
}
|
|
1373
|
+
}
|
|
1374
|
+
function buildLegs(orders, ctx) {
|
|
1375
|
+
const legs = [];
|
|
1376
|
+
let fromChainId = ctx.option.chainId;
|
|
1377
|
+
let fromAsset = ctx.option.symbol;
|
|
1378
|
+
let fromDecimals = ctx.option.decimals;
|
|
1379
|
+
for (let index = 0; index < orders.length; index += 1) {
|
|
1380
|
+
const order = orders[index];
|
|
1381
|
+
const isLast = index === orders.length - 1;
|
|
1382
|
+
const toChainId = Number(order.destinationChainId);
|
|
1383
|
+
const askToken = isLast ? ctx.destinationToken : tokenAt(ctx.tokens, toChainId, order.askToken);
|
|
1384
|
+
const toAsset = isLast ? ctx.destinationToken.symbol : askToken?.symbol ?? "";
|
|
1385
|
+
const toDecimals = askToken ? assetDecimals(askToken) : void 0;
|
|
1386
|
+
const executionChainId = Number(order.executionChainId);
|
|
1387
|
+
legs.push({
|
|
1388
|
+
index: index + 1,
|
|
1389
|
+
fromAsset,
|
|
1390
|
+
fromChainId,
|
|
1391
|
+
fromChainName: chainNameOf(fromChainId, ctx.chains),
|
|
1392
|
+
fromAmount: legAmount(order.bidTokenAmount, fromDecimals),
|
|
1393
|
+
toAsset,
|
|
1394
|
+
toChainId,
|
|
1395
|
+
toChainName: chainNameOf(toChainId, ctx.chains),
|
|
1396
|
+
toAmount: legAmount(order.askTokenAmount, toDecimals),
|
|
1397
|
+
executionChainId,
|
|
1398
|
+
executionChainName: chainNameOf(executionChainId, ctx.chains)
|
|
1399
|
+
});
|
|
1400
|
+
fromChainId = toChainId;
|
|
1401
|
+
fromAsset = toAsset;
|
|
1402
|
+
fromDecimals = toDecimals;
|
|
1403
|
+
}
|
|
1404
|
+
return legs;
|
|
1405
|
+
}
|
|
1406
|
+
async function buildRoute({
|
|
1407
|
+
option,
|
|
1408
|
+
destination,
|
|
1409
|
+
destinationToken,
|
|
1410
|
+
chains,
|
|
1411
|
+
tokens,
|
|
1412
|
+
payer,
|
|
1413
|
+
fetchQuote,
|
|
1414
|
+
solve = solveExactOut,
|
|
1415
|
+
amountInRaw,
|
|
1416
|
+
compliance
|
|
1417
|
+
}) {
|
|
1001
1418
|
const result = await solve({ option, destination, destinationToken, payer, fetchQuote, amountInRaw });
|
|
1002
1419
|
const quote = result.quote;
|
|
1003
1420
|
const destDecimals = assetDecimals(destinationToken);
|
|
@@ -1027,6 +1444,23 @@ async function buildRoute({ option, destination, destinationToken, chains, payer
|
|
|
1027
1444
|
},
|
|
1028
1445
|
routeLabel: routeLabelFor(option, destinationToken, result),
|
|
1029
1446
|
deltaLabel: routeDeltaLabel(result, quote),
|
|
1447
|
+
// A direct transfer submits no order at all, but it is still ONE hop and history renders the
|
|
1448
|
+
// same shape for it — an empty `legs` would leave "one order or two?" unanswerable for it alone.
|
|
1449
|
+
legs: [
|
|
1450
|
+
{
|
|
1451
|
+
index: 1,
|
|
1452
|
+
fromAsset: option.symbol,
|
|
1453
|
+
fromChainId: option.chainId,
|
|
1454
|
+
fromChainName: option.chainName,
|
|
1455
|
+
fromAmount: sourceAmount,
|
|
1456
|
+
toAsset: destinationToken.symbol,
|
|
1457
|
+
toChainId: Number(destination.chainId),
|
|
1458
|
+
toChainName: chainNameOf(Number(destination.chainId), chains),
|
|
1459
|
+
toAmount: receiveAmount,
|
|
1460
|
+
executionChainId: option.chainId,
|
|
1461
|
+
executionChainName: option.chainName
|
|
1462
|
+
}
|
|
1463
|
+
],
|
|
1030
1464
|
transactions: [
|
|
1031
1465
|
{
|
|
1032
1466
|
id: "transfer",
|
|
@@ -1044,7 +1478,11 @@ async function buildRoute({ option, destination, destinationToken, chains, payer
|
|
|
1044
1478
|
bridge: quote.bridge,
|
|
1045
1479
|
feeBps: quote.feeBps,
|
|
1046
1480
|
estimatedDuration: quote.estimatedDuration,
|
|
1047
|
-
iterations: result.iterations
|
|
1481
|
+
iterations: result.iterations,
|
|
1482
|
+
// A direct transfer never reaches /quote (solve.ts short-circuits it), so there is no
|
|
1483
|
+
// gateway decision to carry. The caller screens both parties itself and passes the
|
|
1484
|
+
// synthesized verdict in — see plan.ts and compliance.ts::directComplianceFromScreens.
|
|
1485
|
+
compliance
|
|
1048
1486
|
}
|
|
1049
1487
|
};
|
|
1050
1488
|
}
|
|
@@ -1096,6 +1534,7 @@ async function buildRoute({ option, destination, destinationToken, chains, payer
|
|
|
1096
1534
|
},
|
|
1097
1535
|
routeLabel: routeLabelFor(option, destinationToken, result),
|
|
1098
1536
|
deltaLabel: routeDeltaLabel(result, quote),
|
|
1537
|
+
legs: buildLegs(orders, { option, destinationToken, chains, tokens }),
|
|
1099
1538
|
transactions: [
|
|
1100
1539
|
{
|
|
1101
1540
|
id: "approve",
|
|
@@ -1128,7 +1567,11 @@ async function buildRoute({ option, destination, destinationToken, chains, payer
|
|
|
1128
1567
|
gasCostSource: quote.gasCostSource,
|
|
1129
1568
|
msgValue: valueRaw.toString(),
|
|
1130
1569
|
deadline: order.deadline,
|
|
1131
|
-
iterations: result.iterations
|
|
1570
|
+
iterations: result.iterations,
|
|
1571
|
+
// Carried verbatim from the gateway's decision on THIS wallet pair. The projection used to
|
|
1572
|
+
// drop it, which is why the widget could show a price with no evidence of the control that
|
|
1573
|
+
// produced it.
|
|
1574
|
+
compliance: quote.compliance
|
|
1132
1575
|
}
|
|
1133
1576
|
};
|
|
1134
1577
|
}
|
|
@@ -1164,25 +1607,20 @@ function apiMessage(json, fallback) {
|
|
|
1164
1607
|
}
|
|
1165
1608
|
return sanitizeMessage(err?.message, fallback);
|
|
1166
1609
|
}
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
TERRORIST_FINANCING: "flagged for terrorist financing",
|
|
1173
|
-
FRAUD: "flagged for fraud",
|
|
1174
|
-
SCAM: "flagged as a scam address"
|
|
1175
|
-
};
|
|
1176
|
-
var BLOCK_LABEL_DEFAULT = "flagged by compliance screening";
|
|
1610
|
+
function isStructuredComplianceBlock(error) {
|
|
1611
|
+
const code = String(error?.code || "").toUpperCase();
|
|
1612
|
+
if (code === "COMPLIANCE_BLOCKED" || code === "COMPLIANCE_BLOCK") return true;
|
|
1613
|
+
return error?.status === 422 && Array.isArray(error?.reasons) && error.reasons.length > 0;
|
|
1614
|
+
}
|
|
1177
1615
|
function classifyQuoteError(error) {
|
|
1178
1616
|
if (!error) return null;
|
|
1179
1617
|
const reasons = Array.isArray(error.reasons) ? error.reasons : [];
|
|
1180
1618
|
const haystack = `${error.message || ""} ${reasons.join(" ")}`;
|
|
1181
1619
|
const catMatch = /blocked_category:\s*([A-Za-z_]+)/i.exec(haystack);
|
|
1182
|
-
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);
|
|
1620
|
+
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);
|
|
1183
1621
|
if (!isBlock) return null;
|
|
1184
1622
|
const category = (catMatch?.[1] || "").toUpperCase() || "COMPLIANCE";
|
|
1185
|
-
const label =
|
|
1623
|
+
const label = blockLabelFor([category]);
|
|
1186
1624
|
return {
|
|
1187
1625
|
blocked: true,
|
|
1188
1626
|
category,
|
|
@@ -1204,8 +1642,11 @@ function createApiClient(cfg) {
|
|
|
1204
1642
|
chains: null,
|
|
1205
1643
|
tokens: null,
|
|
1206
1644
|
routes: null,
|
|
1207
|
-
health: null
|
|
1645
|
+
health: null,
|
|
1646
|
+
vaults: null
|
|
1208
1647
|
};
|
|
1648
|
+
const screenCache = /* @__PURE__ */ new Map();
|
|
1649
|
+
const screenInflight = /* @__PURE__ */ new Map();
|
|
1209
1650
|
const apiBase = cfg.apiBase.replace(/\/$/, "");
|
|
1210
1651
|
async function apiRequest(path, init = {}) {
|
|
1211
1652
|
const apiKey = await cfg.getApiKey();
|
|
@@ -1286,6 +1727,19 @@ function createApiClient(cfg) {
|
|
|
1286
1727
|
cache.health = { at: Date.now(), value };
|
|
1287
1728
|
return value;
|
|
1288
1729
|
}
|
|
1730
|
+
async function fetchRwaVaults() {
|
|
1731
|
+
if (nowFresh(cache.vaults)) return cache.vaults.value;
|
|
1732
|
+
let value = [];
|
|
1733
|
+
try {
|
|
1734
|
+
const payload = await apiRequest("/rwa/vaults?status=active,coming_soon", { timeoutMs: 8e3 });
|
|
1735
|
+
const rows = Array.isArray(payload) ? payload : payload?.vaults;
|
|
1736
|
+
value = Array.isArray(rows) ? rows.filter((v) => !!v && typeof v === "object") : [];
|
|
1737
|
+
} catch {
|
|
1738
|
+
value = [];
|
|
1739
|
+
}
|
|
1740
|
+
cache.vaults = { at: Date.now(), value };
|
|
1741
|
+
return value;
|
|
1742
|
+
}
|
|
1289
1743
|
async function fetchQuote(body, retries = 1) {
|
|
1290
1744
|
let lastError;
|
|
1291
1745
|
for (let attempt = 0; attempt <= retries; attempt += 1) {
|
|
@@ -1300,7 +1754,32 @@ function createApiClient(cfg) {
|
|
|
1300
1754
|
}
|
|
1301
1755
|
throw lastError;
|
|
1302
1756
|
}
|
|
1303
|
-
|
|
1757
|
+
async function screenWallet(address, chainId) {
|
|
1758
|
+
const addr = String(address || "").trim();
|
|
1759
|
+
if (!addr) throw apiError("An address is required to screen a wallet.", { code: "bad_request" });
|
|
1760
|
+
const key = `${/^0x[0-9a-fA-F]+$/.test(addr) ? addr.toLowerCase() : addr}|${chainId ?? ""}`;
|
|
1761
|
+
const hit = screenCache.get(key);
|
|
1762
|
+
if (hit && Date.now() - hit.at < SCREEN_CACHE_TTL_MS) return hit.value;
|
|
1763
|
+
const inflight = screenInflight.get(key);
|
|
1764
|
+
if (inflight) return inflight;
|
|
1765
|
+
const request = apiRequest("/screen/wallet", {
|
|
1766
|
+
method: "POST",
|
|
1767
|
+
body: JSON.stringify(chainId == null ? { address: addr } : { address: addr, chainId }),
|
|
1768
|
+
timeoutMs: 12e3
|
|
1769
|
+
}).then((screen) => {
|
|
1770
|
+
if (!screen || typeof screen !== "object" || typeof screen.blocked !== "boolean") {
|
|
1771
|
+
throw apiError("Compliance screening returned an unusable result.", { code: "bad_response" });
|
|
1772
|
+
}
|
|
1773
|
+
const value = { ...screen, address: screen.address || addr };
|
|
1774
|
+
screenCache.set(key, { at: Date.now(), value });
|
|
1775
|
+
return value;
|
|
1776
|
+
}).finally(() => {
|
|
1777
|
+
screenInflight.delete(key);
|
|
1778
|
+
});
|
|
1779
|
+
screenInflight.set(key, request);
|
|
1780
|
+
return request;
|
|
1781
|
+
}
|
|
1782
|
+
return { apiRequest, fetchChains, fetchTokens, fetchRoutes, fetchRouteHealth, fetchRwaVaults, fetchQuote, screenWallet, apiBase };
|
|
1304
1783
|
}
|
|
1305
1784
|
|
|
1306
1785
|
// src/core/plan.ts
|
|
@@ -1368,7 +1847,36 @@ async function fetchPaymentPlan(api, request, payer, wallet = {}, readBalances)
|
|
|
1368
1847
|
balanceTargets.push({ chainId: option.chainId, tokenAddress: option.address, decimals: option.decimals });
|
|
1369
1848
|
}
|
|
1370
1849
|
const walletBalances = readBalances ? await readBalances(payer, balanceTargets).catch(() => ({})) : {};
|
|
1371
|
-
const
|
|
1850
|
+
const directOptions = options.filter((option) => option.direct);
|
|
1851
|
+
let directCompliance = null;
|
|
1852
|
+
if (directOptions.length) {
|
|
1853
|
+
const parties = [];
|
|
1854
|
+
const seenParty = /* @__PURE__ */ new Set();
|
|
1855
|
+
for (const raw of [payer, destination.address]) {
|
|
1856
|
+
const addr = String(raw || "").trim();
|
|
1857
|
+
if (!addr) continue;
|
|
1858
|
+
const key = /^0x[0-9a-fA-F]+$/.test(addr) ? addr.toLowerCase() : addr;
|
|
1859
|
+
if (seenParty.has(key)) continue;
|
|
1860
|
+
seenParty.add(key);
|
|
1861
|
+
parties.push(addr);
|
|
1862
|
+
}
|
|
1863
|
+
try {
|
|
1864
|
+
const screens = await Promise.all(parties.map((address) => api.screenWallet(address, destination.chainId)));
|
|
1865
|
+
const blocked = screens.filter((screen) => screen.blocked);
|
|
1866
|
+
if (blocked.length) {
|
|
1867
|
+
const who = blocked.some((s) => s.address.toLowerCase() === payer.toLowerCase()) ? "your wallet" : "the recipient";
|
|
1868
|
+
const categories = [...new Set(blocked.flatMap((s) => s.blockingCategories ?? []))];
|
|
1869
|
+
throw apiError(
|
|
1870
|
+
`This payment was blocked by compliance screening \u2014 ${who} is ${blockLabelFor(categories)}. Choose a different recipient or connect a different wallet.`,
|
|
1871
|
+
{ blocked: true, blockedCategory: categories[0] || "COMPLIANCE", blockedReason: categories.join(", ") }
|
|
1872
|
+
);
|
|
1873
|
+
}
|
|
1874
|
+
directCompliance = directComplianceFromScreens(screens);
|
|
1875
|
+
} catch (error) {
|
|
1876
|
+
if (error?.blocked) throw error;
|
|
1877
|
+
}
|
|
1878
|
+
}
|
|
1879
|
+
const candidates = directCompliance ? directOptions : [];
|
|
1372
1880
|
const heldOptions = options.filter((option) => !option.direct && hasPositiveBalance(option, walletBalances));
|
|
1373
1881
|
const heldKeys = new Set(heldOptions.map(optionBalanceKey));
|
|
1374
1882
|
const seenChains = /* @__PURE__ */ new Set();
|
|
@@ -1388,7 +1896,16 @@ async function fetchPaymentPlan(api, request, payer, wallet = {}, readBalances)
|
|
|
1388
1896
|
}
|
|
1389
1897
|
const routeErrors = [];
|
|
1390
1898
|
const routePromises = candidates.map(
|
|
1391
|
-
(option) => buildRoute({
|
|
1899
|
+
(option) => buildRoute({
|
|
1900
|
+
option,
|
|
1901
|
+
destination,
|
|
1902
|
+
destinationToken,
|
|
1903
|
+
chains,
|
|
1904
|
+
tokens,
|
|
1905
|
+
payer,
|
|
1906
|
+
fetchQuote: api.fetchQuote,
|
|
1907
|
+
compliance: option.direct ? directCompliance ?? void 0 : void 0
|
|
1908
|
+
}).catch((error) => {
|
|
1392
1909
|
routeErrors.push(error);
|
|
1393
1910
|
return null;
|
|
1394
1911
|
})
|
|
@@ -1501,7 +2018,7 @@ async function buildSwapPlan(api, swap, payer, wallet = {}) {
|
|
|
1501
2018
|
direct: false
|
|
1502
2019
|
};
|
|
1503
2020
|
const destination = { address: receiver, chainId: v.toChainId, asset: destToken.symbol };
|
|
1504
|
-
const route = await buildRoute({ option, destination, destinationToken: destToken, chains, payer: account, fetchQuote: api.fetchQuote, solve: solveExactIn, amountInRaw });
|
|
2021
|
+
const route = await buildRoute({ option, destination, destinationToken: destToken, chains, tokens, payer: account, fetchQuote: api.fetchQuote, solve: solveExactIn, amountInRaw });
|
|
1505
2022
|
if (route.state === "SHORT") throw new Error("ZeroDelta could not price this swap right now.");
|
|
1506
2023
|
route.recommended = true;
|
|
1507
2024
|
return {
|
|
@@ -1856,6 +2373,24 @@ function resolveConfig(config = {}) {
|
|
|
1856
2373
|
}
|
|
1857
2374
|
|
|
1858
2375
|
// src/core/index.ts
|
|
2376
|
+
function sanitizeLegs(legs) {
|
|
2377
|
+
if (!Array.isArray(legs) || !legs.length) return void 0;
|
|
2378
|
+
const text = (v, max) => String(v ?? "").slice(0, max);
|
|
2379
|
+
const chain = (v) => Number(v) || 0;
|
|
2380
|
+
return legs.slice(0, 8).map((leg, i) => ({
|
|
2381
|
+
index: Number(leg?.index) || i + 1,
|
|
2382
|
+
fromAsset: text(leg?.fromAsset, 12),
|
|
2383
|
+
fromChainId: chain(leg?.fromChainId),
|
|
2384
|
+
fromChainName: text(leg?.fromChainName, 40),
|
|
2385
|
+
fromAmount: text(leg?.fromAmount, 40),
|
|
2386
|
+
toAsset: text(leg?.toAsset, 12),
|
|
2387
|
+
toChainId: chain(leg?.toChainId),
|
|
2388
|
+
toChainName: text(leg?.toChainName, 40),
|
|
2389
|
+
toAmount: text(leg?.toAmount, 40),
|
|
2390
|
+
executionChainId: chain(leg?.executionChainId),
|
|
2391
|
+
executionChainName: text(leg?.executionChainName, 40)
|
|
2392
|
+
}));
|
|
2393
|
+
}
|
|
1859
2394
|
function sanitizeTxEntry(entry) {
|
|
1860
2395
|
return {
|
|
1861
2396
|
kind: entry.kind === "swap" ? "swap" : "payment",
|
|
@@ -1871,7 +2406,8 @@ function sanitizeTxEntry(entry) {
|
|
|
1871
2406
|
recipient: isAddress(entry.recipient) ? normalizeAddress(entry.recipient) : "",
|
|
1872
2407
|
settlement: entry.settlement === "direct" ? "direct" : "escrow",
|
|
1873
2408
|
status: entry.status && ["confirmed", "unconfirmed", "error"].includes(entry.status) ? entry.status : "submitted",
|
|
1874
|
-
at: (/* @__PURE__ */ new Date()).toISOString()
|
|
2409
|
+
at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2410
|
+
legs: sanitizeLegs(entry.legs)
|
|
1875
2411
|
};
|
|
1876
2412
|
}
|
|
1877
2413
|
function createEngine(config = {}) {
|
|
@@ -1888,12 +2424,15 @@ function createEngine(config = {}) {
|
|
|
1888
2424
|
fetchRouteHealth: api.fetchRouteHealth,
|
|
1889
2425
|
fetchQuote: api.fetchQuote,
|
|
1890
2426
|
fetchCatalogue: async (allowedAssets, product) => {
|
|
1891
|
-
const [chains,
|
|
2427
|
+
const [chains, registryTokens, routes, health, vaults] = await Promise.all([
|
|
1892
2428
|
api.fetchChains().catch(() => []),
|
|
1893
2429
|
api.fetchTokens().catch(() => []),
|
|
1894
2430
|
api.fetchRoutes().catch(() => []),
|
|
1895
|
-
api.fetchRouteHealth()
|
|
2431
|
+
api.fetchRouteHealth(),
|
|
2432
|
+
api.fetchRwaVaults()
|
|
1896
2433
|
]);
|
|
2434
|
+
const vaultIcons = vaultIconsBySymbol(api.apiBase, vaults);
|
|
2435
|
+
const tokens = withVaultArtwork(registryTokens, vaultIcons);
|
|
1897
2436
|
const allowed = allowedAssets?.length ? new Set([...allowedAssets].map(symbolKey).filter((a) => SUPPORTED_ASSETS.has(a))) : void 0;
|
|
1898
2437
|
return buildCatalogue({
|
|
1899
2438
|
chains,
|
|
@@ -1902,7 +2441,8 @@ function createEngine(config = {}) {
|
|
|
1902
2441
|
product,
|
|
1903
2442
|
...allowed ? { allowedAssets: allowed } : {},
|
|
1904
2443
|
supportedChainIds: SUPPORTED_CHAIN_IDS,
|
|
1905
|
-
brokenLanes: suppressedLanes(health)
|
|
2444
|
+
brokenLanes: suppressedLanes(health),
|
|
2445
|
+
vaultIcons
|
|
1906
2446
|
});
|
|
1907
2447
|
},
|
|
1908
2448
|
fetchPaymentPlan: (request, payer, wallet) => fetchPaymentPlan(api, request, payer, wallet, verifier.readBalances),
|
|
@@ -2366,7 +2906,10 @@ function useFlow(args) {
|
|
|
2366
2906
|
account,
|
|
2367
2907
|
recipient,
|
|
2368
2908
|
settlement: route.state === "DIRECT" ? "direct" : "escrow",
|
|
2369
|
-
status: v.status === "confirmed" ? "confirmed" : v.status === "mismatch" || v.status === "reverted" ? "error" : "unconfirmed"
|
|
2909
|
+
status: v.status === "confirmed" ? "confirmed" : v.status === "mismatch" || v.status === "reverted" ? "error" : "unconfirmed",
|
|
2910
|
+
// One signature can be several orders. Record them, or the history of a chained RWA trade
|
|
2911
|
+
// reads as a single hop that skipped a chain it demonstrably went through.
|
|
2912
|
+
legs: route.legs
|
|
2370
2913
|
});
|
|
2371
2914
|
setLastTxEntry(entry.hash ? entry : null);
|
|
2372
2915
|
appendTxHistory(account, entry);
|
|
@@ -2587,6 +3130,12 @@ var WIDGET_CSS = `
|
|
|
2587
3130
|
@keyframes sg-shimmer{0%{background-position:100% 0}100%{background-position:-100% 0}}
|
|
2588
3131
|
|
|
2589
3132
|
.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}
|
|
3133
|
+
/* display:inline-block is load-bearing, not tidiness. A host running a CSS reset \u2014 Tailwind
|
|
3134
|
+
preflight, which most integrators use and which this repo's own playground applies \u2014 sets
|
|
3135
|
+
svg{display:block}, and the padlock then takes a line of its own above the sentence. Every other
|
|
3136
|
+
glyph in the widget sits in a flex or absolute box where that is harmless; this is the one that
|
|
3137
|
+
lives in normal text flow. (WIDGET_CSS is a template literal: no backticks in these comments.) */
|
|
3138
|
+
.sg-foot svg{display:inline-block;vertical-align:-1px;margin-right:5px}
|
|
2590
3139
|
|
|
2591
3140
|
/* fixed-height variant \u2014 head/foot pinned, body scrolls */
|
|
2592
3141
|
.sg-widget[data-sg-fixed="true"]{display:flex;flex-direction:column}
|
|
@@ -2606,6 +3155,7 @@ var WIDGET_CSS = `
|
|
|
2606
3155
|
.sg-tile:disabled{cursor:default}
|
|
2607
3156
|
.sg-tile-label{font-size:12px;color:var(--sg-text-muted)}
|
|
2608
3157
|
.sg-tile-main{display:flex;align-items:center;gap:10px;min-width:0}
|
|
3158
|
+
.sg-tile-text{display:block;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
2609
3159
|
.sg-tile-sym{font-size:16px;font-weight:700;line-height:1.15;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
|
2610
3160
|
.sg-tile-chain{font-size:11px;color:var(--sg-text-muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
|
2611
3161
|
.sg-tile-empty{color:var(--sg-text-muted);font-size:15px;font-weight:600}
|
|
@@ -2640,7 +3190,9 @@ img.sg-tok-badge{width:16px;padding:0;object-fit:cover;background:var(--sg-bg)}
|
|
|
2640
3190
|
.sg-sel-head{display:flex;align-items:center;margin-bottom:14px}
|
|
2641
3191
|
.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}
|
|
2642
3192
|
.sg-back:hover{background:var(--sg-surface)}
|
|
2643
|
-
.sg-sel-title{flex:1 1 auto;text-align:center;font-size:15px;font-weight:600;margin-right:32px}
|
|
3193
|
+
.sg-sel-title{flex:1 1 auto;min-width:0;text-align:center;font-size:15px;font-weight:600;margin-right:32px}
|
|
3194
|
+
/* Whose transactions these are \u2014 history is per wallet, and the takeover hides the header's pill. */
|
|
3195
|
+
.sg-sel-sub{display:block;font-size:11px;font-weight:600;color:var(--sg-text-muted);margin-top:1px}
|
|
2644
3196
|
/* Scrolls at ~2.5 rows. The catalogue's destination chains outnumber its source chains three to one
|
|
2645
3197
|
(9 escrow chains, ~37 total), so an ungated grid was eight rows tall and pushed the token list \u2014
|
|
2646
3198
|
the thing the panel exists for \u2014 below the fold. The fade is a scroll affordance, not decoration. */
|
|
@@ -2699,6 +3251,53 @@ img.sg-tok-badge{width:16px;padding:0;object-fit:cover;background:var(--sg-bg)}
|
|
|
2699
3251
|
.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}
|
|
2700
3252
|
.sg-hist:hover{color:var(--sg-accent);border-color:var(--sg-accent)}
|
|
2701
3253
|
|
|
3254
|
+
/* transaction history row. NOT the picker's flex row: at 390px that layout wrapped the pair onto two
|
|
3255
|
+
lines and then ellipsised the whole meta line down to "\u2026". A 3-column grid instead, where the meta
|
|
3256
|
+
spans the badge column so it always has the full card width to wrap into. */
|
|
3257
|
+
.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}
|
|
3258
|
+
.sg-txrow:hover{background:var(--sg-surface)}
|
|
3259
|
+
/* Both ends of the trade, side by side \u2014 the RWA gets a mark of its own. NOT overlapped: each disc
|
|
3260
|
+
carries a chain badge at its bottom-right, and an overlap parks that badge on top of its neighbour. */
|
|
3261
|
+
.sg-txrow-glyphs{grid-column:1;grid-row:1 / span 2;display:flex;align-items:center;gap:9px}
|
|
3262
|
+
/* Each side is its own nowrap span, so a narrow card breaks the line AT THE ARROW, never mid-symbol. */
|
|
3263
|
+
.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}
|
|
3264
|
+
.sg-txrow-side{white-space:nowrap;display:inline-flex;align-items:center;gap:5px}
|
|
3265
|
+
.sg-txrow-arrow{display:inline-flex;color:var(--sg-text-muted)}
|
|
3266
|
+
/* Meta and status share line 2. The badge sat beside the pair until it squeezed the pair onto two
|
|
3267
|
+
lines at 390px; down here the pair gets the card's full width and the badge still reads at a glance. */
|
|
3268
|
+
/* flex-start, not center: on a phone the meta wraps to two lines, and a centred badge then floats
|
|
3269
|
+
between them. Pinned to the first line it reads as the row's status rather than as a third line. */
|
|
3270
|
+
.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}
|
|
3271
|
+
.sg-txrow-when{flex:1 1 auto;min-width:0;display:flex;flex-wrap:wrap;column-gap:8px}
|
|
3272
|
+
/* The kind+chain+orders unit WRAPS; only the timestamp is unbreakable. Holding both as nowrap made
|
|
3273
|
+
the express card (the narrowest surface) overflow its text straight under the status pill. */
|
|
3274
|
+
.sg-txrow-time{white-space:nowrap}
|
|
3275
|
+
.sg-txrow-what{display:flex;flex-wrap:wrap;column-gap:5px;min-width:0}
|
|
3276
|
+
.sg-txrow-what>span{white-space:nowrap}
|
|
3277
|
+
/* The separator is the literal character, never a CSS unicode escape. WIDGET_CSS is a JS template
|
|
3278
|
+
literal, so a backslash-zero-zero escape in here is a legacy octal sequence and esbuild refuses to
|
|
3279
|
+
build the package at all \u2014 including inside a comment like this one. */
|
|
3280
|
+
.sg-txrow-what>span:not(:last-child)::after{content:"\xB7";margin-left:5px}
|
|
3281
|
+
.sg-txrow-end{flex:0 0 auto;margin-left:auto}
|
|
3282
|
+
|
|
3283
|
+
/* transaction detail: the route, one row per ORDER. A chained (RWA) trade is ONE signature and TWO
|
|
3284
|
+
orders; the numbered rail is what makes the middle hop visible instead of merely implied. */
|
|
3285
|
+
/* The pair's artwork above the anchor amount, same marks the pickers draw. */
|
|
3286
|
+
.sg-panel > .sg-txrow-glyphs{margin-bottom:10px}
|
|
3287
|
+
.sg-legs{margin-top:14px}
|
|
3288
|
+
.sg-legs-head{display:flex;align-items:center;justify-content:space-between;gap:8px;font-size:13px;margin-bottom:6px}
|
|
3289
|
+
.sg-leg-list{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:2px}
|
|
3290
|
+
.sg-leg{display:flex;align-items:flex-start;gap:10px;padding:8px 0;border-bottom:1px solid var(--sg-border)}
|
|
3291
|
+
.sg-leg:last-child{border-bottom:none}
|
|
3292
|
+
/* The step number doubles as the rail: a pseudo-element joins consecutive orders, so two legs read as
|
|
3293
|
+
one continuous path rather than as two unrelated rows. */
|
|
3294
|
+
.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}
|
|
3295
|
+
.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)}
|
|
3296
|
+
.sg-leg-body{min-width:0;flex:1 1 auto}
|
|
3297
|
+
.sg-leg-line{display:flex;align-items:center;gap:7px;flex-wrap:wrap;font-size:13px;font-weight:600}
|
|
3298
|
+
.sg-leg-arrow{display:inline-flex;color:var(--sg-text-muted)}
|
|
3299
|
+
.sg-leg-sub{margin-top:2px;font-size:11.5px;color:var(--sg-text-muted);line-height:1.45}
|
|
3300
|
+
|
|
2702
3301
|
/* transaction detail: copyable hash row (no external links \u2014 everything stays in-widget) */
|
|
2703
3302
|
.sg-txd-hash{display:flex;align-items:center;gap:8px;margin-top:12px;font-size:13px}
|
|
2704
3303
|
.sg-txd-hash .sg-mono{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
@@ -2849,6 +3448,98 @@ img.sg-tok-badge{width:16px;padding:0;object-fit:cover;background:var(--sg-bg)}
|
|
|
2849
3448
|
.sg-island .sg-spinner{display:none!important}
|
|
2850
3449
|
.sg-island .sg-rm-dot{display:inline-block}
|
|
2851
3450
|
}
|
|
3451
|
+
|
|
3452
|
+
/* \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
|
|
3453
|
+
Mirrors the dApp's compliance row + details dialog. The row is a quiet affordance in the payment
|
|
3454
|
+
summary; the details open a sheet that fills the widget's own card, because a page-level modal
|
|
3455
|
+
inside somebody else's checkout is a z-index fight we would lose.
|
|
3456
|
+
|
|
3457
|
+
Tone note, carried over from the dApp: a PASS reads in body ink, not in green. The shield tick is
|
|
3458
|
+
already green, so colouring the sentence too says the same thing twice and spends the accent on
|
|
3459
|
+
the half that carries no information. A DENY still shouts. */
|
|
3460
|
+
/* NOT positioned. The sheet is inset:0 against the WIDGET CARD, so this wrapper must not become
|
|
3461
|
+
the containing block: when it carried position:relative the sheet collapsed to the height of
|
|
3462
|
+
this one row and drew straight through the CTA beneath it.
|
|
3463
|
+
NB this stylesheet is a JS template literal - never write a backtick in these comments. */
|
|
3464
|
+
.sg-cp{margin-top:10px}
|
|
3465
|
+
.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}
|
|
3466
|
+
.sg-cp-row:hover{border-color:color-mix(in srgb,var(--sg-accent) 40%,var(--sg-border))}
|
|
3467
|
+
.sg-cp-row:focus-visible{outline:2px solid var(--sg-accent);outline-offset:2px}
|
|
3468
|
+
.sg-cp-row-main{display:flex;align-items:center;gap:8px;min-width:0}
|
|
3469
|
+
.sg-cp-row-glyph{display:flex;flex:0 0 auto;color:var(--sg-success)}
|
|
3470
|
+
.sg-cp-row[data-tone="neutral"] .sg-cp-row-glyph{color:var(--sg-text-muted);opacity:.55}
|
|
3471
|
+
.sg-cp-row[data-tone="blocked"] .sg-cp-row-glyph,.sg-cp-row[data-tone="warn"] .sg-cp-row-glyph{color:var(--sg-danger)}
|
|
3472
|
+
.sg-cp-row-label{font-size:13px;font-weight:500;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
3473
|
+
.sg-cp-row[data-tone="neutral"] .sg-cp-row-label{color:var(--sg-text-muted)}
|
|
3474
|
+
.sg-cp-row[data-tone="blocked"] .sg-cp-row-label,.sg-cp-row[data-tone="warn"] .sg-cp-row-label{color:var(--sg-danger)}
|
|
3475
|
+
.sg-cp-row-chev{display:flex;flex:0 0 auto;color:var(--sg-text-muted)}
|
|
3476
|
+
.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)}
|
|
3477
|
+
|
|
3478
|
+
/* the sheet \u2014 fills the widget card */
|
|
3479
|
+
.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}
|
|
3480
|
+
@keyframes sg-cp-in{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}
|
|
3481
|
+
.sg-cp-sheet:focus{outline:none}
|
|
3482
|
+
.sg-cp-sheet-head{display:flex;align-items:center;justify-content:space-between;gap:8px;flex:0 0 auto}
|
|
3483
|
+
.sg-cp-sheet-title{margin:0;font-size:15px;font-weight:600}
|
|
3484
|
+
.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}
|
|
3485
|
+
.sg-cp-close:hover{background:var(--sg-surface);color:var(--sg-text)}
|
|
3486
|
+
.sg-cp-close:focus-visible{outline:2px solid var(--sg-accent);outline-offset:2px}
|
|
3487
|
+
.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}
|
|
3488
|
+
.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}
|
|
3489
|
+
.sg-cp-tab[data-active="true"]{background:color-mix(in srgb,var(--sg-accent) 10%,transparent);color:var(--sg-accent)}
|
|
3490
|
+
.sg-cp-tab:focus-visible{outline:2px solid var(--sg-accent);outline-offset:-2px}
|
|
3491
|
+
.sg-cp-sheet-body{margin-top:10px}
|
|
3492
|
+
.sg-cp-tabpanel{display:flex;flex-direction:column;gap:8px}
|
|
3493
|
+
|
|
3494
|
+
/* cards */
|
|
3495
|
+
.sg-cp-card{display:flex;flex-direction:column;gap:12px;padding:14px;border:1px solid var(--sg-border);border-radius:16px}
|
|
3496
|
+
.sg-cp-card-head{display:flex;align-items:center;gap:8px}
|
|
3497
|
+
.sg-cp-card-glyph{display:flex;flex:0 0 auto;color:var(--sg-accent)}
|
|
3498
|
+
.sg-cp-card-title{margin:0;font-size:14px;font-weight:600}
|
|
3499
|
+
.sg-cp-summary{display:flex;flex-direction:column;gap:3px}
|
|
3500
|
+
.sg-cp-summary-head{display:flex;align-items:center;gap:8px;color:var(--sg-success)}
|
|
3501
|
+
.sg-cp-summary-head[data-tone="neutral"]{color:var(--sg-text-muted)}
|
|
3502
|
+
.sg-cp-summary-head[data-tone="blocked"],.sg-cp-summary-head[data-tone="warn"]{color:var(--sg-danger)}
|
|
3503
|
+
.sg-cp-summary-title{font-size:14px;font-weight:600;color:var(--sg-text)}
|
|
3504
|
+
.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)}
|
|
3505
|
+
.sg-cp-summary-sub{margin:0;padding-left:24px;font-size:12px;line-height:1.35;color:var(--sg-text-muted)}
|
|
3506
|
+
|
|
3507
|
+
/* per-control rows */
|
|
3508
|
+
.sg-cp-checks{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:11px}
|
|
3509
|
+
.sg-cp-check-head{display:flex;flex-wrap:wrap;align-items:center;gap:6px 14px}
|
|
3510
|
+
.sg-cp-check-label{display:flex;align-items:center;gap:8px;min-width:0;font-size:13.5px;line-height:1.25}
|
|
3511
|
+
.sg-cp-check[data-ok="false"] .sg-cp-check-label{color:var(--sg-danger)}
|
|
3512
|
+
.sg-cp-check-mark{display:flex;flex:0 0 auto;color:var(--sg-success)}
|
|
3513
|
+
.sg-cp-check-mark[data-ok="false"]{color:var(--sg-danger)}
|
|
3514
|
+
.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}
|
|
3515
|
+
.sg-cp-check-reason{color:var(--sg-danger)}
|
|
3516
|
+
.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}
|
|
3517
|
+
.sg-cp-link:hover{text-decoration:underline}
|
|
3518
|
+
.sg-cp-link:focus-visible{outline:2px solid var(--sg-accent);outline-offset:2px;border-radius:4px}
|
|
3519
|
+
.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)}
|
|
3520
|
+
.sg-cp-scope{margin:0;font-size:11.5px;line-height:1.45;color:var(--sg-text-muted)}
|
|
3521
|
+
.sg-cp-flags{margin:0;font-size:13px}
|
|
3522
|
+
|
|
3523
|
+
/* quote details */
|
|
3524
|
+
.sg-cp-facts{margin:0;display:flex;flex-direction:column;gap:9px}
|
|
3525
|
+
.sg-cp-fact{display:grid;grid-template-columns:78px minmax(0,1fr);align-items:center;gap:10px}
|
|
3526
|
+
.sg-cp-fact dt{font-size:12px;color:var(--sg-text-muted)}
|
|
3527
|
+
.sg-cp-fact dd{margin:0;font-size:13px;min-width:0;overflow-wrap:anywhere}
|
|
3528
|
+
|
|
3529
|
+
/* screening policy */
|
|
3530
|
+
.sg-cp-policy-head{display:flex;flex-wrap:wrap;align-items:flex-start;justify-content:space-between;gap:8px;padding-bottom:2px}
|
|
3531
|
+
.sg-cp-policy-id{font-size:11px;color:var(--sg-text-muted);overflow-wrap:anywhere}
|
|
3532
|
+
.sg-cp-policy-facts{padding:2px 0 8px}
|
|
3533
|
+
.sg-cp-buckets{display:flex;flex-direction:column;gap:8px}
|
|
3534
|
+
.sg-cp-bucket{gap:10px;padding:12px 14px}
|
|
3535
|
+
.sg-cp-bucket-head{display:flex;flex-wrap:wrap;align-items:baseline;justify-content:space-between;gap:4px 10px}
|
|
3536
|
+
.sg-cp-bucket-detail{font-size:11.5px;color:var(--sg-text-muted)}
|
|
3537
|
+
.sg-cp-cats{list-style:none;margin:0;padding:0 0 0 4px;display:flex;flex-direction:column;gap:5px}
|
|
3538
|
+
.sg-cp-cats li{display:flex;align-items:center;gap:10px;font-size:12.5px;line-height:1.35}
|
|
3539
|
+
.sg-cp-dot{flex:0 0 auto;width:4px;height:4px;border-radius:999px;background:var(--sg-accent);opacity:.8}
|
|
3540
|
+
|
|
3541
|
+
/* express (PaymentIsland) trims the card padding, so the sheet follows */
|
|
3542
|
+
@media (prefers-reduced-motion:reduce){.sg-cp-sheet{animation:none}}
|
|
2852
3543
|
`;
|
|
2853
3544
|
var injected = false;
|
|
2854
3545
|
function injectStyles() {
|
|
@@ -2996,13 +3687,13 @@ function WidgetShell(props) {
|
|
|
2996
3687
|
] })
|
|
2997
3688
|
] }),
|
|
2998
3689
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-body", children: props.children }),
|
|
2999
|
-
/* @__PURE__ */ jsxRuntime.
|
|
3690
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-foot", children: /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
3000
3691
|
/* @__PURE__ */ jsxRuntime.jsx(LockGlyph, {}),
|
|
3001
3692
|
" Your wallet signs every transaction \xB7 Powered by ZeroDelta"
|
|
3002
|
-
] })
|
|
3693
|
+
] }) })
|
|
3003
3694
|
] });
|
|
3004
3695
|
}
|
|
3005
|
-
function
|
|
3696
|
+
function shortAddress2(a) {
|
|
3006
3697
|
if (!a) return "";
|
|
3007
3698
|
return `${a.slice(0, 6)}\u2026${a.slice(-4)}`;
|
|
3008
3699
|
}
|
|
@@ -3214,6 +3905,251 @@ function RouteList(props) {
|
|
|
3214
3905
|
] }) : null
|
|
3215
3906
|
] });
|
|
3216
3907
|
}
|
|
3908
|
+
function ShieldTick({ 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("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" }),
|
|
3911
|
+
/* @__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" }),
|
|
3912
|
+
/* @__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" })
|
|
3913
|
+
] });
|
|
3914
|
+
}
|
|
3915
|
+
function TickCircle({ size = 16 }) {
|
|
3916
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: [
|
|
3917
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "12", r: "10", fill: "currentColor" }),
|
|
3918
|
+
/* @__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" })
|
|
3919
|
+
] });
|
|
3920
|
+
}
|
|
3921
|
+
function CloseCircle({ size = 16 }) {
|
|
3922
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: [
|
|
3923
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "12", r: "10", fill: "currentColor" }),
|
|
3924
|
+
/* @__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" })
|
|
3925
|
+
] });
|
|
3926
|
+
}
|
|
3927
|
+
function PendingCircle({ size = 16 }) {
|
|
3928
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: [
|
|
3929
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "12", r: "9.2", stroke: "currentColor", strokeWidth: "1.6", strokeDasharray: "3 3" }),
|
|
3930
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M8.5 12h7", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round" })
|
|
3931
|
+
] });
|
|
3932
|
+
}
|
|
3933
|
+
function Tick({ size = 12 }) {
|
|
3934
|
+
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" }) });
|
|
3935
|
+
}
|
|
3936
|
+
function Cross({ size = 12 }) {
|
|
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: "m5.5 5.5 13 13M18.5 5.5l-13 13", stroke: "currentColor", strokeWidth: "3", strokeLinecap: "round" }) });
|
|
3938
|
+
}
|
|
3939
|
+
function Chevron({ size = 16 }) {
|
|
3940
|
+
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" }) });
|
|
3941
|
+
}
|
|
3942
|
+
function Info({ size = 16 }) {
|
|
3943
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: [
|
|
3944
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "12", r: "10", fill: "currentColor" }),
|
|
3945
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 10.6v6", stroke: "var(--sg-bg)", strokeWidth: "2.1", strokeLinecap: "round" }),
|
|
3946
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "7.6", r: "1.25", fill: "var(--sg-bg)" })
|
|
3947
|
+
] });
|
|
3948
|
+
}
|
|
3949
|
+
function Lock({ size = 16 }) {
|
|
3950
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: [
|
|
3951
|
+
/* @__PURE__ */ jsxRuntime.jsx("rect", { x: "4.5", y: "10.5", width: "15", height: "9.5", rx: "2.2", stroke: "currentColor", strokeWidth: "1.7" }),
|
|
3952
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M8 10.5V7.8a4 4 0 0 1 8 0v2.7", stroke: "currentColor", strokeWidth: "1.7", strokeLinecap: "round" })
|
|
3953
|
+
] });
|
|
3954
|
+
}
|
|
3955
|
+
function ShieldOutline({ size = 16 }) {
|
|
3956
|
+
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" }) });
|
|
3957
|
+
}
|
|
3958
|
+
function WarningFilled({ size = 16 }) {
|
|
3959
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: [
|
|
3960
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 3.2 21.4 19.4H2.6L12 3.2Z", fill: "currentColor" }),
|
|
3961
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 9.4v4.3", stroke: "var(--sg-bg)", strokeWidth: "1.9", strokeLinecap: "round" }),
|
|
3962
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "16.4", r: "1.05", fill: "var(--sg-bg)" })
|
|
3963
|
+
] });
|
|
3964
|
+
}
|
|
3965
|
+
function CornerArrow({ size = 12 }) {
|
|
3966
|
+
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" }) });
|
|
3967
|
+
}
|
|
3968
|
+
var POLICY_GLYPH = {
|
|
3969
|
+
"always-blocked": Lock,
|
|
3970
|
+
blocked: ShieldOutline,
|
|
3971
|
+
flagged: WarningFilled
|
|
3972
|
+
};
|
|
3973
|
+
var POLICY_DETAIL = {
|
|
3974
|
+
"always-blocked": "Cannot be changed or disabled",
|
|
3975
|
+
blocked: "Stops the payment",
|
|
3976
|
+
flagged: "Does not automatically block"
|
|
3977
|
+
};
|
|
3978
|
+
function shortAddr(a) {
|
|
3979
|
+
return a.length > 14 ? `${a.slice(0, 6)}\u2026${a.slice(-4)}` : a;
|
|
3980
|
+
}
|
|
3981
|
+
function TriggerGlyph({ cv }) {
|
|
3982
|
+
if (cv.tone === "blocked" || cv.tone === "warn") return /* @__PURE__ */ jsxRuntime.jsx(CloseCircle, {});
|
|
3983
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ShieldTick, {});
|
|
3984
|
+
}
|
|
3985
|
+
function CheckRow({ check, onViewPolicy }) {
|
|
3986
|
+
const label = check.id === "risk" ? check.ok ? "Risk screening passed" : "Risk screening failed" : check.label;
|
|
3987
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("li", { className: "sg-cp-check", "data-ok": check.ok, children: [
|
|
3988
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-check-head", children: [
|
|
3989
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-cp-check-label", children: [
|
|
3990
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-check-mark", "data-ok": check.ok, children: check.ok ? /* @__PURE__ */ jsxRuntime.jsx(Tick, {}) : /* @__PURE__ */ jsxRuntime.jsx(Cross, {}) }),
|
|
3991
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: label }),
|
|
3992
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-sr-only", children: check.ok ? " \u2014 passed" : " \u2014 failed" })
|
|
3993
|
+
] }),
|
|
3994
|
+
check.id === "risk" ? /* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", className: "sg-cp-link", onClick: onViewPolicy, children: [
|
|
3995
|
+
"View policy",
|
|
3996
|
+
/* @__PURE__ */ jsxRuntime.jsx(CornerArrow, {})
|
|
3997
|
+
] }) : null
|
|
3998
|
+
] }),
|
|
3999
|
+
check.note ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-check-note", children: check.note }) : null,
|
|
4000
|
+
check.reasons.map((reason) => /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-check-reason", children: humanizeComplianceReason(reason) }, reason))
|
|
4001
|
+
] });
|
|
4002
|
+
}
|
|
4003
|
+
function QuoteChecks({
|
|
4004
|
+
compliance,
|
|
4005
|
+
cv,
|
|
4006
|
+
checks,
|
|
4007
|
+
direct,
|
|
4008
|
+
onViewPolicy
|
|
4009
|
+
}) {
|
|
4010
|
+
const allPassed = cv.tone === "ok" && checks.length > 0 && checks.every((c) => c.ok);
|
|
4011
|
+
const summary = allPassed ? "All checks passed" : cv.label;
|
|
4012
|
+
const orphans = unattributedComplianceReasons(compliance, cv);
|
|
4013
|
+
const wallets = distinctScreenedWallets(compliance);
|
|
4014
|
+
const jurisdiction = compliance?.sourceJurisdiction?.trim();
|
|
4015
|
+
const hasDetails = Boolean(jurisdiction || wallets.length || compliance?.checkId);
|
|
4016
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-tabpanel", role: "tabpanel", "aria-label": "Quote checks", children: [
|
|
4017
|
+
/* @__PURE__ */ jsxRuntime.jsxs("section", { className: "sg-cp-card", children: [
|
|
4018
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-summary", children: [
|
|
4019
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-cp-summary-head", "data-tone": cv.tone, children: [
|
|
4020
|
+
cv.tone === "blocked" || cv.tone === "warn" ? /* @__PURE__ */ jsxRuntime.jsx(CloseCircle, {}) : cv.tone === "neutral" ? /* @__PURE__ */ jsxRuntime.jsx(PendingCircle, {}) : /* @__PURE__ */ jsxRuntime.jsx(TickCircle, {}),
|
|
4021
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-summary-title", children: summary })
|
|
4022
|
+
] }),
|
|
4023
|
+
checks.length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "sg-cp-summary-sub", children: [
|
|
4024
|
+
checks.length,
|
|
4025
|
+
" check",
|
|
4026
|
+
checks.length === 1 ? " was" : "s were",
|
|
4027
|
+
" completed for this payment"
|
|
4028
|
+
] }) : (
|
|
4029
|
+
// No decision was issued. Listing the controls here would be ticks for a verdict nobody
|
|
4030
|
+
// gave, and an unconfigured gate is not a set of passed checks.
|
|
4031
|
+
/* @__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." })
|
|
4032
|
+
)
|
|
4033
|
+
] }),
|
|
4034
|
+
checks.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "sg-cp-checks", children: checks.map((check) => /* @__PURE__ */ jsxRuntime.jsx(CheckRow, { check, onViewPolicy }, check.id)) }) : null,
|
|
4035
|
+
orphans.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "sg-cp-orphans", children: orphans.map((reason) => /* @__PURE__ */ jsxRuntime.jsx("li", { children: humanizeComplianceReason(reason) }, reason)) }) : null,
|
|
4036
|
+
direct && checks.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "sg-cp-scope", children: DIRECT_SCOPE_NOTE }) : null
|
|
4037
|
+
] }),
|
|
4038
|
+
compliance?.flaggedCategories?.length ? /* @__PURE__ */ jsxRuntime.jsxs("section", { className: "sg-cp-card", children: [
|
|
4039
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-card-head", children: [
|
|
4040
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-card-glyph", children: /* @__PURE__ */ jsxRuntime.jsx(WarningFilled, {}) }),
|
|
4041
|
+
/* @__PURE__ */ jsxRuntime.jsx("h5", { className: "sg-cp-card-title", children: "Flagged, not blocking" })
|
|
4042
|
+
] }),
|
|
4043
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "sg-cp-flags", children: compliance.flaggedCategories.map(categoryLabel).join(" \xB7 ") }),
|
|
4044
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "sg-cp-scope", children: "The policy records these and still allows the payment. They do not stop settlement." })
|
|
4045
|
+
] }) : null,
|
|
4046
|
+
hasDetails ? /* @__PURE__ */ jsxRuntime.jsxs("section", { className: "sg-cp-card", children: [
|
|
4047
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-card-head", children: [
|
|
4048
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-card-glyph", children: /* @__PURE__ */ jsxRuntime.jsx(Info, {}) }),
|
|
4049
|
+
/* @__PURE__ */ jsxRuntime.jsx("h5", { className: "sg-cp-card-title", children: "Quote details" })
|
|
4050
|
+
] }),
|
|
4051
|
+
/* @__PURE__ */ jsxRuntime.jsxs("dl", { className: "sg-cp-facts", children: [
|
|
4052
|
+
jurisdiction ? /* @__PURE__ */ jsxRuntime.jsx(Fact, { label: "Jurisdiction", value: jurisdiction }) : null,
|
|
4053
|
+
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)),
|
|
4054
|
+
compliance?.checkId ? /* @__PURE__ */ jsxRuntime.jsx(Fact, { label: "Check ID", value: compliance.checkId, mono: true }) : null
|
|
4055
|
+
] })
|
|
4056
|
+
] }) : null
|
|
4057
|
+
] });
|
|
4058
|
+
}
|
|
4059
|
+
function Fact({ label, value, title, mono = false }) {
|
|
4060
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-fact", children: [
|
|
4061
|
+
/* @__PURE__ */ jsxRuntime.jsx("dt", { children: label }),
|
|
4062
|
+
/* @__PURE__ */ jsxRuntime.jsx("dd", { title, className: mono ? "sg-mono" : void 0, children: value })
|
|
4063
|
+
] });
|
|
4064
|
+
}
|
|
4065
|
+
function ScreeningPolicy({ compliance }) {
|
|
4066
|
+
const policyId = compliance?.policyVersion?.trim();
|
|
4067
|
+
const applied = Boolean(compliance?.decision || policyId || compliance?.appliedPolicyNames?.length);
|
|
4068
|
+
const names = [...compliance?.appliedPolicyNames ?? [], ...compliance?.appliedLegislation ?? []];
|
|
4069
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-tabpanel", role: "tabpanel", "aria-label": "Screening policy", children: [
|
|
4070
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-policy-head", children: [
|
|
4071
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-summary", children: [
|
|
4072
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-cp-summary-head", "data-tone": applied ? "ok" : "neutral", children: [
|
|
4073
|
+
applied ? /* @__PURE__ */ jsxRuntime.jsx(TickCircle, {}) : /* @__PURE__ */ jsxRuntime.jsx(PendingCircle, {}),
|
|
4074
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-summary-title", children: "Transaction screening policy" })
|
|
4075
|
+
] }),
|
|
4076
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "sg-cp-summary-sub", children: applied ? "Applied to this payment" : "No policy decision was returned" })
|
|
4077
|
+
] }),
|
|
4078
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-policy-id sg-mono", children: policyId ? `Policy ${policyId}` : "Policy ID unavailable" })
|
|
4079
|
+
] }),
|
|
4080
|
+
names.length ? /* @__PURE__ */ jsxRuntime.jsxs("dl", { className: "sg-cp-facts sg-cp-policy-facts", children: [
|
|
4081
|
+
compliance?.appliedPolicyNames?.length ? /* @__PURE__ */ jsxRuntime.jsx(Fact, { label: "Policy", value: compliance.appliedPolicyNames.join(", ") }) : null,
|
|
4082
|
+
compliance?.appliedLegislation?.length ? /* @__PURE__ */ jsxRuntime.jsx(Fact, { label: "Legislation", value: compliance.appliedLegislation.join(", ") }) : null
|
|
4083
|
+
] }) : null,
|
|
4084
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-cp-buckets", children: SCREENING_BUCKETS.map((bucket) => {
|
|
4085
|
+
const Glyph = POLICY_GLYPH[bucket.outcome];
|
|
4086
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("section", { className: "sg-cp-card sg-cp-bucket", children: [
|
|
4087
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-bucket-head", children: [
|
|
4088
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-cp-card-head", children: [
|
|
4089
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-card-glyph", children: /* @__PURE__ */ jsxRuntime.jsx(Glyph, {}) }),
|
|
4090
|
+
/* @__PURE__ */ jsxRuntime.jsx("h5", { className: "sg-cp-card-title", children: bucket.title })
|
|
4091
|
+
] }),
|
|
4092
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-bucket-detail", children: POLICY_DETAIL[bucket.outcome] })
|
|
4093
|
+
] }),
|
|
4094
|
+
/* @__PURE__ */ jsxRuntime.jsx("ul", { className: "sg-cp-cats", children: bucket.categories.map((category) => /* @__PURE__ */ jsxRuntime.jsxs("li", { children: [
|
|
4095
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-dot", "aria-hidden": "true" }),
|
|
4096
|
+
category
|
|
4097
|
+
] }, category)) })
|
|
4098
|
+
] }, bucket.outcome);
|
|
4099
|
+
}) })
|
|
4100
|
+
] });
|
|
4101
|
+
}
|
|
4102
|
+
function CompliancePanel(props) {
|
|
4103
|
+
const [open, setOpen] = react.useState(false);
|
|
4104
|
+
const [tab, setTab] = react.useState("checks");
|
|
4105
|
+
const triggerRef = react.useRef(null);
|
|
4106
|
+
const sheetRef = react.useRef(null);
|
|
4107
|
+
const compliance = props.compliance ?? null;
|
|
4108
|
+
const cv = complianceView(compliance, props.hasQuote ?? true);
|
|
4109
|
+
const allChecks = complianceChecks(compliance, cv);
|
|
4110
|
+
const checks = props.direct ? allChecks.filter((c) => DIRECT_CHECK_IDS.includes(c.id)) : allChecks;
|
|
4111
|
+
const tag = complianceTagOf(compliance);
|
|
4112
|
+
react.useEffect(() => {
|
|
4113
|
+
if (!open) return;
|
|
4114
|
+
sheetRef.current?.focus();
|
|
4115
|
+
const onKey = (e) => {
|
|
4116
|
+
if (e.key === "Escape") {
|
|
4117
|
+
e.stopPropagation();
|
|
4118
|
+
setOpen(false);
|
|
4119
|
+
triggerRef.current?.focus();
|
|
4120
|
+
}
|
|
4121
|
+
};
|
|
4122
|
+
document.addEventListener("keydown", onKey, true);
|
|
4123
|
+
return () => document.removeEventListener("keydown", onKey, true);
|
|
4124
|
+
}, [open]);
|
|
4125
|
+
const close = () => {
|
|
4126
|
+
setOpen(false);
|
|
4127
|
+
triggerRef.current?.focus();
|
|
4128
|
+
};
|
|
4129
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp", "data-tone": cv.tone, children: [
|
|
4130
|
+
open ? null : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4131
|
+
/* @__PURE__ */ jsxRuntime.jsxs("button", { ref: triggerRef, type: "button", className: "sg-cp-row", "data-tone": cv.tone, onClick: () => setOpen(true), "aria-haspopup": "dialog", children: [
|
|
4132
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-cp-row-main", children: [
|
|
4133
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-row-glyph", children: /* @__PURE__ */ jsxRuntime.jsx(TriggerGlyph, { cv }) }),
|
|
4134
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-row-label", children: cv.label })
|
|
4135
|
+
] }),
|
|
4136
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-row-chev", children: /* @__PURE__ */ jsxRuntime.jsx(Chevron, {}) })
|
|
4137
|
+
] }),
|
|
4138
|
+
(cv.blocked || cv.needsAction) && tag ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-row-tag sg-mono", children: tag }) : null
|
|
4139
|
+
] }),
|
|
4140
|
+
open ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-sheet", role: "dialog", "aria-modal": "true", "aria-label": "Compliance details", ref: sheetRef, tabIndex: -1, children: [
|
|
4141
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-sheet-head", children: [
|
|
4142
|
+
/* @__PURE__ */ jsxRuntime.jsx("h4", { className: "sg-cp-sheet-title", children: "Compliance details" }),
|
|
4143
|
+
/* @__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" }) }) })
|
|
4144
|
+
] }),
|
|
4145
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-tabs", role: "tablist", "aria-label": "Compliance details sections", children: [
|
|
4146
|
+
/* @__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" }),
|
|
4147
|
+
/* @__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" })
|
|
4148
|
+
] }),
|
|
4149
|
+
/* @__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 }) })
|
|
4150
|
+
] }) : null
|
|
4151
|
+
] });
|
|
4152
|
+
}
|
|
3217
4153
|
|
|
3218
4154
|
// src/react/ui/chain-logos.ts
|
|
3219
4155
|
var BUNDLED_CHAIN_LOGO = {
|
|
@@ -3250,9 +4186,15 @@ var BUNDLED_TOKEN_LOGO = {
|
|
|
3250
4186
|
function isHttpsUrl(u) {
|
|
3251
4187
|
return typeof u === "string" && /^https:\/\//i.test(u);
|
|
3252
4188
|
}
|
|
4189
|
+
function isSameOriginPath2(u) {
|
|
4190
|
+
return typeof u === "string" && u.startsWith("/") && !u.startsWith("//") && !u.startsWith("/\\");
|
|
4191
|
+
}
|
|
4192
|
+
function isDisplayableImageSrc(u) {
|
|
4193
|
+
return isHttpsUrl(u) || isSameOriginPath2(u);
|
|
4194
|
+
}
|
|
3253
4195
|
function tokenLogoCandidates(symbol, logoUrl) {
|
|
3254
4196
|
const out = [];
|
|
3255
|
-
if (
|
|
4197
|
+
if (isDisplayableImageSrc(logoUrl)) out.push(logoUrl);
|
|
3256
4198
|
const bundled = BUNDLED_TOKEN_LOGO[symbolKey(symbol)];
|
|
3257
4199
|
if (bundled && !out.includes(bundled)) out.push(bundled);
|
|
3258
4200
|
return out;
|
|
@@ -3299,7 +4241,7 @@ function TokenTile(props) {
|
|
|
3299
4241
|
const shown = props.token?.symbol ?? props.pick?.symbol ?? "";
|
|
3300
4242
|
const glyph = props.pick ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
3301
4243
|
/* @__PURE__ */ jsxRuntime.jsx(TokenGlyph, { symbol: props.pick.symbol, logoUrl: props.token?.logoUrl, chainId: props.pick.chainId }),
|
|
3302
|
-
/* @__PURE__ */ jsxRuntime.jsxs("span", {
|
|
4244
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-tile-text", children: [
|
|
3303
4245
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-tile-sym", children: shown }),
|
|
3304
4246
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-tile-chain", children: CHAIN_LABELS[props.pick.chainId] || `Chain ${props.pick.chainId}` })
|
|
3305
4247
|
] })
|
|
@@ -3487,6 +4429,59 @@ function HistoryButton(props) {
|
|
|
3487
4429
|
function chainLabel(entry) {
|
|
3488
4430
|
return entry.chainId != null && CHAIN_LABELS[entry.chainId] || entry.chainName || (entry.chainId != null ? `Chain ${entry.chainId}` : "Unknown chain");
|
|
3489
4431
|
}
|
|
4432
|
+
function chainName(chainId, fallback) {
|
|
4433
|
+
return CHAIN_LABELS[chainId] || fallback || (chainId ? `Chain ${chainId}` : "Unknown chain");
|
|
4434
|
+
}
|
|
4435
|
+
function legsOf(entry) {
|
|
4436
|
+
if (entry.legs?.length) return entry.legs;
|
|
4437
|
+
const leg = {
|
|
4438
|
+
index: 1,
|
|
4439
|
+
fromAsset: entry.fromAsset,
|
|
4440
|
+
fromChainId: entry.chainId ?? 0,
|
|
4441
|
+
fromChainName: entry.chainName,
|
|
4442
|
+
fromAmount: entry.payAmount,
|
|
4443
|
+
toAsset: entry.toAsset,
|
|
4444
|
+
toChainId: 0,
|
|
4445
|
+
toChainName: "",
|
|
4446
|
+
toAmount: entry.receiveAmount,
|
|
4447
|
+
executionChainId: 0,
|
|
4448
|
+
executionChainName: ""
|
|
4449
|
+
};
|
|
4450
|
+
return [leg];
|
|
4451
|
+
}
|
|
4452
|
+
function ordersLabel(count) {
|
|
4453
|
+
return count === 1 ? "1 order" : `${count} orders`;
|
|
4454
|
+
}
|
|
4455
|
+
function LegArrowGlyph() {
|
|
4456
|
+
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: [
|
|
4457
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M5 12h14" }),
|
|
4458
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "m13 6 6 6-6 6" })
|
|
4459
|
+
] });
|
|
4460
|
+
}
|
|
4461
|
+
function TxLegs(props) {
|
|
4462
|
+
const multi = props.legs.length > 1;
|
|
4463
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-legs", "data-multi": multi || void 0, children: [
|
|
4464
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-legs-head", children: [
|
|
4465
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-meta-label", children: "Route" }),
|
|
4466
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-badge", children: ordersLabel(props.legs.length) })
|
|
4467
|
+
] }),
|
|
4468
|
+
/* @__PURE__ */ jsxRuntime.jsx("ol", { className: "sg-leg-list", children: props.legs.map((leg) => /* @__PURE__ */ jsxRuntime.jsxs("li", { className: "sg-leg", children: [
|
|
4469
|
+
multi ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-leg-n", "aria-hidden": "true", children: leg.index }) : null,
|
|
4470
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-leg-body", children: [
|
|
4471
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-leg-line", children: [
|
|
4472
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-mono", children: `${leg.fromAmount ? `${leg.fromAmount} ` : ""}${leg.fromAsset || "\u2014"}` }),
|
|
4473
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-leg-arrow", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx(LegArrowGlyph, {}) }),
|
|
4474
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-mono", children: `${leg.toAmount ? `${leg.toAmount} ` : ""}${leg.toAsset || "\u2014"}` })
|
|
4475
|
+
] }),
|
|
4476
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-leg-sub", children: [
|
|
4477
|
+
chainName(leg.fromChainId, leg.fromChainName),
|
|
4478
|
+
leg.toChainId ? ` \u2192 ${chainName(leg.toChainId, leg.toChainName)}` : "",
|
|
4479
|
+
leg.executionChainId && leg.executionChainId !== leg.fromChainId ? ` \xB7 filled on ${chainName(leg.executionChainId, leg.executionChainName)}` : ""
|
|
4480
|
+
] })
|
|
4481
|
+
] })
|
|
4482
|
+
] }, `${leg.index}:${leg.fromChainId}:${leg.toChainId}`)) })
|
|
4483
|
+
] });
|
|
4484
|
+
}
|
|
3490
4485
|
function statusBadge(status) {
|
|
3491
4486
|
if (status === "confirmed")
|
|
3492
4487
|
return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-badge", "data-tone": "ok", children: "Confirmed" });
|
|
@@ -3496,40 +4491,73 @@ function statusBadge(status) {
|
|
|
3496
4491
|
}
|
|
3497
4492
|
function whenLabel(at) {
|
|
3498
4493
|
const d = new Date(at);
|
|
3499
|
-
|
|
4494
|
+
if (Number.isNaN(d.getTime())) return "";
|
|
4495
|
+
const sameYear = d.getFullYear() === (/* @__PURE__ */ new Date()).getFullYear();
|
|
4496
|
+
try {
|
|
4497
|
+
return d.toLocaleString(void 0, { day: "numeric", month: "short", year: sameYear ? void 0 : "numeric", hour: "2-digit", minute: "2-digit" });
|
|
4498
|
+
} catch {
|
|
4499
|
+
return d.toLocaleString();
|
|
4500
|
+
}
|
|
4501
|
+
}
|
|
4502
|
+
function endpoints(entry) {
|
|
4503
|
+
const legs = entry.legs;
|
|
4504
|
+
return {
|
|
4505
|
+
fromChainId: entry.chainId ?? legs?.[0]?.fromChainId ?? void 0,
|
|
4506
|
+
toChainId: legs?.length ? legs[legs.length - 1].toChainId || void 0 : void 0
|
|
4507
|
+
};
|
|
4508
|
+
}
|
|
4509
|
+
function TxPairGlyphs(props) {
|
|
4510
|
+
const e = props.entry;
|
|
4511
|
+
const { fromChainId, toChainId } = endpoints(e);
|
|
4512
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-txrow-glyphs", children: [
|
|
4513
|
+
/* @__PURE__ */ jsxRuntime.jsx(TokenGlyph, { symbol: e.fromAsset || "?", logoUrl: logoFor(props.art, e.fromAsset, fromChainId ?? null), chainId: fromChainId, size: "sm" }),
|
|
4514
|
+
/* @__PURE__ */ jsxRuntime.jsx(TokenGlyph, { symbol: e.toAsset || "?", logoUrl: logoFor(props.art, e.toAsset, toChainId ?? null), chainId: toChainId, size: "sm" })
|
|
4515
|
+
] });
|
|
4516
|
+
}
|
|
4517
|
+
function TxPair(props) {
|
|
4518
|
+
const e = props.entry;
|
|
4519
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-txrow-pair", children: [
|
|
4520
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-txrow-side sg-mono", children: `${e.payAmount} ${e.fromAsset}` }),
|
|
4521
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-txrow-side sg-mono", children: [
|
|
4522
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-txrow-arrow", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx(LegArrowGlyph, {}) }),
|
|
4523
|
+
`${e.receiveAmount} ${e.toAsset}`
|
|
4524
|
+
] })
|
|
4525
|
+
] });
|
|
3500
4526
|
}
|
|
3501
|
-
function logoFor(
|
|
3502
|
-
if (!tokens?.length) return void 0;
|
|
4527
|
+
function logoFor(art, symbol, chainId) {
|
|
3503
4528
|
const key = symbolKey(symbol);
|
|
3504
4529
|
if (!key) return void 0;
|
|
3505
|
-
const
|
|
3506
|
-
|
|
4530
|
+
const tokens = art.tokens;
|
|
4531
|
+
if (tokens?.length) {
|
|
4532
|
+
const sameChain = chainId == null ? void 0 : tokens.find((t) => Number(t.chainId) === chainId && symbolKey(t.symbol) === key);
|
|
4533
|
+
const found = (sameChain ?? tokens.find((t) => symbolKey(t.symbol) === key))?.logoUrl;
|
|
4534
|
+
if (found) return found;
|
|
4535
|
+
}
|
|
4536
|
+
return art.vaultIcons?.get(key);
|
|
3507
4537
|
}
|
|
3508
4538
|
function TxHistoryList(props) {
|
|
3509
4539
|
if (!props.entries.length) {
|
|
3510
4540
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-sel-empty", children: "No transactions yet \u2014 activity from this wallet will appear here." });
|
|
3511
4541
|
}
|
|
3512
|
-
return /* @__PURE__ */ jsxRuntime.jsx("section", { className: "sg-toklist", "aria-label": "Transaction history", children: props.entries.map((e) =>
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
"
|
|
3520
|
-
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
|
|
3525
|
-
|
|
3526
|
-
|
|
3527
|
-
|
|
3528
|
-
whenLabel(e.at) ? ` \xB7 ${whenLabel(e.at)}` : ""
|
|
4542
|
+
return /* @__PURE__ */ jsxRuntime.jsx("section", { className: "sg-toklist", "aria-label": "Transaction history", children: props.entries.map((e) => (
|
|
4543
|
+
// A GRID, not the picker's flex row: the meta line spans the badge column too, so at 390px it
|
|
4544
|
+
// has the full card width to wrap into instead of being ellipsised away to "…".
|
|
4545
|
+
/* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", className: "sg-txrow", onClick: () => props.onPick(e), children: [
|
|
4546
|
+
/* @__PURE__ */ jsxRuntime.jsx(TxPairGlyphs, { entry: e, art: props }),
|
|
4547
|
+
/* @__PURE__ */ jsxRuntime.jsx(TxPair, { entry: e }),
|
|
4548
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-txrow-meta", children: [
|
|
4549
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-txrow-when", children: [
|
|
4550
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-txrow-what", children: [
|
|
4551
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: e.kind === "payment" ? "Payment" : "Swap" }),
|
|
4552
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: chainLabel(e) }),
|
|
4553
|
+
(e.legs?.length ?? 1) > 1 ? /* @__PURE__ */ jsxRuntime.jsx("span", { children: ordersLabel(e.legs.length) }) : null
|
|
4554
|
+
] }),
|
|
4555
|
+
whenLabel(e.at) ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-txrow-time", children: whenLabel(e.at) }) : null
|
|
4556
|
+
] }),
|
|
4557
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-txrow-end", children: statusBadge(e.status) })
|
|
3529
4558
|
] })
|
|
3530
|
-
] })
|
|
3531
|
-
|
|
3532
|
-
] }, `${e.hash}:${e.at}`)) });
|
|
4559
|
+
] }, `${e.hash}:${e.at}`)
|
|
4560
|
+
)) });
|
|
3533
4561
|
}
|
|
3534
4562
|
function TxDetail(props) {
|
|
3535
4563
|
const e = props.entry;
|
|
@@ -3552,6 +4580,7 @@ function TxDetail(props) {
|
|
|
3552
4580
|
}
|
|
3553
4581
|
};
|
|
3554
4582
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-panel", children: [
|
|
4583
|
+
/* @__PURE__ */ jsxRuntime.jsx(TxPairGlyphs, { entry: e, art: props }),
|
|
3555
4584
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-anchor sg-mono", children: [
|
|
3556
4585
|
e.receiveAmount,
|
|
3557
4586
|
" ",
|
|
@@ -3561,6 +4590,7 @@ function TxDetail(props) {
|
|
|
3561
4590
|
e.kind === "payment" ? "Payment" : "Swap",
|
|
3562
4591
|
whenLabel(e.at) ? ` \xB7 ${whenLabel(e.at)}` : ""
|
|
3563
4592
|
] }),
|
|
4593
|
+
/* @__PURE__ */ jsxRuntime.jsx(TxLegs, { legs: legsOf(e) }),
|
|
3564
4594
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-meta", children: [
|
|
3565
4595
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-meta-row", children: [
|
|
3566
4596
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-meta-label", children: "Status" }),
|
|
@@ -3575,12 +4605,12 @@ function TxDetail(props) {
|
|
|
3575
4605
|
] })
|
|
3576
4606
|
] }),
|
|
3577
4607
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-meta-row", children: [
|
|
3578
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-meta-label", children: "
|
|
4608
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-meta-label", children: "Signed on" }),
|
|
3579
4609
|
/* @__PURE__ */ jsxRuntime.jsx("b", { children: chainLabel(e) })
|
|
3580
4610
|
] }),
|
|
3581
4611
|
e.recipient ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-meta-row", children: [
|
|
3582
4612
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-meta-label", children: "Recipient" }),
|
|
3583
|
-
/* @__PURE__ */ jsxRuntime.jsx("b", { className: "sg-mono", children:
|
|
4613
|
+
/* @__PURE__ */ jsxRuntime.jsx("b", { className: "sg-mono", children: shortAddress2(e.recipient) })
|
|
3584
4614
|
] }) : null,
|
|
3585
4615
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-meta-row", children: [
|
|
3586
4616
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-meta-label", children: "Settlement" }),
|
|
@@ -3594,14 +4624,17 @@ function TxDetail(props) {
|
|
|
3594
4624
|
] })
|
|
3595
4625
|
] });
|
|
3596
4626
|
}
|
|
3597
|
-
function displayableHistory(entries) {
|
|
3598
|
-
|
|
4627
|
+
function displayableHistory(entries, account) {
|
|
4628
|
+
const owner = typeof account === "string" ? account.toLowerCase() : "";
|
|
4629
|
+
return entries.filter((e) => e.txKind !== "approve" && (!e.account || !owner || e.account.toLowerCase() === owner));
|
|
3599
4630
|
}
|
|
3600
4631
|
function TxHistoryPanel(props) {
|
|
3601
|
-
const
|
|
3602
|
-
const
|
|
4632
|
+
const account = props.account;
|
|
4633
|
+
const entries = displayableHistory(useTxHistory(account), account);
|
|
4634
|
+
const deepLink = props.initialEntry && displayableHistory([props.initialEntry], account).length ? props.initialEntry : null;
|
|
4635
|
+
const [selected, setSelected] = react.useState(deepLink);
|
|
3603
4636
|
const backRef = react.useRef(null);
|
|
3604
|
-
react.useEffect(() => setSelected(
|
|
4637
|
+
react.useEffect(() => setSelected(deepLink), [deepLink]);
|
|
3605
4638
|
const pick = (entry) => {
|
|
3606
4639
|
setSelected(entry);
|
|
3607
4640
|
requestAnimationFrame(() => backRef.current?.focus());
|
|
@@ -3609,9 +4642,12 @@ function TxHistoryPanel(props) {
|
|
|
3609
4642
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
3610
4643
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-sel-head", children: [
|
|
3611
4644
|
/* @__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, {}) }),
|
|
3612
|
-
/* @__PURE__ */ jsxRuntime.
|
|
4645
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-sel-title", children: [
|
|
4646
|
+
selected ? "Transaction" : "Transaction history",
|
|
4647
|
+
account ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-sel-sub sg-mono", children: shortAddress2(account) }) : null
|
|
4648
|
+
] })
|
|
3613
4649
|
] }),
|
|
3614
|
-
selected ? /* @__PURE__ */ jsxRuntime.jsx(TxDetail, { entry: selected }) : /* @__PURE__ */ jsxRuntime.jsx(TxHistoryList, { entries, tokens: props.tokens, onPick: pick })
|
|
4650
|
+
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 })
|
|
3615
4651
|
] });
|
|
3616
4652
|
}
|
|
3617
4653
|
var IDENTITY_KEY_PREFIX = "sg:link:v1:";
|
|
@@ -3674,7 +4710,7 @@ function forgetIdentity(account) {
|
|
|
3674
4710
|
}
|
|
3675
4711
|
}
|
|
3676
4712
|
var addrEq = (a, b) => String(a || "").toLowerCase() === String(b || "").toLowerCase();
|
|
3677
|
-
var
|
|
4713
|
+
var chainName2 = (id) => id != null ? CHAIN_LABELS[id] || `Chain ${id}` : "";
|
|
3678
4714
|
var STABLES = EXECUTABLE_STABLE_ASSETS;
|
|
3679
4715
|
function BankGlyph() {
|
|
3680
4716
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -3894,7 +4930,7 @@ function IdentityLine(props) {
|
|
|
3894
4930
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-link-id", children: [
|
|
3895
4931
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-link-id-icon", children: /* @__PURE__ */ jsxRuntime.jsx(WalletGlyph, {}) }),
|
|
3896
4932
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-link-id-text", children: [
|
|
3897
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-link-id-primary", children: props.account ?
|
|
4933
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-link-id-primary", children: props.account ? shortAddress2(props.account) : "ZeroDelta Link" }),
|
|
3898
4934
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-link-id-secondary", children: props.email ? props.email : props.account ? "Connected wallet" : "Connect your wallet to continue" })
|
|
3899
4935
|
] }),
|
|
3900
4936
|
props.account ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-wallet-dot", "aria-hidden": "true" }) : null
|
|
@@ -4190,6 +5226,7 @@ function PaymentIsland(props) {
|
|
|
4190
5226
|
const [expanded, setExpanded] = react.useState(() => Boolean(props.defaultExpanded) || rampMode);
|
|
4191
5227
|
const [view, setView] = react.useState("main");
|
|
4192
5228
|
const [hist, setHist] = react.useState(null);
|
|
5229
|
+
const histBtnRef = react.useRef(null);
|
|
4193
5230
|
const pillRef = react.useRef(null);
|
|
4194
5231
|
const methodRowRef = react.useRef(null);
|
|
4195
5232
|
const exFromTileRef = react.useRef(null);
|
|
@@ -4197,6 +5234,7 @@ function PaymentIsland(props) {
|
|
|
4197
5234
|
const regionRef = react.useRef(null);
|
|
4198
5235
|
const panelId = react.useId();
|
|
4199
5236
|
react.useEffect(() => setView("main"), [wallet.account, payParamsKey]);
|
|
5237
|
+
react.useEffect(() => setHist(null), [wallet.account]);
|
|
4200
5238
|
const firstRender = react.useRef(true);
|
|
4201
5239
|
react.useEffect(() => {
|
|
4202
5240
|
if (firstRender.current) {
|
|
@@ -4220,7 +5258,7 @@ function PaymentIsland(props) {
|
|
|
4220
5258
|
};
|
|
4221
5259
|
const closeHistory = () => {
|
|
4222
5260
|
setHist(null);
|
|
4223
|
-
requestAnimationFrame(() => (methodRowRef.current ?? regionRef.current)?.focus());
|
|
5261
|
+
requestAnimationFrame(() => (histBtnRef.current ?? methodRowRef.current ?? regionRef.current)?.focus());
|
|
4224
5262
|
};
|
|
4225
5263
|
const pickFunding = (pick) => {
|
|
4226
5264
|
const r = visibleRoutes.find((x) => x.source.chainId === pick.chainId && symbolKey(x.source.asset) === symbolKey(pick.symbol));
|
|
@@ -4282,7 +5320,11 @@ function PaymentIsland(props) {
|
|
|
4282
5320
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-link-word", children: "ZeroDelta" }),
|
|
4283
5321
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-badge", "data-tone": "accent", children: "Link" })
|
|
4284
5322
|
] });
|
|
4285
|
-
const
|
|
5323
|
+
const linkMenu = menuItems.length ? /* @__PURE__ */ jsxRuntime.jsx(LinkMenu, { items: menuItems }) : null;
|
|
5324
|
+
const walletSlot = wallet.account || linkMenu ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-head-tools", children: [
|
|
5325
|
+
wallet.account ? /* @__PURE__ */ jsxRuntime.jsx(HistoryButton, { btnRef: histBtnRef, disabled: submitting, onClick: () => setHist({}) }) : null,
|
|
5326
|
+
linkMenu
|
|
5327
|
+
] }) : void 0;
|
|
4286
5328
|
const activeStep = flow.steps.find((s) => s.state === "active");
|
|
4287
5329
|
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." : "";
|
|
4288
5330
|
const loading = flow.status === "loading";
|
|
@@ -4316,7 +5358,7 @@ function PaymentIsland(props) {
|
|
|
4316
5358
|
] });
|
|
4317
5359
|
let body;
|
|
4318
5360
|
if (hist && wallet.account) {
|
|
4319
|
-
body = /* @__PURE__ */ jsxRuntime.jsx(TxHistoryPanel, { account: wallet.account, tokens: registryTokens, initialEntry: hist.entry ?? null, onBack: closeHistory });
|
|
5361
|
+
body = /* @__PURE__ */ jsxRuntime.jsx(TxHistoryPanel, { account: wallet.account, tokens: registryTokens, vaultIcons: catalogue?.vaultIcons, initialEntry: hist.entry ?? null, onBack: closeHistory });
|
|
4320
5362
|
} else if (isPay && view === "select" && wallet.account) {
|
|
4321
5363
|
body = /* @__PURE__ */ jsxRuntime.jsx(
|
|
4322
5364
|
TokenSelect,
|
|
@@ -4399,7 +5441,7 @@ function PaymentIsland(props) {
|
|
|
4399
5441
|
] }),
|
|
4400
5442
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-receipt-sub", children: [
|
|
4401
5443
|
confirmed ? "Confirmed on-chain" : "Confirmation pending",
|
|
4402
|
-
isPay && props.recipient ? ` \xB7 ${
|
|
5444
|
+
isPay && props.recipient ? ` \xB7 ${shortAddress2(props.recipient)}` : ""
|
|
4403
5445
|
] })
|
|
4404
5446
|
] }),
|
|
4405
5447
|
!identityMatchesWallet ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-remember", children: [
|
|
@@ -4495,7 +5537,7 @@ function PaymentIsland(props) {
|
|
|
4495
5537
|
] }),
|
|
4496
5538
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-anchor-sub", children: [
|
|
4497
5539
|
"on ",
|
|
4498
|
-
|
|
5540
|
+
chainName2(sel.source.chainId),
|
|
4499
5541
|
selBal ? ` \xB7 balance ${selBal.formatted}` : ""
|
|
4500
5542
|
] })
|
|
4501
5543
|
] }) : null,
|
|
@@ -4508,9 +5550,10 @@ function PaymentIsland(props) {
|
|
|
4508
5550
|
] }),
|
|
4509
5551
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-anchor-sub", children: [
|
|
4510
5552
|
"on ",
|
|
4511
|
-
|
|
5553
|
+
chainName2(sel.source.chainId)
|
|
4512
5554
|
] })
|
|
4513
5555
|
] }) : null,
|
|
5556
|
+
sel && !loading && !quoteError ? /* @__PURE__ */ jsxRuntime.jsx(CompliancePanel, { compliance: sel.quote.compliance, direct: sel.state === "DIRECT" }) : null,
|
|
4514
5557
|
quoteError ? /* @__PURE__ */ jsxRuntime.jsx(StatusPanel, { tone: "error", children: flow.error || "Couldn't get a price right now." }) : null,
|
|
4515
5558
|
walletError ? /* @__PURE__ */ jsxRuntime.jsx(StatusPanel, { tone: "error", children: flow.error || "The wallet could not complete this payment." }) : null,
|
|
4516
5559
|
submitting || walletError ? /* @__PURE__ */ jsxRuntime.jsx(StepList, { variant: "rich", steps: flow.steps, verdict: flow.verdict }) : null,
|
|
@@ -4779,7 +5822,7 @@ function StableGeniePay(props) {
|
|
|
4779
5822
|
] })
|
|
4780
5823
|
] }) : void 0;
|
|
4781
5824
|
if (props.variant === "pill") return /* @__PURE__ */ jsxRuntime.jsx(PaymentIsland, { kind: "pay", ...props });
|
|
4782
|
-
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(
|
|
5825
|
+
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(
|
|
4783
5826
|
TokenSelect,
|
|
4784
5827
|
{
|
|
4785
5828
|
title: "Pay with",
|
|
@@ -4804,7 +5847,7 @@ function StableGeniePay(props) {
|
|
|
4804
5847
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-success-sub", children: [
|
|
4805
5848
|
flow.verdict?.status === "confirmed" ? "Confirmed on-chain" : "Submitted \u2014 awaiting confirmation",
|
|
4806
5849
|
" \xB7 ",
|
|
4807
|
-
|
|
5850
|
+
shortAddress2(props.recipient)
|
|
4808
5851
|
] })
|
|
4809
5852
|
] }),
|
|
4810
5853
|
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
|
|
@@ -4847,6 +5890,7 @@ function StableGeniePay(props) {
|
|
|
4847
5890
|
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,
|
|
4848
5891
|
flow.status === "ready" && !visibleRoutes.length ? /* @__PURE__ */ jsxRuntime.jsx(StatusPanel, { children: "No funding route matches the accepted assets for this payment." }) : null
|
|
4849
5892
|
] }),
|
|
5893
|
+
sel && flow.status !== "loading" ? /* @__PURE__ */ jsxRuntime.jsx(CompliancePanel, { compliance: sel.quote.compliance, direct: sel.state === "DIRECT" }) : null,
|
|
4850
5894
|
submitting ? /* @__PURE__ */ jsxRuntime.jsx(StepList, { steps: flow.steps }) : null,
|
|
4851
5895
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-cta-wrap", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4852
5896
|
Button,
|
|
@@ -4951,7 +5995,7 @@ function StableGenieSwap(props) {
|
|
|
4951
5995
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-brand", children: "ZeroDelta" })
|
|
4952
5996
|
] }) : void 0;
|
|
4953
5997
|
if (hist && wallet.account) {
|
|
4954
|
-
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 }) });
|
|
5998
|
+
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 }) });
|
|
4955
5999
|
}
|
|
4956
6000
|
if (flow.status === "success" || flow.status === "pending") {
|
|
4957
6001
|
return /* @__PURE__ */ jsxRuntime.jsxs(WidgetShell, { title: config.title || "Swap", theme: config.theme, walletSlot, children: [
|
|
@@ -4964,7 +6008,7 @@ function StableGenieSwap(props) {
|
|
|
4964
6008
|
] }),
|
|
4965
6009
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-success-sub", children: [
|
|
4966
6010
|
flow.verdict?.status === "confirmed" ? "Confirmed on-chain" : "Submitted \u2014 awaiting confirmation",
|
|
4967
|
-
props.recipient ? ` \xB7 ${
|
|
6011
|
+
props.recipient ? ` \xB7 ${shortAddress2(props.recipient)}` : ""
|
|
4968
6012
|
] })
|
|
4969
6013
|
] }),
|
|
4970
6014
|
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
|
|
@@ -4990,6 +6034,7 @@ function StableGenieSwap(props) {
|
|
|
4990
6034
|
] }),
|
|
4991
6035
|
flow.status === "error" && flow.error ? /* @__PURE__ */ jsxRuntime.jsx(StatusPanel, { tone: "error", children: flow.error }) : null,
|
|
4992
6036
|
flow.routes.length ? /* @__PURE__ */ jsxRuntime.jsx(RouteList, { routes: flow.routes, selectedId: flow.selected?.id ?? null, onSelect: flow.selectRoute }) : null,
|
|
6037
|
+
flow.selected && flow.status !== "loading" ? /* @__PURE__ */ jsxRuntime.jsx(CompliancePanel, { compliance: flow.selected.quote.compliance, direct: flow.selected.state === "DIRECT" }) : null,
|
|
4993
6038
|
submitting ? /* @__PURE__ */ jsxRuntime.jsx(StepList, { steps: flow.steps }) : null,
|
|
4994
6039
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cta-wrap", children: [
|
|
4995
6040
|
!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 }),
|
|
@@ -5188,7 +6233,7 @@ function StableGenieExchange(props) {
|
|
|
5188
6233
|
/* @__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: [
|
|
5189
6234
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-wallet-dot", "aria-hidden": "true" }),
|
|
5190
6235
|
" ",
|
|
5191
|
-
|
|
6236
|
+
shortAddress2(wallet.account)
|
|
5192
6237
|
] }) : wallet.connecting ? "Connecting\u2026" : "Connect wallet" })
|
|
5193
6238
|
] });
|
|
5194
6239
|
const fromTileRef = react.useRef(null);
|
|
@@ -5200,7 +6245,7 @@ function StableGenieExchange(props) {
|
|
|
5200
6245
|
if (props.variant === "pill") return /* @__PURE__ */ jsxRuntime.jsx(PaymentIsland, { kind: "exchange", ...props });
|
|
5201
6246
|
let body;
|
|
5202
6247
|
if (hist && connected) {
|
|
5203
|
-
body = /* @__PURE__ */ jsxRuntime.jsx(TxHistoryPanel, { account: wallet.account, tokens, initialEntry: hist.entry ?? null, onBack: closeHistory });
|
|
6248
|
+
body = /* @__PURE__ */ jsxRuntime.jsx(TxHistoryPanel, { account: wallet.account, tokens, vaultIcons: catalogue?.vaultIcons, initialEntry: hist.entry ?? null, onBack: closeHistory });
|
|
5204
6249
|
} else if (view === "from" || view === "to") {
|
|
5205
6250
|
const isFrom = view === "from";
|
|
5206
6251
|
body = /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -5230,7 +6275,7 @@ function StableGenieExchange(props) {
|
|
|
5230
6275
|
] }),
|
|
5231
6276
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-success-sub", children: [
|
|
5232
6277
|
flow.verdict?.status === "confirmed" ? "Confirmed on-chain" : "Submitted \u2014 awaiting confirmation",
|
|
5233
|
-
props.recipient ? ` \xB7 ${
|
|
6278
|
+
props.recipient ? ` \xB7 ${shortAddress2(props.recipient)}` : ""
|
|
5234
6279
|
] })
|
|
5235
6280
|
] }),
|
|
5236
6281
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cta-wrap", children: [
|
|
@@ -5277,6 +6322,7 @@ function StableGenieExchange(props) {
|
|
|
5277
6322
|
meta.duration ? ` \xB7 ~${meta.duration}s` : ""
|
|
5278
6323
|
] }) : null
|
|
5279
6324
|
] }) : null,
|
|
6325
|
+
connected && flow.selected && flow.status !== "loading" ? /* @__PURE__ */ jsxRuntime.jsx(CompliancePanel, { compliance: flow.selected.quote.compliance, direct: flow.selected.state === "DIRECT" }) : null,
|
|
5280
6326
|
submitting ? /* @__PURE__ */ jsxRuntime.jsx(StepList, { steps: flow.steps }) : null,
|
|
5281
6327
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cta-wrap", children: [
|
|
5282
6328
|
!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 }),
|
|
@@ -5379,6 +6425,7 @@ function mount(el, config) {
|
|
|
5379
6425
|
return () => root.unmount();
|
|
5380
6426
|
}
|
|
5381
6427
|
|
|
6428
|
+
exports.CompliancePanel = CompliancePanel;
|
|
5382
6429
|
exports.EXECUTABLE_STABLE_ASSETS = EXECUTABLE_STABLE_ASSETS;
|
|
5383
6430
|
exports.PaymentIsland = PaymentIsland;
|
|
5384
6431
|
exports.STABLE_ASSETS = STABLE_ASSETS;
|
|
@@ -5392,10 +6439,14 @@ exports.StableGenieSwap = StableGenieSwap;
|
|
|
5392
6439
|
exports.TRADEABLE_RWA_ASSETS = TRADEABLE_RWA_ASSETS;
|
|
5393
6440
|
exports.assetClassOf = assetClassOf;
|
|
5394
6441
|
exports.brokenLaneReason = brokenLaneReason;
|
|
6442
|
+
exports.complianceChecks = complianceChecks;
|
|
6443
|
+
exports.complianceControlsLine = complianceControlsLine;
|
|
6444
|
+
exports.complianceView = complianceView;
|
|
5395
6445
|
exports.counterpartTokens = counterpartTokens;
|
|
5396
6446
|
exports.createEngine = createEngine;
|
|
5397
6447
|
exports.darkTheme = darkTheme;
|
|
5398
6448
|
exports.destinationAvailability = destinationAvailability;
|
|
6449
|
+
exports.humanizeComplianceReason = humanizeComplianceReason;
|
|
5399
6450
|
exports.lightTheme = lightTheme;
|
|
5400
6451
|
exports.mount = mount;
|
|
5401
6452
|
exports.resolveTheme = resolveTheme;
|