Skip to content

Latest commit

 

History

History
30 lines (20 loc) · 1.03 KB

README.md

File metadata and controls

30 lines (20 loc) · 1.03 KB

Javascript Contract Library

Example javascript library which can be used to communicate with the Ethereum network via localnode, metamask or custom node URL.

  1. Include script files web.min.js and contractInterface.js in HTML file.

  2. Call the ContractInterface contract function with the solidity-contract-function-name and arguments array.

        const contractInterface = new ContractInterface();
        
        contractInterface.contract('solidity_function_name', []).then((res) => {
            console.log(res);
        }, (err) => {
            console.log(err);
        });
        
        contractInterface.contract('solidity_function_name', ['one', 'two']).then((res) => {
            console.log(res);
        }, (err) => {
            console.log(err);
        });
    

*Note: In contractInterface.js change the contractAddress to your deployed contract address and abiAddress to your abi.json file location.

Libraries Used:

Web3.js