This code is now archived and dangerous, eval() should not be used without sanitisation or consideration of the caller.
Interact with smart contracts easily in JavaScript using web3.js.
npm install ethesciconst ERC721 = require("ethesci").erc721
// initialize the contract
var contract = new ERC721(network_url, abi_json, contract_address)
// create contract function call
var contractCall = contract.contractCall(function_name, arguments)
// call the contract function
let output = await contractCall.call()
console.log(output)
// the ERC721 template includes custom functions such as getTokens(owner_address)
var tokens = contract.getTokens(owner_address)
console.log(tokens)
/*
[
{
"tokenId": "unint265",
"tokenURI": "string"
}
]
*/const Contract = require("ethesci").default
var contract = new Contract(network_url, abi_json, contract_address)
var contractCall = contract.contractCall(function_name, arguments)
let output = await contractCall.call()
console.log(output)