adapter-connect 1.0.2 → 1.0.3
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/dist/index.js +123 -159
- package/package.json +13 -8
- package/dist/index.d.mts +0 -30
- package/dist/index.mjs +0 -661
package/dist/index.js
CHANGED
|
@@ -1,89 +1,54 @@
|
|
|
1
|
-
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
|
|
30
|
-
// index.tsx
|
|
31
|
-
var index_exports = {};
|
|
32
|
-
__export(index_exports, {
|
|
33
|
-
WhatWagmiProvider: () => WhatWagmiProvider,
|
|
34
|
-
useWalletConnect: () => useWalletConnect
|
|
35
|
-
});
|
|
36
|
-
module.exports = __toCommonJS(index_exports);
|
|
1
|
+
'use client';
|
|
37
2
|
|
|
38
3
|
// src/WhatWagmiProvider.tsx
|
|
39
|
-
|
|
40
|
-
|
|
4
|
+
import { WagmiProvider } from "wagmi";
|
|
5
|
+
import { PrivyProvider } from "@privy-io/react-auth";
|
|
41
6
|
|
|
42
7
|
// src/config.ts
|
|
43
|
-
|
|
44
|
-
|
|
8
|
+
import { createConfig, http, injected } from "wagmi";
|
|
9
|
+
import { base } from "viem/chains";
|
|
45
10
|
var createConnectors = () => {
|
|
46
|
-
return [
|
|
11
|
+
return [injected()];
|
|
47
12
|
};
|
|
48
|
-
var config =
|
|
49
|
-
chains: [
|
|
13
|
+
var config = createConfig({
|
|
14
|
+
chains: [base],
|
|
50
15
|
connectors: createConnectors(),
|
|
51
16
|
transports: {
|
|
52
|
-
[
|
|
17
|
+
[base.id]: http()
|
|
53
18
|
}
|
|
54
19
|
});
|
|
55
20
|
|
|
56
21
|
// src/ModalPrivyConnect.tsx
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
22
|
+
import React, { useEffect, useMemo as useMemo2 } from "react";
|
|
23
|
+
import { get } from "lodash";
|
|
24
|
+
import { createConnector } from "wagmi";
|
|
25
|
+
import { arbitrum, arbitrumSepolia } from "viem/chains";
|
|
61
26
|
|
|
62
27
|
// src/useWalletConnect.tsx
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
28
|
+
import { usePrivy, useWallets } from "@privy-io/react-auth";
|
|
29
|
+
import { useMemo } from "react";
|
|
30
|
+
import { useAccount, useConnect, useDisconnect } from "wagmi";
|
|
31
|
+
import { switchChain } from "@wagmi/core";
|
|
32
|
+
import { base as base2 } from "viem/chains";
|
|
68
33
|
var useWalletConnect = () => {
|
|
69
|
-
const { login, authenticated, user, logout, ready } =
|
|
70
|
-
const { connectors, connect } =
|
|
71
|
-
const { connectWallet } =
|
|
72
|
-
const { wallets } =
|
|
73
|
-
const { disconnect: disconnectWagmiFunction } =
|
|
74
|
-
const { address, isConnected, chainId } =
|
|
34
|
+
const { login, authenticated, user, logout, ready } = usePrivy();
|
|
35
|
+
const { connectors, connect } = useConnect();
|
|
36
|
+
const { connectWallet } = usePrivy();
|
|
37
|
+
const { wallets } = useWallets();
|
|
38
|
+
const { disconnect: disconnectWagmiFunction } = useDisconnect();
|
|
39
|
+
const { address, isConnected, chainId } = useAccount();
|
|
75
40
|
const disconnect = async () => {
|
|
76
41
|
try {
|
|
77
42
|
disconnectWagmiFunction();
|
|
78
43
|
} catch (e) {
|
|
79
44
|
}
|
|
80
45
|
};
|
|
81
|
-
const isCorrectChain = chainId ===
|
|
46
|
+
const isCorrectChain = chainId === base2.id;
|
|
82
47
|
const switchToArbitrum = async () => {
|
|
83
48
|
try {
|
|
84
49
|
const wallet = wallets.find((wallet2) => wallet2.address.toString() === (address == null ? void 0 : address.toString()));
|
|
85
|
-
wallet == null ? void 0 : wallet.switchChain(
|
|
86
|
-
|
|
50
|
+
wallet == null ? void 0 : wallet.switchChain(base2.id);
|
|
51
|
+
switchChain(config, { chainId: base2.id });
|
|
87
52
|
} catch (error) {
|
|
88
53
|
console.error("Failed to switch chain:", error);
|
|
89
54
|
}
|
|
@@ -93,14 +58,14 @@ var useWalletConnect = () => {
|
|
|
93
58
|
if (walletAddress) {
|
|
94
59
|
const wallet = wallets.find((w) => w.address.toLowerCase() === walletAddress.toLowerCase());
|
|
95
60
|
if (wallet) {
|
|
96
|
-
await wallet.switchChain(
|
|
61
|
+
await wallet.switchChain(base2.id);
|
|
97
62
|
}
|
|
98
63
|
}
|
|
99
64
|
} catch (error) {
|
|
100
65
|
console.error("Failed to set active wallet:", error);
|
|
101
66
|
}
|
|
102
67
|
};
|
|
103
|
-
const connectorsMemo =
|
|
68
|
+
const connectorsMemo = useMemo(() => {
|
|
104
69
|
return connectors.filter((connector) => connector.id !== "injected");
|
|
105
70
|
}, [connectors]);
|
|
106
71
|
return {
|
|
@@ -123,12 +88,12 @@ var useWalletConnect = () => {
|
|
|
123
88
|
};
|
|
124
89
|
|
|
125
90
|
// src/ModalPrivyConnect.tsx
|
|
126
|
-
|
|
127
|
-
|
|
91
|
+
import { base as base3 } from "viem/chains";
|
|
92
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
128
93
|
var ModalPrivyConnect = () => {
|
|
129
|
-
const [isModalOpen, setIsModalOpen] =
|
|
94
|
+
const [isModalOpen, setIsModalOpen] = React.useState(false);
|
|
130
95
|
const { login, connectors, connect, connectWallet } = useWalletConnect();
|
|
131
|
-
const icon = (
|
|
96
|
+
const icon = useMemo2(() => {
|
|
132
97
|
const icons = {
|
|
133
98
|
"walletConnect": "https://hype.what.exchange/icons/walletconnect-icon.png",
|
|
134
99
|
"metaMaskSDK": "https://hype.what.exchange/icons/metamask-icon.png",
|
|
@@ -140,7 +105,7 @@ var ModalPrivyConnect = () => {
|
|
|
140
105
|
};
|
|
141
106
|
return icons;
|
|
142
107
|
}, []);
|
|
143
|
-
const connectorToPrivyWallet = (
|
|
108
|
+
const connectorToPrivyWallet = useMemo2(() => {
|
|
144
109
|
const map = {
|
|
145
110
|
"io.metamask": "metamask",
|
|
146
111
|
"metaMaskSDK": "metamask",
|
|
@@ -154,7 +119,7 @@ var ModalPrivyConnect = () => {
|
|
|
154
119
|
if (privyWalletName && connectWallet) {
|
|
155
120
|
await connectWallet({ walletList: [privyWalletName] });
|
|
156
121
|
} else {
|
|
157
|
-
await connect({ connector, chainId:
|
|
122
|
+
await connect({ connector, chainId: base3.id });
|
|
158
123
|
}
|
|
159
124
|
setIsModalOpen(false);
|
|
160
125
|
} catch (error) {
|
|
@@ -178,7 +143,7 @@ var ModalPrivyConnect = () => {
|
|
|
178
143
|
}
|
|
179
144
|
}
|
|
180
145
|
await provider.request({ method: "eth_requestAccounts" });
|
|
181
|
-
const customConnector =
|
|
146
|
+
const customConnector = createConnector((config2) => ({
|
|
182
147
|
id: walletName,
|
|
183
148
|
name: walletName === "brave" ? "Brave Wallet" : "Binance Wallet",
|
|
184
149
|
type: "injected",
|
|
@@ -216,7 +181,7 @@ var ModalPrivyConnect = () => {
|
|
|
216
181
|
async switchChain({ chainId: targetChainId }) {
|
|
217
182
|
var _a2, _b2;
|
|
218
183
|
const hexChainId = `0x${targetChainId.toString(16)}`;
|
|
219
|
-
const targetChain = targetChainId ===
|
|
184
|
+
const targetChain = targetChainId === arbitrum.id ? arbitrum : arbitrumSepolia;
|
|
220
185
|
try {
|
|
221
186
|
await provider.request({
|
|
222
187
|
method: "wallet_switchEthereumChain",
|
|
@@ -267,7 +232,7 @@ var ModalPrivyConnect = () => {
|
|
|
267
232
|
config2.emitter.emit("disconnect");
|
|
268
233
|
}
|
|
269
234
|
}));
|
|
270
|
-
await connect({ connector: customConnector, chainId:
|
|
235
|
+
await connect({ connector: customConnector, chainId: base3.id });
|
|
271
236
|
setIsModalOpen(false);
|
|
272
237
|
} catch (error) {
|
|
273
238
|
console.error(`Failed to connect ${walletName}:`, error);
|
|
@@ -293,23 +258,23 @@ var ModalPrivyConnect = () => {
|
|
|
293
258
|
loginMethods: ["twitter"]
|
|
294
259
|
});
|
|
295
260
|
};
|
|
296
|
-
|
|
261
|
+
useEffect(() => {
|
|
297
262
|
window.openModalPrivyConnect = () => {
|
|
298
263
|
setIsModalOpen(true);
|
|
299
264
|
};
|
|
300
265
|
}, []);
|
|
301
266
|
if (!isModalOpen) {
|
|
302
|
-
return /* @__PURE__ */
|
|
267
|
+
return /* @__PURE__ */ jsx(Fragment, {});
|
|
303
268
|
}
|
|
304
269
|
const handleConnectWalletSolana = async (walletList) => {
|
|
305
270
|
setIsModalOpen(false);
|
|
306
271
|
};
|
|
307
|
-
return /* @__PURE__ */
|
|
272
|
+
return /* @__PURE__ */ jsx(
|
|
308
273
|
"div",
|
|
309
274
|
{
|
|
310
275
|
className: "fixed inset-0 oui-bg-black/80 flex items-center justify-end z-50",
|
|
311
276
|
onClick: () => setIsModalOpen(false),
|
|
312
|
-
children: /* @__PURE__ */
|
|
277
|
+
children: /* @__PURE__ */ jsx(
|
|
313
278
|
"div",
|
|
314
279
|
{
|
|
315
280
|
role: "dialog",
|
|
@@ -320,8 +285,8 @@ var ModalPrivyConnect = () => {
|
|
|
320
285
|
tabIndex: -1,
|
|
321
286
|
style: { pointerEvents: "auto" },
|
|
322
287
|
onClick: (e) => e.stopPropagation(),
|
|
323
|
-
children: /* @__PURE__ */
|
|
324
|
-
/* @__PURE__ */
|
|
288
|
+
children: /* @__PURE__ */ jsxs("div", { className: "oui-h-full oui-py-0 oui-border-none oui-relative", children: [
|
|
289
|
+
/* @__PURE__ */ jsx(
|
|
325
290
|
"div",
|
|
326
291
|
{
|
|
327
292
|
className: "oui-absolute oui-inset-x-[50px] -oui-top-[calc(100vh/2)] oui-z-0 oui-h-screen",
|
|
@@ -331,10 +296,10 @@ var ModalPrivyConnect = () => {
|
|
|
331
296
|
}
|
|
332
297
|
}
|
|
333
298
|
),
|
|
334
|
-
/* @__PURE__ */
|
|
335
|
-
/* @__PURE__ */
|
|
336
|
-
/* @__PURE__ */
|
|
337
|
-
/* @__PURE__ */
|
|
299
|
+
/* @__PURE__ */ jsxs("div", { className: "oui-relative oui-z-10 oui-flex oui-h-full oui-flex-col oui-gap-4 md:oui-gap-5", children: [
|
|
300
|
+
/* @__PURE__ */ jsxs("div", { className: "oui-flex oui-flex-none oui-items-center oui-justify-between", children: [
|
|
301
|
+
/* @__PURE__ */ jsx("div", { className: "oui-font-semibold oui-text-base-contrast-80 oui-pb-2 oui-text-[20px] md:oui-py-0 md:oui-text-base", children: "Connect wallet" }),
|
|
302
|
+
/* @__PURE__ */ jsx(
|
|
338
303
|
"svg",
|
|
339
304
|
{
|
|
340
305
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -344,74 +309,74 @@ var ModalPrivyConnect = () => {
|
|
|
344
309
|
viewBox: "0 0 24 24",
|
|
345
310
|
className: "oui-size-5 oui-cursor-pointer oui-text-base-contrast-20 hover:oui-text-base-contrast-80",
|
|
346
311
|
onClick: () => setIsModalOpen(false),
|
|
347
|
-
children: /* @__PURE__ */
|
|
312
|
+
children: /* @__PURE__ */ jsx("path", { fill: "currentcolor", fillOpacity: "0.54", d: "M4.994 3.906c-.256 0-.523.086-.718.281a1.029 1.029 0 0 0 0 1.438l6.28 6.281-6.28 6.281a1.029 1.029 0 0 0 0 1.438c.39.39 1.047.39 1.437 0l6.281-6.28 6.282 6.28c.39.39 1.047.39 1.437 0 .39-.39.39-1.047 0-1.438l-6.281-6.28 6.281-6.282c.39-.39.39-1.047 0-1.438a1.013 1.013 0 0 0-.719-.28c-.256 0-.523.085-.718.28l-6.282 6.281-6.28-6.28a1.013 1.013 0 0 0-.72-.282Z" })
|
|
348
313
|
}
|
|
349
314
|
)
|
|
350
315
|
] }),
|
|
351
|
-
/* @__PURE__ */
|
|
352
|
-
/* @__PURE__ */
|
|
353
|
-
/* @__PURE__ */
|
|
354
|
-
/* @__PURE__ */
|
|
355
|
-
/* @__PURE__ */
|
|
316
|
+
/* @__PURE__ */ jsx("div", { className: "oui-relative oui-overflow-hidden oui-scroll-area-root oui-flex oui-grow oui-shrik oui-basis-auto oui-custom-scrollbar", style: { position: "relative" }, children: /* @__PURE__ */ jsx("div", { className: "oui-h-full oui-w-full oui-rounded-[inherit]", style: { overflow: "auto" }, children: /* @__PURE__ */ jsx("div", { style: { minWidth: "100%", display: "table" }, children: /* @__PURE__ */ jsxs("div", { className: "oui-flex oui-flex-col oui-gap-4 md:oui-gap-5", children: [
|
|
317
|
+
/* @__PURE__ */ jsxs("div", { className: "oui-box oui-flex oui-flex-col oui-items-start oui-justify-start oui-flex-nowrap oui-gap-2 oui-w-full", children: [
|
|
318
|
+
/* @__PURE__ */ jsx("div", { className: "oui-flex oui-items-center oui-justify-between oui-mb-3 oui-text-sm oui-font-semibold oui-text-base-contrast-80", children: "Login in" }),
|
|
319
|
+
/* @__PURE__ */ jsxs("div", { className: "oui-box oui-grid oui-grid-cols-1 oui-gap-2 oui-w-full", children: [
|
|
320
|
+
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs(
|
|
356
321
|
"button",
|
|
357
322
|
{
|
|
358
323
|
onClick: handleEmailLogin,
|
|
359
324
|
className: "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] oui-border-none oui-bg-[#333948] w-full",
|
|
360
325
|
children: [
|
|
361
|
-
/* @__PURE__ */
|
|
362
|
-
/* @__PURE__ */
|
|
326
|
+
/* @__PURE__ */ jsx("img", { src: "https://oss.orderly.network/static/sdk/privy/email.svg", className: "oui-size-[18px]" }),
|
|
327
|
+
/* @__PURE__ */ jsx("div", { className: "oui-text-2xs oui-text-base-contrast", children: "Email" })
|
|
363
328
|
]
|
|
364
329
|
}
|
|
365
330
|
) }),
|
|
366
|
-
/* @__PURE__ */
|
|
331
|
+
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs(
|
|
367
332
|
"button",
|
|
368
333
|
{
|
|
369
334
|
onClick: handleGoogleLogin,
|
|
370
335
|
className: "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] oui-border-none oui-bg-[#335FFC] w-full",
|
|
371
336
|
children: [
|
|
372
|
-
/* @__PURE__ */
|
|
373
|
-
/* @__PURE__ */
|
|
337
|
+
/* @__PURE__ */ jsx("img", { src: "https://oss.orderly.network/static/sdk/privy/google.svg", className: "oui-size-[18px]" }),
|
|
338
|
+
/* @__PURE__ */ jsx("div", { className: "oui-text-2xs oui-text-base-contrast", children: "Google" })
|
|
374
339
|
]
|
|
375
340
|
}
|
|
376
341
|
) }),
|
|
377
|
-
/* @__PURE__ */
|
|
342
|
+
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs(
|
|
378
343
|
"button",
|
|
379
344
|
{
|
|
380
345
|
onClick: handleTwitterLogin,
|
|
381
346
|
className: "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] oui-border-none oui-bg-[#07080A] w-full",
|
|
382
347
|
children: [
|
|
383
|
-
/* @__PURE__ */
|
|
384
|
-
/* @__PURE__ */
|
|
348
|
+
/* @__PURE__ */ jsx("img", { src: "https://oss.orderly.network/static/sdk/privy/twitter.svg", className: "oui-size-[18px]" }),
|
|
349
|
+
/* @__PURE__ */ jsx("div", { className: "oui-text-2xs oui-text-base-contrast", children: "X / Twitter" })
|
|
385
350
|
]
|
|
386
351
|
}
|
|
387
352
|
) })
|
|
388
353
|
] }),
|
|
389
|
-
/* @__PURE__ */
|
|
390
|
-
/* @__PURE__ */
|
|
354
|
+
/* @__PURE__ */ jsx("div", { className: "oui-mt-4 oui-flex oui-h-3 oui-justify-center", children: /* @__PURE__ */ jsx("img", { src: "https://oss.orderly.network/static/sdk/privy/privy-logo.png", className: "oui-h-[10px]" }) }),
|
|
355
|
+
/* @__PURE__ */ jsx("div", { className: "oui-mt-4 oui-h-px oui-w-full oui-bg-line md:oui-mt-5" })
|
|
391
356
|
] }),
|
|
392
|
-
/* @__PURE__ */
|
|
393
|
-
/* @__PURE__ */
|
|
394
|
-
/* @__PURE__ */
|
|
395
|
-
connectors.map((connector) => /* @__PURE__ */
|
|
357
|
+
/* @__PURE__ */ jsxs("div", { className: "", children: [
|
|
358
|
+
/* @__PURE__ */ jsx("div", { className: "oui-mb-2 oui-text-sm oui-font-semibold oui-text-base-contrast-80", children: "EVM" }),
|
|
359
|
+
/* @__PURE__ */ jsxs("div", { className: "oui-grid oui-grid-cols-2 oui-gap-2", children: [
|
|
360
|
+
connectors.map((connector) => /* @__PURE__ */ jsxs(
|
|
396
361
|
"button",
|
|
397
362
|
{
|
|
398
363
|
onClick: () => handleConnectWallet(connector),
|
|
399
364
|
className: "oui-flex oui-flex-1 oui-cursor-pointer oui-items-center oui-justify-start oui-gap-1 oui-rounded-[6px] oui-px-2 oui-py-[11px] oui-bg-[#07080A]",
|
|
400
365
|
children: [
|
|
401
|
-
/* @__PURE__ */
|
|
366
|
+
/* @__PURE__ */ jsx("div", { className: "oui-w-[18px] oui-h-[18px] oui-flex oui-items-center oui-justify-center", children: /* @__PURE__ */ jsx(
|
|
402
367
|
"img",
|
|
403
368
|
{
|
|
404
|
-
src: (connector.icon ? connector.icon :
|
|
369
|
+
src: (connector.icon ? connector.icon : get(icon, connector.id, "")) || "",
|
|
405
370
|
className: "oui-w-[18px] oui-h-[18px]",
|
|
406
371
|
alt: connector.name
|
|
407
372
|
}
|
|
408
373
|
) }),
|
|
409
|
-
/* @__PURE__ */
|
|
374
|
+
/* @__PURE__ */ jsx("div", { className: "oui-text-2xs oui-text-base-contrast", children: connector.name })
|
|
410
375
|
]
|
|
411
376
|
},
|
|
412
377
|
connector.id
|
|
413
378
|
)),
|
|
414
|
-
/* @__PURE__ */
|
|
379
|
+
/* @__PURE__ */ jsxs(
|
|
415
380
|
"button",
|
|
416
381
|
{
|
|
417
382
|
onClick: async () => {
|
|
@@ -426,7 +391,7 @@ var ModalPrivyConnect = () => {
|
|
|
426
391
|
},
|
|
427
392
|
className: "oui-flex oui-flex-1 oui-cursor-pointer oui-items-center oui-justify-start oui-gap-1 oui-rounded-[6px] oui-px-2 oui-py-[11px] oui-bg-[#07080A]",
|
|
428
393
|
children: [
|
|
429
|
-
/* @__PURE__ */
|
|
394
|
+
/* @__PURE__ */ jsx("div", { className: "oui-w-[18px] oui-h-[18px] oui-flex oui-items-center oui-justify-center", children: /* @__PURE__ */ jsx(
|
|
430
395
|
"img",
|
|
431
396
|
{
|
|
432
397
|
src: "https://hype.what.exchange/icons/metamask-icon.png",
|
|
@@ -434,11 +399,11 @@ var ModalPrivyConnect = () => {
|
|
|
434
399
|
alt: "MetaMask"
|
|
435
400
|
}
|
|
436
401
|
) }),
|
|
437
|
-
/* @__PURE__ */
|
|
402
|
+
/* @__PURE__ */ jsx("div", { className: "oui-text-2xs oui-text-base-contrast", children: "MetaMask" })
|
|
438
403
|
]
|
|
439
404
|
}
|
|
440
405
|
),
|
|
441
|
-
/* @__PURE__ */
|
|
406
|
+
/* @__PURE__ */ jsxs(
|
|
442
407
|
"button",
|
|
443
408
|
{
|
|
444
409
|
onClick: async () => {
|
|
@@ -453,7 +418,7 @@ var ModalPrivyConnect = () => {
|
|
|
453
418
|
},
|
|
454
419
|
className: "oui-flex oui-flex-1 oui-cursor-pointer oui-items-center oui-justify-start oui-gap-1 oui-rounded-[6px] oui-px-2 oui-py-[11px] oui-bg-[#07080A]",
|
|
455
420
|
children: [
|
|
456
|
-
/* @__PURE__ */
|
|
421
|
+
/* @__PURE__ */ jsx("div", { className: "oui-w-[18px] oui-h-[18px] oui-flex oui-items-center oui-justify-center", children: /* @__PURE__ */ jsx(
|
|
457
422
|
"img",
|
|
458
423
|
{
|
|
459
424
|
src: "https://hype.what.exchange/icons/walletconnect-icon.png",
|
|
@@ -461,17 +426,17 @@ var ModalPrivyConnect = () => {
|
|
|
461
426
|
alt: "WalletConnect"
|
|
462
427
|
}
|
|
463
428
|
) }),
|
|
464
|
-
/* @__PURE__ */
|
|
429
|
+
/* @__PURE__ */ jsx("div", { className: "oui-text-2xs oui-text-base-contrast", children: "WalletConnect" })
|
|
465
430
|
]
|
|
466
431
|
}
|
|
467
432
|
),
|
|
468
|
-
/* @__PURE__ */
|
|
433
|
+
/* @__PURE__ */ jsxs(
|
|
469
434
|
"button",
|
|
470
435
|
{
|
|
471
436
|
onClick: () => handleConnectSpecificWallet("brave"),
|
|
472
437
|
className: "oui-flex oui-flex-1 oui-cursor-pointer oui-items-center oui-justify-start oui-gap-1 oui-rounded-[6px] oui-px-2 oui-py-[11px] oui-bg-[#07080A]",
|
|
473
438
|
children: [
|
|
474
|
-
/* @__PURE__ */
|
|
439
|
+
/* @__PURE__ */ jsx("div", { className: "oui-w-[18px] oui-h-[18px] oui-flex oui-items-center oui-justify-center", children: /* @__PURE__ */ jsx(
|
|
475
440
|
"img",
|
|
476
441
|
{
|
|
477
442
|
src: "https://hype.what.exchange/icons/brave-icon.png",
|
|
@@ -482,17 +447,17 @@ var ModalPrivyConnect = () => {
|
|
|
482
447
|
}
|
|
483
448
|
}
|
|
484
449
|
) }),
|
|
485
|
-
/* @__PURE__ */
|
|
450
|
+
/* @__PURE__ */ jsx("div", { className: "oui-text-2xs oui-text-base-contrast", children: "Brave Wallet" })
|
|
486
451
|
]
|
|
487
452
|
}
|
|
488
453
|
),
|
|
489
|
-
/* @__PURE__ */
|
|
454
|
+
/* @__PURE__ */ jsxs(
|
|
490
455
|
"button",
|
|
491
456
|
{
|
|
492
457
|
onClick: () => handleConnectSpecificWallet("binance"),
|
|
493
458
|
className: "oui-flex oui-flex-1 oui-cursor-pointer oui-items-center oui-justify-start oui-gap-1 oui-rounded-[6px] oui-px-2 oui-py-[11px] oui-bg-[#07080A]",
|
|
494
459
|
children: [
|
|
495
|
-
/* @__PURE__ */
|
|
460
|
+
/* @__PURE__ */ jsx("div", { className: "oui-w-[18px] oui-h-[18px] oui-flex oui-items-center oui-justify-center", children: /* @__PURE__ */ jsx(
|
|
496
461
|
"img",
|
|
497
462
|
{
|
|
498
463
|
src: "https://hype.what.exchange/icons/binance-icon.png",
|
|
@@ -503,17 +468,17 @@ var ModalPrivyConnect = () => {
|
|
|
503
468
|
}
|
|
504
469
|
}
|
|
505
470
|
) }),
|
|
506
|
-
/* @__PURE__ */
|
|
471
|
+
/* @__PURE__ */ jsx("div", { className: "oui-text-2xs oui-text-base-contrast", children: "Binance Wallet" })
|
|
507
472
|
]
|
|
508
473
|
}
|
|
509
474
|
)
|
|
510
475
|
] })
|
|
511
476
|
] })
|
|
512
477
|
] }) }) }) }),
|
|
513
|
-
/* @__PURE__ */
|
|
478
|
+
/* @__PURE__ */ jsx("div", { className: "oui-box oui-flex oui-flex-col oui-items-center oui-justify-start oui-flex-nowrap oui-gap-4", children: /* @__PURE__ */ jsxs("div", { className: "oui-flex-none oui-text-center oui-text-2xs oui-font-semibold oui-text-base-contrast-80", children: [
|
|
514
479
|
"By connecting your wallet, you acknowledge and agree to the",
|
|
515
480
|
" ",
|
|
516
|
-
/* @__PURE__ */
|
|
481
|
+
/* @__PURE__ */ jsx("a", { href: "termsofuse", className: "oui-cursor-pointer oui-text-primary oui-underline", target: "_blank", rel: "noreferrer", children: "terms of use" }),
|
|
517
482
|
"."
|
|
518
483
|
] }) })
|
|
519
484
|
] })
|
|
@@ -525,15 +490,15 @@ var ModalPrivyConnect = () => {
|
|
|
525
490
|
};
|
|
526
491
|
|
|
527
492
|
// src/ModalPrivyWallets.tsx
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
493
|
+
import { useEffect as useEffect2, useState } from "react";
|
|
494
|
+
import { X, Copy, ExternalLink } from "lucide-react";
|
|
495
|
+
import { Fragment as Fragment2, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
531
496
|
var formatAddress = (address) => {
|
|
532
497
|
if (!address) return "";
|
|
533
498
|
return `${address.slice(0, 6)}...${address.slice(-4)}`;
|
|
534
499
|
};
|
|
535
500
|
var CopyAddress = ({ address }) => {
|
|
536
|
-
const [copied, setCopied] =
|
|
501
|
+
const [copied, setCopied] = useState(false);
|
|
537
502
|
const handleCopy = async () => {
|
|
538
503
|
try {
|
|
539
504
|
await navigator.clipboard.writeText(address);
|
|
@@ -543,28 +508,28 @@ var CopyAddress = ({ address }) => {
|
|
|
543
508
|
console.error("Failed to copy address:", err);
|
|
544
509
|
}
|
|
545
510
|
};
|
|
546
|
-
return /* @__PURE__ */ (
|
|
511
|
+
return /* @__PURE__ */ jsx2(
|
|
547
512
|
"button",
|
|
548
513
|
{
|
|
549
514
|
onClick: handleCopy,
|
|
550
515
|
className: " transition-colors duration-200 cursor-pointer",
|
|
551
|
-
children: copied ? "\u2713 Copied!" : /* @__PURE__ */ (
|
|
516
|
+
children: copied ? "\u2713 Copied!" : /* @__PURE__ */ jsx2(Copy, { className: "w-4 h-4" })
|
|
552
517
|
}
|
|
553
518
|
);
|
|
554
519
|
};
|
|
555
520
|
var ModalPrivyWallet = () => {
|
|
556
|
-
const [isExpanded, setIsExpanded] =
|
|
521
|
+
const [isExpanded, setIsExpanded] = useState(true);
|
|
557
522
|
const { address, disconnect } = useWalletConnect();
|
|
558
|
-
const [isOpen, setIsOpen] =
|
|
559
|
-
const [isClosing, setIsClosing] =
|
|
560
|
-
const [isVisible, setIsVisible] =
|
|
523
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
524
|
+
const [isClosing, setIsClosing] = useState(false);
|
|
525
|
+
const [isVisible, setIsVisible] = useState(false);
|
|
561
526
|
const safeAddress = address != null ? address : "";
|
|
562
|
-
(
|
|
527
|
+
useEffect2(() => {
|
|
563
528
|
window.openModalPrivyWallet = () => {
|
|
564
529
|
setIsOpen(true);
|
|
565
530
|
};
|
|
566
531
|
}, []);
|
|
567
|
-
(
|
|
532
|
+
useEffect2(() => {
|
|
568
533
|
if (isOpen) {
|
|
569
534
|
setIsVisible(false);
|
|
570
535
|
const t = requestAnimationFrame(() => setIsVisible(true));
|
|
@@ -573,7 +538,7 @@ var ModalPrivyWallet = () => {
|
|
|
573
538
|
setIsVisible(false);
|
|
574
539
|
}
|
|
575
540
|
}, [isOpen]);
|
|
576
|
-
(
|
|
541
|
+
useEffect2(() => {
|
|
577
542
|
if (isOpen) {
|
|
578
543
|
const previous = document.body.style.overflow;
|
|
579
544
|
document.body.style.overflow = "hidden";
|
|
@@ -595,9 +560,9 @@ var ModalPrivyWallet = () => {
|
|
|
595
560
|
await disconnect();
|
|
596
561
|
setIsOpen(false);
|
|
597
562
|
};
|
|
598
|
-
if (!isOpen) return /* @__PURE__ */ (
|
|
599
|
-
return /* @__PURE__ */ (
|
|
600
|
-
/* @__PURE__ */ (
|
|
563
|
+
if (!isOpen) return /* @__PURE__ */ jsx2(Fragment2, {});
|
|
564
|
+
return /* @__PURE__ */ jsxs2(Fragment2, { children: [
|
|
565
|
+
/* @__PURE__ */ jsx2(
|
|
601
566
|
"div",
|
|
602
567
|
{
|
|
603
568
|
className: `fixed inset-0 z-40 transition-opacity duration-300 ${isClosing ? "opacity-0" : "opacity-100"} `,
|
|
@@ -605,7 +570,7 @@ var ModalPrivyWallet = () => {
|
|
|
605
570
|
onClick: handleClose
|
|
606
571
|
}
|
|
607
572
|
),
|
|
608
|
-
/* @__PURE__ */ (
|
|
573
|
+
/* @__PURE__ */ jsx2(
|
|
609
574
|
"div",
|
|
610
575
|
{
|
|
611
576
|
role: "dialog",
|
|
@@ -619,8 +584,8 @@ var ModalPrivyWallet = () => {
|
|
|
619
584
|
opacity: isVisible && !isClosing ? 1 : 0,
|
|
620
585
|
transition: "transform 300ms ease, opacity 300ms ease"
|
|
621
586
|
},
|
|
622
|
-
children: /* @__PURE__ */ (
|
|
623
|
-
/* @__PURE__ */ (
|
|
587
|
+
children: /* @__PURE__ */ jsxs2("div", { className: "oui-h-full oui-py-0 oui-border-none oui-relative", children: [
|
|
588
|
+
/* @__PURE__ */ jsx2(
|
|
624
589
|
"div",
|
|
625
590
|
{
|
|
626
591
|
className: "oui-absolute oui-inset-x-[50px] -oui-top-[calc(100vh/2)] oui-z-0 oui-h-screen",
|
|
@@ -630,13 +595,13 @@ var ModalPrivyWallet = () => {
|
|
|
630
595
|
}
|
|
631
596
|
}
|
|
632
597
|
),
|
|
633
|
-
/* @__PURE__ */ (
|
|
634
|
-
/* @__PURE__ */ (
|
|
635
|
-
/* @__PURE__ */ (
|
|
636
|
-
/* @__PURE__ */ (
|
|
598
|
+
/* @__PURE__ */ jsxs2("div", { className: "oui-relative oui-z-10 oui-flex oui-h-full oui-flex-col oui-gap-4 md:oui-gap-5", children: [
|
|
599
|
+
/* @__PURE__ */ jsxs2("div", { className: "oui-flex oui-flex-none oui-items-center oui-justify-between", children: [
|
|
600
|
+
/* @__PURE__ */ jsx2("div", { id: "wallet-dialog-title", className: "oui-font-semibold oui-text-base-contrast-80 oui-pb-2 oui-text-[20px] md:oui-py-0 md:oui-text-base", children: "My wallet" }),
|
|
601
|
+
/* @__PURE__ */ jsx2("button", { className: "oui-size-5 oui-cursor-pointer oui-text-base-contrast-20 hover:oui-text-base-contrast-80", onClick: handleClose, children: /* @__PURE__ */ jsx2(X, { size: 24 }) })
|
|
637
602
|
] }),
|
|
638
|
-
/* @__PURE__ */ (
|
|
639
|
-
/* @__PURE__ */ (
|
|
603
|
+
/* @__PURE__ */ jsx2("div", { children: /* @__PURE__ */ jsx2("div", { className: "oui-flex oui-flex-col oui-gap-5", children: /* @__PURE__ */ jsxs2("div", { className: "oui-relative oui-h-[110px] oui-overflow-hidden oui-rounded-2xl oui-p-4 oui-bg-[#283BEE]", children: [
|
|
604
|
+
/* @__PURE__ */ jsx2(
|
|
640
605
|
"div",
|
|
641
606
|
{
|
|
642
607
|
style: {
|
|
@@ -650,11 +615,11 @@ var ModalPrivyWallet = () => {
|
|
|
650
615
|
}
|
|
651
616
|
}
|
|
652
617
|
),
|
|
653
|
-
/* @__PURE__ */ (
|
|
654
|
-
/* @__PURE__ */ (
|
|
655
|
-
/* @__PURE__ */ (
|
|
656
|
-
/* @__PURE__ */ (
|
|
657
|
-
/* @__PURE__ */ (
|
|
618
|
+
/* @__PURE__ */ jsx2("div", { className: "oui-relative oui-z-10 oui-flex oui-h-full oui-flex-col oui-justify-between", children: /* @__PURE__ */ jsxs2("div", { className: "oui-flex oui-items-center oui-justify-between", children: [
|
|
619
|
+
/* @__PURE__ */ jsx2("div", { className: "oui-text-sm oui-font-semibold oui-text-base-contrast", children: formatAddress(safeAddress) }),
|
|
620
|
+
/* @__PURE__ */ jsxs2("div", { className: "oui-flex oui-items-center oui-justify-center oui-gap-2", children: [
|
|
621
|
+
/* @__PURE__ */ jsx2(CopyAddress, { address: safeAddress }),
|
|
622
|
+
/* @__PURE__ */ jsx2("button", { className: "oui-cursor-pointer oui-text-base-contrast-80 hover:oui-text-base-contrast", onClick: handleDisconnect, children: /* @__PURE__ */ jsx2(ExternalLink, { size: 16 }) })
|
|
658
623
|
] })
|
|
659
624
|
] }) })
|
|
660
625
|
] }) }) })
|
|
@@ -666,13 +631,13 @@ var ModalPrivyWallet = () => {
|
|
|
666
631
|
};
|
|
667
632
|
|
|
668
633
|
// src/WhatWagmiProvider.tsx
|
|
669
|
-
|
|
634
|
+
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
670
635
|
function WhatWagmiProvider({
|
|
671
636
|
children,
|
|
672
637
|
privyKey = ""
|
|
673
638
|
}) {
|
|
674
|
-
return /* @__PURE__ */ (
|
|
675
|
-
|
|
639
|
+
return /* @__PURE__ */ jsx3(
|
|
640
|
+
PrivyProvider,
|
|
676
641
|
{
|
|
677
642
|
appId: privyKey,
|
|
678
643
|
config: {
|
|
@@ -684,16 +649,15 @@ function WhatWagmiProvider({
|
|
|
684
649
|
walletChainType: "ethereum-and-solana"
|
|
685
650
|
}
|
|
686
651
|
},
|
|
687
|
-
children: /* @__PURE__ */ (
|
|
652
|
+
children: /* @__PURE__ */ jsxs3(WagmiProvider, { config, children: [
|
|
688
653
|
children,
|
|
689
|
-
/* @__PURE__ */ (
|
|
690
|
-
/* @__PURE__ */ (
|
|
654
|
+
/* @__PURE__ */ jsx3(ModalPrivyConnect, {}),
|
|
655
|
+
/* @__PURE__ */ jsx3(ModalPrivyWallet, {})
|
|
691
656
|
] })
|
|
692
657
|
}
|
|
693
658
|
);
|
|
694
659
|
}
|
|
695
|
-
|
|
696
|
-
0 && (module.exports = {
|
|
660
|
+
export {
|
|
697
661
|
WhatWagmiProvider,
|
|
698
662
|
useWalletConnect
|
|
699
|
-
}
|
|
663
|
+
};
|