npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

js-fluence-client

v0.0.35

Published

Fluence Javascript Client allows you to interact with a Fluence real-time cluster for decentralized computations.

Downloads

61

Readme

IMPORTANT: Client and README are under heavy development and can be outdated. Ask a question in gitter or file an issue.

Fluence Javascript Client

Fluence Javascript Client allows you to interact with a real-time cluster from a browser or use it like npm module.

Motivation

Browser client simplifies interaction with the real-time cluster for a user. It has zero dependencies and can be added to other code. Developers can deploy their backend code to Fluence network and built a web3 application based on Fluence Client to interact with this backend code. It is written on TypeScript to reach more clean, understandable and typesafe code with good reusability.

Documentation

Installation

npm install js-fluence-client

Before started

You need to have a deployed real-time cluster. You can use this part of project to deploy 4-nodes cluster with increment and multiply functions as an example.

TODO: HOWTO deploy custom code (link to some other readme)

Init client and session

For interaction with the default increment and multiply cluster you can use IncrementAndMultiply class. If we have a local cluster, we can initialize client like this:

let client = new IncrementAndMultiply("localhost", 46157);

Than we can use built-in functions:

// mutate state but returns nothing
client.incrementCounter();

// get result after counter
let counter = await client.getCounter().result();
console.log(JSON.stringify(counter));

// get result of moltiplying
let res = await client.multiply(107, 124).result();

// should be 13268
console.log(JSON.stringify(res));

If you deployed your own code, you can use CustomCommands

let client = new CustomCommands("localhost", 46157);

// will return some result based on logic of deployed code
let res = await client.submit("<some-custom-command>").result();

If you want to write your own library, you can use IncrementAndMultiply.ts as a basis:

import {TendermintClient} from "../TendermintClient";
import {Engine} from "../Engine";
import {Signer} from "../Signer";
import {Client} from "../Client";
import {Session} from "../Session";

class IncrementAndMultiply {

    // a session is needed for ordered transactions, you can use multiple sessions if needed
    private session: Session;

    constructor(host: string, port: number) {
        // there is initializing RPC to tendermint cluster
        let tm = new TendermintClient(host, port);

        // creates engine that can start new sessions
        let engine = new Engine(tm);

        // default signing key for now
        // signing key can be generated or received after some authorize processes
        let signingKey = "TVAD4tNeMH2yJfkDZBSjrMJRbavmdc3/fGU2N2VAnxT3hAtSkX+Lrl4lN5OEsXjD7GGG7iEewSod472HudrkrA==";

        // creates signer that can sign messages
        let signer = new Signer(signingKey);

        // `client002` is a default client for now
        // creates client with id and signer
        let client = new Client("client002", signer);

        // generates the random session. If you want to generate session on your own - use createSession(client, "some-id")
        this.session = engine.genSession(client);
    }

    // uses the session to submit commands you want to
    async incrementCounter() {
        console.log("do increment");
        return this.session.invoke("inc");
    }

    async getCounter() {
        let res = await this.session.invoke("get");
        console.log(`get result is: ${JSON.stringify(res)}`);
        return res
    }

    async multiply(first: number, second: number) {
        let res = await this.session.invoke("multiplier.mul", [first.toString(), second.toString()]).result();
        console.log(`multiply result is: ${JSON.stringify(res)}`);
        return res;
    }
}

You can find other examples in the examples folder.