ethers.js/docs/v5/api/experimental/index.html

62 lines
13 KiB
HTML
Raw Permalink Normal View History

2020-06-09 23:56:58 -04:00
<!DOCTYPE html>
<html class="paged">
<head>
<title>Experimental</title>
<link rel="stylesheet" type="text/css" href="/v5/static/style.css">
</head>
<body>
<div class="sidebar">
<div class="header">
<div class="logo"><a href="/v5/"><div class="image"></div><div class="name">ethers</div><div class="version">v5.0-beta</div></a></div>
</div>
<div class="toc"><div>
2020-06-12 03:38:55 -04:00
<div class="link title"><a href="/v5/">Documentation</a></div><div class="base show link depth-1"><a href="/v5/getting-started/">Getting Started</a></div><div class="base show link depth-1"><a href="/v5/concepts/">Ethereum Basics</a></div><div class="hide link depth-2"><a href="/v5/concepts/events/">Events</a></div><div class="hide link depth-2"><a href="/v5/concepts/gas/">Gas</a></div><div class="hide link depth-2"><a href="/v5/concepts/security/">Security</a></div><div class="base ancestor show link depth-1"><a href="/v5/api/">Application Programming Interface</a></div><div class="show link depth-2"><a href="/v5/api/contract/">Contract Interaction</a></div><div class="hide link depth-3"><a href="/v5/api/contract/contract/">Contract</a></div><div class="hide link depth-3"><a href="/v5/api/contract/contract-factory/">ContractFactory</a></div><div class="hide link depth-3"><a href="/v5/api/contract/example/">Example: ERC-20 Contract</a></div><div class="show link depth-2"><a href="/v5/api/signer/">Signers</a></div><div class="show link depth-2"><a href="/v5/api/providers/">Providers</a></div><div class="hide link depth-3"><a href="/v5/api/providers/provider/">Provider</a></div><div class="hide link depth-3"><a href="/v5/api/providers/jsonrpc-provider/">JsonRpcProvider</a></div><div class="hide link depth-3"><a href="/v5/api/providers/api-providers/">API Providers</a></div><div class="hide link depth-3"><a href="/v5/api/providers/other/">Other Providers</a></div><div class="hide link depth-3"><a href="/v5/api/providers/types/">Types</a></div><div class="show link depth-2"><a href="/v5/api/utils/">Utilities</a></div><div class="hide link depth-3"><a href="/v5/api/utils/abi/">Application Binary Interface</a></div><div class="hide link depth-4"><a href="/v5/api/utils/abi/coder/">AbiCoder</a></div><div class="hide link depth-4"><a href="/v5/api/utils/abi/formats/">ABI Formats</a></div><div class="hide link depth-4"><a href="/v5/api/utils/abi/fragments/">Fragments</a></div><div class="hide link depth-4"><a href="/v5/api/utils/abi/interface/">Interface</a></div><div class="hide link depth-3"><a href="/v5/api/utils/address/">Addresses</a></div><div class="hide link depth-3"><a href="/v5/api/utils/bignumber/">BigNumber</a></div><div class="hide link depth-3"><a href="/v5/api/utils/bytes/">Byte Manipulation</a></div><div class="hide link depth-3"><a href="/v5/api/utils/constants/">Constants</a></div><div class="hide link depth-3"><a href="/v5/api/utils/display-logic/">Display Logic and Input</a></div><div class="hide link depth-3"><a href="/v5/api/utils/encoding/">Encoding Utilities</a></div><div class="hide link depth-3"><a href="/v5/api/utils/fixednumber/">FixedNumber</a></div><div class="hide link depth-3"><a href="/v5/api/utils/hashing/">Hashing Algorithms</a></div><div class="hide link depth-3"><a href="/v5/api/utils/hdnode/">HD Wallet</a></div><div class="hide link depth-3"><a href="/v5/api/utils/logger/">Logging</a></div><div class="hide link depth-3"><a href="/v5/api/utils/properties/">Property Utilities</a></div><div class="hide link depth-3"><a href="/v5/api/utils/signing-key/">Signing Key</a></div><div class="hide link depth-3"><a href="/v5/api/utils/strings/">Strings</a></div><div class="hide link depth-3"><a href="/v5/api/utils/transactions/">Transactions</a></div><div class="hide link depth-3"><a href="/v5/api/utils/web/">Web Utilities</a></div><div class="hide link depth-3"><a href="/v5/api/utils/wordlists/">Wordlists</a></div><div class="show link depth-2"><a href="/v5/api/other/">Other Libraries</a></div><div class="hide link depth-3"><a href="/v5/api/other/assembly/">Assembly</a></div><div class="hide link depth-4"><a href="/v5/api/other/assembly/dialect/">Ethers ASM Dialect</a></div><div class="hide link depth-4"><a href="/v5/api/other/assembly/api/">Utilities</a></div><div class="hide link depth-4"><a href="/v5/api/other/assembly/ast/">Abstract Syntax Tree</a></div><div class="hide link depth-3"><a href="/v5/api/other/hardware/">Hardware Wallets</a></div><div class="myself ancestor ancestor show link de
2020-06-09 23:56:58 -04:00
</div></div>
</div>
<div class="content">
<div class="breadcrumbs"><a href="/v5/">Documentation</a>&nbsp;&nbsp;&raquo;&nbsp;&nbsp;<a href="/v5/api/">API</a>&nbsp;&nbsp;&raquo;&nbsp;&nbsp;<span class="current">Experimental</span></div>
<a name="experimental"></a><h1 class="show-anchors"><div>Experimental<div class="anchors"><a class="self" href="/v5/api/experimental/#experimental"></a></div></div></h1><p>The <b>Experimental</b> package is used for features that are not ready to be included in the base library. The API should not be considered stable and does not follow <a href="https://semver.org">semver</a> versioning, so applications requiring it should specify the <i>exact version</i> needed.</p>
<a name="experimental-brainwallet"></a><a name="experimental--experimental-brainwallet"></a><h2 class="show-anchors"><div>BrainWallet<span class="inherits"> inherits <a href="/v5/api/signer/#Wallet">Wallet</a></span><div class="anchors"><a class="self" href="/v5/api/experimental/#experimental-brainwallet"></a></div></div></h2><p>Ethers removed support for BrainWallets in v4, since they are unsafe and many can be easily guessed, allowing attackers to steal the funds. This class is offered to ensure older systems which used brain wallets can still recover their funds and assets.</p>
<div class="property show-anchors"><div class="signature"><span class="path">BrainWallet</span><span class="symbol">.</span><span class="method">generate</span><span class="symbol">(</span> <span class="param">username</span> <span class="symbol">,</span> <span class="param">password</span> <span class="symbol">[</span> <span class="symbol">,</span> <span class="param">progressCallback</span> <span class="symbol">]</span> <span class="symbol">)</span> <span class="arrow">&rArr;</span> <span class="returns"><a href="/v5/api/experimental/#experimental-brainwallet">BrainWallet</a></span><div class="anchors"></div></div><div class="body"><p>Generates a brain wallet, with a slightly improved experience, in which the generated wallet has a mnemonic.</p>
</div></div><div class="property show-anchors"><div class="signature"><span class="path">BrainWallet</span><span class="symbol">.</span><span class="method">generateLegacy</span><span class="symbol">(</span> <span class="param">username</span> <span class="symbol">,</span> <span class="param">password</span> <span class="symbol">[</span> <span class="symbol">,</span> <span class="param">progressCallback</span> <span class="symbol">]</span> <span class="symbol">)</span> <span class="arrow">&rArr;</span> <span class="returns"><a href="/v5/api/experimental/#experimental-brainwallet">BrainWallet</a></span><div class="anchors"></div></div><div class="body"><p>Generate a brain wallet which is compatibile with the ethers v3 and earlier.</p>
</div></div><a name="experimental-eip1193bridge"></a><a name="experimental--experimental-eip1193bridge"></a><h2 class="show-anchors"><div>EIP1193Bridge<span class="inherits"> inherits <a href="https://nodejs.org/dist/latest-v13.x/docs/api/events.html#events_class_eventemitter">EventEmitter</a></span><div class="anchors"><a class="self" href="/v5/api/experimental/#experimental-eip1193bridge"></a></div></div></h2><p>The <b>EIP1193Bridge</b> allows a normal Ethers <a href="/v5/api/signer/#Signer">Signer</a> and <a href="/v5/api/providers/provider/">Provider</a> to be exposed in as a standard <a href="https://eips.ethereum.org/EIPS/eip-1193">EIP-1193 Provider</a>, which may be useful when interacting with other libraries.</p>
<a name="experimental-noncemanager"></a><a name="experimental--experimental-noncemanager"></a><h2 class="show-anchors"><div>NonceManager<span class="inherits"> inherits <a href="/v5/api/signer/#Signer">Signer</a></span><div class="anchors"><a class="self" href="/v5/api/experimental/#experimental-noncemanager"></a></div></div></h2><p>The <b>NonceManager</b> is designed to manage the nonce for a Signer, automatically increasing it as it sends transactions.</p>
<p>Currently the NonceManager does not handle re-broadcast. If you attempt to send a lot of transactions to the network on a node that does not control that account, the transaction pool may drop your transactions.</p>
<p>In the future, it'd be nice if the <b>NonceManager</b> remembered transactions and watched for them on the network, rebroadcasting transactions that appear to have been dropped.</p>
<p>Another future feature will be some sort of failure mode. For example, often a transaction is dependent on another transaction being mined first.</p>
<div class="property show-anchors"><div class="signature"><span class="modifier">new </span><span class="method">NonceManager</span><span class="symbol">(</span> <span class="param">signer</span> <span class="symbol">)</span><div class="anchors"></div></div><div class="body"><p>Create a new NonceManager.</p>
</div></div><div class="property show-anchors"><div class="signature"><span class="path">nonceManager</span><span class="symbol">.</span><span class="method">signer</span> <span class="arrow">&rArr;</span> <span class="returns"><a href="/v5/api/signer/#Signer">Signer</a></span><div class="anchors"></div></div><div class="body"><p>The signer whose nonce is being managed.</p>
</div></div><div class="property show-anchors"><div class="signature"><span class="path">nonceManager</span><span class="symbol">.</span><span class="method">provider</span> <span class="arrow">&rArr;</span> <span class="returns"><a href="/v5/api/providers/provider/">Provider</a></span><div class="anchors"></div></div><div class="body"><p>The provider associated with the signer.</p>
</div></div><div class="property show-anchors"><div class="signature"><span class="path">nonceManager</span><span class="symbol">.</span><span class="method">setTransactionCount</span><span class="symbol">(</span> <span class="param">count</span> <span class="symbol">)</span> <span class="arrow">&rArr;</span> <span class="returns">void</span><div class="anchors"></div></div><div class="body"><p>Set the current transaction count (nonce) for the signer.</p>
<p>This may be useful it interacting with the signer outside of using this class.</p>
</div></div><div class="property show-anchors"><div class="signature"><span class="path">nonceManager</span><span class="symbol">.</span><span class="method">increaseTransactionCount</span><span class="symbol">(</span> <span class="symbol">[</span> <span class="param">count</span> = <span class="param">1</span> <span class="symbol">]</span> <span class="symbol">)</span> <span class="arrow">&rArr;</span> <span class="returns">void</span><div class="anchors"></div></div><div class="body"><p>Bump the current transaction count (nonce) by <i>count</i>.</p>
<p>This may be useful it interacting with the signer outside of using this class.</p>
</div></div>
<div class="footer">
<div class="nav previous"><a href="/v5/api/other/hardware/"><span class="arrow">&larr;</span>Hardware Wallets</a></div>
<div class="nav next"><a href="/v5/cli/">Command Line Interfaces<span class="arrow">&rarr;</span></a></div>
</div>
2020-06-12 19:21:37 -04:00
<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>. Last modified on June 12, 2020, 7:17pm.</div>
2020-06-09 23:56:58 -04:00
</div>
<script src="/v5/static/script.js" type="text/javascript"></script>
</body>
</html>