#unc #command #command-line #protocols #helps #interact #human-friendly

bin+lib unc-cli-rs

human-friendly console utility that helps to interact with unc Protocol from command line

9 releases (breaking)

0.8.0 Apr 7, 2024
0.7.2 Apr 7, 2024
0.6.0 Mar 24, 2024
0.5.0 Mar 21, 2024
0.1.0 Mar 7, 2024

#15 in #unc

MIT/Apache and GPL-2.0-or-later

1MB
18K SLoC

unc CLI

unc CLI is your human-friendly companion that helps to interact with UNC Protocol from command line.

Just run unc and let it guide you through!

Install

Visit Releases page to see the latest updates.

Install prebuilt binaries via shell script (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
Install prebuilt binaries via powershell script (Windows)
irm https://github.com/unc/unc-cli-rs/releases/latest/download/unc-cli-rs-installer.ps1 | iex
Run prebuilt binaries with npx (Node.js)
npx unc-cli-rs
Install prebuilt binaries into your npm project (Node.js)
npm install unc-cli-rs
Compile and install from the source code (Cargo)

Install it with cargo, just make sure you have Rust installed on your computer.

cargo install unc-cli-rs

or, install the most recent version from git repository:

$ cargo install --git https://github.com/unc/unc-cli-rs
Install on CI (GitHub Actions)

It is often desirable to use unc cli from CI to automate some actions, so here is an example of how you can make a function call during 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

You will need to configure GitHub Actions Secrets and Variables and once it is ready, this CI will only take a couple of seconds to complete!

See how it is used by DevHub.

Run

Once installed, you just run it with unc command:

$ 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]

The CLI interactively guides you through some pretty complex topics, helping you make informed decisions along the way.

Read more in English

Dependencies

~55–77MB
~1.5M SLoC