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
npm install eosjs
Typescript
Module System
Node Version
NPM Version
98.6
Supply Chain
99.6
Quality
80.1
Maintenance
50
Vulnerability
99.6
License
EOSJS v22.1.0 Release Notes
Published on 13 Jul 2021
EOSJS v22.0.0 Release Notes
Published on 20 May 2021
EOSJS v21.0.4 Release Notes
Published on 19 Apr 2021
EOSJS v22.0.0-rc2 Release Notes
Published on 17 Feb 2021
EOSJS v22.0.0-rc1 Release Notes
Published on 15 Dec 2020
EOSJS v21.0.3 Release Notes
Published on 12 Aug 2020
TypeScript (72.79%)
JavaScript (14.61%)
HTML (7.42%)
Shell (3.41%)
Dockerfile (1.13%)
CSS (0.42%)
C++ (0.22%)
Total Downloads
11,624,214
Last Day
3,240
Last Week
31,912
Last Month
176,915
Last Year
1,791,788
1,433 Stars
1,387 Commits
463 Forks
109 Watching
56 Branches
58 Contributors
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
Publised On
13 Jul 2021
Cumulative downloads
Total Downloads
Last day
-59.9%
3,240
Compared to previous day
Last week
-26.2%
31,912
Compared to previous week
Last month
-5.6%
176,915
Compared to previous month
Last year
7.6%
1,791,788
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
no binaries found in the repo
Reason
all changesets reviewed
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 8
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is archived
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
29 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-12-23
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