@funkit/connect 10.6.0 → 11.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.
- package/CHANGELOG.md +27 -0
- package/dist/clients/chunk-2FSEE3AW.js +277 -0
- package/dist/clients/chunk-5MY7WMEJ.js +20 -0
- package/dist/clients/chunk-6CYZKITE.js +33 -0
- package/dist/clients/{chunk-TG2AACP2.js → chunk-C4SHJFOV.js} +2 -2
- package/dist/clients/{chunk-3LJQTM37.js → chunk-FNB7OPJI.js} +12 -198
- package/dist/clients/{chunk-2NBYHUIW.js → chunk-HZP4DXIZ.js} +1 -0
- package/dist/clients/{chunk-F6P4CN27.js → chunk-JD2J5K6S.js} +16 -8
- package/dist/clients/chunk-LT4EWLDA.js +30 -0
- package/dist/clients/chunk-MGQLVTSH.js +100 -0
- package/dist/clients/{chunk-FJ6GCMJ4.js → chunk-OODIKHYE.js} +3 -1
- package/dist/clients/chunk-SFDEST63.js +18 -0
- package/dist/clients/{chunk-OZ3KD24N.js → chunk-ZCCLJW6F.js} +0 -8
- package/dist/clients/fanatics.js +5 -6
- package/dist/clients/internal/nado/encoding.js +4 -25
- package/dist/clients/internal/nado/gateway.d.ts +0 -21
- package/dist/clients/internal/nado/gateway.js +1 -5
- package/dist/clients/internal/nado/hooks.d.ts +0 -158
- package/dist/clients/internal/nado/hooks.js +10 -121
- package/dist/clients/internal/nado/withdrawalConfig.js +3 -13
- package/dist/clients/internal/nado/withdrawalForm.css +17529 -0
- package/dist/clients/internal/nado/withdrawalForm.d.ts +41 -0
- package/dist/clients/internal/nado/withdrawalForm.js +283 -0
- package/dist/clients/internal/nado/withdrawalTypes.d.ts +7 -2
- package/dist/clients/lighter.d.ts +29 -1
- package/dist/clients/lighter.js +105 -99
- package/dist/clients/mallard.js +24 -3
- package/dist/clients/polymarket/PolymarketDepositAccountDropdown.js +6 -3
- package/dist/clients/polymarket/index.js +6 -3
- package/dist/domains/swapped.d.ts +1 -10
- package/dist/hooks/useTokenAndChainDropdown.d.ts +8 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1369 -892
- package/dist/modals/WithdrawalModal/LighterWithdrawal.d.ts +20 -31
- package/dist/modals/WithdrawalModal/WithdrawAmountInput.d.ts +5 -9
- package/dist/providers/FunkitCheckoutContext/types.d.ts +61 -4
- package/dist/utils/customer.d.ts +349 -0
- package/dist/utils/withdrawal.d.ts +13 -6
- package/dist/wagmi/actions.d.ts +1 -1
- package/dist/wallets/Wallet.d.ts +21 -1
- package/dist/wallets/walletConnectors/index.js +11 -11
- package/package.json +3 -3
- package/dist/clients/chunk-A4WQS6QG.js +0 -207
- package/dist/clients/internal/nado/products.d.ts +0 -36
- package/dist/clients/internal/nado/products.js +0 -19
package/dist/clients/lighter.js
CHANGED
|
@@ -1,20 +1,25 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
|
-
AsyncImage
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
AsyncImage,
|
|
4
|
+
sanitizeUrl
|
|
5
|
+
} from "./chunk-HZP4DXIZ.js";
|
|
6
|
+
import "./chunk-OODIKHYE.js";
|
|
6
7
|
import {
|
|
7
8
|
chainMetadataById,
|
|
8
|
-
useFunkitConfig,
|
|
9
9
|
useFunkitConnectChainsById
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-FNB7OPJI.js";
|
|
11
|
+
import {
|
|
12
|
+
useFunkitConfig,
|
|
13
|
+
useLighterAccountQuery,
|
|
14
|
+
useLighterAccountsQuery
|
|
15
|
+
} from "./chunk-2FSEE3AW.js";
|
|
11
16
|
import {
|
|
12
17
|
Box
|
|
13
18
|
} from "./chunk-LUHEVXPD.js";
|
|
14
19
|
import "./chunk-UPZNKPYU.js";
|
|
15
20
|
import {
|
|
16
21
|
useFunkitTranslation
|
|
17
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-JD2J5K6S.js";
|
|
18
23
|
import {
|
|
19
24
|
logger
|
|
20
25
|
} from "./chunk-AHYOV7AV.js";
|
|
@@ -22,18 +27,18 @@ import {
|
|
|
22
27
|
// src/clients/lighter.tsx
|
|
23
28
|
import {
|
|
24
29
|
DirectExecutionType as DirectExecutionType2,
|
|
25
|
-
LIGHTERXYZ_API_KEY
|
|
30
|
+
LIGHTERXYZ_API_KEY,
|
|
26
31
|
createDirectExecution as createDirectExecution2
|
|
27
32
|
} from "@funkit/api-base";
|
|
28
33
|
import { LIGHTER_CHAIN_ID, SOLANA_MAINNET_CHAIN_ID } from "@funkit/chains";
|
|
29
34
|
import { RELAY_LIGHTER_CHAIN_ID as RELAY_LIGHTER_CHAIN_ID2 } from "@funkit/fun-relay";
|
|
30
35
|
import { retry } from "@lifeomic/attempt";
|
|
31
|
-
import { useQuery as
|
|
36
|
+
import { useQuery as useQuery2 } from "@tanstack/react-query";
|
|
32
37
|
import i18next from "i18next";
|
|
33
38
|
import React4, { useMemo as useMemo2 } from "react";
|
|
34
39
|
import { v4 as uuid2 } from "uuid";
|
|
35
|
-
import { pad, parseUnits as parseUnits3, toHex } from "viem";
|
|
36
|
-
import { arbitrum, base, bsc, mainnet as
|
|
40
|
+
import { pad as pad2, parseUnits as parseUnits3, toHex } from "viem";
|
|
41
|
+
import { arbitrum, base, bsc, mainnet as mainnet2, optimism } from "viem/chains";
|
|
37
42
|
|
|
38
43
|
// src/components/ChainIcon/ChainIcon.tsx
|
|
39
44
|
import React from "react";
|
|
@@ -157,89 +162,15 @@ import { RELAY_LIGHTER_CHAIN_ID } from "@funkit/fun-relay";
|
|
|
157
162
|
import { formatAddress, formatCryptoAndStringify } from "@funkit/utils";
|
|
158
163
|
import { v4 as uuid } from "uuid";
|
|
159
164
|
import React3, {
|
|
160
|
-
useCallback as
|
|
165
|
+
useCallback as useCallback2,
|
|
161
166
|
useEffect,
|
|
162
167
|
useMemo,
|
|
163
168
|
useRef,
|
|
164
169
|
useState
|
|
165
170
|
} from "react";
|
|
166
171
|
import { createPortal } from "react-dom";
|
|
167
|
-
import { parseUnits as parseUnits2 } from "viem";
|
|
168
|
-
import { mainnet as mainnet2 } from "viem/chains";
|
|
169
|
-
|
|
170
|
-
// src/utils/customer.ts
|
|
171
|
-
import { useQuery as useQuery2, useQueryClient } from "@tanstack/react-query";
|
|
172
|
-
import { useCallback as useCallback2 } from "react";
|
|
173
|
-
|
|
174
|
-
// src/consts/customers.ts
|
|
175
|
-
import {
|
|
176
|
-
AAVE_API_KEY,
|
|
177
|
-
AVANTIS_API_KEY,
|
|
178
|
-
BASED_API_KEY,
|
|
179
|
-
BSX_API_KEY,
|
|
180
|
-
ETHEREAL_API_KEY,
|
|
181
|
-
FANATICS_API_KEY,
|
|
182
|
-
HYENA_API_KEY,
|
|
183
|
-
HYPERDASH_API_KEY,
|
|
184
|
-
LIGHTERXYZ_API_KEY,
|
|
185
|
-
MALLARD_API_KEY,
|
|
186
|
-
MONAD_API_KEY,
|
|
187
|
-
MONKEY_TILT_API_KEY,
|
|
188
|
-
NADO_API_KEY,
|
|
189
|
-
OSTIUM_API_KEY,
|
|
190
|
-
PERPL_API_KEY,
|
|
191
|
-
POLYMARKET_API_KEY
|
|
192
|
-
} from "@funkit/api-base";
|
|
172
|
+
import { numberToHex, pad, parseUnits as parseUnits2 } from "viem";
|
|
193
173
|
import { mainnet } from "viem/chains";
|
|
194
|
-
function isLighterxyzCustomer(apiKey) {
|
|
195
|
-
return apiKey === LIGHTERXYZ_API_KEY;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
// src/utils/customer.ts
|
|
199
|
-
var LIGHTER_MAIN_ACCOUNT_TYPE = 0;
|
|
200
|
-
var LIGHTER_TRADING_MODE = {
|
|
201
|
-
SIMPLE: 0,
|
|
202
|
-
UNIFIED: 1
|
|
203
|
-
};
|
|
204
|
-
async function getLighterAccountsByL1Address(address) {
|
|
205
|
-
const response = await fetch(
|
|
206
|
-
`https://mainnet.zklighter.elliot.ai/api/v1/accountsByL1Address?l1_address=${address}`
|
|
207
|
-
);
|
|
208
|
-
if (!response.ok) {
|
|
209
|
-
throw new Error(`Failed to fetch lighter accounts: ${response.statusText}`);
|
|
210
|
-
}
|
|
211
|
-
const data = await response.json();
|
|
212
|
-
return data;
|
|
213
|
-
}
|
|
214
|
-
function useLighterAccounts({
|
|
215
|
-
address
|
|
216
|
-
}) {
|
|
217
|
-
const { apiKey } = useFunkitConfig();
|
|
218
|
-
const isLighter = isLighterxyzCustomer(apiKey);
|
|
219
|
-
const enabled = !!address && address !== "0x" && isLighter;
|
|
220
|
-
const query = useQuery2({
|
|
221
|
-
queryKey: ["lighterAccounts", address],
|
|
222
|
-
queryFn: () => getLighterAccountsByL1Address(address),
|
|
223
|
-
enabled,
|
|
224
|
-
staleTime: Number.POSITIVE_INFINITY,
|
|
225
|
-
gcTime: Number.POSITIVE_INFINITY,
|
|
226
|
-
retry: false,
|
|
227
|
-
// allows us to always refetch the data but return the previous data until the new data is fetched
|
|
228
|
-
refetchOnMount: "always"
|
|
229
|
-
});
|
|
230
|
-
const subAccounts = query.data?.sub_accounts;
|
|
231
|
-
const mainAccount = subAccounts?.find(
|
|
232
|
-
(account) => account.account_type === LIGHTER_MAIN_ACCOUNT_TYPE
|
|
233
|
-
);
|
|
234
|
-
return {
|
|
235
|
-
...query,
|
|
236
|
-
mainAccountIndex: mainAccount?.index?.toString(),
|
|
237
|
-
// False until the accounts load — consumers fall back to the simple-mode
|
|
238
|
-
// UI (both USDC variants shown) while the trading mode is unknown.
|
|
239
|
-
isUnifiedTradingMode: mainAccount?.account_trading_mode === LIGHTER_TRADING_MODE.UNIFIED,
|
|
240
|
-
subAccounts
|
|
241
|
-
};
|
|
242
|
-
}
|
|
243
174
|
|
|
244
175
|
// src/utils/lighter.ts
|
|
245
176
|
import {
|
|
@@ -300,6 +231,23 @@ function isLighterWithdrawalRateLimitError(error) {
|
|
|
300
231
|
return message.includes("23004") || message.includes("23005") || message.includes("rate limit") || message.includes("ratelimit");
|
|
301
232
|
}
|
|
302
233
|
|
|
234
|
+
// src/utils/tokenIconUrl.ts
|
|
235
|
+
var getLocalTokenIconUrl = (symbol) => {
|
|
236
|
+
return ASSET_LOGO_SRCS[symbol.toUpperCase()] || `https://sdk-cdn.fun.xyz/images/${encodeURIComponent(symbol.toLowerCase())}.svg`;
|
|
237
|
+
};
|
|
238
|
+
var getTokenIconUrl = (symbol, tokens) => {
|
|
239
|
+
if (tokens) {
|
|
240
|
+
const token = tokens.find(
|
|
241
|
+
(token2) => token2.tokenSymbol.toLowerCase() === symbol.toLowerCase()
|
|
242
|
+
);
|
|
243
|
+
if (token) {
|
|
244
|
+
return sanitizeUrl(token.iconSrc) ?? getLocalTokenIconUrl(symbol);
|
|
245
|
+
}
|
|
246
|
+
return getLocalTokenIconUrl(symbol);
|
|
247
|
+
}
|
|
248
|
+
return getLocalTokenIconUrl(symbol);
|
|
249
|
+
};
|
|
250
|
+
|
|
303
251
|
// src/utils/timeFormat.ts
|
|
304
252
|
import { formatSecondsToReadableForm } from "@funkit/utils";
|
|
305
253
|
function formatSecondsTranslated(seconds, t, specifyUnderMinute = false, omitSeconds = false) {
|
|
@@ -315,6 +263,7 @@ function formatSecondsTranslated(seconds, t, specifyUnderMinute = false, omitSec
|
|
|
315
263
|
// src/modals/WithdrawalModal/LighterWithdrawal.tsx
|
|
316
264
|
var LIGHTER_FAST_METHOD_ID = "lighter-fast";
|
|
317
265
|
var LIGHTER_SECURE_METHOD_ID = "lighter-secure";
|
|
266
|
+
var LIGHTER_USDC_SPOT_SYMBOL = "USDC (Spot)";
|
|
318
267
|
var LIGHTER_ROUTE_TYPE = {
|
|
319
268
|
PERPS: 0,
|
|
320
269
|
SPOT: 1
|
|
@@ -350,7 +299,7 @@ async function getLighterWithdrawalDelay() {
|
|
|
350
299
|
}
|
|
351
300
|
function useLighterSecureDelayText() {
|
|
352
301
|
const { t } = useFunkitTranslation();
|
|
353
|
-
const query =
|
|
302
|
+
const query = useQuery2({
|
|
354
303
|
queryKey: ["lighterWithdrawalDelay"],
|
|
355
304
|
queryFn: getLighterWithdrawalDelay,
|
|
356
305
|
staleTime: 6e4,
|
|
@@ -526,7 +475,7 @@ async function trackLighterSecureWithdrawal({
|
|
|
526
475
|
const estTotalUsd = Number(withdrawalUSD);
|
|
527
476
|
const safeAmount = truncateToDecimals(amountTokenUnits, decimals);
|
|
528
477
|
const baseUnitAmount = parseUnits3(safeAmount, decimals).toString();
|
|
529
|
-
const fromTokenAddress =
|
|
478
|
+
const fromTokenAddress = pad2(toHex(assetIndex), { size: 20 });
|
|
530
479
|
await createDirectExecution2({
|
|
531
480
|
apiKey,
|
|
532
481
|
logger,
|
|
@@ -539,7 +488,7 @@ async function trackLighterSecureWithdrawal({
|
|
|
539
488
|
recipientAddr,
|
|
540
489
|
fromChainId: LIGHTER_CHAIN_ID.toString(),
|
|
541
490
|
fromTokenAddress,
|
|
542
|
-
toChainId:
|
|
491
|
+
toChainId: mainnet2.id.toString(),
|
|
543
492
|
toTokenAddress: mainnetTokenAddress,
|
|
544
493
|
fromAmountBaseUnit: baseUnitAmount,
|
|
545
494
|
toAmountBaseUnit: baseUnitAmount,
|
|
@@ -556,7 +505,7 @@ async function trackLighterSecureWithdrawal({
|
|
|
556
505
|
initSettings: {
|
|
557
506
|
config: {
|
|
558
507
|
targetAsset: mainnetTokenAddress,
|
|
559
|
-
targetChain:
|
|
508
|
+
targetChain: mainnet2.id.toString(),
|
|
560
509
|
targetAssetTicker: symbol
|
|
561
510
|
}
|
|
562
511
|
},
|
|
@@ -619,7 +568,7 @@ function buildSecureWithdrawalCallback({
|
|
|
619
568
|
txHash
|
|
620
569
|
});
|
|
621
570
|
void trackLighterSecureWithdrawal({
|
|
622
|
-
apiKey:
|
|
571
|
+
apiKey: LIGHTERXYZ_API_KEY,
|
|
623
572
|
// Secure locks the destination to the connected wallet, so the L1
|
|
624
573
|
// recipient address doubles as the userId for tracking purposes.
|
|
625
574
|
userId: destinationAddress,
|
|
@@ -645,10 +594,12 @@ function createLighterSecureWithdrawalConfig(config) {
|
|
|
645
594
|
modalTitle: config.modalTitle ?? i18next.t("withdrawal.withdraw"),
|
|
646
595
|
disableConnectedWallet: config.disableConnectedWallet,
|
|
647
596
|
onBeforeSign: config.onBeforeSign,
|
|
597
|
+
sourceTokens: config.sourceTokens,
|
|
598
|
+
withdrawalSourceTokenBalance: config.withdrawalSourceTokenBalance,
|
|
648
599
|
withdrawCallback: buildSecureWithdrawalCallback({
|
|
649
600
|
exec: config.sendLighterSecureWithdrawal
|
|
650
601
|
}),
|
|
651
|
-
sourceChainId:
|
|
602
|
+
sourceChainId: mainnet2.id.toString(),
|
|
652
603
|
sourceTokenSymbol: "USDC",
|
|
653
604
|
defaultReceiveToken: "USDC",
|
|
654
605
|
sourceTokenAddress: MAINNET_USDC,
|
|
@@ -657,13 +608,46 @@ function createLighterSecureWithdrawalConfig(config) {
|
|
|
657
608
|
getMinWithdrawalAmount: config.getMinWithdrawalAmount
|
|
658
609
|
};
|
|
659
610
|
}
|
|
611
|
+
function buildLighterSourceTokenOptions({
|
|
612
|
+
isSecure,
|
|
613
|
+
lighterAssets,
|
|
614
|
+
isUnifiedTradingMode = false
|
|
615
|
+
}) {
|
|
616
|
+
const usdcOption = {
|
|
617
|
+
symbol: "USDC",
|
|
618
|
+
label: isUnifiedTradingMode ? "USDC" : "USDC (Perps)",
|
|
619
|
+
iconSrc: getTokenIconUrl("USDC")
|
|
620
|
+
};
|
|
621
|
+
if (!isSecure) {
|
|
622
|
+
return [usdcOption];
|
|
623
|
+
}
|
|
624
|
+
const spotOptions = lighterAssets.filter(
|
|
625
|
+
(asset) => !(isUnifiedTradingMode && asset.symbol.toUpperCase() === "USDC")
|
|
626
|
+
).map((asset) => {
|
|
627
|
+
if (asset.symbol.toUpperCase() === "USDC") {
|
|
628
|
+
return {
|
|
629
|
+
symbol: LIGHTER_USDC_SPOT_SYMBOL,
|
|
630
|
+
label: LIGHTER_USDC_SPOT_SYMBOL,
|
|
631
|
+
iconSrc: getTokenIconUrl("USDC")
|
|
632
|
+
};
|
|
633
|
+
}
|
|
634
|
+
return {
|
|
635
|
+
symbol: asset.symbol,
|
|
636
|
+
label: asset.symbol,
|
|
637
|
+
iconSrc: getTokenIconUrl(asset.symbol)
|
|
638
|
+
};
|
|
639
|
+
});
|
|
640
|
+
return [usdcOption, ...spotOptions];
|
|
641
|
+
}
|
|
660
642
|
function buildLighterFastWalletWithdrawalConfig({
|
|
661
643
|
signerClient,
|
|
662
644
|
accountIndex,
|
|
663
645
|
modalTitle,
|
|
664
646
|
disableConnectedWallet,
|
|
665
647
|
iconSrc,
|
|
666
|
-
onBeforeSign
|
|
648
|
+
onBeforeSign,
|
|
649
|
+
isUnifiedTradingMode,
|
|
650
|
+
withdrawalSourceTokenBalance
|
|
667
651
|
}) {
|
|
668
652
|
const adaptedWallet = createLighterAdaptedWallet({
|
|
669
653
|
signerClient,
|
|
@@ -691,6 +675,12 @@ function buildLighterFastWalletWithdrawalConfig({
|
|
|
691
675
|
wallet,
|
|
692
676
|
sourceChainId: RELAY_LIGHTER_CHAIN_ID2,
|
|
693
677
|
sourceTokenSymbol: "USDC",
|
|
678
|
+
sourceTokens: buildLighterSourceTokenOptions({
|
|
679
|
+
isSecure: false,
|
|
680
|
+
lighterAssets: [],
|
|
681
|
+
isUnifiedTradingMode
|
|
682
|
+
}),
|
|
683
|
+
withdrawalSourceTokenBalance,
|
|
694
684
|
defaultReceiveToken: "USDC",
|
|
695
685
|
sourceTokenAddress: LIGHTER_USDC_PERPS_ADDRESS,
|
|
696
686
|
iconSrc: iconSrc ?? "https://sdk-cdn.fun.xyz/images/logos/lighter.png",
|
|
@@ -716,13 +706,14 @@ var LIGHTER_FAST_PREVIEW_CHAIN_IDS = [
|
|
|
716
706
|
bsc.id,
|
|
717
707
|
SOLANA_MAINNET_CHAIN_ID
|
|
718
708
|
];
|
|
719
|
-
var LIGHTER_SECURE_PREVIEW_CHAIN_IDS = [
|
|
709
|
+
var LIGHTER_SECURE_PREVIEW_CHAIN_IDS = [mainnet2.id];
|
|
720
710
|
function buildLighterMultiMethodConfig({
|
|
721
711
|
config,
|
|
722
712
|
accountIndex,
|
|
723
713
|
t,
|
|
724
714
|
secureDelayText,
|
|
725
|
-
isUnifiedTradingMode
|
|
715
|
+
isUnifiedTradingMode,
|
|
716
|
+
assets
|
|
726
717
|
}) {
|
|
727
718
|
const fastConfig = buildLighterFastWalletWithdrawalConfig({
|
|
728
719
|
signerClient: config.signerClient,
|
|
@@ -730,10 +721,18 @@ function buildLighterMultiMethodConfig({
|
|
|
730
721
|
modalTitle: config.modalTitle,
|
|
731
722
|
disableConnectedWallet: config.disableConnectedWallet,
|
|
732
723
|
iconSrc: config.fastIconSrc,
|
|
733
|
-
onBeforeSign: config.onBeforeSign
|
|
724
|
+
onBeforeSign: config.onBeforeSign,
|
|
725
|
+
isUnifiedTradingMode,
|
|
726
|
+
withdrawalSourceTokenBalance: config.withdrawalSourceTokenBalance
|
|
734
727
|
});
|
|
735
728
|
const secureConfig = createLighterSecureWithdrawalConfig({
|
|
736
729
|
accountIndex,
|
|
730
|
+
sourceTokens: buildLighterSourceTokenOptions({
|
|
731
|
+
isSecure: true,
|
|
732
|
+
lighterAssets: assets,
|
|
733
|
+
isUnifiedTradingMode
|
|
734
|
+
}),
|
|
735
|
+
withdrawalSourceTokenBalance: config.withdrawalSourceTokenBalance,
|
|
737
736
|
modalTitle: config.modalTitle,
|
|
738
737
|
disableConnectedWallet: config.disableConnectedWallet,
|
|
739
738
|
iconSrc: config.secureIconSrc,
|
|
@@ -778,11 +777,16 @@ function buildLighterMultiMethodConfig({
|
|
|
778
777
|
}
|
|
779
778
|
function useLighterWithdrawalConfig(config) {
|
|
780
779
|
const { t } = useFunkitTranslation();
|
|
781
|
-
const { mainAccountIndex, isUnifiedTradingMode } =
|
|
780
|
+
const { mainAccountIndex, isUnifiedTradingMode } = useLighterAccountsQuery({
|
|
782
781
|
address: config?.l1Address
|
|
783
782
|
});
|
|
784
783
|
const accountIndex = mainAccountIndex && /^\d+$/.test(mainAccountIndex) ? mainAccountIndex : void 0;
|
|
785
784
|
const secureDelayText = useLighterSecureDelayText();
|
|
785
|
+
const { account } = useLighterAccountQuery(
|
|
786
|
+
// Validated numeric above, so the template-literal narrowing is safe.
|
|
787
|
+
accountIndex ? { by: "index", value: accountIndex } : null
|
|
788
|
+
);
|
|
789
|
+
const assets = useMemo2(() => account?.assets ?? [], [account]);
|
|
786
790
|
return useMemo2(() => {
|
|
787
791
|
if (!config || !accountIndex) {
|
|
788
792
|
return null;
|
|
@@ -792,15 +796,17 @@ function useLighterWithdrawalConfig(config) {
|
|
|
792
796
|
accountIndex,
|
|
793
797
|
t,
|
|
794
798
|
secureDelayText,
|
|
795
|
-
isUnifiedTradingMode
|
|
799
|
+
isUnifiedTradingMode,
|
|
800
|
+
assets
|
|
796
801
|
});
|
|
797
|
-
}, [config, accountIndex, t, secureDelayText, isUnifiedTradingMode]);
|
|
802
|
+
}, [config, accountIndex, t, secureDelayText, isUnifiedTradingMode, assets]);
|
|
798
803
|
}
|
|
799
804
|
export {
|
|
800
805
|
LIGHTER_DEFAULT_SECURE_MIN_WITHDRAWAL_AMOUNTS,
|
|
801
806
|
LIGHTER_ROUTE_TYPE,
|
|
802
807
|
LIGHTER_WITHDRAW_ABI,
|
|
803
808
|
buildLighterL1WithdrawTransaction,
|
|
809
|
+
buildLighterSourceTokenOptions,
|
|
804
810
|
createLighterSecureWithdrawalConfig,
|
|
805
811
|
isLighterWithdrawalRateLimitError,
|
|
806
812
|
lighterWithdrawBaseUnits,
|
package/dist/clients/mallard.js
CHANGED
|
@@ -2,16 +2,18 @@
|
|
|
2
2
|
import {
|
|
3
3
|
getAccount,
|
|
4
4
|
sendTransaction,
|
|
5
|
+
signMessage,
|
|
6
|
+
signTypedData,
|
|
5
7
|
switchChain,
|
|
6
8
|
waitForTransactionReceipt
|
|
7
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-OODIKHYE.js";
|
|
8
10
|
import {
|
|
9
11
|
useAccount,
|
|
10
12
|
useConfig
|
|
11
13
|
} from "./chunk-UPZNKPYU.js";
|
|
12
14
|
import {
|
|
13
15
|
useFunkitTranslation
|
|
14
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-JD2J5K6S.js";
|
|
15
17
|
import {
|
|
16
18
|
logger
|
|
17
19
|
} from "./chunk-AHYOV7AV.js";
|
|
@@ -131,7 +133,26 @@ function createConnectedWalletWithdrawalClient(config, ownerAddress, sourceChain
|
|
|
131
133
|
hash: txHash,
|
|
132
134
|
chainId
|
|
133
135
|
})
|
|
134
|
-
)
|
|
136
|
+
),
|
|
137
|
+
// Gasless (EIP-3009/permit) relay routes return a typed-data signature
|
|
138
|
+
// step instead of a transaction — sign it with the connected wallet.
|
|
139
|
+
signTypedData: async (typedData) => {
|
|
140
|
+
const domainChainId = typedData.domain?.chainId;
|
|
141
|
+
if (domainChainId != null) {
|
|
142
|
+
await ensureOnChain(Number(domainChainId));
|
|
143
|
+
}
|
|
144
|
+
return signTypedData(config, {
|
|
145
|
+
account: ownerAddress,
|
|
146
|
+
domain: typedData.domain,
|
|
147
|
+
types: typedData.types,
|
|
148
|
+
primaryType: typedData.primaryType,
|
|
149
|
+
message: typedData.message
|
|
150
|
+
});
|
|
151
|
+
},
|
|
152
|
+
signMessage: (message) => signMessage(config, {
|
|
153
|
+
account: ownerAddress,
|
|
154
|
+
message: typeof message === "string" ? message : { raw: message.raw }
|
|
155
|
+
})
|
|
135
156
|
};
|
|
136
157
|
}
|
|
137
158
|
function useMallardWithdrawalConfig(config) {
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
PolymarketDepositAccountDropdown
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
4
|
+
} from "../chunk-C4SHJFOV.js";
|
|
5
|
+
import "../chunk-LT4EWLDA.js";
|
|
6
|
+
import "../chunk-5MY7WMEJ.js";
|
|
7
|
+
import "../chunk-FNB7OPJI.js";
|
|
8
|
+
import "../chunk-2FSEE3AW.js";
|
|
6
9
|
import "../chunk-LUHEVXPD.js";
|
|
7
10
|
import "../chunk-UPZNKPYU.js";
|
|
8
|
-
import "../chunk-
|
|
11
|
+
import "../chunk-JD2J5K6S.js";
|
|
9
12
|
import "../chunk-YFHTV7DT.js";
|
|
10
13
|
import "../chunk-6PIIYPQK.js";
|
|
11
14
|
import "../chunk-AHYOV7AV.js";
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
PolymarketDepositAccountDropdown
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
4
|
+
} from "../chunk-C4SHJFOV.js";
|
|
5
|
+
import "../chunk-LT4EWLDA.js";
|
|
6
|
+
import "../chunk-5MY7WMEJ.js";
|
|
7
|
+
import "../chunk-FNB7OPJI.js";
|
|
8
|
+
import "../chunk-2FSEE3AW.js";
|
|
6
9
|
import "../chunk-LUHEVXPD.js";
|
|
7
10
|
import "../chunk-UPZNKPYU.js";
|
|
8
|
-
import "../chunk-
|
|
11
|
+
import "../chunk-JD2J5K6S.js";
|
|
9
12
|
import {
|
|
10
13
|
POLYMARKET_PERPS_ROUTING_ID,
|
|
11
14
|
POLYMARKET_PREDICTIONS_ROUTING_ID,
|
|
@@ -1,13 +1,4 @@
|
|
|
1
|
-
import { type GetFopsResponse
|
|
2
|
-
/**
|
|
3
|
-
* Build the Swapped `thirdPartyPaymentConfigs` for a /fops request, shared by
|
|
4
|
-
* `useFops` and `useWithdrawFops`.
|
|
5
|
-
*
|
|
6
|
-
* `prefillFiatEmail` is normalized + validated here, but the backend is the
|
|
7
|
-
* authoritative validator: invalid emails are dropped (never block checkout)
|
|
8
|
-
* and the email value is never logged (PII).
|
|
9
|
-
*/
|
|
10
|
-
export declare function buildSwappedThirdPartyPaymentConfigs(prefillFiatEmail: string | undefined, themeConfig: Record<string, string>, logTag: 'useFops' | 'useWithdrawFops'): ThirdPartyPaymentConfigs;
|
|
1
|
+
import { type GetFopsResponse } from '@funkit/api-base';
|
|
11
2
|
export { FOPS_STALE_TIME, getFopsLimit, roundFopsLimit, sortFops, } from '@funkit/connect-core';
|
|
12
3
|
/**
|
|
13
4
|
* Validates FOPs by checking icon URL, embedded flow URL, and payment group.
|
|
@@ -19,6 +19,13 @@ interface UseTokenChainResult {
|
|
|
19
19
|
export interface UseTokenAndChainDropdownOptions {
|
|
20
20
|
transferInit?: CheckoutInitTokenTransferResponse;
|
|
21
21
|
defaultValues?: TransferTokenDefault;
|
|
22
|
+
/**
|
|
23
|
+
* Pre-selects this token/chain (initial + async resync), taking precedence over
|
|
24
|
+
* `defaultValues`, WITHOUT promoting it in the chain sort order or token priority
|
|
25
|
+
* list. Use to restore a prior in-flow choice (e.g. BTC when returning from the
|
|
26
|
+
* Lightning flow) that shouldn't reorder the menus.
|
|
27
|
+
*/
|
|
28
|
+
selectionOverride?: TransferTokenDefault;
|
|
22
29
|
/** When true, resolves the withdrawal Statsig config instead of the token-transfer one. Defaults to false. */
|
|
23
30
|
isWithdrawal?: boolean;
|
|
24
31
|
/** When true, starts with no chain/token pre-selected (user must pick both). Defaults to false. */
|
|
@@ -28,5 +35,5 @@ export interface UseTokenAndChainDropdownOptions {
|
|
|
28
35
|
* Semi reusable hook (tied into token transfer configuration)
|
|
29
36
|
* ensures token&chain dropdown preselection logic is reusable
|
|
30
37
|
*/
|
|
31
|
-
export declare const useTokenAndChainDropdown: ({ defaultValues, isWithdrawal, noDefaultSelection, transferInit, }: UseTokenAndChainDropdownOptions) => UseTokenChainResult;
|
|
38
|
+
export declare const useTokenAndChainDropdown: ({ defaultValues, selectionOverride, isWithdrawal, noDefaultSelection, transferInit, }: UseTokenAndChainDropdownOptions) => UseTokenChainResult;
|
|
32
39
|
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ export { createAuthenticationAdapter, FunkitConnectAuthenticationProvider, } fro
|
|
|
20
20
|
export type { AuthenticationAdapter, FunkitConnectAuthenticationProviderProps, } from './providers/AuthenticationContext';
|
|
21
21
|
export type { AvatarComponent } from './providers/AvatarContext';
|
|
22
22
|
export type { CheckoutBlockedReason } from './modals/CheckoutModal/CheckoutBlockedReason';
|
|
23
|
-
export type { FunkitCheckoutActionParams, FunkitCheckoutConfig, FunkitCheckoutOnCloseResult, FunkitWithdrawalConfig, WalletWithdrawalConfig, CustomWithdrawalConfig, MultiMethodWithdrawalConfig, WithdrawalMethodOption, WithdrawalParam, WithdrawalFormData, WithdrawalCustomerData, LighterWithdrawalCustomerData, LighterRouteType, NadoWithdrawalCustomerData, WithdrawalCustomerConfig, NadoWithdrawalCustomerConfig, UseFunkitCheckoutPropsWithFullConfig, UseFunkitCheckoutProps, FunkitCheckoutValidationResult, FunkitCheckoutResult, DynamicTargetAssetCandidate, AddToWalletToken, TokenInfo, ModalTitleContext, } from './providers/FunkitCheckoutContext';
|
|
23
|
+
export type { FunkitCheckoutActionParams, FunkitCheckoutConfig, FunkitCheckoutOnCloseResult, FunkitWithdrawalConfig, WalletWithdrawalConfig, CustomWithdrawalConfig, MultiMethodWithdrawalConfig, WithdrawalMethodOption, WithdrawalParam, WithdrawalFormData, WithdrawalSourceTokenBalanceParams, WithdrawalSourceCustomData, SourceTokenOption, WithdrawalCustomerData, LighterWithdrawalCustomerData, LighterRouteType, NadoWithdrawalCustomerData, WithdrawalCustomerConfig, NadoWithdrawalCustomerConfig, UseFunkitCheckoutPropsWithFullConfig, UseFunkitCheckoutProps, FunkitCheckoutValidationResult, FunkitCheckoutResult, DynamicTargetAssetCandidate, AddToWalletToken, TokenInfo, ModalTitleContext, } from './providers/FunkitCheckoutContext';
|
|
24
24
|
export { useFunkitCheckout, FunCheckoutStartingStep, } from './providers/FunkitCheckoutContext';
|
|
25
25
|
export type { FunkitCheckoutQuoteResult } from './domains/quote';
|
|
26
26
|
export type { FunkitConfig, FunkitUiCustomizationsConfig, FunkitTextCustomizationsConfig, } from './providers/FunkitConfigContext';
|