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

@dusk-network/dusk-wallet-js

v0.5.3

Published

JS library for interacting with the dusk network

Downloads

13

Readme

dusk-wallet-js

JavaScript library for rusk-wallet

This will be later grafted into js-utils repo

Guide to use

Bundling

➜ deno task build

This will create a dist/wallet.js which can be used on the frontend side

[!IMPORTANT] The env var WALLET_CORE_PATH needs to be set before building the library, the env var points to the web assembly wallet-core the dusk-wallet-js library will use. To compile one on your machine, build https://github.com/dusk-network/wallet-core and use the .wasm

Usage

example/index.html

<script type="module">
  import { Wallet } from "../dist/wallet.js";
  const initWasm = async () => {
    // load a wallet wasm
    const { instance } = await WebAssembly.instantiateStreaming(
      fetch("../assets/dusk-wallet-core-0.21.0.wasm"),
    );

    let wasm = instance.exports;
    // Default wallet seed
    let seed = [
      153, 16, 102, 99, 133, 196, 55, 237, 42, 2, 163, 116, 233, 89, 10, 115,
      19, 81, 140, 31, 38, 81, 10, 46, 118, 112, 151, 244, 145, 90, 145, 168,
      214, 242, 68, 123, 116, 76, 223, 56, 200, 60, 188, 217, 34, 113, 55, 172,
      27, 255, 184, 55, 143, 233, 109, 20, 137, 34, 20, 196, 252, 117, 221, 221,
    ];
    let wallet = new Wallet(wasm, seed);
    // get the 21 psks that belongs to the wallet
    let psks = wallet.getPsks();
    // sync the wallet using IndexedDB, everything is managed internally
    let sync = await wallet.sync();
    // get balance for the first public spend key
    let balance = await wallet.getBalance(psks[0]);
  };

  document.addEventListener("DOMContentLoaded", function (event) {
    initWasm().catch((e) => console.error(e));
  });
</script>

Running the example

➜ deno task buildServe

Then go to 127.0.0.1:8000/example/index.html

NOTE: if you go to localhost/example/index.html then you will get a CORS error

Usage Documentation

Check the wiki on detailed usage guide

@ API Documentation Check the github pages generated jsdoc

Testing

Docker

docker run --name rusk -p 9000:9000/udp -p 8080:8080/tcp -v ./genesis.toml:/opt/rusk/state.toml dusknetwork/node:latest

Make sure you have the node running with the following genesis.toml file for deno task test

[acl.stake]
owners = [
    'oCqYsUMRqpRn2kSabH52Gt6FQCwH5JXj5MtRdYVtjMSJ73AFvdbPf98p3gz98fQwNy9ZBiDem6m9BivzURKFSKLYWP3N9JahSPZs9PnZ996P18rTGAjQTNFsxtbrKx79yWu',
]
allowlist = [
    'oCqYsUMRqpRn2kSabH52Gt6FQCwH5JXj5MtRdYVtjMSJ73AFvdbPf98p3gz98fQwNy9ZBiDem6m9BivzURKFSKLYWP3N9JahSPZs9PnZ996P18rTGAjQTNFsxtbrKx79yWu',
    'ocXXBAafr7xFqQTpC1vfdSYdHMXerbPCED2apyUVpLjkuycsizDxwA6b9D7UW91kG58PFKqm9U9NmY9VSwufUFL5rVRSnFSYxbiKK658TF6XjHsHGBzavFJcxAzjjBRM4eF'
]

[[balance]]
address = '4ZH3oyfTuMHyWD1Rp4e7QKp5yK6wLrWvxHneufAiYBAjvereFvfjtDvTbBcZN5ZCsaoMo49s1LKPTwGpowik6QJG'
seed = 0xdead_beef
notes = [100_000_000_000_000]

[[stake]]
address = 'oCqYsUMRqpRn2kSabH52Gt6FQCwH5JXj5MtRdYVtjMSJ73AFvdbPf98p3gz98fQwNy9ZBiDem6m9BivzURKFSKLYWP3N9JahSPZs9PnZ996P18rTGAjQTNFsxtbrKx79yWu'
amount = 1_000_000_000_000

And then run

deno task test