@funkit/connect-rn 3.5.0 → 3.6.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.
Files changed (51) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/dist/chunk-BNWA4HKO.js +1217 -0
  3. package/dist/chunk-BNWA4HKO.js.map +7 -0
  4. package/dist/clients/lighter/index.d.ts +5 -0
  5. package/dist/clients/lighter/index.d.ts.map +1 -0
  6. package/dist/clients/lighter/lighterFastWithdrawal.d.ts +42 -0
  7. package/dist/clients/lighter/lighterFastWithdrawal.d.ts.map +1 -0
  8. package/dist/clients/lighter/lighterWithdrawalConfig.d.ts +70 -0
  9. package/dist/clients/lighter/lighterWithdrawalConfig.d.ts.map +1 -0
  10. package/dist/clients/lighter/useLighterUnstakedFee.d.ts +15 -0
  11. package/dist/clients/lighter/useLighterUnstakedFee.d.ts.map +1 -0
  12. package/dist/clients/lighter/useLighterWithdrawal.d.ts +21 -0
  13. package/dist/clients/lighter/useLighterWithdrawal.d.ts.map +1 -0
  14. package/dist/clients/lighter/useLighterWithdrawalMethods.d.ts +29 -0
  15. package/dist/clients/lighter/useLighterWithdrawalMethods.d.ts.map +1 -0
  16. package/dist/clients/lighter.d.ts +1 -0
  17. package/dist/clients/lighter.js +323 -0
  18. package/dist/clients/lighter.js.map +7 -0
  19. package/dist/index.d.ts +1 -1
  20. package/dist/index.d.ts.map +1 -1
  21. package/dist/index.js +5455 -6228
  22. package/dist/index.js.map +4 -4
  23. package/dist/src/components/WithdrawFeeSummary.d.ts +7 -1
  24. package/dist/src/components/WithdrawFeeSummary.d.ts.map +1 -1
  25. package/dist/src/flow/DepositFlowContent.d.ts +19 -0
  26. package/dist/src/flow/DepositFlowContent.d.ts.map +1 -0
  27. package/dist/src/flow/FunkitFlowProvider.d.ts +8 -0
  28. package/dist/src/flow/FunkitFlowProvider.d.ts.map +1 -1
  29. package/dist/src/flow/WithdrawalFlowContent.d.ts +18 -0
  30. package/dist/src/flow/WithdrawalFlowContent.d.ts.map +1 -0
  31. package/dist/src/flow/useCopiedToast.d.ts +18 -0
  32. package/dist/src/flow/useCopiedToast.d.ts.map +1 -0
  33. package/dist/src/flow/withdrawalFlowConfig.d.ts +39 -0
  34. package/dist/src/flow/withdrawalFlowConfig.d.ts.map +1 -1
  35. package/dist/src/identity/IdentityContext.d.ts +12 -2
  36. package/dist/src/identity/IdentityContext.d.ts.map +1 -1
  37. package/dist/src/screens/SelectSourceTokenScreen.d.ts +16 -0
  38. package/dist/src/screens/SelectSourceTokenScreen.d.ts.map +1 -0
  39. package/dist/src/screens/WithdrawCryptoForm.d.ts +12 -1
  40. package/dist/src/screens/WithdrawCryptoForm.d.ts.map +1 -1
  41. package/dist/src/swapped/SwappedScreen.d.ts.map +1 -1
  42. package/dist/src/swapped/SwappedScreenShell.d.ts +2 -1
  43. package/dist/src/swapped/SwappedScreenShell.d.ts.map +1 -1
  44. package/dist/src/swapped/SwappedWithdrawScreen.d.ts.map +1 -1
  45. package/dist/src/withdrawal/flatFee.d.ts +9 -0
  46. package/dist/src/withdrawal/flatFee.d.ts.map +1 -0
  47. package/dist/src/withdrawal/useCryptoWithdrawalExecution.d.ts +2 -2
  48. package/dist/src/withdrawal/useCryptoWithdrawalExecution.d.ts.map +1 -1
  49. package/dist/src/withdrawal/validation.d.ts +1 -1
  50. package/dist/src/withdrawal/validation.d.ts.map +1 -1
  51. package/package.json +6 -2
@@ -0,0 +1,323 @@
1
+ import {
2
+ logger,
3
+ useFunkitTranslation
4
+ } from "../chunk-BNWA4HKO.js";
5
+
6
+ // clients/lighter/useLighterWithdrawalMethods.ts
7
+ import { useLighterAccountsQuery } from "@funkit/connect-core";
8
+ import { getLighterWithdrawalDelay } from "@funkit/connect-core/clients/lighter";
9
+ import { useQuery } from "@tanstack/react-query";
10
+ import { useEffect, useRef } from "react";
11
+
12
+ // clients/lighter/lighterWithdrawalConfig.ts
13
+ var LIGHTER_FAST_METHOD_ID = "lighter-fast";
14
+ var LIGHTER_SECURE_METHOD_ID = "lighter-secure";
15
+
16
+ // clients/lighter/useLighterWithdrawalMethods.ts
17
+ var SECONDS_PER_MINUTE = 60;
18
+ var MINUTES_PER_HOUR = 60;
19
+ var SECONDS_PER_HOUR = SECONDS_PER_MINUTE * MINUTES_PER_HOUR;
20
+ function formatDelay(t, seconds) {
21
+ const normalized = Math.ceil(seconds);
22
+ if (normalized === 1) {
23
+ return t("withdrawLighter.delaySecond");
24
+ }
25
+ if (normalized <= SECONDS_PER_MINUTE) {
26
+ return t("withdrawLighter.delaySeconds", { seconds: normalized });
27
+ }
28
+ const minutes = Math.ceil(normalized / SECONDS_PER_MINUTE) % MINUTES_PER_HOUR;
29
+ const hours = Math.ceil(
30
+ (normalized - minutes * SECONDS_PER_MINUTE) / SECONDS_PER_HOUR
31
+ );
32
+ if (hours === 1 && minutes === 0) {
33
+ return t("withdrawLighter.delayMinutes", { minutes: MINUTES_PER_HOUR });
34
+ }
35
+ if (hours > 0 && minutes > 0) {
36
+ return t("withdrawLighter.delayHoursMinutes", { hours, minutes });
37
+ }
38
+ if (hours > 0) {
39
+ return t("withdrawLighter.delayHours", { hours });
40
+ }
41
+ return t("withdrawLighter.delayMinutes", { minutes });
42
+ }
43
+ function useLighterSecureDelayText(enabled) {
44
+ const { t } = useFunkitTranslation();
45
+ const { data } = useQuery({
46
+ queryKey: ["lighterWithdrawalDelay"],
47
+ queryFn: getLighterWithdrawalDelay,
48
+ // This hook runs for every withdrawal flow, Lighter or not — a host with no
49
+ // Lighter config must never reach Lighter's API.
50
+ enabled,
51
+ staleTime: 6e4,
52
+ retry: 2
53
+ });
54
+ const seconds = data?.seconds;
55
+ if (seconds === void 0 || !Number.isFinite(seconds) || seconds <= 0) {
56
+ return void 0;
57
+ }
58
+ return formatDelay(t, seconds);
59
+ }
60
+ function resolveRailOutcome({
61
+ isConfigured,
62
+ isFetched,
63
+ hasAccountIndex
64
+ }) {
65
+ if (!isConfigured) return "not_configured";
66
+ if (!isFetched) return "loading";
67
+ if (!hasAccountIndex) return "no_account_index";
68
+ return "offered";
69
+ }
70
+ function useLighterWithdrawalMethods(config) {
71
+ const { t } = useFunkitTranslation();
72
+ const { mainAccountIndex, isUnifiedTradingMode, isLoading, isFetched } = useLighterAccountsQuery({ address: config?.l1Address });
73
+ const secureDelayText = useLighterSecureDelayText(!!config);
74
+ const accountIndex = mainAccountIndex && /^\d+$/.test(mainAccountIndex) ? mainAccountIndex : void 0;
75
+ const outcome = resolveRailOutcome({
76
+ isConfigured: !!config,
77
+ isFetched,
78
+ hasAccountIndex: !!accountIndex
79
+ });
80
+ const loggedOutcome = useRef(void 0);
81
+ useEffect(() => {
82
+ if (outcome === "loading" || loggedOutcome.current === outcome) return;
83
+ loggedOutcome.current = outcome;
84
+ if (outcome === "not_configured") return;
85
+ const payload = {
86
+ outcome,
87
+ isUnifiedTradingMode,
88
+ hasAccountIndex: !!accountIndex
89
+ };
90
+ if (outcome === "no_account_index") {
91
+ logger.warn("lighter:withdrawal:rails", payload);
92
+ return;
93
+ }
94
+ logger.info("lighter:withdrawal:rails", payload);
95
+ }, [outcome, isUnifiedTradingMode, accountIndex]);
96
+ const methods = config && accountIndex ? [
97
+ {
98
+ id: LIGHTER_FAST_METHOD_ID,
99
+ title: t("withdrawLighter.methodFast"),
100
+ subtitle: isUnifiedTradingMode ? t("withdrawLighter.fastDisclaimerUnified") : t("withdrawLighter.fastDisclaimer")
101
+ },
102
+ {
103
+ id: LIGHTER_SECURE_METHOD_ID,
104
+ title: t("withdrawLighter.methodSecure"),
105
+ subtitle: t("withdrawLighter.secureDisclaimer", {
106
+ // Until the live value loads, show the localized "60+ minutes"
107
+ // historical estimate. The "+" lives in the per-locale fallback
108
+ // string so it doesn't bleed into live values, which are exact.
109
+ delay: secureDelayText ?? t("withdrawLighter.secureFallbackDelay")
110
+ })
111
+ }
112
+ ] : [];
113
+ return {
114
+ methods,
115
+ accountIndex,
116
+ isUnifiedTradingMode,
117
+ isLoading: !!config && isLoading
118
+ };
119
+ }
120
+
121
+ // clients/lighter/lighterFastWithdrawal.ts
122
+ import { LIGHTER_FAST_MAX_WITHDRAWAL_USD } from "@funkit/connect-core/clients/lighter";
123
+ import { createLighterAdaptedWallet } from "@funkit/connect-core/clients/lighter";
124
+ import { LIGHTER_CHAIN_ID } from "@funkit/chains";
125
+ var LIGHTER_USDC_PERPS_ADDRESS = "0x0000000000000000000000000000000000000000";
126
+ var LIGHTER_SOURCE_CHAIN_ID = `${LIGHTER_CHAIN_ID}`;
127
+ var LIGHTER_FAST_MIN_WITHDRAWAL_USD = 4;
128
+ function withPreSignHook(signerClient, onBeforeSign) {
129
+ if (!onBeforeSign) return signerClient;
130
+ return {
131
+ ...signerClient,
132
+ transfer: async (params) => {
133
+ await onBeforeSign();
134
+ return signerClient.transfer(params);
135
+ }
136
+ };
137
+ }
138
+ function createLighterFastWithdrawalClient({
139
+ signerClient,
140
+ accountIndex,
141
+ onBeforeSign
142
+ }) {
143
+ if (!/^\d+$/.test(accountIndex)) {
144
+ throw new Error(
145
+ `Lighter Fast needs a numeric account index, got: ${accountIndex}`
146
+ );
147
+ }
148
+ return {
149
+ adaptedWallet: createLighterAdaptedWallet({
150
+ signerClient: withPreSignHook(signerClient, onBeforeSign),
151
+ accountIndex: Number(accountIndex),
152
+ logger
153
+ }),
154
+ address: () => accountIndex,
155
+ getChainId: async () => LIGHTER_CHAIN_ID,
156
+ // Lighter is single-chain — nothing to switch to.
157
+ switchChain: async () => void 0,
158
+ sendTransaction: async () => {
159
+ throw new Error("Lighter Fast executes through its relay adapter");
160
+ },
161
+ confirmTransaction: async () => {
162
+ throw new Error("Lighter Fast executes through its relay adapter");
163
+ }
164
+ };
165
+ }
166
+ function buildLighterFastWithdrawalConfig({
167
+ config,
168
+ lighter,
169
+ accountIndex,
170
+ isUnifiedTradingMode
171
+ }) {
172
+ const sourceToken = {
173
+ chainId: LIGHTER_SOURCE_CHAIN_ID,
174
+ address: LIGHTER_USDC_PERPS_ADDRESS,
175
+ symbol: "USDC",
176
+ decimals: 6
177
+ };
178
+ return {
179
+ ...config,
180
+ sourceToken,
181
+ sourceTokens: [
182
+ {
183
+ token: sourceToken,
184
+ label: isUnifiedTradingMode ? "USDC" : "USDC (Perps)"
185
+ }
186
+ ],
187
+ withdrawalSourceTokenBalance: lighter.withdrawalSourceTokenBalance,
188
+ defaultReceiveToken: "USDC",
189
+ withdrawalWallet: createLighterFastWithdrawalClient({
190
+ signerClient: lighter.signerClient,
191
+ accountIndex,
192
+ onBeforeSign: lighter.onBeforeSign
193
+ }),
194
+ // Both in token units, not USD: the price API can't resolve Lighter's
195
+ // source (an L2 balance behind a pseudo-address), and a USD bound with no
196
+ // price silently goes unenforced. Fast is USDC-only, so the numbers match.
197
+ getMinWithdrawalAmount: () => LIGHTER_FAST_MIN_WITHDRAWAL_USD,
198
+ getMaxWithdrawalAmount: () => LIGHTER_FAST_MAX_WITHDRAWAL_USD
199
+ };
200
+ }
201
+
202
+ // clients/lighter/useLighterUnstakedFee.ts
203
+ import { useLighterAccountQuery } from "@funkit/connect-core";
204
+ import {
205
+ LIGHTER_STAKING_POOL_INDEX,
206
+ findLighterStakingShare,
207
+ resolveLighterSharePrice,
208
+ resolveLighterUnstakedFeeTokens
209
+ } from "@funkit/connect-core/clients/lighter";
210
+ import { useEffect as useEffect2, useMemo, useRef as useRef2 } from "react";
211
+ function useLighterUnstakedFee({
212
+ accountIndex,
213
+ enabled
214
+ }) {
215
+ const active = enabled && !!accountIndex;
216
+ const {
217
+ account: userAccount,
218
+ isFetched: isUserAccountFetched,
219
+ isError: isUserAccountError
220
+ } = useLighterAccountQuery(
221
+ active ? { by: "index", value: accountIndex } : null
222
+ );
223
+ const { account: poolAccount, isFetched: isPoolFetched } = useLighterAccountQuery(
224
+ active ? {
225
+ by: "index",
226
+ value: `${LIGHTER_STAKING_POOL_INDEX}`
227
+ } : null
228
+ );
229
+ const shares = useMemo(() => userAccount?.shares ?? [], [userAccount]);
230
+ const sharePrice = useMemo(
231
+ () => resolveLighterSharePrice(poolAccount),
232
+ [poolAccount]
233
+ );
234
+ const isSettled = active && isUserAccountFetched && isPoolFetched;
235
+ const feeTokens = isSettled ? resolveLighterUnstakedFeeTokens(shares, sharePrice) : 0;
236
+ const loggedVerdict = useRef2(void 0);
237
+ const verdict = `${accountIndex}|${isSettled}|${isUserAccountError}|${feeTokens}|${sharePrice}`;
238
+ useEffect2(() => {
239
+ if (!active || loggedVerdict.current === verdict) {
240
+ return;
241
+ }
242
+ loggedVerdict.current = verdict;
243
+ if (!isSettled) {
244
+ return;
245
+ }
246
+ if (isUserAccountError) {
247
+ logger.warn("lighter:fast:unstaked-fee:account-unavailable", {
248
+ accountIndex,
249
+ unstakedFeeTokens: feeTokens
250
+ });
251
+ }
252
+ const stakingShare = findLighterStakingShare(shares);
253
+ logger.info("lighter:fast:unstaked-fee:resolved", {
254
+ accountIndex,
255
+ sharesLength: shares.length,
256
+ sharePrice,
257
+ sharesAmount: stakingShare?.shares_amount,
258
+ unstakedFeeTokens: feeTokens
259
+ });
260
+ if (stakingShare && sharePrice === void 0) {
261
+ logger.warn("lighter:fast:share-price-unavailable", {
262
+ accountIndex,
263
+ stakingPoolIndex: LIGHTER_STAKING_POOL_INDEX
264
+ });
265
+ }
266
+ if (shares.length > 1 || !stakingShare) {
267
+ logger.warn("lighter:fast:unexpected-shares", {
268
+ accountIndex,
269
+ sharesLength: shares.length,
270
+ publicPoolIndexes: shares.map((share) => share.public_pool_index),
271
+ hasStakingShare: !!stakingShare
272
+ });
273
+ }
274
+ }, [
275
+ active,
276
+ verdict,
277
+ accountIndex,
278
+ shares,
279
+ sharePrice,
280
+ feeTokens,
281
+ isSettled,
282
+ isUserAccountError
283
+ ]);
284
+ return feeTokens;
285
+ }
286
+
287
+ // clients/lighter/useLighterWithdrawal.ts
288
+ function useLighterWithdrawal({
289
+ lighter,
290
+ config
291
+ }) {
292
+ const { methods, accountIndex, isUnifiedTradingMode } = useLighterWithdrawalMethods(lighter);
293
+ const isFastOffered = methods.some(
294
+ (method) => method.id === LIGHTER_FAST_METHOD_ID
295
+ );
296
+ const quoteInputFeeTokens = useLighterUnstakedFee({
297
+ accountIndex,
298
+ enabled: isFastOffered
299
+ });
300
+ if (!lighter || !config || !accountIndex) return [];
301
+ return methods.filter((method) => method.id === LIGHTER_FAST_METHOD_ID).map((method) => ({
302
+ id: method.id,
303
+ title: method.title,
304
+ subtitle: method.subtitle,
305
+ config: {
306
+ ...buildLighterFastWithdrawalConfig({
307
+ config,
308
+ lighter,
309
+ accountIndex,
310
+ isUnifiedTradingMode
311
+ }),
312
+ // Lighter takes this off the amount before it is quoted.
313
+ quoteInputFeeTokens
314
+ }
315
+ }));
316
+ }
317
+ export {
318
+ LIGHTER_FAST_METHOD_ID,
319
+ LIGHTER_SECURE_METHOD_ID,
320
+ useLighterWithdrawal,
321
+ useLighterWithdrawalMethods
322
+ };
323
+ //# sourceMappingURL=lighter.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../clients/lighter/useLighterWithdrawalMethods.ts", "../../clients/lighter/lighterWithdrawalConfig.ts", "../../clients/lighter/lighterFastWithdrawal.ts", "../../clients/lighter/useLighterUnstakedFee.ts", "../../clients/lighter/useLighterWithdrawal.ts"],
4
+ "sourcesContent": ["import { useLighterAccountsQuery } from '@funkit/connect-core'\nimport { getLighterWithdrawalDelay } from '@funkit/connect-core/clients/lighter'\nimport { useQuery } from '@tanstack/react-query'\nimport type { TFunction } from 'i18next'\nimport { useEffect, useRef } from 'react'\n\nimport { logger } from '../../src/logging/logger'\nimport { useFunkitTranslation } from '../../src/providers/FunkitI18nProvider'\nimport {\n LIGHTER_FAST_METHOD_ID,\n LIGHTER_SECURE_METHOD_ID,\n type LighterWithdrawalFlowConfig,\n} from './lighterWithdrawalConfig'\n\n/** One row on the withdrawal method screen, before icons are attached. */\nexport interface LighterWithdrawalMethod {\n id: typeof LIGHTER_FAST_METHOD_ID | typeof LIGHTER_SECURE_METHOD_ID\n title: string\n subtitle: string\n}\n\nexport interface UseLighterWithdrawalMethodsResult {\n /** Fast then Secure, in web's order. Empty until the account resolves. */\n methods: LighterWithdrawalMethod[]\n /**\n * The user's Lighter L2 main-account index. Both rails address the account\n * by index, so neither can run before this resolves.\n */\n accountIndex: string | undefined\n /** Unified accounts hold one USDC balance \u2014 no spot/perps split. */\n isUnifiedTradingMode: boolean\n /** The account lookup is in flight; rows are expected to be empty. */\n isLoading: boolean\n}\n\nconst SECONDS_PER_MINUTE = 60\nconst MINUTES_PER_HOUR = 60\nconst SECONDS_PER_HOUR = SECONDS_PER_MINUTE * MINUTES_PER_HOUR\n\n/**\n * Formats Lighter's live L2\u2192L1 delay for the Secure row (e.g. \"1 h 50 min\").\n * - Reproduces web's `formatSecondsToReadableForm(seconds, false, true)` output\n * for every input, including its two oddities: a sub-minute delay reads in\n * seconds, and exactly one hour reads \"60 min\". The two SDKs quote the same\n * bridge, so they must not disagree on the wait.\n * - Rounds up otherwise: an estimate must not promise finality early.\n * - One literal `t` key per shape \u2014 never a computed key.\n */\nfunction formatDelay(t: TFunction, seconds: number): string {\n const normalized = Math.ceil(seconds)\n if (normalized === 1) {\n return t('withdrawLighter.delaySecond')\n }\n if (normalized <= SECONDS_PER_MINUTE) {\n return t('withdrawLighter.delaySeconds', { seconds: normalized })\n }\n // Round to minutes first: rounding the remainder alone can yield \"1 h 60 min\".\n const minutes = Math.ceil(normalized / SECONDS_PER_MINUTE) % MINUTES_PER_HOUR\n const hours = Math.ceil(\n (normalized - minutes * SECONDS_PER_MINUTE) / SECONDS_PER_HOUR,\n )\n if (hours === 1 && minutes === 0) {\n return t('withdrawLighter.delayMinutes', { minutes: MINUTES_PER_HOUR })\n }\n if (hours > 0 && minutes > 0) {\n return t('withdrawLighter.delayHoursMinutes', { hours, minutes })\n }\n if (hours > 0) {\n return t('withdrawLighter.delayHours', { hours })\n }\n return t('withdrawLighter.delayMinutes', { minutes })\n}\n\n/**\n * Secure-withdrawal delay as display copy. Shown live because it tracks L2\u2192L1\n * batch cadence; `undefined` until it loads.\n */\nfunction useLighterSecureDelayText(enabled: boolean): string | undefined {\n const { t } = useFunkitTranslation()\n const { data } = useQuery({\n queryKey: ['lighterWithdrawalDelay'],\n queryFn: getLighterWithdrawalDelay,\n // This hook runs for every withdrawal flow, Lighter or not \u2014 a host with no\n // Lighter config must never reach Lighter's API.\n enabled,\n staleTime: 60_000,\n retry: 2,\n })\n const seconds = data?.seconds\n if (seconds === undefined || !Number.isFinite(seconds) || seconds <= 0) {\n return undefined\n }\n return formatDelay(t, seconds)\n}\n\ntype RailOutcome = 'not_configured' | 'loading' | 'offered' | 'no_account_index'\n\n/**\n * Whether Lighter's rails replace the generic crypto row, and why not when they\n * don't.\n * - `isFetched`, not `isLoading`: the latter is false on the first render,\n * before the query starts, which would record a premature \"no account\".\n */\nfunction resolveRailOutcome({\n isConfigured,\n isFetched,\n hasAccountIndex,\n}: {\n isConfigured: boolean\n isFetched: boolean\n hasAccountIndex: boolean\n}): RailOutcome {\n if (!isConfigured) return 'not_configured'\n if (!isFetched) return 'loading'\n if (!hasAccountIndex) return 'no_account_index'\n return 'offered'\n}\n\n/**\n * The Fast / Secure rows plus the account state both rails need. Port of the\n * row-building half of web's `useLighterWithdrawalConfig`.\n *\n * Pass `undefined` when the host configured no Lighter: the inner hooks still\n * run (Rules of Hooks) but every query stays disabled.\n */\nexport function useLighterWithdrawalMethods(\n config: LighterWithdrawalFlowConfig | undefined,\n): UseLighterWithdrawalMethodsResult {\n const { t } = useFunkitTranslation()\n const { mainAccountIndex, isUnifiedTradingMode, isLoading, isFetched } =\n useLighterAccountsQuery({ address: config?.l1Address })\n const secureDelayText = useLighterSecureDelayText(!!config)\n\n // Lighter addresses accounts by a numeric index; anything else means the\n // lookup returned something unusable and neither rail can address the user.\n const accountIndex =\n mainAccountIndex && /^\\d+$/.test(mainAccountIndex)\n ? mainAccountIndex\n : undefined\n\n const outcome = resolveRailOutcome({\n isConfigured: !!config,\n isFetched,\n hasAccountIndex: !!accountIndex,\n })\n // Rail-availability decision point, recorded once per outcome so a re-render\n // or a background refetch doesn't re-emit the same one.\n const loggedOutcome = useRef<RailOutcome | undefined>(undefined)\n useEffect(() => {\n if (outcome === 'loading' || loggedOutcome.current === outcome) return\n loggedOutcome.current = outcome\n if (outcome === 'not_configured') return\n const payload = {\n outcome,\n isUnifiedTradingMode,\n hasAccountIndex: !!accountIndex,\n }\n if (outcome === 'no_account_index') {\n // Recovered, but the user loses Lighter's rails for this session \u2014 that\n // is a visible capability change, so it belongs above INFO.\n logger.warn('lighter:withdrawal:rails', payload)\n return\n }\n logger.info('lighter:withdrawal:rails', payload)\n }, [outcome, isUnifiedTradingMode, accountIndex])\n\n const methods: LighterWithdrawalMethod[] =\n config && accountIndex\n ? [\n {\n id: LIGHTER_FAST_METHOD_ID,\n title: t('withdrawLighter.methodFast'),\n subtitle: isUnifiedTradingMode\n ? t('withdrawLighter.fastDisclaimerUnified')\n : t('withdrawLighter.fastDisclaimer'),\n },\n {\n id: LIGHTER_SECURE_METHOD_ID,\n title: t('withdrawLighter.methodSecure'),\n subtitle: t('withdrawLighter.secureDisclaimer', {\n // Until the live value loads, show the localized \"60+ minutes\"\n // historical estimate. The \"+\" lives in the per-locale fallback\n // string so it doesn't bleed into live values, which are exact.\n delay:\n secureDelayText ?? t('withdrawLighter.secureFallbackDelay'),\n }),\n },\n ]\n : []\n\n return {\n methods,\n accountIndex,\n isUnifiedTradingMode,\n isLoading: !!config && isLoading,\n }\n}\n", "import type { LighterRouteType } from '@funkit/connect-core/clients/lighter'\nimport type { LighterSigner } from '@funkit/connect-core/clients/lighter'\nimport type { Address } from 'viem'\n\nimport type { WithdrawalSourceTokenParams } from '../../src/flow/withdrawalFlowConfig'\n\n/** Stable ids for the two rails \u2014 used for row identity, routing and logs. */\nexport const LIGHTER_FAST_METHOD_ID = 'lighter-fast'\nexport const LIGHTER_SECURE_METHOD_ID = 'lighter-secure'\n\n/** What the host must implement to submit a Secure withdrawal on Lighter's L2. */\nexport interface LighterSecureWithdrawalParams {\n /** Withdrawal amount in token units (e.g. \"1.5\" for 1.5 ETH). */\n amountTokenUnits: string\n /** The Lighter asset index (e.g. 1 for ETH, 3 for USDC). */\n assetIndex: number\n /**\n * 0 = perps / USDC collateral, 1 = spot. USDC shares asset index 3 across\n * both routes, so the route type is what selects Perps vs Spot.\n */\n routeType: LighterRouteType\n}\n\n/**\n * Lighter withdrawal, as the host configures it. Mirrors web's\n * `LighterWithdrawalConfig` (`@funkit/connect/clients/lighter`) so an\n * integrator's web and mobile wiring read the same.\n *\n * Passed on `WithdrawalFlowConfig.lighter`; its presence is what turns the\n * withdrawal flow's single crypto row into the Fast / Secure pair.\n */\nexport interface LighterWithdrawalFlowConfig {\n /**\n * The connected user's L1 address. The SDK resolves the L2 main-account\n * index from it \u2014 Lighter addresses accounts by index, not by address.\n */\n l1Address: Address\n /**\n * Host-built Lighter L2 signer, used by the Fast rail's relay adapter. The\n * SDK never holds L2 key material.\n */\n signerClient: LighterSigner\n /**\n * Submits the Secure withdrawal on Lighter's L2 and resolves with the L2 tx\n * hash. Funds bridge directly to Ethereum mainnet \u2014 no relay, no swap.\n */\n sendLighterSecureWithdrawal: (\n params: LighterSecureWithdrawalParams,\n ) => Promise<string>\n /**\n * Withdrawable balance for the selected source token, applied to both rails.\n * Lighter's own accounting \u2014 it must account for what the SDK cannot see\n * (margin requirements, locked collateral), so the integrator owns it.\n */\n withdrawalSourceTokenBalance?: (\n params: WithdrawalSourceTokenParams,\n ) => string | number\n /**\n * Minimum Secure withdrawal in token units. Takes the same\n * {@link WithdrawalSourceTokenParams} as every other source-token callback,\n * so the shape carries over to any venue rather than being symbol-only.\n * Perps and spot USDC stay distinguishable \u2014 they are separate source tokens\n * with their own addresses. Return `undefined` for the default.\n */\n getSecureMinWithdrawalAmount?: (\n params: WithdrawalSourceTokenParams,\n ) => number | undefined\n /**\n * Awaited after the user taps Withdraw but before either rail fetches a\n * nonce, prompts, or submits.\n *\n * Lighter strategies and withdrawals share one L2 signing account, so a\n * strategy still placing or cancelling orders bumps the nonce out from under\n * the withdrawal and the signed tx is rejected. Cancel in-flight strategies\n * here so the withdrawal signs against a stable nonce. Throw to abort \u2014 no\n * nonce is consumed.\n */\n onBeforeSign?: () => Promise<void> | void\n}\n", "import { type WithdrawalClient } from '@funkit/connect-core'\nimport { LIGHTER_FAST_MAX_WITHDRAWAL_USD } from '@funkit/connect-core/clients/lighter'\nimport { createLighterAdaptedWallet } from '@funkit/connect-core/clients/lighter'\nimport { LIGHTER_CHAIN_ID } from '@funkit/chains'\nimport type { Address } from 'viem'\n\nimport type { WithdrawalFlowConfig } from '../../src/flow/withdrawalFlowConfig'\nimport { logger } from '../../src/logging/logger'\nimport type { LighterWithdrawalFlowConfig } from './lighterWithdrawalConfig'\n\n/**\n * Lighter USDC Perps, addressed as relay does: the zero address maps to relay\n * asset '0' via `RELAY_LIGHTER_FUN_ADDRESS_MAP` in fun-relay.\n */\nconst LIGHTER_USDC_PERPS_ADDRESS =\n '0x0000000000000000000000000000000000000000' as Address\n\n/** Same id relay calls `RELAY_LIGHTER_CHAIN_ID`; the config carries it as a string. */\nconst LIGHTER_SOURCE_CHAIN_ID = `${LIGHTER_CHAIN_ID}`\n\n/** Fast is USDC-only, so web's USD floor is also its token-unit floor. */\nconst LIGHTER_FAST_MIN_WITHDRAWAL_USD = 4\n\n/**\n * Wraps the host's signer so `onBeforeSign` is awaited before the first\n * transfer. Lighter strategies and withdrawals share one L2 signing account, so\n * an in-flight strategy would bump the nonce out from under a Fast withdrawal\n * exactly as it would a Secure one. Throwing aborts before any nonce is used.\n */\nfunction withPreSignHook(\n signerClient: LighterWithdrawalFlowConfig['signerClient'],\n onBeforeSign: LighterWithdrawalFlowConfig['onBeforeSign'],\n): LighterWithdrawalFlowConfig['signerClient'] {\n if (!onBeforeSign) return signerClient\n return {\n ...signerClient,\n transfer: async (params) => {\n await onBeforeSign()\n return signerClient.transfer(params)\n },\n }\n}\n\n/**\n * A {@link WithdrawalClient} for Lighter Fast. Relay drives `adaptedWallet`\n * directly \u2014 the EVM members exist to satisfy the interface and to throw\n * loudly if something ever routes an EVM leg through this client, which for\n * Fast would mean signing on the wrong rail.\n *\n * `address()` is the L2 account index, not an EVM address: Lighter addresses\n * accounts by index, and that is what relay and the tracking row record.\n */\nexport function createLighterFastWithdrawalClient({\n signerClient,\n accountIndex,\n onBeforeSign,\n}: {\n signerClient: LighterWithdrawalFlowConfig['signerClient']\n accountIndex: string\n /**\n * Host hook awaited before the first L2 signature. Relay drives the adapter,\n * so the only point Fast controls is the signer itself.\n */\n onBeforeSign?: LighterWithdrawalFlowConfig['onBeforeSign']\n // The adapter is narrowed to Lighter's own wallet: the interface field is\n // relay's per-VM union, and callers of this client know which vm they got.\n}): WithdrawalClient & {\n adaptedWallet: ReturnType<typeof createLighterAdaptedWallet>\n} {\n // Fail here rather than let a NaN account index reach relay, where it\n // surfaces much later as an unattributable signing failure.\n if (!/^\\d+$/.test(accountIndex)) {\n throw new Error(\n `Lighter Fast needs a numeric account index, got: ${accountIndex}`,\n )\n }\n return {\n adaptedWallet: createLighterAdaptedWallet({\n signerClient: withPreSignHook(signerClient, onBeforeSign),\n accountIndex: Number(accountIndex),\n logger,\n }),\n address: () => accountIndex,\n getChainId: async () => LIGHTER_CHAIN_ID,\n // Lighter is single-chain \u2014 nothing to switch to.\n switchChain: async () => undefined,\n sendTransaction: async () => {\n throw new Error('Lighter Fast executes through its relay adapter')\n },\n confirmTransaction: async () => {\n throw new Error('Lighter Fast executes through its relay adapter')\n },\n }\n}\n\n/**\n * The withdrawal the crypto rail runs for Lighter Fast: USDC Perps out of the\n * user's L2 account, quoted and executed through Fun + Relay to any supported\n * destination. Port of web's `buildLighterFastWalletWithdrawalConfig`.\n *\n * Limits are web's USD numbers expressed in token units. Fast is USDC-only, so\n * the two are the same number; RN has no price feed yet, and a USD limit\n * without one is inert (see `withdrawal/validation.ts`).\n */\nexport function buildLighterFastWithdrawalConfig({\n config,\n lighter,\n accountIndex,\n isUnifiedTradingMode,\n}: {\n /** The host's withdrawal config \u2014 title and callbacks carry over. */\n config: WithdrawalFlowConfig\n lighter: LighterWithdrawalFlowConfig\n accountIndex: string\n /** Unified accounts hold one USDC balance, so the label drops \"(Perps)\". */\n isUnifiedTradingMode: boolean\n}): WithdrawalFlowConfig {\n const sourceToken = {\n chainId: LIGHTER_SOURCE_CHAIN_ID,\n address: LIGHTER_USDC_PERPS_ADDRESS,\n symbol: 'USDC',\n decimals: 6,\n }\n return {\n ...config,\n sourceToken,\n sourceTokens: [\n {\n token: sourceToken,\n label: isUnifiedTradingMode ? 'USDC' : 'USDC (Perps)',\n },\n ],\n withdrawalSourceTokenBalance: lighter.withdrawalSourceTokenBalance,\n defaultReceiveToken: 'USDC',\n withdrawalWallet: createLighterFastWithdrawalClient({\n signerClient: lighter.signerClient,\n accountIndex,\n onBeforeSign: lighter.onBeforeSign,\n }),\n // Both in token units, not USD: the price API can't resolve Lighter's\n // source (an L2 balance behind a pseudo-address), and a USD bound with no\n // price silently goes unenforced. Fast is USDC-only, so the numbers match.\n getMinWithdrawalAmount: () => LIGHTER_FAST_MIN_WITHDRAWAL_USD,\n getMaxWithdrawalAmount: () => LIGHTER_FAST_MAX_WITHDRAWAL_USD,\n }\n}\n", "import type { LighterAccountIndex } from '@funkit/api-base'\nimport { useLighterAccountQuery } from '@funkit/connect-core'\nimport {\n LIGHTER_STAKING_POOL_INDEX,\n findLighterStakingShare,\n resolveLighterSharePrice,\n resolveLighterUnstakedFeeTokens,\n} from '@funkit/connect-core/clients/lighter'\nimport { useEffect, useMemo, useRef } from 'react'\n\nimport { logger } from '../../src/logging/logger'\n\n/**\n * The Lighter Fast \"unstaked fee\": a flat deduction taken off the withdrawal\n * before quoting, waived for users staked at or above the threshold.\n *\n * Two accounts, two queries: the user's carries their `shares[]` (entry state\n * only), and the pool's carries the NAV needed to value them. Returns 0 while\n * either is in flight and for every non-Fast caller; once both settle the fee is\n * computed, failing closed if a lookup errored.\n */\nexport function useLighterUnstakedFee({\n accountIndex,\n enabled,\n}: {\n accountIndex: string | undefined\n /** Fast only \u2014 Secure charges no such fee. */\n enabled: boolean\n}): number {\n const active = enabled && !!accountIndex\n const {\n account: userAccount,\n isFetched: isUserAccountFetched,\n isError: isUserAccountError,\n } = useLighterAccountQuery(\n active ? { by: 'index', value: accountIndex as LighterAccountIndex } : null,\n )\n const { account: poolAccount, isFetched: isPoolFetched } =\n useLighterAccountQuery(\n active\n ? {\n by: 'index',\n value: `${LIGHTER_STAKING_POOL_INDEX}` as LighterAccountIndex,\n }\n : null,\n )\n\n // Stable references so the logging effect doesn't re-fire every render while\n // the accounts are still loading.\n const shares = useMemo(() => userAccount?.shares ?? [], [userAccount])\n const sharePrice = useMemo(\n () => resolveLighterSharePrice(poolAccount),\n [poolAccount],\n )\n // Both lookups, not just the user's: mid-flight, no shares is\n // indistinguishable from a non-staker and a missing NAV values a staker at\n // entry principal \u2014 either way the quote would price a fee that then moves.\n // A *failed* lookup is different: the venue charges the fee regardless of what\n // we can see, and quoting the gross amount would promise the user ~3 tokens\n // the transfer never delivers. So an error fails closed (`isFetched` is true\n // either way), matching web, which computes the fee unconditionally.\n const isSettled = active && isUserAccountFetched && isPoolFetched\n const feeTokens = isSettled\n ? resolveLighterUnstakedFeeTokens(shares, sharePrice)\n : 0\n\n // A background refetch hands back a fresh `shares` array every time; without\n // this the same verdict is recorded again on each one.\n const loggedVerdict = useRef<string | undefined>(undefined)\n const verdict = `${accountIndex}|${isSettled}|${isUserAccountError}|${feeTokens}|${sharePrice}`\n\n useEffect(() => {\n if (!active || loggedVerdict.current === verdict) {\n return\n }\n loggedVerdict.current = verdict\n if (!isSettled) {\n return\n }\n if (isUserAccountError) {\n // The fee is charged from the venue's own view of the stake, which we\n // could not read \u2014 so it is applied blind and worth surfacing.\n logger.warn('lighter:fast:unstaked-fee:account-unavailable', {\n accountIndex,\n unstakedFeeTokens: feeTokens,\n })\n }\n const stakingShare = findLighterStakingShare(shares)\n logger.info('lighter:fast:unstaked-fee:resolved', {\n accountIndex,\n sharesLength: shares.length,\n sharePrice,\n sharesAmount: stakingShare?.shares_amount,\n unstakedFeeTokens: feeTokens,\n })\n // Pool NAV missing for an actual staker \u2014 the gate silently degrades to the\n // entry principal, which under-counts accrued yield and can over-charge.\n if (stakingShare && sharePrice === undefined) {\n logger.warn('lighter:fast:share-price-unavailable', {\n accountIndex,\n stakingPoolIndex: LIGHTER_STAKING_POOL_INDEX,\n })\n }\n // We expect exactly one share \u2014 the staking pool. More than one, or a\n // missing staking-pool share, is unexpected: surface it for monitoring.\n if (shares.length > 1 || !stakingShare) {\n logger.warn('lighter:fast:unexpected-shares', {\n accountIndex,\n sharesLength: shares.length,\n publicPoolIndexes: shares.map((share) => share.public_pool_index),\n hasStakingShare: !!stakingShare,\n })\n }\n }, [\n active,\n verdict,\n accountIndex,\n shares,\n sharePrice,\n feeTokens,\n isSettled,\n isUserAccountError,\n ])\n\n return feeTokens\n}\n", "import type {\n WithdrawalFlowConfig,\n WithdrawalMethodOption,\n} from '../../src/flow/withdrawalFlowConfig'\nimport { buildLighterFastWithdrawalConfig } from './lighterFastWithdrawal'\nimport { LIGHTER_FAST_METHOD_ID } from './lighterWithdrawalConfig'\nimport type { LighterWithdrawalFlowConfig } from './lighterWithdrawalConfig'\nimport { useLighterUnstakedFee } from './useLighterUnstakedFee'\nimport { useLighterWithdrawalMethods } from './useLighterWithdrawalMethods'\n\n/**\n * The Lighter methods to hand `beginWithdrawal`, each carrying the config it\n * runs. Mirrors web's `useLighterWithdrawalConfig`: the host calls this and\n * passes the result on, so the SDK never holds Lighter config.\n *\n * Empty until the L2 account resolves \u2014 both rails address the account by\n * index, so there is nothing to offer before then, and the flow falls back to\n * its generic crypto row.\n */\nexport function useLighterWithdrawal({\n lighter,\n config,\n}: {\n lighter: LighterWithdrawalFlowConfig | undefined\n /**\n * The host's own withdrawal config; title and callbacks carry over. Absent\n * until the host has one \u2014 a hook can't be called conditionally, so there is\n * no placeholder worth inventing.\n */\n config: WithdrawalFlowConfig | undefined\n}): WithdrawalMethodOption[] {\n const { methods, accountIndex, isUnifiedTradingMode } =\n useLighterWithdrawalMethods(lighter)\n // Fast only; Secure charges no such fee. Keyed off the row actually being\n // offered, so the two account lookups stay off the wire when it isn't.\n const isFastOffered = methods.some(\n (method) => method.id === LIGHTER_FAST_METHOD_ID,\n )\n const quoteInputFeeTokens = useLighterUnstakedFee({\n accountIndex,\n enabled: isFastOffered,\n })\n\n if (!lighter || !config || !accountIndex) return []\n\n // Native Bridge is filtered out: its screens have not shipped, and a row\n // that fails on tap is worse than no row.\n return methods\n .filter((method) => method.id === LIGHTER_FAST_METHOD_ID)\n .map((method) => ({\n id: method.id,\n title: method.title,\n subtitle: method.subtitle,\n config: {\n ...buildLighterFastWithdrawalConfig({\n config,\n lighter,\n accountIndex,\n isUnifiedTradingMode,\n }),\n // Lighter takes this off the amount before it is quoted.\n quoteInputFeeTokens,\n },\n }))\n}\n"],
5
+ "mappings": ";;;;;;AAAA,SAAS,+BAA+B;AACxC,SAAS,iCAAiC;AAC1C,SAAS,gBAAgB;AAEzB,SAAS,WAAW,cAAc;;;ACG3B,IAAM,yBAAyB;AAC/B,IAAM,2BAA2B;;;AD2BxC,IAAM,qBAAqB;AAC3B,IAAM,mBAAmB;AACzB,IAAM,mBAAmB,qBAAqB;AAW9C,SAAS,YAAY,GAAc,SAAyB;AAC1D,QAAM,aAAa,KAAK,KAAK,OAAO;AACpC,MAAI,eAAe,GAAG;AACpB,WAAO,EAAE,6BAA6B;AAAA,EACxC;AACA,MAAI,cAAc,oBAAoB;AACpC,WAAO,EAAE,gCAAgC,EAAE,SAAS,WAAW,CAAC;AAAA,EAClE;AAEA,QAAM,UAAU,KAAK,KAAK,aAAa,kBAAkB,IAAI;AAC7D,QAAM,QAAQ,KAAK;AAAA,KAChB,aAAa,UAAU,sBAAsB;AAAA,EAChD;AACA,MAAI,UAAU,KAAK,YAAY,GAAG;AAChC,WAAO,EAAE,gCAAgC,EAA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Ac;AACtC,aAAO,KAAK,kCAAkC;AAAA,QAC5C;AAAA,QACA,cAAc,OAAO;AAAA,QACrB,mBAAmB,OAAO,IAAI,CAAC,UAAU,MAAM,iBAAiB;AAAA,QAChE,iBAAiB,CAAC,CAAC;AAAA,MACrB,CAAC;AAAA,IACH;AAAA,EACF,GAAG;AAAA,IACD;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AAED,SAAO;AACT;;;AC1GO,SAAS,qBAAqB;AAAA,EACnC;AAAA,EACA;AACF,GAQ6B;AAC3B,QAAM,EAAE,SAAS,cAAc,qBAAqB,IAClD,4BAA4B,OAAO;AAGrC,QAAM,gBAAgB,QAAQ;AAAA,IAC5B,CAAC,WAAW,OAAO,OAAO;AAAA,EAC5B;AACA,QAAM,sBAAsB,sBAAsB;AAAA,IAChD;AAAA,IACA,SAAS;AAAA,EACX,CAAC;AAED,MAAI,CAAC,WAAW,CAAC,UAAU,CAAC,aAAc,QAAO,CAAC;AAIlD,SAAO,QACJ,OAAO,CAAC,WAAW,OAAO,OAAO,sBAAsB,EACvD,IAAI,CAAC,YAAY;AAAA,IAChB,IAAI,OAAO;AAAA,IACX,OAAO,OAAO;AAAA,IACd,UAAU,OAAO;AAAA,IACjB,QAAQ;AAAA,MACN,GAAG,iCAAiC;AAAA,QAClC;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF,CAAC;AAAA;AAAA,MAED;AAAA,IACF;AAAA,EACF,EAAE;AACN;",
6
+ "names": ["useEffect", "useRef", "useRef", "useEffect"]
7
+ }
package/dist/index.d.ts CHANGED
@@ -24,7 +24,7 @@ export { useFunkitRecentDeposits, useFunkitRecentDepositsImpl, } from './src/his
24
24
  export { useCheckoutsListenerByUserId } from './src/history/useCheckoutsListenerByUserId';
25
25
  export type { PurifiedCheckoutHistoryItem } from '@funkit/connect-core';
26
26
  export type { DepositFlowCallbacks, DepositFlowConfig, DynamicTargetAssetCandidate, } from './src/flow/depositFlowConfig';
27
- export type { WithdrawalFlowCallbacks, WithdrawalFlowConfig, WithdrawalSourceTokenOption, WithdrawalSourceTokenParams, WithdrawalToken, } from './src/flow/withdrawalFlowConfig';
27
+ export type { WithdrawalFlowCallbacks, WithdrawalFlowConfig, WithdrawalMethodOption, WithdrawalSourceTokenOption, WithdrawalSourceTokenParams, WithdrawalToken, } from './src/flow/withdrawalFlowConfig';
28
28
  export type { PaymentMethodOption, ReceiveTokenOption, } from './src/screens/SelectMethodScreen';
29
29
  export type { ChainOption } from './src/flow/depositFlowConfig';
30
30
  export type { SupportedToken, TokenChainFilter, } from './src/transfer/supportedTokens';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAkBA,YAAY,EACV,2BAA2B,EAC3B,oBAAoB,EACpB,gBAAgB,EAChB,qBAAqB,GACtB,MAAM,sBAAsB,CAAA;AAK7B,OAAO,EACL,UAAU,EACV,mBAAmB,EACnB,WAAW,GACZ,MAAM,oBAAoB,CAAA;AAC3B,YAAY,EACV,aAAa,EACb,mBAAmB,EACnB,gBAAgB,EAChB,gBAAgB,EAChB,YAAY,GACb,MAAM,oBAAoB,CAAA;AAG3B,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,GACf,MAAM,4BAA4B,CAAA;AACnC,YAAY,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AAI7D,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAC1D,YAAY,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAA;AAG9D,OAAO,EACL,oBAAoB,EACpB,kBAAkB,EAClB,cAAc,GACf,MAAM,4BAA4B,CAAA;AACnC,YAAY,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAGhF,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAC3D,YAAY,E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