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

cwao-units

v0.3.4

Published

`cwao-units` runs [AO compatible units](https://ao.arweave.dev/#/spec) for CosmWasm.

Downloads

315

Readme

CosmWasm AO Units

cwao-units runs AO compatible units for CosmWasm.

  • [MU] Messanger Unit
  • [SU] Scheduler Unit
  • [CU] Compute Unit

Installation

yarn add cwao-units

Messanger Unit

const { MU } = require("cwao-utils")
const mu = new MU({ port, wallet, arweave, graphql, protocol, variant, cu })

Scheduler Unit

const { SU } = require("cwao-utils")
const su = new MU({ port, wallet, arweave, graphql, protocol, variant })

Compute Unit

const { CU } = require("cwao-utils")
const cu = new CU({ port, wallet, arweave, graphql, protocol, variant })

Default Values

  • protocol : ao
  • variant : ao.TN.1
  • graphql : http://localhost:1984/graphql
  • mu : http://localhost:1985
  • su : http://localhost:1986
  • cu : http://localhost:1987
  • arweave : { host: "localhost", port: 1984, protocol: "http" }
  • port : MU = 1985 : SU = 1986 : CU = 1987

Example Script

const ArLocal = require("arlocal").default
const Arweave = require("arweave")
const { MU, SU, CU } = require("cwao-units")

const { readFileSync, writeFileSync, mkdirSync, existsSync } = require("fs")
const { resolve } = require("path")

const mkdirs = async dirs => {
  for (let v of dirs) if (!existsSync(v)) mkdirSync(v)
}

const keygen = async (name, dir, arweave) => {
  const keyfile = resolve(dir, `${name}.json`)
  let wallet = null
  if (existsSync(keyfile)) {
    wallet = JSON.parse(readFileSync(keyfile, "utf8"))
    const addr = await arweave.wallets.jwkToAddress(wallet)
    console.log(`[${name}: ${addr}] already exists!`)
  } else {
    wallet = await arweave.wallets.generate()
    const addr = await arweave.wallets.jwkToAddress(wallet)
    await arweave.api.get(`mint/${addr}/10000000000000000`)
    console.log(`[${name}] Arweave account generated!`)
    console.log(addr)
    writeFileSync(keyfile, JSON.stringify(wallet))
  }
  return wallet
}

const start = async () => {

  await mkdirs([
    resolve(__dirname, "../.cwao"),
    resolve(__dirname, "../.cwao/accounts")
  ])
  
  const arweave = Arweave.init({ host: "localhost", port: 1984, protocol: "http" })
  const arLocal = new ArLocal(1984, false, resolve(__dirname, "../.cwao/db"), true)
  await arLocal.start()
  
  let wallets = {}
  for (const v of ["mu", "su", "cu"]) {
    wallets[v] = await keygen(v, dir)
    const addr = await arweave.wallets.jwkToAddress(wallets[v])
    await arweave.api.get(`mint/${addr}/10000000000000000`)
  }

  const mu = new MU({ wallet: wallets.mu })
  const su = new SU({ wallet: wallets.su })
  const cu = new CU({ wallet: wallets.cu })
  
  return  async () => {
    await arLocal.stop()
    mu.stop()
    su.stop()
    cu.stop()
  }

}

const stop = start()