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

fx-sia-lib

v1.0.16

Published

Frontend and nodejs lib for siacoin functions

Downloads

47

Readme

sia-js

Frontend and nodejs lib for siacoin functions

Getting Started

Installation

This library is still highly experimental, and has not been published to a registry yet. For now, install in your project using:

npm install @dewebjs/sia-js

Usage

Import Lib

import Sia from '@dewebjs/sia-js';

Key Derivation

Generate secure random seed

var randomData = sia.keyPair.generateRandomData()

From Seed

var keyPair = Sia.keyPair.generateFromSeed('seed string');

From Private Key

var keyPair = Sia.keyPair.deriveAddress('cbfaced5375c679a1181be27b7530a1c77dcf6a2b2c0c14ac9c62ce5d7fdf5e6e60400f316b823195c6f4f996cfa04827499b2d3d48e0bf8b711a32c653f59a0');

Example response:

{
  address: '91948070704e646adb8ce40655df31e9a0a157cffaabd3776a67c6ebedb00c6e5144bb726fda',
  publicKey: 'e60400f316b823195c6f4f996cfa04827499b2d3d48e0bf8b711a32c653f59a0',
  privateKey: 'cbfaced5375c679a1181be27b7530a1c77dcf6a2b2c0c14ac9c62ce5d7fdf5e6e60400f316b823195c6f4f996cfa04827499b2d3d48e0bf8b711a32c653f59a0'
}

From string salt Key

var keyPair = Sia.keyPair.generateSaltString(); // salt can be provided as param, ex: Sia.keyPair.generateSaltString("BhQBb6Kc4iCN4RjQkUQuaRGStsBd8EnU");

Example response:

{
  address: "27423144bb1f2bd49d6299bed22c1ef605cccf7d585127d18cfd8ee0fe17709c2bf619eb4481",
  privateKey: "35835be1d3b696d4b730fa4f59a9defc0b3633d96c5cb274e16eecd6b6a7a6a1885df509adc99aeadc553cbd22496323a2cac6b728a9df579dcfeff97235aa45",
  publicKey: "885df509adc99aeadc553cbd22496323a2cac6b728a9df579dcfeff97235aa45",
  salt: "BhQBb6Kc4iCN4RjQkUQuaRGStsBd8EnU",
  seed: "launching onboard eight licks both swung tuxedo video twang hedgehog software dude scuba dazed dogs inundate enmity alpine prying hijack nimbly dove roomy bowling badge lakes went upkeep afloat"
}

Build Transaction (Siacoin transfer)

var transaction = Sia.transaction.encodeTransaction(inputs, fee, changeAddress, sendAmount, destinationAddress, privateKey, (transaction) => {
  // returns json object as an encoded transaction
  // send transaction using walrus endpoint (https://escher-walrus.libtechnologies.io/broadcast)
  // TODO Change domain to escher subdomain
})

Inputs

| Name | Type | Example | | ------------------- | ---------------- | ------------------------------------------------------------------------- | | inputs | Array | https://siastats.info:3500/navigator-api/unspent_outputs/changeAddress | | fee | Number (Siacoin) | 0.0001 (In Siacoins not hastings) | | changeAddress | String | Siacoin Address | | sendAmount | Number (Siacoin) | 10 (In Siacoins not hastings) | | destinationAddress | String | Siacoin Address | | privateKey | String | Siacoin Private Key |

Example response

{
  "siacoinInputs": [
    {
      "parentID": "b8c63a8f435bfff7bf8c1f6c7ece0066599fa4e08cb74ab5929e84b014e408c8",
      "unlockConditions": {
        "publicKeys": [ "ed25519:8408ad8d5e7f605995bdf9ab13e5c0d84fbe1fc610c141e0578c7d26d5cfee75" ],
        "signaturesRequired": 1
      }
    }
  ],
  "siacoinOutputs": [
    {
      "value": "10000000000000000000000000000",
      "unlockHash": "5ac6af95fe284b4bbb0110ef51d3c90f3e9ea37586352ec83bad569230bad7f37a452c0a2a2f"
    },
    {
      "value": "100000000000000000000000000000",
      "unlockHash": "df1b42c80b5f7a67331893fde0923a5071d6d7dff4c78baec547cf5ca4d314a1d78b6b1c8d42"
    }
  ],
  "minerFees": [ "13000000000000000000000000000" ],
  "transactionSignatures": [
    {
      "parentID": "b8c63a8f435bfff7bf8c1f6c7ece0066599fa4e08cb74ab5929e84b014e408c8",
      "publicKeyIndex": 0,
      "coveredFields": { "wholeTransaction": true },
      "signature": "rFtBFv9oeScpO3mhp6O2liMwBKYXn05SaOmzhhjQtIkOwAClaJTpLEKn3U26zYis2AG2tH2idWSJNZXNSVa8DQ=="
    }
  ]
}