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

myvetools

v1.4.1

Published

Tools for interacting with VeChainThor

Downloads

83

Readme

MyVeTools

Tools for operating VeChain Thor.

Installation

npm i myvetools

Management of Solidity Compiler

To download a particular Solidity compiler version

node_modules/.bin/solcver -d <VERSION>

To use a downloaded compiler version

node_modules/.bin/solcver -u <VERSION>

Usage

CMD Tools

To create a template TS file for testing smart contracts

node_modules/.bin/mvt -c <FileName>

Package builtin

This package defines the deployed addresses and ABIs of the built-in smart contracts.

To get ABI of function energy from contract Prototype:

const abi = getBuiltinABI('prototype', 'energy', 'function')

You can import soloAccounts to get the 10 default accounts in the solo mode of the thor client >=1.5.0.

Package utils

To get ABI:

const abi = JSON.parse(
	compileContract(solFilePath, contractName, 'abi')
)

To get bytecode:

const bytecode = compileContract(solFilePath, contractName, 'bytecode')

To get a function ABI:

const abiFunc = getABI(abiContract, funcName, 'function')

Check test/utils.test.ts for more examples.

Package connexUtils

This package defines functions that interact directly with a Thor network. It includes functions:

  • deployContract - to deploy a smart contract
  • contractCallWithTx - to call a contract function that changes the contract storage
  • contractCall - to call a contract function that does not change the contract storage
  • getReceipt - to get the receipt of a transaction
  • decodeEvent - to decode a logged event

See test/connexUitls.test.ts for examples.

Package contract

This package is designed to make it easier to operate a contract.

To create a Contract instance:

const c = new Contract({abi: contractABI})

To deploy the contract:

// Set bytecode
c.bytecode(bin)

// Assume that the constructor is of no inputs and doesn't need transfer any value. Method deploy generates the clause for deploying the contract.
const clause = c.deploy(0)

// Construct and send the transaction. Here `connex` is an instance that implements the Connex interface.
const output = await connex.vendor.sign('tx', [clause]).request()

To send a transaction to call function set(uint256):

// Set deployed contract address
c.at(deployedContractAddress)

// Method send generates the clause that calls the function
const clause = c.send('set', 0, newValue)

// Construct and send the transaction.
const output = await connex.vendor.sign('tx', [clause]).request()

To call function get:

c.connex(connex)

const output = await c.call('get')

See test/contract.test.ts for more examples.

Test

To test package connexUtils, you will have to run the Thor client in the solo mode.