Skip to content

Commit e67a66f

Browse files
committed
Major version update; some changes are not backwards compatible. This package has been merged into one package instead of an umbrella pacakge. (See: ethers-io#95)
1 parent 20293fb commit e67a66f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+20884
-22173
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
node_modules/
22
obsolete/
33
.test-account.key
4+
.account.key
45
.DS_Store
56
docs/build/doctrees/
67
docs/build/html/_sources/

Gruntfile.js

Lines changed: 12 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -6,42 +6,19 @@ var through = require('through');
66
var ellipticPackage = require('elliptic/package.json');
77
ellipticPackage = JSON.stringify({ version: ellipticPackage.version });
88

9-
var versions = {
10-
'ethers': require('./package.json').version,
11-
};
12-
13-
var depVersions = require('./package.json').dependencies;
14-
15-
// Make sure the versions we are building a dist from are the most rescent
16-
[ 'contracts', 'providers', 'utils', 'wallet'].forEach(function(name) {
17-
var npmVersion = require('./node_modules/ethers-' + name + '/package.json').version;
18-
var liveVersion = require('./' + name + '/package.json').version;
19-
var depVersion = depVersions['ethers-' + name];
20-
21-
if (npmVersion !== liveVersion) {
22-
console.log(name, ('npm=' + npmVersion), ('live=' + liveVersion));
23-
throw new Error('version mismatch for ' + name + ' - redo npm install');
24-
}
25-
if (npmVersion !== depVersion) {
26-
console.log(name, ('npm=' + npmVersion), ('depVersion=' + depVersion));
27-
throw new Error('dependency version mismatch for ' + name + ' - update package.json');
28-
}
29-
30-
versions[name] = liveVersion;
31-
32-
console.log('Including: ', name + '@' + npmVersion);
33-
});
34-
35-
9+
var version = require('./package.json').version;
3610

3711

3812
var undef = "module.exports = undefined;";
3913
var empty = "module.exports = {};";
4014

4115
// We already have a random Uint8Array browser/node safe source
42-
var brorand = "var randomBytes = require('ethers-utils').randomBytes; module.exports = function(length) { return randomBytes(length); };";
16+
// @TODO: Use path construction instead of ../..
17+
var brorand = "var randomBytes = require('../../utils').randomBytes; module.exports = function(length) { return randomBytes(length); };";
4318

4419
var transforms = {
20+
'ethers.js/package.json': JSON.stringify({ version: version }),
21+
4522
// Remove the precomputed secp256k1 points
4623
"elliptic/lib/elliptic/precomputed/secp256k1.js": undef,
4724

@@ -55,6 +32,9 @@ var transforms = {
5532

5633
// Remove RIPEMD160
5734
"hash.js/lib/hash/ripemd.js": "module.exports = {ripemd160: null}",
35+
"hash.js/lib/hash/sha/1.js": empty,
36+
"hash.js/lib/hash/sha/224.js": empty,
37+
"hash.js/lib/hash/sha/384.js": empty,
5838

5939
// Swap out borland for the random bytes we already have
6040
"brorand/index.js": brorand,
@@ -84,6 +64,7 @@ function transform(path, options) {
8464
}, function () {
8565
var transformed = transformFile(path);
8666
if (transformed != null) {
67+
console.log('Transformed:' + path);
8768
data = transformed;
8869
} else {
8970
unmodified[path] = true;
@@ -103,15 +84,8 @@ function postBundle(error, source, next) {
10384
if (error) {
10485
console.log(error);
10586

106-
} else {
107-
// We setup the utils instance to be able to create a stand-alone package
108-
source = source.toString();
109-
var lengthBefore = source.length;
110-
var source = source.replace(/"__STAND_ALONE_FALSE__"/g, '"__STAND_ALONE_TRUE__"');
111-
if (lengthBefore - source.length !== 1) {
112-
next(new Error('multiple stand-alone variables changed'));
113-
return;
114-
}
87+
// } else {
88+
// source = source.toString();
11589
}
11690

11791
inflight--
@@ -169,7 +143,7 @@ module.exports = function(grunt) {
169143
[ transform, { global: true } ],
170144
],
171145
browserifyOptions: {
172-
//standalone: '_ethers',
146+
standalone: 'ethers',
173147
},
174148
preBundleCB: preBundle,
175149
postBundleCB: postBundle

contracts/README.md

Lines changed: 0 additions & 8 deletions
This file was deleted.

contracts/contract.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ var Interface = require('./interface.js');
44

55
var utils = (function() {
66
return {
7-
defineProperty: require('ethers-utils/properties.js').defineProperty,
7+
defineProperty: require('../utils/properties.js').defineProperty,
88

9-
getAddress: require('ethers-utils/address.js').getAddress,
9+
getAddress: require('../utils/address.js').getAddress,
1010

11-
bigNumberify: require('ethers-utils/bignumber.js').bigNumberify,
11+
bigNumberify: require('../utils/bignumber.js').bigNumberify,
1212

13-
hexlify: require('ethers-utils/convert.js').hexlify,
13+
hexlify: require('../utils/convert.js').hexlify,
1414
};
1515
})();
1616

@@ -125,7 +125,11 @@ function Contract(addressOrName, contractInterface, signerOrProvider) {
125125
return provider.call(transaction);
126126

127127
}).then(function(value) {
128-
return call.parse(value);
128+
var result = call.parse(value);
129+
if (method.outputs.types.length === 1) {
130+
result = result[0];
131+
}
132+
return result;
129133
});
130134

131135
case 'transaction':
@@ -226,7 +230,7 @@ function Contract(addressOrName, contractInterface, signerOrProvider) {
226230
}, this);
227231

228232
Object.keys(contractInterface.events).forEach(function(eventName) {
229-
var eventInfo = contractInterface.events[eventName]();
233+
var eventInfo = contractInterface.events[eventName];
230234

231235
var eventCallback = null;
232236

contracts/index.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,3 @@ module.exports = {
88
Interface: Interface,
99
}
1010

11-
require('ethers-utils/standalone.js')(module.exports);
12-

0 commit comments

Comments
 (0)