@ellcrys/spell
The official JavaScript library for Ellcrys
Last updated a year ago by ncodes .
GPL-3.0 · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @ellcrys/spell 
SYNC missed versions from official npm registry.

Spell - Ellcrys Javascript API

Spell is a Javascript API which provides access to the JSON-RPC 2.0 API service exposed by ELLD node. It allows a user to perform actions such as constructing and sending transactions, fetching transactions and blocks and managing a local or remote Ellcrys node. You need to have access to a running Ellcrys node to use this library.

The full documentation can be found here

Installation

Node

npm install @ellcrys/spell

Yarn

yarn add @ellcrys/spell

Usage

To begin using the library, you must first create a Spell instance and provide connection information that will enable the client connect to the JSON-RPC 2.0 service.

import Spell from "@ellcrys/spell";

// Create a Spell Instance
const spell = new Spell();

// Provide connection options to a local or remote Ellcrys node
const resp = spell.provideClient({
	host: "127.0.0.1",
	port: 8999,
	username: "admin", // optional
	password: "secret", // optional
});

// spell.provideClient returns a promise that is resolved
// when the node responds to an initial ping message.
resp.then(async () => {
	// do something with spell
	const basic = await spell.node.basic();
	console.log(basic);
}).catch(console.error);

Once spell has been initialized with a valid node connection information. You can start accessing the RPC methods. You can get the balance of an account like this:

spell.ell.getBalance("e2763...").then((bal) => {
	console.log(bal); // "20.00"
});

Calling RPC Methods

Spell closely replicates the same namespace-based structure used to organize the JSON-RPC 2.0 methods of an Ellcrys node. For example, RPC methods are named and addressed in the following format:

{namespace}_{method}
Where:
 - namespace: The group name a method belongs to.
 - method: Is the name of the method.

A method getBalance of a namespace ell can be accessed like this:

spell.ell.getBalance(...)

TypeScript Support

The library includes TypeScript types within it. You can use spell like this:

import Spell from "@ellcrys/spell";

Documentation

Find the complete documentation here

Contributing

We appreciate contributions. They help move us faster and improve the quality of the project. Please follow this steps to contribute:

  • Fork this repository and clone it locally. git clone https://github.com/ellcrys/spell
  • Add the remote upstream git remote add upstream git://github.com/ellcrys/spell
  • Pull upstream changes git fetch upstream
  • Create a new branch to work on. Create your branch from dev.
  • Add your changes, add or adapt tests, run linter and generate doc.
  • Push your branch to your fork.
  • Create a pull request targeting the dev branch.

Requirements

Commands

npm i                 // Install dependencies
npm run ts-watch      // Watch and compile TypeScript files into `lib`
npm run gen-docs      // Re-generate documentation
npm run test          // Runs all tests

Useful Links

Current Tags

  • 0.1.23                                ...           latest (a year ago)

25 Versions

  • 0.1.23                                ...           a year ago
  • 0.1.22                                ...           a year ago
  • 0.1.21                                ...           a year ago
  • 0.1.20                                ...           a year ago
  • 0.1.19                                ...           a year ago
  • 0.1.18                                ...           a year ago
  • 0.1.17                                ...           a year ago
  • 0.1.16                                ...           a year ago
  • 0.1.15                                ...           a year ago
  • 0.1.14                                ...           a year ago
  • 0.1.13                                ...           a year ago
  • 0.1.12                                ...           a year ago
  • 0.1.11                                ...           a year ago
  • 0.1.10                                ...           a year ago
  • 0.1.9                                ...           a year ago
  • 0.1.8                                ...           a year ago
  • 0.1.7                                ...           a year ago
  • 0.1.6                                ...           a year ago
  • 0.1.5                                ...           a year ago
  • 0.1.4                                ...           a year ago
  • 0.1.3                                ...           a year ago
  • 0.1.2-b                                ...           a year ago
  • 0.1.2                                ...           a year ago
  • 0.1.1                                ...           a year ago
  • 0.0.1                                ...           a year ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 26
Dependencies (18)
Dev Dependencies (25)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |