tronbox
Version:
TronBox - Simple development framework for Tron
1 lines • 948 B
JavaScript
;var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");var _typeof2=_interopRequireDefault(require("@babel/runtime/helpers/typeof"));module.exports={link:function link(library,destinations,logger){logger=logger||console;if(!Array.isArray(destinations)){destinations=[destinations]}if(!library.contract_name){throw new Error("Cannot link a library with no name.")}var hasAddress=false;if((0,_typeof2["default"])(library.isDeployed)){hasAddress=library.isDeployed()}else{hasAddress=library.address}if(!hasAddress){throw new Error("Cannot link library: "+library.contract_name+" has no address. Has it been deployed?")}destinations.forEach(function(destination){if(destination.links[library.contract_name]===library.address)return;if(destination.unlinked_binary.indexOf(library.contract_name)<0)return;logger.log("Linking "+library.contract_name+" to "+destination.contract_name);destination.link(library)})}};