/near:near-kitfrom near
TypeScript library for NEAR Protocol blockchain interaction. Provides view/call methods, token transfers, type-safe contracts, wallet integration (Wallet Selector, HOT Connect), key management, and NEP-366/413 support.
Ships in near. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
A TypeScript library for NEAR Protocol with an intuitive, fetch-like API.
import { Near } from "near-kit";
// Read-only (no key needed)
const near = new Near({ network: "testnet" });
const data = await near.view("contract.near", "get_data", { key: "value" });
// With signing capability
const near = new Near({
network: "testnet",
privateKey: "ed25519:...",
defaultSignerId: "alice.testnet",
});
await near.call("contract.near", "method", { arg: "value" });
await near.send("bob.testnet", "1 NEAR");
// Core
import { Near } from "near-kit";
// Keys
import { generateKey, parseSeedPhrase, generateSeedPhrase } from "near-kit";
import { RotatingKeyStore, InMemoryKeyStore } from "near-kit";
import { FileKeyStore } from "near-kit/keys/file";
import { NativeKeyStore } from "near-kit/keys/native";
// Wallet adapters
import { fromHotConnect, fromWalletSelector } from "near-kit";
// NEP-413 verification
import { verifyNep413Signature } from "near-kit";
// Utilities
import { Amount, Gas, isValidAccountId } from "near-kit";
const result = await near.view("contract.near", "get_data", { key: "value" });
const balance = await near.getBalance("alice.near");
const exists = await near.accountExists("alice.near");
await near.call(
"contract.near",
"method",
{ arg: "value" },
{ gas: "30 Tgas", attachedDeposit: "1 NEAR" },
);
await near.send("bob.near", "5 NEAR");
import type { Contract } from "near-kit";
type MyContract = Contract<{
view: {
get_balance: (args: { account_id: string }) => Promise<string>;
};
call: {
transfer: (args: { to: string; amount: string }) => Promise<void>;
};
}>;
const contract = near.contract<MyContract>("token.near");
// View (no options needed)
await contract.view.get_balance({ account_id: "alice.near" });
// Call (options as second arg)
await contract.call.transfer(
{ to: "bob.near", amount: "10" },
{ attachedDeposit: "1 yocto" },
);
Untyped contract proxy:
const guestbook = near.contract("guestbook.near-examples.testnet");
const total = await guestbook.view.total_messages();
const result = await guestbook.call.add_message(
{ text: "Hello!" },
{ gas: "30 Tgas" },
);
Chain multiple actions in a single atomic transaction:
const result = await near
.transaction("alice.near")
.functionCall("counter.near", "increment", {}, { gas: "30 Tgas" })
.transfer("counter.near", "0.001 NEAR")
.send();
For all transaction actions and meta-transactions, see references/transactions.md
// Direct private key
const near = new Near({
network: "testnet",
privateKey: "ed25519:...",
defaultSignerId: "alice.testnet",
});
// File-based keystore
import { FileKeyStore } from "near-kit/keys/file";
const near = new Near({
network: "testnet",
keyStore: new FileKeyStore("~/.near-credentials", "testnet"),
});
// High-throughput with rotating keys
import { RotatingKeyStore } from "near-kit";
const near = new Near({
network: "mainnet",
keyStore: new RotatingKeyStore({
"bot.near": ["ed25519:key1...", "ed25519:key2...", "ed25519:key3..."],
}),
});
For all key stores and utilities, see references/keys-and-testing.md
import { NearConnector } from "@hot-labs/near-connect";
import { Near, fromHotConnect } from "near-kit";
const connector = new NearConnector({ network: "mainnet" });
connector.on("wallet:signIn", async (event) => {
const near = new Near({
network: "mainnet",
wallet: fromHotConnect(connector),
});
await near.call("contract.near", "method", { arg: "value" });
});
connector.connect();
For HOT Connect and Wallet Selector integration, see references/wallets.md
import { NearProvider, useNear, useView, useCall } from "@near-kit/react";
function App() {
return (
<NearProvider config={{ network: "testnet" }}>
<Counter />
</NearProvider>
);
}
function Counter() {
const { data: count, isLoading } = useView<{}, number>({
contractId: "counter.testnet",
method: "get_count",
});
const { mutate: increment, isPending } = useCall({
contractId: "counter.testnet",
method: "increment",
});
if (isLoading) return <div>Loading...</div>;
return (
<button onClick={() => increment({})} disabled={isPending}>
Count: {count}
</button>
);
}
For all React hooks, React Query/SWR integration, and SSR patterns, see references/react.md
import { Near } from "near-kit";
import { Sandbox } from "near-kit/sandbox";
const sandbox = await Sandbox.start();
const near = new Near({ network: sandbox });
const testAccount = `test-${Date.now()}.${sandbox.rootAccount.id}`;
await near
.transaction(sandbox.rootAccount.id)
.createAccount(testAccount)
.transfer(testAccount, "10 NEAR")
.send();
await sandbox.stop();
For sandbox patterns and Vitest integration, see references/keys-and-testing.md
import {
InsufficientBalanceError,
FunctionCallError,
NetworkError,
TimeoutError,
} from "near-kit";
try {
await near.call("contract.near", "method", {});
} catch (error) {
if (error instanceof InsufficientBalanceError) {
console.log(`Need ${error.required}, have ${error.available}`);
} else if (error instanceof FunctionCallError) {
console.log(`Panic: ${error.panic}`, `Logs: ${error.logs}`);
}
}
All amounts accept human-readable formats:
"10 NEAR"; // 10 NEAR
"10"; // 10 NEAR
10; // 10 NEAR
("30 Tgas"); // 30 trillion gas units
Programmatic formatting:
import { Amount, Gas } from "near-kit";
Amount.NEAR(0.1);
Amount.yocto(1000n);
Amount.parse("5 NEAR");
Gas.parse("30 Tgas");
import {
generateKey,
generateSeedPhrase,
parseSeedPhrase,
isValidAccountId,
} from "near-kit";
// Generate new keypair
const key = generateKey();
// key.publicKey, key.secretKey
// generateSeedPhrase() returns a string (just the phrase)
const seedPhrase = generateSeedPhrase();
// "word1 word2 word3 ... word12"
// parseSeedPhrase() returns a KeyPair-like object
const keyPair = parseSeedPhrase("word1 word2 ... word12");
// keyPair.publicKey, keyPair.secretKey
// Validation
isValidAccountId("alice.near"); // true
import { Near, verifyNep413Signature } from "near-kit";
const near = new Near({ network: "testnet" });
const isValid = await verifyNep413Signature(
signedMessage,
{ message: "log me in", recipient: "myapp.com", nonce: challengeBuffer },
{ near, maxAge: Infinity },
);
For detailed documentation on specific topics:
near-kit, @near-kit/react; current ^0.20.x)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub near/agent-skills --plugin near8 skills in this plugin
/near-ai-cloudNEAR AI Cloud private inference and verification. Run LLM inference on private or sensitive data so that neither the host nor the model provider can read it, using the private (Confidential TEE) models on NEAR AI Cloud's OpenAI-compatible API, which run inside trusted execution environments (Intel TDX, NVIDIA confidential GPUs), with hardware attestation and response signatures you can verify. Use when integrating NEAR AI Cloud API for verifiable private AI inference, verifying model or gateway TEE attestation (NVIDIA NRAS, Intel TDX), verifying chat message signatures, implementing end-to-end encrypted chat, using specialized TEE endpoints (embeddings, reranking, images, audio, PII redaction), or using the OpenAI-compatible API with NEAR AI Cloud. Also use when someone needs confidential or private AI inference, wants an AI to analyze private business data safely, needs verifiable or attested inference with a receipt, or wants an OpenAI-compatible endpoint that keeps prompts private./near-api-jsGuide for developing with near-api-js v7 - the JavaScript/TypeScript library for NEAR blockchain interaction. Use when: (1) building apps that interact with NEAR blockchain, (2) creating/signing transactions, (3) calling smart contracts, (4) managing accounts and keys, (5) working with NEAR RPC API, (6) handling FT/NFT tokens on NEAR, (7) using NEAR cryptographic operations (KeyPair, signing), (8) converting between NEAR units (yocto, gas), (9) gasless/meta transactions with relayers, (10) NEP-413 message signing for authentication, (11) storage deposit management for FT contracts. Triggers on any NEAR blockchain development tasks. Also use to give an app's users on-chain accounts and let the app act for them: users who never pay gas or hold a gas token, an app or game that can act for a user only within limits (function-call access keys restricted to one contract and chosen methods), accounts or per-player sub-accounts created by the app, or sign-in that proves which account a user controls./near-cli-rsGenerate near-cli-rs v0.14+ commands for NEAR Protocol — account management, NEAR/FT/NFT token transfers, staking delegation, contract deployment and calls, transaction signing (keychain, Ledger, seed phrase, MPC, offline), and network config/near-contract-auditComprehensive security audit skill for NEAR Protocol smart contracts written in Rust. Use when auditing NEAR contracts, reviewing security vulnerabilities, or analyzing contract code for issues like reentrancy, unhandled promises, unsafe math, access control flaws, and callback security./near-dappBuild 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-intentsCross-chain token swap integration using NEAR Intents 1Click API, for moving tokens between blockchains and taking crypto payments across chains. Use when building swap widgets, bridge interfaces, or multi-chain transfers across EVM, Solana, NEAR, TON, Stellar, and Tron. Also use when someone wants to send USDC or another token from one chain to another (for example Ethereum to Solana) without handling a bridge, swap tokens across chains from one interface, pull funds from several chains into one account, accept a crypto payment in a token and on a chain the payer picks from the supported list, create a payment request or invoice for an exact amount, or pay a supplier on the chain the supplier chooses. No API key is needed to start; unauthenticated quotes carry an extra 0.25% fee.Other plugins' skills for the same job