UNPKG

@swipewallet/venus-js

Version:

A JavaScript SDK for Ethereum and the Venus Protocol.

782 lines (748 loc) 60.6 kB
<!doctype html> <html class="default no-js"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>&quot;comp&quot; | Venus.js - v0.0.4</title> <meta name="description" content="Documentation for Venus.js - v0.0.4"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="../assets/css/main.css"> </head> <body> <header> <div class="tsd-page-toolbar"> <div class="container"> <div class="table-wrap"> <div class="table-cell" id="tsd-search" data-index="../assets/js/search.json" data-base=".."> <div class="field"> <label for="tsd-search-field" class="tsd-widget search no-caption">Search</label> <input id="tsd-search-field" type="text" /> </div> <ul class="results"> <li class="state loading">Preparing search index...</li> <li class="state failure">The search index is not available</li> </ul> <a href="../index.html" class="title">Venus.js - v0.0.4</a> </div> <div class="table-cell" id="tsd-widgets"> <div id="tsd-filter"> <a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a> <div class="tsd-filter-group"> <div class="tsd-select" id="tsd-filter-visibility"> <span class="tsd-select-label">All</span> <ul class="tsd-select-list"> <li data-value="public">Public</li> <li data-value="protected">Public/Protected</li> <li data-value="private" class="selected">All</li> </ul> </div> <input type="checkbox" id="tsd-filter-inherited" checked /> <label class="tsd-widget" for="tsd-filter-inherited">Inherited</label> <input type="checkbox" id="tsd-filter-only-exported" /> <label class="tsd-widget" for="tsd-filter-only-exported">Only exported</label> </div> </div> <a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a> </div> </div> </div> </div> <div class="tsd-page-title"> <div class="container"> <ul class="tsd-breadcrumb"> <li> <a href="../globals.html">Globals</a> </li> <li> <a href="_comp_.html">&quot;comp&quot;</a> </li> </ul> <h1>Module &quot;comp&quot;</h1> </div> </div> </header> <div class="container container-main"> <div class="row"> <div class="col-8 col-content"> <section class="tsd-panel-group tsd-index-group"> <h2>Index</h2> <section class="tsd-panel tsd-index-panel"> <div class="tsd-index-content"> <section class="tsd-index-section "> <h3>Functions</h3> <ul class="tsd-index-list"> <li class="tsd-kind-function tsd-parent-kind-module"><a href="_comp_.html#claimvenus" class="tsd-kind-icon">claim<wbr>Venus</a></li> <li class="tsd-kind-function tsd-parent-kind-module"><a href="_comp_.html#createdelegatesignature" class="tsd-kind-icon">create<wbr>Delegate<wbr>Signature</a></li> <li class="tsd-kind-function tsd-parent-kind-module"><a href="_comp_.html#delegate" class="tsd-kind-icon">delegate</a></li> <li class="tsd-kind-function tsd-parent-kind-module"><a href="_comp_.html#delegatebysig" class="tsd-kind-icon">delegate<wbr>BySig</a></li> <li class="tsd-kind-function tsd-parent-kind-module"><a href="_comp_.html#getmintablevai" class="tsd-kind-icon">get<wbr>MintableVAI</a></li> <li class="tsd-kind-function tsd-parent-kind-module"><a href="_comp_.html#getvaimintrate" class="tsd-kind-icon">getVAIMint<wbr>Rate</a></li> <li class="tsd-kind-function tsd-parent-kind-module"><a href="_comp_.html#getvenusaccrued" class="tsd-kind-icon">get<wbr>Venus<wbr>Accrued</a></li> <li class="tsd-kind-function tsd-parent-kind-module"><a href="_comp_.html#getvenusbalance" class="tsd-kind-icon">get<wbr>Venus<wbr>Balance</a></li> <li class="tsd-kind-function tsd-parent-kind-module"><a href="_comp_.html#mintvai" class="tsd-kind-icon">mintVAI</a></li> <li class="tsd-kind-function tsd-parent-kind-module"><a href="_comp_.html#mintvaiguardianpaused" class="tsd-kind-icon">mintVAIGuardian<wbr>Paused</a></li> <li class="tsd-kind-function tsd-parent-kind-module"><a href="_comp_.html#mintedvaiof" class="tsd-kind-icon">mintedVAIOf</a></li> <li class="tsd-kind-function tsd-parent-kind-module"><a href="_comp_.html#mintedvais" class="tsd-kind-icon">mintedVAIs</a></li> <li class="tsd-kind-function tsd-parent-kind-module"><a href="_comp_.html#repayvai" class="tsd-kind-icon">repayVAI</a></li> <li class="tsd-kind-function tsd-parent-kind-module"><a href="_comp_.html#repayvaiguardianpaused" class="tsd-kind-icon">repayVAIGuardian<wbr>Paused</a></li> <li class="tsd-kind-function tsd-parent-kind-module tsd-is-not-exported"><a href="_comp_.html#tochecksumaddress" class="tsd-kind-icon">to<wbr>Checksum<wbr>Address</a></li> <li class="tsd-kind-function tsd-parent-kind-module"><a href="_comp_.html#vaicontroller" class="tsd-kind-icon">vai<wbr>Controller</a></li> <li class="tsd-kind-function tsd-parent-kind-module"><a href="_comp_.html#vaimintrate" class="tsd-kind-icon">vai<wbr>Mint<wbr>Rate</a></li> </ul> </section> </div> </section> </section> <section class="tsd-panel-group tsd-member-group "> <h2>Functions</h2> <section class="tsd-panel tsd-member tsd-kind-function tsd-parent-kind-module"> <a name="claimvenus" class="tsd-anchor"></a> <h3>claim<wbr>Venus</h3> <ul class="tsd-signatures tsd-kind-function tsd-parent-kind-module"> <li class="tsd-signature tsd-kind-icon">claim<wbr>Venus<span class="tsd-signature-symbol">(</span>options<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">CallOptions</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">TrxResponse</span><span class="tsd-signature-symbol">&gt;</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/VenusProtocol/venus-js/blob/f412301/src/comp.ts#L177">comp.ts:177</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Create a transaction to claim accrued VENUS tokens for the user.</p> </div> <dl class="tsd-comment-tags"> <dt>example</dt> <dd><pre><code><span class="hljs-keyword">const</span> venus = <span class="hljs-keyword">new</span> Venus(<span class="hljs-built_in">window</span>.ethereum); (<span class="hljs-keyword">async</span> <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params"></span>) </span>{ <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&#x27;Claiming Venus...&#x27;</span>); <span class="hljs-keyword">const</span> trx = <span class="hljs-keyword">await</span> venus.claimVenus(); <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&#x27;Ethers.js transaction object&#x27;</span>, trx); })().catch(<span class="hljs-built_in">console</span>.error);</code></pre> </dd> </dl> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5><span class="tsd-flag ts-flagDefault value">Default value</span> options: <span class="tsd-signature-type">CallOptions</span><span class="tsd-signature-symbol"> = {}</span></h5> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">TrxResponse</span><span class="tsd-signature-symbol">&gt;</span></h4> <p>Returns an Ethers.js transaction object of the vote transaction.</p> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-function tsd-parent-kind-module"> <a name="createdelegatesignature" class="tsd-anchor"></a> <h3>create<wbr>Delegate<wbr>Signature</h3> <ul class="tsd-signatures tsd-kind-function tsd-parent-kind-module"> <li class="tsd-signature tsd-kind-icon">create<wbr>Delegate<wbr>Signature<span class="tsd-signature-symbol">(</span>delegatee<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, expiry<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">Signature</span><span class="tsd-signature-symbol">&gt;</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/VenusProtocol/venus-js/blob/f412301/src/comp.ts#L375">comp.ts:375</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Create a delegate signature for Venus Governance using EIP-712. The signature can be created without burning gas. Anyone can post it to the blockchain using the <code>delegateBySig</code> method, which does have gas costs.</p> </div> <dl class="tsd-comment-tags"> <dt>example</dt> <dd><pre><code><span class="hljs-keyword">const</span> venus = <span class="hljs-keyword">new</span> Venus(<span class="hljs-built_in">window</span>.ethereum); (<span class="hljs-keyword">async</span> () =&gt; { <span class="hljs-keyword">const</span> delegateSignature = <span class="hljs-keyword">await</span> venus.createDelegateSignature(<span class="hljs-string">&#x27;0xa0df350d2637096571F7A701CBc1C5fdE30dF76A&#x27;</span>); <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&#x27;delegateSignature&#x27;</span>, delegateSignature); })().<span class="hljs-keyword">catch</span>(<span class="hljs-built_in">console</span>.error);</code></pre> </dd> </dl> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>delegatee: <span class="tsd-signature-type">string</span></h5> <div class="tsd-comment tsd-typography"> <p>The address to delegate the user&#39;s voting rights to.</p> </div> </li> <li> <h5><span class="tsd-flag ts-flagDefault value">Default value</span> expiry: <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> = 10000000000</span></h5> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">Signature</span><span class="tsd-signature-symbol">&gt;</span></h4> <p>Returns an object that contains the <code>v</code>, <code>r</code>, and <code>s</code> components of an Ethereum signature as hexadecimal strings.</p> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-function tsd-parent-kind-module"> <a name="delegate" class="tsd-anchor"></a> <h3>delegate</h3> <ul class="tsd-signatures tsd-kind-function tsd-parent-kind-module"> <li class="tsd-signature tsd-kind-icon">delegate<span class="tsd-signature-symbol">(</span>_address<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, options<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">CallOptions</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">TrxResponse</span><span class="tsd-signature-symbol">&gt;</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/VenusProtocol/venus-js/blob/f412301/src/comp.ts#L229">comp.ts:229</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Create a transaction to delegate Venus Governance voting rights to an address.</p> </div> <dl class="tsd-comment-tags"> <dt>example</dt> <dd><pre><code><span class="hljs-keyword">const</span> venus = <span class="hljs-keyword">new</span> Venus(<span class="hljs-built_in">window</span>.ethereum); (<span class="hljs-keyword">async</span> <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params"></span>) </span>{ <span class="hljs-keyword">const</span> delegateTx = <span class="hljs-keyword">await</span> venus.delegate(<span class="hljs-string">&#x27;0xa0df350d2637096571F7A701CBc1C5fdE30dF76A&#x27;</span>); <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&#x27;Ethers.js transaction object&#x27;</span>, delegateTx); })().catch(<span class="hljs-built_in">console</span>.error);</code></pre> </dd> </dl> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>_address: <span class="tsd-signature-type">string</span></h5> <div class="tsd-comment tsd-typography"> <p>The address in which to delegate voting rights to.</p> </div> </li> <li> <h5><span class="tsd-flag ts-flagDefault value">Default value</span> options: <span class="tsd-signature-type">CallOptions</span><span class="tsd-signature-symbol"> = {}</span></h5> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">TrxResponse</span><span class="tsd-signature-symbol">&gt;</span></h4> <p>Returns an Ethers.js transaction object of the vote transaction.</p> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-function tsd-parent-kind-module"> <a name="delegatebysig" class="tsd-anchor"></a> <h3>delegate<wbr>BySig</h3> <ul class="tsd-signatures tsd-kind-function tsd-parent-kind-module"> <li class="tsd-signature tsd-kind-icon">delegate<wbr>BySig<span class="tsd-signature-symbol">(</span>_address<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, nonce<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span>, expiry<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span>, signature<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Signature</span>, options<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">CallOptions</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">TrxResponse</span><span class="tsd-signature-symbol">&gt;</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/VenusProtocol/venus-js/blob/f412301/src/comp.ts#L297">comp.ts:297</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Delegate voting rights in Venus Governance using an EIP-712 signature.</p> </div> <dl class="tsd-comment-tags"> <dt>example</dt> <dd><pre><code><span class="hljs-keyword">const</span> venus = <span class="hljs-keyword">new</span> Venus(<span class="hljs-built_in">window</span>.ethereum); (<span class="hljs-keyword">async</span> <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params"></span>) </span>{ <span class="hljs-keyword">const</span> delegateTx = <span class="hljs-keyword">await</span> venus.delegateBySig( <span class="hljs-string">&#x27;0xa0df350d2637096571F7A701CBc1C5fdE30dF76A&#x27;</span>, <span class="hljs-number">42</span>, <span class="hljs-number">9999999999</span>, { <span class="hljs-attr">v</span>: <span class="hljs-string">&#x27;0x1b&#x27;</span>, <span class="hljs-attr">r</span>: <span class="hljs-string">&#x27;0x130dbca2fafa07424c033b4479687cc1deeb65f08809e3ab397988cc4c6f2e78&#x27;</span>, <span class="hljs-attr">s</span>: <span class="hljs-string">&#x27;0x1debeb8250262f23906b1177161f0c7c9aa3641e8bff5b6f5c88a6bb78d5d8cd&#x27;</span> } ); <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&#x27;Ethers.js transaction object&#x27;</span>, delegateTx); })().catch(<span class="hljs-built_in">console</span>.error);</code></pre> </dd> </dl> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>_address: <span class="tsd-signature-type">string</span></h5> <div class="tsd-comment tsd-typography"> <p>The address to delegate the user&#39;s voting rights to.</p> </div> </li> <li> <h5>nonce: <span class="tsd-signature-type">number</span></h5> <div class="tsd-comment tsd-typography"> <p>The contract state required to match the signature. This can be retrieved from the VENUS contract&#39;s public nonces mapping.</p> </div> </li> <li> <h5>expiry: <span class="tsd-signature-type">number</span></h5> <div class="tsd-comment tsd-typography"> <p>The time at which to expire the signature. A block timestamp as seconds since the unix epoch.</p> </div> </li> <li> <h5><span class="tsd-flag ts-flagDefault value">Default value</span> signature: <span class="tsd-signature-type">Signature</span><span class="tsd-signature-symbol"> = { v: &#x27;&#x27;, r: &#x27;&#x27;, s: &#x27;&#x27; }</span></h5> <div class="tsd-comment tsd-typography"> <p>An object that contains the v, r, and, s values of an EIP-712 signature.</p> </div> </li> <li> <h5><span class="tsd-flag ts-flagDefault value">Default value</span> options: <span class="tsd-signature-type">CallOptions</span><span class="tsd-signature-symbol"> = {}</span></h5> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">TrxResponse</span><span class="tsd-signature-symbol">&gt;</span></h4> <p>Returns an Ethers.js transaction object of the vote transaction.</p> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-function tsd-parent-kind-module"> <a name="getmintablevai" class="tsd-anchor"></a> <h3>get<wbr>MintableVAI</h3> <ul class="tsd-signatures tsd-kind-function tsd-parent-kind-module"> <li class="tsd-signature tsd-kind-icon">get<wbr>MintableVAI<span class="tsd-signature-symbol">(</span>_address<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, options<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">CallOptions</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">&gt;</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/VenusProtocol/venus-js/blob/f412301/src/comp.ts#L454">comp.ts:454</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Get the mintable VAI amount of address.</p> </div> <dl class="tsd-comment-tags"> <dt>example</dt> <dd><pre><code><span class="hljs-keyword">const</span> venus = <span class="hljs-keyword">new</span> Venus(<span class="hljs-built_in">window</span>.ethereum); (<span class="hljs-keyword">async</span> () =&gt; { <span class="hljs-keyword">const</span> amount = <span class="hljs-keyword">await</span> venus.getMintableVAI(<span class="hljs-string">&#x27;0x4Ddc2D193948926D02f9B1fE9e1daa0718270ED5&#x27;</span>); <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&#x27;MintableVAI amount&#x27;</span>, amount); })().<span class="hljs-keyword">catch</span>(<span class="hljs-built_in">console</span>.error);</code></pre> </dd> </dl> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>_address: <span class="tsd-signature-type">string</span></h5> <div class="tsd-comment tsd-typography"> <p>The address in which to get mintable VAI amount.</p> </div> </li> <li> <h5><span class="tsd-flag ts-flagDefault value">Default value</span> options: <span class="tsd-signature-type">CallOptions</span><span class="tsd-signature-symbol"> = {}</span></h5> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">&gt;</span></h4> <p>Returns a string of the numeric amount of mintable VAI. The value is scaled up by 18 decimal places.</p> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-function tsd-parent-kind-module"> <a name="getvaimintrate" class="tsd-anchor"></a> <h3>getVAIMint<wbr>Rate</h3> <ul class="tsd-signatures tsd-kind-function tsd-parent-kind-module"> <li class="tsd-signature tsd-kind-icon">getVAIMint<wbr>Rate<span class="tsd-signature-symbol">(</span>options<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">CallOptions</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">&gt;</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/VenusProtocol/venus-js/blob/f412301/src/comp.ts#L509">comp.ts:509</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Get the VAI mint rate.</p> </div> <dl class="tsd-comment-tags"> <dt>example</dt> <dd><pre><code><span class="hljs-keyword">const</span> venus = <span class="hljs-keyword">new</span> Venus(<span class="hljs-built_in">window</span>.ethereum); (<span class="hljs-keyword">async</span> () =&gt; { <span class="hljs-keyword">const</span> rate = <span class="hljs-keyword">await</span> venus.getVAIMintRate(); <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&#x27;VAI mint rate&#x27;</span>, rate); })().<span class="hljs-keyword">catch</span>(<span class="hljs-built_in">console</span>.error);</code></pre> </dd> </dl> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5><span class="tsd-flag ts-flagDefault value">Default value</span> options: <span class="tsd-signature-type">CallOptions</span><span class="tsd-signature-symbol"> = {}</span></h5> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">&gt;</span></h4> <p>Returns a string of the numeric VAI mint rate.</p> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-function tsd-parent-kind-module"> <a name="getvenusaccrued" class="tsd-anchor"></a> <h3>get<wbr>Venus<wbr>Accrued</h3> <ul class="tsd-signatures tsd-kind-function tsd-parent-kind-module"> <li class="tsd-signature tsd-kind-icon">get<wbr>Venus<wbr>Accrued<span class="tsd-signature-symbol">(</span>_address<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, _provider<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Provider</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">&gt;</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/VenusProtocol/venus-js/blob/f412301/src/comp.ts#L122">comp.ts:122</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Get the amount of VENUS tokens accrued but not yet claimed by an address.</p> </div> <dl class="tsd-comment-tags"> <dt>example</dt> <dd><pre><code>(<span class="hljs-keyword">async</span> <span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params"></span>) </span>{ <span class="hljs-keyword">const</span> acc = <span class="hljs-keyword">await</span> Venus.venus.getVenusAccrued(<span class="hljs-string">&#x27;0x4Ddc2D193948926D02f9B1fE9e1daa0718270ED5&#x27;</span>); <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&#x27;Accrued&#x27;</span>, acc); })().catch(<span class="hljs-built_in">console</span>.error);</code></pre> </dd> </dl> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>_address: <span class="tsd-signature-type">string</span></h5> <div class="tsd-comment tsd-typography"> <p>The address in which to find the VENUS accrued.</p> </div> </li> <li> <h5><span class="tsd-flag ts-flagDefault value">Default value</span> _provider: <span class="tsd-signature-type">Provider</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> = &quot;mainnet&quot;</span></h5> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">&gt;</span></h4> <p>Returns a string of the numeric accruement of VENUS. The value is scaled up by 18 decimal places.</p> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-function tsd-parent-kind-module"> <a name="getvenusbalance" class="tsd-anchor"></a> <h3>get<wbr>Venus<wbr>Balance</h3> <ul class="tsd-signatures tsd-kind-function tsd-parent-kind-module"> <li class="tsd-signature tsd-kind-icon">get<wbr>Venus<wbr>Balance<span class="tsd-signature-symbol">(</span>_address<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, _provider<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Provider</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">&gt;</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/VenusProtocol/venus-js/blob/f412301/src/comp.ts#L73">comp.ts:73</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Get the balance of VENUS tokens held by an address.</p> </div> <dl class="tsd-comment-tags"> <dt>example</dt> <dd><pre><code>(<span class="hljs-keyword">async</span> <span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params"></span>) </span>{ <span class="hljs-keyword">const</span> bal = <span class="hljs-keyword">await</span> Venus.venus.getVenusBalance(<span class="hljs-string">&#x27;0x2775b1c75658Be0F640272CCb8c72ac986009e38&#x27;</span>); <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&#x27;Balance&#x27;</span>, bal); })().catch(<span class="hljs-built_in">console</span>.error);</code></pre> </dd> </dl> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>_address: <span class="tsd-signature-type">string</span></h5> <div class="tsd-comment tsd-typography"> <p>The address in which to find the VENUS balance.</p> </div> </li> <li> <h5><span class="tsd-flag ts-flagDefault value">Default value</span> _provider: <span class="tsd-signature-type">Provider</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> = &quot;mainnet&quot;</span></h5> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">&gt;</span></h4> <p>Returns a string of the numeric balance of VENUS. The value is scaled up by 18 decimal places.</p> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-function tsd-parent-kind-module"> <a name="mintvai" class="tsd-anchor"></a> <h3>mintVAI</h3> <ul class="tsd-signatures tsd-kind-function tsd-parent-kind-module"> <li class="tsd-signature tsd-kind-icon">mintVAI<span class="tsd-signature-symbol">(</span>mintVAIAmount<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">BigNumber</span>, options<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">CallOptions</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">TrxResponse</span><span class="tsd-signature-symbol">&gt;</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/VenusProtocol/venus-js/blob/f412301/src/comp.ts#L806">comp.ts:806</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Mint VAI in the Venus Protocol.</p> </div> <dl class="tsd-comment-tags"> <dt>example</dt> <dd><pre><code><span class="hljs-keyword">const</span> venus = <span class="hljs-keyword">new</span> Venus(<span class="hljs-built_in">window</span>.ethereum); <span class="hljs-comment">// const trxOptions = { gasLimit: 250000, mantissa: false };</span> (<span class="hljs-keyword">async</span> <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params"></span>) </span>{ <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&#x27;Minting VAI in the Venus Protocol...&#x27;</span>); <span class="hljs-keyword">const</span> trx = <span class="hljs-keyword">await</span> venus.mintVAI(<span class="hljs-number">1</span>); <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&#x27;Ethers.js transaction object&#x27;</span>, trx); })().catch(<span class="hljs-built_in">console</span>.error);</code></pre> </dd> </dl> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>mintVAIAmount: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">BigNumber</span></h5> <div class="tsd-comment tsd-typography"> <p>A string, number, or BigNumber object of the amount of an asset to mintVAI. Use the <code>mantissa</code> boolean in the <code>options</code> parameter to indicate if this value is scaled up (so there are no decimals) or in its natural scale.</p> </div> </li> <li> <h5><span class="tsd-flag ts-flagDefault value">Default value</span> options: <span class="tsd-signature-type">CallOptions</span><span class="tsd-signature-symbol"> = {}</span></h5> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">TrxResponse</span><span class="tsd-signature-symbol">&gt;</span></h4> <p>Returns an Ethers.js transaction object of the mintVAI transaction.</p> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-function tsd-parent-kind-module"> <a name="mintvaiguardianpaused" class="tsd-anchor"></a> <h3>mintVAIGuardian<wbr>Paused</h3> <ul class="tsd-signatures tsd-kind-function tsd-parent-kind-module"> <li class="tsd-signature tsd-kind-icon">mintVAIGuardian<wbr>Paused<span class="tsd-signature-symbol">(</span>options<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">CallOptions</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">&gt;</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/VenusProtocol/venus-js/blob/f412301/src/comp.ts#L546">comp.ts:546</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Get the mintVAIGuardianPaused.</p> </div> <dl class="tsd-comment-tags"> <dt>example</dt> <dd><pre><code><span class="hljs-keyword">const</span> venus = <span class="hljs-keyword">new</span> Venus(<span class="hljs-built_in">window</span>.ethereum); (<span class="hljs-keyword">async</span> () =&gt; { <span class="hljs-keyword">const</span> _mintVAIGuardianPaused = <span class="hljs-keyword">await</span> venus.mintVAIGuardianPaused(); <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&#x27;mintVAIGuardianPaused&#x27;</span>, _mintVAIGuardianPaused); })().<span class="hljs-keyword">catch</span>(<span class="hljs-built_in">console</span>.error);</code></pre> </dd> </dl> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5><span class="tsd-flag ts-flagDefault value">Default value</span> options: <span class="tsd-signature-type">CallOptions</span><span class="tsd-signature-symbol"> = {}</span></h5> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">&gt;</span></h4> <p>Returns a string of the boolean mintVAIGuardianPaused.</p> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-function tsd-parent-kind-module"> <a name="mintedvaiof" class="tsd-anchor"></a> <h3>mintedVAIOf</h3> <ul class="tsd-signatures tsd-kind-function tsd-parent-kind-module"> <li class="tsd-signature tsd-kind-icon">mintedVAIOf<span class="tsd-signature-symbol">(</span>_address<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, options<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">CallOptions</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">&gt;</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/VenusProtocol/venus-js/blob/f412301/src/comp.ts#L622">comp.ts:622</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Get the minted VAI amount of the address.</p> </div> <dl class="tsd-comment-tags"> <dt>example</dt> <dd><pre><code><span class="hljs-keyword">const</span> venus = <span class="hljs-keyword">new</span> Venus(<span class="hljs-built_in">window</span>.ethereum); (<span class="hljs-keyword">async</span> () =&gt; { <span class="hljs-keyword">const</span> amount = <span class="hljs-keyword">await</span> venus.mintedVAIOf(<span class="hljs-string">&#x27;0x4Ddc2D193948926D02f9B1fE9e1daa0718270ED5&#x27;</span>); <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&#x27;Minted VAI amount&#x27;</span>, amount); })().<span class="hljs-keyword">catch</span>(<span class="hljs-built_in">console</span>.error);</code></pre> </dd> </dl> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>_address: <span class="tsd-signature-type">string</span></h5> <div class="tsd-comment tsd-typography"> <p>The address in which to get the minted VAI amount.</p> </div> </li> <li> <h5><span class="tsd-flag ts-flagDefault value">Default value</span> options: <span class="tsd-signature-type">CallOptions</span><span class="tsd-signature-symbol"> = {}</span></h5> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">&gt;</span></h4> <p>Returns a string of the numeric amount of minted VAI. The value is scaled up by 18 decimal places.</p> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-function tsd-parent-kind-module"> <a name="mintedvais" class="tsd-anchor"></a> <h3>mintedVAIs</h3> <ul class="tsd-signatures tsd-kind-function tsd-parent-kind-module"> <li class="tsd-signature tsd-kind-icon">mintedVAIs<span class="tsd-signature-symbol">(</span>_address<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, options<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">CallOptions</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">&gt;</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/VenusProtocol/venus-js/blob/f412301/src/comp.ts#L675">comp.ts:675</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Get the minted VAI amount of the address.</p> </div> <dl class="tsd-comment-tags"> <dt>example</dt> <dd><pre><code><span class="hljs-keyword">const</span> venus = <span class="hljs-keyword">new</span> Venus(<span class="hljs-built_in">window</span>.ethereum); (<span class="hljs-keyword">async</span> () =&gt; { <span class="hljs-keyword">const</span> amount = <span class="hljs-keyword">await</span> venus.mintedVAIs(<span class="hljs-string">&#x27;0x4Ddc2D193948926D02f9B1fE9e1daa0718270ED5&#x27;</span>); <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&#x27;Minted VAI amount&#x27;</span>, amount); })().<span class="hljs-keyword">catch</span>(<span class="hljs-built_in">console</span>.error);</code></pre> </dd> </dl> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>_address: <span class="tsd-signature-type">string</span></h5> <div class="tsd-comment tsd-typography"> <p>The address in which to get the minted VAI amount.</p> </div> </li> <li> <h5><span class="tsd-flag ts-flagDefault value">Default value</span> options: <span class="tsd-signature-type">CallOptions</span><span class="tsd-signature-symbol"> = {}</span></h5> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">&gt;</span></h4> <p>Returns a string of the numeric amount of minted VAI. The value is scaled up by 18 decimal places.</p> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-function tsd-parent-kind-module"> <a name="repayvai" class="tsd-anchor"></a> <h3>repayVAI</h3> <ul class="tsd-signatures tsd-kind-function tsd-parent-kind-module"> <li class="tsd-signature tsd-kind-icon">repayVAI<span class="tsd-signature-symbol">(</span>repayVAIAmount<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">BigNumber</span>, options<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">CallOptions</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">TrxResponse</span><span class="tsd-signature-symbol">&gt;</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/VenusProtocol/venus-js/blob/f412301/src/comp.ts#L874">comp.ts:874</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Repay VAI in the Venus Protocol.</p> </div> <dl class="tsd-comment-tags"> <dt>example</dt> <dd><pre><code><span class="hljs-keyword">const</span> venus = <span class="hljs-keyword">new</span> Venus(<span class="hljs-built_in">window</span>.ethereum); <span class="hljs-comment">// const trxOptions = { gasLimit: 250000, mantissa: false };</span> (<span class="hljs-keyword">async</span> <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params"></span>) </span>{ <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&#x27;Repaying VAI in the Venus Protocol...&#x27;</span>); <span class="hljs-keyword">const</span> trx = <span class="hljs-keyword">await</span> venus.repayVAI(<span class="hljs-number">1</span>); <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&#x27;Ethers.js transaction object&#x27;</span>, trx); })().catch(<span class="hljs-built_in">console</span>.error);</code></pre> </dd> </dl> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>repayVAIAmount: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">BigNumber</span></h5> <div class="tsd-comment tsd-typography"> <p>A string, number, or BigNumber object of the amount of an asset to repay. Use the <code>mantissa</code> boolean in the <code>options</code> parameter to indicate if this value is scaled up (so there are no decimals) or in its natural scale.</p> </div> </li> <li> <h5><span class="tsd-flag ts-flagDefault value">Default value</span> options: <span class="tsd-signature-type">CallOptions</span><span class="tsd-signature-symbol"> = {}</span></h5> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">TrxResponse</span><span class="tsd-signature-symbol">&gt;</span></h4> <p>Returns an Ethers.js transaction object of the repayVAI transaction.</p> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-function tsd-parent-kind-module"> <a name="repayvaiguardianpaused" class="tsd-anchor"></a> <h3>repayVAIGuardian<wbr>Paused</h3> <ul class="tsd-signatures tsd-kind-function tsd-parent-kind-module"> <li class="tsd-signature tsd-kind-icon">repayVAIGuardian<wbr>Paused<span class="tsd-signature-symbol">(</span>options<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">CallOptions</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">&gt;</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/VenusProtocol/venus-js/blob/f412301/src/comp.ts#L583">comp.ts:583</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Get the repayVAIGuardianPaused.</p> </div> <dl class="tsd-comment-tags"> <dt>example</dt> <dd><pre><code><span class="hljs-keyword">const</span> venus = <span class="hljs-keyword">new</span> Venus(<span class="hljs-built_in">window</span>.ethereum); (<span class="hljs-keyword">async</span> () =&gt; { <span class="hljs-keyword">const</span> _repayVAIGuardianPaused = <span class="hljs-keyword">await</span> venus.repayVAIGuardianPaused(); <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&#x27;repayVAIGuardianPaused&#x27;</span>, _repayVAIGuardianPaused); })().<span class="hljs-keyword">catch</span>(<span class="hljs-built_in">console</span>.error);</code></pre> </dd> </dl> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5><span class="tsd-flag ts-flagDefault value">Default value</span> options: <span class="tsd-signature-type">CallOptions</span><span class="tsd-signature-symbol"> = {}</span></h5> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">&gt;</span></h4> <p>Returns a string of the boolean repayVAIGuardianPaused.</p> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-function tsd-parent-kind-module tsd-is-not-exported"> <a name="tochecksumaddress" class="tsd-anchor"></a> <h3>to<wbr>Checksum<wbr>Address</h3> <ul class="tsd-signatures tsd-kind-function tsd-parent-kind-module tsd-is-not-exported"> <li class="tsd-signatu