forked from tornado-packages/ethers.js
Compare commits
96 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4e6d121fb8 | ||
|
|
bfcd05fcbb | ||
|
|
819b1ace5c | ||
|
|
4b331148d9 | ||
|
|
7adcf3b154 | ||
|
|
630656e949 | ||
|
|
8681cd5969 | ||
|
|
470551e4ee | ||
|
|
d395d16fa3 | ||
|
|
8077ce0aae | ||
|
|
2fe78ad7e3 | ||
|
|
5f1f2c5e2c | ||
|
|
3c79ee8cef | ||
|
|
772067a3c9 | ||
|
|
621897f249 | ||
|
|
d3b7130ed6 | ||
|
|
dad3829c2e | ||
|
|
de4d683f6d | ||
|
|
ebe4cc90f5 | ||
|
|
35e3bf9d11 | ||
|
|
2d717dcef8 | ||
|
|
3316468e3e | ||
|
|
5144acf456 | ||
|
|
aadc5cd3d6 | ||
|
|
6e088099ad | ||
|
|
b6370f1360 | ||
|
|
26464c5425 | ||
|
|
37a9c77ab2 | ||
|
|
4898e7baac | ||
|
|
c71bbbe7db | ||
|
|
c8fecbbc29 | ||
|
|
b4df28dddd | ||
|
|
483d67f55c | ||
|
|
987bec87af | ||
|
|
a9cdbe1238 | ||
|
|
4e9abfdee4 | ||
|
|
3bb5fbf533 | ||
|
|
cadccc3060 | ||
|
|
65196097f6 | ||
|
|
8e22e0260e | ||
|
|
de7da421b3 | ||
|
|
a9f7957550 | ||
|
|
bd2d44eecf | ||
|
|
bd05aed070 | ||
|
|
ce8f1e4015 | ||
|
|
58488e78f9 | ||
|
|
29116593ba | ||
|
|
51f0e1a52f | ||
|
|
c086962302 | ||
|
|
c0daf437f7 | ||
|
|
8eaeba35f5 | ||
|
|
4a44865a8c | ||
|
|
725fe0aa32 | ||
|
|
08adc18a68 | ||
|
|
1fcf4b6ce6 | ||
|
|
7c8ae9cfcb | ||
|
|
0cd5fccfad | ||
|
|
53ee187443 | ||
|
|
4577444c44 | ||
|
|
1cb3199e5c | ||
|
|
25c3024a89 | ||
|
|
ae0d5eb7c2 | ||
|
|
b8df000c8f | ||
|
|
eb1ec2f231 | ||
|
|
b65508995c | ||
|
|
2a7dbf0571 | ||
|
|
0dc6f4a45b | ||
|
|
2534b1b3b2 | ||
|
|
a11602d066 | ||
|
|
bec066bcb5 | ||
|
|
ef5a2b4baa | ||
|
|
9e273220b6 | ||
|
|
d55ab6d4e6 | ||
|
|
1a7c4e89ef | ||
|
|
c84a5e62f5 | ||
|
|
6978cca17d | ||
|
|
0e3016bfae | ||
|
|
d50b2d7e65 | ||
|
|
941e4210c6 | ||
|
|
3b1d3fcee6 | ||
|
|
81fd628292 | ||
|
|
f9dd0996ca | ||
|
|
87ceaed4be | ||
|
|
0e1721b130 | ||
|
|
c47d2eba4d | ||
|
|
1db4ce12d4 | ||
|
|
6c43e20e7a | ||
|
|
b2ecffb0c8 | ||
|
|
a953f71752 | ||
|
|
c5a53d6911 | ||
|
|
bcda16df1d | ||
|
|
d937668dc1 | ||
|
|
8279120e0a | ||
|
|
243beffa4f | ||
|
|
3a76d69a16 | ||
|
|
5b41675f33 |
24
.github/ISSUE_TEMPLATE/bug-report.md
vendored
Normal file
24
.github/ISSUE_TEMPLATE/bug-report.md
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
---
|
||||
name: Bug Report
|
||||
about: Create a report to help us improve
|
||||
title: ''
|
||||
labels: investigate
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
Note: Not all sections may be relevant, but please be as thorough while remaining concise as possible. Remove this Notice and any sections that don't feel pertinent.
|
||||
|
||||
If you are unsure if something is a bug, start a thread in the *"discussions"* tab above..
|
||||
|
||||
**Describe the bug**
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**Reproduction steps**
|
||||
Please include code snippets, with console.log output, any contract ABI, contract address, network and the full error.
|
||||
|
||||
**Environment:**
|
||||
Please include anything that may be useful in diagnosing the issue. Node vs Browser? Geth vs Parity vs Ganache? Third Party tools, like Hardhat? Mobile vs. Desktop?
|
||||
|
||||
**Search Terms**
|
||||
Often similar issues have come up before. Include any search terms you have tried in this repository's Issues (including closed issues) and *"Discussions"*, so if there are matching issues, we can be sure to add those keywords and link this issue to it, making it easier for people to find in the future.
|
||||
1
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
1
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
@@ -0,0 +1 @@
|
||||
blank_issues_enabled: false
|
||||
16
.github/ISSUE_TEMPLATE/documentation.md
vendored
Normal file
16
.github/ISSUE_TEMPLATE/documentation.md
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
---
|
||||
name: Documentation
|
||||
about: Documentation request or suggestion
|
||||
title: ''
|
||||
labels: documentation
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
Please include anything about the [documentation](https://docs.ethers.io) you would like to see improved.
|
||||
|
||||
- Missing information or details?
|
||||
- Wrong Information?
|
||||
- Dead or wrong links?
|
||||
- Something needs code examples?
|
||||
- General feedback or anything else?
|
||||
22
.github/ISSUE_TEMPLATE/feature-request.md
vendored
Normal file
22
.github/ISSUE_TEMPLATE/feature-request.md
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
---
|
||||
name: Feature Request
|
||||
about: Suggest a new feature for ethers
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
Note: The best place to start a Feature Request is usually in the Discussions, to mull through the desired feature, current options and think through the impact on the library overall.
|
||||
|
||||
**Is your feature request related to a problem? Please describe.**
|
||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||
|
||||
**Describe the solution you'd like**
|
||||
A clear and concise description of what you want to happen.
|
||||
|
||||
**Describe alternatives you've considered**
|
||||
A clear and concise description of any alternative solutions or features you've considered.
|
||||
|
||||
**Additional context**
|
||||
Add any other context or screenshots about the feature request here.
|
||||
16
.github/ISSUE_TEMPLATE/other.md
vendored
Normal file
16
.github/ISSUE_TEMPLATE/other.md
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
---
|
||||
name: Other
|
||||
about: Something else
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
Generally this issue template should be used.
|
||||
|
||||
If your issue is **not** a **Feature Request**, a **Bug Report** or problem with the **Documentation** you should probably be using the *"Discussion"* tab at the top.
|
||||
|
||||
But for truly exceptional issues, please include the details here.
|
||||
|
||||
Please also include any search terms you used when searching issues and discussions, so we can better tag those in the future.
|
||||
85
CHANGELOG.md
85
CHANGELOG.md
@@ -3,6 +3,91 @@ Changelog
|
||||
|
||||
This change log is managed by `admin/cmds/update-versions` but may be manually updated.
|
||||
|
||||
ethers/v5.3.0 (2021-05-31 18:41)
|
||||
--------------------------------
|
||||
|
||||
- Added MinInt256 and MaxInt256 constants. ([#1576](https://github.com/ethers-io/ethers.js/issues/1576); [bfcd05f](https://github.com/ethers-io/ethers.js/commit/bfcd05fcbb132d456d6f22f70c8ac9cf5b1826f7))
|
||||
- Version bumps for bn.js and hash.js to match elliptic and fix some build tools. ([#1478](https://github.com/ethers-io/ethers.js/issues/1478); [819b1ac](https://github.com/ethers-io/ethers.js/commit/819b1ace5c9b16e29dc354ad80e0e5b71ac63c52))
|
||||
- Removed Hangul checks in shims which crashes Android. ([#1519](https://github.com/ethers-io/ethers.js/issues/1519); [4b33114](https://github.com/ethers-io/ethers.js/commit/4b331148d980e3056ceaabdcd6e50a2aa1beb40d))
|
||||
- Fixed ENS namehash with leading and trailing dots. ([#1605](https://github.com/ethers-io/ethers.js/issues/1605); [7adcf3b](https://github.com/ethers-io/ethers.js/commit/7adcf3b154669d9d1a0a66d5e15dabfbf6618180))
|
||||
- Fixed broken variable in template string. ([#1624](https://github.com/ethers-io/ethers.js/issues/1624), [#1626](https://github.com/ethers-io/ethers.js/issues/1626); [630656e](https://github.com/ethers-io/ethers.js/commit/630656e949a8ffd940e4b66ec93ec07cd6ec2634))
|
||||
- Fixed FixedNumber rounding for non-default formats. ([#1629](https://github.com/ethers-io/ethers.js/issues/1629); [8681cd5](https://github.com/ethers-io/ethers.js/commit/8681cd59698d02d040871aa889fc6ccc8550df98))
|
||||
- Update ws dependency version to fix security. ([#1633](https://github.com/ethers-io/ethers.js/issues/1633), [#1634](https://github.com/ethers-io/ethers.js/issues/1634); [470551e](https://github.com/ethers-io/ethers.js/commit/470551e4ee3f1e343a26fc0775f9d9f7489129f8))
|
||||
|
||||
ethers/v5.2.0 (2021-05-17 16:18)
|
||||
--------------------------------
|
||||
|
||||
- More aggresively check for mempool transactions sent from JsonRpcSigner. ([3316468](https://github.com/ethers-io/ethers.js/commit/3316468e3e0a5925cbecad85d894cc7d622394e7))
|
||||
- Added initial support for detecting replacement transactions. ([#1477](https://github.com/ethers-io/ethers.js/issues/1477); [987bec8](https://github.com/ethers-io/ethers.js/commit/987bec87afaa365f291290a0136cedbc2b1992f2), [5144acf](https://github.com/ethers-io/ethers.js/commit/5144acf456b51c95bbe3950bd37609abecc7ebc7))
|
||||
- Added convenience method for HD path derivation. ([aadc5cd](https://github.com/ethers-io/ethers.js/commit/aadc5cd3d65421e13ebd4e4d7c293ac3ece5e178))
|
||||
- Added mnemonicPath option to cli. ([6e08809](https://github.com/ethers-io/ethers.js/commit/6e088099adabd7c5d2e6710062ebc62b316ba0f1))
|
||||
- Added some popular Ethereum-compatible chains to networks. ([b6370f1](https://github.com/ethers-io/ethers.js/commit/b6370f13600a0c444342cbf16a83f010a929976b))
|
||||
- Added debug event to Web3Provider. ([26464c5](https://github.com/ethers-io/ethers.js/commit/26464c54258f98c321638475d6cf11595186e76d))
|
||||
- Abstracted EtherscanProivder to more easily fascilitate other Etherscan-supported chains. ([#1204](https://github.com/ethers-io/ethers.js/issues/1204), [#1473](https://github.com/ethers-io/ethers.js/issues/1473); [37a9c77](https://github.com/ethers-io/ethers.js/commit/37a9c77ab2acb7f75e1fc4cc918810d2fe59dd76))
|
||||
- Added Custom Contract Errors. ([#1498](https://github.com/ethers-io/ethers.js/issues/1498); [6519609](https://github.com/ethers-io/ethers.js/commit/65196097f6626401638d85cf19e3d628a6223d5d), [483d67f](https://github.com/ethers-io/ethers.js/commit/483d67f55c15a76bcd853e889a0e35815d9850f7))
|
||||
- More flexible FixedNumber input and output for strings with no decimals. ([#1019](https://github.com/ethers-io/ethers.js/issues/1019), [#1291](https://github.com/ethers-io/ethers.js/issues/1291), [#1463](https://github.com/ethers-io/ethers.js/issues/1463); [a9cdbe1](https://github.com/ethers-io/ethers.js/commit/a9cdbe1238c149a7167c6bb1a78f314805b52755))
|
||||
- Added hex support for bigint. ([#1472](https://github.com/ethers-io/ethers.js/issues/1472); [4e9abfd](https://github.com/ethers-io/ethers.js/commit/4e9abfdee478a8423da4d55feea8c1aae78a8eb4))
|
||||
- Added support for null entries in EventFilter. ([#1499](https://github.com/ethers-io/ethers.js/issues/1499); [3bb5fbf](https://github.com/ethers-io/ethers.js/commit/3bb5fbf533107e880377ecc14f30f314a5028e56))
|
||||
- Add bigint to allowed BigNumberish types. ([#1472](https://github.com/ethers-io/ethers.js/issues/1472); [cadccc3](https://github.com/ethers-io/ethers.js/commit/cadccc3060b88ab2ca64aeb302717d2d1c95a897))
|
||||
- Minor version bump. ([8e22e02](https://github.com/ethers-io/ethers.js/commit/8e22e0260eb70713c943c9e99ee8d66d71ebe56d))
|
||||
|
||||
ethers/v5.1.4 (2021-04-22 06:33)
|
||||
--------------------------------
|
||||
|
||||
- Do not throw on ABI "error" type. ([#1493](https://github.com/ethers-io/ethers.js/issues/1493), [#1497](https://github.com/ethers-io/ethers.js/issues/1497); [bd05aed](https://github.com/ethers-io/ethers.js/commit/bd05aed070ac9e1421a3e2bff2ceea150bedf9b7))
|
||||
|
||||
ethers/v5.1.3 (2021-04-19 21:01)
|
||||
--------------------------------
|
||||
|
||||
- Fixed JsonRpcProvider event-loop caching when using any network. ([#1484](https://github.com/ethers-io/ethers.js/issues/1484); [58488e7](https://github.com/ethers-io/ethers.js/commit/58488e78f9ef79715693e19b42663335aad88c03))
|
||||
- Updated experimental Eip1193Bridge to support final EIP-1193 API. ([2911659](https://github.com/ethers-io/ethers.js/commit/29116593ba6c9c0fa491b13787cca8b233d4218c))
|
||||
- Fail early for ABI decoding that will obviously run out of data. ([#1486](https://github.com/ethers-io/ethers.js/issues/1486); [51f0e1a](https://github.com/ethers-io/ethers.js/commit/51f0e1a52fb885e6f146f7b3b70ed487fd1c8f5a))
|
||||
- Fixed BigNumber toBigInt return type. ([#1485](https://github.com/ethers-io/ethers.js/issues/1485); [c086962](https://github.com/ethers-io/ethers.js/commit/c0869623024bbf3671938dad03b131ff2ac54345))
|
||||
|
||||
ethers/v5.1.2 (2021-04-18 19:31)
|
||||
--------------------------------
|
||||
|
||||
- Increase provider tests gas price for sending a transaction. ([8eaeba3](https://github.com/ethers-io/ethers.js/commit/8eaeba35f550c3d9aa1ae62eb8d8e0c912818f7f))
|
||||
- Fixed run-checking non-filter Contract events. ([#1458](https://github.com/ethers-io/ethers.js/issues/1458); [4a44865](https://github.com/ethers-io/ethers.js/commit/4a44865a8c22adb9c55d5c37a81ee46ebc68228c))
|
||||
|
||||
ethers/v5.1.1 (2021-04-18 02:47)
|
||||
--------------------------------
|
||||
|
||||
- Increased sendTransaction timeout to 15 minutes and pull Pocket from tx tests. ([08adc18](https://github.com/ethers-io/ethers.js/commit/08adc18a68bdc730633bdaaf2329014a84c12b2b))
|
||||
- Export Eip1193Bridge in experimental package. ([1fcf4b6](https://github.com/ethers-io/ethers.js/commit/1fcf4b6ce6922d2bcb245375c967da3072f113ed))
|
||||
- Prevent non-typed transactions from unsafely ignoring specified access lists. ([#1364](https://github.com/ethers-io/ethers.js/issues/1364); [4577444](https://github.com/ethers-io/ethers.js/commit/4577444c448f41114263077c5b54fbe6af749fd4))
|
||||
- Update tests for current EIP-2930 support across backends. ([#1364](https://github.com/ethers-io/ethers.js/issues/1364); [1cb3199](https://github.com/ethers-io/ethers.js/commit/1cb3199e5cb01f5a55eb00ab6c7904606d7ea1dd))
|
||||
- Removed underscore from the JsonRpcBatchProvider name. ([#62](https://github.com/ethers-io/ethers.js/issues/62), [#656](https://github.com/ethers-io/ethers.js/issues/656), [#892](https://github.com/ethers-io/ethers.js/issues/892); [ae0d5eb](https://github.com/ethers-io/ethers.js/commit/ae0d5eb7c2e37a003d893671db59c2d5719aea0f))
|
||||
- Added better error detection when pre-EIP-155 transactions are disabled. ([b8df000](https://github.com/ethers-io/ethers.js/commit/b8df000c8f0ccd252b6049ac5a32a986d5a8e08d))
|
||||
- Fix Android React Native environment shims which crash on normalizing Korean test. ([#1298](https://github.com/ethers-io/ethers.js/issues/1298); [eb1ec2f](https://github.com/ethers-io/ethers.js/commit/eb1ec2f2318e2851073ea1634e5003cdb53f1c1b))
|
||||
- Fixed EIP-2930 transactions for EtherscanProvider. ([#1364](https://github.com/ethers-io/ethers.js/issues/1364); [b655089](https://github.com/ethers-io/ethers.js/commit/b65508995ce7d02f109a970ebeb625819beb915a))
|
||||
- Re-enable AlchemyProvider Berlin tests. ([bec066b](https://github.com/ethers-io/ethers.js/commit/bec066bcb5ab8b95a7e7ce4848d7b76d7f248ccc))
|
||||
- Added experimental _JsonRpcBatchProvider. ([#62](https://github.com/ethers-io/ethers.js/issues/62), [#656](https://github.com/ethers-io/ethers.js/issues/656), [#892](https://github.com/ethers-io/ethers.js/issues/892); [d55ab6d](https://github.com/ethers-io/ethers.js/commit/d55ab6d4e6025c484cc7e64486d927bd54a0772b))
|
||||
- Cache JsonRpcProvider requests for certain methods per event loop. ([#1371](https://github.com/ethers-io/ethers.js/issues/1371); [1a7c4e8](https://github.com/ethers-io/ethers.js/commit/1a7c4e89efecc2b8afc8bea4c1f8f75fdaac08c5))
|
||||
|
||||
ethers/v5.1.0 (2021-03-30 14:44)
|
||||
--------------------------------
|
||||
|
||||
- Added BigNumber.toBigInt method. ([#1415](https://github.com/ethers-io/ethers.js/issues/1415); [81fd628](https://github.com/ethers-io/ethers.js/commit/81fd628292b7dde90fe5115074fa68476a872dbf))
|
||||
- Abstracted Contract with BaseContract without meta-class properties for easier extensions. ([#1384](https://github.com/ethers-io/ethers.js/issues/1384); [87ceaed](https://github.com/ethers-io/ethers.js/commit/87ceaed4be21283619da74678cf371c228c918b7))
|
||||
- Fixed Contract properties that collide with null member properties. ([#1393](https://github.com/ethers-io/ethers.js/issues/1393); [0e1721b](https://github.com/ethers-io/ethers.js/commit/0e1721b13084dacf63089e47116f7d5331be4f36))
|
||||
- Added EIP-2930 support. ([#1364](https://github.com/ethers-io/ethers.js/issues/1364); [c47d2eb](https://github.com/ethers-io/ethers.js/commit/c47d2eba4dc741eb5cb754c3ef5064b8ea7ac7cc))
|
||||
- Added abstraction for EIP-2718 support. ([1db4ce1](https://github.com/ethers-io/ethers.js/commit/1db4ce12d49e235a7155de24ee153f409e7e7370))
|
||||
|
||||
ethers/v5.0.32 (2021-03-07 18:17)
|
||||
---------------------------------
|
||||
|
||||
- Bumped TypeScript to 4.2.2. ([#1288](https://github.com/ethers-io/ethers.js/issues/1288); [b2ecffb](https://github.com/ethers-io/ethers.js/commit/b2ecffb0c8d44c8ee65199e7866dc744abae4e6e))
|
||||
- Fixed shims from not displaying debug information. ([a953f71](https://github.com/ethers-io/ethers.js/commit/a953f717523a844a3a45810a5acc6630383884d3))
|
||||
- Force TypedData numbers to be in decimal. ([#1193](https://github.com/ethers-io/ethers.js/issues/1193); [c5a53d6](https://github.com/ethers-io/ethers.js/commit/c5a53d6911d7c41dd03a290b550e80f2919e9379))
|
||||
|
||||
ethers/v5.0.31 (2021-02-12 19:04)
|
||||
---------------------------------
|
||||
|
||||
- Prevent unhandled rejections when passing nullish into Contract constructor. ([#1234](https://github.com/ethers-io/ethers.js/issues/1234); [d937668](https://github.com/ethers-io/ethers.js/commit/d937668dc1d39cc293f64bbd30b99b29614d1607))
|
||||
- Better error messaging when provider backends give bogus responses. ([#1243](https://github.com/ethers-io/ethers.js/issues/1243); [8279120](https://github.com/ethers-io/ethers.js/commit/8279120e0ad1cbb7aeabd32c08e168a4228abbec))
|
||||
- Prevent unconfigured ENS names from making an init tx. ([#1290](https://github.com/ethers-io/ethers.js/issues/1290); [243beff](https://github.com/ethers-io/ethers.js/commit/243beffa4f83c910f5f1c5e0554531e5dcf3ab93))
|
||||
|
||||
ethers/v5.0.30 (2021-02-08 15:22)
|
||||
---------------------------------
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ Installing
|
||||
**browser (UMD)**
|
||||
|
||||
```
|
||||
<script src="https://cdn.ethers.io/lib/ethers-5.0.umd.min.js" type="text/javascript">
|
||||
<script src="https://cdn.ethers.io/lib/ethers-5.1.umd.min.js" type="text/javascript">
|
||||
</script>
|
||||
```
|
||||
|
||||
@@ -52,7 +52,7 @@ Installing
|
||||
|
||||
```
|
||||
<script type="module">
|
||||
import { ethers } from "https://cdn.ethers.io/lib/ethers-5.0.umd.min.js";
|
||||
import { ethers } from "https://cdn.ethers.io/lib/ethers-5.1.esm.min.js";
|
||||
</script>
|
||||
```
|
||||
|
||||
|
||||
@@ -8,15 +8,15 @@ to be run with the input of the transaction data.
|
||||
|
||||
_subsection: Creating Instances @<Contract--creating>
|
||||
|
||||
_property: new ethers.Contract(address, abi, signerOrProvider) @src<contracts:constructor.Contract>
|
||||
_property: new ethers.Contract(address, abi, signerOrProvider) @src<contracts:class.Contract>
|
||||
|
||||
_property: contract.attach(addressOrName) => [[Contract]] @<Contract-attach> @SRC<contracts:Contract.attach>
|
||||
_property: contract.attach(addressOrName) => [[Contract]] @<Contract-attach> @SRC<contracts:BaseContract.attach>
|
||||
Returns a new instance of the **Contract** attached to a new
|
||||
address. This is useful if there are multiple similar or identical
|
||||
copies of a Contract on the network and you wish to interact with
|
||||
each of them.
|
||||
|
||||
_property: contract.connect(providerOrSigner) => [[Contract]] @<Contract-connect> @SRC<contracts:Contract.connect>
|
||||
_property: contract.connect(providerOrSigner) => [[Contract]] @<Contract-connect> @SRC<contracts:BaseContract.connect>
|
||||
Returns a new instance of the Contract, but connected to
|
||||
//providerOrSigner//.
|
||||
|
||||
@@ -65,11 +65,11 @@ _subsection: Events @<Contract--events>
|
||||
_property: contract.queryFilter(event [ , fromBlockOrBlockHash [ , toBlock ]) => Promise<Array<Event>> @<Contract-queryFilter> @SRC<contracts>
|
||||
Return Events that match the //event//.
|
||||
|
||||
_property: contract.listenerCount([ event ]) => number @<Contract-listenerCount> @SRC<contracts:Contract.listenerCount>
|
||||
_property: contract.listenerCount([ event ]) => number @<Contract-listenerCount> @SRC<contracts:BaseContract.listenerCount>
|
||||
Return the number of listeners that are subscribed to //event//. If
|
||||
no event is provided, returns the total count of all events.
|
||||
|
||||
_property: contract.listeners(event) => Array<Listener> @<Contract-listeners> @SRC<contracts:Contract.listeners>
|
||||
_property: contract.listeners(event) => Array<Listener> @<Contract-listeners> @SRC<contracts:BaseContract.listeners>
|
||||
Return a list of listeners that are subscribed to //event//.
|
||||
|
||||
_property: contract.off(event, listener) => this @<Contract-off> @SRC<contracts>
|
||||
@@ -82,7 +82,7 @@ _property: contract.once(event, listener) => this @<Contract-once> @SRC<contrac
|
||||
Subscribe once to //event// calling //listener// when the event
|
||||
occurs.
|
||||
|
||||
_property: contract.removeAllListeners([ event ]) => this @<Contract-removeAllListeners> @SRC<contracts:Contract.removeAllListeners>
|
||||
_property: contract.removeAllListeners([ event ]) => this @<Contract-removeAllListeners> @SRC<contracts:BaseContract.removeAllListeners>
|
||||
Unsubscribe all listeners for //event//. If no event is provided,
|
||||
all events are unsubscribed.
|
||||
|
||||
@@ -120,6 +120,13 @@ number is used. Otherwise a [[BigNumber]] is returned.
|
||||
|
||||
For bytes (both fixed length and dynamic), a [[DataHexString]] is returned.
|
||||
|
||||
If the call reverts (or runs out of gas), a [CALL_EXCEPTION](errors--call-exception)
|
||||
will be thrown which will include:
|
||||
|
||||
- ``error.address`` - the contract address
|
||||
- ``error.args`` - the arguments passed into the method
|
||||
- ``error.transaction`` - the transaction
|
||||
|
||||
The //overrides// object for a read-only method may include any of:
|
||||
|
||||
- ``overrides.from`` - the ``msg.sender`` (or ``CALLER``) to use during the
|
||||
|
||||
@@ -136,7 +136,7 @@ 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.
|
||||
|
||||
_property: erc20.getBalance(owner [, overrides ]) => Promise<[[BigNumber]]>
|
||||
_property: erc20.balanceOf(owner [, overrides ]) => Promise<[[BigNumber]]>
|
||||
Returns the balance of //owner// for this ERC-20 token.
|
||||
|
||||
_property: erc20.symbol([ overrides ]) => Promise<string>
|
||||
|
||||
@@ -202,7 +202,18 @@ The chain ID this transaction is authorized on, as specified by
|
||||
If the chain ID is 0 will disable EIP-155 and the transaction will be valid
|
||||
on any network. This can be **dangerous** and care should be taken, since it
|
||||
allows transactions to be replayed on networks that were possibly not
|
||||
intended.
|
||||
intended. Intentionally-replayable transactions are also disabled by default
|
||||
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.
|
||||
|
||||
_property: transactionRequest.accessList => [[providers-AccessListish]]
|
||||
|
||||
The [[providers-AccessList]] to include in an [[link-eip-2930]] transaction, which will
|
||||
include a ``type`` of ``1``.
|
||||
|
||||
_heading: TransactionResponse @<providers-TransactionResponse> @INHERIT<[[Transaction]]>
|
||||
|
||||
@@ -241,6 +252,16 @@ the following properties:
|
||||
- ``error.transactionHash`` - the hash of the transaction
|
||||
- ``error.receipt`` - the actual receipt, with the status of ``0``
|
||||
|
||||
_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.accessList => [[providers-AccessList]]
|
||||
|
||||
The [[providers-AccessList]] included in an [[link-eip-2930]] transaction, which will
|
||||
also have its ``type`` equal to ``1``.
|
||||
|
||||
_heading: TransactionReceipt @<providers-TransactionReceipt>
|
||||
|
||||
_property: receipt.to => string<[[address]]>
|
||||
@@ -314,3 +335,110 @@ _property: receipt.status => boolean
|
||||
The status of a transaction is 1 is successful or 0 if it was
|
||||
reverted. Only transactions included in blocks [post-Byzantium Hard Fork](link-eip-609)
|
||||
have this property.
|
||||
|
||||
_subsection: Access Lists
|
||||
|
||||
An Access List is optional an includes a list of addresses and storage
|
||||
slots for that address which should be //warmed// or pre-fetched for
|
||||
use within the execution of this transaction. A //warmed// value has an
|
||||
additional upfront cost to access, but is discounted throughout the code
|
||||
execution for reading and writing.
|
||||
|
||||
_heading: AccessListish @<providers-AccessListish>
|
||||
|
||||
A looser description of an [[providers-AccessList]], which will be
|
||||
converted internally using [accessListify](utils-accessListify).
|
||||
|
||||
|
||||
It may be any of:
|
||||
|
||||
- any [[providers-AccessList]]
|
||||
- an Array of 2-element Arrays, where the first element is the address
|
||||
and second array is an array of storage keys
|
||||
- an object, whose keys represent the addresses and each value is an
|
||||
array of storage keys
|
||||
|
||||
When using the object form (the last option), the addresses and storage
|
||||
slots will be sorted. If an explicit order for the access list is
|
||||
required, one of the other forms must be used. Most developers
|
||||
**do not** require explicit order.
|
||||
|
||||
_code: equivalent to the AccessList example below @lang<javascript>
|
||||
|
||||
// Option 1:
|
||||
// AccessList
|
||||
// see below
|
||||
|
||||
// Option 2:
|
||||
// Array< [ Address, Array<Bytes32> ] >
|
||||
[
|
||||
[
|
||||
"0x0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",
|
||||
[
|
||||
"0x0000000000000000000000000000000000000000000000000000000000000004",
|
||||
"0x0bcad17ecf260d6506c6b97768bdc2acfb6694445d27ffd3f9c1cfbee4a9bd6d"
|
||||
]
|
||||
],
|
||||
[
|
||||
"0x5FfC014343cd971B7eb70732021E26C35B744cc4",
|
||||
[
|
||||
"0x0000000000000000000000000000000000000000000000000000000000000001"
|
||||
]
|
||||
]
|
||||
]
|
||||
// <hide>
|
||||
;
|
||||
// </hide>
|
||||
|
||||
// Option 3:
|
||||
// Record<Address, Array<Bytes32>>
|
||||
// <hide>
|
||||
(
|
||||
// </hide>
|
||||
{
|
||||
"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e": [
|
||||
"0x0000000000000000000000000000000000000000000000000000000000000004",
|
||||
"0x0bcad17ecf260d6506c6b97768bdc2acfb6694445d27ffd3f9c1cfbee4a9bd6d"
|
||||
],
|
||||
"0x5FfC014343cd971B7eb70732021E26C35B744cc4": [
|
||||
"0x0000000000000000000000000000000000000000000000000000000000000001"
|
||||
]
|
||||
}
|
||||
// <hide>
|
||||
)
|
||||
// </hide>
|
||||
|
||||
|
||||
_heading: AccessList @<providers-AccessList>
|
||||
|
||||
An [[link-eip-2930]] transaction allows an optional **AccessList**
|
||||
which causes a transaction to //warm// (i.e. pre-cache) another
|
||||
addresses state and the specified storage keys.
|
||||
|
||||
This incurs an increased intrinsic cost for the transaction, but provides
|
||||
discounts for storage and state access throughout the execution of the
|
||||
transaction.
|
||||
|
||||
_code: example access list
|
||||
|
||||
// Array of objects with the form:
|
||||
// {
|
||||
// address: Address,
|
||||
// storageKey: Array< DataHexString< 32 > >
|
||||
// }
|
||||
|
||||
[
|
||||
{
|
||||
address: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",
|
||||
storageKeys: [
|
||||
"0x0000000000000000000000000000000000000000000000000000000000000004",
|
||||
"0x0bcad17ecf260d6506c6b97768bdc2acfb6694445d27ffd3f9c1cfbee4a9bd6d"
|
||||
]
|
||||
},
|
||||
{
|
||||
address: "0x5FfC014343cd971B7eb70732021E26C35B744cc4",
|
||||
storageKeys: [
|
||||
"0x0000000000000000000000000000000000000000000000000000000000000001"
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
@@ -97,6 +97,15 @@ used to encode the chain ID into the serialized transaction.
|
||||
|
||||
_subsection: Functions @<transactions--functions>
|
||||
|
||||
_property: ethers.utils.accessListify(anAcceslistish) => [[providers-AccessList]] @<utils-accessListify> @SRC<transactions:accessListify>
|
||||
Normalizes the [[providers-AccessListish]] //anAccessListish// into
|
||||
an [[providers-AccessList]].
|
||||
|
||||
This is useful for other utility functions which wish to remain
|
||||
flexible as to the input parameter for access lists, such as
|
||||
when creating a [[Signer]] which needs to manipulate a possibly
|
||||
typed transaction envelope.
|
||||
|
||||
_property: ethers.utils.parseTransaction(aBytesLike) => [[Transaction]] @<utils-parseTransaction> @SRC<transactions:parse>
|
||||
Parses the transaction properties from a serialized transaction.
|
||||
|
||||
|
||||
@@ -164,7 +164,7 @@ _subsection: Solidity Topics @<events-solidity>
|
||||
This is a quick (and non-comprehensive) overview of how events are computed
|
||||
in Solidity.
|
||||
|
||||
This is likely out of the scope for most developers, but may be intersting
|
||||
This is likely out of the scope for most developers, but may be interesting
|
||||
to those who want to learn a bit more about the underlying technology.
|
||||
|
||||
Solidity provides two types of events, anonymous and non-anonymous. The
|
||||
|
||||
@@ -161,7 +161,7 @@ function codeContextify(context) {
|
||||
|
||||
module.exports = {
|
||||
title: "ethers",
|
||||
subtitle: "v5.0",
|
||||
subtitle: "v5.2",
|
||||
description: "Documentation for ethers, a complete, tiny and simple Ethereum library.",
|
||||
logo: "logo.svg",
|
||||
|
||||
@@ -204,7 +204,8 @@ module.exports = {
|
||||
"link-rtd": "https:/\/github.com/readthedocs/sphinx_rtd_theme",
|
||||
"link-semver": { name: "semver", url: "https:/\/semver.org" },
|
||||
"link-solidity": { name: "Solidity" , url: "https:/\/solidity.readthedocs.io/" },
|
||||
"link-solidity-events": "https:/\/docs.soliditylang.org/en/v0.8.1/abi-spec.html#events",
|
||||
"link-solidity-errors": "https:/\/docs.soliditylang.org/en/v0.8.4/abi-spec.html#errors",
|
||||
"link-solidity-events": "https:/\/docs.soliditylang.org/en/v0.8.4/abi-spec.html#events",
|
||||
"link-sphinx": { name: "Sphinx", url: "https:/\/www.sphinx-doc.org/" },
|
||||
|
||||
"link-alchemy-signup": "https:/\/dashboard.alchemyapi.io/signup?referral=55a35117-028e-4b7c-9e47-e275ad0acc6d",
|
||||
@@ -246,7 +247,7 @@ module.exports = {
|
||||
|
||||
"link-ethersio": "https:/\/ethers.io/",
|
||||
"link-ethers-docs": "https:/\/docs.ethers.io/",
|
||||
"link-ethers-js": "https:/\/cdn.ethers.io/lib/ethers-5.0.esm.min.js",
|
||||
"link-ethers-js": "https:/\/cdn.ethers.io/lib/ethers-5.1.esm.min.js",
|
||||
"link-ethers-npm": "https:/\/www.npmjs.com/search?q=%40ethersproject%2F",
|
||||
"link-ethers-asm-grammar": "https:/\/github.com/ethers-io/ethers.js/blob/master/packages/asm/grammar.jison",
|
||||
|
||||
@@ -260,6 +261,8 @@ module.exports = {
|
||||
"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" },
|
||||
"link-eip-2718": { name: "EIP-2718", url: "https:/\/eips.ethereum.org/EIPS/eip-2718" },
|
||||
"link-eip-2930": { name: "EIP-2930", url: "https:/\/eips.ethereum.org/EIPS/eip-2930" },
|
||||
"link-bip-39": { name: "BIP-39", url: "https:/\/en.bitcoin.it/wiki/BIP_0039" },
|
||||
"link-bip-32": { name: "BIP-32", url: "https:/\/github.com/bitcoin/bips/blob/master/bip-0032.mediawiki" },
|
||||
"link-bip-44": { name: "BIP-44", url: "https:/\/en.bitcoin.it/wiki/BIP_0044" },
|
||||
|
||||
@@ -101,7 +101,7 @@ with Ethereum and is available in all major Ethereum node implementations
|
||||
third-party web services (e.g. [[link-infura]]). It typically provides:
|
||||
|
||||
- A connection to the Ethereum network (a [[Provider]])
|
||||
- Holds your private key and can sign thing (a [[Signer]])
|
||||
- Holds your private key and can sign things (a [[Signer]])
|
||||
|
||||
_code: Connecting to an RPC client @lang<script>
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ of uses.
|
||||
|
||||
_heading: MIT License
|
||||
|
||||
//Copyright © 2019 [Richard Moore](mailto:me@ricmoo.com).//
|
||||
//Copyright © 2019-2021 [Richard Moore](mailto:me@ricmoo.com).//
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
1
docs/api-keys/redirects.txt
Normal file
1
docs/api-keys/redirects.txt
Normal file
@@ -0,0 +1 @@
|
||||
index.html => /v5/api-keys
|
||||
9
docs/errors/redirects.txt
Normal file
9
docs/errors/redirects.txt
Normal file
@@ -0,0 +1,9 @@
|
||||
server-error => /v5/api/utils/logger/#errors--server-error
|
||||
unsupported-operation => /v5/api/utils/logger/#errors--unsupported-operation
|
||||
numeric-fault => /v5/api/utils/logger/#errors--numeric-fault
|
||||
call-exception => /v5/api/utils/logger/#errors--numeric-fault
|
||||
insufficient-funds => /v5/api/utils/logger/#errors--insufficient-funds
|
||||
nonce-expired => /v5/api/utils/logger/#errors--nonce-expired
|
||||
replacement-underpriced => /v5/api/utils/logger/#errors--replacement-underpriced
|
||||
unpredicatable-gas-limit => /v5/api/utils/logger/#errors--unpredicatable-gas-limit
|
||||
|
||||
BIN
docs/favicon.ico
Normal file
BIN
docs/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 25 KiB |
@@ -26,8 +26,8 @@ Developer Documentation
|
||||
* [Signing Messages](getting-started)
|
||||
* [Ethereum Basics](concepts)
|
||||
* [Events](concepts/events)
|
||||
* [Solidity Topics](concepts/events)
|
||||
* [Logs and Filtering](concepts/events)
|
||||
* [Solidity Topics](concepts/events)
|
||||
* [Gas](concepts/gas)
|
||||
* [Gas Price](concepts/gas)
|
||||
* [Gas Limit](concepts/gas)
|
||||
@@ -47,6 +47,7 @@ Developer Documentation
|
||||
* [Accounts Methods](api/providers/provider)
|
||||
* [Blocks Methods](api/providers/provider)
|
||||
* [Ethereum Naming Service (ENS) Methods](api/providers/provider)
|
||||
* [EnsResolver](api/providers/provider)
|
||||
* [Logs Methods](api/providers/provider)
|
||||
* [Network Status Methods](api/providers/provider)
|
||||
* [Transactions Methods](api/providers/provider)
|
||||
@@ -253,8 +254,10 @@ Developer Documentation
|
||||
* [Schemas](testing)
|
||||
* [Contributing and Hacking](contributing)
|
||||
* [Building](contributing)
|
||||
* [Making your changes](contributing)
|
||||
* [Documentation](contributing)
|
||||
* [Other Resources](other-resources)
|
||||
* [Ethereum Overview](other-resources)
|
||||
* [Tutorials](other-resources)
|
||||
* [Flatworm Docs](documentation)
|
||||
* [Fragments](documentation)
|
||||
* [Markdown](documentation)
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -12,6 +12,7 @@ Application Programming Interface
|
||||
* [Accounts Methods](providers/provider)
|
||||
* [Blocks Methods](providers/provider)
|
||||
* [Ethereum Naming Service (ENS) Methods](providers/provider)
|
||||
* [EnsResolver](providers/provider)
|
||||
* [Logs Methods](providers/provider)
|
||||
* [Network Status Methods](providers/provider)
|
||||
* [Transactions Methods](providers/provider)
|
||||
|
||||
@@ -12,14 +12,17 @@ Creating Instances
|
||||
|
||||
#### **new ***ethers* . **ContractFactory**( interface , bytecode [ , signer ] )
|
||||
|
||||
Creates a new instance of a **ContractFactory** for the contract described by the *interface* and *bytecode* initcode.
|
||||
|
||||
|
||||
#### *ContractFactory* . **fromSolidity**( compilerOutput [ , signer ] ) => *[ContractFactory](/v5/api/contract/contract-factory/)*
|
||||
|
||||
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.
|
||||
|
||||
|
||||
#### *contractFactory* . **connect**( signer ) => *[Contract](/v5/api/contract/contract/)*
|
||||
|
||||
Returns a **new instance** of the ContractFactory with the same *interface* and *bytecode*, but with a different *signer*.
|
||||
|
||||
|
||||
Properties
|
||||
@@ -27,14 +30,17 @@ Properties
|
||||
|
||||
#### *contractFactory* . **interface** => *[Interface](/v5/api/utils/abi/interface/)*
|
||||
|
||||
The [Contract](/v5/api/contract/contract/) interface.
|
||||
|
||||
|
||||
#### *contractFactory* . **bytecode** => *string< [DataHexString](/v5/api/utils/bytes/#DataHexString) >*
|
||||
|
||||
The bytecode (i.e. initcode) that this **ContractFactory** will use to deploy the Contract.
|
||||
|
||||
|
||||
#### *contractFactory* . **signer** => *[Signer](/v5/api/signer/#Signer)*
|
||||
|
||||
The [Signer](/v5/api/signer/#Signer) (if any) this ContractFactory will use to deploy instances of the Contract to the Blockchain.
|
||||
|
||||
|
||||
Methods
|
||||
@@ -45,49 +51,87 @@ Methods
|
||||
Return an instance of a [Contract](/v5/api/contract/contract/) attached to *address*. This is the same as using the [Contract constructor](/v5/api/contract/contract/#Contract--creating) with *address* and this the *interface* and *signerOrProvider* passed in when creating the ContractFactory.
|
||||
|
||||
|
||||
#### *contractFactory* . **getDeployTransaction**( ...args ) => *[UnsignedTransaction](/v5/api/utils/transactions/#UnsignedTransaction)*
|
||||
#### *contractFactory* . **getDeployTransaction**( ...args [ , overrides ] ) => *[UnsignedTransaction](/v5/api/utils/transactions/#UnsignedTransaction)*
|
||||
|
||||
Returns the unsigned transaction which would deploy this Contract with *args* passed to the Contract's constructor.
|
||||
|
||||
If the optional *overrides* is specified, they can be used to override the endowment `value`, transaction `nonce`, `gasLimit` or `gasPrice`.
|
||||
|
||||
#### *contractFactory* . **deploy**( ...args ) => *Promise< [Contract](/v5/api/contract/contract/) >*
|
||||
|
||||
#### *contractFactory* . **deploy**( ...args [ , overrides ] ) => *Promise< [Contract](/v5/api/contract/contract/) >*
|
||||
|
||||
Uses the signer to deploy the Contract with *args* passed into the constructor and returns a Contract which is attached to the address where this contract **will** be deployed once the transaction is mined.
|
||||
|
||||
The transaction can be found at `contract.deployTransaction`, and no interactions should be made until the transaction is mined.
|
||||
|
||||
If the optional *overrides* is specified, they can be used to override the endowment `value`, transaction `nonce`, `gasLimit` or `gasPrice`.
|
||||
|
||||
```
|
||||
// <hide>
|
||||
const signer = ethers.LocalSigner();
|
||||
const ContractFactory = ethers.ContractFactory;
|
||||
// </hide>
|
||||
|
||||
```javascript
|
||||
// If your contract constructor requires parameters, the ABI
|
||||
// must include the constructor
|
||||
const abi = [
|
||||
"constructor(address owner, uint256 initialValue)"
|
||||
"constructor(address owner, uint256 initialValue)",
|
||||
"function value() view returns (uint)"
|
||||
];
|
||||
|
||||
const factory = new ContractFactory(abi, bytecode, signer)
|
||||
// The factory we use for deploying contracts
|
||||
factory = new ContractFactory(abi, bytecode, signer)
|
||||
|
||||
const contract = await factory.deploy("ricmoo.eth", 42);
|
||||
// Deploy an instance of the contract
|
||||
contract = await factory.deploy("ricmoo.eth", 42);
|
||||
|
||||
// The address is available immediately, but the contract
|
||||
// is NOT deployed yet
|
||||
contract.address
|
||||
//!
|
||||
// '0x26E9685C018Bf3A401DFA632827e7e6C7D96b1C0'
|
||||
|
||||
// The transaction that the signer sent to deploy
|
||||
contract.deployTransaction
|
||||
//!
|
||||
// {
|
||||
// blockHash: null,
|
||||
// blockNumber: null,
|
||||
// chainId: 1337,
|
||||
// confirmations: 0,
|
||||
// creates: '0x26E9685C018Bf3A401DFA632827e7e6C7D96b1C0',
|
||||
// data: '0x608060405234801561001057600080fd5b5060405161012e38038061012e8339818101604052604081101561003357600080fd5b81019080805190602001909291908051906020019092919050505081600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508060008190555050506088806100a66000396000f3fe6080604052348015600f57600080fd5b506004361060285760003560e01c80633fa4f24514602d575b600080fd5b60336049565b6040518082815260200191505060405180910390f35b6000805490509056fea2646970667358221220926465385af0e8706644e1ff3db7161af699dc063beaadd55405f2ccd6478d7564736f6c63430007040033000000000000000000000000ab7c8803962c0f2f5bbbe3fa8bf41cd82aa1923c000000000000000000000000000000000000000000000000000000000000002a',
|
||||
// from: '0xf3e6942b256A60B596B24F633caE8aDB4983fCA6',
|
||||
// gasLimit: { BigNumber: "126462" },
|
||||
// gasPrice: { BigNumber: "1" },
|
||||
// hash: '0x4037630fdadbbe0aac0bf90eba61118e35ee5fc28329e2134bb2bad0bfc12684',
|
||||
// nonce: 1,
|
||||
// r: '0xc3bb79ea4600864cd110fe74d31d38bb3702c327fd5aef9feddf66903cc87a4f',
|
||||
// s: '0x35cc2ffe352c02b5fcfbbcd2e348001af670f64438d7a9b2c34756ec293a0784',
|
||||
// to: null,
|
||||
// transactionIndex: null,
|
||||
// v: 2709,
|
||||
// value: { BigNumber: "0" },
|
||||
// wait: [Function]
|
||||
// }
|
||||
|
||||
// Wait until the transaction is mined
|
||||
// Wait until the transaction is mined (i.e. contract is deployed)
|
||||
// - returns the receipt
|
||||
// - throws on failure (the reciept is on the error)
|
||||
contract.deployTransaction.wait()
|
||||
//!
|
||||
// { Promise: {
|
||||
// blockHash: '0x1715de2bdfec15a7f64fb79a8254699274be6776df244d24a04945a3218543e6',
|
||||
// blockNumber: 2,
|
||||
// byzantium: true,
|
||||
// confirmations: 1,
|
||||
// contractAddress: '0x26E9685C018Bf3A401DFA632827e7e6C7D96b1C0',
|
||||
// cumulativeGasUsed: { BigNumber: "126462" },
|
||||
// from: '0xf3e6942b256A60B596B24F633caE8aDB4983fCA6',
|
||||
// gasUsed: { BigNumber: "126462" },
|
||||
// logs: [],
|
||||
// logsBloom: '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
|
||||
// status: 1,
|
||||
// to: null,
|
||||
// transactionHash: '0x4037630fdadbbe0aac0bf90eba61118e35ee5fc28329e2134bb2bad0bfc12684',
|
||||
// transactionIndex: 0
|
||||
// } }
|
||||
|
||||
// Now the contract is safe to interact with
|
||||
contract.value()
|
||||
//!
|
||||
// { Promise: { BigNumber: "42" } }
|
||||
```
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -117,7 +117,7 @@ Meta-Class
|
||||
|
||||
#### *contract* . **METHOD_NAME**( ...args [ , overrides ] ) => *Promise< any >*
|
||||
|
||||
The type of the result depends on the ABI.
|
||||
The type of the result depends on the ABI. If the method returns a single value, it will be returned directly, otherwise a [Result](/v5/api/utils/abi/interface/#Result) object will 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 and booleans.
|
||||
|
||||
@@ -125,6 +125,16 @@ For numbers, if the **type** is in the JavaScript safe range (i.e. less than 53
|
||||
|
||||
For bytes (both fixed length and dynamic), a [DataHexString](/v5/api/utils/bytes/#DataHexString) is returned.
|
||||
|
||||
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
|
||||
- `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`); *most developers will not require this*
|
||||
- `overrides.gasLimit` - the amount of gas (theoretically) to allow a node to use during the execution of the code; since there is no transaction, there is not going to be any fee charged, but the EVM still processes gas metering so calls like `gasleft` (or `GAS`) report meaningful values
|
||||
- `overrides.blockTag` - a block tag to simulate the execution at, which can be used for hypothetical historic analysis; note that many backends do not support this, or may require paid plans to access as the node database storage and processing requirements are much higher
|
||||
|
||||
|
||||
|
||||
|
||||
#### *contract* . *functions* . **METHOD_NAME**( ...args [ , overrides ] ) => *Promise< [Result](/v5/api/utils/abi/interface/#Result) >*
|
||||
|
||||
@@ -136,6 +146,8 @@ Another use for this method is for error recovery. For example, if a function re
|
||||
|
||||
Most developers should not require this.
|
||||
|
||||
The *overrides* are identical to the read-only operations above.
|
||||
|
||||
|
||||
### Write Methods (non-constant)
|
||||
|
||||
@@ -143,6 +155,29 @@ Most developers should not require this.
|
||||
|
||||
Returns a [TransactionResponse](/v5/api/providers/types/#providers-TransactionResponse) for the transaction after it is sent to the network. This requires the **Contract** has a signer.
|
||||
|
||||
The *overrides* object for write methods may include any of:
|
||||
|
||||
- `overrides.gasPrice` - the price to pay per gas
|
||||
- `overrides.gasLimit` - the limit on the amount of gas to allow the transaction to consume; any unused gas is returned at the gasPrice
|
||||
- `overrides.value` - the amount of ether (in wei) to forward with the call
|
||||
- `overrides.nonce` - the nonce to use for the [Signer](/v5/api/signer/#Signer)
|
||||
|
||||
|
||||
|
||||
If the `wait()` method on the returned [TransactionResponse](/v5/api/providers/types/#providers-TransactionResponse) is called, there will be additional properties on the receipt:
|
||||
|
||||
- `receipt.events` - an array of the logs, with additional properties (if the ABI included a description for the events)
|
||||
- `receipt.events[n].args` - the parsed arguments
|
||||
- `receipt.events[n].decode` - a method that can be used to parse the log topics and data (this was used to compute `args`)
|
||||
- `receipt.events[n].event` - the name of the event
|
||||
- `receipt.events[n].eventSignature` - the full signature of the event
|
||||
- `receipt.removeListener()` - a method to remove the listener that trigger this event
|
||||
- `receipt.getBlock()` - a method to return the [Block](/v5/api/providers/types/#providers-Block) this event occurred in
|
||||
- `receipt.getTransaction()` - a method to return the [Transaction](/v5/api/providers/types/#providers-TransactionResponse) this event occurred in
|
||||
- `receipt.getTransactionReceipt()` - a method to return the [Transaction Receipt](/v5/api/providers/types/#providers-TransactionReceipt) this event occurred in
|
||||
|
||||
|
||||
|
||||
|
||||
### Write Methods Analysis
|
||||
|
||||
@@ -150,11 +185,15 @@ Returns a [TransactionResponse](/v5/api/providers/types/#providers-TransactionRe
|
||||
|
||||
Returns the estimate units of gas that would be required to execute the *METHOD_NAME* with *args* and *overrides*.
|
||||
|
||||
The *overrides* are identical to the overrides above for read-only or write methods, depending on the type of call of *METHOD_NAME*.
|
||||
|
||||
|
||||
#### *contract* . *populateTransaction* . **METHOD_NAME**( ...args [ , overrides ] ) => *Promise< [UnsignedTx](/v5/api/utils/transactions/#UnsignedTransaction) >*
|
||||
|
||||
Returns an [UnsignedTransaction](/v5/api/utils/transactions/#UnsignedTransaction) which represents the transaction that would need to be signed and submitted to the network to execute *METHOD_NAME* with *args* and *overrides*.
|
||||
|
||||
The *overrides* are identical to the overrides above for read-only or write methods, depending on the type of call of *METHOD_NAME*.
|
||||
|
||||
|
||||
#### *contract* . *callStatic* . **METHOD_NAME**( ...args [ , overrides ] ) => *Promise< any >*
|
||||
|
||||
@@ -164,6 +203,8 @@ This does not actually change any state, but is free. This in some cases can be
|
||||
|
||||
This otherwise functions the same as a [Read-Only Method](/v5/api/contract/contract/#Contract--readonly).
|
||||
|
||||
The *overrides* are identical to the read-only operations above.
|
||||
|
||||
|
||||
### Event Filters
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -48,7 +48,7 @@ Set the current transaction count (nonce) for the signer.
|
||||
This may be useful in interacting with the signer outside of using this class.
|
||||
|
||||
|
||||
#### *nonceManager* . **increaseTransactionCount**( [ count = 1 ] ) => *void*
|
||||
#### *nonceManager* . **incrementTransactionCount**( [ count = 1 ] ) => *void*
|
||||
|
||||
Bump the current transaction count (nonce) by *count*.
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -54,6 +54,7 @@ Provider Documentation
|
||||
* [Accounts Methods](provider)
|
||||
* [Blocks Methods](provider)
|
||||
* [Ethereum Naming Service (ENS) Methods](provider)
|
||||
* [EnsResolver](provider)
|
||||
* [Logs Methods](provider)
|
||||
* [Network Status Methods](provider)
|
||||
* [Transactions Methods](provider)
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -7,9 +7,11 @@ Documentation: [html](https://docs.ethers.io/)
|
||||
JsonRpcProvider
|
||||
===============
|
||||
|
||||
#### **new ***ethers* . *providers* . **JsonRpcProvider**( [ url [ , aNetworkish ] ] )
|
||||
#### **new ***ethers* . *providers* . **JsonRpcProvider**( [ urlOrConnectionInfo [ , networkish ] ] )
|
||||
|
||||
Connect to a JSON-RPC API located at *url* using the *aNetworkish* network. If *url* is not specified, the default (i.e. `http://localhost:8545`) is used and if no network is specified, it will be determined automatically by querying the node.
|
||||
Connect to a JSON-RPC HTTP API using the URL or [ConnectionInfo](/v5/api/utils/web/#ConnectionInfo) *urlOrConnectionInfo* connected to the *networkish* network.
|
||||
|
||||
If *urlOrConnectionInfo* is not specified, the default (i.e. `http://localhost:8545`) is used and if no network is specified, it will be determined automatically by querying the node using `eth_chaindId` and falling back on `eth_networkId`.
|
||||
|
||||
|
||||
#### Note: Connecting to a Local Node
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -36,7 +36,7 @@ The provider for this configuration.
|
||||
|
||||
#### *fallbackProviderConfig* . **priority** => *number*
|
||||
|
||||
The priority used for the provider. Higher priorities are favoured over lower priorities. If multiple providers share the same priority, they are chosen at random.
|
||||
The priority used for the provider. Lower-value priorities are favoured over higher-value priorities. If multiple providers share the same priority, they are chosen at random.
|
||||
|
||||
|
||||
#### *fallbackProviderConfig* . **stallTimeout** => *number*
|
||||
@@ -123,7 +123,7 @@ This is identical to `sendAsync`. Historically, this used a synchronous web requ
|
||||
WebSocketProvider
|
||||
-----------------
|
||||
|
||||
#### **new ***ethers* . *provider* . **WebSocketProvider**( [ url [ , network ] ] )
|
||||
#### **new ***ethers* . *providers* . **WebSocketProvider**( [ url [ , network ] ] )
|
||||
|
||||
Returns a new [WebSocketProvider](/v5/api/providers/other/#WebSocketProvider) connected to *url* as the *network*.
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -7,6 +7,15 @@ Documentation: [html](https://docs.ethers.io/)
|
||||
Provider
|
||||
========
|
||||
|
||||
#### Coming from Web3.js?
|
||||
|
||||
If you are coming from Web3.js, this is one of the biggest differences you will encounter using ethers.
|
||||
|
||||
The ethers library creates a strong division between the operation a **Provider** can perform and those of a [Signer](/v5/api/signer/#Signer), which Web3.js lumps together.
|
||||
|
||||
This separation of concerns and a stricted subset of Provider operations allows for a larger variety of backends, a more consistent API and ensures other libraries to operate without being able to rely on any underlying assumption.
|
||||
|
||||
|
||||
Accounts Methods
|
||||
----------------
|
||||
|
||||
@@ -33,7 +42,7 @@ Returns the number of transactions *address* has ever **sent**, as of *blockTag*
|
||||
```javascript
|
||||
// Get the balance for an account...
|
||||
provider.getBalance("ricmoo.firefly.eth");
|
||||
// { Promise: { BigNumber: "284831012276355695" } }
|
||||
// { Promise: { BigNumber: "25334210474552466902" } }
|
||||
|
||||
// Get the code for a contract...
|
||||
provider.getCode("registrar.firefly.eth");
|
||||
@@ -45,7 +54,7 @@ provider.getStorageAt("registrar.firefly.eth", 0)
|
||||
|
||||
// Get transaction count of an account...
|
||||
provider.getTransactionCount("ricmoo.firefly.eth");
|
||||
// { Promise: 689 }
|
||||
// { Promise: 712 }
|
||||
```
|
||||
|
||||
Blocks Methods
|
||||
@@ -96,7 +105,7 @@ provider.getBlockWithTransactions(100004)
|
||||
// blockHash: '0xf93283571ae16dcecbe1816adc126954a739350cd1523a1559eabeae155fbb63',
|
||||
// blockNumber: 100004,
|
||||
// chainId: 0,
|
||||
// confirmations: 11212224,
|
||||
// confirmations: 11717911,
|
||||
// creates: null,
|
||||
// data: '0x',
|
||||
// from: '0xcf00A85f3826941e7A25BFcF9Aac575d40410852',
|
||||
@@ -118,6 +127,11 @@ provider.getBlockWithTransactions(100004)
|
||||
Ethereum Naming Service (ENS) Methods
|
||||
-------------------------------------
|
||||
|
||||
#### *provider* . **getResolver**( name ) => *Promise< [EnsResolver](/v5/api/providers/provider/#EnsResolver) >*
|
||||
|
||||
Returns an EnsResolver instance which can be used to further inquire about specific entries for an ENS name.
|
||||
|
||||
|
||||
#### *provider* . **lookupAddress**( address ) => *Promise< string >*
|
||||
|
||||
Performs a reverse lookup of the *address* in ENS using the *Reverse Registrar*. If the name does not exist, or the forward lookup does not match, `null` is returned.
|
||||
@@ -138,6 +152,34 @@ provider.resolveName("ricmoo.firefly.eth");
|
||||
// { Promise: '0x8ba1f109551bD432803012645Ac136ddd64DBA72' }
|
||||
```
|
||||
|
||||
EnsResolver
|
||||
-----------
|
||||
|
||||
#### *resolver* . **name** => *string*
|
||||
|
||||
The name of this resolver.
|
||||
|
||||
|
||||
#### *resolver* . **address** => *string< [Address](/v5/api/utils/address/#address) >*
|
||||
|
||||
The address of the Resolver.
|
||||
|
||||
|
||||
#### *resolver* . **getAddress**( [ cointType = 60 ] ) => *Promise< string >*
|
||||
|
||||
Returns a Promise which resolves to the [EIP-2304](https://eips.ethereum.org/EIPS/eip-2304) multicoin address stored for the *coinType*. By default an Ethereum [Address](/v5/api/utils/address/#address) (`coinType = 60`) will be returned.
|
||||
|
||||
|
||||
#### *resolver* . **getContentHash**( ) => *Promise< string >*
|
||||
|
||||
Returns a Promise which resolves to any stored [EIP-1577](https://eips.ethereum.org/EIPS/eip-1577) content hash.
|
||||
|
||||
|
||||
#### *resolver* . **getText**( key ) => *Promise< string >*
|
||||
|
||||
Returns a Promise which resolves to any stored [EIP-634](https://eips.ethereum.org/EIPS/eip-634) text entry for *key*.
|
||||
|
||||
|
||||
Logs Methods
|
||||
------------
|
||||
|
||||
@@ -166,6 +208,13 @@ Returns the block number (or height) of the most recently mined block.
|
||||
Returns a *best guess* of the [Gas Price](/v5/concepts/gas/#gas-price) to use in a transaction.
|
||||
|
||||
|
||||
#### *provider* . **ready** => *Promise< [Network](/v5/api/providers/types/#providers-Network) >*
|
||||
|
||||
Returns a Promise which will stall until the network has heen established, ignoring errors due to the target node not being active yet.
|
||||
|
||||
This can be used for testing or attaching scripts to wait until the node is up and running smoothly.
|
||||
|
||||
|
||||
```javascript
|
||||
// The network information
|
||||
provider.getNetwork()
|
||||
@@ -177,16 +226,16 @@ provider.getNetwork()
|
||||
|
||||
// The current block number
|
||||
provider.getBlockNumber()
|
||||
// { Promise: 11312227 }
|
||||
// { Promise: 11817914 }
|
||||
|
||||
// Get the current suggested gas price (in wei)...
|
||||
gasPrice = await provider.getGasPrice()
|
||||
// { BigNumber: "46200000000" }
|
||||
// { BigNumber: "207000000000" }
|
||||
|
||||
// ...often this gas price is easier to understand or
|
||||
// display to the user in gwei (giga-wei, or 1e9 wei)
|
||||
utils.formatUnits(gasPrice, "gwei")
|
||||
// '46.2'
|
||||
// '207.0'
|
||||
```
|
||||
|
||||
Transactions Methods
|
||||
@@ -204,6 +253,20 @@ Returns an estimate of the amount of gas that would be required to submit *trans
|
||||
An estimate may not be accurate since there could be another transaction on the network that was not accounted for, but after being mined affected relevant state.
|
||||
|
||||
|
||||
#### *provider* . **getTransaction**( hash ) => *Promise< [TransactionResponse](/v5/api/providers/types/#providers-TransactionResponse) >*
|
||||
|
||||
Returns the transaction with *hash* or null if the transaction is unknown.
|
||||
|
||||
If a transaction has not been mined, this method will search the transaction pool. Various backends may have more restrictive transaction pool access (e.g. if the gas price is too low or the transaction was only recently sent and not yet indexed) in which case this method may also return null.
|
||||
|
||||
|
||||
#### *provider* . **getTransactionReceipt**( hash ) => *Promise< [TransactionReceipt](/v5/api/providers/types/#providers-TransactionReceipt) >*
|
||||
|
||||
Returns the transaction receipt for *hash* or null if the transaction has not been mined.
|
||||
|
||||
To stall until the transaction has been mined, consider the `waitForTransaction` method below.
|
||||
|
||||
|
||||
#### *provider* . **sendTransaction**( transaction ) => *Promise< [TransactionResponse](/v5/api/providers/types/#providers-TransactionResponse) >*
|
||||
|
||||
Submits *transaction* to the network to be mined. The *transaction* **must** be signed, and be valid (i.e. the nonce is correct and the account has sufficient balance to pay for the transaction).
|
||||
@@ -213,43 +276,45 @@ Submits *transaction* to the network to be mined. The *transaction* **must** be
|
||||
|
||||
Returns a Promise which will not resolve until *transactionHash* is mined.
|
||||
|
||||
If *confirms* is 0, this method is non-blocking and if the transaction has not been mined returns null. Otherwise, this method will block until the transaction has *confirms* blocks mined on top of the block in which is was mined.
|
||||
|
||||
|
||||
Event Emitter Methods
|
||||
---------------------
|
||||
|
||||
#### *provider* . **on**( eventName , listener ) => *this*
|
||||
|
||||
Add a *listener* to be triggered for each *eventName*.
|
||||
Add a *listener* to be triggered for each *eventName* [event](/v5/api/providers/provider/#Provider--events).
|
||||
|
||||
|
||||
#### *provider* . **once**( eventName , listener ) => *this*
|
||||
|
||||
Add a *listener* to be triggered for only the next *eventName*, at which time it will be removed.
|
||||
Add a *listener* to be triggered for only the next *eventName* [event](/v5/api/providers/provider/#Provider--events), at which time it will be removed.
|
||||
|
||||
|
||||
#### *provider* . **emit**( eventName , ...args ) => *boolean*
|
||||
|
||||
Notify all listeners of *eventName*, passing *args* to each listener. This is generally only used internally.
|
||||
Notify all listeners of the *eventName* [event](/v5/api/providers/provider/#Provider--events), passing *args* to each listener. This is generally only used internally.
|
||||
|
||||
|
||||
#### *provider* . **off**( eventName [ , listener ] ) => *this*
|
||||
|
||||
Remove a *listener* for *eventName*. If no *listener* is provided, all listeners for *eventName* are removed.
|
||||
Remove a *listener* for the *eventName* [event](/v5/api/providers/provider/#Provider--events). If no *listener* is provided, all listeners for *eventName* are removed.
|
||||
|
||||
|
||||
#### *provider* . **removeAllListeners**( [ eventName ] ) => *this*
|
||||
|
||||
Remove all the listeners for *eventName*. If no *eventName* is provided, **all** events are removed.
|
||||
Remove all the listeners for the *eventName* [events](/v5/api/providers/provider/#Provider--events). If no *eventName* is provided, **all** events are removed.
|
||||
|
||||
|
||||
#### *provider* . **listenerCount**( [ eventName ] ) => *number*
|
||||
|
||||
Returns the number of listeners for *eventName*. If no *eventName* is provided, the total number of listeners is returned.
|
||||
Returns the number of listeners for the *eventName* [events](/v5/api/providers/provider/#Provider--events). If no *eventName* is provided, the total number of listeners is returned.
|
||||
|
||||
|
||||
#### *provider* . **listeners**( eventName ) => *Array< Listener >*
|
||||
|
||||
Returns the list of Listeners for *eventName*.
|
||||
Returns the list of Listeners for the *eventName* [events](/v5/api/providers/provider/#Provider--events).
|
||||
|
||||
|
||||
### Events
|
||||
@@ -260,7 +325,7 @@ A filter is an object, representing a contract log Filter, which has the optiona
|
||||
|
||||
If `address` is unspecified, the filter matches any contract address.
|
||||
|
||||
See events for more information on how to specify topic-sets.
|
||||
See [EventFilters](/v5/api/providers/types/#providers-EventFilter) for more information on filtering events.
|
||||
|
||||
|
||||
#### **Topic-Set Filter**
|
||||
@@ -269,6 +334,8 @@ The value of a **Topic-Set Filter** is a array of Topic-Sets.
|
||||
|
||||
This event is identical to a *Log Filter* with the address omitted (i.e. from any contract).
|
||||
|
||||
See [EventFilters](/v5/api/providers/types/#providers-EventFilter) for more information on filtering events.
|
||||
|
||||
|
||||
#### **Transaction Filter**
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -10,8 +10,6 @@ Types
|
||||
BlockTag
|
||||
--------
|
||||
|
||||
### EventType
|
||||
|
||||
Networkish
|
||||
----------
|
||||
|
||||
@@ -118,9 +116,13 @@ Events and Logs
|
||||
The address to filter by, or `null` to match any address.
|
||||
|
||||
|
||||
#### *filter* . **topics** => *Array< string< [DataHexString](/v5/api/utils/bytes/#DataHexString)< 32 > > | Array< string< [DataHexString](/v5/api/utils/bytes/#DataHexString)< 32 > > > >*
|
||||
#### *filter* . **topics** => *Array< string< [Data](/v5/api/utils/bytes/#DataHexString)< 32 > > | Array< string< [Data](/v5/api/utils/bytes/#DataHexString)< 32 > > > >*
|
||||
|
||||
The topics to filter by, or `null` to match any topics. Each entry represents an **AND** condition that must match, or may be `null` to match anything. If a given entry is an Array, then that entry is treated as an **OR** for any value in the entry.
|
||||
The topics to filter by or `null` to match any topics.
|
||||
|
||||
Each entry represents an **AND** condition that must match, or may be `null` to match anything. If a given entry is an Array, then that entry is treated as an **OR** for any value in the entry.
|
||||
|
||||
See [Filters](/v5/concepts/events/#events--filters) for more details and examples on specifying complex filters.
|
||||
|
||||
|
||||
### Filter
|
||||
@@ -268,9 +270,17 @@ The number of blocks that have been mined (including the initial block) since th
|
||||
The serialized transaction.
|
||||
|
||||
|
||||
#### *transaction* . **wait**( [ confirmations = 1 ] ) => *Promise< [TransactionReceipt](/v5/api/providers/types/#providers-TransactionReceipt) >*
|
||||
#### *transaction* . **wait**( [ confirms = 1 ] ) => *Promise< [TransactionReceipt](/v5/api/providers/types/#providers-TransactionReceipt) >*
|
||||
|
||||
Resolves to the [TransactionReceipt](/v5/api/providers/types/#providers-TransactionReceipt) once the transaction has been included in the chain for *confirms* blocks. If *confirms* is 0, and the transaction has not been mined, `null` is returned.
|
||||
|
||||
If the transaction execution failed (i.e. the receipt status is `0`), a [CALL_EXCEPTION](/v5/api/utils/logger/#errors--call-exception) Error will be rejected with the following properties:
|
||||
|
||||
- `error.transaction` - the original transaction
|
||||
- `error.transactionHash` - the hash of the transaction
|
||||
- `error.receipt` - the actual receipt, with the status of `0`
|
||||
|
||||
|
||||
Wait for *confirmations*. If 0, and the transaction has not been mined, `null` is returned.
|
||||
|
||||
|
||||
### TransactionReceipt
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -273,7 +273,7 @@ walletMnemonic.publicKey
|
||||
walletMnemonic.mnemonic
|
||||
// {
|
||||
// locale: 'en',
|
||||
// path: 'm/44\'/60\'/0\'/0/0',
|
||||
// path: "m/44'/60'/0'/0/0",
|
||||
// phrase: 'announce room limb pattern dry unit scale effort smooth jazz weasel alcohol'
|
||||
// }
|
||||
|
||||
@@ -335,7 +335,7 @@ contract = new ethers.Contract("dai.tokens.ethers.eth", abi, signer)
|
||||
|
||||
// Get the number of tokens for this account
|
||||
tokens = await contract.balanceOf(signer.getAddress())
|
||||
// { BigNumber: "15923148775162018481031" }
|
||||
// { BigNumber: "198172622063578627973" }
|
||||
|
||||
//
|
||||
// Pre-flight (check for revert) on DAI from the signer
|
||||
@@ -352,7 +352,7 @@ contract.callStatic.transfer("donations.ethers.eth", tokens)
|
||||
|
||||
// This will fail since it is greater than the token balance
|
||||
contract.callStatic.transfer("donations.ethers.eth", tokens.add(1))
|
||||
// Error: call revert exception (method="transfer(address,uint256)", errorSignature="Error(string)", errorArgs=["Dai/insufficient-balance"], reason="Dai/insufficient-balance", code=CALL_EXCEPTION, version=abi/5.0.9)
|
||||
// Error: call revert exception (method="transfer(address,uint256)", errorSignature="Error(string)", errorArgs=["Dai/insufficient-balance"], reason="Dai/insufficient-balance", code=CALL_EXCEPTION, version=abi/5.0.12)
|
||||
```
|
||||
|
||||
ExternallyOwnedAccount
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -21,14 +21,14 @@ Converting and Verifying
|
||||
|
||||
Returns *address* as a Checksum Address.
|
||||
|
||||
If *address* is an invalid 40-nibble [HexString](/v5/api/utils/bytes/#HexString) or if it contains mixed case and the checksum is invalid, an InvalidArgument Error is thrown.
|
||||
If *address* is an invalid 40-nibble [HexString](/v5/api/utils/bytes/#HexString) or if it contains mixed case and the checksum is invalid, an [INVALID_ARGUMENT](/v5/api/utils/logger/#errors--invalid-argument) Error is thrown.
|
||||
|
||||
The value of *address* may be any supported address format.
|
||||
|
||||
|
||||
#### *ethers* . *utils* . **getIcapAddress**( address ) => *string< [IcapAddress](/v5/api/utils/address/#address-icap) >*
|
||||
|
||||
Returns *address* as an [ICAP address](https://github.com/ethereum/wiki/wiki/Inter-exchange-Client-Address-Protocol-%28ICAP%29). Supports the same restrictions as [utils.getAddress](/v5/api/utils/address/#utils-getAddress).
|
||||
Returns *address* as an [ICAP address](https://github.com/ethereum/wiki/wiki/Inter-exchange-Client-Address-Protocol-%28ICAP%29). Supports the same restrictions as [getAddress](/v5/api/utils/address/#utils-getAddress).
|
||||
|
||||
|
||||
#### *ethers* . *utils* . **isAddress**( address ) => *boolean*
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -85,7 +85,7 @@ BigNumber.from(42n)
|
||||
|
||||
// Numbers outside the safe range fail:
|
||||
BigNumber.from(Number.MAX_SAFE_INTEGER);
|
||||
// Error: overflow (fault="overflow", operation="BigNumber.from", value=9007199254740991, code=NUMERIC_FAULT, version=bignumber/5.0.11)
|
||||
// Error: overflow (fault="overflow", operation="BigNumber.from", value=9007199254740991, code=NUMERIC_FAULT, version=bignumber/5.0.14)
|
||||
```
|
||||
|
||||
Methods
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -164,20 +164,20 @@ Return a copy of *array* shuffled using [Fisher-Yates Shuffle](https://en.wikipe
|
||||
|
||||
```javascript
|
||||
utils.randomBytes(8)
|
||||
// Uint8Array [ 82, 221, 254, 37, 192, 138, 147, 109 ]
|
||||
// Uint8Array [ 97, 223, 223, 186, 224, 0, 90, 28 ]
|
||||
|
||||
const data = [ 1, 2, 3, 4, 5, 6, 7 ];
|
||||
|
||||
// Returns a new Array
|
||||
utils.shuffled(data);
|
||||
// [
|
||||
// 6,
|
||||
// 5,
|
||||
// 3,
|
||||
// 2,
|
||||
// 7,
|
||||
// 1,
|
||||
// 4,
|
||||
// 1
|
||||
// 6,
|
||||
// 7,
|
||||
// 2
|
||||
// ]
|
||||
|
||||
// The Original is unscathed...
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -52,7 +52,7 @@ utils.keccak256("0x1234")
|
||||
|
||||
// Do NOT use UTF-8 strings that are not a DataHexstring
|
||||
utils.keccak256("hello world")
|
||||
// Error: invalid arrayify value (argument="value", value="hello world", code=INVALID_ARGUMENT, version=bytes/5.0.6)
|
||||
// Error: invalid arrayify value (argument="value", value="hello world", code=INVALID_ARGUMENT, version=bytes/5.0.10)
|
||||
|
||||
// If needed, convert strings to bytes first:
|
||||
utils.keccak256(utils.toUtf8Bytes("hello world"))
|
||||
@@ -300,6 +300,24 @@ TypedDataEncoder.getPayload(domain, types, value)
|
||||
// },
|
||||
// primaryType: 'Mail',
|
||||
// types: {
|
||||
// EIP712Domain: [
|
||||
// {
|
||||
// name: 'name',
|
||||
// type: 'string'
|
||||
// },
|
||||
// {
|
||||
// name: 'version',
|
||||
// type: 'string'
|
||||
// },
|
||||
// {
|
||||
// name: 'chainId',
|
||||
// type: 'uint256'
|
||||
// },
|
||||
// {
|
||||
// name: 'verifyingContract',
|
||||
// type: 'address'
|
||||
// }
|
||||
// ],
|
||||
// Mail: [
|
||||
// {
|
||||
// name: 'from',
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -51,34 +51,36 @@ Throw an Error with *message* and an optional *code* and additional *params* set
|
||||
|
||||
#### *logger* . **throwArgumentError**( message , name , value ) => *never*
|
||||
|
||||
Throw an [INVALID_ARGUMENT](/v5/api/utils/logger/#errors-InvalidArgument) Error with *name* and *value*.
|
||||
Throw an [INVALID_ARGUMENT](/v5/api/utils/logger/#errors--invalid-argument) Error with *name* and *value*.
|
||||
|
||||
|
||||
### Usage Validation
|
||||
|
||||
#### *logger* . **checkAbstract**( target , kind ) => *void*
|
||||
|
||||
Checks that *target* is not *kind* and performs the same operations as `checkNew`. This is useful for ensuring abstract classes are not being instantiated.
|
||||
If *target* is *kind*, throws a [UNSUPPORTED_OPERATION](/v5/api/utils/logger/#errors--unsupported-operation) error otherwise performs the same operations as [checkNew](/v5/api/utils/logger/#Logger-checkNew).
|
||||
|
||||
This is useful for ensuring abstract classes are not being instantiated.
|
||||
|
||||
|
||||
#### *logger* . **checkArgumentCount**( count , expectedCount [ , message ) => *void*
|
||||
|
||||
If *count* is not equal to *expectedCount*, throws a [MISSING_ARGUMENT](/v5/api/utils/logger/#errors-MissingArgument) or [UNEXPECTED_ARGUMENT](/v5/api/utils/logger/#errors-UnexpectedArgument) error.
|
||||
If *count* is not equal to *expectedCount*, throws a [MISSING_ARGUMENT](/v5/api/utils/logger/#errors--missing-argument) or [UNEXPECTED_ARGUMENT](/v5/api/utils/logger/#errors--unexpected-argument) error.
|
||||
|
||||
|
||||
#### *logger* . **checkNew**( target , kind ) => *void*
|
||||
|
||||
If *target* is not a valid `this` or `target` value, throw a [MISSING_NEW](/v5/api/utils/logger/#errors-MissingNew) error. This is useful to ensure callers of a Class are using `new`.
|
||||
If *target* is not a valid `this` or `target` value, throw a [MISSING_NEW](/v5/api/utils/logger/#errors--missing-new) error. This is useful to ensure callers of a Class are using `new`.
|
||||
|
||||
|
||||
#### *logger* . **checkNormalize**( message ) => *void*
|
||||
|
||||
Check that the environment has a correctly functioning [String.normalize](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize). If not, a [UNSUPPORTED_OPERATION](/v5/api/utils/logger/#errors-UnsupportedOperation) error is thrown.
|
||||
Check that the environment has a correctly functioning [String.normalize](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize). If not, a [UNSUPPORTED_OPERATION](/v5/api/utils/logger/#errors--unsupported-operation) error is thrown.
|
||||
|
||||
|
||||
#### *logger* . **checkSafeUint53**( value [ , message ] ) => *void*
|
||||
|
||||
If *value* is not safe as a [JavaScript number](https://en.wikipedia.org/wiki/Double-precision_floating-point_format), throws a [NUMERIC_FAULT](/v5/api/utils/logger/#errors-NumericFault) error.
|
||||
If *value* is not safe as a [JavaScript number](https://en.wikipedia.org/wiki/Double-precision_floating-point_format), throws a [NUMERIC_FAULT](/v5/api/utils/logger/#errors--numeric-fault) error.
|
||||
|
||||
|
||||
### Censorship
|
||||
@@ -104,13 +106,23 @@ Errors
|
||||
|
||||
#### *Logger* . *errors* . **NOT_IMPLEMENTED**
|
||||
|
||||
The operation is not implemented.
|
||||
The operation is not implemented. This may occur when calling a method on a sub-class that has not fully implemented its abstract superclass.
|
||||
|
||||
|
||||
#### *Logger* . *errors* . **SERVER_ERROR**
|
||||
|
||||
There was an error communicating with a server.
|
||||
|
||||
This may occur for a number of reasons, for example:
|
||||
|
||||
- a [CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) issue; this is quite often the problem and also the hardest to diagnose and fix, so it is very beneficial to familiarize yourself with CORS; some backends allow you configure your CORS, such as the geth command-line or conifguration files or the INFURA and Alchemy dashboards by specifing allowed Origins, methods, etc.
|
||||
- an SSL issue; for example, if you are trying to connect to a local node via HTTP but are serving the content from a secure HTTPS website
|
||||
- a link issue; a firewall is preventing the traffic from reaching the server
|
||||
- a server issue; the server is down, or is returning 500 error codes
|
||||
- a backend DDoS mitigation proxy; for example, Etherscan operates behind a Cloudflare proxy, which will block traffic if the request is sent via specific User Agents or the client fingerprint is detected as a bot in some cases
|
||||
|
||||
|
||||
|
||||
|
||||
#### *Logger* . *errors* . **TIMEOUT**
|
||||
|
||||
@@ -126,6 +138,14 @@ A generic unknown error.
|
||||
|
||||
The operation is not supported.
|
||||
|
||||
This can happen for a variety reasons, for example:
|
||||
|
||||
- Some backends do not support certain operations; such as passing a blockTag to an [EtherscanProvider](/v5/api/providers/api-providers/#EtherscanProvider) for [call](/v5/api/providers/provider/#Provider-call)
|
||||
- A [Contract](/v5/api/contract/contract/) object connected to [Provider](/v5/api/providers/provider/) (instead of a [Signer](/v5/api/signer/#Signer)) cannot [sign](/v5/api/signer/#Signer-signTransaction) or [send](/v5/api/signer/#Signer-sendTransaction) transactions
|
||||
- a [Contract](/v5/api/contract/contract/) connected to a [Signer](/v5/api/signer/#Signer) without a [Provider](/v5/api/providers/provider/) is write-only and cannot estimate gas or execute static calls
|
||||
|
||||
|
||||
|
||||
|
||||
### Safety Error Codes
|
||||
|
||||
@@ -133,6 +153,8 @@ The operation is not supported.
|
||||
|
||||
The amount of data needed is more than the amount of data required, which would cause the data buffer to read past its end.
|
||||
|
||||
This can occur if a contract erroneously returns invalid ABI-encoded data or RLP data is malformed.
|
||||
|
||||
|
||||
#### *Logger* . *errors* . **NUMERIC_FAULT**
|
||||
|
||||
@@ -145,7 +167,7 @@ Common cases of this occur when there is [overflow](https://en.wikipedia.org/wik
|
||||
|
||||
#### *Logger* . *errors* . **INVALID_ARGUMENT**
|
||||
|
||||
The type or value of an argument is invalid. This will generally also include the `name` and `value` of the argument. Any function which accepts sensitive data (such as a private key) will include the string `[[REDACTED]]` instead of the value passed in.
|
||||
The type or value of an argument is invalid. This will generally also include the `name` and `value` of the argument. Any function which accepts sensitive data (such as a private key) will include the string `"[[REDACTED]]"` instead of the value passed in.
|
||||
|
||||
|
||||
#### *Logger* . *errors* . **MISSING_ARGUMENT**
|
||||
@@ -155,7 +177,7 @@ An expected parameter was not specified.
|
||||
|
||||
#### *Logger* . *errors* . **MISSING_NEW**
|
||||
|
||||
An object is a Class, but is now being called with `new`.
|
||||
An object is a Class, but is not being called with `new`.
|
||||
|
||||
|
||||
#### *Logger* . *errors* . **UNEXPECTED_ARGUMENT**
|
||||
@@ -167,14 +189,16 @@ Too many parameters we passed into a function.
|
||||
|
||||
#### *Logger* . *errors* . **CALL_EXCEPTION**
|
||||
|
||||
An attempt to call a blockchain contract (getter) resulted in a revert or other error.
|
||||
An attempt to call a blockchain contract (getter) resulted in a revert or other error, such as insufficient gas (out-of-gas) or an invalid opcode. This can also occur during gas estimation or if waiting for a [TransactionReceipt](/v5/api/providers/types/#providers-TransactionReceipt) which failed during execution.
|
||||
|
||||
Consult the contract to determine the cause, such as a failed condition in a `require` statement. The `reason` property may provide more context for the cause of this error.
|
||||
|
||||
|
||||
#### *Logger* . *errors* . **INSUFFICIENT_FUNDS**
|
||||
|
||||
The account is attempting to make a transaction which costs more than is available.
|
||||
|
||||
A sending account must have enough ether to pay for the value, the gas limit (at the gas price) as well as the intrinsic cost of data. The intrinsic cost of data is 4 gas for each zero byte and 68 gas for each non-zero byte.
|
||||
A sending account must have enough ether to pay for the value, the gas limit (at the gas price) as well as the intrinsic cost of data. The intrinsic cost of data is 4 gas for each zero byte and 68 gas for each non-zero byte, as well as 35000 gas if a transaction contains no `to` property and is therefore expected to create a new account.
|
||||
|
||||
|
||||
#### *Logger* . *errors* . **NETWORK_ERROR**
|
||||
@@ -191,7 +215,7 @@ The nonce being specified has already been used in a mined transaction.
|
||||
|
||||
When replacing a transaction, by using a nonce which has already been sent to the network, but which has not been mined yet the new transaction must specify a higher gas price.
|
||||
|
||||
This error occurs when the gas price is insufficient to *bribe* the transaction pool to prefer the new transaction over the old one. Generally, the new gas price should be about 50% + 1 wei more, so if a gas price of 10 gwei was used, the replacement should be 15.000000001 gwei.
|
||||
This error occurs when the gas price is insufficient to *bribe* the transaction pool to prefer the new transaction over the old one. Generally, the new gas price should be about 50% + 1 wei more, so if a gas price of 10 gwei was used, the replacement should be 15.000000001 gwei. This is not enforced by the protocol, as it deals with unmined transactions, and can be configured by each node, however to ensure a transaction is propagated to a miner it is best practice to follow the defaults most nodes have enabled.
|
||||
|
||||
|
||||
#### *Logger* . *errors* . **UNPREDICTABLE_GAS_LIMIT**
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -7,27 +7,35 @@ Documentation: [html](https://docs.ethers.io/)
|
||||
Property Utilities
|
||||
==================
|
||||
|
||||
#### *ethers* . *utils* . **checkProperties**( ) => *void*
|
||||
#### *ethers* . *utils* . **checkProperties**( object , check ) => *void*
|
||||
|
||||
Checks that *object* only contains properties included in *check*, and throws [INVALID_ARGUMENT](/v5/api/utils/logger/#errors--invalid-argument) if not.
|
||||
|
||||
|
||||
#### *ethers* . *utils* . **deepCopy**( anObject ) => *any*
|
||||
|
||||
Creates a recursive copy of *anObject*. Frozen (i.e. and other known immutable) objects are copied by reference.
|
||||
|
||||
|
||||
#### *ethers* . *utils* . **defineReadOnly**( anObject , name , value ) => *void*
|
||||
|
||||
Uses the `Object.defineProperty` method to set a read-only property on an object.
|
||||
|
||||
|
||||
#### *ethers* . *utils* . **getStatic**( aConstructor , key ) => *any*
|
||||
|
||||
Recursively check for a static method *key* on an inheritance chain from *aConstructor* to all ancestors.
|
||||
|
||||
This is used to mimic behaviour in other languages where `this` in a static method will also search ancestors.
|
||||
|
||||
|
||||
#### *ethers* . *utils* . **resolveProperties**( anObject ) => *Promise< any >*
|
||||
|
||||
Retruns a Promise which resolves all child values on *anObject*.
|
||||
|
||||
|
||||
#### *ethers* . *utils* . **shallowCopy**( anObject ) => *any*
|
||||
|
||||
Returns a shallow copy of *anObject*. This is the same as using `Object.assign({ }, anObject)`.
|
||||
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -8,8 +8,8 @@ Ethereum Basics
|
||||
===============
|
||||
|
||||
* [Events](events)
|
||||
* [Solidity Topics](events)
|
||||
* [Logs and Filtering](events)
|
||||
* [Solidity Topics](events)
|
||||
* [Gas](gas)
|
||||
* [Gas Price](gas)
|
||||
* [Gas Limit](gas)
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -7,9 +7,6 @@ Documentation: [html](https://docs.ethers.io/)
|
||||
Events
|
||||
======
|
||||
|
||||
Solidity Topics
|
||||
---------------
|
||||
|
||||
Logs and Filtering
|
||||
------------------
|
||||
|
||||
@@ -135,5 +132,8 @@ contract.filters.Transfer(null, [ myAddress, otherAddress ])
|
||||
// }
|
||||
```
|
||||
|
||||
Solidity Topics
|
||||
---------------
|
||||
|
||||
### Other Things? TODO
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -12,46 +12,77 @@ Building
|
||||
|
||||
```
|
||||
# Clone the repository
|
||||
/home/ricmoo> git clone git@github.com:ethers-io/ethers.js.git
|
||||
/home/ricmoo> git clone https://github.com/ethers-io/ethers.js.git
|
||||
|
||||
/home/ricmoo> cd ethers.js
|
||||
|
||||
# Install the base dependencies
|
||||
# Install all dependencies:
|
||||
# - Hoists all sub-package dependencies in the package.json (preinstall)
|
||||
# - Installs all the (hoisted) dependencies and devDependencies (install)
|
||||
# - Build the rat-nests (in .package_node_modules) (postinstall)
|
||||
# - Create a dependency graph for the TypeScript (postinstall)
|
||||
# - Link the rat-nets into each project (postinstall)
|
||||
/home/ricmoo/ethers.js> npm install
|
||||
|
||||
# Install each module's dependencies and link the libraries
|
||||
# internally, so they reference each other
|
||||
/home/ricmoo/ethers.js> npm run bootstrap
|
||||
```
|
||||
|
||||
Making your changes
|
||||
-------------------
|
||||
### Making Changes
|
||||
|
||||
```
|
||||
# Begin watching the files and re-building whenever they change
|
||||
/home/ricmoo/ethers.js> npm run auto-build
|
||||
|
||||
|
||||
# Sometimes the issue only affects the ESM modules
|
||||
/home/ricmoo/ethers.js> npm run auto-build-esm
|
||||
|
||||
|
||||
# Or if you only need to run a single build
|
||||
/home/ricmoo/ethers.js> npm run _build-cjs
|
||||
/home/ricmoo/ethers.js> npm run _build-esm
|
||||
# Or if you do not want to watch and just build
|
||||
/home/ricmoo/ethers.js> npm run build
|
||||
```
|
||||
|
||||
### Creating Browser-Ready Files
|
||||
|
||||
```
|
||||
# Rebuilds all files and bundles testcases up for testing
|
||||
# If you need to rebuild all the libs (esm + cjs) and dist files
|
||||
# Note: this requires node 10 or newer
|
||||
/home/ricmoo/ethers.js> npm run build-all
|
||||
```
|
||||
|
||||
### Testing
|
||||
|
||||
```
|
||||
# Rebuilds all files (npm run build-all) and bundles testcases up for testing
|
||||
/home/ricmoo/ethers.js> npm test
|
||||
|
||||
# Often you don't need the full CI experience
|
||||
/home/ricmoo/ethers.js> npm run _test-node
|
||||
/home/ricmoo/ethers.js> npm run test-node
|
||||
```
|
||||
|
||||
### Distribution
|
||||
|
||||
```
|
||||
# Prepare all the distribution files
|
||||
# - Remove all generated files (i.e. npm run clean)
|
||||
# - Re-install all dependencies, hoisting, etc. (npm install)
|
||||
# - Spell check all strings in every TypeScript files
|
||||
# - Build everything from scratch with this clean install
|
||||
# - Compare local with npm, bumping the version if changed
|
||||
# - Build everything again (with the updated versions)
|
||||
# - Update the CHANGELOG.md with the git history since the last change
|
||||
/home/ricmoo/ethers.js> npm run update-version
|
||||
```
|
||||
|
||||
#### Do NOT check in dist files in a PR
|
||||
|
||||
For Pull Requests, please ONLY commit files in the `docs.wrm/` and `packages/*/src.ts/` folders. I will prepare the distribution builds myself and keeping the PR relevant makes it easier to verify the changes.
|
||||
|
||||
|
||||
### Publishing
|
||||
|
||||
```
|
||||
# Publish
|
||||
# - Update any changed packages to NPM
|
||||
# - Create a release on GitHub with the latest CHANGELOG.md description
|
||||
# - Upload the bundled files the the CDN
|
||||
# - Flush the CDN edge caches
|
||||
/home/ricmoo/ethers.js> npm run publish-all
|
||||
```
|
||||
|
||||
Documentation
|
||||
-------------
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -234,7 +234,7 @@ url.parse("https://www.ricmoo.com/").protocol
|
||||
// 'https:'
|
||||
|
||||
url.parse(45)
|
||||
// Error: The "url" argument must be of type string. Received type number
|
||||
// Error: The "url" argument must be of type string. Received type number (45)
|
||||
|
||||
// You want to assign (doesn't emit eval) AND display the value
|
||||
const foo = 4 + 5;
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -81,7 +81,7 @@ const signer = provider.getSigner()
|
||||
```javascript
|
||||
// Look up the current block number
|
||||
provider.getBlockNumber()
|
||||
// { Promise: 11312227 }
|
||||
// { Promise: 11817915 }
|
||||
|
||||
// Get the balance of an account (by address or ENS name, if supported by network)
|
||||
balance = await provider.getBalance("ethers.eth")
|
||||
@@ -149,11 +149,11 @@ daiContract.symbol()
|
||||
|
||||
// Get the balance of an address
|
||||
balance = await daiContract.balanceOf("ricmoo.firefly.eth")
|
||||
// { BigNumber: "15923148775162018481031" }
|
||||
// { BigNumber: "198172622063578627973" }
|
||||
|
||||
// Format the DAI for displaying to the user
|
||||
ethers.utils.formatUnits(balance, 18)
|
||||
// '15923.148775162018481031'
|
||||
// '198.172622063578627973'
|
||||
```
|
||||
|
||||
### State Changing Methods
|
||||
@@ -208,7 +208,7 @@ daiContract.on(filter, (from, to, amount, event) => {
|
||||
myAddress = await signer.getAddress()
|
||||
// '0x8ba1f109551bD432803012645Ac136ddd64DBA72'
|
||||
|
||||
// Filter for all token transfers to me
|
||||
// Filter for all token transfers from me
|
||||
filterFrom = daiContract.filters.Transfer(myAddress, null);
|
||||
// {
|
||||
// address: 'dai.tokens.ethers.eth',
|
||||
@@ -218,7 +218,7 @@ filterFrom = daiContract.filters.Transfer(myAddress, null);
|
||||
// ]
|
||||
// }
|
||||
|
||||
// Filter for all token transfers from me
|
||||
// Filter for all token transfers to me
|
||||
filterTo = daiContract.filters.Transfer(null, myAddress);
|
||||
// {
|
||||
// address: 'dai.tokens.ethers.eth',
|
||||
@@ -308,7 +308,7 @@ Signing Messages
|
||||
// logging into a service, such as CryptoKitties,
|
||||
// pass the string in.
|
||||
signature = await signer.signMessage("Hello World");
|
||||
// '0xc2c9a0db8e9ae4266d6aa1974b36efabd8e270452587857922c5fd696838a22b6dd8f0536c24a73c0df512eefac68bc118fb91b10640fcc576e44a57bc024ca31b'
|
||||
// '0x800d1d157d472b0cb567ec0d9e2825203aaa7e84db5a9b19169c0c85575f6e0761e99bd670ed82f71a346020cdec8326644132cdeffd8e327d888f94f21825e01b'
|
||||
|
||||
//
|
||||
// A common case is also signing a hash, which is 32
|
||||
@@ -325,6 +325,6 @@ messageBytes = ethers.utils.arrayify(message);
|
||||
|
||||
// To sign a hash, you most often want to sign the bytes
|
||||
signature = await signer.signMessage(messageBytes)
|
||||
// '0x66b35b262989bc88c5c5c1fadcd8bcd5ae410cdae06abf33ce2c3c98a04d4e892fd2f61717a46f81372146019c2e95646a6cfc3a7ae74e78338f40d905fa69fc1b'
|
||||
// '0x3ec3dca35ae2712e7f9bb1e2819f9b40c818c567b1a01586d3b0d0a73bad1c303b7f39d4471ac0c9eb900438bc6b6a4bf5b2c120a5cb31edc2cfab11ede409381b'
|
||||
```
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
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
Reference in New Issue
Block a user