Updted dist files.
This commit is contained in:
parent
b38a36b2f5
commit
b7fc74a99d
21
dist/ethers-contracts.js
vendored
21
dist/ethers-contracts.js
vendored
@ -247,6 +247,27 @@ function Contract(addressOrName, contractInterface, signerOrProvider) {
|
||||
log.removeListener = function() {
|
||||
provider.removeListener(eventInfo.topics, handleEvent);
|
||||
}
|
||||
|
||||
var poller = function(func, key) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
function poll() {
|
||||
provider[func](log[key]).then(function(value) {
|
||||
if (value == null) {
|
||||
setTimeout(poll, 1000);
|
||||
return;
|
||||
}
|
||||
resolve(value);
|
||||
}, function(error) {
|
||||
reject(error);
|
||||
});
|
||||
}
|
||||
poll();
|
||||
});
|
||||
}
|
||||
|
||||
log.getBlock = function() { return poller('getBlock', 'blockHash'); }
|
||||
log.getTransaction = function() { return poller('getTransaction', 'transactionHash'); }
|
||||
log.getTransactionReceipt = function() { return poller('getTransactionReceipt', 'transactionHash'); }
|
||||
log.eventSignature = eventInfo.signature;
|
||||
|
||||
eventCallback.apply(log, Array.prototype.slice.call(result));
|
||||
|
6
dist/ethers-contracts.min.js
vendored
6
dist/ethers-contracts.min.js
vendored
File diff suppressed because one or more lines are too long
124
dist/ethers-providers.js
vendored
124
dist/ethers-providers.js
vendored
@ -5005,6 +5005,14 @@ utils.defineProperty(EtherscanProvider.prototype, 'perform', function(method, pa
|
||||
url += apiKey;
|
||||
return Provider.fetchJSON(url, null, getResult);
|
||||
|
||||
case 'getEtherPrice':
|
||||
if (this.name !== 'homestead') { return Promise.resolve(0.0); }
|
||||
url += '/api?module=stats&action=ethprice';
|
||||
url += apiKey;
|
||||
return Provider.fetchJSON(url, null, getResult).then(function(result) {
|
||||
return parseFloat(result.ethusd);
|
||||
});
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -5012,6 +5020,38 @@ utils.defineProperty(EtherscanProvider.prototype, 'perform', function(method, pa
|
||||
return Promise.reject(new Error('not implemented - ' + method));
|
||||
});
|
||||
|
||||
utils.defineProperty(EtherscanProvider.prototype, 'getHistory', function(addressOrName, startBlock, endBlock) {
|
||||
|
||||
var url = this.baseUrl;
|
||||
|
||||
var apiKey = '';
|
||||
if (this.apiKey) { apiKey += '&apikey=' + this.apiKey; }
|
||||
|
||||
if (startBlock == null) { startBlock = 0; }
|
||||
if (endBlock == null) { endBlock = 99999999; }
|
||||
|
||||
return this.resolveName(addressOrName).then(function(address) {
|
||||
url += '/api?module=account&action=txlist&address=' + address;
|
||||
url += '&fromBlock=' + startBlock;
|
||||
url += '&endBlock=' + endBlock;
|
||||
url += '&sort=asc';
|
||||
|
||||
return Provider.fetchJSON(url, null, getResult).then(function(result) {
|
||||
var output = [];
|
||||
result.forEach(function(tx) {
|
||||
['contractAddress', 'to'].forEach(function(key) {
|
||||
if (tx[key] == '') { delete tx[key]; }
|
||||
});
|
||||
if (tx.creates == null && tx.contractAddress != null) {
|
||||
tx.creates = tx.contractAddress;
|
||||
}
|
||||
output.push(Provider._formatters.checkTransactionResponse(tx));
|
||||
});
|
||||
return output;
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
module.exports = EtherscanProvider;;
|
||||
|
||||
},{"./provider.js":24,"ethers-utils/convert.js":6,"ethers-utils/properties.js":9}],19:[function(require,module,exports){
|
||||
@ -5160,6 +5200,13 @@ function InfuraProvider(network, apiAccessToken) {
|
||||
}
|
||||
JsonRpcProvider.inherits(InfuraProvider);
|
||||
|
||||
utils.defineProperty(InfuraProvider.prototype, '_startPending', function() {
|
||||
console.log('WARNING: INFURA does not support pending filters');
|
||||
});
|
||||
|
||||
utils.defineProperty(InfuraProvider.prototype, '_stopPending', function() {
|
||||
});
|
||||
|
||||
module.exports = InfuraProvider;
|
||||
|
||||
},{"./json-rpc-provider":22,"./provider":24,"ethers-utils/properties.js":9}],22:[function(require,module,exports){
|
||||
@ -5179,6 +5226,15 @@ var utils = (function() {
|
||||
}
|
||||
})();
|
||||
|
||||
// @TODO: Move this to utils
|
||||
function timer(timeout) {
|
||||
return new Promise(function(resolve) {
|
||||
setTimeout(function() {
|
||||
resolve();
|
||||
}, timeout);
|
||||
});
|
||||
}
|
||||
|
||||
function getResult(payload) {
|
||||
if (payload.error) {
|
||||
var error = new Error(payload.error.message);
|
||||
@ -5322,6 +5378,48 @@ utils.defineProperty(JsonRpcProvider.prototype, 'perform', function(method, para
|
||||
return Promise.reject(new Error('not implemented - ' + method));
|
||||
});
|
||||
|
||||
utils.defineProperty(JsonRpcProvider.prototype, '_startPending', function() {
|
||||
if (this._pendingFilter != null) { return; }
|
||||
var self = this;
|
||||
|
||||
var pendingFilter = this.send('eth_newPendingTransactionFilter', []);
|
||||
this._pendingFilter = pendingFilter;
|
||||
|
||||
pendingFilter.then(function(filterId) {
|
||||
function poll() {
|
||||
self.send('eth_getFilterChanges', [ filterId ]).then(function(hashes) {
|
||||
if (self._pendingFilter != pendingFilter) { return; }
|
||||
|
||||
var seq = Promise.resolve();
|
||||
hashes.forEach(function(hash) {
|
||||
seq = seq.then(function() {
|
||||
return self.getTransaction(hash).then(function(tx) {
|
||||
self.emit('pending', tx);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
return seq.then(function() {
|
||||
return timer(1000);
|
||||
});
|
||||
}).then(function() {
|
||||
if (self._pendingFilter != pendingFilter) {
|
||||
self.send('eth_uninstallFilter', [ filterIf ]);
|
||||
return;
|
||||
}
|
||||
setTimeout(function() { poll(); }, 0);
|
||||
});
|
||||
}
|
||||
poll();
|
||||
|
||||
return filterId;
|
||||
});
|
||||
});
|
||||
|
||||
utils.defineProperty(JsonRpcProvider.prototype, '_stopPending', function() {
|
||||
this._pendingFilter = null;
|
||||
});
|
||||
|
||||
module.exports = JsonRpcProvider;
|
||||
|
||||
},{"./provider.js":24,"ethers-utils/convert":6,"ethers-utils/properties":9}],23:[function(require,module,exports){
|
||||
@ -5586,7 +5684,6 @@ function checkTransaction(transaction) {
|
||||
}
|
||||
|
||||
if (!transaction.raw) {
|
||||
|
||||
// Very loose providers (e.g. TestRPC) don't provide a signature or raw
|
||||
if (transaction.v && transaction.r && transaction.s) {
|
||||
var raw = [
|
||||
@ -6305,6 +6402,9 @@ function getEventString(object) {
|
||||
if (object === 'block') {
|
||||
return 'block';
|
||||
|
||||
} else if (object === 'pending') {
|
||||
return 'pending';
|
||||
|
||||
} else if (utils.isHexString(object)) {
|
||||
if (object.length === 66) {
|
||||
return 'tx:' + object;
|
||||
@ -6332,6 +6432,9 @@ function parseEventString(string) {
|
||||
} else if (string === 'block') {
|
||||
return {type: 'block'};
|
||||
|
||||
} else if (string === 'pending') {
|
||||
return {type: 'pending'};
|
||||
|
||||
} else if (string.substring(0, 8) === 'address:') {
|
||||
return {type: 'address', address: string.substring(8)};
|
||||
|
||||
@ -6351,10 +6454,18 @@ function parseEventString(string) {
|
||||
throw new Error('invalid event string');
|
||||
}
|
||||
|
||||
utils.defineProperty(Provider.prototype, '_startPending', function() {
|
||||
console.log('WARNING: this provider does not support pending events');
|
||||
});
|
||||
|
||||
utils.defineProperty(Provider.prototype, '_stopPending', function() {
|
||||
});
|
||||
|
||||
utils.defineProperty(Provider.prototype, 'on', function(eventName, listener) {
|
||||
var key = getEventString(eventName);
|
||||
if (!this._events[key]) { this._events[key] = []; }
|
||||
this._events[key].push({eventName: eventName, listener: listener, type: 'on'});
|
||||
if (key === 'pending') { this._startPending(); }
|
||||
this.polling = true;
|
||||
});
|
||||
|
||||
@ -6362,6 +6473,7 @@ utils.defineProperty(Provider.prototype, 'once', function(eventName, listener) {
|
||||
var key = getEventString(eventName);
|
||||
if (!this._events[key]) { this._events[key] = []; }
|
||||
this._events[key].push({eventName: eventName, listener: listener, type: 'once'});
|
||||
if (key === 'pending') { this._startPending(); }
|
||||
this.polling = true;
|
||||
});
|
||||
|
||||
@ -6386,7 +6498,11 @@ utils.defineProperty(Provider.prototype, 'emit', function(eventName) {
|
||||
}
|
||||
}
|
||||
|
||||
if (listeners.length === 0) { delete this._events[key]; }
|
||||
if (listeners.length === 0) {
|
||||
delete this._events[key];
|
||||
if (key === 'pending') { this._stopPending(); }
|
||||
}
|
||||
|
||||
if (this.listenerCount() === 0) { this.polling = false; }
|
||||
});
|
||||
|
||||
@ -6431,6 +6547,10 @@ utils.defineProperty(Provider.prototype, 'removeListener', function(eventName, l
|
||||
if (this.listenerCount() === 0) { this.polling = false; }
|
||||
});
|
||||
|
||||
utils.defineProperty(Provider, '_formatters', {
|
||||
checkTransactionResponse: checkTransaction
|
||||
});
|
||||
|
||||
module.exports = Provider;
|
||||
|
||||
},{"./networks.json":23,"ethers-utils/address":3,"ethers-utils/bignumber":4,"ethers-utils/contract-address":5,"ethers-utils/convert":6,"ethers-utils/namehash":8,"ethers-utils/properties":9,"ethers-utils/rlp":10,"ethers-utils/utf8":13,"inherits":14,"xmlhttprequest":17}]},{},[20]);
|
||||
|
2
dist/ethers-providers.min.js
vendored
2
dist/ethers-providers.min.js
vendored
File diff suppressed because one or more lines are too long
7
dist/ethers-wallet.js
vendored
7
dist/ethers-wallet.js
vendored
@ -11291,13 +11291,16 @@ utils.defineProperty(Wallet, 'verifyMessage', function(message, signature) {
|
||||
signature = utils.hexlify(signature);
|
||||
if (signature.length != 132) { throw new Error('invalid signature'); }
|
||||
var digest = getHash(message);
|
||||
var recoveryParam = parseInt(signature.substring(130), 16) - 27;
|
||||
|
||||
var recoveryParam = parseInt(signature.substring(130), 16);
|
||||
if (recoveryParam >= 27) { recoveryParam -= 27; }
|
||||
if (recoveryParam < 0) { throw new Error('invalid signature'); }
|
||||
|
||||
return SigningKey.recover(
|
||||
digest,
|
||||
signature.substring(0, 66),
|
||||
'0x' + signature.substring(66, 130),
|
||||
parseInt(signature.substring(130), 16) - 27
|
||||
recoveryParam
|
||||
);
|
||||
});
|
||||
|
||||
|
2
dist/ethers-wallet.min.js
vendored
2
dist/ethers-wallet.min.js
vendored
File diff suppressed because one or more lines are too long
152
dist/ethers.js
vendored
152
dist/ethers.js
vendored
@ -6854,6 +6854,27 @@ function Contract(addressOrName, contractInterface, signerOrProvider) {
|
||||
log.removeListener = function() {
|
||||
provider.removeListener(eventInfo.topics, handleEvent);
|
||||
}
|
||||
|
||||
var poller = function(func, key) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
function poll() {
|
||||
provider[func](log[key]).then(function(value) {
|
||||
if (value == null) {
|
||||
setTimeout(poll, 1000);
|
||||
return;
|
||||
}
|
||||
resolve(value);
|
||||
}, function(error) {
|
||||
reject(error);
|
||||
});
|
||||
}
|
||||
poll();
|
||||
});
|
||||
}
|
||||
|
||||
log.getBlock = function() { return poller('getBlock', 'blockHash'); }
|
||||
log.getTransaction = function() { return poller('getTransaction', 'transactionHash'); }
|
||||
log.getTransactionReceipt = function() { return poller('getTransactionReceipt', 'transactionHash'); }
|
||||
log.eventSignature = eventInfo.signature;
|
||||
|
||||
eventCallback.apply(log, Array.prototype.slice.call(result));
|
||||
@ -7979,6 +8000,14 @@ utils.defineProperty(EtherscanProvider.prototype, 'perform', function(method, pa
|
||||
url += apiKey;
|
||||
return Provider.fetchJSON(url, null, getResult);
|
||||
|
||||
case 'getEtherPrice':
|
||||
if (this.name !== 'homestead') { return Promise.resolve(0.0); }
|
||||
url += '/api?module=stats&action=ethprice';
|
||||
url += apiKey;
|
||||
return Provider.fetchJSON(url, null, getResult).then(function(result) {
|
||||
return parseFloat(result.ethusd);
|
||||
});
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -7986,6 +8015,38 @@ utils.defineProperty(EtherscanProvider.prototype, 'perform', function(method, pa
|
||||
return Promise.reject(new Error('not implemented - ' + method));
|
||||
});
|
||||
|
||||
utils.defineProperty(EtherscanProvider.prototype, 'getHistory', function(addressOrName, startBlock, endBlock) {
|
||||
|
||||
var url = this.baseUrl;
|
||||
|
||||
var apiKey = '';
|
||||
if (this.apiKey) { apiKey += '&apikey=' + this.apiKey; }
|
||||
|
||||
if (startBlock == null) { startBlock = 0; }
|
||||
if (endBlock == null) { endBlock = 99999999; }
|
||||
|
||||
return this.resolveName(addressOrName).then(function(address) {
|
||||
url += '/api?module=account&action=txlist&address=' + address;
|
||||
url += '&fromBlock=' + startBlock;
|
||||
url += '&endBlock=' + endBlock;
|
||||
url += '&sort=asc';
|
||||
|
||||
return Provider.fetchJSON(url, null, getResult).then(function(result) {
|
||||
var output = [];
|
||||
result.forEach(function(tx) {
|
||||
['contractAddress', 'to'].forEach(function(key) {
|
||||
if (tx[key] == '') { delete tx[key]; }
|
||||
});
|
||||
if (tx.creates == null && tx.contractAddress != null) {
|
||||
tx.creates = tx.contractAddress;
|
||||
}
|
||||
output.push(Provider._formatters.checkTransactionResponse(tx));
|
||||
});
|
||||
return output;
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
module.exports = EtherscanProvider;;
|
||||
|
||||
},{"./provider.js":32,"ethers-utils/convert.js":37,"ethers-utils/properties.js":44}],26:[function(require,module,exports){
|
||||
@ -8134,6 +8195,13 @@ function InfuraProvider(network, apiAccessToken) {
|
||||
}
|
||||
JsonRpcProvider.inherits(InfuraProvider);
|
||||
|
||||
utils.defineProperty(InfuraProvider.prototype, '_startPending', function() {
|
||||
console.log('WARNING: INFURA does not support pending filters');
|
||||
});
|
||||
|
||||
utils.defineProperty(InfuraProvider.prototype, '_stopPending', function() {
|
||||
});
|
||||
|
||||
module.exports = InfuraProvider;
|
||||
|
||||
},{"./json-rpc-provider":29,"./provider":32,"ethers-utils/properties.js":44}],29:[function(require,module,exports){
|
||||
@ -8153,6 +8221,15 @@ var utils = (function() {
|
||||
}
|
||||
})();
|
||||
|
||||
// @TODO: Move this to utils
|
||||
function timer(timeout) {
|
||||
return new Promise(function(resolve) {
|
||||
setTimeout(function() {
|
||||
resolve();
|
||||
}, timeout);
|
||||
});
|
||||
}
|
||||
|
||||
function getResult(payload) {
|
||||
if (payload.error) {
|
||||
var error = new Error(payload.error.message);
|
||||
@ -8296,6 +8373,48 @@ utils.defineProperty(JsonRpcProvider.prototype, 'perform', function(method, para
|
||||
return Promise.reject(new Error('not implemented - ' + method));
|
||||
});
|
||||
|
||||
utils.defineProperty(JsonRpcProvider.prototype, '_startPending', function() {
|
||||
if (this._pendingFilter != null) { return; }
|
||||
var self = this;
|
||||
|
||||
var pendingFilter = this.send('eth_newPendingTransactionFilter', []);
|
||||
this._pendingFilter = pendingFilter;
|
||||
|
||||
pendingFilter.then(function(filterId) {
|
||||
function poll() {
|
||||
self.send('eth_getFilterChanges', [ filterId ]).then(function(hashes) {
|
||||
if (self._pendingFilter != pendingFilter) { return; }
|
||||
|
||||
var seq = Promise.resolve();
|
||||
hashes.forEach(function(hash) {
|
||||
seq = seq.then(function() {
|
||||
return self.getTransaction(hash).then(function(tx) {
|
||||
self.emit('pending', tx);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
return seq.then(function() {
|
||||
return timer(1000);
|
||||
});
|
||||
}).then(function() {
|
||||
if (self._pendingFilter != pendingFilter) {
|
||||
self.send('eth_uninstallFilter', [ filterIf ]);
|
||||
return;
|
||||
}
|
||||
setTimeout(function() { poll(); }, 0);
|
||||
});
|
||||
}
|
||||
poll();
|
||||
|
||||
return filterId;
|
||||
});
|
||||
});
|
||||
|
||||
utils.defineProperty(JsonRpcProvider.prototype, '_stopPending', function() {
|
||||
this._pendingFilter = null;
|
||||
});
|
||||
|
||||
module.exports = JsonRpcProvider;
|
||||
|
||||
},{"./provider.js":32,"ethers-utils/convert":37,"ethers-utils/properties":44}],30:[function(require,module,exports){
|
||||
@ -8585,7 +8704,6 @@ function checkTransaction(transaction) {
|
||||
}
|
||||
|
||||
if (!transaction.raw) {
|
||||
|
||||
// Very loose providers (e.g. TestRPC) don't provide a signature or raw
|
||||
if (transaction.v && transaction.r && transaction.s) {
|
||||
var raw = [
|
||||
@ -9304,6 +9422,9 @@ function getEventString(object) {
|
||||
if (object === 'block') {
|
||||
return 'block';
|
||||
|
||||
} else if (object === 'pending') {
|
||||
return 'pending';
|
||||
|
||||
} else if (utils.isHexString(object)) {
|
||||
if (object.length === 66) {
|
||||
return 'tx:' + object;
|
||||
@ -9331,6 +9452,9 @@ function parseEventString(string) {
|
||||
} else if (string === 'block') {
|
||||
return {type: 'block'};
|
||||
|
||||
} else if (string === 'pending') {
|
||||
return {type: 'pending'};
|
||||
|
||||
} else if (string.substring(0, 8) === 'address:') {
|
||||
return {type: 'address', address: string.substring(8)};
|
||||
|
||||
@ -9350,10 +9474,18 @@ function parseEventString(string) {
|
||||
throw new Error('invalid event string');
|
||||
}
|
||||
|
||||
utils.defineProperty(Provider.prototype, '_startPending', function() {
|
||||
console.log('WARNING: this provider does not support pending events');
|
||||
});
|
||||
|
||||
utils.defineProperty(Provider.prototype, '_stopPending', function() {
|
||||
});
|
||||
|
||||
utils.defineProperty(Provider.prototype, 'on', function(eventName, listener) {
|
||||
var key = getEventString(eventName);
|
||||
if (!this._events[key]) { this._events[key] = []; }
|
||||
this._events[key].push({eventName: eventName, listener: listener, type: 'on'});
|
||||
if (key === 'pending') { this._startPending(); }
|
||||
this.polling = true;
|
||||
});
|
||||
|
||||
@ -9361,6 +9493,7 @@ utils.defineProperty(Provider.prototype, 'once', function(eventName, listener) {
|
||||
var key = getEventString(eventName);
|
||||
if (!this._events[key]) { this._events[key] = []; }
|
||||
this._events[key].push({eventName: eventName, listener: listener, type: 'once'});
|
||||
if (key === 'pending') { this._startPending(); }
|
||||
this.polling = true;
|
||||
});
|
||||
|
||||
@ -9385,7 +9518,11 @@ utils.defineProperty(Provider.prototype, 'emit', function(eventName) {
|
||||
}
|
||||
}
|
||||
|
||||
if (listeners.length === 0) { delete this._events[key]; }
|
||||
if (listeners.length === 0) {
|
||||
delete this._events[key];
|
||||
if (key === 'pending') { this._stopPending(); }
|
||||
}
|
||||
|
||||
if (this.listenerCount() === 0) { this.polling = false; }
|
||||
});
|
||||
|
||||
@ -9430,6 +9567,10 @@ utils.defineProperty(Provider.prototype, 'removeListener', function(eventName, l
|
||||
if (this.listenerCount() === 0) { this.polling = false; }
|
||||
});
|
||||
|
||||
utils.defineProperty(Provider, '_formatters', {
|
||||
checkTransactionResponse: checkTransaction
|
||||
});
|
||||
|
||||
module.exports = Provider;
|
||||
|
||||
},{"./networks.json":30,"ethers-utils/address":33,"ethers-utils/bignumber":34,"ethers-utils/contract-address":36,"ethers-utils/convert":37,"ethers-utils/namehash":42,"ethers-utils/properties":44,"ethers-utils/rlp":45,"ethers-utils/utf8":51,"inherits":31,"xmlhttprequest":24}],33:[function(require,module,exports){
|
||||
@ -11712,13 +11853,16 @@ utils.defineProperty(Wallet, 'verifyMessage', function(message, signature) {
|
||||
signature = utils.hexlify(signature);
|
||||
if (signature.length != 132) { throw new Error('invalid signature'); }
|
||||
var digest = getHash(message);
|
||||
var recoveryParam = parseInt(signature.substring(130), 16) - 27;
|
||||
|
||||
var recoveryParam = parseInt(signature.substring(130), 16);
|
||||
if (recoveryParam >= 27) { recoveryParam -= 27; }
|
||||
if (recoveryParam < 0) { throw new Error('invalid signature'); }
|
||||
|
||||
return SigningKey.recover(
|
||||
digest,
|
||||
signature.substring(0, 66),
|
||||
'0x' + signature.substring(66, 130),
|
||||
parseInt(signature.substring(130), 16) - 27
|
||||
recoveryParam
|
||||
);
|
||||
});
|
||||
|
||||
|
6
dist/ethers.min.js
vendored
6
dist/ethers.min.js
vendored
File diff suppressed because one or more lines are too long
@ -10,10 +10,10 @@
|
||||
"version": "grunt dist"
|
||||
},
|
||||
"dependencies": {
|
||||
"ethers-contracts": "2.1.8",
|
||||
"ethers-providers": "2.1.14",
|
||||
"ethers-contracts": "2.1.9",
|
||||
"ethers-providers": "2.1.15",
|
||||
"ethers-utils": "2.1.8",
|
||||
"ethers-wallet": "2.1.6"
|
||||
"ethers-wallet": "2.1.7"
|
||||
},
|
||||
"devDependencies": {
|
||||
"grunt": "^0.4.5",
|
||||
|
Loading…
Reference in New Issue
Block a user