npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

js4eos

v1.6.2

Published

js4eos is a javascript Command Line Application for EOS. All commands are same as cleos. You don't need to build eos or setup a eos docker.<br> js4eos is also a Testing Framework for EOS Smart Contract just like truffle on ethereum<br> <a href='https://g

Downloads

53

Readme

js4eos

js4eos is a javascript Command Line Application for EOS. All commands are same as cleos. You don't need to build eos or setup a eos docker. js4eos is also a Testing Framework for EOS Smart Contract just like truffle on ethereum 中文请点击这里

install js4eos

npm install js4eos -g

update node if there is a error when install js4eos

npm install -g npm
npm install -g node

you may add sudo in linux-based operation

create wallet

create default wallet

js4eos wallet create

create another wallet

js4eos wallet create -n name

unlock wallet

unlock wallet before any operation. You don't need to unlock again in 30 minutes.

js4eos wallet unlock

create the first account

jungle testnet

js4eos config set --network jungle
js4eos faucet accountxxx

accountxxx is the new account name,length 12, and must be 'a-z,1-5' you can switch to other network to create your first account

js4eos config set --network mainnet/kylin/fibos
js4eos faucet accountxxx

import private key of account

you must import the private key of a account before using this account. private key only exists in local ram, and only encrypted key saves to file.

js4eos wallet unlock (then please input password of wallet)
js4eos wallet import keyxxx

keyxxx is the private key of account you want to operate.

compile contract

compile wasm

this will run offline if there is a local compiler, or will run online.

cd xxx
js4eos compile -o xxx.wasm xxx.cpp

use compile2 if your code follows eosio.cdt rule.

js4eos compile2 -o xxx.wasm xxx.cpp

generate abi

js4eos compile -g xxx.abi xxx.cpp

code with cdt rule

js4eos compile2 -g xxx.abi xxx.cpp --contract contractclass

you will find three files xxx.cpp, xxx.abi, xxx.wasm in folder 'xxx'

buyram

hello contract needs almost 52k ram you can get free eos for your account in jungle network. http://jungle.cryptolions.io/#faucet then buyram for your account to deploy a contract

js4eos system buyram acountxxx acountxxx "10.0000 EOS"

must keep four decimal places. '.0000'

deploy contract

js4eos set contract accountxxx xxx

ensure xxx.wasm and xxx.abi have already exist in folder 'xxx'

other commands

all commands are same with that of cleos

new apis

js4eos config

switch network

for example, switch between mainnet/kylin/jungle/enu/fibos networks

js4eos config set --network mainnet/kylin/jungle/enu/fibos

change chainid, httpendpoint

change chainid, httpendpoint of current network

js4eos config  set --chainid=aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906 --url=http://bp.cryptolions.io:8888

change chainid, httpendpoint, network

change network, and then change chainid, httpEndpoint of this network

js4eos config  set --network mainnet --chainid=aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906 --url=http://bp.cryptolions.io:8888

sync configuration

We maintain well-work httpEndpoints, so you can sync the newest configuration file with below command.

js4eos config sync

reset configuration

you may come across some issues, and then you can try reset configuration to fix it.

js4eos config reset

view documents

js4eos doc network

issues

update js4eos firstly with below command if you run into a problem.

npm install -g js4eos

Try below solutions if the issue is still not fixed.

key problem

unlock wallet if encounter below problem.

missing key, check your keyprovider

you can reset wallet if the issue is still going.

js4eos wallet stop
js4eos wallet delete
js4eos wallet create
js4eos wallet import xxx

network problem

check network or httpEndpoint if it is 'fetch error'

{ FetchError: request to

change httpEndpoint

js4eos config choose url

compile issue

compile needs network if no local compiler

how to do when have no idea

firstly, reset config and sync config

#(ubuntu等需要sudo)
npm install -g js4eos@latest
js4eos config reset
js4eos config sync

secondly, reset all if above solution not work

npm install -g js4eos@latest
js4eos reset

finally, restart you machine.Report a issue in github or contact wechat:itleaks

windows compatible issue

Not recommended to use js4eos in mingwin or cygwin.Pleas use powershell or normal terminal of windows. You may need to escape quote of a command.For example

js4eos push action eosio.token transfer '["youraccount", "account2", "1.0000 EOS", "test"]' -p youraccount

you need replace '"' to '""' in normal terminal

js4eos push action eosio.token transfer "[""youraccount"", ""account2"", ""1.0000 EOS"", ""test""]" -p youraccount

you need add '' in PowerShell

js4eos push action eosio.token transfer '[\"youraccount\", \"account2\", \"1.0000 EOS\", \"test\"]' -p youraccount

vscode is recommendded

More commands

create keys

js4eos create key

import key

js4eos wallet import xxxxx

create a new account

js4eos system newaccount --stake-net "0.0000 EOS" --stake-cpu "0.0000 EOS" --buy-ram-kbytes 3  createraccount somenewaccount EOSxxxxx... EOSxxxxx... -p createraccount

transfer

js4eos push action eosio.token transfer '["itleakstoken", "itleakstokem", "10.0000 EOS", "test"]' -p itleakstoken

get account info

js4eos get account youraccount

buy ram

js4eos system buyram payer receiver "0.0001 EOS"

sell RAM

js4eos system sellram payer bytes

delegate CPU,NET

js4eos system delegatebw payer receiver "0.0000 EOS" "0.1000 EOS"

the first "0.0000 EOS" is network, and the second "0.1000 EOS" is cpu

undelegate

js4eos system undelegatebw payer receiver "0.0000 EOS" "0.1000 EOS"

deploy contract

js4eos set contract xxx/xxx/contract_name

contract_name.abi and contract_name.wasm must exist

choose httpendpoint

httpendpoint may halt, and you can change to another endpoint.

$ js4eos config choose url
Choose one httpEndpoint for mainnet:
	*[0] http://bp.cryptolions.io:8888
	 [1] https://mainnet.genereos.io
	 [2] https://mainnet.meet.one
	 [3] http://mainnet.eoscalgary.io
please input[0~3]>

choose network

$ js4eos config choose network
Choose one network:
	*[0] mainnet
	 [1] localnet
	 [2] eosforce
	 [3] jungle
	 [4] kylin
	 [5] enu
	 [6] fibos
please input[0~6]>

Eos Testing framework

js4eos is also a testing framework

initail a contract application

mkdir js4eos-dapp
cd js4eos-dapp
js4eos dapp init
or
// a version support IDE 'vscode'
js4eos dapp init -v vscode

create contract

js4eos dapp create anewcontract

compile contract

js4eos dapp compile hello

deploy contract

js4eos dapp deploy hello

test hello contract

Only test hello test units with option '-g' '-g hi' means grep pattern 'hi' and then test

js4eos dapp test -g hi

test all test

js4eos dapp test

Configure your dapp

Configuration of dapp is in file "js4eos_config.js" please modify this configuration to change deploy config such as deploy account.

Contact

Feel free to add my wechat:itleaks