;
8 | connect: () => void;
9 | disconnect: () => void;
10 | getZKsync: () => ZKsyncPlugin | null;
11 | };
12 |
13 | export type Account =
14 | | { isConnected: true; address: string }
15 | | { isConnected: false; address: null };
16 |
17 | export type Network = Chain | null
--------------------------------------------------------------------------------
/templates/react/vite-web3js/src/services/utils.ts:
--------------------------------------------------------------------------------
1 | import { fromWei } from 'web3-utils';
2 |
3 | export function formatBalance(balance: bigint) {
4 | return fromWei(balance, 'ether');
5 | }
6 |
--------------------------------------------------------------------------------
/templates/react/vite-web3js/src/styles/home.module.css:
--------------------------------------------------------------------------------
1 | .home {
2 | display: flex;
3 | flex-direction: column;
4 | justify-content: space-between;
5 | align-items: center;
6 | padding: 6rem;
7 | min-height: 100vh;
8 | }
9 |
--------------------------------------------------------------------------------
/templates/react/vite-web3js/src/types/index.d.ts:
--------------------------------------------------------------------------------
1 | declare global {
2 | interface Window {
3 | ethereum: import('web3').EIP1193Provider;
4 | }
5 |
6 | interface BigInt {
7 | toJSON: () => string;
8 | }
9 | }
10 |
11 | export {};
12 |
--------------------------------------------------------------------------------
/templates/react/vite-web3js/src/types/web3.ts:
--------------------------------------------------------------------------------
1 | export type Chain = {
2 | id: string;
3 | name: null | string;
4 | rpcUrl: null | string;
5 | blockExplorerUrl?: string;
6 | unsupported?: true;
7 | };
8 |
--------------------------------------------------------------------------------
/templates/react/vite-web3js/src/vite-env.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 |
--------------------------------------------------------------------------------
/templates/react/vite-web3js/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "files": [],
3 | "references": [
4 | {
5 | "path": "./tsconfig.app.json"
6 | },
7 | {
8 | "path": "./tsconfig.node.json"
9 | }
10 | ]
11 | }
12 |
--------------------------------------------------------------------------------
/templates/react/vite-web3js/tsconfig.node.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "composite": true,
4 | "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
5 | "skipLibCheck": true,
6 | "module": "ESNext",
7 | "moduleResolution": "bundler",
8 | "allowSyntheticDefaultImports": true,
9 | "strict": true,
10 | "noEmit": true
11 | },
12 | "include": ["vite.config.ts"]
13 | }
14 |
--------------------------------------------------------------------------------
/templates/react/vite-web3js/vite.config.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig } from "vite";
2 | import react from "@vitejs/plugin-react";
3 | import { resolve } from "node:path";
4 |
5 | // https://vitejs.dev/config/
6 | export default defineConfig({
7 | plugins: [react()],
8 | resolve: {
9 | alias: {
10 | "@": resolve(__dirname, "./src"),
11 | },
12 | },
13 | });
14 |
--------------------------------------------------------------------------------
/templates/svelte/sveltekit-ethers/.gitignore:
--------------------------------------------------------------------------------
1 | # Svelte-kit dev/build outputs
2 | .output
3 | .data
4 | .svelte-kit
5 | .nitro
6 | .cache
7 | dist
8 | vite.config.js.timestamp-*
9 | vite.config.ts.timestamp-*
10 |
11 | # Node dependencies
12 | node_modules
13 |
14 | # Logs
15 | logs
16 | *.log
17 |
18 | # Misc
19 | .DS_Store
20 | .fleet
21 | .idea
22 | package-lock.json
23 |
24 | # Local env files
25 | .env
26 | .env.*
27 | !.env.example
28 |
--------------------------------------------------------------------------------
/templates/svelte/sveltekit-ethers/.npmrc:
--------------------------------------------------------------------------------
1 | engine-strict=true
2 |
--------------------------------------------------------------------------------
/templates/svelte/sveltekit-ethers/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "svelte",
3 | "private": true,
4 | "type": "module",
5 | "scripts": {
6 | "dev": "vite dev",
7 | "build": "vite build",
8 | "preview": "vite preview",
9 | "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
10 | "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch"
11 | },
12 | "devDependencies": {
13 | "@sveltejs/adapter-auto": "^3.0.0",
14 | "@sveltejs/kit": "^2.0.0",
15 | "@sveltejs/vite-plugin-svelte": "^3.0.0",
16 | "svelte": "^4.2.7",
17 | "svelte-check": "^3.6.0",
18 | "tslib": "^2.4.1",
19 | "typescript": "^5.0.0",
20 | "vite": "^5.0.3"
21 | },
22 | "dependencies": {
23 | "ethers": "^6.9.2",
24 | "zksync-ethers": "^6.0.0"
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/templates/svelte/sveltekit-ethers/src/app.d.ts:
--------------------------------------------------------------------------------
1 | // See https://kit.svelte.dev/docs/types#app
2 | // for information about these interfaces
3 | declare global {
4 | namespace App {
5 | // interface Error {}
6 | // interface Locals {}
7 | // interface PageData {}
8 | // interface PageState {}
9 | // interface Platform {}
10 | }
11 | }
12 |
13 | export {};
14 |
--------------------------------------------------------------------------------
/templates/svelte/sveltekit-ethers/src/app.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | %sveltekit.head%
8 |
9 |
10 | %sveltekit.body%
11 |
12 |
13 |
--------------------------------------------------------------------------------
/templates/svelte/sveltekit-ethers/src/components/Account.svelte:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 | {$etherStore.account.address}
7 |
8 |
--------------------------------------------------------------------------------
/templates/svelte/sveltekit-ethers/src/components/BlockNumber.svelte:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 | {blockNumber?.toString()}
13 |
14 |
--------------------------------------------------------------------------------
/templates/svelte/sveltekit-ethers/src/components/Connect.svelte:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 | {#if account.isConnected}
10 |
11 | {:else}
12 |
13 | {/if}
14 |
15 |
--------------------------------------------------------------------------------
/templates/svelte/sveltekit-ethers/src/components/Connected.svelte:
--------------------------------------------------------------------------------
1 |
6 |
7 | {#if account.isConnected}
8 |
9 | {/if}
10 |
--------------------------------------------------------------------------------
/templates/svelte/sveltekit-ethers/src/components/WatchPendingTransactions.svelte:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 |
19 | {transactionHashes.length} transaction hashes
20 |
21 | {transactionHashes.reverse().join("\n")}
22 |
23 |
24 |
--------------------------------------------------------------------------------
/templates/svelte/sveltekit-ethers/src/routes/+layout.ts:
--------------------------------------------------------------------------------
1 | export let ssr = false;
2 |
--------------------------------------------------------------------------------
/templates/svelte/sveltekit-ethers/src/utils/contracts.ts:
--------------------------------------------------------------------------------
1 | import IERC20 from "zksync-ethers/abi/IERC20.json";
2 |
3 | export const erc20ABI = IERC20;
4 |
5 | export const daiContractConfig = {
6 | address: "0x604F0416e788779edB06c1A74a75FAad38384C6E", // zkSync Era Sepolia Testnet DAI token address
7 | abi: erc20ABI,
8 | } as const;
9 |
--------------------------------------------------------------------------------
/templates/svelte/sveltekit-ethers/src/utils/formatters.ts:
--------------------------------------------------------------------------------
1 | export const stringify: typeof JSON.stringify = (value, replacer, space) => {
2 | return JSON.stringify(
3 | value,
4 | (key, value_) => {
5 | const value = typeof value_ === "bigint" ? value_.toString() : value_;
6 | return typeof replacer === "function" ? replacer(key, value) : value;
7 | },
8 | space
9 | );
10 | };
11 |
--------------------------------------------------------------------------------
/templates/svelte/sveltekit-ethers/static/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matter-labs/zksync-frontend-templates/beab20f5f06cb302939701a1d6baa0df095fb692/templates/svelte/sveltekit-ethers/static/favicon.png
--------------------------------------------------------------------------------
/templates/svelte/sveltekit-ethers/svelte.config.js:
--------------------------------------------------------------------------------
1 | import adapter from "@sveltejs/adapter-auto";
2 | import { vitePreprocess } from "@sveltejs/vite-plugin-svelte";
3 |
4 | /** @type {import('@sveltejs/kit').Config} */
5 | const config = {
6 | // Consult https://kit.svelte.dev/docs/integrations#preprocessors
7 | // for more information about preprocessors
8 | preprocess: vitePreprocess(),
9 |
10 | kit: {
11 | // adapter-auto only supports some environments, see https://kit.svelte.dev/docs/adapter-auto for a list.
12 | // If your environment is not supported or you settled on a specific environment, switch out the adapter.
13 | // See https://kit.svelte.dev/docs/adapters for more information about adapters.
14 | adapter: adapter(),
15 | },
16 | };
17 |
18 | export default config;
19 |
--------------------------------------------------------------------------------
/templates/svelte/sveltekit-ethers/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./.svelte-kit/tsconfig.json",
3 | "compilerOptions": {
4 | "allowJs": true,
5 | "checkJs": true,
6 | "esModuleInterop": true,
7 | "forceConsistentCasingInFileNames": true,
8 | "resolveJsonModule": true,
9 | "skipLibCheck": true,
10 | "sourceMap": true,
11 | "strict": true,
12 | "moduleResolution": "bundler"
13 | }
14 | // Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias
15 | //
16 | // If you want to overwrite includes/excludes, make sure to copy over the relevant includes/excludes
17 | // from the referenced tsconfig.json - TypeScript does not merge them in
18 | }
19 |
--------------------------------------------------------------------------------
/templates/svelte/sveltekit-ethers/vite.config.ts:
--------------------------------------------------------------------------------
1 | import { sveltekit } from "@sveltejs/kit/vite";
2 | import { defineConfig } from "vite";
3 |
4 | export default defineConfig({
5 | plugins: [sveltekit()],
6 |
7 | server: {
8 | port: 3000,
9 | },
10 | });
11 |
--------------------------------------------------------------------------------
/templates/svelte/sveltekit-ethers5/.gitignore:
--------------------------------------------------------------------------------
1 | # Svelte-kit dev/build outputs
2 | .output
3 | .data
4 | .svelte-kit
5 | .nitro
6 | .cache
7 | dist
8 | vite.config.js.timestamp-*
9 | vite.config.ts.timestamp-*
10 |
11 | # Node dependencies
12 | node_modules
13 |
14 | # Logs
15 | logs
16 | *.log
17 |
18 | # Misc
19 | .DS_Store
20 | .fleet
21 | .idea
22 | package-lock.json
23 |
24 | # Local env files
25 | .env
26 | .env.*
27 | !.env.example
28 |
--------------------------------------------------------------------------------
/templates/svelte/sveltekit-ethers5/.npmrc:
--------------------------------------------------------------------------------
1 | engine-strict=true
2 |
--------------------------------------------------------------------------------
/templates/svelte/sveltekit-ethers5/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "svelte",
3 | "private": true,
4 | "type": "module",
5 | "scripts": {
6 | "dev": "vite dev",
7 | "build": "vite build",
8 | "preview": "vite preview",
9 | "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
10 | "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch"
11 | },
12 | "devDependencies": {
13 | "@sveltejs/adapter-auto": "^3.0.0",
14 | "@sveltejs/kit": "^2.0.0",
15 | "@sveltejs/vite-plugin-svelte": "^3.0.0",
16 | "svelte": "^4.2.7",
17 | "svelte-check": "^3.6.0",
18 | "tslib": "^2.4.1",
19 | "typescript": "^5.0.0",
20 | "vite": "^5.0.3"
21 | },
22 | "dependencies": {
23 | "ethers": "^5.7.2",
24 | "zksync-ethers": "^5.4.0"
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/templates/svelte/sveltekit-ethers5/src/app.d.ts:
--------------------------------------------------------------------------------
1 | // See https://kit.svelte.dev/docs/types#app
2 | // for information about these interfaces
3 | declare global {
4 | namespace App {
5 | // interface Error {}
6 | // interface Locals {}
7 | // interface PageData {}
8 | // interface PageState {}
9 | // interface Platform {}
10 | }
11 | }
12 |
13 | export {};
14 |
--------------------------------------------------------------------------------
/templates/svelte/sveltekit-ethers5/src/app.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | %sveltekit.head%
8 |
9 |
10 | %sveltekit.body%
11 |
12 |
13 |
--------------------------------------------------------------------------------
/templates/svelte/sveltekit-ethers5/src/components/Account.svelte:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 | {$etherStore.account.address}
7 |
8 |
--------------------------------------------------------------------------------
/templates/svelte/sveltekit-ethers5/src/components/BlockNumber.svelte:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 | {blockNumber?.toString()}
13 |
14 |
--------------------------------------------------------------------------------
/templates/svelte/sveltekit-ethers5/src/components/Connect.svelte:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 | {#if account.isConnected}
10 |
11 | {:else}
12 |
13 | {/if}
14 |
15 |
--------------------------------------------------------------------------------
/templates/svelte/sveltekit-ethers5/src/components/Connected.svelte:
--------------------------------------------------------------------------------
1 |
6 |
7 | {#if account.isConnected}
8 |
9 | {/if}
10 |
--------------------------------------------------------------------------------
/templates/svelte/sveltekit-ethers5/src/components/WatchPendingTransactions.svelte:
--------------------------------------------------------------------------------
1 |
15 |
16 |
17 |
18 | {transactionHashes.length} transaction hashes
19 |
20 | {transactionHashes.reverse().join("\n")}
21 |
22 |
23 |
--------------------------------------------------------------------------------
/templates/svelte/sveltekit-ethers5/src/routes/+layout.ts:
--------------------------------------------------------------------------------
1 | export let ssr = false;
2 |
--------------------------------------------------------------------------------
/templates/svelte/sveltekit-ethers5/src/utils/contracts.ts:
--------------------------------------------------------------------------------
1 | import IERC20 from "zksync-ethers/abi/IERC20.json";
2 |
3 | export const erc20ABI = IERC20;
4 |
5 | export const daiContractConfig = {
6 | address: "0x604F0416e788779edB06c1A74a75FAad38384C6E", // zkSync Era Sepolia Testnet DAI token address
7 | abi: erc20ABI,
8 | } as const;
9 |
--------------------------------------------------------------------------------
/templates/svelte/sveltekit-ethers5/src/utils/formatters.ts:
--------------------------------------------------------------------------------
1 | export const stringify: typeof JSON.stringify = (value, replacer, space) =>
2 | JSON.stringify(
3 | value,
4 | (key, value_) => {
5 | return typeof replacer === 'function' ? replacer(key, value_) : value_
6 | },
7 | space,
8 | )
9 |
--------------------------------------------------------------------------------
/templates/svelte/sveltekit-ethers5/static/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matter-labs/zksync-frontend-templates/beab20f5f06cb302939701a1d6baa0df095fb692/templates/svelte/sveltekit-ethers5/static/favicon.png
--------------------------------------------------------------------------------
/templates/svelte/sveltekit-ethers5/svelte.config.js:
--------------------------------------------------------------------------------
1 | import adapter from "@sveltejs/adapter-auto";
2 | import { vitePreprocess } from "@sveltejs/vite-plugin-svelte";
3 |
4 | /** @type {import('@sveltejs/kit').Config} */
5 | const config = {
6 | // Consult https://kit.svelte.dev/docs/integrations#preprocessors
7 | // for more information about preprocessors
8 | preprocess: vitePreprocess(),
9 |
10 | kit: {
11 | // adapter-auto only supports some environments, see https://kit.svelte.dev/docs/adapter-auto for a list.
12 | // If your environment is not supported or you settled on a specific environment, switch out the adapter.
13 | // See https://kit.svelte.dev/docs/adapters for more information about adapters.
14 | adapter: adapter(),
15 | },
16 | };
17 |
18 | export default config;
19 |
--------------------------------------------------------------------------------
/templates/svelte/sveltekit-ethers5/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./.svelte-kit/tsconfig.json",
3 | "compilerOptions": {
4 | "allowJs": true,
5 | "checkJs": true,
6 | "esModuleInterop": true,
7 | "forceConsistentCasingInFileNames": true,
8 | "resolveJsonModule": true,
9 | "skipLibCheck": true,
10 | "sourceMap": true,
11 | "strict": true,
12 | "moduleResolution": "bundler"
13 | }
14 | // Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias
15 | //
16 | // If you want to overwrite includes/excludes, make sure to copy over the relevant includes/excludes
17 | // from the referenced tsconfig.json - TypeScript does not merge them in
18 | }
19 |
--------------------------------------------------------------------------------
/templates/svelte/sveltekit-ethers5/vite.config.ts:
--------------------------------------------------------------------------------
1 | import { sveltekit } from "@sveltejs/kit/vite";
2 | import { defineConfig } from "vite";
3 |
4 | export default defineConfig({
5 | plugins: [sveltekit()],
6 |
7 | server: {
8 | port: 3000,
9 | },
10 | });
11 |
--------------------------------------------------------------------------------
/templates/svelte/sveltekit-wagmi-web3modal/.env.example:
--------------------------------------------------------------------------------
1 | WALLET_CONNECT_PROJECT_ID=
2 |
--------------------------------------------------------------------------------
/templates/svelte/sveltekit-wagmi-web3modal/.gitignore:
--------------------------------------------------------------------------------
1 | # Svelte-kit dev/build outputs
2 | .output
3 | .data
4 | .svelte-kit
5 | .nitro
6 | .cache
7 | dist
8 | vite.config.js.timestamp-*
9 | vite.config.ts.timestamp-*
10 |
11 | # Node dependencies
12 | node_modules
13 |
14 | # Logs
15 | logs
16 | *.log
17 |
18 | # Misc
19 | .DS_Store
20 | .fleet
21 | .idea
22 | package-lock.json
23 |
24 | # Local env files
25 | .env
26 | .env.*
27 | !.env.example
28 |
--------------------------------------------------------------------------------
/templates/svelte/sveltekit-wagmi-web3modal/.npmrc:
--------------------------------------------------------------------------------
1 | engine-strict=true
2 |
--------------------------------------------------------------------------------
/templates/svelte/sveltekit-wagmi-web3modal/src/app.d.ts:
--------------------------------------------------------------------------------
1 | // See https://kit.svelte.dev/docs/types#app
2 | // for information about these interfaces
3 | declare global {
4 | namespace App {
5 | // interface Error {}
6 | // interface Locals {}
7 | // interface PageData {}
8 | // interface PageState {}
9 | // interface Platform {}
10 | }
11 | }
12 |
13 | export {};
14 |
--------------------------------------------------------------------------------
/templates/svelte/sveltekit-wagmi-web3modal/src/app.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | %sveltekit.head%
8 |
9 |
10 | %sveltekit.body%
11 |
12 |
13 |
--------------------------------------------------------------------------------
/templates/svelte/sveltekit-wagmi-web3modal/src/components/Account.svelte:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 | {$wagmiStore.account.address}
7 |
8 |
--------------------------------------------------------------------------------
/templates/svelte/sveltekit-wagmi-web3modal/src/components/BlockNumber.svelte:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 | {blockNumber?.toString()}
13 |
14 |
--------------------------------------------------------------------------------
/templates/svelte/sveltekit-wagmi-web3modal/src/components/Connected.svelte:
--------------------------------------------------------------------------------
1 |
5 |
6 | {#if account.isConnected}
7 |
8 | {/if}
9 |
--------------------------------------------------------------------------------
/templates/svelte/sveltekit-wagmi-web3modal/src/components/WatchContractEvents.svelte:
--------------------------------------------------------------------------------
1 |
19 |
20 |
21 |
22 | {events.length} DAI `Transfer`s logged
23 |
24 | {events
25 | .reverse()
26 | .map((log) => stringify(log))
27 | .join("\n\n\n\n")}
28 |
29 |
30 |
--------------------------------------------------------------------------------
/templates/svelte/sveltekit-wagmi-web3modal/src/components/WatchPendingTransactions.svelte:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 | {transactionHashes.length} transaction hashes
14 |
15 | {transactionHashes.reverse().join("\n")}
16 |
17 |
18 |
--------------------------------------------------------------------------------
/templates/svelte/sveltekit-wagmi-web3modal/src/routes/+layout.ts:
--------------------------------------------------------------------------------
1 | export const ssr = false;
2 |
--------------------------------------------------------------------------------
/templates/svelte/sveltekit-wagmi-web3modal/src/utils/contracts.ts:
--------------------------------------------------------------------------------
1 | import { erc20ABI } from "@wagmi/core";
2 |
3 | export const daiContractConfig = {
4 | address: "0x604F0416e788779edB06c1A74a75FAad38384C6E", // zkSync Era Sepolia Testnet DAI token address
5 | abi: erc20ABI,
6 | } as const;
7 |
--------------------------------------------------------------------------------
/templates/svelte/sveltekit-wagmi-web3modal/src/utils/formatters.ts:
--------------------------------------------------------------------------------
1 | export const stringify: typeof JSON.stringify = (value, replacer, space) => {
2 | return JSON.stringify(
3 | value,
4 | (key, value_) => {
5 | const value = typeof value_ === "bigint" ? value_.toString() : value_;
6 | return typeof replacer === "function" ? replacer(key, value) : value;
7 | },
8 | space
9 | );
10 | };
11 |
--------------------------------------------------------------------------------
/templates/svelte/sveltekit-wagmi-web3modal/static/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matter-labs/zksync-frontend-templates/beab20f5f06cb302939701a1d6baa0df095fb692/templates/svelte/sveltekit-wagmi-web3modal/static/favicon.png
--------------------------------------------------------------------------------
/templates/svelte/sveltekit-wagmi-web3modal/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./.svelte-kit/tsconfig.json",
3 | "compilerOptions": {
4 | "allowJs": true,
5 | "checkJs": true,
6 | "esModuleInterop": true,
7 | "forceConsistentCasingInFileNames": true,
8 | "resolveJsonModule": true,
9 | "skipLibCheck": true,
10 | "sourceMap": true,
11 | "strict": true,
12 | "moduleResolution": "bundler"
13 | }
14 | // Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias
15 | //
16 | // If you want to overwrite includes/excludes, make sure to copy over the relevant includes/excludes
17 | // from the referenced tsconfig.json - TypeScript does not merge them in
18 | }
19 |
--------------------------------------------------------------------------------
/templates/svelte/sveltekit-wagmi-web3modal/vite.config.ts:
--------------------------------------------------------------------------------
1 | import { sveltekit } from "@sveltejs/kit/vite";
2 | import { defineConfig } from "vite";
3 |
4 | export default defineConfig({
5 | plugins: [sveltekit()],
6 |
7 | server: {
8 | port: 3000,
9 | },
10 | });
11 |
--------------------------------------------------------------------------------
/templates/svelte/sveltekit-wagmi/.gitignore:
--------------------------------------------------------------------------------
1 | # Svelte-kit dev/build outputs
2 | .output
3 | .data
4 | .svelte-kit
5 | .nitro
6 | .cache
7 | dist
8 | vite.config.js.timestamp-*
9 | vite.config.ts.timestamp-*
10 |
11 | # Node dependencies
12 | node_modules
13 |
14 | # Logs
15 | logs
16 | *.log
17 |
18 | # Misc
19 | .DS_Store
20 | .fleet
21 | .idea
22 | package-lock.json
23 |
24 | # Local env files
25 | .env
26 | .env.*
27 | !.env.example
28 |
--------------------------------------------------------------------------------
/templates/svelte/sveltekit-wagmi/.npmrc:
--------------------------------------------------------------------------------
1 | engine-strict=true
2 |
--------------------------------------------------------------------------------
/templates/svelte/sveltekit-wagmi/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "svelte",
3 | "private": true,
4 | "type": "module",
5 | "scripts": {
6 | "dev": "vite dev",
7 | "build": "vite build",
8 | "preview": "vite preview",
9 | "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
10 | "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch"
11 | },
12 | "devDependencies": {
13 | "@sveltejs/adapter-auto": "^3.0.0",
14 | "@sveltejs/kit": "^2.0.0",
15 | "@sveltejs/vite-plugin-svelte": "^3.0.0",
16 | "svelte": "^4.2.7",
17 | "svelte-check": "^3.6.0",
18 | "tslib": "^2.4.1",
19 | "typescript": "^5.0.0",
20 | "vite": "^5.0.3"
21 | },
22 | "dependencies": {
23 | "@wagmi/core": "^1.4.12",
24 | "viem": "^1.20.3"
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/templates/svelte/sveltekit-wagmi/src/app.d.ts:
--------------------------------------------------------------------------------
1 | // See https://kit.svelte.dev/docs/types#app
2 | // for information about these interfaces
3 | declare global {
4 | namespace App {
5 | // interface Error {}
6 | // interface Locals {}
7 | // interface PageData {}
8 | // interface PageState {}
9 | // interface Platform {}
10 | }
11 | }
12 |
13 | export {};
14 |
--------------------------------------------------------------------------------
/templates/svelte/sveltekit-wagmi/src/app.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | %sveltekit.head%
8 |
9 |
10 | %sveltekit.body%
11 |
12 |
13 |
--------------------------------------------------------------------------------
/templates/svelte/sveltekit-wagmi/src/components/Account.svelte:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 | {$wagmiStore.account.address}
7 |
8 |
--------------------------------------------------------------------------------
/templates/svelte/sveltekit-wagmi/src/components/BlockNumber.svelte:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 | {blockNumber?.toString()}
13 |
14 |
--------------------------------------------------------------------------------
/templates/svelte/sveltekit-wagmi/src/components/Connect.svelte:
--------------------------------------------------------------------------------
1 |
8 |
9 |
10 | {#if account.isConnected}
11 |
14 | {:else}
15 | {#each config.connectors as item (item.id)}
16 |
19 | {/each}
20 | {/if}
21 |
22 |
--------------------------------------------------------------------------------
/templates/svelte/sveltekit-wagmi/src/components/Connected.svelte:
--------------------------------------------------------------------------------
1 |
5 |
6 | {#if account.isConnected}
7 |
8 | {/if}
9 |
--------------------------------------------------------------------------------
/templates/svelte/sveltekit-wagmi/src/components/WatchContractEvents.svelte:
--------------------------------------------------------------------------------
1 |
19 |
20 |
21 |
22 | {events.length} DAI `Transfer`s logged
23 |
24 | {events
25 | .reverse()
26 | .map((log) => stringify(log))
27 | .join("\n\n\n\n")}
28 |
29 |
30 |
--------------------------------------------------------------------------------
/templates/svelte/sveltekit-wagmi/src/components/WatchPendingTransactions.svelte:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 | {transactionHashes.length} transaction hashes
14 |
15 | {transactionHashes.reverse().join("\n")}
16 |
17 |
18 |
--------------------------------------------------------------------------------
/templates/svelte/sveltekit-wagmi/src/routes/+layout.ts:
--------------------------------------------------------------------------------
1 | export let ssr = false;
2 |
--------------------------------------------------------------------------------
/templates/svelte/sveltekit-wagmi/src/utils/contracts.ts:
--------------------------------------------------------------------------------
1 | import { erc20ABI } from "@wagmi/core";
2 |
3 | export const daiContractConfig = {
4 | address: "0x604F0416e788779edB06c1A74a75FAad38384C6E", // zkSync Era Sepolia Testnet DAI token address
5 | abi: erc20ABI,
6 | } as const;
7 |
--------------------------------------------------------------------------------
/templates/svelte/sveltekit-wagmi/src/utils/formatters.ts:
--------------------------------------------------------------------------------
1 | export const stringify: typeof JSON.stringify = (value, replacer, space) =>
2 | JSON.stringify(
3 | value,
4 | (key, value_) => {
5 | const value = typeof value_ === "bigint" ? value_.toString() : value_;
6 | return typeof replacer === "function" ? replacer(key, value) : value;
7 | },
8 | space
9 | );
10 |
--------------------------------------------------------------------------------
/templates/svelte/sveltekit-wagmi/static/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matter-labs/zksync-frontend-templates/beab20f5f06cb302939701a1d6baa0df095fb692/templates/svelte/sveltekit-wagmi/static/favicon.png
--------------------------------------------------------------------------------
/templates/svelte/sveltekit-wagmi/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./.svelte-kit/tsconfig.json",
3 | "compilerOptions": {
4 | "allowJs": true,
5 | "checkJs": true,
6 | "esModuleInterop": true,
7 | "forceConsistentCasingInFileNames": true,
8 | "resolveJsonModule": true,
9 | "skipLibCheck": true,
10 | "sourceMap": true,
11 | "strict": true,
12 | "moduleResolution": "bundler"
13 | }
14 | // Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias
15 | //
16 | // If you want to overwrite includes/excludes, make sure to copy over the relevant includes/excludes
17 | // from the referenced tsconfig.json - TypeScript does not merge them in
18 | }
19 |
--------------------------------------------------------------------------------
/templates/svelte/sveltekit-wagmi/vite.config.ts:
--------------------------------------------------------------------------------
1 | import { sveltekit } from "@sveltejs/kit/vite";
2 | import { defineConfig } from "vite";
3 |
4 | export default defineConfig({
5 | plugins: [sveltekit()],
6 |
7 | server: {
8 | port: 3000,
9 | },
10 | });
11 |
--------------------------------------------------------------------------------
/templates/svelte/vite-ethers/.gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 | npm-debug.log*
5 | yarn-debug.log*
6 | yarn-error.log*
7 | pnpm-debug.log*
8 | lerna-debug.log*
9 |
10 | # Node modules and dependencies
11 | node_modules
12 |
13 | # Build outputs
14 | dist
15 | dist-ssr
16 | .output
17 | .data
18 | .svelte-kit
19 | .nitro
20 | .cache
21 |
22 | # Configuration files
23 | vite.config.js.timestamp-*
24 | vite.config.ts.timestamp-*
25 |
26 | # Editor directories and files
27 | .vscode/*
28 | !.vscode/extensions.json
29 | .idea
30 | .DS_Store
31 | *.suo
32 | *.ntvs*
33 | *.njsproj
34 | *.sln
35 | *.sw?
36 |
37 | # Misc
38 | .fleet
39 | package-lock.json
40 |
41 | # Local env files
42 | .env
43 | .env.*
44 | !.env.example
45 |
--------------------------------------------------------------------------------
/templates/svelte/vite-ethers/.vscode/extensions.json:
--------------------------------------------------------------------------------
1 | {
2 | "recommendations": ["svelte.svelte-vscode"]
3 | }
4 |
--------------------------------------------------------------------------------
/templates/svelte/vite-ethers/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | zkSync + ethers + Vite
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/templates/svelte/vite-ethers/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "vite-ethers",
3 | "private": true,
4 | "version": "0.0.0",
5 | "type": "module",
6 | "scripts": {
7 | "dev": "vite",
8 | "build": "vite build",
9 | "preview": "vite preview",
10 | "check": "svelte-check --tsconfig ./tsconfig.json"
11 | },
12 | "devDependencies": {
13 | "@sveltejs/vite-plugin-svelte": "^3.0.2",
14 | "@tsconfig/svelte": "^5.0.2",
15 | "svelte": "^4.2.12",
16 | "svelte-check": "^3.6.6",
17 | "tslib": "^2.6.2",
18 | "typescript": "^5.2.2",
19 | "vite": "^5.1.6"
20 | },
21 | "dependencies": {
22 | "ethers": "^6.9.2",
23 | "zksync-ethers": "^6.5.0"
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/templates/svelte/vite-ethers/src/components/Account.svelte:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 | {$etherStore.account.address}
7 |
8 |
--------------------------------------------------------------------------------
/templates/svelte/vite-ethers/src/components/BlockNumber.svelte:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 | {blockNumber?.toString()}
13 |
14 |
--------------------------------------------------------------------------------
/templates/svelte/vite-ethers/src/components/Connect.svelte:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 | {#if account.isConnected}
10 |
11 | {:else}
12 |
13 | {/if}
14 |
15 |
--------------------------------------------------------------------------------
/templates/svelte/vite-ethers/src/components/Connected.svelte:
--------------------------------------------------------------------------------
1 |
6 |
7 | {#if account.isConnected}
8 |
9 | {/if}
10 |
--------------------------------------------------------------------------------
/templates/svelte/vite-ethers/src/components/WatchPendingTransactions.svelte:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 |
19 | {transactionHashes.length} transaction hashes
20 |
21 | {transactionHashes.reverse().join("\n")}
22 |
23 |
24 |
--------------------------------------------------------------------------------
/templates/svelte/vite-ethers/src/main.ts:
--------------------------------------------------------------------------------
1 | import App from './App.svelte'
2 |
3 | const app = new App({
4 | target: document.getElementById('app')!,
5 | })
6 |
7 | export default app
8 |
--------------------------------------------------------------------------------
/templates/svelte/vite-ethers/src/utils/contracts.ts:
--------------------------------------------------------------------------------
1 | import IERC20 from "zksync-ethers/abi/IERC20.json";
2 |
3 | export const erc20ABI = IERC20;
4 |
5 | export const daiContractConfig = {
6 | address: "0x604F0416e788779edB06c1A74a75FAad38384C6E", // zkSync Era Sepolia Testnet DAI token address
7 | abi: erc20ABI,
8 | } as const;
9 |
--------------------------------------------------------------------------------
/templates/svelte/vite-ethers/src/utils/formatters.ts:
--------------------------------------------------------------------------------
1 | export const stringify: typeof JSON.stringify = (value, replacer, space) => {
2 | return JSON.stringify(
3 | value,
4 | (key, value_) => {
5 | const value = typeof value_ === "bigint" ? value_.toString() : value_;
6 | return typeof replacer === "function" ? replacer(key, value) : value;
7 | },
8 | space
9 | );
10 | };
11 |
--------------------------------------------------------------------------------
/templates/svelte/vite-ethers/src/vite-env.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 | ///
3 |
--------------------------------------------------------------------------------
/templates/svelte/vite-ethers/svelte.config.js:
--------------------------------------------------------------------------------
1 | import { vitePreprocess } from '@sveltejs/vite-plugin-svelte'
2 |
3 | export default {
4 | // Consult https://svelte.dev/docs#compile-time-svelte-preprocess
5 | // for more information about preprocessors
6 | preprocess: vitePreprocess(),
7 | }
8 |
--------------------------------------------------------------------------------
/templates/svelte/vite-ethers/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "@tsconfig/svelte/tsconfig.json",
3 | "compilerOptions": {
4 | "target": "ESNext",
5 | "useDefineForClassFields": true,
6 | "module": "ESNext",
7 | "resolveJsonModule": true,
8 | /**
9 | * Typecheck JS in `.svelte` and `.js` files by default.
10 | * Disable checkJs if you'd like to use dynamic types in JS.
11 | * Note that setting allowJs false does not prevent the use
12 | * of JS in `.svelte` files.
13 | */
14 | "allowJs": true,
15 | "checkJs": true,
16 | "isolatedModules": true
17 | },
18 | "include": ["src/**/*.ts", "src/**/*.js", "src/**/*.svelte"],
19 | "references": [{ "path": "./tsconfig.node.json" }]
20 | }
21 |
--------------------------------------------------------------------------------
/templates/svelte/vite-ethers/tsconfig.node.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "composite": true,
4 | "skipLibCheck": true,
5 | "module": "ESNext",
6 | "moduleResolution": "bundler",
7 | "strict": true
8 | },
9 | "include": ["vite.config.ts"]
10 | }
11 |
--------------------------------------------------------------------------------
/templates/svelte/vite-ethers/vite.config.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig } from "vite";
2 | import { svelte } from "@sveltejs/vite-plugin-svelte";
3 |
4 | // https://vitejs.dev/config/
5 | export default defineConfig({
6 | plugins: [svelte()],
7 |
8 | server: {
9 | port: 3000,
10 | },
11 | });
12 |
--------------------------------------------------------------------------------
/templates/svelte/vite-ethers5/.gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 | npm-debug.log*
5 | yarn-debug.log*
6 | yarn-error.log*
7 | pnpm-debug.log*
8 | lerna-debug.log*
9 |
10 | # Node modules and dependencies
11 | node_modules
12 |
13 | # Build outputs
14 | dist
15 | dist-ssr
16 | .output
17 | .data
18 | .svelte-kit
19 | .nitro
20 | .cache
21 |
22 | # Configuration files
23 | vite.config.js.timestamp-*
24 | vite.config.ts.timestamp-*
25 |
26 | # Editor directories and files
27 | .vscode/*
28 | !.vscode/extensions.json
29 | .idea
30 | .DS_Store
31 | *.suo
32 | *.ntvs*
33 | *.njsproj
34 | *.sln
35 | *.sw?
36 |
37 | # Misc
38 | .fleet
39 | package-lock.json
40 |
41 | # Local env files
42 | .env
43 | .env.*
44 | !.env.example
45 |
--------------------------------------------------------------------------------
/templates/svelte/vite-ethers5/.vscode/extensions.json:
--------------------------------------------------------------------------------
1 | {
2 | "recommendations": ["svelte.svelte-vscode"]
3 | }
4 |
--------------------------------------------------------------------------------
/templates/svelte/vite-ethers5/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | zkSync + ethers + Vite
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/templates/svelte/vite-ethers5/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "vite-ethers",
3 | "private": true,
4 | "version": "0.0.0",
5 | "type": "module",
6 | "scripts": {
7 | "dev": "vite",
8 | "build": "vite build",
9 | "preview": "vite preview",
10 | "check": "svelte-check --tsconfig ./tsconfig.json"
11 | },
12 | "devDependencies": {
13 | "@sveltejs/vite-plugin-svelte": "^3.0.2",
14 | "@tsconfig/svelte": "^5.0.2",
15 | "svelte": "^4.2.12",
16 | "svelte-check": "^3.6.6",
17 | "tslib": "^2.6.2",
18 | "typescript": "^5.2.2",
19 | "vite": "^5.1.6"
20 | },
21 | "dependencies": {
22 | "ethers": "^5.7.2",
23 | "zksync-ethers": "^5.4.0"
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/templates/svelte/vite-ethers5/src/components/Account.svelte:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 | {$etherStore.account.address}
7 |
8 |
--------------------------------------------------------------------------------
/templates/svelte/vite-ethers5/src/components/BlockNumber.svelte:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 | {blockNumber?.toString()}
13 |
14 |
--------------------------------------------------------------------------------
/templates/svelte/vite-ethers5/src/components/Connect.svelte:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 | {#if account.isConnected}
10 |
11 | {:else}
12 |
13 | {/if}
14 |
15 |
--------------------------------------------------------------------------------
/templates/svelte/vite-ethers5/src/components/Connected.svelte:
--------------------------------------------------------------------------------
1 |
6 |
7 | {#if account.isConnected}
8 |
9 | {/if}
10 |
--------------------------------------------------------------------------------
/templates/svelte/vite-ethers5/src/components/WatchPendingTransactions.svelte:
--------------------------------------------------------------------------------
1 |
15 |
16 |
17 |
18 | {transactionHashes.length} transaction hashes
19 |
20 | {transactionHashes.reverse().join("\n")}
21 |
22 |
23 |
--------------------------------------------------------------------------------
/templates/svelte/vite-ethers5/src/main.ts:
--------------------------------------------------------------------------------
1 | import App from './App.svelte'
2 |
3 | const app = new App({
4 | target: document.getElementById('app')!,
5 | })
6 |
7 | export default app
8 |
--------------------------------------------------------------------------------
/templates/svelte/vite-ethers5/src/utils/contracts.ts:
--------------------------------------------------------------------------------
1 | import IERC20 from "zksync-ethers/abi/IERC20.json";
2 |
3 | export const erc20ABI = IERC20;
4 |
5 | export const daiContractConfig = {
6 | address: "0x604F0416e788779edB06c1A74a75FAad38384C6E", // zkSync Era Sepolia Testnet DAI token address
7 | abi: erc20ABI,
8 | } as const;
9 |
--------------------------------------------------------------------------------
/templates/svelte/vite-ethers5/src/utils/formatters.ts:
--------------------------------------------------------------------------------
1 | export const stringify: typeof JSON.stringify = (value, replacer, space) =>
2 | JSON.stringify(
3 | value,
4 | (key, value_) => {
5 | return typeof replacer === 'function' ? replacer(key, value_) : value_
6 | },
7 | space,
8 | )
9 |
--------------------------------------------------------------------------------
/templates/svelte/vite-ethers5/src/vite-env.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 | ///
3 |
--------------------------------------------------------------------------------
/templates/svelte/vite-ethers5/svelte.config.js:
--------------------------------------------------------------------------------
1 | import { vitePreprocess } from '@sveltejs/vite-plugin-svelte'
2 |
3 | export default {
4 | // Consult https://svelte.dev/docs#compile-time-svelte-preprocess
5 | // for more information about preprocessors
6 | preprocess: vitePreprocess(),
7 | }
8 |
--------------------------------------------------------------------------------
/templates/svelte/vite-ethers5/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "@tsconfig/svelte/tsconfig.json",
3 | "compilerOptions": {
4 | "target": "ESNext",
5 | "useDefineForClassFields": true,
6 | "module": "ESNext",
7 | "resolveJsonModule": true,
8 | /**
9 | * Typecheck JS in `.svelte` and `.js` files by default.
10 | * Disable checkJs if you'd like to use dynamic types in JS.
11 | * Note that setting allowJs false does not prevent the use
12 | * of JS in `.svelte` files.
13 | */
14 | "allowJs": true,
15 | "checkJs": true,
16 | "isolatedModules": true
17 | },
18 | "include": ["src/**/*.ts", "src/**/*.js", "src/**/*.svelte"],
19 | "references": [{ "path": "./tsconfig.node.json" }]
20 | }
21 |
--------------------------------------------------------------------------------
/templates/svelte/vite-ethers5/tsconfig.node.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "composite": true,
4 | "skipLibCheck": true,
5 | "module": "ESNext",
6 | "moduleResolution": "bundler",
7 | "strict": true
8 | },
9 | "include": ["vite.config.ts"]
10 | }
11 |
--------------------------------------------------------------------------------
/templates/svelte/vite-ethers5/vite.config.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig } from "vite";
2 | import { svelte } from "@sveltejs/vite-plugin-svelte";
3 |
4 | // https://vitejs.dev/config/
5 | export default defineConfig({
6 | plugins: [svelte()],
7 |
8 | server: {
9 | port: 3000,
10 | },
11 | });
12 |
--------------------------------------------------------------------------------
/templates/svelte/vite-wagmi-web3modal/.gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 | npm-debug.log*
5 | yarn-debug.log*
6 | yarn-error.log*
7 | pnpm-debug.log*
8 | lerna-debug.log*
9 |
10 | # Node modules and dependencies
11 | node_modules
12 |
13 | # Build outputs
14 | dist
15 | dist-ssr
16 | .output
17 | .data
18 | .svelte-kit
19 | .nitro
20 | .cache
21 |
22 | # Configuration files
23 | vite.config.js.timestamp-*
24 | vite.config.ts.timestamp-*
25 |
26 | # Editor directories and files
27 | .vscode/*
28 | !.vscode/extensions.json
29 | .idea
30 | .DS_Store
31 | *.suo
32 | *.ntvs*
33 | *.njsproj
34 | *.sln
35 | *.sw?
36 |
37 | # Misc
38 | .fleet
39 | package-lock.json
40 |
41 | # Local env files
42 | .env
43 | .env.*
44 | !.env.example
45 |
--------------------------------------------------------------------------------
/templates/svelte/vite-wagmi-web3modal/.vscode/extensions.json:
--------------------------------------------------------------------------------
1 | {
2 | "recommendations": ["svelte.svelte-vscode"]
3 | }
4 |
--------------------------------------------------------------------------------
/templates/svelte/vite-wagmi-web3modal/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | zkSync + ethers + Vite
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/templates/svelte/vite-wagmi-web3modal/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "vite-ethers",
3 | "private": true,
4 | "version": "0.0.0",
5 | "type": "module",
6 | "scripts": {
7 | "dev": "vite",
8 | "build": "vite build",
9 | "preview": "vite preview",
10 | "check": "svelte-check --tsconfig ./tsconfig.json"
11 | },
12 | "devDependencies": {
13 | "@sveltejs/vite-plugin-svelte": "^3.0.2",
14 | "@tsconfig/svelte": "^5.0.2",
15 | "svelte": "^4.2.12",
16 | "svelte-check": "^3.6.6",
17 | "tslib": "^2.6.2",
18 | "typescript": "^5.2.2",
19 | "vite": "^5.1.6"
20 | },
21 | "dependencies": {
22 | "@wagmi/core": "^1.4.5",
23 | "@web3modal/wagmi": "^3.5.1",
24 | "viem": "^1.20.3"
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/templates/svelte/vite-wagmi-web3modal/src/components/Account.svelte:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 | {$wagmiStore.account.address}
7 |
8 |
--------------------------------------------------------------------------------
/templates/svelte/vite-wagmi-web3modal/src/components/BlockNumber.svelte:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 | {blockNumber?.toString()}
13 |
14 |
--------------------------------------------------------------------------------
/templates/svelte/vite-wagmi-web3modal/src/components/Connected.svelte:
--------------------------------------------------------------------------------
1 |
5 |
6 | {#if account.isConnected}
7 |
8 | {/if}
9 |
--------------------------------------------------------------------------------
/templates/svelte/vite-wagmi-web3modal/src/components/WatchContractEvents.svelte:
--------------------------------------------------------------------------------
1 |
19 |
20 |
21 |
22 | {events.length} DAI `Transfer`s logged
23 |
24 | {events
25 | .reverse()
26 | .map((log) => stringify(log))
27 | .join("\n\n\n\n")}
28 |
29 |
30 |
--------------------------------------------------------------------------------
/templates/svelte/vite-wagmi-web3modal/src/components/WatchPendingTransactions.svelte:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 | {transactionHashes.length} transaction hashes
14 |
15 | {transactionHashes.reverse().join("\n")}
16 |
17 |
18 |
--------------------------------------------------------------------------------
/templates/svelte/vite-wagmi-web3modal/src/main.ts:
--------------------------------------------------------------------------------
1 | import App from './App.svelte'
2 |
3 | const app = new App({
4 | target: document.getElementById('app')!,
5 | })
6 |
7 | export default app
8 |
--------------------------------------------------------------------------------
/templates/svelte/vite-wagmi-web3modal/src/utils/contracts.ts:
--------------------------------------------------------------------------------
1 | import { erc20ABI } from "@wagmi/core";
2 |
3 | export const daiContractConfig = {
4 | address: "0x604F0416e788779edB06c1A74a75FAad38384C6E", // zkSync Era Sepolia Testnet DAI token address
5 | abi: erc20ABI,
6 | } as const;
7 |
--------------------------------------------------------------------------------
/templates/svelte/vite-wagmi-web3modal/src/utils/formatters.ts:
--------------------------------------------------------------------------------
1 | export const stringify: typeof JSON.stringify = (value, replacer, space) => {
2 | return JSON.stringify(
3 | value,
4 | (key, value_) => {
5 | const value = typeof value_ === "bigint" ? value_.toString() : value_;
6 | return typeof replacer === "function" ? replacer(key, value) : value;
7 | },
8 | space
9 | );
10 | };
11 |
--------------------------------------------------------------------------------
/templates/svelte/vite-wagmi-web3modal/src/vite-env.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 | ///
3 |
--------------------------------------------------------------------------------
/templates/svelte/vite-wagmi-web3modal/svelte.config.js:
--------------------------------------------------------------------------------
1 | import { vitePreprocess } from '@sveltejs/vite-plugin-svelte'
2 |
3 | export default {
4 | // Consult https://svelte.dev/docs#compile-time-svelte-preprocess
5 | // for more information about preprocessors
6 | preprocess: vitePreprocess(),
7 | }
8 |
--------------------------------------------------------------------------------
/templates/svelte/vite-wagmi-web3modal/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "@tsconfig/svelte/tsconfig.json",
3 | "compilerOptions": {
4 | "target": "ESNext",
5 | "useDefineForClassFields": true,
6 | "module": "ESNext",
7 | "resolveJsonModule": true,
8 | /**
9 | * Typecheck JS in `.svelte` and `.js` files by default.
10 | * Disable checkJs if you'd like to use dynamic types in JS.
11 | * Note that setting allowJs false does not prevent the use
12 | * of JS in `.svelte` files.
13 | */
14 | "allowJs": true,
15 | "checkJs": true,
16 | "isolatedModules": true
17 | },
18 | "include": ["src/**/*.ts", "src/**/*.js", "src/**/*.svelte"],
19 | "references": [{ "path": "./tsconfig.node.json" }]
20 | }
21 |
--------------------------------------------------------------------------------
/templates/svelte/vite-wagmi-web3modal/tsconfig.node.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "composite": true,
4 | "skipLibCheck": true,
5 | "module": "ESNext",
6 | "moduleResolution": "bundler",
7 | "strict": true
8 | },
9 | "include": ["vite.config.ts"]
10 | }
11 |
--------------------------------------------------------------------------------
/templates/svelte/vite-wagmi-web3modal/vite.config.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig } from "vite";
2 | import { svelte } from "@sveltejs/vite-plugin-svelte";
3 |
4 | // https://vitejs.dev/config/
5 | export default defineConfig({
6 | plugins: [svelte()],
7 | });
8 |
--------------------------------------------------------------------------------
/templates/svelte/vite-wagmi/.gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 | npm-debug.log*
5 | yarn-debug.log*
6 | yarn-error.log*
7 | pnpm-debug.log*
8 | lerna-debug.log*
9 |
10 | # Node modules and dependencies
11 | node_modules
12 |
13 | # Build outputs
14 | dist
15 | dist-ssr
16 | .output
17 | .data
18 | .svelte-kit
19 | .nitro
20 | .cache
21 |
22 | # Configuration files
23 | vite.config.js.timestamp-*
24 | vite.config.ts.timestamp-*
25 |
26 | # Editor directories and files
27 | .vscode/*
28 | !.vscode/extensions.json
29 | .idea
30 | .DS_Store
31 | *.suo
32 | *.ntvs*
33 | *.njsproj
34 | *.sln
35 | *.sw?
36 |
37 | # Misc
38 | .fleet
39 | package-lock.json
40 |
41 | # Local env files
42 | .env
43 | .env.*
44 | !.env.example
45 |
--------------------------------------------------------------------------------
/templates/svelte/vite-wagmi/.vscode/extensions.json:
--------------------------------------------------------------------------------
1 | {
2 | "recommendations": ["svelte.svelte-vscode"]
3 | }
4 |
--------------------------------------------------------------------------------
/templates/svelte/vite-wagmi/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | zkSync + ethers + Vite
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/templates/svelte/vite-wagmi/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "vite-ethers",
3 | "private": true,
4 | "version": "0.0.0",
5 | "type": "module",
6 | "scripts": {
7 | "dev": "vite",
8 | "build": "vite build",
9 | "preview": "vite preview",
10 | "check": "svelte-check --tsconfig ./tsconfig.json"
11 | },
12 | "devDependencies": {
13 | "@sveltejs/vite-plugin-svelte": "^3.0.2",
14 | "@tsconfig/svelte": "^5.0.2",
15 | "svelte": "^4.2.12",
16 | "svelte-check": "^3.6.6",
17 | "tslib": "^2.6.2",
18 | "typescript": "^5.2.2",
19 | "vite": "^5.1.6"
20 | },
21 | "dependencies": {
22 | "@wagmi/core": "^1.4.12",
23 | "viem": "^1.20.3"
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/templates/svelte/vite-wagmi/src/components/Account.svelte:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 | {$wagmiStore.account.address}
7 |
8 |
--------------------------------------------------------------------------------
/templates/svelte/vite-wagmi/src/components/BlockNumber.svelte:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 | {blockNumber?.toString()}
13 |
14 |
--------------------------------------------------------------------------------
/templates/svelte/vite-wagmi/src/components/Connect.svelte:
--------------------------------------------------------------------------------
1 |
8 |
9 |
10 | {#if account.isConnected}
11 |
14 | {:else}
15 | {#each config.connectors as item (item.id)}
16 |
19 | {/each}
20 | {/if}
21 |
22 |
--------------------------------------------------------------------------------
/templates/svelte/vite-wagmi/src/components/Connected.svelte:
--------------------------------------------------------------------------------
1 |
5 |
6 | {#if account.isConnected}
7 |
8 | {/if}
9 |
--------------------------------------------------------------------------------
/templates/svelte/vite-wagmi/src/components/WatchContractEvents.svelte:
--------------------------------------------------------------------------------
1 |
19 |
20 |
21 |
22 | {events.length} DAI `Transfer`s logged
23 |
24 | {events
25 | .reverse()
26 | .map((log) => stringify(log))
27 | .join("\n\n\n\n")}
28 |
29 |
30 |
--------------------------------------------------------------------------------
/templates/svelte/vite-wagmi/src/components/WatchPendingTransactions.svelte:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 | {transactionHashes.length} transaction hashes
14 |
15 | {transactionHashes.reverse().join("\n")}
16 |
17 |
18 |
--------------------------------------------------------------------------------
/templates/svelte/vite-wagmi/src/main.ts:
--------------------------------------------------------------------------------
1 | import App from './App.svelte'
2 |
3 | const app = new App({
4 | target: document.getElementById('app')!,
5 | })
6 |
7 | export default app
8 |
--------------------------------------------------------------------------------
/templates/svelte/vite-wagmi/src/utils/contracts.ts:
--------------------------------------------------------------------------------
1 | import { erc20ABI } from "@wagmi/core";
2 |
3 | export const daiContractConfig = {
4 | address: "0x604F0416e788779edB06c1A74a75FAad38384C6E", // zkSync Era Sepolia Testnet DAI token address
5 | abi: erc20ABI,
6 | } as const;
7 |
--------------------------------------------------------------------------------
/templates/svelte/vite-wagmi/src/utils/formatters.ts:
--------------------------------------------------------------------------------
1 | export const stringify: typeof JSON.stringify = (value, replacer, space) => {
2 | return JSON.stringify(
3 | value,
4 | (key, value_) => {
5 | const value = typeof value_ === "bigint" ? value_.toString() : value_;
6 | return typeof replacer === "function" ? replacer(key, value) : value;
7 | },
8 | space
9 | );
10 | };
11 |
--------------------------------------------------------------------------------
/templates/svelte/vite-wagmi/src/vite-env.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 | ///
3 |
--------------------------------------------------------------------------------
/templates/svelte/vite-wagmi/svelte.config.js:
--------------------------------------------------------------------------------
1 | import { vitePreprocess } from '@sveltejs/vite-plugin-svelte'
2 |
3 | export default {
4 | // Consult https://svelte.dev/docs#compile-time-svelte-preprocess
5 | // for more information about preprocessors
6 | preprocess: vitePreprocess(),
7 | }
8 |
--------------------------------------------------------------------------------
/templates/svelte/vite-wagmi/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "@tsconfig/svelte/tsconfig.json",
3 | "compilerOptions": {
4 | "target": "ESNext",
5 | "useDefineForClassFields": true,
6 | "module": "ESNext",
7 | "resolveJsonModule": true,
8 | /**
9 | * Typecheck JS in `.svelte` and `.js` files by default.
10 | * Disable checkJs if you'd like to use dynamic types in JS.
11 | * Note that setting allowJs false does not prevent the use
12 | * of JS in `.svelte` files.
13 | */
14 | "allowJs": true,
15 | "checkJs": true,
16 | "isolatedModules": true
17 | },
18 | "include": ["src/**/*.ts", "src/**/*.js", "src/**/*.svelte"],
19 | "references": [{ "path": "./tsconfig.node.json" }]
20 | }
21 |
--------------------------------------------------------------------------------
/templates/svelte/vite-wagmi/tsconfig.node.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "composite": true,
4 | "skipLibCheck": true,
5 | "module": "ESNext",
6 | "moduleResolution": "bundler",
7 | "strict": true
8 | },
9 | "include": ["vite.config.ts"]
10 | }
11 |
--------------------------------------------------------------------------------
/templates/svelte/vite-wagmi/vite.config.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig } from "vite";
2 | import { svelte } from "@sveltejs/vite-plugin-svelte";
3 |
4 | // https://vitejs.dev/config/
5 | export default defineConfig({
6 | plugins: [svelte()],
7 | });
8 |
--------------------------------------------------------------------------------
/templates/vue/nuxt3-ethers/.gitignore:
--------------------------------------------------------------------------------
1 | # Nuxt dev/build outputs
2 | .output
3 | .data
4 | .nuxt
5 | .nitro
6 | .cache
7 | dist
8 |
9 | # Node dependencies
10 | node_modules
11 |
12 | # Logs
13 | logs
14 | *.log
15 |
16 | # Misc
17 | .DS_Store
18 | .fleet
19 | .idea
20 |
21 | # Local env files
22 | .env
23 | .env.*
24 | !.env.example
25 |
--------------------------------------------------------------------------------
/templates/vue/nuxt3-ethers/app.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/templates/vue/nuxt3-ethers/components/Account.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 | {{ account.address }}
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/templates/vue/nuxt3-ethers/components/BlockNumber.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 | {{ blockNumber?.toString() }}
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/templates/vue/nuxt3-ethers/components/Connect.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
7 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/templates/vue/nuxt3-ethers/components/Connected.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/templates/vue/nuxt3-ethers/components/FindBalance.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Find balance:
5 |
6 |
7 |
8 |
{{ balance ? ethers.formatEther(balance): "" }}
9 |
Error: {{ error?.message }}
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/templates/vue/nuxt3-ethers/components/ReadTokenSupply.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Total Supply: {{ supply?.toString() }}
5 |
6 |
7 |
Error: {{ error?.message }}
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/templates/vue/nuxt3-ethers/components/WatchPendingTransactions.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | {{ transactionHashes.length }} transaction hashes
5 |
6 | {{ transactionHashes.reverse().join('\n') }}
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/templates/vue/nuxt3-ethers/nuxt.config.ts:
--------------------------------------------------------------------------------
1 | // https://nuxt.com/docs/api/configuration/nuxt-config
2 | export default defineNuxtConfig({
3 | app: {
4 | head: {
5 | title: "zkSync + ethers + Nuxt 3"
6 | }
7 | },
8 | ssr: false,
9 | devtools: { enabled: true },
10 | modules: ['@pinia/nuxt'],
11 |
12 | pinia: {
13 | autoImports: [
14 | // automatically imports `defineStore`
15 | "defineStore",
16 | "storeToRefs",
17 | ],
18 | },
19 | imports: {
20 | dirs: ["store"],
21 | },
22 | })
23 |
--------------------------------------------------------------------------------
/templates/vue/nuxt3-ethers/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "nuxt-app",
3 | "private": true,
4 | "type": "module",
5 | "scripts": {
6 | "build": "nuxt build",
7 | "dev": "nuxt dev",
8 | "generate": "nuxt generate",
9 | "preview": "nuxt preview",
10 | "postinstall": "nuxt prepare"
11 | },
12 | "devDependencies": {
13 | "@nuxt/devtools": "latest",
14 | "nuxt": "^3.8.0",
15 | "vue": "^3.3.7",
16 | "vue-router": "^4.2.5"
17 | },
18 | "dependencies": {
19 | "@pinia/nuxt": "^0.5.1",
20 | "ethers": "^6.9.2",
21 | "pinia": "^2.1.7",
22 | "zksync-ethers": "^6.0.0"
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/templates/vue/nuxt3-ethers/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matter-labs/zksync-frontend-templates/beab20f5f06cb302939701a1d6baa0df095fb692/templates/vue/nuxt3-ethers/public/favicon.ico
--------------------------------------------------------------------------------
/templates/vue/nuxt3-ethers/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | // https://nuxt.com/docs/guide/concepts/typescript
3 | "extends": "./.nuxt/tsconfig.json"
4 | }
5 |
--------------------------------------------------------------------------------
/templates/vue/nuxt3-ethers/utils/contracts.ts:
--------------------------------------------------------------------------------
1 | import IERC20 from "zksync-ethers/abi/IERC20.json";
2 |
3 | export const erc20ABI = IERC20;
4 |
5 | export const daiContractConfig = {
6 | address: "0x604F0416e788779edB06c1A74a75FAad38384C6E", // zkSync Era Sepolia Testnet DAI token address
7 | abi: erc20ABI,
8 | } as const;
9 |
--------------------------------------------------------------------------------
/templates/vue/nuxt3-ethers/utils/formatters.ts:
--------------------------------------------------------------------------------
1 | export const stringify: typeof JSON.stringify = (value, replacer, space) =>
2 | JSON.stringify(
3 | value,
4 | (key, value_) => {
5 | return typeof replacer === 'function' ? replacer(key, value_) : value_
6 | },
7 | space,
8 | )
9 |
--------------------------------------------------------------------------------
/templates/vue/nuxt3-ethers5/.gitignore:
--------------------------------------------------------------------------------
1 | # Nuxt dev/build outputs
2 | .output
3 | .data
4 | .nuxt
5 | .nitro
6 | .cache
7 | dist
8 |
9 | # Node dependencies
10 | node_modules
11 |
12 | # Logs
13 | logs
14 | *.log
15 |
16 | # Misc
17 | .DS_Store
18 | .fleet
19 | .idea
20 |
21 | # Local env files
22 | .env
23 | .env.*
24 | !.env.example
25 |
--------------------------------------------------------------------------------
/templates/vue/nuxt3-ethers5/app.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/templates/vue/nuxt3-ethers5/components/Account.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 | {{ account.address }}
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/templates/vue/nuxt3-ethers5/components/BlockNumber.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 | {{ blockNumber?.toString() }}
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/templates/vue/nuxt3-ethers5/components/Connect.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
7 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/templates/vue/nuxt3-ethers5/components/Connected.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/templates/vue/nuxt3-ethers5/components/FindBalance.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Find balance:
5 |
6 |
7 |
8 |
{{ balance ? formatEther(balance): "" }}
9 |
Error: {{ error?.message }}
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/templates/vue/nuxt3-ethers5/components/ReadTokenSupply.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Total Supply: {{ supply?.toString() }}
5 |
6 |
7 |
Error: {{ error?.message }}
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/templates/vue/nuxt3-ethers5/components/WatchPendingTransactions.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | {{ transactionHashes.length }} transaction hashes
5 |
6 | {{ transactionHashes.reverse().join('\n') }}
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/templates/vue/nuxt3-ethers5/nuxt.config.ts:
--------------------------------------------------------------------------------
1 | // https://nuxt.com/docs/api/configuration/nuxt-config
2 | export default defineNuxtConfig({
3 | app: {
4 | head: {
5 | title: "zkSync + ethers v5 + Nuxt 3"
6 | }
7 | },
8 | ssr: false,
9 | devtools: { enabled: true },
10 | modules: ['@pinia/nuxt'],
11 |
12 | pinia: {
13 | autoImports: [
14 | // automatically imports `defineStore`
15 | "defineStore",
16 | "storeToRefs",
17 | ],
18 | },
19 | imports: {
20 | dirs: ["store"],
21 | },
22 | })
23 |
--------------------------------------------------------------------------------
/templates/vue/nuxt3-ethers5/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "nuxt-app",
3 | "private": true,
4 | "type": "module",
5 | "scripts": {
6 | "build": "nuxt build",
7 | "dev": "nuxt dev",
8 | "generate": "nuxt generate",
9 | "preview": "nuxt preview",
10 | "postinstall": "nuxt prepare"
11 | },
12 | "devDependencies": {
13 | "@nuxt/devtools": "latest",
14 | "nuxt": "^3.8.0",
15 | "vue": "^3.3.7",
16 | "vue-router": "^4.2.5"
17 | },
18 | "dependencies": {
19 | "@pinia/nuxt": "^0.5.1",
20 | "ethers": "^5.7.2",
21 | "pinia": "^2.1.7",
22 | "zksync-ethers": "^5.0.0"
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/templates/vue/nuxt3-ethers5/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matter-labs/zksync-frontend-templates/beab20f5f06cb302939701a1d6baa0df095fb692/templates/vue/nuxt3-ethers5/public/favicon.ico
--------------------------------------------------------------------------------
/templates/vue/nuxt3-ethers5/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | // https://nuxt.com/docs/guide/concepts/typescript
3 | "extends": "./.nuxt/tsconfig.json"
4 | }
5 |
--------------------------------------------------------------------------------
/templates/vue/nuxt3-ethers5/utils/contracts.ts:
--------------------------------------------------------------------------------
1 | import IERC20 from "zksync-ethers/abi/IERC20.json";
2 |
3 | export const erc20ABI = IERC20;
4 |
5 | export const daiContractConfig = {
6 | address: "0x604F0416e788779edB06c1A74a75FAad38384C6E", // zkSync Era Sepolia Testnet DAI token address
7 | abi: erc20ABI,
8 | } as const;
9 |
--------------------------------------------------------------------------------
/templates/vue/nuxt3-ethers5/utils/formatters.ts:
--------------------------------------------------------------------------------
1 | export const stringify: typeof JSON.stringify = (value, replacer, space) =>
2 | JSON.stringify(
3 | value,
4 | (key, value_) => {
5 | return typeof replacer === 'function' ? replacer(key, value_) : value_
6 | },
7 | space,
8 | )
9 |
--------------------------------------------------------------------------------
/templates/vue/nuxt3-wagmi-web3modal/.env.example:
--------------------------------------------------------------------------------
1 | WALLET_CONNECT_PROJECT_ID=
2 |
--------------------------------------------------------------------------------
/templates/vue/nuxt3-wagmi-web3modal/.gitignore:
--------------------------------------------------------------------------------
1 | # Nuxt dev/build outputs
2 | .output
3 | .data
4 | .nuxt
5 | .nitro
6 | .cache
7 | dist
8 |
9 | # Node dependencies
10 | node_modules
11 |
12 | # Logs
13 | logs
14 | *.log
15 |
16 | # Misc
17 | .DS_Store
18 | .fleet
19 | .idea
20 |
21 | # Local env files
22 | .env
23 | .env.*
24 | !.env.example
25 |
--------------------------------------------------------------------------------
/templates/vue/nuxt3-wagmi-web3modal/app.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/templates/vue/nuxt3-wagmi-web3modal/components/Account.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 | {{ account.address }}
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/templates/vue/nuxt3-wagmi-web3modal/components/BlockNumber.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 | {{ blockNumber?.toString() }}
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/templates/vue/nuxt3-wagmi-web3modal/components/Connected.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/templates/vue/nuxt3-wagmi-web3modal/components/FindBalance.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Find balance:
5 |
6 |
7 |
8 |
{{ balance?.formatted }}
9 |
Error: {{ error?.message }}
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/templates/vue/nuxt3-wagmi-web3modal/components/ReadTokenSupply.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Total Supply: {{ supply?.toString() }}
5 |
6 |
7 |
Error: {{ error?.message }}
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/templates/vue/nuxt3-wagmi-web3modal/components/WatchContractEvents.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | {{ events.length }} DAI `Transfer`s logged
5 |
6 | {{
7 | events
8 | .reverse()
9 | .map((log) => stringify(log))
10 | .join('\n\n\n\n')
11 | }}
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/templates/vue/nuxt3-wagmi-web3modal/components/WatchPendingTransactions.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | {{ transactionHashes.length }} transaction hashes
5 |
6 | {{ transactionHashes.reverse().join('\n') }}
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/templates/vue/nuxt3-wagmi-web3modal/nuxt.config.ts:
--------------------------------------------------------------------------------
1 | // https://nuxt.com/docs/api/configuration/nuxt-config
2 | export default defineNuxtConfig({
3 | app: {
4 | head: {
5 | title: "zkSync + wagmi + Web3Modal + Nuxt 3"
6 | }
7 | },
8 | ssr: false,
9 | devtools: { enabled: true },
10 | modules: ['@pinia/nuxt'],
11 | appConfig: {
12 | walletConnectProjectID: process.env.WALLET_CONNECT_PROJECT_ID,
13 | },
14 |
15 | pinia: {
16 | autoImports: [
17 | // automatically imports `defineStore`
18 | "defineStore",
19 | "storeToRefs",
20 | ],
21 | },
22 | imports: {
23 | dirs: ["store"],
24 | },
25 |
26 | vue: {
27 | compilerOptions: {
28 | isCustomElement: (tag) => ['w3m-button'].includes(tag),
29 | },
30 | },
31 | })
32 |
--------------------------------------------------------------------------------
/templates/vue/nuxt3-wagmi-web3modal/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "nuxt-app",
3 | "private": true,
4 | "type": "module",
5 | "scripts": {
6 | "build": "nuxt build",
7 | "dev": "nuxt dev",
8 | "generate": "nuxt generate",
9 | "preview": "nuxt preview",
10 | "postinstall": "nuxt prepare"
11 | },
12 | "devDependencies": {
13 | "@nuxt/devtools": "latest",
14 | "nuxt": "^3.8.0",
15 | "vue": "^3.3.7",
16 | "vue-router": "^4.2.5"
17 | },
18 | "dependencies": {
19 | "@pinia/nuxt": "^0.5.1",
20 | "@wagmi/core": "^1.4.5",
21 | "@web3modal/wagmi": "^3.5.1",
22 | "pinia": "^2.1.7",
23 | "viem": "^1.20.3"
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/templates/vue/nuxt3-wagmi-web3modal/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matter-labs/zksync-frontend-templates/beab20f5f06cb302939701a1d6baa0df095fb692/templates/vue/nuxt3-wagmi-web3modal/public/favicon.ico
--------------------------------------------------------------------------------
/templates/vue/nuxt3-wagmi-web3modal/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | // https://nuxt.com/docs/guide/concepts/typescript
3 | "extends": "./.nuxt/tsconfig.json"
4 | }
5 |
--------------------------------------------------------------------------------
/templates/vue/nuxt3-wagmi-web3modal/utils/contracts.ts:
--------------------------------------------------------------------------------
1 | import { erc20ABI } from "@wagmi/core";
2 |
3 | export const daiContractConfig = {
4 | address: "0x604F0416e788779edB06c1A74a75FAad38384C6E", // zkSync Era Sepolia Testnet DAI token address
5 | abi: erc20ABI,
6 | } as const;
7 |
--------------------------------------------------------------------------------
/templates/vue/nuxt3-wagmi-web3modal/utils/formatters.ts:
--------------------------------------------------------------------------------
1 | export const stringify: typeof JSON.stringify = (value, replacer, space) =>
2 | JSON.stringify(
3 | value,
4 | (key, value_) => {
5 | const value = typeof value_ === 'bigint' ? value_.toString() : value_
6 | return typeof replacer === 'function' ? replacer(key, value) : value
7 | },
8 | space,
9 | )
10 |
--------------------------------------------------------------------------------
/templates/vue/nuxt3-wagmi/.gitignore:
--------------------------------------------------------------------------------
1 | # Nuxt dev/build outputs
2 | .output
3 | .data
4 | .nuxt
5 | .nitro
6 | .cache
7 | dist
8 |
9 | # Node dependencies
10 | node_modules
11 |
12 | # Logs
13 | logs
14 | *.log
15 |
16 | # Misc
17 | .DS_Store
18 | .fleet
19 | .idea
20 |
21 | # Local env files
22 | .env
23 | .env.*
24 | !.env.example
25 |
--------------------------------------------------------------------------------
/templates/vue/nuxt3-wagmi/app.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/templates/vue/nuxt3-wagmi/components/Account.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 | {{ account.address }}
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/templates/vue/nuxt3-wagmi/components/BlockNumber.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 | {{ blockNumber?.toString() }}
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/templates/vue/nuxt3-wagmi/components/Connect.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
7 |
8 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/templates/vue/nuxt3-wagmi/components/Connected.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/templates/vue/nuxt3-wagmi/components/FindBalance.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Find balance:
5 |
6 |
7 |
8 |
{{ balance?.formatted }}
9 |
Error: {{ error?.message }}
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/templates/vue/nuxt3-wagmi/components/ReadTokenSupply.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Total Supply: {{ supply?.toString() }}
5 |
6 |
7 |
Error: {{ error?.message }}
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/templates/vue/nuxt3-wagmi/components/WatchContractEvents.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | {{ events.length }} DAI `Transfer`s logged
5 |
6 | {{
7 | events
8 | .reverse()
9 | .map((log) => stringify(log))
10 | .join('\n\n\n\n')
11 | }}
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/templates/vue/nuxt3-wagmi/components/WatchPendingTransactions.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | {{ transactionHashes.length }} transaction hashes
5 |
6 | {{ transactionHashes.reverse().join('\n') }}
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/templates/vue/nuxt3-wagmi/nuxt.config.ts:
--------------------------------------------------------------------------------
1 | // https://nuxt.com/docs/api/configuration/nuxt-config
2 | export default defineNuxtConfig({
3 | app: {
4 | head: {
5 | title: "zkSync + wagmi + Nuxt 3"
6 | }
7 | },
8 | ssr: false,
9 | devtools: { enabled: true },
10 | modules: ['@pinia/nuxt'],
11 |
12 | pinia: {
13 | autoImports: [
14 | // automatically imports `defineStore`
15 | "defineStore",
16 | "storeToRefs",
17 | ],
18 | },
19 | imports: {
20 | dirs: ["store"],
21 | },
22 | })
23 |
--------------------------------------------------------------------------------
/templates/vue/nuxt3-wagmi/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "nuxt-app",
3 | "private": true,
4 | "type": "module",
5 | "scripts": {
6 | "build": "nuxt build",
7 | "dev": "nuxt dev",
8 | "generate": "nuxt generate",
9 | "preview": "nuxt preview",
10 | "postinstall": "nuxt prepare"
11 | },
12 | "devDependencies": {
13 | "@nuxt/devtools": "latest",
14 | "nuxt": "^3.8.0",
15 | "vue": "^3.3.7",
16 | "vue-router": "^4.2.5"
17 | },
18 | "dependencies": {
19 | "@pinia/nuxt": "^0.5.1",
20 | "@wagmi/core": "^1.4.12",
21 | "pinia": "^2.1.7",
22 | "viem": "^1.20.3"
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/templates/vue/nuxt3-wagmi/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matter-labs/zksync-frontend-templates/beab20f5f06cb302939701a1d6baa0df095fb692/templates/vue/nuxt3-wagmi/public/favicon.ico
--------------------------------------------------------------------------------
/templates/vue/nuxt3-wagmi/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | // https://nuxt.com/docs/guide/concepts/typescript
3 | "extends": "./.nuxt/tsconfig.json"
4 | }
5 |
--------------------------------------------------------------------------------
/templates/vue/nuxt3-wagmi/utils/contracts.ts:
--------------------------------------------------------------------------------
1 | import { erc20ABI } from "@wagmi/core";
2 |
3 | export const daiContractConfig = {
4 | address: "0x604F0416e788779edB06c1A74a75FAad38384C6E", // zkSync Era Sepolia Testnet DAI token address
5 | abi: erc20ABI,
6 | } as const;
7 |
--------------------------------------------------------------------------------
/templates/vue/nuxt3-wagmi/utils/formatters.ts:
--------------------------------------------------------------------------------
1 | export const stringify: typeof JSON.stringify = (value, replacer, space) =>
2 | JSON.stringify(
3 | value,
4 | (key, value_) => {
5 | const value = typeof value_ === 'bigint' ? value_.toString() : value_
6 | return typeof replacer === 'function' ? replacer(key, value) : value
7 | },
8 | space,
9 | )
10 |
--------------------------------------------------------------------------------
/templates/vue/vite-ethers/.gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 | npm-debug.log*
5 | yarn-debug.log*
6 | yarn-error.log*
7 | pnpm-debug.log*
8 | lerna-debug.log*
9 |
10 | node_modules
11 | dist
12 | dist-ssr
13 | *.local
14 | .env
15 |
16 | # Editor directories and files
17 | .vscode/*
18 | !.vscode/extensions.json
19 | .idea
20 | .DS_Store
21 | *.suo
22 | *.ntvs*
23 | *.njsproj
24 | *.sln
25 | *.sw?
26 |
--------------------------------------------------------------------------------
/templates/vue/vite-ethers/.vscode/extensions.json:
--------------------------------------------------------------------------------
1 | {
2 | "recommendations": ["Vue.volar", "Vue.vscode-typescript-vue-plugin"]
3 | }
4 |
--------------------------------------------------------------------------------
/templates/vue/vite-ethers/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | zkSync + ethers + Vite
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/templates/vue/vite-ethers/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "vue-vite-wagmi-web3modal",
3 | "private": true,
4 | "version": "0.0.0",
5 | "type": "module",
6 | "scripts": {
7 | "dev": "vite",
8 | "build": "vue-tsc && vite build",
9 | "preview": "vite preview"
10 | },
11 | "dependencies": {
12 | "ethers": "^6.9.2",
13 | "vue": "^3.3.4",
14 | "zksync-ethers": "^6.0.0"
15 | },
16 | "devDependencies": {
17 | "@vitejs/plugin-vue": "^4.2.3",
18 | "typescript": "^5.0.2",
19 | "vite": "^4.4.5",
20 | "vue-tsc": "^1.8.5"
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/templates/vue/vite-ethers/src/assets/vue.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/templates/vue/vite-ethers/src/components/Account.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 | {{ account.address }}
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/templates/vue/vite-ethers/src/components/BlockNumber.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 | {{ blockNumber?.toString() }}
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/templates/vue/vite-ethers/src/components/Connect.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
7 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/templates/vue/vite-ethers/src/components/Connected.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/templates/vue/vite-ethers/src/components/WatchPendingTransactions.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | {{ transactionHashes.length }} transaction hashes
5 |
6 | {{ transactionHashes.reverse().join('\n') }}
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/templates/vue/vite-ethers/src/main.ts:
--------------------------------------------------------------------------------
1 | import { createApp } from 'vue'
2 | import './style.css'
3 | import './ethers'
4 | import App from './App.vue'
5 |
6 | createApp(App).mount('#app')
7 |
--------------------------------------------------------------------------------
/templates/vue/vite-ethers/src/style.css:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matter-labs/zksync-frontend-templates/beab20f5f06cb302939701a1d6baa0df095fb692/templates/vue/vite-ethers/src/style.css
--------------------------------------------------------------------------------
/templates/vue/vite-ethers/src/utils/contracts.ts:
--------------------------------------------------------------------------------
1 | import IERC20 from "zksync-ethers/abi/IERC20.json";
2 |
3 | export const erc20ABI = IERC20;
4 |
5 | export const daiContractConfig = {
6 | address: "0x604F0416e788779edB06c1A74a75FAad38384C6E", // zkSync Era Sepolia Testnet DAI token address
7 | abi: erc20ABI,
8 | } as const;
9 |
--------------------------------------------------------------------------------
/templates/vue/vite-ethers/src/utils/formatters.ts:
--------------------------------------------------------------------------------
1 | export const stringify: typeof JSON.stringify = (value, replacer, space) =>
2 | JSON.stringify(
3 | value,
4 | (key, value_) => {
5 | return typeof replacer === 'function' ? replacer(key, value_) : value_
6 | },
7 | space,
8 | )
9 |
--------------------------------------------------------------------------------
/templates/vue/vite-ethers/src/vite-env.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 |
--------------------------------------------------------------------------------
/templates/vue/vite-ethers/tsconfig.node.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "composite": true,
4 | "skipLibCheck": true,
5 | "module": "ESNext",
6 | "moduleResolution": "bundler",
7 | "allowSyntheticDefaultImports": true
8 | },
9 | "include": ["vite.config.ts"]
10 | }
11 |
--------------------------------------------------------------------------------
/templates/vue/vite-ethers/vite.config.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite'
2 | import vue from '@vitejs/plugin-vue'
3 | import { fileURLToPath } from 'node:url'
4 |
5 | // https://vitejs.dev/config/
6 | export default defineConfig({
7 | plugins: [vue()],
8 | resolve: {
9 | alias: [
10 | {
11 | find: '@',
12 | replacement: fileURLToPath(new URL('./src', import.meta.url))
13 | },
14 | ]
15 | },
16 | })
17 |
--------------------------------------------------------------------------------
/templates/vue/vite-ethers5/.gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 | npm-debug.log*
5 | yarn-debug.log*
6 | yarn-error.log*
7 | pnpm-debug.log*
8 | lerna-debug.log*
9 |
10 | node_modules
11 | dist
12 | dist-ssr
13 | *.local
14 | .env
15 |
16 | # Editor directories and files
17 | .vscode/*
18 | !.vscode/extensions.json
19 | .idea
20 | .DS_Store
21 | *.suo
22 | *.ntvs*
23 | *.njsproj
24 | *.sln
25 | *.sw?
26 |
--------------------------------------------------------------------------------
/templates/vue/vite-ethers5/.vscode/extensions.json:
--------------------------------------------------------------------------------
1 | {
2 | "recommendations": ["Vue.volar", "Vue.vscode-typescript-vue-plugin"]
3 | }
4 |
--------------------------------------------------------------------------------
/templates/vue/vite-ethers5/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | zkSync + ethers v5 + Vite
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/templates/vue/vite-ethers5/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "vue-vite-wagmi-web3modal",
3 | "private": true,
4 | "version": "0.0.0",
5 | "type": "module",
6 | "scripts": {
7 | "dev": "vite",
8 | "build": "vue-tsc && vite build",
9 | "preview": "vite preview"
10 | },
11 | "dependencies": {
12 | "ethers": "^5.7.2",
13 | "vue": "^3.3.4",
14 | "zksync-ethers": "^5.0.0"
15 | },
16 | "devDependencies": {
17 | "@vitejs/plugin-vue": "^4.2.3",
18 | "typescript": "^5.0.2",
19 | "vite": "^4.4.5",
20 | "vue-tsc": "^1.8.5"
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/templates/vue/vite-ethers5/src/assets/vue.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/templates/vue/vite-ethers5/src/components/Account.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 | {{ account.address }}
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/templates/vue/vite-ethers5/src/components/BlockNumber.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 | {{ blockNumber?.toString() }}
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/templates/vue/vite-ethers5/src/components/Connect.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
7 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/templates/vue/vite-ethers5/src/components/Connected.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/templates/vue/vite-ethers5/src/components/WatchPendingTransactions.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | {{ transactionHashes.length }} transaction hashes
5 |
6 | {{ transactionHashes.reverse().join('\n') }}
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/templates/vue/vite-ethers5/src/main.ts:
--------------------------------------------------------------------------------
1 | import { createApp } from 'vue'
2 | import './style.css'
3 | import './ethers'
4 | import App from './App.vue'
5 |
6 | createApp(App).mount('#app')
7 |
--------------------------------------------------------------------------------
/templates/vue/vite-ethers5/src/style.css:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matter-labs/zksync-frontend-templates/beab20f5f06cb302939701a1d6baa0df095fb692/templates/vue/vite-ethers5/src/style.css
--------------------------------------------------------------------------------
/templates/vue/vite-ethers5/src/utils/contracts.ts:
--------------------------------------------------------------------------------
1 | import IERC20 from "zksync-ethers/abi/IERC20.json";
2 |
3 | export const erc20ABI = IERC20;
4 |
5 | export const daiContractConfig = {
6 | address: "0x604F0416e788779edB06c1A74a75FAad38384C6E", // zkSync Era Sepolia Testnet DAI token address
7 | abi: erc20ABI,
8 | } as const;
9 |
--------------------------------------------------------------------------------
/templates/vue/vite-ethers5/src/utils/formatters.ts:
--------------------------------------------------------------------------------
1 | export const stringify: typeof JSON.stringify = (value, replacer, space) =>
2 | JSON.stringify(
3 | value,
4 | (key, value_) => {
5 | return typeof replacer === 'function' ? replacer(key, value_) : value_
6 | },
7 | space,
8 | )
9 |
--------------------------------------------------------------------------------
/templates/vue/vite-ethers5/src/vite-env.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 |
--------------------------------------------------------------------------------
/templates/vue/vite-ethers5/tsconfig.node.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "composite": true,
4 | "skipLibCheck": true,
5 | "module": "ESNext",
6 | "moduleResolution": "bundler",
7 | "allowSyntheticDefaultImports": true
8 | },
9 | "include": ["vite.config.ts"]
10 | }
11 |
--------------------------------------------------------------------------------
/templates/vue/vite-ethers5/vite.config.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite'
2 | import vue from '@vitejs/plugin-vue'
3 | import { fileURLToPath } from 'node:url'
4 |
5 | // https://vitejs.dev/config/
6 | export default defineConfig({
7 | plugins: [vue()],
8 | resolve: {
9 | alias: [
10 | {
11 | find: '@',
12 | replacement: fileURLToPath(new URL('./src', import.meta.url))
13 | },
14 | ]
15 | },
16 | })
17 |
--------------------------------------------------------------------------------
/templates/vue/vite-wagmi-web3modal/.env.example:
--------------------------------------------------------------------------------
1 | VITE_WALLET_CONNECT_PROJECT_ID=
2 |
--------------------------------------------------------------------------------
/templates/vue/vite-wagmi-web3modal/.gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 | npm-debug.log*
5 | yarn-debug.log*
6 | yarn-error.log*
7 | pnpm-debug.log*
8 | lerna-debug.log*
9 |
10 | node_modules
11 | dist
12 | dist-ssr
13 | *.local
14 | .env
15 |
16 | # Editor directories and files
17 | .vscode/*
18 | !.vscode/extensions.json
19 | .idea
20 | .DS_Store
21 | *.suo
22 | *.ntvs*
23 | *.njsproj
24 | *.sln
25 | *.sw?
26 |
--------------------------------------------------------------------------------
/templates/vue/vite-wagmi-web3modal/.vscode/extensions.json:
--------------------------------------------------------------------------------
1 | {
2 | "recommendations": ["Vue.volar", "Vue.vscode-typescript-vue-plugin"]
3 | }
4 |
--------------------------------------------------------------------------------
/templates/vue/vite-wagmi-web3modal/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | zkSync + wagmi + Web3Modal + Vite
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/templates/vue/vite-wagmi-web3modal/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "vue-vite-wagmi-web3modal",
3 | "private": true,
4 | "version": "0.0.0",
5 | "type": "module",
6 | "scripts": {
7 | "dev": "vite",
8 | "build": "vue-tsc && vite build",
9 | "preview": "vite preview"
10 | },
11 | "dependencies": {
12 | "@wagmi/core": "^1.4.12",
13 | "@web3modal/wagmi": "^3.5.1",
14 | "viem": "^1.20.3",
15 | "vue": "^3.3.4"
16 | },
17 | "devDependencies": {
18 | "@vitejs/plugin-vue": "^4.2.3",
19 | "typescript": "^5.0.2",
20 | "vite": "^4.4.5",
21 | "vue-tsc": "^1.8.5"
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/templates/vue/vite-wagmi-web3modal/src/assets/vue.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/templates/vue/vite-wagmi-web3modal/src/components/Account.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 | {{ account.address }}
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/templates/vue/vite-wagmi-web3modal/src/components/BlockNumber.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 | {{ blockNumber?.toString() }}
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/templates/vue/vite-wagmi-web3modal/src/components/Connected.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/templates/vue/vite-wagmi-web3modal/src/components/WatchPendingTransactions.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | {{ transactionHashes.length }} transaction hashes
5 |
6 | {{ transactionHashes.reverse().join('\n') }}
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/templates/vue/vite-wagmi-web3modal/src/main.ts:
--------------------------------------------------------------------------------
1 | import { createApp } from 'vue'
2 | import './style.css'
3 | import './wagmi'
4 | import App from './App.vue'
5 |
6 | createApp(App).mount('#app')
7 |
--------------------------------------------------------------------------------
/templates/vue/vite-wagmi-web3modal/src/style.css:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matter-labs/zksync-frontend-templates/beab20f5f06cb302939701a1d6baa0df095fb692/templates/vue/vite-wagmi-web3modal/src/style.css
--------------------------------------------------------------------------------
/templates/vue/vite-wagmi-web3modal/src/utils/contracts.ts:
--------------------------------------------------------------------------------
1 | import { erc20ABI } from "@wagmi/core";
2 |
3 | export const daiContractConfig = {
4 | address: "0x604F0416e788779edB06c1A74a75FAad38384C6E", // zkSync Era Sepolia Testnet DAI token address
5 | abi: erc20ABI,
6 | } as const;
7 |
--------------------------------------------------------------------------------
/templates/vue/vite-wagmi-web3modal/src/utils/formatters.ts:
--------------------------------------------------------------------------------
1 | export const stringify: typeof JSON.stringify = (value, replacer, space) =>
2 | JSON.stringify(
3 | value,
4 | (key, value_) => {
5 | const value = typeof value_ === 'bigint' ? value_.toString() : value_
6 | return typeof replacer === 'function' ? replacer(key, value) : value
7 | },
8 | space,
9 | )
10 |
--------------------------------------------------------------------------------
/templates/vue/vite-wagmi-web3modal/src/vite-env.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 |
--------------------------------------------------------------------------------
/templates/vue/vite-wagmi-web3modal/tsconfig.node.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "composite": true,
4 | "skipLibCheck": true,
5 | "module": "ESNext",
6 | "moduleResolution": "bundler",
7 | "allowSyntheticDefaultImports": true
8 | },
9 | "include": ["vite.config.ts"]
10 | }
11 |
--------------------------------------------------------------------------------
/templates/vue/vite-wagmi-web3modal/vite.config.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite'
2 | import vue from '@vitejs/plugin-vue'
3 | import { fileURLToPath } from 'node:url'
4 |
5 | // https://vitejs.dev/config/
6 | export default defineConfig({
7 | plugins: [vue({
8 | template: {
9 | compilerOptions: {
10 | isCustomElement: (tag) => ['w3m-button'].includes(tag),
11 | },
12 | },
13 | })],
14 | resolve: {
15 | alias: [
16 | {
17 | find: '@',
18 | replacement: fileURLToPath(new URL('./src', import.meta.url))
19 | },
20 | ]
21 | },
22 | })
23 |
--------------------------------------------------------------------------------
/templates/vue/vite-wagmi/.gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 | npm-debug.log*
5 | yarn-debug.log*
6 | yarn-error.log*
7 | pnpm-debug.log*
8 | lerna-debug.log*
9 |
10 | node_modules
11 | dist
12 | dist-ssr
13 | *.local
14 | .env
15 |
16 | # Editor directories and files
17 | .vscode/*
18 | !.vscode/extensions.json
19 | .idea
20 | .DS_Store
21 | *.suo
22 | *.ntvs*
23 | *.njsproj
24 | *.sln
25 | *.sw?
26 |
--------------------------------------------------------------------------------
/templates/vue/vite-wagmi/.vscode/extensions.json:
--------------------------------------------------------------------------------
1 | {
2 | "recommendations": ["Vue.volar", "Vue.vscode-typescript-vue-plugin"]
3 | }
4 |
--------------------------------------------------------------------------------
/templates/vue/vite-wagmi/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | zkSync + wagmi + Vite
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/templates/vue/vite-wagmi/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "vue-vite-wagmi-web3modal",
3 | "private": true,
4 | "version": "0.0.0",
5 | "type": "module",
6 | "scripts": {
7 | "dev": "vite",
8 | "build": "vue-tsc && vite build",
9 | "preview": "vite preview"
10 | },
11 | "dependencies": {
12 | "@wagmi/core": "^1.4.12",
13 | "viem": "^1.20.3",
14 | "vue": "^3.3.4"
15 | },
16 | "devDependencies": {
17 | "@vitejs/plugin-vue": "^4.2.3",
18 | "typescript": "^5.0.2",
19 | "vite": "^4.4.5",
20 | "vue-tsc": "^1.8.5"
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/templates/vue/vite-wagmi/src/assets/vue.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/templates/vue/vite-wagmi/src/components/Account.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 | {{ account.address }}
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/templates/vue/vite-wagmi/src/components/BlockNumber.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 | {{ blockNumber?.toString() }}
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/templates/vue/vite-wagmi/src/components/Connect.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
7 |
8 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/templates/vue/vite-wagmi/src/components/Connected.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/templates/vue/vite-wagmi/src/components/WatchPendingTransactions.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | {{ transactionHashes.length }} transaction hashes
5 |
6 | {{ transactionHashes.reverse().join('\n') }}
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/templates/vue/vite-wagmi/src/main.ts:
--------------------------------------------------------------------------------
1 | import { createApp } from 'vue'
2 | import './style.css'
3 | import './wagmi'
4 | import App from './App.vue'
5 |
6 | createApp(App).mount('#app')
7 |
--------------------------------------------------------------------------------
/templates/vue/vite-wagmi/src/style.css:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matter-labs/zksync-frontend-templates/beab20f5f06cb302939701a1d6baa0df095fb692/templates/vue/vite-wagmi/src/style.css
--------------------------------------------------------------------------------
/templates/vue/vite-wagmi/src/utils/contracts.ts:
--------------------------------------------------------------------------------
1 | import { erc20ABI } from "@wagmi/core";
2 |
3 | export const daiContractConfig = {
4 | address: "0x604F0416e788779edB06c1A74a75FAad38384C6E", // zkSync Era Sepolia Testnet DAI token address
5 | abi: erc20ABI,
6 | } as const;
7 |
--------------------------------------------------------------------------------
/templates/vue/vite-wagmi/src/utils/formatters.ts:
--------------------------------------------------------------------------------
1 | export const stringify: typeof JSON.stringify = (value, replacer, space) =>
2 | JSON.stringify(
3 | value,
4 | (key, value_) => {
5 | const value = typeof value_ === 'bigint' ? value_.toString() : value_
6 | return typeof replacer === 'function' ? replacer(key, value) : value
7 | },
8 | space,
9 | )
10 |
--------------------------------------------------------------------------------
/templates/vue/vite-wagmi/src/vite-env.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 |
--------------------------------------------------------------------------------
/templates/vue/vite-wagmi/tsconfig.node.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "composite": true,
4 | "skipLibCheck": true,
5 | "module": "ESNext",
6 | "moduleResolution": "bundler",
7 | "allowSyntheticDefaultImports": true
8 | },
9 | "include": ["vite.config.ts"]
10 | }
11 |
--------------------------------------------------------------------------------
/templates/vue/vite-wagmi/vite.config.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite'
2 | import vue from '@vitejs/plugin-vue'
3 | import { fileURLToPath } from 'node:url'
4 |
5 | // https://vitejs.dev/config/
6 | export default defineConfig({
7 | plugins: [vue()],
8 | resolve: {
9 | alias: [
10 | {
11 | find: '@',
12 | replacement: fileURLToPath(new URL('./src', import.meta.url))
13 | },
14 | ]
15 | },
16 | })
17 |
--------------------------------------------------------------------------------