Skip to main content

near-cli-rs

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

跳到安装

来源信息

仓库
near/agent-skills
最近来源活动
2026年4月9日 13:47
检测到的 SKILL.md 语言
英语
星标
14
分支
3

安装方式

默认使用会先检查来源的 Prompt;你也可以切换为直接命令,或下载本地副本。

检查来源文件

决定是否安装前,请先阅读 SKILL.md,以及 SkillsMP 当前展示的配套文件。

正在显示 SKILL.md

SKILL.md
来源说明 · 只读预览
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 ```sh # 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> ``` ### import-account ```sh # 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-account ```sh # 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> ``` ### create-account ```sh # 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 ``` ### delete-account ```sh near account delete-account <ACCOUNT_ID> beneficiary <BENEFICIARY_ACCOUNT_ID> network-config <NETWORK> sign-with-keychain send ``` ### list-keys ```sh near account list-keys <ACCOUNT_ID> network-config <NETWORK> now ``` ### get-public-key ```sh # 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-key ```sh # 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 ``` ### delete-keys ```sh near account delete-keys <ACCOUNT_ID> public-keys ed25519:<PUBKEY> network-config <NETWORK> sign-with-keychain send ``` ### manage-storage-deposit ```sh # 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-social-profile ```sh # 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` Commands ### view-near-balance ```sh near tokens <ACCOUNT_ID> view-near-balance network-config <NETWORK> now ``` ### view-ft-balance ```sh near tokens <ACCOUNT_ID> view-ft-balance <FT_CONTRACT_ID> network-config <NETWORK> now ``` ### view-nft-assets ```sh near tokens <ACCOUNT_ID> view-nft-assets <NFT_CONTRACT_ID> network-config <NETWORK> now ``` ### send-near ```sh near tokens <SENDER_ACCOUNT_ID> send-near <RECEIVER_ACCOUNT_ID> '<AMOUNT>' network-config <NETWORK> sign-with-keychain send ``` ### send-ft ```sh # 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 ```
在 GitHub 查看
这个 SKILL.md 很大,SkillsMP 这里只预览前一段内容。 在 GitHub 查看