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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@dioxide-js/silas

v0.2.37

Published

RPC utility for Silas

Downloads

175

Readme

@dioxide-js/silas

@dioxide-js/silas is a Nodejs/javascript SDK which designed to interact with Dioxide JSON RPC API

Installation

For use in Node.js or a web application

using npm

$ npm install @dioxide-js/silas

using yarn

$ yarn add @dioxide-js/silas

Using pnpm:

$ pnpm add @dioxide-js/silas

Using in browser

<script src="https://unpkg.com/@dioxide-js/silas@latest/dist/umd/index.min.js"></script>
<script>
    const { Web3 } = DSSWeb3;
    const web3 = new Web3(<DIOSERVICE_ENDPOINT>, {
      apiKey: <YOUR_API_KEY>
    });
    web3.overview.chainStatus().then(console.log)
</script>

Getting Started

Initialize

import { Web3, NET } from '@dioxide-js/silas'
import { dataview } from '@dioxide-js/misc'

const web3 = new Web3(<DIOSERVICE_ENDPOINT>, {
  apiKey: 'YOUR_API_KEY',
}) // const web3 = new Web3(NET.MAIN); // For production
const user0 = {
  address: 'jjkw5p9fz7nk0zfy6171ch0dy8bk16mhgpwkdcrc4rpt4sfzpvht9za2qr:sm2',
  privatekey: 'AyyogAYL5nVC5CsrTxdYe9IBXOppNqsGd+hSHn+QT68=',
  id: 'stest01',
}

const privatekeyU8 = dataview.base64ToU8(user0.privatekey)

Proofs

newProof(privatekey: string | Unit8Array, p: NewProofParams): Promise<string>

To set a proof and retrieve tx hash as result.

const txnHash = await web3.proof.newProof(user0.privatekey, {
  content: 'sdk unit test',
  key: 'test234',
  sender: user0.address,
})
getProofs(p: GetProofsParams): Promise<Proof>
const proofs = await web3.proof.getProofs({
  owner: user0.address,
})
checkProof(proofHash: string): Promise<boolean>
const proofs = await web3.proof.checkProof("ctz5ftg90cxm65j3ns5g4f99zezen9a73dkw2s7xspjbg19t4ax0")

Account

generate(alg: Alg = 'sm2', privatekey?: Uint8Array | string): Promise<AddressGenerated>
const result = await web3.account.generate('sm2')
console.log(result.publickey, result.privatekey, result.address)
getState(p: RegsiterOption): Promise<{address: string; publickey: string; status: number; userid: string}>
const userState = await web3.account.getState({
  address: user0.address,
})
console.log(userState)

/* output: {
        "address": "a0r0ywzbgntvppvbqwrc6fgfz54f5zq1fme9579bd69j64gvk7f78nmwjm:sm2",
        "publickey": "S7dFGoY5TMydWP1+VuSG5+IpmVMv1jbbqwpBJDxIILtUlntfmrONqfPYZ+0GSbHZ4QlSQaUTcqKrPHWV2nqZTQ==",
        "status": "0",
        "userid": "new_test"
} */
register(p: RegsiterOption): Promise<boolean>
const registed = await web3.account.register({id: user0.id})

Overview

chainStatus(): Promise<DIOX.ChainStatus>
const status = await web3.overview.chainStatus()
console.log(status.Throughput) // output: 100.03
getTxHistory(params?: DIOXScanReq.History): Promise<TxSumList>

Get recently transactions on blockchain.

const list = await web3.overview.getTxHistory()
console.log(list)

Address

getISN(address: string): Promise<number>
const isn = await web3.address.getISN()
console.log(isn) // output: 8
getTxnListByAddress(params?: ListParmas): Promise<TxSumList>

Get the list of transactions related to the address (summary information).

const list = await web3.address.getTxnListByAddress({
  address: user0.address
})
getAddressState(data: { address: string; contract: string }): Promise<AddrBaseInfo>
const state = await web3.address.getAddressState({address: user0.address})
console.log(state)
getAddressInfo(address: string): Promise<DIOX.Address>
const profile = await web3.address.getAddressInfo({
  address: user0.address
})
console.log(profile)

Block

getHistory(params: { height: number; limit?: number, pos?: number; shardindex?: number}): Promise<DIOX.Block[] | undefined
const blockList = await web3.block.getHistory({"shardindex": 1})
console.log(blockList)
getExcutedTx(params: { height: number; limit?: number; pos?: number; shardindex?: number }): Promise<DIOX.ExcutedTx | undefined>
const tx = await web3.block.getExcutedTx({"height": 100})
console.log(tx)
detail(hash: string): Promise<DIOX.Block>
const detail = await web3.block.detail("mgthswczq1b3ycyvh5t3be01t4trayx4k7s7c09ad1natffhk0w0")
console.log(detail)

Transaction

getTx(hash: string): Promise<DIOX.TxDetail>
const detail = await web3.txn.getTx("a9cdzqythgtn8078ejhghb74f6s8x9k9v0rcn13azt1fp19wcftg")
cosnole.log(detail)
// output:
{
  "ISN": 2,
  "TTL": 1800000,
  "Hash": "a9cdzqythgtn8078ejhghb74f6s8x9k9v0rcn13azt1fp19wcftg",
  "Mode": "ITM_FIRST_SIGNER|TGM_USER_SIGNED",
  "Size": 181,
  ...
}
send(originTxn: OriginalTxn, secretKey: Uint8Array | string): Promise<string>

Send a transaction. The transaction will be constructed and signed locally using the private key, and the signed result will be broadcast to the blockchain. The private key will not be transmitted over the network.

export interface OriginalTxn {
  gasprice?: string | number
  sender?: string
  function: string
  args: KeyValue
  delegatee?: string | number
  gaslimit?: string | number
  tokens?: { [key: string]: string }[]
  ttl?: number
  scale?: number
}

const data = aawait web3.txn.send(user0.privatekey, {
  args: {
    Amount: '200000000',
    To: user1.address
  },
  function: 'core.coin.transfer',
  gasprice: '100',
  sender: user0.address,
})

console.log(data) // output:  "5akjfknj9phq93r56kqygjcv3r1tpwm2gt82xex1z3nkrk4r509g"

Contract

deploy(privatekey: string | Uint8Array, params: DeployContractParams) : Promise<string>
interface DeployContractParams extends OriginalTxn {
  code: string[]
  cargs: string[]
  time?: number
  delegatee: string
}

const deployHash = await web3.contract.deploy(user.privatekey, {
  delegatee: dapp + ':dapp',
  code: [contract1],
  cargs: [''],
})
console.log('deploy =>', deployHash)
run(privatekey: string | Uint8Array, params: ExecContractParams) : Promise<string>
interface ExecContractParams {
  func: string
  args: any
  sender: string
}

const invokeHash = await web3.contract.run(user.privatekey, {
  sender: user.address,
  func: `${dapp}.ProofMe.new`,
  args: { key: 'a', content: 'b' },
})
console.log('run contract function =>', invokeHash)
abi(contractName: string): Promise<ContractFunction[]>

Retrive ABI for a contract.

export interface ContractFunction {
  name: string
  flag: string
  scope: string
  opcode: number
  signature: string
}


const abi = await web3.contract.abi(name)
console.log('abi =>', abi)

Type Declaration

see src/api/type.ts link