@jaw.id/ui 0.0.3 → 0.0.5
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/cjs-error.cjs +3 -0
- package/dist/{ccip-BYa9WTP9.js → ccip-nTJDT8tV.js} +1 -1
- package/dist/{index-DBYNWeek.js → index-C2yN5Jh0.js} +20536 -20246
- package/dist/index.js +1 -1
- package/package.json +8 -2
- package/.babelrc +0 -12
- package/CHANGELOG.md +0 -23
- package/components.json +0 -22
- package/postcss.config.cjs +0 -6
- package/src/components/ConnectDialog/index.tsx +0 -270
- package/src/components/ConnectDialog/types.ts +0 -34
- package/src/components/DefaultDialog/index.tsx +0 -99
- package/src/components/Eip712Dialog/index.tsx +0 -525
- package/src/components/Eip712Dialog/types.ts +0 -27
- package/src/components/FeeTokenSelector/index.tsx +0 -308
- package/src/components/OnboardingDialog/index.tsx +0 -317
- package/src/components/OnboardingDialog/types.ts +0 -43
- package/src/components/OrSeparator/index.tsx +0 -13
- package/src/components/PermissionDialog/index.tsx +0 -598
- package/src/components/PermissionDialog/types.ts +0 -77
- package/src/components/SignatureDialog/index.tsx +0 -180
- package/src/components/SignatureDialog/types.ts +0 -27
- package/src/components/SiweDialog/index.tsx +0 -231
- package/src/components/SiweDialog/types.ts +0 -34
- package/src/components/TransactionDialog/DecodedCalldata.tsx +0 -79
- package/src/components/TransactionDialog/index.tsx +0 -663
- package/src/components/TransactionDialog/types.ts +0 -54
- package/src/components/ui/accordion.tsx +0 -66
- package/src/components/ui/avatar.tsx +0 -53
- package/src/components/ui/button.tsx +0 -59
- package/src/components/ui/card.tsx +0 -92
- package/src/components/ui/checkbox.tsx +0 -32
- package/src/components/ui/dialog.tsx +0 -183
- package/src/components/ui/dropdown-menu.tsx +0 -258
- package/src/components/ui/form.tsx +0 -167
- package/src/components/ui/input.tsx +0 -60
- package/src/components/ui/label.tsx +0 -24
- package/src/components/ui/popover.tsx +0 -48
- package/src/components/ui/scroll-area.tsx +0 -58
- package/src/components/ui/select.tsx +0 -160
- package/src/components/ui/separator.tsx +0 -28
- package/src/components/ui/sheet.tsx +0 -169
- package/src/components/ui/spinner.tsx +0 -18
- package/src/components/ui/tabs.tsx +0 -69
- package/src/components/ui/tooltip.tsx +0 -61
- package/src/hooks/index.ts +0 -5
- package/src/hooks/useChainIconURI.tsx +0 -117
- package/src/hooks/useDecodedCalldata.ts +0 -128
- package/src/hooks/useFeeTokenPrice.tsx +0 -36
- package/src/hooks/useGasEstimation.ts +0 -474
- package/src/hooks/useIsMobile.ts +0 -36
- package/src/icons/index.tsx +0 -114
- package/src/index.ts +0 -19
- package/src/lib/utils.ts +0 -6
- package/src/react/ReactUIHandler.tsx +0 -3004
- package/src/react/index.ts +0 -2
- package/src/styles.css +0 -210
- package/src/utils/formatAddress.ts +0 -24
- package/src/utils/index.ts +0 -4
- package/src/utils/justaNameInstance.ts +0 -25
- package/src/utils/tokenBalance.ts +0 -41
- package/src/utils/tokenPrice.ts +0 -58
- package/tailwind.config.js +0 -130
- package/tsconfig.json +0 -19
- package/tsconfig.lib.json +0 -43
- package/vite.config.ts +0 -45
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
|
|
3
|
-
import { Button } from "../ui/button";
|
|
4
|
-
import { DefaultDialog } from "../DefaultDialog";
|
|
5
|
-
import { SignatureDialogProps } from "./types";
|
|
6
|
-
import { useIsMobile } from "../../hooks";
|
|
7
|
-
import { getJustaNameInstance, getDisplayAddress } from "../../utils";
|
|
8
|
-
import { useState, useEffect } from "react";
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
export const SignatureDialog = ({
|
|
12
|
-
open,
|
|
13
|
-
onOpenChange,
|
|
14
|
-
message,
|
|
15
|
-
origin,
|
|
16
|
-
timestamp,
|
|
17
|
-
accountAddress,
|
|
18
|
-
chainName,
|
|
19
|
-
chainId,
|
|
20
|
-
chainIcon,
|
|
21
|
-
mainnetRpcUrl,
|
|
22
|
-
onSign,
|
|
23
|
-
onCancel,
|
|
24
|
-
isProcessing,
|
|
25
|
-
signatureStatus,
|
|
26
|
-
canSign,
|
|
27
|
-
}: SignatureDialogProps) => {
|
|
28
|
-
const isMobile = useIsMobile();
|
|
29
|
-
const [resolvedAddress, setResolvedAddress] = useState<string | null>(null);
|
|
30
|
-
|
|
31
|
-
// Resolve account address to human-readable name
|
|
32
|
-
useEffect(() => {
|
|
33
|
-
if (accountAddress && chainId) {
|
|
34
|
-
const justaName = getJustaNameInstance(mainnetRpcUrl);
|
|
35
|
-
justaName.subnames.reverseResolve({
|
|
36
|
-
address: accountAddress as `0x${string}`,
|
|
37
|
-
chainId: chainId,
|
|
38
|
-
}).then((result) => {
|
|
39
|
-
if (result) {
|
|
40
|
-
setResolvedAddress(result);
|
|
41
|
-
}
|
|
42
|
-
}).catch(() => {
|
|
43
|
-
// Silently fail if resolution fails
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
}, [accountAddress, chainId]);
|
|
47
|
-
|
|
48
|
-
// Get display address - use resolved name or formatted address
|
|
49
|
-
const displayAddress = getDisplayAddress(resolvedAddress, accountAddress || '');
|
|
50
|
-
|
|
51
|
-
// Format origin to display only domain (remove protocol)
|
|
52
|
-
const formatOrigin = (url: string) => {
|
|
53
|
-
try {
|
|
54
|
-
const urlObj = new URL(url.startsWith('http') ? url : `https://${url}`);
|
|
55
|
-
return urlObj.hostname.replace('www.', '');
|
|
56
|
-
} catch {
|
|
57
|
-
return origin;
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
return (
|
|
62
|
-
<DefaultDialog
|
|
63
|
-
open={open}
|
|
64
|
-
handleClose={onCancel}
|
|
65
|
-
onOpenChange={!isProcessing ? onOpenChange : undefined}
|
|
66
|
-
header={
|
|
67
|
-
<div className="flex flex-col gap-2.5 p-3.5">
|
|
68
|
-
<div className="flex flex-row items-center justify-between">
|
|
69
|
-
<p className="text-xs font-bold text-muted-foreground leading-[100%]">
|
|
70
|
-
{timestamp.toLocaleDateString('en-US', {
|
|
71
|
-
weekday: 'long',
|
|
72
|
-
day: 'numeric',
|
|
73
|
-
month: 'long'
|
|
74
|
-
})} at {timestamp.toLocaleTimeString('en-US', {
|
|
75
|
-
hour: '2-digit',
|
|
76
|
-
minute: '2-digit',
|
|
77
|
-
second: '2-digit',
|
|
78
|
-
timeZoneName: 'short'
|
|
79
|
-
})}
|
|
80
|
-
</p>
|
|
81
|
-
{/* <InfoIcon /> */}
|
|
82
|
-
</div>
|
|
83
|
-
{/* Title */}
|
|
84
|
-
<p className="text-[30px] font-medium leading-[100%] text-foreground">
|
|
85
|
-
Signature request
|
|
86
|
-
</p>
|
|
87
|
-
<p className="text-sm text-muted-foreground">
|
|
88
|
-
{displayAddress}
|
|
89
|
-
</p>
|
|
90
|
-
</div>
|
|
91
|
-
}
|
|
92
|
-
contentStyle={isMobile ? {
|
|
93
|
-
width: '100%',
|
|
94
|
-
height: '100%',
|
|
95
|
-
maxWidth: 'none',
|
|
96
|
-
maxHeight: 'none',
|
|
97
|
-
} : {
|
|
98
|
-
width: '500px',
|
|
99
|
-
minWidth: '500px',
|
|
100
|
-
}}
|
|
101
|
-
>
|
|
102
|
-
<div className="flex flex-col h-full min-h-0">
|
|
103
|
-
{/* Main Content Area - Large scrollable message box */}
|
|
104
|
-
<div className="flex-1 p-4 bg-white border border-border rounded-[6px] min-h-[300px] max-h-[50vh] overflow-y-auto">
|
|
105
|
-
<p className="text-sm font-normal text-foreground whitespace-pre-wrap break-words leading-relaxed">
|
|
106
|
-
{message || 'No message provided'}
|
|
107
|
-
</p>
|
|
108
|
-
</div>
|
|
109
|
-
|
|
110
|
-
{/* Footer Information Section - Network and URL */}
|
|
111
|
-
<div className="bg-white border border-border rounded-[6px] p-2 mt-3">
|
|
112
|
-
<div className="flex flex-row gap-4">
|
|
113
|
-
{/* Network Column */}
|
|
114
|
-
{chainName && (
|
|
115
|
-
<div className="flex flex-col gap-1 flex-1">
|
|
116
|
-
<p className="text-xs font-bold text-foreground">Network</p>
|
|
117
|
-
<div className="flex flex-row items-center gap-2">
|
|
118
|
-
{chainIcon && (
|
|
119
|
-
<div className="w-6 h-6 flex items-center justify-center flex-shrink-0">
|
|
120
|
-
{chainIcon}
|
|
121
|
-
</div>
|
|
122
|
-
)}
|
|
123
|
-
<p className="text-sm font-normal text-foreground">
|
|
124
|
-
{chainName}
|
|
125
|
-
</p>
|
|
126
|
-
</div>
|
|
127
|
-
</div>
|
|
128
|
-
)}
|
|
129
|
-
|
|
130
|
-
{/* Vertical Separator */}
|
|
131
|
-
{chainName && (
|
|
132
|
-
<div className="w-[1px] bg-border min-h-[40px]"></div>
|
|
133
|
-
)}
|
|
134
|
-
|
|
135
|
-
{/* URL Column */}
|
|
136
|
-
<div className="flex flex-col gap-1 flex-1">
|
|
137
|
-
<p className="text-xs font-bold text-foreground">URL</p>
|
|
138
|
-
<p className="text-sm font-normal text-foreground">
|
|
139
|
-
{formatOrigin(origin)}
|
|
140
|
-
</p>
|
|
141
|
-
</div>
|
|
142
|
-
</div>
|
|
143
|
-
</div>
|
|
144
|
-
|
|
145
|
-
{/* Status Message */}
|
|
146
|
-
{signatureStatus && (
|
|
147
|
-
<div className={`text-sm p-3 rounded-lg mt-3 ${signatureStatus.includes('Error') ? 'bg-red-50 text-red-600' :
|
|
148
|
-
signatureStatus.includes('successfully') ? 'bg-green-50 text-green-600' :
|
|
149
|
-
'bg-blue-50 text-blue-600'
|
|
150
|
-
}`}>
|
|
151
|
-
{signatureStatus}
|
|
152
|
-
</div>
|
|
153
|
-
)}
|
|
154
|
-
|
|
155
|
-
{/* Action Buttons Section */}
|
|
156
|
-
<div className="flex mt-3 flex-shrink-0">
|
|
157
|
-
<div className="flex gap-2 w-full justify-between">
|
|
158
|
-
<Button
|
|
159
|
-
variant="outline"
|
|
160
|
-
onClick={onCancel}
|
|
161
|
-
disabled={isProcessing}
|
|
162
|
-
className="h-9"
|
|
163
|
-
>
|
|
164
|
-
Cancel
|
|
165
|
-
</Button>
|
|
166
|
-
<Button
|
|
167
|
-
onClick={onSign}
|
|
168
|
-
disabled={!canSign}
|
|
169
|
-
className="h-9"
|
|
170
|
-
>
|
|
171
|
-
{isProcessing ? 'Signing...' : 'Sign'}
|
|
172
|
-
</Button>
|
|
173
|
-
</div>
|
|
174
|
-
</div>
|
|
175
|
-
</div>
|
|
176
|
-
</DefaultDialog>
|
|
177
|
-
)
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
export * from './types';
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { JSX } from "react";
|
|
2
|
-
export interface SignatureDialogProps {
|
|
3
|
-
open: boolean;
|
|
4
|
-
onOpenChange: (open: boolean) => void;
|
|
5
|
-
|
|
6
|
-
// Message data
|
|
7
|
-
message: string;
|
|
8
|
-
origin: string;
|
|
9
|
-
timestamp: Date;
|
|
10
|
-
|
|
11
|
-
accountAddress?: string;
|
|
12
|
-
chainName?: string;
|
|
13
|
-
chainId?: number;
|
|
14
|
-
chainIcon?: JSX.Element;
|
|
15
|
-
|
|
16
|
-
// RPC configuration
|
|
17
|
-
mainnetRpcUrl: string;
|
|
18
|
-
|
|
19
|
-
// Actions
|
|
20
|
-
onSign: () => Promise<void>;
|
|
21
|
-
onCancel: () => void;
|
|
22
|
-
|
|
23
|
-
// Status
|
|
24
|
-
isProcessing: boolean;
|
|
25
|
-
signatureStatus: string;
|
|
26
|
-
canSign: boolean;
|
|
27
|
-
}
|
|
@@ -1,231 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
|
|
3
|
-
import { useEffect, useState } from "react";
|
|
4
|
-
import { useIsMobile } from "../../hooks";
|
|
5
|
-
import { CopyIcon } from "../../icons";
|
|
6
|
-
import { getJustaNameInstance, getDisplayAddress } from "../../utils";
|
|
7
|
-
import { DefaultDialog } from "../DefaultDialog";
|
|
8
|
-
import { Button } from "../ui/button";
|
|
9
|
-
import { SiweDialogProps } from "./types";
|
|
10
|
-
|
|
11
|
-
export const SiweDialog = ({
|
|
12
|
-
open,
|
|
13
|
-
onOpenChange,
|
|
14
|
-
message,
|
|
15
|
-
timestamp,
|
|
16
|
-
appName,
|
|
17
|
-
appLogoUrl,
|
|
18
|
-
accountAddress,
|
|
19
|
-
chainName,
|
|
20
|
-
chainId,
|
|
21
|
-
chainIcon,
|
|
22
|
-
mainnetRpcUrl,
|
|
23
|
-
onSign,
|
|
24
|
-
onCancel,
|
|
25
|
-
isProcessing,
|
|
26
|
-
siweStatus,
|
|
27
|
-
canSign,
|
|
28
|
-
warningMessage,
|
|
29
|
-
}: SiweDialogProps) => {
|
|
30
|
-
const isMobile = useIsMobile();
|
|
31
|
-
const [resolvedAddress, setResolvedAddress] = useState<string | null>(null);
|
|
32
|
-
|
|
33
|
-
// Resolve account address to human-readable name
|
|
34
|
-
useEffect(() => {
|
|
35
|
-
if (accountAddress && chainId) {
|
|
36
|
-
const justaName = getJustaNameInstance(mainnetRpcUrl);
|
|
37
|
-
justaName.subnames.reverseResolve({
|
|
38
|
-
address: accountAddress as `0x${string}`,
|
|
39
|
-
chainId: chainId,
|
|
40
|
-
}).then((result) => {
|
|
41
|
-
if (result) {
|
|
42
|
-
setResolvedAddress(result);
|
|
43
|
-
}
|
|
44
|
-
}).catch(() => {
|
|
45
|
-
// Silently fail if resolution fails
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
}, [accountAddress, chainId]);
|
|
49
|
-
|
|
50
|
-
// Get display address - use resolved name or formatted address
|
|
51
|
-
const displayAddress = getDisplayAddress(resolvedAddress, accountAddress || '');
|
|
52
|
-
|
|
53
|
-
// Format origin to display only domain (remove protocol)
|
|
54
|
-
const formatOrigin = (url: string) => {
|
|
55
|
-
try {
|
|
56
|
-
const urlObj = new URL(url.startsWith('http') ? url : `https://${url}`);
|
|
57
|
-
return urlObj.hostname.replace('www.', '');
|
|
58
|
-
} catch {
|
|
59
|
-
return origin;
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
const onCopyMessageHandler = () => {
|
|
64
|
-
navigator.clipboard.writeText(message);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
return (
|
|
68
|
-
<DefaultDialog
|
|
69
|
-
open={open}
|
|
70
|
-
handleClose={onCancel}
|
|
71
|
-
onOpenChange={!isProcessing ? onOpenChange : undefined}
|
|
72
|
-
header={
|
|
73
|
-
<div className="flex flex-col gap-2.5 p-3.5">
|
|
74
|
-
<div className="flex flex-row items-center justify-between">
|
|
75
|
-
<p className="text-xs font-bold text-muted-foreground leading-[100%]">
|
|
76
|
-
{timestamp.toLocaleDateString('en-US', {
|
|
77
|
-
weekday: 'long',
|
|
78
|
-
day: 'numeric',
|
|
79
|
-
month: 'long'
|
|
80
|
-
})} at {timestamp.toLocaleTimeString('en-US', {
|
|
81
|
-
hour: '2-digit',
|
|
82
|
-
minute: '2-digit',
|
|
83
|
-
second: '2-digit',
|
|
84
|
-
timeZoneName: 'short'
|
|
85
|
-
})}
|
|
86
|
-
</p>
|
|
87
|
-
{/* <InfoIcon /> */}
|
|
88
|
-
</div>
|
|
89
|
-
<p className="text-sm text-muted-foreground">
|
|
90
|
-
{displayAddress}
|
|
91
|
-
</p>
|
|
92
|
-
</div>
|
|
93
|
-
}
|
|
94
|
-
contentStyle={isMobile ? {
|
|
95
|
-
width: '100%',
|
|
96
|
-
height: '100%',
|
|
97
|
-
maxWidth: 'none',
|
|
98
|
-
maxHeight: 'none',
|
|
99
|
-
} : {
|
|
100
|
-
width: '500px',
|
|
101
|
-
minWidth: '500px',
|
|
102
|
-
}}
|
|
103
|
-
>
|
|
104
|
-
<div className="flex flex-col h-full gap-3 max-h-[60vh] overflow-y-auto min-h-0">
|
|
105
|
-
<div className="flex flex-1 flex-col p-3.5 items-center justify-center">
|
|
106
|
-
{appLogoUrl && (
|
|
107
|
-
<img
|
|
108
|
-
src={appLogoUrl}
|
|
109
|
-
alt={`${appName} logo`}
|
|
110
|
-
className="w-[72px] h-[72px] rounded-full mb-3"
|
|
111
|
-
/>
|
|
112
|
-
)}
|
|
113
|
-
<div className="flex flex-col items-center gap-1 text-foreground">
|
|
114
|
-
<p className="text-2xl font-normal leading-[133%] ">
|
|
115
|
-
Sign in Request
|
|
116
|
-
</p>
|
|
117
|
-
<p className="text-base leading-[150%] font-bold">{appName}</p>
|
|
118
|
-
</div>
|
|
119
|
-
</div>
|
|
120
|
-
{/* Main Content Area - Large scrollable message box */}
|
|
121
|
-
<div className="flex-1 p-3.5 bg-white flex flex-col gap-2.5 border border-border rounded-[6px]">
|
|
122
|
-
<div className="flex flex-row items-center justify-between">
|
|
123
|
-
<p className="text-foreground font-bold text-xs leading-[150%]">Message</p>
|
|
124
|
-
<CopyIcon className="w-4 h-4 cursor-pointer" onClick={onCopyMessageHandler} />
|
|
125
|
-
</div>
|
|
126
|
-
<div className="flex bg-secondary rounded-[6px] p-2.5 max-h-[35vh] overflow-y-auto">
|
|
127
|
-
<p className="text-sm font-normal text-foreground whitespace-pre-wrap break-words leading-relaxed">
|
|
128
|
-
{message || 'No message provided'}
|
|
129
|
-
</p>
|
|
130
|
-
</div>
|
|
131
|
-
</div>
|
|
132
|
-
|
|
133
|
-
{/* Footer Information Section */}
|
|
134
|
-
{/* Chain Information */}
|
|
135
|
-
<div className="flex flex-row gap-4 border border-border rounded-[6px] p-2">
|
|
136
|
-
{/* Network Column */}
|
|
137
|
-
{chainName && (
|
|
138
|
-
<>
|
|
139
|
-
<div className="flex flex-col gap-1 flex-1">
|
|
140
|
-
<p className="text-xs font-bold text-foreground">Network</p>
|
|
141
|
-
<div className="flex flex-row items-center gap-2">
|
|
142
|
-
{chainIcon && (
|
|
143
|
-
<div className="w-6 h-6 flex items-center justify-center flex-shrink-0">
|
|
144
|
-
{chainIcon}
|
|
145
|
-
</div>
|
|
146
|
-
)}
|
|
147
|
-
<p className="text-sm font-normal text-foreground">
|
|
148
|
-
{chainName}
|
|
149
|
-
</p>
|
|
150
|
-
</div>
|
|
151
|
-
</div>
|
|
152
|
-
{/* Vertical Separator */}
|
|
153
|
-
<div className="w-[1px] bg-border min-h-[40px]"></div>
|
|
154
|
-
</>
|
|
155
|
-
)}
|
|
156
|
-
{/* URL Column */}
|
|
157
|
-
<div className="flex flex-col gap-1 flex-1">
|
|
158
|
-
<p className="text-xs font-bold text-foreground">URL</p>
|
|
159
|
-
<p className="text-sm font-normal text-foreground">
|
|
160
|
-
{formatOrigin(origin)}
|
|
161
|
-
</p>
|
|
162
|
-
</div>
|
|
163
|
-
</div>
|
|
164
|
-
|
|
165
|
-
{/* Origin Mismatch Warning */}
|
|
166
|
-
{warningMessage && (
|
|
167
|
-
<div className="flex items-start gap-2.5 p-3.5 border border-yellow-300 rounded-[6px] bg-yellow-50">
|
|
168
|
-
<svg
|
|
169
|
-
width="16"
|
|
170
|
-
height="16"
|
|
171
|
-
viewBox="0 0 16 16"
|
|
172
|
-
fill="none"
|
|
173
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
174
|
-
className="flex-shrink-0 mt-0.5"
|
|
175
|
-
>
|
|
176
|
-
<path
|
|
177
|
-
d="M8 1.5L1 14.5H15L8 1.5Z"
|
|
178
|
-
stroke="#F59E0B"
|
|
179
|
-
strokeWidth="1.5"
|
|
180
|
-
strokeLinecap="round"
|
|
181
|
-
strokeLinejoin="round"
|
|
182
|
-
/>
|
|
183
|
-
<path d="M8 6V9" stroke="#F59E0B" strokeWidth="1.5" strokeLinecap="round" />
|
|
184
|
-
<circle cx="8" cy="11.5" r="0.5" fill="#F59E0B" />
|
|
185
|
-
</svg>
|
|
186
|
-
<div className="flex flex-col gap-1">
|
|
187
|
-
<p className="text-xs font-bold leading-[133%] text-yellow-800">Security Warning</p>
|
|
188
|
-
<p className="text-xs font-normal leading-[150%] text-yellow-900">
|
|
189
|
-
{warningMessage}
|
|
190
|
-
</p>
|
|
191
|
-
</div>
|
|
192
|
-
</div>
|
|
193
|
-
)}
|
|
194
|
-
|
|
195
|
-
{/* Status Message */}
|
|
196
|
-
{siweStatus && (
|
|
197
|
-
<div className={`text-sm p-3 rounded-lg mt-3 ${siweStatus.includes('Error') ? 'bg-red-50 text-red-600' :
|
|
198
|
-
siweStatus.includes('successfully') ? 'bg-green-50 text-green-600' :
|
|
199
|
-
'bg-blue-50 text-blue-600'
|
|
200
|
-
}`}>
|
|
201
|
-
{siweStatus}
|
|
202
|
-
</div>
|
|
203
|
-
)}
|
|
204
|
-
|
|
205
|
-
{/* Action Buttons Section */}
|
|
206
|
-
<div className="flex mt-3 flex-shrink-0">
|
|
207
|
-
<div className="flex gap-2 w-full justify-between">
|
|
208
|
-
<Button
|
|
209
|
-
variant="outline"
|
|
210
|
-
onClick={onCancel}
|
|
211
|
-
disabled={isProcessing}
|
|
212
|
-
className="h-9"
|
|
213
|
-
>
|
|
214
|
-
Cancel
|
|
215
|
-
</Button>
|
|
216
|
-
<Button
|
|
217
|
-
onClick={onSign}
|
|
218
|
-
disabled={!canSign}
|
|
219
|
-
className="h-9"
|
|
220
|
-
>
|
|
221
|
-
{isProcessing ? 'Signing...' : 'Sign'}
|
|
222
|
-
</Button>
|
|
223
|
-
</div>
|
|
224
|
-
</div>
|
|
225
|
-
</div>
|
|
226
|
-
</DefaultDialog>
|
|
227
|
-
)
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
export * from './types';
|
|
231
|
-
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { JSX } from "react";
|
|
2
|
-
export interface SiweDialogProps {
|
|
3
|
-
open: boolean;
|
|
4
|
-
onOpenChange: (open: boolean) => void;
|
|
5
|
-
|
|
6
|
-
// Message data
|
|
7
|
-
message: string;
|
|
8
|
-
origin: string;
|
|
9
|
-
timestamp: Date;
|
|
10
|
-
|
|
11
|
-
// App information
|
|
12
|
-
appName: string;
|
|
13
|
-
appLogoUrl?: string;
|
|
14
|
-
|
|
15
|
-
accountAddress?: string;
|
|
16
|
-
chainName?: string;
|
|
17
|
-
chainId?: number;
|
|
18
|
-
chainIcon?: JSX.Element;
|
|
19
|
-
|
|
20
|
-
// Actions
|
|
21
|
-
onSign: () => Promise<void>;
|
|
22
|
-
onCancel: () => void;
|
|
23
|
-
|
|
24
|
-
// Status
|
|
25
|
-
isProcessing: boolean;
|
|
26
|
-
siweStatus: string;
|
|
27
|
-
canSign: boolean;
|
|
28
|
-
|
|
29
|
-
// Security warning for origin mismatch
|
|
30
|
-
warningMessage?: string;
|
|
31
|
-
|
|
32
|
-
// RPC configuration
|
|
33
|
-
mainnetRpcUrl: string;
|
|
34
|
-
}
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { useDecodedCalldata } from '../../hooks/useDecodedCalldata';
|
|
2
|
-
import { Spinner } from '../ui/spinner';
|
|
3
|
-
|
|
4
|
-
interface DecodedCalldataProps {
|
|
5
|
-
to: string;
|
|
6
|
-
data: string;
|
|
7
|
-
chainId: number;
|
|
8
|
-
apiKey?: string;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export const DecodedCalldata = ({ to, data, chainId, apiKey }: DecodedCalldataProps) => {
|
|
12
|
-
const { decoded, isLoading } = useDecodedCalldata(to, data, chainId, apiKey);
|
|
13
|
-
|
|
14
|
-
if (isLoading) {
|
|
15
|
-
return (
|
|
16
|
-
<div className="flex flex-col gap-2">
|
|
17
|
-
<div className="flex items-center gap-2">
|
|
18
|
-
<Spinner className="size-3" />
|
|
19
|
-
<span className="text-xs text-muted-foreground">Decoding calldata...</span>
|
|
20
|
-
</div>
|
|
21
|
-
<div className="p-2.5 bg-secondary rounded-[6px] max-h-[40vh] overflow-y-auto opacity-50">
|
|
22
|
-
<p className="text-xs font-semibold leading-[150%] break-all text-foreground font-mono">
|
|
23
|
-
{data}
|
|
24
|
-
</p>
|
|
25
|
-
</div>
|
|
26
|
-
</div>
|
|
27
|
-
);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
if (!decoded) {
|
|
31
|
-
return (
|
|
32
|
-
<div className="p-2.5 bg-secondary rounded-[6px] max-h-[40vh] overflow-y-auto">
|
|
33
|
-
<p className="text-xs font-semibold leading-[150%] break-all text-foreground font-mono">
|
|
34
|
-
{data}
|
|
35
|
-
</p>
|
|
36
|
-
</div>
|
|
37
|
-
);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
return (
|
|
41
|
-
<div className="flex flex-col gap-2">
|
|
42
|
-
<div className="flex items-center gap-2">
|
|
43
|
-
<span className="text-xs font-semibold text-foreground bg-primary/10 px-2 py-0.5 rounded">
|
|
44
|
-
{decoded.functionName}
|
|
45
|
-
</span>
|
|
46
|
-
<span className="text-xs text-muted-foreground font-mono">
|
|
47
|
-
{decoded.signature}
|
|
48
|
-
</span>
|
|
49
|
-
</div>
|
|
50
|
-
|
|
51
|
-
{decoded.params.length > 0 && (
|
|
52
|
-
<div className="flex flex-col gap-1 p-2 bg-secondary rounded-[6px]">
|
|
53
|
-
{decoded.params.map((param, i) => (
|
|
54
|
-
<div key={i} className="flex flex-col gap-0.5">
|
|
55
|
-
<div className="flex items-baseline gap-1.5">
|
|
56
|
-
<span className="text-xs font-semibold text-muted-foreground">{param.name}</span>
|
|
57
|
-
<span className="text-[10px] text-muted-foreground/60 font-mono">{param.type}</span>
|
|
58
|
-
</div>
|
|
59
|
-
<p className="text-xs font-mono break-all text-foreground leading-[150%]">
|
|
60
|
-
{param.value}
|
|
61
|
-
</p>
|
|
62
|
-
</div>
|
|
63
|
-
))}
|
|
64
|
-
</div>
|
|
65
|
-
)}
|
|
66
|
-
|
|
67
|
-
<details className="text-xs">
|
|
68
|
-
<summary className="text-muted-foreground cursor-pointer hover:text-foreground">
|
|
69
|
-
Raw calldata
|
|
70
|
-
</summary>
|
|
71
|
-
<div className="p-2 bg-secondary rounded-[6px] mt-1 max-h-[20vh] overflow-y-auto">
|
|
72
|
-
<p className="text-xs font-mono leading-[150%] break-all text-foreground">
|
|
73
|
-
{data}
|
|
74
|
-
</p>
|
|
75
|
-
</div>
|
|
76
|
-
</details>
|
|
77
|
-
</div>
|
|
78
|
-
);
|
|
79
|
-
};
|