You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 10, 2025. It is now read-only.
This is the Javascript client for the [Fluence](https://fluence.network) network. The main role of the JS client is to connect to the Fluence Network and allow you to integrate Aqua code into your application.
7
6
8
7
## Installation
9
8
10
-
Adding the Fluence JS client for your web application is very easy.
9
+
> JS Client only supports the ESM format that means not every Node.js project can install it.
10
+
> You can read more [here](https://nodejs.org/api/esm.html)
11
11
12
-
### Browser-based Apps
12
+
1. Install the client:
13
13
14
-
1. Add a script tag with the JS Client bundle to your `index.html`. The easiest way to do this is using a CDN (like [JSDELIVR](https://www.jsdelivr.com/) or [UNPKG](https://unpkg.com/)). The script is large, thus we highly recommend to use the `async` attribute.
If you cannot or don't want to use a CDN, feel free to get the script directly from the [npm package](https://www.npmjs.com/package/@fluencelabs/js-client.web.standalone) and host it yourself. You can find the script in the `/dist` directory of the package. (Note: this option means that developers understand what they are doing and know how to serve this file from their own web server.)
29
-
30
-
2. Install the following packages:
31
-
32
-
```
33
-
npm i @fluencelabs/js-client.api @fluencelabs/fluence-network-environment
14
+
```bash
15
+
npm i @fluencelabs/js-client
34
16
```
35
17
36
-
3. Add the following lines at the beginning of your code:
18
+
2. Add the following lines at the beginning of your code:
37
19
38
-
```
39
-
import { Fluence } from "@fluencelabs/js-client.api";
40
-
import { randomKras } from '@fluencelabs/fluence-network-environment';
Once you've added the client, you can compile [Aqua](https://github.com/fluencelabs/aqua) and run it in your application. To compile Aqua, use [Fluence CLI](https://github.com/fluencelabs/cli).
86
66
87
67
1. Install the package:
88
68
89
-
```
69
+
```bash
90
70
npm i -D @fluencelabs/cli
91
71
```
92
72
@@ -130,7 +110,7 @@ Once you've added the client, you can compile [Aqua](https://github.com/fluencel
130
110
6. Now you can import and call Aqua code from your application like
131
111
this:
132
112
133
-
```
113
+
```javascript
134
114
import { getRelayTime } from"./_aqua/demo";
135
115
136
116
asyncfunctionbuttonClick() {
@@ -172,7 +152,7 @@ Star (`*`) character can be used as a wildcard to enable logs for multiple compo
172
152
173
153
### Enabling logs in Node.js
174
154
175
-
enable logs, pass the environment variable `DEBUG` with the corresponding log level. For example:
155
+
Enable logs by passing the environment variable `DEBUG` with the corresponding log level. For example:
To enable logs, set the `localStorage.debug` variable. For example:
184
164
185
-
```
186
-
localStorage.debug = 'fluence:*'
165
+
```javascript
166
+
localStorage.debug="fluence:*";
187
167
```
188
168
189
169
**NOTE**
190
170
191
-
In Chromium-based web browsers (e.g. Brave, Chrome, and Electron), the JavaScript console will—by default—only show messages logged by debug if the "Verbose" log level is enabled.
171
+
In Chromium-based web browsers (e.g. Brave, Chrome, and Electron), the JavaScript console will be default—only to show
172
+
messages logged by debug if the "Verbose" log level is enabled.
0 commit comments