@funkit/connect 9.9.0 → 9.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/dist/clients/lighter.d.ts +35 -28
- package/dist/clients/lighter.js +121 -25
- package/dist/index.js +97 -60
- package/dist/utils/polymarket.d.ts +6 -0
- package/dist/wallets/walletConnectors/index.js +32 -32
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @funkit/connect
|
|
2
2
|
|
|
3
|
+
## 9.10.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- b902702: Render live Lighter Secure-withdrawal delay and consolidate Lighter setup behind one hook.
|
|
8
|
+
|
|
9
|
+
- `useLighterWithdrawalConfig(config | null)` is now the single React entry — it resolves the account index, balances, locale, and live `/api/v1/withdrawalDelay` internally and returns `null` until ready.
|
|
10
|
+
- `LighterWithdrawalConfig` no longer requires `accountIndex`.
|
|
11
|
+
- Removed the static `createLighterWithdrawalConfig` factory; use the hook.
|
|
12
|
+
- Secure-withdrawal disclaimer now reads "All tokens · Ethereum chain only · 1 h 50 min" (live, localized) instead of the static "60+ minutes".
|
|
13
|
+
- `getSecureMinWithdrawalAmount` is fully optional and may now return `undefined` to defer to the new exported `LIGHTER_DEFAULT_SECURE_MIN_WITHDRAWAL_AMOUNTS` dictionary, which is also used as the fallback when the callback is omitted.
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- ab32d56: Render Lighter withdrawal receive amount and USD label with fractional digits instead of scientific notation
|
|
18
|
+
- d3769c2: Block Polymarket withdrawals to the user's own source (proxy) wallet address
|
|
19
|
+
|
|
3
20
|
## 9.9.0
|
|
4
21
|
|
|
5
22
|
### Minor Changes
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
* caller provides the actual on-chain implementation.
|
|
15
15
|
*/
|
|
16
16
|
import type { LighterAccountIndex } from '@funkit/api-base';
|
|
17
|
+
import type { Address } from 'viem';
|
|
17
18
|
import type { CustomWithdrawalConfig, MultiMethodWithdrawalConfig } from '../providers/FunkitCheckoutContext/types';
|
|
18
19
|
export type LighterTransferParams = {
|
|
19
20
|
toAccountIndex: number;
|
|
@@ -38,13 +39,18 @@ export type LighterSigner = {
|
|
|
38
39
|
transfer: (params: LighterTransferParams) => Promise<[unknown, string, string | null]>;
|
|
39
40
|
};
|
|
40
41
|
export interface LighterWithdrawalConfig {
|
|
41
|
-
|
|
42
|
+
/**
|
|
43
|
+
* The connected user's L1 address. The hook resolves the Lighter account
|
|
44
|
+
* index from this internally — get it from `useFunkitUserInfo` (or your
|
|
45
|
+
* own wallet hook) in the caller and pass it through.
|
|
46
|
+
*/
|
|
47
|
+
l1Address: Address;
|
|
42
48
|
/** Title shown on the selection screen. Defaults to "Withdraw". */
|
|
43
49
|
modalTitle?: string;
|
|
44
50
|
disableConnectedWallet?: boolean;
|
|
45
51
|
fastIconSrc?: string;
|
|
46
52
|
secureIconSrc?: string;
|
|
47
|
-
/** Pre-built Lighter signer.
|
|
53
|
+
/** Pre-built Lighter signer. */
|
|
48
54
|
signerClient: LighterSigner;
|
|
49
55
|
sendLighterSecureWithdrawal: LighterSecureWithdrawalExec;
|
|
50
56
|
/**
|
|
@@ -54,8 +60,14 @@ export interface LighterWithdrawalConfig {
|
|
|
54
60
|
* getSecureMinWithdrawalAmount: (symbol) => ({ USDC: 1, ETH: 0.001 }[symbol] ?? 0)
|
|
55
61
|
* ```
|
|
56
62
|
*/
|
|
57
|
-
getSecureMinWithdrawalAmount?: (symbol: string) => number;
|
|
63
|
+
getSecureMinWithdrawalAmount?: (symbol: string) => number | undefined;
|
|
58
64
|
}
|
|
65
|
+
/**
|
|
66
|
+
* Default minimum Secure-withdrawal amounts (token units) for known Lighter
|
|
67
|
+
* assets. Used as a fallback when `LighterWithdrawalConfig.getSecureMinWithdrawalAmount`
|
|
68
|
+
* is omitted or returns `undefined` for a symbol.
|
|
69
|
+
*/
|
|
70
|
+
export declare const LIGHTER_DEFAULT_SECURE_MIN_WITHDRAWAL_AMOUNTS: Record<string, number>;
|
|
59
71
|
export interface LighterSecureWithdrawalCallbackParams {
|
|
60
72
|
/** Withdrawal amount in token units (e.g. "1.5" for 1.5 ETH). */
|
|
61
73
|
amountTokenUnits: string;
|
|
@@ -100,35 +112,30 @@ export declare function useLighterWithdrawalBalances({ accountIndex, }: {
|
|
|
100
112
|
/** Single-method config for Lighter's Secure withdrawal (bridge to Ethereum). */
|
|
101
113
|
export declare function createLighterSecureWithdrawalConfig(config: LighterSecureWithdrawalConfig): CustomWithdrawalConfig;
|
|
102
114
|
/**
|
|
103
|
-
*
|
|
115
|
+
* The single React entry point for Lighter withdrawals. Returns a
|
|
116
|
+
* `MultiMethodWithdrawalConfig` ready to hand to the withdrawal modal, or
|
|
117
|
+
* `null` while the inputs aren't ready yet.
|
|
104
118
|
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
*
|
|
119
|
+
* The hook owns every Lighter-specific concern that requires React context:
|
|
120
|
+
* - the user's Lighter account index (resolved from `config.l1Address`)
|
|
121
|
+
* - all Lighter asset balances (so the form validates against the real
|
|
122
|
+
* account)
|
|
123
|
+
* - the live Secure-withdrawal delay (`/api/v1/withdrawalDelay`)
|
|
124
|
+
* - the active locale (so the disclaimer renders correctly)
|
|
108
125
|
*
|
|
109
|
-
*
|
|
110
|
-
*
|
|
126
|
+
* Pass `null` while prerequisites (wallet, signer, etc.) aren't ready — the
|
|
127
|
+
* hook always invokes its inner hooks (Rules of Hooks) and returns `null`
|
|
128
|
+
* until you supply a real config and the account resolves:
|
|
111
129
|
*
|
|
112
130
|
* ```tsx
|
|
113
|
-
* const
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
* }
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
|
|
120
|
-
export declare function useLighterWithdrawalConfig(config: LighterWithdrawalConfig): MultiMethodWithdrawalConfig;
|
|
121
|
-
/**
|
|
122
|
-
* Creates a full {@link MultiMethodWithdrawalConfig} for Lighter that renders
|
|
123
|
-
* the Fast vs Secure selection screen before the standard withdrawal flow.
|
|
124
|
-
*
|
|
125
|
-
* Usage:
|
|
126
|
-
* ```ts
|
|
127
|
-
* const withdrawalConfig = createLighterWithdrawalConfig({
|
|
128
|
-
* accountIndex: '0',
|
|
129
|
-
* sendLighterSecureWithdrawal: async ({ amountTokenUnits, assetIndex }) => { ... },
|
|
130
|
-
* })
|
|
131
|
+
* const { address: l1Address } = useFunkitUserInfo()
|
|
132
|
+
* const lighter = useLighterWithdrawalConfig(
|
|
133
|
+
* userId && walletClient
|
|
134
|
+
* ? { l1Address, signerClient, sendLighterSecureWithdrawal, ... }
|
|
135
|
+
* : null,
|
|
136
|
+
* )
|
|
137
|
+
* if (!lighter) return { ready: false, disabledReason: '...' }
|
|
131
138
|
* ```
|
|
132
139
|
*/
|
|
133
|
-
export declare function
|
|
140
|
+
export declare function useLighterWithdrawalConfig(config: LighterWithdrawalConfig | null): MultiMethodWithdrawalConfig | null;
|
|
134
141
|
export {};
|
package/dist/clients/lighter.js
CHANGED
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
import { SOLANA_MAINNET_CHAIN_ID } from "@funkit/chains";
|
|
13
13
|
import { RELAY_LIGHTER_CHAIN_ID } from "@funkit/fun-relay";
|
|
14
14
|
import { retry } from "@lifeomic/attempt";
|
|
15
|
+
import { useQuery as useQuery2 } from "@tanstack/react-query";
|
|
15
16
|
import i18next from "i18next";
|
|
16
17
|
import React2, { useEffect, useMemo as useMemo2 } from "react";
|
|
17
18
|
import { arbitrum, base, bsc, mainnet as mainnet2, optimism } from "viem/chains";
|
|
@@ -238,6 +239,16 @@ function useFunkitConfig() {
|
|
|
238
239
|
}
|
|
239
240
|
|
|
240
241
|
// src/utils/customer.ts
|
|
242
|
+
async function getLighterAccountsByL1Address(address) {
|
|
243
|
+
const response = await fetch(
|
|
244
|
+
`https://mainnet.zklighter.elliot.ai/api/v1/accountsByL1Address?l1_address=${address}`
|
|
245
|
+
);
|
|
246
|
+
if (!response.ok) {
|
|
247
|
+
throw new Error(`Failed to fetch lighter accounts: ${response.statusText}`);
|
|
248
|
+
}
|
|
249
|
+
const data = await response.json();
|
|
250
|
+
return data;
|
|
251
|
+
}
|
|
241
252
|
async function getLighterAccount(lookup, activeOnly) {
|
|
242
253
|
const params = new URLSearchParams({
|
|
243
254
|
by: lookup.by,
|
|
@@ -274,11 +285,75 @@ function useLighterAccount(lookup, options) {
|
|
|
274
285
|
account: query.data?.accounts?.[0]
|
|
275
286
|
};
|
|
276
287
|
}
|
|
288
|
+
function useLighterAccounts({
|
|
289
|
+
address
|
|
290
|
+
}) {
|
|
291
|
+
const { apiKey } = useFunkitConfig();
|
|
292
|
+
const isLighter = isLighterxyzCustomer(apiKey);
|
|
293
|
+
const enabled = !!address && address !== "0x" && isLighter;
|
|
294
|
+
const query = useQuery({
|
|
295
|
+
queryKey: ["lighterAccounts", address],
|
|
296
|
+
queryFn: () => getLighterAccountsByL1Address(address),
|
|
297
|
+
enabled,
|
|
298
|
+
staleTime: Number.POSITIVE_INFINITY,
|
|
299
|
+
gcTime: Number.POSITIVE_INFINITY,
|
|
300
|
+
retry: false,
|
|
301
|
+
// allows us to always refetch the data but return the previous data until the new data is fetched
|
|
302
|
+
refetchOnMount: "always"
|
|
303
|
+
});
|
|
304
|
+
return {
|
|
305
|
+
...query,
|
|
306
|
+
mainAccountIndex: query.data?.sub_accounts?.[0]?.index?.toString(),
|
|
307
|
+
subAccounts: query.data?.sub_accounts
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
// src/utils/timeFormat.ts
|
|
312
|
+
import { formatSecondsToReadableForm } from "@funkit/utils";
|
|
313
|
+
function formatSecondsTranslated(seconds, t, specifyUnderMinute = false, omitSeconds = false) {
|
|
314
|
+
return formatSecondsToReadableForm(seconds, specifyUnderMinute, omitSeconds, {
|
|
315
|
+
lessThanOneMin: t("time.lessThanOneMin"),
|
|
316
|
+
seconds: (count) => t("time.seconds", { count }),
|
|
317
|
+
minutes: (count) => t("time.minutes", { count }),
|
|
318
|
+
hours: (count) => t("time.hours", { count }),
|
|
319
|
+
secondsShort: (count) => t("time.secondsShort", { count })
|
|
320
|
+
});
|
|
321
|
+
}
|
|
277
322
|
|
|
278
323
|
// src/clients/lighter.tsx
|
|
279
324
|
var LIGHTER_USDC_PERPS_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
280
325
|
var MAINNET_USDC = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48";
|
|
281
326
|
var LIGHTER_API_BASE = "https://mainnet.zklighter.elliot.ai";
|
|
327
|
+
async function getLighterWithdrawalDelay() {
|
|
328
|
+
const response = await fetch(`${LIGHTER_API_BASE}/api/v1/withdrawalDelay`);
|
|
329
|
+
if (!response.ok) {
|
|
330
|
+
throw new Error(
|
|
331
|
+
`Failed to fetch Lighter withdrawal delay: ${response.statusText}`
|
|
332
|
+
);
|
|
333
|
+
}
|
|
334
|
+
return response.json();
|
|
335
|
+
}
|
|
336
|
+
function useLighterSecureDelayText() {
|
|
337
|
+
const { t } = useFunkitTranslation();
|
|
338
|
+
const query = useQuery2({
|
|
339
|
+
queryKey: ["lighterWithdrawalDelay"],
|
|
340
|
+
queryFn: getLighterWithdrawalDelay,
|
|
341
|
+
staleTime: 6e4,
|
|
342
|
+
retry: 2
|
|
343
|
+
});
|
|
344
|
+
const seconds = query.data?.seconds;
|
|
345
|
+
if (seconds === void 0 || !Number.isFinite(seconds) || seconds <= 0) {
|
|
346
|
+
return void 0;
|
|
347
|
+
}
|
|
348
|
+
return formatSecondsTranslated(
|
|
349
|
+
seconds,
|
|
350
|
+
t,
|
|
351
|
+
/*specifyUnderMinutes*/
|
|
352
|
+
false,
|
|
353
|
+
/*omitSeconds*/
|
|
354
|
+
true
|
|
355
|
+
);
|
|
356
|
+
}
|
|
282
357
|
var LIGHTER_TX_STATUS = {
|
|
283
358
|
PENDING: 0,
|
|
284
359
|
QUEUED: 1,
|
|
@@ -402,15 +477,20 @@ function createLighterAdaptedWallet({
|
|
|
402
477
|
}
|
|
403
478
|
};
|
|
404
479
|
}
|
|
480
|
+
var LIGHTER_DEFAULT_SECURE_MIN_WITHDRAWAL_AMOUNTS = {
|
|
481
|
+
USDC: 1,
|
|
482
|
+
ETH: 1e-3,
|
|
483
|
+
LIT: 1,
|
|
484
|
+
LINK: 0.1,
|
|
485
|
+
UNI: 0.2,
|
|
486
|
+
AAVE: 0.01,
|
|
487
|
+
SKY: 20,
|
|
488
|
+
LDO: 2,
|
|
489
|
+
AZTEC: 100
|
|
490
|
+
};
|
|
405
491
|
function freeBalance(balance, lockedBalance) {
|
|
406
492
|
return String(Math.max(0, Number(balance) - Number(lockedBalance)));
|
|
407
493
|
}
|
|
408
|
-
function asLighterAccountIndex(s) {
|
|
409
|
-
if (!/^\d+$/.test(s)) {
|
|
410
|
-
throw new Error(`Invalid LighterAccountIndex: ${s}`);
|
|
411
|
-
}
|
|
412
|
-
return s;
|
|
413
|
-
}
|
|
414
494
|
function useLighterWithdrawalBalances({
|
|
415
495
|
accountIndex
|
|
416
496
|
}) {
|
|
@@ -578,23 +658,31 @@ var LIGHTER_FAST_PREVIEW_CHAIN_IDS = [
|
|
|
578
658
|
var LIGHTER_SECURE_PREVIEW_CHAIN_IDS = [mainnet2.id];
|
|
579
659
|
function buildLighterMultiMethodConfig({
|
|
580
660
|
config,
|
|
661
|
+
accountIndex,
|
|
581
662
|
t,
|
|
582
|
-
withBalance
|
|
663
|
+
withBalance,
|
|
664
|
+
secureDelayText
|
|
583
665
|
}) {
|
|
584
666
|
const fastConfig = buildLighterFastWalletWithdrawalConfig({
|
|
585
667
|
signerClient: config.signerClient,
|
|
586
|
-
accountIndex: Number(
|
|
668
|
+
accountIndex: Number(accountIndex),
|
|
587
669
|
modalTitle: config.modalTitle,
|
|
588
670
|
disableConnectedWallet: config.disableConnectedWallet,
|
|
589
671
|
iconSrc: config.fastIconSrc
|
|
590
672
|
});
|
|
591
673
|
const secureConfig = createLighterSecureWithdrawalConfig({
|
|
592
|
-
accountIndex
|
|
674
|
+
accountIndex,
|
|
593
675
|
modalTitle: config.modalTitle,
|
|
594
676
|
disableConnectedWallet: config.disableConnectedWallet,
|
|
595
677
|
iconSrc: config.secureIconSrc,
|
|
596
678
|
sendLighterSecureWithdrawal: config.sendLighterSecureWithdrawal,
|
|
597
|
-
getMinWithdrawalAmount:
|
|
679
|
+
getMinWithdrawalAmount: (symbol) => {
|
|
680
|
+
const userMin = config.getSecureMinWithdrawalAmount?.(symbol);
|
|
681
|
+
if (userMin !== void 0) {
|
|
682
|
+
return userMin;
|
|
683
|
+
}
|
|
684
|
+
return LIGHTER_DEFAULT_SECURE_MIN_WITHDRAWAL_AMOUNTS[symbol.toUpperCase()] ?? 0;
|
|
685
|
+
}
|
|
598
686
|
});
|
|
599
687
|
const fast = {
|
|
600
688
|
id: "lighter-fast",
|
|
@@ -612,7 +700,12 @@ function buildLighterMultiMethodConfig({
|
|
|
612
700
|
const secure = {
|
|
613
701
|
id: "lighter-secure",
|
|
614
702
|
keyText: t("withdrawal.methodSecure"),
|
|
615
|
-
subtitleText: t("withdrawal.secureDisclaimer"
|
|
703
|
+
subtitleText: t("withdrawal.secureDisclaimer", {
|
|
704
|
+
// Until the live value loads, show the localized "60+ minutes"
|
|
705
|
+
// historical estimate. The "+" lives in the per-locale fallback string
|
|
706
|
+
// so it doesn't bleed into live values, which are exact.
|
|
707
|
+
delay: secureDelayText ?? t("withdrawal.secureFallbackDelay")
|
|
708
|
+
}),
|
|
616
709
|
icon: /* @__PURE__ */ React2.createElement(EvmWallet, { size: 20 }),
|
|
617
710
|
valueIcon: /* @__PURE__ */ React2.createElement(ChainIconStack, { chainIds: LIGHTER_SECURE_PREVIEW_CHAIN_IDS }),
|
|
618
711
|
config: withBalance ? {
|
|
@@ -630,27 +723,30 @@ function buildLighterMultiMethodConfig({
|
|
|
630
723
|
}
|
|
631
724
|
function useLighterWithdrawalConfig(config) {
|
|
632
725
|
const { t } = useFunkitTranslation();
|
|
726
|
+
const { mainAccountIndex } = useLighterAccounts({
|
|
727
|
+
address: config?.l1Address
|
|
728
|
+
});
|
|
729
|
+
const accountIndex = mainAccountIndex && /^\d+$/.test(mainAccountIndex) ? mainAccountIndex : void 0;
|
|
633
730
|
const { balances } = useLighterWithdrawalBalances({
|
|
634
|
-
accountIndex
|
|
731
|
+
accountIndex
|
|
635
732
|
});
|
|
636
|
-
|
|
637
|
-
|
|
733
|
+
const secureDelayText = useLighterSecureDelayText();
|
|
734
|
+
return useMemo2(() => {
|
|
735
|
+
if (!config || !accountIndex) {
|
|
736
|
+
return null;
|
|
737
|
+
}
|
|
738
|
+
return buildLighterMultiMethodConfig({
|
|
638
739
|
config,
|
|
740
|
+
accountIndex,
|
|
639
741
|
t,
|
|
640
|
-
withBalance: (symbol) => () => balances[symbol.toUpperCase()] ?? "0"
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
);
|
|
644
|
-
}
|
|
645
|
-
function createLighterWithdrawalConfig(config) {
|
|
646
|
-
return buildLighterMultiMethodConfig({
|
|
647
|
-
config,
|
|
648
|
-
t: i18next.t.bind(i18next)
|
|
649
|
-
});
|
|
742
|
+
withBalance: (symbol) => () => balances[symbol.toUpperCase()] ?? "0",
|
|
743
|
+
secureDelayText
|
|
744
|
+
});
|
|
745
|
+
}, [config, accountIndex, balances, t, secureDelayText]);
|
|
650
746
|
}
|
|
651
747
|
export {
|
|
748
|
+
LIGHTER_DEFAULT_SECURE_MIN_WITHDRAWAL_AMOUNTS,
|
|
652
749
|
createLighterSecureWithdrawalConfig,
|
|
653
|
-
createLighterWithdrawalConfig,
|
|
654
750
|
freeBalance,
|
|
655
751
|
useLighterWithdrawalBalances,
|
|
656
752
|
useLighterWithdrawalConfig
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
lightTheme
|
|
4
|
-
} from "./chunk-76E6MOLR.js";
|
|
5
2
|
import {
|
|
6
3
|
darkTheme
|
|
7
4
|
} from "./chunk-AVVB5AIE.js";
|
|
5
|
+
import {
|
|
6
|
+
lightTheme
|
|
7
|
+
} from "./chunk-76E6MOLR.js";
|
|
8
8
|
import {
|
|
9
9
|
systemFontStack
|
|
10
10
|
} from "./chunk-O35RTEEF.js";
|
|
@@ -1140,7 +1140,7 @@ function useMainnetEnsName(address) {
|
|
|
1140
1140
|
import {
|
|
1141
1141
|
getAllWalletTokens
|
|
1142
1142
|
} from "@funkit/api-base";
|
|
1143
|
-
import { keepPreviousData as keepPreviousData2, useQuery as
|
|
1143
|
+
import { keepPreviousData as keepPreviousData2, useQuery as useQuery27 } from "@tanstack/react-query";
|
|
1144
1144
|
import { arbitrum as arbitrum8, polygon as polygon9 } from "viem/chains";
|
|
1145
1145
|
|
|
1146
1146
|
// src/domains/asset.ts
|
|
@@ -2987,7 +2987,7 @@ function setFunkitConnectVersion({ version }) {
|
|
|
2987
2987
|
localStorage.setItem(storageKey, version);
|
|
2988
2988
|
}
|
|
2989
2989
|
function getCurrentSdkVersion() {
|
|
2990
|
-
return "9.
|
|
2990
|
+
return "9.10.0";
|
|
2991
2991
|
}
|
|
2992
2992
|
function useFingerprint() {
|
|
2993
2993
|
const fingerprint = useCallback3(() => {
|
|
@@ -11217,7 +11217,8 @@ var en_default = {
|
|
|
11217
11217
|
methodFast: "Fast",
|
|
11218
11218
|
methodSecure: "Secure",
|
|
11219
11219
|
fastDisclaimer: "USDC Perps only \xB7 Multiple chains \xB7 Instant",
|
|
11220
|
-
secureDisclaimer: "All tokens \xB7 Ethereum chain only \xB7
|
|
11220
|
+
secureDisclaimer: "All tokens \xB7 Ethereum chain only \xB7 {{delay}}",
|
|
11221
|
+
secureFallbackDelay: "60+ minutes"
|
|
11221
11222
|
},
|
|
11222
11223
|
directExecution: {
|
|
11223
11224
|
fillStatus: "Fill status",
|
|
@@ -11774,7 +11775,8 @@ var es_default = {
|
|
|
11774
11775
|
methodFast: "R\xE1pido",
|
|
11775
11776
|
methodSecure: "Seguro",
|
|
11776
11777
|
fastDisclaimer: "Solo USDC Perps \xB7 M\xFAltiples cadenas \xB7 Instant\xE1neo",
|
|
11777
|
-
secureDisclaimer: "Todos los tokens \xB7 Solo cadena Ethereum \xB7
|
|
11778
|
+
secureDisclaimer: "Todos los tokens \xB7 Solo cadena Ethereum \xB7 {{delay}}",
|
|
11779
|
+
secureFallbackDelay: "60+ minutos"
|
|
11778
11780
|
},
|
|
11779
11781
|
directExecution: {
|
|
11780
11782
|
fillStatus: "Estado de completado",
|
|
@@ -12327,7 +12329,8 @@ var fr_default = {
|
|
|
12327
12329
|
methodFast: "Rapide",
|
|
12328
12330
|
methodSecure: "S\xE9curis\xE9",
|
|
12329
12331
|
fastDisclaimer: "USDC Perps uniquement \xB7 Plusieurs cha\xEEnes \xB7 Instantan\xE9",
|
|
12330
|
-
secureDisclaimer: "Tous les tokens \xB7 Cha\xEEne Ethereum uniquement \xB7
|
|
12332
|
+
secureDisclaimer: "Tous les tokens \xB7 Cha\xEEne Ethereum uniquement \xB7 {{delay}}",
|
|
12333
|
+
secureFallbackDelay: "60+ minutes"
|
|
12331
12334
|
},
|
|
12332
12335
|
directExecution: {
|
|
12333
12336
|
fillStatus: "Statut d'ex\xE9cution",
|
|
@@ -12879,8 +12882,9 @@ var ja_default = {
|
|
|
12879
12882
|
sectionCrypto: "\u6697\u53F7\u8CC7\u7523",
|
|
12880
12883
|
methodFast: "\u9AD8\u901F",
|
|
12881
12884
|
methodSecure: "\u30BB\u30AD\u30E5\u30A2",
|
|
12882
|
-
fastDisclaimer: "USDC\
|
|
12883
|
-
secureDisclaimer: "\u5168\u30C8\u30FC\u30AF\u30F3 \xB7 \u30A4\u30FC\u30B5\u30EA\u30A2\u30E0\u30C1\u30A7\u30FC\u30F3\u306E\u307F \xB7
|
|
12885
|
+
fastDisclaimer: "USDC\u30D1\u30FC\u30D7\u30B9\u306E\u307F \xB7 \u8907\u6570\u30C1\u30A7\u30FC\u30F3 \xB7 \u5373\u6642",
|
|
12886
|
+
secureDisclaimer: "\u5168\u30C8\u30FC\u30AF\u30F3 \xB7 \u30A4\u30FC\u30B5\u30EA\u30A2\u30E0\u30C1\u30A7\u30FC\u30F3\u306E\u307F \xB7 {{delay}}",
|
|
12887
|
+
secureFallbackDelay: "60\u5206\u4EE5\u4E0A"
|
|
12884
12888
|
},
|
|
12885
12889
|
directExecution: {
|
|
12886
12890
|
fillStatus: "\u51E6\u7406\u72B6\u6CC1",
|
|
@@ -13432,8 +13436,9 @@ var ko_default = {
|
|
|
13432
13436
|
sectionCrypto: "\uC554\uD638\uD654\uD3D0",
|
|
13433
13437
|
methodFast: "\uBE60\uB978",
|
|
13434
13438
|
methodSecure: "\uBCF4\uC548",
|
|
13435
|
-
fastDisclaimer: "USDC \
|
|
13436
|
-
secureDisclaimer: "\uBAA8\uB4E0 \uD1A0\uD070 \xB7 \uC774\uB354\uB9AC\uC6C0 \uCCB4\uC778\uB9CC \xB7
|
|
13439
|
+
fastDisclaimer: "USDC \uD37C\uD504\uC2A4\uB9CC \xB7 \uB2E4\uC911 \uCCB4\uC778 \xB7 \uC989\uC2DC",
|
|
13440
|
+
secureDisclaimer: "\uBAA8\uB4E0 \uD1A0\uD070 \xB7 \uC774\uB354\uB9AC\uC6C0 \uCCB4\uC778\uB9CC \xB7 {{delay}}",
|
|
13441
|
+
secureFallbackDelay: "60\uBD84 \uC774\uC0C1"
|
|
13437
13442
|
},
|
|
13438
13443
|
directExecution: {
|
|
13439
13444
|
fillStatus: "\uCC98\uB9AC \uC0C1\uD0DC",
|
|
@@ -13986,7 +13991,8 @@ var ru_default = {
|
|
|
13986
13991
|
methodFast: "\u0411\u044B\u0441\u0442\u0440\u044B\u0439",
|
|
13987
13992
|
methodSecure: "\u0411\u0435\u0437\u043E\u043F\u0430\u0441\u043D\u044B\u0439",
|
|
13988
13993
|
fastDisclaimer: "\u0422\u043E\u043B\u044C\u043A\u043E USDC \u0431\u0435\u0441\u0441\u0440\u043E\u0447\u043D\u044B\u0435 \xB7 \u041D\u0435\u0441\u043A\u043E\u043B\u044C\u043A\u043E \u0441\u0435\u0442\u0435\u0439 \xB7 \u041C\u0433\u043D\u043E\u0432\u0435\u043D\u043D\u043E",
|
|
13989
|
-
secureDisclaimer: "\u0412\u0441\u0435 \u0442\u043E\u043A\u0435\u043D\u044B \xB7 \u0422\u043E\u043B\u044C\u043A\u043E \u0441\u0435\u0442\u044C Ethereum \xB7
|
|
13994
|
+
secureDisclaimer: "\u0412\u0441\u0435 \u0442\u043E\u043A\u0435\u043D\u044B \xB7 \u0422\u043E\u043B\u044C\u043A\u043E \u0441\u0435\u0442\u044C Ethereum \xB7 {{delay}}",
|
|
13995
|
+
secureFallbackDelay: "60+ \u043C\u0438\u043D\u0443\u0442"
|
|
13990
13996
|
},
|
|
13991
13997
|
directExecution: {
|
|
13992
13998
|
fillStatus: "\u0421\u0442\u0430\u0442\u0443\u0441 \u0432\u044B\u043F\u043E\u043B\u043D\u0435\u043D\u0438\u044F",
|
|
@@ -14539,7 +14545,8 @@ var tr_default = {
|
|
|
14539
14545
|
methodFast: "H\u0131zl\u0131",
|
|
14540
14546
|
methodSecure: "G\xFCvenli",
|
|
14541
14547
|
fastDisclaimer: "Yaln\u0131zca USDC Perps \xB7 Birden fazla zincir \xB7 An\u0131nda",
|
|
14542
|
-
secureDisclaimer: "T\xFCm tokenlar \xB7 Yaln\u0131zca Ethereum zinciri \xB7
|
|
14548
|
+
secureDisclaimer: "T\xFCm tokenlar \xB7 Yaln\u0131zca Ethereum zinciri \xB7 {{delay}}",
|
|
14549
|
+
secureFallbackDelay: "60+ dakika"
|
|
14543
14550
|
},
|
|
14544
14551
|
directExecution: {
|
|
14545
14552
|
fillStatus: "\u0130\u015Flem durumu",
|
|
@@ -15092,7 +15099,8 @@ var zh_default = {
|
|
|
15092
15099
|
methodFast: "\u5FEB\u901F",
|
|
15093
15100
|
methodSecure: "\u5B89\u5168",
|
|
15094
15101
|
fastDisclaimer: "\u4EC5\u9650USDC\u6C38\u7EED \xB7 \u591A\u94FE \xB7 \u5373\u65F6",
|
|
15095
|
-
secureDisclaimer: "\u6240\u6709\u4EE3\u5E01 \xB7 \u4EC5\u4EE5\u592A\u574A\u94FE \xB7
|
|
15102
|
+
secureDisclaimer: "\u6240\u6709\u4EE3\u5E01 \xB7 \u4EC5\u4EE5\u592A\u574A\u94FE \xB7 {{delay}}",
|
|
15103
|
+
secureFallbackDelay: "60\u5206\u949F\u4EE5\u4E0A"
|
|
15096
15104
|
},
|
|
15097
15105
|
directExecution: {
|
|
15098
15106
|
fillStatus: "\u586B\u5145\u72B6\u6001",
|
|
@@ -18835,6 +18843,7 @@ import { mainnet as mainnet7 } from "viem/chains";
|
|
|
18835
18843
|
import { SOLANA_MAINNET_CHAIN_ID } from "@funkit/chains";
|
|
18836
18844
|
import { RELAY_LIGHTER_CHAIN_ID as RELAY_LIGHTER_CHAIN_ID2 } from "@funkit/fun-relay";
|
|
18837
18845
|
import { retry } from "@lifeomic/attempt";
|
|
18846
|
+
import { useQuery as useQuery13 } from "@tanstack/react-query";
|
|
18838
18847
|
import i18next from "i18next";
|
|
18839
18848
|
import React67, { useEffect as useEffect28, useMemo as useMemo23 } from "react";
|
|
18840
18849
|
import { arbitrum as arbitrum6, base as base7, bsc as bsc2, mainnet as mainnet5, optimism as optimism2 } from "viem/chains";
|
|
@@ -18862,6 +18871,18 @@ var EvmWallet = ({ size = 20 }) => /* @__PURE__ */ React66.createElement(
|
|
|
18862
18871
|
)
|
|
18863
18872
|
);
|
|
18864
18873
|
|
|
18874
|
+
// src/utils/timeFormat.ts
|
|
18875
|
+
import { formatSecondsToReadableForm } from "@funkit/utils";
|
|
18876
|
+
function formatSecondsTranslated(seconds, t, specifyUnderMinute = false, omitSeconds = false) {
|
|
18877
|
+
return formatSecondsToReadableForm(seconds, specifyUnderMinute, omitSeconds, {
|
|
18878
|
+
lessThanOneMin: t("time.lessThanOneMin"),
|
|
18879
|
+
seconds: (count) => t("time.seconds", { count }),
|
|
18880
|
+
minutes: (count) => t("time.minutes", { count }),
|
|
18881
|
+
hours: (count) => t("time.hours", { count }),
|
|
18882
|
+
secondsShort: (count) => t("time.secondsShort", { count })
|
|
18883
|
+
});
|
|
18884
|
+
}
|
|
18885
|
+
|
|
18865
18886
|
// src/clients/lighter.tsx
|
|
18866
18887
|
function freeBalance(balance, lockedBalance) {
|
|
18867
18888
|
return String(Math.max(0, Number(balance) - Number(lockedBalance)));
|
|
@@ -20402,7 +20423,10 @@ function LighterSecureReceiveAmountValue({
|
|
|
20402
20423
|
size: "withdrawalYouWillReceive",
|
|
20403
20424
|
weight: "withdrawalYouWillReceiveValueCrypto"
|
|
20404
20425
|
},
|
|
20405
|
-
amount ? formatCryptoAndStringify2(Number(amount), tokenSymbol
|
|
20426
|
+
amount ? formatCryptoAndStringify2(Number(amount), tokenSymbol, true, {
|
|
20427
|
+
minBeforeUseScientific: 0,
|
|
20428
|
+
numberFormatOptions: { maximumFractionDigits: 8 }
|
|
20429
|
+
}) : NO_DATA_VALUE
|
|
20406
20430
|
);
|
|
20407
20431
|
}
|
|
20408
20432
|
var LIGHTER_EXPLORER_BASE = "https://app.lighter.xyz/explorer/logs";
|
|
@@ -20507,14 +20531,14 @@ import React107, { useCallback as useCallback23, useEffect as useEffect34, useMe
|
|
|
20507
20531
|
import {
|
|
20508
20532
|
getDirectExecutionsByUserId as getDirectExecutionsByUserId2
|
|
20509
20533
|
} from "@funkit/api-base";
|
|
20510
|
-
import { useQuery as
|
|
20534
|
+
import { useQuery as useQuery15 } from "@tanstack/react-query";
|
|
20511
20535
|
import { useMemo as useMemo25 } from "react";
|
|
20512
20536
|
|
|
20513
20537
|
// src/hooks/queries/useRecentCheckouts.ts
|
|
20514
20538
|
import {
|
|
20515
20539
|
getCheckoutsByUserId as getCheckoutsByUserId2
|
|
20516
20540
|
} from "@funkit/api-base";
|
|
20517
|
-
import { useQuery as
|
|
20541
|
+
import { useQuery as useQuery14 } from "@tanstack/react-query";
|
|
20518
20542
|
var hasCorrectPaymentMethod = (checkout, paymentMethod) => !paymentMethod || checkout.clientMetadata.selectedPaymentMethodInfo?.paymentMethod === paymentMethod;
|
|
20519
20543
|
var isRecent = (checkout, timestampCutoff) => checkout.createdTimeMs > timestampCutoff;
|
|
20520
20544
|
var DEFAULT_NOTIF_CUTOFF = 7 * 24 * 60 * 60 * 1e3;
|
|
@@ -20527,7 +20551,7 @@ var useRecentCheckouts = ({
|
|
|
20527
20551
|
const { listRefresh } = useDynamicConfig(
|
|
20528
20552
|
"checkoutnotificationsrefreshinterval"
|
|
20529
20553
|
);
|
|
20530
|
-
const query =
|
|
20554
|
+
const query = useQuery14({
|
|
20531
20555
|
queryKey: ["checkouts", userInfo.id],
|
|
20532
20556
|
queryFn: async () => {
|
|
20533
20557
|
const checkouts = await getCheckoutsByUserId2({
|
|
@@ -20594,7 +20618,7 @@ function useRecentDepositsImpl({
|
|
|
20594
20618
|
apiKey
|
|
20595
20619
|
}) {
|
|
20596
20620
|
const isFasterNotificationsEnabled = useFeatureGate("faster-notifications");
|
|
20597
|
-
const { data: directExecutions } =
|
|
20621
|
+
const { data: directExecutions } = useQuery15({
|
|
20598
20622
|
queryKey: [
|
|
20599
20623
|
"useRecentDepositsImpl",
|
|
20600
20624
|
userId,
|
|
@@ -20712,20 +20736,6 @@ import React89, { useEffect as useEffect32 } from "react";
|
|
|
20712
20736
|
|
|
20713
20737
|
// src/hooks/useCheckoutTimeEstimate.ts
|
|
20714
20738
|
import { mainnet as mainnet8 } from "viem/chains";
|
|
20715
|
-
|
|
20716
|
-
// src/utils/timeFormat.ts
|
|
20717
|
-
import { formatSecondsToReadableForm } from "@funkit/utils";
|
|
20718
|
-
function formatSecondsTranslated(seconds, t, specifyUnderMinute = false, omitSeconds = false) {
|
|
20719
|
-
return formatSecondsToReadableForm(seconds, specifyUnderMinute, omitSeconds, {
|
|
20720
|
-
lessThanOneMin: t("time.lessThanOneMin"),
|
|
20721
|
-
seconds: (count) => t("time.seconds", { count }),
|
|
20722
|
-
minutes: (count) => t("time.minutes", { count }),
|
|
20723
|
-
hours: (count) => t("time.hours", { count }),
|
|
20724
|
-
secondsShort: (count) => t("time.secondsShort", { count })
|
|
20725
|
-
});
|
|
20726
|
-
}
|
|
20727
|
-
|
|
20728
|
-
// src/hooks/useCheckoutTimeEstimate.ts
|
|
20729
20739
|
var LAYERZEO_OFT_TIME_ESTIMATE_SECONDS = 180;
|
|
20730
20740
|
function useCheckoutTimeEstimate(latestQuote, originalTimeEstimationMs, paymentMethod, bypassFlag) {
|
|
20731
20741
|
const { t } = useFunkitTranslation();
|
|
@@ -20785,10 +20795,10 @@ import { polygon as polygon6 } from "viem/chains";
|
|
|
20785
20795
|
import {
|
|
20786
20796
|
getSupportedAssets
|
|
20787
20797
|
} from "@funkit/api-base";
|
|
20788
|
-
import { useQuery as
|
|
20798
|
+
import { useQuery as useQuery16 } from "@tanstack/react-query";
|
|
20789
20799
|
function useSupportedAssets(options) {
|
|
20790
20800
|
const { apiKey } = useFunkitConfig();
|
|
20791
|
-
return
|
|
20801
|
+
return useQuery16({
|
|
20792
20802
|
queryKey: ["getSupportedAssets", apiKey],
|
|
20793
20803
|
queryFn: () => getSupportedAssets({ apiKey, logger }),
|
|
20794
20804
|
refetchOnMount: false,
|
|
@@ -25006,7 +25016,7 @@ function FunNotification({
|
|
|
25006
25016
|
|
|
25007
25017
|
// src/hooks/queries/useWithdrawalQuote.ts
|
|
25008
25018
|
import { isTokenEquivalent as isTokenEquivalent2 } from "@funkit/utils";
|
|
25009
|
-
import { useQuery as
|
|
25019
|
+
import { useQuery as useQuery17 } from "@tanstack/react-query";
|
|
25010
25020
|
|
|
25011
25021
|
// src/hooks/useIsBlacklistedWithdrawalAddress.ts
|
|
25012
25022
|
import { isTokenAddressEquivalent as isTokenAddressEquivalent2 } from "@funkit/utils";
|
|
@@ -25055,7 +25065,7 @@ function useWithdrawalQuote({
|
|
|
25055
25065
|
secondTokenAddress: selectedTokenAddress
|
|
25056
25066
|
});
|
|
25057
25067
|
const { logEvent } = useTrack();
|
|
25058
|
-
const query =
|
|
25068
|
+
const query = useQuery17({
|
|
25059
25069
|
queryKey: [
|
|
25060
25070
|
"withdrawal",
|
|
25061
25071
|
"quote",
|
|
@@ -25117,12 +25127,12 @@ function useWithdrawalQuote({
|
|
|
25117
25127
|
}
|
|
25118
25128
|
|
|
25119
25129
|
// src/hooks/queries/useWithdrawalRisk.ts
|
|
25120
|
-
import { useQuery as
|
|
25130
|
+
import { useQuery as useQuery18 } from "@tanstack/react-query";
|
|
25121
25131
|
import { useEffect as useEffect37, useRef as useRef17 } from "react";
|
|
25122
25132
|
import { isAddress as isAddress2 } from "viem";
|
|
25123
25133
|
var useWithdrawalRisk = (apiKey, receiveAddress) => {
|
|
25124
25134
|
const lastRiskyAddressRef = useRef17(null);
|
|
25125
|
-
const query =
|
|
25135
|
+
const query = useQuery18({
|
|
25126
25136
|
queryKey: ["withdrawal", "addressRisk", apiKey, receiveAddress],
|
|
25127
25137
|
queryFn: async () => {
|
|
25128
25138
|
try {
|
|
@@ -25161,17 +25171,17 @@ import {
|
|
|
25161
25171
|
convertFunToRelayTokenAddress,
|
|
25162
25172
|
getRelayAssetPriceInfo
|
|
25163
25173
|
} from "@funkit/fun-relay";
|
|
25164
|
-
import { skipToken, useQuery as
|
|
25174
|
+
import { skipToken, useQuery as useQuery20 } from "@tanstack/react-query";
|
|
25165
25175
|
|
|
25166
25176
|
// src/hooks/queries/useErc20Asset.ts
|
|
25167
25177
|
import { getAssetErc20ByChainAndSymbol } from "@funkit/api-base";
|
|
25168
|
-
import { useQuery as
|
|
25178
|
+
import { useQuery as useQuery19 } from "@tanstack/react-query";
|
|
25169
25179
|
var useErc20Asset = ({
|
|
25170
25180
|
chainId,
|
|
25171
25181
|
symbol
|
|
25172
25182
|
}) => {
|
|
25173
25183
|
const { apiKey } = useFunkitConfig();
|
|
25174
|
-
const query =
|
|
25184
|
+
const query = useQuery19({
|
|
25175
25185
|
queryKey: ["erc20Asset", chainId, symbol],
|
|
25176
25186
|
queryFn: async () => {
|
|
25177
25187
|
if (!apiKey || !chainId || !symbol) {
|
|
@@ -25225,7 +25235,7 @@ function useAssetAddressPrice({
|
|
|
25225
25235
|
}) {
|
|
25226
25236
|
const { apiKey } = useFunkitConfig();
|
|
25227
25237
|
const isStablecoin = useIsStablecoin();
|
|
25228
|
-
const { data, error, isLoading } =
|
|
25238
|
+
const { data, error, isLoading } = useQuery20({
|
|
25229
25239
|
queryKey: ["getAssetPriceInfo", chainId, assetTokenAddress],
|
|
25230
25240
|
queryFn: chainId && assetTokenAddress ? async () => {
|
|
25231
25241
|
try {
|
|
@@ -25541,6 +25551,28 @@ var useTokenAndChainDropdown = ({
|
|
|
25541
25551
|
};
|
|
25542
25552
|
};
|
|
25543
25553
|
|
|
25554
|
+
// src/utils/polymarket.ts
|
|
25555
|
+
import {
|
|
25556
|
+
encodeAbiParameters,
|
|
25557
|
+
getAddress as getAddress3,
|
|
25558
|
+
getCreate2Address,
|
|
25559
|
+
keccak256,
|
|
25560
|
+
parseAbiParameters
|
|
25561
|
+
} from "viem";
|
|
25562
|
+
var EOA_PROXY_WALLET_FACTORY_ADDRESS = "0xaacFeEa03eb1561C4e67d661e40682Bd20E3541b";
|
|
25563
|
+
var EOA_PROXY_WALLET_INIT_CODE_HASH = "0x2bce2127ff07fb632d16c8347c4ebf501f4841168bed00d9e6ef715ddb6fcecf";
|
|
25564
|
+
function derivePolymarketProxyAddress(address) {
|
|
25565
|
+
return getAddress3(
|
|
25566
|
+
getCreate2Address({
|
|
25567
|
+
from: EOA_PROXY_WALLET_FACTORY_ADDRESS,
|
|
25568
|
+
salt: keccak256(
|
|
25569
|
+
encodeAbiParameters(parseAbiParameters("address"), [address])
|
|
25570
|
+
),
|
|
25571
|
+
bytecodeHash: EOA_PROXY_WALLET_INIT_CODE_HASH
|
|
25572
|
+
})
|
|
25573
|
+
);
|
|
25574
|
+
}
|
|
25575
|
+
|
|
25544
25576
|
// src/modals/WithdrawalModal/WithdrawAmountInput.tsx
|
|
25545
25577
|
import { RELAY_LIGHTER_CHAIN_ID as RELAY_LIGHTER_CHAIN_ID4 } from "@funkit/fun-relay";
|
|
25546
25578
|
import {
|
|
@@ -25620,7 +25652,8 @@ function WithdrawAmountInput({
|
|
|
25620
25652
|
)
|
|
25621
25653
|
}
|
|
25622
25654
|
), /* @__PURE__ */ React123.createElement(Box, { display: "flex", alignItems: "center", justifyContent: "space-between" }, /* @__PURE__ */ React123.createElement(Text, { size: "12", color: "secondaryText" }, sourceTokenUsdPrice === void 0 ? "-" : formatCurrencyAndStringify5(
|
|
25623
|
-
Number(withdrawalUSD) * sourceTokenUsdPrice
|
|
25655
|
+
Number(withdrawalUSD) * sourceTokenUsdPrice,
|
|
25656
|
+
{ minBeforeUseScientific: 0 }
|
|
25624
25657
|
)), Number(sourceTokenBalance) > 0 && /* @__PURE__ */ React123.createElement(Text, { size: "12", color: "secondaryText" }, t("withdrawal.balance", {
|
|
25625
25658
|
amount: formatCryptoAndStringify3(Number(sourceTokenBalance)),
|
|
25626
25659
|
symbol: activeSymbol
|
|
@@ -26586,6 +26619,7 @@ var WithdrawContent = ({
|
|
|
26586
26619
|
const [recipientAddress, setRecipientAddress] = useState38("");
|
|
26587
26620
|
const [withdrawalUSD, setWithdrawalUSD] = useState38("");
|
|
26588
26621
|
const { isLighterSecure, connectedAddress, lighterBalances, lighterAssets } = useLighterWithdrawal(config, setRecipientAddress);
|
|
26622
|
+
const { address: connectedWalletAddress } = useAccount();
|
|
26589
26623
|
const sourceTokenBalance = lighterBalances[selectedSourceToken.toUpperCase()] ?? fallbackBalance;
|
|
26590
26624
|
const { price: sourceTokenUsdPrice } = useAssetSymbolPrice({
|
|
26591
26625
|
chainId: "1",
|
|
@@ -26757,6 +26791,8 @@ var WithdrawContent = ({
|
|
|
26757
26791
|
recipientAddress
|
|
26758
26792
|
);
|
|
26759
26793
|
const isRecipientBlacklisted = useIsBlacklistedWithdrawalAddress(recipientAddress);
|
|
26794
|
+
const polymarketSourceAddress = isPolymarketCustomer(apiKey) && connectedWalletAddress ? derivePolymarketProxyAddress(connectedWalletAddress) : void 0;
|
|
26795
|
+
const isWithdrawingToSourceAddress = !!polymarketSourceAddress && recipientAddress.toLowerCase() === polymarketSourceAddress.toLowerCase();
|
|
26760
26796
|
const lastTargetAssetErrorRef = useRef19(null);
|
|
26761
26797
|
const lastQuoteErrorRef = useRef19(null);
|
|
26762
26798
|
const lastRiskyRecipientRef = useRef19(null);
|
|
@@ -26833,7 +26869,8 @@ var WithdrawContent = ({
|
|
|
26833
26869
|
lastBlacklistedRecipientRef.current = warningKey;
|
|
26834
26870
|
}, [isRecipientBlacklisted, recipientAddress, selectedChainId, selectedToken]);
|
|
26835
26871
|
const bottomSectionRef = useBottomSectionRef("withdrawal");
|
|
26836
|
-
const
|
|
26872
|
+
const isRecipientInputValid = isValidAddress && !isWithdrawingToSourceAddress;
|
|
26873
|
+
const hasAddressError = !isRecipientInputValid && recipientAddress !== "";
|
|
26837
26874
|
const hasAmountError = withdrawalUSD !== "" && !isWithdrawAmountValid;
|
|
26838
26875
|
function computeCanContinue() {
|
|
26839
26876
|
const baseChecks = !!recipientAddress && !!withdrawalUSD && !hasAmountError && !hasAddressError && !isCheckingAddressRisk && !isRisky && !isRecipientBlacklisted;
|
|
@@ -26861,7 +26898,7 @@ var WithdrawContent = ({
|
|
|
26861
26898
|
return /* @__PURE__ */ React125.createElement(
|
|
26862
26899
|
WithdrawRecipientAddress,
|
|
26863
26900
|
{
|
|
26864
|
-
isValidAddress,
|
|
26901
|
+
isValidAddress: isRecipientInputValid,
|
|
26865
26902
|
recipientAddress,
|
|
26866
26903
|
config,
|
|
26867
26904
|
setRecipientAddress,
|
|
@@ -27156,7 +27193,7 @@ import {
|
|
|
27156
27193
|
RailConfigType,
|
|
27157
27194
|
getFops as getFops2
|
|
27158
27195
|
} from "@funkit/api-base";
|
|
27159
|
-
import { useQuery as
|
|
27196
|
+
import { useQuery as useQuery21 } from "@tanstack/react-query";
|
|
27160
27197
|
import { useMemo as useMemo36 } from "react";
|
|
27161
27198
|
var ENABLE_MOCK_SWAPPED_WITHDRAWAL = true;
|
|
27162
27199
|
var MOCK_SELL_URL = "https://widget.swapped.com/sell?apiKey=pk_live_eb64dc98ae0903092bc2be6e63237542&externalCustomerId=eyJjdXN0b21lcklkIjoic3U0Z25veHoxNCIsImRlcG9zaXRBZGRyZXNzIjoiMHg3NDJkMzVDYzY2MzRDMDUzMjkyNWEzYjg0NEJjOWU3NTk1ZjBiRWIxIiwicGF5bWVudFByb3ZpZGVySWQiOiJTV0FQUEVEIiwidXNlcklkIjoidXNlci0xMjMifQ%3D%3D&method=bank-transfer&baseCountry=US&userSendsFunds=false&cryptoCurrencyCode=USDC_POLYGON&cryptoCurrencyAmount=10&fiatCurrencyCode=USD&signature=%2FqliUixrZQx2NYgtf6fPfb6JZBe8wHsuuZTe9QIS9L0%3D";
|
|
@@ -27202,7 +27239,7 @@ var useWithdrawFops = (params) => {
|
|
|
27202
27239
|
const userId = userInfo.id;
|
|
27203
27240
|
const countryCode = userIpInfo?.alpha2;
|
|
27204
27241
|
const isEnabled = !ENABLE_MOCK_SWAPPED_WITHDRAWAL && !!apiKey && !!userId && !!userInfo.address && !!countryCode && !!params.sourceChainId && !!params.sourceTokenAddress && !isSwappedCurrencyCodeLoading;
|
|
27205
|
-
const query =
|
|
27242
|
+
const query = useQuery21({
|
|
27206
27243
|
queryKey: [
|
|
27207
27244
|
"withdrawFops",
|
|
27208
27245
|
userId,
|
|
@@ -33153,7 +33190,7 @@ import React204, { useEffect as useEffect52 } from "react";
|
|
|
33153
33190
|
|
|
33154
33191
|
// src/hooks/queries/useMeldCurrencies.ts
|
|
33155
33192
|
import { getMeldSupportedFiat } from "@funkit/api-base";
|
|
33156
|
-
import { useQuery as
|
|
33193
|
+
import { useQuery as useQuery22 } from "@tanstack/react-query";
|
|
33157
33194
|
var getPriority = (currencyCode) => {
|
|
33158
33195
|
if (currencyCode === "USD") {
|
|
33159
33196
|
return 0;
|
|
@@ -33165,7 +33202,7 @@ var getPriority = (currencyCode) => {
|
|
|
33165
33202
|
};
|
|
33166
33203
|
var useMeldCurrencies = (isEnabled = true) => {
|
|
33167
33204
|
const { apiKey } = useFunkitConfig();
|
|
33168
|
-
const query =
|
|
33205
|
+
const query = useQuery22({
|
|
33169
33206
|
queryKey: ["meld", "currencies"],
|
|
33170
33207
|
queryFn: async () => {
|
|
33171
33208
|
if (!apiKey) {
|
|
@@ -33191,12 +33228,12 @@ var useMeldCurrencies = (isEnabled = true) => {
|
|
|
33191
33228
|
|
|
33192
33229
|
// src/hooks/queries/useMeldDefaultCurrency.ts
|
|
33193
33230
|
import { getMeldDefaultFiat } from "@funkit/api-base";
|
|
33194
|
-
import { useQuery as
|
|
33231
|
+
import { useQuery as useQuery23 } from "@tanstack/react-query";
|
|
33195
33232
|
var useMeldDefaultCurrency = (paymentMethod) => {
|
|
33196
33233
|
const { apiKey } = useFunkitConfig();
|
|
33197
33234
|
const { userIpInfo } = useFunkitUserIp();
|
|
33198
33235
|
const enableMeld = useIsMeldEnabled();
|
|
33199
|
-
const query =
|
|
33236
|
+
const query = useQuery23({
|
|
33200
33237
|
queryKey: ["meld", "defaultCurrency", paymentMethod],
|
|
33201
33238
|
queryFn: async () => {
|
|
33202
33239
|
if (!apiKey) {
|
|
@@ -33222,7 +33259,7 @@ var useMeldDefaultCurrency = (paymentMethod) => {
|
|
|
33222
33259
|
// src/hooks/queries/useMeldLimits.ts
|
|
33223
33260
|
import { getMeldFiatLimits } from "@funkit/api-base";
|
|
33224
33261
|
import { formatCurrencyAndStringify as formatCurrencyAndStringify8 } from "@funkit/utils";
|
|
33225
|
-
import { useQuery as
|
|
33262
|
+
import { useQuery as useQuery24 } from "@tanstack/react-query";
|
|
33226
33263
|
|
|
33227
33264
|
// src/consts/meld.ts
|
|
33228
33265
|
var MELD_MIN_LIMIT_BUFFER = 5;
|
|
@@ -33268,7 +33305,7 @@ var useMeldLimits = (isEnabled = true) => {
|
|
|
33268
33305
|
const { userIpInfo } = useFunkitUserIp();
|
|
33269
33306
|
const cryptoCurrency = useMeldCryptoCurrencyCode();
|
|
33270
33307
|
const countryCode = userIpInfo?.alpha2;
|
|
33271
|
-
const query =
|
|
33308
|
+
const query = useQuery24({
|
|
33272
33309
|
queryKey: ["meld", "limits", countryCode, cryptoCurrency],
|
|
33273
33310
|
queryFn: async () => {
|
|
33274
33311
|
if (!apiKey || !countryCode) {
|
|
@@ -35733,7 +35770,7 @@ var useMeldLink = (sourceAmount, sourceCurrencyCode = "USD") => {
|
|
|
35733
35770
|
|
|
35734
35771
|
// src/modals/CheckoutModal/MeldQuotes/useMeldQuotes.tsx
|
|
35735
35772
|
import { getMeldQuotes } from "@funkit/api-base";
|
|
35736
|
-
import { useQuery as
|
|
35773
|
+
import { useQuery as useQuery25 } from "@tanstack/react-query";
|
|
35737
35774
|
import { useDebounce as useDebounce2 } from "use-debounce";
|
|
35738
35775
|
var DEBOUNCE_DELAY = 500;
|
|
35739
35776
|
var COUNTDOWN_INTERVAL_SEC = 60;
|
|
@@ -35746,7 +35783,7 @@ var useMeldQuotes = (sourceAmount, fiatCurrency, meldEnabled = true) => {
|
|
|
35746
35783
|
const destinationCurrencyCode = useMeldCryptoCurrencyCode();
|
|
35747
35784
|
const isPolymarket = isPolymarketCustomer(apiKey);
|
|
35748
35785
|
const sourceCurrencyCode = fiatCurrency || "USD";
|
|
35749
|
-
const query =
|
|
35786
|
+
const query = useQuery25({
|
|
35750
35787
|
queryKey: [
|
|
35751
35788
|
"meld",
|
|
35752
35789
|
"quotes",
|
|
@@ -44856,13 +44893,13 @@ var FunNotificationBanner = ({
|
|
|
44856
44893
|
import {
|
|
44857
44894
|
getCheckoutByDepositAddress as getCheckoutByDepositAddress2
|
|
44858
44895
|
} from "@funkit/api-base";
|
|
44859
|
-
import { useQuery as
|
|
44896
|
+
import { useQuery as useQuery26 } from "@tanstack/react-query";
|
|
44860
44897
|
var useCheckout = (depositAddress, initial) => {
|
|
44861
44898
|
const { apiKey } = useFunkitConfig();
|
|
44862
44899
|
const { itemRefresh } = useDynamicConfig(
|
|
44863
44900
|
"checkoutnotificationsrefreshinterval"
|
|
44864
44901
|
);
|
|
44865
|
-
const query =
|
|
44902
|
+
const query = useQuery26({
|
|
44866
44903
|
queryKey: ["checkouts", "checkout", depositAddress],
|
|
44867
44904
|
queryFn: () => getCheckoutByDepositAddress2({
|
|
44868
44905
|
// biome-ignore lint/style/noNonNullAssertion: already checked for null
|
|
@@ -47213,7 +47250,7 @@ var useWalletAssets = ({
|
|
|
47213
47250
|
} = {}) => {
|
|
47214
47251
|
const { address, isConnected } = useAccount();
|
|
47215
47252
|
const { apiKey } = useFunkitConfig();
|
|
47216
|
-
const { data, isLoading, isFetching } =
|
|
47253
|
+
const { data, isLoading, isFetching } = useQuery27({
|
|
47217
47254
|
queryKey: ["getWalletAssets", address, apiKey],
|
|
47218
47255
|
meta: stepQueryMeta({
|
|
47219
47256
|
name: "walletAssets",
|
|
@@ -5,9 +5,6 @@ import {
|
|
|
5
5
|
import {
|
|
6
6
|
zerionWallet
|
|
7
7
|
} from "./chunk-UFYNHHDU.js";
|
|
8
|
-
import {
|
|
9
|
-
tahoWallet
|
|
10
|
-
} from "./chunk-KS5MJNGD.js";
|
|
11
8
|
import {
|
|
12
9
|
talismanWallet
|
|
13
10
|
} from "./chunk-T3VMQBBI.js";
|
|
@@ -18,29 +15,32 @@ import {
|
|
|
18
15
|
tokenaryWallet
|
|
19
16
|
} from "./chunk-R7X5RIO7.js";
|
|
20
17
|
import {
|
|
21
|
-
|
|
22
|
-
} from "./chunk-
|
|
23
|
-
import {
|
|
24
|
-
uniswapWallet
|
|
25
|
-
} from "./chunk-UKSIXGWC.js";
|
|
18
|
+
tahoWallet
|
|
19
|
+
} from "./chunk-KS5MJNGD.js";
|
|
26
20
|
import {
|
|
27
21
|
walletConnectWallet
|
|
28
22
|
} from "./chunk-O7ZCUI2Y.js";
|
|
23
|
+
import {
|
|
24
|
+
uniswapWallet
|
|
25
|
+
} from "./chunk-UKSIXGWC.js";
|
|
29
26
|
import {
|
|
30
27
|
xdefiWallet
|
|
31
28
|
} from "./chunk-KSNA53EX.js";
|
|
32
29
|
import {
|
|
33
|
-
|
|
34
|
-
} from "./chunk-
|
|
30
|
+
trustWallet
|
|
31
|
+
} from "./chunk-FWM4KTOV.js";
|
|
32
|
+
import {
|
|
33
|
+
phantomWallet
|
|
34
|
+
} from "./chunk-57GN4W23.js";
|
|
35
35
|
import {
|
|
36
36
|
rainbowWallet
|
|
37
37
|
} from "./chunk-AZYMJ4C6.js";
|
|
38
|
-
import {
|
|
39
|
-
ramperWallet
|
|
40
|
-
} from "./chunk-P4E2ZFQB.js";
|
|
41
38
|
import {
|
|
42
39
|
roninWallet
|
|
43
40
|
} from "./chunk-OSOB6QYX.js";
|
|
41
|
+
import {
|
|
42
|
+
ramperWallet
|
|
43
|
+
} from "./chunk-P4E2ZFQB.js";
|
|
44
44
|
import {
|
|
45
45
|
safeWallet
|
|
46
46
|
} from "./chunk-BHAPTB57.js";
|
|
@@ -53,12 +53,12 @@ import {
|
|
|
53
53
|
import {
|
|
54
54
|
subWallet
|
|
55
55
|
} from "./chunk-ZJJWGKB6.js";
|
|
56
|
-
import {
|
|
57
|
-
metaMaskWallet
|
|
58
|
-
} from "./chunk-IRHK6SOW.js";
|
|
59
56
|
import {
|
|
60
57
|
mewWallet
|
|
61
58
|
} from "./chunk-DP5ICBEB.js";
|
|
59
|
+
import {
|
|
60
|
+
metaMaskWallet
|
|
61
|
+
} from "./chunk-IRHK6SOW.js";
|
|
62
62
|
import {
|
|
63
63
|
oktoWallet
|
|
64
64
|
} from "./chunk-BBPTPMH7.js";
|
|
@@ -75,8 +75,8 @@ import {
|
|
|
75
75
|
oneKeyWallet
|
|
76
76
|
} from "./chunk-E3NZE4UP.js";
|
|
77
77
|
import {
|
|
78
|
-
|
|
79
|
-
} from "./chunk-
|
|
78
|
+
rabbyWallet
|
|
79
|
+
} from "./chunk-7PVUEV4M.js";
|
|
80
80
|
import {
|
|
81
81
|
foxWallet
|
|
82
82
|
} from "./chunk-YGMU5VWD.js";
|
|
@@ -86,33 +86,33 @@ import {
|
|
|
86
86
|
import {
|
|
87
87
|
frontierWallet
|
|
88
88
|
} from "./chunk-J3PJOMO7.js";
|
|
89
|
-
import {
|
|
90
|
-
gateWallet
|
|
91
|
-
} from "./chunk-LEAZMT5Y.js";
|
|
92
89
|
import {
|
|
93
90
|
imTokenWallet
|
|
94
91
|
} from "./chunk-BWLMNATA.js";
|
|
95
92
|
import {
|
|
96
|
-
|
|
97
|
-
} from "./chunk-
|
|
93
|
+
gateWallet
|
|
94
|
+
} from "./chunk-LEAZMT5Y.js";
|
|
98
95
|
import {
|
|
99
96
|
injectedWallet
|
|
100
97
|
} from "./chunk-HPUEYLLS.js";
|
|
98
|
+
import {
|
|
99
|
+
kresusWallet
|
|
100
|
+
} from "./chunk-O4IDLNBH.js";
|
|
101
101
|
import {
|
|
102
102
|
ledgerWallet
|
|
103
103
|
} from "./chunk-V4EXM3KB.js";
|
|
104
104
|
import {
|
|
105
|
-
|
|
106
|
-
} from "./chunk-
|
|
105
|
+
bitskiWallet
|
|
106
|
+
} from "./chunk-Y36HPFB3.js";
|
|
107
107
|
import {
|
|
108
108
|
clvWallet
|
|
109
109
|
} from "./chunk-3ZJN3PXP.js";
|
|
110
|
-
import {
|
|
111
|
-
coinbaseWallet
|
|
112
|
-
} from "./chunk-OUM6H3WU.js";
|
|
113
110
|
import {
|
|
114
111
|
coin98Wallet
|
|
115
112
|
} from "./chunk-RZQ4B4Z7.js";
|
|
113
|
+
import {
|
|
114
|
+
coinbaseWallet
|
|
115
|
+
} from "./chunk-OUM6H3WU.js";
|
|
116
116
|
import {
|
|
117
117
|
coreWallet
|
|
118
118
|
} from "./chunk-55VS2NKG.js";
|
|
@@ -134,19 +134,19 @@ import {
|
|
|
134
134
|
import {
|
|
135
135
|
bitgetWallet
|
|
136
136
|
} from "./chunk-IMNI4AGV.js";
|
|
137
|
-
import {
|
|
138
|
-
bitskiWallet
|
|
139
|
-
} from "./chunk-Y36HPFB3.js";
|
|
140
137
|
import {
|
|
141
138
|
bitverseWallet
|
|
142
139
|
} from "./chunk-RZH4FSX7.js";
|
|
143
140
|
import {
|
|
144
141
|
bloomWallet
|
|
145
142
|
} from "./chunk-S6R4B763.js";
|
|
146
|
-
import "./chunk-FMVNQKZL.js";
|
|
147
143
|
import {
|
|
148
144
|
braveWallet
|
|
149
145
|
} from "./chunk-XVH4JIXB.js";
|
|
146
|
+
import {
|
|
147
|
+
bybitWallet
|
|
148
|
+
} from "./chunk-7IEUTLHY.js";
|
|
149
|
+
import "./chunk-FMVNQKZL.js";
|
|
150
150
|
import "./chunk-YYYRPQHB.js";
|
|
151
151
|
import "./chunk-3K2MFXCO.js";
|
|
152
152
|
export {
|