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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@libotony/sharp

v1.0.0-beta.2

Published

Contract test utility

Downloads

2

Readme

Sharp

Experimental contract test utility package - just as elegant as Connex.

With VeChain-Enhanced VMOutput, you will be able to inspect more elements of a contract call than before

Features

  • ContractMeta - manages contract bytecode and ABI
  • Awaiter - wait tx to be packed
  • Assertion - assert as much as you can image(event log, transfer log, method output)

Get Started

Sharp Example Project, a project shows a step by step guide of using sharp.

API

import { ContractMeta, Awaiter, Assertion } from 'sharp'

Contract Meta

const bytecode = '0x.....'
const abiJSON = [...]

const contract = new ContractMeta(abiJSON, bytecode)

//Get the bytecode
console.log(contract.Code)

//Search the abi definition
const abi = contract.ABI('balanceOf', 'function')
const transferEvent = contract.ABI('Transfer', 'event')

//Build the deploy clause
const clause = contract
    .deploy()
    .value(100)             //100wei as endowment for contract creation
    .asClause(arg0, arg1)   //args for constructor

//Work with connex
const method = connex.thor.account(address).method(contract.ABI('balanceOf'))
const output = await method.call(accountA) //query the balance of the account

console.log(output)

Awaiter

//Wait until transaction was packed to the chain
const receipt = await Awaiter.receipt(thor.transaction(txid), thor.ticker())

Assertion

const accountA = '0x...'
const accountB = '0x...'
const amount = new BigNumber('1000000').times(1e18)

//Ensure transfer VET emits an transfer log
const receipt: Connex.Thor.Receipt = await connex.thor.transaction(txid).getReceipt()

Assertion
    .transfer()
    .logs(accountA, accountB, amount.toString())
    .equal(receipt.outputs[0].transfers[0])

//Ensure transfer energy emits an transfer event log
const method = connex.thor.account(address).method(contract.ABI('transfer'))
const output: Connex.Thor.VMOutput = method
    .caller(accountA)
    .call(accountB, amount.toString())

Assertion
    .event(contract.ABI('Transfer', 'event'))
    .by(address)
    .logs(accountA, accountB, amount.toString())
    .equal(ret.outputs[0].events[0])

//Ensure balanceOf method outputs the token balance
const method = connex.thor.account(address).method(contract.ABI('balanceOf'))
const output: Connex.Thor.VMOutput = method.call(accountB)

Assertion
    .method(contract.ABI('balanceOf'))
    .outputs(amount.toString())
    .equal(ret)

//Ensure contract reverted with message
const output: Connex.Thor.VMOutput = method.call()

Assertion
    .revert()
    .with('Must have set allowance for this contract')
    .equal(output)