Compare commits
46 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b3f5266e78 | ||
|
|
0609ea9651 | ||
|
|
4f88c5ba6e | ||
|
|
023e946072 | ||
|
|
004cb826d2 | ||
|
|
bfcf224b2b | ||
|
|
c969fe5a68 | ||
|
|
8737f12e1b | ||
|
|
1267eeef4a | ||
|
|
11c250ff7c | ||
|
|
c303199d26 | ||
|
|
ae458a1a49 | ||
|
|
760a5aec74 | ||
|
|
2967efc2b0 | ||
|
|
24f243e689 | ||
|
|
d719064628 | ||
|
|
a7d0b41d98 | ||
|
|
a980fc3db0 | ||
|
|
a34ca6b3a3 | ||
|
|
ef91dcd757 | ||
|
|
a5296a9258 | ||
|
|
f827ae68e2 | ||
|
|
fbf15c0ffe | ||
|
|
10fdbe7274 | ||
|
|
384fc328f2 | ||
|
|
055694ae61 | ||
|
|
edf59d2c26 | ||
|
|
92c978e5c2 | ||
|
|
34397fa2aa | ||
|
|
19587eea3f | ||
|
|
4a9373e773 | ||
|
|
2997bae935 | ||
|
|
b0bd9ee162 | ||
|
|
7075c8c235 | ||
|
|
a4a532fe8e | ||
|
|
77c771bf76 | ||
|
|
c93b48920e | ||
|
|
04c92bb8d5 | ||
|
|
16c9745326 | ||
|
|
05648177aa | ||
|
|
f318fd9cf1 | ||
|
|
c15a89832b | ||
|
|
94b0abc240 | ||
|
|
72edcd054f | ||
|
|
e4a2f8ac6c | ||
|
|
c6d7b31a84 |
252
CHANGELOG.md
Normal file
252
CHANGELOG.md
Normal file
@@ -0,0 +1,252 @@
|
||||
CHANGELOG
|
||||
=========
|
||||
|
||||
ethers/v4.0.38 (2019-10-17 01:28)
|
||||
---------------------------------
|
||||
|
||||
- Fixed TypeScript 3.7-beta import issue. ([#622](https://github.com/ethers-io/ethers.js/issues/622); [0609ea9](https://github.com/ethers-io/ethers.js/commit/0609ea96519bf4afe6badc5f43c0d03ca91b8363))
|
||||
|
||||
ethers/v4.0.37 (2019-09-06 19:10)
|
||||
---------------------------------
|
||||
|
||||
- Added pkg.ethereum key for donations. ([#593](https://github.com/ethers-io/ethers.js/issues/593); [004cb82](https://github.com/ethers-io/ethers.js/commit/004cb826d2441cd5b0770161e66d351b2ba5abb5))
|
||||
- Fixed typo in error message. ([#592](https://github.com/ethers-io/ethers.js/issues/592); [bfcf224](https://github.com/ethers-io/ethers.js/commit/bfcf224b2bcfa10ff1a1250c3943d33daa98d6d8))
|
||||
- Fixed typo in error message. ([#580](https://github.com/ethers-io/ethers.js/issues/580); [c969fe5](https://github.com/ethers-io/ethers.js/commit/c969fe5a68a0703a892dc5ab6e09a6938ccc9e4c))
|
||||
- Fixed typo in error message. ([#574](https://github.com/ethers-io/ethers.js/issues/574); [8737f12](https://github.com/ethers-io/ethers.js/commit/8737f12e1bbeee477413e1d96c4124463256161e))
|
||||
|
||||
ethers/v4.0.36 (2019-08-26 16:09)
|
||||
---------------------------------
|
||||
|
||||
- Updated package-lock for security reasons; dev dependency only. ([11c250f](https://github.com/ethers-io/ethers.js/commit/11c250ff7c78fa6c28c1bc22f91ea214526c467d))
|
||||
- Fixed typo in error message. ([#592](https://github.com/ethers-io/ethers.js/issues/592); [c303199](https://github.com/ethers-io/ethers.js/commit/c303199d26d6c5959b1a85a24ca162a1e405c63b))
|
||||
- Fixed ENS lookupAddress when the resolver isn't configured. ([#581](https://github.com/ethers-io/ethers.js/issues/581); [760a5ae](https://github.com/ethers-io/ethers.js/commit/760a5aec74cfc2ce7467ae89214606500ed7a762))
|
||||
- Allow Secret Storage wallet address to be optional. ([#582](https://github.com/ethers-io/ethers.js/issues/582); [24f243e](https://github.com/ethers-io/ethers.js/commit/24f243e689112048df502e10dbc2935303280c4d))
|
||||
- Updated package-lock for lodash security advisory; the package is only a development dependency, so no urgent need to publish, just for developers. ([lodash/lodash#4336](https://github.com/lodash/lodash/pull/4336); [d719064](https://github.com/ethers-io/ethers.js/commit/d7190646280af9bb36352fc502ba7f6e84559026))
|
||||
|
||||
ethers/v4.0.33 (2019-07-09 20:17)
|
||||
---------------------------------
|
||||
|
||||
- Reduce number of HDNode tests which cause TravisCI to timeout. ([a7d0b41](https://github.com/ethers-io/ethers.js/commit/a7d0b41d9865ffb9bdda497f77c316938f44cd46))
|
||||
|
||||
ethers/v4.0.32 (2019-07-09 16:56)
|
||||
---------------------------------
|
||||
|
||||
- Added test cases for case-agnostic mnemonics. ([#557](https://github.com/ethers-io/ethers.js/issues/557); [a34ca6b](https://github.com/ethers-io/ethers.js/commit/a34ca6b3a38d0854d5b57c908d523a98262c0f53))
|
||||
- Make mnemonics case-agnostic. ([#557](https://github.com/ethers-io/ethers.js/issues/557); [ef91dcd](https://github.com/ethers-io/ethers.js/commit/ef91dcd757349dfb31ad2fbd0b840abe6a4043be))
|
||||
- Added tests for testnet extended private key. ([#553](https://github.com/ethers-io/ethers.js/issues/553); [a5296a9](https://github.com/ethers-io/ethers.js/commit/a5296a9258a475b6d3ebe4c6b848945a77ba4887))
|
||||
|
||||
ethers/v4.0.31 (2019-06-28 15:39)
|
||||
---------------------------------
|
||||
|
||||
- Fixed testnet exteneded private keys. ([#553](https://github.com/ethers-io/ethers.js/issues/553); [fbf15c0](https://github.com/ethers-io/ethers.js/commit/fbf15c0ffe046290749fe307e9d4e8624b81664a))
|
||||
|
||||
ethers/v4.0.30 (2019-06-21 19:18)
|
||||
---------------------------------
|
||||
|
||||
- No longer use hard-coded id of 42 in Web3Provider. ([384fc32](https://github.com/ethers-io/ethers.js/commit/384fc328f2989882bf6027b2af48efa02f2fab53))
|
||||
|
||||
ethers/v4.0.29 (2019-06-10 01:58)
|
||||
---------------------------------
|
||||
|
||||
- Fixed error in throwing an error for ABI decode. ([#539](https://github.com/ethers-io/ethers.js/issues/539); [92c978e](https://github.com/ethers-io/ethers.js/commit/92c978e5c20aca96a4297c7d494e154c3a796e71))
|
||||
|
||||
ethers/v4.0.28 (2019-05-24 14:57)
|
||||
---------------------------------
|
||||
|
||||
- Warn on deprecated INFURA API Token; use Project ID instead. ([#462](https://github.com/ethers-io/ethers.js/issues/462); [19587ee](https://github.com/ethers-io/ethers.js/commit/19587eea3f3fadc301ff4d949646b700ebb4a85b))
|
||||
- Fixed typo in error message. ([#470](https://github.com/ethers-io/ethers.js/issues/470); [4a9373e](https://github.com/ethers-io/ethers.js/commit/4a9373e773dd78c62f4f5127f8357001e5940a22))
|
||||
- Export poll function. ([#514](https://github.com/ethers-io/ethers.js/issues/514); [2997bae](https://github.com/ethers-io/ethers.js/commit/2997bae93599294935d1e467d8ede2960ee92e50))
|
||||
- Fixed error message for unconfigured ENS names. ([#504](https://github.com/ethers-io/ethers.js/issues/504); [7075c8c](https://github.com/ethers-io/ethers.js/commit/7075c8c2352ec306b5679da6fbe7c2ddf7bd65d1))
|
||||
- Fixed security recommendations (development deps only; not a problem, but quiets automatic audits). ([a4a532f](https://github.com/ethers-io/ethers.js/commit/a4a532fe8e6a9fd8ef2ff069ea1b6c9ae28c4e5a))
|
||||
|
||||
ethers/v4.0.27 (2019-04-18 07:50)
|
||||
---------------------------------
|
||||
|
||||
- Increment JSON-RPC ID for JsonRpcProviders for environments that unsafely manage callbacks. ([#489](https://github.com/ethers-io/ethers.js/issues/489); [c93b489](https://github.com/ethers-io/ethers.js/commit/c93b48920e4861b4fe35c60be19344abbb19a184))
|
||||
|
||||
ethers/v4.0.26 (2019-03-08 14:29)
|
||||
---------------------------------
|
||||
|
||||
- Added goerli to InfuraProvider. ([#421](https://github.com/ethers-io/ethers.js/issues/421); [16c9745](https://github.com/ethers-io/ethers.js/commit/16c974532603b6ed7e49cedd6ce11f2e92158bf0))
|
||||
|
||||
ethers/v4.0.25 (2019-02-15 13:43)
|
||||
---------------------------------
|
||||
|
||||
- Added fastRetry to polling for JsonRpcSigner to improve polling for sent transactions. ([#402](https://github.com/ethers-io/ethers.js/issues/402); [f318fd9](https://github.com/ethers-io/ethers.js/commit/f318fd9cf1303fe2770f400cbce14c778f77e454))
|
||||
- Fix waitForTransaction delay. ([#424](https://github.com/ethers-io/ethers.js/issues/424); [c15a898](https://github.com/ethers-io/ethers.js/commit/c15a89832b2fd8ab06b9ec655487cb50e8ded7c1))
|
||||
- Fixed waitForTransaction and removeListener. ([#410](https://github.com/ethers-io/ethers.js/issues/410); [72edcd0](https://github.com/ethers-io/ethers.js/commit/72edcd054fa78c52c82c33bcc7e389d93ff517ec))
|
||||
- Updated BIP39 list in readme. ([e4a2f8a](https://github.com/ethers-io/ethers.js/commit/e4a2f8ac6c5c9bb5fc30d5720e1457381c82e608))
|
||||
|
||||
ethers/v4.0.24 (2019-02-11 19:22)
|
||||
---------------------------------
|
||||
|
||||
- Fixed support for calling self-destructed contracts. ([#411](https://github.com/ethers-io/ethers.js/issues/411); [0ed983a](https://github.com/ethers-io/ethers.js/commit/0ed983a264077d74d23da194b580fc702e9139a9))
|
||||
- Updated balance address for Goerli test cases. ([8fab48a](https://github.com/ethers-io/ethers.js/commit/8fab48a3803f521a77ad8cfc7176f3b819996f88))
|
||||
- Fixed utils test case for phantomjs. ([a2306f7](https://github.com/ethers-io/ethers.js/commit/a2306f7870ab75802af95cc0eab7fa77ca17d8d8))
|
||||
- Initial support for EIP-234; filter by blockHash. ([#412](https://github.com/ethers-io/ethers.js/issues/412); [60b75c1](https://github.com/ethers-io/ethers.js/commit/60b75c10d702b5a04ec1e381191fe1cd5a93274c))
|
||||
- Fixed out-of-safe-range hexlify values to throw an exception. ([#420](https://github.com/ethers-io/ethers.js/issues/420); [41c2c8a](https://github.com/ethers-io/ethers.js/commit/41c2c8a729816226bc38a5bc0e73e0c573afe25d))
|
||||
- Added goerli testnet support. ([#421](https://github.com/ethers-io/ethers.js/issues/421); [9785eed](https://github.com/ethers-io/ethers.js/commit/9785eed8dd227234afbfcb0eef9892e6a7a2b187))
|
||||
- Fixed missing TypeArray slice on constrained environments. ([14484e5](https://github.com/ethers-io/ethers.js/commit/14484e566edf60a493acb1128708136d4205e606))
|
||||
- Fixed test-hdnode for phantomjs; does not support let keyword. ([429af2c](https://github.com/ethers-io/ethers.js/commit/429af2c40db40dc2ff1fd33409f198c2ab3c9b16))
|
||||
- Added xpub and xpriv deserialization. ([#405](https://github.com/ethers-io/ethers.js/issues/405); [af3aed4](https://github.com/ethers-io/ethers.js/commit/af3aed4580da47be1f89fce94c37b91012f92b91))
|
||||
- Added xpub and xpriv test cases for HD nodes. ([#405](https://github.com/ethers-io/ethers.js/issues/405); [3a3764b](https://github.com/ethers-io/ethers.js/commit/3a3764bdb4838c81dcd7afbb6eabd2792d3a5b00))
|
||||
- Support for xpub and xpriv derivation and generating extended keys; no fromExtendedKey yet. ([#405](https://github.com/ethers-io/ethers.js/issues/405); [18ee2c5](https://github.com/ethers-io/ethers.js/commit/18ee2c518c252a18fa172a8a7092c58cf6c0b7c5))
|
||||
|
||||
ethers/v4.0.23 (2019-01-25 19:09)
|
||||
---------------------------------
|
||||
|
||||
- Fixed duplicate events from triggering. ([#404](https://github.com/ethers-io/ethers.js/issues/404); [908258f](https://github.com/ethers-io/ethers.js/commit/908258f8d4c56b58f6826011a805c2e690d9a4a0))
|
||||
|
||||
ethers/v4.0.22 (2019-01-24 16:53)
|
||||
---------------------------------
|
||||
|
||||
- Ganache does not include from in receipts. ([#400](https://github.com/ethers-io/ethers.js/issues/400); [b5f720a](https://github.com/ethers-io/ethers.js/commit/b5f720ace6ac3e43beb2aaeda774f00f050192f4))
|
||||
- Added to and from for Transaction Receipts. ([#398](https://github.com/ethers-io/ethers.js/issues/398); [700dd34](https://github.com/ethers-io/ethers.js/commit/700dd3413718ecfa3800aab361c4c5b91d1a7137))
|
||||
- Added v3 INFURA end-points to InfuraProvider. ([#286](https://github.com/ethers-io/ethers.js/issues/286); [f2dd977](https://github.com/ethers-io/ethers.js/commit/f2dd977de4fb6216d6a990d13999644a9be5815d))
|
||||
- Fixed long-response bug in IpcProvider. ([#384](https://github.com/ethers-io/ethers.js/issues/384); [5f01321](https://github.com/ethers-io/ethers.js/commit/5f013216c5f51830ef3fd3f725d42272f7ae5c99))
|
||||
|
||||
ethers/v4.0.21 (2019-01-17 16:33)
|
||||
---------------------------------
|
||||
|
||||
- Fixed path for x-ethers metadata and wallet. ([#392](https://github.com/ethers-io/ethers.js/issues/392); [e5bee7e](https://github.com/ethers-io/ethers.js/commit/e5bee7e5a34ba9cfddae8e3c43de10a8060f911a))
|
||||
- Fixed contract removeAllListeners which did not clean up the event loop properly. ([#391](https://github.com/ethers-io/ethers.js/issues/391); [6d08968](https://github.com/ethers-io/ethers.js/commit/6d08968b8789976ee5a7ef23e3dd73e73342cf5b))
|
||||
|
||||
ethers/v4.0.20 (2018-12-27 15:49)
|
||||
---------------------------------
|
||||
|
||||
- Added customizable log levels to quiet warnings. ([#379](https://github.com/ethers-io/ethers.js/issues/379); [f3ec27b](https://github.com/ethers-io/ethers.js/commit/f3ec27b95fcb56d521952c708fdc0229f6d6f7f3))
|
||||
|
||||
ethers/v4.0.19 (2018-12-14 18:37)
|
||||
---------------------------------
|
||||
|
||||
- Allow unchecked transactions which will remain unwrapped for the JsonRpcSigner. ([#340](https://github.com/ethers-io/ethers.js/issues/340); [99a2166](https://github.com/ethers-io/ethers.js/commit/99a21660ab5b360cc4cbdba87dc54245c00565b9))
|
||||
- Make it easier for sub-classes of Wallet to manage nonces. ([4bc62a1](https://github.com/ethers-io/ethers.js/commit/4bc62a1e8a2c240ff567140b981c6bf9da57594f))
|
||||
|
||||
ethers/v4.0.18 (2018-12-12 16:57)
|
||||
---------------------------------
|
||||
|
||||
- Allow nonce to be a BigNumber. ([#228](https://github.com/ethers-io/ethers.js/issues/228); [bcba17a](https://github.com/ethers-io/ethers.js/commit/bcba17a9e76e9ff7867e3d8e32a508fc1582e003))
|
||||
- Fixed typo in error strings. ([#376](https://github.com/ethers-io/ethers.js/issues/376); [918b66b](https://github.com/ethers-io/ethers.js/commit/918b66bc2e176fc3c6f3088cc10b9d03e2df1f6e))
|
||||
- Add isHexString to exported utils. ([#367](https://github.com/ethers-io/ethers.js/issues/367); [152d672](https://github.com/ethers-io/ethers.js/commit/152d672278477321d6ff5dab03b2d1e812151f45))
|
||||
- Add abs method to BigNumber. ([#375](https://github.com/ethers-io/ethers.js/issues/375); [51fb472](https://github.com/ethers-io/ethers.js/commit/51fb4728091a30d147b7dcd61e08562c6171b372))
|
||||
- Better error messages for namehash. ([#364](https://github.com/ethers-io/ethers.js/issues/364); [66440b8](https://github.com/ethers-io/ethers.js/commit/66440b8542e80e056bd96d94a1be9fcbb1c9b2d7))
|
||||
|
||||
ethers/v4.0.17 (2018-12-08 18:47)
|
||||
---------------------------------
|
||||
|
||||
- Fixed function name in parsed transactions. ([#370](https://github.com/ethers-io/ethers.js/issues/370); [6ca1d77](https://github.com/ethers-io/ethers.js/commit/6ca1d772986482b8be467d97fd9cd3107c959ab5))
|
||||
- Include request body in web errors. ([4f6748e](https://github.com/ethers-io/ethers.js/commit/4f6748ec4cc432a1bc2097619a25b9e7ce2b2faa))
|
||||
- Squashed unhandled promise exception for Providers that are never used. ([#362](https://github.com/ethers-io/ethers.js/issues/362); [f56fc57](https://github.com/ethers-io/ethers.js/commit/f56fc572f159e6375db27caa1b3d464dd67803c7))
|
||||
- Added gas estimation back into JsonRpcSigner. ([#365](https://github.com/ethers-io/ethers.js/issues/365); [16fdf6b](https://github.com/ethers-io/ethers.js/commit/16fdf6b621fd45bb1d6ab4e636388d9e7a9028d2))
|
||||
|
||||
ethers/v4.0.16 (2018-12-04 17:17)
|
||||
---------------------------------
|
||||
|
||||
|
||||
ethers/v4.0.15 (2018-12-04 17:14)
|
||||
---------------------------------
|
||||
|
||||
- Do not fill in implicit values for JSON-RPC based signers. ([#335](https://github.com/ethers-io/ethers.js/issues/335); [2d854bd](https://github.com/ethers-io/ethers.js/commit/2d854bd94c799271ce5a2aa4f5ad17d22c8d8dc0))
|
||||
- More relaxed transaction parsing. ([#357](https://github.com/ethers-io/ethers.js/issues/357); [9565c28](https://github.com/ethers-io/ethers.js/commit/9565c28a91b558a96a3895ccfc03975efc639432))
|
||||
- Allow any whitespace characters in human-readable ABI. ([#360](https://github.com/ethers-io/ethers.js/issues/360); [bc457bb](https://github.com/ethers-io/ethers.js/commit/bc457bb3bde7f3c3f1ca2e8345cdf1a4e0701454))
|
||||
|
||||
ethers/v4.0.14 (2018-11-27 17:33)
|
||||
---------------------------------
|
||||
|
||||
- Fixed contract proxied tx.wait receipt properties. ([#355](https://github.com/ethers-io/ethers.js/issues/355); [3f76f60](https://github.com/ethers-io/ethers.js/commit/3f76f603d9de66cb38b8c5d2e2fc6f7c6794d234))
|
||||
|
||||
ethers/v4.0.13 (2018-11-27 15:60)
|
||||
---------------------------------
|
||||
|
||||
- Check for partially-working normalize support. ([bb6bc4c](https://github.com/ethers-io/ethers.js/commit/bb6bc4cac330120e691a4a0566ff547342f62c0c))
|
||||
- Support for platforms where UTF-8 is only half broken. ([ef8b9c3](https://github.com/ethers-io/ethers.js/commit/ef8b9c36ef42ce79d8b5db390eea3deec55d9a6b))
|
||||
- Throw exception instead of returning null for getDefaultProvider. ([#351](https://github.com/ethers-io/ethers.js/issues/351); [31d3ee8](https://github.com/ethers-io/ethers.js/commit/31d3ee899f4331cb75952eceb07b9a8ad7b30e9f))
|
||||
|
||||
ethers/v4.0.12 (2018-11-20 15:42)
|
||||
---------------------------------
|
||||
|
||||
- Added default provider support for Ethereum classic. ([#351](https://github.com/ethers-io/ethers.js/issues/351); [bffc557](https://github.com/ethers-io/ethers.js/commit/bffc557be1b84ae2b69edd5071f7a072c94421e9))
|
||||
|
||||
ethers/v4.0.11 (2018-11-13 07:49)
|
||||
---------------------------------
|
||||
|
||||
- Fixed 0 confirmation waiting. ([#346](https://github.com/ethers-io/ethers.js/issues/346); [048c571](https://github.com/ethers-io/ethers.js/commit/048c571d3d307f6b5a0094865b54106f6d7c5ffa))
|
||||
|
||||
ethers/v4.0.10 (2018-11-12 17:23)
|
||||
---------------------------------
|
||||
|
||||
- Fix spacing in checkArgument errors. ([#318](https://github.com/ethers-io/ethers.js/issues/318); [88f2f51](https://github.com/ethers-io/ethers.js/commit/88f2f51266a66cc8a5934ef5371e0458d08a46e8))
|
||||
- Do not replay block events when the provider event block is reset. ([#343](https://github.com/ethers-io/ethers.js/issues/343); [93152ef](https://github.com/ethers-io/ethers.js/commit/93152ef86394720e911aaf98011013e6dae87c77))
|
||||
|
||||
ethers/v4.0.9 (2018-11-09 14:37)
|
||||
--------------------------------
|
||||
|
||||
- Force unorm shim when String.prototype.normalize is broken. ([#338](https://github.com/ethers-io/ethers.js/issues/338); [478aaf9](https://github.com/ethers-io/ethers.js/commit/478aaf9619bd2e75e559ac73f1e007457480cb61))
|
||||
- Better error message when normalize is missing. ([fad902b](https://github.com/ethers-io/ethers.js/commit/fad902b438ee86d5ade3adc6bd4cd4e4a6c9348d))
|
||||
- Added shims for React-Native support. ([7bfaf29](https://github.com/ethers-io/ethers.js/commit/7bfaf292db90f3e25d5563cff63517ae61f88617))
|
||||
|
||||
ethers/v4.0.8 (2018-11-08 16:04)
|
||||
--------------------------------
|
||||
|
||||
- Updated dist files. ([be0488a](https://github.com/ethers-io/ethers.js/commit/be0488a1a02fffb6a31906a674b4a81da2cffd38))
|
||||
|
||||
ethers/v4.0.7 (2018-11-08 16:02)
|
||||
--------------------------------
|
||||
|
||||
- Fix for when blockTag is specified as a null equivalent value in contract overrides. ([#329](https://github.com/ethers-io/ethers.js/issues/329); [28a52cd](https://github.com/ethers-io/ethers.js/commit/28a52cd485f48599ced1cbf58535e41e179a69bf))
|
||||
- Added "debug" event for providers; do not depend on the format as it may change, but this should help debugging in most cases. ([#320](https://github.com/ethers-io/ethers.js/issues/320); [3a19f43](https://github.com/ethers-io/ethers.js/commit/3a19f43844b3161d536455ee0cbb0712263cd061))
|
||||
- Fix for Kovan filters without an address. ([#339](https://github.com/ethers-io/ethers.js/issues/339); [4852e83](https://github.com/ethers-io/ethers.js/commit/4852e837d2f47b70038136f3a702e9e127ad6c9c))
|
||||
|
||||
ethers/v4.0.6 (2018-10-14 19:02)
|
||||
--------------------------------
|
||||
|
||||
- Fixed lingering polling timer when no events left to process in a provider. ([d54609a](https://github.com/ethers-io/ethers.js/commit/d54609a4582b96bbf0bcb8395f0e01b8784a1369))
|
||||
- Fixed utils.poll from mutating passed variables. ([f682861](https://github.com/ethers-io/ethers.js/commit/f682861e0b420e1dc8123587734600cb00f91f06))
|
||||
- Fixed and refactored populating transaction values for signers. ([#306](https://github.com/ethers-io/ethers.js/issues/306); [023a20f](https://github.com/ethers-io/ethers.js/commit/023a20ff470f73a91a72d57bc85dfafd77255d4e))
|
||||
- Fixed test cases for phantomjs (must use ES3 syntax). ([e39cd84](https://github.com/ethers-io/ethers.js/commit/e39cd849236bf33f32168cfaaab0faf64e0ba69d))
|
||||
|
||||
ethers/v4.0.5 (2018-10-13 17:18)
|
||||
--------------------------------
|
||||
|
||||
- Fixed filtering with null non-indexed parameters. ([#305](https://github.com/ethers-io/ethers.js/issues/305); [6ac2d92](https://github.com/ethers-io/ethers.js/commit/6ac2d923b75526ab663a677f6a712f5400c2a621))
|
||||
|
||||
ethers/v4.0.4 (2018-10-11 16:04)
|
||||
--------------------------------
|
||||
|
||||
- Added optional blockTag to call; note that this may not behave as expected on all nodes. ([#226](https://github.com/ethers-io/ethers.js/issues/226); [493273d](https://github.com/ethers-io/ethers.js/commit/493273d698b9cc71ce1c0555f9df2bd791cd851e))
|
||||
- Check all transaction parameters are valid; protect against typos. ([#299](https://github.com/ethers-io/ethers.js/issues/299); [84344ac](https://github.com/ethers-io/ethers.js/commit/84344ac4c2a2502234373c24c0f02d8912417039))
|
||||
|
||||
ethers/v4.0.3 (2018-10-07 01:10)
|
||||
--------------------------------
|
||||
|
||||
- Added address to HDNode. ([#196](https://github.com/ethers-io/ethers.js/issues/196); [e39e2ed](https://github.com/ethers-io/ethers.js/commit/e39e2ed718364cfccb6921518500dd19f2a479fe))
|
||||
- Added French and Spanish to test-hdnode. ([71f781d](https://github.com/ethers-io/ethers.js/commit/71f781d5425f08fe3c88861e23b8a55860b3d074))
|
||||
- Mark progressCallback as optional. ([#293](https://github.com/ethers-io/ethers.js/issues/293); [b2db10e](https://github.com/ethers-io/ethers.js/commit/b2db10e216748e4c4d5d359bded904af7bd1128f))
|
||||
|
||||
ethers/v4.0.2 (2018-10-04 19:55)
|
||||
--------------------------------
|
||||
|
||||
- Added automatic event parsing for contract transaction receipts from tx.wait. ([2481581](https://github.com/ethers-io/ethers.js/commit/248158130e437b14f9d42666e0cdefa33a6be74d))
|
||||
- Added ability to wait for a specific number of confirmations. ([#229](https://github.com/ethers-io/ethers.js/issues/229); [f5c7ccb](https://github.com/ethers-io/ethers.js/commit/f5c7ccbb80e157ad27a51f310686d4ca3e1db7c8))
|
||||
- Fix for geth-etc. (official geth is fine; [24335d0](https://github.com/ethers-io/ethers.js/commit/24335d0dd71d11a2a9088c05728ed8507062434d))
|
||||
- Fixed confirmations tests and bootstrap fast blockNumber. ([908c2c1](https://github.com/ethers-io/ethers.js/commit/908c2c1096920c729669d8abc0fad10ad8f5b7e7))
|
||||
- Added confirmations to TransactionResponse. ([#156](https://github.com/ethers-io/ethers.js/issues/156); [#238](https://github.com/ethers-io/ethers.js/issues/238); [9797b36](https://github.com/ethers-io/ethers.js/commit/9797b36186add496aafc29c96b44d61fa62b23e3))
|
||||
- Fixed nested errors for providers that were masking true error. ([#292](https://github.com/ethers-io/ethers.js/issues/292); [731f189](https://github.com/ethers-io/ethers.js/commit/731f189010f03b22c085fa87f197d77988d7d0c2))
|
||||
- Added version to errors. ([99fed75](https://github.com/ethers-io/ethers.js/commit/99fed75202c19b976fa744d7e27c230da12f0f10))
|
||||
- Fixed French and Spanish for browsers without Uint8Array.forEach. ([cb5f9f5](https://github.com/ethers-io/ethers.js/commit/cb5f9f576aa6747f4ce85b727ea1c3b62c8fd047))
|
||||
- Added French and Spanish includes to phantomjs test page. ([aeac2cd](https://github.com/ethers-io/ethers.js/commit/aeac2cdb867380f3fc321c3b8cc1f5e733bb0d22))
|
||||
- Increased timeout for querying npm registry. ([0dafd83](https://github.com/ethers-io/ethers.js/commit/0dafd83033d16b73dc0d744cfd00d045e9623bd6))
|
||||
|
||||
ethers/v4.0.1 (2018-10-03 20:02)
|
||||
--------------------------------
|
||||
|
||||
- Added French and Spanish wordlist dist files. ([b9c07b5](https://github.com/ethers-io/ethers.js/commit/b9c07b549ca23b11bfac9abc147cad75a6db17b5))
|
||||
- Added French and Spanish BIP-39 wordlists. ([#191](https://github.com/ethers-io/ethers.js/issues/191); [c34a1f7](https://github.com/ethers-io/ethers.js/commit/c34a1f73c6e05a098bd15e760971f68c0a471770))
|
||||
- Added support for JSON serialized BigNumbers in the constructor. ([#288](https://github.com/ethers-io/ethers.js/issues/288); [281bd06](https://github.com/ethers-io/ethers.js/commit/281bd0613d9da2542b519122496387e9e25c51ac))
|
||||
- Fixed scrypt for long passwords. ([#223](https://github.com/ethers-io/ethers.js/issues/223); [d936b4c](https://github.com/ethers-io/ethers.js/commit/d936b4cd09126f395d5478b65c076049e560940c))
|
||||
|
||||
ethers/v4.0.0 (2018-10-01 17:34)
|
||||
--------------------------------
|
||||
|
||||
- Initial v4 release
|
||||
|
||||
@@ -9,7 +9,7 @@ Complete Ethereum wallet implementation and utilities in JavaScript (and TypeScr
|
||||
|
||||
- Keep your private keys in your client, **safe** and sound
|
||||
- Import and export **JSON wallets** (Geth, Parity and crowdsale)
|
||||
- Import and export BIP 39 **mnemonic phrases** (12 word backup phrases) and **HD Wallets** (English, Italian, Japanese, Korean, Simplified Chinese, Traditional Chinese; more coming soon)
|
||||
- Import and export BIP 39 **mnemonic phrases** (12 word backup phrases) and **HD Wallets** (English, French, Italian, Japanese, Korean, Simplified Chinese, Spanish, Traditional Chinese)
|
||||
- Meta-classes create JavaScript objects from any contract ABI, including **ABIv2** and **Human-Readable ABI**
|
||||
- Connect to Ethereum nodes over [JSON-RPC](https://github.com/ethereum/wiki/wiki/JSON-RPC), [INFURA](https://infura.io), [Etherscan](https://etherscan.io), or [MetaMask](https://metamask.io)
|
||||
- **ENS names** are first-class citizens; they can be used anywhere an Ethereum addresses can be used
|
||||
|
||||
2
_version.d.ts
vendored
2
_version.d.ts
vendored
@@ -1 +1 @@
|
||||
export declare const version = "4.0.24";
|
||||
export declare const version = "4.0.38";
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.version = "4.0.24";
|
||||
exports.version = "4.0.38";
|
||||
|
||||
5
contract.d.ts
vendored
5
contract.d.ts
vendored
@@ -1,7 +1,7 @@
|
||||
import { BigNumber } from './utils/bignumber';
|
||||
import { Indexed, Interface } from './utils/interface';
|
||||
import { UnsignedTransaction } from './utils/transaction';
|
||||
import { Provider } from './providers/abstract-provider';
|
||||
import { BlockTag, Provider } from './providers/abstract-provider';
|
||||
import { Signer } from './abstract-signer';
|
||||
import { Arrayish } from './utils/bytes';
|
||||
import { ParamType } from './utils/abi-coder';
|
||||
@@ -50,9 +50,10 @@ export declare class Contract {
|
||||
readonly [name: string]: ContractFunction | any;
|
||||
readonly addressPromise: Promise<string>;
|
||||
readonly deployTransaction: TransactionResponse;
|
||||
private _deployed;
|
||||
private _deployedPromise;
|
||||
constructor(addressOrName: string, contractInterface: Array<string | ParamType> | string | Interface, signerOrProvider: Signer | Provider);
|
||||
deployed(): Promise<Contract>;
|
||||
_deployed(blockTag?: BlockTag): Promise<Contract>;
|
||||
fallback(overrides?: TransactionRequest): Promise<TransactionResponse>;
|
||||
connect(signerOrProvider: Signer | Provider | string): Contract;
|
||||
attach(addressOrName: string): Contract;
|
||||
|
||||
18
contract.js
18
contract.js
@@ -135,8 +135,7 @@ function runMethod(contract, functionName, estimateOnly) {
|
||||
errors.throwError('cannot override ' + key, errors.UNSUPPORTED_OPERATION, { operation: key });
|
||||
}
|
||||
});
|
||||
// Send to the contract address (after checking the contract is deployed)
|
||||
tx.to = contract.deployed().then(function () {
|
||||
tx.to = contract._deployed(blockTag).then(function () {
|
||||
return contract.addressPromise;
|
||||
});
|
||||
return resolveAddresses(contract.provider, params, method.inputs).then(function (params) {
|
||||
@@ -205,7 +204,7 @@ function runMethod(contract, functionName, estimateOnly) {
|
||||
tx.gasLimit = bignumber_1.bigNumberify(method.gas).add(21000);
|
||||
}
|
||||
if (!contract.signer) {
|
||||
errors.throwError('sending a transaction require a signer', errors.UNSUPPORTED_OPERATION, { operation: 'sendTransaction' });
|
||||
errors.throwError('sending a transaction requires a signer', errors.UNSUPPORTED_OPERATION, { operation: 'sendTransaction' });
|
||||
}
|
||||
// Make sure they aren't overriding something they shouldn't
|
||||
if (tx.from != null) {
|
||||
@@ -332,11 +331,14 @@ var Contract = /** @class */ (function () {
|
||||
}
|
||||
// @TODO: Allow timeout?
|
||||
Contract.prototype.deployed = function () {
|
||||
return this._deployed();
|
||||
};
|
||||
Contract.prototype._deployed = function (blockTag) {
|
||||
var _this = this;
|
||||
if (!this._deployed) {
|
||||
if (!this._deployedPromise) {
|
||||
// If we were just deployed, we know the transaction we should occur in
|
||||
if (this.deployTransaction) {
|
||||
this._deployed = this.deployTransaction.wait().then(function () {
|
||||
this._deployedPromise = this.deployTransaction.wait().then(function () {
|
||||
return _this;
|
||||
});
|
||||
}
|
||||
@@ -344,7 +346,7 @@ var Contract = /** @class */ (function () {
|
||||
// @TODO: Once we allow a timeout to be passed in, we will wait
|
||||
// up to that many blocks for getCode
|
||||
// Otherwise, poll for our code to be deployed
|
||||
this._deployed = this.provider.getCode(this.address).then(function (code) {
|
||||
this._deployedPromise = this.provider.getCode(this.address, blockTag).then(function (code) {
|
||||
if (code === '0x') {
|
||||
errors.throwError('contract not deployed', errors.UNSUPPORTED_OPERATION, {
|
||||
contractAddress: _this.address,
|
||||
@@ -355,7 +357,7 @@ var Contract = /** @class */ (function () {
|
||||
});
|
||||
}
|
||||
}
|
||||
return this._deployed;
|
||||
return this._deployedPromise;
|
||||
};
|
||||
// @TODO:
|
||||
// estimateFallback(overrides?: TransactionRequest): Promise<BigNumber>
|
||||
@@ -364,7 +366,7 @@ var Contract = /** @class */ (function () {
|
||||
Contract.prototype.fallback = function (overrides) {
|
||||
var _this = this;
|
||||
if (!this.signer) {
|
||||
errors.throwError('sending a transaction require a signer', errors.UNSUPPORTED_OPERATION, { operation: 'sendTransaction(fallback)' });
|
||||
errors.throwError('sending a transaction requires a signer', errors.UNSUPPORTED_OPERATION, { operation: 'sendTransaction(fallback)' });
|
||||
}
|
||||
var tx = properties_1.shallowCopy(overrides || {});
|
||||
['from', 'to'].forEach(function (key) {
|
||||
|
||||
193
dist/ethers.js
vendored
193
dist/ethers.js
vendored
@@ -1,7 +1,7 @@
|
||||
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.ethers = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.version = "4.0.24";
|
||||
exports.version = "4.0.38";
|
||||
|
||||
},{}],2:[function(require,module,exports){
|
||||
"use strict";
|
||||
@@ -183,8 +183,7 @@ function runMethod(contract, functionName, estimateOnly) {
|
||||
errors.throwError('cannot override ' + key, errors.UNSUPPORTED_OPERATION, { operation: key });
|
||||
}
|
||||
});
|
||||
// Send to the contract address (after checking the contract is deployed)
|
||||
tx.to = contract.deployed().then(function () {
|
||||
tx.to = contract._deployed(blockTag).then(function () {
|
||||
return contract.addressPromise;
|
||||
});
|
||||
return resolveAddresses(contract.provider, params, method.inputs).then(function (params) {
|
||||
@@ -253,7 +252,7 @@ function runMethod(contract, functionName, estimateOnly) {
|
||||
tx.gasLimit = bignumber_1.bigNumberify(method.gas).add(21000);
|
||||
}
|
||||
if (!contract.signer) {
|
||||
errors.throwError('sending a transaction require a signer', errors.UNSUPPORTED_OPERATION, { operation: 'sendTransaction' });
|
||||
errors.throwError('sending a transaction requires a signer', errors.UNSUPPORTED_OPERATION, { operation: 'sendTransaction' });
|
||||
}
|
||||
// Make sure they aren't overriding something they shouldn't
|
||||
if (tx.from != null) {
|
||||
@@ -380,11 +379,14 @@ var Contract = /** @class */ (function () {
|
||||
}
|
||||
// @TODO: Allow timeout?
|
||||
Contract.prototype.deployed = function () {
|
||||
return this._deployed();
|
||||
};
|
||||
Contract.prototype._deployed = function (blockTag) {
|
||||
var _this = this;
|
||||
if (!this._deployed) {
|
||||
if (!this._deployedPromise) {
|
||||
// If we were just deployed, we know the transaction we should occur in
|
||||
if (this.deployTransaction) {
|
||||
this._deployed = this.deployTransaction.wait().then(function () {
|
||||
this._deployedPromise = this.deployTransaction.wait().then(function () {
|
||||
return _this;
|
||||
});
|
||||
}
|
||||
@@ -392,7 +394,7 @@ var Contract = /** @class */ (function () {
|
||||
// @TODO: Once we allow a timeout to be passed in, we will wait
|
||||
// up to that many blocks for getCode
|
||||
// Otherwise, poll for our code to be deployed
|
||||
this._deployed = this.provider.getCode(this.address).then(function (code) {
|
||||
this._deployedPromise = this.provider.getCode(this.address, blockTag).then(function (code) {
|
||||
if (code === '0x') {
|
||||
errors.throwError('contract not deployed', errors.UNSUPPORTED_OPERATION, {
|
||||
contractAddress: _this.address,
|
||||
@@ -403,7 +405,7 @@ var Contract = /** @class */ (function () {
|
||||
});
|
||||
}
|
||||
}
|
||||
return this._deployed;
|
||||
return this._deployedPromise;
|
||||
};
|
||||
// @TODO:
|
||||
// estimateFallback(overrides?: TransactionRequest): Promise<BigNumber>
|
||||
@@ -412,7 +414,7 @@ var Contract = /** @class */ (function () {
|
||||
Contract.prototype.fallback = function (overrides) {
|
||||
var _this = this;
|
||||
if (!this.signer) {
|
||||
errors.throwError('sending a transaction require a signer', errors.UNSUPPORTED_OPERATION, { operation: 'sendTransaction(fallback)' });
|
||||
errors.throwError('sending a transaction requires a signer', errors.UNSUPPORTED_OPERATION, { operation: 'sendTransaction(fallback)' });
|
||||
}
|
||||
var tx = properties_1.shallowCopy(overrides || {});
|
||||
['from', 'to'].forEach(function (key) {
|
||||
@@ -8644,24 +8646,28 @@ exports.shr64_lo = shr64_lo;
|
||||
if (typeof Object.create === 'function') {
|
||||
// implementation from standard node.js 'util' module
|
||||
module.exports = function inherits(ctor, superCtor) {
|
||||
ctor.super_ = superCtor
|
||||
ctor.prototype = Object.create(superCtor.prototype, {
|
||||
constructor: {
|
||||
value: ctor,
|
||||
enumerable: false,
|
||||
writable: true,
|
||||
configurable: true
|
||||
}
|
||||
});
|
||||
if (superCtor) {
|
||||
ctor.super_ = superCtor
|
||||
ctor.prototype = Object.create(superCtor.prototype, {
|
||||
constructor: {
|
||||
value: ctor,
|
||||
enumerable: false,
|
||||
writable: true,
|
||||
configurable: true
|
||||
}
|
||||
})
|
||||
}
|
||||
};
|
||||
} else {
|
||||
// old school shim for old browsers
|
||||
module.exports = function inherits(ctor, superCtor) {
|
||||
ctor.super_ = superCtor
|
||||
var TempCtor = function () {}
|
||||
TempCtor.prototype = superCtor.prototype
|
||||
ctor.prototype = new TempCtor()
|
||||
ctor.prototype.constructor = ctor
|
||||
if (superCtor) {
|
||||
ctor.super_ = superCtor
|
||||
var TempCtor = function () {}
|
||||
TempCtor.prototype = superCtor.prototype
|
||||
ctor.prototype = new TempCtor()
|
||||
ctor.prototype.constructor = ctor
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9618,7 +9624,7 @@ module.exports = { browser: true };
|
||||
|
||||
}).call(this,require("timers").setImmediate)
|
||||
},{"timers":45}],44:[function(require,module,exports){
|
||||
(function (process,global){
|
||||
(function (process,global,clearImmediate){
|
||||
(function (global, undefined) {
|
||||
"use strict";
|
||||
|
||||
@@ -9795,8 +9801,8 @@ module.exports = { browser: true };
|
||||
attachTo.clearImmediate = clearImmediate;
|
||||
}(typeof self === "undefined" ? typeof global === "undefined" ? this : global : self));
|
||||
|
||||
}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
||||
},{"_process":42}],45:[function(require,module,exports){
|
||||
}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("timers").clearImmediate)
|
||||
},{"_process":42,"timers":45}],45:[function(require,module,exports){
|
||||
(function (global){
|
||||
module.exports = { setImmediate: global.setImmediate };
|
||||
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
||||
@@ -10074,6 +10080,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var address_1 = require("../utils/address");
|
||||
var bignumber_1 = require("../utils/bignumber");
|
||||
var bytes_1 = require("../utils/bytes");
|
||||
var constants_1 = require("../constants");
|
||||
var hash_1 = require("../utils/hash");
|
||||
var networks_1 = require("../utils/networks");
|
||||
var properties_1 = require("../utils/properties");
|
||||
@@ -10710,17 +10717,21 @@ var BaseProvider = /** @class */ (function (_super) {
|
||||
if (confirmations == null) {
|
||||
confirmations = 1;
|
||||
}
|
||||
return web_1.poll(function () {
|
||||
return _this.getTransactionReceipt(transactionHash).then(function (receipt) {
|
||||
if (confirmations === 0) {
|
||||
return receipt;
|
||||
}
|
||||
if (receipt == null || receipt.confirmations < confirmations) {
|
||||
return undefined;
|
||||
}
|
||||
return this.getTransactionReceipt(transactionHash).then(function (receipt) {
|
||||
if (confirmations === 0 || (receipt && receipt.confirmations >= confirmations)) {
|
||||
return receipt;
|
||||
});
|
||||
}, { onceBlock: this });
|
||||
}
|
||||
return (new Promise(function (resolve) {
|
||||
var handler = function (receipt) {
|
||||
if (receipt.confirmations < confirmations) {
|
||||
return;
|
||||
}
|
||||
_this.removeListener(transactionHash, handler);
|
||||
resolve(receipt);
|
||||
};
|
||||
_this.on(transactionHash, handler);
|
||||
}));
|
||||
});
|
||||
};
|
||||
BaseProvider.prototype.getBlockNumber = function () {
|
||||
var _this = this;
|
||||
@@ -10748,7 +10759,7 @@ var BaseProvider = /** @class */ (function (_super) {
|
||||
return this.ready.then(function () {
|
||||
return properties_1.resolveProperties({ addressOrName: addressOrName, blockTag: blockTag }).then(function (_a) {
|
||||
var addressOrName = _a.addressOrName, blockTag = _a.blockTag;
|
||||
return _this.resolveName(addressOrName).then(function (address) {
|
||||
return _this._getAddress(addressOrName).then(function (address) {
|
||||
var params = { address: address, blockTag: checkBlockTag(blockTag) };
|
||||
return _this.perform('getBalance', params).then(function (result) {
|
||||
return bignumber_1.bigNumberify(result);
|
||||
@@ -10762,7 +10773,7 @@ var BaseProvider = /** @class */ (function (_super) {
|
||||
return this.ready.then(function () {
|
||||
return properties_1.resolveProperties({ addressOrName: addressOrName, blockTag: blockTag }).then(function (_a) {
|
||||
var addressOrName = _a.addressOrName, blockTag = _a.blockTag;
|
||||
return _this.resolveName(addressOrName).then(function (address) {
|
||||
return _this._getAddress(addressOrName).then(function (address) {
|
||||
var params = { address: address, blockTag: checkBlockTag(blockTag) };
|
||||
return _this.perform('getTransactionCount', params).then(function (result) {
|
||||
return bignumber_1.bigNumberify(result).toNumber();
|
||||
@@ -10776,7 +10787,7 @@ var BaseProvider = /** @class */ (function (_super) {
|
||||
return this.ready.then(function () {
|
||||
return properties_1.resolveProperties({ addressOrName: addressOrName, blockTag: blockTag }).then(function (_a) {
|
||||
var addressOrName = _a.addressOrName, blockTag = _a.blockTag;
|
||||
return _this.resolveName(addressOrName).then(function (address) {
|
||||
return _this._getAddress(addressOrName).then(function (address) {
|
||||
var params = { address: address, blockTag: checkBlockTag(blockTag) };
|
||||
return _this.perform('getCode', params).then(function (result) {
|
||||
return bytes_1.hexlify(result);
|
||||
@@ -10790,7 +10801,7 @@ var BaseProvider = /** @class */ (function (_super) {
|
||||
return this.ready.then(function () {
|
||||
return properties_1.resolveProperties({ addressOrName: addressOrName, position: position, blockTag: blockTag }).then(function (_a) {
|
||||
var addressOrName = _a.addressOrName, position = _a.position, blockTag = _a.blockTag;
|
||||
return _this.resolveName(addressOrName).then(function (address) {
|
||||
return _this._getAddress(addressOrName).then(function (address) {
|
||||
var params = {
|
||||
address: address,
|
||||
blockTag: checkBlockTag(blockTag),
|
||||
@@ -11033,6 +11044,14 @@ var BaseProvider = /** @class */ (function (_super) {
|
||||
});
|
||||
});
|
||||
};
|
||||
BaseProvider.prototype._getAddress = function (addressOrName) {
|
||||
return this.resolveName(addressOrName).then(function (address) {
|
||||
if (address == null) {
|
||||
errors.throwError("ENS name not configured", errors.UNSUPPORTED_OPERATION, { operation: "resolveName(" + JSON.stringify(addressOrName) + ")" });
|
||||
}
|
||||
return address;
|
||||
});
|
||||
};
|
||||
// @TODO: Could probably use resolveProperties instead?
|
||||
BaseProvider.prototype._resolveNames = function (object, keys) {
|
||||
var promises = [];
|
||||
@@ -11041,7 +11060,7 @@ var BaseProvider = /** @class */ (function (_super) {
|
||||
if (result[key] == null) {
|
||||
return;
|
||||
}
|
||||
promises.push(this.resolveName(result[key]).then(function (address) {
|
||||
promises.push(this._getAddress(result[key]).then(function (address) {
|
||||
result[key] = address;
|
||||
return;
|
||||
}));
|
||||
@@ -11054,7 +11073,7 @@ var BaseProvider = /** @class */ (function (_super) {
|
||||
return this.getNetwork().then(function (network) {
|
||||
// No ENS...
|
||||
if (!network.ensAddress) {
|
||||
errors.throwError('network does support ENS', errors.UNSUPPORTED_OPERATION, { operation: 'ENS', network: network.name });
|
||||
errors.throwError('network does not support ENS', errors.UNSUPPORTED_OPERATION, { operation: 'ENS', network: network.name });
|
||||
}
|
||||
// keccak256('resolver(bytes32)')
|
||||
var data = '0x0178b8bf' + hash_1.namehash(name).substring(2);
|
||||
@@ -11064,7 +11083,11 @@ var BaseProvider = /** @class */ (function (_super) {
|
||||
if (bytes_1.hexDataLength(data) !== 32) {
|
||||
return null;
|
||||
}
|
||||
return address_1.getAddress(bytes_1.hexDataSlice(data, 12));
|
||||
var address = address_1.getAddress(bytes_1.hexDataSlice(data, 12));
|
||||
if (address === constants_1.AddressZero) {
|
||||
return null;
|
||||
}
|
||||
return address;
|
||||
});
|
||||
});
|
||||
};
|
||||
@@ -11085,6 +11108,9 @@ var BaseProvider = /** @class */ (function (_super) {
|
||||
var nodeHash = hash_1.namehash(name);
|
||||
// Get the addr from the resovler
|
||||
return this._getResolver(name).then(function (resolverAddress) {
|
||||
if (resolverAddress == null) {
|
||||
return null;
|
||||
}
|
||||
// keccak256('addr(bytes32)')
|
||||
var data = '0x3b3b57de' + nodeHash.substring(2);
|
||||
var transaction = { to: resolverAddress, data: data };
|
||||
@@ -11095,7 +11121,7 @@ var BaseProvider = /** @class */ (function (_super) {
|
||||
return null;
|
||||
}
|
||||
var address = address_1.getAddress(bytes_1.hexDataSlice(data, 12));
|
||||
if (address === '0x0000000000000000000000000000000000000000') {
|
||||
if (address === constants_1.AddressZero) {
|
||||
return null;
|
||||
}
|
||||
return address;
|
||||
@@ -11121,6 +11147,9 @@ var BaseProvider = /** @class */ (function (_super) {
|
||||
var transaction = { to: resolverAddress, data: data };
|
||||
return self.call(transaction);
|
||||
}).then(function (data) {
|
||||
if (data == null) {
|
||||
return null;
|
||||
}
|
||||
// Strip off the "0x"
|
||||
data = data.substring(2);
|
||||
// Strip off the dynamic string pointer (0x20)
|
||||
@@ -11223,13 +11252,19 @@ var BaseProvider = /** @class */ (function (_super) {
|
||||
});
|
||||
};
|
||||
BaseProvider.prototype.removeAllListeners = function (eventName) {
|
||||
var eventTag = getEventTag(eventName);
|
||||
this._events = this._events.filter(function (event) {
|
||||
return (event.tag !== eventTag);
|
||||
});
|
||||
if (eventName === 'pending') {
|
||||
if (eventName == null) {
|
||||
this._events = [];
|
||||
this._stopPending();
|
||||
}
|
||||
else {
|
||||
var eventTag_1 = getEventTag(eventName);
|
||||
this._events = this._events.filter(function (event) {
|
||||
return (event.tag !== eventTag_1);
|
||||
});
|
||||
if (eventName === 'pending') {
|
||||
this._stopPending();
|
||||
}
|
||||
}
|
||||
if (this._events.length === 0) {
|
||||
this.polling = false;
|
||||
}
|
||||
@@ -11239,13 +11274,13 @@ var BaseProvider = /** @class */ (function (_super) {
|
||||
var found = false;
|
||||
var eventTag = getEventTag(eventName);
|
||||
this._events = this._events.filter(function (event) {
|
||||
if (event.tag !== eventTag) {
|
||||
if (event.tag !== eventTag || event.listener != listener) {
|
||||
return true;
|
||||
}
|
||||
if (found) {
|
||||
return true;
|
||||
}
|
||||
found = false;
|
||||
found = true;
|
||||
return false;
|
||||
});
|
||||
if (eventName === 'pending' && this.listenerCount('pending') === 0) {
|
||||
@@ -11261,7 +11296,7 @@ var BaseProvider = /** @class */ (function (_super) {
|
||||
exports.BaseProvider = BaseProvider;
|
||||
properties_1.defineReadOnly(abstract_provider_1.Provider, 'inherits', properties_1.inheritable(abstract_provider_1.Provider));
|
||||
|
||||
},{"../errors":5,"../utils/address":59,"../utils/bignumber":62,"../utils/bytes":63,"../utils/hash":64,"../utils/networks":71,"../utils/properties":73,"../utils/rlp":75,"../utils/transaction":82,"../utils/utf8":84,"../utils/web":85,"./abstract-provider":49}],51:[function(require,module,exports){
|
||||
},{"../constants":3,"../errors":5,"../utils/address":59,"../utils/bignumber":62,"../utils/bytes":63,"../utils/hash":64,"../utils/networks":71,"../utils/properties":73,"../utils/rlp":75,"../utils/transaction":82,"../utils/utf8":84,"../utils/web":85,"./abstract-provider":49}],51:[function(require,module,exports){
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = Object.setPrototypeOf ||
|
||||
@@ -11789,6 +11824,9 @@ var InfuraProvider = /** @class */ (function (_super) {
|
||||
case 'rinkeby':
|
||||
host = 'rinkeby.infura.io';
|
||||
break;
|
||||
case 'goerli':
|
||||
host = 'goerli.infura.io';
|
||||
break;
|
||||
case 'kovan':
|
||||
host = 'kovan.infura.io';
|
||||
break;
|
||||
@@ -11806,6 +11844,7 @@ var InfuraProvider = /** @class */ (function (_super) {
|
||||
// Legacy API Access Token
|
||||
}
|
||||
else {
|
||||
errors.warn("The legacy INFURA apiAccesToken API is deprecated; please upgrade to a Project ID instead (see INFURA dshboard; https://infura.io)");
|
||||
_this = _super.call(this, 'https://' + host + '/' + projectId, standard) || this;
|
||||
properties_1.defineReadOnly(_this, 'apiAccessToken', projectId);
|
||||
properties_1.defineReadOnly(_this, 'projectId', null);
|
||||
@@ -11884,6 +11923,10 @@ function getLowerCase(value) {
|
||||
return value;
|
||||
}
|
||||
var _constructorGuard = {};
|
||||
// Some environments (Trust Wallet and company) use a global map
|
||||
// to track JSON-RPC ID, so we try to keep IDs unique across all
|
||||
// connections. See #489.
|
||||
var _nextId = 42;
|
||||
var JsonRpcSigner = /** @class */ (function (_super) {
|
||||
__extends(JsonRpcSigner, _super);
|
||||
function JsonRpcSigner(constructorGuard, provider, addressOrIndex) {
|
||||
@@ -11988,7 +12031,7 @@ var JsonRpcSigner = /** @class */ (function (_super) {
|
||||
}
|
||||
return _this.provider._wrapTransaction(tx, hash);
|
||||
});
|
||||
}, { onceBlock: _this.provider }).catch(function (error) {
|
||||
}, { fastRetry: 250, onceBlock: _this.provider }).catch(function (error) {
|
||||
error.transactionHash = hash;
|
||||
throw error;
|
||||
});
|
||||
@@ -12070,7 +12113,7 @@ var JsonRpcProvider = /** @class */ (function (_super) {
|
||||
var request = {
|
||||
method: method,
|
||||
params: params,
|
||||
id: 42,
|
||||
id: (_nextId++),
|
||||
jsonrpc: "2.0"
|
||||
};
|
||||
return web_1.fetchJson(this.connection, JSON.stringify(request), getResult).then(function (result) {
|
||||
@@ -12256,6 +12299,7 @@ utils.defineProperty(Web3Signer, 'onchange', {
|
||||
});
|
||||
|
||||
*/
|
||||
var _nextId = 42;
|
||||
var Web3Provider = /** @class */ (function (_super) {
|
||||
__extends(Web3Provider, _super);
|
||||
function Web3Provider(web3Provider, network) {
|
||||
@@ -12289,7 +12333,7 @@ var Web3Provider = /** @class */ (function (_super) {
|
||||
var request = {
|
||||
method: method,
|
||||
params: params,
|
||||
id: 42,
|
||||
id: (_nextId++),
|
||||
jsonrpc: "2.0"
|
||||
};
|
||||
_this._sendAsync(request, function (error, result) {
|
||||
@@ -12299,10 +12343,10 @@ var Web3Provider = /** @class */ (function (_super) {
|
||||
}
|
||||
if (result.error) {
|
||||
// @TODO: not any
|
||||
var error = new Error(result.error.message);
|
||||
error.code = result.error.code;
|
||||
error.data = result.error.data;
|
||||
reject(error);
|
||||
var error_1 = new Error(result.error.message);
|
||||
error_1.code = result.error.code;
|
||||
error_1.data = result.error.data;
|
||||
reject(error_1);
|
||||
return;
|
||||
}
|
||||
resolve(result.result);
|
||||
@@ -12796,7 +12840,7 @@ var CoderFixedBytes = /** @class */ (function (_super) {
|
||||
};
|
||||
CoderFixedBytes.prototype.decode = function (data, offset) {
|
||||
if (data.length < offset + 32) {
|
||||
errors.throwError('insufficient data for ' + name + ' type', errors.INVALID_ARGUMENT, {
|
||||
errors.throwError('insufficient data for ' + this.name + ' type', errors.INVALID_ARGUMENT, {
|
||||
arg: this.localName,
|
||||
coderType: this.name,
|
||||
value: bytes_1.hexlify(data.slice(offset, offset + 32))
|
||||
@@ -14250,7 +14294,7 @@ var HDNode = /** @class */ (function () {
|
||||
result = result._derive(index);
|
||||
}
|
||||
else {
|
||||
throw new Error('invlaid path component - ' + component);
|
||||
throw new Error('invalid path component - ' + component);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
@@ -14281,7 +14325,7 @@ function fromExtendedKey(extendedKey) {
|
||||
return new HDNode(_constructorGuard, null, bytes_1.hexlify(key), parentFingerprint, chainCode, index, depth, null, null);
|
||||
// Private Key
|
||||
case "0x0488ade4":
|
||||
case "0x04358394 ":
|
||||
case "0x04358394":
|
||||
if (key[0] !== 0) {
|
||||
break;
|
||||
}
|
||||
@@ -14302,8 +14346,8 @@ function _fromSeed(seed, mnemonic) {
|
||||
return new HDNode(_constructorGuard, bytes32(I.slice(0, 32)), null, "0x00000000", bytes32(I.slice(32)), 0, 0, mnemonic, 'm');
|
||||
}
|
||||
function fromMnemonic(mnemonic, wordlist, password) {
|
||||
// Check that the checksum s valid (will throw an error)
|
||||
mnemonicToEntropy(mnemonic, wordlist);
|
||||
// Normalize the mnemonic (also throws if the checksum is invalid)
|
||||
mnemonic = entropyToMnemonic(mnemonicToEntropy(mnemonic, wordlist), wordlist);
|
||||
return _fromSeed(mnemonicToSeed(mnemonic, password), mnemonic);
|
||||
}
|
||||
exports.fromMnemonic = fromMnemonic;
|
||||
@@ -14522,6 +14566,7 @@ exports.formatUnits = units_1.formatUnits;
|
||||
exports.parseUnits = units_1.parseUnits;
|
||||
var web_1 = require("./web");
|
||||
exports.fetchJson = web_1.fetchJson;
|
||||
exports.poll = web_1.poll;
|
||||
////////////////////////
|
||||
// Enums
|
||||
var hmac_1 = require("./hmac");
|
||||
@@ -15056,12 +15101,7 @@ var networks = {
|
||||
chainId: 5,
|
||||
ensAddress: "0x112234455c3a32fd11230c42e7bccd4a84e02010",
|
||||
name: "goerli",
|
||||
_defaultProvider: function (providers) {
|
||||
if (providers.EtherscanProvider) {
|
||||
return new providers.EtherscanProvider("goerli");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
_defaultProvider: ethDefaultProvider('goerli')
|
||||
},
|
||||
kovan: {
|
||||
chainId: 42,
|
||||
@@ -15470,7 +15510,7 @@ function _decode(data, offset) {
|
||||
else if (data[offset] >= 0x80) {
|
||||
var length = data[offset] - 0x80;
|
||||
if (offset + 1 + length > data.length) {
|
||||
throw new Error('invlaid rlp data');
|
||||
throw new Error('invalid rlp data');
|
||||
}
|
||||
var result = bytes_1.hexlify(data.slice(offset + 1, offset + 1 + length));
|
||||
return { consumed: (1 + length), result: result };
|
||||
@@ -15717,7 +15757,7 @@ function decrypt(json, password, progressCallback) {
|
||||
return null;
|
||||
}
|
||||
var signingKey = new signing_key_1.SigningKey(privateKey);
|
||||
if (signingKey.address !== address_1.getAddress(data.address)) {
|
||||
if (data.address && signingKey.address !== address_1.getAddress(data.address)) {
|
||||
reject(new Error('address mismatch'));
|
||||
return null;
|
||||
}
|
||||
@@ -16714,7 +16754,7 @@ function parseBytes32String(bytes) {
|
||||
throw new Error('invalid bytes32 - not 32 bytes long');
|
||||
}
|
||||
if (data[31] !== 0) {
|
||||
throw new Error('invalid bytes32 sdtring - no null terminator');
|
||||
throw new Error('invalid bytes32 string - no null terminator');
|
||||
}
|
||||
// Find the null termination
|
||||
var length = 31;
|
||||
@@ -16908,6 +16948,7 @@ function poll(func, options) {
|
||||
}
|
||||
}, options.timeout);
|
||||
}
|
||||
var fastTimeout = options.fastRetry || null;
|
||||
var attempt = 0;
|
||||
function check() {
|
||||
return func().then(function (result) {
|
||||
@@ -16930,6 +16971,12 @@ function poll(func, options) {
|
||||
if (timeout > options.ceiling) {
|
||||
timeout = options.ceiling;
|
||||
}
|
||||
// Fast Timeout, means we quickly try again the first time
|
||||
if (fastTimeout) {
|
||||
attempt--;
|
||||
timeout = fastTimeout;
|
||||
fastTimeout = null;
|
||||
}
|
||||
setTimeout(check, timeout);
|
||||
}
|
||||
return null;
|
||||
|
||||
2
dist/ethers.min.js
vendored
2
dist/ethers.min.js
vendored
File diff suppressed because one or more lines are too long
2
dist/ethers.min.js.map
vendored
2
dist/ethers.min.js.map
vendored
File diff suppressed because one or more lines are too long
14
dist/ethers.types.txt
vendored
14
dist/ethers.types.txt
vendored
@@ -26,7 +26,7 @@ declare module 'ethers/contract' {
|
||||
import { BigNumber } from 'ethers/utils/bignumber';
|
||||
import { Indexed, Interface } from 'ethers/utils/interface';
|
||||
import { UnsignedTransaction } from 'ethers/utils/transaction';
|
||||
import { Provider } from 'ethers/providers/abstract-provider';
|
||||
import { BlockTag, Provider } from 'ethers/providers/abstract-provider';
|
||||
import { Signer } from 'ethers/abstract-signer';
|
||||
import { Arrayish } from 'ethers/utils/bytes';
|
||||
import { ParamType } from 'ethers/utils/abi-coder';
|
||||
@@ -77,6 +77,7 @@ declare module 'ethers/contract' {
|
||||
readonly deployTransaction: TransactionResponse;
|
||||
constructor(addressOrName: string, contractInterface: Array<string | ParamType> | string | Interface, signerOrProvider: Signer | Provider);
|
||||
deployed(): Promise<Contract>;
|
||||
_deployed(blockTag?: BlockTag): Promise<Contract>;
|
||||
fallback(overrides?: TransactionRequest): Promise<TransactionResponse>;
|
||||
connect(signerOrProvider: Signer | Provider | string): Contract;
|
||||
attach(addressOrName: string): Contract;
|
||||
@@ -231,7 +232,7 @@ declare module 'ethers/utils' {
|
||||
import { parse as parseTransaction, serialize as serializeTransaction } from 'ethers/utils/transaction';
|
||||
import { formatBytes32String, parseBytes32String, toUtf8Bytes, toUtf8String } from 'ethers/utils/utf8';
|
||||
import { commify, formatEther, parseEther, formatUnits, parseUnits } from 'ethers/utils/units';
|
||||
import { fetchJson } from 'ethers/utils/web';
|
||||
import { fetchJson, poll } from 'ethers/utils/web';
|
||||
import { SupportedAlgorithms } from 'ethers/utils/hmac';
|
||||
import { UnicodeNormalizationForm } from 'ethers/utils/utf8';
|
||||
import { CoerceFunc, EventFragment, FunctionFragment, ParamType } from 'ethers/utils/abi-coder';
|
||||
@@ -243,7 +244,7 @@ declare module 'ethers/utils' {
|
||||
import { ConnectionInfo, OnceBlockable, PollOptions } from 'ethers/utils/web';
|
||||
import { EncryptOptions, ProgressCallback } from 'ethers/utils/secret-storage';
|
||||
import { Wordlist } from 'ethers/utils/wordlist';
|
||||
export { AbiCoder, defaultAbiCoder, formatSignature, formatParamType, parseSignature, parseParamType, RLP, fetchJson, getNetwork, checkProperties, deepCopy, defineReadOnly, resolveProperties, shallowCopy, arrayify, concat, padZeros, stripZeros, HDNode, SigningKey, Interface, base64, BigNumber, bigNumberify, hexlify, isHexString, hexStripZeros, hexZeroPad, hexDataLength, hexDataSlice, toUtf8Bytes, toUtf8String, formatBytes32String, parseBytes32String, hashMessage, namehash, id, getAddress, getIcapAddress, getContractAddress, formatEther, parseEther, formatUnits, parseUnits, commify, keccak256, sha256, randomBytes, solidityPack, solidityKeccak256, soliditySha256, splitSignature, joinSignature, parseTransaction, populateTransaction, serializeTransaction, getJsonWalletAddress, computeAddress, computePublicKey, recoverAddress, recoverPublicKey, verifyMessage, SupportedAlgorithms, UnicodeNormalizationForm, CoerceFunc, EventFragment, FunctionFragment, ParamType, BigNumberish, Arrayish, Hexable, Signature, Indexed, DeployDescription, EventDescription, FunctionDescription, LogDescription, TransactionDescription, Network, Networkish, Transaction, UnsignedTransaction, ConnectionInfo, OnceBlockable, PollOptions, EncryptOptions, ProgressCallback, Wordlist, };
|
||||
export { AbiCoder, defaultAbiCoder, formatSignature, formatParamType, parseSignature, parseParamType, RLP, fetchJson, getNetwork, checkProperties, deepCopy, defineReadOnly, resolveProperties, shallowCopy, arrayify, concat, padZeros, stripZeros, HDNode, SigningKey, Interface, base64, BigNumber, bigNumberify, hexlify, isHexString, hexStripZeros, hexZeroPad, hexDataLength, hexDataSlice, toUtf8Bytes, toUtf8String, formatBytes32String, parseBytes32String, hashMessage, namehash, id, getAddress, getIcapAddress, getContractAddress, formatEther, parseEther, formatUnits, parseUnits, commify, keccak256, sha256, randomBytes, solidityPack, solidityKeccak256, soliditySha256, splitSignature, joinSignature, parseTransaction, populateTransaction, serializeTransaction, getJsonWalletAddress, computeAddress, computePublicKey, recoverAddress, recoverPublicKey, verifyMessage, poll, SupportedAlgorithms, UnicodeNormalizationForm, CoerceFunc, EventFragment, FunctionFragment, ParamType, BigNumberish, Arrayish, Hexable, Signature, Indexed, DeployDescription, EventDescription, FunctionDescription, LogDescription, TransactionDescription, Network, Networkish, Transaction, UnsignedTransaction, ConnectionInfo, OnceBlockable, PollOptions, EncryptOptions, ProgressCallback, Wordlist, };
|
||||
}
|
||||
|
||||
declare module 'ethers/wordlists' {
|
||||
@@ -265,7 +266,7 @@ declare module 'ethers/utils/shims' {
|
||||
}
|
||||
|
||||
declare module 'ethers/_version' {
|
||||
export const version = "4.0.24";
|
||||
export const version = "4.0.38";
|
||||
}
|
||||
|
||||
declare module 'ethers/utils/bignumber' {
|
||||
@@ -563,7 +564,6 @@ declare module 'ethers/utils/bytes' {
|
||||
* Conversion Utilities
|
||||
*
|
||||
*/
|
||||
import { Arrayish } from 'ethers/utils/bytes';
|
||||
export type Arrayish = string | ArrayLike<number>;
|
||||
export interface Hexable {
|
||||
toHexString(): string;
|
||||
@@ -770,6 +770,7 @@ declare module 'ethers/providers/base-provider' {
|
||||
getTransactionReceipt(transactionHash: string): Promise<TransactionReceipt>;
|
||||
getLogs(filter: Filter | FilterByBlock): Promise<Array<Log>>;
|
||||
getEtherPrice(): Promise<number>;
|
||||
_getAddress(addressOrName: string): Promise<string>;
|
||||
resolveName(name: string | Promise<string>): Promise<string>;
|
||||
lookupAddress(address: string | Promise<string>): Promise<string>;
|
||||
static checkTransactionResponse(transaction: any): TransactionResponse;
|
||||
@@ -783,7 +784,7 @@ declare module 'ethers/providers/base-provider' {
|
||||
emit(eventName: EventType, ...args: Array<any>): boolean;
|
||||
listenerCount(eventName?: EventType): number;
|
||||
listeners(eventName: EventType): Array<Listener>;
|
||||
removeAllListeners(eventName: EventType): Provider;
|
||||
removeAllListeners(eventName?: EventType): Provider;
|
||||
removeListener(eventName: EventType, listener: Listener): Provider;
|
||||
}
|
||||
}
|
||||
@@ -1040,6 +1041,7 @@ declare module 'ethers/utils/web' {
|
||||
ceiling?: number;
|
||||
interval?: number;
|
||||
onceBlock?: OnceBlockable;
|
||||
fastRetry?: number;
|
||||
};
|
||||
export function fetchJson(connection: string | ConnectionInfo, json: string, processFunc: (value: any) => any): Promise<any>;
|
||||
export function poll(func: () => Promise<any>, options?: PollOptions): Promise<any>;
|
||||
|
||||
2
dist/shims.js
vendored
2
dist/shims.js
vendored
File diff suppressed because one or more lines are too long
2375
package-lock.json
generated
2375
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ethers",
|
||||
"version": "4.0.24",
|
||||
"version": "4.0.38",
|
||||
"description": "Ethereum wallet library.",
|
||||
"main": "./index.js",
|
||||
"types": "./index.d.ts",
|
||||
@@ -34,7 +34,7 @@
|
||||
"browserify": "^16.2.3",
|
||||
"browserify-zlib": "^0.2.0",
|
||||
"dts-bundle": "^0.7.3",
|
||||
"eslint": "^5.0.1",
|
||||
"eslint": "^5.16.0",
|
||||
"eslint-plugin-promise": "^3.8.0",
|
||||
"ethereumjs-tx": "^1.3.5",
|
||||
"ethereumjs-util": "^5.2.0",
|
||||
@@ -64,5 +64,6 @@
|
||||
"type": "git",
|
||||
"url": "git://github.com/ethers-io/ethers.js.git"
|
||||
},
|
||||
"ethereum": "donations.ethers.eth",
|
||||
"license": "MIT"
|
||||
}
|
||||
|
||||
3
providers/base-provider.d.ts
vendored
3
providers/base-provider.d.ts
vendored
@@ -53,6 +53,7 @@ export declare class BaseProvider extends Provider {
|
||||
getTransactionReceipt(transactionHash: string): Promise<TransactionReceipt>;
|
||||
getLogs(filter: Filter | FilterByBlock): Promise<Array<Log>>;
|
||||
getEtherPrice(): Promise<number>;
|
||||
_getAddress(addressOrName: string): Promise<string>;
|
||||
private _resolveNames;
|
||||
private _getResolver;
|
||||
resolveName(name: string | Promise<string>): Promise<string>;
|
||||
@@ -69,6 +70,6 @@ export declare class BaseProvider extends Provider {
|
||||
emit(eventName: EventType, ...args: Array<any>): boolean;
|
||||
listenerCount(eventName?: EventType): number;
|
||||
listeners(eventName: EventType): Array<Listener>;
|
||||
removeAllListeners(eventName: EventType): Provider;
|
||||
removeAllListeners(eventName?: EventType): Provider;
|
||||
removeListener(eventName: EventType, listener: Listener): Provider;
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var address_1 = require("../utils/address");
|
||||
var bignumber_1 = require("../utils/bignumber");
|
||||
var bytes_1 = require("../utils/bytes");
|
||||
var constants_1 = require("../constants");
|
||||
var hash_1 = require("../utils/hash");
|
||||
var networks_1 = require("../utils/networks");
|
||||
var properties_1 = require("../utils/properties");
|
||||
@@ -656,17 +657,21 @@ var BaseProvider = /** @class */ (function (_super) {
|
||||
if (confirmations == null) {
|
||||
confirmations = 1;
|
||||
}
|
||||
return web_1.poll(function () {
|
||||
return _this.getTransactionReceipt(transactionHash).then(function (receipt) {
|
||||
if (confirmations === 0) {
|
||||
return receipt;
|
||||
}
|
||||
if (receipt == null || receipt.confirmations < confirmations) {
|
||||
return undefined;
|
||||
}
|
||||
return this.getTransactionReceipt(transactionHash).then(function (receipt) {
|
||||
if (confirmations === 0 || (receipt && receipt.confirmations >= confirmations)) {
|
||||
return receipt;
|
||||
});
|
||||
}, { onceBlock: this });
|
||||
}
|
||||
return (new Promise(function (resolve) {
|
||||
var handler = function (receipt) {
|
||||
if (receipt.confirmations < confirmations) {
|
||||
return;
|
||||
}
|
||||
_this.removeListener(transactionHash, handler);
|
||||
resolve(receipt);
|
||||
};
|
||||
_this.on(transactionHash, handler);
|
||||
}));
|
||||
});
|
||||
};
|
||||
BaseProvider.prototype.getBlockNumber = function () {
|
||||
var _this = this;
|
||||
@@ -694,7 +699,7 @@ var BaseProvider = /** @class */ (function (_super) {
|
||||
return this.ready.then(function () {
|
||||
return properties_1.resolveProperties({ addressOrName: addressOrName, blockTag: blockTag }).then(function (_a) {
|
||||
var addressOrName = _a.addressOrName, blockTag = _a.blockTag;
|
||||
return _this.resolveName(addressOrName).then(function (address) {
|
||||
return _this._getAddress(addressOrName).then(function (address) {
|
||||
var params = { address: address, blockTag: checkBlockTag(blockTag) };
|
||||
return _this.perform('getBalance', params).then(function (result) {
|
||||
return bignumber_1.bigNumberify(result);
|
||||
@@ -708,7 +713,7 @@ var BaseProvider = /** @class */ (function (_super) {
|
||||
return this.ready.then(function () {
|
||||
return properties_1.resolveProperties({ addressOrName: addressOrName, blockTag: blockTag }).then(function (_a) {
|
||||
var addressOrName = _a.addressOrName, blockTag = _a.blockTag;
|
||||
return _this.resolveName(addressOrName).then(function (address) {
|
||||
return _this._getAddress(addressOrName).then(function (address) {
|
||||
var params = { address: address, blockTag: checkBlockTag(blockTag) };
|
||||
return _this.perform('getTransactionCount', params).then(function (result) {
|
||||
return bignumber_1.bigNumberify(result).toNumber();
|
||||
@@ -722,7 +727,7 @@ var BaseProvider = /** @class */ (function (_super) {
|
||||
return this.ready.then(function () {
|
||||
return properties_1.resolveProperties({ addressOrName: addressOrName, blockTag: blockTag }).then(function (_a) {
|
||||
var addressOrName = _a.addressOrName, blockTag = _a.blockTag;
|
||||
return _this.resolveName(addressOrName).then(function (address) {
|
||||
return _this._getAddress(addressOrName).then(function (address) {
|
||||
var params = { address: address, blockTag: checkBlockTag(blockTag) };
|
||||
return _this.perform('getCode', params).then(function (result) {
|
||||
return bytes_1.hexlify(result);
|
||||
@@ -736,7 +741,7 @@ var BaseProvider = /** @class */ (function (_super) {
|
||||
return this.ready.then(function () {
|
||||
return properties_1.resolveProperties({ addressOrName: addressOrName, position: position, blockTag: blockTag }).then(function (_a) {
|
||||
var addressOrName = _a.addressOrName, position = _a.position, blockTag = _a.blockTag;
|
||||
return _this.resolveName(addressOrName).then(function (address) {
|
||||
return _this._getAddress(addressOrName).then(function (address) {
|
||||
var params = {
|
||||
address: address,
|
||||
blockTag: checkBlockTag(blockTag),
|
||||
@@ -979,6 +984,14 @@ var BaseProvider = /** @class */ (function (_super) {
|
||||
});
|
||||
});
|
||||
};
|
||||
BaseProvider.prototype._getAddress = function (addressOrName) {
|
||||
return this.resolveName(addressOrName).then(function (address) {
|
||||
if (address == null) {
|
||||
errors.throwError("ENS name not configured", errors.UNSUPPORTED_OPERATION, { operation: "resolveName(" + JSON.stringify(addressOrName) + ")" });
|
||||
}
|
||||
return address;
|
||||
});
|
||||
};
|
||||
// @TODO: Could probably use resolveProperties instead?
|
||||
BaseProvider.prototype._resolveNames = function (object, keys) {
|
||||
var promises = [];
|
||||
@@ -987,7 +1000,7 @@ var BaseProvider = /** @class */ (function (_super) {
|
||||
if (result[key] == null) {
|
||||
return;
|
||||
}
|
||||
promises.push(this.resolveName(result[key]).then(function (address) {
|
||||
promises.push(this._getAddress(result[key]).then(function (address) {
|
||||
result[key] = address;
|
||||
return;
|
||||
}));
|
||||
@@ -1000,7 +1013,7 @@ var BaseProvider = /** @class */ (function (_super) {
|
||||
return this.getNetwork().then(function (network) {
|
||||
// No ENS...
|
||||
if (!network.ensAddress) {
|
||||
errors.throwError('network does support ENS', errors.UNSUPPORTED_OPERATION, { operation: 'ENS', network: network.name });
|
||||
errors.throwError('network does not support ENS', errors.UNSUPPORTED_OPERATION, { operation: 'ENS', network: network.name });
|
||||
}
|
||||
// keccak256('resolver(bytes32)')
|
||||
var data = '0x0178b8bf' + hash_1.namehash(name).substring(2);
|
||||
@@ -1010,7 +1023,11 @@ var BaseProvider = /** @class */ (function (_super) {
|
||||
if (bytes_1.hexDataLength(data) !== 32) {
|
||||
return null;
|
||||
}
|
||||
return address_1.getAddress(bytes_1.hexDataSlice(data, 12));
|
||||
var address = address_1.getAddress(bytes_1.hexDataSlice(data, 12));
|
||||
if (address === constants_1.AddressZero) {
|
||||
return null;
|
||||
}
|
||||
return address;
|
||||
});
|
||||
});
|
||||
};
|
||||
@@ -1031,6 +1048,9 @@ var BaseProvider = /** @class */ (function (_super) {
|
||||
var nodeHash = hash_1.namehash(name);
|
||||
// Get the addr from the resovler
|
||||
return this._getResolver(name).then(function (resolverAddress) {
|
||||
if (resolverAddress == null) {
|
||||
return null;
|
||||
}
|
||||
// keccak256('addr(bytes32)')
|
||||
var data = '0x3b3b57de' + nodeHash.substring(2);
|
||||
var transaction = { to: resolverAddress, data: data };
|
||||
@@ -1041,7 +1061,7 @@ var BaseProvider = /** @class */ (function (_super) {
|
||||
return null;
|
||||
}
|
||||
var address = address_1.getAddress(bytes_1.hexDataSlice(data, 12));
|
||||
if (address === '0x0000000000000000000000000000000000000000') {
|
||||
if (address === constants_1.AddressZero) {
|
||||
return null;
|
||||
}
|
||||
return address;
|
||||
@@ -1067,6 +1087,9 @@ var BaseProvider = /** @class */ (function (_super) {
|
||||
var transaction = { to: resolverAddress, data: data };
|
||||
return self.call(transaction);
|
||||
}).then(function (data) {
|
||||
if (data == null) {
|
||||
return null;
|
||||
}
|
||||
// Strip off the "0x"
|
||||
data = data.substring(2);
|
||||
// Strip off the dynamic string pointer (0x20)
|
||||
@@ -1169,13 +1192,19 @@ var BaseProvider = /** @class */ (function (_super) {
|
||||
});
|
||||
};
|
||||
BaseProvider.prototype.removeAllListeners = function (eventName) {
|
||||
var eventTag = getEventTag(eventName);
|
||||
this._events = this._events.filter(function (event) {
|
||||
return (event.tag !== eventTag);
|
||||
});
|
||||
if (eventName === 'pending') {
|
||||
if (eventName == null) {
|
||||
this._events = [];
|
||||
this._stopPending();
|
||||
}
|
||||
else {
|
||||
var eventTag_1 = getEventTag(eventName);
|
||||
this._events = this._events.filter(function (event) {
|
||||
return (event.tag !== eventTag_1);
|
||||
});
|
||||
if (eventName === 'pending') {
|
||||
this._stopPending();
|
||||
}
|
||||
}
|
||||
if (this._events.length === 0) {
|
||||
this.polling = false;
|
||||
}
|
||||
@@ -1185,13 +1214,13 @@ var BaseProvider = /** @class */ (function (_super) {
|
||||
var found = false;
|
||||
var eventTag = getEventTag(eventName);
|
||||
this._events = this._events.filter(function (event) {
|
||||
if (event.tag !== eventTag) {
|
||||
if (event.tag !== eventTag || event.listener != listener) {
|
||||
return true;
|
||||
}
|
||||
if (found) {
|
||||
return true;
|
||||
}
|
||||
found = false;
|
||||
found = true;
|
||||
return false;
|
||||
});
|
||||
if (eventName === 'pending' && this.listenerCount('pending') === 0) {
|
||||
|
||||
@@ -42,6 +42,9 @@ var InfuraProvider = /** @class */ (function (_super) {
|
||||
case 'rinkeby':
|
||||
host = 'rinkeby.infura.io';
|
||||
break;
|
||||
case 'goerli':
|
||||
host = 'goerli.infura.io';
|
||||
break;
|
||||
case 'kovan':
|
||||
host = 'kovan.infura.io';
|
||||
break;
|
||||
@@ -59,6 +62,7 @@ var InfuraProvider = /** @class */ (function (_super) {
|
||||
// Legacy API Access Token
|
||||
}
|
||||
else {
|
||||
errors.warn("The legacy INFURA apiAccesToken API is deprecated; please upgrade to a Project ID instead (see INFURA dshboard; https://infura.io)");
|
||||
_this = _super.call(this, 'https://' + host + '/' + projectId, standard) || this;
|
||||
properties_1.defineReadOnly(_this, 'apiAccessToken', projectId);
|
||||
properties_1.defineReadOnly(_this, 'projectId', null);
|
||||
|
||||
@@ -51,6 +51,10 @@ function getLowerCase(value) {
|
||||
return value;
|
||||
}
|
||||
var _constructorGuard = {};
|
||||
// Some environments (Trust Wallet and company) use a global map
|
||||
// to track JSON-RPC ID, so we try to keep IDs unique across all
|
||||
// connections. See #489.
|
||||
var _nextId = 42;
|
||||
var JsonRpcSigner = /** @class */ (function (_super) {
|
||||
__extends(JsonRpcSigner, _super);
|
||||
function JsonRpcSigner(constructorGuard, provider, addressOrIndex) {
|
||||
@@ -155,7 +159,7 @@ var JsonRpcSigner = /** @class */ (function (_super) {
|
||||
}
|
||||
return _this.provider._wrapTransaction(tx, hash);
|
||||
});
|
||||
}, { onceBlock: _this.provider }).catch(function (error) {
|
||||
}, { fastRetry: 250, onceBlock: _this.provider }).catch(function (error) {
|
||||
error.transactionHash = hash;
|
||||
throw error;
|
||||
});
|
||||
@@ -237,7 +241,7 @@ var JsonRpcProvider = /** @class */ (function (_super) {
|
||||
var request = {
|
||||
method: method,
|
||||
params: params,
|
||||
id: 42,
|
||||
id: (_nextId++),
|
||||
jsonrpc: "2.0"
|
||||
};
|
||||
return web_1.fetchJson(this.connection, JSON.stringify(request), getResult).then(function (result) {
|
||||
|
||||
@@ -27,6 +27,7 @@ utils.defineProperty(Web3Signer, 'onchange', {
|
||||
});
|
||||
|
||||
*/
|
||||
var _nextId = 42;
|
||||
var Web3Provider = /** @class */ (function (_super) {
|
||||
__extends(Web3Provider, _super);
|
||||
function Web3Provider(web3Provider, network) {
|
||||
@@ -60,7 +61,7 @@ var Web3Provider = /** @class */ (function (_super) {
|
||||
var request = {
|
||||
method: method,
|
||||
params: params,
|
||||
id: 42,
|
||||
id: (_nextId++),
|
||||
jsonrpc: "2.0"
|
||||
};
|
||||
_this._sendAsync(request, function (error, result) {
|
||||
@@ -70,10 +71,10 @@ var Web3Provider = /** @class */ (function (_super) {
|
||||
}
|
||||
if (result.error) {
|
||||
// @TODO: not any
|
||||
var error = new Error(result.error.message);
|
||||
error.code = result.error.code;
|
||||
error.data = result.error.data;
|
||||
reject(error);
|
||||
var error_1 = new Error(result.error.message);
|
||||
error_1.code = result.error.code;
|
||||
error_1.data = result.error.data;
|
||||
reject(error_1);
|
||||
return;
|
||||
}
|
||||
resolve(result.result);
|
||||
|
||||
@@ -1 +1 @@
|
||||
export const version = "4.0.24";
|
||||
export const version = "4.0.38";
|
||||
|
||||
@@ -262,7 +262,7 @@ function runMethod(contract: Contract, functionName: string, estimateOnly: boole
|
||||
}
|
||||
|
||||
if (!contract.signer) {
|
||||
errors.throwError('sending a transaction require a signer', errors.UNSUPPORTED_OPERATION, { operation: 'sendTransaction' })
|
||||
errors.throwError('sending a transaction requires a signer', errors.UNSUPPORTED_OPERATION, { operation: 'sendTransaction' })
|
||||
}
|
||||
|
||||
// Make sure they aren't overriding something they shouldn't
|
||||
@@ -478,7 +478,7 @@ export class Contract {
|
||||
|
||||
fallback(overrides?: TransactionRequest): Promise<TransactionResponse> {
|
||||
if (!this.signer) {
|
||||
errors.throwError('sending a transaction require a signer', errors.UNSUPPORTED_OPERATION, { operation: 'sendTransaction(fallback)' })
|
||||
errors.throwError('sending a transaction requires a signer', errors.UNSUPPORTED_OPERATION, { operation: 'sendTransaction(fallback)' })
|
||||
}
|
||||
|
||||
var tx: TransactionRequest = shallowCopy(overrides || {});
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
import { getAddress, getContractAddress } from '../utils/address';
|
||||
import { BigNumber, bigNumberify } from '../utils/bignumber';
|
||||
import { hexDataLength, hexDataSlice, hexlify, hexStripZeros, isHexString, stripZeros } from '../utils/bytes';
|
||||
import { AddressZero } from "../constants";
|
||||
import { namehash } from '../utils/hash';
|
||||
import { getNetwork } from '../utils/networks';
|
||||
import { defineReadOnly, inheritable, resolveProperties, shallowCopy } from '../utils/properties';
|
||||
@@ -776,15 +777,21 @@ export class BaseProvider extends Provider {
|
||||
|
||||
waitForTransaction(transactionHash: string, confirmations?: number): Promise<TransactionReceipt> {
|
||||
if (confirmations == null) { confirmations = 1; }
|
||||
return poll(() => {
|
||||
return this.getTransactionReceipt(transactionHash).then((receipt) => {
|
||||
if (confirmations === 0) { return receipt; }
|
||||
if (receipt == null || receipt.confirmations < confirmations) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return this.getTransactionReceipt(transactionHash).then((receipt) => {
|
||||
if (confirmations === 0 || (receipt && receipt.confirmations >= confirmations)) {
|
||||
return receipt;
|
||||
});
|
||||
}, { onceBlock: this });
|
||||
}
|
||||
|
||||
return <Promise<TransactionReceipt>>(new Promise((resolve) => {
|
||||
let handler = (receipt: TransactionReceipt) => {
|
||||
if (receipt.confirmations < confirmations) { return; }
|
||||
this.removeListener(transactionHash, handler);
|
||||
resolve(receipt);
|
||||
}
|
||||
this.on(transactionHash, handler);
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
getBlockNumber(): Promise<number> {
|
||||
@@ -810,7 +817,7 @@ export class BaseProvider extends Provider {
|
||||
getBalance(addressOrName: string | Promise<string>, blockTag?: BlockTag | Promise<BlockTag>): Promise<BigNumber> {
|
||||
return this.ready.then(() => {
|
||||
return resolveProperties({ addressOrName: addressOrName, blockTag: blockTag }).then(({ addressOrName, blockTag }) => {
|
||||
return this.resolveName(addressOrName).then((address) => {
|
||||
return this._getAddress(addressOrName).then((address) => {
|
||||
let params = { address: address, blockTag: checkBlockTag(blockTag) };
|
||||
return this.perform('getBalance', params).then((result) => {
|
||||
return bigNumberify(result);
|
||||
@@ -823,7 +830,7 @@ export class BaseProvider extends Provider {
|
||||
getTransactionCount(addressOrName: string | Promise<string>, blockTag?: BlockTag | Promise<BlockTag>): Promise<number> {
|
||||
return this.ready.then(() => {
|
||||
return resolveProperties({ addressOrName: addressOrName, blockTag: blockTag }).then(({ addressOrName, blockTag }) => {
|
||||
return this.resolveName(addressOrName).then((address) => {
|
||||
return this._getAddress(addressOrName).then((address) => {
|
||||
let params = { address: address, blockTag: checkBlockTag(blockTag) };
|
||||
return this.perform('getTransactionCount', params).then((result) => {
|
||||
return bigNumberify(result).toNumber();
|
||||
@@ -836,7 +843,7 @@ export class BaseProvider extends Provider {
|
||||
getCode(addressOrName: string | Promise<string>, blockTag?: BlockTag | Promise<BlockTag>): Promise<string> {
|
||||
return this.ready.then(() => {
|
||||
return resolveProperties({ addressOrName: addressOrName, blockTag: blockTag }).then(({ addressOrName, blockTag }) => {
|
||||
return this.resolveName(addressOrName).then((address) => {
|
||||
return this._getAddress(addressOrName).then((address) => {
|
||||
let params = {address: address, blockTag: checkBlockTag(blockTag)};
|
||||
return this.perform('getCode', params).then((result) => {
|
||||
return hexlify(result);
|
||||
@@ -849,7 +856,7 @@ export class BaseProvider extends Provider {
|
||||
getStorageAt(addressOrName: string | Promise<string>, position: BigNumberish | Promise<BigNumberish>, blockTag?: BlockTag | Promise<BlockTag>): Promise<string> {
|
||||
return this.ready.then(() => {
|
||||
return resolveProperties({ addressOrName: addressOrName, position: position, blockTag: blockTag }).then(({ addressOrName, position, blockTag }) => {
|
||||
return this.resolveName(addressOrName).then((address) => {
|
||||
return this._getAddress(addressOrName).then((address) => {
|
||||
let params = {
|
||||
address: address,
|
||||
blockTag: checkBlockTag(blockTag),
|
||||
@@ -1102,6 +1109,15 @@ export class BaseProvider extends Provider {
|
||||
});
|
||||
}
|
||||
|
||||
_getAddress(addressOrName: string): Promise<string> {
|
||||
return this.resolveName(addressOrName).then((address) => {
|
||||
if (address == null) {
|
||||
errors.throwError("ENS name not configured", errors.UNSUPPORTED_OPERATION, { operation: "resolveName(" + JSON.stringify(addressOrName) + ")" });
|
||||
}
|
||||
return address;
|
||||
});
|
||||
}
|
||||
|
||||
// @TODO: Could probably use resolveProperties instead?
|
||||
private _resolveNames(object: any, keys: Array<string>): Promise<{ [key: string]: string }> {
|
||||
let promises: Array<Promise<void>> = [];
|
||||
@@ -1110,7 +1126,7 @@ export class BaseProvider extends Provider {
|
||||
|
||||
keys.forEach(function(key) {
|
||||
if (result[key] == null) { return; }
|
||||
promises.push(this.resolveName(result[key]).then((address: string) => {
|
||||
promises.push(this._getAddress(result[key]).then((address: string) => {
|
||||
result[key] = address;
|
||||
return;
|
||||
}));
|
||||
@@ -1126,7 +1142,7 @@ export class BaseProvider extends Provider {
|
||||
// No ENS...
|
||||
if (!network.ensAddress) {
|
||||
errors.throwError(
|
||||
'network does support ENS',
|
||||
'network does not support ENS',
|
||||
errors.UNSUPPORTED_OPERATION,
|
||||
{ operation: 'ENS', network: network.name }
|
||||
);
|
||||
@@ -1137,10 +1153,11 @@ export class BaseProvider extends Provider {
|
||||
let transaction = { to: network.ensAddress, data: data };
|
||||
|
||||
return this.call(transaction).then((data) => {
|
||||
|
||||
// extract the address from the data
|
||||
if (hexDataLength(data) !== 32) { return null; }
|
||||
return getAddress(hexDataSlice(data, 12));
|
||||
let address = getAddress(hexDataSlice(data, 12));
|
||||
if (address === AddressZero) { return null; }
|
||||
return address;
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -1165,6 +1182,7 @@ export class BaseProvider extends Provider {
|
||||
|
||||
// Get the addr from the resovler
|
||||
return this._getResolver(name).then(function(resolverAddress) {
|
||||
if (resolverAddress == null) { return null; }
|
||||
|
||||
// keccak256('addr(bytes32)')
|
||||
let data = '0x3b3b57de' + nodeHash.substring(2);
|
||||
@@ -1175,7 +1193,7 @@ export class BaseProvider extends Provider {
|
||||
}).then(function(data) {
|
||||
if (hexDataLength(data) !== 32) { return null; }
|
||||
let address = getAddress(hexDataSlice(data, 12));
|
||||
if (address === '0x0000000000000000000000000000000000000000') { return null; }
|
||||
if (address === AddressZero) { return null; }
|
||||
return address;
|
||||
});
|
||||
}
|
||||
@@ -1203,6 +1221,8 @@ export class BaseProvider extends Provider {
|
||||
return self.call(transaction);
|
||||
|
||||
}).then(function(data) {
|
||||
if (data == null) { return null; }
|
||||
|
||||
// Strip off the "0x"
|
||||
data = data.substring(2);
|
||||
|
||||
@@ -1306,13 +1326,18 @@ export class BaseProvider extends Provider {
|
||||
});
|
||||
}
|
||||
|
||||
removeAllListeners(eventName: EventType): Provider {
|
||||
let eventTag = getEventTag(eventName);
|
||||
this._events = this._events.filter((event) => {
|
||||
return (event.tag !== eventTag);
|
||||
});
|
||||
removeAllListeners(eventName?: EventType): Provider {
|
||||
if (eventName == null) {
|
||||
this._events = [ ];
|
||||
this._stopPending();
|
||||
} else {
|
||||
let eventTag = getEventTag(eventName);
|
||||
this._events = this._events.filter((event) => {
|
||||
return (event.tag !== eventTag);
|
||||
});
|
||||
if (eventName === 'pending') { this._stopPending(); }
|
||||
}
|
||||
|
||||
if (eventName === 'pending') { this._stopPending(); }
|
||||
if (this._events.length === 0) { this.polling = false; }
|
||||
|
||||
return this;
|
||||
@@ -1323,9 +1348,9 @@ export class BaseProvider extends Provider {
|
||||
|
||||
let eventTag = getEventTag(eventName);
|
||||
this._events = this._events.filter((event) => {
|
||||
if (event.tag !== eventTag) { return true; }
|
||||
if (event.tag !== eventTag || event.listener != listener) { return true; }
|
||||
if (found) { return true; }
|
||||
found = false;
|
||||
found = true;
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
@@ -32,6 +32,9 @@ export class InfuraProvider extends JsonRpcProvider {
|
||||
case 'rinkeby':
|
||||
host = 'rinkeby.infura.io';
|
||||
break;
|
||||
case 'goerli':
|
||||
host = 'goerli.infura.io';
|
||||
break;
|
||||
case 'kovan':
|
||||
host = 'kovan.infura.io';
|
||||
break;
|
||||
@@ -50,6 +53,7 @@ export class InfuraProvider extends JsonRpcProvider {
|
||||
|
||||
// Legacy API Access Token
|
||||
} else {
|
||||
errors.warn("The legacy INFURA apiAccesToken API is deprecated; please upgrade to a Project ID instead (see INFURA dshboard; https://infura.io)");
|
||||
super('https://' + host + '/' + projectId, standard);
|
||||
defineReadOnly(this, 'apiAccessToken', projectId);
|
||||
defineReadOnly(this, 'projectId', null);
|
||||
|
||||
@@ -50,6 +50,11 @@ function getLowerCase(value: string): string {
|
||||
|
||||
const _constructorGuard = {};
|
||||
|
||||
// Some environments (Trust Wallet and company) use a global map
|
||||
// to track JSON-RPC ID, so we try to keep IDs unique across all
|
||||
// connections. See #489.
|
||||
let _nextId = 42;
|
||||
|
||||
export class JsonRpcSigner extends Signer {
|
||||
readonly provider: JsonRpcProvider;
|
||||
private _index: number;
|
||||
@@ -158,7 +163,7 @@ export class JsonRpcSigner extends Signer {
|
||||
if (tx === null) { return undefined; }
|
||||
return this.provider._wrapTransaction(tx, hash);
|
||||
});
|
||||
}, { onceBlock: this.provider }).catch((error: Error) => {
|
||||
}, { fastRetry: 250, onceBlock: this.provider }).catch((error: Error) => {
|
||||
(<any>error).transactionHash = hash;
|
||||
throw error;
|
||||
});
|
||||
@@ -250,7 +255,7 @@ export class JsonRpcProvider extends BaseProvider {
|
||||
let request = {
|
||||
method: method,
|
||||
params: params,
|
||||
id: 42,
|
||||
id: (_nextId++),
|
||||
jsonrpc: "2.0"
|
||||
};
|
||||
|
||||
|
||||
@@ -27,6 +27,8 @@ utils.defineProperty(Web3Signer, 'onchange', {
|
||||
|
||||
*/
|
||||
|
||||
let _nextId = 42;
|
||||
|
||||
export class Web3Provider extends JsonRpcProvider {
|
||||
readonly _web3Provider: AsyncSendable;
|
||||
private _sendAsync: (request: any, callback: (error: any, response: any) => void) => void;
|
||||
@@ -65,10 +67,10 @@ export class Web3Provider extends JsonRpcProvider {
|
||||
}
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
var request = {
|
||||
let request = {
|
||||
method: method,
|
||||
params: params,
|
||||
id: 42,
|
||||
id: (_nextId++),
|
||||
jsonrpc: "2.0"
|
||||
};
|
||||
|
||||
@@ -80,7 +82,7 @@ export class Web3Provider extends JsonRpcProvider {
|
||||
|
||||
if (result.error) {
|
||||
// @TODO: not any
|
||||
var error: any = new Error(result.error.message);
|
||||
let error: any = new Error(result.error.message);
|
||||
error.code = result.error.code;
|
||||
error.data = result.error.data;
|
||||
reject(error);
|
||||
|
||||
@@ -574,7 +574,7 @@ class CoderFixedBytes extends Coder {
|
||||
|
||||
decode(data: Uint8Array, offset: number): DecodedResult {
|
||||
if (data.length < offset + 32) {
|
||||
errors.throwError('insufficient data for ' + name + ' type', errors.INVALID_ARGUMENT, {
|
||||
errors.throwError('insufficient data for ' + this.name + ' type', errors.INVALID_ARGUMENT, {
|
||||
arg: this.localName,
|
||||
coderType: this.name,
|
||||
value: hexlify(data.slice(offset, offset + 32))
|
||||
|
||||
@@ -5,11 +5,6 @@
|
||||
|
||||
import * as errors from '../errors';
|
||||
|
||||
///////////////////////////////
|
||||
// Imported Types
|
||||
|
||||
import { Arrayish } from './bytes';
|
||||
|
||||
///////////////////////////////
|
||||
// Exported Types
|
||||
|
||||
|
||||
@@ -206,7 +206,7 @@ export class HDNode {
|
||||
if (index >= HardenedBit) { throw new Error('invalid path index - ' + component); }
|
||||
result = result._derive(index);
|
||||
} else {
|
||||
throw new Error('invlaid path component - ' + component);
|
||||
throw new Error('invalid path component - ' + component);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -240,7 +240,7 @@ export function fromExtendedKey(extendedKey: string): HDNode {
|
||||
return new HDNode(_constructorGuard, null, hexlify(key), parentFingerprint, chainCode, index, depth, null, null);
|
||||
|
||||
// Private Key
|
||||
case "0x0488ade4": case "0x04358394 ":
|
||||
case "0x0488ade4": case "0x04358394":
|
||||
if (key[0] !== 0) { break; }
|
||||
return new HDNode(_constructorGuard, hexlify(key.slice(1)), null, parentFingerprint, chainCode, index, depth, null, null);
|
||||
}
|
||||
@@ -261,8 +261,8 @@ function _fromSeed(seed: Arrayish, mnemonic: string): HDNode {
|
||||
}
|
||||
|
||||
export function fromMnemonic(mnemonic: string, wordlist?: Wordlist, password?: string): HDNode {
|
||||
// Check that the checksum s valid (will throw an error)
|
||||
mnemonicToEntropy(mnemonic, wordlist);
|
||||
// Normalize the mnemonic (also throws if the checksum is invalid)
|
||||
mnemonic = entropyToMnemonic(mnemonicToEntropy(mnemonic, wordlist), wordlist);
|
||||
|
||||
return _fromSeed(mnemonicToSeed(mnemonic, password), mnemonic);
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ import { populateTransaction } from './transaction';
|
||||
import { parse as parseTransaction, serialize as serializeTransaction } from './transaction';
|
||||
import { formatBytes32String, parseBytes32String, toUtf8Bytes, toUtf8String } from './utf8';
|
||||
import { commify, formatEther, parseEther, formatUnits, parseUnits } from './units';
|
||||
import { fetchJson } from './web';
|
||||
import { fetchJson, poll } from './web';
|
||||
|
||||
|
||||
////////////////////////
|
||||
@@ -136,6 +136,8 @@ export {
|
||||
recoverPublicKey,
|
||||
verifyMessage,
|
||||
|
||||
poll,
|
||||
|
||||
|
||||
////////////////////////
|
||||
// Enums
|
||||
|
||||
@@ -86,12 +86,7 @@ const networks: { [name: string]: Network } = {
|
||||
chainId: 5,
|
||||
ensAddress: "0x112234455c3a32fd11230c42e7bccd4a84e02010",
|
||||
name: "goerli",
|
||||
_defaultProvider: (providers: any): any => {
|
||||
if (providers.EtherscanProvider) {
|
||||
return new providers.EtherscanProvider("goerli");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
_defaultProvider: ethDefaultProvider('goerli')
|
||||
},
|
||||
|
||||
kovan: {
|
||||
|
||||
@@ -127,7 +127,7 @@ function _decode(data: Uint8Array, offset: number): { consumed: number, result:
|
||||
} else if (data[offset] >= 0x80) {
|
||||
var length = data[offset] - 0x80;
|
||||
if (offset + 1 + length > data.length) {
|
||||
throw new Error('invlaid rlp data');
|
||||
throw new Error('invalid rlp data');
|
||||
}
|
||||
|
||||
var result = hexlify(data.slice(offset + 1, offset + 1 + length));
|
||||
|
||||
@@ -171,7 +171,7 @@ export function decrypt(json: string, password: Arrayish, progressCallback?: Pro
|
||||
}
|
||||
|
||||
var signingKey = new SigningKey(privateKey);
|
||||
if (signingKey.address !== getAddress(data.address)) {
|
||||
if (data.address && signingKey.address !== getAddress(data.address)) {
|
||||
reject(new Error('address mismatch'));
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -190,7 +190,7 @@ export function parseBytes32String(bytes: Arrayish): string {
|
||||
|
||||
// Must be 32 bytes with a null-termination
|
||||
if (data.length !== 32) { throw new Error('invalid bytes32 - not 32 bytes long'); }
|
||||
if (data[31] !== 0) { throw new Error('invalid bytes32 sdtring - no null terminator'); }
|
||||
if (data[31] !== 0) { throw new Error('invalid bytes32 string - no null terminator'); }
|
||||
|
||||
// Find the null termination
|
||||
let length = 31;
|
||||
|
||||
@@ -28,7 +28,8 @@ export type PollOptions = {
|
||||
floor?: number,
|
||||
ceiling?: number,
|
||||
interval?: number,
|
||||
onceBlock?: OnceBlockable
|
||||
onceBlock?: OnceBlockable,
|
||||
fastRetry?: number
|
||||
};
|
||||
|
||||
|
||||
@@ -208,6 +209,8 @@ export function poll(func: () => Promise<any>, options?: PollOptions): Promise<a
|
||||
}, options.timeout)
|
||||
}
|
||||
|
||||
let fastTimeout = options.fastRetry || null;
|
||||
|
||||
let attempt = 0;
|
||||
function check() {
|
||||
return func().then(function(result) {
|
||||
@@ -227,6 +230,13 @@ export function poll(func: () => Promise<any>, options?: PollOptions): Promise<a
|
||||
if (timeout < options.floor) { timeout = options.floor; }
|
||||
if (timeout > options.ceiling) { timeout = options.ceiling; }
|
||||
|
||||
// Fast Timeout, means we quickly try again the first time
|
||||
if (fastTimeout) {
|
||||
attempt--;
|
||||
timeout = fastTimeout;
|
||||
fastTimeout = null;
|
||||
}
|
||||
|
||||
setTimeout(check, timeout);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ var path = require('path');
|
||||
var utils = require('../utils.js');
|
||||
|
||||
function prefixAddress(address) {
|
||||
if (!address) { return null; }
|
||||
if (address.substring(0, 2) !== '0x') {
|
||||
address = '0x' + address;
|
||||
}
|
||||
@@ -25,6 +26,10 @@ Output.push({
|
||||
});
|
||||
*/
|
||||
|
||||
var addresses = {
|
||||
"582": "0x008aeeda4d805471df9b2a5b0f38a0c3bcba786b"
|
||||
};
|
||||
|
||||
var privateKeys = {
|
||||
'0x0b88d4b324ec24c8c078551e6e5075547157e5b6': '0xd4375d2a931db84ea8825b69a3128913597744d9236cacec675cc18e1bda4446',
|
||||
'0x2e326fa404fc3661de4f4361776ed9bbabdc26e3': '0xcf367fc32bf789b3339c6664af4a12263e9db0e0eb70f247da1d1165e150c487',
|
||||
@@ -33,7 +38,8 @@ var privateKeys = {
|
||||
'0x88a5c2d9919e46f883eb62f7b8dd9d0cc45bc290': '0xf03e581353c794928373fb0893bc731aefc4c4e234e643f3a46998b03cd4d7c5',
|
||||
'0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025': '0x4242424242424242424242424242424242424242424242424242424242424242',
|
||||
'0x012363d61bdc53d0290a0f25e9c89f8257550fb8': '0x4c94faa2c558a998d10ee8b2b9b8eb1fbcb8a6ac5fd085c6f95535604fc1bffb',
|
||||
'0x15db397ed5f682acb22b0afc6c8de4cdfbda7cbc': '0xcdf3c34a2ea0ff181f462856168f5851e68c37b583eb158403e43aeab4964fee'
|
||||
'0x15db397ed5f682acb22b0afc6c8de4cdfbda7cbc': '0xcdf3c34a2ea0ff181f462856168f5851e68c37b583eb158403e43aeab4964fee',
|
||||
'0x008aeeda4d805471df9b2a5b0f38a0c3bcba786b': '0x7a28b5ba57c53603b0b07b56bba752f7784bf506fa95edc395f5cf6c7514fe9d'
|
||||
}
|
||||
|
||||
var mnemonics = {
|
||||
@@ -62,14 +68,16 @@ fs.readdirSync(walletPath).forEach(function(filename) {
|
||||
});
|
||||
|
||||
} else {
|
||||
let address = (addresses[name] || prefixAddress(data.address));
|
||||
Output.push({
|
||||
type: 'secret-storage',
|
||||
address: prefixAddress(data.address),
|
||||
hasAddress: !addresses[name],
|
||||
address: address,
|
||||
json: JSON.stringify(data),
|
||||
mnemonic: mnemonics[prefixAddress(data.address)] || '',
|
||||
mnemonic: mnemonics[address] || '',
|
||||
name: name,
|
||||
password: password,
|
||||
privateKey: privateKeys[prefixAddress(data.address)],
|
||||
privateKey: privateKeys[address],
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
{"crypto":{"cipher":"aes-128-ctr","cipherparams":{"iv":"6087dab2f9fdbbfaddc31a909735c1e6"},"ciphertext":"5318b4d5bcd28de64ee5559e671353e16f075ecae9f99c7a79a38af5f869aa46","kdf":"pbkdf2","kdfparams":{"c":262144,"dklen":32,"prf":"hmac-sha256","salt":"ae3cd4e7013836a3df6bd7241b12db061dbe2c6785853cce422d148a624ce0bd"},"mac":"517ead924a9d0dc3124507e3393d175ce3ff7c1e96529c6c555ce9e51205e9b2"},"id":"3198bc9c-6672-5ab3-d995-4942343ae5b6","version":3}
|
||||
@@ -5,11 +5,20 @@ var assert = require('assert');
|
||||
var utils = require('./utils');
|
||||
var ethers = utils.getEthers(__filename);
|
||||
|
||||
function skip(name) {
|
||||
var match = name.match(/^random-([0-9]+)$/);
|
||||
if (match && parseInt(match[1]) > 512) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
describe('Test HD Node Derivation', function(test) {
|
||||
|
||||
var tests = utils.loadTests('hdnode');
|
||||
tests.forEach(function(test) {
|
||||
it('Derives the HD nodes - ' + test.name, function() {
|
||||
if (skip(test.name)) { return; }
|
||||
it('Derives the HD nodes - ' + test.name, function() {
|
||||
this.timeout(10000);
|
||||
|
||||
//var rootNode = new ethers.utils.HDNode.fromSeed(test.seed);
|
||||
@@ -87,6 +96,7 @@ describe('Test HD Node Derivation', function(test) {
|
||||
describe('Test HD Mnemonic Phrases', function testMnemonic() {
|
||||
var tests = utils.loadTests('hdnode');
|
||||
tests.forEach(function(test) {
|
||||
if (skip(test.name)) { return; }
|
||||
it(('converts mnemonic phrases - ' + test.name), function() {
|
||||
this.timeout(1000000);
|
||||
|
||||
@@ -128,3 +138,71 @@ testEasySeed(ethers.wordlists.zh_cn, 'zh_cn');
|
||||
testEasySeed(ethers.wordlists.zh_tw, 'zh_tw');
|
||||
testEasySeed(ethers.wordlists.it, 'it');
|
||||
testEasySeed(ethers.wordlists.ko, 'ko');
|
||||
|
||||
describe('Testnet Extended Key (#553)', function testMnemonic() {
|
||||
var tests = [
|
||||
{
|
||||
name: "testnet extended public key",
|
||||
extended: "tpubD6NzVbkrYhZ4Xbv9K5Ajt49a8XEPydLyfyFBNvqt3TRBa9S8L3PVoKBthRS8gimY2ZU2LQ3gXQKpXHRR6fu9W1rWp6jaBToyZ5ar7wbRNYs",
|
||||
node: {
|
||||
publicKey: "0x02ead6f326f28baf5af54ab4a1688d5784f92848bba73c004365da8871b1e8677e",
|
||||
parentFingerprint: "0x00000000",
|
||||
fingerprint: "0x68ff1104",
|
||||
address: "0xc17Ee49BA46A41FBdA2306d00DA5Ce410925a7cb",
|
||||
chainCode: "0x7eee1a867c6938de05f0677d290769a6db3d135d4c1b5ba84c753b56b027cfb7",
|
||||
index: 0,
|
||||
depth: 0
|
||||
}
|
||||
},
|
||||
{
|
||||
name: "testnet extended private key",
|
||||
extended: "tprv8ZgxMBicQKsPe8tMRRW9UeVTZViTpJA56feQ6QoadBcnjfBMheZucpa2XHqF6iuRJSngkasg1yXD7VpGgGafFJwhY5RoETMSbiyEDBzxdCd",
|
||||
node: {
|
||||
privateKey: "0x949219063180d462349e358ec93cec1067fc346b37530e44b592a8a6dbe96d4c",
|
||||
publicKey: "0x02ead6f326f28baf5af54ab4a1688d5784f92848bba73c004365da8871b1e8677e",
|
||||
parentFingerprint: "0x00000000",
|
||||
fingerprint: "0x68ff1104",
|
||||
address: "0xc17Ee49BA46A41FBdA2306d00DA5Ce410925a7cb",
|
||||
chainCode: "0x7eee1a867c6938de05f0677d290769a6db3d135d4c1b5ba84c753b56b027cfb7",
|
||||
index: 0,
|
||||
depth: 0
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
tests.forEach(function(test) {
|
||||
it(test.name, function() {
|
||||
var node = ethers.utils.HDNode.fromExtendedKey(test.extended);
|
||||
Object.keys(test.node).forEach(function(key) {
|
||||
assert.equal(node[key], test.node[key], "does not match " + key);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("Test Mnemonic is Case Agnostic", function() {
|
||||
function randomCase(seed, text) {
|
||||
return text.split("").map(function(c, index) {
|
||||
if (utils.randomNumber(seed + "-" + index, 0, 1000) > 500) {
|
||||
return c.toUpperCase();
|
||||
}
|
||||
return c
|
||||
}).join("");
|
||||
}
|
||||
|
||||
function addTest(mnemonic, altMnemonic) {
|
||||
it(altMnemonic, function() {
|
||||
var node = ethers.utils.HDNode.fromMnemonic(mnemonic);
|
||||
var altNode = ethers.utils.HDNode.fromMnemonic(altMnemonic);
|
||||
assert.equal(node.privateKey, altNode.privateKey, altMnemonic);
|
||||
});
|
||||
}
|
||||
|
||||
for (var i = 0; i < 128; i++) {
|
||||
var seed = "test-" + i;
|
||||
var entropy = utils.randomBytes(seed, 16, 16);
|
||||
var mnemonic = ethers.utils.HDNode.entropyToMnemonic(entropy);
|
||||
var altMnemonic = randomCase(seed, mnemonic);
|
||||
addTest(mnemonic, altMnemonic);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -414,12 +414,6 @@ function testProvider(providerName, networkName) {
|
||||
['default', 'homestead', 'ropsten', 'rinkeby', 'kovan', 'goerli'].forEach(function(networkName) {
|
||||
['getDefaultProvider', 'InfuraProvider', 'EtherscanProvider', 'Web3Provider'].forEach(function(providerName) {
|
||||
|
||||
if (networkName === "goerli") {
|
||||
if (providerName === "InfuraProvider" || providerName === "Web3Provider") {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// @TODO: Remove this! Temporary because Etherscan is down
|
||||
//if (providerName === 'EtherscanProvider') {
|
||||
// console.log("******** Remove this soon! Etherscan is having issues.");
|
||||
|
||||
@@ -12,8 +12,10 @@ describe('Test JSON Wallets', function() {
|
||||
it(('decrypts wallet - ' + test.name), function() {
|
||||
this.timeout(1200000);
|
||||
|
||||
assert.ok((ethers.utils.getJsonWalletAddress(test.json) !== null),
|
||||
'detect encrypted JSON wallet');
|
||||
if (test.hasAddress) {
|
||||
assert.ok((ethers.utils.getJsonWalletAddress(test.json) !== null),
|
||||
'detect encrypted JSON wallet');
|
||||
}
|
||||
|
||||
return Wallet.fromEncryptedJson(test.json, test.password).then(function(wallet) {
|
||||
assert.equal(wallet.privateKey, test.privateKey,
|
||||
|
||||
Binary file not shown.
@@ -480,7 +480,7 @@ var CoderFixedBytes = /** @class */ (function (_super) {
|
||||
};
|
||||
CoderFixedBytes.prototype.decode = function (data, offset) {
|
||||
if (data.length < offset + 32) {
|
||||
errors.throwError('insufficient data for ' + name + ' type', errors.INVALID_ARGUMENT, {
|
||||
errors.throwError('insufficient data for ' + this.name + ' type', errors.INVALID_ARGUMENT, {
|
||||
arg: this.localName,
|
||||
coderType: this.name,
|
||||
value: bytes_1.hexlify(data.slice(offset, offset + 32))
|
||||
|
||||
1
utils/bytes.d.ts
vendored
1
utils/bytes.d.ts
vendored
@@ -2,7 +2,6 @@
|
||||
* Conversion Utilities
|
||||
*
|
||||
*/
|
||||
import { Arrayish } from './bytes';
|
||||
export declare type Arrayish = string | ArrayLike<number>;
|
||||
export interface Hexable {
|
||||
toHexString(): string;
|
||||
|
||||
@@ -174,7 +174,7 @@ var HDNode = /** @class */ (function () {
|
||||
result = result._derive(index);
|
||||
}
|
||||
else {
|
||||
throw new Error('invlaid path component - ' + component);
|
||||
throw new Error('invalid path component - ' + component);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
@@ -205,7 +205,7 @@ function fromExtendedKey(extendedKey) {
|
||||
return new HDNode(_constructorGuard, null, bytes_1.hexlify(key), parentFingerprint, chainCode, index, depth, null, null);
|
||||
// Private Key
|
||||
case "0x0488ade4":
|
||||
case "0x04358394 ":
|
||||
case "0x04358394":
|
||||
if (key[0] !== 0) {
|
||||
break;
|
||||
}
|
||||
@@ -226,8 +226,8 @@ function _fromSeed(seed, mnemonic) {
|
||||
return new HDNode(_constructorGuard, bytes32(I.slice(0, 32)), null, "0x00000000", bytes32(I.slice(32)), 0, 0, mnemonic, 'm');
|
||||
}
|
||||
function fromMnemonic(mnemonic, wordlist, password) {
|
||||
// Check that the checksum s valid (will throw an error)
|
||||
mnemonicToEntropy(mnemonic, wordlist);
|
||||
// Normalize the mnemonic (also throws if the checksum is invalid)
|
||||
mnemonic = entropyToMnemonic(mnemonicToEntropy(mnemonic, wordlist), wordlist);
|
||||
return _fromSeed(mnemonicToSeed(mnemonic, password), mnemonic);
|
||||
}
|
||||
exports.fromMnemonic = fromMnemonic;
|
||||
|
||||
4
utils/index.d.ts
vendored
4
utils/index.d.ts
vendored
@@ -20,7 +20,7 @@ import { populateTransaction } from './transaction';
|
||||
import { parse as parseTransaction, serialize as serializeTransaction } from './transaction';
|
||||
import { formatBytes32String, parseBytes32String, toUtf8Bytes, toUtf8String } from './utf8';
|
||||
import { commify, formatEther, parseEther, formatUnits, parseUnits } from './units';
|
||||
import { fetchJson } from './web';
|
||||
import { fetchJson, poll } from './web';
|
||||
import { SupportedAlgorithms } from './hmac';
|
||||
import { UnicodeNormalizationForm } from './utf8';
|
||||
import { CoerceFunc, EventFragment, FunctionFragment, ParamType } from './abi-coder';
|
||||
@@ -32,4 +32,4 @@ import { Transaction, UnsignedTransaction } from './transaction';
|
||||
import { ConnectionInfo, OnceBlockable, PollOptions } from './web';
|
||||
import { EncryptOptions, ProgressCallback } from './secret-storage';
|
||||
import { Wordlist } from './wordlist';
|
||||
export { AbiCoder, defaultAbiCoder, formatSignature, formatParamType, parseSignature, parseParamType, RLP, fetchJson, getNetwork, checkProperties, deepCopy, defineReadOnly, resolveProperties, shallowCopy, arrayify, concat, padZeros, stripZeros, HDNode, SigningKey, Interface, base64, BigNumber, bigNumberify, hexlify, isHexString, hexStripZeros, hexZeroPad, hexDataLength, hexDataSlice, toUtf8Bytes, toUtf8String, formatBytes32String, parseBytes32String, hashMessage, namehash, id, getAddress, getIcapAddress, getContractAddress, formatEther, parseEther, formatUnits, parseUnits, commify, keccak256, sha256, randomBytes, solidityPack, solidityKeccak256, soliditySha256, splitSignature, joinSignature, parseTransaction, populateTransaction, serializeTransaction, getJsonWalletAddress, computeAddress, computePublicKey, recoverAddress, recoverPublicKey, verifyMessage, SupportedAlgorithms, UnicodeNormalizationForm, CoerceFunc, EventFragment, FunctionFragment, ParamType, BigNumberish, Arrayish, Hexable, Signature, Indexed, DeployDescription, EventDescription, FunctionDescription, LogDescription, TransactionDescription, Network, Networkish, Transaction, UnsignedTransaction, ConnectionInfo, OnceBlockable, PollOptions, EncryptOptions, ProgressCallback, Wordlist, };
|
||||
export { AbiCoder, defaultAbiCoder, formatSignature, formatParamType, parseSignature, parseParamType, RLP, fetchJson, getNetwork, checkProperties, deepCopy, defineReadOnly, resolveProperties, shallowCopy, arrayify, concat, padZeros, stripZeros, HDNode, SigningKey, Interface, base64, BigNumber, bigNumberify, hexlify, isHexString, hexStripZeros, hexZeroPad, hexDataLength, hexDataSlice, toUtf8Bytes, toUtf8String, formatBytes32String, parseBytes32String, hashMessage, namehash, id, getAddress, getIcapAddress, getContractAddress, formatEther, parseEther, formatUnits, parseUnits, commify, keccak256, sha256, randomBytes, solidityPack, solidityKeccak256, soliditySha256, splitSignature, joinSignature, parseTransaction, populateTransaction, serializeTransaction, getJsonWalletAddress, computeAddress, computePublicKey, recoverAddress, recoverPublicKey, verifyMessage, poll, SupportedAlgorithms, UnicodeNormalizationForm, CoerceFunc, EventFragment, FunctionFragment, ParamType, BigNumberish, Arrayish, Hexable, Signature, Indexed, DeployDescription, EventDescription, FunctionDescription, LogDescription, TransactionDescription, Network, Networkish, Transaction, UnsignedTransaction, ConnectionInfo, OnceBlockable, PollOptions, EncryptOptions, ProgressCallback, Wordlist, };
|
||||
|
||||
@@ -92,6 +92,7 @@ exports.formatUnits = units_1.formatUnits;
|
||||
exports.parseUnits = units_1.parseUnits;
|
||||
var web_1 = require("./web");
|
||||
exports.fetchJson = web_1.fetchJson;
|
||||
exports.poll = web_1.poll;
|
||||
////////////////////////
|
||||
// Enums
|
||||
var hmac_1 = require("./hmac");
|
||||
|
||||
@@ -70,12 +70,7 @@ var networks = {
|
||||
chainId: 5,
|
||||
ensAddress: "0x112234455c3a32fd11230c42e7bccd4a84e02010",
|
||||
name: "goerli",
|
||||
_defaultProvider: function (providers) {
|
||||
if (providers.EtherscanProvider) {
|
||||
return new providers.EtherscanProvider("goerli");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
_defaultProvider: ethDefaultProvider('goerli')
|
||||
},
|
||||
kovan: {
|
||||
chainId: 42,
|
||||
|
||||
@@ -98,7 +98,7 @@ function _decode(data, offset) {
|
||||
else if (data[offset] >= 0x80) {
|
||||
var length = data[offset] - 0x80;
|
||||
if (offset + 1 + length > data.length) {
|
||||
throw new Error('invlaid rlp data');
|
||||
throw new Error('invalid rlp data');
|
||||
}
|
||||
var result = bytes_1.hexlify(data.slice(offset + 1, offset + 1 + length));
|
||||
return { consumed: (1 + length), result: result };
|
||||
|
||||
@@ -125,7 +125,7 @@ function decrypt(json, password, progressCallback) {
|
||||
return null;
|
||||
}
|
||||
var signingKey = new signing_key_1.SigningKey(privateKey);
|
||||
if (signingKey.address !== address_1.getAddress(data.address)) {
|
||||
if (data.address && signingKey.address !== address_1.getAddress(data.address)) {
|
||||
reject(new Error('address mismatch'));
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -174,7 +174,7 @@ function parseBytes32String(bytes) {
|
||||
throw new Error('invalid bytes32 - not 32 bytes long');
|
||||
}
|
||||
if (data[31] !== 0) {
|
||||
throw new Error('invalid bytes32 sdtring - no null terminator');
|
||||
throw new Error('invalid bytes32 string - no null terminator');
|
||||
}
|
||||
// Find the null termination
|
||||
var length = 31;
|
||||
|
||||
1
utils/web.d.ts
vendored
1
utils/web.d.ts
vendored
@@ -17,6 +17,7 @@ export declare type PollOptions = {
|
||||
ceiling?: number;
|
||||
interval?: number;
|
||||
onceBlock?: OnceBlockable;
|
||||
fastRetry?: number;
|
||||
};
|
||||
export declare function fetchJson(connection: string | ConnectionInfo, json: string, processFunc: (value: any) => any): Promise<any>;
|
||||
export declare function poll(func: () => Promise<any>, options?: PollOptions): Promise<any>;
|
||||
|
||||
@@ -179,6 +179,7 @@ function poll(func, options) {
|
||||
}
|
||||
}, options.timeout);
|
||||
}
|
||||
var fastTimeout = options.fastRetry || null;
|
||||
var attempt = 0;
|
||||
function check() {
|
||||
return func().then(function (result) {
|
||||
@@ -201,6 +202,12 @@ function poll(func, options) {
|
||||
if (timeout > options.ceiling) {
|
||||
timeout = options.ceiling;
|
||||
}
|
||||
// Fast Timeout, means we quickly try again the first time
|
||||
if (fastTimeout) {
|
||||
attempt--;
|
||||
timeout = fastTimeout;
|
||||
fastTimeout = null;
|
||||
}
|
||||
setTimeout(check, timeout);
|
||||
}
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user