Skip to content

Commit

Permalink
Merge pull request trufflesuite#76 from kingcocomango/txid_network
Browse files Browse the repository at this point in the history
Tracking tx-id per network, with accessors
  • Loading branch information
cgewecke authored Feb 16, 2018
2 parents 64328b7 + aa8182c commit d0bf9a9
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions packages/truffle-contract/contract.js
Original file line number Diff line number Diff line change
Expand Up @@ -768,6 +768,23 @@ var contract = (function(module) {
this.network.address = val;
}
},
transactionHash: {
get: function() {
var transactionHash = this.network.transactionHash;

if(transactionHash === null) {
throw new Error(`Could not find transaction hash for ${this.contractName}`);
}

return transactionHash;
},
set: function(val) {
if(val === null) {
throw new Error(`Could not set \`${val}\` as the transaction hash for ${this.contractName}`);
}
this.network.transactionHash = val;
}
},
links: function() {
if (!this.network_id) {
throw new Error(this.contractName + " has no network id set, cannot lookup artifact data. Either set the network manually using " + this.contractName + ".setNetwork(), run " + this.contractName + ".detectNetwork(), or use new(), at() or deployed() as a thenable which will detect the network automatically.");
Expand Down

0 comments on commit d0bf9a9

Please sign in to comment.