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

tupelo-wasm-sdk

v0.7.3

Published

The JavaScript SDK for interacting with the Tupelo network

Downloads

51

Readme

Tupelo Wasm SDK

Contributor Covenant

V2 of the tupelo-js-sdk is a standalone SDK that works with wasm to talk directly to the Tupelo network and does not require a rpc server.

Note: in the words of IPFS: this project is still in Alpha, lots of development is happening, API might change, beware of the Dragons 🐉.

See https://docs.quorumcontrol.com/ for an overview of Tupelo, the whitepaper, other SDKs, etc. For a high-level walkthrough see this video: https://youtu.be/4Oz03l9IQPc which uses the Tupelo ChainTree Explorer described below.

Examples

We have a comprehensive collection of examples in the examples/ directory, which should help you get up to speed quickly on various aspects of the SDK.

Tupelo ChainTree Explorer

We have made a main demo app based on the SDK, the Tupelo ChainTree Explorer. This lets you explore ChainTrees in the Tupelo testnet, and should be a great reference for learning how to use the Tupelo Wasm SDK in depth!

API

See: https://quorumcontrol.github.io/tupelo-wasm-sdk/docs/tupelo-wasm-sdk.html

Getting Started

The following snippet of code is all you need to send a transaction to our Testnet

const sdk = require('tupelo-wasm-sdk')

// setup a connection to the default community and Tupelo TestNet
const community = await sdk.Community.getDefault() 

// Generate a new public/private keypair
const key = await sdk.EcdsaKey.generate() 

// Create a new empty tree with the new keypair
const tree = await sdk.ChainTree.newEmptyTree(community.blockservice, key) 

// Play a transaction on the TestNet
let resp = await community.playTransactions(tree, [sdk.setDataTransaction("path", true)])

// Congrats on making a DLT transaction

You can also find ChainTrees by their DID and resolve data on them, easily:

const sdk = require('tupelo-wasm-sdk')

// setup a connection to the default community and Tupelo TestNet
const community = await sdk.Community.getDefault() 

const tip = await community.getTip("did:tupelo:0x5bD5b0Ad2d9e73a07E410f32F5C865B231cce62F")

const tree = new sdk.ChainTree({
   store: community.blockservice,
   tip: tip,
})

const {remaining,value} = await tree.resolve("tree/data/path")

// remaining = []
// value = true

Path to Wasm

By default the wasm is loaded from the tupelo.wasm included in the npm package of this repo (src/js/go/tupelo.wasm) for node and from /tupelo.wasm (from the root of the server) in the browser. This is customizable by calling Go.setWasmPath() with wherever is better for your app.

Building

In order to build this project, you first of all need to get the Git submodules:

$ git submodule update --init --recursive

Then install the dependencies and use the NPM 'build' script:

$ npm install
$ npm run build

Running the tests

To run the full test suite, simlpy run npm run test-suite.

In development, you may want to run a long lived tupelo network and run tests adhoc.

To do this, first run: docker-compose run -d tupelo

Tests can now be run many times against that same network with: docker-compose run tester

Once finished, make sure to cleanup your local tupelo network: docker-compose down --remove-orphans -v