mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-08 14:55:49 +00:00
133 lines
62 KiB
HTML
133 lines
62 KiB
HTML
<!DOCTYPE html><html class="default"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>Wallet | xrpl</title><meta name="description" content="Documentation for xrpl"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script async src="../assets/search.js" id="search-script"></script></head><body><script>document.body.classList.add(localStorage.getItem("tsd-theme") || "os")</script><header><div class="tsd-page-toolbar"><div class="container"><div class="table-wrap"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget search no-caption">Search</label><input type="text" id="tsd-search-field"/></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">xrpl</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-externals" checked/><label class="tsd-widget" for="tsd-filter-externals">Externals</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="../modules.html">xrpl</a></li><li><a href="Wallet.html">Wallet</a></li></ul><h1>Class Wallet </h1></div></div></header><div class="container container-main"><div class="row"><div class="col-8 col-content"><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><div class="lead">
|
|
<p>A utility for deriving a wallet composed of a keypair (publicKey/privateKey).
|
|
A wallet can be derived from either a seed, mnemonic, or entropy (array of random numbers).
|
|
It provides functionality to sign/verify transactions offline.</p>
|
|
</div><dl class="tsd-comment-tags"><dt>example</dt><dd><pre><code class="language-typescript"><span class="hl-5">// Derive a wallet from a bip39 Mnemonic</span><br/><span class="hl-0">const</span><span class="hl-1"> </span><span class="hl-2">wallet</span><span class="hl-1"> = </span><span class="hl-4">Wallet</span><span class="hl-1">.</span><span class="hl-3">fromMnemonic</span><span class="hl-1">(</span><br/><span class="hl-1"> </span><span class="hl-7">'jewel insect retreat jump claim horse second chef west gossip bone frown exotic embark laundry'</span><br/><span class="hl-1">)</span><br/><span class="hl-4">console</span><span class="hl-1">.</span><span class="hl-3">log</span><span class="hl-1">(</span><span class="hl-4">wallet</span><span class="hl-1">)</span><br/><span class="hl-5">// Wallet {</span><br/><span class="hl-5">// publicKey: '02348F89E9A6A3615BA317F8474A3F51D66221562D3CA32BFA8D21348FF67012B2',</span><br/><span class="hl-5">// privateKey: '00A8F2E77FC0E05890C1B5088AFE0ECF9D96466A4419B897B1AB383E336E1735A2',</span><br/><span class="hl-5">// classicAddress: 'rwZiksrExmVkR64pf87Jor4cYbmff47SUm',</span><br/><span class="hl-5">// seed: undefined</span><br/><span class="hl-5">// }.</span><br/><br/><span class="hl-5">// Derive a wallet from a base58 encoded seed.</span><br/><span class="hl-0">const</span><span class="hl-1"> </span><span class="hl-2">seedWallet</span><span class="hl-1"> = </span><span class="hl-4">Wallet</span><span class="hl-1">.</span><span class="hl-3">fromSeed</span><span class="hl-1">(</span><span class="hl-7">'ssZkdwURFMBXenJPbrpE14b6noJSu'</span><span class="hl-1">)</span><br/><span class="hl-4">console</span><span class="hl-1">.</span><span class="hl-3">log</span><span class="hl-1">(</span><span class="hl-4">seedWallet</span><span class="hl-1">)</span><br/><span class="hl-5">// Wallet {</span><br/><span class="hl-5">// publicKey: '02FE9932A9C4AA2AC9F0ED0F2B89302DE7C2C95F91D782DA3CF06E64E1C1216449',</span><br/><span class="hl-5">// privateKey: '00445D0A16DD05EFAF6D5AF45E6B8A6DE4170D93C0627021A0B8E705786CBCCFF7',</span><br/><span class="hl-5">// classicAddress: 'rG88FVLjvYiQaGftSa1cKuE2qNx7aK5ivo',</span><br/><span class="hl-5">// seed: 'ssZkdwURFMBXenJPbrpE14b6noJSu'</span><br/><span class="hl-5">// }.</span><br/><br/><span class="hl-5">// Sign a JSON Transaction</span><br/><span class="hl-1"> </span><span class="hl-0">const</span><span class="hl-1"> </span><span class="hl-2">signed</span><span class="hl-1"> = </span><span class="hl-4">seedWallet</span><span class="hl-1">.</span><span class="hl-3">signTransaction</span><span class="hl-1">({</span><br/><span class="hl-1"> </span><span class="hl-4">TransactionType:</span><span class="hl-1"> </span><span class="hl-7">'Payment'</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">Account:</span><span class="hl-1"> </span><span class="hl-7">'rG88FVLjvYiQaGftSa1cKuE2qNx7aK5ivo'</span><br/><span class="hl-1"> ...........</span><br/><span class="hl-1">}).</span><br/><br/><span class="hl-4">console</span><span class="hl-1">.</span><span class="hl-3">log</span><span class="hl-1">(</span><span class="hl-4">signed</span><span class="hl-1">)</span><br/><span class="hl-5">// '1200007321......B01BE1DFF3'.</span><br/><span class="hl-4">console</span><span class="hl-1">.</span><span class="hl-3">log</span><span class="hl-1">(</span><span class="hl-3">decode</span><span class="hl-1">(</span><span class="hl-4">signed</span><span class="hl-1">))</span><br/><span class="hl-5">// {</span><br/><span class="hl-5">// TransactionType: 'Payment',</span><br/><span class="hl-5">// SigningPubKey: '02FE9932A9C4AA2AC9F0ED0F2B89302DE7C2C95F91D782DA3CF06E64E1C1216449',</span><br/><span class="hl-5">// TxnSignature: '3045022100AAD......5B631ABD21171B61B07D304',</span><br/><span class="hl-5">// Account: 'rG88FVLjvYiQaGftSa1cKuE2qNx7aK5ivo'</span><br/><span class="hl-5">// ...........</span><br/><span class="hl-5">// }</span>
|
|
</code></pre>
|
|
</dd></dl></div></section><section class="tsd-panel tsd-hierarchy"><h3>Hierarchy</h3><ul class="tsd-hierarchy"><li><span class="target">Wallet</span></li></ul></section><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>Constructors</h3><ul class="tsd-index-list"><li class="tsd-kind-constructor tsd-parent-kind-class"><a href="Wallet.html#constructor" class="tsd-kind-icon">constructor</a></li></ul></section><section class="tsd-index-section "><h3>Properties</h3><ul class="tsd-index-list"><li class="tsd-kind-property tsd-parent-kind-class"><a href="Wallet.html#classicAddress" class="tsd-kind-icon">classic<wbr/>Address</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="Wallet.html#privateKey" class="tsd-kind-icon">private<wbr/>Key</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="Wallet.html#publicKey" class="tsd-kind-icon">public<wbr/>Key</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="Wallet.html#seed" class="tsd-kind-icon">seed</a></li><li class="tsd-kind-property tsd-parent-kind-class tsd-is-static"><a href="Wallet.html#fromSecret" class="tsd-kind-icon">from<wbr/>Secret</a></li></ul></section><section class="tsd-index-section "><h3>Accessors</h3><ul class="tsd-index-list"><li class="tsd-kind-get-signature tsd-parent-kind-class"><a href="Wallet.html#address" class="tsd-kind-icon">address</a></li></ul></section><section class="tsd-index-section "><h3>Methods</h3><ul class="tsd-index-list"><li class="tsd-kind-method tsd-parent-kind-class tsd-is-private"><a href="Wallet.html#checkTxSerialization" class="tsd-kind-icon">check<wbr/>Tx<wbr/>Serialization</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Wallet.html#getXAddress" class="tsd-kind-icon">getXAddress</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Wallet.html#sign" class="tsd-kind-icon">sign</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Wallet.html#verifyTransaction" class="tsd-kind-icon">verify<wbr/>Transaction</a></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-private tsd-is-static"><a href="Wallet.html#deriveWallet" class="tsd-kind-icon">derive<wbr/>Wallet</a></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="Wallet.html#fromEntropy" class="tsd-kind-icon">from<wbr/>Entropy</a></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="Wallet.html#fromMnemonic" class="tsd-kind-icon">from<wbr/>Mnemonic</a></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-private tsd-is-static"><a href="Wallet.html#fromRFC1751Mnemonic" class="tsd-kind-icon">fromRFC1751<wbr/>Mnemonic</a></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="Wallet.html#fromSeed" class="tsd-kind-icon">from<wbr/>Seed</a></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="Wallet.html#generate" class="tsd-kind-icon">generate</a></li></ul></section></div></section></section><section class="tsd-panel-group tsd-member-group "><h2>Constructors</h2><section class="tsd-panel tsd-member tsd-kind-constructor tsd-parent-kind-class"><a id="constructor" class="tsd-anchor"></a><h3 class="tsd-anchor-link">constructor<a href="#constructor" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><ul class="tsd-signatures tsd-kind-constructor tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon">new <wbr/>Wallet<span class="tsd-signature-symbol">(</span>publicKey<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, privateKey<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, opts<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-symbol">{ </span>masterAddress<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span>seed<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-symbol">: </span><a href="Wallet.html" class="tsd-signature-type" data-tsd-kind="Class">Wallet</a></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/XRPLF/xrpl.js/blob/0f132744/packages/xrpl/src/Wallet/index.ts#L116">packages/xrpl/src/Wallet/index.ts:116</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
|
<p>Creates a new Wallet.</p>
|
|
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>publicKey: <span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
|
|
<p>The public key for the account.</p>
|
|
</div></div></li><li><h5>privateKey: <span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
|
|
<p>The private key used for signing transactions for the account.</p>
|
|
</div></div></li><li><h5>opts: <span class="tsd-signature-symbol">{ </span>masterAddress<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span>seed<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></h5><div class="tsd-comment tsd-typography"><div class="lead">
|
|
<p>(Optional) Options to initialize a Wallet.</p>
|
|
</div></div><ul class="tsd-parameters"><li class="tsd-parameter"><h5><span class="tsd-flag ts-flagOptional">Optional</span> master<wbr/>Address<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
|
|
<p>Include if a Wallet uses a Regular Key Pair. It must be the master address of the account.</p>
|
|
</div></div></li><li class="tsd-parameter"><h5><span class="tsd-flag ts-flagOptional">Optional</span> seed<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
|
|
<p>The seed used to derive the account keys.</p>
|
|
</div></div></li></ul></li></ul><h4 class="tsd-returns-title">Returns <a href="Wallet.html" class="tsd-signature-type" data-tsd-kind="Class">Wallet</a></h4></li></ul></section></section><section class="tsd-panel-group tsd-member-group "><h2>Properties</h2><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a id="classicAddress" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span class="tsd-flag ts-flagReadonly">Readonly</span> classic<wbr/>Address<a href="#classicAddress" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><div class="tsd-signature tsd-kind-icon">classic<wbr/>Address<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/XRPLF/xrpl.js/blob/0f132744/packages/xrpl/src/Wallet/index.ts#L95">packages/xrpl/src/Wallet/index.ts:95</a></li></ul></aside></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a id="privateKey" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span class="tsd-flag ts-flagReadonly">Readonly</span> private<wbr/>Key<a href="#privateKey" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><div class="tsd-signature tsd-kind-icon">private<wbr/>Key<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/XRPLF/xrpl.js/blob/0f132744/packages/xrpl/src/Wallet/index.ts#L94">packages/xrpl/src/Wallet/index.ts:94</a></li></ul></aside></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a id="publicKey" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span class="tsd-flag ts-flagReadonly">Readonly</span> public<wbr/>Key<a href="#publicKey" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><div class="tsd-signature tsd-kind-icon">public<wbr/>Key<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/XRPLF/xrpl.js/blob/0f132744/packages/xrpl/src/Wallet/index.ts#L93">packages/xrpl/src/Wallet/index.ts:93</a></li></ul></aside></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a id="seed" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span class="tsd-flag ts-flagOptional">Optional</span> <span class="tsd-flag ts-flagReadonly">Readonly</span> seed<a href="#seed" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><div class="tsd-signature tsd-kind-icon">seed<span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">string</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/XRPLF/xrpl.js/blob/0f132744/packages/xrpl/src/Wallet/index.ts#L96">packages/xrpl/src/Wallet/index.ts:96</a></li></ul></aside></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-static"><a id="fromSecret" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span class="tsd-flag ts-flagStatic">Static</span> from<wbr/>Secret<a href="#fromSecret" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><div class="tsd-signature tsd-kind-icon">from<wbr/>Secret<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">(</span>seed<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, opts<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-symbol">{ </span>algorithm<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">ECDSA</span><span class="tsd-signature-symbol">; </span>masterAddress<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-symbol"> => </span><a href="Wallet.html" class="tsd-signature-type" data-tsd-kind="Class">Wallet</a><span class="tsd-signature-symbol"> = Wallet.fromSeed</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/XRPLF/xrpl.js/blob/0f132744/packages/xrpl/src/Wallet/index.ts#L172">packages/xrpl/src/Wallet/index.ts:172</a></li></ul></aside><div class="tsd-type-declaration"><h4>Type declaration</h4><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures tsd-kind-type-literal tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon"><span class="tsd-signature-symbol">(</span>seed<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, opts<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-symbol">{ </span>algorithm<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">ECDSA</span><span class="tsd-signature-symbol">; </span>masterAddress<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-symbol">: </span><a href="Wallet.html" class="tsd-signature-type" data-tsd-kind="Class">Wallet</a></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead">
|
|
<p>Derives a wallet from a seed.</p>
|
|
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>seed: <span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
|
|
<p>A string used to generate a keypair (publicKey/privateKey) to derive a wallet.</p>
|
|
</div></div></li><li><h5>opts: <span class="tsd-signature-symbol">{ </span>algorithm<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">ECDSA</span><span class="tsd-signature-symbol">; </span>masterAddress<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></h5><div class="tsd-comment tsd-typography"><div class="lead">
|
|
<p>(Optional) Options to derive a Wallet.</p>
|
|
</div></div><ul class="tsd-parameters"><li class="tsd-parameter"><h5><span class="tsd-flag ts-flagOptional">Optional</span> algorithm<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">ECDSA</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
|
|
<p>The digital signature algorithm to generate an address for.</p>
|
|
</div></div></li><li class="tsd-parameter"><h5><span class="tsd-flag ts-flagOptional">Optional</span> master<wbr/>Address<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
|
|
<p>Include if a Wallet uses a Regular Key Pair. It must be the master address of the account.</p>
|
|
</div></div></li></ul></li></ul><h4 class="tsd-returns-title">Returns <a href="Wallet.html" class="tsd-signature-type" data-tsd-kind="Class">Wallet</a></h4><div><p>A Wallet derived from a seed.</p>
|
|
</div></li></ul></li></ul></div></section></section><section class="tsd-panel-group tsd-member-group "><h2>Accessors</h2><section class="tsd-panel tsd-member tsd-kind-get-signature tsd-parent-kind-class"><a id="address" class="tsd-anchor"></a><h3 class="tsd-anchor-link">address<a href="#address" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><ul class="tsd-signatures tsd-kind-get-signature tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon"><span class="tsd-signature-symbol">get</span> address<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/XRPLF/xrpl.js/blob/0f132744/packages/xrpl/src/Wallet/index.ts#L103">packages/xrpl/src/Wallet/index.ts:103</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
|
<p>Alias for wallet.classicAddress.</p>
|
|
</div></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4><div><p>The wallet's classic address.</p>
|
|
</div></li></ul></section></section><section class="tsd-panel-group tsd-member-group "><h2>Methods</h2><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-private"><a id="checkTxSerialization" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span class="tsd-flag ts-flagPrivate">Private</span> check<wbr/>Tx<wbr/>Serialization<a href="#checkTxSerialization" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-private"><li class="tsd-signature tsd-kind-icon">check<wbr/>Tx<wbr/>Serialization<span class="tsd-signature-symbol">(</span>serialized<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, tx<span class="tsd-signature-symbol">: </span><a href="../modules.html#Transaction" class="tsd-signature-type" data-tsd-kind="Type alias">Transaction</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/XRPLF/xrpl.js/blob/0f132744/packages/xrpl/src/Wallet/index.ts#L397">packages/xrpl/src/Wallet/index.ts:397</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
|
<p> Decode a serialized transaction, remove the fields that are added during the signing process,
|
|
and verify that it matches the transaction prior to signing. This gives the user a sanity check
|
|
to ensure that what they try to encode matches the message that will be recieved by rippled.</p>
|
|
</div><dl class="tsd-comment-tags"><dt>throws</dt><dd><p>A ValidationError if the transaction does not have a TxnSignature/Signers property, or if
|
|
the serialized Transaction desn't match the original transaction.</p>
|
|
</dd></dl></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>serialized: <span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
|
|
<p>A signed and serialized transaction.</p>
|
|
</div></div></li><li><h5>tx: <a href="../modules.html#Transaction" class="tsd-signature-type" data-tsd-kind="Type alias">Transaction</a></h5><div class="tsd-comment tsd-typography"><div class="lead">
|
|
<p>The transaction prior to signing.</p>
|
|
</div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a id="getXAddress" class="tsd-anchor"></a><h3 class="tsd-anchor-link">getXAddress<a href="#getXAddress" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon">getXAddress<span class="tsd-signature-symbol">(</span>tag<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">false</span>, isTestnet<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/XRPLF/xrpl.js/blob/0f132744/packages/xrpl/src/Wallet/index.ts#L382">packages/xrpl/src/Wallet/index.ts:382</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
|
<p>Gets an X-address in Testnet/Mainnet format.</p>
|
|
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>tag: <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">false</span><span class="tsd-signature-symbol"> = false</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
|
|
<p>A tag to be included within the X-address.</p>
|
|
</div></div></li><li><h5>isTestnet: <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> = false</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
|
|
<p>A boolean to indicate if X-address should be in Testnet (true) or Mainnet (false) format.</p>
|
|
</div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4><div><p>An X-address.</p>
|
|
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a id="sign" class="tsd-anchor"></a><h3 class="tsd-anchor-link">sign<a href="#sign" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon">sign<span class="tsd-signature-symbol">(</span>this<span class="tsd-signature-symbol">: </span><a href="Wallet.html" class="tsd-signature-type" data-tsd-kind="Class">Wallet</a>, transaction<span class="tsd-signature-symbol">: </span><a href="../modules.html#Transaction" class="tsd-signature-type" data-tsd-kind="Type alias">Transaction</a>, multisign<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">{ </span>hash<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span>tx_blob<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> }</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/XRPLF/xrpl.js/blob/0f132744/packages/xrpl/src/Wallet/index.ts#L308">packages/xrpl/src/Wallet/index.ts:308</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
|
<p>Signs a transaction offline.</p>
|
|
</div><dl class="tsd-comment-tags"><dt>throws</dt><dd><p>ValidationError if the transaction is already signed or does not encode/decode to same result.</p>
|
|
</dd></dl></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>this: <a href="Wallet.html" class="tsd-signature-type" data-tsd-kind="Class">Wallet</a></h5><div class="tsd-comment tsd-typography"><div class="lead">
|
|
<p>Wallet instance.</p>
|
|
</div></div></li><li><h5>transaction: <a href="../modules.html#Transaction" class="tsd-signature-type" data-tsd-kind="Type alias">Transaction</a></h5><div class="tsd-comment tsd-typography"><div class="lead">
|
|
<p>A transaction to be signed offline.</p>
|
|
</div></div></li><li><h5><span class="tsd-flag ts-flagOptional">Optional</span> multisign: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">boolean</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
|
|
<p>Specify true/false to use multisign or actual address (classic/x-address) to make multisign tx request.</p>
|
|
</div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-symbol">{ </span>hash<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span>tx_blob<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> }</span></h4><div><p>A signed transaction.</p>
|
|
</div><ul class="tsd-parameters"><li class="tsd-parameter"><h5>hash<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></h5></li><li class="tsd-parameter"><h5>tx_<wbr/>blob<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></h5></li></ul></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a id="verifyTransaction" class="tsd-anchor"></a><h3 class="tsd-anchor-link">verify<wbr/>Transaction<a href="#verifyTransaction" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon">verify<wbr/>Transaction<span class="tsd-signature-symbol">(</span>signedTransaction<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">boolean</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/XRPLF/xrpl.js/blob/0f132744/packages/xrpl/src/Wallet/index.ts#L368">packages/xrpl/src/Wallet/index.ts:368</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
|
<p>Verifies a signed transaction offline.</p>
|
|
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>signedTransaction: <span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
|
|
<p>A signed transaction (hex string of signTransaction result) to be verified offline.</p>
|
|
</div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4><div><p>Returns true if a signedTransaction is valid.</p>
|
|
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-private tsd-is-static"><a id="deriveWallet" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span class="tsd-flag ts-flagStatic">Static</span> <span class="tsd-flag ts-flagPrivate">Private</span> derive<wbr/>Wallet<a href="#deriveWallet" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-private tsd-is-static"><li class="tsd-signature tsd-kind-icon">derive<wbr/>Wallet<span class="tsd-signature-symbol">(</span>seed<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, opts<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-symbol">{ </span>algorithm<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">ECDSA</span><span class="tsd-signature-symbol">; </span>masterAddress<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-symbol">: </span><a href="Wallet.html" class="tsd-signature-type" data-tsd-kind="Class">Wallet</a></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/XRPLF/xrpl.js/blob/0f132744/packages/xrpl/src/Wallet/index.ts#L285">packages/xrpl/src/Wallet/index.ts:285</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
|
<p>Derive a Wallet from a seed.</p>
|
|
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>seed: <span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
|
|
<p>The seed used to derive the wallet.</p>
|
|
</div></div></li><li><h5>opts: <span class="tsd-signature-symbol">{ </span>algorithm<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">ECDSA</span><span class="tsd-signature-symbol">; </span>masterAddress<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></h5><div class="tsd-comment tsd-typography"><div class="lead">
|
|
<p>(Optional) Options to derive a Wallet.</p>
|
|
</div></div><ul class="tsd-parameters"><li class="tsd-parameter"><h5><span class="tsd-flag ts-flagOptional">Optional</span> algorithm<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">ECDSA</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
|
|
<p>The digital signature algorithm to generate an address for.</p>
|
|
</div></div></li><li class="tsd-parameter"><h5><span class="tsd-flag ts-flagOptional">Optional</span> master<wbr/>Address<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
|
|
<p>Include if a Wallet uses a Regular Key Pair. It must be the master address of the account.</p>
|
|
</div></div></li></ul></li></ul><h4 class="tsd-returns-title">Returns <a href="Wallet.html" class="tsd-signature-type" data-tsd-kind="Class">Wallet</a></h4><div><p>A Wallet derived from the seed.</p>
|
|
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-static"><a id="fromEntropy" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span class="tsd-flag ts-flagStatic">Static</span> from<wbr/>Entropy<a href="#fromEntropy" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-static"><li class="tsd-signature tsd-kind-icon">from<wbr/>Entropy<span class="tsd-signature-symbol">(</span>entropy<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Uint8Array</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span>, opts<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-symbol">{ </span>algorithm<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">ECDSA</span><span class="tsd-signature-symbol">; </span>masterAddress<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-symbol">: </span><a href="Wallet.html" class="tsd-signature-type" data-tsd-kind="Class">Wallet</a></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/XRPLF/xrpl.js/blob/0f132744/packages/xrpl/src/Wallet/index.ts#L183">packages/xrpl/src/Wallet/index.ts:183</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
|
<p>Derives a wallet from an entropy (array of random numbers).</p>
|
|
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>entropy: <span class="tsd-signature-type">Uint8Array</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
|
|
<p>An array of random numbers to generate a seed used to derive a wallet.</p>
|
|
</div></div></li><li><h5>opts: <span class="tsd-signature-symbol">{ </span>algorithm<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">ECDSA</span><span class="tsd-signature-symbol">; </span>masterAddress<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></h5><div class="tsd-comment tsd-typography"><div class="lead">
|
|
<p>(Optional) Options to derive a Wallet.</p>
|
|
</div></div><ul class="tsd-parameters"><li class="tsd-parameter"><h5><span class="tsd-flag ts-flagOptional">Optional</span> algorithm<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">ECDSA</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
|
|
<p>The digital signature algorithm to generate an address for.</p>
|
|
</div></div></li><li class="tsd-parameter"><h5><span class="tsd-flag ts-flagOptional">Optional</span> master<wbr/>Address<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
|
|
<p>Include if a Wallet uses a Regular Key Pair. It must be the master address of the account.</p>
|
|
</div></div></li></ul></li></ul><h4 class="tsd-returns-title">Returns <a href="Wallet.html" class="tsd-signature-type" data-tsd-kind="Class">Wallet</a></h4><div><p>A Wallet derived from an entropy.</p>
|
|
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-static"><a id="fromMnemonic" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span class="tsd-flag ts-flagStatic">Static</span> from<wbr/>Mnemonic<a href="#fromMnemonic" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-static"><li class="tsd-signature tsd-kind-icon">from<wbr/>Mnemonic<span class="tsd-signature-symbol">(</span>mnemonic<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, opts<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-symbol">{ </span>algorithm<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">ECDSA</span><span class="tsd-signature-symbol">; </span>derivationPath<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span>masterAddress<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span>mnemonicEncoding<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">"bip39"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"rfc1751"</span><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="Wallet.html" class="tsd-signature-type" data-tsd-kind="Class">Wallet</a></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/XRPLF/xrpl.js/blob/0f132744/packages/xrpl/src/Wallet/index.ts#L214">packages/xrpl/src/Wallet/index.ts:214</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
|
<p>Derives a wallet from a bip39 or RFC1751 mnemonic (Defaults to bip39).</p>
|
|
</div><dl class="tsd-comment-tags"><dt>throws</dt><dd><p>ValidationError if unable to derive private key from mnemonic input.</p>
|
|
</dd></dl></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>mnemonic: <span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
|
|
<p>A string consisting of words (whitespace delimited) used to derive a wallet.</p>
|
|
</div></div></li><li><h5>opts: <span class="tsd-signature-symbol">{ </span>algorithm<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">ECDSA</span><span class="tsd-signature-symbol">; </span>derivationPath<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span>masterAddress<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span>mnemonicEncoding<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">"bip39"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"rfc1751"</span><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol"> = {}</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
|
|
<p>(Optional) Options to derive a Wallet.</p>
|
|
</div></div><ul class="tsd-parameters"><li class="tsd-parameter"><h5><span class="tsd-flag ts-flagOptional">Optional</span> algorithm<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">ECDSA</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
|
|
<p>Only used if opts.mnemonicEncoding is 'rfc1751'. Allows the mnemonic to generate its
|
|
secp256k1 seed, or its ed25519 seed. By default, it will generate the secp256k1 seed
|
|
to match the rippled <code>wallet_propose</code> default algorithm.</p>
|
|
</div></div></li><li class="tsd-parameter"><h5><span class="tsd-flag ts-flagOptional">Optional</span> derivation<wbr/>Path<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
|
|
<p>The path to derive a keypair (publicKey/privateKey). Only used for bip39 conversions.</p>
|
|
</div></div></li><li class="tsd-parameter"><h5><span class="tsd-flag ts-flagOptional">Optional</span> master<wbr/>Address<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
|
|
<p>Include if a Wallet uses a Regular Key Pair. It must be the master address of the account.</p>
|
|
</div></div></li><li class="tsd-parameter"><h5><span class="tsd-flag ts-flagOptional">Optional</span> mnemonic<wbr/>Encoding<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">"bip39"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"rfc1751"</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
|
|
<p>If set to 'rfc1751', this interprets the mnemonic as a rippled RFC1751 mnemonic like
|
|
<code>wallet_propose</code> generates in rippled. Otherwise the function defaults to bip39 decoding.</p>
|
|
</div></div></li></ul></li></ul><h4 class="tsd-returns-title">Returns <a href="Wallet.html" class="tsd-signature-type" data-tsd-kind="Class">Wallet</a></h4><div><p>A Wallet derived from a mnemonic.</p>
|
|
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-private tsd-is-static"><a id="fromRFC1751Mnemonic" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span class="tsd-flag ts-flagStatic">Static</span> <span class="tsd-flag ts-flagPrivate">Private</span> fromRFC1751<wbr/>Mnemonic<a href="#fromRFC1751Mnemonic" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-private tsd-is-static"><li class="tsd-signature tsd-kind-icon">fromRFC1751<wbr/>Mnemonic<span class="tsd-signature-symbol">(</span>mnemonic<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, opts<span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">{ </span>algorithm<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">ECDSA</span><span class="tsd-signature-symbol">; </span>masterAddress<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-symbol">: </span><a href="Wallet.html" class="tsd-signature-type" data-tsd-kind="Class">Wallet</a></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/XRPLF/xrpl.js/blob/0f132744/packages/xrpl/src/Wallet/index.ts#L257">packages/xrpl/src/Wallet/index.ts:257</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
|
<p>Derives a wallet from a RFC1751 mnemonic, which is how <code>wallet_propose</code> encodes mnemonics.</p>
|
|
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>mnemonic: <span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
|
|
<p>A string consisting of words (whitespace delimited) used to derive a wallet.</p>
|
|
</div></div></li><li><h5>opts: <span class="tsd-signature-symbol">{ </span>algorithm<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">ECDSA</span><span class="tsd-signature-symbol">; </span>masterAddress<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> }</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
|
|
<p>(Optional) Options to derive a Wallet.</p>
|
|
</div></div><ul class="tsd-parameters"><li class="tsd-parameter"><h5><span class="tsd-flag ts-flagOptional">Optional</span> algorithm<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">ECDSA</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
|
|
<p>The digital signature algorithm to generate an address for.</p>
|
|
</div></div></li><li class="tsd-parameter"><h5><span class="tsd-flag ts-flagOptional">Optional</span> master<wbr/>Address<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
|
|
<p>Include if a Wallet uses a Regular Key Pair. It must be the master address of the account.</p>
|
|
</div></div></li></ul></li></ul><h4 class="tsd-returns-title">Returns <a href="Wallet.html" class="tsd-signature-type" data-tsd-kind="Class">Wallet</a></h4><div><p>A Wallet derived from a mnemonic.</p>
|
|
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-static"><a id="fromSeed" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span class="tsd-flag ts-flagStatic">Static</span> from<wbr/>Seed<a href="#fromSeed" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-static"><li class="tsd-signature tsd-kind-icon">from<wbr/>Seed<span class="tsd-signature-symbol">(</span>seed<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, opts<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-symbol">{ </span>algorithm<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">ECDSA</span><span class="tsd-signature-symbol">; </span>masterAddress<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-symbol">: </span><a href="Wallet.html" class="tsd-signature-type" data-tsd-kind="Class">Wallet</a></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/XRPLF/xrpl.js/blob/0f132744/packages/xrpl/src/Wallet/index.ts#L152">packages/xrpl/src/Wallet/index.ts:152</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
|
<p>Derives a wallet from a seed.</p>
|
|
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>seed: <span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
|
|
<p>A string used to generate a keypair (publicKey/privateKey) to derive a wallet.</p>
|
|
</div></div></li><li><h5>opts: <span class="tsd-signature-symbol">{ </span>algorithm<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">ECDSA</span><span class="tsd-signature-symbol">; </span>masterAddress<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></h5><div class="tsd-comment tsd-typography"><div class="lead">
|
|
<p>(Optional) Options to derive a Wallet.</p>
|
|
</div></div><ul class="tsd-parameters"><li class="tsd-parameter"><h5><span class="tsd-flag ts-flagOptional">Optional</span> algorithm<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">ECDSA</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
|
|
<p>The digital signature algorithm to generate an address for.</p>
|
|
</div></div></li><li class="tsd-parameter"><h5><span class="tsd-flag ts-flagOptional">Optional</span> master<wbr/>Address<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
|
|
<p>Include if a Wallet uses a Regular Key Pair. It must be the master address of the account.</p>
|
|
</div></div></li></ul></li></ul><h4 class="tsd-returns-title">Returns <a href="Wallet.html" class="tsd-signature-type" data-tsd-kind="Class">Wallet</a></h4><div><p>A Wallet derived from a seed.</p>
|
|
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-static"><a id="generate" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span class="tsd-flag ts-flagStatic">Static</span> generate<a href="#generate" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-static"><li class="tsd-signature tsd-kind-icon">generate<span class="tsd-signature-symbol">(</span>algorithm<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">ECDSA</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="Wallet.html" class="tsd-signature-type" data-tsd-kind="Class">Wallet</a></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/XRPLF/xrpl.js/blob/0f132744/packages/xrpl/src/Wallet/index.ts#L138">packages/xrpl/src/Wallet/index.ts:138</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
|
<p>Generates a new Wallet using a generated seed.</p>
|
|
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>algorithm: <span class="tsd-signature-type">ECDSA</span><span class="tsd-signature-symbol"> = DEFAULT_ALGORITHM</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
|
|
<p>The digital signature algorithm to generate an address for.</p>
|
|
</div></div></li></ul><h4 class="tsd-returns-title">Returns <a href="Wallet.html" class="tsd-signature-type" data-tsd-kind="Class">Wallet</a></h4><div><p>A new Wallet derived from a generated seed.</p>
|
|
</div></li></ul></section></section></div><div class="col-4 col-menu menu-sticky-wrap menu-highlight"><nav class="tsd-navigation primary"><ul><li class=""><a href="../modules.html">Exports</a></li><li class=" tsd-kind-namespace"><a href="../modules/LedgerEntry.html">Ledger<wbr/>Entry</a></li></ul></nav><nav class="tsd-navigation secondary menu-sticky"><ul><li class="current tsd-kind-class"><a href="Wallet.html" class="tsd-kind-icon">Wallet</a><ul><li class="tsd-kind-constructor tsd-parent-kind-class"><a href="Wallet.html#constructor" class="tsd-kind-icon">constructor</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="Wallet.html#classicAddress" class="tsd-kind-icon">classic<wbr/>Address</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="Wallet.html#privateKey" class="tsd-kind-icon">private<wbr/>Key</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="Wallet.html#publicKey" class="tsd-kind-icon">public<wbr/>Key</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="Wallet.html#seed" class="tsd-kind-icon">seed</a></li><li class="tsd-kind-property tsd-parent-kind-class tsd-is-static"><a href="Wallet.html#fromSecret" class="tsd-kind-icon">from<wbr/>Secret</a></li><li class="tsd-kind-get-signature tsd-parent-kind-class"><a href="Wallet.html#address" class="tsd-kind-icon">address</a></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-private"><a href="Wallet.html#checkTxSerialization" class="tsd-kind-icon">check<wbr/>Tx<wbr/>Serialization</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Wallet.html#getXAddress" class="tsd-kind-icon">getXAddress</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Wallet.html#sign" class="tsd-kind-icon">sign</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="Wallet.html#verifyTransaction" class="tsd-kind-icon">verify<wbr/>Transaction</a></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-private tsd-is-static"><a href="Wallet.html#deriveWallet" class="tsd-kind-icon">derive<wbr/>Wallet</a></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="Wallet.html#fromEntropy" class="tsd-kind-icon">from<wbr/>Entropy</a></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="Wallet.html#fromMnemonic" class="tsd-kind-icon">from<wbr/>Mnemonic</a></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-private tsd-is-static"><a href="Wallet.html#fromRFC1751Mnemonic" class="tsd-kind-icon">fromRFC1751<wbr/>Mnemonic</a></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="Wallet.html#fromSeed" class="tsd-kind-icon">from<wbr/>Seed</a></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="Wallet.html#generate" class="tsd-kind-icon">generate</a></li></ul></li></ul></nav></div></div></div><footer class="with-border-bottom"><div class="container"><h2>Legend</h2><div class="tsd-legend-group"><ul class="tsd-legend"><li class="tsd-kind-constructor tsd-parent-kind-class"><span class="tsd-kind-icon">Constructor</span></li><li class="tsd-kind-property tsd-parent-kind-class"><span class="tsd-kind-icon">Property</span></li><li class="tsd-kind-method tsd-parent-kind-class"><span class="tsd-kind-icon">Method</span></li></ul><ul class="tsd-legend"><li class="tsd-kind-constructor tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited constructor</span></li><li class="tsd-kind-property tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited property</span></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited method</span></li></ul><ul class="tsd-legend"><li class="tsd-kind-property tsd-parent-kind-class tsd-is-private"><span class="tsd-kind-icon">Private property</span></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-private"><span class="tsd-kind-icon">Private method</span></li></ul><ul class="tsd-legend"><li class="tsd-kind-property tsd-parent-kind-class tsd-is-static"><span class="tsd-kind-icon">Static property</span></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><span class="tsd-kind-icon">Static method</span></li></ul><ul class="tsd-legend"><li class="tsd-kind-property tsd-parent-kind-interface"><span class="tsd-kind-icon">Property</span></li></ul></div><h2>Settings</h2><p>Theme <select id="theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></p></div></footer><div class="container tsd-generator"><p>Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></div><div class="overlay"></div><script src="../assets/main.js"></script></body></html> |