mirror of
https://github.com/fluencelabs/examples
synced 2024-12-04 19:20:17 +00:00
Fix FluenceJS node example
This commit is contained in:
parent
1d1cd3f90c
commit
e34e15afa8
@ -4,6 +4,7 @@
|
|||||||
"description": "",
|
"description": "",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
"prestart": "npm run compile-aqua",
|
||||||
"start": "node -r ts-node/register src/index.ts",
|
"start": "node -r ts-node/register src/index.ts",
|
||||||
"compile-aqua": "aqua --import . -i ./aqua/ -o ./src/_aqua",
|
"compile-aqua": "aqua --import . -i ./aqua/ -o ./src/_aqua",
|
||||||
"watch-aqua": "chokidar \"**/*.aqua\" -c \"npm run compile-aqua\""
|
"watch-aqua": "chokidar \"**/*.aqua\" -c \"npm run compile-aqua\""
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import "./calc.aqua"
|
import "./calc.aqua"
|
||||||
|
|
||||||
const PEER ?= "12D3KooWLBkw4Tz8bRoSriy5WEpHyWfU11jEK3b5yCa7FBRDRWH3"
|
const PEER ?= "12D3KooWKETqJdR26urWDbkRAVRdPQhcYNSJNGMBTn1zuE9kjQmo"
|
||||||
const RELAY ?= "12D3KooWSD5PToNiLQwKDXsu8JSysCwUt8BVUJEqCHcDe7P5h45e"
|
const RELAY ?= "12D3KooWSD5PToNiLQwKDXsu8JSysCwUt8BVUJEqCHcDe7P5h45e"
|
||||||
|
|
||||||
func demoCalculation() -> f32:
|
func demoCalculation() -> f32:
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
"description": "",
|
"description": "",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
"prestart": "npm run compile-aqua",
|
||||||
"start": "node -r ts-node/register src/index.ts",
|
"start": "node -r ts-node/register src/index.ts",
|
||||||
"compile-aqua": "aqua --import . -i ./aqua/ -o ./src/_aqua",
|
"compile-aqua": "aqua --import . -i ./aqua/ -o ./src/_aqua",
|
||||||
"watch-aqua": "chokidar \"**/*.aqua\" -c \"npm run compile-aqua\""
|
"watch-aqua": "chokidar \"**/*.aqua\" -c \"npm run compile-aqua\""
|
||||||
|
3
fluence-js-examples/node-example/run_calculation.sh
Executable file
3
fluence-js-examples/node-example/run_calculation.sh
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
#! /bin/bash
|
||||||
|
|
||||||
|
npx aqua run --input ./aqua/demo-calculation.aqua --func 'demoCalculation()' --addr /dns4/stage.fluence.dev/tcp/19001/wss/p2p/12D3KooWHCJbJKGDfCgHSoCuK9q4STyRnVveqLoXAPBbXHTZx9Cv
|
@ -1,4 +1,4 @@
|
|||||||
import { Fluence } from "@fluencelabs/fluence";
|
import { Fluence, KeyPair } from "@fluencelabs/fluence";
|
||||||
import { krasnodar } from "@fluencelabs/fluence-network-environment";
|
import { krasnodar } from "@fluencelabs/fluence-network-environment";
|
||||||
import { registerCalc, CalcDef } from "./_aqua/calc";
|
import { registerCalc, CalcDef } from "./_aqua/calc";
|
||||||
|
|
||||||
@ -40,9 +40,14 @@ const keypress = async () => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const relay = krasnodar[0];
|
||||||
|
// generated with `npx aqua create_keypair`
|
||||||
|
const skBytes = "tOpsT08fvYMnRypj3VtSoqWMN5W/AptKsP39yanlkg4=";
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
await Fluence.start({
|
await Fluence.start({
|
||||||
connectTo: krasnodar[0],
|
connectTo: relay,
|
||||||
|
KeyPair: await KeyPair.fromEd25519SK(Buffer.from(skBytes, "base64")),
|
||||||
});
|
});
|
||||||
|
|
||||||
registerCalc(new Calc());
|
registerCalc(new Calc());
|
||||||
|
Loading…
Reference in New Issue
Block a user