@funkit/connect 10.3.0 → 10.4.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 (52) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/dist/clients/chunk-2YWQL3AO.js +46 -0
  3. package/dist/clients/chunk-APQYFP6X.js +207 -0
  4. package/dist/clients/chunk-BNMZM23Q.js +42 -0
  5. package/dist/clients/chunk-II5CZTBC.js +18 -0
  6. package/dist/clients/chunk-KNHO756P.js +28 -0
  7. package/dist/clients/chunk-L2KSNS7H.js +112 -0
  8. package/dist/clients/{chunk-3STGJU6Z.js → chunk-M6C7MBQN.js} +1 -1
  9. package/dist/clients/chunk-OZ3KD24N.js +107 -0
  10. package/dist/clients/{chunk-RWCJ4XGX.js → chunk-RCMAGKMG.js} +30 -1
  11. package/dist/clients/internal/nado/consts.d.ts +16 -0
  12. package/dist/clients/internal/nado/consts.js +13 -0
  13. package/dist/clients/internal/nado/encoding.d.ts +22 -0
  14. package/dist/clients/internal/nado/encoding.js +32 -0
  15. package/dist/clients/internal/nado/errors.d.ts +55 -0
  16. package/dist/clients/internal/nado/errors.js +15 -0
  17. package/dist/clients/internal/nado/fetch.d.ts +15 -0
  18. package/dist/clients/internal/nado/fetch.js +9 -0
  19. package/dist/clients/internal/nado/gateway.d.ts +83 -0
  20. package/dist/clients/internal/nado/gateway.js +23 -0
  21. package/dist/clients/internal/nado/hooks.d.ts +360 -0
  22. package/dist/clients/internal/nado/hooks.js +132 -0
  23. package/dist/clients/internal/nado/indexer.d.ts +43 -0
  24. package/dist/clients/internal/nado/indexer.js +13 -0
  25. package/dist/clients/internal/nado/products.d.ts +36 -0
  26. package/dist/clients/internal/nado/products.js +19 -0
  27. package/dist/clients/internal/nado/typedData.d.ts +80 -0
  28. package/dist/clients/internal/nado/typedData.js +43 -0
  29. package/dist/clients/lighter.js +117 -40
  30. package/dist/clients/mallard.js +8 -23
  31. package/dist/clients/polymarket/PolymarketDepositAccountDropdown.js +2 -2
  32. package/dist/clients/polymarket/index.js +2 -2
  33. package/dist/components/ChainIcon/ChainIcon.d.ts +16 -0
  34. package/dist/components/FreeUsdcBanner/FreeUsdcBanner.d.ts +1 -1
  35. package/dist/components/FunAssetAvatar/FunAssetAvatar.d.ts +1 -2
  36. package/dist/hooks/useChainMetadata.d.ts +11 -0
  37. package/dist/hooks/usePaymentMethodTabs.d.ts +8 -2
  38. package/dist/hooks/useSwappedIframeLifecycle.d.ts +5 -2
  39. package/dist/hooks/useSwappedPreload.d.ts +7 -11
  40. package/dist/hooks/useUserIpInfo.d.ts +1 -19
  41. package/dist/index.js +2710 -2638
  42. package/dist/modals/CheckoutModal/SourceChange/SourceChange.d.ts +3 -0
  43. package/dist/modals/CheckoutModal/SwappedIframe/SwappedIframe.d.ts +4 -1
  44. package/dist/modals/CheckoutModal/SwappedIframe/SwappedIframeController.d.ts +3 -0
  45. package/dist/modals/CheckoutModal/isWithdrawalStep.d.ts +3 -2
  46. package/dist/providers/FunkitCheckoutContext/types.d.ts +34 -13
  47. package/dist/providers/FunkitConfigContext.d.ts +4 -0
  48. package/dist/providers/SwappedProvider.d.ts +5 -3
  49. package/dist/utils/tokenIconUrl.d.ts +5 -0
  50. package/dist/wallets/walletConnectors/index.js +28 -28
  51. package/package.json +3 -2
  52. package/dist/hooks/useSkipSwappedPreload.d.ts +0 -7
@@ -0,0 +1,132 @@
1
+ "use client";
2
+ import {
3
+ NADO_SUPPORTED_PRODUCTS,
4
+ fetchNadoProducts
5
+ } from "../../chunk-APQYFP6X.js";
6
+ import {
7
+ getNadoFeeRates,
8
+ getNadoMaxWithdrawable,
9
+ getNadoSubaccountInfo
10
+ } from "../../chunk-OZ3KD24N.js";
11
+ import {
12
+ findSettlementForNonce,
13
+ getNadoWithdrawalEvents
14
+ } from "../../chunk-BNMZM23Q.js";
15
+ import "../../chunk-II5CZTBC.js";
16
+ import "../../chunk-L2KSNS7H.js";
17
+ import {
18
+ NadoGatewayError
19
+ } from "../../chunk-2YWQL3AO.js";
20
+ import "../../chunk-KNHO756P.js";
21
+ import {
22
+ useConfig
23
+ } from "../../chunk-UPZNKPYU.js";
24
+ import {
25
+ logger
26
+ } from "../../chunk-AHYOV7AV.js";
27
+
28
+ // src/clients/internal/nado/hooks.ts
29
+ import { skipToken, useQuery } from "@tanstack/react-query";
30
+ import { useEffect, useReducer } from "react";
31
+ var BALANCES_REFETCH_MS = 3e4;
32
+ var MAX_WITHDRAWABLE_REFETCH_MS = 3e4;
33
+ var FEE_RATES_STALE_MS = 5 * 6e4;
34
+ var SETTLEMENT_POLL_MS = 1e4;
35
+ var SETTLEMENT_TIMEOUT_MS = 10 * 6e4;
36
+ function shouldRetryNadoQuery(failureCount, error) {
37
+ if (error instanceof NadoGatewayError && (error.kind === "api" || error.kind === "timeout" || error.httpStatus === 429)) {
38
+ return false;
39
+ }
40
+ return failureCount < 2;
41
+ }
42
+ function useNadoProducts() {
43
+ const wagmiConfig = useConfig();
44
+ const query = useQuery({
45
+ queryKey: ["nadoProducts"],
46
+ queryFn: ({ signal }) => fetchNadoProducts(wagmiConfig, signal),
47
+ staleTime: Number.POSITIVE_INFINITY,
48
+ gcTime: Number.POSITIVE_INFINITY,
49
+ retry: shouldRetryNadoQuery
50
+ });
51
+ useEffect(() => {
52
+ if (query.isError) {
53
+ logger.warn("nado:products_fallback", {
54
+ message: "gateway_error",
55
+ errorMessage: query.error instanceof Error ? query.error.message : String(query.error)
56
+ });
57
+ }
58
+ }, [query.isError, query.error]);
59
+ return { ...query, data: query.data ?? NADO_SUPPORTED_PRODUCTS };
60
+ }
61
+ function useNadoSubaccountBalances(subaccount) {
62
+ return useQuery({
63
+ queryKey: ["nadoSubaccountInfo", subaccount],
64
+ queryFn: subaccount ? ({ signal }) => getNadoSubaccountInfo(subaccount, signal) : skipToken,
65
+ refetchInterval: BALANCES_REFETCH_MS,
66
+ retry: shouldRetryNadoQuery
67
+ });
68
+ }
69
+ function useNadoMaxWithdrawable(params) {
70
+ const { productId, sender, spotLeverage } = params;
71
+ return useQuery({
72
+ queryKey: ["nadoMaxWithdrawable", sender, productId, spotLeverage],
73
+ queryFn: productId !== void 0 && sender ? ({ signal }) => getNadoMaxWithdrawable({ productId, sender, spotLeverage }, signal) : skipToken,
74
+ refetchInterval: MAX_WITHDRAWABLE_REFETCH_MS,
75
+ retry: shouldRetryNadoQuery
76
+ });
77
+ }
78
+ function useNadoFeeRates(sender) {
79
+ return useQuery({
80
+ queryKey: ["nadoFeeRates", sender],
81
+ queryFn: sender ? ({ signal }) => getNadoFeeRates(sender, signal) : skipToken,
82
+ staleTime: FEE_RATES_STALE_MS,
83
+ retry: shouldRetryNadoQuery
84
+ });
85
+ }
86
+ function useNadoSettlementStatus(params) {
87
+ const { subaccount, nonce, submittedAtMs, enabled } = params;
88
+ const isPastTimeout = () => submittedAtMs !== void 0 && Date.now() - submittedAtMs >= SETTLEMENT_TIMEOUT_MS;
89
+ const query = useQuery({
90
+ queryKey: ["nadoSettlementStatus", subaccount, nonce?.toString()],
91
+ queryFn: subaccount && nonce !== void 0 ? async ({ signal }) => {
92
+ const { txs } = await getNadoWithdrawalEvents(
93
+ { subaccount, limit: 3 },
94
+ signal
95
+ );
96
+ const settlement = findSettlementForNonce(txs, nonce);
97
+ return {
98
+ isSequenced: settlement !== void 0,
99
+ sequencedAt: settlement ? Number(settlement.timestamp) : void 0
100
+ };
101
+ } : skipToken,
102
+ enabled: enabled && submittedAtMs !== void 0,
103
+ // Only the 10s interval drives fetches — a sequenced result is final, so
104
+ // focus/remount refetches would re-ask an answered question
105
+ staleTime: Number.POSITIVE_INFINITY,
106
+ // No retry — the next 10s poll is the retry
107
+ retry: false,
108
+ refetchInterval: (query2) => query2.state.data?.isSequenced || isPastTimeout() ? false : SETTLEMENT_POLL_MS
109
+ });
110
+ const [, rerenderAtTimeout] = useReducer((n) => n + 1, 0);
111
+ useEffect(() => {
112
+ if (submittedAtMs === void 0 || !enabled) {
113
+ return;
114
+ }
115
+ const remainingMs = submittedAtMs + SETTLEMENT_TIMEOUT_MS - Date.now();
116
+ if (remainingMs <= 0) {
117
+ return;
118
+ }
119
+ const id = setTimeout(rerenderAtTimeout, remainingMs);
120
+ return () => clearTimeout(id);
121
+ }, [submittedAtMs, enabled]);
122
+ const isTimedOut = isPastTimeout() && query.data?.isSequenced !== true;
123
+ return { ...query, isTimedOut };
124
+ }
125
+ export {
126
+ shouldRetryNadoQuery,
127
+ useNadoFeeRates,
128
+ useNadoMaxWithdrawable,
129
+ useNadoProducts,
130
+ useNadoSettlementStatus,
131
+ useNadoSubaccountBalances
132
+ };
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Nado archive/indexer queries — tracks a submitted withdrawal through
3
+ * sequencing so the UI can show settlement progress.
4
+ *
5
+ * @see {@link https://docs.nado.xyz/developer-resources/api/archive-indexer | Nado archive indexer API}
6
+ */
7
+ import type { Hex } from 'viem';
8
+ interface NadoWithdrawalTxPayload {
9
+ sender: Hex;
10
+ product_id: number;
11
+ /** Raw base units (native decimals). */
12
+ amount: string;
13
+ nonce: number | string;
14
+ }
15
+ export interface NadoIndexerTx {
16
+ tx: {
17
+ withdraw_collateral?: NadoWithdrawalTxPayload;
18
+ withdraw_collateral_v2?: NadoWithdrawalTxPayload;
19
+ };
20
+ submission_idx: string;
21
+ /** Unix seconds. */
22
+ timestamp: string;
23
+ }
24
+ export interface NadoWithdrawalEventsResponse {
25
+ /** Present in the response; settlement matching only reads `txs`. */
26
+ events: unknown[];
27
+ txs: NadoIndexerTx[];
28
+ }
29
+ /**
30
+ * Sequenced withdraw-collateral (v1 + v2) events for a subaccount, newest
31
+ * first. Unlike the gateway, a successful indexer response returns the
32
+ * payload bare — only failures carry the `{status, error}` wrapper.
33
+ */
34
+ export declare function getNadoWithdrawalEvents(params: {
35
+ subaccount: Hex;
36
+ limit?: number;
37
+ }, signal?: AbortSignal): Promise<NadoWithdrawalEventsResponse>;
38
+ /**
39
+ * Find the sequenced tx for a withdrawal we submitted, matched by the signed
40
+ * nonce. Presence means Nado's sequencer accepted it.
41
+ */
42
+ export declare function findSettlementForNonce(txs: NadoIndexerTx[], nonce: bigint): NadoIndexerTx | undefined;
43
+ export {};
@@ -0,0 +1,13 @@
1
+ "use client";
2
+ import {
3
+ findSettlementForNonce,
4
+ getNadoWithdrawalEvents
5
+ } from "../../chunk-BNMZM23Q.js";
6
+ import "../../chunk-II5CZTBC.js";
7
+ import "../../chunk-L2KSNS7H.js";
8
+ import "../../chunk-2YWQL3AO.js";
9
+ import "../../chunk-AHYOV7AV.js";
10
+ export {
11
+ findSettlementForNonce,
12
+ getNadoWithdrawalEvents
13
+ };
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Withdrawable Nado spot products: live `all_products` ⋈ `symbols` join with
3
+ * a verified static list as fallback.
4
+ *
5
+ * @see {@link https://docs.nado.xyz/developer-resources/api/gateway/queries/all-products | Nado all-products query}
6
+ * @see {@link https://docs.nado.xyz/developer-resources/api/gateway/queries/symbols | Nado symbols query}
7
+ */
8
+ import { type Address } from 'viem';
9
+ import type { Config } from '../../../wagmi/hooks';
10
+ export interface NadoProduct {
11
+ productId: number;
12
+ symbol: string;
13
+ tokenAddress: Address;
14
+ decimals: number;
15
+ isXstock: boolean;
16
+ isTradable: boolean;
17
+ /** Withdraw sequencer fee from the product config, x18 token units. */
18
+ withdrawFeeX18: string;
19
+ }
20
+ /**
21
+ * Xstocks stay out of the source picker until the backend confirms
22
+ * same-token pass-through routing at the UDA. Flip to enable.
23
+ */
24
+ export declare const NADO_XSTOCK_WITHDRAWALS_ENABLED = false;
25
+ /**
26
+ * The withdrawable-product allowlist (membership gates the picker) and the
27
+ * fallback when the gateway is down. Also the symbol source for USDT0,
28
+ * which is absent from the symbols query. Verified against prod 2026-07-16.
29
+ */
30
+ export declare const NADO_SUPPORTED_PRODUCTS: NadoProduct[];
31
+ export declare function isWithdrawableNadoProduct(product: NadoProduct): boolean;
32
+ /**
33
+ * Live product list: `all_products` ⋈ `symbols`, decimals from one multicall.
34
+ * Per-field static fallbacks keep a partial gateway response usable.
35
+ */
36
+ export declare function fetchNadoProducts(wagmiConfig: Config, signal?: AbortSignal): Promise<NadoProduct[]>;
@@ -0,0 +1,19 @@
1
+ "use client";
2
+ import {
3
+ NADO_SUPPORTED_PRODUCTS,
4
+ NADO_XSTOCK_WITHDRAWALS_ENABLED,
5
+ fetchNadoProducts,
6
+ isWithdrawableNadoProduct
7
+ } from "../../chunk-APQYFP6X.js";
8
+ import "../../chunk-OZ3KD24N.js";
9
+ import "../../chunk-II5CZTBC.js";
10
+ import "../../chunk-L2KSNS7H.js";
11
+ import "../../chunk-2YWQL3AO.js";
12
+ import "../../chunk-KNHO756P.js";
13
+ import "../../chunk-AHYOV7AV.js";
14
+ export {
15
+ NADO_SUPPORTED_PRODUCTS,
16
+ NADO_XSTOCK_WITHDRAWALS_ENABLED,
17
+ fetchNadoProducts,
18
+ isWithdrawableNadoProduct
19
+ };
@@ -0,0 +1,80 @@
1
+ /**
2
+ * EIP-712 typed data for Nado's `withdraw_collateral_v2` execute.
3
+ *
4
+ * @see {@link https://docs.nado.xyz/developer-resources/api/gateway/executes/withdraw-collateral | Nado withdraw collateral execute}
5
+ */
6
+ import type { Address, Hex } from 'viem';
7
+ export declare const WITHDRAW_COLLATERAL_V2_TYPES: {
8
+ readonly WithdrawCollateralV2: readonly [{
9
+ readonly name: "sender";
10
+ readonly type: "bytes32";
11
+ }, {
12
+ readonly name: "productId";
13
+ readonly type: "uint32";
14
+ }, {
15
+ readonly name: "amount";
16
+ readonly type: "uint128";
17
+ }, {
18
+ readonly name: "nonce";
19
+ readonly type: "uint64";
20
+ }, {
21
+ readonly name: "sendTo";
22
+ readonly type: "address";
23
+ }, {
24
+ readonly name: "appendix";
25
+ readonly type: "uint128";
26
+ }];
27
+ };
28
+ export interface WithdrawCollateralV2Params {
29
+ /** Packed subaccount id (see `buildNadoSubaccountId`). */
30
+ sender: Hex;
31
+ productId: number;
32
+ /** Raw base units in the token's native decimals — not x18. */
33
+ amount: bigint;
34
+ /** `tx_nonce` from the nonces query, fetched immediately before signing. */
35
+ nonce: bigint;
36
+ /** Payout recipient. Non-zero forces owner-wallet signing on Nado's side. */
37
+ sendTo: Address;
38
+ }
39
+ /**
40
+ * Typed data for Nado's `withdraw_collateral_v2` execute. `appendix` is
41
+ * reserved by Nado and must be 0.
42
+ */
43
+ export declare function buildWithdrawCollateralV2TypedData(params: WithdrawCollateralV2Params): {
44
+ readonly domain: {
45
+ readonly name: "Nado";
46
+ readonly version: "0.0.1";
47
+ readonly chainId: 57073;
48
+ readonly verifyingContract: `0x${string}`;
49
+ };
50
+ readonly types: {
51
+ readonly WithdrawCollateralV2: readonly [{
52
+ readonly name: "sender";
53
+ readonly type: "bytes32";
54
+ }, {
55
+ readonly name: "productId";
56
+ readonly type: "uint32";
57
+ }, {
58
+ readonly name: "amount";
59
+ readonly type: "uint128";
60
+ }, {
61
+ readonly name: "nonce";
62
+ readonly type: "uint64";
63
+ }, {
64
+ readonly name: "sendTo";
65
+ readonly type: "address";
66
+ }, {
67
+ readonly name: "appendix";
68
+ readonly type: "uint128";
69
+ }];
70
+ };
71
+ readonly primaryType: "WithdrawCollateralV2";
72
+ readonly message: {
73
+ readonly sender: `0x${string}`;
74
+ readonly productId: number;
75
+ readonly amount: bigint;
76
+ readonly nonce: bigint;
77
+ readonly sendTo: `0x${string}`;
78
+ readonly appendix: 0n;
79
+ };
80
+ };
@@ -0,0 +1,43 @@
1
+ "use client";
2
+ import {
3
+ INK_CHAIN_ID,
4
+ NADO_EIP712_VERIFYING_CONTRACT_ADDRESS
5
+ } from "../../chunk-II5CZTBC.js";
6
+
7
+ // src/clients/internal/nado/typedData.ts
8
+ var WITHDRAW_COLLATERAL_V2_TYPES = {
9
+ WithdrawCollateralV2: [
10
+ { name: "sender", type: "bytes32" },
11
+ { name: "productId", type: "uint32" },
12
+ { name: "amount", type: "uint128" },
13
+ { name: "nonce", type: "uint64" },
14
+ { name: "sendTo", type: "address" },
15
+ // Reserved by Nado — must be signed as 0
16
+ { name: "appendix", type: "uint128" }
17
+ ]
18
+ };
19
+ function buildWithdrawCollateralV2TypedData(params) {
20
+ return {
21
+ domain: {
22
+ name: "Nado",
23
+ version: "0.0.1",
24
+ chainId: INK_CHAIN_ID,
25
+ verifyingContract: NADO_EIP712_VERIFYING_CONTRACT_ADDRESS
26
+ },
27
+ types: WITHDRAW_COLLATERAL_V2_TYPES,
28
+ primaryType: "WithdrawCollateralV2",
29
+ message: {
30
+ sender: params.sender,
31
+ productId: params.productId,
32
+ amount: params.amount,
33
+ nonce: params.nonce,
34
+ sendTo: params.sendTo,
35
+ appendix: 0n
36
+ // set to 0, Nado reserved
37
+ }
38
+ };
39
+ }
40
+ export {
41
+ WITHDRAW_COLLATERAL_V2_TYPES,
42
+ buildWithdrawCollateralV2TypedData
43
+ };
@@ -3,8 +3,10 @@ import {
3
3
  AsyncImage
4
4
  } from "./chunk-2NBYHUIW.js";
5
5
  import {
6
- useFunkitConfig
7
- } from "./chunk-RWCJ4XGX.js";
6
+ chainMetadataById,
7
+ useFunkitConfig,
8
+ useFunkitConnectChainsById
9
+ } from "./chunk-RCMAGKMG.js";
8
10
  import {
9
11
  Box
10
12
  } from "./chunk-LUHEVXPD.js";
@@ -25,16 +27,106 @@ import {
25
27
  import { LIGHTER_CHAIN_ID, SOLANA_MAINNET_CHAIN_ID } from "@funkit/chains";
26
28
  import { RELAY_LIGHTER_CHAIN_ID as RELAY_LIGHTER_CHAIN_ID2 } from "@funkit/fun-relay";
27
29
  import { retry } from "@lifeomic/attempt";
28
- import { useQuery as useQuery2 } from "@tanstack/react-query";
30
+ import { useQuery as useQuery3 } from "@tanstack/react-query";
29
31
  import i18next from "i18next";
30
- import React3, { useMemo as useMemo2 } from "react";
32
+ import React4, { useMemo as useMemo2 } from "react";
31
33
  import { v4 as uuid } from "uuid";
32
34
  import { pad, parseUnits, toHex } from "viem";
33
35
  import { arbitrum, base, bsc, mainnet as mainnet3, optimism } from "viem/chains";
34
36
 
35
- // src/components/Icons/EvmWallet.tsx
37
+ // src/components/ChainIcon/ChainIcon.tsx
36
38
  import React from "react";
37
- var EvmWallet = ({ size = 20 }) => /* @__PURE__ */ React.createElement(
39
+
40
+ // src/consts/assets.ts
41
+ import {
42
+ ASSET_LOGO_SRCS,
43
+ FALLBACK_ASSET,
44
+ getAssetLogoSrc
45
+ } from "@funkit/fun-relay";
46
+
47
+ // src/hooks/useChainMetadata.ts
48
+ import { getChainIconUrl } from "@funkit/connect-core";
49
+ import { useCallback } from "react";
50
+
51
+ // src/hooks/useSupportedAssets.ts
52
+ import {
53
+ getSupportedAssets
54
+ } from "@funkit/api-base";
55
+ import { useQuery } from "@tanstack/react-query";
56
+ function useSupportedAssets(options) {
57
+ const { apiKey } = useFunkitConfig();
58
+ return useQuery({
59
+ queryKey: ["getSupportedAssets", apiKey],
60
+ queryFn: () => getSupportedAssets({ apiKey, logger }),
61
+ refetchOnMount: false,
62
+ refetchOnReconnect: false,
63
+ refetchOnWindowFocus: false,
64
+ staleTime: 5 * 60 * 1e3,
65
+ gcTime: Number.POSITIVE_INFINITY,
66
+ enabled: !!apiKey && (options?.enabled ?? true)
67
+ });
68
+ }
69
+
70
+ // src/hooks/useChainMetadata.ts
71
+ function useChainMetadata() {
72
+ const { data: supportedAssets } = useSupportedAssets();
73
+ const enabledChainsById = useFunkitConnectChainsById();
74
+ return useCallback(
75
+ (chainId) => {
76
+ if (!Number.isFinite(chainId)) {
77
+ return null;
78
+ }
79
+ const chainMetadata = chainMetadataById[chainId];
80
+ const enabledChain = enabledChainsById[chainId];
81
+ const supportedAssetsChainName = Object.values(
82
+ supportedAssets?.[chainId] ?? {}
83
+ )[0]?.chainName;
84
+ const chainName = chainMetadata?.name ?? supportedAssetsChainName ?? enabledChain?.name;
85
+ if (!chainName) {
86
+ return null;
87
+ }
88
+ return {
89
+ name: chainName,
90
+ iconUrl: chainMetadata?.iconUrl ?? enabledChain?.iconUrl ?? getChainIconUrl(chainName),
91
+ iconBackground: chainMetadata?.iconBackground ?? enabledChain?.iconBackground
92
+ };
93
+ },
94
+ [supportedAssets, enabledChainsById]
95
+ );
96
+ }
97
+
98
+ // src/components/ChainIcon/ChainIcon.tsx
99
+ function ChainIcon({
100
+ chainId,
101
+ size,
102
+ borderColor,
103
+ withIconBackground = false,
104
+ testId
105
+ }) {
106
+ const getChainMetadata = useChainMetadata();
107
+ const chainMetadata = getChainMetadata(chainId);
108
+ if (!chainMetadata) {
109
+ return null;
110
+ }
111
+ return /* @__PURE__ */ React.createElement(
112
+ AsyncImage,
113
+ {
114
+ alt: chainMetadata.name,
115
+ background: withIconBackground ? chainMetadata.iconBackground : void 0,
116
+ borderColor,
117
+ borderRadius: "full",
118
+ fallbackSrc: FALLBACK_ASSET,
119
+ height: size,
120
+ src: chainMetadata.iconUrl,
121
+ testId,
122
+ width: size
123
+ }
124
+ );
125
+ }
126
+
127
+ // src/components/Icons/EvmWallet.tsx
128
+ import React2 from "react";
129
+ var EvmWallet = ({ size = 20 }) => /* @__PURE__ */ React2.createElement(
38
130
  "svg",
39
131
  {
40
132
  width: size,
@@ -43,7 +135,7 @@ var EvmWallet = ({ size = 20 }) => /* @__PURE__ */ React.createElement(
43
135
  fill: "none",
44
136
  xmlns: "http://www.w3.org/2000/svg"
45
137
  },
46
- /* @__PURE__ */ React.createElement(
138
+ /* @__PURE__ */ React2.createElement(
47
139
  "path",
48
140
  {
49
141
  d: "M13.3333 6.66628V3.75016C13.3333 3.05704 13.3333 2.71048 13.1873 2.49751C13.0598 2.31143 12.8622 2.18503 12.6398 2.14718C12.3852 2.10386 12.0706 2.24909 11.4413 2.53955L4.04918 5.95127C3.48792 6.21031 3.20729 6.33984 3.00175 6.54071C2.82005 6.71829 2.68135 6.93507 2.59625 7.17447C2.5 7.44527 2.5 7.75435 2.5 8.3725V12.4996M13.75 12.0829H13.7583M2.5 9.33295L2.5 14.8329C2.5 15.7664 2.5 16.2331 2.68166 16.5896C2.84144 16.9032 3.09641 17.1582 3.41002 17.318C3.76654 17.4996 4.23325 17.4996 5.16667 17.4996H14.8333C15.7668 17.4996 16.2335 17.4996 16.59 17.318C16.9036 17.1582 17.1586 16.9032 17.3183 16.5896C17.5 16.2331 17.5 15.7664 17.5 14.8329V9.33295C17.5 8.39953 17.5 7.93282 17.3183 7.5763C17.1586 7.26269 16.9036 7.00773 16.59 6.84794C16.2335 6.66628 15.7668 6.66628 14.8333 6.66628L5.16667 6.66628C4.23325 6.66628 3.76654 6.66628 3.41002 6.84793C3.09641 7.00772 2.84144 7.26269 2.68166 7.57629C2.5 7.93281 2.5 8.39952 2.5 9.33295ZM14.1667 12.0829C14.1667 12.3131 13.9801 12.4996 13.75 12.4996C13.5199 12.4996 13.3333 12.3131 13.3333 12.0829C13.3333 11.8528 13.5199 11.6663 13.75 11.6663C13.9801 11.6663 14.1667 11.8528 14.1667 12.0829Z",
@@ -59,13 +151,13 @@ var EvmWallet = ({ size = 20 }) => /* @__PURE__ */ React.createElement(
59
151
  import { RELAY_LIGHTER_CHAIN_ID } from "@funkit/fun-relay";
60
152
  import { formatAddress, formatCryptoAndStringify } from "@funkit/utils";
61
153
  import * as dnum from "dnum";
62
- import React2, { useEffect, useMemo } from "react";
154
+ import React3, { useEffect, useMemo } from "react";
63
155
  import { createPortal } from "react-dom";
64
156
  import { mainnet as mainnet2 } from "viem/chains";
65
157
 
66
158
  // src/utils/customer.ts
67
- import { useQuery, useQueryClient } from "@tanstack/react-query";
68
- import { useCallback } from "react";
159
+ import { useQuery as useQuery2, useQueryClient } from "@tanstack/react-query";
160
+ import { useCallback as useCallback2 } from "react";
69
161
 
70
162
  // src/consts/customers.ts
71
163
  import {
@@ -113,7 +205,7 @@ function useLighterAccounts({
113
205
  const { apiKey } = useFunkitConfig();
114
206
  const isLighter = isLighterxyzCustomer(apiKey);
115
207
  const enabled = !!address && address !== "0x" && isLighter;
116
- const query = useQuery({
208
+ const query = useQuery2({
117
209
  queryKey: ["lighterAccounts", address],
118
210
  queryFn: () => getLighterAccountsByL1Address(address),
119
211
  enabled,
@@ -137,9 +229,6 @@ function useLighterAccounts({
137
229
  };
138
230
  }
139
231
 
140
- // src/providers/provideFunkitConnectChains.ts
141
- import { chainMetadataById } from "@funkit/chains";
142
-
143
232
  // src/utils/timeFormat.ts
144
233
  import { formatSecondsToReadableForm } from "@funkit/utils";
145
234
  function formatSecondsTranslated(seconds, t, specifyUnderMinute = false, omitSeconds = false) {
@@ -190,7 +279,7 @@ async function getLighterWithdrawalDelay() {
190
279
  }
191
280
  function useLighterSecureDelayText() {
192
281
  const { t } = useFunkitTranslation();
193
- const query = useQuery2({
282
+ const query = useQuery3({
194
283
  queryKey: ["lighterWithdrawalDelay"],
195
284
  queryFn: getLighterWithdrawalDelay,
196
285
  staleTime: 6e4,
@@ -547,27 +636,15 @@ function buildLighterFastWalletWithdrawalConfig({
547
636
  };
548
637
  }
549
638
  function ChainIconStack({ chainIds }) {
550
- return /* @__PURE__ */ React3.createElement(Box, { display: "flex", alignItems: "center", justifyContent: "flex-end" }, chainIds.map((chainId, index) => {
551
- const metadata = chainMetadataById[chainId];
552
- return /* @__PURE__ */ React3.createElement(
553
- Box,
554
- {
555
- key: chainId,
556
- position: "relative",
557
- style: { right: `${(chainIds.length - index - 1) * -2}px` }
558
- },
559
- /* @__PURE__ */ React3.createElement(
560
- AsyncImage,
561
- {
562
- alt: metadata?.name ?? "",
563
- borderRadius: "full",
564
- src: metadata?.iconUrl ?? "",
565
- height: 16,
566
- width: 16
567
- }
568
- )
569
- );
570
- }));
639
+ return /* @__PURE__ */ React4.createElement(Box, { display: "flex", alignItems: "center", justifyContent: "flex-end" }, chainIds.map((chainId, index) => /* @__PURE__ */ React4.createElement(
640
+ Box,
641
+ {
642
+ key: chainId,
643
+ position: "relative",
644
+ style: { right: `${(chainIds.length - index - 1) * -2}px` }
645
+ },
646
+ /* @__PURE__ */ React4.createElement(ChainIcon, { chainId, size: 16 })
647
+ )));
571
648
  }
572
649
  var LIGHTER_FAST_PREVIEW_CHAIN_IDS = [
573
650
  arbitrum.id,
@@ -613,8 +690,8 @@ function buildLighterMultiMethodConfig({
613
690
  subtitleText: t(
614
691
  isUnifiedTradingMode ? "withdrawal.fastDisclaimerUnified" : "withdrawal.fastDisclaimer"
615
692
  ),
616
- icon: /* @__PURE__ */ React3.createElement(EvmWallet, { size: 20 }),
617
- valueIcon: /* @__PURE__ */ React3.createElement(ChainIconStack, { chainIds: LIGHTER_FAST_PREVIEW_CHAIN_IDS }),
693
+ icon: /* @__PURE__ */ React4.createElement(EvmWallet, { size: 20 }),
694
+ valueIcon: /* @__PURE__ */ React4.createElement(ChainIconStack, { chainIds: LIGHTER_FAST_PREVIEW_CHAIN_IDS }),
618
695
  config: fastConfig
619
696
  };
620
697
  const secure = {
@@ -626,8 +703,8 @@ function buildLighterMultiMethodConfig({
626
703
  // so it doesn't bleed into live values, which are exact.
627
704
  delay: secureDelayText ?? t("withdrawal.secureFallbackDelay")
628
705
  }),
629
- icon: /* @__PURE__ */ React3.createElement(EvmWallet, { size: 20 }),
630
- valueIcon: /* @__PURE__ */ React3.createElement(ChainIconStack, { chainIds: LIGHTER_SECURE_PREVIEW_CHAIN_IDS }),
706
+ icon: /* @__PURE__ */ React4.createElement(EvmWallet, { size: 20 }),
707
+ valueIcon: /* @__PURE__ */ React4.createElement(ChainIconStack, { chainIds: LIGHTER_SECURE_PREVIEW_CHAIN_IDS }),
631
708
  config: secureConfig
632
709
  };
633
710
  return {
@@ -1,4 +1,10 @@
1
1
  "use client";
2
+ import {
3
+ getAccount,
4
+ sendTransaction,
5
+ switchChain,
6
+ waitForTransactionReceipt
7
+ } from "./chunk-KNHO756P.js";
2
8
  import {
3
9
  useAccount,
4
10
  useConfig
@@ -16,31 +22,10 @@ import { VAULT_DEPOSITOR_ABI } from "@funkit/fun-relay";
16
22
  import { useMemo } from "react";
17
23
  import {
18
24
  encodeFunctionData,
19
- erc20Abi as erc20Abi2,
25
+ erc20Abi,
20
26
  getAddress,
21
27
  maxUint256
22
28
  } from "viem";
23
-
24
- // src/wagmi/actions.ts
25
- import { erc20Abi, formatUnits } from "viem";
26
- import {
27
- getBalance as getBalanceCore,
28
- multicall as multicallCore
29
- } from "wagmi/actions";
30
- import {
31
- estimateGas,
32
- getAccount,
33
- getGasPrice,
34
- getTransaction,
35
- getWalletClient,
36
- multicall,
37
- readContract,
38
- sendTransaction,
39
- switchChain,
40
- waitForTransactionReceipt
41
- } from "wagmi/actions";
42
-
43
- // src/clients/mallard.tsx
44
29
  var MALLARD_DEPOSIT_ADDRESS = getAddress(
45
30
  "0xD42c46c7BaD6A54b38395F846b09981CE75fb8e2"
46
31
  );
@@ -95,7 +80,7 @@ function createMallardDepositActions(config) {
95
80
  // that's only needed for USDT-style tokens that require zeroing allowance first; USDG
96
81
  // is standard ERC-20.
97
82
  {
98
- contractAbi: erc20Abi2,
83
+ contractAbi: erc20Abi,
99
84
  contractAddress: token,
100
85
  functionName: "approve",
101
86
  functionArgs: [vaultDepositorAddress, maxUint256]
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
  import {
3
3
  PolymarketDepositAccountDropdown
4
- } from "../chunk-3STGJU6Z.js";
5
- import "../chunk-RWCJ4XGX.js";
4
+ } from "../chunk-M6C7MBQN.js";
5
+ import "../chunk-RCMAGKMG.js";
6
6
  import "../chunk-LUHEVXPD.js";
7
7
  import "../chunk-UPZNKPYU.js";
8
8
  import "../chunk-HOORQPSY.js";
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
  import {
3
3
  PolymarketDepositAccountDropdown
4
- } from "../chunk-3STGJU6Z.js";
5
- import "../chunk-RWCJ4XGX.js";
4
+ } from "../chunk-M6C7MBQN.js";
5
+ import "../chunk-RCMAGKMG.js";
6
6
  import "../chunk-LUHEVXPD.js";
7
7
  import "../chunk-UPZNKPYU.js";
8
8
  import "../chunk-HOORQPSY.js";