internet-court/internet-court-skill / vendored/near/near-dapp
near-dapp
VerifiedBuild NEAR Protocol dApps. Use for: (1) creating new NEAR dApps with `create-near-app` (Vite+React, Next.js), (2) adding NEAR wallet connection to existing apps with `@hot-labs/near-connect` and `near-connect-hooks`, (3) building frontend UI for NEAR smart contracts, (4) integrating wallet sign-in/sign-out, contract calls, and transaction signing into web applications.
| File | Kind | Size |
|---|---|---|
| LICENSE | other | 329 B |
| SKILL.md | skill md | 2.7 KB |
| references/create-near-app.md | markdown | 1.7 KB |
| references/near-connect-hooks.md | markdown | 5.6 KB |
| references/near-connect.md | markdown | 5.3 KB |
SKILL.md
View on GitHub---
name: near-dapp
description: >
Build NEAR Protocol dApps. Use for: (1) creating new NEAR dApps with
`create-near-app` (Vite+React, Next.js), (2) adding NEAR wallet connection
to existing apps with `@hot-labs/near-connect` and `near-connect-hooks`,
(3) building frontend UI for NEAR smart contracts, (4) integrating wallet
sign-in/sign-out, contract calls, and transaction signing into web
applications.
---
# NEAR dApp
## Decision Router
Determine which path to follow:
### Path A: New Project
User wants to create a new NEAR dApp from scratch.
1. Read [references/create-near-app.md](references/create-near-app.md)
2. Run scaffolding:
```bash
npx create-near-app@latest
```
Or with arguments:
```bash
npx create-near-app my-app --frontend vite-react --contract rs --install
```
**Framework options:** `vite-react` | `next-app` | `next-page`
**Contract options:** `rs` (Rust) | `ts` (TypeScript)
3. If user needs wallet connection in the scaffolded app, also follow Path B.
### Path B: Existing Project
User wants to add NEAR wallet connection to an existing React app.
1. Read [references/near-connect-hooks.md](references/near-connect-hooks.md) — React hooks API and patterns
2. If user needs low-level wallet API or non-React integration, also read [references/near-connect.md](references/near-connect.md)
**Quick setup:**
```bash
npm install near-connect-hooks @hot-labs/near-connect near-api-js
```
```tsx
// 1. Wrap app root with NearProvider
import { NearProvider } from 'near-connect-hooks';
<NearProvider config={{ network: 'mainnet' }}>
<App />
</NearProvider>
// 2. Use hook in components
import { useNearWallet } from 'near-connect-hooks';
const { signedAccountId, signIn, signOut, viewFunction, callFunction } = useNearWallet();
```
### Path C: Non-React or Vanilla JS
Use `@hot-labs/near-connect` directly without React hooks.
1. Read [references/near-connect.md](references/near-connect.md)
```bash
npm install @hot-labs/near-connect
```
```typescript
import { NearConnector } from "@hot-labs/near-connect";
const connector = new NearConnector({ network: "mainnet" });
connector.on("wallet:signIn", async (t) => {
const wallet = await connector.wallet();
const address = t.accounts[0].accountId;
});
await connector.connect();
```
## Key Patterns
- **Read contract state** (no wallet): `viewFunction({ contractId, method, args })`
- **Write to contract** (wallet required): `callFunction({ contractId, method, args, deposit })`
- **Transfer NEAR**: `transfer({ receiverId, amount })`
- **NEAR ↔ yoctoNEAR**: Use `nearToYocto()` / `yoctoToNear()` from `near-api-js`
- **1 NEAR** = `"1000000000000000000000000"` yoctoNEAR
- **Default gas**: `"30000000000000"` (30 TGas)
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation). | Stars: 323k | Updated | Claude CodeCodex | Verified | Install |
| brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK). | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |