@funkit/connect 9.21.0 → 9.21.1-next.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 +26 -0
- package/dist/__generated__/default_configs.d.ts +901 -0
- package/dist/__generated__/default_feature_gates.d.ts +20 -0
- package/dist/chunk-6K4U3Z4Z.js +375 -0
- package/dist/chunk-NBECXHBY.js +249 -0
- package/dist/chunk-PFIXC5YK.js +249 -0
- package/dist/clients/chunk-25ICASD7.js +2371 -0
- package/dist/clients/{chunk-NCCAYPLO.js → chunk-4HCOSF4M.js} +1 -1
- package/dist/clients/chunk-7GWX2ZS4.js +69 -0
- package/dist/clients/{chunk-KSSSSWR6.js → chunk-7HNGV6JU.js} +1 -1
- package/dist/clients/chunk-EGMA6ATZ.js +2371 -0
- package/dist/clients/chunk-GGXTLJ7J.js +290 -0
- package/dist/clients/chunk-HRWCNZJA.js +230 -0
- package/dist/clients/chunk-JTGKAPID.js +2382 -0
- package/dist/clients/chunk-L7PABCF2.js +54 -0
- package/dist/clients/{chunk-OWXKWC7I.js → chunk-NCUPPJ2Z.js} +8 -8
- package/dist/clients/{chunk-ZMVXBMON.js → chunk-NUJ6ZM5F.js} +1 -1
- package/dist/clients/chunk-OJLDTEKB.js +54 -0
- package/dist/clients/chunk-SSSQQ32F.js +186 -0
- package/dist/clients/chunk-UVWNEQMD.js +186 -0
- package/dist/clients/chunk-YLZ7COFH.js +230 -0
- package/dist/clients/chunk-ZEFHAWRH.js +69 -0
- 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/clients/polymarket.d.ts +161 -0
- package/dist/clients/polymarket.js +688 -0
- package/dist/hooks/useTokenTransferConfig.d.ts +7 -0
- package/dist/index.css +11 -11
- package/dist/index.js +52 -200
- package/dist/interfaces/logTransport.d.ts +51 -0
- package/dist/interfaces/swapped-transport.d.ts +78 -0
- package/dist/modals/CheckoutModal/SourceChange/EmptyFormOfPaymentsMessage.d.ts +4 -0
- package/dist/modals/CheckoutModal/SourceChange/useUpdateSourceAssetForCard.d.ts +4 -0
- package/dist/modals/CheckoutModal/SwappedIframe/SwappedErrorMessage.d.ts +6 -0
- package/dist/utils/flags/resolver.d.ts +34 -0
- package/dist/utils/tokenTransfer/disabledList.d.ts +1 -14
- package/dist/utils/tokenTransfer/types.d.ts +5 -30
- package/dist/wallets/walletConnectors/chunk-2VP2F6EK.js +70 -0
- package/dist/wallets/walletConnectors/chunk-4T6ZSRJF.js +69 -0
- package/dist/wallets/walletConnectors/chunk-6BW3HLBG.js +96 -0
- package/dist/wallets/walletConnectors/chunk-CCQV2ZET.js +218 -0
- package/dist/wallets/walletConnectors/chunk-CPI4TD43.js +99 -0
- package/dist/wallets/walletConnectors/chunk-F5XEEVG6.js +98 -0
- package/dist/wallets/walletConnectors/chunk-HNRB7KJU.js +92 -0
- package/dist/wallets/walletConnectors/chunk-HTHAK6XB.js +93 -0
- package/dist/wallets/walletConnectors/chunk-MIQTHJ6X.js +66 -0
- package/dist/wallets/walletConnectors/chunk-RB3HR4R2.js +95 -0
- package/dist/wallets/walletConnectors/chunk-RVOY537T.js +100 -0
- package/dist/wallets/walletConnectors/chunk-STVVP43G.js +94 -0
- package/dist/wallets/walletConnectors/chunk-UK7C2JXW.js +87 -0
- package/dist/wallets/walletConnectors/chunk-VAPGUPHO.js +92 -0
- package/dist/wallets/walletConnectors/chunk-VTM6EECM.js +110 -0
- package/dist/wallets/walletConnectors/chunk-X6CGV36L.js +103 -0
- package/dist/wallets/walletConnectors/chunk-YEZM4CK4.js +96 -0
- package/dist/wallets/walletConnectors/chunk-ZNX4EMPB.js +106 -0
- package/dist/wallets/walletConnectors/index.js +53 -53
- package/package.json +2 -2
- /package/dist/clients/{chunk-52NKHZS2.js → chunk-JD3FIVZ7.js} +0 -0
package/dist/index.js
CHANGED
|
@@ -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 polygon8 } 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 solanaChain6
|
|
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 isTokenAddressEquivalent6, isTokenEquivalent as isTokenEquivalent11 } from "@funkit/utils";
|
|
979
|
+
import { arbitrum as arbitrum6, base as base6, mainnet as mainnet13, optimism as optimism2, polygon as polygon7 } 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 solanaChain5,
|
|
990
|
+
tronChain as tronChain4
|
|
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 isTokenAddressEquivalent5,
|
|
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 isTokenAddressEquivalent4 } 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.21.0";
|
|
1645
|
+
return "9.21.1-next.0";
|
|
1646
1646
|
}
|
|
1647
1647
|
function useFingerprint() {
|
|
1648
1648
|
const fingerprint = useCallback3(() => {
|
|
@@ -19991,8 +19991,10 @@ function isLive(option) {
|
|
|
19991
19991
|
}
|
|
19992
19992
|
|
|
19993
19993
|
// src/hooks/useTokenTransferConfig.ts
|
|
19994
|
+
import {
|
|
19995
|
+
resolveTokenTransferConfig
|
|
19996
|
+
} from "@funkit/connect-core";
|
|
19994
19997
|
import { useMemo as useMemo27 } from "react";
|
|
19995
|
-
import { polygon as polygon6 } from "viem/chains";
|
|
19996
19998
|
|
|
19997
19999
|
// src/hooks/useSupportedAssets.ts
|
|
19998
20000
|
import {
|
|
@@ -20013,150 +20015,8 @@ function useSupportedAssets(options) {
|
|
|
20013
20015
|
});
|
|
20014
20016
|
}
|
|
20015
20017
|
|
|
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
|
-
|
|
20047
20018
|
// src/hooks/useTokenTransferConfig.ts
|
|
20048
|
-
var
|
|
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 = {
|
|
20019
|
+
var EMPTY_RESULT = {
|
|
20160
20020
|
supportedAssets: {},
|
|
20161
20021
|
symbolsByChainId: {},
|
|
20162
20022
|
chainIdSortOrder: [],
|
|
@@ -20178,15 +20038,15 @@ function useTokenTransferConfig(isWithdrawal = false) {
|
|
|
20178
20038
|
const { data: allSupportedAssets, isLoading } = useSupportedAssets();
|
|
20179
20039
|
const config = useMemo27(() => {
|
|
20180
20040
|
if (!allSupportedAssets) {
|
|
20181
|
-
return
|
|
20041
|
+
return EMPTY_RESULT;
|
|
20182
20042
|
}
|
|
20183
|
-
|
|
20184
|
-
|
|
20185
|
-
|
|
20186
|
-
rawPriorityTokens ?? [],
|
|
20043
|
+
return resolveTokenTransferConfig({
|
|
20044
|
+
chainConfigs: rawConfig.chains ?? [],
|
|
20045
|
+
priorityTokens: rawConfig.priorityTokens ?? [],
|
|
20187
20046
|
disabledChainAssets,
|
|
20188
|
-
allSupportedAssets
|
|
20189
|
-
|
|
20047
|
+
supportedAssets: allSupportedAssets,
|
|
20048
|
+
logger
|
|
20049
|
+
});
|
|
20190
20050
|
}, [rawConfig, disabledChainAssets, allSupportedAssets]);
|
|
20191
20051
|
return { ...config, isLoading };
|
|
20192
20052
|
}
|
|
@@ -24648,7 +24508,7 @@ import { isTokenEquivalent as isTokenEquivalent3 } from "@funkit/utils";
|
|
|
24648
24508
|
import { useQuery as useQuery16 } from "@tanstack/react-query";
|
|
24649
24509
|
|
|
24650
24510
|
// src/hooks/useIsBlacklistedWithdrawalAddress.ts
|
|
24651
|
-
import { isTokenAddressEquivalent
|
|
24511
|
+
import { isTokenAddressEquivalent } from "@funkit/utils";
|
|
24652
24512
|
import { useMemo as useMemo36 } from "react";
|
|
24653
24513
|
function useIsBlacklistedWithdrawalAddress(address) {
|
|
24654
24514
|
const addressBlacklist = useDynamicConfig("blacklistedwithdrawaladdress");
|
|
@@ -24665,7 +24525,7 @@ function useIsBlacklistedWithdrawalAddress(address) {
|
|
|
24665
24525
|
return addresses;
|
|
24666
24526
|
}, [withdrawalConfig.chains]);
|
|
24667
24527
|
return Object.keys(addressBlacklist).concat(withdrawalTokenAddresses).some(
|
|
24668
|
-
(blockedAddress) =>
|
|
24528
|
+
(blockedAddress) => isTokenAddressEquivalent({
|
|
24669
24529
|
firstTokenAddress: blockedAddress,
|
|
24670
24530
|
secondTokenAddress: address
|
|
24671
24531
|
})
|
|
@@ -24949,30 +24809,22 @@ var useAssetSymbolPrice = ({
|
|
|
24949
24809
|
|
|
24950
24810
|
// src/hooks/useTokenAndChainDropdown.ts
|
|
24951
24811
|
import { useEffect as useEffect39, useState as useState34 } from "react";
|
|
24952
|
-
import { polygon as
|
|
24812
|
+
import { polygon as polygon6 } from "viem/chains";
|
|
24953
24813
|
|
|
24954
24814
|
// src/hooks/useEnabledTokenTransferChainTokens.ts
|
|
24955
|
-
import {
|
|
24815
|
+
import { isTransferChainEnabled } from "@funkit/connect-core";
|
|
24956
24816
|
function useEnabledTokenTransferChainTokens(transferInit, isWithdrawal) {
|
|
24957
24817
|
const { symbolsByChainId } = useTokenTransferConfig(isWithdrawal);
|
|
24958
|
-
const hasSolanaAddress = !!transferInit?.solanaAddr;
|
|
24959
|
-
const hasBitcoinAddress = !!transferInit?.btcAddrSegwit;
|
|
24960
|
-
const hasTronAddress = !!transferInit?.tronAddr;
|
|
24961
24818
|
return Object.keys(
|
|
24962
24819
|
symbolsByChainId
|
|
24963
24820
|
).reduce(
|
|
24964
24821
|
(acc, curChainIdString) => {
|
|
24965
24822
|
const chainId2 = Number(curChainIdString);
|
|
24966
|
-
|
|
24967
|
-
|
|
24968
|
-
|
|
24969
|
-
|
|
24970
|
-
|
|
24971
|
-
if (isBitcoin && !hasBitcoinAddress && !isWithdrawal) {
|
|
24972
|
-
return acc;
|
|
24973
|
-
}
|
|
24974
|
-
const isTron = chainId2 === tronChain3.id;
|
|
24975
|
-
if (isTron && !hasTronAddress && !isWithdrawal) {
|
|
24823
|
+
if (!isTransferChainEnabled(
|
|
24824
|
+
chainId2,
|
|
24825
|
+
transferInit ?? void 0,
|
|
24826
|
+
isWithdrawal
|
|
24827
|
+
)) {
|
|
24976
24828
|
return acc;
|
|
24977
24829
|
}
|
|
24978
24830
|
if (symbolsByChainId[chainId2]?.length) {
|
|
@@ -24990,7 +24842,7 @@ function resolveDefaultChainId(enabledChainSymbols, preferredChainId) {
|
|
|
24990
24842
|
return preferredChainId;
|
|
24991
24843
|
}
|
|
24992
24844
|
const firstAvailable = Number(Object.keys(enabledChainSymbols)[0]);
|
|
24993
|
-
return firstAvailable ||
|
|
24845
|
+
return firstAvailable || polygon6.id;
|
|
24994
24846
|
}
|
|
24995
24847
|
function resolveDefaultToken(currentChainSymbols, preferredToken) {
|
|
24996
24848
|
if (preferredToken && currentChainSymbols?.includes(preferredToken)) {
|
|
@@ -25017,7 +24869,7 @@ var useTokenAndChainDropdown = ({
|
|
|
25017
24869
|
const tokenTransferConfig = useTokenTransferConfig(isWithdrawal);
|
|
25018
24870
|
const isLoadingAssets = tokenTransferConfig.isLoading || Object.keys(tokenTransferConfig.symbolsByChainId).length === 0;
|
|
25019
24871
|
const popularTokenSymbols = tokenTransferConfig.popularTokenSymbols ?? [];
|
|
25020
|
-
const preferredChainId = defaultValues?.chainId ?? tokenTransferConfig.defaultChainId ??
|
|
24872
|
+
const preferredChainId = defaultValues?.chainId ?? tokenTransferConfig.defaultChainId ?? polygon6.id;
|
|
25021
24873
|
const validDefaultChainId = resolveDefaultChainId(
|
|
25022
24874
|
enabledChainSymbols,
|
|
25023
24875
|
preferredChainId
|
|
@@ -25260,8 +25112,8 @@ function getErrorNotification({
|
|
|
25260
25112
|
import React128, { useEffect as useEffect40, useState as useState35 } from "react";
|
|
25261
25113
|
import {
|
|
25262
25114
|
FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO8,
|
|
25263
|
-
solanaChain as
|
|
25264
|
-
tronChain as
|
|
25115
|
+
solanaChain as solanaChain4,
|
|
25116
|
+
tronChain as tronChain3
|
|
25265
25117
|
} from "@funkit/chains";
|
|
25266
25118
|
function getAlertMessage(selectedChainId, selectedToken, t) {
|
|
25267
25119
|
const chainName = FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO8[selectedChainId]?.name;
|
|
@@ -25289,7 +25141,7 @@ function useShowConnectWallet({ config }) {
|
|
|
25289
25141
|
return showUseConnected;
|
|
25290
25142
|
}
|
|
25291
25143
|
function getRecipientAddressPlaceholder(selectedChainId, t) {
|
|
25292
|
-
if (selectedChainId ===
|
|
25144
|
+
if (selectedChainId === solanaChain4.id || selectedChainId === tronChain3.id) {
|
|
25293
25145
|
return t("withdrawal.enterRecipientAddress")[0] + t("withdrawal.enterRecipientAddress").slice(1).toLowerCase();
|
|
25294
25146
|
}
|
|
25295
25147
|
return "0x...";
|
|
@@ -31653,7 +31505,7 @@ var ChainInfoBanners = ({ chainId: chainId2 }) => {
|
|
|
31653
31505
|
// src/components/FunTransactionSummary/PaymentAmountSummary.tsx
|
|
31654
31506
|
import {
|
|
31655
31507
|
formatCurrencyAndStringify as formatCurrencyAndStringify7,
|
|
31656
|
-
isTokenAddressEquivalent as
|
|
31508
|
+
isTokenAddressEquivalent as isTokenAddressEquivalent2,
|
|
31657
31509
|
isTokenEquivalent as isTokenEquivalent4
|
|
31658
31510
|
} from "@funkit/utils";
|
|
31659
31511
|
import NumberFlow from "@number-flow/react";
|
|
@@ -31709,7 +31561,7 @@ function PaymentAmountSummary({
|
|
|
31709
31561
|
const sourceChainId = sourceAssetInfo?.chainId;
|
|
31710
31562
|
const areSameChains = sourceChainId === targetChainId;
|
|
31711
31563
|
const sourceIcon = sourceAssetInfo?.iconSrc ?? void 0;
|
|
31712
|
-
const isSameTokenAddress =
|
|
31564
|
+
const isSameTokenAddress = isTokenAddressEquivalent2({
|
|
31713
31565
|
firstTokenAddress: sourceTokenAddress,
|
|
31714
31566
|
secondTokenAddress: targetTokenAddress
|
|
31715
31567
|
});
|
|
@@ -35422,7 +35274,7 @@ function useTextMeasurer(inputRef) {
|
|
|
35422
35274
|
|
|
35423
35275
|
// src/modals/CheckoutModal/InputAmount/state.ts
|
|
35424
35276
|
import {
|
|
35425
|
-
isTokenAddressEquivalent as
|
|
35277
|
+
isTokenAddressEquivalent as isTokenAddressEquivalent3,
|
|
35426
35278
|
isTokenEquivalent as isTokenEquivalent6,
|
|
35427
35279
|
round
|
|
35428
35280
|
} from "@funkit/utils";
|
|
@@ -35607,7 +35459,7 @@ function isEffectivelySameAsset(checkoutConfig, sourceToken, apiKey) {
|
|
|
35607
35459
|
return true;
|
|
35608
35460
|
}
|
|
35609
35461
|
const mainnetChainId = mainnet11.id.toString();
|
|
35610
|
-
return isLighterxyzCustomer(apiKey) && sourceToken.chainId === mainnetChainId && isNativeTokenAddress(sourceToken.address) && checkoutConfig.targetChain === mainnetChainId &&
|
|
35462
|
+
return isLighterxyzCustomer(apiKey) && sourceToken.chainId === mainnetChainId && isNativeTokenAddress(sourceToken.address) && checkoutConfig.targetChain === mainnetChainId && isTokenAddressEquivalent3({
|
|
35611
35463
|
firstTokenAddress: checkoutConfig.targetAsset,
|
|
35612
35464
|
secondTokenAddress: WETH_MAINNET_ADDRESS
|
|
35613
35465
|
});
|
|
@@ -37836,14 +37688,14 @@ function CopyInputDisplayedAddress(props) {
|
|
|
37836
37688
|
import {
|
|
37837
37689
|
getLightningQuote
|
|
37838
37690
|
} from "@funkit/api-base";
|
|
37839
|
-
import { LIGHTNING_MAINNET_CHAIN_ID, bitcoinChain as
|
|
37691
|
+
import { LIGHTNING_MAINNET_CHAIN_ID, bitcoinChain as bitcoinChain5 } from "@funkit/chains";
|
|
37840
37692
|
import { keepPreviousData as keepPreviousData3, useQuery as useQuery27 } from "@tanstack/react-query";
|
|
37841
37693
|
import { useEffect as useEffect58, useRef as useRef29, useState as useState67 } from "react";
|
|
37842
37694
|
import { parseUnits as parseUnits3 } from "viem";
|
|
37843
37695
|
var QUOTE_REFRESH_LEAD_MS = 3e3;
|
|
37844
37696
|
var QUOTE_REFRESH_MIN_MS = 250;
|
|
37845
37697
|
var QUOTE_GC_MS = 1e4;
|
|
37846
|
-
var BTC_DECIMALS =
|
|
37698
|
+
var BTC_DECIMALS = bitcoinChain5.nativeCurrency.decimals;
|
|
37847
37699
|
var SATS_PER_BTC = 10n ** BigInt(BTC_DECIMALS);
|
|
37848
37700
|
function usdToSats(usd, btcPrice) {
|
|
37849
37701
|
if (usd && btcPrice) {
|
|
@@ -37896,7 +37748,7 @@ var useLightningQuote = ({
|
|
|
37896
37748
|
}
|
|
37897
37749
|
const btcPrice = await getAssetPriceInfoWithFallback({
|
|
37898
37750
|
apiKey,
|
|
37899
|
-
chainId:
|
|
37751
|
+
chainId: bitcoinChain5.id.toString(),
|
|
37900
37752
|
assetTokenAddress: NATIVE_TOKEN
|
|
37901
37753
|
});
|
|
37902
37754
|
const fromAmountSats = usdToSats(fiatAmount, btcPrice.unitPrice);
|
|
@@ -47577,7 +47429,7 @@ function FunkitCheckoutProvider({ children }) {
|
|
|
47577
47429
|
config: {
|
|
47578
47430
|
...config,
|
|
47579
47431
|
// Solana is case-sensitive for SPL token addresses, so we should not lowercase the target asset address here
|
|
47580
|
-
targetAsset: config.targetChain.toString() === SOLANA_MAINNET_CHAIN_ID2.toString() && !
|
|
47432
|
+
targetAsset: config.targetChain.toString() === SOLANA_MAINNET_CHAIN_ID2.toString() && !isTokenAddressEquivalent4({
|
|
47581
47433
|
firstTokenAddress: NATIVE_TOKEN,
|
|
47582
47434
|
secondTokenAddress: config.targetAsset
|
|
47583
47435
|
}) ? config.targetAsset : config.targetAsset.toLowerCase(),
|
|
@@ -48332,7 +48184,7 @@ async function validateCheckoutConfig(config, apiKey) {
|
|
|
48332
48184
|
};
|
|
48333
48185
|
}
|
|
48334
48186
|
var hasSufficientBalance = async (wagmiConfig, walletAddress, tokenAddress, tokenChainId, requiredAssetAmount) => {
|
|
48335
|
-
const finalTokenAddress =
|
|
48187
|
+
const finalTokenAddress = isTokenAddressEquivalent5({
|
|
48336
48188
|
firstTokenAddress: tokenAddress,
|
|
48337
48189
|
secondTokenAddress: FUNKIT_CONNECT_CHECKOUT_NATIVE_CURRENCY_ADDRESS4
|
|
48338
48190
|
}) ? void 0 : tokenAddress;
|
|
@@ -48446,11 +48298,11 @@ async function getTokenDecimals(wagmiConfig, chainId2, tokenAddress) {
|
|
|
48446
48298
|
if (isNativeTokenAddress(tokenAddress)) {
|
|
48447
48299
|
return FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO11[chainId2]?.nativeCurrency?.decimals || 18;
|
|
48448
48300
|
}
|
|
48449
|
-
if (chainId2 ===
|
|
48450
|
-
return
|
|
48301
|
+
if (chainId2 === solanaChain5.id.toString()) {
|
|
48302
|
+
return solanaChain5.nativeCurrency.decimals;
|
|
48451
48303
|
}
|
|
48452
|
-
if (chainId2 ===
|
|
48453
|
-
return
|
|
48304
|
+
if (chainId2 === tronChain4.id.toString()) {
|
|
48305
|
+
return tronChain4.nativeCurrency.decimals;
|
|
48454
48306
|
}
|
|
48455
48307
|
if (chainId2 === lightningChain4.id.toString()) {
|
|
48456
48308
|
return lightningChain4.nativeCurrency.decimals;
|
|
@@ -48577,22 +48429,22 @@ function getMinValueThreshold(config, minUsdRequired) {
|
|
|
48577
48429
|
function isPreferredChain(chainId2, additionalChains = []) {
|
|
48578
48430
|
const chains = /* @__PURE__ */ new Set([
|
|
48579
48431
|
mainnet13.id,
|
|
48580
|
-
|
|
48432
|
+
polygon7.id,
|
|
48581
48433
|
base6.id,
|
|
48582
48434
|
arbitrum6.id,
|
|
48583
48435
|
optimism2.id,
|
|
48584
|
-
|
|
48436
|
+
solanaChain6.id,
|
|
48585
48437
|
...additionalChains
|
|
48586
48438
|
]);
|
|
48587
48439
|
return chains.has(chainId2);
|
|
48588
48440
|
}
|
|
48589
48441
|
function isNativeTokenAddress(address) {
|
|
48590
|
-
return
|
|
48442
|
+
return isTokenAddressEquivalent6({
|
|
48591
48443
|
firstTokenAddress: address,
|
|
48592
48444
|
secondTokenAddress: NATIVE_TOKEN
|
|
48593
48445
|
});
|
|
48594
48446
|
}
|
|
48595
|
-
var isPolygonEcosystemToken = (chainId2, tokenAddress) => chainId2 ===
|
|
48447
|
+
var isPolygonEcosystemToken = (chainId2, tokenAddress) => chainId2 === polygon7.id.toString() && tokenAddress === "0x0000000000000000000000000000000000001010";
|
|
48596
48448
|
var isAssetUsableToPayForCheckout = ({
|
|
48597
48449
|
config,
|
|
48598
48450
|
payerAddress,
|
|
@@ -48670,7 +48522,7 @@ function normalizeAssetSymbol(asset) {
|
|
|
48670
48522
|
if (isTokenEquivalent12({
|
|
48671
48523
|
firstTokenChainId: asset.chainId,
|
|
48672
48524
|
firstTokenAddress: asset.contractAddress,
|
|
48673
|
-
secondTokenChainId:
|
|
48525
|
+
secondTokenChainId: polygon8.id.toString(),
|
|
48674
48526
|
secondTokenAddress: POLYGON_USDCE_TOKEN
|
|
48675
48527
|
})) {
|
|
48676
48528
|
return { ...asset, symbol: "USDC.e" };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/** Severity levels emitted by `FunLogger`. */
|
|
2
|
+
export type LogLevel = 'info' | 'debug' | 'warn' | 'error';
|
|
3
|
+
/** User tracking consent, mirroring the Datadog browser SDK's values. */
|
|
4
|
+
export type TrackingConsent = 'granted' | 'not-granted';
|
|
5
|
+
/**
|
|
6
|
+
* The structured context `FunLogger` assembles for every record: the caller's
|
|
7
|
+
* data plus the logger's resolved user/session fields. Concrete (rather than
|
|
8
|
+
* `object`) so transport implementors get property access and autocomplete.
|
|
9
|
+
*/
|
|
10
|
+
export interface LogContext {
|
|
11
|
+
/** Caller-supplied structured data for this log line, if any. */
|
|
12
|
+
data?: object;
|
|
13
|
+
apiKey: string | null;
|
|
14
|
+
userId: string | null;
|
|
15
|
+
userName: string | null;
|
|
16
|
+
userAddress: string | null;
|
|
17
|
+
userLoginType: string | null;
|
|
18
|
+
typeLabel: string | null;
|
|
19
|
+
sdkVersion: string | null;
|
|
20
|
+
}
|
|
21
|
+
/** A single fully-assembled log record handed to a transport. */
|
|
22
|
+
export interface LogRecord {
|
|
23
|
+
level: LogLevel;
|
|
24
|
+
title: string;
|
|
25
|
+
/** Assembled by `FunLogger` so transports stay dumb sinks. */
|
|
26
|
+
context: LogContext;
|
|
27
|
+
/** Present only for `error`-level records. */
|
|
28
|
+
error?: Error;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Platform sink for `FunLogger`. The logger (queueing, env detection, level
|
|
32
|
+
* routing, console fallback, context tracking) is platform-agnostic; everything
|
|
33
|
+
* platform-specific about *emitting* lives behind this interface.
|
|
34
|
+
*
|
|
35
|
+
* Part of the React Native split (see docs/connect-rn-architecture.md): web
|
|
36
|
+
* implements it with `DatadogBrowserLogsTransport`, React Native will implement
|
|
37
|
+
* it with a Datadog React Native transport (`@datadog/mobile-react-native`).
|
|
38
|
+
* Kept free of DOM/`@datadog/browser-logs` types so it can move to
|
|
39
|
+
* `@funkit/connect-core` untouched.
|
|
40
|
+
*/
|
|
41
|
+
export interface LogTransport {
|
|
42
|
+
/** Emit one record to the platform sink. */
|
|
43
|
+
log(record: LogRecord): void;
|
|
44
|
+
/**
|
|
45
|
+
* Reflect the resolved environment (e.g. `'development'` | `'production'`).
|
|
46
|
+
* Optional — sinks that don't segment by environment can omit it.
|
|
47
|
+
*/
|
|
48
|
+
setEnv?(environment: string): void;
|
|
49
|
+
/** Reflect user tracking consent. Optional. */
|
|
50
|
+
setTrackingConsent?(consent: TrackingConsent): void;
|
|
51
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import type { PaymentGroupType } from '@funkit/api-base';
|
|
2
|
+
import type { SwappedTheme } from '../utils/swapped';
|
|
3
|
+
/**
|
|
4
|
+
* Typed contract for the message bridge between the SDK and the embedded
|
|
5
|
+
* Swapped flow. On web this is bridged over an `<iframe>` + `window.postMessage`
|
|
6
|
+
* (see {@link createIframeSwappedTransport}); React Native will bridge the same
|
|
7
|
+
* messages over a `WebView`. Freezing the event catalog here lets both
|
|
8
|
+
* platforms share the `SwappedProvider` state machine and turns any drift in
|
|
9
|
+
* the message shapes into a compile-time error.
|
|
10
|
+
*
|
|
11
|
+
* Reference: the inbound switch in `SwappedIframeController` and the sends in
|
|
12
|
+
* `SwappedProvider`.
|
|
13
|
+
*
|
|
14
|
+
* This module is platform-agnostic and is slated to move to
|
|
15
|
+
* `@funkit/connect-core/interfaces/` during the RN extraction.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* Navigation steps reported by the Swapped embed. Open-ended — the embed may
|
|
19
|
+
* emit steps we don't enumerate, which fall through to the default handler.
|
|
20
|
+
*/
|
|
21
|
+
export type SwappedStep = 'EMPTY' | 'KYC_ADDRESS' | 'KYC_AWAITING_IDENTITY' | 'KYC_IDENTITY' | 'KYC_PERSONAL' | 'KYC_SUMSUB' | 'LOGIN_EMAIL' | 'LOGIN_EMAIL_VERIFICATION' | 'PAYMENT' | 'ORDER_CONFIRMATION' | (string & {});
|
|
22
|
+
/**
|
|
23
|
+
* Opaque payloads — the SDK never introspects these, it only forwards them to
|
|
24
|
+
* analytics via `JSON.stringify`. Typed as `unknown` so callers must stringify
|
|
25
|
+
* rather than read fields.
|
|
26
|
+
*/
|
|
27
|
+
export type SwappedErrorPayload = unknown;
|
|
28
|
+
export type SwappedTxPayload = unknown;
|
|
29
|
+
/** embed → parent */
|
|
30
|
+
export type SwappedInboundMessage = {
|
|
31
|
+
type: 'SWAPPED_READY';
|
|
32
|
+
} | {
|
|
33
|
+
type: 'SWAPPED_GO_BACK';
|
|
34
|
+
} | {
|
|
35
|
+
type: 'SWAPPED_CLOSE';
|
|
36
|
+
} | {
|
|
37
|
+
type: 'SWAPPED_NEW_DEPOSIT';
|
|
38
|
+
} | {
|
|
39
|
+
type: 'SWAPPED_ERROR';
|
|
40
|
+
data?: SwappedErrorPayload;
|
|
41
|
+
} | {
|
|
42
|
+
type: 'SWAPPED_NAVIGATION';
|
|
43
|
+
data?: {
|
|
44
|
+
step?: SwappedStep;
|
|
45
|
+
};
|
|
46
|
+
} | {
|
|
47
|
+
type: 'SWAPPED_ORDER_DATA';
|
|
48
|
+
data?: unknown;
|
|
49
|
+
} | {
|
|
50
|
+
type: 'SWAPPED_TRANSACTION_SUCCESSFUL';
|
|
51
|
+
data?: SwappedTxPayload;
|
|
52
|
+
} | {
|
|
53
|
+
type: 'SWAPPED_LOGOUT';
|
|
54
|
+
};
|
|
55
|
+
/** parent → embed */
|
|
56
|
+
export type SwappedOutboundMessage = {
|
|
57
|
+
type: 'SWAPPED_METHOD';
|
|
58
|
+
method: PaymentGroupType;
|
|
59
|
+
} | {
|
|
60
|
+
type: 'SWAPPED_THEME';
|
|
61
|
+
data: SwappedTheme;
|
|
62
|
+
} | {
|
|
63
|
+
type: 'SWAPPED_FOCUS';
|
|
64
|
+
};
|
|
65
|
+
export interface SwappedTransport {
|
|
66
|
+
/**
|
|
67
|
+
* Send a message to the embed. Returns `true` if the message was dispatched,
|
|
68
|
+
* `false` if the embed isn't reachable yet (so callers can mirror today's
|
|
69
|
+
* behavior of logging only on a successful send).
|
|
70
|
+
*/
|
|
71
|
+
send(msg: SwappedOutboundMessage): boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Subscribe to messages from the embed. The handler is only invoked for
|
|
74
|
+
* messages whose origin has already been validated by the transport. Returns
|
|
75
|
+
* an unsubscribe function.
|
|
76
|
+
*/
|
|
77
|
+
onMessage(handler: (msg: SwappedInboundMessage) => void): () => void;
|
|
78
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
type BaseCondition = {
|
|
2
|
+
type: 'country';
|
|
3
|
+
countryCodes: string[];
|
|
4
|
+
};
|
|
5
|
+
type Condition = BaseCondition | {
|
|
6
|
+
type: 'all';
|
|
7
|
+
conditions: Condition[];
|
|
8
|
+
} | {
|
|
9
|
+
type: 'any';
|
|
10
|
+
conditions: Condition[];
|
|
11
|
+
};
|
|
12
|
+
interface Variant<T> {
|
|
13
|
+
condition?: Condition;
|
|
14
|
+
value: T;
|
|
15
|
+
}
|
|
16
|
+
interface VariantConfig<T> {
|
|
17
|
+
variants: Variant<T>[];
|
|
18
|
+
value: T;
|
|
19
|
+
}
|
|
20
|
+
interface EvaluationContext {
|
|
21
|
+
countryCode?: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Type guard to check if a value is a VariantConfig
|
|
25
|
+
* (used to distinguish from simple static configs)
|
|
26
|
+
*/
|
|
27
|
+
export declare function isVariantConfig<T>(value: unknown): value is VariantConfig<T>;
|
|
28
|
+
/**
|
|
29
|
+
* Resolves the appropriate value from a VariantConfig based on runtime context.
|
|
30
|
+
* Evaluates variants in order and returns the first matching variant's value.
|
|
31
|
+
* Falls back to default value if no variants match.
|
|
32
|
+
*/
|
|
33
|
+
export declare function resolveValue<T>(config: VariantConfig<T>, ctx: EvaluationContext): T;
|
|
34
|
+
export {};
|
|
@@ -1,14 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Keys are chainId strings. Values are arrays of token addresses,
|
|
3
|
-
* or ["*"] to disable the entire chain.
|
|
4
|
-
*/
|
|
5
|
-
export type DisabledChainsAndAssets = Record<string, string[]>;
|
|
6
|
-
/** Returns true if an entire chain is disabled (has ["*"]). */
|
|
7
|
-
export declare function isChainDisabled(disabledConfig: DisabledChainsAndAssets, chainId: number | string): boolean;
|
|
8
|
-
/**
|
|
9
|
-
* Returns true if a specific chain + asset combination is disabled.
|
|
10
|
-
* - If the chain has ["*"], the entire chain (and all its assets) is disabled.
|
|
11
|
-
* - If the chain has specific addresses, only those tokens are disabled.
|
|
12
|
-
* - Address comparison is case-insensitive.
|
|
13
|
-
*/
|
|
14
|
-
export declare function isAssetDisabled(disabledConfig: DisabledChainsAndAssets, chainId: number | string, tokenAddress: string): boolean;
|
|
1
|
+
export { type DisabledChainsAndAssets, isAssetDisabled, isChainDisabled, } from '@funkit/connect-core';
|