create-lightning-scaffold 1.0.0 → 1.0.2
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/README.md +107 -25
- package/dist/index.js +169 -64
- package/package.json +1 -1
- package/templates/backend/firebase/index.ts +86 -9
- package/templates/backend/supabase/index.ts +107 -6
- package/templates/base/.env.example.ejs +17 -10
- package/templates/lib/backend.ts.ejs +59 -0
- package/templates/mobile/app/_layout.tsx +22 -52
- package/templates/mobile/app/index.tsx.ejs +44 -0
- package/templates/mobile/components/History.tsx.ejs +114 -0
- package/templates/mobile/components/Onboarding.tsx.ejs +79 -0
- package/templates/mobile/components/Recovery.tsx.ejs +119 -0
- package/templates/mobile/components/Swap.tsx.ejs +315 -0
- package/templates/mobile/package.json.ejs +4 -0
- package/templates/vite/README.md +73 -0
- package/templates/vite/eslint.config.js +23 -0
- package/templates/vite/index.html +13 -0
- package/templates/vite/package.json.ejs +37 -0
- package/templates/vite/postcss.config.js.ejs +8 -0
- package/templates/vite/public/vite.svg +1 -0
- package/templates/vite/src/App.tsx.ejs +65 -0
- package/templates/vite/src/assets/react.svg +1 -0
- package/templates/vite/src/components/History.tsx.ejs +112 -0
- package/templates/vite/src/components/Onboarding.tsx.ejs +64 -0
- package/templates/vite/src/components/Recovery.tsx.ejs +107 -0
- package/templates/vite/src/components/Swap.tsx.ejs +241 -0
- package/templates/vite/src/index.css.ejs +55 -0
- package/templates/vite/src/main.tsx +25 -0
- package/templates/vite/tailwind.config.js.ejs +13 -0
- package/templates/vite/tsconfig.app.json +28 -0
- package/templates/vite/tsconfig.json +7 -0
- package/templates/vite/tsconfig.node.json +26 -0
- package/templates/vite/vite.config.ts +15 -0
- package/templates/web/app/globals.css.ejs +53 -0
- package/templates/web/app/layout.tsx.ejs +8 -15
- package/templates/web/app/page.tsx.ejs +45 -0
- package/templates/web/app/providers.tsx +27 -0
- package/templates/web/components/History.tsx.ejs +114 -0
- package/templates/web/components/Onboarding.tsx.ejs +66 -0
- package/templates/web/components/Recovery.tsx.ejs +108 -0
- package/templates/web/components/Swap.tsx.ejs +289 -0
- package/templates/web/package.json.ejs +3 -1
- package/templates/examples/mobile/biometric-onboard.tsx +0 -104
- package/templates/examples/mobile/gasless-transfer.tsx +0 -72
- package/templates/examples/mobile/index.tsx +0 -30
- package/templates/examples/mobile/passkey-login.tsx +0 -55
- package/templates/examples/web/biometric-onboard/page.tsx +0 -70
- package/templates/examples/web/gasless-transfer/page.tsx +0 -85
- package/templates/examples/web/page.tsx +0 -27
- package/templates/examples/web/passkey-login/page.tsx +0 -50
- package/templates/lib/lazorkit/mobile/index.ts +0 -53
- package/templates/lib/lazorkit/web/index.ts +0 -67
- package/templates/mobile/app/(tabs)/_layout.tsx +0 -59
- package/templates/mobile/app/(tabs)/index.tsx +0 -31
- package/templates/mobile/app/(tabs)/two.tsx +0 -31
- package/templates/mobile/app/+html.tsx +0 -38
- package/templates/mobile/app/+not-found.tsx +0 -40
- package/templates/mobile/app/modal.tsx +0 -35
- package/templates/mobile/components/EditScreenInfo.tsx +0 -77
- package/templates/mobile/components/StyledText.tsx +0 -5
- package/templates/mobile/components/__tests__/StyledText-test.js +0 -10
- package/templates/mobile/lib/lazorkit/index.ts +0 -53
- package/templates/web/app/globals.css +0 -26
- package/templates/web/app/page.tsx +0 -65
- package/templates/web/lib/lazorkit/index.ts +0 -67
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
@import "tailwindcss";
|
|
2
|
-
|
|
3
|
-
:root {
|
|
4
|
-
--background: #ffffff;
|
|
5
|
-
--foreground: #171717;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
@theme inline {
|
|
9
|
-
--color-background: var(--background);
|
|
10
|
-
--color-foreground: var(--foreground);
|
|
11
|
-
--font-sans: var(--font-geist-sans);
|
|
12
|
-
--font-mono: var(--font-geist-mono);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
@media (prefers-color-scheme: dark) {
|
|
16
|
-
:root {
|
|
17
|
-
--background: #0a0a0a;
|
|
18
|
-
--foreground: #ededed;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
body {
|
|
23
|
-
background: var(--background);
|
|
24
|
-
color: var(--foreground);
|
|
25
|
-
font-family: Arial, Helvetica, sans-serif;
|
|
26
|
-
}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import Image from "next/image";
|
|
2
|
-
|
|
3
|
-
export default function Home() {
|
|
4
|
-
return (
|
|
5
|
-
<div className="flex min-h-screen items-center justify-center bg-zinc-50 font-sans dark:bg-black">
|
|
6
|
-
<main className="flex min-h-screen w-full max-w-3xl flex-col items-center justify-between py-32 px-16 bg-white dark:bg-black sm:items-start">
|
|
7
|
-
<Image
|
|
8
|
-
className="dark:invert"
|
|
9
|
-
src="/next.svg"
|
|
10
|
-
alt="Next.js logo"
|
|
11
|
-
width={100}
|
|
12
|
-
height={20}
|
|
13
|
-
priority
|
|
14
|
-
/>
|
|
15
|
-
<div className="flex flex-col items-center gap-6 text-center sm:items-start sm:text-left">
|
|
16
|
-
<h1 className="max-w-xs text-3xl font-semibold leading-10 tracking-tight text-black dark:text-zinc-50">
|
|
17
|
-
To get started, edit the page.tsx file.
|
|
18
|
-
</h1>
|
|
19
|
-
<p className="max-w-md text-lg leading-8 text-zinc-600 dark:text-zinc-400">
|
|
20
|
-
Looking for a starting point or more instructions? Head over to{" "}
|
|
21
|
-
<a
|
|
22
|
-
href="https://vercel.com/templates?framework=next.js&utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
|
|
23
|
-
className="font-medium text-zinc-950 dark:text-zinc-50"
|
|
24
|
-
>
|
|
25
|
-
Templates
|
|
26
|
-
</a>{" "}
|
|
27
|
-
or the{" "}
|
|
28
|
-
<a
|
|
29
|
-
href="https://nextjs.org/learn?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
|
|
30
|
-
className="font-medium text-zinc-950 dark:text-zinc-50"
|
|
31
|
-
>
|
|
32
|
-
Learning
|
|
33
|
-
</a>{" "}
|
|
34
|
-
center.
|
|
35
|
-
</p>
|
|
36
|
-
</div>
|
|
37
|
-
<div className="flex flex-col gap-4 text-base font-medium sm:flex-row">
|
|
38
|
-
<a
|
|
39
|
-
className="flex h-12 w-full items-center justify-center gap-2 rounded-full bg-foreground px-5 text-background transition-colors hover:bg-[#383838] dark:hover:bg-[#ccc] md:w-[158px]"
|
|
40
|
-
href="https://vercel.com/new?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
|
|
41
|
-
target="_blank"
|
|
42
|
-
rel="noopener noreferrer"
|
|
43
|
-
>
|
|
44
|
-
<Image
|
|
45
|
-
className="dark:invert"
|
|
46
|
-
src="/vercel.svg"
|
|
47
|
-
alt="Vercel logomark"
|
|
48
|
-
width={16}
|
|
49
|
-
height={16}
|
|
50
|
-
/>
|
|
51
|
-
Deploy Now
|
|
52
|
-
</a>
|
|
53
|
-
<a
|
|
54
|
-
className="flex h-12 w-full items-center justify-center rounded-full border border-solid border-black/[.08] px-5 transition-colors hover:border-transparent hover:bg-black/[.04] dark:border-white/[.145] dark:hover:bg-[#1a1a1a] md:w-[158px]"
|
|
55
|
-
href="https://nextjs.org/docs?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
|
|
56
|
-
target="_blank"
|
|
57
|
-
rel="noopener noreferrer"
|
|
58
|
-
>
|
|
59
|
-
Documentation
|
|
60
|
-
</a>
|
|
61
|
-
</div>
|
|
62
|
-
</main>
|
|
63
|
-
</div>
|
|
64
|
-
);
|
|
65
|
-
}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { Connection, PublicKey, Transaction } from "@solana/web3.js";
|
|
3
|
-
|
|
4
|
-
const PORTAL_URL = process.env.NEXT_PUBLIC_LAZORKIT_PORTAL_URL || "https://portal.lazor.sh";
|
|
5
|
-
const PAYMASTER_URL = process.env.NEXT_PUBLIC_LAZORKIT_PAYMASTER_URL || "https://kora.devnet.lazorkit.com";
|
|
6
|
-
const RPC_URL = process.env.NEXT_PUBLIC_SOLANA_RPC || "https://api.devnet.solana.com";
|
|
7
|
-
|
|
8
|
-
export interface LazorWallet {
|
|
9
|
-
address: string;
|
|
10
|
-
publicKey: PublicKey;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export async function connectPasskey(): Promise<LazorWallet | null> {
|
|
14
|
-
const redirectUrl = `${window.location.origin}/auth/callback`;
|
|
15
|
-
const popup = window.open(`${PORTAL_URL}/auth?redirect=${encodeURIComponent(redirectUrl)}`, "lazorkit", "width=500,height=600");
|
|
16
|
-
|
|
17
|
-
return new Promise((resolve) => {
|
|
18
|
-
const handler = (e: MessageEvent) => {
|
|
19
|
-
if (e.origin === window.location.origin && e.data?.address) {
|
|
20
|
-
window.removeEventListener("message", handler);
|
|
21
|
-
popup?.close();
|
|
22
|
-
resolve({ address: e.data.address, publicKey: new PublicKey(e.data.address) });
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
window.addEventListener("message", handler);
|
|
26
|
-
const check = setInterval(() => {
|
|
27
|
-
if (popup?.closed) { clearInterval(check); window.removeEventListener("message", handler); resolve(null); }
|
|
28
|
-
}, 500);
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export async function signAndSendTransaction(tx: Transaction, wallet: LazorWallet): Promise<string | null> {
|
|
33
|
-
const connection = new Connection(RPC_URL);
|
|
34
|
-
const { blockhash } = await connection.getLatestBlockhash();
|
|
35
|
-
tx.recentBlockhash = blockhash;
|
|
36
|
-
tx.feePayer = wallet.publicKey;
|
|
37
|
-
|
|
38
|
-
const serialized = tx.serialize({ requireAllSignatures: false }).toString("base64");
|
|
39
|
-
const redirectUrl = `${window.location.origin}/auth/callback`;
|
|
40
|
-
const popup = window.open(`${PORTAL_URL}/sign?tx=${encodeURIComponent(serialized)}&redirect=${encodeURIComponent(redirectUrl)}`, "lazorkit", "width=500,height=600");
|
|
41
|
-
|
|
42
|
-
return new Promise((resolve) => {
|
|
43
|
-
const handler = (e: MessageEvent) => {
|
|
44
|
-
if (e.origin === window.location.origin && e.data?.signature) {
|
|
45
|
-
window.removeEventListener("message", handler);
|
|
46
|
-
popup?.close();
|
|
47
|
-
resolve(e.data.signature);
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
window.addEventListener("message", handler);
|
|
51
|
-
const check = setInterval(() => {
|
|
52
|
-
if (popup?.closed) { clearInterval(check); window.removeEventListener("message", handler); resolve(null); }
|
|
53
|
-
}, 500);
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export async function sponsorTransaction(tx: Transaction): Promise<Transaction> {
|
|
58
|
-
const res = await fetch(`${PAYMASTER_URL}/sponsor`, {
|
|
59
|
-
method: "POST",
|
|
60
|
-
headers: { "Content-Type": "application/json" },
|
|
61
|
-
body: JSON.stringify({ transaction: tx.serialize({ requireAllSignatures: false }).toString("base64") }),
|
|
62
|
-
});
|
|
63
|
-
const { sponsoredTx } = await res.json();
|
|
64
|
-
return Transaction.from(Buffer.from(sponsoredTx, "base64"));
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
export const connection = new Connection(RPC_URL);
|