@glacislabs/stablegenie-zerodelta 3.4.0 → 4.0.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.
@@ -25,6 +25,7 @@ var TRADEABLE_RWA_ASSETS = /* @__PURE__ */ new Set([
25
25
  ]);
26
26
  var SUPPORTED_ASSETS = /* @__PURE__ */ new Set([...STABLE_ASSETS, ...TRADEABLE_RWA_ASSETS]);
27
27
  var API_CACHE_TTL_MS = 6e4;
28
+ var SCREEN_CACHE_TTL_MS = 5 * 6e4;
28
29
  var MAX_QUOTE_CANDIDATES = 8;
29
30
  var QUOTE_BUFFER_BPS = 50;
30
31
  var LZ_FEE_BUFFER_BPS = 1500n;
@@ -751,6 +752,338 @@ function brokenLaneReason(lane) {
751
752
  }
752
753
  }
753
754
 
755
+ // src/core/compliance.ts
756
+ var COMPLIANCE_DENY_LABEL = "Compliance check failed";
757
+ function complianceView(compliance, hasQuote = true) {
758
+ if (!hasQuote) {
759
+ return {
760
+ tone: "neutral",
761
+ label: "Compliance checks run with your quote",
762
+ headline: "No compliance decision for this payment yet",
763
+ blocked: false,
764
+ needsAction: false,
765
+ screened: false
766
+ };
767
+ }
768
+ const decision = compliance?.decision;
769
+ const screened = compliance?.status === "SCREENED";
770
+ if (decision === "DENY") {
771
+ return {
772
+ tone: "blocked",
773
+ label: COMPLIANCE_DENY_LABEL,
774
+ headline: "Blocked by compliance policy",
775
+ blocked: true,
776
+ needsAction: false,
777
+ screened
778
+ };
779
+ }
780
+ if (decision === "REVIEW" || decision === "REMEDIATE") {
781
+ const word = decision.toLowerCase();
782
+ return {
783
+ tone: "warn",
784
+ label: `Compliance: ${word} required`,
785
+ headline: `Manual ${word} required`,
786
+ blocked: false,
787
+ needsAction: true,
788
+ screened
789
+ };
790
+ }
791
+ if (decision === "ALLOW") {
792
+ return {
793
+ tone: "ok",
794
+ label: screened ? "Compliance checks passed" : "Allowed \u2014 wallets not screened",
795
+ headline: screened ? "Wallets screened and allowed" : "Allowed \u2014 wallets not screened",
796
+ blocked: false,
797
+ needsAction: false,
798
+ screened
799
+ };
800
+ }
801
+ return {
802
+ tone: "neutral",
803
+ label: screened ? "Screened \u2014 no policy decision returned" : "No compliance decision returned",
804
+ headline: screened ? "Screened \u2014 no policy decision returned" : "No compliance decision returned",
805
+ blocked: false,
806
+ needsAction: false,
807
+ screened
808
+ };
809
+ }
810
+ var CATEGORY_PHRASES = {
811
+ SANCTIONS: "sanctions",
812
+ TERRORISM_FINANCING: "terrorism financing",
813
+ STOLEN_FUNDS: "stolen funds",
814
+ RANSOMWARE: "ransomware",
815
+ SCAM: "scam activity",
816
+ DARKNET: "darknet activity",
817
+ MIXER: "mixer usage",
818
+ HIGH_RISK_ENTITY: "a high-risk entity",
819
+ PEP: "a politically-exposed person",
820
+ INDIRECT_EXPOSURE: "indirect exposure",
821
+ UNCLASSIFIED: "an unrecognized risk",
822
+ UNKNOWN: "an unrecognized risk"
823
+ };
824
+ function categoryLabel(code) {
825
+ const key = code.trim().toUpperCase();
826
+ const LABELS = {
827
+ SANCTIONS: "Sanctions",
828
+ TERRORISM_FINANCING: "Terrorist financing",
829
+ STOLEN_FUNDS: "Stolen funds",
830
+ RANSOMWARE: "Ransomware",
831
+ SCAM: "Scam",
832
+ DARKNET: "Darknet services",
833
+ MIXER: "Mixer",
834
+ HIGH_RISK_ENTITY: "High-risk entity",
835
+ PEP: "Politically exposed person (PEP)",
836
+ INDIRECT_EXPOSURE: "Indirect exposure",
837
+ UNCLASSIFIED: "Unclassified risk",
838
+ UNKNOWN: "Unclassified risk"
839
+ };
840
+ return LABELS[key] ?? key.toLowerCase().replace(/_/g, " ");
841
+ }
842
+ function cleanJurisdiction(code) {
843
+ return code.replace(/^(OFAC|TIER\d+|SANCTIONED)_/i, "").trim();
844
+ }
845
+ function stripBundlePrefix(head) {
846
+ if (head.startsWith("policy_")) return { head: head.slice("policy_".length), source: "policy" };
847
+ if (head.startsWith("legislation_")) return { head: head.slice("legislation_".length), source: "legislation" };
848
+ return { head, source: null };
849
+ }
850
+ function complianceReasonHead(raw) {
851
+ return stripBundlePrefix((raw.split(":")[0] ?? "").trim()).head;
852
+ }
853
+ function usd(raw) {
854
+ const n = Number(raw);
855
+ if (!Number.isFinite(n)) return `$${raw}`;
856
+ return `$${n.toLocaleString("en-US", { maximumFractionDigits: 2 })}`;
857
+ }
858
+ function capFromDetail(detail) {
859
+ const m = detail.match(/>([\d.]+)/);
860
+ return m ? ` (${usd(m[1])})` : "";
861
+ }
862
+ function categoryPhrase(detail) {
863
+ const cat = detail.replace(/\s*\(.*\)$/, "").toUpperCase();
864
+ return CATEGORY_PHRASES[cat] ?? cat.toLowerCase().replace(/_/g, " ");
865
+ }
866
+ function humanizeComplianceReason(raw) {
867
+ const [headRaw, ...restParts] = raw.split(":");
868
+ const detail = restParts.join(":").trim();
869
+ const { head, source } = stripBundlePrefix((headRaw ?? "").trim());
870
+ const scope = source === "legislation" ? "applicable regulations" : "the applicable policy";
871
+ switch (head) {
872
+ case "asset_pair_not_allowed": {
873
+ const m = detail.match(/^(\S+)->(\S+)\s+in\s+(\S+)/);
874
+ if (m) return `${m[1]} \u2192 ${m[2]} isn't available in your region (${cleanJurisdiction(m[3])}).`;
875
+ return "This asset pair isn't available in your region.";
876
+ }
877
+ case "asset_not_allowed": {
878
+ const m = detail.match(/^(\S+?)->(\S+?)(?::|$)/);
879
+ if (m) return `${m[1]} \u2192 ${m[2]} isn't permitted under ${scope}.`;
880
+ return `This asset pair isn't permitted under ${scope}.`;
881
+ }
882
+ case "blocked_jurisdiction":
883
+ return `Your region (${cleanJurisdiction(detail)}) isn't supported.`;
884
+ case "blocked_destination_jurisdiction":
885
+ return `The destination region (${cleanJurisdiction(detail)}) isn't supported.`;
886
+ case "jurisdiction_out_of_scope":
887
+ return `Not covered by ${scope}.`;
888
+ case "ui_block":
889
+ return `Payments aren't available in your region (${cleanJurisdiction(detail)}).`;
890
+ case "blocked_corridor_mode":
891
+ return "This route isn't currently open for payments.";
892
+ case "blocked_category":
893
+ return `Flagged for ${categoryPhrase(detail)}.`;
894
+ case "amount_exceeds_max_order_usd":
895
+ case "amount_exceeds_max":
896
+ return `Amount exceeds the maximum order size${capFromDetail(detail)}.`;
897
+ case "amount_exceeds_actor_cap":
898
+ return `Amount exceeds the limit for your account type${capFromDetail(detail)}.`;
899
+ case "amount_exceeds_jurisdiction_max":
900
+ return `Amount exceeds the limit for your region${capFromDetail(detail)}.`;
901
+ case "source_chain_not_allowed":
902
+ return `The source chain isn't permitted under ${scope}.`;
903
+ case "dest_chain_not_allowed":
904
+ return `The destination chain isn't permitted under ${scope}.`;
905
+ default:
906
+ return detail ? `${head.replace(/_/g, " ")} \u2014 ${detail}` : head.replace(/_/g, " ");
907
+ }
908
+ }
909
+ var COMPLIANCE_CHECK_ORDER = [
910
+ "location",
911
+ "screening",
912
+ "risk",
913
+ "asset",
914
+ "limits"
915
+ ];
916
+ var CHECK_LABELS = {
917
+ location: "Location and corridor permitted",
918
+ screening: "Both wallets screened",
919
+ risk: "Risk policy passed",
920
+ asset: "Asset and amount allowed",
921
+ limits: "Transaction limits verified"
922
+ };
923
+ var CHECK_HEADS = {
924
+ location: [
925
+ "blocked_jurisdiction",
926
+ "blocked_destination_jurisdiction",
927
+ "ui_block",
928
+ "blocked_corridor_mode",
929
+ "jurisdiction_out_of_scope"
930
+ ],
931
+ screening: [],
932
+ risk: ["blocked_category"],
933
+ asset: ["asset_pair_not_allowed", "asset_not_allowed", "source_chain_not_allowed", "dest_chain_not_allowed"],
934
+ limits: [
935
+ "amount_exceeds_max_order_usd",
936
+ "amount_exceeds_max",
937
+ "amount_exceeds_actor_cap",
938
+ "amount_exceeds_jurisdiction_max"
939
+ ]
940
+ };
941
+ function distinctScreenedWallets(compliance) {
942
+ const seen = /* @__PURE__ */ new Set();
943
+ const wallets = [];
944
+ for (const raw of compliance?.screenedWallets ?? []) {
945
+ const address = raw?.trim();
946
+ if (!address) continue;
947
+ const key = /^0x[0-9a-fA-F]+$/.test(address) ? address.toLowerCase() : address;
948
+ if (seen.has(key)) continue;
949
+ seen.add(key);
950
+ wallets.push(address);
951
+ }
952
+ return wallets;
953
+ }
954
+ function shortAddress(a) {
955
+ return a.length > 12 ? `${a.slice(0, 6)}\u2026${a.slice(-4)}` : a;
956
+ }
957
+ function screeningLabel(wallets) {
958
+ if (wallets === 1) return "Wallet screened";
959
+ if (wallets === 2) return CHECK_LABELS.screening;
960
+ return "Wallets screened";
961
+ }
962
+ function complianceChecks(compliance, cv = complianceView(compliance)) {
963
+ if (cv.tone === "neutral") return [];
964
+ const byControl = /* @__PURE__ */ new Map();
965
+ for (const raw of compliance?.reasons ?? []) {
966
+ const head = complianceReasonHead(raw);
967
+ const id = COMPLIANCE_CHECK_ORDER.find((c) => CHECK_HEADS[c].includes(head));
968
+ if (!id) continue;
969
+ byControl.set(id, [...byControl.get(id) ?? [], raw]);
970
+ }
971
+ const screenedWallets = distinctScreenedWallets(compliance);
972
+ const wallets = screenedWallets.length;
973
+ const blocking = compliance?.blockingCategories?.length ?? 0;
974
+ return COMPLIANCE_CHECK_ORDER.map((id) => {
975
+ if (id === "screening") {
976
+ const ok2 = cv.screened || wallets > 0;
977
+ const note = wallets === 1 ? shortAddress(screenedWallets[0]) : wallets > 1 ? `${wallets} wallets screened` : void 0;
978
+ return { id, label: ok2 ? screeningLabel(wallets) : "Wallets not screened", ok: ok2, reasons: [], note };
979
+ }
980
+ const reasons = byControl.get(id) ?? [];
981
+ const ok = reasons.length === 0 && !(id === "risk" && blocking > 0);
982
+ return { id, label: CHECK_LABELS[id], ok, reasons };
983
+ });
984
+ }
985
+ function unattributedComplianceReasons(compliance, cv = complianceView(compliance)) {
986
+ const claimed = new Set(complianceChecks(compliance, cv).flatMap((c) => c.reasons));
987
+ return (compliance?.reasons ?? []).filter((r) => !claimed.has(r));
988
+ }
989
+ function complianceControlsEvaluated(compliance, cv = complianceView(compliance)) {
990
+ const checks = complianceChecks(compliance, cv);
991
+ if (checks.length === 0) return 0;
992
+ const named = /* @__PURE__ */ new Set();
993
+ for (const raw of [...compliance?.appliedPolicyNames ?? [], ...compliance?.appliedLegislation ?? []]) {
994
+ const name = raw?.trim();
995
+ if (name) named.add(name.toLowerCase());
996
+ }
997
+ return checks.length + named.size;
998
+ }
999
+ function complianceControlsLine(compliance, cv = complianceView(compliance)) {
1000
+ if (cv.blocked || cv.needsAction) return cv.headline;
1001
+ const n = complianceControlsEvaluated(compliance, cv);
1002
+ if (n === 0) return cv.headline;
1003
+ return `${n} compliance control${n === 1 ? "" : "s"} evaluated for this payment`;
1004
+ }
1005
+ function directComplianceFromScreens(screens) {
1006
+ const blockedAny = screens.some((s) => s.blocked);
1007
+ const cats = (pick) => [
1008
+ ...new Set(screens.flatMap((s) => pick(s) ?? []))
1009
+ ];
1010
+ return {
1011
+ status: "SCREENED",
1012
+ decision: blockedAny ? "DENY" : "ALLOW",
1013
+ screenedWallets: screens.map((s) => s.address),
1014
+ riskCategories: cats((s) => s.riskCategories),
1015
+ flaggedCategories: cats((s) => s.flaggedCategories),
1016
+ blockingCategories: cats((s) => s.blockingCategories),
1017
+ reasons: blockedAny ? cats((s) => s.blockingCategories).map((c) => `blocked_category:${c}`) : []
1018
+ };
1019
+ }
1020
+ var DIRECT_CHECK_IDS = ["screening", "risk"];
1021
+ 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.";
1022
+ var BLOCK_CATEGORY_LABELS = {
1023
+ STOLEN_FUNDS: "flagged as associated with stolen funds",
1024
+ SANCTIONS: "on a sanctions list",
1025
+ SANCTIONED: "on a sanctions list",
1026
+ OFAC: "on a sanctions list",
1027
+ TERRORIST_FINANCING: "flagged for terrorist financing",
1028
+ TERRORISM_FINANCING: "flagged for terrorist financing",
1029
+ FRAUD: "flagged for fraud",
1030
+ SCAM: "flagged as a scam address"
1031
+ };
1032
+ var BLOCK_LABEL_DEFAULT = "flagged by compliance screening";
1033
+ function blockLabelFor(categories) {
1034
+ for (const raw of categories) {
1035
+ const label = BLOCK_CATEGORY_LABELS[String(raw || "").trim().toUpperCase()];
1036
+ if (label) return label;
1037
+ }
1038
+ return BLOCK_LABEL_DEFAULT;
1039
+ }
1040
+ var REASON_TAGS = {
1041
+ blocked_jurisdiction: "Restricted country",
1042
+ ui_block: "Restricted country",
1043
+ blocked_destination_jurisdiction: "Restricted destination",
1044
+ blocked_corridor_mode: "Corridor closed",
1045
+ blocked_category: "Risk flag",
1046
+ amount_exceeds_max_order_usd: "Limit exceeded",
1047
+ amount_exceeds_max: "Limit exceeded",
1048
+ amount_exceeds_actor_cap: "Limit exceeded",
1049
+ amount_exceeds_jurisdiction_max: "Limit exceeded",
1050
+ asset_pair_not_allowed: "Asset not allowed",
1051
+ asset_not_allowed: "Asset not allowed",
1052
+ source_chain_not_allowed: "Chain not allowed",
1053
+ dest_chain_not_allowed: "Chain not allowed",
1054
+ jurisdiction_out_of_scope: "Out of scope"
1055
+ };
1056
+ function complianceReasonTag(raw) {
1057
+ const head = complianceReasonHead(raw);
1058
+ return REASON_TAGS[head] ?? head.replace(/_/g, " ");
1059
+ }
1060
+ function complianceTagOf(compliance) {
1061
+ const first = (compliance?.reasons ?? [])[0];
1062
+ return first ? complianceReasonTag(first) : "";
1063
+ }
1064
+ var FLOOR_CATEGORIES = ["SANCTIONS", "TERRORISM_FINANCING", "STOLEN_FUNDS", "RANSOMWARE"];
1065
+ var TUNABLE_CATEGORIES = ["SCAM", "DARKNET", "MIXER", "HIGH_RISK_ENTITY", "PEP", "INDIRECT_EXPOSURE", "UNCLASSIFIED"];
1066
+ var TUNED_OUTCOMES = {
1067
+ SCAM: "blocked",
1068
+ DARKNET: "blocked",
1069
+ MIXER: "flagged",
1070
+ HIGH_RISK_ENTITY: "flagged",
1071
+ PEP: "flagged",
1072
+ INDIRECT_EXPOSURE: "flagged",
1073
+ UNCLASSIFIED: "flagged"
1074
+ };
1075
+ function screeningOutcomeOf(category) {
1076
+ const key = category.trim().toUpperCase();
1077
+ if (FLOOR_CATEGORIES.includes(key)) return "always-blocked";
1078
+ return TUNED_OUTCOMES[key] ?? null;
1079
+ }
1080
+ var labelsFor = (outcome) => [...FLOOR_CATEGORIES, ...TUNABLE_CATEGORIES].filter((c) => screeningOutcomeOf(c) === outcome).map(categoryLabel);
1081
+ var SCREENING_BUCKETS = [
1082
+ { outcome: "always-blocked", title: "Always blocked", detail: "Cannot be changed or disabled.", categories: labelsFor("always-blocked") },
1083
+ { outcome: "blocked", title: "Blocked under this policy", detail: "The current policy stops the order.", categories: labelsFor("blocked") },
1084
+ { outcome: "flagged", title: "Flagged", detail: "A warning is shown.", categories: labelsFor("flagged") }
1085
+ ];
1086
+
754
1087
  // src/core/solve.ts
755
1088
  async function solveExactOut({ option, destination, destinationToken, payer, fetchQuote }) {
756
1089
  const destDecimals = assetDecimals(destinationToken);
@@ -987,7 +1320,7 @@ function routeLabelFor(option, destinationToken, result) {
987
1320
  const bridge = result.quote.bridge ? ` via ${result.quote.bridge}` : "";
988
1321
  return `Swap ${option.symbol} to ${destinationToken.symbol} and settle on ZeroDelta${bridge}.`;
989
1322
  }
990
- async function buildRoute({ option, destination, destinationToken, chains, payer, fetchQuote, solve = solveExactOut, amountInRaw }) {
1323
+ async function buildRoute({ option, destination, destinationToken, chains, payer, fetchQuote, solve = solveExactOut, amountInRaw, compliance }) {
991
1324
  const result = await solve({ option, destination, destinationToken, payer, fetchQuote, amountInRaw });
992
1325
  const quote = result.quote;
993
1326
  const destDecimals = assetDecimals(destinationToken);
@@ -1034,7 +1367,11 @@ async function buildRoute({ option, destination, destinationToken, chains, payer
1034
1367
  bridge: quote.bridge,
1035
1368
  feeBps: quote.feeBps,
1036
1369
  estimatedDuration: quote.estimatedDuration,
1037
- iterations: result.iterations
1370
+ iterations: result.iterations,
1371
+ // A direct transfer never reaches /quote (solve.ts short-circuits it), so there is no
1372
+ // gateway decision to carry. The caller screens both parties itself and passes the
1373
+ // synthesized verdict in — see plan.ts and compliance.ts::directComplianceFromScreens.
1374
+ compliance
1038
1375
  }
1039
1376
  };
1040
1377
  }
@@ -1118,7 +1455,11 @@ async function buildRoute({ option, destination, destinationToken, chains, payer
1118
1455
  gasCostSource: quote.gasCostSource,
1119
1456
  msgValue: valueRaw.toString(),
1120
1457
  deadline: order.deadline,
1121
- iterations: result.iterations
1458
+ iterations: result.iterations,
1459
+ // Carried verbatim from the gateway's decision on THIS wallet pair. The projection used to
1460
+ // drop it, which is why the widget could show a price with no evidence of the control that
1461
+ // produced it.
1462
+ compliance: quote.compliance
1122
1463
  }
1123
1464
  };
1124
1465
  }
@@ -1154,25 +1495,20 @@ function apiMessage(json, fallback) {
1154
1495
  }
1155
1496
  return sanitizeMessage(err?.message, fallback);
1156
1497
  }
1157
- var BLOCK_CATEGORY_LABELS = {
1158
- STOLEN_FUNDS: "flagged as associated with stolen funds",
1159
- SANCTIONS: "on a sanctions list",
1160
- SANCTIONED: "on a sanctions list",
1161
- OFAC: "on a sanctions list",
1162
- TERRORIST_FINANCING: "flagged for terrorist financing",
1163
- FRAUD: "flagged for fraud",
1164
- SCAM: "flagged as a scam address"
1165
- };
1166
- var BLOCK_LABEL_DEFAULT = "flagged by compliance screening";
1498
+ function isStructuredComplianceBlock(error) {
1499
+ const code = String(error?.code || "").toUpperCase();
1500
+ if (code === "COMPLIANCE_BLOCKED" || code === "COMPLIANCE_BLOCK") return true;
1501
+ return error?.status === 422 && Array.isArray(error?.reasons) && error.reasons.length > 0;
1502
+ }
1167
1503
  function classifyQuoteError(error) {
1168
1504
  if (!error) return null;
1169
1505
  const reasons = Array.isArray(error.reasons) ? error.reasons : [];
1170
1506
  const haystack = `${error.message || ""} ${reasons.join(" ")}`;
1171
1507
  const catMatch = /blocked_category:\s*([A-Za-z_]+)/i.exec(haystack);
1172
- 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);
1508
+ 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);
1173
1509
  if (!isBlock) return null;
1174
1510
  const category = (catMatch?.[1] || "").toUpperCase() || "COMPLIANCE";
1175
- const label = BLOCK_CATEGORY_LABELS[category] || BLOCK_LABEL_DEFAULT;
1511
+ const label = blockLabelFor([category]);
1176
1512
  return {
1177
1513
  blocked: true,
1178
1514
  category,
@@ -1196,6 +1532,8 @@ function createApiClient(cfg) {
1196
1532
  routes: null,
1197
1533
  health: null
1198
1534
  };
1535
+ const screenCache = /* @__PURE__ */ new Map();
1536
+ const screenInflight = /* @__PURE__ */ new Map();
1199
1537
  const apiBase = cfg.apiBase.replace(/\/$/, "");
1200
1538
  async function apiRequest(path, init = {}) {
1201
1539
  const apiKey = await cfg.getApiKey();
@@ -1290,7 +1628,32 @@ function createApiClient(cfg) {
1290
1628
  }
1291
1629
  throw lastError;
1292
1630
  }
1293
- return { apiRequest, fetchChains, fetchTokens, fetchRoutes, fetchRouteHealth, fetchQuote, apiBase };
1631
+ async function screenWallet(address, chainId) {
1632
+ const addr = String(address || "").trim();
1633
+ if (!addr) throw apiError("An address is required to screen a wallet.", { code: "bad_request" });
1634
+ const key = `${/^0x[0-9a-fA-F]+$/.test(addr) ? addr.toLowerCase() : addr}|${chainId ?? ""}`;
1635
+ const hit = screenCache.get(key);
1636
+ if (hit && Date.now() - hit.at < SCREEN_CACHE_TTL_MS) return hit.value;
1637
+ const inflight = screenInflight.get(key);
1638
+ if (inflight) return inflight;
1639
+ const request = apiRequest("/screen/wallet", {
1640
+ method: "POST",
1641
+ body: JSON.stringify(chainId == null ? { address: addr } : { address: addr, chainId }),
1642
+ timeoutMs: 12e3
1643
+ }).then((screen) => {
1644
+ if (!screen || typeof screen !== "object" || typeof screen.blocked !== "boolean") {
1645
+ throw apiError("Compliance screening returned an unusable result.", { code: "bad_response" });
1646
+ }
1647
+ const value = { ...screen, address: screen.address || addr };
1648
+ screenCache.set(key, { at: Date.now(), value });
1649
+ return value;
1650
+ }).finally(() => {
1651
+ screenInflight.delete(key);
1652
+ });
1653
+ screenInflight.set(key, request);
1654
+ return request;
1655
+ }
1656
+ return { apiRequest, fetchChains, fetchTokens, fetchRoutes, fetchRouteHealth, fetchQuote, screenWallet, apiBase };
1294
1657
  }
1295
1658
 
1296
1659
  // src/core/plan.ts
@@ -1358,7 +1721,36 @@ async function fetchPaymentPlan(api, request, payer, wallet = {}, readBalances)
1358
1721
  balanceTargets.push({ chainId: option.chainId, tokenAddress: option.address, decimals: option.decimals });
1359
1722
  }
1360
1723
  const walletBalances = readBalances ? await readBalances(payer, balanceTargets).catch(() => ({})) : {};
1361
- const candidates = options.filter((option) => option.direct);
1724
+ const directOptions = options.filter((option) => option.direct);
1725
+ let directCompliance = null;
1726
+ if (directOptions.length) {
1727
+ const parties = [];
1728
+ const seenParty = /* @__PURE__ */ new Set();
1729
+ for (const raw of [payer, destination.address]) {
1730
+ const addr = String(raw || "").trim();
1731
+ if (!addr) continue;
1732
+ const key = /^0x[0-9a-fA-F]+$/.test(addr) ? addr.toLowerCase() : addr;
1733
+ if (seenParty.has(key)) continue;
1734
+ seenParty.add(key);
1735
+ parties.push(addr);
1736
+ }
1737
+ try {
1738
+ const screens = await Promise.all(parties.map((address) => api.screenWallet(address, destination.chainId)));
1739
+ const blocked = screens.filter((screen) => screen.blocked);
1740
+ if (blocked.length) {
1741
+ const who = blocked.some((s) => s.address.toLowerCase() === payer.toLowerCase()) ? "your wallet" : "the recipient";
1742
+ const categories = [...new Set(blocked.flatMap((s) => s.blockingCategories ?? []))];
1743
+ throw apiError(
1744
+ `This payment was blocked by compliance screening \u2014 ${who} is ${blockLabelFor(categories)}. Choose a different recipient or connect a different wallet.`,
1745
+ { blocked: true, blockedCategory: categories[0] || "COMPLIANCE", blockedReason: categories.join(", ") }
1746
+ );
1747
+ }
1748
+ directCompliance = directComplianceFromScreens(screens);
1749
+ } catch (error) {
1750
+ if (error?.blocked) throw error;
1751
+ }
1752
+ }
1753
+ const candidates = directCompliance ? directOptions : [];
1362
1754
  const heldOptions = options.filter((option) => !option.direct && hasPositiveBalance(option, walletBalances));
1363
1755
  const heldKeys = new Set(heldOptions.map(optionBalanceKey));
1364
1756
  const seenChains = /* @__PURE__ */ new Set();
@@ -1378,7 +1770,7 @@ async function fetchPaymentPlan(api, request, payer, wallet = {}, readBalances)
1378
1770
  }
1379
1771
  const routeErrors = [];
1380
1772
  const routePromises = candidates.map(
1381
- (option) => buildRoute({ option, destination, destinationToken, chains, payer, fetchQuote: api.fetchQuote }).catch((error) => {
1773
+ (option) => buildRoute({ option, destination, destinationToken, chains, payer, fetchQuote: api.fetchQuote, compliance: option.direct ? directCompliance ?? void 0 : void 0 }).catch((error) => {
1382
1774
  routeErrors.push(error);
1383
1775
  return null;
1384
1776
  })
@@ -1969,18 +2361,24 @@ function createEngine(config = {}) {
1969
2361
  }
1970
2362
 
1971
2363
  exports.API_CACHE_TTL_MS = API_CACHE_TTL_MS;
2364
+ exports.BLOCK_LABEL_DEFAULT = BLOCK_LABEL_DEFAULT;
1972
2365
  exports.BUNDLED_NATIVE_SYMBOL = BUNDLED_NATIVE_SYMBOL;
1973
2366
  exports.BUNDLED_RPC = BUNDLED_RPC;
1974
2367
  exports.CANONICAL_DECIMALS = CANONICAL_DECIMALS;
1975
2368
  exports.CANONICAL_ESCROW = CANONICAL_ESCROW;
1976
2369
  exports.CANONICAL_INBOUND_BRIDGE = CANONICAL_INBOUND_BRIDGE;
1977
2370
  exports.CHAIN_DISPLAY_NAMES = CHAIN_DISPLAY_NAMES;
2371
+ exports.COMPLIANCE_CHECK_ORDER = COMPLIANCE_CHECK_ORDER;
2372
+ exports.COMPLIANCE_DENY_LABEL = COMPLIANCE_DENY_LABEL;
1978
2373
  exports.DEFAULT_WIDGET_API_BASE = DEFAULT_WIDGET_API_BASE;
2374
+ exports.DIRECT_CHECK_IDS = DIRECT_CHECK_IDS;
2375
+ exports.DIRECT_SCOPE_NOTE = DIRECT_SCOPE_NOTE;
1979
2376
  exports.ERC20_ALLOWANCE_SELECTOR = ERC20_ALLOWANCE_SELECTOR;
1980
2377
  exports.ERC20_APPROVE_SELECTOR = ERC20_APPROVE_SELECTOR;
1981
2378
  exports.ERC20_BALANCEOF_SELECTOR = ERC20_BALANCEOF_SELECTOR;
1982
2379
  exports.ERC20_TRANSFER_SELECTOR = ERC20_TRANSFER_SELECTOR;
1983
2380
  exports.EXECUTABLE_STABLE_ASSETS = EXECUTABLE_STABLE_ASSETS;
2381
+ exports.FLOOR_CATEGORIES = FLOOR_CATEGORIES;
1984
2382
  exports.LZ_FEE_BUFFER_BPS = LZ_FEE_BUFFER_BPS;
1985
2383
  exports.MAX_LZ_MSG_VALUE_WEI = MAX_LZ_MSG_VALUE_WEI;
1986
2384
  exports.MAX_LZ_MSG_VALUE_WEI_BY_CHAIN = MAX_LZ_MSG_VALUE_WEI_BY_CHAIN;
@@ -1991,6 +2389,8 @@ exports.NO_PARTNER_ID = NO_PARTNER_ID;
1991
2389
  exports.PREVIEW_OWNER = PREVIEW_OWNER;
1992
2390
  exports.QUOTE_BUFFER_BPS = QUOTE_BUFFER_BPS;
1993
2391
  exports.SAME_CLASS_STABLE = SAME_CLASS_STABLE;
2392
+ exports.SCREENING_BUCKETS = SCREENING_BUCKETS;
2393
+ exports.SCREEN_CACHE_TTL_MS = SCREEN_CACHE_TTL_MS;
1994
2394
  exports.STABLEGENIE_INTENT_TTL_MS = STABLEGENIE_INTENT_TTL_MS;
1995
2395
  exports.STABLEGENIE_INTENT_VERSION = STABLEGENIE_INTENT_VERSION;
1996
2396
  exports.STABLEGENIE_SUPPORTED_ASSETS = STABLEGENIE_SUPPORTED_ASSETS;
@@ -2000,6 +2400,7 @@ exports.SUBMIT_ORDER_SELECTOR = SUBMIT_ORDER_SELECTOR;
2000
2400
  exports.SUPPORTED_ASSETS = SUPPORTED_ASSETS;
2001
2401
  exports.SUPPORTED_CHAIN_IDS = SUPPORTED_CHAIN_IDS;
2002
2402
  exports.TRADEABLE_RWA_ASSETS = TRADEABLE_RWA_ASSETS;
2403
+ exports.TUNABLE_CATEGORIES = TUNABLE_CATEGORIES;
2003
2404
  exports.ZERO_ADDRESS = ZERO_ADDRESS;
2004
2405
  exports.addressWord = addressWord;
2005
2406
  exports.allowanceCovers = allowanceCovers;
@@ -2009,6 +2410,7 @@ exports.assertAddress = assertAddress;
2009
2410
  exports.assertQuoteMatchesSelection = assertQuoteMatchesSelection;
2010
2411
  exports.assetClassOf = assetClassOf;
2011
2412
  exports.assetDecimals = assetDecimals;
2413
+ exports.blockLabelFor = blockLabelFor;
2012
2414
  exports.brokenLaneFor = brokenLaneFor;
2013
2415
  exports.brokenLaneReason = brokenLaneReason;
2014
2416
  exports.buildCatalogue = buildCatalogue;
@@ -2018,12 +2420,20 @@ exports.buildSwapPlan = buildSwapPlan;
2018
2420
  exports.bytes32Word = bytes32Word;
2019
2421
  exports.bytesPayload = bytesPayload;
2020
2422
  exports.canAttachApiKey = canAttachApiKey;
2423
+ exports.categoryLabel = categoryLabel;
2021
2424
  exports.chainById = chainById;
2022
2425
  exports.chainNameOf = chainNameOf;
2023
2426
  exports.chainSelectable = chainSelectable;
2024
2427
  exports.checkEscrow = checkEscrow;
2025
2428
  exports.checkNativeFee = checkNativeFee;
2026
2429
  exports.classifyQuoteError = classifyQuoteError;
2430
+ exports.complianceChecks = complianceChecks;
2431
+ exports.complianceControlsEvaluated = complianceControlsEvaluated;
2432
+ exports.complianceControlsLine = complianceControlsLine;
2433
+ exports.complianceReasonHead = complianceReasonHead;
2434
+ exports.complianceReasonTag = complianceReasonTag;
2435
+ exports.complianceTagOf = complianceTagOf;
2436
+ exports.complianceView = complianceView;
2027
2437
  exports.counterpartTokens = counterpartTokens;
2028
2438
  exports.createApiClient = createApiClient;
2029
2439
  exports.createEngine = createEngine;
@@ -2031,6 +2441,8 @@ exports.createVerifier = createVerifier;
2031
2441
  exports.decodeSubmitOrderCalldata = decodeSubmitOrderCalldata;
2032
2442
  exports.destinationAvailability = destinationAvailability;
2033
2443
  exports.destinationKeys = destinationKeys;
2444
+ exports.directComplianceFromScreens = directComplianceFromScreens;
2445
+ exports.distinctScreenedWallets = distinctScreenedWallets;
2034
2446
  exports.encodeAllowance = encodeAllowance;
2035
2447
  exports.encodeApprove = encodeApprove;
2036
2448
  exports.encodeBalanceOf = encodeBalanceOf;
@@ -2045,6 +2457,7 @@ exports.formatNative = formatNative;
2045
2457
  exports.formatUnits = formatUnits;
2046
2458
  exports.hasReachableDestination = hasReachableDestination;
2047
2459
  exports.hubDeliverableSymbols = hubDeliverableSymbols;
2460
+ exports.humanizeComplianceReason = humanizeComplianceReason;
2048
2461
  exports.isAddress = isAddress;
2049
2462
  exports.isDeliverable = isDeliverable;
2050
2463
  exports.isExecutableBridge = isExecutableBridge;
@@ -2077,6 +2490,7 @@ exports.resolveConfig = resolveConfig;
2077
2490
  exports.resolveSwapReceiver = resolveSwapReceiver;
2078
2491
  exports.routeNativeValue = routeNativeValue;
2079
2492
  exports.scaleDecimals = scaleDecimals;
2493
+ exports.screeningOutcomeOf = screeningOutcomeOf;
2080
2494
  exports.solveExactIn = solveExactIn;
2081
2495
  exports.solveExactOut = solveExactOut;
2082
2496
  exports.sourceKeys = sourceKeys;
@@ -2090,6 +2504,7 @@ exports.tokenKey = tokenKey;
2090
2504
  exports.txMatchesPlan = txMatchesPlan;
2091
2505
  exports.uint64Word = uint64Word;
2092
2506
  exports.uintWord = uintWord;
2507
+ exports.unattributedComplianceReasons = unattributedComplianceReasons;
2093
2508
  exports.validateDestination = validateDestination;
2094
2509
  exports.validatePlannedTransaction = validatePlannedTransaction;
2095
2510
  exports.validateSwap = validateSwap;
@@ -1,5 +1,5 @@
1
- import { T as Token, Q as Quote, N as NormalizedOrder, i as PayOption, c as RouteResult, a as Chain, R as Route, C as Catalogue, F as FetchQuoteFn, j as SolveResult, O as OrderRequest, k as BalanceTarget, l as BalanceEntry, m as ApiClient, P as Plan, n as SwapInput, o as PlannedTx, p as Verifier, b as ExchangeProduct, d as TxHistoryEntry, S as SanitizedTxEntry, E as EngineConfig } from '../verify-34voZYj1.cjs';
2
- export { q as Address, r as ApiError, A as Availability, B as BrokenLane, s as CatalogueContext, t as CatalogueInput, D as Destination, H as Hex, u as PlannedTxKind, v as QuoteBlock, w as ResolvedConfig, x as RouteHealth, y as RouteHealthLane, z as TxPlan, V as VerifyResult, G as apiError, e as assetClassOf, I as brokenLaneFor, f as brokenLaneReason, J as buildCatalogue, K as canAttachApiKey, L as classifyQuoteError, g as counterpartTokens, M as createApiClient, U as createVerifier, h as destinationAvailability, W as destinationKeys, X as executableRoutes, Y as executionChainIds, Z as hasReachableDestination, _ as hubDeliverableSymbols, $ as isExecutableBridge, a0 as isKnownUnbridgeable, a1 as isSourceToken, a2 as laneKey, a3 as laneKeys, a4 as parseAllowedApiBase, a5 as productAssets, a6 as registryRpc, a7 as resolveApiBase, a8 as resolveConfig, a9 as sourceKeys, aa as suppressedLanes, ab as tokenKey, ac as txMatchesPlan } from '../verify-34voZYj1.cjs';
1
+ import { T as Token, Q as Quote, N as NormalizedOrder, q as PayOption, g as RouteResult, b as Chain, R as Route, a as Catalogue, F as FetchQuoteFn, r as SolveResult, O as OrderRequest, C as Compliance, s as BalanceTarget, t as BalanceEntry, u as ApiClient, P as Plan, v as SwapInput, w as PlannedTx, x as Verifier, f as ExchangeProduct, h as TxHistoryEntry, S as SanitizedTxEntry, E as EngineConfig } from '../verify-C9vzpm4T.cjs';
2
+ export { y as Address, z as ApiError, A as Availability, D as BLOCK_LABEL_DEFAULT, B as BrokenLane, G as COMPLIANCE_CHECK_ORDER, H as COMPLIANCE_DENY_LABEL, I as CatalogueContext, J as CatalogueInput, c as ComplianceCheck, K as ComplianceCheckId, L as ComplianceDecision, d as ComplianceTone, e as ComplianceView, M as DIRECT_CHECK_IDS, U as DIRECT_SCOPE_NOTE, X as Destination, Y as FLOOR_CATEGORIES, Z as Hex, _ as PlannedTxKind, $ as QuoteBlock, a0 as ResolvedConfig, a1 as RouteHealth, a2 as RouteHealthLane, a3 as SCREENING_BUCKETS, a4 as ScreenProvider, a5 as ScreeningBucket, a6 as ScreeningOutcome, a7 as TUNABLE_CATEGORIES, a8 as TxPlan, V as VerifyResult, W as WalletScreen, a9 as apiError, i as assetClassOf, aa as blockLabelFor, ab as brokenLaneFor, j as brokenLaneReason, ac as buildCatalogue, ad as canAttachApiKey, ae as categoryLabel, af as classifyQuoteError, k as complianceChecks, ag as complianceControlsEvaluated, l as complianceControlsLine, ah as complianceReasonHead, ai as complianceReasonTag, aj as complianceTagOf, m as complianceView, n as counterpartTokens, ak as createApiClient, al as createVerifier, o as destinationAvailability, am as destinationKeys, an as directComplianceFromScreens, ao as distinctScreenedWallets, ap as executableRoutes, aq as executionChainIds, ar as hasReachableDestination, as as hubDeliverableSymbols, p as humanizeComplianceReason, at as isExecutableBridge, au as isKnownUnbridgeable, av as isSourceToken, aw as laneKey, ax as laneKeys, ay as parseAllowedApiBase, az as productAssets, aA as registryRpc, aB as resolveApiBase, aC as resolveConfig, aD as screeningOutcomeOf, aE as sourceKeys, aF as suppressedLanes, aG as tokenKey, aH as txMatchesPlan, aI as unattributedComplianceReasons } from '../verify-C9vzpm4T.cjs';
3
3
 
4
4
  /** Default request base for the widget: the same-origin keyless custody proxy (server injects the
5
5
  * ZeroDelta key). A host may override to `/api/v1` + an apiKey for the demo-first fallback path. */
@@ -11,6 +11,15 @@ declare const TRADEABLE_RWA_ASSETS: ReadonlySet<string>;
11
11
  /** Everything the engine may price. The catalogue narrows this per product; see availability.ts. */
12
12
  declare const SUPPORTED_ASSETS: ReadonlySet<string>;
13
13
  declare const API_CACHE_TTL_MS = 60000;
14
+ /**
15
+ * How long one wallet's KYW verdict is held.
16
+ *
17
+ * Longer than the resource cache on purpose: a screening verdict is a property of the ADDRESS, not
18
+ * of the current market, so re-asking every minute buys nothing and every miss costs a provider
19
+ * bill plus an audit row upstream (see api.ts `screenWallet`). Five minutes matches the dApp's own
20
+ * `staleTime` for the same call, so the two products re-screen on the same cadence.
21
+ */
22
+ declare const SCREEN_CACHE_TTL_MS: number;
14
23
  declare const MAX_QUOTE_CANDIDATES = 8;
15
24
  declare const QUOTE_BUFFER_BPS = 50;
16
25
  declare const LZ_FEE_BUFFER_BPS = 1500n;
@@ -285,8 +294,16 @@ interface BuildRouteArgs {
285
294
  fetchQuote: FetchQuoteFn;
286
295
  solve?: typeof solveExactOut;
287
296
  amountInRaw?: string | bigint;
297
+ /**
298
+ * The compliance verdict for a DIRECT route, synthesized from standalone wallet screens.
299
+ *
300
+ * Only ever set on the direct path: a routed quote carries the gateway's own decision on the
301
+ * response. Absent here means the route has no verdict to show, which the panel states as
302
+ * "no decision returned" rather than rendering as passed.
303
+ */
304
+ compliance?: Compliance;
288
305
  }
289
- declare function buildRoute({ option, destination, destinationToken, chains, payer, fetchQuote, solve, amountInRaw }: BuildRouteArgs): Promise<RouteResult>;
306
+ declare function buildRoute({ option, destination, destinationToken, chains, payer, fetchQuote, solve, amountInRaw, compliance }: BuildRouteArgs): Promise<RouteResult>;
290
307
 
291
308
  interface PayRequest {
292
309
  address: string;
@@ -484,4 +501,4 @@ interface Engine {
484
501
  /** Create an engine bound to a config. The 60s resource cache is per-engine. */
485
502
  declare function createEngine(config?: EngineConfig): Engine;
486
503
 
487
- export { API_CACHE_TTL_MS, ApiClient, type AssertQuoteArgs, BUNDLED_NATIVE_SYMBOL, BUNDLED_RPC, BalanceEntry, type BalanceReader, BalanceTarget, type BuildPayOptionsArgs, type BuildRouteArgs, CANONICAL_DECIMALS, CANONICAL_ESCROW, CANONICAL_INBOUND_BRIDGE, CHAIN_DISPLAY_NAMES, Catalogue, Chain, DEFAULT_WIDGET_API_BASE, type DecodedOrderRequest, type DecodedSubmitOrder, ERC20_ALLOWANCE_SELECTOR, ERC20_APPROVE_SELECTOR, ERC20_BALANCEOF_SELECTOR, ERC20_TRANSFER_SELECTOR, EXECUTABLE_STABLE_ASSETS, type Engine, EngineConfig, ExchangeProduct, FetchQuoteFn, LZ_FEE_BUFFER_BPS, MAX_LZ_MSG_VALUE_WEI, MAX_LZ_MSG_VALUE_WEI_BY_CHAIN, MAX_QUOTE_CANDIDATES, MAX_SAME_CLASS_PAY_BPS, MAX_UINT64, NO_PARTNER_ID, type NativeFeeCheck, NormalizedOrder, OrderRequest, PREVIEW_OWNER, PayOption, type PayRequest, type PaymentWalletContext, Plan, PlannedTx, QUOTE_BUFFER_BPS, Quote, Route, RouteResult, SAME_CLASS_STABLE, STABLEGENIE_INTENT_TTL_MS, STABLEGENIE_INTENT_VERSION, STABLEGENIE_SUPPORTED_ASSETS, STABLEGENIE_SUPPORTED_CHAIN_IDS, STABLE_ASSETS, SUBMIT_ORDER_SELECTOR, SUPPORTED_ASSETS, SUPPORTED_CHAIN_IDS, SanitizedTxEntry, type SolveArgs, SolveResult, SwapInput, type SwapPreview, TRADEABLE_RWA_ASSETS, Token, TxHistoryEntry, type ValidatedSwap, Verifier, ZERO_ADDRESS, addressWord, allowanceCovers, applyLayerZeroBuffer, assertAddress, assertQuoteMatchesSelection, assetDecimals, buildPayOptions, buildRoute, buildSwapPlan, bytes32Word, bytesPayload, chainById, chainNameOf, chainSelectable, checkEscrow, checkNativeFee, createEngine, decodeSubmitOrderCalldata, encodeAllowance, encodeApprove, encodeBalanceOf, encodeSubmitOrder, encodeTransfer, fetchPaymentPlan, finalOf, findToken, formatNative, formatUnits, isAddress, isDeliverable, isHexAddress, isHexData, isHexQuantity, isLayerZeroRoute, maxNativeFeeWei, nativeFeeShortLabel, nativeFeeShortMessage, nativeSymbol, normalizeAddress, normalizeDecimalText, normalizeOrderRequest, normalizeOrderRequests, parseUnitsDecimal, planErrorSummary, planMsgValueHex, quoteSwapPreview, requiresNativeBridgeFee, resolveSwapReceiver, routeNativeValue, scaleDecimals, solveExactIn, solveExactOut, stableGenieIntentSchema, strip0x, symbolKey, toHexQuantity, tokenEnabled, uint64Word, uintWord, validateDestination, validatePlannedTransaction, validateSwap };
504
+ export { API_CACHE_TTL_MS, ApiClient, type AssertQuoteArgs, BUNDLED_NATIVE_SYMBOL, BUNDLED_RPC, BalanceEntry, type BalanceReader, BalanceTarget, type BuildPayOptionsArgs, type BuildRouteArgs, CANONICAL_DECIMALS, CANONICAL_ESCROW, CANONICAL_INBOUND_BRIDGE, CHAIN_DISPLAY_NAMES, Catalogue, Chain, Compliance, DEFAULT_WIDGET_API_BASE, type DecodedOrderRequest, type DecodedSubmitOrder, ERC20_ALLOWANCE_SELECTOR, ERC20_APPROVE_SELECTOR, ERC20_BALANCEOF_SELECTOR, ERC20_TRANSFER_SELECTOR, EXECUTABLE_STABLE_ASSETS, type Engine, EngineConfig, ExchangeProduct, FetchQuoteFn, LZ_FEE_BUFFER_BPS, MAX_LZ_MSG_VALUE_WEI, MAX_LZ_MSG_VALUE_WEI_BY_CHAIN, MAX_QUOTE_CANDIDATES, MAX_SAME_CLASS_PAY_BPS, MAX_UINT64, NO_PARTNER_ID, type NativeFeeCheck, NormalizedOrder, OrderRequest, PREVIEW_OWNER, PayOption, type PayRequest, type PaymentWalletContext, Plan, PlannedTx, QUOTE_BUFFER_BPS, Quote, Route, RouteResult, SAME_CLASS_STABLE, SCREEN_CACHE_TTL_MS, STABLEGENIE_INTENT_TTL_MS, STABLEGENIE_INTENT_VERSION, STABLEGENIE_SUPPORTED_ASSETS, STABLEGENIE_SUPPORTED_CHAIN_IDS, STABLE_ASSETS, SUBMIT_ORDER_SELECTOR, SUPPORTED_ASSETS, SUPPORTED_CHAIN_IDS, SanitizedTxEntry, type SolveArgs, SolveResult, SwapInput, type SwapPreview, TRADEABLE_RWA_ASSETS, Token, TxHistoryEntry, type ValidatedSwap, Verifier, ZERO_ADDRESS, addressWord, allowanceCovers, applyLayerZeroBuffer, assertAddress, assertQuoteMatchesSelection, assetDecimals, buildPayOptions, buildRoute, buildSwapPlan, bytes32Word, bytesPayload, chainById, chainNameOf, chainSelectable, checkEscrow, checkNativeFee, createEngine, decodeSubmitOrderCalldata, encodeAllowance, encodeApprove, encodeBalanceOf, encodeSubmitOrder, encodeTransfer, fetchPaymentPlan, finalOf, findToken, formatNative, formatUnits, isAddress, isDeliverable, isHexAddress, isHexData, isHexQuantity, isLayerZeroRoute, maxNativeFeeWei, nativeFeeShortLabel, nativeFeeShortMessage, nativeSymbol, normalizeAddress, normalizeDecimalText, normalizeOrderRequest, normalizeOrderRequests, parseUnitsDecimal, planErrorSummary, planMsgValueHex, quoteSwapPreview, requiresNativeBridgeFee, resolveSwapReceiver, routeNativeValue, scaleDecimals, solveExactIn, solveExactOut, stableGenieIntentSchema, strip0x, symbolKey, toHexQuantity, tokenEnabled, uint64Word, uintWord, validateDestination, validatePlannedTransaction, validateSwap };