forked from tornado-packages/ethers.js
Compare commits
51 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b288ad9ba7 | ||
|
|
6da5c53120 | ||
|
|
26d3271643 | ||
|
|
12da07579a | ||
|
|
bd066b8542 | ||
|
|
4478896ca5 | ||
|
|
f996ec0c32 | ||
|
|
c76e01e61f | ||
|
|
f8087ae39c | ||
|
|
7250cdcd31 | ||
|
|
20f34f1ba9 | ||
|
|
4ac08432b8 | ||
|
|
3e3048df81 | ||
|
|
c6199bf52a | ||
|
|
20409c083c | ||
|
|
7a90f18145 | ||
|
|
df1ae611ba | ||
|
|
6009a26c89 | ||
|
|
30984b6f00 | ||
|
|
76a8e503dd | ||
|
|
d0e0e30532 | ||
|
|
b3f5266e78 | ||
|
|
0609ea9651 | ||
|
|
5af16a6090 | ||
|
|
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 |
276
CHANGELOG.md
Normal file
276
CHANGELOG.md
Normal file
@@ -0,0 +1,276 @@
|
||||
CHANGELOG
|
||||
=========
|
||||
|
||||
ethers/v4.0.42 (2020-01-03 18:35)
|
||||
---------------------------------
|
||||
|
||||
- Properly handle errors in the IpcProvider ([#695](https://github.com/ethers-io/ethers.js/issues/695); [c76e01e](https://github.com/ethers-io/ethers.js/commit/c76e01e61fd52692f58c516842f7ed3b252b0f83))
|
||||
- Added utility function to compute CREATE2 addresses ([#697](https://github.com/ethers-io/ethers.js/issues/697); [f8087ae](https://github.com/ethers-io/ethers.js/commit/f8087ae39ce7631425b6b4763347a4f9618f9730))
|
||||
|
||||
ethers/v4.0.41 (2019-12-21 01:05)
|
||||
---------------------------------
|
||||
|
||||
- Added proper support for v0.6 Solidity JSON type ([#688](https://github.com/ethers-io/ethers.js/issues/688); [20f34f1](https://github.com/ethers-io/ethers.js/commit/20f34f1ba9c698d1731cb12c5de1822ad462fd7f)).
|
||||
|
||||
ethers/v4.0.40 (2019-11-24 19:58)
|
||||
---------------------------------
|
||||
|
||||
- Update elliptic package to protect from Minerva timing attack ([#666](https://github.com/ethers-io/ethers.js/issues/666); [20409c0](https://github.com/ethers-io/ethers.js/commit/20409c083cd428c46cba09488ee609cc14ff1d2b)).
|
||||
- Do not poll if disabled during the previous event loop. ([7a90f18](https://github.com/ethers-io/ethers.js/commit/7a90f18145931e7ff790cd9e1fd549929fbb9023)).
|
||||
- Moved node types to devDependencies ([#663](https://github.com/ethers-io/ethers.js/issues/663); [df1ae61](https://github.com/ethers-io/ethers.js/commit/df1ae611bab0955005b0da6604191b60b34f198f)).
|
||||
- Added provider property to Web3Provider ([#641](https://github.com/ethers-io/ethers.js/issues/641); [6009a26](https://github.com/ethers-io/ethers.js/commit/6009a26c89c359ae44ef4b6e8a664ed57db24f67)).
|
||||
|
||||
ethers/v4.0.39 (2019-10-30 19:15)
|
||||
---------------------------------
|
||||
|
||||
- Fix filters by forcing a poll instantly when polling starts to capture the current block. ([#613](https://github.com/ethers-io/ethers.js/issues/613); [d0e0e30](https://github.com/ethers-io/ethers.js/commit/d0e0e30532baf387df6b4a8efe0805986cc265f2))
|
||||
|
||||
ethers/v4.0.38 (2019-10-17 01:28)
|
||||
---------------------------------
|
||||
|
||||
- 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
|
||||
|
||||
2
_version.d.ts
vendored
2
_version.d.ts
vendored
@@ -1 +1 @@
|
||||
export declare const version = "4.0.28";
|
||||
export declare const version = "4.0.43";
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.version = "4.0.28";
|
||||
exports.version = "4.0.43";
|
||||
|
||||
6
contract.d.ts
vendored
6
contract.d.ts
vendored
@@ -4,7 +4,7 @@ import { UnsignedTransaction } from './utils/transaction';
|
||||
import { BlockTag, Provider } from './providers/abstract-provider';
|
||||
import { Signer } from './abstract-signer';
|
||||
import { Arrayish } from './utils/bytes';
|
||||
import { ParamType } from './utils/abi-coder';
|
||||
import { EventFragment, FunctionFragment } from './utils/abi-coder';
|
||||
import { Block, Listener, Log, TransactionReceipt, TransactionRequest, TransactionResponse } from './providers/abstract-provider';
|
||||
export declare type ContractFunction = (...params: Array<any>) => Promise<any>;
|
||||
export declare type EventFilter = {
|
||||
@@ -51,7 +51,7 @@ export declare class Contract {
|
||||
readonly addressPromise: Promise<string>;
|
||||
readonly deployTransaction: TransactionResponse;
|
||||
private _deployedPromise;
|
||||
constructor(addressOrName: string, contractInterface: Array<string | ParamType> | string | Interface, signerOrProvider: Signer | Provider);
|
||||
constructor(addressOrName: string, contractInterface: Array<string | FunctionFragment | EventFragment> | string | Interface, signerOrProvider: Signer | Provider);
|
||||
deployed(): Promise<Contract>;
|
||||
_deployed(blockTag?: BlockTag): Promise<Contract>;
|
||||
fallback(overrides?: TransactionRequest): Promise<TransactionResponse>;
|
||||
@@ -74,7 +74,7 @@ export declare class ContractFactory {
|
||||
readonly interface: Interface;
|
||||
readonly bytecode: string;
|
||||
readonly signer: Signer;
|
||||
constructor(contractInterface: Array<string | ParamType> | string | Interface, bytecode: Arrayish | string | {
|
||||
constructor(contractInterface: Array<string | FunctionFragment | EventFragment> | string | Interface, bytecode: Arrayish | string | {
|
||||
object: string;
|
||||
}, signer?: Signer);
|
||||
getDeployTransaction(...args: Array<any>): UnsignedTransaction;
|
||||
|
||||
@@ -204,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) {
|
||||
@@ -366,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) {
|
||||
|
||||
731
dist/ethers.js
vendored
731
dist/ethers.js
vendored
File diff suppressed because it is too large
Load Diff
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
26
dist/ethers.types.txt
vendored
26
dist/ethers.types.txt
vendored
@@ -29,7 +29,7 @@ declare module 'ethers/contract' {
|
||||
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';
|
||||
import { EventFragment, FunctionFragment } from 'ethers/utils/abi-coder';
|
||||
import { Block, Listener, Log, TransactionReceipt, TransactionRequest, TransactionResponse } from 'ethers/providers/abstract-provider';
|
||||
export type ContractFunction = (...params: Array<any>) => Promise<any>;
|
||||
export type EventFilter = {
|
||||
@@ -75,7 +75,7 @@ declare module 'ethers/contract' {
|
||||
readonly [name: string]: ContractFunction | any;
|
||||
readonly addressPromise: Promise<string>;
|
||||
readonly deployTransaction: TransactionResponse;
|
||||
constructor(addressOrName: string, contractInterface: Array<string | ParamType> | string | Interface, signerOrProvider: Signer | Provider);
|
||||
constructor(addressOrName: string, contractInterface: Array<string | FunctionFragment | EventFragment> | string | Interface, signerOrProvider: Signer | Provider);
|
||||
deployed(): Promise<Contract>;
|
||||
_deployed(blockTag?: BlockTag): Promise<Contract>;
|
||||
fallback(overrides?: TransactionRequest): Promise<TransactionResponse>;
|
||||
@@ -95,7 +95,7 @@ declare module 'ethers/contract' {
|
||||
readonly interface: Interface;
|
||||
readonly bytecode: string;
|
||||
readonly signer: Signer;
|
||||
constructor(contractInterface: Array<string | ParamType> | string | Interface, bytecode: Arrayish | string | {
|
||||
constructor(contractInterface: Array<string | FunctionFragment | EventFragment> | string | Interface, bytecode: Arrayish | string | {
|
||||
object: string;
|
||||
}, signer?: Signer);
|
||||
getDeployTransaction(...args: Array<any>): UnsignedTransaction;
|
||||
@@ -211,7 +211,7 @@ declare module 'ethers/providers' {
|
||||
|
||||
declare module 'ethers/utils' {
|
||||
import { AbiCoder, defaultAbiCoder, formatSignature, formatParamType, parseSignature, parseParamType } from 'ethers/utils/abi-coder';
|
||||
import { getAddress, getContractAddress, getIcapAddress } from 'ethers/utils/address';
|
||||
import { getAddress, getContractAddress, getCreate2Address, getIcapAddress } from 'ethers/utils/address';
|
||||
import * as base64 from 'ethers/utils/base64';
|
||||
import { BigNumber, bigNumberify } from 'ethers/utils/bignumber';
|
||||
import { arrayify, concat, hexDataSlice, hexDataLength, hexlify, hexStripZeros, hexZeroPad, isHexString, joinSignature, padZeros, splitSignature, stripZeros } from 'ethers/utils/bytes';
|
||||
@@ -232,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';
|
||||
@@ -244,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, getCreate2Address, 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' {
|
||||
@@ -266,7 +266,7 @@ declare module 'ethers/utils/shims' {
|
||||
}
|
||||
|
||||
declare module 'ethers/_version' {
|
||||
export const version = "4.0.28";
|
||||
export const version = "4.0.43";
|
||||
}
|
||||
|
||||
declare module 'ethers/utils/bignumber' {
|
||||
@@ -400,7 +400,7 @@ declare module 'ethers/utils/interface' {
|
||||
[name: string]: _EventDescription;
|
||||
};
|
||||
readonly deployFunction: _DeployDescription;
|
||||
constructor(abi: Array<string | ParamType> | string);
|
||||
constructor(abi: Array<string | FunctionFragment | EventFragment> | string);
|
||||
parseTransaction(tx: {
|
||||
data: string;
|
||||
value?: BigNumberish;
|
||||
@@ -564,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;
|
||||
@@ -615,7 +614,7 @@ declare module 'ethers/utils/abi-coder' {
|
||||
outputs: Array<ParamType>;
|
||||
payable: boolean;
|
||||
stateMutability: string;
|
||||
gas: BigNumber;
|
||||
gas?: BigNumber;
|
||||
};
|
||||
export const defaultCoerceFunc: CoerceFunc;
|
||||
export function parseParamType(type: string): ParamType;
|
||||
@@ -899,6 +898,13 @@ declare module 'ethers/utils/address' {
|
||||
from: string;
|
||||
nonce: Arrayish | BigNumber | number;
|
||||
}): string;
|
||||
export type Create2Options = {
|
||||
from: string;
|
||||
salt: Arrayish;
|
||||
initCode?: Arrayish;
|
||||
initCodeHash?: Arrayish;
|
||||
};
|
||||
export function getCreate2Address(options: Create2Options): string;
|
||||
}
|
||||
|
||||
declare module 'ethers/utils/base64' {
|
||||
|
||||
2
dist/shims.js
vendored
2
dist/shims.js
vendored
File diff suppressed because one or more lines are too long
1985
package-lock.json
generated
1985
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ethers",
|
||||
"version": "4.0.28",
|
||||
"version": "4.0.43",
|
||||
"description": "Ethereum wallet library.",
|
||||
"main": "./index.js",
|
||||
"types": "./index.d.ts",
|
||||
@@ -19,10 +19,9 @@
|
||||
"version": "npm dist"
|
||||
},
|
||||
"dependencies": {
|
||||
"@types/node": "^10.3.2",
|
||||
"aes-js": "3.0.0",
|
||||
"bn.js": "^4.4.0",
|
||||
"elliptic": "6.3.3",
|
||||
"elliptic": "6.5.2",
|
||||
"hash.js": "1.1.3",
|
||||
"js-sha3": "0.5.7",
|
||||
"scrypt-js": "2.0.4",
|
||||
@@ -31,6 +30,7 @@
|
||||
"xmlhttprequest": "1.8.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^10.3.2",
|
||||
"browserify": "^16.2.3",
|
||||
"browserify-zlib": "^0.2.0",
|
||||
"dts-bundle": "^0.7.3",
|
||||
@@ -64,5 +64,6 @@
|
||||
"type": "git",
|
||||
"url": "git://github.com/ethers-io/ethers.js.git"
|
||||
},
|
||||
"ethereum": "donations.ethers.eth",
|
||||
"license": "MIT"
|
||||
}
|
||||
|
||||
@@ -227,6 +227,9 @@ function checkTransactionResponse(transaction) {
|
||||
networkId = 0;
|
||||
}
|
||||
result.networkId = networkId;
|
||||
if (result.chainId == null && networkId != null) {
|
||||
result.chainId = networkId;
|
||||
}
|
||||
// 0x0000... should actually be null
|
||||
if (result.blockHash && result.blockHash.replace(/0/g, '') === 'x') {
|
||||
result.blockHash = null;
|
||||
@@ -452,6 +455,9 @@ var BaseProvider = /** @class */ (function (_super) {
|
||||
BaseProvider.prototype._doPoll = function () {
|
||||
var _this = this;
|
||||
this.getBlockNumber().then(function (blockNumber) {
|
||||
if (!_this.polling) {
|
||||
return;
|
||||
}
|
||||
_this._setFastBlockNumber(blockNumber);
|
||||
// If the block hasn't changed, meh.
|
||||
if (blockNumber === _this._lastBlockNumber) {
|
||||
@@ -594,6 +600,7 @@ var BaseProvider = /** @class */ (function (_super) {
|
||||
setTimeout(function () {
|
||||
if (value && !_this._poller) {
|
||||
_this._poller = setInterval(_this._doPoll.bind(_this), _this.pollingInterval);
|
||||
_this._doPoll();
|
||||
}
|
||||
else if (!value && _this._poller) {
|
||||
clearInterval(_this._poller);
|
||||
@@ -1013,7 +1020,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);
|
||||
@@ -1043,7 +1050,12 @@ var BaseProvider = /** @class */ (function (_super) {
|
||||
try {
|
||||
return Promise.resolve(address_1.getAddress(name));
|
||||
}
|
||||
catch (error) { }
|
||||
catch (error) {
|
||||
// See #694
|
||||
if (bytes_1.isHexString(name)) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
var self = this;
|
||||
var nodeHash = hash_1.namehash(name);
|
||||
// Get the addr from the resovler
|
||||
@@ -1087,6 +1099,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)
|
||||
|
||||
@@ -62,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);
|
||||
|
||||
@@ -59,8 +59,16 @@ var IpcProvider = /** @class */ (function (_super) {
|
||||
});
|
||||
stream.on("end", function () {
|
||||
try {
|
||||
resolve(JSON.parse(response.toString('utf8')).result);
|
||||
// @TODO: Better pull apart the error
|
||||
var payload_1 = JSON.parse(response.toString('utf8'));
|
||||
if (payload_1.error) {
|
||||
var error = new Error(payload_1.error.message);
|
||||
error.code = payload_1.error.code;
|
||||
error.data = payload_1.error.data;
|
||||
reject(error);
|
||||
}
|
||||
else {
|
||||
resolve(payload_1.result);
|
||||
}
|
||||
stream.destroy();
|
||||
}
|
||||
catch (error) {
|
||||
|
||||
@@ -27,6 +27,7 @@ utils.defineProperty(Web3Signer, 'onchange', {
|
||||
});
|
||||
|
||||
*/
|
||||
var _nextId = 42;
|
||||
var Web3Provider = /** @class */ (function (_super) {
|
||||
__extends(Web3Provider, _super);
|
||||
function Web3Provider(web3Provider, network) {
|
||||
@@ -46,6 +47,8 @@ var Web3Provider = /** @class */ (function (_super) {
|
||||
errors.throwError('invalid web3Provider', errors.INVALID_ARGUMENT, { arg: 'web3Provider', value: web3Provider });
|
||||
}
|
||||
properties_1.defineReadOnly(_this, '_web3Provider', web3Provider);
|
||||
// @TODO: In v5 remove the above definition; only this one is needed
|
||||
properties_1.defineReadOnly(_this, 'provider', web3Provider);
|
||||
return _this;
|
||||
}
|
||||
Web3Provider.prototype.send = function (method, params) {
|
||||
@@ -60,7 +63,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 +73,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.28";
|
||||
export const version = "4.0.43";
|
||||
|
||||
@@ -24,7 +24,7 @@ import { Signer } from './abstract-signer';
|
||||
|
||||
import { Arrayish } from './utils/bytes';
|
||||
import { EventDescription } from './utils/interface';
|
||||
import { ParamType } from './utils/abi-coder';
|
||||
import { EventFragment, FunctionFragment, ParamType } from './utils/abi-coder';
|
||||
import { Block, Listener, Log, TransactionReceipt, TransactionRequest, TransactionResponse } from './providers/abstract-provider';
|
||||
|
||||
///////////////////////////////
|
||||
@@ -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
|
||||
@@ -364,7 +364,7 @@ export class Contract {
|
||||
// Once this issue is resolved (there are open PR) we can do this nicer
|
||||
// by making addressOrName default to null for 2 operand calls. :)
|
||||
|
||||
constructor(addressOrName: string, contractInterface: Array<string | ParamType> | string | Interface, signerOrProvider: Signer | Provider) {
|
||||
constructor(addressOrName: string, contractInterface: Array<string | FunctionFragment | EventFragment> | string | Interface, signerOrProvider: Signer | Provider) {
|
||||
errors.checkNew(this, Contract);
|
||||
|
||||
// @TODO: Maybe still check the addressOrName looks like a valid address or name?
|
||||
@@ -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 || {});
|
||||
@@ -744,7 +744,7 @@ export class ContractFactory {
|
||||
readonly bytecode: string;
|
||||
readonly signer: Signer;
|
||||
|
||||
constructor(contractInterface: Array<string | ParamType> | string | Interface, bytecode: Arrayish | string | { object: string }, signer?: Signer) {
|
||||
constructor(contractInterface: Array<string | FunctionFragment | EventFragment> | string | Interface, bytecode: Arrayish | string | { object: string }, signer?: Signer) {
|
||||
|
||||
let bytecodeHex: string = null;
|
||||
|
||||
|
||||
@@ -247,6 +247,9 @@ function checkTransactionResponse(transaction: any): TransactionResponse {
|
||||
if (typeof(networkId) !== 'number') { networkId = 0; }
|
||||
|
||||
result.networkId = networkId;
|
||||
if (result.chainId == null && networkId != null) {
|
||||
result.chainId = networkId;
|
||||
}
|
||||
|
||||
// 0x0000... should actually be null
|
||||
if (result.blockHash && result.blockHash.replace(/0/g, '') === 'x') {
|
||||
@@ -573,6 +576,8 @@ export class BaseProvider extends Provider {
|
||||
|
||||
private _doPoll(): void {
|
||||
this.getBlockNumber().then((blockNumber) => {
|
||||
if (!this.polling) { return; }
|
||||
|
||||
this._setFastBlockNumber(blockNumber);
|
||||
|
||||
// If the block hasn't changed, meh.
|
||||
@@ -666,6 +671,7 @@ export class BaseProvider extends Provider {
|
||||
toBlock: blockNumber,
|
||||
topics: topics
|
||||
}
|
||||
|
||||
if (!filter.address) { delete filter.address; }
|
||||
this.getLogs(filter).then((logs) => {
|
||||
if (logs.length === 0) { return; }
|
||||
@@ -716,6 +722,7 @@ export class BaseProvider extends Provider {
|
||||
setTimeout(() => {
|
||||
if (value && !this._poller) {
|
||||
this._poller = setInterval(this._doPoll.bind(this), this.pollingInterval);
|
||||
this._doPoll();
|
||||
|
||||
} else if (!value && this._poller) {
|
||||
clearInterval(this._poller);
|
||||
@@ -1142,7 +1149,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 }
|
||||
);
|
||||
@@ -1174,7 +1181,10 @@ export class BaseProvider extends Provider {
|
||||
// If it is already an address, nothing to resolve
|
||||
try {
|
||||
return Promise.resolve(getAddress(name));
|
||||
} catch (error) { }
|
||||
} catch (error) {
|
||||
// See #694
|
||||
if (isHexString(name)) { throw error; }
|
||||
}
|
||||
|
||||
let self = this;
|
||||
|
||||
@@ -1221,6 +1231,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);
|
||||
|
||||
|
||||
@@ -54,8 +54,15 @@ export class IpcProvider extends JsonRpcProvider {
|
||||
|
||||
stream.on("end", () => {
|
||||
try {
|
||||
resolve(JSON.parse(response.toString('utf8')).result);
|
||||
// @TODO: Better pull apart the error
|
||||
const payload = JSON.parse(response.toString('utf8'));
|
||||
if (payload.error) {
|
||||
const error: any = new Error(payload.error.message);
|
||||
error.code = payload.error.code;
|
||||
error.data = payload.error.data;
|
||||
reject(error);
|
||||
} else {
|
||||
resolve(payload.result);
|
||||
}
|
||||
stream.destroy();
|
||||
} catch (error) {
|
||||
reject(error);
|
||||
|
||||
@@ -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;
|
||||
@@ -53,6 +55,9 @@ export class Web3Provider extends JsonRpcProvider {
|
||||
}
|
||||
|
||||
defineReadOnly(this, '_web3Provider', web3Provider);
|
||||
|
||||
// @TODO: In v5 remove the above definition; only this one is needed
|
||||
defineReadOnly(this, 'provider', web3Provider);
|
||||
}
|
||||
|
||||
send(method: string, params: any): Promise<any> {
|
||||
@@ -65,10 +70,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 +85,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);
|
||||
|
||||
@@ -54,7 +54,7 @@ export type FunctionFragment = {
|
||||
payable: boolean,
|
||||
stateMutability: string,
|
||||
|
||||
gas: BigNumber
|
||||
gas?: BigNumber
|
||||
};
|
||||
|
||||
///////////////////////////////
|
||||
@@ -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))
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// We use this for base 36 maths
|
||||
import BN from 'bn.js';
|
||||
|
||||
import { arrayify, stripZeros, hexlify } from './bytes';
|
||||
import { arrayify, concat, stripZeros, hexlify } from './bytes';
|
||||
import { BigNumber } from './bignumber';
|
||||
import { keccak256 } from './keccak256';
|
||||
import { encode } from './rlp';
|
||||
@@ -140,3 +140,47 @@ export function getContractAddress(transaction: { from: string, nonce: Arrayish
|
||||
])).substring(26));
|
||||
}
|
||||
|
||||
export type Create2Options = {
|
||||
from: string,
|
||||
salt: Arrayish,
|
||||
initCode?: Arrayish,
|
||||
initCodeHash?: Arrayish,
|
||||
};
|
||||
|
||||
// See: https://eips.ethereum.org/EIPS/eip-1014
|
||||
export function getCreate2Address(options: Create2Options): string {
|
||||
let initCodeHash = options.initCodeHash;
|
||||
if (options.initCode) {
|
||||
if (initCodeHash) {
|
||||
if (keccak256(options.initCode) !== initCodeHash) {
|
||||
errors.throwError("initCode/initCodeHash mismatch", errors.INVALID_ARGUMENT, {
|
||||
arg: "options", value: options
|
||||
});
|
||||
}
|
||||
} else {
|
||||
initCodeHash = keccak256(options.initCode);
|
||||
}
|
||||
}
|
||||
|
||||
if (!initCodeHash) {
|
||||
errors.throwError("missing initCode or initCodeHash", errors.INVALID_ARGUMENT, {
|
||||
arg: "options", value: options
|
||||
});
|
||||
}
|
||||
|
||||
const from = getAddress(options.from);
|
||||
|
||||
const salt = arrayify(options.salt);
|
||||
if (salt.length !== 32) {
|
||||
errors.throwError("invalid salt", errors.INVALID_ARGUMENT, {
|
||||
arg: "options", value: options
|
||||
});
|
||||
}
|
||||
|
||||
return getAddress("0x" + keccak256(concat([
|
||||
"0xff",
|
||||
from,
|
||||
salt,
|
||||
initCodeHash
|
||||
])).substring(26));
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
import { AbiCoder, defaultAbiCoder, formatSignature, formatParamType, parseSignature, parseParamType } from './abi-coder';
|
||||
import { getAddress, getContractAddress, getIcapAddress } from './address';
|
||||
import { getAddress, getContractAddress, getCreate2Address, getIcapAddress } from './address';
|
||||
import * as base64 from './base64';
|
||||
import { BigNumber, bigNumberify } from './bignumber';
|
||||
import { arrayify, concat, hexDataSlice, hexDataLength, hexlify, hexStripZeros, hexZeroPad, isHexString, joinSignature, padZeros, splitSignature, stripZeros } from './bytes';
|
||||
@@ -103,6 +103,7 @@ export {
|
||||
getAddress,
|
||||
getIcapAddress,
|
||||
getContractAddress,
|
||||
getCreate2Address,
|
||||
|
||||
formatEther,
|
||||
parseEther,
|
||||
|
||||
@@ -311,6 +311,13 @@ function addMethod(method: any): void {
|
||||
let signature = formatSignature(method).replace(/tuple/g, '');
|
||||
let sighash = id(signature).substring(0, 10);
|
||||
|
||||
let isConst = false;
|
||||
if (method.constant != null) {
|
||||
isConst = method.constant;
|
||||
} else if (method.stateMutability != null) {
|
||||
isConst = (method.stateMutability == "view" || method.stateMutability == "pure");
|
||||
}
|
||||
|
||||
let description = new _FunctionDescription({
|
||||
inputs: method.inputs,
|
||||
outputs: method.outputs,
|
||||
@@ -318,7 +325,7 @@ function addMethod(method: any): void {
|
||||
gas: method.gas,
|
||||
|
||||
payable: (method.payable == null || !!method.payable),
|
||||
type: ((method.constant) ? 'call': 'transaction'),
|
||||
type: (isConst ? 'call': 'transaction'),
|
||||
|
||||
name: method.name,
|
||||
signature: signature,
|
||||
@@ -383,7 +390,7 @@ export class Interface {
|
||||
readonly events: { [ name: string ]: _EventDescription };
|
||||
readonly deployFunction: _DeployDescription;
|
||||
|
||||
constructor(abi: Array<string | ParamType> | string) {
|
||||
constructor(abi: Array<string | FunctionFragment | EventFragment> | string) {
|
||||
errors.checkNew(this, Interface);
|
||||
|
||||
if (typeof(abi) === 'string') {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ Building Testcases
|
||||
------------------
|
||||
|
||||
Each suite of testcases is produced from a variety of sources. Many include a
|
||||
specific set of test vecotrs as well as procedurally generated tests using known
|
||||
specific set of test vectors as well as procedurally generated tests using known
|
||||
correct implementations.
|
||||
|
||||
The `contract-interface` test cases are created by selecting a (deterministically) random
|
||||
|
||||
@@ -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}
|
||||
@@ -110,4 +110,8 @@ function Reporter(runner) {
|
||||
});
|
||||
}
|
||||
|
||||
try {
|
||||
window.ethersReporter = Reporter;
|
||||
} catch (error) { }
|
||||
|
||||
module.exports = Reporter;
|
||||
|
||||
@@ -59,6 +59,13 @@ if (!ArrayBuffer.isView) {
|
||||
}
|
||||
}
|
||||
|
||||
if (Array.prototype.fill == null) {
|
||||
shims.push("Array.fill");
|
||||
Array.prototype.fill = function(value) {
|
||||
for (var i = 0; i < this.length; i++) { this[i] = value; }
|
||||
}
|
||||
}
|
||||
|
||||
// Shim nextTick
|
||||
if (!global.nextTick) {
|
||||
shims.push("nextTick");
|
||||
|
||||
@@ -36,3 +36,64 @@ describe('Checksum and ICAP address generation', function() {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("Create2 Address Generation", function() {
|
||||
var tests = [
|
||||
{
|
||||
name: "Example 0",
|
||||
from: "0x0000000000000000000000000000000000000000",
|
||||
salt: "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||
initCode: "0x00",
|
||||
expected: "0x4D1A2e2bB4F88F0250f26Ffff098B0b30B26BF38"
|
||||
},
|
||||
{
|
||||
name: "Example 1",
|
||||
from: "0xdeadbeef00000000000000000000000000000000",
|
||||
salt: "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||
initCode: "0x00",
|
||||
expected: "0xB928f69Bb1D91Cd65274e3c79d8986362984fDA3"
|
||||
},
|
||||
{
|
||||
name: "Example 2",
|
||||
from: "0xdeadbeef00000000000000000000000000000000",
|
||||
salt: "0x000000000000000000000000feed000000000000000000000000000000000000",
|
||||
initCode: "0x00",
|
||||
expected: "0xD04116cDd17beBE565EB2422F2497E06cC1C9833"
|
||||
},
|
||||
{
|
||||
name: "Example 3",
|
||||
from: "0x0000000000000000000000000000000000000000",
|
||||
salt: "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||
initCode: "0xdeadbeef",
|
||||
expected: "0x70f2b2914A2a4b783FaEFb75f459A580616Fcb5e"
|
||||
},
|
||||
{
|
||||
name: "Example 4",
|
||||
from: "0x00000000000000000000000000000000deadbeef",
|
||||
salt: "0x00000000000000000000000000000000000000000000000000000000cafebabe",
|
||||
initCode: "0xdeadbeef",
|
||||
expected: "0x60f3f640a8508fC6a86d45DF051962668E1e8AC7"
|
||||
},
|
||||
{
|
||||
name: "Example 5",
|
||||
from: "0x00000000000000000000000000000000deadbeef",
|
||||
salt: "0x00000000000000000000000000000000000000000000000000000000cafebabe",
|
||||
initCode: "0xdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef",
|
||||
expected: "0x1d8bfDC5D46DC4f61D6b6115972536eBE6A8854C"
|
||||
},
|
||||
{
|
||||
name: "Example 6",
|
||||
from: "0x0000000000000000000000000000000000000000",
|
||||
salt: "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||
initCode: "0x",
|
||||
expected: "0xE33C0C7F7df4809055C3ebA6c09CFe4BaF1BD9e0"
|
||||
},
|
||||
];
|
||||
|
||||
tests.forEach(function(test) {
|
||||
it("correctly computes the Create2 address - " + test.name, function() {
|
||||
var address = ethers.utils.getCreate2Address(test);
|
||||
assert.equal(address, test.expected, "correctly computes Create2 address");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -540,3 +540,46 @@ describe('Test Filters', function() {
|
||||
doTest(test);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Test Solidity v0.6 ABI', function() {
|
||||
|
||||
var tests = [
|
||||
{
|
||||
inputs: [ ],
|
||||
outputs: [ ],
|
||||
stateMutability: "view",
|
||||
type: "function",
|
||||
name: "testView_call"
|
||||
},
|
||||
{
|
||||
inputs: [ ],
|
||||
outputs: [ ],
|
||||
stateMutability: "pure",
|
||||
type: "function",
|
||||
name: "testPure_call"
|
||||
},
|
||||
{
|
||||
inputs: [ ],
|
||||
outputs: [ ],
|
||||
stateMutability: "payable",
|
||||
type: "function",
|
||||
name: "testPayable_transaction"
|
||||
},
|
||||
{
|
||||
inputs: [ ],
|
||||
outputs: [ ],
|
||||
stateMutability: "nonpayable",
|
||||
type: "function",
|
||||
name: "testNonpayable_transaction"
|
||||
},
|
||||
];
|
||||
|
||||
tests.forEach(function(test, index) {
|
||||
var type = test.name.split("_")[1];
|
||||
it(('generates fragment from ABI - ' + test.name.split("_")[0]), function() {
|
||||
var iface = new ethers.utils.Interface(JSON.stringify([ test ]));
|
||||
var func = iface.functions[test.name];
|
||||
assert.equal(func.type, type, "matches type");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -46,7 +46,8 @@ var blockchainData = {
|
||||
v: 38,
|
||||
creates: null,
|
||||
raw: '0xf8d2808504a817c8008303d090946fc21092da55b392b045ed78f4732bff3c580e2c880186cc6acd4b0000b864f2c298be000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000067269636d6f6f000000000000000000000000000000000000000000000000000026a01e5605197a03e3f0a168f14749168dfeefc44c9228312dacbffdcbbb13263265a0269c3e5b3558267ad91b0a887d51f9f10098771c67b82ea6cb74f29638754f54',
|
||||
networkId: 1
|
||||
networkId: 1,
|
||||
chainId: 1
|
||||
},
|
||||
transactionReceipt: {
|
||||
blockHash: "0x36b4af7f0538559e581c8588f16477df0f676439ea67fe8d7a2ae4abb20e2566",
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
|
||||
<!-- Run the test cases! -->
|
||||
<script type="text/javascript">
|
||||
mocha.reporter(tests.reporter);
|
||||
mocha.reporter(ethersReporter);
|
||||
|
||||
// Use this to focus on specific test cases
|
||||
//mocha.grep(new RegExp('easyseed')).run();
|
||||
|
||||
Binary file not shown.
@@ -1,7 +1,7 @@
|
||||
var assert = require('assert');
|
||||
|
||||
function getEthers(filename) {
|
||||
let ethers = require('../index');
|
||||
var ethers = require('../index');
|
||||
console.log('Loaded local ethers: ' + filename);
|
||||
assert.equal(ethers.platform, 'node', 'platform: ' + ethers.platform + ' != "node"');
|
||||
return ethers;
|
||||
|
||||
2
utils/abi-coder.d.ts
vendored
2
utils/abi-coder.d.ts
vendored
@@ -21,7 +21,7 @@ export declare type FunctionFragment = {
|
||||
outputs: Array<ParamType>;
|
||||
payable: boolean;
|
||||
stateMutability: string;
|
||||
gas: BigNumber;
|
||||
gas?: BigNumber;
|
||||
};
|
||||
export declare const defaultCoerceFunc: CoerceFunc;
|
||||
export declare function parseParamType(type: string): ParamType;
|
||||
|
||||
@@ -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))
|
||||
|
||||
7
utils/address.d.ts
vendored
7
utils/address.d.ts
vendored
@@ -6,3 +6,10 @@ export declare function getContractAddress(transaction: {
|
||||
from: string;
|
||||
nonce: Arrayish | BigNumber | number;
|
||||
}): string;
|
||||
export declare type Create2Options = {
|
||||
from: string;
|
||||
salt: Arrayish;
|
||||
initCode?: Arrayish;
|
||||
initCodeHash?: Arrayish;
|
||||
};
|
||||
export declare function getCreate2Address(options: Create2Options): string;
|
||||
|
||||
@@ -123,3 +123,38 @@ function getContractAddress(transaction) {
|
||||
])).substring(26));
|
||||
}
|
||||
exports.getContractAddress = getContractAddress;
|
||||
// See: https://eips.ethereum.org/EIPS/eip-1014
|
||||
function getCreate2Address(options) {
|
||||
var initCodeHash = options.initCodeHash;
|
||||
if (options.initCode) {
|
||||
if (initCodeHash) {
|
||||
if (keccak256_1.keccak256(options.initCode) !== initCodeHash) {
|
||||
errors.throwError("initCode/initCodeHash mismatch", errors.INVALID_ARGUMENT, {
|
||||
arg: "options", value: options
|
||||
});
|
||||
}
|
||||
}
|
||||
else {
|
||||
initCodeHash = keccak256_1.keccak256(options.initCode);
|
||||
}
|
||||
}
|
||||
if (!initCodeHash) {
|
||||
errors.throwError("missing initCode or initCodeHash", errors.INVALID_ARGUMENT, {
|
||||
arg: "options", value: options
|
||||
});
|
||||
}
|
||||
var from = getAddress(options.from);
|
||||
var salt = bytes_1.arrayify(options.salt);
|
||||
if (salt.length !== 32) {
|
||||
errors.throwError("invalid salt", errors.INVALID_ARGUMENT, {
|
||||
arg: "options", value: options
|
||||
});
|
||||
}
|
||||
return getAddress("0x" + keccak256_1.keccak256(bytes_1.concat([
|
||||
"0xff",
|
||||
from,
|
||||
salt,
|
||||
initCodeHash
|
||||
])).substring(26));
|
||||
}
|
||||
exports.getCreate2Address = getCreate2Address;
|
||||
|
||||
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;
|
||||
|
||||
6
utils/index.d.ts
vendored
6
utils/index.d.ts
vendored
@@ -1,5 +1,5 @@
|
||||
import { AbiCoder, defaultAbiCoder, formatSignature, formatParamType, parseSignature, parseParamType } from './abi-coder';
|
||||
import { getAddress, getContractAddress, getIcapAddress } from './address';
|
||||
import { getAddress, getContractAddress, getCreate2Address, getIcapAddress } from './address';
|
||||
import * as base64 from './base64';
|
||||
import { BigNumber, bigNumberify } from './bignumber';
|
||||
import { arrayify, concat, hexDataSlice, hexDataLength, hexlify, hexStripZeros, hexZeroPad, isHexString, joinSignature, padZeros, splitSignature, stripZeros } from './bytes';
|
||||
@@ -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, getCreate2Address, 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, };
|
||||
|
||||
@@ -17,6 +17,7 @@ exports.parseParamType = abi_coder_1.parseParamType;
|
||||
var address_1 = require("./address");
|
||||
exports.getAddress = address_1.getAddress;
|
||||
exports.getContractAddress = address_1.getContractAddress;
|
||||
exports.getCreate2Address = address_1.getCreate2Address;
|
||||
exports.getIcapAddress = address_1.getIcapAddress;
|
||||
var base64 = __importStar(require("./base64"));
|
||||
exports.base64 = base64;
|
||||
@@ -92,6 +93,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");
|
||||
|
||||
2
utils/interface.d.ts
vendored
2
utils/interface.d.ts
vendored
@@ -98,7 +98,7 @@ export declare class Interface {
|
||||
[name: string]: _EventDescription;
|
||||
};
|
||||
readonly deployFunction: _DeployDescription;
|
||||
constructor(abi: Array<string | ParamType> | string);
|
||||
constructor(abi: Array<string | FunctionFragment | EventFragment> | string);
|
||||
parseTransaction(tx: {
|
||||
data: string;
|
||||
value?: BigNumberish;
|
||||
|
||||
@@ -243,12 +243,19 @@ function addMethod(method) {
|
||||
case 'function': {
|
||||
var signature = abi_coder_1.formatSignature(method).replace(/tuple/g, '');
|
||||
var sighash = hash_1.id(signature).substring(0, 10);
|
||||
var isConst = false;
|
||||
if (method.constant != null) {
|
||||
isConst = method.constant;
|
||||
}
|
||||
else if (method.stateMutability != null) {
|
||||
isConst = (method.stateMutability == "view" || method.stateMutability == "pure");
|
||||
}
|
||||
var description = new _FunctionDescription({
|
||||
inputs: method.inputs,
|
||||
outputs: method.outputs,
|
||||
gas: method.gas,
|
||||
payable: (method.payable == null || !!method.payable),
|
||||
type: ((method.constant) ? 'call' : 'transaction'),
|
||||
type: (isConst ? 'call' : 'transaction'),
|
||||
name: method.name,
|
||||
signature: signature,
|
||||
sighash: sighash,
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user