Skip to content

Commit

Permalink
npm package version 1.1.0, update docs with v2ray, wireguard process,…
Browse files Browse the repository at this point in the history
… utils methods and websocket client
  • Loading branch information
Tkd-Alex committed May 24, 2024
1 parent 1f14284 commit 2dbcf16
Show file tree
Hide file tree
Showing 215 changed files with 349 additions and 304 deletions.
2 changes: 1 addition & 1 deletion docs/assets/navigation.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/assets/search.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions docs/classes/index.SentinelClient.html

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions docs/classes/index.SentinelWsClient.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions docs/classes/index.SigningSentinelClient.html

Large diffs are not rendered by default.

11 changes: 7 additions & 4 deletions docs/classes/index.V2Ray.html

Large diffs are not rendered by default.

9 changes: 6 additions & 3 deletions docs/classes/index.Wireguard.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/enums/index.NodeVPNType.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/enums/index.Status.html

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions docs/functions/index.fetchLocation.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/functions/index.isNodeEventCreateSubscription.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/functions/index.isNodeEventRegister.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/functions/index.isNodeEventUpdateDetails.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/functions/index.isNodeEventUpdateStatus.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/functions/index.isPlanEventCreate.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/functions/index.isPlanEventCreateSubscription.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/functions/index.isPlanEventLinkNode.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/functions/index.isPlanEventUnlinkNode.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/functions/index.isPlanEventUpdateStatus.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/functions/index.isProviderEventRegister.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/functions/index.isProviderEventUpdate.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/functions/index.isSessionEventStart.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/functions/index.isSessionEventUpdateDetails.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/functions/index.isSessionEventUpdateStatus.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/functions/index.isSubscriptionEventAllocate.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/functions/index.isSubscriptionEventCreatePayout.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/functions/index.isSubscriptionEventPayForPayout.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/functions/index.isSubscriptionEventPayForPlan.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/functions/index.isSubscriptionEventPayForSession.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/functions/index.isSubscriptionEventRefund.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/functions/index.isSubscriptionEventUpdateStatus.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/functions/index.nodeRegister.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/functions/index.nodeStatus-1.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/functions/index.nodeSubscribe.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/functions/index.nodeUpdateDetails.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/functions/index.nodeUpdateStatus.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/functions/index.parseAttributes.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/functions/index.planCreate.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/functions/index.planLinkNode.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/functions/index.planSubscribe.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/functions/index.planUnlinkNode.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/functions/index.planUpdateStatus.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/functions/index.postSession.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/functions/index.privKeyFromMnemonic.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/functions/index.providerRegister.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/functions/index.providerUpdate.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/functions/index.searchEvent.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/functions/index.sessionEnd.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/functions/index.sessionStart.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/functions/index.sessionUpdateDetails.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/functions/index.signSessionId.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/functions/index.subscriptionAllocate.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/functions/index.subscriptionCancel.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/functions/index.uintArrayTob64.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/functions/modules_node.isMsgRegisterEncodeObject.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/functions/modules_node.setupNodeExtension.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/functions/modules_plan.isMsgCreateEncodeObject.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/functions/modules_plan.isMsgLinkNodeEncodeObject.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/functions/modules_plan.setupPlanExtension.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/functions/modules_session.isMsgEndEncodeObject.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/functions/modules_session.isMsgStartEncodeObject.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/functions/modules_session.setupSessionExtension.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions docs/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<!DOCTYPE html><html class="default" lang="en"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>@sentinel-official/sentinel-js-sdk</title><meta name="description" content="Documentation for @sentinel-official/sentinel-js-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 defer src="assets/main.js"></script><script async src="assets/search.js" id="tsd-search-script"></script><script async src="assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os"</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search" data-base="."><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="index.html" class="title">@sentinel-official/sentinel-js-sdk</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><h2>@sentinel-official/sentinel-js-sdk</h2></div><div class="tsd-panel tsd-typography"><a id="md:sentinel-js-sdk" class="tsd-anchor"></a><h1><a href="#md:sentinel-js-sdk">sentinel-js-sdk</a></h1><p>The Sentinel JS SDK relays on <a href="https://github.com/cosmos/cosmjs">CosmJS</a> and it was developed following the official <a href="https://tutorials.cosmos.network/tutorials/7-cosmjs/">tutorial</a>, it take also inspiration from other open source Cosmos SDK.</p>
<p><img src="https://img.shields.io/npm/v/%40sentinel-official%2Fsentinel-js-sdk" alt="NPM Version">
<img src="https://img.shields.io/npm/dm/%40sentinel-official%2Fsentinel-js-sdk" alt="NPM Downloads">
<img src="https://img.shields.io/github/stars/sentinel-official/sentinel-js-sdk" alt="GitHub Repo stars">
<img src="https://img.shields.io/github/forks/sentinel-official/sentinel-js-sdk" alt="GitHub forks"></p>
<p>The SDK exstends the followings:</p>
<ul>
<li><a href="https://cosmos.github.io/cosmjs/latest/stargate/classes/StargateClient.html">@cosmjs/stargate/StargateClient</a> as <code>SentinelClient</code></li>
Expand All @@ -12,6 +16,9 @@
<pre><code class="language-javascript"><span class="hl-0">import</span><span class="hl-1"> { </span><span class="hl-2">SigningSentinelClient</span><span class="hl-1"> } </span><span class="hl-0">from</span><span class="hl-1"> </span><span class="hl-3">&quot;@sentinel-official/sentinel-js-sdk&quot;</span><span class="hl-1">;</span><br/><span class="hl-0">import</span><span class="hl-1"> { </span><span class="hl-2">DirectSecp256k1HdWallet</span><span class="hl-1"> } </span><span class="hl-0">from</span><span class="hl-1"> </span><span class="hl-3">&quot;@cosmjs/proto-signing&quot;</span><br/><span class="hl-0">import</span><span class="hl-1"> { </span><span class="hl-2">GasPrice</span><span class="hl-1"> } </span><span class="hl-0">from</span><span class="hl-1"> </span><span class="hl-3">&quot;@cosmjs/stargate&quot;</span><br/><br/><span class="hl-4">const</span><span class="hl-1"> </span><span class="hl-5">wallet</span><span class="hl-1"> = </span><span class="hl-0">await</span><span class="hl-1"> </span><span class="hl-2">DirectSecp256k1HdWallet</span><span class="hl-1">.</span><span class="hl-6">fromMnemonic</span><span class="hl-1">(</span><span class="hl-2">mnemonic</span><span class="hl-1">, { </span><span class="hl-2">prefix:</span><span class="hl-1"> </span><span class="hl-3">&quot;sent&quot;</span><span class="hl-1"> });</span><br/><span class="hl-4">const</span><span class="hl-1"> [</span><span class="hl-5">account</span><span class="hl-1">] = </span><span class="hl-0">await</span><span class="hl-1"> </span><span class="hl-2">wallet</span><span class="hl-1">.</span><span class="hl-6">getAccounts</span><span class="hl-1">();</span><br/><br/><span class="hl-4">const</span><span class="hl-1"> </span><span class="hl-5">rpc</span><span class="hl-1"> = </span><span class="hl-3">&quot;https://rpc.sentinel.co:443&quot;</span><br/><br/><span class="hl-7">// With a default GasPrice:</span><br/><span class="hl-4">const</span><span class="hl-1"> </span><span class="hl-5">customDenom</span><span class="hl-1"> = </span><span class="hl-3">&quot;udvpn&quot;</span><br/><span class="hl-4">const</span><span class="hl-1"> </span><span class="hl-5">gasPrice</span><span class="hl-1"> = </span><span class="hl-2">GasPrice</span><span class="hl-1">.</span><span class="hl-6">fromString</span><span class="hl-1">(</span><span class="hl-3">`0.2</span><span class="hl-4">${</span><span class="hl-2">customDenom</span><span class="hl-4">}</span><span class="hl-3">`</span><span class="hl-1">);</span><br/><span class="hl-4">const</span><span class="hl-1"> </span><span class="hl-5">client</span><span class="hl-1"> = </span><span class="hl-0">await</span><span class="hl-1"> </span><span class="hl-2">SigningSentinelClient</span><span class="hl-1">.</span><span class="hl-6">connectWithSigner</span><span class="hl-1">(</span><span class="hl-2">rpc</span><span class="hl-1">, </span><span class="hl-2">wallet</span><span class="hl-1">, {</span><br/><span class="hl-1"> </span><span class="hl-2">gasPrice:</span><span class="hl-1"> </span><span class="hl-2">gasPrice</span><br/><span class="hl-1">})</span><br/><br/><span class="hl-7">// Without a default GasPrice:</span><br/><span class="hl-4">const</span><span class="hl-1"> </span><span class="hl-5">client</span><span class="hl-1"> = </span><span class="hl-0">await</span><span class="hl-1"> </span><span class="hl-2">SigningSentinelClient</span><span class="hl-1">.</span><span class="hl-6">connectWithSigner</span><span class="hl-1">(</span><span class="hl-2">rpc</span><span class="hl-1">, </span><span class="hl-2">wallet</span><span class="hl-1">)</span>
</code><button>Copy</button></pre>
<p>You can also set other default parameters: <a href="https://cosmos.github.io/cosmjs/latest/stargate/interfaces/SigningStargateClientOptions.html">https://cosmos.github.io/cosmjs/latest/stargate/interfaces/SigningStargateClientOptions.html</a>.</p>
<p>In order to subscribe to chain events you need a websocket client</p>
<pre><code class="language-javascript"><span class="hl-0">import</span><span class="hl-1"> { </span><span class="hl-2">SentinelWsClient</span><span class="hl-1"> } </span><span class="hl-0">from</span><span class="hl-1"> </span><span class="hl-3">&quot;@sentinel-official/sentinel-js-sdk&quot;</span><span class="hl-1">;</span><br/><span class="hl-4">const</span><span class="hl-1"> </span><span class="hl-5">client</span><span class="hl-1"> = </span><span class="hl-4">new</span><span class="hl-1"> </span><span class="hl-6">SentinelWsClient</span><span class="hl-1">(</span><span class="hl-3">&quot;wss://rpc.sentinel.quokkastake.io&quot;</span><span class="hl-1">);</span><br/><span class="hl-4">const</span><span class="hl-1"> </span><span class="hl-5">stream</span><span class="hl-1"> = </span><span class="hl-2">client</span><span class="hl-1">.</span><span class="hl-6">subscribe</span><span class="hl-1">(</span><span class="hl-3">&quot;tm.event=&#39;NewBlock&#39;&quot;</span><span class="hl-1">)</span><br/><span class="hl-2">stream</span><span class="hl-1">.</span><span class="hl-6">addListener</span><span class="hl-1">({</span><br/><span class="hl-1"> </span><span class="hl-6">next</span><span class="hl-2">:</span><span class="hl-1"> </span><span class="hl-2">data</span><span class="hl-1"> </span><span class="hl-4">=&gt;</span><span class="hl-1"> </span><span class="hl-2">console</span><span class="hl-1">.</span><span class="hl-6">log</span><span class="hl-1">(</span><span class="hl-2">data</span><span class="hl-1">),</span><br/><span class="hl-1"> </span><span class="hl-6">error</span><span class="hl-2">:</span><span class="hl-1"> </span><span class="hl-2">err</span><span class="hl-1"> </span><span class="hl-4">=&gt;</span><span class="hl-1"> </span><span class="hl-2">console</span><span class="hl-1">.</span><span class="hl-6">error</span><span class="hl-1">(</span><span class="hl-2">err</span><span class="hl-1">),</span><br/><span class="hl-1"> </span><span class="hl-6">complete</span><span class="hl-2">:</span><span class="hl-1"> () </span><span class="hl-4">=&gt;</span><span class="hl-1"> </span><span class="hl-2">console</span><span class="hl-1">.</span><span class="hl-6">log</span><span class="hl-1">(</span><span class="hl-3">&#39;completed&#39;</span><span class="hl-1">),</span><br/><span class="hl-1">});</span>
</code><button>Copy</button></pre>
<a id="md:query" class="tsd-anchor"></a><h2><a href="#md:query">query</a></h2><pre><code class="language-javascript"><span class="hl-0">import</span><span class="hl-1"> { </span><span class="hl-2">Status</span><span class="hl-1">, </span><span class="hl-2">PageRequest</span><span class="hl-1"> } </span><span class="hl-0">from</span><span class="hl-1"> </span><span class="hl-3">&quot;@sentinel-official/sentinel-js-sdk&quot;</span><span class="hl-1">;</span><br/><span class="hl-4">const</span><span class="hl-1"> </span><span class="hl-5">nodes</span><span class="hl-1"> = </span><span class="hl-0">await</span><span class="hl-1"> </span><span class="hl-2">client</span><span class="hl-1">.</span><span class="hl-2">sentinelQuery</span><span class="hl-1">?.</span><span class="hl-2">node</span><span class="hl-1">.</span><span class="hl-6">nodes</span><span class="hl-1">(</span><br/><span class="hl-1"> </span><span class="hl-2">Status</span><span class="hl-1">.</span><span class="hl-5">STATUS_ACTIVE</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-2">PageRequest</span><span class="hl-1">.</span><span class="hl-6">fromPartial</span><span class="hl-1">({</span><br/><span class="hl-1"> </span><span class="hl-2">limit:</span><span class="hl-1"> </span><span class="hl-8">5</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-2">countTotal:</span><span class="hl-1"> </span><span class="hl-4">true</span><br/><span class="hl-1"> })</span><br/><span class="hl-1">)</span>
</code><button>Copy</button></pre>
<p>For pagination please follow:</p>
Expand Down
Loading

0 comments on commit 2dbcf16

Please sign in to comment.