diff --git a/.gitbook/assets/air_null_6 (1) (2) (2) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (2).png b/.gitbook/assets/air_null_6 (1) (2) (2) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (1) (1).png similarity index 100% rename from .gitbook/assets/air_null_6 (1) (2) (2) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (2).png rename to .gitbook/assets/air_null_6 (1) (2) (2) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (1) (1).png diff --git a/.gitbook/assets/air_null_6 (1) (2) (2) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3).png b/.gitbook/assets/air_null_6 (1) (2) (2) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (1) (2).png similarity index 100% rename from .gitbook/assets/air_null_6 (1) (2) (2) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3).png rename to .gitbook/assets/air_null_6 (1) (2) (2) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (1) (2).png diff --git a/.gitbook/assets/air_null_6 (1) (2) (2) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3).png b/.gitbook/assets/air_null_6 (1) (2) (2) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (1) (3).png similarity index 100% rename from .gitbook/assets/air_null_6 (1) (2) (2) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3).png rename to .gitbook/assets/air_null_6 (1) (2) (2) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (1) (3).png diff --git a/.gitbook/assets/image (18) (1).png b/.gitbook/assets/image (18) (1) (1) (1).png similarity index 100% rename from .gitbook/assets/image (18) (1).png rename to .gitbook/assets/image (18) (1) (1) (1).png diff --git a/.gitbook/assets/image (18) (1) (1) (2).png b/.gitbook/assets/image (18) (1) (1) (2).png new file mode 100644 index 0000000..971b427 Binary files /dev/null and b/.gitbook/assets/image (18) (1) (1) (2).png differ diff --git a/.gitbook/assets/image (38) (1).png b/.gitbook/assets/image (38) (2) (1).png similarity index 100% rename from .gitbook/assets/image (38) (1).png rename to .gitbook/assets/image (38) (2) (1).png diff --git a/.gitbook/assets/image (38).png b/.gitbook/assets/image (38) (2) (2).png similarity index 100% rename from .gitbook/assets/image (38).png rename to .gitbook/assets/image (38) (2) (2).png diff --git a/SUMMARY.md b/SUMMARY.md index 26eedb6..bead570 100644 --- a/SUMMARY.md +++ b/SUMMARY.md @@ -1,32 +1,33 @@ # Table of contents -- [Introduction](README.md) -- [Thinking In Aquamarine](p2p.md) -- [Concepts](concepts.md) -- [Quick Start](quick-start/README.md) - - [1. Browser-to-Browser](quick-start/1.-browser-to-browser-1.md) - - [2. Hosted Services](quick-start/2.-hosted-services.md) - - [3. Browser-to-Service](quick-start/3.-browser-to-service.md) -- [Aquamarine](knowledge_aquamarine/README.md) - - [Aqua](knowledge_aquamarine/hll.md) - - [Marine](knowledge_aquamarine/marine/README.md) - - [Marine CLI](knowledge_aquamarine/marine/marine-cli.md) - - [Marine REPL](knowledge_aquamarine/marine/marine-repl.md) - - [Marine Rust SDK](knowledge_aquamarine/marine/marine-rs-sdk.md) -- [Tools](knowledge_tools.md) -- [Node](node.md) -- [JS SDK](js-sdk/README.md) - - [Concepts](js-sdk/1_concepts.md) - - [Basics](js-sdk/2_basics.md) - - [In-depth](js-sdk/3_in_depth.md) - - [Running app in nodejs](js-sdk/5_run_in_node.md) - - [Running app in browser](js-sdk/4_run_in_browser-1.md) - - [Api reference](js-sdk/6-reference.md) - - [Changelog](js-sdk/changelog.md) -- [Security](knowledge_security.md) -- [Tutorials](tutorials_tutorials/README.md) - - [Setting Up Your Environment](tutorials_tutorials/recipes_setting_up.md) - - [Deploy A Local Fluence Node](tutorials_tutorials/tutorial_run_local_node.md) - - [cUrl As A Service](tutorials_tutorials/curl-as-a-service.md) - - [Add Your Own Builtins](tutorials_tutorials/add-your-own-builtin.md) -- [Research, Papers And References](research-papers-and-references.md) +* [Introduction](README.md) +* [Thinking In Aquamarine](p2p.md) +* [Concepts](concepts.md) +* [Quick Start](quick-start/README.md) + * [1. Browser-to-Browser](quick-start/1.-browser-to-browser-1.md) + * [2. Hosted Services](quick-start/2.-hosted-services.md) + * [3. Browser-to-Service](quick-start/3.-browser-to-service.md) +* [Aquamarine](knowledge_aquamarine/README.md) + * [Aqua](knowledge_aquamarine/hll.md) + * [Marine](knowledge_aquamarine/marine/README.md) + * [Marine CLI](knowledge_aquamarine/marine/marine-cli.md) + * [Marine REPL](knowledge_aquamarine/marine/marine-repl.md) + * [Marine Rust SDK](knowledge_aquamarine/marine/marine-rs-sdk.md) +* [Tools](knowledge_tools.md) +* [Node](node.md) +* [JS SDK](js-sdk/README.md) + * [Concepts](js-sdk/1_concepts.md) + * [Basics](js-sdk/2_basics.md) + * [In-depth](js-sdk/3_in_depth.md) + * [Running app in nodejs](js-sdk/5_run_in_node.md) + * [Running app in browser](js-sdk/4_run_in_browser-1.md) + * [Api reference](js-sdk/6-reference.md) + * [Changelog](js-sdk/changelog.md) +* [Security](knowledge_security.md) +* [Tutorials](tutorials_tutorials/README.md) + * [Setting Up Your Environment](tutorials_tutorials/recipes_setting_up.md) + * [Deploy A Local Fluence Node](tutorials_tutorials/tutorial_run_local_node.md) + * [cUrl As A Service](tutorials_tutorials/curl-as-a-service.md) + * [Add Your Own Builtins](tutorials_tutorials/add-your-own-builtin.md) +* [Research, Papers And References](research-papers-and-references.md) + diff --git a/js-sdk/1_concepts.md b/js-sdk/1_concepts.md index 97ab1b3..ea59e89 100644 --- a/js-sdk/1_concepts.md +++ b/js-sdk/1_concepts.md @@ -31,9 +31,10 @@ To learn more about Aqua see [aqua book](https://doc.fluence.dev/aqua-book/) The building block of the application are: -- Aqua code for peer-to-peer communication -- Compiler cli package for aqua to \(java\)typescript compilation -- Initialization of the `FluencePeer` -- Application specific code \(java\)typescript in the framework of your choice +* Aqua code for peer-to-peer communication +* Compiler cli package for aqua to \(java\)typescript compilation +* Initialization of the `FluencePeer` +* Application specific code \(java\)typescript in the framework of your choice In the next section we see it in action + diff --git a/js-sdk/2_basics.md b/js-sdk/2_basics.md index ad7695d..dfa218f 100644 --- a/js-sdk/2_basics.md +++ b/js-sdk/2_basics.md @@ -147,7 +147,7 @@ async function main() { main(); ``` -\(1\) Import list of possible relay nodes (network enironment) +\(1\) Import list of possible relay nodes \(network enironment\) \(2\) Aqua compiler provides functions which can be directly imported like any normal typescript function. @@ -169,4 +169,5 @@ If everything has been done correctly yuo should see `Hello, world!` in the cons The next secion will cover in-depth and advanced usage JS SDK -The code from this section is available in on (github)[https://github.com/fluencelabs/examples/tree/main/js-sdk-examples/hello-world] +The code from this section is available in on \(github\)\[[https://github.com/fluencelabs/examples/tree/main/js-sdk-examples/hello-world](https://github.com/fluencelabs/examples/tree/main/js-sdk-examples/hello-world)\] + diff --git a/js-sdk/3_in_depth.md b/js-sdk/3_in_depth.md index ce92ece..b69f544 100644 --- a/js-sdk/3_in_depth.md +++ b/js-sdk/3_in_depth.md @@ -8,13 +8,10 @@ In this section we will cover the JS SDK in-depth. `@fluencelabs/fluence` exports a facade `Fluence` which provides all the needed functionality for the most uses cases. It defined 4 functions: -- `start`: Start the default peer. - -- `stop`: Stops the default peer - -- `getStatus`: Gets the status of the default peer. This includes connection - -- `getPeer`: Gets the default Fluence Peer instance (see below) +* `start`: Start the default peer. +* `stop`: Stops the default peer +* `getStatus`: Gets the status of the default peer. This includes connection +* `getPeer`: Gets the default Fluence Peer instance \(see below\) Under the hood `Fluence` facade calls the corresponding method on the default instance of FluencePeer. This instance is passed to the Aqua-compiler generated functions by default. @@ -137,7 +134,7 @@ Aqua compiler emits TypeScript or JavaScript which in turn can be called from a For every exported function definition in aqua the compiler generated two overloads. One accepting the `FluencePeer` instance as the first argument, and one without it. Otherwise arguments are the same and correspond to the arguments of aqua functions. The last argument is always an optional config object with the following properties: -- `ttl`: Optional parameter which specify TTL \(time to live\) of particle with execution logic for the function +* `ttl`: Optional parameter which specify TTL \(time to live\) of particle with execution logic for the function The return type is always a promise of the aqua function return type. If the function does not return anything, the return type will be `Promise`. @@ -167,7 +164,7 @@ export async function callMeBack( ### Service definitions -``` +```text service ServiceName: -- service interface ``` @@ -186,9 +183,9 @@ export function registerServiceName( ): void; ``` -- `peer` - the Fluence Peer instance where the handler should be registered. The peer can be ommited. In that case the default Fluence Peer will be used instead -- `serviceId` - the name of the service id. If the service was defined with the default service id in aqua code, this argument can be ommited. -- `service` - the handler for the service. +* `peer` - the Fluence Peer instance where the handler should be registered. The peer can be ommited. In that case the default Fluence Peer will be used instead +* `serviceId` - the name of the service id. If the service was defined with the default service id in aqua code, this argument can be ommited. +* `service` - the handler for the service. Depending on whether or not the services was defined with the default id the number of overloads will be different. In the case it **is defined**, there would be four overloads: @@ -277,9 +274,9 @@ export interface CalcDef { Basic types convertion is pretty much straightforward: -- `string` is converted to `string` in typescript -- `bool` is converted to `boolean` in typescript -- All number types \(`u8`, `u16`, `u32`, `u64`, `s8`, `s16`, `s32`, `s64`, `f32`, `f64`\) are converted to `number` in typescript +* `string` is converted to `string` in typescript +* `bool` is converted to `boolean` in typescript +* All number types \(`u8`, `u16`, `u32`, `u64`, `s8`, `s16`, `s32`, `s64`, `f32`, `f64`\) are converted to `number` in typescript Arrow types translate to functions in typescript which have their arguments translated to typescript types. In addition to arguments defined in aqua, typescript counterparts have an additional argument for call params. For the majority of use cases this parameter is not needed and can be ommited. @@ -315,3 +312,4 @@ Tetraplets have the form of: To learn more about tetraplets and application security see [Security](https://github.com/fluencelabs/gitbook-docs/tree/77344eb147c2ce17fe1c0f37013082fc85c1ffa3/js-sdk/knowledge_security.md) To see full specification of `CallParms` type see [Api reference](https://github.com/fluencelabs/gitbook-docs/tree/77344eb147c2ce17fe1c0f37013082fc85c1ffa3/js-sdk/js-sdk/6_reference/modules.md) + diff --git a/js-sdk/4_run_in_browser-1.md b/js-sdk/4_run_in_browser-1.md index f0ec520..562199d 100644 --- a/js-sdk/4_run_in_browser-1.md +++ b/js-sdk/4_run_in_browser-1.md @@ -2,6 +2,7 @@ You can use the JS SDK with any framework \(or even without it\). The "flunce" part of the application is a collection of pure typesctipt\javascript functions which can be called withing any framework of your choosing. -See the browser-example which demonstrate integrating Fluence with React: (github)[https://github.com/fluencelabs/examples/tree/main/js-sdk-examples/browser-example] +See the browser-example which demonstrate integrating Fluence with React: \(github\)\[[https://github.com/fluencelabs/examples/tree/main/js-sdk-examples/browser-example](https://github.com/fluencelabs/examples/tree/main/js-sdk-examples/browser-example)\] Also take a look at FluentPad. It is an example application written in React: [https://github.com/fluencelabs/fluent-pad](https://github.com/fluencelabs/fluent-pad) + diff --git a/quick-start/3.-browser-to-service.md b/quick-start/3.-browser-to-service.md index 2306a67..c63a679 100644 --- a/quick-start/3.-browser-to-service.md +++ b/quick-start/3.-browser-to-service.md @@ -16,7 +16,7 @@ npm start Which will open a new browser tab at `http://localhost:3000` . Following the instructions, we connect to any one of the displayed relay ids, open another browser tab also at `http://localhost:3000`, select a relay and copy and paste the client peer id and relay id into corresponding fields in the first tab and press the `say hello` button. -![Browser To Service Implementation](../.gitbook/assets/image%20%2838%29.png) +![Browser To Service Implementation](../.gitbook/assets/image%20%2838%29%20%282%29.png) The result looks familiar, so what's different? Let's have a look at the Aqua file. Navigate to the `aqua/getting_started.aqua` file in your IDE: diff --git a/quick-start/README.md b/quick-start/README.md index 47ea706..3453dcc 100644 --- a/quick-start/README.md +++ b/quick-start/README.md @@ -8,38 +8,38 @@ Welcome to our quick-start tutorials which guide you through the necessary steps For your development convenience, Fluence provides a [docker-based development environment](https://github.com/fluencelabs/devcontainer) that comes with the necessary dependencies, tooling and quick-start code pre-installed. -### Fluence Devcontainer +## Fluence Devcontainer Fluence's devcontainer is a ready to use dockerized development environment with VSCode integration containing the following tools: -- [`aqua`](https://www.npmjs.com/package/@fluencelabs/aqua) to compile [Aqua](https://doc.fluence.dev/aqua-book/) to AIR or wrapped in Typescript -- [`fldist`](https://www.npmjs.com/package/@fluencelabs/fldist) to manage services and optionally execute compiled Aqua from the command line -- [`marine`](https://crates.io/crates/marine) to compile services developed in Rust to the wasm32-wasi target -- [`mrepl`](https://crates.io/crates/mrepl) to run, test and debug WebAssembly \(Wasm\) services locally +* [`aqua`](https://www.npmjs.com/package/@fluencelabs/aqua) to compile [Aqua](https://doc.fluence.dev/aqua-book/) to AIR or wrapped in Typescript +* [`fldist`](https://www.npmjs.com/package/@fluencelabs/fldist) to manage services and optionally execute compiled Aqua from the command line +* [`marine`](https://crates.io/crates/marine) to compile services developed in Rust to the wasm32-wasi target +* [`mrepl`](https://crates.io/crates/mrepl) to run, test and debug WebAssembly \(Wasm\) services locally -### How to install +## How to install Docker and optionally VSCode need to be available on your system. For Docker installation, follow the [Get Docker](https://docs.docker.com/get-docker/) instructions for your OS. For VSCode, see [VSCode](https://code.visualstudio.com/) for instructions. With Docker and VSCode in place: -- Install Remote-Containers extension in VSCode +* Install Remote-Containers extension in VSCode ![Install Remote - Containers in VSCode](../.gitbook/assets/image%20%2813%29.png) -- `Run Remote-Containers: Clone Repository in Container Volume...` via the command palette \(F1 or Cmd-Shift-P\) +* `Run Remote-Containers: Clone Repository in Container Volume...` via the command palette \(F1 or Cmd-Shift-P\) ![Select Remote Container Clone Repository](../.gitbook/assets/image%20%2814%29.png) -- Enter `fluencelabs/devcontainer` +* Enter `fluencelabs/devcontainer` -![Select `fluencelabs/devcontainer`](../.gitbook/assets/image%20%2815%29.png) +![Select \`fluencelabs/devcontainer\`](../.gitbook/assets/image%20%2815%29.png) -- When asked for branch, press enter \(main\) -- When asked for volume, press enter \(unique\) -- Open Terminal in VSCode \(ctrl-\`\) +* When asked for branch, press enter \(main\) +* When asked for volume, press enter \(unique\) +* Open Terminal in VSCode \(ctrl-\`\) -![Installed And Ready Devcontainer in VSCode](../.gitbook/assets/image%20%2818%29%20%281%29.png) +![Installed And Ready Devcontainer in VSCode](../.gitbook/assets/image%20%2818%29%20%281%29%20%281%29%20%282%29.png) Congratulations, you now have a fully functional Fluence development environment. For a variety of container management options, click on the `Dev Container: Fluence` button in the lower left of your tool bar: @@ -48,3 +48,4 @@ Congratulations, you now have a fully functional Fluence development environment If you encounter any problems or have suggestions, please open an issue or submit a PR. You can also reach out in [Discord](https://fluence.chat) or [Telegram](https://t.me/fluence_project). For more detailed reference resources, see the [Fluence documentation](https://doc.fluence.dev/docs/) and [Aqua book](https://doc.fluence.dev/aqua-book/). All right, now we are ready to proceed to the first application on Fluence. + diff --git a/tutorials_tutorials/tutorial_run_local_node.md b/tutorials_tutorials/tutorial_run_local_node.md index dcf3384..7948d5e 100644 --- a/tutorials_tutorials/tutorial_run_local_node.md +++ b/tutorials_tutorials/tutorial_run_local_node.md @@ -165,7 +165,7 @@ fldist --node-id 12D3KooWLFCmDq4vDRfaxW2GA6kYnorxAiie78XzQrVDVoWEZnPx \ --node-addr /ip4/127.0.0.1/tcp/9999/ws/p2p/12D3KooWLFCmDq4vDRfaxW2GA6kYnorxAiie78XzQrVDVoWEZnPx \ run_air \ -p greeting.greeting.air \ - -d '{"service": "64551400-6296-4701-8e82-daf0b4e02751", "name":"Fluence"}' + -d '{"service": "64551400-6296-4701-8e82-daf0b4e02751", "name":"Fluence", "node": "12D3KooWLFCmDq4vDRfaxW2GA6kYnorxAiie78XzQrVDVoWEZnPx"}' ``` ```bash