Skip to content

Commit

Permalink
chore: transparent node connection
Browse files Browse the repository at this point in the history
  • Loading branch information
ohager committed Nov 8, 2023
1 parent c0aafb1 commit e40838b
Show file tree
Hide file tree
Showing 10 changed files with 56 additions and 47 deletions.
50 changes: 25 additions & 25 deletions docs/classes/ChainWalker.html

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions docs/interfaces/ChainWalkerConfig.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ <h4>Hierarchy</h4>
<ul class="tsd-hierarchy">
<li><span class="target">ChainWalkerConfig</span></li></ul></section><aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/signum-network/signum-chain-walker/blob/c39117d/src/chainWalker.ts#L67">chainWalker.ts:67</a></li></ul></aside>
<li>Defined in <a href="https://github.com/signum-network/signum-chain-walker/blob/c0aafb1/src/chainWalker.ts#L67">chainWalker.ts:67</a></li></ul></aside>
<section class="tsd-panel-group tsd-index-group">
<section class="tsd-panel tsd-index-panel">
<details class="tsd-index-content tsd-index-accordion" open><summary class="tsd-accordion-summary tsd-index-summary">
Expand Down Expand Up @@ -59,7 +59,7 @@ <h3>Default</h3><pre><code class="language-ts"><span class="hl-8">0</span>
</code><button>Copy</button></pre>
</div><aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/signum-network/signum-chain-walker/blob/c39117d/src/chainWalker.ts#L120">chainWalker.ts:120</a></li></ul></aside></section>
<li>Defined in <a href="https://github.com/signum-network/signum-chain-walker/blob/c0aafb1/src/chainWalker.ts#L120">chainWalker.ts:120</a></li></ul></aside></section>
<section class="tsd-panel tsd-member"><a id="cachePath" class="tsd-anchor"></a>
<h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagOptional">Optional</code> <span>cache<wbr/>Path</span><a href="#cachePath" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></h3>
<div class="tsd-signature"><span class="tsd-kind-property">cache<wbr/>Path</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">string</span></div>
Expand All @@ -68,7 +68,7 @@ <h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagOptional">Optional</code
<h3>Default</h3><p><code>./chainwalker.cache.json </code>(current working directory)</p>
</div><aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/signum-network/signum-chain-walker/blob/c39117d/src/chainWalker.ts#L98">chainWalker.ts:98</a></li></ul></aside></section>
<li>Defined in <a href="https://github.com/signum-network/signum-chain-walker/blob/c0aafb1/src/chainWalker.ts#L98">chainWalker.ts:98</a></li></ul></aside></section>
<section class="tsd-panel tsd-member"><a id="intervalSeconds" class="tsd-anchor"></a>
<h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagOptional">Optional</code> <span>interval<wbr/>Seconds</span><a href="#intervalSeconds" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></h3>
<div class="tsd-signature"><span class="tsd-kind-property">interval<wbr/>Seconds</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">number</span></div>
Expand All @@ -80,7 +80,7 @@ <h3>Default</h3><pre><code class="language-ts"><span class="hl-8">5</span>
</code><button>Copy</button></pre>
</div><aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/signum-network/signum-chain-walker/blob/c39117d/src/chainWalker.ts#L85">chainWalker.ts:85</a></li></ul></aside></section>
<li>Defined in <a href="https://github.com/signum-network/signum-chain-walker/blob/c0aafb1/src/chainWalker.ts#L85">chainWalker.ts:85</a></li></ul></aside></section>
<section class="tsd-panel tsd-member"><a id="maxRetries" class="tsd-anchor"></a>
<h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagOptional">Optional</code> <span>max<wbr/>Retries</span><a href="#maxRetries" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></h3>
<div class="tsd-signature"><span class="tsd-kind-property">max<wbr/>Retries</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">number</span></div>
Expand All @@ -91,15 +91,15 @@ <h3>Default</h3><pre><code class="language-ts"><span class="hl-8">3</span>
</code><button>Copy</button></pre>
</div><aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/signum-network/signum-chain-walker/blob/c39117d/src/chainWalker.ts#L92">chainWalker.ts:92</a></li></ul></aside></section>
<li>Defined in <a href="https://github.com/signum-network/signum-chain-walker/blob/c0aafb1/src/chainWalker.ts#L92">chainWalker.ts:92</a></li></ul></aside></section>
<section class="tsd-panel tsd-member"><a id="mockLedger" class="tsd-anchor"></a>
<h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagOptional">Optional</code> <span>mock<wbr/>Ledger</span><a href="#mockLedger" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></h3>
<div class="tsd-signature"><span class="tsd-kind-property">mock<wbr/>Ledger</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type ">MockLedger</span></div>
<div class="tsd-comment tsd-typography"><p>If using a mock ledger, the nodeHost parameter is ignored.
The Mock Ledger is for testing purposes.</p>
</div><aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/signum-network/signum-chain-walker/blob/c39117d/src/chainWalker.ts#L104">chainWalker.ts:104</a></li></ul></aside></section>
<li>Defined in <a href="https://github.com/signum-network/signum-chain-walker/blob/c0aafb1/src/chainWalker.ts#L104">chainWalker.ts:104</a></li></ul></aside></section>
<section class="tsd-panel tsd-member"><a id="nodeHost" class="tsd-anchor"></a>
<h3 class="tsd-anchor-link"><span>node<wbr/>Host</span><a href="#nodeHost" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></h3>
<div class="tsd-signature"><span class="tsd-kind-property">node<wbr/>Host</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div>
Expand All @@ -109,7 +109,7 @@ <h3 class="tsd-anchor-link"><span>node<wbr/>Host</span><a href="#nodeHost" aria-
Main Net: <a href="http://localhost:8125">http://localhost:8125</a></p>
</div><aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/signum-network/signum-chain-walker/blob/c39117d/src/chainWalker.ts#L74">chainWalker.ts:74</a></li></ul></aside></section>
<li>Defined in <a href="https://github.com/signum-network/signum-chain-walker/blob/c0aafb1/src/chainWalker.ts#L74">chainWalker.ts:74</a></li></ul></aside></section>
<section class="tsd-panel tsd-member"><a id="verbose" class="tsd-anchor"></a>
<h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagOptional">Optional</code> <span>verbose</span><a href="#verbose" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></h3>
<div class="tsd-signature"><span class="tsd-kind-property">verbose</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">boolean</span></div>
Expand All @@ -119,7 +119,7 @@ <h3>Default</h3><pre><code class="language-ts"><span class="hl-0">false</span>
</code><button>Copy</button></pre>
</div><aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/signum-network/signum-chain-walker/blob/c39117d/src/chainWalker.ts#L79">chainWalker.ts:79</a></li></ul></aside></section></section></div>
<li>Defined in <a href="https://github.com/signum-network/signum-chain-walker/blob/c0aafb1/src/chainWalker.ts#L79">chainWalker.ts:79</a></li></ul></aside></section></section></div>
<div class="col-sidebar">
<div class="page-menu">
<div class="tsd-navigation settings">
Expand Down
4 changes: 2 additions & 2 deletions docs/interfaces/ChainWalkerContext.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ <h4>Hierarchy</h4>
<ul class="tsd-hierarchy">
<li><span class="target">ChainWalkerContext</span></li></ul></section><aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/signum-network/signum-chain-walker/blob/c39117d/src/chainWalker.ts#L23">chainWalker.ts:23</a></li></ul></aside>
<li>Defined in <a href="https://github.com/signum-network/signum-chain-walker/blob/c0aafb1/src/chainWalker.ts#L23">chainWalker.ts:23</a></li></ul></aside>
<section class="tsd-panel-group tsd-index-group">
<section class="tsd-panel tsd-index-panel">
<details class="tsd-index-content tsd-index-accordion" open><summary class="tsd-accordion-summary tsd-index-summary">
Expand All @@ -39,7 +39,7 @@ <h2>Properties</h2>
<h3 class="tsd-anchor-link"><span>ledger<wbr/>Client</span><a href="#ledgerClient" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none" id="icon-anchor-a"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5" id="icon-anchor-b"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5" id="icon-anchor-c"></path></svg></a></h3>
<div class="tsd-signature"><span class="tsd-kind-property">ledger<wbr/>Client</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type ">Api</span></div><aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/signum-network/signum-chain-walker/blob/c39117d/src/chainWalker.ts#L24">chainWalker.ts:24</a></li></ul></aside></section></section></div>
<li>Defined in <a href="https://github.com/signum-network/signum-chain-walker/blob/c0aafb1/src/chainWalker.ts#L24">chainWalker.ts:24</a></li></ul></aside></section></section></div>
<div class="col-sidebar">
<div class="page-menu">
<div class="tsd-navigation settings">
Expand Down
2 changes: 1 addition & 1 deletion docs/types/BeforeQuitHandler.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ <h4 class="tsd-parameters-title">Parameters</h4>
<h5><span class="tsd-kind-parameter">ctx</span>: <a href="../interfaces/ChainWalkerContext.html" class="tsd-signature-type tsd-kind-interface">ChainWalkerContext</a></h5></li></ul></div>
<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">void</span><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">void</span></h4></li></ul></li></ul></div><aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/signum-network/signum-chain-walker/blob/c39117d/src/chainWalker.ts#L60">chainWalker.ts:60</a></li></ul></aside></div>
<li>Defined in <a href="https://github.com/signum-network/signum-chain-walker/blob/c0aafb1/src/chainWalker.ts#L60">chainWalker.ts:60</a></li></ul></aside></div>
<div class="col-sidebar">
<div class="page-menu">
<div class="tsd-navigation settings">
Expand Down
2 changes: 1 addition & 1 deletion docs/types/BlockHandler.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ <h5><span class="tsd-kind-parameter">block</span>: <span class="tsd-signature-ty
<h5><span class="tsd-kind-parameter">ctx</span>: <a href="../interfaces/ChainWalkerContext.html" class="tsd-signature-type tsd-kind-interface">ChainWalkerContext</a></h5></li></ul></div>
<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">void</span><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">void</span></h4></li></ul></li></ul></div><aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/signum-network/signum-chain-walker/blob/c39117d/src/chainWalker.ts#L33">chainWalker.ts:33</a></li></ul></aside></div>
<li>Defined in <a href="https://github.com/signum-network/signum-chain-walker/blob/c0aafb1/src/chainWalker.ts#L33">chainWalker.ts:33</a></li></ul></aside></div>
<div class="col-sidebar">
<div class="page-menu">
<div class="tsd-navigation settings">
Expand Down
2 changes: 1 addition & 1 deletion docs/types/PendingTransactionsHandler.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ <h5><span class="tsd-kind-parameter">tx</span>: <span class="tsd-signature-type
<h5><span class="tsd-kind-parameter">ctx</span>: <a href="../interfaces/ChainWalkerContext.html" class="tsd-signature-type tsd-kind-interface">ChainWalkerContext</a></h5></li></ul></div>
<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">void</span><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">void</span></h4></li></ul></li></ul></div><aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/signum-network/signum-chain-walker/blob/c39117d/src/chainWalker.ts#L50">chainWalker.ts:50</a></li></ul></aside></div>
<li>Defined in <a href="https://github.com/signum-network/signum-chain-walker/blob/c0aafb1/src/chainWalker.ts#L50">chainWalker.ts:50</a></li></ul></aside></div>
<div class="col-sidebar">
<div class="page-menu">
<div class="tsd-navigation settings">
Expand Down
2 changes: 1 addition & 1 deletion docs/types/TransactionHandler.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ <h5><span class="tsd-kind-parameter">tx</span>: <span class="tsd-signature-type
<h5><span class="tsd-kind-parameter">ctx</span>: <a href="../interfaces/ChainWalkerContext.html" class="tsd-signature-type tsd-kind-interface">ChainWalkerContext</a></h5></li></ul></div>
<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">void</span><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">void</span></h4></li></ul></li></ul></div><aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/signum-network/signum-chain-walker/blob/c39117d/src/chainWalker.ts#L41">chainWalker.ts:41</a></li></ul></aside></div>
<li>Defined in <a href="https://github.com/signum-network/signum-chain-walker/blob/c0aafb1/src/chainWalker.ts#L41">chainWalker.ts:41</a></li></ul></aside></div>
<div class="col-sidebar">
<div class="page-menu">
<div class="tsd-navigation settings">
Expand Down
2 changes: 1 addition & 1 deletion examples/walk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ let movedSigna = Amount.Zero();

const walker = new ChainWalker({
nodeHost: "http://localhost:6876",
verbose: false,
verbose: true,
cachePath: "./example.catchUpBlockchain.cache.json",
})
.onBlock(() => {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "signum-chain-walker",
"version": "1.0.5",
"version": "1.0.6",
"description": "",
"main": "dist/index.js",
"private": false,
Expand Down
21 changes: 15 additions & 6 deletions src/chainWalker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -507,12 +507,21 @@ export class ChainWalker {
this.logger.trace(
`Trying to reach node under ${this.config.nodeHost} ...`
);
const { height } = await pRetry(() =>
this.ledger.block.getBlockByHeight(
// @ts-ignore
undefined,
false
)
const { height } = await pRetry(
() =>
this.ledger.block.getBlockByHeight(
// @ts-ignore
undefined,
false
),
{
onFailedAttempt: (error) => {
this.logger.warn(
`Cannot reach Node - trying again (${error.retriesLeft} retries left)`
);
},
retries: 5,
}
);
return height - (this.config.blockOffset || 0);
} catch (e: any) {
Expand Down

0 comments on commit e40838b

Please sign in to comment.