ethers.js/docs/api/signer/index.html

53 lines
41 KiB
HTML
Raw Normal View History

2020-02-18 01:56:50 +03:00
<html><head><title>Signer</title><link rel="stylesheet" type="text/css" href="/static/style.css"></head><body><div class="sidebar"><div class="header"><div class="logo"><a href="/"><div class="image"></div><div class="name">ethers</div><div class="version">v5.0-beta</div></a></div></div><div class="toc"><div><div class="link title"><a href="/">Documentation</a></div><div class="base show link depth-1"><a href="/getting-started/">Getting Started</a></div><div class="hide link depth-2"><a href="/getting-started/#installing">Installing</a></div><div class="hide link depth-2"><a href="/getting-started/#importing">Importing</a></div><div class="base show link depth-1"><a href="/concepts/">Concepts</a></div><div class="hide link depth-2"><a href="/concepts/events/">Events</a></div><div class="hide link depth-3"><a href="/concepts/events/#solidity-topics">Solidity Topics</a></div><div class="hide link depth-2"><a href="/concepts/gas/">Gas</a></div><div class="hide link depth-3"><a href="/concepts/gas/#gas-price">Gas Price</a></div><div class="hide link depth-3"><a href="/concepts/gas/#gas-limit">Gas Limit</a></div><div class="base ancestor show link depth-1"><a href="/api/">Application Programming Interface</a></div><div class="show link depth-2"><a href="/api/contract/">Contracts</a></div><div class="hide link depth-3"><a href="/api/contract/#buckets">Buckets</a></div><div class="myself ancestor ancestor show link depth-2"><a href="/api/signer/">Signers</a></div><div class="child link depth-3"><a href="/api/signer/#signer">Signer</a></div><div class="child link depth-3"><a href="/api/signer/#wallet">Wallet</a></div><div class="child link depth-3"><a href="/api/signer/#voidsigner">VoidSigner</a></div><div class="child link depth-3"><a href="/api/signer/#externallyownedaccount">ExternallyOwnedAccount</a></div><div class="show link depth-2"><a href="/api/providers/">Providers</a></div><div class="hide link depth-3"><a href="/api/providers/provider/">Provider</a></div><div class="hide link depth-4"><a href="/api/providers/provider/#accounts-methods">Accounts Methods</a></div><div class="hide link depth-4"><a href="/api/providers/provider/#blocks-methods">Blocks Methods</a></div><div class="hide link depth-4"><a href="/api/providers/provider/#ethereum-naming-service-(ens)-methods">Ethereum Naming Service (ENS) Methods</a></div><div class="hide link depth-4"><a href="/api/providers/provider/#logs-methods">Logs Methods</a></div><div class="hide link depth-4"><a href="/api/providers/provider/#network-status-methods">Network Status Methods</a></div><div class="hide link depth-4"><a href="/api/providers/provider/#transactions-methods">Transactions Methods</a></div><div class="hide link depth-4"><a href="/api/providers/provider/#event-emitter-methods">Event Emitter Methods</a></div><div class="hide link depth-4"><a href="/api/providers/provider/#inspection-methods">Inspection Methods</a></div><div class="hide link depth-3"><a href="/api/providers/jsonrpc-provider/">JsonRpcProvider</a></div><div class="hide link depth-4"><a href="/api/providers/jsonrpc-provider/#jsonrpcsigner">JsonRpcSigner</a></div><div class="hide link depth-4"><a href="/api/providers/jsonrpc-provider/#jsonrpcuncheckedsigner">JsonRpcUncheckedSigner</a></div><div class="hide link depth-3"><a href="/api/providers/api-providers/">API Providers</a></div><div class="hide link depth-4"><a href="/api/providers/api-providers/#etherscanprovider">EtherscanProvider</a></div><div class="hide link depth-4"><a href="/api/providers/api-providers/#infuraprovider">InfuraProvider</a></div><div class="hide link depth-4"><a href="/api/providers/api-providers/#alchemyprovider">AlchemyProvider</a></div><div class="hide link depth-4"><a href="/api/providers/api-providers/#cloudfrontprovider">CloudfrontProvider</a></div><div class="hide link depth-3"><a href="/api/providers/other/">Other Providers</a></div><div class="hide link depth-4"><a href="/api/providers/other/#fallbackprovider">FallbackProvider</a></div><div class="hide link depth-4"><a href="/api/providers/other/#ipcprovider">IpcProvi
2019-12-14 06:05:10 +03:00
<a name="signers"></a><h1 class="show-anchors"><div>Signers<div class="anchors"><a class="self" href="#signers"></a></div></div></h1>
2020-02-02 08:53:22 +03:00
<p>A Signer represents...</p>
<a name="signer"></a><a name="signer"></a><h2 class="show-anchors"><div>Signer<div class="anchors"><a class="self" href="#signer"></a><a class="source" href="https://github.com/ethers-io/ethers.js/blob/ethers-v5-beta/packages/abstract-signer/src.ts/index.ts#L30">source</a></div></div></h2>
<p>The <b>Signer</b> class is abstract and cannot be directly instaniated. Instead use one of the concreate sub-classes, such as the <a href="/api/signer/#wallet">Wallet</a>, <a href="/api/signer/#void-signer">VoidSigner</a> or <a href="/api/providers/jsonrpc-provider/#signer-jsonrpc">JsonRpcSigner</a>.</p>
<a name="signer-connect"></a><div class="property show-anchors"><div class="signature"><span class="path">signer</span> . <span class="method">connect</span> ( <span class="param">provider</span> ) <span class="arrow">&rArr;</span> <span class="returns"><a href="/api/signer/#signer">Signer</a></span><div class="anchors"><a class="self" href="#signer-connect"></a></div></div><div class="body"><p>Sub-classes <b>must</b> implement this, however they may simply throw an error if changing providers is not supported.</p></div></div>
<a name="signer-getaddress"></a><div class="property show-anchors"><div class="signature"><span class="path">signer</span> . <span class="method">getAddress</span> ( ) <span class="arrow">&rArr;</span> <span class="returns">Promise&lt;&thinsp;string&lt;&thinsp;<a href="/api/utils/address/#address">Address</a>&thinsp;&gt;&thinsp;&gt;</span><div class="anchors"><a class="self" href="#signer-getaddress"></a><a class="source" href="https://github.com/ethers-io/ethers.js/blob/ethers-v5-beta/packages/abstract-signer/src.ts/index.ts#L53">source</a></div></div><div class="body"><p>Returns a Promise that resolves to the account address.</p><p>This is a Promise so that a <b>Signer</b> can be designed around an asynchronous source, such as hardware wallets.</p><p>Sub-classes <b>must</b> implement this.</p></div></div>
2020-02-18 01:56:50 +03:00
<a name="signer-issigner"></a><div class="property show-anchors"><div class="signature"><span class="path">Signer</span> . <span class="method">isSigner</span> ( <span class="param">object</span> ) <span class="arrow">&rArr;</span> <span class="returns">boolean</span><div class="anchors"><a class="self" href="#signer-issigner"></a><a class="source" href="https://github.com/ethers-io/ethers.js/blob/ethers-v5-beta/packages/abstract-signer/src.ts/index.ts#L205">source</a></div></div><div class="body"><p>Returns true if an only if <i>object</i> is a <b>Signer</b>.</p></div></div>
2020-02-02 08:53:22 +03:00
<a name="signer-blockchain"></a><a name="blockchain-methods"></a><h3 class="show-anchors"><div>Blockchain Methods<div class="anchors"><a class="self" href="#signer-blockchain"></a></div></div></h3>
2020-02-02 08:53:22 +03:00
<a name="signer-getbalance"></a><div class="property show-anchors"><div class="signature"><span class="path">signer</span> . <span class="method">getBalance</span> ( [ <span class="param">blockTag</span> = <span class="default-value">"</span><span class="param">latest</span>" ] ) <span class="arrow">&rArr;</span> <span class="returns">Promise&lt;&thinsp;<a href="/api/utils/bignumber/">BigNumber</a>&thinsp;&gt;</span><div class="anchors"><a class="self" href="#signer-getbalance"></a><a class="source" href="https://github.com/ethers-io/ethers.js/blob/ethers-v5-beta/packages/abstract-signer/src.ts/index.ts#L69">source</a></div></div><div class="body"><p>Returns the balance of this wallet at <i>blockTag</i>.</p></div></div>
<a name="signer-getchainid"></a><div class="property show-anchors"><div class="signature"><span class="path">signer</span> . <span class="method">getChainId</span> ( ) <span class="arrow">&rArr;</span> <span class="returns">Promise&lt;&thinsp;number&thinsp;&gt;</span><div class="anchors"><a class="self" href="#signer-getchainid"></a><a class="source" href="https://github.com/ethers-io/ethers.js/blob/ethers-v5-beta/packages/abstract-signer/src.ts/index.ts#L105">source</a></div></div><div class="body"><p>Returns ths chain ID this wallet is connected to.</p></div></div>
<a name="signer-getgasprice"></a><div class="property show-anchors"><div class="signature"><span class="path">signer</span> . <span class="method">getGasPrice</span> ( ) <span class="arrow">&rArr;</span> <span class="returns">Promise&lt;&thinsp;<a href="/api/utils/bignumber/">BigNumber</a>&thinsp;&gt;</span><div class="anchors"><a class="self" href="#signer-getgasprice"></a><a class="source" href="https://github.com/ethers-io/ethers.js/blob/ethers-v5-beta/packages/abstract-signer/src.ts/index.ts#L110">source</a></div></div><div class="body"><p>Returns the current gas price.</p></div></div>
<a name="signer-gettransactioncount"></a><div class="property show-anchors"><div class="signature"><span class="path">signer</span> . <span class="method">getTransactionCount</span> ( [ <span class="param">blockTag</span> = <span class="default-value">"</span><span class="param">latest</span>" ] ) <span class="arrow">&rArr;</span> <span class="returns">Promise&lt;&thinsp;number&thinsp;&gt;</span><div class="anchors"><a class="self" href="#signer-gettransactioncount"></a><a class="source" href="https://github.com/ethers-io/ethers.js/blob/ethers-v5-beta/packages/abstract-signer/src.ts/index.ts#L74">source</a></div></div><div class="body"><p>Returns the number of transactions this account has ever sent. This is the value required to be included in transactions as the <code class="inline">nonce</code>.</p></div></div>
<a name="signer-call"></a><div class="property show-anchors"><div class="signature"><span class="path">signer</span> . <span class="method">call</span> ( <span class="param">transactionRequest</span> ) <span class="arrow">&rArr;</span> <span class="returns">Promise&lt;&thinsp;string&lt;&thinsp;<a href="/api/utils/bytes/#datahexstring">DataHexstring</a>&thinsp;&gt;&thinsp;&gt;</span><div class="anchors"><a class="self" href="#signer-call"></a><a class="source" href="https://github.com/ethers-io/ethers.js/blob/ethers-v5-beta/packages/abstract-signer/src.ts/index.ts#L88">source</a></div></div><div class="body"><p>Returns the result of calling using the <i>transactionRequest</i>, with this account address being used as the <code class="inline">from</code> field.</p></div></div>
<a name="signer-estimategas"></a><div class="property show-anchors"><div class="signature"><span class="path">signer</span> . <span class="method">estimateGas</span> ( <span class="param">transactionRequest</span> ) <span class="arrow">&rArr;</span> <span class="returns">Promise&lt;&thinsp;<a href="/api/utils/bignumber/">BigNumber</a>&thinsp;&gt;</span><div class="anchors"><a class="self" href="#signer-estimategas"></a><a class="source" href="https://github.com/ethers-io/ethers.js/blob/ethers-v5-beta/packages/abstract-signer/src.ts/index.ts#L80">source</a></div></div><div class="body"><p>Returns the result of estimating the cost to send the <i>transactionRequest</i>, with this account address being used as the <code class="inline">from</code> field.</p></div></div>
<a name="signer-resolvename"></a><div class="property show-anchors"><div class="signature"><span class="path">signer</span> . <span class="method">resolveName</span> ( <span class="param">ensName</span> ) <span class="arrow">&rArr;</span> <span class="returns">Promise&lt;&thinsp;string&lt;&thinsp;<a href="/api/utils/address/#address">Address</a>&thinsp;&gt;&thinsp;&gt;</span><div class="anchors"><a class="self" href="#signer-resolvename"></a><a class="source" href="https://github.com/ethers-io/ethers.js/blob/ethers-v5-beta/packages/abstract-signer/src.ts/index.ts#L115">source</a></div></div><div class="body"><p>Returns the address associated with the <i>ensName</i>.</p></div></div>
<a name="signing"></a><h3 class="show-anchors"><div>Signing<div class="anchors"><a class="self" href="#signing"></a></div></div></h3>
2020-02-02 08:53:22 +03:00
<a name="signer-signmessage"></a><div class="property show-anchors"><div class="signature"><span class="path">signer</span> . <span class="method">signMessage</span> ( <span class="param">message</span> ) <span class="arrow">&rArr;</span> <span class="returns">Promise&lt;&thinsp;string&lt;&thinsp;<a href="/api/utils/bytes/#signature-flat">FlatSignature</a>&thinsp;&gt;&thinsp;&gt;</span><div class="anchors"><a class="self" href="#signer-signmessage"></a></div></div><div class="body"><p>This returns a Promise which resolves to the <a href="/api/utils/bytes/#signature-flat">Flat-Format Signature</a> of <i>message</i>.</p><p>Sub-classes <b>must</b> implement this, however they may throw if signing a message is not supported.</p></div></div>
<div class="definition container-box note show-anchors"><div class="term">Note</div><div class="body"><p>If <i>message</i> is a string, it is <b>treated as a string</b> and converted to its representation in UTF8 bytes.</p><p><b>If and only if</b> a message is a <a href="/api/utils/bytes/#bytes">Bytes</a> will it be treated as binary data.</p><p>For example, the string <code class="inline">"0x1234"</code> is 6 characters long (and in this case 6 bytes long). This is <b>not</b> equivalent to the array <code class="inline">[ 0x12, 0x34 ]</code>, which is 2 bytes long.</p><p>A common case is to sign a hash. In this case, if the hash is a string, it <b>must</b> be converted to an array first, using the <a href="/api/utils/bytes/#utils-arrayify">arrayify</a> utility function.</p></div></div>
<a name="signer-signtransaction"></a><div class="property show-anchors"><div class="signature"><span class="path">signer</span> . <span class="method">signTransaction</span> ( <span class="param">transactionRequest</span> ) <span class="arrow">&rArr;</span> <span class="returns">Promise&lt;&thinsp;string&lt;&thinsp;<a href="/api/utils/bytes/#datahexstring">DataHexstring</a>&thinsp;&gt;&thinsp;&gt;</span><div class="anchors"><a class="self" href="#signer-signtransaction"></a></div></div><div class="body"><p>Returns a Promise which resolves to the signed transaction of the <i>transactionRequest</i>. This method does not populate any missing fields.</p><p>Sub-classes <b>must</b> implement this, however they may throw if signing a transaction is not supported.</p></div></div>
<a name="signer-sendtransaction"></a><div class="property show-anchors"><div class="signature"><span class="path">signer</span> . <span class="method">sendTransaction</span> ( <span class="param">transactionRequest</span> ) <span class="arrow">&rArr;</span> <span class="returns">Promise&lt;&thinsp;<a href="/api/providers/types/#provider-transactionresponse">TransactionResponse</a>&thinsp;&gt;</span><div class="anchors"><a class="self" href="#signer-sendtransaction"></a></div></div><div class="body"><p>This method populates the transactionRequest with missing fields, using <a href="/api/signer/#signer-populatetransaction">populateTransaction</a> and returns a Promise which resolves to the transaction.</p><p>Sub-classes <b>must</b> implement this, however they may throw if signing a transaction is not supported.</p></div></div>
<a name="signer-subclassing"></a><a name="sub-classes"></a><h3 class="show-anchors"><div>Sub-Classes<div class="anchors"><a class="self" href="#signer-subclassing"></a></div></div></h3>
<p>It is very important that all important properties of a <b>Signer</b> are <b>immutable</b>. Since Ethereum is very asynchronous and deals with critical data (such as ether and other potentially valuable crypto assets), keeping properties such as the <i>provider</i> and <i>address</i> static helps prevent serious issues.</p><p>A sub-class <b>must</b> call <code class="inline">super()</code>.</p>
<a name="signer-checktransaction"></a><div class="property show-anchors"><div class="signature"><span class="path">signer</span> . <span class="method">checkTransaction</span> ( <span class="param">transactionRequest</span> ) <span class="arrow">&rArr;</span> <span class="returns"><a href="/api/providers/types/#provider-transactionrequest">TransactionRequest</a></span><div class="anchors"><a class="self" href="#signer-checktransaction"></a><a class="source" href="https://github.com/ethers-io/ethers.js/blob/ethers-v5-beta/packages/abstract-signer/src.ts/index.ts#L132">source</a></div></div><div class="body"><p>This is generally not required to be overridden, but may needed to provide custom behaviour in sub-classes.</p><p>This should return a <b>copy</b> of the <i>transactionRequest</i>, with any properties needed by <code class="inline">call</code>, <code class="inline">estimateGas</code> and <code class="inline">populateTransaction</code> (which is used by sendTransaction). It should also throw an error if any unknown key is specified.</p><p>The default implementation checks only valid <a href="/api/providers/types/#provider-transactionrequest">TransactionRequest</a> properties exist and adds <code class="inline">from</code> to the transaction if it does not exist, or verifies it is equal to the Signer's address if it does exist.</p></div></div>
<a name="signer-populatetransaction"></a><div class="property show-anchors"><div class="signature"><span class="path">signer</span> . <span class="method">populateTransaction</span> ( <span class="param">transactionRequest</span> ) <span class="arrow">&rArr;</span> <span class="returns">Promise&lt;&thinsp;<a href="/api/providers/types/#provider-transactionrequest">TransactionRequest</a>&thinsp;&gt;</span><div class="anchors"><a class="self" href="#signer-populatetransaction"></a><a class="source" href="https://github.com/ethers-io/ethers.js/blob/ethers-v5-beta/packages/abstract-signer/src.ts/index.ts#L163">source</a></div></div><div class="body"><p>This is generally not required to be overridden, but may needed to provide custom behaviour in sub-classes.</p><p>This should return a <b>copy</b> of <i>transactionRequest</i>, follow the same procedure as <code class="inline">checkTransaction</code> and fill in any properties required for sending a transaction. The result should have all promises resolved; if needed the <a href="/api/utils/properties/#utils-resolveproperties">resolveProperties</a> utility function can be used for this.</p><p>The default implementation calls <code class="inline">checkTransaction</code> and resolves to if it is an ENS name, adds <code class="inline">gasPrice</code>, <code class="inline">nonce</code>, <code class="inline">gasLimit</code> and <code class="inline">chainId</code> based on the related operations on Signer.</p></div></div>
<a name="wallet"></a><a name="wallet"></a><h2 class="show-anchors"><div>Wallet<span class="inherits"> inherits <a href="/api/signer/#externally-owned-account">ExternallyOwnedAccount</a> and <a href="/api/signer/#signer">Signer</a></span><div class="anchors"><a class="self" href="#wallet"></a><a class="source" href="https://github.com/ethers-io/ethers.js/blob/ethers-v5-beta/packages/wallet/src.ts/index.ts#L30">source</a></div></div></h2>
2019-12-14 06:05:10 +03:00
<p>The Wallet class inherits <a href="/api/signer/#signer">Signer</a> and can sign transactions and messages using a private key as a standard Externally Owned Account (EOA).</p>
2020-02-02 08:53:22 +03:00
<a name="wallet-constructor"></a><div class="property show-anchors"><div class="signature"><span class="modifier">new </span><span class="path">ethers</span> . <span class="method">Wallet</span> ( <span class="param">privateKey</span> [ , <span class="param">provider</span> ] ) <div class="anchors"><a class="self" href="#wallet-constructor"></a><a class="source" href="https://github.com/ethers-io/ethers.js/blob/ethers-v5-beta/packages/wallet/src.ts/index.ts#L40">source</a></div></div><div class="body"><p>Create a new Wallet instance for <i>privateKey</i> and optionally connected to the <i>provider</i>.</p></div></div>
2020-02-18 01:56:50 +03:00
<a name="wallet-createrandom"></a><div class="property show-anchors"><div class="signature"><span class="path">ethers</span> . <span class="path">Wallet</span> . <span class="method">createRandom</span> ( [ <span class="param">options</span> = <span class="default-value">{</span>} ] ) <span class="arrow">&rArr;</span> <span class="returns"><a href="/api/signer/#wallet">Wallet</a></span><div class="anchors"><a class="self" href="#wallet-createrandom"></a><a class="source" href="https://github.com/ethers-io/ethers.js/blob/ethers-v5-beta/packages/wallet/src.ts/index.ts#L143">source</a></div></div><div class="body"><p>Returns a new Wallet with a random private key, generated from cryptographically secure entropy sources. If the current environment does not have a secure entropy source, an error is thrown.</p></div></div>
<a name="wallet-fromencryptedjson"></a><div class="property show-anchors"><div class="signature"><span class="path">ethers</span> . <span class="path">Wallet</span> . <span class="method">fromEncryptedJson</span> ( <span class="param">json</span> , <span class="param">password</span> [ , <span class="param">progress</span> ] ) <span class="arrow">&rArr;</span> <span class="returns">Promise&lt;&thinsp;<a href="/api/signer/#wallet">Wallet</a>&thinsp;&gt;</span><div class="anchors"><a class="self" href="#wallet-fromencryptedjson"></a><a class="source" href="https://github.com/ethers-io/ethers.js/blob/ethers-v5-beta/packages/wallet/src.ts/index.ts#L156">source</a></div></div><div class="body"><p>Create an instance from an encrypted JSON wallet. If <i>progress</i> is provided it will be called during decryption with a value between 0 and 1 indicating the progress towards completion.</p></div></div>
2020-02-02 08:53:22 +03:00
<div class="property show-anchors"><div class="signature"><span class="path">ethers</span> . <span class="path">Wallet</span> . <span class="method">fromMnemonic</span> ( <span class="param">mnemonic</span> [ , <span class="param">path</span> , [ <span class="param">wordlist</span> ] ] ) <span class="arrow">&rArr;</span> <span class="returns"><a href="/api/signer/#wallet">Wallet</a></span><div class="anchors"></div></div><div class="body"><p>Create an instance from a mnemonic phrase.</p><p>If path is not specified, the Ethereum default path is used (i.e. m/44'/60'/0'/0/0).</p><p>If wordlist is not specified, the English Wordlist is used.</p></div></div>
<a name="properties"></a><h3 class="show-anchors"><div>Properties<div class="anchors"><a class="self" href="#properties"></a></div></div></h3>
<div class="property show-anchors"><div class="signature"><span class="path">wallet</span> . <span class="method">address</span> <span class="arrow">&rArr;</span> <span class="returns">string&lt;&thinsp;<a href="/api/utils/address/#address">Address</a>&thinsp;&gt;</span><div class="anchors"></div></div><div class="body"><p>The address for the account this Wallet represents.</p></div></div>
<div class="property show-anchors"><div class="signature"><span class="path">wallet</span> . <span class="method">provider</span> <span class="arrow">&rArr;</span> <span class="returns"><a href="/api/providers/provider/">Provider</a></span><div class="anchors"></div></div><div class="body"><p>The provider this wallet is connected to, which will ge used for any <a href="/api/signer/#signer-blockchain">Blockchain Methods</a> methods. This can be null.</p></div></div>
<div class="definition container-box note show-anchors"><div class="term">Note</div><div class="body"><p>A <b>Wallet</b> instance is immuatable, so if you wish to change the Provider, you may use the <a href="/api/signer/#signer-connect">connect</a> method to create a new instance connected to the desired provider.</p></div></div>
<div class="property show-anchors"><div class="signature"><span class="path">wallet</span> . <span class="method">publicKey</span> <span class="arrow">&rArr;</span> <span class="returns">string&lt;&thinsp;<a href="/api/utils/bytes/#datahexstring">DataHexstring</a>&lt;&thinsp;65&thinsp;&gt;&thinsp;&gt;</span><div class="anchors"></div></div><div class="body"><p>The uncompressed public key for this Wallet represents.</p></div></div>
<a name="methods"></a><h3 class="show-anchors"><div>Methods<div class="anchors"><a class="self" href="#methods"></a></div></div></h3>
<div class="property show-anchors"><div class="signature"><span class="path">wallet</span> . <span class="method">encrypt</span> ( <span class="param">password</span> , [ <span class="param">options</span> = <span class="default-value">{</span>} , [ <span class="param">progress</span> ] ] ) <span class="arrow">&rArr;</span> <span class="returns">Promise&lt;&thinsp;string&thinsp;&gt;</span><div class="anchors"></div></div><div class="body"><p>Encrypt the wallet using <i>password</i> returning a Promise which resolves to a JSON wallet.</p></div></div>
2020-02-18 01:56:50 +03:00
<a name="void-signer"></a><a name="voidsigner"></a><h2 class="show-anchors"><div>VoidSigner<span class="inherits"> inherits <a href="/api/signer/#signer">Signer</a></span><div class="anchors"><a class="self" href="#void-signer"></a><a class="source" href="https://github.com/ethers-io/ethers.js/blob/ethers-v5-beta/packages/abstract-signer/src.ts/index.ts#L210">source</a></div></div></h2>
2020-02-02 08:53:22 +03:00
<p>A <b>VoidSigner</b> is a simple Signer which cannot sign.</p><p>It is useful as a read-only signer, when an API requires a Signer as a parameter, but it is known only read-only operations will be carried.</p><p>For example, the <code class="inline">call</code> operation will automatically have the provided address passed along during the execution.</p>
<div class="property show-anchors"><div class="signature"><span class="modifier">new </span><span class="path">ethers</span> . <span class="method">VoidSigner</span> ( <span class="param">address</span> ) <span class="arrow">&rArr;</span> <span class="returns"><a href="/api/signer/#void-signer">VoidSigner</a></span><div class="anchors"></div></div><div class="body"><p>Create a new instance of a <b>VoidSigner</b> for <i>address</i>.</p></div></div>
<div class="property show-anchors"><div class="signature"><span class="path">voidSigner</span> . <span class="method">address</span> <span class="arrow">&rArr;</span> <span class="returns">string&lt;&thinsp;<a href="/api/utils/address/#address">Address</a>&thinsp;&gt;</span><div class="anchors"></div></div><div class="body"><p>The address of this <b>VoidSigner</b>.</p></div></div>
<a name="externally-owned-account"></a><a name="externallyownedaccount"></a><h2 class="show-anchors"><div>ExternallyOwnedAccount<div class="anchors"><a class="self" href="#externally-owned-account"></a></div></div></h2>
2020-02-02 08:53:22 +03:00
<div class="property show-anchors"><div class="signature"><span class="path">eoa</span> . <span class="method">address</span> <span class="arrow">&rArr;</span> <span class="returns">string&lt;&thinsp;<a href="/api/utils/address/#address">Address</a>&thinsp;&gt;</span><div class="anchors"></div></div><div class="body"><p>The <a href="/api/utils/address/#address">Address</a> of this EOA.</p></div></div>
<div class="property show-anchors"><div class="signature"><span class="path">eoa</span> . <span class="method">privateKey</span> <span class="arrow">&rArr;</span> <span class="returns">string&lt;&thinsp;<a href="/api/utils/bytes/#datahexstring">DataHexstring</a>&lt;&thinsp;32&thinsp;&gt;&thinsp;&gt;</span><div class="anchors"></div></div><div class="body"><p>The privateKey of this EOA</p></div></div>
<div class="property show-anchors"><div class="signature"><span class="path">eoa</span> . <span class="method">mnemonic</span> <span class="arrow">&rArr;</span> <span class="returns">string</span><div class="anchors"></div></div><div class="body"><p><i>Optional</i>. The account HD mnemonic, if it has one and can be determined.</p></div></div>
2020-02-18 01:56:50 +03:00
<div class="property show-anchors"><div class="signature"><span class="path">eoa</span> . <span class="method">path</span> <span class="arrow">&rArr;</span> <span class="returns">string</span><div class="anchors"></div></div><div class="body"><p><i>Optional</i>. The account HD path, if it has one and can be determined.</p></div></div><div class="footer"><div class="nav previous"><a href="/api/contract/"><span class="arrow">&larr;</span>Contracts</a></div> <div class="nav next"><a href="/api/providers/">Providers<span class="arrow">&rarr;</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 Attribution 4.0 International License</a>.</div></div><script src="/script.js" type="text/javascript"></script></body></html><!-- ContentHash:f8ad55e1a73a42b6c441ffc866de012dd177e039cf868ef8e53fd2cfd9ab35df -->