GithubHelp home page GithubHelp logo

flmel / near-cli-rs Goto Github PK

View Code? Open in Web Editor NEW

This project forked from near/near-cli-rs

0.0 0.0 0.0 1.88 MB

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

Home Page: https://near.cli.rs

License: Apache License 2.0

Rust 99.98% Dockerfile 0.02%

near-cli-rs's Introduction

NEAR CLI

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

Just run near and let it guide you through!

Install

You can find binary releases of near CLI for your OS on the Releases page.

Install prebuilt binaries via shell script (macOS, Linux, WSL)

curl --proto '=https' --tlsv1.2 -LsSf https://github.com/near/near-cli-rs/releases/latest/download/near-cli-rs-installer.sh | sh

Install prebuilt binaries via powershell script (Windows)

irm https://github.com/near/near-cli-rs/releases/latest/download/near-cli-rs-installer.ps1 | iex

Run prebuilt binaries with npx (Node.js)

npx near-cli-rs

Install prebuilt binaries into your npm project (Node.js)

npm install near-cli-rs

Install from source code (Cargo)

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

cargo install near-cli-rs

or, install the most recent version from git repository:

$ cargo install --git https://github.com/near/near-cli-rs

Install on CI (GitHub Actions)

It is often desirable to use near 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:
      NEAR_NETWORK_CONNECTION: mainnet
      NEAR_CONTRACT_ACCOUNT_ID: ${{ vars.NEAR_CONTRACT_ACCOUNT_ID }}
      NEAR_SIGNER_ACCOUNT_ID: ${{ vars.NEAR_SIGNER_ACCOUNT_ID }}
      NEAR_SIGNER_ACCOUNT_PUBLIC_KEY: ${{ vars.NEAR_SIGNER_ACCOUNT_PUBLIC_KEY }}
      NEAR_SIGNER_ACCOUNT_PRIVATE_KEY: ${{ secrets.NEAR_SIGNER_ACCOUNT_PRIVATE_KEY }}

    steps:
    - name: Checkout repository
      uses: actions/checkout@v2

    - name: Install near CLI
      run: |
        curl --proto '=https' --tlsv1.2 -LsSf https://github.com/near/near-cli-rs/releases/download/v0.7.4/near-cli-rs-installer.sh | sh

    - name: Call some function
      run: |
        near contract call-function as-transaction "$NEAR_CONTRACT_ACCOUNT_ID" 'function_name_here' json-args '{}' prepaid-gas '100 TeraGas' attached-deposit '0 NEAR' sign-as "$NEAR_SIGNER_ACCOUNT_ID" network-config "$NEAR_NETWORK_CONNECTION" sign-with-plaintext-private-key --signer-public-key "$NEAR_SIGNER_ACCOUNT_PUBLIC_KEY" --signer-private-key "$NEAR_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 in near/devgigsboard.

Run

Once installed, you just run it with near command:

$ near

? 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 NEAR, FT, NFT
  staking     - Manage staking: view, add and withdraw stake
  contract    - Manage smart-contracts: deploy code, call functions
  transaction - Operate transactions
  config      - Manage connections in a configuration file (config.toml)
  extension   - Manage near 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.

near-cli-rs's People

Contributors

adsick avatar bucanero avatar buckram123 avatar chaotictempest avatar chubik avatar dj8yfo avatar evgenykuzyakov avatar frol avatar frolvanya avatar frovolod avatar iho avatar jjambazov-bc avatar khorolets avatar marcoieni avatar mehrbod2002 avatar mfornet avatar miraclx avatar ninolipartiia4ire avatar shariffdev avatar thaodt avatar volovyks avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.