@getpara/create-para-app 0.1.0 → 0.3.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.
@@ -1,55 +1,45 @@
1
- export function getEnvFileContent(apiKey: string, isNext: boolean): string {
2
- return isNext ? `NEXT_PUBLIC_PARA_API_KEY=${apiKey}\n` : `VITE_PARA_API_KEY=${apiKey}\n`;
1
+ export function getEnvFileContent(apiKey, isNext) {
2
+ return isNext ? `NEXT_PUBLIC_PARA_API_KEY=${apiKey}\n` : `VITE_PARA_API_KEY=${apiKey}\n`;
3
3
  }
4
-
5
- export function getParaClientCode(isNext: boolean, isTypescript: boolean): string {
6
- if (isNext && !isTypescript) {
7
- return `import { Environment, ParaWeb } from "@getpara/react-sdk";
4
+ export function getParaClientCode(isNext, isTypescript) {
5
+ if (isNext && !isTypescript) {
6
+ return `import { Environment, ParaWeb } from "@getpara/react-sdk";
8
7
 
9
8
  const API_KEY = process.env.NEXT_PUBLIC_PARA_API_KEY;
10
9
  export const para = new ParaWeb(Environment.BETA, API_KEY);
11
10
  `;
12
- }
13
- if (isNext && isTypescript) {
14
- return `import { Environment, ParaWeb } from "@getpara/react-sdk";
11
+ }
12
+ if (isNext && isTypescript) {
13
+ return `import { Environment, ParaWeb } from "@getpara/react-sdk";
15
14
 
16
15
  const API_KEY: string | undefined = process.env.NEXT_PUBLIC_PARA_API_KEY;
17
16
  export const para = new ParaWeb(Environment.BETA, API_KEY || "");
18
17
  `;
19
- }
20
- if (!isNext && !isTypescript) {
21
- return `import { Environment, ParaWeb } from "@getpara/react-sdk";
18
+ }
19
+ if (!isNext && !isTypescript) {
20
+ return `import { Environment, ParaWeb } from "@getpara/react-sdk";
22
21
 
23
22
  const API_KEY = import.meta.env.VITE_PARA_API_KEY;
24
23
  export const para = new ParaWeb(Environment.BETA, API_KEY);
25
24
  `;
26
- }
27
- return `import { Environment, ParaWeb } from "@getpara/react-sdk";
25
+ }
26
+ return `import { Environment, ParaWeb } from "@getpara/react-sdk";
28
27
 
29
28
  const API_KEY: string | undefined = import.meta.env.VITE_PARA_API_KEY;
30
29
  export const para = new ParaWeb(Environment.BETA, API_KEY || "");
31
30
  `;
32
31
  }
33
-
34
- export function getWalletProviderCodeNextjs(networks: string[], noAppRouter: boolean): { fileName: string; code: string }[] {
35
- const result: { fileName: string; code: string }[] = [];
36
- if (!noAppRouter) {
37
- const lines: string[] = [];
38
- lines.push(
39
- `"use client";`,
40
- `import React, { PropsWithChildren } from "react";`,
41
- `import { para } from "@/client/para";`,
42
- `import { QueryClient, QueryClientProvider } from "@tanstack/react-query";`,
43
- );
44
- let needQueryClient = false;
45
- let nest = '{children}';
46
- if (networks.includes('evm')) {
47
- needQueryClient = true;
48
- lines.push(
49
- `import { ParaEvmProvider, walletConnectWallet, metaMaskWallet, rabbyWallet, rainbowWallet, coinbaseWallet, zerionWallet } from "@getpara/evm-wallet-connectors";`,
50
- `import { sepolia, celo, mainnet, polygon } from "wagmi/chains";`,
51
- );
52
- nest = `
32
+ export function getWalletProviderCodeNextjs(networks, noAppRouter) {
33
+ const result = [];
34
+ if (!noAppRouter) {
35
+ const lines = [];
36
+ lines.push(`"use client";`, `import React, { PropsWithChildren } from "react";`, `import { para } from "@/client/para";`, `import { QueryClient, QueryClientProvider } from "@tanstack/react-query";`);
37
+ let needQueryClient = false;
38
+ let nest = '{children}';
39
+ if (networks.includes('evm')) {
40
+ needQueryClient = true;
41
+ lines.push(`import { ParaEvmProvider, walletConnectWallet, metaMaskWallet, rabbyWallet, rainbowWallet, coinbaseWallet, zerionWallet } from "@getpara/evm-wallet-connectors";`, `import { sepolia, celo, mainnet, polygon } from "wagmi/chains";`);
42
+ nest = `
53
43
  <ParaEvmProvider
54
44
  config={{
55
45
  projectId: "YOUR_PROJECT_ID",
@@ -62,15 +52,11 @@ export function getWalletProviderCodeNextjs(networks: string[], noAppRouter: boo
62
52
  ${nest}
63
53
  </ParaEvmProvider>
64
54
  `;
65
- }
66
- if (networks.includes('solana')) {
67
- needQueryClient = true;
68
- lines.push(
69
- `import { ParaSolanaProvider, glowWallet, phantomWallet, backpackWallet } from "@getpara/solana-wallet-connectors";`,
70
- `import { WalletAdapterNetwork } from "@solana/wallet-adapter-base";`,
71
- `import { clusterApiUrl } from "@solana/web3.js";`,
72
- );
73
- nest = `
55
+ }
56
+ if (networks.includes('solana')) {
57
+ needQueryClient = true;
58
+ lines.push(`import { ParaSolanaProvider, glowWallet, phantomWallet, backpackWallet } from "@getpara/solana-wallet-connectors";`, `import { WalletAdapterNetwork } from "@solana/wallet-adapter-base";`, `import { clusterApiUrl } from "@solana/web3.js";`);
59
+ nest = `
74
60
  <ParaSolanaProvider
75
61
  endpoint={clusterApiUrl(WalletAdapterNetwork.Devnet)}
76
62
  wallets={[glowWallet, phantomWallet, backpackWallet]}
@@ -83,14 +69,11 @@ export function getWalletProviderCodeNextjs(networks: string[], noAppRouter: boo
83
69
  ${nest}
84
70
  </ParaSolanaProvider>
85
71
  `;
86
- }
87
- if (networks.includes('cosmos')) {
88
- needQueryClient = true;
89
- lines.push(
90
- `import { ParaCosmosProvider, keplrWallet, leapWallet } from "@getpara/cosmos-wallet-connectors";`,
91
- `import { cosmoshub } from "@getpara/graz/chains";`,
92
- );
93
- nest = `
72
+ }
73
+ if (networks.includes('cosmos')) {
74
+ needQueryClient = true;
75
+ lines.push(`import { ParaCosmosProvider, keplrWallet, leapWallet } from "@getpara/cosmos-wallet-connectors";`, `import { cosmoshub } from "@getpara/graz/chains";`);
76
+ nest = `
94
77
  <ParaCosmosProvider
95
78
  chains={[{
96
79
  ...cosmoshub,
@@ -107,16 +90,16 @@ export function getWalletProviderCodeNextjs(networks: string[], noAppRouter: boo
107
90
  ${nest}
108
91
  </ParaCosmosProvider>
109
92
  `;
110
- }
111
- const queryClientSetup = needQueryClient ? `const queryClient = new QueryClient();` : '';
112
- if (needQueryClient) {
113
- nest = `
93
+ }
94
+ const queryClientSetup = needQueryClient ? `const queryClient = new QueryClient();` : '';
95
+ if (needQueryClient) {
96
+ nest = `
114
97
  <QueryClientProvider client={queryClient}>
115
98
  ${nest}
116
99
  </QueryClientProvider>
117
100
  `;
118
- }
119
- lines.push(`
101
+ }
102
+ lines.push(`
120
103
  ${queryClientSetup}
121
104
 
122
105
  export function ParaWalletsProvider({ children }: PropsWithChildren) {
@@ -127,32 +110,25 @@ export function getWalletProviderCodeNextjs(networks: string[], noAppRouter: boo
127
110
  );
128
111
  }
129
112
  `);
130
- result.push({ fileName: 'ParaWalletsProvider', code: lines.join('\n') });
131
- } else {
132
- const dynamicImport: string[] = [];
133
- dynamicImport.push(`import React, { PropsWithChildren } from "react";`, `import dynamic from "next/dynamic";`);
134
- dynamicImport.push(`
113
+ result.push({ fileName: 'ParaWalletsProvider', code: lines.join('\n') });
114
+ }
115
+ else {
116
+ const dynamicImport = [];
117
+ dynamicImport.push(`import React, { PropsWithChildren } from "react";`, `import dynamic from "next/dynamic";`);
118
+ dynamicImport.push(`
135
119
  export const ParaWalletsProvider = dynamic(() => import("./ParaWalletsProviderFull").then(m => m.ParaWalletsProviderFull), {
136
120
  ssr: false
137
121
  });
138
122
  `);
139
- result.push({ fileName: 'ParaWalletsProvider', code: dynamicImport.join('\n') });
140
- const fullProvider: string[] = [];
141
- fullProvider.push(
142
- `"use client";`,
143
- `import React, { PropsWithChildren } from "react";`,
144
- `import { para } from "@/client/para";`,
145
- `import { QueryClient, QueryClientProvider } from "@tanstack/react-query";`,
146
- );
147
- let needQueryClient = false;
148
- let nest = '{children}';
149
- if (networks.includes('evm')) {
150
- needQueryClient = true;
151
- fullProvider.push(
152
- `import { ParaEvmProvider, walletConnectWallet, metaMaskWallet, rabbyWallet, rainbowWallet, coinbaseWallet, zerionWallet } from "@getpara/evm-wallet-connectors";`,
153
- `import { sepolia, celo, mainnet, polygon } from "wagmi/chains";`,
154
- );
155
- nest = `
123
+ result.push({ fileName: 'ParaWalletsProvider', code: dynamicImport.join('\n') });
124
+ const fullProvider = [];
125
+ fullProvider.push(`"use client";`, `import React, { PropsWithChildren } from "react";`, `import { para } from "@/client/para";`, `import { QueryClient, QueryClientProvider } from "@tanstack/react-query";`);
126
+ let needQueryClient = false;
127
+ let nest = '{children}';
128
+ if (networks.includes('evm')) {
129
+ needQueryClient = true;
130
+ fullProvider.push(`import { ParaEvmProvider, walletConnectWallet, metaMaskWallet, rabbyWallet, rainbowWallet, coinbaseWallet, zerionWallet } from "@getpara/evm-wallet-connectors";`, `import { sepolia, celo, mainnet, polygon } from "wagmi/chains";`);
131
+ nest = `
156
132
  <ParaEvmProvider
157
133
  config={{
158
134
  projectId: "YOUR_PROJECT_ID",
@@ -165,15 +141,11 @@ export function getWalletProviderCodeNextjs(networks: string[], noAppRouter: boo
165
141
  ${nest}
166
142
  </ParaEvmProvider>
167
143
  `;
168
- }
169
- if (networks.includes('solana')) {
170
- needQueryClient = true;
171
- fullProvider.push(
172
- `import { ParaSolanaProvider, glowWallet, phantomWallet, backpackWallet } from "@getpara/solana-wallet-connectors";`,
173
- `import { WalletAdapterNetwork } from "@solana/wallet-adapter-base";`,
174
- `import { clusterApiUrl } from "@solana/web3.js";`,
175
- );
176
- nest = `
144
+ }
145
+ if (networks.includes('solana')) {
146
+ needQueryClient = true;
147
+ fullProvider.push(`import { ParaSolanaProvider, glowWallet, phantomWallet, backpackWallet } from "@getpara/solana-wallet-connectors";`, `import { WalletAdapterNetwork } from "@solana/wallet-adapter-base";`, `import { clusterApiUrl } from "@solana/web3.js";`);
148
+ nest = `
177
149
  <ParaSolanaProvider
178
150
  endpoint={clusterApiUrl(WalletAdapterNetwork.Devnet)}
179
151
  wallets={[glowWallet, phantomWallet, backpackWallet]}
@@ -186,14 +158,11 @@ export function getWalletProviderCodeNextjs(networks: string[], noAppRouter: boo
186
158
  ${nest}
187
159
  </ParaSolanaProvider>
188
160
  `;
189
- }
190
- if (networks.includes('cosmos')) {
191
- needQueryClient = true;
192
- fullProvider.push(
193
- `import { ParaCosmosProvider, keplrWallet, leapWallet } from "@getpara/cosmos-wallet-connectors";`,
194
- `import { cosmoshub } from "@getpara/graz/chains";`,
195
- );
196
- nest = `
161
+ }
162
+ if (networks.includes('cosmos')) {
163
+ needQueryClient = true;
164
+ fullProvider.push(`import { ParaCosmosProvider, keplrWallet, leapWallet } from "@getpara/cosmos-wallet-connectors";`, `import { cosmoshub } from "@getpara/graz/chains";`);
165
+ nest = `
197
166
  <ParaCosmosProvider
198
167
  chains={[{
199
168
  ...cosmoshub,
@@ -210,16 +179,16 @@ export function getWalletProviderCodeNextjs(networks: string[], noAppRouter: boo
210
179
  ${nest}
211
180
  </ParaCosmosProvider>
212
181
  `;
213
- }
214
- const qSetup = needQueryClient ? `const queryClient = new QueryClient();` : '';
215
- if (needQueryClient) {
216
- nest = `
182
+ }
183
+ const qSetup = needQueryClient ? `const queryClient = new QueryClient();` : '';
184
+ if (needQueryClient) {
185
+ nest = `
217
186
  <QueryClientProvider client={queryClient}>
218
187
  ${nest}
219
188
  </QueryClientProvider>
220
189
  `;
221
- }
222
- fullProvider.push(`
190
+ }
191
+ fullProvider.push(`
223
192
  ${qSetup}
224
193
 
225
194
  export function ParaWalletsProviderFull({ children }: PropsWithChildren) {
@@ -230,27 +199,19 @@ export function getWalletProviderCodeNextjs(networks: string[], noAppRouter: boo
230
199
  );
231
200
  }
232
201
  `);
233
- result.push({ fileName: 'ParaWalletsProviderFull', code: fullProvider.join('\n') });
234
- }
235
- return result;
202
+ result.push({ fileName: 'ParaWalletsProviderFull', code: fullProvider.join('\n') });
203
+ }
204
+ return result;
236
205
  }
237
-
238
- export function getWalletProviderCodeVite(networks: string[]): string {
239
- const lines: string[] = [];
240
- lines.push(
241
- `import React, { PropsWithChildren } from "react";`,
242
- `import { para } from "@/client/para";`,
243
- `import { QueryClient, QueryClientProvider } from "@tanstack/react-query";`,
244
- );
245
- let needQueryClient = false;
246
- let nest = '{children}';
247
- if (networks.includes('evm')) {
248
- needQueryClient = true;
249
- lines.push(
250
- `import { ParaEvmProvider, walletConnectWallet, metaMaskWallet, rabbyWallet, rainbowWallet, coinbaseWallet, zerionWallet } from "@getpara/evm-wallet-connectors";`,
251
- `import { sepolia, celo, mainnet, polygon } from "wagmi/chains";`,
252
- );
253
- nest = `
206
+ export function getWalletProviderCodeVite(networks) {
207
+ const lines = [];
208
+ lines.push(`import React, { PropsWithChildren } from "react";`, `import { para } from "@/client/para";`, `import { QueryClient, QueryClientProvider } from "@tanstack/react-query";`);
209
+ let needQueryClient = false;
210
+ let nest = '{children}';
211
+ if (networks.includes('evm')) {
212
+ needQueryClient = true;
213
+ lines.push(`import { ParaEvmProvider, walletConnectWallet, metaMaskWallet, rabbyWallet, rainbowWallet, coinbaseWallet, zerionWallet } from "@getpara/evm-wallet-connectors";`, `import { sepolia, celo, mainnet, polygon } from "wagmi/chains";`);
214
+ nest = `
254
215
  <ParaEvmProvider
255
216
  config={{
256
217
  projectId: "YOUR_PROJECT_ID",
@@ -263,15 +224,11 @@ export function getWalletProviderCodeVite(networks: string[]): string {
263
224
  ${nest}
264
225
  </ParaEvmProvider>
265
226
  `;
266
- }
267
- if (networks.includes('solana')) {
268
- needQueryClient = true;
269
- lines.push(
270
- `import { ParaSolanaProvider, glowWallet, phantomWallet, backpackWallet } from "@getpara/solana-wallet-connectors";`,
271
- `import { WalletAdapterNetwork } from "@solana/wallet-adapter-base";`,
272
- `import { clusterApiUrl } from "@solana/web3.js";`,
273
- );
274
- nest = `
227
+ }
228
+ if (networks.includes('solana')) {
229
+ needQueryClient = true;
230
+ lines.push(`import { ParaSolanaProvider, glowWallet, phantomWallet, backpackWallet } from "@getpara/solana-wallet-connectors";`, `import { WalletAdapterNetwork } from "@solana/wallet-adapter-base";`, `import { clusterApiUrl } from "@solana/web3.js";`);
231
+ nest = `
275
232
  <ParaSolanaProvider
276
233
  endpoint={clusterApiUrl(WalletAdapterNetwork.Devnet)}
277
234
  wallets={[glowWallet, phantomWallet, backpackWallet]}
@@ -284,14 +241,11 @@ export function getWalletProviderCodeVite(networks: string[]): string {
284
241
  ${nest}
285
242
  </ParaSolanaProvider>
286
243
  `;
287
- }
288
- if (networks.includes('cosmos')) {
289
- needQueryClient = true;
290
- lines.push(
291
- `import { ParaCosmosProvider, keplrWallet, leapWallet } from "@getpara/cosmos-wallet-connectors";`,
292
- `import { cosmoshub } from "@getpara/graz/chains";`,
293
- );
294
- nest = `
244
+ }
245
+ if (networks.includes('cosmos')) {
246
+ needQueryClient = true;
247
+ lines.push(`import { ParaCosmosProvider, keplrWallet, leapWallet } from "@getpara/cosmos-wallet-connectors";`, `import { cosmoshub } from "@getpara/graz/chains";`);
248
+ nest = `
295
249
  <ParaCosmosProvider
296
250
  chains={[{
297
251
  ...cosmoshub,
@@ -308,16 +262,16 @@ export function getWalletProviderCodeVite(networks: string[]): string {
308
262
  ${nest}
309
263
  </ParaCosmosProvider>
310
264
  `;
311
- }
312
- const queryClientSetup = needQueryClient ? `const queryClient = new QueryClient();` : '';
313
- if (needQueryClient) {
314
- nest = `
265
+ }
266
+ const queryClientSetup = needQueryClient ? `const queryClient = new QueryClient();` : '';
267
+ if (needQueryClient) {
268
+ nest = `
315
269
  <QueryClientProvider client={queryClient}>
316
270
  ${nest}
317
271
  </QueryClientProvider>
318
272
  `;
319
- }
320
- lines.push(`
273
+ }
274
+ lines.push(`
321
275
  ${queryClientSetup}
322
276
 
323
277
  export function ParaWalletsProvider({ children }: PropsWithChildren) {
@@ -328,13 +282,12 @@ export function getWalletProviderCodeVite(networks: string[]): string {
328
282
  );
329
283
  }
330
284
  `);
331
- return lines.join('\n');
285
+ return lines.join('\n');
332
286
  }
333
-
334
- export function getHelloParaFile(tailwind: boolean, isTypescript: boolean, isNext: boolean): string {
335
- if (tailwind) {
336
- const ext = isTypescript ? 'tsx' : 'jsx';
337
- return `export default function HelloPara({ children }: { children: React.ReactNode }) {
287
+ export function getHelloParaFile(tailwind, isTypescript, isNext) {
288
+ if (tailwind) {
289
+ const ext = isTypescript ? 'tsx' : 'jsx';
290
+ return `export default function HelloPara({ children }: { children: React.ReactNode }) {
338
291
  return (
339
292
  <div className="min-h-screen bg-[#fafafa]">
340
293
  <main className="container mx-auto px-4 py-16">
@@ -404,8 +357,8 @@ export function getHelloParaFile(tailwind: boolean, isTypescript: boolean, isNex
404
357
  );
405
358
  }
406
359
  `;
407
- }
408
- return `export default function HelloPara({ children }) {
360
+ }
361
+ return `export default function HelloPara({ children }) {
409
362
  return (
410
363
  <div style={{ minHeight: '100vh', backgroundColor: '#fafafa' }}>
411
364
  <main style={{ maxWidth: '1200px', margin: '0 auto', padding: '4rem 1rem' }}>
@@ -478,33 +431,29 @@ export function getHelloParaFile(tailwind: boolean, isTypescript: boolean, isNex
478
431
  }
479
432
  `;
480
433
  }
481
-
482
- export function getHomeFile(tailwind: boolean, isNext: boolean, externalWalletSupport: boolean): string {
483
- const maybeUseClient = isNext ? `"use client";\n` : '';
484
-
485
- const helloParaImport = isNext
486
- ? `import HelloPara from "@/components/HelloPara";`
487
- : `import HelloPara from "./HelloPara";`;
488
-
489
- let externalImports = ``;
490
- if (externalWalletSupport) {
491
- if (isNext) {
492
- externalImports = `import { ExternalWallet } from "@getpara/react-sdk";
434
+ export function getHomeFile(tailwind, isNext, externalWalletSupport) {
435
+ const maybeUseClient = isNext ? `"use client";\n` : '';
436
+ const helloParaImport = isNext
437
+ ? `import HelloPara from "@/components/HelloPara";`
438
+ : `import HelloPara from "./HelloPara";`;
439
+ let externalImports = ``;
440
+ if (externalWalletSupport) {
441
+ if (isNext) {
442
+ externalImports = `import { ExternalWallet } from "@getpara/react-sdk";
493
443
  import { ParaWalletsProvider } from "@/components/ParaWalletsProvider";`;
494
- } else {
495
- externalImports = `import { ExternalWallet } from "@getpara/react-sdk";
444
+ }
445
+ else {
446
+ externalImports = `import { ExternalWallet } from "@getpara/react-sdk";
496
447
  import { ParaWalletsProvider } from "./ParaWalletsProvider";`;
448
+ }
497
449
  }
498
- }
499
-
500
- const wrapBegin = externalWalletSupport ? `<ParaWalletsProvider>` : ``;
501
- const wrapEnd = externalWalletSupport ? `</ParaWalletsProvider>` : ``;
502
- const maybeClass = tailwind
503
- ? `className="bg-[#FF4E00] hover:bg-[#E73461] text-white font-semibold py-2 px-4 rounded"`
504
- : `className="open-button"`;
505
-
506
- const externalWalletSnippet = externalWalletSupport
507
- ? ` externalWallets={[
450
+ const wrapBegin = externalWalletSupport ? `<ParaWalletsProvider>` : ``;
451
+ const wrapEnd = externalWalletSupport ? `</ParaWalletsProvider>` : ``;
452
+ const maybeClass = tailwind
453
+ ? `className="bg-[#FF4E00] hover:bg-[#E73461] text-white font-semibold py-2 px-4 rounded"`
454
+ : `className="open-button"`;
455
+ const externalWalletSnippet = externalWalletSupport
456
+ ? ` externalWallets={[
508
457
  ExternalWallet.BACKPACK,
509
458
  ExternalWallet.COINBASE,
510
459
  ExternalWallet.GLOW,
@@ -517,9 +466,8 @@ import { ParaWalletsProvider } from "./ParaWalletsProvider";`;
517
466
  ExternalWallet.WALLETCONNECT,
518
467
  ExternalWallet.ZERION,
519
468
  ]}`
520
- : ``;
521
-
522
- return `
469
+ : ``;
470
+ return `
523
471
  ${maybeUseClient}import React, { useState } from "react";
524
472
  import { para } from "@/client/para";
525
473
  import { ParaModal, OAuthMethod, AuthLayout } from "@getpara/react-sdk";
@@ -576,9 +524,8 @@ export default function Home() {
576
524
  }
577
525
  `;
578
526
  }
579
-
580
- export function getStylesNonTailwind(): string {
581
- return `.outer {
527
+ export function getStylesNonTailwind() {
528
+ return `.outer {
582
529
  min-height: 100vh;
583
530
  background-color: #fafafa;
584
531
  }
@@ -0,0 +1,77 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import fs from 'fs-extra';
11
+ import path from 'path';
12
+ const EVM_DEPS = ['@getpara/evm-wallet-connectors', '@tanstack/react-query', 'wagmi', '@getpara/react-sdk'];
13
+ const SOLANA_DEPS = [
14
+ '@getpara/react-sdk',
15
+ '@getpara/solana-wallet-connectors',
16
+ '@solana-mobile/wallet-adapter-mobile',
17
+ '@solana/wallet-adapter-base',
18
+ '@solana/wallet-adapter-react',
19
+ '@solana/wallet-adapter-walletconnect',
20
+ '@solana/web3.js',
21
+ '@tanstack/react-query',
22
+ ];
23
+ const COSMOS_DEPS = [
24
+ '@getpara/core-sdk',
25
+ '@getpara/cosmos-wallet-connectors',
26
+ '@getpara/graz',
27
+ '@getpara/react-sdk',
28
+ '@getpara/user-management-client',
29
+ '@cosmjs/cosmwasm-stargate',
30
+ '@cosmjs/launchpad',
31
+ '@cosmjs/proto-signing',
32
+ '@cosmjs/stargate',
33
+ '@cosmjs/tendermint-rpc',
34
+ '@leapwallet/cosmos-social-login-capsule-provider',
35
+ 'long',
36
+ 'starknet',
37
+ ];
38
+ const BASE_DEPS = ['@getpara/react-sdk'];
39
+ export function updatePackageJsonDependencies(projectName, networks, externalWalletSupport) {
40
+ return __awaiter(this, void 0, void 0, function* () {
41
+ const pkgPath = path.join(projectName, 'package.json');
42
+ const exists = yield fs.pathExists(pkgPath);
43
+ if (!exists) {
44
+ return;
45
+ }
46
+ const pkgData = yield fs.readJSON(pkgPath);
47
+ pkgData.dependencies = pkgData.dependencies || {};
48
+ if (!externalWalletSupport) {
49
+ BASE_DEPS.forEach(dep => {
50
+ pkgData.dependencies[dep] = pkgData.dependencies[dep] || 'latest';
51
+ });
52
+ }
53
+ else {
54
+ if (networks.includes('evm')) {
55
+ EVM_DEPS.forEach(dep => {
56
+ pkgData.dependencies[dep] = pkgData.dependencies[dep] || 'latest';
57
+ });
58
+ }
59
+ if (networks.includes('solana')) {
60
+ SOLANA_DEPS.forEach(dep => {
61
+ pkgData.dependencies[dep] = pkgData.dependencies[dep] || 'latest';
62
+ });
63
+ }
64
+ if (networks.includes('cosmos')) {
65
+ COSMOS_DEPS.forEach(dep => {
66
+ pkgData.dependencies[dep] = pkgData.dependencies[dep] || 'latest';
67
+ });
68
+ }
69
+ if (!networks.includes('evm') && !networks.includes('solana') && !networks.includes('cosmos')) {
70
+ BASE_DEPS.forEach(dep => {
71
+ pkgData.dependencies[dep] = pkgData.dependencies[dep] || 'latest';
72
+ });
73
+ }
74
+ }
75
+ yield fs.writeJSON(pkgPath, pkgData, { spaces: 2 });
76
+ });
77
+ }
@@ -0,0 +1,24 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { logInfo } from '../utils/logger.js';
11
+ import { sdkSetupNextjs } from './sdkSetupNextjs.js';
12
+ import { sdkSetupVite } from './sdkSetupVite.js';
13
+ export function runSDKSetup(config) {
14
+ return __awaiter(this, void 0, void 0, function* () {
15
+ const { projectName, template } = config;
16
+ logInfo(`🔌 Integrating Para SDK into project ${projectName}...`);
17
+ if (template === 'vite-react') {
18
+ yield sdkSetupVite(config);
19
+ }
20
+ else {
21
+ yield sdkSetupNextjs(config);
22
+ }
23
+ });
24
+ }