About near-dapp
A skill for creating NEAR dApps and adding wallet connectivity to existing React or non-React apps. It routes development tasks to scaffolding, React hooks, or the lower-level connector setup.
Key features
- 01Create apps with create-near-app
- 02React wallet connection with hooks
- 03Non-React wallet connector setup
- 04Read and write contract state
Use cases
- 01Start a NEAR dApp from scratch
- 02Add wallet login to a React app
- 03Connect a wallet in vanilla JavaScript
- 04Read or call NEAR contract methods
Install
Copy the command and run it in a terminal.
$
npx skills add https:/ / github.com/ near/ agent-skills --skill near-dappAfter installing, type/near-dappin Claude Code to confirm it loaded.
Bundled files
References and scripts installed along with SKILL.md.
references/create-near-app.mdnear-connect-hooks.mdnear-connect.mdDetails
From the project READMENEAR dApp
Upstream Documentation
- Web3 App Quickstart — official first-dApp guide
- Wallet Connector — official docs for the
@hot-labs/near-connectconnector used here - Wallet Login tutorial
- create-near-app repo — scaffolding tool source (templates verified:
auction,auction-adv;--helpis authoritative)
Decision Router
Determine which path to follow:
Path A: New Project
User wants to create a new NEAR dApp from scratch.
- Read references/create-near-app.md
- Run scaffolding:
npx create-near-app@latest
Or with arguments:
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)
- 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.
- Read references/near-connect-hooks.md — React hooks API and patterns
- If user needs low-level wallet API or non-React integration, also read references/near-connect.md
Quick setup:
npm install near-connect-hooks @hot-labs/near-connect near-api-js
// 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.
npm install @hot-labs/near-connect
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()fromnear-api-js - 1 NEAR =
"1000000000000000000000000"yoctoNEAR - Default gas:
"30000000000000"(30 TGas)
Comments
Markdown supported