@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.
@@ -1,3 +1,206 @@
1
+ /** The engine's decision on the wallet pair. `ALLOW` still permits `flaggedCategories`. */
2
+ type ComplianceDecision = "ALLOW" | "DENY" | "REVIEW" | "REMEDIATE";
3
+ /**
4
+ * The compliance object the gateway attaches to a quote (domain.Compliance in
5
+ * zd-bebop-lite `api/internal/domain/quote.go`).
6
+ *
7
+ * ⚠️ `riskCategories` / `flaggedCategories` / `blockingCategories` / `reasons` are
8
+ * DISCLOSURE-GATED upstream: the gateway withholds them unless its reason-disclosure mode is
9
+ * "all", because naming a sanctions category back to the subject can amount to tipping off. Their
10
+ * absence therefore means "not disclosed to this key", NEVER "none found" — no surface may render
11
+ * an empty list as an all-clear.
12
+ */
13
+ interface Compliance {
14
+ status?: "SCREENED" | "UNSCREENED" | string;
15
+ decision?: ComplianceDecision | string;
16
+ screenedWallets?: string[];
17
+ sourceJurisdiction?: string;
18
+ appliedPolicyIds?: string[];
19
+ appliedPolicyNames?: string[];
20
+ appliedLegislation?: string[];
21
+ riskCategories?: string[];
22
+ flaggedCategories?: string[];
23
+ blockingCategories?: string[];
24
+ reasons?: string[];
25
+ policyVersion?: string;
26
+ checkId?: string;
27
+ expiresAt?: string;
28
+ }
29
+ /** One screening source's contribution. The vendor is never named — reason about `tier`. */
30
+ interface ScreenProvider {
31
+ providerId?: string;
32
+ tier?: string;
33
+ categories?: string[];
34
+ riskScore?: number;
35
+ }
36
+ /** A standalone /screen/wallet verdict — the direct-settlement path's gate. */
37
+ interface WalletScreen {
38
+ address: string;
39
+ network?: string;
40
+ riskScore?: number;
41
+ riskCategories?: string[];
42
+ blocked: boolean;
43
+ blockingCategories?: string[];
44
+ flaggedCategories?: string[];
45
+ providers?: ScreenProvider[];
46
+ checkedAt?: string;
47
+ }
48
+ type ComplianceTone = "ok" | "warn" | "blocked" | "neutral";
49
+ /** THE copy for a DENY, in one place — shared by the chip and the panel headline. */
50
+ declare const COMPLIANCE_DENY_LABEL = "Compliance check failed";
51
+ interface ComplianceView {
52
+ tone: ComplianceTone;
53
+ /** Short line for the chip. */
54
+ label: string;
55
+ /** Headline for the detail panel. */
56
+ headline: string;
57
+ /** True only for an explicit DENY — never inferred from an absence. */
58
+ blocked: boolean;
59
+ /** REVIEW / REMEDIATE: allowed to proceed, but the payer should know. */
60
+ needsAction: boolean;
61
+ /** The engine actually screened wallets for this payment. */
62
+ screened: boolean;
63
+ }
64
+ /**
65
+ * What the decision means, in the words a payer can act on.
66
+ *
67
+ * The four-way split exists because an ABSENT decision and a FAILED one are different facts and
68
+ * used to be rendered the same. A gateway with no compliance gate configured returns no
69
+ * `compliance` object at all; calling that "checks failed" is alarmist and calling it "checks
70
+ * passed" is a lie. It is stated as absent.
71
+ */
72
+ declare function complianceView(compliance: Compliance | null | undefined, hasQuote?: boolean): ComplianceView;
73
+ /** Display name of one engine risk category. */
74
+ declare function categoryLabel(code: string): string;
75
+ /** The bare reason "head" — everything before the first ':', bundle prefix removed. */
76
+ declare function complianceReasonHead(raw: string): string;
77
+ /**
78
+ * A machine reason code as a sentence a payer can act on.
79
+ *
80
+ * Unknown heads degrade to a lightly cleaned form of the raw code rather than being dropped: a
81
+ * blocked payer with a blank reason is the worst outcome this function can produce.
82
+ */
83
+ declare function humanizeComplianceReason(raw: string): string;
84
+ type ComplianceCheckId = "location" | "screening" | "risk" | "asset" | "limits";
85
+ interface ComplianceCheck {
86
+ id: ComplianceCheckId;
87
+ label: string;
88
+ ok: boolean;
89
+ /** Raw engine reason codes attributed to this control. Humanize for display. */
90
+ reasons: string[];
91
+ /** Evidence sub-line, e.g. "2 wallets screened" or the single screened address. */
92
+ note?: string;
93
+ }
94
+ /** The row order the panel renders. */
95
+ declare const COMPLIANCE_CHECK_ORDER: readonly ComplianceCheckId[];
96
+ /**
97
+ * The DISTINCT wallets the engine screened, in the order it listed them.
98
+ *
99
+ * The engine reports the order's owner and its destination receiver, so a payment that settles
100
+ * back to the sender arrives as the SAME address twice — counting the array would print "2 wallets
101
+ * screened" for a payment with one party in it. Folding is family-dependent: hex compares
102
+ * case-insensitively (EIP-55 casing is a checksum, not an identity), anything else — a base58
103
+ * Solana key — compares EXACTLY, because lowercasing base58 merges genuinely different wallets.
104
+ */
105
+ declare function distinctScreenedWallets(compliance: Compliance | null | undefined): string[];
106
+ /**
107
+ * The 5-control checklist, derived from evidence only.
108
+ *
109
+ * Returns `[]` when no decision was issued (`tone === "neutral"`). That is the non-negotiable
110
+ * part: five green ticks for a verdict nobody issued is exactly the failure this module exists to
111
+ * prevent, and an unconfigured gate is not a set of passed checks — the caller renders the
112
+ * headline alone in that case.
113
+ *
114
+ * ► Documented reading of an ambiguous case. When a decision IS issued, a control that no reason
115
+ * names is reported as passed: the engine accumulates `reasons` as a plural SET (the list of
116
+ * causes, not the first cause), so an unnamed control is one that ran without firing. The one
117
+ * place we refuse to infer is `screening`, asserted from the status field alone.
118
+ */
119
+ declare function complianceChecks(compliance: Compliance | null | undefined, cv?: ComplianceView): ComplianceCheck[];
120
+ /** Reasons the checklist did not claim, so a reason is never silently dropped. */
121
+ declare function unattributedComplianceReasons(compliance: Compliance | null | undefined, cv?: ComplianceView): string[];
122
+ /**
123
+ * How many controls this decision actually evidences.
124
+ *
125
+ * Nothing on the payload carries a control count, so a literal number would be fabricated in the
126
+ * one panel a payer reads as reassurance. What we CAN count is the checklist controls we are
127
+ * willing to assert plus every named overlay the decision reports it applied. Deduped
128
+ * case-insensitively so an overlay listed twice is not counted twice.
129
+ */
130
+ declare function complianceControlsEvaluated(compliance: Compliance | null | undefined, cv?: ComplianceView): number;
131
+ /** The summary sentence the chip and the panel share, so they cannot word the same fact differently. */
132
+ declare function complianceControlsLine(compliance: Compliance | null | undefined, cv?: ComplianceView): string;
133
+ /**
134
+ * Synthesize the quote-shaped compliance object for a DIRECT settlement, from the standalone
135
+ * wallet screens of the two parties.
136
+ *
137
+ * A direct transfer never touches /quote — it is a plain ERC-20 `transfer` from payer to merchant
138
+ * — so the gateway's own pre-quote gate cannot run on it and the payment would otherwise settle
139
+ * with NO screening whatsoever. `plan.ts` screens both parties explicitly and passes the verdicts
140
+ * here so the panel states the truth about what ran.
141
+ *
142
+ * ⚠️ It reports `decision: "ALLOW"` ONLY when every screen came back not-blocked, and the caller
143
+ * must have already refused to build the route otherwise. Note what this decision is NOT: a
144
+ * standalone wallet screen answers "is this address on a list", so `location`, `asset` and
145
+ * `limits` were NOT evaluated — the jurisdiction/corridor/amount controls live in the quote gate,
146
+ * which a direct transfer never reaches. Those rows are reported as not-evaluated rather than
147
+ * passed, because claiming a control ran when it did not is the one failure mode this whole module
148
+ * is built to avoid.
149
+ */
150
+ declare function directComplianceFromScreens(screens: WalletScreen[]): Compliance;
151
+ /**
152
+ * The controls a DIRECT settlement can evidence.
153
+ *
154
+ * `complianceChecks` reports an unnamed control as passed, which is the right reading for a quote
155
+ * decision (the engine ran every control and named the ones that fired) and the WRONG one here:
156
+ * a wallet screen evaluated neither jurisdiction, nor the asset pair, nor the amount. This narrows
157
+ * the list to the two rows a screen genuinely evidences rather than printing five green ticks for
158
+ * three controls that never ran.
159
+ */
160
+ declare const DIRECT_CHECK_IDS: readonly ComplianceCheckId[];
161
+ /** The sub-line explaining what a direct settlement did NOT evaluate. Stated, never omitted. */
162
+ declare const 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.";
163
+ declare const BLOCK_LABEL_DEFAULT = "flagged by compliance screening";
164
+ /**
165
+ * The phrase for a block, from whichever categories the engine disclosed.
166
+ *
167
+ * An empty list is the NORMAL case, not an error: categories are disclosure-gated upstream and are
168
+ * withheld from most keys precisely because naming a sanctions hit back to its subject can amount
169
+ * to tipping off. The generic default is therefore the designed outcome, never a fallback that
170
+ * signals something went wrong.
171
+ */
172
+ declare function blockLabelFor(categories: readonly string[]): string;
173
+ /**
174
+ * Short tag for a reason code — "Restricted country" where `humanizeComplianceReason` returns
175
+ * "Your region (CU) isn't supported." Same head grammar, different register: this is for the
176
+ * compact sub-line, the humanizer wherever there is room for a sentence.
177
+ */
178
+ declare function complianceReasonTag(raw: string): string;
179
+ /** The tag for a decision — the first reason that has one. Empty when there is nothing to say. */
180
+ declare function complianceTagOf(compliance: Compliance | null | undefined): string;
181
+ /** `always-blocked` is the floor; `blocked` and `flagged` are the two settings a tunable may hold. */
182
+ type ScreeningOutcome = "always-blocked" | "blocked" | "flagged";
183
+ /**
184
+ * The four NON-WEAKENABLE categories. The engine answers 422 `MATRIX_NOT_WEAKENABLE` to any policy
185
+ * that tries to soften one, so "always blocked" is a guarantee of the engine rather than a property
186
+ * of whichever policy happens to be active — which is why this half is derived, not transcribed.
187
+ */
188
+ declare const FLOOR_CATEGORIES: readonly string[];
189
+ /** Categories a policy MAY tune between BLOCK and FLAG. */
190
+ declare const TUNABLE_CATEGORIES: readonly string[];
191
+ /** The outcome one category carries, or `null` when this build cannot say — dropped, never guessed. */
192
+ declare function screeningOutcomeOf(category: string): ScreeningOutcome | null;
193
+ interface ScreeningBucket {
194
+ outcome: ScreeningOutcome;
195
+ /** The card heading. */
196
+ title: string;
197
+ /** One line saying what the outcome does to an order. */
198
+ detail: string;
199
+ categories: readonly string[];
200
+ }
201
+ /** The three groups, in escalating-permissiveness order. Mirrors the dApp's `SCREENING_BUCKETS`. */
202
+ declare const SCREENING_BUCKETS: readonly ScreeningBucket[];
203
+
1
204
  type Hex = `0x${string}`;
2
205
  type Address = `0x${string}`;
3
206
  interface Chain {
@@ -85,6 +288,8 @@ interface Quote {
85
288
  estimatedDuration?: number;
86
289
  gasCostSource?: string;
87
290
  gasCostDest?: string;
291
+ /** The gateway's compliance decision for this quote's wallet pair. Absent = gate not configured. */
292
+ compliance?: Compliance;
88
293
  escrowAddress?: string;
89
294
  /** Escrow on the execution chain. Informational: approve/submitOrder go to the SOURCE-chain
90
295
  * escrow, which is what checkEscrow binds. */
@@ -167,6 +372,17 @@ interface RouteResult {
167
372
  msgValue?: string;
168
373
  deadline?: string;
169
374
  iterations: number;
375
+ /**
376
+ * The gateway's compliance decision for THIS route's wallet pair.
377
+ *
378
+ * ⚠️ This projection used to drop it, which is why the widget could not say anything about a
379
+ * control that had already run: the payer saw a price and no evidence. It is carried verbatim
380
+ * — the panel derives, it never invents (see core/compliance.ts).
381
+ *
382
+ * Absent when the gateway has no compliance gate configured. Absent is NOT "passed": the view
383
+ * renders that case as "no decision returned" rather than as green ticks.
384
+ */
385
+ compliance?: Compliance;
170
386
  };
171
387
  }
172
388
  interface Destination {
@@ -575,6 +791,14 @@ interface ApiClient {
575
791
  /** Measured lane health. NEVER rejects — see the implementation. */
576
792
  fetchRouteHealth: () => Promise<RouteHealth | null>;
577
793
  fetchQuote: (body: Record<string, unknown>, retries?: number) => Promise<Quote>;
794
+ /**
795
+ * Standalone KYW screen of ONE address — the direct-settlement gate.
796
+ *
797
+ * ⚠️ Rejects rather than resolving to a benign verdict. The caller MUST fail closed: a screen
798
+ * that could not complete is not a clean wallet, and this is the only control standing between a
799
+ * direct ERC-20 transfer and a sanctioned counterparty.
800
+ */
801
+ screenWallet: (address: string, chainId?: number) => Promise<WalletScreen>;
578
802
  apiBase: string;
579
803
  }
580
804
  /** Build an API client bound to a resolved config. The 60s resource cache is per-instance. */
@@ -628,4 +852,4 @@ interface Verifier {
628
852
  }
629
853
  declare function createVerifier(api: ApiClient, fetchImpl: typeof fetch, rpcOverrides?: Record<number, string>): Verifier;
630
854
 
631
- export { isExecutableBridge as $, type Availability as A, type BrokenLane as B, type Catalogue as C, type Destination as D, type EngineConfig as E, type FetchQuoteFn as F, apiError as G, type Hex as H, brokenLaneFor as I, buildCatalogue as J, canAttachApiKey as K, classifyQuoteError as L, createApiClient as M, type NormalizedOrder as N, type OrderRequest as O, type Plan as P, type Quote as Q, type Route as R, type SanitizedTxEntry as S, type Token as T, createVerifier as U, type VerifyResult as V, destinationKeys as W, executableRoutes as X, executionChainIds as Y, hasReachableDestination as Z, hubDeliverableSymbols as _, type Chain as a, isKnownUnbridgeable as a0, isSourceToken as a1, laneKey as a2, laneKeys as a3, parseAllowedApiBase as a4, productAssets as a5, registryRpc as a6, resolveApiBase as a7, resolveConfig as a8, sourceKeys as a9, suppressedLanes as aa, tokenKey as ab, txMatchesPlan as ac, type ExchangeProduct as b, type RouteResult as c, type TxHistoryEntry as d, assetClassOf as e, brokenLaneReason as f, counterpartTokens as g, destinationAvailability as h, type PayOption as i, type SolveResult as j, type BalanceTarget as k, type BalanceEntry as l, type ApiClient as m, type SwapInput as n, type PlannedTx as o, type Verifier as p, type Address as q, type ApiError as r, type CatalogueContext as s, type CatalogueInput as t, type PlannedTxKind as u, type QuoteBlock as v, type ResolvedConfig as w, type RouteHealth as x, type RouteHealthLane as y, type TxPlan as z };
855
+ export { type QuoteBlock as $, type Availability as A, type BrokenLane as B, type Compliance as C, BLOCK_LABEL_DEFAULT as D, type EngineConfig as E, type FetchQuoteFn as F, COMPLIANCE_CHECK_ORDER as G, COMPLIANCE_DENY_LABEL as H, type CatalogueContext as I, type CatalogueInput as J, type ComplianceCheckId as K, type ComplianceDecision as L, DIRECT_CHECK_IDS as M, type NormalizedOrder as N, type OrderRequest as O, type Plan as P, type Quote as Q, type Route as R, type SanitizedTxEntry as S, type Token as T, DIRECT_SCOPE_NOTE as U, type VerifyResult as V, type WalletScreen as W, type Destination as X, FLOOR_CATEGORIES as Y, type Hex as Z, type PlannedTxKind as _, type Catalogue as a, type ResolvedConfig as a0, type RouteHealth as a1, type RouteHealthLane as a2, SCREENING_BUCKETS as a3, type ScreenProvider as a4, type ScreeningBucket as a5, type ScreeningOutcome as a6, TUNABLE_CATEGORIES as a7, type TxPlan as a8, apiError as a9, registryRpc as aA, resolveApiBase as aB, resolveConfig as aC, screeningOutcomeOf as aD, sourceKeys as aE, suppressedLanes as aF, tokenKey as aG, txMatchesPlan as aH, unattributedComplianceReasons as aI, blockLabelFor as aa, brokenLaneFor as ab, buildCatalogue as ac, canAttachApiKey as ad, categoryLabel as ae, classifyQuoteError as af, complianceControlsEvaluated as ag, complianceReasonHead as ah, complianceReasonTag as ai, complianceTagOf as aj, createApiClient as ak, createVerifier as al, destinationKeys as am, directComplianceFromScreens as an, distinctScreenedWallets as ao, executableRoutes as ap, executionChainIds as aq, hasReachableDestination as ar, hubDeliverableSymbols as as, isExecutableBridge as at, isKnownUnbridgeable as au, isSourceToken as av, laneKey as aw, laneKeys as ax, parseAllowedApiBase as ay, productAssets as az, type Chain as b, type ComplianceCheck as c, type ComplianceTone as d, type ComplianceView as e, type ExchangeProduct as f, type RouteResult as g, type TxHistoryEntry as h, assetClassOf as i, brokenLaneReason as j, complianceChecks as k, complianceControlsLine as l, complianceView as m, counterpartTokens as n, destinationAvailability as o, humanizeComplianceReason as p, type PayOption as q, type SolveResult as r, type BalanceTarget as s, type BalanceEntry as t, type ApiClient as u, type SwapInput as v, type PlannedTx as w, type Verifier as x, type Address as y, type ApiError as z };
@@ -1,3 +1,206 @@
1
+ /** The engine's decision on the wallet pair. `ALLOW` still permits `flaggedCategories`. */
2
+ type ComplianceDecision = "ALLOW" | "DENY" | "REVIEW" | "REMEDIATE";
3
+ /**
4
+ * The compliance object the gateway attaches to a quote (domain.Compliance in
5
+ * zd-bebop-lite `api/internal/domain/quote.go`).
6
+ *
7
+ * ⚠️ `riskCategories` / `flaggedCategories` / `blockingCategories` / `reasons` are
8
+ * DISCLOSURE-GATED upstream: the gateway withholds them unless its reason-disclosure mode is
9
+ * "all", because naming a sanctions category back to the subject can amount to tipping off. Their
10
+ * absence therefore means "not disclosed to this key", NEVER "none found" — no surface may render
11
+ * an empty list as an all-clear.
12
+ */
13
+ interface Compliance {
14
+ status?: "SCREENED" | "UNSCREENED" | string;
15
+ decision?: ComplianceDecision | string;
16
+ screenedWallets?: string[];
17
+ sourceJurisdiction?: string;
18
+ appliedPolicyIds?: string[];
19
+ appliedPolicyNames?: string[];
20
+ appliedLegislation?: string[];
21
+ riskCategories?: string[];
22
+ flaggedCategories?: string[];
23
+ blockingCategories?: string[];
24
+ reasons?: string[];
25
+ policyVersion?: string;
26
+ checkId?: string;
27
+ expiresAt?: string;
28
+ }
29
+ /** One screening source's contribution. The vendor is never named — reason about `tier`. */
30
+ interface ScreenProvider {
31
+ providerId?: string;
32
+ tier?: string;
33
+ categories?: string[];
34
+ riskScore?: number;
35
+ }
36
+ /** A standalone /screen/wallet verdict — the direct-settlement path's gate. */
37
+ interface WalletScreen {
38
+ address: string;
39
+ network?: string;
40
+ riskScore?: number;
41
+ riskCategories?: string[];
42
+ blocked: boolean;
43
+ blockingCategories?: string[];
44
+ flaggedCategories?: string[];
45
+ providers?: ScreenProvider[];
46
+ checkedAt?: string;
47
+ }
48
+ type ComplianceTone = "ok" | "warn" | "blocked" | "neutral";
49
+ /** THE copy for a DENY, in one place — shared by the chip and the panel headline. */
50
+ declare const COMPLIANCE_DENY_LABEL = "Compliance check failed";
51
+ interface ComplianceView {
52
+ tone: ComplianceTone;
53
+ /** Short line for the chip. */
54
+ label: string;
55
+ /** Headline for the detail panel. */
56
+ headline: string;
57
+ /** True only for an explicit DENY — never inferred from an absence. */
58
+ blocked: boolean;
59
+ /** REVIEW / REMEDIATE: allowed to proceed, but the payer should know. */
60
+ needsAction: boolean;
61
+ /** The engine actually screened wallets for this payment. */
62
+ screened: boolean;
63
+ }
64
+ /**
65
+ * What the decision means, in the words a payer can act on.
66
+ *
67
+ * The four-way split exists because an ABSENT decision and a FAILED one are different facts and
68
+ * used to be rendered the same. A gateway with no compliance gate configured returns no
69
+ * `compliance` object at all; calling that "checks failed" is alarmist and calling it "checks
70
+ * passed" is a lie. It is stated as absent.
71
+ */
72
+ declare function complianceView(compliance: Compliance | null | undefined, hasQuote?: boolean): ComplianceView;
73
+ /** Display name of one engine risk category. */
74
+ declare function categoryLabel(code: string): string;
75
+ /** The bare reason "head" — everything before the first ':', bundle prefix removed. */
76
+ declare function complianceReasonHead(raw: string): string;
77
+ /**
78
+ * A machine reason code as a sentence a payer can act on.
79
+ *
80
+ * Unknown heads degrade to a lightly cleaned form of the raw code rather than being dropped: a
81
+ * blocked payer with a blank reason is the worst outcome this function can produce.
82
+ */
83
+ declare function humanizeComplianceReason(raw: string): string;
84
+ type ComplianceCheckId = "location" | "screening" | "risk" | "asset" | "limits";
85
+ interface ComplianceCheck {
86
+ id: ComplianceCheckId;
87
+ label: string;
88
+ ok: boolean;
89
+ /** Raw engine reason codes attributed to this control. Humanize for display. */
90
+ reasons: string[];
91
+ /** Evidence sub-line, e.g. "2 wallets screened" or the single screened address. */
92
+ note?: string;
93
+ }
94
+ /** The row order the panel renders. */
95
+ declare const COMPLIANCE_CHECK_ORDER: readonly ComplianceCheckId[];
96
+ /**
97
+ * The DISTINCT wallets the engine screened, in the order it listed them.
98
+ *
99
+ * The engine reports the order's owner and its destination receiver, so a payment that settles
100
+ * back to the sender arrives as the SAME address twice — counting the array would print "2 wallets
101
+ * screened" for a payment with one party in it. Folding is family-dependent: hex compares
102
+ * case-insensitively (EIP-55 casing is a checksum, not an identity), anything else — a base58
103
+ * Solana key — compares EXACTLY, because lowercasing base58 merges genuinely different wallets.
104
+ */
105
+ declare function distinctScreenedWallets(compliance: Compliance | null | undefined): string[];
106
+ /**
107
+ * The 5-control checklist, derived from evidence only.
108
+ *
109
+ * Returns `[]` when no decision was issued (`tone === "neutral"`). That is the non-negotiable
110
+ * part: five green ticks for a verdict nobody issued is exactly the failure this module exists to
111
+ * prevent, and an unconfigured gate is not a set of passed checks — the caller renders the
112
+ * headline alone in that case.
113
+ *
114
+ * ► Documented reading of an ambiguous case. When a decision IS issued, a control that no reason
115
+ * names is reported as passed: the engine accumulates `reasons` as a plural SET (the list of
116
+ * causes, not the first cause), so an unnamed control is one that ran without firing. The one
117
+ * place we refuse to infer is `screening`, asserted from the status field alone.
118
+ */
119
+ declare function complianceChecks(compliance: Compliance | null | undefined, cv?: ComplianceView): ComplianceCheck[];
120
+ /** Reasons the checklist did not claim, so a reason is never silently dropped. */
121
+ declare function unattributedComplianceReasons(compliance: Compliance | null | undefined, cv?: ComplianceView): string[];
122
+ /**
123
+ * How many controls this decision actually evidences.
124
+ *
125
+ * Nothing on the payload carries a control count, so a literal number would be fabricated in the
126
+ * one panel a payer reads as reassurance. What we CAN count is the checklist controls we are
127
+ * willing to assert plus every named overlay the decision reports it applied. Deduped
128
+ * case-insensitively so an overlay listed twice is not counted twice.
129
+ */
130
+ declare function complianceControlsEvaluated(compliance: Compliance | null | undefined, cv?: ComplianceView): number;
131
+ /** The summary sentence the chip and the panel share, so they cannot word the same fact differently. */
132
+ declare function complianceControlsLine(compliance: Compliance | null | undefined, cv?: ComplianceView): string;
133
+ /**
134
+ * Synthesize the quote-shaped compliance object for a DIRECT settlement, from the standalone
135
+ * wallet screens of the two parties.
136
+ *
137
+ * A direct transfer never touches /quote — it is a plain ERC-20 `transfer` from payer to merchant
138
+ * — so the gateway's own pre-quote gate cannot run on it and the payment would otherwise settle
139
+ * with NO screening whatsoever. `plan.ts` screens both parties explicitly and passes the verdicts
140
+ * here so the panel states the truth about what ran.
141
+ *
142
+ * ⚠️ It reports `decision: "ALLOW"` ONLY when every screen came back not-blocked, and the caller
143
+ * must have already refused to build the route otherwise. Note what this decision is NOT: a
144
+ * standalone wallet screen answers "is this address on a list", so `location`, `asset` and
145
+ * `limits` were NOT evaluated — the jurisdiction/corridor/amount controls live in the quote gate,
146
+ * which a direct transfer never reaches. Those rows are reported as not-evaluated rather than
147
+ * passed, because claiming a control ran when it did not is the one failure mode this whole module
148
+ * is built to avoid.
149
+ */
150
+ declare function directComplianceFromScreens(screens: WalletScreen[]): Compliance;
151
+ /**
152
+ * The controls a DIRECT settlement can evidence.
153
+ *
154
+ * `complianceChecks` reports an unnamed control as passed, which is the right reading for a quote
155
+ * decision (the engine ran every control and named the ones that fired) and the WRONG one here:
156
+ * a wallet screen evaluated neither jurisdiction, nor the asset pair, nor the amount. This narrows
157
+ * the list to the two rows a screen genuinely evidences rather than printing five green ticks for
158
+ * three controls that never ran.
159
+ */
160
+ declare const DIRECT_CHECK_IDS: readonly ComplianceCheckId[];
161
+ /** The sub-line explaining what a direct settlement did NOT evaluate. Stated, never omitted. */
162
+ declare const 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.";
163
+ declare const BLOCK_LABEL_DEFAULT = "flagged by compliance screening";
164
+ /**
165
+ * The phrase for a block, from whichever categories the engine disclosed.
166
+ *
167
+ * An empty list is the NORMAL case, not an error: categories are disclosure-gated upstream and are
168
+ * withheld from most keys precisely because naming a sanctions hit back to its subject can amount
169
+ * to tipping off. The generic default is therefore the designed outcome, never a fallback that
170
+ * signals something went wrong.
171
+ */
172
+ declare function blockLabelFor(categories: readonly string[]): string;
173
+ /**
174
+ * Short tag for a reason code — "Restricted country" where `humanizeComplianceReason` returns
175
+ * "Your region (CU) isn't supported." Same head grammar, different register: this is for the
176
+ * compact sub-line, the humanizer wherever there is room for a sentence.
177
+ */
178
+ declare function complianceReasonTag(raw: string): string;
179
+ /** The tag for a decision — the first reason that has one. Empty when there is nothing to say. */
180
+ declare function complianceTagOf(compliance: Compliance | null | undefined): string;
181
+ /** `always-blocked` is the floor; `blocked` and `flagged` are the two settings a tunable may hold. */
182
+ type ScreeningOutcome = "always-blocked" | "blocked" | "flagged";
183
+ /**
184
+ * The four NON-WEAKENABLE categories. The engine answers 422 `MATRIX_NOT_WEAKENABLE` to any policy
185
+ * that tries to soften one, so "always blocked" is a guarantee of the engine rather than a property
186
+ * of whichever policy happens to be active — which is why this half is derived, not transcribed.
187
+ */
188
+ declare const FLOOR_CATEGORIES: readonly string[];
189
+ /** Categories a policy MAY tune between BLOCK and FLAG. */
190
+ declare const TUNABLE_CATEGORIES: readonly string[];
191
+ /** The outcome one category carries, or `null` when this build cannot say — dropped, never guessed. */
192
+ declare function screeningOutcomeOf(category: string): ScreeningOutcome | null;
193
+ interface ScreeningBucket {
194
+ outcome: ScreeningOutcome;
195
+ /** The card heading. */
196
+ title: string;
197
+ /** One line saying what the outcome does to an order. */
198
+ detail: string;
199
+ categories: readonly string[];
200
+ }
201
+ /** The three groups, in escalating-permissiveness order. Mirrors the dApp's `SCREENING_BUCKETS`. */
202
+ declare const SCREENING_BUCKETS: readonly ScreeningBucket[];
203
+
1
204
  type Hex = `0x${string}`;
2
205
  type Address = `0x${string}`;
3
206
  interface Chain {
@@ -85,6 +288,8 @@ interface Quote {
85
288
  estimatedDuration?: number;
86
289
  gasCostSource?: string;
87
290
  gasCostDest?: string;
291
+ /** The gateway's compliance decision for this quote's wallet pair. Absent = gate not configured. */
292
+ compliance?: Compliance;
88
293
  escrowAddress?: string;
89
294
  /** Escrow on the execution chain. Informational: approve/submitOrder go to the SOURCE-chain
90
295
  * escrow, which is what checkEscrow binds. */
@@ -167,6 +372,17 @@ interface RouteResult {
167
372
  msgValue?: string;
168
373
  deadline?: string;
169
374
  iterations: number;
375
+ /**
376
+ * The gateway's compliance decision for THIS route's wallet pair.
377
+ *
378
+ * ⚠️ This projection used to drop it, which is why the widget could not say anything about a
379
+ * control that had already run: the payer saw a price and no evidence. It is carried verbatim
380
+ * — the panel derives, it never invents (see core/compliance.ts).
381
+ *
382
+ * Absent when the gateway has no compliance gate configured. Absent is NOT "passed": the view
383
+ * renders that case as "no decision returned" rather than as green ticks.
384
+ */
385
+ compliance?: Compliance;
170
386
  };
171
387
  }
172
388
  interface Destination {
@@ -575,6 +791,14 @@ interface ApiClient {
575
791
  /** Measured lane health. NEVER rejects — see the implementation. */
576
792
  fetchRouteHealth: () => Promise<RouteHealth | null>;
577
793
  fetchQuote: (body: Record<string, unknown>, retries?: number) => Promise<Quote>;
794
+ /**
795
+ * Standalone KYW screen of ONE address — the direct-settlement gate.
796
+ *
797
+ * ⚠️ Rejects rather than resolving to a benign verdict. The caller MUST fail closed: a screen
798
+ * that could not complete is not a clean wallet, and this is the only control standing between a
799
+ * direct ERC-20 transfer and a sanctioned counterparty.
800
+ */
801
+ screenWallet: (address: string, chainId?: number) => Promise<WalletScreen>;
578
802
  apiBase: string;
579
803
  }
580
804
  /** Build an API client bound to a resolved config. The 60s resource cache is per-instance. */
@@ -628,4 +852,4 @@ interface Verifier {
628
852
  }
629
853
  declare function createVerifier(api: ApiClient, fetchImpl: typeof fetch, rpcOverrides?: Record<number, string>): Verifier;
630
854
 
631
- export { isExecutableBridge as $, type Availability as A, type BrokenLane as B, type Catalogue as C, type Destination as D, type EngineConfig as E, type FetchQuoteFn as F, apiError as G, type Hex as H, brokenLaneFor as I, buildCatalogue as J, canAttachApiKey as K, classifyQuoteError as L, createApiClient as M, type NormalizedOrder as N, type OrderRequest as O, type Plan as P, type Quote as Q, type Route as R, type SanitizedTxEntry as S, type Token as T, createVerifier as U, type VerifyResult as V, destinationKeys as W, executableRoutes as X, executionChainIds as Y, hasReachableDestination as Z, hubDeliverableSymbols as _, type Chain as a, isKnownUnbridgeable as a0, isSourceToken as a1, laneKey as a2, laneKeys as a3, parseAllowedApiBase as a4, productAssets as a5, registryRpc as a6, resolveApiBase as a7, resolveConfig as a8, sourceKeys as a9, suppressedLanes as aa, tokenKey as ab, txMatchesPlan as ac, type ExchangeProduct as b, type RouteResult as c, type TxHistoryEntry as d, assetClassOf as e, brokenLaneReason as f, counterpartTokens as g, destinationAvailability as h, type PayOption as i, type SolveResult as j, type BalanceTarget as k, type BalanceEntry as l, type ApiClient as m, type SwapInput as n, type PlannedTx as o, type Verifier as p, type Address as q, type ApiError as r, type CatalogueContext as s, type CatalogueInput as t, type PlannedTxKind as u, type QuoteBlock as v, type ResolvedConfig as w, type RouteHealth as x, type RouteHealthLane as y, type TxPlan as z };
855
+ export { type QuoteBlock as $, type Availability as A, type BrokenLane as B, type Compliance as C, BLOCK_LABEL_DEFAULT as D, type EngineConfig as E, type FetchQuoteFn as F, COMPLIANCE_CHECK_ORDER as G, COMPLIANCE_DENY_LABEL as H, type CatalogueContext as I, type CatalogueInput as J, type ComplianceCheckId as K, type ComplianceDecision as L, DIRECT_CHECK_IDS as M, type NormalizedOrder as N, type OrderRequest as O, type Plan as P, type Quote as Q, type Route as R, type SanitizedTxEntry as S, type Token as T, DIRECT_SCOPE_NOTE as U, type VerifyResult as V, type WalletScreen as W, type Destination as X, FLOOR_CATEGORIES as Y, type Hex as Z, type PlannedTxKind as _, type Catalogue as a, type ResolvedConfig as a0, type RouteHealth as a1, type RouteHealthLane as a2, SCREENING_BUCKETS as a3, type ScreenProvider as a4, type ScreeningBucket as a5, type ScreeningOutcome as a6, TUNABLE_CATEGORIES as a7, type TxPlan as a8, apiError as a9, registryRpc as aA, resolveApiBase as aB, resolveConfig as aC, screeningOutcomeOf as aD, sourceKeys as aE, suppressedLanes as aF, tokenKey as aG, txMatchesPlan as aH, unattributedComplianceReasons as aI, blockLabelFor as aa, brokenLaneFor as ab, buildCatalogue as ac, canAttachApiKey as ad, categoryLabel as ae, classifyQuoteError as af, complianceControlsEvaluated as ag, complianceReasonHead as ah, complianceReasonTag as ai, complianceTagOf as aj, createApiClient as ak, createVerifier as al, destinationKeys as am, directComplianceFromScreens as an, distinctScreenedWallets as ao, executableRoutes as ap, executionChainIds as aq, hasReachableDestination as ar, hubDeliverableSymbols as as, isExecutableBridge as at, isKnownUnbridgeable as au, isSourceToken as av, laneKey as aw, laneKeys as ax, parseAllowedApiBase as ay, productAssets as az, type Chain as b, type ComplianceCheck as c, type ComplianceTone as d, type ComplianceView as e, type ExchangeProduct as f, type RouteResult as g, type TxHistoryEntry as h, assetClassOf as i, brokenLaneReason as j, complianceChecks as k, complianceControlsLine as l, complianceView as m, counterpartTokens as n, destinationAvailability as o, humanizeComplianceReason as p, type PayOption as q, type SolveResult as r, type BalanceTarget as s, type BalanceEntry as t, type ApiClient as u, type SwapInput as v, type PlannedTx as w, type Verifier as x, type Address as y, type ApiError as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glacislabs/stablegenie-zerodelta",
3
- "version": "3.4.0",
3
+ "version": "4.0.0",
4
4
  "description": "Lightweight embeddable ZeroDelta payment + swap widget (exact-receive Pay and exact-in Swap). Wallet always owns the final signature.",
5
5
  "type": "module",
6
6
  "license": "MIT",