@funkit/connect 6.9.0 → 6.10.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 +18 -0
- package/dist/hooks/useTokenTransfer.d.ts +3 -0
- package/dist/index.js +217 -93
- package/dist/utils/flags/config.d.ts +279 -265
- package/dist/utils/flags/impl.d.ts +282 -1
- package/dist/utils/flags/patches/enable-bitcoin-patch.d.ts +2 -0
- package/dist/utils/funLogger.d.ts +7 -1
- package/dist/utils/transfer.d.ts +9 -0
- package/dist/wallets/walletConnectors/index.js +40 -40
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
darkTheme
|
|
4
|
-
} from "./chunk-UOY5XFCR.js";
|
|
5
2
|
import {
|
|
6
3
|
lightTheme
|
|
7
4
|
} from "./chunk-AYGZMDTC.js";
|
|
5
|
+
import {
|
|
6
|
+
darkTheme
|
|
7
|
+
} from "./chunk-UOY5XFCR.js";
|
|
8
8
|
import {
|
|
9
9
|
systemFontStack
|
|
10
10
|
} from "./chunk-7HKC2KCK.js";
|
|
@@ -662,6 +662,15 @@ var FunLogger = class {
|
|
|
662
662
|
console.error(title, data || "", error);
|
|
663
663
|
}
|
|
664
664
|
}
|
|
665
|
+
extractError(error) {
|
|
666
|
+
if (error instanceof Error) {
|
|
667
|
+
return error;
|
|
668
|
+
}
|
|
669
|
+
if (typeof error === "object" && error !== null && "error" in error && error.error instanceof Error) {
|
|
670
|
+
return error.error;
|
|
671
|
+
}
|
|
672
|
+
return null;
|
|
673
|
+
}
|
|
665
674
|
/**========================
|
|
666
675
|
* PUBLIC LOGGER FUNCTIONS
|
|
667
676
|
*=========================*/
|
|
@@ -677,7 +686,17 @@ var FunLogger = class {
|
|
|
677
686
|
warn(title, data) {
|
|
678
687
|
this.onWarn({ title, data });
|
|
679
688
|
}
|
|
680
|
-
|
|
689
|
+
/**
|
|
690
|
+
* @param errorOrData -
|
|
691
|
+
* Previously was called "error" but since in the {@link Logger} interface, error is defined as object (which is the same thing as "any"), we treat it as of unknown type here for safety.
|
|
692
|
+
* In a lot of places it's actually being used as a "data" prop, which also usually has an `.error` property representing an actual {@link Error} object.
|
|
693
|
+
*/
|
|
694
|
+
error(title, errorOrData, _data = {}) {
|
|
695
|
+
const error = this.extractError(errorOrData) ?? void 0;
|
|
696
|
+
const data = {
|
|
697
|
+
..._data,
|
|
698
|
+
...typeof errorOrData === "object" && errorOrData !== null ? errorOrData : {}
|
|
699
|
+
};
|
|
681
700
|
this.onError({ title, error, data });
|
|
682
701
|
}
|
|
683
702
|
configure(apiKey, isDebug, sdkVersion) {
|
|
@@ -810,6 +829,7 @@ function useFunkitConfig() {
|
|
|
810
829
|
|
|
811
830
|
// src/providers/provideFunkitConnectChains.ts
|
|
812
831
|
import {
|
|
832
|
+
BITCOIN_MAINNET_CHAIN_ID,
|
|
813
833
|
HYPERCORE_CHAIN_ID,
|
|
814
834
|
HYPER_EVM_CHAIN_ID,
|
|
815
835
|
KATANA_CHAIN_ID,
|
|
@@ -832,6 +852,10 @@ var baseIcon = {
|
|
|
832
852
|
iconBackground: "#0052ff",
|
|
833
853
|
iconUrl: "https://sdk-cdn.fun.xyz/images/base.svg"
|
|
834
854
|
};
|
|
855
|
+
var bitcoinIcon = {
|
|
856
|
+
iconBackground: "#000000",
|
|
857
|
+
iconUrl: "https://sdk-cdn.fun.xyz/images/bitcoin.svg"
|
|
858
|
+
};
|
|
835
859
|
var blastIcon = {
|
|
836
860
|
iconBackground: "#000000",
|
|
837
861
|
iconUrl: "https://sdk-cdn.fun.xyz/images/blast.svg"
|
|
@@ -978,6 +1002,12 @@ var chainMetadataByName = {
|
|
|
978
1002
|
name: "HyperCore",
|
|
979
1003
|
...hyperCoreIcon
|
|
980
1004
|
},
|
|
1005
|
+
// Non-evm -- Funkit Bitcoin support
|
|
1006
|
+
bitcoin: {
|
|
1007
|
+
chainId: BITCOIN_MAINNET_CHAIN_ID,
|
|
1008
|
+
name: "Bitcoin",
|
|
1009
|
+
...bitcoinIcon
|
|
1010
|
+
},
|
|
981
1011
|
xdc: { chainId: 50, name: "XinFin", ...xdcIcon },
|
|
982
1012
|
xdcTestnet: { chainId: 51, name: "XinFin Testnet", ...xdcIcon },
|
|
983
1013
|
zetachain: { chainId: 7e3, name: "ZetaChain", ...zetachainIcon },
|
|
@@ -2416,7 +2446,7 @@ import React37, {
|
|
|
2416
2446
|
useCallback as useCallback2,
|
|
2417
2447
|
useState as useState5
|
|
2418
2448
|
} from "react";
|
|
2419
|
-
import { FlagKey as
|
|
2449
|
+
import { FlagKey as FlagKey4 } from "@funkit/utils";
|
|
2420
2450
|
|
|
2421
2451
|
// src/utils/safeJSON.ts
|
|
2422
2452
|
import { safeParseJson } from "@funkit/utils";
|
|
@@ -2808,7 +2838,10 @@ var flagConfig = {
|
|
|
2808
2838
|
56: ["*"],
|
|
2809
2839
|
747474: ["*"],
|
|
2810
2840
|
999: ["*"],
|
|
2811
|
-
2741: ["*"]
|
|
2841
|
+
2741: ["*"],
|
|
2842
|
+
8253038: ["*"]
|
|
2843
|
+
// No HyperCore
|
|
2844
|
+
// No Solana
|
|
2812
2845
|
})
|
|
2813
2846
|
},
|
|
2814
2847
|
[FlagKey.RelayBypassTargetChainsAndAssets]: {
|
|
@@ -2823,6 +2856,7 @@ var flagConfig = {
|
|
|
2823
2856
|
747474: ["*"],
|
|
2824
2857
|
999: ["*"],
|
|
2825
2858
|
2741: ["*"],
|
|
2859
|
+
8253038: ["*"],
|
|
2826
2860
|
// HyperCore
|
|
2827
2861
|
1337: ["*"],
|
|
2828
2862
|
// Solana
|
|
@@ -3084,6 +3118,10 @@ var flagConfig = {
|
|
|
3084
3118
|
"10"
|
|
3085
3119
|
// Optimism
|
|
3086
3120
|
])
|
|
3121
|
+
},
|
|
3122
|
+
[FlagKey.EnableBitcoin]: {
|
|
3123
|
+
type: "boolean",
|
|
3124
|
+
default_value: true
|
|
3087
3125
|
}
|
|
3088
3126
|
};
|
|
3089
3127
|
|
|
@@ -3115,6 +3153,41 @@ var hashPct = (flag_key, value, pct) => {
|
|
|
3115
3153
|
return cyrb53(hashKey) % 100 < pct;
|
|
3116
3154
|
};
|
|
3117
3155
|
|
|
3156
|
+
// src/utils/flags/patches/enable-bitcoin-patch.ts
|
|
3157
|
+
import { FlagKey as FlagKey2, safeParseJson as safeParseJson2 } from "@funkit/utils";
|
|
3158
|
+
var BITCOIN_CHAIN_ID = 8253038;
|
|
3159
|
+
var enableBitcoin = (config) => {
|
|
3160
|
+
try {
|
|
3161
|
+
const tokenTransferNewTokensDefaultValue = safeParseJson2(config[FlagKey2.TokenTransferNewTokens].default_value) || {};
|
|
3162
|
+
const tokenTransferSourceChainsAndAssetsDefaultValue = safeParseJson2(
|
|
3163
|
+
config[FlagKey2.TokenTransferSourceChainsAndAssets].default_value
|
|
3164
|
+
) || {};
|
|
3165
|
+
if (config[FlagKey2.EnableBitcoin]) {
|
|
3166
|
+
return config;
|
|
3167
|
+
}
|
|
3168
|
+
return {
|
|
3169
|
+
...config,
|
|
3170
|
+
[FlagKey2.TokenTransferNewTokens]: {
|
|
3171
|
+
...config[FlagKey2.TokenTransferNewTokens],
|
|
3172
|
+
default_value: JSON.stringify({
|
|
3173
|
+
...tokenTransferNewTokensDefaultValue,
|
|
3174
|
+
[BITCOIN_CHAIN_ID]: ["BTC"]
|
|
3175
|
+
})
|
|
3176
|
+
},
|
|
3177
|
+
[FlagKey2.TokenTransferSourceChainsAndAssets]: {
|
|
3178
|
+
...config[FlagKey2.TokenTransferSourceChainsAndAssets],
|
|
3179
|
+
default_value: JSON.stringify({
|
|
3180
|
+
...tokenTransferSourceChainsAndAssetsDefaultValue,
|
|
3181
|
+
[BITCOIN_CHAIN_ID]: ["BTC"]
|
|
3182
|
+
})
|
|
3183
|
+
}
|
|
3184
|
+
};
|
|
3185
|
+
} catch (error) {
|
|
3186
|
+
logger.error("enableBitcoin:unexpected error", error);
|
|
3187
|
+
return config;
|
|
3188
|
+
}
|
|
3189
|
+
};
|
|
3190
|
+
|
|
3118
3191
|
// src/utils/flags/impl.ts
|
|
3119
3192
|
async function fetchWithTimeout(url, options = {}, timeout = 15e3) {
|
|
3120
3193
|
const controller = new AbortController();
|
|
@@ -3137,7 +3210,8 @@ async function fetchConfigFromServer() {
|
|
|
3137
3210
|
logger.log("flag_fetchConfigFromServer", {
|
|
3138
3211
|
configData
|
|
3139
3212
|
});
|
|
3140
|
-
|
|
3213
|
+
const config = enableBitcoin(configData.flags);
|
|
3214
|
+
return config;
|
|
3141
3215
|
}
|
|
3142
3216
|
function deriveAllFlags(config, userContext) {
|
|
3143
3217
|
return Object.fromEntries(
|
|
@@ -3211,7 +3285,7 @@ import React35, {
|
|
|
3211
3285
|
useMemo as useMemo4,
|
|
3212
3286
|
useState as useState4
|
|
3213
3287
|
} from "react";
|
|
3214
|
-
import { FlagKey as
|
|
3288
|
+
import { FlagKey as FlagKey3 } from "@funkit/utils";
|
|
3215
3289
|
|
|
3216
3290
|
// src/consts/customers.ts
|
|
3217
3291
|
import {
|
|
@@ -3333,7 +3407,7 @@ function useFunkitUserIp() {
|
|
|
3333
3407
|
if (!userIpInfo) {
|
|
3334
3408
|
return true;
|
|
3335
3409
|
}
|
|
3336
|
-
const blockedList = getFlag(
|
|
3410
|
+
const blockedList = getFlag(FlagKey3.BlockedCountries, ALL_MATCH).split(",");
|
|
3337
3411
|
return isCountryBlocked(blockedList, userIpInfo);
|
|
3338
3412
|
}, [
|
|
3339
3413
|
getFlag,
|
|
@@ -3447,7 +3521,7 @@ function fetchDataMapFromCache(enableFrogProxyServer) {
|
|
|
3447
3521
|
}
|
|
3448
3522
|
}
|
|
3449
3523
|
function FunkitMeshProvider({ children }) {
|
|
3450
|
-
const enableFrogProxyServer = useFlag(
|
|
3524
|
+
const enableFrogProxyServer = useFlag(FlagKey4.EnableFrogProxyServer);
|
|
3451
3525
|
const [meshBrokerDataMap, setMeshBrokerDataMap] = useState5(
|
|
3452
3526
|
fetchDataMapFromCache(enableFrogProxyServer)
|
|
3453
3527
|
);
|
|
@@ -3916,7 +3990,7 @@ import {
|
|
|
3916
3990
|
initializeCheckout as postApiInitializeCheckout
|
|
3917
3991
|
} from "@funkit/api-base";
|
|
3918
3992
|
import { FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO4 } from "@funkit/chains";
|
|
3919
|
-
import { FlagKey as
|
|
3993
|
+
import { FlagKey as FlagKey7, isNotNullish as isNotNullish3 } from "@funkit/utils";
|
|
3920
3994
|
import React39, {
|
|
3921
3995
|
createContext as createContext10,
|
|
3922
3996
|
useCallback as useCallback8,
|
|
@@ -3949,7 +4023,7 @@ var WEB3_ACCOUNT_BALANCE_MESSAGE = {
|
|
|
3949
4023
|
};
|
|
3950
4024
|
|
|
3951
4025
|
// src/hooks/useRelayBypass.ts
|
|
3952
|
-
import { FlagKey as
|
|
4026
|
+
import { FlagKey as FlagKey5, isTokenAddressEquivalent as isTokenAddressEquivalent2 } from "@funkit/utils";
|
|
3953
4027
|
import { useCallback as useCallback4, useMemo as useMemo7 } from "react";
|
|
3954
4028
|
var isTokenFlagEnabled = (tokenList, tokenAddress) => {
|
|
3955
4029
|
if (tokenList.includes("*")) {
|
|
@@ -3963,9 +4037,9 @@ var isTokenFlagEnabled = (tokenList, tokenAddress) => {
|
|
|
3963
4037
|
);
|
|
3964
4038
|
};
|
|
3965
4039
|
function useSourceTokenRelayEnabled() {
|
|
3966
|
-
const isRelayBypassEnabled = useFlag(
|
|
4040
|
+
const isRelayBypassEnabled = useFlag(FlagKey5.IsRelayBypassEnabled);
|
|
3967
4041
|
const sourceTokensJsonString = useFlag(
|
|
3968
|
-
|
|
4042
|
+
FlagKey5.RelayBypassSourceChainsAndAssets
|
|
3969
4043
|
);
|
|
3970
4044
|
const sourceTokens = useMemo7(
|
|
3971
4045
|
() => safeJSONParse(sourceTokensJsonString),
|
|
@@ -3984,12 +4058,12 @@ function useSourceTokenRelayEnabled() {
|
|
|
3984
4058
|
}
|
|
3985
4059
|
function useRelayBypass() {
|
|
3986
4060
|
const { apiKey } = useFunkitConfig();
|
|
3987
|
-
const isRelayBypassEnabled = useFlag(
|
|
4061
|
+
const isRelayBypassEnabled = useFlag(FlagKey5.IsRelayBypassEnabled);
|
|
3988
4062
|
const sourceTokensJsonString = useFlag(
|
|
3989
|
-
|
|
4063
|
+
FlagKey5.RelayBypassSourceChainsAndAssets
|
|
3990
4064
|
);
|
|
3991
4065
|
const targetTokensJsonString = useFlag(
|
|
3992
|
-
|
|
4066
|
+
FlagKey5.RelayBypassTargetChainsAndAssets
|
|
3993
4067
|
);
|
|
3994
4068
|
const sourceTokens = safeJSONParse(
|
|
3995
4069
|
sourceTokensJsonString
|
|
@@ -4262,7 +4336,7 @@ function useCheckoutDirectExecution() {
|
|
|
4262
4336
|
import {
|
|
4263
4337
|
initializeCheckoutTokenTransferAddress
|
|
4264
4338
|
} from "@funkit/api-base";
|
|
4265
|
-
import { FlagKey as
|
|
4339
|
+
import { FlagKey as FlagKey6 } from "@funkit/utils";
|
|
4266
4340
|
import { useQuery as useQuery3 } from "@tanstack/react-query";
|
|
4267
4341
|
import { useCallback as useCallback6 } from "react";
|
|
4268
4342
|
|
|
@@ -4337,7 +4411,7 @@ var useCheckoutTransferInit = () => {
|
|
|
4337
4411
|
const checkoutConfig = checkoutItem?.initSettings.config;
|
|
4338
4412
|
const { walletAddress, userInfo } = useGeneralWallet();
|
|
4339
4413
|
const { apiKey } = useFunkitConfig();
|
|
4340
|
-
const isQrCodeEnabled = useFlag(
|
|
4414
|
+
const isQrCodeEnabled = useFlag(FlagKey6.EnableTokenTransfer, false);
|
|
4341
4415
|
const recipientAddr = checkoutConfig?.customRecipient || walletAddress || "0x";
|
|
4342
4416
|
const queryKey = {
|
|
4343
4417
|
userId: userInfo.id || "",
|
|
@@ -4862,7 +4936,7 @@ function useFunkitCheckout(props) {
|
|
|
4862
4936
|
const { openWithdrawalModal } = useWithdrawalModal();
|
|
4863
4937
|
const { connectModalOpen, openConnectModal } = useConnectModal();
|
|
4864
4938
|
const { isUserLoggedIn } = useGeneralWallet();
|
|
4865
|
-
const isCheckoutActivated = useFlag(
|
|
4939
|
+
const isCheckoutActivated = useFlag(FlagKey7.IsCheckoutActivated);
|
|
4866
4940
|
const onErrorWrapper = useCallback8(
|
|
4867
4941
|
(payload) => {
|
|
4868
4942
|
logger.warn(payload.message, payload);
|
|
@@ -7022,6 +7096,7 @@ var ASSET_LOGO_SRCS = {
|
|
|
7022
7096
|
BLERF: "https://sdk-cdn.fun.xyz/images/blerf.png",
|
|
7023
7097
|
BRETT: "https://sdk-cdn.fun.xyz/images/brett.svg",
|
|
7024
7098
|
BSHIB: "https://sdk-cdn.fun.xyz/images/bshib.png",
|
|
7099
|
+
BTC: "https://sdk-cdn.fun.xyz/images/btc.svg",
|
|
7025
7100
|
CBBTC: "https://sdk-cdn.fun.xyz/images/cbbtc.svg",
|
|
7026
7101
|
CBETH: "https://sdk-cdn.fun.xyz/images/cbeth.png",
|
|
7027
7102
|
CRO: "https://sdk-cdn.fun.xyz/images/cro.svg",
|
|
@@ -7397,7 +7472,7 @@ var ErrorFallback = () => /* @__PURE__ */ React57.createElement(
|
|
|
7397
7472
|
);
|
|
7398
7473
|
|
|
7399
7474
|
// src/components/FunBottomBar/FunBottomBar.tsx
|
|
7400
|
-
import { FlagKey as
|
|
7475
|
+
import { FlagKey as FlagKey8, isMobile } from "@funkit/utils";
|
|
7401
7476
|
import React61 from "react";
|
|
7402
7477
|
|
|
7403
7478
|
// src/components/FunButton/FunButton.tsx
|
|
@@ -7685,7 +7760,7 @@ var FunBottomBar = ({
|
|
|
7685
7760
|
onClose
|
|
7686
7761
|
}) => {
|
|
7687
7762
|
const { uiCustomizations } = useFunkitConfig();
|
|
7688
|
-
const showTagline = useFlag(
|
|
7763
|
+
const showTagline = useFlag(FlagKey8.ShowPoweredTagline);
|
|
7689
7764
|
const defaultBottomSection = showTagline ? /* @__PURE__ */ React61.createElement(FunPoweredTagline, null) : void 0;
|
|
7690
7765
|
const bottomSectionComponent = bottomSection ?? defaultBottomSection;
|
|
7691
7766
|
const hasMultipleButtons = !!onClose;
|
|
@@ -8571,7 +8646,7 @@ Dialog.BottomBar = FunBottomBar;
|
|
|
8571
8646
|
// src/modals/WithdrwalModal/WithdrawalContent.tsx
|
|
8572
8647
|
import { FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO8 } from "@funkit/chains";
|
|
8573
8648
|
import {
|
|
8574
|
-
FlagKey as
|
|
8649
|
+
FlagKey as FlagKey15,
|
|
8575
8650
|
formatCryptoAndStringify as formatCryptoAndStringify2,
|
|
8576
8651
|
formatCurrencyAndStringify as formatCurrencyAndStringify3
|
|
8577
8652
|
} from "@funkit/utils";
|
|
@@ -8751,7 +8826,7 @@ var getRemoteImageStyles = (isRemoteImage, isRemoteImageLoaded, src) => {
|
|
|
8751
8826
|
import React85 from "react";
|
|
8752
8827
|
|
|
8753
8828
|
// src/components/Dropdown/ChainDropdown.tsx
|
|
8754
|
-
import { FlagKey as
|
|
8829
|
+
import { FlagKey as FlagKey9 } from "@funkit/utils";
|
|
8755
8830
|
import React82 from "react";
|
|
8756
8831
|
|
|
8757
8832
|
// src/components/Dropdown/BaseDropdown.tsx
|
|
@@ -9660,9 +9735,9 @@ var ChainDropdown = ({
|
|
|
9660
9735
|
maxDropdownHeight,
|
|
9661
9736
|
tagComponent
|
|
9662
9737
|
}) => {
|
|
9663
|
-
const defaultChainIdJson = useFlag(
|
|
9738
|
+
const defaultChainIdJson = useFlag(FlagKey9.TokenTransferDefaultChainId);
|
|
9664
9739
|
const defaultChainId = safeJSONParse(defaultChainIdJson);
|
|
9665
|
-
const chainSortOrderJson = useFlag(
|
|
9740
|
+
const chainSortOrderJson = useFlag(FlagKey9.ChainIdSortOrder);
|
|
9666
9741
|
const chainSortOrder = safeJSONParse(chainSortOrderJson) || [];
|
|
9667
9742
|
const chainIds = getSortedChainIds();
|
|
9668
9743
|
const options = allowUnselect ? [DEFAULT_VALUE, ...chainIds] : chainIds;
|
|
@@ -9769,7 +9844,7 @@ var ChainDropdown = ({
|
|
|
9769
9844
|
};
|
|
9770
9845
|
|
|
9771
9846
|
// src/components/Dropdown/TokenDropdown.tsx
|
|
9772
|
-
import { FlagKey as
|
|
9847
|
+
import { FlagKey as FlagKey10, safeParseJson as safeParseJson3 } from "@funkit/utils";
|
|
9773
9848
|
import React84, { useState as useState20 } from "react";
|
|
9774
9849
|
|
|
9775
9850
|
// src/utils/tokenIconUrl.ts
|
|
@@ -9868,10 +9943,10 @@ var NewTokenBadge = ({ iconSymbol }) => {
|
|
|
9868
9943
|
// src/components/Dropdown/TokenDropdown.tsx
|
|
9869
9944
|
var TOKEN_ICON_SIZE = 16;
|
|
9870
9945
|
var useNewTokens = () => {
|
|
9871
|
-
const bannerJson = useFlag(
|
|
9872
|
-
const bannerData =
|
|
9873
|
-
const newBadgeTokensJson = useFlag(
|
|
9874
|
-
const newBadgeData =
|
|
9946
|
+
const bannerJson = useFlag(FlagKey10.NewTokenAssetSelectionBanner);
|
|
9947
|
+
const bannerData = safeParseJson3(bannerJson);
|
|
9948
|
+
const newBadgeTokensJson = useFlag(FlagKey10.TokenTransferNewTokens);
|
|
9949
|
+
const newBadgeData = safeParseJson3(newBadgeTokensJson);
|
|
9875
9950
|
const newTokens = newBadgeData && Object.values(newBadgeData).flat();
|
|
9876
9951
|
const newUniqueTokens = new Set(newTokens);
|
|
9877
9952
|
const newSymbol = bannerData && newUniqueTokens.has(bannerData.symbol) ? bannerData.symbol : newTokens?.[0];
|
|
@@ -9886,7 +9961,7 @@ var TokenDropdown = ({
|
|
|
9886
9961
|
alwaysOpenToTop,
|
|
9887
9962
|
maxDropdownHeight
|
|
9888
9963
|
}) => {
|
|
9889
|
-
const defaultTokensJson = useFlag(
|
|
9964
|
+
const defaultTokensJson = useFlag(FlagKey10.TokenTransferDefaultTokens);
|
|
9890
9965
|
const defaultTokens = safeJSONParse(defaultTokensJson);
|
|
9891
9966
|
const enabledTokens = assets[selectedChainId];
|
|
9892
9967
|
const allTokens = getSortedTokens();
|
|
@@ -11476,13 +11551,13 @@ var useAssetSymbolPrice = ({
|
|
|
11476
11551
|
};
|
|
11477
11552
|
|
|
11478
11553
|
// src/hooks/useTokenChain.ts
|
|
11479
|
-
import { FlagKey as
|
|
11554
|
+
import { FlagKey as FlagKey12 } from "@funkit/utils";
|
|
11480
11555
|
import { useEffect as useEffect24, useState as useState22 } from "react";
|
|
11481
11556
|
import { polygon as polygon3 } from "viem/chains";
|
|
11482
11557
|
|
|
11483
11558
|
// src/hooks/useEnabledTokenTransferChainTokens.ts
|
|
11484
|
-
import { solanaChain as solanaChain3 } from "@funkit/chains";
|
|
11485
|
-
import { FlagKey as
|
|
11559
|
+
import { bitcoinChain, solanaChain as solanaChain3 } from "@funkit/chains";
|
|
11560
|
+
import { FlagKey as FlagKey11 } from "@funkit/utils";
|
|
11486
11561
|
import { base as base4 } from "viem/chains";
|
|
11487
11562
|
|
|
11488
11563
|
// src/hooks/useIsUsUser.ts
|
|
@@ -11504,14 +11579,15 @@ function useIsUsKatanaUser() {
|
|
|
11504
11579
|
// src/hooks/useEnabledTokenTransferChainTokens.ts
|
|
11505
11580
|
function useEnabledTokenTransferChainTokens(transferInit, isWithdrawal) {
|
|
11506
11581
|
const isBankrUsUser = useIsUsBankrUser();
|
|
11507
|
-
const depositAssets = useFlag(
|
|
11508
|
-
const withdrawalAssets = useFlag(
|
|
11582
|
+
const depositAssets = useFlag(FlagKey11.TokenTransferSourceChainsAndAssets);
|
|
11583
|
+
const withdrawalAssets = useFlag(FlagKey11.WithdrawalChainsAndAssets);
|
|
11509
11584
|
const assetsJsonString = isWithdrawal ? withdrawalAssets : depositAssets;
|
|
11510
11585
|
const assets = safeJSONParse(assetsJsonString);
|
|
11511
11586
|
if (!assets) {
|
|
11512
11587
|
return {};
|
|
11513
11588
|
}
|
|
11514
11589
|
const hasSolanaAddress = !!transferInit?.solanaAddr;
|
|
11590
|
+
const hasBitcoinAddress = !!transferInit?.btcAddrSegwit;
|
|
11515
11591
|
return Object.keys(assets).reduce(
|
|
11516
11592
|
(acc, curChainIdString) => {
|
|
11517
11593
|
const chainId = Number(curChainIdString);
|
|
@@ -11519,6 +11595,10 @@ function useEnabledTokenTransferChainTokens(transferInit, isWithdrawal) {
|
|
|
11519
11595
|
if (isSolana && !hasSolanaAddress && !isWithdrawal) {
|
|
11520
11596
|
return acc;
|
|
11521
11597
|
}
|
|
11598
|
+
const isBitcoin = chainId === bitcoinChain.id;
|
|
11599
|
+
if (isBitcoin && !hasBitcoinAddress && !isWithdrawal) {
|
|
11600
|
+
return acc;
|
|
11601
|
+
}
|
|
11522
11602
|
if (isBankrUsUser && chainId !== base4.id) {
|
|
11523
11603
|
return acc;
|
|
11524
11604
|
}
|
|
@@ -11537,7 +11617,7 @@ var useTokenAndChainSelection = (transferInit, defaultValues, isWithdrawal) => {
|
|
|
11537
11617
|
transferInit ?? null,
|
|
11538
11618
|
isWithdrawal
|
|
11539
11619
|
);
|
|
11540
|
-
const defaultChainIdFlag = useFlag(
|
|
11620
|
+
const defaultChainIdFlag = useFlag(FlagKey12.TokenTransferDefaultChainId);
|
|
11541
11621
|
const defaultChainId = defaultValues?.chainId ?? Number(defaultChainIdFlag);
|
|
11542
11622
|
const validDefaultChainId = filteredAssets[defaultChainId] !== void 0 ? defaultChainId : polygon3.id;
|
|
11543
11623
|
const [selectedChainId, setSelectedChainId] = useState22(validDefaultChainId);
|
|
@@ -11623,10 +11703,10 @@ import { ClientError as ClientError2 } from "@funkit/utils";
|
|
|
11623
11703
|
import { useState as useState25 } from "react";
|
|
11624
11704
|
|
|
11625
11705
|
// src/hooks/useIsBlacklisted.ts
|
|
11626
|
-
import { FlagKey as
|
|
11706
|
+
import { FlagKey as FlagKey13 } from "@funkit/utils";
|
|
11627
11707
|
import { useMemo as useMemo12 } from "react";
|
|
11628
11708
|
var useIsBlacklisted = (walletAddress, customRecipient) => {
|
|
11629
|
-
const flagStr = useFlag(
|
|
11709
|
+
const flagStr = useFlag(FlagKey13.AddressBlacklist);
|
|
11630
11710
|
const blacklist = useMemo12(
|
|
11631
11711
|
() => safeJSONParse(flagStr)?.map((addr) => addr.toLowerCase()) || [],
|
|
11632
11712
|
[flagStr]
|
|
@@ -11638,7 +11718,7 @@ var useIsBlacklisted = (walletAddress, customRecipient) => {
|
|
|
11638
11718
|
};
|
|
11639
11719
|
|
|
11640
11720
|
// src/providers/FunkitQuoteContext.tsx
|
|
11641
|
-
import { FlagKey as
|
|
11721
|
+
import { FlagKey as FlagKey14, isNotNullish as isNotNullish5 } from "@funkit/utils";
|
|
11642
11722
|
import React92, {
|
|
11643
11723
|
createContext as createContext14,
|
|
11644
11724
|
useCallback as useCallback16,
|
|
@@ -11739,7 +11819,7 @@ function FunkitQuoteProvider({ children }) {
|
|
|
11739
11819
|
const funkitConfig = useFunkitConfig();
|
|
11740
11820
|
const wagmiConfig = useConfig3();
|
|
11741
11821
|
const { walletAddress, logoutSymbol, loginType, userInfo } = useGeneralWallet();
|
|
11742
|
-
const enableFrogProxyServer = useFlag(
|
|
11822
|
+
const enableFrogProxyServer = useFlag(FlagKey14.EnableFrogProxyServer);
|
|
11743
11823
|
const { getDirectExecutionInfo } = useCheckoutDirectExecution();
|
|
11744
11824
|
const [latestQuote, setLatestQuote] = useState24(null);
|
|
11745
11825
|
const [isQuoting, setIsQuoting] = useState24(false);
|
|
@@ -12179,7 +12259,7 @@ function useWithdrawalAssets(config) {
|
|
|
12179
12259
|
},
|
|
12180
12260
|
true
|
|
12181
12261
|
);
|
|
12182
|
-
const excludedTokenStr = useFlag(
|
|
12262
|
+
const excludedTokenStr = useFlag(FlagKey15.WithdrawalExcludeTokens);
|
|
12183
12263
|
const excludedTokens = safeJSONParse(excludedTokenStr);
|
|
12184
12264
|
if (excludedTokens) {
|
|
12185
12265
|
for (const chainIdStr of Object.keys(excludedTokens)) {
|
|
@@ -12944,10 +13024,10 @@ import { useAccount as useAccount6 } from "wagmi";
|
|
|
12944
13024
|
// src/components/FunPayments/FunPaymentMethods.tsx
|
|
12945
13025
|
import { BridgeCustomerStatus as BridgeCustomerStatus3 } from "@funkit/api-base";
|
|
12946
13026
|
import {
|
|
12947
|
-
FlagKey as
|
|
13027
|
+
FlagKey as FlagKey18,
|
|
12948
13028
|
formatCurrencyAndStringify as formatCurrencyAndStringify4,
|
|
12949
13029
|
formatSecondsToReadableForm,
|
|
12950
|
-
safeParseJson as
|
|
13030
|
+
safeParseJson as safeParseJson4
|
|
12951
13031
|
} from "@funkit/utils";
|
|
12952
13032
|
import React103 from "react";
|
|
12953
13033
|
|
|
@@ -13031,9 +13111,9 @@ var isSoftRejected = (customer) => customer && isKycUninitialized(customer.statu
|
|
|
13031
13111
|
var FIAT_PROCESSING_TIME = "1-2 business days";
|
|
13032
13112
|
|
|
13033
13113
|
// src/hooks/useCheckoutTimeEstimate.ts
|
|
13034
|
-
import { FlagKey as
|
|
13114
|
+
import { FlagKey as FlagKey16 } from "@funkit/utils";
|
|
13035
13115
|
function useCheckoutTimeEstimate(originalTimeEstimationMs, paymentMethod = "card" /* CARD */, bypassFlag = false) {
|
|
13036
|
-
const timeEstimatesJsonString = useFlag(
|
|
13116
|
+
const timeEstimatesJsonString = useFlag(FlagKey16.CheckoutTimeEstimateOverrides);
|
|
13037
13117
|
const timeEstimates = safeJSONParse(
|
|
13038
13118
|
timeEstimatesJsonString
|
|
13039
13119
|
);
|
|
@@ -13050,7 +13130,7 @@ import {
|
|
|
13050
13130
|
getBridgeKycLink
|
|
13051
13131
|
} from "@funkit/api-base";
|
|
13052
13132
|
import { FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO11 } from "@funkit/chains";
|
|
13053
|
-
import { FlagKey as
|
|
13133
|
+
import { FlagKey as FlagKey17 } from "@funkit/utils";
|
|
13054
13134
|
import { useQuery as useQuery11, useQueryClient } from "@tanstack/react-query";
|
|
13055
13135
|
import { useCallback as useCallback18 } from "react";
|
|
13056
13136
|
var sepaCountryCode = [
|
|
@@ -13130,8 +13210,8 @@ function useFiatEnabled() {
|
|
|
13130
13210
|
const isEuSepaUser = sepaCountryCode.includes(
|
|
13131
13211
|
userIpInfo?.alpha2 || "PLACEHOLDER"
|
|
13132
13212
|
);
|
|
13133
|
-
const isTokenTransferEnabled = useFlag(
|
|
13134
|
-
const isFiatEnabled = useFlag(
|
|
13213
|
+
const isTokenTransferEnabled = useFlag(FlagKey17.EnableTokenTransfer);
|
|
13214
|
+
const isFiatEnabled = useFlag(FlagKey17.EnableFiatDeposit);
|
|
13135
13215
|
return isEuSepaUser && isTokenTransferEnabled && isFiatEnabled;
|
|
13136
13216
|
}
|
|
13137
13217
|
function useFrogAccounts() {
|
|
@@ -14610,9 +14690,9 @@ var TransferPaymentMethodItem = ({
|
|
|
14610
14690
|
paymentIcon
|
|
14611
14691
|
}) => {
|
|
14612
14692
|
const { textCustomizations } = useFunkitConfig();
|
|
14613
|
-
const bannerJson = useFlag(
|
|
14614
|
-
const bannerData =
|
|
14615
|
-
const depositAssetsJson = useFlag(
|
|
14693
|
+
const bannerJson = useFlag(FlagKey18.NewTokenAssetSelectionBanner);
|
|
14694
|
+
const bannerData = safeParseJson4(bannerJson);
|
|
14695
|
+
const depositAssetsJson = useFlag(FlagKey18.TokenTransferSourceChainsAndAssets);
|
|
14616
14696
|
const depositAssetsData = safeJSONParse(depositAssetsJson);
|
|
14617
14697
|
const getTokenTransferIcon = () => {
|
|
14618
14698
|
const uniqueChainIds = new Set(Object.keys(depositAssetsData ?? {}));
|
|
@@ -16868,7 +16948,7 @@ import { DirectExecutionType as DirectExecutionType2 } from "@funkit/api-base";
|
|
|
16868
16948
|
|
|
16869
16949
|
// src/components/FunInfoBanner/FunInfoBanner.tsx
|
|
16870
16950
|
import React136 from "react";
|
|
16871
|
-
import { FlagKey as
|
|
16951
|
+
import { FlagKey as FlagKey19, safeParseJson as safeParseJson5 } from "@funkit/utils";
|
|
16872
16952
|
|
|
16873
16953
|
// src/components/FunInfoBanner/EphemeralInfoBanner.tsx
|
|
16874
16954
|
import React135, { useState as useState33 } from "react";
|
|
@@ -16906,8 +16986,8 @@ var EphemeralInfoBanner = ({
|
|
|
16906
16986
|
|
|
16907
16987
|
// src/components/FunInfoBanner/FunInfoBanner.tsx
|
|
16908
16988
|
var FunInfoBanner = () => {
|
|
16909
|
-
const bannerJson = useFlag(
|
|
16910
|
-
const bannerData =
|
|
16989
|
+
const bannerJson = useFlag(FlagKey19.ShowInfoBanner);
|
|
16990
|
+
const bannerData = safeParseJson5(bannerJson);
|
|
16911
16991
|
if (!bannerData || !bannerData.message) {
|
|
16912
16992
|
return null;
|
|
16913
16993
|
}
|
|
@@ -18747,7 +18827,7 @@ import { getMeldDefaultFiat } from "@funkit/api-base";
|
|
|
18747
18827
|
import { useQuery as useQuery13 } from "@tanstack/react-query";
|
|
18748
18828
|
|
|
18749
18829
|
// src/hooks/queries/useMeldCryptoCurrencyCode.ts
|
|
18750
|
-
import { FlagKey as
|
|
18830
|
+
import { FlagKey as FlagKey20 } from "@funkit/utils";
|
|
18751
18831
|
import { arbitrum as arbitrum3, base as base6, polygon as polygon5 } from "viem/chains";
|
|
18752
18832
|
var ARB_USDC = "0xaf88d065e77c8cC2239327C5EDb3A432268e5831".toLowerCase();
|
|
18753
18833
|
var POLYGON_USDC = "0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359".toLowerCase();
|
|
@@ -18780,7 +18860,7 @@ function useMeldCryptoCurrencyCode() {
|
|
|
18780
18860
|
return mappedCurrency;
|
|
18781
18861
|
}
|
|
18782
18862
|
function useIsMeldEnabled() {
|
|
18783
|
-
const meldEnabled = useFlag(
|
|
18863
|
+
const meldEnabled = useFlag(FlagKey20.EnableMeldPayment);
|
|
18784
18864
|
const meldCurrencyCode = useMeldCryptoCurrencyCode();
|
|
18785
18865
|
return meldEnabled && !!meldCurrencyCode;
|
|
18786
18866
|
}
|
|
@@ -18895,7 +18975,7 @@ var useMeldLimitError = (amount, fiatCurrency) => {
|
|
|
18895
18975
|
// src/modals/CheckoutModal/InputAmount/InputAmountLoaded.tsx
|
|
18896
18976
|
import { MeldServiceProvider as MeldServiceProvider2 } from "@funkit/api-base";
|
|
18897
18977
|
import {
|
|
18898
|
-
FlagKey as
|
|
18978
|
+
FlagKey as FlagKey23,
|
|
18899
18979
|
formatCryptoAndStringify as formatCryptoAndStringify4,
|
|
18900
18980
|
formatCurrencyAndStringify as formatCurrencyAndStringify9,
|
|
18901
18981
|
isTokenEquivalent as isTokenEquivalent5,
|
|
@@ -19167,7 +19247,7 @@ var MeldProviderLabel = ({
|
|
|
19167
19247
|
};
|
|
19168
19248
|
|
|
19169
19249
|
// src/components/SourcePaymentMethodItem/SourcePaymentMethodItem.tsx
|
|
19170
|
-
import { FlagKey as
|
|
19250
|
+
import { FlagKey as FlagKey21 } from "@funkit/utils";
|
|
19171
19251
|
import clsx17 from "clsx";
|
|
19172
19252
|
import { useAnimate as useAnimate2 } from "motion/react";
|
|
19173
19253
|
import React157 from "react";
|
|
@@ -19772,8 +19852,8 @@ var SourcePaymentMethodItem = ({
|
|
|
19772
19852
|
icon: /* @__PURE__ */ React157.createElement(MasterCardPillIcon, { key: "mastercard", backdropColor })
|
|
19773
19853
|
}
|
|
19774
19854
|
];
|
|
19775
|
-
const isCardEnabled = useFlag(
|
|
19776
|
-
const isBrokerageEnabled = useFlag(
|
|
19855
|
+
const isCardEnabled = useFlag(FlagKey21.EnableCard);
|
|
19856
|
+
const isBrokerageEnabled = useFlag(FlagKey21.EnableBrokerage);
|
|
19777
19857
|
const usableAlternativeIcons = icons.filter(({ paymentMethod }) => {
|
|
19778
19858
|
if (paymentMethod === type || paymentMethod === "card" /* CARD */ && !isCardEnabled || paymentMethod === "brokerage" /* BROKERAGE */ && !isBrokerageEnabled) {
|
|
19779
19859
|
return false;
|
|
@@ -20363,7 +20443,7 @@ function InputAmountLayout({
|
|
|
20363
20443
|
}
|
|
20364
20444
|
|
|
20365
20445
|
// src/modals/CheckoutModal/InputAmount/QuickOptions.tsx
|
|
20366
|
-
import { FlagKey as
|
|
20446
|
+
import { FlagKey as FlagKey22, clamp as clamp2, formatCurrencyAndStringify as formatCurrencyAndStringify8 } from "@funkit/utils";
|
|
20367
20447
|
import React162 from "react";
|
|
20368
20448
|
var USD_AMOUNT_OPTIONS_PCT = [25, 50, 75, 100];
|
|
20369
20449
|
function deduplicateArray(arr) {
|
|
@@ -20371,7 +20451,7 @@ function deduplicateArray(arr) {
|
|
|
20371
20451
|
}
|
|
20372
20452
|
function useFiatAmountOptions(currency) {
|
|
20373
20453
|
const isMeldEnabled = useIsMeldEnabled();
|
|
20374
|
-
const currencyQuickOptionStr = useFlag(
|
|
20454
|
+
const currencyQuickOptionStr = useFlag(FlagKey22.MeldQuickOptions);
|
|
20375
20455
|
const currencyQuickOption = safeJSONParse(
|
|
20376
20456
|
currencyQuickOptionStr
|
|
20377
20457
|
);
|
|
@@ -21021,7 +21101,7 @@ function InputAmountLoaded({
|
|
|
21021
21101
|
defaultFiatCurrency,
|
|
21022
21102
|
textCustomizations
|
|
21023
21103
|
}) {
|
|
21024
|
-
const maxCheckoutUsdString = useFlag(
|
|
21104
|
+
const maxCheckoutUsdString = useFlag(FlagKey23.MaxCheckoutUsd);
|
|
21025
21105
|
const isSourceNavWidgetEnabled = modalState.startingStep === "select_asset" /* SELECT_ASSET */;
|
|
21026
21106
|
const { paymentMethod } = modalState.paymentMethodInfo;
|
|
21027
21107
|
const { quote: manuallySelectedQuote } = modalState;
|
|
@@ -21576,14 +21656,14 @@ import { mainnet as mainnet8, polygon as polygon6 } from "viem/chains";
|
|
|
21576
21656
|
var ASSETS_LOW_VALUE_THRESHOLD2 = 0.1;
|
|
21577
21657
|
|
|
21578
21658
|
// src/hooks/usePaymentSources.ts
|
|
21579
|
-
import { FlagKey as
|
|
21659
|
+
import { FlagKey as FlagKey24, isNotNullish as isNotNullish8 } from "@funkit/utils";
|
|
21580
21660
|
function usePaymentMethodEnablement({
|
|
21581
21661
|
checkoutConfig
|
|
21582
21662
|
}) {
|
|
21583
21663
|
const { apiKey } = useFunkitConfig();
|
|
21584
|
-
const isTokenTransferFlagEnabled = useFlag(
|
|
21664
|
+
const isTokenTransferFlagEnabled = useFlag(FlagKey24.EnableTokenTransfer);
|
|
21585
21665
|
const isFiatFlagEnabled = useFiatEnabled();
|
|
21586
|
-
const isCardFlagEnabled = useFlag(
|
|
21666
|
+
const isCardFlagEnabled = useFlag(FlagKey24.EnableCard);
|
|
21587
21667
|
const isKatanaEarnFlowAction = isKatanaEarnFlow({ apiKey, checkoutConfig });
|
|
21588
21668
|
const isUsKatanaUser = useIsUsKatanaUser();
|
|
21589
21669
|
const isFiatEnabled = isFiatFlagEnabled && !isKatanaEarnFlowAction;
|
|
@@ -22404,13 +22484,13 @@ var ReceiveTokenDropdown = ({
|
|
|
22404
22484
|
|
|
22405
22485
|
// src/components/NewTokenDepositAlert/NewTokenDepositAlert.tsx
|
|
22406
22486
|
import React174 from "react";
|
|
22407
|
-
import { FlagKey as
|
|
22487
|
+
import { FlagKey as FlagKey25, safeParseJson as safeParseJson6 } from "@funkit/utils";
|
|
22408
22488
|
var NewTokenDepositAlert = ({
|
|
22409
22489
|
onClick
|
|
22410
22490
|
}) => {
|
|
22411
|
-
const alertJson = useFlag(
|
|
22412
|
-
const alertData =
|
|
22413
|
-
const isTokenTransferEnabled = useFlag(
|
|
22491
|
+
const alertJson = useFlag(FlagKey25.NewTokenAssetSelectionBanner);
|
|
22492
|
+
const alertData = safeParseJson6(alertJson);
|
|
22493
|
+
const isTokenTransferEnabled = useFlag(FlagKey25.EnableTokenTransfer);
|
|
22414
22494
|
if (!alertData || !isTokenTransferEnabled) {
|
|
22415
22495
|
return null;
|
|
22416
22496
|
}
|
|
@@ -24013,14 +24093,31 @@ var TransferTokenDetails = ({
|
|
|
24013
24093
|
};
|
|
24014
24094
|
|
|
24015
24095
|
// src/hooks/useTokenTransfer.ts
|
|
24016
|
-
import { solanaChain as solanaChain4 } from "@funkit/chains";
|
|
24017
|
-
import { FlagKey as
|
|
24096
|
+
import { bitcoinChain as bitcoinChain2, solanaChain as solanaChain4 } from "@funkit/chains";
|
|
24097
|
+
import { FlagKey as FlagKey26 } from "@funkit/utils";
|
|
24018
24098
|
import { useMemo as useMemo30 } from "react";
|
|
24019
24099
|
import { mainnet as mainnet9, polygon as polygon7 } from "viem/chains";
|
|
24100
|
+
|
|
24101
|
+
// src/utils/transfer.ts
|
|
24102
|
+
var getTransferTokenQrCodeUri = (props) => {
|
|
24103
|
+
const { depositAddress, type } = props;
|
|
24104
|
+
if (type === "ethereum") {
|
|
24105
|
+
return `ethereum:${depositAddress}`;
|
|
24106
|
+
}
|
|
24107
|
+
if (type === "solana") {
|
|
24108
|
+
return `solana:${depositAddress}`;
|
|
24109
|
+
}
|
|
24110
|
+
if (type === "bitcoin") {
|
|
24111
|
+
return `bitcoin:${depositAddress}`;
|
|
24112
|
+
}
|
|
24113
|
+
throw new Error(`Invalid transfer token qr code type: ${type}`);
|
|
24114
|
+
};
|
|
24115
|
+
|
|
24116
|
+
// src/hooks/useTokenTransfer.ts
|
|
24020
24117
|
var useTokenTransfer = (selectedChainId, selectedToken, chainIds) => {
|
|
24021
24118
|
const { checkoutItem } = useCheckoutContext();
|
|
24022
24119
|
const enableUniversal = useFlag(
|
|
24023
|
-
|
|
24120
|
+
FlagKey26.EnableTokenTransferUniversalDepositAddress,
|
|
24024
24121
|
false
|
|
24025
24122
|
);
|
|
24026
24123
|
const estPriceImpact = usePriceImpactEstimation(selectedToken);
|
|
@@ -24038,9 +24135,22 @@ var useTokenTransfer = (selectedChainId, selectedToken, chainIds) => {
|
|
|
24038
24135
|
const isUsdceOnPolygon = isPolygon && selectedToken === "USDC.e";
|
|
24039
24136
|
const isUsdcOnPolygon = isPolygon && selectedToken === "USDC";
|
|
24040
24137
|
const showOriginalRecipient = isBankrUsUser || !enableUniversal && (isUsdceOnPolygon || isUsdcOnPolygon);
|
|
24041
|
-
const funDepositAddress = selectedChainId === solanaChain4.id ? transferInit?.solanaAddr : transferInit?.depositAddr;
|
|
24138
|
+
const funDepositAddress = selectedChainId === solanaChain4.id ? transferInit?.solanaAddr : selectedChainId === bitcoinChain2.id ? transferInit?.btcAddrSegwit : transferInit?.depositAddr;
|
|
24139
|
+
const blockchainType = (() => {
|
|
24140
|
+
if (selectedChainId === solanaChain4.id) {
|
|
24141
|
+
return "solana";
|
|
24142
|
+
}
|
|
24143
|
+
if (selectedChainId === bitcoinChain2.id) {
|
|
24144
|
+
return "bitcoin";
|
|
24145
|
+
}
|
|
24146
|
+
return "ethereum";
|
|
24147
|
+
})();
|
|
24042
24148
|
const depositAddressTooltip = `Send any accepted token to this address${showOriginalRecipient ? "" : ` and it will auto
|
|
24043
24149
|
swap to ${checkoutConfig?.targetAssetTicker} in your account`}.`;
|
|
24150
|
+
const qrCodeUri = funDepositAddress ? getTransferTokenQrCodeUri({
|
|
24151
|
+
depositAddress: funDepositAddress,
|
|
24152
|
+
type: blockchainType
|
|
24153
|
+
}) : void 0;
|
|
24044
24154
|
return {
|
|
24045
24155
|
depositAddress: showOriginalRecipient ? recipientAddr : funDepositAddress,
|
|
24046
24156
|
depositAddressTooltip,
|
|
@@ -24049,12 +24159,14 @@ var useTokenTransfer = (selectedChainId, selectedToken, chainIds) => {
|
|
|
24049
24159
|
minTransferUsdPerChain,
|
|
24050
24160
|
showOriginalRecipient,
|
|
24051
24161
|
estPriceImpact: showOriginalRecipient ? void 0 : estPriceImpact,
|
|
24052
|
-
maxSlippage: showOriginalRecipient ? void 0 : maxSlippage
|
|
24162
|
+
maxSlippage: showOriginalRecipient ? void 0 : maxSlippage,
|
|
24163
|
+
qrCodeUri,
|
|
24164
|
+
blockchain: blockchainType
|
|
24053
24165
|
};
|
|
24054
24166
|
};
|
|
24055
24167
|
var useMinTransferLimits = () => {
|
|
24056
24168
|
const { userIpInfo } = useFunkitUserIp();
|
|
24057
|
-
const minTransferValueJsonString = useFlag(
|
|
24169
|
+
const minTransferValueJsonString = useFlag(FlagKey26.MinTokenTransferValue);
|
|
24058
24170
|
const minTransferValue = safeJSONParse(
|
|
24059
24171
|
minTransferValueJsonString
|
|
24060
24172
|
);
|
|
@@ -24065,9 +24177,13 @@ var useMinTransferLimits = () => {
|
|
|
24065
24177
|
const limits = minTransferValue[transferLimitKey] ?? minTransferValue.DEFAULT;
|
|
24066
24178
|
return limits;
|
|
24067
24179
|
};
|
|
24180
|
+
function getMinTransferValueForChain(chainId, limits) {
|
|
24181
|
+
const MAINNET_IDS = [mainnet9.id, bitcoinChain2.id];
|
|
24182
|
+
return MAINNET_IDS.includes(chainId) ? limits.mainnet : limits.nonMainnet;
|
|
24183
|
+
}
|
|
24068
24184
|
var useMinTransferValue = (selectedChainId) => {
|
|
24069
24185
|
const limits = useMinTransferLimits();
|
|
24070
|
-
const limit = selectedChainId
|
|
24186
|
+
const limit = getMinTransferValueForChain(selectedChainId, limits);
|
|
24071
24187
|
return Math.ceil(limit);
|
|
24072
24188
|
};
|
|
24073
24189
|
var useMinTransferValues = (chainIds) => {
|
|
@@ -24075,13 +24191,13 @@ var useMinTransferValues = (chainIds) => {
|
|
|
24075
24191
|
return useMemo30(() => {
|
|
24076
24192
|
return chainIds.reduce(
|
|
24077
24193
|
(acc, id) => {
|
|
24078
|
-
const limit = id
|
|
24194
|
+
const limit = getMinTransferValueForChain(id, limits);
|
|
24079
24195
|
acc[id] = Math.ceil(limit);
|
|
24080
24196
|
return acc;
|
|
24081
24197
|
},
|
|
24082
24198
|
{}
|
|
24083
24199
|
);
|
|
24084
|
-
}, [chainIds, limits
|
|
24200
|
+
}, [chainIds, limits]);
|
|
24085
24201
|
};
|
|
24086
24202
|
var usePriceImpactEstimation = (selectedToken) => {
|
|
24087
24203
|
const { apiKey } = useFunkitConfig();
|
|
@@ -24155,7 +24271,9 @@ function TransferToken({
|
|
|
24155
24271
|
minTransferUsd,
|
|
24156
24272
|
minTransferUsdPerChain,
|
|
24157
24273
|
estPriceImpact,
|
|
24158
|
-
maxSlippage
|
|
24274
|
+
maxSlippage,
|
|
24275
|
+
qrCodeUri,
|
|
24276
|
+
blockchain
|
|
24159
24277
|
} = useTokenTransfer(selectedChainId, selectedToken, chainIds);
|
|
24160
24278
|
const isDefiMode = checkoutItem?.initSettings.config.isDefiMode;
|
|
24161
24279
|
const toggleQrHover = async () => {
|
|
@@ -24336,7 +24454,7 @@ function TransferToken({
|
|
|
24336
24454
|
logoSize: 24,
|
|
24337
24455
|
logoUrl: chainMetadataById[selectedChainId].iconUrl,
|
|
24338
24456
|
size: 152,
|
|
24339
|
-
uri:
|
|
24457
|
+
uri: qrCodeUri ?? "",
|
|
24340
24458
|
enableCornerMarkersRadius: false,
|
|
24341
24459
|
enableOuterBorder: false
|
|
24342
24460
|
}
|
|
@@ -24381,7 +24499,13 @@ function TransferToken({
|
|
|
24381
24499
|
size: "12"
|
|
24382
24500
|
}
|
|
24383
24501
|
)
|
|
24384
|
-
), isLoadingDepositAddress ? /* @__PURE__ */ React189.createElement(FunSkeletonBlock, { height: "66", width: "full" }) : /* @__PURE__ */ React189.createElement(CopyInputDisplayedAddress, { address: depositAddress })), /* @__PURE__ */ React189.createElement(FunInfoBanner, null), /* @__PURE__ */ React189.createElement(
|
|
24502
|
+
), isLoadingDepositAddress ? /* @__PURE__ */ React189.createElement(FunSkeletonBlock, { height: "66", width: "full" }) : /* @__PURE__ */ React189.createElement(CopyInputDisplayedAddress, { address: depositAddress })), /* @__PURE__ */ React189.createElement(FunInfoBanner, null), blockchain === "bitcoin" && /* @__PURE__ */ React189.createElement(
|
|
24503
|
+
InfoBanner,
|
|
24504
|
+
{
|
|
24505
|
+
message: "Bitcoin deposits might take up to 30 minutes to complete.",
|
|
24506
|
+
type: "announcement"
|
|
24507
|
+
}
|
|
24508
|
+
), /* @__PURE__ */ React189.createElement(FunInfoBanner, null), /* @__PURE__ */ React189.createElement(
|
|
24385
24509
|
TransferTokenDetails,
|
|
24386
24510
|
{
|
|
24387
24511
|
disabled: isLoadingDepositAddress,
|
|
@@ -28664,7 +28788,7 @@ function ChainModal({ onClose, open }) {
|
|
|
28664
28788
|
// src/modals/CheckoutModal/FunCheckoutModal.tsx
|
|
28665
28789
|
import { FUNKIT_CONNECT_SUPPORTED_CHECKOUT_CHAINS_INFO_LIST as FUNKIT_CONNECT_SUPPORTED_CHECKOUT_CHAINS_INFO_LIST3 } from "@funkit/chains";
|
|
28666
28790
|
import { LogLevel, initializeRelayClient } from "@funkit/fun-relay";
|
|
28667
|
-
import { FlagKey as
|
|
28791
|
+
import { FlagKey as FlagKey28 } from "@funkit/utils";
|
|
28668
28792
|
import React248, { useRef as useRef27 } from "react";
|
|
28669
28793
|
|
|
28670
28794
|
// src/components/FunCheckoutBlocked/FunCheckoutBlocked.tsx
|
|
@@ -28733,13 +28857,13 @@ var FunNotificationShowMoreButton = ({
|
|
|
28733
28857
|
import {
|
|
28734
28858
|
getCheckoutsByUserId as getCheckoutsByUserId2
|
|
28735
28859
|
} from "@funkit/api-base";
|
|
28736
|
-
import { FlagKey as
|
|
28860
|
+
import { FlagKey as FlagKey27 } from "@funkit/utils";
|
|
28737
28861
|
import { useQuery as useQuery17 } from "@tanstack/react-query";
|
|
28738
28862
|
var hasCorrectPaymentMethod = (checkout, paymentMethod) => !paymentMethod || checkout.clientMetadata.selectedPaymentMethodInfo?.paymentMethod === paymentMethod;
|
|
28739
28863
|
var isRecent = (checkout, timestampCutoff) => checkout.createdTimeMs > timestampCutoff;
|
|
28740
28864
|
var DEFAULT_NOTIF_CUTOFF = 7 * 24 * 60 * 60 * 1e3;
|
|
28741
28865
|
function useCheckoutRefreshInterval() {
|
|
28742
|
-
const str = useFlag(
|
|
28866
|
+
const str = useFlag(FlagKey27.CheckoutNotificationsRefreshInterval);
|
|
28743
28867
|
return safeJSONParse(str) || { listRefresh: 50 * 1e3, itemRefresh: 5 * 1e3 };
|
|
28744
28868
|
}
|
|
28745
28869
|
var useRecentCheckouts = ({
|
|
@@ -29907,7 +30031,7 @@ function FunCheckoutModalInner({
|
|
|
29907
30031
|
const isBlocked = isUserGeoblocked || modalState.isBlocked;
|
|
29908
30032
|
const hasBack = hasHistoryEntry && !disableBack;
|
|
29909
30033
|
const checkoutConfig = checkoutItem.initSettings.config;
|
|
29910
|
-
const helpButtonUrl = useFlag(
|
|
30034
|
+
const helpButtonUrl = useFlag(FlagKey28.HelpTutorialUrl);
|
|
29911
30035
|
const { onScroll, topbar, withTopDivider } = useCustomStatusAnimationAboveTopbar({
|
|
29912
30036
|
depositAddress: checkoutItem.depositAddress ?? void 0,
|
|
29913
30037
|
isActiveCheckout: true,
|
|
@@ -31800,18 +31924,18 @@ function cssStringFromTheme(theme, options = {}) {
|
|
|
31800
31924
|
}
|
|
31801
31925
|
|
|
31802
31926
|
// src/hooks/useIsFunkitCheckoutActivated.ts
|
|
31803
|
-
import { FlagKey as
|
|
31927
|
+
import { FlagKey as FlagKey29 } from "@funkit/utils";
|
|
31804
31928
|
var useIsFunkitCheckoutActivated = () => {
|
|
31805
|
-
const isCheckoutActivated = useFlag(
|
|
31929
|
+
const isCheckoutActivated = useFlag(FlagKey29.IsCheckoutActivated);
|
|
31806
31930
|
return {
|
|
31807
31931
|
isActivated: isCheckoutActivated
|
|
31808
31932
|
};
|
|
31809
31933
|
};
|
|
31810
31934
|
|
|
31811
31935
|
// src/hooks/useFunkitMaxCheckoutUsdInfo.ts
|
|
31812
|
-
import { FlagKey as
|
|
31936
|
+
import { FlagKey as FlagKey30, formatCurrencyAndStringify as formatCurrencyAndStringify16 } from "@funkit/utils";
|
|
31813
31937
|
var useFunkitMaxCheckoutUsdInfo = () => {
|
|
31814
|
-
const maxCheckoutUsd = Number(useFlag(
|
|
31938
|
+
const maxCheckoutUsd = Number(useFlag(FlagKey30.MaxCheckoutUsd));
|
|
31815
31939
|
const limitText = maxCheckoutUsd === Number.MAX_VALUE ? "no" : formatCurrencyAndStringify16(maxCheckoutUsd, {
|
|
31816
31940
|
decimalPrecisionForSuffix: 0,
|
|
31817
31941
|
minimumSignificantDigits: 0,
|
|
@@ -31928,7 +32052,7 @@ function setFunkitConnectVersion({ version }) {
|
|
|
31928
32052
|
localStorage.setItem(storageKey5, version);
|
|
31929
32053
|
}
|
|
31930
32054
|
function getCurrentSdkVersion() {
|
|
31931
|
-
return "6.
|
|
32055
|
+
return "6.10.0";
|
|
31932
32056
|
}
|
|
31933
32057
|
function useFingerprint() {
|
|
31934
32058
|
const fingerprint = useCallback51(() => {
|