@getpara/create-para-app 0.5.0 → 0.6.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/dist/package.json
CHANGED
|
@@ -431,12 +431,12 @@ export function getHelloParaFile(tailwind, isTypescript, isNext) {
|
|
|
431
431
|
}
|
|
432
432
|
`;
|
|
433
433
|
}
|
|
434
|
-
export function getHomeFile(tailwind, isNext, externalWalletSupport) {
|
|
434
|
+
export function getHomeFile(tailwind, isNext, externalWalletSupport, networks = []) {
|
|
435
435
|
const maybeUseClient = isNext ? `"use client";\n` : '';
|
|
436
436
|
const helloParaImport = isNext
|
|
437
437
|
? `import HelloPara from "@/components/HelloPara";`
|
|
438
438
|
: `import HelloPara from "./HelloPara";`;
|
|
439
|
-
let externalImports =
|
|
439
|
+
let externalImports = '';
|
|
440
440
|
if (externalWalletSupport) {
|
|
441
441
|
if (isNext) {
|
|
442
442
|
externalImports = `import { ExternalWallet } from "@getpara/react-sdk";
|
|
@@ -447,26 +447,22 @@ import { ParaWalletsProvider } from "@/components/ParaWalletsProvider";`;
|
|
|
447
447
|
import { ParaWalletsProvider } from "./ParaWalletsProvider";`;
|
|
448
448
|
}
|
|
449
449
|
}
|
|
450
|
+
let externalWallets = [];
|
|
451
|
+
if (networks.includes('evm')) {
|
|
452
|
+
externalWallets.push('ExternalWallet.METAMASK', 'ExternalWallet.RABBY', 'ExternalWallet.RAINBOW', 'ExternalWallet.WALLETCONNECT', 'ExternalWallet.COINBASE', 'ExternalWallet.ZERION');
|
|
453
|
+
}
|
|
454
|
+
if (networks.includes('solana')) {
|
|
455
|
+
externalWallets.push('ExternalWallet.BACKPACK', 'ExternalWallet.GLOW', 'ExternalWallet.PHANTOM');
|
|
456
|
+
}
|
|
457
|
+
if (networks.includes('cosmos')) {
|
|
458
|
+
externalWallets.push('ExternalWallet.KEPLR', 'ExternalWallet.LEAP');
|
|
459
|
+
}
|
|
460
|
+
const externalWalletSnippet = externalWalletSupport ? ` externalWallets={[${externalWallets.join(', ')}]}` : ``;
|
|
450
461
|
const wrapBegin = externalWalletSupport ? `<ParaWalletsProvider>` : ``;
|
|
451
462
|
const wrapEnd = externalWalletSupport ? `</ParaWalletsProvider>` : ``;
|
|
452
463
|
const maybeClass = tailwind
|
|
453
464
|
? `className="bg-[#FF4E00] hover:bg-[#E73461] text-white font-semibold py-2 px-4 rounded"`
|
|
454
465
|
: `className="open-button"`;
|
|
455
|
-
const externalWalletSnippet = externalWalletSupport
|
|
456
|
-
? ` externalWallets={[
|
|
457
|
-
ExternalWallet.BACKPACK,
|
|
458
|
-
ExternalWallet.COINBASE,
|
|
459
|
-
ExternalWallet.GLOW,
|
|
460
|
-
ExternalWallet.KEPLR,
|
|
461
|
-
ExternalWallet.LEAP,
|
|
462
|
-
ExternalWallet.METAMASK,
|
|
463
|
-
ExternalWallet.PHANTOM,
|
|
464
|
-
ExternalWallet.RABBY,
|
|
465
|
-
ExternalWallet.RAINBOW,
|
|
466
|
-
ExternalWallet.WALLETCONNECT,
|
|
467
|
-
ExternalWallet.ZERION,
|
|
468
|
-
]}`
|
|
469
|
-
: ``;
|
|
470
466
|
return `
|
|
471
467
|
${maybeUseClient}import React, { useState } from "react";
|
|
472
468
|
import { para } from "@/client/para";
|
|
@@ -46,7 +46,7 @@ export function sdkSetupNextjs(config) {
|
|
|
46
46
|
const formatted = yield formatWithPrettier(helloParaCode, filePath);
|
|
47
47
|
yield fs.outputFile(filePath, formatted);
|
|
48
48
|
}
|
|
49
|
-
const homeCode = getHomeFile(!!tailwind, !noTypescript, !!externalWalletSupport);
|
|
49
|
+
const homeCode = getHomeFile(!!tailwind, !noTypescript, !!externalWalletSupport, networks);
|
|
50
50
|
let mainPath = '';
|
|
51
51
|
if (noAppRouter) {
|
|
52
52
|
if (noSrcDir) {
|
|
@@ -43,7 +43,7 @@ export function sdkSetupVite(config) {
|
|
|
43
43
|
const formatted = yield formatWithPrettier(helloParaCode, filePath);
|
|
44
44
|
yield fs.outputFile(filePath, formatted);
|
|
45
45
|
}
|
|
46
|
-
const homeCode = getHomeFile(!!tailwind, !noTypescript, !!externalWalletSupport);
|
|
46
|
+
const homeCode = getHomeFile(!!tailwind, !noTypescript, !!externalWalletSupport, networks);
|
|
47
47
|
const mainFileDir = noSrcDir ? projectName : path.join(projectName, 'src');
|
|
48
48
|
const mainFilePath = path.join(mainFileDir, `App.${noTypescript ? 'jsx' : 'tsx'}`);
|
|
49
49
|
const exists = yield fs.pathExists(mainFilePath);
|