Skip to content
This repository was archived by the owner on Jul 10, 2025. It is now read-only.

Update JS SDK api to the new version #61

Merged
merged 49 commits into from
Sep 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
832c9d9
Exposing more particle context and tetraplets to call handlers
coder11 Jul 27, 2021
f400a9f
Additional test for aqua compiler output + fix existing tests
coder11 Jul 29, 2021
2862b3c
Better types for CallParams
coder11 Jul 29, 2021
c196cc1
Fix typos
coder11 Jul 29, 2021
5de0b0c
Move all the imports in the `compiled functions` into a separate dire…
coder11 Aug 2, 2021
82ed3bf
Api rework
coder11 Aug 5, 2021
165be17
api fixes
coder11 Aug 5, 2021
d68cdeb
New api works
coder11 Aug 9, 2021
18d4ddf
More test fixes
coder11 Aug 9, 2021
a38d04b
ed25519 private key instead of js-peerid seed
coder11 Aug 9, 2021
6b379da
fix tests
coder11 Aug 9, 2021
9ab568e
fix one more test
coder11 Aug 9, 2021
a2c4b40
Polishing exports
coder11 Aug 9, 2021
f6c7f1c
fix typos
coder11 Aug 10, 2021
71a5995
more fixes
coder11 Aug 10, 2021
25bff1b
remove old seed methods
coder11 Aug 11, 2021
fe4ccfd
Moving all the developers documentation to the gitbook. The readme on…
coder11 Aug 16, 2021
a433caf
Merge branch 'master' into new-js-sdk-api
coder11 Aug 23, 2021
e455466
fix merge conflicts
coder11 Aug 23, 2021
7cafe2d
draft improved api
coder11 Aug 23, 2021
68948d3
update test to the latest compiler version
coder11 Aug 24, 2021
23f8fe8
Merge remote-tracking branch 'origin/master' into new-js-sdk-api
coder11 Aug 24, 2021
96f8a0a
implement async CallService callbacsk
coder11 Aug 24, 2021
c7fad2f
small refactoring
coder11 Aug 24, 2021
2fde707
update avm and fix tests
coder11 Aug 25, 2021
174477e
fix package-lock
coder11 Aug 25, 2021
a8a6a81
fix test on ci
coder11 Aug 25, 2021
5d77db8
Revert "fix test on ci"
coder11 Aug 25, 2021
f1a52d4
update avm version
coder11 Aug 26, 2021
19ceeda
update avm version
coder11 Aug 27, 2021
b09ef7d
tmp
coder11 Aug 31, 2021
506fcbd
Improve particle processing logging
coder11 Sep 6, 2021
284a59b
fix issues
coder11 Sep 6, 2021
9102f66
Add doc generation
coder11 Sep 6, 2021
c2e280d
Add doc auto-generation
coder11 Sep 6, 2021
3a92e25
Move internal parts out of public api
coder11 Sep 6, 2021
586c4ac
Add additional test for avm
coder11 Sep 6, 2021
5c89ee5
More logging
coder11 Sep 6, 2021
480d630
Update call params JSdoc
coder11 Sep 7, 2021
a0e4fbb
Revert "implement async CallService callbacsk"
coder11 Sep 7, 2021
e30890e
Merge main into current branch
coder11 Sep 7, 2021
998cb63
Fixing tests
coder11 Sep 7, 2021
bf35562
Fix PR comments
coder11 Sep 7, 2021
32fa669
Fix failing test
coder11 Sep 7, 2021
4be3ec3
Swap peer id with Key Pair
coder11 Sep 7, 2021
72bdea4
Get rid of multiple relays
coder11 Sep 7, 2021
0111743
Fix PR comments
coder11 Sep 7, 2021
6511112
Fix tests
coder11 Sep 7, 2021
77eac72
Merge branch 'master' into new-js-sdk-api
coder11 Sep 8, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ lerna-debug.log*
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
bundle/
docs/

# Dependency directories
node_modules/
Expand Down
102 changes: 5 additions & 97 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,105 +2,17 @@

[![npm](https://img.shields.io/npm/v/@fluencelabs/fluence)](https://www.npmjs.com/package/@fluencelabs/fluence)

Official SDK for building web-based applications for Fluence

## About Fluence

Fluence is an open application platform where apps can build on each other, share data and users

| Layer | Tech | Scale | State | Based on |
| :-------------------: | :-------------------------------------------------------------------------------------------------------------------------------: | :------------------------------: | :-------------------------------: | :-----------------------------------------------------------------------------------------------------------: |
| Execution | [FCE](https://github.com/fluencelabs/fce) | Single peer | Disk, network, external processes | Wasm, [IT](https://github.com/fluencelabs/interface-types), [Wasmer\*](https://github.com/fluencelabs/wasmer) |
| Composition | [Aquamarine](https://github.com/fluencelabs/aquamarine) | Involved peers | Results and signatures | ⇅, π-calculus |
| Topology | [TrustGraph](https://github.com/fluencelabs/fluence/tree/master/trust-graph), [DHT\*](https://github.com/fluencelabs/rust-libp2p) | Distributed with Kademlia\* algo | Actual state of the network | [libp2p](https://github.com/libp2p/rust-libp2p) |
| Security & Accounting | Blockchain | Whole network | Licenses & payments | substrate? |

<img alt="aquamarine scheme" align="center" src="doc/stack.png"/>

## Installation

With npm

```bash
npm install @fluencelabs/fluence
```

With yarn

```bash
yarn add @fluencelabs/fluence
```
Official SDK providing javascript-based implementation of the Fluence Peer.

## Getting started

Pick a node to connect to the Fluence network. The easiest way to do so is by using [fluence-network-environment](https://github.com/fluencelabs/fluence-network-environment) package

```typescript
import { dev } from '@fluencelabs/fluence-network-environment';

export const relayNode = dev[0];
```

Initialize client

```typescript
import { createClient, FluenceClient } from '@fluencelabs/fluence';

const client = await createClient(relayNode);
```

Respond to service function calls
To start developing applications with JS SDK refer to the official [gitbook page](https://doc.fluence.dev/docs/js-sdk)

```typescript
subscribeToEvent(client, 'helloService', 'helloFunction', (args) => {
const [networkInfo] = args;
console.log(networkInfo);
});
```

Make a particle

```typescript
const particle = new Particle(
`
(seq
(call myRelay ("peer" "identify") [] result)
(call %init_peer_id% ("helloService" "helloFunction") [result])
)`,
{
myRelay: client.relayPeerId,
},
);
```

Send it to the network

```typescript
await sendParticle(client, particle);
```

Observe the result in browser console

```json
{
"external_addresses": ["/ip4/1.2.3.4/tcp/7777", "/dns4/dev.fluence.dev/tcp/19002"]
}
```

## Documentation

Guide on building applications: [doc.fluence.dev](https://doc.fluence.dev/docs/tutorials_tutorials/building-a-frontend-with-js-sdk)

Sample applications:

- [FluentPad](https://github.com/fluencelabs/fluent-pad): a collaborative text editor with users online status synchronization
- [Examples](https://github.com/fluencelabs/examples): examples of using the Aqua programming language

About [Fluence](https://fluence.network/)
## Contributing

## Developing
While the project is still in the early stages of development, you are welcome to track progress and contribute. As the project is undergoing rapid changes, interested contributors should contact the team before embarking on larger pieces of work. All contributors should consult with and agree to our [basic contributing rules](CONTRIBUTING.md).

### Setting up Dev
### Setting up dev environment

Install node packages

Expand Down Expand Up @@ -140,10 +52,6 @@ To run all tests
npm run test:all
```

## Contributing

While the project is still in the early stages of development, you are welcome to track progress and contribute. As the project is undergoing rapid changes, interested contributors should contact the team before embarking on larger pieces of work. All contributors should consult with and agree to our [basic contributing rules](CONTRIBUTING.md).

## License

[Apache 2.0](LICENSE)
Binary file removed doc/stack.png
Binary file not shown.
Loading