@funkit/connect 6.0.3 → 6.0.5

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 (27) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/domains/relay.d.ts +7 -13
  3. package/dist/hooks/queries/useWithdrawalQuote.d.ts +6 -0
  4. package/dist/index.js +213 -174
  5. package/dist/modals/CheckoutModal/ConfirmationStep/useCheckoutConfirmation.d.ts +2 -1
  6. package/dist/modals/CheckoutModal/InputAmount/state.d.ts +6 -1
  7. package/dist/utils/flags/config.d.ts +3 -26
  8. package/dist/wallets/walletConnectors/index.js +41 -41
  9. package/package.json +5 -5
  10. package/dist/wallets/walletConnectors/chunk-2GJQ4XZQ.js +0 -87
  11. package/dist/wallets/walletConnectors/chunk-3CICVJUN.js +0 -70
  12. package/dist/wallets/walletConnectors/chunk-5W7VDOCL.js +0 -99
  13. package/dist/wallets/walletConnectors/chunk-AFXHGWBH.js +0 -94
  14. package/dist/wallets/walletConnectors/chunk-CJGUM55H.js +0 -92
  15. package/dist/wallets/walletConnectors/chunk-CNPKISHN.js +0 -66
  16. package/dist/wallets/walletConnectors/chunk-EC6CHBSZ.js +0 -110
  17. package/dist/wallets/walletConnectors/chunk-J3LI3FYZ.js +0 -93
  18. package/dist/wallets/walletConnectors/chunk-JCHN6A47.js +0 -95
  19. package/dist/wallets/walletConnectors/chunk-KIDC67XJ.js +0 -96
  20. package/dist/wallets/walletConnectors/chunk-LNEC5RNX.js +0 -98
  21. package/dist/wallets/walletConnectors/chunk-Q3H3TRBS.js +0 -100
  22. package/dist/wallets/walletConnectors/chunk-QLVVUKYB.js +0 -92
  23. package/dist/wallets/walletConnectors/chunk-RKPCWHXL.js +0 -106
  24. package/dist/wallets/walletConnectors/chunk-UIASLGLV.js +0 -69
  25. package/dist/wallets/walletConnectors/chunk-UYGJO62F.js +0 -218
  26. package/dist/wallets/walletConnectors/chunk-VWCLFMWJ.js +0 -96
  27. package/dist/wallets/walletConnectors/chunk-ZSI5N4VV.js +0 -103
package/dist/index.js CHANGED
@@ -1139,7 +1139,7 @@ import React40, {
1139
1139
  useState as useState8
1140
1140
  } from "react";
1141
1141
  import { isHex } from "viem";
1142
- import { useQuery as useQuery6 } from "@tanstack/react-query";
1142
+ import { useQuery as useQuery5 } from "@tanstack/react-query";
1143
1143
 
1144
1144
  // src/hooks/useSymbolRefresh.ts
1145
1145
  import { useState as useState3 } from "react";
@@ -2331,6 +2331,7 @@ import {
2331
2331
  DYDX_API_KEY,
2332
2332
  ETHEREAL_API_KEY,
2333
2333
  HYPERBEAT_API_KEY,
2334
+ HYPERSWAP_API_KEY,
2334
2335
  KATANA_API_KEY,
2335
2336
  OSTIUM_API_KEY,
2336
2337
  POLYMARKET_API_KEY,
@@ -2756,55 +2757,33 @@ var flagConfig = {
2756
2757
  key: "apiKey",
2757
2758
  type: "isAnyOf",
2758
2759
  values: [
2760
+ POLYMARKET_API_KEY,
2761
+ OSTIUM_API_KEY,
2759
2762
  ETHEREAL_API_KEY,
2760
2763
  KATANA_API_KEY,
2761
2764
  HYPERBEAT_API_KEY,
2762
- SUSHI_API_KEY
2763
- ]
2764
- },
2765
- // Rollout to specific users across all customers
2766
- {
2767
- key: "userId",
2768
- type: "isAnyOf",
2769
- values: [
2770
- "0x6ec0c2f25d323e7779925Cc20c3740101f990d9F",
2771
- "0xbeFE12aA8cBa36DD79F50eE5E23828adB62f2FD6",
2772
- "0x2A8Bd916E85d98d8175258De99fc0ddbcC102eF6",
2773
- "0xda6b07Eb94f699F511a943e9bFC12B64B7fe3486",
2774
- "0x0D6e43CA32545B3dc2FE6f93AafBD7e640F548d4",
2775
- "0x9CB7F86F360459cC96C74a0F81aF2C4cC7a54bd2",
2776
- // Felix
2777
- "0x236c60C57a8B9ca563Fb0dA5199FDdCB686d91E8",
2778
- // Greg
2779
- "0x9C64fD7d9826E6d552dD8bc53e5C96F7C3F38528",
2780
- // Panda
2781
- "0x21b94a3E67c4a72d3D15f478A696c5175f036092"
2782
- // Jianhe
2765
+ HYPERSWAP_API_KEY,
2766
+ SUSHI_API_KEY,
2767
+ BANKR_API_KEY,
2768
+ DEGEN_API_KEY
2783
2769
  ]
2784
2770
  }
2785
- ]
2786
- },
2787
- // 20% rollout to Ostium and Polymarket users
2788
- {
2789
- value: true,
2790
- if_all: [
2791
- {
2792
- key: "userId",
2793
- type: "pctRollout",
2794
- pct: 100
2795
- },
2796
- {
2797
- key: "apiKey",
2798
- type: "isAnyOf",
2799
- values: [OSTIUM_API_KEY, POLYMARKET_API_KEY]
2800
- }
2801
- ],
2802
- if_any: [
2803
- {
2804
- key: "userId",
2805
- type: "isAnyOf",
2806
- values: ["0x6ec0c2f25d323e7779925Cc20c3740101f990d9F"]
2807
- }
2771
+ // Rollout to specific users across all customers
2772
+ // {
2773
+ // key: 'userId',
2774
+ // type: 'isAnyOf',
2775
+ // values: [
2776
+ // '0x6ec0c2f25d323e7779925Cc20c3740101f990d9F',
2777
+ // '0xbeFE12aA8cBa36DD79F50eE5E23828adB62f2FD6',
2778
+ // '0x2A8Bd916E85d98d8175258De99fc0ddbcC102eF6',
2779
+ // '0xda6b07Eb94f699F511a943e9bFC12B64B7fe3486',
2780
+ // '0x0D6e43CA32545B3dc2FE6f93AafBD7e640F548d4',
2781
+ // '0x9CB7F86F360459cC96C74a0F81aF2C4cC7a54bd2', // Felix
2782
+ // '0x236c60C57a8B9ca563Fb0dA5199FDdCB686d91E8', // Greg
2783
+ // '0x9C64fD7d9826E6d552dD8bc53e5C96F7C3F38528', // Panda
2784
+ // '0x21b94a3E67c4a72d3D15f478A696c5175f036092', // Jianhe
2785
+ // ],
2786
+ // },
2808
2787
  ]
2809
2788
  }
2810
2789
  ]
@@ -3941,8 +3920,8 @@ import { flushSync } from "react-dom";
3941
3920
  import { v4 as uuid } from "uuid";
3942
3921
 
3943
3922
  // src/hooks/useCheckoutDirectExecution.ts
3944
- import { DirectExecutionType } from "@funkit/api-base";
3945
- import { executeRelayQuote, getRelayQuote } from "@funkit/fun-relay";
3923
+ import { DirectExecutionType, getCheckoutQuoteV2 } from "@funkit/api-base";
3924
+ import { executeRelayQuote } from "@funkit/fun-relay";
3946
3925
  import { useCallback as useCallback5 } from "react";
3947
3926
  import { useWalletClient } from "wagmi";
3948
3927
 
@@ -3961,19 +3940,6 @@ var WEB3_ACCOUNT_BALANCE_MESSAGE = {
3961
3940
  [2 /* APPROVE_TRANSFER */]: (tokenSymbol) => `Confirm ${tokenSymbol} transfer`
3962
3941
  };
3963
3942
 
3964
- // src/hooks/queries/useClientId.ts
3965
- import { getOrganizationIdByApiKey } from "@funkit/api-base";
3966
- import { useQuery as useQuery3 } from "@tanstack/react-query";
3967
- var useClientId = () => {
3968
- const { apiKey } = useFunkitConfig();
3969
- const query = useQuery3({
3970
- queryKey: ["getOrganizationIdByApiKey", apiKey],
3971
- queryFn: () => getOrganizationIdByApiKey({ apiKey }),
3972
- enabled: !!apiKey
3973
- });
3974
- return query;
3975
- };
3976
-
3977
3943
  // src/hooks/useRelayBypass.ts
3978
3944
  import { FlagKey as FlagKey4, isTokenAddressEquivalent as isTokenAddressEquivalent2 } from "@funkit/utils";
3979
3945
  import { useCallback as useCallback4, useMemo as useMemo7 } from "react";
@@ -4087,7 +4053,7 @@ function useCheckoutDirectExecution() {
4087
4053
  const { connector } = useFunkitAccount();
4088
4054
  const { data: walletClient } = useWalletClient();
4089
4055
  const { getIsRelayEnabled } = useRelayBypass();
4090
- const { data: clientData } = useClientId();
4056
+ const { apiKey } = useFunkitConfig();
4091
4057
  const getRelayDirectExecutionBaseQuote = useCallback5(
4092
4058
  async (params) => {
4093
4059
  const {
@@ -4102,41 +4068,35 @@ function useCheckoutDirectExecution() {
4102
4068
  if (params.isExactIn) {
4103
4069
  const { fromTokenDecimals, fromTokenAmount } = params;
4104
4070
  const multiplier2 = 10 ** fromTokenDecimals;
4105
- return await getRelayQuote({
4071
+ return await getCheckoutQuoteV2({
4106
4072
  actionParams,
4107
- clientId: clientData?.id ?? "",
4073
+ apiKey,
4074
+ fromAmountBaseUnit: BigInt(Math.floor(fromTokenAmount * multiplier2)),
4108
4075
  fromChainId,
4109
4076
  fromTokenAddress,
4110
4077
  logger,
4111
4078
  recipientAddress,
4112
4079
  toChainId,
4113
4080
  toTokenAddress,
4114
- fromTokenAmountBaseUnit: BigInt(
4115
- Math.floor(fromTokenAmount * multiplier2)
4116
- ),
4117
- tradeType: "EXACT_INPUT",
4118
4081
  userAddress: senderAddress
4119
4082
  });
4120
4083
  }
4121
4084
  const { toTokenAmount, toTokenDecimals } = params;
4122
4085
  const multiplier = 10 ** toTokenDecimals;
4123
- return await getRelayQuote({
4086
+ return await getCheckoutQuoteV2({
4124
4087
  actionParams,
4125
- clientId: clientData?.id ?? "",
4088
+ apiKey,
4126
4089
  fromChainId,
4127
4090
  fromTokenAddress,
4128
4091
  logger,
4129
4092
  recipientAddress,
4093
+ toAmountBaseUnit: BigInt(Math.floor(toTokenAmount * multiplier)),
4130
4094
  toChainId,
4131
4095
  toTokenAddress,
4132
- toTokenAmountBaseUnit: BigInt(Math.floor(toTokenAmount * multiplier)),
4133
- // When no contract action is required: expected_output
4134
- // When a contract action is required: exact_output
4135
- tradeType: actionParams?.length ? "EXACT_OUTPUT" : "EXPECTED_OUTPUT",
4136
4096
  userAddress: senderAddress
4137
4097
  });
4138
4098
  },
4139
- [address, clientData]
4099
+ [address, apiKey]
4140
4100
  );
4141
4101
  const checkAndSwitchChains = useCallback5(
4142
4102
  async ({
@@ -4295,7 +4255,7 @@ import {
4295
4255
  initializeCheckoutTokenTransferAddress
4296
4256
  } from "@funkit/api-base";
4297
4257
  import { FlagKey as FlagKey5 } from "@funkit/utils";
4298
- import { useQuery as useQuery4 } from "@tanstack/react-query";
4258
+ import { useQuery as useQuery3 } from "@tanstack/react-query";
4299
4259
  import { useCallback as useCallback6 } from "react";
4300
4260
 
4301
4261
  // src/domains/clientMetadata.ts
@@ -4392,7 +4352,7 @@ var useCheckoutTransferInit = () => {
4392
4352
  const isQRCodeEnabledWithPostAction = !!checkoutConfig && // either no post action required
4393
4353
  (!isCheckoutPostActionRequired(checkoutConfig) || // or action type is set
4394
4354
  !!checkoutConfig?.qrcodeActionType);
4395
- const { data, isFetching } = useQuery4({
4355
+ const { data, isFetching } = useQuery3({
4396
4356
  queryKey: ["initializeCheckoutTokenTransferAddress", queryKey],
4397
4357
  queryFn: () => queryFunction(queryKey),
4398
4358
  refetchOnWindowFocus: false,
@@ -5360,14 +5320,14 @@ import {
5360
5320
  getDirectExecutionByTxHash
5361
5321
  } from "@funkit/api-base";
5362
5322
  import { RELAY_TERMINAL_STATUSES } from "@funkit/fun-relay";
5363
- import { useQuery as useQuery5 } from "@tanstack/react-query";
5323
+ import { useQuery as useQuery4 } from "@tanstack/react-query";
5364
5324
  var RELAY_FETCH_INTERVAL = 1500;
5365
5325
  var logPrefix = "useDirectExecutionInfoPolling";
5366
5326
  function useDirectExecutionInfoPolling({
5367
5327
  initDirectExecution
5368
5328
  }) {
5369
5329
  const { apiKey } = useFunkitConfig();
5370
- const { data: directExecution, isLoading } = useQuery5({
5330
+ const { data: directExecution, isLoading } = useQuery4({
5371
5331
  queryKey: [logPrefix, initDirectExecution?.txHash],
5372
5332
  queryFn: async () => {
5373
5333
  try {
@@ -5631,7 +5591,7 @@ function useCheckoutHistoryContext() {
5631
5591
  }
5632
5592
  function useCheckoutsListenerByUserId(userId) {
5633
5593
  const { apiKey } = useFunkitConfig();
5634
- const { data, isLoading } = useQuery6({
5594
+ const { data, isLoading } = useQuery5({
5635
5595
  enabled: !!userId,
5636
5596
  queryKey: ["getPurifiedCheckoutsByUserId", userId],
5637
5597
  queryFn: async () => {
@@ -5658,7 +5618,7 @@ function useCheckoutsListenerByUserId(userId) {
5658
5618
  }
5659
5619
  function useCheckoutListenerByCheckoutId(checkoutId) {
5660
5620
  const { apiKey } = useFunkitConfig();
5661
- const { data, isLoading } = useQuery6({
5621
+ const { data, isLoading } = useQuery5({
5662
5622
  enabled: !!checkoutId,
5663
5623
  queryKey: ["getPurifiedCheckoutById", checkoutId],
5664
5624
  queryFn: async () => {
@@ -8512,7 +8472,7 @@ Dialog.BottomSection = DialogBottom;
8512
8472
  Dialog.BottomBar = FunBottomBar;
8513
8473
 
8514
8474
  // src/modals/WithdrwalModal/WithdrawalContent.tsx
8515
- import { FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO9 } from "@funkit/chains";
8475
+ import { FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO8 } from "@funkit/chains";
8516
8476
  import {
8517
8477
  FlagKey as FlagKey14,
8518
8478
  formatCryptoAndStringify as formatCryptoAndStringify2,
@@ -10247,13 +10207,16 @@ import clsx14 from "clsx";
10247
10207
  import { motion as motion6, useAnimationControls } from "motion/react";
10248
10208
 
10249
10209
  // src/domains/relay.ts
10250
- import { FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO6 } from "@funkit/chains";
10251
10210
  var KATANA_BRIDGE_ALERT_THRESHOLD_PERCENT = 0.5;
10252
- function extractRelayFeeInfo(relayQuote) {
10211
+ function extractRelayFeeInfo({
10212
+ relayQuote = {},
10213
+ feeBreakdown
10214
+ } = {}) {
10215
+ if (feeBreakdown) {
10216
+ return feeBreakdown;
10217
+ }
10253
10218
  const { details, fees } = relayQuote;
10254
10219
  const gasUsd = Number.parseFloat(fees?.gas?.amountUsd || "0");
10255
- const destinationChainId = details?.currencyOut?.currency?.chainId || "";
10256
- const chainName = FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO6[destinationChainId]?.name;
10257
10220
  const appFeeUsd = Number.parseFloat(fees?.app?.amountUsd || "0");
10258
10221
  const fillCostUsd = Number.parseFloat(fees?.relayerGas?.amountUsd || "0");
10259
10222
  const relayCostUsd = Number.parseFloat(fees?.relayerService?.amountUsd || "0");
@@ -10273,7 +10236,6 @@ function extractRelayFeeInfo(relayQuote) {
10273
10236
  gasUsd,
10274
10237
  fillCostUsd,
10275
10238
  fillCostPercent,
10276
- chainName,
10277
10239
  totalImpactUsd,
10278
10240
  totalImpact,
10279
10241
  swapImpact,
@@ -10395,7 +10357,7 @@ function formatRelayFee({
10395
10357
  }
10396
10358
  return formatPercent(percent);
10397
10359
  }
10398
- function renderRelayFee(relayQuote, fees, totalUsd) {
10360
+ function renderRelayFee(relayQuoteMetadata, fees, totalUsd) {
10399
10361
  const {
10400
10362
  gasUsd,
10401
10363
  totalImpactUsd,
@@ -10406,7 +10368,7 @@ function renderRelayFee(relayQuote, fees, totalUsd) {
10406
10368
  maxSlippage,
10407
10369
  minReceived,
10408
10370
  fillCostUsd
10409
- } = extractRelayFeeInfo(relayQuote);
10371
+ } = extractRelayFeeInfo(relayQuoteMetadata);
10410
10372
  const totalNetworkCostUsd = fillCostUsd + gasUsd;
10411
10373
  const totalPriceImpact = swapImpactUsd + appFeeUsd;
10412
10374
  const totalPriceImpactPercent = swapImpact + appFeePercent;
@@ -10519,9 +10481,9 @@ function renderRelayFee(relayQuote, fees, totalUsd) {
10519
10481
  ]
10520
10482
  };
10521
10483
  }
10522
- var extractFeeItems = (fees, totalUsd, relayQuote) => {
10523
- if (relayQuote) {
10524
- return renderRelayFee(relayQuote, fees, totalUsd);
10484
+ var extractFeeItems = (fees, totalUsd, relayQuoteMetadata) => {
10485
+ if (relayQuoteMetadata) {
10486
+ return renderRelayFee(relayQuoteMetadata, fees, totalUsd);
10525
10487
  }
10526
10488
  const marketMakerFee = {
10527
10489
  label: "Market maker gas costs",
@@ -10608,8 +10570,8 @@ function PaymentFeesSummary({
10608
10570
  return NO_DATA;
10609
10571
  }
10610
10572
  const totalUsd = Number(quote?.finalTotalUsd ?? "0");
10611
- const relayQuote = quote?.baseQuote?.metadata?.relayQuote;
10612
- return extractFeeItems(fees, totalUsd, relayQuote);
10573
+ const relayQuoteMetadata = quote?.baseQuote?.metadata;
10574
+ return extractFeeItems(fees, totalUsd, relayQuoteMetadata);
10613
10575
  }, [quote, fallbackFees]);
10614
10576
  const isExpandable = expandedItems.length > 0 && !isLoading && !valuesNotAvailable;
10615
10577
  return /* @__PURE__ */ React90.createElement(Box, null, /* @__PURE__ */ React90.createElement(
@@ -10750,7 +10712,7 @@ var EvmWallet = ({ size = 20 }) => /* @__PURE__ */ React91.createElement(
10750
10712
  );
10751
10713
 
10752
10714
  // src/hooks/queries/useWithdrawalQuote.ts
10753
- import { useQuery as useQuery7 } from "@tanstack/react-query";
10715
+ import { useQuery as useQuery6 } from "@tanstack/react-query";
10754
10716
  import { useConfig as useConfig2 } from "wagmi";
10755
10717
 
10756
10718
  // src/domains/quote.ts
@@ -10761,18 +10723,18 @@ import {
10761
10723
  getAssetPriceInfo as getAssetPriceInfo2,
10762
10724
  getMoonpayBuyQuoteForCreditCard
10763
10725
  } from "@funkit/api-base";
10764
- import { FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO8 } from "@funkit/chains";
10726
+ import { FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO7 } from "@funkit/chains";
10765
10727
  import { estimateGas, getGasPrice } from "@wagmi/core";
10766
10728
  import { encodeFunctionData, erc20Abi as erc20Abi2, formatEther } from "viem";
10767
10729
  import { zkSync } from "viem/zksync";
10768
10730
 
10769
10731
  // src/utils/moonpay.ts
10770
- import { FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO7 } from "@funkit/chains";
10732
+ import { FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO6 } from "@funkit/chains";
10771
10733
  var MINIMUM_MOONPAY_DEPOSIT_AMOUNT_USD = 35;
10772
10734
  var MINIMUM_DEFI_MOONPAY_DEPOSIT_AMOUNT_USD = 25;
10773
10735
  var MAXIMUM_MOONPAY_DEPOSIT_AMOUNT_USD = 1e4;
10774
10736
  var generateMoonpayCurrencyCode = (tokenSymbol, chainId) => {
10775
- let moonpayChainName = FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO7[chainId]?.moonpayChainName;
10737
+ let moonpayChainName = FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO6[chainId]?.moonpayChainName;
10776
10738
  if (moonpayChainName == null) {
10777
10739
  throw new Error("MoonPay not supported on testnets");
10778
10740
  }
@@ -10838,7 +10800,7 @@ async function evaluateAccountWalletFees({
10838
10800
  apiKey,
10839
10801
  isWithdrawal
10840
10802
  }) {
10841
- const nativeCurrencySymbol = FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO8[selectedSourceAssetInfo.chainId]?.nativeCurrency.symbol || "";
10803
+ const nativeCurrencySymbol = FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO7[selectedSourceAssetInfo.chainId]?.nativeCurrency.symbol || "";
10842
10804
  const walletCheckoutFees = {
10843
10805
  paymentMethod: "balance" /* ACCOUNT_BALANCE */,
10844
10806
  ...getFunFeeBreakdown(baseQuote),
@@ -11170,12 +11132,13 @@ function useWithdrawalQuote({
11170
11132
  const wagmiConfig = useConfig2();
11171
11133
  const { getWithdrawalDirectExecution } = useCheckoutDirectExecution();
11172
11134
  const { checkoutItem } = useCheckoutContext();
11135
+ const isInstantQuoting = (symbol === "USDC" || symbol === "USDT") && chainId !== "1";
11173
11136
  const isValidAddress = isAddressCompatibleWithChain(
11174
11137
  recipientAddress,
11175
11138
  Number(chainId)
11176
11139
  );
11177
11140
  const enabled = !!apiKey && !!targetAsset && !!sourceAmount && !!recipientAddress && !!chainId && !!symbol && !!isValidAddress && !!checkoutItem;
11178
- const query = useQuery7({
11141
+ const query = useQuery6({
11179
11142
  queryKey: [
11180
11143
  "withdrawal",
11181
11144
  "quote",
@@ -11212,19 +11175,33 @@ function useWithdrawalQuote({
11212
11175
  retry: false,
11213
11176
  enabled,
11214
11177
  refetchInterval: enabled ? QUOTE_REFRESH_INTERVAL_MS : false,
11215
- refetchIntervalInBackground: true
11178
+ refetchIntervalInBackground: true,
11179
+ placeholderData: (previousData) => {
11180
+ if (!previousData || !isInstantQuoting) {
11181
+ return void 0;
11182
+ }
11183
+ const prevQuote = previousData.baseQuote.metadata?.relayQuote;
11184
+ if (!prevQuote) {
11185
+ return void 0;
11186
+ }
11187
+ const { chainId: prevChainId, symbol: prevSymbol } = prevQuote?.details?.currencyOut?.currency || {};
11188
+ if (prevChainId?.toString() === chainId && prevSymbol === symbol) {
11189
+ return previousData;
11190
+ }
11191
+ }
11216
11192
  });
11217
11193
  return {
11218
11194
  ...query,
11219
- quoteEnabled: enabled
11195
+ quoteEnabled: enabled,
11196
+ isInstantQuoting
11220
11197
  };
11221
11198
  }
11222
11199
 
11223
11200
  // src/hooks/queries/useWithdrawalRisk.ts
11224
- import { useQuery as useQuery8 } from "@tanstack/react-query";
11201
+ import { useQuery as useQuery7 } from "@tanstack/react-query";
11225
11202
  import { isAddress as isAddress3 } from "viem";
11226
11203
  var useWithdrawalRisk = (apiKey, receiveAddress) => {
11227
- const query = useQuery8({
11204
+ const query = useQuery7({
11228
11205
  queryKey: ["withdrawal", "addressRisk", apiKey, receiveAddress],
11229
11206
  queryFn: async () => {
11230
11207
  return await hasRisk(apiKey, receiveAddress);
@@ -11244,17 +11221,17 @@ import {
11244
11221
  convertFunToRelayTokenAddress,
11245
11222
  getRelayAssetPriceInfo
11246
11223
  } from "@funkit/fun-relay";
11247
- import { skipToken, useQuery as useQuery10 } from "@tanstack/react-query";
11224
+ import { skipToken, useQuery as useQuery9 } from "@tanstack/react-query";
11248
11225
 
11249
11226
  // src/hooks/queries/useErc20Asset.ts
11250
11227
  import { getAssetErc20ByChainAndSymbol } from "@funkit/api-base";
11251
- import { useQuery as useQuery9 } from "@tanstack/react-query";
11228
+ import { useQuery as useQuery8 } from "@tanstack/react-query";
11252
11229
  var useErc20Asset = ({
11253
11230
  chainId,
11254
11231
  symbol
11255
11232
  }) => {
11256
11233
  const { apiKey } = useFunkitConfig();
11257
- const query = useQuery9({
11234
+ const query = useQuery8({
11258
11235
  queryKey: ["erc20Asset", chainId, symbol],
11259
11236
  queryFn: async () => {
11260
11237
  if (!apiKey || !chainId || !symbol) {
@@ -11303,7 +11280,7 @@ function useAssetAddressPrice({
11303
11280
  refetchInterval = 1e4
11304
11281
  }) {
11305
11282
  const { apiKey } = useFunkitConfig();
11306
- const { data, error, isLoading } = useQuery10({
11283
+ const { data, error, isLoading } = useQuery9({
11307
11284
  queryKey: ["getAssetPriceInfo", chainId, assetTokenAddress],
11308
11285
  queryFn: chainId && assetTokenAddress ? async () => {
11309
11286
  const isRelayPrimary = RELAY_SHORT_CIRCUIT_CHAIN_IDS.includes(chainId);
@@ -11841,17 +11818,17 @@ var CHECKOUT_CONFIRMATION_UI_ERRORS = {
11841
11818
  QUOTE_EXPIRED: {
11842
11819
  durationMs: 5e3,
11843
11820
  message: "Quote expired. Please re-confirm the new checkout quote.",
11844
- type: "error",
11821
+ type: "hint",
11845
11822
  code: "QUOTE_EXPIRED" /* QUOTE_EXPIRED */
11846
11823
  },
11847
11824
  GENERIC_ERROR: {
11848
11825
  message: "An error occurred during checkout. Please try again.",
11849
- type: "error",
11826
+ type: "hint",
11850
11827
  code: "GENERIC_ERROR" /* GENERIC_ERROR */
11851
11828
  },
11852
11829
  RISK_ERROR: {
11853
11830
  message: `Sorry, ${FUN_ORG_NAME} Checkout is unable to proceed for security reasons.`,
11854
- type: "warning",
11831
+ type: "hint",
11855
11832
  code: "RISK_ERROR" /* RISK_ERROR */
11856
11833
  },
11857
11834
  SIGNATURE_DENIED: {
@@ -11862,17 +11839,28 @@ var CHECKOUT_CONFIRMATION_UI_ERRORS = {
11862
11839
  },
11863
11840
  SWITCH_CHAIN_ERROR: {
11864
11841
  message: "Unable to switch chains. Please ensure your wallet supports the chain.",
11865
- type: "warning",
11842
+ type: "hint",
11866
11843
  code: "SWITCH_CHAIN_ERROR" /* SWITCH_CHAIN_ERROR */
11844
+ },
11845
+ WALLET_CLIENT_UNDEFINED: {
11846
+ message: "Your wallet connection wasn\u2019t successful. Please try again.",
11847
+ type: "hint",
11848
+ code: "WALLET_CLIENT_UNDEFINED" /* WALLET_CLIENT_UNDEFINED */
11867
11849
  }
11868
11850
  };
11869
11851
  function isQuoteExpiredError(error) {
11870
11852
  return error.message.includes("Quote expired");
11871
11853
  }
11854
+ function isWalletClientUndefinedError(error) {
11855
+ return error.message.includes("wallet client is not defined");
11856
+ }
11872
11857
  function toCheckoutConfirmationError(error) {
11873
11858
  if (error instanceof Error && isQuoteExpiredError(error)) {
11874
11859
  return CHECKOUT_CONFIRMATION_UI_ERRORS.QUOTE_EXPIRED;
11875
11860
  }
11861
+ if (error instanceof Error && isWalletClientUndefinedError(error)) {
11862
+ return CHECKOUT_CONFIRMATION_UI_ERRORS.WALLET_CLIENT_UNDEFINED;
11863
+ }
11876
11864
  if (isUserRejectedError(error)) {
11877
11865
  return CHECKOUT_CONFIRMATION_UI_ERRORS.SIGNATURE_DENIED;
11878
11866
  }
@@ -11888,7 +11876,7 @@ function toCheckoutConfirmationError(error) {
11888
11876
  if (error instanceof ClientError2) {
11889
11877
  return {
11890
11878
  message: error.rawMessage,
11891
- type: "error",
11879
+ type: "hint",
11892
11880
  code: "GENERIC_ERROR" /* GENERIC_ERROR */
11893
11881
  };
11894
11882
  }
@@ -12074,8 +12062,9 @@ function useWithdrawalAssets(config) {
12074
12062
  }
12075
12063
  function getRelayOutputCurrencyAmount(quote, fallback2) {
12076
12064
  try {
12065
+ const relayQuote = quote.baseQuote;
12077
12066
  return Number.parseFloat(
12078
- quote?.baseQuote.metadata?.relayQuote.details.currencyOut.amountFormatted
12067
+ relayQuote.metadata?.relayQuote?.details?.currencyOut?.amountFormatted || "0"
12079
12068
  ) || fallback2 || 0;
12080
12069
  } catch (error) {
12081
12070
  logger.error("Error getting relay output currency amount:", error);
@@ -12092,9 +12081,11 @@ var WithdrawContent = ({
12092
12081
  onContinue,
12093
12082
  config,
12094
12083
  withdrawalItem
12084
+ // biome-ignore lint/complexity/noExcessiveCognitiveComplexity: <explanation>
12095
12085
  }) => {
12096
12086
  const sourceTokenBalance = withdrawalItem?.withdrawalSourceTokenBalance?.() || 0;
12097
12087
  const token = config.sourceTokenSymbol;
12088
+ const [confirmingQuote, setConfirmingQuote] = useState27(false);
12098
12089
  const [recipientAddress, setRecipientAddress] = useState27("");
12099
12090
  const [amount, setAmount] = useState27("");
12100
12091
  const [debouncedAmount] = useDebounce(amount, 500);
@@ -12142,7 +12133,9 @@ var WithdrawContent = ({
12142
12133
  isLoading: isQuoteLoading,
12143
12134
  data: quote,
12144
12135
  error: quoteErrorObject,
12145
- quoteEnabled
12136
+ quoteEnabled,
12137
+ isPlaceholderData,
12138
+ isInstantQuoting
12146
12139
  } = useWithdrawalQuote({
12147
12140
  withdrawalClient: config.wallet,
12148
12141
  recipientAddress,
@@ -12163,6 +12156,13 @@ var WithdrawContent = ({
12163
12156
  onContinue(withdrawal, txHash);
12164
12157
  }
12165
12158
  });
12159
+ useEffect27(() => {
12160
+ if (!isPlaceholderData && !isQuoteLoading && isInstantQuoting && confirmingQuote) {
12161
+ setTimeout(() => {
12162
+ setConfirmingQuote(false);
12163
+ }, 150);
12164
+ }
12165
+ }, [isPlaceholderData, confirmingQuote, isQuoteLoading, isInstantQuoting]);
12166
12166
  const showCheckAddressAlert = false;
12167
12167
  const wallets = usePreparedWalletConnectors();
12168
12168
  const { loginType } = useGeneralWallet();
@@ -12170,6 +12170,7 @@ var WithdrawContent = ({
12170
12170
  const connectedWalletIconUrl = wallets.find(
12171
12171
  (wallet) => wallet.id === connector?.id
12172
12172
  )?.iconUrl;
12173
+ const normalizedSelectedToken = selectedToken.toUpperCase();
12173
12174
  const isValidAddress = isAddressSupported(recipientAddress);
12174
12175
  const isValidAddressAndChain = isAddressCompatibleWithChain(
12175
12176
  recipientAddress,
@@ -12206,6 +12207,10 @@ var WithdrawContent = ({
12206
12207
  updateWithdrawalSourceAssetAmount(sourceTokenBalance);
12207
12208
  };
12208
12209
  const handleSubmit = () => {
12210
+ if (isPlaceholderData || isQuoteLoading && isInstantQuoting) {
12211
+ setConfirmingQuote(true);
12212
+ return;
12213
+ }
12209
12214
  if (!quote) {
12210
12215
  throw new Error("Quote is not available");
12211
12216
  }
@@ -12222,6 +12227,9 @@ var WithdrawContent = ({
12222
12227
  };
12223
12228
  const { data: addressAssessment, isLoading: isCheckingAddressRisk } = useWithdrawalRisk(apiKey, recipientAddress);
12224
12229
  const getWithdrawButtonText = () => {
12230
+ if (confirmingQuote) {
12231
+ return "Confirming quote";
12232
+ }
12225
12233
  if (isWithdrawing) {
12226
12234
  return "Processing";
12227
12235
  }
@@ -12237,7 +12245,7 @@ var WithdrawContent = ({
12237
12245
  return "Withdraw";
12238
12246
  };
12239
12247
  const getAlertMessage = () => {
12240
- const chainName = FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO9[selectedChainId]?.name;
12248
+ const chainName = FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO8[selectedChainId]?.name;
12241
12249
  if (chainName) {
12242
12250
  return `Please ensure the address supports receiving ${selectedToken} on ${chainName}.`;
12243
12251
  }
@@ -12246,15 +12254,14 @@ var WithdrawContent = ({
12246
12254
  const bottomSectionRef = useBottomSectionRef("withdrawal");
12247
12255
  const showAddressError = addressInputTouched && !isValidAddress && recipientAddress !== "";
12248
12256
  const showAmountError = amountInputTouched && amount !== "" && !isWithdrawAmountValid;
12249
- const canContinue = recipientAddress && amount && token && selectedChainId && !isQuoteLoading && !showAmountError && !showAddressError && !isCheckingAddressRisk && !addressAssessment && isValidAddressAndChain && amount === debouncedAmount;
12257
+ const canContinue = recipientAddress && amount && token && selectedChainId && (!isQuoteLoading || isInstantQuoting) && !showAmountError && !showAddressError && !isCheckingAddressRisk && !addressAssessment && isValidAddressAndChain && amount === debouncedAmount;
12250
12258
  const { totalImpactUsd, gasUsd } = extractRelayFeeInfo(
12251
- quote?.baseQuote?.metadata?.relayQuote || {}
12259
+ quote?.baseQuote?.metadata
12252
12260
  );
12253
- const receiveAmountCrypto = quote ? getRelayOutputCurrencyAmount(quote.finalEstimation, targetAssetAmount) : 0;
12254
- const receiveAmountFiat = quote ? Number(debouncedAmount || 0) : 0;
12261
+ const receiveAmountCrypto = quote ? getRelayOutputCurrencyAmount(quote.finalEstimation, targetAssetAmount) : isInstantQuoting ? Number(amount) : 0;
12262
+ const receiveAmountFiat = quote || isInstantQuoting ? Number(debouncedAmount || 0) : 0;
12255
12263
  const receiveAmountFiatTotal = receiveAmountFiat - totalImpactUsd - gasUsd;
12256
12264
  const withdrawButtonText = getWithdrawButtonText();
12257
- const normalizedSelectedToken = selectedToken.toUpperCase();
12258
12265
  return /* @__PURE__ */ React93.createElement(Box, { id: "withdrawal-flow", display: "flex", flexDirection: "column", gap: "18" }, /* @__PURE__ */ React93.createElement(Box, { display: "flex", flexDirection: "column", gap: "8" }, /* @__PURE__ */ React93.createElement(Box, { display: "flex", flexDirection: "column", gap: "4" }, /* @__PURE__ */ React93.createElement(Text, { size: "12", weight: "medium" }, "Recipient address"), /* @__PURE__ */ React93.createElement(
12259
12266
  FunInput,
12260
12267
  {
@@ -12368,7 +12375,7 @@ var WithdrawContent = ({
12368
12375
  alwaysOpenToTop: true,
12369
12376
  maxTokenDropdownHeight: 195
12370
12377
  }
12371
- ), /* @__PURE__ */ React93.createElement(Box, { display: "flex", justifyContent: "space-between", alignItems: "center" }, /* @__PURE__ */ React93.createElement(Text, { size: "12" }, "You will receive"), isQuoteLoading ? /* @__PURE__ */ React93.createElement(FunSkeletonBlock, { height: "14", width: "54" }) : /* @__PURE__ */ React93.createElement(
12378
+ ), /* @__PURE__ */ React93.createElement(Box, { display: "flex", justifyContent: "space-between", alignItems: "center" }, /* @__PURE__ */ React93.createElement(Text, { size: "12" }, "You will receive"), isQuoteLoading && !isInstantQuoting ? /* @__PURE__ */ React93.createElement(FunSkeletonBlock, { height: "14", width: "54" }) : /* @__PURE__ */ React93.createElement(
12372
12379
  Box,
12373
12380
  {
12374
12381
  display: "flex",
@@ -12381,7 +12388,7 @@ var WithdrawContent = ({
12381
12388
  PaymentFeesSummary,
12382
12389
  {
12383
12390
  fallbackFees: FALLBACK_FEES,
12384
- isLoading: isQuoteLoading,
12391
+ isLoading: isQuoteLoading && !isInstantQuoting,
12385
12392
  quote: quote?.finalEstimation,
12386
12393
  key: `${isQuoteLoading}`,
12387
12394
  valuesNotAvailable: !quoteEnabled
@@ -12400,14 +12407,14 @@ var WithdrawContent = ({
12400
12407
  FunNotification,
12401
12408
  {
12402
12409
  description: quoteErrorObject ? getRelayQuoteErrorDisplayMessage(quoteErrorObject.message) : withdrawalError?.message,
12403
- type: "hint",
12410
+ type: withdrawalError?.type,
12404
12411
  isVisible: !!withdrawalError || !!quoteErrorObject
12405
12412
  }
12406
12413
  ),
12407
12414
  actionButtonProps: {
12408
12415
  title: withdrawButtonText,
12409
12416
  isDisabled: !canContinue || isWithdrawing,
12410
- isLoading: isWithdrawing,
12417
+ isLoading: isWithdrawing || confirmingQuote,
12411
12418
  onClick: handleSubmit
12412
12419
  }
12413
12420
  }
@@ -12529,7 +12536,7 @@ function useSIWFarcasterListener(channelToken) {
12529
12536
  import {
12530
12537
  getAllWalletTokens
12531
12538
  } from "@funkit/api-base";
12532
- import { keepPreviousData, useQuery as useQuery11 } from "@tanstack/react-query";
12539
+ import { keepPreviousData, useQuery as useQuery10 } from "@tanstack/react-query";
12533
12540
  import { arbitrum as arbitrum2, polygon as polygon4 } from "viem/chains";
12534
12541
  import { useAccount as useAccount4 } from "wagmi";
12535
12542
  import { isTokenEquivalent as isTokenEquivalent2 } from "@funkit/utils";
@@ -12618,7 +12625,7 @@ var useWalletAssets = ({
12618
12625
  } = {}) => {
12619
12626
  const { address, isConnected } = useAccount4();
12620
12627
  const { apiKey } = useFunkitConfig();
12621
- const { data, isLoading, isFetching } = useQuery11({
12628
+ const { data, isLoading, isFetching } = useQuery10({
12622
12629
  queryKey: ["getWalletAssets", address, apiKey],
12623
12630
  queryFn: ({ queryKey: [_, addr, key] }) => fetchAssets(addr, key),
12624
12631
  placeholderData: keepPreviousData,
@@ -12696,7 +12703,7 @@ function FunTxSummaryLineItemKeyText({ text }) {
12696
12703
 
12697
12704
  // src/components/FunButton/FunRedirectButton.tsx
12698
12705
  import React97 from "react";
12699
- import { FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO10 } from "@funkit/chains";
12706
+ import { FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO9 } from "@funkit/chains";
12700
12707
 
12701
12708
  // src/components/Icons/RedirectIcon.tsx
12702
12709
  import React96 from "react";
@@ -12755,7 +12762,7 @@ var AddressRedirectButton = ({
12755
12762
  address,
12756
12763
  customRedirectUrl
12757
12764
  }) => {
12758
- const explorerInfo = FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO10[chainId]?.explorerInfo;
12765
+ const explorerInfo = FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO9[chainId]?.explorerInfo;
12759
12766
  return /* @__PURE__ */ React97.createElement(
12760
12767
  FunRedirectButton,
12761
12768
  {
@@ -12769,7 +12776,7 @@ var TransactionRedirectButton = ({
12769
12776
  txHash,
12770
12777
  customRedirectUrl
12771
12778
  }) => {
12772
- const explorerInfo = FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO10[chainId]?.explorerInfo;
12779
+ const explorerInfo = FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO9[chainId]?.explorerInfo;
12773
12780
  return /* @__PURE__ */ React97.createElement(
12774
12781
  FunRedirectButton,
12775
12782
  {
@@ -12806,7 +12813,7 @@ import {
12806
12813
  getBridgeCustomer,
12807
12814
  getFrogAccount
12808
12815
  } from "@funkit/api-base";
12809
- import { FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO11 } from "@funkit/chains";
12816
+ import { FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO10 } from "@funkit/chains";
12810
12817
  import { ResourceNotFoundError } from "@funkit/utils";
12811
12818
  async function fetchFrogAccounts(walletAddress, params) {
12812
12819
  const { logger: logger2 } = params;
@@ -12850,7 +12857,7 @@ async function fetchAllFiatAccounts(bridgeSubAccount, params) {
12850
12857
  }
12851
12858
  function getMatchingBankAccount(accounts, targetChain, targetAddress) {
12852
12859
  const { bankAccounts } = accounts;
12853
- const chainInfo = FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO11[targetChain];
12860
+ const chainInfo = FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO10[targetChain];
12854
12861
  if (!bankAccounts || !chainInfo) {
12855
12862
  return void 0;
12856
12863
  }
@@ -12895,9 +12902,9 @@ import {
12895
12902
  createBridgeBankAccount,
12896
12903
  getBridgeKycLink
12897
12904
  } from "@funkit/api-base";
12898
- import { FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO12 } from "@funkit/chains";
12905
+ import { FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO11 } from "@funkit/chains";
12899
12906
  import { FlagKey as FlagKey16 } from "@funkit/utils";
12900
- import { useQuery as useQuery12, useQueryClient } from "@tanstack/react-query";
12907
+ import { useQuery as useQuery11, useQueryClient } from "@tanstack/react-query";
12901
12908
  import { useCallback as useCallback18 } from "react";
12902
12909
  var sepaCountryCode = [
12903
12910
  // EU countries that are part of SEPA
@@ -12983,7 +12990,7 @@ function useFiatEnabled() {
12983
12990
  function useFrogAccounts() {
12984
12991
  const { apiKey } = useFunkitConfig();
12985
12992
  const { walletAddress } = useGeneralWallet();
12986
- const query = useQuery12({
12993
+ const query = useQuery11({
12987
12994
  queryKey: ["frogSubAccounts", walletAddress],
12988
12995
  queryFn: () => fetchFrogAccounts(walletAddress, { apiKey, logger }),
12989
12996
  enabled: !!walletAddress,
@@ -13019,7 +13026,7 @@ function useVirtualFiatAccounts() {
13019
13026
  const bridgeSubAccount = frogSubAccounts?.find(
13020
13027
  (subAccount) => subAccount.subAccountType === "bridge"
13021
13028
  );
13022
- const query = useQuery12({
13029
+ const query = useQuery11({
13023
13030
  queryKey: ["useVirtualFiatAccounts", bridgeSubAccount?.guid],
13024
13031
  queryFn: () => fetchAllFiatAccounts(bridgeSubAccount, { apiKey, logger }),
13025
13032
  enabled: !!bridgeSubAccount,
@@ -13046,7 +13053,7 @@ function useMatchingVirtualFiatAccount(accounts) {
13046
13053
  }
13047
13054
  function useLoadKycLink(linkLoad) {
13048
13055
  const { apiKey } = useFunkitConfig();
13049
- const query = useQuery12({
13056
+ const query = useQuery11({
13050
13057
  queryKey: ["kycLink", linkLoad.guid],
13051
13058
  queryFn: async () => {
13052
13059
  if (linkLoad.kycLink) {
@@ -13075,7 +13082,7 @@ function useCreateVirtualBankAccount() {
13075
13082
  const targetChainId = checkoutConfig?.targetChain;
13076
13083
  const { transferInit, recipientAddr } = useCheckoutTransferInit();
13077
13084
  const destinationAddress = transferInit?.depositAddr || recipientAddr;
13078
- const chainName = targetChainId && FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO12[targetChainId]?.name?.toLowerCase();
13085
+ const chainName = targetChainId && FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO11[targetChainId]?.name?.toLowerCase();
13079
13086
  const subAccountId = allFiatAccounts?.bridgeCustomer?.id;
13080
13087
  const { clearVirtualFiatAccounts } = useClearFrogAccountsCache();
13081
13088
  const handleCreateVirtualFiatAccount = useCallback18(async () => {
@@ -13126,7 +13133,7 @@ var useWalletLabel = () => {
13126
13133
  // src/modals/CheckoutModal/useWalletAssetHoldings.ts
13127
13134
  import {
13128
13135
  FUNKIT_CONNECT_CHECKOUT_NATIVE_CURRENCY_ADDRESS as FUNKIT_CONNECT_CHECKOUT_NATIVE_CURRENCY_ADDRESS3,
13129
- FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO13
13136
+ FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO12
13130
13137
  } from "@funkit/chains";
13131
13138
  import { useMemo as useMemo13 } from "react";
13132
13139
 
@@ -13146,14 +13153,14 @@ var processWalletAssets = (walletAssets, targetChain) => {
13146
13153
  if (!walletAssets) {
13147
13154
  return;
13148
13155
  }
13149
- const targetChainInfo = FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO13[targetChain];
13156
+ const targetChainInfo = FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO12[targetChain];
13150
13157
  const isCheckoutOnMainnet = targetChainInfo?.isMainnet;
13151
13158
  return Object.values(walletAssets).reduce(
13152
13159
  (result, asset) => {
13153
13160
  if (!asset.symbol || !asset.contractAddress) {
13154
13161
  return result;
13155
13162
  }
13156
- const assetChainInfo = FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO13[asset.chainId];
13163
+ const assetChainInfo = FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO12[asset.chainId];
13157
13164
  const isAssetOnMainnet = assetChainInfo?.isMainnet;
13158
13165
  if (isCheckoutOnMainnet && !isAssetOnMainnet) {
13159
13166
  return result;
@@ -13200,7 +13207,7 @@ function useWalletAssetHoldings(targetChain) {
13200
13207
 
13201
13208
  // src/config/getDefaultConfig.ts
13202
13209
  import {
13203
- FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO14,
13210
+ FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO13,
13204
13211
  FUNKIT_CONNECT_SUPPORTED_CHECKOUT_CHAINS_INFO_LIST
13205
13212
  } from "@funkit/chains";
13206
13213
  import { fallback } from "viem";
@@ -13897,7 +13904,7 @@ var createDefaultTransports = (chains) => {
13897
13904
  const transportsObject = {};
13898
13905
  for (const chain of chains) {
13899
13906
  const key = chain.id;
13900
- const fallbackRpcs = FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO14[key]?.fallbackRpcUrls;
13907
+ const fallbackRpcs = FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO13[key]?.fallbackRpcUrls;
13901
13908
  if (fallbackRpcs && fallbackRpcs.length > 0) {
13902
13909
  transportsObject[key] = fallback([
13903
13910
  http(),
@@ -18218,7 +18225,7 @@ function ConfirmationStep({
18218
18225
  if (!isInitialQuoting && moonpayAmountCheck?.isInvalid) {
18219
18226
  return {
18220
18227
  message: moonpayAmountCheck.message,
18221
- type: "error"
18228
+ type: "hint"
18222
18229
  };
18223
18230
  }
18224
18231
  return confirmationError ?? postCheckoutError ?? quoteError;
@@ -18287,11 +18294,11 @@ function ConfirmationStep({
18287
18294
  const uiCustomizations = funkitConfig.uiCustomizations?.confirmationScreen;
18288
18295
  const customRecipient = checkoutItem?.initSettings.config.customRecipient;
18289
18296
  const showKatanaBridgeAlert = useMemo19(() => {
18290
- const relayQuote = latestQuote?.baseQuote?.metadata?.relayQuote;
18291
- if (!relayQuote) {
18297
+ const relayQuoteMetadata = latestQuote?.baseQuote?.metadata;
18298
+ if (!relayQuoteMetadata) {
18292
18299
  return false;
18293
18300
  }
18294
- const { swapImpact, appFeePercent } = extractRelayFeeInfo(relayQuote);
18301
+ const { swapImpact, appFeePercent } = extractRelayFeeInfo(relayQuoteMetadata);
18295
18302
  return isKatanaCustomer(funkitConfig.apiKey) && // Don't take totalImpact, just sum swapImpact and appFeePercent
18296
18303
  // https://fun-xyz.slack.com/archives/C08PVUDA1M2/p1752179735981389?thread_ts=1752176009.628309&cid=C08PVUDA1M2
18297
18304
  swapImpact + appFeePercent > KATANA_BRIDGE_ALERT_THRESHOLD_PERCENT;
@@ -18508,7 +18515,7 @@ import React164, { useEffect as useEffect37 } from "react";
18508
18515
 
18509
18516
  // src/hooks/queries/useMeldCurrencies.ts
18510
18517
  import { getMeldSupportedFiat } from "@funkit/api-base";
18511
- import { useQuery as useQuery13 } from "@tanstack/react-query";
18518
+ import { useQuery as useQuery12 } from "@tanstack/react-query";
18512
18519
  var getPriority = (currencyCode) => {
18513
18520
  if (currencyCode === "USD") {
18514
18521
  return 0;
@@ -18520,7 +18527,7 @@ var getPriority = (currencyCode) => {
18520
18527
  };
18521
18528
  var useMeldCurrencies = (isEnabled = true) => {
18522
18529
  const { apiKey } = useFunkitConfig();
18523
- const query = useQuery13({
18530
+ const query = useQuery12({
18524
18531
  queryKey: ["meld", "currencies"],
18525
18532
  queryFn: async () => {
18526
18533
  if (!apiKey) {
@@ -18546,7 +18553,7 @@ var useMeldCurrencies = (isEnabled = true) => {
18546
18553
 
18547
18554
  // src/hooks/queries/useMeldDefaultCurrency.ts
18548
18555
  import { getMeldDefaultFiat } from "@funkit/api-base";
18549
- import { useQuery as useQuery14 } from "@tanstack/react-query";
18556
+ import { useQuery as useQuery13 } from "@tanstack/react-query";
18550
18557
 
18551
18558
  // src/hooks/queries/useMeldCryptoCurrencyCode.ts
18552
18559
  import { FlagKey as FlagKey20 } from "@funkit/utils";
@@ -18592,7 +18599,7 @@ var useMeldDefaultCurrency = (paymentMethod) => {
18592
18599
  const { apiKey } = useFunkitConfig();
18593
18600
  const { userIpInfo } = useFunkitUserIp();
18594
18601
  const enableMeld = useIsMeldEnabled();
18595
- const query = useQuery14({
18602
+ const query = useQuery13({
18596
18603
  queryKey: ["meld", "defaultCurrency", paymentMethod],
18597
18604
  queryFn: async () => {
18598
18605
  if (!apiKey) {
@@ -18617,13 +18624,13 @@ var useMeldDefaultCurrency = (paymentMethod) => {
18617
18624
  // src/hooks/queries/useMeldLimits.ts
18618
18625
  import { getMeldFiatLimits } from "@funkit/api-base";
18619
18626
  import { formatCurrencyAndStringify as formatCurrencyAndStringify6 } from "@funkit/utils";
18620
- import { useQuery as useQuery15 } from "@tanstack/react-query";
18627
+ import { useQuery as useQuery14 } from "@tanstack/react-query";
18621
18628
  var useMeldLimits = (isEnabled = true) => {
18622
18629
  const { apiKey } = useFunkitConfig();
18623
18630
  const { userIpInfo } = useFunkitUserIp();
18624
18631
  const cryptoCurrency = useMeldCryptoCurrencyCode();
18625
18632
  const countryCode = userIpInfo?.alpha2;
18626
- const query = useQuery15({
18633
+ const query = useQuery14({
18627
18634
  queryKey: ["meld", "limits", countryCode, cryptoCurrency],
18628
18635
  queryFn: async () => {
18629
18636
  if (!apiKey || !countryCode) {
@@ -19842,7 +19849,7 @@ var useMeldLink = (sourceAmount, sourceCurrencyCode = "USD") => {
19842
19849
 
19843
19850
  // src/modals/CheckoutModal/MeldQuotes/useMeldQuotes.tsx
19844
19851
  import { getMeldQuotes } from "@funkit/api-base";
19845
- import { useQuery as useQuery16 } from "@tanstack/react-query";
19852
+ import { useQuery as useQuery15 } from "@tanstack/react-query";
19846
19853
  import { useDebounce as useDebounce2 } from "use-debounce";
19847
19854
  var DEBOUNCE_DELAY = 500;
19848
19855
  var COUNTDOWN_INTERVAL_SEC = 60;
@@ -19854,7 +19861,7 @@ var useMeldQuotes = (sourceAmount, fiatCurrency) => {
19854
19861
  const { isAway } = useUserPresence();
19855
19862
  const destinationCurrencyCode = useMeldCryptoCurrencyCode();
19856
19863
  const sourceCurrencyCode = fiatCurrency || "USD";
19857
- const query = useQuery16({
19864
+ const query = useQuery15({
19858
19865
  queryKey: [
19859
19866
  "meld",
19860
19867
  "quotes",
@@ -20170,20 +20177,37 @@ function getInputValueFromAmount(params) {
20170
20177
  );
20171
20178
  return params.isInputInFiat ? params.currencySymbol + formattedAmount : formattedAmount;
20172
20179
  }
20180
+ function calcInitialFiatAmount(balance) {
20181
+ const halfBalance = balance / 2;
20182
+ let roundingFactor;
20183
+ if (balance >= 1e5) {
20184
+ roundingFactor = 1e4;
20185
+ } else if (balance >= 1e4) {
20186
+ roundingFactor = 1e3;
20187
+ } else if (balance >= 100) {
20188
+ roundingFactor = 100;
20189
+ } else if (balance >= 10) {
20190
+ roundingFactor = 10;
20191
+ } else {
20192
+ roundingFactor = 1;
20193
+ }
20194
+ const ceilResult = Math.ceil(halfBalance / roundingFactor);
20195
+ return ceilResult * roundingFactor;
20196
+ }
20173
20197
  function initializeState({
20174
20198
  checkoutConfig,
20175
20199
  maxUsd,
20176
20200
  minUsd,
20177
20201
  paymentMethod,
20178
20202
  sourceHolding,
20179
- unitPrice,
20203
+ unitPrice: realUnitPrice,
20180
20204
  defaultAmount,
20181
20205
  fiatCurrency = "USD",
20182
20206
  quickOptions
20183
20207
  }) {
20184
- const { targetAssetAmount, targetChain } = checkoutConfig;
20185
- const isCardCheckout = paymentMethod === "card" /* CARD */;
20208
+ const { targetAssetAmount, targetChain, targetAssetTicker } = checkoutConfig;
20186
20209
  const isInputInFiat = true;
20210
+ const unitPrice = isStablecoin(targetAssetTicker) ? 1 : realUnitPrice;
20187
20211
  const usdAvailableAmount = getUsdAvailableAmount(
20188
20212
  targetChain,
20189
20213
  sourceHolding?.pickedChainId,
@@ -20192,7 +20216,7 @@ function initializeState({
20192
20216
  );
20193
20217
  const usdMaxAmount = getUsdMaxAmount(maxUsd);
20194
20218
  const usdMinAmount = getUsdMinAmount(paymentMethod, minUsd);
20195
- const initialFiatAmount = defaultAmount ?? (isCardCheckout ? getDefaultAmountFromQuickOptions(quickOptions) : targetAssetAmount === void 0 ? USD_INITIAL_AMOUNT : targetAssetAmount * unitPrice);
20219
+ const initialFiatAmount = getInitialFiatAmount();
20196
20220
  const finalFiatAmount = initialFiatAmount === void 0 ? void 0 : Math.min(
20197
20221
  Math.max(initialFiatAmount, usdMinAmount, 0),
20198
20222
  usdAvailableAmount ?? Number.MAX_VALUE,
@@ -20207,6 +20231,21 @@ function initializeState({
20207
20231
  isInputInFiat,
20208
20232
  fiatAmount
20209
20233
  });
20234
+ function getInitialFiatAmount() {
20235
+ if (defaultAmount !== void 0) {
20236
+ return defaultAmount;
20237
+ }
20238
+ if (paymentMethod === "balance" /* ACCOUNT_BALANCE */) {
20239
+ return calcInitialFiatAmount(usdAvailableAmount ?? 0);
20240
+ }
20241
+ if (paymentMethod === "card" /* CARD */) {
20242
+ return getDefaultAmountFromQuickOptions(quickOptions);
20243
+ }
20244
+ if (targetAssetAmount !== void 0) {
20245
+ return targetAssetAmount * unitPrice;
20246
+ }
20247
+ return USD_INITIAL_AMOUNT;
20248
+ }
20210
20249
  return {
20211
20250
  assetAmount,
20212
20251
  fiatAmount,
@@ -20509,7 +20548,7 @@ function InputAmountLoaded({
20509
20548
  if (usdAvailableAmount === 0) {
20510
20549
  return {
20511
20550
  message: "Insufficient balance, please select another asset instead.",
20512
- type: "error"
20551
+ type: "hint"
20513
20552
  };
20514
20553
  }
20515
20554
  return getInputErrorNotification(inputError);
@@ -20965,7 +21004,7 @@ function InputAmount(props) {
20965
21004
  import React167, { useEffect as useEffect38 } from "react";
20966
21005
 
20967
21006
  // src/domains/wallet.ts
20968
- import { FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO15, dydxChain as dydxChain2 } from "@funkit/chains";
21007
+ import { FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO14, dydxChain as dydxChain2 } from "@funkit/chains";
20969
21008
  import { isNotNullish as isNotNullish7 } from "@funkit/utils";
20970
21009
  import { mainnet as mainnet6, polygon as polygon6 } from "viem/chains";
20971
21010
  var ASSETS_LOW_VALUE_THRESHOLD2 = 0.1;
@@ -21649,7 +21688,7 @@ function MoonpaySetup({
21649
21688
  return /* @__PURE__ */ React171.createElement(Box, { className: stretchStyle, flexDirection: "column" }, isSupportedRegion ? MoonpayWidget : /* @__PURE__ */ React171.createElement(Box, { paddingY: "10" }, /* @__PURE__ */ React171.createElement(
21650
21689
  FunNotification,
21651
21690
  {
21652
- type: "error",
21691
+ type: "hint",
21653
21692
  description: "You are using moonpay from an unsupported region. Please use a different payment method."
21654
21693
  }
21655
21694
  )), isContinueEnabled && /* @__PURE__ */ React171.createElement(
@@ -21792,12 +21831,12 @@ var NewTokenDepositAlert = ({
21792
21831
 
21793
21832
  // src/hooks/useAllowedAssets.ts
21794
21833
  import { getAllowedAssets } from "@funkit/api-base";
21795
- import { useQuery as useQuery17 } from "@tanstack/react-query";
21834
+ import { useQuery as useQuery16 } from "@tanstack/react-query";
21796
21835
  import { useCallback as useCallback30, useMemo as useMemo26 } from "react";
21797
21836
  function useAllowedAssets() {
21798
21837
  const { apiKey } = useFunkitConfig();
21799
21838
  const isRelayEnabled = useSourceTokenRelayEnabled();
21800
- const { data: allowedAssets, isLoading } = useQuery17({
21839
+ const { data: allowedAssets, isLoading } = useQuery16({
21801
21840
  queryKey: ["getAllowedAssets", apiKey],
21802
21841
  queryFn: () => getAllowedAssets({ apiKey, logger }),
21803
21842
  refetchOnMount: false,
@@ -22205,7 +22244,7 @@ function MeshOrAccountSelectAsset({
22205
22244
  FunNotification,
22206
22245
  {
22207
22246
  isVisible: !!fetchHoldingsError,
22208
- type: "error",
22247
+ type: "hint",
22209
22248
  description: fetchHoldingsError
22210
22249
  }
22211
22250
  ),
@@ -22358,7 +22397,7 @@ var DefiPurchaseSection = ({ config }) => {
22358
22397
 
22359
22398
  // src/modals/CheckoutModal/SourceChange/useUpdateSourceAssetForCard.ts
22360
22399
  import {
22361
- FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO16,
22400
+ FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO15,
22362
22401
  dydxChain as dydxChain3,
22363
22402
  katanaChain
22364
22403
  } from "@funkit/chains";
@@ -22384,7 +22423,7 @@ var pickSourceAssetForCard = async (checkoutItem, userIpInfo) => {
22384
22423
  const wethAddrOnTargetChain = (await getTokenAddressBySymbolAndChainId2("weth", moonpayChainId)).toLowerCase();
22385
22424
  const isTargetAssetEthOrWeth = [NATIVE_TOKEN, wethAddrOnTargetChain].includes(
22386
22425
  checkoutItem.initSettings.config.targetAsset
22387
- ) && FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO16[moonpayChainId]?.nativeCurrency.symbol === "ETH" /* ETH */;
22426
+ ) && FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO15[moonpayChainId]?.nativeCurrency.symbol === "ETH" /* ETH */;
22388
22427
  let sourceTokenAddress;
22389
22428
  let sourceTokenTicker;
22390
22429
  let sourceTokenChainId;
@@ -26312,7 +26351,7 @@ function FunCheckoutHistoryHelp({
26312
26351
  FunNotification,
26313
26352
  {
26314
26353
  description: errorMessage,
26315
- type: "error",
26354
+ type: "hint",
26316
26355
  isVisible: errorMessage !== void 0
26317
26356
  }
26318
26357
  )
@@ -28094,7 +28133,7 @@ import {
28094
28133
  getCheckoutsByUserId as getCheckoutsByUserId2
28095
28134
  } from "@funkit/api-base";
28096
28135
  import { FlagKey as FlagKey27 } from "@funkit/utils";
28097
- import { useQuery as useQuery18 } from "@tanstack/react-query";
28136
+ import { useQuery as useQuery17 } from "@tanstack/react-query";
28098
28137
  var hasCorrectPaymentMethod = (checkout, paymentMethod) => !paymentMethod || checkout.clientMetadata.selectedPaymentMethodInfo?.paymentMethod === paymentMethod;
28099
28138
  var isRecent = (checkout, timestampCutoff) => checkout.createdTimeMs > timestampCutoff;
28100
28139
  var DEFAULT_NOTIF_CUTOFF = 7 * 24 * 60 * 60 * 1e3;
@@ -28109,7 +28148,7 @@ var useRecentCheckouts = ({
28109
28148
  const { isUserLoggedIn, userInfo } = useGeneralWallet();
28110
28149
  const { apiKey } = useFunkitConfig();
28111
28150
  const { listRefresh } = useCheckoutRefreshInterval();
28112
- const query = useQuery18({
28151
+ const query = useQuery17({
28113
28152
  queryKey: ["checkouts", userInfo.id],
28114
28153
  queryFn: async () => {
28115
28154
  const checkouts = await getCheckoutsByUserId2({
@@ -28132,7 +28171,7 @@ var useRecentCheckouts = ({
28132
28171
  import {
28133
28172
  getDirectExecutionsByUserId as getDirectExecutionsByUserId2
28134
28173
  } from "@funkit/api-base";
28135
- import { useQuery as useQuery19 } from "@tanstack/react-query";
28174
+ import { useQuery as useQuery18 } from "@tanstack/react-query";
28136
28175
  var isRecent2 = (de, timestampCutoff) => de.createdTimeMs > timestampCutoff;
28137
28176
  var useRecentDirectExecutions = ({
28138
28177
  isVisible
@@ -28140,7 +28179,7 @@ var useRecentDirectExecutions = ({
28140
28179
  const { isUserLoggedIn, userInfo } = useGeneralWallet();
28141
28180
  const { apiKey } = useFunkitConfig();
28142
28181
  const { listRefresh } = useCheckoutRefreshInterval();
28143
- const query = useQuery19({
28182
+ const query = useQuery18({
28144
28183
  queryKey: ["directExecutions", userInfo.id],
28145
28184
  queryFn: async () => {
28146
28185
  const directExecutions = await getDirectExecutionsByUserId2({
@@ -28853,11 +28892,11 @@ var FunNotificationBanner = ({
28853
28892
  import {
28854
28893
  getCheckoutByDepositAddress as getCheckoutByDepositAddress2
28855
28894
  } from "@funkit/api-base";
28856
- import { useQuery as useQuery20 } from "@tanstack/react-query";
28895
+ import { useQuery as useQuery19 } from "@tanstack/react-query";
28857
28896
  var useCheckout = (depositAddress, initial) => {
28858
28897
  const { apiKey } = useFunkitConfig();
28859
28898
  const { itemRefresh } = useCheckoutRefreshInterval();
28860
- const query = useQuery20({
28899
+ const query = useQuery19({
28861
28900
  queryKey: ["checkouts", "checkout", depositAddress],
28862
28901
  queryFn: () => (
28863
28902
  // biome-ignore lint/style/noNonNullAssertion: already checked for null
@@ -31287,7 +31326,7 @@ function setFunkitConnectVersion({ version }) {
31287
31326
  localStorage.setItem(storageKey5, version);
31288
31327
  }
31289
31328
  function getCurrentSdkVersion() {
31290
- return "6.0.3";
31329
+ return "6.0.5";
31291
31330
  }
31292
31331
  function useFingerprint() {
31293
31332
  const fingerprint = useCallback50(() => {