seeleteam.js
Version:
Generic script api library for Seele blockchain
37 lines (29 loc) • 928 B
JavaScript
class BaseContract{
constructor(host){
this.host = host
}
init(jsonABI,contractAddress){
if(!jsonABI || !(Array.isArray(jsonABI))) {
throw new Error('You must provide the json abi of the contract.');
}
this.jsonABI = jsonABI
this.contractAddress = contractAddress
var bc = BaseContract.prototype
return this
}
}
/**
* Should be used to create full function/event name from json abi
*
* @method _jsonInterfaceMethodToString
* @param {Object} json
* @return {String} full function/event name
*/
var _jsonInterfaceMethodToString = function (json) {
if (_.isObject(json) && json.name && json.name.indexOf('(') !== -1) {
return json.name;
}
return json.name + '(' + _flattenTypes(false, json.inputs).join(',') + ')';
};
module.exports = BaseContract