Code Monkey home page Code Monkey logo

near-cli's Introduction

NEAR CLI (command line interface)

Build Status Gitpod Ready-to-Code

NEAR CLI is a Node.js application that relies on near-api-js to generate secure keys, connect to the NEAR platform and send transactions to the network on your behalf.

note that Node.js version 10+ is required to run NEAR CLI

Installation

npm install -g near-cli

Usage

In command line, from the directory with your project:

near <command>

Commands

For account:

  near login                                       # logging in through NEAR protocol wallet
  near create-account <accountId>                  # create a developer account with --masterAccount (required), publicKey and initialBalance
  near state <accountId>                           # view account state
  near keys <accountId>                            # view account public keys
  near send <sender> <receiver> <amount>           # send tokens to given receiver
  near stake <accountId> <stakingKey> <amount>     # create staking transaction (stakingKey is base58 encoded)
  near delete <accountId> <beneficiaryId>          # delete an account and transfer funds to beneficiary account
  near delete-key [accessKey]                      # delete access key

For smart contract:

  near deploy [accountId] [wasmFile] [initFunction] [initArgs] [initGas] [initDeposit]  # deploy your smart contract
  near dev-deploy [wasmFile]                       # deploy your smart contract using temporary account (TestNet only)
  near call <contractName> <methodName> [args]     # schedule smart contract call which can modify state
  near view <contractName> <methodName> [args]     # make smart contract call which can view state
  near clean                                       # clean the smart contract build locally (remove ./out )

For transactions:

  near tx-status <hash>                            # lookup transaction status by hash

For validators:

  near validators <epoch>                          # lookup validating nodes by epoch(or "current", "next")
  near proposals                                   # lookup current proposals

REPL:

near repl

Launch interactive Node.js shell with NEAR connection available to use. The repl's initial context contains nearAPI, nearand account if an accountId cli argument is provided. To load a script into the repl use .load script.js.

Usage example:
near repl --acountId bob
> console.log(account)
> .load script.js

Misc:

  near repl                                        # launch interactive Node.js shell with NEAR connection available to use
  near generate-key <account-id>                   # generate key locally (Note: this does not create another access key automatically)

Options

Option Description Type Default
--help Show help [boolean]
--version Show version number [boolean]
--nodeUrl NEAR node URL [string] "http://localhost:3030"
--networkId NEAR network ID for different keys by network [string] "default"
--helperUrl NEAR contract helper URL [string]
--keyPath Path to master account key [string]
--accountId Unique identifier for the account [string] [required]
--masterAccount Account used to create requested account. [string] [required]
--publicKey Public key to initialize the account with [string] [required]
--initialBalance Number of tokens to transfer to newly account [string] [required]

License

This repository is distributed under the terms of both the MIT license and the Apache License (Version 2.0). See LICENSE and LICENSE-APACHE for details.

near-cli's People

Contributors

ailisp avatar amgando avatar behaviary avatar bowenwang1996 avatar chadoh avatar dependabot-preview[bot] avatar dependabot[bot] avatar frol avatar icerove avatar ilblackdragon avatar janedegtiareva avatar june07 avatar mikedotexe avatar vgrichina avatar willemneal avatar

Watchers

 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.