Ephemeral networks core implementation (#160)

This commit is contained in:
Pavel 2022-08-05 16:43:19 +03:00 committed by GitHub
parent 83c587af34
commit fb50ec271c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
31 changed files with 3314 additions and 5774 deletions

1
docs/.nojekyll Normal file
View File

@ -0,0 +1 @@
TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false.

File diff suppressed because it is too large Load Diff

22
docs/assets/highlight.css Normal file
View File

@ -0,0 +1,22 @@
:root {
--light-code-background: #F5F5F5;
--dark-code-background: #1E1E1E;
}
@media (prefers-color-scheme: light) { :root {
--code-background: var(--light-code-background);
} }
@media (prefers-color-scheme: dark) { :root {
--code-background: var(--dark-code-background);
} }
body.light {
--code-background: var(--light-code-background);
}
body.dark {
--code-background: var(--dark-code-background);
}
pre, code { background: var(--code-background); }

1043
docs/assets/icons.css Normal file

File diff suppressed because it is too large Load Diff

View File

Before

Width:  |  Height:  |  Size: 9.4 KiB

After

Width:  |  Height:  |  Size: 9.4 KiB

View File

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 28 KiB

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

52
docs/assets/main.js Normal file

File diff suppressed because one or more lines are too long

1
docs/assets/search.js Normal file

File diff suppressed because one or more lines are too long

1414
docs/assets/style.css Normal file

File diff suppressed because it is too large Load Diff

View File

Before

Width:  |  Height:  |  Size: 480 B

After

Width:  |  Height:  |  Size: 480 B

View File

Before

Width:  |  Height:  |  Size: 855 B

After

Width:  |  Height:  |  Size: 855 B

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,152 +1,16 @@
<!doctype html>
<html class="default no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>@fluencelabs/fluence</title>
<meta name="description" content="Documentation for @fluencelabs/fluence">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="assets/css/main.css">
<script async src="assets/js/search.js" id="search-script"></script>
</head>
<body>
<header>
<div class="tsd-page-toolbar">
<div class="container">
<div class="table-wrap">
<div class="table-cell" id="tsd-search" data-index="assets/js/search.json" data-base=".">
<div class="field">
<label for="tsd-search-field" class="tsd-widget search no-caption">Search</label>
<input id="tsd-search-field" type="text" />
</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">@fluencelabs/fluence</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">
<h1>@fluencelabs/fluence</h1>
</div>
</div>
</header>
<div class="container container-main">
<div class="row">
<div class="col-8 col-content">
<div class="tsd-panel tsd-typography">
<a href="#fluence-js" id="fluence-js" style="color: inherit; text-decoration: none;">
<!DOCTYPE html><html class="default"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>@fluencelabs/fluence</title><meta name="description" content="Documentation for @fluencelabs/fluence"/><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">@fluencelabs/fluence</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"><h1>@fluencelabs/fluence </h1></div></div></header><div class="container container-main"><div class="row"><div class="col-8 col-content"><div class="tsd-panel tsd-typography">
<a href="#fluence-js" id="fluence-js" style="color: inherit; text-decoration: none;">
<h1>Fluence JS</h1>
</a>
<p>To start developing applications with Fluence JS refer to the official <a href="https://doc.fluence.dev/docs/js-sdk">documentation</a></p>
<p>Fluence JS is an implementation of the Fluence protocol for JavaScript-based environments. It can connect browsers, Node.js applications, and so on to the Fluence p2p network.</p>
<p>Similar to the <a href="https://github.com/fluencelabs/fluence">Rust Fluence Peer implementation</a> it includes:</p>
<ul>
<li>Peer-to-peer communication layer (via <a href="https://github.com/libp2p/js-libp2p">js-libp2p</a>)</li>
<li><a href="https://github.com/fluencelabs/aquavm">Aqua VM</a></li>
<li>Builtin services</li>
</ul>
<p>Fluence JS can call services and functions on the Fluence network, and expose new APIs to the p2p network directly from TypeScript and JavaScript.
<a href="https://github.com/fluencelabs/aqua">Aqua language</a> uses Fluence JS as a compilation target, and they are designed to <a href="https://doc.fluence.dev/docs/js-sdk/3_in_depth#understanding-the-aqua-compiler-output">work in tandem</a>.</p>
<p>Fluence JS can be used with any framework of your choice (or even without frameworks).</p>
</div>
</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 class="before-current">
<li class=" tsd-kind-class">
<a href="classes/FluencePeer.html" class="tsd-kind-icon">Fluence<wbr>Peer</a>
</li>
<li class=" tsd-kind-class">
<a href="classes/KeyPair.html" class="tsd-kind-icon">Key<wbr>Pair</a>
</li>
<li class=" tsd-kind-interface tsd-has-type-parameter">
<a href="interfaces/CallParams.html" class="tsd-kind-icon">Call<wbr>Params</a>
</li>
<li class=" tsd-kind-interface">
<a href="interfaces/PeerConfig.html" class="tsd-kind-icon">Peer<wbr>Config</a>
</li>
<li class=" tsd-kind-interface">
<a href="interfaces/PeerStatus.html" class="tsd-kind-icon">Peer<wbr>Status</a>
</li>
<li class=" tsd-kind-type-alias">
<a href="modules.html#AvmLoglevel" class="tsd-kind-icon">Avm<wbr>Loglevel</a>
</li>
<li class=" tsd-kind-type-alias">
<a href="modules.html#PeerIdB58" class="tsd-kind-icon">Peer<wbr>IdB58</a>
</li>
<li class=" tsd-kind-variable">
<a href="modules.html#Fluence" class="tsd-kind-icon">Fluence</a>
</li>
<li class=" tsd-kind-function tsd-is-external">
<a href="modules.html#loadWasmFromFileSystem" class="tsd-kind-icon">load<wbr>Wasm<wbr>From<wbr>File<wbr>System</a>
</li>
<li class=" tsd-kind-function tsd-is-external">
<a href="modules.html#loadWasmFromNpmPackage" class="tsd-kind-icon">load<wbr>Wasm<wbr>From<wbr>Npm<wbr>Package</a>
</li>
<li class=" tsd-kind-function tsd-is-external">
<a href="modules.html#loadWasmFromServer" class="tsd-kind-icon">load<wbr>Wasm<wbr>From<wbr>Server</a>
</li>
<li class=" tsd-kind-function">
<a href="modules.html#setLogLevel" class="tsd-kind-icon">set<wbr>Log<wbr>Level</a>
</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>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><span class="tsd-kind-icon">Static method</span></li>
</ul>
</div>
</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/js/main.js"></script>
</body>
</html>
</a>
<p>To start developing applications with Fluence JS refer to the official <a href="https://doc.fluence.dev/docs/js-sdk">documentation</a></p>
<p>Fluence JS is an implementation of the Fluence protocol for JavaScript-based environments. It can connect browsers, Node.js applications, and so on to the Fluence p2p network.</p>
<p>Similar to the <a href="https://github.com/fluencelabs/fluence">Rust Fluence Peer implementation</a> it includes:</p>
<ul>
<li>Peer-to-peer communication layer (via <a href="https://github.com/libp2p/js-libp2p">js-libp2p</a>)</li>
<li><a href="https://github.com/fluencelabs/aquavm">Aqua VM</a></li>
<li>Builtin services</li>
</ul>
<p>Fluence JS can call services and functions on the Fluence network, and expose new APIs to the p2p network directly from TypeScript and JavaScript.
<a href="https://github.com/fluencelabs/aqua">Aqua language</a> uses Fluence JS as a compilation target, and they are designed to <a href="https://doc.fluence.dev/docs/js-sdk/3_in_depth#understanding-the-aqua-compiler-output">work in tandem</a>.</p>
<p>Fluence JS can be used with any framework of your choice (or even without frameworks).</p>
</div></div><div class="col-4 col-menu menu-sticky-wrap menu-highlight"><nav class="tsd-navigation primary"><ul><li class="current"><a href="modules.html">Exports</a></li></ul></nav><nav class="tsd-navigation secondary menu-sticky"><ul><li class="tsd-kind-class"><a href="classes/FluencePeer.html" class="tsd-kind-icon">Fluence<wbr/>Peer</a></li><li class="tsd-kind-class"><a href="classes/KeyPair.html" class="tsd-kind-icon">Key<wbr/>Pair</a></li><li class="tsd-kind-interface tsd-has-type-parameter"><a href="interfaces/CallParams.html" class="tsd-kind-icon">Call<wbr/>Params</a></li><li class="tsd-kind-interface"><a href="interfaces/PeerConfig.html" class="tsd-kind-icon">Peer<wbr/>Config</a></li><li class="tsd-kind-type-alias"><a href="modules.html#AvmLoglevel" class="tsd-kind-icon">Avm<wbr/>Loglevel</a></li><li class="tsd-kind-type-alias"><a href="modules.html#PeerIdB58" class="tsd-kind-icon">Peer<wbr/>Id<wbr/>B58</a></li><li class="tsd-kind-type-alias"><a href="modules.html#PeerStatus" class="tsd-kind-icon">Peer<wbr/>Status</a></li><li class="tsd-kind-variable"><a href="modules.html#Fluence" class="tsd-kind-icon">Fluence</a></li><li class="tsd-kind-function tsd-is-external"><a href="modules.html#loadWasmFromFileSystem" class="tsd-kind-icon">load<wbr/>Wasm<wbr/>From<wbr/>File<wbr/>System</a></li><li class="tsd-kind-function tsd-is-external"><a href="modules.html#loadWasmFromNpmPackage" class="tsd-kind-icon">load<wbr/>Wasm<wbr/>From<wbr/>Npm<wbr/>Package</a></li><li class="tsd-kind-function tsd-is-external"><a href="modules.html#loadWasmFromServer" class="tsd-kind-icon">load<wbr/>Wasm<wbr/>From<wbr/>Server</a></li><li class="tsd-kind-function"><a href="modules.html#setLogLevel" class="tsd-kind-icon">set<wbr/>Log<wbr/>Level</a></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></ul><ul class="tsd-legend"><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,306 +1,16 @@
<!doctype html>
<html class="default no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>CallParams | @fluencelabs/fluence</title>
<meta name="description" content="Documentation for @fluencelabs/fluence">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="../assets/css/main.css">
<script async src="../assets/js/search.js" id="search-script"></script>
</head>
<body>
<header>
<div class="tsd-page-toolbar">
<div class="container">
<div class="table-wrap">
<div class="table-cell" id="tsd-search" data-index="../assets/js/search.json" data-base="..">
<div class="field">
<label for="tsd-search-field" class="tsd-widget search no-caption">Search</label>
<input id="tsd-search-field" type="text" />
</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">@fluencelabs/fluence</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">@fluencelabs/fluence</a>
</li>
<li>
<a href="CallParams.html">CallParams</a>
</li>
</ul>
<h1>Interface CallParams&lt;ArgName&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>Additional information about a service call</p>
</div>
</div>
</section>
<section class="tsd-panel tsd-type-parameters">
<h3>Type parameters</h3>
<ul class="tsd-type-parameters">
<li>
<h4>ArgName<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">null</span></h4>
<div class="tsd-comment tsd-typography">
<div class="lead">
</div>
</div>
</li>
</ul>
</section>
<section class="tsd-panel tsd-hierarchy">
<h3>Hierarchy</h3>
<ul class="tsd-hierarchy">
<li>
<span class="target">CallParams</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>Properties</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="CallParams.html#initPeerId" class="tsd-kind-icon">init<wbr>Peer<wbr>Id</a></li>
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="CallParams.html#particleId" class="tsd-kind-icon">particle<wbr>Id</a></li>
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="CallParams.html#signature" class="tsd-kind-icon">signature</a></li>
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="CallParams.html#tetraplets" class="tsd-kind-icon">tetraplets</a></li>
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="CallParams.html#timestamp" class="tsd-kind-icon">timestamp</a></li>
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="CallParams.html#ttl" class="tsd-kind-icon">ttl</a></li>
</ul>
</section>
</div>
</section>
</section>
<section class="tsd-panel-group tsd-member-group ">
<h2>Properties</h2>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
<a name="initPeerId" class="tsd-anchor"></a>
<h3>init<wbr>Peer<wbr>Id</h3>
<div class="tsd-signature tsd-kind-icon">init<wbr>Peer<wbr>Id<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/4fcb39b/src/internal/commonTypes.ts#L37">src/internal/commonTypes.ts:37</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>The peer id which created the particle</p>
</div>
</div>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
<a name="particleId" class="tsd-anchor"></a>
<h3>particle<wbr>Id</h3>
<div class="tsd-signature tsd-kind-icon">particle<wbr>Id<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/4fcb39b/src/internal/commonTypes.ts#L32">src/internal/commonTypes.ts:32</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>The identifier of particle which triggered the call</p>
</div>
</div>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
<a name="signature" class="tsd-anchor"></a>
<h3>signature</h3>
<div class="tsd-signature tsd-kind-icon">signature<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/4fcb39b/src/internal/commonTypes.ts#L52">src/internal/commonTypes.ts:52</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>Particle&#39;s signature</p>
</div>
</div>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
<a name="tetraplets" class="tsd-anchor"></a>
<h3>tetraplets</h3>
<div class="tsd-signature tsd-kind-icon">tetraplets<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{</span><span class="tsd-signature-symbol">[ </span><span class="tsd-signature-type">key</span><span class="tsd-signature-symbol"> in </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">]</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">SecurityTetraplet</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol"> }</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/4fcb39b/src/internal/commonTypes.ts#L57">src/internal/commonTypes.ts:57</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>Security tetraplets</p>
</div>
</div>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
<a name="timestamp" class="tsd-anchor"></a>
<h3>timestamp</h3>
<div class="tsd-signature tsd-kind-icon">timestamp<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/4fcb39b/src/internal/commonTypes.ts#L42">src/internal/commonTypes.ts:42</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>Particle&#39;s timestamp when it was created</p>
</div>
</div>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
<a name="ttl" class="tsd-anchor"></a>
<h3>ttl</h3>
<div class="tsd-signature tsd-kind-icon">ttl<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/4fcb39b/src/internal/commonTypes.ts#L47">src/internal/commonTypes.ts:47</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>Time to live in milliseconds. The time after the particle should be expired</p>
</div>
</div>
</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 class="before-current">
<li class=" tsd-kind-class">
<a href="../classes/FluencePeer.html" class="tsd-kind-icon">Fluence<wbr>Peer</a>
</li>
<li class=" tsd-kind-class">
<a href="../classes/KeyPair.html" class="tsd-kind-icon">Key<wbr>Pair</a>
</li>
</ul>
<ul class="current">
<li class="current tsd-kind-interface tsd-has-type-parameter">
<a href="CallParams.html" class="tsd-kind-icon">Call<wbr>Params</a>
<ul>
<li class=" tsd-kind-property tsd-parent-kind-interface">
<a href="CallParams.html#initPeerId" class="tsd-kind-icon">init<wbr>Peer<wbr>Id</a>
</li>
<li class=" tsd-kind-property tsd-parent-kind-interface">
<a href="CallParams.html#particleId" class="tsd-kind-icon">particle<wbr>Id</a>
</li>
<li class=" tsd-kind-property tsd-parent-kind-interface">
<a href="CallParams.html#signature" class="tsd-kind-icon">signature</a>
</li>
<li class=" tsd-kind-property tsd-parent-kind-interface">
<a href="CallParams.html#tetraplets" class="tsd-kind-icon">tetraplets</a>
</li>
<li class=" tsd-kind-property tsd-parent-kind-interface">
<a href="CallParams.html#timestamp" class="tsd-kind-icon">timestamp</a>
</li>
<li class=" tsd-kind-property tsd-parent-kind-interface">
<a href="CallParams.html#ttl" class="tsd-kind-icon">ttl</a>
</li>
</ul>
</li>
</ul>
<ul class="after-current">
<li class=" tsd-kind-interface">
<a href="PeerConfig.html" class="tsd-kind-icon">Peer<wbr>Config</a>
</li>
<li class=" tsd-kind-interface">
<a href="PeerStatus.html" class="tsd-kind-icon">Peer<wbr>Status</a>
</li>
<li class=" tsd-kind-type-alias">
<a href="../modules.html#AvmLoglevel" class="tsd-kind-icon">Avm<wbr>Loglevel</a>
</li>
<li class=" tsd-kind-type-alias">
<a href="../modules.html#PeerIdB58" class="tsd-kind-icon">Peer<wbr>IdB58</a>
</li>
<li class=" tsd-kind-variable">
<a href="../modules.html#Fluence" class="tsd-kind-icon">Fluence</a>
</li>
<li class=" tsd-kind-function tsd-is-external">
<a href="../modules.html#loadWasmFromFileSystem" class="tsd-kind-icon">load<wbr>Wasm<wbr>From<wbr>File<wbr>System</a>
</li>
<li class=" tsd-kind-function tsd-is-external">
<a href="../modules.html#loadWasmFromNpmPackage" class="tsd-kind-icon">load<wbr>Wasm<wbr>From<wbr>Npm<wbr>Package</a>
</li>
<li class=" tsd-kind-function tsd-is-external">
<a href="../modules.html#loadWasmFromServer" class="tsd-kind-icon">load<wbr>Wasm<wbr>From<wbr>Server</a>
</li>
<li class=" tsd-kind-function">
<a href="../modules.html#setLogLevel" class="tsd-kind-icon">set<wbr>Log<wbr>Level</a>
</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>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><span class="tsd-kind-icon">Static method</span></li>
</ul>
</div>
</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/js/main.js"></script>
</body>
</html>
<!DOCTYPE html><html class="default"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>CallParams | @fluencelabs/fluence</title><meta name="description" content="Documentation for @fluencelabs/fluence"/><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">@fluencelabs/fluence</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">@fluencelabs/fluence</a></li><li><a href="CallParams.html">CallParams</a></li></ul><h1>Interface CallParams&lt;ArgName&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>Additional information about a service call</p>
</div></div></section><section class="tsd-panel tsd-type-parameters"><h3>Type parameters</h3><ul class="tsd-type-parameters"><li><h4>ArgName<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">null</span></h4><div class="tsd-comment tsd-typography"><div class="lead">
</div></div></li></ul></section><section class="tsd-panel tsd-hierarchy"><h3>Hierarchy</h3><ul class="tsd-hierarchy"><li><span class="target">CallParams</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>Properties</h3><ul class="tsd-index-list"><li class="tsd-kind-property tsd-parent-kind-interface"><a href="CallParams.html#initPeerId" class="tsd-kind-icon">init<wbr/>Peer<wbr/>Id</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="CallParams.html#particleId" class="tsd-kind-icon">particle<wbr/>Id</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="CallParams.html#signature" class="tsd-kind-icon">signature</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="CallParams.html#tetraplets" class="tsd-kind-icon">tetraplets</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="CallParams.html#timestamp" class="tsd-kind-icon">timestamp</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="CallParams.html#ttl" class="tsd-kind-icon">ttl</a></li></ul></section></div></section></section><section class="tsd-panel-group tsd-member-group "><h2>Properties</h2><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="initPeerId" class="tsd-anchor"></a><h3 class="tsd-anchor-link">init<wbr/>Peer<wbr/>Id<a href="#initPeerId" 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">init<wbr/>Peer<wbr/>Id<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/fea91db/src/internal/commonTypes.ts#L37">src/internal/commonTypes.ts:37</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>The peer id which created the particle</p>
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="particleId" class="tsd-anchor"></a><h3 class="tsd-anchor-link">particle<wbr/>Id<a href="#particleId" 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">particle<wbr/>Id<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/fea91db/src/internal/commonTypes.ts#L32">src/internal/commonTypes.ts:32</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>The identifier of particle which triggered the call</p>
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="signature" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span class="tsd-flag ts-flagOptional">Optional</span> signature<a href="#signature" 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">signature<span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">string</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/fea91db/src/internal/commonTypes.ts#L52">src/internal/commonTypes.ts:52</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Particle&#39;s signature</p>
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="tetraplets" class="tsd-anchor"></a><h3 class="tsd-anchor-link">tetraplets<a href="#tetraplets" 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">tetraplets<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type" data-tsd-kind="Type parameter">ArgName</span><span class="tsd-signature-symbol"> extends </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> ? </span><span class="tsd-signature-type">Record</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">ArgName</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">SecurityTetraplet</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol"> : </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">never</span><span class="tsd-signature-symbol">&gt;</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/fea91db/src/internal/commonTypes.ts#L57">src/internal/commonTypes.ts:57</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Security tetraplets</p>
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="timestamp" class="tsd-anchor"></a><h3 class="tsd-anchor-link">timestamp<a href="#timestamp" 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">timestamp<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/fea91db/src/internal/commonTypes.ts#L42">src/internal/commonTypes.ts:42</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Particle&#39;s timestamp when it was created</p>
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="ttl" class="tsd-anchor"></a><h3 class="tsd-anchor-link">ttl<a href="#ttl" 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">ttl<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/fea91db/src/internal/commonTypes.ts#L47">src/internal/commonTypes.ts:47</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Time to live in milliseconds. The time after the particle should be expired</p>
</div></div></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="CallParams.html" class="tsd-kind-icon">Call<wbr/>Params</a><ul><li class="tsd-kind-property tsd-parent-kind-interface"><a href="CallParams.html#initPeerId" class="tsd-kind-icon">init<wbr/>Peer<wbr/>Id</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="CallParams.html#particleId" class="tsd-kind-icon">particle<wbr/>Id</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="CallParams.html#signature" class="tsd-kind-icon">signature</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="CallParams.html#tetraplets" class="tsd-kind-icon">tetraplets</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="CallParams.html#timestamp" class="tsd-kind-icon">timestamp</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="CallParams.html#ttl" class="tsd-kind-icon">ttl</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></ul><ul class="tsd-legend"><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,448 +1,52 @@
<!doctype html>
<html class="default no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>PeerConfig | @fluencelabs/fluence</title>
<meta name="description" content="Documentation for @fluencelabs/fluence">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="../assets/css/main.css">
<script async src="../assets/js/search.js" id="search-script"></script>
</head>
<body>
<header>
<div class="tsd-page-toolbar">
<div class="container">
<div class="table-wrap">
<div class="table-cell" id="tsd-search" data-index="../assets/js/search.json" data-base="..">
<div class="field">
<label for="tsd-search-field" class="tsd-widget search no-caption">Search</label>
<input id="tsd-search-field" type="text" />
</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">@fluencelabs/fluence</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">@fluencelabs/fluence</a>
</li>
<li>
<a href="PeerConfig.html">PeerConfig</a>
</li>
</ul>
<h1>Interface PeerConfig</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>Configuration used when initiating Fluence Peer</p>
</div>
</div>
</section>
<section class="tsd-panel tsd-hierarchy">
<h3>Hierarchy</h3>
<ul class="tsd-hierarchy">
<li>
<span class="target">PeerConfig</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>Properties</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="PeerConfig.html#KeyPair" class="tsd-kind-icon">Key<wbr>Pair</a></li>
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="PeerConfig.html#avmLogLevel" class="tsd-kind-icon">avm<wbr>Log<wbr>Level</a></li>
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="PeerConfig.html#avmRunner" class="tsd-kind-icon">avm<wbr>Runner</a></li>
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="PeerConfig.html#checkConnectionTimeoutMs" class="tsd-kind-icon">check<wbr>Connection<wbr>Timeout<wbr>Ms</a></li>
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="PeerConfig.html#connectTo" class="tsd-kind-icon">connect<wbr>To</a></li>
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="PeerConfig.html#debug" class="tsd-kind-icon">debug</a></li>
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="PeerConfig.html#defaultTtlMs" class="tsd-kind-icon">default<wbr>Ttl<wbr>Ms</a></li>
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="PeerConfig.html#dialTimeoutMs" class="tsd-kind-icon">dial<wbr>Timeout<wbr>Ms</a></li>
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="PeerConfig.html#marineJS" class="tsd-kind-icon">marineJS</a></li>
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="PeerConfig.html#skipCheckConnection" class="tsd-kind-icon">skip<wbr>Check<wbr>Connection</a></li>
</ul>
</section>
</div>
</section>
</section>
<section class="tsd-panel-group tsd-member-group ">
<h2>Properties</h2>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
<a name="KeyPair" class="tsd-anchor"></a>
<h3><span class="tsd-flag ts-flagOptional">Optional</span> Key<wbr>Pair</h3>
<div class="tsd-signature tsd-kind-icon">Key<wbr>Pair<span class="tsd-signature-symbol">:</span> <a href="../classes/KeyPair.html" class="tsd-signature-type" data-tsd-kind="Class">KeyPair</a></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/4fcb39b/src/internal/FluencePeer.ts#L75">src/internal/FluencePeer.ts:75</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>Specify the KeyPair to be used to identify the Fluence Peer.
Will be generated randomly if not specified</p>
</div>
</div>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
<a name="avmLogLevel" class="tsd-anchor"></a>
<h3><span class="tsd-flag ts-flagOptional">Optional</span> avm<wbr>Log<wbr>Level</h3>
<div class="tsd-signature tsd-kind-icon">avm<wbr>Log<wbr>Level<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">LogLevel</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/4fcb39b/src/internal/FluencePeer.ts#L69">src/internal/FluencePeer.ts:69</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<dl class="tsd-comment-tags">
<dt>deprecated.</dt>
<dd><p>AVM run through marine-js infrastructure.</p>
</dd>
<dt>see</dt>
<dd><p>debug.marineLogLevel option to configure logging level of AVM</p>
</dd>
</dl>
</div>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
<a name="avmRunner" class="tsd-anchor"></a>
<h3><span class="tsd-flag ts-flagOptional">Optional</span> avm<wbr>Runner</h3>
<div class="tsd-signature tsd-kind-icon">avm<wbr>Runner<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">AvmRunner</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/4fcb39b/src/internal/FluencePeer.ts#L107">src/internal/FluencePeer.ts:107</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<dl class="tsd-comment-tags">
<dt>deprecated.</dt>
<dd><p>AVM run through marine-js infrastructure.</p>
</dd>
<dt>see</dt>
<dd><p>marineJS option to configure AVM</p>
</dd>
</dl>
</div>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
<a name="checkConnectionTimeoutMs" class="tsd-anchor"></a>
<h3><span class="tsd-flag ts-flagOptional">Optional</span> check<wbr>Connection<wbr>Timeout<wbr>Ms</h3>
<div class="tsd-signature tsd-kind-icon">check<wbr>Connection<wbr>Timeout<wbr>Ms<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/4fcb39b/src/internal/FluencePeer.ts#L82">src/internal/FluencePeer.ts:82</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>When the peer established the connection to the network it sends a ping-like message to check if it works correctly.
The options allows to specify the timeout for that message in milliseconds.
If not specified the default timeout will be used</p>
</div>
</div>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
<a name="connectTo" class="tsd-anchor"></a>
<h3><span class="tsd-flag ts-flagOptional">Optional</span> connect<wbr>To</h3>
<div class="tsd-signature tsd-kind-icon">connect<wbr>To<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Multiaddr</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Node</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/4fcb39b/src/internal/FluencePeer.ts#L63">src/internal/FluencePeer.ts:63</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>Node in Fluence network to connect to.
Can be in the form of:</p>
<ul>
<li>string: multiaddr in string format</li>
<li>Multiaddr: multiaddr object, @see <a href="https://github.com/multiformats/js-multiaddr">https://github.com/multiformats/js-multiaddr</a></li>
<li>Node: node structure, @see Node
If not specified the will work locally and would not be able to send or receive particles.</li>
</ul>
</div>
</div>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
<a name="debug" class="tsd-anchor"></a>
<h3><span class="tsd-flag ts-flagOptional">Optional</span> debug</h3>
<div class="tsd-signature tsd-kind-icon">debug<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{ </span>marineLogLevel<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">LogLevel</span><span class="tsd-signature-symbol">; </span>printParticleId<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> }</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/4fcb39b/src/internal/FluencePeer.ts#L135">src/internal/FluencePeer.ts:135</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>Enables\disabled various debugging features</p>
</div>
</div>
<div class="tsd-type-declaration">
<h4>Type declaration</h4>
<ul class="tsd-parameters">
<li class="tsd-parameter">
<h5><span class="tsd-flag ts-flagOptional">Optional</span> marine<wbr>Log<wbr>Level<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">LogLevel</span></h5>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>Log level for marine services. By default logging is turned off.</p>
</div>
</div>
</li>
<li class="tsd-parameter">
<h5><span class="tsd-flag ts-flagOptional">Optional</span> print<wbr>Particle<wbr>Id<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">boolean</span></h5>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>If set to true, newly initiated particle ids will be printed to console.
Useful to see what particle id is responsible for aqua function</p>
</div>
</div>
</li>
</ul>
</div>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
<a name="defaultTtlMs" class="tsd-anchor"></a>
<h3><span class="tsd-flag ts-flagOptional">Optional</span> default<wbr>Ttl<wbr>Ms</h3>
<div class="tsd-signature tsd-kind-icon">default<wbr>Ttl<wbr>Ms<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/4fcb39b/src/internal/FluencePeer.ts#L101">src/internal/FluencePeer.ts:101</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>Sets the default TTL for all particles originating from the peer with no TTL specified.
If the originating particle&#39;s TTL is defined then that value will be used
If the option is not set default TTL will be 7000</p>
</div>
</div>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
<a name="dialTimeoutMs" class="tsd-anchor"></a>
<h3><span class="tsd-flag ts-flagOptional">Optional</span> dial<wbr>Timeout<wbr>Ms</h3>
<div class="tsd-signature tsd-kind-icon">dial<wbr>Timeout<wbr>Ms<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/4fcb39b/src/internal/FluencePeer.ts#L94">src/internal/FluencePeer.ts:94</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>The dialing timeout in milliseconds</p>
</div>
</div>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
<a name="marineJS" class="tsd-anchor"></a>
<h3><span class="tsd-flag ts-flagOptional">Optional</span> marineJS</h3>
<div class="tsd-signature tsd-kind-icon">marineJS<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{ </span>avmWasmPath<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span>marineWasmPath<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span>workerScriptPath<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> }</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/4fcb39b/src/internal/FluencePeer.ts#L115">src/internal/FluencePeer.ts:115</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>This option allows to specify the location of various dependencies needed for marine-js.
Each key specifies the location of the corresponding dependency.
If Fluence peer is started inside browser the location is treated as the path to the file relative to origin.
IF Fluence peer is started in nodejs the location is treated as the full path to file on the file system.</p>
</div>
</div>
<div class="tsd-type-declaration">
<h4>Type declaration</h4>
<ul class="tsd-parameters">
<li class="tsd-parameter">
<h5>avm<wbr>Wasm<wbr>Path<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></h5>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>Configures the path to AVM wasm module</p>
</div>
</div>
</li>
<li class="tsd-parameter">
<h5>marine<wbr>Wasm<wbr>Path<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></h5>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>Configures the path to marine-js control wasm module</p>
</div>
</div>
</li>
<li class="tsd-parameter">
<h5>worker<wbr>Script<wbr>Path<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></h5>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>Configures path to the marine-js worker script.</p>
</div>
</div>
</li>
</ul>
</div>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
<a name="skipCheckConnection" class="tsd-anchor"></a>
<h3><span class="tsd-flag ts-flagOptional">Optional</span> skip<wbr>Check<wbr>Connection</h3>
<div class="tsd-signature tsd-kind-icon">skip<wbr>Check<wbr>Connection<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/4fcb39b/src/internal/FluencePeer.ts#L89">src/internal/FluencePeer.ts:89</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>When the peer established the connection to the network it sends a ping-like message to check if it works correctly.
If set to true, the ping-like message will be skipped
Default: false</p>
</div>
</div>
</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 class="before-current">
<li class=" tsd-kind-class">
<a href="../classes/FluencePeer.html" class="tsd-kind-icon">Fluence<wbr>Peer</a>
</li>
<li class=" tsd-kind-class">
<a href="../classes/KeyPair.html" class="tsd-kind-icon">Key<wbr>Pair</a>
</li>
<li class=" tsd-kind-interface tsd-has-type-parameter">
<a href="CallParams.html" class="tsd-kind-icon">Call<wbr>Params</a>
</li>
</ul>
<ul class="current">
<li class="current tsd-kind-interface">
<a href="PeerConfig.html" class="tsd-kind-icon">Peer<wbr>Config</a>
<ul>
<li class=" tsd-kind-property tsd-parent-kind-interface">
<a href="PeerConfig.html#KeyPair" class="tsd-kind-icon">Key<wbr>Pair</a>
</li>
<li class=" tsd-kind-property tsd-parent-kind-interface">
<a href="PeerConfig.html#avmLogLevel" class="tsd-kind-icon">avm<wbr>Log<wbr>Level</a>
</li>
<li class=" tsd-kind-property tsd-parent-kind-interface">
<a href="PeerConfig.html#avmRunner" class="tsd-kind-icon">avm<wbr>Runner</a>
</li>
<li class=" tsd-kind-property tsd-parent-kind-interface">
<a href="PeerConfig.html#checkConnectionTimeoutMs" class="tsd-kind-icon">check<wbr>Connection<wbr>Timeout<wbr>Ms</a>
</li>
<li class=" tsd-kind-property tsd-parent-kind-interface">
<a href="PeerConfig.html#connectTo" class="tsd-kind-icon">connect<wbr>To</a>
</li>
<li class=" tsd-kind-property tsd-parent-kind-interface">
<a href="PeerConfig.html#debug" class="tsd-kind-icon">debug</a>
</li>
<li class=" tsd-kind-property tsd-parent-kind-interface">
<a href="PeerConfig.html#defaultTtlMs" class="tsd-kind-icon">default<wbr>Ttl<wbr>Ms</a>
</li>
<li class=" tsd-kind-property tsd-parent-kind-interface">
<a href="PeerConfig.html#dialTimeoutMs" class="tsd-kind-icon">dial<wbr>Timeout<wbr>Ms</a>
</li>
<li class=" tsd-kind-property tsd-parent-kind-interface">
<a href="PeerConfig.html#marineJS" class="tsd-kind-icon">marineJS</a>
</li>
<li class=" tsd-kind-property tsd-parent-kind-interface">
<a href="PeerConfig.html#skipCheckConnection" class="tsd-kind-icon">skip<wbr>Check<wbr>Connection</a>
</li>
</ul>
</li>
</ul>
<ul class="after-current">
<li class=" tsd-kind-interface">
<a href="PeerStatus.html" class="tsd-kind-icon">Peer<wbr>Status</a>
</li>
<li class=" tsd-kind-type-alias">
<a href="../modules.html#AvmLoglevel" class="tsd-kind-icon">Avm<wbr>Loglevel</a>
</li>
<li class=" tsd-kind-type-alias">
<a href="../modules.html#PeerIdB58" class="tsd-kind-icon">Peer<wbr>IdB58</a>
</li>
<li class=" tsd-kind-variable">
<a href="../modules.html#Fluence" class="tsd-kind-icon">Fluence</a>
</li>
<li class=" tsd-kind-function tsd-is-external">
<a href="../modules.html#loadWasmFromFileSystem" class="tsd-kind-icon">load<wbr>Wasm<wbr>From<wbr>File<wbr>System</a>
</li>
<li class=" tsd-kind-function tsd-is-external">
<a href="../modules.html#loadWasmFromNpmPackage" class="tsd-kind-icon">load<wbr>Wasm<wbr>From<wbr>Npm<wbr>Package</a>
</li>
<li class=" tsd-kind-function tsd-is-external">
<a href="../modules.html#loadWasmFromServer" class="tsd-kind-icon">load<wbr>Wasm<wbr>From<wbr>Server</a>
</li>
<li class=" tsd-kind-function">
<a href="../modules.html#setLogLevel" class="tsd-kind-icon">set<wbr>Log<wbr>Level</a>
</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>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><span class="tsd-kind-icon">Static method</span></li>
</ul>
</div>
</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/js/main.js"></script>
</body>
</html>
<!DOCTYPE html><html class="default"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>PeerConfig | @fluencelabs/fluence</title><meta name="description" content="Documentation for @fluencelabs/fluence"/><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">@fluencelabs/fluence</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">@fluencelabs/fluence</a></li><li><a href="PeerConfig.html">PeerConfig</a></li></ul><h1>Interface PeerConfig </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>Configuration used when initiating Fluence Peer</p>
</div></div></section><section class="tsd-panel tsd-hierarchy"><h3>Hierarchy</h3><ul class="tsd-hierarchy"><li><span class="target">PeerConfig</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>Properties</h3><ul class="tsd-index-list"><li class="tsd-kind-property tsd-parent-kind-interface"><a href="PeerConfig.html#KeyPair" class="tsd-kind-icon">Key<wbr/>Pair</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="PeerConfig.html#avmLogLevel" class="tsd-kind-icon">avm<wbr/>Log<wbr/>Level</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="PeerConfig.html#avmRunner" class="tsd-kind-icon">avm<wbr/>Runner</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="PeerConfig.html#checkConnectionTimeoutMs" class="tsd-kind-icon">check<wbr/>Connection<wbr/>Timeout<wbr/>Ms</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="PeerConfig.html#connectTo" class="tsd-kind-icon">connect<wbr/>To</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="PeerConfig.html#debug" class="tsd-kind-icon">debug</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="PeerConfig.html#defaultTtlMs" class="tsd-kind-icon">default<wbr/>Ttl<wbr/>Ms</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="PeerConfig.html#dialTimeoutMs" class="tsd-kind-icon">dial<wbr/>Timeout<wbr/>Ms</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="PeerConfig.html#marineJS" class="tsd-kind-icon">marineJS</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="PeerConfig.html#skipCheckConnection" class="tsd-kind-icon">skip<wbr/>Check<wbr/>Connection</a></li></ul></section></div></section></section><section class="tsd-panel-group tsd-member-group "><h2>Properties</h2><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="KeyPair" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span class="tsd-flag ts-flagOptional">Optional</span> Key<wbr/>Pair<a href="#KeyPair" 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">Key<wbr/>Pair<span class="tsd-signature-symbol">?:</span> <a href="../classes/KeyPair.html" class="tsd-signature-type" data-tsd-kind="Class">KeyPair</a></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/fea91db/src/internal/FluencePeer.ts#L72">src/internal/FluencePeer.ts:72</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Specify the KeyPair to be used to identify the Fluence Peer.
Will be generated randomly if not specified</p>
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="avmLogLevel" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span class="tsd-flag ts-flagOptional">Optional</span> avm<wbr/>Log<wbr/>Level<a href="#avmLogLevel" 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">avm<wbr/>Log<wbr/>Level<span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">LogLevel</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/fea91db/src/internal/FluencePeer.ts#L66">src/internal/FluencePeer.ts:66</a></li></ul></aside><div class="tsd-comment tsd-typography"><dl class="tsd-comment-tags"><dt>deprecated.</dt><dd><p>AVM run through marine-js infrastructure.</p>
</dd><dt>see</dt><dd><p>debug.marineLogLevel option to configure logging level of AVM</p>
</dd></dl></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="avmRunner" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span class="tsd-flag ts-flagOptional">Optional</span> avm<wbr/>Runner<a href="#avmRunner" 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">avm<wbr/>Runner<span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">AvmRunner</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/fea91db/src/internal/FluencePeer.ts#L104">src/internal/FluencePeer.ts:104</a></li></ul></aside><div class="tsd-comment tsd-typography"><dl class="tsd-comment-tags"><dt>deprecated.</dt><dd><p>AVM run through marine-js infrastructure.</p>
</dd><dt>see</dt><dd><p>marineJS option to configure AVM</p>
</dd></dl></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="checkConnectionTimeoutMs" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span class="tsd-flag ts-flagOptional">Optional</span> check<wbr/>Connection<wbr/>Timeout<wbr/>Ms<a href="#checkConnectionTimeoutMs" 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">check<wbr/>Connection<wbr/>Timeout<wbr/>Ms<span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">number</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/fea91db/src/internal/FluencePeer.ts#L79">src/internal/FluencePeer.ts:79</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>When the peer established the connection to the network it sends a ping-like message to check if it works correctly.
The options allows to specify the timeout for that message in milliseconds.
If not specified the default timeout will be used</p>
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="connectTo" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span class="tsd-flag ts-flagOptional">Optional</span> connect<wbr/>To<a href="#connectTo" 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">connect<wbr/>To<span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">ConnectionOption</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/fea91db/src/internal/FluencePeer.ts#L60">src/internal/FluencePeer.ts:60</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Node in Fluence network to connect to.
Can be in the form of:</p>
<ul>
<li>string: multiaddr in string format</li>
<li>Multiaddr: multiaddr object, @see <a href="https://github.com/multiformats/js-multiaddr">https://github.com/multiformats/js-multiaddr</a></li>
<li>Node: node structure, @see Node</li>
<li>Implementation of FluenceConnection class, @see FluenceConnection
If not specified the will work locally and would not be able to send or receive particles.</li>
</ul>
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="debug" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span class="tsd-flag ts-flagOptional">Optional</span> debug<a href="#debug" 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">debug<span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-symbol">{ </span>marineLogLevel<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">LogLevel</span><span class="tsd-signature-symbol">; </span>printParticleId<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> }</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/fea91db/src/internal/FluencePeer.ts#L132">src/internal/FluencePeer.ts:132</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Enables\disabled various debugging features</p>
</div></div><div class="tsd-type-declaration"><h4>Type declaration</h4><ul class="tsd-parameters"><li class="tsd-parameter"><h5><span class="tsd-flag ts-flagOptional">Optional</span> marine<wbr/>Log<wbr/>Level<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">LogLevel</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p>Log level for marine services. By default logging is turned off.</p>
</div></div></li><li class="tsd-parameter"><h5><span class="tsd-flag ts-flagOptional">Optional</span> print<wbr/>Particle<wbr/>Id<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">boolean</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p>If set to true, newly initiated particle ids will be printed to console.
Useful to see what particle id is responsible for aqua function</p>
</div></div></li></ul></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="defaultTtlMs" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span class="tsd-flag ts-flagOptional">Optional</span> default<wbr/>Ttl<wbr/>Ms<a href="#defaultTtlMs" 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">default<wbr/>Ttl<wbr/>Ms<span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">number</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/fea91db/src/internal/FluencePeer.ts#L98">src/internal/FluencePeer.ts:98</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Sets the default TTL for all particles originating from the peer with no TTL specified.
If the originating particle&#39;s TTL is defined then that value will be used
If the option is not set default TTL will be 7000</p>
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="dialTimeoutMs" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span class="tsd-flag ts-flagOptional">Optional</span> dial<wbr/>Timeout<wbr/>Ms<a href="#dialTimeoutMs" 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">dial<wbr/>Timeout<wbr/>Ms<span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">number</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/fea91db/src/internal/FluencePeer.ts#L91">src/internal/FluencePeer.ts:91</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>The dialing timeout in milliseconds</p>
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="marineJS" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span class="tsd-flag ts-flagOptional">Optional</span> marineJS<a href="#marineJS" 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">marineJS<span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-symbol">{ </span>avmWasmPath<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span>marineWasmPath<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span>workerScriptPath<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> }</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/fea91db/src/internal/FluencePeer.ts#L112">src/internal/FluencePeer.ts:112</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>This option allows to specify the location of various dependencies needed for marine-js.
Each key specifies the location of the corresponding dependency.
If Fluence peer is started inside browser the location is treated as the path to the file relative to origin.
IF Fluence peer is started in nodejs the location is treated as the full path to file on the file system.</p>
</div></div><div class="tsd-type-declaration"><h4>Type declaration</h4><ul class="tsd-parameters"><li class="tsd-parameter"><h5>avm<wbr/>Wasm<wbr/>Path<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p>Configures the path to AVM wasm module</p>
</div></div></li><li class="tsd-parameter"><h5>marine<wbr/>Wasm<wbr/>Path<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p>Configures the path to marine-js control wasm module</p>
</div></div></li><li class="tsd-parameter"><h5>worker<wbr/>Script<wbr/>Path<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p>Configures path to the marine-js worker script.</p>
</div></div></li></ul></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="skipCheckConnection" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span class="tsd-flag ts-flagOptional">Optional</span> skip<wbr/>Check<wbr/>Connection<a href="#skipCheckConnection" 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">skip<wbr/>Check<wbr/>Connection<span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">boolean</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/fea91db/src/internal/FluencePeer.ts#L86">src/internal/FluencePeer.ts:86</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>When the peer established the connection to the network it sends a ping-like message to check if it works correctly.
If set to true, the ping-like message will be skipped
Default: false</p>
</div></div></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="PeerConfig.html" class="tsd-kind-icon">Peer<wbr/>Config</a><ul><li class="tsd-kind-property tsd-parent-kind-interface"><a href="PeerConfig.html#KeyPair" class="tsd-kind-icon">Key<wbr/>Pair</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="PeerConfig.html#avmLogLevel" class="tsd-kind-icon">avm<wbr/>Log<wbr/>Level</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="PeerConfig.html#avmRunner" class="tsd-kind-icon">avm<wbr/>Runner</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="PeerConfig.html#checkConnectionTimeoutMs" class="tsd-kind-icon">check<wbr/>Connection<wbr/>Timeout<wbr/>Ms</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="PeerConfig.html#connectTo" class="tsd-kind-icon">connect<wbr/>To</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="PeerConfig.html#debug" class="tsd-kind-icon">debug</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="PeerConfig.html#defaultTtlMs" class="tsd-kind-icon">default<wbr/>Ttl<wbr/>Ms</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="PeerConfig.html#dialTimeoutMs" class="tsd-kind-icon">dial<wbr/>Timeout<wbr/>Ms</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="PeerConfig.html#marineJS" class="tsd-kind-icon">marineJS</a></li><li class="tsd-kind-property tsd-parent-kind-interface"><a href="PeerConfig.html#skipCheckConnection" class="tsd-kind-icon">skip<wbr/>Check<wbr/>Connection</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></ul><ul class="tsd-legend"><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,256 +0,0 @@
<!doctype html>
<html class="default no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>PeerStatus | @fluencelabs/fluence</title>
<meta name="description" content="Documentation for @fluencelabs/fluence">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="../assets/css/main.css">
<script async src="../assets/js/search.js" id="search-script"></script>
</head>
<body>
<header>
<div class="tsd-page-toolbar">
<div class="container">
<div class="table-wrap">
<div class="table-cell" id="tsd-search" data-index="../assets/js/search.json" data-base="..">
<div class="field">
<label for="tsd-search-field" class="tsd-widget search no-caption">Search</label>
<input id="tsd-search-field" type="text" />
</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">@fluencelabs/fluence</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">@fluencelabs/fluence</a>
</li>
<li>
<a href="PeerStatus.html">PeerStatus</a>
</li>
</ul>
<h1>Interface PeerStatus</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>Information about Fluence Peer connection</p>
</div>
</div>
</section>
<section class="tsd-panel tsd-hierarchy">
<h3>Hierarchy</h3>
<ul class="tsd-hierarchy">
<li>
<span class="target">PeerStatus</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>Properties</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="PeerStatus.html#isConnected" class="tsd-kind-icon">is<wbr>Connected</a></li>
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="PeerStatus.html#isInitialized" class="tsd-kind-icon">is<wbr>Initialized</a></li>
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="PeerStatus.html#peerId" class="tsd-kind-icon">peer<wbr>Id</a></li>
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="PeerStatus.html#relayPeerId" class="tsd-kind-icon">relay<wbr>Peer<wbr>Id</a></li>
</ul>
</section>
</div>
</section>
</section>
<section class="tsd-panel-group tsd-member-group ">
<h2>Properties</h2>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
<a name="isConnected" class="tsd-anchor"></a>
<h3>is<wbr>Connected</h3>
<div class="tsd-signature tsd-kind-icon">is<wbr>Connected<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Boolean</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/4fcb39b/src/internal/FluencePeer.ts#L161">src/internal/FluencePeer.ts:161</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>Is the peer connected to network or not</p>
</div>
</div>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
<a name="isInitialized" class="tsd-anchor"></a>
<h3>is<wbr>Initialized</h3>
<div class="tsd-signature tsd-kind-icon">is<wbr>Initialized<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Boolean</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/4fcb39b/src/internal/FluencePeer.ts#L156">src/internal/FluencePeer.ts:156</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>Is the peer initialized or not</p>
</div>
</div>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
<a name="peerId" class="tsd-anchor"></a>
<h3>peer<wbr>Id</h3>
<div class="tsd-signature tsd-kind-icon">peer<wbr>Id<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/4fcb39b/src/internal/FluencePeer.ts#L166">src/internal/FluencePeer.ts:166</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>The Peer&#39;s identification in the Fluence network</p>
</div>
</div>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
<a name="relayPeerId" class="tsd-anchor"></a>
<h3>relay<wbr>Peer<wbr>Id</h3>
<div class="tsd-signature tsd-kind-icon">relay<wbr>Peer<wbr>Id<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/fluencelabs/fluence-js/blob/4fcb39b/src/internal/FluencePeer.ts#L171">src/internal/FluencePeer.ts:171</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>The relays&#39;s peer id to which the peer is connected to</p>
</div>
</div>
</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 class="before-current">
<li class=" tsd-kind-class">
<a href="../classes/FluencePeer.html" class="tsd-kind-icon">Fluence<wbr>Peer</a>
</li>
<li class=" tsd-kind-class">
<a href="../classes/KeyPair.html" class="tsd-kind-icon">Key<wbr>Pair</a>
</li>
<li class=" tsd-kind-interface tsd-has-type-parameter">
<a href="CallParams.html" class="tsd-kind-icon">Call<wbr>Params</a>
</li>
<li class=" tsd-kind-interface">
<a href="PeerConfig.html" class="tsd-kind-icon">Peer<wbr>Config</a>
</li>
</ul>
<ul class="current">
<li class="current tsd-kind-interface">
<a href="PeerStatus.html" class="tsd-kind-icon">Peer<wbr>Status</a>
<ul>
<li class=" tsd-kind-property tsd-parent-kind-interface">
<a href="PeerStatus.html#isConnected" class="tsd-kind-icon">is<wbr>Connected</a>
</li>
<li class=" tsd-kind-property tsd-parent-kind-interface">
<a href="PeerStatus.html#isInitialized" class="tsd-kind-icon">is<wbr>Initialized</a>
</li>
<li class=" tsd-kind-property tsd-parent-kind-interface">
<a href="PeerStatus.html#peerId" class="tsd-kind-icon">peer<wbr>Id</a>
</li>
<li class=" tsd-kind-property tsd-parent-kind-interface">
<a href="PeerStatus.html#relayPeerId" class="tsd-kind-icon">relay<wbr>Peer<wbr>Id</a>
</li>
</ul>
</li>
</ul>
<ul class="after-current">
<li class=" tsd-kind-type-alias">
<a href="../modules.html#AvmLoglevel" class="tsd-kind-icon">Avm<wbr>Loglevel</a>
</li>
<li class=" tsd-kind-type-alias">
<a href="../modules.html#PeerIdB58" class="tsd-kind-icon">Peer<wbr>IdB58</a>
</li>
<li class=" tsd-kind-variable">
<a href="../modules.html#Fluence" class="tsd-kind-icon">Fluence</a>
</li>
<li class=" tsd-kind-function tsd-is-external">
<a href="../modules.html#loadWasmFromFileSystem" class="tsd-kind-icon">load<wbr>Wasm<wbr>From<wbr>File<wbr>System</a>
</li>
<li class=" tsd-kind-function tsd-is-external">
<a href="../modules.html#loadWasmFromNpmPackage" class="tsd-kind-icon">load<wbr>Wasm<wbr>From<wbr>Npm<wbr>Package</a>
</li>
<li class=" tsd-kind-function tsd-is-external">
<a href="../modules.html#loadWasmFromServer" class="tsd-kind-icon">load<wbr>Wasm<wbr>From<wbr>Server</a>
</li>
<li class=" tsd-kind-function">
<a href="../modules.html#setLogLevel" class="tsd-kind-icon">set<wbr>Log<wbr>Level</a>
</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>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><span class="tsd-kind-icon">Static method</span></li>
</ul>
</div>
</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/js/main.js"></script>
</body>
</html>

File diff suppressed because one or more lines are too long

View File

@ -2,4 +2,5 @@ module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
testTimeout: 10000,
testPathIgnorePatterns: ['dist'],
};

28
package-lock.json generated
View File

@ -19,6 +19,7 @@
"cids": "1.1.9",
"it-length-prefixed": "5.0.3",
"it-pipe": "1.1.0",
"js-base64": "^3.7.2",
"libp2p": "0.36.2",
"libp2p-crypto": "0.21.2",
"libp2p-mplex": "0.10.7",
@ -38,12 +39,12 @@
"devDependencies": {
"@fluencelabs/aqua": "^0.7.2-307",
"@fluencelabs/aqua-lib": "^0.5.1",
"@fluencelabs/fluence-network-environment": "^1.0.13",
"@types/bs58": "^4.0.1",
"@types/jest": "^27.5.1",
"@types/platform": "^1.3.4",
"@types/uuid": "^8.3.4",
"jest": "^28.1.0",
"js-base64": "^3.7.2",
"ts-jest": "^28.0.2",
"typedoc": "^0.22.15",
"typescript": "^4.6.4"
@ -5451,19 +5452,6 @@
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
"integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8="
},
"node_modules/fsevents": {
"version": "2.3.2",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz",
"integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==",
"hasInstallScript": true,
"optional": true,
"os": [
"darwin"
],
"engines": {
"node": "^8.16.0 || ^10.6.0 || >=11.0.0"
}
},
"node_modules/function-bind": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
@ -8042,8 +8030,7 @@
"node_modules/js-base64": {
"version": "3.7.2",
"resolved": "https://registry.npmjs.org/js-base64/-/js-base64-3.7.2.tgz",
"integrity": "sha512-NnRs6dsyqUXejqk/yv2aiXlAvOs56sLkX6nUdeaNezI5LFFLlsZjOThmwnrcwh5ZZRwZlCMnVAY3CvhIhoVEKQ==",
"dev": true
"integrity": "sha512-NnRs6dsyqUXejqk/yv2aiXlAvOs56sLkX6nUdeaNezI5LFFLlsZjOThmwnrcwh5ZZRwZlCMnVAY3CvhIhoVEKQ=="
},
"node_modules/js-sha3": {
"version": "0.8.0",
@ -14978,12 +14965,6 @@
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
"integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8="
},
"fsevents": {
"version": "2.3.2",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz",
"integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==",
"optional": true
},
"function-bind": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
@ -17074,8 +17055,7 @@
"js-base64": {
"version": "3.7.2",
"resolved": "https://registry.npmjs.org/js-base64/-/js-base64-3.7.2.tgz",
"integrity": "sha512-NnRs6dsyqUXejqk/yv2aiXlAvOs56sLkX6nUdeaNezI5LFFLlsZjOThmwnrcwh5ZZRwZlCMnVAY3CvhIhoVEKQ==",
"dev": true
"integrity": "sha512-NnRs6dsyqUXejqk/yv2aiXlAvOs56sLkX6nUdeaNezI5LFFLlsZjOThmwnrcwh5ZZRwZlCMnVAY3CvhIhoVEKQ=="
},
"js-sha3": {
"version": "0.8.0",

View File

@ -43,17 +43,18 @@
"platform": "^1.3.6",
"rxjs": "^7.5.5",
"ts-pattern": "3.3.3",
"js-base64": "^3.7.2",
"uuid": "8.3.2"
},
"devDependencies": {
"@fluencelabs/aqua": "^0.7.2-307",
"@fluencelabs/aqua-lib": "^0.5.1",
"@fluencelabs/fluence-network-environment": "^1.0.13",
"@types/bs58": "^4.0.1",
"@types/jest": "^27.5.1",
"@types/platform": "^1.3.4",
"@types/uuid": "^8.3.4",
"jest": "^28.1.0",
"js-base64": "^3.7.2",
"ts-jest": "^28.0.2",
"typedoc": "^0.22.15",
"typescript": "^4.6.4"

View File

@ -1,14 +1,6 @@
// Uncomment to test on dev nodes
// export const nodes = [
// {
// multiaddr: '/dns4/dev.fluence.dev/tcp/19003/wss/p2p/12D3KooWBUJifCTgaxAUrcM9JysqCcS4CS8tiYH5hExbdWCAoNwb',
// peerId: '12D3KooWBUJifCTgaxAUrcM9JysqCcS4CS8tiYH5hExbdWCAoNwb',
// },
// {
// multiaddr: '/dns4/dev.fluence.dev/tcp/19004/wss/p2p/12D3KooWJbJFaZ3k5sNd8DjQgg3aERoKtBAnirEvPV8yp76kEXHB',
// peerId: '12D3KooWJbJFaZ3k5sNd8DjQgg3aERoKtBAnirEvPV8yp76kEXHB',
// },
// ];
// import { krasnodar } from '@fluencelabs/fluence-network-environment';
// export const nodes = krasnodar;
/*
* start docker container to run integration tests locally:
@ -16,6 +8,7 @@
docker run --rm -e RUST_LOG="info" -p 1210:1210 -p 4310:4310 fluencelabs/fluence -t 1210 -w 4310 -k gKdiCSUr1TFGFEgu2t8Ch1XEUsrN5A2UfBLjSZvfci9SPR3NvZpACfcpPGC3eY4zma1pk7UvYv5zb1VjvPHwCjj --local
*/
export const nodes = [
{
multiaddr: '/ip4/127.0.0.1/tcp/4310/ws/p2p/12D3KooWKEprYXUXqoV5xSBeyqrWLpQLLH4PXfvVkDJtmcqmh5V3',

View File

@ -164,8 +164,12 @@ describe('Tests for default handler', () => {
// assert
expect(res).toMatchObject({
retCode: 1,
result: 'The JS implementation of Peer does not support "peer.identify"',
retCode: 0,
result: {
external_addresses: [],
node_version: expect.stringContaining('js'),
air_version: expect.stringContaining('js'),
},
});
});
});

View File

@ -0,0 +1,81 @@
import { EphemeralNetwork, defaultConfig } from '../../internal/ephemeral';
import { FluencePeer, KeyPair } from '../../index';
import { ResultCodes } from '../../internal/commonTypes';
let en: EphemeralNetwork;
let peer: FluencePeer;
describe('Ephemeral networks tests', () => {
beforeEach(async () => {
en = new EphemeralNetwork(defaultConfig);
await en.up();
const relay = defaultConfig.peers[0].peerId;
peer = new FluencePeer();
await peer.init({
KeyPair: await KeyPair.randomEd25519(),
});
const conn = en.getRelayConnection(relay, peer);
await peer.connect(conn);
});
afterEach(async () => {
if (peer) {
await peer.stop();
}
if (en) {
await en.down();
}
});
it('smoke test', async function () {
const relay = peer.getStatus().relayPeerId!;
const peers = defaultConfig.peers.map((x) => x.peerId);
const script = `
(seq
(call "${relay}" ("op" "noop") [])
(seq
(call "${peers[0]}" ("op" "noop") [])
(seq
(call "${peers[1]}" ("op" "noop") [])
(seq
(call "${peers[2]}" ("op" "noop") [])
(seq
(call "${peers[3]}" ("op" "noop") [])
(seq
(call "${peers[4]}" ("op" "noop") [])
(seq
(call "${relay}" ("op" "noop") [])
(call %init_peer_id% ("test" "test") [])
)
)
)
)
)
)
)
`;
const particle = peer.internals.createNewParticle(script);
if (particle instanceof Error) {
throw particle;
}
const promise = new Promise<string>((resolve) => {
peer.internals.regHandler.forParticle(particle.id, 'test', 'test', (req) => {
resolve('success');
return {
result: 'test',
retCode: ResultCodes.success,
};
});
});
peer.internals.initiateParticle(particle, () => {});
await expect(promise).resolves.toBe('success');
});
});

View File

@ -22,13 +22,14 @@ import { decode, encode } from 'it-length-prefixed';
import { pipe } from 'it-pipe';
import * as log from 'loglevel';
import { Noise } from '@chainsafe/libp2p-noise';
import { Particle } from './Particle';
import PeerId from 'peer-id';
import type { MultiaddrInput } from 'multiaddr';
import { Multiaddr } from 'multiaddr';
// @ts-ignore
import { all as allow_all } from 'libp2p-websockets/src/filters';
import { Connection } from 'libp2p-interfaces/src/topology';
import Buffer from './Buffer';
import { PeerIdB58 } from './commonTypes';
export const PROTOCOL_NAME = '/fluence/particle/2.0.0';
@ -44,25 +45,42 @@ export interface FluenceConnectionOptions {
/**
* Multiaddress of the relay to make connection to
*/
relayAddress: Multiaddr;
relayAddress: MultiaddrInput;
/**
* The dialing timeout in milliseconds
*/
dialTimeoutMs?: number;
/**
* Handler for incoming particles from the connection
*/
onIncomingParticle: (p: Particle) => void;
}
export class FluenceConnection {
constructor(private _lib2p2Peer: Lib2p2Peer, private _relayAddress: Multiaddr) {}
export type ParticleHandler = (particle: string) => void;
/**
* Base class for connectivity layer to Fluence Network
*/
export abstract class FluenceConnection {
abstract readonly relayPeerId: PeerIdB58 | null;
abstract connect(onIncomingParticle: ParticleHandler): Promise<void>;
abstract disconnect(): Promise<void>;
abstract sendParticle(nextPeerIds: PeerIdB58[], particle: string): Promise<void>;
}
/**
* Implementation for JS peers which connects to Fluence through relay node
*/
export class RelayConnection extends FluenceConnection {
constructor(
public peerId: PeerIdB58,
private _lib2p2Peer: Lib2p2Peer,
private _relayAddress: Multiaddr,
public readonly relayPeerId: PeerIdB58,
) {
super();
}
private _connection?: Connection;
static async createConnection(options: FluenceConnectionOptions): Promise<FluenceConnection> {
static async createConnection(options: FluenceConnectionOptions): Promise<RelayConnection> {
const transportKey = Websockets.prototype[Symbol.toStringTag];
const lib2p2Peer = await Lib2p2Peer.create({
peerId: options.peerId,
@ -83,39 +101,34 @@ export class FluenceConnection {
},
});
lib2p2Peer.handle([PROTOCOL_NAME], async ({ connection, stream }) => {
pipe(
stream.source,
// @ts-ignore
decode(),
async (source: AsyncIterable<string>) => {
try {
for await (const msg of source) {
try {
const particle = Particle.fromString(msg);
options.onIncomingParticle(particle);
} catch (e) {
log.error('error on handling a new incoming message: ' + e);
const relayMultiaddr = new Multiaddr(options.relayAddress);
const relayPeerId = relayMultiaddr.getPeerId();
if (relayPeerId === null) {
throw new Error('Specified multiaddr is invalid or missing peer id: ' + options.relayAddress);
}
}
} catch (e) {
log.debug('connection closed: ' + e);
}
},
return new RelayConnection(
// force new line
options.peerId.toB58String(),
lib2p2Peer,
relayMultiaddr,
relayPeerId,
);
});
const relayAddress = options.relayAddress;
return new FluenceConnection(lib2p2Peer, relayAddress);
}
async disconnect() {
await this._lib2p2Peer.unhandle(PROTOCOL_NAME);
await this._lib2p2Peer.stop();
}
async sendParticle(particle: Particle): Promise<void> {
particle.logTo('debug', 'sending particle:');
async sendParticle(nextPeerIds: PeerIdB58[], particle: string): Promise<void> {
if (nextPeerIds.length !== 1 && nextPeerIds[0] !== this.relayPeerId) {
throw new Error(
`Relay connection only accepts peer id of the connected relay. Got: ${JSON.stringify(
nextPeerIds,
)} instead.`,
);
}
/*
TODO:: find out why this doesn't work and a new connection has to be established each time
@ -131,15 +144,36 @@ export class FluenceConnection {
pipe(
// force new line
[Buffer.from(particle.toString(), 'utf8')],
[Buffer.from(particle, 'utf8')],
encode(),
sink,
);
}
async connect() {
async connect(onIncomingParticle: ParticleHandler) {
await this._lib2p2Peer.start();
this._lib2p2Peer.handle([PROTOCOL_NAME], async ({ connection, stream }) => {
pipe(
stream.source,
// @ts-ignore
decode(),
async (source: AsyncIterable<string>) => {
try {
for await (const msg of source) {
try {
onIncomingParticle(msg);
} catch (e) {
log.error('error on handling a new incoming message: ' + e);
}
}
} catch (e) {
log.debug('connection closed: ' + e);
}
},
);
});
log.debug(`dialing to the node with client's address: ` + this._lib2p2Peer.peerId.toB58String());
try {

View File

@ -14,10 +14,10 @@
* limitations under the License.
*/
import { Multiaddr } from 'multiaddr';
import type { MultiaddrInput } from 'multiaddr';
import { CallServiceData, CallServiceResult, GenericCallServiceHandler, ResultCodes } from './commonTypes';
import { PeerIdB58 } from './commonTypes';
import { FluenceConnection } from './FluenceConnection';
import { RelayConnection, FluenceConnection } from './FluenceConnection';
import { Particle, ParticleExecutionStage, ParticleQueueItem } from './Particle';
import { KeyPair } from './KeyPair';
import { throwIfNotSupported, dataToString, jsonify, MarineLoglevel, marineLogLevelToEnvs } from './utils';
@ -42,6 +42,8 @@ type Node = {
const DEFAULT_TTL = 7000;
export type ConnectionOption = string | MultiaddrInput | Node;
/**
* Configuration used when initiating Fluence Peer
*/
@ -52,9 +54,10 @@ export interface PeerConfig {
* - string: multiaddr in string format
* - Multiaddr: multiaddr object, @see https://github.com/multiformats/js-multiaddr
* - Node: node structure, @see Node
* - Implementation of FluenceConnection class, @see FluenceConnection
* If not specified the will work locally and would not be able to send or receive particles.
*/
connectTo?: string | Multiaddr | Node;
connectTo?: ConnectionOption;
/**
* @deprecated. AVM run through marine-js infrastructure.
@ -141,7 +144,13 @@ export interface PeerConfig {
}
/**
* Information about Fluence Peer connection
* Information about Fluence Peer connection.
* Represented as object with the following keys:
* - `isInitialized`: Is the peer initialized or not.
* - `peerId`: Peer Id of the peer. Null if the peer is not initialized
* - `isConnected`: Is the peer connected to network or not
* - `relayPeerId`: Peer Id of the relay the peer is connected to. If the connection is direct relayPeerId is null
* - `isDirect`: True if the peer is connected to the network directly (not through relay)
*/
export type PeerStatus =
| {
@ -161,6 +170,13 @@ export type PeerStatus =
peerId: PeerIdB58;
isConnected: true;
relayPeerId: PeerIdB58;
}
| {
isInitialized: true;
peerId: PeerIdB58;
isConnected: true;
isDirect: true;
relayPeerId: null;
};
/**
@ -191,7 +207,7 @@ export class FluencePeer {
};
}
if (this._connection === undefined || this._relayPeerId === null) {
if (this._connection === undefined) {
return {
isInitialized: true,
peerId: this._keyPair.Libp2pPeerId.toB58String(),
@ -200,11 +216,21 @@ export class FluencePeer {
};
}
if (this._connection.relayPeerId === null) {
return {
isInitialized: true,
peerId: this._keyPair.Libp2pPeerId.toB58String(),
isConnected: true,
relayPeerId: this._relayPeerId,
isDirect: true,
relayPeerId: null,
};
}
return {
isInitialized: true,
peerId: this._keyPair.Libp2pPeerId.toB58String(),
isConnected: true,
relayPeerId: this._connection.relayPeerId,
};
}
@ -213,73 +239,17 @@ export class FluencePeer {
* and (optionally) connect to the Fluence network
* @param config - object specifying peer configuration
*/
async start(config?: PeerConfig): Promise<void> {
async start(config: PeerConfig = {}): Promise<void> {
throwIfNotSupported();
const keyPair = config.KeyPair ?? (await KeyPair.randomEd25519());
const newConfig = { ...config, KeyPair: keyPair };
const keyPair = config?.KeyPair ?? (await KeyPair.randomEd25519());
this._keyPair = keyPair;
await this.init(newConfig);
const peerId = keyPair.Libp2pPeerId.toB58String();
if (config?.debug?.printParticleId) {
this._printParticleId = true;
const conn = await configToConnection(newConfig.KeyPair, config?.connectTo, config?.dialTimeoutMs);
if (conn !== null) {
await this.connect(conn);
}
this._defaultTTL = config?.defaultTtlMs ?? DEFAULT_TTL;
if (config?.debug?.marineLogLevel) {
this._marineLogLevel = config.debug.marineLogLevel;
}
this._fluenceAppService = new FluenceAppService(config?.marineJS?.workerScriptPath);
const marineDeps = config?.marineJS
? await loadMarineAndAvm(config.marineJS.marineWasmPath, config.marineJS.avmWasmPath)
: await loadDefaults();
await this._fluenceAppService.init(marineDeps.marine);
await this._fluenceAppService.createService(
marineDeps.avm,
'avm',
undefined,
marineLogLevelToEnvs(this._marineLogLevel),
);
this._avmRunner = config?.avmRunner || new AVM(this._fluenceAppService);
await this._avmRunner.init(config?.avmLogLevel || 'off');
if (config?.connectTo) {
let connectToMultiAddr: Multiaddr;
const fromNode = (config.connectTo as any).multiaddr;
if (fromNode) {
connectToMultiAddr = new Multiaddr(fromNode);
} else {
connectToMultiAddr = new Multiaddr(config.connectTo as string);
}
this._relayPeerId = connectToMultiAddr.getPeerId();
if (this._connection) {
await this._connection.disconnect();
}
this._connection = await FluenceConnection.createConnection({
peerId: this._keyPair.Libp2pPeerId,
relayAddress: connectToMultiAddr,
dialTimeoutMs: config.dialTimeoutMs,
onIncomingParticle: (p) => this._incomingParticles.next({ particle: p, onStageChange: () => {} }),
});
await this._connect();
}
registerDefaultServices(this);
this._classServices = {
sig: new Sig(this._keyPair),
};
this._classServices.sig.securityGuard = defaultSigGuard(peerId);
registerSig(this, this._classServices.sig);
registerSig(this, peerId, this._classServices.sig);
this._startParticleProcessing();
}
getServices() {
@ -331,9 +301,8 @@ export class FluencePeer {
*/
async stop() {
this._keyPair = undefined; // This will set peer to non-initialized state and stop particle processing
this._relayPeerId = null;
this._stopParticleProcessing();
await this._disconnect();
await this.disconnect();
await this._avmRunner?.terminate();
await this._fluenceAppService?.terminate();
this._avmRunner = undefined;
@ -348,7 +317,7 @@ export class FluencePeer {
// internal api
/**
* Is not intended to be used manually. Subject to change
* @private Is not intended to be used manually. Subject to change
*/
get internals() {
return {
@ -453,22 +422,79 @@ export class FluencePeer {
};
}
/**
* @private Subject to change. Do not use this method directly
*/
async init(config: PeerConfig & Required<Pick<PeerConfig, 'KeyPair'>>) {
this._keyPair = config.KeyPair;
const peerId = this._keyPair.Libp2pPeerId.toB58String();
if (config?.debug?.printParticleId) {
this._printParticleId = true;
}
this._defaultTTL = config?.defaultTtlMs ?? DEFAULT_TTL;
if (config?.debug?.marineLogLevel) {
this._marineLogLevel = config.debug.marineLogLevel;
}
this._fluenceAppService = new FluenceAppService(config?.marineJS?.workerScriptPath);
const marineDeps = config?.marineJS
? await loadMarineAndAvm(config.marineJS.marineWasmPath, config.marineJS.avmWasmPath)
: await loadDefaults();
await this._fluenceAppService.init(marineDeps.marine);
await this._fluenceAppService.createService(
marineDeps.avm,
'avm',
undefined,
marineLogLevelToEnvs(this._marineLogLevel),
);
this._avmRunner = config?.avmRunner || new AVM(this._fluenceAppService);
await this._avmRunner.init(config?.avmLogLevel || 'off');
registerDefaultServices(this);
this._classServices = {
sig: new Sig(this._keyPair),
};
this._classServices.sig.securityGuard = defaultSigGuard(peerId);
registerSig(this, this._classServices.sig);
registerSig(this, peerId, this._classServices.sig);
this._startParticleProcessing();
}
/**
* @private Subject to change. Do not use this method directly
*/
async connect(connection: FluenceConnection): Promise<void> {
if (this._connection) {
await this._connection.disconnect();
}
this._connection = connection;
await this._connection.connect(this._onIncomingParticle.bind(this));
}
/**
* @private Subject to change. Do not use this method directly
*/
async disconnect(): Promise<void> {
if (this._connection) {
await this._connection.disconnect();
this._connection = undefined;
}
}
// private
// TODO:: make public when full connection\disconnection cycle is implemented properly
private _connect(): Promise<void> {
return this._connection?.connect() || Promise.resolve();
}
// TODO:: make public when full connection\disconnection cycle is implemented properly
private _disconnect(): Promise<void> {
return this._connection?.disconnect() || Promise.resolve();
}
// Queues for incoming and outgoing particles
private _incomingParticles = new Subject<ParticleQueueItem>();
private _outgoingParticles = new Subject<ParticleQueueItem>();
private _outgoingParticles = new Subject<ParticleQueueItem & { nextPeerIds: PeerIdB58[] }>();
// Call service handler
@ -489,7 +515,6 @@ export class FluencePeer {
private _printParticleId = false;
private _defaultTTL: number = DEFAULT_TTL;
private _relayPeerId: PeerIdB58 | null = null;
private _keyPair: KeyPair | undefined;
private _connection?: FluenceConnection;
@ -501,6 +526,11 @@ export class FluencePeer {
private _timeouts: Array<NodeJS.Timeout> = [];
private _particleQueues = new Map<string, Subject<ParticleQueueItem>>();
private _onIncomingParticle(p: string) {
const particle = Particle.fromString(p);
this._incomingParticles.next({ particle, onStageChange: () => {} });
}
private _startParticleProcessing() {
this._incomingParticles
.pipe(
@ -538,7 +568,8 @@ export class FluencePeer {
item.onStageChange({ stage: 'sendingError' });
return;
}
this._connection.sendParticle(item.particle).then(
item.particle.logTo('debug', 'sending particle:');
this._connection.sendParticle(item.nextPeerIds, item.particle.toString()).then(
() => {
item.onStageChange({ stage: 'sent' });
},
@ -612,7 +643,11 @@ export class FluencePeer {
if (item.result.nextPeerPks.length > 0) {
const newParticle = item.particle.clone();
newParticle.data = item.newData;
this._outgoingParticles.next({ ...item, particle: newParticle });
this._outgoingParticles.next({
...item,
particle: newParticle,
nextPeerIds: item.result.nextPeerPks,
});
}
// execute call requests if needed
@ -735,6 +770,38 @@ export class FluencePeer {
}
}
async function configToConnection(
keyPair: KeyPair,
connection?: ConnectionOption,
dialTimeoutMs?: number,
): Promise<FluenceConnection | null> {
if (!connection) {
return null;
}
if (connection instanceof FluenceConnection) {
return connection;
}
let connectToMultiAddr: MultiaddrInput;
// figuring out what was specified as input
const tmp = connection as any;
if (tmp.multiaddr !== undefined) {
// specified as FluenceNode (object with multiaddr and peerId props)
connectToMultiAddr = tmp.multiaddr;
} else {
// specified as MultiaddrInput
connectToMultiAddr = tmp;
}
const res = await RelayConnection.createConnection({
peerId: keyPair.Libp2pPeerId,
relayAddress: connectToMultiAddr,
dialTimeoutMs: dialTimeoutMs,
});
return res;
}
function isInterpretationSuccessful(result: InterpreterResult) {
return result.retCode === 0;
}

View File

@ -16,6 +16,7 @@
import * as PeerId from 'peer-id';
import { keys } from 'libp2p-crypto';
import { toUint8Array } from 'js-base64';
export class KeyPair {
/**
@ -67,3 +68,8 @@ export class KeyPair {
return this.Libp2pPeerId.privKey.public.verify(data, signature);
}
}
export const keyPairFromBase64Sk = (sk: string): Promise<KeyPair> => {
const arr = toUint8Array(sk);
return KeyPair.fromEd25519SK(arr);
};

View File

@ -43,7 +43,12 @@ const errorNotImpl = (methodName: string) => {
export const builtInServices: Record<string, Record<string, GenericCallServiceHandler>> = {
peer: {
identify: () => {
return errorNotImpl('peer.identify');
return success({
external_addresses: [],
// TODO: remove hardcoded values
node_version: 'js-0.23.0',
air_version: 'js-0.24.2',
});
},
timestamp_ms: () => {

245
src/internal/ephemeral.ts Normal file
View File

@ -0,0 +1,245 @@
import { PeerIdB58 } from './commonTypes';
import { FluenceConnection, ParticleHandler } from './FluenceConnection';
import { FluencePeer } from '../index';
import { keyPairFromBase64Sk } from './KeyPair';
import log from 'loglevel';
interface EphemeralConfig {
peers: Array<{
peerId: PeerIdB58;
sk: string;
}>;
}
interface PeerAdapter {
isEphemeral: boolean;
peer: FluencePeer;
peerId: PeerIdB58;
onIncoming: ParticleHandler;
connections: Set<PeerIdB58>;
}
export const defaultConfig = {
peers: [
{
peerId: '12D3KooWJankP2PcEDYCZDdJ26JsU8BMRfdGWyGqbtFiWyoKVtmx',
sk: 'dWNAHhDVuFj9bEieILMu6TcCFRxBJdOPIvAWmf4sZQI=',
},
{
peerId: '12D3KooWSBTB5sYxdwayUyTnqopBwABsnGFY3p4dTx5hABYDtJjV',
sk: 'dOmaxAeu4Th+MJ22vRDLMFTNbiDgKNXar9fW9ofAMgQ=',
},
{
peerId: '12D3KooWQjwf781DJ41moW5RrZXypLdnTbo6aMsoA8QLctGGX8RB',
sk: 'TgzaLlxXuOMDNuuuTKEHUKsW0jM4AmX0gahFvkB1KgE=',
},
{
peerId: '12D3KooWCXWTLFyY1mqKnNAhLQTsjW1zqDzCMbUs8M4a8zdz28HK',
sk: 'hiO2Ta8g2ibMQ7iu5yj9CfN+qQCwE8oRShjr7ortKww=',
},
{
peerId: '12D3KooWPmZpf4ng6GMS39HLagxsXbjiTPLH5CFJpFAHyN6amw6V',
sk: 'LzJtOHTqxfrlHDW40BKiLfjai8JU4yW6/s2zrXLCcQE=',
},
{
peerId: '12D3KooWKrx8PZxM1R9A8tp2jmrFf6c6q1ZQiWfD4QkNgh7fWSoF',
sk: 'XMhlk/xr1FPcp7sKQhS18doXlq1x16EMhBC2NGW2LQ4=',
},
{
peerId: '12D3KooWCbJHvnzSZEXjR1UJmtSUozuJK13iRiCYHLN1gjvm4TZZ',
sk: 'KXPAIqxrSHr7v0ngv3qagcqivFvnQ0xd3s1/rKmi8QU=',
},
{
peerId: '12D3KooWEvKe7WQHp42W4xhHRgTAWQjtDWyH38uJbLHAsMuTtYvD',
sk: 'GCYMAshGnsrNtrHhuT7ayzh5uCzX99J03PmAXoOcCgw=',
},
{
peerId: '12D3KooWSznSHN3BGrSykBXkLkFsqo9SYB73wVauVdqeuRt562cC',
sk: 'UP+SEuznS0h259VbFquzyOJAQ4W5iIwhP+hd1PmUQQ0=',
},
{
peerId: '12D3KooWF57jwbShfnT3c4dNfRDdGjr6SQ3B71m87UVpEpSWHFwi',
sk: '8dl+Crm5RSh0eh+LqLKwX8/Eo4QLpvIjfD8L0wzX4A4=',
},
{
peerId: '12D3KooWBWrzpSg9nwMLBCa2cJubUjTv63Mfy6PYg9rHGbetaV5C',
sk: 'qolc1FcpJ+vHDon0HeXdUYnstjV1wiVx2p0mjblrfAg=',
},
{
peerId: '12D3KooWNkLVU6juM8oyN2SVq5nBd2kp7Rf4uzJH1hET6vj6G5j6',
sk: 'vN6QzWILTM7hSHp+iGkKxiXcqs8bzlnH3FPaRaDGSQY=',
},
{
peerId: '12D3KooWKo1YwGL5vivPiKJMJS7wjtB6B2nJNdSXPkSABT4NKBUU',
sk: 'YbDQ++bsor2kei7rYAsu2SbyoiOYPRzFRZWnNRUpBgQ=',
},
{
peerId: '12D3KooWLUyBKmmNCyxaPkXoWcUFPcy5qrZsUo2E1tyM6CJmGJvC',
sk: 'ptB9eSFMKudAtHaFgDrRK/1oIMrhBujxbMw2Pzwx/wA=',
},
{
peerId: '12D3KooWAEZXME4KMu9FvLezsJWDbYFe2zyujyMnDT1AgcAxgcCk',
sk: 'xtwTOKgAbDIgkuPf7RKiR7gYyZ1HY4mOgFMv3sOUcAQ=',
},
{
peerId: '12D3KooWEhXetsFVAD9h2dRz9XgFpfidho1TCZVhFrczX8h8qgzY',
sk: '1I2MGuiKG1F4FDMiRihVOcOP2mxzOLWJ99MeexK27A4=',
},
{
peerId: '12D3KooWDBfVNdMyV3hPEF4WLBmx9DwD2t2SYuqZ2mztYmDzZWM1',
sk: 'eqJ4Bp7iN4aBXgPH0ezwSg+nVsatkYtfrXv9obI0YQ0=',
},
{
peerId: '12D3KooWSyY7wiSiR4vbXa1WtZawi3ackMTqcQhEPrvqtagoWPny',
sk: 'UVM3SBJhPYIY/gafpnd9/q/Fn9V4BE9zkgrvF1T7Pgc=',
},
{
peerId: '12D3KooWFZmBMGG9PxTs9s6ASzkLGKJWMyPheA5ruaYc2FDkDTmv',
sk: '8RbZfEVpQhPVuhv64uqxENDuSoyJrslQoSQJznxsTQ0=',
},
{
peerId: '12D3KooWBbhUaqqur6KHPunnKxXjY1daCtqJdy4wRji89LmAkVB4',
sk: 'RbgKmG6soWW9uOi7yRedm+0Qck3f3rw6MSnDP7AcBQs=',
},
],
};
/**
* Ephemeral network implementation.
* Ephemeral network is a virtual network which runs locally and focuses on p2p interaction by removing connectivity layer out of the equation.
*/
export class EphemeralNetwork {
private _peers: Map<PeerIdB58, PeerAdapter> = new Map();
constructor(public readonly config: EphemeralConfig) {}
/**
* Starts the Ephemeral network up
*/
async up(): Promise<void> {
log.debug('Starting ephemeral network up...');
const allPeerIds = this.config.peers.map((x) => x.peerId);
const promises = this.config.peers.map(async (x) => {
const peer = new FluencePeer();
const sendParticle = async (nextPeerIds: string[], particle: string): Promise<void> => {
this._send(peer.getStatus().peerId!, nextPeerIds, particle);
};
const kp = await keyPairFromBase64Sk(x.sk);
if (kp.toB58String() !== x.peerId) {
throw new Error(`Invalid config: peer id ${x.peerId} does not match the secret key ${x.sk}`);
}
await peer.init({
KeyPair: kp,
});
let handler: ParticleHandler | null = null;
const connectionCtor = class extends FluenceConnection {
relayPeerId = null;
async connect(onIncomingParticle: ParticleHandler): Promise<void> {
handler = onIncomingParticle;
}
async disconnect(): Promise<void> {
handler = null;
}
sendParticle = sendParticle;
};
await peer.connect(new connectionCtor());
const peerId = peer.getStatus().peerId!;
const ephPeer: PeerAdapter = {
isEphemeral: true,
connections: new Set(allPeerIds.filter((x) => x !== peerId)),
peer: peer,
peerId: peerId,
onIncoming: handler!,
};
return [peerId, ephPeer] as const;
});
const values = await Promise.all(promises);
this._peers = new Map(values);
log.debug('Ephemeral network started...');
}
/**
* Shuts the ephemeral network down. Will disconnect all connected peers.
*/
async down(): Promise<void> {
log.debug('Shutting down ephemeral network...');
const peers = Array.from(this._peers.entries());
const promises = peers.map(([k, p]) => {
return p.isEphemeral ? p.peer.stop() : p.peer.disconnect();
});
await Promise.all(promises);
this._peers.clear();
log.debug('Ephemeral network shut down');
}
/**
* Gets the FluenceConnection which can be used to connect to the ephemeral networks via the specified relay peer.
*/
getRelayConnection(relay: PeerIdB58, peer: FluencePeer): FluenceConnection {
const me = this;
const relayPeer = this._peers.get(relay);
if (relayPeer === undefined) {
throw new Error(`Relay with peer Id: ${relay} has not been found in ephemeral network`);
}
const connectionCtor = class extends FluenceConnection {
relayPeerId = relay;
async connect(onIncomingParticle: ParticleHandler): Promise<void> {
const peerId = peer.getStatus().peerId!;
me._peers.set(peerId, {
isEphemeral: false,
peer: peer,
onIncoming: onIncomingParticle,
peerId: peerId,
connections: new Set([relay]),
});
relayPeer.connections.add(peerId);
}
async disconnect(): Promise<void> {
const peerId = peer.getStatus().peerId!;
relayPeer.connections.delete(peerId);
me._peers.delete(peerId);
}
async sendParticle(nextPeerIds: string[], particle: string): Promise<void> {
const peerId = peer.getStatus().peerId!;
me._send(peerId, nextPeerIds, particle);
}
};
return new connectionCtor();
}
private async _send(from: PeerIdB58, to: PeerIdB58[], particle: string) {
log.info(`Sending particle from ${from}, to ${JSON.stringify(to)}`);
const peer = this._peers.get(from);
if (peer === undefined) {
log.error(`Peer ${from} cannot be found in ephemeral network`);
return;
}
for (let dest of to) {
if (!peer.connections.has(dest)) {
log.error(`Peer ${from} has no connection with ${dest}`);
continue;
}
const destPeer = this._peers.get(dest);
if (destPeer === undefined) {
log.error(`peer ${destPeer} cannot be found in ephemeral network`);
continue;
}
destPeer.onIncoming(particle);
}
}
}