Replace AccountFetcher with WhirlpoolAccountFetcher (#107)

- Replace AccountFetcher with WhirlpoolAccountFetcher. 
- Modify fetcher references to an interface
- Update PriceModuleUtils to only take in fetcher instead of ctx
This commit is contained in:
meep 2023-06-27 13:39:37 +08:00 committed by GitHub
parent e06505fb1e
commit 0fdf8e5dc6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
103 changed files with 1487 additions and 1455 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,16 +2,14 @@
<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/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">
</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/adbe2a7/sdk/src/utils/graphs/public/pool-graph-builder.ts#L46">utils/graphs/public/pool-graph-builder.ts:46</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/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">
</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="../interfaces/WhirlpoolAccountFetcherInterface.html" class="tsd-signature-type" data-tsd-kind="Interface">WhirlpoolAccountFetcherInterface</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/adbe2a7/sdk/src/utils/graphs/public/pool-graph-builder.ts#L20">utils/graphs/public/pool-graph-builder.ts:20</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>
</div></div></li><li><h5>fetcher: <a href="AccountFetcher.html" class="tsd-signature-type" data-tsd-kind="Class">AccountFetcher</a></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p><a href="AccountFetcher.html">AccountFetcher</a> to use for fetching pool 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><a href="../modules.html#PoolGraph" class="tsd-signature-type" data-tsd-kind="Type alias">PoolGraph</a><span class="tsd-signature-symbol">&gt;</span></h4><div><p>A <a href="../modules.html#PoolGraph">PoolGraph</a> with the provided pools</p>
</div></div></li><li><h5>fetcher: <a href="../interfaces/WhirlpoolAccountFetcherInterface.html" class="tsd-signature-type" data-tsd-kind="Interface">WhirlpoolAccountFetcherInterface</a></h5></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#PoolGraph" class="tsd-signature-type" data-tsd-kind="Type alias">PoolGraph</a><span class="tsd-signature-symbol">&gt;</span></h4><div><p>A <a href="../modules.html#PoolGraph">PoolGraph</a> with the provided pools</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="PoolGraphBuilder.html" class="tsd-kind-icon">Pool<wbr/>Graph<wbr/>Builder</a><ul><li class="tsd-kind-constructor tsd-parent-kind-class"><a href="PoolGraphBuilder.html#constructor" class="tsd-kind-icon">constructor</a></li><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></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,48 +1,48 @@
<!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">
</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/adbe2a7/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">
</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/adbe2a7/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">
</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/adbe2a7/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">
</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/adbe2a7/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">
</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/adbe2a7/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">
</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/adbe2a7/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">
</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/adbe2a7/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">
</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/adbe2a7/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">
</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/adbe2a7/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>

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,35 +1,35 @@
<!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/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">
</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>fetcher<span class="tsd-signature-symbol">: </span><a href="../interfaces/WhirlpoolAccountFetcherInterface.html" class="tsd-signature-type" data-tsd-kind="Interface">WhirlpoolAccountFetcherInterface</a>, mints<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Address</span><span class="tsd-signature-symbol">[]</span>, opts<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">SimpleAccountFetchOptions</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/adbe2a7/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>
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>fetcher: <a href="../interfaces/WhirlpoolAccountFetcherInterface.html" class="tsd-signature-type" data-tsd-kind="Interface">WhirlpoolAccountFetcherInterface</a></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p><a href="../interfaces/WhirlpoolAccountFetcherInterface.html">WhirlpoolAccountFetcherInterface</a></p>
</div></div></li><li><h5>mints: <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 mints to fetch decimals for.</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><li><h5>opts: <span class="tsd-signature-type">SimpleAccountFetchOptions</span><span class="tsd-signature-symbol"> = IGNORE_CACHE</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p>an <a href="../modules.html#WhirlpoolAccountFetchOptions">WhirlpoolAccountFetchOptions</a> object to define fetch and cache options when accessing on-chain 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><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/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">
</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>fetcher<span class="tsd-signature-symbol">: </span><a href="../interfaces/WhirlpoolAccountFetcherInterface.html" class="tsd-signature-type" data-tsd-kind="Interface">WhirlpoolAccountFetcherInterface</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>, opts<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">SimpleAccountFetchOptions</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/adbe2a7/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">
<p><a href="WhirlpoolContext.html">WhirlpoolContext</a></p>
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>fetcher: <a href="../interfaces/WhirlpoolAccountFetcherInterface.html" class="tsd-signature-type" data-tsd-kind="Interface">WhirlpoolAccountFetcherInterface</a></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p><a href="../interfaces/WhirlpoolAccountFetcherInterface.html">WhirlpoolAccountFetcherInterface</a></p>
</div></div></li><li><h5>mints: <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 mints to fetch pool data for.</p>
</div></div></li><li><h5>config: <a href="../modules.html#GetPricesConfig" class="tsd-signature-type" data-tsd-kind="Type alias">GetPricesConfig</a><span class="tsd-signature-symbol"> = defaultGetPricesConfig</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p>The configuration for the price calculation.</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><li><h5>opts: <span class="tsd-signature-type">SimpleAccountFetchOptions</span><span class="tsd-signature-symbol"> = IGNORE_CACHE</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p>an <a href="../modules.html#WhirlpoolAccountFetchOptions">WhirlpoolAccountFetchOptions</a> object to define fetch and cache options when accessing on-chain 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><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/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">
</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>fetcher<span class="tsd-signature-symbol">: </span><a href="../interfaces/WhirlpoolAccountFetcherInterface.html" class="tsd-signature-type" data-tsd-kind="Interface">WhirlpoolAccountFetcherInterface</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>, opts<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">SimpleAccountFetchOptions</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/adbe2a7/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>
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>fetcher: <a href="../interfaces/WhirlpoolAccountFetcherInterface.html" class="tsd-signature-type" data-tsd-kind="Interface">WhirlpoolAccountFetcherInterface</a></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p><a href="../interfaces/WhirlpoolAccountFetcherInterface.html">WhirlpoolAccountFetcherInterface</a></p>
</div></div></li><li><h5>pools: <a href="../modules.html#PoolMap" class="tsd-signature-type" data-tsd-kind="Type alias">PoolMap</a></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p>The pools to fetch tick-array data for.</p>
</div></div></li><li><h5>config: <a href="../modules.html#GetPricesConfig" class="tsd-signature-type" data-tsd-kind="Type alias">GetPricesConfig</a><span class="tsd-signature-symbol"> = defaultGetPricesConfig</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p>The configuration for the price calculation.</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><li><h5>opts: <span class="tsd-signature-type">SimpleAccountFetchOptions</span><span class="tsd-signature-symbol"> = IGNORE_CACHE</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p>an <a href="../modules.html#WhirlpoolAccountFetchOptions">WhirlpoolAccountFetchOptions</a> object to define fetch and cache options when accessing on-chain 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><a href="../modules.html#TickArrayMap" class="tsd-signature-type" data-tsd-kind="Type alias">TickArrayMap</a><span class="tsd-signature-symbol">&gt;</span></h4><div><p>A <a href="../modules.html#TickArrayMap">TickArrayMap</a> of tick-array addresses to tick-array data.</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="PriceModuleUtils.html" class="tsd-kind-icon">Price<wbr/>Module<wbr/>Utils</a><ul><li class="tsd-kind-constructor tsd-parent-kind-class"><a href="PriceModuleUtils.html#constructor" class="tsd-kind-icon">constructor</a></li><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></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,17 +1,17 @@
<!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">
</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/adbe2a7/sdk/src/router/public/router-utils.ts#L161">router/public/router-utils.ts:161</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">
</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/adbe2a7/sdk/src/router/public/router-utils.ts#L174">router/public/router-utils.ts:174</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">
</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/adbe2a7/sdk/src/router/public/router-utils.ts#L143">router/public/router-utils.ts:143</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">
</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/adbe2a7/sdk/src/router/public/router-utils.ts#L58">router/public/router-utils.ts:58</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>

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

@ -1,13 +1,13 @@
<!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">
</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/adbe2a7/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">
</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/adbe2a7/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>

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/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>
</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/adbe2a7/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/adbe2a7/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/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>
</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/adbe2a7/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/adbe2a7/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,8 +0,0 @@
<!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/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>
</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" data-tsd-kind="Type parameter">T</span></h4><div><p>Parsed entity</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 tsd-has-type-parameter"><a href="ParsableEntity.html" class="tsd-kind-icon">Parsable<wbr/>Entity</a><ul><li class="tsd-kind-method tsd-parent-kind-interface"><a href="ParsableEntity.html#parse" class="tsd-kind-icon">parse</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>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/9e0a389/sdk/src/whirlpool-client.ts#L384">whirlpool-client.ts:384</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>, opts<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">SimpleAccountFetchOptions</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/adbe2a7/sdk/src/whirlpool-client.ts#L387">whirlpool-client.ts:387</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">
@ -13,10 +13,10 @@
<p>the wallet to that houses the position token. If null, the WhirlpoolContext wallet is used.</p>
</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><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><li><h5><span class="tsd-flag ts-flagOptional">Optional</span> opts: <span class="tsd-signature-type">SimpleAccountFetchOptions</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p>an options object to define fetch and cache options when accessing on-chain 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 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/9e0a389/sdk/src/whirlpool-client.ts#L407">whirlpool-client.ts:407</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>, opts<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">SimpleAccountFetchOptions</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/adbe2a7/sdk/src/whirlpool-client.ts#L410">whirlpool-client.ts:410</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">
@ -31,10 +31,10 @@
<p>the wallet to that houses the position token. If null, the WhirlpoolContext wallet is used.</p>
</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><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><li><h5><span class="tsd-flag ts-flagOptional">Optional</span> opts: <span class="tsd-signature-type">SimpleAccountFetchOptions</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p>an options object to define fetch and cache options when accessing on-chain 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 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/9e0a389/sdk/src/whirlpool-client.ts#L363">whirlpool-client.ts:363</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/adbe2a7/sdk/src/whirlpool-client.ts#L366">whirlpool-client.ts:366</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/9e0a389/sdk/src/whirlpool-client.ts#L299">whirlpool-client.ts:299</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/adbe2a7/sdk/src/whirlpool-client.ts#L302">whirlpool-client.ts:302</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/9e0a389/sdk/src/whirlpool-client.ts#L305">whirlpool-client.ts:305</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/adbe2a7/sdk/src/whirlpool-client.ts#L308">whirlpool-client.ts:308</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/9e0a389/sdk/src/whirlpool-client.ts#L317">whirlpool-client.ts:317</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/adbe2a7/sdk/src/whirlpool-client.ts#L320">whirlpool-client.ts:320</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/9e0a389/sdk/src/whirlpool-client.ts#L323">whirlpool-client.ts:323</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/adbe2a7/sdk/src/whirlpool-client.ts#L326">whirlpool-client.ts:326</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/9e0a389/sdk/src/whirlpool-client.ts#L311">whirlpool-client.ts:311</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/adbe2a7/sdk/src/whirlpool-client.ts#L314">whirlpool-client.ts:314</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/9e0a389/sdk/src/whirlpool-client.ts#L343">whirlpool-client.ts:343</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/adbe2a7/sdk/src/whirlpool-client.ts#L346">whirlpool-client.ts:346</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/9e0a389/sdk/src/whirlpool-client.ts#L329">whirlpool-client.ts:329</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/adbe2a7/sdk/src/whirlpool-client.ts#L332">whirlpool-client.ts:332</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/9e0a389/sdk/src/whirlpool-client.ts#L256">whirlpool-client.ts:256</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/adbe2a7/sdk/src/whirlpool-client.ts#L259">whirlpool-client.ts:259</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,38 +14,38 @@
<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/9e0a389/sdk/src/whirlpool-client.ts#L139">whirlpool-client.ts:139</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/adbe2a7/sdk/src/whirlpool-client.ts#L142">whirlpool-client.ts:142</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/9e0a389/sdk/src/whirlpool-client.ts#L145">whirlpool-client.ts:145</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/adbe2a7/sdk/src/whirlpool-client.ts#L148">whirlpool-client.ts:148</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/9e0a389/sdk/src/whirlpool-client.ts#L181">whirlpool-client.ts:181</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/adbe2a7/sdk/src/whirlpool-client.ts#L184">whirlpool-client.ts:184</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/9e0a389/sdk/src/whirlpool-client.ts#L157">whirlpool-client.ts:157</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/adbe2a7/sdk/src/whirlpool-client.ts#L160">whirlpool-client.ts:160</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/9e0a389/sdk/src/whirlpool-client.ts#L163">whirlpool-client.ts:163</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/adbe2a7/sdk/src/whirlpool-client.ts#L166">whirlpool-client.ts:166</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/9e0a389/sdk/src/whirlpool-client.ts#L169">whirlpool-client.ts:169</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">Account</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/adbe2a7/sdk/src/whirlpool-client.ts#L172">whirlpool-client.ts:172</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/9e0a389/sdk/src/whirlpool-client.ts#L175">whirlpool-client.ts:175</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
</div></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Account</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">Account</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/adbe2a7/sdk/src/whirlpool-client.ts#L178">whirlpool-client.ts:178</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/9e0a389/sdk/src/whirlpool-client.ts#L193">whirlpool-client.ts:193</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
</div></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Account</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>, opts<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">SimpleAccountFetchOptions</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/adbe2a7/sdk/src/whirlpool-client.ts#L196">whirlpool-client.ts:196</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">
<p>A group of ticks that define the desired tick-arrays to initialize. If the tick&#39;s array has been initialized, it will be ignored.</p>
</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><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><li><h5><span class="tsd-flag ts-flagOptional">Optional</span> opts: <span class="tsd-signature-type">SimpleAccountFetchOptions</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p>an <a href="../modules.html#WhirlpoolAccountFetchOptions">WhirlpoolAccountFetchOptions</a> object to define fetch and cache options when accessing on-chain 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">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/9e0a389/sdk/src/whirlpool-client.ts#L213">whirlpool-client.ts:213</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/adbe2a7/sdk/src/whirlpool-client.ts#L216">whirlpool-client.ts:216</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/9e0a389/sdk/src/whirlpool-client.ts#L235">whirlpool-client.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-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/adbe2a7/sdk/src/whirlpool-client.ts#L238">whirlpool-client.ts:238</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/9e0a389/sdk/src/whirlpool-client.ts#L151">whirlpool-client.ts:151</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/adbe2a7/sdk/src/whirlpool-client.ts#L154">whirlpool-client.ts:154</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/9e0a389/sdk/src/whirlpool-client.ts#L271">whirlpool-client.ts:271</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/adbe2a7/sdk/src/whirlpool-client.ts#L274">whirlpool-client.ts:274</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/9e0a389/sdk/src/whirlpool-client.ts#L282">whirlpool-client.ts:282</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/adbe2a7/sdk/src/whirlpool-client.ts#L285">whirlpool-client.ts:285</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>

File diff suppressed because one or more lines are too long

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><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">
</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>, opts<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">SimpleAccountFetchOptions</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/adbe2a7/sdk/src/whirlpool-client.ts#L89">whirlpool-client.ts:89</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><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> opts: <span class="tsd-signature-type">SimpleAccountFetchOptions</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p>an options object to define fetch and cache options when accessing on-chain 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">[]</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/9e0a389/sdk/src/whirlpool-client.ts#L116">whirlpool-client.ts:116</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/adbe2a7/sdk/src/whirlpool-client.ts#L119">whirlpool-client.ts:119</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/9e0a389/sdk/src/whirlpool-client.ts#L102">whirlpool-client.ts:102</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/adbe2a7/sdk/src/whirlpool-client.ts#L105">whirlpool-client.ts:105</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,40 +24,40 @@
</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/9e0a389/sdk/src/whirlpool-client.ts#L28">whirlpool-client.ts:28</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/adbe2a7/sdk/src/whirlpool-client.ts#L31">whirlpool-client.ts:31</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/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/9e0a389/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="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="WhirlpoolAccountFetcherInterface.html" class="tsd-signature-type" data-tsd-kind="Interface">WhirlpoolAccountFetcherInterface</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/adbe2a7/sdk/src/whirlpool-client.ts#L37">whirlpool-client.ts:37</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Get an WhirlpoolAccountCacheInterface to fetch and cache Whirlpool accounts</p>
</div></div><h4 class="tsd-returns-title">Returns <a href="WhirlpoolAccountFetcherInterface.html" class="tsd-signature-type" data-tsd-kind="Interface">WhirlpoolAccountFetcherInterface</a></h4><div><p>an WhirlpoolAccountCacheInterface 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>, opts<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">SimpleAccountFetchOptions</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/adbe2a7/sdk/src/whirlpool-client.ts#L52">whirlpool-client.ts:52</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><li><h5><span class="tsd-flag ts-flagOptional">Optional</span> opts: <span class="tsd-signature-type">SimpleAccountFetchOptions</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p>an options object to define fetch and cache options when accessing on-chain 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><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/9e0a389/sdk/src/whirlpool-client.ts#L57">whirlpool-client.ts:57</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>, opts<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">SimpleAccountFetchOptions</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/adbe2a7/sdk/src/whirlpool-client.ts#L60">whirlpool-client.ts:60</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><li><h5><span class="tsd-flag ts-flagOptional">Optional</span> opts: <span class="tsd-signature-type">SimpleAccountFetchOptions</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p>an options object to define fetch and cache options when accessing on-chain 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><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/9e0a389/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="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>, opts<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">SimpleAccountFetchOptions</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/adbe2a7/sdk/src/whirlpool-client.ts#L69">whirlpool-client.ts:69</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">
<p>the address of the Position 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><li><h5><span class="tsd-flag ts-flagOptional">Optional</span> opts: <span class="tsd-signature-type">SimpleAccountFetchOptions</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p>an options object to define fetch and cache options when accessing on-chain 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><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/9e0a389/sdk/src/whirlpool-client.ts#L74">whirlpool-client.ts:74</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>, opts<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">SimpleAccountFetchOptions</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/adbe2a7/sdk/src/whirlpool-client.ts#L77">whirlpool-client.ts:77</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><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> opts: <span class="tsd-signature-type">SimpleAccountFetchOptions</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p>an options object to define fetch and cache options when accessing on-chain 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">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 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">
</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/adbe2a7/sdk/src/whirlpool-client.ts#L44">whirlpool-client.ts:44</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>

View File

@ -2,32 +2,30 @@
<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">
</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>, 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>, fetchOpts<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">SimpleAccountFetchOptions</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/adbe2a7/sdk/src/router/public/index.ts#L140">router/public/index.ts:140</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>
<p>an <a href="../modules.html#WhirlpoolAccountFetchOptions">WhirlpoolAccountFetchOptions</a> object to define fetch and cache options when accessing on-chain accounts</p>
</div></div></li><li><h5><span class="tsd-flag ts-flagOptional">Optional</span> fetchOpts: <span class="tsd-signature-type">SimpleAccountFetchOptions</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p><a href="../modules.html#WhirlpoolAccountFetchOptions">WhirlpoolAccountFetchOptions</a> to configure the fetching of 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><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">
</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>, 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>, fetchOpts<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">SimpleAccountFetchOptions</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/adbe2a7/sdk/src/router/public/index.ts#L163">router/public/index.ts:163</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>
<p>an <a href="../modules.html#WhirlpoolAccountFetchOptions">WhirlpoolAccountFetchOptions</a> object to define fetch and cache options when accessing on-chain accounts</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><li><h5><span class="tsd-flag ts-flagOptional">Optional</span> fetchOpts: <span class="tsd-signature-type">SimpleAccountFetchOptions</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p><a href="../modules.html#WhirlpoolAccountFetchOptions">WhirlpoolAccountFetchOptions</a> to configure the fetching of 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">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">
</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/adbe2a7/sdk/src/router/public/index.ts#L182">router/public/index.ts:182</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>

File diff suppressed because one or more lines are too long

View File

@ -7,7 +7,7 @@
"types": "dist/index.d.ts",
"dependencies": {
"@coral-xyz/anchor": "~0.27.0",
"@orca-so/common-sdk": "^0.3.0-beta-1",
"@orca-so/common-sdk": "^0.3.1",
"@solana/spl-token": "^0.3.8",
"@solana/web3.js": "^1.75.0",
"decimal.js": "^10.3.1",
@ -64,4 +64,4 @@
"url": "https://github.com/orca-so/whirlpools/issues"
},
"homepage": "https://www.orca.so"
}
}

View File

@ -8,7 +8,10 @@ import {
import { Commitment, Connection, PublicKey, SendOptions } from "@solana/web3.js";
import { Whirlpool } from "./artifacts/whirlpool";
import WhirlpoolIDL from "./artifacts/whirlpool.json";
import { AccountFetcher } from "./network/public";
import {
WhirlpoolAccountFetcherInterface,
buildDefaultAccountFetcher,
} from "./network/public/fetcher";
import { contextOptionsToBuilderOptions } from "./utils/txn-utils";
/**
@ -30,7 +33,7 @@ export class WhirlpoolContext {
readonly wallet: Wallet;
readonly program: Program<Whirlpool>;
readonly provider: AnchorProvider;
readonly fetcher: AccountFetcher;
readonly fetcher: WhirlpoolAccountFetcherInterface;
readonly lookupTableFetcher: LookupTableFetcher | undefined;
readonly opts: WhirlpoolContextOpts;
readonly txBuilderOpts: TransactionBuilderOptions | undefined;
@ -39,7 +42,7 @@ export class WhirlpoolContext {
connection: Connection,
wallet: Wallet,
programId: PublicKey,
fetcher = new AccountFetcher(connection),
fetcher: WhirlpoolAccountFetcherInterface = buildDefaultAccountFetcher(connection),
lookupTableFetcher?: LookupTableFetcher,
opts: WhirlpoolContextOpts = {}
): WhirlpoolContext {
@ -61,7 +64,7 @@ export class WhirlpoolContext {
public static fromWorkspace(
provider: AnchorProvider,
program: Program,
fetcher = new AccountFetcher(provider.connection),
fetcher: WhirlpoolAccountFetcherInterface = buildDefaultAccountFetcher(provider.connection),
lookupTableFetcher?: LookupTableFetcher,
opts: WhirlpoolContextOpts = {}
) {
@ -78,7 +81,7 @@ export class WhirlpoolContext {
public static withProvider(
provider: AnchorProvider,
programId: PublicKey,
fetcher = new AccountFetcher(provider.connection),
fetcher: WhirlpoolAccountFetcherInterface = buildDefaultAccountFetcher(provider.connection),
lookupTableFetcher?: LookupTableFetcher,
opts: WhirlpoolContextOpts = {}
): WhirlpoolContext {
@ -97,7 +100,7 @@ export class WhirlpoolContext {
provider: AnchorProvider,
wallet: Wallet,
program: Program,
fetcher: AccountFetcher,
fetcher: WhirlpoolAccountFetcherInterface,
lookupTableFetcher?: LookupTableFetcher,
opts: WhirlpoolContextOpts = {}
) {

View File

@ -20,6 +20,11 @@ import {
increaseLiquidityIx,
updateFeesAndRewardsIx,
} from "../instructions";
import {
IGNORE_CACHE,
PREFER_CACHE,
WhirlpoolAccountFetchOptions,
} from "../network/public/fetcher";
import { PositionData, TickArrayData, TickData, WhirlpoolData } from "../types/public";
import { getTickArrayDataForPosition } from "../utils/builder/position-builder-util";
import { PDAUtil, PoolUtil, TickArrayUtil, TickUtil } from "../utils/public";
@ -97,7 +102,7 @@ export class PositionImpl implements Position {
: this.ctx.wallet.publicKey;
const ataPayerKey = ataPayer ? AddressUtil.toPubKey(ataPayer) : this.ctx.wallet.publicKey;
const whirlpool = await this.ctx.fetcher.getPool(this.data.whirlpool, true);
const whirlpool = await this.ctx.fetcher.getPool(this.data.whirlpool, IGNORE_CACHE);
if (!whirlpool) {
throw new Error("Unable to fetch whirlpool for this position.");
}
@ -176,7 +181,7 @@ export class PositionImpl implements Position {
? AddressUtil.toPubKey(positionWallet)
: this.ctx.wallet.publicKey;
const ataPayerKey = ataPayer ? AddressUtil.toPubKey(ataPayer) : this.ctx.wallet.publicKey;
const whirlpool = await this.ctx.fetcher.getPool(this.data.whirlpool, true);
const whirlpool = await this.ctx.fetcher.getPool(this.data.whirlpool, IGNORE_CACHE);
if (!whirlpool) {
throw new Error("Unable to fetch whirlpool for this position.");
@ -243,7 +248,7 @@ export class PositionImpl implements Position {
destinationWallet?: Address,
positionWallet?: Address,
ataPayer?: Address,
refresh = false
opts: WhirlpoolAccountFetchOptions = PREFER_CACHE
): Promise<TransactionBuilder> {
const [destinationWalletKey, positionWalletKey, ataPayerKey] = AddressUtil.toPubKeys([
destinationWallet ?? this.ctx.wallet.publicKey,
@ -251,7 +256,7 @@ export class PositionImpl implements Position {
ataPayer ?? this.ctx.wallet.publicKey,
]);
const whirlpool = await this.ctx.fetcher.getPool(this.data.whirlpool, refresh);
const whirlpool = await this.ctx.fetcher.getPool(this.data.whirlpool, opts);
if (!whirlpool) {
throw new Error(
`Unable to fetch whirlpool (${this.data.whirlpool}) for this position (${this.address}).`
@ -342,7 +347,7 @@ export class PositionImpl implements Position {
destinationWallet?: Address,
positionWallet?: Address,
ataPayer?: Address,
refresh = true
opts: WhirlpoolAccountFetchOptions = IGNORE_CACHE
): Promise<TransactionBuilder> {
const [destinationWalletKey, positionWalletKey, ataPayerKey] = AddressUtil.toPubKeys([
destinationWallet ?? this.ctx.wallet.publicKey,
@ -350,7 +355,7 @@ export class PositionImpl implements Position {
ataPayer ?? this.ctx.wallet.publicKey,
]);
const whirlpool = await this.ctx.fetcher.getPool(this.data.whirlpool, refresh);
const whirlpool = await this.ctx.fetcher.getPool(this.data.whirlpool, opts);
if (!whirlpool) {
throw new Error(
`Unable to fetch whirlpool(${this.data.whirlpool}) for this position(${this.address}).`
@ -440,11 +445,11 @@ export class PositionImpl implements Position {
}
private async refresh() {
const positionAccount = await this.ctx.fetcher.getPosition(this.address, true);
const positionAccount = await this.ctx.fetcher.getPosition(this.address, IGNORE_CACHE);
if (!!positionAccount) {
this.data = positionAccount;
}
const whirlpoolAccount = await this.ctx.fetcher.getPool(this.data.whirlpool, true);
const whirlpoolAccount = await this.ctx.fetcher.getPool(this.data.whirlpool, IGNORE_CACHE);
if (!!whirlpoolAccount) {
this.whirlpoolData = whirlpoolAccount;
}
@ -453,7 +458,7 @@ export class PositionImpl implements Position {
this.ctx,
this.data,
this.whirlpoolData,
true
IGNORE_CACHE
);
if (lowerTickArray) {
this.lowerTickArrayData = lowerTickArray;

View File

@ -1,5 +1,9 @@
import BN from "bn.js";
import { AccountFetcher, PoolUtil, TokenInfo } from "..";
import { PoolUtil, TokenInfo } from "..";
import {
WhirlpoolAccountFetchOptions,
WhirlpoolAccountFetcherInterface,
} from "../network/public/fetcher";
import {
TokenAccountInfo,
WhirlpoolData,
@ -8,17 +12,17 @@ import {
} from "../types/public";
export async function getTokenMintInfos(
fetcher: AccountFetcher,
fetcher: WhirlpoolAccountFetcherInterface,
data: WhirlpoolData,
refresh: boolean
opts?: WhirlpoolAccountFetchOptions
): Promise<TokenInfo[]> {
const mintA = data.tokenMintA;
const infoA = await fetcher.getMintInfo(mintA, refresh);
const infoA = await fetcher.getMintInfo(mintA, opts);
if (!infoA) {
throw new Error(`Unable to fetch MintInfo for mint - ${mintA}`);
}
const mintB = data.tokenMintB;
const infoB = await fetcher.getMintInfo(mintB, refresh);
const infoB = await fetcher.getMintInfo(mintB, opts);
if (!infoB) {
throw new Error(`Unable to fetch MintInfo for mint - ${mintB}`);
}
@ -29,25 +33,25 @@ export async function getTokenMintInfos(
}
export async function getRewardInfos(
fetcher: AccountFetcher,
fetcher: WhirlpoolAccountFetcherInterface,
data: WhirlpoolData,
refresh: boolean
opts?: WhirlpoolAccountFetchOptions
): Promise<WhirlpoolRewardInfo[]> {
const rewardInfos: WhirlpoolRewardInfo[] = [];
for (const rewardInfo of data.rewardInfos) {
rewardInfos.push(await getRewardInfo(fetcher, rewardInfo, refresh));
rewardInfos.push(await getRewardInfo(fetcher, rewardInfo, opts));
}
return rewardInfos;
}
async function getRewardInfo(
fetcher: AccountFetcher,
fetcher: WhirlpoolAccountFetcherInterface,
data: WhirlpoolRewardInfoData,
refresh: boolean
opts?: WhirlpoolAccountFetchOptions
): Promise<WhirlpoolRewardInfo> {
const rewardInfo = { ...data, initialized: false, vaultAmount: new BN(0) };
if (PoolUtil.isRewardInitialized(data)) {
const vaultInfo = await fetcher.getTokenInfo(data.vault, refresh);
const vaultInfo = await fetcher.getTokenInfo(data.vault, opts);
if (!vaultInfo) {
throw new Error(`Unable to fetch TokenAccountInfo for vault - ${data.vault}`);
}
@ -58,17 +62,17 @@ async function getRewardInfo(
}
export async function getTokenVaultAccountInfos(
fetcher: AccountFetcher,
fetcher: WhirlpoolAccountFetcherInterface,
data: WhirlpoolData,
refresh: boolean
opts?: WhirlpoolAccountFetchOptions
): Promise<TokenAccountInfo[]> {
const vaultA = data.tokenVaultA;
const vaultInfoA = await fetcher.getTokenInfo(vaultA, refresh);
const vaultInfoA = await fetcher.getTokenInfo(vaultA, opts);
if (!vaultInfoA) {
throw new Error(`Unable to fetch TokenAccountInfo for vault - ${vaultA}`);
}
const vaultB = data.tokenVaultB;
const vaultInfoB = await fetcher.getTokenInfo(vaultB, refresh);
const vaultInfoB = await fetcher.getTokenInfo(vaultB, opts);
if (!vaultInfoB) {
throw new Error(`Unable to fetch TokenAccountInfo for vault - ${vaultB}`);
}

View File

@ -9,7 +9,12 @@ import {
collectProtocolFees,
} from "../instructions/composites";
import { WhirlpoolIx } from "../ix";
import { AccountFetcher } from "../network/public";
import {
IGNORE_CACHE,
PREFER_CACHE,
WhirlpoolAccountFetchOptions,
WhirlpoolAccountFetcherInterface,
} from "../network/public/fetcher";
import { WhirlpoolRouter, WhirlpoolRouterBuilder } from "../router/public";
import { WhirlpoolData } from "../types/public";
import { getTickArrayDataForPosition } from "../utils/builder/position-builder-util";
@ -26,7 +31,7 @@ export class WhirlpoolClientImpl implements WhirlpoolClient {
return this.ctx;
}
public getFetcher(): AccountFetcher {
public getFetcher(): WhirlpoolAccountFetcherInterface {
return this.ctx.fetcher;
}
@ -34,14 +39,14 @@ export class WhirlpoolClientImpl implements WhirlpoolClient {
return WhirlpoolRouterBuilder.buildWithPools(this.ctx, poolAddresses);
}
public async getPool(poolAddress: Address, refresh = false): Promise<Whirlpool> {
const account = await this.ctx.fetcher.getPool(poolAddress, refresh);
public async getPool(poolAddress: Address, opts = PREFER_CACHE): Promise<Whirlpool> {
const account = await this.ctx.fetcher.getPool(poolAddress, opts);
if (!account) {
throw new Error(`Unable to fetch Whirlpool at address at ${poolAddress}`);
}
const tokenInfos = await getTokenMintInfos(this.ctx.fetcher, account, refresh);
const vaultInfos = await getTokenVaultAccountInfos(this.ctx.fetcher, account, refresh);
const rewardInfos = await getRewardInfos(this.ctx.fetcher, account, refresh);
const tokenInfos = await getTokenMintInfos(this.ctx.fetcher, account, opts);
const vaultInfos = await getTokenVaultAccountInfos(this.ctx.fetcher, account, opts);
const rewardInfos = await getRewardInfos(this.ctx.fetcher, account, opts);
return new WhirlpoolImpl(
this.ctx,
AddressUtil.toPubKey(poolAddress),
@ -54,10 +59,10 @@ export class WhirlpoolClientImpl implements WhirlpoolClient {
);
}
public async getPools(poolAddresses: Address[], refresh = false): Promise<Whirlpool[]> {
const accounts = (await this.ctx.fetcher.listPools(poolAddresses, refresh)).filter(
(account): account is WhirlpoolData => !!account
);
public async getPools(poolAddresses: Address[], opts = PREFER_CACHE): Promise<Whirlpool[]> {
const accounts = Array.from(
(await this.ctx.fetcher.getPools(poolAddresses, opts)).values()
).filter((account): account is WhirlpoolData => !!account);
if (accounts.length !== poolAddresses.length) {
throw new Error(`Unable to fetch all Whirlpools at addresses ${poolAddresses}`);
}
@ -74,16 +79,16 @@ export class WhirlpoolClientImpl implements WhirlpoolClient {
}
});
});
await this.ctx.fetcher.listMintInfos(Array.from(tokenMints), refresh);
await this.ctx.fetcher.listTokenInfos(Array.from(tokenAccounts), refresh);
await this.ctx.fetcher.getMintInfos(Array.from(tokenMints), opts);
await this.ctx.fetcher.getTokenInfos(Array.from(tokenAccounts), opts);
const whirlpools: Whirlpool[] = [];
for (let i = 0; i < accounts.length; i++) {
const account = accounts[i];
const poolAddress = poolAddresses[i];
const tokenInfos = await getTokenMintInfos(this.ctx.fetcher, account, false);
const vaultInfos = await getTokenVaultAccountInfos(this.ctx.fetcher, account, false);
const rewardInfos = await getRewardInfos(this.ctx.fetcher, account, false);
const tokenInfos = await getTokenMintInfos(this.ctx.fetcher, account, PREFER_CACHE);
const vaultInfos = await getTokenVaultAccountInfos(this.ctx.fetcher, account, PREFER_CACHE);
const rewardInfos = await getRewardInfos(this.ctx.fetcher, account, PREFER_CACHE);
whirlpools.push(
new WhirlpoolImpl(
this.ctx,
@ -100,12 +105,12 @@ export class WhirlpoolClientImpl implements WhirlpoolClient {
return whirlpools;
}
public async getPosition(positionAddress: Address, refresh = false): Promise<Position> {
const account = await this.ctx.fetcher.getPosition(positionAddress, refresh);
public async getPosition(positionAddress: Address, opts = PREFER_CACHE): Promise<Position> {
const account = await this.ctx.fetcher.getPosition(positionAddress, opts);
if (!account) {
throw new Error(`Unable to fetch Position at address at ${positionAddress}`);
}
const whirlAccount = await this.ctx.fetcher.getPool(account.whirlpool, refresh);
const whirlAccount = await this.ctx.fetcher.getPool(account.whirlpool, opts);
if (!whirlAccount) {
throw new Error(`Unable to fetch Whirlpool for Position at address at ${positionAddress}`);
}
@ -114,7 +119,7 @@ export class WhirlpoolClientImpl implements WhirlpoolClient {
this.ctx,
account,
whirlAccount,
refresh
opts
);
if (!lowerTickArray || !upperTickArray) {
throw new Error(`Unable to fetch TickArrays for Position at address at ${positionAddress}`);
@ -131,19 +136,21 @@ export class WhirlpoolClientImpl implements WhirlpoolClient {
public async getPositions(
positionAddresses: Address[],
refresh = false
opts = PREFER_CACHE
): Promise<Record<string, Position | null>> {
// TODO: Prefetch and use fetcher as a cache - Think of a cleaner way to prefetch
const positions = await this.ctx.fetcher.listPositions(positionAddresses, refresh);
const positions = Array.from(
(await this.ctx.fetcher.getPositions(positionAddresses, opts)).values()
);
const whirlpoolAddrs = positions
.map((position) => position?.whirlpool.toBase58())
.flatMap((x) => (!!x ? x : []));
await this.ctx.fetcher.listPools(whirlpoolAddrs, refresh);
await this.ctx.fetcher.getPools(whirlpoolAddrs, opts);
const tickArrayAddresses: Set<string> = new Set();
await Promise.all(
positions.map(async (pos) => {
if (pos) {
const pool = await this.ctx.fetcher.getPool(pos.whirlpool, false);
const pool = await this.ctx.fetcher.getPool(pos.whirlpool, PREFER_CACHE);
if (pool) {
const lowerTickArrayPda = PDAUtil.getTickArrayFromTickIndex(
pos.tickLowerIndex,
@ -163,13 +170,13 @@ export class WhirlpoolClientImpl implements WhirlpoolClient {
}
})
);
await this.ctx.fetcher.listTickArrays(Array.from(tickArrayAddresses), true);
await this.ctx.fetcher.getTickArrays(Array.from(tickArrayAddresses), IGNORE_CACHE);
// Use getPosition and the prefetched values to generate the Positions
const results = await Promise.all(
positionAddresses.map(async (pos) => {
try {
const position = await this.getPosition(pos, false);
const position = await this.getPosition(pos, PREFER_CACHE);
return [pos, position];
} catch {
return [pos, null];
@ -186,7 +193,7 @@ export class WhirlpoolClientImpl implements WhirlpoolClient {
tickSpacing: number,
initialTick: number,
funder: Address,
refresh = false
opts = PREFER_CACHE
): Promise<{ poolKey: PublicKey; tx: TransactionBuilder }> {
invariant(TickUtil.checkTickInBounds(initialTick), "initialTick is out of bounds.");
invariant(
@ -223,7 +230,7 @@ export class WhirlpoolClientImpl implements WhirlpoolClient {
tickSpacing
);
const feeTier = await this.ctx.fetcher.getFeeTier(feeTierKey, refresh);
const feeTier = await this.ctx.fetcher.getFeeTier(feeTierKey, opts);
invariant(!!feeTier, `Fee tier for ${tickSpacing} doesn't exist`);
const txBuilder = new TransactionBuilder(
@ -270,7 +277,7 @@ export class WhirlpoolClientImpl implements WhirlpoolClient {
public async collectFeesAndRewardsForPositions(
positionAddresses: Address[],
refresh?: boolean | undefined
opts?: WhirlpoolAccountFetchOptions
): Promise<TransactionBuilder[]> {
const walletKey = this.ctx.wallet.publicKey;
return collectAllForPositionAddressesTxns(
@ -282,7 +289,7 @@ export class WhirlpoolClientImpl implements WhirlpoolClient {
positionOwner: walletKey,
payer: walletKey,
},
refresh
opts
);
}

View File

@ -23,6 +23,7 @@ import {
openPositionWithMetadataIx,
swapAsync,
} from "../instructions";
import { IGNORE_CACHE, PREFER_CACHE } from "../network/public/fetcher";
import {
collectFeesQuote,
collectRewardsQuote,
@ -124,14 +125,14 @@ export class WhirlpoolImpl implements Whirlpool {
);
}
async initTickArrayForTicks(ticks: number[], funder?: Address, refresh = true) {
async initTickArrayForTicks(ticks: number[], funder?: Address, opts = IGNORE_CACHE) {
const initTickArrayStartPdas = await TickArrayUtil.getUninitializedArraysPDAs(
ticks,
this.ctx.program.programId,
this.address,
this.data.tickSpacing,
this.ctx.fetcher,
refresh
opts
);
if (!initTickArrayStartPdas.length) {
@ -191,7 +192,7 @@ export class WhirlpoolImpl implements Whirlpool {
whirlpool: this,
wallet: sourceWalletKey,
},
true
IGNORE_CACHE
);
}
@ -234,7 +235,7 @@ export class WhirlpoolImpl implements Whirlpool {
whirlpool: this,
wallet: sourceWalletKey,
},
true
IGNORE_CACHE
);
txBuilder.addInstruction(swapTxBuilder.compressIx(true));
@ -260,7 +261,7 @@ export class WhirlpoolImpl implements Whirlpool {
invariant(liquidity.gt(new BN(0)), "liquidity must be greater than zero");
const whirlpool = await this.ctx.fetcher.getPool(this.address, false);
const whirlpool = await this.ctx.fetcher.getPool(this.address, PREFER_CACHE);
if (!whirlpool) {
throw new Error(`Whirlpool not found: ${translateAddress(this.address).toBase58()}`);
}
@ -366,7 +367,7 @@ export class WhirlpoolImpl implements Whirlpool {
positionWallet: PublicKey,
payerKey: PublicKey
): Promise<TransactionBuilder[]> {
const positionData = await this.ctx.fetcher.getPosition(positionAddress, true);
const positionData = await this.ctx.fetcher.getPosition(positionAddress, IGNORE_CACHE);
if (!positionData) {
throw new Error(`Position not found: ${positionAddress.toBase58()}`);
}
@ -415,7 +416,7 @@ export class WhirlpoolImpl implements Whirlpool {
this.ctx,
positionData,
whirlpool,
true
IGNORE_CACHE
);
invariant(
@ -537,7 +538,7 @@ export class WhirlpoolImpl implements Whirlpool {
destinationWallet,
positionWallet,
payerKey,
true
IGNORE_CACHE
);
txBuilder.addInstruction(collectFeexTx.compressIx(false));
@ -579,13 +580,13 @@ export class WhirlpoolImpl implements Whirlpool {
}
private async refresh() {
const account = await this.ctx.fetcher.getPool(this.address, true);
const account = await this.ctx.fetcher.getPool(this.address, IGNORE_CACHE);
if (!!account) {
const rewardInfos = await getRewardInfos(this.ctx.fetcher, account, true);
const rewardInfos = await getRewardInfos(this.ctx.fetcher, account, IGNORE_CACHE);
const [tokenVaultAInfo, tokenVaultBInfo] = await getTokenVaultAccountInfos(
this.ctx.fetcher,
account,
true
IGNORE_CACHE
);
this.data = account;
this.tokenVaultAInfo = tokenVaultAInfo;

View File

@ -11,6 +11,7 @@ import { NATIVE_MINT, getAssociatedTokenAddressSync } from "@solana/spl-token";
import { PublicKey } from "@solana/web3.js";
import { PositionData, WhirlpoolContext } from "../..";
import { WhirlpoolIx } from "../../ix";
import { PREFER_CACHE, WhirlpoolAccountFetchOptions } from "../../network/public/fetcher";
import { WhirlpoolData } from "../../types/public";
import { PDAUtil, PoolUtil, TickUtil } from "../../utils/public";
import { checkMergedTransactionSizeIsValid, convertListToMap } from "../../utils/txn-utils";
@ -68,21 +69,19 @@ export type CollectAllParams = {
* @experimental
* @param ctx - WhirlpoolContext object for the current environment.
* @param params - CollectAllPositionAddressParams object
* @param refresh - if true, will always fetch for the latest on-chain data.
* @param opts an {@link WhirlpoolAccountFetchOptions} object to define fetch and cache options when accessing on-chain accounts
* @returns A set of transaction-builders to resolve ATA for affliated tokens, collect fee & rewards for all positions.
*/
export async function collectAllForPositionAddressesTxns(
ctx: WhirlpoolContext,
params: CollectAllPositionAddressParams,
refresh = false
opts: WhirlpoolAccountFetchOptions = PREFER_CACHE
): Promise<TransactionBuilder[]> {
const { positions, ...rest } = params;
const posData = convertListToMap(
await ctx.fetcher.listPositions(positions, refresh),
positions.map((pos) => pos.toString())
);
const fetchedPositions = await ctx.fetcher.getPositions(positions, opts);
const positionMap: Record<string, PositionData> = {};
Object.entries(posData).forEach(([addr, pos]) => {
fetchedPositions.forEach((pos, addr) => {
if (pos) {
positionMap[addr] = pos;
}
@ -115,10 +114,9 @@ export async function collectAllForPositionsTxns(
}
const whirlpoolAddrs = positionList.map(([, pos]) => pos.whirlpool.toBase58());
const whirlpoolDatas = await ctx.fetcher.listPools(whirlpoolAddrs, false);
const whirlpools = convertListToMap(whirlpoolDatas, whirlpoolAddrs);
const whirlpools = await ctx.fetcher.getPools(whirlpoolAddrs, PREFER_CACHE);
const allMints = getTokenMintsFromWhirlpools(whirlpoolDatas);
const allMints = getTokenMintsFromWhirlpools(Array.from(whirlpools.values()));
const accountExemption = await ctx.fetcher.getAccountRentExempt();
// resolvedAtas[mint] => Instruction & { address }
@ -205,7 +203,7 @@ const constructCollectIxForPosition = (
ctx: WhirlpoolContext,
positionKey: PublicKey,
position: PositionData,
whirlpools: Record<string, WhirlpoolData | null>,
whirlpools: ReadonlyMap<string, WhirlpoolData | null>,
positionOwner: PublicKey,
positionAuthority: PublicKey,
resolvedAtas: Record<string, ResolvedTokenAddressInstruction>,
@ -221,7 +219,7 @@ const constructCollectIxForPosition = (
rewardInfos: positionRewardInfos,
} = position;
const whirlpool = whirlpools[whirlpoolKey.toBase58()];
const whirlpool = whirlpools.get(whirlpoolKey.toBase58());
if (!whirlpool) {
throw new Error(
`Unable to process positionMint ${positionMint} - unable to derive whirlpool ${whirlpoolKey.toBase58()}`

View File

@ -3,6 +3,7 @@ import { AddressUtil, Instruction, TokenUtil, TransactionBuilder } from "@orca-s
import { NATIVE_MINT } from "@solana/spl-token";
import { PACKET_DATA_SIZE } from "@solana/web3.js";
import { WhirlpoolContext } from "../..";
import { PREFER_CACHE } from "../../network/public/fetcher";
import {
TokenMintTypes,
addNativeMintHandlingIx,
@ -18,7 +19,9 @@ export async function collectProtocolFees(
const receiverKey = ctx.wallet.publicKey;
const payerKey = ctx.wallet.publicKey;
const whirlpoolDatas = await ctx.fetcher.listPools(poolAddresses, false);
const whirlpoolDatas = Array.from(
(await ctx.fetcher.getPools(poolAddresses, PREFER_CACHE)).values()
);
const accountExemption = await ctx.fetcher.getAccountRentExempt();
const { ataTokenAddresses, resolveAtaIxs } = await resolveAtaForMints(ctx, {

View File

@ -1,6 +1,7 @@
import { resolveOrCreateATAs, TransactionBuilder, ZERO } from "@orca-so/common-sdk";
import { PublicKey } from "@solana/web3.js";
import { SwapUtils, TickArrayUtil, Whirlpool, WhirlpoolContext } from "../..";
import { WhirlpoolAccountFetchOptions } from "../../network/public/fetcher";
import { SwapInput, swapIx } from "../swap-ix";
export type SwapAsyncParams = {
@ -13,13 +14,13 @@ export type SwapAsyncParams = {
* Swap instruction builder method with resolveATA & additional checks.
* @param ctx - WhirlpoolContext object for the current environment.
* @param params - {@link SwapAsyncParams}
* @param refresh - If true, the network calls will always fetch for the latest values.
* @param opts - {@link WhirlpoolAccountFetchOptions} to use for account fetching.
* @returns
*/
export async function swapAsync(
ctx: WhirlpoolContext,
params: SwapAsyncParams,
refresh: boolean
opts: WhirlpoolAccountFetchOptions
): Promise<TransactionBuilder> {
const { wallet, whirlpool, swapInput } = params;
const { aToB, amount } = swapInput;
@ -29,7 +30,7 @@ export async function swapAsync(
let uninitializedArrays = await TickArrayUtil.getUninitializedArraysString(
tickArrayAddresses,
ctx.fetcher,
refresh
opts
);
if (uninitializedArrays) {
throw new Error(`TickArray addresses - [${uninitializedArrays}] need to be initialized.`);

View File

@ -11,7 +11,7 @@ import {
Account,
NATIVE_MINT,
createAssociatedTokenAccountInstruction,
getAssociatedTokenAddressSync
getAssociatedTokenAddressSync,
} from "@solana/spl-token";
import { PublicKey } from "@solana/web3.js";
import BN from "bn.js";
@ -25,6 +25,7 @@ import {
WhirlpoolContext,
twoHopSwapQuoteFromSwapQuotes,
} from "../..";
import { PREFER_CACHE, WhirlpoolAccountFetchOptions } from "../../network/public/fetcher";
import { adjustForSlippage } from "../../utils/position-util";
import { contextOptionsToBuilderOptions } from "../../utils/txn-utils";
import { swapIx } from "../swap-ix";
@ -40,7 +41,7 @@ export type SwapFromRouteParams = {
export async function getSwapFromRoute(
ctx: WhirlpoolContext,
params: SwapFromRouteParams,
refresh: boolean = false,
opts: WhirlpoolAccountFetchOptions = PREFER_CACHE,
txBuilder: TransactionBuilder = new TransactionBuilder(
ctx.connection,
ctx.wallet,
@ -107,7 +108,7 @@ export async function getSwapFromRoute(
let uninitializedArrays = await TickArrayUtil.getUninitializedArraysString(
requiredTickArrays,
ctx.fetcher,
refresh
opts
);
if (uninitializedArrays) {
throw new Error(`TickArray addresses - [${uninitializedArrays}] need to be initialized.`);
@ -129,7 +130,7 @@ export async function getSwapFromRoute(
) as Account[]
);
} else {
return ctx.fetcher.listTokenInfos(keys, false);
return ctx.fetcher.getTokenInfos(keys, opts).then((result) => Array.from(result.values()));
}
}
);
@ -339,7 +340,7 @@ async function cachedResolveOrCreateNonNativeATAs(
payer,
ataAddress,
ownerAddress,
tokenMintArray[index],
tokenMintArray[index]
);
resolvedInstruction = {

View File

@ -1,6 +1,5 @@
import { Program } from "@coral-xyz/anchor";
import { PDA } from "@orca-so/common-sdk";
import { WhirlpoolContext } from ".";
import { Whirlpool } from "./artifacts/whirlpool";
import * as ix from "./instructions";
@ -520,22 +519,4 @@ export class WhirlpoolIx {
) {
return ix.closeBundledPositionIx(program, params);
}
/**
* DEPRECATED - use ${@link WhirlpoolClient} collectFeesAndRewardsForPositions function
* A set of transactions to collect all fees and rewards from a list of positions.
*
* @deprecated
* @param ctx - WhirlpoolContext object for the current environment.
* @param params - CollectAllPositionAddressParams object.
* @param refresh - if true, will always fetch for the latest values on chain to compute.
* @returns
*/
public static async collectAllForPositionsTxns(
ctx: WhirlpoolContext,
params: ix.CollectAllPositionAddressParams,
refresh: boolean
) {
return ix.collectAllForPositionAddressesTxns(ctx, params, refresh);
}
}

View File

@ -1,391 +0,0 @@
import { Address } from "@coral-xyz/anchor";
import {
AddressUtil,
ParsableEntity,
ParsableMintInfo,
ParsableTokenAccountInfo,
getMultipleAccountsInMap,
} from "@orca-so/common-sdk";
import { Account, AccountLayout, Mint } from "@solana/spl-token";
import { Connection, PublicKey } from "@solana/web3.js";
import invariant from "tiny-invariant";
import {
AccountName,
PositionBundleData,
PositionData,
TickArrayData,
WHIRLPOOL_CODER,
WhirlpoolData,
WhirlpoolsConfigData,
} from "../..";
import { FeeTierData, getAccountSize } from "../../types/public";
import {
ParsableFeeTier,
ParsablePosition,
ParsablePositionBundle,
ParsableTickArray,
ParsableWhirlpool,
ParsableWhirlpoolsConfig,
} from "./parsing";
/**
* Supported accounts
*/
type CachedValue =
| WhirlpoolsConfigData
| WhirlpoolData
| PositionData
| TickArrayData
| FeeTierData
| PositionBundleData
| Account
| Mint;
/**
* Include both the entity (i.e. type) of the stored value, and the value itself
*/
interface CachedContent<T extends CachedValue> {
entity: ParsableEntity<T>;
value: CachedValue | null;
}
/**
* Filter params for Whirlpools when invoking getProgramAccounts.
* @category Fetcher
*/
export type ListWhirlpoolParams = {
programId: Address;
configId: Address;
};
/**
* Tuple containing Whirlpool address and parsed account data.
* @category Fetcher
*/
export type WhirlpoolAccount = [Address, WhirlpoolData];
/**
* Data access layer to access Whirlpool related accounts
* Includes internal cache that can be refreshed by the client.
*
* @category Fetcher
*/
export class AccountFetcher {
private readonly connection: Connection;
private readonly _cache: Record<string, CachedContent<CachedValue>> = {};
private _accountRentExempt: number | undefined;
constructor(connection: Connection, cache?: Record<string, CachedContent<CachedValue>>) {
this.connection = connection;
this._cache = cache ?? {};
}
/*** Public Methods ***/
/**
* Retrieve minimum balance for rent exemption of a Token Account;
*
* @param refresh force refresh of account rent exemption
* @returns minimum balance for rent exemption
*/
public async getAccountRentExempt(refresh: boolean = false) {
// This value should be relatively static or at least not break according to spec
// https://docs.solana.com/developing/programming-model/accounts#rent-exemption
if (!this._accountRentExempt || refresh) {
this._accountRentExempt = await this.connection.getMinimumBalanceForRentExemption(
AccountLayout.span
);
}
return this._accountRentExempt;
}
/**
* Retrieve a cached whirlpool account. Fetch from rpc on cache miss.
*
* @param address whirlpool address
* @param refresh force cache refresh
* @returns whirlpool account
*/
public async getPool(address: Address, refresh = false): Promise<WhirlpoolData | null> {
return this.get(AddressUtil.toPubKey(address), ParsableWhirlpool, refresh);
}
/**
* Retrieve a cached position account. Fetch from rpc on cache miss.
*
* @param address position address
* @param refresh force cache refresh
* @returns position account
*/
public async getPosition(address: Address, refresh = false): Promise<PositionData | null> {
return this.get(AddressUtil.toPubKey(address), ParsablePosition, refresh);
}
/**
* Retrieve a cached tick array account. Fetch from rpc on cache miss.
*
* @param address tick array address
* @param refresh force cache refresh
* @returns tick array account
*/
public async getTickArray(address: Address, refresh = false): Promise<TickArrayData | null> {
return this.get(AddressUtil.toPubKey(address), ParsableTickArray, refresh);
}
/**
* Retrieve a cached fee tier account. Fetch from rpc on cache miss.
*
* @param address fee tier address
* @param refresh force cache refresh
* @returns fee tier account
*/
public async getFeeTier(address: Address, refresh = false): Promise<FeeTierData | null> {
return this.get(AddressUtil.toPubKey(address), ParsableFeeTier, refresh);
}
/**
* Retrieve a cached token info account. Fetch from rpc on cache miss.
*
* @param address token info address
* @param refresh force cache refresh
* @returns token info account
*/
public async getTokenInfo(address: Address, refresh = false): Promise<Account | null> {
return this.get(AddressUtil.toPubKey(address), ParsableTokenAccountInfo, refresh);
}
/**
* Retrieve a cached mint info account. Fetch from rpc on cache miss.
*
* @param address mint info address
* @param refresh force cache refresh
* @returns mint info account
*/
public async getMintInfo(address: Address, refresh = false): Promise<Mint | null> {
return this.get(AddressUtil.toPubKey(address), ParsableMintInfo, refresh);
}
/**
* Retrieve a cached whirlpool config account. Fetch from rpc on cache miss.
*
* @param address whirlpool config address
* @param refresh force cache refresh
* @returns whirlpool config account
*/
public async getConfig(address: Address, refresh = false): Promise<WhirlpoolsConfigData | null> {
return this.get(AddressUtil.toPubKey(address), ParsableWhirlpoolsConfig, refresh);
}
/**
* Retrieve a cached position bundle account. Fetch from rpc on cache miss.
*
* @param address position bundle address
* @param refresh force cache refresh
* @returns position bundle account
*/
public async getPositionBundle(
address: Address,
refresh = false
): Promise<PositionBundleData | null> {
return this.get(AddressUtil.toPubKey(address), ParsablePositionBundle, refresh);
}
/**
* Retrieve a list of cached whirlpool accounts. Fetch from rpc for cache misses.
*
* @param addresses whirlpool addresses
* @param refresh force cache refresh
* @returns whirlpool accounts
*/
public async listPools(
addresses: Address[],
refresh: boolean
): Promise<(WhirlpoolData | null)[]> {
return this.list(AddressUtil.toPubKeys(addresses), ParsableWhirlpool, refresh);
}
/**
* Retrieve a list of cached whirlpool addresses and accounts filtered by the given params using
* getProgramAccounts.
*
* @param params whirlpool filter params
* @returns tuple of whirlpool addresses and accounts
*/
public async listPoolsWithParams({
programId,
configId,
}: ListWhirlpoolParams): Promise<WhirlpoolAccount[]> {
const filters = [
{ dataSize: getAccountSize(AccountName.Whirlpool) },
{
memcmp: WHIRLPOOL_CODER.memcmp(
AccountName.Whirlpool,
AddressUtil.toPubKey(configId).toBuffer()
),
},
];
const accounts = await this.connection.getProgramAccounts(AddressUtil.toPubKey(programId), {
filters,
});
const parsedAccounts: WhirlpoolAccount[] = [];
accounts.forEach(({ pubkey, account }) => {
const parsedAccount = ParsableWhirlpool.parse(pubkey, account);
invariant(!!parsedAccount, `could not parse whirlpool: ${pubkey.toBase58()}`);
parsedAccounts.push([pubkey, parsedAccount]);
this._cache[pubkey.toBase58()] = { entity: ParsableWhirlpool, value: parsedAccount };
});
return parsedAccounts;
}
/**
* Retrieve a list of cached position accounts. Fetch from rpc for cache misses.
*
* @param addresses position addresses
* @param refresh force cache refresh
* @returns position accounts
*/
public async listPositions(
addresses: Address[],
refresh: boolean
): Promise<(PositionData | null)[]> {
return this.list(AddressUtil.toPubKeys(addresses), ParsablePosition, refresh);
}
/**
* Retrieve a list of cached tick array accounts. Fetch from rpc for cache misses.
*
* @param addresses tick array addresses
* @param refresh force cache refresh
* @returns tick array accounts
*/
public async listTickArrays(
addresses: Address[],
refresh: boolean
): Promise<(TickArrayData | null)[]> {
return this.list(AddressUtil.toPubKeys(addresses), ParsableTickArray, refresh);
}
/**
* Retrieve a list of cached token info accounts. Fetch from rpc for cache misses.
*
* @param addresses token info addresses
* @param refresh force cache refresh
* @returns token info accounts
*/
public async listTokenInfos(addresses: Address[], refresh: boolean): Promise<(Account | null)[]> {
return this.list(AddressUtil.toPubKeys(addresses), ParsableTokenAccountInfo, refresh);
}
/**
* Retrieve a list of cached mint info accounts. Fetch from rpc for cache misses.
*
* @param addresses mint info addresses
* @param refresh force cache refresh
* @returns mint info accounts
*/
public async listMintInfos(addresses: Address[], refresh: boolean): Promise<(Mint | null)[]> {
return this.list(AddressUtil.toPubKeys(addresses), ParsableMintInfo, refresh);
}
/**
* Retrieve a list of cached position bundle accounts. Fetch from rpc for cache misses.
*
* @param addresses position bundle addresses
* @param refresh force cache refresh
* @returns position bundle accounts
*/
public async listPositionBundles(
addresses: Address[],
refresh: boolean
): Promise<(PositionBundleData | null)[]> {
return this.list(AddressUtil.toPubKeys(addresses), ParsablePositionBundle, refresh);
}
/**
* Update the cached value of all entities currently in the cache.
* Uses batched rpc request for network efficient fetch.
*/
public async refreshAll(): Promise<void> {
const addresses: string[] = Object.keys(this._cache);
const fetchedAccountsMap = await getMultipleAccountsInMap(this.connection, addresses);
for (const [key, cachedContent] of Object.entries(this._cache)) {
const entity = cachedContent.entity;
const fetchedEntry = fetchedAccountsMap.get(key);
const value = entity.parse(AddressUtil.toPubKey(key), fetchedEntry);
this._cache[key] = { entity, value };
}
}
/*** Private Methods ***/
/**
* Retrieve from cache or fetch from rpc, an account
*/
private async get<T extends CachedValue>(
address: PublicKey,
entity: ParsableEntity<T>,
refresh: boolean
): Promise<T | null> {
const key = address.toBase58();
const cachedValue: CachedValue | null | undefined = this._cache[key]?.value;
if (cachedValue !== undefined && !refresh) {
return cachedValue as T | null;
}
const accountInfo = await this.connection.getAccountInfo(address);
const value = entity.parse(address, accountInfo);
this._cache[key] = { entity, value };
return value;
}
/**
* Retrieve from cache or fetch from rpc, a list of accounts
*/
private async list<T extends CachedValue>(
addresses: PublicKey[],
entity: ParsableEntity<T>,
refresh: boolean
): Promise<(T | null)[]> {
const keys = addresses.map((address) => address.toBase58());
const cachedValues: [string, CachedValue | null | undefined][] = keys.map((key) => [
key,
refresh ? undefined : this._cache[key]?.value,
]);
/* Look for accounts not found in cache */
const undefinedAccounts: { cacheIndex: number; key: string }[] = [];
cachedValues.forEach(([key, value], cacheIndex) => {
if (value === undefined) {
undefinedAccounts.push({ cacheIndex, key });
}
});
/* Fetch accounts not found in cache */
if (undefinedAccounts.length > 0) {
const fetchedAccountsMap = await getMultipleAccountsInMap(
this.connection,
undefinedAccounts.map((account) => account.key)
);
undefinedAccounts.forEach(({ cacheIndex, key }) => {
const fetchedEntry = fetchedAccountsMap.get(key);
const value = entity.parse(AddressUtil.toPubKey(key), fetchedEntry);
invariant(cachedValues[cacheIndex]?.[1] === undefined, "unexpected non-undefined value");
cachedValues[cacheIndex] = [key, value];
this._cache[key] = { entity, value };
});
}
const result = cachedValues
.map(([_, value]) => value)
.filter((value): value is T | null => value !== undefined);
invariant(result.length === addresses.length, "not enough results fetched");
return result;
}
}

View File

@ -0,0 +1,154 @@
import { Address } from "@coral-xyz/anchor";
import {
AccountFetcher,
ParsableMintInfo,
ParsableTokenAccountInfo,
SimpleAccountFetcher,
} from "@orca-so/common-sdk";
import { AccountLayout, Mint, Account as TokenAccount } from "@solana/spl-token";
import { Connection } from "@solana/web3.js";
import {
DEFAULT_WHIRLPOOL_RETENTION_POLICY,
WhirlpoolAccountFetchOptions,
WhirlpoolAccountFetcherInterface,
WhirlpoolSupportedTypes,
} from "..";
import {
FeeTierData,
PositionBundleData,
PositionData,
TickArrayData,
WhirlpoolData,
WhirlpoolsConfigData,
} from "../../../types/public";
import {
ParsableFeeTier,
ParsablePosition,
ParsablePositionBundle,
ParsableTickArray,
ParsableWhirlpool,
ParsableWhirlpoolsConfig,
} from "../parsing";
/**
* Build a default instance of {@link WhirlpoolAccountFetcherInterface} with the default {@link AccountFetcher} implementation
* @param connection An instance of {@link Connection} to use for fetching accounts
* @returns An instance of {@link WhirlpoolAccountFetcherInterface}
* @category Network
*/
export const buildDefaultAccountFetcher = (connection: Connection) => {
return new WhirlpoolAccountFetcher(
connection,
new SimpleAccountFetcher(connection, DEFAULT_WHIRLPOOL_RETENTION_POLICY)
);
};
/**
* Fetcher and cache layer for fetching {@link WhirlpoolSupportedTypes} from the network
* Default implementation for {@link WhirlpoolAccountFetcherInterface}
* @category Network
*/
export class WhirlpoolAccountFetcher implements WhirlpoolAccountFetcherInterface {
private _accountRentExempt: number | undefined;
constructor(
readonly connection: Connection,
readonly fetcher: AccountFetcher<WhirlpoolSupportedTypes, WhirlpoolAccountFetchOptions>
) {}
async getAccountRentExempt(refresh: boolean = false): Promise<number> {
// This value should be relatively static or at least not break according to spec
// https://docs.solana.com/developing/programming-model/accounts#rent-exemption
if (!this._accountRentExempt || refresh) {
this._accountRentExempt = await this.connection.getMinimumBalanceForRentExemption(
AccountLayout.span
);
}
return this._accountRentExempt;
}
getPool(address: Address, opts?: WhirlpoolAccountFetchOptions): Promise<WhirlpoolData | null> {
return this.fetcher.getAccount(address, ParsableWhirlpool, opts);
}
getPools(
addresses: Address[],
opts?: WhirlpoolAccountFetchOptions
): Promise<ReadonlyMap<string, WhirlpoolData | null>> {
return this.fetcher.getAccounts(addresses, ParsableWhirlpool, opts);
}
getPosition(address: Address, opts?: WhirlpoolAccountFetchOptions): Promise<PositionData | null> {
return this.fetcher.getAccount(address, ParsablePosition, opts);
}
getPositions(
addresses: Address[],
opts?: WhirlpoolAccountFetchOptions
): Promise<ReadonlyMap<string, PositionData | null>> {
return this.fetcher.getAccounts(addresses, ParsablePosition, opts);
}
getTickArray(
address: Address,
opts?: WhirlpoolAccountFetchOptions
): Promise<TickArrayData | null> {
return this.fetcher.getAccount(address, ParsableTickArray, opts);
}
getTickArrays(
addresses: Address[],
opts?: WhirlpoolAccountFetchOptions
): Promise<ReadonlyArray<TickArrayData | null>> {
return this.fetcher.getAccountsAsArray(addresses, ParsableTickArray, opts);
}
getFeeTier(address: Address, opts?: WhirlpoolAccountFetchOptions): Promise<FeeTierData | null> {
return this.fetcher.getAccount(address, ParsableFeeTier, opts);
}
getFeeTiers(
addresses: Address[],
opts?: WhirlpoolAccountFetchOptions
): Promise<ReadonlyMap<string, FeeTierData | null>> {
return this.fetcher.getAccounts(addresses, ParsableFeeTier, opts);
}
getTokenInfo(
address: Address,
opts?: WhirlpoolAccountFetchOptions
): Promise<TokenAccount | null> {
return this.fetcher.getAccount(address, ParsableTokenAccountInfo, opts);
}
getTokenInfos(
addresses: Address[],
opts?: WhirlpoolAccountFetchOptions
): Promise<ReadonlyMap<string, TokenAccount | null>> {
return this.fetcher.getAccounts(addresses, ParsableTokenAccountInfo, opts);
}
getMintInfo(address: Address, opts?: WhirlpoolAccountFetchOptions): Promise<Mint | null> {
return this.fetcher.getAccount(address, ParsableMintInfo, opts);
}
getMintInfos(
addresses: Address[],
opts?: WhirlpoolAccountFetchOptions
): Promise<ReadonlyMap<string, Mint | null>> {
return this.fetcher.getAccounts(addresses, ParsableMintInfo, opts);
}
getConfig(
address: Address,
opts?: WhirlpoolAccountFetchOptions
): Promise<WhirlpoolsConfigData | null> {
return this.fetcher.getAccount(address, ParsableWhirlpoolsConfig, opts);
}
getConfigs(
addresses: Address[],
opts?: WhirlpoolAccountFetchOptions
): Promise<ReadonlyMap<string, WhirlpoolsConfigData | null>> {
return this.fetcher.getAccounts(addresses, ParsableWhirlpoolsConfig, opts);
}
getPositionBundle(
address: Address,
opts?: WhirlpoolAccountFetchOptions
): Promise<PositionBundleData | null> {
return this.fetcher.getAccount(address, ParsablePositionBundle, opts);
}
getPositionBundles(
addresses: Address[],
opts?: WhirlpoolAccountFetchOptions
): Promise<ReadonlyMap<string, PositionBundleData | null>> {
return this.fetcher.getAccounts(addresses, ParsablePositionBundle, opts);
}
}

View File

@ -0,0 +1,214 @@
import {
Address,
BasicSupportedTypes,
ParsableEntity,
SimpleAccountFetchOptions,
} from "@orca-so/common-sdk";
import { Mint, Account as TokenAccount } from "@solana/spl-token";
import {
FeeTierData,
PositionBundleData,
PositionData,
TickArrayData,
WhirlpoolData,
WhirlpoolsConfigData,
} from "../../../types/public";
export * from "./fetcher-impl";
/**
* Union type of all the {@link ParsableEntity} types that can be cached in the {@link WhirlpoolAccountFetcherInterface}
* @category Network
*/
export type WhirlpoolSupportedTypes =
| WhirlpoolsConfigData
| WhirlpoolData
| PositionData
| TickArrayData
| FeeTierData
| PositionBundleData
| BasicSupportedTypes;
/**
* The default retention periods for each {@link ParsableEntity} type in the {@link WhirlpoolAccountFetcherInterface}
* @category Network
*/
export const DEFAULT_WHIRLPOOL_RETENTION_POLICY: ReadonlyMap<
ParsableEntity<WhirlpoolSupportedTypes>,
number
> = new Map<ParsableEntity<WhirlpoolSupportedTypes>, number>([]);
/**
* Type to define fetch options for the {@link WhirlpoolAccountFetcherInterface}
* @category Network
*/
export type WhirlpoolAccountFetchOptions = SimpleAccountFetchOptions;
/**
* Default fetch option for always fetching when making an account request to the {@link WhirlpoolAccountFetcherInterface}
* @category Network
*/
export const IGNORE_CACHE: WhirlpoolAccountFetchOptions = { maxAge: 0 };
/**
* Default fetch option for always using the cached value for an account request to the {@link WhirlpoolAccountFetcherInterface}
* @category Network
*/
export const PREFER_CACHE: WhirlpoolAccountFetchOptions = { maxAge: Number.POSITIVE_INFINITY };
/**
* Fetcher interface for fetching {@link WhirlpoolSupportedTypes} from the network
* @category Network
*/
export interface WhirlpoolAccountFetcherInterface {
/**
* Fetch and cache the rent exempt value
* @param refresh If true, will always fetch from the network
*/
getAccountRentExempt(refresh?: boolean): Promise<number>;
/**
* Fetch and cache the account for a given Whirlpool addresses
* @param address The mint address
* @param opts {@link WhirlpoolAccountFetchOptions} instance to dictate fetch behavior
*/
getPool(address: Address, opts?: WhirlpoolAccountFetchOptions): Promise<WhirlpoolData | null>;
/**
* Fetch and cache the accounts for a given array of Whirlpool addresses
* @param addresses The array of mint addresses
* @param opts {@link WhirlpoolAccountFetchOptions} instance to dictate fetch behavior
*/
getPools(
addresses: Address[],
opts?: WhirlpoolAccountFetchOptions
): Promise<ReadonlyMap<string, WhirlpoolData | null>>;
/**
* Fetch and cache the account for a given Position address
* @param address The address of the position account
* @param opts {@link WhirlpoolAccountFetchOptions} instance to dictate fetch behavior
*/
getPosition(address: Address, opts?: WhirlpoolAccountFetchOptions): Promise<PositionData | null>;
/**
* Fetch and cache the accounts for a given array of Position addresses
* @param addresses The array of position account addresses
* @param opts {@link WhirlpoolAccountFetchOptions} instance to dictate fetch behavior
*/
getPositions(
addresses: Address[],
opts?: WhirlpoolAccountFetchOptions
): Promise<ReadonlyMap<string, PositionData | null>>;
/**
* Fetch and cache the account for a given TickArray address.
* @param address The address of the tick array account
* @param opts {@link WhirlpoolAccountFetchOptions} instance to dictate fetch behavior
*/
getTickArray(
address: Address,
opts?: WhirlpoolAccountFetchOptions
): Promise<TickArrayData | null>;
/**
* Fetch and cache the accounts for a given array of TickArray addresses
* @param addresses The array of tick array account addresses
* @param opts {@link WhirlpoolAccountFetchOptions} instance to dictate fetch behavior
*/
getTickArrays(
addresses: Address[],
opts?: WhirlpoolAccountFetchOptions
): Promise<ReadonlyArray<TickArrayData | null>>;
/**
* Fetch and cache the account for a given FeeTier address
* @param address The address of the fee tier account
* @param opts {@link WhirlpoolAccountFetchOptions} instance to dictate fetch behavior
*/
getFeeTier(address: Address, opts?: WhirlpoolAccountFetchOptions): Promise<FeeTierData | null>;
/**
* Fetch and cache the accounts for a given array of FeeTier addresses
* @param addresses The array of fee tier account addresses
* @param opts {@link WhirlpoolAccountFetchOptions} instance to dictate fetch behavior
*/
getFeeTiers(
addresses: Address[],
opts?: WhirlpoolAccountFetchOptions
): Promise<ReadonlyMap<string, FeeTierData | null>>;
/**
* Fetch and cache the account for a given TokenAccount address
* @param address The address of the token account
* @param opts {@link WhirlpoolAccountFetchOptions} instance to dictate fetch behavior
*/
getTokenInfo(address: Address, opts?: WhirlpoolAccountFetchOptions): Promise<TokenAccount | null>;
/**
* Fetch and cache the accounts for a given array of TokenAccount addresses
* @param addresses The array of token account addresses
* @param opts {@link WhirlpoolAccountFetchOptions} instance to dictate fetch behavior
*/
getTokenInfos(
addresses: Address[],
opts?: WhirlpoolAccountFetchOptions
): Promise<ReadonlyMap<string, TokenAccount | null>>;
/**
* Fetch and cache the account for a given Mint address
* @param address The address of the mint account
* @param opts {@link WhirlpoolAccountFetchOptions} instance to dictate fetch behavior
*/
getMintInfo(address: Address, opts?: WhirlpoolAccountFetchOptions): Promise<Mint | null>;
/**
* Fetch and cache the accounts for a given array of Mint addresses
* @param addresses The array of mint account addresses
* @param opts {@link WhirlpoolAccountFetchOptions} instance to dictate fetch behavior
*/
getMintInfos(
addresses: Address[],
opts?: WhirlpoolAccountFetchOptions
): Promise<ReadonlyMap<string, Mint | null>>;
/**
* Fetch and cache the account for a given WhirlpoolConfig address
* @param address The address of the WhirlpoolConfig account
* @param opts {@link WhirlpoolAccountFetchOptions} instance to dictate fetch behavior
*/
getConfig(
address: Address,
opts?: WhirlpoolAccountFetchOptions
): Promise<WhirlpoolsConfigData | null>;
/**
* Fetch and cache the accounts for a given array of WhirlpoolConfig addresses
* @param addresses The array of WhirlpoolConfig account addresses
* @param opts {@link WhirlpoolAccountFetchOptions} instance to dictate fetch behavior
*/
getConfigs(
addresses: Address[],
opts?: WhirlpoolAccountFetchOptions
): Promise<ReadonlyMap<string, WhirlpoolsConfigData | null>>;
/**
* Fetch and cache the account for a given PositionBundle address
* @param address The address of the position bundle account
* @param opts {@link WhirlpoolAccountFetchOptions} instance to dictate fetch behavior
*/
getPositionBundle(
address: Address,
opts?: WhirlpoolAccountFetchOptions
): Promise<PositionBundleData | null>;
/**
* Fetch and cache the accounts for a given array of PositionBundle addresses
* @param addresses The array of position bundle account addresses
* @param opts {@link WhirlpoolAccountFetchOptions} instance to dictate fetch behavior
*/
getPositionBundles(
addresses: Address[],
opts?: WhirlpoolAccountFetchOptions
): Promise<ReadonlyMap<string, PositionBundleData | null>>;
}

View File

@ -1,2 +1,3 @@
export * from "./fetcher";
export * from "./fetcher/";
export * from "./fetcher/fetcher-impl";
export * from "./parsing";

View File

@ -13,11 +13,11 @@ import {
} from "../../types/public";
/**
* @category Parsables
* @category Network
*/
@staticImplements<ParsableEntity<WhirlpoolsConfigData>>()
export class ParsableWhirlpoolsConfig {
private constructor() { }
private constructor() {}
public static parse(
address: PublicKey,
@ -37,11 +37,11 @@ export class ParsableWhirlpoolsConfig {
}
/**
* @category Parsables
* @category Network
*/
@staticImplements<ParsableEntity<WhirlpoolData>>()
export class ParsableWhirlpool {
private constructor() { }
private constructor() {}
public static parse(
address: PublicKey,
@ -61,11 +61,11 @@ export class ParsableWhirlpool {
}
/**
* @category Parsables
* @category Network
*/
@staticImplements<ParsableEntity<PositionData>>()
export class ParsablePosition {
private constructor() { }
private constructor() {}
public static parse(
address: PublicKey,
@ -85,11 +85,11 @@ export class ParsablePosition {
}
/**
* @category Parsables
* @category Network
*/
@staticImplements<ParsableEntity<TickArrayData>>()
export class ParsableTickArray {
private constructor() { }
private constructor() {}
public static parse(
address: PublicKey,
@ -109,11 +109,11 @@ export class ParsableTickArray {
}
/**
* @category Parsables
* @category Network
*/
@staticImplements<ParsableEntity<FeeTierData>>()
export class ParsableFeeTier {
private constructor() { }
private constructor() {}
public static parse(
address: PublicKey,
@ -133,11 +133,11 @@ export class ParsableFeeTier {
}
/**
* @category Parsables
* @category Network
*/
@staticImplements<ParsableEntity<PositionBundleData>>()
export class ParsablePositionBundle {
private constructor() { }
private constructor() {}
public static parse(
address: PublicKey,

View File

@ -3,14 +3,19 @@ import { AddressUtil } from "@orca-so/common-sdk";
import { PublicKey } from "@solana/web3.js";
import {
DecimalsMap,
defaultGetPricesConfig,
defaultGetPricesThresholdConfig,
PoolMap,
PriceCalculationData,
PriceMap,
TickArrayMap,
defaultGetPricesConfig,
defaultGetPricesThresholdConfig,
} from ".";
import { WhirlpoolContext } from "../context";
import {
IGNORE_CACHE,
PREFER_CACHE,
WhirlpoolAccountFetchOptions,
WhirlpoolAccountFetcherInterface,
} from "../network/public/fetcher";
import { PDAUtil, PoolUtil, SwapUtils } from "../utils/public";
import { convertListToMap, filterNullObjects } from "../utils/txn-utils";
import { calculatePricesForQuoteToken, convertAmount, isSubset } from "./calculate-pool-prices";
@ -26,31 +31,31 @@ export class PriceModule {
* Fetches and calculates the prices for a set of tokens.
* This method will derive the pools that need to be queried from the mints and is not performant.
*
* @param ctx {@link WhirlpoolContext}
* @param fetcher {@link WhirlpoolAccountFetcherInterface}
* @param mints The mints to fetch prices for.
* @param config The configuration for the price calculation.
* @param thresholdConfig - The threshold configuration for the price calculation.
* @param refresh Whether to refresh the cache.
* @param opts an {@link WhirlpoolAccountFetchOptions} object to define fetch and cache options when accessing on-chain accounts
* @param availableData - Data that is already available to avoid redundant fetches.
* @returns A map of token addresses to prices.
*/
static async fetchTokenPricesByMints(
ctx: WhirlpoolContext,
fetcher: WhirlpoolAccountFetcherInterface,
mints: Address[],
config = defaultGetPricesConfig,
thresholdConfig = defaultGetPricesThresholdConfig,
refresh = true,
opts = IGNORE_CACHE,
availableData: Partial<PriceCalculationData> = {}
): Promise<PriceMap> {
const poolMap = availableData?.poolMap
? availableData?.poolMap
: await PriceModuleUtils.fetchPoolDataFromMints(ctx, mints, config, refresh);
: await PriceModuleUtils.fetchPoolDataFromMints(fetcher, mints, config, opts);
const tickArrayMap = availableData?.tickArrayMap
? availableData.tickArrayMap
: await PriceModuleUtils.fetchTickArraysForPools(ctx, poolMap, config, refresh);
: await PriceModuleUtils.fetchTickArraysForPools(fetcher, poolMap, config, opts);
const decimalsMap = availableData?.decimalsMap
? availableData.decimalsMap
: await PriceModuleUtils.fetchDecimalsForMints(ctx, mints, false);
: await PriceModuleUtils.fetchDecimalsForMints(fetcher, mints, PREFER_CACHE);
return PriceModule.calculateTokenPrices(
mints,
@ -67,33 +72,28 @@ export class PriceModule {
/**
* Fetches and calculates the token prices from a set of pools.
*
* @param ctx {@link WhirlpoolContext}
* @param fetcher {@link WhirlpoolAccountFetcherInterface}
* @param pools The pools to fetch prices for.
* @param config The configuration for the price calculation.
* @param thresholdConfig The threshold configuration for the price calculation.
* @param refresh Whether to refresh the cache.
* @param opts an {@link WhirlpoolAccountFetchOptions} object to define fetch and cache options when accessing on-chain accounts
* @returns A map of token addresses to prices
*/
static async fetchTokenPricesByPools(
ctx: WhirlpoolContext,
fetcher: WhirlpoolAccountFetcherInterface,
pools: Address[],
config = defaultGetPricesConfig,
thresholdConfig = defaultGetPricesThresholdConfig,
refresh = true
opts: WhirlpoolAccountFetchOptions = IGNORE_CACHE
): Promise<PriceMap> {
const poolDatas = await ctx.fetcher.listPools(pools, refresh);
const poolDatas = Array.from((await fetcher.getPools(pools, opts)).values());
const [filteredPoolDatas, filteredPoolAddresses] = filterNullObjects(poolDatas, pools);
const poolMap = convertListToMap(
filteredPoolDatas,
AddressUtil.toStrings(filteredPoolAddresses)
);
const tickArrayMap = await PriceModuleUtils.fetchTickArraysForPools(
ctx,
poolMap,
config,
refresh
);
const tickArrayMap = await PriceModuleUtils.fetchTickArraysForPools(fetcher, poolMap, config, opts);
const mints = Array.from(
Object.values(poolMap).reduce((acc, pool) => {
acc.add(pool.tokenMintA.toBase58());
@ -101,7 +101,7 @@ export class PriceModule {
return acc;
}, new Set<string>())
);
const decimalsMap = await PriceModuleUtils.fetchDecimalsForMints(ctx, mints, false);
const decimalsMap = await PriceModuleUtils.fetchDecimalsForMints(fetcher, mints, PREFER_CACHE);
return PriceModule.calculateTokenPrices(
mints,
@ -226,17 +226,17 @@ export class PriceModuleUtils {
* Fetch pool data for the given mints by deriving the PDA from all combinations of mints & tick-arrays.
* Note that this method can be slow.
*
* @param ctx {@link WhirlpoolContext}
* @param fetcher {@link WhirlpoolAccountFetcherInterface}
* @param mints The mints to fetch pool data for.
* @param config The configuration for the price calculation.
* @param refresh Whether to refresh the cache.
* @param opts an {@link WhirlpoolAccountFetchOptions} object to define fetch and cache options when accessing on-chain accounts
* @returns A {@link PoolMap} of pool addresses to pool data.
*/
static async fetchPoolDataFromMints(
ctx: WhirlpoolContext,
fetcher: WhirlpoolAccountFetcherInterface,
mints: Address[],
config = defaultGetPricesConfig,
refresh = true
opts = IGNORE_CACHE
): Promise<PoolMap> {
const { quoteTokens, tickSpacings, programId, whirlpoolsConfig } = config;
const poolAddresses: string[] = mints
@ -258,7 +258,7 @@ export class PriceModuleUtils {
)
.flat();
const poolDatas = await ctx.fetcher.listPools(poolAddresses, refresh);
const poolDatas = Array.from((await fetcher.getPools(poolAddresses, opts)).values());
const [filteredPoolDatas, filteredPoolAddresses] = filterNullObjects(poolDatas, poolAddresses);
return convertListToMap(filteredPoolDatas, filteredPoolAddresses);
@ -267,17 +267,17 @@ export class PriceModuleUtils {
/**
* Fetch tick-array data for the given pools
*
* @param ctx {@link WhirlpoolData}
* @param fetcher {@link WhirlpoolAccountFetcherInterface}
* @param pools The pools to fetch tick-array data for.
* @param config The configuration for the price calculation.
* @param refresh Whether to refresh the cache.
* @param opts an {@link WhirlpoolAccountFetchOptions} object to define fetch and cache options when accessing on-chain accounts
* @returns A {@link TickArrayMap} of tick-array addresses to tick-array data.
*/
static async fetchTickArraysForPools(
ctx: WhirlpoolContext,
fetcher: WhirlpoolAccountFetcherInterface,
pools: PoolMap,
config = defaultGetPricesConfig,
refresh = true
opts: WhirlpoolAccountFetchOptions = IGNORE_CACHE
): Promise<TickArrayMap> {
const { programId } = config;
@ -312,7 +312,7 @@ export class PriceModuleUtils {
});
const tickArrayAddresses = Array.from(tickArrayAddressSet);
const tickArrays = await ctx.fetcher.listTickArrays(tickArrayAddresses, refresh);
const tickArrays = await fetcher.getTickArrays(tickArrayAddresses, opts);
const [filteredTickArrays, filteredTickArrayAddresses] = filterNullObjects(
tickArrays,
@ -323,17 +323,17 @@ export class PriceModuleUtils {
/**
* Fetch the decimals to token mapping for the given mints.
* @param ctx {@link WhirlpoolContext}
* @param fetcher {@link WhirlpoolAccountFetcherInterface}
* @param mints The mints to fetch decimals for.
* @param refresh Whether to refresh the cache.
* @param opts an {@link WhirlpoolAccountFetchOptions} object to define fetch and cache options when accessing on-chain accounts
* @returns A {@link DecimalsMap} of mint addresses to decimals.
*/
static async fetchDecimalsForMints(
ctx: WhirlpoolContext,
fetcher: WhirlpoolAccountFetcherInterface,
mints: Address[],
refresh = true
opts = IGNORE_CACHE
): Promise<DecimalsMap> {
const mintInfos = await ctx.fetcher.listMintInfos(mints, refresh);
const mintInfos = Array.from((await fetcher.getMintInfos(mints, opts)).values());
return mintInfos.reduce((acc, mintInfo, index) => {
const mint = AddressUtil.toString(mints[index]);

View File

@ -1,8 +1,11 @@
import { Address } from "@coral-xyz/anchor";
import { Percentage } from "@orca-so/common-sdk";
import BN from "bn.js";
import { AccountFetcher } from "../..";
import { SwapErrorCode, WhirlpoolsError } from "../../errors/errors";
import {
WhirlpoolAccountFetchOptions,
WhirlpoolAccountFetcherInterface,
} from "../../network/public/fetcher";
import { Whirlpool } from "../../whirlpool-client";
import { NormalSwapQuote, swapQuoteByInputToken } from "./swap-quote";
@ -36,8 +39,8 @@ export type DevFeeSwapQuote = NormalSwapQuote & {
* @param tokenAmount - The amount of input token to swap from
* @param slippageTolerance - The amount of slippage to account for in this quote
* @param programId - PublicKey for the Whirlpool ProgramId
* @param fetcher - AccountFetcher object to fetch solana accounts
* @param refresh - If true, fetcher would default to fetching the latest accounts
* @param cache - WhirlpoolAccountCacheInterface instance to fetch solana accounts
* @param opts an {@link WhirlpoolAccountFetchOptions} object to define fetch and cache options when accessing on-chain accounts
* @param devFeePercentage - The percentage amount to send to developer wallet prior to the swap. Percentage num/dem values has to match token decimal.
* @returns a SwapQuote object with slippage adjusted SwapInput parameters & estimates on token amounts, fee & end whirlpool states.
*/
@ -47,9 +50,9 @@ export async function swapQuoteByInputTokenWithDevFees(
tokenAmount: BN,
slippageTolerance: Percentage,
programId: Address,
fetcher: AccountFetcher,
fetcher: WhirlpoolAccountFetcherInterface,
devFeePercentage: Percentage,
refresh: boolean
opts?: WhirlpoolAccountFetchOptions
): Promise<DevFeeSwapQuote> {
if (devFeePercentage.toDecimal().greaterThanOrEqualTo(1)) {
throw new WhirlpoolsError(
@ -69,7 +72,7 @@ export async function swapQuoteByInputTokenWithDevFees(
slippageTolerance,
programId,
fetcher,
refresh
opts
);
const devFeeAdjustedQuote: DevFeeSwapQuote = {

View File

@ -3,7 +3,10 @@ import { AddressUtil, Percentage } from "@orca-so/common-sdk";
import BN from "bn.js";
import invariant from "tiny-invariant";
import { SwapInput } from "../../instructions";
import { AccountFetcher } from "../../network/public";
import {
WhirlpoolAccountFetchOptions,
WhirlpoolAccountFetcherInterface,
} from "../../network/public/fetcher";
import { TickArray, WhirlpoolData } from "../../types/public";
import { PoolUtil, SwapDirection } from "../../utils/public";
import { SwapUtils } from "../../utils/public/swap-utils";
@ -72,8 +75,8 @@ export type NormalSwapQuote = SwapInput & SwapEstimates;
* @param tokenAmount - The amount of input token to swap from
* @param slippageTolerance - The amount of slippage to account for in this quote
* @param programId - PublicKey for the Whirlpool ProgramId
* @param fetcher - AccountFetcher object to fetch solana accounts
* @param refresh - If true, fetcher would default to fetching the latest accounts
* @param cache - WhirlpoolAccountCacheInterface instance object to fetch solana accounts
* @param opts an {@link WhirlpoolAccountFetchOptions} object to define fetch and cache options when accessing on-chain accounts
* @returns a SwapQuote object with slippage adjusted SwapInput parameters & estimates on token amounts, fee & end whirlpool states.
*/
export async function swapQuoteByInputToken(
@ -82,8 +85,8 @@ export async function swapQuoteByInputToken(
tokenAmount: BN,
slippageTolerance: Percentage,
programId: Address,
fetcher: AccountFetcher,
refresh: boolean
fetcher: WhirlpoolAccountFetcherInterface,
opts?: WhirlpoolAccountFetchOptions
): Promise<SwapQuote> {
const params = await swapQuoteByToken(
whirlpool,
@ -92,7 +95,7 @@ export async function swapQuoteByInputToken(
true,
programId,
fetcher,
refresh
opts
);
return swapQuoteWithParams(params, slippageTolerance);
}
@ -109,8 +112,8 @@ export async function swapQuoteByInputToken(
* @param tokenAmount - The maximum amount of output token to receive in this swap.
* @param slippageTolerance - The amount of slippage to account for in this quote
* @param programId - PublicKey for the Whirlpool ProgramId
* @param fetcher - AccountFetcher object to fetch solana accounts
* @param refresh - If true, fetcher would default to fetching the latest accounts
* @param cache - WhirlpoolAccountCacheInterface instance to fetch solana accounts
* @param opts an {@link WhirlpoolAccountFetchOptions} object to define fetch and cache options when accessing on-chain accounts
* @returns a SwapQuote object with slippage adjusted SwapInput parameters & estimates on token amounts, fee & end whirlpool states.
*/
export async function swapQuoteByOutputToken(
@ -119,8 +122,8 @@ export async function swapQuoteByOutputToken(
tokenAmount: BN,
slippageTolerance: Percentage,
programId: Address,
fetcher: AccountFetcher,
refresh: boolean
fetcher: WhirlpoolAccountFetcherInterface,
opts?: WhirlpoolAccountFetchOptions
): Promise<SwapQuote> {
const params = await swapQuoteByToken(
whirlpool,
@ -129,7 +132,7 @@ export async function swapQuoteByOutputToken(
false,
programId,
fetcher,
refresh
opts
);
return swapQuoteWithParams(params, slippageTolerance);
}
@ -168,8 +171,8 @@ async function swapQuoteByToken(
tokenAmount: BN,
amountSpecifiedIsInput: boolean,
programId: Address,
fetcher: AccountFetcher,
refresh: boolean
fetcher: WhirlpoolAccountFetcherInterface,
opts?: WhirlpoolAccountFetchOptions
): Promise<SwapQuoteParam> {
const whirlpoolData = whirlpool.getData();
const swapMintKey = AddressUtil.toPubKey(inputTokenMint);
@ -187,7 +190,7 @@ async function swapQuoteByToken(
AddressUtil.toPubKey(programId),
whirlpool.getAddress(),
fetcher,
refresh
opts
);
return {

View File

@ -2,7 +2,10 @@ import { Address } from "@coral-xyz/anchor";
import { AddressUtil } from "@orca-so/common-sdk";
import BN from "bn.js";
import invariant from "tiny-invariant";
import { AccountFetcher } from "..";
import {
WhirlpoolAccountFetcherInterface,
WhirlpoolAccountFetchOptions,
} from "../network/public/fetcher";
import { SwapQuoteParam } from "../quotes/public";
import { PoolUtil, SwapDirection, SwapUtils } from "../utils/public";
@ -16,18 +19,18 @@ export interface SwapQuoteRequest {
export async function batchBuildSwapQuoteParams(
quoteRequests: SwapQuoteRequest[],
programId: Address,
fetcher: AccountFetcher,
refresh: boolean
fetcher: WhirlpoolAccountFetcherInterface,
opts?: WhirlpoolAccountFetchOptions
): Promise<SwapQuoteParam[]> {
const whirlpools = await fetcher.listPools(
const whirlpools = await fetcher.getPools(
quoteRequests.map((req) => req.whirlpool),
refresh
opts
);
const program = AddressUtil.toPubKey(programId);
const tickArrayRequests = quoteRequests.map((quoteReq, index) => {
const tickArrayRequests = quoteRequests.map((quoteReq) => {
const { whirlpool, tokenAmount, tradeTokenMint, amountSpecifiedIsInput } = quoteReq;
const whirlpoolData = whirlpools[index]!;
const whirlpoolData = whirlpools.get(AddressUtil.toString(whirlpool))!;
const swapMintKey = AddressUtil.toPubKey(tradeTokenMint);
const swapTokenType = PoolUtil.getTokenType(whirlpoolData, swapMintKey);
invariant(!!swapTokenType, "swapTokenMint does not match any tokens on this pool");
@ -45,12 +48,7 @@ export async function batchBuildSwapQuoteParams(
};
});
const tickArrays = await SwapUtils.getBatchTickArrays(
program,
fetcher,
refresh,
tickArrayRequests
);
const tickArrays = await SwapUtils.getBatchTickArrays(program, fetcher, tickArrayRequests, opts);
return tickArrayRequests.map((req, index) => {
const { whirlpoolData, tokenAmount, aToB, amountSpecifiedIsInput } = req;

View File

@ -2,6 +2,7 @@ import { Address } from "@coral-xyz/anchor";
import { Percentage, TransactionBuilder } from "@orca-so/common-sdk";
import { AddressLookupTableAccount } from "@solana/web3.js";
import BN from "bn.js";
import { WhirlpoolAccountFetchOptions } from "../../network/public/fetcher";
import { SwapQuote } from "../../quotes/public";
import { Path } from "../../utils/public";
import { AtaAccountInfo, RouteSelectOptions } from "./router-utils";
@ -128,17 +129,18 @@ export interface WhirlpoolRouter {
*
* @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 an {@link WhirlpoolAccountFetchOptions} object to define fetch and cache options when accessing on-chain accounts
* @param opts
* {@link RoutingOptions} to configure the router. Missing options will be filled with default values from
* {@link RouterUtils.getDefaultRoutingOptions}.
* @param fetchOpts
* {@link WhirlpoolAccountFetchOptions} to configure the fetching of on-chain data.
* @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>
opts?: Partial<RoutingOptions>,
fetchOpts?: WhirlpoolAccountFetchOptions
): Promise<TradeRoute[]>;
/**
@ -146,22 +148,23 @@ export interface WhirlpoolRouter {
* 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 an {@link WhirlpoolAccountFetchOptions} object to define fetch and cache options when accessing on-chain accounts
* @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}.
* @param fetchOpts
* {@link WhirlpoolAccountFetchOptions} to configure the fetching of on-chain data.
* @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>
selectionOpts?: Partial<RouteSelectOptions>,
fetchOpts?: WhirlpoolAccountFetchOptions
): Promise<ExecutableRoute | null>;
/**

View File

@ -11,6 +11,7 @@ import { PublicKey } from "@solana/web3.js";
import { ExecutableRoute, RoutingOptions, TradeRoute } from ".";
import { WhirlpoolContext } from "../../context";
import { getSwapFromRoute } from "../../instructions/composites/swap-with-route";
import { PREFER_CACHE } from "../../network/public/fetcher";
import { isWalletConnected } from "../../utils/wallet-utils";
/**
@ -86,7 +87,7 @@ export class RouterUtils {
resolvedAtaAccounts: opts.availableAtaAccounts ?? null,
wallet: wallet.publicKey,
},
false
PREFER_CACHE
);
if (!!opts.onRouteEvaluation) {

View File

@ -2,8 +2,8 @@ import { Address } from "@coral-xyz/anchor";
import { AddressUtil, Percentage } from "@orca-so/common-sdk";
import { PublicKey } from "@solana/web3.js";
import BN from "bn.js";
import { AccountFetcher } from "..";
import { SwapErrorCode } from "../errors/errors";
import { PREFER_CACHE, WhirlpoolAccountFetcherInterface } from "../network/public/fetcher";
import { SwapQuoteParam, swapQuoteWithParams } from "../quotes/public";
import { Path } from "../utils/public";
import { SwapQuoteRequest, batchBuildSwapQuoteParams } from "./batch-swap-quote";
@ -27,7 +27,7 @@ export async function getQuoteMap(
paths: Path[],
amountSpecifiedIsInput: boolean,
programId: PublicKey,
fetcher: AccountFetcher,
fetcher: WhirlpoolAccountFetcherInterface,
opts: RoutingOptions
) {
const { percentIncrement, numTopPartialQuotes } = opts;
@ -63,7 +63,7 @@ export async function getQuoteMap(
quoteUpdates.map((update) => update.request),
AddressUtil.toPubKey(programId),
fetcher,
false
PREFER_CACHE
);
populateQuoteMap(quoteUpdates, quoteParams, quoteMap);

View File

@ -1,9 +1,15 @@
import { Address } from "@coral-xyz/anchor";
import { AddressUtil, Percentage, TransactionBuilder } from "@orca-so/common-sdk";
import { Account } from "@solana/spl-token";
import { AccountFetcher, WhirlpoolContext } from "..";
import { WhirlpoolContext } from "..";
import { RouteQueryErrorCode, SwapErrorCode, WhirlpoolsError } from "../errors/errors";
import { getSwapFromRoute } from "../instructions/composites/swap-with-route";
import {
IGNORE_CACHE,
PREFER_CACHE,
WhirlpoolAccountFetchOptions,
WhirlpoolAccountFetcherInterface,
} from "../network/public/fetcher";
import { Path, PoolGraph, SwapUtils } from "../utils/public";
import { getBestRoutesFromQuoteMap } from "./convert-quote-map";
import {
@ -22,8 +28,8 @@ export class WhirlpoolRouterImpl implements WhirlpoolRouter {
async findAllRoutes(
trade: Trade,
refresh: boolean,
opts?: Partial<RoutingOptions>
opts?: Partial<RoutingOptions>,
fetchOpts?: WhirlpoolAccountFetchOptions
): Promise<TradeRoute[]> {
const { tokenIn, tokenOut, tradeAmount, amountSpecifiedIsInput } = trade;
const paths = this.poolGraph.getPath(tokenIn, tokenOut);
@ -50,7 +56,7 @@ export class WhirlpoolRouterImpl implements WhirlpoolRouter {
const { program, fetcher } = this.ctx;
const programId = program.programId;
await prefetchRoutes(paths, programId, fetcher, refresh);
await prefetchRoutes(paths, programId, fetcher, fetchOpts);
try {
const [quoteMap, failures] = await getQuoteMap(
@ -94,11 +100,11 @@ export class WhirlpoolRouterImpl implements WhirlpoolRouter {
async findBestRoute(
trade: Trade,
refresh: boolean,
routingOpts?: Partial<RoutingOptions>,
selectionOpts?: Partial<RouteSelectOptions>
selectionOpts?: Partial<RouteSelectOptions>,
fetchOpts?: WhirlpoolAccountFetchOptions
): Promise<ExecutableRoute | null> {
const allRoutes = await this.findAllRoutes(trade, refresh, routingOpts);
const allRoutes = await this.findAllRoutes(trade, routingOpts, fetchOpts);
const selectOpts = { ...RouterUtils.getDefaultSelectOptions(), selectionOpts };
return await RouterUtils.selectFirstExecutableRoute(this.ctx, allRoutes, selectOpts);
}
@ -116,7 +122,7 @@ export class WhirlpoolRouterImpl implements WhirlpoolRouter {
resolvedAtaAccounts: resolvedAtas,
wallet: this.ctx.wallet.publicKey,
},
true
IGNORE_CACHE
);
return txBuilder;
}
@ -126,8 +132,8 @@ export class WhirlpoolRouterImpl implements WhirlpoolRouter {
async function prefetchRoutes(
paths: Path[],
programId: Address,
fetcher: AccountFetcher,
refresh: boolean = false
fetcher: WhirlpoolAccountFetcherInterface,
opts: WhirlpoolAccountFetchOptions = PREFER_CACHE
): Promise<void> {
const poolSet = new Set<string>();
for (let i = 0; i < paths.length; i++) {
@ -138,11 +144,10 @@ async function prefetchRoutes(
}
const ps = Array.from(poolSet);
const allWps = await fetcher.listPools(ps, refresh);
const allWps = await fetcher.getPools(ps, opts);
const tickArrayAddresses = [];
for (let i = 0; i < allWps.length; i++) {
const wp = allWps[i];
for (const [key, wp] of allWps) {
if (wp == null) {
continue;
}
@ -151,19 +156,19 @@ async function prefetchRoutes(
wp.tickSpacing,
true,
AddressUtil.toPubKey(programId),
AddressUtil.toPubKey(ps[i])
AddressUtil.toPubKey(key)
);
const addr2 = SwapUtils.getTickArrayPublicKeys(
wp.tickCurrentIndex,
wp.tickSpacing,
false,
AddressUtil.toPubKey(programId),
AddressUtil.toPubKey(ps[i])
AddressUtil.toPubKey(key)
);
const allAddrs = [...addr1, ...addr2].map((k) => k.toBase58());
const unique = Array.from(new Set(allAddrs));
tickArrayAddresses.push(...unique);
}
await fetcher.listTickArrays(tickArrayAddresses, refresh);
await fetcher.getTickArrays(tickArrayAddresses, opts);
}

View File

@ -12,7 +12,7 @@ import WhirlpoolIDL from "../../artifacts/whirlpool.json";
/**
* Supported parasable account names from the Whirlpool contract.
* @category Parsables
* @category Network
*/
export enum AccountName {
WhirlpoolsConfig = "WhirlpoolsConfig",

View File

@ -1,4 +1,5 @@
import { WhirlpoolContext } from "../..";
import { WhirlpoolAccountFetchOptions } from "../../network/public/fetcher";
import { PositionData, WhirlpoolData } from "../../types/public";
import { PDAUtil } from "../public";
@ -6,7 +7,7 @@ export async function getTickArrayDataForPosition(
ctx: WhirlpoolContext,
position: PositionData,
whirlpool: WhirlpoolData,
refresh: boolean
opts?: WhirlpoolAccountFetchOptions
) {
const lowerTickArrayKey = PDAUtil.getTickArrayFromTickIndex(
position.tickLowerIndex,
@ -21,5 +22,5 @@ export async function getTickArrayDataForPosition(
ctx.program.programId
).publicKey;
return await ctx.fetcher.listTickArrays([lowerTickArrayKey, upperTickArrayKey], refresh);
return await ctx.fetcher.getTickArrays([lowerTickArrayKey, upperTickArrayKey], opts);
}

View File

@ -1,7 +1,5 @@
import { Address } from "@coral-xyz/anchor";
import { AddressUtil } from "@orca-so/common-sdk";
import { AccountFetcher } from "../../../network/public";
import { convertListToMap } from "../../txn-utils";
import { PREFER_CACHE, WhirlpoolAccountFetcherInterface } from "../../../network/public/fetcher";
import { AdjacencyListPoolGraph } from "../adjacency-list-pool-graph";
import { PoolGraph, PoolTokenPair } from "./pool-graph";
@ -16,18 +14,15 @@ export class PoolGraphBuilder {
/**
* Fetch data and build a {@link PoolGraph} from a list of pools addresses
* @param pools - a list of pool addresses to generate this pool graph
* @param fetcher - {@link AccountFetcher} to use for fetching pool data
* @param cache - {@link WhirlpoolAccountFetcherInterface} to use for fetching pool data
* @returns A {@link PoolGraph} with the provided pools
*/
static async buildPoolGraphWithFetch(
pools: Address[],
fetcher: AccountFetcher
fetcher: WhirlpoolAccountFetcherInterface
): Promise<PoolGraph> {
const poolAccounts = convertListToMap(
await fetcher.listPools(pools, false),
pools.map((pool) => AddressUtil.toPubKey(pool).toBase58())
);
const poolTokenPairs = Object.entries(poolAccounts)
const poolAccounts = await fetcher.getPools(pools, PREFER_CACHE);
const poolTokenPairs = Array.from(poolAccounts.entries())
.map(([addr, pool]) => {
if (pool) {
return {

View File

@ -3,7 +3,10 @@ import { AddressUtil, Percentage, U64_MAX, ZERO } from "@orca-so/common-sdk";
import { PublicKey } from "@solana/web3.js";
import BN from "bn.js";
import { WhirlpoolContext } from "../..";
import { AccountFetcher } from "../../network/public";
import {
WhirlpoolAccountFetchOptions,
WhirlpoolAccountFetcherInterface,
} from "../../network/public/fetcher";
import {
MAX_SQRT_PRICE,
MAX_SWAP_TICK_ARRAYS,
@ -123,8 +126,8 @@ export class SwapUtils {
* @param aToB - The direction of the trade.
* @param programId - The Whirlpool programId which the Whirlpool lives on.
* @param whirlpoolAddress - PublicKey of the whirlpool to swap on.
* @param fetcher - AccountFetcher object to fetch solana accounts
* @param refresh - If true, fetcher would default to fetching the latest accounts
* @param cache - WhirlpoolAccountCacheInterface object to fetch solana accounts
* @param opts an {@link WhirlpoolAccountFetchOptions} object to define fetch and cache options when accessing on-chain accounts
* @returns An array of PublicKey[] for the tickArray accounts that this swap may traverse across.
*/
public static async getTickArrays(
@ -133,28 +136,31 @@ export class SwapUtils {
aToB: boolean,
programId: PublicKey,
whirlpoolAddress: PublicKey,
fetcher: AccountFetcher,
refresh: boolean
fetcher: WhirlpoolAccountFetcherInterface,
opts?: WhirlpoolAccountFetchOptions
): Promise<TickArray[]> {
const data = await this.getBatchTickArrays(programId, fetcher, refresh, [
{ tickCurrentIndex, tickSpacing, aToB, whirlpoolAddress },
]);
const data = await this.getBatchTickArrays(
programId,
fetcher,
[{ tickCurrentIndex, tickSpacing, aToB, whirlpoolAddress }],
opts
);
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 cache - WhirlpoolAccountCacheInterface instance to fetch solana accounts
* @param tickArrayRequests - An array of {@link TickArrayRequest} of tick-arrays to request for.
* @param opts an {@link WhirlpoolAccountFetchOptions} object to define fetch and cache options when accessing on-chain accounts
* @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[]
fetcher: WhirlpoolAccountFetcherInterface,
tickArrayRequests: TickArrayRequest[],
opts?: WhirlpoolAccountFetchOptions
): Promise<TickArray[][]> {
let addresses: PublicKey[] = [];
let requestToIndices = [];
@ -173,7 +179,7 @@ export class SwapUtils {
requestToIndices.push([addresses.length, addresses.length + requestAddresses.length]);
addresses.push(...requestAddresses);
}
const data = await fetcher.listTickArrays(addresses, refresh);
const data = await fetcher.getTickArrays(addresses, opts);
// Re-map from flattened batch data to TickArray[] for request
return requestToIndices.map((indices) => {

View File

@ -2,13 +2,16 @@ import { Address } from "@coral-xyz/anchor";
import { AddressUtil, PDA } from "@orca-so/common-sdk";
import { PublicKey } from "@solana/web3.js";
import invariant from "tiny-invariant";
import { AccountFetcher } from "../../network/public";
import {
WhirlpoolAccountFetchOptions,
WhirlpoolAccountFetcherInterface,
} from "../../network/public/fetcher";
import {
MAX_TICK_INDEX,
MIN_TICK_INDEX,
TICK_ARRAY_SIZE,
TickArrayData,
TickData,
TICK_ARRAY_SIZE,
} from "../../types/public";
import { PDAUtil } from "./pda-utils";
@ -223,17 +226,17 @@ export class TickArrayUtil {
* Useful for creating error messages.
*
* @param tickArrayAddrs - A list of tick-array addresses to verify.
* @param fetcher - {@link AccountFetcher}
* @param refresh - If true, always fetch the latest on-chain data
* @param cache - {@link WhirlpoolAccountFetcherInterface}
* @param opts an {@link WhirlpoolAccountFetchOptions} object to define fetch and cache options when accessing on-chain accounts
* @returns A string of all uninitialized tick array addresses, delimited by ",". Falsy value if all arrays are initialized.
*/
public static async getUninitializedArraysString(
tickArrayAddrs: Address[],
fetcher: AccountFetcher,
refresh: boolean
fetcher: WhirlpoolAccountFetcherInterface,
opts?: WhirlpoolAccountFetchOptions
) {
const taAddrs = AddressUtil.toPubKeys(tickArrayAddrs);
const tickArrayData = await fetcher.listTickArrays(taAddrs, refresh);
const tickArrayData = await fetcher.getTickArrays(taAddrs, opts);
// Verify tick arrays are initialized if the user provided them.
if (tickArrayData) {
@ -255,17 +258,17 @@ export class TickArrayUtil {
programId: PublicKey,
whirlpoolAddress: PublicKey,
tickSpacing: number,
fetcher: AccountFetcher,
refresh: boolean
fetcher: WhirlpoolAccountFetcherInterface,
opts: WhirlpoolAccountFetchOptions
) {
const startTicks = ticks.map((tick) => TickUtil.getStartTickIndex(tick, tickSpacing));
const removeDupeTicks = [...new Set(startTicks)];
const tickArrayPDAs = removeDupeTicks.map((tick) =>
PDAUtil.getTickArray(programId, whirlpoolAddress, tick)
);
const fetchedArrays = await fetcher.listTickArrays(
const fetchedArrays = await fetcher.getTickArrays(
tickArrayPDAs.map((pda) => pda.publicKey),
refresh
opts
);
const uninitializedIndices = TickArrayUtil.getUninitializedArrays(fetchedArrays);
return uninitializedIndices.map((index) => {
@ -278,10 +281,10 @@ export class TickArrayUtil {
/**
* Evaluate a list of tick-array data and return the array of indices which the tick-arrays are not initialized.
* @param tickArrays - a list of TickArrayData or null objects from AccountFetcher.listTickArrays
* @param tickArrays - a list of TickArrayData or null objects from WhirlpoolAccountCacheInterface.getTickArrays
* @returns an array of array-index for the input tickArrays that requires initialization.
*/
public static getUninitializedArrays(tickArrays: (TickArrayData | null)[]): number[] {
public static getUninitializedArrays(tickArrays: readonly (TickArrayData | null)[]): number[] {
return tickArrays
.map((value, index) => {
if (!value) {

View File

@ -18,8 +18,8 @@ export function convertListToMap<T>(fetchedData: T[], addresses: string[]): Reco
// Filter out null objects in the first array and remove the corresponding objects in the second array
export function filterNullObjects<T, K>(
firstArray: Array<T | null>,
secondArray: Array<K>
firstArray: ReadonlyArray<T | null>,
secondArray: ReadonlyArray<K>
): [Array<T>, Array<K>] {
const filteredFirstArray: Array<T> = [];
const filteredSecondArray: Array<K> = [];

View File

@ -4,7 +4,10 @@ import { PublicKey } from "@solana/web3.js";
import { WhirlpoolContext } from "./context";
import { WhirlpoolClientImpl } from "./impl/whirlpool-client-impl";
import { DevFeeSwapInput, SwapInput } from "./instructions";
import { AccountFetcher } from "./network/public";
import {
WhirlpoolAccountFetchOptions,
WhirlpoolAccountFetcherInterface,
} from "./network/public/fetcher";
import { WhirlpoolRouter } from "./router/public";
import {
DecreaseLiquidityInput,
@ -28,10 +31,10 @@ export interface WhirlpoolClient {
getContext: () => WhirlpoolContext;
/**
* Get an AccountFetcher to fetch Whirlpool accounts
* @return an AccountFetcher instance
* Get an WhirlpoolAccountCacheInterface to fetch and cache Whirlpool accounts
* @return an WhirlpoolAccountCacheInterface instance
*/
getFetcher: () => AccountFetcher;
getFetcher: () => WhirlpoolAccountFetcherInterface;
/**
* Get a WhirlpoolRouter to help generate the best prices when transacting across a set of pools.
@ -43,49 +46,49 @@ export interface WhirlpoolClient {
/**
* Get a Whirlpool object to interact with the Whirlpool account at the given address.
* @param poolAddress the address of the Whirlpool account
* @param refresh true to always request newest data from chain with this request
* @param opts an options object to define fetch and cache options when accessing on-chain accounts
* @return a Whirlpool object to interact with
*/
getPool: (poolAddress: Address, refresh?: boolean) => Promise<Whirlpool>;
getPool: (poolAddress: Address, opts?: WhirlpoolAccountFetchOptions) => Promise<Whirlpool>;
/**
* Get a list of Whirlpool objects matching the provided list of addresses.
* @param poolAddresses the addresses of the Whirlpool accounts
* @param refresh true to always request newest data from chain with this request
* @param opts an options object to define fetch and cache options when accessing on-chain accounts
* @return a list of Whirlpool objects to interact with
*/
getPools: (poolAddresses: Address[], refresh?: boolean) => Promise<Whirlpool[]>;
getPools: (poolAddresses: Address[], opts?: WhirlpoolAccountFetchOptions) => Promise<Whirlpool[]>;
/**
* Get a Position object to interact with the Position account at the given address.
* @param positionAddress the address of the Position account
* @param refresh true to always request newest data from chain with this request
* @param opts an options object to define fetch and cache options when accessing on-chain accounts
* @return a Position object to interact with.
* @throws error when address does not return a Position account.
*/
getPosition: (positionAddress: Address, refresh?: boolean) => Promise<Position>;
getPosition: (positionAddress: Address, opts?: WhirlpoolAccountFetchOptions) => Promise<Position>;
/**
* Get a list of Position objects to interact with the Position account at the given addresses.
* @param positionAddress the addresses of the Position accounts
* @param refresh true to always request newest data from chain with this request
* @param opts an options object to define fetch and cache options when accessing on-chain accounts
* @return a Record object between account address and Position. If an address is not a Position account, it will be null.
*/
getPositions: (
positionAddresses: Address[],
refresh?: boolean
opts?: WhirlpoolAccountFetchOptions
) => Promise<Record<string, Position | null>>;
/**
* Collect all fees and rewards from a list of positions.
* @experimental
* @param positionAddress the addresses of the Position accounts to collect fee & rewards from.
* @param refresh true to always request newest data from chain with this request
* @param opts an options object to define fetch and cache options when accessing on-chain accounts
* @returns A set of transaction-builders to resolve ATA for affliated tokens, collect fee & rewards for all positions.
*/
collectFeesAndRewardsForPositions: (
positionAddresses: Address[],
refresh?: boolean
opts?: WhirlpoolAccountFetchOptions
) => Promise<TransactionBuilder[]>;
/**
@ -187,13 +190,13 @@ export interface Whirlpool {
*
* @param ticks - A group of ticks that define the desired tick-arrays to initialize. If the tick's array has been initialized, it will be ignored.
* @param funder - the wallet that will fund the cost needed to initialize the position. If null, the WhirlpoolContext wallet is used.
* @param refresh - whether this operation will fetch for the latest accounts if a cache version is available.
* @param opts an {@link WhirlpoolAccountFetchOptions} object to define fetch and cache options when accessing on-chain accounts
* @return a transaction that will initialize the defined tick-arrays if executed. Return null if all of the tick's arrays are initialized.
*/
initTickArrayForTicks: (
ticks: number[],
funder?: Address,
refresh?: boolean
opts?: WhirlpoolAccountFetchOptions
) => Promise<TransactionBuilder | null>;
/**
@ -378,7 +381,7 @@ export interface Position {
* @param destinationWallet - the wallet to deposit tokens into when withdrawing from the position. If null, the WhirlpoolContext wallet is used.
* @param positionWallet - the wallet to that houses the position token. If null, the WhirlpoolContext wallet is used.
* @param ataPayer - wallet that will fund the creation of the new associated token accounts
* @param refresh - set to true to bypass cached on-chain data
* @param opts an options object to define fetch and cache options when accessing on-chain accounts
* @return the transaction that will collect fees from the position
*/
collectFees: (
@ -387,7 +390,7 @@ export interface Position {
destinationWallet?: Address,
positionWallet?: Address,
ataPayer?: Address,
refresh?: boolean
opts?: WhirlpoolAccountFetchOptions
) => Promise<TransactionBuilder>;
/**
@ -401,7 +404,7 @@ export interface Position {
* @param destinationWallet - the wallet to deposit tokens into when withdrawing from the position. If null, the WhirlpoolContext wallet is used.
* @param positionWallet - the wallet to that houses the position token. If null, the WhirlpoolContext wallet is used.
* @param ataPayer - wallet that will fund the creation of the new associated token accounts
* @param refresh - set to true to bypass cached on-chain data
* @param opts an options object to define fetch and cache options when accessing on-chain accounts
* @return the transaction that will collect fees from the position
*/
collectRewards: (
@ -411,6 +414,6 @@ export interface Position {
destinationWallet?: Address,
positionWallet?: Address,
ataPayer?: Address,
refresh?: boolean
opts?: WhirlpoolAccountFetchOptions
) => Promise<TransactionBuilder>;
}

View File

@ -12,6 +12,7 @@ import {
increaseLiquidityQuoteByInputTokenWithParams,
toTx
} from "../../src";
import { IGNORE_CACHE } from "../../src/network/public/fetcher";
import {
ONE_SOL,
TickSpacing,
@ -86,8 +87,8 @@ describe("close_bundled_position", () => {
);
const { bundledPositionPda } = positionInitInfo.params;
const preAccount = await fetcher.getPosition(bundledPositionPda.publicKey, true);
const prePositionBundle = await fetcher.getPositionBundle(positionBundleInfo.positionBundlePda.publicKey, true);
const preAccount = await fetcher.getPosition(bundledPositionPda.publicKey, IGNORE_CACHE);
const prePositionBundle = await fetcher.getPositionBundle(positionBundleInfo.positionBundlePda.publicKey, IGNORE_CACHE);
checkBitmap(prePositionBundle!, [bundleIndex]);
assert.ok(preAccount !== null);
@ -103,8 +104,8 @@ describe("close_bundled_position", () => {
receiver: receiverKeypair.publicKey,
})
).buildAndExecute();
const postAccount = await fetcher.getPosition(bundledPositionPda.publicKey, true);
const postPositionBundle = await fetcher.getPositionBundle(positionBundleInfo.positionBundlePda.publicKey, true);
const postAccount = await fetcher.getPosition(bundledPositionPda.publicKey, IGNORE_CACHE);
const postPositionBundle = await fetcher.getPositionBundle(positionBundleInfo.positionBundlePda.publicKey, IGNORE_CACHE);
checkBitmap(postPositionBundle!, []);
assert.ok(postAccount === null);
@ -194,7 +195,7 @@ describe("close_bundled_position", () => {
const { bundledPositionPda } = positionInitInfo.params;
// deposit
const pool = await client.getPool(poolInitInfo.whirlpoolPda.publicKey, true);
const pool = await client.getPool(poolInitInfo.whirlpoolPda.publicKey, IGNORE_CACHE);
const quote = increaseLiquidityQuoteByInputTokenWithParams({
tokenMintA: poolInitInfo.tokenMintA,
tokenMintB: poolInitInfo.tokenMintB,
@ -216,7 +217,7 @@ describe("close_bundled_position", () => {
ctx.wallet.publicKey
);
const position = await client.getPosition(bundledPositionPda.publicKey, true);
const position = await client.getPosition(bundledPositionPda.publicKey, IGNORE_CACHE);
await (await position.increaseLiquidity(quote)).buildAndExecute();
assert.ok((await position.refreshData()).liquidity.gtn(0));
@ -446,7 +447,7 @@ describe("close_bundled_position", () => {
1,
);
await tx.buildAndExecute();
const positionBundle = await fetcher.getPositionBundle(positionBundleInfo.positionBundlePda.publicKey, true);
const positionBundle = await fetcher.getPositionBundle(positionBundleInfo.positionBundlePda.publicKey, IGNORE_CACHE);
checkBitmapIsClosed(positionBundle!, 0);
});
@ -485,7 +486,7 @@ describe("close_bundled_position", () => {
// owner can close even if delegation exists
await tx.buildAndExecute();
const positionBundle = await fetcher.getPositionBundle(positionBundleInfo.positionBundlePda.publicKey, true);
const positionBundle = await fetcher.getPositionBundle(positionBundleInfo.positionBundlePda.publicKey, IGNORE_CACHE);
checkBitmapIsClosed(positionBundle!, 0);
});
@ -562,7 +563,7 @@ describe("close_bundled_position", () => {
1
);
const tokenInfo = await fetcher.getTokenInfo(funderATA, true);
const tokenInfo = await fetcher.getTokenInfo(funderATA, IGNORE_CACHE);
assert.ok(tokenInfo?.amount === 1n);
const tx = toTx(
@ -579,7 +580,7 @@ describe("close_bundled_position", () => {
tx.addSigner(funderKeypair);
await tx.buildAndExecute();
const positionBundle = await fetcher.getPositionBundle(positionBundleInfo.positionBundlePda.publicKey, true);
const positionBundle = await fetcher.getPositionBundle(positionBundleInfo.positionBundlePda.publicKey, IGNORE_CACHE);
checkBitmapIsClosed(positionBundle!, 0);
});
});

View File

@ -14,6 +14,7 @@ import {
WhirlpoolData,
WhirlpoolIx
} from "../../src";
import { IGNORE_CACHE } from "../../src/network/public/fetcher";
import {
approveToken,
createTokenAccount,
@ -121,7 +122,7 @@ describe("collect_fees", () => {
const positionBeforeCollect = (await fetcher.getPosition(
positions[0].publicKey,
true
IGNORE_CACHE
)) as PositionData;
assert.ok(positionBeforeCollect.feeOwedA.eq(new BN(581)));
assert.ok(positionBeforeCollect.feeOwedB.eq(new BN(581)));
@ -155,7 +156,7 @@ describe("collect_fees", () => {
tokenVaultB: tokenVaultBKeypair.publicKey,
})
).buildAndExecute();
const positionAfter = (await fetcher.getPosition(positions[0].publicKey, true)) as PositionData;
const positionAfter = (await fetcher.getPosition(positions[0].publicKey, IGNORE_CACHE)) as PositionData;
const feeBalanceA = await getTokenBalance(provider, feeAccountA);
const feeBalanceB = await getTokenBalance(provider, feeAccountB);
@ -174,7 +175,7 @@ describe("collect_fees", () => {
tickArrayUpper: positions[1].tickArrayUpper,
})
).buildAndExecute();
const outOfRangePosition = await fetcher.getPosition(positions[1].publicKey, true);
const outOfRangePosition = await fetcher.getPosition(positions[1].publicKey, IGNORE_CACHE);
assert.ok(outOfRangePosition?.feeOwedA.eq(ZERO_BN));
assert.ok(outOfRangePosition?.feeOwedB.eq(ZERO_BN));
});

View File

@ -4,6 +4,7 @@ import { MathUtil } from "@orca-so/common-sdk";
import * as assert from "assert";
import Decimal from "decimal.js";
import { PDAUtil, toTx, WhirlpoolContext, WhirlpoolData, WhirlpoolIx } from "../../src";
import { IGNORE_CACHE } from "../../src/network/public/fetcher";
import { createTokenAccount, getTokenBalance, TickSpacing, ZERO_BN } from "../utils";
import { defaultConfirmOptions } from "../utils/const";
import { WhirlpoolTestFixture } from "../utils/fixture";
@ -53,7 +54,7 @@ describe("collect_protocol_fees", () => {
.addSigner(feeAuthorityKeypair)
.buildAndExecute();
const poolBefore = (await fetcher.getPool(whirlpoolPda.publicKey, true)) as WhirlpoolData;
const poolBefore = (await fetcher.getPool(whirlpoolPda.publicKey, IGNORE_CACHE)) as WhirlpoolData;
assert.ok(poolBefore?.protocolFeeOwedA.eq(ZERO_BN));
assert.ok(poolBefore?.protocolFeeOwedB.eq(ZERO_BN));
@ -105,7 +106,7 @@ describe("collect_protocol_fees", () => {
})
).buildAndExecute();
const poolAfter = (await fetcher.getPool(whirlpoolPda.publicKey, true)) as WhirlpoolData;
const poolAfter = (await fetcher.getPool(whirlpoolPda.publicKey, IGNORE_CACHE)) as WhirlpoolData;
assert.ok(poolAfter?.protocolFeeOwedA.eq(new BN(150)));
assert.ok(poolAfter?.protocolFeeOwedB.eq(new BN(150)));

View File

@ -9,6 +9,7 @@ import {
NUM_REWARDS, toTx,
WhirlpoolContext, WhirlpoolIx
} from "../../src";
import { IGNORE_CACHE } from "../../src/network/public/fetcher";
import {
approveToken,
createAndMintToTokenAccount,
@ -82,8 +83,8 @@ describe("collect_reward", () => {
).buildAndExecute();
// Generate collect reward expectation
const pool = await client.getPool(whirlpoolPda.publicKey, true);
const positionPreCollect = await client.getPosition(positions[0].publicKey, true);
const pool = await client.getPool(whirlpoolPda.publicKey, IGNORE_CACHE);
const positionPreCollect = await client.getPosition(positions[0].publicKey, IGNORE_CACHE);
// Lock the collectRewards quote to the last time we called updateFeesAndRewards
const expectation = collectRewardsQuote({
@ -126,7 +127,7 @@ describe("collect_reward", () => {
await getTokenBalance(provider, rewards[i].rewardVaultKeypair.publicKey)
);
assert.equal(vaultStartBalance - collectedBalance, vaultBalance);
const position = await fetcher.getPosition(positions[0].publicKey, true);
const position = await fetcher.getPosition(positions[0].publicKey, IGNORE_CACHE);
assert.equal(position?.rewardInfos[i].amountOwed, 0);
assert.ok(position?.rewardInfos[i].growthInsideCheckpoint.gte(ZERO_BN));
}

View File

@ -11,6 +11,7 @@ import {
WhirlpoolIx,
toTx
} from "../../src";
import { IGNORE_CACHE } from "../../src/network/public/fetcher";
import { decreaseLiquidityQuoteByLiquidityWithParams } from "../../src/quotes/public/decrease-liquidity-quote";
import {
TickSpacing,
@ -45,7 +46,7 @@ describe("decrease_liquidity", () => {
});
const { poolInitInfo, tokenAccountA, tokenAccountB, positions } = fixture.getInfos();
const { whirlpoolPda, tokenVaultAKeypair, tokenVaultBKeypair } = poolInitInfo;
const poolBefore = (await fetcher.getPool(whirlpoolPda.publicKey, true)) as WhirlpoolData;
const poolBefore = (await fetcher.getPool(whirlpoolPda.publicKey, IGNORE_CACHE)) as WhirlpoolData;
// To check if rewardLastUpdatedTimestamp is updated
await sleep(1200);
@ -77,16 +78,16 @@ describe("decrease_liquidity", () => {
).buildAndExecute();
const remainingLiquidity = liquidityAmount.sub(removalQuote.liquidityAmount);
const poolAfter = (await fetcher.getPool(whirlpoolPda.publicKey, true)) as WhirlpoolData;
const poolAfter = (await fetcher.getPool(whirlpoolPda.publicKey, IGNORE_CACHE)) as WhirlpoolData;
assert.ok(poolAfter.rewardLastUpdatedTimestamp.gt(poolBefore.rewardLastUpdatedTimestamp));
assert.ok(poolAfter.liquidity.eq(remainingLiquidity));
const position = await fetcher.getPosition(positions[0].publicKey, true);
const position = await fetcher.getPosition(positions[0].publicKey, IGNORE_CACHE);
assert.ok(position?.liquidity.eq(remainingLiquidity));
const tickArray = (await fetcher.getTickArray(
positions[0].tickArrayLower,
true
IGNORE_CACHE
)) as TickArrayData;
assertTick(tickArray.ticks[56], true, remainingLiquidity, remainingLiquidity);
assertTick(tickArray.ticks[70], true, remainingLiquidity, remainingLiquidity.neg());
@ -104,7 +105,7 @@ describe("decrease_liquidity", () => {
const { poolInitInfo, positions, tokenAccountA, tokenAccountB } = fixture.getInfos();
const { whirlpoolPda, tokenVaultAKeypair, tokenVaultBKeypair } = poolInitInfo;
const position = positions[0];
const poolBefore = (await fetcher.getPool(whirlpoolPda.publicKey, true)) as WhirlpoolData;
const poolBefore = (await fetcher.getPool(whirlpoolPda.publicKey, IGNORE_CACHE)) as WhirlpoolData;
const removalQuote = decreaseLiquidityQuoteByLiquidityWithParams({
liquidity: new anchor.BN(1_000_000),
@ -133,22 +134,22 @@ describe("decrease_liquidity", () => {
).buildAndExecute();
const remainingLiquidity = liquidityAmount.sub(removalQuote.liquidityAmount);
const poolAfter = (await fetcher.getPool(whirlpoolPda.publicKey, true)) as WhirlpoolData;
const poolAfter = (await fetcher.getPool(whirlpoolPda.publicKey, IGNORE_CACHE)) as WhirlpoolData;
assert.ok(poolAfter.rewardLastUpdatedTimestamp.gte(poolBefore.rewardLastUpdatedTimestamp));
assert.ok(poolAfter.liquidity.eq(remainingLiquidity));
const positionAfter = (await fetcher.getPosition(position.publicKey, true)) as PositionData;
const positionAfter = (await fetcher.getPosition(position.publicKey, IGNORE_CACHE)) as PositionData;
assert.ok(positionAfter.liquidity.eq(remainingLiquidity));
const tickArrayLower = (await fetcher.getTickArray(
position.tickArrayLower,
true
IGNORE_CACHE
)) as TickArrayData;
assertTick(tickArrayLower.ticks[78], true, remainingLiquidity, remainingLiquidity);
const tickArrayUpper = (await fetcher.getTickArray(
position.tickArrayUpper,
true
IGNORE_CACHE
)) as TickArrayData;
assertTick(tickArrayUpper.ticks[10], true, remainingLiquidity, remainingLiquidity.neg());
});

View File

@ -5,6 +5,7 @@ import { Keypair } from "@solana/web3.js";
import * as assert from "assert";
import { InitPoolParams, POSITION_BUNDLE_SIZE, PositionBundleData, WhirlpoolIx, toTx } from "../../src";
import { WhirlpoolContext } from "../../src/context";
import { IGNORE_CACHE } from "../../src/network/public/fetcher";
import {
ONE_SOL,
TickSpacing,
@ -56,7 +57,7 @@ describe("delete_position_bundle", () => {
);
// PositionBundle account exists
const prePositionBundle = await fetcher.getPositionBundle(positionBundleInfo.positionBundlePda.publicKey, true);
const prePositionBundle = await fetcher.getPositionBundle(positionBundleInfo.positionBundlePda.publicKey, IGNORE_CACHE);
assert.ok(prePositionBundle !== null);
// NFT supply should be 1
@ -88,7 +89,7 @@ describe("delete_position_bundle", () => {
const postBalance = await provider.connection.getBalance(owner.publicKey, "confirmed");
// PositionBundle account should be closed
const postPositionBundle = await fetcher.getPositionBundle(positionBundleInfo.positionBundlePda.publicKey, true);
const postPositionBundle = await fetcher.getPositionBundle(positionBundleInfo.positionBundlePda.publicKey, IGNORE_CACHE);
assert.ok(postPositionBundle === null);
// NFT should be burned and its supply should be 0
@ -118,7 +119,7 @@ describe("delete_position_bundle", () => {
);
// PositionBundle account exists
const prePositionBundle = await fetcher.getPositionBundle(positionBundleInfo.positionBundlePda.publicKey, true);
const prePositionBundle = await fetcher.getPositionBundle(positionBundleInfo.positionBundlePda.publicKey, IGNORE_CACHE);
assert.ok(prePositionBundle !== null);
// NFT supply should be 1
@ -147,7 +148,7 @@ describe("delete_position_bundle", () => {
const postBalance = await provider.connection.getBalance(owner.publicKey, "confirmed");
// PositionBundle account should be closed
const postPositionBundle = await fetcher.getPositionBundle(positionBundleInfo.positionBundlePda.publicKey, true);
const postPositionBundle = await fetcher.getPositionBundle(positionBundleInfo.positionBundlePda.publicKey, IGNORE_CACHE);
assert.ok(postPositionBundle === null);
// NFT should be burned and its supply should be 0
@ -212,11 +213,11 @@ describe("delete_position_bundle", () => {
);
const { bundledPositionPda } = positionInitInfo.params;
const position = await fetcher.getPosition(positionInitInfo.params.bundledPositionPda.publicKey, true);
const position = await fetcher.getPosition(positionInitInfo.params.bundledPositionPda.publicKey, IGNORE_CACHE);
assert.equal(position!.tickLowerIndex, tickLowerIndex);
assert.equal(position!.tickUpperIndex, tickUpperIndex);
const positionBundle = await fetcher.getPositionBundle(positionBundleInfo.positionBundlePda.publicKey, true);
const positionBundle = await fetcher.getPositionBundle(positionBundleInfo.positionBundlePda.publicKey, IGNORE_CACHE);
checkBitmapIsOpened(positionBundle!, bundleIndex);
const tx = toTx(
@ -251,7 +252,7 @@ describe("delete_position_bundle", () => {
// should be ok
await tx.buildAndExecute();
const deleted = await fetcher.getPositionBundle(positionBundleInfo.positionBundlePda.publicKey, true);
const deleted = await fetcher.getPositionBundle(positionBundleInfo.positionBundlePda.publicKey, IGNORE_CACHE);
assert.ok(deleted === null);
});
@ -272,11 +273,11 @@ describe("delete_position_bundle", () => {
);
const { bundledPositionPda } = positionInitInfo.params;
const position = await fetcher.getPosition(positionInitInfo.params.bundledPositionPda.publicKey, true);
const position = await fetcher.getPosition(positionInitInfo.params.bundledPositionPda.publicKey, IGNORE_CACHE);
assert.equal(position!.tickLowerIndex, tickLowerIndex);
assert.equal(position!.tickUpperIndex, tickUpperIndex);
const positionBundle = await fetcher.getPositionBundle(positionBundleInfo.positionBundlePda.publicKey, true);
const positionBundle = await fetcher.getPositionBundle(positionBundleInfo.positionBundlePda.publicKey, IGNORE_CACHE);
checkBitmapIsOpened(positionBundle!, bundleIndex);
const tx = toTx(
@ -311,7 +312,7 @@ describe("delete_position_bundle", () => {
// should be ok
await tx.buildAndExecute();
const deleted = await fetcher.getPositionBundle(positionBundleInfo.positionBundlePda.publicKey, true);
const deleted = await fetcher.getPositionBundle(positionBundleInfo.positionBundlePda.publicKey, IGNORE_CACHE);
assert.ok(deleted === null);
});
@ -372,7 +373,7 @@ describe("delete_position_bundle", () => {
).addSigner(delegate);
await txAfterTransfer.buildAndExecute();
const deleted = await fetcher.getPositionBundle(positionBundleInfo.positionBundlePda.publicKey, true);
const deleted = await fetcher.getPositionBundle(positionBundleInfo.positionBundlePda.publicKey, IGNORE_CACHE);
assert.ok(deleted === null);
});

View File

@ -24,9 +24,9 @@ describe("get_pool_prices", () => {
const context = WhirlpoolContext.fromWorkspace(provider, program);
async function fetchMaps(context: WhirlpoolContext, mints: PublicKey[], config: GetPricesConfig) {
const poolMap = await PriceModuleUtils.fetchPoolDataFromMints(context, mints, config);
const tickArrayMap = await PriceModuleUtils.fetchTickArraysForPools(context, poolMap, config);
const decimalsMap = await PriceModuleUtils.fetchDecimalsForMints(context, mints);
const poolMap = await PriceModuleUtils.fetchPoolDataFromMints(context.fetcher, mints, config);
const tickArrayMap = await PriceModuleUtils.fetchTickArraysForPools(context.fetcher, poolMap, config);
const decimalsMap = await PriceModuleUtils.fetchDecimalsForMints(context.fetcher, mints);
return { poolMap, tickArrayMap, decimalsMap };
}

View File

@ -14,6 +14,7 @@ import {
WhirlpoolIx,
toTx
} from "../../src";
import { IGNORE_CACHE } from "../../src/network/public/fetcher";
import { PoolUtil, toTokenAmount } from "../../src/utils/public/pool-utils";
import {
MAX_U64,
@ -56,7 +57,7 @@ describe("increase_liquidity", () => {
const { whirlpoolPda } = poolInitInfo;
const positionInitInfo = positions[0];
const poolBefore = (await fetcher.getPool(whirlpoolPda.publicKey, true)) as WhirlpoolData;
const poolBefore = (await fetcher.getPool(whirlpoolPda.publicKey, IGNORE_CACHE)) as WhirlpoolData;
const tokenAmount = toTokenAmount(167_000, 167_000);
const liquidityAmount = PoolUtil.estimateLiquidityFromTokenAmounts(
currTick,
@ -87,10 +88,10 @@ describe("increase_liquidity", () => {
})
).buildAndExecute();
const position = (await fetcher.getPosition(positionInitInfo.publicKey, true)) as PositionData;
const position = (await fetcher.getPosition(positionInitInfo.publicKey, IGNORE_CACHE)) as PositionData;
assert.ok(position.liquidity.eq(liquidityAmount));
const poolAfter = (await fetcher.getPool(whirlpoolPda.publicKey, true)) as WhirlpoolData;
const poolAfter = (await fetcher.getPool(whirlpoolPda.publicKey, IGNORE_CACHE)) as WhirlpoolData;
assert.ok(poolAfter.rewardLastUpdatedTimestamp.gt(poolBefore.rewardLastUpdatedTimestamp));
assert.equal(
await getTokenBalance(provider, poolInitInfo.tokenVaultAKeypair.publicKey),
@ -104,12 +105,12 @@ describe("increase_liquidity", () => {
const tickArrayLower = (await fetcher.getTickArray(
positionInitInfo.tickArrayLower,
true
IGNORE_CACHE
)) as TickArrayData;
assertTick(tickArrayLower.ticks[78], true, liquidityAmount, liquidityAmount);
const tickArrayUpper = (await fetcher.getTickArray(
positionInitInfo.tickArrayUpper,
true
IGNORE_CACHE
)) as TickArrayData;
assertTick(tickArrayUpper.ticks[10], true, liquidityAmount, liquidityAmount.neg());
});
@ -126,7 +127,7 @@ describe("increase_liquidity", () => {
const { poolInitInfo, positions, tokenAccountA, tokenAccountB } = fixture.getInfos();
const { whirlpoolPda } = poolInitInfo;
const positionInitInfo = positions[0];
const poolBefore = (await fetcher.getPool(whirlpoolPda.publicKey, true)) as WhirlpoolData;
const poolBefore = (await fetcher.getPool(whirlpoolPda.publicKey, IGNORE_CACHE)) as WhirlpoolData;
const tokenAmount = toTokenAmount(1_000_000, 0);
const liquidityAmount = PoolUtil.estimateLiquidityFromTokenAmounts(
@ -166,18 +167,18 @@ describe("increase_liquidity", () => {
);
const expectedLiquidity = new anchor.BN(liquidityAmount);
const position = (await fetcher.getPosition(positionInitInfo.publicKey, true)) as PositionData;
const position = (await fetcher.getPosition(positionInitInfo.publicKey, IGNORE_CACHE)) as PositionData;
assert.ok(position.liquidity.eq(expectedLiquidity));
const tickArray = (await fetcher.getTickArray(
positionInitInfo.tickArrayLower,
true
IGNORE_CACHE
)) as TickArrayData;
assertTick(tickArray.ticks[56], true, expectedLiquidity, expectedLiquidity);
assertTick(tickArray.ticks[70], true, expectedLiquidity, expectedLiquidity.neg());
const poolAfter = (await fetcher.getPool(whirlpoolPda.publicKey, true)) as WhirlpoolData;
const poolAfter = (await fetcher.getPool(whirlpoolPda.publicKey, IGNORE_CACHE)) as WhirlpoolData;
assert.ok(poolAfter.rewardLastUpdatedTimestamp.gte(poolBefore.rewardLastUpdatedTimestamp));
assert.equal(poolAfter.liquidity, 0);
});
@ -192,7 +193,7 @@ describe("increase_liquidity", () => {
});
const { poolInitInfo, tokenAccountA, tokenAccountB } = fixture.getInfos();
const { whirlpoolPda, tickSpacing } = poolInitInfo;
const poolBefore = (await fetcher.getPool(whirlpoolPda.publicKey, true)) as WhirlpoolData;
const poolBefore = (await fetcher.getPool(whirlpoolPda.publicKey, IGNORE_CACHE)) as WhirlpoolData;
const tokenAmount = toTokenAmount(1_000_000, 0);
const liquidityAmount = PoolUtil.estimateLiquidityFromTokenAmounts(
@ -278,16 +279,16 @@ describe("increase_liquidity", () => {
const expectedLiquidity = new anchor.BN(liquidityAmount);
const position = (await fetcher.getPosition(
params.positionPda.publicKey,
true
IGNORE_CACHE
)) as PositionData;
assert.ok(position.liquidity.eq(expectedLiquidity));
const tickArray = (await fetcher.getTickArray(tickArrayLower, true)) as TickArrayData;
const tickArray = (await fetcher.getTickArray(tickArrayLower, IGNORE_CACHE)) as TickArrayData;
assertTick(tickArray.ticks[56], true, expectedLiquidity, expectedLiquidity);
assertTick(tickArray.ticks[70], true, expectedLiquidity, expectedLiquidity.neg());
const poolAfter = (await fetcher.getPool(whirlpoolPda.publicKey, true)) as WhirlpoolData;
const poolAfter = (await fetcher.getPool(whirlpoolPda.publicKey, IGNORE_CACHE)) as WhirlpoolData;
assert.ok(poolAfter.rewardLastUpdatedTimestamp.gte(poolBefore.rewardLastUpdatedTimestamp));
assert.equal(poolAfter.liquidity, 0);
});
@ -305,7 +306,7 @@ describe("increase_liquidity", () => {
const { whirlpoolPda } = poolInitInfo;
const positionInitInfo = positions[0];
const poolBefore = (await fetcher.getPool(whirlpoolPda.publicKey, true)) as WhirlpoolData;
const poolBefore = (await fetcher.getPool(whirlpoolPda.publicKey, IGNORE_CACHE)) as WhirlpoolData;
const tokenAmount = toTokenAmount(0, 167_000);
const liquidityAmount = PoolUtil.estimateLiquidityFromTokenAmounts(
currTick,
@ -340,10 +341,10 @@ describe("increase_liquidity", () => {
.addSigner(delegate)
.buildAndExecute();
const position = (await fetcher.getPosition(positionInitInfo.publicKey, true)) as PositionData;
const position = (await fetcher.getPosition(positionInitInfo.publicKey, IGNORE_CACHE)) as PositionData;
assert.ok(position.liquidity.eq(liquidityAmount));
const poolAfter = (await fetcher.getPool(whirlpoolPda.publicKey, true)) as WhirlpoolData;
const poolAfter = (await fetcher.getPool(whirlpoolPda.publicKey, IGNORE_CACHE)) as WhirlpoolData;
assert.ok(poolAfter.rewardLastUpdatedTimestamp.gte(poolBefore.rewardLastUpdatedTimestamp));
assert.equal(
await getTokenBalance(provider, poolInitInfo.tokenVaultAKeypair.publicKey),
@ -357,12 +358,12 @@ describe("increase_liquidity", () => {
const tickArrayLower = (await fetcher.getTickArray(
positionInitInfo.tickArrayLower,
true
IGNORE_CACHE
)) as TickArrayData;
assertTick(tickArrayLower.ticks[78], true, liquidityAmount, liquidityAmount);
const tickArrayUpper = (await fetcher.getTickArray(
positionInitInfo.tickArrayUpper,
true
IGNORE_CACHE
)) as TickArrayData;
assertTick(tickArrayUpper.ticks[10], true, liquidityAmount, liquidityAmount.neg());
});
@ -423,7 +424,7 @@ describe("increase_liquidity", () => {
})
).buildAndExecute();
const position = (await fetcher.getPosition(positionPda.publicKey, true)) as PositionData;
const position = (await fetcher.getPosition(positionPda.publicKey, IGNORE_CACHE)) as PositionData;
assert.ok(position.liquidity.eq(estLiquidityAmount));
});
@ -483,7 +484,7 @@ describe("increase_liquidity", () => {
})
).buildAndExecute();
const position = (await fetcher.getPosition(positionPda.publicKey, true)) as PositionData;
const position = (await fetcher.getPosition(positionPda.publicKey, IGNORE_CACHE)) as PositionData;
assert.ok(position.liquidity.eq(estLiquidityAmount));
});

View File

@ -9,6 +9,7 @@ import {
toTx,
WhirlpoolContext
} from "../../src";
import { IGNORE_CACHE } from "../../src/network/public/fetcher";
import {
createMintInstructions,
mintToDestination
@ -57,7 +58,7 @@ describe("initialize_position_bundle", () => {
async function checkPositionBundleMint(positionBundleMintPubkey: PublicKey) {
// verify position bundle Mint account
const positionBundleMint = (await ctx.fetcher.getMintInfo(positionBundleMintPubkey, true)) as Mint;
const positionBundleMint = (await ctx.fetcher.getMintInfo(positionBundleMintPubkey, IGNORE_CACHE)) as Mint;
// should have NFT characteristics
assert.strictEqual(positionBundleMint.decimals, 0);
assert.ok(positionBundleMint.supply === 1n);
@ -68,7 +69,7 @@ describe("initialize_position_bundle", () => {
async function checkPositionBundleTokenAccount(positionBundleTokenAccountPubkey: PublicKey, owner: PublicKey, positionBundleMintPubkey: PublicKey) {
// verify position bundle Token account
const positionBundleTokenAccount = (await ctx.fetcher.getTokenInfo(positionBundleTokenAccountPubkey, true)) as Account;
const positionBundleTokenAccount = (await ctx.fetcher.getTokenInfo(positionBundleTokenAccountPubkey, IGNORE_CACHE)) as Account;
assert.ok(positionBundleTokenAccount.amount === 1n);
assert.ok(positionBundleTokenAccount.mint.equals(positionBundleMintPubkey));
assert.ok(positionBundleTokenAccount.owner.equals(owner));
@ -76,7 +77,7 @@ describe("initialize_position_bundle", () => {
async function checkPositionBundle(positionBundlePubkey: PublicKey, positionBundleMintPubkey: PublicKey) {
// verify PositionBundle account
const positionBundle = (await ctx.fetcher.getPositionBundle(positionBundlePubkey, true)) as PositionBundleData;
const positionBundle = (await ctx.fetcher.getPositionBundle(positionBundlePubkey, IGNORE_CACHE)) as PositionBundleData;
assert.ok(positionBundle.positionBundleMint.equals(positionBundleMintPubkey));
assert.strictEqual(positionBundle.positionBitmap.length * 8, POSITION_BUNDLE_SIZE);
for (const bitmap of positionBundle.positionBitmap) {

View File

@ -19,6 +19,7 @@ import {
WHIRLPOOL_NFT_UPDATE_AUTH,
WhirlpoolContext,
} from "../../src";
import { IGNORE_CACHE } from "../../src/network/public/fetcher";
import {
createMintInstructions,
mintToDestination
@ -83,7 +84,7 @@ describe("initialize_position_bundle_with_metadata", () => {
// verify position bundle Mint account
const positionBundleMint = (await ctx.fetcher.getMintInfo(
positionBundleMintPubkey,
true
IGNORE_CACHE
)) as Mint;
// should have NFT characteristics
assert.strictEqual(positionBundleMint.decimals, 0);
@ -101,7 +102,7 @@ describe("initialize_position_bundle_with_metadata", () => {
// verify position bundle Token account
const positionBundleTokenAccount = (await ctx.fetcher.getTokenInfo(
positionBundleTokenAccountPubkey,
true
IGNORE_CACHE
)) as Account;
assert.ok(positionBundleTokenAccount.amount === 1n);
assert.ok(positionBundleTokenAccount.mint.equals(positionBundleMintPubkey));
@ -115,7 +116,7 @@ describe("initialize_position_bundle_with_metadata", () => {
// verify PositionBundle account
const positionBundle = (await ctx.fetcher.getPositionBundle(
positionBundlePubkey,
true
IGNORE_CACHE
)) as PositionBundleData;
assert.ok(positionBundle.positionBundleMint.equals(positionBundleMintPubkey));
assert.strictEqual(positionBundle.positionBitmap.length * 8, POSITION_BUNDLE_SIZE);

View File

@ -1,6 +1,7 @@
import * as anchor from "@coral-xyz/anchor";
import * as assert from "assert";
import { toTx, WhirlpoolContext, WhirlpoolData, WhirlpoolIx } from "../../src";
import { IGNORE_CACHE } from "../../src/network/public/fetcher";
import { createMint, ONE_SOL, systemTransferTx, TickSpacing } from "../utils";
import { defaultConfirmOptions } from "../utils/const";
import { initializeReward, initTestPool } from "../utils/init-utils";
@ -24,7 +25,7 @@ describe("initialize_reward", () => {
const whirlpool = (await fetcher.getPool(
poolInitInfo.whirlpoolPda.publicKey,
true
IGNORE_CACHE
)) as WhirlpoolData;
assert.ok(whirlpool.rewardInfos[0].mint.equals(params.rewardMint));
@ -49,7 +50,7 @@ describe("initialize_reward", () => {
const whirlpool2 = (await fetcher.getPool(
poolInitInfo.whirlpoolPda.publicKey,
true
IGNORE_CACHE
)) as WhirlpoolData;
assert.ok(whirlpool2.rewardInfos[0].mint.equals(params.rewardMint));

View File

@ -7,6 +7,7 @@ import { BN } from "bn.js";
import Decimal from "decimal.js";
import { NUM_REWARDS, PDAUtil, POSITION_BUNDLE_SIZE, PoolUtil, PositionBundleData, PriceMath, Whirlpool, WhirlpoolClient, WhirlpoolIx, buildWhirlpoolClient, collectFeesQuote, toTx } from "../../../src";
import { WhirlpoolContext } from "../../../src/context";
import { IGNORE_CACHE } from "../../../src/network/public/fetcher";
import { TickSpacing, ZERO_BN, createTokenAccount } from "../../utils";
import { defaultConfirmOptions } from "../../utils/const";
import { WhirlpoolTestFixture } from "../../utils/fixture";
@ -214,7 +215,7 @@ describe("bundled position management tests", () => {
}
await builder.buildAndExecute();
const positionBundleAccount = await ctx.fetcher.getPositionBundle(positionBundlePubkey, true);
const positionBundleAccount = await ctx.fetcher.getPositionBundle(positionBundlePubkey, IGNORE_CACHE);
checkBitmap(positionBundleAccount!, openedBundleIndexes);
}
assert.equal(openedBundleIndexes.length, POSITION_BUNDLE_SIZE);
@ -240,7 +241,7 @@ describe("bundled position management tests", () => {
}
await builder.buildAndExecute();
const positionBundleAccount = await ctx.fetcher.getPositionBundle(positionBundlePubkey, true);
const positionBundleAccount = await ctx.fetcher.getPositionBundle(positionBundlePubkey, IGNORE_CACHE);
checkBitmap(positionBundleAccount!, openedBundleIndexes);
}
assert.equal(openedBundleIndexes.length, 0);
@ -256,7 +257,7 @@ describe("bundled position management tests", () => {
receiver: ctx.wallet.publicKey,
})
).buildAndExecute();
const positionBundleAccount = await ctx.fetcher.getPositionBundle(positionBundlePubkey, true);
const positionBundleAccount = await ctx.fetcher.getPositionBundle(positionBundlePubkey, IGNORE_CACHE);
assert.ok(positionBundleAccount === null);
});
@ -324,13 +325,13 @@ describe("bundled position management tests", () => {
// increaseLiquidity
const depositAmounts = PoolUtil.getTokenAmountsFromLiquidity(
liquidityAmount,
(await ctx.fetcher.getPool(whirlpoolPubkey, true))!.sqrtPrice,
(await ctx.fetcher.getPool(whirlpoolPubkey, IGNORE_CACHE))!.sqrtPrice,
PriceMath.tickIndexToSqrtPriceX64(tickLowerIndex),
PriceMath.tickIndexToSqrtPriceX64(tickUpperIndex),
true
);
const preIncrease = await ctx.fetcher.getPosition(bundledPositionPubkey, true);
const preIncrease = await ctx.fetcher.getPosition(bundledPositionPubkey, IGNORE_CACHE);
assert.ok(preIncrease!.liquidity.isZero());
await toTx(
ctx,
@ -340,7 +341,7 @@ describe("bundled position management tests", () => {
tokenMaxB: depositAmounts.tokenB,
})
).buildAndExecute();
const postIncrease = await ctx.fetcher.getPosition(bundledPositionPubkey, true);
const postIncrease = await ctx.fetcher.getPosition(bundledPositionPubkey, IGNORE_CACHE);
assert.ok(postIncrease!.liquidity.eq(liquidityAmount));
await sleep(2); // accrueRewards
@ -348,7 +349,7 @@ describe("bundled position management tests", () => {
await stopRewardsEmission(fixture);
// updateFeesAndRewards
const preUpdate = await ctx.fetcher.getPosition(bundledPositionPubkey, true);
const preUpdate = await ctx.fetcher.getPosition(bundledPositionPubkey, IGNORE_CACHE);
assert.ok(preUpdate!.feeOwedA.isZero());
assert.ok(preUpdate!.feeOwedB.isZero());
assert.ok(preUpdate!.rewardInfos.every((r) => r.amountOwed.isZero()));
@ -361,7 +362,7 @@ describe("bundled position management tests", () => {
whirlpool: whirlpoolPubkey,
})
).buildAndExecute();
const postUpdate = await ctx.fetcher.getPosition(bundledPositionPubkey, true);
const postUpdate = await ctx.fetcher.getPosition(bundledPositionPubkey, IGNORE_CACHE);
assert.ok(postUpdate!.feeOwedA.gtn(0));
assert.ok(postUpdate!.feeOwedB.gtn(0));
assert.ok(postUpdate!.rewardInfos.every((r) => r.amountOwed.gtn(0)));
@ -380,7 +381,7 @@ describe("bundled position management tests", () => {
whirlpool: whirlpoolPubkey,
})
).buildAndExecute();
const postCollectFees = await ctx.fetcher.getPosition(bundledPositionPubkey, true);
const postCollectFees = await ctx.fetcher.getPosition(bundledPositionPubkey, IGNORE_CACHE);
assert.ok(postCollectFees!.feeOwedA.isZero());
assert.ok(postCollectFees!.feeOwedB.isZero());
@ -392,7 +393,7 @@ describe("bundled position management tests", () => {
ctx.wallet.publicKey
);
const preCollectReward = await ctx.fetcher.getPosition(bundledPositionPubkey, true);
const preCollectReward = await ctx.fetcher.getPosition(bundledPositionPubkey, IGNORE_CACHE);
assert.ok(preCollectReward!.rewardInfos[i].amountOwed.gtn(0));
await toTx(
ctx,
@ -406,19 +407,19 @@ describe("bundled position management tests", () => {
whirlpool: whirlpoolPubkey,
})
).buildAndExecute();
const postCollectReward = await ctx.fetcher.getPosition(bundledPositionPubkey, true);
const postCollectReward = await ctx.fetcher.getPosition(bundledPositionPubkey, IGNORE_CACHE);
assert.ok(postCollectReward!.rewardInfos[i].amountOwed.isZero());
}
// decreaseLiquidity
const withdrawAmounts = PoolUtil.getTokenAmountsFromLiquidity(
liquidityAmount,
(await ctx.fetcher.getPool(whirlpoolPubkey, true))!.sqrtPrice,
(await ctx.fetcher.getPool(whirlpoolPubkey, IGNORE_CACHE))!.sqrtPrice,
PriceMath.tickIndexToSqrtPriceX64(tickLowerIndex),
PriceMath.tickIndexToSqrtPriceX64(tickUpperIndex),
false
);
const preDecrease = await ctx.fetcher.getPosition(bundledPositionPubkey, true);
const preDecrease = await ctx.fetcher.getPosition(bundledPositionPubkey, IGNORE_CACHE);
assert.ok(preDecrease!.liquidity.eq(liquidityAmount));
await toTx(
ctx,
@ -428,7 +429,7 @@ describe("bundled position management tests", () => {
tokenMinB: withdrawAmounts.tokenB,
})
).buildAndExecute();
const postDecrease = await ctx.fetcher.getPosition(bundledPositionPubkey, true);
const postDecrease = await ctx.fetcher.getPosition(bundledPositionPubkey, IGNORE_CACHE);
assert.ok(postDecrease!.liquidity.isZero());
// close bundled position
@ -443,7 +444,7 @@ describe("bundled position management tests", () => {
receiver: ctx.wallet.publicKey,
})
).buildAndExecute();
const postClose = await ctx.fetcher.getPosition(bundledPositionPubkey, true);
const postClose = await ctx.fetcher.getPosition(bundledPositionPubkey, IGNORE_CACHE);
assert.ok(postClose === null);
});
@ -504,7 +505,7 @@ describe("bundled position management tests", () => {
const tokenOwnerAccountB = getAssociatedTokenAddressSync(poolInitInfo.tokenMintB, ctx.wallet.publicKey);
// initialized check (No data left over from previous opening)
const postOpen = await ctx.fetcher.getPosition(bundledPositionPubkey, true);
const postOpen = await ctx.fetcher.getPosition(bundledPositionPubkey, IGNORE_CACHE);
assert.ok(postOpen!.feeGrowthCheckpointA.isZero());
assert.ok(postOpen!.feeGrowthCheckpointB.isZero());
assert.ok(postOpen!.rewardInfos.every((r) => r.growthInsideCheckpoint.isZero()));
@ -526,12 +527,12 @@ describe("bundled position management tests", () => {
// increaseLiquidity
const depositAmounts = PoolUtil.getTokenAmountsFromLiquidity(
liquidityAmount,
(await ctx.fetcher.getPool(whirlpoolPubkey, true))!.sqrtPrice,
(await ctx.fetcher.getPool(whirlpoolPubkey, IGNORE_CACHE))!.sqrtPrice,
PriceMath.tickIndexToSqrtPriceX64(tickLowerIndex),
PriceMath.tickIndexToSqrtPriceX64(tickUpperIndex),
true
);
const preIncrease = await ctx.fetcher.getPosition(bundledPositionPubkey, true);
const preIncrease = await ctx.fetcher.getPosition(bundledPositionPubkey, IGNORE_CACHE);
assert.ok(preIncrease!.liquidity.isZero());
await toTx(
ctx,
@ -541,7 +542,7 @@ describe("bundled position management tests", () => {
tokenMaxB: depositAmounts.tokenB,
})
).buildAndExecute();
const postIncrease = await ctx.fetcher.getPosition(bundledPositionPubkey, true);
const postIncrease = await ctx.fetcher.getPosition(bundledPositionPubkey, IGNORE_CACHE);
assert.ok(postIncrease!.liquidity.eq(liquidityAmount));
// non-zero check
@ -554,13 +555,13 @@ describe("bundled position management tests", () => {
// decreaseLiquidity
const withdrawAmounts = PoolUtil.getTokenAmountsFromLiquidity(
liquidityAmount,
(await ctx.fetcher.getPool(whirlpoolPubkey, true))!.sqrtPrice,
(await ctx.fetcher.getPool(whirlpoolPubkey, IGNORE_CACHE))!.sqrtPrice,
PriceMath.tickIndexToSqrtPriceX64(tickLowerIndex),
PriceMath.tickIndexToSqrtPriceX64(tickUpperIndex),
false
);
const preDecrease = await ctx.fetcher.getPosition(bundledPositionPubkey, true);
const preDecrease = await ctx.fetcher.getPosition(bundledPositionPubkey, IGNORE_CACHE);
assert.ok(preDecrease!.liquidity.eq(liquidityAmount));
await toTx(
ctx,
@ -570,7 +571,7 @@ describe("bundled position management tests", () => {
tokenMinB: withdrawAmounts.tokenB,
})
).buildAndExecute();
const postDecrease = await ctx.fetcher.getPosition(bundledPositionPubkey, true);
const postDecrease = await ctx.fetcher.getPosition(bundledPositionPubkey, IGNORE_CACHE);
assert.ok(postDecrease!.liquidity.isZero());
// collectFees
@ -587,7 +588,7 @@ describe("bundled position management tests", () => {
whirlpool: whirlpoolPubkey,
})
).buildAndExecute();
const postCollectFees = await ctx.fetcher.getPosition(bundledPositionPubkey, true);
const postCollectFees = await ctx.fetcher.getPosition(bundledPositionPubkey, IGNORE_CACHE);
assert.ok(postCollectFees!.feeOwedA.isZero());
assert.ok(postCollectFees!.feeOwedB.isZero());
@ -599,7 +600,7 @@ describe("bundled position management tests", () => {
ctx.wallet.publicKey
);
const preCollectReward = await ctx.fetcher.getPosition(bundledPositionPubkey, true);
const preCollectReward = await ctx.fetcher.getPosition(bundledPositionPubkey, IGNORE_CACHE);
assert.ok(preCollectReward!.rewardInfos[i].amountOwed.gtn(0));
await toTx(
ctx,
@ -613,7 +614,7 @@ describe("bundled position management tests", () => {
whirlpool: whirlpoolPubkey,
})
).buildAndExecute();
const postCollectReward = await ctx.fetcher.getPosition(bundledPositionPubkey, true);
const postCollectReward = await ctx.fetcher.getPosition(bundledPositionPubkey, IGNORE_CACHE);
assert.ok(postCollectReward!.rewardInfos[i].amountOwed.isZero());
}
@ -629,7 +630,7 @@ describe("bundled position management tests", () => {
receiver: ctx.wallet.publicKey,
})
).buildAndExecute();
const postClose = await ctx.fetcher.getPosition(bundledPositionPubkey, true);
const postClose = await ctx.fetcher.getPosition(bundledPositionPubkey, IGNORE_CACHE);
assert.ok(postClose === null);
}
});
@ -675,7 +676,7 @@ describe("bundled position management tests", () => {
const depositAmounts = PoolUtil.getTokenAmountsFromLiquidity(
liquidityAmount,
(await ctx.fetcher.getPool(whirlpoolPubkey, true))!.sqrtPrice,
(await ctx.fetcher.getPool(whirlpoolPubkey, IGNORE_CACHE))!.sqrtPrice,
PriceMath.tickIndexToSqrtPriceX64(tickLowerIndex),
PriceMath.tickIndexToSqrtPriceX64(tickUpperIndex),
true
@ -701,12 +702,12 @@ describe("bundled position management tests", () => {
tokenMaxB: depositAmounts.tokenB,
}));
await openIncreaseBuilder.buildAndExecute();
const postIncrease = await ctx.fetcher.getPosition(bundledPositionPubkey, true);
const postIncrease = await ctx.fetcher.getPosition(bundledPositionPubkey, IGNORE_CACHE);
assert.ok(postIncrease!.liquidity.eq(liquidityAmount));
const withdrawAmounts = PoolUtil.getTokenAmountsFromLiquidity(
liquidityAmount,
(await ctx.fetcher.getPool(whirlpoolPubkey, true))!.sqrtPrice,
(await ctx.fetcher.getPool(whirlpoolPubkey, IGNORE_CACHE))!.sqrtPrice,
PriceMath.tickIndexToSqrtPriceX64(tickLowerIndex),
PriceMath.tickIndexToSqrtPriceX64(tickUpperIndex),
false
@ -728,7 +729,7 @@ describe("bundled position management tests", () => {
receiver: ctx.wallet.publicKey,
}));
await decreaseCloseBuilder.buildAndExecute();
const postClose = await ctx.fetcher.getPosition(bundledPositionPubkey, true);
const postClose = await ctx.fetcher.getPosition(bundledPositionPubkey, IGNORE_CACHE);
assert.ok(postClose === null);
});
@ -785,7 +786,7 @@ describe("bundled position management tests", () => {
const depositAmounts = PoolUtil.getTokenAmountsFromLiquidity(
liquidityAmount,
(await ctx.fetcher.getPool(whirlpoolPubkey, true))!.sqrtPrice,
(await ctx.fetcher.getPool(whirlpoolPubkey, IGNORE_CACHE))!.sqrtPrice,
PriceMath.tickIndexToSqrtPriceX64(tickLowerIndex),
PriceMath.tickIndexToSqrtPriceX64(tickUpperIndex),
true
@ -887,7 +888,7 @@ describe("bundled position management tests", () => {
// https://github.com/coral-xyz/anchor/pull/2169
// in Anchor v0.26.0, close & open in same Tx will success.
await builder.buildAndExecute();
const postReopen = await ctx.fetcher.getPosition(bundledPositionPubkey, true);
const postReopen = await ctx.fetcher.getPosition(bundledPositionPubkey, IGNORE_CACHE);
assert.ok(postReopen!.liquidity.isZero());
assert.ok(postReopen!.tickLowerIndex === tickLowerIndex + tickSpacing);
assert.ok(postReopen!.tickUpperIndex === tickUpperIndex + tickSpacing);
@ -949,7 +950,7 @@ describe("bundled position management tests", () => {
const depositAmounts = PoolUtil.getTokenAmountsFromLiquidity(
liquidityAmount,
(await ctx.fetcher.getPool(whirlpoolPubkey, true))!.sqrtPrice,
(await ctx.fetcher.getPool(whirlpoolPubkey, IGNORE_CACHE))!.sqrtPrice,
PriceMath.tickIndexToSqrtPriceX64(tickLowerIndex),
PriceMath.tickIndexToSqrtPriceX64(tickUpperIndex),
true
@ -1046,8 +1047,8 @@ describe("bundled position management tests", () => {
}));
await builder.buildAndExecute();
assert.ok((await ctx.fetcher.getTokenInfo(receiverAtaA, true))!.amount === BigInt(estimatedFee.toString()));
assert.ok((await ctx.fetcher.getTokenInfo(receiverAtaB, true))!.amount === BigInt(estimatedFee.toString()));
assert.ok((await ctx.fetcher.getTokenInfo(receiverAtaA, IGNORE_CACHE))!.amount === BigInt(estimatedFee.toString()));
assert.ok((await ctx.fetcher.getTokenInfo(receiverAtaB, IGNORE_CACHE))!.amount === BigInt(estimatedFee.toString()));
});
});

View File

@ -15,6 +15,7 @@ import {
WhirlpoolContext,
WhirlpoolIx
} from "../../src";
import { IGNORE_CACHE } from "../../src/network/public/fetcher";
import {
approveToken,
createAssociatedTokenAccount,
@ -146,7 +147,7 @@ describe("open_bundled_position", () => {
const position = (await fetcher.getPosition(bundledPositionPda.publicKey)) as PositionData;
checkPositionAccountContents(position, positionBundleInfo.positionBundleMintKeypair.publicKey);
const positionBundle = (await fetcher.getPositionBundle(positionBundleInfo.positionBundlePda.publicKey, true)) as PositionBundleData;
const positionBundle = (await fetcher.getPositionBundle(positionBundleInfo.positionBundlePda.publicKey, IGNORE_CACHE)) as PositionBundleData;
checkBitmap(positionBundle, [bundleIndex]);
});
@ -176,7 +177,7 @@ describe("open_bundled_position", () => {
const position = (await fetcher.getPosition(bundledPositionPda.publicKey)) as PositionData;
checkPositionAccountContents(position, positionBundleInfo.positionBundleMintKeypair.publicKey);
const positionBundle = (await fetcher.getPositionBundle(positionBundleInfo.positionBundlePda.publicKey, true)) as PositionBundleData;
const positionBundle = (await fetcher.getPositionBundle(positionBundleInfo.positionBundlePda.publicKey, IGNORE_CACHE)) as PositionBundleData;
checkBitmap(positionBundle, [bundleIndex]);
});
@ -199,7 +200,7 @@ describe("open_bundled_position", () => {
checkPositionAccountContents(position, positionBundleInfo.positionBundleMintKeypair.publicKey);
}
const positionBundle = (await fetcher.getPositionBundle(positionBundleInfo.positionBundlePda.publicKey, true)) as PositionBundleData;
const positionBundle = (await fetcher.getPositionBundle(positionBundleInfo.positionBundlePda.publicKey, IGNORE_CACHE)) as PositionBundleData;
checkBitmap(positionBundle, bundleIndexes);
});
@ -314,7 +315,7 @@ describe("open_bundled_position", () => {
tickUpperIndex
);
const positionBundle = (await fetcher.getPositionBundle(positionBundleInfo.positionBundlePda.publicKey, true)) as PositionBundleData;
const positionBundle = (await fetcher.getPositionBundle(positionBundleInfo.positionBundlePda.publicKey, IGNORE_CACHE)) as PositionBundleData;
assert.ok(checkBitmapIsOpened(positionBundle, bundleIndex));
await assert.rejects(
@ -500,7 +501,7 @@ describe("open_bundled_position", () => {
funderKeypair
);
await tx.buildAndExecute();
const positionBundle = await fetcher.getPositionBundle(positionBundleInfo.positionBundlePda.publicKey, true);
const positionBundle = await fetcher.getPositionBundle(positionBundleInfo.positionBundlePda.publicKey, IGNORE_CACHE);
checkBitmapIsOpened(positionBundle!, 0);
});
@ -523,7 +524,7 @@ describe("open_bundled_position", () => {
);
// owner can open even if delegation exists
await tx.buildAndExecute();
const positionBundle = await fetcher.getPositionBundle(positionBundleInfo.positionBundlePda.publicKey, true);
const positionBundle = await fetcher.getPositionBundle(positionBundleInfo.positionBundlePda.publicKey, IGNORE_CACHE);
checkBitmapIsOpened(positionBundle!, 0);
});
@ -577,7 +578,7 @@ describe("open_bundled_position", () => {
1
);
const tokenInfo = await fetcher.getTokenInfo(funderATA, true);
const tokenInfo = await fetcher.getTokenInfo(funderATA, IGNORE_CACHE);
assert.ok(tokenInfo?.amount === 1n);
const tx = toTx(
@ -597,7 +598,7 @@ describe("open_bundled_position", () => {
tx.addSigner(funderKeypair);
await tx.buildAndExecute();
const positionBundle = await fetcher.getPositionBundle(positionBundleInfo.positionBundlePda.publicKey, true);
const positionBundle = await fetcher.getPositionBundle(positionBundleInfo.positionBundlePda.publicKey, IGNORE_CACHE);
checkBitmapIsOpened(positionBundle!, 0);
});
});

View File

@ -1,6 +1,7 @@
import * as anchor from "@coral-xyz/anchor";
import * as assert from "assert";
import { toTx, WhirlpoolContext, WhirlpoolData, WhirlpoolIx } from "../../src";
import { IGNORE_CACHE } from "../../src/network/public/fetcher";
import { TickSpacing } from "../utils";
import { defaultConfirmOptions } from "../utils/const";
import { initTestPool } from "../utils/init-utils";
@ -24,7 +25,7 @@ describe("set_fee_rate", () => {
const newFeeRate = 50;
let whirlpool = (await fetcher.getPool(whirlpoolKey, true)) as WhirlpoolData;
let whirlpool = (await fetcher.getPool(whirlpoolKey, IGNORE_CACHE)) as WhirlpoolData;
assert.equal(whirlpool.feeRate, feeTierParams.defaultFeeRate);
@ -36,7 +37,7 @@ describe("set_fee_rate", () => {
})).addSigner(feeAuthorityKeypair);
await setFeeRateTx.buildAndExecute();
whirlpool = (await fetcher.getPool(poolInitInfo.whirlpoolPda.publicKey, true)) as WhirlpoolData;
whirlpool = (await fetcher.getPool(poolInitInfo.whirlpoolPda.publicKey, IGNORE_CACHE)) as WhirlpoolData;
assert.equal(whirlpool.feeRate, newFeeRate);
});

View File

@ -1,6 +1,7 @@
import * as anchor from "@coral-xyz/anchor";
import * as assert from "assert";
import { toTx, WhirlpoolContext, WhirlpoolData, WhirlpoolIx } from "../../src";
import { IGNORE_CACHE } from "../../src/network/public/fetcher";
import { TickSpacing } from "../utils";
import { defaultConfirmOptions } from "../utils/const";
import { initTestPool } from "../utils/init-utils";
@ -23,7 +24,7 @@ describe("set_protocol_fee_rate", () => {
const newProtocolFeeRate = 50;
let whirlpool = (await fetcher.getPool(whirlpoolKey, true)) as WhirlpoolData;
let whirlpool = (await fetcher.getPool(whirlpoolKey, IGNORE_CACHE)) as WhirlpoolData;
assert.equal(whirlpool.protocolFeeRate, configInitInfo.defaultProtocolFeeRate);
@ -35,7 +36,7 @@ describe("set_protocol_fee_rate", () => {
})).addSigner(feeAuthorityKeypair);
await txBuilder.buildAndExecute();
whirlpool = (await fetcher.getPool(poolInitInfo.whirlpoolPda.publicKey, true)) as WhirlpoolData;
whirlpool = (await fetcher.getPool(poolInitInfo.whirlpoolPda.publicKey, IGNORE_CACHE)) as WhirlpoolData;
assert.equal(whirlpool.protocolFeeRate, newProtocolFeeRate);
});

View File

@ -1,6 +1,7 @@
import * as anchor from "@coral-xyz/anchor";
import * as assert from "assert";
import { toTx, WhirlpoolContext, WhirlpoolData, WhirlpoolIx } from "../../src";
import { IGNORE_CACHE } from "../../src/network/public/fetcher";
import { createAndMintToTokenAccount, mintToDestination, TickSpacing, ZERO_BN } from "../utils";
import { defaultConfirmOptions } from "../utils/const";
import { initializeReward, initTestPool } from "../utils/init-utils";
@ -48,7 +49,7 @@ describe("set_reward_emissions", () => {
let whirlpool = (await fetcher.getPool(
poolInitInfo.whirlpoolPda.publicKey,
true
IGNORE_CACHE
)) as WhirlpoolData;
assert.ok(whirlpool.rewardInfos[0].emissionsPerSecondX64.eq(emissionsPerSecondX64));
@ -66,7 +67,7 @@ describe("set_reward_emissions", () => {
.addSigner(configKeypairs.rewardEmissionsSuperAuthorityKeypair)
.buildAndExecute();
whirlpool = (await fetcher.getPool(poolInitInfo.whirlpoolPda.publicKey, true)) as WhirlpoolData;
whirlpool = (await fetcher.getPool(poolInitInfo.whirlpoolPda.publicKey, IGNORE_CACHE)) as WhirlpoolData;
assert.ok(whirlpool.rewardInfos[0].emissionsPerSecondX64.eq(ZERO_BN));
});

View File

@ -19,6 +19,7 @@ import {
swapQuoteByInputToken,
toTx
} from "../../src";
import { IGNORE_CACHE } from "../../src/network/public/fetcher";
import { MAX_U64, TickSpacing, ZERO_BN, getTokenBalance } from "../utils";
import { defaultConfirmOptions } from "../utils/const";
import {
@ -551,7 +552,7 @@ describe("swap", () => {
const oraclePda = PDAUtil.getOracle(ctx.program.programId, whirlpoolPda.publicKey);
const whirlpoolKey = poolInitInfo.whirlpoolPda.publicKey;
const whirlpool = await client.getPool(whirlpoolKey, true);
const whirlpool = await client.getPool(whirlpoolKey, IGNORE_CACHE);
const whirlpoolData = whirlpool.getData();
const quote = await swapQuoteByInputToken(
whirlpool,
@ -560,7 +561,7 @@ describe("swap", () => {
Percentage.fromFraction(1, 100),
ctx.program.programId,
fetcher,
true
IGNORE_CACHE
);
await toTx(
@ -620,7 +621,7 @@ describe("swap", () => {
await fundPositions(ctx, poolInitInfo, tokenAccountA, tokenAccountB, initialParams);
const whirlpoolKey = poolInitInfo.whirlpoolPda.publicKey;
let whirlpool = await client.getPool(whirlpoolKey, true);
let whirlpool = await client.getPool(whirlpoolKey, IGNORE_CACHE);
let whirlpoolData = whirlpool.getData();
// Position covers the current price, so liquidity should be equal to the initial funded position
@ -636,7 +637,7 @@ describe("swap", () => {
await fundPositions(ctx, poolInitInfo, tokenAccountA, tokenAccountB, nextParams);
whirlpool = await client.getPool(whirlpoolKey, true);
whirlpool = await client.getPool(whirlpoolKey, IGNORE_CACHE);
whirlpoolData = whirlpool.getData();
// Whirlpool.currentTick is 91720, so the newly funded position's upper tick is not
// strictly less than 91720 so the liquidity is not added.
@ -651,7 +652,7 @@ describe("swap", () => {
Percentage.fromFraction(1, 100),
ctx.program.programId,
fetcher,
true
IGNORE_CACHE
);
await toTx(
@ -668,7 +669,7 @@ describe("swap", () => {
})
).buildAndExecute();
whirlpool = await client.getPool(whirlpoolKey, true);
whirlpool = await client.getPool(whirlpoolKey, IGNORE_CACHE);
whirlpoolData = whirlpool.getData();
// After the above swap, since the amount is so low, it is completely taken by fees
@ -686,7 +687,7 @@ describe("swap", () => {
Percentage.fromFraction(1, 100),
ctx.program.programId,
fetcher,
true
IGNORE_CACHE
);
await toTx(
@ -703,7 +704,7 @@ describe("swap", () => {
})
).buildAndExecute();
whirlpool = await client.getPool(whirlpoolKey, true);
whirlpool = await client.getPool(whirlpoolKey, IGNORE_CACHE);
whirlpoolData = whirlpool.getData();
// After the above swap, since the amount is so low, it is completely taken by fees
@ -747,7 +748,7 @@ describe("swap", () => {
await fundPositions(ctx, poolInitInfo, tokenAccountA, tokenAccountB, initialParams);
const whirlpoolKey = poolInitInfo.whirlpoolPda.publicKey;
let whirlpool = await client.getPool(whirlpoolKey, true);
let whirlpool = await client.getPool(whirlpoolKey, IGNORE_CACHE);
let whirlpoolData = whirlpool.getData();
// Position covers the current price, so liquidity should be equal to the initial funded position
@ -763,7 +764,7 @@ describe("swap", () => {
await fundPositions(ctx, poolInitInfo, tokenAccountA, tokenAccountB, nextParams);
whirlpool = await client.getPool(whirlpoolKey, true);
whirlpool = await client.getPool(whirlpoolKey, IGNORE_CACHE);
whirlpoolData = whirlpool.getData();
// Whirlpool.currentTick is 91720, so the newly funded position's upper tick is not
// strictly less than 91720 so the liquidity is not added.
@ -778,7 +779,7 @@ describe("swap", () => {
Percentage.fromFraction(1, 100),
ctx.program.programId,
fetcher,
true
IGNORE_CACHE
);
await toTx(
@ -795,7 +796,7 @@ describe("swap", () => {
})
).buildAndExecute();
whirlpool = await client.getPool(whirlpoolKey, true);
whirlpool = await client.getPool(whirlpoolKey, IGNORE_CACHE);
whirlpoolData = whirlpool.getData();
// After the above swap, since the amount is so low, it is completely taken by fees
@ -812,7 +813,7 @@ describe("swap", () => {
Percentage.fromFraction(1, 100),
ctx.program.programId,
fetcher,
true
IGNORE_CACHE
);
await toTx(
@ -829,7 +830,7 @@ describe("swap", () => {
})
).buildAndExecute();
whirlpool = await client.getPool(whirlpoolKey, true);
whirlpool = await client.getPool(whirlpoolKey, IGNORE_CACHE);
whirlpoolData = whirlpool.getData();
// After the above swap, there will be a small amount remaining that crosses

View File

@ -15,6 +15,7 @@ import {
WhirlpoolIx
} from "../../src";
import { TwoHopSwapParams } from "../../src/instructions";
import { IGNORE_CACHE } from "../../src/network/public/fetcher";
import { getTokenBalance, TickSpacing } from "../utils";
import { defaultConfirmOptions } from "../utils/const";
import {
@ -74,8 +75,8 @@ describe("two-hop swap", () => {
const whirlpoolOneKey = pools[0].whirlpoolPda.publicKey;
const whirlpoolTwoKey = pools[1].whirlpoolPda.publicKey;
const whirlpoolOne = await client.getPool(whirlpoolOneKey, true);
const whirlpoolTwo = await client.getPool(whirlpoolTwoKey, true);
const whirlpoolOne = await client.getPool(whirlpoolOneKey, IGNORE_CACHE);
const whirlpoolTwo = await client.getPool(whirlpoolTwoKey, IGNORE_CACHE);
const [inputToken, intermediaryToken, _outputToken] = mintKeys;
@ -86,7 +87,7 @@ describe("two-hop swap", () => {
Percentage.fromFraction(1, 100),
ctx.program.programId,
fetcher,
true
IGNORE_CACHE
);
const quote2 = await swapQuoteByInputToken(
@ -96,7 +97,7 @@ describe("two-hop swap", () => {
Percentage.fromFraction(1, 100),
ctx.program.programId,
fetcher,
true
IGNORE_CACHE
);
const twoHopQuote = twoHopSwapQuoteFromSwapQuotes(quote, quote2);
@ -224,8 +225,8 @@ describe("two-hop swap", () => {
const whirlpoolOneKey = pools[0].whirlpoolPda.publicKey;
const whirlpoolTwoKey = pools[1].whirlpoolPda.publicKey;
let whirlpoolOne = await client.getPool(whirlpoolOneKey, true);
let whirlpoolTwo = await client.getPool(whirlpoolTwoKey, true);
let whirlpoolOne = await client.getPool(whirlpoolOneKey, IGNORE_CACHE);
let whirlpoolTwo = await client.getPool(whirlpoolTwoKey, IGNORE_CACHE);
const [inputToken, intermediaryToken, _outputToken] = mintKeys;
@ -236,7 +237,7 @@ describe("two-hop swap", () => {
Percentage.fromFraction(1, 100),
ctx.program.programId,
fetcher,
true
IGNORE_CACHE
);
const quote2 = await swapQuoteByInputToken(
@ -246,7 +247,7 @@ describe("two-hop swap", () => {
Percentage.fromFraction(1, 100),
ctx.program.programId,
fetcher,
true
IGNORE_CACHE
);
const twoHopQuote = twoHopSwapQuoteFromSwapQuotes(quote, quote2);
@ -276,8 +277,8 @@ describe("two-hop swap", () => {
prevTbs[2].add(quote2.estimatedAmountOut),
]);
whirlpoolOne = await client.getPool(whirlpoolOneKey, true);
whirlpoolTwo = await client.getPool(whirlpoolTwoKey, true);
whirlpoolOne = await client.getPool(whirlpoolOneKey, IGNORE_CACHE);
whirlpoolTwo = await client.getPool(whirlpoolTwoKey, IGNORE_CACHE);
});
@ -309,8 +310,8 @@ describe("two-hop swap", () => {
const whirlpoolOneKey = pools[0].whirlpoolPda.publicKey;
const whirlpoolTwoKey = pools[1].whirlpoolPda.publicKey;
let whirlpoolOne = await client.getPool(whirlpoolOneKey, true);
let whirlpoolTwo = await client.getPool(whirlpoolTwoKey, true);
let whirlpoolOne = await client.getPool(whirlpoolOneKey, IGNORE_CACHE);
let whirlpoolTwo = await client.getPool(whirlpoolTwoKey, IGNORE_CACHE);
const [tokenA, tokenB, _outputToken] = mintKeys;
@ -321,7 +322,7 @@ describe("two-hop swap", () => {
Percentage.fromFraction(1, 100),
ctx.program.programId,
fetcher,
true
IGNORE_CACHE
);
const quote2 = await swapQuoteByInputToken(
@ -331,7 +332,7 @@ describe("two-hop swap", () => {
Percentage.fromFraction(1, 100),
ctx.program.programId,
fetcher,
true
IGNORE_CACHE
);
const twoHopQuote = twoHopSwapQuoteFromSwapQuotes(quote, quote2);
@ -368,8 +369,8 @@ describe("two-hop swap", () => {
const whirlpoolOneKey = pools[0].whirlpoolPda.publicKey;
const whirlpoolTwoKey = pools[1].whirlpoolPda.publicKey;
const whirlpoolOne = await client.getPool(whirlpoolOneKey, true);
const whirlpoolTwo = await client.getPool(whirlpoolTwoKey, true);
const whirlpoolOne = await client.getPool(whirlpoolOneKey, IGNORE_CACHE);
const whirlpoolTwo = await client.getPool(whirlpoolTwoKey, IGNORE_CACHE);
const [inputToken, intermediaryToken, _outputToken] = mintKeys;
@ -380,7 +381,7 @@ describe("two-hop swap", () => {
Percentage.fromFraction(1, 100),
ctx.program.programId,
fetcher,
true
IGNORE_CACHE
);
const quote2 = await swapQuoteByInputToken(
@ -390,7 +391,7 @@ describe("two-hop swap", () => {
Percentage.fromFraction(1, 100),
ctx.program.programId,
fetcher,
true
IGNORE_CACHE
);
const twoHopQuote = twoHopSwapQuoteFromSwapQuotes(quote, quote2);
@ -418,8 +419,8 @@ describe("two-hop swap", () => {
const whirlpoolOneKey = pools[0].whirlpoolPda.publicKey;
const whirlpoolTwoKey = pools[1].whirlpoolPda.publicKey;
const whirlpoolOne = await client.getPool(whirlpoolOneKey, true);
const whirlpoolTwo = await client.getPool(whirlpoolTwoKey, true);
const whirlpoolOne = await client.getPool(whirlpoolOneKey, IGNORE_CACHE);
const whirlpoolTwo = await client.getPool(whirlpoolTwoKey, IGNORE_CACHE);
const [_inputToken, intermediaryToken, outputToken] = mintKeys;
@ -430,7 +431,7 @@ describe("two-hop swap", () => {
Percentage.fromFraction(1, 100),
ctx.program.programId,
fetcher,
true
IGNORE_CACHE
);
const quote = await swapQuoteByOutputToken(
@ -440,7 +441,7 @@ describe("two-hop swap", () => {
Percentage.fromFraction(1, 100),
ctx.program.programId,
fetcher,
true
IGNORE_CACHE
);
const twoHopQuote = twoHopSwapQuoteFromSwapQuotes(quote, quote2);
@ -477,8 +478,8 @@ describe("two-hop swap", () => {
const whirlpoolOneKey = pools[0].whirlpoolPda.publicKey;
const whirlpoolTwoKey = pools[1].whirlpoolPda.publicKey;
const whirlpoolOne = await client.getPool(whirlpoolOneKey, true);
const whirlpoolTwo = await client.getPool(whirlpoolTwoKey, true);
const whirlpoolOne = await client.getPool(whirlpoolOneKey, IGNORE_CACHE);
const whirlpoolTwo = await client.getPool(whirlpoolTwoKey, IGNORE_CACHE);
const [_inputToken, intermediaryToken, outputToken] = mintKeys;
@ -489,7 +490,7 @@ describe("two-hop swap", () => {
Percentage.fromFraction(1, 100),
ctx.program.programId,
fetcher,
true
IGNORE_CACHE
);
const quote = await swapQuoteByOutputToken(
@ -499,7 +500,7 @@ describe("two-hop swap", () => {
Percentage.fromFraction(1, 100),
ctx.program.programId,
fetcher,
true
IGNORE_CACHE
);
const twoHopQuote = twoHopSwapQuoteFromSwapQuotes(quote, quote2);
@ -528,8 +529,8 @@ describe("two-hop swap", () => {
const whirlpoolOneKey = pools[0].whirlpoolPda.publicKey;
const whirlpoolTwoKey = pools[1].whirlpoolPda.publicKey;
const whirlpoolOne = await client.getPool(whirlpoolOneKey, true);
const whirlpoolTwo = await client.getPool(whirlpoolTwoKey, true);
const whirlpoolOne = await client.getPool(whirlpoolOneKey, IGNORE_CACHE);
const whirlpoolTwo = await client.getPool(whirlpoolTwoKey, IGNORE_CACHE);
const [_inputToken, intermediaryToken, outputToken] = mintKeys;
@ -540,7 +541,7 @@ describe("two-hop swap", () => {
Percentage.fromFraction(1, 100),
ctx.program.programId,
fetcher,
true
IGNORE_CACHE
);
const quote = await swapQuoteByOutputToken(
@ -550,7 +551,7 @@ describe("two-hop swap", () => {
Percentage.fromFraction(1, 100),
ctx.program.programId,
fetcher,
true
IGNORE_CACHE
);
const twoHopQuote = twoHopSwapQuoteFromSwapQuotes(quote, quote2);
@ -574,8 +575,8 @@ describe("two-hop swap", () => {
const whirlpoolOneKey = pools[0].whirlpoolPda.publicKey;
const whirlpoolTwoKey = pools[1].whirlpoolPda.publicKey;
let whirlpoolOne = await client.getPool(whirlpoolOneKey, true);
let whirlpoolTwo = await client.getPool(whirlpoolTwoKey, true);
let whirlpoolOne = await client.getPool(whirlpoolOneKey, IGNORE_CACHE);
let whirlpoolTwo = await client.getPool(whirlpoolTwoKey, IGNORE_CACHE);
const [inputToken, intermediaryToken, _outputToken] = mintKeys;
@ -586,7 +587,7 @@ describe("two-hop swap", () => {
Percentage.fromFraction(0, 100),
ctx.program.programId,
fetcher,
true
IGNORE_CACHE
);
const quote2 = await swapQuoteByInputToken(
@ -596,7 +597,7 @@ describe("two-hop swap", () => {
Percentage.fromFraction(1, 100),
ctx.program.programId,
fetcher,
true
IGNORE_CACHE
);
// Set a price limit that is less than the 1% slippage threshold,
@ -620,8 +621,8 @@ describe("two-hop swap", () => {
})
).buildAndExecute();
whirlpoolOne = await client.getPool(whirlpoolOneKey, true);
whirlpoolTwo = await client.getPool(whirlpoolTwoKey, true);
whirlpoolOne = await client.getPool(whirlpoolOneKey, IGNORE_CACHE);
whirlpoolTwo = await client.getPool(whirlpoolTwoKey, IGNORE_CACHE);
assert.equal(whirlpoolOne.getData().sqrtPrice.eq(quote.sqrtPriceLimit), true);
});
@ -633,8 +634,8 @@ describe("two-hop swap", () => {
const whirlpoolOneKey = pools[0].whirlpoolPda.publicKey;
const whirlpoolTwoKey = pools[1].whirlpoolPda.publicKey;
let whirlpoolOne = await client.getPool(whirlpoolOneKey, true);
let whirlpoolTwo = await client.getPool(whirlpoolTwoKey, true);
let whirlpoolOne = await client.getPool(whirlpoolOneKey, IGNORE_CACHE);
let whirlpoolTwo = await client.getPool(whirlpoolTwoKey, IGNORE_CACHE);
const [inputToken, intermediaryToken, _outputToken] = mintKeys;
@ -645,7 +646,7 @@ describe("two-hop swap", () => {
Percentage.fromFraction(0, 100),
ctx.program.programId,
fetcher,
true
IGNORE_CACHE
);
const quote2 = await swapQuoteByInputToken(
@ -655,7 +656,7 @@ describe("two-hop swap", () => {
Percentage.fromFraction(1, 100),
ctx.program.programId,
fetcher,
true
IGNORE_CACHE
);
// Set a price limit that is less than the 1% slippage threshold,
@ -679,8 +680,8 @@ describe("two-hop swap", () => {
})
).buildAndExecute();
whirlpoolOne = await client.getPool(whirlpoolOneKey, true);
whirlpoolTwo = await client.getPool(whirlpoolTwoKey, true);
whirlpoolOne = await client.getPool(whirlpoolOneKey, IGNORE_CACHE);
whirlpoolTwo = await client.getPool(whirlpoolTwoKey, IGNORE_CACHE);
assert.equal(whirlpoolTwo.getData().sqrtPrice.eq(quote2.sqrtPriceLimit), true);
});
@ -691,8 +692,8 @@ describe("two-hop swap", () => {
const whirlpoolOneKey = pools[0].whirlpoolPda.publicKey;
const whirlpoolTwoKey = pools[1].whirlpoolPda.publicKey;
let whirlpoolOne = await client.getPool(whirlpoolOneKey, true);
let whirlpoolTwo = await client.getPool(whirlpoolTwoKey, true);
let whirlpoolOne = await client.getPool(whirlpoolOneKey, IGNORE_CACHE);
let whirlpoolTwo = await client.getPool(whirlpoolTwoKey, IGNORE_CACHE);
const [inputToken, intermediaryToken, _outputToken] = mintKeys;
@ -703,7 +704,7 @@ describe("two-hop swap", () => {
Percentage.fromFraction(0, 100),
ctx.program.programId,
fetcher,
true
IGNORE_CACHE
);
const quote2 = await swapQuoteByInputToken(
@ -713,7 +714,7 @@ describe("two-hop swap", () => {
Percentage.fromFraction(1, 100),
ctx.program.programId,
fetcher,
true
IGNORE_CACHE
);
// Set a price limit that is less than the 1% slippage threshold,
@ -747,8 +748,8 @@ describe("two-hop swap", () => {
const whirlpoolOneKey = pools[0].whirlpoolPda.publicKey;
const whirlpoolTwoKey = pools[1].whirlpoolPda.publicKey;
let whirlpoolOne = await client.getPool(whirlpoolOneKey, true);
let whirlpoolTwo = await client.getPool(whirlpoolTwoKey, true);
let whirlpoolOne = await client.getPool(whirlpoolOneKey, IGNORE_CACHE);
let whirlpoolTwo = await client.getPool(whirlpoolTwoKey, IGNORE_CACHE);
const [inputToken, intermediaryToken, _outputToken] = mintKeys;
@ -759,7 +760,7 @@ describe("two-hop swap", () => {
Percentage.fromFraction(0, 100),
ctx.program.programId,
fetcher,
true
IGNORE_CACHE
);
const quote2 = await swapQuoteByInputToken(
@ -769,7 +770,7 @@ describe("two-hop swap", () => {
Percentage.fromFraction(1, 100),
ctx.program.programId,
fetcher,
true
IGNORE_CACHE
);
// Set a price limit that is greater than the 1% slippage threshold,

View File

@ -4,6 +4,7 @@ import * as assert from "assert";
import { BN } from "bn.js";
import Decimal from "decimal.js";
import { PDAUtil, PositionData, toTx, WhirlpoolContext, WhirlpoolIx } from "../../src";
import { IGNORE_CACHE } from "../../src/network/public/fetcher";
import { sleep, TickSpacing, ZERO_BN } from "../utils";
import { defaultConfirmOptions } from "../utils/const";
import { WhirlpoolTestFixture } from "../utils/fixture";
@ -40,7 +41,7 @@ describe("update_fees_and_rewards", () => {
const positionBefore = (await fetcher.getPosition(
positions[0].publicKey,
true
IGNORE_CACHE
)) as PositionData;
assert.ok(positionBefore.feeGrowthCheckpointA.eq(ZERO_BN));
assert.ok(positionBefore.feeGrowthCheckpointB.eq(ZERO_BN));
@ -81,7 +82,7 @@ describe("update_fees_and_rewards", () => {
tickArrayUpper: tickArrayPda.publicKey,
})
).buildAndExecute();
const positionAfter = (await fetcher.getPosition(positions[0].publicKey, true)) as PositionData;
const positionAfter = (await fetcher.getPosition(positions[0].publicKey, IGNORE_CACHE)) as PositionData;
assert.ok(positionAfter.feeOwedA.gt(positionBefore.feeOwedA));
assert.ok(positionAfter.feeOwedB.eq(ZERO_BN));
assert.ok(positionAfter.feeGrowthCheckpointA.gt(positionBefore.feeGrowthCheckpointA));

View File

@ -14,6 +14,7 @@ import {
collectFeesQuote,
toTx
} from "../../../src";
import { IGNORE_CACHE } from "../../../src/network/public/fetcher";
import { TickSpacing, ZERO_BN } from "../../utils";
import { defaultConfirmOptions } from "../../utils/const";
import { WhirlpoolTestFixture } from "../../utils/fixture";
@ -142,7 +143,7 @@ describe("PositionImpl#collectFees()", () => {
const positionDataBefore = await testCtx.whirlpoolCtx.fetcher.getPosition(
position.getAddress(),
true
IGNORE_CACHE
);
const otherWallet = anchor.web3.Keypair.generate();
@ -167,24 +168,24 @@ describe("PositionImpl#collectFees()", () => {
otherWallet.publicKey,
testCtx.provider.wallet.publicKey,
testCtx.provider.wallet.publicKey,
true
IGNORE_CACHE
);
await tx.buildAndExecute();
const positionDataAfter = await testCtx.whirlpoolCtx.fetcher.getPosition(
position.getAddress(),
true
IGNORE_CACHE
);
assert.notEqual(positionDataAfter, null);
const accountAPubkey = getAssociatedTokenAddressSync(poolInitInfo.tokenMintA, otherWallet.publicKey);
const accountA = await testCtx.whirlpoolCtx.fetcher.getTokenInfo(accountAPubkey, true);
const accountA = await testCtx.whirlpoolCtx.fetcher.getTokenInfo(accountAPubkey, IGNORE_CACHE);
assert.ok(accountA && new BN(accountA.amount.toString()).eq(quote.feeOwedA));
const accountBPubkey = getAssociatedTokenAddressSync(poolInitInfo.tokenMintB, otherWallet.publicKey);
const accountB = await testCtx.whirlpoolCtx.fetcher.getTokenInfo(accountBPubkey, true);
const accountB = await testCtx.whirlpoolCtx.fetcher.getTokenInfo(accountBPubkey, IGNORE_CACHE);
assert.ok(accountB && new BN(accountB.amount.toString()).eq(quote.feeOwedB));
});
});
@ -208,7 +209,7 @@ describe("PositionImpl#collectFees()", () => {
const positionDataBefore = await testCtx.whirlpoolCtx.fetcher.getPosition(
position.getAddress(),
true
IGNORE_CACHE
);
const otherWallet = anchor.web3.Keypair.generate();
@ -234,14 +235,14 @@ describe("PositionImpl#collectFees()", () => {
otherWallet.publicKey,
testCtx.provider.wallet.publicKey,
testCtx.provider.wallet.publicKey,
true
IGNORE_CACHE
);
await tx.addSigner(otherWallet).buildAndExecute();
const positionDataAfter = await testCtx.whirlpoolCtx.fetcher.getPosition(
position.getAddress(),
true
IGNORE_CACHE
);
assert.notEqual(positionDataAfter, null);
@ -254,7 +255,7 @@ describe("PositionImpl#collectFees()", () => {
);
const accountBPubkey = getAssociatedTokenAddressSync(poolInitInfo.tokenMintB, otherWallet.publicKey);
const accountB = await testCtx.whirlpoolCtx.fetcher.getTokenInfo(accountBPubkey, true);
const accountB = await testCtx.whirlpoolCtx.fetcher.getTokenInfo(accountBPubkey, IGNORE_CACHE);
assert.ok(accountB && new BN(accountB.amount.toString()).eq(quote.feeOwedB));
});
});

View File

@ -12,6 +12,7 @@ import {
buildWhirlpoolClient,
collectRewardsQuote
} from "../../../src";
import { IGNORE_CACHE } from "../../../src/network/public/fetcher";
import { TickSpacing, sleep } from "../../utils";
import { defaultConfirmOptions } from "../../utils/const";
import { WhirlpoolTestFixture } from "../../utils/fixture";
@ -71,8 +72,8 @@ describe("PositionImpl#collectRewards()", () => {
const { positions, poolInitInfo, rewards } = fixture.getInfos();
const pool = await testCtx.whirlpoolClient.getPool(poolInitInfo.whirlpoolPda.publicKey, true);
const position = await testCtx.whirlpoolClient.getPosition(positions[0].publicKey, true);
const pool = await testCtx.whirlpoolClient.getPool(poolInitInfo.whirlpoolPda.publicKey, IGNORE_CACHE);
const position = await testCtx.whirlpoolClient.getPosition(positions[0].publicKey, IGNORE_CACHE);
const otherWallet = anchor.web3.Keypair.generate();
const preCollectPoolData = pool.getData();
@ -88,7 +89,7 @@ describe("PositionImpl#collectRewards()", () => {
otherWallet.publicKey,
testCtx.provider.wallet.publicKey,
testCtx.provider.wallet.publicKey,
true
IGNORE_CACHE
)
).buildAndExecute();
@ -109,7 +110,7 @@ describe("PositionImpl#collectRewards()", () => {
for (let i = 0; i < NUM_REWARDS; i++) {
const rewardATA = getAssociatedTokenAddressSync(rewards[i].rewardMint, otherWallet.publicKey);
const rewardTokenAccount = await testCtx.whirlpoolCtx.fetcher.getTokenInfo(rewardATA, true);
const rewardTokenAccount = await testCtx.whirlpoolCtx.fetcher.getTokenInfo(rewardATA, IGNORE_CACHE);
assert.equal(rewardTokenAccount?.amount.toString(), quote[i]?.toString());
}
});
@ -141,8 +142,8 @@ describe("PositionImpl#collectRewards()", () => {
const { positions, poolInitInfo, rewards } = fixture.getInfos();
const pool = await testCtx.whirlpoolClient.getPool(poolInitInfo.whirlpoolPda.publicKey, true);
const position = await testCtx.whirlpoolClient.getPosition(positions[0].publicKey, true);
const pool = await testCtx.whirlpoolClient.getPool(poolInitInfo.whirlpoolPda.publicKey, IGNORE_CACHE);
const position = await testCtx.whirlpoolClient.getPosition(positions[0].publicKey, IGNORE_CACHE);
const otherWallet = anchor.web3.Keypair.generate();
const preCollectPoolData = pool.getData();
@ -157,7 +158,7 @@ describe("PositionImpl#collectRewards()", () => {
otherWallet.publicKey,
testCtx.provider.wallet.publicKey,
testCtx.provider.wallet.publicKey,
true
IGNORE_CACHE
)
).buildAndExecute();
@ -178,7 +179,7 @@ describe("PositionImpl#collectRewards()", () => {
for (let i = 0; i < NUM_REWARDS; i++) {
const rewardATA = getAssociatedTokenAddressSync(rewards[i].rewardMint, otherWallet.publicKey);
const rewardTokenAccount = await testCtx.whirlpoolCtx.fetcher.getTokenInfo(rewardATA, true);
const rewardTokenAccount = await testCtx.whirlpoolCtx.fetcher.getTokenInfo(rewardATA, IGNORE_CACHE);
assert.equal(rewardTokenAccount?.amount.toString(), quote[i]?.toString());
}
});

View File

@ -10,6 +10,7 @@ import {
PriceMath
} from "../../../src";
import { WhirlpoolContext } from "../../../src/context";
import { IGNORE_CACHE } from "../../../src/network/public/fetcher";
import { createAssociatedTokenAccount, TickSpacing, transferToken } from "../../utils";
import { defaultConfirmOptions } from "../../utils/const";
import { initTestPool } from "../../utils/init-utils";
@ -68,7 +69,7 @@ describe("position-impl", () => {
);
// [Action] Increase liquidity by 70 tokens of tokenB
const position = await client.getPosition(positionAddress.publicKey, true);
const position = await client.getPosition(positionAddress.publicKey, IGNORE_CACHE);
const preIncreaseData = position.getData();
const increase_quote = increaseLiquidityQuoteByInputToken(
poolInitInfo.tokenMintB,
@ -152,7 +153,7 @@ describe("position-impl", () => {
);
// [Action] Increase liquidity by 70 tokens of tokenB & create the ATA in the new source Wallet
const position = await client.getPosition(positionAddress.publicKey, true);
const position = await client.getPosition(positionAddress.publicKey, IGNORE_CACHE);
const preIncreaseData = position.getData();
const increase_quote = increaseLiquidityQuoteByInputToken(
poolInitInfo.tokenMintB,

View File

@ -12,6 +12,7 @@ import {
swapQuoteWithParams
} from "../../../../src";
import { SwapErrorCode, WhirlpoolsError } from "../../../../src/errors/errors";
import { IGNORE_CACHE } from "../../../../src/network/public/fetcher";
import { adjustForSlippage } from "../../../../src/utils/position-util";
import { TickSpacing } from "../../../utils";
import { defaultConfirmOptions } from "../../../utils/const";
@ -63,7 +64,7 @@ describe("swap arrays test", () => {
slippageTolerance,
ctx.program.programId,
fetcher,
true
IGNORE_CACHE
);
// Verify with an actual swap.
@ -115,7 +116,7 @@ describe("swap arrays test", () => {
slippageTolerance,
ctx.program.programId,
fetcher,
true
IGNORE_CACHE
),
(err: Error) => err.message.indexOf(expectedError) != -1
);
@ -152,7 +153,7 @@ describe("swap arrays test", () => {
slippageTolerance,
ctx.program.programId,
fetcher,
true
IGNORE_CACHE
);
// Verify with an actual swap.
@ -204,7 +205,7 @@ describe("swap arrays test", () => {
slippageTolerance,
ctx.program.programId,
fetcher,
true
IGNORE_CACHE
),
(err: Error) => err.message.indexOf(expectedError) != -1
);
@ -241,7 +242,7 @@ describe("swap arrays test", () => {
slippageTolerance,
ctx.program.programId,
fetcher,
true
IGNORE_CACHE
);
// Verify with an actual swap.
@ -291,7 +292,7 @@ describe("swap arrays test", () => {
slippageTolerance,
ctx.program.programId,
fetcher,
true
IGNORE_CACHE
);
// Verify with an actual swap.
@ -341,7 +342,7 @@ describe("swap arrays test", () => {
ctx.program.programId,
whirlpool.getAddress(),
fetcher,
true
IGNORE_CACHE
);
assert.throws(
() =>
@ -392,7 +393,7 @@ describe("swap arrays test", () => {
ctx.program.programId,
whirlpool.getAddress(),
fetcher,
true
IGNORE_CACHE
);
assert.throws(
() =>
@ -442,7 +443,7 @@ describe("swap arrays test", () => {
ctx.program.programId,
whirlpool.getAddress(),
fetcher,
true
IGNORE_CACHE
);
assert.throws(
() =>
@ -492,7 +493,7 @@ describe("swap arrays test", () => {
ctx.program.programId,
whirlpool.getAddress(),
fetcher,
true
IGNORE_CACHE
);
assert.throws(

View File

@ -3,7 +3,7 @@ import { Address } from "@coral-xyz/anchor";
import { Percentage } from "@orca-so/common-sdk";
import { Keypair } from "@solana/web3.js";
import * as assert from "assert";
import { BN } from "bn.js";
import BN from "bn.js";
import {
buildWhirlpoolClient, PriceMath,
swapQuoteByInputToken,
@ -11,6 +11,7 @@ import {
WhirlpoolContext
} from "../../../../src";
import { SwapErrorCode, WhirlpoolsError } from "../../../../src/errors/errors";
import { IGNORE_CACHE } from "../../../../src/network/public/fetcher";
import { swapQuoteByInputTokenWithDevFees } from "../../../../src/quotes/public/dev-fee-swap-quote";
import {
assertDevFeeQuotes,
@ -70,7 +71,7 @@ describe("whirlpool-dev-fee-swap", () => {
slippageTolerance,
ctx.program.programId,
ctx.fetcher,
true
IGNORE_CACHE
);
const postFeeInputTokenQuote = await swapQuoteByInputToken(
whirlpool,
@ -79,7 +80,7 @@ describe("whirlpool-dev-fee-swap", () => {
slippageTolerance,
ctx.program.programId,
ctx.fetcher,
true
IGNORE_CACHE
);
const inputTokenQuoteWithDevFees = await swapQuoteByInputTokenWithDevFees(
whirlpool,
@ -89,7 +90,7 @@ describe("whirlpool-dev-fee-swap", () => {
ctx.program.programId,
ctx.fetcher,
devFeePercentage,
true
IGNORE_CACHE
);
assertDevFeeQuotes(inputTokenQuote, postFeeInputTokenQuote, inputTokenQuoteWithDevFees);
await (
@ -385,7 +386,7 @@ describe("whirlpool-dev-fee-swap", () => {
ctx.program.programId,
ctx.fetcher,
devFeePercentage,
true
IGNORE_CACHE
),
(err) => (err as WhirlpoolsError).errorCode === SwapErrorCode.InvalidDevFeePercentage
);
@ -425,7 +426,7 @@ describe("whirlpool-dev-fee-swap", () => {
ctx.program.programId,
ctx.fetcher,
devFeePercentage,
true
IGNORE_CACHE
),
(err) => (err as WhirlpoolsError).errorCode === SwapErrorCode.InvalidDevFeePercentage
);
@ -448,7 +449,7 @@ async function getQuotes(
slippageTolerance,
ctx.program.programId,
ctx.fetcher,
true
IGNORE_CACHE
);
const postFeeInputTokenQuote = await swapQuoteByInputToken(
whirlpool,
@ -457,7 +458,7 @@ async function getQuotes(
slippageTolerance,
ctx.program.programId,
ctx.fetcher,
true
IGNORE_CACHE
);
const inputTokenQuoteWithDevFees = await swapQuoteByInputTokenWithDevFees(
whirlpool,
@ -467,7 +468,7 @@ async function getQuotes(
ctx.program.programId,
ctx.fetcher,
devFeePercentage,
true
IGNORE_CACHE
);
return { inputTokenQuote, postFeeInputTokenQuote, inputTokenQuoteWithDevFees };

View File

@ -10,6 +10,7 @@ import {
WhirlpoolContext
} from "../../../../src";
import { SwapErrorCode, WhirlpoolsError } from "../../../../src/errors/errors";
import { IGNORE_CACHE } from "../../../../src/network/public/fetcher";
import { assertInputOutputQuoteEqual, assertQuoteAndResults, TickSpacing } from "../../../utils";
import { defaultConfirmOptions } from "../../../utils/const";
import {
@ -68,7 +69,7 @@ describe("swap traversal tests", () => {
slippageTolerance,
ctx.program.programId,
fetcher,
true
IGNORE_CACHE
);
const outputTokenQuote = await swapQuoteByOutputToken(
@ -78,7 +79,7 @@ describe("swap traversal tests", () => {
slippageTolerance,
ctx.program.programId,
fetcher,
true
IGNORE_CACHE
);
assertInputOutputQuoteEqual(inputTokenQuote, outputTokenQuote);
@ -131,7 +132,7 @@ describe("swap traversal tests", () => {
slippageTolerance,
ctx.program.programId,
fetcher,
true
IGNORE_CACHE
);
const outputTokenQuote = await swapQuoteByOutputToken(
whirlpool,
@ -140,7 +141,7 @@ describe("swap traversal tests", () => {
slippageTolerance,
ctx.program.programId,
fetcher,
true
IGNORE_CACHE
);
assertInputOutputQuoteEqual(inputTokenQuote, outputTokenQuote);
@ -190,7 +191,7 @@ describe("swap traversal tests", () => {
slippageTolerance,
ctx.program.programId,
fetcher,
true
IGNORE_CACHE
);
const outputTokenQuote = await swapQuoteByOutputToken(
whirlpool,
@ -199,7 +200,7 @@ describe("swap traversal tests", () => {
slippageTolerance,
ctx.program.programId,
fetcher,
true
IGNORE_CACHE
);
assertInputOutputQuoteEqual(inputTokenQuote, outputTokenQuote);
await (await whirlpool.swap(inputTokenQuote)).buildAndExecute();
@ -248,7 +249,7 @@ describe("swap traversal tests", () => {
slippageTolerance,
ctx.program.programId,
fetcher,
true
IGNORE_CACHE
);
const outputTokenQuote = await swapQuoteByOutputToken(
whirlpool,
@ -257,7 +258,7 @@ describe("swap traversal tests", () => {
slippageTolerance,
ctx.program.programId,
fetcher,
true
IGNORE_CACHE
);
assertInputOutputQuoteEqual(inputTokenQuote, outputTokenQuote);
await (await whirlpool.swap(inputTokenQuote)).buildAndExecute();
@ -309,7 +310,7 @@ describe("swap traversal tests", () => {
slippageTolerance,
ctx.program.programId,
fetcher,
true
IGNORE_CACHE
);
const outputTokenQuote = await swapQuoteByOutputToken(
whirlpool,
@ -318,7 +319,7 @@ describe("swap traversal tests", () => {
slippageTolerance,
ctx.program.programId,
fetcher,
true
IGNORE_CACHE
);
assertInputOutputQuoteEqual(inputTokenQuote, outputTokenQuote);
await (await whirlpool.swap(inputTokenQuote)).buildAndExecute();
@ -367,7 +368,7 @@ describe("swap traversal tests", () => {
slippageTolerance,
ctx.program.programId,
fetcher,
true
IGNORE_CACHE
);
const outputTokenQuote = await swapQuoteByOutputToken(
whirlpool,
@ -376,7 +377,7 @@ describe("swap traversal tests", () => {
slippageTolerance,
ctx.program.programId,
fetcher,
true
IGNORE_CACHE
);
assertInputOutputQuoteEqual(inputTokenQuote, outputTokenQuote);
await (await whirlpool.swap(inputTokenQuote)).buildAndExecute();
@ -425,7 +426,7 @@ describe("swap traversal tests", () => {
slippageTolerance,
ctx.program.programId,
fetcher,
true
IGNORE_CACHE
);
const outputTokenQuote = await swapQuoteByOutputToken(
whirlpool,
@ -434,7 +435,7 @@ describe("swap traversal tests", () => {
slippageTolerance,
ctx.program.programId,
fetcher,
true
IGNORE_CACHE
);
assertInputOutputQuoteEqual(inputTokenQuote, outputTokenQuote);
await (await whirlpool.swap(inputTokenQuote)).buildAndExecute();
@ -483,7 +484,7 @@ describe("swap traversal tests", () => {
slippageTolerance,
ctx.program.programId,
fetcher,
true
IGNORE_CACHE
);
const outputTokenQuote = await swapQuoteByOutputToken(
whirlpool,
@ -492,7 +493,7 @@ describe("swap traversal tests", () => {
slippageTolerance,
ctx.program.programId,
fetcher,
true
IGNORE_CACHE
);
assertInputOutputQuoteEqual(inputTokenQuote, outputTokenQuote);
await (await whirlpool.swap(inputTokenQuote)).buildAndExecute();
@ -541,7 +542,7 @@ describe("swap traversal tests", () => {
slippageTolerance,
ctx.program.programId,
fetcher,
true
IGNORE_CACHE
);
const outputTokenQuote = await swapQuoteByOutputToken(
whirlpool,
@ -550,7 +551,7 @@ describe("swap traversal tests", () => {
slippageTolerance,
ctx.program.programId,
fetcher,
true
IGNORE_CACHE
);
assertInputOutputQuoteEqual(inputTokenQuote, outputTokenQuote);
await (await whirlpool.swap(inputTokenQuote)).buildAndExecute();
@ -599,7 +600,7 @@ describe("swap traversal tests", () => {
slippageTolerance,
ctx.program.programId,
fetcher,
true
IGNORE_CACHE
);
const outputTokenQuote = await swapQuoteByOutputToken(
whirlpool,
@ -608,7 +609,7 @@ describe("swap traversal tests", () => {
slippageTolerance,
ctx.program.programId,
fetcher,
true
IGNORE_CACHE
);
assertInputOutputQuoteEqual(inputTokenQuote, outputTokenQuote);
await (await whirlpool.swap(inputTokenQuote)).buildAndExecute();
@ -650,7 +651,7 @@ describe("swap traversal tests", () => {
slippageTolerance,
ctx.program.programId,
fetcher,
true
IGNORE_CACHE
);
const outputTokenQuote = await swapQuoteByOutputToken(
whirlpool,
@ -659,7 +660,7 @@ describe("swap traversal tests", () => {
slippageTolerance,
ctx.program.programId,
fetcher,
true
IGNORE_CACHE
);
assertInputOutputQuoteEqual(inputTokenQuote, outputTokenQuote);
await (await whirlpool.swap(inputTokenQuote)).buildAndExecute();
@ -701,7 +702,7 @@ describe("swap traversal tests", () => {
slippageTolerance,
ctx.program.programId,
fetcher,
true
IGNORE_CACHE
);
const outputTokenQuote = await swapQuoteByOutputToken(
whirlpool,
@ -710,7 +711,7 @@ describe("swap traversal tests", () => {
slippageTolerance,
ctx.program.programId,
fetcher,
true
IGNORE_CACHE
);
assertInputOutputQuoteEqual(inputTokenQuote, outputTokenQuote);
await (await whirlpool.swap(inputTokenQuote)).buildAndExecute();
@ -752,7 +753,7 @@ describe("swap traversal tests", () => {
slippageTolerance,
ctx.program.programId,
fetcher,
true
IGNORE_CACHE
);
const outputTokenQuote = await swapQuoteByOutputToken(
whirlpool,
@ -761,7 +762,7 @@ describe("swap traversal tests", () => {
slippageTolerance,
ctx.program.programId,
fetcher,
true
IGNORE_CACHE
);
assertInputOutputQuoteEqual(inputTokenQuote, outputTokenQuote);
await (await whirlpool.swap(inputTokenQuote)).buildAndExecute();
@ -803,7 +804,7 @@ describe("swap traversal tests", () => {
slippageTolerance,
ctx.program.programId,
fetcher,
true
IGNORE_CACHE
);
const outputTokenQuote = await swapQuoteByOutputToken(
whirlpool,
@ -812,7 +813,7 @@ describe("swap traversal tests", () => {
slippageTolerance,
ctx.program.programId,
fetcher,
true
IGNORE_CACHE
);
assertInputOutputQuoteEqual(inputTokenQuote, outputTokenQuote);
await (await whirlpool.swap(inputTokenQuote)).buildAndExecute();
@ -884,7 +885,7 @@ describe("swap traversal tests", () => {
slippageTolerance,
ctx.program.programId,
fetcher,
true
IGNORE_CACHE
);
const outputTokenQuote = await swapQuoteByOutputToken(
whirlpool,
@ -893,7 +894,7 @@ describe("swap traversal tests", () => {
slippageTolerance,
ctx.program.programId,
fetcher,
true
IGNORE_CACHE
);
assertInputOutputQuoteEqual(inputTokenQuote, outputTokenQuote);
await (await whirlpool.swap(inputTokenQuote)).buildAndExecute();
@ -964,7 +965,7 @@ describe("swap traversal tests", () => {
slippageTolerance,
ctx.program.programId,
fetcher,
true
IGNORE_CACHE
);
const outputTokenQuote = await swapQuoteByOutputToken(
whirlpool,
@ -973,7 +974,7 @@ describe("swap traversal tests", () => {
slippageTolerance,
ctx.program.programId,
fetcher,
true
IGNORE_CACHE
);
assertInputOutputQuoteEqual(inputTokenQuote, outputTokenQuote);
await (await whirlpool.swap(inputTokenQuote)).buildAndExecute();
@ -1016,8 +1017,7 @@ describe("swap traversal tests", () => {
slippageTolerance,
ctx.program.programId,
fetcher,
true
IGNORE_CACHE
),
(err) => {
const whirlErr = err as WhirlpoolsError;
@ -1064,8 +1064,7 @@ describe("swap traversal tests", () => {
slippageTolerance,
ctx.program.programId,
fetcher,
true
IGNORE_CACHE
),
(err) => {
const whirlErr = err as WhirlpoolsError;
@ -1112,7 +1111,7 @@ describe("swap traversal tests", () => {
slippageTolerance,
ctx.program.programId,
fetcher,
true
IGNORE_CACHE
);
await (await whirlpool.swap(quote)).buildAndExecute();
@ -1154,7 +1153,7 @@ describe("swap traversal tests", () => {
slippageTolerance,
ctx.program.programId,
fetcher,
true
IGNORE_CACHE
);
await (await whirlpool.swap(quote)).buildAndExecute();
@ -1197,7 +1196,7 @@ describe("swap traversal tests", () => {
slippageTolerance,
ctx.program.programId,
fetcher,
true
IGNORE_CACHE
);
const ta2StartTickIndex = 11264
assert.ok(inputTokenQuote.estimatedEndTickIndex > ta2StartTickIndex); // traverse ta0, ta1, and ta2
@ -1209,7 +1208,7 @@ describe("swap traversal tests", () => {
slippageTolerance,
ctx.program.programId,
fetcher,
true
IGNORE_CACHE
);
assertInputOutputQuoteEqual(inputTokenQuote, outputTokenQuote);
await (await whirlpool.swap(inputTokenQuote)).buildAndExecute();
@ -1253,7 +1252,7 @@ describe("swap traversal tests", () => {
slippageTolerance,
ctx.program.programId,
fetcher,
true
IGNORE_CACHE
);
const ta2StartTickIndex = 11264
assert.ok(inputTokenQuote.estimatedEndTickIndex > ta2StartTickIndex); // traverse ta0, ta1, and ta2
@ -1265,7 +1264,7 @@ describe("swap traversal tests", () => {
slippageTolerance,
ctx.program.programId,
fetcher,
true
IGNORE_CACHE
);
assertInputOutputQuoteEqual(inputTokenQuote, outputTokenQuote);
await (await whirlpool.swap(inputTokenQuote)).buildAndExecute();
@ -1309,7 +1308,7 @@ describe("swap traversal tests", () => {
slippageTolerance,
ctx.program.programId,
fetcher,
true
IGNORE_CACHE
);
const ta2StartTickIndex = 11264
assert.ok(inputTokenQuote.estimatedEndTickIndex > ta2StartTickIndex); // traverse ta0, ta1, and ta2
@ -1321,7 +1320,7 @@ describe("swap traversal tests", () => {
slippageTolerance,
ctx.program.programId,
fetcher,
true
IGNORE_CACHE
);
assertInputOutputQuoteEqual(inputTokenQuote, outputTokenQuote);
await (await whirlpool.swap(inputTokenQuote)).buildAndExecute();
@ -1363,7 +1362,7 @@ describe("swap traversal tests", () => {
ctx.program.programId,
whirlpool.getAddress(),
fetcher,
true
IGNORE_CACHE
);
assert.throws(
() =>
@ -1415,7 +1414,7 @@ describe("swap traversal tests", () => {
ctx.program.programId,
whirlpool.getAddress(),
fetcher,
true
IGNORE_CACHE
);
assert.throws(
() =>

View File

@ -9,6 +9,7 @@ import {
TickUtil,
WhirlpoolContext
} from "../../../src";
import { IGNORE_CACHE } from "../../../src/network/public/fetcher";
import { ONE_SOL, systemTransferTx, TickSpacing } from "../../utils";
import { defaultConfirmOptions } from "../../utils/const";
import { buildTestPoolParams } from "../../utils/init-utils";
@ -69,8 +70,8 @@ describe("whirlpool-client-impl", () => {
assert.ok(expectedPda.publicKey.equals(actualPubkey));
const [whirlpoolAccountBefore, tickArrayAccountBefore] = await Promise.all([
ctx.fetcher.getPool(expectedPda.publicKey, true),
ctx.fetcher.getTickArray(startTickArrayPda.publicKey, true),
ctx.fetcher.getPool(expectedPda.publicKey, IGNORE_CACHE),
ctx.fetcher.getTickArray(startTickArrayPda.publicKey, IGNORE_CACHE),
]);
assert.ok(whirlpoolAccountBefore === null);
@ -79,8 +80,8 @@ describe("whirlpool-client-impl", () => {
await tx.addSigner(funderKeypair).buildAndExecute();
const [whirlpoolAccountAfter, tickArrayAccountAfter] = await Promise.all([
ctx.fetcher.getPool(expectedPda.publicKey, true),
ctx.fetcher.getTickArray(startTickArrayPda.publicKey, true),
ctx.fetcher.getPool(expectedPda.publicKey, IGNORE_CACHE),
ctx.fetcher.getTickArray(startTickArrayPda.publicKey, IGNORE_CACHE),
]);
assert.ok(whirlpoolAccountAfter !== null);

View File

@ -14,6 +14,7 @@ import {
collectRewardsQuote,
decreaseLiquidityQuoteByLiquidity
} from "../../../src";
import { IGNORE_CACHE } from "../../../src/network/public/fetcher";
import { TickSpacing, ZERO_BN, createAssociatedTokenAccount, sleep, transferToken } from "../../utils";
import { defaultConfirmOptions } from "../../utils/const";
import { WhirlpoolTestFixture } from "../../utils/fixture";
@ -57,7 +58,7 @@ describe("WhirlpoolImpl#closePosition()", () => {
const tickArrayPda = PDAUtil.getTickArray(ctx.program.programId, whirlpoolPda.publicKey, 22528);
// Accrue fees in token A
const pool = await whirlpoolClient.getPool(whirlpoolPda.publicKey, true);
const pool = await whirlpoolClient.getPool(whirlpoolPda.publicKey, IGNORE_CACHE);
await (await pool.swap({
amount: new BN(200_000),
amountSpecifiedIsInput: true,
@ -90,8 +91,8 @@ describe("WhirlpoolImpl#closePosition()", () => {
poolInitInfo,
positions: [positionInfo],
} = fixture.getInfos();
const position = await testCtx.whirlpoolClient.getPosition(positionInfo.publicKey, true);
const pool = await testCtx.whirlpoolClient.getPool(poolInitInfo.whirlpoolPda.publicKey, true);
const position = await testCtx.whirlpoolClient.getPosition(positionInfo.publicKey, IGNORE_CACHE);
const pool = await testCtx.whirlpoolClient.getPool(poolInitInfo.whirlpoolPda.publicKey, IGNORE_CACHE);
const liquidityCollectedQuote = await decreaseLiquidityQuoteByLiquidity(
@ -109,7 +110,7 @@ describe("WhirlpoolImpl#closePosition()", () => {
async function collectFees(fixture: WhirlpoolTestFixture) {
const { positions } = fixture.getInfos();
const { whirlpoolClient } = testCtx;
const position = await whirlpoolClient.getPosition(positions[0].publicKey, true);
const position = await whirlpoolClient.getPosition(positions[0].publicKey, IGNORE_CACHE);
const hasL = !position.getData().liquidity.isZero()
await (await position.collectFees(hasL)).buildAndExecute();
}
@ -117,7 +118,7 @@ describe("WhirlpoolImpl#closePosition()", () => {
async function collectRewards(fixture: WhirlpoolTestFixture) {
const { positions } = fixture.getInfos();
const { whirlpoolClient } = testCtx;
const position = await whirlpoolClient.getPosition(positions[0].publicKey, true);
const position = await whirlpoolClient.getPosition(positions[0].publicKey, IGNORE_CACHE);
await (await position.collectRewards(undefined, true)).buildAndExecute();
}
@ -127,8 +128,8 @@ describe("WhirlpoolImpl#closePosition()", () => {
const ctx = whirlpoolClient.getContext();
const otherWallet = anchor.web3.Keypair.generate();
const pool = await whirlpoolClient.getPool(poolInitInfo.whirlpoolPda.publicKey, true);
const position = await whirlpoolClient.getPosition(positions[0].publicKey, true);
const pool = await whirlpoolClient.getPool(poolInitInfo.whirlpoolPda.publicKey, IGNORE_CACHE);
const position = await whirlpoolClient.getPosition(positions[0].publicKey, IGNORE_CACHE);
const preClosePoolData = pool.getData();
const positionAccountBalance = await ctx.connection.getBalance(positions[0].publicKey);
@ -164,7 +165,7 @@ describe("WhirlpoolImpl#closePosition()", () => {
tickUpper: position.getUpperTickData(),
});
const accountAPubkey = getAssociatedTokenAddressSync(poolInitInfo.tokenMintA, otherWallet.publicKey);
const accountA = (await ctx.fetcher.getTokenInfo(accountAPubkey, true)) as Account;
const accountA = (await ctx.fetcher.getTokenInfo(accountAPubkey, IGNORE_CACHE)) as Account;
const expectAmountA = liquidityCollectedQuote.tokenMinA.add(feeQuote.feeOwedA);
if (isWSOLTest) {
// If this is a WSOL test, we have to account for account rent retrieval
@ -187,7 +188,7 @@ describe("WhirlpoolImpl#closePosition()", () => {
}
const accountBPubkey = getAssociatedTokenAddressSync(poolInitInfo.tokenMintB, otherWallet.publicKey);
const accountB = await ctx.fetcher.getTokenInfo(accountBPubkey, true);
const accountB = await ctx.fetcher.getTokenInfo(accountBPubkey, IGNORE_CACHE);
const expectAmountB = liquidityCollectedQuote.tokenMinB.add(feeQuote.feeOwedB);
if (expectAmountB.isZero()) {
assert.ok(!accountB || accountB.amount === 0n);
@ -210,7 +211,7 @@ describe("WhirlpoolImpl#closePosition()", () => {
for (let i = 0; i < NUM_REWARDS; i++) {
if (!!rewards[i]) {
const rewardATA = getAssociatedTokenAddressSync(rewards[i].rewardMint, otherWallet.publicKey);
const rewardTokenAccount = await ctx.fetcher.getTokenInfo(rewardATA, true);
const rewardTokenAccount = await ctx.fetcher.getTokenInfo(rewardATA, IGNORE_CACHE);
assert.equal(rewardTokenAccount?.amount.toString(), rewardQuote[i]?.toString());
}
}
@ -404,7 +405,7 @@ describe("WhirlpoolImpl#closePosition()", () => {
const otherWallet = anchor.web3.Keypair.generate();
const positionData = fixture.getInfos().positions[0];
const position = await testCtx.whirlpoolClient.getPosition(positionData.publicKey, true);
const position = await testCtx.whirlpoolClient.getPosition(positionData.publicKey, IGNORE_CACHE);
const walletPositionTokenAccount = getAssociatedTokenAddressSync(
positionData.mintKeypair.publicKey,
@ -427,7 +428,7 @@ describe("WhirlpoolImpl#closePosition()", () => {
const positionDataBefore = await testCtx.whirlpoolCtx.fetcher.getPosition(
position.getAddress(),
true
IGNORE_CACHE
);
assert.notEqual(positionDataBefore, null);
@ -445,7 +446,7 @@ describe("WhirlpoolImpl#closePosition()", () => {
const positionDataAfter = await testCtx.whirlpoolCtx.fetcher.getPosition(
position.getAddress(),
true
IGNORE_CACHE
);
assert.equal(positionDataAfter, null);
@ -507,7 +508,7 @@ describe("WhirlpoolImpl#closePosition()", () => {
const otherWallet = anchor.web3.Keypair.generate();
const positionData = fixture.getInfos().positions[0];
const position = await testCtx.whirlpoolClient.getPosition(positionData.publicKey, true);
const position = await testCtx.whirlpoolClient.getPosition(positionData.publicKey, IGNORE_CACHE);
const walletPositionTokenAccount = getAssociatedTokenAddressSync(
positionData.mintKeypair.publicKey,
@ -530,7 +531,7 @@ describe("WhirlpoolImpl#closePosition()", () => {
const positionDataBefore = await testCtx.whirlpoolCtx.fetcher.getPosition(
position.getAddress(),
true
IGNORE_CACHE
);
assert.notEqual(positionDataBefore, null);
@ -548,7 +549,7 @@ describe("WhirlpoolImpl#closePosition()", () => {
const positionDataAfter = await testCtx.whirlpoolCtx.fetcher.getPosition(
position.getAddress(),
true
IGNORE_CACHE
);
assert.equal(positionDataAfter, null);

View File

@ -18,6 +18,7 @@ import {
collectRewardsQuote,
toTx
} from "../../../src";
import { IGNORE_CACHE } from "../../../src/network/public/fetcher";
import { TickSpacing, ZERO_BN } from "../../utils";
import { defaultConfirmOptions } from "../../utils/const";
import { WhirlpoolTestFixture } from "../../utils/fixture";
@ -184,7 +185,7 @@ describe("WhirlpoolImpl#collectFeesAndRewardsForPositions()", () => {
}
async function burnAndCloseATA(ctx: WhirlpoolContext, ata: PublicKey) {
const account = await ctx.fetcher.getTokenInfo(ata, true);
const account = await ctx.fetcher.getTokenInfo(ata, IGNORE_CACHE);
if (account === null) return;
const burnIx = createBurnInstruction(ata, account.mint, ctx.wallet.publicKey, account.amount);
@ -225,7 +226,7 @@ describe("WhirlpoolImpl#collectFeesAndRewardsForPositions()", () => {
async function createATA(ctx: WhirlpoolContext, ata: PublicKey, mint: PublicKey) {
if (mint.equals(NATIVE_MINT)) return;
const account = await ctx.fetcher.getTokenInfo(ata, true);
const account = await ctx.fetcher.getTokenInfo(ata, IGNORE_CACHE);
if (account !== null) return;
const createATAIx = createAssociatedTokenAccountInstruction(
ctx.wallet.publicKey,
@ -289,7 +290,7 @@ describe("WhirlpoolImpl#collectFeesAndRewardsForPositions()", () => {
for (const positionInfo of positions) {
const position = await testCtx.whirlpoolClient.getPosition(positionInfo.publicKey);
const poolData = await testCtx.whirlpoolCtx.fetcher.getPool(position.getData().whirlpool, true);
const poolData = await testCtx.whirlpoolCtx.fetcher.getPool(position.getData().whirlpool, IGNORE_CACHE);
const positionData = await position.refreshData();
const tickLowerData = position.getLowerTickData();
const tickUpperData = position.getLowerTickData();
@ -318,7 +319,7 @@ describe("WhirlpoolImpl#collectFeesAndRewardsForPositions()", () => {
const txs = await testCtx.whirlpoolClient.collectFeesAndRewardsForPositions(
positions.map((p) => p.publicKey),
true,
IGNORE_CACHE,
);
assert.ok(txs.length >= 2);
@ -345,7 +346,7 @@ describe("WhirlpoolImpl#collectFeesAndRewardsForPositions()", () => {
for (const positionInfo of positions) {
const position = await testCtx.whirlpoolClient.getPosition(positionInfo.publicKey);
const poolData = await testCtx.whirlpoolCtx.fetcher.getPool(position.getData().whirlpool, true);
const poolData = await testCtx.whirlpoolCtx.fetcher.getPool(position.getData().whirlpool, IGNORE_CACHE);
const positionData = await position.refreshData();
const tickLowerData = position.getLowerTickData();
const tickUpperData = position.getLowerTickData();

View File

@ -16,6 +16,7 @@ import {
toTx
} from "../../../src";
import { WhirlpoolContext } from "../../../src/context";
import { IGNORE_CACHE } from "../../../src/network/public/fetcher";
import {
ONE_SOL,
TickSpacing,
@ -114,7 +115,7 @@ describe("whirlpool-impl", () => {
// Verify position exists and numbers fit input parameters
const positionAddress = PDAUtil.getPosition(ctx.program.programId, positionMint).publicKey;
const position = await client.getPosition(positionAddress, true);
const position = await client.getPosition(positionAddress, IGNORE_CACHE);
const positionData = position.getData();
const tickLowerIndex = TickUtil.getInitializableTickIndex(
@ -139,7 +140,7 @@ describe("whirlpool-impl", () => {
}
// Verify position is closed and owner wallet has the tokens back
const postClosePosition = await fetcher.getPosition(positionAddress, true);
const postClosePosition = await fetcher.getPosition(positionAddress, IGNORE_CACHE);
assert.ok(postClosePosition === null);
// TODO: we are leaking 1 decimal place of token?
@ -223,7 +224,7 @@ describe("whirlpool-impl", () => {
// Verify position exists and numbers fit input parameters
const positionAddress = PDAUtil.getPosition(ctx.program.programId, positionMint).publicKey;
const position = await client.getPosition(positionAddress, true);
const position = await client.getPosition(positionAddress, IGNORE_CACHE);
const positionData = position.getData();
const tickLowerIndex = TickUtil.getInitializableTickIndex(
@ -284,7 +285,7 @@ describe("whirlpool-impl", () => {
await closeTx.addSigner(otherWallet).buildAndExecute();
// Verify position is closed and owner wallet has the tokens back
const postClosePosition = await fetcher.getPosition(positionAddress, true);
const postClosePosition = await fetcher.getPosition(positionAddress, IGNORE_CACHE);
assert.ok(postClosePosition === null);
const dWalletTokenAAccount = getAssociatedTokenAddressSync(poolData.tokenMintA, destinationWallet.publicKey,);
@ -403,8 +404,8 @@ describe("whirlpool-impl", () => {
await transferToken(provider, walletPositionTokenAccount, newOwnerPositionTokenAccount, 1);
const pool = await client.getPool(whirlpoolPda.publicKey, true);
const position = await client.getPosition(positionWithFees.publicKey, true);
const pool = await client.getPool(whirlpoolPda.publicKey, IGNORE_CACHE);
const position = await client.getPosition(positionWithFees.publicKey, IGNORE_CACHE);
const positionData = position.getData();
const poolData = pool.getData();
const txs = await pool.closePosition(
@ -583,8 +584,8 @@ describe("whirlpool-impl", () => {
await transferToken(provider, walletPositionTokenAccount, newOwnerPositionTokenAccount, 1);
const pool = await client.getPool(whirlpoolPda.publicKey, true);
const position = await client.getPosition(positionWithFees.publicKey, true);
const pool = await client.getPool(whirlpoolPda.publicKey, IGNORE_CACHE);
const position = await client.getPosition(positionWithFees.publicKey, IGNORE_CACHE);
const positionData = position.getData();
const poolData = pool.getData();

View File

@ -27,6 +27,7 @@ import {
WhirlpoolIx,
toTx
} from "../../src";
import { IGNORE_CACHE } from "../../src/network/public/fetcher";
import { PoolUtil } from "../../src/utils/public/pool-utils";
import {
TestConfigParams,
@ -734,7 +735,7 @@ export async function fundPositionsWithClient(
whirlpoolKey: PublicKey,
fundParams: FundedPositionParams[]
) {
const whirlpool = await client.getPool(whirlpoolKey, true);
const whirlpool = await client.getPool(whirlpoolKey, IGNORE_CACHE);
const whirlpoolData = whirlpool.getData();
await Promise.all(
fundParams.map(async (param, idx) => {

Some files were not shown because too many files have changed in this diff Show More