neon-js

neon-js

  • Docs
  • API
  • Examples
  • Changelog
  • Help

›Getting Started

Getting Started

  • Overview
  • Installation
  • Structure

Guides

  • Basic - Sending assets
  • Basic - Claiming Gas
  • Basic - Create Smart Contract Script
  • Basic - Invoking a Smart Contract
  • Basic - Using a Private Net
  • Basic - Signing with a multi-sig account
  • Advanced - Sending multiple transactions in a block
  • Advanced - API Core Components

Installation

neon-js lives in the NPM system under the organization cityofzion.

Install

To install

npm install @cityofzion/neon-js

For a specific commit or release, add the commit hash / tag / branch behind:

npm install @cityofzion/neon-js#dev

Import

neon-js supports 2 kinds of imports.

A default import will import the semantic version of neon. Use this if you are new or just want the whole package to use.

import Neon from "@cityofzion/neon-js";

Neon.create.claimTx(...args);
const query = Neon.create.query();

Modules are exposed through named imports. This allows more fine grained control and access to individual modules.

import { rpc, tx } from "@cityofzion/neon-js";

Neon.tx.createClaimTx(...args);
const query = new rpc.Query();

Require

As neon-js package uses ES6 module conventions, require will need to specify which module do they want exactly:

var neonJs = require('@cityofzion/neon-js')

// Semantic Style by using default import
var Neon = neonJs.default
const query = Neon.create.query()

// Named imports are available too
var wallet = neonJs.wallet
var tx = neonJs.tx

const account = new wallet.Account(privateKey)

Web

neon-js is also packaged for the web. You can add it through a script tag

  <script src="./lib/browser.js"></script>

The library will be available as a global variable Neon. Similar to require style, you will have the semantic style under default and the rest of the named modules exposed at the same level.

← OverviewStructure →
  • Install
  • Import
  • Require
  • Web
neon-js
Docs
Getting StartedGuidesAPI Reference
Community
Discord ChatNEO Reddit
More
NEOGitHubStar
City of Zion
Copyright © 2020 City of Zion