130 lines
31 KiB
HTML
130 lines
31 KiB
HTML
<!DOCTYPE html>
|
|
<html class="paged">
|
|
<head>
|
|
<title>Interface</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</div></a></div>
|
|
</div>
|
|
<div class="toc"><div>
|
|
<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="ancestor show link depth-2"><a href="/v5/api/utils/">Utilities</a></div><div class="ancestor show link depth-3"><a href="/v5/api/utils/abi/">Application Binary Interface</a></div><div class="show link depth-4"><a href="/v5/api/utils/abi/coder/">AbiCoder</a></div><div class="show link depth-4"><a href="/v5/api/utils/abi/formats/">ABI Formats</a></div><div class="show link depth-4"><a href="/v5/api/utils/abi/fragments/">Fragments</a></div><div class="myself ancestor ancestor show link depth-4"><a href="/v5/api/utils/abi/interface/">Interface</a></div><div class="show link depth-3"><a href="/v5/api/utils/address/">Addresses</a></div><div class="show link depth-3"><a href="/v5/api/utils/bignumber/">BigNumber</a></div><div class="show link depth-3"><a href="/v5/api/utils/bytes/">Byte Manipulation</a></div><div class="show link depth-3"><a href="/v5/api/utils/constants/">Constants</a></div><div class="show link depth-3"><a href="/v5/api/utils/display-logic/">Display Logic and Input</a></div><div class="show link depth-3"><a href="/v5/api/utils/encoding/">Encoding Utilities</a></div><div class="show link depth-3"><a href="/v5/api/utils/fixednumber/">FixedNumber</a></div><div class="show link depth-3"><a href="/v5/api/utils/hashing/">Hashing Algorithms</a></div><div class="show link depth-3"><a href="/v5/api/utils/hdnode/">HD Wallet</a></div><div class="show link depth-3"><a href="/v5/api/utils/logger/">Logging</a></div><div class="show link depth-3"><a href="/v5/api/utils/properties/">Property Utilities</a></div><div class="show link depth-3"><a href="/v5/api/utils/signing-key/">Signing Key</a></div><div class="show link depth-3"><a href="/v5/api/utils/strings/">Strings</a></div><div class="show link depth-3"><a href="/v5/api/utils/transactions/">Transactions</a></div><div class="show link depth-3"><a href="/v5/api/utils/web/">Web Utilities</a></div><div class="show 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="show link depth-2"><a href="/v5/api/experimental/">Experimental</a></div><div class="base show link depth-1"><a href="/v5/cli/">Command Line Interfaces</a></div><div class="hide link depth-2"><a href="/v5/cli/ethers/">Sandbox Utility</a></div><div class="hide link depth-2"><a href="/v5/cli/asm/">Assembler</a></div><div class="hide link depth-2"><a href="/v5/cli/ens/">Ethereum Naming Service</a></div><div class="hide link depth-2"><a href="/v5/cli/typescript/">TypeScript</a></div><div class="hide link depth-2"><a href="/v5/cli/plugin/">Making Your Own</a></div><div class="base show link depth-1"><a href="/v5/cookbook/">Cookbook</a></div><div class="base show link depth-1"><a href="/v5/migration/">Migration Guide</a></div><div class="hide link depth-2"><a href="/v5/migration/web3/">Migration: From Web3.js</a></div><div class="hide link depth-2"><a href="/v5/migration/ethers-v4/">Migration: From Ethers v4</a></div><div class="base show link depth-1"><a href="/v5/testing/">Testing</a></div><div class="base show link depth-1"><a href="/v5/contributing/">Contributing and Hacking</a></div><div class="base show link depth-1"><a href="/v5/documentation/">Flatworm Docs</a></div><div class="base show link depth-1"><a href="/v5/license/">License and Copyright</a></div>
|
|
</div></div>
|
|
</div>
|
|
<div class="content">
|
|
<div class="breadcrumbs"><a href="/v5/">Documentation</a> » <a href="/v5/api/">API</a> » <a href="/v5/api/utils/">Utilities</a> » <a href="/v5/api/utils/abi/">ABI</a> » <span class="current">Interface</span></div>
|
|
|
|
<a name="Interface"></a><a name="Interface"></a><h1 class="show-anchors"><div>Interface<div class="anchors"><a class="self" href="/v5/api/utils/abi/interface/#Interface"></a><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/abi/src.ts/interface.ts#L65">source</a></div></div></h1><p>The <b>Interface</b> Class abstracts the encoding and decoding required to interact with contracts on the Ethereum network.</p>
|
|
|
|
<p>Many of the standards organically evolved along side the <a href="https://solidity.readthedocs.io/en/v0.6.2/">Solidity</a> language, which other languages have adopted to remain compatibile with existing deployed contracts.</p>
|
|
|
|
<p>The EVM itself does not understand what the ABI is. It is simply an agreed upon set of formats to encode various types of data which each contract can expect so they can interoperate with each other.</p>
|
|
|
|
<a name="Interface--creating"></a><a name="Interface--Interface--creating"></a><h2 class="show-anchors"><div>Creating Instances<div class="anchors"><a class="self" href="/v5/api/utils/abi/interface/#Interface--creating"></a></div></div></h2>
|
|
<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">utils</span><span class="symbol">.</span><span class="method">Interface</span><span class="symbol">(</span> <span class="param">abi</span> <span class="symbol">)</span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/abi/src.ts/interface.ts#L79">source</a></div></div><div class="body"><p>Create a new <b>Interface</b> from a JSON string or object representing <i>abi</i>.</p>
|
|
|
|
<p>The <i>abi</i> may be a JSON string or the parsed Object (using JSON.parse) which is emitted by the <a href="https://solidity.readthedocs.io/en/v0.6.0/using-the-compiler.html#output-description">Solidity compiler</a> (or compatible languages).</p>
|
|
|
|
<p>The <i>abi</i> may also be a <a href="https://blog.ricmoo.com/human-readable-contract-abis-in-ethers-js-141902f4d917">Human-Readable Abi</a>, which is a format the Ethers created to simplify manually typing the ABI into the source and so that a Contract ABI can also be referenced easily within the same source file.</p>
|
|
|
|
</div></div><a name="Interface--properties"></a><a name="Interface--Interface--properties"></a><h2 class="show-anchors"><div>Properties<div class="anchors"><a class="self" href="/v5/api/utils/abi/interface/#Interface--properties"></a></div></div></h2>
|
|
<div class="property show-anchors"><div class="signature"><span class="path">interface</span><span class="symbol">.</span><span class="method">fragments</span> <span class="arrow">⇒</span> <span class="returns">Array< <a href="/v5/api/utils/abi/fragments/#Fragment">Fragment</a> ></span><div class="anchors"></div></div><div class="body"><p>All the <a href="/v5/api/utils/abi/fragments/#Fragment">Fragments</a> in the interface.</p>
|
|
|
|
</div></div><div class="property show-anchors"><div class="signature"><span class="path">interface</span><span class="symbol">.</span><span class="method">events</span> <span class="arrow">⇒</span> <span class="returns">Array< <a href="/v5/api/utils/abi/fragments/#EventFragment">EventFragment</a> ></span><div class="anchors"></div></div><div class="body"><p>All the <a href="/v5/api/utils/abi/fragments/#EventFragment">Event Fragments</a> in the interface.</p>
|
|
|
|
</div></div><div class="property show-anchors"><div class="signature"><span class="path">interface</span><span class="symbol">.</span><span class="method">functions</span> <span class="arrow">⇒</span> <span class="returns">Array< <a href="/v5/api/utils/abi/fragments/#FunctionFragment">FunctionFragment</a> ></span><div class="anchors"></div></div><div class="body"><p>All the <a href="/v5/api/utils/abi/fragments/#FunctionFragment">Function Fragments</a> in the interface.</p>
|
|
|
|
</div></div><div class="property show-anchors"><div class="signature"><span class="path">interface</span><span class="symbol">.</span><span class="method">deploy</span> <span class="arrow">⇒</span> <span class="returns"><a href="/v5/api/utils/abi/fragments/#ConstructorFragment">ConstructorFragment</a></span><div class="anchors"></div></div><div class="body"><p>The <a href="/v5/api/utils/abi/fragments/#ConstructorFragment">Constructor Fragments</a> for the interface.</p>
|
|
|
|
</div></div><a name="Interface--formatting"></a><a name="Interface--Interface--formatting"></a><h2 class="show-anchors"><div>Formatting<div class="anchors"><a class="self" href="/v5/api/utils/abi/interface/#Interface--formatting"></a></div></div></h2>
|
|
<div class="property show-anchors"><div class="signature"><span class="path">interface</span><span class="symbol">.</span><span class="method">format</span><span class="symbol">(</span> <span class="symbol">[</span> <span class="param">format</span> <span class="symbol">]</span> <span class="symbol">)</span> <span class="arrow">⇒</span> <span class="returns">string | Array< string ></span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/abi/src.ts/interface.ts#L145">source</a></div></div><div class="body"><p>Return the formatted <b>Interface</b>. If the format type is <code class="inline">json</code> a single string is returned, otherwise an Array of the human-readable strings is returned.</p>
|
|
|
|
</div></div><a name="Interface--fragments"></a><a name="Interface--Interface--fragments"></a><h2 class="show-anchors"><div>Fragment Access<div class="anchors"><a class="self" href="/v5/api/utils/abi/interface/#Interface--fragments"></a></div></div></h2>
|
|
<div class="property show-anchors"><div class="signature"><span class="path">interface</span><span class="symbol">.</span><span class="method">getFunction</span><span class="symbol">(</span> <span class="param">fragment</span> <span class="symbol">)</span> <span class="arrow">⇒</span> <span class="returns"><a href="/v5/api/utils/abi/fragments/#FunctionFragment">FunctionFragment</a></span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/abi/src.ts/interface.ts#L179">source</a></div></div><div class="body"><p>Returns the <a href="/v5/api/utils/abi/fragments/#FunctionFragment">FunctionFragment</a> for <i>fragment</i> (see <a href="/v5/api/utils/abi/interface/#Interface--specifying-fragments">Specifying Fragments</a>).</p>
|
|
|
|
</div></div><div class="property show-anchors"><div class="signature"><span class="path">interface</span><span class="symbol">.</span><span class="method">getEvent</span><span class="symbol">(</span> <span class="param">fragment</span> <span class="symbol">)</span> <span class="arrow">⇒</span> <span class="returns"><a href="/v5/api/utils/abi/fragments/#EventFragment">EventFragment</a></span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/abi/src.ts/interface.ts#L211">source</a></div></div><div class="body"><p>Returns the <a href="/v5/api/utils/abi/fragments/#EventFragment">EventFragment</a> for <i>fragment</i> (see <a href="/v5/api/utils/abi/interface/#Interface--specifying-fragments">Specifying Fragments</a>).</p>
|
|
|
|
</div></div><a name="Interface--selectors"></a><a name="Interface--Interface--selectors"></a><h2 class="show-anchors"><div>Signature and Topic Hashes<div class="anchors"><a class="self" href="/v5/api/utils/abi/interface/#Interface--selectors"></a></div></div></h2>
|
|
<div class="property show-anchors"><div class="signature"><span class="path">interface</span><span class="symbol">.</span><span class="method">getSighash</span><span class="symbol">(</span> <span class="param">fragment</span> <span class="symbol">)</span> <span class="arrow">⇒</span> <span class="returns">string< <a href="/v5/api/utils/bytes/#DataHexString">DataHexString</a>< 4 > ></span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/abi/src.ts/interface.ts#L244">source</a></div></div><div class="body"><p>Return the sighash (or Function Selector) for <i>fragment</i> (see <a href="/v5/api/utils/abi/interface/#Interface--specifying-fragments">Specifying Fragments</a>).</p>
|
|
|
|
</div></div><div class="property show-anchors"><div class="signature"><span class="path">interface</span><span class="symbol">.</span><span class="method">getEventTopic</span><span class="symbol">(</span> <span class="param">fragment</span> <span class="symbol">)</span> <span class="arrow">⇒</span> <span class="returns">string< <a href="/v5/api/utils/bytes/#DataHexString">DataHexString</a>< 32 > ></span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/abi/src.ts/interface.ts#L253">source</a></div></div><div class="body"><p>Return the topic hash for <i>fragment</i> (see <a href="/v5/api/utils/abi/interface/#Interface--specifying-fragments">Specifying Fragments</a>).</p>
|
|
|
|
</div></div><a name="Interface--encoding"></a><a name="Interface--Interface--encoding"></a><h2 class="show-anchors"><div>Encoding Data<div class="anchors"><a class="self" href="/v5/api/utils/abi/interface/#Interface--encoding"></a></div></div></h2>
|
|
<div class="property show-anchors"><div class="signature"><span class="path">interface</span><span class="symbol">.</span><span class="method">encodeDeploy</span><span class="symbol">(</span> <span class="symbol">[</span> <span class="param">values</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/abi/src.ts/interface.ts#L270">source</a></div></div><div class="body"><p>Return the encoded deployment data, which can be concatenated to the deployment bytecode of a contract to pass <i>values</i> into the contract constructor.</p>
|
|
|
|
</div></div><div class="property show-anchors"><div class="signature"><span class="path">interface</span><span class="symbol">.</span><span class="method">encodeFilterTopics</span><span class="symbol">(</span> <span class="param">fragment</span> <span class="symbol">[</span> <span class="symbol">,</span> <span class="param">values</span> <span class="symbol">]</span> <span class="symbol">)</span> <span class="arrow">⇒</span> <span class="returns">Array< topic | Array< topic > ></span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/abi/src.ts/interface.ts#L344">source</a></div></div><div class="body"><p>Returns the encoded topic filter, which can be passed to getLogs for <i>fragment</i> (see <a href="/v5/api/utils/abi/interface/#Interface--specifying-fragments">Specifying Fragments</a>) for the given <i>values</i>.</p>
|
|
|
|
<p>Each <i>topic</i> is a 32 byte (64 nibble) <a href="/v5/api/utils/bytes/#DataHexString">DataHexString</a>.</p>
|
|
|
|
</div></div><div class="property show-anchors"><div class="signature"><span class="path">interface</span><span class="symbol">.</span><span class="method">encodeFunctionData</span><span class="symbol">(</span> <span class="param">fragment</span> <span class="symbol">[</span> <span class="symbol">,</span> <span class="param">values</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/abi/src.ts/interface.ts#L290">source</a></div></div><div class="body"><p>Returns the encoded data, which can be used as the data for a transaction for <i>fragment</i> (see <a href="/v5/api/utils/abi/interface/#Interface--specifying-fragments">Specifying Fragments</a>) for the given <i>values</i>.</p>
|
|
|
|
</div></div><div class="property show-anchors"><div class="signature"><span class="path">interface</span><span class="symbol">.</span><span class="method">encodeFunctionResult</span><span class="symbol">(</span> <span class="param">fragment</span> <span class="symbol">[</span> <span class="symbol">,</span> <span class="param">values</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/abi/src.ts/interface.ts#L335">source</a></div></div><div class="body"><p>Returns the encoded result, which would normally be the response from a call for <i>fragment</i> (see <a href="/v5/api/utils/abi/interface/#Interface--specifying-fragments">Specifying Fragments</a>) for the given <i>values</i>.</p>
|
|
|
|
<p>Most developers will not need this method, but may be useful for authors of a mock blockchain.</p>
|
|
|
|
</div></div><a name="Interface--decoding"></a><a name="Interface--Interface--decoding"></a><h2 class="show-anchors"><div>Decoding Data<div class="anchors"><a class="self" href="/v5/api/utils/abi/interface/#Interface--decoding"></a></div></div></h2>
|
|
<div class="property show-anchors"><div class="signature"><span class="path">interface</span><span class="symbol">.</span><span class="method">decodeEventLog</span><span class="symbol">(</span> <span class="param">fragment</span> <span class="symbol">,</span> <span class="param">data</span> <span class="symbol">[</span> <span class="symbol">,</span> <span class="param">topics</span> <span class="symbol">]</span> <span class="symbol">)</span> <span class="arrow">⇒</span> <span class="returns"><a href="/v5/api/utils/abi/interface/#Result">Result</a></span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/abi/src.ts/interface.ts#L445">source</a></div></div><div class="body"><p>Returns the decoded event values from an event log for <i>fragment</i> (see <a href="/v5/api/utils/abi/interface/#Interface--specifying-fragments">Specifying Fragments</a>) for the given <i>data</i> with the optional <i>topics</i>.</p>
|
|
|
|
<p>If <i>topics</i> is not specified, placeholders will be inserted into the result.</p>
|
|
|
|
</div></div><div class="property show-anchors"><div class="signature"><span class="path">interface</span><span class="symbol">.</span><span class="method">decodeFunctionData</span><span class="symbol">(</span> <span class="param">fragment</span> <span class="symbol">,</span> <span class="param">data</span> <span class="symbol">)</span> <span class="arrow">⇒</span> <span class="returns"><a href="/v5/api/utils/abi/interface/#Result">Result</a></span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/abi/src.ts/interface.ts#L275">source</a></div></div><div class="body"><p>Returns the decoded values from transaction data for <i>fragment</i> (see <a href="/v5/api/utils/abi/interface/#Interface--specifying-fragments">Specifying Fragments</a>) for the given <i>data</i>.</p>
|
|
|
|
<p>Most developers will not need this method, but may be useful for debugging or inspecting transactions.</p>
|
|
|
|
</div></div><div class="property show-anchors"><div class="signature"><span class="path">interface</span><span class="symbol">.</span><span class="method">decodeFunctionResult</span><span class="symbol">(</span> <span class="param">fragment</span> <span class="symbol">,</span> <span class="param">data</span> <span class="symbol">)</span> <span class="arrow">⇒</span> <span class="returns"><a href="/v5/api/utils/abi/interface/#Result">Result</a></span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/abi/src.ts/interface.ts#L302">source</a></div></div><div class="body"><p>Returns the decoded values from the result of a call for <i>fragment</i> (see <a href="/v5/api/utils/abi/interface/#Interface--specifying-fragments">Specifying Fragments</a>) for the given <i>data</i>.</p>
|
|
|
|
</div></div><a name="Interface--parsing"></a><a name="Interface--Interface--parsing"></a><h2 class="show-anchors"><div>Parsing<div class="anchors"><a class="self" href="/v5/api/utils/abi/interface/#Interface--parsing"></a></div></div></h2><p>The functions are generally the most useful for most developers. They will automatically search the ABI for a matching Event or Function and decode the components as a fully specified description.</p>
|
|
|
|
<div class="property show-anchors"><div class="signature"><span class="path">interface</span><span class="symbol">.</span><span class="method">parseLog</span><span class="symbol">(</span> <span class="param">log</span> <span class="symbol">)</span> <span class="arrow">⇒</span> <span class="returns"><a href="/v5/api/utils/abi/interface/#LogDescription">LogDescription</a></span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/abi/src.ts/interface.ts#L552">source</a></div></div><div class="body"><p>Search the event that matches the <i>log</i> topic hash and parse the values the log represents.</p>
|
|
|
|
</div></div><div class="property show-anchors"><div class="signature"><span class="path">interface</span><span class="symbol">.</span><span class="method">parseTransaction</span><span class="symbol">(</span> <span class="param">transaction</span> <span class="symbol">)</span> <span class="arrow">⇒</span> <span class="returns"><a href="/v5/api/utils/abi/interface/#TransactionDescription">TransactionDescription</a></span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/abi/src.ts/interface.ts#L535">source</a></div></div><div class="body"><p>Search for the function that matches the <i>transaction</i> data sighash and parse the transaction properties.</p>
|
|
|
|
</div></div><a name="Interface--types"></a><a name="Interface--Interface--types"></a><h2 class="show-anchors"><div>Types<div class="anchors"><a class="self" href="/v5/api/utils/abi/interface/#Interface--types"></a></div></div></h2>
|
|
<a name="Result"></a><a name="Interface--Interface--types--Result"></a><h3 class="show-anchors"><div>Result<span class="inherits"> inherits Array<any></span><div class="anchors"><a class="self" href="/v5/api/utils/abi/interface/#Result"></a></div></div></h3><p>A <b>Result</b> is an array, so each value can be accessed as a positional argument.</p>
|
|
|
|
<p>Additionally, if values are named, the identical object as its positional value can be accessed by its name.</p>
|
|
|
|
<p>The name <code class="inline">length</code> is however reserved as it is part of the Array, so any named value for this key is renamed to <code class="inline">_length</code>. If there is a name collision, only the first is available by its key.</p>
|
|
|
|
<a name="LogDescription"></a><a name="Interface--Interface--types--LogDescription"></a><h3 class="show-anchors"><div>LogDescription<div class="anchors"><a class="self" href="/v5/api/utils/abi/interface/#LogDescription"></a></div></div></h3>
|
|
<div class="property show-anchors"><div class="signature"><span class="path">logDescription</span><span class="symbol">.</span><span class="method">args</span> <span class="arrow">⇒</span> <span class="returns"><a href="/v5/api/utils/abi/interface/#Result">Result</a></span><div class="anchors"></div></div><div class="body"><p>The values of the input parameters of the event.</p>
|
|
|
|
</div></div><div class="property show-anchors"><div class="signature"><span class="path">logDescription</span><span class="symbol">.</span><span class="method">eventFragment</span> <span class="arrow">⇒</span> <span class="returns"><a href="/v5/api/utils/abi/fragments/#EventFragment">EventFragment</a></span><div class="anchors"></div></div><div class="body"><p>The <a href="/v5/api/utils/abi/fragments/#EventFragment">EventFragment</a> which matches the topic in the Log.</p>
|
|
|
|
</div></div><div class="property show-anchors"><div class="signature"><span class="path">logDescription</span><span class="symbol">.</span><span class="method">name</span> <span class="arrow">⇒</span> <span class="returns">string</span><div class="anchors"></div></div><div class="body"><p>The event name. (e.g. <code class="inline">Transfer</code>)</p>
|
|
|
|
</div></div><div class="property show-anchors"><div class="signature"><span class="path">logDescription</span><span class="symbol">.</span><span class="method">signature</span> <span class="arrow">⇒</span> <span class="returns">string</span><div class="anchors"></div></div><div class="body"><p>The event signature. (e.g. <code class="inline">Transfer(address,address,uint256)</code>)</p>
|
|
|
|
</div></div><div class="property show-anchors"><div class="signature"><span class="path">logDescription</span><span class="symbol">.</span><span class="method">topic</span> <span class="arrow">⇒</span> <span class="returns">string</span><div class="anchors"></div></div><div class="body"><p>The topic hash.</p>
|
|
|
|
</div></div><a name="TransactionDescription"></a><a name="Interface--Interface--types--TransactionDescription"></a><h3 class="show-anchors"><div>TransactionDescription<div class="anchors"><a class="self" href="/v5/api/utils/abi/interface/#TransactionDescription"></a></div></div></h3>
|
|
<div class="property show-anchors"><div class="signature"><span class="path">transactionDescription</span><span class="symbol">.</span><span class="method">args</span> <span class="arrow">⇒</span> <span class="returns"><a href="/v5/api/utils/abi/interface/#Result">Result</a></span><div class="anchors"></div></div><div class="body"><p>The decoded values from the transaction data which were passed as the input parameters.</p>
|
|
|
|
</div></div><div class="property show-anchors"><div class="signature"><span class="path">transactionDescription</span><span class="symbol">.</span><span class="method">functionFragment</span> <span class="arrow">⇒</span> <span class="returns"><a href="/v5/api/utils/abi/fragments/#FunctionFragment">FunctionFragment</a></span><div class="anchors"></div></div><div class="body"><p>The <a href="/v5/api/utils/abi/fragments/#FunctionFragment">FunctionFragment</a> which matches the sighash in the transaction data.</p>
|
|
|
|
</div></div><div class="property show-anchors"><div class="signature"><span class="path">transactionDescription</span><span class="symbol">.</span><span class="method">name</span> <span class="arrow">⇒</span> <span class="returns">string</span><div class="anchors"></div></div><div class="body"><p>The name of the function. (e.g. <code class="inline">transfer</code>)</p>
|
|
|
|
</div></div><div class="property show-anchors"><div class="signature"><span class="path">transactionDescription</span><span class="symbol">.</span><span class="method">sighash</span> <span class="arrow">⇒</span> <span class="returns">string</span><div class="anchors"></div></div><div class="body"><p>The sighash (or function selector) that matched the transaction data.</p>
|
|
|
|
</div></div><div class="property show-anchors"><div class="signature"><span class="path">transactionDescription</span><span class="symbol">.</span><span class="method">signature</span> <span class="arrow">⇒</span> <span class="returns">string</span><div class="anchors"></div></div><div class="body"><p>The signature of the function. (e.g. <code class="inline">transfer(address,uint256)</code>)</p>
|
|
|
|
</div></div><div class="property show-anchors"><div class="signature"><span class="path">transactionDescription</span><span class="symbol">.</span><span class="method">value</span> <span class="arrow">⇒</span> <span class="returns"><a href="/v5/api/utils/bignumber/">BigNumber</a></span><div class="anchors"></div></div><div class="body"><p>The value from the transaction.</p>
|
|
|
|
</div></div><a name="Interface--specifying-fragments"></a><a name="Interface--Interface--specifying-fragments"></a><h2 class="show-anchors"><div>Specifying Fragments<div class="anchors"><a class="self" href="/v5/api/utils/abi/interface/#Interface--specifying-fragments"></a></div></div></h2><p>When specifying a fragment to any of the functions in an <b>Interface</b>, any of the following may be used:</p>
|
|
|
|
<p><ul><li>The <b>name</b> of the event or function, if it is unique and non-ambiguous within the ABI (e.g. <code class="inline">transfer</code>) </li><li>The <b>signature</b> of the event or function. The signature is normalized, so, for example, <code class="inline">uint</code> and <code class="inline">uint256</code> are equivalent (e.g. <code class="inline">transfer(address, uint)</code>) </li><li>The <b>sighash</b> or <b>topichash</b> of the function. The sighash is often referred to the function selector in Solidity (e.g. <code class="inline">0xa9059cbb</code>) </li><li>A <a href="/v5/api/utils/abi/fragments/#Fragment">Fragment</a> </li></ul></p>
|
|
|
|
|
|
|
|
<div class="footer">
|
|
<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 5, 2020, 12:0am.</div>
|
|
</div>
|
|
<script src="/v5/static/script.js" type="text/javascript"></script>
|
|
</body>
|
|
</html>
|