ethers.js/docs/v5/api/utils/abi/fragments/index.html
2020-06-12 19:21:37 -04:00

139 lines
33 KiB
HTML

<!DOCTYPE html>
<html class="paged">
<head>
<title>Fragments</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>
<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="myself ancestor ancestor show link depth-4"><a href="/v5/api/utils/abi/fragments/">Fragments</a></div><div class="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>&nbsp;&nbsp;&raquo;&nbsp;&nbsp;<a href="/v5/api/">API</a>&nbsp;&nbsp;&raquo;&nbsp;&nbsp;<a href="/v5/api/utils/">Utilities</a>&nbsp;&nbsp;&raquo;&nbsp;&nbsp;<a href="/v5/api/utils/abi/">ABI</a>&nbsp;&nbsp;&raquo;&nbsp;&nbsp;<span class="current">Fragments</span></div>
<a name="fragments"></a><a name="fragments"></a><h1 class="show-anchors"><div>Fragments<div class="anchors"><a class="self" href="/v5/api/utils/abi/fragments/#fragments"></a></div></div></h1><p>Explain an ABI.</p>
<a name="fragments--formats"></a><h2 class="show-anchors"><div>Formats<div class="anchors"><a class="self" href="/v5/api/utils/abi/fragments/#fragments--formats"></a></div></div></h2>
<a name="fragments--formats--json-string-abi-solidity-output-json"></a><h3 class="show-anchors"><div>JSON String ABI (Solidity Output JSON)<div class="anchors"><a class="self" href="/v5/api/utils/abi/fragments/#fragments--formats--json-string-abi-solidity-output-json"></a></div></div></h3><p>The <b>JSON ABI Format</b> is the format that is <a href="https://solidity.readthedocs.io/en/v0.6.0/using-the-compiler.html#output-description">output from the Solidity compiler</a>.</p>
<p>A JSON serialized object is always a string, which represents an Array of Objects, where each Object has various properties describing the <a href="/v5/api/utils/abi/fragments/#Fragment">Fragment</a> of the ABI.</p>
<p>The deserialied JSON string (which is a normal JavaScript Object) may also be passed into any function which accepts a JSON String ABI.</p>
<a name="fragments--formats--humanb-readable-abi"></a><h3 class="show-anchors"><div>Humanb-Readable ABI<div class="anchors"><a class="self" href="/v5/api/utils/abi/fragments/#fragments--formats--humanb-readable-abi"></a></div></div></h3><p>The Human-Readable ABI was</p>
<p><a href="https://blog.ricmoo.com/human-readable-contract-abis-in-ethers-js-141902f4d917">article</a></p>
<a name="fragments--output-formats"></a><a name="fragments--formats--fragments--output-formats"></a><h3 class="show-anchors"><div>Output Formats<div class="anchors"><a class="self" href="/v5/api/utils/abi/fragments/#fragments--output-formats"></a><a class="source" href="https://github.com/ethers-io/ethers.js/blob/ethers-v5-beta/packages/abi/src.ts/fragments.ts#L235">source</a></div></div></h3><p>Each <a href="/v5/api/utils/abi/fragments/#Fragment">Fragment</a> and <a href="/v5/api/utils/abi/fragments/#ParamType">ParamType</a> may be output using its <code class="inline">format</code> method.</p>
<div class="property show-anchors"><div class="signature"><span class="path">ethers</span><span class="symbol">.</span><span class="path">utils</span><span class="symbol">.</span><span class="path">FragmentTypes</span><span class="symbol">.</span><span class="method">full</span> <span class="arrow">&rArr;</span> <span class="returns">string</span><div class="anchors"></div></div><div class="body"><p>This is a full human-readable string, including all parameter names, any optional modifiers (e.g. <code class="inline">indexed</code>, <code class="inline">public</code>, etc) and white-space to aid in human readabiliy.</p>
</div></div><div class="property show-anchors"><div class="signature"><span class="path">ethers</span><span class="symbol">.</span><span class="path">utils</span><span class="symbol">.</span><span class="path">FragmentTypes</span><span class="symbol">.</span><span class="method">minimal</span> <span class="arrow">&rArr;</span> <span class="returns">string</span><div class="anchors"></div></div><div class="body"><p>This is similar to <code class="inline">full</code>, except with no unnecessary whitespace or parameter names. This is useful for storing a minimal string which can still fully reconstruct the original Fragment using <a href="/v5/api/utils/abi/fragments/#Fragment-from">Fragment&amp;thinsp;.&amp;thinsp;from</a>.</p>
</div></div><div class="property show-anchors"><div class="signature"><span class="path">ethers</span><span class="symbol">.</span><span class="path">utils</span><span class="symbol">.</span><span class="path">FragmentTypes</span><span class="symbol">.</span><span class="method">json</span> <span class="arrow">&rArr;</span> <span class="returns">string</span><div class="anchors"></div></div><div class="body"><p>This returns a JavaScript Object which is safe to call <code class="inline">JSON.stringify</code> on to create a JSON string.</p>
</div></div><div class="property show-anchors"><div class="signature"><span class="path">ethers</span><span class="symbol">.</span><span class="path">utils</span><span class="symbol">.</span><span class="path">FragmentTypes</span><span class="symbol">.</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>This is a minimal output format, which is used by Solidity when computing a signature hash or an event topic hash.</p>
</div></div><div class="definition container-box warning"><div class="term">Note</div><div class="body"><p>The <code class="inline">sighash</code> format is <b>insufficient</b> to re-create the original <a href="/v5/api/utils/abi/fragments/#Fragment">Fragment</a>, since it discards modifiers such as indexed, anonymous, stateMutability, etc.</p>
</div></div><a name="Fragment"></a><a name="fragments--Fragment"></a><h2 class="show-anchors"><div>Fragment<div class="anchors"><a class="self" href="/v5/api/utils/abi/fragments/#Fragment"></a><a class="source" href="https://github.com/ethers-io/ethers.js/blob/ethers-v5-beta/packages/abi/src.ts/fragments.ts#L405">source</a></div></div></h2><p>An ABI is a collection of <b>Fragments</b>, where each fragment specifies:</p>
<p><ul><li>An <a href="/v5/api/utils/abi/fragments/#EventFragment">Event</a> </li><li>A <a href="/v5/api/utils/abi/fragments/#FunctionFragment">Function</a> </li><li>A <a href="/v5/api/utils/abi/fragments/#ConstructorFragment">Constructor</a> </li></ul></p>
<a name="fragments--Fragment--properties"></a><h3 class="show-anchors"><div>Properties<div class="anchors"><a class="self" href="/v5/api/utils/abi/fragments/#fragments--Fragment--properties"></a></div></div></h3>
<div class="property show-anchors"><div class="signature"><span class="path">fragment</span><span class="symbol">.</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>This is the name of the Event or Function. This will be null for a <a href="/v5/api/utils/abi/fragments/#ConstructorFragment">ConstructorFragment</a>.</p>
</div></div><div class="property show-anchors"><div class="signature"><span class="path">fragment</span><span class="symbol">.</span><span class="method">type</span> <span class="arrow">&rArr;</span> <span class="returns">string</span><div class="anchors"></div></div><div class="body"><p>This is a string which indicates the type of the <a href="/v5/api/utils/abi/fragments/#Fragment">Fragment</a>. This will be one of:</p>
<p><ul><li><code class="inline">constructor</code> </li><li><code class="inline">event</code> </li><li><code class="inline">function</code> </li></ul></p>
</div></div><div class="property show-anchors"><div class="signature"><span class="path">fragment</span><span class="symbol">.</span><span class="method">inputs</span> <span class="arrow">&rArr;</span> <span class="returns">Array&lt; <a href="/v5/api/utils/abi/fragments/#ParamType">ParamType</a> &gt;</span><div class="anchors"></div></div><div class="body"><p>This is an array of of each <a href="/v5/api/utils/abi/fragments/#ParamType">ParamType</a> for the input parameters to the Constructor, Event of Function.</p>
</div></div><a name="fragments--Fragment--methods"></a><h3 class="show-anchors"><div>Methods<div class="anchors"><a class="self" href="/v5/api/utils/abi/fragments/#fragments--Fragment--methods"></a></div></div></h3>
<a name="Fragment-from"></a><div class="property show-anchors"><div class="signature"><span class="path">ethers</span><span class="symbol">.</span><span class="path">utils</span><span class="symbol">.</span><span class="path">Fragment</span><span class="symbol">.</span><span class="method">from</span><span class="symbol">(</span> <span class="param">objectOrString</span> <span class="symbol">)</span> <span class="arrow">&rArr;</span> <span class="returns"><a href="/v5/api/utils/abi/fragments/#Fragment">Fragment</a></span><div class="anchors"><a class="self" href="/v5/api/utils/abi/fragments/#Fragment-from"></a><a class="source" href="https://github.com/ethers-io/ethers.js/blob/ethers-v5-beta/packages/abi/src.ts/fragments.ts#L428">source</a></div></div><div class="body"><p>Returns a</p>
</div></div><a name="Fragment-isFragment"></a><div class="property show-anchors"><div class="signature"><span class="path">ethers</span><span class="symbol">.</span><span class="path">utils</span><span class="symbol">.</span><span class="path">Fragment</span><span class="symbol">.</span><span class="method">isFragment</span><span class="symbol">(</span> <span class="param">object</span> <span class="symbol">)</span> <span class="arrow">&rArr;</span> <span class="returns">boolean</span><div class="anchors"><a class="self" href="/v5/api/utils/abi/fragments/#Fragment-isFragment"></a><a class="source" href="https://github.com/ethers-io/ethers.js/blob/ethers-v5-beta/packages/abi/src.ts/fragments.ts#L474">source</a></div></div><div class="body"><p>Tra lal al</p>
</div></div><a name="ConstructorFragment"></a><a name="fragments--ConstructorFragment"></a><h2 class="show-anchors"><div>ConstructorFragment<span class="inherits"> inherits <a href="/v5/api/utils/abi/fragments/#Fragment">Fragment</a></span><div class="anchors"><a class="self" href="/v5/api/utils/abi/fragments/#ConstructorFragment"></a><a class="source" href="https://github.com/ethers-io/ethers.js/blob/ethers-v5-beta/packages/abi/src.ts/fragments.ts#L708">source</a></div></div></h2>
<a name="fragments--ConstructorFragment--properties"></a><h3 class="show-anchors"><div>Properties<div class="anchors"><a class="self" href="/v5/api/utils/abi/fragments/#fragments--ConstructorFragment--properties"></a></div></div></h3>
<div class="property show-anchors"><div class="signature"><span class="path">fragment</span><span class="symbol">.</span><span class="method">gas</span> <span class="arrow">&rArr;</span> <span class="returns"><a href="/v5/api/utils/bignumber/">BigNumber</a></span><div class="anchors"></div></div><div class="body"><p>This is the gas limit that should be used during deployment. It may be null.</p>
</div></div><div class="property show-anchors"><div class="signature"><span class="path">fragment</span><span class="symbol">.</span><span class="method">payable</span> <span class="arrow">&rArr;</span> <span class="returns">boolean</span><div class="anchors"></div></div><div class="body"><p>This is whether the constructor may receive ether during deployment as an endowment (i.e. msg.value != 0).</p>
</div></div><div class="property show-anchors"><div class="signature"><span class="path">fragment</span><span class="symbol">.</span><span class="method">stateMutability</span> <span class="arrow">&rArr;</span> <span class="returns">string</span><div class="anchors"></div></div><div class="body"><p>This is the state mutability of the constructor. It can be any of:</p>
<p><ul><li><code class="inline">nonpayable</code> </li><li><code class="inline">payable</code> </li></ul></p>
</div></div><a name="fragments--ConstructorFragment--methods"></a><h3 class="show-anchors"><div>Methods<div class="anchors"><a class="self" href="/v5/api/utils/abi/fragments/#fragments--ConstructorFragment--methods"></a></div></div></h3>
<a name="ConstructorFragment-from"></a><div class="property show-anchors"><div class="signature"><span class="path">ethers</span><span class="symbol">.</span><span class="path">utils</span><span class="symbol">.</span><span class="path">ConstructorFragment</span><span class="symbol">.</span><span class="method">from</span><span class="symbol">(</span> <span class="param">objectOrString</span> <span class="symbol">)</span> <span class="arrow">&rArr;</span> <span class="returns"><a href="/v5/api/utils/abi/fragments/#ConstructorFragment">ConstructorFragment</a></span><div class="anchors"><a class="self" href="/v5/api/utils/abi/fragments/#ConstructorFragment-from"></a><a class="source" href="https://github.com/ethers-io/ethers.js/blob/ethers-v5-beta/packages/abi/src.ts/fragments.ts#L746">source</a></div></div><div class="body"><p>Tra la la...</p>
</div></div><a name="ConstructorFragment-isConstructorFragment"></a><div class="property show-anchors"><div class="signature"><span class="path">ethers</span><span class="symbol">.</span><span class="path">utils</span><span class="symbol">.</span><span class="path">ConstructorFragment</span><span class="symbol">.</span><span class="method">isConstructorFragment</span><span class="symbol">(</span> <span class="param">object</span> <span class="symbol">)</span> <span class="arrow">&rArr;</span> <span class="returns">boolean</span><div class="anchors"><a class="self" href="/v5/api/utils/abi/fragments/#ConstructorFragment-isConstructorFragment"></a><a class="source" href="https://github.com/ethers-io/ethers.js/blob/ethers-v5-beta/packages/abi/src.ts/fragments.ts#L794">source</a></div></div><div class="body"><p>Tra lal al</p>
</div></div><a name="EventFragment"></a><a name="fragments--EventFragment"></a><h2 class="show-anchors"><div>EventFragment<span class="inherits"> inherits <a href="/v5/api/utils/abi/fragments/#Fragment">Fragment</a></span><div class="anchors"><a class="self" href="/v5/api/utils/abi/fragments/#EventFragment"></a><a class="source" href="https://github.com/ethers-io/ethers.js/blob/ethers-v5-beta/packages/abi/src.ts/fragments.ts#L483">source</a></div></div></h2>
<a name="fragments--EventFragment--properties"></a><h3 class="show-anchors"><div>Properties<div class="anchors"><a class="self" href="/v5/api/utils/abi/fragments/#fragments--EventFragment--properties"></a></div></div></h3>
<div class="property show-anchors"><div class="signature"><span class="path">fragment</span><span class="symbol">.</span><span class="method">anonymous</span> <span class="arrow">&rArr;</span> <span class="returns">boolean</span><div class="anchors"></div></div><div class="body"><p>This is whether the event is anonymous. An anonymous Event does not inject its topic hash as topic0 when creating a log.</p>
</div></div><a name="fragments--EventFragment--methods"></a><h3 class="show-anchors"><div>Methods<div class="anchors"><a class="self" href="/v5/api/utils/abi/fragments/#fragments--EventFragment--methods"></a></div></div></h3>
<a name="EventFragment-from"></a><div class="property show-anchors"><div class="signature"><span class="path">ethers</span><span class="symbol">.</span><span class="path">utils</span><span class="symbol">.</span><span class="path">EventFragment</span><span class="symbol">.</span><span class="method">from</span><span class="symbol">(</span> <span class="param">objectOrString</span> <span class="symbol">)</span> <span class="arrow">&rArr;</span> <span class="returns"><a href="/v5/api/utils/abi/fragments/#EventFragment">EventFragment</a></span><div class="anchors"><a class="self" href="/v5/api/utils/abi/fragments/#EventFragment-from"></a><a class="source" href="https://github.com/ethers-io/ethers.js/blob/ethers-v5-beta/packages/abi/src.ts/fragments.ts#L520">source</a></div></div><div class="body"><p>Tra la la...</p>
</div></div><a name="EventFragment-isEventFragment"></a><div class="property show-anchors"><div class="signature"><span class="path">ethers</span><span class="symbol">.</span><span class="path">utils</span><span class="symbol">.</span><span class="path">EventFragment</span><span class="symbol">.</span><span class="method">isEventFragment</span><span class="symbol">(</span> <span class="param">object</span> <span class="symbol">)</span> <span class="arrow">&rArr;</span> <span class="returns">boolean</span><div class="anchors"><a class="self" href="/v5/api/utils/abi/fragments/#EventFragment-isEventFragment"></a><a class="source" href="https://github.com/ethers-io/ethers.js/blob/ethers-v5-beta/packages/abi/src.ts/fragments.ts#L572">source</a></div></div><div class="body"><p>Tra lal al</p>
</div></div><a name="FunctionFragment"></a><a name="fragments--FunctionFragment"></a><h2 class="show-anchors"><div>FunctionFragment<span class="inherits"> inherits <a href="/v5/api/utils/abi/fragments/#ConstructorFragment">ConstructorFragment</a></span><div class="anchors"><a class="self" href="/v5/api/utils/abi/fragments/#FunctionFragment"></a><a class="source" href="https://github.com/ethers-io/ethers.js/blob/ethers-v5-beta/packages/abi/src.ts/fragments.ts#L804">source</a></div></div></h2>
<a name="fragments--FunctionFragment--properties"></a><h3 class="show-anchors"><div>Properties<div class="anchors"><a class="self" href="/v5/api/utils/abi/fragments/#fragments--FunctionFragment--properties"></a></div></div></h3>
<div class="property show-anchors"><div class="signature"><span class="path">fragment</span><span class="symbol">.</span><span class="method">constant</span> <span class="arrow">&rArr;</span> <span class="returns">boolean</span><div class="anchors"></div></div><div class="body"><p>This is whether the function is constant (i.e. does not change state). This is true if the state mutability is <code class="inline">pure</code> or <code class="inline">view</code>.</p>
</div></div><div class="property show-anchors"><div class="signature"><span class="path">fragment</span><span class="symbol">.</span><span class="method">stateMutability</span> <span class="arrow">&rArr;</span> <span class="returns">string</span><div class="anchors"></div></div><div class="body"><p>This is the state mutability of the constructor. It can be any of:</p>
<p><ul><li><code class="inline">nonpayable</code> </li><li><code class="inline">payable</code> </li><li><code class="inline">pure</code> </li><li><code class="inline">view</code> </li></ul></p>
</div></div><div class="property show-anchors"><div class="signature"><span class="path">fragment</span><span class="symbol">.</span><span class="method">outputs</span> <span class="arrow">&rArr;</span> <span class="returns">Array&lt; <a href="/v5/api/utils/abi/fragments/#ParamType">ParamType</a> &gt;</span><div class="anchors"></div></div><div class="body"><p>A list of the Function output parameters.</p>
</div></div><a name="fragments--FunctionFragment--method"></a><h3 class="show-anchors"><div>Method<div class="anchors"><a class="self" href="/v5/api/utils/abi/fragments/#fragments--FunctionFragment--method"></a></div></div></h3>
<a name="FunctionFragment-from"></a><div class="property show-anchors"><div class="signature"><span class="path">ethers</span><span class="symbol">.</span><span class="path">utils</span><span class="symbol">.</span><span class="path">FunctionFragment</span><span class="symbol">.</span><span class="method">from</span><span class="symbol">(</span> <span class="param">objectOrString</span> <span class="symbol">)</span> <span class="arrow">&rArr;</span> <span class="returns"><a href="/v5/api/utils/abi/fragments/#FunctionFragment">FunctionFragment</a></span><div class="anchors"><a class="self" href="/v5/api/utils/abi/fragments/#FunctionFragment-from"></a><a class="source" href="https://github.com/ethers-io/ethers.js/blob/ethers-v5-beta/packages/abi/src.ts/fragments.ts#L746">source</a></div></div><div class="body"><p>Tra la la...</p>
</div></div><a name="FunctionFragment-isFunctionFragment"></a><div class="property show-anchors"><div class="signature"><span class="path">ethers</span><span class="symbol">.</span><span class="path">utils</span><span class="symbol">.</span><span class="path">FunctionFragment</span><span class="symbol">.</span><span class="method">isFunctionFragment</span><span class="symbol">(</span> <span class="param">object</span> <span class="symbol">)</span> <span class="arrow">&rArr;</span> <span class="returns">boolean</span><div class="anchors"><a class="self" href="/v5/api/utils/abi/fragments/#FunctionFragment-isFunctionFragment"></a><a class="source" href="https://github.com/ethers-io/ethers.js/blob/ethers-v5-beta/packages/abi/src.ts/fragments.ts#L925">source</a></div></div><div class="body"><p>Tra lal al</p>
</div></div><a name="ParamType"></a><a name="fragments--ParamType"></a><h2 class="show-anchors"><div>ParamType<div class="anchors"><a class="self" href="/v5/api/utils/abi/fragments/#ParamType"></a><a class="source" href="https://github.com/ethers-io/ethers.js/blob/ethers-v5-beta/packages/abi/src.ts/fragments.ts#L251">source</a></div></div></h2><p>The following examples will represent the Solidity parameter:</p>
<p><code class="inline">string foobar</code></p>
<a name="fragments--ParamType--properties"></a><h3 class="show-anchors"><div>Properties<div class="anchors"><a class="self" href="/v5/api/utils/abi/fragments/#fragments--ParamType--properties"></a></div></div></h3>
<a name="ParamType-name"></a><div class="property show-anchors"><div class="signature"><span class="path">paramType</span><span class="symbol">.</span><span class="method">name</span> <span class="arrow">&rArr;</span> <span class="returns">string</span><div class="anchors"><a class="self" href="/v5/api/utils/abi/fragments/#ParamType-name"></a></div></div><div class="body"><p>The local parameter name. This may be null for unnamed parameters. For example, the parameter definition <code class="inline">string foobar</code> would be <code class="inline">foobar</code>.</p>
</div></div><a name="ParamType-type"></a><div class="property show-anchors"><div class="signature"><span class="path">paramType</span><span class="symbol">.</span><span class="method">type</span> <span class="arrow">&rArr;</span> <span class="returns">string</span><div class="anchors"><a class="self" href="/v5/api/utils/abi/fragments/#ParamType-type"></a></div></div><div class="body"><p>The full type of the parameter, including tuple and array symbols. This may be null for unnamed parameters. For the above example, this would be <code class="inline">foobar</code>.</p>
</div></div><a name="ParamType-baseType"></a><div class="property show-anchors"><div class="signature"><span class="path">paramType</span><span class="symbol">.</span><span class="method">baseType</span> <span class="arrow">&rArr;</span> <span class="returns">string</span><div class="anchors"><a class="self" href="/v5/api/utils/abi/fragments/#ParamType-baseType"></a></div></div><div class="body"><p>The base type of the parameter. For primitive types (e.g. <code class="inline">address</code>, <code class="inline">uint256</code>, etc) this is equal to <a href="/v5/api/utils/abi/fragments/#ParamType-type">type</a>. For arrays, it will be the string <code class="inline">array</code> and for a tuple, it will be the string <code class="inline">tuple</code>.</p>
</div></div><a name="ParamType-indexed"></a><div class="property show-anchors"><div class="signature"><span class="path">paramType</span><span class="symbol">.</span><span class="method">indexed</span> <span class="arrow">&rArr;</span> <span class="returns">boolean</span><div class="anchors"><a class="self" href="/v5/api/utils/abi/fragments/#ParamType-indexed"></a></div></div><div class="body"><p>Whether the parameter has been marked as indexed. This <b>only</b> applies to parameters which are part of an <a href="/v5/api/utils/abi/fragments/#EventFragment">EventFragment</a>.</p>
</div></div><a name="ParamType-arrayChildren"></a><div class="property show-anchors"><div class="signature"><span class="path">paramType</span><span class="symbol">.</span><span class="method">arrayChildren</span> <span class="arrow">&rArr;</span> <span class="returns"><a href="/v5/api/utils/abi/fragments/#ParamType">ParamType</a></span><div class="anchors"><a class="self" href="/v5/api/utils/abi/fragments/#ParamType-arrayChildren"></a></div></div><div class="body"><p>The type of children of the array. This is null for for any parameter wjhich is not an array.</p>
</div></div><a name="ParamType-arrayLength"></a><div class="property show-anchors"><div class="signature"><span class="path">paramType</span><span class="symbol">.</span><span class="method">arrayLength</span> <span class="arrow">&rArr;</span> <span class="returns">number</span><div class="anchors"><a class="self" href="/v5/api/utils/abi/fragments/#ParamType-arrayLength"></a></div></div><div class="body"><p>The length of the array, or <code class="inline">-1</code> for dynamic-length arrays. This is null for parameters which is not arrays.</p>
</div></div><a name="ParamType-components"></a><div class="property show-anchors"><div class="signature"><span class="path">paramType</span><span class="symbol">.</span><span class="method">components</span> <span class="arrow">&rArr;</span> <span class="returns">Array&lt; <a href="/v5/api/utils/abi/fragments/#ParamType">ParamType</a> &gt;</span><div class="anchors"><a class="self" href="/v5/api/utils/abi/fragments/#ParamType-components"></a></div></div><div class="body"><p>The components of a tuple. This is null for non-tuple parameters.</p>
</div></div><a name="fragments--ParamType--methods"></a><h3 class="show-anchors"><div>Methods<div class="anchors"><a class="self" href="/v5/api/utils/abi/fragments/#fragments--ParamType--methods"></a></div></div></h3><p>Tra la la...</p>
<div class="property show-anchors"><div class="signature"><span class="path">paramType</span><span class="symbol">.</span><span class="method">format</span><span class="symbol">(</span> <span class="symbol">[</span> <span class="param">outputType</span> = <span class="param">sighash</span> <span class="symbol">]</span> <span class="symbol">)</span><div class="anchors"></div></div><div class="body"><p>Tra la la...</p>
</div></div><a name="ParamType-from"></a><div class="property show-anchors"><div class="signature"><span class="path">ethers</span><span class="symbol">.</span><span class="path">utils</span><span class="symbol">.</span><span class="path">ParamType</span><span class="symbol">.</span><span class="method">from</span><span class="symbol">(</span> <span class="param">objectOrString</span> <span class="symbol">)</span> <span class="arrow">&rArr;</span> <span class="returns"><a href="/v5/api/utils/abi/fragments/#ParamType">ParamType</a></span><div class="anchors"><a class="self" href="/v5/api/utils/abi/fragments/#ParamType-from"></a><a class="source" href="https://github.com/ethers-io/ethers.js/blob/ethers-v5-beta/packages/abi/src.ts/fragments.ts#L357">source</a></div></div><div class="body"><p>Tra la la...</p>
</div></div><a name="ParamType-isParamType"></a><div class="property show-anchors"><div class="signature"><span class="path">ethers</span><span class="symbol">.</span><span class="path">utils</span><span class="symbol">.</span><span class="path">ParamType</span><span class="symbol">.</span><span class="method">isParamType</span><span class="symbol">(</span> <span class="param">object</span> <span class="symbol">)</span> <span class="arrow">&rArr;</span> <span class="returns">boolean</span><div class="anchors"><a class="self" href="/v5/api/utils/abi/fragments/#ParamType-isParamType"></a><a class="source" href="https://github.com/ethers-io/ethers.js/blob/ethers-v5-beta/packages/abi/src.ts/fragments.ts#L388">source</a></div></div><div class="body"><p>Tra la la...</p>
</div></div>
<div class="footer">
<div class="nav previous"><a href="/v5/api/utils/abi/formats/"><span class="arrow">&larr;</span>ABI Formats</a></div>
<div class="nav next"><a href="/v5/api/utils/abi/interface/">Interface<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 License</a>. Last modified on June 12, 2020, 7:17pm.</div>
</div>
<script src="/v5/static/script.js" type="text/javascript"></script>
</body>
</html>