@funkit/connect 9.0.2 → 9.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/dist/components/Dialog/DialogContent.css.d.ts +1 -0
- package/dist/index.css +5 -1
- package/dist/index.js +158 -270
- package/dist/modals/CheckoutModal/SwappedIframe/SwappedIframe.d.ts +1 -1
- package/dist/providers/FunkitConfigContext.d.ts +0 -5
- package/dist/utils/flags/config.d.ts +8 -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 +52 -52
- 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 +3 -3
- package/dist/wallets/walletConnectors/{chunk-6YO27XOM.js → chunk-3Y2GG3PM.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-HETS3KKI.js → chunk-3YCR2ZB4.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-HOPH3TQ3.js → chunk-C4RP2DNH.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-IICWJWGZ.js → chunk-CBI3SGOC.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-GVOQTORD.js → chunk-CMLFDRCP.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-LI6QY2B5.js → chunk-COX3VEDR.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-EKJHJFRN.js → chunk-CT3QPTAU.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-7OARWILZ.js → chunk-DWMUM4F6.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-CJJT7LMT.js → chunk-FDVJHNLL.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-6UCI7GM6.js → chunk-I7K6LUZR.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-XBLHZICW.js → chunk-N3UJMC3V.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-4C7ER452.js → chunk-NEK7T3IC.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-PKMAPNN6.js → chunk-RLLTYOWT.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-GH4M6FTK.js → chunk-TIT5F32X.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-TTHM3WUR.js → chunk-UPUDLUBT.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-53VYSPXK.js → chunk-UVMMPRDM.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-GSHSWVEG.js → chunk-UVYZSGIX.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-KO56HCTI.js → chunk-ZMRIQOR5.js} +3 -3
package/dist/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
darkTheme
|
|
4
|
-
} from "./chunk-WSCXOKCX.js";
|
|
5
2
|
import {
|
|
6
3
|
lightTheme
|
|
7
4
|
} from "./chunk-XCM74QX2.js";
|
|
5
|
+
import {
|
|
6
|
+
darkTheme
|
|
7
|
+
} from "./chunk-WSCXOKCX.js";
|
|
8
8
|
import {
|
|
9
9
|
systemFontStack
|
|
10
10
|
} from "./chunk-SC53AFEE.js";
|
|
11
11
|
|
|
12
12
|
// src/components/Dialog/DialogContent.css.ts
|
|
13
|
-
var
|
|
13
|
+
var DIALOG_HEIGHT_SWAPPED_IFRAME = 580;
|
|
14
14
|
var DIALOG_WIDTH_WIDE = "450px";
|
|
15
15
|
var SCROLL_BAR_WIDTH = 6;
|
|
16
16
|
var bottomPaddingVariable = "--bottom-padding-value";
|
|
@@ -2353,7 +2353,7 @@ function setFunkitConnectVersion({ version }) {
|
|
|
2353
2353
|
localStorage.setItem(storageKey, version);
|
|
2354
2354
|
}
|
|
2355
2355
|
function getCurrentSdkVersion() {
|
|
2356
|
-
return "9.0.
|
|
2356
|
+
return "9.0.3";
|
|
2357
2357
|
}
|
|
2358
2358
|
function useFingerprint() {
|
|
2359
2359
|
const fingerprint = useCallback3(() => {
|
|
@@ -2576,8 +2576,7 @@ var DEFAULT_UI_CUSTOMIZATIONS = {
|
|
|
2576
2576
|
},
|
|
2577
2577
|
selectAssetScreen: {
|
|
2578
2578
|
isSecondaryTokenSymbolVisible: true,
|
|
2579
|
-
navigateOnAssetClick: false
|
|
2580
|
-
showTargetAssetSelection: false
|
|
2579
|
+
navigateOnAssetClick: false
|
|
2581
2580
|
},
|
|
2582
2581
|
transferCryptoScreen: {
|
|
2583
2582
|
showYouSendYouReceive: false
|
|
@@ -7280,7 +7279,20 @@ var flagConfig = {
|
|
|
7280
7279
|
{
|
|
7281
7280
|
key: "apiKey",
|
|
7282
7281
|
type: "isAnyOf",
|
|
7283
|
-
values: [POLYMARKET_API_KEY2
|
|
7282
|
+
values: [POLYMARKET_API_KEY2]
|
|
7283
|
+
}
|
|
7284
|
+
],
|
|
7285
|
+
value: JSON.stringify({
|
|
7286
|
+
...QR_CODE_WITH_TRON,
|
|
7287
|
+
56: [...COMMON_SUPPORT_CHAINS_AND_ASSETS[56], "U"]
|
|
7288
|
+
})
|
|
7289
|
+
},
|
|
7290
|
+
{
|
|
7291
|
+
if_any: [
|
|
7292
|
+
{
|
|
7293
|
+
key: "apiKey",
|
|
7294
|
+
type: "isAnyOf",
|
|
7295
|
+
values: [LIGHTERXYZ_API_KEY2]
|
|
7284
7296
|
}
|
|
7285
7297
|
],
|
|
7286
7298
|
value: JSON.stringify(QR_CODE_WITH_TRON)
|
|
@@ -20607,6 +20619,8 @@ function buildSwappedTheme(theme) {
|
|
|
20607
20619
|
const swappedTheme = {
|
|
20608
20620
|
colors: {
|
|
20609
20621
|
...theme.colors,
|
|
20622
|
+
boxBackground: theme.colors.offBackground,
|
|
20623
|
+
buttonPrimaryHover: theme.colors.buttonBackgroundHover,
|
|
20610
20624
|
buttonDisabled: theme.colors.buttonBackgroundDisabled,
|
|
20611
20625
|
headerButtonBackground: theme.colors.modalTopbarIconBackground,
|
|
20612
20626
|
inputBorder: theme.colors.inputBorderBase,
|
|
@@ -20657,7 +20671,7 @@ function buildSwappedThemeQueryParams(activeTheme) {
|
|
|
20657
20671
|
modalRadii: resolveCssValue(activeTheme.radii.modal),
|
|
20658
20672
|
skeletonColor: toRawHex(activeTheme.colors.inputBorderHover),
|
|
20659
20673
|
skeletonSecondaryColor: toRawHex(activeTheme.colors.offBackground),
|
|
20660
|
-
height: String(
|
|
20674
|
+
height: String(DIALOG_HEIGHT_SWAPPED_IFRAME),
|
|
20661
20675
|
width: String(Number.parseInt(DIALOG_WIDTH_WIDE))
|
|
20662
20676
|
};
|
|
20663
20677
|
}
|
|
@@ -34256,13 +34270,9 @@ function MeldRedirect({
|
|
|
34256
34270
|
}
|
|
34257
34271
|
|
|
34258
34272
|
// src/modals/CheckoutModal/SelectAsset/SelectAsset.tsx
|
|
34259
|
-
import {
|
|
34260
|
-
FUNKIT_CONNECT_SUPPORTED_CHECKOUT_CHAINS_INFO_LIST as FUNKIT_CONNECT_SUPPORTED_CHECKOUT_CHAINS_INFO_LIST2,
|
|
34261
|
-
etherealChain,
|
|
34262
|
-
hyperEvmChain as hyperEvmChain5
|
|
34263
|
-
} from "@funkit/chains";
|
|
34273
|
+
import { etherealChain, hyperEvmChain as hyperEvmChain5 } from "@funkit/chains";
|
|
34264
34274
|
import { isTokenEquivalent as isTokenEquivalent6 } from "@funkit/utils";
|
|
34265
|
-
import
|
|
34275
|
+
import React213, {
|
|
34266
34276
|
useEffect as useEffect52,
|
|
34267
34277
|
useLayoutEffect as useLayoutEffect2,
|
|
34268
34278
|
useMemo as useMemo46,
|
|
@@ -34271,101 +34281,6 @@ import React214, {
|
|
|
34271
34281
|
import { createPortal as createPortal19 } from "react-dom";
|
|
34272
34282
|
import { mainnet as mainnet9 } from "viem/chains";
|
|
34273
34283
|
|
|
34274
|
-
// src/components/Dropdown/ReceiveTokenDropdown.tsx
|
|
34275
|
-
import React210 from "react";
|
|
34276
|
-
var TOKEN_ICON_SIZE2 = "16";
|
|
34277
|
-
var aprTag = (badgeText) => /* @__PURE__ */ React210.createElement(
|
|
34278
|
-
FunBadge,
|
|
34279
|
-
{
|
|
34280
|
-
background: "badgeBackgroundSuccess",
|
|
34281
|
-
borderColor: "badgeBorderSuccess",
|
|
34282
|
-
color: "badgeTextSuccess"
|
|
34283
|
-
},
|
|
34284
|
-
badgeText
|
|
34285
|
-
);
|
|
34286
|
-
var ReceiveTokenDropdown = ({
|
|
34287
|
-
tokens,
|
|
34288
|
-
chainId,
|
|
34289
|
-
selectedToken,
|
|
34290
|
-
onTokenSelected,
|
|
34291
|
-
label,
|
|
34292
|
-
activeItemLabel,
|
|
34293
|
-
activeItemProps,
|
|
34294
|
-
maxDropdownHeight,
|
|
34295
|
-
displayedChainId
|
|
34296
|
-
}) => {
|
|
34297
|
-
const allTokens = Array.from(new Set(Object.values(tokens).flat()));
|
|
34298
|
-
const patchedChainId = displayedChainId ?? chainId;
|
|
34299
|
-
const tokenBadgeText = tokens.find(
|
|
34300
|
-
(token) => token.tokenSymbol === selectedToken
|
|
34301
|
-
)?.badgeText;
|
|
34302
|
-
const handleChangeSymbol = (symbol) => {
|
|
34303
|
-
const matchingToken = tokens.find((token) => token.tokenSymbol === symbol);
|
|
34304
|
-
if (matchingToken) {
|
|
34305
|
-
onTokenSelected(matchingToken);
|
|
34306
|
-
}
|
|
34307
|
-
};
|
|
34308
|
-
return /* @__PURE__ */ React210.createElement(
|
|
34309
|
-
BaseDropdown_default,
|
|
34310
|
-
{
|
|
34311
|
-
maxDropdownHeight,
|
|
34312
|
-
horizontalIconGap: "8",
|
|
34313
|
-
label,
|
|
34314
|
-
openToTopOnMobile: false,
|
|
34315
|
-
activeItemProps: {
|
|
34316
|
-
iconComponent: selectedToken && /* @__PURE__ */ React210.createElement(
|
|
34317
|
-
FunAssetAvatar,
|
|
34318
|
-
{
|
|
34319
|
-
assetIconSize: TOKEN_ICON_SIZE2,
|
|
34320
|
-
assetName: selectedToken,
|
|
34321
|
-
assetSrc: getTokenIconUrl(selectedToken, tokens),
|
|
34322
|
-
chainId: patchedChainId,
|
|
34323
|
-
largeChainIcon: true
|
|
34324
|
-
}
|
|
34325
|
-
),
|
|
34326
|
-
alwaysVisibleLabel: activeItemLabel,
|
|
34327
|
-
tagComponent: tokenBadgeText ? aprTag(tokenBadgeText) : void 0,
|
|
34328
|
-
...activeItemProps
|
|
34329
|
-
},
|
|
34330
|
-
value: selectedToken ?? "",
|
|
34331
|
-
options: allTokens.map((token) => ({
|
|
34332
|
-
value: token.tokenSymbol,
|
|
34333
|
-
label: token.tokenSymbol
|
|
34334
|
-
})),
|
|
34335
|
-
renderDropdownOption: (option, isSelected) => {
|
|
34336
|
-
const symbol = option.value;
|
|
34337
|
-
const iconUrl = getTokenIconUrl(symbol, tokens);
|
|
34338
|
-
const tokenBadgeText2 = tokens.find(
|
|
34339
|
-
(token) => token.tokenSymbol === symbol
|
|
34340
|
-
)?.badgeText;
|
|
34341
|
-
const tagComponent = tokenBadgeText2 ? aprTag(tokenBadgeText2) : void 0;
|
|
34342
|
-
return /* @__PURE__ */ React210.createElement(
|
|
34343
|
-
BaseDropdownItem_default,
|
|
34344
|
-
{
|
|
34345
|
-
horizontalIconGap: "8",
|
|
34346
|
-
iconComponent: /* @__PURE__ */ React210.createElement(
|
|
34347
|
-
FunAssetAvatar,
|
|
34348
|
-
{
|
|
34349
|
-
assetIconSize: TOKEN_ICON_SIZE2,
|
|
34350
|
-
assetName: "receive-token-asset",
|
|
34351
|
-
assetSrc: iconUrl,
|
|
34352
|
-
chainId: patchedChainId,
|
|
34353
|
-
largeChainIcon: true
|
|
34354
|
-
}
|
|
34355
|
-
),
|
|
34356
|
-
id: option.value,
|
|
34357
|
-
onClick: handleChangeSymbol,
|
|
34358
|
-
label: option.label,
|
|
34359
|
-
isSelected,
|
|
34360
|
-
tagComponent
|
|
34361
|
-
}
|
|
34362
|
-
);
|
|
34363
|
-
},
|
|
34364
|
-
preloadIconUrls: allTokens.map((token) => getTokenIconUrl(token.tokenSymbol, tokens)).filter((url) => !!url)
|
|
34365
|
-
}
|
|
34366
|
-
);
|
|
34367
|
-
};
|
|
34368
|
-
|
|
34369
34284
|
// src/hooks/useAllowedAssets.ts
|
|
34370
34285
|
import { getAllowedAssets } from "@funkit/api-base";
|
|
34371
34286
|
import { useQuery as useQuery21 } from "@tanstack/react-query";
|
|
@@ -34444,10 +34359,10 @@ var useDynamicRoutes = (_dynamicRoutingId) => {
|
|
|
34444
34359
|
|
|
34445
34360
|
// src/modals/CheckoutModal/SelectAsset/SelectAssetInfoSection.tsx
|
|
34446
34361
|
import { formatCurrencyAndStringify as formatCurrencyAndStringify10 } from "@funkit/utils";
|
|
34447
|
-
import
|
|
34362
|
+
import React211 from "react";
|
|
34448
34363
|
|
|
34449
34364
|
// src/components/NewTokenDepositAlert/NewTokenDepositAlert.tsx
|
|
34450
|
-
import
|
|
34365
|
+
import React210 from "react";
|
|
34451
34366
|
import { Trans as Trans14 } from "react-i18next";
|
|
34452
34367
|
import { FlagKey as FlagKey10 } from "@funkit/utils";
|
|
34453
34368
|
var FunLinkButtonComponent2 = ({
|
|
@@ -34455,7 +34370,7 @@ var FunLinkButtonComponent2 = ({
|
|
|
34455
34370
|
onClick,
|
|
34456
34371
|
weight
|
|
34457
34372
|
}) => {
|
|
34458
|
-
return /* @__PURE__ */
|
|
34373
|
+
return /* @__PURE__ */ React210.createElement(
|
|
34459
34374
|
FunLinkButton,
|
|
34460
34375
|
{
|
|
34461
34376
|
inline: true,
|
|
@@ -34475,19 +34390,19 @@ var NewTokenDepositAlert = ({
|
|
|
34475
34390
|
if (!alertData || !isTokenTransferEnabled) {
|
|
34476
34391
|
return null;
|
|
34477
34392
|
}
|
|
34478
|
-
return /* @__PURE__ */
|
|
34393
|
+
return /* @__PURE__ */ React210.createElement(
|
|
34479
34394
|
FunAlert,
|
|
34480
34395
|
{
|
|
34481
|
-
icon: /* @__PURE__ */
|
|
34396
|
+
icon: /* @__PURE__ */ React210.createElement(NewTokenBadge, { iconSymbol: alertData.symbol }),
|
|
34482
34397
|
paddingX: "8",
|
|
34483
|
-
description: /* @__PURE__ */
|
|
34398
|
+
description: /* @__PURE__ */ React210.createElement(
|
|
34484
34399
|
Trans14,
|
|
34485
34400
|
{
|
|
34486
34401
|
t,
|
|
34487
34402
|
i18nKey: "common.depositsLiveTryNow",
|
|
34488
34403
|
values: { tokenName: alertData.name },
|
|
34489
34404
|
components: {
|
|
34490
|
-
TryNowLink: /* @__PURE__ */
|
|
34405
|
+
TryNowLink: /* @__PURE__ */ React210.createElement(
|
|
34491
34406
|
FunLinkButtonComponent2,
|
|
34492
34407
|
{
|
|
34493
34408
|
weight: "regular",
|
|
@@ -34516,9 +34431,9 @@ var SelectAssetInfoSection = ({
|
|
|
34516
34431
|
const label = usePaymentMethodInfoLabel(paymentMethodInfo, 16);
|
|
34517
34432
|
const isDefiMode = checkoutItem?.initSettings.config.isDefiMode;
|
|
34518
34433
|
if (isDefiMode || !isSourceNavWidgetEnabled) {
|
|
34519
|
-
return /* @__PURE__ */
|
|
34434
|
+
return /* @__PURE__ */ React211.createElement(NewTokenDepositAlert, { onClick: onTokenTransfer });
|
|
34520
34435
|
}
|
|
34521
|
-
return /* @__PURE__ */
|
|
34436
|
+
return /* @__PURE__ */ React211.createElement(Box, { display: "flex", gap: "8", flexDirection: "column" }, /* @__PURE__ */ React211.createElement(
|
|
34522
34437
|
SourcePaymentMethodItem,
|
|
34523
34438
|
{
|
|
34524
34439
|
type: paymentMethodInfo.paymentMethod,
|
|
@@ -34528,12 +34443,12 @@ var SelectAssetInfoSection = ({
|
|
|
34528
34443
|
onClick: onSelectSource,
|
|
34529
34444
|
testId: "checkout-source-wallet-button"
|
|
34530
34445
|
}
|
|
34531
|
-
), /* @__PURE__ */
|
|
34446
|
+
), /* @__PURE__ */ React211.createElement(NewTokenDepositAlert, { onClick: onTokenTransfer }));
|
|
34532
34447
|
};
|
|
34533
34448
|
|
|
34534
34449
|
// src/modals/CheckoutModal/SelectAsset/SelectAssetList.tsx
|
|
34535
34450
|
import { formatCurrencyAndStringify as formatCurrencyAndStringify11 } from "@funkit/utils";
|
|
34536
|
-
import
|
|
34451
|
+
import React212 from "react";
|
|
34537
34452
|
import { flushSync } from "react-dom";
|
|
34538
34453
|
var SelectAssetList = ({
|
|
34539
34454
|
isLoading,
|
|
@@ -34565,16 +34480,16 @@ var SelectAssetList = ({
|
|
|
34565
34480
|
return void 0;
|
|
34566
34481
|
}
|
|
34567
34482
|
if (isLoading) {
|
|
34568
|
-
return /* @__PURE__ */
|
|
34483
|
+
return /* @__PURE__ */ React212.createElement(FunAssetLoading, { count: 5 });
|
|
34569
34484
|
}
|
|
34570
34485
|
if (isAssetsEmpty) {
|
|
34571
|
-
return /* @__PURE__ */
|
|
34486
|
+
return /* @__PURE__ */ React212.createElement(
|
|
34572
34487
|
FunNoResults,
|
|
34573
34488
|
{
|
|
34574
34489
|
title: t("checkout.noAvailableTokens"),
|
|
34575
34490
|
text: t("checkout.noAvailableTokensMessage"),
|
|
34576
34491
|
variant: "actionable",
|
|
34577
|
-
actionButton: onBalanceTopUpSwitch ? /* @__PURE__ */
|
|
34492
|
+
actionButton: onBalanceTopUpSwitch ? /* @__PURE__ */ React212.createElement(
|
|
34578
34493
|
FunButton,
|
|
34579
34494
|
{
|
|
34580
34495
|
type: "tertiary",
|
|
@@ -34588,7 +34503,7 @@ var SelectAssetList = ({
|
|
|
34588
34503
|
}
|
|
34589
34504
|
);
|
|
34590
34505
|
}
|
|
34591
|
-
return /* @__PURE__ */
|
|
34506
|
+
return /* @__PURE__ */ React212.createElement(
|
|
34592
34507
|
Box,
|
|
34593
34508
|
{
|
|
34594
34509
|
display: "flex",
|
|
@@ -34597,7 +34512,7 @@ var SelectAssetList = ({
|
|
|
34597
34512
|
},
|
|
34598
34513
|
assetOptions.map(({ asset, isDisabled, badgeText, minUsdRequired }) => {
|
|
34599
34514
|
const isAssetItemActive = !navigateOnAssetClick && selectedChainTokenSymbol === asset.chainSymbolKey;
|
|
34600
|
-
return /* @__PURE__ */
|
|
34515
|
+
return /* @__PURE__ */ React212.createElement(
|
|
34601
34516
|
FunAssetItem,
|
|
34602
34517
|
{
|
|
34603
34518
|
key: asset.chainSymbolKey,
|
|
@@ -34714,16 +34629,13 @@ function useEnrichedAccountHoldings({
|
|
|
34714
34629
|
function useAssetOptions({
|
|
34715
34630
|
enrichedAccountHoldings,
|
|
34716
34631
|
userSelectedTargetAsset,
|
|
34717
|
-
chainId,
|
|
34718
34632
|
dynamicTargetAssetCandidates
|
|
34719
34633
|
}) {
|
|
34720
34634
|
const { apiKey } = useFunkitConfig();
|
|
34721
34635
|
const { t } = useFunkitTranslation();
|
|
34722
34636
|
const { findPath } = useDynamicRoutes();
|
|
34723
34637
|
const assetOptions = useMemo46(() => {
|
|
34724
|
-
return enrichedAccountHoldings.
|
|
34725
|
-
({ asset }) => chainId !== void 0 ? asset.pickedChainId === chainId.toString() : true
|
|
34726
|
-
).map(({ asset, usableForCheckout }) => {
|
|
34638
|
+
return enrichedAccountHoldings.map(({ asset, usableForCheckout }) => {
|
|
34727
34639
|
const { isUsable, reason } = usableForCheckout;
|
|
34728
34640
|
const isKnown = isKnownAsset(asset);
|
|
34729
34641
|
const isDisabled = !isUsable || !isKnown;
|
|
@@ -34774,7 +34686,6 @@ function useAssetOptions({
|
|
|
34774
34686
|
t,
|
|
34775
34687
|
apiKey,
|
|
34776
34688
|
enrichedAccountHoldings,
|
|
34777
|
-
chainId,
|
|
34778
34689
|
userSelectedTargetAsset,
|
|
34779
34690
|
dynamicTargetAssetCandidates,
|
|
34780
34691
|
findPath
|
|
@@ -34797,24 +34708,6 @@ function useScrollToSelectedAsset(selectedChainTokenSymbol) {
|
|
|
34797
34708
|
});
|
|
34798
34709
|
}, []);
|
|
34799
34710
|
}
|
|
34800
|
-
function computeDefaultToken(checkoutConfig) {
|
|
34801
|
-
const candidates = checkoutConfig?.dynamicTargetAssetCandidates;
|
|
34802
|
-
if (!candidates?.length) {
|
|
34803
|
-
return {
|
|
34804
|
-
tokenAddress: checkoutConfig?.targetAsset || "0x",
|
|
34805
|
-
tokenChainId: checkoutConfig?.targetChain || "",
|
|
34806
|
-
tokenSymbol: checkoutConfig?.targetAssetTicker || "",
|
|
34807
|
-
iconSrc: checkoutConfig?.iconSrc || "",
|
|
34808
|
-
targetAssetMinAmount: 0
|
|
34809
|
-
};
|
|
34810
|
-
}
|
|
34811
|
-
if (candidates.length === 1) {
|
|
34812
|
-
return candidates[0];
|
|
34813
|
-
}
|
|
34814
|
-
return candidates.find(
|
|
34815
|
-
(token) => token.tokenSymbol === checkoutConfig?.targetAssetTicker
|
|
34816
|
-
) ?? candidates.find((token) => token.isDefault) ?? candidates[0];
|
|
34817
|
-
}
|
|
34818
34711
|
function AccountSelectAsset({
|
|
34819
34712
|
paymentMethodInfo,
|
|
34820
34713
|
onFinish,
|
|
@@ -34825,12 +34718,10 @@ function AccountSelectAsset({
|
|
|
34825
34718
|
}) {
|
|
34826
34719
|
const { logMeasuredEvent } = useTrack();
|
|
34827
34720
|
const { t } = useFunkitTranslation();
|
|
34828
|
-
const
|
|
34829
|
-
const { textCustomizations, uiCustomizations } = useFunkitConfig();
|
|
34721
|
+
const { uiCustomizations } = useFunkitConfig();
|
|
34830
34722
|
const {
|
|
34831
34723
|
checkoutItem,
|
|
34832
34724
|
updateSourceAsset,
|
|
34833
|
-
updateTargetAsset,
|
|
34834
34725
|
updateTargetAssetAmount,
|
|
34835
34726
|
applyDynamicRouting
|
|
34836
34727
|
} = useCheckoutContext();
|
|
@@ -34843,24 +34734,21 @@ function AccountSelectAsset({
|
|
|
34843
34734
|
const { setSelectedBrokerageAsset } = useFunkitBrokerageContext();
|
|
34844
34735
|
const [explicitlySelectedChainTokenSymbol, setSelectedChainTokenSymbol] = useState61("");
|
|
34845
34736
|
const checkoutConfig = checkoutItem?.initSettings.config;
|
|
34846
|
-
const
|
|
34847
|
-
|
|
34848
|
-
|
|
34849
|
-
() => computeDefaultToken(checkoutConfig)
|
|
34737
|
+
const defaultTargetAsset = useMemo46(
|
|
34738
|
+
() => getDefaultDynamicTargetAsset(checkoutConfig),
|
|
34739
|
+
[checkoutConfig]
|
|
34850
34740
|
);
|
|
34851
34741
|
const { enrichedAccountHoldings, isLoading: isLoadingEnrichedHoldings } = useEnrichedAccountHoldings({
|
|
34852
34742
|
accountHoldings,
|
|
34853
34743
|
paymentMethodInfo,
|
|
34854
34744
|
checkoutConfig,
|
|
34855
|
-
targetAssetInfo:
|
|
34745
|
+
targetAssetInfo: defaultTargetAsset
|
|
34856
34746
|
});
|
|
34857
34747
|
const assetOptions = useAssetOptions({
|
|
34858
34748
|
enrichedAccountHoldings,
|
|
34859
|
-
userSelectedTargetAsset:
|
|
34860
|
-
|
|
34861
|
-
dynamicTargetAssetCandidates: candidates || []
|
|
34749
|
+
userSelectedTargetAsset: defaultTargetAsset,
|
|
34750
|
+
dynamicTargetAssetCandidates: checkoutConfig?.dynamicTargetAssetCandidates || []
|
|
34862
34751
|
});
|
|
34863
|
-
const showTargetAssetSelection = isTargetAssetSelectable && uiCustomizations.selectAssetScreen.showTargetAssetSelection;
|
|
34864
34752
|
const navigateOnAssetClick = uiCustomizations.selectAssetScreen.navigateOnAssetClick;
|
|
34865
34753
|
const handleTargetAssetUpdate = (tokenItem) => {
|
|
34866
34754
|
const dynamicPath = findPath({
|
|
@@ -34893,38 +34781,6 @@ function AccountSelectAsset({
|
|
|
34893
34781
|
}),
|
|
34894
34782
|
bridgeOverride: dynamicPath.bridgeOverride
|
|
34895
34783
|
});
|
|
34896
|
-
return;
|
|
34897
|
-
}
|
|
34898
|
-
if (!isTargetAssetSelectable) {
|
|
34899
|
-
return;
|
|
34900
|
-
}
|
|
34901
|
-
if (showTargetAssetSelection && selectedTargetAsset) {
|
|
34902
|
-
updateTargetAsset({
|
|
34903
|
-
targetAsset: selectedTargetAsset.tokenAddress,
|
|
34904
|
-
targetChain: selectedTargetAsset.tokenChainId,
|
|
34905
|
-
targetAssetTicker: selectedTargetAsset.tokenSymbol,
|
|
34906
|
-
targetAssetMinAmount: selectedTargetAsset.targetAssetMinAmount,
|
|
34907
|
-
iconSrc: selectedTargetAsset.iconSrc
|
|
34908
|
-
});
|
|
34909
|
-
return;
|
|
34910
|
-
}
|
|
34911
|
-
let candidate = candidates.find(
|
|
34912
|
-
(cand) => isTokenEquivalent6({
|
|
34913
|
-
firstTokenChainId: cand.tokenChainId,
|
|
34914
|
-
firstTokenAddress: cand.tokenAddress,
|
|
34915
|
-
secondTokenChainId: tokenItem.pickedChainId,
|
|
34916
|
-
secondTokenAddress: tokenItem.tokenAddress
|
|
34917
|
-
})
|
|
34918
|
-
);
|
|
34919
|
-
candidate = candidate || candidates.find((token) => token.isDefault) || candidates[0];
|
|
34920
|
-
if (candidate) {
|
|
34921
|
-
updateTargetAsset({
|
|
34922
|
-
targetAsset: candidate.tokenAddress,
|
|
34923
|
-
targetChain: candidate.tokenChainId,
|
|
34924
|
-
targetAssetMinAmount: candidate.targetAssetMinAmount,
|
|
34925
|
-
targetAssetTicker: candidate.tokenSymbol,
|
|
34926
|
-
iconSrc: candidate.iconSrc
|
|
34927
|
-
});
|
|
34928
34784
|
}
|
|
34929
34785
|
};
|
|
34930
34786
|
const onContinueWithToken = useEffectEvent(() => {
|
|
@@ -35010,7 +34866,7 @@ function AccountSelectAsset({
|
|
|
35010
34866
|
});
|
|
35011
34867
|
}
|
|
35012
34868
|
}, [checkoutId, isLoading, logMeasuredEvent]);
|
|
35013
|
-
const assetList = /* @__PURE__ */
|
|
34869
|
+
const assetList = /* @__PURE__ */ React213.createElement(
|
|
35014
34870
|
SelectAssetList,
|
|
35015
34871
|
{
|
|
35016
34872
|
isLoading,
|
|
@@ -35024,7 +34880,7 @@ function AccountSelectAsset({
|
|
|
35024
34880
|
onContinueWithToken
|
|
35025
34881
|
}
|
|
35026
34882
|
);
|
|
35027
|
-
return /* @__PURE__ */
|
|
34883
|
+
return /* @__PURE__ */ React213.createElement(React213.Fragment, null, uiCustomizations.selectAssetScreen.customTopComponent?.(), /* @__PURE__ */ React213.createElement(
|
|
35028
34884
|
Box,
|
|
35029
34885
|
{
|
|
35030
34886
|
width: "full",
|
|
@@ -35035,50 +34891,13 @@ function AccountSelectAsset({
|
|
|
35035
34891
|
gap: "4",
|
|
35036
34892
|
style: { flex: 1 }
|
|
35037
34893
|
},
|
|
35038
|
-
|
|
35039
|
-
Box,
|
|
35040
|
-
{
|
|
35041
|
-
display: "flex",
|
|
35042
|
-
flexDirection: "column",
|
|
35043
|
-
gap: "12",
|
|
35044
|
-
style: { flex: 1 }
|
|
35045
|
-
},
|
|
35046
|
-
/* @__PURE__ */ React214.createElement(
|
|
35047
|
-
ReceiveTokenDropdown,
|
|
35048
|
-
{
|
|
35049
|
-
label: textCustomizations.receiveDropdownTitle,
|
|
35050
|
-
activeItemLabel: textCustomizations.receiveDropdownLabel,
|
|
35051
|
-
tokens: candidates,
|
|
35052
|
-
chainId: Number(checkoutConfig.targetChain),
|
|
35053
|
-
selectedToken: selectedTargetAsset?.tokenSymbol,
|
|
35054
|
-
onTokenSelected: setSelectedTargetAsset
|
|
35055
|
-
}
|
|
35056
|
-
),
|
|
35057
|
-
/* @__PURE__ */ React214.createElement(
|
|
35058
|
-
Box,
|
|
35059
|
-
{
|
|
35060
|
-
display: "flex",
|
|
35061
|
-
flexDirection: "column",
|
|
35062
|
-
gap: "4",
|
|
35063
|
-
style: { flex: 1 }
|
|
35064
|
-
},
|
|
35065
|
-
/* @__PURE__ */ React214.createElement(
|
|
35066
|
-
FilterAssets,
|
|
35067
|
-
{
|
|
35068
|
-
label: textCustomizations.tokensListTitle,
|
|
35069
|
-
value: selectedChainId,
|
|
35070
|
-
onFilterChange: setSelectedChainId
|
|
35071
|
-
}
|
|
35072
|
-
),
|
|
35073
|
-
assetList
|
|
35074
|
-
)
|
|
35075
|
-
) : assetList
|
|
34894
|
+
assetList
|
|
35076
34895
|
), bottomSectionRef && createPortal19(
|
|
35077
|
-
/* @__PURE__ */
|
|
34896
|
+
/* @__PURE__ */ React213.createElement(
|
|
35078
34897
|
Dialog.BottomBar,
|
|
35079
34898
|
{
|
|
35080
34899
|
topSectionVisible: !!fetchHoldingsError,
|
|
35081
|
-
topSection: navigateOnAssetClick && !fetchHoldingsError ? null : /* @__PURE__ */
|
|
34900
|
+
topSection: navigateOnAssetClick && !fetchHoldingsError ? null : /* @__PURE__ */ React213.createElement(
|
|
35082
34901
|
FunNotification,
|
|
35083
34902
|
{
|
|
35084
34903
|
isVisible: !!fetchHoldingsError,
|
|
@@ -35096,34 +34915,6 @@ function AccountSelectAsset({
|
|
|
35096
34915
|
bottomSectionRef
|
|
35097
34916
|
));
|
|
35098
34917
|
}
|
|
35099
|
-
var FilterAssets = ({ value, onFilterChange, label }) => {
|
|
35100
|
-
const { t } = useFunkitTranslation();
|
|
35101
|
-
const enabledChainIds = FUNKIT_CONNECT_SUPPORTED_CHECKOUT_CHAINS_INFO_LIST2.sort(
|
|
35102
|
-
(a, b) => a.name.localeCompare(b.name)
|
|
35103
|
-
).map((chain) => chain.id);
|
|
35104
|
-
return /* @__PURE__ */ React214.createElement(
|
|
35105
|
-
Box,
|
|
35106
|
-
{
|
|
35107
|
-
display: "flex",
|
|
35108
|
-
justifyContent: "space-between",
|
|
35109
|
-
alignItems: "center",
|
|
35110
|
-
color: "secondaryText"
|
|
35111
|
-
},
|
|
35112
|
-
/* @__PURE__ */ React214.createElement(Text, { size: "12", color: "secondaryText" }, label ?? t("selectAsset.yourTokens")),
|
|
35113
|
-
/* @__PURE__ */ React214.createElement(
|
|
35114
|
-
ChainDropdown,
|
|
35115
|
-
{
|
|
35116
|
-
activeItemProps: { color: "secondaryText" },
|
|
35117
|
-
allowUnselect: true,
|
|
35118
|
-
size: "compact",
|
|
35119
|
-
chainIds: enabledChainIds,
|
|
35120
|
-
assets: [],
|
|
35121
|
-
selectedChainId: value,
|
|
35122
|
-
onChainSelected: onFilterChange
|
|
35123
|
-
}
|
|
35124
|
-
)
|
|
35125
|
-
);
|
|
35126
|
-
};
|
|
35127
34918
|
function SelectAsset({
|
|
35128
34919
|
modalState,
|
|
35129
34920
|
onNext,
|
|
@@ -35145,7 +34936,7 @@ function SelectAsset({
|
|
|
35145
34936
|
const handleFinish = useEffectEvent(() => {
|
|
35146
34937
|
onNext({});
|
|
35147
34938
|
});
|
|
35148
|
-
return /* @__PURE__ */
|
|
34939
|
+
return /* @__PURE__ */ React213.createElement(Box, { display: "flex", flexDirection: "column", gap: "12", style: { flex: 1 } }, moreSources.length > 0 && /* @__PURE__ */ React213.createElement(
|
|
35149
34940
|
SelectAssetInfoSection,
|
|
35150
34941
|
{
|
|
35151
34942
|
paymentMethodInfo,
|
|
@@ -35154,7 +34945,7 @@ function SelectAsset({
|
|
|
35154
34945
|
onSelectSource: handleSelectSource,
|
|
35155
34946
|
isSourceNavWidgetEnabled: modalState.startingStep === "select_asset" /* SELECT_ASSET */
|
|
35156
34947
|
}
|
|
35157
|
-
), /* @__PURE__ */
|
|
34948
|
+
), /* @__PURE__ */ React213.createElement(
|
|
35158
34949
|
AccountSelectAsset,
|
|
35159
34950
|
{
|
|
35160
34951
|
paymentMethodInfo,
|
|
@@ -35226,6 +35017,101 @@ import { noop as noop9 } from "@funkit/utils";
|
|
|
35226
35017
|
import React222, { useEffect as useEffect55, useRef as useRef31, useState as useState63 } from "react";
|
|
35227
35018
|
import { createPortal as createPortal20 } from "react-dom";
|
|
35228
35019
|
|
|
35020
|
+
// src/components/Dropdown/ReceiveTokenDropdown.tsx
|
|
35021
|
+
import React214 from "react";
|
|
35022
|
+
var TOKEN_ICON_SIZE2 = "16";
|
|
35023
|
+
var aprTag = (badgeText) => /* @__PURE__ */ React214.createElement(
|
|
35024
|
+
FunBadge,
|
|
35025
|
+
{
|
|
35026
|
+
background: "badgeBackgroundSuccess",
|
|
35027
|
+
borderColor: "badgeBorderSuccess",
|
|
35028
|
+
color: "badgeTextSuccess"
|
|
35029
|
+
},
|
|
35030
|
+
badgeText
|
|
35031
|
+
);
|
|
35032
|
+
var ReceiveTokenDropdown = ({
|
|
35033
|
+
tokens,
|
|
35034
|
+
chainId,
|
|
35035
|
+
selectedToken,
|
|
35036
|
+
onTokenSelected,
|
|
35037
|
+
label,
|
|
35038
|
+
activeItemLabel,
|
|
35039
|
+
activeItemProps,
|
|
35040
|
+
maxDropdownHeight,
|
|
35041
|
+
displayedChainId
|
|
35042
|
+
}) => {
|
|
35043
|
+
const allTokens = Array.from(new Set(Object.values(tokens).flat()));
|
|
35044
|
+
const patchedChainId = displayedChainId ?? chainId;
|
|
35045
|
+
const tokenBadgeText = tokens.find(
|
|
35046
|
+
(token) => token.tokenSymbol === selectedToken
|
|
35047
|
+
)?.badgeText;
|
|
35048
|
+
const handleChangeSymbol = (symbol) => {
|
|
35049
|
+
const matchingToken = tokens.find((token) => token.tokenSymbol === symbol);
|
|
35050
|
+
if (matchingToken) {
|
|
35051
|
+
onTokenSelected(matchingToken);
|
|
35052
|
+
}
|
|
35053
|
+
};
|
|
35054
|
+
return /* @__PURE__ */ React214.createElement(
|
|
35055
|
+
BaseDropdown_default,
|
|
35056
|
+
{
|
|
35057
|
+
maxDropdownHeight,
|
|
35058
|
+
horizontalIconGap: "8",
|
|
35059
|
+
label,
|
|
35060
|
+
openToTopOnMobile: false,
|
|
35061
|
+
activeItemProps: {
|
|
35062
|
+
iconComponent: selectedToken && /* @__PURE__ */ React214.createElement(
|
|
35063
|
+
FunAssetAvatar,
|
|
35064
|
+
{
|
|
35065
|
+
assetIconSize: TOKEN_ICON_SIZE2,
|
|
35066
|
+
assetName: selectedToken,
|
|
35067
|
+
assetSrc: getTokenIconUrl(selectedToken, tokens),
|
|
35068
|
+
chainId: patchedChainId,
|
|
35069
|
+
largeChainIcon: true
|
|
35070
|
+
}
|
|
35071
|
+
),
|
|
35072
|
+
alwaysVisibleLabel: activeItemLabel,
|
|
35073
|
+
tagComponent: tokenBadgeText ? aprTag(tokenBadgeText) : void 0,
|
|
35074
|
+
...activeItemProps
|
|
35075
|
+
},
|
|
35076
|
+
value: selectedToken ?? "",
|
|
35077
|
+
options: allTokens.map((token) => ({
|
|
35078
|
+
value: token.tokenSymbol,
|
|
35079
|
+
label: token.tokenSymbol
|
|
35080
|
+
})),
|
|
35081
|
+
renderDropdownOption: (option, isSelected) => {
|
|
35082
|
+
const symbol = option.value;
|
|
35083
|
+
const iconUrl = getTokenIconUrl(symbol, tokens);
|
|
35084
|
+
const tokenBadgeText2 = tokens.find(
|
|
35085
|
+
(token) => token.tokenSymbol === symbol
|
|
35086
|
+
)?.badgeText;
|
|
35087
|
+
const tagComponent = tokenBadgeText2 ? aprTag(tokenBadgeText2) : void 0;
|
|
35088
|
+
return /* @__PURE__ */ React214.createElement(
|
|
35089
|
+
BaseDropdownItem_default,
|
|
35090
|
+
{
|
|
35091
|
+
horizontalIconGap: "8",
|
|
35092
|
+
iconComponent: /* @__PURE__ */ React214.createElement(
|
|
35093
|
+
FunAssetAvatar,
|
|
35094
|
+
{
|
|
35095
|
+
assetIconSize: TOKEN_ICON_SIZE2,
|
|
35096
|
+
assetName: "receive-token-asset",
|
|
35097
|
+
assetSrc: iconUrl,
|
|
35098
|
+
chainId: patchedChainId,
|
|
35099
|
+
largeChainIcon: true
|
|
35100
|
+
}
|
|
35101
|
+
),
|
|
35102
|
+
id: option.value,
|
|
35103
|
+
onClick: handleChangeSymbol,
|
|
35104
|
+
label: option.label,
|
|
35105
|
+
isSelected,
|
|
35106
|
+
tagComponent
|
|
35107
|
+
}
|
|
35108
|
+
);
|
|
35109
|
+
},
|
|
35110
|
+
preloadIconUrls: allTokens.map((token) => getTokenIconUrl(token.tokenSymbol, tokens)).filter((url) => !!url)
|
|
35111
|
+
}
|
|
35112
|
+
);
|
|
35113
|
+
};
|
|
35114
|
+
|
|
35229
35115
|
// src/hooks/queries/useFops.ts
|
|
35230
35116
|
import {
|
|
35231
35117
|
getFops
|
|
@@ -36756,7 +36642,8 @@ function SwappedIframe({
|
|
|
36756
36642
|
paddingX: "20",
|
|
36757
36643
|
flexDirection: "column",
|
|
36758
36644
|
alignItems: "center",
|
|
36759
|
-
width: "full"
|
|
36645
|
+
width: "full",
|
|
36646
|
+
id: "swapped-iframe-loading"
|
|
36760
36647
|
},
|
|
36761
36648
|
/* @__PURE__ */ React223.createElement(
|
|
36762
36649
|
Box,
|
|
@@ -36847,7 +36734,7 @@ function SwappedIframe({
|
|
|
36847
36734
|
)
|
|
36848
36735
|
);
|
|
36849
36736
|
}
|
|
36850
|
-
return
|
|
36737
|
+
return /* @__PURE__ */ React223.createElement(Box, { id: "swapped-iframe" });
|
|
36851
36738
|
}
|
|
36852
36739
|
function trackEventForFormOfPayment(fop, checkoutItem, eventName, extras) {
|
|
36853
36740
|
return {
|
|
@@ -38636,7 +38523,8 @@ var mapHeightToCheckoutStep = {
|
|
|
38636
38523
|
["fiat_account_detail" /* FIAT_ACCOUNT_DETAIL */]: 825,
|
|
38637
38524
|
["confirmation" /* CONFIRMATION */]: 825,
|
|
38638
38525
|
["checkout_complete" /* CHECKOUT_COMPLETE */]: 825,
|
|
38639
|
-
["connect_exchange" /* CONNECT_EXCHANGE */]: 825
|
|
38526
|
+
["connect_exchange" /* CONNECT_EXCHANGE */]: 825,
|
|
38527
|
+
["swapped_iframe" /* SWAPPED_IFRAME */]: DIALOG_HEIGHT_SWAPPED_IFRAME
|
|
38640
38528
|
};
|
|
38641
38529
|
function getPermittedHeight2(checkoutStep) {
|
|
38642
38530
|
const heightOffset = 2;
|
|
@@ -39957,7 +39845,7 @@ function ChainModal({ onClose, open }) {
|
|
|
39957
39845
|
}
|
|
39958
39846
|
|
|
39959
39847
|
// src/modals/CheckoutModal/FunCheckoutModal.tsx
|
|
39960
|
-
import { FUNKIT_CONNECT_SUPPORTED_CHECKOUT_CHAINS_INFO_LIST as
|
|
39848
|
+
import { FUNKIT_CONNECT_SUPPORTED_CHECKOUT_CHAINS_INFO_LIST as FUNKIT_CONNECT_SUPPORTED_CHECKOUT_CHAINS_INFO_LIST2 } from "@funkit/chains";
|
|
39961
39849
|
import { LogLevel as LogLevel2, initializeRelayClient } from "@funkit/fun-relay";
|
|
39962
39850
|
import React268, { useRef as useRef36 } from "react";
|
|
39963
39851
|
|
|
@@ -40598,7 +40486,7 @@ var SwappedIframePool_default = React267.memo(SwappedIframePool);
|
|
|
40598
40486
|
// src/modals/CheckoutModal/FunCheckoutModal.tsx
|
|
40599
40487
|
initializeRelayClient({
|
|
40600
40488
|
// For now, enable only the checkout target chains funkit supports. In future, source chains may be added.
|
|
40601
|
-
chains:
|
|
40489
|
+
chains: FUNKIT_CONNECT_SUPPORTED_CHECKOUT_CHAINS_INFO_LIST2,
|
|
40602
40490
|
logLevel: LogLevel2.Verbose,
|
|
40603
40491
|
logger
|
|
40604
40492
|
});
|