ethers.js/docs/api/utils/abi/interface/index.html

58 lines
43 KiB
HTML
Raw Normal View History

2020-02-25 22:57:11 +03:00
<html><head><title>Interface</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/#getting-started--installing">Installing</a></div><div class="hide link depth-2"><a href="/getting-started/#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/#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/">Contract Interaction</a></div><div class="hide link depth-3"><a href="/api/contract/contract/">Contract</a></div><div class="hide link depth-4"><a href="/api/contract/contract/#contract--properties">Properties</a></div><div class="hide link depth-4"><a href="/api/contract/contract/#contract--methods">Methods</a></div><div class="hide link depth-4"><a href="/api/contract/contract/#contract--events">Events</a></div><div class="hide link depth-4"><a href="/api/contract/contract/#contract-metaclass">Meta-Class</a></div><div class="hide link depth-3"><a href="/api/contract/example/">Example: ERC-20 Contract</a></div><div class="hide link depth-4"><a href="/api/contract/example/#example-erc-20-contract--connecting-to-a-contract">Connecting to a Contract</a></div><div class="hide link depth-4"><a href="/api/contract/example/#example-erc-20-contract--properties-inheritted-from-contract">Properties ^^//(inheritted from [[contract]])//^^</a></div><div class="hide link depth-4"><a href="/api/contract/example/#example-erc-20-contract--methods-inheritted-from-contract">Methods ^^//(inheritted from [[contract]])//^^</a></div><div class="hide link depth-4"><a href="/api/contract/example/#erc20-events">Events ^^//(inheritted from Contract)//^^</a></div><div class="hide link depth-4"><a href="/api/contract/example/#example-erc-20-contract--meta-class-methods-added-at-runtime">Meta-Class Methods ^^//(added at Runtime)//^^</a></div><div class="hide link depth-4"><a href="/api/contract/example/#example-erc-20-contract--meta-class-filters-added-at-runtime">Meta-Class Filters ^^//(added at Runtime)//^^</a></div><div class="show link depth-2"><a href="/api/signer/">Signers</a></div><div class="hide link depth-3"><a href="/api/signer/#signer">Signer</a></div><div class="hide link depth-3"><a href="/api/signer/#wallet">Wallet</a></div><div class="hide link depth-3"><a href="/api/signer/#void-signer">VoidSigner</a></div><div class="hide link depth-3"><a href="/api/signer/#externally-owned-account">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/#provider--accounts-methods">Accounts Methods</a></div><div class="hide link depth-4"><a href="/api/providers/provider/#provider--blocks-methods">Blocks Methods</a></div><div class="hide link depth-4"><a href="/api/providers/provider/#provider--ethereum-naming-service-ens-methods">Ethereum Naming Service (ENS) Methods</a></div><div class="hide link depth-4"><a href="/api/providers/provider/#provider--logs-methods">Logs Methods</a></div><div class="hide link depth-4"><a href="/api/providers/provide
<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="abi-interface--creating-instances"></a><h2 class="show-anchors"><div>Creating Instances<div class="anchors"><a class="self" href="#abi-interface--creating-instances"></a></div></div></h2>
<div class="property show-anchors"><div class="signature"><span class="modifier">new </span><span class="path">ethers</span> . <span class="path">utils</span> . <span class="method">Interface</span> ( <span class="param">abi</span> ) <div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/ethers-v5-beta/packages/abi/src.ts/interface.ts#L60">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="abi-interface--properties"></a><h2 class="show-anchors"><div>Properties<div class="anchors"><a class="self" href="#abi-interface--properties"></a></div></div></h2>
<div class="property show-anchors"><div class="signature"><span class="path">interface</span> . <span class="method">fragments</span> <span class="arrow">&rArr;</span> <span class="returns">Array&lt;&thinsp;<a href="/api/utils/abi/fragments/#abi-fragment">Fragment</a>&thinsp;&gt;</span><div class="anchors"></div></div><div class="body"><p>All the <a href="/api/utils/abi/fragments/#abi-fragment">Fragments</a> in the interface.</p></div></div>
<div class="property show-anchors"><div class="signature"><span class="path">interface</span> . <span class="method">events</span> <span class="arrow">&rArr;</span> <span class="returns">Array&lt;&thinsp;<a href="/api/utils/abi/fragments/#abi-eventfragment">EventFragment</a>&thinsp;&gt;</span><div class="anchors"></div></div><div class="body"><p>All the <a href="/api/utils/abi/fragments/#abi-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="method">functions</span> <span class="arrow">&rArr;</span> <span class="returns">Array&lt;&thinsp;<a href="/api/utils/abi/fragments/#abi-functionfragment">FunctionFragment</a>&thinsp;&gt;</span><div class="anchors"></div></div><div class="body"><p>All the <a href="/api/utils/abi/fragments/#abi-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="method">deploy</span> <span class="arrow">&rArr;</span> <span class="returns"><a href="/api/utils/abi/fragments/#abi-constructorfragment">ConstructorFragment</a></span><div class="anchors"></div></div><div class="body"><p>The <a href="/api/utils/abi/fragments/#abi-constructorfragment">Constructor Fragments</a> for the interface.</p></div></div>
<a name="abi-interface--formatting"></a><h2 class="show-anchors"><div>Formatting<div class="anchors"><a class="self" href="#abi-interface--formatting"></a></div></div></h2>
<div class="property show-anchors"><div class="signature"><span class="path">interface</span> . <span class="method">format</span> ( [ <span class="param">format</span> ] ) <span class="arrow">&rArr;</span> <span class="returns">string&nbsp;&nbsp;|&nbsp;&nbsp;Array&lt;&thinsp;string&thinsp;&gt;</span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/ethers-v5-beta/packages/abi/src.ts/interface.ts#L119">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="abi-interface--fragment-access"></a><h2 class="show-anchors"><div>Fragment Access<div class="anchors"><a class="self" href="#abi-interface--fragment-access"></a></div></div></h2>
<div class="property show-anchors"><div class="signature"><span class="path">interface</span> . <span class="method">getFunction</span> ( <span class="param">fragment</span> ) <span class="arrow">&rArr;</span> <span class="returns"><a href="/api/utils/abi/fragments/#abi-functionfragment">FunctionFragment</a></span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/ethers-v5-beta/packages/abi/src.ts/interface.ts#L153">source</a></div></div><div class="body"><p>Returns the <a href="/api/utils/abi/fragments/#abi-functionfragment">FunctionFragment</a> for <i>fragment</i> (see <a href="/api/utils/abi/interface/#abi-fragmentid">Specifying Fragments</a>).</p></div></div>
<div class="property show-anchors"><div class="signature"><span class="path">interface</span> . <span class="method">getEvent</span> ( <span class="param">fragment</span> ) <span class="arrow">&rArr;</span> <span class="returns"><a href="/api/utils/abi/fragments/#abi-eventfragment">EventFragment</a></span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/ethers-v5-beta/packages/abi/src.ts/interface.ts#L185">source</a></div></div><div class="body"><p>Returns the <a href="/api/utils/abi/fragments/#abi-eventfragment">EventFragment</a> for <i>fragment</i> (see <a href="/api/utils/abi/interface/#abi-fragmentid">Specifying Fragments</a>).</p></div></div>
<a name="abi-interface--signature-and-topic-hashes"></a><h2 class="show-anchors"><div>Signature and Topic Hashes<div class="anchors"><a class="self" href="#abi-interface--signature-and-topic-hashes"></a></div></div></h2>
<div class="property show-anchors"><div class="signature"><span class="path">interface</span> . <span class="method">getSighash</span> ( <span class="param">fragment</span> ) <span class="arrow">&rArr;</span> <span class="returns">string&lt;&thinsp;<a href="/api/utils/bytes/#datahexstring">DataHexstring</a>&lt;&thinsp;4&thinsp;&gt;&thinsp;&gt;</span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/ethers-v5-beta/packages/abi/src.ts/interface.ts#L218">source</a></div></div><div class="body"><p>Return the sighash (or Function Selector) for <i>fragment</i> (see <a href="/api/utils/abi/interface/#abi-fragmentid">Specifying Fragments</a>).</p></div></div>
<div class="property show-anchors"><div class="signature"><span class="path">interface</span> . <span class="method">getEventTopic</span> ( <span class="param">fragment</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"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/ethers-v5-beta/packages/abi/src.ts/interface.ts#L227">source</a></div></div><div class="body"><p>Return the topic hash for <i>fragment</i> (see <a href="/api/utils/abi/interface/#abi-fragmentid">Specifying Fragments</a>).</p></div></div>
<a name="abi-interface--encoding-data"></a><h2 class="show-anchors"><div>Encoding Data<div class="anchors"><a class="self" href="#abi-interface--encoding-data"></a></div></div></h2>
<div class="property show-anchors"><div class="signature"><span class="path">interface</span> . <span class="method">encodeDeploy</span> ( [ <span class="param">values</span> ] ) <span class="arrow">&rArr;</span> <span class="returns">string&lt;&thinsp;<a href="/api/utils/bytes/#datahexstring">DataHexstring</a>&thinsp;&gt;</span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/ethers-v5-beta/packages/abi/src.ts/interface.ts#L244">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="method">encodeFilterTopics</span> ( <span class="param">fragment</span> [ , <span class="param">values</span> ] ) <span class="arrow">&rArr;</span> <span class="returns">Array&lt;&thinsp;topic&nbsp;&nbsp;|&nbsp;&nbsp;Array&lt;&thinsp;topic&thinsp;&gt;&thinsp;&gt;</span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/ethers-v5-beta/packages/abi/src.ts/interface.ts#L318">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="/api/utils/abi/interface/#abi-fragmentid">Specifying Fragments</a>) for the given <i>values</i>.</p><p>Each <i>topic</i> is a 32 byte (64 nibble) <a href="/api/utils/bytes/#datahexstring">DataHexstring</a>.</p></div></div>
<div class="property show-anchors"><div class="signature"><span class="path">interface</span> . <span class="method">encodeFunctionData</span> ( <span class="param">fragment</span> [ , <span class="param">values</span> ] ) <span class="arrow">&rArr;</span> <span class="returns">string&lt;&thinsp;<a href="/api/utils/bytes/#datahexstring">DataHexstring</a>&thinsp;&gt;</span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/ethers-v5-beta/packages/abi/src.ts/interface.ts#L264">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="/api/utils/abi/interface/#abi-fragmentid">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="method">encodeFunctionResult</span> ( <span class="param">fragment</span> [ , <span class="param">values</span> ] ) <span class="arrow">&rArr;</span> <span class="returns">string&lt;&thinsp;<a href="/api/utils/bytes/#datahexstring">DataHexstring</a>&thinsp;&gt;</span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/ethers-v5-beta/packages/abi/src.ts/interface.ts#L309">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="/api/utils/abi/interface/#abi-fragmentid">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="abi-interface--decoding-data"></a><h2 class="show-anchors"><div>Decoding Data<div class="anchors"><a class="self" href="#abi-interface--decoding-data"></a></div></div></h2>
<div class="property show-anchors"><div class="signature"><span class="path">interface</span> . <span class="method">decodeEventLog</span> ( <span class="param">fragment</span> , <span class="param">data</span> [ , <span class="param">topics</span> ] ) <span class="arrow">&rArr;</span> <span class="returns"><a href="/api/utils/abi/interface/#abi-result">Result</a></span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/ethers-v5-beta/packages/abi/src.ts/interface.ts#L368">source</a></div></div><div class="body"><p>Returns the decoded event values from an event log for <i>fragment</i> (see <a href="/api/utils/abi/interface/#abi-fragmentid">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="method">decodeFunctionData</span> ( <span class="param">fragment</span> , <span class="param">data</span> ) <span class="arrow">&rArr;</span> <span class="returns"><a href="/api/utils/abi/interface/#abi-result">Result</a></span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/ethers-v5-beta/packages/abi/src.ts/interface.ts#L249">source</a></div></div><div class="body"><p>Returns the decoded values from transaction data for <i>fragment</i> (see <a href="/api/utils/abi/interface/#abi-fragmentid">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="method">decodeFunctionResult</span> ( <span class="param">fragment</span> , <span class="param">data</span> ) <span class="arrow">&rArr;</span> <span class="returns"><a href="/api/utils/abi/interface/#abi-result">Result</a></span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/ethers-v5-beta/packages/abi/src.ts/interface.ts#L276">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="/api/utils/abi/interface/#abi-fragmentid">Specifying Fragments</a>) for the given <i>data</i>.</p></div></div>
<a name="abi-interface--parsing"></a><h2 class="show-anchors"><div>Parsing<div class="anchors"><a class="self" href="#abi-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="method">parseLog</span> ( <span class="param">log</span> ) <span class="arrow">&rArr;</span> <span class="returns"><a href="/api/utils/abi/interface/#abi-log">LogDescription</a></span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/ethers-v5-beta/packages/abi/src.ts/interface.ts#L444">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="method">parseTransaction</span> ( <span class="param">transaction</span> ) <span class="arrow">&rArr;</span> <span class="returns"><a href="/api/utils/abi/interface/#abi-transaction">TransactionDescription</a></span><div class="anchors"><a class="source" href="https://github.com/ethers-io/ethers.js/blob/ethers-v5-beta/packages/abi/src.ts/interface.ts#L427">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="abi-interface--types"></a><h2 class="show-anchors"><div>Types<div class="anchors"><a class="self" href="#abi-interface--types"></a></div></div></h2>
<a name="abi-result"></a><a name="abi-interface--types--abi-result"></a><a name="abi-result"></a><h3 class="show-anchors"><div>Result<span class="inherits"> inherits Array&lt;any&gt;</span><div class="anchors"><a class="self" href="#abi-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="abi-log"></a><a name="abi-interface--types--abi-log"></a><a name="abi-log"></a><h3 class="show-anchors"><div>LogDescription<div class="anchors"><a class="self" href="#abi-log"></a></div></div></h3>
<div class="property show-anchors"><div class="signature"><span class="path">logDescription</span> . <span class="method">args</span> <span class="arrow">&rArr;</span> <span class="returns"><a href="/api/utils/abi/interface/#abi-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="method">eventFragment</span> <span class="arrow">&rArr;</span> <span class="returns"><a href="/api/utils/abi/fragments/#abi-eventfragment">EventFragment</a></span><div class="anchors"></div></div><div class="body"><p>The <a href="/api/utils/abi/fragments/#abi-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="method">name</span> <span class="arrow">&rArr;</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="method">signature</span> <span class="arrow">&rArr;</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="method">topic</span> <span class="arrow">&rArr;</span> <span class="returns">string</span><div class="anchors"></div></div><div class="body"><p>The topic hash.</p></div></div>
<a name="abi-transaction"></a><a name="abi-interface--types--abi-transaction"></a><a name="abi-transaction"></a><h3 class="show-anchors"><div>TransactionDescription<div class="anchors"><a class="self" href="#abi-transaction"></a></div></div></h3>
<div class="property show-anchors"><div class="signature"><span class="path">transactionDescription</span> . <span class="method">args</span> <span class="arrow">&rArr;</span> <span class="returns"><a href="/api/utils/abi/interface/#abi-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="method">functionFragment</span> <span class="arrow">&rArr;</span> <span class="returns"><a href="/api/utils/abi/fragments/#abi-functionfragment">FunctionFragment</a></span><div class="anchors"></div></div><div class="body"><p>The <a href="/api/utils/abi/fragments/#abi-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="method">name</span> <span class="arrow">&rArr;</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="method">sighash</span> <span class="arrow">&rArr;</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="method">signature</span> <span class="arrow">&rArr;</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="method">value</span> <span class="arrow">&rArr;</span> <span class="returns"><a href="/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="abi-fragmentid"></a><a name="abi-interface--abi-fragmentid"></a><a name="abi-fragmentid"></a><h2 class="show-anchors"><div>Specifying Fragments<div class="anchors"><a class="self" href="#abi-fragmentid"></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><ul><li>The name 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 signature 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 sighash or topichash 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="/api/utils/abi/fragments/#abi-fragment">Fragment</a></li></ul><div class="footer"><div class="nav previous"><a href="/api/utils/abi/"><span class="arrow">&larr;</span>Application Binary Interface</a></div> <div class="nav next"><a href="/api/utils/abi/fragments/">Fragments<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:0214075148b67e7a1eb883809077921aa17de4e29e344ba0c3fc36f86db19138 -->