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

upowjs

v0.0.7

Published

A upowjs JavaScript library for interacting with the blockchain, designed specifically for uPow blockchain networks. This library provides functionalities for wallet management, transaction processing, and more.

Downloads

11

Readme

uPowjs

A upowjs JavaScript library for interacting with the blockchain, designed specifically for uPow blockchain networks. This library provides functionalities for wallet management, transaction processing, and more.

Installation

Install upowjs using npm:

npm install upowjs

Usage

Creating a Wallet

import { upowjs } from "upowjs";

async function createWallet() {
  try {
    const walletInfo = await upowjs.uPowKeys();
    console.log("Wallet created:", walletInfo);
  } catch (error) {
    console.error("Error during wallet creation:", error.message);
  }
}

createWallet();

Sending a Transaction

import { upowjs } from "upowjs";

const KEY = "your_private_key_here";
const TO = "recipient_wallet_address";
const AMOUNT = "amount_to_send";
const ENDPOINT = "https://api.upow.ai/";

async function sendTransaction() {
  const myWallet = new upowjs.Wallet(KEY, ENDPOINT);
  try {
    const transactionInfo = await upowjs.sendTransaction(myWallet, TO, AMOUNT);
    console.log("Transaction successful:", transactionInfo);
  } catch (error) {
    console.error("Error during transaction:", error.message);
  }
}

sendTransaction();

Stake uPow coins

import { upowjs } from "upowjs";

async function stakeTransactionPush() {
  const endpoint = ENDPOINT;
  const myWallet = new upowjs.Wallet(KEY, endpoint);

  try {
    const info = await upowjs.stakeTransaction(myWallet, AMOUNT);
    console.log("Transaction successful:", info);
  } catch (error) {
    console.error("Error during transaction:", error.message);
  }
}

stakeTransactionPush();

unStake uPow coins

import { upowjs } from "upowjs";

async function unstakeTransactionPush() {
  const endpoint = ENDPOINT;
  const myWallet = new upowjs.Wallet(KEY, endpoint);

  try {
    const info = await upowjs.unStakeTransaction(myWallet);
    console.log("Transaction successful:", info);
  } catch (error) {
    console.error("Error during transaction:", error.message);
  }
}

unstakeTransactionPush();

Register as a iNode

import { upowjs } from "upowjs";

async function registerInodeTransactionPush() {
  const endpoint = ENDPOINT;
  const myWallet = new upowjs.Wallet(KEY, endpoint);

  try {
    const info = await upowjs.registerInodeTransaction(myWallet);
    console.log("Transaction successful:", info);
  } catch (error) {
    console.error("Error during transaction:", error.message);
  }
}

registerInodeTransactionPush();

deRegister as a iNode

import { upowjs } from "upowjs";

async function deRegisterInodeTransactionPush() {
  const endpoint = ENDPOINT;
  const myWallet = new upowjs.Wallet(KEY, endpoint);

  try {
    const info = await upowjs.deRegisterInodeTransaction(myWallet);
    console.log("Transaction successful:", info);
  } catch (error) {
    console.error("Error during transaction:", error.message);
  }
}

deRegisterInodeTransactionPush();

Register as a validator

import { upowjs } from "upowjs";

async function registerValidatorTransactionPush() {
  const endpoint = ENDPOINT;
  const myWallet = new upowjs.Wallet(KEY, endpoint);

  try {
    const info = await upowjs.registerValidatorTransaction(myWallet);
    console.log("Transaction successful:", info);
  } catch (error) {
    console.error("Error during transaction:", error.message);
  }
}

registerValidatorTransactionPush();

Vote

import { upowjs } from "upowjs";

async function voteTransactionPush() {
  const endpoint = ENDPOINT;
  const myWallet = new upowjs.Wallet(KEY, endpoint);

  try {
    const info = await upowjs.voteTransaction(myWallet, VOTING_RANGE, VOTE_TO);
    console.log("Transaction successful:", info);
  } catch (error) {
    console.error("Error during transaction:", error.message);
  }
}

voteTransactionPush();

Revoke vote

import { upowjs } from "upowjs";

async function revokeTransactionPush() {
  const endpoint = ENDPOINT;
  const myWallet = new upowjs.Wallet(KEY, endpoint);

  try {
    const info = await upowjs.revokeTransaction(myWallet, REVOKE_FROM);
    console.log("Transaction successful:", info);
  } catch (error) {
    console.error("Error during transaction:", error.message);
  }
}

revokeTransactionPush();

Get user balance

import { upowjs } from "upowjs";

async function checkUserBalance() {
  const endpoint = ENDPOINT;
  const myWallet = new upowjs.Wallet(KEY, endpoint);

  try {
    const bal = await upowjs.uPowBalance(myWallet, WALLET);
    console.log("Balance:", bal);
  } catch (error) {
    console.error("Error during transaction:", error.message);
  }
}

checkUserBalance();

Get tx hash

import { upowjs } from "upowjs";

async function checkTx() {
  const endpoint = ENDPOINT;
  const myWallet = new upowjs.Wallet(KEY, endpoint);

  try {
    const txhash = await upowjs.uPowTxHash(myWallet, txhashval);
    console.log(JSON.stringify(txhash, null, 2));
  } catch (error) {
    console.error("Error during transaction:", error.message);
  }
}

checkTx();

Get address

import { upowjs } from "upowjs";

async function getAddress() {
  const endpoint = ENDPOINT;
  const myWallet = new upowjs.Wallet(KEY, endpoint);

  try {
    const address = await upowjs.uPowGetAdress(myWallet);
    console.log(address);
  } catch (error) {
    console.error("Error during transaction:", error.message);
  }
}

getAddress();

Contributing

Contributions are welcome! Please feel free to submit a pull request or open an issue.

License

This project is licensed under the MIT License - see the LICENSE file for details.