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

provenance-nodejs

v2.0.2

Published

This is a nodejs package for provenance blockchain. It is a wrapper around the cosmos sdk. It is written in typescript and can be used in any nodejs project. It is a work in progress and will be updated regularly.

Downloads

16

Readme

Provenance package for nodejs devolopers

This is a nodejs package for provenance blockchain. It is a wrapper around the cosmos sdk. It is written in typescript and can be used in any nodejs project. It is a work in progress and will be updated regularly.

This npm package makes it easier to create provenance wallet,create transactions or send hash tokens to other wallets. It also makes it easier to create and sign transactions and broadcast them to the blockchain. It also makes it easier to query the blockchain for data.

docs: https://github.com/KwobiaMtech/provenance-nodejs

Let's get started!


npm i provenance-nodejs

yarn add provenance-nodejs

For type script you can import the package as shown below:

import { client } from "provenance-nodejs";

For javascript you can import the package as shown below:

const { client } = require("provenance-nodejs");

To initiate Provenance client you can use you can instantiate it with the init function:

const provenance = await client.Provenance.init();

By default transaction environment is set to TEST_NET. To change the transaction environment you can set the environment as shown below:

provenance.environment = "MAIN_NET";

To create a wallet you can use the createWallet function as shown below:

const wallet = provenance.createWallet();

Successful wallet creation should give below response

{
  "privateKey": "be7441dfe414c3abffb224a2ebeca57fbc17c929942b59d795d9",
  "address": "tp1klrru0tp2ue79mjnsaur32afmv32lasfasdfd68uatm9y",
  "publicKey": "02f0c3bbf8dc3899553fd8e8fa71fed59eb8389404b4c51b80cd",
  "mnemonicPhrase": "james scissors venue guitar naive hidden abandon spot snow luggage lock akon"
}

You can also check wallet balance using the getBalance function as shown below:

const balance = await provenance.getBalance(wallet.address);

Successful balance check should give below response

{
  "denom": "nhash",
  "amount": "1000000000000000000"
}

You can also send token to another wallet using the Create Transaction function as shown below:Transaction amount is in hash not nhash

const transaction = await provenance.createTransaction(
  senderAddress,
  receiverAddress,
  mneumonic,
  1
);

Transaction response should be as shown below:

{
  "gasUsed": 106362,
  "gasWanted": 131339,
  "transactionHash": "FED9E5A6AE8B3904A0DA845BEC86AFA56072D35D0689E2AAE0F41F72B83E6562"
}

To get transaction details from transaction hash or transaction ID you can use the getTransaction function as shown below:

const transactionDetails = await provenance.getTransactionDetails(
  transactionHash
);

Successful transaction response will give below json

{
  "senderAddress": "tp1rxrgg3j43nucq2phgjwccmz23n3a0kya9adasdfasd",
  "receiverAddress": "tp1pxg6vf32jt32qmtd9kg4yskf5sdfasdf",
  "tokenMintAddress": "nhash",
  "amount": 1
}