
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
eos-common
Advanced tools
eos-common
EOSIO Smart Contract common library used for Typescript
To implement the most commonly used EOSIO C++ Classes into Typescript:
Using Yarn:
yarn add eos-common
or using NPM:
npm install --save eos-common
import { Asset, Symbol } from "eos-common"
const quantity = new Asset(10000, new Symbol("EOS", 4));
quantity.toString() //=> "1.0000 EOS";
quantity.symbol.code() //=> "EOS"
quantity.symbol.precision //=> 4
Asset
const quantity = new Asset(10000, new Symbol("EOS", 4));
quantity.toString() //=> "1.0000 EOS";
quantity.symbol.code() //=> "EOS"
quantity.symbol.precision //=> 4
Returns Asset Asset
{int64_t} The amount of the asset
Check if the amount doesn't exceed the max amount
Returns any true - if the amount doesn't exceed the max amount
Returns any false - otherwise
Check if the asset is valid. %A valid asset has its amount <= max_amount and its symbol name valid
Returns any true - if the asset is valid
Returns any false - otherwise
{constexpr int64_t} Maximum amount possible for this asset. It's capped to 2^62 - 1
Assert if the predicate fails and use the supplied message.
check(a == b, "a does not equal b");
Returns void
Symbol
const sym = new Symbol("EOS", 4);
sym.code() //=> "EOS"
sym.precision //=> 4
Returns Symbol Symbol
Convert EOS stake into decaying value
staked
vote
number voteConvert vote decay value into EOS stake
vote
staked
number stakedvoteWeightToday computes the stake2vote weight for EOS, in order to compute the decaying value.
Split quantity string
quantity
string Quantity stringconst quantity = split("1.0000 EOS");
quantity.amount //=> 10000
quantity.symbol.precision //=> 4
quantity.symbol.code() //=> "EOS"
Returns Asset
FAQs
EOSIO Smart Contract common library used for Typescript
The npm package eos-common receives a total of 34 weekly downloads. As such, eos-common popularity was classified as not popular.
We found that eos-common demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.