Compare commits

...

153 Commits

Author SHA1 Message Date
Richard Moore
dfaa8ee7e6 admin: updated dist files 2022-03-09 14:58:07 -05:00
Richard Moore
fa4a29028d Tweaked test case to re-order transaction after event listeners added. 2022-03-09 14:51:48 -05:00
Richard Moore
f46aa75ef1 Fix events getting blocked from fix for missed events (#1798, #1814, #1830, #2274, #2652). 2022-03-09 14:49:37 -05:00
Richard Moore
d160bac273 Ignore errors when resolving ENS resolver properties. 2022-03-09 14:31:16 -05:00
Richard Moore
be518c32ec Enable CCIP Read for ENS resolvers (#2478). 2022-03-09 14:00:23 -05:00
Richard Moore
26cdbab59b admin: Updated spell check file 2022-03-09 02:56:46 -05:00
Richard Moore
b8cda5dffd admin: updated dist files 2022-03-09 02:56:08 -05:00
Richard Moore
f67a9a8569 Fix missing events on certain network conditions (#1798, #1814, #1830, #2274, #2652). 2022-03-09 02:08:37 -05:00
Richard Moore
bae215eb7f Added defaultProvider option to omit specific Providers. 2022-03-08 17:21:29 -05:00
Richard Moore
54e6e57fce Add support for pending blocks (#2225). 2022-03-08 17:16:32 -05:00
Richard Moore
38e825cee6 Updated help for errors (#2489). 2022-03-08 14:34:47 -05:00
Richard Moore
16007d4d1e Fixed typo in testcase string. 2022-03-04 16:39:55 -05:00
Richard Moore
cf47ec5fd5 docs: fixed typo (#2760). 2022-03-04 16:17:26 -05:00
Richard Moore
ae23bb76a9 Added CCIP support to provider.call (#2478). 2022-03-04 16:15:47 -05:00
Richard Moore
33a029e457 Adjust default maxPriorityFeePerGas to 1.5 gwei. 2022-03-02 11:33:27 -05:00
Richard Moore
c2a6a012bf Fix contracts when name resolution fails without any checks (#2737). 2022-02-24 03:51:53 -05:00
Richard Moore
6807a76b8d Preserve explicit chainId in JsonRpcProvider during transaction serialization (#2691). 2022-02-22 03:53:34 -05:00
Richard Moore
5f26fd55c9 Fixed eth_chainId response for Eip1193Bridge (#2711). 2022-02-22 03:51:37 -05:00
Richard Moore
c562150d26 Tweaked error URLs (#2489). 2022-02-21 14:16:25 -05:00
Richard Moore
4e8f004e9e Remove spurious console.log from Interface (#2714). 2022-02-19 02:29:34 -05:00
Richard Moore
9aac785395 Allow raw WebSocket to be passed into WebSocketProvider (#2562, #2644). 2022-02-19 01:57:45 -05:00
Richard Moore
1651389571 docs: added skipFetchSetup to ConnectionInfo (#1886). 2022-02-19 01:40:49 -05:00
Richard Moore
2d98b4fca1 Added Cloudflare Worker support (#1886). 2022-02-19 01:31:03 -05:00
Richard Moore
f26074b92b Add support for EIP-2098 compact signatures (#2246). 2022-02-18 18:54:00 -05:00
Richard Moore
eb91d708ac Merge branch 'v5.4' 2022-02-18 18:23:02 -05:00
Richard Moore
83891f9258 Add EIP-2544 Wildcard support (#2477, #2582, #2583). 2022-02-18 18:15:03 -05:00
Richard Moore
7b134bd5c9 docs: added more searchable wording. 2022-02-03 16:36:52 -05:00
Richard Moore
e175448380 docs: added BaseProvider (#2625). 2022-02-03 16:31:40 -05:00
Richard Moore
1d419b5829 docs: more explicitly describe the id function (#2115). 2022-02-03 16:08:15 -05:00
Richard Moore
95b2c72b12 docs: updated API provider supported networks (#2242). 2022-02-03 15:55:50 -05:00
Richard Moore
7b0d02d30e docs: fixed typos (#2289). 2022-02-03 15:46:18 -05:00
Richard Moore
0c72e0f1fd docs: added effectiveGasPrice to receipts (#2311). 2022-02-03 15:44:18 -05:00
Richard Moore
315ecfd19e docs: fixed typs (#2354). 2022-02-03 15:38:14 -05:00
Richard Moore
c61f3bc2a0 docs: fixed import typo (#2397). 2022-02-03 15:36:34 -05:00
Richard Moore
1be096130c docs: fixed typos (#2400). 2022-02-03 15:34:40 -05:00
Richard Moore
9eed04a6d5 docs: fixed typos (#2407). 2022-02-03 15:31:43 -05:00
Richard Moore
82d6dcbdde docs: fix typos (#2430). 2022-02-03 15:30:19 -05:00
Richard Moore
4935f93015 docs: add MetaMask request info (#2535). 2022-02-03 15:28:04 -05:00
Richard Moore
3df0e06c64 docs: fixed typos (#2522). 2022-02-03 15:25:26 -05:00
Richard Moore
18d8d1f34d docs: fixed typos (#2531). 2022-02-03 15:24:09 -05:00
Richard Moore
7b80ba20fe docs: fixed typos (#2614). 2022-02-03 15:23:20 -05:00
Richard Moore
f635af2684 docs: added getAvatar (#2591). 2022-01-30 22:58:43 -05:00
Richard Moore
813fcef4ad docs: added jsonRpcProvider.connection (#2611) 2022-01-30 22:45:46 -05:00
Richard Moore
32c9a09762 admin: update dist files 2022-01-24 21:33:40 -05:00
Richard Moore
03545aa78b Support invalid but popular IPFS URI format (#2271, #2527, #2590). 2022-01-24 16:39:50 -05:00
Richard Moore
03152ea014 Include trouble-shooting URLs in errors (#2489). 2022-01-24 16:32:41 -05:00
Richard Moore
0578a88efa Updated dist files. 2022-01-06 03:53:52 -05:00
Richard Moore
3f5bc6ddc1 Fixed case-folding in schemes for ENS avatars (#2500). 2022-01-06 03:46:02 -05:00
Richard Moore
ab13887cda Added Kintsugi network (#2434). 2022-01-06 03:37:13 -05:00
Richard Moore
28f383300c admin: updated dist files 2021-12-24 03:09:45 -05:00
Richard Moore
4ba63acc10 Fix browser random in WebWorkers (#2405). 2021-12-24 02:05:10 -05:00
Richard Moore
3d6a7ec020 Add support for IPFS metadata imageUrl in getAvatar (#2426). 2021-12-24 01:41:41 -05:00
Richard Moore
2f57c6a4ab Do not swallow ENS not supported errors (#2387). 2021-12-24 01:08:54 -05:00
Richard Moore
d3d2953e8d docs: fixed and expanded explanation of fees (#2321) 2021-12-01 13:09:14 -05:00
Richard Moore
0403314023 docs: added note about pure/view for constant methods. 2021-12-01 12:56:21 -05:00
Richard Moore
eb432aa1f4 admin: updated dist files 2021-11-30 19:16:49 -05:00
Richard Moore
617714d196 Fixed test case for getAvatar; url has moved 2021-11-30 19:11:44 -05:00
Richard Moore
42784b8d38 Added basic redirect support. 2021-11-30 19:11:03 -05:00
Richard Moore
50d712d6af admin: updated dist files 2021-11-30 11:19:37 -05:00
Richard Moore
c7e9715758 docs: Fixed ContractFactory.connect return type (#2224, #2257) 2021-11-30 10:24:06 -05:00
Richard Moore
0844de4eb4 Added arbitrum and optimism to networks and providers (#2335). 2021-11-30 10:20:26 -05:00
Richard Moore
caa1983665 docs: Add view/pure to docs (#2336) 2021-11-30 10:03:43 -05:00
Richard Moore
b8391b0e61 Added support for data URLs for avatar metadata. 2021-10-31 00:53:49 -04:00
Richard Moore
1e1c93effa Fixed getAvatar for unconfigured ENS names. 2021-10-31 00:05:27 -04:00
Richard Moore
b145898976 admin: updated dist files 2021-10-20 04:00:49 -04:00
Richard Moore
1bd91615ee Fixed abstract Provider signature issue (#2190). 2021-10-20 03:54:24 -04:00
Richard Moore
d3079745c5 admin: updated dist files 2021-10-19 00:01:37 -04:00
Richard Moore
ecce86125d Added ENS avatar support to provider (#2185). 2021-10-18 23:53:37 -04:00
Richard Moore
5899c8aec0 admin: updated dist files 2021-10-17 23:03:30 -04:00
Richard Moore
3de1b81501 Fixed splitSignature logic for verifying EIP-2930 and EIP-1559 v (#2084). 2021-10-17 22:56:57 -04:00
Richard Moore
ab319f2f4c Include events on ContractFactory deployment transactions (#1334). 2021-10-17 21:38:47 -04:00
Richard Moore
5b94ce2966 admin: updated dist files 2021-10-17 16:23:46 -04:00
Richard Moore
91c577b611 Removed non-english tests from the browser. 2021-10-17 16:18:22 -04:00
Richard Moore
2f363da5ff admin: add changelog 2021-10-16 02:31:02 -04:00
Richard Moore
73a46efea3 admin: updated dist files 2021-10-16 02:29:27 -04:00
Richard Moore
8f3d71dc5f admin: fixed alias script (#1494). 2021-10-16 01:53:12 -04:00
Richard Moore
a5c6a468f4 Better errors when non-string address or ENS name is passed into Contracts or provider methods (#1051). 2021-10-16 01:30:06 -04:00
Richard Moore
8947fd405e Use personal_sign instead of eth_sign for message signing with JsonRpcSigner; added _legacySignMessage for legacy support (#1542, #1840). 2021-10-16 01:11:53 -04:00
Richard Moore
cb43a99405 Removed extra wordlists from the dist files (#2058, #2077). 2021-10-15 22:34:03 -04:00
Richard Moore
b7e61bd67e admin: use https endpoints for NPM registry 2021-10-15 22:03:35 -04:00
Richard Moore
0a8be37b08 Fix issue when Solidity method collises with JavaScript prototype (#1432, #2054, #2120). 2021-10-15 21:32:48 -04:00
Richard Moore
6582ede1ce Add support for Cloudflare Workers (#1886). 2021-10-05 16:57:51 -04:00
Richard Moore
f3c6d819f3 Added more information to some invalid argument errors (#1130). 2021-10-05 16:05:40 -04:00
Richard Moore
bee76a49b2 Fix compile-time error in new TypeScript version. 2021-10-05 15:48:14 -04:00
Richard Moore
68095a48ae Adding customData support to transactions to assist L2 chains (#1761). 2021-10-05 15:47:26 -04:00
Richard Moore
0e5419ec79 Added some explicit null results to previously implicit null results for ENS (#1850). 2021-10-04 12:19:48 -04:00
Richard Moore
a48552a4fb Added BigNumber _difficulty to Block results (#2001, #2036). 2021-10-04 12:09:44 -04:00
Richard Moore
ab806cad15 docs: fixed typo (#1770). 2021-10-04 11:49:33 -04:00
Richard Moore
d5b41ce210 Removed redundant call to normalizing blockTag (1838). 2021-10-04 11:48:36 -04:00
Richard Moore
fb6d141723 docs: fixed typos in comments; h/t @ly0va (#1838). 2021-10-04 11:46:24 -04:00
Richard Moore
7a404fb8ed Fixed isBytes check for invalid length or elements (#1964). 2021-10-04 11:21:43 -04:00
Richard Moore
f8adf82e16 Fixed randomBytes not rejecting NaN as a length (#1977). 2021-10-04 11:08:58 -04:00
Richard Moore
8395cc146f docs: fixed typo in providers README (#1979). 2021-10-04 10:59:37 -04:00
Richard Moore
8fc5914c5a docs: fixed typo in cookbook (#2011). 2021-10-04 10:58:10 -04:00
Richard Moore
cc250b2060 Allow any Networkish for getDefaultProvider (#2031). 2021-10-04 10:57:00 -04:00
Richard Moore
375627f6b1 docs: updated signer prefix info (#2032). 2021-10-04 10:54:31 -04:00
Richard Moore
d67f8fb778 docs: fixed capitalization of MetaMask (#2033). 2021-10-04 10:52:34 -04:00
Richard Moore
45f367512d Stop allowing commas in fixed numbers; left over from legacy comma support (#2083). 2021-10-04 10:48:27 -04:00
Richard Moore
ad87b718a9 docs: fixed typos in comments (#2087). 2021-10-04 10:46:35 -04:00
Richard Moore
48c9e0bf39 Export FallbackProviderConfig (#2121). 2021-10-04 10:44:24 -04:00
Richard Moore
d1d636b503 docs: fixed typo (#2125). 2021-10-04 10:41:54 -04:00
Richard Moore
4166b2753d Updated dist files. 2021-09-16 13:19:43 -04:00
Richard Moore
32a6b2a362 Fix parseUints with excess zeros and fix ReDoS issue (#2016, #1975, #1976). 2021-09-16 13:04:32 -04:00
Richard Moore
f2a32d0d5b docs: added provider.FeeData 2021-08-27 15:35:23 -04:00
Richard Moore
5762a1f83d updated dist files. 2021-08-27 15:34:47 -04:00
Richard Moore
8320d534d7 Temporarily remove the block miner for clique-based networks from CI testing (#1967). 2021-08-27 15:29:52 -04:00
Richard Moore
c41b89a0c1 updated dist files. 2021-08-24 16:15:51 -03:00
Richard Moore
b6a061e7bf More readable errors involving Uint8Arrays. 2021-08-24 16:08:27 -03:00
Richard Moore
a662490e82 Added Deferred Error support to Description objects to extent Interface parse methods (#1894). 2021-08-24 16:03:12 -03:00
Richard Moore
bdb54ac52b docs: added cookbook entry to compute raw transaction (#1857). 2021-08-24 14:54:15 -03:00
Richard Moore
32a90b66f0 docs: added Alchemy tutorial 2021-08-24 14:43:27 -03:00
Richard Moore
95b87f61a6 docs: added BigNumber.toBigInt (#1799). 2021-08-24 14:42:38 -03:00
Richard Moore
017b1feba2 Fix address coder to prepare non-hexdatastring addresses as hexdatastring (#1906). 2021-08-24 14:33:04 -03:00
Richard Moore
accb85268c Removed temporary code for better errors needed until Alchemy added EIP-1559 support (#1893). 2021-08-23 23:02:32 -03:00
Richard Moore
f0b3bc32d5 Updated dist files. 2021-08-18 03:05:48 -03:00
Richard Moore
78e4273a32 Fxied getBlockWithTransactions results (1858). 2021-08-18 02:59:47 -03:00
Richard Moore
dd09bf0735 docs: dded code examples for Contract (#982). 2021-08-10 00:20:16 -03:00
Richard Moore
4b163e9e73 docs: added dynamic localSigner 2021-08-09 17:49:24 -03:00
Richard Moore
aacb95cd6b docs: added struct encoding example (#1147, #1301, #1302). 2021-08-09 17:47:33 -03:00
Richard Moore
e6315a6b3c docs: remove need to restart dev node after each run. 2021-08-09 17:46:33 -03:00
Richard Moore
3ac91a414c docs: added StaticJsonRpcProvider (#1514, #1531). 2021-08-09 16:02:37 -03:00
Richard Moore
2dd5c1a6d2 docs: Fixed topicset example (#1538). 2021-08-09 15:48:02 -03:00
Richard Moore
2653449f3c docs: updated transactions for EIP-1559. 2021-08-09 15:42:33 -03:00
Richard Moore
cddb03880a docs: added API for custom error coding. 2021-08-09 15:41:36 -03:00
Richard Moore
e80f8dd4e6 docs: updates for EIP-1559 (#1777). 2021-08-09 15:40:37 -03:00
Richard Moore
1b4bc7a6a6 docs: Fix listAccounts return type (#1851). 2021-08-09 15:35:43 -03:00
Richard Moore
4e9394554b Updated dist files. 2021-08-04 01:39:05 -03:00
Richard Moore
1d27d95670 Fixed Etherscan API key in default provider (#1807). 2021-08-04 01:32:30 -03:00
Richard Moore
2e431a5002 Temporarily remove Pocket fro provider tests. 2021-08-04 01:28:54 -03:00
Richard Moore
da4e107268 Update dist files. 2021-08-02 22:57:45 -03:00
Richard Moore
7175e2e99c Adjust default masPriorityFeePerGas to account for MEV-heavy blocks (#1817). 2021-08-02 22:52:29 -03:00
Richard Moore
68229ac0af Updated dist files. 2021-07-29 23:30:17 -04:00
Richard Moore
7274cd06cf Fixed JsonRpcProvider for pre-EIP-2930 chains (#1766). 2021-07-29 23:20:56 -04:00
Richard Moore
be3854e648 Forward some missing EIP-1559 fields to call and estimateGas (#1766). 2021-07-29 23:12:29 -04:00
Richard Moore
63f8b28223 Fixed possible UnhandledPromiseException for bad ENS names. 2021-07-29 23:11:06 -04:00
Richard Moore
593b4886ff Prevent overriding value for non-payble constructors (#1785). 2021-07-29 17:25:19 -04:00
Richard Moore
6d1904c379 Updated dist files. 2021-07-23 17:24:05 -04:00
Richard Moore
0aafca71db Fix test case for new transactions responses. 2021-07-23 17:17:43 -04:00
Richard Moore
0d40156fcb Updated dist files. 2021-07-23 02:21:24 -04:00
Richard Moore
576e9b54ab Added matic support to INFURA and Alchemy (#1546). 2021-07-23 02:13:35 -04:00
Richard Moore
bc5cc2e7e3 Added string change to coalesce errors on some clients. 2021-07-23 01:52:43 -04:00
Richard Moore
660e69db71 Added wait to transactions returned by getBlockWithTransactions (#971). 2021-07-22 20:04:07 -04:00
Richard Moore
551cfa0062 Fixed floor, ceiling and round for FixedNumber for non-default Formats (#1749). 2021-07-22 19:40:49 -04:00
Richard Moore
0f0d0c00d3 Fixed null confirmations in Wallet transaction (#1706). 2021-07-06 00:07:32 -04:00
Richard Moore
a1f8d188a7 Fixed Etherscan string change and enabled all tests. 2021-07-03 00:45:03 -04:00
Richard Moore
bde861436e updated dist files. 2021-07-02 01:49:02 -04:00
Richard Moore
6e8a39ec35 Added Pocket back into Homestead defaultProvider and skip certain EtherscanProvider tests affected by outage. 2021-07-02 01:42:16 -04:00
Richard Moore
ecae793edf Fixed EtherscanProvider NONCE_EXPIRED matching string update. 2021-07-02 00:18:53 -04:00
Richard Moore
bac684c5a0 docs: fixd type 2021-07-01 23:32:53 -04:00
Richard Moore
53671d0b17 docs: fixed typo (#1727) 2021-07-01 23:25:01 -04:00
Richard Moore
25c8b8b3e6 docs: fixed typo (#1729) 2021-07-01 23:22:14 -04:00
Richard Moore
a0fa92c075 updated dist files. 2021-06-29 12:25:07 -04:00
Richard Moore
72feee8f58 Fixed explicit EIP-1559 keys for JsonRpcSigner. 2021-06-29 11:57:53 -04:00
718 changed files with 12350 additions and 7884 deletions

View File

@@ -15,7 +15,7 @@ jobs:
strategy:
fail-fast: false
matrix:
node-version: [ 8.x, 10.x, 12.x, 13.x ]
node-version: [ 12.x, 14.x, 16.x ]
steps:
- name: Use Node.js ${{ matrix.node-version }}

View File

@@ -3,6 +3,131 @@ Changelog
This change log is managed by `admin/cmds/update-versions` but may be manually updated.
ethers/v5.6.0 (2022-03-09 14:57)
--------------------------------
- Tweaked test case to re-order transaction after event listeners added. ([fa4a290](https://github.com/ethers-io/ethers.js/commit/fa4a29028d97d598b43b2f5ff98077e8cadf56a4))
- Ignore errors when resolving ENS resolver properties. ([d160bac](https://github.com/ethers-io/ethers.js/commit/d160bac273775f928a9441b0275dbdb6032368fa))
- Enable CCIP Read for ENS resolvers. ([#2478](https://github.com/ethers-io/ethers.js/issues/2478); [be518c3](https://github.com/ethers-io/ethers.js/commit/be518c32ec7db9dd4769b57cdf130eb333aebb72))
- Fix missing events on certain network conditions. ([#1798](https://github.com/ethers-io/ethers.js/issues/1798), [#1814](https://github.com/ethers-io/ethers.js/issues/1814), [#1830](https://github.com/ethers-io/ethers.js/issues/1830), [#2274](https://github.com/ethers-io/ethers.js/issues/2274), [#2652](https://github.com/ethers-io/ethers.js/issues/2652); [f67a9a8](https://github.com/ethers-io/ethers.js/commit/f67a9a8569cdfd0ef9ce5fbf09866aab6e4814d4), [f46aa75](https://github.com/ethers-io/ethers.js/commit/f46aa75ef1f3428e640cd046db3f080d264b32f3))
- Added defaultProvider option to omit specific Providers. ([bae215e](https://github.com/ethers-io/ethers.js/commit/bae215eb7fb3efea8473a544579abac1bebb7ef0))
- Add support for pending blocks. ([#2225](https://github.com/ethers-io/ethers.js/issues/2225); [54e6e57](https://github.com/ethers-io/ethers.js/commit/54e6e57fcece4c1718a577ecbeb1af97998e8bdc))
- Help URLs for errors. ([#2489](https://github.com/ethers-io/ethers.js/issues/2489); [38e825c](https://github.com/ethers-io/ethers.js/commit/38e825cee624ff935ec6b70023cf288126a6bb85), [c562150](https://github.com/ethers-io/ethers.js/commit/c562150d2678710f50e5ee3ffa88d0e62d6f696f))
- Added CCIP support to provider.call. ([#2478](https://github.com/ethers-io/ethers.js/issues/2478); [ae23bb7](https://github.com/ethers-io/ethers.js/commit/ae23bb76a937924bf57baf679e6efd8cdf59bc47))
- Adjust default maxPriorityFeePerGas to 1.5 gwei. ([33a029e](https://github.com/ethers-io/ethers.js/commit/33a029e457320a226c68a01f4cfa2d110125a8b8))
- Fix contracts when name resolution fails without any checks. ([#2737](https://github.com/ethers-io/ethers.js/issues/2737); [c2a6a01](https://github.com/ethers-io/ethers.js/commit/c2a6a012bf1d8fcd5805e45754cebdfe211c6933))
- Preserve explicit chainId in JsonRpcProvider during transaction serialization. ([#2691](https://github.com/ethers-io/ethers.js/issues/2691); [6807a76](https://github.com/ethers-io/ethers.js/commit/6807a76b8ddfdd121f98b21e269de3b195a7673e))
- Fixed eth_chainId response for Eip1193Bridge. ([#2711](https://github.com/ethers-io/ethers.js/issues/2711); [5f26fd5](https://github.com/ethers-io/ethers.js/commit/5f26fd55c9d010c00f830a4c83a480a54773858d))
- Remove spurious console.log from Interface. ([#2714](https://github.com/ethers-io/ethers.js/issues/2714); [4e8f004](https://github.com/ethers-io/ethers.js/commit/4e8f004e9e42892840663311cafe042c0b24c61e))
- Allow raw WebSocket to be passed into WebSocketProvider. ([#2562](https://github.com/ethers-io/ethers.js/issues/2562), [#2644](https://github.com/ethers-io/ethers.js/issues/2644); [9aac785](https://github.com/ethers-io/ethers.js/commit/9aac785395e9b47655477a3ba7baf05df3274de9))
- Added Cloudflare Worker support. ([#1886](https://github.com/ethers-io/ethers.js/issues/1886); [2d98b4f](https://github.com/ethers-io/ethers.js/commit/2d98b4fca1eb2544fec728f7c1c7b0d450e0dbee), [1651389](https://github.com/ethers-io/ethers.js/commit/1651389571b5dd16c1c056dcd94729b48a4bdd85))
- Add support for EIP-2098 compact signatures. ([#2246](https://github.com/ethers-io/ethers.js/issues/2246); [f26074b](https://github.com/ethers-io/ethers.js/commit/f26074b92b0fc8efd3d85c68e84cc6ff8897e4a8))
- Add EIP-2544 Wildcard support. ([#2477](https://github.com/ethers-io/ethers.js/issues/2477), [#2582](https://github.com/ethers-io/ethers.js/issues/2582), [#2583](https://github.com/ethers-io/ethers.js/issues/2583); [83891f9](https://github.com/ethers-io/ethers.js/commit/83891f9258492f9801aa579ac50764b6491b6180))
ethers/v5.5.4 (2022-01-24 16:45)
--------------------------------
- Support invalid but popular IPFS URI format. ([#2271](https://github.com/ethers-io/ethers.js/issues/2271), [#2527](https://github.com/ethers-io/ethers.js/issues/2527), [#2590](https://github.com/ethers-io/ethers.js/issues/2590); [03545aa](https://github.com/ethers-io/ethers.js/commit/03545aa78b0e7bd177e22432e4842b0580a11d7d))
ethers/v5.5.3 (2022-01-06 03:52)
--------------------------------
- Fixed case-folding in schemes for ENS avatars. ([#2500](https://github.com/ethers-io/ethers.js/issues/2500); [3f5bc6d](https://github.com/ethers-io/ethers.js/commit/3f5bc6ddc1013f0a5974f2ee6f542d6c91480c13))
- Added Kintsugi network. ([#2434](https://github.com/ethers-io/ethers.js/issues/2434); [ab13887](https://github.com/ethers-io/ethers.js/commit/ab13887cda3939703dc1f7e27d139ef6001b7dd2))
- Fix browser random in WebWorkers. ([#2405](https://github.com/ethers-io/ethers.js/issues/2405); [4ba63ac](https://github.com/ethers-io/ethers.js/commit/4ba63acc107fdd0a6d6ef3e27349e65edb007447))
- Add support for IPFS metadata imageUrl in getAvatar. ([#2426](https://github.com/ethers-io/ethers.js/issues/2426); [3d6a7ec](https://github.com/ethers-io/ethers.js/commit/3d6a7ec020eacd993b4b0fd3274574de3ddcc257))
- Do not swallow ENS not supported errors. ([#2387](https://github.com/ethers-io/ethers.js/issues/2387); [2f57c6a](https://github.com/ethers-io/ethers.js/commit/2f57c6a4ab44083b2c03f5e57b2702ab7078d286))
ethers/v5.5.2 (2021-11-30 19:16)
--------------------------------
- Fixed test case for getAvatar; url has moved ([617714d](https://github.com/ethers-io/ethers.js/commit/617714d19632c7b4789f042ef8357f858421fbae))
- Added basic redirect support. ([42784b8](https://github.com/ethers-io/ethers.js/commit/42784b8d38a96170d19ea8adcbc42ebf7415804c))
- Added arbitrum and optimism to networks and providers. ([#2335](https://github.com/ethers-io/ethers.js/issues/2335); [0844de4](https://github.com/ethers-io/ethers.js/commit/0844de4eb45eb4170fafb6f2a239b53b6be22f1c))
- Added support for data URLs for avatar metadata. ([b8391b0](https://github.com/ethers-io/ethers.js/commit/b8391b0e61bf3627702668920c4fd6506f9bdc60))
- Fixed getAvatar for unconfigured ENS names. ([1e1c93e](https://github.com/ethers-io/ethers.js/commit/1e1c93effa083765be52f3dee10400a9b3eeb003))
ethers/v5.5.1 (2021-10-20 03:59)
--------------------------------
- Fixed abstract Provider signature issue. ([#2190](https://github.com/ethers-io/ethers.js/issues/2190); [1bd9161](https://github.com/ethers-io/ethers.js/commit/1bd91615eedcb34a24fca04aa93a9aac394968ed))
ethers/v5.5.0 (2021-10-19 00:01)
--------------------------------
- Added ENS avatar support to provider. ([#2185](https://github.com/ethers-io/ethers.js/issues/2185); [ecce861](https://github.com/ethers-io/ethers.js/commit/ecce86125d87ef5258406bde2fff5bc8c9ff3141))
- Fixed splitSignature logic for verifying EIP-2930 and EIP-1559 v. ([#2084](https://github.com/ethers-io/ethers.js/issues/2084); [3de1b81](https://github.com/ethers-io/ethers.js/commit/3de1b815014b10d223a42e524fe9c25f9087293b))
- Include events on ContractFactory deployment transactions. ([#1334](https://github.com/ethers-io/ethers.js/issues/1334); [ab319f2](https://github.com/ethers-io/ethers.js/commit/ab319f2f4c365d4cd1b1e17e577ecd18a7a89276))
- admin: fixed alias script. ([#1494](https://github.com/ethers-io/ethers.js/issues/1494); [8f3d71d](https://github.com/ethers-io/ethers.js/commit/8f3d71dc5fd0e91407737a4b82c58c31269ed2be))
- Better errors when non-string address or ENS name is passed into Contracts or provider methods. ([#1051](https://github.com/ethers-io/ethers.js/issues/1051); [a5c6a46](https://github.com/ethers-io/ethers.js/commit/a5c6a468f4a7ad29fb5277e08c6b8b208383a575))
- Use personal_sign instead of eth_sign for message signing with JsonRpcSigner; added _legacySignMessage for legacy support. ([#1542](https://github.com/ethers-io/ethers.js/issues/1542), [#1840](https://github.com/ethers-io/ethers.js/issues/1840); [8947fd4](https://github.com/ethers-io/ethers.js/commit/8947fd405e3aea07f6db958d89a3ad39abe3a25a))
- Removed extra wordlists from the dist files. ([#2058](https://github.com/ethers-io/ethers.js/issues/2058), [#2077](https://github.com/ethers-io/ethers.js/issues/2077); [cb43a99](https://github.com/ethers-io/ethers.js/commit/cb43a99405cdc5bdcc875efc1821e00e55447791))
- Fix issue when Solidity method collises with JavaScript prototype. ([#1432](https://github.com/ethers-io/ethers.js/issues/1432), [#2054](https://github.com/ethers-io/ethers.js/issues/2054), [#2120](https://github.com/ethers-io/ethers.js/issues/2120); [0a8be37](https://github.com/ethers-io/ethers.js/commit/0a8be37b087470d9354f387d7c439cb0166eaf4d))
- Add support for Cloudflare Workers. ([#1886](https://github.com/ethers-io/ethers.js/issues/1886); [6582ede](https://github.com/ethers-io/ethers.js/commit/6582ede1ce46be0b3abafb120e052b95a2d172b3))
- Added more information to some invalid argument errors. ([#1130](https://github.com/ethers-io/ethers.js/issues/1130); [f3c6d81](https://github.com/ethers-io/ethers.js/commit/f3c6d819f34b6d93f53d98b9f337ade5aa37a594))
- Fix compile-time error in new TypeScript version. ([bee76a4](https://github.com/ethers-io/ethers.js/commit/bee76a49b2e5f95ea2eab49aabf5e44cb4ca794b))
- Adding customData support to transactions to assist L2 chains. ([#1761](https://github.com/ethers-io/ethers.js/issues/1761); [68095a4](https://github.com/ethers-io/ethers.js/commit/68095a48ae19ed06cbcf2f415f1fcbda90d4b2ae))
- Added some explicit null results to previously implicit null results for ENS. ([#1850](https://github.com/ethers-io/ethers.js/issues/1850); [0e5419e](https://github.com/ethers-io/ethers.js/commit/0e5419ec79cb18d82bab8c47bfa3ab4a21cfd293))
- Added BigNumber _difficulty to Block results. ([#2001](https://github.com/ethers-io/ethers.js/issues/2001), [#2036](https://github.com/ethers-io/ethers.js/issues/2036); [a48552a](https://github.com/ethers-io/ethers.js/commit/a48552a4fb85a08178d07437a3934db98b7d0736))
- Removed redundant call to normalizing blockTag (1838). ([d5b41ce](https://github.com/ethers-io/ethers.js/commit/d5b41ce210c0f22dd795749810f6ce798f71a00f))
- Fixed isBytes check for invalid length or elements. ([#1964](https://github.com/ethers-io/ethers.js/issues/1964); [7a404fb](https://github.com/ethers-io/ethers.js/commit/7a404fb8ed95a99baab8f3b384f438b697fa5d76))
- Fixed randomBytes not rejecting NaN as a length. ([#1977](https://github.com/ethers-io/ethers.js/issues/1977); [f8adf82](https://github.com/ethers-io/ethers.js/commit/f8adf82e16aaad1a7c1750e7f2e3a9f8073b73e1))
- Allow any Networkish for getDefaultProvider. ([#2031](https://github.com/ethers-io/ethers.js/issues/2031); [cc250b2](https://github.com/ethers-io/ethers.js/commit/cc250b2060451e0ee6b1cf3edb6b005f9eee9c61))
- Stop allowing commas in fixed numbers; left over from legacy comma support. ([#2083](https://github.com/ethers-io/ethers.js/issues/2083); [45f3675](https://github.com/ethers-io/ethers.js/commit/45f367512d1d5dccfd06fad9cc8688e4d0cccdb8))
- Export FallbackProviderConfig. ([#2121](https://github.com/ethers-io/ethers.js/issues/2121); [48c9e0b](https://github.com/ethers-io/ethers.js/commit/48c9e0bf39eec9b5b30ab7cd5685effdccaa1b1a))
ethers/v5.4.7 (2021-09-16 13:17)
--------------------------------
- Fix parseUints with excess zeros and fix ReDoS issue. ([#2016](https://github.com/ethers-io/ethers.js/issues/2016), [#1975](https://github.com/ethers-io/ethers.js/issues/1975), [#1976](https://github.com/ethers-io/ethers.js/issues/1976); [32a6b2a](https://github.com/ethers-io/ethers.js/commit/32a6b2a362815eb85ce3f3abad5adf92f2b80e10))
ethers/v5.4.6 (2021-08-27 15:34)
--------------------------------
- Temporarily remove the block miner for clique-based networks from CI testing. ([#1967](https://github.com/ethers-io/ethers.js/issues/1967); [8320d53](https://github.com/ethers-io/ethers.js/commit/8320d534d78173dfa8ecb4def634a00483a6aa9c))
- More readable errors involving Uint8Arrays. ([b6a061e](https://github.com/ethers-io/ethers.js/commit/b6a061e7bfd14c1f2df1418df37f704275908e8b))
- Added Deferred Error support to Description objects to extent Interface parse methods. ([#1894](https://github.com/ethers-io/ethers.js/issues/1894); [a662490](https://github.com/ethers-io/ethers.js/commit/a662490e82a9b71b5f6dee0a8242e6fa78409d79))
- Fix address coder to prepare non-hexdatastring addresses as hexdatastring. ([#1906](https://github.com/ethers-io/ethers.js/issues/1906); [017b1fe](https://github.com/ethers-io/ethers.js/commit/017b1feba2c9dea88f078b299d211cbd58d43b49))
- Removed temporary code for better errors needed until Alchemy added EIP-1559 support. ([#1893](https://github.com/ethers-io/ethers.js/issues/1893); [accb852](https://github.com/ethers-io/ethers.js/commit/accb85268c92fa894e769ec1dca322e117d33e5f))
ethers/v5.4.5 (2021-08-18 03:05)
--------------------------------
- Fxied getBlockWithTransactions results (#1858). ([78e4273](https://github.com/ethers-io/ethers.js/commit/78e4273a327d12da9a1ec008d3f2146d97385921))
ethers/v5.4.4 (2021-08-04 01:37)
--------------------------------
- Fixed Etherscan API key in default provider. ([#1807](https://github.com/ethers-io/ethers.js/issues/1807); [1d27d95](https://github.com/ethers-io/ethers.js/commit/1d27d95670ee3a51879393fed44297128c4a42a3))
- Adjust default masPriorityFeePerGas to account for MEV-heavy blocks. ([#1817](https://github.com/ethers-io/ethers.js/issues/1817); [7175e2e](https://github.com/ethers-io/ethers.js/commit/7175e2e99c2747e8d2314feb407bf0a0f9371ece))
ethers/v5.4.3 (2021-07-29 23:26)
--------------------------------
- Fixed JsonRpcProvider for pre-EIP-2930 chains. ([#1766](https://github.com/ethers-io/ethers.js/issues/1766); [7274cd0](https://github.com/ethers-io/ethers.js/commit/7274cd06cf3f6f31c6df3fd6636706d8536b7ee2))
- Forward some missing EIP-1559 fields to call and estimateGas. ([#1766](https://github.com/ethers-io/ethers.js/issues/1766); [be3854e](https://github.com/ethers-io/ethers.js/commit/be3854e648fdef0478db8a64c26be6d9e90cf453))
- Fixed possible UnhandledPromiseException for bad ENS names. ([63f8b28](https://github.com/ethers-io/ethers.js/commit/63f8b2822318d1e0fcc41f4662feb6e5ae338f3d))
- Prevent overriding value for non-payble constructors. ([#1785](https://github.com/ethers-io/ethers.js/issues/1785); [593b488](https://github.com/ethers-io/ethers.js/commit/593b4886ff607d00d656b8131b843933eb48838e))
ethers/v5.4.2 (2021-07-23 17:22)
--------------------------------
- Fix test case for new transactions responses. ([0aafca7](https://github.com/ethers-io/ethers.js/commit/0aafca71dbc019beb398e1b5a0f24936a4fd215a))
- Added matic support to INFURA and Alchemy. ([#1546](https://github.com/ethers-io/ethers.js/issues/1546); [576e9b5](https://github.com/ethers-io/ethers.js/commit/576e9b54abc3ff048113f93f765aa3177bf3b819))
- Added string change to coalesce errors on some clients. ([bc5cc2e](https://github.com/ethers-io/ethers.js/commit/bc5cc2e7e34f6cc69c43c1665be9c18854fb26b8))
- Added wait to transactions returned by getBlockWithTransactions. ([#971](https://github.com/ethers-io/ethers.js/issues/971); [660e69d](https://github.com/ethers-io/ethers.js/commit/660e69db71d42084b1fe791d864d13f0111f84fb))
- Fixed floor, ceiling and round for FixedNumber for non-default Formats. ([#1749](https://github.com/ethers-io/ethers.js/issues/1749); [551cfa0](https://github.com/ethers-io/ethers.js/commit/551cfa0062ec1645c9310335e0e6cbd250bb3788))
- Fixed null confirmations in Wallet transaction. ([#1706](https://github.com/ethers-io/ethers.js/issues/1706); [0f0d0c0](https://github.com/ethers-io/ethers.js/commit/0f0d0c00d3fc14e5454169d42a9286b1d8b0abef))
- Fixed Etherscan string change and enabled all tests. ([a1f8d18](https://github.com/ethers-io/ethers.js/commit/a1f8d188a7bc0b0d11426b7ef0d018cc1b7b399d))
ethers/v5.4.1 (2021-07-02 01:47)
--------------------------------
- Added Pocket back into Homestead defaultProvider and skip certain EtherscanProvider tests affected by outage. ([6e8a39e](https://github.com/ethers-io/ethers.js/commit/6e8a39ec35123e681e47807f54ef9b9122635ea0))
- Fixed EtherscanProvider NONCE_EXPIRED matching string update. ([ecae793](https://github.com/ethers-io/ethers.js/commit/ecae793edff172a885e5ee014a8ad0b28b68c1e5))
- Fixed explicit EIP-1559 keys for JsonRpcSigner. ([72feee8](https://github.com/ethers-io/ethers.js/commit/72feee8f5841febdab0d15f09baa69539d95e199))
ethers/v5.4.0 (2021-06-26 01:50)
--------------------------------

View File

@@ -46,7 +46,7 @@ The INFURA service has been around for quite some time and is very robust
and reliable and highly recommended.
They offer a standard JSON-RPC interface and a WebSocket interface, which makes
interaction with standard tools versatile, simple and straight forward.
interaction with standard tools versatile, simple and straightforward.
[Sign up for a free Project ID on INFURA](link-infura-signup)

View File

@@ -0,0 +1,34 @@
// Do not use this; it is only for an example in the docs
contract MyToken {
event Transfer(address indexed from, address indexed to, uint amount);
mapping (address => uint256) _balances;
constructor(uint256 totalSupply) {
emit Transfer(address(0), msg.sender, totalSupply);
_balances[msg.sender] = totalSupply;
}
// Read-Only Functions
function balanceOf(address owner) public view returns (uint256) {
return _balances[owner];
}
function decimals() public pure returns (uint8) {
return 18;
}
function symbol() public pure returns (string memory) {
return "MyToken";
}
// Authenticated Functions
function transfer(address to, uint amount) public returns (bool) {
require(_balances[msg.sender] >= amount, "insufficient token balance");
_balances[msg.sender] -= amount;
_balances[to] += amount;
emit Transfer(msg.sender, to, amount);
return true;
}
}

View File

@@ -23,7 +23,7 @@ Consumes the output of the Solidity compiler, extracting the ABI
and bytecode from it, allowing for the various formats the solc
compiler has emitted over its life.
_property: contractFactory.connect(signer) => [[Contract]] @<ContractFactory-connect>
_property: contractFactory.connect(signer) => [[ContractFactory]] @<ContractFactory-connect>
Returns a **new instance** of the ContractFactory with the same //interface//
and //bytecode//, but with a different //signer//.

View File

@@ -98,11 +98,12 @@ at run-time during the **Contract** constructor.
_heading: Read-Only Methods (constant) @<Contract--readonly>
A constant method is read-only and evaluates a small amount of EVM
code against the current blockchain state and can be computed by
asking a single node, which can return a result. It is therefore
free and does not require any ether, but **cannot make changes** to
the blockchain state..
A constant method (denoted by ``pure`` or ``view`` in Solidity)
is read-only and evaluates a small amount of EVM code against the
current blockchain state and can be computed by asking a single
node, which can return a result. It is therefore free and does
not require any ether, but **cannot make changes** to the
blockchain state..
_property: contract.METHOD_NAME(...args [, overrides ]) => Promise<any> @<Contract-functionsCall>
The type of the result depends on the ABI. If the method returns a single
@@ -111,7 +112,7 @@ be returned with each parameter available positionally and if the parameter
is named, it will also be available by its name.
For values that have a simple meaning in JavaScript, the types are fairly
straight forward; strings and booleans are returned as JavaScript strings
straightforward; strings and booleans are returned as JavaScript strings
and booleans.
For numbers, if the **type** is in the JavaScript safe range (i.e. less
@@ -132,7 +133,7 @@ The //overrides// object for a read-only method may include any of:
- ``overrides.from`` - the ``msg.sender`` (or ``CALLER``) to use during the
execution of the code
- ``overrides.value`` - the ``msg.value`` (or ``CALLVALUE``) to use during the
exectuiont of the code
execution of the code
- ``overrides.gasPrice`` - the price to pay per gas (theoretically); since there
is no transaction, there is not going to be any fee charged, but the EVM still
requires a value to report to ``tx.gasprice`` (or ``GASPRICE``);

View File

@@ -1,10 +1,75 @@
_section: Example: ERC-20 Contract
The concept of Meta-Classes is somewhat confusing, so we will go
over a short example.
A meta-class is a class which is defined at run-time. A Contract
is specified by an //Application Binary Interface// (ABI), which describes
the methods and events it has. This description is passed the the
[[Contract]] object at run-time, and it creates a new Class, adding
all the methods defined in the ABI at run-time.
_subsection: Deploying a Contract
Most often, any contract you will need to interact with will already
be deployed to the blockchain, but for this example will will first
deploy the contract.
_property: new ethers.ContractFactory(abi, bytecode, signer)
Create a new [[ContractFactory]] which can deploy a contract to the
blockchain.
_code: @lang<javascript>
//_hide: const signer = localSigner;
//_hide: const parseUnits = utils.parseUnits;
const bytecode = "0x608060405234801561001057600080fd5b506040516103bc3803806103bc83398101604081905261002f9161007c565b60405181815233906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a333600090815260208190526040902055610094565b60006020828403121561008d578081fd5b5051919050565b610319806100a36000396000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c8063313ce5671461005157806370a082311461006557806395d89b411461009c578063a9059cbb146100c5575b600080fd5b604051601281526020015b60405180910390f35b61008e610073366004610201565b6001600160a01b031660009081526020819052604090205490565b60405190815260200161005c565b604080518082018252600781526626bcaa37b5b2b760c91b6020820152905161005c919061024b565b6100d86100d3366004610222565b6100e8565b604051901515815260200161005c565b3360009081526020819052604081205482111561014b5760405162461bcd60e51b815260206004820152601a60248201527f696e73756666696369656e7420746f6b656e2062616c616e6365000000000000604482015260640160405180910390fd5b336000908152602081905260408120805484929061016a9084906102b6565b90915550506001600160a01b0383166000908152602081905260408120805484929061019790849061029e565b90915550506040518281526001600160a01b0384169033907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a350600192915050565b80356001600160a01b03811681146101fc57600080fd5b919050565b600060208284031215610212578081fd5b61021b826101e5565b9392505050565b60008060408385031215610234578081fd5b61023d836101e5565b946020939093013593505050565b6000602080835283518082850152825b818110156102775785810183015185820160400152820161025b565b818111156102885783604083870101525b50601f01601f1916929092016040019392505050565b600082198211156102b1576102b16102cd565b500190565b6000828210156102c8576102c86102cd565b500390565b634e487b7160e01b600052601160045260246000fdfea2646970667358221220d80384ce584e101c5b92e4ee9b7871262285070dbcd2d71f99601f0f4fcecd2364736f6c63430008040033";
// A Human-Readable ABI; we only need to specify relevant fragments,
// in the case of deployment this means the constructor
const abi = [
"constructor(uint totalSupply)"
];
const factory = new ethers.ContractFactory(abi, bytecode, signer)
// Deploy, setting total supply to 100 tokens (assigned to the deployer)
const contract = await factory.deploy(parseUnits("100"));
// The contract is not currentl live on the network yet, however
// its address is ready for us
//_result:
contract.address
//_log:
//_hide: _page.address = contract.address;
// Wait until the contract has been deployed before interacting
// with it; returns the receipt for the deployemnt transaction
//_result:
await contract.deployTransaction.wait();
//_log:
_subsection: Connecting to a Contract
_code: A simple ERC-20 contract @lang<javascript>
_heading: ERC20Contract @INHERIT<[[Contract]]>
// A Human-Readable ABI; any supported ABI format could be used
_property: new ethers.Contract(address, abi, providerOrSigner)
Creating a new instance of a Contract connects to an existing
contract by specifying its //address// on the blockchain,
its //abi// (used to populate the class' methods) a //providerOrSigner//.
If a [[Provider]] is given, the contract has only read-only access, while
a [[Signer]] offers access to state manipulating methods.
_code: @lang<javascript>
//_hide: const provider = localProvider;
//_hide: const signer = localSigner;
// A Human-Readable ABI; for interacting with the contract, we
// must include any fragment we wish to use
const abi = [
// Read-Only Functions
"function balanceOf(address owner) view returns (uint256)",
@@ -12,20 +77,15 @@ const abi = [
"function symbol() view returns (string)",
// Authenticated Functions
"function transfer(address to, uint amount) returns (boolean)",
"function transfer(address to, uint amount) returns (bool)",
// Events
"event Transfer(address indexed from, address indexed to, uint amount)"
];
// This can be an address or an ENS name
const address = "dai.tokens.ethers.eth";
// An example Provider
const provider = ethers.getDefaultProvider();
// An example Signer
const signer = ethers.Wallet.createRandom().connect(provider);
//_hide: const address = _page.address;
//_verbatim: `const address = ${ JSON.stringify(address) };`
// Read-Only; By connecting to a Provider, allows:
// - Any constant function
@@ -34,20 +94,13 @@ const signer = ethers.Wallet.createRandom().connect(provider);
// - Estimating Gas for non-constant (as an anonymous sender)
// - Static Calling non-constant methods (as anonymous sender)
const erc20 = new ethers.Contract(address, abi, provider);
//_hide: _page.erc20 = erc20;
// Read-Write; By connecting to a Signer, allows:
// - Everything from Read-Only (except as Signer, not anonymous)
// - Sending transactions for non-constant functions
const erc20_rw = new ethers.Contract(address, abi, signer)
_heading: ERC20Contract @INHERIT<[[Contract]]>
_property: new ethers.Contract(address, abi, providerOrSigner)
See the above code example for creating an Instance which will
(in addition to the Contact methods and properties) automatically
add the additional properties defined in //abi// to a **Contract**
connected to //address// using the //providerOrSigner//.
const erc20_rw = new ethers.Contract(address, abi, signer);
//_hide: _page.erc20_rw = erc20_rw;
_subsection: Properties @NOTE<(inheritted from [[Contract]])>
@@ -101,6 +154,8 @@ _property: Contract.isIndexed(value) => boolean
_subsection: Events @NOTE<(inheritted from [[Contract]])> @<erc20-events>
See [Meta-Class Filters](erc20-meta-events) for examples using events.
_property: erc20.queryFilter(event [ , fromBlockOrBlockHash [ , toBlock ]) => Promise<Array<Event>> @<erc20-queryfilter>
Return Events that match the //event//.
@@ -126,7 +181,7 @@ Unsubscribe all listeners for //event//. If no event is provided,
all events are unsubscribed.
_subsection: Meta-Class Methods @NOTE<(added at Runtime)>
_subsection: Meta-Class Methods @NOTE<(added at Runtime)> @<erc20-meta-methods>
Since the Contract is a Meta-Class, the methods available here depend
on the ABI which was passed into the **Contract**.
@@ -136,12 +191,35 @@ Returns the number of decimal places used by this ERC-20 token. This can be
used with [parseUnits](utils-parseUnits) when taking input from the user or
[formatUnits](utils-formatunits] when displaying the token amounts in the UI.
_code: @lang<javascript>
//_hide: const erc20 = _page.erc20;
//_result:
await erc20.decimals();
//_log:
_property: erc20.balanceOf(owner [, overrides ]) => Promise<[[BigNumber]]>
Returns the balance of //owner// for this ERC-20 token.
_code: @lang<javascript>
//_hide: const signer = localSigner;
//_hide: const erc20 = _page.erc20;
//_result:
await erc20.balanceOf(signer.getAddress())
//_log:
_property: erc20.symbol([ overrides ]) => Promise<string>
Returns the symbol of the token.
_code: @lang<javascript>
//_hide: const erc20 = _page.erc20;
//_result:
await erc20.symbol();
//_log:
_property: erc20_rw.transfer(target, amount [, overrides ]) => Promise<[[providers-TransactionResponse]]>
Transfers //amount// tokens to //target// from the current signer.
The return value (a boolean) is inaccessible during a write operation
@@ -149,20 +227,86 @@ using a transaction. Other techniques (such as events) are required
if this value is required. On-chain contracts calling the ``transfer``
function have access to this result, which is why it is possible.
_code: @lang<javascript>
//_hide: const signer = localSigner;
//_hide: const erc20_rw = _page.erc20_rw;
//_hide: const parseUnits = utils.parseUnits;
//_hide: const formatUnits = utils.formatUnits;
// Before...
//_result:
formatUnits(await erc20_rw.balanceOf(signer.getAddress()));
//_log:
// Transfer 1.23 tokens to the ENS name "ricmoo.eth"
//_result:
tx = await erc20_rw.transfer("ricmoo.eth", parseUnits("1.23"));
//_log:
// Wait for the transaction to be mined...
//_result:
await tx.wait();
//_log:
// After!
//_result:
formatUnits(await erc20_rw.balanceOf(signer.getAddress()));
//_log:
//_result:
formatUnits(await erc20_rw.balanceOf("ricmoo.eth"));
//_log:
_property: erc20.callStatic.transfer(target, amount [, overrides ]) => Promise<boolean>
Performs a dry-run of transferring //amount// tokens to //target// from
the current signer, without actually signing or sending a transaction.
This can be used to preflight check that a transaction will be successful.
_code: @lang<javascript>
//_hide: const erc20_rw = _page.erc20_rw;
//_hide: const randomWallet = ethers.Wallet.createRandom().connect(erc20_rw.provider);
//_hide: const parseUnits = utils.parseUnits;
// The signer has enough tokens to send, so true is returned
//_result:
await erc20_rw.callStatic.transfer("ricmoo.eth", parseUnits("1.23"));
//_log:
// A random address does not have enough tokens to
// send, in which case the contract throws an error
erc20_random = erc20_rw.connect(randomWallet);
//_throws:
await erc20_random.callStatic.transfer("ricmoo.eth", parseUnits("1.23"));
//_log:
_property: erc20.estimateGas.transfer(target, amount [, overrides ]) => Promise<[[BigNumber]]>
Returns an estimate for how many units of gas would be required
to transfer //amount// tokens to //target//.
_code: @lang<javascript>
//_hide: const erc20_rw = _page.erc20_rw;
//_hide: const parseUnits = utils.parseUnits;
//_result:
await erc20_rw.estimateGas.transfer("ricmoo.eth", parseUnits("1.23"));
//_log:
_property: erc20.populateTransaction.transfer(target, amount [, overrides ]) => Promise<[UnsignedTx](UnsignedTransaction)>
Returns an [[UnsignedTransaction]] which could be signed and submitted
to the network to transaction //amount// tokens to //target//.
_code: @lang<javascript>
//_hide: const erc20_rw = _page.erc20_rw;
//_hide: const parseUnits = utils.parseUnits;
//_result:
await erc20_rw.populateTransaction.transfer("ricmoo.eth", parseUnits("1.23"));
//_log:
_note: Note on Estimating and Static Calling
@@ -173,7 +317,7 @@ blockchain also means there are certain consistency modes that cannot be
known until an actual transaction is attempted.
_subsection: Meta-Class Filters @NOTE<(added at Runtime)>
_subsection: Meta-Class Filters @NOTE<(added at Runtime)> @<erc20-meta-events>
Since the Contract is a Meta-Class, the methods available here depend
on the ABI which was passed into the **Contract**.
@@ -184,3 +328,75 @@ to [subscribe/unsubscribe to events](erc20-events).
If //fromAddress// is null or not provided, then any from address matches.
If //toAddress// is null or not provided, then any to address matches.
_code: query filter *from* events @lang<javascript>
//_hide: const signer = localSigner;
//_hide: const erc20 = _page.erc20;
//_result:
filterFrom = erc20.filters.Transfer(signer.address);
//_log:
// Search for transfers *from* me in the last 10 blocks
//_result:
logsFrom = await erc20.queryFilter(filterFrom, -10, "latest");
//_log:
// Note that the args providees the details of the event, each
// parameters is available positionally, and since our ABI
// included parameter names also by name
//_result:
logsFrom[0].args
//_log:
//_hide: _page.filterFrom = filterFrom;
_code: query filter with *to* events @lang<javascript>
//_hide: const signer = localSigner;
//_hide: const erc20 = _page.erc20;
//_result:
filterTo = erc20.filters.Transfer(null, signer.address);
//_log:
// Search for transfers *to* me in the last 10 blocks
// Note: the contract transferred totalSupply tokens to us
// when it was deployed in its constructor
//_result:
logsTo = await erc20.queryFilter(filterTo, -10, "latest");
//_log:
// Note that the args providees the details of the event, each
// parameters is available positionally, and since our ABI
// included parameter names also by name
//_result:
logsTo[0].args
//_log:
//_hide: _page.filterTo = filterTo;
_code: listen for events @lang<javascript>
//_hide: const erc20 = _page.erc20;
//_hide: const filterFrom = _page.filterFrom;
//_hide: const filterTo = _page.filterTo;
// Listen to incoming events from signer:
erc20.on(filterFrom, (from, to, amount, event) => {
// The `from` will always be the signer address
});
// Listen to incoming events to signer:
erc20.on(filterTo, (from, to, amount, event) => {
// The `to` will always be the signer address
});
// Listen to all Transfer events:
erc20.on("Transfer", (from, to, amount, event) => {
// ...
});
//_hide: erc20.removeAllListeners();

View File

@@ -11,7 +11,7 @@ To mitigate these issues, it is recommended you use a
[Default Provider](providers-getDefaultProvider).
_subsection: EtherscanProvider @<EtherscanProvider> @inherit<[[Provider]]> @src<providers:class.EtherscanProvider>
_subsection: EtherscanProvider @<EtherscanProvider> @inherit<[[BaseProvider]]> @src<providers:class.EtherscanProvider>
The **EtherscanProvider** is backed by a combination of the various
[Etherscan APIs](link-etherscan-api).
@@ -39,11 +39,11 @@ It is highly recommended for production, you register with
_definition: **Supported Networks**
- Homestead (Mainnet)
- Ropsten (proof-of-work testnet)
- Rinkeby (proof-of-authority testnet)
- G&ouml;rli (clique testnet)
- Kovan (proof-of-authority testnet)
- ``homestead`` - Homestead (Mainnet)
- ``ropsten`` - Ropsten (proof-of-work testnet)
- ``rinkeby`` - Rinkeby (proof-of-authority testnet)
- ``goerli`` - G&ouml;rli (clique testnet)
- ``kovan`` - Kovan (proof-of-authority testnet)
_code: Etherscan Examples @lang<javascript>
@@ -106,11 +106,17 @@ It is highly recommended for production, you register with
_definition: **Supported Networks**
- Homestead (Mainnet)
- Ropsten (proof-of-work testnet)
- Rinkeby (proof-of-authority testnet)
- G&ouml;rli (clique testnet)
- Kovan (proof-of-authority testnet)
- ``homestead`` - Homestead (Mainnet)
- ``ropsten`` - Ropsten (proof-of-work testnet)
- ``rinkeby`` - Rinkeby (proof-of-authority testnet)
- ``goerli`` - G&ouml;rli (clique testnet)
- ``kovan`` - Kovan (proof-of-authority testnet)
- ``matic`` - Polygon
- ``maticmum`` - Polygon Mumbai Testnet
- ``optimism`` - Optimism (L2; optimistic roll-up)
- ``optimism-kovan`` - Optimism Testnet (L2; optimistic roll-up testnet)
- ``arbitrum`` - Arbitrum (L2; optimistic roll-up)
- ``arbitrum-rinkeby`` - Arbitrum Testnet (L2; optimistic roll-up testnet)
_code: INFURA Examples @lang<javascript>
@@ -161,11 +167,17 @@ It is highly recommended for production, you register with
_definition: **Supported Networks**
- Homestead (Mainnet)
- Ropsten (proof-of-work testnet)
- Rinkeby (proof-of-authority testnet)
- G&ouml;rli (clique testnet)
- Kovan (proof-of-authority testnet)
- ``homestead`` - Homestead (Mainnet)
- ``ropsten`` - Ropsten (proof-of-work testnet)
- ``rinkeby`` - Rinkeby (proof-of-authority testnet)
- ``goerli`` - G&ouml;rli (clique testnet)
- ``kovan`` - Kovan (proof-of-authority testnet)
- ``matic`` - Polygon
- ``maticmum`` - Polygon Mumbai Testnet
- ``optimism`` - Optimism (L2; optimistic roll-up)
- ``optimism-kovan`` - Optimism Testnet (L2; optimistic roll-up testnet)
- ``arbitrum`` - Arbitrum (L2; optimistic roll-up)
- ``arbitrum-rinkeby`` - Arbitrum Testnet (L2; optimistic roll-up testnet)
_code: Alchemy Examples @lang<javascript>
@@ -197,7 +209,7 @@ Create a new **CloudflareProvider** connected to mainnet (i.e. "homestead").
_definition: **Supported Networks**
- Homestead (Mainnet)
- ``homestead`` - Homestead (Mainnet)
_code: Cloudflare Examples @lang<javascript>

View File

@@ -116,7 +116,7 @@ _code: Example: Override the ENS registry @lang<script>
const network = {
name: "dev",
chianId: 1337,
chainId: 1337,
ensAddress: customEnsAddress
};

View File

@@ -1,4 +1,4 @@
_section: JsonRpcProvider @<JsonRpcProvider> @INHERIT<[[Provider]]> @SRC<providers:class.JsonRpcProvider>
_section: JsonRpcProvider @<JsonRpcProvider> @INHERIT<[[BaseProvider]]> @SRC<providers:class.JsonRpcProvider>
The [JSON-RPC API](link-jsonrpc) is a popular method for interacting
with Ethereum and is available in all major Ethereum node implementations
@@ -19,6 +19,9 @@ command-line flags, configuration or settings in their UI to enable
JSON-RPC, unlock accounts or expose specific APIs. Please consult
their documentation.
_property: jsonRpcProvider.connection => [[ConnectionInfo]]
The fully formed [[ConnectionInfo]] the Provider is connected to.
_property: jsonRpcProvider.getSigner([ addressOrIndex ]) => [[JsonRpcSigner]] @<JsonRpcProvider-getSigner> @SRC<providers/json-rpc-provider>
Returns a [[JsonRpcSigner]] which is managed by this Ethereum node, at
//addressOrIndex//. If no //addressOrIndex// is provided, the first
@@ -26,7 +29,7 @@ account (account #0) is used.
_property: jsonRpcProvider.getUncheckedSigner([ addressOrIndex ]) => [[UncheckedJsonRpcSigner]] @<JsonRpcProvider-getUncheckedSigner> @SRC<providers/json-rpc-provider>
_property: jsonRpcProvider.listAccounts() => Array<string> @<JsonRpcProvider-listAccounts> @SRC<providers/json-rpc-provider>
_property: jsonRpcProvider.listAccounts() => Promise<Array<string>> @<JsonRpcProvider-listAccounts> @SRC<providers/json-rpc-provider>
Returns a list of all account addresses managed by this provider.
_property: jsonRpcProvider.send(method, params) => Promise<any> @<JsonRpcProvider-send> @SRC<providers/json-rpc-provider>
@@ -75,6 +78,25 @@ object, with most of the properties set to null, but allows access to the
transaction hash quickly, if that is all that is required.
_subsection: StaticJsonRpcProvider @<StaticJsonRpcProvider> @INHERIT<[[JsonRpcProvider]]> @SRC<providers:class.StaticJsonRpcProvider>
An ethers Provider will execute frequent ``getNetwork`` calls to ensure
the network calls and network being communicated with are consistent.
In the case of a client like MetaMask, this is desired as the network
may be changed by the user at any time, in such cases the cost of
checking the chainId is local and therefore cheap.
However, there are also many times where it is known the network cannot
change, such as when connecting to an INFURA endpoint, in which case,
the **StaticJsonRpcProvider** can be used which will indefinitely cache
the chain ID, which can reduce network traffic and reduce round-trip
queries for the chain ID.
This [[Provider]] should **only** be used when it is known the network
cannot change.
_subsection: Node-Specific Methods @<JsonRpcProvider--other>
Many methods are less common or specific to certain Ethereum Node implementations

View File

@@ -1,6 +1,6 @@
_section: Other Providers
_subsection: FallbackProvider @<FallbackProvider> @INHERIT<[[Provider]]> @SRC<providers/fallback-provider:class.FallbackProvider>
_subsection: FallbackProvider @<FallbackProvider> @INHERIT<[[BaseProvider]]> @SRC<providers/fallback-provider:class.FallbackProvider>
The **FallbackProvider** is the most advanced [[Provider]] available in
ethers.
@@ -99,7 +99,7 @@ application to ethers by wrapping an existing Web3-compatible (such as a
[Web3WsProvider](link-web3-ws)) and exposing it as an ethers.js [[Provider]]
which can then be used with the rest of the library.
This may also be used to wrap a standard [EIP-1193 Provider](link-eip-1193].
This may also be used to wrap a standard [EIP-1193 Provider](link-eip-1193).
_property: new ethers.providers.Web3Provider(externalProvider [, network ])
Create a new **Web3Provider**, which wraps an [EIP-1193 Provider](link-eip-1193) or

View File

@@ -96,6 +96,10 @@ reading and debugging much simpler.
The provider offers some basic operations to help resolve and
work with ENS names.
_property: provider.getAvatar(name) => Promise<string>
Returns the URL for the avatar associated to the ENS name, or null
if no avatar was configured.
_property: provider.getResolver(name) => Promise<[[EnsResolver]]>
Returns an EnsResolver instance which can be used to further inquire
about specific entries for an ENS name.
@@ -163,6 +167,18 @@ await resolver.getAddress();
await resolver.getAddress(0);
//_log:
_property: resolver.getAvatar() => Promise<AvatarInfo>
Returns an object the provides the URL of the avatar and the
linkage representing each stage in the avatar resolution.
If there is no avatar found (or the owner of any NFT does not
match the name owner), null is returned.
The AvatarInfo has the properties:
- ``info.linkage`` - An array of info on each step resolving the avatar
- ``info.url`` - The URL of the avatar
_property: resolver.getContentHash() => Promise<string>
Returns a Promise which resolves to any stored [[link-eip-1577]] content hash.
@@ -240,6 +256,27 @@ gasPrice = await provider.getGasPrice()
utils.formatUnits(gasPrice, "gwei")
//_log:
_property: provider.getFeeData() => Promise<[[providers-FeeData]]> @<Provider-getFeeData> @SRC<abstract-provider>
Returns the current recommended [[providers-FeeData]] to use in a transaction.
For an EIP-1559 transaction, the ``maxFeePerGas`` and ``maxPriorityFeePerGas``
should be used.
For legacy transactions and networks which do not support EIP-1559, the ``gasPrice``
should be used.
_code: @lang<javascript>
// The gas price (in wei)...
feeData = await provider.getFeeData()
//_log: feeData
// ...often these values are easier to understand or
// display to the user in gwei
//_result:
utils.formatUnits(feeData.maxFeePerGas, "gwei")
//_log:
_property: provider.ready => Promise<[[providers-Network]]> @<Provider-ready> @src<providers/base-provider>
Returns a Promise which will stall until the network has heen established,
ignoring errors due to the target node not being active yet.
@@ -333,9 +370,12 @@ _code: @lang<javascript>
//_hide: value: ethers.utils.parseEther("2.0")
//_hide: });
//_hide: await fundTx.wait();
//_hide: const tx = await localSigner.populateTransaction({ to: "ricmoo.eth", value: ethers.utils.parseEther("3.14159") });
//_hide: const signedTx = await localSigner.signTransaction(tx);
//_verbatim: `const signedTx = ${ JSON.stringify(signedTx) };`
//_result:
await provider.sendTransaction("0xf86e808502540be400825208948ba1f109551bd432803012645ac136ddd64dba72880de0b6b3a764000080820a96a0f0c5bcb11e5a16ab116c60a0e5837ae98ec36e7f217740076572e8183002edd2a01ed1b4411c2840b9793e8be5415a554507f1ea320069be6dcecabd7b9097dbd4");
await provider.sendTransaction(signedTx);
//_log:
_property: provider.waitForTransaction(hash [ , confirms = 1 [ , timeout ] ]) => Promise<[TxReceipt](providers-TransactionReceipt)> @<Provider-waitForTransaction> @SRC<providers/base-provider>
@@ -453,6 +493,7 @@ _code: Events Example @lang<javascript>
//_hide: const txHash = utils.id("dummy-data");
//_hide: const myAddress = ethers.constants.HashZero;
//_hide: const myOtherAddress = ethers.constants.HashZero;
//_hide: const hexZeroPad = ethers.utils.hexZeroPad;
provider.on("block", (blockNumber) => {
// Emitted on every block change
@@ -484,8 +525,8 @@ topicSets = [
utils.id("Transfer(address,address,uint256)"),
null,
[
myAddress,
myOtherAddress
hexZeroPad(myAddress, 32),
hexZeroPad(myOtherAddress, 32)
]
]
provider.on(topicSets, (log, event) => {
@@ -509,3 +550,17 @@ _subsection: Inspection Methods @<Provider--inspection-methods>
_property: Provider.isProvider(object) => boolean @<Provider-isProvider> @SRC<abstract-provider>
Returns true if and only if //object// is a Provider.
_subsection: BaseProvider @<BaseProvider> @INHERIT<[[Provider]]> @SRC<providers:class.BaseProvider>
Most Providers available in ethers are sub-classes of BaseProvider, which
simplifies sub-classes, as it handles much of the event operations, such as
polling and formatting.
_property: provider.polling => boolean
Indicates if the Provider is currently polling. If there are no events to
poll for or polling has been explicitly disabled, this will be false.
_property: provider.pollingInterval => number
The frequency at which the provider polls.

View File

@@ -34,6 +34,23 @@ _property: network.ensAddress => string<[[address]]>
The address at which the ENS registry is deployed on this network.
_subsection: FeeData @<providers-FeeData>
A **FeeData** object encapsulates the necessary fee data required
to send a transaction, based on the best available recommendations.
_property: feeData.gasPrice => [[BigNumber]]
The gasPrice to use for legacy transactions or networks which do not
support EIP-1559.
_property: feeData.maxFeePerGas => [[BigNumber]]
The ``maxFeePerGas`` to use for a transaction. This is based on the
most recent block's ``baseFee``.
_property: feeData.maxPriorityFeePerGas => [[BigNumber]]
The ``maxPriorityFeePerGas`` to use for a transaction. This accounts
for the uncle risk and for the majority of current MEV risk.
_subsection: Block @<providers-Block>
_property: block.hash => string<[[DataHexString]]<32>>
@@ -183,18 +200,47 @@ _property: transactionRequest.nonce => number | Promise<number>
The nonce for this transaction. This should be set to the number of
transactions ever sent **from** this address.
_property: transactionRequest.gasLimit => [[BigNumber]] | Promise<[[BigNumber]]>
The maximum amount of gas this transaction is permitted to use.
_property: transactionRequest.gasPrice => [[BigNumber]] | Promise<[[BigNumber]]>
The price (in wei) per unit of gas this transaction will pay.
_property: transactionRequest.data => [[DataHexString]] | Promise<[[DataHexString]]>
The transaction data.
_property: transactionRequest.value => [[BigNumber]] | Promise<[[BigNumber]]>
The amount (in wei) this transaction is sending.
_property: transactionRequest.gasLimit => [[BigNumber]] | Promise<[[BigNumber]]>
The maximum amount of gas this transaction is permitted to use.
If left unspecified, ethers will use ``estimateGas`` to determine the value
to use. For transactions with unpredicatable gas estimates, this may be required
to specify explicitly.
_property: transactionRequest.gasPrice => [[BigNumber]] | Promise<[[BigNumber]]>
The price (in wei) per unit of gas this transaction will pay.
This may not be specified for transactions with ``type`` set to ``1`` or ``2``, or
if ``maxFeePerGas`` or ``maxPriorityFeePerGas`` is given.
_property: transactionRequest.maxFeePerGas => [[BigNumber]] | Promise<[[BigNumber]]>
The maximum price (in wei) per unit of gas this transaction will pay for the
combined [[link-eip-1559]] block's base fee and this transaction's priority fee.
Most developers should leave this unspecified and use the default value that
ethers determines from the network.
This may not be specified for transactions with ``type`` set to ``0`` or if ``gasPrice``
is specified..
_property: transactionRequest.maxPriorityFeePerGas => [[BigNumber]] | Promise<[[BigNumber]]>
The price (in wei) per unit of gas this transaction will allow in addition to
the [[link-eip-1559]] block's base fee to bribe miners into giving this transaction
priority. This is **included in** the ``maxFeePerGas``, so this will **not affect**
the total maximum cost set with ``maxFeePerGas``.
Most developers should leave this unspecified and use the default value that
ethers determines from the network.
This may not be specified for transactions with ``type`` set to ``0`` or if ``gasPrice``
is specified.
_property: transactionRequest.chainId => number | Promise<number>
The chain ID this transaction is authorized on, as specified by
[EIP-155](link-eip-155).
@@ -208,12 +254,13 @@ on recent versions of Geth and require configuration to enable.
_property: transactionRequest.type => null | number
The [[link-eip-2718]] type of this transaction envelope, or ``null``
for legacy transactions that do not have an envelope.
for to use the network default. To force using a lagacy transaction
without an envelope, use type ``0``.
_property: transactionRequest.accessList => [[providers-AccessListish]]
The [[providers-AccessList]] to include in an [[link-eip-2930]] transaction, which will
include a ``type`` of ``1``.
The [[providers-AccessList]] to include; only available for [[link-eip-2930]]
and [[link-eip-1559]] transactions.
_heading: TransactionResponse @<providers-TransactionResponse> @INHERIT<[[Transaction]]>
@@ -237,7 +284,9 @@ The number of blocks that have been mined (including the initial block) since th
transaction was mined.
_property: transaction.raw => string<[[DataHexString]]>
The serialized transaction.
The serialized transaction. This may be null as some backends do not
rpopulate it. If this is required, it can be computed from a **TransactionResponse**
object using [this cookbook recipe](cookbook--compute-raw-transaction).
_property: transaction.wait([ confirms = 1 ]) => Promise<[[providers-TransactionReceipt]]>
Resolves to the [[providers-TransactionReceipt]] once the transaction
@@ -267,15 +316,13 @@ send a new transaction from the same account with the original ``nonce``.
This is usually to speed up a transaction or to cancel one, by bribing
miners with additional fees to prefer the new transaction over the original one.
_property: transactionRequest.type => null | number
The [[link-eip-2718]] type of this transaction envelope, or ``null``
for legacy transactions that do not have an envelope.
_property: transactionRequest.type => number
The [[link-eip-2718]] type of this transaction. If the transaction
is a legacy transaction without an envelope, it will have the type ``0``.
_property: transactionRequest.accessList => [[providers-AccessList]]
The [[providers-AccessList]] included in an [[link-eip-2930]] transaction, which will
also have its ``type`` equal to ``1``.
The [[providers-AccessList]] included, or null for transaction types which
do not support access lists.
_heading: TransactionReceipt @<providers-TransactionReceipt>
@@ -299,6 +346,10 @@ _property: receipt.transactionIndex => number
The index of this transaction in the list of transactions included in
the block this transaction was mined in.
_property: receipt.type => number
The [[link-eip-2718]] type of this transaction. If the transaction
is a legacy transaction without an envelope, it will have the type ``0``.
_property: receipt.root => string
The intermediate state root of a receipt.
@@ -313,6 +364,16 @@ must be considered.
_property: receipt.gasUsed => [[BigNumber]]
The amount of gas actually used by this transaction.
_property: receipt.effectiveGasPrice => [[BigNumber]]
The effective gas price the transaction was charged at.
Prior to EIP-1559 or on chains that do not support it, this value will
simply be equal to the transaction ``gasPrice``.
On EIP-1559 chains, this is equal to the block ``baseFee`` for the block
that the transaction was included in, plus the transaction
``maxPriorityFeePerGas`` clamped to the transaction ``maxFeePerGas``.
_property: receipt.logsBloom => string<[[DataHexString]]>
A [bloom-filter](link-wiki-bloomfilter), which
includes all the addresses and topics included in any log in this

View File

@@ -39,7 +39,7 @@ asynchronous source, such as hardware wallets.
Sub-classes **must** implement this.
_property: Signer.isSigner(object) => boolean @<Signer-isSigner> @SRC<abstract-signer>
Returns true if an only if //object// is a **Signer**.
Returns true if and only if //object// is a **Signer**.
_heading: Blockchain Methods @<Signer--blockchain-methods>
@@ -74,7 +74,7 @@ _property: signer.signMessage(message) => Promise<string<[RawSignature](signatur
This returns a Promise which resolves to the [[signature-raw]]
of //message//.
A signed message is prefixd with ``"\\x19Ethereum signed message:\\n"`` and
A signed message is prefixd with ``"\\x19Ethereum Signed Message:\\n"`` and
the length of the message, using the [hashMessage](utils-hashMessage)
method, so that it is [EIP-191](link-eip-191) compliant. If recovering
the address in Solidity, this prefix will be required to create a matching
@@ -228,7 +228,7 @@ does not have a secure entropy source, an error is thrown.
Wallets created using this method will have a mnemonic.
_property: ethers.Wallet.fromEncryptedJson(json, password [ , progress ]) => Promise<[[Wallet]]> @<Wallet-fromEncryptedJson> @SRC<wallet>
Create an instance from an encrypted JSON wallet.
Create an instance by decrypting an encrypted JSON wallet.
If //progress// is provided it will be called during decryption
with a value between 0 and 1 indicating the progress towards

View File

@@ -42,7 +42,78 @@ _property: abiCoder.encode(types, values) => string<[[DataHexString]]> @<AbiCode
Encode the array //values// according to the array of //types//, each of which may be a
string or a [[ParamType]].
_code: @lang<javascript>
//_hide: const abiCoder = utils.defaultAbiCoder;
// Encoding simple types
//_result:
abiCoder.encode([ "uint", "string" ], [ 1234, "Hello World" ]);
//_log:
//_hide: _page.example1 = _;
// Encoding with arrays types
//_result:
abiCoder.encode([ "uint[]", "string" ], [ [ 1234, 5678 ] , "Hello World" ]);
//_log:
//_hide: _page.example2 = _;
// Encoding complex structs (using positional properties)
//_result:
abiCoder.encode(
[ "uint", "tuple(uint256, string)" ],
[
1234,
[ 5678, "Hello World" ]
]
);
//_log:
//_hide: _page.example3 = _;
// Encoding complex structs (using keyword properties)
//_result:
abiCoder.encode(
[ "uint a", "tuple(uint256 b, string c) d" ],
[
1234,
{ b: 5678, c: "Hello World" }
]
);
//_log:
_property: abiCoder.decode(types, data) => [[Result]] @<AbiCoder-decode> @SRC<abi/abi-coder>
Decode the //data// according to the array of //types//, each of which may be a
string or [[ParamType]].
_code: @lang<javascript>
//_hide: const abiCoder = utils.defaultAbiCoder;
// Decoding simple types
//_hide: data = _page.example1;
//_verbatim: `data = ${ JSON.stringify(data) };`
//_result:
abiCoder.decode([ "uint", "string" ], data);
//_log:
// Decoding with arrays types
//_hide: data = _page.example2;
//_verbatim: `data = ${ JSON.stringify(data) };`
//_result:
abiCoder.decode([ "uint[]", "string" ], data);
//_log:
// Decoding complex structs; unnamed parameters allows ONLY
// positional access to values
//_hide: data = _page.example3;
//_verbatim: `data = ${ JSON.stringify(data) };`
//_result:
abiCoder.decode([ "uint", "tuple(uint256, string)" ], data);
//_log:
// Decoding complex structs; named parameters allows positional
// or keyword access to values
//_result:
abiCoder.decode([ "uint a", "tuple(uint256 b, string c) d" ], data);
//_log:

View File

@@ -29,13 +29,13 @@ all the properties the ABI requires:
- payability (for constructors and methods)
- whether inputs are indexed (for events)
This allows for a simple format which is both machine-readalbe (since
This allows for a simple format which is both machine-readable (since
the parser is a machine) and human-readable (at least **developer-readable**),
as well as simple for humans to type and inline into code, which improves
code readability. The Human-Readable ABI is also considerably smaller, which
helps reduce code size.
A Huamn-Readable ABI is simple an array of strings, where each string is
A Human-Readable ABI is simple an array of strings, where each string is
the Solidity signature.
Signatures may be minimally specified (i.e. names of inputs and outputs

View File

@@ -230,6 +230,27 @@ _code: @lang<javascript>
iface.encodeDeploy([ "SYM", "Some Name" ])
//_log:
_property: interface.encodeErrorResult(fragment [ , values ]) => string<[[DataHexString]]> @SRC<abi/interface>
Returns the encoded error result, which would normally be the response from
a reverted call for //fragment// (see [[Interface--specifying-fragments]]) for
the given //values//.
Most developers will not need this method, but may be useful for authors of
a mock blockchain.
_code: @lang<javascript>
//_hide: const iface = _page.iface;
//_hide: const parseEther = ethers.utils.parseEther;
// Encoding result data (like is returned by eth_call during a revert)
//_result:
iface.encodeErrorResult("AccountLocked", [
"0x8ba1f109551bD432803012645Ac136ddd64DBA72",
parseEther("1.0")
]);
//_log:
_property: interface.encodeFilterTopics(fragment, values) => Array<topic | Array<topic>> @SRC<abi/interface>
Returns the encoded topic filter, which can be passed to getLogs for //fragment//
(see [[Interface--specifying-fragments]]) for the given //values//.
@@ -319,6 +340,24 @@ iface.encodeFunctionResult("balanceOf", [
_subsection: Decoding Data @<Interface--decoding>
_property: interface.decodeErrorResult(fragment, data) => [[Result]] @SRC<abi/interface>
Returns the decoded values from the result of a call during a revert for
//fragment// (see [[Interface--specifying-fragments]]) for the given //data//.
Most developers won't need this, as the ``decodeFunctionResult`` will automatically
decode errors if the //data// represents a revert.
_code: @lang<javascript>
//_hide: const iface = _page.iface;
// Decoding result data (e.g. from an eth_call)
errorData = "0xf7c3865a0000000000000000000000008ba1f109551bd432803012645ac136ddd64dba720000000000000000000000000000000000000000000000000de0b6b3a7640000";
//_result:
iface.decodeErrorResult("AccountLocked", errorData)
//_log:
_property: interface.decodeEventLog(fragment, data [ , topics ]) => [[Result]] @SRC<abi/interface>
Returns the decoded event values from an event log for
//fragment// (see [[Interface--specifying-fragments]]) for the given //data//
@@ -415,6 +454,21 @@ The functions are generally the most useful for most developers. They will
automatically search the ABI for a matching Event or Function and decode
the components as a fully specified description.
_property: interface.parseError(data) => [[ErrorDescription]] @SRC<abi/interface>
Search for the error that matches the error selector in //data// and parse out
the details.
_code: @lang<javascript>
//_hide: const iface = _page.iface;
const data = "0xf7c3865a0000000000000000000000008ba1f109551bd432803012645ac136ddd64dba720000000000000000000000000000000000000000000000000de0b6b3a7640000";
//_result:
iface.parseError(data);
//_hide: _.errorFragment = createClass("ErrorFragment");
//_log:
_property: interface.parseLog(log) => [[LogDescription]] @SRC<abi/interface>
Search the event that matches the //log// topic hash and parse the values
the log represents.
@@ -467,6 +521,24 @@ any named value for this key is renamed to ``_length``. If there is a
name collision, only the first is available by its key.
_heading: ErrorDescription @<ErrorDescription>
_property: errorDescription.args => [[Result]]
The values of the input parameters of the error.
_property: errorDescription.errorFragment => [[ErrorFragment]]
The [[ErrorFragment]] which matches the selector in the data.
_property: errorDescription.name => string
The error name. (e.g. ``AccountLocked``)
_property: errorDescription.signature => string
The error signature. (e.g. ``AccountLocked(address,uint256)``)
_property: errorDescription.sighash => string
The selector of the error.
_heading: LogDescription @<LogDescription>
_property: logDescription.args => [[Result]]

View File

@@ -168,6 +168,10 @@ Returns true if and only if the value of //BigNumber// is zero.
_heading: Conversion
_property: BigNumber.toBigInt() => bigint @SRC<bignumber>
Returns the value of //BigNumber// as a [JavaScript BigInt](link-js-bigint) value,
on platforms which support them.
_property: BigNumber.toNumber() => number @SRC<bignumber>
Returns the value of //BigNumber// as a JavaScript value.

View File

@@ -38,8 +38,10 @@ _heading: Signature @<Signature>
- **r** and **s** --- The x co-ordinate of **r** and the **s** value of the signature
- **v** --- The parity of the y co-ordinate of **r**
- **_vs** --- The [compact representation](link-eip-2098) of the **s** and **v**
- **yParityAndS** --- The [compact representation](link-eip-2098) of the **s** and **v**
- **_vs** --- Deprecated property; renamed to yParityAndS
- **recoveryParam** --- The normalized (i.e. 0 or 1) value of **v**
- **compact** - The full siggnature using [compact representation](link-eip-2098)
_heading: Raw Signature @<signature-raw> @inherit<string\<[[DataHexString]]\<65\>\>>

View File

@@ -1,6 +1,6 @@
_section: Constants @<constants>
The **ethers.contants** Object contains commonly used values.
The **ethers.constants** Object contains commonly used values.
_subsection: Bytes

View File

@@ -18,6 +18,12 @@ The gas limit for this transaction.
_property: unsignedTransaction.gasPrice => [[BigNumberish]]
The gas price for this transaction.
_property: unsignedTransaction.maxFeePerGas => [[BigNumberish]]
The maximum fee per unit of gas for this transaction.
_property: unsignedTransaction.maxPriorityFeePerGas => [[BigNumberish]]
The maximum priority fee per unit of gas for this transaction.
_property: unsignedTransaction.data => [[BytesLike]]
The data for this transaction.
@@ -38,7 +44,7 @@ The transaction hash, which can be used as an identifier for
//transaction//. This is the keccak256 of the serialized RLP encoded
representation of //transaction//.
_property: unsignedTransaction.to => string<[Address](address)>
_property: transaction.to => string<[Address](address)>
The address //transaction// is to.
_property: transaction.from => string<[Address](address)>
@@ -57,9 +63,21 @@ refunded at the end of the transaction, and if there is insufficient gas
to complete execution, the effects of the transaction are reverted, but
the gas is **fully consumed** and an out-of-gas error occurs.
_property: transaction.gasPrice => [[BigNumber]]
_property: transaction.gasPrice => null | [[BigNumber]]
The price (in wei) per unit of gas for //transaction//.
For [[link-eip-1559]] transactions, this will be null.
_property: transaction.maxFeePerGas => [[BigNumber]]
The maximum price (in wei) per unit of gas for //transaction//.
For transactions that are not [[link-eip-1559]] transactions, this will be null.
_property: transaction.maxPriorityFeePerGas => [[BigNumber]]
The priority fee price (in wei) per unit of gas for //transaction//.
For transactions that are not [[link-eip-1559]] transactions, this will be null.
_property: transaction.data => [[BytesLike]]
The data for //transaction//. In a contract this is the call data.

View File

@@ -33,6 +33,12 @@ How long to wait before rejecting with a //timeout// error.
_property: connection.headers => { [ key: string]: string }
Additional headers to include in the connection.
_property: connection.skipFetchSetup => boolean
Normally a connection will specify the default values for a connection
such as CORS-behavior and caching policy, to ensure compatibility across
platforms. On some services, such as Cloudflare Workers, specifying any
value (inclluding the default values) will cause failure. Setting this
to true will prevent any values being passed to the underlying API.
_heading: PollOptions @<PollOptions>

View File

@@ -91,7 +91,7 @@ _code: ERC-20 Transfer Filter Examples @lang<javascript>
filter = {
address: tokenAddress,
topics: [
id("Transfer(address,address,uint256)"),
utils.id("Transfer(address,address,uint256)"),
hexZeroPad(myAddress, 32)
]
};
@@ -100,7 +100,7 @@ filter = {
filter = {
address: tokenAddress,
topics: [
id("Transfer(address,address,uint256)"),
utils.id("Transfer(address,address,uint256)"),
null,
hexZeroPad(myAddress, 32)
]
@@ -110,7 +110,7 @@ filter = {
filter = {
address: tokenAddress,
topics: [
id("Transfer(address,address,uint256)"),
utils.id("Transfer(address,address,uint256)"),
null,
[
hexZeroPad(myAddress, 32),

View File

@@ -26,7 +26,7 @@ importantly securely released.
[Historically](https://github.com/nodejs/node/issues/4660),
``new Buffer(16)`` would re-use old memory that had been
released. This would mean that code runnint later, may have
released. This would mean that code running later, may have
access to data that was discarded.
As an example of the dangers, imagine if you had used a Buffer
@@ -37,9 +37,9 @@ have that left-over private key, which it could then use to
steal the funds from that account.
There are also many debugging tools and systems designed to
assist develoeprs inspect the memory contents of JavaScript
assist developers inspect the memory contents of JavaScript
programs. In these cases, any //private key// or //mnemonic//
siiting in memory may be visible to other users on the system,
sitting in memory may be visible to other users on the system,
or malicious scripts.
_heading: Timing Attack
@@ -65,9 +65,9 @@ will. By timing how long the code took to execute, they now know
whether garbage collection occured and therefore whether the simple
or complex path was taken.
Advancced timing attacks are very difficult to mitigate in any
Advanced timing attacks are very difficult to mitigate in any
garbage-collection-based language. Most libraries where this
matters will hopefully mitigated this for you as much as possible,
matters will hopefully mitigate this for you as much as possible,
but it is still good to be aware of.
_heading: General Concerns
@@ -128,7 +128,7 @@ progress callback which will be periodically called with a number between
In general a progress bar makes the experience feel faster, as well as
more comfortable since there is a clear indication how much (relative) time
is remaining. Additionally, using language like //"decrypting..."// in
a progress bar makes a user feel like there time is not being //needlessly//
a progress bar makes a user feel like their time is not being //needlessly//
wasted.
_heading: Work-Arounds (not recommended)

View File

@@ -117,10 +117,14 @@ const getSourceUrl = (function(path, include, exclude) {
}
})("../packages/", new RegExp("packages/.*/src.ts/.*\.ts$"), new RegExp("/node_modules/|src.ts/.*browser.*"));
let localSigner = null;
function codeContextify(context) {
const { inspect } = require("util");
const ethers = context.require("./packages/ethers");
if (localSigner == null) { localSigner = ethers.Wallet.createRandom(); }
context.ethers = ethers;
context.BigNumber = ethers.BigNumber;
context.constants = ethers.constants;
@@ -133,9 +137,9 @@ function codeContextify(context) {
// We use a local dev node for some signing examples, but want to
// resolve ENS names against mainnet; super hacky but makes the
// docs nicer
// docs nicer (funded in _startup)
context.localProvider = new ethers.providers.JsonRpcProvider();
context.localSigner = context.localProvider.getSigner();
context.localSigner = localSigner.connect(context.localProvider);
context.localProvider.resolveName = context.provider.resolveName.bind(context.provider);
context.BigNumber.prototype[inspect.custom] = function(depth, options) {
@@ -180,8 +184,14 @@ function codeContextify(context) {
});
}
context._startup = function() {
context._startup = async function() {
console.log("Startup");
const signer = context.localProvider.getSigner();
const tx = await signer.sendTransaction({
to: localSigner.address,
value: ethers.utils.parseEther("10.0")
});
await tx.wait();
}
context._shutdown = function() {
@@ -192,7 +202,7 @@ function codeContextify(context) {
module.exports = {
title: "ethers",
subtitle: "v5.3",
subtitle: "v5.4",
description: "Documentation for ethers, a complete, tiny and simple Ethereum library.",
logo: "logo.svg",
@@ -227,7 +237,7 @@ module.exports = {
"link-infura": { name: "INFURA", url: "https:/\/infura.io" },
"link-javascriptcore": { name: "JavaScriptCore", url: "https:/\/developer.apple.com/documentation/javascriptcore?language=objc" },
"link-ledger": "https:/\/www.ledger.com",
"link-metamask": { name: "Metamask", url: "https:/\/metamask.io/" },
"link-metamask": { name: "MetaMask", url: "https:/\/metamask.io/" },
"link-otto": "https:/\/github.com/robertkrimen/otto",
"link-parity": { name: "Parity", url: "https:/\/www.parity.io" },
"link-pocket": { name: "Pocket Network", url: "https:/\/pokt.network" },
@@ -289,6 +299,7 @@ module.exports = {
"link-eip-712": { name: "EIP-712", url: "https:/\/eips.ethereum.org/EIPS/eip-712" },
"link-eip-1014": { name: "EIP-1014", url: "https:/\/eips.ethereum.org/EIPS/eip-1014" },
"link-eip-1193": { name: "EIP-1193", url: "https:/\/eips.ethereum.org/EIPS/eip-1193" },
"link-eip-1559": { name: "EIP-1559", url: "https:/\/eips.ethereum.org/EIPS/eip-1559" },
"link-eip-1577": { name: "EIP-1577", url: "https:/\/eips.ethereum.org/EIPS/eip-1577" },
"link-eip-2098": { name: "EIP-2098", url: "https:/\/eips.ethereum.org/EIPS/eip-2098" },
"link-eip-2304": { name: "EIP-2304", url: "https:/\/eips.ethereum.org/EIPS/eip-2304" },
@@ -329,7 +340,7 @@ module.exports = {
"link-wiki-hmac": "https:/\/en.wikipedia.org/wiki/HMAC",
"link-wiki-iban": "https:/\/en.wikipedia.org/wiki/International_Bank_Account_Number",
"link-wiki-ieee754": "https:/\/en.wikipedia.org/wiki/Double-precision_floating-point_format",
"link-wiki-observer-pattern": { name: "Obeserver Pattern", url: "https:/\/en.wikipedia.org/wiki/Observer_pattern" },
"link-wiki-observer-pattern": { name: "Observer Pattern", url: "https:/\/en.wikipedia.org/wiki/Observer_pattern" },
"link-wiki-phishing": "https:/\/en.wikipedia.org/wiki/Phishing",
"link-wiki-ripemd": "https:/\/en.m.wikipedia.org/wiki/RIPEMD",
"link-wiki-sha2": "https:/\/en.wikipedia.org/wiki/SHA-2",

View File

@@ -31,7 +31,7 @@ have a public discussion and figure out the best way to address the problem/feat
_subsection: Building @<contributing--building>
The build process for ethers is unfortunatly not super trivial, but
I have attempted to make it as straight-forward as possible.
I have attempted to make it as straightforward as possible.
It is a mono-repo which attempts to be compatibile with a large
number of environments, build tools and platforms, which is why

View File

@@ -6,4 +6,5 @@ snippets of code that are in general useful.
_toc:
react-native
transactions

View File

@@ -0,0 +1,24 @@
_section: Transactions @<cookbook--transactions>
_subsection: Compute the raw transaction @<cookbook--compute-raw-transaction>
_code: @lang<javascript>
function getRawTransaction(tx) {
function addKey(accum, key) {
if (tx[key]) { accum[key] = tx[key]; }
return accum;
}
// Extract the relevant parts of the transaction and signature
const txFields = "accessList chainId data gasPrice gasLimit maxFeePerGas maxPriorityFeePerGas nonce to type value".split(" ");
const sigFields = "v r s".split(" ");
// Seriailze the signed transaction
const raw = utils.serializeTransaction(txFields.reduce(addKey, { }), sigFields.reduce(addKey, { }));
// Double check things went well
if (utils.keccak256(raw) !== tx.hash) { throw new Error("serializing failed!"); }
return raw;
}

View File

@@ -73,7 +73,7 @@ $Contract: A Contract is an abstraction which represents a connection to a
| **Contract** | $Contract |
_subsection: Connecting to Ethereum: Metamask @<getting-started--connecting>
_subsection: Connecting to Ethereum: MetaMask @<getting-started--connecting>
The quickest and easiest way to experiment and begin developing on
Ethereum is to use [[link-metamask]], which is a browser extension
@@ -82,13 +82,16 @@ that provides:
- A connection to the Ethereum network (a [[Provider]])
- Holds your private key and can sign things (a [[Signer]])
_code: Connecting to Metamask @lang<script>
_code: Connecting to MetaMask @lang<script>
// A Web3Provider wraps a standard Web3 provider, which is
// what Metamask injects as window.ethereum into each page
// what MetaMask injects as window.ethereum into each page
const provider = new ethers.providers.Web3Provider(window.ethereum)
// The Metamask plugin also allows signing transactions to
// MetaMask requires requesting permission to connect users accounts
await provider.send("eth_requestAccounts", []);
// The MetaMask plugin also allows signing transactions to
// send ether and pay to change state within the blockchain.
// For this, you need the account signer...
const signer = provider.getSigner()
@@ -301,7 +304,7 @@ filterFrom = daiContract.filters.Transfer(myAddress, null);
filterTo = daiContract.filters.Transfer(null, myAddress);
//_log: filterTo
// List all transfers sent from me a specific block range
// List all transfers sent from me in a specific block range
//_result:
await daiContract.queryFilter(filterFrom, 9843470, 9843480)
//_log:

View File

@@ -69,7 +69,7 @@ signature = await signer.signMessage('Some data')
_subsection: Contracts
A contract object is an abstraction of a smart contract on the Ethereum Network. It allows for easy interaction with the smart contact.
A contract object is an abstraction of a smart contract on the Ethereum Network. It allows for easy interaction with the smart contract.
_heading: Deploying a Contract

View File

@@ -14,4 +14,4 @@ _subsection: Tutorials
I do not manage or maintain these tutorials, but have happened across them.
If a link is dead or outdated, please [let me know](link-mail) and I'll update it.
- No links yet; send me some
- [Alchemy - How to Mint an NFT](https://docs.alchemy.com/alchemy/tutorials/how-to-create-an-nft/how-to-mint-an-nft-with-ethers)

View File

@@ -151,7 +151,7 @@ This section is still a work in progress, but will outline some of the more nuan
aspects of the test cases and their values.
There will likely be an overhaul of the test cases in the next major version, to
make code coverage testing more straight forward and to collapse some of the redundancy.
make code coverage testing more straightforward and to collapse some of the redundancy.
For example, there is no longer a need to separate the ABI and ABIv2 test case and the
accounts and transactions suites can be merged into one large collection.

View File

@@ -0,0 +1,15 @@
_section: Building @<troubleshooting-building>
@TODO
_subsection: Packages
Sometimes packages get out of sync.
_code:
/home/ethers> rm package-lock.json node_modules/
/home/ethers> rm yarn.lock
/home/ethers> npm install

View File

@@ -0,0 +1,249 @@
_section: Error Codes @<error-codes>
All errors in ethers are created by the [[Logger]] class, which includes
a number of additional properties and extra data, which can assist in
debugging and when submitting issues.
When submitting an issue, please include as much of any error as possible,
but also make sure you understand the error and have tried suggested solutions
both in this trouble-shooting document and any other issues you find when
searching the GitHub issues.
_subsection: CALL_EXCEPTION @<help-CALL_EXCEPTION>
This error occurs when a call or transaction is used to interact with
the blockchain reverts (via ``revert``, ``require``, et cetera).
Due to the overall flexibility of Ethereum and Turing Completeness,
there is a large variety of reasons this can occur and troubleshooting
requires attention.
_heading: Common Causes
- The code does not exist on-chain. This may happen if you failed to wait
until the contract was deployed, the address is incorrect or if you
are connected to a different network than the contract has been deployed.
Check the code exists using ``provider.getCode(address)``.
- The wrong code is being accessed, for example if an artifact file was
not correctly updated so an older instance of the contract is being called
- The contract is failing during a ``require`` statement. For example, if
a contract method requires an //admin account// to be used, but the
contract is connected to another [[Signer]].
- The wrong ABI is being used to interact with a contract.
_heading: Debugging
- Always double check the address and network you are connected to and use
``provider.getCode(address)`` to verify the deployed code matches your
most recent version.
- Try accessing other, simpler contract methods to verify the account is correct.
_subsection: INSUFFICIENT_FUNDS @<help-INSUFFICIENT_FUNDS>
This usually occurs when a transaction is attempted, but the sending account
does not have enough ether to cover the cost of the transaction.
A transaction has an intrinsic cost which must be met, which accounts for
the value being sent, the base fee of the transaction, additional fees per byte
of calldata and whether the transaction will create a new account (i.e. the ``to``
is empty).
This error can also happen if ``provider.estimateGas`` is used with a non-zero
fee (i.e. ``gasPrice``, ``maxFeePerGas`` or ``maxPriorityFeePerGas``). If any
fee properties are specified, the ``from`` account must have sufficient ether
to execute the transaction.
_subsection: MISSING_NEW @<help-MISSING_NEW>
Classes in ethers must be instantiated with the ``new`` operator. This
error indicates that a Class is attempting to be used as a function.
_code: Examples @lang<javascript>
//_hide: privateKey = "0x0123456789012345678901234567890123456789012345678901234567890123";
//_hide: Wallet = ethers.Wallet;
// Bad:
//_throws:
ethers.Wallet(privateKey)
//_log:
// Good:
//_result:
new ethers.Wallet(privateKey)
//_log:
_subsection: NONCE_EXPIRED @<help-NONCE_EXPIRED>
This error occurs when a transaction is being sent with a ``nonce`` that
is lower than next required ``nonce``.
Each Ethereum transaction requires a ``nonce`` property equal to the index
of that transaction for that account for all time. So, if an account has
send four transactions over its lifetime, that means the nonces 0 though 3
(inclusive) have been used. The next transaction must use a nonce of 4.
Attempting to re-use a nonce less than 4 will result in this error.
_subsection: NUMERIC_FAULT @<help-NUMERIC_FAULT>
A [numeric fault](errors--numeric-fault) is a consequence of
performing an illegal operation with numeric values, such as
dividing by zero.
The error will indicate the ``operation``, which further indicates
the reason for the error.
_heading: Overflow @<help-NUMERIC_FAULT-overflow>
JavaScript uses [IEEE 754 double-precision binary floating point](link-wiki-ieee754)
numbers to represent numeric values. As a result, there are //holes//
in the integer set after 9,007,199,254,740,991; which is
problematic for //Ethereum// because that is only around 0.009
ether (in wei), which means any value over that will begin to
experience rounding errors.
As a result, any attempt to use a number which is outside the safe
range, which would result in incorrect values, an error is thrown.
In general, numbers should be kept as strings, [[BigNumber]] instances or
using ES2020 bigints, which all can safely be used without loss of precission.
_code: Examples @lang<javascript>
// One ether is outside the safe range
//_throws:
BigNumber.from(1000000000000000000)
//_log:
// Providing the value as a string is safe
//_result:
BigNumber.from("1000000000000000000")
//_log:
// As is using a bigint (notice the `n` suffix)
//_result:
BigNumber.from(1000000000000000000n)
//_log:
// But most often, the `parseEther` function solves this
//_result:
utils.parseEther("1.0")
//_log:
_heading: Numeric Underflow @<help-NUMERIC_FAULT-underflow>
Numeric underflow sbould not be confused with overflow.
Numeric underflow occurs when the precission of a value cannot be
safely represented in the current data type.
**Common Causes**
- Using values with fractional componets (e.g. ``BigNumber.from(1.2)``).
If you require fractions, you must use the [[FixedNumber]] class.
- Parsing string values that have more decimals than the unit supports
(e.g. ``parseUints("1.33", 1)``).
_code: Examples @lang<javascript>
// BigNumbers cannot be created with a fractional component
//_throws:
BigNumber.from(1.2)
//_log:
// Parsing a value with more decimals than the type
//_throws:
utils.parseUnits("1.34", 1);
//_log:
_heading: Division by zero @<help-NUMERIC_FAULT-division-by-zero>
This error occurs when dividing by zero or attempting to take the modulo zero.
_heading: Unbound Result @<help-NUMERIC_FAULT-unbound-result>
The ethers [[BigNumber]] does not support bitwise operators
on negative numbers which can result in the need for an infinite
number of set bits.
Other implementations may use negative values to indicate this,
but this is considered out of scope for ethers.
_heading: Unsupported Operation @<help-NUMERIC_FAULT-unsupported>
The ethers [[BigNumber]] does not support negative powers or bitwise
shift operation using negative values.
_code: Examples @lang<javascript>
two = BigNumber.from(2);
//_throws:
two.pow(-2)
//_log:
// Cannot use negative values to alter shift direction
//_throws:
two.shr(-1)
//_log:
_subsection: REPLACEMENT_UNDERPRICED @<help-REPLACEMENT_UNDERPRICED>
To prevent nodes from being overloaded with junk transactions, a transaction
is only accepted into the memory pool if it has a reasonable chance of being
actually mined, which means that the account has sufficient balance, the nonce
is correct and the fee seems reasonable.
Once a transaction is in the memory pool though, to prevent an account from
flooding the network with many different transactions with the same nonce (each
of which satisfies the above criteria), to replace an existing transaction
an additional committment of a fee must be made by increasing the promised fee.
When replacing a legacy non-EIP1559 transaction, the ``gasPrice`` must be
increased. When replacing a modern, EIP-1559 transaction, the ``maxPriorityFeePerGas``
should be increased.
_subsection: TRANSACTION_REPLACED @<help-TRANSACTION_REPLACED>
This error is thrown when waiting for a transaction which has been
replaced by another, by the sender submitting a second transaction
with the same nonce, while the transaction was pending in the
transaction pool.
You can learn more about this feature in the ``.wait`` method of
[TransactionResponse](providers-TransactionResponse).
_subsection: UNPREDICTABLE_GAS_LIMIT @<help-UNPREDICTABLE_GAS_LIMIT>
During gas estimation it is possible that a transaction would actually
fail (and hence has no reasonable estimate of gas requirements) or that
the transaction is complex in a way that does not permit a node to
estiamte the gas requirements, in which case this error is thrown.
In almost all cases, this will unfortunately require you specify an
explicit ``gasLimit`` for your transaction, which will disable ether's
automatic population of the ``gasLimit`` field, which will cause this
error to go away.
To dial in an appropriate gas limit, try a value that is much higher
than you expect, and then make a few transactions to discover reasonable
values and then you can reduce this value down to that ballpark.
Keep in mind this error can also occur if the transaction would
legitimately fail, in which case the root cause must be addressed, such
as ensuring the correct [[Signer]] is being used, the appropriate allowance
for an ERC-20 token has been approved, etc.

View File

@@ -0,0 +1,62 @@
_section: Getting Help @<troubleshooting-issues>
@TODO
_subsection: Starting a discussion
Before opening an issue
_subsection: Opening an Issue
Keep in mind that opening an issue should be a last resort, as it
requires time and energy by the library developers to look at that
could otherwise be spent on improving the library, documentation
and tools.
Before opening an issue, please make sure you have searched any
public information, such as:
- Documentation
- GitHub Discussions
- GitHub Issues (including closed issues)
There are several types of issues tracked by ethers. Using the correct
one helps you receive feedback quicker and helps us keep the right
person
_heading: Feature Requests
_heading: Bugs
This type of issue is for anything you you believe to be a bug in ethers.
Keep in mind that ethers is used extensively by thousands of people every
day, so while chances are possible you found a bug, please make sure to
do your due diligence to rule out user error.
If you are new to ethers, or are doing a fairly common operation, it is
quite likely what you are experiencing is a misunderstanding of how to
use a function, method or class. You should consider opening a discussion first.
Please make sure you include as much information as is useful:
- Are you using a third-party library, like Hardhat or Truffle?
- What platform are you on, a web browser, React Native, node, etc.?
- What network are you on, such as Ethereum mainnet, Optimism, etc.?
- What backend are you using, such as Geth, INFURA, Provider Engine, etc.?
_heading: Docuementation
If you have found a typo in the documentation, a feature which isn't
documented (or documented well) or just find something described in
the documentation confusing, please feel free to create an issue and
we will try to improve it.
_heading: Other
This should never be used.

View File

@@ -0,0 +1,11 @@
_section: TroubleShooting
_toc:
building
errors
networks
help
_subsection: About Trbouble-Shooting

View File

@@ -0,0 +1,9 @@
_section: Troubleshooting Network @<troubleshooting-network>
@TODO
_subsection: Links
_subsection: Cross-Origin Resource Sharing (CORS)
_subsection: Mobile Development (Device Firewalls)

View File

@@ -5,23 +5,23 @@ const path_1 = require("./path");
const utils_1 = require("./utils");
function setupConfig(outDir, moduleType, targetType) {
// Configure the tsconfit.package.json...
const path = path_1.resolve("tsconfig.package.json");
const content = utils_1.loadJson(path);
const path = (0, path_1.resolve)("tsconfig.package.json");
const content = (0, utils_1.loadJson)(path);
content.compilerOptions.module = moduleType;
content.compilerOptions.target = targetType;
utils_1.saveJson(path, content, true);
(0, utils_1.saveJson)(path, content, true);
// Configure the browser field for every pacakge, copying the
// browser.umd filed for UMD and browser.esm for ESM
path_1.dirnames.forEach((dirname) => {
const filename = path_1.getPackageJsonPath(dirname);
const info = utils_1.loadJson(filename);
const filename = (0, path_1.getPackageJsonPath)(dirname);
const info = (0, utils_1.loadJson)(filename);
if (info._ethers_nobuild) {
return;
}
let path = path_1.resolve("packages", dirname, "tsconfig.json");
let content = utils_1.loadJson(path);
let path = (0, path_1.resolve)("packages", dirname, "tsconfig.json");
let content = (0, utils_1.loadJson)(path);
content.compilerOptions.outDir = outDir;
utils_1.saveJson(path, content, true);
(0, utils_1.saveJson)(path, content, true);
});
}
function setupBuild(buildModule) {

View File

@@ -39,7 +39,7 @@ const npm = __importStar(require("./npm"));
const path_1 = require("./path");
const run_1 = require("./run");
const utils_1 = require("./utils");
const changelogPath = path_1.resolve("CHANGELOG.md");
const changelogPath = (0, path_1.resolve)("CHANGELOG.md");
function generate() {
return __awaiter(this, void 0, void 0, function* () {
const lines = fs_1.default.readFileSync(changelogPath).toString().trim().split("\n");
@@ -59,11 +59,11 @@ function generate() {
const published = yield npm.getPackage("ethers");
if (versions.indexOf(version) >= 0) {
const line = `Version ${version} already in CHANGELOG. Please edit before committing.`;
console.log(log_1.colorify.red(utils_1.repeat("=", line.length)));
console.log(log_1.colorify.red((0, utils_1.repeat)("=", line.length)));
console.log(log_1.colorify.red(line));
console.log(log_1.colorify.red(utils_1.repeat("=", line.length)));
console.log(log_1.colorify.red((0, utils_1.repeat)("=", line.length)));
}
const gitResult = yield run_1.run("git", ["log", (published.gitHead + "..")]);
const gitResult = yield (0, run_1.run)("git", ["log", (published.gitHead + "..")]);
if (!gitResult.ok) {
console.log(gitResult);
throw new Error("Error running git log");
@@ -78,7 +78,7 @@ function generate() {
});
}
else if (line.toLowerCase().substring(0, 5) === "date:") {
changes[changes.length - 1].date = utils_1.getDateTime(new Date(line.substring(5).trim()));
changes[changes.length - 1].date = (0, utils_1.getDateTime)(new Date(line.substring(5).trim()));
}
else if (line.substring(0, 1) === " ") {
line = line.trim();
@@ -92,9 +92,9 @@ function generate() {
for (let i = 0; i < firstLine; i++) {
output.push(lines[i]);
}
const newTitle = `ethers/v${version} (${utils_1.getDateTime(new Date())})`;
const newTitle = `ethers/v${version} (${(0, utils_1.getDateTime)(new Date())})`;
output.push(newTitle);
output.push(utils_1.repeat("-", newTitle.length));
output.push((0, utils_1.repeat)("-", newTitle.length));
output.push("");
changes.forEach((change) => {
let body = change.body.trim();

View File

@@ -65,7 +65,7 @@ const path_1 = require("../path");
accum[name] = version;
return accum;
}, {});
const packageJsonPath = path_1.getPackageJsonPath(dirname);
const packageJsonPath = (0, path_1.getPackageJsonPath)(dirname);
local.updateJson(packageJsonPath, {
dependencies: deps,
version: newVersion

View File

@@ -40,8 +40,8 @@ const npm = __importStar(require("../npm"));
const utils_1 = require("../utils");
(function () {
return __awaiter(this, void 0, void 0, function* () {
const common = utils_1.loadJson(path_1.resolve("package.json")).common;
const progress = log_1.getProgressBar(log_1.colorify.bold("Bumping package.json versions"));
const common = (0, utils_1.loadJson)((0, path_1.resolve)("package.json")).common;
const progress = (0, log_1.getProgressBar)(log_1.colorify.bold("Bumping package.json versions"));
const latestVersions = {};
let updated = false;
const output = [];
@@ -49,7 +49,7 @@ const utils_1 = require("../utils");
for (let i = 0; i < path_1.dirnames.length; i++) {
progress(i / path_1.dirnames.length);
const dirname = path_1.dirnames[i];
const packageJsonPath = path_1.getPackageJsonPath(dirname);
const packageJsonPath = (0, path_1.getPackageJsonPath)(dirname);
// Set the common elements to the package.json
local.updateJson(packageJsonPath, common, true);
const pLocal = local.getPackage(dirname);
@@ -68,7 +68,7 @@ const utils_1 = require("../utils");
output.push([
" ",
log_1.colorify.blue(pLocal.name),
utils_1.repeat(" ", 47 - pLocal.name.length - pNpm.version.length),
(0, utils_1.repeat)(" ", 47 - pLocal.name.length - pNpm.version.length),
pNpm.version,
log_1.colorify.bold(" => "),
log_1.colorify.green(version)
@@ -80,13 +80,13 @@ const utils_1 = require("../utils");
// Write out the _version.ts
if (!pLocal._ethers_nobuild) {
const code = "export const version = " + JSON.stringify(dirname + "/" + version) + ";\n";
fs_1.default.writeFileSync(path_1.resolve(path_1.getPackagePath(dirname), "src.ts/_version.ts"), code);
fs_1.default.writeFileSync((0, path_1.resolve)((0, path_1.getPackagePath)(dirname), "src.ts/_version.ts"), code);
}
}
progress(1);
if (updated) {
const filename = path_1.resolve("packages/ethers/package.json");
const info = utils_1.loadJson(filename);
const filename = (0, path_1.resolve)("packages/ethers/package.json");
const info = (0, utils_1.loadJson)(filename);
Object.keys(info.dependencies).forEach((name) => {
const version = latestVersions[name];
if (name == null) {
@@ -94,7 +94,7 @@ const utils_1 = require("../utils");
}
info.dependencies[name] = version;
});
utils_1.saveJson(filename, info);
(0, utils_1.saveJson)(filename, info);
}
output.forEach((line) => { console.log(line); });
});

View File

@@ -38,10 +38,10 @@ const config = {
console.log(log_1.colorify.bold(`Bundling Testcase Data...`));
const data = { "_": JSON.stringify({ name: "browser-fs", config: config }) };
config.dirs.forEach((dirname) => {
let fulldirname = path_2.resolve("packages/testcases", dirname);
let fulldirname = (0, path_2.resolve)("packages/testcases", dirname);
fs_1.default.readdirSync(fulldirname).forEach((filename) => {
const key = path_1.join(dirname, filename);
const content = fs_1.default.readFileSync(path_1.join(fulldirname, filename));
const key = (0, path_1.join)(dirname, filename);
const content = fs_1.default.readFileSync((0, path_1.join)(fulldirname, filename));
if (filename.split(".").pop() === "gz") {
const contentData = zlib_1.default.gunzipSync(content);
data[key] = String(contentData.length) + "," + zlib_1.default.deflateRawSync(contentData).toString("base64");
@@ -52,15 +52,15 @@ const config = {
//console.log(` - Added ${ key } (${ data[key].length } bytes)`);
});
});
utils_1.mkdir(path_2.resolve("packages/testcases/lib"));
utils_1.mkdir(path_2.resolve("packages/testcases/lib._esm"));
utils_1.mkdir(path_2.resolve("packages/testcases/lib.esm"));
(0, utils_1.mkdir)((0, path_2.resolve)("packages/testcases/lib"));
(0, utils_1.mkdir)((0, path_2.resolve)("packages/testcases/lib._esm"));
(0, utils_1.mkdir)((0, path_2.resolve)("packages/testcases/lib.esm"));
// We write it out to all needed places
fs_1.default.writeFileSync(path_2.resolve("packages/testcases/lib/browser-data.json"), JSON.stringify(data));
fs_1.default.writeFileSync(path_2.resolve("packages/testcases/lib._esm/browser-data.json"), JSON.stringify(data));
fs_1.default.writeFileSync(path_2.resolve("packages/testcases/lib.esm/browser-data.json"), JSON.stringify(data));
fs_1.default.writeFileSync((0, path_2.resolve)("packages/testcases/lib/browser-data.json"), JSON.stringify(data));
fs_1.default.writeFileSync((0, path_2.resolve)("packages/testcases/lib._esm/browser-data.json"), JSON.stringify(data));
fs_1.default.writeFileSync((0, path_2.resolve)("packages/testcases/lib.esm/browser-data.json"), JSON.stringify(data));
// Write it to the TypeScript source last, in case it is running it will
// be regenerated overwriting the above files, but with identical content
fs_1.default.writeFileSync(path_2.resolve("packages/testcases/src.ts/browser-data.json"), JSON.stringify(data));
fs_1.default.writeFileSync((0, path_2.resolve)("packages/testcases/src.ts/browser-data.json"), JSON.stringify(data));
});
})();

View File

@@ -15,6 +15,6 @@ const github_1 = require("../github");
return __awaiter(this, void 0, void 0, function* () {
const user = yield config_1.config.get("github-user");
const password = yield config_1.config.get("github-readonly");
yield github_1.syncIssues(user, password);
yield (0, github_1.syncIssues)(user, password);
});
})();

View File

@@ -24,8 +24,8 @@ const log_1 = require("../log");
function alias(name) {
return __awaiter(this, void 0, void 0, function* () {
console.log(` Aliasing: ${name}`);
const baseDir = path_2.resolve("packages", name);
const info = utils_1.loadJson(path_2.resolve(baseDir, "package.json"));
const baseDir = (0, path_2.resolve)("packages", name);
const info = (0, utils_1.loadJson)((0, path_2.resolve)(baseDir, "package.json"));
const replacements = info["_ethers.alias"] || {};
const skip = Object.keys(replacements).reduce((accum, key) => {
const replace = replacements[key];
@@ -37,10 +37,10 @@ function alias(name) {
}, ({}));
const transforms = [];
const recurse = function (input, output) {
fs_1.default.readdirSync(path_1.join(baseDir, input)).forEach((filename) => {
const stat = fs_1.default.statSync(path_1.join(baseDir, input, filename));
fs_1.default.readdirSync((0, path_1.join)(baseDir, input)).forEach((filename) => {
const stat = fs_1.default.statSync((0, path_1.join)(baseDir, input, filename));
if (stat.isDirectory()) {
recurse(path_1.join(input, filename), path_1.join(output, filename));
recurse((0, path_1.join)(input, filename), (0, path_1.join)(output, filename));
return;
}
if (skip[filename]) {
@@ -61,7 +61,7 @@ function alias(name) {
if (replace) {
inputFilename = replace;
transform = function (content) {
content = content.replace(/(\/\/# sourceMappingURL=)(.*)$/g, (all, prefix, mapFilename) => {
content = content.replace(/^(\/\/# sourceMappingURL=)(.*)$/mg, (all, prefix, mapFilename) => {
return prefix + filename + ".map";
});
return content;
@@ -118,19 +118,19 @@ function alias(name) {
};
}
}
transforms.push({ input: path_1.join(input, inputFilename), output: path_1.join(output, filename), transform });
transforms.push({ input: (0, path_1.join)(input, inputFilename), output: (0, path_1.join)(output, filename), transform });
});
};
recurse("lib._esm", "lib.esm");
transforms.forEach(({ input, output, transform }) => {
const sourceFile = path_1.join(baseDir, input);
const sourceFile = (0, path_1.join)(baseDir, input);
let content = fs_1.default.readFileSync(sourceFile).toString();
if (transform) {
content = transform(content);
}
const targetFile = path_1.join(baseDir, output);
const targetDir = path_1.dirname(targetFile);
utils_1.mkdir(targetDir);
const targetFile = (0, path_1.join)(baseDir, output);
const targetDir = (0, path_1.dirname)(targetFile);
(0, utils_1.mkdir)(targetDir);
fs_1.default.writeFileSync(targetFile, content);
});
});
@@ -138,9 +138,9 @@ function alias(name) {
(function () {
return __awaiter(this, void 0, void 0, function* () {
console.log(log_1.colorify.bold(`Aliasing Node ESM to Browser ESM...`));
const dirnames = depgraph_1.getOrdered(true);
const dirnames = (0, depgraph_1.getOrdered)(true);
for (let i = 0; i < dirnames.length; i++) {
//if (dirnames[i] !== "base64") { continue; }
//if (dirnames[i] !== "signing-key") { continue; }
yield alias(dirnames[i]);
}
});

View File

@@ -14,11 +14,11 @@ const local_1 = require("../local");
const log_1 = require("../log");
(function () {
return __awaiter(this, void 0, void 0, function* () {
const dependencies = local_1.getDependencies(null, (name) => {
return !path_1.isEthers(name);
const dependencies = (0, local_1.getDependencies)(null, (name) => {
return !(0, path_1.isEthers)(name);
});
console.log(log_1.colorify.bold(`Hoisting ${Object.keys(dependencies).length} dependencies into root package...`));
local_1.updateJson(path_1.dirs.rootPackageJsonPath, { dependencies });
(0, local_1.updateJson)(path_1.dirs.rootPackageJsonPath, { dependencies });
});
})().catch((error) => {
console.log(`Error running ${process.argv[0]}: ${error.message}`);

View File

@@ -33,28 +33,28 @@ function link(existing, path) {
}
}
// Link
const dir = path_1.dirname(path);
utils_1.mkdir(dir);
const dir = (0, path_1.dirname)(path);
(0, utils_1.mkdir)(dir);
fs_1.default.symlinkSync(existing, path, "junction");
}
(function () {
return __awaiter(this, void 0, void 0, function* () {
console.log(log_1.colorify.bold(`Linking ${path_2.packages.length} package node_modules rat nests...`));
const nodeModulesBase = path_1.resolve(path_2.dirs.root, ".package_node_modules");
const nodeModulesBase = (0, path_1.resolve)(path_2.dirs.root, ".package_node_modules");
// Make a symlink in the ROOT/node_mpdules to each package in this repo
path_2.packages.forEach((name) => {
// e.g. /node_modules/@ethersproject/abi => /packages/abi
link(path_2.getPackagePath(name), path_1.resolve(path_2.dirs.root, "node_modules", name));
link((0, path_2.getPackagePath)(name), (0, path_1.resolve)(path_2.dirs.root, "node_modules", name));
// e.g. /packages/abi/node_modules => /.package_node_modules/abi/
const nodeModules = path_1.resolve(nodeModulesBase, path_2.getDirname(name));
utils_1.mkdir(nodeModules);
link(nodeModules, path_1.resolve(path_2.getPackagePath(name), "node_modules"));
const nodeModules = (0, path_1.resolve)(nodeModulesBase, (0, path_2.getDirname)(name));
(0, utils_1.mkdir)(nodeModules);
link(nodeModules, (0, path_1.resolve)((0, path_2.getPackagePath)(name), "node_modules"));
});
path_2.packages.forEach((name) => {
const nodeModules = path_1.resolve(nodeModulesBase, path_2.getDirname(name));
const deps = local_1.getDependencies(name);
const nodeModules = (0, path_1.resolve)(nodeModulesBase, (0, path_2.getDirname)(name));
const deps = (0, local_1.getDependencies)(name);
Object.keys(deps).forEach((name) => {
link(path_1.resolve(path_2.dirs.root, "node_modules", name), path_1.resolve(nodeModules, name));
link((0, path_1.resolve)(path_2.dirs.root, "node_modules", name), (0, path_1.resolve)(nodeModules, name));
});
});
});

View File

@@ -15,7 +15,7 @@ const utils_1 = require("../utils");
(function () {
return __awaiter(this, void 0, void 0, function* () {
const versions = path_1.dirnames.reduce((accum, dirname) => {
const pkg = local_1.getPackage(dirname);
const pkg = (0, local_1.getPackage)(dirname);
accum[pkg.name] = pkg.version;
return accum;
}, ({}));
@@ -25,8 +25,8 @@ const utils_1 = require("../utils");
return;
}
console.log(dirname);
const path = path_1.resolve("packages", dirname, "package.json");
const json = utils_1.loadJson(path);
const path = (0, path_1.resolve)("packages", dirname, "package.json");
const json = (0, utils_1.loadJson)(path);
for (const name in (json.dependencies || {})) {
const version = json.dependencies[name];
const target = (versions[name] ? ("^" + versions[name]) : version);
@@ -35,7 +35,7 @@ const utils_1 = require("../utils");
}
json.dependencies[name] = target;
}
utils_1.saveJson(path, json, true);
(0, utils_1.saveJson)(path, json, true);
});
});
})();

0
misc/admin/lib/cmds/peg-version.d.ts vendored Normal file
View File

View File

@@ -0,0 +1,16 @@
/*
import { dirnames, getPackage } from "../local";
import { colorify } from "../log";
const dirname = process.argv[2];
if (dirname == null) {
console.log("Usage: peg-version DIRNAME");
process.exit(1);
}
(async function(dirname) {
const { name, version } = getPackage(dirname);
console.log(colorify.bold(`Pegging ${ name } to ${ version }...`));
})(dirname);
*/

View File

@@ -89,10 +89,10 @@ function invalidate(cloudfront, distributionId) {
exports.invalidate = invalidate;
(function () {
return __awaiter(this, void 0, void 0, function* () {
const dirnames = depgraph_1.getOrdered();
const dirnames = (0, depgraph_1.getOrdered)();
// @TODO: Fail if there are any untracked files or unchecked in files
const publish = {};
const progressUpdate = log_1.getProgressBar(log_1.colorify.bold("Finding updated packages..."));
const progressUpdate = (0, log_1.getProgressBar)(log_1.colorify.bold("Finding updated packages..."));
for (let i = 0; i < dirnames.length; i++) {
progressUpdate(i / dirnames.length);
let dirname = dirnames[i];
@@ -103,8 +103,8 @@ exports.invalidate = invalidate;
continue;
}
// Get the latest commit this package was modified at
const path = path_1.resolve("packages", dirname);
const gitHead = yield git_1.getGitTag(path);
const path = (0, path_1.resolve)("packages", dirname);
const gitHead = yield (0, git_1.getGitTag)(path);
if (gitHead == null) {
throw new Error("hmmm...");
}
@@ -119,7 +119,7 @@ exports.invalidate = invalidate;
console.log(log_1.colorify.bold(`Found ${Object.keys(publish).length} updated pacakges...`));
Object.keys(publish).forEach((dirname) => {
const info = publish[dirname];
console.log(` ${log_1.colorify.blue(info.name)} ${utils_1.repeat(" ", 50 - info.name.length - info.oldVersion.length)} ${info.oldVersion} ${log_1.colorify.bold("=>")} ${log_1.colorify.green(info.newVersion)}`);
console.log(` ${log_1.colorify.blue(info.name)} ${(0, utils_1.repeat)(" ", 50 - info.name.length - info.oldVersion.length)} ${info.oldVersion} ${log_1.colorify.bold("=>")} ${log_1.colorify.green(info.newVersion)}`);
});
const publishNames = Object.keys(publish);
publishNames.sort((a, b) => (dirnames.indexOf(a) - dirnames.indexOf(b)));
@@ -149,17 +149,17 @@ exports.invalidate = invalidate;
console.log(log_1.colorify.bold("Publishing:"));
for (let i = 0; i < publishNames.length; i++) {
const dirname = publishNames[i];
const path = path_1.resolve("packages", dirname);
const pathJson = path_1.resolve("packages", dirname, "package.json");
const path = (0, path_1.resolve)("packages", dirname);
const pathJson = (0, path_1.resolve)("packages", dirname, "package.json");
const { gitHead, name, newVersion } = publish[dirname];
console.log(` ${log_1.colorify.blue(name)} @ ${log_1.colorify.green(newVersion)}`);
local.updateJson(pathJson, { gitHead: gitHead }, true);
const info = utils_1.loadJson(pathJson);
const info = (0, utils_1.loadJson)(pathJson);
yield npm.publish(path, info, options);
local.updateJson(pathJson, { gitHead: undefined }, true);
}
if (publishNames.indexOf("ethers") >= 0 || forcePublish) {
const change = changelog_1.getLatestChange();
const change = (0, changelog_1.getLatestChange)();
const patchVersion = change.version.substring(1);
const minorVersion = patchVersion.split(".").slice(0, 2).join(".");
const awsAccessId = yield config_1.config.get("aws-upload-scripts-accesskey");
@@ -169,8 +169,8 @@ exports.invalidate = invalidate;
// The password above already succeeded
const username = yield config_1.config.get("github-user");
const password = yield config_1.config.get("github-release");
const hash = createHash("sha384").update(fs_1.default.readFileSync(path_1.resolve("packages/ethers/dist/ethers.umd.min.js"))).digest("base64");
const gitCommit = yield git_1.getGitTag(path_1.resolve("CHANGELOG.md"));
const hash = createHash("sha384").update(fs_1.default.readFileSync((0, path_1.resolve)("packages/ethers/dist/ethers.umd.min.js"))).digest("base64");
const gitCommit = yield (0, git_1.getGitTag)((0, path_1.resolve)("CHANGELOG.md"));
let content = change.content.trim();
content += '\n\n----\n\n';
content += '**Embedding UMD with [SRI](https:/\/developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity):**\n';
@@ -183,7 +183,7 @@ exports.invalidate = invalidate;
content += '```';
// Publish the release
const beta = false;
const link = yield github_1.createRelease(username, password, change.version, change.title, content, beta, gitCommit);
const link = yield (0, github_1.createRelease)(username, password, change.version, change.title, content, beta, gitCommit);
console.log(`${log_1.colorify.bold("Published release:")} ${link}`);
}
// Upload libs to the CDN (as ethers-v5.1 and ethers-5.1.x)
@@ -244,7 +244,7 @@ exports.invalidate = invalidate;
const { bucketName, originRoot, filename, key, suffix } = fileInfos[i];
yield putObject(s3, {
ACL: "public-read",
Body: fs_1.default.readFileSync(path_1.resolve(filename)),
Body: fs_1.default.readFileSync((0, path_1.resolve)(filename)),
Bucket: bucketName,
ContentType: "application/javascript; charset=utf-8",
Key: (originRoot + key)

View File

@@ -42,8 +42,8 @@ function start(root, options) {
if (options.port == null) {
options.port = 8000;
}
root = path_1.resolve(root);
const server = http_1.createServer((req, resp) => {
root = (0, path_1.resolve)(root);
const server = (0, http_1.createServer)((req, resp) => {
const url = req.url.split("?")[0];
// Follow redirects in options
if (options.redirects && options.redirects[url]) {
@@ -51,7 +51,7 @@ function start(root, options) {
resp.end();
return;
}
let filename = path_1.resolve(root, "." + url);
let filename = (0, path_1.resolve)(root, "." + url);
// Make sure we aren't crawling out of our sandbox
if (url[0] !== "/" || filename.substring(0, filename.length) !== filename) {
resp.writeHead(403);
@@ -94,7 +94,7 @@ function start(root, options) {
return server;
}
exports.start = start;
start(path_2.resolve("docs"), {
start((0, path_2.resolve)("docs"), {
redirects: {
"/": "/v5/"
}

View File

@@ -19,19 +19,19 @@ const utils_1 = require("../utils");
console.log(log_1.colorify.bold("Setting Option:"), arg);
switch (arg) {
case "esm":
build_1.setupBuild(true);
(0, build_1.setupBuild)(true);
break;
case "cjs":
build_1.setupBuild(false);
(0, build_1.setupBuild)(false);
break;
// This will remove the browser field entirely, so make sure
// to set esm of cjs first as they will restore the browser
// field
case "browser-lang-all": {
const filename = path_1.getPackageJsonPath("wordlists");
const info = utils_1.loadJson(filename);
const filename = (0, path_1.getPackageJsonPath)("wordlists");
const info = (0, utils_1.loadJson)(filename);
delete info.browser;
utils_1.saveJson(filename, info, true);
(0, utils_1.saveJson)(filename, info, true);
break;
}
default:

View File

@@ -18,7 +18,7 @@ if (process.argv.length !== 3) {
const key = process.argv[2];
(function () {
return __awaiter(this, void 0, void 0, function* () {
const value = yield log_1.getPassword("Value: ");
const value = yield (0, log_1.getPassword)("Value: ");
yield config_1.config.set(key, value);
});
})().catch((error) => {

View File

@@ -16,7 +16,7 @@ const fs_1 = __importDefault(require("fs"));
const path_1 = require("../path");
const utils_1 = require("../utils");
function copy(src, dst, transform) {
let data = fs_1.default.readFileSync(path_1.resolve(src));
let data = fs_1.default.readFileSync((0, path_1.resolve)(src));
if (transform) {
data = Buffer.from(transform(data.toString()));
}
@@ -24,14 +24,14 @@ function copy(src, dst, transform) {
}
(function () {
return __awaiter(this, void 0, void 0, function* () {
yield utils_1.mkdir(path_1.resolve("output/karma"));
copy(path_1.resolve("packages/ethers/dist/ethers.esm.js"), path_1.resolve("output/karma/ethers.esm.js"));
copy(path_1.resolve("packages/tests/dist/tests.esm.js"), path_1.resolve("output/karma/tests.esm.js"), (data) => {
yield (0, utils_1.mkdir)((0, path_1.resolve)("output/karma"));
copy((0, path_1.resolve)("packages/ethers/dist/ethers.esm.js"), (0, path_1.resolve)("output/karma/ethers.esm.js"));
copy((0, path_1.resolve)("packages/tests/dist/tests.esm.js"), (0, path_1.resolve)("output/karma/tests.esm.js"), (data) => {
return data.replace(/^(import [^;]* from ')(ethers)(';)/, (all, prefix, id, suffix) => {
return prefix + "./ethers.esm.js" + suffix;
});
});
copy(path_1.resolve("packages/ethers/dist/ethers.umd.js"), path_1.resolve("output/karma/ethers.umd.js"));
copy(path_1.resolve("packages/tests/dist/tests.umd.js"), path_1.resolve("output/karma/tests.umd.js"));
copy((0, path_1.resolve)("packages/ethers/dist/ethers.umd.js"), (0, path_1.resolve)("output/karma/ethers.umd.js"));
copy((0, path_1.resolve)("packages/tests/dist/tests.umd.js"), (0, path_1.resolve)("output/karma/tests.umd.js"));
});
})();

View File

@@ -22,17 +22,17 @@ const Words = fs_1.default.readFileSync("/usr/share/dict/words").toString().spli
}, {});
`
// Words missing from the dictionary
accessing addresses aligned autofill called cancelled changed censored
clamping compiled computed configured consumed creating decoded decoding
accessing addresses aligned autofill avatar called cancelled changed censored
clamping compiled computed configured consumed contained creating decoded decoding
decreased decrypt decrypted decrypting deployed deploying deprecated detected
discontinued earliest email emitted enabled encoded encoder encoding encrypt
encrypted encrypting entries euro exceeded existing expected
discontinued earliest email emitted enabled encoded encoder encoding encountered
encrypt encrypted encrypting entries euro exceeded existing expected
expired failed fetches formatted formatting funding generated
hardened has highly ignoring implemented implementer imported including instantiate
joined keyword labelled larger lookup matches mined modified modifies multi
named needed nested neutered numeric offline optimizer overriding owned packed
padded parsed parsing passed payload placeholder processing properties prototyping reached
recommended recovered redacted remaining replaced repriced required reverted
recommended recovered recursively redacted remaining replaced repriced required reverted
serializes shared signed signing skipped stats stored supported tagging targetted
throttled transactions typed uninstall unstake unsubscribe untyped
using verifies verifying website
@@ -56,15 +56,15 @@ ABIEncoder testcase numberish Wordlist
// Common Code Strings
abi addr api app arg arrayify asm backend basex bigint bignumber bn byte
bytecode callback calldata charset checksum ciphertext cli codepoint
bytecode callback calldata ccip charset checksum ciphertext cli codepoint
commify config
contenthash ctr ctrl debug dd dklen eexist encseed eof eq ethaddr
contenthash ctr ctrl debug dd dklen eexist encseed eof eq erc ethaddr
ethseed ethers eval exec filename func gz gzip hid http https hw iv
info init ipc json kdf kdfparams labelhash lang lib mm multihash nfc
nfkc nfd nfkd nodehash notok nowait nullish oob opcode pbkdf pc plugin
info init ipc json kdf kdfparams labelhash lang lib metadata mm multihash nfc
nfkc nfd nfkd nodehash notok nowait nullish offchain oob opcode org pbkdf pc plugin
pragma pre prf recid repl rpc sighash topichash solc stdin stdout subclasses
subnode timeout todo txt typeof ufixed utc utf util url urlencoded uuid vm
vs websocket wikipedia www wx xe xpriv xpub xx yyyy zlib
vs websocket wikipedia wildcard wildcards www wx xe xpriv xpub xx yyyy zlib
// AbiV2
abiv
@@ -72,13 +72,14 @@ abiv
// Query parameters
apikey asc endblock startblock
alchemyapi Cloudflare Etherscan INFURA IPFS MetaMask Nodesmith
alchemyapi arbitrum Cloudflare Etherscan INFURA IPFS MetaMask Nodesmith
Trezor ledgerhq axic bitcoinjs browserify easyseed ethereumjs
goerli homestead kotti kovan mainnet morden mordor rinkeby
goerli homestead kotti kovan mainnet morden mordor rinkeby kintsugi
ropsten testnet lb maticmum
// Demo words
args foo eth foo foobar ll localhost passwd ricmoo tx xxx yna
brantly ricmoose
// nameprep tags
ALCat BiDi LCat nameprep
@@ -129,7 +130,7 @@ function getStrings(source) {
const Include = new RegExp("packages/.*/src.ts/.*\.ts$");
const Exclude = new RegExp("/node_modules/|src.ts/.*browser.*");
function getAllStrings(path) {
const Root = path_1.resolve(__dirname, path);
const Root = (0, path_1.resolve)(__dirname, path);
const readdir = function (path) {
if (path.match(Exclude)) {
return [];
@@ -137,7 +138,7 @@ function getAllStrings(path) {
const stat = fs_1.default.statSync(path);
if (stat.isDirectory()) {
return fs_1.default.readdirSync(path).reduce((result, filename) => {
readdir(path_1.resolve(path, filename)).forEach((file) => {
readdir((0, path_1.resolve)(path, filename)).forEach((file) => {
result.push(file);
});
return result;
@@ -174,7 +175,7 @@ function starts(text, prefix) {
return __awaiter(this, void 0, void 0, function* () {
console.log(log_1.colorify.bold("Spell checking source code strings..."));
let count = 0;
getAllStrings(path_1.resolve(__dirname, "../../../../packages")).forEach((file) => {
getAllStrings((0, path_1.resolve)(__dirname, "../../../../packages")).forEach((file) => {
if (starts(file.filename, "/testcases/src.ts/generation-scripts")) {
return;
}

View File

@@ -19,6 +19,6 @@ const path_1 = require("../path");
(function () {
return __awaiter(this, void 0, void 0, function* () {
console.log(log_1.colorify.bold("Updating CHANGELOG.md..."));
fs_1.default.writeFileSync(path_1.resolve("CHANGELOG.md"), yield changelog_1.generate());
fs_1.default.writeFileSync((0, path_1.resolve)("CHANGELOG.md"), yield (0, changelog_1.generate)());
});
})();

View File

@@ -14,8 +14,8 @@ const path_1 = require("../path");
const local_1 = require("../local");
(function () {
return __awaiter(this, void 0, void 0, function* () {
const ordered = depgraph_1.getOrdered(true);
local_1.updateJson(path_1.resolve("tsconfig.project.json"), {
const ordered = (0, depgraph_1.getOrdered)(true);
(0, local_1.updateJson)((0, path_1.resolve)("tsconfig.project.json"), {
references: ordered.map((name) => ({ path: ("./packages/" + name) }))
});
});

View File

@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
const fs_1 = __importDefault(require("fs"));
const log_1 = require("../log");
const path_1 = require("../path");
const sourceEthers = fs_1.default.readFileSync(path_1.resolve("packages/ethers/src.ts/ethers.ts")).toString();
const sourceEthers = fs_1.default.readFileSync((0, path_1.resolve)("packages/ethers/src.ts/ethers.ts")).toString();
const targets = sourceEthers.match(/export\s*{\s*((.|\s)*)}/)[1].trim();
////////////////////
// Begin template
@@ -35,4 +35,4 @@ export {
// End template
////////////////////
console.log(log_1.colorify.bold(`Flattening exports...`));
fs_1.default.writeFileSync(path_1.resolve("packages/ethers/src.ts/index.ts"), output);
fs_1.default.writeFileSync((0, path_1.resolve)("packages/ethers/src.ts/index.ts"), output);

View File

@@ -14,14 +14,14 @@ const log_1 = require("../log");
const path_1 = require("../path");
(function () {
return __awaiter(this, void 0, void 0, function* () {
const progress = log_1.getProgressBar(log_1.colorify.bold("Updating package.json hashes"));
const progress = (0, log_1.getProgressBar)(log_1.colorify.bold("Updating package.json hashes"));
// Updating all tarball hashes now that versions have been updated
for (let i = 0; i < path_1.dirnames.length; i++) {
progress(i / path_1.dirnames.length);
const dirname = path_1.dirnames[i];
//const gitHead = await getGitTag(resolve("packages", dirname));
const tarballHash = local_1.computeTarballHash(dirname);
local_1.updateJson(path_1.getPackageJsonPath(dirname), { tarballHash }, true);
const tarballHash = (0, local_1.computeTarballHash)(dirname);
(0, local_1.updateJson)((0, path_1.getPackageJsonPath)(dirname), { tarballHash }, true);
}
progress(1);
});

View File

@@ -116,7 +116,7 @@ function _getFiles(result, root) {
if (filename === '.DS_Store') {
return;
}
const fullFilename = path_1.join(root, filename);
const fullFilename = (0, path_1.join)(root, filename);
const stat = fs_1.default.statSync(fullFilename);
if (stat.isDirectory()) {
_getFiles(result, fullFilename);
@@ -150,7 +150,7 @@ function getFiles(basedir) {
secretAccessKey: awsSecretKey
});
const added = [], removed = [], changed = [], upload = [];
const basedir = path_2.resolve("docs");
const basedir = (0, path_2.resolve)("docs");
const local = yield getFiles(basedir);
const remote = yield getKeys(s3, bucket);
Object.keys(local).forEach((filename) => {
@@ -177,7 +177,7 @@ function getFiles(basedir) {
console.log('Changed: ', changed.length);
for (let i = 0; i < upload.length; i++) {
const filename = upload[i];
const content = fs_1.default.readFileSync(path_1.join(basedir, filename));
const content = fs_1.default.readFileSync((0, path_1.join)(basedir, filename));
console.log(`Uploading: ${filename} (${content.length} bytes)`);
yield putObject(s3, bucket, filename, content);
}

View File

@@ -22,15 +22,15 @@ const scrypt_js_1 = __importDefault(require("scrypt-js"));
const log_1 = require("./log");
function getRandomBytes(length) {
const result = new Uint8Array(length);
result.set(crypto_1.randomBytes(length));
result.set((0, crypto_1.randomBytes)(length));
return result;
}
function computeHmac(key, data) {
return "0x" + crypto_1.createHmac("sha512", key).update(data).digest("hex");
return "0x" + (0, crypto_1.createHmac)("sha512", key).update(data).digest("hex");
}
function getScrypt(message, password, salt) {
return __awaiter(this, void 0, void 0, function* () {
const progress = log_1.getProgressBar(message);
const progress = (0, log_1.getProgressBar)(message);
return yield scrypt_js_1.default.scrypt(Buffer.from(password), Buffer.from(salt), (1 << 17), 8, 1, 64, progress);
});
}
@@ -58,7 +58,7 @@ class Config {
}
this.canary = data.canary || "";
this.salt = data.salt;
const password = yield log_1.getPassword(log_1.colorify.bold("Password (config-store): "));
const password = yield (0, log_1.getPassword)(log_1.colorify.bold("Password (config-store): "));
this.dkey = yield getScrypt(log_1.colorify.bold("Unlocking config"), password, this.salt);
if (data.ciphertext) {
const ciphertext = Buffer.from(data.ciphertext, "base64");
@@ -113,7 +113,7 @@ class Config {
this.salt = this.dkey = null;
}
}
const _config = new Config(path_1.resolve(os_1.default.homedir(), ".ethers-dist"));
const _config = new Config((0, path_1.resolve)(os_1.default.homedir(), ".ethers-dist"));
exports.config = {
get: function (key) {
return _config.get(key);

View File

@@ -47,7 +47,7 @@ function getOrdered(skipNobuild) {
};
for (let i = 0; i < path_1.dirnames.length; i++) {
let dirname = path_1.dirnames[i];
let info = local_1.getPackage(dirname);
let info = (0, local_1.getPackage)(dirname);
if (skipNobuild && info._ethers_nobuild) {
continue;
}
@@ -91,8 +91,8 @@ exports.getOrdered = getOrdered;
function sort(dirnames) {
let ordered = getOrdered();
dirnames.sort((a, b) => {
let ai = ordered.indexOf(local_1.getPackage(a).name);
let bi = ordered.indexOf(local_1.getPackage(b).name);
let ai = ordered.indexOf((0, local_1.getPackage)(a).name);
let bi = ordered.indexOf((0, local_1.getPackage)(b).name);
if (ai === -1 || bi === -1) {
throw new Error("unknown dirname - " + [a, b].join(", "));
}

View File

@@ -75,7 +75,7 @@ function _getUrl(href, options) {
// @TODO: Once we drop support for node 8, we can pass the href
// directly into request and skip adding the components
// to this request object
const url = url_1.parse(href);
const url = (0, url_1.parse)(href);
const request = {
protocol: nonnull(url.protocol),
hostname: nonnull(url.hostname),

View File

@@ -14,7 +14,7 @@ const run_1 = require("./run");
// Returns the most recent git commit hash for a given filename
function getGitTag(filename) {
return __awaiter(this, void 0, void 0, function* () {
const result = yield run_1.run("git", ["log", "-n", "1", "--", filename]);
const result = yield (0, run_1.run)("git", ["log", "-n", "1", "--", filename]);
if (!result.ok) {
throw new Error(`git log error`);
}

View File

@@ -22,7 +22,7 @@ function _fetchGitHub(user, password, getUrlFunc, url) {
return __awaiter(this, void 0, void 0, function* () {
const result = [];
while (true) {
const filename = path_1.resolve("github-cache", Buffer.from(js_sha3_1.keccak_256.create().update(Buffer.from(url)).digest()).toString("hex").substring(0, 12));
const filename = (0, path_1.resolve)("github-cache", Buffer.from(js_sha3_1.keccak_256.create().update(Buffer.from(url)).digest()).toString("hex").substring(0, 12));
const headers = {
"User-Agent": "ethers-io",
};
@@ -41,7 +41,7 @@ function _fetchGitHub(user, password, getUrlFunc, url) {
throw error;
}
}
const response = yield geturl_1.getUrl(url, { headers, user, password });
const response = yield (0, geturl_1.getUrl)(url, { headers, user, password });
console.log(response.statusCode);
// Cached response is good; use it!
if (response.statusCode !== 304) {
@@ -129,7 +129,7 @@ function syncIssues(user, password) {
exports.syncIssues = syncIssues;
function createRelease(user, password, tagName, title, body, prerelease, commit) {
return __awaiter(this, void 0, void 0, function* () {
const result = yield geturl_1.getUrl("https:/\/api.github.com/repos/ethers-io/ethers.js/releases", {
const result = yield (0, geturl_1.getUrl)("https:/\/api.github.com/repos/ethers-io/ethers.js/releases", {
body: Buffer.from(JSON.stringify({
tag_name: tagName,
target_commitish: (commit || "master"),

View File

@@ -9,7 +9,7 @@ const path_1 = require("./path");
const run_1 = require("./run");
const utils_1 = require("./utils");
function getPackage(name) {
const value = utils_1.loadJson(path_1.getPackageJsonPath(name));
const value = (0, utils_1.loadJson)((0, path_1.getPackageJsonPath)(name));
return {
name: value.name,
version: value.version,
@@ -23,7 +23,7 @@ function getPackage(name) {
}
exports.getPackage = getPackage;
function updateJson(path, replace, sort) {
const values = utils_1.loadJson(path);
const values = (0, utils_1.loadJson)(path);
Object.keys(replace).forEach((key) => {
const value = replace[key];
if (value === undefined) {
@@ -33,12 +33,12 @@ function updateJson(path, replace, sort) {
values[key] = replace[key];
}
});
utils_1.saveJson(path, values, !!sort);
(0, utils_1.saveJson)(path, values, !!sort);
}
exports.updateJson = updateJson;
function getDependencies(name, filter) {
if (name) {
return utils_1.sortRecords(getPackage(name).dependencies);
return (0, utils_1.sortRecords)(getPackage(name).dependencies);
}
// Find all versions for each package dependency
const deps = path_1.dirnames.reduce((accum, dirname) => {
@@ -55,7 +55,7 @@ function getDependencies(name, filter) {
return accum;
}, {});
// Make sure each package dependency only has 1 version
return utils_1.sortRecords(Object.keys(deps).reduce((accum, name) => {
return (0, utils_1.sortRecords)(Object.keys(deps).reduce((accum, name) => {
const versions = Object.keys(deps[name]);
if (versions.length > 1) {
throw new Error(`cannot depend on multiple versions for ${JSON.stringify(name)}: ${versions.map(v => JSON.stringify(v)).join(", ")}`);
@@ -66,7 +66,7 @@ function getDependencies(name, filter) {
}
exports.getDependencies = getDependencies;
function getPackList(name) {
const result = run_1.run("npm", ["pack", "--json", path_1.getPackagePath(name), "--dry-run"]);
const result = (0, run_1.run)("npm", ["pack", "--json", (0, path_1.getPackagePath)(name), "--dry-run"]);
if (!result.ok) {
const error = new Error(`failed to run npm pack: ${name}`);
error.result = result;
@@ -118,9 +118,9 @@ function computeTarballHash(name) {
const files = getPackList(name);
files.sort();
// Compute the hash for each file
const packageRoot = path_1.getPackagePath(name);
const packageRoot = (0, path_1.getPackagePath)(name);
const hashes = files.reduce((accum, filename) => {
let content = fs_1.default.readFileSync(path_1.resolve(packageRoot, filename));
let content = fs_1.default.readFileSync((0, path_1.resolve)(packageRoot, filename));
// The package.json includes the hash, so we need to nix it to get a consistent hash
if (filename === "package.json") {
const info = JSON.parse(content.toString());
@@ -128,10 +128,10 @@ function computeTarballHash(name) {
delete info.tarballHash;
content = Buffer.from(JSON.stringify(info, null, 2));
}
accum[filename] = utils_1.sha256(content);
accum[filename] = (0, utils_1.sha256)(content);
return accum;
}, {});
return utils_1.sha256(Buffer.from("{" + files.map((filename) => {
return (0, utils_1.sha256)(Buffer.from("{" + files.map((filename) => {
return `${JSON.stringify(filename)}:"${hashes[filename]}"`;
}).join(",") + "}"));
}

View File

@@ -98,7 +98,7 @@ function _getPrompt(prompt, options, callback) {
(process.stdout).clearLine();
(process.stdout).cursorTo(0);
if (options.mask) {
process.stdout.write(prompt + utils_1.repeat(options.mask, message.length));
process.stdout.write(prompt + (0, utils_1.repeat)(options.mask, message.length));
}
else {
process.stdout.write(prompt + message);

View File

@@ -22,10 +22,10 @@ const cache = {};
function getPackageInfo(name) {
return __awaiter(this, void 0, void 0, function* () {
// Convert dirname to package if needed
name = local_1.getPackage(name).name;
name = (0, local_1.getPackage)(name).name;
if (!cache[name]) {
try {
const result = yield geturl_1.getUrl("http:/" + "/registry.npmjs.org/" + name);
const result = yield (0, geturl_1.getUrl)("https:/\/registry.npmjs.org/" + name);
cache[name] = JSON.parse(Buffer.from(result.body).toString("utf8"));
}
catch (error) {
@@ -66,12 +66,12 @@ exports.getPackage = getPackage;
function publish(path, manifest, options) {
return __awaiter(this, void 0, void 0, function* () {
try {
yield libnpmpublish_1.publish(path, manifest, options);
yield (0, libnpmpublish_1.publish)(path, manifest, options);
}
catch (error) {
// We need an OTP
if (error.code === "EOTP") {
const otp = yield log_1.getPrompt(log_1.colorify.bold("Enter OTP: "));
const otp = yield (0, log_1.getPrompt)(log_1.colorify.bold("Enter OTP: "));
options.otp = otp.replace(" ", "");
// Retry with the new OTP
return yield publish(path, manifest, options);

View File

@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
exports.isEthers = exports.getPackageJsonPath = exports.getDirname = exports.getPackagePath = exports.packages = exports.dirnames = exports.dirs = exports.resolve = exports.root = void 0;
const fs_1 = __importDefault(require("fs"));
const path_1 = require("path");
exports.root = path_1.resolve(__dirname, "../../../");
exports.root = (0, path_1.resolve)(__dirname, "../../../");
function resolve(...args) {
args.unshift(exports.root);
return path_1.resolve.apply(null, args);
@@ -23,8 +23,8 @@ exports.dirnames = Object.freeze(fs_1.default.readdirSync(exports.dirs.packages)
return (dirname[0] !== ".");
}));
const packageLookup = exports.dirnames.reduce((accum, dirname) => {
const packagePath = path_1.resolve(exports.dirs.packages, dirname);
const packageJsonPath = path_1.resolve(packagePath, "package.json");
const packagePath = (0, path_1.resolve)(exports.dirs.packages, dirname);
const packageJsonPath = (0, path_1.resolve)(packagePath, "package.json");
const info = JSON.parse(fs_1.default.readFileSync(packageJsonPath).toString());
const packageName = info.name;
const version = info.version;

View File

@@ -10,7 +10,7 @@ function run(progname, args, currentWorkingDirectory) {
if (currentWorkingDirectory) {
options.cwd = currentWorkingDirectory;
}
const child = child_process_1.spawnSync(progname, args, options);
const child = (0, child_process_1.spawnSync)(progname, args, options);
const result = {
_stderr: child.stderr,
stderr: (child.stderr.toString() || null),

View File

@@ -28,7 +28,7 @@ function repeat(char, length) {
}
exports.repeat = repeat;
function sha256(content) {
const hasher = crypto_1.createHash("sha256");
const hasher = (0, crypto_1.createHash)("sha256");
hasher.update(content);
return "0x" + hasher.digest("hex");
}
@@ -43,7 +43,7 @@ function sortRecords(record) {
}
exports.sortRecords = sortRecords;
function atomicWrite(path, value) {
const tmp = path_1.resolve(__dirname, "../../../.atomic-tmp");
const tmp = (0, path_1.resolve)(__dirname, "../../../.atomic-tmp");
fs_1.default.writeFileSync(tmp, value);
fs_1.default.renameSync(tmp, path);
}
@@ -96,7 +96,7 @@ function mkdir(path) {
break;
}
dirs.push(path);
path = path_1.dirname(path);
path = (0, path_1.dirname)(path);
}
while (dirs.length) {
fs_1.default.mkdirSync(dirs.pop());

View File

@@ -52,7 +52,7 @@ async function alias(name: string): Promise<void> {
if (replace) {
inputFilename = replace;
transform = function(content: string) {
content = content.replace(/(\/\/# sourceMappingURL=)(.*)$/g, (all, prefix, mapFilename) => {
content = content.replace(/^(\/\/# sourceMappingURL=)(.*)$/mg, (all, prefix, mapFilename) => {
return prefix + filename + ".map";
});
return content;
@@ -132,7 +132,7 @@ async function alias(name: string): Promise<void> {
console.log(colorify.bold(`Aliasing Node ESM to Browser ESM...`));
const dirnames = getOrdered(true);
for (let i = 0; i < dirnames.length; i++) {
//if (dirnames[i] !== "base64") { continue; }
//if (dirnames[i] !== "signing-key") { continue; }
await alias(dirnames[i]);
}
})();

View File

@@ -0,0 +1,16 @@
/*
import { dirnames, getPackage } from "../local";
import { colorify } from "../log";
const dirname = process.argv[2];
if (dirname == null) {
console.log("Usage: peg-version DIRNAME");
process.exit(1);
}
(async function(dirname) {
const { name, version } = getPackage(dirname);
console.log(colorify.bold(`Pegging ${ name } to ${ version }...`));
})(dirname);
*/

View File

@@ -13,17 +13,17 @@ const Words = fs.readFileSync("/usr/share/dict/words").toString().split("\n").re
`
// Words missing from the dictionary
accessing addresses aligned autofill called cancelled changed censored
clamping compiled computed configured consumed creating decoded decoding
accessing addresses aligned autofill avatar called cancelled changed censored
clamping compiled computed configured consumed contained creating decoded decoding
decreased decrypt decrypted decrypting deployed deploying deprecated detected
discontinued earliest email emitted enabled encoded encoder encoding encrypt
encrypted encrypting entries euro exceeded existing expected
discontinued earliest email emitted enabled encoded encoder encoding encountered
encrypt encrypted encrypting entries euro exceeded existing expected
expired failed fetches formatted formatting funding generated
hardened has highly ignoring implemented implementer imported including instantiate
joined keyword labelled larger lookup matches mined modified modifies multi
named needed nested neutered numeric offline optimizer overriding owned packed
padded parsed parsing passed payload placeholder processing properties prototyping reached
recommended recovered redacted remaining replaced repriced required reverted
recommended recovered recursively redacted remaining replaced repriced required reverted
serializes shared signed signing skipped stats stored supported tagging targetted
throttled transactions typed uninstall unstake unsubscribe untyped
using verifies verifying website
@@ -47,15 +47,15 @@ ABIEncoder testcase numberish Wordlist
// Common Code Strings
abi addr api app arg arrayify asm backend basex bigint bignumber bn byte
bytecode callback calldata charset checksum ciphertext cli codepoint
bytecode callback calldata ccip charset checksum ciphertext cli codepoint
commify config
contenthash ctr ctrl debug dd dklen eexist encseed eof eq ethaddr
contenthash ctr ctrl debug dd dklen eexist encseed eof eq erc ethaddr
ethseed ethers eval exec filename func gz gzip hid http https hw iv
info init ipc json kdf kdfparams labelhash lang lib mm multihash nfc
nfkc nfd nfkd nodehash notok nowait nullish oob opcode pbkdf pc plugin
info init ipc json kdf kdfparams labelhash lang lib metadata mm multihash nfc
nfkc nfd nfkd nodehash notok nowait nullish offchain oob opcode org pbkdf pc plugin
pragma pre prf recid repl rpc sighash topichash solc stdin stdout subclasses
subnode timeout todo txt typeof ufixed utc utf util url urlencoded uuid vm
vs websocket wikipedia www wx xe xpriv xpub xx yyyy zlib
vs websocket wikipedia wildcard wildcards www wx xe xpriv xpub xx yyyy zlib
// AbiV2
abiv
@@ -63,13 +63,14 @@ abiv
// Query parameters
apikey asc endblock startblock
alchemyapi Cloudflare Etherscan INFURA IPFS MetaMask Nodesmith
alchemyapi arbitrum Cloudflare Etherscan INFURA IPFS MetaMask Nodesmith
Trezor ledgerhq axic bitcoinjs browserify easyseed ethereumjs
goerli homestead kotti kovan mainnet morden mordor rinkeby
goerli homestead kotti kovan mainnet morden mordor rinkeby kintsugi
ropsten testnet lb maticmum
// Demo words
args foo eth foo foobar ll localhost passwd ricmoo tx xxx yna
brantly ricmoose
// nameprep tags
ALCat BiDi LCat nameprep

View File

@@ -15,7 +15,7 @@ async function getPackageInfo(name: string): Promise<any> {
if (!cache[name]) {
try {
const result = await getUrl("http:/" + "/registry.npmjs.org/" + name);
const result = await getUrl("https:/\/registry.npmjs.org/" + name);
cache[name] = JSON.parse(Buffer.from(result.body).toString("utf8"));
} catch (error) {
if (error.status === 404) { return null; }

2449
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -65,22 +65,22 @@
"@types/node": "^12.7.4",
"@types/semver": "^7.3.4",
"aes-js": "3.0.0",
"aws-sdk": "2.137.0",
"aws-sdk": "2.1039.0",
"diff": "4.0.1",
"flatworm": "0.0.2-beta.6",
"flatworm": "0.0.2-beta.7",
"jison": "0.4.18",
"karma": "6.3.2",
"karma": "6.3.17",
"karma-chrome-launcher": "3.1.0",
"karma-mocha": "2.0.1",
"libnpmpublish": "3.0.1",
"mocha": "^7.1.1",
"mocha": "^9.1.3",
"nyc": "15.1.0",
"rollup": "2.33.2",
"rollup-plugin-node-polyfills": "0.2.1",
"rollup-plugin-sourcemaps": "0.6.3",
"scrypt-js": "3.0.1",
"semver": "^5.6.0",
"typescript": "4.2.2",
"typescript": "4.4.4",
"uglify-es": "3.3.9"
},
"dependencies": {
@@ -95,7 +95,7 @@
"bn.js": "^4.11.9",
"elliptic": "6.5.4",
"hash.js": "1.1.7",
"js-sha3": "0.5.7",
"js-sha3": "0.8.0",
"scrypt-js": "3.0.1",
"solc": "0.7.1",
"tiny-inflate": "1.0.3",

View File

@@ -1,2 +1,2 @@
export declare const version = "abi/5.4.0";
export declare const version = "abi/5.6.0";
//# sourceMappingURL=_version.d.ts.map

View File

@@ -1,2 +1,2 @@
export const version = "abi/5.4.0";
export const version = "abi/5.6.0";
//# sourceMappingURL=_version.js.map

View File

@@ -11,7 +11,7 @@ export class AddressCoder extends Coder {
}
encode(writer, value) {
try {
getAddress(value);
value = getAddress(value);
}
catch (error) {
this._throwError(error.message, value);

View File

@@ -1 +1 @@
{"version":3,"file":"address.js","sourceRoot":"","sources":["../../src.ts/coders/address.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,OAAO,EAAE,KAAK,EAAkB,MAAM,kBAAkB,CAAC;AAEzD,MAAM,OAAO,YAAa,SAAQ,KAAK;IAEnC,YAAY,SAAiB;QACzB,KAAK,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;IAClD,CAAC;IAED,YAAY;QACR,OAAO,4CAA4C,CAAC;IACxD,CAAC;IAED,MAAM,CAAC,MAAc,EAAE,KAAa;QAChC,IAAI;YACA,UAAU,CAAC,KAAK,CAAC,CAAC;SACrB;QAAC,OAAO,KAAK,EAAE;YACZ,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;SAC1C;QACD,OAAO,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;IAED,MAAM,CAAC,MAAc;QACjB,OAAO,UAAU,CAAC,UAAU,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC,WAAW,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;IACxE,CAAC;CACJ"}
{"version":3,"file":"address.js","sourceRoot":"","sources":["../../src.ts/coders/address.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,OAAO,EAAE,KAAK,EAAkB,MAAM,kBAAkB,CAAC;AAEzD,MAAM,OAAO,YAAa,SAAQ,KAAK;IAEnC,YAAY,SAAiB;QACzB,KAAK,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;IAClD,CAAC;IAED,YAAY;QACR,OAAO,4CAA4C,CAAC;IACxD,CAAC;IAED,MAAM,CAAC,MAAc,EAAE,KAAa;QAChC,IAAI;YACA,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC,CAAA;SAC5B;QAAC,OAAO,KAAK,EAAE;YACZ,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;SAC1C;QACD,OAAO,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;IAED,MAAM,CAAC,MAAc;QACjB,OAAO,UAAU,CAAC,UAAU,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC,WAAW,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;IACxE,CAAC;CACJ"}

View File

@@ -1 +1 @@
{"version":3,"file":"array.d.ts","sourceRoot":"","sources":["../../src.ts/coders/array.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAGjE,wBAAgB,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,CAAC,KAAK,CAAC,EA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,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;IAS3D,YAAY,IAAI,KAAK,CAAC,GAAG,CAAC;IAW1B,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,MAAM;IAoBjD,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG;CAsB9B"}

View File

@@ -131,6 +131,7 @@ export function unpack(reader, coders) {
const value = values[index];
if (value instanceof Error) {
Object.defineProperty(values, name, {
enumerable: true,
get: () => { throw value; }
});
}
@@ -142,6 +143,7 @@ export function unpack(reader, coders) {
const value = values[i];
if (value instanceof Error) {
Object.defineProperty(values, i, {
enumerable: true,
get: () => { throw value; }
});
}

File diff suppressed because one or more lines are too long

View File

@@ -201,7 +201,7 @@ export const FormatTypes = Object.freeze({
sighash: "sighash",
// Human-Readable with Minimal spacing and without names (compact human-readable)
minimal: "minimal",
// Human-Readble with nice spacing, including all names
// Human-Readable with nice spacing, including all names
full: "full",
// JSON-format a la Solidity
json: "json"
@@ -239,7 +239,7 @@ export class ParamType {
// Format the parameter fragment
// - sighash: "(uint256,address)"
// - minimal: "tuple(uint256,address) indexed"
// - full: "tuple(uint256 foo, addres bar) indexed baz"
// - full: "tuple(uint256 foo, address bar) indexed baz"
format(format) {
if (!format) {
format = FormatTypes.sighash;

File diff suppressed because one or more lines are too long

View File

@@ -1 +1 @@
{"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../src.ts/interface.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAY,SAAS,EAA0D,MAAM,sBAAsB,CAAC;AAGnH,OAAO,EAAkB,WAAW,EAAa,MAAM,2BAA2B,CAAC;AAEnF,OAAO,EAAE,QAAQ,EAAmB,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAC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E,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,YAAY,CAAA;KAAE,GAAG,sBAAsB;IAoBpF,QAAQ,CAAC,GAAG,EAAE;QAAE,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAC,GAAG,cAAc;IAmBrE,UAAU,CAAC,IAAI,EAAE,SAAS,GAAG,gBAAgB;IA4B7C,MAAM,CAAC,WAAW,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,SAAS;CAGrD"}

View File

@@ -58,7 +58,7 @@ export class Interface {
defineReadOnly(this, "fragments", abi.map((fragment) => {
return Fragment.from(fragment);
}).filter((fragment) => (fragment != null)));
defineReadOnly(this, "_abiCoder", getStatic((new.target), "getAbiCoder")());
defineReadOnly(this, "_abiCoder", getStatic(new.target, "getAbiCoder")());
defineReadOnly(this, "functions", {});
defineReadOnly(this, "errors", {});
defineReadOnly(this, "events", {});
@@ -155,7 +155,7 @@ export class Interface {
}
return this.functions[matching[0]];
}
// Normlize the signature and lookup the function
// Normalize the signature and lookup the function
const result = this.functions[FunctionFragment.fromString(nameOrSignatureOrSighash).format()];
if (!result) {
logger.throwArgumentError("no matching function", "signature", nameOrSignatureOrSighash);
@@ -185,7 +185,7 @@ export class Interface {
}
return this.events[matching[0]];
}
// Normlize the signature and lookup the function
// Normalize the signature and lookup the function
const result = this.events[EventFragment.fromString(nameOrSignatureOrTopic).format()];
if (!result) {
logger.throwArgumentError("no matching event", "signature", nameOrSignatureOrTopic);
@@ -216,7 +216,7 @@ export class Interface {
}
return this.errors[matching[0]];
}
// Normlize the signature and lookup the function
// Normalize the signature and lookup the function
const result = this.errors[FunctionFragment.fromString(nameOrSignatureOrSighash).format()];
if (!result) {
logger.throwArgumentError("no matching error", "signature", nameOrSignatureOrSighash);
@@ -331,9 +331,7 @@ export class Interface {
errorName = error.name;
errorSignature = error.format();
}
catch (error) {
console.log(error);
}
catch (error) { }
}
break;
}
@@ -428,7 +426,7 @@ export class Interface {
topics.push(keccak256(value));
}
else if (param.baseType === "tuple" || param.baseType === "array") {
// @TOOD
// @TODO
throw new Error("not implemented");
}
else {
@@ -511,6 +509,7 @@ export class Interface {
// Make error named values throw on access
if (value instanceof Error) {
Object.defineProperty(result, param.name, {
enumerable: true,
get: () => { throw wrapAccessError(`property ${JSON.stringify(param.name)}`, value); }
});
}
@@ -524,6 +523,7 @@ export class Interface {
const value = result[i];
if (value instanceof Error) {
Object.defineProperty(result, i, {
enumerable: true,
get: () => { throw wrapAccessError(`index ${i}`, value); }
});
}
@@ -557,7 +557,7 @@ export class Interface {
}
// @TODO: If anonymous, and the only method, and the input count matches, should we parse?
// Probably not, because just because it is the only event in the ABI does
// not mean we have the full ABI; maybe jsut a fragment?
// not mean we have the full ABI; maybe just a fragment?
return new LogDescription({
eventFragment: fragment,
name: fragment.name,

File diff suppressed because one or more lines are too long

View File

@@ -1,2 +1,2 @@
export declare const version = "abi/5.4.0";
export declare const version = "abi/5.6.0";
//# sourceMappingURL=_version.d.ts.map

View File

@@ -1,5 +1,5 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.version = void 0;
exports.version = "abi/5.4.0";
exports.version = "abi/5.6.0";
//# sourceMappingURL=_version.js.map

View File

@@ -24,7 +24,7 @@ var AbiCoder = /** @class */ (function () {
function AbiCoder(coerceFunc) {
var _newTarget = this.constructor;
logger.checkNew(_newTarget, AbiCoder);
properties_1.defineReadOnly(this, "coerceFunc", coerceFunc || null);
(0, properties_1.defineReadOnly)(this, "coerceFunc", coerceFunc || null);
}
AbiCoder.prototype._getCoder = function (param) {
var _this = this;
@@ -97,7 +97,7 @@ var AbiCoder = /** @class */ (function () {
var _this = this;
var coders = types.map(function (type) { return _this._getCoder(fragments_1.ParamType.from(type)); });
var coder = new tuple_1.TupleCoder(coders, "_");
return coder.decode(this._getReader(bytes_1.arrayify(data), loose));
return coder.decode(this._getReader((0, bytes_1.arrayify)(data), loose));
};
return AbiC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AC,IAAI,kBAAU,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC;QAE5C,IAAM,MAAM,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QACjC,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAC7B,OAAO,MAAM,CAAC,IAAI,CAAC;IACvB,CAAC;IAED,yBAAM,GAAN,UAAO,KAAwC,EAAE,IAAe,EAAE,KAAe;QAAjF,iBAIC;QAHG,IAAM,MAAM,GAAiB,KAAK,CAAC,GAAG,CAAC,UAAC,IAAI,IAAK,OAAA,KAAI,CAAC,SAAS,CAAC,qBAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,EAApC,CAAoC,CAAC,CAAC;QACvF,IAAM,KAAK,GAAG,IAAI,kBAAU,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAC1C,OAAO,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,IAAA,gBAAQ,EAAC,IAAI,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;IAChE,CAAC;IACL,eAAC;AAAD,CAAC,AAzFD,IAyFC;AAzFY,4BAAQ;AA2FR,QAAA,eAAe,GAAa,IAAI,QAAQ,EAAE,CAAC"}

View File

@@ -45,14 +45,14 @@ var Coder = /** @class */ (function () {
exports.Coder = Coder;
var Writer = /** @class */ (function () {
function Writer(wordSize) {
properties_1.defineReadOnly(this, "wordSize", wordSize || 32);
(0, properties_1.defineReadOnly)(this, "wordSize", wordSize || 32);
this._data = [];
this._dataLength = 0;
this._padding = new Uint8Array(wordSize);
}
Object.defineProperty(Writer.prototype, "data", {
get: function () {
return bytes_1.hexConcat(this._data);
return (0, bytes_1.hexConcat)(this._data);
},
enumerable: false,
configurable: true
@@ -68,19 +68,19 @@ var Writer = /** @class */ (function () {
return data.length;
};
Writer.prototype.appendWriter = function (writer) {
return this._writeData(bytes_1.concat(writer._data));
return this._writeData((0, bytes_1.concat)(writer._data));
};
// Arrayish items; padded on the right to wordSize
Writer.prototype.writeBytes = function (value) {
var bytes = bytes_1.arrayify(value);
var bytes = (0, bytes_1.arrayify)(value);
var paddingOffset = bytes.length % this.wordSize;
if (paddingOffset) {
bytes = bytes_1.concat([bytes, this._padding.slice(paddingOffset)]);
bytes = (0, bytes_1.concat)([bytes, this._padding.slice(paddingOffset)]);
}
return this._writeData(bytes);
};
Writer.prototype._getValue = function (value) {
var bytes = bytes_1.arrayify(bignumber_1.BigNumber.from(value));
var bytes = (0, bytes_1.arrayify)(bignumber_1.BigNumber.from(value));
if (bytes.length > this.wordSize) {
logger.throwError("value out-of-bounds", logger_1.Logger.errors.BUFFER_OVERRUN, {
length: this.wordSize,
@@ -88,7 +88,7 @@ var Writer = /** @class */ (function () {
});
}
if (bytes.length % this.wordSize) {
bytes = bytes_1.concat([this._padding.slice(bytes.length % this.wordSize), bytes]);
bytes = (0, bytes_1.concat)([this._padding.slice(bytes.length % this.wordSize), bytes]);
}
return bytes;
};
@@ -110,14 +110,14 @@ var Writer = /** @class */ (function () {
exports.Writer = Writer;
var Reader = /** @class */ (function () {
function Reader(data, wordSize, coerceFunc, allowLoose) {
properties_1.defineReadOnly(this, "_data", bytes_1.arrayify(data));
properties_1.defineReadOnly(this, "wordSize", wordSize || 32);
properties_1.defineReadOnly(this, "_coerceFunc", coerceFunc);
properties_1.defineReadOnly(this, "allowLoose", allowLoose);
(0, properties_1.defineReadOnly)(this, "_data", (0, bytes_1.arrayify)(data));
(0, properties_1.defineReadOnly)(this, "wordSize", wordSize || 32);
(0, properties_1.defineReadOnly)(this, "_coerceFunc", coerceFunc);
(0, properties_1.defineReadOnly)(this, "allowLoose", allowLoose);
this._offset = 0;
}
Object.defineProperty(Reader.prototype, "data", {
get: function () { return bytes_1.hexlify(this._data); },
get: function () { return (0, bytes_1.hexlify)(this._data); },
enumerable: false,
configurable: true
});

File diff suppressed because one or more lines are too long

View File

@@ -29,7 +29,7 @@ var AddressCoder = /** @class */ (function (_super) {
};
AddressCoder.prototype.encode = function (writer, value) {
try {
address_1.getAddress(value);
value = (0, address_1.getAddress)(value);
}
catch (error) {
this._throwError(error.message, value);
@@ -37,7 +37,7 @@ var AddressCoder = /** @class */ (function (_super) {
return writer.writeValue(value);
};
AddressCoder.prototype.decode = function (reader) {
return address_1.getAddress(bytes_1.hexZeroPad(reader.readValue().toHexString(), 20));
return (0, address_1.getAddress)((0, bytes_1.hexZeroPad)(reader.readValue().toHexString(), 20));
};
return AddressCoder;
}(abstract_coder_1.Coder));

View File

@@ -1 +1 @@
{"version":3,"file":"address.js","sourceRoot":"","sources":["../../src.ts/coders/address.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;AAEb,kDAAoD;AACpD,8CAAkD;AAElD,mDAAyD;AAEzD;IAAkC,gCAAK;IAEnC,sBAAY,SAAiB;eACzB,kBAAM,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,CAAC;IACjD,CAAC;IAED,mCAAY,GAAZ;QACI,OAAO,4CAA4C,CAAC;IACxD,CAAC;IAED,6BAAM,GAAN,UAAO,MAAc,EAAE,KAAa;QAChC,IAAI;YACA,oBAAU,CAAC,KAAK,CAAC,CAAC;SACrB;QAAC,OAAO,KAAK,EAAE;YACZ,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;SAC1C;QACD,OAAO,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;IAED,6BAAM,GAAN,UAAO,MAAc;QACjB,OAAO,oBAAU,CAAC,kBAAU,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC,WAAW,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;IACxE,CAAC;IACL,mBAAC;AAAD,CAAC,AAtBD,CAAkC,sBAAK,GAsBtC;AAtBY,oCAAY"}
{"version":3,"file":"address.js","sourceRoot":"","sources":["../../src.ts/coders/address.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;;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,GAAG,GAAG;CAsB9B"}

View File

@@ -149,6 +149,7 @@ function unpack(reader, coders) {
var value = values[index];
if (value instanceof Error) {
Object.defineProperty(values, name, {
enumerable: true,
get: function () { throw value; }
});
}
@@ -160,6 +161,7 @@ function unpack(reader, coders) {
var value = values[i];
if (value instanceof Error) {
Object.defineProperty(values, i, {
enumerable: true,
get: function () { throw value; }
});
}

File diff suppressed because one or more lines are too long

Some files were not shown because too many files have changed in this diff Show More