11import {
22 ArrowLeftRightIcon ,
33 ChevronRightIcon ,
4- CircleAlertIcon ,
54 ExternalLinkIcon ,
65} from "lucide-react" ;
76import Link from "next/link" ;
87import type { Project } from "@/api/project/projects" ;
9- import { Alert , AlertDescription , AlertTitle } from "@/components/ui/alert" ;
108import { CodeServer } from "@/components/ui/code/code.server" ;
11- import { UnderlineLink } from "@/components/ui/UnderlineLink" ;
129import { DotNetIcon } from "@/icons/brand-icons/DotNetIcon" ;
1310import { GithubIcon } from "@/icons/brand-icons/GithubIcon" ;
1411import { ReactIcon } from "@/icons/brand-icons/ReactIcon" ;
@@ -25,7 +22,6 @@ import {
2522 type ProjectWalletSummary ,
2623} from "@/lib/server/project-wallet" ;
2724import { ClientIDSection } from "./ClientIDSection" ;
28- import { IntegrateAPIKeyCodeTabs } from "./IntegrateAPIKeyCodeTabs" ;
2925import { ProjectWalletControls } from "./ProjectWalletControls.client" ;
3026import { ProjectWalletSetup } from "./ProjectWalletSetup.client" ;
3127import { SecretKeySection } from "./SecretKeySection" ;
@@ -46,10 +42,7 @@ export async function ProjectFTUX(props: {
4642 wallet = { projectWallet }
4743 managementAccessToken = { props . managementAccessToken }
4844 />
49- < IntegrateAPIKeySection
50- project = { props . project }
51- teamSlug = { props . teamSlug }
52- />
45+ < IntegrateAPIKeySection project = { props . project } />
5346 < ProductsSection
5447 projectSlug = { props . project . slug }
5548 teamSlug = { props . teamSlug }
@@ -83,8 +76,7 @@ export function ProjectWalletSection(props: {
8376 Project Wallet
8477 </ p >
8578 < p className = "text-muted-foreground text-sm" >
86- Default managed server wallet for this project. Use it for
87- deployments, payments, and API integrations.
79+ Use it for deployments, payments, and API integrations.
8880 </ p >
8981 </ div >
9082 </ div >
@@ -121,13 +113,7 @@ export function ProjectWalletSection(props: {
121113
122114// Integrate API key section ------------------------------------------------------------
123115
124- function IntegrateAPIKeySection ( {
125- project,
126- teamSlug,
127- } : {
128- project : Project ;
129- teamSlug : string ;
130- } ) {
116+ function IntegrateAPIKeySection ( { project } : { project : Project } ) {
131117 const secretKeyMasked = project . secretKeys [ 0 ] ?. masked ;
132118 const clientId = project . publishableKey ;
133119
@@ -149,194 +135,38 @@ function IntegrateAPIKeySection({
149135 </ div >
150136
151137 < div className = "h-5" />
152- < IntegrationCodeExamples project = { project } teamSlug = { teamSlug } />
153- </ div >
154- </ section >
155- ) ;
156- }
157-
158- function IntegrationCodeExamples ( props : {
159- project : Project ;
160- teamSlug : string ;
161- } ) {
162- return (
163- < IntegrateAPIKeyCodeTabs
164- tabs = { {
165- dotnet : (
166- < div className = "flex flex-col gap-3" >
167- < CodeServer
168- className = "bg-background"
169- code = { dotNotCodeExample ( props . project ) }
170- lang = "csharp"
171- />
172- < Alert className = "bg-background" variant = "info" >
173- < CircleAlertIcon className = "size-5" />
174- < AlertTitle >
175- Configure your app's bundle ID in "Allowed Bundle IDs" in
176- Project
177- </ AlertTitle >
178- < AlertDescription className = "leading-loose" >
179- Go to{ " " }
180- < UnderlineLink
181- href = { `/team/${ props . teamSlug } /${ props . project . slug } /settings` }
182- target = "_blank"
183- >
184- Project settings
185- </ UnderlineLink > { " " }
186- and add your app's bundle ID to the "Allowed Bundle IDs" list.
187- </ AlertDescription >
188- </ Alert >
189- </ div >
190- ) ,
191- react : (
192- < CodeServer
193- className = "bg-background"
194- code = { reactCodeExample ( props . project ) }
195- lang = "ts"
196- />
197- ) ,
198- "react-native" : (
199- < CodeServer
200- className = "bg-background"
201- code = { reactCodeExample ( props . project ) }
202- lang = "ts"
203- />
204- ) ,
205- ts : (
138+ < div className = "flex flex-col gap-3" >
139+ < p className = "text-muted-foreground text-sm" >
140+ Run this command in your terminal to send a test transaction using
141+ your Project Wallet.
142+ </ p >
206143 < CodeServer
207144 className = "bg-background"
208- code = { typescriptCodeExample ( props . project ) }
209- lang = "ts"
210- />
211- ) ,
212- unity : (
213- < Alert className = "bg-background" variant = "info" >
214- < CircleAlertIcon className = "size-5" />
215- < AlertTitle >
216- Configure Client ID in Thirdweb Manager prefab
217- </ AlertTitle >
218- < AlertDescription className = "leading-loose" >
219- Configure "Client ID" and "Bundle ID" in{ " " }
220- < UnderlineLink
221- href = "https://portal.thirdweb.com/unity/v5/thirdwebmanager"
222- rel = "noopener noreferrer"
223- target = "_blank"
224- >
225- Thirdweb Manager prefab
226- </ UnderlineLink >
227- < span className = "block text-sm" >
228- Make sure to configure your app's bundle ID in "Allowed Bundle
229- IDs" in{ " " }
230- < UnderlineLink
231- href = { `/team/${ props . teamSlug } /${ props . project . slug } /settings` }
232- rel = "noopener noreferrer"
233- target = "_blank"
234- >
235- Project settings
236- </ UnderlineLink >
237- </ span >
238- </ AlertDescription >
239- </ Alert >
240- ) ,
241- unreal : (
242- < Alert className = "bg-background" variant = "info" >
243- < CircleAlertIcon className = "size-5" />
244- < AlertTitle >
245- Configure Client ID in Thirdweb Unreal Plugin{ " " }
246- </ AlertTitle >
247- < AlertDescription className = "leading-loose" >
248- Configure "Client ID" and "Bundle ID" in{ " " }
249- < UnderlineLink
250- href = "https://portal.thirdweb.com/unreal-engine/getting-started"
251- rel = "noopener noreferrer"
252- target = "_blank"
253- >
254- thirdweb plugin settings
255- </ UnderlineLink >
256- < span className = "block text-sm" >
257- Make sure to configure your app's bundle ID in "Allowed Bundle
258- IDs" in{ " " }
259- < UnderlineLink
260- href = { `/team/${ props . teamSlug } /${ props . project . slug } /settings` }
261- rel = "noopener noreferrer"
262- target = "_blank"
263- >
264- Project settings
265- </ UnderlineLink >
266- </ span >
267- </ AlertDescription >
268- </ Alert >
269- ) ,
270- api : (
271- < CodeServer
272- className = "bg-background"
273- code = { apiCodeExample ( props . project ) }
274- lang = "javascript"
275- />
276- ) ,
277- curl : (
278- < CodeServer
279- className = "bg-background"
280- code = { curlCodeExample ( props . project ) }
145+ code = { curlCodeExample ( project ) }
281146 lang = "bash"
282147 />
283- ) ,
284- } }
285- / >
148+ </ div >
149+ </ div >
150+ </ section >
286151 ) ;
287152}
288-
289- const typescriptCodeExample = ( project : Project ) => `\
290- import { createThirdwebClient } from "thirdweb";
291-
292- const client = createThirdwebClient({
293- // use clientId for client side usage
294- clientId: "${ project . publishableKey } ",
295- // use secretKey for server side usage
296- secretKey: "${ project . secretKeys [ 0 ] ?. masked } ", // replace this with full secret key
297- });` ;
298-
299- const reactCodeExample = ( project : Project ) => `\
300- import { createThirdwebClient } from "thirdweb";
301-
302- const client = createThirdwebClient({
303- clientId: "${ project . publishableKey } ",
304- });` ;
305-
306- const dotNotCodeExample = ( project : Project ) => `\
307- using Thirdweb;
308-
309- // For web applications
310- var client = ThirdwebClient.Create(clientId: "${ project . publishableKey } ");
311-
312- // For native applications - Replace "yourBundleId" with your app's bundle ID
313- var client = ThirdwebClient.Create(clientId: "${ project . publishableKey } ", bundleId: "yourBundleId");
314-
315- // For backend applications (Note: below shown secret key is not the full secret key)
316- var client = ThirdwebClient.Create(secretKey: "${ project . secretKeys [ 0 ] ?. masked } ");` ;
317-
318- const apiCodeExample = ( project : Project ) : string => `\
319- // Server-side only: replace with your full secret key. Never expose in browser code.
320- fetch('https://api.thirdweb.com/v1/wallets/server', {
321- method: 'POST',
322- headers: {
323- 'Content-Type': 'application/json',
324- 'x-secret-key': '${ project . secretKeys [ 0 ] ?. masked ?? "<YOUR_SECRET_KEY>" } '
325- },
326- body: JSON.stringify({
327- identifier: 'treasury-wallet-123'
328- })
329- });` ;
330-
331153const curlCodeExample = ( project : Project ) : string => `\
332- // Server-side only: replace with your full secret key. Never expose in browser code.
333- curl https://api.thirdweb.com/v1/wallets/server \\
154+ curl https://api.thirdweb.com/v1/transactions \\
334155 --request POST \\
335156 --header 'Content-Type: application/json' \\
336157 --header 'x-secret-key: ${ project . secretKeys [ 0 ] ?. masked ?? "<YOUR_SECRET_KEY>" } ' \\
337158 --data '{
338- "identifier": "treasury-wallet-123"
339- }'` ;
159+ "chainId": 421614,
160+ "transactions": [
161+ {
162+ "data": "0x",
163+ "to": "vitalik.eth",
164+ "value": "0"
165+ }
166+ ]
167+ }'
168+ ` ;
169+
340170// products section ------------------------------------------------------------
341171
342172function ProductsSection ( props : { teamSlug : string ; projectSlug : string } ) {
0 commit comments