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

nahmii-contract-abstractions-ropsten

v3.2.4

Published

Smart contract abstractions for nahmii deployed to Ropsten

Downloads

272

Readme

NAHMII CONTRACT ABSTRACTIONS

About the contract abstractions

This package hosts contract abstractions generated from the deployment of nahmii contracts to the Ropsten Ethereum testnet.

About nahmii

nahmii is hubii's scaling solution for the Ethereum block chain. It is a hybrid centralized/decentralized solution that enables instant (micro-) payments, trading and trustless settlements.

About hubii

See www.hubii.com for more information.

Prerequisites

  • To use this software you need a modern version of NodeJS and NPM. We recommend having the current LTS version (v8.x) installed, or later, and updating NPM to the latest available version.
  • You will also need an API key for access to hubii's APIs.

Installation

To install the SDK into your project, simply run:

npm install nahmii-contract-abstractions-ropsten

Contract abstractions

The package includes directory build/contracts that contains the actual contract abstractions.

Symlinks

In a dependent project it will often be more convenient to have the abstractions available in its own build/contracts directory rather than having to refer to the lengthy node_modules/nahmii-contract-abstractions-ropsten/build/contracts.

The package contains scripts to symlink its build/contracts to ../../build/contracts. In order to run the script you may run

npm run symlink:build

Alternatively a call to

npm run symlink:build:force

will also delete previously existent ../../build/contracts as seen from the package directory (node_modules/nahmii-contract-abstractions-ropsten).

Usage in Node.js context

The contract abstractions may be required into Node.js scripts and used in contexts of web3, ethers or Truffle.

Assuming the above symlink has been carried out a simple script may be as follows:

const ClientFundAbstn = require('./build/contracts/ClientFund.json'); 

console.log(ClientFundAbstn.networks[1].address);
// 0xcc8d82f6ba952966e63001c7b320eef2ae729099

console.log(ClientFundAbstn.abi);
// [ { constant: false,
//     inputs: [ [Object] ],
//     name: 'authorizeRegisteredService',
//     outputs: [],
//     payable: false,
//     stateMutability: 'nonpayable',
//     type: 'function' },
//   { constant: true,
//     inputs: [ [Object] ],
//     name: 'isRegisteredBeneficiary',
// ...

If no symlink has been done a contract abstraction may rather be required as

const abstractions = require('nahmii-contract-abstractions-ropsten');

console.log(abstractions.getAbstraction('ClientFund'));
// { contractName: 'ClientFund',
//   abi:
//    [ { constant: false,
//        inputs: [Array],
//        name: 'authorizeRegisteredService',
//        outputs: [],
//        payable: false,
//        stateMutability: 'nonpayable',
//        type: 'function' },
// ...

The full set of names of contract abstractions may be obtained as

console.log(abtractions.getAbstractionNames());
// [ 'BalanceTracker',
//   'BlockNumbCurrenciesLib',
//   'BlockNumbDisdIntsLib',
//   'BlockNumbIntsLib',
//   'BlockNumbUintsLib',
//   'ClientFund',
//   'Configuration',
// ...

Event samples

The package also includes directory events containing samples of events emitted from contracts. There is one JSON file per contract.

Symlinks

Similar to contract abstractions the package contains scripts to symlink its events to ../../events in a dependent project. In order to run the script you may run

npm run symlink:events

or

npm run symlink:events:force

The latter will delete previously existent ../../events as seen from the package directory (node_modules/nahmii-contract-abstractions-ropsten).

Usage in Node.js context

As with contract abstractions events may be required into a Node.js context by

const ClientFundEvents = require('./events/ClientFund.json');

if previous symlink has been carried out. Alternatively an event may be required as

const ReceiveEvent = require('nahmii-contract-abstractions-ropsten').getEvent('ClientFund', 'ReceiveEvent');