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.
6
+
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
7
8
+
## Installation
8
9
9
-
## Get Started
10
+
Adding the Fluence JS client for your web application is very easy.
10
11
11
-
Adding the Fluence JS client for your web application is very easy:
12
+
### Browser-based Apps
12
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 and host in yourself: `https://www.npmjs.com/package/@fluencelabs/js-client.web.standalone`. 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.)
28
+
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.)
26
29
27
30
2. Install the following packages:
28
31
@@ -34,14 +37,30 @@ Adding the Fluence JS client for your web application is very easy:
34
37
35
38
```
36
39
import { Fluence } from "@fluencelabs/js-client.api";
37
-
import { krasnodar } from "@fluencelabs/fluence-network-environment";
40
+
import { randomKras } from '@fluencelabs/fluence-network-environment';
38
41
39
-
Fluence.start({
40
-
relay: krasnodar[3],
41
-
});
42
+
Fluence.connect(randomKras());
42
43
```
43
44
44
-
## Use Aqua in a Web Application
45
+
### Node.js Apps
46
+
47
+
1. Install the following packages:
48
+
49
+
```
50
+
npm i @fluencelabs/js-client.api"@fluencelabs/js-client.node @fluencelabs/fluence-network-environment
51
+
```
52
+
53
+
2. Add the following lines at the beginning of your code:
54
+
55
+
```
56
+
import '@fluencelabs/js-client.node';
57
+
import { Fluence } from "@fluencelabs/js-client.api";
58
+
import { randomKras } from '@fluencelabs/fluence-network-environment';
59
+
60
+
Fluence.connect(randomKras());
61
+
```
62
+
63
+
## Usage in an Application
45
64
46
65
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/fluence-cli).
47
66
@@ -100,23 +119,18 @@ Once you've added the client, you can compile [Aqua](https://github.com/fluencel
100
119
}
101
120
```
102
121
103
-
**Warning**: Fluence JS client for Node.js is currently broken. We will fix this shortly.
104
-
105
-
106
122
## Development
107
123
108
124
To hack on the Fluence JS Client itself, please refer to the [development page](./DEVELOPING.md).
109
125
110
-
111
126
## Documentation
112
127
113
128
The starting point for all documentation related to Fluence is
114
129
[fluence.dev](https://fluence.dev/). We also have an active [YouTube channel](https://www.youtube.com/@fluencelabs).
115
130
116
-
117
131
## Support
118
132
119
-
Please, file an [issue](https://github.com/fluencelabs/fluence-js/issues) if you find a bug. You can also contact us at [Discord](https://discord.com/invite/5qSnPZKh7u) or [Telegram](https://t.me/fluence_project). We will do our best to resolve the issue ASAP.
133
+
Please, file an [issue](https://github.com/fluencelabs/js-client/issues) if you find a bug. You can also contact us at [Discord](https://discord.com/invite/5qSnPZKh7u) or [Telegram](https://t.me/fluence_project). We will do our best to resolve the issue ASAP.
0 commit comments