Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
d2563466
Commit
d2563466
authored
Jul 08, 2015
by
Jeffrey Wilcke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
web3: updated
parent
819ecd45
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
10 deletions
+22
-10
ethereum_js.go
jsre/ethereum_js.go
+22
-10
No files found.
jsre/ethereum_js.go
View file @
d2563466
...
...
@@ -1417,7 +1417,7 @@ module.exports = {
},{"bignumber.js":"bignumber.js"}],8:[function(require,module,exports){
module.exports={
"version": "0.8.
0
"
"version": "0.8.
1
"
}
},{}],9:[function(require,module,exports){
...
...
@@ -1840,14 +1840,14 @@ var contract = function (abi) {
};
/**
* Should be called to c
reate new ContractFactory
* Should be called to c
heck if the contract gets properly deployed on the blockchain.
*
* @method checkForContractAddress
* @param {Object} contract
* @param {Function} callback
* @returns {Undefined}
*/
var checkForContractAddress = function(contract, callback){
var checkForContractAddress = function(contract,
abi,
callback){
var count = 0;
// wait for receipt
...
...
@@ -1855,6 +1855,8 @@ var checkForContractAddress = function(contract, callback){
if(!e) {
count++;
// console.log('Checking for contract address', count);
// stop watching after 50 blocks (timeout)
if(count > 50) {
if(callback)
...
...
@@ -1870,8 +1872,14 @@ var checkForContractAddress = function(contract, callback){
web3.eth.getCode(receipt.contractAddress, function(e, code){
if(code.length > 2) {
// console.log('Contract code deployed!');
contract.address = receipt.contractAddress;
// attach events and methods
addFunctionsToContract(contract, abi);
addEventsToContract(contract, abi);
if(callback)
callback(null, contract);
...
...
@@ -1909,6 +1917,7 @@ var ContractFactory = function (abi) {
* @returns {Contract} returns contract instance
*/
ContractFactory.prototype.new = function () {
var _this = this;
var contract = new Contract(this.abi);
// parse arguments
...
...
@@ -1940,14 +1949,14 @@ ContractFactory.prototype.new = function () {
} else {
// add the transaction hash
contract.transactionHash = hash;
checkForContractAddress(contract, callback);
checkForContractAddress(contract,
_this.abi,
callback);
}
});
} else {
var hash = web3.eth.sendTransaction(options);
// add the transaction hash
contract.transactionHash = hash;
checkForContractAddress(contract);
checkForContractAddress(contract
, _this.abi
);
}
return contract;
...
...
@@ -1963,12 +1972,17 @@ ContractFactory.prototype.new = function () {
* otherwise calls callback function (err, contract)
*/
ContractFactory.prototype.at = function (address, callback) {
var contract = new Contract(this.abi, address);
// TODO: address is required
// attach functions
addFunctionsToContract(contract, this.abi);
addEventsToContract(contract, this.abi);
if (callback) {
callback(null,
new Contract(this.abi, address)
);
callback(null,
contract
);
}
return
new Contract(this.abi, address)
;
return
contract
;
};
/**
...
...
@@ -1980,8 +1994,6 @@ ContractFactory.prototype.at = function (address, callback) {
*/
var Contract = function (abi, address) {
this.address = address;
addFunctionsToContract(this, abi);
addEventsToContract(this, abi);
};
module.exports = contract;
...
...
@@ -2484,8 +2496,8 @@ SolidityEvent.prototype.encode = function (indexed, options) {
result.topics = [];
result.address = this._address;
if (!this._anonymous) {
result.address = this._address;
result.topics.push('0x' + this.signature());
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment