# near-shell

> General purpose command line tools for interacting with NEAR Protocol

Latest version **0.24.9** (published 2020-07-22) · (MIT AND Apache-2.0) license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install near-shell
pnpm add near-shell
yarn add near-shell
bun add near-shell
```

Provides the command `near`.

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.24.9 |
| Published | 2020-07-22 |
| First published | 2019-02-27 |
| Weekly downloads | 0 |
| License | (MIT AND Apache-2.0) |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 10 |
| Dependencies | 20 |
| Unpacked size | 263.4 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 199 |
| Author | Jane Degtiareva |
| Maintainers | chefsale, janedegtiareva, mikedotexe, nearvlad, potatodepaulo |
| Keywords | blockchain, crypto, dapps, distributed, applications, distributed applications |

## Links

- npm: https://www.npmjs.com/package/near-shell
- Repository: https://github.com/nearprotocol/near-shell
- Homepage: https://github.com/nearprotocol/near-shell#readme
- Issues: https://github.com/nearprotocol/near-shell/issues
- npm.io page: https://npm.io/package/near-shell

## Dependencies (20)

- [ncp](https://npm.io/package/ncp.md) ^2.0.0
- [bs58](https://npm.io/package/bs58.md) ^4.0.1
- [open](https://npm.io/package/open.md) ^7.0.1
- [uuid](https://npm.io/package/uuid.md) ^8.0.0
- [bn.js](https://npm.io/package/bn.js.md) ^5.1.1
- [chalk](https://npm.io/package/chalk.md) ^4.0.0
- [is-ci](https://npm.io/package/is-ci.md) ^2.0.0
- [yargs](https://npm.io/package/yargs.md) ^15.0.1
- [rimraf](https://npm.io/package/rimraf.md) ^3.0.0
- [v8flags](https://npm.io/package/v8flags.md) ^3.1.3
- [mixpanel](https://npm.io/package/mixpanel.md) ^0.11.0
- [stoppable](https://npm.io/package/stoppable.md) ^1.1.0
- [ascii-table](https://npm.io/package/ascii-table.md) 0.0.9
- [near-api-js](https://npm.io/package/near-api-js.md) ^0.27.0
- [tcp-port-used](https://npm.io/package/tcp-port-used.md) ^1.0.1
- [near-ledger-js](https://npm.io/package/near-ledger-js.md) ^0.1.1
- [flagged-respawn](https://npm.io/package/flagged-respawn.md) ^1.0.1
- [update-notifier](https://npm.io/package/update-notifier.md) ^4.0.0
- [jest-environment-node](https://npm.io/package/jest-environment-node.md) ^26.0.0
- [@ledgerhq/hw-transport-node-hid](https://npm.io/package/@ledgerhq/hw-transport-node-hid.md) ^5.15.0

## Alternatives

- [@gemini-wallet/core](https://npm.io/package/@gemini-wallet/core.md) — 515.6K weekly downloads
- [utility](https://npm.io/package/utility.md) — 416.6K weekly downloads
- [@primno/dpapi](https://npm.io/package/@primno/dpapi.md) — 7.2K weekly downloads
- [pi-readseek](https://npm.io/package/pi-readseek.md) — 3.7K weekly downloads
- [@emilia-protocol/verify](https://npm.io/package/@emilia-protocol/verify.md) — 1.1K weekly downloads

## Recent versions

- 0.24.9 (latest) — 2020-07-22
- 0.20.2-preview (preview) — 2020-03-23
- 0.24.8 — 2020-07-21
- 0.24.7 — 2020-07-21
- 0.24.6 — 2020-07-08
- 0.24.5 — 2020-07-07
- 0.24.4 — 2020-06-24
- 0.24.3 — 2020-06-23
- 0.24.2 — 2020-06-07
- 0.24.1 — 2020-05-22
- 0.24.0 — 2020-05-22
- 0.23.2 — 2020-05-17
- 0.23.1 — 2020-05-13
- 0.23.0 — 2020-05-08
- 0.22.0 — 2020-05-06
- … 79 more at https://npm.io/package/near-shell/versions

## README

# NEAR Shell command line interface

[![Build Status](https://travis-ci.com/near/near-shell.svg?branch=master)](https://travis-ci.com/near/near-shell)
[![Gitpod Ready-to-Code](https://img.shields.io/badge/Gitpod-Ready--to--Code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/near/near-shell) 

NEAR Shell is a Node.js application that relies on [`near-api-js`](https://github.com/near/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 Shell

## Installation

```bash
npm install -g near-shell
```

## Usage

In command line, from the directory with your project:

```bash
near <command>
```

### Commands

#### For account:
```bash
  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:
```bash
  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:
```bash
  near tx-status <hash>                            # lookup transaction status by hash
```

#### For validators:
```bash
  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`, `near`and `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:

```bash
  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](LICENSE) and [LICENSE-APACHE](LICENSE-APACHE) for details.

---
_Source: https://npm.io/package/near-shell · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
