web3-api
TypeScript icon, indicating that this package has built-in type declarations

1.0.9 • Public • Published

Introduction

This package was created in the course of the diploma thesis at the HTBLA Perg. It is designed to work with a Smart Contract not publicly avialable. Web3.js is used for the communication to the Smart Contract.

Installation

npm install web3-api

Usage with TypeScript

import * as web3 from "web3-api";
import { web3Api } from "web3-api";

let chain:web3Api = web3.init(fs.readFileSync("abi.json", 'utf8'), contractAddress, BlockchainUrl);

The init() function creates a new web3Api object and returns it. contractAddress is the unique Address of the Contract on the Blockchain and BlockchainUrl is the url on which the blockchain is available. abi.json is the abi of the Smart Contract created in the course of the diploma thesis.

Once the Object is created, the functions can be used like this:

import * as web3 from "web3-api";
import { web3Api } from "web3-api";

let chain:web3Api = web3.init(fs.readFileSync("abi.json", 'utf8'), contractAddress, BlockchainUrl);

newEvent();

async function newEvent() {
    let result = await chain.newEvent(UserAddress);
    console.log(result);
    return result;
}

Readme

Keywords

none

Package Sidebar

Install

npm i web3-api

Weekly Downloads

2

Version

1.0.9

License

ISC

Unpacked Size

21.8 kB

Total Files

6

Last publish

Collaborators

  • xxanonymxx