# PolyNote · Polygon message pusher Send hex-encoded messages on Polygon mainnet using the Trust Wallet browser extension or in-app browser. The app builds a zero-value transaction with your message in the data field, so only gas is spent. ## What it does - Connects to an injected EIP-1193 provider (Trust Wallet) and targets Polygon mainnet. - Hex-encodes up to 280 characters and sends a 0 MATIC transaction carrying the payload. - Internationalization (English, Spanish, French, German, Italian, Swedish) with a locale picker and auto language detection. - Live feedback, copy-to-clipboard for the tx hash, Polygonscan deep links, and a session “recent messages” view. - Light/Dark theme toggle. ## Stack - Next.js 15 (App Router), React 18, TypeScript - Ethers v6 - Styling via a single CSS file (`app/globals.css`) - Path alias: `@/` → `app/` - Lint: ESLint 9 (flat config), Prettier ## Getting started 1. Install pnpm and Node 18+ (Node 24 recommended). 2. Install deps: ```bash pnpm install ``` 3. Run dev: ```bash pnpm dev -- --hostname 127.0.0.1 --port 3120 ``` The dev script guards against a missing `.next/server/middleware-manifest.json`. 4. Open the URL, pick a language, connect Trust Wallet, type a message, and send. Only gas is charged. ## Scripts - `pnpm dev` – start dev server (with manifest guard) - `pnpm build` – production build (skips lint, run lint separately) - `pnpm start` – run the production server - `pnpm lint` – ESLint flat config - `pnpm format` – Prettier check ## Project layout - `app/page.tsx` – main UI/logic - `app/components/LocaleSelector.tsx` – locale dropdown - `app/hooks/useI18n.ts`, `app/hooks/useTheme.ts` – i18n + theme toggles - `app/locales/*.json` – translations - `app/globals.css` – styles - `scripts/ensure-middleware-manifest.cjs` – guards against missing Next middleware manifest on fresh starts ## Configuration No env vars required. Wallet connectivity is via the injected Trust Wallet provider; WalletConnect is not used. ## Docker The Dockerfile is multi-stage and uses pnpm: ```bash docker build -t polynote . # run docker run -p 3000:3000 polynote ``` BuildKit with cache mounts is supported in the Dockerfile, but if buildx isn’t available locally, use the plain `docker build` command above. ## CI (Gitea actions) `.gitea/workflows/build.yml` runs lint on Node 22, then builds and uploads `.next/standalone` + `.next/static` + `public` as artifacts for `main` and tags. ## Security notes - Only injected providers are used; no secrets leave the browser. - Recipient addresses validated with `ethers.isAddress`. - Zero-value tx; user pays gas. The app requests a switch to Polygon (chainId 137). - Copy-to-clipboard is wrapped in error handling. - Serve over HTTPS in production so wallet and clipboard APIs work reliably. - Sending data to an EOA can be blocked by some wallets/RPCs; a warning is shown when you target your own address. ## Path aliases Imports under `app/` can use `@/` (configured in `tsconfig.json`): ```ts import en from "@/locales/en.json"; import { LocaleSelector } from "@/components/LocaleSelector"; ``` ## Contributing PRs welcome. Run `pnpm format` and `pnpm lint` before submitting. If you add locales, extend the JSON files under `app/locales/`. ## License GPL-3.0 (see `LICENSE`). Core dependencies are permissive (MIT): Next.js, React, React DOM, ethers, Prettier, TypeScript, @types/*.