@funkit/connect 9.21.1-next.0 → 9.22.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 +10 -21
- package/dist/clients/aave.d.ts +2 -0
- package/dist/clients/aave.js +3 -0
- package/dist/clients/{chunk-7HNGV6JU.js → chunk-KSSSSWR6.js} +1 -1
- package/dist/clients/{chunk-4HCOSF4M.js → chunk-NCCAYPLO.js} +1 -1
- package/dist/clients/{chunk-NCUPPJ2Z.js → chunk-OWXKWC7I.js} +8 -8
- package/dist/clients/{chunk-NUJ6ZM5F.js → chunk-ZMVXBMON.js} +1 -1
- package/dist/clients/fanatics.css +1 -1
- package/dist/clients/fanatics.js +3 -3
- package/dist/clients/lighter.css +1 -1
- package/dist/clients/lighter.js +3 -3
- package/dist/clients/polymarket/PolymarketDepositAccountDropdown.css +11 -11
- package/dist/clients/polymarket/PolymarketDepositAccountDropdown.js +5 -5
- package/dist/clients/polymarket/index.css +11 -11
- package/dist/clients/polymarket/index.js +5 -5
- package/dist/hooks/useTokenTransferConfig.d.ts +0 -7
- package/dist/index.css +11 -11
- package/dist/index.js +270 -76
- package/dist/modals/CheckoutModal/InputAmount/InputAmountLayout.d.ts +6 -1
- package/dist/utils/checkout.d.ts +16 -0
- package/dist/utils/tokenTransfer/disabledList.d.ts +14 -1
- package/dist/utils/tokenTransfer/types.d.ts +30 -5
- package/dist/wallets/walletConnectors/index.js +46 -46
- package/package.json +2 -2
- package/dist/__generated__/default_configs.d.ts +0 -901
- package/dist/__generated__/default_feature_gates.d.ts +0 -20
- package/dist/chunk-6K4U3Z4Z.js +0 -375
- package/dist/chunk-NBECXHBY.js +0 -249
- package/dist/chunk-PFIXC5YK.js +0 -249
- package/dist/clients/chunk-25ICASD7.js +0 -2371
- package/dist/clients/chunk-7GWX2ZS4.js +0 -69
- package/dist/clients/chunk-EGMA6ATZ.js +0 -2371
- package/dist/clients/chunk-GGXTLJ7J.js +0 -290
- package/dist/clients/chunk-HRWCNZJA.js +0 -230
- package/dist/clients/chunk-JTGKAPID.js +0 -2382
- package/dist/clients/chunk-L7PABCF2.js +0 -54
- package/dist/clients/chunk-OJLDTEKB.js +0 -54
- package/dist/clients/chunk-SSSQQ32F.js +0 -186
- package/dist/clients/chunk-UVWNEQMD.js +0 -186
- package/dist/clients/chunk-YLZ7COFH.js +0 -230
- package/dist/clients/chunk-ZEFHAWRH.js +0 -69
- package/dist/clients/polymarket.d.ts +0 -161
- package/dist/clients/polymarket.js +0 -688
- package/dist/interfaces/logTransport.d.ts +0 -51
- package/dist/interfaces/swapped-transport.d.ts +0 -78
- package/dist/modals/CheckoutModal/SourceChange/EmptyFormOfPaymentsMessage.d.ts +0 -4
- package/dist/modals/CheckoutModal/SourceChange/useUpdateSourceAssetForCard.d.ts +0 -4
- package/dist/modals/CheckoutModal/SwappedIframe/SwappedErrorMessage.d.ts +0 -6
- package/dist/utils/flags/resolver.d.ts +0 -34
- package/dist/wallets/walletConnectors/chunk-2VP2F6EK.js +0 -70
- package/dist/wallets/walletConnectors/chunk-4T6ZSRJF.js +0 -69
- package/dist/wallets/walletConnectors/chunk-6BW3HLBG.js +0 -96
- package/dist/wallets/walletConnectors/chunk-CCQV2ZET.js +0 -218
- package/dist/wallets/walletConnectors/chunk-CPI4TD43.js +0 -99
- package/dist/wallets/walletConnectors/chunk-F5XEEVG6.js +0 -98
- package/dist/wallets/walletConnectors/chunk-HNRB7KJU.js +0 -92
- package/dist/wallets/walletConnectors/chunk-HTHAK6XB.js +0 -93
- package/dist/wallets/walletConnectors/chunk-MIQTHJ6X.js +0 -66
- package/dist/wallets/walletConnectors/chunk-RB3HR4R2.js +0 -95
- package/dist/wallets/walletConnectors/chunk-RVOY537T.js +0 -100
- package/dist/wallets/walletConnectors/chunk-STVVP43G.js +0 -94
- package/dist/wallets/walletConnectors/chunk-UK7C2JXW.js +0 -87
- package/dist/wallets/walletConnectors/chunk-VAPGUPHO.js +0 -92
- package/dist/wallets/walletConnectors/chunk-VTM6EECM.js +0 -110
- package/dist/wallets/walletConnectors/chunk-X6CGV36L.js +0 -103
- package/dist/wallets/walletConnectors/chunk-YEZM4CK4.js +0 -96
- package/dist/wallets/walletConnectors/chunk-ZNX4EMPB.js +0 -106
- /package/dist/clients/{chunk-JD3FIVZ7.js → chunk-52NKHZS2.js} +0 -0
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
darkTheme
|
|
4
|
-
} from "./chunk-36KVHK22.js";
|
|
5
2
|
import {
|
|
6
3
|
lightTheme
|
|
7
4
|
} from "./chunk-67BKQQNG.js";
|
|
5
|
+
import {
|
|
6
|
+
darkTheme
|
|
7
|
+
} from "./chunk-36KVHK22.js";
|
|
8
8
|
import {
|
|
9
9
|
systemFontStack
|
|
10
10
|
} from "./chunk-4YEAUICE.js";
|
|
@@ -968,15 +968,15 @@ import {
|
|
|
968
968
|
getAllWalletTokens
|
|
969
969
|
} from "@funkit/api-base";
|
|
970
970
|
import { keepPreviousData as keepPreviousData4, useQuery as useQuery30 } from "@tanstack/react-query";
|
|
971
|
-
import { arbitrum as arbitrum7, polygon as
|
|
971
|
+
import { arbitrum as arbitrum7, polygon as polygon9 } from "viem/chains";
|
|
972
972
|
|
|
973
973
|
// src/domains/asset.ts
|
|
974
974
|
import {
|
|
975
975
|
FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO12,
|
|
976
|
-
solanaChain as
|
|
976
|
+
solanaChain as solanaChain7
|
|
977
977
|
} from "@funkit/chains";
|
|
978
|
-
import { isTokenAddressEquivalent as
|
|
979
|
-
import { arbitrum as arbitrum6, base as base6, mainnet as mainnet13, optimism as optimism2, polygon as
|
|
978
|
+
import { isTokenAddressEquivalent as isTokenAddressEquivalent7, isTokenEquivalent as isTokenEquivalent11 } from "@funkit/utils";
|
|
979
|
+
import { arbitrum as arbitrum6, base as base6, mainnet as mainnet13, optimism as optimism2, polygon as polygon8 } from "viem/chains";
|
|
980
980
|
|
|
981
981
|
// src/utils/checkout.ts
|
|
982
982
|
import {
|
|
@@ -986,14 +986,14 @@ import {
|
|
|
986
986
|
FUNKIT_CONNECT_CHECKOUT_NATIVE_CURRENCY_ADDRESS as FUNKIT_CONNECT_CHECKOUT_NATIVE_CURRENCY_ADDRESS4,
|
|
987
987
|
FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO11,
|
|
988
988
|
lightningChain as lightningChain4,
|
|
989
|
-
solanaChain as
|
|
990
|
-
tronChain as
|
|
989
|
+
solanaChain as solanaChain6,
|
|
990
|
+
tronChain as tronChain5
|
|
991
991
|
} from "@funkit/chains";
|
|
992
992
|
import { getRelayAssetInfo } from "@funkit/fun-relay";
|
|
993
993
|
import {
|
|
994
994
|
formatCryptoAndStringify as formatCryptoAndStringify11,
|
|
995
995
|
isNumericString,
|
|
996
|
-
isTokenAddressEquivalent as
|
|
996
|
+
isTokenAddressEquivalent as isTokenAddressEquivalent6,
|
|
997
997
|
isTokenEquivalent as isTokenEquivalent10,
|
|
998
998
|
round as round3
|
|
999
999
|
} from "@funkit/utils";
|
|
@@ -1114,7 +1114,7 @@ import {
|
|
|
1114
1114
|
FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO10,
|
|
1115
1115
|
SOLANA_MAINNET_CHAIN_ID as SOLANA_MAINNET_CHAIN_ID2
|
|
1116
1116
|
} from "@funkit/chains";
|
|
1117
|
-
import { isNotNullish as isNotNullish8, isTokenAddressEquivalent as
|
|
1117
|
+
import { isNotNullish as isNotNullish8, isTokenAddressEquivalent as isTokenAddressEquivalent5 } from "@funkit/utils";
|
|
1118
1118
|
import React300, {
|
|
1119
1119
|
createContext as createContext21,
|
|
1120
1120
|
useCallback as useCallback57,
|
|
@@ -1642,7 +1642,7 @@ function setFunkitConnectVersion({ version }) {
|
|
|
1642
1642
|
localStorage.setItem(storageKey, version);
|
|
1643
1643
|
}
|
|
1644
1644
|
function getCurrentSdkVersion() {
|
|
1645
|
-
return "9.
|
|
1645
|
+
return "9.22.0";
|
|
1646
1646
|
}
|
|
1647
1647
|
function useFingerprint() {
|
|
1648
1648
|
const fingerprint = useCallback3(() => {
|
|
@@ -19991,10 +19991,8 @@ function isLive(option) {
|
|
|
19991
19991
|
}
|
|
19992
19992
|
|
|
19993
19993
|
// src/hooks/useTokenTransferConfig.ts
|
|
19994
|
-
import {
|
|
19995
|
-
resolveTokenTransferConfig
|
|
19996
|
-
} from "@funkit/connect-core";
|
|
19997
19994
|
import { useMemo as useMemo27 } from "react";
|
|
19995
|
+
import { polygon as polygon6 } from "viem/chains";
|
|
19998
19996
|
|
|
19999
19997
|
// src/hooks/useSupportedAssets.ts
|
|
20000
19998
|
import {
|
|
@@ -20015,8 +20013,150 @@ function useSupportedAssets(options) {
|
|
|
20015
20013
|
});
|
|
20016
20014
|
}
|
|
20017
20015
|
|
|
20016
|
+
// src/utils/tokenTransfer/disabledList.ts
|
|
20017
|
+
import { isTokenAddressEquivalent } from "@funkit/utils";
|
|
20018
|
+
function isChainDisabled(disabledConfig, chainId2) {
|
|
20019
|
+
if (!disabledConfig) {
|
|
20020
|
+
return false;
|
|
20021
|
+
}
|
|
20022
|
+
const disabledTokens = disabledConfig[String(chainId2)];
|
|
20023
|
+
if (!disabledTokens) {
|
|
20024
|
+
return false;
|
|
20025
|
+
}
|
|
20026
|
+
return disabledTokens.includes("*");
|
|
20027
|
+
}
|
|
20028
|
+
function isAssetDisabled(disabledConfig, chainId2, tokenAddress) {
|
|
20029
|
+
if (!disabledConfig) {
|
|
20030
|
+
return false;
|
|
20031
|
+
}
|
|
20032
|
+
const disabledTokens = disabledConfig[String(chainId2)];
|
|
20033
|
+
if (!disabledTokens) {
|
|
20034
|
+
return false;
|
|
20035
|
+
}
|
|
20036
|
+
if (disabledTokens.includes("*")) {
|
|
20037
|
+
return true;
|
|
20038
|
+
}
|
|
20039
|
+
return disabledTokens.some(
|
|
20040
|
+
(disabledTokenAddress) => isTokenAddressEquivalent({
|
|
20041
|
+
firstTokenAddress: disabledTokenAddress,
|
|
20042
|
+
secondTokenAddress: tokenAddress
|
|
20043
|
+
})
|
|
20044
|
+
);
|
|
20045
|
+
}
|
|
20046
|
+
|
|
20018
20047
|
// src/hooks/useTokenTransferConfig.ts
|
|
20019
|
-
var
|
|
20048
|
+
var SYMBOL_OVERRIDES = {
|
|
20049
|
+
"USD\u20AE0": "USDT",
|
|
20050
|
+
USDT0: "USDT"
|
|
20051
|
+
};
|
|
20052
|
+
var POLYGON_NATIVE_TOKEN_ALIAS = "MATIC";
|
|
20053
|
+
function lowercaseAddressKeys(response) {
|
|
20054
|
+
return Object.fromEntries(
|
|
20055
|
+
Object.entries(response).map(([chainId2, chainAssets]) => [
|
|
20056
|
+
chainId2,
|
|
20057
|
+
Object.fromEntries(
|
|
20058
|
+
Object.entries(chainAssets).map(([address, metadata]) => [
|
|
20059
|
+
address.toLowerCase(),
|
|
20060
|
+
metadata
|
|
20061
|
+
])
|
|
20062
|
+
)
|
|
20063
|
+
])
|
|
20064
|
+
);
|
|
20065
|
+
}
|
|
20066
|
+
function resolveSymbols(backendSymbol, chainId2, address) {
|
|
20067
|
+
const displaySymbol = SYMBOL_OVERRIDES[backendSymbol] ?? backendSymbol;
|
|
20068
|
+
const alias = chainId2 === polygon6.id && isNativeTokenAddress(address) ? POLYGON_NATIVE_TOKEN_ALIAS : void 0;
|
|
20069
|
+
return { displaySymbol, alias };
|
|
20070
|
+
}
|
|
20071
|
+
function resolveChainAssets(chainConfig, chainAssets, disabledChainAssets) {
|
|
20072
|
+
const { chainId: chainId2 } = chainConfig;
|
|
20073
|
+
const resolvedChainAssets = chainConfig.assets.filter(
|
|
20074
|
+
(configAsset) => !isAssetDisabled(
|
|
20075
|
+
disabledChainAssets,
|
|
20076
|
+
chainId2,
|
|
20077
|
+
configAsset.address.toLowerCase()
|
|
20078
|
+
)
|
|
20079
|
+
).map((configAsset) => {
|
|
20080
|
+
const address = configAsset.address.toLowerCase();
|
|
20081
|
+
const metadata = chainAssets?.[address];
|
|
20082
|
+
if (!metadata) {
|
|
20083
|
+
logger.warn("useTokenTransferConfig:tokenMetadataMissing", {
|
|
20084
|
+
chainId: chainId2,
|
|
20085
|
+
address: configAsset.address
|
|
20086
|
+
});
|
|
20087
|
+
return null;
|
|
20088
|
+
}
|
|
20089
|
+
const { displaySymbol, alias } = resolveSymbols(
|
|
20090
|
+
metadata.symbol,
|
|
20091
|
+
chainId2,
|
|
20092
|
+
address
|
|
20093
|
+
);
|
|
20094
|
+
return {
|
|
20095
|
+
address,
|
|
20096
|
+
metadata: { ...configAsset, ...metadata, symbol: displaySymbol },
|
|
20097
|
+
alias
|
|
20098
|
+
};
|
|
20099
|
+
}).filter((item) => item !== null);
|
|
20100
|
+
const assets = Object.fromEntries(
|
|
20101
|
+
resolvedChainAssets.map(({ address, metadata }) => [address, metadata])
|
|
20102
|
+
);
|
|
20103
|
+
const symbols = [
|
|
20104
|
+
...new Set(
|
|
20105
|
+
resolvedChainAssets.flatMap(
|
|
20106
|
+
({ metadata, alias }) => alias ? [metadata.symbol, alias] : [metadata.symbol]
|
|
20107
|
+
)
|
|
20108
|
+
)
|
|
20109
|
+
];
|
|
20110
|
+
return { assets, symbols };
|
|
20111
|
+
}
|
|
20112
|
+
function resolveNewBadgeSymbols(resolvedChains) {
|
|
20113
|
+
const allBadgeAssets = resolvedChains.flatMap(
|
|
20114
|
+
({ resolvedChainAssets }) => Object.values(resolvedChainAssets.assets).filter((a) => !!a.showNewBadge)
|
|
20115
|
+
);
|
|
20116
|
+
return /* @__PURE__ */ new Set([
|
|
20117
|
+
...allBadgeAssets.filter((a) => a.showNewBadge === "primary").map((a) => a.symbol),
|
|
20118
|
+
...allBadgeAssets.filter((a) => a.showNewBadge !== "primary").map((a) => a.symbol)
|
|
20119
|
+
]);
|
|
20120
|
+
}
|
|
20121
|
+
function resolveTokenTransferConfig(chainConfigs, rawPriorityTokens, disabledChainAssets, allSupportedAssets) {
|
|
20122
|
+
const lowercasedAssets = lowercaseAddressKeys(allSupportedAssets);
|
|
20123
|
+
const resolvedChains = chainConfigs.filter((c) => !isChainDisabled(disabledChainAssets, c.chainId)).map((chainConfig) => ({
|
|
20124
|
+
chainConfig,
|
|
20125
|
+
resolvedChainAssets: resolveChainAssets(
|
|
20126
|
+
chainConfig,
|
|
20127
|
+
lowercasedAssets[String(chainConfig.chainId)],
|
|
20128
|
+
disabledChainAssets
|
|
20129
|
+
)
|
|
20130
|
+
})).filter(({ resolvedChainAssets }) => resolvedChainAssets.symbols.length > 0);
|
|
20131
|
+
const supportedAssets = Object.fromEntries(
|
|
20132
|
+
resolvedChains.map(({ chainConfig, resolvedChainAssets }) => [
|
|
20133
|
+
chainConfig.chainId,
|
|
20134
|
+
resolvedChainAssets.assets
|
|
20135
|
+
])
|
|
20136
|
+
);
|
|
20137
|
+
const symbolsByChainId = Object.fromEntries(
|
|
20138
|
+
resolvedChains.map(({ chainConfig, resolvedChainAssets }) => [
|
|
20139
|
+
chainConfig.chainId,
|
|
20140
|
+
resolvedChainAssets.symbols
|
|
20141
|
+
])
|
|
20142
|
+
);
|
|
20143
|
+
const chainIdSortOrder = resolvedChains.map(
|
|
20144
|
+
({ chainConfig }) => chainConfig.chainId
|
|
20145
|
+
);
|
|
20146
|
+
const defaultChainId = resolvedChains.find(
|
|
20147
|
+
({ chainConfig }) => chainConfig.isDefault
|
|
20148
|
+
)?.chainConfig.chainId;
|
|
20149
|
+
const newBadgeSymbols = resolveNewBadgeSymbols(resolvedChains);
|
|
20150
|
+
return {
|
|
20151
|
+
supportedAssets,
|
|
20152
|
+
symbolsByChainId,
|
|
20153
|
+
chainIdSortOrder,
|
|
20154
|
+
defaultChainId,
|
|
20155
|
+
priorityTokenSymbols: [...rawPriorityTokens],
|
|
20156
|
+
newBadgeSymbols
|
|
20157
|
+
};
|
|
20158
|
+
}
|
|
20159
|
+
var EMPTY_CONFIG = {
|
|
20020
20160
|
supportedAssets: {},
|
|
20021
20161
|
symbolsByChainId: {},
|
|
20022
20162
|
chainIdSortOrder: [],
|
|
@@ -20038,15 +20178,15 @@ function useTokenTransferConfig(isWithdrawal = false) {
|
|
|
20038
20178
|
const { data: allSupportedAssets, isLoading } = useSupportedAssets();
|
|
20039
20179
|
const config = useMemo27(() => {
|
|
20040
20180
|
if (!allSupportedAssets) {
|
|
20041
|
-
return
|
|
20181
|
+
return EMPTY_CONFIG;
|
|
20042
20182
|
}
|
|
20043
|
-
|
|
20044
|
-
|
|
20045
|
-
|
|
20183
|
+
const { chains: rawChains, priorityTokens: rawPriorityTokens } = rawConfig;
|
|
20184
|
+
return resolveTokenTransferConfig(
|
|
20185
|
+
rawChains ?? [],
|
|
20186
|
+
rawPriorityTokens ?? [],
|
|
20046
20187
|
disabledChainAssets,
|
|
20047
|
-
|
|
20048
|
-
|
|
20049
|
-
});
|
|
20188
|
+
allSupportedAssets
|
|
20189
|
+
);
|
|
20050
20190
|
}, [rawConfig, disabledChainAssets, allSupportedAssets]);
|
|
20051
20191
|
return { ...config, isLoading };
|
|
20052
20192
|
}
|
|
@@ -24508,7 +24648,7 @@ import { isTokenEquivalent as isTokenEquivalent3 } from "@funkit/utils";
|
|
|
24508
24648
|
import { useQuery as useQuery16 } from "@tanstack/react-query";
|
|
24509
24649
|
|
|
24510
24650
|
// src/hooks/useIsBlacklistedWithdrawalAddress.ts
|
|
24511
|
-
import { isTokenAddressEquivalent } from "@funkit/utils";
|
|
24651
|
+
import { isTokenAddressEquivalent as isTokenAddressEquivalent2 } from "@funkit/utils";
|
|
24512
24652
|
import { useMemo as useMemo36 } from "react";
|
|
24513
24653
|
function useIsBlacklistedWithdrawalAddress(address) {
|
|
24514
24654
|
const addressBlacklist = useDynamicConfig("blacklistedwithdrawaladdress");
|
|
@@ -24525,7 +24665,7 @@ function useIsBlacklistedWithdrawalAddress(address) {
|
|
|
24525
24665
|
return addresses;
|
|
24526
24666
|
}, [withdrawalConfig.chains]);
|
|
24527
24667
|
return Object.keys(addressBlacklist).concat(withdrawalTokenAddresses).some(
|
|
24528
|
-
(blockedAddress) =>
|
|
24668
|
+
(blockedAddress) => isTokenAddressEquivalent2({
|
|
24529
24669
|
firstTokenAddress: blockedAddress,
|
|
24530
24670
|
secondTokenAddress: address
|
|
24531
24671
|
})
|
|
@@ -24809,22 +24949,30 @@ var useAssetSymbolPrice = ({
|
|
|
24809
24949
|
|
|
24810
24950
|
// src/hooks/useTokenAndChainDropdown.ts
|
|
24811
24951
|
import { useEffect as useEffect39, useState as useState34 } from "react";
|
|
24812
|
-
import { polygon as
|
|
24952
|
+
import { polygon as polygon7 } from "viem/chains";
|
|
24813
24953
|
|
|
24814
24954
|
// src/hooks/useEnabledTokenTransferChainTokens.ts
|
|
24815
|
-
import {
|
|
24955
|
+
import { bitcoinChain as bitcoinChain5, solanaChain as solanaChain4, tronChain as tronChain3 } from "@funkit/chains";
|
|
24816
24956
|
function useEnabledTokenTransferChainTokens(transferInit, isWithdrawal) {
|
|
24817
24957
|
const { symbolsByChainId } = useTokenTransferConfig(isWithdrawal);
|
|
24958
|
+
const hasSolanaAddress = !!transferInit?.solanaAddr;
|
|
24959
|
+
const hasBitcoinAddress = !!transferInit?.btcAddrSegwit;
|
|
24960
|
+
const hasTronAddress = !!transferInit?.tronAddr;
|
|
24818
24961
|
return Object.keys(
|
|
24819
24962
|
symbolsByChainId
|
|
24820
24963
|
).reduce(
|
|
24821
24964
|
(acc, curChainIdString) => {
|
|
24822
24965
|
const chainId2 = Number(curChainIdString);
|
|
24823
|
-
|
|
24824
|
-
|
|
24825
|
-
|
|
24826
|
-
|
|
24827
|
-
|
|
24966
|
+
const isSolana = chainId2 === solanaChain4.id;
|
|
24967
|
+
if (isSolana && !hasSolanaAddress && !isWithdrawal) {
|
|
24968
|
+
return acc;
|
|
24969
|
+
}
|
|
24970
|
+
const isBitcoin = chainId2 === bitcoinChain5.id;
|
|
24971
|
+
if (isBitcoin && !hasBitcoinAddress && !isWithdrawal) {
|
|
24972
|
+
return acc;
|
|
24973
|
+
}
|
|
24974
|
+
const isTron = chainId2 === tronChain3.id;
|
|
24975
|
+
if (isTron && !hasTronAddress && !isWithdrawal) {
|
|
24828
24976
|
return acc;
|
|
24829
24977
|
}
|
|
24830
24978
|
if (symbolsByChainId[chainId2]?.length) {
|
|
@@ -24842,7 +24990,7 @@ function resolveDefaultChainId(enabledChainSymbols, preferredChainId) {
|
|
|
24842
24990
|
return preferredChainId;
|
|
24843
24991
|
}
|
|
24844
24992
|
const firstAvailable = Number(Object.keys(enabledChainSymbols)[0]);
|
|
24845
|
-
return firstAvailable ||
|
|
24993
|
+
return firstAvailable || polygon7.id;
|
|
24846
24994
|
}
|
|
24847
24995
|
function resolveDefaultToken(currentChainSymbols, preferredToken) {
|
|
24848
24996
|
if (preferredToken && currentChainSymbols?.includes(preferredToken)) {
|
|
@@ -24869,7 +25017,7 @@ var useTokenAndChainDropdown = ({
|
|
|
24869
25017
|
const tokenTransferConfig = useTokenTransferConfig(isWithdrawal);
|
|
24870
25018
|
const isLoadingAssets = tokenTransferConfig.isLoading || Object.keys(tokenTransferConfig.symbolsByChainId).length === 0;
|
|
24871
25019
|
const popularTokenSymbols = tokenTransferConfig.popularTokenSymbols ?? [];
|
|
24872
|
-
const preferredChainId = defaultValues?.chainId ?? tokenTransferConfig.defaultChainId ??
|
|
25020
|
+
const preferredChainId = defaultValues?.chainId ?? tokenTransferConfig.defaultChainId ?? polygon7.id;
|
|
24873
25021
|
const validDefaultChainId = resolveDefaultChainId(
|
|
24874
25022
|
enabledChainSymbols,
|
|
24875
25023
|
preferredChainId
|
|
@@ -25112,8 +25260,8 @@ function getErrorNotification({
|
|
|
25112
25260
|
import React128, { useEffect as useEffect40, useState as useState35 } from "react";
|
|
25113
25261
|
import {
|
|
25114
25262
|
FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO8,
|
|
25115
|
-
solanaChain as
|
|
25116
|
-
tronChain as
|
|
25263
|
+
solanaChain as solanaChain5,
|
|
25264
|
+
tronChain as tronChain4
|
|
25117
25265
|
} from "@funkit/chains";
|
|
25118
25266
|
function getAlertMessage(selectedChainId, selectedToken, t) {
|
|
25119
25267
|
const chainName = FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO8[selectedChainId]?.name;
|
|
@@ -25141,7 +25289,7 @@ function useShowConnectWallet({ config }) {
|
|
|
25141
25289
|
return showUseConnected;
|
|
25142
25290
|
}
|
|
25143
25291
|
function getRecipientAddressPlaceholder(selectedChainId, t) {
|
|
25144
|
-
if (selectedChainId ===
|
|
25292
|
+
if (selectedChainId === solanaChain5.id || selectedChainId === tronChain4.id) {
|
|
25145
25293
|
return t("withdrawal.enterRecipientAddress")[0] + t("withdrawal.enterRecipientAddress").slice(1).toLowerCase();
|
|
25146
25294
|
}
|
|
25147
25295
|
return "0x...";
|
|
@@ -31505,7 +31653,7 @@ var ChainInfoBanners = ({ chainId: chainId2 }) => {
|
|
|
31505
31653
|
// src/components/FunTransactionSummary/PaymentAmountSummary.tsx
|
|
31506
31654
|
import {
|
|
31507
31655
|
formatCurrencyAndStringify as formatCurrencyAndStringify7,
|
|
31508
|
-
isTokenAddressEquivalent as
|
|
31656
|
+
isTokenAddressEquivalent as isTokenAddressEquivalent3,
|
|
31509
31657
|
isTokenEquivalent as isTokenEquivalent4
|
|
31510
31658
|
} from "@funkit/utils";
|
|
31511
31659
|
import NumberFlow from "@number-flow/react";
|
|
@@ -31561,7 +31709,7 @@ function PaymentAmountSummary({
|
|
|
31561
31709
|
const sourceChainId = sourceAssetInfo?.chainId;
|
|
31562
31710
|
const areSameChains = sourceChainId === targetChainId;
|
|
31563
31711
|
const sourceIcon = sourceAssetInfo?.iconSrc ?? void 0;
|
|
31564
|
-
const isSameTokenAddress =
|
|
31712
|
+
const isSameTokenAddress = isTokenAddressEquivalent3({
|
|
31565
31713
|
firstTokenAddress: sourceTokenAddress,
|
|
31566
31714
|
secondTokenAddress: targetTokenAddress
|
|
31567
31715
|
});
|
|
@@ -31725,7 +31873,7 @@ import React192 from "react";
|
|
|
31725
31873
|
|
|
31726
31874
|
// src/components/FunTransactionSummary/DestinationYieldRows.tsx
|
|
31727
31875
|
import React191 from "react";
|
|
31728
|
-
var
|
|
31876
|
+
var YIELD_GREEN = "#478f00";
|
|
31729
31877
|
function DestinationYieldRows({
|
|
31730
31878
|
yieldInfo
|
|
31731
31879
|
}) {
|
|
@@ -31740,7 +31888,16 @@ function DestinationYieldRows({
|
|
|
31740
31888
|
{
|
|
31741
31889
|
text: t("checkoutConfirmation.supplyApy")
|
|
31742
31890
|
}
|
|
31743
|
-
), /* @__PURE__ */ React191.createElement(
|
|
31891
|
+
), /* @__PURE__ */ React191.createElement(
|
|
31892
|
+
Text,
|
|
31893
|
+
{
|
|
31894
|
+
style: { color: YIELD_GREEN },
|
|
31895
|
+
weight: "txSummaryValue",
|
|
31896
|
+
size: "txSummaryValue",
|
|
31897
|
+
textAlign: "right"
|
|
31898
|
+
},
|
|
31899
|
+
`${supplyApy}%`
|
|
31900
|
+
)), supplyApy !== void 0 && collateralizationEnabled !== void 0 && /* @__PURE__ */ React191.createElement(FunTxSummaryDivider, null), collateralizationEnabled !== void 0 && /* @__PURE__ */ React191.createElement(FunTxSummaryLineItem, { testId: "destination-collateralization" }, /* @__PURE__ */ React191.createElement(
|
|
31744
31901
|
FunTxSummaryLineItemKeyText,
|
|
31745
31902
|
{
|
|
31746
31903
|
text: t("checkoutConfirmation.collateralization")
|
|
@@ -31749,7 +31906,7 @@ function DestinationYieldRows({
|
|
|
31749
31906
|
Text,
|
|
31750
31907
|
{
|
|
31751
31908
|
color: collateralizationEnabled ? void 0 : "secondaryText",
|
|
31752
|
-
style: collateralizationEnabled ? { color:
|
|
31909
|
+
style: collateralizationEnabled ? { color: YIELD_GREEN } : void 0,
|
|
31753
31910
|
weight: "txSummaryValue",
|
|
31754
31911
|
size: "txSummaryValue",
|
|
31755
31912
|
textAlign: "right"
|
|
@@ -34560,18 +34717,29 @@ import { isMobile as isMobile6 } from "@funkit/utils";
|
|
|
34560
34717
|
import React209 from "react";
|
|
34561
34718
|
import { createPortal as createPortal16 } from "react-dom";
|
|
34562
34719
|
import { LayoutGroup } from "motion/react";
|
|
34720
|
+
var shouldHideAmountSwitcherForStablecoin = (switcherTokenSymbol, isStablecoin, isStablecoinSwitchHidingEnabled) => isStablecoinSwitchHidingEnabled && !!switcherTokenSymbol && isStablecoin(switcherTokenSymbol);
|
|
34563
34721
|
function InputAmountLayout({
|
|
34564
34722
|
actionButtonProps,
|
|
34565
34723
|
amountOptions,
|
|
34566
34724
|
fiatCurrencySelector,
|
|
34567
34725
|
amountInput: amountInput2,
|
|
34568
34726
|
amountInputSwitch,
|
|
34727
|
+
switcherTokenSymbol,
|
|
34569
34728
|
header,
|
|
34570
34729
|
footer,
|
|
34571
34730
|
error
|
|
34572
34731
|
}) {
|
|
34573
34732
|
const funkitConfig = useFunkitConfig();
|
|
34574
|
-
const
|
|
34733
|
+
const isStablecoin = useIsStablecoin();
|
|
34734
|
+
const isStablecoinSwitchHidingEnabled = useFeatureGate(
|
|
34735
|
+
"hide-stablecoin-amount-switch"
|
|
34736
|
+
);
|
|
34737
|
+
const shouldHideTokenAmountInputSwitcher = shouldHideAmountSwitcherForStablecoin(
|
|
34738
|
+
switcherTokenSymbol,
|
|
34739
|
+
isStablecoin,
|
|
34740
|
+
isStablecoinSwitchHidingEnabled
|
|
34741
|
+
);
|
|
34742
|
+
const allowTokenAmountInput = funkitConfig.uiCustomizations.inputAmountScreen.allowTokenAmountInput ? !shouldHideTokenAmountInputSwitcher : false;
|
|
34575
34743
|
const bottomSectionRef = useBottomSectionRef();
|
|
34576
34744
|
return /* @__PURE__ */ React209.createElement(Box, { display: "flex", flexDirection: "column", width: "full", style: { flex: 1 } }, /* @__PURE__ */ React209.createElement(
|
|
34577
34745
|
Box,
|
|
@@ -35274,7 +35442,7 @@ function useTextMeasurer(inputRef) {
|
|
|
35274
35442
|
|
|
35275
35443
|
// src/modals/CheckoutModal/InputAmount/state.ts
|
|
35276
35444
|
import {
|
|
35277
|
-
isTokenAddressEquivalent as
|
|
35445
|
+
isTokenAddressEquivalent as isTokenAddressEquivalent4,
|
|
35278
35446
|
isTokenEquivalent as isTokenEquivalent6,
|
|
35279
35447
|
round
|
|
35280
35448
|
} from "@funkit/utils";
|
|
@@ -35459,7 +35627,7 @@ function isEffectivelySameAsset(checkoutConfig, sourceToken, apiKey) {
|
|
|
35459
35627
|
return true;
|
|
35460
35628
|
}
|
|
35461
35629
|
const mainnetChainId = mainnet11.id.toString();
|
|
35462
|
-
return isLighterxyzCustomer(apiKey) && sourceToken.chainId === mainnetChainId && isNativeTokenAddress(sourceToken.address) && checkoutConfig.targetChain === mainnetChainId &&
|
|
35630
|
+
return isLighterxyzCustomer(apiKey) && sourceToken.chainId === mainnetChainId && isNativeTokenAddress(sourceToken.address) && checkoutConfig.targetChain === mainnetChainId && isTokenAddressEquivalent4({
|
|
35463
35631
|
firstTokenAddress: checkoutConfig.targetAsset,
|
|
35464
35632
|
secondTokenAddress: WETH_MAINNET_ADDRESS
|
|
35465
35633
|
});
|
|
@@ -36843,7 +37011,7 @@ function InputAmountLoaded({
|
|
|
36843
37011
|
}
|
|
36844
37012
|
};
|
|
36845
37013
|
const isInputDisabled = aaveSupply.isPending;
|
|
36846
|
-
const { amountInput: amountInput2, amountInputSwitch } = useAmountInputUI(
|
|
37014
|
+
const { amountInput: amountInput2, amountInputSwitch, switchSymbol } = useAmountInputUI(
|
|
36847
37015
|
amountInputResult,
|
|
36848
37016
|
{
|
|
36849
37017
|
checkoutConfig,
|
|
@@ -36851,7 +37019,9 @@ function InputAmountLoaded({
|
|
|
36851
37019
|
fiatCurrency,
|
|
36852
37020
|
handleSubmit,
|
|
36853
37021
|
previousStep: modalState.previousStep,
|
|
36854
|
-
isInputDisabled
|
|
37022
|
+
isInputDisabled,
|
|
37023
|
+
isExactIn,
|
|
37024
|
+
sourceTokenSymbol: sourceHolding?.symbol
|
|
36855
37025
|
}
|
|
36856
37026
|
);
|
|
36857
37027
|
return /* @__PURE__ */ React214.createElement(
|
|
@@ -36888,6 +37058,7 @@ function InputAmountLoaded({
|
|
|
36888
37058
|
)),
|
|
36889
37059
|
amountInput: amountInput2,
|
|
36890
37060
|
amountInputSwitch,
|
|
37061
|
+
switcherTokenSymbol: switchSymbol,
|
|
36891
37062
|
amountOptions: (!!usdAvailableAmount || isFixedFiatQuickOptions) && /* @__PURE__ */ React214.createElement(
|
|
36892
37063
|
QuickOptions,
|
|
36893
37064
|
{
|
|
@@ -36920,7 +37091,8 @@ function InputAmountLoaded({
|
|
|
36920
37091
|
{
|
|
36921
37092
|
value: preferredApprovalMethod,
|
|
36922
37093
|
onChange: setPreferredApprovalMethod,
|
|
36923
|
-
testId: "approval-method-toggle"
|
|
37094
|
+
testId: "approval-method-toggle",
|
|
37095
|
+
disabled: aaveSupply.isPending
|
|
36924
37096
|
}
|
|
36925
37097
|
)
|
|
36926
37098
|
)),
|
|
@@ -36950,7 +37122,9 @@ function useAmountInputUI({
|
|
|
36950
37122
|
fiatCurrency,
|
|
36951
37123
|
handleSubmit,
|
|
36952
37124
|
previousStep,
|
|
36953
|
-
isInputDisabled
|
|
37125
|
+
isInputDisabled,
|
|
37126
|
+
isExactIn,
|
|
37127
|
+
sourceTokenSymbol
|
|
36954
37128
|
}) {
|
|
36955
37129
|
const [isLayoutAnimating, setIsLayoutAnimating] = React214.useState(
|
|
36956
37130
|
previousStep === "confirmation" /* CONFIRMATION */
|
|
@@ -36986,7 +37160,12 @@ function useAmountInputUI({
|
|
|
36986
37160
|
handleSubmit();
|
|
36987
37161
|
};
|
|
36988
37162
|
const displayAssetAmount = round2(assetAmount ?? 0, ASSET_DECIMALS);
|
|
36989
|
-
const {
|
|
37163
|
+
const { amount: switchAmount, symbol: switchSymbol } = computeSwitcherDisplayToken({
|
|
37164
|
+
checkoutConfig,
|
|
37165
|
+
displayAssetAmount,
|
|
37166
|
+
isExactIn,
|
|
37167
|
+
sourceTokenSymbol
|
|
37168
|
+
});
|
|
36990
37169
|
const isConvertedAmountShown = targetAssetTicker && (!isInputInFiat || meldEnabled && fiatCurrency === "USD" || !meldEnabled);
|
|
36991
37170
|
const affixElement = inputAffix.content && /* needs whitespace for padding*/
|
|
36992
37171
|
/* @__PURE__ */ React214.createElement(
|
|
@@ -37146,12 +37325,9 @@ function useAmountInputUI({
|
|
|
37146
37325
|
const innerSwitch = (() => {
|
|
37147
37326
|
let innerText = "";
|
|
37148
37327
|
if (finalizedToken) {
|
|
37149
|
-
innerText = `${formatCryptoAndStringify7(
|
|
37328
|
+
innerText = `${formatCryptoAndStringify7(switchAmount, switchSymbol)} \u2022 ${fiatDisplay}`;
|
|
37150
37329
|
} else if (isInputInFiat) {
|
|
37151
|
-
innerText = formatCryptoAndStringify7(
|
|
37152
|
-
finalizedTokenAmount,
|
|
37153
|
-
finalizedTokenSymbol
|
|
37154
|
-
);
|
|
37330
|
+
innerText = formatCryptoAndStringify7(switchAmount, switchSymbol);
|
|
37155
37331
|
} else {
|
|
37156
37332
|
innerText = fiatDisplay;
|
|
37157
37333
|
}
|
|
@@ -37195,14 +37371,15 @@ function useAmountInputUI({
|
|
|
37195
37371
|
layoutId: "asset",
|
|
37196
37372
|
...motionProps.switch
|
|
37197
37373
|
},
|
|
37198
|
-
formatCryptoAndStringify7(
|
|
37374
|
+
formatCryptoAndStringify7(switchAmount),
|
|
37199
37375
|
/* @__PURE__ */ React214.createElement(Backdrop, null)
|
|
37200
|
-
), isInputInFiat && /* @__PURE__ */ React214.createElement(motion13.div, { key: "symbol", ...motionProps.symbol }, "\xA0",
|
|
37376
|
+
), isInputInFiat && /* @__PURE__ */ React214.createElement(motion13.div, { key: "symbol", ...motionProps.symbol }, "\xA0", switchSymbol)))
|
|
37201
37377
|
)
|
|
37202
37378
|
);
|
|
37203
37379
|
return {
|
|
37204
37380
|
amountInput: amountInput2,
|
|
37205
|
-
amountInputSwitch
|
|
37381
|
+
amountInputSwitch,
|
|
37382
|
+
switchSymbol
|
|
37206
37383
|
};
|
|
37207
37384
|
}
|
|
37208
37385
|
function YouPayYouReceiveWrapper({
|
|
@@ -37270,6 +37447,13 @@ function InputAmountLoading({
|
|
|
37270
37447
|
const targetAssetAmount = checkoutConfig?.targetAssetAmount;
|
|
37271
37448
|
const targetAssetTicker = checkoutConfig?.targetAssetTicker;
|
|
37272
37449
|
const sourceAsset = checkoutItem?.selectedSourceAssetInfo;
|
|
37450
|
+
const isExactIn = useQuoteBuilder().isExactIn();
|
|
37451
|
+
const { amount: switchAmount, symbol: switchSymbol } = computeSwitcherDisplayToken({
|
|
37452
|
+
checkoutConfig,
|
|
37453
|
+
displayAssetAmount: targetAssetAmount ?? 0,
|
|
37454
|
+
isExactIn,
|
|
37455
|
+
sourceTokenSymbol: sourceAsset?.symbol
|
|
37456
|
+
});
|
|
37273
37457
|
const error = useMemo52(() => {
|
|
37274
37458
|
if (sourceHoldingError) {
|
|
37275
37459
|
return {
|
|
@@ -37314,6 +37498,7 @@ function InputAmountLoading({
|
|
|
37314
37498
|
width: "180"
|
|
37315
37499
|
}
|
|
37316
37500
|
),
|
|
37501
|
+
switcherTokenSymbol: switchSymbol,
|
|
37317
37502
|
amountInputSwitch: (
|
|
37318
37503
|
// Omit switching when there is no associated token
|
|
37319
37504
|
showAmountSwitch && /* @__PURE__ */ React215.createElement(
|
|
@@ -37332,10 +37517,7 @@ function InputAmountLoading({
|
|
|
37332
37517
|
paddingX: "6",
|
|
37333
37518
|
color: { base: "secondaryText" }
|
|
37334
37519
|
},
|
|
37335
|
-
targetAssetAmount !== void 0 ? /* @__PURE__ */ React215.createElement(Text, { color: "secondaryText", size: "14" }, formatCryptoAndStringify8(
|
|
37336
|
-
targetAssetAmount,
|
|
37337
|
-
targetAssetTicker
|
|
37338
|
-
)) : /* @__PURE__ */ React215.createElement(Box, { alignItems: "center", display: "flex", gap: "8" }, /* @__PURE__ */ React215.createElement(FunSkeletonBlock, { height: "14", width: "60" }), /* @__PURE__ */ React215.createElement(Text, { color: "secondaryText", size: "14" }, targetAssetTicker))
|
|
37520
|
+
!isExactIn && targetAssetAmount !== void 0 ? /* @__PURE__ */ React215.createElement(Text, { color: "secondaryText", size: "14" }, formatCryptoAndStringify8(switchAmount, switchSymbol)) : /* @__PURE__ */ React215.createElement(Box, { alignItems: "center", display: "flex", gap: "8" }, /* @__PURE__ */ React215.createElement(FunSkeletonBlock, { height: "14", width: "60" }), /* @__PURE__ */ React215.createElement(Text, { color: "secondaryText", size: "14" }, switchSymbol))
|
|
37339
37521
|
)
|
|
37340
37522
|
)
|
|
37341
37523
|
),
|
|
@@ -37688,14 +37870,14 @@ function CopyInputDisplayedAddress(props) {
|
|
|
37688
37870
|
import {
|
|
37689
37871
|
getLightningQuote
|
|
37690
37872
|
} from "@funkit/api-base";
|
|
37691
|
-
import { LIGHTNING_MAINNET_CHAIN_ID, bitcoinChain as
|
|
37873
|
+
import { LIGHTNING_MAINNET_CHAIN_ID, bitcoinChain as bitcoinChain6 } from "@funkit/chains";
|
|
37692
37874
|
import { keepPreviousData as keepPreviousData3, useQuery as useQuery27 } from "@tanstack/react-query";
|
|
37693
37875
|
import { useEffect as useEffect58, useRef as useRef29, useState as useState67 } from "react";
|
|
37694
37876
|
import { parseUnits as parseUnits3 } from "viem";
|
|
37695
37877
|
var QUOTE_REFRESH_LEAD_MS = 3e3;
|
|
37696
37878
|
var QUOTE_REFRESH_MIN_MS = 250;
|
|
37697
37879
|
var QUOTE_GC_MS = 1e4;
|
|
37698
|
-
var BTC_DECIMALS =
|
|
37880
|
+
var BTC_DECIMALS = bitcoinChain6.nativeCurrency.decimals;
|
|
37699
37881
|
var SATS_PER_BTC = 10n ** BigInt(BTC_DECIMALS);
|
|
37700
37882
|
function usdToSats(usd, btcPrice) {
|
|
37701
37883
|
if (usd && btcPrice) {
|
|
@@ -37748,7 +37930,7 @@ var useLightningQuote = ({
|
|
|
37748
37930
|
}
|
|
37749
37931
|
const btcPrice = await getAssetPriceInfoWithFallback({
|
|
37750
37932
|
apiKey,
|
|
37751
|
-
chainId:
|
|
37933
|
+
chainId: bitcoinChain6.id.toString(),
|
|
37752
37934
|
assetTokenAddress: NATIVE_TOKEN
|
|
37753
37935
|
});
|
|
37754
37936
|
const fromAmountSats = usdToSats(fiatAmount, btcPrice.unitPrice);
|
|
@@ -47429,7 +47611,7 @@ function FunkitCheckoutProvider({ children }) {
|
|
|
47429
47611
|
config: {
|
|
47430
47612
|
...config,
|
|
47431
47613
|
// Solana is case-sensitive for SPL token addresses, so we should not lowercase the target asset address here
|
|
47432
|
-
targetAsset: config.targetChain.toString() === SOLANA_MAINNET_CHAIN_ID2.toString() && !
|
|
47614
|
+
targetAsset: config.targetChain.toString() === SOLANA_MAINNET_CHAIN_ID2.toString() && !isTokenAddressEquivalent5({
|
|
47433
47615
|
firstTokenAddress: NATIVE_TOKEN,
|
|
47434
47616
|
secondTokenAddress: config.targetAsset
|
|
47435
47617
|
}) ? config.targetAsset : config.targetAsset.toLowerCase(),
|
|
@@ -48184,7 +48366,7 @@ async function validateCheckoutConfig(config, apiKey) {
|
|
|
48184
48366
|
};
|
|
48185
48367
|
}
|
|
48186
48368
|
var hasSufficientBalance = async (wagmiConfig, walletAddress, tokenAddress, tokenChainId, requiredAssetAmount) => {
|
|
48187
|
-
const finalTokenAddress =
|
|
48369
|
+
const finalTokenAddress = isTokenAddressEquivalent6({
|
|
48188
48370
|
firstTokenAddress: tokenAddress,
|
|
48189
48371
|
secondTokenAddress: FUNKIT_CONNECT_CHECKOUT_NATIVE_CURRENCY_ADDRESS4
|
|
48190
48372
|
}) ? void 0 : tokenAddress;
|
|
@@ -48298,11 +48480,11 @@ async function getTokenDecimals(wagmiConfig, chainId2, tokenAddress) {
|
|
|
48298
48480
|
if (isNativeTokenAddress(tokenAddress)) {
|
|
48299
48481
|
return FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO11[chainId2]?.nativeCurrency?.decimals || 18;
|
|
48300
48482
|
}
|
|
48301
|
-
if (chainId2 ===
|
|
48302
|
-
return
|
|
48483
|
+
if (chainId2 === solanaChain6.id.toString()) {
|
|
48484
|
+
return solanaChain6.nativeCurrency.decimals;
|
|
48303
48485
|
}
|
|
48304
|
-
if (chainId2 ===
|
|
48305
|
-
return
|
|
48486
|
+
if (chainId2 === tronChain5.id.toString()) {
|
|
48487
|
+
return tronChain5.nativeCurrency.decimals;
|
|
48306
48488
|
}
|
|
48307
48489
|
if (chainId2 === lightningChain4.id.toString()) {
|
|
48308
48490
|
return lightningChain4.nativeCurrency.decimals;
|
|
@@ -48412,6 +48594,18 @@ function computeDisplayDestinationToken(checkoutConfig, displayAssetAmount) {
|
|
|
48412
48594
|
finalizedTokenIcon
|
|
48413
48595
|
};
|
|
48414
48596
|
}
|
|
48597
|
+
function computeSwitcherDisplayToken({
|
|
48598
|
+
checkoutConfig,
|
|
48599
|
+
displayAssetAmount,
|
|
48600
|
+
isExactIn,
|
|
48601
|
+
sourceTokenSymbol
|
|
48602
|
+
}) {
|
|
48603
|
+
if (isExactIn) {
|
|
48604
|
+
return { amount: displayAssetAmount, symbol: sourceTokenSymbol ?? "" };
|
|
48605
|
+
}
|
|
48606
|
+
const { finalizedTokenAmount, finalizedTokenSymbol } = computeDisplayDestinationToken(checkoutConfig, displayAssetAmount);
|
|
48607
|
+
return { amount: finalizedTokenAmount, symbol: finalizedTokenSymbol };
|
|
48608
|
+
}
|
|
48415
48609
|
|
|
48416
48610
|
// src/domains/asset.ts
|
|
48417
48611
|
function getMinValueThreshold(config, minUsdRequired) {
|
|
@@ -48429,22 +48623,22 @@ function getMinValueThreshold(config, minUsdRequired) {
|
|
|
48429
48623
|
function isPreferredChain(chainId2, additionalChains = []) {
|
|
48430
48624
|
const chains = /* @__PURE__ */ new Set([
|
|
48431
48625
|
mainnet13.id,
|
|
48432
|
-
|
|
48626
|
+
polygon8.id,
|
|
48433
48627
|
base6.id,
|
|
48434
48628
|
arbitrum6.id,
|
|
48435
48629
|
optimism2.id,
|
|
48436
|
-
|
|
48630
|
+
solanaChain7.id,
|
|
48437
48631
|
...additionalChains
|
|
48438
48632
|
]);
|
|
48439
48633
|
return chains.has(chainId2);
|
|
48440
48634
|
}
|
|
48441
48635
|
function isNativeTokenAddress(address) {
|
|
48442
|
-
return
|
|
48636
|
+
return isTokenAddressEquivalent7({
|
|
48443
48637
|
firstTokenAddress: address,
|
|
48444
48638
|
secondTokenAddress: NATIVE_TOKEN
|
|
48445
48639
|
});
|
|
48446
48640
|
}
|
|
48447
|
-
var isPolygonEcosystemToken = (chainId2, tokenAddress) => chainId2 ===
|
|
48641
|
+
var isPolygonEcosystemToken = (chainId2, tokenAddress) => chainId2 === polygon8.id.toString() && tokenAddress === "0x0000000000000000000000000000000000001010";
|
|
48448
48642
|
var isAssetUsableToPayForCheckout = ({
|
|
48449
48643
|
config,
|
|
48450
48644
|
payerAddress,
|
|
@@ -48522,7 +48716,7 @@ function normalizeAssetSymbol(asset) {
|
|
|
48522
48716
|
if (isTokenEquivalent12({
|
|
48523
48717
|
firstTokenChainId: asset.chainId,
|
|
48524
48718
|
firstTokenAddress: asset.contractAddress,
|
|
48525
|
-
secondTokenChainId:
|
|
48719
|
+
secondTokenChainId: polygon9.id.toString(),
|
|
48526
48720
|
secondTokenAddress: POLYGON_USDCE_TOKEN
|
|
48527
48721
|
})) {
|
|
48528
48722
|
return { ...asset, symbol: "USDC.e" };
|