@funkit/connect 6.0.3 → 6.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/dist/domains/relay.d.ts +7 -13
- package/dist/hooks/queries/useWithdrawalQuote.d.ts +6 -0
- package/dist/index.css +4 -4
- package/dist/index.js +132 -115
- package/dist/wallets/walletConnectors/bifrostWallet/bifrostWallet.js +2 -2
- package/dist/wallets/walletConnectors/bitgetWallet/bitgetWallet.js +2 -2
- package/dist/wallets/walletConnectors/bybitWallet/bybitWallet.js +2 -2
- package/dist/wallets/walletConnectors/clvWallet/clvWallet.js +2 -2
- package/dist/wallets/walletConnectors/coin98Wallet/coin98Wallet.js +2 -2
- package/dist/wallets/walletConnectors/coreWallet/coreWallet.js +2 -2
- package/dist/wallets/walletConnectors/foxWallet/foxWallet.js +2 -2
- package/dist/wallets/walletConnectors/frontierWallet/frontierWallet.js +2 -2
- package/dist/wallets/walletConnectors/gateWallet/gateWallet.js +2 -2
- package/dist/wallets/walletConnectors/index.js +49 -49
- package/dist/wallets/walletConnectors/metaMaskWallet/metaMaskWallet.js +2 -2
- package/dist/wallets/walletConnectors/okxWallet/okxWallet.js +2 -2
- package/dist/wallets/walletConnectors/rainbowWallet/rainbowWallet.js +2 -2
- package/dist/wallets/walletConnectors/roninWallet/roninWallet.js +2 -2
- package/dist/wallets/walletConnectors/safepalWallet/safepalWallet.js +2 -2
- package/dist/wallets/walletConnectors/subWallet/subWallet.js +2 -2
- package/dist/wallets/walletConnectors/tokenPocketWallet/tokenPocketWallet.js +2 -2
- package/dist/wallets/walletConnectors/trustWallet/trustWallet.js +2 -2
- package/dist/wallets/walletConnectors/zerionWallet/zerionWallet.js +2 -2
- package/package.json +5 -5
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
|
|
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";
|
|
@@ -3941,8 +3941,8 @@ import { flushSync } from "react-dom";
|
|
|
3941
3941
|
import { v4 as uuid } from "uuid";
|
|
3942
3942
|
|
|
3943
3943
|
// src/hooks/useCheckoutDirectExecution.ts
|
|
3944
|
-
import { DirectExecutionType } from "@funkit/api-base";
|
|
3945
|
-
import { executeRelayQuote
|
|
3944
|
+
import { DirectExecutionType, getCheckoutQuoteV2 } from "@funkit/api-base";
|
|
3945
|
+
import { executeRelayQuote } from "@funkit/fun-relay";
|
|
3946
3946
|
import { useCallback as useCallback5 } from "react";
|
|
3947
3947
|
import { useWalletClient } from "wagmi";
|
|
3948
3948
|
|
|
@@ -3961,19 +3961,6 @@ var WEB3_ACCOUNT_BALANCE_MESSAGE = {
|
|
|
3961
3961
|
[2 /* APPROVE_TRANSFER */]: (tokenSymbol) => `Confirm ${tokenSymbol} transfer`
|
|
3962
3962
|
};
|
|
3963
3963
|
|
|
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
3964
|
// src/hooks/useRelayBypass.ts
|
|
3978
3965
|
import { FlagKey as FlagKey4, isTokenAddressEquivalent as isTokenAddressEquivalent2 } from "@funkit/utils";
|
|
3979
3966
|
import { useCallback as useCallback4, useMemo as useMemo7 } from "react";
|
|
@@ -4087,7 +4074,7 @@ function useCheckoutDirectExecution() {
|
|
|
4087
4074
|
const { connector } = useFunkitAccount();
|
|
4088
4075
|
const { data: walletClient } = useWalletClient();
|
|
4089
4076
|
const { getIsRelayEnabled } = useRelayBypass();
|
|
4090
|
-
const {
|
|
4077
|
+
const { apiKey } = useFunkitConfig();
|
|
4091
4078
|
const getRelayDirectExecutionBaseQuote = useCallback5(
|
|
4092
4079
|
async (params) => {
|
|
4093
4080
|
const {
|
|
@@ -4102,41 +4089,35 @@ function useCheckoutDirectExecution() {
|
|
|
4102
4089
|
if (params.isExactIn) {
|
|
4103
4090
|
const { fromTokenDecimals, fromTokenAmount } = params;
|
|
4104
4091
|
const multiplier2 = 10 ** fromTokenDecimals;
|
|
4105
|
-
return await
|
|
4092
|
+
return await getCheckoutQuoteV2({
|
|
4106
4093
|
actionParams,
|
|
4107
|
-
|
|
4094
|
+
apiKey,
|
|
4095
|
+
fromAmountBaseUnit: BigInt(Math.floor(fromTokenAmount * multiplier2)),
|
|
4108
4096
|
fromChainId,
|
|
4109
4097
|
fromTokenAddress,
|
|
4110
4098
|
logger,
|
|
4111
4099
|
recipientAddress,
|
|
4112
4100
|
toChainId,
|
|
4113
4101
|
toTokenAddress,
|
|
4114
|
-
fromTokenAmountBaseUnit: BigInt(
|
|
4115
|
-
Math.floor(fromTokenAmount * multiplier2)
|
|
4116
|
-
),
|
|
4117
|
-
tradeType: "EXACT_INPUT",
|
|
4118
4102
|
userAddress: senderAddress
|
|
4119
4103
|
});
|
|
4120
4104
|
}
|
|
4121
4105
|
const { toTokenAmount, toTokenDecimals } = params;
|
|
4122
4106
|
const multiplier = 10 ** toTokenDecimals;
|
|
4123
|
-
return await
|
|
4107
|
+
return await getCheckoutQuoteV2({
|
|
4124
4108
|
actionParams,
|
|
4125
|
-
|
|
4109
|
+
apiKey,
|
|
4126
4110
|
fromChainId,
|
|
4127
4111
|
fromTokenAddress,
|
|
4128
4112
|
logger,
|
|
4129
4113
|
recipientAddress,
|
|
4114
|
+
toAmountBaseUnit: BigInt(Math.floor(toTokenAmount * multiplier)),
|
|
4130
4115
|
toChainId,
|
|
4131
4116
|
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
4117
|
userAddress: senderAddress
|
|
4137
4118
|
});
|
|
4138
4119
|
},
|
|
4139
|
-
[address,
|
|
4120
|
+
[address, apiKey]
|
|
4140
4121
|
);
|
|
4141
4122
|
const checkAndSwitchChains = useCallback5(
|
|
4142
4123
|
async ({
|
|
@@ -4295,7 +4276,7 @@ import {
|
|
|
4295
4276
|
initializeCheckoutTokenTransferAddress
|
|
4296
4277
|
} from "@funkit/api-base";
|
|
4297
4278
|
import { FlagKey as FlagKey5 } from "@funkit/utils";
|
|
4298
|
-
import { useQuery as
|
|
4279
|
+
import { useQuery as useQuery3 } from "@tanstack/react-query";
|
|
4299
4280
|
import { useCallback as useCallback6 } from "react";
|
|
4300
4281
|
|
|
4301
4282
|
// src/domains/clientMetadata.ts
|
|
@@ -4392,7 +4373,7 @@ var useCheckoutTransferInit = () => {
|
|
|
4392
4373
|
const isQRCodeEnabledWithPostAction = !!checkoutConfig && // either no post action required
|
|
4393
4374
|
(!isCheckoutPostActionRequired(checkoutConfig) || // or action type is set
|
|
4394
4375
|
!!checkoutConfig?.qrcodeActionType);
|
|
4395
|
-
const { data, isFetching } =
|
|
4376
|
+
const { data, isFetching } = useQuery3({
|
|
4396
4377
|
queryKey: ["initializeCheckoutTokenTransferAddress", queryKey],
|
|
4397
4378
|
queryFn: () => queryFunction(queryKey),
|
|
4398
4379
|
refetchOnWindowFocus: false,
|
|
@@ -5360,14 +5341,14 @@ import {
|
|
|
5360
5341
|
getDirectExecutionByTxHash
|
|
5361
5342
|
} from "@funkit/api-base";
|
|
5362
5343
|
import { RELAY_TERMINAL_STATUSES } from "@funkit/fun-relay";
|
|
5363
|
-
import { useQuery as
|
|
5344
|
+
import { useQuery as useQuery4 } from "@tanstack/react-query";
|
|
5364
5345
|
var RELAY_FETCH_INTERVAL = 1500;
|
|
5365
5346
|
var logPrefix = "useDirectExecutionInfoPolling";
|
|
5366
5347
|
function useDirectExecutionInfoPolling({
|
|
5367
5348
|
initDirectExecution
|
|
5368
5349
|
}) {
|
|
5369
5350
|
const { apiKey } = useFunkitConfig();
|
|
5370
|
-
const { data: directExecution, isLoading } =
|
|
5351
|
+
const { data: directExecution, isLoading } = useQuery4({
|
|
5371
5352
|
queryKey: [logPrefix, initDirectExecution?.txHash],
|
|
5372
5353
|
queryFn: async () => {
|
|
5373
5354
|
try {
|
|
@@ -5631,7 +5612,7 @@ function useCheckoutHistoryContext() {
|
|
|
5631
5612
|
}
|
|
5632
5613
|
function useCheckoutsListenerByUserId(userId) {
|
|
5633
5614
|
const { apiKey } = useFunkitConfig();
|
|
5634
|
-
const { data, isLoading } =
|
|
5615
|
+
const { data, isLoading } = useQuery5({
|
|
5635
5616
|
enabled: !!userId,
|
|
5636
5617
|
queryKey: ["getPurifiedCheckoutsByUserId", userId],
|
|
5637
5618
|
queryFn: async () => {
|
|
@@ -5658,7 +5639,7 @@ function useCheckoutsListenerByUserId(userId) {
|
|
|
5658
5639
|
}
|
|
5659
5640
|
function useCheckoutListenerByCheckoutId(checkoutId) {
|
|
5660
5641
|
const { apiKey } = useFunkitConfig();
|
|
5661
|
-
const { data, isLoading } =
|
|
5642
|
+
const { data, isLoading } = useQuery5({
|
|
5662
5643
|
enabled: !!checkoutId,
|
|
5663
5644
|
queryKey: ["getPurifiedCheckoutById", checkoutId],
|
|
5664
5645
|
queryFn: async () => {
|
|
@@ -8512,7 +8493,7 @@ Dialog.BottomSection = DialogBottom;
|
|
|
8512
8493
|
Dialog.BottomBar = FunBottomBar;
|
|
8513
8494
|
|
|
8514
8495
|
// src/modals/WithdrwalModal/WithdrawalContent.tsx
|
|
8515
|
-
import { FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as
|
|
8496
|
+
import { FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO8 } from "@funkit/chains";
|
|
8516
8497
|
import {
|
|
8517
8498
|
FlagKey as FlagKey14,
|
|
8518
8499
|
formatCryptoAndStringify as formatCryptoAndStringify2,
|
|
@@ -10247,13 +10228,16 @@ import clsx14 from "clsx";
|
|
|
10247
10228
|
import { motion as motion6, useAnimationControls } from "motion/react";
|
|
10248
10229
|
|
|
10249
10230
|
// src/domains/relay.ts
|
|
10250
|
-
import { FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO6 } from "@funkit/chains";
|
|
10251
10231
|
var KATANA_BRIDGE_ALERT_THRESHOLD_PERCENT = 0.5;
|
|
10252
|
-
function extractRelayFeeInfo(
|
|
10232
|
+
function extractRelayFeeInfo({
|
|
10233
|
+
relayQuote = {},
|
|
10234
|
+
feeBreakdown
|
|
10235
|
+
} = {}) {
|
|
10236
|
+
if (feeBreakdown) {
|
|
10237
|
+
return feeBreakdown;
|
|
10238
|
+
}
|
|
10253
10239
|
const { details, fees } = relayQuote;
|
|
10254
10240
|
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
10241
|
const appFeeUsd = Number.parseFloat(fees?.app?.amountUsd || "0");
|
|
10258
10242
|
const fillCostUsd = Number.parseFloat(fees?.relayerGas?.amountUsd || "0");
|
|
10259
10243
|
const relayCostUsd = Number.parseFloat(fees?.relayerService?.amountUsd || "0");
|
|
@@ -10273,7 +10257,6 @@ function extractRelayFeeInfo(relayQuote) {
|
|
|
10273
10257
|
gasUsd,
|
|
10274
10258
|
fillCostUsd,
|
|
10275
10259
|
fillCostPercent,
|
|
10276
|
-
chainName,
|
|
10277
10260
|
totalImpactUsd,
|
|
10278
10261
|
totalImpact,
|
|
10279
10262
|
swapImpact,
|
|
@@ -10395,7 +10378,7 @@ function formatRelayFee({
|
|
|
10395
10378
|
}
|
|
10396
10379
|
return formatPercent(percent);
|
|
10397
10380
|
}
|
|
10398
|
-
function renderRelayFee(
|
|
10381
|
+
function renderRelayFee(relayQuoteMetadata, fees, totalUsd) {
|
|
10399
10382
|
const {
|
|
10400
10383
|
gasUsd,
|
|
10401
10384
|
totalImpactUsd,
|
|
@@ -10406,7 +10389,7 @@ function renderRelayFee(relayQuote, fees, totalUsd) {
|
|
|
10406
10389
|
maxSlippage,
|
|
10407
10390
|
minReceived,
|
|
10408
10391
|
fillCostUsd
|
|
10409
|
-
} = extractRelayFeeInfo(
|
|
10392
|
+
} = extractRelayFeeInfo(relayQuoteMetadata);
|
|
10410
10393
|
const totalNetworkCostUsd = fillCostUsd + gasUsd;
|
|
10411
10394
|
const totalPriceImpact = swapImpactUsd + appFeeUsd;
|
|
10412
10395
|
const totalPriceImpactPercent = swapImpact + appFeePercent;
|
|
@@ -10519,9 +10502,9 @@ function renderRelayFee(relayQuote, fees, totalUsd) {
|
|
|
10519
10502
|
]
|
|
10520
10503
|
};
|
|
10521
10504
|
}
|
|
10522
|
-
var extractFeeItems = (fees, totalUsd,
|
|
10523
|
-
if (
|
|
10524
|
-
return renderRelayFee(
|
|
10505
|
+
var extractFeeItems = (fees, totalUsd, relayQuoteMetadata) => {
|
|
10506
|
+
if (relayQuoteMetadata) {
|
|
10507
|
+
return renderRelayFee(relayQuoteMetadata, fees, totalUsd);
|
|
10525
10508
|
}
|
|
10526
10509
|
const marketMakerFee = {
|
|
10527
10510
|
label: "Market maker gas costs",
|
|
@@ -10608,8 +10591,8 @@ function PaymentFeesSummary({
|
|
|
10608
10591
|
return NO_DATA;
|
|
10609
10592
|
}
|
|
10610
10593
|
const totalUsd = Number(quote?.finalTotalUsd ?? "0");
|
|
10611
|
-
const
|
|
10612
|
-
return extractFeeItems(fees, totalUsd,
|
|
10594
|
+
const relayQuoteMetadata = quote?.baseQuote?.metadata;
|
|
10595
|
+
return extractFeeItems(fees, totalUsd, relayQuoteMetadata);
|
|
10613
10596
|
}, [quote, fallbackFees]);
|
|
10614
10597
|
const isExpandable = expandedItems.length > 0 && !isLoading && !valuesNotAvailable;
|
|
10615
10598
|
return /* @__PURE__ */ React90.createElement(Box, null, /* @__PURE__ */ React90.createElement(
|
|
@@ -10750,7 +10733,7 @@ var EvmWallet = ({ size = 20 }) => /* @__PURE__ */ React91.createElement(
|
|
|
10750
10733
|
);
|
|
10751
10734
|
|
|
10752
10735
|
// src/hooks/queries/useWithdrawalQuote.ts
|
|
10753
|
-
import { useQuery as
|
|
10736
|
+
import { useQuery as useQuery6 } from "@tanstack/react-query";
|
|
10754
10737
|
import { useConfig as useConfig2 } from "wagmi";
|
|
10755
10738
|
|
|
10756
10739
|
// src/domains/quote.ts
|
|
@@ -10761,18 +10744,18 @@ import {
|
|
|
10761
10744
|
getAssetPriceInfo as getAssetPriceInfo2,
|
|
10762
10745
|
getMoonpayBuyQuoteForCreditCard
|
|
10763
10746
|
} from "@funkit/api-base";
|
|
10764
|
-
import { FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as
|
|
10747
|
+
import { FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO7 } from "@funkit/chains";
|
|
10765
10748
|
import { estimateGas, getGasPrice } from "@wagmi/core";
|
|
10766
10749
|
import { encodeFunctionData, erc20Abi as erc20Abi2, formatEther } from "viem";
|
|
10767
10750
|
import { zkSync } from "viem/zksync";
|
|
10768
10751
|
|
|
10769
10752
|
// src/utils/moonpay.ts
|
|
10770
|
-
import { FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as
|
|
10753
|
+
import { FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO6 } from "@funkit/chains";
|
|
10771
10754
|
var MINIMUM_MOONPAY_DEPOSIT_AMOUNT_USD = 35;
|
|
10772
10755
|
var MINIMUM_DEFI_MOONPAY_DEPOSIT_AMOUNT_USD = 25;
|
|
10773
10756
|
var MAXIMUM_MOONPAY_DEPOSIT_AMOUNT_USD = 1e4;
|
|
10774
10757
|
var generateMoonpayCurrencyCode = (tokenSymbol, chainId) => {
|
|
10775
|
-
let moonpayChainName =
|
|
10758
|
+
let moonpayChainName = FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO6[chainId]?.moonpayChainName;
|
|
10776
10759
|
if (moonpayChainName == null) {
|
|
10777
10760
|
throw new Error("MoonPay not supported on testnets");
|
|
10778
10761
|
}
|
|
@@ -10838,7 +10821,7 @@ async function evaluateAccountWalletFees({
|
|
|
10838
10821
|
apiKey,
|
|
10839
10822
|
isWithdrawal
|
|
10840
10823
|
}) {
|
|
10841
|
-
const nativeCurrencySymbol =
|
|
10824
|
+
const nativeCurrencySymbol = FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO7[selectedSourceAssetInfo.chainId]?.nativeCurrency.symbol || "";
|
|
10842
10825
|
const walletCheckoutFees = {
|
|
10843
10826
|
paymentMethod: "balance" /* ACCOUNT_BALANCE */,
|
|
10844
10827
|
...getFunFeeBreakdown(baseQuote),
|
|
@@ -11170,12 +11153,13 @@ function useWithdrawalQuote({
|
|
|
11170
11153
|
const wagmiConfig = useConfig2();
|
|
11171
11154
|
const { getWithdrawalDirectExecution } = useCheckoutDirectExecution();
|
|
11172
11155
|
const { checkoutItem } = useCheckoutContext();
|
|
11156
|
+
const isInstantQuoting = (symbol === "USDC" || symbol === "USDT") && chainId !== "1";
|
|
11173
11157
|
const isValidAddress = isAddressCompatibleWithChain(
|
|
11174
11158
|
recipientAddress,
|
|
11175
11159
|
Number(chainId)
|
|
11176
11160
|
);
|
|
11177
11161
|
const enabled = !!apiKey && !!targetAsset && !!sourceAmount && !!recipientAddress && !!chainId && !!symbol && !!isValidAddress && !!checkoutItem;
|
|
11178
|
-
const query =
|
|
11162
|
+
const query = useQuery6({
|
|
11179
11163
|
queryKey: [
|
|
11180
11164
|
"withdrawal",
|
|
11181
11165
|
"quote",
|
|
@@ -11212,19 +11196,33 @@ function useWithdrawalQuote({
|
|
|
11212
11196
|
retry: false,
|
|
11213
11197
|
enabled,
|
|
11214
11198
|
refetchInterval: enabled ? QUOTE_REFRESH_INTERVAL_MS : false,
|
|
11215
|
-
refetchIntervalInBackground: true
|
|
11199
|
+
refetchIntervalInBackground: true,
|
|
11200
|
+
placeholderData: (previousData) => {
|
|
11201
|
+
if (!previousData || !isInstantQuoting) {
|
|
11202
|
+
return void 0;
|
|
11203
|
+
}
|
|
11204
|
+
const prevQuote = previousData.baseQuote.metadata?.relayQuote;
|
|
11205
|
+
if (!prevQuote) {
|
|
11206
|
+
return void 0;
|
|
11207
|
+
}
|
|
11208
|
+
const { chainId: prevChainId, symbol: prevSymbol } = prevQuote?.details?.currencyOut?.currency || {};
|
|
11209
|
+
if (prevChainId?.toString() === chainId && prevSymbol === symbol) {
|
|
11210
|
+
return previousData;
|
|
11211
|
+
}
|
|
11212
|
+
}
|
|
11216
11213
|
});
|
|
11217
11214
|
return {
|
|
11218
11215
|
...query,
|
|
11219
|
-
quoteEnabled: enabled
|
|
11216
|
+
quoteEnabled: enabled,
|
|
11217
|
+
isInstantQuoting
|
|
11220
11218
|
};
|
|
11221
11219
|
}
|
|
11222
11220
|
|
|
11223
11221
|
// src/hooks/queries/useWithdrawalRisk.ts
|
|
11224
|
-
import { useQuery as
|
|
11222
|
+
import { useQuery as useQuery7 } from "@tanstack/react-query";
|
|
11225
11223
|
import { isAddress as isAddress3 } from "viem";
|
|
11226
11224
|
var useWithdrawalRisk = (apiKey, receiveAddress) => {
|
|
11227
|
-
const query =
|
|
11225
|
+
const query = useQuery7({
|
|
11228
11226
|
queryKey: ["withdrawal", "addressRisk", apiKey, receiveAddress],
|
|
11229
11227
|
queryFn: async () => {
|
|
11230
11228
|
return await hasRisk(apiKey, receiveAddress);
|
|
@@ -11244,17 +11242,17 @@ import {
|
|
|
11244
11242
|
convertFunToRelayTokenAddress,
|
|
11245
11243
|
getRelayAssetPriceInfo
|
|
11246
11244
|
} from "@funkit/fun-relay";
|
|
11247
|
-
import { skipToken, useQuery as
|
|
11245
|
+
import { skipToken, useQuery as useQuery9 } from "@tanstack/react-query";
|
|
11248
11246
|
|
|
11249
11247
|
// src/hooks/queries/useErc20Asset.ts
|
|
11250
11248
|
import { getAssetErc20ByChainAndSymbol } from "@funkit/api-base";
|
|
11251
|
-
import { useQuery as
|
|
11249
|
+
import { useQuery as useQuery8 } from "@tanstack/react-query";
|
|
11252
11250
|
var useErc20Asset = ({
|
|
11253
11251
|
chainId,
|
|
11254
11252
|
symbol
|
|
11255
11253
|
}) => {
|
|
11256
11254
|
const { apiKey } = useFunkitConfig();
|
|
11257
|
-
const query =
|
|
11255
|
+
const query = useQuery8({
|
|
11258
11256
|
queryKey: ["erc20Asset", chainId, symbol],
|
|
11259
11257
|
queryFn: async () => {
|
|
11260
11258
|
if (!apiKey || !chainId || !symbol) {
|
|
@@ -11303,7 +11301,7 @@ function useAssetAddressPrice({
|
|
|
11303
11301
|
refetchInterval = 1e4
|
|
11304
11302
|
}) {
|
|
11305
11303
|
const { apiKey } = useFunkitConfig();
|
|
11306
|
-
const { data, error, isLoading } =
|
|
11304
|
+
const { data, error, isLoading } = useQuery9({
|
|
11307
11305
|
queryKey: ["getAssetPriceInfo", chainId, assetTokenAddress],
|
|
11308
11306
|
queryFn: chainId && assetTokenAddress ? async () => {
|
|
11309
11307
|
const isRelayPrimary = RELAY_SHORT_CIRCUIT_CHAIN_IDS.includes(chainId);
|
|
@@ -12074,8 +12072,9 @@ function useWithdrawalAssets(config) {
|
|
|
12074
12072
|
}
|
|
12075
12073
|
function getRelayOutputCurrencyAmount(quote, fallback2) {
|
|
12076
12074
|
try {
|
|
12075
|
+
const relayQuote = quote.baseQuote;
|
|
12077
12076
|
return Number.parseFloat(
|
|
12078
|
-
|
|
12077
|
+
relayQuote.metadata?.relayQuote?.details?.currencyOut?.amountFormatted || "0"
|
|
12079
12078
|
) || fallback2 || 0;
|
|
12080
12079
|
} catch (error) {
|
|
12081
12080
|
logger.error("Error getting relay output currency amount:", error);
|
|
@@ -12092,9 +12091,11 @@ var WithdrawContent = ({
|
|
|
12092
12091
|
onContinue,
|
|
12093
12092
|
config,
|
|
12094
12093
|
withdrawalItem
|
|
12094
|
+
// biome-ignore lint/complexity/noExcessiveCognitiveComplexity: <explanation>
|
|
12095
12095
|
}) => {
|
|
12096
12096
|
const sourceTokenBalance = withdrawalItem?.withdrawalSourceTokenBalance?.() || 0;
|
|
12097
12097
|
const token = config.sourceTokenSymbol;
|
|
12098
|
+
const [confirmingQuote, setConfirmingQuote] = useState27(false);
|
|
12098
12099
|
const [recipientAddress, setRecipientAddress] = useState27("");
|
|
12099
12100
|
const [amount, setAmount] = useState27("");
|
|
12100
12101
|
const [debouncedAmount] = useDebounce(amount, 500);
|
|
@@ -12142,7 +12143,9 @@ var WithdrawContent = ({
|
|
|
12142
12143
|
isLoading: isQuoteLoading,
|
|
12143
12144
|
data: quote,
|
|
12144
12145
|
error: quoteErrorObject,
|
|
12145
|
-
quoteEnabled
|
|
12146
|
+
quoteEnabled,
|
|
12147
|
+
isPlaceholderData,
|
|
12148
|
+
isInstantQuoting
|
|
12146
12149
|
} = useWithdrawalQuote({
|
|
12147
12150
|
withdrawalClient: config.wallet,
|
|
12148
12151
|
recipientAddress,
|
|
@@ -12163,6 +12166,13 @@ var WithdrawContent = ({
|
|
|
12163
12166
|
onContinue(withdrawal, txHash);
|
|
12164
12167
|
}
|
|
12165
12168
|
});
|
|
12169
|
+
useEffect27(() => {
|
|
12170
|
+
if (!isPlaceholderData && !isQuoteLoading && isInstantQuoting && confirmingQuote) {
|
|
12171
|
+
setTimeout(() => {
|
|
12172
|
+
setConfirmingQuote(false);
|
|
12173
|
+
}, 150);
|
|
12174
|
+
}
|
|
12175
|
+
}, [isPlaceholderData, confirmingQuote, isQuoteLoading, isInstantQuoting]);
|
|
12166
12176
|
const showCheckAddressAlert = false;
|
|
12167
12177
|
const wallets = usePreparedWalletConnectors();
|
|
12168
12178
|
const { loginType } = useGeneralWallet();
|
|
@@ -12170,6 +12180,7 @@ var WithdrawContent = ({
|
|
|
12170
12180
|
const connectedWalletIconUrl = wallets.find(
|
|
12171
12181
|
(wallet) => wallet.id === connector?.id
|
|
12172
12182
|
)?.iconUrl;
|
|
12183
|
+
const normalizedSelectedToken = selectedToken.toUpperCase();
|
|
12173
12184
|
const isValidAddress = isAddressSupported(recipientAddress);
|
|
12174
12185
|
const isValidAddressAndChain = isAddressCompatibleWithChain(
|
|
12175
12186
|
recipientAddress,
|
|
@@ -12206,6 +12217,10 @@ var WithdrawContent = ({
|
|
|
12206
12217
|
updateWithdrawalSourceAssetAmount(sourceTokenBalance);
|
|
12207
12218
|
};
|
|
12208
12219
|
const handleSubmit = () => {
|
|
12220
|
+
if (isPlaceholderData || isQuoteLoading && isInstantQuoting) {
|
|
12221
|
+
setConfirmingQuote(true);
|
|
12222
|
+
return;
|
|
12223
|
+
}
|
|
12209
12224
|
if (!quote) {
|
|
12210
12225
|
throw new Error("Quote is not available");
|
|
12211
12226
|
}
|
|
@@ -12222,6 +12237,9 @@ var WithdrawContent = ({
|
|
|
12222
12237
|
};
|
|
12223
12238
|
const { data: addressAssessment, isLoading: isCheckingAddressRisk } = useWithdrawalRisk(apiKey, recipientAddress);
|
|
12224
12239
|
const getWithdrawButtonText = () => {
|
|
12240
|
+
if (confirmingQuote) {
|
|
12241
|
+
return "Confirming quote";
|
|
12242
|
+
}
|
|
12225
12243
|
if (isWithdrawing) {
|
|
12226
12244
|
return "Processing";
|
|
12227
12245
|
}
|
|
@@ -12237,7 +12255,7 @@ var WithdrawContent = ({
|
|
|
12237
12255
|
return "Withdraw";
|
|
12238
12256
|
};
|
|
12239
12257
|
const getAlertMessage = () => {
|
|
12240
|
-
const chainName =
|
|
12258
|
+
const chainName = FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO8[selectedChainId]?.name;
|
|
12241
12259
|
if (chainName) {
|
|
12242
12260
|
return `Please ensure the address supports receiving ${selectedToken} on ${chainName}.`;
|
|
12243
12261
|
}
|
|
@@ -12246,15 +12264,14 @@ var WithdrawContent = ({
|
|
|
12246
12264
|
const bottomSectionRef = useBottomSectionRef("withdrawal");
|
|
12247
12265
|
const showAddressError = addressInputTouched && !isValidAddress && recipientAddress !== "";
|
|
12248
12266
|
const showAmountError = amountInputTouched && amount !== "" && !isWithdrawAmountValid;
|
|
12249
|
-
const canContinue = recipientAddress && amount && token && selectedChainId && !isQuoteLoading && !showAmountError && !showAddressError && !isCheckingAddressRisk && !addressAssessment && isValidAddressAndChain && amount === debouncedAmount;
|
|
12267
|
+
const canContinue = recipientAddress && amount && token && selectedChainId && (!isQuoteLoading || isInstantQuoting) && !showAmountError && !showAddressError && !isCheckingAddressRisk && !addressAssessment && isValidAddressAndChain && amount === debouncedAmount;
|
|
12250
12268
|
const { totalImpactUsd, gasUsd } = extractRelayFeeInfo(
|
|
12251
|
-
quote?.baseQuote?.metadata
|
|
12269
|
+
quote?.baseQuote?.metadata
|
|
12252
12270
|
);
|
|
12253
|
-
const receiveAmountCrypto = quote ? getRelayOutputCurrencyAmount(quote.finalEstimation, targetAssetAmount) : 0;
|
|
12254
|
-
const receiveAmountFiat = quote ? Number(debouncedAmount || 0) : 0;
|
|
12271
|
+
const receiveAmountCrypto = quote ? getRelayOutputCurrencyAmount(quote.finalEstimation, targetAssetAmount) : isInstantQuoting ? Number(amount) : 0;
|
|
12272
|
+
const receiveAmountFiat = quote || isInstantQuoting ? Number(debouncedAmount || 0) : 0;
|
|
12255
12273
|
const receiveAmountFiatTotal = receiveAmountFiat - totalImpactUsd - gasUsd;
|
|
12256
12274
|
const withdrawButtonText = getWithdrawButtonText();
|
|
12257
|
-
const normalizedSelectedToken = selectedToken.toUpperCase();
|
|
12258
12275
|
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
12276
|
FunInput,
|
|
12260
12277
|
{
|
|
@@ -12368,7 +12385,7 @@ var WithdrawContent = ({
|
|
|
12368
12385
|
alwaysOpenToTop: true,
|
|
12369
12386
|
maxTokenDropdownHeight: 195
|
|
12370
12387
|
}
|
|
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(
|
|
12388
|
+
), /* @__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
12389
|
Box,
|
|
12373
12390
|
{
|
|
12374
12391
|
display: "flex",
|
|
@@ -12381,7 +12398,7 @@ var WithdrawContent = ({
|
|
|
12381
12398
|
PaymentFeesSummary,
|
|
12382
12399
|
{
|
|
12383
12400
|
fallbackFees: FALLBACK_FEES,
|
|
12384
|
-
isLoading: isQuoteLoading,
|
|
12401
|
+
isLoading: isQuoteLoading && !isInstantQuoting,
|
|
12385
12402
|
quote: quote?.finalEstimation,
|
|
12386
12403
|
key: `${isQuoteLoading}`,
|
|
12387
12404
|
valuesNotAvailable: !quoteEnabled
|
|
@@ -12407,7 +12424,7 @@ var WithdrawContent = ({
|
|
|
12407
12424
|
actionButtonProps: {
|
|
12408
12425
|
title: withdrawButtonText,
|
|
12409
12426
|
isDisabled: !canContinue || isWithdrawing,
|
|
12410
|
-
isLoading: isWithdrawing,
|
|
12427
|
+
isLoading: isWithdrawing || confirmingQuote,
|
|
12411
12428
|
onClick: handleSubmit
|
|
12412
12429
|
}
|
|
12413
12430
|
}
|
|
@@ -12529,7 +12546,7 @@ function useSIWFarcasterListener(channelToken) {
|
|
|
12529
12546
|
import {
|
|
12530
12547
|
getAllWalletTokens
|
|
12531
12548
|
} from "@funkit/api-base";
|
|
12532
|
-
import { keepPreviousData, useQuery as
|
|
12549
|
+
import { keepPreviousData, useQuery as useQuery10 } from "@tanstack/react-query";
|
|
12533
12550
|
import { arbitrum as arbitrum2, polygon as polygon4 } from "viem/chains";
|
|
12534
12551
|
import { useAccount as useAccount4 } from "wagmi";
|
|
12535
12552
|
import { isTokenEquivalent as isTokenEquivalent2 } from "@funkit/utils";
|
|
@@ -12618,7 +12635,7 @@ var useWalletAssets = ({
|
|
|
12618
12635
|
} = {}) => {
|
|
12619
12636
|
const { address, isConnected } = useAccount4();
|
|
12620
12637
|
const { apiKey } = useFunkitConfig();
|
|
12621
|
-
const { data, isLoading, isFetching } =
|
|
12638
|
+
const { data, isLoading, isFetching } = useQuery10({
|
|
12622
12639
|
queryKey: ["getWalletAssets", address, apiKey],
|
|
12623
12640
|
queryFn: ({ queryKey: [_, addr, key] }) => fetchAssets(addr, key),
|
|
12624
12641
|
placeholderData: keepPreviousData,
|
|
@@ -12696,7 +12713,7 @@ function FunTxSummaryLineItemKeyText({ text }) {
|
|
|
12696
12713
|
|
|
12697
12714
|
// src/components/FunButton/FunRedirectButton.tsx
|
|
12698
12715
|
import React97 from "react";
|
|
12699
|
-
import { FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as
|
|
12716
|
+
import { FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO9 } from "@funkit/chains";
|
|
12700
12717
|
|
|
12701
12718
|
// src/components/Icons/RedirectIcon.tsx
|
|
12702
12719
|
import React96 from "react";
|
|
@@ -12755,7 +12772,7 @@ var AddressRedirectButton = ({
|
|
|
12755
12772
|
address,
|
|
12756
12773
|
customRedirectUrl
|
|
12757
12774
|
}) => {
|
|
12758
|
-
const explorerInfo =
|
|
12775
|
+
const explorerInfo = FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO9[chainId]?.explorerInfo;
|
|
12759
12776
|
return /* @__PURE__ */ React97.createElement(
|
|
12760
12777
|
FunRedirectButton,
|
|
12761
12778
|
{
|
|
@@ -12769,7 +12786,7 @@ var TransactionRedirectButton = ({
|
|
|
12769
12786
|
txHash,
|
|
12770
12787
|
customRedirectUrl
|
|
12771
12788
|
}) => {
|
|
12772
|
-
const explorerInfo =
|
|
12789
|
+
const explorerInfo = FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO9[chainId]?.explorerInfo;
|
|
12773
12790
|
return /* @__PURE__ */ React97.createElement(
|
|
12774
12791
|
FunRedirectButton,
|
|
12775
12792
|
{
|
|
@@ -12806,7 +12823,7 @@ import {
|
|
|
12806
12823
|
getBridgeCustomer,
|
|
12807
12824
|
getFrogAccount
|
|
12808
12825
|
} from "@funkit/api-base";
|
|
12809
|
-
import { FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as
|
|
12826
|
+
import { FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO10 } from "@funkit/chains";
|
|
12810
12827
|
import { ResourceNotFoundError } from "@funkit/utils";
|
|
12811
12828
|
async function fetchFrogAccounts(walletAddress, params) {
|
|
12812
12829
|
const { logger: logger2 } = params;
|
|
@@ -12850,7 +12867,7 @@ async function fetchAllFiatAccounts(bridgeSubAccount, params) {
|
|
|
12850
12867
|
}
|
|
12851
12868
|
function getMatchingBankAccount(accounts, targetChain, targetAddress) {
|
|
12852
12869
|
const { bankAccounts } = accounts;
|
|
12853
|
-
const chainInfo =
|
|
12870
|
+
const chainInfo = FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO10[targetChain];
|
|
12854
12871
|
if (!bankAccounts || !chainInfo) {
|
|
12855
12872
|
return void 0;
|
|
12856
12873
|
}
|
|
@@ -12895,9 +12912,9 @@ import {
|
|
|
12895
12912
|
createBridgeBankAccount,
|
|
12896
12913
|
getBridgeKycLink
|
|
12897
12914
|
} from "@funkit/api-base";
|
|
12898
|
-
import { FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as
|
|
12915
|
+
import { FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO11 } from "@funkit/chains";
|
|
12899
12916
|
import { FlagKey as FlagKey16 } from "@funkit/utils";
|
|
12900
|
-
import { useQuery as
|
|
12917
|
+
import { useQuery as useQuery11, useQueryClient } from "@tanstack/react-query";
|
|
12901
12918
|
import { useCallback as useCallback18 } from "react";
|
|
12902
12919
|
var sepaCountryCode = [
|
|
12903
12920
|
// EU countries that are part of SEPA
|
|
@@ -12983,7 +13000,7 @@ function useFiatEnabled() {
|
|
|
12983
13000
|
function useFrogAccounts() {
|
|
12984
13001
|
const { apiKey } = useFunkitConfig();
|
|
12985
13002
|
const { walletAddress } = useGeneralWallet();
|
|
12986
|
-
const query =
|
|
13003
|
+
const query = useQuery11({
|
|
12987
13004
|
queryKey: ["frogSubAccounts", walletAddress],
|
|
12988
13005
|
queryFn: () => fetchFrogAccounts(walletAddress, { apiKey, logger }),
|
|
12989
13006
|
enabled: !!walletAddress,
|
|
@@ -13019,7 +13036,7 @@ function useVirtualFiatAccounts() {
|
|
|
13019
13036
|
const bridgeSubAccount = frogSubAccounts?.find(
|
|
13020
13037
|
(subAccount) => subAccount.subAccountType === "bridge"
|
|
13021
13038
|
);
|
|
13022
|
-
const query =
|
|
13039
|
+
const query = useQuery11({
|
|
13023
13040
|
queryKey: ["useVirtualFiatAccounts", bridgeSubAccount?.guid],
|
|
13024
13041
|
queryFn: () => fetchAllFiatAccounts(bridgeSubAccount, { apiKey, logger }),
|
|
13025
13042
|
enabled: !!bridgeSubAccount,
|
|
@@ -13046,7 +13063,7 @@ function useMatchingVirtualFiatAccount(accounts) {
|
|
|
13046
13063
|
}
|
|
13047
13064
|
function useLoadKycLink(linkLoad) {
|
|
13048
13065
|
const { apiKey } = useFunkitConfig();
|
|
13049
|
-
const query =
|
|
13066
|
+
const query = useQuery11({
|
|
13050
13067
|
queryKey: ["kycLink", linkLoad.guid],
|
|
13051
13068
|
queryFn: async () => {
|
|
13052
13069
|
if (linkLoad.kycLink) {
|
|
@@ -13075,7 +13092,7 @@ function useCreateVirtualBankAccount() {
|
|
|
13075
13092
|
const targetChainId = checkoutConfig?.targetChain;
|
|
13076
13093
|
const { transferInit, recipientAddr } = useCheckoutTransferInit();
|
|
13077
13094
|
const destinationAddress = transferInit?.depositAddr || recipientAddr;
|
|
13078
|
-
const chainName = targetChainId &&
|
|
13095
|
+
const chainName = targetChainId && FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO11[targetChainId]?.name?.toLowerCase();
|
|
13079
13096
|
const subAccountId = allFiatAccounts?.bridgeCustomer?.id;
|
|
13080
13097
|
const { clearVirtualFiatAccounts } = useClearFrogAccountsCache();
|
|
13081
13098
|
const handleCreateVirtualFiatAccount = useCallback18(async () => {
|
|
@@ -13126,7 +13143,7 @@ var useWalletLabel = () => {
|
|
|
13126
13143
|
// src/modals/CheckoutModal/useWalletAssetHoldings.ts
|
|
13127
13144
|
import {
|
|
13128
13145
|
FUNKIT_CONNECT_CHECKOUT_NATIVE_CURRENCY_ADDRESS as FUNKIT_CONNECT_CHECKOUT_NATIVE_CURRENCY_ADDRESS3,
|
|
13129
|
-
FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as
|
|
13146
|
+
FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO12
|
|
13130
13147
|
} from "@funkit/chains";
|
|
13131
13148
|
import { useMemo as useMemo13 } from "react";
|
|
13132
13149
|
|
|
@@ -13146,14 +13163,14 @@ var processWalletAssets = (walletAssets, targetChain) => {
|
|
|
13146
13163
|
if (!walletAssets) {
|
|
13147
13164
|
return;
|
|
13148
13165
|
}
|
|
13149
|
-
const targetChainInfo =
|
|
13166
|
+
const targetChainInfo = FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO12[targetChain];
|
|
13150
13167
|
const isCheckoutOnMainnet = targetChainInfo?.isMainnet;
|
|
13151
13168
|
return Object.values(walletAssets).reduce(
|
|
13152
13169
|
(result, asset) => {
|
|
13153
13170
|
if (!asset.symbol || !asset.contractAddress) {
|
|
13154
13171
|
return result;
|
|
13155
13172
|
}
|
|
13156
|
-
const assetChainInfo =
|
|
13173
|
+
const assetChainInfo = FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO12[asset.chainId];
|
|
13157
13174
|
const isAssetOnMainnet = assetChainInfo?.isMainnet;
|
|
13158
13175
|
if (isCheckoutOnMainnet && !isAssetOnMainnet) {
|
|
13159
13176
|
return result;
|
|
@@ -13200,7 +13217,7 @@ function useWalletAssetHoldings(targetChain) {
|
|
|
13200
13217
|
|
|
13201
13218
|
// src/config/getDefaultConfig.ts
|
|
13202
13219
|
import {
|
|
13203
|
-
FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as
|
|
13220
|
+
FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO13,
|
|
13204
13221
|
FUNKIT_CONNECT_SUPPORTED_CHECKOUT_CHAINS_INFO_LIST
|
|
13205
13222
|
} from "@funkit/chains";
|
|
13206
13223
|
import { fallback } from "viem";
|
|
@@ -13897,7 +13914,7 @@ var createDefaultTransports = (chains) => {
|
|
|
13897
13914
|
const transportsObject = {};
|
|
13898
13915
|
for (const chain of chains) {
|
|
13899
13916
|
const key = chain.id;
|
|
13900
|
-
const fallbackRpcs =
|
|
13917
|
+
const fallbackRpcs = FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO13[key]?.fallbackRpcUrls;
|
|
13901
13918
|
if (fallbackRpcs && fallbackRpcs.length > 0) {
|
|
13902
13919
|
transportsObject[key] = fallback([
|
|
13903
13920
|
http(),
|
|
@@ -18287,11 +18304,11 @@ function ConfirmationStep({
|
|
|
18287
18304
|
const uiCustomizations = funkitConfig.uiCustomizations?.confirmationScreen;
|
|
18288
18305
|
const customRecipient = checkoutItem?.initSettings.config.customRecipient;
|
|
18289
18306
|
const showKatanaBridgeAlert = useMemo19(() => {
|
|
18290
|
-
const
|
|
18291
|
-
if (!
|
|
18307
|
+
const relayQuoteMetadata = latestQuote?.baseQuote?.metadata;
|
|
18308
|
+
if (!relayQuoteMetadata) {
|
|
18292
18309
|
return false;
|
|
18293
18310
|
}
|
|
18294
|
-
const { swapImpact, appFeePercent } = extractRelayFeeInfo(
|
|
18311
|
+
const { swapImpact, appFeePercent } = extractRelayFeeInfo(relayQuoteMetadata);
|
|
18295
18312
|
return isKatanaCustomer(funkitConfig.apiKey) && // Don't take totalImpact, just sum swapImpact and appFeePercent
|
|
18296
18313
|
// https://fun-xyz.slack.com/archives/C08PVUDA1M2/p1752179735981389?thread_ts=1752176009.628309&cid=C08PVUDA1M2
|
|
18297
18314
|
swapImpact + appFeePercent > KATANA_BRIDGE_ALERT_THRESHOLD_PERCENT;
|
|
@@ -18508,7 +18525,7 @@ import React164, { useEffect as useEffect37 } from "react";
|
|
|
18508
18525
|
|
|
18509
18526
|
// src/hooks/queries/useMeldCurrencies.ts
|
|
18510
18527
|
import { getMeldSupportedFiat } from "@funkit/api-base";
|
|
18511
|
-
import { useQuery as
|
|
18528
|
+
import { useQuery as useQuery12 } from "@tanstack/react-query";
|
|
18512
18529
|
var getPriority = (currencyCode) => {
|
|
18513
18530
|
if (currencyCode === "USD") {
|
|
18514
18531
|
return 0;
|
|
@@ -18520,7 +18537,7 @@ var getPriority = (currencyCode) => {
|
|
|
18520
18537
|
};
|
|
18521
18538
|
var useMeldCurrencies = (isEnabled = true) => {
|
|
18522
18539
|
const { apiKey } = useFunkitConfig();
|
|
18523
|
-
const query =
|
|
18540
|
+
const query = useQuery12({
|
|
18524
18541
|
queryKey: ["meld", "currencies"],
|
|
18525
18542
|
queryFn: async () => {
|
|
18526
18543
|
if (!apiKey) {
|
|
@@ -18546,7 +18563,7 @@ var useMeldCurrencies = (isEnabled = true) => {
|
|
|
18546
18563
|
|
|
18547
18564
|
// src/hooks/queries/useMeldDefaultCurrency.ts
|
|
18548
18565
|
import { getMeldDefaultFiat } from "@funkit/api-base";
|
|
18549
|
-
import { useQuery as
|
|
18566
|
+
import { useQuery as useQuery13 } from "@tanstack/react-query";
|
|
18550
18567
|
|
|
18551
18568
|
// src/hooks/queries/useMeldCryptoCurrencyCode.ts
|
|
18552
18569
|
import { FlagKey as FlagKey20 } from "@funkit/utils";
|
|
@@ -18592,7 +18609,7 @@ var useMeldDefaultCurrency = (paymentMethod) => {
|
|
|
18592
18609
|
const { apiKey } = useFunkitConfig();
|
|
18593
18610
|
const { userIpInfo } = useFunkitUserIp();
|
|
18594
18611
|
const enableMeld = useIsMeldEnabled();
|
|
18595
|
-
const query =
|
|
18612
|
+
const query = useQuery13({
|
|
18596
18613
|
queryKey: ["meld", "defaultCurrency", paymentMethod],
|
|
18597
18614
|
queryFn: async () => {
|
|
18598
18615
|
if (!apiKey) {
|
|
@@ -18617,13 +18634,13 @@ var useMeldDefaultCurrency = (paymentMethod) => {
|
|
|
18617
18634
|
// src/hooks/queries/useMeldLimits.ts
|
|
18618
18635
|
import { getMeldFiatLimits } from "@funkit/api-base";
|
|
18619
18636
|
import { formatCurrencyAndStringify as formatCurrencyAndStringify6 } from "@funkit/utils";
|
|
18620
|
-
import { useQuery as
|
|
18637
|
+
import { useQuery as useQuery14 } from "@tanstack/react-query";
|
|
18621
18638
|
var useMeldLimits = (isEnabled = true) => {
|
|
18622
18639
|
const { apiKey } = useFunkitConfig();
|
|
18623
18640
|
const { userIpInfo } = useFunkitUserIp();
|
|
18624
18641
|
const cryptoCurrency = useMeldCryptoCurrencyCode();
|
|
18625
18642
|
const countryCode = userIpInfo?.alpha2;
|
|
18626
|
-
const query =
|
|
18643
|
+
const query = useQuery14({
|
|
18627
18644
|
queryKey: ["meld", "limits", countryCode, cryptoCurrency],
|
|
18628
18645
|
queryFn: async () => {
|
|
18629
18646
|
if (!apiKey || !countryCode) {
|
|
@@ -19842,7 +19859,7 @@ var useMeldLink = (sourceAmount, sourceCurrencyCode = "USD") => {
|
|
|
19842
19859
|
|
|
19843
19860
|
// src/modals/CheckoutModal/MeldQuotes/useMeldQuotes.tsx
|
|
19844
19861
|
import { getMeldQuotes } from "@funkit/api-base";
|
|
19845
|
-
import { useQuery as
|
|
19862
|
+
import { useQuery as useQuery15 } from "@tanstack/react-query";
|
|
19846
19863
|
import { useDebounce as useDebounce2 } from "use-debounce";
|
|
19847
19864
|
var DEBOUNCE_DELAY = 500;
|
|
19848
19865
|
var COUNTDOWN_INTERVAL_SEC = 60;
|
|
@@ -19854,7 +19871,7 @@ var useMeldQuotes = (sourceAmount, fiatCurrency) => {
|
|
|
19854
19871
|
const { isAway } = useUserPresence();
|
|
19855
19872
|
const destinationCurrencyCode = useMeldCryptoCurrencyCode();
|
|
19856
19873
|
const sourceCurrencyCode = fiatCurrency || "USD";
|
|
19857
|
-
const query =
|
|
19874
|
+
const query = useQuery15({
|
|
19858
19875
|
queryKey: [
|
|
19859
19876
|
"meld",
|
|
19860
19877
|
"quotes",
|
|
@@ -20965,7 +20982,7 @@ function InputAmount(props) {
|
|
|
20965
20982
|
import React167, { useEffect as useEffect38 } from "react";
|
|
20966
20983
|
|
|
20967
20984
|
// src/domains/wallet.ts
|
|
20968
|
-
import { FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as
|
|
20985
|
+
import { FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO14, dydxChain as dydxChain2 } from "@funkit/chains";
|
|
20969
20986
|
import { isNotNullish as isNotNullish7 } from "@funkit/utils";
|
|
20970
20987
|
import { mainnet as mainnet6, polygon as polygon6 } from "viem/chains";
|
|
20971
20988
|
var ASSETS_LOW_VALUE_THRESHOLD2 = 0.1;
|
|
@@ -21792,12 +21809,12 @@ var NewTokenDepositAlert = ({
|
|
|
21792
21809
|
|
|
21793
21810
|
// src/hooks/useAllowedAssets.ts
|
|
21794
21811
|
import { getAllowedAssets } from "@funkit/api-base";
|
|
21795
|
-
import { useQuery as
|
|
21812
|
+
import { useQuery as useQuery16 } from "@tanstack/react-query";
|
|
21796
21813
|
import { useCallback as useCallback30, useMemo as useMemo26 } from "react";
|
|
21797
21814
|
function useAllowedAssets() {
|
|
21798
21815
|
const { apiKey } = useFunkitConfig();
|
|
21799
21816
|
const isRelayEnabled = useSourceTokenRelayEnabled();
|
|
21800
|
-
const { data: allowedAssets, isLoading } =
|
|
21817
|
+
const { data: allowedAssets, isLoading } = useQuery16({
|
|
21801
21818
|
queryKey: ["getAllowedAssets", apiKey],
|
|
21802
21819
|
queryFn: () => getAllowedAssets({ apiKey, logger }),
|
|
21803
21820
|
refetchOnMount: false,
|
|
@@ -22358,7 +22375,7 @@ var DefiPurchaseSection = ({ config }) => {
|
|
|
22358
22375
|
|
|
22359
22376
|
// src/modals/CheckoutModal/SourceChange/useUpdateSourceAssetForCard.ts
|
|
22360
22377
|
import {
|
|
22361
|
-
FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as
|
|
22378
|
+
FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO15,
|
|
22362
22379
|
dydxChain as dydxChain3,
|
|
22363
22380
|
katanaChain
|
|
22364
22381
|
} from "@funkit/chains";
|
|
@@ -22384,7 +22401,7 @@ var pickSourceAssetForCard = async (checkoutItem, userIpInfo) => {
|
|
|
22384
22401
|
const wethAddrOnTargetChain = (await getTokenAddressBySymbolAndChainId2("weth", moonpayChainId)).toLowerCase();
|
|
22385
22402
|
const isTargetAssetEthOrWeth = [NATIVE_TOKEN, wethAddrOnTargetChain].includes(
|
|
22386
22403
|
checkoutItem.initSettings.config.targetAsset
|
|
22387
|
-
) &&
|
|
22404
|
+
) && FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO15[moonpayChainId]?.nativeCurrency.symbol === "ETH" /* ETH */;
|
|
22388
22405
|
let sourceTokenAddress;
|
|
22389
22406
|
let sourceTokenTicker;
|
|
22390
22407
|
let sourceTokenChainId;
|
|
@@ -28094,7 +28111,7 @@ import {
|
|
|
28094
28111
|
getCheckoutsByUserId as getCheckoutsByUserId2
|
|
28095
28112
|
} from "@funkit/api-base";
|
|
28096
28113
|
import { FlagKey as FlagKey27 } from "@funkit/utils";
|
|
28097
|
-
import { useQuery as
|
|
28114
|
+
import { useQuery as useQuery17 } from "@tanstack/react-query";
|
|
28098
28115
|
var hasCorrectPaymentMethod = (checkout, paymentMethod) => !paymentMethod || checkout.clientMetadata.selectedPaymentMethodInfo?.paymentMethod === paymentMethod;
|
|
28099
28116
|
var isRecent = (checkout, timestampCutoff) => checkout.createdTimeMs > timestampCutoff;
|
|
28100
28117
|
var DEFAULT_NOTIF_CUTOFF = 7 * 24 * 60 * 60 * 1e3;
|
|
@@ -28109,7 +28126,7 @@ var useRecentCheckouts = ({
|
|
|
28109
28126
|
const { isUserLoggedIn, userInfo } = useGeneralWallet();
|
|
28110
28127
|
const { apiKey } = useFunkitConfig();
|
|
28111
28128
|
const { listRefresh } = useCheckoutRefreshInterval();
|
|
28112
|
-
const query =
|
|
28129
|
+
const query = useQuery17({
|
|
28113
28130
|
queryKey: ["checkouts", userInfo.id],
|
|
28114
28131
|
queryFn: async () => {
|
|
28115
28132
|
const checkouts = await getCheckoutsByUserId2({
|
|
@@ -28132,7 +28149,7 @@ var useRecentCheckouts = ({
|
|
|
28132
28149
|
import {
|
|
28133
28150
|
getDirectExecutionsByUserId as getDirectExecutionsByUserId2
|
|
28134
28151
|
} from "@funkit/api-base";
|
|
28135
|
-
import { useQuery as
|
|
28152
|
+
import { useQuery as useQuery18 } from "@tanstack/react-query";
|
|
28136
28153
|
var isRecent2 = (de, timestampCutoff) => de.createdTimeMs > timestampCutoff;
|
|
28137
28154
|
var useRecentDirectExecutions = ({
|
|
28138
28155
|
isVisible
|
|
@@ -28140,7 +28157,7 @@ var useRecentDirectExecutions = ({
|
|
|
28140
28157
|
const { isUserLoggedIn, userInfo } = useGeneralWallet();
|
|
28141
28158
|
const { apiKey } = useFunkitConfig();
|
|
28142
28159
|
const { listRefresh } = useCheckoutRefreshInterval();
|
|
28143
|
-
const query =
|
|
28160
|
+
const query = useQuery18({
|
|
28144
28161
|
queryKey: ["directExecutions", userInfo.id],
|
|
28145
28162
|
queryFn: async () => {
|
|
28146
28163
|
const directExecutions = await getDirectExecutionsByUserId2({
|
|
@@ -28853,11 +28870,11 @@ var FunNotificationBanner = ({
|
|
|
28853
28870
|
import {
|
|
28854
28871
|
getCheckoutByDepositAddress as getCheckoutByDepositAddress2
|
|
28855
28872
|
} from "@funkit/api-base";
|
|
28856
|
-
import { useQuery as
|
|
28873
|
+
import { useQuery as useQuery19 } from "@tanstack/react-query";
|
|
28857
28874
|
var useCheckout = (depositAddress, initial) => {
|
|
28858
28875
|
const { apiKey } = useFunkitConfig();
|
|
28859
28876
|
const { itemRefresh } = useCheckoutRefreshInterval();
|
|
28860
|
-
const query =
|
|
28877
|
+
const query = useQuery19({
|
|
28861
28878
|
queryKey: ["checkouts", "checkout", depositAddress],
|
|
28862
28879
|
queryFn: () => (
|
|
28863
28880
|
// biome-ignore lint/style/noNonNullAssertion: already checked for null
|
|
@@ -31287,7 +31304,7 @@ function setFunkitConnectVersion({ version }) {
|
|
|
31287
31304
|
localStorage.setItem(storageKey5, version);
|
|
31288
31305
|
}
|
|
31289
31306
|
function getCurrentSdkVersion() {
|
|
31290
|
-
return "6.0.
|
|
31307
|
+
return "6.0.4";
|
|
31291
31308
|
}
|
|
31292
31309
|
function useFingerprint() {
|
|
31293
31310
|
const fingerprint = useCallback50(() => {
|