Updated docs build.
This commit is contained in:
parent
f34be4e2c2
commit
a1b2a62e6b
@ -71,7 +71,7 @@ contract.value()
|
||||
<div class="nav previous"><a href="/v5/api/contract/contract/"><span class="arrow">←</span>Contract</a></div>
|
||||
<div class="nav next"><a href="/v5/api/contract/example/">Example: ERC-20 Contract<span class="arrow">→</span></a></div>
|
||||
</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 3, 2020, 1:44am.</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 5, 2020, 12:0am.</div>
|
||||
</div>
|
||||
<script src="/v5/static/script.js" type="text/javascript"></script>
|
||||
</body>
|
||||
|
@ -109,7 +109,7 @@
|
||||
<div class="nav previous"><a href="/v5/api/contract/"><span class="arrow">←</span>Contract Interaction</a></div>
|
||||
<div class="nav next"><a href="/v5/api/contract/contract-factory/">ContractFactory<span class="arrow">→</span></a></div>
|
||||
</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 3, 2020, 1:44am.</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 5, 2020, 12:0am.</div>
|
||||
</div>
|
||||
<script src="/v5/static/script.js" type="text/javascript"></script>
|
||||
</body>
|
||||
|
@ -127,7 +127,7 @@
|
||||
<div class="nav previous"><a href="/v5/api/contract/contract-factory/"><span class="arrow">←</span>ContractFactory</a></div>
|
||||
<div class="nav next"><a href="/v5/api/signer/">Signers<span class="arrow">→</span></a></div>
|
||||
</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 3, 2020, 1:44am.</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 5, 2020, 12:0am.</div>
|
||||
</div>
|
||||
<script src="/v5/static/script.js" type="text/javascript"></script>
|
||||
</body>
|
||||
|
@ -26,7 +26,7 @@
|
||||
<div class="nav previous"><a href="/v5/api/"><span class="arrow">←</span>Application Programming Interface</a></div>
|
||||
<div class="nav next"><a href="/v5/api/contract/contract/">Contract<span class="arrow">→</span></a></div>
|
||||
</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 3, 2020, 1:44am.</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 5, 2020, 12:0am.</div>
|
||||
</div>
|
||||
<script src="/v5/static/script.js" type="text/javascript"></script>
|
||||
</body>
|
||||
|
@ -54,7 +54,7 @@
|
||||
<div class="nav previous"><a href="/v5/api/other/hardware/"><span class="arrow">←</span>Hardware Wallets</a></div>
|
||||
<div class="nav next"><a href="/v5/cli/">Command Line Interfaces<span class="arrow">→</span></a></div>
|
||||
</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 3, 2020, 1:44am.</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 5, 2020, 12:0am.</div>
|
||||
</div>
|
||||
<script src="/v5/static/script.js" type="text/javascript"></script>
|
||||
</body>
|
||||
|
@ -24,7 +24,7 @@
|
||||
<div class="nav previous"><a href="/v5/concepts/security/"><span class="arrow">←</span>Security</a></div>
|
||||
<div class="nav next"><a href="/v5/api/contract/">Contract Interaction<span class="arrow">→</span></a></div>
|
||||
</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 3, 2020, 1:44am.</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 5, 2020, 12:0am.</div>
|
||||
</div>
|
||||
<script src="/v5/static/script.js" type="text/javascript"></script>
|
||||
</body>
|
||||
|
@ -69,7 +69,7 @@
|
||||
<div class="nav previous"><a href="/v5/api/other/assembly/dialect/"><span class="arrow">←</span>Ethers ASM Dialect</a></div>
|
||||
<div class="nav next"><a href="/v5/api/other/assembly/ast/">Abstract Syntax Tree<span class="arrow">→</span></a></div>
|
||||
</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 3, 2020, 1:44am.</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 5, 2020, 12:0am.</div>
|
||||
</div>
|
||||
<script src="/v5/static/script.js" type="text/javascript"></script>
|
||||
</body>
|
||||
|
@ -87,7 +87,7 @@
|
||||
<div class="nav previous"><a href="/v5/api/other/assembly/api/"><span class="arrow">←</span>Utilities</a></div>
|
||||
<div class="nav next"><a href="/v5/api/other/hardware/">Hardware Wallets<span class="arrow">→</span></a></div>
|
||||
</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 3, 2020, 1:44am.</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 5, 2020, 12:0am.</div>
|
||||
</div>
|
||||
<script src="/v5/static/script.js" type="text/javascript"></script>
|
||||
</body>
|
||||
|
@ -77,7 +77,7 @@
|
||||
<div class="nav previous"><a href="/v5/api/other/assembly/"><span class="arrow">←</span>Assembly</a></div>
|
||||
<div class="nav next"><a href="/v5/api/other/assembly/api/">Utilities<span class="arrow">→</span></a></div>
|
||||
</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 3, 2020, 1:44am.</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 5, 2020, 12:0am.</div>
|
||||
</div>
|
||||
<script src="/v5/static/script.js" type="text/javascript"></script>
|
||||
</body>
|
||||
|
@ -24,7 +24,7 @@
|
||||
<div class="nav previous"><a href="/v5/api/other/"><span class="arrow">←</span>Other Libraries</a></div>
|
||||
<div class="nav next"><a href="/v5/api/other/assembly/dialect/">Ethers ASM Dialect<span class="arrow">→</span></a></div>
|
||||
</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 3, 2020, 1:44am.</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 5, 2020, 12:0am.</div>
|
||||
</div>
|
||||
<script src="/v5/static/script.js" type="text/javascript"></script>
|
||||
</body>
|
||||
|
@ -29,7 +29,7 @@
|
||||
<div class="nav previous"><a href="/v5/api/other/assembly/ast/"><span class="arrow">←</span>Abstract Syntax Tree</a></div>
|
||||
<div class="nav next"><a href="/v5/api/experimental/">Experimental<span class="arrow">→</span></a></div>
|
||||
</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 3, 2020, 1:44am.</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 5, 2020, 12:0am.</div>
|
||||
</div>
|
||||
<script src="/v5/static/script.js" type="text/javascript"></script>
|
||||
</body>
|
||||
|
@ -24,7 +24,7 @@
|
||||
<div class="nav previous"><a href="/v5/api/utils/wordlists/"><span class="arrow">←</span>Wordlists</a></div>
|
||||
<div class="nav next"><a href="/v5/api/other/assembly/">Assembly<span class="arrow">→</span></a></div>
|
||||
</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 3, 2020, 1:44am.</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 5, 2020, 12:0am.</div>
|
||||
</div>
|
||||
<script src="/v5/static/script.js" type="text/javascript"></script>
|
||||
</body>
|
||||
|
@ -128,7 +128,7 @@ provider = new AlchemyProvider("homestead", apiKey);
|
||||
<div class="nav previous"><a href="/v5/api/providers/jsonrpc-provider/"><span class="arrow">←</span>JsonRpcProvider</a></div>
|
||||
<div class="nav next"><a href="/v5/api/providers/other/">Other Providers<span class="arrow">→</span></a></div>
|
||||
</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 3, 2020, 1:44am.</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 5, 2020, 12:0am.</div>
|
||||
</div>
|
||||
<script src="/v5/static/script.js" type="text/javascript"></script>
|
||||
</body>
|
||||
|
@ -47,7 +47,7 @@
|
||||
<div class="nav previous"><a href="/v5/api/signer/"><span class="arrow">←</span>Signers</a></div>
|
||||
<div class="nav next"><a href="/v5/api/providers/provider/">Provider<span class="arrow">→</span></a></div>
|
||||
</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 3, 2020, 1:44am.</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 5, 2020, 12:0am.</div>
|
||||
</div>
|
||||
<script src="/v5/static/script.js" type="text/javascript"></script>
|
||||
</body>
|
||||
|
@ -61,7 +61,7 @@
|
||||
<div class="nav previous"><a href="/v5/api/providers/provider/"><span class="arrow">←</span>Provider</a></div>
|
||||
<div class="nav next"><a href="/v5/api/providers/api-providers/">API Providers<span class="arrow">→</span></a></div>
|
||||
</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 3, 2020, 1:44am.</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 5, 2020, 12:0am.</div>
|
||||
</div>
|
||||
<script src="/v5/static/script.js" type="text/javascript"></script>
|
||||
</body>
|
||||
|
@ -51,7 +51,7 @@
|
||||
|
||||
<div class="property show-anchors"><div class="signature"><span class="path">ipcProvider</span><span class="symbol">.</span><span class="method">path</span> <span class="arrow">⇒</span> <span class="returns">string</span><div class="anchors"></div></div><div class="body"><p>The path this <a href="/v5/api/providers/provider/">Provider</a> is connected to.</p>
|
||||
|
||||
</div></div><a name="UrlJsonRpcProvider"></a><a name="other-providers--UrlJsonRpcProvider"></a><h2 class="show-anchors"><div>UrlJsonRpcProvider<span class="inherits"> inherits <a href="/v5/api/providers/jsonrpc-provider/">JsonRpcProvider</a></span><div class="anchors"><a class="self" href="/v5/api/providers/other/#UrlJsonRpcProvider"></a><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/providers/src.ts/url-json-rpc-provider.ts#L35">source</a></div></div></h2><p>This class is intended to be sub-classed and not used directly. It simplifies creating a <a href="/v5/api/providers/provider/">Provider</a> where a normal <a href="/v5/api/providers/jsonrpc-provider/">JsonRpcProvider</a> would suffice, with a little extra effort needed to generate the JSON-RPC URL.</p>
|
||||
</div></div><a name="UrlJsonRpcProvider"></a><a name="other-providers--UrlJsonRpcProvider"></a><h2 class="show-anchors"><div>UrlJsonRpcProvider<span class="inherits"> inherits <a href="/v5/api/providers/jsonrpc-provider/">JsonRpcProvider</a></span><div class="anchors"><a class="self" href="/v5/api/providers/other/#UrlJsonRpcProvider"></a><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/providers/src.ts/url-json-rpc-provider.ts#L49">source</a></div></div></h2><p>This class is intended to be sub-classed and not used directly. It simplifies creating a <a href="/v5/api/providers/provider/">Provider</a> where a normal <a href="/v5/api/providers/jsonrpc-provider/">JsonRpcProvider</a> would suffice, with a little extra effort needed to generate the JSON-RPC URL.</p>
|
||||
|
||||
<div class="property show-anchors"><div class="signature"><span class="modifier">new </span><span class="path">ethers</span><span class="symbol">.</span><span class="path">providers</span><span class="symbol">.</span><span class="method">UrlJsonRpcProvider</span><span class="symbol">(</span> <span class="symbol">[</span> <span class="param">network</span> <span class="symbol">[</span> <span class="symbol">,</span> <span class="param">apiKey</span> <span class="symbol">]</span> <span class="symbol">]</span> <span class="symbol">)</span><div class="anchors"></div></div><div class="body"><p>Sub-classes do not need to override this. Instead they should override the static method <code class="inline">getUrl</code> and optionally <code class="inline">getApiKey</code>.</p>
|
||||
|
||||
@ -101,7 +101,7 @@
|
||||
<div class="nav previous"><a href="/v5/api/providers/api-providers/"><span class="arrow">←</span>API Providers</a></div>
|
||||
<div class="nav next"><a href="/v5/api/providers/types/">Types<span class="arrow">→</span></a></div>
|
||||
</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 3, 2020, 1:44am.</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 5, 2020, 12:0am.</div>
|
||||
</div>
|
||||
<script src="/v5/static/script.js" type="text/javascript"></script>
|
||||
</body>
|
||||
|
@ -33,7 +33,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: "1585454034436018765" } }
|
||||
// { Promise: { BigNumber: "1578527309436018765" } }
|
||||
|
||||
// Get the code for a contract...
|
||||
provider.getCode("registrar.firefly.eth");
|
||||
@ -45,7 +45,7 @@ provider.getStorageAt("registrar.firefly.eth", 0)
|
||||
|
||||
// Get transaction count of an account...
|
||||
provider.getTransactionCount("ricmoo.firefly.eth");
|
||||
// { Promise: 670 }
|
||||
// { Promise: 673 }
|
||||
```
|
||||
|
||||
Blocks Methods
|
||||
@ -96,7 +96,7 @@ provider.getBlockWithTransactions(100004)
|
||||
// blockHash: '0xf93283571ae16dcecbe1816adc126954a739350cd1523a1559eabeae155fbb63',
|
||||
// blockNumber: 100004,
|
||||
// chainId: 0,
|
||||
// confirmations: 10284646,
|
||||
// confirmations: 10297123,
|
||||
// creates: null,
|
||||
// data: '0x',
|
||||
// from: '0xcf00A85f3826941e7A25BFcF9Aac575d40410852',
|
||||
@ -177,16 +177,16 @@ provider.getNetwork()
|
||||
|
||||
// The current block number
|
||||
provider.getBlockNumber()
|
||||
// { Promise: 10384649 }
|
||||
// { Promise: 10397126 }
|
||||
|
||||
// Get the current suggested gas price (in wei)...
|
||||
gasPrice = await provider.getGasPrice()
|
||||
// { BigNumber: "41000000000" }
|
||||
// { BigNumber: "19000001123" }
|
||||
|
||||
// ...often this gas price is easier to understand or
|
||||
// display to the user in gwei (giga-wei, or 1e9 wei)
|
||||
utils.formatUnits(gasPrice, "gwei")
|
||||
// '41.0'
|
||||
// '19.000001123'
|
||||
```
|
||||
|
||||
Transactions Methods
|
||||
|
@ -29,7 +29,7 @@
|
||||
|
||||
</div></div><div class="code-title"><div>Account Examples</div></div><div class="code"><span class="comment">// Get the balance for an account...
|
||||
</span>provider.getBalance("ricmoo.firefly.eth");
|
||||
<span class="result ok">// { Promise: { BigNumber: "1585454034436018765" } }
|
||||
<span class="result ok">// { Promise: { BigNumber: "1578527309436018765" } }
|
||||
</span>
|
||||
<span class="comment">// Get the code for a contract...
|
||||
</span>provider.getCode("registrar.firefly.eth");
|
||||
@ -41,7 +41,7 @@
|
||||
</span>
|
||||
<span class="comment">// Get transaction count of an account...
|
||||
</span>provider.getTransactionCount("ricmoo.firefly.eth");
|
||||
<span class="result ok">// { Promise: 670 }
|
||||
<span class="result ok">// { Promise: 673 }
|
||||
</span></div><a name="Provider--block-methods"></a><a name="Provider--Provider--block-methods"></a><h2 class="show-anchors"><div>Blocks Methods<div class="anchors"><a class="self" href="/v5/api/providers/provider/#Provider--block-methods"></a></div></div></h2>
|
||||
<a name="Provider-getBlock"></a><div class="property show-anchors"><div class="signature"><span class="path">provider</span><span class="symbol">.</span><span class="method">getBlock</span><span class="symbol">(</span> <span class="param">block</span> <span class="symbol">)</span> <span class="arrow">⇒</span> <span class="returns">Promise< <a href="/v5/api/providers/types/#providers-Block">Block</a> ></span><div class="anchors"><a class="self" href="/v5/api/providers/provider/#Provider-getBlock"></a><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/providers/src.ts/base-provider.ts#L936">source</a></div></div><div class="body"><p>Get the <i>block</i> from the network, where the <code class="inline">result.transactions</code> is a list of transaction hashes.</p>
|
||||
|
||||
@ -81,7 +81,7 @@ provider.getBlockWithTransactions(100004)
|
||||
</span><span class="result ok">// blockHash: '0xf93283571ae16dcecbe1816adc126954a739350cd1523a1559eabeae155fbb63',
|
||||
</span><span class="result ok">// blockNumber: 100004,
|
||||
</span><span class="result ok">// chainId: 0,
|
||||
</span><span class="result ok">// confirmations: 10284646,
|
||||
</span><span class="result ok">// confirmations: 10297123,
|
||||
</span><span class="result ok">// creates: null,
|
||||
</span><span class="result ok">// data: '0x',
|
||||
</span><span class="result ok">// from: '0xcf00A85f3826941e7A25BFcF9Aac575d40410852',
|
||||
@ -139,16 +139,16 @@ provider.getBlockWithTransactions(100004)
|
||||
</span>
|
||||
<span class="comment">// The current block number
|
||||
</span>provider.getBlockNumber()
|
||||
<span class="result ok">// { Promise: 10384649 }
|
||||
<span class="result ok">// { Promise: 10397126 }
|
||||
</span>
|
||||
<span class="comment">// Get the current suggested gas price (in wei)...
|
||||
</span>gasPrice = await provider.getGasPrice()
|
||||
<span class="result ok">// { BigNumber: "41000000000" }
|
||||
<span class="result ok">// { BigNumber: "19000001123" }
|
||||
</span>
|
||||
<span class="comment">// ...often this gas price is easier to understand or
|
||||
</span><span class="comment">// display to the user in gwei (giga-wei, or 1e9 wei)
|
||||
</span>utils.formatUnits(gasPrice, "gwei")
|
||||
<span class="result ok">// '41.0'
|
||||
<span class="result ok">// '19.000001123'
|
||||
</span></div><a name="Provider--transaction-methods"></a><a name="Provider--Provider--transaction-methods"></a><h2 class="show-anchors"><div>Transactions Methods<div class="anchors"><a class="self" href="/v5/api/providers/provider/#Provider--transaction-methods"></a></div></div></h2>
|
||||
<a name="Provider-call"></a><div class="property show-anchors"><div class="signature"><span class="path">provider</span><span class="symbol">.</span><span class="method">call</span><span class="symbol">(</span> <span class="param">transaction</span> <span class="symbol">[</span> <span class="symbol">,</span> <span class="param">blockTag</span> = <span class="param">latest</span> <span class="symbol">]</span> <span class="symbol">)</span> <span class="arrow">⇒</span> <span class="returns">Promise< string< <a href="/v5/api/utils/bytes/#DataHexString">DataHexString</a> > ></span><div class="anchors"><a class="self" href="/v5/api/providers/provider/#Provider-call"></a><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/providers/src.ts/base-provider.ts#L836">source</a></div></div><div class="body"><p>Returns the result of executing the <i>transaction</i>, using <i>call</i>. A call does not require any ether, but cannot change any state. This is useful for calling gettings on Contracts.</p>
|
||||
|
||||
@ -250,7 +250,7 @@ provider.on("error", (tx) => {
|
||||
<div class="nav previous"><a href="/v5/api/providers/"><span class="arrow">←</span>Providers</a></div>
|
||||
<div class="nav next"><a href="/v5/api/providers/jsonrpc-provider/">JsonRpcProvider<span class="arrow">→</span></a></div>
|
||||
</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 3, 2020, 1:44am.</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 5, 2020, 12:0am.</div>
|
||||
</div>
|
||||
<script src="/v5/static/script.js" type="text/javascript"></script>
|
||||
</body>
|
||||
|
@ -187,7 +187,7 @@
|
||||
<div class="nav previous"><a href="/v5/api/providers/other/"><span class="arrow">←</span>Other Providers</a></div>
|
||||
<div class="nav next"><a href="/v5/api/utils/">Utilities<span class="arrow">→</span></a></div>
|
||||
</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 3, 2020, 1:44am.</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 5, 2020, 12:0am.</div>
|
||||
</div>
|
||||
<script src="/v5/static/script.js" type="text/javascript"></script>
|
||||
</body>
|
||||
|
@ -285,7 +285,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: "8814410125722568213383" }
|
||||
// { BigNumber: "9709905125722568213383" }
|
||||
|
||||
//
|
||||
// Pre-flight (check for revert) on DAI from the signer
|
||||
|
@ -215,7 +215,7 @@ contract = new ethers.Contract("dai.tokens.ethers.eth", abi, signer)
|
||||
|
||||
<span class="comment">// Get the number of tokens for this account
|
||||
</span>tokens = await contract.balanceOf(signer.getAddress())
|
||||
<span class="result ok">// { BigNumber: "8814410125722568213383" }
|
||||
<span class="result ok">// { BigNumber: "9709905125722568213383" }
|
||||
</span>
|
||||
//
|
||||
<span class="comment">// Pre-flight (check for revert) on DAI from the signer
|
||||
@ -247,7 +247,7 @@ contract = new ethers.Contract("dai.tokens.ethers.eth", abi, signer)
|
||||
<div class="nav previous"><a href="/v5/api/contract/example/"><span class="arrow">←</span>Example: ERC-20 Contract</a></div>
|
||||
<div class="nav next"><a href="/v5/api/providers/">Providers<span class="arrow">→</span></a></div>
|
||||
</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 3, 2020, 1:44am.</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 5, 2020, 12:0am.</div>
|
||||
</div>
|
||||
<script src="/v5/static/script.js" type="text/javascript"></script>
|
||||
</body>
|
||||
|
@ -43,7 +43,7 @@
|
||||
<div class="nav previous"><a href="/v5/api/utils/abi/"><span class="arrow">←</span>Application Binary Interface</a></div>
|
||||
<div class="nav next"><a href="/v5/api/utils/abi/formats/">ABI Formats<span class="arrow">→</span></a></div>
|
||||
</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 3, 2020, 1:44am.</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 5, 2020, 12:0am.</div>
|
||||
</div>
|
||||
<script src="/v5/static/script.js" type="text/javascript"></script>
|
||||
</body>
|
||||
|
@ -28,7 +28,7 @@
|
||||
<div class="nav previous"><a href="/v5/api/utils/abi/coder/"><span class="arrow">←</span>AbiCoder</a></div>
|
||||
<div class="nav next"><a href="/v5/api/utils/abi/fragments/">Fragments<span class="arrow">→</span></a></div>
|
||||
</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 3, 2020, 1:44am.</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 5, 2020, 12:0am.</div>
|
||||
</div>
|
||||
<script src="/v5/static/script.js" type="text/javascript"></script>
|
||||
</body>
|
||||
|
@ -131,7 +131,7 @@
|
||||
<div class="nav previous"><a href="/v5/api/utils/abi/formats/"><span class="arrow">←</span>ABI Formats</a></div>
|
||||
<div class="nav next"><a href="/v5/api/utils/abi/interface/">Interface<span class="arrow">→</span></a></div>
|
||||
</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 3, 2020, 1:44am.</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 5, 2020, 12:0am.</div>
|
||||
</div>
|
||||
<script src="/v5/static/script.js" type="text/javascript"></script>
|
||||
</body>
|
||||
|
@ -28,7 +28,7 @@
|
||||
<div class="nav previous"><a href="/v5/api/utils/"><span class="arrow">←</span>Utilities</a></div>
|
||||
<div class="nav next"><a href="/v5/api/utils/abi/coder/">AbiCoder<span class="arrow">→</span></a></div>
|
||||
</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 3, 2020, 1:44am.</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 5, 2020, 12:0am.</div>
|
||||
</div>
|
||||
<script src="/v5/static/script.js" type="text/javascript"></script>
|
||||
</body>
|
||||
|
@ -122,7 +122,7 @@
|
||||
<div class="nav previous"><a href="/v5/api/utils/abi/fragments/"><span class="arrow">←</span>Fragments</a></div>
|
||||
<div class="nav next"><a href="/v5/api/utils/address/">Addresses<span class="arrow">→</span></a></div>
|
||||
</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 3, 2020, 1:44am.</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 5, 2020, 12:0am.</div>
|
||||
</div>
|
||||
<script src="/v5/static/script.js" type="text/javascript"></script>
|
||||
</body>
|
||||
|
@ -62,7 +62,7 @@
|
||||
<div class="nav previous"><a href="/v5/api/utils/abi/interface/"><span class="arrow">←</span>Interface</a></div>
|
||||
<div class="nav next"><a href="/v5/api/utils/bignumber/">BigNumber<span class="arrow">→</span></a></div>
|
||||
</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 3, 2020, 1:44am.</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 5, 2020, 12:0am.</div>
|
||||
</div>
|
||||
<script src="/v5/static/script.js" type="text/javascript"></script>
|
||||
</body>
|
||||
|
@ -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.2)
|
||||
// Error: overflow (fault="overflow", operation="BigNumber.from", value=9007199254740991, code=NUMERIC_FAULT, version=bignumber/5.0.3)
|
||||
```
|
||||
|
||||
Methods
|
||||
|
@ -77,7 +77,7 @@ one2
|
||||
</span>
|
||||
<span class="comment">// Numbers outside the safe range fail:
|
||||
</span>BigNumber.from(Number.MAX_SAFE_INTEGER);
|
||||
<span class="result error">// Error: overflow (fault="overflow", operation="BigNumber.from", value=9007199254740991, code=NUMERIC_FAULT, version=bignumber/5.0.2)
|
||||
<span class="result error">// Error: overflow (fault="overflow", operation="BigNumber.from", value=9007199254740991, code=NUMERIC_FAULT, version=bignumber/5.0.3)
|
||||
</span></div><a name="BigNumber--methods"></a><a name="BigNumber--BigNumber--methods"></a><h2 class="show-anchors"><div>Methods<div class="anchors"><a class="self" href="/v5/api/utils/bignumber/#BigNumber--methods"></a></div></div></h2><p>The BigNumber class is immutable, so no operations can change the value it represents.</p>
|
||||
|
||||
<a name="BigNumber--BigNumber--methods--math-operations"></a><h3 class="show-anchors"><div>Math Operations<div class="anchors"><a class="self" href="/v5/api/utils/bignumber/#BigNumber--BigNumber--methods--math-operations"></a></div></div></h3>
|
||||
@ -95,7 +95,7 @@ one2
|
||||
|
||||
</div></div><div class="property show-anchors"><div class="signature"><span class="path">BigNumber</span><span class="symbol">.</span><span class="method">abs</span><span class="symbol">(</span> <span class="symbol">)</span> <span class="arrow">⇒</span> <span class="returns"><a href="/v5/api/utils/bignumber/">BigNumber</a></span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/bignumber/src.ts/bignumber.ts#L64">source</a></div></div><div class="body"><p>Returns a BigNumber with the absolute value of <i>BigNumber</i>.</p>
|
||||
|
||||
</div></div><div class="property show-anchors"><div class="signature"><span class="path">BigNumber</span><span class="symbol">.</span><span class="method">mask</span><span class="symbol">(</span> <span class="param">bitcount</span> <span class="symbol">)</span> <span class="arrow">⇒</span> <span class="returns"><a href="/v5/api/utils/bignumber/">BigNumber</a></span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/bignumber/src.ts/bignumber.ts#L127">source</a></div></div><div class="body"><p>Returns a BigNumber with the value of <i>BigNumber</i> with bits beyond the <i>bitcount</i> least significant bits set to zero.</p>
|
||||
</div></div><div class="property show-anchors"><div class="signature"><span class="path">BigNumber</span><span class="symbol">.</span><span class="method">mask</span><span class="symbol">(</span> <span class="param">bitcount</span> <span class="symbol">)</span> <span class="arrow">⇒</span> <span class="returns"><a href="/v5/api/utils/bignumber/">BigNumber</a></span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/bignumber/src.ts/bignumber.ts#L131">source</a></div></div><div class="body"><p>Returns a BigNumber with the value of <i>BigNumber</i> with bits beyond the <i>bitcount</i> least significant bits set to zero.</p>
|
||||
|
||||
</div></div><a name="BigNumber--BigNumber--methods--two-s-compliment"></a><h3 class="show-anchors"><div>Two's Compliment<div class="anchors"><a class="self" href="/v5/api/utils/bignumber/#BigNumber--BigNumber--methods--two-s-compliment"></a></div></div></h3><p><a href="https://en.wikipedia.org/wiki/Two%27s_complement">Two's Complicment</a> is an elegant method used to encode and decode fixed-width signed values while efficiently preserving mathematic operations. Most users will not need to interact with these.</p>
|
||||
|
||||
@ -104,29 +104,29 @@ one2
|
||||
</div></div><div class="property show-anchors"><div class="signature"><span class="path">BigNumber</span><span class="symbol">.</span><span class="method">toTwos</span><span class="symbol">(</span> <span class="param">bitwidth</span> <span class="symbol">)</span> <span class="arrow">⇒</span> <span class="returns"><a href="/v5/api/utils/bignumber/">BigNumber</a></span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/bignumber/src.ts/bignumber.ts#L60">source</a></div></div><div class="body"><p>Returns a BigNumber with the value of <i>BigNumber</i> converted to twos-compliment with <i>bitwidth</i>.</p>
|
||||
|
||||
</div></div><a name="BigNumber--BigNumber--methods--comparison-and-equivalence"></a><h3 class="show-anchors"><div>Comparison and Equivalence<div class="anchors"><a class="self" href="/v5/api/utils/bignumber/#BigNumber--BigNumber--methods--comparison-and-equivalence"></a></div></div></h3>
|
||||
<div class="property show-anchors"><div class="signature"><span class="path">BigNumber</span><span class="symbol">.</span><span class="method">eq</span><span class="symbol">(</span> <span class="param">otherValue</span> <span class="symbol">)</span> <span class="arrow">⇒</span> <span class="returns">boolean</span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/bignumber/src.ts/bignumber.ts#L148">source</a></div></div><div class="body"><p>Returns true if and only if the value of <i>BigNumber</i> is equal to <i>otherValue</i>.</p>
|
||||
<div class="property show-anchors"><div class="signature"><span class="path">BigNumber</span><span class="symbol">.</span><span class="method">eq</span><span class="symbol">(</span> <span class="param">otherValue</span> <span class="symbol">)</span> <span class="arrow">⇒</span> <span class="returns">boolean</span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/bignumber/src.ts/bignumber.ts#L152">source</a></div></div><div class="body"><p>Returns true if and only if the value of <i>BigNumber</i> is equal to <i>otherValue</i>.</p>
|
||||
|
||||
</div></div><div class="property show-anchors"><div class="signature"><span class="path">BigNumber</span><span class="symbol">.</span><span class="method">lt</span><span class="symbol">(</span> <span class="param">otherValue</span> <span class="symbol">)</span> <span class="arrow">⇒</span> <span class="returns">boolean</span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/bignumber/src.ts/bignumber.ts#L152">source</a></div></div><div class="body"><p>Returns true if and only if the value of <i>BigNumber</i> <b><</b> <i>otherValue</i>.</p>
|
||||
</div></div><div class="property show-anchors"><div class="signature"><span class="path">BigNumber</span><span class="symbol">.</span><span class="method">lt</span><span class="symbol">(</span> <span class="param">otherValue</span> <span class="symbol">)</span> <span class="arrow">⇒</span> <span class="returns">boolean</span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/bignumber/src.ts/bignumber.ts#L156">source</a></div></div><div class="body"><p>Returns true if and only if the value of <i>BigNumber</i> <b><</b> <i>otherValue</i>.</p>
|
||||
|
||||
</div></div><div class="property show-anchors"><div class="signature"><span class="path">BigNumber</span><span class="symbol">.</span><span class="method">lte</span><span class="symbol">(</span> <span class="param">otherValue</span> <span class="symbol">)</span> <span class="arrow">⇒</span> <span class="returns">boolean</span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/bignumber/src.ts/bignumber.ts#L156">source</a></div></div><div class="body"><p>Returns true if and only if the value of <i>BigNumber</i> <b>≤</b> <i>otherValue</i>.</p>
|
||||
</div></div><div class="property show-anchors"><div class="signature"><span class="path">BigNumber</span><span class="symbol">.</span><span class="method">lte</span><span class="symbol">(</span> <span class="param">otherValue</span> <span class="symbol">)</span> <span class="arrow">⇒</span> <span class="returns">boolean</span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/bignumber/src.ts/bignumber.ts#L160">source</a></div></div><div class="body"><p>Returns true if and only if the value of <i>BigNumber</i> <b>≤</b> <i>otherValue</i>.</p>
|
||||
|
||||
</div></div><div class="property show-anchors"><div class="signature"><span class="path">BigNumber</span><span class="symbol">.</span><span class="method">gt</span><span class="symbol">(</span> <span class="param">otherValue</span> <span class="symbol">)</span> <span class="arrow">⇒</span> <span class="returns">boolean</span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/bignumber/src.ts/bignumber.ts#L160">source</a></div></div><div class="body"><p>Returns true if and only if the value of <i>BigNumber</i> <b>></b> <i>otherValue</i>.</p>
|
||||
</div></div><div class="property show-anchors"><div class="signature"><span class="path">BigNumber</span><span class="symbol">.</span><span class="method">gt</span><span class="symbol">(</span> <span class="param">otherValue</span> <span class="symbol">)</span> <span class="arrow">⇒</span> <span class="returns">boolean</span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/bignumber/src.ts/bignumber.ts#L164">source</a></div></div><div class="body"><p>Returns true if and only if the value of <i>BigNumber</i> <b>></b> <i>otherValue</i>.</p>
|
||||
|
||||
</div></div><div class="property show-anchors"><div class="signature"><span class="path">BigNumber</span><span class="symbol">.</span><span class="method">gte</span><span class="symbol">(</span> <span class="param">otherValue</span> <span class="symbol">)</span> <span class="arrow">⇒</span> <span class="returns">boolean</span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/bignumber/src.ts/bignumber.ts#L164">source</a></div></div><div class="body"><p>Returns true if and only if the value of <i>BigNumber</i> <b>≥</b> <i>otherValue</i>.</p>
|
||||
</div></div><div class="property show-anchors"><div class="signature"><span class="path">BigNumber</span><span class="symbol">.</span><span class="method">gte</span><span class="symbol">(</span> <span class="param">otherValue</span> <span class="symbol">)</span> <span class="arrow">⇒</span> <span class="returns">boolean</span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/bignumber/src.ts/bignumber.ts#L168">source</a></div></div><div class="body"><p>Returns true if and only if the value of <i>BigNumber</i> <b>≥</b> <i>otherValue</i>.</p>
|
||||
|
||||
</div></div><div class="property show-anchors"><div class="signature"><span class="path">BigNumber</span><span class="symbol">.</span><span class="method">isZero</span><span class="symbol">(</span> <span class="symbol">)</span> <span class="arrow">⇒</span> <span class="returns">boolean</span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/bignumber/src.ts/bignumber.ts#L172">source</a></div></div><div class="body"><p>Returns true if and only if the value of <i>BigNumber</i> is zero.</p>
|
||||
</div></div><div class="property show-anchors"><div class="signature"><span class="path">BigNumber</span><span class="symbol">.</span><span class="method">isZero</span><span class="symbol">(</span> <span class="symbol">)</span> <span class="arrow">⇒</span> <span class="returns">boolean</span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/bignumber/src.ts/bignumber.ts#L176">source</a></div></div><div class="body"><p>Returns true if and only if the value of <i>BigNumber</i> is zero.</p>
|
||||
|
||||
</div></div><a name="BigNumber--BigNumber--methods--conversion"></a><h3 class="show-anchors"><div>Conversion<div class="anchors"><a class="self" href="/v5/api/utils/bignumber/#BigNumber--BigNumber--methods--conversion"></a></div></div></h3>
|
||||
<div class="property show-anchors"><div class="signature"><span class="path">BigNumber</span><span class="symbol">.</span><span class="method">toNumber</span><span class="symbol">(</span> <span class="symbol">)</span> <span class="arrow">⇒</span> <span class="returns">number</span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/bignumber/src.ts/bignumber.ts#L176">source</a></div></div><div class="body"><p>Returns the value of <i>BigNumber</i> as a JavaScript value.</p>
|
||||
<div class="property show-anchors"><div class="signature"><span class="path">BigNumber</span><span class="symbol">.</span><span class="method">toNumber</span><span class="symbol">(</span> <span class="symbol">)</span> <span class="arrow">⇒</span> <span class="returns">number</span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/bignumber/src.ts/bignumber.ts#L180">source</a></div></div><div class="body"><p>Returns the value of <i>BigNumber</i> as a JavaScript value.</p>
|
||||
|
||||
<p>This will <b>throw an error</b> if the value is greater than or equal to <i>Number.MAX_SAFE_INTEGER</i> or less than or equal to <i>Number.MIN_SAFE_INTEGER</i>.</p>
|
||||
|
||||
</div></div><div class="property show-anchors"><div class="signature"><span class="path">BigNumber</span><span class="symbol">.</span><span class="method">toString</span><span class="symbol">(</span> <span class="symbol">)</span> <span class="arrow">⇒</span> <span class="returns">string</span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/bignumber/src.ts/bignumber.ts#L185">source</a></div></div><div class="body"><p>Returns the value of <i>BigNumber</i> as a base-10 string.</p>
|
||||
</div></div><div class="property show-anchors"><div class="signature"><span class="path">BigNumber</span><span class="symbol">.</span><span class="method">toString</span><span class="symbol">(</span> <span class="symbol">)</span> <span class="arrow">⇒</span> <span class="returns">string</span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/bignumber/src.ts/bignumber.ts#L189">source</a></div></div><div class="body"><p>Returns the value of <i>BigNumber</i> as a base-10 string.</p>
|
||||
|
||||
</div></div><div class="property show-anchors"><div class="signature"><span class="path">BigNumber</span><span class="symbol">.</span><span class="method">toHexString</span><span class="symbol">(</span> <span class="symbol">)</span> <span class="arrow">⇒</span> <span class="returns">string< <a href="/v5/api/utils/bytes/#DataHexString">DataHexString</a> ></span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/bignumber/src.ts/bignumber.ts#L193">source</a></div></div><div class="body"><p>Returns the value of <i>BigNumber</i> as a base-16, <code class="inline">0x</code>-prefixed <a href="/v5/api/utils/bytes/#DataHexString">DataHexString</a>.</p>
|
||||
</div></div><div class="property show-anchors"><div class="signature"><span class="path">BigNumber</span><span class="symbol">.</span><span class="method">toHexString</span><span class="symbol">(</span> <span class="symbol">)</span> <span class="arrow">⇒</span> <span class="returns">string< <a href="/v5/api/utils/bytes/#DataHexString">DataHexString</a> ></span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/bignumber/src.ts/bignumber.ts#L197">source</a></div></div><div class="body"><p>Returns the value of <i>BigNumber</i> as a base-16, <code class="inline">0x</code>-prefixed <a href="/v5/api/utils/bytes/#DataHexString">DataHexString</a>.</p>
|
||||
|
||||
</div></div><a name="BigNumber--BigNumber--methods--inspection"></a><h3 class="show-anchors"><div>Inspection<div class="anchors"><a class="self" href="/v5/api/utils/bignumber/#BigNumber--BigNumber--methods--inspection"></a></div></div></h3>
|
||||
<div class="property show-anchors"><div class="signature"><span class="path">ethers</span><span class="symbol">.</span><span class="path">BigNumnber</span><span class="symbol">.</span><span class="method">isBigNumber</span><span class="symbol">(</span> <span class="param">object</span> <span class="symbol">)</span> <span class="arrow">⇒</span> <span class="returns">boolean</span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/bignumber/src.ts/bignumber.ts#L246">source</a></div></div><div class="body"><p>Returns true if and only if the <i>object</i> is a BigNumber object.</p>
|
||||
<div class="property show-anchors"><div class="signature"><span class="path">ethers</span><span class="symbol">.</span><span class="path">BigNumnber</span><span class="symbol">.</span><span class="method">isBigNumber</span><span class="symbol">(</span> <span class="param">object</span> <span class="symbol">)</span> <span class="arrow">⇒</span> <span class="returns">boolean</span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/bignumber/src.ts/bignumber.ts#L250">source</a></div></div><div class="body"><p>Returns true if and only if the <i>object</i> is a BigNumber object.</p>
|
||||
|
||||
</div></div><a name="BigNumber--BigNumber--methods--examples"></a><h3 class="show-anchors"><div>Examples<div class="anchors"><a class="self" href="/v5/api/utils/bignumber/#BigNumber--BigNumber--methods--examples"></a></div></div></h3>
|
||||
<div class="code">let a = BigNumber.from(42);
|
||||
@ -178,7 +178,7 @@ a.mul(b);
|
||||
<div class="nav previous"><a href="/v5/api/utils/address/"><span class="arrow">←</span>Addresses</a></div>
|
||||
<div class="nav next"><a href="/v5/api/utils/bytes/">Byte Manipulation<span class="arrow">→</span></a></div>
|
||||
</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 3, 2020, 1:44am.</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 5, 2020, 12:0am.</div>
|
||||
</div>
|
||||
<script src="/v5/static/script.js" type="text/javascript"></script>
|
||||
</body>
|
||||
|
@ -164,20 +164,20 @@ Return a copy of *array* shuffled using [Fisher-Yates Shuffle](https://en.wikipe
|
||||
|
||||
```javascript
|
||||
utils.randomBytes(8)
|
||||
// Uint8Array [ 95, 9, 0, 81, 176, 49, 211, 225 ]
|
||||
// Uint8Array [ 158, 14, 185, 6, 8, 37, 214, 172 ]
|
||||
|
||||
const data = [ 1, 2, 3, 4, 5, 6, 7 ];
|
||||
|
||||
// Returns a new Array
|
||||
utils.shuffled(data);
|
||||
// [
|
||||
// 6,
|
||||
// 7,
|
||||
// 4,
|
||||
// 3,
|
||||
// 5,
|
||||
// 1,
|
||||
// 2
|
||||
// 3,
|
||||
// 4,
|
||||
// 7,
|
||||
// 2,
|
||||
// 5,
|
||||
// 6
|
||||
// ]
|
||||
|
||||
// The Original is unscathed...
|
||||
|
@ -105,20 +105,20 @@
|
||||
</div></div><a name="utils-shuffled"></a><div class="property show-anchors"><div class="signature"><span class="path">ethers</span><span class="symbol">.</span><span class="path">utils</span><span class="symbol">.</span><span class="method">shuffled</span><span class="symbol">(</span> <span class="param">array</span> <span class="symbol">)</span> <span class="arrow">⇒</span> <span class="returns">Array< any ></span><div class="anchors"><a class="self" href="/v5/api/utils/bytes/#utils-shuffled"></a><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/random/src.ts/shuffle.ts#L3">source</a></div></div><div class="body"><p>Return a copy of <i>array</i> shuffled using <a href="https://en.wikipedia.org/wiki/Fisher-Yates_shuffle">Fisher-Yates Shuffle</a>.</p>
|
||||
|
||||
</div></div><div class="code-title"><div>Examples</div></div><div class="code">utils.randomBytes(8)
|
||||
<span class="result ok">// Uint8Array [ 95, 9, 0, 81, 176, 49, 211, 225 ]
|
||||
<span class="result ok">// Uint8Array [ 158, 14, 185, 6, 8, 37, 214, 172 ]
|
||||
</span>
|
||||
const data = [ 1, 2, 3, 4, 5, 6, 7 ];
|
||||
|
||||
<span class="comment">// Returns a new Array
|
||||
</span>utils.shuffled(data);
|
||||
<span class="result ok">// [
|
||||
</span><span class="result ok">// 6,
|
||||
</span><span class="result ok">// 7,
|
||||
</span><span class="result ok">// 4,
|
||||
</span><span class="result ok">// 3,
|
||||
</span><span class="result ok">// 5,
|
||||
</span><span class="result ok">// 1,
|
||||
</span><span class="result ok">// 2
|
||||
</span><span class="result ok">// 3,
|
||||
</span><span class="result ok">// 4,
|
||||
</span><span class="result ok">// 7,
|
||||
</span><span class="result ok">// 2,
|
||||
</span><span class="result ok">// 5,
|
||||
</span><span class="result ok">// 6
|
||||
</span><span class="result ok">// ]
|
||||
</span>
|
||||
<span class="comment">// The Original is unscathed...
|
||||
@ -138,7 +138,7 @@ const data = [ 1, 2, 3, 4, 5, 6, 7 ];
|
||||
<div class="nav previous"><a href="/v5/api/utils/bignumber/"><span class="arrow">←</span>BigNumber</a></div>
|
||||
<div class="nav next"><a href="/v5/api/utils/constants/">Constants<span class="arrow">→</span></a></div>
|
||||
</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 3, 2020, 1:44am.</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 5, 2020, 12:0am.</div>
|
||||
</div>
|
||||
<script src="/v5/static/script.js" type="text/javascript"></script>
|
||||
</body>
|
||||
|
@ -45,7 +45,7 @@
|
||||
<div class="nav previous"><a href="/v5/api/utils/bytes/"><span class="arrow">←</span>Byte Manipulation</a></div>
|
||||
<div class="nav next"><a href="/v5/api/utils/display-logic/">Display Logic and Input<span class="arrow">→</span></a></div>
|
||||
</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 3, 2020, 1:44am.</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 5, 2020, 12:0am.</div>
|
||||
</div>
|
||||
<script src="/v5/static/script.js" type="text/javascript"></script>
|
||||
</body>
|
||||
|
@ -52,7 +52,7 @@
|
||||
<div class="nav previous"><a href="/v5/api/utils/constants/"><span class="arrow">←</span>Constants</a></div>
|
||||
<div class="nav next"><a href="/v5/api/utils/encoding/">Encoding Utilities<span class="arrow">→</span></a></div>
|
||||
</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 3, 2020, 1:44am.</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 5, 2020, 12:0am.</div>
|
||||
</div>
|
||||
<script src="/v5/static/script.js" type="text/javascript"></script>
|
||||
</body>
|
||||
|
@ -49,7 +49,7 @@
|
||||
<div class="nav previous"><a href="/v5/api/utils/display-logic/"><span class="arrow">←</span>Display Logic and Input</a></div>
|
||||
<div class="nav next"><a href="/v5/api/utils/fixednumber/">FixedNumber<span class="arrow">→</span></a></div>
|
||||
</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 3, 2020, 1:44am.</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 5, 2020, 12:0am.</div>
|
||||
</div>
|
||||
<script src="/v5/static/script.js" type="text/javascript"></script>
|
||||
</body>
|
||||
|
@ -90,7 +90,7 @@
|
||||
<div class="nav previous"><a href="/v5/api/utils/encoding/"><span class="arrow">←</span>Encoding Utilities</a></div>
|
||||
<div class="nav next"><a href="/v5/api/utils/hashing/">Hashing Algorithms<span class="arrow">→</span></a></div>
|
||||
</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 3, 2020, 1:44am.</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 5, 2020, 12:0am.</div>
|
||||
</div>
|
||||
<script src="/v5/static/script.js" type="text/javascript"></script>
|
||||
</body>
|
||||
|
@ -151,7 +151,7 @@ utils.soliditySha256([ "int16", "uint48" ], [ -1, 12 ])
|
||||
<div class="nav previous"><a href="/v5/api/utils/fixednumber/"><span class="arrow">←</span>FixedNumber</a></div>
|
||||
<div class="nav next"><a href="/v5/api/utils/hdnode/">HD Wallet<span class="arrow">→</span></a></div>
|
||||
</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 3, 2020, 1:44am.</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 5, 2020, 12:0am.</div>
|
||||
</div>
|
||||
<script src="/v5/static/script.js" type="text/javascript"></script>
|
||||
</body>
|
||||
|
@ -88,7 +88,7 @@
|
||||
<div class="nav previous"><a href="/v5/api/utils/hashing/"><span class="arrow">←</span>Hashing Algorithms</a></div>
|
||||
<div class="nav next"><a href="/v5/api/utils/logger/">Logging<span class="arrow">→</span></a></div>
|
||||
</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 3, 2020, 1:44am.</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 5, 2020, 12:0am.</div>
|
||||
</div>
|
||||
<script src="/v5/static/script.js" type="text/javascript"></script>
|
||||
</body>
|
||||
|
@ -24,7 +24,7 @@
|
||||
<div class="nav previous"><a href="/v5/api/providers/types/"><span class="arrow">←</span>Types</a></div>
|
||||
<div class="nav next"><a href="/v5/api/utils/abi/">Application Binary Interface<span class="arrow">→</span></a></div>
|
||||
</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 3, 2020, 1:44am.</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 5, 2020, 12:0am.</div>
|
||||
</div>
|
||||
<script src="/v5/static/script.js" type="text/javascript"></script>
|
||||
</body>
|
||||
|
@ -132,7 +132,7 @@
|
||||
<div class="nav previous"><a href="/v5/api/utils/hdnode/"><span class="arrow">←</span>HD Wallet</a></div>
|
||||
<div class="nav next"><a href="/v5/api/utils/properties/">Property Utilities<span class="arrow">→</span></a></div>
|
||||
</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 3, 2020, 1:44am.</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 5, 2020, 12:0am.</div>
|
||||
</div>
|
||||
<script src="/v5/static/script.js" type="text/javascript"></script>
|
||||
</body>
|
||||
|
@ -29,7 +29,7 @@
|
||||
<div class="nav previous"><a href="/v5/api/utils/logger/"><span class="arrow">←</span>Logging</a></div>
|
||||
<div class="nav next"><a href="/v5/api/utils/signing-key/">Signing Key<span class="arrow">→</span></a></div>
|
||||
</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 3, 2020, 1:44am.</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 5, 2020, 12:0am.</div>
|
||||
</div>
|
||||
<script src="/v5/static/script.js" type="text/javascript"></script>
|
||||
</body>
|
||||
|
@ -45,7 +45,7 @@
|
||||
<div class="nav previous"><a href="/v5/api/utils/properties/"><span class="arrow">←</span>Property Utilities</a></div>
|
||||
<div class="nav next"><a href="/v5/api/utils/strings/">Strings<span class="arrow">→</span></a></div>
|
||||
</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 3, 2020, 1:44am.</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 5, 2020, 12:0am.</div>
|
||||
</div>
|
||||
<script src="/v5/static/script.js" type="text/javascript"></script>
|
||||
</body>
|
||||
|
@ -98,7 +98,7 @@
|
||||
<div class="nav previous"><a href="/v5/api/utils/signing-key/"><span class="arrow">←</span>Signing Key</a></div>
|
||||
<div class="nav next"><a href="/v5/api/utils/transactions/">Transactions<span class="arrow">→</span></a></div>
|
||||
</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 3, 2020, 1:44am.</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 5, 2020, 12:0am.</div>
|
||||
</div>
|
||||
<script src="/v5/static/script.js" type="text/javascript"></script>
|
||||
</body>
|
||||
|
@ -81,7 +81,7 @@
|
||||
<div class="nav previous"><a href="/v5/api/utils/strings/"><span class="arrow">←</span>Strings</a></div>
|
||||
<div class="nav next"><a href="/v5/api/utils/web/">Web Utilities<span class="arrow">→</span></a></div>
|
||||
</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 3, 2020, 1:44am.</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 5, 2020, 12:0am.</div>
|
||||
</div>
|
||||
<script src="/v5/static/script.js" type="text/javascript"></script>
|
||||
</body>
|
||||
|
@ -61,7 +61,7 @@
|
||||
<div class="nav previous"><a href="/v5/api/utils/transactions/"><span class="arrow">←</span>Transactions</a></div>
|
||||
<div class="nav next"><a href="/v5/api/utils/wordlists/">Wordlists<span class="arrow">→</span></a></div>
|
||||
</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 3, 2020, 1:44am.</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 5, 2020, 12:0am.</div>
|
||||
</div>
|
||||
<script src="/v5/static/script.js" type="text/javascript"></script>
|
||||
</body>
|
||||
|
@ -58,7 +58,7 @@
|
||||
<div class="nav previous"><a href="/v5/api/utils/web/"><span class="arrow">←</span>Web Utilities</a></div>
|
||||
<div class="nav next"><a href="/v5/api/other/">Other Libraries<span class="arrow">→</span></a></div>
|
||||
</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 3, 2020, 1:44am.</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 5, 2020, 12:0am.</div>
|
||||
</div>
|
||||
<script src="/v5/static/script.js" type="text/javascript"></script>
|
||||
</body>
|
||||
|
@ -180,7 +180,7 @@ return(0, #myContract)
|
||||
<div class="nav previous"><a href="/v5/cli/ethers/"><span class="arrow">←</span>Sandbox Utility</a></div>
|
||||
<div class="nav next"><a href="/v5/cli/ens/">Ethereum Naming Service<span class="arrow">→</span></a></div>
|
||||
</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 3, 2020, 1:44am.</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 5, 2020, 12:0am.</div>
|
||||
</div>
|
||||
<script src="/v5/static/script.js" type="text/javascript"></script>
|
||||
</body>
|
||||
|
@ -94,7 +94,7 @@ OTHER OPTIONS
|
||||
<div class="nav previous"><a href="/v5/cli/asm/"><span class="arrow">←</span>Assembler</a></div>
|
||||
<div class="nav next"><a href="/v5/cli/typescript/">TypeScript<span class="arrow">→</span></a></div>
|
||||
</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 3, 2020, 1:44am.</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 5, 2020, 12:0am.</div>
|
||||
</div>
|
||||
<script src="/v5/static/script.js" type="text/javascript"></script>
|
||||
</body>
|
||||
|
@ -209,7 +209,7 @@ homestead></div><div class="definition container-box warning"><div class="ter
|
||||
<div class="nav previous"><a href="/v5/cli/"><span class="arrow">←</span>Command Line Interfaces</a></div>
|
||||
<div class="nav next"><a href="/v5/cli/asm/">Assembler<span class="arrow">→</span></a></div>
|
||||
</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 3, 2020, 1:44am.</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 5, 2020, 12:0am.</div>
|
||||
</div>
|
||||
<script src="/v5/static/script.js" type="text/javascript"></script>
|
||||
</body>
|
||||
|
@ -23,7 +23,7 @@
|
||||
<div class="nav previous"><a href="/v5/api/experimental/"><span class="arrow">←</span>Experimental</a></div>
|
||||
<div class="nav next"><a href="/v5/cli/ethers/">Sandbox Utility<span class="arrow">→</span></a></div>
|
||||
</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 3, 2020, 1:44am.</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 5, 2020, 12:0am.</div>
|
||||
</div>
|
||||
<script src="/v5/static/script.js" type="text/javascript"></script>
|
||||
</body>
|
||||
|
@ -102,7 +102,7 @@
|
||||
<div class="nav previous"><a href="/v5/cli/typescript/"><span class="arrow">←</span>TypeScript</a></div>
|
||||
<div class="nav next"><a href="/v5/cookbook/">Cookbook<span class="arrow">→</span></a></div>
|
||||
</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 3, 2020, 1:44am.</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 5, 2020, 12:0am.</div>
|
||||
</div>
|
||||
<script src="/v5/static/script.js" type="text/javascript"></script>
|
||||
</body>
|
||||
|
@ -42,7 +42,7 @@ OTHER OPTIONS
|
||||
<div class="nav previous"><a href="/v5/cli/ens/"><span class="arrow">←</span>Ethereum Naming Service</a></div>
|
||||
<div class="nav next"><a href="/v5/cli/plugin/">Making Your Own<span class="arrow">→</span></a></div>
|
||||
</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 3, 2020, 1:44am.</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 5, 2020, 12:0am.</div>
|
||||
</div>
|
||||
<script src="/v5/static/script.js" type="text/javascript"></script>
|
||||
</body>
|
||||
|
@ -46,7 +46,7 @@
|
||||
<div class="nav previous"><!--PREV_LINK--></div>
|
||||
<div class="nav next"><!--NEXT_LINK--></div>
|
||||
</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 3, 2020, 1:44am.</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 5, 2020, 12:0am.</div>
|
||||
</div>
|
||||
<script src="/v5/static/script.js" type="text/javascript"></script>
|
||||
</body>
|
||||
|
@ -150,7 +150,7 @@ const contract = new Contract(tokenAddress, abi, provider);
|
||||
<div class="nav previous"><a href="/v5/concepts/"><span class="arrow">←</span>Ethereum Basics</a></div>
|
||||
<div class="nav next"><a href="/v5/concepts/gas/">Gas<span class="arrow">→</span></a></div>
|
||||
</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 3, 2020, 1:44am.</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 5, 2020, 12:0am.</div>
|
||||
</div>
|
||||
<script src="/v5/static/script.js" type="text/javascript"></script>
|
||||
</body>
|
||||
|
@ -27,7 +27,7 @@
|
||||
<div class="nav previous"><a href="/v5/concepts/events/"><span class="arrow">←</span>Events</a></div>
|
||||
<div class="nav next"><a href="/v5/concepts/security/">Security<span class="arrow">→</span></a></div>
|
||||
</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 3, 2020, 1:44am.</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 5, 2020, 12:0am.</div>
|
||||
</div>
|
||||
<script src="/v5/static/script.js" type="text/javascript"></script>
|
||||
</body>
|
||||
|
@ -26,7 +26,7 @@
|
||||
<div class="nav previous"><a href="/v5/getting-started/"><span class="arrow">←</span>Getting Started</a></div>
|
||||
<div class="nav next"><a href="/v5/concepts/events/">Events<span class="arrow">→</span></a></div>
|
||||
</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 3, 2020, 1:44am.</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 5, 2020, 12:0am.</div>
|
||||
</div>
|
||||
<script src="/v5/static/script.js" type="text/javascript"></script>
|
||||
</body>
|
||||
|
@ -62,7 +62,7 @@
|
||||
<div class="nav previous"><a href="/v5/concepts/gas/"><span class="arrow">←</span>Gas</a></div>
|
||||
<div class="nav next"><a href="/v5/api/">Application Programming Interface<span class="arrow">→</span></a></div>
|
||||
</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 3, 2020, 1:44am.</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 5, 2020, 12:0am.</div>
|
||||
</div>
|
||||
<script src="/v5/static/script.js" type="text/javascript"></script>
|
||||
</body>
|
||||
|
@ -81,7 +81,7 @@
|
||||
<div class="nav previous"><a href="/v5/testing/"><span class="arrow">←</span>Testing</a></div>
|
||||
<div class="nav next"><a href="/v5/documentation/">Flatworm Docs<span class="arrow">→</span></a></div>
|
||||
</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 3, 2020, 1:44am.</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 5, 2020, 12:0am.</div>
|
||||
</div>
|
||||
<script src="/v5/static/script.js" type="text/javascript"></script>
|
||||
</body>
|
||||
|
@ -24,7 +24,7 @@
|
||||
<div class="nav previous"><a href="/v5/cli/plugin/"><span class="arrow">←</span>Making Your Own</a></div>
|
||||
<div class="nav next"><a href="/v5/migration/">Migration Guide<span class="arrow">→</span></a></div>
|
||||
</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 3, 2020, 1:44am.</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 5, 2020, 12:0am.</div>
|
||||
</div>
|
||||
<script src="/v5/static/script.js" type="text/javascript"></script>
|
||||
</body>
|
||||
|
@ -282,7 +282,7 @@ $bottom: This just represents an example of
|
||||
<div class="nav previous"><a href="/v5/contributing/"><span class="arrow">←</span>Contributing and Hacking</a></div>
|
||||
<div class="nav next"><a href="/v5/license/">License and Copyright<span class="arrow">→</span></a></div>
|
||||
</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 3, 2020, 1:44am.</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 5, 2020, 12:0am.</div>
|
||||
</div>
|
||||
<script src="/v5/static/script.js" type="text/javascript"></script>
|
||||
</body>
|
||||
|
@ -30,8 +30,10 @@ import { ethers } from "ethers";
|
||||
### Web Browser
|
||||
|
||||
```
|
||||
<script src="https://cdn.ethers.io/lib/ethers-5.0.esm.min.js"
|
||||
type="application/javascipt"></script>
|
||||
<script type="module">
|
||||
import { ethers } from "https://cdn.ethers.io/lib/ethers-5.0.esm.min.js";
|
||||
// Your code here...
|
||||
</script>
|
||||
```
|
||||
|
||||
```
|
||||
@ -65,7 +67,7 @@ const signer = provider.getSigner()
|
||||
```javascript
|
||||
// Look up the current block number
|
||||
provider.getBlockNumber()
|
||||
// { Promise: 10384649 }
|
||||
// { Promise: 10397126 }
|
||||
|
||||
// Get the balance of an account (by address or ENS name)
|
||||
balance = await provider.getBalance("ethers.eth")
|
||||
@ -133,11 +135,11 @@ daiContract.symbol()
|
||||
|
||||
// Get the balance of an address
|
||||
balance = await daiContract.balanceOf("ricmoo.firefly.eth")
|
||||
// { BigNumber: "8814410125722568213383" }
|
||||
// { BigNumber: "9709905125722568213383" }
|
||||
|
||||
// Format the DAI for displaying to the user
|
||||
ethers.utils.formatUnits(balance, 18)
|
||||
// '8814.410125722568213383'
|
||||
// '9709.905125722568213383'
|
||||
```
|
||||
|
||||
### State Changing Methods
|
||||
@ -292,7 +294,7 @@ Signing Messages
|
||||
// logging into a service, such as CryptoKitties simply
|
||||
// pass the string in.
|
||||
signature = await signer.signMessage("Hello World");
|
||||
// '0x9671c8b89473038593fddda5875debcb517dbfe79bd25119f6b0878bcd6c5e9d497e5d7f08cb7314da5d2a04b49bee0918d0b9e11744ee5a738b94e38986575f1c'
|
||||
// '0x7b8d663c680b165bb7b0601a65d730f532fa6427b2e30f1d91ff1d929712b3a50b427a672b90c1dc48a4e5fbde292fbded51f670ab57d15d5794b6ff015649611c'
|
||||
|
||||
//
|
||||
// A common case is also signing a hash, which is 32
|
||||
@ -309,6 +311,6 @@ messageBytes = ethers.utils.arrayify(message);
|
||||
|
||||
// To sign a hash, you most often want to sign the bytes
|
||||
signature = await signer.signMessage(messageBytes)
|
||||
// '0xfff17b9972cf8466bcde13dfc52afe6cbe39b86b1c9028d0fe4de6ab565ce01a48b7eba3663a24588e87798d924e8178f3c7c84d9363f57a9bee519f7cac50b31b'
|
||||
// '0xc791b3d29aa1754f9e392784273f076ef39ca5d81f2729c92af61f89db724a604074acbd725d9d95e1d3c9630211c8eee8e34f6d948d537dd82c11be4bcf676e1c'
|
||||
```
|
||||
|
||||
|
@ -27,8 +27,10 @@
|
||||
|
||||
<p>For quick demos or prototyping though, it can be loaded in your Web Applications from our CDN.</p>
|
||||
|
||||
<div class="code-title"><div>ES6 in the Browser</div></div><div class="code"><script src="https://cdn.ethers.io/lib/ethers-5.0.esm.min.js"
|
||||
type="application/javascipt"></script></div><div class="code-title"><div>ES3 (UMD) in the Browser</div></div><div class="code"><script src="https://cdn.ethers.io/lib/ethers-5.0.umd.min.js"
|
||||
<div class="code-title"><div>ES6 in the Browser</div></div><div class="code"><script type="module">
|
||||
import { ethers } from "https://cdn.ethers.io/lib/ethers-5.0.esm.min.js";
|
||||
// Your code here...
|
||||
</script></div><div class="code-title"><div>ES3 (UMD) in the Browser</div></div><div class="code"><script src="https://cdn.ethers.io/lib/ethers-5.0.umd.min.js"
|
||||
type="application/javascipt"></script></div><a name="getting-started--glossary"></a><a name="getting-started--getting-started--glossary"></a><h2 class="show-anchors"><div>Common Terminology<div class="anchors"><a class="self" href="/v5/getting-started/#getting-started--glossary"></a></div></div></h2><p>This section needs work...</p>
|
||||
|
||||
<table class="table minimal"><tr><td align="left"><b>Provider</b></td><td align="left">A Provider (in ethers) is a class which provides an abstraction for a connection to the Ethereum Network. It provides read-only access to the Blockchain and its status.</td><td class="fix"> </td></tr><tr><td align="left"><b>Signer</b></td><td align="left">A Signer is a class which (usually) in some way directly or indirectly has access to a private key, which can sign messages and transactions to authorize the network to charge your account ether to perform operations.</td><td class="fix"> </td></tr><tr><td align="left"><b>Contract</b></td><td align="left">A Contract is an abstraction which represents a connection to a specific contract on the Ethereum Network, so that it can be used like a normal JavaScipt object.</td><td class="fix"> </td></tr><tr><td class="table-title" colspan="2">Common Terms</td><td class="fix"> </td></tr></table><a name="getting-started--connecting"></a><a name="getting-started--getting-started--connecting"></a><h2 class="show-anchors"><div>Connecting to Ethereum: Metamask<div class="anchors"><a class="self" href="/v5/getting-started/#getting-started--connecting"></a></div></div></h2><p>The quickest and easiest way to experiment and begin developing on Ethereum is to use <a href="https://metamask.io/">Metamask</a>, which is a browser extension that provides:</p>
|
||||
@ -47,7 +49,7 @@
|
||||
|
||||
<div class="code-title"><div>Basic Queries</div></div><div class="code"><span class="comment">// Look up the current block number
|
||||
</span>provider.getBlockNumber()
|
||||
<span class="result ok">// { Promise: 10384649 }
|
||||
<span class="result ok">// { Promise: 10397126 }
|
||||
</span>
|
||||
<span class="comment">// Get the balance of an account (by address or ENS name)
|
||||
</span>balance = await provider.getBalance("ethers.eth")
|
||||
@ -115,11 +117,11 @@
|
||||
</span>
|
||||
<span class="comment">// Get the balance of an address
|
||||
</span>balance = await daiContract.balanceOf("ricmoo.firefly.eth")
|
||||
<span class="result ok">// { BigNumber: "8814410125722568213383" }
|
||||
<span class="result ok">// { BigNumber: "9709905125722568213383" }
|
||||
</span>
|
||||
<span class="comment">// Format the DAI for displaying to the user
|
||||
</span>ethers.utils.formatUnits(balance, 18)
|
||||
<span class="result ok">// '8814.410125722568213383'
|
||||
<span class="result ok">// '9709.905125722568213383'
|
||||
</span></div><a name="getting-started--writing"></a><a name="getting-started--getting-started--contracts--getting-started--writing"></a><h3 class="show-anchors"><div>State Changing Methods<div class="anchors"><a class="self" href="/v5/getting-started/#getting-started--writing"></a></div></div></h3>
|
||||
<div class="code-title"><div>Sending DAI</div></div><div class="code"><span class="comment">// The DAI Contract is currently connected to the Provider,
|
||||
</span><span class="comment">// which is read-only. We need to connect to a Signer, so
|
||||
@ -257,7 +259,7 @@ filter = daiContract.filters.Transfer(null, myAddress)
|
||||
</span><span class="comment">// logging into a service, such as CryptoKitties simply
|
||||
</span><span class="comment">// pass the string in.
|
||||
</span>signature = await signer.signMessage("Hello World");
|
||||
<span class="result ok">// '0x9671c8b89473038593fddda5875debcb517dbfe79bd25119f6b0878bcd6c5e9d497e5d7f08cb7314da5d2a04b49bee0918d0b9e11744ee5a738b94e38986575f1c'
|
||||
<span class="result ok">// '0x7b8d663c680b165bb7b0601a65d730f532fa6427b2e30f1d91ff1d929712b3a50b427a672b90c1dc48a4e5fbde292fbded51f670ab57d15d5794b6ff015649611c'
|
||||
</span>
|
||||
//
|
||||
<span class="comment">// A common case is also signing a hash, which is 32
|
||||
@ -274,14 +276,14 @@ filter = daiContract.filters.Transfer(null, myAddress)
|
||||
</span>
|
||||
<span class="comment">// To sign a hash, you most often want to sign the bytes
|
||||
</span>signature = await signer.signMessage(messageBytes)
|
||||
<span class="result ok">// '0xfff17b9972cf8466bcde13dfc52afe6cbe39b86b1c9028d0fe4de6ab565ce01a48b7eba3663a24588e87798d924e8178f3c7c84d9363f57a9bee519f7cac50b31b'
|
||||
<span class="result ok">// '0xc791b3d29aa1754f9e392784273f076ef39ca5d81f2729c92af61f89db724a604074acbd725d9d95e1d3c9630211c8eee8e34f6d948d537dd82c11be4bcf676e1c'
|
||||
</span></div>
|
||||
|
||||
<div class="footer">
|
||||
<div class="nav previous"><a href="/v5/"><span class="arrow">←</span>Documentation</a></div>
|
||||
<div class="nav next"><a href="/v5/concepts/">Ethereum Basics<span class="arrow">→</span></a></div>
|
||||
</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 3, 2020, 1:44am.</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 5, 2020, 12:0am.</div>
|
||||
</div>
|
||||
<script src="/v5/static/script.js" type="text/javascript"></script>
|
||||
</body>
|
||||
|
@ -46,7 +46,7 @@
|
||||
<div class="nav previous"><!--PREV_LINK--></div>
|
||||
<div class="nav next"><!--NEXT_LINK--></div>
|
||||
</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 3, 2020, 1:44am.</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 5, 2020, 12:0am.</div>
|
||||
</div>
|
||||
<script src="/v5/static/script.js" type="text/javascript"></script>
|
||||
</body>
|
||||
|
@ -32,7 +32,7 @@
|
||||
<div class="nav previous"><!--PREV_LINK--></div>
|
||||
<div class="nav next"><a href="/v5/getting-started/">Getting Started<span class="arrow">→</span></a></div>
|
||||
</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 3, 2020, 1:44am.</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 5, 2020, 12:0am.</div>
|
||||
</div>
|
||||
<script src="/v5/static/script.js" type="text/javascript"></script>
|
||||
</body>
|
||||
|
@ -32,7 +32,7 @@
|
||||
<div class="nav previous"><a href="/v5/documentation/"><span class="arrow">←</span>Flatworm Docs</a></div>
|
||||
<div class="nav next"><!--NEXT_LINK--></div>
|
||||
</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 3, 2020, 1:44am.</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 5, 2020, 12:0am.</div>
|
||||
</div>
|
||||
<script src="/v5/static/script.js" type="text/javascript"></script>
|
||||
</body>
|
||||
|
@ -108,7 +108,7 @@ interface.events.Transfer.decode(data, topics)
|
||||
|
||||
// v5
|
||||
interface.encodeFilterTopics("Transfer", values)
|
||||
interface.encodeEventLog("Transfer", data, topics)
|
||||
interface.decodeEventLog("Transfer", data, topics)
|
||||
```
|
||||
|
||||
### Inspection
|
||||
|
@ -97,7 +97,7 @@ interface.events.Transfer.decode(data, topics)
|
||||
|
||||
<span class="comment">// v5
|
||||
</span>interface.encodeFilterTopics("Transfer", values)
|
||||
interface.encodeEventLog("Transfer", data, topics)
|
||||
interface.decodeEventLog("Transfer", data, topics)
|
||||
</div><a name="migration-v4--interface--inspection"></a><h3 class="show-anchors"><div>Inspection<div class="anchors"><a class="self" href="/v5/migration/ethers-v4/#migration-v4--interface--inspection"></a></div></div></h3><p>Interrogating properties about a function or event can now (mostly) be done directly on the <a href="/v5/api/utils/abi/fragments/#Fragment">Fragment</a> object.</p>
|
||||
|
||||
<div class="code">// v4
|
||||
@ -168,7 +168,7 @@ wallet.mnemonic.path
|
||||
<div class="nav previous"><a href="/v5/migration/web3/"><span class="arrow">←</span>Migration: From Web3.js</a></div>
|
||||
<div class="nav next"><a href="/v5/testing/">Testing<span class="arrow">→</span></a></div>
|
||||
</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 3, 2020, 1:44am.</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 5, 2020, 12:0am.</div>
|
||||
</div>
|
||||
<script src="/v5/static/script.js" type="text/javascript"></script>
|
||||
</body>
|
||||
|
@ -24,7 +24,7 @@
|
||||
<div class="nav previous"><a href="/v5/cookbook/"><span class="arrow">←</span>Cookbook</a></div>
|
||||
<div class="nav next"><a href="/v5/migration/web3/">Migration: From Web3.js<span class="arrow">→</span></a></div>
|
||||
</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 3, 2020, 1:44am.</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 5, 2020, 12:0am.</div>
|
||||
</div>
|
||||
<script src="/v5/static/script.js" type="text/javascript"></script>
|
||||
</body>
|
||||
|
@ -28,7 +28,7 @@
|
||||
<div class="nav previous"><a href="/v5/migration/"><span class="arrow">←</span>Migration Guide</a></div>
|
||||
<div class="nav next"><a href="/v5/migration/ethers-v4/">Migration: From Ethers v4<span class="arrow">→</span></a></div>
|
||||
</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 3, 2020, 1:44am.</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 5, 2020, 12:0am.</div>
|
||||
</div>
|
||||
<script src="/v5/static/script.js" type="text/javascript"></script>
|
||||
</body>
|
||||
|
@ -36,8 +36,10 @@
|
||||
|
||||
<p>For quick demos or prototyping though, it can be loaded in your Web Applications from our CDN.</p>
|
||||
|
||||
<div class="code-title"><div>ES6 in the Browser</div></div><div class="code"><script src="https://cdn.ethers.io/lib/ethers-5.0.esm.min.js"
|
||||
type="application/javascipt"></script></div><div class="code-title"><div>ES3 (UMD) in the Browser</div></div><div class="code"><script src="https://cdn.ethers.io/lib/ethers-5.0.umd.min.js"
|
||||
<div class="code-title"><div>ES6 in the Browser</div></div><div class="code"><script type="module">
|
||||
import { ethers } from "https://cdn.ethers.io/lib/ethers-5.0.esm.min.js";
|
||||
// Your code here...
|
||||
</script></div><div class="code-title"><div>ES3 (UMD) in the Browser</div></div><div class="code"><script src="https://cdn.ethers.io/lib/ethers-5.0.umd.min.js"
|
||||
type="application/javascipt"></script></div><a name="/v5/getting-started/-%23-getting-started--glossary"></a><a name="/v5/getting-started/-%23-getting-started--getting-started--glossary"></a><a name="/v5/getting-started/"></a><h2 class="show-anchors"><div>Common Terminology<div class="anchors"><a class="self" href="#/v5/getting-started/-%23-getting-started--glossary"></a></div></div></h2><p>This section needs work...</p>
|
||||
|
||||
<table class="table minimal"><tr><td align="left"><b>Provider</b></td><td align="left">A Provider (in ethers) is a class which provides an abstraction for a connection to the Ethereum Network. It provides read-only access to the Blockchain and its status.</td><td class="fix"> </td></tr><tr><td align="left"><b>Signer</b></td><td align="left">A Signer is a class which (usually) in some way directly or indirectly has access to a private key, which can sign messages and transactions to authorize the network to charge your account ether to perform operations.</td><td class="fix"> </td></tr><tr><td align="left"><b>Contract</b></td><td align="left">A Contract is an abstraction which represents a connection to a specific contract on the Ethereum Network, so that it can be used like a normal JavaScipt object.</td><td class="fix"> </td></tr><tr><td class="table-title" colspan="2">Common Terms</td><td class="fix"> </td></tr></table><a name="/v5/getting-started/-%23-getting-started--connecting"></a><a name="/v5/getting-started/-%23-getting-started--getting-started--connecting"></a><a name="/v5/getting-started/"></a><h2 class="show-anchors"><div>Connecting to Ethereum: Metamask<div class="anchors"><a class="self" href="#/v5/getting-started/-%23-getting-started--connecting"></a></div></div></h2><p>The quickest and easiest way to experiment and begin developing on Ethereum is to use <a href="https://metamask.io/">Metamask</a>, which is a browser extension that provides:</p>
|
||||
@ -56,7 +58,7 @@
|
||||
|
||||
<div class="code-title"><div>Basic Queries</div></div><div class="code"><span class="comment">// Look up the current block number
|
||||
</span>provider.getBlockNumber()
|
||||
<span class="result ok">// { Promise: 10384649 }
|
||||
<span class="result ok">// { Promise: 10397126 }
|
||||
</span>
|
||||
<span class="comment">// Get the balance of an account (by address or ENS name)
|
||||
</span>balance = await provider.getBalance("ethers.eth")
|
||||
@ -124,11 +126,11 @@
|
||||
</span>
|
||||
<span class="comment">// Get the balance of an address
|
||||
</span>balance = await daiContract.balanceOf("ricmoo.firefly.eth")
|
||||
<span class="result ok">// { BigNumber: "8814410125722568213383" }
|
||||
<span class="result ok">// { BigNumber: "9709905125722568213383" }
|
||||
</span>
|
||||
<span class="comment">// Format the DAI for displaying to the user
|
||||
</span>ethers.utils.formatUnits(balance, 18)
|
||||
<span class="result ok">// '8814.410125722568213383'
|
||||
<span class="result ok">// '9709.905125722568213383'
|
||||
</span></div><a name="/v5/getting-started/-%23-getting-started--writing"></a><a name="/v5/getting-started/-%23-getting-started--getting-started--contracts--getting-started--writing"></a><a name="/v5/getting-started/"></a><h3 class="show-anchors"><div>State Changing Methods<div class="anchors"><a class="self" href="#/v5/getting-started/-%23-getting-started--writing"></a></div></div></h3>
|
||||
<div class="code-title"><div>Sending DAI</div></div><div class="code"><span class="comment">// The DAI Contract is currently connected to the Provider,
|
||||
</span><span class="comment">// which is read-only. We need to connect to a Signer, so
|
||||
@ -266,7 +268,7 @@ filter = daiContract.filters.Transfer(null, myAddress)
|
||||
</span><span class="comment">// logging into a service, such as CryptoKitties simply
|
||||
</span><span class="comment">// pass the string in.
|
||||
</span>signature = await signer.signMessage("Hello World");
|
||||
<span class="result ok">// '0x9671c8b89473038593fddda5875debcb517dbfe79bd25119f6b0878bcd6c5e9d497e5d7f08cb7314da5d2a04b49bee0918d0b9e11744ee5a738b94e38986575f1c'
|
||||
<span class="result ok">// '0x7b8d663c680b165bb7b0601a65d730f532fa6427b2e30f1d91ff1d929712b3a50b427a672b90c1dc48a4e5fbde292fbded51f670ab57d15d5794b6ff015649611c'
|
||||
</span>
|
||||
//
|
||||
<span class="comment">// A common case is also signing a hash, which is 32
|
||||
@ -283,7 +285,7 @@ filter = daiContract.filters.Transfer(null, myAddress)
|
||||
</span>
|
||||
<span class="comment">// To sign a hash, you most often want to sign the bytes
|
||||
</span>signature = await signer.signMessage(messageBytes)
|
||||
<span class="result ok">// '0xfff17b9972cf8466bcde13dfc52afe6cbe39b86b1c9028d0fe4de6ab565ce01a48b7eba3663a24588e87798d924e8178f3c7c84d9363f57a9bee519f7cac50b31b'
|
||||
<span class="result ok">// '0xc791b3d29aa1754f9e392784273f076ef39ca5d81f2729c92af61f89db724a604074acbd725d9d95e1d3c9630211c8eee8e34f6d948d537dd82c11be4bcf676e1c'
|
||||
</span></div><div class="page-separator"></div><a name="/v5/concepts/-%23-ethereum-basics"></a><a name="/v5/concepts/"></a><h1 class="show-anchors"><div>Ethereum Basics<div class="anchors"><a class="self" href="#/v5/concepts/-%23-ethereum-basics"></a></div></div></h1><p>This is a very breif overview of some aspects of <i>Ethereum</i> and blockchains which developers can make use of or should be aware of.</p>
|
||||
|
||||
<p>This section is fairly sparse at the moment, but will be expanded as time goes on.</p>
|
||||
@ -907,7 +909,7 @@ contract = new ethers.Contract("dai.tokens.ethers.eth", abi, signer)
|
||||
|
||||
<span class="comment">// Get the number of tokens for this account
|
||||
</span>tokens = await contract.balanceOf(signer.getAddress())
|
||||
<span class="result ok">// { BigNumber: "8814410125722568213383" }
|
||||
<span class="result ok">// { BigNumber: "9709905125722568213383" }
|
||||
</span>
|
||||
//
|
||||
<span class="comment">// Pre-flight (check for revert) on DAI from the signer
|
||||
@ -971,7 +973,7 @@ contract = new ethers.Contract("dai.tokens.ethers.eth", abi, signer)
|
||||
|
||||
</div></div><div class="code-title"><div>Account Examples</div></div><div class="code"><span class="comment">// Get the balance for an account...
|
||||
</span>provider.getBalance("ricmoo.firefly.eth");
|
||||
<span class="result ok">// { Promise: { BigNumber: "1585454034436018765" } }
|
||||
<span class="result ok">// { Promise: { BigNumber: "1578527309436018765" } }
|
||||
</span>
|
||||
<span class="comment">// Get the code for a contract...
|
||||
</span>provider.getCode("registrar.firefly.eth");
|
||||
@ -983,7 +985,7 @@ contract = new ethers.Contract("dai.tokens.ethers.eth", abi, signer)
|
||||
</span>
|
||||
<span class="comment">// Get transaction count of an account...
|
||||
</span>provider.getTransactionCount("ricmoo.firefly.eth");
|
||||
<span class="result ok">// { Promise: 670 }
|
||||
<span class="result ok">// { Promise: 673 }
|
||||
</span></div><a name="/v5/api/providers/provider/-%23-Provider--block-methods"></a><a name="/v5/api/providers/provider/-%23-Provider--Provider--block-methods"></a><a name="/v5/api/providers/provider/"></a><h2 class="show-anchors"><div>Blocks Methods<div class="anchors"><a class="self" href="#/v5/api/providers/provider/-%23-Provider--block-methods"></a></div></div></h2>
|
||||
<a name="/v5/api/providers/provider/-%23-Provider-getBlock"></a><div class="property show-anchors"><div class="signature"><span class="path">provider</span><span class="symbol">.</span><span class="method">getBlock</span><span class="symbol">(</span> <span class="param">block</span> <span class="symbol">)</span> <span class="arrow">⇒</span> <span class="returns">Promise< <a href="#/v5/api/providers/types/-%23-providers-Block">Block</a> ></span><div class="anchors"><a class="self" href="#/v5/api/providers/provider/-%23-Provider-getBlock"></a><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/providers/src.ts/base-provider.ts#L936">source</a></div></div><div class="body"><p>Get the <i>block</i> from the network, where the <code class="inline">result.transactions</code> is a list of transaction hashes.</p>
|
||||
|
||||
@ -1023,7 +1025,7 @@ provider.getBlockWithTransactions(100004)
|
||||
</span><span class="result ok">// blockHash: '0xf93283571ae16dcecbe1816adc126954a739350cd1523a1559eabeae155fbb63',
|
||||
</span><span class="result ok">// blockNumber: 100004,
|
||||
</span><span class="result ok">// chainId: 0,
|
||||
</span><span class="result ok">// confirmations: 10284646,
|
||||
</span><span class="result ok">// confirmations: 10297123,
|
||||
</span><span class="result ok">// creates: null,
|
||||
</span><span class="result ok">// data: '0x',
|
||||
</span><span class="result ok">// from: '0xcf00A85f3826941e7A25BFcF9Aac575d40410852',
|
||||
@ -1081,16 +1083,16 @@ provider.getBlockWithTransactions(100004)
|
||||
</span>
|
||||
<span class="comment">// The current block number
|
||||
</span>provider.getBlockNumber()
|
||||
<span class="result ok">// { Promise: 10384649 }
|
||||
<span class="result ok">// { Promise: 10397126 }
|
||||
</span>
|
||||
<span class="comment">// Get the current suggested gas price (in wei)...
|
||||
</span>gasPrice = await provider.getGasPrice()
|
||||
<span class="result ok">// { BigNumber: "41000000000" }
|
||||
<span class="result ok">// { BigNumber: "19000001123" }
|
||||
</span>
|
||||
<span class="comment">// ...often this gas price is easier to understand or
|
||||
</span><span class="comment">// display to the user in gwei (giga-wei, or 1e9 wei)
|
||||
</span>utils.formatUnits(gasPrice, "gwei")
|
||||
<span class="result ok">// '41.0'
|
||||
<span class="result ok">// '19.000001123'
|
||||
</span></div><a name="/v5/api/providers/provider/-%23-Provider--transaction-methods"></a><a name="/v5/api/providers/provider/-%23-Provider--Provider--transaction-methods"></a><a name="/v5/api/providers/provider/"></a><h2 class="show-anchors"><div>Transactions Methods<div class="anchors"><a class="self" href="#/v5/api/providers/provider/-%23-Provider--transaction-methods"></a></div></div></h2>
|
||||
<a name="/v5/api/providers/provider/-%23-Provider-call"></a><div class="property show-anchors"><div class="signature"><span class="path">provider</span><span class="symbol">.</span><span class="method">call</span><span class="symbol">(</span> <span class="param">transaction</span> <span class="symbol">[</span> <span class="symbol">,</span> <span class="param">blockTag</span> = <span class="param">latest</span> <span class="symbol">]</span> <span class="symbol">)</span> <span class="arrow">⇒</span> <span class="returns">Promise< string< <a href="#/v5/api/utils/bytes/-%23-DataHexString">DataHexString</a> > ></span><div class="anchors"><a class="self" href="#/v5/api/providers/provider/-%23-Provider-call"></a><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/providers/src.ts/base-provider.ts#L836">source</a></div></div><div class="body"><p>Returns the result of executing the <i>transaction</i>, using <i>call</i>. A call does not require any ether, but cannot change any state. This is useful for calling gettings on Contracts.</p>
|
||||
|
||||
@ -1366,7 +1368,7 @@ provider = new AlchemyProvider("homestead", apiKey);
|
||||
|
||||
<div class="property show-anchors"><div class="signature"><span class="path">ipcProvider</span><span class="symbol">.</span><span class="method">path</span> <span class="arrow">⇒</span> <span class="returns">string</span><div class="anchors"></div></div><div class="body"><p>The path this <a href="#/v5/api/providers/provider/">Provider</a> is connected to.</p>
|
||||
|
||||
</div></div><a name="/v5/api/providers/other/-%23-UrlJsonRpcProvider"></a><a name="/v5/api/providers/other/-%23-other-providers--UrlJsonRpcProvider"></a><a name="/v5/api/providers/other/"></a><h2 class="show-anchors"><div>UrlJsonRpcProvider<span class="inherits"> inherits <a href="#/v5/api/providers/jsonrpc-provider/">JsonRpcProvider</a></span><div class="anchors"><a class="self" href="#/v5/api/providers/other/-%23-UrlJsonRpcProvider"></a><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/providers/src.ts/url-json-rpc-provider.ts#L35">source</a></div></div></h2><p>This class is intended to be sub-classed and not used directly. It simplifies creating a <a href="#/v5/api/providers/provider/">Provider</a> where a normal <a href="#/v5/api/providers/jsonrpc-provider/">JsonRpcProvider</a> would suffice, with a little extra effort needed to generate the JSON-RPC URL.</p>
|
||||
</div></div><a name="/v5/api/providers/other/-%23-UrlJsonRpcProvider"></a><a name="/v5/api/providers/other/-%23-other-providers--UrlJsonRpcProvider"></a><a name="/v5/api/providers/other/"></a><h2 class="show-anchors"><div>UrlJsonRpcProvider<span class="inherits"> inherits <a href="#/v5/api/providers/jsonrpc-provider/">JsonRpcProvider</a></span><div class="anchors"><a class="self" href="#/v5/api/providers/other/-%23-UrlJsonRpcProvider"></a><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/providers/src.ts/url-json-rpc-provider.ts#L49">source</a></div></div></h2><p>This class is intended to be sub-classed and not used directly. It simplifies creating a <a href="#/v5/api/providers/provider/">Provider</a> where a normal <a href="#/v5/api/providers/jsonrpc-provider/">JsonRpcProvider</a> would suffice, with a little extra effort needed to generate the JSON-RPC URL.</p>
|
||||
|
||||
<div class="property show-anchors"><div class="signature"><span class="modifier">new </span><span class="path">ethers</span><span class="symbol">.</span><span class="path">providers</span><span class="symbol">.</span><span class="method">UrlJsonRpcProvider</span><span class="symbol">(</span> <span class="symbol">[</span> <span class="param">network</span> <span class="symbol">[</span> <span class="symbol">,</span> <span class="param">apiKey</span> <span class="symbol">]</span> <span class="symbol">]</span> <span class="symbol">)</span><div class="anchors"></div></div><div class="body"><p>Sub-classes do not need to override this. Instead they should override the static method <code class="inline">getUrl</code> and optionally <code class="inline">getApiKey</code>.</p>
|
||||
|
||||
@ -1920,7 +1922,7 @@ one2
|
||||
</span>
|
||||
<span class="comment">// Numbers outside the safe range fail:
|
||||
</span>BigNumber.from(Number.MAX_SAFE_INTEGER);
|
||||
<span class="result error">// Error: overflow (fault="overflow", operation="BigNumber.from", value=9007199254740991, code=NUMERIC_FAULT, version=bignumber/5.0.2)
|
||||
<span class="result error">// Error: overflow (fault="overflow", operation="BigNumber.from", value=9007199254740991, code=NUMERIC_FAULT, version=bignumber/5.0.3)
|
||||
</span></div><a name="/v5/api/utils/bignumber/-%23-BigNumber--methods"></a><a name="/v5/api/utils/bignumber/-%23-BigNumber--BigNumber--methods"></a><a name="/v5/api/utils/bignumber/"></a><h2 class="show-anchors"><div>Methods<div class="anchors"><a class="self" href="#/v5/api/utils/bignumber/-%23-BigNumber--methods"></a></div></div></h2><p>The BigNumber class is immutable, so no operations can change the value it represents.</p>
|
||||
|
||||
<a name="/v5/api/utils/bignumber/-%23-BigNumber--BigNumber--methods--math-operations"></a><a name="/v5/api/utils/bignumber/"></a><h3 class="show-anchors"><div>Math Operations<div class="anchors"><a class="self" href="#/v5/api/utils/bignumber/-%23-BigNumber--BigNumber--methods--math-operations"></a></div></div></h3>
|
||||
@ -1938,7 +1940,7 @@ one2
|
||||
|
||||
</div></div><div class="property show-anchors"><div class="signature"><span class="path">BigNumber</span><span class="symbol">.</span><span class="method">abs</span><span class="symbol">(</span> <span class="symbol">)</span> <span class="arrow">⇒</span> <span class="returns"><a href="#/v5/api/utils/bignumber/">BigNumber</a></span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/bignumber/src.ts/bignumber.ts#L64">source</a></div></div><div class="body"><p>Returns a BigNumber with the absolute value of <i>BigNumber</i>.</p>
|
||||
|
||||
</div></div><div class="property show-anchors"><div class="signature"><span class="path">BigNumber</span><span class="symbol">.</span><span class="method">mask</span><span class="symbol">(</span> <span class="param">bitcount</span> <span class="symbol">)</span> <span class="arrow">⇒</span> <span class="returns"><a href="#/v5/api/utils/bignumber/">BigNumber</a></span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/bignumber/src.ts/bignumber.ts#L127">source</a></div></div><div class="body"><p>Returns a BigNumber with the value of <i>BigNumber</i> with bits beyond the <i>bitcount</i> least significant bits set to zero.</p>
|
||||
</div></div><div class="property show-anchors"><div class="signature"><span class="path">BigNumber</span><span class="symbol">.</span><span class="method">mask</span><span class="symbol">(</span> <span class="param">bitcount</span> <span class="symbol">)</span> <span class="arrow">⇒</span> <span class="returns"><a href="#/v5/api/utils/bignumber/">BigNumber</a></span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/bignumber/src.ts/bignumber.ts#L131">source</a></div></div><div class="body"><p>Returns a BigNumber with the value of <i>BigNumber</i> with bits beyond the <i>bitcount</i> least significant bits set to zero.</p>
|
||||
|
||||
</div></div><a name="/v5/api/utils/bignumber/-%23-BigNumber--BigNumber--methods--two-s-compliment"></a><a name="/v5/api/utils/bignumber/"></a><h3 class="show-anchors"><div>Two's Compliment<div class="anchors"><a class="self" href="#/v5/api/utils/bignumber/-%23-BigNumber--BigNumber--methods--two-s-compliment"></a></div></div></h3><p><a href="https://en.wikipedia.org/wiki/Two%27s_complement">Two's Complicment</a> is an elegant method used to encode and decode fixed-width signed values while efficiently preserving mathematic operations. Most users will not need to interact with these.</p>
|
||||
|
||||
@ -1947,29 +1949,29 @@ one2
|
||||
</div></div><div class="property show-anchors"><div class="signature"><span class="path">BigNumber</span><span class="symbol">.</span><span class="method">toTwos</span><span class="symbol">(</span> <span class="param">bitwidth</span> <span class="symbol">)</span> <span class="arrow">⇒</span> <span class="returns"><a href="#/v5/api/utils/bignumber/">BigNumber</a></span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/bignumber/src.ts/bignumber.ts#L60">source</a></div></div><div class="body"><p>Returns a BigNumber with the value of <i>BigNumber</i> converted to twos-compliment with <i>bitwidth</i>.</p>
|
||||
|
||||
</div></div><a name="/v5/api/utils/bignumber/-%23-BigNumber--BigNumber--methods--comparison-and-equivalence"></a><a name="/v5/api/utils/bignumber/"></a><h3 class="show-anchors"><div>Comparison and Equivalence<div class="anchors"><a class="self" href="#/v5/api/utils/bignumber/-%23-BigNumber--BigNumber--methods--comparison-and-equivalence"></a></div></div></h3>
|
||||
<div class="property show-anchors"><div class="signature"><span class="path">BigNumber</span><span class="symbol">.</span><span class="method">eq</span><span class="symbol">(</span> <span class="param">otherValue</span> <span class="symbol">)</span> <span class="arrow">⇒</span> <span class="returns">boolean</span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/bignumber/src.ts/bignumber.ts#L148">source</a></div></div><div class="body"><p>Returns true if and only if the value of <i>BigNumber</i> is equal to <i>otherValue</i>.</p>
|
||||
<div class="property show-anchors"><div class="signature"><span class="path">BigNumber</span><span class="symbol">.</span><span class="method">eq</span><span class="symbol">(</span> <span class="param">otherValue</span> <span class="symbol">)</span> <span class="arrow">⇒</span> <span class="returns">boolean</span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/bignumber/src.ts/bignumber.ts#L152">source</a></div></div><div class="body"><p>Returns true if and only if the value of <i>BigNumber</i> is equal to <i>otherValue</i>.</p>
|
||||
|
||||
</div></div><div class="property show-anchors"><div class="signature"><span class="path">BigNumber</span><span class="symbol">.</span><span class="method">lt</span><span class="symbol">(</span> <span class="param">otherValue</span> <span class="symbol">)</span> <span class="arrow">⇒</span> <span class="returns">boolean</span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/bignumber/src.ts/bignumber.ts#L152">source</a></div></div><div class="body"><p>Returns true if and only if the value of <i>BigNumber</i> <b><</b> <i>otherValue</i>.</p>
|
||||
</div></div><div class="property show-anchors"><div class="signature"><span class="path">BigNumber</span><span class="symbol">.</span><span class="method">lt</span><span class="symbol">(</span> <span class="param">otherValue</span> <span class="symbol">)</span> <span class="arrow">⇒</span> <span class="returns">boolean</span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/bignumber/src.ts/bignumber.ts#L156">source</a></div></div><div class="body"><p>Returns true if and only if the value of <i>BigNumber</i> <b><</b> <i>otherValue</i>.</p>
|
||||
|
||||
</div></div><div class="property show-anchors"><div class="signature"><span class="path">BigNumber</span><span class="symbol">.</span><span class="method">lte</span><span class="symbol">(</span> <span class="param">otherValue</span> <span class="symbol">)</span> <span class="arrow">⇒</span> <span class="returns">boolean</span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/bignumber/src.ts/bignumber.ts#L156">source</a></div></div><div class="body"><p>Returns true if and only if the value of <i>BigNumber</i> <b>≤</b> <i>otherValue</i>.</p>
|
||||
</div></div><div class="property show-anchors"><div class="signature"><span class="path">BigNumber</span><span class="symbol">.</span><span class="method">lte</span><span class="symbol">(</span> <span class="param">otherValue</span> <span class="symbol">)</span> <span class="arrow">⇒</span> <span class="returns">boolean</span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/bignumber/src.ts/bignumber.ts#L160">source</a></div></div><div class="body"><p>Returns true if and only if the value of <i>BigNumber</i> <b>≤</b> <i>otherValue</i>.</p>
|
||||
|
||||
</div></div><div class="property show-anchors"><div class="signature"><span class="path">BigNumber</span><span class="symbol">.</span><span class="method">gt</span><span class="symbol">(</span> <span class="param">otherValue</span> <span class="symbol">)</span> <span class="arrow">⇒</span> <span class="returns">boolean</span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/bignumber/src.ts/bignumber.ts#L160">source</a></div></div><div class="body"><p>Returns true if and only if the value of <i>BigNumber</i> <b>></b> <i>otherValue</i>.</p>
|
||||
</div></div><div class="property show-anchors"><div class="signature"><span class="path">BigNumber</span><span class="symbol">.</span><span class="method">gt</span><span class="symbol">(</span> <span class="param">otherValue</span> <span class="symbol">)</span> <span class="arrow">⇒</span> <span class="returns">boolean</span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/bignumber/src.ts/bignumber.ts#L164">source</a></div></div><div class="body"><p>Returns true if and only if the value of <i>BigNumber</i> <b>></b> <i>otherValue</i>.</p>
|
||||
|
||||
</div></div><div class="property show-anchors"><div class="signature"><span class="path">BigNumber</span><span class="symbol">.</span><span class="method">gte</span><span class="symbol">(</span> <span class="param">otherValue</span> <span class="symbol">)</span> <span class="arrow">⇒</span> <span class="returns">boolean</span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/bignumber/src.ts/bignumber.ts#L164">source</a></div></div><div class="body"><p>Returns true if and only if the value of <i>BigNumber</i> <b>≥</b> <i>otherValue</i>.</p>
|
||||
</div></div><div class="property show-anchors"><div class="signature"><span class="path">BigNumber</span><span class="symbol">.</span><span class="method">gte</span><span class="symbol">(</span> <span class="param">otherValue</span> <span class="symbol">)</span> <span class="arrow">⇒</span> <span class="returns">boolean</span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/bignumber/src.ts/bignumber.ts#L168">source</a></div></div><div class="body"><p>Returns true if and only if the value of <i>BigNumber</i> <b>≥</b> <i>otherValue</i>.</p>
|
||||
|
||||
</div></div><div class="property show-anchors"><div class="signature"><span class="path">BigNumber</span><span class="symbol">.</span><span class="method">isZero</span><span class="symbol">(</span> <span class="symbol">)</span> <span class="arrow">⇒</span> <span class="returns">boolean</span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/bignumber/src.ts/bignumber.ts#L172">source</a></div></div><div class="body"><p>Returns true if and only if the value of <i>BigNumber</i> is zero.</p>
|
||||
</div></div><div class="property show-anchors"><div class="signature"><span class="path">BigNumber</span><span class="symbol">.</span><span class="method">isZero</span><span class="symbol">(</span> <span class="symbol">)</span> <span class="arrow">⇒</span> <span class="returns">boolean</span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/bignumber/src.ts/bignumber.ts#L176">source</a></div></div><div class="body"><p>Returns true if and only if the value of <i>BigNumber</i> is zero.</p>
|
||||
|
||||
</div></div><a name="/v5/api/utils/bignumber/-%23-BigNumber--BigNumber--methods--conversion"></a><a name="/v5/api/utils/bignumber/"></a><h3 class="show-anchors"><div>Conversion<div class="anchors"><a class="self" href="#/v5/api/utils/bignumber/-%23-BigNumber--BigNumber--methods--conversion"></a></div></div></h3>
|
||||
<div class="property show-anchors"><div class="signature"><span class="path">BigNumber</span><span class="symbol">.</span><span class="method">toNumber</span><span class="symbol">(</span> <span class="symbol">)</span> <span class="arrow">⇒</span> <span class="returns">number</span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/bignumber/src.ts/bignumber.ts#L176">source</a></div></div><div class="body"><p>Returns the value of <i>BigNumber</i> as a JavaScript value.</p>
|
||||
<div class="property show-anchors"><div class="signature"><span class="path">BigNumber</span><span class="symbol">.</span><span class="method">toNumber</span><span class="symbol">(</span> <span class="symbol">)</span> <span class="arrow">⇒</span> <span class="returns">number</span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/bignumber/src.ts/bignumber.ts#L180">source</a></div></div><div class="body"><p>Returns the value of <i>BigNumber</i> as a JavaScript value.</p>
|
||||
|
||||
<p>This will <b>throw an error</b> if the value is greater than or equal to <i>Number.MAX_SAFE_INTEGER</i> or less than or equal to <i>Number.MIN_SAFE_INTEGER</i>.</p>
|
||||
|
||||
</div></div><div class="property show-anchors"><div class="signature"><span class="path">BigNumber</span><span class="symbol">.</span><span class="method">toString</span><span class="symbol">(</span> <span class="symbol">)</span> <span class="arrow">⇒</span> <span class="returns">string</span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/bignumber/src.ts/bignumber.ts#L185">source</a></div></div><div class="body"><p>Returns the value of <i>BigNumber</i> as a base-10 string.</p>
|
||||
</div></div><div class="property show-anchors"><div class="signature"><span class="path">BigNumber</span><span class="symbol">.</span><span class="method">toString</span><span class="symbol">(</span> <span class="symbol">)</span> <span class="arrow">⇒</span> <span class="returns">string</span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/bignumber/src.ts/bignumber.ts#L189">source</a></div></div><div class="body"><p>Returns the value of <i>BigNumber</i> as a base-10 string.</p>
|
||||
|
||||
</div></div><div class="property show-anchors"><div class="signature"><span class="path">BigNumber</span><span class="symbol">.</span><span class="method">toHexString</span><span class="symbol">(</span> <span class="symbol">)</span> <span class="arrow">⇒</span> <span class="returns">string< <a href="#/v5/api/utils/bytes/-%23-DataHexString">DataHexString</a> ></span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/bignumber/src.ts/bignumber.ts#L193">source</a></div></div><div class="body"><p>Returns the value of <i>BigNumber</i> as a base-16, <code class="inline">0x</code>-prefixed <a href="#/v5/api/utils/bytes/-%23-DataHexString">DataHexString</a>.</p>
|
||||
</div></div><div class="property show-anchors"><div class="signature"><span class="path">BigNumber</span><span class="symbol">.</span><span class="method">toHexString</span><span class="symbol">(</span> <span class="symbol">)</span> <span class="arrow">⇒</span> <span class="returns">string< <a href="#/v5/api/utils/bytes/-%23-DataHexString">DataHexString</a> ></span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/bignumber/src.ts/bignumber.ts#L197">source</a></div></div><div class="body"><p>Returns the value of <i>BigNumber</i> as a base-16, <code class="inline">0x</code>-prefixed <a href="#/v5/api/utils/bytes/-%23-DataHexString">DataHexString</a>.</p>
|
||||
|
||||
</div></div><a name="/v5/api/utils/bignumber/-%23-BigNumber--BigNumber--methods--inspection"></a><a name="/v5/api/utils/bignumber/"></a><h3 class="show-anchors"><div>Inspection<div class="anchors"><a class="self" href="#/v5/api/utils/bignumber/-%23-BigNumber--BigNumber--methods--inspection"></a></div></div></h3>
|
||||
<div class="property show-anchors"><div class="signature"><span class="path">ethers</span><span class="symbol">.</span><span class="path">BigNumnber</span><span class="symbol">.</span><span class="method">isBigNumber</span><span class="symbol">(</span> <span class="param">object</span> <span class="symbol">)</span> <span class="arrow">⇒</span> <span class="returns">boolean</span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/bignumber/src.ts/bignumber.ts#L246">source</a></div></div><div class="body"><p>Returns true if and only if the <i>object</i> is a BigNumber object.</p>
|
||||
<div class="property show-anchors"><div class="signature"><span class="path">ethers</span><span class="symbol">.</span><span class="path">BigNumnber</span><span class="symbol">.</span><span class="method">isBigNumber</span><span class="symbol">(</span> <span class="param">object</span> <span class="symbol">)</span> <span class="arrow">⇒</span> <span class="returns">boolean</span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/bignumber/src.ts/bignumber.ts#L250">source</a></div></div><div class="body"><p>Returns true if and only if the <i>object</i> is a BigNumber object.</p>
|
||||
|
||||
</div></div><a name="/v5/api/utils/bignumber/-%23-BigNumber--BigNumber--methods--examples"></a><a name="/v5/api/utils/bignumber/"></a><h3 class="show-anchors"><div>Examples<div class="anchors"><a class="self" href="#/v5/api/utils/bignumber/-%23-BigNumber--BigNumber--methods--examples"></a></div></div></h3>
|
||||
<div class="code">let a = BigNumber.from(42);
|
||||
@ -2104,20 +2106,20 @@ a.mul(b);
|
||||
</div></div><a name="/v5/api/utils/bytes/-%23-utils-shuffled"></a><div class="property show-anchors"><div class="signature"><span class="path">ethers</span><span class="symbol">.</span><span class="path">utils</span><span class="symbol">.</span><span class="method">shuffled</span><span class="symbol">(</span> <span class="param">array</span> <span class="symbol">)</span> <span class="arrow">⇒</span> <span class="returns">Array< any ></span><div class="anchors"><a class="self" href="#/v5/api/utils/bytes/-%23-utils-shuffled"></a><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/random/src.ts/shuffle.ts#L3">source</a></div></div><div class="body"><p>Return a copy of <i>array</i> shuffled using <a href="https://en.wikipedia.org/wiki/Fisher-Yates_shuffle">Fisher-Yates Shuffle</a>.</p>
|
||||
|
||||
</div></div><div class="code-title"><div>Examples</div></div><div class="code">utils.randomBytes(8)
|
||||
<span class="result ok">// Uint8Array [ 95, 9, 0, 81, 176, 49, 211, 225 ]
|
||||
<span class="result ok">// Uint8Array [ 158, 14, 185, 6, 8, 37, 214, 172 ]
|
||||
</span>
|
||||
const data = [ 1, 2, 3, 4, 5, 6, 7 ];
|
||||
|
||||
<span class="comment">// Returns a new Array
|
||||
</span>utils.shuffled(data);
|
||||
<span class="result ok">// [
|
||||
</span><span class="result ok">// 6,
|
||||
</span><span class="result ok">// 7,
|
||||
</span><span class="result ok">// 4,
|
||||
</span><span class="result ok">// 3,
|
||||
</span><span class="result ok">// 5,
|
||||
</span><span class="result ok">// 1,
|
||||
</span><span class="result ok">// 2
|
||||
</span><span class="result ok">// 3,
|
||||
</span><span class="result ok">// 4,
|
||||
</span><span class="result ok">// 7,
|
||||
</span><span class="result ok">// 2,
|
||||
</span><span class="result ok">// 5,
|
||||
</span><span class="result ok">// 6
|
||||
</span><span class="result ok">// ]
|
||||
</span>
|
||||
<span class="comment">// The Original is unscathed...
|
||||
@ -3643,7 +3645,7 @@ interface.events.Transfer.decode(data, topics)
|
||||
|
||||
<span class="comment">// v5
|
||||
</span>interface.encodeFilterTopics("Transfer", values)
|
||||
interface.encodeEventLog("Transfer", data, topics)
|
||||
interface.decodeEventLog("Transfer", data, topics)
|
||||
</div><a name="/v5/migration/ethers-v4/-%23-migration-v4--interface--inspection"></a><a name="/v5/migration/ethers-v4/"></a><h3 class="show-anchors"><div>Inspection<div class="anchors"><a class="self" href="#/v5/migration/ethers-v4/-%23-migration-v4--interface--inspection"></a></div></div></h3><p>Interrogating properties about a function or event can now (mostly) be done directly on the <a href="#/v5/api/utils/abi/fragments/-%23-Fragment">Fragment</a> object.</p>
|
||||
|
||||
<div class="code">// v4
|
||||
@ -4044,7 +4046,7 @@ $bottom: This just represents an example of
|
||||
<div class="nav previous"><!--PREV_LINK--></div>
|
||||
<div class="nav next"><!--NEXT_LINK--></div>
|
||||
</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 3, 2020, 1:44am.</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 5, 2020, 12:0am.</div>
|
||||
</div>
|
||||
<script src="/v5/static/script.js" type="text/javascript"></script>
|
||||
</body>
|
||||
|
@ -24,7 +24,7 @@
|
||||
<div class="nav previous"><a href="/v5/migration/ethers-v4/"><span class="arrow">←</span>Migration: From Ethers v4</a></div>
|
||||
<div class="nav next"><a href="/v5/contributing/">Contributing and Hacking<span class="arrow">→</span></a></div>
|
||||
</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 3, 2020, 1:44am.</div>
|
||||
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 5, 2020, 12:0am.</div>
|
||||
</div>
|
||||
<script src="/v5/static/script.js" type="text/javascript"></script>
|
||||
</body>
|
||||
|
Loading…
Reference in New Issue
Block a user