Gathering detailed insights and metrics for eosjs
Gathering detailed insights and metrics for eosjs
Gathering detailed insights and metrics for eosjs
Gathering detailed insights and metrics for eosjs
General purpose library for the EOSIO blockchain.
npm install eosjs
Typescript
Module System
Node Version
NPM Version
99
Supply Chain
99.6
Quality
80.1
Maintenance
25
Vulnerability
99.6
License
EOSJS v22.1.0 Release Notes
Updated on Jul 13, 2021
EOSJS v22.0.0 Release Notes
Updated on May 20, 2021
EOSJS v21.0.4 Release Notes
Updated on Apr 19, 2021
EOSJS v22.0.0-rc2 Release Notes
Updated on Feb 17, 2021
EOSJS v22.0.0-rc1 Release Notes
Updated on Dec 15, 2020
EOSJS v21.0.3 Release Notes
Updated on Aug 12, 2020
TypeScript (72.79%)
JavaScript (14.61%)
HTML (7.42%)
Shell (3.41%)
Dockerfile (1.13%)
CSS (0.42%)
C++ (0.22%)
Total Downloads
12,297,406
Last Day
12,374
Last Week
68,159
Last Month
265,209
Last Year
2,084,868
MIT License
1,433 Stars
1,387 Commits
461 Forks
108 Watchers
56 Branches
57 Contributors
Updated on Mar 15, 2025
Minified
Minified + Gzipped
Latest Version
22.1.0
Package Id
eosjs@22.1.0
Size
79.40 kB
NPM Version
7.7.6
Node Version
15.14.0
Published on
Jul 13, 2021
Cumulative downloads
Total Downloads
Last Day
3.6%
12,374
Compared to previous day
Last Week
32.2%
68,159
Compared to previous week
Last Month
16.2%
265,209
Compared to previous month
Last Year
29.4%
2,084,868
Compared to previous year
Javascript API for integration with EOSIO-based blockchains using EOSIO RPC API.
Documentation can be found here
The official distribution package can be found at npm.
yarn add eosjs
In order to get access to the TextEncoding
and TextDecoding
types, you need to add @types/text-encoding
as a dev dependency:
yarn add --dev @types/text-encoding
If you're using Node (not a browser) then you'll also need to make sure the dom
lib is referenced in your tsconfig.json
:
{
"compilerOptions": {
"lib": [..., "dom"]
}
}
Clone this repository locally then run yarn build-web
. The browser distribution will be located in dist-web
and can be directly copied into your project repository. The dist-web
folder contains minified bundles ready for production, along with source mapped versions of the library for debugging. For full browser usage examples, see the documentation.
Importing using ESM syntax is supported using TypeScript, webpack, or Node.js with --experimental-modules
flag
1import { Api, JsonRpc, RpcError } from 'eosjs'; 2import { JsSignatureProvider } from 'eosjs/dist/eosjs-jssig'; // development only
Importing using commonJS syntax is supported by Node.js out of the box.
1const { Api, JsonRpc, RpcError } = require('eosjs'); 2const { JsSignatureProvider } = require('eosjs/dist/eosjs-jssig'); // development only 3const fetch = require('node-fetch'); // node only; not needed in browsers 4const { TextEncoder, TextDecoder } = require('util'); // node only; native TextEncoder/Decoder
The Signature Provider holds private keys and is responsible for signing transactions.
Using the JsSignatureProvider in the browser is not secure and should only be used for development purposes. Use a secure vault outside of the context of the webpage to ensure security when signing transactions in production
1const defaultPrivateKey = "5JtUScZK2XEp3g9gh7F8bwtPTRAkASmNrrftmx4AxDKD5K4zDnr"; // bob 2const signatureProvider = new JsSignatureProvider([defaultPrivateKey]);
Open a connection to JSON-RPC, include fetch
when on Node.js.
1const rpc = new JsonRpc('http://127.0.0.1:8888', { fetch });
Include textDecoder and textEncoder when using in Node. You may exclude these when running in a browser since most modern browsers now natively support these. If your browser does not support these (https://caniuse.com/#feat=textencoder), then you can import them as a dependency through the following deprecated npm package: https://www.npmjs.com/package/text-encoding
1const api = new Api({ rpc, signatureProvider, textDecoder: new TextDecoder(), textEncoder: new TextEncoder() });
transact()
is used to sign and push transactions onto the blockchain with an optional configuration object parameter. This parameter can override the default value of broadcast: true
, and can be used to fill TAPOS fields given expireSeconds
and either blocksBehind
or useLastIrreversible
. Given no configuration options, transactions are expected to be unpacked with TAPOS fields (expiration
, ref_block_num
, ref_block_prefix
) and will automatically be broadcast onto the chain.
1(async () => { 2 const result = await api.transact({ 3 actions: [{ 4 account: 'eosio.token', 5 name: 'transfer', 6 authorization: [{ 7 actor: 'useraaaaaaaa', 8 permission: 'active', 9 }], 10 data: { 11 from: 'useraaaaaaaa', 12 to: 'useraaaaaaab', 13 quantity: '0.0001 SYS', 14 memo: '', 15 }, 16 }] 17 }, { 18 blocksBehind: 3, 19 expireSeconds: 30, 20 }); 21 console.dir(result); 22})();
use RpcError
for handling RPC Errors
1... 2try { 3 const result = await api.transact({ 4 ... 5} catch (e) { 6 console.log('\nCaught exception: ' + e); 7 if (e instanceof RpcError) 8 console.log(JSON.stringify(e.json, null, 2)); 9} 10...
See LICENSE for copyright and license terms.
All repositories and other materials are provided subject to the terms of this IMPORTANT notice and you must familiarize yourself with its terms. The notice contains important information, limitations and restrictions relating to our software, publications, trademarks, third-party resources, and forward-looking statements. By accessing any of our repositories and other materials, you accept and agree to the terms of the notice.
No vulnerabilities found.
Reason
all changesets reviewed
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 8
Details
Reason
project is archived
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
32 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-03-24
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More