Implement Smart Router API (#96) (#101)

- swap on routes with up to 2-hops
- swap on routes that is split into multiple smaller routes
- route selection
- Support VersionedTransaction & lookup tables
This commit is contained in:
meep 2023-05-13 11:15:27 +10:00 committed by GitHub
parent bf60726d05
commit 04abca9ef0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
60 changed files with 2453 additions and 282 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -2,12 +2,12 @@
<p>A builder class for creating a <a href="../modules.html#PoolGraph">PoolGraph</a></p>
</div><div><p>Note: we use an adjacency list as a representation of our pool graph,
since we assume that most token pairings don&#39;t exist as pools</p>
</div></div></section><section class="tsd-panel tsd-hierarchy"><h3>Hierarchy</h3><ul class="tsd-hierarchy"><li><span class="target">PoolGraphBuilder</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="PoolGraphBuilder.html#constructor" class="tsd-kind-icon">constructor</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-static"><a href="PoolGraphBuilder.html#buildPoolGraph" class="tsd-kind-icon">build<wbr/>Pool<wbr/>Graph</a></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="PoolGraphBuilder.html#buildPoolGraphWithFetch" class="tsd-kind-icon">build<wbr/>Pool<wbr/>Graph<wbr/>With<wbr/>Fetch</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/>Pool<wbr/>Graph<wbr/>Builder<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="PoolGraphBuilder.html" class="tsd-signature-type" data-tsd-kind="Class">PoolGraphBuilder</a></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><h4 class="tsd-returns-title">Returns <a href="PoolGraphBuilder.html" class="tsd-signature-type" data-tsd-kind="Class">PoolGraphBuilder</a></h4></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-static"><a id="buildPoolGraph" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span class="tsd-flag ts-flagStatic">Static</span> build<wbr/>Pool<wbr/>Graph<a href="#buildPoolGraph" 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">build<wbr/>Pool<wbr/>Graph<span class="tsd-signature-symbol">(</span>poolTokenPairs<span class="tsd-signature-symbol">: </span><a href="../interfaces/PoolTokenPair.html" class="tsd-signature-type" data-tsd-kind="Interface">PoolTokenPair</a><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="../modules.html#PoolGraph" class="tsd-signature-type" data-tsd-kind="Type alias">PoolGraph</a></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/96e2185/sdk/src/utils/graphs/public/pool-graph-builder.ts#L51">utils/graphs/public/pool-graph-builder.ts:51</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
</div></div></section><section class="tsd-panel tsd-hierarchy"><h3>Hierarchy</h3><ul class="tsd-hierarchy"><li><span class="target">PoolGraphBuilder</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="PoolGraphBuilder.html#constructor" class="tsd-kind-icon">constructor</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-static"><a href="PoolGraphBuilder.html#buildPoolGraph" class="tsd-kind-icon">build<wbr/>Pool<wbr/>Graph</a></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="PoolGraphBuilder.html#buildPoolGraphWithFetch" class="tsd-kind-icon">build<wbr/>Pool<wbr/>Graph<wbr/>With<wbr/>Fetch</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/>Pool<wbr/>Graph<wbr/>Builder<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="PoolGraphBuilder.html" class="tsd-signature-type" data-tsd-kind="Class">PoolGraphBuilder</a></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><h4 class="tsd-returns-title">Returns <a href="PoolGraphBuilder.html" class="tsd-signature-type" data-tsd-kind="Class">PoolGraphBuilder</a></h4></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-static"><a id="buildPoolGraph" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span class="tsd-flag ts-flagStatic">Static</span> build<wbr/>Pool<wbr/>Graph<a href="#buildPoolGraph" 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">build<wbr/>Pool<wbr/>Graph<span class="tsd-signature-symbol">(</span>poolTokenPairs<span class="tsd-signature-symbol">: </span><a href="../interfaces/PoolTokenPair.html" class="tsd-signature-type" data-tsd-kind="Interface">PoolTokenPair</a><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="../modules.html#PoolGraph" class="tsd-signature-type" data-tsd-kind="Type alias">PoolGraph</a></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/9e0a389/sdk/src/utils/graphs/public/pool-graph-builder.ts#L51">utils/graphs/public/pool-graph-builder.ts:51</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Build a <a href="../modules.html#PoolGraph">PoolGraph</a> from a list of pools in the format of <a href="../interfaces/PoolTokenPair.html">PoolTokenPair</a></p>
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>poolTokenPairs: <a href="../interfaces/PoolTokenPair.html" class="tsd-signature-type" data-tsd-kind="Interface">PoolTokenPair</a><span class="tsd-signature-symbol">[]</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p>a list of <a href="../interfaces/PoolTokenPair.html">PoolTokenPair</a> to generate this pool graph</p>
</div></div></li></ul><h4 class="tsd-returns-title">Returns <a href="../modules.html#PoolGraph" class="tsd-signature-type" data-tsd-kind="Type alias">PoolGraph</a></h4><div><p>A <a href="../modules.html#PoolGraph">PoolGraph</a> with the provided pools</p>
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-static"><a id="buildPoolGraphWithFetch" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span class="tsd-flag ts-flagStatic">Static</span> build<wbr/>Pool<wbr/>Graph<wbr/>With<wbr/>Fetch<a href="#buildPoolGraphWithFetch" 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">build<wbr/>Pool<wbr/>Graph<wbr/>With<wbr/>Fetch<span class="tsd-signature-symbol">(</span>pools<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Address</span><span class="tsd-signature-symbol">[]</span>, fetcher<span class="tsd-signature-symbol">: </span><a href="AccountFetcher.html" class="tsd-signature-type" data-tsd-kind="Class">AccountFetcher</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><a href="../modules.html#PoolGraph" class="tsd-signature-type" data-tsd-kind="Type alias">PoolGraph</a><span class="tsd-signature-symbol">&gt;</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/96e2185/sdk/src/utils/graphs/public/pool-graph-builder.ts#L22">utils/graphs/public/pool-graph-builder.ts:22</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-static"><a id="buildPoolGraphWithFetch" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span class="tsd-flag ts-flagStatic">Static</span> build<wbr/>Pool<wbr/>Graph<wbr/>With<wbr/>Fetch<a href="#buildPoolGraphWithFetch" 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">build<wbr/>Pool<wbr/>Graph<wbr/>With<wbr/>Fetch<span class="tsd-signature-symbol">(</span>pools<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Address</span><span class="tsd-signature-symbol">[]</span>, fetcher<span class="tsd-signature-symbol">: </span><a href="AccountFetcher.html" class="tsd-signature-type" data-tsd-kind="Class">AccountFetcher</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><a href="../modules.html#PoolGraph" class="tsd-signature-type" data-tsd-kind="Type alias">PoolGraph</a><span class="tsd-signature-symbol">&gt;</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/9e0a389/sdk/src/utils/graphs/public/pool-graph-builder.ts#L22">utils/graphs/public/pool-graph-builder.ts:22</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Fetch data and build a <a href="../modules.html#PoolGraph">PoolGraph</a> from a list of pools addresses</p>
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>pools: <span class="tsd-signature-type">Address</span><span class="tsd-signature-symbol">[]</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p>a list of pool addresses to generate this pool graph</p>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,52 @@
<!DOCTYPE html><html class="default"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>PositionBundleUtil | @orca-so/whirlpools-sdk</title><meta name="description" content="Documentation for @orca-so/whirlpools-sdk"/><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">@orca-so/whirlpools-sdk</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">@orca-so/whirlpools-sdk</a></li><li><a href="PositionBundleUtil.html">PositionBundleUtil</a></li></ul><h1>Class PositionBundleUtil </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 collection of utility functions when interacting with a PositionBundle.</p>
</div></div></section><section class="tsd-panel tsd-hierarchy"><h3>Hierarchy</h3><ul class="tsd-hierarchy"><li><span class="target">PositionBundleUtil</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>Methods</h3><ul class="tsd-index-list"><li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="PositionBundleUtil.html#checkBundleIndexInBounds" class="tsd-kind-icon">check<wbr/>Bundle<wbr/>Index<wbr/>In<wbr/>Bounds</a></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="PositionBundleUtil.html#convertBitmapToArray" class="tsd-kind-icon">convert<wbr/>Bitmap<wbr/>To<wbr/>Array</a></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="PositionBundleUtil.html#findUnoccupiedBundleIndex" class="tsd-kind-icon">find<wbr/>Unoccupied<wbr/>Bundle<wbr/>Index</a></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="PositionBundleUtil.html#getOccupiedBundleIndexes" class="tsd-kind-icon">get<wbr/>Occupied<wbr/>Bundle<wbr/>Indexes</a></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="PositionBundleUtil.html#getUnoccupiedBundleIndexes" class="tsd-kind-icon">get<wbr/>Unoccupied<wbr/>Bundle<wbr/>Indexes</a></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="PositionBundleUtil.html#isEmpty" class="tsd-kind-icon">is<wbr/>Empty</a></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="PositionBundleUtil.html#isFull" class="tsd-kind-icon">is<wbr/>Full</a></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="PositionBundleUtil.html#isOccupied" class="tsd-kind-icon">is<wbr/>Occupied</a></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="PositionBundleUtil.html#isUnoccupied" class="tsd-kind-icon">is<wbr/>Unoccupied</a></li></ul></section></div></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-static"><a id="checkBundleIndexInBounds" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span class="tsd-flag ts-flagStatic">Static</span> check<wbr/>Bundle<wbr/>Index<wbr/>In<wbr/>Bounds<a href="#checkBundleIndexInBounds" 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">check<wbr/>Bundle<wbr/>Index<wbr/>In<wbr/>Bounds<span class="tsd-signature-symbol">(</span>bundleIndex<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">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/orca-so/whirlpools/blob/9e0a389/sdk/src/utils/public/position-bundle-util.ts#L17">utils/public/position-bundle-util.ts:17</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Check if the bundle index is in the correct range.</p>
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>bundleIndex: <span class="tsd-signature-type">number</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p>The bundle index to be checked</p>
</div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4><div><p>true if bundle index is in the correct range</p>
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-static"><a id="convertBitmapToArray" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span class="tsd-flag ts-flagStatic">Static</span> convert<wbr/>Bitmap<wbr/>To<wbr/>Array<a href="#convertBitmapToArray" 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">convert<wbr/>Bitmap<wbr/>To<wbr/>Array<span class="tsd-signature-symbol">(</span>positionBundle<span class="tsd-signature-symbol">: </span><a href="../modules.html#PositionBundleData" class="tsd-signature-type" data-tsd-kind="Type alias">PositionBundleData</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</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/orca-so/whirlpools/blob/9e0a389/sdk/src/utils/public/position-bundle-util.ts#L116">utils/public/position-bundle-util.ts:116</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Convert position bitmap to the array of boolean which represent if Bundled Position is open.</p>
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>positionBundle: <a href="../modules.html#PositionBundleData" class="tsd-signature-type" data-tsd-kind="Type alias">PositionBundleData</a></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p>The position bundle whose bitmap will be converted</p>
</div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">[]</span></h4><div><p>The array of boolean representing if Bundled Position is open</p>
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-static"><a id="findUnoccupiedBundleIndex" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span class="tsd-flag ts-flagStatic">Static</span> find<wbr/>Unoccupied<wbr/>Bundle<wbr/>Index<a href="#findUnoccupiedBundleIndex" 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">find<wbr/>Unoccupied<wbr/>Bundle<wbr/>Index<span class="tsd-signature-symbol">(</span>positionBundle<span class="tsd-signature-symbol">: </span><a href="../modules.html#PositionBundleData" class="tsd-signature-type" data-tsd-kind="Type alias">PositionBundleData</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">number</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/9e0a389/sdk/src/utils/public/position-bundle-util.ts#L105">utils/public/position-bundle-util.ts:105</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Get the first unoccupied bundle index in the position bundle.</p>
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>positionBundle: <a href="../modules.html#PositionBundleData" class="tsd-signature-type" data-tsd-kind="Type alias">PositionBundleData</a></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p>The position bundle to be checked</p>
</div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">number</span></h4><div><p>The first unoccupied bundle index, null if the position bundle is full</p>
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-static"><a id="getOccupiedBundleIndexes" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span class="tsd-flag ts-flagStatic">Static</span> get<wbr/>Occupied<wbr/>Bundle<wbr/>Indexes<a href="#getOccupiedBundleIndexes" 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">get<wbr/>Occupied<wbr/>Bundle<wbr/>Indexes<span class="tsd-signature-symbol">(</span>positionBundle<span class="tsd-signature-symbol">: </span><a href="../modules.html#PositionBundleData" class="tsd-signature-type" data-tsd-kind="Type alias">PositionBundleData</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</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/orca-so/whirlpools/blob/9e0a389/sdk/src/utils/public/position-bundle-util.ts#L73">utils/public/position-bundle-util.ts:73</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Get all bundle indexes where the corresponding Bundled Position is open.</p>
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>positionBundle: <a href="../modules.html#PositionBundleData" class="tsd-signature-type" data-tsd-kind="Type alias">PositionBundleData</a></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p>The position bundle to be checked</p>
</div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span></h4><div><p>The array of bundle index where the corresponding Bundled Position is open</p>
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-static"><a id="getUnoccupiedBundleIndexes" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span class="tsd-flag ts-flagStatic">Static</span> get<wbr/>Unoccupied<wbr/>Bundle<wbr/>Indexes<a href="#getUnoccupiedBundleIndexes" 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">get<wbr/>Unoccupied<wbr/>Bundle<wbr/>Indexes<span class="tsd-signature-symbol">(</span>positionBundle<span class="tsd-signature-symbol">: </span><a href="../modules.html#PositionBundleData" class="tsd-signature-type" data-tsd-kind="Type alias">PositionBundleData</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</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/orca-so/whirlpools/blob/9e0a389/sdk/src/utils/public/position-bundle-util.ts#L89">utils/public/position-bundle-util.ts:89</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Get all bundle indexes where the corresponding Bundled Position is not open.</p>
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>positionBundle: <a href="../modules.html#PositionBundleData" class="tsd-signature-type" data-tsd-kind="Type alias">PositionBundleData</a></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p>The position bundle to be checked</p>
</div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span></h4><div><p>The array of bundle index where the corresponding Bundled Position is not open</p>
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-static"><a id="isEmpty" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span class="tsd-flag ts-flagStatic">Static</span> is<wbr/>Empty<a href="#isEmpty" 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">is<wbr/>Empty<span class="tsd-signature-symbol">(</span>positionBundle<span class="tsd-signature-symbol">: </span><a href="../modules.html#PositionBundleData" class="tsd-signature-type" data-tsd-kind="Type alias">PositionBundleData</a><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/orca-so/whirlpools/blob/9e0a389/sdk/src/utils/public/position-bundle-util.ts#L62">utils/public/position-bundle-util.ts:62</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Check if all bundle index is unoccupied.</p>
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>positionBundle: <a href="../modules.html#PositionBundleData" class="tsd-signature-type" data-tsd-kind="Type alias">PositionBundleData</a></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p>The position bundle to be checked</p>
</div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4><div><p>true if all bundle index is unoccupied</p>
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-static"><a id="isFull" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span class="tsd-flag ts-flagStatic">Static</span> is<wbr/>Full<a href="#isFull" 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">is<wbr/>Full<span class="tsd-signature-symbol">(</span>positionBundle<span class="tsd-signature-symbol">: </span><a href="../modules.html#PositionBundleData" class="tsd-signature-type" data-tsd-kind="Type alias">PositionBundleData</a><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/orca-so/whirlpools/blob/9e0a389/sdk/src/utils/public/position-bundle-util.ts#L51">utils/public/position-bundle-util.ts:51</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Check if all bundle index is occupied.</p>
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>positionBundle: <a href="../modules.html#PositionBundleData" class="tsd-signature-type" data-tsd-kind="Type alias">PositionBundleData</a></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p>The position bundle to be checked</p>
</div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4><div><p>true if all bundle index is occupied</p>
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-static"><a id="isOccupied" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span class="tsd-flag ts-flagStatic">Static</span> is<wbr/>Occupied<a href="#isOccupied" 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">is<wbr/>Occupied<span class="tsd-signature-symbol">(</span>positionBundle<span class="tsd-signature-symbol">: </span><a href="../modules.html#PositionBundleData" class="tsd-signature-type" data-tsd-kind="Type alias">PositionBundleData</a>, bundleIndex<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">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/orca-so/whirlpools/blob/9e0a389/sdk/src/utils/public/position-bundle-util.ts#L28">utils/public/position-bundle-util.ts:28</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Check if the Bundled Position corresponding to the bundle index has been opened.</p>
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>positionBundle: <a href="../modules.html#PositionBundleData" class="tsd-signature-type" data-tsd-kind="Type alias">PositionBundleData</a></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p>The position bundle to be checked</p>
</div></div></li><li><h5>bundleIndex: <span class="tsd-signature-type">number</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p>The bundle index to be checked</p>
</div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4><div><p>true if Bundled Position has been opened</p>
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-static"><a id="isUnoccupied" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span class="tsd-flag ts-flagStatic">Static</span> is<wbr/>Unoccupied<a href="#isUnoccupied" 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">is<wbr/>Unoccupied<span class="tsd-signature-symbol">(</span>positionBundle<span class="tsd-signature-symbol">: </span><a href="../modules.html#PositionBundleData" class="tsd-signature-type" data-tsd-kind="Type alias">PositionBundleData</a>, bundleIndex<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">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/orca-so/whirlpools/blob/9e0a389/sdk/src/utils/public/position-bundle-util.ts#L41">utils/public/position-bundle-util.ts:41</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Check if the Bundled Position corresponding to the bundle index has not been opened.</p>
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>positionBundle: <a href="../modules.html#PositionBundleData" class="tsd-signature-type" data-tsd-kind="Type alias">PositionBundleData</a></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p>The position bundle to be checked</p>
</div></div></li><li><h5>bundleIndex: <span class="tsd-signature-type">number</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p>The bundle index to be checked</p>
</div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4><div><p>true if Bundled Position has not been opened</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></ul></nav><nav class="tsd-navigation secondary menu-sticky"><ul><li class="current tsd-kind-class"><a href="PositionBundleUtil.html" class="tsd-kind-icon">Position<wbr/>Bundle<wbr/>Util</a><ul><li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="PositionBundleUtil.html#checkBundleIndexInBounds" class="tsd-kind-icon">check<wbr/>Bundle<wbr/>Index<wbr/>In<wbr/>Bounds</a></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="PositionBundleUtil.html#convertBitmapToArray" class="tsd-kind-icon">convert<wbr/>Bitmap<wbr/>To<wbr/>Array</a></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="PositionBundleUtil.html#findUnoccupiedBundleIndex" class="tsd-kind-icon">find<wbr/>Unoccupied<wbr/>Bundle<wbr/>Index</a></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="PositionBundleUtil.html#getOccupiedBundleIndexes" class="tsd-kind-icon">get<wbr/>Occupied<wbr/>Bundle<wbr/>Indexes</a></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="PositionBundleUtil.html#getUnoccupiedBundleIndexes" class="tsd-kind-icon">get<wbr/>Unoccupied<wbr/>Bundle<wbr/>Indexes</a></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="PositionBundleUtil.html#isEmpty" class="tsd-kind-icon">is<wbr/>Empty</a></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="PositionBundleUtil.html#isFull" class="tsd-kind-icon">is<wbr/>Full</a></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="PositionBundleUtil.html#isOccupied" class="tsd-kind-icon">is<wbr/>Occupied</a></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="PositionBundleUtil.html#isUnoccupied" class="tsd-kind-icon">is<wbr/>Unoccupied</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-property tsd-parent-kind-interface"><span class="tsd-kind-icon">Property</span></li><li class="tsd-kind-method tsd-parent-kind-interface"><span class="tsd-kind-icon">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></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>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
<!DOCTYPE html><html class="default"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>PriceModuleUtils | @orca-so/whirlpools-sdk</title><meta name="description" content="Documentation for @orca-so/whirlpools-sdk"/><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">@orca-so/whirlpools-sdk</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">@orca-so/whirlpools-sdk</a></li><li><a href="PriceModuleUtils.html">PriceModuleUtils</a></li></ul><h1>Class PriceModuleUtils </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 list of utility functions for the price module.</p>
</div></div></section><section class="tsd-panel tsd-hierarchy"><h3>Hierarchy</h3><ul class="tsd-hierarchy"><li><span class="target">PriceModuleUtils</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="PriceModuleUtils.html#constructor" class="tsd-kind-icon">constructor</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-static"><a href="PriceModuleUtils.html#fetchDecimalsForMints" class="tsd-kind-icon">fetch<wbr/>Decimals<wbr/>For<wbr/>Mints</a></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="PriceModuleUtils.html#fetchPoolDataFromMints" class="tsd-kind-icon">fetch<wbr/>Pool<wbr/>Data<wbr/>From<wbr/>Mints</a></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="PriceModuleUtils.html#fetchTickArraysForPools" class="tsd-kind-icon">fetch<wbr/>Tick<wbr/>Arrays<wbr/>For<wbr/>Pools</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/>Price<wbr/>Module<wbr/>Utils<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="PriceModuleUtils.html" class="tsd-signature-type" data-tsd-kind="Class">PriceModuleUtils</a></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><h4 class="tsd-returns-title">Returns <a href="PriceModuleUtils.html" class="tsd-signature-type" data-tsd-kind="Class">PriceModuleUtils</a></h4></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-static"><a id="fetchDecimalsForMints" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span class="tsd-flag ts-flagStatic">Static</span> fetch<wbr/>Decimals<wbr/>For<wbr/>Mints<a href="#fetchDecimalsForMints" 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">fetch<wbr/>Decimals<wbr/>For<wbr/>Mints<span class="tsd-signature-symbol">(</span>ctx<span class="tsd-signature-symbol">: </span><a href="WhirlpoolContext.html" class="tsd-signature-type" data-tsd-kind="Class">WhirlpoolContext</a>, mints<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Address</span><span class="tsd-signature-symbol">[]</span>, refresh<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">Promise</span><span class="tsd-signature-symbol">&lt;</span><a href="../modules.html#DecimalsMap" class="tsd-signature-type" data-tsd-kind="Type alias">DecimalsMap</a><span class="tsd-signature-symbol">&gt;</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/96e2185/sdk/src/prices/price-module.ts#L327">prices/price-module.ts:327</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
</div></div></section><section class="tsd-panel tsd-hierarchy"><h3>Hierarchy</h3><ul class="tsd-hierarchy"><li><span class="target">PriceModuleUtils</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="PriceModuleUtils.html#constructor" class="tsd-kind-icon">constructor</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-static"><a href="PriceModuleUtils.html#fetchDecimalsForMints" class="tsd-kind-icon">fetch<wbr/>Decimals<wbr/>For<wbr/>Mints</a></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="PriceModuleUtils.html#fetchPoolDataFromMints" class="tsd-kind-icon">fetch<wbr/>Pool<wbr/>Data<wbr/>From<wbr/>Mints</a></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="PriceModuleUtils.html#fetchTickArraysForPools" class="tsd-kind-icon">fetch<wbr/>Tick<wbr/>Arrays<wbr/>For<wbr/>Pools</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/>Price<wbr/>Module<wbr/>Utils<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="PriceModuleUtils.html" class="tsd-signature-type" data-tsd-kind="Class">PriceModuleUtils</a></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><h4 class="tsd-returns-title">Returns <a href="PriceModuleUtils.html" class="tsd-signature-type" data-tsd-kind="Class">PriceModuleUtils</a></h4></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-static"><a id="fetchDecimalsForMints" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span class="tsd-flag ts-flagStatic">Static</span> fetch<wbr/>Decimals<wbr/>For<wbr/>Mints<a href="#fetchDecimalsForMints" 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">fetch<wbr/>Decimals<wbr/>For<wbr/>Mints<span class="tsd-signature-symbol">(</span>ctx<span class="tsd-signature-symbol">: </span><a href="WhirlpoolContext.html" class="tsd-signature-type" data-tsd-kind="Class">WhirlpoolContext</a>, mints<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Address</span><span class="tsd-signature-symbol">[]</span>, refresh<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">Promise</span><span class="tsd-signature-symbol">&lt;</span><a href="../modules.html#DecimalsMap" class="tsd-signature-type" data-tsd-kind="Type alias">DecimalsMap</a><span class="tsd-signature-symbol">&gt;</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/9e0a389/sdk/src/prices/price-module.ts#L331">prices/price-module.ts:331</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Fetch the decimals to token mapping for the given mints.</p>
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>ctx: <a href="WhirlpoolContext.html" class="tsd-signature-type" data-tsd-kind="Class">WhirlpoolContext</a></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p><a href="WhirlpoolContext.html">WhirlpoolContext</a></p>
@ -9,7 +9,7 @@
</div></div></li><li><h5>refresh: <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> = true</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p>Whether to refresh the cache.</p>
</div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><a href="../modules.html#DecimalsMap" class="tsd-signature-type" data-tsd-kind="Type alias">DecimalsMap</a><span class="tsd-signature-symbol">&gt;</span></h4><div><p>A <a href="../modules.html#DecimalsMap">DecimalsMap</a> of mint addresses to decimals.</p>
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-static"><a id="fetchPoolDataFromMints" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span class="tsd-flag ts-flagStatic">Static</span> fetch<wbr/>Pool<wbr/>Data<wbr/>From<wbr/>Mints<a href="#fetchPoolDataFromMints" 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">fetch<wbr/>Pool<wbr/>Data<wbr/>From<wbr/>Mints<span class="tsd-signature-symbol">(</span>ctx<span class="tsd-signature-symbol">: </span><a href="WhirlpoolContext.html" class="tsd-signature-type" data-tsd-kind="Class">WhirlpoolContext</a>, mints<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Address</span><span class="tsd-signature-symbol">[]</span>, config<span class="tsd-signature-symbol">?: </span><a href="../modules.html#GetPricesConfig" class="tsd-signature-type" data-tsd-kind="Type alias">GetPricesConfig</a>, refresh<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">Promise</span><span class="tsd-signature-symbol">&lt;</span><a href="../modules.html#PoolMap" class="tsd-signature-type" data-tsd-kind="Type alias">PoolMap</a><span class="tsd-signature-symbol">&gt;</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/96e2185/sdk/src/prices/price-module.ts#L235">prices/price-module.ts:235</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-static"><a id="fetchPoolDataFromMints" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span class="tsd-flag ts-flagStatic">Static</span> fetch<wbr/>Pool<wbr/>Data<wbr/>From<wbr/>Mints<a href="#fetchPoolDataFromMints" 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">fetch<wbr/>Pool<wbr/>Data<wbr/>From<wbr/>Mints<span class="tsd-signature-symbol">(</span>ctx<span class="tsd-signature-symbol">: </span><a href="WhirlpoolContext.html" class="tsd-signature-type" data-tsd-kind="Class">WhirlpoolContext</a>, mints<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Address</span><span class="tsd-signature-symbol">[]</span>, config<span class="tsd-signature-symbol">?: </span><a href="../modules.html#GetPricesConfig" class="tsd-signature-type" data-tsd-kind="Type alias">GetPricesConfig</a>, refresh<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">Promise</span><span class="tsd-signature-symbol">&lt;</span><a href="../modules.html#PoolMap" class="tsd-signature-type" data-tsd-kind="Type alias">PoolMap</a><span class="tsd-signature-symbol">&gt;</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/9e0a389/sdk/src/prices/price-module.ts#L235">prices/price-module.ts:235</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Fetch pool data for the given mints by deriving the PDA from all combinations of mints &amp; tick-arrays.
Note that this method can be slow.</p>
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>ctx: <a href="WhirlpoolContext.html" class="tsd-signature-type" data-tsd-kind="Class">WhirlpoolContext</a></h5><div class="tsd-comment tsd-typography"><div class="lead">
@ -21,7 +21,7 @@ Note that this method can be slow.</p>
</div></div></li><li><h5>refresh: <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> = true</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p>Whether to refresh the cache.</p>
</div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><a href="../modules.html#PoolMap" class="tsd-signature-type" data-tsd-kind="Type alias">PoolMap</a><span class="tsd-signature-symbol">&gt;</span></h4><div><p>A <a href="../modules.html#PoolMap">PoolMap</a> of pool addresses to pool data.</p>
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-static"><a id="fetchTickArraysForPools" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span class="tsd-flag ts-flagStatic">Static</span> fetch<wbr/>Tick<wbr/>Arrays<wbr/>For<wbr/>Pools<a href="#fetchTickArraysForPools" 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">fetch<wbr/>Tick<wbr/>Arrays<wbr/>For<wbr/>Pools<span class="tsd-signature-symbol">(</span>ctx<span class="tsd-signature-symbol">: </span><a href="WhirlpoolContext.html" class="tsd-signature-type" data-tsd-kind="Class">WhirlpoolContext</a>, pools<span class="tsd-signature-symbol">: </span><a href="../modules.html#PoolMap" class="tsd-signature-type" data-tsd-kind="Type alias">PoolMap</a>, config<span class="tsd-signature-symbol">?: </span><a href="../modules.html#GetPricesConfig" class="tsd-signature-type" data-tsd-kind="Type alias">GetPricesConfig</a>, refresh<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">Promise</span><span class="tsd-signature-symbol">&lt;</span><a href="../modules.html#TickArrayMap" class="tsd-signature-type" data-tsd-kind="Type alias">TickArrayMap</a><span class="tsd-signature-symbol">&gt;</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/96e2185/sdk/src/prices/price-module.ts#L276">prices/price-module.ts:276</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-static"><a id="fetchTickArraysForPools" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span class="tsd-flag ts-flagStatic">Static</span> fetch<wbr/>Tick<wbr/>Arrays<wbr/>For<wbr/>Pools<a href="#fetchTickArraysForPools" 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">fetch<wbr/>Tick<wbr/>Arrays<wbr/>For<wbr/>Pools<span class="tsd-signature-symbol">(</span>ctx<span class="tsd-signature-symbol">: </span><a href="WhirlpoolContext.html" class="tsd-signature-type" data-tsd-kind="Class">WhirlpoolContext</a>, pools<span class="tsd-signature-symbol">: </span><a href="../modules.html#PoolMap" class="tsd-signature-type" data-tsd-kind="Type alias">PoolMap</a>, config<span class="tsd-signature-symbol">?: </span><a href="../modules.html#GetPricesConfig" class="tsd-signature-type" data-tsd-kind="Type alias">GetPricesConfig</a>, refresh<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">Promise</span><span class="tsd-signature-symbol">&lt;</span><a href="../modules.html#TickArrayMap" class="tsd-signature-type" data-tsd-kind="Type alias">TickArrayMap</a><span class="tsd-signature-symbol">&gt;</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/9e0a389/sdk/src/prices/price-module.ts#L276">prices/price-module.ts:276</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Fetch tick-array data for the given pools</p>
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>ctx: <a href="WhirlpoolContext.html" class="tsd-signature-type" data-tsd-kind="Class">WhirlpoolContext</a></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p><a href="../modules.html#WhirlpoolData">WhirlpoolData</a></p>

View File

@ -0,0 +1,25 @@
<!DOCTYPE html><html class="default"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>RouterUtils | @orca-so/whirlpools-sdk</title><meta name="description" content="Documentation for @orca-so/whirlpools-sdk"/><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">@orca-so/whirlpools-sdk</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">@orca-so/whirlpools-sdk</a></li><li><a href="RouterUtils.html">RouterUtils</a></li></ul><h1>Class RouterUtils </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 selection of utility functions for the <a href="../interfaces/WhirlpoolRouter.html">WhirlpoolRouter</a>.</p>
</div></div></section><section class="tsd-panel tsd-hierarchy"><h3>Hierarchy</h3><ul class="tsd-hierarchy"><li><span class="target">RouterUtils</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="RouterUtils.html#constructor" class="tsd-kind-icon">constructor</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-static"><a href="RouterUtils.html#getDefaultRouteOptions" class="tsd-kind-icon">get<wbr/>Default<wbr/>Route<wbr/>Options</a></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="RouterUtils.html#getDefaultSelectOptions" class="tsd-kind-icon">get<wbr/>Default<wbr/>Select<wbr/>Options</a></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="RouterUtils.html#getTouchedTickArraysFromRoute" class="tsd-kind-icon">get<wbr/>Touched<wbr/>Tick<wbr/>Arrays<wbr/>From<wbr/>Route</a></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="RouterUtils.html#selectFirstExecutableRoute" class="tsd-kind-icon">select<wbr/>First<wbr/>Executable<wbr/>Route</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/>Router<wbr/>Utils<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="RouterUtils.html" class="tsd-signature-type" data-tsd-kind="Class">RouterUtils</a></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><h4 class="tsd-returns-title">Returns <a href="RouterUtils.html" class="tsd-signature-type" data-tsd-kind="Class">RouterUtils</a></h4></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-static"><a id="getDefaultRouteOptions" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span class="tsd-flag ts-flagStatic">Static</span> get<wbr/>Default<wbr/>Route<wbr/>Options<a href="#getDefaultRouteOptions" 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">get<wbr/>Default<wbr/>Route<wbr/>Options<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="../modules.html#RoutingOptions" class="tsd-signature-type" data-tsd-kind="Type alias">RoutingOptions</a></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/9e0a389/sdk/src/router/public/router-utils.ts#L158">router/public/router-utils.ts:158</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Get the default options for generating trade routes.</p>
</div></div><h4 class="tsd-returns-title">Returns <a href="../modules.html#RoutingOptions" class="tsd-signature-type" data-tsd-kind="Type alias">RoutingOptions</a></h4><div><p>Default options for generating trade routes.</p>
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-static"><a id="getDefaultSelectOptions" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span class="tsd-flag ts-flagStatic">Static</span> get<wbr/>Default<wbr/>Select<wbr/>Options<a href="#getDefaultSelectOptions" 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">get<wbr/>Default<wbr/>Select<wbr/>Options<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="../modules.html#RouteSelectOptions" class="tsd-signature-type" data-tsd-kind="Type alias">RouteSelectOptions</a></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/9e0a389/sdk/src/router/public/router-utils.ts#L171">router/public/router-utils.ts:171</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Get the default options for selecting a route from a list of generated routes.</p>
</div></div><h4 class="tsd-returns-title">Returns <a href="../modules.html#RouteSelectOptions" class="tsd-signature-type" data-tsd-kind="Type alias">RouteSelectOptions</a></h4><div><p>Default options for selecting a a route from a list of generated routes.</p>
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-static"><a id="getTouchedTickArraysFromRoute" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span class="tsd-flag ts-flagStatic">Static</span> get<wbr/>Touched<wbr/>Tick<wbr/>Arrays<wbr/>From<wbr/>Route<a href="#getTouchedTickArraysFromRoute" 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">get<wbr/>Touched<wbr/>Tick<wbr/>Arrays<wbr/>From<wbr/>Route<span class="tsd-signature-symbol">(</span>route<span class="tsd-signature-symbol">: </span><a href="../modules.html#TradeRoute" class="tsd-signature-type" data-tsd-kind="Type alias">TradeRoute</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">PublicKey</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/orca-so/whirlpools/blob/9e0a389/sdk/src/router/public/router-utils.ts#L140">router/public/router-utils.ts:140</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Get the tick arrays addresses that are touched by a route.</p>
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>route: <a href="../modules.html#TradeRoute" class="tsd-signature-type" data-tsd-kind="Type alias">TradeRoute</a></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p>The route to get the tick arrays from.</p>
</div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">PublicKey</span><span class="tsd-signature-symbol">[]</span></h4><div><p>The tick arrays addresses that are touched by the route.</p>
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-static"><a id="selectFirstExecutableRoute" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span class="tsd-flag ts-flagStatic">Static</span> select<wbr/>First<wbr/>Executable<wbr/>Route<a href="#selectFirstExecutableRoute" 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">select<wbr/>First<wbr/>Executable<wbr/>Route<span class="tsd-signature-symbol">(</span>ctx<span class="tsd-signature-symbol">: </span><a href="WhirlpoolContext.html" class="tsd-signature-type" data-tsd-kind="Class">WhirlpoolContext</a>, orderedRoutes<span class="tsd-signature-symbol">: </span><a href="../modules.html#TradeRoute" class="tsd-signature-type" data-tsd-kind="Type alias">TradeRoute</a><span class="tsd-signature-symbol">[]</span>, opts<span class="tsd-signature-symbol">: </span><a href="../modules.html#RouteSelectOptions" class="tsd-signature-type" data-tsd-kind="Type alias">RouteSelectOptions</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><a href="../modules.html#ExecutableRoute" class="tsd-signature-type" data-tsd-kind="Type alias">ExecutableRoute</a><span class="tsd-signature-symbol">&gt;</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/9e0a389/sdk/src/router/public/router-utils.ts#L55">router/public/router-utils.ts:55</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Selects the best executable route from a list of routes using the current execution environment.
The wallet support type, available ATA accounts, existance of lookup tables all effect the transaction size
and eligibility of a route.</p>
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>ctx: <a href="WhirlpoolContext.html" class="tsd-signature-type" data-tsd-kind="Class">WhirlpoolContext</a></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p>The <a href="WhirlpoolContext.html">WhirlpoolContext</a> that represents the current execution environment</p>
</div></div></li><li><h5>orderedRoutes: <a href="../modules.html#TradeRoute" class="tsd-signature-type" data-tsd-kind="Type alias">TradeRoute</a><span class="tsd-signature-symbol">[]</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p>A list of routes to select from, ordered by the best routes (trade amount wise) first.</p>
</div></div></li><li><h5>opts: <a href="../modules.html#RouteSelectOptions" class="tsd-signature-type" data-tsd-kind="Type alias">RouteSelectOptions</a></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p><a href="../modules.html#RouteSelectOptions">RouteSelectOptions</a> to configure the selection of the best route.</p>
</div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><a href="../modules.html#ExecutableRoute" class="tsd-signature-type" data-tsd-kind="Type alias">ExecutableRoute</a><span class="tsd-signature-symbol">&gt;</span></h4><div><p>The best <a href="../modules.html#ExecutableRoute">ExecutableRoute</a> that can be used to execute a swap. If no executable route is found, null is returned.</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></ul></nav><nav class="tsd-navigation secondary menu-sticky"><ul><li class="current tsd-kind-class"><a href="RouterUtils.html" class="tsd-kind-icon">Router<wbr/>Utils</a><ul><li class="tsd-kind-constructor tsd-parent-kind-class"><a href="RouterUtils.html#constructor" class="tsd-kind-icon">constructor</a></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="RouterUtils.html#getDefaultRouteOptions" class="tsd-kind-icon">get<wbr/>Default<wbr/>Route<wbr/>Options</a></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="RouterUtils.html#getDefaultSelectOptions" class="tsd-kind-icon">get<wbr/>Default<wbr/>Select<wbr/>Options</a></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="RouterUtils.html#getTouchedTickArraysFromRoute" class="tsd-kind-icon">get<wbr/>Touched<wbr/>Tick<wbr/>Arrays<wbr/>From<wbr/>Route</a></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="RouterUtils.html#selectFirstExecutableRoute" class="tsd-kind-icon">select<wbr/>First<wbr/>Executable<wbr/>Route</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-property tsd-parent-kind-interface"><span class="tsd-kind-icon">Property</span></li><li class="tsd-kind-method tsd-parent-kind-interface"><span class="tsd-kind-icon">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></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>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,17 @@
<!DOCTYPE html><html class="default"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>WhirlpoolRouterBuilder | @orca-so/whirlpools-sdk</title><meta name="description" content="Documentation for @orca-so/whirlpools-sdk"/><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">@orca-so/whirlpools-sdk</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">@orca-so/whirlpools-sdk</a></li><li><a href="WhirlpoolRouterBuilder.html">WhirlpoolRouterBuilder</a></li></ul><h1>Class WhirlpoolRouterBuilder </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>Builder to build instances of the <a href="../interfaces/WhirlpoolRouter.html">WhirlpoolRouter</a></p>
</div></div></section><section class="tsd-panel tsd-hierarchy"><h3>Hierarchy</h3><ul class="tsd-hierarchy"><li><span class="target">WhirlpoolRouterBuilder</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="WhirlpoolRouterBuilder.html#constructor" class="tsd-kind-icon">constructor</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-static"><a href="WhirlpoolRouterBuilder.html#buildWithPoolGraph" class="tsd-kind-icon">build<wbr/>With<wbr/>Pool<wbr/>Graph</a></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="WhirlpoolRouterBuilder.html#buildWithPools" class="tsd-kind-icon">build<wbr/>With<wbr/>Pools</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/>Whirlpool<wbr/>Router<wbr/>Builder<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="WhirlpoolRouterBuilder.html" class="tsd-signature-type" data-tsd-kind="Class">WhirlpoolRouterBuilder</a></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><h4 class="tsd-returns-title">Returns <a href="WhirlpoolRouterBuilder.html" class="tsd-signature-type" data-tsd-kind="Class">WhirlpoolRouterBuilder</a></h4></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-static"><a id="buildWithPoolGraph" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span class="tsd-flag ts-flagStatic">Static</span> build<wbr/>With<wbr/>Pool<wbr/>Graph<a href="#buildWithPoolGraph" 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">build<wbr/>With<wbr/>Pool<wbr/>Graph<span class="tsd-signature-symbol">(</span>ctx<span class="tsd-signature-symbol">: </span><a href="WhirlpoolContext.html" class="tsd-signature-type" data-tsd-kind="Class">WhirlpoolContext</a>, graph<span class="tsd-signature-symbol">: </span><a href="../modules.html#PoolGraph" class="tsd-signature-type" data-tsd-kind="Type alias">PoolGraph</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="../interfaces/WhirlpoolRouter.html" class="tsd-signature-type" data-tsd-kind="Interface">WhirlpoolRouter</a></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/9e0a389/sdk/src/router/public/router-builder.ts#L19">router/public/router-builder.ts:19</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Builds a <a href="../interfaces/WhirlpoolRouter.html">WhirlpoolRouter</a> with a prebuilt <a href="../modules.html#PoolGraph">PoolGraph</a></p>
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>ctx: <a href="WhirlpoolContext.html" class="tsd-signature-type" data-tsd-kind="Class">WhirlpoolContext</a></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p>A <a href="WhirlpoolContext.html">WhirlpoolContext</a> for the current execution environment</p>
</div></div></li><li><h5>graph: <a href="../modules.html#PoolGraph" class="tsd-signature-type" data-tsd-kind="Type alias">PoolGraph</a></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p>A <a href="../modules.html#PoolGraph">PoolGraph</a> that represents the connections between all pools.</p>
</div></div></li></ul><h4 class="tsd-returns-title">Returns <a href="../interfaces/WhirlpoolRouter.html" class="tsd-signature-type" data-tsd-kind="Interface">WhirlpoolRouter</a></h4><div><p>A <a href="../interfaces/WhirlpoolRouter.html">WhirlpoolRouter</a> that can be used to find routes and execute swaps</p>
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-static"><a id="buildWithPools" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span class="tsd-flag ts-flagStatic">Static</span> build<wbr/>With<wbr/>Pools<a href="#buildWithPools" 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">build<wbr/>With<wbr/>Pools<span class="tsd-signature-symbol">(</span>ctx<span class="tsd-signature-symbol">: </span><a href="WhirlpoolContext.html" class="tsd-signature-type" data-tsd-kind="Class">WhirlpoolContext</a>, pools<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Address</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><a href="../interfaces/WhirlpoolRouter.html" class="tsd-signature-type" data-tsd-kind="Interface">WhirlpoolRouter</a><span class="tsd-signature-symbol">&gt;</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/9e0a389/sdk/src/router/public/router-builder.ts#L29">router/public/router-builder.ts:29</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Fetch and builds a <a href="../interfaces/WhirlpoolRouter.html">WhirlpoolRouter</a> with a list of pool addresses.</p>
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>ctx: <a href="WhirlpoolContext.html" class="tsd-signature-type" data-tsd-kind="Class">WhirlpoolContext</a></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p>A <a href="WhirlpoolContext.html">WhirlpoolContext</a> for the current execution environment</p>
</div></div></li><li><h5>pools: <span class="tsd-signature-type">Address</span><span class="tsd-signature-symbol">[]</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p>A list of {@link Address}es that the router will find routes through.</p>
</div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><a href="../interfaces/WhirlpoolRouter.html" class="tsd-signature-type" data-tsd-kind="Interface">WhirlpoolRouter</a><span class="tsd-signature-symbol">&gt;</span></h4><div><p>A <a href="../interfaces/WhirlpoolRouter.html">WhirlpoolRouter</a> that can be used to find routes and execute swaps</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></ul></nav><nav class="tsd-navigation secondary menu-sticky"><ul><li class="current tsd-kind-class"><a href="WhirlpoolRouterBuilder.html" class="tsd-kind-icon">Whirlpool<wbr/>Router<wbr/>Builder</a><ul><li class="tsd-kind-constructor tsd-parent-kind-class"><a href="WhirlpoolRouterBuilder.html#constructor" class="tsd-kind-icon">constructor</a></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="WhirlpoolRouterBuilder.html#buildWithPoolGraph" class="tsd-kind-icon">build<wbr/>With<wbr/>Pool<wbr/>Graph</a></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="WhirlpoolRouterBuilder.html#buildWithPools" class="tsd-kind-icon">build<wbr/>With<wbr/>Pools</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-property tsd-parent-kind-interface"><span class="tsd-kind-icon">Property</span></li><li class="tsd-kind-method tsd-parent-kind-interface"><span class="tsd-kind-icon">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></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>

File diff suppressed because one or more lines are too long

View File

@ -1,3 +1,3 @@
<!DOCTYPE html><html class="default"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>SwapDirection | @orca-so/whirlpools-sdk</title><meta name="description" content="Documentation for @orca-so/whirlpools-sdk"/><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">@orca-so/whirlpools-sdk</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">@orca-so/whirlpools-sdk</a></li><li><a href="SwapDirection.html">SwapDirection</a></li></ul><h1>Enumeration SwapDirection </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>An enum for the direction of a swap.</p>
</div></div></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>Enumeration Members</h3><ul class="tsd-index-list"><li class="tsd-kind-enum-member tsd-parent-kind-enum"><a href="SwapDirection.html#AtoB" class="tsd-kind-icon">AtoB</a></li><li class="tsd-kind-enum-member tsd-parent-kind-enum"><a href="SwapDirection.html#BtoA" class="tsd-kind-icon">BtoA</a></li></ul></section></div></section></section><section class="tsd-panel-group tsd-member-group "><h2>Enumeration Members</h2><section class="tsd-panel tsd-member tsd-kind-enum-member tsd-parent-kind-enum"><a id="AtoB" class="tsd-anchor"></a><h3 class="tsd-anchor-link">AtoB<a href="#AtoB" 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">AtoB<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">&quot;aToB&quot;</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/96e2185/sdk/src/utils/public/types.ts#L6">utils/public/types.ts:6</a></li></ul></aside></section><section class="tsd-panel tsd-member tsd-kind-enum-member tsd-parent-kind-enum"><a id="BtoA" class="tsd-anchor"></a><h3 class="tsd-anchor-link">BtoA<a href="#BtoA" 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">BtoA<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">&quot;bToA&quot;</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/96e2185/sdk/src/utils/public/types.ts#L7">utils/public/types.ts:7</a></li></ul></aside></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></ul></nav><nav class="tsd-navigation secondary menu-sticky"><ul><li class="current tsd-kind-enum"><a href="SwapDirection.html" class="tsd-kind-icon">Swap<wbr/>Direction</a><ul><li class="tsd-kind-enum-member tsd-parent-kind-enum"><a href="SwapDirection.html#AtoB" class="tsd-kind-icon">AtoB</a></li><li class="tsd-kind-enum-member tsd-parent-kind-enum"><a href="SwapDirection.html#BtoA" class="tsd-kind-icon">BtoA</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-property tsd-parent-kind-interface"><span class="tsd-kind-icon">Property</span></li><li class="tsd-kind-method tsd-parent-kind-interface"><span class="tsd-kind-icon">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></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>
</div></div></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>Enumeration Members</h3><ul class="tsd-index-list"><li class="tsd-kind-enum-member tsd-parent-kind-enum"><a href="SwapDirection.html#AtoB" class="tsd-kind-icon">AtoB</a></li><li class="tsd-kind-enum-member tsd-parent-kind-enum"><a href="SwapDirection.html#BtoA" class="tsd-kind-icon">BtoA</a></li></ul></section></div></section></section><section class="tsd-panel-group tsd-member-group "><h2>Enumeration Members</h2><section class="tsd-panel tsd-member tsd-kind-enum-member tsd-parent-kind-enum"><a id="AtoB" class="tsd-anchor"></a><h3 class="tsd-anchor-link">AtoB<a href="#AtoB" 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">AtoB<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">&quot;aToB&quot;</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/9e0a389/sdk/src/utils/public/types.ts#L6">utils/public/types.ts:6</a></li></ul></aside></section><section class="tsd-panel tsd-member tsd-kind-enum-member tsd-parent-kind-enum"><a id="BtoA" class="tsd-anchor"></a><h3 class="tsd-anchor-link">BtoA<a href="#BtoA" 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">BtoA<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">&quot;bToA&quot;</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/9e0a389/sdk/src/utils/public/types.ts#L7">utils/public/types.ts:7</a></li></ul></aside></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></ul></nav><nav class="tsd-navigation secondary menu-sticky"><ul><li class="current tsd-kind-enum"><a href="SwapDirection.html" class="tsd-kind-icon">Swap<wbr/>Direction</a><ul><li class="tsd-kind-enum-member tsd-parent-kind-enum"><a href="SwapDirection.html#AtoB" class="tsd-kind-icon">AtoB</a></li><li class="tsd-kind-enum-member tsd-parent-kind-enum"><a href="SwapDirection.html#BtoA" class="tsd-kind-icon">BtoA</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-property tsd-parent-kind-interface"><span class="tsd-kind-icon">Property</span></li><li class="tsd-kind-method tsd-parent-kind-interface"><span class="tsd-kind-icon">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></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>

View File

@ -1,3 +1,3 @@
<!DOCTYPE html><html class="default"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>TokenType | @orca-so/whirlpools-sdk</title><meta name="description" content="Documentation for @orca-so/whirlpools-sdk"/><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">@orca-so/whirlpools-sdk</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">@orca-so/whirlpools-sdk</a></li><li><a href="TokenType.html">TokenType</a></li></ul><h1>Enumeration TokenType </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>An enum for the token type in a Whirlpool.</p>
</div></div></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>Enumeration Members</h3><ul class="tsd-index-list"><li class="tsd-kind-enum-member tsd-parent-kind-enum"><a href="TokenType.html#TokenA" class="tsd-kind-icon">TokenA</a></li><li class="tsd-kind-enum-member tsd-parent-kind-enum"><a href="TokenType.html#TokenB" class="tsd-kind-icon">TokenB</a></li></ul></section></div></section></section><section class="tsd-panel-group tsd-member-group "><h2>Enumeration Members</h2><section class="tsd-panel tsd-member tsd-kind-enum-member tsd-parent-kind-enum"><a id="TokenA" class="tsd-anchor"></a><h3 class="tsd-anchor-link">TokenA<a href="#TokenA" 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">TokenA<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">1</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/96e2185/sdk/src/utils/public/types.ts#L15">utils/public/types.ts:15</a></li></ul></aside></section><section class="tsd-panel tsd-member tsd-kind-enum-member tsd-parent-kind-enum"><a id="TokenB" class="tsd-anchor"></a><h3 class="tsd-anchor-link">TokenB<a href="#TokenB" 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">TokenB<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">2</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/96e2185/sdk/src/utils/public/types.ts#L16">utils/public/types.ts:16</a></li></ul></aside></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></ul></nav><nav class="tsd-navigation secondary menu-sticky"><ul><li class="current tsd-kind-enum"><a href="TokenType.html" class="tsd-kind-icon">Token<wbr/>Type</a><ul><li class="tsd-kind-enum-member tsd-parent-kind-enum"><a href="TokenType.html#TokenA" class="tsd-kind-icon">TokenA</a></li><li class="tsd-kind-enum-member tsd-parent-kind-enum"><a href="TokenType.html#TokenB" class="tsd-kind-icon">TokenB</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-property tsd-parent-kind-interface"><span class="tsd-kind-icon">Property</span></li><li class="tsd-kind-method tsd-parent-kind-interface"><span class="tsd-kind-icon">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></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>
</div></div></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>Enumeration Members</h3><ul class="tsd-index-list"><li class="tsd-kind-enum-member tsd-parent-kind-enum"><a href="TokenType.html#TokenA" class="tsd-kind-icon">TokenA</a></li><li class="tsd-kind-enum-member tsd-parent-kind-enum"><a href="TokenType.html#TokenB" class="tsd-kind-icon">TokenB</a></li></ul></section></div></section></section><section class="tsd-panel-group tsd-member-group "><h2>Enumeration Members</h2><section class="tsd-panel tsd-member tsd-kind-enum-member tsd-parent-kind-enum"><a id="TokenA" class="tsd-anchor"></a><h3 class="tsd-anchor-link">TokenA<a href="#TokenA" 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">TokenA<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">1</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/9e0a389/sdk/src/utils/public/types.ts#L15">utils/public/types.ts:15</a></li></ul></aside></section><section class="tsd-panel tsd-member tsd-kind-enum-member tsd-parent-kind-enum"><a id="TokenB" class="tsd-anchor"></a><h3 class="tsd-anchor-link">TokenB<a href="#TokenB" 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">TokenB<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">2</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/9e0a389/sdk/src/utils/public/types.ts#L16">utils/public/types.ts:16</a></li></ul></aside></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></ul></nav><nav class="tsd-navigation secondary menu-sticky"><ul><li class="current tsd-kind-enum"><a href="TokenType.html" class="tsd-kind-icon">Token<wbr/>Type</a><ul><li class="tsd-kind-enum-member tsd-parent-kind-enum"><a href="TokenType.html#TokenA" class="tsd-kind-icon">TokenA</a></li><li class="tsd-kind-enum-member tsd-parent-kind-enum"><a href="TokenType.html#TokenB" class="tsd-kind-icon">TokenB</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-property tsd-parent-kind-interface"><span class="tsd-kind-icon">Property</span></li><li class="tsd-kind-method tsd-parent-kind-interface"><span class="tsd-kind-icon">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></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>

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
<!DOCTYPE html><html class="default"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>ParsableEntity | @orca-so/whirlpools-sdk</title><meta name="description" content="Documentation for @orca-so/whirlpools-sdk"/><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">@orca-so/whirlpools-sdk</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">@orca-so/whirlpools-sdk</a></li><li><a href="ParsableEntity.html">ParsableEntity</a></li></ul><h1>Interface ParsableEntity&lt;T&gt; </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>Static abstract class definition to parse entities.</p>
</div></div></section><section class="tsd-panel tsd-type-parameters"><h3>Type Parameters</h3><ul class="tsd-type-parameters"><li><h4>T</h4></li></ul></section><section class="tsd-panel tsd-hierarchy"><h3>Hierarchy</h3><ul class="tsd-hierarchy"><li><span class="target">ParsableEntity</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>Methods</h3><ul class="tsd-index-list"><li class="tsd-kind-method tsd-parent-kind-interface"><a href="ParsableEntity.html#parse" class="tsd-kind-icon">parse</a></li></ul></section></div></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-interface"><a id="parse" class="tsd-anchor"></a><h3 class="tsd-anchor-link">parse<a href="#parse" 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-interface"><li class="tsd-signature tsd-kind-icon">parse<span class="tsd-signature-symbol">(</span>accountData<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Buffer</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type" data-tsd-kind="Type parameter">T</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/96e2185/sdk/src/network/public/parsing.ts#L26">network/public/parsing.ts:26</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
</div></div></section><section class="tsd-panel tsd-type-parameters"><h3>Type Parameters</h3><ul class="tsd-type-parameters"><li><h4>T</h4></li></ul></section><section class="tsd-panel tsd-hierarchy"><h3>Hierarchy</h3><ul class="tsd-hierarchy"><li><span class="target">ParsableEntity</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>Methods</h3><ul class="tsd-index-list"><li class="tsd-kind-method tsd-parent-kind-interface"><a href="ParsableEntity.html#parse" class="tsd-kind-icon">parse</a></li></ul></section></div></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-interface"><a id="parse" class="tsd-anchor"></a><h3 class="tsd-anchor-link">parse<a href="#parse" 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-interface"><li class="tsd-signature tsd-kind-icon">parse<span class="tsd-signature-symbol">(</span>accountData<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Buffer</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type" data-tsd-kind="Type parameter">T</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/9e0a389/sdk/src/network/public/parsing.ts#L27">network/public/parsing.ts:27</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Parse account data</p>
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>accountData: <span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Buffer</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p>Buffer data for the entity</p>

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
<!DOCTYPE html><html class="default"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>Position | @orca-so/whirlpools-sdk</title><meta name="description" content="Documentation for @orca-so/whirlpools-sdk"/><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">@orca-so/whirlpools-sdk</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">@orca-so/whirlpools-sdk</a></li><li><a href="Position.html">Position</a></li></ul><h1>Interface Position </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>Helper class to interact with a Position account and build complex transactions.</p>
</div></div></section><section class="tsd-panel tsd-hierarchy"><h3>Hierarchy</h3><ul class="tsd-hierarchy"><li><span class="target">Position</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>Methods</h3><ul class="tsd-index-list"><li class="tsd-kind-method tsd-parent-kind-interface"><a href="Position.html#collectFees" class="tsd-kind-icon">collect<wbr/>Fees</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="Position.html#collectRewards" class="tsd-kind-icon">collect<wbr/>Rewards</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="Position.html#decreaseLiquidity" class="tsd-kind-icon">decrease<wbr/>Liquidity</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="Position.html#getAddress" class="tsd-kind-icon">get<wbr/>Address</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="Position.html#getData" class="tsd-kind-icon">get<wbr/>Data</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="Position.html#getLowerTickData" class="tsd-kind-icon">get<wbr/>Lower<wbr/>Tick<wbr/>Data</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="Position.html#getUpperTickData" class="tsd-kind-icon">get<wbr/>Upper<wbr/>Tick<wbr/>Data</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="Position.html#getWhirlpoolData" class="tsd-kind-icon">get<wbr/>Whirlpool<wbr/>Data</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="Position.html#increaseLiquidity" class="tsd-kind-icon">increase<wbr/>Liquidity</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="Position.html#refreshData" class="tsd-kind-icon">refresh<wbr/>Data</a></li></ul></section></div></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-interface"><a id="collectFees" class="tsd-anchor"></a><h3 class="tsd-anchor-link">collect<wbr/>Fees<a href="#collectFees" 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-interface"><li class="tsd-signature tsd-kind-icon">collect<wbr/>Fees<span class="tsd-signature-symbol">(</span>updateFeesAndRewards<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">boolean</span>, ownerTokenAccountMap<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">Record</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">Address</span><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">&gt;</span>, destinationWallet<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Address</span>, positionWallet<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Address</span>, ataPayer<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Address</span>, refresh<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">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">TransactionBuilder</span><span class="tsd-signature-symbol">&gt;</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/96e2185/sdk/src/whirlpool-client.ts#L376">whirlpool-client.ts:376</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
</div></div></section><section class="tsd-panel tsd-hierarchy"><h3>Hierarchy</h3><ul class="tsd-hierarchy"><li><span class="target">Position</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>Methods</h3><ul class="tsd-index-list"><li class="tsd-kind-method tsd-parent-kind-interface"><a href="Position.html#collectFees" class="tsd-kind-icon">collect<wbr/>Fees</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="Position.html#collectRewards" class="tsd-kind-icon">collect<wbr/>Rewards</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="Position.html#decreaseLiquidity" class="tsd-kind-icon">decrease<wbr/>Liquidity</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="Position.html#getAddress" class="tsd-kind-icon">get<wbr/>Address</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="Position.html#getData" class="tsd-kind-icon">get<wbr/>Data</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="Position.html#getLowerTickData" class="tsd-kind-icon">get<wbr/>Lower<wbr/>Tick<wbr/>Data</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="Position.html#getUpperTickData" class="tsd-kind-icon">get<wbr/>Upper<wbr/>Tick<wbr/>Data</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="Position.html#getWhirlpoolData" class="tsd-kind-icon">get<wbr/>Whirlpool<wbr/>Data</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="Position.html#increaseLiquidity" class="tsd-kind-icon">increase<wbr/>Liquidity</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="Position.html#refreshData" class="tsd-kind-icon">refresh<wbr/>Data</a></li></ul></section></div></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-interface"><a id="collectFees" class="tsd-anchor"></a><h3 class="tsd-anchor-link">collect<wbr/>Fees<a href="#collectFees" 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-interface"><li class="tsd-signature tsd-kind-icon">collect<wbr/>Fees<span class="tsd-signature-symbol">(</span>updateFeesAndRewards<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">boolean</span>, ownerTokenAccountMap<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">Record</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">Address</span><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">&gt;</span>, destinationWallet<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Address</span>, positionWallet<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Address</span>, ataPayer<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Address</span>, refresh<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">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">TransactionBuilder</span><span class="tsd-signature-symbol">&gt;</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/9e0a389/sdk/src/whirlpool-client.ts#L384">whirlpool-client.ts:384</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Collect fees from this position</p>
</div><div><p>If <code>positionWallet</code> is provided, the wallet owners have to sign this transaction.</p>
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag ts-flagOptional">Optional</span> updateFeesAndRewards: <span class="tsd-signature-type">boolean</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
@ -16,7 +16,7 @@
</div></div></li><li><h5><span class="tsd-flag ts-flagOptional">Optional</span> refresh: <span class="tsd-signature-type">boolean</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p>set to true to bypass cached on-chain data</p>
</div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">TransactionBuilder</span><span class="tsd-signature-symbol">&gt;</span></h4><div><p>the transaction that will collect fees from the position</p>
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface"><a id="collectRewards" class="tsd-anchor"></a><h3 class="tsd-anchor-link">collect<wbr/>Rewards<a href="#collectRewards" 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-interface"><li class="tsd-signature tsd-kind-icon">collect<wbr/>Rewards<span class="tsd-signature-symbol">(</span>rewardsToCollect<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Address</span><span class="tsd-signature-symbol">[]</span>, updateFeesAndRewards<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">boolean</span>, ownerTokenAccountMap<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">Record</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">Address</span><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">&gt;</span>, destinationWallet<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Address</span>, positionWallet<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Address</span>, ataPayer<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Address</span>, refresh<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">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">TransactionBuilder</span><span class="tsd-signature-symbol">&gt;</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/96e2185/sdk/src/whirlpool-client.ts#L399">whirlpool-client.ts:399</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface"><a id="collectRewards" class="tsd-anchor"></a><h3 class="tsd-anchor-link">collect<wbr/>Rewards<a href="#collectRewards" 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-interface"><li class="tsd-signature tsd-kind-icon">collect<wbr/>Rewards<span class="tsd-signature-symbol">(</span>rewardsToCollect<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Address</span><span class="tsd-signature-symbol">[]</span>, updateFeesAndRewards<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">boolean</span>, ownerTokenAccountMap<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">Record</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">Address</span><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">&gt;</span>, destinationWallet<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Address</span>, positionWallet<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Address</span>, ataPayer<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Address</span>, refresh<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">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">TransactionBuilder</span><span class="tsd-signature-symbol">&gt;</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/9e0a389/sdk/src/whirlpool-client.ts#L407">whirlpool-client.ts:407</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Collect rewards from this position</p>
</div><div><p>If <code>positionWallet</code> is provided, the wallet owners have to sign this transaction.</p>
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag ts-flagOptional">Optional</span> rewardsToCollect: <span class="tsd-signature-type">Address</span><span class="tsd-signature-symbol">[]</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
@ -34,7 +34,7 @@
</div></div></li><li><h5><span class="tsd-flag ts-flagOptional">Optional</span> refresh: <span class="tsd-signature-type">boolean</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p>set to true to bypass cached on-chain data</p>
</div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">TransactionBuilder</span><span class="tsd-signature-symbol">&gt;</span></h4><div><p>the transaction that will collect fees from the position</p>
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface"><a id="decreaseLiquidity" class="tsd-anchor"></a><h3 class="tsd-anchor-link">decrease<wbr/>Liquidity<a href="#decreaseLiquidity" 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-interface"><li class="tsd-signature tsd-kind-icon">decrease<wbr/>Liquidity<span class="tsd-signature-symbol">(</span>liquidityInput<span class="tsd-signature-symbol">: </span><a href="../modules.html#DecreaseLiquidityInput" class="tsd-signature-type" data-tsd-kind="Type alias">DecreaseLiquidityInput</a>, resolveATA<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">boolean</span>, destinationWallet<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Address</span>, positionWallet<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Address</span>, ataPayer<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Address</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">TransactionBuilder</span><span class="tsd-signature-symbol">&gt;</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/96e2185/sdk/src/whirlpool-client.ts#L355">whirlpool-client.ts:355</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface"><a id="decreaseLiquidity" class="tsd-anchor"></a><h3 class="tsd-anchor-link">decrease<wbr/>Liquidity<a href="#decreaseLiquidity" 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-interface"><li class="tsd-signature tsd-kind-icon">decrease<wbr/>Liquidity<span class="tsd-signature-symbol">(</span>liquidityInput<span class="tsd-signature-symbol">: </span><a href="../modules.html#DecreaseLiquidityInput" class="tsd-signature-type" data-tsd-kind="Type alias">DecreaseLiquidityInput</a>, resolveATA<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">boolean</span>, destinationWallet<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Address</span>, positionWallet<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Address</span>, ataPayer<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Address</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">TransactionBuilder</span><span class="tsd-signature-symbol">&gt;</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/9e0a389/sdk/src/whirlpool-client.ts#L363">whirlpool-client.ts:363</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Withdraw liquidity from this position.</p>
</div><div><p>If <code>positionWallet</code> is provided, the wallet owners have to sign this transaction.</p>
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>liquidityInput: <a href="../modules.html#DecreaseLiquidityInput" class="tsd-signature-type" data-tsd-kind="Type alias">DecreaseLiquidityInput</a></h5><div class="tsd-comment tsd-typography"><div class="lead">
@ -48,22 +48,22 @@
</div></div></li><li><h5><span class="tsd-flag ts-flagOptional">Optional</span> ataPayer: <span class="tsd-signature-type">Address</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p>wallet that will fund the creation of the new associated token accounts</p>
</div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">TransactionBuilder</span><span class="tsd-signature-symbol">&gt;</span></h4><div><p>the transaction that will deposit the tokens into the position when executed.</p>
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface"><a id="getAddress" class="tsd-anchor"></a><h3 class="tsd-anchor-link">get<wbr/>Address<a href="#getAddress" 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-interface"><li class="tsd-signature tsd-kind-icon">get<wbr/>Address<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">PublicKey</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/96e2185/sdk/src/whirlpool-client.ts#L291">whirlpool-client.ts:291</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface"><a id="getAddress" class="tsd-anchor"></a><h3 class="tsd-anchor-link">get<wbr/>Address<a href="#getAddress" 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-interface"><li class="tsd-signature tsd-kind-icon">get<wbr/>Address<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">PublicKey</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/9e0a389/sdk/src/whirlpool-client.ts#L299">whirlpool-client.ts:299</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Return the address for this Whirlpool instance.</p>
</div></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">PublicKey</span></h4><div><p>the PublicKey for this Whirlpool instance.</p>
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface"><a id="getData" class="tsd-anchor"></a><h3 class="tsd-anchor-link">get<wbr/>Data<a href="#getData" 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-interface"><li class="tsd-signature tsd-kind-icon">get<wbr/>Data<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="../modules.html#PositionData" class="tsd-signature-type" data-tsd-kind="Type alias">PositionData</a></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/96e2185/sdk/src/whirlpool-client.ts#L297">whirlpool-client.ts:297</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface"><a id="getData" class="tsd-anchor"></a><h3 class="tsd-anchor-link">get<wbr/>Data<a href="#getData" 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-interface"><li class="tsd-signature tsd-kind-icon">get<wbr/>Data<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="../modules.html#PositionData" class="tsd-signature-type" data-tsd-kind="Type alias">PositionData</a></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/9e0a389/sdk/src/whirlpool-client.ts#L305">whirlpool-client.ts:305</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Return the most recently fetched Position account data.</p>
</div></div><h4 class="tsd-returns-title">Returns <a href="../modules.html#PositionData" class="tsd-signature-type" data-tsd-kind="Type alias">PositionData</a></h4><div><p>most recently fetched PositionData for this address.</p>
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface"><a id="getLowerTickData" class="tsd-anchor"></a><h3 class="tsd-anchor-link">get<wbr/>Lower<wbr/>Tick<wbr/>Data<a href="#getLowerTickData" 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-interface"><li class="tsd-signature tsd-kind-icon">get<wbr/>Lower<wbr/>Tick<wbr/>Data<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="../modules.html#TickData" class="tsd-signature-type" data-tsd-kind="Type alias">TickData</a></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/96e2185/sdk/src/whirlpool-client.ts#L309">whirlpool-client.ts:309</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface"><a id="getLowerTickData" class="tsd-anchor"></a><h3 class="tsd-anchor-link">get<wbr/>Lower<wbr/>Tick<wbr/>Data<a href="#getLowerTickData" 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-interface"><li class="tsd-signature tsd-kind-icon">get<wbr/>Lower<wbr/>Tick<wbr/>Data<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="../modules.html#TickData" class="tsd-signature-type" data-tsd-kind="Type alias">TickData</a></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/9e0a389/sdk/src/whirlpool-client.ts#L317">whirlpool-client.ts:317</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Return the most recently fetched TickData account data for this position&#39;s lower tick.</p>
</div></div><h4 class="tsd-returns-title">Returns <a href="../modules.html#TickData" class="tsd-signature-type" data-tsd-kind="Type alias">TickData</a></h4><div><p>most recently fetched TickData for this position&#39;s lower tick.</p>
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface"><a id="getUpperTickData" class="tsd-anchor"></a><h3 class="tsd-anchor-link">get<wbr/>Upper<wbr/>Tick<wbr/>Data<a href="#getUpperTickData" 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-interface"><li class="tsd-signature tsd-kind-icon">get<wbr/>Upper<wbr/>Tick<wbr/>Data<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="../modules.html#TickData" class="tsd-signature-type" data-tsd-kind="Type alias">TickData</a></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/96e2185/sdk/src/whirlpool-client.ts#L315">whirlpool-client.ts:315</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface"><a id="getUpperTickData" class="tsd-anchor"></a><h3 class="tsd-anchor-link">get<wbr/>Upper<wbr/>Tick<wbr/>Data<a href="#getUpperTickData" 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-interface"><li class="tsd-signature tsd-kind-icon">get<wbr/>Upper<wbr/>Tick<wbr/>Data<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="../modules.html#TickData" class="tsd-signature-type" data-tsd-kind="Type alias">TickData</a></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/9e0a389/sdk/src/whirlpool-client.ts#L323">whirlpool-client.ts:323</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Return the most recently fetched TickData account data for this position&#39;s upper tick.</p>
</div></div><h4 class="tsd-returns-title">Returns <a href="../modules.html#TickData" class="tsd-signature-type" data-tsd-kind="Type alias">TickData</a></h4><div><p>most recently fetched TickData for this position&#39;s upper tick.</p>
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface"><a id="getWhirlpoolData" class="tsd-anchor"></a><h3 class="tsd-anchor-link">get<wbr/>Whirlpool<wbr/>Data<a href="#getWhirlpoolData" 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-interface"><li class="tsd-signature tsd-kind-icon">get<wbr/>Whirlpool<wbr/>Data<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="../modules.html#WhirlpoolData" class="tsd-signature-type" data-tsd-kind="Type alias">WhirlpoolData</a></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/96e2185/sdk/src/whirlpool-client.ts#L303">whirlpool-client.ts:303</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface"><a id="getWhirlpoolData" class="tsd-anchor"></a><h3 class="tsd-anchor-link">get<wbr/>Whirlpool<wbr/>Data<a href="#getWhirlpoolData" 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-interface"><li class="tsd-signature tsd-kind-icon">get<wbr/>Whirlpool<wbr/>Data<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="../modules.html#WhirlpoolData" class="tsd-signature-type" data-tsd-kind="Type alias">WhirlpoolData</a></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/9e0a389/sdk/src/whirlpool-client.ts#L311">whirlpool-client.ts:311</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Return the most recently fetched Whirlpool account data for this position.</p>
</div></div><h4 class="tsd-returns-title">Returns <a href="../modules.html#WhirlpoolData" class="tsd-signature-type" data-tsd-kind="Type alias">WhirlpoolData</a></h4><div><p>most recently fetched WhirlpoolData for this position.</p>
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface"><a id="increaseLiquidity" class="tsd-anchor"></a><h3 class="tsd-anchor-link">increase<wbr/>Liquidity<a href="#increaseLiquidity" 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-interface"><li class="tsd-signature tsd-kind-icon">increase<wbr/>Liquidity<span class="tsd-signature-symbol">(</span>liquidityInput<span class="tsd-signature-symbol">: </span><a href="../modules.html#IncreaseLiquidityInput" class="tsd-signature-type" data-tsd-kind="Type alias">IncreaseLiquidityInput</a>, resolveATA<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">boolean</span>, wallet<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Address</span>, positionWallet<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Address</span>, ataPayer<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Address</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">TransactionBuilder</span><span class="tsd-signature-symbol">&gt;</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/96e2185/sdk/src/whirlpool-client.ts#L335">whirlpool-client.ts:335</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface"><a id="increaseLiquidity" class="tsd-anchor"></a><h3 class="tsd-anchor-link">increase<wbr/>Liquidity<a href="#increaseLiquidity" 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-interface"><li class="tsd-signature tsd-kind-icon">increase<wbr/>Liquidity<span class="tsd-signature-symbol">(</span>liquidityInput<span class="tsd-signature-symbol">: </span><a href="../modules.html#IncreaseLiquidityInput" class="tsd-signature-type" data-tsd-kind="Type alias">IncreaseLiquidityInput</a>, resolveATA<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">boolean</span>, wallet<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Address</span>, positionWallet<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Address</span>, ataPayer<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Address</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">TransactionBuilder</span><span class="tsd-signature-symbol">&gt;</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/9e0a389/sdk/src/whirlpool-client.ts#L343">whirlpool-client.ts:343</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Deposit additional tokens into this postiion.
The wallet must contain the position token and the necessary token A &amp; B to complete the deposit.
If <code>positionWallet</code> and <code>wallet</code> is provided, the wallet owners have to sign this transaction.</p>
@ -78,7 +78,7 @@ If <code>positionWallet</code> and <code>wallet</code> is provided, the wallet
</div></div></li><li><h5><span class="tsd-flag ts-flagOptional">Optional</span> ataPayer: <span class="tsd-signature-type">Address</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p>wallet that will fund the creation of the new associated token accounts</p>
</div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">TransactionBuilder</span><span class="tsd-signature-symbol">&gt;</span></h4><div><p>the transaction that will deposit the tokens into the position when executed.</p>
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface"><a id="refreshData" class="tsd-anchor"></a><h3 class="tsd-anchor-link">refresh<wbr/>Data<a href="#refreshData" 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-interface"><li class="tsd-signature tsd-kind-icon">refresh<wbr/>Data<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><a href="../modules.html#PositionData" class="tsd-signature-type" data-tsd-kind="Type alias">PositionData</a><span class="tsd-signature-symbol">&gt;</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/96e2185/sdk/src/whirlpool-client.ts#L321">whirlpool-client.ts:321</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface"><a id="refreshData" class="tsd-anchor"></a><h3 class="tsd-anchor-link">refresh<wbr/>Data<a href="#refreshData" 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-interface"><li class="tsd-signature tsd-kind-icon">refresh<wbr/>Data<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><a href="../modules.html#PositionData" class="tsd-signature-type" data-tsd-kind="Type alias">PositionData</a><span class="tsd-signature-symbol">&gt;</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/9e0a389/sdk/src/whirlpool-client.ts#L329">whirlpool-client.ts:329</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Fetch and return the most recently fetched Position account data.</p>
</div></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><a href="../modules.html#PositionData" class="tsd-signature-type" data-tsd-kind="Type alias">PositionData</a><span class="tsd-signature-symbol">&gt;</span></h4><div><p>the most up to date PositionData for this address.</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></ul></nav><nav class="tsd-navigation secondary menu-sticky"><ul><li class="current tsd-kind-interface"><a href="Position.html" class="tsd-kind-icon">Position</a><ul><li class="tsd-kind-method tsd-parent-kind-interface"><a href="Position.html#collectFees" class="tsd-kind-icon">collect<wbr/>Fees</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="Position.html#collectRewards" class="tsd-kind-icon">collect<wbr/>Rewards</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="Position.html#decreaseLiquidity" class="tsd-kind-icon">decrease<wbr/>Liquidity</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="Position.html#getAddress" class="tsd-kind-icon">get<wbr/>Address</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="Position.html#getData" class="tsd-kind-icon">get<wbr/>Data</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="Position.html#getLowerTickData" class="tsd-kind-icon">get<wbr/>Lower<wbr/>Tick<wbr/>Data</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="Position.html#getUpperTickData" class="tsd-kind-icon">get<wbr/>Upper<wbr/>Tick<wbr/>Data</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="Position.html#getWhirlpoolData" class="tsd-kind-icon">get<wbr/>Whirlpool<wbr/>Data</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="Position.html#increaseLiquidity" class="tsd-kind-icon">increase<wbr/>Liquidity</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="Position.html#refreshData" class="tsd-kind-icon">refresh<wbr/>Data</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-property tsd-parent-kind-interface"><span class="tsd-kind-icon">Property</span></li><li class="tsd-kind-method tsd-parent-kind-interface"><span class="tsd-kind-icon">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></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>

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
<!DOCTYPE html><html class="default"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>Whirlpool | @orca-so/whirlpools-sdk</title><meta name="description" content="Documentation for @orca-so/whirlpools-sdk"/><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">@orca-so/whirlpools-sdk</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">@orca-so/whirlpools-sdk</a></li><li><a href="Whirlpool.html">Whirlpool</a></li></ul><h1>Interface Whirlpool </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>Helper class to interact with a Whirlpool account and build complex transactions.</p>
</div></div></section><section class="tsd-panel tsd-hierarchy"><h3>Hierarchy</h3><ul class="tsd-hierarchy"><li><span class="target">Whirlpool</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>Methods</h3><ul class="tsd-index-list"><li class="tsd-kind-method tsd-parent-kind-interface"><a href="Whirlpool.html#closePosition" class="tsd-kind-icon">close<wbr/>Position</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="Whirlpool.html#getAddress" class="tsd-kind-icon">get<wbr/>Address</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="Whirlpool.html#getData" class="tsd-kind-icon">get<wbr/>Data</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="Whirlpool.html#getRewardInfos" class="tsd-kind-icon">get<wbr/>Reward<wbr/>Infos</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="Whirlpool.html#getTokenAInfo" class="tsd-kind-icon">get<wbr/>TokenAInfo</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="Whirlpool.html#getTokenBInfo" class="tsd-kind-icon">get<wbr/>TokenBInfo</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="Whirlpool.html#getTokenVaultAInfo" class="tsd-kind-icon">get<wbr/>Token<wbr/>VaultAInfo</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="Whirlpool.html#getTokenVaultBInfo" class="tsd-kind-icon">get<wbr/>Token<wbr/>VaultBInfo</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="Whirlpool.html#initTickArrayForTicks" class="tsd-kind-icon">init<wbr/>Tick<wbr/>Array<wbr/>For<wbr/>Ticks</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="Whirlpool.html#openPosition" class="tsd-kind-icon">open<wbr/>Position</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="Whirlpool.html#openPositionWithMetadata" class="tsd-kind-icon">open<wbr/>Position<wbr/>With<wbr/>Metadata</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="Whirlpool.html#refreshData" class="tsd-kind-icon">refresh<wbr/>Data</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="Whirlpool.html#swap" class="tsd-kind-icon">swap</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="Whirlpool.html#swapWithDevFees" class="tsd-kind-icon">swap<wbr/>With<wbr/>Dev<wbr/>Fees</a></li></ul></section></div></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-interface"><a id="closePosition" class="tsd-anchor"></a><h3 class="tsd-anchor-link">close<wbr/>Position<a href="#closePosition" 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-interface"><li class="tsd-signature tsd-kind-icon">close<wbr/>Position<span class="tsd-signature-symbol">(</span>positionAddress<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Address</span>, slippageTolerance<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Percentage</span>, destinationWallet<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Address</span>, positionWallet<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Address</span>, payer<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Address</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">TransactionBuilder</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">&gt;</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/96e2185/sdk/src/whirlpool-client.ts#L248">whirlpool-client.ts:248</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
</div></div></section><section class="tsd-panel tsd-hierarchy"><h3>Hierarchy</h3><ul class="tsd-hierarchy"><li><span class="target">Whirlpool</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>Methods</h3><ul class="tsd-index-list"><li class="tsd-kind-method tsd-parent-kind-interface"><a href="Whirlpool.html#closePosition" class="tsd-kind-icon">close<wbr/>Position</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="Whirlpool.html#getAddress" class="tsd-kind-icon">get<wbr/>Address</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="Whirlpool.html#getData" class="tsd-kind-icon">get<wbr/>Data</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="Whirlpool.html#getRewardInfos" class="tsd-kind-icon">get<wbr/>Reward<wbr/>Infos</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="Whirlpool.html#getTokenAInfo" class="tsd-kind-icon">get<wbr/>TokenAInfo</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="Whirlpool.html#getTokenBInfo" class="tsd-kind-icon">get<wbr/>TokenBInfo</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="Whirlpool.html#getTokenVaultAInfo" class="tsd-kind-icon">get<wbr/>Token<wbr/>VaultAInfo</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="Whirlpool.html#getTokenVaultBInfo" class="tsd-kind-icon">get<wbr/>Token<wbr/>VaultBInfo</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="Whirlpool.html#initTickArrayForTicks" class="tsd-kind-icon">init<wbr/>Tick<wbr/>Array<wbr/>For<wbr/>Ticks</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="Whirlpool.html#openPosition" class="tsd-kind-icon">open<wbr/>Position</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="Whirlpool.html#openPositionWithMetadata" class="tsd-kind-icon">open<wbr/>Position<wbr/>With<wbr/>Metadata</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="Whirlpool.html#refreshData" class="tsd-kind-icon">refresh<wbr/>Data</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="Whirlpool.html#swap" class="tsd-kind-icon">swap</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="Whirlpool.html#swapWithDevFees" class="tsd-kind-icon">swap<wbr/>With<wbr/>Dev<wbr/>Fees</a></li></ul></section></div></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-interface"><a id="closePosition" class="tsd-anchor"></a><h3 class="tsd-anchor-link">close<wbr/>Position<a href="#closePosition" 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-interface"><li class="tsd-signature tsd-kind-icon">close<wbr/>Position<span class="tsd-signature-symbol">(</span>positionAddress<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Address</span>, slippageTolerance<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Percentage</span>, destinationWallet<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Address</span>, positionWallet<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Address</span>, payer<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Address</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">TransactionBuilder</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">&gt;</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/9e0a389/sdk/src/whirlpool-client.ts#L256">whirlpool-client.ts:256</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Withdraw all tokens from a position, close the account and burn the position token.</p>
</div><div><p>Users have to collect all fees and rewards from this position prior to closing the account.</p>
<p>If <code>positionWallet</code>, <code>payer</code> is provided, the wallet owner has to sign this transaction.</p>
@ -14,28 +14,28 @@
<p>The wallet that houses the position token that corresponds to this position address. If null, the WhirlpoolContext wallet is used.</p>
</div></div></li><li><h5><span class="tsd-flag ts-flagOptional">Optional</span> payer: <span class="tsd-signature-type">Address</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p>the wallet that will fund the cost needed to initialize the token ATA accounts. If null, the WhirlpoolContext wallet is used.</p>
</div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">TransactionBuilder</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">&gt;</span></h4></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface"><a id="getAddress" class="tsd-anchor"></a><h3 class="tsd-anchor-link">get<wbr/>Address<a href="#getAddress" 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-interface"><li class="tsd-signature tsd-kind-icon">get<wbr/>Address<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">PublicKey</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/96e2185/sdk/src/whirlpool-client.ts#L131">whirlpool-client.ts:131</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
</div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">TransactionBuilder</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">&gt;</span></h4></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface"><a id="getAddress" class="tsd-anchor"></a><h3 class="tsd-anchor-link">get<wbr/>Address<a href="#getAddress" 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-interface"><li class="tsd-signature tsd-kind-icon">get<wbr/>Address<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">PublicKey</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/9e0a389/sdk/src/whirlpool-client.ts#L139">whirlpool-client.ts:139</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Return the address for this Whirlpool instance.</p>
</div></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">PublicKey</span></h4><div><p>the PublicKey for this Whirlpool instance.</p>
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface"><a id="getData" class="tsd-anchor"></a><h3 class="tsd-anchor-link">get<wbr/>Data<a href="#getData" 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-interface"><li class="tsd-signature tsd-kind-icon">get<wbr/>Data<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="../modules.html#WhirlpoolData" class="tsd-signature-type" data-tsd-kind="Type alias">WhirlpoolData</a></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/96e2185/sdk/src/whirlpool-client.ts#L137">whirlpool-client.ts:137</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface"><a id="getData" class="tsd-anchor"></a><h3 class="tsd-anchor-link">get<wbr/>Data<a href="#getData" 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-interface"><li class="tsd-signature tsd-kind-icon">get<wbr/>Data<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="../modules.html#WhirlpoolData" class="tsd-signature-type" data-tsd-kind="Type alias">WhirlpoolData</a></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/9e0a389/sdk/src/whirlpool-client.ts#L145">whirlpool-client.ts:145</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Return the most recently fetched Whirlpool account data.</p>
</div></div><h4 class="tsd-returns-title">Returns <a href="../modules.html#WhirlpoolData" class="tsd-signature-type" data-tsd-kind="Type alias">WhirlpoolData</a></h4><div><p>most recently fetched WhirlpoolData for this address.</p>
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface"><a id="getRewardInfos" class="tsd-anchor"></a><h3 class="tsd-anchor-link">get<wbr/>Reward<wbr/>Infos<a href="#getRewardInfos" 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-interface"><li class="tsd-signature tsd-kind-icon">get<wbr/>Reward<wbr/>Infos<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="../modules.html#WhirlpoolRewardInfo" class="tsd-signature-type" data-tsd-kind="Type alias">WhirlpoolRewardInfo</a><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/orca-so/whirlpools/blob/96e2185/sdk/src/whirlpool-client.ts#L173">whirlpool-client.ts:173</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface"><a id="getRewardInfos" class="tsd-anchor"></a><h3 class="tsd-anchor-link">get<wbr/>Reward<wbr/>Infos<a href="#getRewardInfos" 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-interface"><li class="tsd-signature tsd-kind-icon">get<wbr/>Reward<wbr/>Infos<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="../modules.html#WhirlpoolRewardInfo" class="tsd-signature-type" data-tsd-kind="Type alias">WhirlpoolRewardInfo</a><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/orca-so/whirlpools/blob/9e0a389/sdk/src/whirlpool-client.ts#L181">whirlpool-client.ts:181</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Get the WhirlpoolRewardInfos for this pool.</p>
</div></div><h4 class="tsd-returns-title">Returns <a href="../modules.html#WhirlpoolRewardInfo" class="tsd-signature-type" data-tsd-kind="Type alias">WhirlpoolRewardInfo</a><span class="tsd-signature-symbol">[]</span></h4><div><p>Array of 3 WhirlpoolRewardInfos. However, not all of them may be initialized. Use the initialized field on WhirlpoolRewardInfo to check if the reward is active.</p>
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface"><a id="getTokenAInfo" class="tsd-anchor"></a><h3 class="tsd-anchor-link">get<wbr/>TokenAInfo<a href="#getTokenAInfo" 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-interface"><li class="tsd-signature tsd-kind-icon">get<wbr/>TokenAInfo<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="../modules.html#TokenInfo" class="tsd-signature-type" data-tsd-kind="Type alias">TokenInfo</a></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/96e2185/sdk/src/whirlpool-client.ts#L149">whirlpool-client.ts:149</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface"><a id="getTokenAInfo" class="tsd-anchor"></a><h3 class="tsd-anchor-link">get<wbr/>TokenAInfo<a href="#getTokenAInfo" 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-interface"><li class="tsd-signature tsd-kind-icon">get<wbr/>TokenAInfo<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="../modules.html#TokenInfo" class="tsd-signature-type" data-tsd-kind="Type alias">TokenInfo</a></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/9e0a389/sdk/src/whirlpool-client.ts#L157">whirlpool-client.ts:157</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Get the TokenInfo for token A of this pool.</p>
</div></div><h4 class="tsd-returns-title">Returns <a href="../modules.html#TokenInfo" class="tsd-signature-type" data-tsd-kind="Type alias">TokenInfo</a></h4><div><p>TokenInfo for token A</p>
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface"><a id="getTokenBInfo" class="tsd-anchor"></a><h3 class="tsd-anchor-link">get<wbr/>TokenBInfo<a href="#getTokenBInfo" 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-interface"><li class="tsd-signature tsd-kind-icon">get<wbr/>TokenBInfo<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="../modules.html#TokenInfo" class="tsd-signature-type" data-tsd-kind="Type alias">TokenInfo</a></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/96e2185/sdk/src/whirlpool-client.ts#L155">whirlpool-client.ts:155</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface"><a id="getTokenBInfo" class="tsd-anchor"></a><h3 class="tsd-anchor-link">get<wbr/>TokenBInfo<a href="#getTokenBInfo" 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-interface"><li class="tsd-signature tsd-kind-icon">get<wbr/>TokenBInfo<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="../modules.html#TokenInfo" class="tsd-signature-type" data-tsd-kind="Type alias">TokenInfo</a></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/9e0a389/sdk/src/whirlpool-client.ts#L163">whirlpool-client.ts:163</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Get the TokenInfo for token B of this pool.</p>
</div></div><h4 class="tsd-returns-title">Returns <a href="../modules.html#TokenInfo" class="tsd-signature-type" data-tsd-kind="Type alias">TokenInfo</a></h4><div><p>TokenInfo for token B</p>
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface"><a id="getTokenVaultAInfo" class="tsd-anchor"></a><h3 class="tsd-anchor-link">get<wbr/>Token<wbr/>VaultAInfo<a href="#getTokenVaultAInfo" 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-interface"><li class="tsd-signature tsd-kind-icon">get<wbr/>Token<wbr/>VaultAInfo<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">AccountInfo</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/96e2185/sdk/src/whirlpool-client.ts#L161">whirlpool-client.ts:161</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface"><a id="getTokenVaultAInfo" class="tsd-anchor"></a><h3 class="tsd-anchor-link">get<wbr/>Token<wbr/>VaultAInfo<a href="#getTokenVaultAInfo" 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-interface"><li class="tsd-signature tsd-kind-icon">get<wbr/>Token<wbr/>VaultAInfo<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">AccountInfo</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/9e0a389/sdk/src/whirlpool-client.ts#L169">whirlpool-client.ts:169</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Get the TokenAccountInfo for token vault A of this pool.</p>
</div></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">AccountInfo</span></h4><div><p>TokenAccountInfo for token vault A</p>
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface"><a id="getTokenVaultBInfo" class="tsd-anchor"></a><h3 class="tsd-anchor-link">get<wbr/>Token<wbr/>VaultBInfo<a href="#getTokenVaultBInfo" 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-interface"><li class="tsd-signature tsd-kind-icon">get<wbr/>Token<wbr/>VaultBInfo<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">AccountInfo</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/96e2185/sdk/src/whirlpool-client.ts#L167">whirlpool-client.ts:167</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface"><a id="getTokenVaultBInfo" class="tsd-anchor"></a><h3 class="tsd-anchor-link">get<wbr/>Token<wbr/>VaultBInfo<a href="#getTokenVaultBInfo" 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-interface"><li class="tsd-signature tsd-kind-icon">get<wbr/>Token<wbr/>VaultBInfo<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">AccountInfo</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/9e0a389/sdk/src/whirlpool-client.ts#L175">whirlpool-client.ts:175</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Get the TokenAccountInfo for token vault B of this pool.</p>
</div></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">AccountInfo</span></h4><div><p>TokenAccountInfo for token vault B</p>
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface"><a id="initTickArrayForTicks" class="tsd-anchor"></a><h3 class="tsd-anchor-link">init<wbr/>Tick<wbr/>Array<wbr/>For<wbr/>Ticks<a href="#initTickArrayForTicks" 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-interface"><li class="tsd-signature tsd-kind-icon">init<wbr/>Tick<wbr/>Array<wbr/>For<wbr/>Ticks<span class="tsd-signature-symbol">(</span>ticks<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span>, funder<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Address</span>, refresh<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">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">TransactionBuilder</span><span class="tsd-signature-symbol">&gt;</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/96e2185/sdk/src/whirlpool-client.ts#L185">whirlpool-client.ts:185</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface"><a id="initTickArrayForTicks" class="tsd-anchor"></a><h3 class="tsd-anchor-link">init<wbr/>Tick<wbr/>Array<wbr/>For<wbr/>Ticks<a href="#initTickArrayForTicks" 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-interface"><li class="tsd-signature tsd-kind-icon">init<wbr/>Tick<wbr/>Array<wbr/>For<wbr/>Ticks<span class="tsd-signature-symbol">(</span>ticks<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span>, funder<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Address</span>, refresh<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">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">TransactionBuilder</span><span class="tsd-signature-symbol">&gt;</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/9e0a389/sdk/src/whirlpool-client.ts#L193">whirlpool-client.ts:193</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Initialize a set of tick-arrays that encompasses the provided ticks.</p>
</div><div><p>If <code>funder</code> is provided, the funder wallet has to sign this transaction.</p>
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>ticks: <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
@ -45,7 +45,7 @@
</div></div></li><li><h5><span class="tsd-flag ts-flagOptional">Optional</span> refresh: <span class="tsd-signature-type">boolean</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p>whether this operation will fetch for the latest accounts if a cache version is available.</p>
</div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">TransactionBuilder</span><span class="tsd-signature-symbol">&gt;</span></h4><div><p>a transaction that will initialize the defined tick-arrays if executed. Return null if all of the tick&#39;s arrays are initialized.</p>
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface"><a id="openPosition" class="tsd-anchor"></a><h3 class="tsd-anchor-link">open<wbr/>Position<a href="#openPosition" 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-interface"><li class="tsd-signature tsd-kind-icon">open<wbr/>Position<span class="tsd-signature-symbol">(</span>tickLower<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span>, tickUpper<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span>, liquidityInput<span class="tsd-signature-symbol">: </span><a href="../modules.html#IncreaseLiquidityInput" class="tsd-signature-type" data-tsd-kind="Type alias">IncreaseLiquidityInput</a>, wallet<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Address</span>, funder<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Address</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-symbol">{ </span>positionMint<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">PublicKey</span><span class="tsd-signature-symbol">; </span>tx<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">TransactionBuilder</span><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol">&gt;</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/96e2185/sdk/src/whirlpool-client.ts#L205">whirlpool-client.ts:205</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface"><a id="openPosition" class="tsd-anchor"></a><h3 class="tsd-anchor-link">open<wbr/>Position<a href="#openPosition" 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-interface"><li class="tsd-signature tsd-kind-icon">open<wbr/>Position<span class="tsd-signature-symbol">(</span>tickLower<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span>, tickUpper<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span>, liquidityInput<span class="tsd-signature-symbol">: </span><a href="../modules.html#IncreaseLiquidityInput" class="tsd-signature-type" data-tsd-kind="Type alias">IncreaseLiquidityInput</a>, wallet<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Address</span>, funder<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Address</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-symbol">{ </span>positionMint<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">PublicKey</span><span class="tsd-signature-symbol">; </span>tx<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">TransactionBuilder</span><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol">&gt;</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/9e0a389/sdk/src/whirlpool-client.ts#L213">whirlpool-client.ts:213</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Open and fund a position on this Whirlpool.</p>
</div><div><p>User has to ensure the TickArray for tickLower and tickUpper has been initialized prior to calling this function.</p>
<p>If <code>wallet</code> or <code>funder</code> is provided, those wallets have to sign this transaction.</p>
@ -60,7 +60,7 @@
</div></div></li><li><h5><span class="tsd-flag ts-flagOptional">Optional</span> funder: <span class="tsd-signature-type">Address</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p>the wallet that will fund the cost needed to initialize the position. If null, the WhirlpoolContext wallet is used.</p>
</div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-symbol">{ </span>positionMint<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">PublicKey</span><span class="tsd-signature-symbol">; </span>tx<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">TransactionBuilder</span><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol">&gt;</span></h4><div><p><code>positionMint</code> - the position to be created. <code>tx</code> - The transaction containing the instructions to perform the operation on chain.</p>
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface"><a id="openPositionWithMetadata" class="tsd-anchor"></a><h3 class="tsd-anchor-link">open<wbr/>Position<wbr/>With<wbr/>Metadata<a href="#openPositionWithMetadata" 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-interface"><li class="tsd-signature tsd-kind-icon">open<wbr/>Position<wbr/>With<wbr/>Metadata<span class="tsd-signature-symbol">(</span>tickLower<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span>, tickUpper<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span>, liquidityInput<span class="tsd-signature-symbol">: </span><a href="../modules.html#IncreaseLiquidityInput" class="tsd-signature-type" data-tsd-kind="Type alias">IncreaseLiquidityInput</a>, wallet<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Address</span>, funder<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Address</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-symbol">{ </span>positionMint<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">PublicKey</span><span class="tsd-signature-symbol">; </span>tx<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">TransactionBuilder</span><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol">&gt;</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/96e2185/sdk/src/whirlpool-client.ts#L227">whirlpool-client.ts:227</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface"><a id="openPositionWithMetadata" class="tsd-anchor"></a><h3 class="tsd-anchor-link">open<wbr/>Position<wbr/>With<wbr/>Metadata<a href="#openPositionWithMetadata" 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-interface"><li class="tsd-signature tsd-kind-icon">open<wbr/>Position<wbr/>With<wbr/>Metadata<span class="tsd-signature-symbol">(</span>tickLower<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span>, tickUpper<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span>, liquidityInput<span class="tsd-signature-symbol">: </span><a href="../modules.html#IncreaseLiquidityInput" class="tsd-signature-type" data-tsd-kind="Type alias">IncreaseLiquidityInput</a>, wallet<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Address</span>, funder<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Address</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-symbol">{ </span>positionMint<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">PublicKey</span><span class="tsd-signature-symbol">; </span>tx<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">TransactionBuilder</span><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol">&gt;</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/9e0a389/sdk/src/whirlpool-client.ts#L235">whirlpool-client.ts:235</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Open and fund a position with meta-data on this Whirlpool.</p>
</div><div><p>User has to ensure the TickArray for tickLower and tickUpper has been initialized prior to calling this function.</p>
<p>If <code>wallet</code> or <code>funder</code> is provided, the wallet owners have to sign this transaction.</p>
@ -75,17 +75,17 @@
</div></div></li><li><h5><span class="tsd-flag ts-flagOptional">Optional</span> funder: <span class="tsd-signature-type">Address</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p>the wallet that will fund the cost needed to initialize the position. If null, the WhirlpoolContext wallet is used.</p>
</div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-symbol">{ </span>positionMint<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">PublicKey</span><span class="tsd-signature-symbol">; </span>tx<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">TransactionBuilder</span><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol">&gt;</span></h4><div><p><code>positionMint</code> - the position to be created. <code>tx</code> - The transaction containing the instructions to perform the operation on chain.</p>
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface"><a id="refreshData" class="tsd-anchor"></a><h3 class="tsd-anchor-link">refresh<wbr/>Data<a href="#refreshData" 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-interface"><li class="tsd-signature tsd-kind-icon">refresh<wbr/>Data<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><a href="../modules.html#WhirlpoolData" class="tsd-signature-type" data-tsd-kind="Type alias">WhirlpoolData</a><span class="tsd-signature-symbol">&gt;</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/96e2185/sdk/src/whirlpool-client.ts#L143">whirlpool-client.ts:143</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface"><a id="refreshData" class="tsd-anchor"></a><h3 class="tsd-anchor-link">refresh<wbr/>Data<a href="#refreshData" 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-interface"><li class="tsd-signature tsd-kind-icon">refresh<wbr/>Data<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><a href="../modules.html#WhirlpoolData" class="tsd-signature-type" data-tsd-kind="Type alias">WhirlpoolData</a><span class="tsd-signature-symbol">&gt;</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/9e0a389/sdk/src/whirlpool-client.ts#L151">whirlpool-client.ts:151</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Fetch and return the most recently fetched Whirlpool account data.</p>
</div></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><a href="../modules.html#WhirlpoolData" class="tsd-signature-type" data-tsd-kind="Type alias">WhirlpoolData</a><span class="tsd-signature-symbol">&gt;</span></h4><div><p>the most up to date WhirlpoolData for this address.</p>
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface"><a id="swap" class="tsd-anchor"></a><h3 class="tsd-anchor-link">swap<a href="#swap" 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-interface"><li class="tsd-signature tsd-kind-icon">swap<span class="tsd-signature-symbol">(</span>input<span class="tsd-signature-symbol">: </span><a href="../modules.html#SwapInput" class="tsd-signature-type" data-tsd-kind="Type alias">SwapInput</a>, wallet<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">PublicKey</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">TransactionBuilder</span><span class="tsd-signature-symbol">&gt;</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/96e2185/sdk/src/whirlpool-client.ts#L263">whirlpool-client.ts:263</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface"><a id="swap" class="tsd-anchor"></a><h3 class="tsd-anchor-link">swap<a href="#swap" 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-interface"><li class="tsd-signature tsd-kind-icon">swap<span class="tsd-signature-symbol">(</span>input<span class="tsd-signature-symbol">: </span><a href="../modules.html#SwapInput" class="tsd-signature-type" data-tsd-kind="Type alias">SwapInput</a>, wallet<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">PublicKey</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">TransactionBuilder</span><span class="tsd-signature-symbol">&gt;</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/9e0a389/sdk/src/whirlpool-client.ts#L271">whirlpool-client.ts:271</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Perform a swap between tokenA and tokenB on this pool.</p>
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>input: <a href="../modules.html#SwapInput" class="tsd-signature-type" data-tsd-kind="Type alias">SwapInput</a></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p>A quote on the desired tokenIn and tokenOut for this swap. Use <a href="../modules.html#swapQuoteWithParams">swapQuoteWithParams</a> or other swap quote functions to generate this object.</p>
</div></div></li><li><h5><span class="tsd-flag ts-flagOptional">Optional</span> wallet: <span class="tsd-signature-type">PublicKey</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p>The wallet that tokens will be withdrawn and deposit into. If null, the WhirlpoolContext wallet is used.</p>
</div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">TransactionBuilder</span><span class="tsd-signature-symbol">&gt;</span></h4><div><p>a transaction that will perform the swap once executed.</p>
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface"><a id="swapWithDevFees" class="tsd-anchor"></a><h3 class="tsd-anchor-link">swap<wbr/>With<wbr/>Dev<wbr/>Fees<a href="#swapWithDevFees" 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-interface"><li class="tsd-signature tsd-kind-icon">swap<wbr/>With<wbr/>Dev<wbr/>Fees<span class="tsd-signature-symbol">(</span>input<span class="tsd-signature-symbol">: </span><a href="../modules.html#DevFeeSwapInput" class="tsd-signature-type" data-tsd-kind="Type alias">DevFeeSwapInput</a>, devFeeWallet<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">PublicKey</span>, wallet<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">PublicKey</span>, payer<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">PublicKey</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">TransactionBuilder</span><span class="tsd-signature-symbol">&gt;</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/96e2185/sdk/src/whirlpool-client.ts#L274">whirlpool-client.ts:274</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface"><a id="swapWithDevFees" class="tsd-anchor"></a><h3 class="tsd-anchor-link">swap<wbr/>With<wbr/>Dev<wbr/>Fees<a href="#swapWithDevFees" 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-interface"><li class="tsd-signature tsd-kind-icon">swap<wbr/>With<wbr/>Dev<wbr/>Fees<span class="tsd-signature-symbol">(</span>input<span class="tsd-signature-symbol">: </span><a href="../modules.html#DevFeeSwapInput" class="tsd-signature-type" data-tsd-kind="Type alias">DevFeeSwapInput</a>, devFeeWallet<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">PublicKey</span>, wallet<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">PublicKey</span>, payer<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">PublicKey</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">TransactionBuilder</span><span class="tsd-signature-symbol">&gt;</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/9e0a389/sdk/src/whirlpool-client.ts#L282">whirlpool-client.ts:282</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Collect a developer fee and perform a swap between tokenA and tokenB on this pool.</p>
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>input: <a href="../modules.html#DevFeeSwapInput" class="tsd-signature-type" data-tsd-kind="Type alias">DevFeeSwapInput</a></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p>A quote on the desired tokenIn and tokenOut for this swap. Use <a href="../modules.html#swapQuoteByInputTokenWithDevFees">swapQuoteByInputTokenWithDevFees</a> to generate this object.</p>

View File

@ -1,16 +1,16 @@
<!DOCTYPE html><html class="default"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>WhirlpoolClient | @orca-so/whirlpools-sdk</title><meta name="description" content="Documentation for @orca-so/whirlpools-sdk"/><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">@orca-so/whirlpools-sdk</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">@orca-so/whirlpools-sdk</a></li><li><a href="WhirlpoolClient.html">WhirlpoolClient</a></li></ul><h1>Interface WhirlpoolClient </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>Helper class to help interact with Whirlpool Accounts with a simpler interface.</p>
</div></div></section><section class="tsd-panel tsd-hierarchy"><h3>Hierarchy</h3><ul class="tsd-hierarchy"><li><span class="target">WhirlpoolClient</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>Methods</h3><ul class="tsd-index-list"><li class="tsd-kind-method tsd-parent-kind-interface"><a href="WhirlpoolClient.html#collectFeesAndRewardsForPositions" class="tsd-kind-icon">collect<wbr/>Fees<wbr/>And<wbr/>Rewards<wbr/>For<wbr/>Positions</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="WhirlpoolClient.html#collectProtocolFeesForPools" class="tsd-kind-icon">collect<wbr/>Protocol<wbr/>Fees<wbr/>For<wbr/>Pools</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="WhirlpoolClient.html#createPool" class="tsd-kind-icon">create<wbr/>Pool</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="WhirlpoolClient.html#getContext" class="tsd-kind-icon">get<wbr/>Context</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="WhirlpoolClient.html#getFetcher" class="tsd-kind-icon">get<wbr/>Fetcher</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="WhirlpoolClient.html#getPool" class="tsd-kind-icon">get<wbr/>Pool</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="WhirlpoolClient.html#getPools" class="tsd-kind-icon">get<wbr/>Pools</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="WhirlpoolClient.html#getPosition" class="tsd-kind-icon">get<wbr/>Position</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="WhirlpoolClient.html#getPositions" class="tsd-kind-icon">get<wbr/>Positions</a></li></ul></section></div></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-interface"><a id="collectFeesAndRewardsForPositions" class="tsd-anchor"></a><h3 class="tsd-anchor-link">collect<wbr/>Fees<wbr/>And<wbr/>Rewards<wbr/>For<wbr/>Positions<a href="#collectFeesAndRewardsForPositions" 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-interface"><li class="tsd-signature tsd-kind-icon">collect<wbr/>Fees<wbr/>And<wbr/>Rewards<wbr/>For<wbr/>Positions<span class="tsd-signature-symbol">(</span>positionAddresses<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Address</span><span class="tsd-signature-symbol">[]</span>, refresh<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">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">TransactionBuilder</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">&gt;</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/96e2185/sdk/src/whirlpool-client.ts#L78">whirlpool-client.ts:78</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
</div></div></section><section class="tsd-panel tsd-hierarchy"><h3>Hierarchy</h3><ul class="tsd-hierarchy"><li><span class="target">WhirlpoolClient</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>Methods</h3><ul class="tsd-index-list"><li class="tsd-kind-method tsd-parent-kind-interface"><a href="WhirlpoolClient.html#collectFeesAndRewardsForPositions" class="tsd-kind-icon">collect<wbr/>Fees<wbr/>And<wbr/>Rewards<wbr/>For<wbr/>Positions</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="WhirlpoolClient.html#collectProtocolFeesForPools" class="tsd-kind-icon">collect<wbr/>Protocol<wbr/>Fees<wbr/>For<wbr/>Pools</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="WhirlpoolClient.html#createPool" class="tsd-kind-icon">create<wbr/>Pool</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="WhirlpoolClient.html#getContext" class="tsd-kind-icon">get<wbr/>Context</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="WhirlpoolClient.html#getFetcher" class="tsd-kind-icon">get<wbr/>Fetcher</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="WhirlpoolClient.html#getPool" class="tsd-kind-icon">get<wbr/>Pool</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="WhirlpoolClient.html#getPools" class="tsd-kind-icon">get<wbr/>Pools</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="WhirlpoolClient.html#getPosition" class="tsd-kind-icon">get<wbr/>Position</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="WhirlpoolClient.html#getPositions" class="tsd-kind-icon">get<wbr/>Positions</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="WhirlpoolClient.html#getRouter" class="tsd-kind-icon">get<wbr/>Router</a></li></ul></section></div></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-interface"><a id="collectFeesAndRewardsForPositions" class="tsd-anchor"></a><h3 class="tsd-anchor-link">collect<wbr/>Fees<wbr/>And<wbr/>Rewards<wbr/>For<wbr/>Positions<a href="#collectFeesAndRewardsForPositions" 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-interface"><li class="tsd-signature tsd-kind-icon">collect<wbr/>Fees<wbr/>And<wbr/>Rewards<wbr/>For<wbr/>Positions<span class="tsd-signature-symbol">(</span>positionAddresses<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Address</span><span class="tsd-signature-symbol">[]</span>, refresh<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">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">TransactionBuilder</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">&gt;</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/9e0a389/sdk/src/whirlpool-client.ts#L86">whirlpool-client.ts:86</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Collect all fees and rewards from a list of positions.</p>
</div><dl class="tsd-comment-tags"><dt>experimental</dt><dd></dd></dl></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>positionAddresses: <span class="tsd-signature-type">Address</span><span class="tsd-signature-symbol">[]</span></h5></li><li><h5><span class="tsd-flag ts-flagOptional">Optional</span> refresh: <span class="tsd-signature-type">boolean</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p>true to always request newest data from chain with this request</p>
</div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">TransactionBuilder</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">&gt;</span></h4><div><p>A set of transaction-builders to resolve ATA for affliated tokens, collect fee &amp; rewards for all positions.</p>
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface"><a id="collectProtocolFeesForPools" class="tsd-anchor"></a><h3 class="tsd-anchor-link">collect<wbr/>Protocol<wbr/>Fees<wbr/>For<wbr/>Pools<a href="#collectProtocolFeesForPools" 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-interface"><li class="tsd-signature tsd-kind-icon">collect<wbr/>Protocol<wbr/>Fees<wbr/>For<wbr/>Pools<span class="tsd-signature-symbol">(</span>poolAddresses<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Address</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">TransactionBuilder</span><span class="tsd-signature-symbol">&gt;</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/96e2185/sdk/src/whirlpool-client.ts#L108">whirlpool-client.ts:108</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface"><a id="collectProtocolFeesForPools" class="tsd-anchor"></a><h3 class="tsd-anchor-link">collect<wbr/>Protocol<wbr/>Fees<wbr/>For<wbr/>Pools<a href="#collectProtocolFeesForPools" 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-interface"><li class="tsd-signature tsd-kind-icon">collect<wbr/>Protocol<wbr/>Fees<wbr/>For<wbr/>Pools<span class="tsd-signature-symbol">(</span>poolAddresses<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Address</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">TransactionBuilder</span><span class="tsd-signature-symbol">&gt;</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/9e0a389/sdk/src/whirlpool-client.ts#L116">whirlpool-client.ts:116</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Collect protocol fees from a list of pools</p>
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>poolAddresses: <span class="tsd-signature-type">Address</span><span class="tsd-signature-symbol">[]</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p>the addresses of the Whirlpool accounts to collect protocol fees from</p>
</div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">TransactionBuilder</span><span class="tsd-signature-symbol">&gt;</span></h4><div><p>A transaction builder to resolve ATA for tokenA and tokenB if needed, and collect protocol fees for all pools</p>
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface"><a id="createPool" class="tsd-anchor"></a><h3 class="tsd-anchor-link">create<wbr/>Pool<a href="#createPool" 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-interface"><li class="tsd-signature tsd-kind-icon">create<wbr/>Pool<span class="tsd-signature-symbol">(</span>whirlpoolsConfig<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Address</span>, tokenMintA<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Address</span>, tokenMintB<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Address</span>, tickSpacing<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span>, initialTick<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span>, funder<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Address</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-symbol">{ </span>poolKey<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">PublicKey</span><span class="tsd-signature-symbol">; </span>tx<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">TransactionBuilder</span><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol">&gt;</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/96e2185/sdk/src/whirlpool-client.ts#L94">whirlpool-client.ts:94</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface"><a id="createPool" class="tsd-anchor"></a><h3 class="tsd-anchor-link">create<wbr/>Pool<a href="#createPool" 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-interface"><li class="tsd-signature tsd-kind-icon">create<wbr/>Pool<span class="tsd-signature-symbol">(</span>whirlpoolsConfig<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Address</span>, tokenMintA<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Address</span>, tokenMintB<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Address</span>, tickSpacing<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span>, initialTick<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span>, funder<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Address</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-symbol">{ </span>poolKey<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">PublicKey</span><span class="tsd-signature-symbol">; </span>tx<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">TransactionBuilder</span><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol">&gt;</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/9e0a389/sdk/src/whirlpool-client.ts#L102">whirlpool-client.ts:102</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Create a Whirlpool account for a group of token A, token B and tick spacing</p>
</div><dl class="tsd-comment-tags"><dt>throws</dt><dd><p>error when the tokens are not in the canonical byte-based ordering. To resolve this, invert the token order and the initialTick (see <code>TickUtil.invertTick()</code>, <code>PriceMath.invertSqrtPriceX64()</code>, or <code>PriceMath.invertPrice()</code>).</p>
</dd></dl></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>whirlpoolsConfig: <span class="tsd-signature-type">Address</span></h5></li><li><h5>tokenMintA: <span class="tsd-signature-type">Address</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
@ -24,27 +24,27 @@
</div></div></li><li><h5>funder: <span class="tsd-signature-type">Address</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p>the account to debit SOL from to fund the creation of the account(s)</p>
</div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-symbol">{ </span>poolKey<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">PublicKey</span><span class="tsd-signature-symbol">; </span>tx<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">TransactionBuilder</span><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol">&gt;</span></h4><div><p><code>poolKey</code>: The public key of the newly created whirlpool account. <code>tx</code>: The transaction containing instructions for the on-chain operations.</p>
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface"><a id="getContext" class="tsd-anchor"></a><h3 class="tsd-anchor-link">get<wbr/>Context<a href="#getContext" 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-interface"><li class="tsd-signature tsd-kind-icon">get<wbr/>Context<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="../classes/WhirlpoolContext.html" class="tsd-signature-type" data-tsd-kind="Class">WhirlpoolContext</a></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/96e2185/sdk/src/whirlpool-client.ts#L27">whirlpool-client.ts:27</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface"><a id="getContext" class="tsd-anchor"></a><h3 class="tsd-anchor-link">get<wbr/>Context<a href="#getContext" 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-interface"><li class="tsd-signature tsd-kind-icon">get<wbr/>Context<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="../classes/WhirlpoolContext.html" class="tsd-signature-type" data-tsd-kind="Class">WhirlpoolContext</a></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/9e0a389/sdk/src/whirlpool-client.ts#L28">whirlpool-client.ts:28</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Get this client&#39;s WhirlpoolContext object</p>
</div></div><h4 class="tsd-returns-title">Returns <a href="../classes/WhirlpoolContext.html" class="tsd-signature-type" data-tsd-kind="Class">WhirlpoolContext</a></h4><div><p>a WhirlpoolContext object</p>
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface"><a id="getFetcher" class="tsd-anchor"></a><h3 class="tsd-anchor-link">get<wbr/>Fetcher<a href="#getFetcher" 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-interface"><li class="tsd-signature tsd-kind-icon">get<wbr/>Fetcher<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="../classes/AccountFetcher.html" class="tsd-signature-type" data-tsd-kind="Class">AccountFetcher</a></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/96e2185/sdk/src/whirlpool-client.ts#L33">whirlpool-client.ts:33</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface"><a id="getFetcher" class="tsd-anchor"></a><h3 class="tsd-anchor-link">get<wbr/>Fetcher<a href="#getFetcher" 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-interface"><li class="tsd-signature tsd-kind-icon">get<wbr/>Fetcher<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="../classes/AccountFetcher.html" class="tsd-signature-type" data-tsd-kind="Class">AccountFetcher</a></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/9e0a389/sdk/src/whirlpool-client.ts#L34">whirlpool-client.ts:34</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Get an AccountFetcher to fetch Whirlpool accounts</p>
</div></div><h4 class="tsd-returns-title">Returns <a href="../classes/AccountFetcher.html" class="tsd-signature-type" data-tsd-kind="Class">AccountFetcher</a></h4><div><p>an AccountFetcher instance</p>
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface"><a id="getPool" class="tsd-anchor"></a><h3 class="tsd-anchor-link">get<wbr/>Pool<a href="#getPool" 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-interface"><li class="tsd-signature tsd-kind-icon">get<wbr/>Pool<span class="tsd-signature-symbol">(</span>poolAddress<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Address</span>, refresh<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">Promise</span><span class="tsd-signature-symbol">&lt;</span><a href="Whirlpool.html" class="tsd-signature-type" data-tsd-kind="Interface">Whirlpool</a><span class="tsd-signature-symbol">&gt;</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/96e2185/sdk/src/whirlpool-client.ts#L41">whirlpool-client.ts:41</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface"><a id="getPool" class="tsd-anchor"></a><h3 class="tsd-anchor-link">get<wbr/>Pool<a href="#getPool" 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-interface"><li class="tsd-signature tsd-kind-icon">get<wbr/>Pool<span class="tsd-signature-symbol">(</span>poolAddress<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Address</span>, refresh<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">Promise</span><span class="tsd-signature-symbol">&lt;</span><a href="Whirlpool.html" class="tsd-signature-type" data-tsd-kind="Interface">Whirlpool</a><span class="tsd-signature-symbol">&gt;</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/9e0a389/sdk/src/whirlpool-client.ts#L49">whirlpool-client.ts:49</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Get a Whirlpool object to interact with the Whirlpool account at the given address.</p>
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>poolAddress: <span class="tsd-signature-type">Address</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p>the address of the Whirlpool account</p>
</div></div></li><li><h5><span class="tsd-flag ts-flagOptional">Optional</span> refresh: <span class="tsd-signature-type">boolean</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p>true to always request newest data from chain with this request</p>
</div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><a href="Whirlpool.html" class="tsd-signature-type" data-tsd-kind="Interface">Whirlpool</a><span class="tsd-signature-symbol">&gt;</span></h4><div><p>a Whirlpool object to interact with</p>
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface"><a id="getPools" class="tsd-anchor"></a><h3 class="tsd-anchor-link">get<wbr/>Pools<a href="#getPools" 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-interface"><li class="tsd-signature tsd-kind-icon">get<wbr/>Pools<span class="tsd-signature-symbol">(</span>poolAddresses<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Address</span><span class="tsd-signature-symbol">[]</span>, refresh<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">Promise</span><span class="tsd-signature-symbol">&lt;</span><a href="Whirlpool.html" class="tsd-signature-type" data-tsd-kind="Interface">Whirlpool</a><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">&gt;</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/96e2185/sdk/src/whirlpool-client.ts#L49">whirlpool-client.ts:49</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface"><a id="getPools" class="tsd-anchor"></a><h3 class="tsd-anchor-link">get<wbr/>Pools<a href="#getPools" 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-interface"><li class="tsd-signature tsd-kind-icon">get<wbr/>Pools<span class="tsd-signature-symbol">(</span>poolAddresses<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Address</span><span class="tsd-signature-symbol">[]</span>, refresh<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">Promise</span><span class="tsd-signature-symbol">&lt;</span><a href="Whirlpool.html" class="tsd-signature-type" data-tsd-kind="Interface">Whirlpool</a><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">&gt;</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/9e0a389/sdk/src/whirlpool-client.ts#L57">whirlpool-client.ts:57</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Get a list of Whirlpool objects matching the provided list of addresses.</p>
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>poolAddresses: <span class="tsd-signature-type">Address</span><span class="tsd-signature-symbol">[]</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p>the addresses of the Whirlpool accounts</p>
</div></div></li><li><h5><span class="tsd-flag ts-flagOptional">Optional</span> refresh: <span class="tsd-signature-type">boolean</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p>true to always request newest data from chain with this request</p>
</div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><a href="Whirlpool.html" class="tsd-signature-type" data-tsd-kind="Interface">Whirlpool</a><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">&gt;</span></h4><div><p>a list of Whirlpool objects to interact with</p>
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface"><a id="getPosition" class="tsd-anchor"></a><h3 class="tsd-anchor-link">get<wbr/>Position<a href="#getPosition" 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-interface"><li class="tsd-signature tsd-kind-icon">get<wbr/>Position<span class="tsd-signature-symbol">(</span>positionAddress<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Address</span>, refresh<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">Promise</span><span class="tsd-signature-symbol">&lt;</span><a href="Position.html" class="tsd-signature-type" data-tsd-kind="Interface">Position</a><span class="tsd-signature-symbol">&gt;</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/96e2185/sdk/src/whirlpool-client.ts#L58">whirlpool-client.ts:58</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface"><a id="getPosition" class="tsd-anchor"></a><h3 class="tsd-anchor-link">get<wbr/>Position<a href="#getPosition" 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-interface"><li class="tsd-signature tsd-kind-icon">get<wbr/>Position<span class="tsd-signature-symbol">(</span>positionAddress<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Address</span>, refresh<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">Promise</span><span class="tsd-signature-symbol">&lt;</span><a href="Position.html" class="tsd-signature-type" data-tsd-kind="Interface">Position</a><span class="tsd-signature-symbol">&gt;</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/9e0a389/sdk/src/whirlpool-client.ts#L66">whirlpool-client.ts:66</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Get a Position object to interact with the Position account at the given address.</p>
</div><dl class="tsd-comment-tags"><dt>throws</dt><dd><p>error when address does not return a Position account.</p>
</dd></dl></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>positionAddress: <span class="tsd-signature-type">Address</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
@ -52,9 +52,14 @@
</div></div></li><li><h5><span class="tsd-flag ts-flagOptional">Optional</span> refresh: <span class="tsd-signature-type">boolean</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p>true to always request newest data from chain with this request</p>
</div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><a href="Position.html" class="tsd-signature-type" data-tsd-kind="Interface">Position</a><span class="tsd-signature-symbol">&gt;</span></h4><div><p>a Position object to interact with.</p>
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface"><a id="getPositions" class="tsd-anchor"></a><h3 class="tsd-anchor-link">get<wbr/>Positions<a href="#getPositions" 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-interface"><li class="tsd-signature tsd-kind-icon">get<wbr/>Positions<span class="tsd-signature-symbol">(</span>positionAddresses<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Address</span><span class="tsd-signature-symbol">[]</span>, refresh<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">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">Record</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><a href="Position.html" class="tsd-signature-type" data-tsd-kind="Interface">Position</a><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">&gt;</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/96e2185/sdk/src/whirlpool-client.ts#L66">whirlpool-client.ts:66</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface"><a id="getPositions" class="tsd-anchor"></a><h3 class="tsd-anchor-link">get<wbr/>Positions<a href="#getPositions" 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-interface"><li class="tsd-signature tsd-kind-icon">get<wbr/>Positions<span class="tsd-signature-symbol">(</span>positionAddresses<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Address</span><span class="tsd-signature-symbol">[]</span>, refresh<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">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">Record</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><a href="Position.html" class="tsd-signature-type" data-tsd-kind="Interface">Position</a><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">&gt;</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/9e0a389/sdk/src/whirlpool-client.ts#L74">whirlpool-client.ts:74</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Get a list of Position objects to interact with the Position account at the given addresses.</p>
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>positionAddresses: <span class="tsd-signature-type">Address</span><span class="tsd-signature-symbol">[]</span></h5></li><li><h5><span class="tsd-flag ts-flagOptional">Optional</span> refresh: <span class="tsd-signature-type">boolean</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p>true to always request newest data from chain with this request</p>
</div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">Record</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><a href="Position.html" class="tsd-signature-type" data-tsd-kind="Interface">Position</a><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">&gt;</span></h4><div><p>a Record object between account address and Position. If an address is not a Position account, it will be null.</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></ul></nav><nav class="tsd-navigation secondary menu-sticky"><ul><li class="current tsd-kind-interface"><a href="WhirlpoolClient.html" class="tsd-kind-icon">Whirlpool<wbr/>Client</a><ul><li class="tsd-kind-method tsd-parent-kind-interface"><a href="WhirlpoolClient.html#collectFeesAndRewardsForPositions" class="tsd-kind-icon">collect<wbr/>Fees<wbr/>And<wbr/>Rewards<wbr/>For<wbr/>Positions</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="WhirlpoolClient.html#collectProtocolFeesForPools" class="tsd-kind-icon">collect<wbr/>Protocol<wbr/>Fees<wbr/>For<wbr/>Pools</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="WhirlpoolClient.html#createPool" class="tsd-kind-icon">create<wbr/>Pool</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="WhirlpoolClient.html#getContext" class="tsd-kind-icon">get<wbr/>Context</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="WhirlpoolClient.html#getFetcher" class="tsd-kind-icon">get<wbr/>Fetcher</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="WhirlpoolClient.html#getPool" class="tsd-kind-icon">get<wbr/>Pool</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="WhirlpoolClient.html#getPools" class="tsd-kind-icon">get<wbr/>Pools</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="WhirlpoolClient.html#getPosition" class="tsd-kind-icon">get<wbr/>Position</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="WhirlpoolClient.html#getPositions" class="tsd-kind-icon">get<wbr/>Positions</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-property tsd-parent-kind-interface"><span class="tsd-kind-icon">Property</span></li><li class="tsd-kind-method tsd-parent-kind-interface"><span class="tsd-kind-icon">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></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>
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface"><a id="getRouter" class="tsd-anchor"></a><h3 class="tsd-anchor-link">get<wbr/>Router<a href="#getRouter" 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-interface"><li class="tsd-signature tsd-kind-icon">get<wbr/>Router<span class="tsd-signature-symbol">(</span>poolAddresses<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Address</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><a href="WhirlpoolRouter.html" class="tsd-signature-type" data-tsd-kind="Interface">WhirlpoolRouter</a><span class="tsd-signature-symbol">&gt;</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/9e0a389/sdk/src/whirlpool-client.ts#L41">whirlpool-client.ts:41</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Get a WhirlpoolRouter to help generate the best prices when transacting across a set of pools.</p>
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>poolAddresses: <span class="tsd-signature-type">Address</span><span class="tsd-signature-symbol">[]</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p>the addresses of the Whirlpool account addresses to route through</p>
</div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><a href="WhirlpoolRouter.html" class="tsd-signature-type" data-tsd-kind="Interface">WhirlpoolRouter</a><span class="tsd-signature-symbol">&gt;</span></h4><div><p>a <a href="WhirlpoolRouter.html">WhirlpoolRouter</a> instance</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></ul></nav><nav class="tsd-navigation secondary menu-sticky"><ul><li class="current tsd-kind-interface"><a href="WhirlpoolClient.html" class="tsd-kind-icon">Whirlpool<wbr/>Client</a><ul><li class="tsd-kind-method tsd-parent-kind-interface"><a href="WhirlpoolClient.html#collectFeesAndRewardsForPositions" class="tsd-kind-icon">collect<wbr/>Fees<wbr/>And<wbr/>Rewards<wbr/>For<wbr/>Positions</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="WhirlpoolClient.html#collectProtocolFeesForPools" class="tsd-kind-icon">collect<wbr/>Protocol<wbr/>Fees<wbr/>For<wbr/>Pools</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="WhirlpoolClient.html#createPool" class="tsd-kind-icon">create<wbr/>Pool</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="WhirlpoolClient.html#getContext" class="tsd-kind-icon">get<wbr/>Context</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="WhirlpoolClient.html#getFetcher" class="tsd-kind-icon">get<wbr/>Fetcher</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="WhirlpoolClient.html#getPool" class="tsd-kind-icon">get<wbr/>Pool</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="WhirlpoolClient.html#getPools" class="tsd-kind-icon">get<wbr/>Pools</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="WhirlpoolClient.html#getPosition" class="tsd-kind-icon">get<wbr/>Position</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="WhirlpoolClient.html#getPositions" class="tsd-kind-icon">get<wbr/>Positions</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="WhirlpoolClient.html#getRouter" class="tsd-kind-icon">get<wbr/>Router</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-property tsd-parent-kind-interface"><span class="tsd-kind-icon">Property</span></li><li class="tsd-kind-method tsd-parent-kind-interface"><span class="tsd-kind-icon">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></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>

View File

@ -0,0 +1,42 @@
<!DOCTYPE html><html class="default"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>WhirlpoolRouter | @orca-so/whirlpools-sdk</title><meta name="description" content="Documentation for @orca-so/whirlpools-sdk"/><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">@orca-so/whirlpools-sdk</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">@orca-so/whirlpools-sdk</a></li><li><a href="WhirlpoolRouter.html">WhirlpoolRouter</a></li></ul><h1>Interface WhirlpoolRouter </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>Convienience class to find routes through a set of Whirlpools and execute a swap across them.
The router only supports up to 2-hop trades between pools and does not support arbitrage trades
between the same token.</p>
</div></div></section><section class="tsd-panel tsd-hierarchy"><h3>Hierarchy</h3><ul class="tsd-hierarchy"><li><span class="target">WhirlpoolRouter</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>Methods</h3><ul class="tsd-index-list"><li class="tsd-kind-method tsd-parent-kind-interface"><a href="WhirlpoolRouter.html#findAllRoutes" class="tsd-kind-icon">find<wbr/>All<wbr/>Routes</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="WhirlpoolRouter.html#findBestRoute" class="tsd-kind-icon">find<wbr/>Best<wbr/>Route</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="WhirlpoolRouter.html#swap" class="tsd-kind-icon">swap</a></li></ul></section></div></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-interface"><a id="findAllRoutes" class="tsd-anchor"></a><h3 class="tsd-anchor-link">find<wbr/>All<wbr/>Routes<a href="#findAllRoutes" 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-interface"><li class="tsd-signature tsd-kind-icon">find<wbr/>All<wbr/>Routes<span class="tsd-signature-symbol">(</span>trade<span class="tsd-signature-symbol">: </span><a href="../modules.html#Trade" class="tsd-signature-type" data-tsd-kind="Type alias">Trade</a>, refresh<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span>, opts<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol">&lt;</span><a href="../modules.html#RoutingOptions" class="tsd-signature-type" data-tsd-kind="Type alias">RoutingOptions</a><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><a href="../modules.html#TradeRoute" class="tsd-signature-type" data-tsd-kind="Type alias">TradeRoute</a><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">&gt;</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/9e0a389/sdk/src/router/public/index.ts#L138">router/public/index.ts:138</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Finds all possible routes for a trade, ordered by the best other token amount you would get from a trade.
Use <a href="../classes/RouterUtils.html#selectFirstExecutableRoute">RouterUtils.selectFirstExecutableRoute</a> to find the best executable route.</p>
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>trade: <a href="../modules.html#Trade" class="tsd-signature-type" data-tsd-kind="Type alias">Trade</a></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p>The trade to find routes for.</p>
</div></div></li><li><h5>refresh: <span class="tsd-signature-type">boolean</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p>If true, the call will fetch the latest on-chain data to calculate the routes.</p>
</div></div></li><li><h5><span class="tsd-flag ts-flagOptional">Optional</span> opts: <span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol">&lt;</span><a href="../modules.html#RoutingOptions" class="tsd-signature-type" data-tsd-kind="Type alias">RoutingOptions</a><span class="tsd-signature-symbol">&gt;</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p><a href="../modules.html#RoutingOptions">RoutingOptions</a> to configure the router. Missing options will be filled with default values from
{@link RouterUtils.getDefaultRoutingOptions}.</p>
</div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><a href="../modules.html#TradeRoute" class="tsd-signature-type" data-tsd-kind="Type alias">TradeRoute</a><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">&gt;</span></h4><div><p>A list of <a href="../modules.html#TradeRoute">TradeRoute</a> that can be used to execute a swap, ordered by the best other token amount.</p>
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface"><a id="findBestRoute" class="tsd-anchor"></a><h3 class="tsd-anchor-link">find<wbr/>Best<wbr/>Route<a href="#findBestRoute" 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-interface"><li class="tsd-signature tsd-kind-icon">find<wbr/>Best<wbr/>Route<span class="tsd-signature-symbol">(</span>trade<span class="tsd-signature-symbol">: </span><a href="../modules.html#Trade" class="tsd-signature-type" data-tsd-kind="Type alias">Trade</a>, refresh<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span>, opts<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol">&lt;</span><a href="../modules.html#RoutingOptions" class="tsd-signature-type" data-tsd-kind="Type alias">RoutingOptions</a><span class="tsd-signature-symbol">&gt;</span>, selectionOpts<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol">&lt;</span><a href="../modules.html#RouteSelectOptions" class="tsd-signature-type" data-tsd-kind="Type alias">RouteSelectOptions</a><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><a href="../modules.html#ExecutableRoute" class="tsd-signature-type" data-tsd-kind="Type alias">ExecutableRoute</a><span class="tsd-signature-symbol">&gt;</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/9e0a389/sdk/src/router/public/index.ts#L160">router/public/index.ts:160</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Finds all possible routes for a trade and select the best route that is executable
under the current execution environment.</p>
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>trade: <a href="../modules.html#Trade" class="tsd-signature-type" data-tsd-kind="Type alias">Trade</a></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p>The trade to find routes for.</p>
</div></div></li><li><h5>refresh: <span class="tsd-signature-type">boolean</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p>If true, the call will fetch the latest on-chain data to calculate the routes.</p>
</div></div></li><li><h5><span class="tsd-flag ts-flagOptional">Optional</span> opts: <span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol">&lt;</span><a href="../modules.html#RoutingOptions" class="tsd-signature-type" data-tsd-kind="Type alias">RoutingOptions</a><span class="tsd-signature-symbol">&gt;</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p><a href="../modules.html#RoutingOptions">RoutingOptions</a> to configure the router. Missing options will be filled with default values from
{@link RouterUtils.getDefaultRoutingOptions}.</p>
</div></div></li><li><h5><span class="tsd-flag ts-flagOptional">Optional</span> selectionOpts: <span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol">&lt;</span><a href="../modules.html#RouteSelectOptions" class="tsd-signature-type" data-tsd-kind="Type alias">RouteSelectOptions</a><span class="tsd-signature-symbol">&gt;</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p><a href="../modules.html#RouteSelectOptions">RouteSelectOptions</a> to configure the selection of the best route. Missing options
will be filled with default values from {@link RouterUtils.getDefaultRouteSelectOptions}.</p>
</div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><a href="../modules.html#ExecutableRoute" class="tsd-signature-type" data-tsd-kind="Type alias">ExecutableRoute</a><span class="tsd-signature-symbol">&gt;</span></h4><div><p>The best <a href="../modules.html#ExecutableRoute">ExecutableRoute</a> that can be used to execute a swap. If no executable route is found, null is returned.</p>
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface"><a id="swap" class="tsd-anchor"></a><h3 class="tsd-anchor-link">swap<a href="#swap" 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-interface"><li class="tsd-signature tsd-kind-icon">swap<span class="tsd-signature-symbol">(</span>trade<span class="tsd-signature-symbol">: </span><a href="../modules.html#TradeRoute" class="tsd-signature-type" data-tsd-kind="Type alias">TradeRoute</a>, slippage<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Percentage</span>, resolvedAtas<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><a href="../modules.html#AtaAccountInfo" class="tsd-signature-type" data-tsd-kind="Type alias">AtaAccountInfo</a><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">TransactionBuilder</span><span class="tsd-signature-symbol">&gt;</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/orca-so/whirlpools/blob/9e0a389/sdk/src/router/public/index.ts#L179">router/public/index.ts:179</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Construct a {@link TransactionBuilder} to help execute a trade route.</p>
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>trade: <a href="../modules.html#TradeRoute" class="tsd-signature-type" data-tsd-kind="Type alias">TradeRoute</a></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p>The trade route to execute.</p>
</div></div></li><li><h5>slippage: <span class="tsd-signature-type">Percentage</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p>The slippage tolerance for the trade.</p>
</div></div></li><li><h5>resolvedAtas: <span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><a href="../modules.html#AtaAccountInfo" class="tsd-signature-type" data-tsd-kind="Type alias">AtaAccountInfo</a><span class="tsd-signature-symbol">[]</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p>The ATA accounts that the executing wallet owns / needed by the execution.
If not provided, the router will attempt to resolve them.</p>
</div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">TransactionBuilder</span><span class="tsd-signature-symbol">&gt;</span></h4><div><p>A {@link TransactionBuilder}that can be used to execute the trade.
If provvided from <a href="../modules.html#ExecutableRoute">ExecutableRoute</a>, plug the {@link AddressLookupTableAccount}s
into builder to lower the transaction size.</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></ul></nav><nav class="tsd-navigation secondary menu-sticky"><ul><li class="current tsd-kind-interface"><a href="WhirlpoolRouter.html" class="tsd-kind-icon">Whirlpool<wbr/>Router</a><ul><li class="tsd-kind-method tsd-parent-kind-interface"><a href="WhirlpoolRouter.html#findAllRoutes" class="tsd-kind-icon">find<wbr/>All<wbr/>Routes</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="WhirlpoolRouter.html#findBestRoute" class="tsd-kind-icon">find<wbr/>Best<wbr/>Route</a></li><li class="tsd-kind-method tsd-parent-kind-interface"><a href="WhirlpoolRouter.html#swap" class="tsd-kind-icon">swap</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-property tsd-parent-kind-interface"><span class="tsd-kind-icon">Property</span></li><li class="tsd-kind-method tsd-parent-kind-interface"><span class="tsd-kind-icon">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></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>

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{
"name": "@orca-so/whirlpools-sdk",
"version": "0.9.0",
"version": "0.10.0-beta.3",
"description": "Typescript SDK to interact with Orca's Whirlpool program.",
"license": "Apache-2.0",
"main": "dist/index.js",
@ -8,14 +8,16 @@
"dependencies": {
"@coral-xyz/anchor": "~0.27.0",
"@metaplex-foundation/mpl-token-metadata": "1.2.5",
"@orca-so/common-sdk": "0.2.1",
"@orca-so/common-sdk": "0.2.2",
"@solana/spl-token": "^0.1.8",
"@solana/web3.js": "~1.74.0",
"decimal.js": "^10.3.1",
"lodash.combinations": "^18.11.1",
"tiny-invariant": "^1.2.0"
},
"devDependencies": {
"@types/bn.js": "~5.1.0",
"@types/lodash": "4.14.194",
"@types/mocha": "^9.0.0",
"@typescript-eslint/eslint-plugin": "^4.26.0",
"@typescript-eslint/parser": "^4.26.0",
@ -41,6 +43,7 @@
"*.{ts,md}": "yarn run prettier-format"
},
"files": [
".yalc",
"/dist"
],
"repository": {

View File

@ -22,6 +22,7 @@ export type WhirlpoolContextOpts = {
};
/**
* Context for storing environment classes and objects for usage throughout the SDK
* @category Core
*/
export class WhirlpoolContext {

View File

@ -22,15 +22,27 @@ export enum SwapErrorCode {
TickArraySequenceInvalid = `TickArraySequenceInvalid`,
}
export type WhirlpoolsErrorCode = TokenErrorCode | SwapErrorCode | MathErrorCode;
export enum RouteQueryErrorCode {
RouteDoesNotExist = "RouteDoesNotExist",
TradeAmountTooHigh = "TradeAmountTooHigh",
ZeroInputAmount = "ZeroInputAmount",
General = "General",
}
export type WhirlpoolsErrorCode =
| TokenErrorCode
| SwapErrorCode
| MathErrorCode
| RouteQueryErrorCode;
export class WhirlpoolsError extends Error {
message: string;
errorCode?: WhirlpoolsErrorCode;
constructor(message: string, errorCode?: WhirlpoolsErrorCode) {
constructor(message: string, errorCode?: WhirlpoolsErrorCode, stack?: string) {
super(message);
this.message = message;
this.errorCode = errorCode;
this.stack = stack;
}
public static isWhirlpoolsErrorCode(e: any, code: WhirlpoolsErrorCode): boolean {

View File

@ -10,6 +10,7 @@ import {
} from "../instructions/composites";
import { WhirlpoolIx } from "../ix";
import { AccountFetcher } from "../network/public";
import { WhirlpoolRouter, WhirlpoolRouterBuilder } from "../router/public";
import { WhirlpoolData } from "../types/public";
import { getTickArrayDataForPosition } from "../utils/builder/position-builder-util";
import { PDAUtil, PoolUtil, PriceMath, TickUtil } from "../utils/public";
@ -29,6 +30,10 @@ export class WhirlpoolClientImpl implements WhirlpoolClient {
return this.ctx.fetcher;
}
public getRouter(poolAddresses: Address[]): Promise<WhirlpoolRouter> {
return WhirlpoolRouterBuilder.buildWithPools(this.ctx, poolAddresses);
}
public async getPool(poolAddress: Address, refresh = false): Promise<Whirlpool> {
const account = await this.ctx.fetcher.getPool(poolAddress, refresh);
if (!account) {

View File

@ -4,12 +4,13 @@ export * from "./context";
export * from "./impl/position-impl";
export * from "./ix";
export * from "./network/public";
export * from "./prices";
export * from "./quotes/public";
export * from "./router/public";
export * from "./types/public";
export * from "./types/public/anchor-types";
export * from "./utils/public";
export * from "./whirlpool-client";
export * from "./prices";
// Global rules for Decimals
// - 40 digits of precision for the largest number

View File

@ -0,0 +1,356 @@
import {
AddressUtil,
deriveATA,
EMPTY_INSTRUCTION,
Percentage,
TransactionBuilder,
ZERO,
} from "@orca-so/common-sdk";
import { ResolvedTokenAddressInstruction } from "@orca-so/common-sdk/dist/helpers/token-instructions";
import {
AccountInfo,
ASSOCIATED_TOKEN_PROGRAM_ID,
NATIVE_MINT,
TOKEN_PROGRAM_ID,
u64,
} from "@solana/spl-token";
import { PublicKey } from "@solana/web3.js";
import {
AtaAccountInfo,
PDAUtil,
SubTradeRoute,
SwapUtils,
TickArrayUtil,
TradeRoute,
twoHopSwapQuoteFromSwapQuotes,
WhirlpoolContext,
} from "../..";
import { createAssociatedTokenAccountInstruction } from "../../utils/ata-ix-util";
import { adjustForSlippage } from "../../utils/position-util";
import { createWSOLAccountInstructions } from "../../utils/spl-token-utils";
import { contextOptionsToBuilderOptions } from "../../utils/txn-utils";
import { swapIx } from "../swap-ix";
import { twoHopSwapIx } from "../two-hop-swap-ix";
export type SwapFromRouteParams = {
route: TradeRoute;
slippage: Percentage;
wallet: PublicKey;
resolvedAtaAccounts: AtaAccountInfo[] | null;
};
export async function getSwapFromRoute(
ctx: WhirlpoolContext,
params: SwapFromRouteParams,
refresh: boolean = false,
txBuilder: TransactionBuilder = new TransactionBuilder(
ctx.connection,
ctx.wallet,
contextOptionsToBuilderOptions(ctx.opts)
)
) {
const { route, wallet, resolvedAtaAccounts, slippage } = params;
const requiredAtas = new Set<string>();
const requiredTickArrays = [];
let hasNativeMint = false;
let nativeMintAmount = new u64(0);
function addOrNative(mint: string, amount: u64) {
if (mint === NATIVE_MINT.toBase58()) {
hasNativeMint = true;
nativeMintAmount = nativeMintAmount.add(amount);
} else {
requiredAtas.add(mint);
}
}
for (let i = 0; i < route.subRoutes.length; i++) {
const routeFragment = route.subRoutes[i];
const slippageAdjustedRoute = adjustQuoteForSlippage(routeFragment, slippage);
if (slippageAdjustedRoute.hopQuotes.length == 1) {
const { quote, mintA, mintB } = slippageAdjustedRoute.hopQuotes[0];
requiredTickArrays.push(...[quote.tickArray0, quote.tickArray1, quote.tickArray2]);
const inputAmount = quote.amountSpecifiedIsInput ? quote.amount : quote.otherAmountThreshold;
addOrNative(mintA.toString(), quote.aToB ? inputAmount : ZERO);
addOrNative(mintB.toString(), !quote.aToB ? inputAmount : ZERO);
} else if (slippageAdjustedRoute.hopQuotes.length == 2) {
const {
quote: quoteOne,
mintA: mintOneA,
mintB: mintOneB,
} = slippageAdjustedRoute.hopQuotes[0];
const {
quote: quoteTwo,
mintA: mintTwoA,
mintB: mintTwoB,
} = slippageAdjustedRoute.hopQuotes[1];
const twoHopQuote = twoHopSwapQuoteFromSwapQuotes(quoteOne, quoteTwo);
requiredTickArrays.push(
...[
twoHopQuote.tickArrayOne0,
twoHopQuote.tickArrayOne1,
twoHopQuote.tickArrayOne2,
twoHopQuote.tickArrayTwo0,
twoHopQuote.tickArrayTwo1,
twoHopQuote.tickArrayTwo2,
]
);
const inputAmount = quoteOne.estimatedAmountIn;
addOrNative(mintOneA.toString(), quoteOne.aToB ? inputAmount : ZERO);
addOrNative(mintOneB.toString(), !quoteOne.aToB ? inputAmount : ZERO);
addOrNative(mintTwoA.toString(), ZERO);
addOrNative(mintTwoB.toString(), ZERO);
}
}
let uninitializedArrays = await TickArrayUtil.getUninitializedArraysString(
requiredTickArrays,
ctx.fetcher,
refresh
);
if (uninitializedArrays) {
throw new Error(`TickArray addresses - [${uninitializedArrays}] need to be initialized.`);
}
// Handle non-native mints only first
requiredAtas.delete(NATIVE_MINT.toBase58());
const ataInstructionMap = await cachedResolveOrCreateNonNativeATAs(
wallet,
requiredAtas,
(keys) => {
// TODO: if atas are not up to date, there might be failures, not sure if there's
// any good way, other than to re-fetch each time?
if (resolvedAtaAccounts != null) {
return Promise.resolve(
keys.map((key) =>
resolvedAtaAccounts.find((ata) => ata.address?.toBase58() === key.toBase58())
) as AccountInfo[]
);
} else {
return ctx.fetcher.listTokenInfos(keys, false);
}
}
);
const ataIxes = Object.values(ataInstructionMap);
if (hasNativeMint) {
const solIx = createWSOLAccountInstructions(
wallet,
nativeMintAmount,
await ctx.fetcher.getAccountRentExempt()
);
txBuilder.addInstruction(solIx);
ataInstructionMap[NATIVE_MINT.toBase58()] = solIx;
}
txBuilder.addInstructions(ataIxes);
// Slippage adjustment
const slippageAdjustedQuotes = route.subRoutes.map((quote) =>
adjustQuoteForSlippage(quote, slippage)
);
for (let i = 0; i < slippageAdjustedQuotes.length; i++) {
const routeFragment = slippageAdjustedQuotes[i];
if (routeFragment.hopQuotes.length == 1) {
const { quote, whirlpool, mintA, mintB, vaultA, vaultB } = routeFragment.hopQuotes[0];
const [wp, tokenVaultA, tokenVaultB] = AddressUtil.toPubKeys([whirlpool, vaultA, vaultB]);
const accA = ataInstructionMap[mintA.toString()].address;
const accB = ataInstructionMap[mintB.toString()].address;
const oraclePda = PDAUtil.getOracle(ctx.program.programId, wp);
txBuilder.addInstruction(
swapIx(ctx.program, {
whirlpool: wp,
tokenOwnerAccountA: accA,
tokenOwnerAccountB: accB,
tokenVaultA,
tokenVaultB,
oracle: oraclePda.publicKey,
tokenAuthority: wallet,
...quote,
})
);
} else if (routeFragment.hopQuotes.length == 2) {
const {
quote: quoteOne,
whirlpool: whirlpoolOne,
mintA: mintOneA,
mintB: mintOneB,
vaultA: vaultOneA,
vaultB: vaultOneB,
} = routeFragment.hopQuotes[0];
const {
quote: quoteTwo,
whirlpool: whirlpoolTwo,
mintA: mintTwoA,
mintB: mintTwoB,
vaultA: vaultTwoA,
vaultB: vaultTwoB,
} = routeFragment.hopQuotes[1];
const [wpOne, wpTwo, tokenVaultOneA, tokenVaultOneB, tokenVaultTwoA, tokenVaultTwoB] =
AddressUtil.toPubKeys([
whirlpoolOne,
whirlpoolTwo,
vaultOneA,
vaultOneB,
vaultTwoA,
vaultTwoB,
]);
const twoHopQuote = twoHopSwapQuoteFromSwapQuotes(quoteOne, quoteTwo);
const oracleOne = PDAUtil.getOracle(ctx.program.programId, wpOne).publicKey;
const oracleTwo = PDAUtil.getOracle(ctx.program.programId, wpTwo).publicKey;
const tokenOwnerAccountOneA = ataInstructionMap[mintOneA.toString()].address;
const tokenOwnerAccountOneB = ataInstructionMap[mintOneB.toString()].address;
const tokenOwnerAccountTwoA = ataInstructionMap[mintTwoA.toString()].address;
const tokenOwnerAccountTwoB = ataInstructionMap[mintTwoB.toString()].address;
txBuilder.addInstruction(
twoHopSwapIx(ctx.program, {
...twoHopQuote,
whirlpoolOne: wpOne,
whirlpoolTwo: wpTwo,
tokenOwnerAccountOneA,
tokenOwnerAccountOneB,
tokenOwnerAccountTwoA,
tokenOwnerAccountTwoB,
tokenVaultOneA,
tokenVaultOneB,
tokenVaultTwoA,
tokenVaultTwoB,
oracleOne,
oracleTwo,
tokenAuthority: wallet,
})
);
}
}
return txBuilder;
}
function adjustQuoteForSlippage(quote: SubTradeRoute, slippage: Percentage): SubTradeRoute {
const { hopQuotes } = quote;
if (hopQuotes.length === 1) {
return {
...quote,
hopQuotes: [
{
...hopQuotes[0],
quote: {
...hopQuotes[0].quote,
...SwapUtils.calculateSwapAmountsFromQuote(
hopQuotes[0].quote.amount,
hopQuotes[0].quote.estimatedAmountIn,
hopQuotes[0].quote.estimatedAmountOut,
slippage,
hopQuotes[0].quote.amountSpecifiedIsInput
),
},
},
],
};
} else if (quote.hopQuotes.length === 2) {
const swapQuoteOne = quote.hopQuotes[0];
const swapQuoteTwo = quote.hopQuotes[1];
const amountSpecifiedIsInput = swapQuoteOne.quote.amountSpecifiedIsInput;
let updatedQuote = {
...quote,
};
if (amountSpecifiedIsInput) {
updatedQuote.hopQuotes[1] = {
...swapQuoteTwo,
quote: {
...swapQuoteTwo.quote,
otherAmountThreshold: adjustForSlippage(
swapQuoteTwo.quote.estimatedAmountOut,
slippage,
false
),
},
};
} else {
updatedQuote.hopQuotes[0] = {
...swapQuoteOne,
quote: {
...swapQuoteOne.quote,
otherAmountThreshold: adjustForSlippage(
swapQuoteOne.quote.estimatedAmountIn,
slippage,
true
),
},
};
}
return updatedQuote;
}
return quote;
}
/**
* Internal duplicate of resolveOrCreateAta
* This could be ported over to common-sdk?
*
* IMPORTANT: wrappedSolAmountIn should only be used for input/source token that
* could be SOL. This is because when SOL is the output, it is the end
* destination, and thus does not need to be wrapped with an amount.
*
* @param ownerAddress The user's public key
* @param tokenMint Token mint address
* @param payer Payer that would pay the rent for the creation of the ATAs
* @param modeIdempotent Optional. Use CreateIdempotent instruction instead of Create instruction
* @returns
*/
async function cachedResolveOrCreateNonNativeATAs(
ownerAddress: PublicKey,
tokenMints: Set<string>,
getTokenAccounts: (keys: PublicKey[]) => Promise<Array<AtaAccountInfo | null>>,
payer = ownerAddress,
modeIdempotent: boolean = false
): Promise<{ [tokenMint: string]: ResolvedTokenAddressInstruction }> {
const instructionMap: { [tokenMint: string]: ResolvedTokenAddressInstruction } = {};
const tokenMintArray = Array.from(tokenMints).map((tm) => new PublicKey(tm));
const tokenAtas = await Promise.all(tokenMintArray.map((tm) => deriveATA(ownerAddress, tm)));
const tokenAccounts = await getTokenAccounts(tokenAtas);
tokenAccounts.forEach((tokenAccount, index) => {
const ataAddress = tokenAtas[index]!;
let resolvedInstruction;
if (tokenAccount) {
// ATA whose owner has been changed is abnormal entity.
// To prevent to send swap/withdraw/collect output to the ATA, an error should be thrown.
if (!tokenAccount.owner.equals(ownerAddress)) {
throw new Error(`ATA with change of ownership detected: ${ataAddress.toBase58()}`);
}
resolvedInstruction = { address: ataAddress, ...EMPTY_INSTRUCTION };
} else {
const createAtaInstruction = createAssociatedTokenAccountInstruction(
ASSOCIATED_TOKEN_PROGRAM_ID,
TOKEN_PROGRAM_ID,
tokenMintArray[index],
ataAddress,
ownerAddress,
payer,
modeIdempotent
);
resolvedInstruction = {
address: ataAddress,
instructions: [createAtaInstruction],
cleanupInstructions: [],
signers: [],
};
}
instructionMap[tokenMintArray[index].toBase58()] = resolvedInstruction;
});
return instructionMap;
}

View File

@ -0,0 +1,67 @@
import { Address } from "@coral-xyz/anchor";
import { AddressUtil } from "@orca-so/common-sdk";
import { u64 } from "@solana/spl-token";
import invariant from "tiny-invariant";
import { AccountFetcher } from "..";
import { SwapQuoteParam } from "../quotes/public";
import { PoolUtil, SwapDirection, SwapUtils } from "../utils/public";
export interface SwapQuoteRequest {
whirlpool: Address;
tradeTokenMint: Address;
tokenAmount: u64;
amountSpecifiedIsInput: boolean;
}
export async function batchBuildSwapQuoteParams(
quoteRequests: SwapQuoteRequest[],
programId: Address,
fetcher: AccountFetcher,
refresh: boolean
): Promise<SwapQuoteParam[]> {
const whirlpools = await fetcher.listPools(
quoteRequests.map((req) => req.whirlpool),
refresh
);
const program = AddressUtil.toPubKey(programId);
const tickArrayRequests = quoteRequests.map((quoteReq, index) => {
const { whirlpool, tokenAmount, tradeTokenMint, amountSpecifiedIsInput } = quoteReq;
const whirlpoolData = whirlpools[index]!;
const swapMintKey = AddressUtil.toPubKey(tradeTokenMint);
const swapTokenType = PoolUtil.getTokenType(whirlpoolData, swapMintKey);
invariant(!!swapTokenType, "swapTokenMint does not match any tokens on this pool");
const aToB =
SwapUtils.getSwapDirection(whirlpoolData, swapMintKey, amountSpecifiedIsInput) ===
SwapDirection.AtoB;
return {
whirlpoolData,
tokenAmount,
aToB,
tickCurrentIndex: whirlpoolData.tickCurrentIndex,
tickSpacing: whirlpoolData.tickSpacing,
whirlpoolAddress: AddressUtil.toPubKey(whirlpool),
amountSpecifiedIsInput,
};
});
const tickArrays = await SwapUtils.getBatchTickArrays(
program,
fetcher,
refresh,
tickArrayRequests
);
return tickArrayRequests.map((req, index) => {
const { whirlpoolData, tokenAmount, aToB, amountSpecifiedIsInput } = req;
return {
whirlpoolData,
tokenAmount,
aToB,
amountSpecifiedIsInput,
sqrtPriceLimit: SwapUtils.getDefaultSqrtPriceLimit(aToB),
otherAmountThreshold: SwapUtils.getDefaultOtherAmountThreshold(amountSpecifiedIsInput),
tickArrays: tickArrays[index],
};
});
}

View File

@ -0,0 +1,177 @@
import { u64 } from "@solana/spl-token";
import { kSmallestPartition } from "../utils/math/k-smallest-partition";
import { RoutingOptions, SubTradeRoute, TradeRoute } from "./public";
import { PathQuote, SanitizedQuoteMap } from "./quote-map";
export function getBestRoutesFromQuoteMap(
quoteMap: SanitizedQuoteMap,
amountSpecifiedIsInput: boolean,
opts: RoutingOptions
): TradeRoute[] {
const { numTopRoutes, maxSplits } = opts;
const sortedRoutes = [
...getRankedRoutes(quoteMap, amountSpecifiedIsInput, numTopRoutes, maxSplits),
...getSingleHopSplit(quoteMap),
].sort(getRouteCompareFn(amountSpecifiedIsInput));
return convertInternalRoutesToTradeRoutes(sortedRoutes);
}
function convertInternalRoutesToTradeRoutes(internalRoutes: InternalRoute[]): TradeRoute[] {
const tradeRoutes: TradeRoute[] = internalRoutes.map((internalRoute) => {
const { quotes, totalIn, totalOut } = internalRoute;
return {
subRoutes: quotes.map((quote) => convertPathQuoteToSubTradeRoute(quote)),
totalAmountIn: totalIn,
totalAmountOut: totalOut,
};
});
return tradeRoutes;
}
function convertPathQuoteToSubTradeRoute(pathQuote: PathQuote): SubTradeRoute {
const { calculatedEdgeQuotes, path, splitPercent, amountIn, amountOut } = pathQuote;
return {
path,
splitPercent,
amountIn,
amountOut,
hopQuotes: calculatedEdgeQuotes,
};
}
type InternalRoute = {
quotes: PathQuote[];
splitPercent: number;
totalIn: u64;
totalOut: u64;
};
function getSingleHopSplit(quoteMap: SanitizedQuoteMap): InternalRoute[] {
const fullFlow = quoteMap[100];
if (fullFlow) {
return fullFlow
.filter((f) => f.calculatedEdgeQuotes.length == 1)
.map((f) => {
const oneHop = f.calculatedEdgeQuotes[0];
return {
quotes: [f],
splitPercent: 100,
totalIn: oneHop.amountIn,
totalOut: oneHop.amountOut,
};
})
.flatMap((g) => (!!g ? g : []));
}
return [];
}
function getRankedRoutes(
percentMap: SanitizedQuoteMap,
amountSpecifiedIsInput: boolean,
topN: number,
maxSplits: number
): InternalRoute[] {
let routes = generateRoutes(percentMap, maxSplits);
// Run quick select algorithm to partition the topN results, mutating inplace
const routeCompare = getRouteCompareFn(amountSpecifiedIsInput);
if (routes.length <= topN) {
return routes.sort(routeCompare);
}
kSmallestPartition(routes, topN, 0, routes.length - 1, routeCompare);
return routes.slice(0, topN).sort(routeCompare);
}
function generateRoutes(percentMap: SanitizedQuoteMap, maxSplits: number): InternalRoute[] {
let routes: InternalRoute[] = [];
buildRoutes(
percentMap,
maxSplits,
{
quotes: [],
splitPercent: 0,
totalIn: new u64(0),
totalOut: new u64(0),
},
routes
);
return routes;
}
function buildRoutes(
quotePercentMap: SanitizedQuoteMap,
maxSplits: number,
currentRoute: InternalRoute,
routes: InternalRoute[]
) {
const { splitPercent: percent, quotes } = currentRoute;
const percents = Object.keys(quotePercentMap).map((percent) => Number(percent));
for (let i = percents.length - 1; i >= 0; i--) {
const nextPercent = percents[i];
const newPercentTotal = percent + nextPercent;
// Optimization to prevent exceeding 100% flow and excess combinations of flow by only using decreasing
// amounts of flow percentages
const nextPercentIsSmaller =
quotes.length > 0 && nextPercent > quotes[quotes.length - 1].splitPercent;
if (newPercentTotal > 100 || nextPercentIsSmaller) {
continue;
}
const nextPercentQuotes = quotePercentMap[nextPercent];
for (let j = 0; j < nextPercentQuotes.length; j++) {
const nextQuote = nextPercentQuotes[j];
// Don't use a quote that shares a pool with an existing quote
const hasReusedPools = nextQuote.edgesPoolAddrs.some((r1) =>
quotes.some((r2) => r2.edgesPoolAddrs.some((r3) => r3.indexOf(r1) !== -1))
);
if (hasReusedPools) {
continue;
}
// todo: Doesn't take into transaction fees
// double-hops, multi-route penalties, benefits for pairs that can share lookup tables
const nextRoute: InternalRoute = {
quotes: [...quotes, nextQuote],
splitPercent: newPercentTotal,
totalIn: currentRoute.totalIn.add(nextQuote.amountIn),
totalOut: currentRoute.totalOut.add(nextQuote.amountOut),
};
// Remove the current and prior routes from consideration
const nextCandidateQuotes = nextPercentQuotes.slice(j + 1);
if (newPercentTotal === 100) {
// If we have reached 100% flow routed, we add it to the set of valid route sets
routes.push(nextRoute);
} else if (quotes.length + 1 != maxSplits) {
// Otherwise, recursively build route sets
buildRoutes(
{
...quotePercentMap,
[nextPercent]: nextCandidateQuotes,
},
maxSplits,
nextRoute,
routes
);
}
}
}
}
function getRouteCompareFn(amountSpecifiedIsInput: boolean) {
return amountSpecifiedIsInput ? routesCompareForInputAmount : routesCompareForOutputAmount;
}
function routesCompareForInputAmount(a: InternalRoute, b: InternalRoute) {
return b.totalOut.cmp(a.totalOut);
}
function routesCompareForOutputAmount(a: InternalRoute, b: InternalRoute) {
return a.totalIn.cmp(b.totalIn);
}

View File

@ -0,0 +1,184 @@
import { Address } from "@coral-xyz/anchor";
import { Percentage, TransactionBuilder } from "@orca-so/common-sdk";
import { u64 } from "@solana/spl-token";
import { AddressLookupTableAccount } from "@solana/web3.js";
import { SwapQuote } from "../../quotes/public";
import { Path } from "../../utils/public";
import { AtaAccountInfo, RouteSelectOptions } from "./router-utils";
export * from "./router-builder";
export * from "./router-utils";
/**
* A Trade type that represents a trade between two tokens
*
* @category Router
* @param tokenIn The token that is being traded in
* @param tokenOut The token that is being traded out
* @param tradeAmount The amount of token being traded in or out
* @param amountSpecifiedIsInput Whether the trade amount is the amount being traded in or out
*/
export type Trade = {
tokenIn: Address;
tokenOut: Address;
tradeAmount: u64;
amountSpecifiedIsInput: boolean;
};
/**
* Options to configure the router.
*
* @category Router
* @param percentIncrement The percent increment to use when splitting a trade into multiple trades.
* @param numTopRoutes The number of top routes to return from the router.
* @param numTopPartialQuotes The number of top partial quotes to return from the router.
* @param maxSplits The maximum number of splits to perform on a trade.
*/
export type RoutingOptions = {
percentIncrement: number;
numTopRoutes: number;
numTopPartialQuotes: number;
maxSplits: number;
};
/**
* A trade route that is ready to execute.
* A trade can be broken into multiple sub-trades for potentially better trades.
*
* @category Router
* @param subRoutes
* The sub-routes that make up the trade route. The sum of all splitPercent should equal 100.
* @param totalAmountIn The total amount of token being traded in for this trade.
* @param totalAmountOut The total amount of token being traded out for this trade.
*/
export type TradeRoute = {
subRoutes: SubTradeRoute[];
totalAmountIn: u64;
totalAmountOut: u64;
};
/**
* Represents a fragment of a trade that was splitted into multiple trades for more efficient execution.
*
* @category Router
* @param path The path of pool addresses that make up this sub trade.
* @param splitPercent The percent of the trade that this sub trade represents.
* @param amountIn The amount of token being traded in within this sub-route.
* @param amountOut The amount of token being traded out within this sub-routes.
* @param hopQuotes The quotes for each hop in the path of this trade.
*/
export type SubTradeRoute = {
path: Path;
splitPercent: number;
amountIn: u64;
amountOut: u64;
hopQuotes: TradeHop[];
};
/**
* Represents a quote for a single hop in the path of a {@link SubTradeRoute}.
*
* @category Router
* @param amountIn The amount of token being traded in for this hop.
* @param amountOut The amount of token being traded out for this hop.
* @param whirlpool The address of the whirlpool that this hop is trading through.
* @param inputMint The address of the input token mint.
* @param outputMint The address of the output token mint.
* @param mintA The address of the first mint in the pool.
* @param mintB The address of the second mint in the pool.
* @param vaultA The address of the first vault in the pool.
* @param vaultB The address of the second vault in the pool.
* @param quote The {@link SwapQuote} for this hop.
*/
export type TradeHop = {
amountIn: u64;
amountOut: u64;
whirlpool: Address;
inputMint: Address;
outputMint: Address;
mintA: Address;
mintB: Address;
vaultA: Address;
vaultB: Address;
quote: SwapQuote;
};
/**
* A trade route that is ready to execute.
* Contains the {@link TradeRoute} and a possible set of {@link AddressLookupTableAccount} that
* is needed to successfully execute the trade.
*
* If the lookup table accounts are undefined, then the trade can be executed with a legacy transaction.
*
* @category Router
*/
export type ExecutableRoute = readonly [TradeRoute, AddressLookupTableAccount[] | undefined];
/**
* Convienience class to find routes through a set of Whirlpools and execute a swap across them.
* The router only supports up to 2-hop trades between pools and does not support arbitrage trades
* between the same token.
*
* @category Router
*/
export interface WhirlpoolRouter {
/**
* Finds all possible routes for a trade, ordered by the best other token amount you would get from a trade.
* Use {@link RouterUtils.selectFirstExecutableRoute} to find the best executable route.
*
* @param trade
* The trade to find routes for.
* @param refresh
* If true, the call will fetch the latest on-chain data to calculate the routes.
* @param opts
* {@link RoutingOptions} to configure the router. Missing options will be filled with default values from
* {@link RouterUtils.getDefaultRoutingOptions}.
* @return A list of {@link TradeRoute} that can be used to execute a swap, ordered by the best other token amount.
*/
findAllRoutes(
trade: Trade,
refresh: boolean,
opts?: Partial<RoutingOptions>
): Promise<TradeRoute[]>;
/**
* Finds all possible routes for a trade and select the best route that is executable
* under the current execution environment.
* @param trade
* The trade to find routes for.
* @param refresh
* If true, the call will fetch the latest on-chain data to calculate the routes.
* @param opts
* {@link RoutingOptions} to configure the router. Missing options will be filled with default values from
* {@link RouterUtils.getDefaultRoutingOptions}.
* @param selectionOpts
* {@link RouteSelectOptions} to configure the selection of the best route. Missing options
* will be filled with default values from {@link RouterUtils.getDefaultRouteSelectOptions}.
* @returns
* The best {@link ExecutableRoute} that can be used to execute a swap. If no executable route is found, null is returned.
*/
findBestRoute(
trade: Trade,
refresh: boolean,
opts?: Partial<RoutingOptions>,
selectionOpts?: Partial<RouteSelectOptions>
): Promise<ExecutableRoute | null>;
/**
* Construct a {@link TransactionBuilder} to help execute a trade route.
* @param trade The trade route to execute.
* @param slippage The slippage tolerance for the trade.
* @param resolvedAtas
* The ATA accounts that the executing wallet owns / needed by the execution.
* If not provided, the router will attempt to resolve them.
* @returns
* A {@link TransactionBuilder}that can be used to execute the trade.
* If provvided from {@link ExecutableRoute}, plug the {@link AddressLookupTableAccount}s
* into builder to lower the transaction size.
*/
swap(
trade: TradeRoute,
slippage: Percentage,
resolvedAtas: AtaAccountInfo[] | null
): Promise<TransactionBuilder>;
}

View File

@ -0,0 +1,33 @@
import { Address } from "@coral-xyz/anchor";
import { WhirlpoolRouter } from ".";
import { WhirlpoolContext } from "../..";
import { PoolGraph, PoolGraphBuilder } from "../../utils/public";
import { WhirlpoolRouterImpl } from "../router-impl";
/**
* Builder to build instances of the {@link WhirlpoolRouter}
* @category Router
*/
export class WhirlpoolRouterBuilder {
/**
* Builds a {@link WhirlpoolRouter} with a prebuilt {@link PoolGraph}
*
* @param ctx A {@link WhirlpoolContext} for the current execution environment
* @param graph A {@link PoolGraph} that represents the connections between all pools.
* @returns A {@link WhirlpoolRouter} that can be used to find routes and execute swaps
*/
static buildWithPoolGraph(ctx: WhirlpoolContext, graph: PoolGraph): WhirlpoolRouter {
return new WhirlpoolRouterImpl(ctx, graph);
}
/**
* Fetch and builds a {@link WhirlpoolRouter} with a list of pool addresses.
* @param ctx A {@link WhirlpoolContext} for the current execution environment
* @param pools A list of {@link Address}es that the router will find routes through.
* @returns A {@link WhirlpoolRouter} that can be used to find routes and execute swaps
*/
static async buildWithPools(ctx: WhirlpoolContext, pools: Address[]): Promise<WhirlpoolRouter> {
const poolGraph = await PoolGraphBuilder.buildPoolGraphWithFetch(pools, ctx.fetcher);
return new WhirlpoolRouterImpl(ctx, poolGraph);
}
}

View File

@ -0,0 +1,207 @@
import {
AddressUtil,
LookupTableFetcher,
MEASUREMENT_BLOCKHASH,
Percentage,
TransactionBuilder,
TX_SIZE_LIMIT,
} from "@orca-so/common-sdk";
import { AccountInfo } from "@solana/spl-token";
import { PublicKey } from "@solana/web3.js";
import { ExecutableRoute, RoutingOptions, TradeRoute } from ".";
import { WhirlpoolContext } from "../../context";
import { getSwapFromRoute } from "../../instructions/composites/swap-with-route";
import { isWalletConnected } from "../../utils/wallet-utils";
/**
* A type representing a Associated Token Account
* @param address The address of the ATA account.
* @param owner The owner address of the ATA.
* @param mint The mint of the token the ATA represents.
*/
export type AtaAccountInfo = Pick<AccountInfo, "address" | "owner" | "mint">;
/**
* Parameters to configure the selection of the best route.
* @category Router
* @param slippageTolerance The slippage tolerance to use when selecting the best route.
* @param maxSupportedTransactionVersion The maximum transaction version that the wallet supports.
* @param availableAtaAccounts A list of ATA accounts that are available in this wallet to use for the swap.
* @param onRouteEvaluation
* A callback that is called right before a route is evaluated. Users have a chance to add additional instructions
* to be added for an accurate txn size measurement. (ex. Adding a priority fee ix to the transaction)
*
*/
export type RouteSelectOptions = {
maxSupportedTransactionVersion: "legacy" | number;
availableAtaAccounts?: AtaAccountInfo[];
onRouteEvaluation?: (route: Readonly<TradeRoute>, tx: TransactionBuilder) => void;
};
/**
* A selection of utility functions for the {@link WhirlpoolRouter}.
* @category Router
*/
export class RouterUtils {
/**
* Selects the best executable route from a list of routes using the current execution environment.
* The wallet support type, available ATA accounts, existance of lookup tables all effect the transaction size
* and eligibility of a route.
*
* @param ctx The {@link WhirlpoolContext} that represents the current execution environment
* @param orderedRoutes A list of routes to select from, ordered by the best routes (trade amount wise) first.
* @param opts {@link RouteSelectOptions} to configure the selection of the best route.
* @returns
* The best {@link ExecutableRoute} that can be used to execute a swap. If no executable route is found, null is returned.
*/
static async selectFirstExecutableRoute(
ctx: WhirlpoolContext,
orderedRoutes: TradeRoute[],
opts: RouteSelectOptions
): Promise<ExecutableRoute | null> {
const { wallet } = ctx;
if (orderedRoutes.length === 0) {
return null;
}
// Don't measure if there is no wallet
if (!isWalletConnected(wallet)) {
return [orderedRoutes[0], undefined];
}
// Preload LookupTableFetcher with lookup tables that are needed for v0 transactions
if (opts.maxSupportedTransactionVersion !== "legacy" && ctx.lookupTableFetcher) {
await loadLookupTablesForRoutes(ctx.lookupTableFetcher, orderedRoutes);
}
for (let i = 0; i < orderedRoutes.length && i < MEASURE_ROUTE_MAX; i++) {
const route = orderedRoutes[i];
const tx = await getSwapFromRoute(
ctx,
{
route,
slippage: Percentage.fromFraction(0, 100),
resolvedAtaAccounts: opts.availableAtaAccounts ?? null,
wallet: wallet.publicKey,
},
false
);
if (!!opts.onRouteEvaluation) {
opts.onRouteEvaluation(route, tx);
}
try {
const legacyTxSize = tx.txnSize({
latestBlockhash: MEASUREMENT_BLOCKHASH,
maxSupportedTransactionVersion: "legacy",
});
if (legacyTxSize !== undefined && legacyTxSize <= TX_SIZE_LIMIT) {
return [route, undefined];
}
} catch (e) {
// No-op
}
let v0TxSize;
if (opts.maxSupportedTransactionVersion !== "legacy" && ctx.lookupTableFetcher) {
const addressesToLookup = RouterUtils.getTouchedTickArraysFromRoute(route);
if (addressesToLookup.length > MAX_LOOKUP_TABLE_FETCH_SIZE) {
continue;
}
const lookupTableAccounts = await ctx.lookupTableFetcher.getLookupTableAccountsForAddresses(
addressesToLookup
);
try {
v0TxSize = tx.txnSize({
latestBlockhash: MEASUREMENT_BLOCKHASH,
maxSupportedTransactionVersion: opts.maxSupportedTransactionVersion,
lookupTableAccounts,
});
if (v0TxSize !== undefined && v0TxSize <= TX_SIZE_LIMIT) {
return [route, lookupTableAccounts];
}
} catch (e) {
// No-op
}
}
}
return null;
}
/**
* Get the tick arrays addresses that are touched by a route.
* @param route The route to get the tick arrays from.
* @returns The tick arrays addresses that are touched by the route.
*/
static getTouchedTickArraysFromRoute(route: TradeRoute): PublicKey[] {
const taAddresses = new Set<string>();
for (const quote of route.subRoutes) {
for (const hop of quote.hopQuotes) {
// We only need to search for tick arrays, since we should be guaranteed due to the layout
// that all other addresses are included in the LUTs for the tick array
taAddresses.add(hop.quote.tickArray0.toBase58());
taAddresses.add(hop.quote.tickArray1.toBase58());
taAddresses.add(hop.quote.tickArray2.toBase58());
}
}
return AddressUtil.toPubKeys(Array.from(taAddresses));
}
/**
* Get the default options for generating trade routes.
* @returns Default options for generating trade routes.
*/
static getDefaultRouteOptions(): RoutingOptions {
return {
percentIncrement: 20,
numTopRoutes: 50,
numTopPartialQuotes: 10,
maxSplits: 3,
};
}
/**
* Get the default options for selecting a route from a list of generated routes.
* @returns Default options for selecting a a route from a list of generated routes.
*/
static getDefaultSelectOptions(): RouteSelectOptions {
return {
maxSupportedTransactionVersion: 0,
};
}
}
async function loadLookupTablesForRoutes(
lookupTableFetcher: LookupTableFetcher,
routes: TradeRoute[]
) {
const altTicks = new Set<string>();
for (let i = 0; i < routes.length && i < MEASURE_ROUTE_MAX; i++) {
const route = routes[i];
RouterUtils.getTouchedTickArraysFromRoute(route).map((ta) => altTicks.add(ta.toBase58()));
}
const altTickArray = Array.from(altTicks);
const altPageSize = 45;
const altRequests = [];
for (let i = 0; i < altTickArray.length; i += altPageSize) {
altRequests.push(altTickArray.slice(i, i + altPageSize));
}
await Promise.all(
altRequests.map((altPage) => {
const altPageKeys = AddressUtil.toPubKeys(altPage);
lookupTableFetcher.loadLookupTables(altPageKeys);
})
);
}
// The maximum number of routes to measure
const MEASURE_ROUTE_MAX = 100;
// The maximum number of tick arrays to lookup per network request
const MAX_LOOKUP_TABLE_FETCH_SIZE = 50;

312
sdk/src/router/quote-map.ts Normal file
View File

@ -0,0 +1,312 @@
import { Address } from "@coral-xyz/anchor";
import { AddressUtil, Percentage } from "@orca-so/common-sdk";
import { u64 } from "@solana/spl-token";
import { PublicKey } from "@solana/web3.js";
import BN from "bn.js";
import { AccountFetcher } from "..";
import { SwapErrorCode } from "../errors/errors";
import { SwapQuoteParam, swapQuoteWithParams } from "../quotes/public";
import { Path } from "../utils/public";
import { SwapQuoteRequest, batchBuildSwapQuoteParams } from "./batch-swap-quote";
import { RoutingOptions, Trade, TradeHop } from "./public";
// Key between <splitPercent, array of quotes with successful hop quotes>
export type SanitizedQuoteMap = Record<number, PathQuote[]>;
// A trade quote on trading on a path between user input tokenIn -> tokenOut
export type PathQuote = {
path: Path;
edgesPoolAddrs: string[];
splitPercent: number;
amountIn: u64;
amountOut: u64;
calculatedEdgeQuotes: TradeHopQuoteSuccess[];
};
export async function getQuoteMap(
trade: Trade,
paths: Path[],
amountSpecifiedIsInput: boolean,
programId: PublicKey,
fetcher: AccountFetcher,
opts: RoutingOptions
) {
const { percentIncrement, numTopPartialQuotes } = opts;
const { tokenIn, tokenOut, tradeAmount } = trade;
const { percents, amounts } = getSplitPercentageAmts(tradeAmount, percentIncrement);
// The max route length is the number of iterations of quoting that we need to do
const maxRouteLength = Math.max(...paths.map((path) => path.edges.length), 0);
// For hop 0 of all routes, get swap quotes using [inputAmount, inputTokenMint]
// For hop 1..n of all routes, get swap quotes using [outputAmount, outputTokenMint] of hop n-1 as input
const quoteMap: InternalQuoteMap = {};
let iteration = Array.from(Array(maxRouteLength).keys());
if (!amountSpecifiedIsInput) {
iteration = iteration.reverse();
}
try {
for (const hop of iteration) {
// Each batch of quotes needs to be iterative
const quoteUpdates = buildQuoteUpdateRequests(
tokenIn,
tokenOut,
paths,
percents,
amounts,
hop,
amountSpecifiedIsInput,
quoteMap
);
const quoteParams = await batchBuildSwapQuoteParams(
quoteUpdates.map((update) => update.request),
AddressUtil.toPubKey(programId),
fetcher,
false
);
populateQuoteMap(quoteUpdates, quoteParams, quoteMap);
}
} catch (e) {
throw e;
}
return sanitizeQuoteMap(quoteMap, numTopPartialQuotes, amountSpecifiedIsInput);
}
// Key between <splitPercent, array of quotes of pre-sanitized calculated-hops>
type InternalQuoteMap = Record<
number,
Array<
Pick<InternalPathQuote, "path" | "edgesPoolAddrs" | "splitPercent" | "calculatedEdgeQuotes">
>
>;
type InternalPathQuote = Omit<PathQuote, "calculatedEdgeQuotes"> & {
calculatedEdgeQuotes: (TradeHopQuoteResult | undefined)[];
};
type TradeHopQuoteResult = TradeHopQuoteSuccess | TradeHopQuoteError;
type TradeHopQuoteSuccess = TradeHop & { success: true };
type TradeHopQuoteError = {
success: false;
error: SwapErrorCode;
};
function populateQuoteMap(
quoteUpdates: ReturnType<typeof buildQuoteUpdateRequests>,
quoteParams: SwapQuoteParam[],
quoteMap: InternalQuoteMap
) {
for (const { splitPercent, pathIndex, quoteIndex, edgeIndex, request } of quoteUpdates) {
const swapParam = quoteParams[quoteIndex];
const path = quoteMap[splitPercent][pathIndex];
try {
const quote = swapQuoteWithParams(swapParam, Percentage.fromFraction(0, 1000));
const { whirlpoolData, tokenAmount, aToB, amountSpecifiedIsInput } = swapParam;
const [mintA, mintB, vaultA, vaultB] = [
whirlpoolData.tokenMintA.toBase58(),
whirlpoolData.tokenMintB.toBase58(),
whirlpoolData.tokenVaultA.toBase58(),
whirlpoolData.tokenVaultB.toBase58(),
];
const [inputMint, outputMint] = aToB ? [mintA, mintB] : [mintB, mintA];
path.calculatedEdgeQuotes[edgeIndex] = {
success: true,
amountIn: amountSpecifiedIsInput ? tokenAmount : quote.estimatedAmountIn,
amountOut: amountSpecifiedIsInput ? quote.estimatedAmountOut : tokenAmount,
whirlpool: request.whirlpool,
inputMint,
outputMint,
mintA,
mintB,
vaultA,
vaultB,
quote,
};
} catch (e: any) {
const errorCode: SwapErrorCode = e.errorCode;
path.calculatedEdgeQuotes[edgeIndex] = {
success: false,
error: errorCode,
};
continue;
}
}
}
/**
* A list of quote requests to be queried in a batch.
*
* @param quoteIndex The index for this quote in the QuoteRequest array
* @param pathIndex The index of the trade paths this request is evaluating
* @param edgeIndex The index of the edge for the evaluated path
* @param splitPercent The percent of the total amount to be swapped
* @param poolAddress The account address of the pool this edge is evaluating
*
*/
type QuoteRequest = {
quoteIndex: number;
pathIndex: number;
edgeIndex: number;
splitPercent: number;
request: SwapQuoteRequest;
};
function buildQuoteUpdateRequests(
tokenIn: Address,
tokenOut: Address,
paths: Path[],
percents: number[],
amounts: BN[],
hop: number,
amountSpecifiedIsInput: boolean,
quoteMap: InternalQuoteMap
): QuoteRequest[] {
// Each batch of quotes needs to be iterative
const quoteUpdates: QuoteRequest[] = [];
for (let amountIndex = 0; amountIndex < amounts.length; amountIndex++) {
const percent = percents[amountIndex];
const tradeAmount = amounts[amountIndex];
// Initialize quote map for first hop
if (!quoteMap[percent]) {
quoteMap[percent] = Array(paths.length);
}
// Iterate over all routes
for (let pathIndex = 0; pathIndex < paths.length; pathIndex++) {
const path = paths[pathIndex];
const edges = path.edges;
// If the current route is already complete (amountSpecifiedIsInput = true) or if the current hop is beyond
// this route's length (amountSpecifiedIsInput = false), don't do anything
if (amountSpecifiedIsInput ? edges.length <= hop : hop > edges.length - 1) {
continue;
}
const startingRouteEval = amountSpecifiedIsInput ? hop === 0 : hop === edges.length - 1;
const poolsPath = AddressUtil.toStrings(edges.map((edge) => edge.poolAddress));
// If this is the first hop of the route, initialize the quote map
if (startingRouteEval) {
quoteMap[percent][pathIndex] = {
path: path,
splitPercent: percent,
edgesPoolAddrs: poolsPath,
calculatedEdgeQuotes: Array(edges.length),
};
}
const currentQuote = quoteMap[percent][pathIndex];
const poolAddr = poolsPath[hop];
const lastHop = amountSpecifiedIsInput
? currentQuote.calculatedEdgeQuotes[hop - 1]
: currentQuote.calculatedEdgeQuotes[hop + 1];
// If this is the first hop, use the input mint and amount, otherwise use the output of the last hop
let tokenAmount: u64;
let tradeToken: Address;
if (startingRouteEval) {
tokenAmount = tradeAmount;
tradeToken = amountSpecifiedIsInput ? tokenIn : tokenOut;
} else {
if (!lastHop?.success) {
continue;
}
tokenAmount = amountSpecifiedIsInput ? lastHop.amountOut : lastHop.amountIn;
tradeToken = amountSpecifiedIsInput ? lastHop.outputMint : lastHop.inputMint;
}
quoteUpdates.push({
splitPercent: percent,
pathIndex,
edgeIndex: hop,
quoteIndex: quoteUpdates.length,
request: {
whirlpool: poolAddr,
tradeTokenMint: tradeToken,
tokenAmount,
amountSpecifiedIsInput,
},
});
}
}
return quoteUpdates;
}
/**
* Annotate amountIn/amountOut for calculations
* @param tradeAmount
* @param quoteMap
* @returns
*/
function sanitizeQuoteMap(
quoteMap: InternalQuoteMap,
pruneN: number,
amountSpecifiedIsInput: boolean
): readonly [SanitizedQuoteMap, Set<SwapErrorCode>] {
const percents = Object.keys(quoteMap).map((percent) => Number(percent));
const cleanedQuoteMap: SanitizedQuoteMap = {};
const failureErrors: Set<SwapErrorCode> = new Set();
for (let i = 0; i < percents.length; i++) {
const percent = percents[i];
const uncleanedQuotes = quoteMap[percent];
cleanedQuoteMap[percent] = [];
for (const {
edgesPoolAddrs: hopPoolAddrs,
calculatedEdgeQuotes: calculatedHops,
path,
} of uncleanedQuotes) {
// If the route was successful at each step, add it to the clean quote stack
const filteredCalculatedEdges = calculatedHops.flatMap((val) =>
!!val && val.success ? val : []
);
if (filteredCalculatedEdges.length === hopPoolAddrs.length) {
const [input, output] = [
filteredCalculatedEdges[0].amountIn,
filteredCalculatedEdges[filteredCalculatedEdges.length - 1].amountOut,
];
cleanedQuoteMap[percent].push({
path,
splitPercent: percent,
edgesPoolAddrs: hopPoolAddrs,
amountIn: input,
amountOut: output,
calculatedEdgeQuotes: filteredCalculatedEdges,
});
continue;
}
// If a route failed, there would only be one failure
const quoteFailures = calculatedHops.flatMap((f) => (f && !f?.success ? f : []));
failureErrors.add(quoteFailures[0].error);
}
}
// Prune the quote map to only include the top N quotes
const prunedQuoteMap: SanitizedQuoteMap = {};
const sortFn = amountSpecifiedIsInput
? (a: PathQuote, b: PathQuote) => b.amountOut.cmp(a.amountOut)
: (a: PathQuote, b: PathQuote) => a.amountIn.cmp(b.amountIn);
for (let i = 0; i < percents.length; i++) {
const sortedQuotes = cleanedQuoteMap[percents[i]].sort(sortFn);
const slicedSorted = sortedQuotes.slice(0, pruneN);
prunedQuoteMap[percents[i]] = slicedSorted;
}
return [prunedQuoteMap, failureErrors] as const;
}
function getSplitPercentageAmts(inputAmount: u64, minPercent: number = 5) {
const percents = [];
const amounts = [];
for (let i = 1; i <= 100 / minPercent; i++) {
percents.push(i * minPercent);
amounts.push(inputAmount.mul(new u64(i * minPercent)).div(new u64(100)));
}
return { percents, amounts };
}

View File

@ -0,0 +1,169 @@
import { Address } from "@coral-xyz/anchor";
import { AddressUtil, Percentage, TransactionBuilder } from "@orca-so/common-sdk";
import { AccountInfo } from "@solana/spl-token";
import { AccountFetcher, WhirlpoolContext } from "..";
import { RouteQueryErrorCode, SwapErrorCode, WhirlpoolsError } from "../errors/errors";
import { getSwapFromRoute } from "../instructions/composites/swap-with-route";
import { Path, PoolGraph, SwapUtils } from "../utils/public";
import { getBestRoutesFromQuoteMap } from "./convert-quote-map";
import {
ExecutableRoute,
RouteSelectOptions,
RouterUtils,
RoutingOptions,
Trade,
TradeRoute,
WhirlpoolRouter,
} from "./public";
import { getQuoteMap } from "./quote-map";
export class WhirlpoolRouterImpl implements WhirlpoolRouter {
constructor(readonly ctx: WhirlpoolContext, readonly poolGraph: PoolGraph) {}
async findAllRoutes(
trade: Trade,
refresh: boolean,
opts?: Partial<RoutingOptions>
): Promise<TradeRoute[]> {
const { tokenIn, tokenOut, tradeAmount, amountSpecifiedIsInput } = trade;
const paths = this.poolGraph.getPath(tokenIn, tokenOut);
if (paths.length === 0) {
return Promise.reject(
new WhirlpoolsError(
`Could not find route for ${tokenIn} -> ${tokenOut}`,
RouteQueryErrorCode.RouteDoesNotExist
)
);
}
if (tradeAmount.isZero()) {
return Promise.reject(
new WhirlpoolsError(
`findBestRoutes error - input amount is zero.`,
RouteQueryErrorCode.ZeroInputAmount
)
);
}
const routingOptions = { ...RouterUtils.getDefaultRouteOptions(), ...opts };
const { program, fetcher } = this.ctx;
const programId = program.programId;
await prefetchRoutes(paths, programId, fetcher, refresh);
try {
const [quoteMap, failures] = await getQuoteMap(
trade,
paths,
amountSpecifiedIsInput,
programId,
fetcher,
routingOptions
);
const bestRoutes = getBestRoutesFromQuoteMap(
quoteMap,
amountSpecifiedIsInput,
routingOptions
);
// TODO: Rudementary implementation to determine error. Find a better solution
if (bestRoutes.length === 0) {
// TODO: TRADE_AMOUNT_TOO_HIGH actually corresponds to TickArrayCrossingAboveMax. Fix swap quote.
if (failures.has(SwapErrorCode.TickArraySequenceInvalid)) {
return Promise.reject(
new WhirlpoolsError(
`All swap quote generation failed on amount too high.`,
RouteQueryErrorCode.TradeAmountTooHigh
)
);
}
}
return bestRoutes;
} catch (e: any) {
return Promise.reject(
new WhirlpoolsError(
`Stack error received on quote generation.`,
RouteQueryErrorCode.General,
e.stack
)
);
}
}
async findBestRoute(
trade: Trade,
refresh: boolean,
routingOpts?: Partial<RoutingOptions>,
selectionOpts?: Partial<RouteSelectOptions>
): Promise<ExecutableRoute | null> {
const allRoutes = await this.findAllRoutes(trade, refresh, routingOpts);
const selectOpts = { ...RouterUtils.getDefaultSelectOptions(), selectionOpts };
return await RouterUtils.selectFirstExecutableRoute(this.ctx, allRoutes, selectOpts);
}
async swap(
trade: TradeRoute,
slippage: Percentage,
resolvedAtas: AccountInfo[] | null
): Promise<TransactionBuilder> {
const txBuilder = await getSwapFromRoute(
this.ctx,
{
route: trade,
slippage,
resolvedAtaAccounts: resolvedAtas,
wallet: this.ctx.wallet.publicKey,
},
true
);
return txBuilder;
}
}
// Load all pool and tick-array data into the fetcher cache.
async function prefetchRoutes(
paths: Path[],
programId: Address,
fetcher: AccountFetcher,
refresh: boolean = false
): Promise<void> {
const poolSet = new Set<string>();
for (let i = 0; i < paths.length; i++) {
const path = paths[i];
for (let j = 0; j < path.edges.length; j++) {
poolSet.add(AddressUtil.toString(path.edges[j].poolAddress));
}
}
const ps = Array.from(poolSet);
const allWps = await fetcher.listPools(ps, refresh);
const tickArrayAddresses = [];
for (let i = 0; i < allWps.length; i++) {
const wp = allWps[i];
if (wp == null) {
continue;
}
const addr1 = SwapUtils.getTickArrayPublicKeys(
wp.tickCurrentIndex,
wp.tickSpacing,
true,
AddressUtil.toPubKey(programId),
AddressUtil.toPubKey(ps[i])
);
const addr2 = SwapUtils.getTickArrayPublicKeys(
wp.tickCurrentIndex,
wp.tickSpacing,
false,
AddressUtil.toPubKey(programId),
AddressUtil.toPubKey(ps[i])
);
const allAddrs = [...addr1, ...addr2].map((k) => k.toBase58());
const unique = Array.from(new Set(allAddrs));
tickArrayAddresses.push(...unique);
}
await fetcher.listTickArrays(tickArrayAddresses, refresh);
}

View File

@ -0,0 +1,42 @@
import { Token } from "@solana/spl-token";
import { PublicKey, SystemProgram, TransactionInstruction } from "@solana/web3.js";
export function createAssociatedTokenAccountInstruction(
associatedTokenProgramId: PublicKey,
tokenProgramId: PublicKey,
mint: PublicKey,
associatedAccount: PublicKey,
owner: PublicKey,
payer: PublicKey,
modeIdempotent: boolean
): TransactionInstruction {
if (!modeIdempotent) {
return Token.createAssociatedTokenAccountInstruction(
associatedTokenProgramId,
tokenProgramId,
mint,
associatedAccount,
owner,
payer
);
}
// create CreateIdempotent instruction
// spl-token v0.1.8 doesn't have a method for CreateIdempotent.
// https://github.com/solana-labs/solana-program-library/blob/master/associated-token-account/program/src/instruction.rs#L26
const keys = [
{ pubkey: payer, isSigner: true, isWritable: true },
{ pubkey: associatedAccount, isSigner: false, isWritable: true },
{ pubkey: owner, isSigner: false, isWritable: false },
{ pubkey: mint, isSigner: false, isWritable: false },
{ pubkey: SystemProgram.programId, isSigner: false, isWritable: false },
{ pubkey: tokenProgramId, isSigner: false, isWritable: false },
];
const instructionData = Buffer.from([1]);
return new TransactionInstruction({
keys,
programId: associatedTokenProgramId,
data: instructionData,
});
}

View File

@ -1,6 +1,7 @@
import { Address } from "@coral-xyz/anchor";
import { AddressUtil } from "@orca-so/common-sdk";
import { PublicKey } from "@solana/web3.js";
import _ from "lodash";
import "lodash.combinations";
import {
Edge,
Path,
@ -21,9 +22,12 @@ import { PoolGraphUtils } from "./public/pool-graph-utils";
*/
export class AdjacencyListPoolGraph implements PoolGraph {
readonly graph: Readonly<AdjacencyPoolGraphMap>;
readonly tokens: Readonly<Address[]>;
constructor(pools: PoolTokenPair[]) {
this.graph = buildPoolGraph(pools);
const [adjacencyListGraphMap, insertedTokens] = buildPoolGraph(pools);
this.graph = adjacencyListGraphMap;
this.tokens = Array.from(insertedTokens);
}
getPath(startMint: Address, endMint: Address, options?: PathSearchOptions): Path[] {
@ -35,55 +39,118 @@ export class AdjacencyListPoolGraph implements PoolGraph {
searchTokenPairs: [Address, Address][],
options?: PathSearchOptions
): PathSearchEntries {
const searchTokenPairsToFind = searchTokenPairs.filter(([startMint, endMint]) => {
return AddressUtil.toString(startMint) !== AddressUtil.toString(endMint);
});
const searchTokenPairsToFindAddrs = searchTokenPairsToFind.map(([startMint, endMint]) => {
const searchTokenPairsInString = searchTokenPairs.map(([startMint, endMint]) => {
return [AddressUtil.toString(startMint), AddressUtil.toString(endMint)] as const;
});
const searchTokenPairsToFind = searchTokenPairsInString.filter(([startMint, endMint]) => {
return startMint !== endMint;
});
const walkMap = findWalks(
searchTokenPairsToFindAddrs,
searchTokenPairsToFind,
this.graph,
options?.intermediateTokens.map((token) => AddressUtil.toString(token))
);
const results = searchTokenPairs.map(([startMint, endMint]) => {
const results = searchTokenPairsInString.map(([startMint, endMint]) => {
const searchRouteId = PoolGraphUtils.getSearchPathId(startMint, endMint);
const internalRouteId = getInternalRouteId(startMint, endMint);
const [internalStartMint, internalEndMint] = [startMint, endMint].sort();
const internalRouteId = getInternalRouteId(internalStartMint, internalEndMint, false);
const reversed = internalStartMint !== startMint;
const pathsForSearchPair = walkMap[internalRouteId];
const paths = pathsForSearchPair
? pathsForSearchPair.map<Path>((path) => {
return {
startTokenMint: AddressUtil.toString(startMint),
endTokenMint: AddressUtil.toString(endMint),
edges: getHopsFromRoute(internalRouteId, searchRouteId, path),
startTokenMint: startMint,
endTokenMint: endMint,
edges: getHopsFromRoute(path, reversed),
};
})
: [];
return [searchRouteId, paths] as const;
});
return results;
}
getAllPaths(options?: PathSearchOptions | undefined): PathSearchEntries {
const tokenPairCombinations = _.combinations(this.tokens, 2) as [string, string][];
const searchTokenPairsInString = tokenPairCombinations.map(([startMint, endMint]) => {
return [startMint, endMint] as const;
});
const searchTokenPairsToFind = searchTokenPairsInString.filter(([startMint, endMint]) => {
return startMint !== endMint;
});
const walkMap = findWalks(
searchTokenPairsToFind,
this.graph,
options?.intermediateTokens.map((token) => AddressUtil.toString(token))
);
// TODO: The token pairs are is in 1 direction only, we have to reverse them to get the other direction.
// this is actually pretty slow.consider removing reversal optimization in findWalks
const results = searchTokenPairsInString.reduce<PathSearchEntries>(
(acc, [startMint, endMint]) => {
const searchRouteId = PoolGraphUtils.getSearchPathId(startMint, endMint);
// We do not support routes that routes between identical tokens
if (startMint === endMint) {
acc.push([searchRouteId, []]);
return acc;
}
const [internalStartMint, internalEndMint] = [startMint, endMint].sort();
const internalRouteId = getInternalRouteId(internalStartMint, internalEndMint, false);
const reversed = internalStartMint !== startMint;
const pathsForSearchPair = walkMap[internalRouteId];
const paths = pathsForSearchPair
? pathsForSearchPair.map<Path>((path) => {
return {
startTokenMint: startMint,
endTokenMint: endMint,
edges: getHopsFromRoute(path, reversed),
};
})
: [];
acc.push([searchRouteId, paths]);
const reversedSearchRouteId = PoolGraphUtils.getSearchPathId(endMint, startMint);
const reversedPaths = pathsForSearchPair
? pathsForSearchPair.map<Path>((path) => {
return {
startTokenMint: endMint,
endTokenMint: startMint,
edges: getHopsFromRoute(path, !reversed),
};
})
: [];
acc.push([reversedSearchRouteId, reversedPaths]);
return acc;
},
[]
);
return results;
}
}
function getHopsFromRoute(internalRouteId: string, searchRouteId: string, path: string[]): Edge[] {
const [intStartA] = PoolGraphUtils.deconstructPathId(internalRouteId);
const [searchStartA] = PoolGraphUtils.deconstructPathId(searchRouteId);
const shouldReverseRoute = searchStartA !== intStartA;
const finalRoutes = shouldReverseRoute ? path.slice().reverse() : path;
function getHopsFromRoute(path: string[], reversed: boolean): Edge[] {
const finalRoutes = reversed ? path.slice().reverse() : path;
return finalRoutes.map((hopStr) => {
return { poolAddress: new PublicKey(hopStr) };
return { poolAddress: hopStr };
});
}
type AdjacencyPoolGraphMap = Record<string, PoolGraphEdge[]>;
type AdjacencyPoolGraphMap = Record<string, readonly PoolGraphEdge[]>;
type PoolGraphEdge = {
address: string;
@ -93,12 +160,18 @@ type PoolGraphEdge = {
// A record of path-id (tokenA-tokenB) to a list of edges
type PoolWalks = Record<string, string[][]>;
function buildPoolGraph(pools: PoolTokenPair[]): Readonly<AdjacencyPoolGraphMap> {
function buildPoolGraph(
pools: PoolTokenPair[]
): readonly [Readonly<AdjacencyPoolGraphMap>, Set<string>] {
const insertedPoolCache: Record<string, Set<string>> = {};
const insertedTokens = new Set<string>();
const poolGraphSet = pools.reduce((poolGraph: Record<string, PoolGraphEdge[]>, pool) => {
const { address, tokenMintA, tokenMintB } = pool;
const [addr, mintA, mintB] = AddressUtil.toStrings([address, tokenMintA, tokenMintB]);
insertedTokens.add(mintA);
insertedTokens.add(mintB);
if (poolGraph[mintA] === undefined) {
poolGraph[mintA] = [];
insertedPoolCache[mintA] = new Set<string>();
@ -127,7 +200,7 @@ function buildPoolGraph(pools: PoolTokenPair[]): Readonly<AdjacencyPoolGraphMap>
return poolGraph;
}, {});
return poolGraphSet;
return [poolGraphSet, insertedTokens] as const;
}
// This is currently hardcoded to find walks of max length 2, generalizing to longer walks
@ -144,8 +217,8 @@ function findWalks(
let paths = [];
// Adjust walk's from & to token based of of internal path id.
const internalPathId = getInternalRouteId(tokenMintFrom, tokenMintTo);
const [internalTokenMintFrom, internalTokenMintTo] = [tokenMintFrom, tokenMintTo].sort();
const internalPathId = getInternalRouteId(internalTokenMintFrom, internalTokenMintTo, false);
const poolsForTokenFrom = poolGraph[internalTokenMintFrom] || [];
const poolsForTokenTo = poolGraph[internalTokenMintTo] || [];
@ -187,8 +260,8 @@ function findWalks(
return walks;
}
function getInternalRouteId(tokenA: Address, tokenB: Address): string {
function getInternalRouteId(tokenA: Address, tokenB: Address, sort = true): string {
const mints = [AddressUtil.toString(tokenA), AddressUtil.toString(tokenB)];
const sortedMints = mints.sort();
return `${sortedMints[0]}${PoolGraphUtils.PATH_ID_DELIMITER}${sortedMints[1]} `;
const sortedMints = sort ? mints.sort() : mints;
return `${sortedMints[0]}${PoolGraphUtils.PATH_ID_DELIMITER}${sortedMints[1]}`;
}

View File

@ -9,10 +9,10 @@ export class PoolGraphUtils {
static readonly PATH_ID_DELIMITER = "-";
/**
* Get a search path id from two tokens. The id can be used to identify a path between the two tokens in {@link RouteSearchEntires}.
* Get a search path id from two tokens. The id can be used to identify a path between the two tokens in {@link PathSearchEntries}.
* @param tokenA The first token in the path
* @param tokenB The second token in the path
* @returns A path id that can be used to identify a path between the two tokens in {@link RouteSearchEntires}.
* @returns A path id that can be used to identify a path between the two tokens in {@link PathSearchEntries}.
*/
static getSearchPathId(tokenA: Address, tokenB: Address): string {
return `${AddressUtil.toString(tokenA)}${
@ -25,7 +25,7 @@ export class PoolGraphUtils {
* @param pathId - The path id to deconstruct
* @returns A tuple of the two tokens in the path id. Returns undefined if the provided pathId is invalid.
*/
static deconstructPathId(pathId: string): [string, string] {
static deconstructPathId(pathId: string): readonly [string, string] {
const split = pathId.split(PoolGraphUtils.PATH_ID_DELIMITER);
if (split.length !== 2) {
@ -33,6 +33,6 @@ export class PoolGraphUtils {
}
const [tokenA, tokenB] = split;
return [tokenA, tokenB];
return [tokenA, tokenB] as const;
}
}

View File

@ -89,4 +89,11 @@ export type PoolGraph = {
searchTokenPairs: [Address, Address][],
options?: PathSearchOptions
): PathSearchEntries;
/**
* Get a list of all paths for this pool graph.
* @param options Options for finding a path
* @return An array of all permutations of token-pairs to the paths for each pair.
*/
getAllPaths(options?: PathSearchOptions): PathSearchEntries;
};

View File

@ -0,0 +1,84 @@
const RECURSION_BREAKPOINT = 600;
/**
* Implementation of Floyd-Rivest selection
* https://en.wikipedia.org/wiki/Floyd%E2%80%93Rivest_algorithm
*
* Performs an in place partition of an array of items, such that
* indices [0, k) contain the k smallest elements and all indices
* [k, array.length) are larger than all elements in [0, k)
*
* @param array
* @param k
* @param left
* @param right
* @param compare
*/
export function kSmallestPartition<T>(
array: T[],
k: number,
left: number = 0,
right: number = array.length - 1,
compare: (a: T, b: T) => number = defaultCompare
) {
while (right > left) {
// Recursive sampling and partition of the set
if (right - left > RECURSION_BREAKPOINT) {
const n = right - left + 1;
const i = k - left + 1;
const z = Math.log(n);
const s = 0.5 * Math.exp((2 * z) / 3);
const sd = 0.5 * Math.sqrt((z * s * (n - s)) / n) * (i - n / 2 < 0 ? -1 : 1);
const newLeft = Math.max(left, Math.floor(k - (i * s) / n + sd));
const newRight = Math.min(right, Math.floor(k + ((n - i) * s) / n + sd));
kSmallestPartition(array, k, newLeft, newRight, compare);
}
// Partition elements around t
const t = array[k];
let i = left;
let j = right;
swap(array, left, k);
if (compare(array[right], t) > 0) {
swap(array, left, right);
}
while (i < j) {
swap(array, i, j);
i++;
j--;
while (compare(array[i], t) < 0) {
i++;
}
while (compare(array[j], t) > 0) {
j--;
}
}
if (compare(array[left], t) === 0) {
swap(array, left, j);
} else {
j++;
swap(array, j, right);
}
// Adjust boundaries of partitions
if (j <= k) {
left = j + 1;
}
if (k <= j) {
right = j - 1;
}
}
}
function swap<T>(arr: T[], i: number, j: number) {
const tmp = arr[i];
arr[i] = arr[j];
arr[j] = tmp;
}
function defaultCompare<T>(a: T, b: T) {
return a < b ? -1 : a > b ? 1 : 0;
}

View File

@ -20,6 +20,17 @@ import { PoolUtil } from "./pool-utils";
import { TickUtil } from "./tick-utils";
import { SwapDirection, TokenType } from "./types";
/**
* A request to fetch the tick-arrays that a swap may traverse across.
* @category Whirlpool Utils
*/
export interface TickArrayRequest {
whirlpoolAddress: PublicKey;
aToB: boolean;
tickCurrentIndex: number;
tickSpacing: number;
}
/**
* @category Whirlpool Utils
*/
@ -125,19 +136,54 @@ export class SwapUtils {
fetcher: AccountFetcher,
refresh: boolean
): Promise<TickArray[]> {
const addresses = SwapUtils.getTickArrayPublicKeys(
tickCurrentIndex,
tickSpacing,
aToB,
programId,
whirlpoolAddress
);
const data = await this.getBatchTickArrays(programId, fetcher, refresh, [
{ tickCurrentIndex, tickSpacing, aToB, whirlpoolAddress },
]);
return data[0];
}
/**
* Fetch a batch of tick-arrays for a set of TA requests.
* @param programId - The Whirlpool programId which the Whirlpool lives on.
* @param fetcher - AccountFetcher object to fetch solana accounts
* @param refresh - If true, fetcher would default to fetching the latest accounts
* @param tickArrayRequests - An array of {@link TickArrayRequest} of tick-arrays to request for.
* @returns A array of request indicies mapped to an array of resulting PublicKeys.
*/
public static async getBatchTickArrays(
programId: PublicKey,
fetcher: AccountFetcher,
refresh: boolean,
tickArrayRequests: TickArrayRequest[]
): Promise<TickArray[][]> {
let addresses: PublicKey[] = [];
let requestToIndices = [];
// Each individual tick array request may correspond to more than one tick array
// so we map each request to a slice of the batch request
for (let i = 0; i < tickArrayRequests.length; i++) {
const { tickCurrentIndex, tickSpacing, aToB, whirlpoolAddress } = tickArrayRequests[i];
const requestAddresses = SwapUtils.getTickArrayPublicKeys(
tickCurrentIndex,
tickSpacing,
aToB,
programId,
whirlpoolAddress
);
requestToIndices.push([addresses.length, addresses.length + requestAddresses.length]);
addresses.push(...requestAddresses);
}
const data = await fetcher.listTickArrays(addresses, refresh);
return addresses.map((addr, index) => {
return {
// Re-map from flattened batch data to TickArray[] for request
return requestToIndices.map((indices) => {
const [start, end] = indices;
const addressSlice = addresses.slice(start, end);
const dataSlice = data.slice(start, end);
return addressSlice.map((addr, index) => ({
address: addr,
data: data[index],
};
data: dataSlice[index],
}));
});
}
@ -191,20 +237,41 @@ export class SwapUtils {
outputTokenAssociatedAddress: Address,
wallet: PublicKey
) {
const addr = whirlpool.getAddress();
const data = whirlpool.getData();
return this.getSwapParamsFromQuoteKeys(
quote,
ctx,
whirlpool.getAddress(),
data.tokenVaultA,
data.tokenVaultB,
inputTokenAssociatedAddress,
outputTokenAssociatedAddress,
wallet
);
}
public static getSwapParamsFromQuoteKeys(
quote: SwapInput,
ctx: WhirlpoolContext,
whirlpool: PublicKey,
tokenVaultA: PublicKey,
tokenVaultB: PublicKey,
inputTokenAssociatedAddress: Address,
outputTokenAssociatedAddress: Address,
wallet: PublicKey
) {
const aToB = quote.aToB;
const [inputTokenATA, outputTokenATA] = AddressUtil.toPubKeys([
inputTokenAssociatedAddress,
outputTokenAssociatedAddress,
]);
const oraclePda = PDAUtil.getOracle(ctx.program.programId, addr);
const oraclePda = PDAUtil.getOracle(ctx.program.programId, whirlpool);
const params: SwapParams = {
whirlpool: whirlpool.getAddress(),
whirlpool,
tokenOwnerAccountA: aToB ? inputTokenATA : outputTokenATA,
tokenOwnerAccountB: aToB ? outputTokenATA : inputTokenATA,
tokenVaultA: data.tokenVaultA,
tokenVaultB: data.tokenVaultB,
tokenVaultA,
tokenVaultB,
oracle: oraclePda.publicKey,
tokenAuthority: wallet,
...quote,

View File

@ -0,0 +1,12 @@
import { Wallet } from "@orca-so/common-sdk";
import { PublicKey } from "@solana/web3.js";
/**
* Checks if a wallet is connected.
* @category Whirlpool Utils
* @param wallet The wallet to check.
* @returns True if the wallet is connected, false otherwise.
*/
export function isWalletConnected(wallet: Wallet | null): boolean {
return wallet !== null && !wallet.publicKey.equals(PublicKey.default);
}

View File

@ -5,6 +5,7 @@ import { WhirlpoolContext } from "./context";
import { WhirlpoolClientImpl } from "./impl/whirlpool-client-impl";
import { DevFeeSwapInput, SwapInput } from "./instructions";
import { AccountFetcher } from "./network/public";
import { WhirlpoolRouter } from "./router/public";
import {
DecreaseLiquidityInput,
IncreaseLiquidityInput,
@ -32,6 +33,13 @@ export interface WhirlpoolClient {
*/
getFetcher: () => AccountFetcher;
/**
* Get a WhirlpoolRouter to help generate the best prices when transacting across a set of pools.
* @param poolAddresses the addresses of the Whirlpool account addresses to route through
* @returns a {@link WhirlpoolRouter} instance
*/
getRouter: (poolAddresses: Address[]) => Promise<WhirlpoolRouter>;
/**
* Get a Whirlpool object to interact with the Whirlpool account at the given address.
* @param poolAddress the address of the Whirlpool account

View File

@ -174,7 +174,7 @@ describe("PositionImpl#collectRewards()", () => {
for (let i = 0; i < NUM_REWARDS; i++) {
assert.ok(!quote[i]!.isZero());
}
for (let i = 0; i < NUM_REWARDS; i++) {
const rewardATA = await deriveATA(otherWallet.publicKey, rewards[i].rewardMint);
const rewardTokenAccount = await testCtx.whirlpoolCtx.fetcher.getTokenInfo(rewardATA, true);

View File

@ -116,10 +116,10 @@
"@nodelib/fs.scandir" "2.1.5"
fastq "^1.6.0"
"@orca-so/common-sdk@0.2.1":
version "0.2.1"
resolved "https://registry.yarnpkg.com/@orca-so/common-sdk/-/common-sdk-0.2.1.tgz#fd95ee300a031cb798de59bfaab7f653f04adeec"
integrity sha512-HbY2HEisHZPuKPzmJDBSsGx9BVrv3ubK3h0zTp9jVOJyO2k92H/YYq/G0nBGZJgXr1HgAnMZnQMNVtVaEO5FmA==
"@orca-so/common-sdk@0.2.2":
version "0.2.2"
resolved "https://registry.yarnpkg.com/@orca-so/common-sdk/-/common-sdk-0.2.2.tgz#c912ad3d6d37df5119fa40ca21b9e4ccd3855582"
integrity sha512-ZL8D9/RbT0xKb9CIVMPl7ZBzbhQGCsskyEy1DKMlQTPyktzLXyN0SRAg+NgjLnGd9mJwB/8JX0c7SyB5zE9wlQ==
dependencies:
"@solana/spl-token" "0.1.8"
"@solana/web3.js" "^1.74.0"
@ -262,6 +262,11 @@
resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee"
integrity sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==
"@types/lodash@4.14.194":
version "4.14.194"
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.194.tgz#b71eb6f7a0ff11bff59fc987134a093029258a76"
integrity sha512-r22s9tAS7imvBt2lyHC9B8AGwWnXaYb1tY09oyLkXDs4vArpYJzw09nj8MLx5VfciBPGIb+ZwG0ssYnEPJxn/g==
"@types/mocha@^9.0.0":
version "9.1.1"
resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-9.1.1.tgz#e7c4f1001eefa4b8afbd1eee27a237fee3bf29c4"
@ -1088,6 +1093,11 @@ locate-path@^6.0.0:
dependencies:
p-locate "^5.0.0"
lodash.combinations@^18.11.1:
version "18.11.1"
resolved "https://registry.yarnpkg.com/lodash.combinations/-/lodash.combinations-18.11.1.tgz#4b55cba7f01f6a8fd889a15fe6f57f0e61a77b4f"
integrity sha512-0jtulyUQA1My13JuMR23MHqsMk8pQswcy+fO0jTKRp41bi+dDWflv/Ct4qRW6CcbLkk2Qi3PZyzx+tqgqSYLug==
lodash@^4.17.20:
version "4.17.21"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"