feat: Use JS Client instead of old FluenceJS (#37)

This commit is contained in:
Pavel 2023-02-20 23:36:23 +03:00 committed by GitHub
parent 82c9198fb1
commit 488afdb189
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 34486 additions and 4877 deletions

View File

@ -23,10 +23,10 @@ jobs:
- uses: actions/checkout@v2
- name: Use Node.js 15
- name: Use Node.js 16
uses: actions/setup-node@v1
with:
node-version: 15
node-version: 16
- run: npm install
- run: npm run build

View File

@ -11,10 +11,10 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Use Node.js 15
- name: Use Node.js 16
uses: actions/setup-node@v1
with:
node-version: 15
node-version: 16
- run: npm install
- run: npm run prod

3
.gitignore vendored
View File

@ -7,5 +7,4 @@ bundle
.storybook/explorer.js
public/*.wasm
public/runnerScript.*
src/_aqua

View File

@ -1,30 +1,35 @@
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="favicon" type="image/ico" href="images/favicon.ico" />
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Roboto+Mono:wght@200;400;500&display=swap" rel="stylesheet">
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="theme-color" content="#000000">
<!--
<head>
<link rel="favicon" type="image/ico" href="images/favicon.ico" />
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Roboto+Mono:wght@200;400;500&display=swap" rel="stylesheet">
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="theme-color" content="#000000">
<!--
manifest.json provides metadata used when your web app is added to the
homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/
-->
<title>Fluence Network Dashboard</title>
<script src='https://cdn.jsdelivr.net/npm/@fluencelabs/js-client.web.standalone@0.13.3/dist/js-client.min.js'
async></script>
<title>Fluence Network Dashboard</title>
</head>
<body>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-6ZTQKE1D4L"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-6ZTQKE1D4L');
</script>
<script id="env" type="application/json" src="/env/env.json"></script>
<div id="root"></div>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-6ZTQKE1D4L"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() { dataLayer.push(arguments); }
gtag('js', new Date());
gtag('config', 'G-6ZTQKE1D4L');
</script>
<script id="env" type="application/json" src="/env/env.json"></script>
<div id="root"></div>
</body>
</html>
</html>

38454
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -4,15 +4,14 @@
"description": "",
"main": "index.js",
"scripts": {
"postinstall": "copy-avm-public public",
"test": "elm-test",
"start": "npm run dev",
"dev": "webpack-dev-server --hot --colors --port 3000",
"build": "webpack",
"prod": "webpack -p --mode production",
"dev": "npm run compile-aqua && webpack-dev-server --hot --colors --port 3000",
"build": "npm run compile-aqua && webpack",
"prod": "npm run compile-aqua && webpack -p --mode production",
"analyse": "elm-analyse -s -p 3001 -o",
"compile-aqua": "aqua --js -i ./aqua/ -o ./src/_aqua",
"watch-aqua": "chokidar \"**/*.aqua\" -c \"npm run compile-aqua\"",
"compile-aqua": "fluence aqua --js -i ./aqua/ -o ./src/_aqua",
"watch-aqua": "fluence aqua --js -w -i ./aqua/ -o ./src/_aqua",
"uie": "elm-live src_storybook/Explorer.elm --open --dir=.storybook --start-page=index.html -- --output=.storybook/explorer.js --debug"
},
"nodemonConfig": {
@ -32,8 +31,8 @@
},
"homepage": "https://github.com/fluencelabs/fluence-admin#readme",
"dependencies": {
"@fluencelabs/fluence": "0.19.0",
"@fluencelabs/fluence-network-environment": "1.0.10",
"@fluencelabs/js-client.api": "0.11.3",
"@fluencelabs/fluence-network-environment": "1.0.14",
"css-spinners": "^1.0.1",
"tachyons": "^4.12.0",
"yup": "^0.32.9"
@ -41,7 +40,7 @@
"devDependencies": {
"@babel/core": "^7.11.6",
"@babel/preset-env": "^7.11.5",
"@fluencelabs/aqua": "0.6.0-263",
"@fluencelabs/cli": "0.2.41",
"@fluencelabs/aqua-lib": "0.3.3",
"@types/yup": "^0.29.11",
"babel-loader": "^8.1.0",
@ -61,7 +60,7 @@
"google-closure-compiler": "^20200920.0.0",
"html-webpack-plugin": "^4.5.0",
"mini-css-extract-plugin": "^0.11.2",
"node-sass": "^4.14.1",
"sass": "1.58.3",
"optimize-css-assets-webpack-plugin": "^5.0.4",
"resolve-url-loader": "^3.1.1",
"sass-loader": "^10.0.2",

90
src/_aqua/app.d.ts vendored
View File

@ -1,90 +0,0 @@
/**
*
* This file is auto-generated. Do not edit manually: changes may be erased.
* Generated by Aqua compiler: https://github.com/fluencelabs/aqua/.
* If you find any bugs, please write an issue on GitHub: https://github.com/fluencelabs/aqua/issues
* Aqua version: 0.6.0-263
*
*/
import { Fluence, FluencePeer } from '@fluencelabs/fluence';
import {
CallParams,
callFunction,
registerService,
} from '@fluencelabs/fluence/dist/internal/compilerSupport/v2';
// Services
// Functions
export function askAllAndSend(
peer_: string,
collectPeerInfo: (arg0: string, arg1: { air_version: string; external_addresses: string[]; node_version: string; }, arg2: { blueprint_id: string; id: string; owner_id: string; }[], arg3: { dependencies: string[]; id: string; name: string; }[], arg4: { config: { name: string; }; hash: string; name: string; }[], callParams: CallParams<'arg0' | 'arg1' | 'arg2' | 'arg3' | 'arg4'>) => void | Promise<void>,
collectServiceInterface: (arg0: string, arg1: string, arg2: { function_signatures: { arguments: string[][]; name: string; output_types: string[]; }[]; record_types: { fields: string[][]; id: number; name: string; }[]; }, callParams: CallParams<'arg0' | 'arg1' | 'arg2'>) => void | Promise<void>,
config?: {ttl?: number}
): Promise<void>;
export function askAllAndSend(
peer: FluencePeer,
peer_: string,
collectPeerInfo: (arg0: string, arg1: { air_version: string; external_addresses: string[]; node_version: string; }, arg2: { blueprint_id: string; id: string; owner_id: string; }[], arg3: { dependencies: string[]; id: string; name: string; }[], arg4: { config: { name: string; }; hash: string; name: string; }[], callParams: CallParams<'arg0' | 'arg1' | 'arg2' | 'arg3' | 'arg4'>) => void | Promise<void>,
collectServiceInterface: (arg0: string, arg1: string, arg2: { function_signatures: { arguments: string[][]; name: string; output_types: string[]; }[]; record_types: { fields: string[][]; id: number; name: string; }[]; }, callParams: CallParams<'arg0' | 'arg1' | 'arg2'>) => void | Promise<void>,
config?: {ttl?: number}
): Promise<void>;
export function getAll(
knownPeers: string[],
collectPeerInfo: (arg0: string, arg1: { air_version: string; external_addresses: string[]; node_version: string; }, arg2: { blueprint_id: string; id: string; owner_id: string; }[], arg3: { dependencies: string[]; id: string; name: string; }[], arg4: { config: { name: string; }; hash: string; name: string; }[], callParams: CallParams<'arg0' | 'arg1' | 'arg2' | 'arg3' | 'arg4'>) => void | Promise<void>,
collectServiceInterface: (arg0: string, arg1: string, arg2: { function_signatures: { arguments: string[][]; name: string; output_types: string[]; }[]; record_types: { fields: string[][]; id: number; name: string; }[]; }, callParams: CallParams<'arg0' | 'arg1' | 'arg2'>) => void | Promise<void>,
config?: {ttl?: number}
): Promise<void>;
export function getAll(
peer: FluencePeer,
knownPeers: string[],
collectPeerInfo: (arg0: string, arg1: { air_version: string; external_addresses: string[]; node_version: string; }, arg2: { blueprint_id: string; id: string; owner_id: string; }[], arg3: { dependencies: string[]; id: string; name: string; }[], arg4: { config: { name: string; }; hash: string; name: string; }[], callParams: CallParams<'arg0' | 'arg1' | 'arg2' | 'arg3' | 'arg4'>) => void | Promise<void>,
collectServiceInterface: (arg0: string, arg1: string, arg2: { function_signatures: { arguments: string[][]; name: string; output_types: string[]; }[]; record_types: { fields: string[][]; id: number; name: string; }[]; }, callParams: CallParams<'arg0' | 'arg1' | 'arg2'>) => void | Promise<void>,
config?: {ttl?: number}
): Promise<void>;
export function findAndAskNeighboursSchema(
relayPeerId: string,
clientId: string,
collectPeerInfo: (arg0: string, arg1: { air_version: string; external_addresses: string[]; node_version: string; }, arg2: { blueprint_id: string; id: string; owner_id: string; }[], arg3: { dependencies: string[]; id: string; name: string; }[], arg4: { config: { name: string; }; hash: string; name: string; }[], callParams: CallParams<'arg0' | 'arg1' | 'arg2' | 'arg3' | 'arg4'>) => void | Promise<void>,
collectServiceInterface: (arg0: string, arg1: string, arg2: { function_signatures: { arguments: string[][]; name: string; output_types: string[]; }[]; record_types: { fields: string[][]; id: number; name: string; }[]; }, callParams: CallParams<'arg0' | 'arg1' | 'arg2'>) => void | Promise<void>,
config?: {ttl?: number}
): Promise<void>;
export function findAndAskNeighboursSchema(
peer: FluencePeer,
relayPeerId: string,
clientId: string,
collectPeerInfo: (arg0: string, arg1: { air_version: string; external_addresses: string[]; node_version: string; }, arg2: { blueprint_id: string; id: string; owner_id: string; }[], arg3: { dependencies: string[]; id: string; name: string; }[], arg4: { config: { name: string; }; hash: string; name: string; }[], callParams: CallParams<'arg0' | 'arg1' | 'arg2' | 'arg3' | 'arg4'>) => void | Promise<void>,
collectServiceInterface: (arg0: string, arg1: string, arg2: { function_signatures: { arguments: string[][]; name: string; output_types: string[]; }[]; record_types: { fields: string[][]; id: number; name: string; }[]; }, callParams: CallParams<'arg0' | 'arg1' | 'arg2'>) => void | Promise<void>,
config?: {ttl?: number}
): Promise<void>;
export function collectServiceInterfaces(
peer_: string,
services: { blueprint_id: string; id: string; owner_id: string; }[],
collectServiceInterface: (arg0: string, arg1: string, arg2: { function_signatures: { arguments: string[][]; name: string; output_types: string[]; }[]; record_types: { fields: string[][]; id: number; name: string; }[]; }, callParams: CallParams<'arg0' | 'arg1' | 'arg2'>) => void | Promise<void>,
config?: {ttl?: number}
): Promise<void>;
export function collectServiceInterfaces(
peer: FluencePeer,
peer_: string,
services: { blueprint_id: string; id: string; owner_id: string; }[],
collectServiceInterface: (arg0: string, arg1: string, arg2: { function_signatures: { arguments: string[][]; name: string; output_types: string[]; }[]; record_types: { fields: string[][]; id: number; name: string; }[]; }, callParams: CallParams<'arg0' | 'arg1' | 'arg2'>) => void | Promise<void>,
config?: {ttl?: number}
): Promise<void>;

View File

@ -1,710 +0,0 @@
/**
*
* This file is auto-generated. Do not edit manually: changes may be erased.
* Generated by Aqua compiler: https://github.com/fluencelabs/aqua/.
* If you find any bugs, please write an issue on GitHub: https://github.com/fluencelabs/aqua/issues
* Aqua version: 0.6.0-263
*
*/
import { Fluence, FluencePeer } from '@fluencelabs/fluence';
import {
CallParams,
callFunction,
registerService,
} from '@fluencelabs/fluence/dist/internal/compilerSupport/v2';
// Services
// Functions
export function askAllAndSend(...args) {
let script = `
(xor
(seq
(seq
(seq
(call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-)
(call %init_peer_id% ("getDataSrv" "peer") [] peer)
)
(call -relay- ("op" "noop") [])
)
(xor
(seq
(seq
(seq
(seq
(seq
(seq
(seq
(call peer ("peer" "identify") [] ident)
(call peer ("dist" "list_blueprints") [] blueprints)
)
(call peer ("dist" "list_modules") [] modules)
)
(call peer ("srv" "list") [] services)
)
(call -relay- ("op" "noop") [])
)
(xor
(seq
(call %init_peer_id% ("callbackSrv" "collectPeerInfo") [peer ident services blueprints modules])
(call -relay- ("op" "noop") [])
)
(seq
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
(call -relay- ("op" "noop") [])
)
)
)
(par
(fold services srv
(par
(xor
(seq
(seq
(call peer ("srv" "get_interface") [srv.$.id!] iface)
(call -relay- ("op" "noop") [])
)
(xor
(call %init_peer_id% ("callbackSrv" "collectServiceInterface") [peer srv.$.id! iface])
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 2])
)
)
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 3])
)
(next srv)
)
)
(null)
)
)
(call -relay- ("op" "noop") [])
)
(seq
(call -relay- ("op" "noop") [])
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 4])
)
)
)
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 5])
)
`
return callFunction(
args,
{
"functionName" : "askAllAndSend",
"returnType" : {
"tag" : "void"
},
"argDefs" : [
{
"name" : "peer",
"argType" : {
"tag" : "primitive"
}
},
{
"name" : "collectPeerInfo",
"argType" : {
"tag" : "callback",
"callback" : {
"argDefs" : [
{
"name" : "arg0",
"argType" : {
"tag" : "primitive"
}
},
{
"name" : "arg1",
"argType" : {
"tag" : "primitive"
}
},
{
"name" : "arg2",
"argType" : {
"tag" : "primitive"
}
},
{
"name" : "arg3",
"argType" : {
"tag" : "primitive"
}
},
{
"name" : "arg4",
"argType" : {
"tag" : "primitive"
}
}
],
"returnType" : {
"tag" : "void"
}
}
}
},
{
"name" : "collectServiceInterface",
"argType" : {
"tag" : "callback",
"callback" : {
"argDefs" : [
{
"name" : "arg0",
"argType" : {
"tag" : "primitive"
}
},
{
"name" : "arg1",
"argType" : {
"tag" : "primitive"
}
},
{
"name" : "arg2",
"argType" : {
"tag" : "primitive"
}
}
],
"returnType" : {
"tag" : "void"
}
}
}
}
],
"names" : {
"relay" : "-relay-",
"getDataSrv" : "getDataSrv",
"callbackSrv" : "callbackSrv",
"responseSrv" : "callbackSrv",
"responseFnName" : "response",
"errorHandlingSrv" : "errorHandlingSrv",
"errorFnName" : "error"
}
},
script
)
}
export function getAll(...args) {
let script = `
(xor
(seq
(seq
(seq
(call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-)
(call %init_peer_id% ("getDataSrv" "knownPeers") [] knownPeers)
)
(call -relay- ("op" "noop") [])
)
(xor
(par
(fold knownPeers peer
(par
(xor
(seq
(seq
(seq
(seq
(seq
(seq
(call peer ("peer" "identify") [] ident)
(call peer ("dist" "list_blueprints") [] blueprints)
)
(call peer ("dist" "list_modules") [] modules)
)
(call peer ("srv" "list") [] services)
)
(call -relay- ("op" "noop") [])
)
(xor
(seq
(call %init_peer_id% ("callbackSrv" "collectPeerInfo") [peer ident services blueprints modules])
(call -relay- ("op" "noop") [])
)
(seq
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
(call -relay- ("op" "noop") [])
)
)
)
(par
(fold services srv
(par
(xor
(seq
(seq
(call peer ("srv" "get_interface") [srv.$.id!] iface)
(call -relay- ("op" "noop") [])
)
(xor
(call %init_peer_id% ("callbackSrv" "collectServiceInterface") [peer srv.$.id! iface])
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 2])
)
)
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 3])
)
(next srv)
)
)
(null)
)
)
(seq
(call -relay- ("op" "noop") [])
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 4])
)
)
(next peer)
)
)
(null)
)
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 5])
)
)
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 6])
)
`
return callFunction(
args,
{
"functionName" : "getAll",
"returnType" : {
"tag" : "void"
},
"argDefs" : [
{
"name" : "knownPeers",
"argType" : {
"tag" : "primitive"
}
},
{
"name" : "collectPeerInfo",
"argType" : {
"tag" : "callback",
"callback" : {
"argDefs" : [
{
"name" : "arg0",
"argType" : {
"tag" : "primitive"
}
},
{
"name" : "arg1",
"argType" : {
"tag" : "primitive"
}
},
{
"name" : "arg2",
"argType" : {
"tag" : "primitive"
}
},
{
"name" : "arg3",
"argType" : {
"tag" : "primitive"
}
},
{
"name" : "arg4",
"argType" : {
"tag" : "primitive"
}
}
],
"returnType" : {
"tag" : "void"
}
}
}
},
{
"name" : "collectServiceInterface",
"argType" : {
"tag" : "callback",
"callback" : {
"argDefs" : [
{
"name" : "arg0",
"argType" : {
"tag" : "primitive"
}
},
{
"name" : "arg1",
"argType" : {
"tag" : "primitive"
}
},
{
"name" : "arg2",
"argType" : {
"tag" : "primitive"
}
}
],
"returnType" : {
"tag" : "void"
}
}
}
}
],
"names" : {
"relay" : "-relay-",
"getDataSrv" : "getDataSrv",
"callbackSrv" : "callbackSrv",
"responseSrv" : "callbackSrv",
"responseFnName" : "response",
"errorHandlingSrv" : "errorHandlingSrv",
"errorFnName" : "error"
}
},
script
)
}
export function findAndAskNeighboursSchema(...args) {
let script = `
(xor
(seq
(seq
(seq
(seq
(call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-)
(call %init_peer_id% ("getDataSrv" "relayPeerId") [] relayPeerId)
)
(call %init_peer_id% ("getDataSrv" "clientId") [] clientId)
)
(call -relay- ("op" "noop") [])
)
(xor
(seq
(seq
(call relayPeerId ("kad" "neighborhood") [clientId [] []] neighbors)
(par
(fold neighbors n
(par
(xor
(seq
(call n ("kad" "neighborhood") [clientId [] []] neighbors2)
(par
(fold neighbors2 n2
(par
(seq
(call -relay- ("op" "noop") [])
(xor
(seq
(seq
(seq
(seq
(seq
(seq
(call n2 ("peer" "identify") [] ident)
(call n2 ("dist" "list_blueprints") [] blueprints)
)
(call n2 ("dist" "list_modules") [] modules)
)
(call n2 ("srv" "list") [] services)
)
(call -relay- ("op" "noop") [])
)
(xor
(seq
(call %init_peer_id% ("callbackSrv" "collectPeerInfo") [n2 ident services blueprints modules])
(call -relay- ("op" "noop") [])
)
(seq
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
(call -relay- ("op" "noop") [])
)
)
)
(par
(fold services srv
(par
(xor
(seq
(seq
(call n2 ("srv" "get_interface") [srv.$.id!] iface)
(call -relay- ("op" "noop") [])
)
(xor
(call %init_peer_id% ("callbackSrv" "collectServiceInterface") [n2 srv.$.id! iface])
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 2])
)
)
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 3])
)
(next srv)
)
)
(null)
)
)
(seq
(call -relay- ("op" "noop") [])
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 4])
)
)
)
(next n2)
)
)
(null)
)
)
(seq
(call -relay- ("op" "noop") [])
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 5])
)
)
(next n)
)
)
(null)
)
)
(call -relay- ("op" "noop") [])
)
(seq
(call -relay- ("op" "noop") [])
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 6])
)
)
)
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 7])
)
`
return callFunction(
args,
{
"functionName" : "findAndAskNeighboursSchema",
"returnType" : {
"tag" : "void"
},
"argDefs" : [
{
"name" : "relayPeerId",
"argType" : {
"tag" : "primitive"
}
},
{
"name" : "clientId",
"argType" : {
"tag" : "primitive"
}
},
{
"name" : "collectPeerInfo",
"argType" : {
"tag" : "callback",
"callback" : {
"argDefs" : [
{
"name" : "arg0",
"argType" : {
"tag" : "primitive"
}
},
{
"name" : "arg1",
"argType" : {
"tag" : "primitive"
}
},
{
"name" : "arg2",
"argType" : {
"tag" : "primitive"
}
},
{
"name" : "arg3",
"argType" : {
"tag" : "primitive"
}
},
{
"name" : "arg4",
"argType" : {
"tag" : "primitive"
}
}
],
"returnType" : {
"tag" : "void"
}
}
}
},
{
"name" : "collectServiceInterface",
"argType" : {
"tag" : "callback",
"callback" : {
"argDefs" : [
{
"name" : "arg0",
"argType" : {
"tag" : "primitive"
}
},
{
"name" : "arg1",
"argType" : {
"tag" : "primitive"
}
},
{
"name" : "arg2",
"argType" : {
"tag" : "primitive"
}
}
],
"returnType" : {
"tag" : "void"
}
}
}
}
],
"names" : {
"relay" : "-relay-",
"getDataSrv" : "getDataSrv",
"callbackSrv" : "callbackSrv",
"responseSrv" : "callbackSrv",
"responseFnName" : "response",
"errorHandlingSrv" : "errorHandlingSrv",
"errorFnName" : "error"
}
},
script
)
}
export function collectServiceInterfaces(...args) {
let script = `
(xor
(seq
(seq
(seq
(call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-)
(call %init_peer_id% ("getDataSrv" "peer") [] peer)
)
(call %init_peer_id% ("getDataSrv" "services") [] services)
)
(par
(fold services srv
(par
(seq
(call -relay- ("op" "noop") [])
(xor
(seq
(seq
(call peer ("srv" "get_interface") [srv.$.id!] iface)
(call -relay- ("op" "noop") [])
)
(xor
(call %init_peer_id% ("callbackSrv" "collectServiceInterface") [peer srv.$.id! iface])
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
)
)
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 2])
)
)
(next srv)
)
)
(null)
)
)
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 3])
)
`
return callFunction(
args,
{
"functionName" : "collectServiceInterfaces",
"returnType" : {
"tag" : "void"
},
"argDefs" : [
{
"name" : "peer",
"argType" : {
"tag" : "primitive"
}
},
{
"name" : "services",
"argType" : {
"tag" : "primitive"
}
},
{
"name" : "collectServiceInterface",
"argType" : {
"tag" : "callback",
"callback" : {
"argDefs" : [
{
"name" : "arg0",
"argType" : {
"tag" : "primitive"
}
},
{
"name" : "arg1",
"argType" : {
"tag" : "primitive"
}
},
{
"name" : "arg2",
"argType" : {
"tag" : "primitive"
}
}
],
"returnType" : {
"tag" : "void"
}
}
}
}
],
"names" : {
"relay" : "-relay-",
"getDataSrv" : "getDataSrv",
"callbackSrv" : "callbackSrv",
"responseSrv" : "callbackSrv",
"responseFnName" : "response",
"errorHandlingSrv" : "errorHandlingSrv",
"errorFnName" : "error"
}
},
script
)
}

View File

@ -20,16 +20,16 @@ import './main.css';
// eslint-disable-next-line import/no-extraneous-dependencies
import log from 'loglevel';
import Multiaddr from 'multiaddr';
import { stage, krasnodar, testNet } from '@fluencelabs/fluence-network-environment';
import { Fluence, KeyPair, setLogLevel } from '@fluencelabs/fluence';
import { stage, kras, testNet } from '@fluencelabs/fluence-network-environment';
import { Fluence } from '@fluencelabs/js-client.api';
import { Elm } from './Main.elm';
import * as serviceWorker from './serviceWorker';
import { interfaceInfo, peerInfo } from './types';
import { askAllAndSend, getAll } from './_aqua/app';
const defaultNetworkName = 'testNet + krasnodar';
const defaultNetworkName = 'testNet + kras';
const relays = [...krasnodar, ...stage];
const relays = [...kras, ...stage];
const defaultEnv = {
relays,
@ -115,10 +115,11 @@ function genFlags(peerId, relays, relayIdx) {
(async () => {
const { relays, relayIdx, logLevel } = await initEnvironment();
setLogLevel(logLevel);
const keyPair = await KeyPair.randomEd25519();
await Fluence.start({ connectTo: relays[relayIdx].multiaddr });
const pid = Fluence.getStatus().peerId;
log.setLevel(logLevel);
// it will use random key pair by default
await Fluence.connect(relays[relayIdx].multiaddr);
const client = await Fluence.getClient();
const pid = client.getPeerId();
const flags = genFlags(pid, relays, relayIdx);
console.log(`Own peer id: ${pid}`);
@ -176,7 +177,7 @@ function genFlags(peerId, relays, relayIdx) {
let N = 10;
let sorted = [...servicesPerHost.entries()].sort((a, b) => b[1].size - a[1].size);
console.log(`top ${N} nodes by hosted services:`)
console.log(`top ${N} nodes by hosted services:`);
let slice = sorted.slice(0, 10);
for (let entry of slice) {
console.log(`\t node ${entry[0]} has ${entry[1].size} services`);
@ -186,19 +187,19 @@ function genFlags(peerId, relays, relayIdx) {
let byAirVersion = new Map();
for (let info of window.collectedData.peerInfos.values()) {
let byNodeCount = byNodeVersion.get(info.node_version) || 0;
byNodeVersion.set(info.node_version, byNodeCount + 1)
byNodeVersion.set(info.node_version, byNodeCount + 1);
let byAirCount = byAirVersion.get(info.air_version) || 0;
byAirVersion.set(info.air_version, byAirCount + 1)
byAirVersion.set(info.air_version, byAirCount + 1);
}
console.log("Nodes version distribution:");
console.log('Nodes version distribution:');
for (let entry of byNodeVersion.entries()) {
let version = entry[0];
let count = entry[1];
console.log(`\t${version}: ${count} nodes`);
}
console.log("AIR intepreter versions distribution:");
console.log('AIR intepreter versions distribution:');
for (let entry of byAirVersion.entries()) {
let version = entry[0];
let count = entry[1];
@ -233,11 +234,12 @@ function genFlags(peerId, relays, relayIdx) {
window.collectedData.moduleNames.add(module.name);
}
let perCreator = window.collectedData.creators.has(service.owner_id) ? window.collectedData.creators.get(service.owner_id) : new Set();
let perCreator = window.collectedData.creators.has(service.owner_id)
? window.collectedData.creators.get(service.owner_id)
: new Set();
perCreator.add(service.id);
window.collectedData.creators.set(service.owner_id, perCreator);
}
}
}