@one_deploy/sdk 1.0.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/.turbo/turbo-build.log +0 -0
- package/.turbo/turbo-type-check.log +0 -0
- package/dist/config/index.d.mts +74 -0
- package/dist/config/index.d.ts +74 -0
- package/dist/config/index.js +242 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/index.mjs +224 -0
- package/dist/config/index.mjs.map +1 -0
- package/dist/engine-5ndtBaCr.d.ts +1039 -0
- package/dist/engine-CrlhH0nw.d.mts +1039 -0
- package/dist/hooks/index.d.mts +56 -0
- package/dist/hooks/index.d.ts +56 -0
- package/dist/hooks/index.js +1360 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/index.mjs +1356 -0
- package/dist/hooks/index.mjs.map +1 -0
- package/dist/index.d.mts +356 -0
- package/dist/index.d.ts +356 -0
- package/dist/index.js +5068 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +4949 -0
- package/dist/index.mjs.map +1 -0
- package/dist/price-CgqXPnT3.d.ts +13 -0
- package/dist/price-ClbLHHjv.d.mts +13 -0
- package/dist/providers/index.d.mts +121 -0
- package/dist/providers/index.d.ts +121 -0
- package/dist/providers/index.js +1642 -0
- package/dist/providers/index.js.map +1 -0
- package/dist/providers/index.mjs +1600 -0
- package/dist/providers/index.mjs.map +1 -0
- package/dist/react-native.d.mts +120 -0
- package/dist/react-native.d.ts +120 -0
- package/dist/react-native.js +1792 -0
- package/dist/react-native.js.map +1 -0
- package/dist/react-native.mjs +1755 -0
- package/dist/react-native.mjs.map +1 -0
- package/dist/services/index.d.mts +85 -0
- package/dist/services/index.d.ts +85 -0
- package/dist/services/index.js +1466 -0
- package/dist/services/index.js.map +1 -0
- package/dist/services/index.mjs +1458 -0
- package/dist/services/index.mjs.map +1 -0
- package/dist/types/index.d.mts +759 -0
- package/dist/types/index.d.ts +759 -0
- package/dist/types/index.js +4 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/index.mjs +3 -0
- package/dist/types/index.mjs.map +1 -0
- package/dist/utils/index.d.mts +36 -0
- package/dist/utils/index.d.ts +36 -0
- package/dist/utils/index.js +164 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/index.mjs +142 -0
- package/dist/utils/index.mjs.map +1 -0
- package/package.json +101 -0
- package/src/components/OneConnectButton.tsx +143 -0
- package/src/components/OneNFTGallery.tsx +324 -0
- package/src/components/OneOfframpWidget.tsx +660 -0
- package/src/components/OneOnrampWidget.tsx +596 -0
- package/src/components/OnePayWidget.tsx +160 -0
- package/src/components/OneReceiveWidget.tsx +272 -0
- package/src/components/OneSendWidget.tsx +248 -0
- package/src/components/OneSwapWidget.tsx +715 -0
- package/src/components/OneTransactionButton.tsx +150 -0
- package/src/components/OneWalletBalance.tsx +354 -0
- package/src/components/index.ts +24 -0
- package/src/config/index.ts +299 -0
- package/src/hooks/index.ts +2 -0
- package/src/hooks/useTokenPrice.ts +162 -0
- package/src/hooks/useWalletBalance.ts +98 -0
- package/src/index.ts +193 -0
- package/src/providers/OneProvider.tsx +452 -0
- package/src/providers/ThirdwebProvider.tsx +203 -0
- package/src/providers/index.ts +26 -0
- package/src/react-native.ts +378 -0
- package/src/services/engine.ts +1854 -0
- package/src/services/index.ts +30 -0
- package/src/services/price.ts +164 -0
- package/src/services/supabase.ts +180 -0
- package/src/types/index.ts +887 -0
- package/src/utils/index.ts +200 -0
- package/tsconfig.json +22 -0
- package/tsup.config.ts +25 -0
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { ConnectButton, type ConnectButtonProps } from 'thirdweb/react';
|
|
5
|
+
import { inAppWallet, smartWallet } from 'thirdweb/wallets';
|
|
6
|
+
import { base } from 'thirdweb/chains';
|
|
7
|
+
import { useThirdwebClient } from '../providers/ThirdwebProvider';
|
|
8
|
+
|
|
9
|
+
// ===== Types =====
|
|
10
|
+
|
|
11
|
+
export interface OneConnectButtonProps {
|
|
12
|
+
// Appearance
|
|
13
|
+
label?: string;
|
|
14
|
+
theme?: 'light' | 'dark';
|
|
15
|
+
className?: string;
|
|
16
|
+
style?: React.CSSProperties;
|
|
17
|
+
|
|
18
|
+
// Chain config
|
|
19
|
+
chain?: Parameters<typeof smartWallet>[0]['chain'];
|
|
20
|
+
sponsorGas?: boolean;
|
|
21
|
+
|
|
22
|
+
// Auth options
|
|
23
|
+
authOptions?: {
|
|
24
|
+
email?: boolean;
|
|
25
|
+
google?: boolean;
|
|
26
|
+
apple?: boolean;
|
|
27
|
+
discord?: boolean;
|
|
28
|
+
passkey?: boolean;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
// Callbacks
|
|
32
|
+
onConnect?: (address: string) => void;
|
|
33
|
+
onDisconnect?: () => void;
|
|
34
|
+
|
|
35
|
+
// Account abstraction
|
|
36
|
+
accountAbstraction?: {
|
|
37
|
+
chain: Parameters<typeof smartWallet>[0]['chain'];
|
|
38
|
+
sponsorGas?: boolean;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// ===== Default Theme =====
|
|
43
|
+
|
|
44
|
+
const ONE_THEME = {
|
|
45
|
+
colors: {
|
|
46
|
+
primaryButtonBg: '#10b981', // emerald-500
|
|
47
|
+
primaryButtonText: '#ffffff',
|
|
48
|
+
accentButtonBg: '#059669', // emerald-600
|
|
49
|
+
modalBg: '#1f2937', // gray-800
|
|
50
|
+
borderColor: '#374151', // gray-700
|
|
51
|
+
separatorLine: '#374151',
|
|
52
|
+
secondaryText: '#9ca3af', // gray-400
|
|
53
|
+
primaryText: '#ffffff',
|
|
54
|
+
},
|
|
55
|
+
fontFamily: 'Inter, system-ui, sans-serif',
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
// ===== Component =====
|
|
59
|
+
|
|
60
|
+
export function OneConnectButton({
|
|
61
|
+
label = 'Connect Wallet',
|
|
62
|
+
theme = 'dark',
|
|
63
|
+
className,
|
|
64
|
+
style,
|
|
65
|
+
chain = base,
|
|
66
|
+
sponsorGas = true,
|
|
67
|
+
authOptions = {
|
|
68
|
+
email: true,
|
|
69
|
+
google: true,
|
|
70
|
+
apple: true,
|
|
71
|
+
discord: false,
|
|
72
|
+
passkey: true,
|
|
73
|
+
},
|
|
74
|
+
onConnect,
|
|
75
|
+
onDisconnect,
|
|
76
|
+
accountAbstraction,
|
|
77
|
+
}: OneConnectButtonProps) {
|
|
78
|
+
const client = useThirdwebClient();
|
|
79
|
+
|
|
80
|
+
// Build auth methods
|
|
81
|
+
const authMethods: string[] = ['email'];
|
|
82
|
+
if (authOptions.google) authMethods.push('google');
|
|
83
|
+
if (authOptions.apple) authMethods.push('apple');
|
|
84
|
+
if (authOptions.discord) authMethods.push('discord');
|
|
85
|
+
if (authOptions.passkey) authMethods.push('passkey');
|
|
86
|
+
|
|
87
|
+
// Create in-app wallet
|
|
88
|
+
const wallet = inAppWallet({
|
|
89
|
+
auth: {
|
|
90
|
+
options: authMethods as any[],
|
|
91
|
+
},
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
// Build connect button props
|
|
95
|
+
const connectProps: Partial<ConnectButtonProps> = {
|
|
96
|
+
client,
|
|
97
|
+
wallets: [wallet],
|
|
98
|
+
connectButton: {
|
|
99
|
+
label,
|
|
100
|
+
style: {
|
|
101
|
+
backgroundColor: ONE_THEME.colors.primaryButtonBg,
|
|
102
|
+
color: ONE_THEME.colors.primaryButtonText,
|
|
103
|
+
fontFamily: ONE_THEME.fontFamily,
|
|
104
|
+
fontWeight: 600,
|
|
105
|
+
borderRadius: '12px',
|
|
106
|
+
padding: '12px 24px',
|
|
107
|
+
...style,
|
|
108
|
+
},
|
|
109
|
+
className,
|
|
110
|
+
},
|
|
111
|
+
theme: theme === 'dark' ? 'dark' : 'light',
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
// Add account abstraction if sponsoring gas
|
|
115
|
+
if (sponsorGas || accountAbstraction) {
|
|
116
|
+
connectProps.accountAbstraction = {
|
|
117
|
+
chain: accountAbstraction?.chain || chain,
|
|
118
|
+
sponsorGas: accountAbstraction?.sponsorGas ?? sponsorGas,
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
return <ConnectButton {...(connectProps as ConnectButtonProps)} />;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// ===== Presets =====
|
|
126
|
+
|
|
127
|
+
export function OneConnectButtonSimple(props: Omit<OneConnectButtonProps, 'authOptions'>) {
|
|
128
|
+
return (
|
|
129
|
+
<OneConnectButton
|
|
130
|
+
{...props}
|
|
131
|
+
authOptions={{ email: true, google: true, apple: false, passkey: false }}
|
|
132
|
+
/>
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export function OneConnectButtonFull(props: Omit<OneConnectButtonProps, 'authOptions'>) {
|
|
137
|
+
return (
|
|
138
|
+
<OneConnectButton
|
|
139
|
+
{...props}
|
|
140
|
+
authOptions={{ email: true, google: true, apple: true, discord: true, passkey: true }}
|
|
141
|
+
/>
|
|
142
|
+
);
|
|
143
|
+
}
|
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import React, { useState, useEffect, useCallback } from 'react';
|
|
4
|
+
import { useActiveAccount } from 'thirdweb/react';
|
|
5
|
+
import { MediaRenderer } from 'thirdweb/react';
|
|
6
|
+
import { useThirdwebClient } from '../providers/ThirdwebProvider';
|
|
7
|
+
|
|
8
|
+
// ===== Types =====
|
|
9
|
+
|
|
10
|
+
export interface NFTItem {
|
|
11
|
+
id: string;
|
|
12
|
+
tokenId: string;
|
|
13
|
+
contractAddress: string;
|
|
14
|
+
name: string;
|
|
15
|
+
description?: string;
|
|
16
|
+
image?: string;
|
|
17
|
+
animationUrl?: string;
|
|
18
|
+
attributes?: Array<{ trait_type: string; value: string | number }>;
|
|
19
|
+
chain: string;
|
|
20
|
+
chainId: number;
|
|
21
|
+
collection?: {
|
|
22
|
+
name: string;
|
|
23
|
+
image?: string;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface OneNFTGalleryProps {
|
|
28
|
+
// Data source
|
|
29
|
+
nfts?: NFTItem[];
|
|
30
|
+
fetchEndpoint?: string;
|
|
31
|
+
|
|
32
|
+
// Display options
|
|
33
|
+
columns?: 2 | 3 | 4;
|
|
34
|
+
showCollection?: boolean;
|
|
35
|
+
showChain?: boolean;
|
|
36
|
+
|
|
37
|
+
// Appearance
|
|
38
|
+
theme?: 'light' | 'dark';
|
|
39
|
+
className?: string;
|
|
40
|
+
style?: React.CSSProperties;
|
|
41
|
+
|
|
42
|
+
// Callbacks
|
|
43
|
+
onNFTClick?: (nft: NFTItem) => void;
|
|
44
|
+
onTransfer?: (nft: NFTItem) => void;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// ===== Styles =====
|
|
48
|
+
|
|
49
|
+
const galleryStyle: React.CSSProperties = {
|
|
50
|
+
display: 'grid',
|
|
51
|
+
gap: '16px',
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
const cardStyle: React.CSSProperties = {
|
|
55
|
+
backgroundColor: '#1f2937',
|
|
56
|
+
borderRadius: '16px',
|
|
57
|
+
overflow: 'hidden',
|
|
58
|
+
border: '1px solid #374151',
|
|
59
|
+
cursor: 'pointer',
|
|
60
|
+
transition: 'transform 0.2s, box-shadow 0.2s',
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
const imageContainerStyle: React.CSSProperties = {
|
|
64
|
+
aspectRatio: '1',
|
|
65
|
+
backgroundColor: '#374151',
|
|
66
|
+
display: 'flex',
|
|
67
|
+
alignItems: 'center',
|
|
68
|
+
justifyContent: 'center',
|
|
69
|
+
overflow: 'hidden',
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const infoStyle: React.CSSProperties = {
|
|
73
|
+
padding: '12px',
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
// ===== Component =====
|
|
77
|
+
|
|
78
|
+
export function OneNFTGallery({
|
|
79
|
+
nfts: propNfts,
|
|
80
|
+
fetchEndpoint = '/api/v1/assets/nft',
|
|
81
|
+
columns = 3,
|
|
82
|
+
showCollection = true,
|
|
83
|
+
showChain = true,
|
|
84
|
+
theme = 'dark',
|
|
85
|
+
className,
|
|
86
|
+
style,
|
|
87
|
+
onNFTClick,
|
|
88
|
+
onTransfer,
|
|
89
|
+
}: OneNFTGalleryProps) {
|
|
90
|
+
const client = useThirdwebClient();
|
|
91
|
+
const account = useActiveAccount();
|
|
92
|
+
|
|
93
|
+
const [nfts, setNfts] = useState<NFTItem[]>(propNfts || []);
|
|
94
|
+
const [isLoading, setIsLoading] = useState(!propNfts);
|
|
95
|
+
const [error, setError] = useState<string | null>(null);
|
|
96
|
+
const [selectedNFT, setSelectedNFT] = useState<NFTItem | null>(null);
|
|
97
|
+
|
|
98
|
+
// Fetch NFTs
|
|
99
|
+
const fetchNFTs = useCallback(async () => {
|
|
100
|
+
if (!account?.address || propNfts) return;
|
|
101
|
+
|
|
102
|
+
setIsLoading(true);
|
|
103
|
+
setError(null);
|
|
104
|
+
|
|
105
|
+
try {
|
|
106
|
+
const response = await fetch(`${fetchEndpoint}?address=${account.address}`);
|
|
107
|
+
const data = await response.json();
|
|
108
|
+
|
|
109
|
+
if (data.success && data.data) {
|
|
110
|
+
setNfts(data.data.nfts || []);
|
|
111
|
+
} else {
|
|
112
|
+
setError(data.error?.message || 'Failed to fetch NFTs');
|
|
113
|
+
}
|
|
114
|
+
} catch (err) {
|
|
115
|
+
setError('Failed to load NFTs');
|
|
116
|
+
} finally {
|
|
117
|
+
setIsLoading(false);
|
|
118
|
+
}
|
|
119
|
+
}, [account?.address, fetchEndpoint, propNfts]);
|
|
120
|
+
|
|
121
|
+
useEffect(() => {
|
|
122
|
+
fetchNFTs();
|
|
123
|
+
}, [fetchNFTs]);
|
|
124
|
+
|
|
125
|
+
useEffect(() => {
|
|
126
|
+
if (propNfts) {
|
|
127
|
+
setNfts(propNfts);
|
|
128
|
+
}
|
|
129
|
+
}, [propNfts]);
|
|
130
|
+
|
|
131
|
+
const isDark = theme === 'dark';
|
|
132
|
+
|
|
133
|
+
const gridColumns = {
|
|
134
|
+
2: 'repeat(2, 1fr)',
|
|
135
|
+
3: 'repeat(3, 1fr)',
|
|
136
|
+
4: 'repeat(4, 1fr)',
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
if (isLoading) {
|
|
140
|
+
return (
|
|
141
|
+
<div className={className} style={{ ...style, textAlign: 'center', padding: '40px', color: isDark ? '#9ca3af' : '#6b7280' }}>
|
|
142
|
+
Loading NFTs...
|
|
143
|
+
</div>
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
if (error) {
|
|
148
|
+
return (
|
|
149
|
+
<div className={className} style={{ ...style, textAlign: 'center', padding: '40px', color: '#ef4444' }}>
|
|
150
|
+
{error}
|
|
151
|
+
</div>
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
if (nfts.length === 0) {
|
|
156
|
+
return (
|
|
157
|
+
<div className={className} style={{ ...style, textAlign: 'center', padding: '40px', color: isDark ? '#9ca3af' : '#6b7280' }}>
|
|
158
|
+
No NFTs found
|
|
159
|
+
</div>
|
|
160
|
+
);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
return (
|
|
164
|
+
<div className={className} style={style}>
|
|
165
|
+
<div style={{ ...galleryStyle, gridTemplateColumns: gridColumns[columns] }}>
|
|
166
|
+
{nfts.map((nft) => (
|
|
167
|
+
<div
|
|
168
|
+
key={`${nft.contractAddress}-${nft.tokenId}`}
|
|
169
|
+
style={{
|
|
170
|
+
...cardStyle,
|
|
171
|
+
backgroundColor: isDark ? '#1f2937' : '#ffffff',
|
|
172
|
+
border: `1px solid ${isDark ? '#374151' : '#e5e7eb'}`,
|
|
173
|
+
}}
|
|
174
|
+
onClick={() => {
|
|
175
|
+
setSelectedNFT(nft);
|
|
176
|
+
onNFTClick?.(nft);
|
|
177
|
+
}}
|
|
178
|
+
onMouseEnter={(e) => {
|
|
179
|
+
e.currentTarget.style.transform = 'translateY(-4px)';
|
|
180
|
+
e.currentTarget.style.boxShadow = '0 10px 40px rgba(0,0,0,0.3)';
|
|
181
|
+
}}
|
|
182
|
+
onMouseLeave={(e) => {
|
|
183
|
+
e.currentTarget.style.transform = 'translateY(0)';
|
|
184
|
+
e.currentTarget.style.boxShadow = 'none';
|
|
185
|
+
}}
|
|
186
|
+
>
|
|
187
|
+
<div style={{ ...imageContainerStyle, backgroundColor: isDark ? '#374151' : '#f3f4f6' }}>
|
|
188
|
+
{nft.image ? (
|
|
189
|
+
<MediaRenderer
|
|
190
|
+
client={client}
|
|
191
|
+
src={nft.image}
|
|
192
|
+
style={{ width: '100%', height: '100%', objectFit: 'cover' }}
|
|
193
|
+
/>
|
|
194
|
+
) : (
|
|
195
|
+
<span style={{ color: isDark ? '#6b7280' : '#9ca3af', fontSize: '14px' }}>No Image</span>
|
|
196
|
+
)}
|
|
197
|
+
</div>
|
|
198
|
+
<div style={infoStyle}>
|
|
199
|
+
<h4 style={{ margin: '0 0 4px 0', color: isDark ? '#ffffff' : '#111827', fontSize: '14px', fontWeight: 600 }}>
|
|
200
|
+
{nft.name || `#${nft.tokenId}`}
|
|
201
|
+
</h4>
|
|
202
|
+
{showCollection && nft.collection && (
|
|
203
|
+
<p style={{ margin: 0, color: isDark ? '#9ca3af' : '#6b7280', fontSize: '12px' }}>
|
|
204
|
+
{nft.collection.name}
|
|
205
|
+
</p>
|
|
206
|
+
)}
|
|
207
|
+
{showChain && (
|
|
208
|
+
<span style={{
|
|
209
|
+
display: 'inline-block',
|
|
210
|
+
marginTop: '8px',
|
|
211
|
+
padding: '2px 8px',
|
|
212
|
+
backgroundColor: isDark ? '#374151' : '#e5e7eb',
|
|
213
|
+
borderRadius: '4px',
|
|
214
|
+
fontSize: '10px',
|
|
215
|
+
color: isDark ? '#9ca3af' : '#6b7280',
|
|
216
|
+
}}>
|
|
217
|
+
{nft.chain}
|
|
218
|
+
</span>
|
|
219
|
+
)}
|
|
220
|
+
</div>
|
|
221
|
+
</div>
|
|
222
|
+
))}
|
|
223
|
+
</div>
|
|
224
|
+
|
|
225
|
+
{/* NFT Detail Modal */}
|
|
226
|
+
{selectedNFT && (
|
|
227
|
+
<div
|
|
228
|
+
style={{
|
|
229
|
+
position: 'fixed',
|
|
230
|
+
inset: 0,
|
|
231
|
+
backgroundColor: 'rgba(0,0,0,0.8)',
|
|
232
|
+
display: 'flex',
|
|
233
|
+
alignItems: 'center',
|
|
234
|
+
justifyContent: 'center',
|
|
235
|
+
zIndex: 1000,
|
|
236
|
+
}}
|
|
237
|
+
onClick={() => setSelectedNFT(null)}
|
|
238
|
+
>
|
|
239
|
+
<div
|
|
240
|
+
style={{
|
|
241
|
+
backgroundColor: isDark ? '#1f2937' : '#ffffff',
|
|
242
|
+
borderRadius: '16px',
|
|
243
|
+
padding: '24px',
|
|
244
|
+
maxWidth: '500px',
|
|
245
|
+
width: '90%',
|
|
246
|
+
maxHeight: '90vh',
|
|
247
|
+
overflow: 'auto',
|
|
248
|
+
}}
|
|
249
|
+
onClick={(e) => e.stopPropagation()}
|
|
250
|
+
>
|
|
251
|
+
{selectedNFT.image && (
|
|
252
|
+
<MediaRenderer
|
|
253
|
+
client={client}
|
|
254
|
+
src={selectedNFT.image}
|
|
255
|
+
style={{ width: '100%', borderRadius: '12px', marginBottom: '16px' }}
|
|
256
|
+
/>
|
|
257
|
+
)}
|
|
258
|
+
<h3 style={{ margin: '0 0 8px 0', color: isDark ? '#ffffff' : '#111827' }}>
|
|
259
|
+
{selectedNFT.name || `#${selectedNFT.tokenId}`}
|
|
260
|
+
</h3>
|
|
261
|
+
{selectedNFT.description && (
|
|
262
|
+
<p style={{ margin: '0 0 16px 0', color: isDark ? '#9ca3af' : '#6b7280', fontSize: '14px' }}>
|
|
263
|
+
{selectedNFT.description}
|
|
264
|
+
</p>
|
|
265
|
+
)}
|
|
266
|
+
{selectedNFT.attributes && selectedNFT.attributes.length > 0 && (
|
|
267
|
+
<div style={{ display: 'flex', flexWrap: 'wrap', gap: '8px', marginBottom: '16px' }}>
|
|
268
|
+
{selectedNFT.attributes.map((attr, i) => (
|
|
269
|
+
<div
|
|
270
|
+
key={i}
|
|
271
|
+
style={{
|
|
272
|
+
padding: '8px 12px',
|
|
273
|
+
backgroundColor: isDark ? '#374151' : '#f3f4f6',
|
|
274
|
+
borderRadius: '8px',
|
|
275
|
+
}}
|
|
276
|
+
>
|
|
277
|
+
<div style={{ fontSize: '10px', color: isDark ? '#9ca3af' : '#6b7280' }}>{attr.trait_type}</div>
|
|
278
|
+
<div style={{ fontSize: '14px', color: isDark ? '#ffffff' : '#111827', fontWeight: 500 }}>{attr.value}</div>
|
|
279
|
+
</div>
|
|
280
|
+
))}
|
|
281
|
+
</div>
|
|
282
|
+
)}
|
|
283
|
+
<div style={{ display: 'flex', gap: '12px' }}>
|
|
284
|
+
<button
|
|
285
|
+
onClick={() => setSelectedNFT(null)}
|
|
286
|
+
style={{
|
|
287
|
+
flex: 1,
|
|
288
|
+
padding: '12px',
|
|
289
|
+
backgroundColor: 'transparent',
|
|
290
|
+
border: `1px solid ${isDark ? '#374151' : '#e5e7eb'}`,
|
|
291
|
+
borderRadius: '8px',
|
|
292
|
+
color: isDark ? '#9ca3af' : '#6b7280',
|
|
293
|
+
cursor: 'pointer',
|
|
294
|
+
}}
|
|
295
|
+
>
|
|
296
|
+
Close
|
|
297
|
+
</button>
|
|
298
|
+
{onTransfer && (
|
|
299
|
+
<button
|
|
300
|
+
onClick={() => {
|
|
301
|
+
onTransfer(selectedNFT);
|
|
302
|
+
setSelectedNFT(null);
|
|
303
|
+
}}
|
|
304
|
+
style={{
|
|
305
|
+
flex: 1,
|
|
306
|
+
padding: '12px',
|
|
307
|
+
backgroundColor: '#10b981',
|
|
308
|
+
border: 'none',
|
|
309
|
+
borderRadius: '8px',
|
|
310
|
+
color: '#ffffff',
|
|
311
|
+
fontWeight: 600,
|
|
312
|
+
cursor: 'pointer',
|
|
313
|
+
}}
|
|
314
|
+
>
|
|
315
|
+
Transfer
|
|
316
|
+
</button>
|
|
317
|
+
)}
|
|
318
|
+
</div>
|
|
319
|
+
</div>
|
|
320
|
+
</div>
|
|
321
|
+
)}
|
|
322
|
+
</div>
|
|
323
|
+
);
|
|
324
|
+
}
|