Skip to content
EOS common library used for Typescript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
__tests__
libraries/eosiolib
.gitignore
LICENSE
README.md
index.ts
package.json
tsconfig.json
tslint.json

README.md

eos-common

Build Status npm version MIT licensed

EOSIO Smart Contract common library used for Typescript

Installation

Using Yarn:

yarn add eos-common

or using NPM:

npm install --save eos-common

Quick Start

import { split } from "eos-common"

const { amount } = split("1.0000 EOS");
amount //=> 10000

API

Table of Contents

constructor

Symbol Class

Parameters

Examples

const sym = new Symbol("EOS", 4);
sym.symbol //=> "EOS"
sym.precision //=> 4

Returns Symbol Symbol

symbol

Symbol

Parameters

Examples

const sym = symbol("EOS", 4);
sym.symbol //=> "EOS"
sym.precision //=> 4

Returns Symbol Symbol

constructor

Asset Class

Parameters

Examples

const quantity = new Asset(10000, new Symbol("EOS", 4));
quantity.toString() //=> "1.0000 EOS";
quantity.symbol.symbol //=> "EOS"
quantity.symbol.precision //=> 4

Returns Asset Asset

asset

Asset

Parameters

Examples

const quantity = asset(10000, new Symbol("EOS", 4));
quantity.toString() //=> "1.0000 EOS";
quantity.symbol.symbol //=> "EOS"
quantity.symbol.precision //=> 4

Returns Asset Asset

split

Split quantity string

Parameters

  • quantity string Quantity string

Examples

const quantity = split("1.0000 EOS");
quantity.amount //=> 10000
quantity.symbol.precision() //=> 4
quantity.symbol.symbol() //=> "EOS"

Returns Asset

You can’t perform that action at this time.