@funkit/connect 9.14.0 → 9.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +34 -0
- package/dist/__generated__/default_configs.d.ts +5 -11
- package/dist/__generated__/default_feature_gates.d.ts +3 -2
- package/dist/clients/aave.d.ts +92 -0
- package/dist/clients/aave.js +156 -0
- package/dist/clients/{chunk-LMEQD56M.js → chunk-PLDXBAAH.js} +2 -1
- package/dist/clients/fanatics.js +1 -1
- package/dist/clients/lighter.d.ts +33 -2
- package/dist/clients/lighter.js +121 -2
- package/dist/clients/polymarket.d.ts +30 -1
- package/dist/clients/polymarket.js +147 -4
- package/dist/components/CopyAddress/CopyInputDisplayedAddress.css.d.ts +1 -0
- package/dist/components/CopyAddress/CopyInputDisplayedAddress.d.ts +6 -0
- package/dist/components/FreeUsdcBanner/FreeUsdcBanner.d.ts +5 -0
- package/dist/consts/polymarket.d.ts +7 -0
- package/dist/domains/quote.d.ts +11 -0
- package/dist/index.css +12 -5
- package/dist/index.js +828 -516
- package/dist/modals/CheckoutModal/InputAmount/InputAmount.d.ts +4 -0
- package/dist/modals/CheckoutModal/InputAmount/aaveClient.d.ts +20 -0
- package/dist/modals/CheckoutModal/InputAmount/useAaveNativeSupply.d.ts +44 -0
- package/dist/modals/WithdrawalModal/WithdrawalSuccess.d.ts +0 -1
- package/dist/modals/WithdrawalModal/useWithdrawal.d.ts +1 -2
- package/dist/providers/FunkitCheckoutContext/index.d.ts +8 -0
- package/dist/providers/FunkitCheckoutContext/types.d.ts +6 -0
- package/dist/wagmi/actions.d.ts +1 -1
- 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 +51 -51
- 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 +10 -5
- package/dist/wallets/walletConnectors/{chunk-VMMROPXK.js → chunk-34HACM5U.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-3ZJN3PXP.js → chunk-5TN5Z2WY.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-OD6B2ISG.js → chunk-6DRCY52E.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-IRHK6SOW.js → chunk-7V33VJAL.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-ZJJWGKB6.js → chunk-APHCF4DT.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-7IEUTLHY.js → chunk-DEFRRPXB.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-OSOB6QYX.js → chunk-FG2LDVXL.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-ZL6XCMV5.js → chunk-HRDPUW3V.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-UYW6MV74.js → chunk-HXWUH73P.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-UFYNHHDU.js → chunk-KWX2SYU2.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-AZYMJ4C6.js → chunk-LCIPVVH5.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-FWM4KTOV.js → chunk-T4ROGPMF.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-J3PJOMO7.js → chunk-UDTBQV4Q.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-55VS2NKG.js → chunk-V6UOWTEZ.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-LEAZMT5Y.js → chunk-VJZWNQOF.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-RZQ4B4Z7.js → chunk-XVBSJCW5.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-IMNI4AGV.js → chunk-YIEASHLS.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-YGMU5VWD.js → chunk-ZPSPK6LH.js} +3 -3
package/dist/index.js
CHANGED
|
@@ -121,13 +121,14 @@ import { createContext } from "react";
|
|
|
121
121
|
import React5, { useEffect, useMemo as useMemo2, useState } from "react";
|
|
122
122
|
|
|
123
123
|
// src/utils/sanitizeUrl.ts
|
|
124
|
+
var SAFE_URL_PROTOCOLS = /* @__PURE__ */ new Set(["https:", "http:"]);
|
|
124
125
|
function sanitizeUrl(url) {
|
|
125
126
|
if (!url) {
|
|
126
127
|
return void 0;
|
|
127
128
|
}
|
|
128
129
|
try {
|
|
129
130
|
const parsed = new URL(url);
|
|
130
|
-
if (
|
|
131
|
+
if (SAFE_URL_PROTOCOLS.has(parsed.protocol)) {
|
|
131
132
|
return parsed.href;
|
|
132
133
|
}
|
|
133
134
|
return void 0;
|
|
@@ -446,7 +447,7 @@ function Avatar({ address, imageUrl, loading, size }) {
|
|
|
446
447
|
}
|
|
447
448
|
|
|
448
449
|
// src/components/ConnectButton/ConnectButton.tsx
|
|
449
|
-
import React292, { useEffect as useEffect78, useState as
|
|
450
|
+
import React292, { useEffect as useEffect78, useState as useState85 } from "react";
|
|
450
451
|
|
|
451
452
|
// src/css/touchableStyles.css.ts
|
|
452
453
|
var active = { shrink: "_7rkubb8", shrinkSm: "_7rkubb9" };
|
|
@@ -1103,9 +1104,9 @@ import {
|
|
|
1103
1104
|
// src/hooks/useIsMainnetConfigured.ts
|
|
1104
1105
|
function useIsMainnetConfigured() {
|
|
1105
1106
|
const funkitConnectChains = useFunkitConnectChains();
|
|
1106
|
-
const
|
|
1107
|
+
const chainId2 = mainnet.id;
|
|
1107
1108
|
const configured = funkitConnectChains.some(
|
|
1108
|
-
(funkitConnectChain) => funkitConnectChain.id ===
|
|
1109
|
+
(funkitConnectChain) => funkitConnectChain.id === chainId2
|
|
1109
1110
|
);
|
|
1110
1111
|
return configured;
|
|
1111
1112
|
}
|
|
@@ -1149,7 +1150,7 @@ import {
|
|
|
1149
1150
|
solanaChain as solanaChain9
|
|
1150
1151
|
} from "@funkit/chains";
|
|
1151
1152
|
import { isTokenAddressEquivalent as isTokenAddressEquivalent6, isTokenEquivalent as isTokenEquivalent9 } from "@funkit/utils";
|
|
1152
|
-
import { arbitrum as arbitrum6, base as base7, mainnet as
|
|
1153
|
+
import { arbitrum as arbitrum6, base as base7, mainnet as mainnet13, optimism as optimism2, polygon as polygon8 } from "viem/chains";
|
|
1153
1154
|
|
|
1154
1155
|
// src/utils/checkout.ts
|
|
1155
1156
|
import {
|
|
@@ -1169,7 +1170,7 @@ import {
|
|
|
1169
1170
|
isTokenEquivalent as isTokenEquivalent8,
|
|
1170
1171
|
round as round3
|
|
1171
1172
|
} from "@funkit/utils";
|
|
1172
|
-
import * as
|
|
1173
|
+
import * as dnum10 from "dnum";
|
|
1173
1174
|
import { erc20Abi as erc20Abi5, formatUnits as formatUnits5, isAddress as isAddress3 } from "viem";
|
|
1174
1175
|
|
|
1175
1176
|
// src/consts/customers.ts
|
|
@@ -1234,6 +1235,7 @@ import {
|
|
|
1234
1235
|
estimateGas,
|
|
1235
1236
|
getGasPrice,
|
|
1236
1237
|
getTransaction,
|
|
1238
|
+
getWalletClient,
|
|
1237
1239
|
multicall,
|
|
1238
1240
|
readContract
|
|
1239
1241
|
} from "wagmi/actions";
|
|
@@ -1246,7 +1248,7 @@ async function getBalance(config, params) {
|
|
|
1246
1248
|
formatted: formatUnits(result.value, result.decimals)
|
|
1247
1249
|
};
|
|
1248
1250
|
}
|
|
1249
|
-
const { address, chainId, ...callOverrides } = rest;
|
|
1251
|
+
const { address, chainId: chainId2, ...callOverrides } = rest;
|
|
1250
1252
|
const [value, decimals, symbol] = await multicallCore(config, {
|
|
1251
1253
|
contracts: [
|
|
1252
1254
|
{
|
|
@@ -1258,7 +1260,7 @@ async function getBalance(config, params) {
|
|
|
1258
1260
|
{ abi: erc20Abi, address: token, functionName: "decimals" },
|
|
1259
1261
|
{ abi: erc20Abi, address: token, functionName: "symbol" }
|
|
1260
1262
|
],
|
|
1261
|
-
chainId,
|
|
1263
|
+
chainId: chainId2,
|
|
1262
1264
|
...callOverrides,
|
|
1263
1265
|
allowFailure: false
|
|
1264
1266
|
});
|
|
@@ -1272,8 +1274,8 @@ async function getBalance(config, params) {
|
|
|
1272
1274
|
|
|
1273
1275
|
// src/providers/FunkitCheckoutContext/index.tsx
|
|
1274
1276
|
import {
|
|
1275
|
-
DirectExecutionType as
|
|
1276
|
-
createDirectExecution,
|
|
1277
|
+
DirectExecutionType as DirectExecutionType5,
|
|
1278
|
+
createDirectExecution as createDirectExecution2,
|
|
1277
1279
|
deactivateCheckout as postApiDeactivateCheckout,
|
|
1278
1280
|
initializeCheckout as postApiInitializeCheckout
|
|
1279
1281
|
} from "@funkit/api-base";
|
|
@@ -1284,10 +1286,10 @@ import {
|
|
|
1284
1286
|
import { isNotNullish as isNotNullish8, isTokenAddressEquivalent as isTokenAddressEquivalent4 } from "@funkit/utils";
|
|
1285
1287
|
import React290, {
|
|
1286
1288
|
createContext as createContext21,
|
|
1287
|
-
useCallback as
|
|
1289
|
+
useCallback as useCallback57,
|
|
1288
1290
|
useContext as useContext21,
|
|
1289
1291
|
useEffect as useEffect77,
|
|
1290
|
-
useState as
|
|
1292
|
+
useState as useState84
|
|
1291
1293
|
} from "react";
|
|
1292
1294
|
import { flushSync as flushSync2 } from "react-dom";
|
|
1293
1295
|
import { v4 as uuid2 } from "uuid";
|
|
@@ -1813,7 +1815,9 @@ var default_configs_default = {
|
|
|
1813
1815
|
"0x1111111254EEB25477B68fb85Ed929f73A960582": "1inch V5 Router",
|
|
1814
1816
|
"0x881D40237659C251811CEC9c364ef91dC08D300C": "Metamask Swap Router",
|
|
1815
1817
|
"0x07d82CD44cd598ACf355Af8c8089b30b2a13B088": "Polymarket Withdrawal Block",
|
|
1816
|
-
"2ygdTkdUtN9PhoMko12bQi6PimJrqxcKmCvQGkCG6SN7": "Polymarket Withdrawal Block"
|
|
1818
|
+
"2ygdTkdUtN9PhoMko12bQi6PimJrqxcKmCvQGkCG6SN7": "Polymarket Withdrawal Block",
|
|
1819
|
+
"0xd40cBF452e8D6c9dF3e8bbE24eA8b65f859Ae34b": "Polymarket Withdrawal Block",
|
|
1820
|
+
GZxiVHg1JM6gCWRG7FwhaD6gPYpcLhiJ21s4ga7Ynfus: "Polymarket Withdrawal Block"
|
|
1817
1821
|
}
|
|
1818
1822
|
},
|
|
1819
1823
|
blockedcountries: {
|
|
@@ -2156,6 +2160,9 @@ var default_configs_default = {
|
|
|
2156
2160
|
enablesourcegrouplabels: {
|
|
2157
2161
|
value: true
|
|
2158
2162
|
},
|
|
2163
|
+
enableswapped: {
|
|
2164
|
+
value: false
|
|
2165
|
+
},
|
|
2159
2166
|
enableswappeddeposit: {
|
|
2160
2167
|
value: false
|
|
2161
2168
|
},
|
|
@@ -2774,23 +2781,6 @@ var default_configs_default = {
|
|
|
2774
2781
|
}
|
|
2775
2782
|
]
|
|
2776
2783
|
},
|
|
2777
|
-
{
|
|
2778
|
-
chainId: 2741,
|
|
2779
|
-
assets: [
|
|
2780
|
-
{
|
|
2781
|
-
address: "0x84A71ccD554Cc1b02749b35d22F684CC8ec987e1"
|
|
2782
|
-
},
|
|
2783
|
-
{
|
|
2784
|
-
address: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE"
|
|
2785
|
-
},
|
|
2786
|
-
{
|
|
2787
|
-
address: "0x3439153EB7AF838Ad19d56E1571FBD09333C2809"
|
|
2788
|
-
},
|
|
2789
|
-
{
|
|
2790
|
-
address: "0x0709F39376dEEe2A2dfC94A58EdEb2Eb9DF012bD"
|
|
2791
|
-
}
|
|
2792
|
-
]
|
|
2793
|
-
},
|
|
2794
2784
|
{
|
|
2795
2785
|
chainId: 5064014,
|
|
2796
2786
|
assets: [
|
|
@@ -3084,7 +3074,7 @@ function setFunkitConnectVersion({ version }) {
|
|
|
3084
3074
|
localStorage.setItem(storageKey, version);
|
|
3085
3075
|
}
|
|
3086
3076
|
function getCurrentSdkVersion() {
|
|
3087
|
-
return "9.
|
|
3077
|
+
return "9.15.0";
|
|
3088
3078
|
}
|
|
3089
3079
|
function useFingerprint() {
|
|
3090
3080
|
const fingerprint = useCallback3(() => {
|
|
@@ -3632,14 +3622,14 @@ var useIsStablecoin = () => {
|
|
|
3632
3622
|
|
|
3633
3623
|
// src/utils/transfer.ts
|
|
3634
3624
|
import { bitcoinChain, solanaChain, tronChain } from "@funkit/chains";
|
|
3635
|
-
function getDepositAddressForChain(
|
|
3636
|
-
if (
|
|
3625
|
+
function getDepositAddressForChain(chainId2, transferInit) {
|
|
3626
|
+
if (chainId2 === solanaChain.id) {
|
|
3637
3627
|
return transferInit?.solanaAddr;
|
|
3638
3628
|
}
|
|
3639
|
-
if (
|
|
3629
|
+
if (chainId2 === bitcoinChain.id) {
|
|
3640
3630
|
return transferInit?.btcAddrSegwit;
|
|
3641
3631
|
}
|
|
3642
|
-
if (
|
|
3632
|
+
if (chainId2 === tronChain.id) {
|
|
3643
3633
|
return transferInit?.tronAddr;
|
|
3644
3634
|
}
|
|
3645
3635
|
return transferInit?.depositAddr;
|
|
@@ -3668,6 +3658,13 @@ import {
|
|
|
3668
3658
|
import { lighterChain } from "@funkit/chains";
|
|
3669
3659
|
import { useQuery as useQuery2 } from "@tanstack/react-query";
|
|
3670
3660
|
|
|
3661
|
+
// src/consts/polymarket.ts
|
|
3662
|
+
import { getAddress } from "viem";
|
|
3663
|
+
var POLYMARKET_PERPS_DEPOSIT_ACTION_TYPE = "POLYMARKET_PERPS_DEPOSIT";
|
|
3664
|
+
var POLYMARKET_PUSD_ADDRESS = getAddress(
|
|
3665
|
+
"0xC011a7E12a19f7B1f670d46F03B03f3342E82DFB"
|
|
3666
|
+
);
|
|
3667
|
+
|
|
3671
3668
|
// src/hooks/useStepQueryReadiness.ts
|
|
3672
3669
|
import { useQueryClient } from "@tanstack/react-query";
|
|
3673
3670
|
import { useCallback as useCallback6, useRef, useState as useState6 } from "react";
|
|
@@ -3874,10 +3871,11 @@ function getCheckoutTokenTransferParams({
|
|
|
3874
3871
|
if (!checkoutConfig.targetChain) {
|
|
3875
3872
|
return;
|
|
3876
3873
|
}
|
|
3874
|
+
const toTokenAddress = checkoutConfig.qrcodeActionType === POLYMARKET_PERPS_DEPOSIT_ACTION_TYPE ? POLYMARKET_PUSD_ADDRESS : checkoutConfig.targetAsset;
|
|
3877
3875
|
return {
|
|
3878
3876
|
...commonParams,
|
|
3879
3877
|
toChainId: checkoutConfig.targetChain,
|
|
3880
|
-
toTokenAddress
|
|
3878
|
+
toTokenAddress
|
|
3881
3879
|
};
|
|
3882
3880
|
}
|
|
3883
3881
|
function useIsQRCodeTransferEnabled() {
|
|
@@ -4037,8 +4035,8 @@ var useTokenTransfer = (selectedChainId, selectedToken, chainIds) => {
|
|
|
4037
4035
|
blockchain: blockchainType
|
|
4038
4036
|
};
|
|
4039
4037
|
};
|
|
4040
|
-
function getMinTransferValueForChain(
|
|
4041
|
-
return limits.chains[String(
|
|
4038
|
+
function getMinTransferValueForChain(chainId2, limits) {
|
|
4039
|
+
return limits.chains[String(chainId2)] ?? limits.default;
|
|
4042
4040
|
}
|
|
4043
4041
|
var useMinTransferValueUsd = (selectedChainId) => {
|
|
4044
4042
|
const limits = useDynamicConfig("mintokentransfervalue");
|
|
@@ -4343,11 +4341,11 @@ function isTronAddress(address) {
|
|
|
4343
4341
|
function isWithdrawalAddressSupported(address) {
|
|
4344
4342
|
return isAddress(address) || isSolanaAddress(address) || isTronAddress(address);
|
|
4345
4343
|
}
|
|
4346
|
-
function isAddressCompatibleWithChain(address,
|
|
4347
|
-
if (
|
|
4344
|
+
function isAddressCompatibleWithChain(address, chainId2) {
|
|
4345
|
+
if (chainId2 === solanaChain3.id) {
|
|
4348
4346
|
return isSolanaAddress(address);
|
|
4349
4347
|
}
|
|
4350
|
-
if (
|
|
4348
|
+
if (chainId2 === tronChain3.id) {
|
|
4351
4349
|
return isTronAddress(address);
|
|
4352
4350
|
}
|
|
4353
4351
|
return isAddress(address);
|
|
@@ -4579,24 +4577,24 @@ import {
|
|
|
4579
4577
|
|
|
4580
4578
|
// src/utils/combineChainSymbolOrAddress.ts
|
|
4581
4579
|
function combineChainSymbolOrAddress({
|
|
4582
|
-
chainId,
|
|
4580
|
+
chainId: chainId2,
|
|
4583
4581
|
symbolOrAddress
|
|
4584
4582
|
}) {
|
|
4585
|
-
return `${
|
|
4583
|
+
return `${chainId2}|${symbolOrAddress}`;
|
|
4586
4584
|
}
|
|
4587
4585
|
|
|
4588
4586
|
// src/utils/bluvo.ts
|
|
4589
4587
|
var ASSETS_LOW_VALUE_THRESHOLD = 0.1;
|
|
4590
4588
|
var isBrokerageAsset = (asset) => "minAmount" in asset && "maxAmount" in asset && asset.usdAmount !== null;
|
|
4591
4589
|
function getBrokerageMinMax(asset, minTransferLimits, minDeposit = 1) {
|
|
4592
|
-
const
|
|
4590
|
+
const chainId2 = Number(asset.pickedChainId);
|
|
4593
4591
|
const unitPrice = asset.usdAmount / asset.amount;
|
|
4594
4592
|
const brokerageMin = Number.parseFloat(asset.minAmount);
|
|
4595
4593
|
const brokerageMax = Number.parseFloat(asset.maxAmount);
|
|
4596
4594
|
const brokerageMinUsd = brokerageMin * unitPrice;
|
|
4597
4595
|
const brokerageMaxUsd = brokerageMax * unitPrice;
|
|
4598
4596
|
const tokenTransferMin = getMinTransferValueForChain(
|
|
4599
|
-
|
|
4597
|
+
chainId2,
|
|
4600
4598
|
minTransferLimits
|
|
4601
4599
|
);
|
|
4602
4600
|
return {
|
|
@@ -4606,7 +4604,7 @@ function getBrokerageMinMax(asset, minTransferLimits, minDeposit = 1) {
|
|
|
4606
4604
|
}
|
|
4607
4605
|
function getPreferredNetwork(networks, targetChainId) {
|
|
4608
4606
|
let preferredChainId = targetChainId;
|
|
4609
|
-
const validNetworks = networks.filter(({ chainId }) => !!
|
|
4607
|
+
const validNetworks = networks.filter(({ chainId: chainId2 }) => !!chainId2);
|
|
4610
4608
|
const networkMap = Object.fromEntries(
|
|
4611
4609
|
validNetworks.map((n) => [n.chainId?.toString(), n])
|
|
4612
4610
|
);
|
|
@@ -4628,12 +4626,12 @@ function getPreferredNetwork(networks, targetChainId) {
|
|
|
4628
4626
|
}
|
|
4629
4627
|
let pickedNetwork = validNetworks[0];
|
|
4630
4628
|
let lowestPriority = Number.MAX_SAFE_INTEGER;
|
|
4631
|
-
for (const
|
|
4632
|
-
const chainInfo = FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO[
|
|
4629
|
+
for (const chainId2 of Object.keys(networkMap)) {
|
|
4630
|
+
const chainInfo = FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO[chainId2];
|
|
4633
4631
|
const pickPriority = chainInfo?.pickPriority || Number.MAX_SAFE_INTEGER;
|
|
4634
4632
|
if (pickPriority < lowestPriority) {
|
|
4635
4633
|
lowestPriority = pickPriority;
|
|
4636
|
-
pickedNetwork = networkMap[
|
|
4634
|
+
pickedNetwork = networkMap[chainId2];
|
|
4637
4635
|
}
|
|
4638
4636
|
}
|
|
4639
4637
|
return pickedNetwork ?? null;
|
|
@@ -4659,8 +4657,8 @@ function transformBluvoBalancesToAssetHoldings(balances, preferredChainId) {
|
|
|
4659
4657
|
const preferredNetwork = getPreferredNetwork(networks, preferredChainId);
|
|
4660
4658
|
const asset = preferredNetwork?.assetName;
|
|
4661
4659
|
const tokenAddress = preferredNetwork?.contractAddress;
|
|
4662
|
-
const
|
|
4663
|
-
if (!
|
|
4660
|
+
const chainId2 = preferredNetwork?.chainId;
|
|
4661
|
+
if (!chainId2 || !tokenAddress || !asset) {
|
|
4664
4662
|
logger.warn(`${LOG_PREFIX}:invalidNetwork`, {
|
|
4665
4663
|
message: `Invalid network for checkout ${balance.asset}`,
|
|
4666
4664
|
balance,
|
|
@@ -4668,11 +4666,11 @@ function transformBluvoBalancesToAssetHoldings(balances, preferredChainId) {
|
|
|
4668
4666
|
});
|
|
4669
4667
|
continue;
|
|
4670
4668
|
}
|
|
4671
|
-
const chainInfo = FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO[
|
|
4669
|
+
const chainInfo = FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO[chainId2];
|
|
4672
4670
|
if (!chainInfo?.isCheckoutSupported || !chainInfo?.isMainnet) {
|
|
4673
4671
|
logger.warn(`${LOG_PREFIX}:unsupportedAsset`, {
|
|
4674
|
-
message: `Unsupported asset for checkout ${
|
|
4675
|
-
chainId,
|
|
4672
|
+
message: `Unsupported asset for checkout ${chainId2}|${asset}`,
|
|
4673
|
+
chainId: chainId2,
|
|
4676
4674
|
asset,
|
|
4677
4675
|
preferredNetwork
|
|
4678
4676
|
});
|
|
@@ -4680,8 +4678,8 @@ function transformBluvoBalancesToAssetHoldings(balances, preferredChainId) {
|
|
|
4680
4678
|
}
|
|
4681
4679
|
if (!tokenAddress) {
|
|
4682
4680
|
logger.warn(`${LOG_PREFIX}:invalidTokenAddress`, {
|
|
4683
|
-
message: `Invalid token address for ${
|
|
4684
|
-
chainId,
|
|
4681
|
+
message: `Invalid token address for ${chainId2}|${asset}`,
|
|
4682
|
+
chainId: chainId2,
|
|
4685
4683
|
asset,
|
|
4686
4684
|
preferredNetwork
|
|
4687
4685
|
});
|
|
@@ -4689,8 +4687,8 @@ function transformBluvoBalancesToAssetHoldings(balances, preferredChainId) {
|
|
|
4689
4687
|
}
|
|
4690
4688
|
if (!amountInFiat || amountInFiat < ASSETS_LOW_VALUE_THRESHOLD) {
|
|
4691
4689
|
logger.warn(`${LOG_PREFIX}:assetBelowThreshold`, {
|
|
4692
|
-
message: `Asset below threshold ${
|
|
4693
|
-
chainId,
|
|
4690
|
+
message: `Asset below threshold ${chainId2}|${asset}. Amount in fiat: ${amountInFiat}`,
|
|
4691
|
+
chainId: chainId2,
|
|
4694
4692
|
asset,
|
|
4695
4693
|
amountInFiat,
|
|
4696
4694
|
preferredNetwork
|
|
@@ -4700,7 +4698,7 @@ function transformBluvoBalancesToAssetHoldings(balances, preferredChainId) {
|
|
|
4700
4698
|
const isNativeCurrency = chainInfo.nativeCurrency.symbol.toUpperCase() === asset.toUpperCase();
|
|
4701
4699
|
const normalizedTokenAddress = isNativeCurrency ? FUNKIT_CONNECT_CHECKOUT_NATIVE_CURRENCY_ADDRESS2 : tokenAddress;
|
|
4702
4700
|
const chainSymbolKey = combineChainSymbolOrAddress({
|
|
4703
|
-
chainId:
|
|
4701
|
+
chainId: chainId2.toString(),
|
|
4704
4702
|
symbolOrAddress: asset
|
|
4705
4703
|
});
|
|
4706
4704
|
const iconSrc = ASSET_LOGO_SRCS[asset.toUpperCase()] || FALLBACK_ASSET;
|
|
@@ -4710,7 +4708,7 @@ function transformBluvoBalancesToAssetHoldings(balances, preferredChainId) {
|
|
|
4710
4708
|
amount,
|
|
4711
4709
|
tokenAddress: normalizedTokenAddress,
|
|
4712
4710
|
usdAmount: amountInFiat,
|
|
4713
|
-
pickedChainId:
|
|
4711
|
+
pickedChainId: chainId2.toString(),
|
|
4714
4712
|
chainSymbolKey,
|
|
4715
4713
|
minAmount: preferredNetwork.minWithdrawal,
|
|
4716
4714
|
maxAmount: preferredNetwork.maxWithdrawal || amount.toString(),
|
|
@@ -4964,11 +4962,11 @@ import {
|
|
|
4964
4962
|
hyperCoreChain as hyperCoreChain2
|
|
4965
4963
|
} from "@funkit/chains";
|
|
4966
4964
|
import { ResourceNotFoundError } from "@funkit/utils";
|
|
4967
|
-
var findBridgeSupportedChain = (
|
|
4968
|
-
if (
|
|
4965
|
+
var findBridgeSupportedChain = (chainId2) => {
|
|
4966
|
+
if (chainId2 === hyperCoreChain2.id.toString()) {
|
|
4969
4967
|
return "arbitrum";
|
|
4970
4968
|
}
|
|
4971
|
-
const chainName = FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO2[
|
|
4969
|
+
const chainName = FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO2[chainId2]?.name.toLowerCase();
|
|
4972
4970
|
if (createBridgeBankAccountRequestChainNames.includes(chainName)) {
|
|
4973
4971
|
return chainName;
|
|
4974
4972
|
}
|
|
@@ -5354,21 +5352,21 @@ function useAllowedAssets({
|
|
|
5354
5352
|
return {};
|
|
5355
5353
|
}
|
|
5356
5354
|
const ret = {};
|
|
5357
|
-
for (const
|
|
5358
|
-
const tokens2 = allowedAssets[
|
|
5359
|
-
ret[
|
|
5355
|
+
for (const chainId2 of Object.keys(allowedAssets)) {
|
|
5356
|
+
const tokens2 = allowedAssets[chainId2] ?? [];
|
|
5357
|
+
ret[chainId2] = new Set(tokens2.map((token) => token.toLowerCase()));
|
|
5360
5358
|
}
|
|
5361
5359
|
return ret;
|
|
5362
5360
|
}, [allowedAssets]);
|
|
5363
5361
|
const isAllowed = useCallback8(
|
|
5364
|
-
(
|
|
5362
|
+
(chainId2, tokenAddress) => {
|
|
5365
5363
|
const disabledByCustomerList = checkoutItem?.initSettings.config.disabledSourceTokens?.some(
|
|
5366
5364
|
(token) => {
|
|
5367
|
-
return token.tokenChainId === String(
|
|
5365
|
+
return token.tokenChainId === String(chainId2) && token.tokenAddress.toLowerCase() === tokenAddress.toLowerCase();
|
|
5368
5366
|
}
|
|
5369
5367
|
);
|
|
5370
5368
|
return Boolean(
|
|
5371
|
-
!disabledByCustomerList && tokens[
|
|
5369
|
+
!disabledByCustomerList && tokens[chainId2]?.has(tokenAddress.toLowerCase())
|
|
5372
5370
|
);
|
|
5373
5371
|
},
|
|
5374
5372
|
[tokens, checkoutItem?.initSettings.config.disabledSourceTokens]
|
|
@@ -6426,7 +6424,7 @@ var useFeatureGate = (name) => {
|
|
|
6426
6424
|
import { DirectExecutionType, getCheckoutQuoteV2 } from "@funkit/api-base";
|
|
6427
6425
|
import { executeRelayQuote, shouldResetApproval } from "@funkit/fun-relay";
|
|
6428
6426
|
import { useCallback as useCallback11 } from "react";
|
|
6429
|
-
import { decodeFunctionData, erc20Abi as erc20Abi2, getAddress } from "viem";
|
|
6427
|
+
import { decodeFunctionData, erc20Abi as erc20Abi2, getAddress as getAddress2 } from "viem";
|
|
6430
6428
|
import { readContract as readContract2 } from "viem/actions";
|
|
6431
6429
|
|
|
6432
6430
|
// src/consts/checkout.ts
|
|
@@ -6496,32 +6494,32 @@ function getLzOftDestinationChain(de) {
|
|
|
6496
6494
|
return lzChainEnum && lzOftChainEnumToChainId[lzChainEnum]?.toString();
|
|
6497
6495
|
}
|
|
6498
6496
|
function getCompletionTxInfo(directExecution) {
|
|
6499
|
-
const
|
|
6497
|
+
const chainId2 = getLzOftDestinationChain(directExecution) ?? directExecution.toChainId;
|
|
6500
6498
|
const listenerInfoTxHashes = directExecution.listenerInfo?.txHashes || [];
|
|
6501
6499
|
const defaultTxHash = listenerInfoTxHashes[listenerInfoTxHashes.length - 1] ?? directExecution.toTxId;
|
|
6502
6500
|
const lighterHash = directExecution.listenerInfo?.lighterExecutionStatusResponse?.hash;
|
|
6503
6501
|
if (lighterHash) {
|
|
6504
6502
|
return {
|
|
6505
|
-
chainId,
|
|
6503
|
+
chainId: chainId2,
|
|
6506
6504
|
txHash: lighterHash,
|
|
6507
6505
|
customRedirectUrl: `https://app.lighter.xyz/explorer/logs/${lighterHash}`
|
|
6508
6506
|
};
|
|
6509
6507
|
}
|
|
6510
6508
|
return {
|
|
6511
|
-
chainId,
|
|
6509
|
+
chainId: chainId2,
|
|
6512
6510
|
txHash: defaultTxHash,
|
|
6513
6511
|
customRedirectUrl: void 0
|
|
6514
6512
|
};
|
|
6515
6513
|
}
|
|
6516
6514
|
var GET_CAPABILITIES_TIMEOUT_MS = 2e3;
|
|
6517
|
-
async function getCapabilitiesWithTimeout(wallet,
|
|
6515
|
+
async function getCapabilitiesWithTimeout(wallet, chainId2) {
|
|
6518
6516
|
if (!wallet.account) {
|
|
6519
6517
|
return null;
|
|
6520
6518
|
}
|
|
6521
6519
|
let timer;
|
|
6522
6520
|
try {
|
|
6523
6521
|
return await Promise.race([
|
|
6524
|
-
wallet.getCapabilities({ account: wallet.account, chainId }),
|
|
6522
|
+
wallet.getCapabilities({ account: wallet.account, chainId: chainId2 }),
|
|
6525
6523
|
new Promise((resolve) => {
|
|
6526
6524
|
timer = setTimeout(() => resolve(null), GET_CAPABILITIES_TIMEOUT_MS);
|
|
6527
6525
|
})
|
|
@@ -6532,15 +6530,15 @@ async function getCapabilitiesWithTimeout(wallet, chainId) {
|
|
|
6532
6530
|
clearTimeout(timer);
|
|
6533
6531
|
}
|
|
6534
6532
|
}
|
|
6535
|
-
async function needsOverrideAtomicBatch(wallet,
|
|
6536
|
-
const capabilities = await getCapabilitiesWithTimeout(wallet,
|
|
6533
|
+
async function needsOverrideAtomicBatch(wallet, chainId2) {
|
|
6534
|
+
const capabilities = await getCapabilitiesWithTimeout(wallet, chainId2);
|
|
6537
6535
|
if (!capabilities) {
|
|
6538
6536
|
return true;
|
|
6539
6537
|
}
|
|
6540
6538
|
return capabilities.atomicBatch?.supported ?? capabilities.atomic?.status === "supported";
|
|
6541
6539
|
}
|
|
6542
|
-
async function disableAtomicBatchIfSupported(wallet,
|
|
6543
|
-
const needsOverride = await needsOverrideAtomicBatch(wallet,
|
|
6540
|
+
async function disableAtomicBatchIfSupported(wallet, chainId2) {
|
|
6541
|
+
const needsOverride = await needsOverrideAtomicBatch(wallet, chainId2);
|
|
6544
6542
|
if (!needsOverride) {
|
|
6545
6543
|
return wallet;
|
|
6546
6544
|
}
|
|
@@ -6550,7 +6548,7 @@ async function disableAtomicBatchIfSupported(wallet, chainId) {
|
|
|
6550
6548
|
return async (params) => {
|
|
6551
6549
|
const capabilities = await getCapabilitiesWithTimeout(
|
|
6552
6550
|
target,
|
|
6553
|
-
params?.chainId ??
|
|
6551
|
+
params?.chainId ?? chainId2
|
|
6554
6552
|
);
|
|
6555
6553
|
return {
|
|
6556
6554
|
...capabilities,
|
|
@@ -6768,7 +6766,7 @@ function useCheckoutDirectExecution() {
|
|
|
6768
6766
|
async (relayQuote) => {
|
|
6769
6767
|
try {
|
|
6770
6768
|
const currencyInMetadata = relayQuote.details?.currencyIn?.currency;
|
|
6771
|
-
const currencyInAddress = currencyInMetadata?.address ?
|
|
6769
|
+
const currencyInAddress = currencyInMetadata?.address ? getAddress2(currencyInMetadata.address) : void 0;
|
|
6772
6770
|
const approveAction = relayQuote.steps.find(
|
|
6773
6771
|
(step) => currencyInAddress && step.id === "approve" && step.items[0]?.data && step.items[0].data.to.toLowerCase() === currencyInAddress.toLowerCase()
|
|
6774
6772
|
);
|
|
@@ -6904,18 +6902,18 @@ function useCheckoutDirectExecution() {
|
|
|
6904
6902
|
"unsupported operation in withdrawal modal"
|
|
6905
6903
|
);
|
|
6906
6904
|
},
|
|
6907
|
-
handleSendTransactionStep: async (
|
|
6905
|
+
handleSendTransactionStep: async (chainId2, step) => {
|
|
6908
6906
|
const stepData = step.data;
|
|
6909
|
-
return withdrawalClient.sendTransaction(
|
|
6907
|
+
return withdrawalClient.sendTransaction(chainId2, {
|
|
6910
6908
|
to: stepData.to,
|
|
6911
6909
|
value: stepData.value,
|
|
6912
6910
|
data: stepData.data
|
|
6913
6911
|
});
|
|
6914
6912
|
},
|
|
6915
|
-
handleConfirmTransactionStep: async (txHash,
|
|
6913
|
+
handleConfirmTransactionStep: async (txHash, chainId2) => {
|
|
6916
6914
|
return withdrawalClient.confirmTransaction(
|
|
6917
6915
|
txHash,
|
|
6918
|
-
|
|
6916
|
+
chainId2
|
|
6919
6917
|
);
|
|
6920
6918
|
},
|
|
6921
6919
|
switchChain: async () => {
|
|
@@ -6929,12 +6927,12 @@ function useCheckoutDirectExecution() {
|
|
|
6929
6927
|
// into one user signature via relay-kit's batched step.
|
|
6930
6928
|
...withdrawalClient.sendTransactions ? {
|
|
6931
6929
|
supportsAtomicBatch: async () => true,
|
|
6932
|
-
handleBatchTransactionStep: async (
|
|
6930
|
+
handleBatchTransactionStep: async (chainId2, items) => {
|
|
6933
6931
|
if (!withdrawalClient.sendTransactions) {
|
|
6934
6932
|
logger.error(
|
|
6935
6933
|
"handleBatchTransactionStep:error:sendTransactionsMissing",
|
|
6936
6934
|
{
|
|
6937
|
-
chainId,
|
|
6935
|
+
chainId: chainId2,
|
|
6938
6936
|
address: withdrawalClient.address(),
|
|
6939
6937
|
itemsCount: items.length,
|
|
6940
6938
|
itemsTo: items.map((item) => item.data.to),
|
|
@@ -6947,7 +6945,7 @@ function useCheckoutDirectExecution() {
|
|
|
6947
6945
|
"sendTransactions is not supported"
|
|
6948
6946
|
);
|
|
6949
6947
|
}
|
|
6950
|
-
return withdrawalClient.sendTransactions(
|
|
6948
|
+
return withdrawalClient.sendTransactions(chainId2, [
|
|
6951
6949
|
...consumePendingPreTxs(),
|
|
6952
6950
|
...items.map((item) => ({
|
|
6953
6951
|
to: item.data.to,
|
|
@@ -6961,7 +6959,7 @@ function useCheckoutDirectExecution() {
|
|
|
6961
6959
|
// path (we report `supportsAtomicBatch: true`). If it
|
|
6962
6960
|
// does anyway, route through `sendTransactions` so the
|
|
6963
6961
|
// pre-withdrawal txs are not silently dropped.
|
|
6964
|
-
handleSendTransactionStep: async (
|
|
6962
|
+
handleSendTransactionStep: async (chainId2, step) => {
|
|
6965
6963
|
const stepData = step.data;
|
|
6966
6964
|
const tx = {
|
|
6967
6965
|
to: stepData.to,
|
|
@@ -6972,7 +6970,7 @@ function useCheckoutDirectExecution() {
|
|
|
6972
6970
|
logger.error(
|
|
6973
6971
|
"handleSendTransactionStep:error:sendTransactionsMissing",
|
|
6974
6972
|
{
|
|
6975
|
-
chainId,
|
|
6973
|
+
chainId: chainId2,
|
|
6976
6974
|
address: withdrawalClient.address(),
|
|
6977
6975
|
tx,
|
|
6978
6976
|
typeofSendTransactions: typeof withdrawalClient.sendTransactions,
|
|
@@ -6984,7 +6982,7 @@ function useCheckoutDirectExecution() {
|
|
|
6984
6982
|
"sendTransactions is not supported"
|
|
6985
6983
|
);
|
|
6986
6984
|
}
|
|
6987
|
-
return withdrawalClient.sendTransactions(
|
|
6985
|
+
return withdrawalClient.sendTransactions(chainId2, [
|
|
6988
6986
|
...consumePendingPreTxs(),
|
|
6989
6987
|
tx
|
|
6990
6988
|
]);
|
|
@@ -7558,11 +7556,11 @@ var useFunkitPostCheckoutInternal = (checkoutId) => {
|
|
|
7558
7556
|
// src/providers/ModalContext.tsx
|
|
7559
7557
|
import React289, {
|
|
7560
7558
|
createContext as createContext20,
|
|
7561
|
-
useCallback as
|
|
7559
|
+
useCallback as useCallback56,
|
|
7562
7560
|
useContext as useContext20,
|
|
7563
7561
|
useEffect as useEffect76,
|
|
7564
7562
|
useMemo as useMemo66,
|
|
7565
|
-
useState as
|
|
7563
|
+
useState as useState83
|
|
7566
7564
|
} from "react";
|
|
7567
7565
|
|
|
7568
7566
|
// src/components/Dialog/Dialog.css.ts
|
|
@@ -7580,7 +7578,12 @@ var topbarOverflowContent = "_1r8f576 _1rsrm2fpw _1rsrm2frw";
|
|
|
7580
7578
|
|
|
7581
7579
|
// src/modals/WithdrawalModal/WithdrawalModal.tsx
|
|
7582
7580
|
import React145, { useCallback as useCallback27, useEffect as useEffect44, useState as useState43 } from "react";
|
|
7583
|
-
import { mainnet as
|
|
7581
|
+
import { mainnet as mainnet9 } from "viem/chains";
|
|
7582
|
+
|
|
7583
|
+
// src/components/FreeUsdcBanner/FreeUsdcBanner.tsx
|
|
7584
|
+
function FreeUsdcBanner(_props) {
|
|
7585
|
+
return null;
|
|
7586
|
+
}
|
|
7584
7587
|
|
|
7585
7588
|
// src/components/FunCheckoutHistory/useCustomStatusAnimationAboveTopbar.tsx
|
|
7586
7589
|
import { clamp } from "@funkit/utils";
|
|
@@ -8878,8 +8881,8 @@ function extractStartTimeMs(historyCheckoutItemId, activeCheckoutItem, { created
|
|
|
8878
8881
|
import React36, { useEffect as useEffect14, useState as useState16 } from "react";
|
|
8879
8882
|
|
|
8880
8883
|
// src/utils/lighter.ts
|
|
8881
|
-
import { getAddress as
|
|
8882
|
-
var LIGHTER_DEPOSIT_ADDRESS =
|
|
8884
|
+
import { getAddress as getAddress3 } from "viem";
|
|
8885
|
+
var LIGHTER_DEPOSIT_ADDRESS = getAddress3(
|
|
8883
8886
|
"0x3b4d794a66304f130a4db8f2551b0070dfcf5ca7"
|
|
8884
8887
|
);
|
|
8885
8888
|
var LIGHTER_SLOW_DEPOSIT_TIME_ESTIMATE_SECONDS = 60 * 2;
|
|
@@ -11288,6 +11291,7 @@ var en_default = {
|
|
|
11288
11291
|
close: "Close",
|
|
11289
11292
|
done: "Done",
|
|
11290
11293
|
copyAddress: "Copy address",
|
|
11294
|
+
copyInvoice: "Copy invoice",
|
|
11291
11295
|
copy: "Copy",
|
|
11292
11296
|
copied: "Copied",
|
|
11293
11297
|
auto: "Auto",
|
|
@@ -11853,6 +11857,7 @@ var es_default = {
|
|
|
11853
11857
|
close: "Cerrar",
|
|
11854
11858
|
done: "Listo",
|
|
11855
11859
|
copyAddress: "Copiar direcci\xF3n",
|
|
11860
|
+
copyInvoice: "Copiar solicitud de pago",
|
|
11856
11861
|
copy: "Copiar",
|
|
11857
11862
|
copied: "Copiado",
|
|
11858
11863
|
auto: "Auto",
|
|
@@ -12414,6 +12419,7 @@ var fr_default = {
|
|
|
12414
12419
|
close: "Fermer",
|
|
12415
12420
|
done: "Termin\xE9",
|
|
12416
12421
|
copyAddress: "Copier l'adresse",
|
|
12422
|
+
copyInvoice: "Copier la demande de paiement",
|
|
12417
12423
|
copy: "Copier",
|
|
12418
12424
|
copied: "Copi\xE9e",
|
|
12419
12425
|
auto: "Auto",
|
|
@@ -12975,6 +12981,7 @@ var ja_default = {
|
|
|
12975
12981
|
close: "\u9589\u3058\u308B",
|
|
12976
12982
|
done: "\u5B8C\u4E86",
|
|
12977
12983
|
copyAddress: "\u30A2\u30C9\u30EC\u30B9\u3092\u30B3\u30D4\u30FC",
|
|
12984
|
+
copyInvoice: "\u652F\u6255\u3044\u30EA\u30AF\u30A8\u30B9\u30C8\u3092\u30B3\u30D4\u30FC",
|
|
12978
12985
|
copy: "\u30B3\u30D4\u30FC",
|
|
12979
12986
|
copied: "\u30B3\u30D4\u30FC\u3057\u307E\u3057\u305F",
|
|
12980
12987
|
auto: "\u81EA\u52D5",
|
|
@@ -13536,6 +13543,7 @@ var ko_default = {
|
|
|
13536
13543
|
close: "\uB2EB\uAE30",
|
|
13537
13544
|
done: "\uC644\uB8CC",
|
|
13538
13545
|
copyAddress: "\uC8FC\uC18C \uBCF5\uC0AC",
|
|
13546
|
+
copyInvoice: "\uC778\uBCF4\uC774\uC2A4 \uBCF5\uC0AC",
|
|
13539
13547
|
copy: "\uBCF5\uC0AC",
|
|
13540
13548
|
copied: "\uBCF5\uC0AC\uB428",
|
|
13541
13549
|
auto: "\uC790\uB3D9",
|
|
@@ -14097,6 +14105,7 @@ var ru_default = {
|
|
|
14097
14105
|
close: "\u0417\u0430\u043A\u0440\u044B\u0442\u044C",
|
|
14098
14106
|
done: "\u0413\u043E\u0442\u043E\u0432\u043E",
|
|
14099
14107
|
copyAddress: "\u0421\u043A\u043E\u043F\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u0430\u0434\u0440\u0435\u0441",
|
|
14108
|
+
copyInvoice: "\u0421\u043A\u043E\u043F\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u0437\u0430\u043F\u0440\u043E\u0441 \u043D\u0430 \u043E\u043F\u043B\u0430\u0442\u0443",
|
|
14100
14109
|
copy: "\u041A\u043E\u043F\u0438\u0440\u043E\u0432\u0430\u0442\u044C",
|
|
14101
14110
|
copied: "\u0421\u043A\u043E\u043F\u0438\u0440\u043E\u0432\u0430\u043D\u043E",
|
|
14102
14111
|
auto: "\u0410\u0432\u0442\u043E",
|
|
@@ -14658,6 +14667,7 @@ var tr_default = {
|
|
|
14658
14667
|
close: "Kapat",
|
|
14659
14668
|
done: "Tamam",
|
|
14660
14669
|
copyAddress: "Adresi kopyala",
|
|
14670
|
+
copyInvoice: "\xD6deme talebini kopyala",
|
|
14661
14671
|
copy: "Kopyala",
|
|
14662
14672
|
copied: "Kopyaland\u0131",
|
|
14663
14673
|
auto: "Otomatik",
|
|
@@ -15219,6 +15229,7 @@ var zh_default = {
|
|
|
15219
15229
|
close: "\u5173\u95ED",
|
|
15220
15230
|
done: "\u5B8C\u6210",
|
|
15221
15231
|
copyAddress: "\u590D\u5236\u5730\u5740",
|
|
15232
|
+
copyInvoice: "\u590D\u5236\u4ED8\u6B3E\u8BF7\u6C42",
|
|
15222
15233
|
copy: "\u590D\u5236",
|
|
15223
15234
|
copied: "\u5DF2\u590D\u5236",
|
|
15224
15235
|
auto: "\u81EA\u52A8",
|
|
@@ -15824,9 +15835,9 @@ var useBluvoCheckoutQuote = () => {
|
|
|
15824
15835
|
async function getBluvoCheckoutQuote({
|
|
15825
15836
|
amount,
|
|
15826
15837
|
symbol,
|
|
15827
|
-
chainId
|
|
15838
|
+
chainId: chainId2
|
|
15828
15839
|
}) {
|
|
15829
|
-
if (!
|
|
15840
|
+
if (!chainId2 || !symbol || !amount) {
|
|
15830
15841
|
return;
|
|
15831
15842
|
}
|
|
15832
15843
|
if (!transferInit?.depositAddr) {
|
|
@@ -15837,7 +15848,7 @@ var useBluvoCheckoutQuote = () => {
|
|
|
15837
15848
|
return;
|
|
15838
15849
|
}
|
|
15839
15850
|
const availableTokenAmount = selectedBrokerageAsset?.amount || 0;
|
|
15840
|
-
const chainInfo = FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO5[
|
|
15851
|
+
const chainInfo = FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO5[chainId2];
|
|
15841
15852
|
if (bluvoClient.state) {
|
|
15842
15853
|
bluvoClient.state.type = "quote:ready";
|
|
15843
15854
|
}
|
|
@@ -19224,11 +19235,11 @@ var normalizePath = (path) => {
|
|
|
19224
19235
|
return path.startsWith("/") ? path.slice(1) : path;
|
|
19225
19236
|
};
|
|
19226
19237
|
var AddressRedirectButton = ({
|
|
19227
|
-
chainId,
|
|
19238
|
+
chainId: chainId2,
|
|
19228
19239
|
address,
|
|
19229
19240
|
customRedirectUrl
|
|
19230
19241
|
}) => {
|
|
19231
|
-
const explorerInfo = FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO7[
|
|
19242
|
+
const explorerInfo = FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO7[chainId2]?.explorerInfo;
|
|
19232
19243
|
const addressPath = normalizePath(explorerInfo?.path?.address || "address");
|
|
19233
19244
|
return /* @__PURE__ */ React68.createElement(
|
|
19234
19245
|
FunRedirectButton,
|
|
@@ -19239,11 +19250,11 @@ var AddressRedirectButton = ({
|
|
|
19239
19250
|
);
|
|
19240
19251
|
};
|
|
19241
19252
|
var TransactionRedirectButton = ({
|
|
19242
|
-
chainId,
|
|
19253
|
+
chainId: chainId2,
|
|
19243
19254
|
txHash,
|
|
19244
19255
|
customRedirectUrl
|
|
19245
19256
|
}) => {
|
|
19246
|
-
const explorerInfo = FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO7[
|
|
19257
|
+
const explorerInfo = FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO7[chainId2]?.explorerInfo;
|
|
19247
19258
|
const txPath = normalizePath(explorerInfo?.path?.tx || "tx");
|
|
19248
19259
|
return /* @__PURE__ */ React68.createElement(
|
|
19249
19260
|
FunRedirectButton,
|
|
@@ -21128,10 +21139,10 @@ var useSwappedExchanges = () => {
|
|
|
21128
21139
|
}
|
|
21129
21140
|
const targets = [];
|
|
21130
21141
|
if (transferInit.depositAddr) {
|
|
21131
|
-
for (const { chainId, address } of EVM_USDC_TARGETS) {
|
|
21142
|
+
for (const { chainId: chainId2, address } of EVM_USDC_TARGETS) {
|
|
21132
21143
|
targets.push({
|
|
21133
21144
|
recipientAddress: transferInit.depositAddr,
|
|
21134
|
-
destinationToken: { chainId, address }
|
|
21145
|
+
destinationToken: { chainId: chainId2, address }
|
|
21135
21146
|
});
|
|
21136
21147
|
}
|
|
21137
21148
|
}
|
|
@@ -21282,21 +21293,21 @@ function useSupportedAssets(options) {
|
|
|
21282
21293
|
|
|
21283
21294
|
// src/utils/tokenTransfer/disabledList.ts
|
|
21284
21295
|
import { isTokenAddressEquivalent } from "@funkit/utils";
|
|
21285
|
-
function isChainDisabled(disabledConfig,
|
|
21296
|
+
function isChainDisabled(disabledConfig, chainId2) {
|
|
21286
21297
|
if (!disabledConfig) {
|
|
21287
21298
|
return false;
|
|
21288
21299
|
}
|
|
21289
|
-
const disabledTokens = disabledConfig[String(
|
|
21300
|
+
const disabledTokens = disabledConfig[String(chainId2)];
|
|
21290
21301
|
if (!disabledTokens) {
|
|
21291
21302
|
return false;
|
|
21292
21303
|
}
|
|
21293
21304
|
return disabledTokens.includes("*");
|
|
21294
21305
|
}
|
|
21295
|
-
function isAssetDisabled(disabledConfig,
|
|
21306
|
+
function isAssetDisabled(disabledConfig, chainId2, tokenAddress) {
|
|
21296
21307
|
if (!disabledConfig) {
|
|
21297
21308
|
return false;
|
|
21298
21309
|
}
|
|
21299
|
-
const disabledTokens = disabledConfig[String(
|
|
21310
|
+
const disabledTokens = disabledConfig[String(chainId2)];
|
|
21300
21311
|
if (!disabledTokens) {
|
|
21301
21312
|
return false;
|
|
21302
21313
|
}
|
|
@@ -21319,8 +21330,8 @@ var SYMBOL_OVERRIDES = {
|
|
|
21319
21330
|
var POLYGON_NATIVE_TOKEN_ALIAS = "MATIC";
|
|
21320
21331
|
function lowercaseAddressKeys(response) {
|
|
21321
21332
|
return Object.fromEntries(
|
|
21322
|
-
Object.entries(response).map(([
|
|
21323
|
-
|
|
21333
|
+
Object.entries(response).map(([chainId2, chainAssets]) => [
|
|
21334
|
+
chainId2,
|
|
21324
21335
|
Object.fromEntries(
|
|
21325
21336
|
Object.entries(chainAssets).map(([address, metadata]) => [
|
|
21326
21337
|
address.toLowerCase(),
|
|
@@ -21330,17 +21341,17 @@ function lowercaseAddressKeys(response) {
|
|
|
21330
21341
|
])
|
|
21331
21342
|
);
|
|
21332
21343
|
}
|
|
21333
|
-
function resolveSymbols(backendSymbol,
|
|
21344
|
+
function resolveSymbols(backendSymbol, chainId2, address) {
|
|
21334
21345
|
const displaySymbol = SYMBOL_OVERRIDES[backendSymbol] ?? backendSymbol;
|
|
21335
|
-
const alias =
|
|
21346
|
+
const alias = chainId2 === polygon6.id && isNativeTokenAddress(address) ? POLYGON_NATIVE_TOKEN_ALIAS : void 0;
|
|
21336
21347
|
return { displaySymbol, alias };
|
|
21337
21348
|
}
|
|
21338
21349
|
function resolveChainAssets(chainConfig, chainAssets, disabledChainAssets) {
|
|
21339
|
-
const { chainId } = chainConfig;
|
|
21350
|
+
const { chainId: chainId2 } = chainConfig;
|
|
21340
21351
|
const resolvedChainAssets = chainConfig.assets.filter(
|
|
21341
21352
|
(configAsset) => !isAssetDisabled(
|
|
21342
21353
|
disabledChainAssets,
|
|
21343
|
-
|
|
21354
|
+
chainId2,
|
|
21344
21355
|
configAsset.address.toLowerCase()
|
|
21345
21356
|
)
|
|
21346
21357
|
).map((configAsset) => {
|
|
@@ -21348,14 +21359,14 @@ function resolveChainAssets(chainConfig, chainAssets, disabledChainAssets) {
|
|
|
21348
21359
|
const metadata = chainAssets?.[address];
|
|
21349
21360
|
if (!metadata) {
|
|
21350
21361
|
logger.warn("useTokenTransferConfig:tokenMetadataMissing", {
|
|
21351
|
-
chainId,
|
|
21362
|
+
chainId: chainId2,
|
|
21352
21363
|
address: configAsset.address
|
|
21353
21364
|
});
|
|
21354
21365
|
return null;
|
|
21355
21366
|
}
|
|
21356
21367
|
const { displaySymbol, alias } = resolveSymbols(
|
|
21357
21368
|
metadata.symbol,
|
|
21358
|
-
|
|
21369
|
+
chainId2,
|
|
21359
21370
|
address
|
|
21360
21371
|
);
|
|
21361
21372
|
return {
|
|
@@ -21693,7 +21704,7 @@ function FunAssetAvatar({
|
|
|
21693
21704
|
assetTicker,
|
|
21694
21705
|
assetName,
|
|
21695
21706
|
assetIconSize = "20",
|
|
21696
|
-
chainId,
|
|
21707
|
+
chainId: chainId2,
|
|
21697
21708
|
prioritizeDefaults = true,
|
|
21698
21709
|
hideIfUnknown = false,
|
|
21699
21710
|
largeChainIcon = false,
|
|
@@ -21702,7 +21713,7 @@ function FunAssetAvatar({
|
|
|
21702
21713
|
const { activeTheme } = useActiveTheme();
|
|
21703
21714
|
const { uiCustomizations } = useFunkitConfig();
|
|
21704
21715
|
const { enableCompactList } = uiCustomizations;
|
|
21705
|
-
const chainMetadata = chainMetadataById[Number.parseInt((
|
|
21716
|
+
const chainMetadata = chainMetadataById[Number.parseInt((chainId2 || "").toString())] || null;
|
|
21706
21717
|
const finalAssetSrc = useMemo30(() => {
|
|
21707
21718
|
const normalizedTicker = assetTicker?.toUpperCase() || "";
|
|
21708
21719
|
const defaultSrc = ASSET_LOGO_SRCS[normalizedTicker];
|
|
@@ -21775,7 +21786,7 @@ function FunAssetAvatar({
|
|
|
21775
21786
|
borderRadius: "full",
|
|
21776
21787
|
height: largeChainIcon || enableCompactList ? chainIconSize : chainIconSize - 2,
|
|
21777
21788
|
width: largeChainIcon || enableCompactList ? chainIconSize : chainIconSize - 2,
|
|
21778
|
-
testId: `fun-asset-chain-${
|
|
21789
|
+
testId: `fun-asset-chain-${chainId2}-icon`
|
|
21779
21790
|
}
|
|
21780
21791
|
)
|
|
21781
21792
|
) : null
|
|
@@ -22262,12 +22273,12 @@ function getIconFromUiConfig(paymentMethod, iconConfig, defaultIconSize = 12) {
|
|
|
22262
22273
|
}
|
|
22263
22274
|
var getDynamicValueIconComponent = () => {
|
|
22264
22275
|
const defaultChains = getDefaultChains();
|
|
22265
|
-
return /* @__PURE__ */ React89.createElement(Box, { display: "flex", alignItems: "center", justifyContent: "flex-end" }, defaultChains.map(({ id:
|
|
22266
|
-
const metadata = chainMetadataById[
|
|
22276
|
+
return /* @__PURE__ */ React89.createElement(Box, { display: "flex", alignItems: "center", justifyContent: "flex-end" }, defaultChains.map(({ id: chainId2 }, index) => {
|
|
22277
|
+
const metadata = chainMetadataById[chainId2];
|
|
22267
22278
|
return /* @__PURE__ */ React89.createElement(
|
|
22268
22279
|
Box,
|
|
22269
22280
|
{
|
|
22270
|
-
key:
|
|
22281
|
+
key: chainId2,
|
|
22271
22282
|
position: "relative",
|
|
22272
22283
|
style: { right: `${(defaultChains.length - index - 1) * -2}px` }
|
|
22273
22284
|
},
|
|
@@ -22324,12 +22335,12 @@ function SupportedChainList({
|
|
|
22324
22335
|
justifyContent: "flex-end",
|
|
22325
22336
|
style
|
|
22326
22337
|
},
|
|
22327
|
-
chainIdList.map((
|
|
22328
|
-
const metadata = chainMetadataById[
|
|
22338
|
+
chainIdList.map((chainId2, index) => {
|
|
22339
|
+
const metadata = chainMetadataById[chainId2];
|
|
22329
22340
|
return /* @__PURE__ */ React89.createElement(
|
|
22330
22341
|
Box,
|
|
22331
22342
|
{
|
|
22332
|
-
key:
|
|
22343
|
+
key: chainId2,
|
|
22333
22344
|
position: "relative",
|
|
22334
22345
|
style: { right: `${(chainIdList.length - index - 1) * -2}px` }
|
|
22335
22346
|
},
|
|
@@ -24252,6 +24263,7 @@ import {
|
|
|
24252
24263
|
import React129, { useEffect as useEffect41, useMemo as useMemo39, useRef as useRef19, useState as useState39 } from "react";
|
|
24253
24264
|
import { createPortal as createPortal4 } from "react-dom";
|
|
24254
24265
|
import { useDebounce } from "use-debounce";
|
|
24266
|
+
import { mainnet as mainnet8 } from "viem/chains";
|
|
24255
24267
|
|
|
24256
24268
|
// src/components/Dropdown/TokenAndChainDropdown.tsx
|
|
24257
24269
|
import React120 from "react";
|
|
@@ -25030,9 +25042,9 @@ var ChainDropdown = ({
|
|
|
25030
25042
|
return [.../* @__PURE__ */ new Set([...priorityIds, ...availableChainIds])];
|
|
25031
25043
|
}, [assets, chainIdSortOrder]);
|
|
25032
25044
|
const options = useMemo36(() => {
|
|
25033
|
-
return chainIds.map((
|
|
25034
|
-
label: chainMetadataById[
|
|
25035
|
-
value:
|
|
25045
|
+
return chainIds.map((chainId2) => ({
|
|
25046
|
+
label: chainMetadataById[chainId2]?.name ?? "",
|
|
25047
|
+
value: chainId2.toString()
|
|
25036
25048
|
}));
|
|
25037
25049
|
}, [chainIds]);
|
|
25038
25050
|
const [selectedChainId, setSelectedChainId] = React118.useState(propSelectedChainId);
|
|
@@ -25049,13 +25061,13 @@ var ChainDropdown = ({
|
|
|
25049
25061
|
if (!value) {
|
|
25050
25062
|
return onChainSelected(void 0);
|
|
25051
25063
|
}
|
|
25052
|
-
const
|
|
25053
|
-
if (allowUnselect &&
|
|
25064
|
+
const chainId2 = Number(value);
|
|
25065
|
+
if (allowUnselect && chainId2 === selectedChainId) {
|
|
25054
25066
|
setSelectedChainId(void 0);
|
|
25055
25067
|
onChainSelected(void 0, autoUpdate);
|
|
25056
25068
|
} else {
|
|
25057
|
-
setSelectedChainId(
|
|
25058
|
-
onChainSelected(
|
|
25069
|
+
setSelectedChainId(chainId2);
|
|
25070
|
+
onChainSelected(chainId2, autoUpdate);
|
|
25059
25071
|
}
|
|
25060
25072
|
};
|
|
25061
25073
|
return /* @__PURE__ */ React118.createElement(
|
|
@@ -25089,8 +25101,8 @@ var ChainDropdown = ({
|
|
|
25089
25101
|
options,
|
|
25090
25102
|
renderDropdownOption: (option, isSelected) => {
|
|
25091
25103
|
const metadata = chainMetadataById[option.value];
|
|
25092
|
-
const
|
|
25093
|
-
const isDisabled = !!selectedToken && !assets[
|
|
25104
|
+
const chainId2 = Number(option.value);
|
|
25105
|
+
const isDisabled = !!selectedToken && !assets[chainId2]?.includes(selectedToken);
|
|
25094
25106
|
const dropdownItem = /* @__PURE__ */ React118.createElement(
|
|
25095
25107
|
BaseDropdownItem_default,
|
|
25096
25108
|
{
|
|
@@ -25860,26 +25872,26 @@ import { skipToken, useQuery as useQuery20 } from "@tanstack/react-query";
|
|
|
25860
25872
|
import { getAssetErc20ByChainAndSymbol } from "@funkit/api-base";
|
|
25861
25873
|
import { useQuery as useQuery19 } from "@tanstack/react-query";
|
|
25862
25874
|
var useErc20Asset = ({
|
|
25863
|
-
chainId,
|
|
25875
|
+
chainId: chainId2,
|
|
25864
25876
|
symbol,
|
|
25865
25877
|
enabled = true
|
|
25866
25878
|
}) => {
|
|
25867
25879
|
const { apiKey } = useFunkitConfig();
|
|
25868
25880
|
const query = useQuery19({
|
|
25869
|
-
queryKey: ["erc20Asset",
|
|
25881
|
+
queryKey: ["erc20Asset", chainId2, symbol],
|
|
25870
25882
|
queryFn: async () => {
|
|
25871
|
-
if (!apiKey || !
|
|
25883
|
+
if (!apiKey || !chainId2 || !symbol) {
|
|
25872
25884
|
return null;
|
|
25873
25885
|
}
|
|
25874
25886
|
const response = await getAssetErc20ByChainAndSymbol({
|
|
25875
|
-
chainId,
|
|
25887
|
+
chainId: chainId2,
|
|
25876
25888
|
symbol,
|
|
25877
25889
|
apiKey,
|
|
25878
25890
|
logger
|
|
25879
25891
|
});
|
|
25880
25892
|
return response;
|
|
25881
25893
|
},
|
|
25882
|
-
enabled: enabled && !!apiKey && !!
|
|
25894
|
+
enabled: enabled && !!apiKey && !!chainId2 && !!symbol,
|
|
25883
25895
|
refetchOnMount: false,
|
|
25884
25896
|
refetchOnReconnect: false,
|
|
25885
25897
|
refetchOnWindowFocus: false
|
|
@@ -25889,15 +25901,15 @@ var useErc20Asset = ({
|
|
|
25889
25901
|
|
|
25890
25902
|
// src/hooks/useAssetPrice.ts
|
|
25891
25903
|
async function getFormattedRelayAssetPriceInfo({
|
|
25892
|
-
chainId,
|
|
25904
|
+
chainId: chainId2,
|
|
25893
25905
|
assetTokenAddress
|
|
25894
25906
|
}) {
|
|
25895
25907
|
try {
|
|
25896
25908
|
const relayResponse = await getRelayAssetPriceInfo({
|
|
25897
|
-
chainId,
|
|
25909
|
+
chainId: chainId2,
|
|
25898
25910
|
address: convertFunToRelayTokenAddress(
|
|
25899
25911
|
assetTokenAddress,
|
|
25900
|
-
Number(
|
|
25912
|
+
Number(chainId2)
|
|
25901
25913
|
)
|
|
25902
25914
|
});
|
|
25903
25915
|
return {
|
|
@@ -25911,7 +25923,7 @@ async function getFormattedRelayAssetPriceInfo({
|
|
|
25911
25923
|
}
|
|
25912
25924
|
}
|
|
25913
25925
|
function useAssetAddressPrice({
|
|
25914
|
-
chainId,
|
|
25926
|
+
chainId: chainId2,
|
|
25915
25927
|
assetTokenAddress,
|
|
25916
25928
|
amount = 1,
|
|
25917
25929
|
refetchInterval = 1e4,
|
|
@@ -25921,13 +25933,13 @@ function useAssetAddressPrice({
|
|
|
25921
25933
|
const { apiKey } = useFunkitConfig();
|
|
25922
25934
|
const isStablecoin = useIsStablecoin();
|
|
25923
25935
|
const { data, error, isLoading } = useQuery20({
|
|
25924
|
-
queryKey: ["getAssetPriceInfo",
|
|
25925
|
-
queryFn: enabled &&
|
|
25936
|
+
queryKey: ["getAssetPriceInfo", chainId2, assetTokenAddress],
|
|
25937
|
+
queryFn: enabled && chainId2 && assetTokenAddress ? async () => {
|
|
25926
25938
|
try {
|
|
25927
25939
|
return await getAssetPriceInfo2({
|
|
25928
25940
|
apiKey,
|
|
25929
25941
|
assetTokenAddress,
|
|
25930
|
-
chainId,
|
|
25942
|
+
chainId: chainId2,
|
|
25931
25943
|
logger
|
|
25932
25944
|
});
|
|
25933
25945
|
} catch (primaryError) {
|
|
@@ -25936,7 +25948,7 @@ function useAssetAddressPrice({
|
|
|
25936
25948
|
{ primaryError }
|
|
25937
25949
|
);
|
|
25938
25950
|
return await getFormattedRelayAssetPriceInfo({
|
|
25939
|
-
chainId,
|
|
25951
|
+
chainId: chainId2,
|
|
25940
25952
|
assetTokenAddress
|
|
25941
25953
|
});
|
|
25942
25954
|
}
|
|
@@ -25951,14 +25963,14 @@ function useAssetAddressPrice({
|
|
|
25951
25963
|
};
|
|
25952
25964
|
}
|
|
25953
25965
|
var useAssetSymbolPrice = ({
|
|
25954
|
-
chainId,
|
|
25966
|
+
chainId: chainId2,
|
|
25955
25967
|
symbol,
|
|
25956
25968
|
refetchInterval,
|
|
25957
25969
|
enabled = true
|
|
25958
25970
|
}) => {
|
|
25959
|
-
const assetQuery = useErc20Asset({ chainId, symbol, enabled });
|
|
25971
|
+
const assetQuery = useErc20Asset({ chainId: chainId2, symbol, enabled });
|
|
25960
25972
|
const priceQuery = useAssetAddressPrice({
|
|
25961
|
-
chainId,
|
|
25973
|
+
chainId: chainId2,
|
|
25962
25974
|
assetTokenAddress: assetQuery.data?.address,
|
|
25963
25975
|
symbol,
|
|
25964
25976
|
refetchInterval,
|
|
@@ -26008,21 +26020,21 @@ function useEnabledTokenTransferChainTokens(transferInit, isWithdrawal) {
|
|
|
26008
26020
|
const hasTronAddress = !!transferInit?.tronAddr;
|
|
26009
26021
|
return Object.keys(assets).reduce(
|
|
26010
26022
|
(acc, curChainIdString) => {
|
|
26011
|
-
const
|
|
26012
|
-
const isSolana =
|
|
26023
|
+
const chainId2 = Number(curChainIdString);
|
|
26024
|
+
const isSolana = chainId2 === solanaChain6.id;
|
|
26013
26025
|
if (isSolana && !hasSolanaAddress && !isWithdrawal) {
|
|
26014
26026
|
return acc;
|
|
26015
26027
|
}
|
|
26016
|
-
const isBitcoin =
|
|
26028
|
+
const isBitcoin = chainId2 === bitcoinChain6.id;
|
|
26017
26029
|
if (isBitcoin && !hasBitcoinAddress && !isWithdrawal) {
|
|
26018
26030
|
return acc;
|
|
26019
26031
|
}
|
|
26020
|
-
const isTron =
|
|
26032
|
+
const isTron = chainId2 === tronChain5.id;
|
|
26021
26033
|
if (isTron && !hasTronAddress && !isWithdrawal) {
|
|
26022
26034
|
return acc;
|
|
26023
26035
|
}
|
|
26024
|
-
if (assets[
|
|
26025
|
-
acc[
|
|
26036
|
+
if (assets[chainId2]?.length) {
|
|
26037
|
+
acc[chainId2] = assets[chainId2];
|
|
26026
26038
|
}
|
|
26027
26039
|
return acc;
|
|
26028
26040
|
},
|
|
@@ -26046,38 +26058,38 @@ function resolveDefaultToken(currentChainSymbols, preferredToken) {
|
|
|
26046
26058
|
}
|
|
26047
26059
|
function findChainForToken(enabledChainSymbols, token, fallbackChainId) {
|
|
26048
26060
|
const matchingChainId = Object.keys(enabledChainSymbols).find(
|
|
26049
|
-
(
|
|
26061
|
+
(chainId2) => enabledChainSymbols[Number(chainId2)]?.includes(token)
|
|
26050
26062
|
);
|
|
26051
26063
|
return matchingChainId ? Number(matchingChainId) : fallbackChainId;
|
|
26052
26064
|
}
|
|
26053
26065
|
function compareLegacyAndNewConfig(legacyConfig, newConfig, configType = "deposit") {
|
|
26054
26066
|
const legacyChains = new Set(Object.keys(legacyConfig).map(Number));
|
|
26055
26067
|
const newChains = new Set(Object.keys(newConfig).map(Number));
|
|
26056
|
-
for (const
|
|
26057
|
-
if (!newChains.has(
|
|
26068
|
+
for (const chainId2 of legacyChains) {
|
|
26069
|
+
if (!newChains.has(chainId2)) {
|
|
26058
26070
|
logger.warn("tokenTransferConfig:chainMissingInNewConfig", {
|
|
26059
|
-
chainId,
|
|
26071
|
+
chainId: chainId2,
|
|
26060
26072
|
configType
|
|
26061
26073
|
});
|
|
26062
26074
|
}
|
|
26063
26075
|
}
|
|
26064
|
-
for (const
|
|
26065
|
-
if (!legacyChains.has(
|
|
26076
|
+
for (const chainId2 of newChains) {
|
|
26077
|
+
if (!legacyChains.has(chainId2)) {
|
|
26066
26078
|
logger.warn("tokenTransferConfig:extraChainInNewConfig", {
|
|
26067
|
-
chainId,
|
|
26079
|
+
chainId: chainId2,
|
|
26068
26080
|
configType
|
|
26069
26081
|
});
|
|
26070
26082
|
}
|
|
26071
26083
|
}
|
|
26072
|
-
for (const
|
|
26073
|
-
const legacySymbols = legacyConfig[
|
|
26074
|
-
const newSymbols = newConfig[
|
|
26084
|
+
for (const chainId2 of legacyChains) {
|
|
26085
|
+
const legacySymbols = legacyConfig[chainId2] ?? [];
|
|
26086
|
+
const newSymbols = newConfig[chainId2] ?? [];
|
|
26075
26087
|
const legacySet = new Set(legacySymbols.map((s) => s.toLowerCase()));
|
|
26076
26088
|
const newSet = new Set(newSymbols.map((s) => s.toLowerCase()));
|
|
26077
26089
|
const missing = legacySymbols.filter((s) => !newSet.has(s.toLowerCase()));
|
|
26078
26090
|
const extra = newSymbols.filter((s) => !legacySet.has(s.toLowerCase()));
|
|
26079
26091
|
if (missing.length > 0 || extra.length > 0) {
|
|
26080
|
-
const data = { chainId, configType, missing, extra };
|
|
26092
|
+
const data = { chainId: chainId2, configType, missing, extra };
|
|
26081
26093
|
logger.warn("tokenTransferConfig:symbolMismatch", data);
|
|
26082
26094
|
}
|
|
26083
26095
|
if (missing.length === 0 && extra.length === 0) {
|
|
@@ -26085,7 +26097,7 @@ function compareLegacyAndNewConfig(legacyConfig, newConfig, configType = "deposi
|
|
|
26085
26097
|
const newOrder = newSymbols.map((s) => s.toLowerCase());
|
|
26086
26098
|
if (JSON.stringify(legacyOrder) !== JSON.stringify(newOrder)) {
|
|
26087
26099
|
const data = {
|
|
26088
|
-
chainId,
|
|
26100
|
+
chainId: chainId2,
|
|
26089
26101
|
configType,
|
|
26090
26102
|
legacyOrder: legacySymbols,
|
|
26091
26103
|
newOrder: newSymbols
|
|
@@ -26186,16 +26198,16 @@ var useTokenAndChainDropdown = ({
|
|
|
26186
26198
|
setSelectedToken(defaultSelectedToken);
|
|
26187
26199
|
}
|
|
26188
26200
|
}, [defaultSelectedToken, noDefaultSelection]);
|
|
26189
|
-
const handleTokenChange = (token,
|
|
26201
|
+
const handleTokenChange = (token, chainId2, autoUpdate) => {
|
|
26190
26202
|
setSelectedToken(token);
|
|
26191
26203
|
if (noDefaultSelection && selectedChainId === void 0) {
|
|
26192
26204
|
return;
|
|
26193
26205
|
}
|
|
26194
|
-
if (
|
|
26195
|
-
setSelectedChainId(
|
|
26206
|
+
if (chainId2 !== void 0 && chainId2 !== selectedChainId) {
|
|
26207
|
+
setSelectedChainId(chainId2);
|
|
26196
26208
|
}
|
|
26197
26209
|
if (autoUpdate) {
|
|
26198
|
-
const targetChainId =
|
|
26210
|
+
const targetChainId = chainId2 ?? selectedChainId;
|
|
26199
26211
|
if (targetChainId !== void 0 && !enabledChainSymbols[targetChainId]?.includes(token)) {
|
|
26200
26212
|
setSelectedChainId(
|
|
26201
26213
|
findChainForToken(enabledChainSymbols, token, preferredChainId)
|
|
@@ -26203,13 +26215,13 @@ var useTokenAndChainDropdown = ({
|
|
|
26203
26215
|
}
|
|
26204
26216
|
}
|
|
26205
26217
|
};
|
|
26206
|
-
const handleChainChange = (
|
|
26207
|
-
if (
|
|
26218
|
+
const handleChainChange = (chainId2, autoUpdate) => {
|
|
26219
|
+
if (chainId2 === void 0) {
|
|
26208
26220
|
return;
|
|
26209
26221
|
}
|
|
26210
|
-
setSelectedChainId(
|
|
26211
|
-
if (autoUpdate && selectedToken !== void 0 && !enabledChainSymbols[
|
|
26212
|
-
const firstToken = enabledChainSymbols[
|
|
26222
|
+
setSelectedChainId(chainId2);
|
|
26223
|
+
if (autoUpdate && selectedToken !== void 0 && !enabledChainSymbols[chainId2]?.includes(selectedToken)) {
|
|
26224
|
+
const firstToken = enabledChainSymbols[chainId2]?.[0];
|
|
26213
26225
|
if (noDefaultSelection || firstToken) {
|
|
26214
26226
|
setSelectedToken(firstToken);
|
|
26215
26227
|
}
|
|
@@ -26241,7 +26253,7 @@ var useTokenAndChainDropdown = ({
|
|
|
26241
26253
|
// src/utils/polymarket.ts
|
|
26242
26254
|
import {
|
|
26243
26255
|
encodeAbiParameters,
|
|
26244
|
-
getAddress as
|
|
26256
|
+
getAddress as getAddress4,
|
|
26245
26257
|
getCreate2Address,
|
|
26246
26258
|
keccak256,
|
|
26247
26259
|
parseAbiParameters
|
|
@@ -26249,7 +26261,7 @@ import {
|
|
|
26249
26261
|
var EOA_PROXY_WALLET_FACTORY_ADDRESS = "0xaacFeEa03eb1561C4e67d661e40682Bd20E3541b";
|
|
26250
26262
|
var EOA_PROXY_WALLET_INIT_CODE_HASH = "0x2bce2127ff07fb632d16c8347c4ebf501f4841168bed00d9e6ef715ddb6fcecf";
|
|
26251
26263
|
function derivePolymarketProxyAddress(address) {
|
|
26252
|
-
return
|
|
26264
|
+
return getAddress4(
|
|
26253
26265
|
getCreate2Address({
|
|
26254
26266
|
from: EOA_PROXY_WALLET_FACTORY_ADDRESS,
|
|
26255
26267
|
salt: keccak256(
|
|
@@ -27153,7 +27165,8 @@ function useWithdrawal({
|
|
|
27153
27165
|
onSuccess
|
|
27154
27166
|
}) {
|
|
27155
27167
|
const { t } = useFunkitTranslation();
|
|
27156
|
-
const { confirmCheckout } = useCheckoutContext();
|
|
27168
|
+
const { confirmCheckout, checkoutItem } = useCheckoutContext();
|
|
27169
|
+
const { refreshCheckoutHistory } = useCheckoutHistoryContext();
|
|
27157
27170
|
const [error, setError] = useAutoClearState();
|
|
27158
27171
|
const [isWithdrawing, setIsWithdrawing] = useState38(false);
|
|
27159
27172
|
const [step, setStep] = useState38(null);
|
|
@@ -27184,7 +27197,8 @@ function useWithdrawal({
|
|
|
27184
27197
|
targetChainId: formData.chainId,
|
|
27185
27198
|
destinationAddress: formData.destinationAddress,
|
|
27186
27199
|
lighterAssetIndex: formData.lighterAssetIndex,
|
|
27187
|
-
userInputAmount: formData.userInputAmount
|
|
27200
|
+
userInputAmount: formData.userInputAmount,
|
|
27201
|
+
withdrawalUSD: formData.withdrawalUSD
|
|
27188
27202
|
});
|
|
27189
27203
|
customCallbackFailed = false;
|
|
27190
27204
|
}
|
|
@@ -27219,10 +27233,18 @@ function useWithdrawal({
|
|
|
27219
27233
|
targetChainId: formData.chainId,
|
|
27220
27234
|
destinationAddress: formData.destinationAddress,
|
|
27221
27235
|
lighterAssetIndex: formData.lighterAssetIndex,
|
|
27222
|
-
userInputAmount: formData.userInputAmount
|
|
27236
|
+
userInputAmount: formData.userInputAmount,
|
|
27237
|
+
withdrawalUSD: formData.withdrawalUSD
|
|
27223
27238
|
});
|
|
27224
27239
|
customCallbackFailed = false;
|
|
27225
27240
|
withdrawalItem?.initSettings.onWithdrawalConfirmation?.(quoteId);
|
|
27241
|
+
if (callbackResult) {
|
|
27242
|
+
logger.log("directExecutionCheckoutConfirmed", {
|
|
27243
|
+
depositAddressOrHash: callbackResult
|
|
27244
|
+
});
|
|
27245
|
+
checkoutItem?.initSettings.onConfirmation?.(callbackResult);
|
|
27246
|
+
refreshCheckoutHistory();
|
|
27247
|
+
}
|
|
27226
27248
|
return callbackResult ? callbackResult : generateSyntheticDepositAddress();
|
|
27227
27249
|
}
|
|
27228
27250
|
try {
|
|
@@ -27335,11 +27357,11 @@ function useWithdrawalAssets(config) {
|
|
|
27335
27357
|
const excludedTokens = safeJSONParse(excludedTokenStr);
|
|
27336
27358
|
if (!useNewWithdrawalConfig && excludedTokens) {
|
|
27337
27359
|
for (const chainIdStr of Object.keys(excludedTokens)) {
|
|
27338
|
-
const
|
|
27339
|
-
const excluded = excludedTokens[
|
|
27340
|
-
const chainAssets = assets[
|
|
27360
|
+
const chainId2 = Number.parseInt(chainIdStr);
|
|
27361
|
+
const excluded = excludedTokens[chainId2] ?? [];
|
|
27362
|
+
const chainAssets = assets[chainId2];
|
|
27341
27363
|
if (chainAssets) {
|
|
27342
|
-
assets[
|
|
27364
|
+
assets[chainId2] = chainAssets.filter(
|
|
27343
27365
|
(token) => !excluded.includes(token)
|
|
27344
27366
|
);
|
|
27345
27367
|
}
|
|
@@ -27458,7 +27480,10 @@ var WithdrawContent = ({
|
|
|
27458
27480
|
const { isLighterSecure, connectedAddress, lighterBalances, lighterAssets } = useLighterWithdrawal(config, setRecipientAddress);
|
|
27459
27481
|
const { address: connectedWalletAddress } = useAccount();
|
|
27460
27482
|
const sourceTokenBalance = lighterBalances[selectedSourceToken.toUpperCase()] ?? fallbackBalance;
|
|
27461
|
-
const {
|
|
27483
|
+
const {
|
|
27484
|
+
asset: lighterSecureMainnetAsset,
|
|
27485
|
+
price: lighterSecureSourceTokenUsdPrice
|
|
27486
|
+
} = useAssetSymbolPrice({
|
|
27462
27487
|
chainId: config.sourceChainId,
|
|
27463
27488
|
symbol: selectedSourceToken,
|
|
27464
27489
|
refetchInterval: PRICE_REFRESH_INTERVAL,
|
|
@@ -27575,8 +27600,12 @@ var WithdrawContent = ({
|
|
|
27575
27600
|
destinationAddress: recipientAddress,
|
|
27576
27601
|
withdrawalUSD: usdValue.toString(),
|
|
27577
27602
|
tokenSymbol: selectedSourceToken,
|
|
27578
|
-
|
|
27579
|
-
|
|
27603
|
+
// Mainnet ERC-20 of the destination token. Secure bridges 1:1, so the
|
|
27604
|
+
// L1 destination matches the user's L2 source-token selection. Falls
|
|
27605
|
+
// back to '0x' only if the price/asset hook hasn't resolved — the
|
|
27606
|
+
// submit button is gated on `lighterAssetIndex` but not on this asset.
|
|
27607
|
+
tokenAddress: lighterSecureMainnetAsset?.address ?? "0x",
|
|
27608
|
+
chainId: mainnet8.id,
|
|
27580
27609
|
lighterAssetIndex,
|
|
27581
27610
|
userInputAmount: withdrawalInputAmount
|
|
27582
27611
|
});
|
|
@@ -29163,6 +29192,7 @@ function WithdrawalModal({
|
|
|
29163
29192
|
}) {
|
|
29164
29193
|
const { withdrawalItem, resetForNewWithdrawal } = useCheckoutContext();
|
|
29165
29194
|
const isSwappedWithdrawalEnabled = useDynamicConfig("enableswappedwithdrawal");
|
|
29195
|
+
const isFreeUsdcBannerEnabled = useFeatureGate("enable-free-usdc-banner");
|
|
29166
29196
|
const titleId = "rk_withdrawal_modal_title";
|
|
29167
29197
|
const isMultiMethod = isMultiMethodWithdrawalConfig(config);
|
|
29168
29198
|
const [selectedMethod, setSelectedMethod] = useState43(null);
|
|
@@ -29248,7 +29278,7 @@ function WithdrawalModal({
|
|
|
29248
29278
|
const nextStep = isCallback ? "PENDING_CALLBACK" /* PENDING_CALLBACK */ : "SUCCESS" /* SUCCESS */;
|
|
29249
29279
|
const withdrawModalEvent = isCallback ? "fw::pending_callback" /* PENDING_CALLBACK */ : "fw::success" /* SUCCESS */;
|
|
29250
29280
|
navigateToStep(nextStep, { skipAnimation: true });
|
|
29251
|
-
setWithdrawnAmount(withdrawal.
|
|
29281
|
+
setWithdrawnAmount(withdrawal.userInputAmount);
|
|
29252
29282
|
setConfirmedHash(depositAddress);
|
|
29253
29283
|
setQuote(withdrawal.quote);
|
|
29254
29284
|
setSelectedTokenSymbol(withdrawal.tokenSymbol);
|
|
@@ -29268,91 +29298,97 @@ function WithdrawalModal({
|
|
|
29268
29298
|
Dialog.Content,
|
|
29269
29299
|
{
|
|
29270
29300
|
className: getContentAnimation(animation),
|
|
29271
|
-
paddingTop:
|
|
29301
|
+
paddingTop: "0",
|
|
29272
29302
|
withTopDivider,
|
|
29273
29303
|
id: WITHDRAWAL_MODAL_CONTENT_ID,
|
|
29274
29304
|
onScroll
|
|
29275
29305
|
},
|
|
29276
|
-
|
|
29277
|
-
|
|
29278
|
-
|
|
29279
|
-
sectionTitle: config.sectionTitle,
|
|
29280
|
-
methods: config.methods,
|
|
29281
|
-
onMethodSelect: handleTypeSelect
|
|
29282
|
-
}
|
|
29283
|
-
) : activeConfig && /* @__PURE__ */ React145.createElement(
|
|
29284
|
-
WithdrawalMethodSelect,
|
|
29306
|
+
isFreeUsdcBannerEnabled && /* @__PURE__ */ React145.createElement(FreeUsdcBanner, { type: "withdrawal" }),
|
|
29307
|
+
/* @__PURE__ */ React145.createElement(
|
|
29308
|
+
Box,
|
|
29285
29309
|
{
|
|
29286
|
-
|
|
29287
|
-
|
|
29288
|
-
|
|
29289
|
-
|
|
29290
|
-
|
|
29291
|
-
|
|
29292
|
-
|
|
29293
|
-
|
|
29294
|
-
eventName: "fw::enter_amount_viewed" /* ENTER_AMOUNT_VIEWED */,
|
|
29295
|
-
metadata: { checkoutId: withdrawalItem?.id }
|
|
29296
|
-
});
|
|
29297
|
-
navigateToStep("ENTER_AMOUNT" /* ENTER_AMOUNT */);
|
|
29298
|
-
},
|
|
29299
|
-
onCashFopSelect: (fop) => {
|
|
29300
|
-
logEvent({
|
|
29301
|
-
eventName: "fw::cash_fop_selected" /* CASH_FOP_SELECTED */,
|
|
29302
|
-
metadata: {
|
|
29303
|
-
checkoutId: withdrawalItem?.id,
|
|
29304
|
-
fopName: fop.name,
|
|
29305
|
-
fopType: fop.fopType
|
|
29306
|
-
}
|
|
29307
|
-
});
|
|
29310
|
+
paddingTop: step === "SELECT_METHOD" /* SELECT_METHOD */ ? "0" : "withdrawalModalPaddingTop"
|
|
29311
|
+
},
|
|
29312
|
+
step === "SELECT_METHOD" /* SELECT_METHOD */ && (isMultiMethodWithdrawalConfig(config) ? /* @__PURE__ */ React145.createElement(
|
|
29313
|
+
WithdrawalTypeSelect,
|
|
29314
|
+
{
|
|
29315
|
+
sectionTitle: config.sectionTitle,
|
|
29316
|
+
methods: config.methods,
|
|
29317
|
+
onMethodSelect: handleTypeSelect
|
|
29308
29318
|
}
|
|
29309
|
-
|
|
29310
|
-
|
|
29311
|
-
|
|
29312
|
-
|
|
29313
|
-
|
|
29314
|
-
|
|
29315
|
-
|
|
29316
|
-
|
|
29317
|
-
|
|
29318
|
-
|
|
29319
|
-
|
|
29320
|
-
|
|
29321
|
-
|
|
29322
|
-
|
|
29323
|
-
|
|
29324
|
-
|
|
29325
|
-
|
|
29326
|
-
|
|
29327
|
-
|
|
29328
|
-
|
|
29329
|
-
|
|
29330
|
-
|
|
29331
|
-
|
|
29332
|
-
|
|
29333
|
-
|
|
29334
|
-
|
|
29335
|
-
|
|
29336
|
-
|
|
29337
|
-
|
|
29338
|
-
|
|
29339
|
-
|
|
29340
|
-
|
|
29341
|
-
|
|
29342
|
-
|
|
29343
|
-
|
|
29344
|
-
|
|
29345
|
-
|
|
29346
|
-
|
|
29347
|
-
|
|
29348
|
-
|
|
29349
|
-
|
|
29350
|
-
|
|
29351
|
-
|
|
29352
|
-
|
|
29353
|
-
|
|
29354
|
-
|
|
29355
|
-
|
|
29319
|
+
) : activeConfig && /* @__PURE__ */ React145.createElement(
|
|
29320
|
+
WithdrawalMethodSelect,
|
|
29321
|
+
{
|
|
29322
|
+
sourceChainId: activeConfig.sourceChainId,
|
|
29323
|
+
sourceTokenAddress: activeConfig.sourceTokenAddress,
|
|
29324
|
+
onCryptoSelect: () => {
|
|
29325
|
+
logEvent({
|
|
29326
|
+
eventName: "fw::crypto_address_selected" /* CRYPTO_ADDRESS_SELECTED */,
|
|
29327
|
+
metadata: { checkoutId: withdrawalItem?.id }
|
|
29328
|
+
});
|
|
29329
|
+
logEvent({
|
|
29330
|
+
eventName: "fw::enter_amount_viewed" /* ENTER_AMOUNT_VIEWED */,
|
|
29331
|
+
metadata: { checkoutId: withdrawalItem?.id }
|
|
29332
|
+
});
|
|
29333
|
+
navigateToStep("ENTER_AMOUNT" /* ENTER_AMOUNT */);
|
|
29334
|
+
},
|
|
29335
|
+
onCashFopSelect: (fop) => {
|
|
29336
|
+
logEvent({
|
|
29337
|
+
eventName: "fw::cash_fop_selected" /* CASH_FOP_SELECTED */,
|
|
29338
|
+
metadata: {
|
|
29339
|
+
checkoutId: withdrawalItem?.id,
|
|
29340
|
+
fopName: fop.name,
|
|
29341
|
+
fopType: fop.fopType
|
|
29342
|
+
}
|
|
29343
|
+
});
|
|
29344
|
+
}
|
|
29345
|
+
}
|
|
29346
|
+
)),
|
|
29347
|
+
step === "ENTER_AMOUNT" /* ENTER_AMOUNT */ && activeConfig && /* @__PURE__ */ React145.createElement(React145.Fragment, null, uiCustomizations.withdrawalScreen.customTopComponent?.(), /* @__PURE__ */ React145.createElement(
|
|
29348
|
+
WithdrawContent,
|
|
29349
|
+
{
|
|
29350
|
+
onContinue: handleWithdrawContentContinue,
|
|
29351
|
+
config: activeConfig,
|
|
29352
|
+
withdrawalItem
|
|
29353
|
+
}
|
|
29354
|
+
)),
|
|
29355
|
+
step === "SUCCESS" /* SUCCESS */ && activeConfig && /* @__PURE__ */ React145.createElement(
|
|
29356
|
+
WithdrawSuccess,
|
|
29357
|
+
{
|
|
29358
|
+
depositAddress: confirmedHash,
|
|
29359
|
+
token: activeConfig.sourceTokenSymbol,
|
|
29360
|
+
tokenIconSrc: activeConfig.iconSrc || ASSET_LOGO_SRCS[activeConfig.sourceTokenSymbol] || "",
|
|
29361
|
+
bottomBarId: MODAL_BOTTOM_BAR_IDS.withdrawal,
|
|
29362
|
+
onNewWithdrawal: handleNewWithdrawal,
|
|
29363
|
+
onClose: onCloseWrapper,
|
|
29364
|
+
chainId: activeConfig.sourceChainId,
|
|
29365
|
+
txHash: confirmedHash
|
|
29366
|
+
}
|
|
29367
|
+
),
|
|
29368
|
+
step === "PENDING_CALLBACK" /* PENDING_CALLBACK */ && (isLighterxyzCustomer(apiKey) && activeConfig?.sourceChainId === String(mainnet9.id) ? /* @__PURE__ */ React145.createElement(
|
|
29369
|
+
LighterSecureWithdrawalSuccess,
|
|
29370
|
+
{
|
|
29371
|
+
onClose: onCloseWrapper,
|
|
29372
|
+
onNewWithdrawal: handleNewWithdrawal,
|
|
29373
|
+
amount: withdrawnAmount,
|
|
29374
|
+
tokenSymbol: selectedTokenSymbol,
|
|
29375
|
+
txHash: confirmedHash
|
|
29376
|
+
}
|
|
29377
|
+
) : /* @__PURE__ */ React145.createElement(
|
|
29378
|
+
WithdrawalCallbackSuccess,
|
|
29379
|
+
{
|
|
29380
|
+
bottomBarId: MODAL_BOTTOM_BAR_IDS.withdrawal,
|
|
29381
|
+
onClose: onCloseWrapper,
|
|
29382
|
+
onNewWithdrawal: () => {
|
|
29383
|
+
resetForNewWithdrawal();
|
|
29384
|
+
navigateToStep("ENTER_AMOUNT" /* ENTER_AMOUNT */, {
|
|
29385
|
+
skipAnimation: true
|
|
29386
|
+
});
|
|
29387
|
+
},
|
|
29388
|
+
quote
|
|
29389
|
+
}
|
|
29390
|
+
))
|
|
29391
|
+
)
|
|
29356
29392
|
), /* @__PURE__ */ React145.createElement(Dialog.BottomSection, { id: MODAL_BOTTOM_BAR_IDS.withdrawal }))
|
|
29357
29393
|
);
|
|
29358
29394
|
}
|
|
@@ -29433,17 +29469,17 @@ var useActivityTraversal = () => {
|
|
|
29433
29469
|
};
|
|
29434
29470
|
|
|
29435
29471
|
// src/modals/ProfileDetails/ProfileDetails.tsx
|
|
29436
|
-
import React266, { useCallback as
|
|
29472
|
+
import React266, { useCallback as useCallback52, useState as useState76 } from "react";
|
|
29437
29473
|
|
|
29438
29474
|
// src/components/ModalHeightAnimationLayer/FunCheckoutModalHeightAnimationWrapper.tsx
|
|
29439
29475
|
import React252 from "react";
|
|
29440
29476
|
|
|
29441
29477
|
// src/modals/CheckoutModal/stepTransition.ts
|
|
29442
29478
|
import {
|
|
29443
|
-
useCallback as
|
|
29479
|
+
useCallback as useCallback50,
|
|
29444
29480
|
useEffect as useEffect65,
|
|
29445
29481
|
useRef as useRef33,
|
|
29446
|
-
useState as
|
|
29482
|
+
useState as useState73
|
|
29447
29483
|
} from "react";
|
|
29448
29484
|
|
|
29449
29485
|
// src/hooks/useCheckoutQuoteNotification.ts
|
|
@@ -31273,13 +31309,13 @@ function BrokerageTwoFA({
|
|
|
31273
31309
|
const { logEvent } = useTrack();
|
|
31274
31310
|
const { checkoutItem } = useCheckoutContext();
|
|
31275
31311
|
const bottomSectionRef = useBottomSectionRef();
|
|
31276
|
-
const
|
|
31312
|
+
const chainId2 = checkoutItem?.selectedSourceAssetInfo.chainId || "";
|
|
31277
31313
|
const tryToRefreshQuote = async () => {
|
|
31278
31314
|
logger.info(`${logPrefix2}handleEnterTwoFactor:quoteExpired`, {
|
|
31279
31315
|
quote: bluvoClient.context?.quote
|
|
31280
31316
|
});
|
|
31281
31317
|
const quoteMetadata = {
|
|
31282
|
-
chainId,
|
|
31318
|
+
chainId: chainId2,
|
|
31283
31319
|
symbol: bluvoClient.context?.quote?.asset || "",
|
|
31284
31320
|
amount: bluvoClient.context?.quote?.amount || "",
|
|
31285
31321
|
quote: bluvoClient.context?.quote
|
|
@@ -32219,13 +32255,13 @@ function ApprovalMethodToggle({
|
|
|
32219
32255
|
// src/components/FunInfoBanner/ChainInfoBanners.tsx
|
|
32220
32256
|
import React181 from "react";
|
|
32221
32257
|
var ChainInfoBanners = ({
|
|
32222
|
-
chainId
|
|
32258
|
+
chainId: chainId2
|
|
32223
32259
|
}) => {
|
|
32224
32260
|
const chainInfoBanners = useDynamicConfig(
|
|
32225
32261
|
"chaininfobanners"
|
|
32226
32262
|
);
|
|
32227
32263
|
try {
|
|
32228
|
-
const chainBanners = chainInfoBanners[
|
|
32264
|
+
const chainBanners = chainInfoBanners[chainId2] ?? [];
|
|
32229
32265
|
return chainBanners.map((banner) => {
|
|
32230
32266
|
const { expireAtMs, ...bannerProps } = banner;
|
|
32231
32267
|
if (expireAtMs && Date.now() > expireAtMs) {
|
|
@@ -32234,10 +32270,10 @@ var ChainInfoBanners = ({
|
|
|
32234
32270
|
if (expireAtMs) {
|
|
32235
32271
|
return /* @__PURE__ */ React181.createElement(EphemeralInfoBanner, { ...bannerProps, expireAtMs });
|
|
32236
32272
|
}
|
|
32237
|
-
return /* @__PURE__ */ React181.createElement(InfoBanner, { key: `${banner.message}-${
|
|
32273
|
+
return /* @__PURE__ */ React181.createElement(InfoBanner, { key: `${banner.message}-${chainId2}`, ...banner });
|
|
32238
32274
|
});
|
|
32239
32275
|
} catch {
|
|
32240
|
-
logger.error("ChainInfoBanners:error", { chainId, chainInfoBanners });
|
|
32276
|
+
logger.error("ChainInfoBanners:error", { chainId: chainId2, chainInfoBanners });
|
|
32241
32277
|
return null;
|
|
32242
32278
|
}
|
|
32243
32279
|
};
|
|
@@ -32781,9 +32817,9 @@ function useCardDisclaimer(checkoutItem, finalConvertedAssetName) {
|
|
|
32781
32817
|
return null;
|
|
32782
32818
|
}
|
|
32783
32819
|
const { config } = checkoutItem.initSettings;
|
|
32784
|
-
const { chainId, symbol } = checkoutItem.selectedSourceAssetInfo;
|
|
32820
|
+
const { chainId: chainId2, symbol } = checkoutItem.selectedSourceAssetInfo;
|
|
32785
32821
|
const depositToken = symbol ?? "";
|
|
32786
|
-
const sourceChainName = chainMetadataById[
|
|
32822
|
+
const sourceChainName = chainMetadataById[chainId2]?.name ?? "";
|
|
32787
32823
|
const toChainName = chainMetadataById[config.targetChain]?.name ?? "";
|
|
32788
32824
|
const areTokensEqual = (
|
|
32789
32825
|
// TODO: comparing symbol with the result of a function named 'getCheckoutItemDisplay' does not feel reliable
|
|
@@ -32979,14 +33015,14 @@ import { erc20Abi as erc20Abi4 } from "viem";
|
|
|
32979
33015
|
|
|
32980
33016
|
// src/utils/isMainnetUsdt.ts
|
|
32981
33017
|
import { isTokenEquivalent as isTokenEquivalent4 } from "@funkit/utils";
|
|
32982
|
-
import { mainnet as
|
|
33018
|
+
import { mainnet as mainnet10 } from "viem/chains";
|
|
32983
33019
|
var USDT_MAINNET_ADDRESS = "0xdAC17F958D2ee523a2206206994597C13D831ec7";
|
|
32984
|
-
function isMainnetUsdt(
|
|
33020
|
+
function isMainnetUsdt(chainId2, address) {
|
|
32985
33021
|
return isTokenEquivalent4({
|
|
32986
33022
|
firstTokenAddress: address,
|
|
32987
|
-
firstTokenChainId:
|
|
33023
|
+
firstTokenChainId: chainId2.toString(),
|
|
32988
33024
|
secondTokenAddress: USDT_MAINNET_ADDRESS,
|
|
32989
|
-
secondTokenChainId:
|
|
33025
|
+
secondTokenChainId: mainnet10.id.toString()
|
|
32990
33026
|
});
|
|
32991
33027
|
}
|
|
32992
33028
|
|
|
@@ -34124,7 +34160,7 @@ import {
|
|
|
34124
34160
|
isTokenEquivalent as isTokenEquivalent5,
|
|
34125
34161
|
round as round2
|
|
34126
34162
|
} from "@funkit/utils";
|
|
34127
|
-
import * as
|
|
34163
|
+
import * as dnum9 from "dnum";
|
|
34128
34164
|
import { motion as motion10 } from "motion/react";
|
|
34129
34165
|
import React205, { useEffect as useEffect52, useMemo as useMemo53 } from "react";
|
|
34130
34166
|
|
|
@@ -35315,20 +35351,226 @@ var QuickOptions = ({
|
|
|
35315
35351
|
);
|
|
35316
35352
|
};
|
|
35317
35353
|
|
|
35354
|
+
// src/modals/CheckoutModal/InputAmount/useAaveNativeSupply.ts
|
|
35355
|
+
import {
|
|
35356
|
+
bigDecimal,
|
|
35357
|
+
chainId,
|
|
35358
|
+
evmAddress
|
|
35359
|
+
} from "@aave/client";
|
|
35360
|
+
import { supply } from "@aave/client/actions";
|
|
35361
|
+
import { sendWith } from "@aave/client/viem";
|
|
35362
|
+
import { DirectExecutionType as DirectExecutionType4, createDirectExecution } from "@funkit/api-base";
|
|
35363
|
+
import * as dnum7 from "dnum";
|
|
35364
|
+
import { useCallback as useCallback39, useState as useState59 } from "react";
|
|
35365
|
+
|
|
35366
|
+
// src/modals/CheckoutModal/InputAmount/aaveClient.ts
|
|
35367
|
+
import { AaveV3Ethereum } from "@aave-dao/aave-address-book";
|
|
35368
|
+
import { AaveClient, production } from "@aave/client";
|
|
35369
|
+
var aaveClient = AaveClient.create({ environment: production });
|
|
35370
|
+
var AAVE_MARKET_ADDRESS_BY_CHAIN = {
|
|
35371
|
+
"1": AaveV3Ethereum.POOL
|
|
35372
|
+
};
|
|
35373
|
+
|
|
35374
|
+
// src/modals/CheckoutModal/InputAmount/useAaveNativeSupply.ts
|
|
35375
|
+
function isAaveNativeSupplyContext({
|
|
35376
|
+
apiKey,
|
|
35377
|
+
sourceAsset,
|
|
35378
|
+
checkoutConfig
|
|
35379
|
+
}) {
|
|
35380
|
+
if (!isCustomerNativeFastPathEnabled(apiKey)) {
|
|
35381
|
+
return false;
|
|
35382
|
+
}
|
|
35383
|
+
if (!AAVE_MARKET_ADDRESS_BY_CHAIN[String(checkoutConfig.targetChain)]) {
|
|
35384
|
+
return false;
|
|
35385
|
+
}
|
|
35386
|
+
if (String(sourceAsset.chainId) !== String(checkoutConfig.targetChain)) {
|
|
35387
|
+
return false;
|
|
35388
|
+
}
|
|
35389
|
+
return sourceAsset.address.toLowerCase() === checkoutConfig.targetAsset.toLowerCase();
|
|
35390
|
+
}
|
|
35391
|
+
function formatSupplyAmount(tokenAmountBaseUnit, fallbackAssetAmount) {
|
|
35392
|
+
if (tokenAmountBaseUnit) {
|
|
35393
|
+
return dnum7.toString(tokenAmountBaseUnit);
|
|
35394
|
+
}
|
|
35395
|
+
return String(fallbackAssetAmount ?? 0);
|
|
35396
|
+
}
|
|
35397
|
+
async function executeAaveSupplyPlan(walletClient, request) {
|
|
35398
|
+
const result = await supply(aaveClient, request).andThen(
|
|
35399
|
+
sendWith(walletClient)
|
|
35400
|
+
);
|
|
35401
|
+
if (result.isErr()) {
|
|
35402
|
+
throw result.error;
|
|
35403
|
+
}
|
|
35404
|
+
return result.value.txHash;
|
|
35405
|
+
}
|
|
35406
|
+
function useAaveNativeSupply({
|
|
35407
|
+
checkoutItem
|
|
35408
|
+
}) {
|
|
35409
|
+
const { address: walletAddress, connector } = useAccount();
|
|
35410
|
+
const { apiKey } = useFunkitConfig();
|
|
35411
|
+
const userInfo = useFunkitUserInfo();
|
|
35412
|
+
const wagmiConfig = useConfig();
|
|
35413
|
+
const { switchChainAsync } = useFunkitSwitchChains({});
|
|
35414
|
+
const { updateActiveCheckout } = useCheckoutContext();
|
|
35415
|
+
const { refreshCheckoutHistory } = useCheckoutHistoryContext();
|
|
35416
|
+
const [isPending, setIsPending] = useState59(false);
|
|
35417
|
+
const [error, setError] = useState59(null);
|
|
35418
|
+
const submit = useCallback39(
|
|
35419
|
+
async (humanAmount) => {
|
|
35420
|
+
setError(null);
|
|
35421
|
+
if (!walletAddress || !connector) {
|
|
35422
|
+
const err = new Error("Wallet not connected");
|
|
35423
|
+
setError(err);
|
|
35424
|
+
return null;
|
|
35425
|
+
}
|
|
35426
|
+
if (!checkoutItem) {
|
|
35427
|
+
const err = new Error("No active checkout");
|
|
35428
|
+
setError(err);
|
|
35429
|
+
return null;
|
|
35430
|
+
}
|
|
35431
|
+
const targetChainStr = checkoutItem.initSettings.config.targetChain;
|
|
35432
|
+
const market = AAVE_MARKET_ADDRESS_BY_CHAIN[targetChainStr];
|
|
35433
|
+
if (!market) {
|
|
35434
|
+
const err = new Error(
|
|
35435
|
+
`Aave native supply not configured for chain ${targetChainStr}`
|
|
35436
|
+
);
|
|
35437
|
+
setError(err);
|
|
35438
|
+
return null;
|
|
35439
|
+
}
|
|
35440
|
+
const targetChainNum = Number.parseInt(targetChainStr, 10);
|
|
35441
|
+
const targetAsset = checkoutItem.initSettings.config.targetAsset;
|
|
35442
|
+
setIsPending(true);
|
|
35443
|
+
try {
|
|
35444
|
+
const currentChainId = await connector.getChainId();
|
|
35445
|
+
if (currentChainId !== targetChainNum) {
|
|
35446
|
+
logger.info("aaveNativeSupply:chainSwitch", {
|
|
35447
|
+
from: currentChainId,
|
|
35448
|
+
to: targetChainNum
|
|
35449
|
+
});
|
|
35450
|
+
await switchChainAsync({ chainId: targetChainNum });
|
|
35451
|
+
}
|
|
35452
|
+
const walletClient = await getWalletClient(wagmiConfig, {
|
|
35453
|
+
chainId: targetChainNum
|
|
35454
|
+
});
|
|
35455
|
+
const supplyRequest = {
|
|
35456
|
+
chainId: chainId(targetChainNum),
|
|
35457
|
+
market: evmAddress(market),
|
|
35458
|
+
amount: {
|
|
35459
|
+
erc20: {
|
|
35460
|
+
currency: evmAddress(targetAsset),
|
|
35461
|
+
value: bigDecimal(humanAmount)
|
|
35462
|
+
}
|
|
35463
|
+
},
|
|
35464
|
+
sender: evmAddress(walletAddress)
|
|
35465
|
+
};
|
|
35466
|
+
const supplyTxHash = await executeAaveSupplyPlan(
|
|
35467
|
+
walletClient,
|
|
35468
|
+
supplyRequest
|
|
35469
|
+
);
|
|
35470
|
+
if (!userInfo.id) {
|
|
35471
|
+
logger.warn("aaveNativeSupply:skippingDirectExecutionNoUserId", {
|
|
35472
|
+
txHash: supplyTxHash,
|
|
35473
|
+
checkoutId: checkoutItem.id
|
|
35474
|
+
});
|
|
35475
|
+
} else {
|
|
35476
|
+
try {
|
|
35477
|
+
const config = checkoutItem.initSettings.config;
|
|
35478
|
+
const clientMetadata = {
|
|
35479
|
+
id: checkoutItem.id,
|
|
35480
|
+
startTimestampMs: checkoutItem.startTimestampMs,
|
|
35481
|
+
finalDollarValue: checkoutItem.finalDollarValue,
|
|
35482
|
+
depositAddress: supplyTxHash,
|
|
35483
|
+
latestQuote: null,
|
|
35484
|
+
initSettings: {
|
|
35485
|
+
...checkoutItem.initSettings,
|
|
35486
|
+
config: { ...config, generateActionsParams: void 0 }
|
|
35487
|
+
},
|
|
35488
|
+
selectedSourceAssetInfo: checkoutItem.selectedSourceAssetInfo,
|
|
35489
|
+
selectedPaymentMethodInfo: checkoutItem.selectedPaymentMethodInfo ?? null,
|
|
35490
|
+
evaluatedActionsParams: [],
|
|
35491
|
+
isWithdrawal: false
|
|
35492
|
+
};
|
|
35493
|
+
await createDirectExecution({
|
|
35494
|
+
txHash: supplyTxHash,
|
|
35495
|
+
userId: userInfo.id,
|
|
35496
|
+
recipientAddr: getCheckoutRecipient({
|
|
35497
|
+
config,
|
|
35498
|
+
walletAddress
|
|
35499
|
+
}),
|
|
35500
|
+
type: DirectExecutionType4.CONTRACT_CALL,
|
|
35501
|
+
fromChainId: targetChainStr,
|
|
35502
|
+
fromTokenAddress: targetAsset,
|
|
35503
|
+
toChainId: targetChainStr,
|
|
35504
|
+
toTokenAddress: targetAsset,
|
|
35505
|
+
// For a pure supply, source and destination amounts match —
|
|
35506
|
+
// there is no swap. Aave's API doesn't return base-unit
|
|
35507
|
+
// amounts in the plan, so we omit them here for the PoC.
|
|
35508
|
+
// TODO(ENG-3757): plumb base-unit amounts once we read
|
|
35509
|
+
// token decimals (or extend the supply request to return them).
|
|
35510
|
+
fromAmountBaseUnit: "0",
|
|
35511
|
+
toAmountBaseUnit: "0",
|
|
35512
|
+
estTotalUsd: checkoutItem.finalDollarValue ?? 0,
|
|
35513
|
+
sourceOfFund: `${checkoutItem.selectedPaymentMethodInfo?.paymentMethod ?? ""}|aave|${walletAddress}`,
|
|
35514
|
+
clientMetadata,
|
|
35515
|
+
apiKey,
|
|
35516
|
+
logger
|
|
35517
|
+
});
|
|
35518
|
+
} catch (deError) {
|
|
35519
|
+
logger.warn("aaveNativeSupply:createDirectExecutionFailed", {
|
|
35520
|
+
txHash: supplyTxHash,
|
|
35521
|
+
checkoutId: checkoutItem.id,
|
|
35522
|
+
errorMessage: deError instanceof Error ? deError.message : String(deError)
|
|
35523
|
+
});
|
|
35524
|
+
}
|
|
35525
|
+
}
|
|
35526
|
+
checkoutItem.initSettings.onConfirmation?.(supplyTxHash);
|
|
35527
|
+
logger.log("directExecutionCheckoutConfirmed", {
|
|
35528
|
+
depositAddressOrHash: supplyTxHash
|
|
35529
|
+
});
|
|
35530
|
+
updateActiveCheckout({ depositAddress: supplyTxHash });
|
|
35531
|
+
refreshCheckoutHistory();
|
|
35532
|
+
return { txHash: supplyTxHash };
|
|
35533
|
+
} catch (err) {
|
|
35534
|
+
const e = err instanceof Error ? err : new Error(String(err));
|
|
35535
|
+
logger.warn("aaveNativeSupply:executionFailed", {
|
|
35536
|
+
checkoutId: checkoutItem.id,
|
|
35537
|
+
errorMessage: e.message
|
|
35538
|
+
});
|
|
35539
|
+
setError(e);
|
|
35540
|
+
return null;
|
|
35541
|
+
} finally {
|
|
35542
|
+
setIsPending(false);
|
|
35543
|
+
}
|
|
35544
|
+
},
|
|
35545
|
+
[
|
|
35546
|
+
walletAddress,
|
|
35547
|
+
connector,
|
|
35548
|
+
apiKey,
|
|
35549
|
+
userInfo.id,
|
|
35550
|
+
checkoutItem,
|
|
35551
|
+
wagmiConfig,
|
|
35552
|
+
switchChainAsync,
|
|
35553
|
+
updateActiveCheckout,
|
|
35554
|
+
refreshCheckoutHistory
|
|
35555
|
+
]
|
|
35556
|
+
);
|
|
35557
|
+
return { submit, isPending, error };
|
|
35558
|
+
}
|
|
35559
|
+
|
|
35318
35560
|
// src/modals/CheckoutModal/InputAmount/useAmountInput.ts
|
|
35319
35561
|
import {
|
|
35320
|
-
useCallback as
|
|
35562
|
+
useCallback as useCallback41,
|
|
35321
35563
|
useMemo as useMemo52,
|
|
35322
35564
|
useReducer as useReducer3,
|
|
35323
35565
|
useRef as useRef26,
|
|
35324
|
-
useState as
|
|
35566
|
+
useState as useState61
|
|
35325
35567
|
} from "react";
|
|
35326
35568
|
|
|
35327
35569
|
// src/hooks/useTextMeasurer.ts
|
|
35328
|
-
import { useCallback as
|
|
35570
|
+
import { useCallback as useCallback40, useState as useState60 } from "react";
|
|
35329
35571
|
function useTextMeasurer(inputRef) {
|
|
35330
|
-
const [temp] =
|
|
35331
|
-
const measureText =
|
|
35572
|
+
const [temp] = useState60(() => document.createElement("span"));
|
|
35573
|
+
const measureText = useCallback40(
|
|
35332
35574
|
(text, fontSize) => {
|
|
35333
35575
|
if (!inputRef.current) {
|
|
35334
35576
|
return void 0;
|
|
@@ -35361,7 +35603,7 @@ function useTextMeasurer(inputRef) {
|
|
|
35361
35603
|
|
|
35362
35604
|
// src/modals/CheckoutModal/InputAmount/state.ts
|
|
35363
35605
|
import { round } from "@funkit/utils";
|
|
35364
|
-
import * as
|
|
35606
|
+
import * as dnum8 from "dnum";
|
|
35365
35607
|
function resolveUnitPrice(isExactIn, sourceHolding, targetUnitPrice) {
|
|
35366
35608
|
if (!isExactIn) {
|
|
35367
35609
|
return targetUnitPrice;
|
|
@@ -35437,9 +35679,9 @@ function isAmountAboveAvailable({
|
|
|
35437
35679
|
}
|
|
35438
35680
|
const limit = maxSendableAmount ?? tokenBalanceBaseUnit;
|
|
35439
35681
|
if (tokenAmountBaseUnit !== null) {
|
|
35440
|
-
return
|
|
35682
|
+
return dnum8.greaterThan(tokenAmountBaseUnit, limit);
|
|
35441
35683
|
}
|
|
35442
|
-
return
|
|
35684
|
+
return dnum8.greaterThan(toBaseUnits(assetAmount, limit[1]), limit);
|
|
35443
35685
|
}
|
|
35444
35686
|
function computeInitialTokenAmount(isExactIn, assetAmount, tokenDecimals, tokenBalanceBaseUnit) {
|
|
35445
35687
|
if (!isExactIn || assetAmount === void 0 || tokenDecimals === null) {
|
|
@@ -35455,7 +35697,7 @@ function parseTokenBalance(sourceHolding) {
|
|
|
35455
35697
|
if (!sourceHolding?.tokenBalanceRaw || decimals === null) {
|
|
35456
35698
|
return null;
|
|
35457
35699
|
}
|
|
35458
|
-
return
|
|
35700
|
+
return dnum8.from([BigInt(sourceHolding.tokenBalanceRaw), decimals]);
|
|
35459
35701
|
}
|
|
35460
35702
|
function tokenToFiat(tokenAmountBaseUnit, frozenUnitPrice, decimals = ASSET_DECIMALS) {
|
|
35461
35703
|
return mulByPriceRoundedDown(tokenAmountBaseUnit, frozenUnitPrice, decimals);
|
|
@@ -35464,7 +35706,7 @@ function clampToBalance(computed, tokenBalanceBaseUnit) {
|
|
|
35464
35706
|
if (computed === null || tokenBalanceBaseUnit === null) {
|
|
35465
35707
|
return computed;
|
|
35466
35708
|
}
|
|
35467
|
-
if (
|
|
35709
|
+
if (dnum8.greaterThan(computed, tokenBalanceBaseUnit) && dnum8.subtract(computed, tokenBalanceBaseUnit)[0] < 1000n) {
|
|
35468
35710
|
return tokenBalanceBaseUnit;
|
|
35469
35711
|
}
|
|
35470
35712
|
return computed;
|
|
@@ -36077,8 +36319,8 @@ function useAmountInput(options) {
|
|
|
36077
36319
|
activeTheme.fontSize.inputAmount.fontSize,
|
|
36078
36320
|
10
|
|
36079
36321
|
);
|
|
36080
|
-
const [fontSize, setFontSize] =
|
|
36081
|
-
const [inputWidth, setInputWidth] =
|
|
36322
|
+
const [fontSize, setFontSize] = useState61(maxFontSize);
|
|
36323
|
+
const [inputWidth, setInputWidth] = useState61();
|
|
36082
36324
|
const textContent = inputAffix.type === "prefix" ? inputAffix.content + inputText : inputText + inputAffix.content;
|
|
36083
36325
|
useIsomorphicLayoutEffect(() => {
|
|
36084
36326
|
const totalTextWidth = measureText(textContent, fontSize);
|
|
@@ -36105,7 +36347,7 @@ function useAmountInput(options) {
|
|
|
36105
36347
|
const isCardCheckout = paymentMethodInfo.paymentMethod === "card" /* CARD */;
|
|
36106
36348
|
const isMeldFlow = isCardCheckout && isMeldEnabled;
|
|
36107
36349
|
const unitPrice = realUnitPrice;
|
|
36108
|
-
const dispatchAndGetNewState =
|
|
36350
|
+
const dispatchAndGetNewState = useCallback41(
|
|
36109
36351
|
(action) => {
|
|
36110
36352
|
dispatch(action);
|
|
36111
36353
|
return getDerivedState(
|
|
@@ -36121,7 +36363,7 @@ function useAmountInput(options) {
|
|
|
36121
36363
|
}
|
|
36122
36364
|
return attachInputNormalization(inputRef.current, inputDecimals, locale);
|
|
36123
36365
|
}, [inputDecimals, locale, inputRef.current]);
|
|
36124
|
-
const onChange =
|
|
36366
|
+
const onChange = useCallback41(
|
|
36125
36367
|
(event) => {
|
|
36126
36368
|
dispatch({
|
|
36127
36369
|
type: "setInputValue",
|
|
@@ -36156,7 +36398,7 @@ function useAmountInput(options) {
|
|
|
36156
36398
|
});
|
|
36157
36399
|
}
|
|
36158
36400
|
}, [defaultAmount]);
|
|
36159
|
-
const setAssetAmount =
|
|
36401
|
+
const setAssetAmount = useCallback41(
|
|
36160
36402
|
(assetAmount) => {
|
|
36161
36403
|
const newState = dispatchAndGetNewState({
|
|
36162
36404
|
type: "setAssetAmount",
|
|
@@ -36168,7 +36410,7 @@ function useAmountInput(options) {
|
|
|
36168
36410
|
},
|
|
36169
36411
|
[dispatchAndGetNewState, unitPrice]
|
|
36170
36412
|
);
|
|
36171
|
-
const setFiatAmount =
|
|
36413
|
+
const setFiatAmount = useCallback41(
|
|
36172
36414
|
(fiatAmount) => {
|
|
36173
36415
|
const newState = dispatchAndGetNewState({
|
|
36174
36416
|
type: "setFiatAmount",
|
|
@@ -36180,7 +36422,7 @@ function useAmountInput(options) {
|
|
|
36180
36422
|
},
|
|
36181
36423
|
[dispatchAndGetNewState, unitPrice]
|
|
36182
36424
|
);
|
|
36183
|
-
const setTokenAmount =
|
|
36425
|
+
const setTokenAmount = useCallback41(
|
|
36184
36426
|
(tokenAmountBaseUnit, frozenUnitPrice) => {
|
|
36185
36427
|
const newState = dispatchAndGetNewState({
|
|
36186
36428
|
type: "setTokenAmount",
|
|
@@ -36192,7 +36434,7 @@ function useAmountInput(options) {
|
|
|
36192
36434
|
},
|
|
36193
36435
|
[dispatchAndGetNewState]
|
|
36194
36436
|
);
|
|
36195
|
-
const toggleInputInFiat =
|
|
36437
|
+
const toggleInputInFiat = useCallback41(() => {
|
|
36196
36438
|
dispatch({ type: "toggleInputInFiat" });
|
|
36197
36439
|
inputRef.current?.focus();
|
|
36198
36440
|
}, []);
|
|
@@ -36216,7 +36458,7 @@ function useAmountInput(options) {
|
|
|
36216
36458
|
|
|
36217
36459
|
// src/modals/CheckoutModal/InputAmount/useMeld.tsx
|
|
36218
36460
|
import { MeldServiceProvider as MeldServiceProvider2 } from "@funkit/api-base";
|
|
36219
|
-
import React204, { useCallback as
|
|
36461
|
+
import React204, { useCallback as useCallback43 } from "react";
|
|
36220
36462
|
|
|
36221
36463
|
// src/components/SourceMeldQuoteItem/SourceMeldQuoteItem.tsx
|
|
36222
36464
|
import React203 from "react";
|
|
@@ -36569,8 +36811,8 @@ import {
|
|
|
36569
36811
|
FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO9,
|
|
36570
36812
|
hyperEvmChain as hyperEvmChain4
|
|
36571
36813
|
} from "@funkit/chains";
|
|
36572
|
-
import { useCallback as
|
|
36573
|
-
import { mainnet as
|
|
36814
|
+
import { useCallback as useCallback42, useState as useState62 } from "react";
|
|
36815
|
+
import { mainnet as mainnet11, mantle, zksync as zksync2 } from "viem/chains";
|
|
36574
36816
|
import { getAssetErc20ByChainAndSymbol as getAssetErc20ByChainAndSymbol2 } from "@funkit/api-base";
|
|
36575
36817
|
var pickSourceAssetForCard = async (checkoutItem, userIpInfo, apiKey) => {
|
|
36576
36818
|
if (!checkoutItem?.initSettings.config.targetChain) {
|
|
@@ -36600,7 +36842,7 @@ var pickSourceAssetForCard = async (checkoutItem, userIpInfo, apiKey) => {
|
|
|
36600
36842
|
sourceTokenAddress = NATIVE_TOKEN;
|
|
36601
36843
|
sourceTokenChainId = moonpayChainId;
|
|
36602
36844
|
} else {
|
|
36603
|
-
sourceTokenChainId = isNyOrTxOrVi ?
|
|
36845
|
+
sourceTokenChainId = isNyOrTxOrVi ? mainnet11.id.toString() : moonpayChainId;
|
|
36604
36846
|
if (isTargetAssetEthOrWeth) {
|
|
36605
36847
|
sourceTokenTicker = "ETH" /* ETH */;
|
|
36606
36848
|
sourceTokenAddress = NATIVE_TOKEN;
|
|
@@ -36633,8 +36875,8 @@ function useUpdateCardSourceAsset() {
|
|
|
36633
36875
|
const { checkoutItem, updateSourceAsset } = useCheckoutContext();
|
|
36634
36876
|
const { userIpInfo } = useFunkitUserIp();
|
|
36635
36877
|
const { apiKey } = useFunkitConfig();
|
|
36636
|
-
const [isUpdating, setIsUpdating] =
|
|
36637
|
-
const onSelectCard =
|
|
36878
|
+
const [isUpdating, setIsUpdating] = useState62(false);
|
|
36879
|
+
const onSelectCard = useCallback42(async () => {
|
|
36638
36880
|
setIsUpdating(true);
|
|
36639
36881
|
try {
|
|
36640
36882
|
const source = await pickSourceAssetForCard(
|
|
@@ -36749,7 +36991,7 @@ function useMeld(meldEnabled, manuallySelectedQuote, usdAmount, fiatCurrency) {
|
|
|
36749
36991
|
);
|
|
36750
36992
|
const isMeldMoonpaySelected = selectedQuote?.serviceProvider === MeldServiceProvider2.MOONPAY;
|
|
36751
36993
|
const isMeldContinueDisabled = meldEnabled && (!!meldLimitError || isMeldLinkPending || !!meldQuotesQuery.error || meldQuotesQuery.isFetching || isSelectedQuoteUnavailable);
|
|
36752
|
-
const getMeldError =
|
|
36994
|
+
const getMeldError = useCallback43(
|
|
36753
36995
|
function getMeldError2() {
|
|
36754
36996
|
if (isSelectedQuoteUnavailable) {
|
|
36755
36997
|
return {
|
|
@@ -36821,9 +37063,18 @@ function InputAmountLoaded({
|
|
|
36821
37063
|
const isBrokerageCheckout = paymentMethodInfo.paymentMethod === "brokerage" /* BROKERAGE */;
|
|
36822
37064
|
const meldEnabled = useIsMeldEnabled() && isCardCheckout;
|
|
36823
37065
|
const { getMinDepositUSD } = checkoutConfig;
|
|
36824
|
-
const { updateTargetAssetAmount } = useCheckoutContext();
|
|
37066
|
+
const { checkoutItem, updateTargetAssetAmount } = useCheckoutContext();
|
|
36825
37067
|
const { brokerageMinMax } = useFunkitBrokerageContext();
|
|
36826
37068
|
const quoteBuilder = useQuoteBuilder();
|
|
37069
|
+
const aaveSupply = useAaveNativeSupply({ checkoutItem: checkoutItem ?? null });
|
|
37070
|
+
const isAaveNativeFastPath = sourceHolding != null && isAaveNativeSupplyContext({
|
|
37071
|
+
apiKey,
|
|
37072
|
+
sourceAsset: {
|
|
37073
|
+
chainId: sourceHolding.pickedChainId,
|
|
37074
|
+
address: sourceHolding.tokenAddress
|
|
37075
|
+
},
|
|
37076
|
+
checkoutConfig
|
|
37077
|
+
});
|
|
36827
37078
|
const isExactIn = quoteBuilder.isExactIn();
|
|
36828
37079
|
const sourceTokenKey = sourceHolding?.chainSymbolKey;
|
|
36829
37080
|
const sourceTokenChanged = modalState.sourceTokenKey != null && modalState.sourceTokenKey !== sourceTokenKey;
|
|
@@ -36870,7 +37121,7 @@ function InputAmountLoaded({
|
|
|
36870
37121
|
const { tokenBalanceBaseUnit, frozenUnitPrice } = amountInputResult;
|
|
36871
37122
|
if (isExactIn && !isCardCheckout && tokenBalanceBaseUnit != null && frozenUnitPrice != null) {
|
|
36872
37123
|
const base8 = amountInputResult.maxSendableAmount ?? tokenBalanceBaseUnit;
|
|
36873
|
-
const amount = option === 100 ? base8 :
|
|
37124
|
+
const amount = option === 100 ? base8 : dnum9.multiply(base8, option / 100);
|
|
36874
37125
|
amountInputResult.setTokenAmount(amount, frozenUnitPrice);
|
|
36875
37126
|
return null;
|
|
36876
37127
|
}
|
|
@@ -36920,6 +37171,9 @@ function InputAmountLoaded({
|
|
|
36920
37171
|
return meldError;
|
|
36921
37172
|
}
|
|
36922
37173
|
}
|
|
37174
|
+
if (aaveSupply.error) {
|
|
37175
|
+
return { message: aaveSupply.error.message, type: "error" };
|
|
37176
|
+
}
|
|
36923
37177
|
if (usdAvailableAmount === 0) {
|
|
36924
37178
|
return {
|
|
36925
37179
|
message: t("inputAmount.insufficientBalanceSelectAnother"),
|
|
@@ -36927,16 +37181,49 @@ function InputAmountLoaded({
|
|
|
36927
37181
|
};
|
|
36928
37182
|
}
|
|
36929
37183
|
return getInputErrorNotification(inputError, t);
|
|
36930
|
-
}, [
|
|
36931
|
-
|
|
37184
|
+
}, [
|
|
37185
|
+
t,
|
|
37186
|
+
inputError,
|
|
37187
|
+
usdAvailableAmount,
|
|
37188
|
+
isCardCheckout,
|
|
37189
|
+
getMeldError,
|
|
37190
|
+
aaveSupply.error
|
|
37191
|
+
]);
|
|
37192
|
+
const handleContinue = async (assetAmount2, tokenAmountBaseUnit, fiatAmountOverride) => {
|
|
36932
37193
|
if (assetAmount2 === void 0) {
|
|
36933
37194
|
return;
|
|
36934
37195
|
}
|
|
37196
|
+
if (isAaveNativeFastPath) {
|
|
37197
|
+
logger.info("checkoutFlow:aaveNativeFastPath:selected", {
|
|
37198
|
+
targetChain: checkoutConfig.targetChain,
|
|
37199
|
+
targetAsset: checkoutConfig.targetAsset,
|
|
37200
|
+
sourceChainId: sourceHolding?.pickedChainId,
|
|
37201
|
+
sourceTokenAddress: sourceHolding?.tokenAddress,
|
|
37202
|
+
assetAmount: assetAmount2
|
|
37203
|
+
});
|
|
37204
|
+
updateTargetAssetAmount(
|
|
37205
|
+
assetAmount2,
|
|
37206
|
+
fiatAmountOverride ?? fiatAmount,
|
|
37207
|
+
tokenAmountBaseUnit?.[0] ?? void 0
|
|
37208
|
+
);
|
|
37209
|
+
const amountString = formatSupplyAmount(
|
|
37210
|
+
tokenAmountBaseUnit ?? null,
|
|
37211
|
+
assetAmount2
|
|
37212
|
+
);
|
|
37213
|
+
const result = await aaveSupply.submit(amountString);
|
|
37214
|
+
if (result) {
|
|
37215
|
+
onNext({
|
|
37216
|
+
nextStep: "checkout_complete" /* CHECKOUT_COMPLETE */,
|
|
37217
|
+
txHash: result.txHash
|
|
37218
|
+
});
|
|
37219
|
+
}
|
|
37220
|
+
return;
|
|
37221
|
+
}
|
|
36935
37222
|
if (!meldEnabled) {
|
|
36936
37223
|
updateTargetAssetAmount(
|
|
36937
37224
|
assetAmount2,
|
|
36938
37225
|
fiatAmountOverride ?? fiatAmount,
|
|
36939
|
-
|
|
37226
|
+
tokenAmountBaseUnit?.[0] ?? void 0
|
|
36940
37227
|
);
|
|
36941
37228
|
onNext({});
|
|
36942
37229
|
return;
|
|
@@ -36946,7 +37233,7 @@ function InputAmountLoaded({
|
|
|
36946
37233
|
const autoConfirm = (newState) => {
|
|
36947
37234
|
handleContinue(
|
|
36948
37235
|
newState.assetAmount,
|
|
36949
|
-
newState.tokenAmountBaseUnit
|
|
37236
|
+
newState.tokenAmountBaseUnit ?? null,
|
|
36950
37237
|
newState.fiatAmount
|
|
36951
37238
|
);
|
|
36952
37239
|
};
|
|
@@ -36954,7 +37241,7 @@ function InputAmountLoaded({
|
|
|
36954
37241
|
if (!suggestion) {
|
|
36955
37242
|
return handleContinue(
|
|
36956
37243
|
assetAmount,
|
|
36957
|
-
amountInputResult.tokenAmountBaseUnit
|
|
37244
|
+
amountInputResult.tokenAmountBaseUnit ?? null
|
|
36958
37245
|
);
|
|
36959
37246
|
}
|
|
36960
37247
|
if (inputError?.type === "aboveAvailable") {
|
|
@@ -36982,8 +37269,8 @@ function InputAmountLoaded({
|
|
|
36982
37269
|
actionButtonProps: {
|
|
36983
37270
|
title: suggestion?.buttonLabel ?? t("common.continue"),
|
|
36984
37271
|
onClick: handleSubmit,
|
|
36985
|
-
isDisabled: !isValid && !suggestion || isMeldContinueDisabled,
|
|
36986
|
-
isLoading: isMeldLinkPending
|
|
37272
|
+
isDisabled: !isValid && !suggestion || isMeldContinueDisabled || aaveSupply.isPending,
|
|
37273
|
+
isLoading: isMeldLinkPending || aaveSupply.isPending
|
|
36987
37274
|
},
|
|
36988
37275
|
fiatCurrencySelector: meldEnabled && /* @__PURE__ */ React205.createElement(
|
|
36989
37276
|
CurrencySelector,
|
|
@@ -37025,7 +37312,8 @@ function InputAmountLoaded({
|
|
|
37025
37312
|
targetChainId: modalState.targetChainId,
|
|
37026
37313
|
textCustomizations,
|
|
37027
37314
|
checkoutConfig,
|
|
37028
|
-
isChainIconHidden: isBrokerageCheckout
|
|
37315
|
+
isChainIconHidden: isBrokerageCheckout,
|
|
37316
|
+
forceShowYouPaySection: isAaveNativeFastPath
|
|
37029
37317
|
}
|
|
37030
37318
|
),
|
|
37031
37319
|
error
|
|
@@ -37304,7 +37592,8 @@ function YouPayYouReceiveWrapper({
|
|
|
37304
37592
|
targetChainId,
|
|
37305
37593
|
checkoutConfig,
|
|
37306
37594
|
textCustomizations,
|
|
37307
|
-
isChainIconHidden
|
|
37595
|
+
isChainIconHidden,
|
|
37596
|
+
forceShowYouPaySection
|
|
37308
37597
|
}) {
|
|
37309
37598
|
const {
|
|
37310
37599
|
targetAssetTicker,
|
|
@@ -37322,7 +37611,7 @@ function YouPayYouReceiveWrapper({
|
|
|
37322
37611
|
const showYouPayYouReceive = Boolean(
|
|
37323
37612
|
sourceAssetSymbol && sourceAssetIconSrc && targetAssetTicker && targetIconSrc
|
|
37324
37613
|
);
|
|
37325
|
-
const youPayYouReceiveShowYouPaySection = !isTokenEquivalent5({
|
|
37614
|
+
const youPayYouReceiveShowYouPaySection = forceShowYouPaySection || !isTokenEquivalent5({
|
|
37326
37615
|
firstTokenChainId: sourceAssetChainId?.toString() || "",
|
|
37327
37616
|
firstTokenAddress: sourceAssetAddress?.toString() || "",
|
|
37328
37617
|
secondTokenChainId: targetChainId,
|
|
@@ -37494,6 +37783,19 @@ var InputAmountInfo = {
|
|
|
37494
37783
|
paymentMethodInfo: null
|
|
37495
37784
|
};
|
|
37496
37785
|
}
|
|
37786
|
+
if (payload.nextStep === "checkout_complete" /* CHECKOUT_COMPLETE */) {
|
|
37787
|
+
return {
|
|
37788
|
+
...common,
|
|
37789
|
+
step: "checkout_complete" /* CHECKOUT_COMPLETE */,
|
|
37790
|
+
// CheckoutCompleteState.depositAddress is a misnomer — for
|
|
37791
|
+
// direct-execution flows (Aave native, brokerage, account-balance)
|
|
37792
|
+
// it carries the tx hash rather than a real deposit address.
|
|
37793
|
+
// FunkitCheckoutContext's startDirectExecutionCheckout already
|
|
37794
|
+
// names its local `depositAddressOrHash: Address | Hex` to
|
|
37795
|
+
// acknowledge this. Wider rename tracked in ENG-3966.
|
|
37796
|
+
depositAddress: payload.txHash
|
|
37797
|
+
};
|
|
37798
|
+
}
|
|
37497
37799
|
if (state.paymentMethodInfo.paymentMethod === "card" /* CARD */ && payload.fiatCurrency) {
|
|
37498
37800
|
if (payload.nextStep === "meld_redirect" /* MELD_REDIRECT */ && payload.quote) {
|
|
37499
37801
|
return {
|
|
@@ -38359,7 +38661,7 @@ function LoadingAccount({
|
|
|
38359
38661
|
|
|
38360
38662
|
// src/modals/CheckoutModal/MeldCurrencySelect/MeldCurrencySelect.tsx
|
|
38361
38663
|
import clsx20 from "clsx";
|
|
38362
|
-
import React217, { useMemo as useMemo56, useState as
|
|
38664
|
+
import React217, { useMemo as useMemo56, useState as useState63 } from "react";
|
|
38363
38665
|
|
|
38364
38666
|
// src/modals/CheckoutModal/MeldCurrencySelect/currenciesWithMultipleCountries.ts
|
|
38365
38667
|
var currenciesWithMultipleCountries = {
|
|
@@ -38416,8 +38718,8 @@ function MeldCurrencySelect({
|
|
|
38416
38718
|
const { t } = useFunkitTranslation();
|
|
38417
38719
|
const { defaultCurrency } = modalState;
|
|
38418
38720
|
const { data, isPending } = useMeldCurrencies();
|
|
38419
|
-
const [query, setQuery] =
|
|
38420
|
-
const [selectedCurrency, setSelectedCurrency] =
|
|
38721
|
+
const [query, setQuery] = useState63("");
|
|
38722
|
+
const [selectedCurrency, setSelectedCurrency] = useState63(
|
|
38421
38723
|
defaultCurrency
|
|
38422
38724
|
);
|
|
38423
38725
|
const filteredOptions = useMemo56(() => {
|
|
@@ -38620,10 +38922,10 @@ import React223, {
|
|
|
38620
38922
|
useEffect as useEffect55,
|
|
38621
38923
|
useLayoutEffect as useLayoutEffect2,
|
|
38622
38924
|
useMemo as useMemo58,
|
|
38623
|
-
useState as
|
|
38925
|
+
useState as useState64
|
|
38624
38926
|
} from "react";
|
|
38625
38927
|
import { createPortal as createPortal18 } from "react-dom";
|
|
38626
|
-
import { mainnet as
|
|
38928
|
+
import { mainnet as mainnet12 } from "viem/chains";
|
|
38627
38929
|
|
|
38628
38930
|
// src/hooks/useDynamicRoutes.ts
|
|
38629
38931
|
import { useMemo as useMemo57 } from "react";
|
|
@@ -39033,7 +39335,7 @@ function AccountSelectAsset({
|
|
|
39033
39335
|
const bottomSectionRef = useBottomSectionRef();
|
|
39034
39336
|
const { findPath } = useDynamicRoutes();
|
|
39035
39337
|
const { setSelectedBrokerageAsset } = useFunkitBrokerageContext();
|
|
39036
|
-
const [explicitlySelectedChainTokenSymbol, setSelectedChainTokenSymbol] =
|
|
39338
|
+
const [explicitlySelectedChainTokenSymbol, setSelectedChainTokenSymbol] = useState64("");
|
|
39037
39339
|
const checkoutConfig = checkoutItem?.initSettings.config;
|
|
39038
39340
|
const defaultTargetAsset = useMemo58(
|
|
39039
39341
|
() => getDefaultDynamicTargetAsset(checkoutConfig),
|
|
@@ -39268,7 +39570,7 @@ function isTreatedAsNativeToken(apiKey, asset, dynamicTargetAssetCandidates, fin
|
|
|
39268
39570
|
}
|
|
39269
39571
|
if (isEtherealCustomer(apiKey)) {
|
|
39270
39572
|
if (isTokenEquivalent6({
|
|
39271
|
-
firstTokenChainId:
|
|
39573
|
+
firstTokenChainId: mainnet12.id.toString(),
|
|
39272
39574
|
firstTokenAddress: "0x90d2af7d622ca3141efa4d8f1f24d86e5974cc8f",
|
|
39273
39575
|
// eUSDe (Ethereum)
|
|
39274
39576
|
secondTokenChainId: asset.pickedChainId,
|
|
@@ -39315,7 +39617,7 @@ import {
|
|
|
39315
39617
|
} from "@funkit/api-base";
|
|
39316
39618
|
import { LIGHTER_CHAIN_ID as LIGHTER_CHAIN_ID3 } from "@funkit/chains";
|
|
39317
39619
|
import { isTokenEquivalent as isTokenEquivalent7, noop as noop8 } from "@funkit/utils";
|
|
39318
|
-
import React233, { useEffect as useEffect59, useMemo as useMemo60, useRef as useRef28, useState as
|
|
39620
|
+
import React233, { useEffect as useEffect59, useMemo as useMemo60, useRef as useRef28, useState as useState66 } from "react";
|
|
39319
39621
|
import { createPortal as createPortal19 } from "react-dom";
|
|
39320
39622
|
|
|
39321
39623
|
// src/components/Dropdown/ReceiveTokenDropdown.tsx
|
|
@@ -39332,7 +39634,7 @@ var aprTag = (badgeText) => /* @__PURE__ */ React224.createElement(
|
|
|
39332
39634
|
);
|
|
39333
39635
|
var ReceiveTokenDropdown = ({
|
|
39334
39636
|
tokens,
|
|
39335
|
-
chainId,
|
|
39637
|
+
chainId: chainId2,
|
|
39336
39638
|
selectedToken,
|
|
39337
39639
|
onTokenSelected,
|
|
39338
39640
|
label,
|
|
@@ -39343,7 +39645,7 @@ var ReceiveTokenDropdown = ({
|
|
|
39343
39645
|
displayedChainId
|
|
39344
39646
|
}) => {
|
|
39345
39647
|
const allTokens = Array.from(new Set(Object.values(tokens).flat()));
|
|
39346
|
-
const patchedChainId = displayedChainId ??
|
|
39648
|
+
const patchedChainId = displayedChainId ?? chainId2;
|
|
39347
39649
|
const tokenBadgeText = tokens.find(
|
|
39348
39650
|
(token) => token.tokenSymbol === selectedToken
|
|
39349
39651
|
)?.badgeText;
|
|
@@ -39429,21 +39731,21 @@ import { useEffect as useEffect57 } from "react";
|
|
|
39429
39731
|
import { PaymentGroup as PaymentGroup2 } from "@funkit/api-base";
|
|
39430
39732
|
import React225, {
|
|
39431
39733
|
createContext as createContext19,
|
|
39432
|
-
useCallback as
|
|
39734
|
+
useCallback as useCallback44,
|
|
39433
39735
|
useContext as useContext19,
|
|
39434
39736
|
useEffect as useEffect56,
|
|
39435
39737
|
useMemo as useMemo59,
|
|
39436
39738
|
useRef as useRef27,
|
|
39437
|
-
useState as
|
|
39739
|
+
useState as useState65
|
|
39438
39740
|
} from "react";
|
|
39439
39741
|
var SwappedContext = createContext19(null);
|
|
39440
39742
|
function SwappedProvider({ children }) {
|
|
39441
39743
|
const { activeTheme, darkTheme: darkTheme2 } = useActiveTheme();
|
|
39442
39744
|
const isDarkMode = activeTheme === darkTheme2;
|
|
39443
39745
|
const { uiCustomizations } = useFunkitConfig();
|
|
39444
|
-
const [iframeUrl, setIframeUrl] =
|
|
39445
|
-
const [isActive, setIsActive] =
|
|
39446
|
-
const [isSwappedReady, setIsSwappedReady] =
|
|
39746
|
+
const [iframeUrl, setIframeUrl] = useState65(null);
|
|
39747
|
+
const [isActive, setIsActive] = useState65(false);
|
|
39748
|
+
const [isSwappedReady, setIsSwappedReady] = useState65(false);
|
|
39447
39749
|
const iframeRef = useRef27(null);
|
|
39448
39750
|
const activeFopTypeRef = useRef27(null);
|
|
39449
39751
|
const swappedTheme = useMemo59(() => {
|
|
@@ -39451,7 +39753,7 @@ function SwappedProvider({ children }) {
|
|
|
39451
39753
|
const theme = { ...activeTheme, customFontFamily };
|
|
39452
39754
|
return buildSwappedTheme(theme, isDarkMode);
|
|
39453
39755
|
}, [activeTheme, isDarkMode, uiCustomizations.customFontFamily]);
|
|
39454
|
-
const setIframeRef =
|
|
39756
|
+
const setIframeRef = useCallback44((el) => {
|
|
39455
39757
|
iframeRef.current = el;
|
|
39456
39758
|
}, []);
|
|
39457
39759
|
const sendSwappedPaymentMethod = useEffectEvent(
|
|
@@ -39484,7 +39786,7 @@ function SwappedProvider({ children }) {
|
|
|
39484
39786
|
contentWindow.postMessage(msg, targetOrigin);
|
|
39485
39787
|
logger.info("swapped-provider:focusAmountInput", { postMessage: msg });
|
|
39486
39788
|
});
|
|
39487
|
-
const activateIframe =
|
|
39789
|
+
const activateIframe = useCallback44(
|
|
39488
39790
|
(fopType) => {
|
|
39489
39791
|
setIsActive(true);
|
|
39490
39792
|
activeFopTypeRef.current = fopType;
|
|
@@ -39492,10 +39794,10 @@ function SwappedProvider({ children }) {
|
|
|
39492
39794
|
},
|
|
39493
39795
|
[sendSwappedPaymentMethod]
|
|
39494
39796
|
);
|
|
39495
|
-
const deactivateIframe =
|
|
39797
|
+
const deactivateIframe = useCallback44(() => {
|
|
39496
39798
|
setIsActive(false);
|
|
39497
39799
|
}, []);
|
|
39498
|
-
const resetIframe =
|
|
39800
|
+
const resetIframe = useCallback44(() => {
|
|
39499
39801
|
setIsSwappedReady(false);
|
|
39500
39802
|
setIsActive(false);
|
|
39501
39803
|
setIframeUrl(null);
|
|
@@ -39756,7 +40058,7 @@ function GroupedList({
|
|
|
39756
40058
|
|
|
39757
40059
|
// src/modals/CheckoutModal/SourceChange/PayPal.tsx
|
|
39758
40060
|
import { MeldServiceProvider as MeldServiceProvider3 } from "@funkit/api-base";
|
|
39759
|
-
import React230, { useCallback as
|
|
40061
|
+
import React230, { useCallback as useCallback45 } from "react";
|
|
39760
40062
|
function PayPal() {
|
|
39761
40063
|
const { apiKey } = useFunkitConfig();
|
|
39762
40064
|
const { data: defaultCurrency } = useMeldDefaultCurrency("card" /* CARD */);
|
|
@@ -39768,7 +40070,7 @@ function PayPal() {
|
|
|
39768
40070
|
const isMeldEnabled = useIsMeldEnabled();
|
|
39769
40071
|
const { checkoutItem } = useCheckoutContext();
|
|
39770
40072
|
const isPaypalReady = false;
|
|
39771
|
-
const onClick =
|
|
40073
|
+
const onClick = useCallback45(() => {
|
|
39772
40074
|
if (isMeldEnabled && isPaypalReady) {
|
|
39773
40075
|
openMeldPopup(() => mutateAsync(MeldServiceProvider3.PAYPAL));
|
|
39774
40076
|
} else {
|
|
@@ -40041,22 +40343,23 @@ function SourceChange({
|
|
|
40041
40343
|
const isSavedCardDefaultsToFiatTabEnabled = useFeatureGate(
|
|
40042
40344
|
"saved-card-defaults-to-fiat-tab"
|
|
40043
40345
|
);
|
|
40044
|
-
const
|
|
40346
|
+
const isFreeUsdcBannerEnabled = useFeatureGate("enable-free-usdc-banner");
|
|
40347
|
+
const [selectedFop, setSelectedFop] = useState66(
|
|
40045
40348
|
null
|
|
40046
40349
|
);
|
|
40047
|
-
const [connectedSource, setConnectedSource] =
|
|
40048
|
-
const [newSource, setNewSource] =
|
|
40049
|
-
const [defaultTab] =
|
|
40350
|
+
const [connectedSource, setConnectedSource] = useState66(paymentMethodInfo);
|
|
40351
|
+
const [newSource, setNewSource] = useState66();
|
|
40352
|
+
const [defaultTab] = useState66(
|
|
40050
40353
|
isSavedCardDefaultsToFiatTabEnabled && hasSavedFops ? "fiat" : "crypto"
|
|
40051
40354
|
);
|
|
40052
|
-
const [paymentMethodTab, setPaymentMethodTab] =
|
|
40355
|
+
const [paymentMethodTab, setPaymentMethodTab] = useState66(
|
|
40053
40356
|
modalState.paymentMethodTypeFilter ?? defaultTab
|
|
40054
40357
|
);
|
|
40055
|
-
const [leavingTab, setLeavingTab] =
|
|
40358
|
+
const [leavingTab, setLeavingTab] = useState66(null);
|
|
40056
40359
|
const isTabTransitionReversed = leavingTab !== defaultTab;
|
|
40057
40360
|
const leavingClass = isTabTransitionReversed ? tabSlideContentOutReverse : tabSlideContentOut;
|
|
40058
40361
|
const enteringClass = isTabTransitionReversed ? tabSlideContentInReverse : tabSlideContentIn;
|
|
40059
|
-
const [selectedTargetAsset, setSelectedTargetAsset] =
|
|
40362
|
+
const [selectedTargetAsset, setSelectedTargetAsset] = useState66(
|
|
40060
40363
|
() => getDefaultDynamicTargetAsset(checkoutConfig)
|
|
40061
40364
|
);
|
|
40062
40365
|
const { isFallback, preferred, moreSources, unavailable } = usePaymentSources(
|
|
@@ -40384,6 +40687,7 @@ function SourceChange({
|
|
|
40384
40687
|
onTabChange: handlePaymentMethodTabChange
|
|
40385
40688
|
}
|
|
40386
40689
|
),
|
|
40690
|
+
isFreeUsdcBannerEnabled && (paymentMethodTab === "crypto" || !isSwappedEnabled) && /* @__PURE__ */ React233.createElement(FreeUsdcBanner, { type: "deposit" }),
|
|
40387
40691
|
isUnderComplianceReview && /* @__PURE__ */ React233.createElement(ComplianceReviewBanner, { checkoutId: modalState.checkoutId })
|
|
40388
40692
|
), isSwappedEnabled && paymentMethodTab === "fiat" && /* @__PURE__ */ React233.createElement(
|
|
40389
40693
|
FunDivider,
|
|
@@ -40881,18 +41185,18 @@ function trackEventForFormOfPayment(fop, checkoutItem, eventName, extras) {
|
|
|
40881
41185
|
|
|
40882
41186
|
// src/modals/CheckoutModal/TransferToken/TransferToken.tsx
|
|
40883
41187
|
import { motion as motion13, useAnimationControls as useAnimationControls3 } from "motion/react";
|
|
40884
|
-
import React245, { useRef as useRef32, useState as
|
|
41188
|
+
import React245, { useRef as useRef32, useState as useState70 } from "react";
|
|
40885
41189
|
import { createPortal as createPortal21 } from "react-dom";
|
|
40886
41190
|
|
|
40887
41191
|
// src/components/CopyAddress/CopyInputDisplayedAddress.tsx
|
|
40888
41192
|
import { truncateMiddleOfAddress } from "@funkit/utils";
|
|
40889
|
-
import React236, { useCallback as
|
|
41193
|
+
import React236, { useCallback as useCallback47, useState as useState68 } from "react";
|
|
40890
41194
|
|
|
40891
41195
|
// src/hooks/useCopyToClipboard.ts
|
|
40892
|
-
import { useCallback as
|
|
41196
|
+
import { useCallback as useCallback46, useEffect as useEffect62, useState as useState67 } from "react";
|
|
40893
41197
|
var useCopyToClipboard = (text, delay = 1500) => {
|
|
40894
|
-
const [isCopied, setCopied] =
|
|
40895
|
-
const handleCopy =
|
|
41198
|
+
const [isCopied, setCopied] = useState67(false);
|
|
41199
|
+
const handleCopy = useCallback46(() => {
|
|
40896
41200
|
if (!text) {
|
|
40897
41201
|
return;
|
|
40898
41202
|
}
|
|
@@ -40916,24 +41220,30 @@ var copyButtonIconActive = "_1kbzei96 _1kbzei94";
|
|
|
40916
41220
|
var copyButtonIconBase = "_1kbzei95";
|
|
40917
41221
|
var copyButtonWrapper = "_1rsrm2fa _1rsrm2f4 _1rsrm2f1z _1rsrm2f2c6 _1rsrm2f2cd _1rsrm2f1j _1rsrm2fu _1rsrm2f1f";
|
|
40918
41222
|
var copyInputText = "_1kbzei9a";
|
|
40919
|
-
var copyInputTextActive = "_1kbzei9d
|
|
41223
|
+
var copyInputTextActive = "_1kbzei9e _1kbzei9d";
|
|
40920
41224
|
var copyInputTextBox = "_1kbzei98 _1rsrm2fa _1rsrm2f4 _1rsrm2f83 _1rsrm2f4g";
|
|
40921
41225
|
var copyInputTextBoxActive = "_1kbzei99 _1kbzei98 _1rsrm2fa _1rsrm2f4 _1rsrm2f83 _1rsrm2f4g";
|
|
40922
|
-
var copyInputTextDefault = "
|
|
40923
|
-
var copyInputTextWrapper = "
|
|
40924
|
-
var
|
|
40925
|
-
var
|
|
41226
|
+
var copyInputTextDefault = "_1kbzei9d";
|
|
41227
|
+
var copyInputTextWrapper = "_1kbzei9c";
|
|
41228
|
+
var displayedAddressText = "_1kbzei9b";
|
|
41229
|
+
var textIn = "_1kbzei9g";
|
|
41230
|
+
var textOut = "_1kbzei9f";
|
|
40926
41231
|
|
|
40927
41232
|
// src/components/CopyAddress/CopyInputDisplayedAddress.tsx
|
|
41233
|
+
var COPY_LABEL_I18N_KEY = {
|
|
41234
|
+
address: "common.copyAddress",
|
|
41235
|
+
invoice: "common.copyInvoice"
|
|
41236
|
+
};
|
|
40928
41237
|
function CopyInputDisplayedAddressEN({
|
|
40929
41238
|
address,
|
|
40930
41239
|
onAddressCopied,
|
|
40931
|
-
truncateAddress = false
|
|
41240
|
+
truncateAddress = false,
|
|
41241
|
+
label = "address"
|
|
40932
41242
|
}) {
|
|
40933
41243
|
const { handleCopy } = useCopyToClipboard(address);
|
|
40934
|
-
const [isActive, setIsActive] =
|
|
41244
|
+
const [isActive, setIsActive] = useState68(null);
|
|
40935
41245
|
const displayAddress = truncateAddress ? truncateMiddleOfAddress(address, 40, 24, 8) : address;
|
|
40936
|
-
const handleClick =
|
|
41246
|
+
const handleClick = useCallback47(() => {
|
|
40937
41247
|
if (isActive) {
|
|
40938
41248
|
return;
|
|
40939
41249
|
}
|
|
@@ -40944,21 +41254,19 @@ function CopyInputDisplayedAddressEN({
|
|
|
40944
41254
|
}, 2e3);
|
|
40945
41255
|
handleCopy();
|
|
40946
41256
|
}, [isActive, handleCopy, onAddressCopied]);
|
|
40947
|
-
return /* @__PURE__ */ React236.createElement(Box, { className: copyButtonWrapper }, /* @__PURE__ */ React236.createElement(Box, { paddingY: "8", paddingX: "12", width: "full" }, /* @__PURE__ */ React236.createElement(Text, { size: "depositAddressFontSize" }, displayAddress)), /* @__PURE__ */ React236.createElement(FunDivider, { borderColor: "mediumStroke" }), /* @__PURE__ */ React236.createElement(Box, { as: "button", onClick: handleClick, className: copyButton }, /* @__PURE__ */ React236.createElement("div", { className: isActive ? copyInputTextBoxActive : copyInputTextBox }, /* @__PURE__ */ React236.createElement("div", { className: isActive ? copyButtonIconActive : copyButtonIcon }, /* @__PURE__ */ React236.createElement(CheckIcon, { className: copyButtonIconBase })), /* @__PURE__ */ React236.createElement(Text, { size: "inputLabel", weight: "inputLabel" }, /* @__PURE__ */ React236.createElement("div", { className: copyInputText }, /* @__PURE__ */ React236.createElement("span", null, "Cop"), /* @__PURE__ */ React236.createElement("span", { className: copyInputTextWrapper }, ["y", " ", "
|
|
40948
|
-
|
|
40949
|
-
|
|
40950
|
-
|
|
40951
|
-
|
|
40952
|
-
|
|
40953
|
-
|
|
40954
|
-
|
|
40955
|
-
|
|
40956
|
-
|
|
40957
|
-
|
|
40958
|
-
|
|
40959
|
-
|
|
40960
|
-
)
|
|
40961
|
-
), ["ied"].map((char, i) => /* @__PURE__ */ React236.createElement(
|
|
41257
|
+
return /* @__PURE__ */ React236.createElement(Box, { className: copyButtonWrapper }, /* @__PURE__ */ React236.createElement(Box, { paddingY: "8", paddingX: "12", width: "full" }, /* @__PURE__ */ React236.createElement(Text, { size: "depositAddressFontSize", className: displayedAddressText }, displayAddress)), /* @__PURE__ */ React236.createElement(FunDivider, { borderColor: "mediumStroke" }), /* @__PURE__ */ React236.createElement(Box, { as: "button", onClick: handleClick, className: copyButton }, /* @__PURE__ */ React236.createElement("div", { className: isActive ? copyInputTextBoxActive : copyInputTextBox }, /* @__PURE__ */ React236.createElement("div", { className: isActive ? copyButtonIconActive : copyButtonIcon }, /* @__PURE__ */ React236.createElement(CheckIcon, { className: copyButtonIconBase })), /* @__PURE__ */ React236.createElement(Text, { size: "inputLabel", weight: "inputLabel" }, /* @__PURE__ */ React236.createElement("div", { className: copyInputText }, /* @__PURE__ */ React236.createElement("span", null, "Cop"), /* @__PURE__ */ React236.createElement("span", { className: copyInputTextWrapper }, ["y", " ", ...label.split("")].map((char, i) => /* @__PURE__ */ React236.createElement(
|
|
41258
|
+
"span",
|
|
41259
|
+
{
|
|
41260
|
+
className: copyInputTextDefault,
|
|
41261
|
+
key: `${char}-${i}`,
|
|
41262
|
+
style: {
|
|
41263
|
+
"--animation-name": isActive === null ? "none" : isActive ? textOut : textIn,
|
|
41264
|
+
"--animation-delay": `${i * 0.03 * (isActive ? 1 : i * 0.025) + (!isActive ? 0.05 : 0)}s`,
|
|
41265
|
+
"--animation-opacity": isActive === false ? "0" : "1"
|
|
41266
|
+
}
|
|
41267
|
+
},
|
|
41268
|
+
char === " " ? /* @__PURE__ */ React236.createElement(React236.Fragment, null, "\xA0") : char
|
|
41269
|
+
)), ["ied"].map((char, i) => /* @__PURE__ */ React236.createElement(
|
|
40962
41270
|
"span",
|
|
40963
41271
|
{
|
|
40964
41272
|
className: copyInputTextActive,
|
|
@@ -40974,13 +41282,16 @@ function CopyInputDisplayedAddressEN({
|
|
|
40974
41282
|
}
|
|
40975
41283
|
function CopyInputDisplayedAddressI18n({
|
|
40976
41284
|
address,
|
|
40977
|
-
truncateAddress = false
|
|
41285
|
+
truncateAddress = false,
|
|
41286
|
+
label = "address"
|
|
40978
41287
|
}) {
|
|
40979
41288
|
const { t } = useFunkitTranslation();
|
|
40980
41289
|
const { handleCopy } = useCopyToClipboard(address);
|
|
40981
|
-
const [isActive, setIsActive] =
|
|
41290
|
+
const [isActive, setIsActive] = useState68(null);
|
|
41291
|
+
const copyLabelI18nKey = COPY_LABEL_I18N_KEY[label];
|
|
41292
|
+
const buttonText = isActive ? t("common.copied") : t(copyLabelI18nKey);
|
|
40982
41293
|
const displayAddress = truncateAddress ? truncateMiddleOfAddress(address, 40, 24, 8) : address;
|
|
40983
|
-
const handleClick =
|
|
41294
|
+
const handleClick = useCallback47(() => {
|
|
40984
41295
|
if (isActive) {
|
|
40985
41296
|
return;
|
|
40986
41297
|
}
|
|
@@ -40990,8 +41301,7 @@ function CopyInputDisplayedAddressI18n({
|
|
|
40990
41301
|
}, 2e3);
|
|
40991
41302
|
handleCopy();
|
|
40992
41303
|
}, [isActive, handleCopy]);
|
|
40993
|
-
|
|
40994
|
-
return /* @__PURE__ */ React236.createElement(Box, { className: copyButtonWrapper }, /* @__PURE__ */ React236.createElement(Box, { paddingY: "8", paddingX: "12", width: "full" }, /* @__PURE__ */ React236.createElement(Text, { size: "depositAddressFontSize" }, displayAddress)), /* @__PURE__ */ React236.createElement(FunDivider, { borderColor: "mediumStroke" }), /* @__PURE__ */ React236.createElement(Box, { as: "button", onClick: handleClick, className: copyButton }, /* @__PURE__ */ React236.createElement("div", { className: copyInputTextBox }, /* @__PURE__ */ React236.createElement("div", { className: copyButtonIcon }, /* @__PURE__ */ React236.createElement(CheckIcon, { className: copyButtonIconBase })), /* @__PURE__ */ React236.createElement(Text, { size: "inputLabel", weight: "inputLabel" }, /* @__PURE__ */ React236.createElement("div", { className: copyInputText }, buttonText)))));
|
|
41304
|
+
return /* @__PURE__ */ React236.createElement(Box, { className: copyButtonWrapper }, /* @__PURE__ */ React236.createElement(Box, { paddingY: "8", paddingX: "12", width: "full" }, /* @__PURE__ */ React236.createElement(Text, { size: "depositAddressFontSize", className: displayedAddressText }, displayAddress)), /* @__PURE__ */ React236.createElement(FunDivider, { borderColor: "mediumStroke" }), /* @__PURE__ */ React236.createElement(Box, { as: "button", onClick: handleClick, className: copyButton }, /* @__PURE__ */ React236.createElement("div", { className: copyInputTextBox }, /* @__PURE__ */ React236.createElement("div", { className: copyButtonIcon }, /* @__PURE__ */ React236.createElement(CheckIcon, { className: copyButtonIconBase })), /* @__PURE__ */ React236.createElement(Text, { size: "inputLabel", weight: "inputLabel" }, /* @__PURE__ */ React236.createElement("div", { className: copyInputText }, buttonText)))));
|
|
40995
41305
|
}
|
|
40996
41306
|
function CopyInputDisplayedAddress(props) {
|
|
40997
41307
|
const { i18n: i18n2 } = useFunkitTranslation();
|
|
@@ -41240,7 +41550,7 @@ var SpeedometerIcon = () => {
|
|
|
41240
41550
|
|
|
41241
41551
|
// src/components/FunFeatureList/FunFeatureList.tsx
|
|
41242
41552
|
import { motion as motion12, useAnimationControls as useAnimationControls2 } from "motion/react";
|
|
41243
|
-
import React242, { useState as
|
|
41553
|
+
import React242, { useState as useState69 } from "react";
|
|
41244
41554
|
|
|
41245
41555
|
// src/components/FunFeatureList/FunFeatureList.css.ts
|
|
41246
41556
|
var detailsButton = "_1045qr71 _1rsrm2fpr _1rsrm2frr _1rsrm2ftn _1rsrm2fnn _1rsrm2fwv _1rsrm2fa _1rsrm2f4 _1rsrm2f84 _1rsrm2fu";
|
|
@@ -41323,8 +41633,8 @@ var FunFeatureList = ({
|
|
|
41323
41633
|
gapBetweenItems = "6",
|
|
41324
41634
|
onExpanded
|
|
41325
41635
|
}) => {
|
|
41326
|
-
const [isExpanded, setIsExpanded] =
|
|
41327
|
-
const [isDisplayed, setIsDisplayed] =
|
|
41636
|
+
const [isExpanded, setIsExpanded] = useState69(false);
|
|
41637
|
+
const [isDisplayed, setIsDisplayed] = useState69();
|
|
41328
41638
|
const controls = useAnimationControls2();
|
|
41329
41639
|
const handleExpandToggle = async () => {
|
|
41330
41640
|
setIsDisplayed((value) => !value);
|
|
@@ -41577,7 +41887,7 @@ var TransferTokenDetails = ({
|
|
|
41577
41887
|
};
|
|
41578
41888
|
|
|
41579
41889
|
// src/modals/CheckoutModal/TransferToken/useTransferTokenTracking.ts
|
|
41580
|
-
import { useCallback as
|
|
41890
|
+
import { useCallback as useCallback48, useEffect as useEffect63, useRef as useRef31 } from "react";
|
|
41581
41891
|
|
|
41582
41892
|
// src/modals/CheckoutModal/TransferToken/CheckoutNotifications.track.ts
|
|
41583
41893
|
function getNotificationId(item) {
|
|
@@ -41683,7 +41993,7 @@ function useTransferTokenTracking({
|
|
|
41683
41993
|
});
|
|
41684
41994
|
}
|
|
41685
41995
|
}, [depositAddress, fromChainId, toChainId, toTokenAddress]);
|
|
41686
|
-
const trackAddressCopied =
|
|
41996
|
+
const trackAddressCopied = useCallback48(() => {
|
|
41687
41997
|
logEvent({
|
|
41688
41998
|
eventName: "fc::deposit::transfer::address::copied" /* DEPOSIT_TRANSFER_ADDRESS_COPIED */,
|
|
41689
41999
|
metadata: {
|
|
@@ -41692,7 +42002,7 @@ function useTransferTokenTracking({
|
|
|
41692
42002
|
}
|
|
41693
42003
|
});
|
|
41694
42004
|
}, [fromChainId, fromTokenSymbol, logEvent]);
|
|
41695
|
-
const trackImpactExpanded =
|
|
42005
|
+
const trackImpactExpanded = useCallback48(
|
|
41696
42006
|
(estPriceImpactPct) => {
|
|
41697
42007
|
logEvent({
|
|
41698
42008
|
eventName: "fc::deposit::transfer::impact::viewed" /* DEPOSIT_TRANSFER_IMPACT_VIEWED */,
|
|
@@ -41705,7 +42015,7 @@ function useTransferTokenTracking({
|
|
|
41705
42015
|
},
|
|
41706
42016
|
[fromChainId, fromTokenSymbol, logEvent]
|
|
41707
42017
|
);
|
|
41708
|
-
const trackSourceChainChange =
|
|
42018
|
+
const trackSourceChainChange = useCallback48(
|
|
41709
42019
|
(newChainId) => {
|
|
41710
42020
|
if (newChainId === fromChainId) {
|
|
41711
42021
|
return;
|
|
@@ -41721,7 +42031,7 @@ function useTransferTokenTracking({
|
|
|
41721
42031
|
},
|
|
41722
42032
|
[fromChainId, fromTokenSymbol, logEvent]
|
|
41723
42033
|
);
|
|
41724
|
-
const trackSourceTokenChange =
|
|
42034
|
+
const trackSourceTokenChange = useCallback48(
|
|
41725
42035
|
(newTokenSymbol) => {
|
|
41726
42036
|
if (newTokenSymbol === fromTokenSymbol) {
|
|
41727
42037
|
return;
|
|
@@ -41813,7 +42123,7 @@ function useNotificationTracking({
|
|
|
41813
42123
|
}
|
|
41814
42124
|
}
|
|
41815
42125
|
}, [logEvent, status]);
|
|
41816
|
-
const trackDismissal =
|
|
42126
|
+
const trackDismissal = useCallback48(() => {
|
|
41817
42127
|
if (!itemRef.current || !notificationDisplayedAtRef.current) {
|
|
41818
42128
|
return;
|
|
41819
42129
|
}
|
|
@@ -41826,7 +42136,7 @@ function useNotificationTracking({
|
|
|
41826
42136
|
);
|
|
41827
42137
|
reasonRef.current = "dismissed";
|
|
41828
42138
|
}, [logEvent]);
|
|
41829
|
-
const trackShowMore =
|
|
42139
|
+
const trackShowMore = useCallback48(() => {
|
|
41830
42140
|
if (!itemRef.current || !notificationDisplayedAtRef.current) {
|
|
41831
42141
|
return;
|
|
41832
42142
|
}
|
|
@@ -41926,7 +42236,7 @@ function TransferToken({
|
|
|
41926
42236
|
const { t } = useFunkitTranslation();
|
|
41927
42237
|
const controls = useAnimationControls3();
|
|
41928
42238
|
const udaParams = useUDAParams();
|
|
41929
|
-
const [qrCodeHover, setQrCodeHover] =
|
|
42239
|
+
const [qrCodeHover, setQrCodeHover] = useState70(false);
|
|
41930
42240
|
const isSourceNavWidgetEnabled = modalState.startingStep === "select_asset" /* SELECT_ASSET */;
|
|
41931
42241
|
const { textCustomizations, uiCustomizations } = useFunkitConfig();
|
|
41932
42242
|
const { checkoutItem } = useCheckoutContext();
|
|
@@ -42016,9 +42326,9 @@ function TransferToken({
|
|
|
42016
42326
|
};
|
|
42017
42327
|
function getDefaultTransferToken() {
|
|
42018
42328
|
const { defaultTokenSymbol, defaultChainId } = udaParams ?? {};
|
|
42019
|
-
const
|
|
42020
|
-
if (defaultTokenSymbol && !Number.isNaN(
|
|
42021
|
-
return { token: defaultTokenSymbol, chainId };
|
|
42329
|
+
const chainId2 = Number(defaultChainId);
|
|
42330
|
+
if (defaultTokenSymbol && !Number.isNaN(chainId2)) {
|
|
42331
|
+
return { token: defaultTokenSymbol, chainId: chainId2 };
|
|
42022
42332
|
}
|
|
42023
42333
|
return transferToken;
|
|
42024
42334
|
}
|
|
@@ -42074,31 +42384,31 @@ function TransferToken({
|
|
|
42074
42384
|
{
|
|
42075
42385
|
isLoading: isLoadingDepositAddress,
|
|
42076
42386
|
assets,
|
|
42077
|
-
onTokenSelected: (token,
|
|
42387
|
+
onTokenSelected: (token, chainId2, autoUpdate) => {
|
|
42078
42388
|
trackSourceTokenChange(token);
|
|
42079
42389
|
logger.log(`${TRANSFER_TOKEN_LOG_PREFIX}_changeToken`, {
|
|
42080
42390
|
previousToken: selectedToken,
|
|
42081
42391
|
newToken: token,
|
|
42082
42392
|
selectedChainId,
|
|
42083
42393
|
depositAddress,
|
|
42084
|
-
...
|
|
42394
|
+
...chainId2 !== selectedChainId && {
|
|
42085
42395
|
previousChainId: selectedChainId,
|
|
42086
|
-
newChainId:
|
|
42396
|
+
newChainId: chainId2
|
|
42087
42397
|
}
|
|
42088
42398
|
});
|
|
42089
|
-
handleTokenChange(token,
|
|
42399
|
+
handleTokenChange(token, chainId2, autoUpdate);
|
|
42090
42400
|
},
|
|
42091
|
-
onChainSelected: (
|
|
42092
|
-
if (
|
|
42093
|
-
trackSourceChainChange(String(
|
|
42401
|
+
onChainSelected: (chainId2, autoUpdate) => {
|
|
42402
|
+
if (chainId2 !== void 0) {
|
|
42403
|
+
trackSourceChainChange(String(chainId2));
|
|
42094
42404
|
logger.log(`${TRANSFER_TOKEN_LOG_PREFIX}_changeChain`, {
|
|
42095
42405
|
previousChainId: selectedChainId,
|
|
42096
|
-
newChainId:
|
|
42406
|
+
newChainId: chainId2,
|
|
42097
42407
|
selectedToken,
|
|
42098
42408
|
depositAddress
|
|
42099
42409
|
});
|
|
42100
42410
|
}
|
|
42101
|
-
handleChainChange(
|
|
42411
|
+
handleChainChange(chainId2, autoUpdate);
|
|
42102
42412
|
},
|
|
42103
42413
|
selectedToken,
|
|
42104
42414
|
selectedChainId,
|
|
@@ -42248,7 +42558,7 @@ function TransferToken({
|
|
|
42248
42558
|
}
|
|
42249
42559
|
|
|
42250
42560
|
// src/modals/CheckoutModal/VirtualFiatAccount/FiatAccountDetail.tsx
|
|
42251
|
-
import React250, { useState as
|
|
42561
|
+
import React250, { useState as useState71 } from "react";
|
|
42252
42562
|
|
|
42253
42563
|
// src/components/VirtualFiatAccount/AccountDetailsTab/AccountDetailsTab.tsx
|
|
42254
42564
|
import React249 from "react";
|
|
@@ -42500,8 +42810,8 @@ var AccountDetailsScreen = ({
|
|
|
42500
42810
|
const label = usePaymentMethodInfoLabel(paymentMethodInfo);
|
|
42501
42811
|
const { animation, animate } = useAnimatedNavigation(void 0);
|
|
42502
42812
|
const isSourceNavWidgetEnabled = modalState.startingStep === "select_asset" /* SELECT_ASSET */;
|
|
42503
|
-
const [activeTab, setActiveTab] =
|
|
42504
|
-
const [detailsExpanded, setDetailsExpanded] =
|
|
42813
|
+
const [activeTab, setActiveTab] = useState71(0);
|
|
42814
|
+
const [detailsExpanded, setDetailsExpanded] = useState71(false);
|
|
42505
42815
|
const { source_deposit_instructions: sourceDeposit } = matchingFiatAccount;
|
|
42506
42816
|
const handleTabChange = (index) => {
|
|
42507
42817
|
animate(() => setActiveTab(index), { reverse: index < activeTab });
|
|
@@ -42587,9 +42897,9 @@ var FiatAccountDetail = {
|
|
|
42587
42897
|
|
|
42588
42898
|
// src/modals/CheckoutModal/VirtualFiatAccount/KycIframe.tsx
|
|
42589
42899
|
import { BridgeCustomerStatus as BridgeCustomerStatus7 } from "@funkit/api-base";
|
|
42590
|
-
import React251, { useCallback as
|
|
42900
|
+
import React251, { useCallback as useCallback49, useEffect as useEffect64, useMemo as useMemo62, useState as useState72 } from "react";
|
|
42591
42901
|
function useIframeListener(listeners, expectedOrigin) {
|
|
42592
|
-
const handleMessage =
|
|
42902
|
+
const handleMessage = useCallback49(
|
|
42593
42903
|
(event) => {
|
|
42594
42904
|
if (!expectedOrigin || event.origin !== expectedOrigin) {
|
|
42595
42905
|
return;
|
|
@@ -42643,7 +42953,7 @@ function KycIframe({
|
|
|
42643
42953
|
const { textCustomizations } = useFunkitConfig();
|
|
42644
42954
|
const { clearVirtualFiatAccounts } = useClearFrogAccountsCache();
|
|
42645
42955
|
const { data: kycLink, isLoading: isLinkLoading } = useLoadKycLink(modalState);
|
|
42646
|
-
const [iframeLoading, setIframeLoading] =
|
|
42956
|
+
const [iframeLoading, setIframeLoading] = useState72(true);
|
|
42647
42957
|
const kycOrigin = useMemo62(() => {
|
|
42648
42958
|
try {
|
|
42649
42959
|
return kycLink ? new URL(kycLink).origin : null;
|
|
@@ -42801,7 +43111,7 @@ function initialState(checkoutItem) {
|
|
|
42801
43111
|
}
|
|
42802
43112
|
function useCheckoutModalTransition(checkoutItem, onClose) {
|
|
42803
43113
|
const { logEvent, logMeasuredEvent, startMeasuredEvent } = useTrack();
|
|
42804
|
-
const [modalState, setModalState] =
|
|
43114
|
+
const [modalState, setModalState] = useState73(() => initialState(checkoutItem));
|
|
42805
43115
|
const { isStepReady, ensureStepQueries } = useStepQueryReadiness(
|
|
42806
43116
|
logEvent,
|
|
42807
43117
|
logMeasuredEvent
|
|
@@ -42814,7 +43124,7 @@ function useCheckoutModalTransition(checkoutItem, onClose) {
|
|
|
42814
43124
|
useEffect65(() => {
|
|
42815
43125
|
ensureLoadingAccountScreen();
|
|
42816
43126
|
}, [ensureLoadingAccountScreen]);
|
|
42817
|
-
const trackNextState =
|
|
43127
|
+
const trackNextState = useCallback50(
|
|
42818
43128
|
(nextState) => {
|
|
42819
43129
|
const trackEvent = trackEventFromNextState(nextState);
|
|
42820
43130
|
logEvent(trackEvent);
|
|
@@ -42828,7 +43138,7 @@ function useCheckoutModalTransition(checkoutItem, onClose) {
|
|
|
42828
43138
|
const { clearCheckoutQuoteMessages } = useCheckoutQuoteNotification();
|
|
42829
43139
|
const { getCheckoutProgress } = useCheckoutContext();
|
|
42830
43140
|
const { softHide } = useSoftHiddenCheckout();
|
|
42831
|
-
const onCloseWrapper =
|
|
43141
|
+
const onCloseWrapper = useCallback50(
|
|
42832
43142
|
(options) => {
|
|
42833
43143
|
const normalizedIsNewDeposit = !!options?.isNewDeposit;
|
|
42834
43144
|
const metadata = {
|
|
@@ -42869,10 +43179,10 @@ function useCheckoutModalTransition(checkoutItem, onClose) {
|
|
|
42869
43179
|
]
|
|
42870
43180
|
);
|
|
42871
43181
|
const { animation, animate } = useAnimatedNavigation(void 0);
|
|
42872
|
-
const [stateHistory, setHistory] =
|
|
43182
|
+
const [stateHistory, setHistory] = useState73([]);
|
|
42873
43183
|
const prevStep = useRef33(null);
|
|
42874
43184
|
const hasHistoryEntry = stateHistory.length > 1;
|
|
42875
|
-
const onNext =
|
|
43185
|
+
const onNext = useCallback50(
|
|
42876
43186
|
(payload) => {
|
|
42877
43187
|
if (prevStep.current === modalState.step) {
|
|
42878
43188
|
return;
|
|
@@ -42916,7 +43226,7 @@ function useCheckoutModalTransition(checkoutItem, onClose) {
|
|
|
42916
43226
|
ensureStepQueries
|
|
42917
43227
|
]
|
|
42918
43228
|
);
|
|
42919
|
-
const onStepChange =
|
|
43229
|
+
const onStepChange = useCallback50(
|
|
42920
43230
|
(nextState) => {
|
|
42921
43231
|
if (prevStep.current === modalState.step) {
|
|
42922
43232
|
return;
|
|
@@ -42931,7 +43241,7 @@ function useCheckoutModalTransition(checkoutItem, onClose) {
|
|
|
42931
43241
|
},
|
|
42932
43242
|
[modalState, animate, trackNextState, ensureStepQueries]
|
|
42933
43243
|
);
|
|
42934
|
-
const onBack =
|
|
43244
|
+
const onBack = useCallback50(() => {
|
|
42935
43245
|
clearCheckoutQuoteMessages();
|
|
42936
43246
|
const backStepOverride = checkoutBackMap[modalState.step];
|
|
42937
43247
|
const prevState = [...stateHistory].reverse().find((s) => s.step === backStepOverride) ?? stateHistory[stateHistory.length - 1];
|
|
@@ -43043,7 +43353,7 @@ function useCheckoutModalTitle(depositAddress, defaultTitle) {
|
|
|
43043
43353
|
import { IN_PROGRESS_CHECKOUT_STATES as IN_PROGRESS_CHECKOUT_STATES2 } from "@funkit/api-base";
|
|
43044
43354
|
import { formatTimestampToDate, fullMonthNames } from "@funkit/utils";
|
|
43045
43355
|
import clsx22 from "clsx";
|
|
43046
|
-
import React262, { useEffect as useEffect67, useMemo as useMemo63, useRef as useRef35, useState as
|
|
43356
|
+
import React262, { useEffect as useEffect67, useMemo as useMemo63, useRef as useRef35, useState as useState75 } from "react";
|
|
43047
43357
|
import { Virtuoso } from "react-virtuoso";
|
|
43048
43358
|
|
|
43049
43359
|
// src/consts/layout.ts
|
|
@@ -43424,7 +43734,7 @@ var HomeTokenBalanceDisplayRowSkeleton = () => {
|
|
|
43424
43734
|
|
|
43425
43735
|
// src/modals/ProfileDetails/FunProfileViews/Home/ProfileTitleSection.tsx
|
|
43426
43736
|
import React261 from "react";
|
|
43427
|
-
import { useCallback as
|
|
43737
|
+
import { useCallback as useCallback51, useState as useState74 } from "react";
|
|
43428
43738
|
|
|
43429
43739
|
// src/components/FunSelect/FunClickOutside.tsx
|
|
43430
43740
|
import React258 from "react";
|
|
@@ -43516,8 +43826,8 @@ var ProfileTitleSection = ({
|
|
|
43516
43826
|
onClose
|
|
43517
43827
|
}) => {
|
|
43518
43828
|
const { t } = useFunkitTranslation();
|
|
43519
|
-
const [isDisconnectExpanded, setIsDisconnectExpanded] =
|
|
43520
|
-
const collapseDisconnect =
|
|
43829
|
+
const [isDisconnectExpanded, setIsDisconnectExpanded] = useState74(false);
|
|
43830
|
+
const collapseDisconnect = useCallback51(
|
|
43521
43831
|
() => setIsDisconnectExpanded(false),
|
|
43522
43832
|
[]
|
|
43523
43833
|
);
|
|
@@ -43607,7 +43917,7 @@ function Home({
|
|
|
43607
43917
|
animation
|
|
43608
43918
|
}) {
|
|
43609
43919
|
const { t } = useFunkitTranslation();
|
|
43610
|
-
const [selectedView, setSelectedView] =
|
|
43920
|
+
const [selectedView, setSelectedView] = useState75(defaultHomeTab);
|
|
43611
43921
|
const checkoutsListRef = useRef35(null);
|
|
43612
43922
|
const virtuosoParentRef = useRef35(null);
|
|
43613
43923
|
const account = useAccount();
|
|
@@ -43899,8 +44209,8 @@ var PROFILE_DETAILS_DIALOG_CONTENT_ID = "profile-details-dialog-content";
|
|
|
43899
44209
|
var HISTORY_BOTTOM_BAR_ID = "history-bottom-section";
|
|
43900
44210
|
function ProfileDetails({ onClose, defaultTab }) {
|
|
43901
44211
|
const { t } = useFunkitTranslation();
|
|
43902
|
-
const [view, setView] =
|
|
43903
|
-
const [selectedHomeTab, setSelectedHomeTab] =
|
|
44212
|
+
const [view, setView] = useState76(0 /* HOME */);
|
|
44213
|
+
const [selectedHomeTab, setSelectedHomeTab] = useState76(
|
|
43904
44214
|
defaultTab ?? "assets" /* ASSETS */
|
|
43905
44215
|
);
|
|
43906
44216
|
const {
|
|
@@ -43914,16 +44224,16 @@ function ProfileDetails({ onClose, defaultTab }) {
|
|
|
43914
44224
|
selectedPurchaseId || "0x",
|
|
43915
44225
|
DEFAULT_CHECKOUT_HISTORY_DETAIL_TITLE
|
|
43916
44226
|
);
|
|
43917
|
-
const [singleActivityPage, setSingleActivityPage] =
|
|
44227
|
+
const [singleActivityPage, setSingleActivityPage] = useState76(
|
|
43918
44228
|
selectedPurchaseInitView ?? "detail" /* DETAIL */
|
|
43919
44229
|
);
|
|
43920
|
-
const resetView =
|
|
44230
|
+
const resetView = useCallback52(() => {
|
|
43921
44231
|
setView(returnView ?? 0 /* HOME */);
|
|
43922
44232
|
setSelectedHomeTab("checkouts" /* CHECKOUTS */);
|
|
43923
44233
|
resetActivityTraversal();
|
|
43924
44234
|
}, [resetActivityTraversal, returnView]);
|
|
43925
44235
|
const { animation, animate } = useAnimatedNavigation(void 0);
|
|
43926
|
-
const onSelectActivityWrapper =
|
|
44236
|
+
const onSelectActivityWrapper = useCallback52(
|
|
43927
44237
|
(activity) => {
|
|
43928
44238
|
onSelectActivity({
|
|
43929
44239
|
...activity,
|
|
@@ -43960,7 +44270,7 @@ function ProfileDetails({ onClose, defaultTab }) {
|
|
|
43960
44270
|
const isHelpPage = singleActivityPage === "help" /* HELP */;
|
|
43961
44271
|
const isCheckoutDetailView = isSingleActivityView && singleActivityPage === "detail" /* DETAIL */;
|
|
43962
44272
|
const withDivider = isSingleActivityView ? isHelpPage ? "scroll" : "always" : void 0;
|
|
43963
|
-
const handleHelp =
|
|
44273
|
+
const handleHelp = useCallback52(() => {
|
|
43964
44274
|
animate(() => setSingleActivityPage("help" /* HELP */));
|
|
43965
44275
|
}, [animate]);
|
|
43966
44276
|
const { onScroll, topbar, withTopDivider } = useCustomStatusAnimationAboveTopbar({
|
|
@@ -44141,14 +44451,14 @@ function FunDot() {
|
|
|
44141
44451
|
|
|
44142
44452
|
// src/modals/ChainModal/Chain.tsx
|
|
44143
44453
|
function ChainLineItem({
|
|
44144
|
-
chainId,
|
|
44454
|
+
chainId: chainId2,
|
|
44145
44455
|
chainIconSize,
|
|
44146
44456
|
gap = "12",
|
|
44147
44457
|
hideChainName = false
|
|
44148
44458
|
}) {
|
|
44149
44459
|
const enabledChainMap = useFunkitConnectChainsById();
|
|
44150
|
-
const enabledChainItem = enabledChainMap?.[
|
|
44151
|
-
const chainItem = chainMetadataById[
|
|
44460
|
+
const enabledChainItem = enabledChainMap?.[chainId2];
|
|
44461
|
+
const chainItem = chainMetadataById[chainId2] || enabledChainItem;
|
|
44152
44462
|
if (!chainItem) {
|
|
44153
44463
|
return null;
|
|
44154
44464
|
}
|
|
@@ -44170,14 +44480,14 @@ function ChainLineItem({
|
|
|
44170
44480
|
height: chainIconSize,
|
|
44171
44481
|
src: chainItem.iconUrl ?? void 0,
|
|
44172
44482
|
width: chainIconSize,
|
|
44173
|
-
testId: `chain-option-${
|
|
44483
|
+
testId: `chain-option-${chainId2}-icon`
|
|
44174
44484
|
}
|
|
44175
44485
|
)),
|
|
44176
44486
|
!hideChainName ? /* @__PURE__ */ React271.createElement("div", null, chainItem.name) : null
|
|
44177
44487
|
);
|
|
44178
44488
|
}
|
|
44179
44489
|
var Chain = ({
|
|
44180
|
-
chainId,
|
|
44490
|
+
chainId: chainId2,
|
|
44181
44491
|
currentChainId,
|
|
44182
44492
|
switchChain,
|
|
44183
44493
|
chainIconSize,
|
|
@@ -44187,13 +44497,13 @@ var Chain = ({
|
|
|
44187
44497
|
const { t } = useFunkitTranslation();
|
|
44188
44498
|
const mobile = isMobile11();
|
|
44189
44499
|
const funkitConnectChains = useFunkitConnectChains();
|
|
44190
|
-
const isCurrentChain = currentChainId ===
|
|
44500
|
+
const isCurrentChain = currentChainId === chainId2 && !isLoading;
|
|
44191
44501
|
return /* @__PURE__ */ React271.createElement(Fragment3, null, /* @__PURE__ */ React271.createElement(
|
|
44192
44502
|
MenuButton,
|
|
44193
44503
|
{
|
|
44194
44504
|
currentlySelected: isCurrentChain,
|
|
44195
|
-
onClick: isCurrentChain ? void 0 : () => switchChain({ chainId }),
|
|
44196
|
-
testId: `chain-option-${
|
|
44505
|
+
onClick: isCurrentChain ? void 0 : () => switchChain({ chainId: chainId2 }),
|
|
44506
|
+
testId: `chain-option-${chainId2}`
|
|
44197
44507
|
},
|
|
44198
44508
|
/* @__PURE__ */ React271.createElement(Box, { fontFamily: "body", fontSize: "16", fontWeight: "bold" }, /* @__PURE__ */ React271.createElement(
|
|
44199
44509
|
Box,
|
|
@@ -44203,7 +44513,7 @@ var Chain = ({
|
|
|
44203
44513
|
flexDirection: "row",
|
|
44204
44514
|
justifyContent: "space-between"
|
|
44205
44515
|
},
|
|
44206
|
-
/* @__PURE__ */ React271.createElement(ChainLineItem, { chainId, chainIconSize }),
|
|
44516
|
+
/* @__PURE__ */ React271.createElement(ChainLineItem, { chainId: chainId2, chainIconSize }),
|
|
44207
44517
|
isCurrentChain && /* @__PURE__ */ React271.createElement(
|
|
44208
44518
|
Box,
|
|
44209
44519
|
{
|
|
@@ -44247,7 +44557,7 @@ var MobileScrollClassName = "_1d2b1vf1";
|
|
|
44247
44557
|
// src/modals/ChainModal/ChainModal.tsx
|
|
44248
44558
|
function ChainModal({ onClose, open }) {
|
|
44249
44559
|
const { t } = useFunkitTranslation();
|
|
44250
|
-
const { chainId } = useAccount();
|
|
44560
|
+
const { chainId: chainId2 } = useAccount();
|
|
44251
44561
|
const { chains } = useConfig();
|
|
44252
44562
|
const { switchChain, pendingChainId } = useFunkitSwitchChains({
|
|
44253
44563
|
onSettled: () => onClose()
|
|
@@ -44255,10 +44565,10 @@ function ChainModal({ onClose, open }) {
|
|
|
44255
44565
|
const { handleLogout } = useGeneralWallet();
|
|
44256
44566
|
const titleId = "rk_chain_modal_title";
|
|
44257
44567
|
const mobile = isMobile12();
|
|
44258
|
-
const isCurrentChainSupported = chains.some((chain) => chain.id ===
|
|
44568
|
+
const isCurrentChainSupported = chains.some((chain) => chain.id === chainId2);
|
|
44259
44569
|
const chainIconSize = mobile ? "36" : "28";
|
|
44260
44570
|
const funkitConnectChains = useFunkitConnectChains();
|
|
44261
|
-
if (!
|
|
44571
|
+
if (!chainId2) {
|
|
44262
44572
|
return null;
|
|
44263
44573
|
}
|
|
44264
44574
|
return /* @__PURE__ */ React272.createElement(
|
|
@@ -44305,7 +44615,7 @@ function ChainModal({ onClose, open }) {
|
|
|
44305
44615
|
{
|
|
44306
44616
|
key: id,
|
|
44307
44617
|
chainId: id,
|
|
44308
|
-
currentChainId:
|
|
44618
|
+
currentChainId: chainId2,
|
|
44309
44619
|
switchChain,
|
|
44310
44620
|
chainIconSize,
|
|
44311
44621
|
isLoading: pendingChainId === id,
|
|
@@ -44370,7 +44680,7 @@ import { LogLevel as LogLevel2, initializeRelayClient } from "@funkit/fun-relay"
|
|
|
44370
44680
|
import React287, { useEffect as useEffect75, useRef as useRef38 } from "react";
|
|
44371
44681
|
|
|
44372
44682
|
// src/components/FunConnectOptions/FunConnectOptions.tsx
|
|
44373
|
-
import React278, { useCallback as
|
|
44683
|
+
import React278, { useCallback as useCallback53, useMemo as useMemo64, useState as useState79 } from "react";
|
|
44374
44684
|
|
|
44375
44685
|
// src/components/FunConnectOptions/FunConnectResultStep.tsx
|
|
44376
44686
|
import React273, { useEffect as useEffect68 } from "react";
|
|
@@ -44444,7 +44754,7 @@ var FunConnectResultStep = ({
|
|
|
44444
44754
|
|
|
44445
44755
|
// src/components/FunConnectOptions/FunSignInStep.tsx
|
|
44446
44756
|
import { isMobile as isMobile13, isSafari as isSafari2, redirectInMobile } from "@funkit/utils";
|
|
44447
|
-
import React275, { useState as
|
|
44757
|
+
import React275, { useState as useState78 } from "react";
|
|
44448
44758
|
|
|
44449
44759
|
// src/wallets/latestWalletId.ts
|
|
44450
44760
|
var storageKey5 = "fkc-latest-id";
|
|
@@ -44453,7 +44763,7 @@ function addLatestWalletId(walletId) {
|
|
|
44453
44763
|
}
|
|
44454
44764
|
|
|
44455
44765
|
// src/components/ModalSelection/ModalSelection.tsx
|
|
44456
|
-
import React274, { useState as
|
|
44766
|
+
import React274, { useState as useState77 } from "react";
|
|
44457
44767
|
var ModalSelection = ({
|
|
44458
44768
|
as = "button",
|
|
44459
44769
|
currentlySelected = false,
|
|
@@ -44468,7 +44778,7 @@ var ModalSelection = ({
|
|
|
44468
44778
|
isFunkitSdkConnector: isFunkitSdkConnector2,
|
|
44469
44779
|
...urlProps
|
|
44470
44780
|
}) => {
|
|
44471
|
-
const [isMouseOver, setIsMouseOver] =
|
|
44781
|
+
const [isMouseOver, setIsMouseOver] = useState77(false);
|
|
44472
44782
|
const { t } = useFunkitTranslation();
|
|
44473
44783
|
return /* @__PURE__ */ React274.createElement(
|
|
44474
44784
|
Box,
|
|
@@ -44555,7 +44865,7 @@ function FunSignInStep({
|
|
|
44555
44865
|
connectToWallet,
|
|
44556
44866
|
setQrCodeUri
|
|
44557
44867
|
}) {
|
|
44558
|
-
const [selectedOptionId, setSelectedOptionId] =
|
|
44868
|
+
const [selectedOptionId, setSelectedOptionId] = useState78();
|
|
44559
44869
|
const wallets = usePreparedWalletConnectors();
|
|
44560
44870
|
const safari = isSafari2();
|
|
44561
44871
|
const onDesktopUri = async (wallet) => {
|
|
@@ -44735,10 +45045,10 @@ function FunConnectOptions({
|
|
|
44735
45045
|
onClose,
|
|
44736
45046
|
initialScreenOnBack
|
|
44737
45047
|
}) {
|
|
44738
|
-
const [step, setStep] =
|
|
44739
|
-
const [selectedWallet, setSelectedWallet] =
|
|
44740
|
-
const [qrCodeUri, setQrCodeUri] =
|
|
44741
|
-
const changeStep =
|
|
45048
|
+
const [step, setStep] = useState79(INITIAL_STEP);
|
|
45049
|
+
const [selectedWallet, setSelectedWallet] = useState79();
|
|
45050
|
+
const [qrCodeUri, setQrCodeUri] = useState79("");
|
|
45051
|
+
const changeStep = useCallback53((newStep) => {
|
|
44742
45052
|
setStep(newStep);
|
|
44743
45053
|
if (isSignIn(newStep)) {
|
|
44744
45054
|
setSelectedWallet(void 0);
|
|
@@ -44749,7 +45059,7 @@ function FunConnectOptions({
|
|
|
44749
45059
|
navigateTo(0 /* SIGNIN_PRIMARY */, { reverse: true });
|
|
44750
45060
|
};
|
|
44751
45061
|
const walletConnectors = usePreparedWalletConnectors();
|
|
44752
|
-
const onRegenerateQrCode =
|
|
45062
|
+
const onRegenerateQrCode = useCallback53(
|
|
44753
45063
|
async (wallet) => {
|
|
44754
45064
|
const sWallet = walletConnectors.find((w) => wallet.id === w.id);
|
|
44755
45065
|
const uri = await sWallet?.getQrCodeUri?.();
|
|
@@ -44757,7 +45067,7 @@ function FunConnectOptions({
|
|
|
44757
45067
|
},
|
|
44758
45068
|
[walletConnectors]
|
|
44759
45069
|
);
|
|
44760
|
-
const connectToWallet =
|
|
45070
|
+
const connectToWallet = useCallback53(
|
|
44761
45071
|
async (wallet) => {
|
|
44762
45072
|
if (!wallet.ready) {
|
|
44763
45073
|
return;
|
|
@@ -44776,7 +45086,7 @@ function FunConnectOptions({
|
|
|
44776
45086
|
},
|
|
44777
45087
|
[changeStep, onRegenerateQrCode]
|
|
44778
45088
|
);
|
|
44779
|
-
const handleRetry =
|
|
45089
|
+
const handleRetry = useCallback53(() => {
|
|
44780
45090
|
if (selectedWallet) {
|
|
44781
45091
|
changeStep(1 /* PENDING_WALLET */);
|
|
44782
45092
|
connectToWallet(selectedWallet);
|
|
@@ -44912,10 +45222,10 @@ var FunCheckoutBlocked = ({ reason }) => {
|
|
|
44912
45222
|
};
|
|
44913
45223
|
|
|
44914
45224
|
// src/modals/CheckoutModal/SwappedIframe/SwappedIframe.tsx
|
|
44915
|
-
import React280, { useEffect as useEffect69, useState as
|
|
45225
|
+
import React280, { useEffect as useEffect69, useState as useState80 } from "react";
|
|
44916
45226
|
var SwappedIframe = () => {
|
|
44917
45227
|
const { iframeUrl, isSwappedReady, isActive, setIframeRef } = useSwappedContext();
|
|
44918
|
-
const [visible, setVisible] =
|
|
45228
|
+
const [visible, setVisible] = useState80(false);
|
|
44919
45229
|
const shouldShow = isActive && isSwappedReady;
|
|
44920
45230
|
useEffect69(() => {
|
|
44921
45231
|
if (shouldShow) {
|
|
@@ -44973,7 +45283,7 @@ var SwappedIframe_default = React280.memo(SwappedIframe);
|
|
|
44973
45283
|
|
|
44974
45284
|
// src/modals/CheckoutModal/TransferToken/CheckoutNotifications.tsx
|
|
44975
45285
|
import clsx25 from "clsx";
|
|
44976
|
-
import React286, { useCallback as
|
|
45286
|
+
import React286, { useCallback as useCallback55, useEffect as useEffect73, useMemo as useMemo65, useState as useState82 } from "react";
|
|
44977
45287
|
|
|
44978
45288
|
// src/components/FunNotificationBanner/FunNotificationShowMoreButton.tsx
|
|
44979
45289
|
import React281 from "react";
|
|
@@ -45070,7 +45380,7 @@ import { Trans as Trans17 } from "react-i18next";
|
|
|
45070
45380
|
|
|
45071
45381
|
// src/components/FunNotificationBanner/FunNotificationBanner.tsx
|
|
45072
45382
|
import { AnimatePresence as AnimatePresence3, motion as motion15 } from "motion/react";
|
|
45073
|
-
import React283, { useEffect as useEffect72, useRef as useRef37, useState as
|
|
45383
|
+
import React283, { useEffect as useEffect72, useRef as useRef37, useState as useState81 } from "react";
|
|
45074
45384
|
import clsx24 from "clsx";
|
|
45075
45385
|
|
|
45076
45386
|
// src/components/FunNotificationBanner/FunNotificationBanner.css.ts
|
|
@@ -45080,7 +45390,7 @@ var showMoreButtonStyle = "_4yitd93 _1rsrm2f1q6 _1rsrm2f1i _1rsrm2f1f _1rsrm2f11
|
|
|
45080
45390
|
// src/components/FunNotificationBanner/FunNotificationBannerIcon.tsx
|
|
45081
45391
|
import clsx23 from "clsx";
|
|
45082
45392
|
import { motion as motion14, useAnimate as useAnimate3 } from "motion/react";
|
|
45083
|
-
import React282, { useCallback as
|
|
45393
|
+
import React282, { useCallback as useCallback54, useEffect as useEffect71, useRef as useRef36 } from "react";
|
|
45084
45394
|
|
|
45085
45395
|
// src/components/FunNotificationBanner/FunNotificationBannerIcon.css.ts
|
|
45086
45396
|
var STATUS_SPINNER_BOTTOM_POSITION = -5;
|
|
@@ -45329,7 +45639,7 @@ var FunNotificationBannerIcon = ({
|
|
|
45329
45639
|
fallbackIconUrl = FALLBACK_ASSET
|
|
45330
45640
|
}) => {
|
|
45331
45641
|
const [animationScope, animate] = useAnimate3();
|
|
45332
|
-
const triggerAnimationProcessingToCompleted =
|
|
45642
|
+
const triggerAnimationProcessingToCompleted = useCallback54(async () => {
|
|
45333
45643
|
const completedIconPath = document.querySelector(
|
|
45334
45644
|
`.${generateAnimationPrefixClassName("icon-wrapper-completed")} path`
|
|
45335
45645
|
);
|
|
@@ -45436,7 +45746,7 @@ var FunNotificationBannerIcon = ({
|
|
|
45436
45746
|
)
|
|
45437
45747
|
]);
|
|
45438
45748
|
}, [animate]);
|
|
45439
|
-
const triggerAnimationDelayedToFailed =
|
|
45749
|
+
const triggerAnimationDelayedToFailed = useCallback54(async () => {
|
|
45440
45750
|
await Promise.all([
|
|
45441
45751
|
animate(
|
|
45442
45752
|
`.${generateAnimationPrefixClassName("icon-wrapper")}`,
|
|
@@ -45626,8 +45936,8 @@ var FunNotificationBanner = ({
|
|
|
45626
45936
|
onClosed,
|
|
45627
45937
|
onShowMore
|
|
45628
45938
|
}) => {
|
|
45629
|
-
const [showMore, setShowMore] =
|
|
45630
|
-
const [isOpen, setIsOpen] =
|
|
45939
|
+
const [showMore, setShowMore] = useState81(false);
|
|
45940
|
+
const [isOpen, setIsOpen] = useState81(true);
|
|
45631
45941
|
const prevStatusRef = useRef37(status);
|
|
45632
45942
|
const prevStatus = prevStatusRef.current;
|
|
45633
45943
|
useEffect72(() => {
|
|
@@ -46187,10 +46497,10 @@ var CheckoutNotifications = ({
|
|
|
46187
46497
|
isVisible,
|
|
46188
46498
|
variant
|
|
46189
46499
|
}) => {
|
|
46190
|
-
const [isExpanded, setIsExpanded] =
|
|
46191
|
-
const [initialCheckouts, setInitialCheckouts] =
|
|
46192
|
-
const [initialDirectExecutions, setInitialDirectExecutions] =
|
|
46193
|
-
const [closedNotifications, setClosedNotifications] =
|
|
46500
|
+
const [isExpanded, setIsExpanded] = useState82(false);
|
|
46501
|
+
const [initialCheckouts, setInitialCheckouts] = useState82();
|
|
46502
|
+
const [initialDirectExecutions, setInitialDirectExecutions] = useState82();
|
|
46503
|
+
const [closedNotifications, setClosedNotifications] = useState82([]);
|
|
46194
46504
|
const { data: checkouts } = useRecentCheckouts({ isVisible });
|
|
46195
46505
|
const { data: directExecutions } = useRecentDeposits({ isVisible });
|
|
46196
46506
|
const mergedDirectExecutions = useMemo65(
|
|
@@ -46244,7 +46554,7 @@ var CheckoutNotifications = ({
|
|
|
46244
46554
|
}, [isExpanded, combinedNotifications]);
|
|
46245
46555
|
const handleNotificationClose = (id) => setClosedNotifications((prev) => [...prev, id]);
|
|
46246
46556
|
const { logEvent } = useTrack();
|
|
46247
|
-
const handleNewNotification =
|
|
46557
|
+
const handleNewNotification = useCallback55(
|
|
46248
46558
|
(item) => {
|
|
46249
46559
|
const trackEvent = trackEventFromNotification(item);
|
|
46250
46560
|
logEvent(trackEvent);
|
|
@@ -46624,18 +46934,18 @@ function ConnectModal({ onClose, open }) {
|
|
|
46624
46934
|
|
|
46625
46935
|
// src/providers/ModalContext.tsx
|
|
46626
46936
|
function useModalStateValue() {
|
|
46627
|
-
const [isModalOpen, setModalOpen] =
|
|
46937
|
+
const [isModalOpen, setModalOpen] = useState83(false);
|
|
46628
46938
|
return {
|
|
46629
|
-
closeModal:
|
|
46939
|
+
closeModal: useCallback56(() => setModalOpen(false), []),
|
|
46630
46940
|
isModalOpen,
|
|
46631
|
-
openModal:
|
|
46941
|
+
openModal: useCallback56(() => setModalOpen(true), [])
|
|
46632
46942
|
};
|
|
46633
46943
|
}
|
|
46634
46944
|
function useModalStateValueWithProp() {
|
|
46635
|
-
const [isModalOpen, setModalOpen] =
|
|
46636
|
-
const [prop, setProp] =
|
|
46945
|
+
const [isModalOpen, setModalOpen] = useState83(false);
|
|
46946
|
+
const [prop, setProp] = useState83(null);
|
|
46637
46947
|
return {
|
|
46638
|
-
closeModal:
|
|
46948
|
+
closeModal: useCallback56(() => {
|
|
46639
46949
|
setTimeout(
|
|
46640
46950
|
() => {
|
|
46641
46951
|
setProp(null);
|
|
@@ -46646,7 +46956,7 @@ function useModalStateValueWithProp() {
|
|
|
46646
46956
|
}, []),
|
|
46647
46957
|
isModalOpen,
|
|
46648
46958
|
prop,
|
|
46649
|
-
openModal:
|
|
46959
|
+
openModal: useCallback56((prop2) => {
|
|
46650
46960
|
if (prop2 != null) {
|
|
46651
46961
|
setProp(prop2);
|
|
46652
46962
|
}
|
|
@@ -46683,27 +46993,27 @@ function ModalProvider({ children }) {
|
|
|
46683
46993
|
isModalOpen: chainModalOpen,
|
|
46684
46994
|
openModal: openChainModal
|
|
46685
46995
|
} = useModalStateValue();
|
|
46686
|
-
const [isWalletConnectModalOpen, setIsWalletConnectModalOpen] =
|
|
46996
|
+
const [isWalletConnectModalOpen, setIsWalletConnectModalOpen] = useState83(false);
|
|
46687
46997
|
const {
|
|
46688
46998
|
closeModal: closeFunCheckoutModal,
|
|
46689
46999
|
isModalOpen: funCheckoutModalOpen,
|
|
46690
47000
|
openModal: openFunCheckoutModal,
|
|
46691
47001
|
prop: funCheckoutModalId
|
|
46692
47002
|
} = useModalStateValueWithProp();
|
|
46693
|
-
const [softHiddenCheckoutId, setSoftHiddenCheckoutId] =
|
|
46694
|
-
const softHideFunCheckoutModal =
|
|
47003
|
+
const [softHiddenCheckoutId, setSoftHiddenCheckoutId] = useState83(null);
|
|
47004
|
+
const softHideFunCheckoutModal = useCallback56(() => {
|
|
46695
47005
|
if (funCheckoutModalId) {
|
|
46696
47006
|
setSoftHiddenCheckoutId(funCheckoutModalId);
|
|
46697
47007
|
}
|
|
46698
47008
|
closeFunCheckoutModal();
|
|
46699
47009
|
}, [funCheckoutModalId, closeFunCheckoutModal]);
|
|
46700
|
-
const resumeSoftHiddenCheckout =
|
|
47010
|
+
const resumeSoftHiddenCheckout = useCallback56(() => {
|
|
46701
47011
|
if (softHiddenCheckoutId) {
|
|
46702
47012
|
openFunCheckoutModal(softHiddenCheckoutId);
|
|
46703
47013
|
setSoftHiddenCheckoutId(null);
|
|
46704
47014
|
}
|
|
46705
47015
|
}, [softHiddenCheckoutId, openFunCheckoutModal]);
|
|
46706
|
-
const discardSoftHiddenCheckout =
|
|
47016
|
+
const discardSoftHiddenCheckout = useCallback56(() => {
|
|
46707
47017
|
setSoftHiddenCheckoutId(null);
|
|
46708
47018
|
}, []);
|
|
46709
47019
|
const {
|
|
@@ -46713,9 +47023,9 @@ function ModalProvider({ children }) {
|
|
|
46713
47023
|
prop: withdrawalModalConfig
|
|
46714
47024
|
} = useModalStateValueWithProp();
|
|
46715
47025
|
const connectionStatus = useConnectionStatus();
|
|
46716
|
-
const { chainId } = useAccount();
|
|
47026
|
+
const { chainId: chainId2 } = useAccount();
|
|
46717
47027
|
const { chains } = useConfig();
|
|
46718
|
-
const isCurrentChainSupported = chains.some((chain) => chain.id ===
|
|
47028
|
+
const isCurrentChainSupported = chains.some((chain) => chain.id === chainId2);
|
|
46719
47029
|
function closeModals(keepConnectModalOpen = false) {
|
|
46720
47030
|
if (!keepConnectModalOpen) {
|
|
46721
47031
|
closeConnectModal();
|
|
@@ -46889,6 +47199,7 @@ var FunkitCheckoutContext = createContext21({
|
|
|
46889
47199
|
updateCustomRecipient: () => void 0,
|
|
46890
47200
|
confirmCheckout: () => Promise.resolve("0x"),
|
|
46891
47201
|
cancelCheckout: () => Promise.resolve(false),
|
|
47202
|
+
updateActiveCheckout: () => void 0,
|
|
46892
47203
|
setCheckout: () => void 0,
|
|
46893
47204
|
setCompletedTimestamp: () => void 0,
|
|
46894
47205
|
withdrawalItem: null,
|
|
@@ -46912,19 +47223,19 @@ function FunkitCheckoutProvider({ children }) {
|
|
|
46912
47223
|
const { refreshCheckoutHistory } = useCheckoutHistoryContext();
|
|
46913
47224
|
const { getDirectExecutionInfo, getWithdrawalDirectExecution } = useCheckoutDirectExecution();
|
|
46914
47225
|
const { logEvent, startMeasuredEvent } = useTrack();
|
|
46915
|
-
const [activeCheckout, setActiveCheckout] =
|
|
46916
|
-
const [activeWithdrawal, setActiveWithdrawal] =
|
|
47226
|
+
const [activeCheckout, setActiveCheckout] = useState84(null);
|
|
47227
|
+
const [activeWithdrawal, setActiveWithdrawal] = useState84(null);
|
|
46917
47228
|
const udaParams = useUDAParams(
|
|
46918
47229
|
activeCheckout?.initSettings.config?.dynamicRoutingId
|
|
46919
47230
|
);
|
|
46920
|
-
const [checkoutsProgress, setCheckoutsProgress] =
|
|
46921
|
-
const getCheckoutProgress =
|
|
47231
|
+
const [checkoutsProgress, setCheckoutsProgress] = useState84({});
|
|
47232
|
+
const getCheckoutProgress = useCallback57(
|
|
46922
47233
|
(checkoutId) => {
|
|
46923
47234
|
return checkoutsProgress[checkoutId];
|
|
46924
47235
|
},
|
|
46925
47236
|
[checkoutsProgress]
|
|
46926
47237
|
);
|
|
46927
|
-
const setCheckoutProgress =
|
|
47238
|
+
const setCheckoutProgress = useCallback57(
|
|
46928
47239
|
(checkoutId, progress) => {
|
|
46929
47240
|
setCheckoutsProgress((data) => ({ ...data, [checkoutId]: progress }));
|
|
46930
47241
|
},
|
|
@@ -46946,7 +47257,7 @@ function FunkitCheckoutProvider({ children }) {
|
|
|
46946
47257
|
});
|
|
46947
47258
|
}
|
|
46948
47259
|
);
|
|
46949
|
-
const initNewWithdrawal =
|
|
47260
|
+
const initNewWithdrawal = useCallback57(
|
|
46950
47261
|
(props, checkoutConfig) => {
|
|
46951
47262
|
const { onWithdrawalConfirmation, onWithdrawalError, config } = props;
|
|
46952
47263
|
const newWithdrawalId = uuid2();
|
|
@@ -46996,7 +47307,7 @@ function FunkitCheckoutProvider({ children }) {
|
|
|
46996
47307
|
},
|
|
46997
47308
|
[logEvent, startMeasuredEvent]
|
|
46998
47309
|
);
|
|
46999
|
-
const initNewCheckout =
|
|
47310
|
+
const initNewCheckout = useCallback57(
|
|
47000
47311
|
({ config, ...initSettings }) => {
|
|
47001
47312
|
const newCheckoutId = uuid2();
|
|
47002
47313
|
const newActiveCheckoutItem = {
|
|
@@ -47085,7 +47396,7 @@ function FunkitCheckoutProvider({ children }) {
|
|
|
47085
47396
|
});
|
|
47086
47397
|
}
|
|
47087
47398
|
);
|
|
47088
|
-
const startDirectExecutionCheckout =
|
|
47399
|
+
const startDirectExecutionCheckout = useCallback57(
|
|
47089
47400
|
async ({
|
|
47090
47401
|
stepMessageSetter,
|
|
47091
47402
|
latestQuote,
|
|
@@ -47151,8 +47462,8 @@ function FunkitCheckoutProvider({ children }) {
|
|
|
47151
47462
|
}
|
|
47152
47463
|
const resolvedDirectExecutionType = isAcrossRoute(
|
|
47153
47464
|
latestQuote.baseQuote.metadata
|
|
47154
|
-
) ?
|
|
47155
|
-
await
|
|
47465
|
+
) ? DirectExecutionType5.ACROSS : directExecutionType;
|
|
47466
|
+
await createDirectExecution2({
|
|
47156
47467
|
txHash,
|
|
47157
47468
|
userId: userInfo.id,
|
|
47158
47469
|
recipientAddr: getCheckoutRecipient({
|
|
@@ -47233,7 +47544,7 @@ function FunkitCheckoutProvider({ children }) {
|
|
|
47233
47544
|
udaParams
|
|
47234
47545
|
]
|
|
47235
47546
|
);
|
|
47236
|
-
const startRegularCheckout =
|
|
47547
|
+
const startRegularCheckout = useCallback57(
|
|
47237
47548
|
async ({
|
|
47238
47549
|
stepMessageSetter,
|
|
47239
47550
|
latestQuote,
|
|
@@ -47482,6 +47793,7 @@ function FunkitCheckoutProvider({ children }) {
|
|
|
47482
47793
|
updateSelectedPaymentMethodInfo,
|
|
47483
47794
|
confirmCheckout,
|
|
47484
47795
|
cancelCheckout,
|
|
47796
|
+
updateActiveCheckout,
|
|
47485
47797
|
setCheckout: setActiveCheckout,
|
|
47486
47798
|
setCompletedTimestamp,
|
|
47487
47799
|
withdrawalItem: activeWithdrawal,
|
|
@@ -47518,21 +47830,21 @@ function useFunkitCheckout(props) {
|
|
|
47518
47830
|
resume: resumeSoftHiddenCheckout,
|
|
47519
47831
|
discard: discardSoftHiddenCheckout
|
|
47520
47832
|
} = useSoftHiddenCheckout();
|
|
47521
|
-
const onErrorWrapper =
|
|
47833
|
+
const onErrorWrapper = useCallback57(
|
|
47522
47834
|
(payload) => {
|
|
47523
47835
|
logger.warn(payload.message, payload);
|
|
47524
47836
|
onError?.(payload);
|
|
47525
47837
|
},
|
|
47526
47838
|
[onError]
|
|
47527
47839
|
);
|
|
47528
|
-
const onOpenWrapper =
|
|
47840
|
+
const onOpenWrapper = useCallback57(
|
|
47529
47841
|
(newId) => {
|
|
47530
47842
|
props?.onOpen?.();
|
|
47531
47843
|
openFunCheckoutModal?.(newId);
|
|
47532
47844
|
},
|
|
47533
47845
|
[openFunCheckoutModal, props]
|
|
47534
47846
|
);
|
|
47535
|
-
const [pendingCheckoutConfig, setPendingCheckoutConfig] =
|
|
47847
|
+
const [pendingCheckoutConfig, setPendingCheckoutConfig] = useState84();
|
|
47536
47848
|
const onCheckoutConflict = ({
|
|
47537
47849
|
resume,
|
|
47538
47850
|
replace
|
|
@@ -47868,26 +48180,26 @@ function getMaxTargetAssetAmountEstimate(sourceAssetBalance, config, quoteResult
|
|
|
47868
48180
|
const sourceAssetFees = getQuoteTotalFeesFromAmount(quoteResult);
|
|
47869
48181
|
const maxSourceAssetAmount = Math.max(sourceAssetBalance - sourceAssetFees, 0);
|
|
47870
48182
|
const maxTargetAssetAmount = maxSourceAssetAmount * exchangeRate;
|
|
47871
|
-
return
|
|
47872
|
-
|
|
48183
|
+
return dnum10.multiply(
|
|
48184
|
+
dnum10.from(maxTargetAssetAmount, targetAssetDecimals),
|
|
47873
48185
|
0.99
|
|
47874
48186
|
);
|
|
47875
48187
|
}
|
|
47876
|
-
async function getTokenDecimals(wagmiConfig,
|
|
48188
|
+
async function getTokenDecimals(wagmiConfig, chainId2, tokenAddress) {
|
|
47877
48189
|
try {
|
|
47878
48190
|
if (isNativeTokenAddress(tokenAddress)) {
|
|
47879
|
-
return FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO12[
|
|
48191
|
+
return FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO12[chainId2]?.nativeCurrency?.decimals || 18;
|
|
47880
48192
|
}
|
|
47881
|
-
if (
|
|
48193
|
+
if (chainId2 === solanaChain8.id.toString()) {
|
|
47882
48194
|
return solanaChain8.nativeCurrency.decimals;
|
|
47883
48195
|
}
|
|
47884
|
-
if (
|
|
48196
|
+
if (chainId2 === tronChain7.id.toString()) {
|
|
47885
48197
|
return tronChain7.nativeCurrency.decimals;
|
|
47886
48198
|
}
|
|
47887
48199
|
const decimals = await readContract(wagmiConfig, {
|
|
47888
48200
|
address: tokenAddress,
|
|
47889
48201
|
abi: erc20Abi5,
|
|
47890
|
-
chainId: Number.parseInt(
|
|
48202
|
+
chainId: Number.parseInt(chainId2),
|
|
47891
48203
|
functionName: "decimals"
|
|
47892
48204
|
});
|
|
47893
48205
|
return decimals;
|
|
@@ -47895,7 +48207,7 @@ async function getTokenDecimals(wagmiConfig, chainId, tokenAddress) {
|
|
|
47895
48207
|
try {
|
|
47896
48208
|
logger.log("getTokenDecimals_relayFallbackFetch");
|
|
47897
48209
|
const assetInfo = await getRelayAssetInfo({
|
|
47898
|
-
chainId,
|
|
48210
|
+
chainId: chainId2,
|
|
47899
48211
|
address: tokenAddress
|
|
47900
48212
|
});
|
|
47901
48213
|
return assetInfo.decimals;
|
|
@@ -48002,9 +48314,9 @@ function getMinValueThreshold(config, minUsdRequired) {
|
|
|
48002
48314
|
minUsdRequired ?? 0
|
|
48003
48315
|
);
|
|
48004
48316
|
}
|
|
48005
|
-
function isPreferredChain(
|
|
48317
|
+
function isPreferredChain(chainId2, additionalChains = []) {
|
|
48006
48318
|
const chains = /* @__PURE__ */ new Set([
|
|
48007
|
-
|
|
48319
|
+
mainnet13.id,
|
|
48008
48320
|
polygon8.id,
|
|
48009
48321
|
base7.id,
|
|
48010
48322
|
arbitrum6.id,
|
|
@@ -48012,7 +48324,7 @@ function isPreferredChain(chainId, additionalChains = []) {
|
|
|
48012
48324
|
solanaChain9.id,
|
|
48013
48325
|
...additionalChains
|
|
48014
48326
|
]);
|
|
48015
|
-
return chains.has(
|
|
48327
|
+
return chains.has(chainId2);
|
|
48016
48328
|
}
|
|
48017
48329
|
function isNativeTokenAddress(address) {
|
|
48018
48330
|
return isTokenAddressEquivalent6({
|
|
@@ -48020,7 +48332,7 @@ function isNativeTokenAddress(address) {
|
|
|
48020
48332
|
secondTokenAddress: NATIVE_TOKEN
|
|
48021
48333
|
});
|
|
48022
48334
|
}
|
|
48023
|
-
var isPolygonEcosystemToken = (
|
|
48335
|
+
var isPolygonEcosystemToken = (chainId2, tokenAddress) => chainId2 === polygon8.id.toString() && tokenAddress === "0x0000000000000000000000000000000000001010";
|
|
48024
48336
|
var isAssetUsableToPayForCheckout = ({
|
|
48025
48337
|
config,
|
|
48026
48338
|
payerAddress,
|
|
@@ -48232,7 +48544,7 @@ function ConnectButtonRenderer({
|
|
|
48232
48544
|
children
|
|
48233
48545
|
}) {
|
|
48234
48546
|
const isMounted = useIsMounted();
|
|
48235
|
-
const { chainId, address } = useAccount();
|
|
48547
|
+
const { chainId: chainId2, address } = useAccount();
|
|
48236
48548
|
const ensName = useMainnetEnsName(address);
|
|
48237
48549
|
const ensAvatar = useMainnetEnsAvatar(ensName);
|
|
48238
48550
|
const { userInfo } = useGeneralWallet();
|
|
@@ -48241,11 +48553,11 @@ function ConnectButtonRenderer({
|
|
|
48241
48553
|
});
|
|
48242
48554
|
const { chains: wagmiChains } = useConfig();
|
|
48243
48555
|
const isCurrentChainSupported = wagmiChains.some(
|
|
48244
|
-
(chain) => chain.id ===
|
|
48556
|
+
(chain) => chain.id === chainId2
|
|
48245
48557
|
);
|
|
48246
48558
|
const funkitConnectChainsById = useFunkitConnectChainsById();
|
|
48247
48559
|
const authenticationStatus = useAuthenticationStatus() ?? void 0;
|
|
48248
|
-
const funkitConnectChain =
|
|
48560
|
+
const funkitConnectChain = chainId2 ? funkitConnectChainsById[chainId2] : void 0;
|
|
48249
48561
|
const chainName = funkitConnectChain?.name ?? void 0;
|
|
48250
48562
|
const chainIconUrl = funkitConnectChain?.iconUrl ?? void 0;
|
|
48251
48563
|
const chainIconBackground = funkitConnectChain?.iconBackground ?? void 0;
|
|
@@ -48291,11 +48603,11 @@ function ConnectButtonRenderer({
|
|
|
48291
48603
|
} : void 0,
|
|
48292
48604
|
accountModalOpen,
|
|
48293
48605
|
authenticationStatus,
|
|
48294
|
-
chain:
|
|
48606
|
+
chain: chainId2 ? {
|
|
48295
48607
|
hasIcon: Boolean(chainIconUrl),
|
|
48296
48608
|
iconBackground: chainIconBackground,
|
|
48297
48609
|
iconUrl: resolvedChainIconUrl,
|
|
48298
|
-
id:
|
|
48610
|
+
id: chainId2,
|
|
48299
48611
|
name: chainName,
|
|
48300
48612
|
unsupported: !isCurrentChainSupported
|
|
48301
48613
|
} : void 0,
|
|
@@ -48475,7 +48787,7 @@ function ConnectButton({
|
|
|
48475
48787
|
const chains = useFunkitConnectChains();
|
|
48476
48788
|
const connectionStatus = useConnectionStatus();
|
|
48477
48789
|
const { setShowBalance } = useShowBalance();
|
|
48478
|
-
const [ready, setReady] =
|
|
48790
|
+
const [ready, setReady] = useState85(false);
|
|
48479
48791
|
useEffect78(() => {
|
|
48480
48792
|
setShowBalance(showBalance);
|
|
48481
48793
|
if (!ready) {
|