Merge branch 'master' into libp2p-37 (WIP)
1
docs/.nojekyll
Normal 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.
|
22
docs/assets/highlight.css
Normal 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
Before Width: | Height: | Size: 9.4 KiB After Width: | Height: | Size: 9.4 KiB |
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB |
52
docs/assets/main.js
Normal file
1
docs/assets/search.js
Normal file
1414
docs/assets/style.css
Normal file
Before Width: | Height: | Size: 480 B After Width: | Height: | Size: 480 B |
Before Width: | Height: | Size: 855 B After Width: | Height: | Size: 855 B |
168
docs/index.html
@ -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;">
|
||||
<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>
|
||||
<!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="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>
|
@ -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<ArgName></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'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'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<ArgName> </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'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"><</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">></span><span class="tsd-signature-symbol"> : </span><span class="tsd-signature-type">Record</span><span class="tsd-signature-symbol"><</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">></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'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>
|
@ -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'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'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>
|
@ -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'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'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>
|
@ -20,11 +20,14 @@ import { Libp2p as Lib2p2Peer, createLibp2p } from 'libp2p';
|
||||
import { decode, encode } from 'it-length-prefixed';
|
||||
import { pipe } from 'it-pipe';
|
||||
import { Noise } from '@chainsafe/libp2p-noise';
|
||||
import type { MultiaddrInput } from '@multiformats/multiaddr';
|
||||
import { Multiaddr } from '@multiformats/multiaddr';
|
||||
import type { PeerId } from '@libp2p/interface-peer-id';
|
||||
import type { Connection } from '@libp2p/interface-connection';
|
||||
import * as log from 'loglevel';
|
||||
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';
|
||||
|
||||
@ -46,18 +49,38 @@ export interface FluenceConnectionOptions {
|
||||
* The dialing timeout in milliseconds
|
||||
*/
|
||||
dialTimeoutMs?: number;
|
||||
|
||||
/**
|
||||
* Handler for incoming particles from the connection
|
||||
*/
|
||||
onIncomingParticle: (particle: string) => void;
|
||||
}
|
||||
|
||||
export class FluenceConnection {
|
||||
constructor(private _lib2p2Peer: Lib2p2Peer, private _relayAddress: Multiaddr) {}
|
||||
export type ParticleHandler = (particle: string) => void;
|
||||
|
||||
static async createConnection(options: FluenceConnectionOptions): Promise<FluenceConnection> {
|
||||
const lib2p2Peer = await createLibp2p({
|
||||
/**
|
||||
* 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<RelayConnection> {
|
||||
const transportKey = Websockets.prototype[Symbol.toStringTag];
|
||||
const lib2p2Peer = await Lib2p2Peer.create({
|
||||
peerId: options.peerId,
|
||||
//@ts-ignore
|
||||
transports: [new WebSockets()],
|
||||
@ -69,45 +92,35 @@ export class FluenceConnection {
|
||||
},
|
||||
});
|
||||
|
||||
lib2p2Peer.handle([PROTOCOL_NAME], async (arg: any) => {
|
||||
const { connection, stream } = arg;
|
||||
pipe(
|
||||
// force new line
|
||||
stream.source,
|
||||
// @ts-ignore
|
||||
decode(),
|
||||
async (source: AsyncIterable<string>) => {
|
||||
try {
|
||||
console.log('incoming');
|
||||
for await (const particle of source) {
|
||||
try {
|
||||
options.onIncomingParticle(particle);
|
||||
} catch (e) {
|
||||
log.error('error on handling a new incoming message: ' + e);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
log.debug('connection closed: ' + 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);
|
||||
}
|
||||
|
||||
const relayAddress = options.relayAddress;
|
||||
|
||||
return new FluenceConnection(lib2p2Peer, new Multiaddr(relayAddress));
|
||||
}
|
||||
|
||||
getPeerId(): string {
|
||||
return this._relayAddress.getPeerId()!;
|
||||
return new RelayConnection(
|
||||
// force new line
|
||||
options.peerId.toB58String(),
|
||||
lib2p2Peer,
|
||||
relayMultiaddr,
|
||||
relayPeerId,
|
||||
);
|
||||
}
|
||||
|
||||
async disconnect() {
|
||||
// @ts-ignore
|
||||
await this._lib2p2Peer.unhandle(PROTOCOL_NAME);
|
||||
await this._lib2p2Peer.stop();
|
||||
}
|
||||
|
||||
async sendParticle(particle: string): Promise<void> {
|
||||
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
|
||||
if (this._connection.streams.length !== 1) {
|
||||
@ -124,17 +137,36 @@ export class FluenceConnection {
|
||||
pipe(
|
||||
// force new line
|
||||
[Buffer.from(particle, 'utf8')],
|
||||
// @ts-ignore
|
||||
encode(),
|
||||
sink,
|
||||
);
|
||||
}
|
||||
|
||||
async connect() {
|
||||
// @ts-ignore
|
||||
async connect(onIncomingParticle: ParticleHandler) {
|
||||
await this._lib2p2Peer.start();
|
||||
|
||||
log.debug(`dialing to the node with client's address: ` + this._lib2p2Peer.peerId);
|
||||
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 {
|
||||
|
@ -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:
|
||||
@ -17,18 +9,9 @@ docker run --rm -e RUST_LOG="info" -p 1210:1210 -p 4310:4310 fluencelabs/fluence
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
export const nodes = [
|
||||
{
|
||||
multiaddr: '/ip4/127.0.0.1/tcp/4310/ws/p2p/12D3KooWKEprYXUXqoV5xSBeyqrWLpQLLH4PXfvVkDJtmcqmh5V3',
|
||||
peerId: '12D3KooWKEprYXUXqoV5xSBeyqrWLpQLLH4PXfvVkDJtmcqmh5V3',
|
||||
},
|
||||
];
|
||||
*/
|
||||
|
||||
export const nodes = [
|
||||
{
|
||||
multiaddr: '/dns4/kras-00.fluence.dev/tcp/19990/wss/p2p/12D3KooWSD5PToNiLQwKDXsu8JSysCwUt8BVUJEqCHcDe7P5h45e',
|
||||
peerId: '12D3KooWSD5PToNiLQwKDXsu8JSysCwUt8BVUJEqCHcDe7P5h45e',
|
||||
},
|
||||
];
|
||||
|
33
packages/fluence-js/src/__test__/unit/ast.spec.ts
Normal file
@ -0,0 +1,33 @@
|
||||
import { Fluence } from '../../index';
|
||||
|
||||
describe('Parse ast tests', () => {
|
||||
beforeAll(async () => {
|
||||
await Fluence.start();
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
await Fluence.stop();
|
||||
});
|
||||
|
||||
it('Correct ast should be parsed correctly', async function () {
|
||||
const peer = Fluence.getPeer();
|
||||
const air = `(null)`;
|
||||
const res = await peer.internals.parseAst(air);
|
||||
|
||||
expect(res).toStrictEqual({
|
||||
success: true,
|
||||
data: { Null: null },
|
||||
});
|
||||
});
|
||||
|
||||
it('Incorrect ast should result in corresponding error', async function () {
|
||||
const peer = Fluence.getPeer();
|
||||
const air = `(null`;
|
||||
const res = await peer.internals.parseAst(air);
|
||||
|
||||
expect(res).toStrictEqual({
|
||||
success: false,
|
||||
data: expect.stringContaining('error'),
|
||||
});
|
||||
});
|
||||
});
|
@ -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'),
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
|
81
packages/fluence-js/src/__test__/unit/ephemeral.spec.ts
Normal 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');
|
||||
});
|
||||
});
|
@ -40,14 +40,10 @@ type Node = {
|
||||
multiaddr: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* Enum representing the log level used in Aqua VM.
|
||||
* Possible values: 'info', 'trace', 'debug', 'info', 'warn', 'error', 'off';
|
||||
*/
|
||||
export type MarineLoglevel = LogLevel;
|
||||
|
||||
const DEFAULT_TTL = 7000;
|
||||
|
||||
export type ConnectionOption = string | MultiaddrInput | Node;
|
||||
|
||||
/**
|
||||
* Configuration used when initiating Fluence Peer
|
||||
*/
|
||||
@ -58,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 | MultiaddrInput | Node;
|
||||
connectTo?: ConnectionOption;
|
||||
|
||||
/**
|
||||
* @deprecated. AVM run through marine-js infrastructure.
|
||||
@ -147,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 =
|
||||
| {
|
||||
@ -167,6 +170,13 @@ export type PeerStatus =
|
||||
peerId: PeerIdB58;
|
||||
isConnected: true;
|
||||
relayPeerId: PeerIdB58;
|
||||
}
|
||||
| {
|
||||
isInitialized: true;
|
||||
peerId: PeerIdB58;
|
||||
isConnected: true;
|
||||
isDirect: true;
|
||||
relayPeerId: null;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -197,7 +207,7 @@ export class FluencePeer {
|
||||
};
|
||||
}
|
||||
|
||||
if (this._connection === undefined || this._relayPeerId === null) {
|
||||
if (this._connection === undefined) {
|
||||
return {
|
||||
isInitialized: true,
|
||||
peerId: this._keyPair.libp2pPeerId.toString(),
|
||||
@ -206,11 +216,21 @@ export class FluencePeer {
|
||||
};
|
||||
}
|
||||
|
||||
if (this._connection.relayPeerId === null) {
|
||||
return {
|
||||
isInitialized: true,
|
||||
peerId: this._keyPair.Libp2pPeerId.toB58String(),
|
||||
isConnected: true,
|
||||
isDirect: true,
|
||||
relayPeerId: null,
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
isInitialized: true,
|
||||
peerId: this._keyPair.libp2pPeerId.toString(),
|
||||
isConnected: true,
|
||||
relayPeerId: this._relayPeerId,
|
||||
relayPeerId: this._connection.relayPeerId,
|
||||
};
|
||||
}
|
||||
|
||||
@ -219,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.toString();
|
||||
|
||||
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');
|
||||
this._avmRunner = config?.avmRunner || new AVM(this._fluenceAppService);
|
||||
await this._avmRunner.init(config?.avmLogLevel || 'off');
|
||||
|
||||
if (config?.connectTo) {
|
||||
let connectToMultiAddr: MultiaddrInput;
|
||||
const fromNode = (config.connectTo as any).multiaddr;
|
||||
if (fromNode) {
|
||||
connectToMultiAddr = fromNode;
|
||||
} else {
|
||||
connectToMultiAddr = config.connectTo as string;
|
||||
}
|
||||
|
||||
if (this._connection) {
|
||||
await this._connection.disconnect();
|
||||
}
|
||||
|
||||
this._connection = await FluenceConnection.createConnection({
|
||||
peerId: this._keyPair.libp2pPeerId,
|
||||
relayAddress: connectToMultiAddr,
|
||||
dialTimeoutMs: config.dialTimeoutMs,
|
||||
onIncomingParticle: (p) => {
|
||||
console.log('particle received \\/');
|
||||
console.log(p);
|
||||
const particle = Particle.fromString(p);
|
||||
this._incomingParticles.next({ particle, onStageChange: () => {} });
|
||||
},
|
||||
});
|
||||
|
||||
this._relayPeerId = this._connection!.getPeerId();
|
||||
|
||||
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() {
|
||||
@ -314,8 +278,12 @@ export class FluencePeer {
|
||||
throw new Error(`Service with '${serviceId}' id already exists`);
|
||||
}
|
||||
|
||||
const envs = this._marineLogLevel ? { WASM_LOG: this._marineLogLevel } : undefined;
|
||||
await this._fluenceAppService.createService(wasm, serviceId, undefined, envs);
|
||||
await this._fluenceAppService.createService(
|
||||
wasm,
|
||||
serviceId,
|
||||
undefined,
|
||||
marineLogLevelToEnvs(this._marineLogLevel),
|
||||
);
|
||||
this._marineServices.add(serviceId);
|
||||
}
|
||||
|
||||
@ -333,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;
|
||||
@ -350,10 +317,38 @@ 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 {
|
||||
parseAst: async (air: string): Promise<{ success: boolean; data: any }> => {
|
||||
const status = this.getStatus();
|
||||
|
||||
if (!status.isInitialized) {
|
||||
new Error("Can't use avm: peer is not initialized");
|
||||
}
|
||||
|
||||
const args = JSON.stringify([air]);
|
||||
const rawRes = await this._fluenceAppService!.callService('avm', 'ast', args, undefined);
|
||||
let res;
|
||||
try {
|
||||
res = JSON.parse(rawRes);
|
||||
res = res.result as string;
|
||||
if (res.startsWith('error')) {
|
||||
return {
|
||||
success: false,
|
||||
data: res,
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
success: true,
|
||||
data: JSON.parse(res),
|
||||
};
|
||||
}
|
||||
} catch (err) {
|
||||
throw new Error('Failed to call avm. Raw result: ' + rawRes + '. Error: ' + err);
|
||||
}
|
||||
},
|
||||
createNewParticle: (script: string, ttl: number = this._defaultTTL) => {
|
||||
const status = this.getStatus();
|
||||
|
||||
@ -427,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
|
||||
|
||||
@ -463,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;
|
||||
|
||||
@ -475,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(
|
||||
@ -512,13 +568,8 @@ export class FluencePeer {
|
||||
item.onStageChange({ stage: 'sendingError' });
|
||||
return;
|
||||
}
|
||||
|
||||
item.particle.logTo('debug', 'sending particle:');
|
||||
|
||||
const particleToSend = item.particle.toString();
|
||||
|
||||
/*
|
||||
this._connection.sendParticle(particleToSend).then(
|
||||
this._connection.sendParticle(item.nextPeerIds, item.particle.toString()).then(
|
||||
() => {
|
||||
item.onStageChange({ stage: 'sent' });
|
||||
},
|
||||
@ -526,7 +577,6 @@ export class FluencePeer {
|
||||
log.error(e);
|
||||
},
|
||||
);
|
||||
*/
|
||||
|
||||
this._connection.sendParticle(particleToSend);
|
||||
});
|
||||
@ -595,7 +645,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
|
||||
@ -718,6 +772,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;
|
||||
}
|
||||
|
@ -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: () => {
|
||||
|
@ -19,6 +19,7 @@ import platform from 'platform';
|
||||
|
||||
import { CallServiceData, CallServiceResult, CallServiceResultType, ResultCodes } from './commonTypes';
|
||||
import { FluencePeer } from './FluencePeer';
|
||||
import { LogLevel } from '@fluencelabs/avm';
|
||||
import { ParticleExecutionStage } from './Particle';
|
||||
import Buffer from './Buffer';
|
||||
|
||||
@ -162,3 +163,12 @@ export function throwIfNotSupported() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Enum representing the log level used in Aqua VM.
|
||||
* Possible values: 'info', 'trace', 'debug', 'info', 'warn', 'error', 'off';
|
||||
*/
|
||||
export type MarineLoglevel = LogLevel;
|
||||
|
||||
export const marineLogLevelToEnvs = (marineLogLevel: MarineLoglevel | undefined) =>
|
||||
marineLogLevel ? { WASM_LOG: marineLogLevel } : undefined;
|
||||
|
@ -69,3 +69,8 @@ export class KeyPair {
|
||||
return this.secretKey.public.verify(data, signature);
|
||||
}
|
||||
}
|
||||
|
||||
export const keyPairFromBase64Sk = (sk: string): Promise<KeyPair> => {
|
||||
const arr = toUint8Array(sk);
|
||||
return KeyPair.fromEd25519SK(arr);
|
||||
};
|
||||
|
245
src/internal/ephemeral.ts
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|