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

sym-web3js

v1.0.0-beta.25

Published

symverse blockchain web3js library

Downloads

27

Readme

Symverse Web3 JavaScript SDK

It provides json rpc communication interface and development library with symverse blockchain, rpc api.
npm: https://www.npmjs.com/package/sym-web3js

Installation

Node.js

npm i sym-web3js

Yarn

yarn add sym-web3js

...

import SymWeb3 from "sym-web3js"

A minified, browserified file dist/sym-web3 is included for use in the browser. Including this file simply attaches the symjs object to window:

<script src='sym-web3.js'></script>

Usage

Use the symjs object directly from the global namespace:

console.log(SymWeb3)  // { utils: ...} 

const symjs = SymWeb3();
console.log(symjs); // {network: ..., utils: ..., signer: ...} 

Network connect

const symjs = SymWeb3();
symjs.network.connect("http://localhost:8001").then(connectedMessage => {
    console.log(connectedMessage, 'connect success...')
}).catch(e => {
    // connected fail...
})

There you go, now you can use it:

// Return Promise Object By Json RPC   
symjs.network.call.getBalance(address); 
symjs.network.call.clientVersion();
  • Send Raw Transaction example:
let privateKey = "1a43aa399cb2efe186317e0b09f4a7ef88b83cff05089b145709881bf4db3a20"
let params = {
    from:"0x00021000000000010002",
    nonce: 210,
    gasLimit: 41000,
    to: "0x00021000000000020002",
    value: 5,
    workNodes: ["0x00021000000000010002"],
    chainId: 7777 //require
};
// Return Promise Object By Json RPC   
symjs.network.call.sendTransaction(params, privateKey);
  • Citizen api call example:
// Return Promise Object By Json RPC   
let citizenInfo = await symjs.network.call.citizen.getCitizenBySymID("0x00021000000000010002")
let count = await symjs.network.call.citizen.getCitizenCount()
  • Warrant api call example:
// Return Promise Object By Json RPC   
let blockNumber = await symjs.network.call.warrant.blockNumber()
  • Sct api call example:
// Return Promise Object By Json RPC   
let constract = await symjs.network.call.sct.getContract("0x4523ad7875a9c41e9629")
let account = await symjs.network.call.sct.getContractAccount("0x4523ad7875a9c41e9629", "0x00021000000000010002")

Send Transaction Receipt confirmation


//send Transaction
const hash = await symjs.network.call.sendRawTransaction(symjs.signer.sign(params, pk))

// watch Transaction Receipt
const receipt = await watch(hash).next(symjs.network.call.getTransactionReceipt);

console.log(receipt)
/*
* {
  blockHash: '0xc8580648b270bf690ca5b151f0d76c1d2b864af7f3ba7003f4ab031b3aa0505c',
  blockNumber: '0x18eee87',
  contractAddress: null,
  cumulativeGasUsed: '0xbf68',
  from: '0x0002afc5b2b55a270002',
  gasUsed: '0xbf68',
  logs: [],
  logsBloom: '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
  status: '0x1',
  to: '0x00020000000000010002',
  transactionHash: '0x318e722534f9acc60fc45fcca7f54058e0fecb34e175e619033c5982a9ff099a',
  transactionIndex: '0x0'
}
* */

Contact

https://www.symverse.com/ Please contact us on this page.