| name | near-cli-rs |
| description | 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 |
SKILL: near-cli-rs — NEAR Protocol CLI Reference for AI Agents
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)
Command Grammar
near [GLOBAL_FLAGS] <COMMAND_GROUP> [ENTITY_ARGS] <SUBCOMMAND> [SUB_ARGS] network-config <NETWORK> [SIGNING_OPTION] [FINAL_ACTION]
- View commands end with:
now | at-block-height <N> | at-block-hash <HASH>
- Transaction commands end with a signing option followed by
send or display
- Account creation via faucet ends with
create
network-config keyword is always required (even for view commands)
Global Flags
| 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 |
Networks and View Qualifiers
| 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> |
Amount and Gas Formats
| 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 |
Signing Options Reference
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
view-account-summary
near account view-account-summary <ACCOUNT_ID> network-config <NETWORK> now
near account view-account-summary <ACCOUNT_ID> network-config <NETWORK> at-block-height <BLOCK_HEIGHT>
near account view-account-summary <ACCOUNT_ID> network-config <NETWORK> at-block-hash <BLOCK_HASH>
import-account
near account import-account using-seed-phrase '<SEED_PHRASE>' --seed-phrase-hd-path 'm/44'"'"'/397'"'"'/0'"'"'' network-config <NETWORK>
near account import-account using-private-key ed25519:<PRIVATE_KEY> network-config <NETWORK>
export-account
near account export-account <ACCOUNT_ID> using-seed-phrase network-config <NETWORK>
near account export-account <ACCOUNT_ID> using-private-key network-config <NETWORK>
create-account
near account create-account sponsor-by-faucet-service <NEW_ACCOUNT_ID> autogenerate-new-keypair save-to-keychain network-config testnet create
near account create-account sponsor-by-faucet-service <NEW_ACCOUNT_ID> use-manually-provided-seed-phrase '<SEED_PHRASE>' network-config testnet create
near account create-account sponsor-by-faucet-service <NEW_ACCOUNT_ID> use-manually-provided-public-key ed25519:<PUBKEY> network-config testnet create
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
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
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
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
delete-account
near account delete-account <ACCOUNT_ID> beneficiary <BENEFICIARY_ACCOUNT_ID> network-config <NETWORK> sign-with-keychain send
list-keys
near account list-keys <ACCOUNT_ID> network-config <NETWORK> now
get-public-key
near account get-public-key from-seed-phrase '<SEED_PHRASE>' --seed-phrase-hd-path "m/44'/397'/0'"
near account get-public-key from-plaintext-private-key ed25519:<PRIVATE_KEY>
near account get-public-key from-keychain <ACCOUNT_ID> network-config <NETWORK>
near account get-public-key from-legacy-keychain <ACCOUNT_ID> network-config <NETWORK>
near account get-public-key from-ledger --seed-phrase-hd-path "m/44'/397'/0'/0'/1'"
add-key
near account add-key <ACCOUNT_ID> grant-full-access use-manually-provided-public-key ed25519:<PUBKEY> network-config <NETWORK> sign-with-keychain send
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
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
delete-keys
near account delete-keys <ACCOUNT_ID> public-keys ed25519:<PUBKEY> network-config <NETWORK> sign-with-keychain send
manage-storage-deposit
near account manage-storage-deposit <CONTRACT_ID> view-balance <ACCOUNT_ID> network-config <NETWORK> now
near account manage-storage-deposit <CONTRACT_ID> deposit <ACCOUNT_ID> '<AMOUNT>' sign-as <SIGNER_ACCOUNT_ID> network-config <NETWORK> sign-with-keychain send
near account manage-storage-deposit <CONTRACT_ID> withdraw '<AMOUNT>' sign-as <ACCOUNT_ID> network-config <NETWORK> sign-with-keychain send
update-social-profile
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
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 Commands
view-near-balance
near tokens <ACCOUNT_ID> view-near-balance network-config <NETWORK> now
view-ft-balance
near tokens <ACCOUNT_ID> view-ft-balance <FT_CONTRACT_ID> network-config <NETWORK> now
view-nft-assets
near tokens <ACCOUNT_ID> view-nft-assets <NFT_CONTRACT_ID> network-config <NETWORK> now
send-near
near tokens <SENDER_ACCOUNT_ID> send-near <RECEIVER_ACCOUNT_ID> '<AMOUNT>' network-config <NETWORK> sign-with-keychain send
send-ft
near tokens <SENDER_ACCOUNT_ID> send-ft <FT_CONTRACT_ID> <RECEIVER_ACCOUNT_ID> '<AMOUNT>' memo '<MEMO>' network-config <NETWORK> sign-with-keychain send
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