Git Product home page Git Product logo

contract-abstractions-manager's Introduction

CONTRACT ABSTRACTIONS MANAGER

About the contract abstractions manager

This package contains a thin manager of contract abstractions. It is used a.o. in npm packages nahmii-contract-abstractions and nahmii-contract-abstractions-ropsten hosting contract abstractions from the deployment of nahmii-contracts to the Ethereum mainnet and to Ropsten testnet, respectively.

Prerequisites

  • To use this software you need a modern version of NodeJS and NPM. We recommend having the current LTS version (v10.x) installed, or later, and updating NPM to the latest available version.

Installation

To install the SDK into your project, simply run:

npm install contract-abstractions-manager

Dummy data

The package includes dummy directories build/contracts and event that respectively contain the actual contract abstractions and recorded events from smart contract functions. Thus when a test manager is instantiated it uses these two directories for reading contract abstractions and event samples.

However, when the manager is imported into client project (e.g. nahmii-contract-abstractions) the manager instance is initialized with the client project's home directory as manager data root directory, one that contains build/contracts and event sub-directories.

Contract abstractions

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

A contract abstraction may be required as

const Manager = require('contract-abstractions-manager');

const manager = new Manager();

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

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

console.log(manager.getAbstractionNames());
// [ 'MyContractA',
//   'MyContractB',
//   'MyContractC',
// ...

Event samples

As with contract abstractions an event may be required as

const myEvent = manager.getEvent('MyContract', 'MyEvent');

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.