Chuyển đến nội dung
Skillpedia
Website và giao diện (frontend)7.0k · #13653

near-dapp

Skill này làm gì

Skill này giúp bạn tạo ứng dụng web NEAR mới từ một mẫu khởi đầu, hoặc thêm đăng nhập ví vào ứng dụng bạn đã có. Skill bao quát cách dùng React hooks và một lựa chọn JavaScript thuần, dành cho lập trình viên web xây trên NEAR.

Khi nào nên dùng

  • ✓Khi bạn muốn khởi tạo một ứng dụng web NEAR mới từ mẫu.
  • ✓Khi bạn muốn thêm đăng nhập ví NEAR và gọi hợp đồng vào một ứng dụng React có sẵn.
  • ✓Khi bạn cần kết nối ví NEAR từ JavaScript thuần.

Liên kết skill

https://github.com/internet-court/internet-court-skill/blob/main/vendored/near/near-dapp/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/internet-court/internet-court-skill/blob/main/vendored/near/near-dapp/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Tôi muốn thêm đăng nhập ví NEAR vào ứng dụng React hiện có của mình.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Với dự án mới, agent chạy công cụ create-near-app với framework và ngôn ngữ hợp đồng bạn chọn. Với ứng dụng có sẵn, agent cài các gói kết nối, bọc ứng dụng trong một provider, và dùng hooks để đăng nhập và gọi hợp đồng.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

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
  2. 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)

  1. 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 — React hooks API and patterns
  2. 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.

  1. Read references/near-connect.md
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() from near-api-js
  • 1 NEAR = "1000000000000000000000000" yoctoNEAR
  • Default gas: "30000000000000" (30 TGas)
Câu hỏi thường gặp

Mẫu khởi đầu hỗ trợ những framework nào?

Vite với React, Next.js với app router, hoặc Next.js với pages.

Hỗ trợ những ngôn ngữ hợp đồng nào?

Rust và TypeScript.

Tôi có thể dùng mà không cần React không?

Có. Skill có một đường dẫn riêng cho JavaScript thuần, dùng thư viện ví cấp thấp hơn.

Chi tiết

Mô tả gốc của tác giả

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.

repo: internet-court/internet-court-skill

Độ phổ biến

Sao GitHub
7.0k
Vị trí xếp hạng
#13653
Giấy phép
—
Cập nhật
26/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự