<divclass="link title"><ahref="/v5/">Documentation</a></div><divclass="base show link depth-1"><ahref="/v5/getting-started/">Getting Started</a></div><divclass="base show link depth-1"><ahref="/v5/concepts/">Ethereum Basics</a></div><divclass="hide link depth-2"><ahref="/v5/concepts/events/">Events</a></div><divclass="hide link depth-2"><ahref="/v5/concepts/gas/">Gas</a></div><divclass="hide link depth-2"><ahref="/v5/concepts/security/">Security</a></div><divclass="base show link depth-1"><ahref="/v5/api/">Application Programming Interface</a></div><divclass="hide link depth-2"><ahref="/v5/api/contract/">Contract Interaction</a></div><divclass="hide link depth-3"><ahref="/v5/api/contract/contract/">Contract</a></div><divclass="hide link depth-3"><ahref="/v5/api/contract/contract-factory/">ContractFactory</a></div><divclass="hide link depth-3"><ahref="/v5/api/contract/example/">Example: ERC-20 Contract</a></div><divclass="hide link depth-2"><ahref="/v5/api/signer/">Signers</a></div><divclass="hide link depth-2"><ahref="/v5/api/providers/">Providers</a></div><divclass="hide link depth-3"><ahref="/v5/api/providers/provider/">Provider</a></div><divclass="hide link depth-3"><ahref="/v5/api/providers/jsonrpc-provider/">JsonRpcProvider</a></div><divclass="hide link depth-3"><ahref="/v5/api/providers/api-providers/">API Providers</a></div><divclass="hide link depth-3"><ahref="/v5/api/providers/other/">Other Providers</a></div><divclass="hide link depth-3"><ahref="/v5/api/providers/types/">Types</a></div><divclass="hide link depth-2"><ahref="/v5/api/utils/">Utilities</a></div><divclass="hide link depth-3"><ahref="/v5/api/utils/abi/">Application Binary Interface</a></div><divclass="hide link depth-4"><ahref="/v5/api/utils/abi/coder/">AbiCoder</a></div><divclass="hide link depth-4"><ahref="/v5/api/utils/abi/formats/">ABI Formats</a></div><divclass="hide link depth-4"><ahref="/v5/api/utils/abi/fragments/">Fragments</a></div><divclass="hide link depth-4"><ahref="/v5/api/utils/abi/interface/">Interface</a></div><divclass="hide link depth-3"><ahref="/v5/api/utils/address/">Addresses</a></div><divclass="hide link depth-3"><ahref="/v5/api/utils/bignumber/">BigNumber</a></div><divclass="hide link depth-3"><ahref="/v5/api/utils/bytes/">Byte Manipulation</a></div><divclass="hide link depth-3"><ahref="/v5/api/utils/constants/">Constants</a></div><divclass="hide link depth-3"><ahref="/v5/api/utils/display-logic/">Display Logic and Input</a></div><divclass="hide link depth-3"><ahref="/v5/api/utils/encoding/">Encoding Utilities</a></div><divclass="hide link depth-3"><ahref="/v5/api/utils/fixednumber/">FixedNumber</a></div><divclass="hide link depth-3"><ahref="/v5/api/utils/hashing/">Hashing Algorithms</a></div><divclass="hide link depth-3"><ahref="/v5/api/utils/hdnode/">HD Wallet</a></div><divclass="hide link depth-3"><ahref="/v5/api/utils/logger/">Logging</a></div><divclass="hide link depth-3"><ahref="/v5/api/utils/properties/">Property Utilities</a></div><divclass="hide link depth-3"><ahref="/v5/api/utils/signing-key/">Signing Key</a></div><divclass="hide link depth-3"><ahref="/v5/api/utils/strings/">Strings</a></div><divclass="hide link depth-3"><ahref="/v5/api/utils/transactions/">Transactions</a></div><divclass="hide link depth-3"><ahref="/v5/api/utils/web/">Web Utilities</a></div><divclass="hide link depth-3"><ahref="/v5/api/utils/wordlists/">Wordlists</a></div><divclass="hide link depth-2"><ahref="/v5/api/other/">Other Libraries</a></div><divclass="hide link depth-3"><ahref="/v5/api/other/assembly/">Assembly</a></div><divclass="hide link depth-4"><ahref="/v5/api/other/assembly/dialect/">Ethers ASM Dialect</a></div><divclass="hide link depth-4"><ahref="/v5/api/other/assembly/api/">Utilities</a></div><divclass="hide link depth-4"><ahref="/v5/api/other/assembly/ast/">Abstract Syntax Tree</a></div><divclass="hide link depth-3"><ahref="/v5/api/other/hardware/">Hardware Wallets</a></div><divclass="hide link depth-2"><ahref="/v5/api/experiment
<aname="flatworm"></a><aname="flatworm"></a><h1class="show-anchors"><div>Flatworm Docs<divclass="anchors"><aclass="self"href="/v5/documentation/#flatworm"></a></div></div></h1><p>The <i>Flatworm Docs</i> rendering engine is designed to be <b>very</b> simple, but provide enough formatting necessary for documenting JavaScript libraries.</p>
<p>A lot of its inspiration came from <ahref="https://github.com/readthedocs/sphinx_rtd_theme">Read the Docs</a> and the <ahref="https://www.sphinx-doc.org/">Sphinx</a> project.</p>
<aname="flatworm-fragments"></a><aname="flatworm--flatworm-fragments"></a><h2class="show-anchors"><div>Fragments<divclass="anchors"><aclass="self"href="/v5/documentation/#flatworm-fragments"></a></div></div></h2><p>Each page is made up of fragments. A fragment is a <ahref="/v5/documentation/#flatworm-directive">directive</a>, with an value and optional <i>link</i>, <i>extensions</i> and a body.</p>
BODY: Optional; the directive body (certain directives only)</div><aname="flatworm-directive"></a><aname="flatworm--flatworm-fragments--flatworm-directive"></a><h3class="show-anchors"><div>Flatworm Directives<divclass="anchors"><aclass="self"href="/v5/documentation/#flatworm-directive"></a></div></div></h3>
<divclass="definition"><divclass="term"><b>_section:</b><i>TITLE</i></div><divclass="body"><p>A <i>section</i> has its <b>TITLE</b> in an H1 font. Sections are linked to in <i>Table of Contents</i> and have a dividing line drawn above them.</p>
<p>The body supports markdown.</p>
<p>There should only be one <codeclass="inline">_section:</code> per page.</p>
</div></div><divclass="definition"><divclass="term"><b>_subsection:</b><i>TITLE</i></div><divclass="body"><p>A <i>subsection</i> has its <b>TITLE</b> in an H2 font. Subsections are linked to in <i>Table of Contents</i> and have a dividing line drawn above them.</p>
</div></div><divclass="definition"><divclass="term"><b>_heading:</b><i>TITLE</i></div><divclass="body"><p>A <i>heading</i> has its <b>TITLE</b> in an H3 font.</p>
</div></div><divclass="definition"><divclass="term"><b>_definition:</b><i>TERM</i></div><divclass="body"><p>A <i>definition</i> has its <b>TERM</b> in normal text and the body is indented.</p>
<p>The title and body support markdown.</p>
</div></div><divclass="definition"><divclass="term"><b>_property:</b><i>SIGNATURE</i></div><divclass="body"><p>A <i>property</i> has its JavaScript <b>SIGNATURE</b> formatted.</p>
<p>The body supports markdown and the return portion of the signature support markdown links.</p>
</div></div><divclass="definition"><divclass="term"><b>_note:</b><i>BANNER</i></div><divclass="body"><p>A <i>note</i> is placed in a blue bordered-box to draw attention to it.</p>
<p>The body supports markdown.</p>
</div></div><divclass="definition"><divclass="term"><b>_warning:</b><i>BANNER</i></div><divclass="body"><p>A <i>warning</i> is placed in an orange bordered-box to draw attention to it.</p>
<p>The body supports markdown.</p>
</div></div><divclass="definition"><divclass="term"><b>_code:</b><i>CAPTION</i></div><divclass="body"><p>Creates a <ahref="/v5/documentation/#flatworm--code">Code</a> block.</p>
<p>The body does <b>not</b> support markdown, and will be output exactly as is, with the exception of <ahref="/v5/documentation/#flatworm--code-eval">Code Evaluation</a>.</p>
<p>If a line begins with a <codeclass="inline">"_"</code>, it should be escaped with a <codeclass="inline">"\"</code>.</p>
</div></div><divclass="definition"><divclass="term"><b>_table:</b><i>FOOTER</i></div><divclass="body"><p>Creates a <ahref="/v5/documentation/#flatworm--table">Table</a> structured according to the body.</p>
</div></div><divclass="definition"><divclass="term"><b>_toc:</b></div><divclass="body"><p>A <i>toc</i> injects a Table of Contents, loading each line of the body as a filename and recursively loads the <i>toc</i> if present, otherwise all the <i>sections</i> and <i>subsections</i>.</p>
<p>The body does <b>not</b> support markdown, as it is interpreted as a list of files and directories to process.</p>
</div></div><divclass="definition"><divclass="term"><b>_null:</b></div><divclass="body"><p>A <i>null</i> is used to terminated a directive. For example, after a <i>definition</i>, the bodies are indented, so a <i>null</i> can be used to reset the indentation.</p>
<p>The body supports markdown.</p>
</div></div><divclass="code-title"><div>Example</div></div><divclass="code">_section: Hello World @<link-main>
Body for section...
_subsection: Some Example @<link-secondary>
Body for subsection...
_heading: Large Bold Text @<link-here>
Body for heading...
_definition: Flatworm
A phylum of relatively **simple** bilaterian, unsegmented,
soft-bodied invertebrates.
_property: String.fromCharCode(code) => string
Returns a string created from //code//, a sequence of
This breaks out of a directive. For example, to end
a ``_note:`` or ``_code:``.</div><aname="flatworm-markdown"></a><aname="flatworm--flatworm-markdown"></a><h2class="show-anchors"><div>Markdown<divclass="anchors"><aclass="self"href="/v5/documentation/#flatworm-markdown"></a></div></div></h2><p>The markdown is simple and does not have the flexibility of other dialects, but allows for <b>bold</b>, <i>italic</i>, <u>underlined</u>, <codeclass="inline">monospaced</code>, super<sup>script</sup> and <strike>strike</strike> text, supporting <ahref="/v5/documentation/#flatworm-markdown">links</a> and lists.</p>
[[some-link]] will use the title from its directives value.</div><aname="flatworm--code"></a><aname="flatworm--flatworm--code"></a><h2class="show-anchors"><div>Code<divclass="anchors"><aclass="self"href="/v5/documentation/#flatworm--code"></a></div></div></h2><p>The code directive creates a monospace, contained block useful for displaying code samples.</p>
<aname="flatworm--code-eval"></a><aname="flatworm--flatworm--code--flatworm--code-eval"></a><h3class="show-anchors"><div>JavaScript Evaluation<divclass="anchors"><aclass="self"href="/v5/documentation/#flatworm--code-eval"></a></div></div></h3><p>For JavaScript files, the file is executed with some simple substitution.</p>
<p>A bare <codeclass="inline">//!</code> on a line is replaced with the result of the last statement. Building will fail if an error is thrown.</p>
<p>A bare <codeclass="inline">//!error</code> is replaced with the throw error. Building will fail if an error is not thrown.</p>
<p>Also any code included between the lines <b><codeclass="inline">// <hide></code></b> and <b><codeclass="inline">// </hide></code></b> will be omitted from the output, which can be used to setup variables.</p>
<divclass="code-title"><div>Code Evaluation Example</div></div><divclass="code">_code: Result of Code Example @lang<javascript>
// <hide>
const url = require("url");
// </hide>
url.parse("https://www.ricmoo.com/").protocol
//!
url.parse(45)
//! error
// You want to assign (doesn't emit eval) AND display the value
</span></div><aname="flatworm--flatworm--code--languages"></a><h3class="show-anchors"><div>Languages<divclass="anchors"><aclass="self"href="/v5/documentation/#flatworm--flatworm--code--languages"></a></div></div></h3><p>The language can be specified using the <ahref="/v5/documentation/#flatworm--ext-lang">@lang extension</a>.</p>
<tableclass="table minimal"><tr><tdalign="center"><b>Language</b></td><tdalign="center"><b>Notes</b></td><tdclass="fix"> </td></tr><tr><tdalign="center">javascript</td><tdalign="left">Syntax highlights and <ahref="/v5/documentation/#flatworm--code-eval">evaluates</a> the JavaScipt</td><tdclass="fix"> </td></tr><tr><tdalign="center">script</td><tdalign="left">Same as <codeclass="inline">javascript</code>, but does not evaluate the results</td><tdclass="fix"> </td></tr><tr><tdalign="center">shell</td><tdalign="left">Shell scripts or command-line</td><tdclass="fix"> </td></tr><tr><tdalign="center">text</td><tdalign="left">Plain text with no syntax highlighting</td><tdclass="fix"> </td></tr></table><aname="flatworm--table"></a><aname="flatworm--flatworm--table"></a><h2class="show-anchors"><div>Tables<divclass="anchors"><aclass="self"href="/v5/documentation/#flatworm--table"></a></div></div></h2><p>The table directive consumes the entire body up until the next directive. To terminate a table early to begin a text block, use a <b>_null:</b> directive.</p>
<p>Each line of the body should be <ahref="/v5/documentation/#flatworm--table-row">Row Data</a> or a <ahref="/v5/documentation/#flatworm--table-variable">Variable Declaration</a> (or continuation of a <i>Variable Declaration</i>). Blank lines are ignored.</p>
<aname="flatworm--table-row"></a><aname="flatworm--flatworm--table--flatworm--table-row"></a><h3class="show-anchors"><div>Row Data<divclass="anchors"><aclass="self"href="/v5/documentation/#flatworm--table-row"></a></div></div></h3><p>Each <b>Row Data</b> line must begin and end with a <b><codeclass="inline">"|"</code></b>, with each gap representing the cell data, <ahref="/v5/documentation/#flatworm--table-alignment">alignment</a> with optional <ahref="/v5/documentation/#flatworm--table-spanning">column and row spanning</a>.</p>
<aname="flatworm--table-alignment"></a><aname="flatworm--flatworm--table--flatworm--table-alignment"></a><h3class="show-anchors"><div>Alignment<divclass="anchors"><aclass="self"href="/v5/documentation/#flatworm--table-alignment"></a></div></div></h3><p>The alignment for a cell is determined by the whitespace surrounding the cell data.</p>
<tableclass="table minimal"><tr><tdalign="center"><b>Alignment</b></td><tdalign="center"><b>Whitespace</b></td><tdclass="fix"> </td></tr><tr><tdalign="center"><i>Left</i></td><tdalign="left">1 or fewer spaces before the content</td><tdclass="fix"> </td></tr><tr><tdalign="center"><i>Right</i></td><tdalign="left">1 or fewer spaces after the content</td><tdclass="fix"> </td></tr><tr><tdalign="center"><i>Center</i></td><tdalign="left">2 or more space <b>both</b> before and after the content</td><tdclass="fix"> </td></tr><tr><tdclass="table-title"colspan="2">Alignment Conditions (higher precedence listed first)</td><tdclass="fix"> </td></tr></table><divclass="code-title"><div>Alignment Example</div></div><divclass="code">_table: Result of Alignment Example @style<compact>
| right|</div><tableclass="table compact"><tr><tdalign="center"width="100%">center</td><tdclass="fix"> </td></tr><tr><tdalign="left"width="100%">left</td><tdclass="fix"> </td></tr><tr><tdalign="left"width="100%">left</td><tdclass="fix"> </td></tr><tr><tdalign="right"width="100%">right</td><tdclass="fix"> </td></tr><tr><tdalign="right"width="100%">right</td><tdclass="fix"> </td></tr><tr><tdclass="table-title"colspan="1">Result of Alignment Example</td><tdclass="fix"> </td></tr></table><aname="flatworm--table-spanning"></a><aname="flatworm--flatworm--table--flatworm--table-spanning"></a><h3class="show-anchors"><div>Row and Column Spanning<divclass="anchors"><aclass="self"href="/v5/documentation/#flatworm--table-spanning"></a></div></div></h3><p>A column may end its content with any number of <b><codeclass="inline">"<"</code></b> which indicates how many <i>additional</i> columns to extend into.</p>
<p>If the cell content contains only a <b><codeclass="inline">"^"</code></b>, then the row above is extended into this cell (into the same number of columns).</p>
<divclass="code-title"><div>Cell Spanning Example</div></div><divclass="code">_table: Result of Cell Spanning Example @style<compact>
| ^ | ^ | (1x1) |</div><tableclass="table compact"><tr><tdalign="center"width="25%">(1x1)</td><tdalign="center"colspan="2"width="50%">(1x2)</td><tdalign="center"rowspan="2"width="25%">(2x1)</td><tdclass="fix"> </td></tr><tr><tdalign="center"colspan="2"rowspan="2"width="50%">(2x2)</td><tdalign="center"rowspan="2"width="25%">(2x1)</td><tdclass="fix"> </td></tr><tr><tdalign="center"width="25%">(1x1)</td><tdclass="fix"> </td></tr><tr><tdclass="table-title"colspan="4">Result of Cell Spanning Example</td><tdclass="fix"> </td></tr></table><aname="flatworm--table-style"></a><aname="flatworm--flatworm--table--flatworm--table-style"></a><h3class="show-anchors"><div>Styles<divclass="anchors"><aclass="self"href="/v5/documentation/#flatworm--table-style"></a></div></div></h3><p>The <ahref="/v5/documentation/#flatworm--ext-style">@style extension</a> for a table can be used to control its appearance.</p>
<tableclass="table minimal"><tr><tdalign="center"><b>Name</b></td><tdalign="center"><b>Width</b></td><tdalign="center"><b>Columns</b></td><tdclass="fix"> </td></tr><tr><tdalign="center"><i>minimal</i></td><tdalign="center">minimum size</td><tdalign="center">best fit</td><tdclass="fix"> </td></tr><tr><tdalign="center"><i>compact</i></td><tdalign="center">40%</td><tdalign="center">evenly spaced</td><tdclass="fix"> </td></tr><tr><tdalign="center"><i>wide</i></td><tdalign="center">67%</td><tdalign="center">evenly spaced</td><tdclass="fix"> </td></tr><tr><tdalign="center"><i>full</i></td><tdalign="center">100%</td><tdalign="center">evenly spaced</td><tdclass="fix"> </td></tr></table><aname="flatworm--table-variable"></a><aname="flatworm--flatworm--table--flatworm--table-variable"></a><h3class="show-anchors"><div>Variables<divclass="anchors"><aclass="self"href="/v5/documentation/#flatworm--table-variable"></a></div></div></h3><p>Often the layout of a table is easier to express and maintain without uneven or changing content within it. So the content can be defined separately within a table directive using <b>variables</b>. A varaible name must being with a letter and must only contain letters and numbers.</p>
<p>Variables are also useful when content is repeated throughout a table.</p>
<p>A variable is declared by starting a line with <codeclass="inline">"$NAME:"</code>, which consumes all lines until the next variable declaration or until the next table row line.</p>
<p>A variable name must start with a letter and may consist of letters and numbers. (i.e. <codeclass="inline">/[a-z][a-z0-9]*/i</code>)</p>
<divclass="code-title"><div>Variables Example</div></div><divclass="code">_table: Result of Variables Example
| $bottom <|</div><tableclass="table minimal"><tr><tdalign="center"><b>Feature</b></td><tdalign="center"><b>Supported</b></td><tdclass="fix"> </td></tr><tr><tdalign="center">Dancing Monkey</td><tdalign="center">This option is supported.</td><tdclass="fix"> </td></tr><tr><tdalign="center">Singing Turtle</td><tdalign="center">This option is <b>not</b> supported.</td><tdclass="fix"> </td></tr><tr><tdalign="center">Newt Hair</td><tdalign="center">This option is supported.</td><tdclass="fix"> </td></tr><tr><tdalign="center"colspan="2">This just represents an example of what is possible. Notice that variable content can span multiple lines.</td><tdclass="fix"> </td></tr><tr><tdclass="table-title"colspan="2">Result of Variables Example</td><tdclass="fix"> </td></tr></table><aname="flatworm-config"></a><aname="flatworm--flatworm-config"></a><h2class="show-anchors"><div>Configuration<divclass="anchors"><aclass="self"href="/v5/documentation/#flatworm-config"></a></div></div></h2><p>Configuration is optional (but highly recommended) and may be either a simple JSON file (config.json) or a JS file (config.js) placed in the top of the source folder.</p>
<aname="flatworm--ext-inherit"></a><aname="flatworm--flatworm-extensions--flatworm--ext-inherit"></a><h3class="show-anchors"><div>@inherit<<i>markdown</i>><divclass="anchors"><aclass="self"href="/v5/documentation/#flatworm--ext-inherit"></a></div></div></h3><p>Adds an inherits description to a directive. The <i>markdown</i> may contain links.</p>
<aname="flatworm--ext-lang"></a><aname="flatworm--flatworm-extensions--flatworm--ext-lang"></a><h3class="show-anchors"><div>@lang<<i>text</i>><divclass="anchors"><aclass="self"href="/v5/documentation/#flatworm--ext-lang"></a></div></div></h3><p>Set the language a <ahref="/v5/documentation/#flatworm--code">code directive</a> should be syntax-highlighted for. If "javascript", the code will be evaluated.</p>
<aname="flatworm--ext-nav"></a><aname="flatworm--flatworm-extensions--flatworm--ext-nav"></a><h3class="show-anchors"><div>@nav<<i>text</i>><divclass="anchors"><aclass="self"href="/v5/documentation/#flatworm--ext-nav"></a></div></div></h3><p>Sets the name in the breadcrumbs when not the current node.</p>
<aname="flatworm--ext-note"></a><aname="flatworm--flatworm-extensions--flatworm--ext-note"></a><h3class="show-anchors"><div>@note<<i> markdown</i>><divclass="anchors"><aclass="self"href="/v5/documentation/#flatworm--ext-note"></a></div></div></h3><p>Adds a note to a directive. The <i>markdown</i> may contain links. If the directive already has an @INHERIT extension, that will be used instead and the @NOTE will be ignored.</p>
<aname="flatworm--ext-src"></a><aname="flatworm--flatworm-extensions--flatworm--ext-src"></a><h3class="show-anchors"><div>@src<<i>key</i>><divclass="anchors"><aclass="self"href="/v5/documentation/#flatworm--ext-src"></a></div></div></h3><p>Calls the configuration <codeclass="inline">getSourceUrl(key, VALUE)</code> to get a URL which will be linked to by a link next to the <i>directive</i>.</p>
<p>This extended directive function requires an advanced <codeclass="inline">config.js</code><ahref="/v5/documentation/#flatworm-config">Configuration</a> file since it requires a JavaScript function.</p>
<aname="flatworm--ext-style"></a><aname="flatworm--flatworm-extensions--flatworm--ext-style"></a><h3class="show-anchors"><div>@style<<i>text</i>><divclass="anchors"><aclass="self"href="/v5/documentation/#flatworm--ext-style"></a></div></div></h3><p>The <ahref="/v5/documentation/#flatworm--table-style">Table Style</a> to use for a table directive.</p>
<divclass="copyright">The content of this site is licensed under the <ahref="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 5, 2020, 12:0am.</div>