9个版本 (破坏性更新)
0.8.0 | 2024年4月7日 |
---|---|
0.7.2 | 2024年4月7日 |
0.6.0 | 2024年3月24日 |
0.5.0 | 2024年3月21日 |
0.1.0 | 2024年3月7日 |
#2727 in 魔法豆
每月456次下载
1MB
18K SLoC
unc CLI
unc CLI 是您的 人性化的 伴侣,帮助您从命令行交互 UNC 协议。
只需运行 unc
并让它引导您!
安装
访问 版本页面 查看最新更新。
通过 shell 脚本安装预构建的二进制文件(macOS,Linux,WSL)
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/unc/unc-cli-rs/releases/latest/download/unc-cli-rs-installer.sh | sh
通过 powershell 脚本安装预构建的二进制文件(Windows)
irm https://github.com/unc/unc-cli-rs/releases/latest/download/unc-cli-rs-installer.ps1 | iex
使用 npx 运行预构建的二进制文件(Node.js)
npx unc-cli-rs
将预构建的二进制文件安装到您的 npm 项目中(Node.js)
npm install unc-cli-rs
从源代码编译和安装(Cargo)
使用 cargo
安装,确保您已在计算机上安装了 Rust。
cargo install unc-cli-rs
或者,从 Git 仓库安装最新版本
$ cargo install --git https://github.com/unc/unc-cli-rs
在 CI 上安装(GitHub Actions)
通常希望从 CI 使用 unc
cli来自动化一些操作,所以这里有一个示例,说明您如何在 CI 期间进行函数调用
name: Release
on:
push:
branches: [main]
jobs:
deploy-widgets:
runs-on: ubuntu-latest
name: Make a function call on mainnet
env:
UNC_NETWORK_CONNECTION: mainnet
UNC_CONTRACT_ACCOUNT_ID: ${{ vars.UNC_CONTRACT_ACCOUNT_ID }}
UNC_SIGNER_ACCOUNT_ID: ${{ vars.UNC_SIGNER_ACCOUNT_ID }}
UNC_SIGNER_ACCOUNT_PUBLIC_KEY: ${{ vars.UNC_SIGNER_ACCOUNT_PUBLIC_KEY }}
UNC_SIGNER_ACCOUNT_PRIVATE_KEY: ${{ secrets.UNC_SIGNER_ACCOUNT_PRIVATE_KEY }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install unc cli
run: |
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/utility/utility-cli-rs/releases/download/v0.2.0/unc-cli-rs-installer.sh | sh
- name: Call some function
run: |
unc contract call-function as-transaction "$UNC_CONTRACT_ACCOUNT_ID" 'function_name_here' json-args '{}' prepaid-gas '100 TeraGas' attached-deposit '0 unc' sign-as "$UNC_SIGNER_ACCOUNT_ID" network-config "$UNC_NETWORK_CONNECTION" sign-with-plaintext-private-key --signer-public-key "$UNC_SIGNER_ACCOUNT_PUBLIC_KEY" --signer-private-key "$UNC_SIGNER_ACCOUNT_PRIVATE_KEY" send
您需要配置 GitHub Actions Secrets 和变量,一旦准备就绪,此 CI 将只需要几秒钟即可完成!
请参阅 DevHub 的使用方法。
运行
安装后,您只需使用 unc
命令运行它
$ unc
? What are you up to? (select one of the options with the up-down arrows on your keyboard and press Enter)
> account - Manage accounts
tokens - Manage token assets such as UNC, FT, NFT
pledging - Manage pledging: view, add and withdraw pledge
contract - Manage smart-contracts: deploy code, call functions
transaction - Operate transactions
config - Manage connections in a configuration file (config.toml)
extension - Manage unc CLI and extensions
[↑↓ to move, enter to select, type to filter]
CLI 交互式引导您了解一些相当复杂的话题,帮助您在过程中做出明智的决定。
英文阅读更多
依赖关系
~53–78MB
~1.5M SLoC