9个不稳定版本 (3个破坏性)
0.15.0 | 2024年6月18日 |
---|---|
0.14.2 | 2024年6月18日 |
0.13.2 | 2024年6月4日 |
0.13.1 | 2024年5月31日 |
0.12.5 | 2024年5月28日 |
#2691 in 魔法豆
1MB
20K SLoC
实用CLI
实用CLI是您的 人性化的 伴侣,帮助您从命令行与实用工具交互。
只需运行 unc
,它会引导您完成操作!
安装
访问发行页面查看最新更新。
通过shell脚本安装预构建的二进制文件(macOS,Linux,WSL)
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/utnet-org/utility-cli-rs/releases/latest/download/unc-installer.sh | sh
使用npx运行预构建的二进制文件(Node.js)
npx unc
将预构建的二进制文件安装到您的npm项目中(Node.js)
npm install unc
从源代码编译和安装(Cargo)
使用cargo
安装它,只需确保您的计算机上已安装Rust。
cargo install unc
或,从git仓库安装最新版本
cargo install --git https://github.com/utnet-org/utility-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 testnet
env:
UNC_NETWORK_CONNECTION: testnet
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@v3
- name: Install unc cli
run: |
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/utnet-org/utility-cli-rs/releases/download/v0.8.2/unc-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和Variables,一旦准备就绪,这个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)
v dev-tool - Developer tools to build and deploy smart contracts
[↑↓ to move, enter to select, type to filter]
CLI交互式地引导您通过一些相当复杂的话题,帮助您在过程中做出明智的决定。
阅读更多
依赖项
~55–76MB
~1.5M SLoC