Files
xahau.js/docs/index.html
Raj Patel 8995e3d579 Docgen issue fix (#2910)
* fix: use .mts extension to emit ES Modules

* add comments and Apppliction type

* update docs
2025-03-07 20:07:47 -05:00

82 lines
18 KiB
HTML

<!DOCTYPE html><html class="default" lang="en" data-base="."><head><meta charset="utf-8"/><script src="https://cmp.osano.com/AzyjT6TIZMlgyLyy8/ad2447d5-f101-40df-b92e-d6452b5ecac0/osano.js"></script><script>
(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-M7HKJJ3');
</script><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>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 defer src="assets/main.js"></script><script async src="assets/icons.js" id="tsd-icons-script"></script><script async src="assets/search.js" id="tsd-search-script"></script><script async src="assets/navigation.js" id="tsd-nav-script"></script><script async src="assets/hierarchy.js" id="tsd-hierarchy-script"></script></head><body><noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-M7HKJJ3" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search"><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></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"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><h1>xrpl</h1></div><div class="tsd-panel tsd-typography"><a id="xrpljs" class="tsd-anchor"></a><h1 class="tsd-anchor-link">xrpl.js<a href="#xrpljs" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h1><p>A JavaScript/TypeScript library for interacting with the XRP Ledger</p>
<p><a href="https://www.npmjs.org/package/xrpl"><img src="https://nodei.co/npm/xrpl.png" alt="NPM"></a>
<img src="https://img.shields.io/bundlephobia/min/xrpl" alt="npm bundle size"></p>
<p>This is the recommended library for integrating a JavaScript/TypeScript app with the XRP Ledger, especially if you intend to use advanced functionality such as IOUs, payment paths, the decentralized exchange, account settings, payment channels, escrows, multi-signing, and more.</p>
<a id="➡️-reference-documentation" class="tsd-anchor"></a><h2 class="tsd-anchor-link"><a href="http://js.xrpl.org">➡️ Reference Documentation</a><a href="#➡️-reference-documentation" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h2><p>See the full reference documentation for all classes, methods, and utilities.</p>
<a id="features" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Features<a href="#features" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h2><ol>
<li>Managing keys &amp; creating test credentials (<a href="https://js.xrpl.org/classes/Wallet.html"><code>Wallet</code></a> &amp;&amp; <a href="https://js.xrpl.org/classes/Client.html#fundWallet"><code>Client.fundWallet()</code></a>)</li>
<li>Submitting transactions to the XRP Ledger (<a href="https://js.xrpl.org/classes/Client.html#submit"><code>Client.submit(...)</code></a> &amp; <a href="https://xrpl.org/transaction-types.html">transaction types</a>)</li>
<li>Sending requests to observe the ledger (<a href="https://js.xrpl.org/classes/Client.html#request"><code>Client.request(...)</code></a> using <a href="https://xrpl.org/public-api-methods.html">public API methods</a>)</li>
<li>Subscribing to changes in the ledger (<a href="https://xrpl.org/subscribe.html">Ex. ledger, transactions, &amp; more...</a>)</li>
<li>Parsing ledger data into more convenient formats (<a href="https://js.xrpl.org/functions/xrpToDrops.html"><code>xrpToDrops</code></a> and <a href="https://js.xrpl.org/functions/rippleTimeToISOTime.html"><code>rippleTimeToISOTime</code></a>)</li>
</ol>
<p>All of which works in Node.js (tested for v18+) &amp; web browsers (tested for Chrome).</p>
<a id="quickstart" class="tsd-anchor"></a><h1 class="tsd-anchor-link">Quickstart<a href="#quickstart" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h1><a id="requirements" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Requirements<a href="#requirements" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h3><ul>
<li><strong><a href="https://nodejs.org/">Node.js v18</a></strong> is recommended. We also support v20 and v22. Other versions may work but are not frequently tested.</li>
</ul>
<a id="installing-xrpljs" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Installing xrpl.js<a href="#installing-xrpljs" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h3><p>In an existing project (with package.json), install xrpl.js with:</p>
<pre><code><span class="hl-0">$</span><span class="hl-1"> </span><span class="hl-0">npm</span><span class="hl-1"> </span><span class="hl-0">install</span><span class="hl-1"> --</span><span class="hl-0">save</span><span class="hl-1"> </span><span class="hl-0">xrpl</span>
</code><button>Copy</button></pre>
<p>Or with <code>yarn</code>:</p>
<pre><code><span class="hl-0">$</span><span class="hl-1"> </span><span class="hl-0">yarn</span><span class="hl-1"> </span><span class="hl-0">add</span><span class="hl-1"> </span><span class="hl-0">xrpl</span>
</code><button>Copy</button></pre>
<p>Example usage:</p>
<pre><code class="js"><span class="hl-2">const</span><span class="hl-1"> </span><span class="hl-3">xrpl</span><span class="hl-1"> = </span><span class="hl-4">require</span><span class="hl-1">(</span><span class="hl-5">&quot;xrpl&quot;</span><span class="hl-1">);</span><br/><span class="hl-2">async</span><span class="hl-1"> </span><span class="hl-2">function</span><span class="hl-1"> </span><span class="hl-4">main</span><span class="hl-1">() {</span><br/><span class="hl-1"> </span><span class="hl-2">const</span><span class="hl-1"> </span><span class="hl-3">client</span><span class="hl-1"> = </span><span class="hl-2">new</span><span class="hl-1"> </span><span class="hl-0">xrpl</span><span class="hl-1">.</span><span class="hl-4">Client</span><span class="hl-1">(</span><span class="hl-5">&quot;wss://s.altnet.rippletest.net:51233&quot;</span><span class="hl-1">);</span><br/><span class="hl-1"> </span><span class="hl-6">await</span><span class="hl-1"> </span><span class="hl-0">client</span><span class="hl-1">.</span><span class="hl-4">connect</span><span class="hl-1">();</span><br/><br/><span class="hl-1"> </span><span class="hl-2">const</span><span class="hl-1"> </span><span class="hl-3">response</span><span class="hl-1"> = </span><span class="hl-6">await</span><span class="hl-1"> </span><span class="hl-0">client</span><span class="hl-1">.</span><span class="hl-4">request</span><span class="hl-1">({</span><br/><span class="hl-1"> </span><span class="hl-0">command:</span><span class="hl-1"> </span><span class="hl-5">&quot;account_info&quot;</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-0">account:</span><span class="hl-1"> </span><span class="hl-5">&quot;rPT1Sjq2YGrBMTttX4GZHjKu9dyfzbpAYe&quot;</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-0">ledger_index:</span><span class="hl-1"> </span><span class="hl-5">&quot;validated&quot;</span><span class="hl-1">,</span><br/><span class="hl-1"> });</span><br/><span class="hl-1"> </span><span class="hl-0">console</span><span class="hl-1">.</span><span class="hl-4">log</span><span class="hl-1">(</span><span class="hl-0">response</span><span class="hl-1">);</span><br/><br/><span class="hl-1"> </span><span class="hl-6">await</span><span class="hl-1"> </span><span class="hl-0">client</span><span class="hl-1">.</span><span class="hl-4">disconnect</span><span class="hl-1">();</span><br/><span class="hl-1">}</span><br/><span class="hl-4">main</span><span class="hl-1">();</span>
</code><button type="button">Copy</button></pre>
<p>For a more in-depth example, you can copy/forking this Code Sandbox template!
<br><a href="https://codesandbox.io/s/xrpl-intro-pxgdjr?file=/src/App.js">https://codesandbox.io/s/xrpl-intro-pxgdjr?file=/src/App.js</a></p>
<p>It goes through:</p>
<ol>
<li>Creating a new test account</li>
<li>Sending a payment transaction</li>
<li>And sending requests to see your account balance!</li>
</ol>
<a id="case-by-case-setup-steps" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Case by Case Setup Steps<a href="#case-by-case-setup-steps" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h3><p>If you're using xrpl.js with React or Deno, you'll need to do a couple extra steps to set it up:</p>
<ul>
<li><a href="https://github.com/XRPLF/xrpl.js/blob/main/UNIQUE_SETUPS.md#using-xrpljs-from-a-cdn">Using xrpl.js with a CDN</a></li>
<li><a href="https://github.com/XRPLF/xrpl.js/blob/main/UNIQUE_SETUPS.md#using-xrpljs-with-create-react-app">Using xrpl.js with <code>create-react-app</code></a></li>
<li><a href="https://github.com/XRPLF/xrpl.js/blob/main/UNIQUE_SETUPS.md#using-xrpljs-with-react-native">Using xrpl.js with <code>React Native</code></a></li>
<li><a href="https://github.com/XRPLF/xrpl.js/blob/main/UNIQUE_SETUPS.md#using-xrpljs-with-vite-react">Using xrpl.js with <code>Vite React</code></a></li>
<li><a href="https://github.com/XRPLF/xrpl.js/blob/main/UNIQUE_SETUPS.md#using-xrpljs-with-deno">Using xrpl.js with <code>Deno</code></a></li>
</ul>
<a id="documentation" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Documentation<a href="#documentation" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h2><p>As you develop with xrpl.js, there's two sites you'll use extensively:</p>
<ol>
<li><a href="https://xrpl.org/references.html">xrpl.org</a> is the primary source for:
<ul>
<li>How the ledger works (<a href="https://xrpl.org/concepts.html#main-page-header">See Concepts</a>)</li>
<li>What kinds of transactions there are (<a href="https://xrpl.org/transaction-types.html#transaction-types">Transaction Types</a>)</li>
<li>Requests you can send (<a href="https://xrpl.org/public-api-methods.html">Public API Methods</a>)</li>
<li>Tutorials for interacting with various features of the ledger (<a href="https://xrpl.org/tutorials.html#main-page-header">Tutorials</a>)</li>
</ul>
</li>
<li><a href="https://js.xrpl.org/">js.xrpl.org</a> has the reference docs for this library</li>
</ol>
<a id="mailing-lists" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Mailing Lists<a href="#mailing-lists" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h3><p>If you want to hear when we release new versions of xrpl.js, you can join our low-traffic mailing list (About 1 email per week):</p>
<ul>
<li><a href="https://groups.google.com/g/xrpl-announce">Subscribe to xrpl-announce</a></li>
</ul>
<p>If you're using the XRP Ledger in production, you should run a <a href="https://github.com/ripple/rippled">rippled server</a> and subscribe to the ripple-server mailing list as well.</p>
<ul>
<li><a href="https://groups.google.com/g/ripple-server">Subscribe to ripple-server</a></li>
</ul>
<a id="asking-for-help" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Asking for help<a href="#asking-for-help" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h2><p>One of the best spots to ask for help is in the <a href="https://xrpldevs.org">XRPL Developer Discord</a> - There's a channel for xrpl.js where other community members can help you figure out how to accomplish your goals.</p>
<p>You are also welcome to create an <a href="https://github.com/XRPLF/xrpl.js/issues">issue</a> here and we'll do our best to respond within 3 days.</p>
<a id="key-links" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Key Links<a href="#key-links" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h2><ul>
<li><a href="https://js.xrpl.org/">xrpl.js Reference Docs</a></li>
<li><a href="https://xrpl.org/references.html">xrpl.org (Detailed docs on how the XRPL works)</a></li>
<li><a href="https://github.com/XRPLF/xrpl-dev-portal/tree/master/content/_code-samples">XRPL Code Samples</a></li>
<li><a href="https://xrpldevs.org">#javascript in the XRPL Developer Discord for questions &amp; support</a></li>
<li><a href="https://groups.google.com/g/xrpl-announce">xrpl-announce (The mailing list for new xrpl.js versions)</a></li>
<li><a href="https://github.com/XRPLF/xrpl.js/blob/main/APPLICATIONS.md">Applications that use xrpl.js</a> (You can open a PR to add your project!)</li>
</ul>
</div></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="assets/icons.svg#icon-chevronDown"></use></svg>On This Page</h3></summary><div class="tsd-accordion-details"><a href="#xrpljs"><span>xrpl.js</span></a><ul><li><a href="#➡️-reference-documentation"><span>➡️ <wbr/>Reference <wbr/>Documentation</span></a></li><li><a href="#features"><span>Features</span></a></li></ul><a href="#quickstart"><span>Quickstart</span></a><ul><li><ul><li><a href="#requirements"><span>Requirements</span></a></li><li><a href="#installing-xrpljs"><span>Installing xrpl.js</span></a></li><li><a href="#case-by-case-setup-steps"><span>Case by <wbr/>Case <wbr/>Setup <wbr/>Steps</span></a></li></ul></li><li><a href="#documentation"><span>Documentation</span></a></li><li><ul><li><a href="#mailing-lists"><span>Mailing <wbr/>Lists</span></a></li></ul></li><li><a href="#asking-for-help"><span>Asking for help</span></a></li><li><a href="#key-links"><span>Key <wbr/>Links</span></a></li></ul></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="modules.html">xrpl</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>