@funkit/connect 4.1.2 → 4.1.3

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 (28) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/config/getDefaultConfig.d.ts +33 -33
  3. package/dist/domains/wallet.d.ts +2 -1
  4. package/dist/hooks/usePaymentSources.d.ts +2 -2
  5. package/dist/index.js +78 -71
  6. package/dist/modals/CheckoutModal/useWalletAssetHoldings.d.ts +6 -2
  7. package/dist/providers/GeneralWalletProvider.d.ts +8 -8
  8. package/dist/wallets/walletConnectors/funkitConnectWallet/funkitConnectWallet.js +1 -1
  9. package/dist/wallets/walletConnectors/index.js +60 -60
  10. package/package.json +5 -4
  11. package/dist/wallets/walletConnectors/chunk-25VW5TZP.js +0 -92
  12. package/dist/wallets/walletConnectors/chunk-3NC26XLM.js +0 -92
  13. package/dist/wallets/walletConnectors/chunk-3U3BMEH5.js +0 -94
  14. package/dist/wallets/walletConnectors/chunk-4UM4GTKZ.js +0 -103
  15. package/dist/wallets/walletConnectors/chunk-545L7Y4M.js +0 -69
  16. package/dist/wallets/walletConnectors/chunk-6LPM6LUQ.js +0 -110
  17. package/dist/wallets/walletConnectors/chunk-7GSNBOD3.js +0 -99
  18. package/dist/wallets/walletConnectors/chunk-ETTNDQQG.js +0 -100
  19. package/dist/wallets/walletConnectors/chunk-FRGSRLTS.js +0 -93
  20. package/dist/wallets/walletConnectors/chunk-HKV7EMYZ.js +0 -96
  21. package/dist/wallets/walletConnectors/chunk-IPOC2VJX.js +0 -106
  22. package/dist/wallets/walletConnectors/chunk-JXP2QPW7.js +0 -95
  23. package/dist/wallets/walletConnectors/chunk-KFFJPS5R.js +0 -96
  24. package/dist/wallets/walletConnectors/chunk-LEXSM5KI.js +0 -87
  25. package/dist/wallets/walletConnectors/chunk-MOOBCMMB.js +0 -70
  26. package/dist/wallets/walletConnectors/chunk-N2NIIUW6.js +0 -146
  27. package/dist/wallets/walletConnectors/chunk-W5O4YSZN.js +0 -98
  28. package/dist/wallets/walletConnectors/chunk-XYBEMO3C.js +0 -66
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # @funkit/connect
2
2
 
3
+ ## 4.1.3
4
+
5
+ ### Patch Changes
6
+
7
+ - 61112d5: refactor: integrate @funkit/chains
8
+ - Updated dependencies [61112d5]
9
+ - @funkit/wagmi-tools@3.0.23
10
+ - @funkit/chains@0.1.1
11
+ - @funkit/core@2.3.2
12
+
3
13
  ## 4.1.2
4
14
 
5
15
  ### Patch Changes
@@ -19,6 +19,39 @@ export declare const createFunkitWagmiConfig: (rawWagmiConfig: CreateFunkitWagmi
19
19
  * Get default funkit-supported checkout chains
20
20
  */
21
21
  export declare const getDefaultChains: () => ({
22
+ id: number;
23
+ name: string;
24
+ nativeCurrency: {
25
+ symbol: string;
26
+ decimals: number;
27
+ name: string;
28
+ };
29
+ rpcUrls: {
30
+ default: {
31
+ http: string[];
32
+ };
33
+ };
34
+ blockExplorers: {
35
+ default: {
36
+ name: string;
37
+ url: string;
38
+ apiUrl: string;
39
+ };
40
+ };
41
+ contracts: {
42
+ ensRegistry: {
43
+ address: `0x${string}`;
44
+ };
45
+ ensUniversalResolver: {
46
+ address: `0x${string}`;
47
+ blockCreated: number;
48
+ };
49
+ multicall3: {
50
+ address: `0x${string}`;
51
+ blockCreated: number;
52
+ };
53
+ };
54
+ } | {
22
55
  blockExplorers: {
23
56
  readonly default: {
24
57
  readonly name: "Etherscan";
@@ -1041,39 +1074,6 @@ export declare const getDefaultChains: () => ({
1041
1074
  fees?: import("viem").ChainFees<undefined> | undefined;
1042
1075
  formatters?: undefined;
1043
1076
  serializers?: import("viem").ChainSerializers<undefined, import("viem").TransactionSerializable> | undefined;
1044
- } | {
1045
- id: number;
1046
- name: string;
1047
- nativeCurrency: {
1048
- symbol: string;
1049
- decimals: number;
1050
- name: string;
1051
- };
1052
- rpcUrls: {
1053
- default: {
1054
- http: string[];
1055
- };
1056
- };
1057
- blockExplorers: {
1058
- default: {
1059
- name: string;
1060
- url: string;
1061
- apiUrl: string;
1062
- };
1063
- };
1064
- contracts: {
1065
- ensRegistry: {
1066
- address: `0x${string}`;
1067
- };
1068
- ensUniversalResolver: {
1069
- address: `0x${string}`;
1070
- blockCreated: number;
1071
- };
1072
- multicall3: {
1073
- address: `0x${string}`;
1074
- blockCreated: number;
1075
- };
1076
- };
1077
1077
  } | {
1078
1078
  blockExplorers: {
1079
1079
  readonly default: {
@@ -14,5 +14,6 @@ export interface AssetHoldingsMap {
14
14
  [symbol: string]: AssetHoldingsItem;
15
15
  }
16
16
  /**
17
- * @returns formatted max usable USD balance from a given assets map */
17
+ * @returns formatted max usable USD balance from a given assets map
18
+ */
18
19
  export declare function getTotalAssetBalance(assets: AssetHoldingsMap): number;
@@ -1,6 +1,6 @@
1
1
  import { type ConnectablePaymentMethodInfo, PaymentMethod } from '~/domains/paymentMethods';
2
- export declare const usePaymentSources: (paymentMethodInfo: ConnectablePaymentMethodInfo | null) => {
2
+ export declare const usePaymentSources: (paymentMethodInfo: ConnectablePaymentMethodInfo | null, targetChainId: string) => {
3
3
  preferred: (import("~/domains/paymentMethods").PaymentMethodBrokerageInfo | import("~/domains/paymentMethods").PaymentMethodAccountInfo)[] | PaymentMethod[];
4
4
  moreSources: PaymentMethod[];
5
5
  };
6
- export declare const useRemainingPaymentSourcesCount: () => number;
6
+ export declare const useRemainingPaymentSourcesCount: (targetChainId: string) => number;
package/dist/index.js CHANGED
@@ -535,7 +535,7 @@ function formatAccountName(accountName, isEmail) {
535
535
 
536
536
  // src/consts/funkit.ts
537
537
  import { CheckoutState } from "@funkit/api-base";
538
- import { FUNKIT_CONNECT_CHECKOUT_NATIVE_CURRENCY_ADDRESS } from "@funkit/core";
538
+ import { FUNKIT_CONNECT_CHECKOUT_NATIVE_CURRENCY_ADDRESS } from "@funkit/chains";
539
539
  var NATIVE_TOKEN = FUNKIT_CONNECT_CHECKOUT_NATIVE_CURRENCY_ADDRESS;
540
540
  var FUNKIT_CONNECT_WALLET_ID = "funkitConnectWallet";
541
541
  var RESERVED_GROUP_NAME = "funkit-web2";
@@ -762,7 +762,7 @@ import { useConfig } from "wagmi";
762
762
  // src/providers/FunkitConfigContext.tsx
763
763
  import { createContext as createContext3, useContext as useContext3, useMemo as useMemo2 } from "react";
764
764
  var DEFAULT_TEXT_CUSTOMIZATIONS = {
765
- brokerageOrExchange: "Exchange",
765
+ brokerageOrExchange: "Connect Exchange",
766
766
  debitOrCredit: "Card",
767
767
  accountBalance: "Wallet",
768
768
  selectAccount: "Select an exchange",
@@ -815,7 +815,7 @@ function useFunkitConfig() {
815
815
  }
816
816
 
817
817
  // src/providers/provideFunkitConnectChains.ts
818
- import { DYDX_MAINNET_CHAIN_ID } from "@funkit/core";
818
+ import { DYDX_MAINNET_CHAIN_ID } from "@funkit/chains";
819
819
  import { isNotNullish } from "@funkit/utils";
820
820
  var arbitrumIcon = {
821
821
  iconBackground: "#96bedc",
@@ -3461,13 +3461,8 @@ function evalCondition(flagKey, condition, context) {
3461
3461
  }
3462
3462
 
3463
3463
  // src/providers/GeneralWalletProvider.tsx
3464
- import {
3465
- Auth,
3466
- Chain,
3467
- FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO2,
3468
- FunWallet,
3469
- configureEnvironment as configureEnvironment2
3470
- } from "@funkit/core";
3464
+ import { FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO2 } from "@funkit/chains";
3465
+ import { Auth, Chain, FunWallet, configureEnvironment as configureEnvironment2 } from "@funkit/core";
3471
3466
  import { formatAddress as formatAddress2 } from "@funkit/utils";
3472
3467
  import React46, {
3473
3468
  createContext as createContext8,
@@ -3589,7 +3584,7 @@ import {
3589
3584
  meshGetLinkToken,
3590
3585
  meshGetTransferIntegrations
3591
3586
  } from "@funkit/api-base";
3592
- import { FUNKIT_CONNECT_SUPPORTED_CHAINS_ID_LIST } from "@funkit/core";
3587
+ import { FUNKIT_CONNECT_SUPPORTED_CHAINS_ID_LIST } from "@funkit/chains";
3593
3588
  import { isNotNullish as isNotNullish2 } from "@funkit/utils";
3594
3589
 
3595
3590
  // src/utils/checkout.ts
@@ -3598,11 +3593,13 @@ import {
3598
3593
  getAssetPriceInfo
3599
3594
  } from "@funkit/api-base";
3600
3595
  import {
3601
- CHECKOUT_SPONSOR_SUPPORT_CHAINS,
3602
- CONTRACT_ADDRESSES,
3603
3596
  FUNKIT_CONNECT_CHECKOUT_NATIVE_CURRENCY_ADDRESS as FUNKIT_CONNECT_CHECKOUT_NATIVE_CURRENCY_ADDRESS2,
3604
3597
  FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO,
3605
- dydxChain,
3598
+ dydxChain
3599
+ } from "@funkit/chains";
3600
+ import {
3601
+ CHECKOUT_SPONSOR_SUPPORT_CHAINS,
3602
+ CONTRACT_ADDRESSES,
3606
3603
  getEnvOptions,
3607
3604
  getTokenAddressBySymbolAndChainId
3608
3605
  } from "@funkit/core";
@@ -5441,7 +5438,8 @@ import {
5441
5438
  getCheckoutByDepositAddress,
5442
5439
  getCheckoutsByUserId
5443
5440
  } from "@funkit/api-base";
5444
- import { FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO3, isAddress as isAddress2 } from "@funkit/core";
5441
+ import { FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO3 } from "@funkit/chains";
5442
+ import { isAddress as isAddress2 } from "@funkit/core";
5445
5443
  import { isNotNullish as isNotNullish3 } from "@funkit/utils";
5446
5444
  import React58, {
5447
5445
  createContext as createContext11,
@@ -5851,10 +5849,10 @@ import {
5851
5849
  deactivateCheckout as postApiDeactivateCheckout,
5852
5850
  initializeCheckout as postApiInitializeCheckout
5853
5851
  } from "@funkit/api-base";
5852
+ import { FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO4 } from "@funkit/chains";
5854
5853
  import {
5855
5854
  Chain as Chain2,
5856
5855
  ContractInterface,
5857
- FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO4,
5858
5856
  HashZero,
5859
5857
  WALLET_CONTRACT_INTERFACE,
5860
5858
  addOwnerTxParams
@@ -6422,17 +6420,14 @@ function isDefaultToken(asset, targetChainId, targetAsset) {
6422
6420
  var isPolygonEcosystemToken = (chainId, tokenAddress) => chainId === polygon.id.toString() && tokenAddress === "0x0000000000000000000000000000000000001010";
6423
6421
 
6424
6422
  // src/utils/assets.ts
6425
- import {
6426
- FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO6,
6427
- STABLECOIN_SYMBOLS,
6428
- dydxChain as dydxChain2
6429
- } from "@funkit/core";
6423
+ import { FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO6, dydxChain as dydxChain2 } from "@funkit/chains";
6424
+ import { STABLECOIN_SYMBOLS } from "@funkit/core";
6430
6425
  import { FlagKey as FlagKey4, isNotNullish as isNotNullish5, round } from "@funkit/utils";
6431
6426
  import { formatUnits } from "viem";
6432
6427
  import { base as base3, mainnet as mainnet5, mantle, zkSync } from "viem/chains";
6433
6428
 
6434
6429
  // src/utils/moonpay.ts
6435
- import { FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO5 } from "@funkit/core";
6430
+ import { FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO5 } from "@funkit/chains";
6436
6431
  var MINIMUM_MOONPAY_DEPOSIT_AMOUNT_USD = 35;
6437
6432
  var MAXIMUM_MOONPAY_DEPOSIT_AMOUNT_USD = 1e4;
6438
6433
  var generateMoonpayCurrencyCode = (tokenSymbol, chainId) => {
@@ -6656,7 +6651,7 @@ var useWalletAssets = ({
6656
6651
  };
6657
6652
 
6658
6653
  // src/modals/FunCheckoutHistoryModal/FunCheckoutHistoryTransaction.tsx
6659
- import { FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO7 } from "@funkit/core";
6654
+ import { FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO7 } from "@funkit/chains";
6660
6655
  import {
6661
6656
  formatAddress as formatAddress3,
6662
6657
  formatSecondsToReadableForm,
@@ -11785,7 +11780,7 @@ import {
11785
11780
  meshPreviewTransfer,
11786
11781
  meshPreviewTransferProxy
11787
11782
  } from "@funkit/api-base";
11788
- import { FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO8 } from "@funkit/core";
11783
+ import { FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO8 } from "@funkit/chains";
11789
11784
  import { roundUpToXDecimalPlaces as roundUpToXDecimalPlaces2 } from "@funkit/utils";
11790
11785
  import { estimateGas, getGasPrice } from "@wagmi/core";
11791
11786
  import { encodeFunctionData, erc20Abi as erc20Abi2, formatEther } from "viem";
@@ -15370,8 +15365,20 @@ import { useMemo as useMemo27 } from "react";
15370
15365
  import {
15371
15366
  FUNKIT_CONNECT_CHECKOUT_NATIVE_CURRENCY_ADDRESS as FUNKIT_CONNECT_CHECKOUT_NATIVE_CURRENCY_ADDRESS3,
15372
15367
  FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO9
15373
- } from "@funkit/core";
15368
+ } from "@funkit/chains";
15374
15369
  import { useMemo as useMemo26 } from "react";
15370
+ import { USABLE_BALANCE_THRESHOLD } from "@funkit/utils";
15371
+
15372
+ // src/domains/wallet.ts
15373
+ function getTotalAssetBalance(assets) {
15374
+ const maxUsdBalance = Object.values(assets).reduce(
15375
+ (acc, { usdAmount }) => (usdAmount ?? 0) + acc,
15376
+ 0
15377
+ );
15378
+ return maxUsdBalance;
15379
+ }
15380
+
15381
+ // src/modals/CheckoutModal/useWalletAssetHoldings.ts
15375
15382
  var processWalletAssets = (walletAssets, targetChain) => {
15376
15383
  if (!walletAssets) {
15377
15384
  return;
@@ -15416,12 +15423,19 @@ var processWalletAssets = (walletAssets, targetChain) => {
15416
15423
  };
15417
15424
  function useWalletAssetHoldings(targetChain) {
15418
15425
  const { walletAssets, isLoading } = useWalletAssets();
15419
- const processedAssets = useMemo26(() => {
15420
- return processWalletAssets(walletAssets, targetChain);
15421
- }, [targetChain, walletAssets]);
15426
+ const processedAssets = useMemo26(
15427
+ () => processWalletAssets(walletAssets, targetChain),
15428
+ [targetChain, walletAssets]
15429
+ );
15430
+ const totalBalance = useMemo26(
15431
+ () => processedAssets ? getTotalAssetBalance(processedAssets) : 0,
15432
+ [processedAssets]
15433
+ );
15422
15434
  return {
15423
15435
  data: processedAssets,
15424
- isLoading
15436
+ isLoading,
15437
+ totalBalance,
15438
+ hasUsableBalance: isLoading || totalBalance > USABLE_BALANCE_THRESHOLD
15425
15439
  };
15426
15440
  }
15427
15441
 
@@ -16400,15 +16414,6 @@ import { formatCurrencyAndStringify as formatCurrencyAndStringify11 } from "@fun
16400
16414
  import React173, { useEffect as useEffect38, useMemo as useMemo32, useState as useState49 } from "react";
16401
16415
  import { createPortal as createPortal8 } from "react-dom";
16402
16416
 
16403
- // src/domains/wallet.ts
16404
- function getTotalAssetBalance(assets) {
16405
- const maxUsdBalance = Object.values(assets).reduce(
16406
- (acc, { usdAmount }) => (usdAmount ?? 0) + acc,
16407
- 0
16408
- );
16409
- return maxUsdBalance;
16410
- }
16411
-
16412
16417
  // src/hooks/useAllowedAssets.ts
16413
16418
  import { getAllowedAssets } from "@funkit/api-base";
16414
16419
  import { useQuery as useQuery7 } from "@tanstack/react-query";
@@ -16474,38 +16479,40 @@ function useRemainingMeshExchangeConnections(selected) {
16474
16479
  )
16475
16480
  };
16476
16481
  }
16477
- var usePaymentSources = (paymentMethodInfo) => {
16482
+ var usePaymentSources = (paymentMethodInfo, targetChainId) => {
16478
16483
  const { activeConnections } = useRemainingMeshExchangeConnections(paymentMethodInfo);
16479
16484
  const { isUserLoggedIn, walletAddress } = useGeneralWallet();
16485
+ const { hasUsableBalance } = useWalletAssetHoldings(targetChainId);
16480
16486
  const { apiKey, uiCustomizations } = useFunkitConfig();
16487
+ const isTokenTransferEnabled = useFlag(FlagKey16.EnableTokenTransfer);
16481
16488
  const accountPaymentMethodInfo = createPaymentMethodInfo({
16482
16489
  paymentMethod: "balance" /* ACCOUNT_BALANCE */,
16483
16490
  walletAddress
16484
16491
  });
16485
- const connectedAccountInfo = paymentMethodInfo?.paymentMethod !== "balance" /* ACCOUNT_BALANCE */ && isUserLoggedIn ? accountPaymentMethodInfo : null;
16492
+ const connectedAccountInfo = paymentMethodInfo?.paymentMethod !== "balance" /* ACCOUNT_BALANCE */ && isUserLoggedIn && hasUsableBalance ? accountPaymentMethodInfo : null;
16486
16493
  const connected = [
16487
16494
  paymentMethodInfo,
16488
16495
  connectedAccountInfo,
16489
16496
  ...activeConnections
16490
16497
  ].filter(isNotNullish12);
16491
- const isTokenTransferEnabled = useFlag(FlagKey16.EnableTokenTransfer);
16492
16498
  const isCardEnabled = uiCustomizations?.paymentMethods?.isCardEnabled ?? true;
16493
- const fallback2 = connected.length === 0 ? isTokenTransferEnabled ? ["token_transfer" /* TOKEN_TRANSFER */] : isCardEnabled ? ["card" /* CARD */] : ["balance" /* ACCOUNT_BALANCE */] : [];
16499
+ const ignoreFallback = isUserLoggedIn && !hasUsableBalance;
16500
+ const fallback2 = connected.length === 0 && !ignoreFallback ? isTokenTransferEnabled ? ["token_transfer" /* TOKEN_TRANSFER */] : isCardEnabled ? ["card" /* CARD */] : ["balance" /* ACCOUNT_BALANCE */] : [];
16494
16501
  const isTokenInNewSources = !fallback2.includes("token_transfer" /* TOKEN_TRANSFER */) && isTokenTransferEnabled;
16495
16502
  const isWalletInNewSources = !isUserLoggedIn && !isDydxCustomer(apiKey);
16496
16503
  const newSources = [
16497
16504
  isTokenInNewSources && "token_transfer" /* TOKEN_TRANSFER */,
16498
- !fallback2.includes("card" /* CARD */) && isCardEnabled && "card" /* CARD */,
16499
16505
  "brokerage" /* BROKERAGE */,
16500
- isWalletInNewSources && "balance" /* ACCOUNT_BALANCE */
16506
+ isWalletInNewSources && "balance" /* ACCOUNT_BALANCE */,
16507
+ !fallback2.includes("card" /* CARD */) && isCardEnabled && "card" /* CARD */
16501
16508
  ].filter((b) => !!b);
16502
16509
  return {
16503
16510
  preferred: connected.length > 0 ? connected : fallback2,
16504
16511
  moreSources: newSources
16505
16512
  };
16506
16513
  };
16507
- var useRemainingPaymentSourcesCount = () => {
16508
- const { moreSources, preferred } = usePaymentSources(null);
16514
+ var useRemainingPaymentSourcesCount = (targetChainId) => {
16515
+ const { moreSources, preferred } = usePaymentSources(null, targetChainId);
16509
16516
  return Math.max(moreSources.length + preferred.length - 1, 0);
16510
16517
  };
16511
16518
 
@@ -16868,10 +16875,8 @@ function SelectWalletAsset({
16868
16875
  const label = usePaymentMethodInfoLabel(paymentMethodInfo, 16);
16869
16876
  const { textCustomizations } = useFunkitConfig();
16870
16877
  const { walletAddress } = useGeneralWallet();
16871
- const otherSourcesCount = useRemainingPaymentSourcesCount();
16872
- const { data, isLoading } = useWalletAssetHoldings(targetChainId);
16873
- const accountHoldings = data ?? {};
16874
- const totalBalance = getTotalAssetBalance(accountHoldings);
16878
+ const otherSourcesCount = useRemainingPaymentSourcesCount(targetChainId);
16879
+ const { data, isLoading, totalBalance } = useWalletAssetHoldings(targetChainId);
16875
16880
  return /* @__PURE__ */ React173.createElement(Box, { display: "flex", flexDirection: "column", gap: "12" }, /* @__PURE__ */ React173.createElement(
16876
16881
  SourcePaymentMethodItem,
16877
16882
  {
@@ -16885,7 +16890,7 @@ function SelectWalletAsset({
16885
16890
  MeshOrAccountSelectAsset,
16886
16891
  {
16887
16892
  paymentMethodInfo,
16888
- accountHoldings,
16893
+ accountHoldings: data ?? {},
16889
16894
  fetchHoldingsError: null,
16890
16895
  onFinish
16891
16896
  }
@@ -16899,7 +16904,7 @@ function SelectMeshAsset({
16899
16904
  onBrokerageDisconnected
16900
16905
  }) {
16901
16906
  const label = usePaymentMethodInfoLabel(paymentMethodInfo, 16);
16902
- const otherSourcesCount = useRemainingPaymentSourcesCount();
16907
+ const otherSourcesCount = useRemainingPaymentSourcesCount(targetChainId);
16903
16908
  const { data, isLoading, isError } = useMeshAccountHoldings(
16904
16909
  targetChainId,
16905
16910
  paymentMethodInfo.meta
@@ -17098,7 +17103,10 @@ import React177, { useEffect as useEffect40, useState as useState52 } from "reac
17098
17103
  import { POLYMARKET_API_KEY as POLYMARKET_API_KEY4 } from "@funkit/api-base";
17099
17104
 
17100
17105
  // src/components/FunPayments/FunPaymentMethods.tsx
17101
- import { formatCurrencyAndStringify as formatCurrencyAndStringify12 } from "@funkit/utils";
17106
+ import {
17107
+ USABLE_BALANCE_THRESHOLD as USABLE_BALANCE_THRESHOLD2,
17108
+ formatCurrencyAndStringify as formatCurrencyAndStringify12
17109
+ } from "@funkit/utils";
17102
17110
  import React176, { Fragment as Fragment4, useEffect as useEffect39 } from "react";
17103
17111
 
17104
17112
  // src/hooks/useEnabledTokenTransferChainTokens.ts
@@ -17125,7 +17133,7 @@ function useEnabledTokenTransferChainTokens() {
17125
17133
  import {
17126
17134
  FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO10,
17127
17135
  FUNKIT_CONNECT_SUPPORTED_CHECKOUT_CHAINS_INFO_LIST
17128
- } from "@funkit/core";
17136
+ } from "@funkit/chains";
17129
17137
  import { fallback } from "viem";
17130
17138
  import {
17131
17139
  http
@@ -17960,7 +17968,7 @@ var ConnectedMeshPaymentMethodItem = ({
17960
17968
  const sourceBalance = meshAssets ? getTotalAssetBalance(meshAssets) : 0;
17961
17969
  const label = usePaymentMethodInfoLabel(paymentMethodInfo);
17962
17970
  const disclaimerText = isPending ? "Fetching balance..." : balanceError ? "Couldn't fetch balance" : `${formatCurrencyAndStringify12(sourceBalance)} \u2022 3 mins`;
17963
- const isDisabled = !!balanceError || sourceBalance < 0.01;
17971
+ const isDisabled = !!balanceError || sourceBalance < USABLE_BALANCE_THRESHOLD2;
17964
17972
  useEffect39(() => {
17965
17973
  if (isPending || isLoading || isFetching) {
17966
17974
  return;
@@ -17997,9 +18005,9 @@ var AccountBalancePaymentMethodItem = ({
17997
18005
  }) => {
17998
18006
  const { walletAddress } = useGeneralWallet();
17999
18007
  const { textCustomizations } = useFunkitConfig();
18000
- const { data: walletAssets, isLoading: isLoadingAssets } = useWalletAssetHoldings(targetChainId);
18001
- const sourceBalance = walletAssets ? getTotalAssetBalance(walletAssets) : 0;
18008
+ const { isLoading: isLoadingAssets, totalBalance } = useWalletAssetHoldings(targetChainId);
18002
18009
  const usableWalletAssets = useUsableWalletAssetsForCheckout();
18010
+ const paymentIcon = usePaymentMethodIcon("balance" /* ACCOUNT_BALANCE */);
18003
18011
  const getDynamicValueIcon = () => {
18004
18012
  if (usableWalletAssets === void 0) return null;
18005
18013
  const uniqueChainIds = Array.from(
@@ -18007,12 +18015,9 @@ var AccountBalancePaymentMethodItem = ({
18007
18015
  );
18008
18016
  return /* @__PURE__ */ React176.createElement(SupportedChainList, { chainIdList: uniqueChainIds });
18009
18017
  };
18010
- const dynamicLimit = formatCurrencyAndStringify12(sourceBalance);
18018
+ const dynamicLimit = formatCurrencyAndStringify12(totalBalance);
18011
18019
  const disclaimerText = `${dynamicLimit ?? "No limit"} \u2022 Instant`;
18012
- const isClickable = sourceBalance !== void 0 && sourceBalance > 0.01;
18013
- const isDisabled = !isClickable || isLoadingAssets;
18014
18020
  const walletLabel = getWalletLabel(textCustomizations, walletAddress);
18015
- const paymentIcon = usePaymentMethodIcon("balance" /* ACCOUNT_BALANCE */);
18016
18021
  const keyIconSize = "20";
18017
18022
  return /* @__PURE__ */ React176.createElement(
18018
18023
  FunPaymentMethodItem,
@@ -18028,7 +18033,7 @@ var AccountBalancePaymentMethodItem = ({
18028
18033
  keyText: walletLabel,
18029
18034
  valueIcon: customValueIcon !== void 0 ? customValueIcon : getDynamicValueIcon(),
18030
18035
  onClick,
18031
- isDisabled,
18036
+ isDisabled: isLoadingAssets,
18032
18037
  disclaimerText: isLoadingAssets ? "Fetching balance..." : disclaimerText
18033
18038
  }
18034
18039
  );
@@ -18155,11 +18160,8 @@ function AddPaymentMethodItem({
18155
18160
  }
18156
18161
 
18157
18162
  // src/modals/CheckoutModal/SourceChange/useUpdateSourceAssetForCard.ts
18158
- import {
18159
- FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO11,
18160
- dydxChain as dydxChain3,
18161
- getTokenAddressBySymbolAndChainId as getTokenAddressBySymbolAndChainId2
18162
- } from "@funkit/core";
18163
+ import { FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO11, dydxChain as dydxChain3 } from "@funkit/chains";
18164
+ import { getTokenAddressBySymbolAndChainId as getTokenAddressBySymbolAndChainId2 } from "@funkit/core";
18163
18165
  import { useCallback as useCallback37, useState as useState51 } from "react";
18164
18166
  import { mainnet as mainnet7, mantle as mantle2, zkSync as zkSync3 } from "viem/chains";
18165
18167
  var pickSourceAssetForCard = async (checkoutItem, userIpInfo) => {
@@ -18383,7 +18385,10 @@ function SourceChange({
18383
18385
  });
18384
18386
  }
18385
18387
  };
18386
- const { preferred, moreSources } = usePaymentSources(paymentMethodInfo);
18388
+ const { preferred, moreSources } = usePaymentSources(
18389
+ paymentMethodInfo,
18390
+ targetChainId
18391
+ );
18387
18392
  function renderSource(source) {
18388
18393
  if (typeof source === "object") {
18389
18394
  return /* @__PURE__ */ React177.createElement(
@@ -18408,7 +18413,7 @@ function SourceChange({
18408
18413
  }
18409
18414
  );
18410
18415
  }
18411
- return /* @__PURE__ */ React177.createElement(Box, { display: "flex", flexDirection: "column", gap: "4" }, preferred.map(renderSource), /* @__PURE__ */ React177.createElement(FunDivider, { label: "more", marginTop: "8", marginBottom: "8" }), moreSources.map(renderSource));
18416
+ return /* @__PURE__ */ React177.createElement(Box, { display: "flex", flexDirection: "column", gap: "4" }, preferred.map(renderSource), preferred.length > 0 && /* @__PURE__ */ React177.createElement(FunDivider, { label: "more", marginTop: "8", marginBottom: "8" }), moreSources.map(renderSource));
18412
18417
  }
18413
18418
 
18414
18419
  // src/modals/CheckoutModal/TransferToken.tsx
@@ -18992,7 +18997,9 @@ function TransferToken({
18992
18997
  selectedChainId,
18993
18998
  selectedToken
18994
18999
  );
18995
- const otherSourcesCount = useRemainingPaymentSourcesCount();
19000
+ const otherSourcesCount = useRemainingPaymentSourcesCount(
19001
+ selectedChainId.toString()
19002
+ );
18996
19003
  const isLoadingDepositAddress = depositAddress === void 0;
18997
19004
  return /* @__PURE__ */ React186.createElement(Box, { id: "token-transfer-page" }, /* @__PURE__ */ React186.createElement(
18998
19005
  Box,
@@ -21299,7 +21306,7 @@ function setFunkitConnectVersion({ version }) {
21299
21306
  localStorage.setItem(storageKey5, version);
21300
21307
  }
21301
21308
  function getCurrentSdkVersion() {
21302
- return "4.1.2";
21309
+ return "4.1.3";
21303
21310
  }
21304
21311
  function useFingerprint() {
21305
21312
  const fingerprint = useCallback43(() => {
@@ -1,5 +1,9 @@
1
1
  import { type AssetHoldingsMap } from '../../utils/assets';
2
- export declare function useWalletAssetHoldings(targetChain: string): {
2
+ interface UseWalletAssetHoldingsResponse {
3
3
  data: AssetHoldingsMap | undefined;
4
4
  isLoading: boolean;
5
- };
5
+ totalBalance: number;
6
+ hasUsableBalance: boolean;
7
+ }
8
+ export declare function useWalletAssetHoldings(targetChain: string): UseWalletAssetHoldingsResponse;
9
+ export {};
@@ -96,15 +96,15 @@ export declare const useFunkitDisconnect: () => {
96
96
  error: null;
97
97
  data: undefined;
98
98
  status: "idle";
99
+ isPaused: boolean;
100
+ context: unknown;
99
101
  isError: false;
100
102
  isPending: false;
101
103
  isSuccess: false;
102
104
  failureCount: number;
103
105
  failureReason: import("@wagmi/core").DisconnectErrorType | null;
104
- isPaused: boolean;
105
106
  variables: undefined;
106
107
  isIdle: true;
107
- context: unknown;
108
108
  submittedAt: number;
109
109
  connectors: readonly import("wagmi").Connector[];
110
110
  } | {
@@ -114,15 +114,15 @@ export declare const useFunkitDisconnect: () => {
114
114
  error: null;
115
115
  data: undefined;
116
116
  status: "pending";
117
+ isPaused: boolean;
118
+ context: unknown;
117
119
  isError: false;
118
120
  isPending: true;
119
121
  isSuccess: false;
120
122
  failureCount: number;
121
123
  failureReason: import("@wagmi/core").DisconnectErrorType | null;
122
- isPaused: boolean;
123
124
  variables: import("wagmi/query").DisconnectVariables;
124
125
  isIdle: false;
125
- context: unknown;
126
126
  submittedAt: number;
127
127
  connectors: readonly import("wagmi").Connector[];
128
128
  } | {
@@ -132,15 +132,15 @@ export declare const useFunkitDisconnect: () => {
132
132
  error: import("@wagmi/core").DisconnectErrorType;
133
133
  data: undefined;
134
134
  status: "error";
135
+ isPaused: boolean;
136
+ context: unknown;
135
137
  isError: true;
136
138
  isPending: false;
137
139
  isSuccess: false;
138
140
  failureCount: number;
139
141
  failureReason: import("@wagmi/core").DisconnectErrorType | null;
140
- isPaused: boolean;
141
142
  variables: import("wagmi/query").DisconnectVariables;
142
143
  isIdle: false;
143
- context: unknown;
144
144
  submittedAt: number;
145
145
  connectors: readonly import("wagmi").Connector[];
146
146
  } | {
@@ -150,15 +150,15 @@ export declare const useFunkitDisconnect: () => {
150
150
  error: null;
151
151
  data: void;
152
152
  status: "success";
153
+ isPaused: boolean;
154
+ context: unknown;
153
155
  isError: false;
154
156
  isPending: false;
155
157
  isSuccess: true;
156
158
  failureCount: number;
157
159
  failureReason: import("@wagmi/core").DisconnectErrorType | null;
158
- isPaused: boolean;
159
160
  variables: import("wagmi/query").DisconnectVariables;
160
161
  isIdle: false;
161
- context: unknown;
162
162
  submittedAt: number;
163
163
  connectors: readonly import("wagmi").Connector[];
164
164
  };
@@ -6,7 +6,7 @@ import { createConnector } from "wagmi";
6
6
 
7
7
  // src/consts/funkit.ts
8
8
  import { CheckoutState } from "@funkit/api-base";
9
- import { FUNKIT_CONNECT_CHECKOUT_NATIVE_CURRENCY_ADDRESS } from "@funkit/core";
9
+ import { FUNKIT_CONNECT_CHECKOUT_NATIVE_CURRENCY_ADDRESS } from "@funkit/chains";
10
10
  var FUNKIT_CONNECT_WALLET_ID = "funkitConnectWallet";
11
11
  var FROM_PROGRESS_CHECKOUT_STATES = [
12
12
  CheckoutState.FROM_UNFUNDED,