skills/near-cli-rs/SKILL.md
Generate 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
npx skillsauth add near/agent-skills near-cli-rsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Purpose: This file is for LLMs generating non-interactive near commands. When a user request maps to a CLI action, look up the correct syntax here, construct the complete one-liner, show it to the user for approval, then execute it.
Rule: Always produce complete commands from near through the final action token (send, display, now, create, etc.). Never omit network-config <NETWORK>.
Version: near-cli-rs v0.14+ (tested through v0.24)
near [GLOBAL_FLAGS] <COMMAND_GROUP> [ENTITY_ARGS] <SUBCOMMAND> [SUB_ARGS] network-config <NETWORK> [SIGNING_OPTION] [FINAL_ACTION]
now | at-block-height <N> | at-block-hash <HASH>send or displaycreatenetwork-config keyword is always required (even for view commands)| Flag | Effect |
| ------------ | ---------------------------------------------------- |
| --offline | Create/sign tx without network access |
| --quiet | Suppress progress output (recommended for scripting) |
| --teach-me | Print all RPC calls and their parameters |
| Item | Value |
| --------------------- | ----------------------------------------------------------- |
| Built-in networks | mainnet, testnet |
| Custom network | any <connection-name> from near config show-connections |
| View: latest block | now |
| View: specific height | at-block-height <BLOCK_HEIGHT> |
| View: specific hash | at-block-hash <BLOCK_HASH> |
| Asset | Format | Notes |
| --------- | --------------------------- | ---------------------------------------- |
| NEAR | '1 NEAR' or '0.5 NEAR' | Quoted, space before unit |
| yoctoNEAR | '1 yoctoNEAR' | Required deposit for many contract calls |
| Gas | '30 Tgas' to '300 Tgas' | Default '100 Tgas', max '300 Tgas' |
| FT amount | '10 usn' | Number + FT symbol, quoted |
| FT all | all | Transfer entire balance |
Replace <SIGNING_OPTION> in any transaction command with one of:
| Option | Full syntax |
| ---------------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
| OS keychain (recommended) | sign-with-keychain send |
| Legacy keychain (~/.near-credentials/) | sign-with-legacy-keychain send |
| Ledger hardware wallet | sign-with-ledger send |
| Plaintext private key | sign-with-plaintext-private-key --signer-public-key ed25519:<PUBKEY> --signer-private-key ed25519:<PRIVKEY> send |
| Access key file | sign-with-access-key-file /path/to/key.json send |
| Seed phrase | sign-with-seed-phrase 'word1 ... word12' --seed-phrase-hd-path 'm/44'"'"'/397'"'"'/0'"'"'' send |
| MPC | sign-with-mpc send |
| Produce unsigned tx (sign later) | sign-later |
Replace send with display to print the signed transaction in base64 without broadcasting.
account Commands# Current block
near account view-account-summary <ACCOUNT_ID> network-config <NETWORK> now
# Specific block height
near account view-account-summary <ACCOUNT_ID> network-config <NETWORK> at-block-height <BLOCK_HEIGHT>
# Specific block hash
near account view-account-summary <ACCOUNT_ID> network-config <NETWORK> at-block-hash <BLOCK_HASH>
# Using seed phrase (non-interactive)
near account import-account using-seed-phrase '<SEED_PHRASE>' --seed-phrase-hd-path 'm/44'"'"'/397'"'"'/0'"'"'' network-config <NETWORK>
# Using private key
near account import-account using-private-key ed25519:<PRIVATE_KEY> network-config <NETWORK>
# NOTE: using-web-wallet requires a browser redirect — not suitable for non-interactive use
# Export as seed phrase
near account export-account <ACCOUNT_ID> using-seed-phrase network-config <NETWORK>
# Export as private key
near account export-account <ACCOUNT_ID> using-private-key network-config <NETWORK>
# Testnet faucet (testnet only) — autogenerate keypair
near account create-account sponsor-by-faucet-service <NEW_ACCOUNT_ID> autogenerate-new-keypair save-to-keychain network-config testnet create
# Testnet faucet — use known seed phrase
near account create-account sponsor-by-faucet-service <NEW_ACCOUNT_ID> use-manually-provided-seed-phrase '<SEED_PHRASE>' network-config testnet create
# Testnet faucet — use known public key
near account create-account sponsor-by-faucet-service <NEW_ACCOUNT_ID> use-manually-provided-public-key ed25519:<PUBKEY> network-config testnet create
# Fund-myself: create sub-account (signer is implicit from keychain)
near account create-account fund-myself <NEW_ACCOUNT_ID> '<INITIAL_BALANCE>' autogenerate-new-keypair save-to-keychain sign-as network-config <NETWORK> sign-with-keychain send
# Fund-myself: create account specifying explicit signer
near account create-account fund-myself <NEW_ACCOUNT_ID> '<INITIAL_BALANCE>' autogenerate-new-keypair save-to-keychain sign-as <SIGNER_ACCOUNT_ID> network-config <NETWORK> sign-with-keychain send
# Fund-myself: use known seed phrase for new account
near account create-account fund-myself <NEW_ACCOUNT_ID> '<INITIAL_BALANCE>' use-manually-provided-seed-phrase '<SEED_PHRASE>' sign-as <SIGNER_ACCOUNT_ID> network-config <NETWORK> sign-with-keychain send
# Fund-myself: use known public key for new account
near account create-account fund-myself <NEW_ACCOUNT_ID> '<INITIAL_BALANCE>' use-manually-provided-public-key ed25519:<PUBKEY> sign-as <SIGNER_ACCOUNT_ID> network-config <NETWORK> sign-with-keychain send
near account delete-account <ACCOUNT_ID> beneficiary <BENEFICIARY_ACCOUNT_ID> network-config <NETWORK> sign-with-keychain send
near account list-keys <ACCOUNT_ID> network-config <NETWORK> now
# From seed phrase
near account get-public-key from-seed-phrase '<SEED_PHRASE>' --seed-phrase-hd-path "m/44'/397'/0'"
# From plaintext private key
near account get-public-key from-plaintext-private-key ed25519:<PRIVATE_KEY>
# From OS keychain
near account get-public-key from-keychain <ACCOUNT_ID> network-config <NETWORK>
# From legacy keychain
near account get-public-key from-legacy-keychain <ACCOUNT_ID> network-config <NETWORK>
# From Ledger (requires 5-component path)
near account get-public-key from-ledger --seed-phrase-hd-path "m/44'/397'/0'/0'/1'"
# Add full-access key (provide existing public key)
near account add-key <ACCOUNT_ID> grant-full-access use-manually-provided-public-key ed25519:<PUBKEY> network-config <NETWORK> sign-with-keychain send
# Add function-call-only key (autogenerate keypair)
near account add-key <ACCOUNT_ID> grant-function-call-access --allowance '<ALLOWANCE>' --contract-account-id <CONTRACT_ID> --function-names '<METHOD1>, <METHOD2>' autogenerate-new-keypair save-to-keychain network-config <NETWORK> sign-with-keychain send
# Add function-call-only key (allow all methods on contract)
near account add-key <ACCOUNT_ID> grant-function-call-access --allowance '<ALLOWANCE>' --contract-account-id <CONTRACT_ID> --function-names '' use-manually-provided-public-key ed25519:<PUBKEY> network-config <NETWORK> sign-with-keychain send
near account delete-keys <ACCOUNT_ID> public-keys ed25519:<PUBKEY> network-config <NETWORK> sign-with-keychain send
# View storage balance
near account manage-storage-deposit <CONTRACT_ID> view-balance <ACCOUNT_ID> network-config <NETWORK> now
# Deposit storage
near account manage-storage-deposit <CONTRACT_ID> deposit <ACCOUNT_ID> '<AMOUNT>' sign-as <SIGNER_ACCOUNT_ID> network-config <NETWORK> sign-with-keychain send
# Withdraw from storage
near account manage-storage-deposit <CONTRACT_ID> withdraw '<AMOUNT>' sign-as <ACCOUNT_ID> network-config <NETWORK> sign-with-keychain send
# Update profile with JSON args
near account update-social-profile <ACCOUNT_ID> json-args '{"name":"<NAME>","image":{"ipfs_cid":"<CID>"}}' sign-as <ACCOUNT_ID> network-config <NETWORK> sign-with-keychain send
# Update profile from file
near account update-social-profile <ACCOUNT_ID> file-args /path/to/profile.json sign-as <ACCOUNT_ID> network-config <NETWORK> sign-with-keychain send
tokens Commandsnear tokens <ACCOUNT_ID> view-near-balance network-config <NETWORK> now
near tokens <ACCOUNT_ID> view-ft-balance <FT_CONTRACT_ID> network-config <NETWORK> now
near tokens <ACCOUNT_ID> view-nft-assets <NFT_CONTRACT_ID> network-config <NETWORK> now
near tokens <SENDER_ACCOUNT_ID> send-near <RECEIVER_ACCOUNT_ID> '<AMOUNT>' network-config <NETWORK> sign-with-keychain send
# Send specific amount
near tokens <SENDER_ACCOUNT_ID> send-ft <FT_CONTRACT_ID> <RECEIVER_ACCOUNT_ID> '<AMOUNT>' memo '<MEMO>' network-config <NETWORK> sign-with-keychain send
# Send all tokens (with optional custom gas/deposit)
near tokens <SENDER_ACCOUNT_ID> send-ft <FT_CONTRACT_ID> <RECEIVER_ACCOUNT_ID> all memo '' --prepaid-gas '300.0 Tgas' --attached-deposit '1 yoctoNEAR' network-config <NETWORK> sign-with-keychain send
Note: Default prepaid-gas is '100.0 Tgas' and attached-deposit is '1 yoctoNEAR'.
near tokens <SENDER_ACCOUNT_ID> send-nft <NFT_CONTRACT_ID> <RECEIVER_ACCOUNT_ID> <TOKEN_ID> --prepaid-gas '300.0 Tgas' --attached-deposit '1 yoctoNEAR' network-config <NETWORK> sign-with-keychain send
staking Commandsnear staking validator-list network-config <NETWORK>
# View delegated stake balance
near staking delegation <ACCOUNT_ID> view-balance <POOL_ID> network-config <NETWORK> now
# Deposit and stake (send NEAR to pool and immediately stake)
near staking delegation <ACCOUNT_ID> deposit-and-stake '<AMOUNT>' <POOL_ID> network-config <NETWORK> sign-with-keychain send
# Stake previously deposited tokens
near staking delegation <ACCOUNT_ID> stake '<AMOUNT>' <POOL_ID> network-config <NETWORK> sign-with-keychain send
# Stake all previously deposited or unstaked tokens
near staking delegation <ACCOUNT_ID> stake-all <POOL_ID> network-config <NETWORK> sign-with-keychain send
# Unstake a specific amount
near staking delegation <ACCOUNT_ID> unstake '<AMOUNT>' <POOL_ID> network-config <NETWORK> sign-with-keychain send
# Unstake everything
near staking delegation <ACCOUNT_ID> unstake-all <POOL_ID> network-config <NETWORK> sign-with-keychain send
# Withdraw a specific amount (after unstaking + ~2 epoch wait)
near staking delegation <ACCOUNT_ID> withdraw '<AMOUNT>' <POOL_ID> network-config <NETWORK> sign-with-keychain send
# Withdraw all available unstaked tokens
near staking delegation <ACCOUNT_ID> withdraw-all <POOL_ID> network-config <NETWORK> sign-with-keychain send
Note: Unstaked funds require approximately 2 epochs (~48 hours) before they can be withdrawn.
contract Commands# With JSON args
near contract call-function as-read-only <CONTRACT_ID> <METHOD_NAME> json-args '{"key":"value"}' network-config <NETWORK> now
# With empty args
near contract call-function as-read-only <CONTRACT_ID> <METHOD_NAME> empty-args network-config <NETWORK> now
# With text args
near contract call-function as-read-only <CONTRACT_ID> <METHOD_NAME> text-args '<STRING>' network-config <NETWORK> now
# With base64 args
near contract call-function as-read-only <CONTRACT_ID> <METHOD_NAME> base64-args '<BASE64>' network-config <NETWORK> now
# With JSON args
near contract call-function as-transaction <CONTRACT_ID> <METHOD_NAME> json-args '{"key":"value"}' prepaid-gas '<GAS>' attached-deposit '<DEPOSIT>' sign-as <SIGNER_ACCOUNT_ID> network-config <NETWORK> sign-with-keychain send
# With empty args
near contract call-function as-transaction <CONTRACT_ID> <METHOD_NAME> empty-args prepaid-gas '<GAS>' attached-deposit '<DEPOSIT>' sign-as <SIGNER_ACCOUNT_ID> network-config <NETWORK> sign-with-keychain send
# Deploy without init call
near contract deploy <ACCOUNT_ID> use-file /path/to/contract.wasm without-init-call network-config <NETWORK> sign-with-keychain send
# Deploy with init call
near contract deploy <ACCOUNT_ID> use-file /path/to/contract.wasm with-init-call <INIT_METHOD> json-args '{}' prepaid-gas '100 Tgas' attached-deposit '0 NEAR' network-config <NETWORK> sign-with-keychain send
near contract inspect <CONTRACT_ID> network-config <NETWORK> now
near contract verify deployed-at <CONTRACT_ID> network-config <NETWORK> now
near contract download-abi <CONTRACT_ID> save-to-file <OUTPUT_FILE_PATH> network-config <NETWORK> now
near contract download-wasm <CONTRACT_ID> save-to-file <OUTPUT_FILE_PATH> network-config <NETWORK> now
# View all storage as JSON
near contract view-storage <CONTRACT_ID> all as-json network-config <NETWORK> now
# View storage filtered by key prefix (string)
near contract view-storage <CONTRACT_ID> keys-start-with-string '<PREFIX>' as-json network-config <NETWORK> now
# View storage filtered by key prefix (base64)
near contract view-storage <CONTRACT_ID> keys-start-with-bytes-as-base64 '<BASE64_PREFIX>' as-json network-config <NETWORK> now
transaction Commandsnear transaction view-status <TX_HASH> network-config <NETWORK>
near transaction reconstruct-transaction <TX_HASH> network-config <NETWORK>
near transaction sign-transaction '<UNSIGNED_TX_BASE64>' network-config <NETWORK> sign-with-keychain send
near transaction send-signed-transaction '<SIGNED_TX_BASE64>' network-config <NETWORK>
# Print signed transaction fields
near transaction print-transaction signed '<SIGNED_TX_BASE64>'
# Print unsigned transaction fields
near transaction print-transaction unsigned '<UNSIGNED_TX_BASE64>'
near transaction send-meta-transaction '<SIGNED_DELEGATE_BASE64>' network-config <NETWORK>
config Commandsnear config show-connections
near config add-connection --network-name <NETWORK_NAME> --connection-name <CONNECTION_NAME> --rpc-url <RPC_URL> --wallet-url <WALLET_URL> --explorer-transaction-url <EXPLORER_TX_URL> [--rpc-api-key '<API_KEY>'] [--linkdrop-account-id <LINKDROP_ID>] [--faucet-url <FAUCET_URL>] [--meta-transaction-relayer-url <RELAYER_URL>]
near config delete-connection <CONNECTION_NAME>
Quick-reference one-liners for the most frequent tasks. Substitute placeholders with real values.
near tokens alice.near view-near-balance network-config mainnet now
near tokens alice.near send-near bob.near '5 NEAR' network-config mainnet sign-with-keychain send
near account view-account-summary alice.near network-config mainnet now
near account list-keys alice.near network-config mainnet now
near tokens alice.near send-ft usdt.tether-token.near bob.near '10 USDT' memo '' network-config mainnet sign-with-keychain send
near tokens alice.near view-ft-balance usdt.tether-token.near network-config mainnet now
near contract call-function as-read-only wrap.near ft_balance_of json-args '{"account_id":"alice.near"}' network-config mainnet now
near contract call-function as-transaction wrap.near ft_transfer json-args '{"receiver_id":"bob.near","amount":"1000000000000000000000000"}' prepaid-gas '100 Tgas' attached-deposit '1 yoctoNEAR' sign-as alice.near network-config mainnet sign-with-keychain send
near staking delegation alice.near deposit-and-stake '10 NEAR' aurora.pool.near network-config mainnet sign-with-keychain send
near staking delegation alice.near unstake-all aurora.pool.near network-config mainnet sign-with-keychain send
near staking delegation alice.near withdraw-all aurora.pool.near network-config mainnet sign-with-keychain send
near account create-account sponsor-by-faucet-service myaccount.testnet autogenerate-new-keypair save-to-keychain network-config testnet create
near account create-account fund-myself sub.alice.testnet '1 NEAR' autogenerate-new-keypair save-to-keychain sign-as alice.testnet network-config testnet sign-with-keychain send
near contract deploy mycontract.testnet use-file ./contract.wasm without-init-call network-config testnet sign-with-keychain send
near account delete-keys alice.testnet public-keys ed25519:<PUBKEY_TO_REMOVE> network-config testnet sign-with-keychain send
near account add-key alice.testnet grant-full-access use-manually-provided-public-key ed25519:<NEW_PUBKEY> network-config testnet sign-with-keychain send
# Machine A (offline): produce signed tx in base64 without broadcasting
near --offline tokens alice.near send-near bob.near '1 NEAR' network-config mainnet sign-with-seed-phrase '<SEED_PHRASE>' --seed-phrase-hd-path 'm/44'"'"'/397'"'"'/0'"'"'' display
# Machine B (online): broadcast the base64 tx
near transaction send-signed-transaction '<SIGNED_TX_BASE64>' network-config mainnet
# Step 1: produce unsigned base64 tx
near tokens alice.near send-near bob.near '1 NEAR' network-config mainnet sign-later
# Step 2: sign it (outputs signed base64)
near transaction sign-transaction '<UNSIGNED_TX_BASE64>' network-config mainnet sign-with-keychain display
# Step 3: broadcast
near transaction send-signed-transaction '<SIGNED_TX_BASE64>' network-config mainnet
--quiet to suppress progress output in scripts'1 NEAR', '0.5 NEAR', '1 yoctoNEAR''m/44'"'"'/397'"'"'/0'"'"''display instead of send to inspect signed tx before broadcasting| Item | Format | Example |
| ---------------- | ---------------------------- | ------------------------------- |
| Public key | ed25519:<BASE58> | ed25519:8h7kFK4... |
| Private key | ed25519:<BASE58> | ed25519:2qM8v3N... |
| Transaction hash | 44-char base58 | F3eZmht... |
| Named account | name.near / name.testnet | alice.near |
| Implicit account | 64-char lowercase hex | a4b05ef3... |
| Standard HD path | m/44'/397'/0' | NEAR BIP44 |
| Ledger HD path | m/44'/397'/0'/0'/N' | 5-component required for Ledger |
| Error | Likely cause / fix |
| -------------------------- | ---------------------------------------------------------- |
| "Account does not exist" | Wrong network, or account not yet funded |
| "Access key not found" | Use sign-with-legacy-keychain or sign-with-seed-phrase |
| "Exceeded prepaid gas" | Increase gas: '300 Tgas' |
| FT transfer fails silently | FT ft_transfer requires attached-deposit '1 yoctoNEAR' |
| "Method not found" | Check method name with near contract inspect |
| Seed phrase HD path error | Escape single quotes: 'm/44'"'"'/397'"'"'/0'"'"'' |
development
NEAR Protocol smart contract development in Rust. Use when writing, reviewing, or deploying NEAR smart contracts. Covers contract structure, state management, cross-contract calls, testing, security, and optimization patterns. Based on near-sdk v5.x with modern macro syntax.
development
TypeScript library for NEAR Protocol blockchain interaction. Use this skill when writing code that interacts with NEAR Protocol, including viewing contract data, calling contract methods, sending NEAR tokens, building transactions, creating type-safe contract wrappers, integrating wallets (Wallet Selector, HOT Connect), React hooks and providers (@near-kit/react), managing keys, testing with sandbox, meta-transactions (NEP-366), and message signing (NEP-413).
tools
Cross-chain token swap integration using NEAR Intents 1Click API. Use when building swap widgets, bridge interfaces, or multi-chain transfers across EVM, Solana, NEAR, TON, Stellar, and Tron.
development
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.