@kodiak-finance/orderly-wallet-connector-privy 2.8.18 → 2.8.19-rc.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/README.md +8 -0
- package/dist/index.js +168 -52
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +171 -55
- package/dist/index.mjs.map +1 -1
- package/package.json +9 -9
package/dist/index.mjs
CHANGED
|
@@ -2,9 +2,9 @@ import React19, { createContext, useState, useEffect, useMemo, useContext, useRe
|
|
|
2
2
|
import * as viemExport from 'viem';
|
|
3
3
|
import { defineChain } from 'viem';
|
|
4
4
|
import { mainnet, abstract, abstractTestnet } from 'viem/chains';
|
|
5
|
-
import { useWalletConnector, useAccount,
|
|
6
|
-
import { SOLANA_TESTNET_CHAINID, SOLANA_MAINNET_CHAINID, ChainNamespace,
|
|
7
|
-
import { modal, useModal, SimpleSheet, SheetHeader, Text, Flex, Divider, cn, installExtension, ExtensionPositionEnum, useScreen, formatAddress, Button, SimpleDialog, TooltipProvider,
|
|
5
|
+
import { useWalletConnector, useAccount, useMainnetChainsStore, useTestnetChainsStore, useSwapSupportStore, WalletConnectorContext, useTrack, useStorageLedgerAddress, useLocalStorage, useStorageChain } from '@kodiak-finance/orderly-hooks';
|
|
6
|
+
import { SOLANA_TESTNET_CHAINID, SOLANA_MAINNET_CHAINID, ChainNamespace, ABSTRACT_CHAIN_ID_MAP, AccountStatusEnum, ABSTRACT_TESTNET_CHAINID, ABSTRACT_MAINNET_CHAINID, SolanaChains as SolanaChains$1, AbstractChains, ArbitrumSepoliaChainInfo, SolanaDevnetChainInfo, EMPTY_OBJECT, TrackerEventName, ConnectorKey } from '@kodiak-finance/orderly-types';
|
|
7
|
+
import { modal, useModal, SimpleSheet, SheetHeader, Text, Flex, Divider, cn, installExtension, ExtensionPositionEnum, useScreen, formatAddress, Button, SimpleDialog, TooltipProvider, CloseSquareFillIcon, ScrollArea, ExclamationFillIcon, Tooltip, CopyIcon, Checkbox, toast, DropdownMenuRoot, DropdownMenuTrigger, DropdownMenuPortal, DropdownMenuContent, DropdownMenuItem, ChevronDownIcon, ChevronUpIcon, Grid, ChainIcon, Popover } from '@kodiak-finance/orderly-ui';
|
|
8
8
|
import { useTranslation, Trans } from '@kodiak-finance/orderly-i18n';
|
|
9
9
|
import { AbstractWalletProvider as AbstractWalletProvider$1, useLoginWithAbstract, useAbstractClient, useGlobalWalletSignerAccount } from '@abstract-foundation/agw-react';
|
|
10
10
|
import * as WagmiExport from 'wagmi';
|
|
@@ -25,11 +25,11 @@ var Network = /* @__PURE__ */ ((Network3) => {
|
|
|
25
25
|
Network3["testnet"] = "testnet";
|
|
26
26
|
return Network3;
|
|
27
27
|
})(Network || {});
|
|
28
|
-
var WalletType = /* @__PURE__ */ ((
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
return
|
|
28
|
+
var WalletType = /* @__PURE__ */ ((WalletType4) => {
|
|
29
|
+
WalletType4["EVM"] = "EVM";
|
|
30
|
+
WalletType4["SOL"] = "SOL";
|
|
31
|
+
WalletType4["ABSTRACT"] = "Abstract";
|
|
32
|
+
return WalletType4;
|
|
33
33
|
})(WalletType || {});
|
|
34
34
|
var WalletConnectType = /* @__PURE__ */ ((WalletConnectType2) => {
|
|
35
35
|
WalletConnectType2["EVM"] = "EVM";
|
|
@@ -207,6 +207,8 @@ var PrivyWalletProvider = ({
|
|
|
207
207
|
address = `@${account.username}`;
|
|
208
208
|
} else if (account.type === "google_oauth") {
|
|
209
209
|
address = `@${account.name}`;
|
|
210
|
+
} else if (account.type === "telegram") {
|
|
211
|
+
address = `@${account.username}`;
|
|
210
212
|
}
|
|
211
213
|
return {
|
|
212
214
|
type: account.type,
|
|
@@ -1106,6 +1108,7 @@ function useWallet2() {
|
|
|
1106
1108
|
if (chainType === "SOL" /* SOL */) {
|
|
1107
1109
|
if (isConnectedSOL && walletSOL) {
|
|
1108
1110
|
setStorageChain(parseInt(chain.chainId));
|
|
1111
|
+
return Promise.resolve(true);
|
|
1109
1112
|
} else {
|
|
1110
1113
|
setOpenConnectDrawer(true);
|
|
1111
1114
|
setTargetWalletType("SOL" /* SOL */);
|
|
@@ -1320,7 +1323,7 @@ var RenderLoginMethodsDom = ({
|
|
|
1320
1323
|
{
|
|
1321
1324
|
className: cn(
|
|
1322
1325
|
"oui-flex oui-cursor-pointer oui-items-center oui-justify-center oui-gap-1 oui-rounded-[6px] oui-border oui-border-base-contrast-12 oui-px-2 oui-py-[11px]",
|
|
1323
|
-
|
|
1326
|
+
"oui-border-none oui-bg-[#333948]"
|
|
1324
1327
|
),
|
|
1325
1328
|
onClick: () => connect({ walletType: "privy", extraType: "email" })
|
|
1326
1329
|
},
|
|
@@ -1331,7 +1334,7 @@ var RenderLoginMethodsDom = ({
|
|
|
1331
1334
|
className: "oui-size-[18px]"
|
|
1332
1335
|
}
|
|
1333
1336
|
),
|
|
1334
|
-
|
|
1337
|
+
/* @__PURE__ */ React19.createElement("div", { className: "oui-text-2xs oui-text-base-contrast" }, t("connector.privy.email"))
|
|
1335
1338
|
)
|
|
1336
1339
|
);
|
|
1337
1340
|
}
|
|
@@ -1342,7 +1345,7 @@ var RenderLoginMethodsDom = ({
|
|
|
1342
1345
|
{
|
|
1343
1346
|
className: cn(
|
|
1344
1347
|
"oui-flex oui-cursor-pointer oui-items-center oui-justify-center oui-gap-1 oui-rounded-[6px] oui-border oui-border-base-contrast-12 oui-px-2 oui-py-[11px]",
|
|
1345
|
-
|
|
1348
|
+
"oui-border-none oui-bg-[#335FFC]"
|
|
1346
1349
|
),
|
|
1347
1350
|
onClick: () => connect({ walletType: "privy", extraType: "google" })
|
|
1348
1351
|
},
|
|
@@ -1353,7 +1356,7 @@ var RenderLoginMethodsDom = ({
|
|
|
1353
1356
|
className: "oui-size-[18px]"
|
|
1354
1357
|
}
|
|
1355
1358
|
),
|
|
1356
|
-
|
|
1359
|
+
/* @__PURE__ */ React19.createElement("div", { className: "oui-text-2xs oui-text-base-contrast" }, t("connector.privy.google"))
|
|
1357
1360
|
)
|
|
1358
1361
|
);
|
|
1359
1362
|
}
|
|
@@ -1364,7 +1367,7 @@ var RenderLoginMethodsDom = ({
|
|
|
1364
1367
|
{
|
|
1365
1368
|
className: cn(
|
|
1366
1369
|
"oui-flex oui-cursor-pointer oui-items-center oui-justify-center oui-gap-1 oui-rounded-[6px] oui-border oui-border-base-contrast-12 oui-px-2 oui-py-[11px]",
|
|
1367
|
-
|
|
1370
|
+
"oui-border-none oui-bg-[#07080A]"
|
|
1368
1371
|
),
|
|
1369
1372
|
onClick: () => connect({ walletType: "privy", extraType: "twitter" })
|
|
1370
1373
|
},
|
|
@@ -1375,7 +1378,39 @@ var RenderLoginMethodsDom = ({
|
|
|
1375
1378
|
className: "oui-size-[18px]"
|
|
1376
1379
|
}
|
|
1377
1380
|
),
|
|
1378
|
-
|
|
1381
|
+
/* @__PURE__ */ React19.createElement("div", { className: "oui-text-2xs oui-text-base-contrast" }, t("connector.privy.twitter"))
|
|
1382
|
+
)
|
|
1383
|
+
);
|
|
1384
|
+
}
|
|
1385
|
+
if (loginMethods?.includes("telegram")) {
|
|
1386
|
+
arr.push(
|
|
1387
|
+
/* @__PURE__ */ React19.createElement(
|
|
1388
|
+
"div",
|
|
1389
|
+
{
|
|
1390
|
+
className: cn(
|
|
1391
|
+
"oui-flex oui-cursor-pointer oui-items-center oui-justify-center oui-gap-1 oui-rounded-[6px] oui-border oui-border-base-contrast-12 oui-px-2 oui-py-[11px]",
|
|
1392
|
+
"oui-border-none oui-bg-[#3D79A9]"
|
|
1393
|
+
),
|
|
1394
|
+
onClick: () => connect({ walletType: "privy", extraType: "telegram" })
|
|
1395
|
+
},
|
|
1396
|
+
/* @__PURE__ */ React19.createElement(
|
|
1397
|
+
"svg",
|
|
1398
|
+
{
|
|
1399
|
+
width: "18",
|
|
1400
|
+
height: "18",
|
|
1401
|
+
viewBox: "0 0 18 18",
|
|
1402
|
+
fill: "none",
|
|
1403
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
1404
|
+
},
|
|
1405
|
+
/* @__PURE__ */ React19.createElement(
|
|
1406
|
+
"path",
|
|
1407
|
+
{
|
|
1408
|
+
d: "M2.652 8.12916L15.0683 4.04929C15.6468 3.87358 16.1499 4.16929 15.9587 4.91069L13.8458 13.3962C13.6898 13.9961 13.2672 14.1461 12.6836 13.859L9.46384 11.8362L7.90929 13.109C7.73824 13.2547 7.59234 13.379 7.2603 13.379L7.4867 10.5891L13.4584 5.99923C13.72 5.80638 13.398 5.69495 13.0559 5.8878L5.68061 9.8434L2.50107 8.99914C1.81687 8.81058 1.80178 8.41201 2.652 8.12916Z",
|
|
1409
|
+
fill: "white"
|
|
1410
|
+
}
|
|
1411
|
+
)
|
|
1412
|
+
),
|
|
1413
|
+
/* @__PURE__ */ React19.createElement("div", { className: "oui-text-2xs oui-text-base-contrast" }, t("connector.privy.telegram"))
|
|
1379
1414
|
)
|
|
1380
1415
|
);
|
|
1381
1416
|
}
|
|
@@ -1390,7 +1425,7 @@ var PrivyConnectAreaMobile = ({
|
|
|
1390
1425
|
const { isMobile, isDesktop } = useScreen();
|
|
1391
1426
|
const { connectorWalletType, privyConfig } = useWalletConnectorPrivy();
|
|
1392
1427
|
const loginMethods = privyConfig.loginMethods;
|
|
1393
|
-
return /* @__PURE__ */ React19.createElement(Flex, { direction: "column", className: "oui-w-full" }, /* @__PURE__ */ React19.createElement(Grid, { cols:
|
|
1428
|
+
return /* @__PURE__ */ React19.createElement(Flex, { direction: "column", className: "oui-w-full" }, /* @__PURE__ */ React19.createElement(Grid, { cols: 2, rows: 2, className: "oui-w-full", gap: 2 }, /* @__PURE__ */ React19.createElement(RenderLoginMethodsDom, { connect, loginMethods })), (!connectorWalletType.disableWagmi || !connectorWalletType.disableSolana) && /* @__PURE__ */ React19.createElement("div", { className: "oui-mt-4 oui-h-px oui-w-full oui-bg-line md:oui-mt-5" }));
|
|
1394
1429
|
};
|
|
1395
1430
|
var PrivyConnectAreaDesktop = ({
|
|
1396
1431
|
connect
|
|
@@ -1441,6 +1476,25 @@ function RenderPrivyTypeIcon({
|
|
|
1441
1476
|
}
|
|
1442
1477
|
);
|
|
1443
1478
|
}
|
|
1479
|
+
if (type === "telegram") {
|
|
1480
|
+
return /* @__PURE__ */ React19.createElement(
|
|
1481
|
+
"svg",
|
|
1482
|
+
{
|
|
1483
|
+
width: size,
|
|
1484
|
+
height: size,
|
|
1485
|
+
viewBox: "0 0 18 18",
|
|
1486
|
+
fill: "none",
|
|
1487
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
1488
|
+
},
|
|
1489
|
+
/* @__PURE__ */ React19.createElement(
|
|
1490
|
+
"path",
|
|
1491
|
+
{
|
|
1492
|
+
d: "M2.652 8.12916L15.0683 4.04929C15.6468 3.87358 16.1499 4.16929 15.9587 4.91069L13.8458 13.3962C13.6898 13.9961 13.2672 14.1461 12.6836 13.859L9.46384 11.8362L7.90929 13.109C7.73824 13.2547 7.59234 13.379 7.2603 13.379L7.4867 10.5891L13.4584 5.99923C13.72 5.80638 13.398 5.69495 13.0559 5.8878L5.68061 9.8434L2.50107 8.99914C1.81687 8.81058 1.80178 8.41201 2.652 8.12916Z",
|
|
1493
|
+
fill: black ? "black" : "white"
|
|
1494
|
+
}
|
|
1495
|
+
)
|
|
1496
|
+
);
|
|
1497
|
+
}
|
|
1444
1498
|
return /* @__PURE__ */ React19.createElement(
|
|
1445
1499
|
"img",
|
|
1446
1500
|
{
|
|
@@ -1569,7 +1623,24 @@ function EVMConnectArea({
|
|
|
1569
1623
|
// src/components/renderConnector/index.tsx
|
|
1570
1624
|
function RenderConnector() {
|
|
1571
1625
|
const { connect } = useWallet2();
|
|
1572
|
-
const {
|
|
1626
|
+
const {
|
|
1627
|
+
setOpenConnectDrawer,
|
|
1628
|
+
connectorWalletType,
|
|
1629
|
+
walletChainTypeConfig,
|
|
1630
|
+
targetWalletType
|
|
1631
|
+
} = useWalletConnectorPrivy();
|
|
1632
|
+
const { storageChain } = useStorageChain();
|
|
1633
|
+
const selectedWalletType = (() => {
|
|
1634
|
+
if (targetWalletType)
|
|
1635
|
+
return targetWalletType;
|
|
1636
|
+
if (!storageChain?.chainId)
|
|
1637
|
+
return void 0;
|
|
1638
|
+
try {
|
|
1639
|
+
return getChainType(parseInt(storageChain.chainId));
|
|
1640
|
+
} catch {
|
|
1641
|
+
return void 0;
|
|
1642
|
+
}
|
|
1643
|
+
})();
|
|
1573
1644
|
const handleConnect = (params) => {
|
|
1574
1645
|
connect(params);
|
|
1575
1646
|
if (params.walletType === "privy" /* PRIVY */) {
|
|
@@ -1638,7 +1709,30 @@ function RenderConnector() {
|
|
|
1638
1709
|
}
|
|
1639
1710
|
);
|
|
1640
1711
|
};
|
|
1641
|
-
|
|
1712
|
+
const walletOrder = ["evm", "sol", "abstract"];
|
|
1713
|
+
const typeToKey = {
|
|
1714
|
+
["EVM" /* EVM */]: "evm",
|
|
1715
|
+
["SOL" /* SOL */]: "sol",
|
|
1716
|
+
["Abstract" /* ABSTRACT */]: "abstract"
|
|
1717
|
+
};
|
|
1718
|
+
const prioritizedKey = selectedWalletType ? typeToKey[selectedWalletType] : void 0;
|
|
1719
|
+
const orderedWalletKeys = prioritizedKey ? [
|
|
1720
|
+
prioritizedKey,
|
|
1721
|
+
...walletOrder.filter((k) => k !== prioritizedKey)
|
|
1722
|
+
] : walletOrder;
|
|
1723
|
+
const renderByKey = (key) => {
|
|
1724
|
+
switch (key) {
|
|
1725
|
+
case "evm":
|
|
1726
|
+
return renderWagmiConnectArea();
|
|
1727
|
+
case "sol":
|
|
1728
|
+
return renderSolanaConnectArea();
|
|
1729
|
+
case "abstract":
|
|
1730
|
+
return renderAbstractConnectArea();
|
|
1731
|
+
default:
|
|
1732
|
+
return null;
|
|
1733
|
+
}
|
|
1734
|
+
};
|
|
1735
|
+
return /* @__PURE__ */ React19.createElement(ScrollArea, { className: "oui-flex oui-grow oui-shrik oui-basis-auto oui-custom-scrollbar" }, /* @__PURE__ */ React19.createElement("div", { className: cn("oui-flex oui-flex-col oui-gap-4", "md:oui-gap-5") }, renderPrivyConnectArea(), orderedWalletKeys.map((key) => /* @__PURE__ */ React19.createElement(React19.Fragment, { key }, renderByKey(key)))));
|
|
1642
1736
|
}
|
|
1643
1737
|
function SwitchNetworkTips({
|
|
1644
1738
|
tipsContent
|
|
@@ -2564,7 +2658,7 @@ function ConnectDrawer(props) {
|
|
|
2564
2658
|
}
|
|
2565
2659
|
),
|
|
2566
2660
|
/* @__PURE__ */ React19.createElement("div", { className: "oui-relative oui-z-10 oui-flex oui-h-full oui-flex-col oui-gap-4 md:oui-gap-5" }, /* @__PURE__ */ React19.createElement("div", { className: "oui-flex oui-flex-none oui-items-center oui-justify-between" }, renderHeader(), /* @__PURE__ */ React19.createElement(
|
|
2567
|
-
|
|
2661
|
+
CloseSquareFillIcon,
|
|
2568
2662
|
{
|
|
2569
2663
|
className: "oui-size-5 oui-cursor-pointer oui-text-base-contrast-20 hover:oui-text-base-contrast-80",
|
|
2570
2664
|
onClick: () => props.onChangeOpen(false)
|
|
@@ -3070,19 +3164,6 @@ var WagmiWallet = (props) => {
|
|
|
3070
3164
|
};
|
|
3071
3165
|
|
|
3072
3166
|
// src/provider.tsx
|
|
3073
|
-
var commonSwrOpts = {
|
|
3074
|
-
revalidateIfStale: false,
|
|
3075
|
-
revalidateOnFocus: false,
|
|
3076
|
-
revalidateOnReconnect: false,
|
|
3077
|
-
// If false, undefined data gets cached against the key.
|
|
3078
|
-
revalidateOnMount: true,
|
|
3079
|
-
// don't duplicate a request with the same key for 1hr
|
|
3080
|
-
dedupingInterval: 36e5
|
|
3081
|
-
};
|
|
3082
|
-
TesntTokenFallback([
|
|
3083
|
-
ArbitrumSepoliaTokenInfo,
|
|
3084
|
-
SolanaDevnetTokenInfo
|
|
3085
|
-
]);
|
|
3086
3167
|
var testnetChainFallback = [ArbitrumSepoliaChainInfo, SolanaDevnetChainInfo];
|
|
3087
3168
|
var formatSwapChainInfo = (data = {}) => {
|
|
3088
3169
|
return Object.keys(data).map((key) => {
|
|
@@ -3167,7 +3248,22 @@ function WalletConnectorPrivyProvider(props) {
|
|
|
3167
3248
|
const [initChains, setInitChains] = useState([]);
|
|
3168
3249
|
const [mainnetChains, setMainnetChains] = useState([]);
|
|
3169
3250
|
const [testnetChains, setTestnetChains] = useState([]);
|
|
3170
|
-
const
|
|
3251
|
+
const [mainnetChainInfos, setMainnetChainInfos] = useState(null);
|
|
3252
|
+
const [testChainInfos, setTestChainInfos] = useState(
|
|
3253
|
+
null
|
|
3254
|
+
);
|
|
3255
|
+
const fetchMainChains = useMainnetChainsStore((state) => state.fetchData);
|
|
3256
|
+
const fetchTestChains = useTestnetChainsStore((state) => state.fetchData);
|
|
3257
|
+
const mainnetChainsHydrated = useMainnetChainsStore(
|
|
3258
|
+
(state) => state.hydrated
|
|
3259
|
+
);
|
|
3260
|
+
const testChainsHydrated = useTestnetChainsStore((state) => state.hydrated);
|
|
3261
|
+
const mainnetChainInfosFromStore = useMainnetChainsStore(
|
|
3262
|
+
(state) => state.data
|
|
3263
|
+
);
|
|
3264
|
+
const testChainInfosFromStore = useTestnetChainsStore((state) => state.data);
|
|
3265
|
+
const hasCustomChains = Array.isArray(props.customChains) && props.customChains.length > 0;
|
|
3266
|
+
const initRef = useRef(hasCustomChains);
|
|
3171
3267
|
const [openConnectDrawer, setOpenConnectDrawer] = useState(false);
|
|
3172
3268
|
const [targetWalletType, setTargetWalletType] = useState();
|
|
3173
3269
|
const [privyConfig, setPrivyConfig] = useState({
|
|
@@ -3212,24 +3308,29 @@ function WalletConnectorPrivyProvider(props) {
|
|
|
3212
3308
|
});
|
|
3213
3309
|
return chainTypeObj;
|
|
3214
3310
|
}, [initChains]);
|
|
3215
|
-
const {
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
);
|
|
3220
|
-
|
|
3221
|
-
!props.
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
);
|
|
3225
|
-
|
|
3226
|
-
!
|
|
3227
|
-
|
|
3228
|
-
{
|
|
3229
|
-
|
|
3230
|
-
fallbackData: testnetChainFallback
|
|
3311
|
+
const {
|
|
3312
|
+
data: swapChainInfoRes,
|
|
3313
|
+
// loading: swapLoading,
|
|
3314
|
+
fetchData: fetchSwapData
|
|
3315
|
+
} = useSwapSupportStore();
|
|
3316
|
+
useEffect(() => {
|
|
3317
|
+
if (!props.enableSwapDeposit || !!props.customChains)
|
|
3318
|
+
return;
|
|
3319
|
+
fetchSwapData();
|
|
3320
|
+
}, [props.enableSwapDeposit, props.customChains]);
|
|
3321
|
+
useEffect(() => {
|
|
3322
|
+
if (!mainnetChainsHydrated || !testChainsHydrated)
|
|
3323
|
+
return;
|
|
3324
|
+
if (Array.isArray(useMainnetChainsStore.getState().data) && useTestnetChainsStore.getState().data) {
|
|
3325
|
+
return;
|
|
3231
3326
|
}
|
|
3232
|
-
|
|
3327
|
+
fetchMainChains().then((data) => {
|
|
3328
|
+
setMainnetChainInfos(data);
|
|
3329
|
+
});
|
|
3330
|
+
fetchTestChains().then((data) => {
|
|
3331
|
+
setTestChainInfos(data);
|
|
3332
|
+
});
|
|
3333
|
+
}, [mainnetChainsHydrated, testChainsHydrated]);
|
|
3233
3334
|
const handleCustomerChains = () => {
|
|
3234
3335
|
const testChains = processChainInfo(
|
|
3235
3336
|
props.customChains.testnet?.map((item) => item.network_infos)
|
|
@@ -3312,21 +3413,33 @@ function WalletConnectorPrivyProvider(props) {
|
|
|
3312
3413
|
]
|
|
3313
3414
|
);
|
|
3314
3415
|
useEffect(() => {
|
|
3315
|
-
if (
|
|
3416
|
+
if (initRef.current)
|
|
3417
|
+
return;
|
|
3418
|
+
if (hasCustomChains) {
|
|
3316
3419
|
return;
|
|
3317
3420
|
}
|
|
3318
|
-
|
|
3421
|
+
const hasStoreData = mainnetChainInfosFromStore && testChainInfosFromStore;
|
|
3422
|
+
const hasApiData = mainnetChainInfos && testChainInfos;
|
|
3423
|
+
if (!hasStoreData && !hasApiData) {
|
|
3424
|
+
return;
|
|
3425
|
+
}
|
|
3426
|
+
if (props.enableSwapDeposit && !swapChainInfoRes) {
|
|
3319
3427
|
return;
|
|
3320
3428
|
}
|
|
3321
3429
|
let testChainsList = [];
|
|
3322
3430
|
let mainnetChainsList = [];
|
|
3323
3431
|
try {
|
|
3324
|
-
|
|
3325
|
-
|
|
3432
|
+
if (hasStoreData) {
|
|
3433
|
+
testChainsList = testChainInfosFromStore;
|
|
3434
|
+
mainnetChainsList = mainnetChainInfosFromStore;
|
|
3435
|
+
} else {
|
|
3436
|
+
testChainsList = testChainInfos || testnetChainFallback;
|
|
3437
|
+
mainnetChainsList = mainnetChainInfos || [];
|
|
3438
|
+
}
|
|
3326
3439
|
const testChains = processChainInfo(testChainsList);
|
|
3327
3440
|
const mainnetChains2 = processChainInfo(mainnetChainsList);
|
|
3328
3441
|
const swapChains = processChainInfo(
|
|
3329
|
-
formatSwapChainInfo(swapChainInfoRes
|
|
3442
|
+
formatSwapChainInfo(swapChainInfoRes || {})
|
|
3330
3443
|
);
|
|
3331
3444
|
const chains = [...testChains, ...mainnetChains2];
|
|
3332
3445
|
const filterSwapChains = swapChains.filter(
|
|
@@ -3344,8 +3457,11 @@ function WalletConnectorPrivyProvider(props) {
|
|
|
3344
3457
|
props.customChains,
|
|
3345
3458
|
mainnetChainInfos,
|
|
3346
3459
|
testChainInfos,
|
|
3460
|
+
mainnetChainInfosFromStore,
|
|
3461
|
+
testChainInfosFromStore,
|
|
3347
3462
|
swapChainInfoRes,
|
|
3348
|
-
|
|
3463
|
+
props.enableSwapDeposit
|
|
3464
|
+
// swapLoading,
|
|
3349
3465
|
]);
|
|
3350
3466
|
useEffect(() => {
|
|
3351
3467
|
if (props.customChains) {
|