Compare commits

..

13 Commits

Author SHA1 Message Date
Richard Moore
7250cdcd31 Updated dist files. 2019-12-21 01:09:18 -05:00
Richard Moore
20f34f1ba9 Added proper support for v0.6 Solidity JSON type (#688). 2019-12-21 01:03:05 -05:00
Richard Moore
4ac08432b8 Fixed PhantomJS test cases for new elliptic library. 2019-11-24 20:56:28 +09:00
Richard Moore
3e3048df81 Merge branch 'master' of github.com:ethers-io/ethers.js 2019-11-24 20:06:38 +09:00
Richard Moore
c6199bf52a Updated dist files. 2019-11-24 20:06:10 +09:00
Richard Moore
20409c083c Update elliptic package to protect from Minerva timing attack (#666). 2019-11-24 19:55:10 +09:00
Richard Moore
7a90f18145 Do not poll if disabled during the previous event loop. 2019-11-24 19:34:17 +09:00
Richard Moore
df1ae611ba Moved node types to devDependencies (#663). 2019-11-24 19:33:02 +09:00
Richard Moore
6009a26c89 Added provider property to Web3Provider (#641). 2019-11-24 19:31:02 +09:00
Richard Moore
30984b6f00 Merge pull request #628 from evertonfraga/patch-1
Fix typo in tests/readme.md.
2019-11-20 21:01:58 +09:00
Richard Moore
76a8e503dd Updated dist files. 2019-10-30 19:17:31 +09:00
Richard Moore
d0e0e30532 Fix filters by forcing a poll instantly when polling starts to capture the current block (#613). 2019-10-30 19:13:32 +09:00
Ev
5af16a6090 Update README.md 2019-10-14 01:25:55 +09:00
23 changed files with 441 additions and 319 deletions

View File

@@ -1,6 +1,24 @@
CHANGELOG
=========
ethers/v4.0.41 (2019-12-21 01:05)
---------------------------------
- Added proper support for v0.6 Solidity JSON type ([#688](https://github.com/ethers-io/ethers.js/issues/688); [20f34f1](https://github.com/ethers-io/ethers.js/commit/20f34f1ba9c698d1731cb12c5de1822ad462fd7f)).
ethers/v4.0.40 (2019-11-24 19:58)
---------------------------------
- Update elliptic package to protect from Minerva timing attack ([#666](https://github.com/ethers-io/ethers.js/issues/666); [20409c0](https://github.com/ethers-io/ethers.js/commit/20409c083cd428c46cba09488ee609cc14ff1d2b)).
- Do not poll if disabled during the previous event loop. ([7a90f18](https://github.com/ethers-io/ethers.js/commit/7a90f18145931e7ff790cd9e1fd549929fbb9023)).
- Moved node types to devDependencies ([#663](https://github.com/ethers-io/ethers.js/issues/663); [df1ae61](https://github.com/ethers-io/ethers.js/commit/df1ae611bab0955005b0da6604191b60b34f198f)).
- Added provider property to Web3Provider ([#641](https://github.com/ethers-io/ethers.js/issues/641); [6009a26](https://github.com/ethers-io/ethers.js/commit/6009a26c89c359ae44ef4b6e8a664ed57db24f67)).
ethers/v4.0.39 (2019-10-30 19:15)
---------------------------------
- Fix filters by forcing a poll instantly when polling starts to capture the current block. ([#613](https://github.com/ethers-io/ethers.js/issues/613); [d0e0e30](https://github.com/ethers-io/ethers.js/commit/d0e0e30532baf387df6b4a8efe0805986cc265f2))
ethers/v4.0.38 (2019-10-17 01:28)
---------------------------------

2
_version.d.ts vendored
View File

@@ -1 +1 @@
export declare const version = "4.0.38";
export declare const version = "4.0.41";

View File

@@ -1,3 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.version = "4.0.38";
exports.version = "4.0.41";

611
dist/ethers.js vendored

File diff suppressed because it is too large Load Diff

2
dist/ethers.min.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -266,7 +266,7 @@ declare module 'ethers/utils/shims' {
}
declare module 'ethers/_version' {
export const version = "4.0.38";
export const version = "4.0.41";
}
declare module 'ethers/utils/bignumber' {

2
dist/shims.js vendored

File diff suppressed because one or more lines are too long

20
package-lock.json generated
View File

@@ -1,6 +1,6 @@
{
"name": "ethers",
"version": "4.0.37",
"version": "4.0.40",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@@ -92,7 +92,8 @@
"@types/node": {
"version": "10.14.12",
"resolved": "https://registry.npmjs.org/@types/node/-/node-10.14.12.tgz",
"integrity": "sha512-QcAKpaO6nhHLlxWBvpc4WeLrTvPqlHOvaj0s5GriKkA1zq+bsFBPpfYCvQhLqLgYlIko8A9YrPdaMHCo5mBcpg=="
"integrity": "sha512-QcAKpaO6nhHLlxWBvpc4WeLrTvPqlHOvaj0s5GriKkA1zq+bsFBPpfYCvQhLqLgYlIko8A9YrPdaMHCo5mBcpg==",
"dev": true
},
"JSONStream": {
"version": "1.3.5",
@@ -1827,14 +1828,17 @@
"dev": true
},
"elliptic": {
"version": "6.3.3",
"resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.3.3.tgz",
"integrity": "sha1-VILZZG1UvLif19mU/J4ulWiHbj8=",
"version": "6.5.2",
"resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.2.tgz",
"integrity": "sha512-f4x70okzZbIQl/NSRLkI/+tteV/9WqL98zx+SQ69KbXxmVrmjwsNUPn/gYJJ0sHvEak24cZgHIPegRePAtA/xw==",
"requires": {
"bn.js": "^4.4.0",
"brorand": "^1.0.1",
"hash.js": "^1.0.0",
"inherits": "^2.0.1"
"hmac-drbg": "^1.0.0",
"inherits": "^2.0.1",
"minimalistic-assert": "^1.0.0",
"minimalistic-crypto-utils": "^1.0.0"
}
},
"emoji-regex": {
@@ -3661,7 +3665,6 @@
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz",
"integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=",
"dev": true,
"requires": {
"hash.js": "^1.0.3",
"minimalistic-assert": "^1.0.0",
@@ -4589,8 +4592,7 @@
"minimalistic-crypto-utils": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz",
"integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=",
"dev": true
"integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo="
},
"minimatch": {
"version": "3.0.4",

View File

@@ -1,6 +1,6 @@
{
"name": "ethers",
"version": "4.0.38",
"version": "4.0.41",
"description": "Ethereum wallet library.",
"main": "./index.js",
"types": "./index.d.ts",
@@ -19,10 +19,9 @@
"version": "npm dist"
},
"dependencies": {
"@types/node": "^10.3.2",
"aes-js": "3.0.0",
"bn.js": "^4.4.0",
"elliptic": "6.3.3",
"elliptic": "6.5.2",
"hash.js": "1.1.3",
"js-sha3": "0.5.7",
"scrypt-js": "2.0.4",
@@ -31,6 +30,7 @@
"xmlhttprequest": "1.8.0"
},
"devDependencies": {
"@types/node": "^10.3.2",
"browserify": "^16.2.3",
"browserify-zlib": "^0.2.0",
"dts-bundle": "^0.7.3",

View File

@@ -452,6 +452,9 @@ var BaseProvider = /** @class */ (function (_super) {
BaseProvider.prototype._doPoll = function () {
var _this = this;
this.getBlockNumber().then(function (blockNumber) {
if (!_this.polling) {
return;
}
_this._setFastBlockNumber(blockNumber);
// If the block hasn't changed, meh.
if (blockNumber === _this._lastBlockNumber) {
@@ -594,6 +597,7 @@ var BaseProvider = /** @class */ (function (_super) {
setTimeout(function () {
if (value && !_this._poller) {
_this._poller = setInterval(_this._doPoll.bind(_this), _this.pollingInterval);
_this._doPoll();
}
else if (!value && _this._poller) {
clearInterval(_this._poller);

View File

@@ -47,6 +47,8 @@ var Web3Provider = /** @class */ (function (_super) {
errors.throwError('invalid web3Provider', errors.INVALID_ARGUMENT, { arg: 'web3Provider', value: web3Provider });
}
properties_1.defineReadOnly(_this, '_web3Provider', web3Provider);
// @TODO: In v5 remove the above definition; only this one is needed
properties_1.defineReadOnly(_this, 'provider', web3Provider);
return _this;
}
Web3Provider.prototype.send = function (method, params) {

View File

@@ -1 +1 @@
export const version = "4.0.38";
export const version = "4.0.41";

View File

@@ -573,6 +573,8 @@ export class BaseProvider extends Provider {
private _doPoll(): void {
this.getBlockNumber().then((blockNumber) => {
if (!this.polling) { return; }
this._setFastBlockNumber(blockNumber);
// If the block hasn't changed, meh.
@@ -666,6 +668,7 @@ export class BaseProvider extends Provider {
toBlock: blockNumber,
topics: topics
}
if (!filter.address) { delete filter.address; }
this.getLogs(filter).then((logs) => {
if (logs.length === 0) { return; }
@@ -716,6 +719,7 @@ export class BaseProvider extends Provider {
setTimeout(() => {
if (value && !this._poller) {
this._poller = setInterval(this._doPoll.bind(this), this.pollingInterval);
this._doPoll();
} else if (!value && this._poller) {
clearInterval(this._poller);

View File

@@ -55,6 +55,9 @@ export class Web3Provider extends JsonRpcProvider {
}
defineReadOnly(this, '_web3Provider', web3Provider);
// @TODO: In v5 remove the above definition; only this one is needed
defineReadOnly(this, 'provider', web3Provider);
}
send(method: string, params: any): Promise<any> {

View File

@@ -311,6 +311,13 @@ function addMethod(method: any): void {
let signature = formatSignature(method).replace(/tuple/g, '');
let sighash = id(signature).substring(0, 10);
let isConst = false;
if (method.constant != null) {
isConst = method.constant;
} else if (method.stateMutability != null) {
isConst = (method.stateMutability == "view" || method.stateMutability == "pure");
}
let description = new _FunctionDescription({
inputs: method.inputs,
outputs: method.outputs,
@@ -318,7 +325,7 @@ function addMethod(method: any): void {
gas: method.gas,
payable: (method.payable == null || !!method.payable),
type: ((method.constant) ? 'call': 'transaction'),
type: (isConst ? 'call': 'transaction'),
name: method.name,
signature: signature,

View File

@@ -63,7 +63,7 @@ Building Testcases
------------------
Each suite of testcases is produced from a variety of sources. Many include a
specific set of test vecotrs as well as procedurally generated tests using known
specific set of test vectors as well as procedurally generated tests using known
correct implementations.
The `contract-interface` test cases are created by selecting a (deterministically) random

View File

@@ -110,4 +110,8 @@ function Reporter(runner) {
});
}
try {
window.ethersReporter = Reporter;
} catch (error) { }
module.exports = Reporter;

View File

@@ -59,6 +59,13 @@ if (!ArrayBuffer.isView) {
}
}
if (Array.prototype.fill == null) {
shims.push("Array.fill");
Array.prototype.fill = function(value) {
for (var i = 0; i < this.length; i++) { this[i] = value; }
}
}
// Shim nextTick
if (!global.nextTick) {
shims.push("nextTick");

View File

@@ -540,3 +540,46 @@ describe('Test Filters', function() {
doTest(test);
});
});
describe('Test Solidity v0.6 ABI', function() {
var tests = [
{
inputs: [ ],
outputs: [ ],
stateMutability: "view",
type: "function",
name: "testView_call"
},
{
inputs: [ ],
outputs: [ ],
stateMutability: "pure",
type: "function",
name: "testPure_call"
},
{
inputs: [ ],
outputs: [ ],
stateMutability: "payable",
type: "function",
name: "testPayable_transaction"
},
{
inputs: [ ],
outputs: [ ],
stateMutability: "nonpayable",
type: "function",
name: "testNonpayable_transaction"
},
];
tests.forEach(function(test, index) {
var type = test.name.split("_")[1];
it(('generates fragment from ABI - ' + test.name.split("_")[0]), function() {
var iface = new ethers.utils.Interface(JSON.stringify([ test ]));
var func = iface.functions[test.name];
assert.equal(func.type, type, "matches type");
});
});
});

View File

@@ -38,7 +38,7 @@
<!-- Run the test cases! -->
<script type="text/javascript">
mocha.reporter(tests.reporter);
mocha.reporter(ethersReporter);
// Use this to focus on specific test cases
//mocha.grep(new RegExp('easyseed')).run();

View File

@@ -1,7 +1,7 @@
var assert = require('assert');
function getEthers(filename) {
let ethers = require('../index');
var ethers = require('../index');
console.log('Loaded local ethers: ' + filename);
assert.equal(ethers.platform, 'node', 'platform: ' + ethers.platform + ' != "node"');
return ethers;

View File

@@ -243,12 +243,19 @@ function addMethod(method) {
case 'function': {
var signature = abi_coder_1.formatSignature(method).replace(/tuple/g, '');
var sighash = hash_1.id(signature).substring(0, 10);
var isConst = false;
if (method.constant != null) {
isConst = method.constant;
}
else if (method.stateMutability != null) {
isConst = (method.stateMutability == "view" || method.stateMutability == "pure");
}
var description = new _FunctionDescription({
inputs: method.inputs,
outputs: method.outputs,
gas: method.gas,
payable: (method.payable == null || !!method.payable),
type: ((method.constant) ? 'call' : 'transaction'),
type: (isConst ? 'call' : 'transaction'),
name: method.name,
signature: signature,
sighash: sighash,