1<!DOCTYPE html><html class="default" lang="en" data-base="../"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>docs-src/usage/usage_index | Cashu-TS - v4.11.0</title><meta name="description" content="Documentation for Cashu-TS"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><link rel="stylesheet" href="../assets/custom.css"/>
1<script defer src="../assets/main.js"></script>
1<script async src="../assets/icons.js" id="tsd-icons-script"></script>
1<script async src="../assets/search.js" id="tsd-search-script"></script>
1<script async src="../assets/navigation.js" id="tsd-nav-script"></script>
1<script async src="../assets/hierarchy.js" id="tsd-hierarchy-script"></script>
1</head><body>
1<script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => window.app?app.showPage():document.body.style.removeProperty("display"),500)</script>
1<header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><a href="../index.html" class="title">Cashu-TS - v4.11.0</a><div id="tsd-toolbar-links"></div><button id="tsd-search-trigger" class="tsd-widget" aria-label="Search"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-search"></use></svg></button><dialog id="tsd-search" aria-label="Search"><input role="combobox" id="tsd-search-input" aria-controls="tsd-search-results" aria-autocomplete="list" aria-expanded="true" autocapitalize="off" autocomplete="off" placeholder="Search the docs" maxLength="100"/><ul role="listbox" id="tsd-search-results"></ul><div id="tsd-search-status" aria-live="polite" aria-atomic="true"><div>Preparing search index...</div></div></dialog><a href="#" class="tsd-widget menu" id="tsd-toolbar-menu-trigger" 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></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb" aria-label="Breadcrumb"><li><a href="" aria-current="page">docs-src/usage/usage_index</a></li></ul></div><div class="tsd-panel tsd-typography"><h1 id="documents-usage-examples" class="tsd-anchor-link"><a href="/">Documents</a> ⺠<strong>Usage Examples</strong><a href="#documents-usage-examples" 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> 2<h1 id="usage-examples" class="tsd-anchor-link">Usage Examples<a href="#usage-examples" 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> 3<p>This section collects the shortest paths through the library for common wallet tasks. Use it as an 4entry point, then jump into the focused recipe for the exact flow you need.</p> 5<p>If you want end-to-end examples with realistic state handling, also inspect the 6<a href="https://github.com/cashubtc/cashu-ts/blob/main/test/integration.test.ts">integration tests</a>.</p> 7<h2 id="start-here" class="tsd-anchor-link">Start here<a href="#start-here" 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> 8<p>If you are building a wallet integration from scratch, read these in order:</p> 9<ol> 10<li><a href="docs-src_usage_create_wallet.html">Create Wallet</a> to instantiate a wallet and load mint state.</li> 11<li><a href="docs-src_usage_mint_token.html">Mint Token</a> to mint proofs from a paid quote.</li> 12<li><a href="docs-src_usage_create_token.html">Create Token</a> or <a href="docs-src_usage_create_p2pk.html">Create P2PK</a> to send value.</li> 13<li><a href="docs-src_usage_get_token.html">Get Token</a> to inspect or decode tokens safely.</li> 14<li><a href="docs-src_usage_melt_token.html">Melt Token</a> to pay invoices with proofs.</li> 15</ol> 16<h2 id="recipes" class="tsd-anchor-link">Recipes<a href="#recipes" 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> 17<table> 18<thead> 19<tr> 20<th style="text-align:left">Recipe</th> 21<th style="text-align:left">Use it for</th> 22</tr> 23</thead> 24<tbody> 25<tr> 26<td style="text-align:left"><a href="docs-src_usage_create_wallet.html">Create Wallet</a></td> 27<td style="text-align:left">Initialize a wallet from a mint URL or cached mint state.</td> 28</tr> 29<tr> 30<td style="text-align:left"><a href="docs-src_usage_mint_token.html">Mint Token</a></td> 31<td style="text-align:left">Create proofs from a paid quote, including two-step mint flows.</td> 32</tr> 33<tr> 34<td style="text-align:left"><a href="docs-src_usage_create_token.html">Create Token</a></td> 35<td style="text-align:left">Send standard Cashu tokens to another wallet.</td> 36</tr> 37<tr> 38<td style="text-align:left"><a href="docs-src_usage_create_p2pk.html">Create P2PK</a></td> 39<td style="text-align:left">Send tokens locked to a public key.</td> 40</tr> 41<tr> 42<td style="text-align:left"><a href="docs-src_usage_get_token.html">Get Token</a></td> 43<td style="text-align:left">Inspect token metadata before wallet creation or decode it after load.</td> 44</tr> 45<tr> 46<td style="text-align:left"><a href="docs-src_usage_melt_token.html">Melt Token</a></td> 47<td style="text-align:left">Pay BOLT11 invoices or other payment methods with wallet proofs.</td> 48</tr> 49<tr> 50<td style="text-align:left"><a href="../media/keysets.md">Keysets & Rotation</a></td> 51<td style="text-align:left">What the wallet snapshot tracks, lazy key loading, and self-repair on rotation.</td> 52</tr> 53<tr> 54<td style="text-align:left"><a href="docs-src_usage_bolt12.html">Bolt12</a></td> 55<td style="text-align:left">Work with reusable BOLT12 offers for minting and melting.</td> 56</tr> 57<tr> 58<td style="text-align:left"><a href="docs-src_usage_nut19.html">NUT-19 Cached Responses</a></td> 59<td style="text-align:left">Understand cached endpoint retries and timeout behavior.</td> 60</tr> 61<tr> 62<td style="text-align:left"><a href="docs-src_usage_logging.html">Logging</a></td> 63<td style="text-align:left">Enable and route library logs while debugging wallet or mint behavior.</td> 64</tr> 65<tr> 66<td style="text-align:left"><a href="../media/amounts.md">Amounts</a></td> 67<td style="text-align:left">Work with the <code>Amount</code> and <code>AmountWithUnit</code> value objects.</td> 68</tr> 69<tr> 70<td style="text-align:left"><a href="docs-src_usage_fees.html">Fees</a></td> 71<td style="text-align:left">Pick the right fee helper: input fees, sender-pays-fees, send-max.</td> 72</tr> 73<tr> 74<td style="text-align:left"><a href="docs-src_usage_helpers.html">Helpers</a></td> 75<td style="text-align:left">Standalone public utility functions.</td> 76</tr> 77</tbody> 78</table> 79<h2 id="related-docs" class="tsd-anchor-link">Related docs<a href="#related-docs" 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> 80<ul> 81<li><a href="docs-src_wallet_ops_wallet_ops.html">Wallet Operations</a> for the builder-style <code>wallet.ops</code> API.</li> 82<li><a href="docs-src_wallet_events_wallet_events.html">Wallet Events</a> for quote and proof state subscriptions.</li> 83<li><a href="docs-src_deterministic_counters.html">Deterministic Counters</a> for deterministic secret generation flows.</li> 84</ul> 85</div></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg><h3>Settings</h3></summary>
85<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"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg><h3>On This Page</h3></summary><div class="tsd-accordion-details"><a href="#documents-usage-examples"><span>Documents ⺠<wbr/>Usage <wbr/>Examples</span></a><a href="#usage-examples"><span>Usage <wbr/>Examples</span></a><ul><li><a href="#start-here"><span>Start here</span></a></li><li><a href="#recipes"><span>Recipes</span></a></li><li><a href="#related-docs"><span>Related docs</span></a></li></ul></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html">Cashu-TS - v4.11.0</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer></footer><div class="overlay"></div></body></html>
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.