@jerydam/lumina-sdk 0.1.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/BUTTON_FIXES.md +59 -0
- package/DOCS_INDEX.md +332 -0
- package/DOCUMENTATION.md +252 -0
- package/DOCUMENTATION_BUILD_SUMMARY.md +376 -0
- package/DOCUMENTATION_COMPLETE.md +311 -0
- package/FEATURES.md +333 -0
- package/Lumina-sdk/src/components/lumina-provider.tsx +46 -0
- package/Lumina-sdk/src/components/transaction-confirm.tsx +242 -0
- package/Lumina-sdk/src/components/wallet-display.tsx +157 -0
- package/Lumina-sdk/src/components/wallet-login.tsx +163 -0
- package/Lumina-sdk/src/hooks/use-mobile.ts +19 -0
- package/Lumina-sdk/src/hooks/use-toast.ts +191 -0
- package/Lumina-sdk/src/index.ts +0 -0
- package/Lumina-sdk/src/lib/api.ts +66 -0
- package/Lumina-sdk/src/lib/utils.ts +6 -0
- package/Lumina-sdk/src/package.json +42 -0
- package/Lumina-sdk/src/tsconfig.json +19 -0
- package/NEW_FILES_MANIFEST.txt +146 -0
- package/README.md +298 -0
- package/app/dashboard/analytics/page.tsx +218 -0
- package/app/dashboard/api-keys/page.tsx +260 -0
- package/app/dashboard/billing/page.tsx +412 -0
- package/app/dashboard/integration/page.tsx +185 -0
- package/app/dashboard/layout.tsx +18 -0
- package/app/dashboard/page.tsx +244 -0
- package/app/dashboard/settings/page.tsx +285 -0
- package/app/dashboard/users/page.tsx +148 -0
- package/app/docs/api/authentication/page.tsx +246 -0
- package/app/docs/api/endpoints/page.tsx +397 -0
- package/app/docs/api/errors/page.tsx +305 -0
- package/app/docs/api/overview/page.tsx +306 -0
- package/app/docs/examples/basic-setup/page.tsx +256 -0
- package/app/docs/examples/multi-chain/page.tsx +331 -0
- package/app/docs/examples/nextjs-full-stack/page.tsx +332 -0
- package/app/docs/getting-started/environment-setup/page.tsx +243 -0
- package/app/docs/getting-started/installation/page.tsx +187 -0
- package/app/docs/getting-started/introduction/page.tsx +178 -0
- package/app/docs/getting-started/quick-start/page.tsx +199 -0
- package/app/docs/guides/nextjs/page.tsx +358 -0
- package/app/docs/guides/react/page.tsx +230 -0
- package/app/docs/guides/security/page.tsx +284 -0
- package/app/docs/layout.tsx +32 -0
- package/app/docs/page.tsx +180 -0
- package/app/docs/sdk/lumina-provider/page.tsx +186 -0
- package/app/docs/sdk/transaction-confirm/page.tsx +331 -0
- package/app/docs/sdk/wallet-display/page.tsx +224 -0
- package/app/docs/sdk/wallet-login/page.tsx +207 -0
- package/app/docs/troubleshooting/common-issues/page.tsx +301 -0
- package/app/docs/troubleshooting/faq/page.tsx +105 -0
- package/app/globals.css +125 -0
- package/app/invite/[token]/page.tsx +78 -0
- package/app/layout.tsx +36 -0
- package/app/login/page.tsx +175 -0
- package/app/page.tsx +336 -0
- package/app/sdk-demo/page.tsx +239 -0
- package/components/dashboard-sidebar.tsx +113 -0
- package/components/docs/breadcrumb.tsx +51 -0
- package/components/docs/callout.tsx +53 -0
- package/components/docs/code-block.tsx +77 -0
- package/components/docs/docs-sidebar.tsx +214 -0
- package/components/docs/table-of-contents.tsx +83 -0
- package/components/sdk/lumina-provider.tsx +46 -0
- package/components/sdk/transaction-confirm.tsx +242 -0
- package/components/sdk/wallet-display.tsx +157 -0
- package/components/sdk/wallet-login.tsx +163 -0
- package/components/theme-provider.tsx +11 -0
- package/components/ui/accordion.tsx +66 -0
- package/components/ui/alert-dialog.tsx +157 -0
- package/components/ui/alert.tsx +66 -0
- package/components/ui/aspect-ratio.tsx +11 -0
- package/components/ui/avatar.tsx +53 -0
- package/components/ui/badge.tsx +46 -0
- package/components/ui/breadcrumb.tsx +109 -0
- package/components/ui/button-group.tsx +83 -0
- package/components/ui/button.tsx +60 -0
- package/components/ui/calendar.tsx +213 -0
- package/components/ui/card.tsx +92 -0
- package/components/ui/carousel.tsx +241 -0
- package/components/ui/chart.tsx +351 -0
- package/components/ui/checkbox.tsx +32 -0
- package/components/ui/collapsible.tsx +33 -0
- package/components/ui/command.tsx +184 -0
- package/components/ui/context-menu.tsx +252 -0
- package/components/ui/dialog.tsx +143 -0
- package/components/ui/drawer.tsx +135 -0
- package/components/ui/dropdown-menu.tsx +257 -0
- package/components/ui/empty.tsx +104 -0
- package/components/ui/field.tsx +244 -0
- package/components/ui/form.tsx +167 -0
- package/components/ui/hover-card.tsx +44 -0
- package/components/ui/input-group.tsx +169 -0
- package/components/ui/input-otp.tsx +77 -0
- package/components/ui/input.tsx +21 -0
- package/components/ui/item.tsx +193 -0
- package/components/ui/kbd.tsx +28 -0
- package/components/ui/label.tsx +24 -0
- package/components/ui/menubar.tsx +276 -0
- package/components/ui/navigation-menu.tsx +166 -0
- package/components/ui/pagination.tsx +127 -0
- package/components/ui/popover.tsx +48 -0
- package/components/ui/progress.tsx +31 -0
- package/components/ui/radio-group.tsx +45 -0
- package/components/ui/resizable.tsx +56 -0
- package/components/ui/scroll-area.tsx +58 -0
- package/components/ui/select.tsx +185 -0
- package/components/ui/separator.tsx +28 -0
- package/components/ui/sheet.tsx +139 -0
- package/components/ui/sidebar.tsx +726 -0
- package/components/ui/skeleton.tsx +13 -0
- package/components/ui/slider.tsx +59 -0
- package/components/ui/sonner.tsx +25 -0
- package/components/ui/spinner.tsx +16 -0
- package/components/ui/switch.tsx +29 -0
- package/components/ui/table.tsx +116 -0
- package/components/ui/tabs.tsx +66 -0
- package/components/ui/textarea.tsx +18 -0
- package/components/ui/toast.tsx +129 -0
- package/components/ui/toaster.tsx +35 -0
- package/components/ui/toggle-group.tsx +73 -0
- package/components/ui/toggle.tsx +47 -0
- package/components/ui/tooltip.tsx +61 -0
- package/components/ui/use-mobile.tsx +19 -0
- package/components/ui/use-toast.ts +191 -0
- package/components.json +21 -0
- package/hooks/use-mobile.ts +19 -0
- package/hooks/use-toast.ts +191 -0
- package/lib/api.ts +66 -0
- package/lib/utils.ts +6 -0
- package/next-env.d.ts +6 -0
- package/next.config.mjs +11 -0
- package/package.json +73 -0
- package/pnpm-workspace.yaml +5 -0
- package/postcss.config.mjs +8 -0
- package/public/apple-icon.png +0 -0
- package/public/fav.jpeg +0 -0
- package/public/fav.png +0 -0
- package/public/icon-dark-32x32.png +0 -0
- package/public/icon-light-32x32.png +0 -0
- package/public/icon.png +0 -0
- package/public/icon.svg +26 -0
- package/public/logo.jpeg +0 -0
- package/public/logo.png +0 -0
- package/public/logo2.jpeg +0 -0
- package/public/logo2.png +0 -0
- package/public/placeholder-logo.png +0 -0
- package/public/placeholder-logo.svg +1 -0
- package/public/placeholder-user.jpg +0 -0
- package/public/placeholder.jpg +0 -0
- package/public/placeholder.svg +1 -0
- package/styles/globals.css +209 -0
- package/tailwind.config.ts +15 -0
- package/tsconfig.json +41 -0
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import { Breadcrumb } from '@/components/docs/breadcrumb'
|
|
4
|
+
import { TableOfContents } from '@/components/docs/table-of-contents'
|
|
5
|
+
import { CodeBlock } from '@/components/docs/code-block'
|
|
6
|
+
import { Callout } from '@/components/docs/callout'
|
|
7
|
+
|
|
8
|
+
export default function TransactionConfirmPage() {
|
|
9
|
+
const headings = [
|
|
10
|
+
{ id: 'overview', level: 2, text: 'Overview' },
|
|
11
|
+
{ id: 'props', level: 2, text: 'Props & Configuration' },
|
|
12
|
+
{ id: 'callbacks', level: 2, text: 'Callbacks' },
|
|
13
|
+
{ id: 'transaction-flow', level: 2, text: 'Transaction Flow' },
|
|
14
|
+
{ id: 'examples', level: 2, text: 'Examples' },
|
|
15
|
+
{ id: 'error-handling', level: 2, text: 'Error Handling' },
|
|
16
|
+
]
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<div className="flex gap-8 max-w-7xl mx-auto px-4 py-8">
|
|
20
|
+
<main className="flex-1 min-w-0">
|
|
21
|
+
<Breadcrumb
|
|
22
|
+
items={[
|
|
23
|
+
{ label: 'Docs', href: '/docs' },
|
|
24
|
+
{ label: 'SDK', href: '/docs/sdk/lumina-provider' },
|
|
25
|
+
{ label: 'TransactionConfirm' },
|
|
26
|
+
]}
|
|
27
|
+
/>
|
|
28
|
+
|
|
29
|
+
<div className="mt-8 prose prose-invert max-w-none">
|
|
30
|
+
<h1>TransactionConfirm Component</h1>
|
|
31
|
+
|
|
32
|
+
<p className="text-lg text-foreground/80">
|
|
33
|
+
A secure transaction confirmation component that handles user review and approval of blockchain transactions before execution.
|
|
34
|
+
</p>
|
|
35
|
+
|
|
36
|
+
<h2 id="overview">Overview</h2>
|
|
37
|
+
<p>
|
|
38
|
+
The <code>TransactionConfirm</code> component provides a modal interface for users to review transaction details before confirmation. It handles gas estimates, fee calculations, and secure confirmation workflows.
|
|
39
|
+
</p>
|
|
40
|
+
|
|
41
|
+
<CodeBlock
|
|
42
|
+
code={`import { TransactionConfirm } from '@lumina/react'
|
|
43
|
+
|
|
44
|
+
export default function MyComponent() {
|
|
45
|
+
return (
|
|
46
|
+
<TransactionConfirm
|
|
47
|
+
transactionId="txn_123abc"
|
|
48
|
+
amount="1.5"
|
|
49
|
+
recipient="0x742d35Cc6634C0532925a3b844Bc9e7595f42e0d"
|
|
50
|
+
onConfirm={() => console.log('Confirmed')}
|
|
51
|
+
onCancel={() => console.log('Cancelled')}
|
|
52
|
+
/>
|
|
53
|
+
)
|
|
54
|
+
}`}
|
|
55
|
+
language="typescript"
|
|
56
|
+
title="Basic Usage"
|
|
57
|
+
/>
|
|
58
|
+
|
|
59
|
+
<h2 id="props">Props & Configuration</h2>
|
|
60
|
+
|
|
61
|
+
<h3>Required Props</h3>
|
|
62
|
+
<CodeBlock
|
|
63
|
+
code={`interface TransactionConfirmProps {
|
|
64
|
+
// Transaction identifier
|
|
65
|
+
transactionId: string
|
|
66
|
+
|
|
67
|
+
// Amount to send (in token units)
|
|
68
|
+
amount: string
|
|
69
|
+
|
|
70
|
+
// Recipient wallet address
|
|
71
|
+
recipient: string
|
|
72
|
+
|
|
73
|
+
// Token symbol (e.g., 'ETH', 'USDC')
|
|
74
|
+
tokenSymbol?: string
|
|
75
|
+
|
|
76
|
+
// Transaction type
|
|
77
|
+
type?: 'send' | 'swap' | 'stake' | 'contract'
|
|
78
|
+
}`}
|
|
79
|
+
language="typescript"
|
|
80
|
+
title="Required Props"
|
|
81
|
+
/>
|
|
82
|
+
|
|
83
|
+
<h3>Optional Props</h3>
|
|
84
|
+
<CodeBlock
|
|
85
|
+
code={`interface TransactionConfirmProps {
|
|
86
|
+
// Gas settings
|
|
87
|
+
gasLimit?: string
|
|
88
|
+
gasPrice?: string
|
|
89
|
+
maxFeePerGas?: string
|
|
90
|
+
maxPriorityFeePerGas?: string
|
|
91
|
+
|
|
92
|
+
// Network
|
|
93
|
+
chainId?: number
|
|
94
|
+
networkName?: string
|
|
95
|
+
|
|
96
|
+
// Display options
|
|
97
|
+
showGasDetails?: boolean
|
|
98
|
+
showEstimatedTime?: boolean
|
|
99
|
+
theme?: 'light' | 'dark'
|
|
100
|
+
|
|
101
|
+
// Validation
|
|
102
|
+
maxSlippage?: number
|
|
103
|
+
skipValidation?: boolean
|
|
104
|
+
|
|
105
|
+
// Metadata
|
|
106
|
+
metadata?: Record<string, any>
|
|
107
|
+
}`}
|
|
108
|
+
language="typescript"
|
|
109
|
+
title="Optional Props"
|
|
110
|
+
/>
|
|
111
|
+
|
|
112
|
+
<h2 id="callbacks">Callbacks</h2>
|
|
113
|
+
|
|
114
|
+
<CodeBlock
|
|
115
|
+
code={`interface TransactionConfirmProps {
|
|
116
|
+
// Called when user confirms transaction
|
|
117
|
+
onConfirm: (confirmationData: {
|
|
118
|
+
transactionId: string
|
|
119
|
+
hash: string
|
|
120
|
+
signature: string
|
|
121
|
+
timestamp: number
|
|
122
|
+
}) => void | Promise<void>
|
|
123
|
+
|
|
124
|
+
// Called when user cancels
|
|
125
|
+
onCancel: () => void
|
|
126
|
+
|
|
127
|
+
// Called on error
|
|
128
|
+
onError?: (error: {
|
|
129
|
+
code: string
|
|
130
|
+
message: string
|
|
131
|
+
}) => void
|
|
132
|
+
|
|
133
|
+
// Called when transaction completes
|
|
134
|
+
onComplete?: (receipt: {
|
|
135
|
+
hash: string
|
|
136
|
+
blockNumber: number
|
|
137
|
+
gasUsed: string
|
|
138
|
+
status: 'success' | 'failed'
|
|
139
|
+
}) => void
|
|
140
|
+
}`}
|
|
141
|
+
language="typescript"
|
|
142
|
+
title="Callback Functions"
|
|
143
|
+
/>
|
|
144
|
+
|
|
145
|
+
<h2 id="transaction-flow">Transaction Flow</h2>
|
|
146
|
+
|
|
147
|
+
<p>
|
|
148
|
+
The TransactionConfirm component follows a specific flow:
|
|
149
|
+
</p>
|
|
150
|
+
|
|
151
|
+
<CodeBlock
|
|
152
|
+
code={`1. User initiates transaction
|
|
153
|
+
↓
|
|
154
|
+
2. TransactionConfirm modal opens
|
|
155
|
+
↓
|
|
156
|
+
3. Display transaction details:
|
|
157
|
+
- From/To addresses
|
|
158
|
+
- Amount and token
|
|
159
|
+
- Network info
|
|
160
|
+
- Gas fees
|
|
161
|
+
- Estimated time
|
|
162
|
+
↓
|
|
163
|
+
4. User reviews and clicks "Confirm"
|
|
164
|
+
↓
|
|
165
|
+
5. Component signs transaction
|
|
166
|
+
↓
|
|
167
|
+
6. onConfirm callback invoked
|
|
168
|
+
↓
|
|
169
|
+
7. Transaction submitted to network
|
|
170
|
+
↓
|
|
171
|
+
8. onComplete callback invoked`}
|
|
172
|
+
language="text"
|
|
173
|
+
title="Transaction Lifecycle"
|
|
174
|
+
/>
|
|
175
|
+
|
|
176
|
+
<h2 id="examples">Examples</h2>
|
|
177
|
+
|
|
178
|
+
<h3>Basic ETH Transfer</h3>
|
|
179
|
+
<CodeBlock
|
|
180
|
+
code={`'use client'
|
|
181
|
+
|
|
182
|
+
import { useState } from 'react'
|
|
183
|
+
import { TransactionConfirm } from '@lumina/react'
|
|
184
|
+
|
|
185
|
+
export default function TransferETH() {
|
|
186
|
+
const [txId, setTxId] = useState(null)
|
|
187
|
+
const [status, setStatus] = useState('idle')
|
|
188
|
+
|
|
189
|
+
const handleConfirm = async (confirmationData) => {
|
|
190
|
+
setStatus('confirming')
|
|
191
|
+
try {
|
|
192
|
+
const response = await fetch('/api/confirm-transaction', {
|
|
193
|
+
method: 'POST',
|
|
194
|
+
body: JSON.stringify(confirmationData),
|
|
195
|
+
})
|
|
196
|
+
setStatus('success')
|
|
197
|
+
} catch (error) {
|
|
198
|
+
setStatus('error')
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
return (
|
|
203
|
+
<TransactionConfirm
|
|
204
|
+
transactionId={txId}
|
|
205
|
+
amount="2.5"
|
|
206
|
+
recipient="0x742d35Cc6634C0532925a3b844Bc9e7595f42e0d"
|
|
207
|
+
tokenSymbol="ETH"
|
|
208
|
+
chainId={1}
|
|
209
|
+
onConfirm={handleConfirm}
|
|
210
|
+
onCancel={() => setTxId(null)}
|
|
211
|
+
/>
|
|
212
|
+
)
|
|
213
|
+
}`}
|
|
214
|
+
language="typescript"
|
|
215
|
+
title="ETH Transfer Example"
|
|
216
|
+
/>
|
|
217
|
+
|
|
218
|
+
<h3>Token Swap with Gas Details</h3>
|
|
219
|
+
<CodeBlock
|
|
220
|
+
code={`<TransactionConfirm
|
|
221
|
+
transactionId="txn_swap_123"
|
|
222
|
+
amount="100"
|
|
223
|
+
recipient="0x1111111254fb6c44bac0bed2854e76f90643097d"
|
|
224
|
+
tokenSymbol="USDC"
|
|
225
|
+
type="swap"
|
|
226
|
+
chainId={1}
|
|
227
|
+
showGasDetails={true}
|
|
228
|
+
showEstimatedTime={true}
|
|
229
|
+
maxSlippage={0.5}
|
|
230
|
+
onConfirm={async (data) => {
|
|
231
|
+
console.log('Swap confirmed:', data)
|
|
232
|
+
const tx = await submitSwap(data)
|
|
233
|
+
console.log('Swap hash:', tx.hash)
|
|
234
|
+
}}
|
|
235
|
+
onError={(error) => {
|
|
236
|
+
console.error('Swap error:', error.message)
|
|
237
|
+
}}
|
|
238
|
+
onComplete={(receipt) => {
|
|
239
|
+
console.log('Swap complete:', receipt.status)
|
|
240
|
+
}}
|
|
241
|
+
/>`}
|
|
242
|
+
language="typescript"
|
|
243
|
+
title="Swap with Gas Details"
|
|
244
|
+
/>
|
|
245
|
+
|
|
246
|
+
<h3>Staking with Contract Interaction</h3>
|
|
247
|
+
<CodeBlock
|
|
248
|
+
code={`<TransactionConfirm
|
|
249
|
+
transactionId="txn_stake_456"
|
|
250
|
+
amount="10"
|
|
251
|
+
recipient="0x1234567890123456789012345678901234567890"
|
|
252
|
+
type="contract"
|
|
253
|
+
chainId={1}
|
|
254
|
+
metadata={{
|
|
255
|
+
contractMethod: 'stake',
|
|
256
|
+
stakingPeriod: '30days',
|
|
257
|
+
expectedYield: '12.5%',
|
|
258
|
+
}}
|
|
259
|
+
onConfirm={async (confirmationData) => {
|
|
260
|
+
// Handle stake confirmation
|
|
261
|
+
const stakeTx = await stakeTokens(confirmationData)
|
|
262
|
+
console.log('Staking initiated:', stakeTx.hash)
|
|
263
|
+
}}
|
|
264
|
+
/>`}
|
|
265
|
+
language="typescript"
|
|
266
|
+
title="Contract Interaction"
|
|
267
|
+
/>
|
|
268
|
+
|
|
269
|
+
<h2 id="error-handling">Error Handling</h2>
|
|
270
|
+
|
|
271
|
+
<p>
|
|
272
|
+
Handle various error scenarios:
|
|
273
|
+
</p>
|
|
274
|
+
|
|
275
|
+
<CodeBlock
|
|
276
|
+
code={`<TransactionConfirm
|
|
277
|
+
transactionId={txId}
|
|
278
|
+
amount="1.0"
|
|
279
|
+
recipient={recipientAddress}
|
|
280
|
+
onConfirm={handleConfirm}
|
|
281
|
+
onError={(error) => {
|
|
282
|
+
switch (error.code) {
|
|
283
|
+
case 'INSUFFICIENT_BALANCE':
|
|
284
|
+
console.error('User has insufficient balance')
|
|
285
|
+
break
|
|
286
|
+
case 'INVALID_RECIPIENT':
|
|
287
|
+
console.error('Invalid recipient address')
|
|
288
|
+
break
|
|
289
|
+
case 'GAS_ESTIMATION_FAILED':
|
|
290
|
+
console.error('Failed to estimate gas')
|
|
291
|
+
break
|
|
292
|
+
case 'SIGNATURE_REJECTED':
|
|
293
|
+
console.error('User rejected signature request')
|
|
294
|
+
break
|
|
295
|
+
case 'NETWORK_ERROR':
|
|
296
|
+
console.error('Network connectivity issue')
|
|
297
|
+
break
|
|
298
|
+
default:
|
|
299
|
+
console.error('Unknown error:', error.message)
|
|
300
|
+
}
|
|
301
|
+
}}
|
|
302
|
+
/>`}
|
|
303
|
+
language="typescript"
|
|
304
|
+
title="Error Handling"
|
|
305
|
+
/>
|
|
306
|
+
|
|
307
|
+
<Callout type="info">
|
|
308
|
+
TransactionConfirm automatically handles gas estimation and fee calculation for the selected network.
|
|
309
|
+
</Callout>
|
|
310
|
+
|
|
311
|
+
<Callout type="warning">
|
|
312
|
+
Always wait for the onConfirm callback before submitting the transaction. Never bypass the confirmation step.
|
|
313
|
+
</Callout>
|
|
314
|
+
</div>
|
|
315
|
+
|
|
316
|
+
<div className="flex justify-between mt-12 pt-8 border-t border-white/10">
|
|
317
|
+
<a href="/docs/sdk/wallet-display" className="text-emerald-400 hover:text-emerald-300">
|
|
318
|
+
← Wallet Display
|
|
319
|
+
</a>
|
|
320
|
+
<a href="/docs/api/overview" className="text-emerald-400 hover:text-emerald-300">
|
|
321
|
+
API Overview →
|
|
322
|
+
</a>
|
|
323
|
+
</div>
|
|
324
|
+
</main>
|
|
325
|
+
|
|
326
|
+
<aside className="hidden lg:block w-64 flex-shrink-0">
|
|
327
|
+
<TableOfContents headings={headings} />
|
|
328
|
+
</aside>
|
|
329
|
+
</div>
|
|
330
|
+
)
|
|
331
|
+
}
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
import { Breadcrumb } from '@/components/docs/breadcrumb'
|
|
2
|
+
import { CodeBlock } from '@/components/docs/code-block'
|
|
3
|
+
import { Callout } from '@/components/docs/callout'
|
|
4
|
+
|
|
5
|
+
export const metadata = {
|
|
6
|
+
title: 'WalletDisplay - SDK Reference',
|
|
7
|
+
description: 'Show wallet details and enable send/receive with WalletDisplay.',
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export default function WalletDisplayPage() {
|
|
11
|
+
return (
|
|
12
|
+
<>
|
|
13
|
+
<Breadcrumb />
|
|
14
|
+
|
|
15
|
+
<div className="space-y-8">
|
|
16
|
+
<div className="space-y-4">
|
|
17
|
+
<h1 className="text-4xl font-bold text-white">WalletDisplay</h1>
|
|
18
|
+
<p className="text-lg text-foreground/80">
|
|
19
|
+
Display wallet information including balance, address, and allow users to send or receive funds. Includes copy-to-clipboard and address explorer links.
|
|
20
|
+
</p>
|
|
21
|
+
</div>
|
|
22
|
+
|
|
23
|
+
<div className="space-y-4">
|
|
24
|
+
<h2 className="text-2xl font-bold">Basic Usage</h2>
|
|
25
|
+
<CodeBlock
|
|
26
|
+
code={`'use client'
|
|
27
|
+
|
|
28
|
+
import { WalletDisplay } from '@lumina/sdk'
|
|
29
|
+
|
|
30
|
+
export default function WalletPage() {
|
|
31
|
+
return (
|
|
32
|
+
<WalletDisplay
|
|
33
|
+
address="0x742d35Cc6634C0532925a3b844Bc1e8181f42f9f"
|
|
34
|
+
balance="5.234"
|
|
35
|
+
network="ethereum"
|
|
36
|
+
/>
|
|
37
|
+
)
|
|
38
|
+
}`}
|
|
39
|
+
language="tsx"
|
|
40
|
+
/>
|
|
41
|
+
</div>
|
|
42
|
+
|
|
43
|
+
<div className="space-y-4">
|
|
44
|
+
<h2 className="text-2xl font-bold">Props</h2>
|
|
45
|
+
<div className="space-y-4">
|
|
46
|
+
<div className="p-4 rounded-lg bg-white/5 border border-white/10">
|
|
47
|
+
<p className="font-semibold text-emerald-400 mb-2">address</p>
|
|
48
|
+
<p className="text-sm text-foreground/80 mb-2">
|
|
49
|
+
<span className="text-red-400">Required</span> • <span className="text-blue-400">string</span>
|
|
50
|
+
</p>
|
|
51
|
+
<p className="text-sm text-foreground/80">
|
|
52
|
+
The wallet address to display. Should be a valid Ethereum address.
|
|
53
|
+
</p>
|
|
54
|
+
</div>
|
|
55
|
+
|
|
56
|
+
<div className="p-4 rounded-lg bg-white/5 border border-white/10">
|
|
57
|
+
<p className="font-semibold text-emerald-400 mb-2">balance</p>
|
|
58
|
+
<p className="text-sm text-foreground/80 mb-2">
|
|
59
|
+
<span className="text-red-400">Required</span> • <span className="text-blue-400">string | number</span>
|
|
60
|
+
</p>
|
|
61
|
+
<p className="text-sm text-foreground/80">
|
|
62
|
+
The account balance in native currency (ETH, MATIC, etc).
|
|
63
|
+
</p>
|
|
64
|
+
</div>
|
|
65
|
+
|
|
66
|
+
<div className="p-4 rounded-lg bg-white/5 border border-white/10">
|
|
67
|
+
<p className="font-semibold text-emerald-400 mb-2">network</p>
|
|
68
|
+
<p className="text-sm text-foreground/80 mb-2">
|
|
69
|
+
<span className="text-red-400">Required</span> • <span className="text-blue-400">'ethereum' | 'polygon' | 'arbitrum' | 'optimism'</span>
|
|
70
|
+
</p>
|
|
71
|
+
<p className="text-sm text-foreground/80">
|
|
72
|
+
The blockchain network. Used for explorer links and asset prices.
|
|
73
|
+
</p>
|
|
74
|
+
</div>
|
|
75
|
+
|
|
76
|
+
<div className="p-4 rounded-lg bg-white/5 border border-white/10">
|
|
77
|
+
<p className="font-semibold text-emerald-400 mb-2">onSend</p>
|
|
78
|
+
<p className="text-sm text-foreground/80 mb-2">
|
|
79
|
+
<span className="text-green-400">Optional</span> • <span className="text-blue-400">() => void</span>
|
|
80
|
+
</p>
|
|
81
|
+
<p className="text-sm text-foreground/80">
|
|
82
|
+
Callback when the "Send" button is clicked.
|
|
83
|
+
</p>
|
|
84
|
+
</div>
|
|
85
|
+
|
|
86
|
+
<div className="p-4 rounded-lg bg-white/5 border border-white/10">
|
|
87
|
+
<p className="font-semibold text-emerald-400 mb-2">onReceive</p>
|
|
88
|
+
<p className="text-sm text-foreground/80 mb-2">
|
|
89
|
+
<span className="text-green-400">Optional</span> • <span className="text-blue-400">() => void</span>
|
|
90
|
+
</p>
|
|
91
|
+
<p className="text-sm text-foreground/80">
|
|
92
|
+
Callback when the "Receive" button is clicked.
|
|
93
|
+
</p>
|
|
94
|
+
</div>
|
|
95
|
+
|
|
96
|
+
<div className="p-4 rounded-lg bg-white/5 border border-white/10">
|
|
97
|
+
<p className="font-semibold text-emerald-400 mb-2">showTokens</p>
|
|
98
|
+
<p className="text-sm text-foreground/80 mb-2">
|
|
99
|
+
<span className="text-green-400">Optional</span> • <span className="text-blue-400">boolean</span>
|
|
100
|
+
</p>
|
|
101
|
+
<p className="text-sm text-foreground/80">
|
|
102
|
+
Show list of ERC-20 tokens. Defaults to true.
|
|
103
|
+
</p>
|
|
104
|
+
</div>
|
|
105
|
+
</div>
|
|
106
|
+
</div>
|
|
107
|
+
|
|
108
|
+
<div className="space-y-4">
|
|
109
|
+
<h2 className="text-2xl font-bold">With Callbacks</h2>
|
|
110
|
+
<CodeBlock
|
|
111
|
+
code={`<WalletDisplay
|
|
112
|
+
address="0x742d35Cc6634C0532925a3b844Bc1e8181f42f9f"
|
|
113
|
+
balance="5.234"
|
|
114
|
+
network="ethereum"
|
|
115
|
+
showTokens={true}
|
|
116
|
+
onSend={() => {
|
|
117
|
+
console.log('Send button clicked')
|
|
118
|
+
// Open send modal or navigate
|
|
119
|
+
}}
|
|
120
|
+
onReceive={() => {
|
|
121
|
+
console.log('Receive button clicked')
|
|
122
|
+
// Show QR code or copy address
|
|
123
|
+
}}
|
|
124
|
+
/>`}
|
|
125
|
+
language="tsx"
|
|
126
|
+
/>
|
|
127
|
+
</div>
|
|
128
|
+
|
|
129
|
+
<div className="space-y-4">
|
|
130
|
+
<h2 className="text-2xl font-bold">Full Example with Sending</h2>
|
|
131
|
+
<CodeBlock
|
|
132
|
+
code={`'use client'
|
|
133
|
+
|
|
134
|
+
import { useState } from 'react'
|
|
135
|
+
import { WalletDisplay, TransactionConfirm } from '@lumina/sdk'
|
|
136
|
+
|
|
137
|
+
export default function WalletPage() {
|
|
138
|
+
const [showSendModal, setShowSendModal] = useState(false)
|
|
139
|
+
const [recipient, setRecipient] = useState('')
|
|
140
|
+
|
|
141
|
+
return (
|
|
142
|
+
<div className="p-8 space-y-6">
|
|
143
|
+
<WalletDisplay
|
|
144
|
+
address="0x742d35Cc6634C0532925a3b844Bc1e8181f42f9f"
|
|
145
|
+
balance="5.234"
|
|
146
|
+
network="ethereum"
|
|
147
|
+
onSend={() => setShowSendModal(true)}
|
|
148
|
+
/>
|
|
149
|
+
|
|
150
|
+
{showSendModal && (
|
|
151
|
+
<div className="fixed inset-0 bg-black/50 flex items-center justify-center">
|
|
152
|
+
<div className="bg-card p-6 rounded-lg max-w-md">
|
|
153
|
+
<h2 className="text-xl font-bold mb-4">Send ETH</h2>
|
|
154
|
+
<input
|
|
155
|
+
type="text"
|
|
156
|
+
placeholder="Recipient address"
|
|
157
|
+
value={recipient}
|
|
158
|
+
onChange={(e) => setRecipient(e.target.value)}
|
|
159
|
+
className="w-full px-4 py-2 rounded-lg bg-white/10 border border-white/20 mb-4"
|
|
160
|
+
/>
|
|
161
|
+
<button
|
|
162
|
+
onClick={() => setShowSendModal(false)}
|
|
163
|
+
className="w-full px-4 py-2 bg-emerald-600 rounded-lg hover:bg-emerald-700"
|
|
164
|
+
>
|
|
165
|
+
Proceed
|
|
166
|
+
</button>
|
|
167
|
+
</div>
|
|
168
|
+
</div>
|
|
169
|
+
)}
|
|
170
|
+
</div>
|
|
171
|
+
)
|
|
172
|
+
}`}
|
|
173
|
+
language="tsx"
|
|
174
|
+
/>
|
|
175
|
+
</div>
|
|
176
|
+
|
|
177
|
+
<div className="space-y-4">
|
|
178
|
+
<h2 className="text-2xl font-bold">Supported Networks</h2>
|
|
179
|
+
<div className="grid grid-cols-2 gap-4">
|
|
180
|
+
{[
|
|
181
|
+
{ name: 'Ethereum', id: 'ethereum' },
|
|
182
|
+
{ name: 'Polygon', id: 'polygon' },
|
|
183
|
+
{ name: 'Arbitrum', id: 'arbitrum' },
|
|
184
|
+
{ name: 'Optimism', id: 'optimism' },
|
|
185
|
+
{ name: 'Base', id: 'base' },
|
|
186
|
+
{ name: 'Avalanche', id: 'avalanche' },
|
|
187
|
+
].map((network) => (
|
|
188
|
+
<div key={network.id} className="p-3 rounded-lg bg-white/5 border border-white/10">
|
|
189
|
+
<p className="font-semibold text-emerald-400">{network.name}</p>
|
|
190
|
+
<p className="text-xs text-foreground/60">{network.id}</p>
|
|
191
|
+
</div>
|
|
192
|
+
))}
|
|
193
|
+
</div>
|
|
194
|
+
</div>
|
|
195
|
+
|
|
196
|
+
<Callout type="info" title="Token List Updates">
|
|
197
|
+
The token list is automatically updated every 24 hours. For a fresh list, call the <code className="bg-black/40 px-2 py-1 rounded text-xs">refreshTokens()</code> method.
|
|
198
|
+
</Callout>
|
|
199
|
+
|
|
200
|
+
<div className="space-y-4">
|
|
201
|
+
<h2 className="text-2xl font-bold">Customizing Display</h2>
|
|
202
|
+
<CodeBlock
|
|
203
|
+
code={`// Hide tokens for a minimal display
|
|
204
|
+
<WalletDisplay
|
|
205
|
+
address={address}
|
|
206
|
+
balance={balance}
|
|
207
|
+
network="ethereum"
|
|
208
|
+
showTokens={false}
|
|
209
|
+
/>
|
|
210
|
+
|
|
211
|
+
// Always show all tokens
|
|
212
|
+
<WalletDisplay
|
|
213
|
+
address={address}
|
|
214
|
+
balance={balance}
|
|
215
|
+
network="ethereum"
|
|
216
|
+
showTokens={true}
|
|
217
|
+
/>`}
|
|
218
|
+
language="tsx"
|
|
219
|
+
/>
|
|
220
|
+
</div>
|
|
221
|
+
</div>
|
|
222
|
+
</>
|
|
223
|
+
)
|
|
224
|
+
}
|