@orderly.network/wallet-connector-privy 2.7.4 → 2.8.0-alpha.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 +62 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +63 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +9 -9
package/dist/index.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import { defineChain } from 'viem';
|
|
|
4
4
|
import { mainnet, abstract, abstractTestnet } from 'viem/chains';
|
|
5
5
|
import { useWalletConnector, useAccount, useSWR, fetcher, WalletConnectorContext, useTrack, useStorageLedgerAddress, useLocalStorage, useStorageChain } from '@orderly.network/hooks';
|
|
6
6
|
import { SOLANA_TESTNET_CHAINID, SOLANA_MAINNET_CHAINID, ChainNamespace, TesntTokenFallback, ArbitrumSepoliaTokenInfo, SolanaDevnetTokenInfo, ABSTRACT_CHAIN_ID_MAP, AccountStatusEnum, ABSTRACT_TESTNET_CHAINID, ABSTRACT_MAINNET_CHAINID, SolanaChains as SolanaChains$1, AbstractChains, ArbitrumSepoliaChainInfo, SolanaDevnetChainInfo, EMPTY_OBJECT, TrackerEventName, ConnectorKey } from '@orderly.network/types';
|
|
7
|
-
import { modal, useModal, SimpleSheet, SheetHeader, Text, Flex, Divider, cn, installExtension, ExtensionPositionEnum, useScreen, formatAddress, Button, SimpleDialog, TooltipProvider,
|
|
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 '@orderly.network/ui';
|
|
8
8
|
import { useTranslation, Trans } from '@orderly.network/i18n';
|
|
9
9
|
import { AbstractWalletProvider as AbstractWalletProvider$1, useLoginWithAbstract, useAbstractClient, useGlobalWalletSignerAccount } from '@abstract-foundation/agw-react';
|
|
10
10
|
import * as WagmiExport from 'wagmi';
|
|
@@ -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,
|
|
@@ -1320,7 +1322,7 @@ var RenderLoginMethodsDom = ({
|
|
|
1320
1322
|
{
|
|
1321
1323
|
className: cn(
|
|
1322
1324
|
"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
|
-
|
|
1325
|
+
"oui-border-none oui-bg-[#333948]"
|
|
1324
1326
|
),
|
|
1325
1327
|
onClick: () => connect({ walletType: "privy", extraType: "email" })
|
|
1326
1328
|
},
|
|
@@ -1331,7 +1333,7 @@ var RenderLoginMethodsDom = ({
|
|
|
1331
1333
|
className: "oui-size-[18px]"
|
|
1332
1334
|
}
|
|
1333
1335
|
),
|
|
1334
|
-
|
|
1336
|
+
/* @__PURE__ */ React19.createElement("div", { className: "oui-text-2xs oui-text-base-contrast" }, t("connector.privy.email"))
|
|
1335
1337
|
)
|
|
1336
1338
|
);
|
|
1337
1339
|
}
|
|
@@ -1342,7 +1344,7 @@ var RenderLoginMethodsDom = ({
|
|
|
1342
1344
|
{
|
|
1343
1345
|
className: cn(
|
|
1344
1346
|
"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
|
-
|
|
1347
|
+
"oui-border-none oui-bg-[#335FFC]"
|
|
1346
1348
|
),
|
|
1347
1349
|
onClick: () => connect({ walletType: "privy", extraType: "google" })
|
|
1348
1350
|
},
|
|
@@ -1353,7 +1355,7 @@ var RenderLoginMethodsDom = ({
|
|
|
1353
1355
|
className: "oui-size-[18px]"
|
|
1354
1356
|
}
|
|
1355
1357
|
),
|
|
1356
|
-
|
|
1358
|
+
/* @__PURE__ */ React19.createElement("div", { className: "oui-text-2xs oui-text-base-contrast" }, t("connector.privy.google"))
|
|
1357
1359
|
)
|
|
1358
1360
|
);
|
|
1359
1361
|
}
|
|
@@ -1364,7 +1366,7 @@ var RenderLoginMethodsDom = ({
|
|
|
1364
1366
|
{
|
|
1365
1367
|
className: cn(
|
|
1366
1368
|
"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
|
-
|
|
1369
|
+
"oui-border-none oui-bg-[#07080A]"
|
|
1368
1370
|
),
|
|
1369
1371
|
onClick: () => connect({ walletType: "privy", extraType: "twitter" })
|
|
1370
1372
|
},
|
|
@@ -1375,7 +1377,39 @@ var RenderLoginMethodsDom = ({
|
|
|
1375
1377
|
className: "oui-size-[18px]"
|
|
1376
1378
|
}
|
|
1377
1379
|
),
|
|
1378
|
-
|
|
1380
|
+
/* @__PURE__ */ React19.createElement("div", { className: "oui-text-2xs oui-text-base-contrast" }, t("connector.privy.twitter"))
|
|
1381
|
+
)
|
|
1382
|
+
);
|
|
1383
|
+
}
|
|
1384
|
+
if (loginMethods?.includes("telegram")) {
|
|
1385
|
+
arr.push(
|
|
1386
|
+
/* @__PURE__ */ React19.createElement(
|
|
1387
|
+
"div",
|
|
1388
|
+
{
|
|
1389
|
+
className: cn(
|
|
1390
|
+
"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]",
|
|
1391
|
+
"oui-border-none oui-bg-[#3D79A9]"
|
|
1392
|
+
),
|
|
1393
|
+
onClick: () => connect({ walletType: "privy", extraType: "telegram" })
|
|
1394
|
+
},
|
|
1395
|
+
/* @__PURE__ */ React19.createElement(
|
|
1396
|
+
"svg",
|
|
1397
|
+
{
|
|
1398
|
+
width: "18",
|
|
1399
|
+
height: "18",
|
|
1400
|
+
viewBox: "0 0 18 18",
|
|
1401
|
+
fill: "none",
|
|
1402
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
1403
|
+
},
|
|
1404
|
+
/* @__PURE__ */ React19.createElement(
|
|
1405
|
+
"path",
|
|
1406
|
+
{
|
|
1407
|
+
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",
|
|
1408
|
+
fill: "white"
|
|
1409
|
+
}
|
|
1410
|
+
)
|
|
1411
|
+
),
|
|
1412
|
+
/* @__PURE__ */ React19.createElement("div", { className: "oui-text-2xs oui-text-base-contrast" }, t("connector.privy.telegram"))
|
|
1379
1413
|
)
|
|
1380
1414
|
);
|
|
1381
1415
|
}
|
|
@@ -1390,7 +1424,7 @@ var PrivyConnectAreaMobile = ({
|
|
|
1390
1424
|
const { isMobile, isDesktop } = useScreen();
|
|
1391
1425
|
const { connectorWalletType, privyConfig } = useWalletConnectorPrivy();
|
|
1392
1426
|
const loginMethods = privyConfig.loginMethods;
|
|
1393
|
-
return /* @__PURE__ */ React19.createElement(Flex, { direction: "column", className: "oui-w-full" }, /* @__PURE__ */ React19.createElement(Grid, { cols:
|
|
1427
|
+
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
1428
|
};
|
|
1395
1429
|
var PrivyConnectAreaDesktop = ({
|
|
1396
1430
|
connect
|
|
@@ -1441,6 +1475,25 @@ function RenderPrivyTypeIcon({
|
|
|
1441
1475
|
}
|
|
1442
1476
|
);
|
|
1443
1477
|
}
|
|
1478
|
+
if (type === "telegram") {
|
|
1479
|
+
return /* @__PURE__ */ React19.createElement(
|
|
1480
|
+
"svg",
|
|
1481
|
+
{
|
|
1482
|
+
width: size,
|
|
1483
|
+
height: size,
|
|
1484
|
+
viewBox: "0 0 18 18",
|
|
1485
|
+
fill: "none",
|
|
1486
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
1487
|
+
},
|
|
1488
|
+
/* @__PURE__ */ React19.createElement(
|
|
1489
|
+
"path",
|
|
1490
|
+
{
|
|
1491
|
+
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",
|
|
1492
|
+
fill: black ? "black" : "white"
|
|
1493
|
+
}
|
|
1494
|
+
)
|
|
1495
|
+
);
|
|
1496
|
+
}
|
|
1444
1497
|
return /* @__PURE__ */ React19.createElement(
|
|
1445
1498
|
"img",
|
|
1446
1499
|
{
|
|
@@ -2564,7 +2617,7 @@ function ConnectDrawer(props) {
|
|
|
2564
2617
|
}
|
|
2565
2618
|
),
|
|
2566
2619
|
/* @__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
|
-
|
|
2620
|
+
CloseSquareFillIcon,
|
|
2568
2621
|
{
|
|
2569
2622
|
className: "oui-size-5 oui-cursor-pointer oui-text-base-contrast-20 hover:oui-text-base-contrast-80",
|
|
2570
2623
|
onClick: () => props.onChangeOpen(false)
|
|
@@ -3214,7 +3267,7 @@ function WalletConnectorPrivyProvider(props) {
|
|
|
3214
3267
|
}, [initChains]);
|
|
3215
3268
|
const { data: swapChainInfoRes, isLoading: swapLoading } = useSWR(
|
|
3216
3269
|
!props.customChains && props.enableSwapDeposit ? "https://fi-api.woo.org/swap_support" : null,
|
|
3217
|
-
|
|
3270
|
+
(url) => fetch(url).then((res) => res.json()),
|
|
3218
3271
|
commonSwrOpts
|
|
3219
3272
|
);
|
|
3220
3273
|
const { data: mainnetChainInfos } = useSWR(
|