@gearbox-protocol/permissionless-ui 1.6.0 → 1.6.1
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/cjs/components/buttons/button.js +1 -1
- package/dist/cjs/components/buttons/tab-button.js +1 -5
- package/dist/cjs/components/cards/card.js +1 -1
- package/dist/cjs/components/cards/expandable-card.js +1 -1
- package/dist/cjs/components/detailed-page-title.js +1 -1
- package/dist/cjs/components/next/index.js +2 -5
- package/dist/cjs/components/signatures/vertical-timeline.js +2 -2
- package/dist/esm/components/buttons/button.js +1 -1
- package/dist/esm/components/buttons/tab-button.js +1 -5
- package/dist/esm/components/cards/card.js +1 -1
- package/dist/esm/components/cards/expandable-card.js +1 -1
- package/dist/esm/components/detailed-page-title.js +1 -1
- package/dist/esm/components/next/index.js +1 -3
- package/dist/esm/components/signatures/vertical-timeline.js +2 -2
- package/dist/types/components/next/index.d.ts +0 -1
- package/package.json +1 -1
- package/dist/cjs/components/next/web3-providers.js +0 -116
- package/dist/esm/components/next/web3-providers.js +0 -92
- package/dist/types/components/next/web3-providers.d.ts +0 -29
|
@@ -44,7 +44,7 @@ const buttonVariants = (0, import_class_variance_authority.cva)(
|
|
|
44
44
|
variant: {
|
|
45
45
|
default: "bg-primary text-primary-foreground shadow hover:bg-primary/90",
|
|
46
46
|
destructive: "bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",
|
|
47
|
-
outline: "border-border bg-background shadow-sm hover:bg-
|
|
47
|
+
outline: "border-border bg-background shadow-sm hover:bg-secondary hover:text-white text-white",
|
|
48
48
|
secondary: "bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",
|
|
49
49
|
ghost: "hover:bg-accent hover:text-accent-foreground",
|
|
50
50
|
link: "text-primary underline-offset-4 hover:underline",
|
|
@@ -33,7 +33,6 @@ __export(tab_button_exports, {
|
|
|
33
33
|
module.exports = __toCommonJS(tab_button_exports);
|
|
34
34
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
35
35
|
var React = __toESM(require("react"));
|
|
36
|
-
var import_utils = __toESM(require('../../utils/index.js'));
|
|
37
36
|
var import_button = require('./button.js');
|
|
38
37
|
const TabButton = React.forwardRef(
|
|
39
38
|
({ className, children, size = "sm", ...props }, ref) => {
|
|
@@ -43,10 +42,7 @@ const TabButton = React.forwardRef(
|
|
|
43
42
|
ref,
|
|
44
43
|
variant: "outline",
|
|
45
44
|
size,
|
|
46
|
-
className
|
|
47
|
-
"bg-gray-900 text-gray-100 border-gray-700 hover:bg-gray-800 border-gray-300",
|
|
48
|
-
className
|
|
49
|
-
),
|
|
45
|
+
className,
|
|
50
46
|
...props,
|
|
51
47
|
children
|
|
52
48
|
}
|
|
@@ -41,7 +41,7 @@ var import_class_variance_authority = require("class-variance-authority");
|
|
|
41
41
|
var React = __toESM(require("react"));
|
|
42
42
|
var import_utils = __toESM(require('../../utils/index.js'));
|
|
43
43
|
const cardVariants = (0, import_class_variance_authority.cva)(
|
|
44
|
-
"rounded-xl border border-border bg-card text-card-foreground",
|
|
44
|
+
"rounded-xl border border-border bg-card text-card-foreground hover:bg-secondary",
|
|
45
45
|
{
|
|
46
46
|
variants: {
|
|
47
47
|
variant: {
|
|
@@ -49,7 +49,7 @@ function ExpandableCard({
|
|
|
49
49
|
{
|
|
50
50
|
className: (0, import_utils.default)(
|
|
51
51
|
"flex items-center justify-between gap-4 p-4 rounded-t-xl",
|
|
52
|
-
alwaysExpanded ? "" : "cursor-pointer hover:bg-
|
|
52
|
+
alwaysExpanded ? "" : "cursor-pointer hover:bg-secondary",
|
|
53
53
|
isExpanded ? "" : "rounded-b-xl"
|
|
54
54
|
),
|
|
55
55
|
onClick: () => {
|
|
@@ -48,7 +48,7 @@ function DetailedPageTitle({
|
|
|
48
48
|
explorerLinks,
|
|
49
49
|
className
|
|
50
50
|
}) {
|
|
51
|
-
const
|
|
51
|
+
const _intl = (0, import_typed_intl.useIntlTyped)();
|
|
52
52
|
const [isPressed, setIsPressed] = React.useState(false);
|
|
53
53
|
const handleCopy = () => {
|
|
54
54
|
if (toCopy) {
|
|
@@ -22,8 +22,7 @@ __export(next_exports, {
|
|
|
22
22
|
MarkdownViewer: () => import_markdown_viewer.MarkdownViewer,
|
|
23
23
|
SIWEClientProvider: () => import_siwe_provider.SIWEClientProvider,
|
|
24
24
|
SignInRequired: () => import_signin_required.SignInRequired,
|
|
25
|
-
TokenIcon: () => import_token_icon.TokenIcon
|
|
26
|
-
Web3Providers: () => import_web3_providers.Web3Providers
|
|
25
|
+
TokenIcon: () => import_token_icon.TokenIcon
|
|
27
26
|
});
|
|
28
27
|
module.exports = __toCommonJS(next_exports);
|
|
29
28
|
var import_signin_required = require('../auth/signin-required.js');
|
|
@@ -31,13 +30,11 @@ var import_back_button = require('./back-button.js');
|
|
|
31
30
|
var import_markdown_viewer = require('./markdown-viewer.js');
|
|
32
31
|
var import_siwe_provider = require('./siwe-provider.js');
|
|
33
32
|
var import_token_icon = require('./token-icon.js');
|
|
34
|
-
var import_web3_providers = require('./web3-providers.js');
|
|
35
33
|
// Annotate the CommonJS export names for ESM import in node:
|
|
36
34
|
0 && (module.exports = {
|
|
37
35
|
BackButton,
|
|
38
36
|
MarkdownViewer,
|
|
39
37
|
SIWEClientProvider,
|
|
40
38
|
SignInRequired,
|
|
41
|
-
TokenIcon
|
|
42
|
-
Web3Providers
|
|
39
|
+
TokenIcon
|
|
43
40
|
});
|
|
@@ -61,8 +61,8 @@ function VerticalTimeline({
|
|
|
61
61
|
!showAll[index],
|
|
62
62
|
...showAll.slice(index + 1)
|
|
63
63
|
]),
|
|
64
|
-
className: "ml-10 text-green-500 hover:underline",
|
|
65
|
-
children: showAll ? "Hide all" : "Show all"
|
|
64
|
+
className: "ml-10 text-green-500 hover:underline cursor-pointer",
|
|
65
|
+
children: showAll[index] ? "Hide all" : "Show all"
|
|
66
66
|
}
|
|
67
67
|
)
|
|
68
68
|
] }),
|
|
@@ -10,7 +10,7 @@ const buttonVariants = cva(
|
|
|
10
10
|
variant: {
|
|
11
11
|
default: "bg-primary text-primary-foreground shadow hover:bg-primary/90",
|
|
12
12
|
destructive: "bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",
|
|
13
|
-
outline: "border-border bg-background shadow-sm hover:bg-
|
|
13
|
+
outline: "border-border bg-background shadow-sm hover:bg-secondary hover:text-white text-white",
|
|
14
14
|
secondary: "bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",
|
|
15
15
|
ghost: "hover:bg-accent hover:text-accent-foreground",
|
|
16
16
|
link: "text-primary underline-offset-4 hover:underline",
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import * as React from "react";
|
|
3
|
-
import cn from "../../utils/index.js";
|
|
4
3
|
import { Button } from "./button.js";
|
|
5
4
|
const TabButton = React.forwardRef(
|
|
6
5
|
({ className, children, size = "sm", ...props }, ref) => {
|
|
@@ -10,10 +9,7 @@ const TabButton = React.forwardRef(
|
|
|
10
9
|
ref,
|
|
11
10
|
variant: "outline",
|
|
12
11
|
size,
|
|
13
|
-
className
|
|
14
|
-
"bg-gray-900 text-gray-100 border-gray-700 hover:bg-gray-800 border-gray-300",
|
|
15
|
-
className
|
|
16
|
-
),
|
|
12
|
+
className,
|
|
17
13
|
...props,
|
|
18
14
|
children
|
|
19
15
|
}
|
|
@@ -3,7 +3,7 @@ import { cva } from "class-variance-authority";
|
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import cn from "../../utils/index.js";
|
|
5
5
|
const cardVariants = cva(
|
|
6
|
-
"rounded-xl border border-border bg-card text-card-foreground",
|
|
6
|
+
"rounded-xl border border-border bg-card text-card-foreground hover:bg-secondary",
|
|
7
7
|
{
|
|
8
8
|
variants: {
|
|
9
9
|
variant: {
|
|
@@ -16,7 +16,7 @@ function ExpandableCard({
|
|
|
16
16
|
{
|
|
17
17
|
className: cn(
|
|
18
18
|
"flex items-center justify-between gap-4 p-4 rounded-t-xl",
|
|
19
|
-
alwaysExpanded ? "" : "cursor-pointer hover:bg-
|
|
19
|
+
alwaysExpanded ? "" : "cursor-pointer hover:bg-secondary",
|
|
20
20
|
isExpanded ? "" : "rounded-b-xl"
|
|
21
21
|
),
|
|
22
22
|
onClick: () => {
|
|
@@ -3,12 +3,10 @@ import { BackButton } from "./back-button.js";
|
|
|
3
3
|
import { MarkdownViewer } from "./markdown-viewer.js";
|
|
4
4
|
import { SIWEClientProvider } from "./siwe-provider.js";
|
|
5
5
|
import { TokenIcon } from "./token-icon.js";
|
|
6
|
-
import { Web3Providers } from "./web3-providers.js";
|
|
7
6
|
export {
|
|
8
7
|
BackButton,
|
|
9
8
|
MarkdownViewer,
|
|
10
9
|
SIWEClientProvider,
|
|
11
10
|
SignInRequired,
|
|
12
|
-
TokenIcon
|
|
13
|
-
Web3Providers
|
|
11
|
+
TokenIcon
|
|
14
12
|
};
|
|
@@ -38,8 +38,8 @@ function VerticalTimeline({
|
|
|
38
38
|
!showAll[index],
|
|
39
39
|
...showAll.slice(index + 1)
|
|
40
40
|
]),
|
|
41
|
-
className: "ml-10 text-green-500 hover:underline",
|
|
42
|
-
children: showAll ? "Hide all" : "Show all"
|
|
41
|
+
className: "ml-10 text-green-500 hover:underline cursor-pointer",
|
|
42
|
+
children: showAll[index] ? "Hide all" : "Show all"
|
|
43
43
|
}
|
|
44
44
|
)
|
|
45
45
|
] }),
|
package/package.json
CHANGED
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
"use client";
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
-
var web3_providers_exports = {};
|
|
21
|
-
__export(web3_providers_exports, {
|
|
22
|
-
Web3Providers: () => Web3Providers
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(web3_providers_exports);
|
|
25
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
26
|
-
var import_react_query = require("@tanstack/react-query");
|
|
27
|
-
var import_connectkit = require("connectkit");
|
|
28
|
-
var import_react = require("react");
|
|
29
|
-
var import_siwe = require("viem/siwe");
|
|
30
|
-
var import_wagmi = require("wagmi");
|
|
31
|
-
function makeQueryClient() {
|
|
32
|
-
return new import_react_query.QueryClient({
|
|
33
|
-
defaultOptions: {
|
|
34
|
-
queries: {
|
|
35
|
-
staleTime: 60 * 1e3
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
let browserQueryClient;
|
|
41
|
-
function getQueryClient() {
|
|
42
|
-
if (typeof window === "undefined") {
|
|
43
|
-
return makeQueryClient();
|
|
44
|
-
}
|
|
45
|
-
if (!browserQueryClient) browserQueryClient = makeQueryClient();
|
|
46
|
-
return browserQueryClient;
|
|
47
|
-
}
|
|
48
|
-
function Web3Providers({
|
|
49
|
-
config,
|
|
50
|
-
apiRoutePrefix,
|
|
51
|
-
statement = "Sign In With Ethereum.",
|
|
52
|
-
children
|
|
53
|
-
}) {
|
|
54
|
-
const [queryClient] = (0, import_react.useState)(() => getQueryClient());
|
|
55
|
-
const getNonce = async () => {
|
|
56
|
-
const res = await fetch(`${apiRoutePrefix}/nonce`);
|
|
57
|
-
if (!res.ok) {
|
|
58
|
-
throw new Error("Failed to fetch SIWE nonce");
|
|
59
|
-
}
|
|
60
|
-
return await res.text();
|
|
61
|
-
};
|
|
62
|
-
const createMessage = ({
|
|
63
|
-
nonce,
|
|
64
|
-
address,
|
|
65
|
-
chainId
|
|
66
|
-
}) => (0, import_siwe.createSiweMessage)({
|
|
67
|
-
version: "1",
|
|
68
|
-
domain: window.location.host,
|
|
69
|
-
uri: window.location.origin,
|
|
70
|
-
address,
|
|
71
|
-
chainId,
|
|
72
|
-
nonce,
|
|
73
|
-
statement
|
|
74
|
-
});
|
|
75
|
-
const verifyMessage = async ({
|
|
76
|
-
message,
|
|
77
|
-
signature
|
|
78
|
-
}) => {
|
|
79
|
-
const res = await fetch(`${apiRoutePrefix}/signin`, {
|
|
80
|
-
method: "POST",
|
|
81
|
-
body: JSON.stringify({ message, signature })
|
|
82
|
-
});
|
|
83
|
-
if (!res.ok) {
|
|
84
|
-
throw new Error("Failed to verify SIWE message");
|
|
85
|
-
}
|
|
86
|
-
return true;
|
|
87
|
-
};
|
|
88
|
-
const getSession = async () => {
|
|
89
|
-
const res = await fetch(`${apiRoutePrefix}/session`);
|
|
90
|
-
if (!res.ok) {
|
|
91
|
-
return null;
|
|
92
|
-
}
|
|
93
|
-
return res.json();
|
|
94
|
-
};
|
|
95
|
-
const signOut = async () => {
|
|
96
|
-
await fetch(`${apiRoutePrefix}/logout`, {
|
|
97
|
-
method: "POST"
|
|
98
|
-
});
|
|
99
|
-
return true;
|
|
100
|
-
};
|
|
101
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_wagmi.WagmiProvider, { config, reconnectOnMount: true, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_query.QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
102
|
-
import_connectkit.SIWEProvider,
|
|
103
|
-
{
|
|
104
|
-
getNonce,
|
|
105
|
-
createMessage,
|
|
106
|
-
verifyMessage,
|
|
107
|
-
getSession,
|
|
108
|
-
signOut,
|
|
109
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_connectkit.ConnectKitProvider, { children })
|
|
110
|
-
}
|
|
111
|
-
) }) });
|
|
112
|
-
}
|
|
113
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
114
|
-
0 && (module.exports = {
|
|
115
|
-
Web3Providers
|
|
116
|
-
});
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
4
|
-
import { ConnectKitProvider, SIWEProvider } from "connectkit";
|
|
5
|
-
import { useState } from "react";
|
|
6
|
-
import { createSiweMessage } from "viem/siwe";
|
|
7
|
-
import { WagmiProvider } from "wagmi";
|
|
8
|
-
function makeQueryClient() {
|
|
9
|
-
return new QueryClient({
|
|
10
|
-
defaultOptions: {
|
|
11
|
-
queries: {
|
|
12
|
-
staleTime: 60 * 1e3
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
let browserQueryClient;
|
|
18
|
-
function getQueryClient() {
|
|
19
|
-
if (typeof window === "undefined") {
|
|
20
|
-
return makeQueryClient();
|
|
21
|
-
}
|
|
22
|
-
if (!browserQueryClient) browserQueryClient = makeQueryClient();
|
|
23
|
-
return browserQueryClient;
|
|
24
|
-
}
|
|
25
|
-
function Web3Providers({
|
|
26
|
-
config,
|
|
27
|
-
apiRoutePrefix,
|
|
28
|
-
statement = "Sign In With Ethereum.",
|
|
29
|
-
children
|
|
30
|
-
}) {
|
|
31
|
-
const [queryClient] = useState(() => getQueryClient());
|
|
32
|
-
const getNonce = async () => {
|
|
33
|
-
const res = await fetch(`${apiRoutePrefix}/nonce`);
|
|
34
|
-
if (!res.ok) {
|
|
35
|
-
throw new Error("Failed to fetch SIWE nonce");
|
|
36
|
-
}
|
|
37
|
-
return await res.text();
|
|
38
|
-
};
|
|
39
|
-
const createMessage = ({
|
|
40
|
-
nonce,
|
|
41
|
-
address,
|
|
42
|
-
chainId
|
|
43
|
-
}) => createSiweMessage({
|
|
44
|
-
version: "1",
|
|
45
|
-
domain: window.location.host,
|
|
46
|
-
uri: window.location.origin,
|
|
47
|
-
address,
|
|
48
|
-
chainId,
|
|
49
|
-
nonce,
|
|
50
|
-
statement
|
|
51
|
-
});
|
|
52
|
-
const verifyMessage = async ({
|
|
53
|
-
message,
|
|
54
|
-
signature
|
|
55
|
-
}) => {
|
|
56
|
-
const res = await fetch(`${apiRoutePrefix}/signin`, {
|
|
57
|
-
method: "POST",
|
|
58
|
-
body: JSON.stringify({ message, signature })
|
|
59
|
-
});
|
|
60
|
-
if (!res.ok) {
|
|
61
|
-
throw new Error("Failed to verify SIWE message");
|
|
62
|
-
}
|
|
63
|
-
return true;
|
|
64
|
-
};
|
|
65
|
-
const getSession = async () => {
|
|
66
|
-
const res = await fetch(`${apiRoutePrefix}/session`);
|
|
67
|
-
if (!res.ok) {
|
|
68
|
-
return null;
|
|
69
|
-
}
|
|
70
|
-
return res.json();
|
|
71
|
-
};
|
|
72
|
-
const signOut = async () => {
|
|
73
|
-
await fetch(`${apiRoutePrefix}/logout`, {
|
|
74
|
-
method: "POST"
|
|
75
|
-
});
|
|
76
|
-
return true;
|
|
77
|
-
};
|
|
78
|
-
return /* @__PURE__ */ jsx(WagmiProvider, { config, reconnectOnMount: true, children: /* @__PURE__ */ jsx(QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsx(
|
|
79
|
-
SIWEProvider,
|
|
80
|
-
{
|
|
81
|
-
getNonce,
|
|
82
|
-
createMessage,
|
|
83
|
-
verifyMessage,
|
|
84
|
-
getSession,
|
|
85
|
-
signOut,
|
|
86
|
-
children: /* @__PURE__ */ jsx(ConnectKitProvider, { children })
|
|
87
|
-
}
|
|
88
|
-
) }) });
|
|
89
|
-
}
|
|
90
|
-
export {
|
|
91
|
-
Web3Providers
|
|
92
|
-
};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from "react";
|
|
2
|
-
import type { Config } from "wagmi";
|
|
3
|
-
/**
|
|
4
|
-
* Web3Providers — all-in-one provider component for Web3 apps with Wagmi, ConnectKit, SIWE, and React Query.
|
|
5
|
-
*
|
|
6
|
-
* @usage
|
|
7
|
-
* Use Web3Providers to wrap your Next.js application and enable Web3 functionality:
|
|
8
|
-
* app root, authentication context, wallet connection.
|
|
9
|
-
*
|
|
10
|
-
* Props:
|
|
11
|
-
* - `config` — Wagmi config object (required).
|
|
12
|
-
* - `apiRoutePrefix` — API route prefix for SIWE endpoints (required):
|
|
13
|
-
* - `/api/nonce` — endpoint for fetching nonce.
|
|
14
|
-
* - `/api/signin` — endpoint for verifying signature.
|
|
15
|
-
* - `/api/session` — endpoint for getting current session.
|
|
16
|
-
* - `/api/logout` — endpoint for signing out.
|
|
17
|
-
* - `statement` — optional custom statement for SIWE message (defaults to "Sign In With Ethereum.").
|
|
18
|
-
* - `children` — application content wrapped by provider (required).
|
|
19
|
-
*
|
|
20
|
-
* Note: Web3Providers wraps WagmiProvider, QueryClientProvider, ConnectKitProvider, and SIWEProvider with correct order and configuration.
|
|
21
|
-
*/
|
|
22
|
-
interface Web3ProvidersProps {
|
|
23
|
-
config: Config;
|
|
24
|
-
apiRoutePrefix: string;
|
|
25
|
-
statement?: string;
|
|
26
|
-
children: ReactNode;
|
|
27
|
-
}
|
|
28
|
-
export declare function Web3Providers({ config, apiRoutePrefix, statement, children, }: Web3ProvidersProps): import("react/jsx-runtime").JSX.Element;
|
|
29
|
-
export {};
|