本文へスキップ
Skillpedia
WebサイトとUI(フロントエンド)7.0k · #13653

near-dapp

できること

このスキルは、テンプレートから新しいNEARのウェブアプリを作ったり、既に持っているアプリにウォレットのサインインを加えたりする手助けをします。Reactのフックのアプローチと、プレーンJavaScriptの選択肢を扱い、NEARの上にウェブを構築する開発者向けです。

使う場面

  • ✓テンプレートから新しいNEARのウェブアプリを始めたいとき。
  • ✓既存のReactアプリにNEARのウォレットのサインインとコントラクトの呼び出しを加えたいとき。
  • ✓プレーンJavaScriptからNEARのウォレットに接続する必要があるとき。

スキルのリンク

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

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/internet-court/internet-court-skill/blob/main/vendored/near/near-dapp/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“既存のReactアプリにNEARのウォレットのサインインを加えたいです。”

毎週5つの新しいスキル。1分で読めます。

仕組み

新しいプロジェクトの場合、エージェントは選んだフレームワークとコントラクトの言語で、create-near-appツールを実行します。既存のアプリの場合、接続のパッケージをインストールし、アプリをプロバイダーで包み、フックを使ってサインインやコントラクトの呼び出しを行います。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)をGitHubからそのまま表示しています。

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)
よくある質問

スターターはどのフレームワークを使えますか?

Viteを使うReact、App Routerを使うNext.js、またはPagesを使うNext.jsです。

どのコントラクトの言語に対応していますか?

RustとTypeScriptです。

Reactなしでも使えますか?

はい。このスキルには、より低レベルのウォレットのライブラリを使う、プレーンJavaScriptのための別の道筋があります。

詳細

作者による元の説明

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

人気

GitHubのスター
7.0k
ランキング
#13653
ライセンス
—
更新日
2026/10/26

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル