mirror of
https://github.com/fluencelabs/examples
synced 2024-12-04 19:20:17 +00:00
Merge remote-tracking branch 'refs/remotes/origin/main'
This commit is contained in:
commit
cf01a840a8
12
.github/download_marine.sh
vendored
12
.github/download_marine.sh
vendored
@ -2,13 +2,5 @@
|
||||
set -o pipefail -o errexit -o nounset
|
||||
set -x
|
||||
|
||||
MARINE_RELEASE="https://api.github.com/repos/fluencelabs/marine/releases/latest"
|
||||
OUT_DIR=/usr/local/bin
|
||||
|
||||
# get metadata about release
|
||||
curl -s -H "Accept: application/vnd.github.v3+json" $MARINE_RELEASE |
|
||||
# extract url and name for asset with name "marine"
|
||||
# also append $OUT_DIR to each name so file is saved to $OUT_DIR
|
||||
jq -r ".assets | .[] | select(.name == \"marine\") | \"\(.browser_download_url) $OUT_DIR/\(.name)\"" |
|
||||
# download assets
|
||||
xargs -n2 bash -c 'curl -L $0 -o $1 && chmod +x $1'
|
||||
MARINE_RELEASE="https://github.com/fluencelabs/marine/releases/download/marine-v0.12.6/marine"
|
||||
curl -sS -L $MARINE_RELEASE -o /usr/local/bin/marine && chmod +x /usr/local/bin/marine
|
||||
|
6
.github/workflows/test-js-projects.yml
vendored
6
.github/workflows/test-js-projects.yml
vendored
@ -13,9 +13,9 @@ jobs:
|
||||
working-directory: [
|
||||
"./quickstart/1-browser-to-browser",
|
||||
"./quickstart/3-browser-to-service",
|
||||
"./fluence-js-examples/hello-world",
|
||||
"./fluence-js-examples/browser-example",
|
||||
"./fluence-js-examples/node-example",
|
||||
"./js-client-examples/hello-world",
|
||||
"./js-client-examples/browser-example",
|
||||
"./js-client-examples/node-example",
|
||||
"./aqua-examples/echo-greeter/client-peer",
|
||||
"./aqua-examples/price-oracle/client-peer",
|
||||
"./aqua-examples/price-oracle/web"
|
||||
|
@ -8,9 +8,6 @@ If you encounter a problem, please post an Issue or open a PR. If you want to co
|
||||
|
||||
## Resource Directory
|
||||
|
||||
* The [Ceramic Integration](./aqua-examples/aqua-ceramic-integration/) provides an example Wasm adapter for the Ceramic [CLI API](https://developers.ceramic.network/build/cli/api/) and [HTTP API](https://developers.ceramic.network/build/http/api/).
|
||||
* Rust Wasm, Aqua
|
||||
|
||||
* The [IPFS Integration](./aqua-examples/aqua-ipfs-integration/) shows how to use the [aqua-ipfs](https://github.com/fluencelabs/aqua-ipfs) library to deploy single-module Wasm services to a Fluence node from a IPFS sidecar
|
||||
* Fluence JS, Aqua
|
||||
|
||||
|
@ -23,14 +23,14 @@
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@fluencelabs/aqua-ipfs": "^0.5.5",
|
||||
"@fluencelabs/fluence": "^0.27.0",
|
||||
"@fluencelabs/fluence-network-environment": "1.0.13",
|
||||
"@fluencelabs/fluence": "^0.28.0",
|
||||
"@fluencelabs/fluence-network-environment": "1.0.14",
|
||||
"it-all": "^1.0.5",
|
||||
"multiaddr": "^10.0.0",
|
||||
"uint8arrays": "^2.1.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@fluencelabs/aqua": "0.8.0-368",
|
||||
"@fluencelabs/aqua": "0.10.3",
|
||||
"@fluencelabs/aqua-lib": "0.6.0",
|
||||
"typescript": "^4.6.3"
|
||||
}
|
||||
|
@ -24,15 +24,15 @@
|
||||
"author": "Fluence Labs",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@fluencelabs/fluence": "^0.27.0",
|
||||
"@fluencelabs/fluence-network-environment": "1.0.13",
|
||||
"@fluencelabs/fluence": "^0.28.0",
|
||||
"@fluencelabs/fluence-network-environment": "1.0.14",
|
||||
"@fluencelabs/ipfs-execution-aqua": "file:../aqua",
|
||||
"it-all": "^1.0.5",
|
||||
"multiaddr": "^10.0.0",
|
||||
"uint8arrays": "^2.1.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@fluencelabs/aqua": "0.8.0-368",
|
||||
"@fluencelabs/aqua": "0.10.3",
|
||||
"@fluencelabs/aqua-lib": "0.6.0",
|
||||
"@types/jest": "^27.0.3",
|
||||
"jest": "^27.4.0",
|
||||
|
356
aqua-examples/aqua-ipfs-integration/package-lock.json
generated
356
aqua-examples/aqua-ipfs-integration/package-lock.json
generated
@ -11,8 +11,8 @@
|
||||
"web"
|
||||
],
|
||||
"dependencies": {
|
||||
"@fluencelabs/aqua": "0.8.0-368",
|
||||
"@fluencelabs/fluence": "0.27.5",
|
||||
"@fluencelabs/aqua": "0.10.3",
|
||||
"@fluencelabs/fluence": "0.28.0",
|
||||
"ipfs-http-client": "^56.0.3",
|
||||
"typescript": "^4.6.3"
|
||||
},
|
||||
@ -31,14 +31,14 @@
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@fluencelabs/aqua-ipfs": "^0.5.5",
|
||||
"@fluencelabs/fluence": "^0.27.0",
|
||||
"@fluencelabs/fluence-network-environment": "1.0.13",
|
||||
"@fluencelabs/fluence": "^0.28.0",
|
||||
"@fluencelabs/fluence-network-environment": "1.0.14",
|
||||
"it-all": "^1.0.5",
|
||||
"multiaddr": "^10.0.0",
|
||||
"uint8arrays": "^2.1.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@fluencelabs/aqua": "0.8.0-368",
|
||||
"@fluencelabs/aqua": "0.10.3",
|
||||
"@fluencelabs/aqua-lib": "0.6.0",
|
||||
"typescript": "^4.6.3"
|
||||
}
|
||||
@ -49,6 +49,11 @@
|
||||
"integrity": "sha512-ifjtCM93KO3LhzPkMxqmXhwLmrg/scjOiyTihEVg7ns5N+BVzaK1eWzdOdqGdl9ZVoah43pdlQUepEo7VdRmsw==",
|
||||
"dev": true
|
||||
},
|
||||
"aqua/node_modules/@fluencelabs/fluence-network-environment": {
|
||||
"version": "1.0.14",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/fluence-network-environment/-/fluence-network-environment-1.0.14.tgz",
|
||||
"integrity": "sha512-lMiH+7obmJW2Q+PMUR/vNAuX6TcVqlKmsWAHvnBogH7s8IeMT+UGN8qrweILWmE57G7MfauB302dIFQowR9tug=="
|
||||
},
|
||||
"node_modules/@ampproject/remapping": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.0.tgz",
|
||||
@ -2275,13 +2280,13 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@fluencelabs/aqua": {
|
||||
"version": "0.8.0-368",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/aqua/-/aqua-0.8.0-368.tgz",
|
||||
"integrity": "sha512-vnqgjwJWa2XvNqGUCITvkhIiF7ps9WhZL4GfvtuSwVAsdpDaYGtxPH63wcYcG9TwRCr7nGgjOhJGXhkmGhUE2w==",
|
||||
"version": "0.10.3",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/aqua/-/aqua-0.10.3.tgz",
|
||||
"integrity": "sha512-v7Jy+KzZkUm7NuUgrp7UQ8gxuhykxuTU3JigCdxiZMcG3/zD+OtHzsSggVLxVjDP7CKuTcjEKZSCxObwHp/Tpw==",
|
||||
"dependencies": {
|
||||
"@fluencelabs/aqua-ipfs": "0.5.8",
|
||||
"@fluencelabs/aqua-ipfs": "0.5.9",
|
||||
"@fluencelabs/aqua-lib": "0.6.0",
|
||||
"@fluencelabs/fluence": "0.27.4",
|
||||
"@fluencelabs/fluence": "0.28.0",
|
||||
"@fluencelabs/fluence-network-environment": "1.0.13",
|
||||
"ipfs-http-client": "50.1.2"
|
||||
},
|
||||
@ -2291,9 +2296,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@fluencelabs/aqua-ipfs": {
|
||||
"version": "0.5.8",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/aqua-ipfs/-/aqua-ipfs-0.5.8.tgz",
|
||||
"integrity": "sha512-jKlyGBm8oJAIQ3Ags58oJ8QVTlCYSvZQVTnX2SnugGXWVwt4+9qtqtvNT5MvWKK3M9lCFDbJJy/qVTjzPJlaiw==",
|
||||
"version": "0.5.9",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/aqua-ipfs/-/aqua-ipfs-0.5.9.tgz",
|
||||
"integrity": "sha512-Vg7pYv4gEreOKfvzKEL5FchGqSKwat7JyKpqJO6h+FC5S1bl76UkI507+ExhijmUbQGznop8G33XFxyUi6q5SQ==",
|
||||
"dependencies": {
|
||||
"@fluencelabs/aqua-lib": "^0.5.2"
|
||||
}
|
||||
@ -2308,38 +2313,6 @@
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/aqua-lib/-/aqua-lib-0.6.0.tgz",
|
||||
"integrity": "sha512-ifjtCM93KO3LhzPkMxqmXhwLmrg/scjOiyTihEVg7ns5N+BVzaK1eWzdOdqGdl9ZVoah43pdlQUepEo7VdRmsw=="
|
||||
},
|
||||
"node_modules/@fluencelabs/aqua/node_modules/@fluencelabs/fluence": {
|
||||
"version": "0.27.4",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/fluence/-/fluence-0.27.4.tgz",
|
||||
"integrity": "sha512-f85q8ZdmPlUd6uIgmS0CDTvSsb+TGvTqOljw0b161lfEuqPIXrjxJSt0/2Lyh2eEZ1P3slOka1tbVw01nVrt5w==",
|
||||
"dependencies": {
|
||||
"@fluencelabs/avm": "0.31.10",
|
||||
"@fluencelabs/connection": "0.2.0",
|
||||
"@fluencelabs/interfaces": "0.1.0",
|
||||
"@fluencelabs/keypair": "0.2.0",
|
||||
"@fluencelabs/marine-js": "0.3.37",
|
||||
"async": "3.2.3",
|
||||
"base64-js": "^1.5.1",
|
||||
"browser-or-node": "2.0.0",
|
||||
"bs58": "5.0.0",
|
||||
"buffer": "^6.0.3",
|
||||
"cids": "1.1.9",
|
||||
"loglevel": "1.8.0",
|
||||
"multiformats": "9.6.5",
|
||||
"peer-id": "0.16.0",
|
||||
"platform": "^1.3.6",
|
||||
"rxjs": "^7.5.5",
|
||||
"ts-pattern": "3.3.3",
|
||||
"uuid": "8.3.2"
|
||||
},
|
||||
"bin": {
|
||||
"copy-marine": "dist/tools/copyMarine.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10",
|
||||
"pnpm": ">=3"
|
||||
}
|
||||
},
|
||||
"node_modules/@fluencelabs/aqua/node_modules/any-signal": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/any-signal/-/any-signal-2.1.2.tgz",
|
||||
@ -2489,32 +2462,6 @@
|
||||
"minimatch": "^3.0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/@fluencelabs/aqua/node_modules/libp2p-crypto": {
|
||||
"version": "0.21.2",
|
||||
"resolved": "https://registry.npmjs.org/libp2p-crypto/-/libp2p-crypto-0.21.2.tgz",
|
||||
"integrity": "sha512-EXFrhSpiHtJ+/L8xXDvQNK5VjUMG51u878jzZcaT5XhuN/zFg6PWJFnl/qB2Y2j7eMWnvCRP7Kp+ua2H36cG4g==",
|
||||
"dependencies": {
|
||||
"@noble/ed25519": "^1.5.1",
|
||||
"@noble/secp256k1": "^1.3.0",
|
||||
"err-code": "^3.0.1",
|
||||
"iso-random-stream": "^2.0.0",
|
||||
"multiformats": "^9.4.5",
|
||||
"node-forge": "^1.2.1",
|
||||
"protobufjs": "^6.11.2",
|
||||
"uint8arrays": "^3.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@fluencelabs/aqua/node_modules/libp2p-crypto/node_modules/uint8arrays": {
|
||||
"version": "3.1.1",
|
||||
"resolved": "https://registry.npmjs.org/uint8arrays/-/uint8arrays-3.1.1.tgz",
|
||||
"integrity": "sha512-+QJa8QRnbdXVpHYjLoTpJIdCTiw9Ir62nocClWuXIq2JIh4Uta0cQsTSpFL678p2CN8B+XSApwcU+pQEqVpKWg==",
|
||||
"dependencies": {
|
||||
"multiformats": "^9.4.2"
|
||||
}
|
||||
},
|
||||
"node_modules/@fluencelabs/aqua/node_modules/multiaddr": {
|
||||
"version": "9.0.2",
|
||||
"resolved": "https://registry.npmjs.org/multiaddr/-/multiaddr-9.0.2.tgz",
|
||||
@ -2539,42 +2486,6 @@
|
||||
"multiaddr": "^9.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@fluencelabs/aqua/node_modules/multiformats": {
|
||||
"version": "9.6.5",
|
||||
"resolved": "https://registry.npmjs.org/multiformats/-/multiformats-9.6.5.tgz",
|
||||
"integrity": "sha512-vMwf/FUO+qAPvl3vlSZEgEVFY/AxeZq5yg761ScF3CZsXgmTi/HGkicUiNN0CI4PW8FiY2P0OLklOcmQjdQJhw=="
|
||||
},
|
||||
"node_modules/@fluencelabs/aqua/node_modules/node-forge": {
|
||||
"version": "1.3.1",
|
||||
"resolved": "https://registry.npmjs.org/node-forge/-/node-forge-1.3.1.tgz",
|
||||
"integrity": "sha512-dPEtOeMvF9VMcYV/1Wb8CPoVAXtp6MKMlcbAt4ddqmGqUJ6fQZFXkNZNkNlfevtNkGtaSoXf/vNNNSvgrdXwtA==",
|
||||
"engines": {
|
||||
"node": ">= 6.13.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@fluencelabs/aqua/node_modules/peer-id": {
|
||||
"version": "0.16.0",
|
||||
"resolved": "https://registry.npmjs.org/peer-id/-/peer-id-0.16.0.tgz",
|
||||
"integrity": "sha512-EmL7FurFUduU9m1PS9cfJ5TAuCvxKQ7DKpfx3Yj6IKWyBRtosriFuOag/l3ni/dtPgPLwiA4R9IvpL7hsDLJuQ==",
|
||||
"dependencies": {
|
||||
"class-is": "^1.1.0",
|
||||
"libp2p-crypto": "^0.21.0",
|
||||
"multiformats": "^9.4.5",
|
||||
"protobufjs": "^6.10.2",
|
||||
"uint8arrays": "^3.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=15.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@fluencelabs/aqua/node_modules/peer-id/node_modules/uint8arrays": {
|
||||
"version": "3.1.1",
|
||||
"resolved": "https://registry.npmjs.org/uint8arrays/-/uint8arrays-3.1.1.tgz",
|
||||
"integrity": "sha512-+QJa8QRnbdXVpHYjLoTpJIdCTiw9Ir62nocClWuXIq2JIh4Uta0cQsTSpFL678p2CN8B+XSApwcU+pQEqVpKWg==",
|
||||
"dependencies": {
|
||||
"multiformats": "^9.4.2"
|
||||
}
|
||||
},
|
||||
"node_modules/@fluencelabs/aqua/node_modules/retimer": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/retimer/-/retimer-2.0.0.tgz",
|
||||
@ -2595,9 +2506,9 @@
|
||||
"integrity": "sha512-cXEIW6cfr15lFv563k4GuVuW/fiwjknytD37jIOLSdSWuOI6WnO/oKwmP2FQTU2l01LP8/M5TSAJpzUaGe3uWg=="
|
||||
},
|
||||
"node_modules/@fluencelabs/avm": {
|
||||
"version": "0.31.10",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/avm/-/avm-0.31.10.tgz",
|
||||
"integrity": "sha512-tkpjdHyRmsTwAEZCJt15//jXEgC2Nw2qFiD1NenvK127SlgKeuzQU9IMReUYY3dowb2IGeC578/uGMu96jHYKw=="
|
||||
"version": "0.35.3",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/avm/-/avm-0.35.3.tgz",
|
||||
"integrity": "sha512-Y5mPPCmAUUKc5CDO12IL8mGEreWa7maVdX0MWCAH4+GvfLPFN1FxOMSKRYEtvkyVEL88pc9pd8cm5IRCBkFthg=="
|
||||
},
|
||||
"node_modules/@fluencelabs/connection": {
|
||||
"version": "0.2.0",
|
||||
@ -2673,11 +2584,11 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@fluencelabs/fluence": {
|
||||
"version": "0.27.5",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/fluence/-/fluence-0.27.5.tgz",
|
||||
"integrity": "sha512-nMCzd/oHHk5/yWdg/+rPB+sc8X+fQ5YgwPhGVDoxFs8/CmIr1G5Na8Y6l8rrigasgQd+LV5GtAyh50Oq7/IXkg==",
|
||||
"version": "0.28.0",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/fluence/-/fluence-0.28.0.tgz",
|
||||
"integrity": "sha512-SXb2vjTj8m/nw4jEILV0tu9VIFprGo8mNb2nOB5btxdsOI8GzQZkpGzTLrSd/+UagIo2GdxAu0GhBP8dxZXaqg==",
|
||||
"dependencies": {
|
||||
"@fluencelabs/avm": "0.31.10",
|
||||
"@fluencelabs/avm": "0.35.3",
|
||||
"@fluencelabs/connection": "0.2.0",
|
||||
"@fluencelabs/interfaces": "0.1.0",
|
||||
"@fluencelabs/keypair": "0.2.0",
|
||||
@ -2709,11 +2620,6 @@
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/fluence-network-environment/-/fluence-network-environment-1.0.13.tgz",
|
||||
"integrity": "sha512-2pci3T0sUHE08jwEs1r/vHKVT4XUh/A3j/QJ0eIhddsxyIjEksjdn05X7DF6STD14CF8GgBVOJEPgav8qaUMpA=="
|
||||
},
|
||||
"node_modules/@fluencelabs/fluence/node_modules/async": {
|
||||
"version": "3.2.4",
|
||||
"resolved": "https://registry.npmjs.org/async/-/async-3.2.4.tgz",
|
||||
"integrity": "sha512-iAB+JbDEGXhyIUavoDl9WP/Jj106Kz9DEn1DPgYw5ruDn0e3Wgi3sKFm55sASdGBNOQB8F59d9qQ7deqrHA8wQ=="
|
||||
},
|
||||
"node_modules/@fluencelabs/fluence/node_modules/libp2p-crypto": {
|
||||
"version": "0.21.2",
|
||||
"resolved": "https://registry.npmjs.org/libp2p-crypto/-/libp2p-crypto-0.21.2.tgz",
|
||||
@ -2744,11 +2650,6 @@
|
||||
"url": "https://tidelift.com/funding/github/npm/loglevel"
|
||||
}
|
||||
},
|
||||
"node_modules/@fluencelabs/fluence/node_modules/multiformats": {
|
||||
"version": "9.9.0",
|
||||
"resolved": "https://registry.npmjs.org/multiformats/-/multiformats-9.9.0.tgz",
|
||||
"integrity": "sha512-HoMUjhH9T8DDBNT+6xzkrd9ga/XiBI4xLr58LJACwK6G3HTOPeMz4nB4KJs33L2BelrIJa7P0VuNaVF3hMYfjg=="
|
||||
},
|
||||
"node_modules/@fluencelabs/fluence/node_modules/node-forge": {
|
||||
"version": "1.3.1",
|
||||
"resolved": "https://registry.npmjs.org/node-forge/-/node-forge-1.3.1.tgz",
|
||||
@ -5671,9 +5572,9 @@
|
||||
"integrity": "sha512-eBvWn1lvIApYMhzQMsu9ciLfkBY499mFZlNqG+/9WR7PVlroQw0vG30cOQQbaKz3sCEc44TAOu2ykzqXSNnwag=="
|
||||
},
|
||||
"node_modules/async": {
|
||||
"version": "3.2.3",
|
||||
"resolved": "https://registry.npmjs.org/async/-/async-3.2.3.tgz",
|
||||
"integrity": "sha512-spZRyzKL5l5BZQrr/6m/SqFdBN0q3OCI0f9rjfBzCMBIP4p75P620rR3gTmaksNOhmzgdxcaxdNfMy6anrbM0g=="
|
||||
"version": "3.2.4",
|
||||
"resolved": "https://registry.npmjs.org/async/-/async-3.2.4.tgz",
|
||||
"integrity": "sha512-iAB+JbDEGXhyIUavoDl9WP/Jj106Kz9DEn1DPgYw5ruDn0e3Wgi3sKFm55sASdGBNOQB8F59d9qQ7deqrHA8wQ=="
|
||||
},
|
||||
"node_modules/async-foreach": {
|
||||
"version": "0.1.3",
|
||||
@ -12003,11 +11904,6 @@
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/jake/node_modules/async": {
|
||||
"version": "3.2.4",
|
||||
"resolved": "https://registry.npmjs.org/async/-/async-3.2.4.tgz",
|
||||
"integrity": "sha512-iAB+JbDEGXhyIUavoDl9WP/Jj106Kz9DEn1DPgYw5ruDn0e3Wgi3sKFm55sASdGBNOQB8F59d9qQ7deqrHA8wQ=="
|
||||
},
|
||||
"node_modules/jake/node_modules/chalk": {
|
||||
"version": "4.1.2",
|
||||
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
|
||||
@ -14617,9 +14513,9 @@
|
||||
"integrity": "sha512-cXEIW6cfr15lFv563k4GuVuW/fiwjknytD37jIOLSdSWuOI6WnO/oKwmP2FQTU2l01LP8/M5TSAJpzUaGe3uWg=="
|
||||
},
|
||||
"node_modules/multiformats": {
|
||||
"version": "9.7.0",
|
||||
"resolved": "https://registry.npmjs.org/multiformats/-/multiformats-9.7.0.tgz",
|
||||
"integrity": "sha512-uv/tcgwk0yN4DStopnBN4GTgvaAlYdy6KnZpuzEPFOYQd71DYFJjs0MN1ERElAflrZaYyGBWXyGxL5GgrxIx0Q=="
|
||||
"version": "9.9.0",
|
||||
"resolved": "https://registry.npmjs.org/multiformats/-/multiformats-9.9.0.tgz",
|
||||
"integrity": "sha512-HoMUjhH9T8DDBNT+6xzkrd9ga/XiBI4xLr58LJACwK6G3HTOPeMz4nB4KJs33L2BelrIJa7P0VuNaVF3hMYfjg=="
|
||||
},
|
||||
"node_modules/multihashes": {
|
||||
"version": "4.0.3",
|
||||
@ -21924,15 +21820,15 @@
|
||||
"version": "0.1.0",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@fluencelabs/fluence": "^0.27.0",
|
||||
"@fluencelabs/fluence-network-environment": "1.0.13",
|
||||
"@fluencelabs/fluence": "^0.28.0",
|
||||
"@fluencelabs/fluence-network-environment": "1.0.14",
|
||||
"@fluencelabs/ipfs-execution-aqua": "file:../aqua",
|
||||
"it-all": "^1.0.5",
|
||||
"multiaddr": "^10.0.0",
|
||||
"uint8arrays": "^2.1.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@fluencelabs/aqua": "0.8.0-368",
|
||||
"@fluencelabs/aqua": "0.10.3",
|
||||
"@fluencelabs/aqua-lib": "0.6.0",
|
||||
"@types/jest": "^27.0.3",
|
||||
"jest": "^27.4.0",
|
||||
@ -21947,13 +21843,18 @@
|
||||
"integrity": "sha512-ifjtCM93KO3LhzPkMxqmXhwLmrg/scjOiyTihEVg7ns5N+BVzaK1eWzdOdqGdl9ZVoah43pdlQUepEo7VdRmsw==",
|
||||
"dev": true
|
||||
},
|
||||
"nodejs/node_modules/@fluencelabs/fluence-network-environment": {
|
||||
"version": "1.0.14",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/fluence-network-environment/-/fluence-network-environment-1.0.14.tgz",
|
||||
"integrity": "sha512-lMiH+7obmJW2Q+PMUR/vNAuX6TcVqlKmsWAHvnBogH7s8IeMT+UGN8qrweILWmE57G7MfauB302dIFQowR9tug=="
|
||||
},
|
||||
"web": {
|
||||
"name": "ipfs-aqua-browser",
|
||||
"version": "0.1.0",
|
||||
"hasInstallScript": true,
|
||||
"dependencies": {
|
||||
"@fluencelabs/fluence": "0.27.5",
|
||||
"@fluencelabs/fluence-network-environment": "1.0.13",
|
||||
"@fluencelabs/fluence": "0.28.0",
|
||||
"@fluencelabs/fluence-network-environment": "1.0.14",
|
||||
"@fluencelabs/ipfs-execution-aqua": "file:../aqua",
|
||||
"@testing-library/jest-dom": "^5.14.1",
|
||||
"@testing-library/react": "^11.2.7",
|
||||
@ -21980,6 +21881,11 @@
|
||||
"ts-jest": "^27.1.3"
|
||||
}
|
||||
},
|
||||
"web/node_modules/@fluencelabs/fluence-network-environment": {
|
||||
"version": "1.0.14",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/fluence-network-environment/-/fluence-network-environment-1.0.14.tgz",
|
||||
"integrity": "sha512-lMiH+7obmJW2Q+PMUR/vNAuX6TcVqlKmsWAHvnBogH7s8IeMT+UGN8qrweILWmE57G7MfauB302dIFQowR9tug=="
|
||||
},
|
||||
"web/node_modules/@types/node": {
|
||||
"version": "12.20.55",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.55.tgz",
|
||||
@ -23471,13 +23377,13 @@
|
||||
}
|
||||
},
|
||||
"@fluencelabs/aqua": {
|
||||
"version": "0.8.0-368",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/aqua/-/aqua-0.8.0-368.tgz",
|
||||
"integrity": "sha512-vnqgjwJWa2XvNqGUCITvkhIiF7ps9WhZL4GfvtuSwVAsdpDaYGtxPH63wcYcG9TwRCr7nGgjOhJGXhkmGhUE2w==",
|
||||
"version": "0.10.3",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/aqua/-/aqua-0.10.3.tgz",
|
||||
"integrity": "sha512-v7Jy+KzZkUm7NuUgrp7UQ8gxuhykxuTU3JigCdxiZMcG3/zD+OtHzsSggVLxVjDP7CKuTcjEKZSCxObwHp/Tpw==",
|
||||
"requires": {
|
||||
"@fluencelabs/aqua-ipfs": "0.5.8",
|
||||
"@fluencelabs/aqua-ipfs": "0.5.9",
|
||||
"@fluencelabs/aqua-lib": "0.6.0",
|
||||
"@fluencelabs/fluence": "0.27.4",
|
||||
"@fluencelabs/fluence": "0.28.0",
|
||||
"@fluencelabs/fluence-network-environment": "1.0.13",
|
||||
"ipfs-http-client": "50.1.2"
|
||||
},
|
||||
@ -23487,31 +23393,6 @@
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/aqua-lib/-/aqua-lib-0.6.0.tgz",
|
||||
"integrity": "sha512-ifjtCM93KO3LhzPkMxqmXhwLmrg/scjOiyTihEVg7ns5N+BVzaK1eWzdOdqGdl9ZVoah43pdlQUepEo7VdRmsw=="
|
||||
},
|
||||
"@fluencelabs/fluence": {
|
||||
"version": "0.27.4",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/fluence/-/fluence-0.27.4.tgz",
|
||||
"integrity": "sha512-f85q8ZdmPlUd6uIgmS0CDTvSsb+TGvTqOljw0b161lfEuqPIXrjxJSt0/2Lyh2eEZ1P3slOka1tbVw01nVrt5w==",
|
||||
"requires": {
|
||||
"@fluencelabs/avm": "0.31.10",
|
||||
"@fluencelabs/connection": "0.2.0",
|
||||
"@fluencelabs/interfaces": "0.1.0",
|
||||
"@fluencelabs/keypair": "0.2.0",
|
||||
"@fluencelabs/marine-js": "0.3.37",
|
||||
"async": "3.2.3",
|
||||
"base64-js": "^1.5.1",
|
||||
"browser-or-node": "2.0.0",
|
||||
"bs58": "5.0.0",
|
||||
"buffer": "^6.0.3",
|
||||
"cids": "1.1.9",
|
||||
"loglevel": "1.8.0",
|
||||
"multiformats": "9.6.5",
|
||||
"peer-id": "0.16.0",
|
||||
"platform": "^1.3.6",
|
||||
"rxjs": "^7.5.5",
|
||||
"ts-pattern": "3.3.3",
|
||||
"uuid": "8.3.2"
|
||||
}
|
||||
},
|
||||
"any-signal": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/any-signal/-/any-signal-2.1.2.tgz",
|
||||
@ -23653,31 +23534,6 @@
|
||||
"minimatch": "^3.0.4"
|
||||
}
|
||||
},
|
||||
"libp2p-crypto": {
|
||||
"version": "0.21.2",
|
||||
"resolved": "https://registry.npmjs.org/libp2p-crypto/-/libp2p-crypto-0.21.2.tgz",
|
||||
"integrity": "sha512-EXFrhSpiHtJ+/L8xXDvQNK5VjUMG51u878jzZcaT5XhuN/zFg6PWJFnl/qB2Y2j7eMWnvCRP7Kp+ua2H36cG4g==",
|
||||
"requires": {
|
||||
"@noble/ed25519": "^1.5.1",
|
||||
"@noble/secp256k1": "^1.3.0",
|
||||
"err-code": "^3.0.1",
|
||||
"iso-random-stream": "^2.0.0",
|
||||
"multiformats": "^9.4.5",
|
||||
"node-forge": "^1.2.1",
|
||||
"protobufjs": "^6.11.2",
|
||||
"uint8arrays": "^3.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"uint8arrays": {
|
||||
"version": "3.1.1",
|
||||
"resolved": "https://registry.npmjs.org/uint8arrays/-/uint8arrays-3.1.1.tgz",
|
||||
"integrity": "sha512-+QJa8QRnbdXVpHYjLoTpJIdCTiw9Ir62nocClWuXIq2JIh4Uta0cQsTSpFL678p2CN8B+XSApwcU+pQEqVpKWg==",
|
||||
"requires": {
|
||||
"multiformats": "^9.4.2"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"multiaddr": {
|
||||
"version": "9.0.2",
|
||||
"resolved": "https://registry.npmjs.org/multiaddr/-/multiaddr-9.0.2.tgz",
|
||||
@ -23700,38 +23556,6 @@
|
||||
"multiaddr": "^9.0.1"
|
||||
}
|
||||
},
|
||||
"multiformats": {
|
||||
"version": "9.6.5",
|
||||
"resolved": "https://registry.npmjs.org/multiformats/-/multiformats-9.6.5.tgz",
|
||||
"integrity": "sha512-vMwf/FUO+qAPvl3vlSZEgEVFY/AxeZq5yg761ScF3CZsXgmTi/HGkicUiNN0CI4PW8FiY2P0OLklOcmQjdQJhw=="
|
||||
},
|
||||
"node-forge": {
|
||||
"version": "1.3.1",
|
||||
"resolved": "https://registry.npmjs.org/node-forge/-/node-forge-1.3.1.tgz",
|
||||
"integrity": "sha512-dPEtOeMvF9VMcYV/1Wb8CPoVAXtp6MKMlcbAt4ddqmGqUJ6fQZFXkNZNkNlfevtNkGtaSoXf/vNNNSvgrdXwtA=="
|
||||
},
|
||||
"peer-id": {
|
||||
"version": "0.16.0",
|
||||
"resolved": "https://registry.npmjs.org/peer-id/-/peer-id-0.16.0.tgz",
|
||||
"integrity": "sha512-EmL7FurFUduU9m1PS9cfJ5TAuCvxKQ7DKpfx3Yj6IKWyBRtosriFuOag/l3ni/dtPgPLwiA4R9IvpL7hsDLJuQ==",
|
||||
"requires": {
|
||||
"class-is": "^1.1.0",
|
||||
"libp2p-crypto": "^0.21.0",
|
||||
"multiformats": "^9.4.5",
|
||||
"protobufjs": "^6.10.2",
|
||||
"uint8arrays": "^3.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"uint8arrays": {
|
||||
"version": "3.1.1",
|
||||
"resolved": "https://registry.npmjs.org/uint8arrays/-/uint8arrays-3.1.1.tgz",
|
||||
"integrity": "sha512-+QJa8QRnbdXVpHYjLoTpJIdCTiw9Ir62nocClWuXIq2JIh4Uta0cQsTSpFL678p2CN8B+XSApwcU+pQEqVpKWg==",
|
||||
"requires": {
|
||||
"multiformats": "^9.4.2"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"retimer": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/retimer/-/retimer-2.0.0.tgz",
|
||||
@ -23754,9 +23578,9 @@
|
||||
}
|
||||
},
|
||||
"@fluencelabs/aqua-ipfs": {
|
||||
"version": "0.5.8",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/aqua-ipfs/-/aqua-ipfs-0.5.8.tgz",
|
||||
"integrity": "sha512-jKlyGBm8oJAIQ3Ags58oJ8QVTlCYSvZQVTnX2SnugGXWVwt4+9qtqtvNT5MvWKK3M9lCFDbJJy/qVTjzPJlaiw==",
|
||||
"version": "0.5.9",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/aqua-ipfs/-/aqua-ipfs-0.5.9.tgz",
|
||||
"integrity": "sha512-Vg7pYv4gEreOKfvzKEL5FchGqSKwat7JyKpqJO6h+FC5S1bl76UkI507+ExhijmUbQGznop8G33XFxyUi6q5SQ==",
|
||||
"requires": {
|
||||
"@fluencelabs/aqua-lib": "^0.5.2"
|
||||
}
|
||||
@ -23767,9 +23591,9 @@
|
||||
"integrity": "sha512-fmoFFE8myhLH9d+YR0+0ZPL2YIQyR6M1woAGu5d1xXI02Sjzn4id6dE4PpxHb8cSBPRie8AwsKobHCNqGxI8oA=="
|
||||
},
|
||||
"@fluencelabs/avm": {
|
||||
"version": "0.31.10",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/avm/-/avm-0.31.10.tgz",
|
||||
"integrity": "sha512-tkpjdHyRmsTwAEZCJt15//jXEgC2Nw2qFiD1NenvK127SlgKeuzQU9IMReUYY3dowb2IGeC578/uGMu96jHYKw=="
|
||||
"version": "0.35.3",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/avm/-/avm-0.35.3.tgz",
|
||||
"integrity": "sha512-Y5mPPCmAUUKc5CDO12IL8mGEreWa7maVdX0MWCAH4+GvfLPFN1FxOMSKRYEtvkyVEL88pc9pd8cm5IRCBkFthg=="
|
||||
},
|
||||
"@fluencelabs/connection": {
|
||||
"version": "0.2.0",
|
||||
@ -23834,11 +23658,11 @@
|
||||
}
|
||||
},
|
||||
"@fluencelabs/fluence": {
|
||||
"version": "0.27.5",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/fluence/-/fluence-0.27.5.tgz",
|
||||
"integrity": "sha512-nMCzd/oHHk5/yWdg/+rPB+sc8X+fQ5YgwPhGVDoxFs8/CmIr1G5Na8Y6l8rrigasgQd+LV5GtAyh50Oq7/IXkg==",
|
||||
"version": "0.28.0",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/fluence/-/fluence-0.28.0.tgz",
|
||||
"integrity": "sha512-SXb2vjTj8m/nw4jEILV0tu9VIFprGo8mNb2nOB5btxdsOI8GzQZkpGzTLrSd/+UagIo2GdxAu0GhBP8dxZXaqg==",
|
||||
"requires": {
|
||||
"@fluencelabs/avm": "0.31.10",
|
||||
"@fluencelabs/avm": "0.35.3",
|
||||
"@fluencelabs/connection": "0.2.0",
|
||||
"@fluencelabs/interfaces": "0.1.0",
|
||||
"@fluencelabs/keypair": "0.2.0",
|
||||
@ -23858,11 +23682,6 @@
|
||||
"uuid": "8.3.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"async": {
|
||||
"version": "3.2.4",
|
||||
"resolved": "https://registry.npmjs.org/async/-/async-3.2.4.tgz",
|
||||
"integrity": "sha512-iAB+JbDEGXhyIUavoDl9WP/Jj106Kz9DEn1DPgYw5ruDn0e3Wgi3sKFm55sASdGBNOQB8F59d9qQ7deqrHA8wQ=="
|
||||
},
|
||||
"libp2p-crypto": {
|
||||
"version": "0.21.2",
|
||||
"resolved": "https://registry.npmjs.org/libp2p-crypto/-/libp2p-crypto-0.21.2.tgz",
|
||||
@ -23883,11 +23702,6 @@
|
||||
"resolved": "https://registry.npmjs.org/loglevel/-/loglevel-1.8.1.tgz",
|
||||
"integrity": "sha512-tCRIJM51SHjAayKwC+QAg8hT8vg6z7GSgLJKGvzuPb1Wc+hLzqtuVLxp6/HzSPOozuK+8ErAhy7U/sVzw8Dgfg=="
|
||||
},
|
||||
"multiformats": {
|
||||
"version": "9.9.0",
|
||||
"resolved": "https://registry.npmjs.org/multiformats/-/multiformats-9.9.0.tgz",
|
||||
"integrity": "sha512-HoMUjhH9T8DDBNT+6xzkrd9ga/XiBI4xLr58LJACwK6G3HTOPeMz4nB4KJs33L2BelrIJa7P0VuNaVF3hMYfjg=="
|
||||
},
|
||||
"node-forge": {
|
||||
"version": "1.3.1",
|
||||
"resolved": "https://registry.npmjs.org/node-forge/-/node-forge-1.3.1.tgz",
|
||||
@ -23928,10 +23742,10 @@
|
||||
"@fluencelabs/ipfs-execution": {
|
||||
"version": "file:nodejs",
|
||||
"requires": {
|
||||
"@fluencelabs/aqua": "0.8.0-368",
|
||||
"@fluencelabs/aqua": "0.10.3",
|
||||
"@fluencelabs/aqua-lib": "0.6.0",
|
||||
"@fluencelabs/fluence": "^0.27.0",
|
||||
"@fluencelabs/fluence-network-environment": "1.0.13",
|
||||
"@fluencelabs/fluence": "^0.28.0",
|
||||
"@fluencelabs/fluence-network-environment": "1.0.14",
|
||||
"@fluencelabs/ipfs-execution-aqua": "file:../aqua",
|
||||
"@types/jest": "^27.0.3",
|
||||
"it-all": "^1.0.5",
|
||||
@ -23948,17 +23762,22 @@
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/aqua-lib/-/aqua-lib-0.6.0.tgz",
|
||||
"integrity": "sha512-ifjtCM93KO3LhzPkMxqmXhwLmrg/scjOiyTihEVg7ns5N+BVzaK1eWzdOdqGdl9ZVoah43pdlQUepEo7VdRmsw==",
|
||||
"dev": true
|
||||
},
|
||||
"@fluencelabs/fluence-network-environment": {
|
||||
"version": "1.0.14",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/fluence-network-environment/-/fluence-network-environment-1.0.14.tgz",
|
||||
"integrity": "sha512-lMiH+7obmJW2Q+PMUR/vNAuX6TcVqlKmsWAHvnBogH7s8IeMT+UGN8qrweILWmE57G7MfauB302dIFQowR9tug=="
|
||||
}
|
||||
}
|
||||
},
|
||||
"@fluencelabs/ipfs-execution-aqua": {
|
||||
"version": "file:aqua",
|
||||
"requires": {
|
||||
"@fluencelabs/aqua": "0.8.0-368",
|
||||
"@fluencelabs/aqua": "0.10.3",
|
||||
"@fluencelabs/aqua-ipfs": "^0.5.5",
|
||||
"@fluencelabs/aqua-lib": "0.6.0",
|
||||
"@fluencelabs/fluence": "^0.27.0",
|
||||
"@fluencelabs/fluence-network-environment": "1.0.13",
|
||||
"@fluencelabs/fluence": "^0.28.0",
|
||||
"@fluencelabs/fluence-network-environment": "1.0.14",
|
||||
"it-all": "^1.0.5",
|
||||
"multiaddr": "^10.0.0",
|
||||
"typescript": "^4.6.3",
|
||||
@ -23970,6 +23789,11 @@
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/aqua-lib/-/aqua-lib-0.6.0.tgz",
|
||||
"integrity": "sha512-ifjtCM93KO3LhzPkMxqmXhwLmrg/scjOiyTihEVg7ns5N+BVzaK1eWzdOdqGdl9ZVoah43pdlQUepEo7VdRmsw==",
|
||||
"dev": true
|
||||
},
|
||||
"@fluencelabs/fluence-network-environment": {
|
||||
"version": "1.0.14",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/fluence-network-environment/-/fluence-network-environment-1.0.14.tgz",
|
||||
"integrity": "sha512-lMiH+7obmJW2Q+PMUR/vNAuX6TcVqlKmsWAHvnBogH7s8IeMT+UGN8qrweILWmE57G7MfauB302dIFQowR9tug=="
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -26232,9 +26056,9 @@
|
||||
"integrity": "sha512-eBvWn1lvIApYMhzQMsu9ciLfkBY499mFZlNqG+/9WR7PVlroQw0vG30cOQQbaKz3sCEc44TAOu2ykzqXSNnwag=="
|
||||
},
|
||||
"async": {
|
||||
"version": "3.2.3",
|
||||
"resolved": "https://registry.npmjs.org/async/-/async-3.2.3.tgz",
|
||||
"integrity": "sha512-spZRyzKL5l5BZQrr/6m/SqFdBN0q3OCI0f9rjfBzCMBIP4p75P620rR3gTmaksNOhmzgdxcaxdNfMy6anrbM0g=="
|
||||
"version": "3.2.4",
|
||||
"resolved": "https://registry.npmjs.org/async/-/async-3.2.4.tgz",
|
||||
"integrity": "sha512-iAB+JbDEGXhyIUavoDl9WP/Jj106Kz9DEn1DPgYw5ruDn0e3Wgi3sKFm55sASdGBNOQB8F59d9qQ7deqrHA8wQ=="
|
||||
},
|
||||
"async-foreach": {
|
||||
"version": "0.1.3",
|
||||
@ -30291,8 +30115,8 @@
|
||||
"ipfs-aqua-browser": {
|
||||
"version": "file:web",
|
||||
"requires": {
|
||||
"@fluencelabs/fluence": "0.27.5",
|
||||
"@fluencelabs/fluence-network-environment": "1.0.13",
|
||||
"@fluencelabs/fluence": "0.28.0",
|
||||
"@fluencelabs/fluence-network-environment": "1.0.14",
|
||||
"@fluencelabs/ipfs-execution-aqua": "file:../aqua",
|
||||
"@testing-library/jest-dom": "^5.14.1",
|
||||
"@testing-library/react": "^11.2.7",
|
||||
@ -30317,6 +30141,11 @@
|
||||
"web-vitals": "^1.1.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@fluencelabs/fluence-network-environment": {
|
||||
"version": "1.0.14",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/fluence-network-environment/-/fluence-network-environment-1.0.14.tgz",
|
||||
"integrity": "sha512-lMiH+7obmJW2Q+PMUR/vNAuX6TcVqlKmsWAHvnBogH7s8IeMT+UGN8qrweILWmE57G7MfauB302dIFQowR9tug=="
|
||||
},
|
||||
"@types/node": {
|
||||
"version": "12.20.55",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.55.tgz",
|
||||
@ -31034,11 +30863,6 @@
|
||||
"minimatch": "^3.0.4"
|
||||
},
|
||||
"dependencies": {
|
||||
"async": {
|
||||
"version": "3.2.4",
|
||||
"resolved": "https://registry.npmjs.org/async/-/async-3.2.4.tgz",
|
||||
"integrity": "sha512-iAB+JbDEGXhyIUavoDl9WP/Jj106Kz9DEn1DPgYw5ruDn0e3Wgi3sKFm55sASdGBNOQB8F59d9qQ7deqrHA8wQ=="
|
||||
},
|
||||
"chalk": {
|
||||
"version": "4.1.2",
|
||||
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
|
||||
@ -33115,9 +32939,9 @@
|
||||
}
|
||||
},
|
||||
"multiformats": {
|
||||
"version": "9.7.0",
|
||||
"resolved": "https://registry.npmjs.org/multiformats/-/multiformats-9.7.0.tgz",
|
||||
"integrity": "sha512-uv/tcgwk0yN4DStopnBN4GTgvaAlYdy6KnZpuzEPFOYQd71DYFJjs0MN1ERElAflrZaYyGBWXyGxL5GgrxIx0Q=="
|
||||
"version": "9.9.0",
|
||||
"resolved": "https://registry.npmjs.org/multiformats/-/multiformats-9.9.0.tgz",
|
||||
"integrity": "sha512-HoMUjhH9T8DDBNT+6xzkrd9ga/XiBI4xLr58LJACwK6G3HTOPeMz4nB4KJs33L2BelrIJa7P0VuNaVF3hMYfjg=="
|
||||
},
|
||||
"multihashes": {
|
||||
"version": "4.0.3",
|
||||
|
@ -10,8 +10,8 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"ipfs-http-client": "^56.0.3",
|
||||
"@fluencelabs/aqua": "0.8.0-368",
|
||||
"@fluencelabs/fluence": "0.27.5",
|
||||
"@fluencelabs/aqua": "0.10.3",
|
||||
"@fluencelabs/fluence": "0.28.0",
|
||||
"typescript": "^4.6.3"
|
||||
},
|
||||
"engines": {
|
||||
|
@ -16,7 +16,7 @@ log = "0.4.14"
|
||||
rand = "0.8.4"
|
||||
|
||||
[dev-dependencies]
|
||||
marine-rs-sdk-test = "0.8.1"
|
||||
marine-rs-sdk-test = "0.8.2"
|
||||
|
||||
[profile.release]
|
||||
opt-level = "s"
|
||||
|
@ -4,8 +4,8 @@
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@fluencelabs/ipfs-execution-aqua": "file:../aqua",
|
||||
"@fluencelabs/fluence": "0.27.5",
|
||||
"@fluencelabs/fluence-network-environment": "1.0.13",
|
||||
"@fluencelabs/fluence": "0.28.0",
|
||||
"@fluencelabs/fluence-network-environment": "1.0.14",
|
||||
"@testing-library/jest-dom": "^5.14.1",
|
||||
"@testing-library/react": "^11.2.7",
|
||||
"@testing-library/user-event": "^12.8.3",
|
||||
|
@ -4,3 +4,13 @@ target/
|
||||
Cargo.lock
|
||||
**/*.bk
|
||||
**/*.bak
|
||||
|
||||
# recommended by Fluence Labs:
|
||||
.idea
|
||||
.fluence
|
||||
**/node_modules
|
||||
**/target/
|
||||
.repl_history
|
||||
.vscode/settings.json
|
||||
src/ts/src/aqua
|
||||
src/js/src/aqua
|
||||
|
13
aqua-examples/decentralized-blockchain-gateway/Cargo.toml
Normal file
13
aqua-examples/decentralized-blockchain-gateway/Cargo.toml
Normal file
@ -0,0 +1,13 @@
|
||||
[workspace]
|
||||
members = [
|
||||
"wasm-modules/curl-adapter",
|
||||
"wasm-modules/multi-provider-query",
|
||||
"wasm-modules/simple-quorum",
|
||||
"wasm-modules/utilities",
|
||||
"wasm-modules/eth-rpc",
|
||||
"wasm-modules/ipfs-adapter",
|
||||
"wasm-modules/ipfs-cli"
|
||||
]
|
||||
|
||||
[profile.release]
|
||||
opt-level = "s"
|
@ -15,28 +15,42 @@ data EVMResult:
|
||||
stdout: string
|
||||
stderr: string
|
||||
|
||||
service MyOp("op"):
|
||||
array_length(providers: []ProviderInfo) -> i64
|
||||
service I64ToF64("op"):
|
||||
identity(x: i64) -> f64
|
||||
|
||||
service MyOp2("op"):
|
||||
service ProviderInfoOp("op"):
|
||||
array_length(providers: []ProviderInfo) -> i64
|
||||
|
||||
service FuncAddrOp("op"):
|
||||
array_length(providers: []FunctionAddress) -> i64
|
||||
|
||||
service MultiProviderQuery("service-id"):
|
||||
get_block_number(provider: ProviderInfo) -> EVMResult
|
||||
get_block_number(provider: ProviderInfo) -> EVMResult
|
||||
|
||||
service Utilities("service_id"):
|
||||
kv_to_u64(kv: string, k: string) -> u64
|
||||
|
||||
service Console("run-console"):
|
||||
print(msg: string)
|
||||
print(msg: string)
|
||||
|
||||
alias QuorumService: FunctionAddress
|
||||
|
||||
data Quorum:
|
||||
n: u32
|
||||
mode: u64
|
||||
freq: u32
|
||||
err_str: string
|
||||
|
||||
service SimpleQuorum("service-id"):
|
||||
point_estimate(data: []EVMResult, min_points: u32) -> Quorum
|
||||
is_quorum(x:u64, y:u64, threshold:f64) -> bool
|
||||
|
||||
|
||||
func get_block_heights(providers: []ProviderInfo, addrs: []FunctionAddress) -> []EVMResult:
|
||||
result: *EVMResult
|
||||
|
||||
n <- MyOp.array_length(providers)
|
||||
m <- MyOp2.array_length(addrs)
|
||||
|
||||
n <- ProviderInfoOp.array_length(providers)
|
||||
m <- FuncAddrOp.array_length(addrs)
|
||||
|
||||
if n > 0:
|
||||
for addr <- addrs par:
|
||||
@ -50,8 +64,8 @@ func get_block_heights(providers: []ProviderInfo, addrs: []FunctionAddress) -> [
|
||||
|
||||
func get_block_height(providers: []ProviderInfo, addr: FunctionAddress) ->[]EVMResult:
|
||||
result: *EVMResult
|
||||
n <- MyOp.array_length(providers)
|
||||
|
||||
n <- ProviderInfoOp.array_length(providers)
|
||||
|
||||
if n > 0:
|
||||
on addr.peer_id:
|
||||
MultiProviderQuery addr.service_id
|
||||
@ -63,33 +77,21 @@ func get_block_height(providers: []ProviderInfo, addr: FunctionAddress) ->[]EVMR
|
||||
|
||||
func provider_test(providers: []ProviderInfo) -> []string:
|
||||
result: *string
|
||||
n <- MyOp.array_length(providers)
|
||||
|
||||
n <- ProviderInfoOp.array_length(providers)
|
||||
|
||||
if n > 0:
|
||||
for provider <- providers:
|
||||
result <<- provider.name
|
||||
join result[n-1]
|
||||
<- result
|
||||
|
||||
alias QuorumService: FunctionAddress
|
||||
|
||||
data Quorum:
|
||||
n: u32
|
||||
mode: u64
|
||||
freq: u32
|
||||
err_str: string
|
||||
|
||||
service SimpleQuorum("service-id"):
|
||||
point_estimate(data: []EVMResult, min_points: u32) -> Quorum
|
||||
is_quorum(x:u64, y:u64, threshold:f64) -> bool
|
||||
|
||||
func get_block_height_raw_quorum(providers: []ProviderInfo, addrs: []FunctionAddress, q_addr: QuorumService) -> Quorum:
|
||||
result: *EVMResult
|
||||
result2: *string
|
||||
quorum: *Quorum
|
||||
|
||||
n <- MyOp.array_length(providers)
|
||||
n2 <- MyOp2.array_length(addrs)
|
||||
|
||||
n <- ProviderInfoOp.array_length(providers)
|
||||
n2 <- FuncAddrOp.array_length(addrs)
|
||||
|
||||
if n > 0:
|
||||
for addr <- addrs par:
|
||||
@ -100,7 +102,7 @@ func get_block_height_raw_quorum(providers: []ProviderInfo, addrs: []FunctionAdd
|
||||
result2 <<- provider.name
|
||||
-- join result[n2-1]
|
||||
join result[n*n2-1]
|
||||
|
||||
|
||||
on q_addr.peer_id:
|
||||
SimpleQuorum q_addr.service_id
|
||||
quorum <-SimpleQuorum.point_estimate(result, 3)
|
||||
@ -121,10 +123,10 @@ func get_block_height_quorum(providers: []ProviderInfo, addrs: []FunctionAddress
|
||||
result: *EVMResult
|
||||
quorum: *Quorum
|
||||
is_quorum: *bool
|
||||
min_points = 3 -- minimum points we want in order to calculate an oracle
|
||||
min_points = 3 -- minimum points we want in order to calculate an oracle
|
||||
|
||||
n <- MyOp.array_length(providers)
|
||||
n2 <- MyOp2.array_length(addrs)
|
||||
n <- ProviderInfoOp.array_length(providers)
|
||||
n2 <- FuncAddrOp.array_length(addrs)
|
||||
|
||||
if n > 0:
|
||||
for addr <- addrs par:
|
||||
@ -133,12 +135,12 @@ func get_block_height_quorum(providers: []ProviderInfo, addrs: []FunctionAddress
|
||||
for provider <- providers:
|
||||
result <- MultiProviderQuery.get_block_number(provider)
|
||||
join result[n*n2-2]
|
||||
|
||||
|
||||
on q_addr.peer_id:
|
||||
SimpleQuorum q_addr.service_id
|
||||
quorum <-SimpleQuorum.point_estimate(result, min_points)
|
||||
is_quorum <- SimpleQuorum.is_quorum(quorum[0].freq, quorum[0].n, t_quorum)
|
||||
|
||||
|
||||
<- quorum[0], is_quorum[0]
|
||||
|
||||
func get_block_height_quorum_with_mapper(providers: []ProviderInfo, addrs: []FunctionAddress, q_addr: QuorumService, u_addr: FunctionAddress, t_quorum: f64) -> Quorum, bool:
|
||||
@ -146,10 +148,10 @@ func get_block_height_quorum_with_mapper(providers: []ProviderInfo, addrs: []Fun
|
||||
quorum: *Quorum
|
||||
is_quorum: *bool
|
||||
|
||||
min_points = 3 -- minimum points we want in order to calculate an oracle
|
||||
min_points = 3 -- minimum points we want in order to calculate an oracle
|
||||
|
||||
n <- MyOp.array_length(providers)
|
||||
n2 <- MyOp2.array_length(addrs)
|
||||
n <- ProviderInfoOp.array_length(providers)
|
||||
n2 <- FuncAddrOp.array_length(addrs)
|
||||
|
||||
if n > 0:
|
||||
for addr <- addrs par:
|
||||
@ -169,7 +171,7 @@ func get_block_height_quorum_with_mapper(providers: []ProviderInfo, addrs: []Fun
|
||||
is_quorum <<- false
|
||||
else:
|
||||
is_quorum <- SimpleQuorum.is_quorum(quorum[0].freq, quorum[0].n, t_quorum)
|
||||
|
||||
|
||||
deviations: *EVMResult
|
||||
n_dev = 1
|
||||
if quorum[0].freq != quorum[0].n:
|
||||
@ -198,7 +200,7 @@ func get_block_height_quorum_with_cid(providers: []ProviderInfo, services_cid: I
|
||||
quorum: *Quorum
|
||||
is_quorum: *bool
|
||||
|
||||
min_points = 3 -- minimum points we want in order to calculate an oracle
|
||||
min_points = 3 -- minimum points we want in order to calculate an oracle
|
||||
|
||||
on ipfs_service.peer_id:
|
||||
IpfsCli ipfs_service.service_id
|
||||
@ -206,8 +208,8 @@ func get_block_height_quorum_with_cid(providers: []ProviderInfo, services_cid: I
|
||||
q_addrs <- IpfsCli.params_from_cid(quorum_cid.multiaddr, quorum_cid.cid)
|
||||
u_addrs <- IpfsCli.params_from_cid(utility_cid.multiaddr, utility_cid.cid)
|
||||
|
||||
n <- MyOp.array_length(providers)
|
||||
m <- MyOp2.array_length(addrs)
|
||||
n <- ProviderInfoOp.array_length(providers)
|
||||
m <- FuncAddrOp.array_length(addrs)
|
||||
|
||||
if n > 0:
|
||||
for addr <- addrs par:
|
||||
@ -224,7 +226,7 @@ func get_block_height_quorum_with_cid(providers: []ProviderInfo, services_cid: I
|
||||
is_quorum <<- false
|
||||
else:
|
||||
is_quorum <- SimpleQuorum.is_quorum(quorum[0].freq, quorum[0].n, t_quorum)
|
||||
|
||||
|
||||
deviations: *EVMResult
|
||||
n_dev = 1
|
||||
if quorum[0].freq != quorum[0].n:
|
||||
@ -238,5 +240,3 @@ func get_block_height_quorum_with_cid(providers: []ProviderInfo, services_cid: I
|
||||
co ConsoleEVMResult.print(res)
|
||||
Math.add(n_dev, 1)
|
||||
<- quorum[0], is_quorum[0]
|
||||
|
||||
|
||||
|
@ -52,5 +52,22 @@
|
||||
"logger_enabled": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"eth-rpc": {
|
||||
"modules": [
|
||||
{
|
||||
"name": "curl_adapter",
|
||||
"path": "./artifacts/curl_adapter.wasm",
|
||||
"max_heap_size": "2 MiB",
|
||||
"mounted_binaries": [["curl", "/usr/bin/curl"]],
|
||||
"logger_enabled": true
|
||||
},
|
||||
{
|
||||
"name": "eth-rpc",
|
||||
"path": "./artifacts/eth-rpc.wasm",
|
||||
"logger_enabled": true,
|
||||
"max_heap_size": "100 MiB"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,13 @@
|
||||
# yaml-language-server: $schema=../../../.fluence/schemas/service.yaml.json
|
||||
|
||||
# Defines a [Marine service](https://fluence.dev/docs/build/concepts/#services), most importantly the modules that the service consists of. For Fluence CLI, **service** - is a directory which contains this config. You can use `fluence service new` command to generate a template for new service
|
||||
|
||||
# Documentation: https://github.com/fluencelabs/fluence-cli/tree/main/docs/configs/service.md
|
||||
|
||||
version: 0
|
||||
name: eth_rpc
|
||||
modules:
|
||||
facade:
|
||||
get: ../../../wasm-modules/eth-rpc
|
||||
curl-adapter:
|
||||
get: ../../../wasm-modules/curl-adapter
|
@ -0,0 +1,13 @@
|
||||
# yaml-language-server: $schema=../../../.fluence/schemas/service.yaml.json
|
||||
|
||||
# Defines a [Marine service](https://fluence.dev/docs/build/concepts/#services), most importantly the modules that the service consists of. For Fluence CLI, **service** - is a directory which contains this config. You can use `fluence service new` command to generate a template for new service
|
||||
|
||||
# Documentation: https://github.com/fluencelabs/fluence-cli/tree/main/docs/configs/service.md
|
||||
|
||||
version: 0
|
||||
name: ipfs_package
|
||||
modules:
|
||||
facade:
|
||||
get: ../../../wasm-modules/ipfs-cli
|
||||
ipfs-adapter:
|
||||
get: ../../../wasm-modules/ipfs-adapter
|
@ -0,0 +1,13 @@
|
||||
# yaml-language-server: $schema=../../../.fluence/schemas/service.yaml.json
|
||||
|
||||
# Defines a [Marine service](https://fluence.dev/docs/build/concepts/#services), most importantly the modules that the service consists of. For Fluence CLI, **service** - is a directory which contains this config. You can use `fluence service new` command to generate a template for new service
|
||||
|
||||
# Documentation: https://github.com/fluencelabs/fluence-cli/tree/main/docs/configs/service.md
|
||||
|
||||
version: 0
|
||||
name: multi_provider_query
|
||||
modules:
|
||||
facade:
|
||||
get: ../../../wasm-modules/multi-provider-query
|
||||
curl-adapter:
|
||||
get: ../../../wasm-modules/curl-adapter
|
@ -0,0 +1,11 @@
|
||||
# yaml-language-server: $schema=../../../.fluence/schemas/service.yaml.json
|
||||
|
||||
# Defines a [Marine service](https://fluence.dev/docs/build/concepts/#services), most importantly the modules that the service consists of. For Fluence CLI, **service** - is a directory which contains this config. You can use `fluence service new` command to generate a template for new service
|
||||
|
||||
# Documentation: https://github.com/fluencelabs/fluence-cli/tree/main/docs/configs/service.md
|
||||
|
||||
version: 0
|
||||
name: simple_quorum
|
||||
modules:
|
||||
facade:
|
||||
get: ../../../wasm-modules/simple-quorum
|
@ -0,0 +1,11 @@
|
||||
# yaml-language-server: $schema=../../../.fluence/schemas/service.yaml.json
|
||||
|
||||
# Defines a [Marine service](https://fluence.dev/docs/build/concepts/#services), most importantly the modules that the service consists of. For Fluence CLI, **service** - is a directory which contains this config. You can use `fluence service new` command to generate a template for new service
|
||||
|
||||
# Documentation: https://github.com/fluencelabs/fluence-cli/tree/main/docs/configs/service.md
|
||||
|
||||
version: 0
|
||||
name: utilities
|
||||
modules:
|
||||
facade:
|
||||
get: ../../../wasm-modules/utilities
|
@ -0,0 +1,14 @@
|
||||
# yaml-language-server: $schema=.fluence/schemas/fluence-lock.yaml.json
|
||||
|
||||
# Defines a lock file for Fluence Project dependencies. When dependencies are installed - their exact versions are saved here.
|
||||
|
||||
# Documentation: https://github.com/fluencelabs/fluence-cli/tree/main/docs/configs/fluence-lock.md
|
||||
|
||||
version: 0
|
||||
cargo:
|
||||
marine: 0.12.5
|
||||
mrepl: 0.18.8
|
||||
npm:
|
||||
"@fluencelabs/aqua": 0.9.4
|
||||
"@fluencelabs/aqua-lib": 0.6.0
|
||||
"@fluencelabs/spell": 0.0.1
|
37
aqua-examples/decentralized-blockchain-gateway/fluence.yaml
Normal file
37
aqua-examples/decentralized-blockchain-gateway/fluence.yaml
Normal file
@ -0,0 +1,37 @@
|
||||
# yaml-language-server: $schema=.fluence/schemas/fluence.yaml.json
|
||||
|
||||
# Defines Fluence Project, most importantly - what exactly you want to deploy and how. You can use `fluence init` command to generate a template for new Fluence project
|
||||
|
||||
# Documentation: https://github.com/fluencelabs/fluence-cli/tree/main/docs/configs/fluence.md
|
||||
|
||||
version: 2
|
||||
aquaInputPath: src/aqua/main.aqua
|
||||
dependencies:
|
||||
npm:
|
||||
"@fluencelabs/aqua-lib": 0.6.0
|
||||
"@fluencelabs/spell": 0.0.1
|
||||
"@fluencelabs/aqua": 0.9.4
|
||||
cargo:
|
||||
marine: 0.12.5
|
||||
mrepl: 0.18.8
|
||||
services:
|
||||
multi_provider_query:
|
||||
get: configs/services/multi-provider-query
|
||||
deploy:
|
||||
- deployId: default
|
||||
simple_quorum:
|
||||
get: configs/services/simple-quorum
|
||||
deploy:
|
||||
- deployId: default
|
||||
utilities:
|
||||
get: configs/services/utilities
|
||||
deploy:
|
||||
- deployId: default
|
||||
eth_rpc:
|
||||
get: configs/services/eth-rpc
|
||||
deploy:
|
||||
- deployId: default
|
||||
ipfs_package:
|
||||
get: configs/services/ipfs-package
|
||||
deploy:
|
||||
- deployId: default
|
@ -0,0 +1,50 @@
|
||||
# Aqua Ethereum Gateway
|
||||
|
||||
Gateway represents access to different Ethereum API providers (infura, alchemy). It can be used with Web3 client and load balancing requests between different providers.
|
||||
|
||||
|
||||
## Installation
|
||||
|
||||
```shell
|
||||
npm install -g @fluencelabs/aqua-eth-gateway
|
||||
```
|
||||
|
||||
## Example
|
||||
|
||||
```shell
|
||||
aqua-eth-gateway path/to/config.json
|
||||
```
|
||||
|
||||
where config is:
|
||||
|
||||
```json
|
||||
{
|
||||
"providers": [
|
||||
"https://goerli.infura.io/v3/your-api-key",
|
||||
"https://eth-goerli.g.alchemy.com/v2/your-api-key"
|
||||
],
|
||||
"mode": "random",
|
||||
"relay": "fluence/peer/address",
|
||||
"serviceId": "eth-rpc serviceId",
|
||||
"port": 3000,
|
||||
"counterServiceId": null,
|
||||
"counterPeerId": null,
|
||||
"quorumServiceId": null,
|
||||
"quorumPeerId": null,
|
||||
"quorumNumber": null,
|
||||
"quorumTimeout": null,
|
||||
"requestTimeout": null
|
||||
}
|
||||
```
|
||||
|
||||
`counterServiceId` and `counterPeerId` is credentials to counter service for `round-robin` mode. Will be used local counter if undefined.
|
||||
`quorumServiceId` and `quorumPeerId` is credentials to counter service for `round-robin` mode. Will be used local counter if undefined.
|
||||
`quorumNumber` is `2` by default.
|
||||
`quorumTimeout` is how long we will wait for all responses
|
||||
`requestTimeout` is how long we will wait for aqua request
|
||||
|
||||
## Mode
|
||||
|
||||
`random` - choose providers randomly
|
||||
`round-robin` - choose providers in circle order
|
||||
`quorum` - call all providers and choose the result that is the same from `>= quorumNumber` providers. Or return an error.
|
236
aqua-examples/decentralized-blockchain-gateway/gateway/aqua-compiled/rpc.d.ts
vendored
Normal file
236
aqua-examples/decentralized-blockchain-gateway/gateway/aqua-compiled/rpc.d.ts
vendored
Normal file
@ -0,0 +1,236 @@
|
||||
/* eslint-disable */
|
||||
// @ts-nocheck
|
||||
/**
|
||||
*
|
||||
* This file is auto-generated. Do not edit manually: changes may be erased.
|
||||
* Generated by Aqua compiler: https://github.com/fluencelabs/aqua/.
|
||||
* If you find any bugs, please write an issue on GitHub: https://github.com/fluencelabs/aqua/issues
|
||||
* Aqua version: 0.10.1
|
||||
*
|
||||
*/
|
||||
|
||||
import {
|
||||
v5_callFunction as callFunction$$,
|
||||
v5_registerService as registerService$$,
|
||||
} from '@fluencelabs/js-client.api';
|
||||
|
||||
|
||||
|
||||
// Services
|
||||
export interface NumOpDef {
|
||||
identity: (n: number, callParams: CallParams$$<'n'>) => number | Promise<number>;
|
||||
}
|
||||
export function registerNumOp(service: NumOpDef): void;
|
||||
export function registerNumOp(serviceId: string, service: NumOpDef): void;
|
||||
export function registerNumOp(peer: IFluenceClient$$, service: NumOpDef): void;
|
||||
export function registerNumOp(peer: IFluenceClient$$, serviceId: string, service: NumOpDef): void;
|
||||
|
||||
export interface LoggerDef {
|
||||
log: (s: string[], callParams: CallParams$$<'s'>) => void | Promise<void>;
|
||||
logCall: (s: string, callParams: CallParams$$<'s'>) => void | Promise<void>;
|
||||
}
|
||||
export function registerLogger(service: LoggerDef): void;
|
||||
export function registerLogger(serviceId: string, service: LoggerDef): void;
|
||||
export function registerLogger(peer: IFluenceClient$$, service: LoggerDef): void;
|
||||
export function registerLogger(peer: IFluenceClient$$, serviceId: string, service: LoggerDef): void;
|
||||
|
||||
export interface QuorumCheckerDef {
|
||||
check: (results: { error: string; success: boolean; value: string; }[], minResults: number, callParams: CallParams$$<'results' | 'minResults'>) => { error: string; results: { error: string; success: boolean; value: string; }[]; value: string; } | Promise<{ error: string; results: { error: string; success: boolean; value: string; }[]; value: string; }>;
|
||||
}
|
||||
export function registerQuorumChecker(service: QuorumCheckerDef): void;
|
||||
export function registerQuorumChecker(serviceId: string, service: QuorumCheckerDef): void;
|
||||
export function registerQuorumChecker(peer: IFluenceClient$$, service: QuorumCheckerDef): void;
|
||||
export function registerQuorumChecker(peer: IFluenceClient$$, serviceId: string, service: QuorumCheckerDef): void;
|
||||
|
||||
export interface EthCallerDef {
|
||||
eth_call: (uri: string, method: string, jsonArgs: string[], callParams: CallParams$$<'uri' | 'method' | 'jsonArgs'>) => { error: string; success: boolean; value: string; } | Promise<{ error: string; success: boolean; value: string; }>;
|
||||
}
|
||||
export function registerEthCaller(serviceId: string, service: EthCallerDef): void;
|
||||
export function registerEthCaller(peer: IFluenceClient$$, serviceId: string, service: EthCallerDef): void;
|
||||
|
||||
export interface CounterDef {
|
||||
incrementAndReturn: (callParams: CallParams$$<null>) => number | Promise<number>;
|
||||
}
|
||||
export function registerCounter(service: CounterDef): void;
|
||||
export function registerCounter(serviceId: string, service: CounterDef): void;
|
||||
export function registerCounter(peer: IFluenceClient$$, service: CounterDef): void;
|
||||
export function registerCounter(peer: IFluenceClient$$, serviceId: string, service: CounterDef): void;
|
||||
|
||||
|
||||
// Functions
|
||||
|
||||
export type RoundRobinEthResult = { error: string; success: boolean; value: string; }
|
||||
export function roundRobinEth(
|
||||
uris: string[],
|
||||
method: string,
|
||||
jsonArgs: string[],
|
||||
serviceId: string,
|
||||
counterServiceId: string,
|
||||
counterPeerId: string,
|
||||
config?: {ttl?: number}
|
||||
): Promise<RoundRobinEthResult>;
|
||||
|
||||
export function roundRobinEth(
|
||||
peer: IFluenceClient$$,
|
||||
uris: string[],
|
||||
method: string,
|
||||
jsonArgs: string[],
|
||||
serviceId: string,
|
||||
counterServiceId: string,
|
||||
counterPeerId: string,
|
||||
config?: {ttl?: number}
|
||||
): Promise<RoundRobinEthResult>;
|
||||
|
||||
|
||||
export type EmptyResult = { error: string; success: boolean; value: string; }
|
||||
export function empty(
|
||||
config?: {ttl?: number}
|
||||
): Promise<EmptyResult>;
|
||||
|
||||
export function empty(
|
||||
peer: IFluenceClient$$,
|
||||
config?: {ttl?: number}
|
||||
): Promise<EmptyResult>;
|
||||
|
||||
|
||||
export type QuorumEthResult = { error: string; results: { error: string; success: boolean; value: string; }[]; value: string; }
|
||||
export function quorumEth(
|
||||
uris: string[],
|
||||
quorumNumber: number,
|
||||
timeout: number,
|
||||
method: string,
|
||||
jsonArgs: string[],
|
||||
serviceId: string,
|
||||
quorumServiceId: string,
|
||||
quorumPeerId: string,
|
||||
config?: {ttl?: number}
|
||||
): Promise<QuorumEthResult>;
|
||||
|
||||
export function quorumEth(
|
||||
peer: IFluenceClient$$,
|
||||
uris: string[],
|
||||
quorumNumber: number,
|
||||
timeout: number,
|
||||
method: string,
|
||||
jsonArgs: string[],
|
||||
serviceId: string,
|
||||
quorumServiceId: string,
|
||||
quorumPeerId: string,
|
||||
config?: {ttl?: number}
|
||||
): Promise<QuorumEthResult>;
|
||||
|
||||
|
||||
export type RandomLoadBalancingResult = { error: string; success: boolean; value: string; }
|
||||
export function randomLoadBalancing(
|
||||
uris: string[],
|
||||
method: string,
|
||||
jsonArgs: string[],
|
||||
serviceId: string,
|
||||
callFunc: (arg0: string, arg1: string, arg2: string[], arg3: string, callParams: CallParams$$<'arg0' | 'arg1' | 'arg2' | 'arg3'>) => { error: string; success: boolean; value: string; } | Promise<{ error: string; success: boolean; value: string; }>,
|
||||
config?: {ttl?: number}
|
||||
): Promise<RandomLoadBalancingResult>;
|
||||
|
||||
export function randomLoadBalancing(
|
||||
peer: IFluenceClient$$,
|
||||
uris: string[],
|
||||
method: string,
|
||||
jsonArgs: string[],
|
||||
serviceId: string,
|
||||
callFunc: (arg0: string, arg1: string, arg2: string[], arg3: string, callParams: CallParams$$<'arg0' | 'arg1' | 'arg2' | 'arg3'>) => { error: string; success: boolean; value: string; } | Promise<{ error: string; success: boolean; value: string; }>,
|
||||
config?: {ttl?: number}
|
||||
): Promise<RandomLoadBalancingResult>;
|
||||
|
||||
|
||||
export type RandomLoadBalancingEthResult = { error: string; success: boolean; value: string; }
|
||||
export function randomLoadBalancingEth(
|
||||
uris: string[],
|
||||
method: string,
|
||||
jsonArgs: string[],
|
||||
serviceId: string,
|
||||
config?: {ttl?: number}
|
||||
): Promise<RandomLoadBalancingEthResult>;
|
||||
|
||||
export function randomLoadBalancingEth(
|
||||
peer: IFluenceClient$$,
|
||||
uris: string[],
|
||||
method: string,
|
||||
jsonArgs: string[],
|
||||
serviceId: string,
|
||||
config?: {ttl?: number}
|
||||
): Promise<RandomLoadBalancingEthResult>;
|
||||
|
||||
|
||||
export type QuorumResult = { error: string; results: { error: string; success: boolean; value: string; }[]; value: string; }
|
||||
export function quorum(
|
||||
uris: string[],
|
||||
quorumNumber: number,
|
||||
timeout: number,
|
||||
method: string,
|
||||
jsonArgs: string[],
|
||||
serviceId: string,
|
||||
quorumServiceId: string,
|
||||
quorumPeerId: string,
|
||||
callFunc: (arg0: string, arg1: string, arg2: string[], arg3: string, callParams: CallParams$$<'arg0' | 'arg1' | 'arg2' | 'arg3'>) => { error: string; success: boolean; value: string; } | Promise<{ error: string; success: boolean; value: string; }>,
|
||||
config?: {ttl?: number}
|
||||
): Promise<QuorumResult>;
|
||||
|
||||
export function quorum(
|
||||
peer: IFluenceClient$$,
|
||||
uris: string[],
|
||||
quorumNumber: number,
|
||||
timeout: number,
|
||||
method: string,
|
||||
jsonArgs: string[],
|
||||
serviceId: string,
|
||||
quorumServiceId: string,
|
||||
quorumPeerId: string,
|
||||
callFunc: (arg0: string, arg1: string, arg2: string[], arg3: string, callParams: CallParams$$<'arg0' | 'arg1' | 'arg2' | 'arg3'>) => { error: string; success: boolean; value: string; } | Promise<{ error: string; success: boolean; value: string; }>,
|
||||
config?: {ttl?: number}
|
||||
): Promise<QuorumResult>;
|
||||
|
||||
|
||||
export type RoundRobinResult = { error: string; success: boolean; value: string; }
|
||||
export function roundRobin(
|
||||
uris: string[],
|
||||
method: string,
|
||||
jsonArgs: string[],
|
||||
serviceId: string,
|
||||
counterServiceId: string,
|
||||
counterPeerId: string,
|
||||
callFunc: (arg0: string, arg1: string, arg2: string[], arg3: string, callParams: CallParams$$<'arg0' | 'arg1' | 'arg2' | 'arg3'>) => { error: string; success: boolean; value: string; } | Promise<{ error: string; success: boolean; value: string; }>,
|
||||
config?: {ttl?: number}
|
||||
): Promise<RoundRobinResult>;
|
||||
|
||||
export function roundRobin(
|
||||
peer: IFluenceClient$$,
|
||||
uris: string[],
|
||||
method: string,
|
||||
jsonArgs: string[],
|
||||
serviceId: string,
|
||||
counterServiceId: string,
|
||||
counterPeerId: string,
|
||||
callFunc: (arg0: string, arg1: string, arg2: string[], arg3: string, callParams: CallParams$$<'arg0' | 'arg1' | 'arg2' | 'arg3'>) => { error: string; success: boolean; value: string; } | Promise<{ error: string; success: boolean; value: string; }>,
|
||||
config?: {ttl?: number}
|
||||
): Promise<RoundRobinResult>;
|
||||
|
||||
|
||||
export type CallResult = { error: string; success: boolean; value: string; }
|
||||
export function call(
|
||||
uri: string,
|
||||
method: string,
|
||||
jsonArgs: string[],
|
||||
serviceId: string,
|
||||
config?: {ttl?: number}
|
||||
): Promise<CallResult>;
|
||||
|
||||
export function call(
|
||||
peer: IFluenceClient$$,
|
||||
uri: string,
|
||||
method: string,
|
||||
jsonArgs: string[],
|
||||
serviceId: string,
|
||||
config?: {ttl?: number}
|
||||
): Promise<CallResult>;
|
||||
|
||||
|
||||
/* eslint-enable */
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,76 @@
|
||||
import "@fluencelabs/aqua-lib/builtin.aqua"
|
||||
|
||||
export randomLoadBalancingEth, roundRobinEth, Counter, Logger
|
||||
|
||||
data EthResult:
|
||||
value: string
|
||||
success: bool
|
||||
error: string
|
||||
|
||||
data QuorumResult:
|
||||
value: string
|
||||
results: []EthResult
|
||||
error: string
|
||||
|
||||
service Logger("logger"):
|
||||
log(s: []string)
|
||||
logCall(s: string)
|
||||
|
||||
service NumOp("op"):
|
||||
identity(n: u64) -> i64
|
||||
|
||||
service Counter("counter"):
|
||||
incrementAndReturn() -> u32
|
||||
|
||||
service QuorumChecker("quorum"):
|
||||
check(results: []EthResult, minResults: u32) -> QuorumResult
|
||||
|
||||
func empty() -> EthResult:
|
||||
<- EthResult(value = "", success = true, error = "")
|
||||
|
||||
service EthCaller:
|
||||
eth_call(uri: string, method: string, jsonArgs: []string) -> EthResult
|
||||
|
||||
func call(uri: string, method: string, jsonArgs: []string, serviceId: string) -> EthResult:
|
||||
EthCaller serviceId
|
||||
on HOST_PEER_ID:
|
||||
res <- EthCaller.eth_call(uri, method, jsonArgs)
|
||||
<- res
|
||||
|
||||
func randomLoadBalancing(uris: []string, method: string, jsonArgs: []string, serviceId: string, callFunc: string, string, []string, string -> EthResult) -> EthResult:
|
||||
on INIT_PEER_ID:
|
||||
time <- NumOp.identity(Peer.timestamp_sec())
|
||||
providerNumber = time % Op.array_length(uris)
|
||||
Logger.logCall(uris[providerNumber])
|
||||
<- callFunc(uris[providerNumber], method, jsonArgs, serviceId)
|
||||
|
||||
func randomLoadBalancingEth(uris: []string, method: string, jsonArgs: []string, serviceId: string) -> EthResult:
|
||||
<- randomLoadBalancing(uris, method, jsonArgs, serviceId, call)
|
||||
|
||||
func roundRobin(uris: []string, method: string, jsonArgs: []string, serviceId: string, counterServiceId: string, counterPeerId: string, callFunc: string, string, []string, string -> EthResult) -> EthResult:
|
||||
on counterPeerId:
|
||||
Counter counterServiceId
|
||||
requestNumber <- Counter.incrementAndReturn()
|
||||
on INIT_PEER_ID:
|
||||
providerNumber = requestNumber % uris.length
|
||||
Logger.logCall(uris[providerNumber])
|
||||
<- callFunc(uris[providerNumber], method, jsonArgs, serviceId)
|
||||
|
||||
func roundRobinEth(uris: []string, method: string, jsonArgs: []string, serviceId: string, counterServiceId: string, counterPeerId: string) -> EthResult:
|
||||
<- roundRobin(uris, method, jsonArgs, serviceId, counterServiceId, counterPeerId, call)
|
||||
|
||||
func quorum(uris: []string, quorumNumber: u32, timeout: u32, method: string, jsonArgs: []string, serviceId: string, quorumServiceId: string, quorumPeerId: string,
|
||||
callFunc: string, string, []string, string -> EthResult) -> QuorumResult:
|
||||
results: *EthResult
|
||||
on INIT_PEER_ID:
|
||||
for uri <- uris par:
|
||||
results <- callFunc(uri, method, jsonArgs, serviceId)
|
||||
join results[uris.length - 1]
|
||||
par Peer.timeout(timeout, "")
|
||||
on quorumPeerId:
|
||||
Counter quorumServiceId
|
||||
quorumResult <- QuorumChecker.check(results, quorumNumber)
|
||||
<- quorumResult
|
||||
|
||||
func quorumEth(uris: []string, quorumNumber: u32, timeout: u32, method: string, jsonArgs: []string, serviceId: string, quorumServiceId: string, quorumPeerId: string) -> QuorumResult:
|
||||
<- quorum(uris, quorumNumber, timeout, method, jsonArgs, serviceId, quorumServiceId, quorumPeerId, call)
|
@ -0,0 +1,18 @@
|
||||
{
|
||||
"providers": [
|
||||
"https://goerli.infura.io/v3/77214656b25f4cad9cd2540c6d40c301",
|
||||
"https://goerli.infura.io/v3/c48f3b538f154204ad53d04aa8990544"
|
||||
],
|
||||
"mode": "quorum",
|
||||
"relay": "/dns4/kras-02.fluence.dev/tcp/19001/wss/p2p/12D3KooWHLxVhUQyAuZe6AHMB29P7wkvTNMn7eDMcsqimJYLKREf",
|
||||
"serviceId": "25bf2293-7503-4a01-af00-d1b7d089ca37",
|
||||
"port": 3000,
|
||||
"counterServiceId": null,
|
||||
"counterPeerId": null,
|
||||
"quorumServiceId": null,
|
||||
"quorumPeerId": null,
|
||||
"quorumNumber": 2,
|
||||
"quorumTimeout": null,
|
||||
"requestTimeout": null
|
||||
}
|
||||
|
6954
aqua-examples/decentralized-blockchain-gateway/gateway/package-lock.json
generated
Normal file
6954
aqua-examples/decentralized-blockchain-gateway/gateway/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,30 @@
|
||||
{
|
||||
"name": "@fluencelabs/aqua-eth-gateway",
|
||||
"version": "0.0.15",
|
||||
"description": "",
|
||||
"main": "src/index.js",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"run:example": "node src/index.js \"config.json\"",
|
||||
"run": "node src/index.js",
|
||||
"req": "node web3run.js"
|
||||
},
|
||||
"bin": {
|
||||
"aqua-eth-gateway": "src/index.js"
|
||||
},
|
||||
"files": [
|
||||
"src/*",
|
||||
"aqua/*",
|
||||
"aqua-compiled/*"
|
||||
],
|
||||
"author": "Fluence Labs",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"json-rpc-2.0": "1.4.2",
|
||||
"web3": "1.8.2",
|
||||
"@fluencelabs/js-client.node": "0.6.5",
|
||||
"@fluencelabs/js-client.api": "0.11.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
import {configHelp} from "./config.js";
|
||||
|
||||
export function readArguments(args) {
|
||||
const configPath = args[0]
|
||||
|
||||
let errors = []
|
||||
|
||||
if (!configPath) {
|
||||
errors.push("Specify config with uri to ethereum RPC providers")
|
||||
}
|
||||
|
||||
return {
|
||||
configPath, errors,
|
||||
help: "Example: aqua-eth-gateway <config-path>\n" + configHelp
|
||||
}
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
import fs from 'fs';
|
||||
|
||||
export const configHelp = "Config structure: { port, relay, serviceId, providers, mode, counterServiceId?, counterPeerId?}\n" +
|
||||
"Where 'mode' can be: 'random' (default), 'round-robin' or 'quorum',\n" +
|
||||
"'counterServiceId' and 'counterPeerId' will use local service if undefined.\n"
|
||||
"'quorumServiceId' and 'quorumPeerId' will use local service if undefined.\n"
|
||||
|
||||
export function readConfig(path) {
|
||||
const rawdata = fs.readFileSync(path);
|
||||
const config = JSON.parse(rawdata);
|
||||
|
||||
let errors = []
|
||||
if (!config.port) {
|
||||
errors.push("Specify port ('port') in config")
|
||||
}
|
||||
if (!config.relay) {
|
||||
errors.push("Specify Fluence peer address ('relay') in config")
|
||||
}
|
||||
|
||||
if (!config.serviceId) {
|
||||
errors.push("Specify id to ethereum Aqua service ('serviceId') in config")
|
||||
}
|
||||
|
||||
return {
|
||||
config, errors,
|
||||
help: configHelp
|
||||
}
|
||||
}
|
@ -0,0 +1,163 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
"use strict";
|
||||
|
||||
import express from "express";
|
||||
import bodyParser from "body-parser";
|
||||
import {JSONRPCServer} from "json-rpc-2.0";
|
||||
import {Fluence} from '@fluencelabs/js-client.api';
|
||||
import "@fluencelabs/js-client.node"
|
||||
import {
|
||||
quorumEth,
|
||||
randomLoadBalancingEth,
|
||||
registerCounter,
|
||||
registerLogger,
|
||||
registerQuorumChecker,
|
||||
roundRobinEth
|
||||
} from "../aqua-compiled/rpc.js";
|
||||
import {readArguments} from "./arguments.js";
|
||||
import {readConfig} from "./config.js";
|
||||
import {methods} from "./methods.js";
|
||||
|
||||
const args = readArguments(process.argv.slice(2));
|
||||
|
||||
if (args.errors.length > 0) {
|
||||
console.log(args.help);
|
||||
args.errors.forEach((err) => console.log(err));
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const {config, errors, help} = readConfig(args.configPath);
|
||||
|
||||
if (errors.length > 0) {
|
||||
errors.forEach((err) => console.log(err));
|
||||
console.log(help);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
console.log("Running server...");
|
||||
|
||||
const route = "/";
|
||||
|
||||
const server = new JSONRPCServer();
|
||||
|
||||
// initialize fluence client
|
||||
await Fluence.connect(config.relay);
|
||||
const peerId = (await Fluence.getClient()).getPeerId()
|
||||
|
||||
// handler for logger
|
||||
registerLogger({
|
||||
log: s => {
|
||||
console.log("log: " + s);
|
||||
},
|
||||
logCall: s => {
|
||||
console.log("Call will be to : " + s);
|
||||
},
|
||||
})
|
||||
|
||||
let counter = 0;
|
||||
registerCounter("counter", {
|
||||
incrementAndReturn: () => {
|
||||
counter++;
|
||||
console.log("Counter: " + counter)
|
||||
return counter;
|
||||
}
|
||||
})
|
||||
|
||||
function findSameResults(results, minNum) {
|
||||
const resultCounts = results.filter((obj) => obj.success).map((obj) => obj.value).reduce(function(i, v) {
|
||||
if (i[v] === undefined) {
|
||||
i[v] = 1
|
||||
} else {
|
||||
i[v] = i[v] + 1;
|
||||
}
|
||||
return i;
|
||||
}, {});
|
||||
|
||||
const getMaxRepeated = Math.max(...Object.values(resultCounts));
|
||||
if (getMaxRepeated >= minNum) {
|
||||
console.log(resultCounts)
|
||||
const max = Object.entries(resultCounts).find((kv) => kv[1] === getMaxRepeated)
|
||||
return {
|
||||
value: max[0],
|
||||
results: [],
|
||||
error: ""
|
||||
}
|
||||
} else {
|
||||
return {
|
||||
error: "No consensus in results",
|
||||
results: results,
|
||||
value: ""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
registerQuorumChecker("quorum",
|
||||
{
|
||||
check: (ethResults, minQuorum) => {
|
||||
console.log(ethResults)
|
||||
return findSameResults(ethResults, minQuorum)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
const counterServiceId = config.counterServiceId || 'counter'
|
||||
const counterPeerId = config.counterPeerId || peerId
|
||||
const quorumServiceId = config.quorumServiceId || 'quorum'
|
||||
const quorumPeerId = config.quorumPeerId || peerId
|
||||
const quorumNumber = config.quorumNumber || 2
|
||||
const quorumTimeout = config.quorumTimeout || 10000
|
||||
const requestTimeoutConfig = config.requestTimeout ? {ttl: config.requestTimeout} : null
|
||||
|
||||
async function methodHandler(req, method) {
|
||||
console.log(`Receiving request '${method}'`);
|
||||
let result;
|
||||
if (!config.mode || config.mode === "random") {
|
||||
result = await randomLoadBalancingEth(config.providers, method, req.map((s) => JSON.stringify(s)), config.serviceId, requestTimeoutConfig);
|
||||
} else if (config.mode === "round-robin") {
|
||||
console.log("peerId: " + peerId)
|
||||
result = await roundRobinEth(config.providers, method, req.map((s) => JSON.stringify(s)), config.serviceId, counterServiceId, counterPeerId,
|
||||
config.serviceId, requestTimeoutConfig);
|
||||
} else if (config.mode === "quorum") {
|
||||
result = await quorumEth(config.providers, quorumNumber, quorumTimeout, method, req.map((s) => JSON.stringify(s)), config.serviceId, quorumServiceId, quorumPeerId,
|
||||
config.serviceId, requestTimeoutConfig);
|
||||
|
||||
if (result.error) {
|
||||
return {error: result.error, results: result.results}
|
||||
}
|
||||
|
||||
console.log(result)
|
||||
}
|
||||
|
||||
|
||||
return JSON.parse(result.value);
|
||||
|
||||
}
|
||||
|
||||
function addMethod(op) {
|
||||
server.addMethod(op, async (req) => methodHandler(req, op));
|
||||
}
|
||||
|
||||
// register all eth methods
|
||||
methods.forEach((m) => {
|
||||
addMethod(m);
|
||||
})
|
||||
|
||||
const app = express();
|
||||
app.use(bodyParser.json());
|
||||
|
||||
// register JSON-RPC handler
|
||||
app.post(route, (req, res) => {
|
||||
const jsonRPCRequest = req.body;
|
||||
server.receive(jsonRPCRequest).then((jsonRPCResponse) => {
|
||||
if (jsonRPCResponse) {
|
||||
res.json(jsonRPCResponse);
|
||||
} else {
|
||||
res.sendStatus(204);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
app.listen(config.port);
|
||||
|
||||
console.log("Server was started on port " + config.port);
|
@ -0,0 +1,58 @@
|
||||
export const methods = ['eth_accounts',
|
||||
'eth_blockNumber',
|
||||
'eth_call',
|
||||
'eth_chainId',
|
||||
'eth_estimateGas',
|
||||
'eth_getBalance',
|
||||
'eth_getBlockByHash',
|
||||
'eth_getBlockByNumber',
|
||||
'eth_getBlockTransactionCountByHash',
|
||||
'eth_getBlockTransactionCountByNumber',
|
||||
'eth_getCode',
|
||||
'eth_getLogs',
|
||||
'eth_getStorageAt',
|
||||
'eth_getTransactionByBlockHashAndIndex',
|
||||
'eth_getTransactionByBlockNumberAndIndex',
|
||||
'eth_getTransactionByHash',
|
||||
'eth_getTransactionCount',
|
||||
'eth_getTransactionReceipt',
|
||||
'eth_sendTransaction',
|
||||
'net_version',
|
||||
'web3_sha3',
|
||||
'eth_sendRawTransaction',
|
||||
'eth_subscribe',
|
||||
'eth_maxPriorityFeePerGas',
|
||||
'eth_getUncleCountByBlockHash',
|
||||
'eth_getUncleCountByBlockNumber',
|
||||
'net_listening',
|
||||
'net_peerCount',
|
||||
'eth_protocolVersion',
|
||||
'eth_syncing',
|
||||
'eth_coinbase',
|
||||
'eth_mining',
|
||||
'eth_hashrate',
|
||||
'eth_gasPrice',
|
||||
'eth_getStorageAt',
|
||||
'eth_sign',
|
||||
'eth_getCompilers',
|
||||
'eth_newBlockFilter',
|
||||
'eth_newPendingTransactionFilter',
|
||||
'eth_uninstallFilter',
|
||||
'eth_getFilterChanges',
|
||||
'eth_getWork',
|
||||
'eth_submitWork',
|
||||
'eth_submitHashrate',
|
||||
'db_putString',
|
||||
'db_getString',
|
||||
'db_putHex',
|
||||
'db_getHex',
|
||||
'shh_post',
|
||||
'shh_version',
|
||||
'shh_newIdentity',
|
||||
'shh_hasIdentity',
|
||||
'shh_newGroup',
|
||||
'shh_addToGroup',
|
||||
'shh_newFilter',
|
||||
'shh_uninstallFilter',
|
||||
'shh_getFilterChanges',
|
||||
'shh_getMessages']
|
@ -0,0 +1,20 @@
|
||||
import Web3 from 'web3';
|
||||
|
||||
const web3 = new Web3("http://localhost:3000");
|
||||
|
||||
async function main() {
|
||||
const bn = await web3.eth.getBlockNumber()
|
||||
await web3.eth.getBlockNumber()
|
||||
await web3.eth.getBlockNumber()
|
||||
await web3.eth.getBlockNumber()
|
||||
await web3.eth.getBlockNumber()
|
||||
await web3.eth.getBlockNumber()
|
||||
await web3.eth.getBlockNumber()
|
||||
console.log(bn)
|
||||
|
||||
const resp = await web3.eth.getTransaction("0x8bad403edde37642e4dab6c91eeca77b979fce1c979c14ca8755f5c3573eaeb4")
|
||||
console.log(resp)
|
||||
}
|
||||
|
||||
main();
|
||||
|
@ -8,33 +8,31 @@ rm -f artifacts/*.wasm
|
||||
cd wasm-modules
|
||||
|
||||
cd curl-adapter
|
||||
cargo update --aggressive
|
||||
marine build --release
|
||||
cp target/wasm32-wasi/release/curl_adapter.wasm ../../artifacts/
|
||||
|
||||
cd ../ipfs-adapter
|
||||
cargo update --aggressive
|
||||
marine build --release
|
||||
cp target/wasm32-wasi/release/ipfs_adapter.wasm ../../artifacts/
|
||||
|
||||
cd ../multi-provider-query
|
||||
cargo update --aggressive
|
||||
marine build --release
|
||||
cp target/wasm32-wasi/release/multi_provider_query.wasm ../../artifacts/
|
||||
|
||||
cd ../simple-quorum
|
||||
cargo update --aggressive
|
||||
marine build --release
|
||||
cp target/wasm32-wasi/release/simple_quorum.wasm ../../artifacts/
|
||||
|
||||
cd ../ipfs-cli
|
||||
cargo update --aggressive
|
||||
marine build --release
|
||||
cp target/wasm32-wasi/release/ipfs_cli.wasm ../../artifacts/
|
||||
|
||||
cd ../utilities
|
||||
cargo update --aggressive
|
||||
marine build --release
|
||||
cp target/wasm32-wasi/release/utilities.wasm ../../artifacts/
|
||||
|
||||
cd ../eth-rpc
|
||||
marine build --release
|
||||
cp target/wasm32-wasi/release/eth_rpc.wasm ../../artifacts/
|
||||
|
||||
cd ..
|
51
aqua-examples/decentralized-blockchain-gateway/scripts/package_services.sh
Executable file
51
aqua-examples/decentralized-blockchain-gateway/scripts/package_services.sh
Executable file
@ -0,0 +1,51 @@
|
||||
mkdir -p service-packages/modules/eth_rpc
|
||||
mkdir -p service-packages/modules/ipfs_adapter
|
||||
mkdir -p service-packages/modules/ipfs_cli
|
||||
mkdir -p service-packages/modules/multi_provider_query
|
||||
mkdir -p service-packages/modules/simple_quorum
|
||||
mkdir -p service-packages/modules/utilities
|
||||
mkdir -p service-packages/modules/curl_adapter
|
||||
sh ./scripts/build.sh
|
||||
|
||||
cd service-packages
|
||||
|
||||
# create eth-rpc service package
|
||||
cp ../configs/services/eth-rpc/service.yaml .
|
||||
cp ../artifacts/eth_rpc.wasm modules/eth_rpc/
|
||||
cp ../wasm-modules/eth-rpc/module.yaml modules/eth_rpc/
|
||||
cp ../artifacts/curl_adapter.wasm modules/curl_adapter/
|
||||
cp ../wasm-modules/curl-adapter/module.yaml modules/curl_adapter
|
||||
tar -czf eth_rpc.tar.gz modules/eth_rpc modules/curl_adapter service.yaml
|
||||
rm service.yaml
|
||||
|
||||
# create ipfs-package service package
|
||||
cp ../configs/services/ipfs-package/service.yaml .
|
||||
cp ../artifacts/ipfs_cli.wasm modules/ipfs_cli/
|
||||
cp ../wasm-modules/ipfs-cli/module.yaml modules/ipfs_cli/
|
||||
cp ../artifacts/ipfs_adapter.wasm modules/ipfs_adapter/
|
||||
cp ../wasm-modules/ipfs-adapter/module.yaml modules/ipfs_adapter
|
||||
tar -czf ipfs_package.tar.gz modules/ipfs_cli modules/ipfs_adapter service.yaml
|
||||
rm service.yaml
|
||||
|
||||
# create multi-provider-query service package
|
||||
cp ../configs/services/multi-provider-query/service.yaml .
|
||||
cp ../artifacts/multi_provider_query.wasm modules/multi_provider_query/
|
||||
cp ../wasm-modules/multi-provider-query/module.yaml modules/multi_provider_query/
|
||||
tar -czf multi_provider_query_package.tar.gz modules/ipfs_cli modules/curl_adapter service.yaml
|
||||
rm service.yaml
|
||||
|
||||
# create simple-quorum service package
|
||||
cp ../configs/services/simple-quorum/service.yaml .
|
||||
cp ../artifacts/simple_quorum.wasm modules/simple_quorum/
|
||||
cp ../wasm-modules/simple-quorum/module.yaml modules/simple_quorum/
|
||||
tar -czf simple_quorum_package.tar.gz service.yaml
|
||||
rm service.yaml
|
||||
|
||||
# create utility service package
|
||||
cp ../configs/services/utilities/service.yaml .
|
||||
cp ../artifacts/utilities.wasm modules/utilities/
|
||||
cp ../wasm-modules/utilities/module.yaml modules/utilities/
|
||||
tar -czf utilities_package.tar.gz service.yaml
|
||||
rm service.yaml
|
||||
|
||||
rm -rf modules
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,5 +1,5 @@
|
||||
[package]
|
||||
name = "curl_adapter"
|
||||
name = "curl-adapter"
|
||||
version = "0.1.0"
|
||||
authors = ["Fluence Labs"]
|
||||
edition = "2018"
|
||||
@ -7,7 +7,7 @@ publish = false
|
||||
|
||||
[[bin]]
|
||||
path = "src/main.rs"
|
||||
name = "curl_adapter"
|
||||
name = "curl-adapter"
|
||||
|
||||
[dependencies]
|
||||
marine-rs-sdk = "0.7.1"
|
||||
|
@ -0,0 +1,11 @@
|
||||
# yaml-language-server: $schema=../../.fluence/schemas/module.yaml.json
|
||||
|
||||
# Defines [Marine Module](https://fluence.dev/docs/build/concepts/#modules). For Fluence CLI, **module** - is a directory which contains this config and either a precompiled .wasm Marine module or a source code of the module written in Rust which can be compiled into a .wasm Marine module. You can use `fluence module new` command to generate a template for new module
|
||||
|
||||
# Documentation: https://github.com/fluencelabs/fluence-cli/tree/main/docs/configs/module.md
|
||||
|
||||
version: 0
|
||||
type: rust
|
||||
name: curl-adapter
|
||||
mountedBinaries:
|
||||
curl: /usr/bin/curl
|
@ -0,0 +1,24 @@
|
||||
[package]
|
||||
name = "eth-rpc"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[[bin]]
|
||||
name = "eth-rpc"
|
||||
path = "src/main.rs"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
web3 = { version = "0.18.0", features = [], default-features = false }
|
||||
#async-std = "1.12.0" # async-std does not support wasm32-wasi
|
||||
serde_json = "1.0.91"
|
||||
serde = "1.0.152"
|
||||
jsonrpc-core = "18.0.0"
|
||||
tokio = { version = "1.24.1", default-features = false, features = ["rt"] }
|
||||
eyre = "0.6.8"
|
||||
|
||||
marine-rs-sdk = "0.7.1"
|
||||
|
||||
[dev-dependencies]
|
||||
marine-rs-sdk-test = "0.8.2"
|
@ -0,0 +1,16 @@
|
||||
# Build eth-rpc.wasm
|
||||
```shell
|
||||
marine build --release
|
||||
```
|
||||
|
||||
# Build curl-adapter.wasm
|
||||
```shell
|
||||
cd ../curl-adapter
|
||||
marine build --release
|
||||
```
|
||||
|
||||
# Run tests
|
||||
```shell
|
||||
./test.sh
|
||||
```
|
||||
## It works!~
|
@ -0,0 +1,87 @@
|
||||
data RPCResponse:
|
||||
value: string
|
||||
success: bool
|
||||
error: ?string
|
||||
|
||||
data RPCResult:
|
||||
stdout: RPCResponse -- JSON-RPC result
|
||||
stderr: string -- curl error and other non json-rpc errors
|
||||
|
||||
data Web3Balance:
|
||||
balance: ?string -- hex string bignum
|
||||
success: bool
|
||||
error: ?string
|
||||
|
||||
data Web3GasUsed:
|
||||
gas_used: ?string -- hex string
|
||||
success: bool
|
||||
error: ?string
|
||||
|
||||
data Web3EthCall:
|
||||
result: ?string -- hex string
|
||||
success: bool
|
||||
error: ?string
|
||||
|
||||
service ParseToWeb3Balances("json"):
|
||||
parse(s:string) -> Web3Balance
|
||||
|
||||
-- e.g., https://docs.infura.io/infura/networks/ethereum/json-rpc-methods/eth_getbalance
|
||||
service Web3Services("service-id"):
|
||||
call_eth_get_balance() -> RPCResult
|
||||
call_eth_estimate_gas() -> RPCResult
|
||||
call_eth_call() -> RPCResult
|
||||
|
||||
-- rpc_params: account id, blockheight: ususally "latest"
|
||||
-- or we create a data struct and serialize it in aqua to []string
|
||||
func eth_ getBalance(peerid: string, service_id: string, uri: string, rpc_params: Vec<String>, nonce: u32) -> Web3Balance:
|
||||
result: *Web3Balance
|
||||
on peerid:
|
||||
Web3Services service_id
|
||||
res <- Web3Services.call_eth_get_balance(uri, rpc_params, nonce)
|
||||
if res.stdout.success==true:
|
||||
result.balance <- res.stdout.value
|
||||
result.success <<- true
|
||||
else:
|
||||
result.success <<- false
|
||||
result.error <<- res.stdout.value
|
||||
<- result[0]
|
||||
|
||||
-- here the data struct approach seems to make even more sense as we need the transaction call object:
|
||||
-- data TObject:
|
||||
-- from: ?[]u8 -- optional 20 bytes, address tx is sent from
|
||||
-- to: []u8 -- 20 bytes to address
|
||||
-- gas: ?string -- gas provided for execution of method haxadecimal
|
||||
-- gasPrice: ?string -- gasPrice used, hexadecimal
|
||||
-- maxFeesPerGase: ?string -- maximum fee in wei
|
||||
-- value: ?string -- value sent with tx, hexadecimal
|
||||
-- data: ?string -- hash of method signature and encoded params
|
||||
--func eth_estimateGas(peerid: string, service_id: string, uri: string, t_obj: TObject, nonce: u32) -> Web3GasUsed:
|
||||
-- the "easy" way: Vec<String>
|
||||
func eth_estimateGas(peerid: string, service_id: string, uri: string, rpc_params: []string, nonce: u32) -> Web3GasUsed:
|
||||
result: *Web3Gas
|
||||
on peerid:
|
||||
Web3Services service_id
|
||||
res <- Web3Services.call_eth_estimate_gas(uri, rpc_params, nonce)
|
||||
if res.stdout.success==true:
|
||||
result.gas_used <- res.stdout.value
|
||||
result.success <<- true
|
||||
else:
|
||||
result.success <<- false
|
||||
result.error <<- res.stdout.value
|
||||
<- result
|
||||
|
||||
-- also a big intake object, e.g. https://docs.infura.io/infura/networks/ethereum/json-rpc-methods/eth_call
|
||||
-- easy way -- client serializes to []string
|
||||
func eth_call(peerid: string, service_id: string, uri: string, rpc_params: []string, nonce: u32) -> Web3EthCall:
|
||||
result: *Web3EthCall
|
||||
on peerid:
|
||||
Web3Services service_id
|
||||
res <- Web3Services.call_eth_call(uri, rpc_params, nonce)
|
||||
if res.stdout.success==true:
|
||||
result.result <- res.stdout.value
|
||||
result.success <<- true
|
||||
else:
|
||||
result.success <<- false
|
||||
result.error <<- res.stdout.error ---not sure if this is how Web3 does it if there is a Revert error, e.g. https://docs.infura.io/infura/networks/ethereum/json-rpc-methods/eth_call
|
||||
<- result
|
||||
|
@ -0,0 +1,66 @@
|
||||
|
||||
-- https://www.jsonrpc.org/specification
|
||||
data RPCError:
|
||||
code: i32
|
||||
message: string
|
||||
data: ?string
|
||||
|
||||
data RPCResponse:
|
||||
jsonrpc: string
|
||||
result: string
|
||||
error: ?RPCError
|
||||
id: u32
|
||||
|
||||
data RPCResponse2:
|
||||
value: string
|
||||
success: bool
|
||||
error: ?string
|
||||
|
||||
data RPCResult:
|
||||
stdout: RPCResponse -- JSON-RPC result
|
||||
stderr: string -- curl error and other non json-rpc errors
|
||||
|
||||
|
||||
data RPCResult2:
|
||||
stdout: RPCResponse2 -- JSON-RPC result
|
||||
stderr: string -- curl error and other non json-rpc errors
|
||||
|
||||
|
||||
data Web3Accounts:
|
||||
accounts: []string
|
||||
|
||||
service ParseToAccounts("json"):
|
||||
parse(s:string) -> Web3Accounts
|
||||
|
||||
service Web3Services("service-id"):
|
||||
call_get_accounts() -> [][]u8
|
||||
call_get_accounts_json() -> RPCResult
|
||||
call_get_accounts_json_2() -> RPCResult2
|
||||
|
||||
|
||||
-- the bytestring return which allows you to do nothing until you convert
|
||||
-- the bytes using another service to be deployed and a pita to sort through
|
||||
-- error types
|
||||
func get_accounts(peerid: string, service_id: string) -> [][]u8:
|
||||
on peerid:
|
||||
Web3Services service_id
|
||||
res <- Web3Services.call_get_accounts()
|
||||
<- res
|
||||
|
||||
func get_accounts_jstring(peerid: string, service_id: string) -> Web3Accounts:
|
||||
on peerid:
|
||||
Web3Services service_id
|
||||
res <- Web3Services.call_get_accounts_json()
|
||||
-- if not error ...
|
||||
-- if not rpc error
|
||||
accounts <- ParseToAccounts.parse(res.stdout.result)
|
||||
<- accounts
|
||||
|
||||
func get_accounts_jstring_2(peerid: string, service_id: string) -> Web3Accounts:
|
||||
on peerid:
|
||||
Web3Services service_id
|
||||
res <- Web3Services.call_get_accounts_json_2()
|
||||
-- if not error ....
|
||||
if res.stdout.success == true:
|
||||
accounts <- ParseToAccounts.parse(res.stdout.value)
|
||||
<- accounts
|
@ -0,0 +1,9 @@
|
||||
# yaml-language-server: $schema=../../.fluence/schemas/module.yaml.json
|
||||
|
||||
# Defines [Marine Module](https://fluence.dev/docs/build/concepts/#modules). For Fluence CLI, **module** - is a directory which contains this config and either a precompiled .wasm Marine module or a source code of the module written in Rust which can be compiled into a .wasm Marine module. You can use `fluence module new` command to generate a template for new module
|
||||
|
||||
# Documentation: https://github.com/fluencelabs/fluence-cli/tree/main/docs/configs/module.md
|
||||
|
||||
version: 0
|
||||
type: rust
|
||||
name: eth-rpc
|
@ -0,0 +1,4 @@
|
||||
[toolchain]
|
||||
channel = "nightly-2022-12-06"
|
||||
targets = [ "x86_64-unknown-linux-gnu" ]
|
||||
components = [ "rustfmt" ]
|
@ -0,0 +1,131 @@
|
||||
use std::sync::atomic::{AtomicUsize, Ordering};
|
||||
use std::sync::Arc;
|
||||
|
||||
use jsonrpc_core::types::request::Call;
|
||||
use jsonrpc_core::Output;
|
||||
use serde_json::json;
|
||||
use serde_json::Value;
|
||||
use web3::futures::future::BoxFuture;
|
||||
use web3::{RequestId, Transport};
|
||||
|
||||
use crate::curl_request;
|
||||
|
||||
pub type FutResult = BoxFuture<'static, web3::error::Result<Value>>;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct CurlTransport {
|
||||
pub uri: String,
|
||||
id: Arc<AtomicUsize>,
|
||||
}
|
||||
impl CurlTransport {
|
||||
pub fn new(uri: String) -> Self {
|
||||
Self {
|
||||
uri,
|
||||
id: Arc::new(AtomicUsize::new(0)),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn next_id(&self) -> RequestId {
|
||||
self.id.fetch_add(1, Ordering::AcqRel)
|
||||
}
|
||||
}
|
||||
|
||||
impl Transport for CurlTransport {
|
||||
type Out = FutResult;
|
||||
|
||||
fn prepare(&self, method: &str, params: Vec<Value>) -> (RequestId, Call) {
|
||||
let id = self.next_id();
|
||||
let request = web3::helpers::build_request(id, method, params.clone());
|
||||
(id, request)
|
||||
}
|
||||
|
||||
fn send(&self, _: RequestId, call: Call) -> Self::Out {
|
||||
if let Call::MethodCall(call) = call {
|
||||
/*
|
||||
curl --request POST \
|
||||
--url $uri \
|
||||
--header 'accept: application/json' \
|
||||
--header 'content-type: application/json' \
|
||||
--data '
|
||||
{
|
||||
"id": 1,
|
||||
"jsonrpc": "2.0",
|
||||
"method": "eth_accounts"
|
||||
}
|
||||
'
|
||||
*/
|
||||
let uri = self.uri.clone();
|
||||
Box::pin(async move {
|
||||
let json = json!(call).to_string();
|
||||
let args = vec![
|
||||
"--request",
|
||||
"POST",
|
||||
"--url",
|
||||
&uri,
|
||||
"--header",
|
||||
"accept: application/json",
|
||||
"--header",
|
||||
"content-type: application/json",
|
||||
"--data",
|
||||
json.as_str(),
|
||||
];
|
||||
let args = args.into_iter().map(|s| s.to_string()).collect();
|
||||
let response = curl_request(args);
|
||||
|
||||
/*
|
||||
println!(
|
||||
"response is: \nstdout: {:?}\nstderr: {:?}",
|
||||
String::from_utf8(response.stdout.clone()),
|
||||
String::from_utf8(response.stderr.clone())
|
||||
);
|
||||
|
||||
println!("slice: {:?}", serde_json::from_value::<Output>(serde_json::from_slice(response.stdout.as_slice())?));
|
||||
*/
|
||||
|
||||
// FIX: if there's a bad uri, the panic kicks in here.
|
||||
|
||||
if response.ret_code != 0 {
|
||||
let stdout = String::from_utf8_lossy(&response.stdout);
|
||||
let error = if response.error.is_empty() {
|
||||
stdout.to_string()
|
||||
} else {
|
||||
format!("error: {}\nstdout: {stdout}", response.error)
|
||||
};
|
||||
return Err(web3::error::Error::Transport(
|
||||
web3::error::TransportError::Message(format!("error: {}", error)),
|
||||
));
|
||||
}
|
||||
|
||||
let response = serde_json::from_slice(response.stdout.as_slice())?;
|
||||
let response: Output = serde_json::from_value(response)?;
|
||||
let result = match response {
|
||||
Output::Success(jsonrpc_core::types::Success { result, .. }) => result,
|
||||
|
||||
// no sure if that's enough vs the complete jsonrpc error msg
|
||||
Output::Failure(jsonrpc_core::types::Failure { error, .. }) => {
|
||||
serde_json::to_value(error.message).unwrap()
|
||||
} /*
|
||||
Output::Failure(failure) => panic!(
|
||||
"JSON RPC response was a failure {}",
|
||||
json!(failure).to_string()
|
||||
),
|
||||
*/
|
||||
/*
|
||||
Output::Failure(failure) => {
|
||||
let err = jsonrpc_core::types::error::Error.parse_error()
|
||||
}
|
||||
|
||||
format!("JSON RPC response was a failure {}",
|
||||
json!(failure).to_string()),
|
||||
*/
|
||||
};
|
||||
|
||||
// println!("parsed result is {}", result.to_string());
|
||||
Ok(result)
|
||||
})
|
||||
} else {
|
||||
todo!()
|
||||
}
|
||||
// Box::pin(async { Ok(json!(["0x407d73d8a49eeb85d32cf465507dd71d507100c1"])) })
|
||||
}
|
||||
}
|
@ -0,0 +1,135 @@
|
||||
use eyre::eyre;
|
||||
use marine_rs_sdk::marine;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_json::Value;
|
||||
use tokio::runtime::Builder;
|
||||
use web3::Transport;
|
||||
|
||||
use crate::curl_transport::CurlTransport;
|
||||
use crate::values::JsonString;
|
||||
|
||||
#[marine]
|
||||
pub fn eth_call(uri: String, method: &str, json_args: Vec<String>) -> JsonString {
|
||||
let result: eyre::Result<Value> = try {
|
||||
let rt = Builder::new_current_thread().build()?;
|
||||
|
||||
let args: Result<Vec<Value>, _> =
|
||||
json_args.iter().map(|a| serde_json::from_str(a)).collect();
|
||||
let args = args.map_err(|err| {
|
||||
eyre!("Invalid arguments. Expected JSON serialized to string, got {json_args:?}: {err}")
|
||||
})?;
|
||||
let transport = CurlTransport::new(uri);
|
||||
let result = rt.block_on(transport.execute(method, args))?;
|
||||
|
||||
result
|
||||
};
|
||||
|
||||
result.into()
|
||||
}
|
||||
|
||||
#[marine]
|
||||
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||
pub struct RPCResult {
|
||||
provider_name: String,
|
||||
stdout: String,
|
||||
stderr: String,
|
||||
}
|
||||
|
||||
pub fn eth_call_2(uri: String, method: &str, json_args: Vec<String>) -> JsonString {
|
||||
let result: eyre::Result<Value> = try {
|
||||
let rt = Builder::new_current_thread().build()?;
|
||||
|
||||
let args: Result<Vec<Value>, _> = json_args
|
||||
.into_iter()
|
||||
.map(|a| serde_json::from_str(&a))
|
||||
.collect();
|
||||
let transport = CurlTransport::new(uri);
|
||||
let result = rt.block_on(transport.execute(method, args?))?;
|
||||
|
||||
result
|
||||
};
|
||||
|
||||
result.into()
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use marine_rs_sdk_test::marine_test;
|
||||
|
||||
#[marine_test(
|
||||
config_path = "../tests_artifacts/Config.toml",
|
||||
modules_dir = "../tests_artifacts"
|
||||
)]
|
||||
fn get_accounts_bad_uri(rpc: marine_test_env::eth_rpc::ModuleInterface) {
|
||||
let uri: String = "http://bad_uri.to".into();
|
||||
let method: String = "eth_accounts".into();
|
||||
let json_args: Vec<String> = vec![];
|
||||
|
||||
let accounts = rpc.eth_call(uri, method, json_args);
|
||||
println!("bad uri call: {:?}", accounts);
|
||||
// println!("accounts: {:?}", accounts);
|
||||
// assert_eq!(accounts.len(), 0);
|
||||
}
|
||||
|
||||
#[marine_test(
|
||||
config_path = "../tests_artifacts/Config.toml",
|
||||
modules_dir = "../tests_artifacts"
|
||||
)]
|
||||
fn get_accounts_bad_method(rpc: marine_test_env::eth_rpc::ModuleInterface) {
|
||||
let uri: String = std::fs::read_to_string("./infura_uri.txt").unwrap();
|
||||
let method: String = "eth_getAccounts".into();
|
||||
let json_args: Vec<String> = vec![];
|
||||
|
||||
let accounts = rpc.eth_call(uri, method, json_args);
|
||||
println!("bad method: {:?}", accounts);
|
||||
}
|
||||
|
||||
#[marine_test(
|
||||
config_path = "../tests_artifacts/Config.toml",
|
||||
modules_dir = "../tests_artifacts"
|
||||
)]
|
||||
fn get_accounts_good_uri(rpc: marine_test_env::eth_rpc::ModuleInterface) {
|
||||
let uri: String = std::fs::read_to_string("./infura_uri.txt").unwrap();
|
||||
let method: String = "eth_accounts".into();
|
||||
let json_args: Vec<String> = vec![];
|
||||
|
||||
let accounts = rpc.eth_call(uri, method, json_args);
|
||||
println!("all good: {:?}", accounts);
|
||||
|
||||
// println!("accounts: {:?}", accounts);
|
||||
// assert_eq!(accounts.len(), 0);
|
||||
}
|
||||
|
||||
#[marine_test(
|
||||
config_path = "../tests_artifacts/Config.toml",
|
||||
modules_dir = "../tests_artifacts"
|
||||
)]
|
||||
fn get_transaction(rpc: marine_test_env::eth_rpc::ModuleInterface) {
|
||||
use serde_json::json;
|
||||
|
||||
let uri: String = todo!("put Goerli ETH RPC URL here");
|
||||
let method: String = "eth_getTransactionByHash".into();
|
||||
let json_args: Vec<String> =
|
||||
vec![
|
||||
json!("0x3ffaa16b93ef90b9385b6f6a140d8297c43b6551bf8e8b804d9eecff7bc1509f")
|
||||
.to_string(),
|
||||
];
|
||||
|
||||
let result = rpc.eth_call(uri.clone(), method.clone(), json_args);
|
||||
assert!(result.success, "{}", result.error);
|
||||
assert_eq!(result.value, "null", "{}", result.value);
|
||||
|
||||
let json_args: Vec<String> =
|
||||
vec!["0x3ffaa16b93ef90b9385b6f6a140d8297c43b6551bf8e8b804d9eecff7bc1509f".into()];
|
||||
|
||||
let result = rpc.eth_call(uri, method, json_args);
|
||||
assert!(!result.success);
|
||||
assert!(
|
||||
result
|
||||
.error
|
||||
.starts_with("Invalid arguments. Expected JSON serialized to string"),
|
||||
"{}",
|
||||
result.error
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,88 @@
|
||||
#![feature(try_blocks)]
|
||||
|
||||
use marine_rs_sdk::module_manifest;
|
||||
use marine_rs_sdk::{marine, MountedBinaryResult};
|
||||
use tokio::runtime::Builder;
|
||||
use web3::api::Eth;
|
||||
use web3::helpers::CallFuture;
|
||||
use web3::types::Address;
|
||||
use web3::Web3;
|
||||
|
||||
use crate::curl_transport::{CurlTransport, FutResult};
|
||||
|
||||
pub mod curl_transport;
|
||||
pub mod eth_call;
|
||||
pub mod typed;
|
||||
pub mod values;
|
||||
|
||||
module_manifest!();
|
||||
|
||||
pub fn main() {}
|
||||
|
||||
// #[tokio::main(flavor = "current_thread")]
|
||||
// flavor idea comes from https://github.com/rjzak/tokio-echo-test/blob/main/src/main.rs#L42
|
||||
// but seems to require additional tokio futures
|
||||
pub fn get_accounts(uri: String) -> web3::error::Result<Vec<Vec<u8>>> {
|
||||
let rt = Builder::new_current_thread().build()?;
|
||||
|
||||
let web3 = Web3::new(CurlTransport::new(uri));
|
||||
|
||||
let eth = web3.eth();
|
||||
println!("Calling accounts.");
|
||||
let accounts: CallFuture<Vec<Address>, FutResult> = eth.accounts();
|
||||
let accounts: web3::Result<Vec<Address>> = rt.block_on(accounts);
|
||||
println!("Accounts: {:?}", accounts);
|
||||
|
||||
Ok(accounts?
|
||||
.into_iter()
|
||||
.map(|a: Address| a.as_bytes().to_vec())
|
||||
.collect())
|
||||
}
|
||||
|
||||
pub fn web3_call<
|
||||
Out: serde::de::DeserializeOwned,
|
||||
F: FnOnce(Eth<CurlTransport>) -> CallFuture<Out, FutResult>,
|
||||
>(
|
||||
uri: String,
|
||||
call: F,
|
||||
) -> web3::error::Result<Out> {
|
||||
let rt = Builder::new_current_thread()
|
||||
.build()
|
||||
.expect("error starting tokio runtime");
|
||||
|
||||
let web3 = Web3::new(CurlTransport::new(uri));
|
||||
|
||||
let result: CallFuture<Out, FutResult> = call(web3.eth());
|
||||
let result: web3::error::Result<Out> = rt.block_on(result);
|
||||
|
||||
result
|
||||
}
|
||||
|
||||
#[marine]
|
||||
pub fn call_get_accounts(uri: String) -> Vec<Vec<u8>> {
|
||||
get_accounts(uri).expect("error calling main")
|
||||
}
|
||||
|
||||
#[marine]
|
||||
#[link(wasm_import_module = "curl_adapter")]
|
||||
extern "C" {
|
||||
pub fn curl_request(cmd: Vec<String>) -> MountedBinaryResult;
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use marine_rs_sdk_test::marine_test;
|
||||
|
||||
#[marine_test(
|
||||
config_path = "../tests_artifacts/Config.toml",
|
||||
modules_dir = "../tests_artifacts"
|
||||
)]
|
||||
fn get_accounts_generic(rpc: marine_test_env::eth_rpc::ModuleInterface) {
|
||||
let uri: String = std::fs::read_to_string("./infura_uri.txt").unwrap();
|
||||
let method: String = "eth_accounts".into();
|
||||
let json_args: Vec<String> = vec![];
|
||||
|
||||
let accounts = rpc.eth_call(uri, method, json_args);
|
||||
println!("accounts: {:?}", accounts);
|
||||
}
|
||||
}
|
@ -0,0 +1,268 @@
|
||||
#![allow(unused)]
|
||||
|
||||
use marine_rs_sdk::marine;
|
||||
use web3::types::{BlockId, BlockNumber, Bytes, CallRequest};
|
||||
|
||||
use crate::values::{BytesValue, JsonString, U64Value};
|
||||
use crate::web3_call;
|
||||
|
||||
/// Get list of available accounts.
|
||||
#[marine]
|
||||
pub fn accounts(uri: String) -> Vec<JsonString> {
|
||||
web3_call(uri, |w| w.accounts())
|
||||
.into_iter()
|
||||
.map(|a| {
|
||||
let json = serde_json::to_value(&a).map_err(eyre::Report::from);
|
||||
JsonString::from(json)
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// Get current block number
|
||||
#[marine]
|
||||
pub fn block_number(uri: String) -> U64Value {
|
||||
web3_call(uri, |w| w.block_number()).into()
|
||||
}
|
||||
|
||||
/// Call a constant method of contract without changing the state of the blockchain.
|
||||
#[marine]
|
||||
pub fn call(uri: String, req: String, block: u64) -> BytesValue {
|
||||
let result: eyre::Result<Bytes> = try {
|
||||
let req: CallRequest = serde_json::from_str(&req)?;
|
||||
web3_call(uri, move |w| {
|
||||
w.call(
|
||||
req,
|
||||
Some(BlockId::Number(BlockNumber::Number(block.into()))),
|
||||
)
|
||||
})?
|
||||
};
|
||||
|
||||
result.into()
|
||||
}
|
||||
|
||||
/// Get coinbase address
|
||||
// #[marine]
|
||||
pub fn coinbase(uri: String) -> String {
|
||||
todo!()
|
||||
}
|
||||
|
||||
/// Compile LLL
|
||||
// #[marine]
|
||||
pub fn compile_lll(uri: String, code: String) -> Vec<u8> {
|
||||
todo!()
|
||||
}
|
||||
|
||||
/// Compile Solidity
|
||||
// #[marine]
|
||||
pub fn compile_solidity(uri: String, code: String) -> Vec<u8> {
|
||||
todo!()
|
||||
}
|
||||
|
||||
/// Compile Serpent
|
||||
// #[marine]
|
||||
pub fn compile_serpent(uri: String, code: String) -> Vec<u8> {
|
||||
todo!()
|
||||
}
|
||||
|
||||
/// Call a contract without changing the state of the blockchain to estimate gas usage.
|
||||
// #[marine]
|
||||
pub fn estimate_gas(uri: String, req: String, block: String) -> String {
|
||||
todo!()
|
||||
}
|
||||
|
||||
/// Get current recommended gas price
|
||||
// #[marine]
|
||||
pub fn gas_price(uri: String) -> String {
|
||||
todo!()
|
||||
}
|
||||
|
||||
/// Returns a collection of historical gas information. This can be used for evaluating the max_fee_per_gas
|
||||
/// and max_priority_fee_per_gas to send the future transactions.
|
||||
// #[marine]
|
||||
pub fn fee_history(
|
||||
uri: String,
|
||||
block_count: String,
|
||||
newest_block: String,
|
||||
reward_percentiles: Vec<f64>,
|
||||
) -> String {
|
||||
todo!()
|
||||
}
|
||||
|
||||
/// Get balance of given address
|
||||
// #[marine]
|
||||
pub fn balance(uri: String, address: String, block: String) -> String {
|
||||
todo!()
|
||||
}
|
||||
|
||||
/// Get all logs matching a given filter object
|
||||
// #[marine]
|
||||
pub fn logs(uri: String, filter: String) -> Vec<String> {
|
||||
todo!()
|
||||
}
|
||||
|
||||
/// Get block details with transaction hashes.
|
||||
// #[marine]
|
||||
pub fn block(uri: String, block: String) -> String {
|
||||
todo!()
|
||||
}
|
||||
|
||||
/// Get block details with full transaction objects.
|
||||
// #[marine]
|
||||
pub fn block_with_txs(uri: String, block: String) -> String {
|
||||
todo!()
|
||||
}
|
||||
|
||||
/// Get number of transactions in block
|
||||
// #[marine]
|
||||
pub fn block_transaction_count(uri: String, block: String) -> String {
|
||||
todo!()
|
||||
}
|
||||
|
||||
/// Get code under given address
|
||||
// #[marine]
|
||||
pub fn code(uri: String, address: String, block: String) -> Vec<u8> {
|
||||
todo!()
|
||||
}
|
||||
|
||||
/// Get supported compilers
|
||||
// #[marine]
|
||||
pub fn compilers(uri: String) -> Vec<String> {
|
||||
todo!()
|
||||
}
|
||||
|
||||
/// Get chain id
|
||||
// #[marine]
|
||||
pub fn chain_id(uri: String) -> String {
|
||||
todo!()
|
||||
}
|
||||
|
||||
/// Get available user accounts. This method is only available in the browser. With MetaMask,
|
||||
/// this will cause the popup that prompts the user to allow or deny access to their accounts
|
||||
/// to your app.
|
||||
// #[marine]
|
||||
pub fn request_accounts(uri: String) -> Vec<String> {
|
||||
todo!()
|
||||
}
|
||||
|
||||
/// Get storage entry
|
||||
// #[marine]
|
||||
pub fn storage(uri: String, address: String, idx: String, block: String) -> String {
|
||||
todo!()
|
||||
}
|
||||
|
||||
/// Get nonce
|
||||
// #[marine]
|
||||
pub fn transaction_count(uri: String, address: String, block: String) -> String {
|
||||
todo!()
|
||||
}
|
||||
|
||||
/// Get transaction
|
||||
// #[marine]
|
||||
pub fn transaction(uri: String, id: String) -> String {
|
||||
todo!()
|
||||
}
|
||||
|
||||
/// Get transaction receipt
|
||||
// #[marine]
|
||||
pub fn transaction_receipt(uri: String, hash: String) -> String {
|
||||
todo!()
|
||||
}
|
||||
|
||||
/// Get uncle header by block ID and uncle index.
|
||||
///
|
||||
/// This method is meant for TurboGeth compatiblity,
|
||||
/// which is missing transaction hashes in the response.
|
||||
// #[marine]
|
||||
pub fn uncle_header(uri: String, block: String, index: String) -> String {
|
||||
todo!()
|
||||
}
|
||||
|
||||
/// Get uncle by block ID and uncle index -- transactions only has hashes.
|
||||
// #[marine]
|
||||
pub fn uncle(uri: String, block: String, index: String) -> String {
|
||||
todo!()
|
||||
}
|
||||
|
||||
/// Get uncle count in block
|
||||
// #[marine]
|
||||
pub fn uncle_count(uri: String, block: String) -> String {
|
||||
todo!()
|
||||
}
|
||||
|
||||
/// Get work package
|
||||
// #[marine]
|
||||
pub fn work(uri: String) -> String {
|
||||
todo!()
|
||||
}
|
||||
|
||||
/// Get hash rate
|
||||
// #[marine]
|
||||
pub fn hashrate(uri: String) -> String {
|
||||
todo!()
|
||||
}
|
||||
|
||||
/// Get mining status
|
||||
// #[marine]
|
||||
pub fn mining(uri: String) -> bool {
|
||||
todo!()
|
||||
}
|
||||
|
||||
/// Start new block filter
|
||||
// #[marine]
|
||||
pub fn new_block_filter(uri: String) -> String {
|
||||
todo!()
|
||||
}
|
||||
|
||||
/// Start new pending transaction filter
|
||||
// #[marine]
|
||||
pub fn new_pending_transaction_filter(uri: String) -> String {
|
||||
todo!()
|
||||
}
|
||||
|
||||
/// Start new pending transaction filter
|
||||
// #[marine]
|
||||
pub fn protocol_version(uri: String) -> String {
|
||||
todo!()
|
||||
}
|
||||
|
||||
/// Sends a rlp-encoded signed transaction
|
||||
// #[marine]
|
||||
pub fn send_raw_transaction(uri: String, rlp: String) -> String {
|
||||
todo!()
|
||||
}
|
||||
|
||||
/// Sends a transaction transaction
|
||||
// #[marine]
|
||||
pub fn send_transaction(uri: String, tx: String) -> String {
|
||||
todo!()
|
||||
}
|
||||
|
||||
/// Signs a hash of given data
|
||||
// #[marine]
|
||||
pub fn sign(uri: String, address: String, data: String) -> String {
|
||||
todo!()
|
||||
}
|
||||
|
||||
/// Submit hashrate of external miner
|
||||
// #[marine]
|
||||
pub fn submit_hashrate(uri: String, rate: String, id: String) -> bool {
|
||||
todo!()
|
||||
}
|
||||
|
||||
/// Submit work of external miner
|
||||
// #[marine]
|
||||
pub fn submit_work(uri: String, nonce: String, pow_hash: String, mix_hash: String) -> bool {
|
||||
todo!()
|
||||
}
|
||||
|
||||
/// Get syncing status
|
||||
// #[marine]
|
||||
pub fn syncing(uri: String) -> String {
|
||||
todo!()
|
||||
}
|
||||
|
||||
/// Returns the account- and storage-values of the specified account including the Merkle-proof.
|
||||
// #[marine]
|
||||
pub fn proof(uri: String, address: String, keys: String, block: String) -> String {
|
||||
todo!()
|
||||
}
|
@ -0,0 +1,76 @@
|
||||
use marine_rs_sdk::marine;
|
||||
use serde_json::Value;
|
||||
use web3::types::Bytes;
|
||||
use web3::types::U64;
|
||||
|
||||
#[marine]
|
||||
pub struct JsonString {
|
||||
pub value: String,
|
||||
pub success: bool,
|
||||
pub error: String,
|
||||
}
|
||||
|
||||
impl From<eyre::Result<Value>> for JsonString {
|
||||
fn from(value: eyre::Result<Value>) -> Self {
|
||||
match value {
|
||||
Ok(value) => JsonString {
|
||||
value: value.to_string(),
|
||||
success: true,
|
||||
error: String::new(),
|
||||
},
|
||||
Err(err) => JsonString {
|
||||
value: String::new(),
|
||||
success: false,
|
||||
error: format!("{}\n{:?}", err, err),
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[marine]
|
||||
pub struct U64Value {
|
||||
pub value: u64,
|
||||
pub success: bool,
|
||||
pub error: String,
|
||||
}
|
||||
|
||||
impl From<web3::error::Result<U64>> for U64Value {
|
||||
fn from(value: web3::error::Result<U64>) -> Self {
|
||||
match value {
|
||||
Ok(value) => U64Value {
|
||||
value: value.as_u64(),
|
||||
success: true,
|
||||
error: String::new(),
|
||||
},
|
||||
Err(err) => U64Value {
|
||||
value: u64::default(),
|
||||
success: false,
|
||||
error: format!("{}\n{:?}", err, err),
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[marine]
|
||||
pub struct BytesValue {
|
||||
pub value: Vec<u8>,
|
||||
pub success: bool,
|
||||
pub error: String,
|
||||
}
|
||||
|
||||
impl From<eyre::Result<Bytes>> for BytesValue {
|
||||
fn from(value: eyre::Result<Bytes>) -> Self {
|
||||
match value {
|
||||
Ok(value) => BytesValue {
|
||||
value: value.0,
|
||||
success: true,
|
||||
error: String::new(),
|
||||
},
|
||||
Err(err) => BytesValue {
|
||||
value: vec![],
|
||||
success: false,
|
||||
error: format!("{}\n{:?}", err, err),
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
25
aqua-examples/decentralized-blockchain-gateway/wasm-modules/eth-rpc/test.sh
Executable file
25
aqua-examples/decentralized-blockchain-gateway/wasm-modules/eth-rpc/test.sh
Executable file
@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -o nounset
|
||||
set -o errexit
|
||||
set -o pipefail
|
||||
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
mkdir -p tests_artifacts
|
||||
|
||||
# build eth-rpc.wasm
|
||||
marine build --release
|
||||
cp ./target/wasm32-wasi/release/eth-rpc.wasm tests_artifacts/
|
||||
|
||||
# build curl-adapter.wasm
|
||||
(cd ../curl-adapter; marine build --release)
|
||||
cp ../curl-adapter/target/wasm32-wasi/release/curl_adapter.wasm tests_artifacts/
|
||||
|
||||
#if [[ ! -f "tests_artifacts/sqlite3.wasm" ]]; then
|
||||
# # download SQLite 3
|
||||
# curl -L https://github.com/fluencelabs/sqlite/releases/download/v0.15.0_w/sqlite3.wasm -o tests_artifacts/sqlite3.wasm
|
||||
#fi
|
||||
|
||||
# run tests
|
||||
cargo nextest run --release --no-fail-fast --nocapture
|
@ -0,0 +1,22 @@
|
||||
modules_dir = "."
|
||||
|
||||
#[[module]]
|
||||
#name = "sqlite3"
|
||||
#mem_pages_count = 100
|
||||
#logger_enabled = false
|
||||
|
||||
#[module.wasi]
|
||||
#preopened_files = ["/tmp"]
|
||||
#mapped_dirs = { "tmp" = "." }
|
||||
|
||||
[[module]]
|
||||
name = "curl_adapter"
|
||||
max_heap_size = "2 MiB"
|
||||
logger_enabled = true
|
||||
|
||||
[module.mounted_binaries]
|
||||
curl = "/usr/bin/curl"
|
||||
|
||||
[[module]]
|
||||
name = "eth_rpc"
|
||||
logger_enabled = true
|
Binary file not shown.
@ -0,0 +1,29 @@
|
||||
# Fluence decentralized RPC Workshop
|
||||
|
||||
ETHDenver 2/27/2023
|
||||
|
||||
|
||||
##Outline
|
||||
|
||||
## Intended bounty user experience
|
||||
|
||||
* embedd a the already created Fluence client peer into your dApp
|
||||
|
||||
|
||||
|
||||
## Deployment and code
|
||||
|
||||
* deploy eth-rpc service to each KRAS (?) peer at least once
|
||||
* create Registry instance for deployed services
|
||||
* create Aqua scaffold to interct with registry and modules
|
||||
* create Fluence JS reference client to embed into dApp
|
||||
|
||||
|
||||
|
||||
|
||||
## Introduction
|
||||
|
||||
Fluence decentralized RPC (fRPC) is a ready to use ???
|
||||
|
||||
|
||||
|
@ -7,7 +7,7 @@ description = "ipfs-adapter, a Marine wasi module"
|
||||
license = "Apache-2.0"
|
||||
|
||||
[[bin]]
|
||||
name = "ipfs_adapter"
|
||||
name = "ipfs-adapter"
|
||||
path = "src/main.rs"
|
||||
|
||||
[dependencies]
|
||||
@ -15,8 +15,5 @@ marine-rs-sdk = { version = "0.7.1", features = ["logger"] }
|
||||
log = "0.4.14"
|
||||
|
||||
[dev-dependencies]
|
||||
marine-rs-sdk-test = "0.8.1"
|
||||
marine-rs-sdk-test = "0.8.2"
|
||||
|
||||
[dev]
|
||||
[profile.release]
|
||||
opt-level = "s"
|
||||
|
@ -0,0 +1,11 @@
|
||||
# yaml-language-server: $schema=../../.fluence/schemas/module.yaml.json
|
||||
|
||||
# Defines [Marine Module](https://fluence.dev/docs/build/concepts/#modules). For Fluence CLI, **module** - is a directory which contains this config and either a precompiled .wasm Marine module or a source code of the module written in Rust which can be compiled into a .wasm Marine module. You can use `fluence module new` command to generate a template for new module
|
||||
|
||||
# Documentation: https://github.com/fluencelabs/fluence-cli/tree/main/docs/configs/module.md
|
||||
|
||||
version: 0
|
||||
type: rust
|
||||
name: ipfs-adapter
|
||||
mountedBinaries:
|
||||
ipfs: /usr/bin/ipfs
|
@ -7,7 +7,7 @@ description = "ipfs-cli, a Marine wasi module"
|
||||
license = "Apache-2.0"
|
||||
|
||||
[[bin]]
|
||||
name = "ipfs_cli"
|
||||
name = "ipfs-cli"
|
||||
path = "src/main.rs"
|
||||
|
||||
[dependencies]
|
||||
@ -17,8 +17,4 @@ serde_json = "1.0.81"
|
||||
serde = "1.0.137"
|
||||
|
||||
[dev-dependencies]
|
||||
marine-rs-sdk-test = "0.8.1"
|
||||
|
||||
[dev]
|
||||
[profile.release]
|
||||
opt-level = "s"
|
||||
marine-rs-sdk-test = "0.8.2"
|
||||
|
@ -0,0 +1,9 @@
|
||||
# yaml-language-server: $schema=../../.fluence/schemas/module.yaml.json
|
||||
|
||||
# Defines [Marine Module](https://fluence.dev/docs/build/concepts/#modules). For Fluence CLI, **module** - is a directory which contains this config and either a precompiled .wasm Marine module or a source code of the module written in Rust which can be compiled into a .wasm Marine module. You can use `fluence module new` command to generate a template for new module
|
||||
|
||||
# Documentation: https://github.com/fluencelabs/fluence-cli/tree/main/docs/configs/module.md
|
||||
|
||||
version: 0
|
||||
type: rust
|
||||
name: ipfs-cli
|
@ -1,24 +1,16 @@
|
||||
[package]
|
||||
name = "multi_provider_query"
|
||||
version = "0.1.5"
|
||||
authors = ["boneyard93501 <4523011+boneyard93501@users.noreply.github.com>"]
|
||||
name = "multi-provider-query"
|
||||
version = "0.1.0"
|
||||
edition = "2018"
|
||||
description = "multi-provider-query, a Marine wasi module"
|
||||
license = "Apache-2.0"
|
||||
|
||||
[[bin]]
|
||||
name = "multi_provider_query"
|
||||
name = "multi-provider-query"
|
||||
path = "src/main.rs"
|
||||
|
||||
[dependencies]
|
||||
marine-rs-sdk = { version = "0.7.1", features = ["logger"] }
|
||||
log = "0.4.14"
|
||||
serde_json = "1.0.81"
|
||||
serde = "1.0.137"
|
||||
marine-rs-sdk = "0.7.1"
|
||||
serde = "1.0.152"
|
||||
serde_json = "1.0.92"
|
||||
|
||||
[dev-dependencies]
|
||||
marine-rs-sdk-test = "0.8.1"
|
||||
|
||||
[dev]
|
||||
[profile.release]
|
||||
opt-level = "s"
|
||||
marine-rs-sdk-test = "0.8.2"
|
||||
|
@ -0,0 +1,9 @@
|
||||
# yaml-language-server: $schema=../../.fluence/schemas/module.yaml.json
|
||||
|
||||
# Defines [Marine Module](https://fluence.dev/docs/build/concepts/#modules). For Fluence CLI, **module** - is a directory which contains this config and either a precompiled .wasm Marine module or a source code of the module written in Rust which can be compiled into a .wasm Marine module. You can use `fluence module new` command to generate a template for new module
|
||||
|
||||
# Documentation: https://github.com/fluencelabs/fluence-cli/tree/main/docs/configs/module.md
|
||||
|
||||
version: 0
|
||||
type: rust
|
||||
name: multi-provider-query
|
@ -14,146 +14,146 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
use marine_rs_sdk::{marine, module_manifest, MountedBinaryResult};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_json;
|
||||
use std::sync::atomic::{AtomicUsize, Ordering};
|
||||
use marine_rs_sdk::{marine, module_manifest, MountedBinaryResult};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_json;
|
||||
use std::sync::atomic::{AtomicUsize, Ordering};
|
||||
|
||||
pub static NONCE_COUNTER: AtomicUsize = AtomicUsize::new(1);
|
||||
pub static NONCE_COUNTER: AtomicUsize = AtomicUsize::new(1);
|
||||
|
||||
module_manifest!();
|
||||
module_manifest!();
|
||||
|
||||
fn main() {}
|
||||
fn main() {}
|
||||
|
||||
fn get_nonce() -> u64 {
|
||||
NONCE_COUNTER.fetch_add(1, Ordering::SeqCst) as u64
|
||||
}
|
||||
fn get_nonce() -> u64 {
|
||||
NONCE_COUNTER.fetch_add(1, Ordering::SeqCst) as u64
|
||||
}
|
||||
|
||||
#[marine]
|
||||
pub struct ProviderInfo {
|
||||
pub url: String,
|
||||
pub name: String,
|
||||
}
|
||||
#[marine]
|
||||
pub struct ProviderInfo {
|
||||
pub url: String,
|
||||
pub name: String,
|
||||
}
|
||||
|
||||
#[marine]
|
||||
pub struct EVMResult {
|
||||
pub provider: String,
|
||||
pub stdout: String,
|
||||
pub stderr: String,
|
||||
}
|
||||
#[marine]
|
||||
pub struct EVMResult {
|
||||
pub provider: String,
|
||||
pub stdout: String,
|
||||
pub stderr: String,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
struct RpcData {
|
||||
jsonrpc: String,
|
||||
method: String,
|
||||
params: Vec<String>,
|
||||
id: u64,
|
||||
}
|
||||
#[derive(Serialize, Deserialize)]
|
||||
struct RpcData {
|
||||
jsonrpc: String,
|
||||
method: String,
|
||||
params: Vec<String>,
|
||||
id: u64,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
struct RpcResponseError {
|
||||
code: i32,
|
||||
message: String,
|
||||
}
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
struct RpcResponse {
|
||||
jsonrpc: String,
|
||||
error: Option<RpcResponseError>,
|
||||
result: Option<String>,
|
||||
}
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
struct RpcResponseError {
|
||||
code: i32,
|
||||
message: String,
|
||||
}
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
struct RpcResponse {
|
||||
jsonrpc: String,
|
||||
error: Option<RpcResponseError>,
|
||||
result: Option<String>,
|
||||
}
|
||||
|
||||
impl RpcData {
|
||||
fn new(method: String, params: Vec<String>) -> Self {
|
||||
let nonce = get_nonce();
|
||||
RpcData {
|
||||
jsonrpc: "2.0".to_owned(),
|
||||
method: method,
|
||||
params: params,
|
||||
id: nonce,
|
||||
}
|
||||
}
|
||||
}
|
||||
impl RpcData {
|
||||
fn new(method: String, params: Vec<String>) -> Self {
|
||||
let nonce = get_nonce();
|
||||
RpcData {
|
||||
jsonrpc: "2.0".to_owned(),
|
||||
method: method,
|
||||
params: params,
|
||||
id: nonce,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn curl_cmd_builder(url: String, data: String) -> Vec<String> {
|
||||
let curl_cmd: Vec<String> = vec![
|
||||
url,
|
||||
"-X".to_string(),
|
||||
"POST".to_string(),
|
||||
"-H".to_string(),
|
||||
"Accept: application/json".to_string(),
|
||||
"-H".to_string(),
|
||||
"Content-Type: application/json".to_string(),
|
||||
"-d".to_string(),
|
||||
data,
|
||||
];
|
||||
fn curl_cmd_builder(url: String, data: String) -> Vec<String> {
|
||||
let curl_cmd: Vec<String> = vec![
|
||||
url,
|
||||
"-X".to_string(),
|
||||
"POST".to_string(),
|
||||
"-H".to_string(),
|
||||
"Accept: application/json".to_string(),
|
||||
"-H".to_string(),
|
||||
"Content-Type: application/json".to_string(),
|
||||
"-d".to_string(),
|
||||
data,
|
||||
];
|
||||
|
||||
curl_cmd
|
||||
}
|
||||
curl_cmd
|
||||
}
|
||||
|
||||
fn get_curl_response(curl_cmd: Vec<String>) -> RpcResponse {
|
||||
let response = curl_request(curl_cmd);
|
||||
let response = String::from_utf8(response.stdout).unwrap();
|
||||
let response: Result<RpcResponse, _> = serde_json::from_str(&response);
|
||||
match response {
|
||||
Ok(r) => r,
|
||||
Err(e) => RpcResponse {
|
||||
jsonrpc: "".to_owned(),
|
||||
error: Some(RpcResponseError {
|
||||
code: -1,
|
||||
message: e.to_string(),
|
||||
}),
|
||||
result: None,
|
||||
},
|
||||
}
|
||||
}
|
||||
fn get_curl_response(curl_cmd: Vec<String>) -> RpcResponse {
|
||||
let response = curl_request(curl_cmd);
|
||||
let response = String::from_utf8(response.stdout).unwrap();
|
||||
let response: Result<RpcResponse, _> = serde_json::from_str(&response);
|
||||
match response {
|
||||
Ok(r) => r,
|
||||
Err(e) => RpcResponse {
|
||||
jsonrpc: "".to_owned(),
|
||||
error: Some(RpcResponseError {
|
||||
code: -1,
|
||||
message: e.to_string(),
|
||||
}),
|
||||
result: None,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
#[marine]
|
||||
// see https://eth.wiki/json-rpc/API#eth_blocknumbers
|
||||
fn get_block_number(provider: ProviderInfo) -> EVMResult {
|
||||
let method = "eth_blockNumber";
|
||||
let params: Vec<String> = vec![];
|
||||
let url = provider.url;
|
||||
#[marine]
|
||||
// see https://eth.wiki/json-rpc/API#eth_blocknumbers
|
||||
fn get_block_number(provider: ProviderInfo) -> EVMResult {
|
||||
let method = "eth_blockNumber";
|
||||
let params: Vec<String> = vec![];
|
||||
let url = provider.url;
|
||||
|
||||
let data = RpcData::new(method.to_owned(), params);
|
||||
let data = serde_json::to_string(&data).unwrap();
|
||||
let data = RpcData::new(method.to_owned(), params);
|
||||
let data = serde_json::to_string(&data).unwrap();
|
||||
|
||||
let curl_cmd = curl_cmd_builder(url, data);
|
||||
let response = get_curl_response(curl_cmd);
|
||||
let curl_cmd = curl_cmd_builder(url, data);
|
||||
let response = get_curl_response(curl_cmd);
|
||||
|
||||
if response.error.is_none() {
|
||||
let raw_response = response.result.unwrap();
|
||||
let block_height = u64::from_str_radix(raw_response.trim_start_matches("0x"), 16);
|
||||
if response.error.is_none() {
|
||||
let raw_response = response.result.unwrap();
|
||||
let block_height = u64::from_str_radix(raw_response.trim_start_matches("0x"), 16);
|
||||
|
||||
let result = match block_height {
|
||||
Ok(r) => {
|
||||
let j_res = serde_json::json!({ "block-height": r });
|
||||
EVMResult {
|
||||
provider: provider.name,
|
||||
stdout: j_res.to_string(),
|
||||
stderr: "".to_owned(),
|
||||
}
|
||||
}
|
||||
Err(e) => {
|
||||
let err = format!("unable to convert {} to u64 with error {}", raw_response, e);
|
||||
EVMResult {
|
||||
provider: provider.name,
|
||||
stdout: "".to_owned(),
|
||||
stderr: err,
|
||||
}
|
||||
}
|
||||
};
|
||||
return result;
|
||||
}
|
||||
let result = match block_height {
|
||||
Ok(r) => {
|
||||
let j_res = serde_json::json!({ "block-height": r });
|
||||
EVMResult {
|
||||
provider: provider.name,
|
||||
stdout: j_res.to_string(),
|
||||
stderr: "".to_owned(),
|
||||
}
|
||||
}
|
||||
Err(e) => {
|
||||
let err = format!("unable to convert {} to u64 with error {}", raw_response, e);
|
||||
EVMResult {
|
||||
provider: provider.name,
|
||||
stdout: "".to_owned(),
|
||||
stderr: err,
|
||||
}
|
||||
}
|
||||
};
|
||||
return result;
|
||||
}
|
||||
|
||||
EVMResult {
|
||||
provider: provider.name,
|
||||
stdout: "".to_owned(),
|
||||
stderr: serde_json::to_string(&response.error).unwrap(),
|
||||
}
|
||||
}
|
||||
EVMResult {
|
||||
provider: provider.name,
|
||||
stdout: "".to_owned(),
|
||||
stderr: serde_json::to_string(&response.error).unwrap(),
|
||||
}
|
||||
}
|
||||
|
||||
#[marine]
|
||||
#[link(wasm_import_module = "curl_adapter")]
|
||||
extern "C" {
|
||||
pub fn curl_request(cmd: Vec<String>) -> MountedBinaryResult;
|
||||
}
|
||||
#[marine]
|
||||
#[link(wasm_import_module = "curl_adapter")]
|
||||
extern "C" {
|
||||
pub fn curl_request(cmd: Vec<String>) -> MountedBinaryResult;
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ description = "simple-quorum, a Marine wasi module"
|
||||
license = "Apache-2.0"
|
||||
|
||||
[[bin]]
|
||||
name = "simple_quorum"
|
||||
name = "simple-quorum"
|
||||
path = "src/main.rs"
|
||||
|
||||
[dependencies]
|
||||
@ -18,8 +18,5 @@ serde = "1.0.137"
|
||||
streaming-stats = "0.2.3"
|
||||
|
||||
[dev-dependencies]
|
||||
marine-rs-sdk-test = "0.8.1"
|
||||
marine-rs-sdk-test = "0.8.2"
|
||||
|
||||
[dev]
|
||||
[profile.release]
|
||||
opt-level = "s"
|
||||
|
@ -0,0 +1,9 @@
|
||||
# yaml-language-server: $schema=../../.fluence/schemas/module.yaml.json
|
||||
|
||||
# Defines [Marine Module](https://fluence.dev/docs/build/concepts/#modules). For Fluence CLI, **module** - is a directory which contains this config and either a precompiled .wasm Marine module or a source code of the module written in Rust which can be compiled into a .wasm Marine module. You can use `fluence module new` command to generate a template for new module
|
||||
|
||||
# Documentation: https://github.com/fluencelabs/fluence-cli/tree/main/docs/configs/module.md
|
||||
|
||||
version: 0
|
||||
type: rust
|
||||
name: simple-quorum
|
@ -47,6 +47,7 @@ fn mode<'a>(data: impl ExactSizeIterator<Item = &'a EVMResult>) -> (u32, u64) {
|
||||
(*frequencies.get(&mode).unwrap(), *mode)
|
||||
}
|
||||
|
||||
#[allow(unused)]
|
||||
fn mean<'a>(data: impl ExactSizeIterator<Item = &'a u64>) -> Option<f64> {
|
||||
let n = data.len() as u64;
|
||||
if n < 1 {
|
||||
|
@ -18,8 +18,5 @@ serde = "1.0.137"
|
||||
streaming-stats = "0.2.3"
|
||||
|
||||
[dev-dependencies]
|
||||
marine-rs-sdk-test = "0.8.1"
|
||||
marine-rs-sdk-test = "0.8.2"
|
||||
|
||||
[dev]
|
||||
[profile.release]
|
||||
opt-level = "s"
|
||||
|
@ -0,0 +1,9 @@
|
||||
# yaml-language-server: $schema=../../.fluence/schemas/module.yaml.json
|
||||
|
||||
# Defines [Marine Module](https://fluence.dev/docs/build/concepts/#modules). For Fluence CLI, **module** - is a directory which contains this config and either a precompiled .wasm Marine module or a source code of the module written in Rust which can be compiled into a .wasm Marine module. You can use `fluence module new` command to generate a template for new module
|
||||
|
||||
# Documentation: https://github.com/fluencelabs/fluence-cli/tree/main/docs/configs/module.md
|
||||
|
||||
version: 0
|
||||
type: rust
|
||||
name: utilities
|
@ -23,7 +23,7 @@ paired = "0.22.0"
|
||||
sha2 = "0.9.9"
|
||||
|
||||
[dev-dependencies]
|
||||
marine-rs-sdk-test = "0.8.1"
|
||||
marine-rs-sdk-test = "0.8.2"
|
||||
hex-literal = "0.3.4"
|
||||
|
||||
[dev]
|
||||
|
117
aqua-examples/echo-greeter/client-peer/package-lock.json
generated
117
aqua-examples/echo-greeter/client-peer/package-lock.json
generated
@ -9,12 +9,12 @@
|
||||
"version": "0.1.0",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@fluencelabs/fluence": "^0.27.0",
|
||||
"@fluencelabs/fluence": "^0.28.0",
|
||||
"@fluencelabs/fluence-network-environment": "^1.0.13",
|
||||
"it-all": "^1.0.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@fluencelabs/aqua": "0.8.0-368",
|
||||
"@fluencelabs/aqua": "0.10.3",
|
||||
"@fluencelabs/aqua-lib": "0.6.0",
|
||||
"@types/jest": "^27.0.3",
|
||||
"chokidar-cli": "^3.0.0",
|
||||
@ -606,14 +606,14 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@fluencelabs/aqua": {
|
||||
"version": "0.8.0-368",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/aqua/-/aqua-0.8.0-368.tgz",
|
||||
"integrity": "sha512-vnqgjwJWa2XvNqGUCITvkhIiF7ps9WhZL4GfvtuSwVAsdpDaYGtxPH63wcYcG9TwRCr7nGgjOhJGXhkmGhUE2w==",
|
||||
"version": "0.10.3",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/aqua/-/aqua-0.10.3.tgz",
|
||||
"integrity": "sha512-v7Jy+KzZkUm7NuUgrp7UQ8gxuhykxuTU3JigCdxiZMcG3/zD+OtHzsSggVLxVjDP7CKuTcjEKZSCxObwHp/Tpw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@fluencelabs/aqua-ipfs": "0.5.8",
|
||||
"@fluencelabs/aqua-ipfs": "0.5.9",
|
||||
"@fluencelabs/aqua-lib": "0.6.0",
|
||||
"@fluencelabs/fluence": "0.27.4",
|
||||
"@fluencelabs/fluence": "0.28.0",
|
||||
"@fluencelabs/fluence-network-environment": "1.0.13",
|
||||
"ipfs-http-client": "50.1.2"
|
||||
},
|
||||
@ -623,9 +623,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@fluencelabs/aqua-ipfs": {
|
||||
"version": "0.5.8",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/aqua-ipfs/-/aqua-ipfs-0.5.8.tgz",
|
||||
"integrity": "sha512-jKlyGBm8oJAIQ3Ags58oJ8QVTlCYSvZQVTnX2SnugGXWVwt4+9qtqtvNT5MvWKK3M9lCFDbJJy/qVTjzPJlaiw==",
|
||||
"version": "0.5.9",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/aqua-ipfs/-/aqua-ipfs-0.5.9.tgz",
|
||||
"integrity": "sha512-Vg7pYv4gEreOKfvzKEL5FchGqSKwat7JyKpqJO6h+FC5S1bl76UkI507+ExhijmUbQGznop8G33XFxyUi6q5SQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@fluencelabs/aqua-lib": "^0.5.2"
|
||||
@ -644,9 +644,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@fluencelabs/avm": {
|
||||
"version": "0.31.10",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/avm/-/avm-0.31.10.tgz",
|
||||
"integrity": "sha512-tkpjdHyRmsTwAEZCJt15//jXEgC2Nw2qFiD1NenvK127SlgKeuzQU9IMReUYY3dowb2IGeC578/uGMu96jHYKw=="
|
||||
"version": "0.35.3",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/avm/-/avm-0.35.3.tgz",
|
||||
"integrity": "sha512-Y5mPPCmAUUKc5CDO12IL8mGEreWa7maVdX0MWCAH4+GvfLPFN1FxOMSKRYEtvkyVEL88pc9pd8cm5IRCBkFthg=="
|
||||
},
|
||||
"node_modules/@fluencelabs/connection": {
|
||||
"version": "0.2.0",
|
||||
@ -714,23 +714,23 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@fluencelabs/fluence": {
|
||||
"version": "0.27.4",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/fluence/-/fluence-0.27.4.tgz",
|
||||
"integrity": "sha512-f85q8ZdmPlUd6uIgmS0CDTvSsb+TGvTqOljw0b161lfEuqPIXrjxJSt0/2Lyh2eEZ1P3slOka1tbVw01nVrt5w==",
|
||||
"version": "0.28.0",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/fluence/-/fluence-0.28.0.tgz",
|
||||
"integrity": "sha512-SXb2vjTj8m/nw4jEILV0tu9VIFprGo8mNb2nOB5btxdsOI8GzQZkpGzTLrSd/+UagIo2GdxAu0GhBP8dxZXaqg==",
|
||||
"dependencies": {
|
||||
"@fluencelabs/avm": "0.31.10",
|
||||
"@fluencelabs/avm": "0.35.3",
|
||||
"@fluencelabs/connection": "0.2.0",
|
||||
"@fluencelabs/interfaces": "0.1.0",
|
||||
"@fluencelabs/keypair": "0.2.0",
|
||||
"@fluencelabs/marine-js": "0.3.37",
|
||||
"async": "3.2.3",
|
||||
"async": "3.2.4",
|
||||
"base64-js": "^1.5.1",
|
||||
"browser-or-node": "2.0.0",
|
||||
"bs58": "5.0.0",
|
||||
"buffer": "^6.0.3",
|
||||
"cids": "1.1.9",
|
||||
"loglevel": "1.8.0",
|
||||
"multiformats": "9.6.5",
|
||||
"loglevel": "1.8.1",
|
||||
"multiformats": "9.9.0",
|
||||
"peer-id": "0.16.0",
|
||||
"platform": "^1.3.6",
|
||||
"rxjs": "^7.5.5",
|
||||
@ -768,6 +768,18 @@
|
||||
"node": ">=12.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@fluencelabs/fluence/node_modules/loglevel": {
|
||||
"version": "1.8.1",
|
||||
"resolved": "https://registry.npmjs.org/loglevel/-/loglevel-1.8.1.tgz",
|
||||
"integrity": "sha512-tCRIJM51SHjAayKwC+QAg8hT8vg6z7GSgLJKGvzuPb1Wc+hLzqtuVLxp6/HzSPOozuK+8ErAhy7U/sVzw8Dgfg==",
|
||||
"engines": {
|
||||
"node": ">= 0.6.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "tidelift",
|
||||
"url": "https://tidelift.com/funding/github/npm/loglevel"
|
||||
}
|
||||
},
|
||||
"node_modules/@fluencelabs/fluence/node_modules/node-forge": {
|
||||
"version": "1.3.1",
|
||||
"resolved": "https://registry.npmjs.org/node-forge/-/node-forge-1.3.1.tgz",
|
||||
@ -1753,9 +1765,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/async": {
|
||||
"version": "3.2.3",
|
||||
"resolved": "https://registry.npmjs.org/async/-/async-3.2.3.tgz",
|
||||
"integrity": "sha512-spZRyzKL5l5BZQrr/6m/SqFdBN0q3OCI0f9rjfBzCMBIP4p75P620rR3gTmaksNOhmzgdxcaxdNfMy6anrbM0g=="
|
||||
"version": "3.2.4",
|
||||
"resolved": "https://registry.npmjs.org/async/-/async-3.2.4.tgz",
|
||||
"integrity": "sha512-iAB+JbDEGXhyIUavoDl9WP/Jj106Kz9DEn1DPgYw5ruDn0e3Wgi3sKFm55sASdGBNOQB8F59d9qQ7deqrHA8wQ=="
|
||||
},
|
||||
"node_modules/asynckit": {
|
||||
"version": "0.4.0",
|
||||
@ -5542,9 +5554,9 @@
|
||||
"integrity": "sha512-cXEIW6cfr15lFv563k4GuVuW/fiwjknytD37jIOLSdSWuOI6WnO/oKwmP2FQTU2l01LP8/M5TSAJpzUaGe3uWg=="
|
||||
},
|
||||
"node_modules/multiformats": {
|
||||
"version": "9.6.5",
|
||||
"resolved": "https://registry.npmjs.org/multiformats/-/multiformats-9.6.5.tgz",
|
||||
"integrity": "sha512-vMwf/FUO+qAPvl3vlSZEgEVFY/AxeZq5yg761ScF3CZsXgmTi/HGkicUiNN0CI4PW8FiY2P0OLklOcmQjdQJhw=="
|
||||
"version": "9.9.0",
|
||||
"resolved": "https://registry.npmjs.org/multiformats/-/multiformats-9.9.0.tgz",
|
||||
"integrity": "sha512-HoMUjhH9T8DDBNT+6xzkrd9ga/XiBI4xLr58LJACwK6G3HTOPeMz4nB4KJs33L2BelrIJa7P0VuNaVF3hMYfjg=="
|
||||
},
|
||||
"node_modules/multihashes": {
|
||||
"version": "4.0.3",
|
||||
@ -8026,22 +8038,22 @@
|
||||
}
|
||||
},
|
||||
"@fluencelabs/aqua": {
|
||||
"version": "0.8.0-368",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/aqua/-/aqua-0.8.0-368.tgz",
|
||||
"integrity": "sha512-vnqgjwJWa2XvNqGUCITvkhIiF7ps9WhZL4GfvtuSwVAsdpDaYGtxPH63wcYcG9TwRCr7nGgjOhJGXhkmGhUE2w==",
|
||||
"version": "0.10.3",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/aqua/-/aqua-0.10.3.tgz",
|
||||
"integrity": "sha512-v7Jy+KzZkUm7NuUgrp7UQ8gxuhykxuTU3JigCdxiZMcG3/zD+OtHzsSggVLxVjDP7CKuTcjEKZSCxObwHp/Tpw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@fluencelabs/aqua-ipfs": "0.5.8",
|
||||
"@fluencelabs/aqua-ipfs": "0.5.9",
|
||||
"@fluencelabs/aqua-lib": "0.6.0",
|
||||
"@fluencelabs/fluence": "0.27.4",
|
||||
"@fluencelabs/fluence": "0.28.0",
|
||||
"@fluencelabs/fluence-network-environment": "1.0.13",
|
||||
"ipfs-http-client": "50.1.2"
|
||||
}
|
||||
},
|
||||
"@fluencelabs/aqua-ipfs": {
|
||||
"version": "0.5.8",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/aqua-ipfs/-/aqua-ipfs-0.5.8.tgz",
|
||||
"integrity": "sha512-jKlyGBm8oJAIQ3Ags58oJ8QVTlCYSvZQVTnX2SnugGXWVwt4+9qtqtvNT5MvWKK3M9lCFDbJJy/qVTjzPJlaiw==",
|
||||
"version": "0.5.9",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/aqua-ipfs/-/aqua-ipfs-0.5.9.tgz",
|
||||
"integrity": "sha512-Vg7pYv4gEreOKfvzKEL5FchGqSKwat7JyKpqJO6h+FC5S1bl76UkI507+ExhijmUbQGznop8G33XFxyUi6q5SQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@fluencelabs/aqua-lib": "^0.5.2"
|
||||
@ -8062,9 +8074,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"@fluencelabs/avm": {
|
||||
"version": "0.31.10",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/avm/-/avm-0.31.10.tgz",
|
||||
"integrity": "sha512-tkpjdHyRmsTwAEZCJt15//jXEgC2Nw2qFiD1NenvK127SlgKeuzQU9IMReUYY3dowb2IGeC578/uGMu96jHYKw=="
|
||||
"version": "0.35.3",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/avm/-/avm-0.35.3.tgz",
|
||||
"integrity": "sha512-Y5mPPCmAUUKc5CDO12IL8mGEreWa7maVdX0MWCAH4+GvfLPFN1FxOMSKRYEtvkyVEL88pc9pd8cm5IRCBkFthg=="
|
||||
},
|
||||
"@fluencelabs/connection": {
|
||||
"version": "0.2.0",
|
||||
@ -8121,23 +8133,23 @@
|
||||
}
|
||||
},
|
||||
"@fluencelabs/fluence": {
|
||||
"version": "0.27.4",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/fluence/-/fluence-0.27.4.tgz",
|
||||
"integrity": "sha512-f85q8ZdmPlUd6uIgmS0CDTvSsb+TGvTqOljw0b161lfEuqPIXrjxJSt0/2Lyh2eEZ1P3slOka1tbVw01nVrt5w==",
|
||||
"version": "0.28.0",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/fluence/-/fluence-0.28.0.tgz",
|
||||
"integrity": "sha512-SXb2vjTj8m/nw4jEILV0tu9VIFprGo8mNb2nOB5btxdsOI8GzQZkpGzTLrSd/+UagIo2GdxAu0GhBP8dxZXaqg==",
|
||||
"requires": {
|
||||
"@fluencelabs/avm": "0.31.10",
|
||||
"@fluencelabs/avm": "0.35.3",
|
||||
"@fluencelabs/connection": "0.2.0",
|
||||
"@fluencelabs/interfaces": "0.1.0",
|
||||
"@fluencelabs/keypair": "0.2.0",
|
||||
"@fluencelabs/marine-js": "0.3.37",
|
||||
"async": "3.2.3",
|
||||
"async": "3.2.4",
|
||||
"base64-js": "^1.5.1",
|
||||
"browser-or-node": "2.0.0",
|
||||
"bs58": "5.0.0",
|
||||
"buffer": "^6.0.3",
|
||||
"cids": "1.1.9",
|
||||
"loglevel": "1.8.0",
|
||||
"multiformats": "9.6.5",
|
||||
"loglevel": "1.8.1",
|
||||
"multiformats": "9.9.0",
|
||||
"peer-id": "0.16.0",
|
||||
"platform": "^1.3.6",
|
||||
"rxjs": "^7.5.5",
|
||||
@ -8160,6 +8172,11 @@
|
||||
"uint8arrays": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"loglevel": {
|
||||
"version": "1.8.1",
|
||||
"resolved": "https://registry.npmjs.org/loglevel/-/loglevel-1.8.1.tgz",
|
||||
"integrity": "sha512-tCRIJM51SHjAayKwC+QAg8hT8vg6z7GSgLJKGvzuPb1Wc+hLzqtuVLxp6/HzSPOozuK+8ErAhy7U/sVzw8Dgfg=="
|
||||
},
|
||||
"node-forge": {
|
||||
"version": "1.3.1",
|
||||
"resolved": "https://registry.npmjs.org/node-forge/-/node-forge-1.3.1.tgz",
|
||||
@ -9008,9 +9025,9 @@
|
||||
"integrity": "sha512-NfJ4UzBCcQGLDlQq7nHxH+tv3kyZ0hHQqF5BO6J7tNJeP5do1llPr8dZ8zHonfhAu0PHAdMkSo+8o0wxg9lZWw=="
|
||||
},
|
||||
"async": {
|
||||
"version": "3.2.3",
|
||||
"resolved": "https://registry.npmjs.org/async/-/async-3.2.3.tgz",
|
||||
"integrity": "sha512-spZRyzKL5l5BZQrr/6m/SqFdBN0q3OCI0f9rjfBzCMBIP4p75P620rR3gTmaksNOhmzgdxcaxdNfMy6anrbM0g=="
|
||||
"version": "3.2.4",
|
||||
"resolved": "https://registry.npmjs.org/async/-/async-3.2.4.tgz",
|
||||
"integrity": "sha512-iAB+JbDEGXhyIUavoDl9WP/Jj106Kz9DEn1DPgYw5ruDn0e3Wgi3sKFm55sASdGBNOQB8F59d9qQ7deqrHA8wQ=="
|
||||
},
|
||||
"asynckit": {
|
||||
"version": "0.4.0",
|
||||
@ -12093,9 +12110,9 @@
|
||||
}
|
||||
},
|
||||
"multiformats": {
|
||||
"version": "9.6.5",
|
||||
"resolved": "https://registry.npmjs.org/multiformats/-/multiformats-9.6.5.tgz",
|
||||
"integrity": "sha512-vMwf/FUO+qAPvl3vlSZEgEVFY/AxeZq5yg761ScF3CZsXgmTi/HGkicUiNN0CI4PW8FiY2P0OLklOcmQjdQJhw=="
|
||||
"version": "9.9.0",
|
||||
"resolved": "https://registry.npmjs.org/multiformats/-/multiformats-9.9.0.tgz",
|
||||
"integrity": "sha512-HoMUjhH9T8DDBNT+6xzkrd9ga/XiBI4xLr58LJACwK6G3HTOPeMz4nB4KJs33L2BelrIJa7P0VuNaVF3hMYfjg=="
|
||||
},
|
||||
"multihashes": {
|
||||
"version": "4.0.3",
|
||||
|
@ -13,7 +13,7 @@
|
||||
"package-lock.json"
|
||||
],
|
||||
"dependencies": {
|
||||
"@fluencelabs/fluence": "^0.27.0",
|
||||
"@fluencelabs/fluence": "^0.28.0",
|
||||
"@fluencelabs/fluence-network-environment": "^1.0.13",
|
||||
"it-all": "^1.0.5"
|
||||
},
|
||||
@ -41,7 +41,7 @@
|
||||
},
|
||||
"homepage": "git+https://github.com/fluencelabs/examples/aqua-examples/echo-greeter#readme",
|
||||
"devDependencies": {
|
||||
"@fluencelabs/aqua": "0.8.0-368",
|
||||
"@fluencelabs/aqua": "0.10.3",
|
||||
"@fluencelabs/aqua-lib": "0.6.0",
|
||||
"@types/jest": "^27.0.3",
|
||||
"chokidar-cli": "^3.0.0",
|
||||
|
@ -15,7 +15,7 @@ marine-rs-sdk = { version = "0.7.1", features = ["logger"] }
|
||||
log = "0.4.14"
|
||||
|
||||
[dev-dependencies]
|
||||
marine-rs-sdk-test = "0.8.1"
|
||||
marine-rs-sdk-test = "0.8.2"
|
||||
|
||||
[dev]
|
||||
[profile.release]
|
||||
|
@ -11,15 +11,15 @@
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"devDependencies": {
|
||||
"@fluencelabs/aqua": "0.8.0-368",
|
||||
"@fluencelabs/aqua": "0.10.3",
|
||||
"@fluencelabs/aqua-lib": "0.6.0",
|
||||
"chokidar-cli": "^3.0.0",
|
||||
"ts-node": "^10.7.0",
|
||||
"typescript": "^4.6.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@fluencelabs/fluence": "0.27.5",
|
||||
"@fluencelabs/fluence-network-environment": "1.0.13",
|
||||
"@fluencelabs/fluence": "0.28.0",
|
||||
"@fluencelabs/fluence-network-environment": "1.0.14",
|
||||
"@types/sqlite3": "^3.1.7",
|
||||
"near-api-js": "^0.43.1"
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ marine-rs-sdk = { version = "0.7.1", features = ["logger"] }
|
||||
log = "0.4.14"
|
||||
|
||||
[dev-dependencies]
|
||||
marine-rs-sdk-test = "0.8.1"
|
||||
marine-rs-sdk-test = "0.8.2"
|
||||
|
||||
[dev]
|
||||
[profile.release]
|
||||
|
@ -17,7 +17,7 @@ serde = { version = "1.0.132", default-features = false }
|
||||
serde_json = { version = "1.0.73", default-features = false }
|
||||
|
||||
[dev-dependencies]
|
||||
marine-rs-sdk-test = "0.8.1"
|
||||
marine-rs-sdk-test = "0.8.2"
|
||||
|
||||
[dev]
|
||||
[profile.release]
|
||||
|
145
aqua-examples/price-oracle/client-peer/package-lock.json
generated
145
aqua-examples/price-oracle/client-peer/package-lock.json
generated
@ -9,12 +9,12 @@
|
||||
"version": "0.1.0",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@fluencelabs/fluence": "^0.27.0",
|
||||
"@fluencelabs/fluence-network-environment": "1.0.13",
|
||||
"@fluencelabs/fluence": "^0.28.0",
|
||||
"@fluencelabs/fluence-network-environment": "1.0.14",
|
||||
"it-all": "^1.0.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@fluencelabs/aqua": "0.8.0-368",
|
||||
"@fluencelabs/aqua": "0.10.3",
|
||||
"@fluencelabs/aqua-lib": "0.6.0",
|
||||
"@types/jest": "^27.0.3",
|
||||
"chokidar-cli": "^3.0.0",
|
||||
@ -606,14 +606,14 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@fluencelabs/aqua": {
|
||||
"version": "0.8.0-368",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/aqua/-/aqua-0.8.0-368.tgz",
|
||||
"integrity": "sha512-vnqgjwJWa2XvNqGUCITvkhIiF7ps9WhZL4GfvtuSwVAsdpDaYGtxPH63wcYcG9TwRCr7nGgjOhJGXhkmGhUE2w==",
|
||||
"version": "0.10.3",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/aqua/-/aqua-0.10.3.tgz",
|
||||
"integrity": "sha512-v7Jy+KzZkUm7NuUgrp7UQ8gxuhykxuTU3JigCdxiZMcG3/zD+OtHzsSggVLxVjDP7CKuTcjEKZSCxObwHp/Tpw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@fluencelabs/aqua-ipfs": "0.5.8",
|
||||
"@fluencelabs/aqua-ipfs": "0.5.9",
|
||||
"@fluencelabs/aqua-lib": "0.6.0",
|
||||
"@fluencelabs/fluence": "0.27.4",
|
||||
"@fluencelabs/fluence": "0.28.0",
|
||||
"@fluencelabs/fluence-network-environment": "1.0.13",
|
||||
"ipfs-http-client": "50.1.2"
|
||||
},
|
||||
@ -623,9 +623,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@fluencelabs/aqua-ipfs": {
|
||||
"version": "0.5.8",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/aqua-ipfs/-/aqua-ipfs-0.5.8.tgz",
|
||||
"integrity": "sha512-jKlyGBm8oJAIQ3Ags58oJ8QVTlCYSvZQVTnX2SnugGXWVwt4+9qtqtvNT5MvWKK3M9lCFDbJJy/qVTjzPJlaiw==",
|
||||
"version": "0.5.9",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/aqua-ipfs/-/aqua-ipfs-0.5.9.tgz",
|
||||
"integrity": "sha512-Vg7pYv4gEreOKfvzKEL5FchGqSKwat7JyKpqJO6h+FC5S1bl76UkI507+ExhijmUbQGznop8G33XFxyUi6q5SQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@fluencelabs/aqua-lib": "^0.5.2"
|
||||
@ -643,10 +643,16 @@
|
||||
"integrity": "sha512-ifjtCM93KO3LhzPkMxqmXhwLmrg/scjOiyTihEVg7ns5N+BVzaK1eWzdOdqGdl9ZVoah43pdlQUepEo7VdRmsw==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@fluencelabs/aqua/node_modules/@fluencelabs/fluence-network-environment": {
|
||||
"version": "1.0.13",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/fluence-network-environment/-/fluence-network-environment-1.0.13.tgz",
|
||||
"integrity": "sha512-2pci3T0sUHE08jwEs1r/vHKVT4XUh/A3j/QJ0eIhddsxyIjEksjdn05X7DF6STD14CF8GgBVOJEPgav8qaUMpA==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@fluencelabs/avm": {
|
||||
"version": "0.31.10",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/avm/-/avm-0.31.10.tgz",
|
||||
"integrity": "sha512-tkpjdHyRmsTwAEZCJt15//jXEgC2Nw2qFiD1NenvK127SlgKeuzQU9IMReUYY3dowb2IGeC578/uGMu96jHYKw=="
|
||||
"version": "0.35.3",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/avm/-/avm-0.35.3.tgz",
|
||||
"integrity": "sha512-Y5mPPCmAUUKc5CDO12IL8mGEreWa7maVdX0MWCAH4+GvfLPFN1FxOMSKRYEtvkyVEL88pc9pd8cm5IRCBkFthg=="
|
||||
},
|
||||
"node_modules/@fluencelabs/connection": {
|
||||
"version": "0.2.0",
|
||||
@ -714,23 +720,23 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@fluencelabs/fluence": {
|
||||
"version": "0.27.4",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/fluence/-/fluence-0.27.4.tgz",
|
||||
"integrity": "sha512-f85q8ZdmPlUd6uIgmS0CDTvSsb+TGvTqOljw0b161lfEuqPIXrjxJSt0/2Lyh2eEZ1P3slOka1tbVw01nVrt5w==",
|
||||
"version": "0.28.0",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/fluence/-/fluence-0.28.0.tgz",
|
||||
"integrity": "sha512-SXb2vjTj8m/nw4jEILV0tu9VIFprGo8mNb2nOB5btxdsOI8GzQZkpGzTLrSd/+UagIo2GdxAu0GhBP8dxZXaqg==",
|
||||
"dependencies": {
|
||||
"@fluencelabs/avm": "0.31.10",
|
||||
"@fluencelabs/avm": "0.35.3",
|
||||
"@fluencelabs/connection": "0.2.0",
|
||||
"@fluencelabs/interfaces": "0.1.0",
|
||||
"@fluencelabs/keypair": "0.2.0",
|
||||
"@fluencelabs/marine-js": "0.3.37",
|
||||
"async": "3.2.3",
|
||||
"async": "3.2.4",
|
||||
"base64-js": "^1.5.1",
|
||||
"browser-or-node": "2.0.0",
|
||||
"bs58": "5.0.0",
|
||||
"buffer": "^6.0.3",
|
||||
"cids": "1.1.9",
|
||||
"loglevel": "1.8.0",
|
||||
"multiformats": "9.6.5",
|
||||
"loglevel": "1.8.1",
|
||||
"multiformats": "9.9.0",
|
||||
"peer-id": "0.16.0",
|
||||
"platform": "^1.3.6",
|
||||
"rxjs": "^7.5.5",
|
||||
@ -746,9 +752,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@fluencelabs/fluence-network-environment": {
|
||||
"version": "1.0.13",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/fluence-network-environment/-/fluence-network-environment-1.0.13.tgz",
|
||||
"integrity": "sha512-2pci3T0sUHE08jwEs1r/vHKVT4XUh/A3j/QJ0eIhddsxyIjEksjdn05X7DF6STD14CF8GgBVOJEPgav8qaUMpA=="
|
||||
"version": "1.0.14",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/fluence-network-environment/-/fluence-network-environment-1.0.14.tgz",
|
||||
"integrity": "sha512-lMiH+7obmJW2Q+PMUR/vNAuX6TcVqlKmsWAHvnBogH7s8IeMT+UGN8qrweILWmE57G7MfauB302dIFQowR9tug=="
|
||||
},
|
||||
"node_modules/@fluencelabs/fluence/node_modules/libp2p-crypto": {
|
||||
"version": "0.21.2",
|
||||
@ -768,6 +774,18 @@
|
||||
"node": ">=12.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@fluencelabs/fluence/node_modules/loglevel": {
|
||||
"version": "1.8.1",
|
||||
"resolved": "https://registry.npmjs.org/loglevel/-/loglevel-1.8.1.tgz",
|
||||
"integrity": "sha512-tCRIJM51SHjAayKwC+QAg8hT8vg6z7GSgLJKGvzuPb1Wc+hLzqtuVLxp6/HzSPOozuK+8ErAhy7U/sVzw8Dgfg==",
|
||||
"engines": {
|
||||
"node": ">= 0.6.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "tidelift",
|
||||
"url": "https://tidelift.com/funding/github/npm/loglevel"
|
||||
}
|
||||
},
|
||||
"node_modules/@fluencelabs/fluence/node_modules/node-forge": {
|
||||
"version": "1.3.1",
|
||||
"resolved": "https://registry.npmjs.org/node-forge/-/node-forge-1.3.1.tgz",
|
||||
@ -1753,9 +1771,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/async": {
|
||||
"version": "3.2.3",
|
||||
"resolved": "https://registry.npmjs.org/async/-/async-3.2.3.tgz",
|
||||
"integrity": "sha512-spZRyzKL5l5BZQrr/6m/SqFdBN0q3OCI0f9rjfBzCMBIP4p75P620rR3gTmaksNOhmzgdxcaxdNfMy6anrbM0g=="
|
||||
"version": "3.2.4",
|
||||
"resolved": "https://registry.npmjs.org/async/-/async-3.2.4.tgz",
|
||||
"integrity": "sha512-iAB+JbDEGXhyIUavoDl9WP/Jj106Kz9DEn1DPgYw5ruDn0e3Wgi3sKFm55sASdGBNOQB8F59d9qQ7deqrHA8wQ=="
|
||||
},
|
||||
"node_modules/asynckit": {
|
||||
"version": "0.4.0",
|
||||
@ -5542,9 +5560,9 @@
|
||||
"integrity": "sha512-cXEIW6cfr15lFv563k4GuVuW/fiwjknytD37jIOLSdSWuOI6WnO/oKwmP2FQTU2l01LP8/M5TSAJpzUaGe3uWg=="
|
||||
},
|
||||
"node_modules/multiformats": {
|
||||
"version": "9.6.5",
|
||||
"resolved": "https://registry.npmjs.org/multiformats/-/multiformats-9.6.5.tgz",
|
||||
"integrity": "sha512-vMwf/FUO+qAPvl3vlSZEgEVFY/AxeZq5yg761ScF3CZsXgmTi/HGkicUiNN0CI4PW8FiY2P0OLklOcmQjdQJhw=="
|
||||
"version": "9.9.0",
|
||||
"resolved": "https://registry.npmjs.org/multiformats/-/multiformats-9.9.0.tgz",
|
||||
"integrity": "sha512-HoMUjhH9T8DDBNT+6xzkrd9ga/XiBI4xLr58LJACwK6G3HTOPeMz4nB4KJs33L2BelrIJa7P0VuNaVF3hMYfjg=="
|
||||
},
|
||||
"node_modules/multihashes": {
|
||||
"version": "4.0.3",
|
||||
@ -8026,22 +8044,30 @@
|
||||
}
|
||||
},
|
||||
"@fluencelabs/aqua": {
|
||||
"version": "0.8.0-368",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/aqua/-/aqua-0.8.0-368.tgz",
|
||||
"integrity": "sha512-vnqgjwJWa2XvNqGUCITvkhIiF7ps9WhZL4GfvtuSwVAsdpDaYGtxPH63wcYcG9TwRCr7nGgjOhJGXhkmGhUE2w==",
|
||||
"version": "0.10.3",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/aqua/-/aqua-0.10.3.tgz",
|
||||
"integrity": "sha512-v7Jy+KzZkUm7NuUgrp7UQ8gxuhykxuTU3JigCdxiZMcG3/zD+OtHzsSggVLxVjDP7CKuTcjEKZSCxObwHp/Tpw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@fluencelabs/aqua-ipfs": "0.5.8",
|
||||
"@fluencelabs/aqua-ipfs": "0.5.9",
|
||||
"@fluencelabs/aqua-lib": "0.6.0",
|
||||
"@fluencelabs/fluence": "0.27.4",
|
||||
"@fluencelabs/fluence": "0.28.0",
|
||||
"@fluencelabs/fluence-network-environment": "1.0.13",
|
||||
"ipfs-http-client": "50.1.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@fluencelabs/fluence-network-environment": {
|
||||
"version": "1.0.13",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/fluence-network-environment/-/fluence-network-environment-1.0.13.tgz",
|
||||
"integrity": "sha512-2pci3T0sUHE08jwEs1r/vHKVT4XUh/A3j/QJ0eIhddsxyIjEksjdn05X7DF6STD14CF8GgBVOJEPgav8qaUMpA==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"@fluencelabs/aqua-ipfs": {
|
||||
"version": "0.5.8",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/aqua-ipfs/-/aqua-ipfs-0.5.8.tgz",
|
||||
"integrity": "sha512-jKlyGBm8oJAIQ3Ags58oJ8QVTlCYSvZQVTnX2SnugGXWVwt4+9qtqtvNT5MvWKK3M9lCFDbJJy/qVTjzPJlaiw==",
|
||||
"version": "0.5.9",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/aqua-ipfs/-/aqua-ipfs-0.5.9.tgz",
|
||||
"integrity": "sha512-Vg7pYv4gEreOKfvzKEL5FchGqSKwat7JyKpqJO6h+FC5S1bl76UkI507+ExhijmUbQGznop8G33XFxyUi6q5SQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@fluencelabs/aqua-lib": "^0.5.2"
|
||||
@ -8062,9 +8088,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"@fluencelabs/avm": {
|
||||
"version": "0.31.10",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/avm/-/avm-0.31.10.tgz",
|
||||
"integrity": "sha512-tkpjdHyRmsTwAEZCJt15//jXEgC2Nw2qFiD1NenvK127SlgKeuzQU9IMReUYY3dowb2IGeC578/uGMu96jHYKw=="
|
||||
"version": "0.35.3",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/avm/-/avm-0.35.3.tgz",
|
||||
"integrity": "sha512-Y5mPPCmAUUKc5CDO12IL8mGEreWa7maVdX0MWCAH4+GvfLPFN1FxOMSKRYEtvkyVEL88pc9pd8cm5IRCBkFthg=="
|
||||
},
|
||||
"@fluencelabs/connection": {
|
||||
"version": "0.2.0",
|
||||
@ -8121,23 +8147,23 @@
|
||||
}
|
||||
},
|
||||
"@fluencelabs/fluence": {
|
||||
"version": "0.27.4",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/fluence/-/fluence-0.27.4.tgz",
|
||||
"integrity": "sha512-f85q8ZdmPlUd6uIgmS0CDTvSsb+TGvTqOljw0b161lfEuqPIXrjxJSt0/2Lyh2eEZ1P3slOka1tbVw01nVrt5w==",
|
||||
"version": "0.28.0",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/fluence/-/fluence-0.28.0.tgz",
|
||||
"integrity": "sha512-SXb2vjTj8m/nw4jEILV0tu9VIFprGo8mNb2nOB5btxdsOI8GzQZkpGzTLrSd/+UagIo2GdxAu0GhBP8dxZXaqg==",
|
||||
"requires": {
|
||||
"@fluencelabs/avm": "0.31.10",
|
||||
"@fluencelabs/avm": "0.35.3",
|
||||
"@fluencelabs/connection": "0.2.0",
|
||||
"@fluencelabs/interfaces": "0.1.0",
|
||||
"@fluencelabs/keypair": "0.2.0",
|
||||
"@fluencelabs/marine-js": "0.3.37",
|
||||
"async": "3.2.3",
|
||||
"async": "3.2.4",
|
||||
"base64-js": "^1.5.1",
|
||||
"browser-or-node": "2.0.0",
|
||||
"bs58": "5.0.0",
|
||||
"buffer": "^6.0.3",
|
||||
"cids": "1.1.9",
|
||||
"loglevel": "1.8.0",
|
||||
"multiformats": "9.6.5",
|
||||
"loglevel": "1.8.1",
|
||||
"multiformats": "9.9.0",
|
||||
"peer-id": "0.16.0",
|
||||
"platform": "^1.3.6",
|
||||
"rxjs": "^7.5.5",
|
||||
@ -8160,6 +8186,11 @@
|
||||
"uint8arrays": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"loglevel": {
|
||||
"version": "1.8.1",
|
||||
"resolved": "https://registry.npmjs.org/loglevel/-/loglevel-1.8.1.tgz",
|
||||
"integrity": "sha512-tCRIJM51SHjAayKwC+QAg8hT8vg6z7GSgLJKGvzuPb1Wc+hLzqtuVLxp6/HzSPOozuK+8ErAhy7U/sVzw8Dgfg=="
|
||||
},
|
||||
"node-forge": {
|
||||
"version": "1.3.1",
|
||||
"resolved": "https://registry.npmjs.org/node-forge/-/node-forge-1.3.1.tgz",
|
||||
@ -8180,9 +8211,9 @@
|
||||
}
|
||||
},
|
||||
"@fluencelabs/fluence-network-environment": {
|
||||
"version": "1.0.13",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/fluence-network-environment/-/fluence-network-environment-1.0.13.tgz",
|
||||
"integrity": "sha512-2pci3T0sUHE08jwEs1r/vHKVT4XUh/A3j/QJ0eIhddsxyIjEksjdn05X7DF6STD14CF8GgBVOJEPgav8qaUMpA=="
|
||||
"version": "1.0.14",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/fluence-network-environment/-/fluence-network-environment-1.0.14.tgz",
|
||||
"integrity": "sha512-lMiH+7obmJW2Q+PMUR/vNAuX6TcVqlKmsWAHvnBogH7s8IeMT+UGN8qrweILWmE57G7MfauB302dIFQowR9tug=="
|
||||
},
|
||||
"@fluencelabs/interfaces": {
|
||||
"version": "0.1.0",
|
||||
@ -9008,9 +9039,9 @@
|
||||
"integrity": "sha512-NfJ4UzBCcQGLDlQq7nHxH+tv3kyZ0hHQqF5BO6J7tNJeP5do1llPr8dZ8zHonfhAu0PHAdMkSo+8o0wxg9lZWw=="
|
||||
},
|
||||
"async": {
|
||||
"version": "3.2.3",
|
||||
"resolved": "https://registry.npmjs.org/async/-/async-3.2.3.tgz",
|
||||
"integrity": "sha512-spZRyzKL5l5BZQrr/6m/SqFdBN0q3OCI0f9rjfBzCMBIP4p75P620rR3gTmaksNOhmzgdxcaxdNfMy6anrbM0g=="
|
||||
"version": "3.2.4",
|
||||
"resolved": "https://registry.npmjs.org/async/-/async-3.2.4.tgz",
|
||||
"integrity": "sha512-iAB+JbDEGXhyIUavoDl9WP/Jj106Kz9DEn1DPgYw5ruDn0e3Wgi3sKFm55sASdGBNOQB8F59d9qQ7deqrHA8wQ=="
|
||||
},
|
||||
"asynckit": {
|
||||
"version": "0.4.0",
|
||||
@ -12093,9 +12124,9 @@
|
||||
}
|
||||
},
|
||||
"multiformats": {
|
||||
"version": "9.6.5",
|
||||
"resolved": "https://registry.npmjs.org/multiformats/-/multiformats-9.6.5.tgz",
|
||||
"integrity": "sha512-vMwf/FUO+qAPvl3vlSZEgEVFY/AxeZq5yg761ScF3CZsXgmTi/HGkicUiNN0CI4PW8FiY2P0OLklOcmQjdQJhw=="
|
||||
"version": "9.9.0",
|
||||
"resolved": "https://registry.npmjs.org/multiformats/-/multiformats-9.9.0.tgz",
|
||||
"integrity": "sha512-HoMUjhH9T8DDBNT+6xzkrd9ga/XiBI4xLr58LJACwK6G3HTOPeMz4nB4KJs33L2BelrIJa7P0VuNaVF3hMYfjg=="
|
||||
},
|
||||
"multihashes": {
|
||||
"version": "4.0.3",
|
||||
|
@ -13,8 +13,8 @@
|
||||
"package-lock.json"
|
||||
],
|
||||
"dependencies": {
|
||||
"@fluencelabs/fluence": "^0.27.0",
|
||||
"@fluencelabs/fluence-network-environment": "1.0.13",
|
||||
"@fluencelabs/fluence": "^0.28.0",
|
||||
"@fluencelabs/fluence-network-environment": "1.0.14",
|
||||
"it-all": "^1.0.5"
|
||||
},
|
||||
"scripts": {
|
||||
@ -41,7 +41,7 @@
|
||||
},
|
||||
"homepage": "git+https://github.com/fluencelabs/examples/aqua-examples/price-oracle#readme",
|
||||
"devDependencies": {
|
||||
"@fluencelabs/aqua": "0.8.0-368",
|
||||
"@fluencelabs/aqua": "0.10.3",
|
||||
"@fluencelabs/aqua-lib": "0.6.0",
|
||||
"@types/jest": "^27.0.3",
|
||||
"chokidar-cli": "^3.0.0",
|
||||
|
266
aqua-examples/price-oracle/web/package-lock.json
generated
266
aqua-examples/price-oracle/web/package-lock.json
generated
@ -9,8 +9,8 @@
|
||||
"version": "0.1.0",
|
||||
"hasInstallScript": true,
|
||||
"dependencies": {
|
||||
"@fluencelabs/fluence": "0.27.5",
|
||||
"@fluencelabs/fluence-network-environment": "1.0.13",
|
||||
"@fluencelabs/fluence": "0.28.0",
|
||||
"@fluencelabs/fluence-network-environment": "1.0.14",
|
||||
"@testing-library/jest-dom": "^5.14.1",
|
||||
"@testing-library/react": "^11.2.7",
|
||||
"@testing-library/user-event": "^12.8.3",
|
||||
@ -25,7 +25,7 @@
|
||||
"web-vitals": "^1.1.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@fluencelabs/aqua": "0.8.0-368",
|
||||
"@fluencelabs/aqua": "0.10.3",
|
||||
"@types/jest-environment-puppeteer": "^4.4.1",
|
||||
"@types/puppeteer": "^5.4.4",
|
||||
"@types/serve-handler": "^6.1.1",
|
||||
@ -2116,14 +2116,14 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@fluencelabs/aqua": {
|
||||
"version": "0.8.0-368",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/aqua/-/aqua-0.8.0-368.tgz",
|
||||
"integrity": "sha512-vnqgjwJWa2XvNqGUCITvkhIiF7ps9WhZL4GfvtuSwVAsdpDaYGtxPH63wcYcG9TwRCr7nGgjOhJGXhkmGhUE2w==",
|
||||
"version": "0.10.3",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/aqua/-/aqua-0.10.3.tgz",
|
||||
"integrity": "sha512-v7Jy+KzZkUm7NuUgrp7UQ8gxuhykxuTU3JigCdxiZMcG3/zD+OtHzsSggVLxVjDP7CKuTcjEKZSCxObwHp/Tpw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@fluencelabs/aqua-ipfs": "0.5.8",
|
||||
"@fluencelabs/aqua-ipfs": "0.5.9",
|
||||
"@fluencelabs/aqua-lib": "0.6.0",
|
||||
"@fluencelabs/fluence": "0.27.4",
|
||||
"@fluencelabs/fluence": "0.28.0",
|
||||
"@fluencelabs/fluence-network-environment": "1.0.13",
|
||||
"ipfs-http-client": "50.1.2"
|
||||
},
|
||||
@ -2133,9 +2133,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@fluencelabs/aqua-ipfs": {
|
||||
"version": "0.5.8",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/aqua-ipfs/-/aqua-ipfs-0.5.8.tgz",
|
||||
"integrity": "sha512-jKlyGBm8oJAIQ3Ags58oJ8QVTlCYSvZQVTnX2SnugGXWVwt4+9qtqtvNT5MvWKK3M9lCFDbJJy/qVTjzPJlaiw==",
|
||||
"version": "0.5.9",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/aqua-ipfs/-/aqua-ipfs-0.5.9.tgz",
|
||||
"integrity": "sha512-Vg7pYv4gEreOKfvzKEL5FchGqSKwat7JyKpqJO6h+FC5S1bl76UkI507+ExhijmUbQGznop8G33XFxyUi6q5SQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@fluencelabs/aqua-lib": "^0.5.2"
|
||||
@ -2153,87 +2153,16 @@
|
||||
"integrity": "sha512-ifjtCM93KO3LhzPkMxqmXhwLmrg/scjOiyTihEVg7ns5N+BVzaK1eWzdOdqGdl9ZVoah43pdlQUepEo7VdRmsw==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@fluencelabs/aqua/node_modules/@fluencelabs/fluence": {
|
||||
"version": "0.27.4",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/fluence/-/fluence-0.27.4.tgz",
|
||||
"integrity": "sha512-f85q8ZdmPlUd6uIgmS0CDTvSsb+TGvTqOljw0b161lfEuqPIXrjxJSt0/2Lyh2eEZ1P3slOka1tbVw01nVrt5w==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@fluencelabs/avm": "0.31.10",
|
||||
"@fluencelabs/connection": "0.2.0",
|
||||
"@fluencelabs/interfaces": "0.1.0",
|
||||
"@fluencelabs/keypair": "0.2.0",
|
||||
"@fluencelabs/marine-js": "0.3.37",
|
||||
"async": "3.2.3",
|
||||
"base64-js": "^1.5.1",
|
||||
"browser-or-node": "2.0.0",
|
||||
"bs58": "5.0.0",
|
||||
"buffer": "^6.0.3",
|
||||
"cids": "1.1.9",
|
||||
"loglevel": "1.8.0",
|
||||
"multiformats": "9.6.5",
|
||||
"peer-id": "0.16.0",
|
||||
"platform": "^1.3.6",
|
||||
"rxjs": "^7.5.5",
|
||||
"ts-pattern": "3.3.3",
|
||||
"uuid": "8.3.2"
|
||||
},
|
||||
"bin": {
|
||||
"copy-marine": "dist/tools/copyMarine.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10",
|
||||
"pnpm": ">=3"
|
||||
}
|
||||
},
|
||||
"node_modules/@fluencelabs/aqua/node_modules/libp2p-crypto": {
|
||||
"version": "0.21.2",
|
||||
"resolved": "https://registry.npmjs.org/libp2p-crypto/-/libp2p-crypto-0.21.2.tgz",
|
||||
"integrity": "sha512-EXFrhSpiHtJ+/L8xXDvQNK5VjUMG51u878jzZcaT5XhuN/zFg6PWJFnl/qB2Y2j7eMWnvCRP7Kp+ua2H36cG4g==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@noble/ed25519": "^1.5.1",
|
||||
"@noble/secp256k1": "^1.3.0",
|
||||
"err-code": "^3.0.1",
|
||||
"iso-random-stream": "^2.0.0",
|
||||
"multiformats": "^9.4.5",
|
||||
"node-forge": "^1.2.1",
|
||||
"protobufjs": "^6.11.2",
|
||||
"uint8arrays": "^3.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@fluencelabs/aqua/node_modules/node-forge": {
|
||||
"version": "1.3.1",
|
||||
"resolved": "https://registry.npmjs.org/node-forge/-/node-forge-1.3.1.tgz",
|
||||
"integrity": "sha512-dPEtOeMvF9VMcYV/1Wb8CPoVAXtp6MKMlcbAt4ddqmGqUJ6fQZFXkNZNkNlfevtNkGtaSoXf/vNNNSvgrdXwtA==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">= 6.13.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@fluencelabs/aqua/node_modules/peer-id": {
|
||||
"version": "0.16.0",
|
||||
"resolved": "https://registry.npmjs.org/peer-id/-/peer-id-0.16.0.tgz",
|
||||
"integrity": "sha512-EmL7FurFUduU9m1PS9cfJ5TAuCvxKQ7DKpfx3Yj6IKWyBRtosriFuOag/l3ni/dtPgPLwiA4R9IvpL7hsDLJuQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"class-is": "^1.1.0",
|
||||
"libp2p-crypto": "^0.21.0",
|
||||
"multiformats": "^9.4.5",
|
||||
"protobufjs": "^6.10.2",
|
||||
"uint8arrays": "^3.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=15.0.0"
|
||||
}
|
||||
"node_modules/@fluencelabs/aqua/node_modules/@fluencelabs/fluence-network-environment": {
|
||||
"version": "1.0.13",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/fluence-network-environment/-/fluence-network-environment-1.0.13.tgz",
|
||||
"integrity": "sha512-2pci3T0sUHE08jwEs1r/vHKVT4XUh/A3j/QJ0eIhddsxyIjEksjdn05X7DF6STD14CF8GgBVOJEPgav8qaUMpA==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@fluencelabs/avm": {
|
||||
"version": "0.31.10",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/avm/-/avm-0.31.10.tgz",
|
||||
"integrity": "sha512-tkpjdHyRmsTwAEZCJt15//jXEgC2Nw2qFiD1NenvK127SlgKeuzQU9IMReUYY3dowb2IGeC578/uGMu96jHYKw=="
|
||||
"version": "0.35.3",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/avm/-/avm-0.35.3.tgz",
|
||||
"integrity": "sha512-Y5mPPCmAUUKc5CDO12IL8mGEreWa7maVdX0MWCAH4+GvfLPFN1FxOMSKRYEtvkyVEL88pc9pd8cm5IRCBkFthg=="
|
||||
},
|
||||
"node_modules/@fluencelabs/connection": {
|
||||
"version": "0.2.0",
|
||||
@ -2301,11 +2230,11 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@fluencelabs/fluence": {
|
||||
"version": "0.27.5",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/fluence/-/fluence-0.27.5.tgz",
|
||||
"integrity": "sha512-nMCzd/oHHk5/yWdg/+rPB+sc8X+fQ5YgwPhGVDoxFs8/CmIr1G5Na8Y6l8rrigasgQd+LV5GtAyh50Oq7/IXkg==",
|
||||
"version": "0.28.0",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/fluence/-/fluence-0.28.0.tgz",
|
||||
"integrity": "sha512-SXb2vjTj8m/nw4jEILV0tu9VIFprGo8mNb2nOB5btxdsOI8GzQZkpGzTLrSd/+UagIo2GdxAu0GhBP8dxZXaqg==",
|
||||
"dependencies": {
|
||||
"@fluencelabs/avm": "0.31.10",
|
||||
"@fluencelabs/avm": "0.35.3",
|
||||
"@fluencelabs/connection": "0.2.0",
|
||||
"@fluencelabs/interfaces": "0.1.0",
|
||||
"@fluencelabs/keypair": "0.2.0",
|
||||
@ -2333,14 +2262,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@fluencelabs/fluence-network-environment": {
|
||||
"version": "1.0.13",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/fluence-network-environment/-/fluence-network-environment-1.0.13.tgz",
|
||||
"integrity": "sha512-2pci3T0sUHE08jwEs1r/vHKVT4XUh/A3j/QJ0eIhddsxyIjEksjdn05X7DF6STD14CF8GgBVOJEPgav8qaUMpA=="
|
||||
},
|
||||
"node_modules/@fluencelabs/fluence/node_modules/async": {
|
||||
"version": "3.2.4",
|
||||
"resolved": "https://registry.npmjs.org/async/-/async-3.2.4.tgz",
|
||||
"integrity": "sha512-iAB+JbDEGXhyIUavoDl9WP/Jj106Kz9DEn1DPgYw5ruDn0e3Wgi3sKFm55sASdGBNOQB8F59d9qQ7deqrHA8wQ=="
|
||||
"version": "1.0.14",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/fluence-network-environment/-/fluence-network-environment-1.0.14.tgz",
|
||||
"integrity": "sha512-lMiH+7obmJW2Q+PMUR/vNAuX6TcVqlKmsWAHvnBogH7s8IeMT+UGN8qrweILWmE57G7MfauB302dIFQowR9tug=="
|
||||
},
|
||||
"node_modules/@fluencelabs/fluence/node_modules/libp2p-crypto": {
|
||||
"version": "0.21.2",
|
||||
@ -2372,11 +2296,6 @@
|
||||
"url": "https://tidelift.com/funding/github/npm/loglevel"
|
||||
}
|
||||
},
|
||||
"node_modules/@fluencelabs/fluence/node_modules/multiformats": {
|
||||
"version": "9.9.0",
|
||||
"resolved": "https://registry.npmjs.org/multiformats/-/multiformats-9.9.0.tgz",
|
||||
"integrity": "sha512-HoMUjhH9T8DDBNT+6xzkrd9ga/XiBI4xLr58LJACwK6G3HTOPeMz4nB4KJs33L2BelrIJa7P0VuNaVF3hMYfjg=="
|
||||
},
|
||||
"node_modules/@fluencelabs/fluence/node_modules/node-forge": {
|
||||
"version": "1.3.1",
|
||||
"resolved": "https://registry.npmjs.org/node-forge/-/node-forge-1.3.1.tgz",
|
||||
@ -5179,9 +5098,9 @@
|
||||
"integrity": "sha1-9wtzXGvKGlycItmCw+Oef+ujva0="
|
||||
},
|
||||
"node_modules/async": {
|
||||
"version": "3.2.3",
|
||||
"resolved": "https://registry.npmjs.org/async/-/async-3.2.3.tgz",
|
||||
"integrity": "sha512-spZRyzKL5l5BZQrr/6m/SqFdBN0q3OCI0f9rjfBzCMBIP4p75P620rR3gTmaksNOhmzgdxcaxdNfMy6anrbM0g=="
|
||||
"version": "3.2.4",
|
||||
"resolved": "https://registry.npmjs.org/async/-/async-3.2.4.tgz",
|
||||
"integrity": "sha512-iAB+JbDEGXhyIUavoDl9WP/Jj106Kz9DEn1DPgYw5ruDn0e3Wgi3sKFm55sASdGBNOQB8F59d9qQ7deqrHA8wQ=="
|
||||
},
|
||||
"node_modules/async-foreach": {
|
||||
"version": "0.1.3",
|
||||
@ -14240,9 +14159,9 @@
|
||||
"integrity": "sha512-cXEIW6cfr15lFv563k4GuVuW/fiwjknytD37jIOLSdSWuOI6WnO/oKwmP2FQTU2l01LP8/M5TSAJpzUaGe3uWg=="
|
||||
},
|
||||
"node_modules/multiformats": {
|
||||
"version": "9.6.5",
|
||||
"resolved": "https://registry.npmjs.org/multiformats/-/multiformats-9.6.5.tgz",
|
||||
"integrity": "sha512-vMwf/FUO+qAPvl3vlSZEgEVFY/AxeZq5yg761ScF3CZsXgmTi/HGkicUiNN0CI4PW8FiY2P0OLklOcmQjdQJhw=="
|
||||
"version": "9.9.0",
|
||||
"resolved": "https://registry.npmjs.org/multiformats/-/multiformats-9.9.0.tgz",
|
||||
"integrity": "sha512-HoMUjhH9T8DDBNT+6xzkrd9ga/XiBI4xLr58LJACwK6G3HTOPeMz4nB4KJs33L2BelrIJa7P0VuNaVF3hMYfjg=="
|
||||
},
|
||||
"node_modules/multihashes": {
|
||||
"version": "4.0.3",
|
||||
@ -22600,14 +22519,14 @@
|
||||
}
|
||||
},
|
||||
"@fluencelabs/aqua": {
|
||||
"version": "0.8.0-368",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/aqua/-/aqua-0.8.0-368.tgz",
|
||||
"integrity": "sha512-vnqgjwJWa2XvNqGUCITvkhIiF7ps9WhZL4GfvtuSwVAsdpDaYGtxPH63wcYcG9TwRCr7nGgjOhJGXhkmGhUE2w==",
|
||||
"version": "0.10.3",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/aqua/-/aqua-0.10.3.tgz",
|
||||
"integrity": "sha512-v7Jy+KzZkUm7NuUgrp7UQ8gxuhykxuTU3JigCdxiZMcG3/zD+OtHzsSggVLxVjDP7CKuTcjEKZSCxObwHp/Tpw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@fluencelabs/aqua-ipfs": "0.5.8",
|
||||
"@fluencelabs/aqua-ipfs": "0.5.9",
|
||||
"@fluencelabs/aqua-lib": "0.6.0",
|
||||
"@fluencelabs/fluence": "0.27.4",
|
||||
"@fluencelabs/fluence": "0.28.0",
|
||||
"@fluencelabs/fluence-network-environment": "1.0.13",
|
||||
"ipfs-http-client": "50.1.2"
|
||||
},
|
||||
@ -22618,73 +22537,18 @@
|
||||
"integrity": "sha512-ifjtCM93KO3LhzPkMxqmXhwLmrg/scjOiyTihEVg7ns5N+BVzaK1eWzdOdqGdl9ZVoah43pdlQUepEo7VdRmsw==",
|
||||
"dev": true
|
||||
},
|
||||
"@fluencelabs/fluence": {
|
||||
"version": "0.27.4",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/fluence/-/fluence-0.27.4.tgz",
|
||||
"integrity": "sha512-f85q8ZdmPlUd6uIgmS0CDTvSsb+TGvTqOljw0b161lfEuqPIXrjxJSt0/2Lyh2eEZ1P3slOka1tbVw01nVrt5w==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@fluencelabs/avm": "0.31.10",
|
||||
"@fluencelabs/connection": "0.2.0",
|
||||
"@fluencelabs/interfaces": "0.1.0",
|
||||
"@fluencelabs/keypair": "0.2.0",
|
||||
"@fluencelabs/marine-js": "0.3.37",
|
||||
"async": "3.2.3",
|
||||
"base64-js": "^1.5.1",
|
||||
"browser-or-node": "2.0.0",
|
||||
"bs58": "5.0.0",
|
||||
"buffer": "^6.0.3",
|
||||
"cids": "1.1.9",
|
||||
"loglevel": "1.8.0",
|
||||
"multiformats": "9.6.5",
|
||||
"peer-id": "0.16.0",
|
||||
"platform": "^1.3.6",
|
||||
"rxjs": "^7.5.5",
|
||||
"ts-pattern": "3.3.3",
|
||||
"uuid": "8.3.2"
|
||||
}
|
||||
},
|
||||
"libp2p-crypto": {
|
||||
"version": "0.21.2",
|
||||
"resolved": "https://registry.npmjs.org/libp2p-crypto/-/libp2p-crypto-0.21.2.tgz",
|
||||
"integrity": "sha512-EXFrhSpiHtJ+/L8xXDvQNK5VjUMG51u878jzZcaT5XhuN/zFg6PWJFnl/qB2Y2j7eMWnvCRP7Kp+ua2H36cG4g==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@noble/ed25519": "^1.5.1",
|
||||
"@noble/secp256k1": "^1.3.0",
|
||||
"err-code": "^3.0.1",
|
||||
"iso-random-stream": "^2.0.0",
|
||||
"multiformats": "^9.4.5",
|
||||
"node-forge": "^1.2.1",
|
||||
"protobufjs": "^6.11.2",
|
||||
"uint8arrays": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"node-forge": {
|
||||
"version": "1.3.1",
|
||||
"resolved": "https://registry.npmjs.org/node-forge/-/node-forge-1.3.1.tgz",
|
||||
"integrity": "sha512-dPEtOeMvF9VMcYV/1Wb8CPoVAXtp6MKMlcbAt4ddqmGqUJ6fQZFXkNZNkNlfevtNkGtaSoXf/vNNNSvgrdXwtA==",
|
||||
"@fluencelabs/fluence-network-environment": {
|
||||
"version": "1.0.13",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/fluence-network-environment/-/fluence-network-environment-1.0.13.tgz",
|
||||
"integrity": "sha512-2pci3T0sUHE08jwEs1r/vHKVT4XUh/A3j/QJ0eIhddsxyIjEksjdn05X7DF6STD14CF8GgBVOJEPgav8qaUMpA==",
|
||||
"dev": true
|
||||
},
|
||||
"peer-id": {
|
||||
"version": "0.16.0",
|
||||
"resolved": "https://registry.npmjs.org/peer-id/-/peer-id-0.16.0.tgz",
|
||||
"integrity": "sha512-EmL7FurFUduU9m1PS9cfJ5TAuCvxKQ7DKpfx3Yj6IKWyBRtosriFuOag/l3ni/dtPgPLwiA4R9IvpL7hsDLJuQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"class-is": "^1.1.0",
|
||||
"libp2p-crypto": "^0.21.0",
|
||||
"multiformats": "^9.4.5",
|
||||
"protobufjs": "^6.10.2",
|
||||
"uint8arrays": "^3.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"@fluencelabs/aqua-ipfs": {
|
||||
"version": "0.5.8",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/aqua-ipfs/-/aqua-ipfs-0.5.8.tgz",
|
||||
"integrity": "sha512-jKlyGBm8oJAIQ3Ags58oJ8QVTlCYSvZQVTnX2SnugGXWVwt4+9qtqtvNT5MvWKK3M9lCFDbJJy/qVTjzPJlaiw==",
|
||||
"version": "0.5.9",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/aqua-ipfs/-/aqua-ipfs-0.5.9.tgz",
|
||||
"integrity": "sha512-Vg7pYv4gEreOKfvzKEL5FchGqSKwat7JyKpqJO6h+FC5S1bl76UkI507+ExhijmUbQGznop8G33XFxyUi6q5SQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@fluencelabs/aqua-lib": "^0.5.2"
|
||||
@ -22697,9 +22561,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"@fluencelabs/avm": {
|
||||
"version": "0.31.10",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/avm/-/avm-0.31.10.tgz",
|
||||
"integrity": "sha512-tkpjdHyRmsTwAEZCJt15//jXEgC2Nw2qFiD1NenvK127SlgKeuzQU9IMReUYY3dowb2IGeC578/uGMu96jHYKw=="
|
||||
"version": "0.35.3",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/avm/-/avm-0.35.3.tgz",
|
||||
"integrity": "sha512-Y5mPPCmAUUKc5CDO12IL8mGEreWa7maVdX0MWCAH4+GvfLPFN1FxOMSKRYEtvkyVEL88pc9pd8cm5IRCBkFthg=="
|
||||
},
|
||||
"@fluencelabs/connection": {
|
||||
"version": "0.2.0",
|
||||
@ -22756,11 +22620,11 @@
|
||||
}
|
||||
},
|
||||
"@fluencelabs/fluence": {
|
||||
"version": "0.27.5",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/fluence/-/fluence-0.27.5.tgz",
|
||||
"integrity": "sha512-nMCzd/oHHk5/yWdg/+rPB+sc8X+fQ5YgwPhGVDoxFs8/CmIr1G5Na8Y6l8rrigasgQd+LV5GtAyh50Oq7/IXkg==",
|
||||
"version": "0.28.0",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/fluence/-/fluence-0.28.0.tgz",
|
||||
"integrity": "sha512-SXb2vjTj8m/nw4jEILV0tu9VIFprGo8mNb2nOB5btxdsOI8GzQZkpGzTLrSd/+UagIo2GdxAu0GhBP8dxZXaqg==",
|
||||
"requires": {
|
||||
"@fluencelabs/avm": "0.31.10",
|
||||
"@fluencelabs/avm": "0.35.3",
|
||||
"@fluencelabs/connection": "0.2.0",
|
||||
"@fluencelabs/interfaces": "0.1.0",
|
||||
"@fluencelabs/keypair": "0.2.0",
|
||||
@ -22780,11 +22644,6 @@
|
||||
"uuid": "8.3.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"async": {
|
||||
"version": "3.2.4",
|
||||
"resolved": "https://registry.npmjs.org/async/-/async-3.2.4.tgz",
|
||||
"integrity": "sha512-iAB+JbDEGXhyIUavoDl9WP/Jj106Kz9DEn1DPgYw5ruDn0e3Wgi3sKFm55sASdGBNOQB8F59d9qQ7deqrHA8wQ=="
|
||||
},
|
||||
"libp2p-crypto": {
|
||||
"version": "0.21.2",
|
||||
"resolved": "https://registry.npmjs.org/libp2p-crypto/-/libp2p-crypto-0.21.2.tgz",
|
||||
@ -22805,11 +22664,6 @@
|
||||
"resolved": "https://registry.npmjs.org/loglevel/-/loglevel-1.8.1.tgz",
|
||||
"integrity": "sha512-tCRIJM51SHjAayKwC+QAg8hT8vg6z7GSgLJKGvzuPb1Wc+hLzqtuVLxp6/HzSPOozuK+8ErAhy7U/sVzw8Dgfg=="
|
||||
},
|
||||
"multiformats": {
|
||||
"version": "9.9.0",
|
||||
"resolved": "https://registry.npmjs.org/multiformats/-/multiformats-9.9.0.tgz",
|
||||
"integrity": "sha512-HoMUjhH9T8DDBNT+6xzkrd9ga/XiBI4xLr58LJACwK6G3HTOPeMz4nB4KJs33L2BelrIJa7P0VuNaVF3hMYfjg=="
|
||||
},
|
||||
"node-forge": {
|
||||
"version": "1.3.1",
|
||||
"resolved": "https://registry.npmjs.org/node-forge/-/node-forge-1.3.1.tgz",
|
||||
@ -22830,9 +22684,9 @@
|
||||
}
|
||||
},
|
||||
"@fluencelabs/fluence-network-environment": {
|
||||
"version": "1.0.13",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/fluence-network-environment/-/fluence-network-environment-1.0.13.tgz",
|
||||
"integrity": "sha512-2pci3T0sUHE08jwEs1r/vHKVT4XUh/A3j/QJ0eIhddsxyIjEksjdn05X7DF6STD14CF8GgBVOJEPgav8qaUMpA=="
|
||||
"version": "1.0.14",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/fluence-network-environment/-/fluence-network-environment-1.0.14.tgz",
|
||||
"integrity": "sha512-lMiH+7obmJW2Q+PMUR/vNAuX6TcVqlKmsWAHvnBogH7s8IeMT+UGN8qrweILWmE57G7MfauB302dIFQowR9tug=="
|
||||
},
|
||||
"@fluencelabs/interfaces": {
|
||||
"version": "0.1.0",
|
||||
@ -25043,9 +24897,9 @@
|
||||
"integrity": "sha1-9wtzXGvKGlycItmCw+Oef+ujva0="
|
||||
},
|
||||
"async": {
|
||||
"version": "3.2.3",
|
||||
"resolved": "https://registry.npmjs.org/async/-/async-3.2.3.tgz",
|
||||
"integrity": "sha512-spZRyzKL5l5BZQrr/6m/SqFdBN0q3OCI0f9rjfBzCMBIP4p75P620rR3gTmaksNOhmzgdxcaxdNfMy6anrbM0g=="
|
||||
"version": "3.2.4",
|
||||
"resolved": "https://registry.npmjs.org/async/-/async-3.2.4.tgz",
|
||||
"integrity": "sha512-iAB+JbDEGXhyIUavoDl9WP/Jj106Kz9DEn1DPgYw5ruDn0e3Wgi3sKFm55sASdGBNOQB8F59d9qQ7deqrHA8wQ=="
|
||||
},
|
||||
"async-foreach": {
|
||||
"version": "0.1.3",
|
||||
@ -32137,9 +31991,9 @@
|
||||
}
|
||||
},
|
||||
"multiformats": {
|
||||
"version": "9.6.5",
|
||||
"resolved": "https://registry.npmjs.org/multiformats/-/multiformats-9.6.5.tgz",
|
||||
"integrity": "sha512-vMwf/FUO+qAPvl3vlSZEgEVFY/AxeZq5yg761ScF3CZsXgmTi/HGkicUiNN0CI4PW8FiY2P0OLklOcmQjdQJhw=="
|
||||
"version": "9.9.0",
|
||||
"resolved": "https://registry.npmjs.org/multiformats/-/multiformats-9.9.0.tgz",
|
||||
"integrity": "sha512-HoMUjhH9T8DDBNT+6xzkrd9ga/XiBI4xLr58LJACwK6G3HTOPeMz4nB4KJs33L2BelrIJa7P0VuNaVF3hMYfjg=="
|
||||
},
|
||||
"multihashes": {
|
||||
"version": "4.0.3",
|
||||
|
@ -3,8 +3,8 @@
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@fluencelabs/fluence": "0.27.5",
|
||||
"@fluencelabs/fluence-network-environment": "1.0.13",
|
||||
"@fluencelabs/fluence": "0.28.0",
|
||||
"@fluencelabs/fluence-network-environment": "1.0.14",
|
||||
"@testing-library/jest-dom": "^5.14.1",
|
||||
"@testing-library/react": "^11.2.7",
|
||||
"@testing-library/user-event": "^12.8.3",
|
||||
@ -52,7 +52,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/serve-handler": "^6.1.1",
|
||||
"@fluencelabs/aqua": "0.8.0-368",
|
||||
"@fluencelabs/aqua": "0.10.3",
|
||||
"@types/jest-environment-puppeteer": "^4.4.1",
|
||||
"@types/puppeteer": "^5.4.4",
|
||||
"chokidar-cli": "^2.1.0",
|
||||
|
@ -15,7 +15,7 @@ marine-rs-sdk = { version = "0.7.1", features = ["logger"] }
|
||||
log = "0.4.14"
|
||||
|
||||
[dev-dependencies]
|
||||
marine-rs-sdk-test = "0.8.1"
|
||||
marine-rs-sdk-test = "0.8.2"
|
||||
|
||||
[dev]
|
||||
[profile.release]
|
||||
|
568
aqua-examples/vrfun/Cargo.lock
generated
568
aqua-examples/vrfun/Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@ -17,7 +17,7 @@ ecvrf = "0.4.3"
|
||||
zeroize = "1.5.7"
|
||||
|
||||
[dev-dependencies]
|
||||
marine-rs-sdk-test = "0.8.1"
|
||||
marine-rs-sdk-test = "0.8.2"
|
||||
|
||||
[dev]
|
||||
[profile.release]
|
||||
|
@ -15,7 +15,7 @@ marine-rs-sdk = { version = "0.7.1", features = ["logger"] }
|
||||
log = "0.4.14"
|
||||
|
||||
[dev-dependencies]
|
||||
marine-rs-sdk-test = "0.8.1"
|
||||
marine-rs-sdk-test = "0.8.2"
|
||||
|
||||
[dev]
|
||||
[profile.release]
|
||||
|
@ -15,7 +15,7 @@ marine-rs-sdk = { version = "0.7.1", features = ["logger"] }
|
||||
log = "0.4.14"
|
||||
|
||||
[dev-dependencies]
|
||||
marine-rs-sdk-test = "0.8.1"
|
||||
marine-rs-sdk-test = "0.8.2"
|
||||
|
||||
[dev]
|
||||
[profile.release]
|
||||
|
@ -14,7 +14,7 @@ marine-rs-sdk = { version = "0.7.1", features = ["logger"] }
|
||||
log = "0.4.14"
|
||||
|
||||
[dev-dependencies]
|
||||
marine-rs-sdk-test = "0.8.1"
|
||||
marine-rs-sdk-test = "0.8.2"
|
||||
|
||||
[dev]
|
||||
[profile.release]
|
||||
|
@ -12,7 +12,7 @@ Community members have been coding incredible peer-ro-pper applications and solu
|
||||
* [Web3](https://github.com/ntrotner/web3-exposed-to-fluence) is a Fluence and Aqua wrapper around [web3js](https://github.com/ChainSafe/web3.js), the "original" Ethereum SDK, for use with Aqua. See[documentation](https://github.com/ntrotner/web3-exposed-to-fluence/tree/main/src/aqua/doc) for detailed documentation and [tests](https://github.com/ntrotner/web3-exposed-to-fluence/tree/main/tests) for examples.
|
||||
* Uses Fluence JS
|
||||
|
||||
* [Ethereum and Elasticsearch](https://github.com/Joera/gitcoin11-fluence) is a project aiming to use Wasm for a variety of uses in Web3 ecosystem using Fluence and Aqua possibly in response to DAO directives. THe project is WIP but chockfull of great examples on how to use Fluence and Aqua in a larger Web3 project.
|
||||
* [Ethereum and Elasticsearch](https://github.com/Joera/Public-Record-DAO) is a project aiming to use Wasm for a variety of uses in Web3 ecosystem using Fluence and Aqua possibly in response to DAO directives. THe project is WIP but chockfull of great examples on how to use Fluence and Aqua in a larger Web3 project.
|
||||
* Uses Marine Wasm
|
||||
|
||||
* [Fluence Tronweb](https://github.com/visdauas/fluence-tronweb) is a wrapper around [TronWeb](https://github.com/tronprotocol/tronweb) -- a Javascript library for the [Tron network](https://tron.network/). Not only a great way to use Aqua to interact with all things Tron but laos a great starting point to build your own SDK wrapper.
|
||||
|
@ -1,147 +0,0 @@
|
||||
# Getting Started with Fluence
|
||||
|
||||
This sample project demonstrates how fluence network can be accessed from the browser. As an example it retrieves the timestamp of the current time from the relay node. The project is based on an create-react-app template with slight modifications to integrate Fluence. The primary focus is the integration itself, i.e React could be swapped with a framework of your choice.
|
||||
|
||||
## Getting started
|
||||
|
||||
Run aqua compiler in watch mode:
|
||||
|
||||
```bash
|
||||
npm run watch-aqua
|
||||
```
|
||||
|
||||
Start the application
|
||||
|
||||
```bash
|
||||
npm start
|
||||
```
|
||||
|
||||
The browser window with `localhost:3000` should open
|
||||
|
||||
## How it works
|
||||
|
||||
The application can be split into two main building blocks: the runtime provided by the `@fluencelabs/fluence` package and the compiler for the `Aqua` language. The workflow is as follows:
|
||||
|
||||
1. You write aqua code
|
||||
2. Aqua gets compiled into the typescript file
|
||||
3. The typescript is build by the webpack (or any other tool of you choice) into js bunlde.
|
||||
|
||||
## Project structure
|
||||
|
||||
```
|
||||
aqua (1)
|
||||
┗ getting-started.aqua (3)
|
||||
node_modules
|
||||
public
|
||||
src
|
||||
┣ _aqua (2)
|
||||
┃ ┗ getting-started.ts (4)
|
||||
┣ App.scss
|
||||
┣ App.tsx
|
||||
┣ index.css
|
||||
┣ index.tsx
|
||||
┣ logo.svg
|
||||
┗ react-app-env.d.ts
|
||||
package-lock.json
|
||||
package.json
|
||||
tsconfig.json
|
||||
```
|
||||
|
||||
The project structure is based on the create-react-app template with some minor differences:
|
||||
|
||||
* `aqua` (1) contains the Aqua source code files. The complier picks them up and generate corresponding typescript file. See `getting-started.aqua` (3) and `getting-started.ts` respectively
|
||||
* `src/_aqua` (2) is where the generated target files are places. The target directory is conveniently placed inside the sources directory which makes it easy to import typescript functions from the application source code
|
||||
|
||||
## npm packages and scripts
|
||||
|
||||
The following npm packages are used:
|
||||
|
||||
* `@fluencelabs/fluence` - is the client for Fluence Network running inside the browser. See https://github.com/fluencelabs/fluence-js for additional information
|
||||
* `@fluencelabs/fluence-network-environment` - is the maintained list of Fluence networks and nodes to connect to.
|
||||
* `@fluencelabs/aqua` - is the command line interface for Aqua compiler. See https://github.com/fluencelabs/aqua for more information
|
||||
* `@fluencelabs/aqua-lib` - Aqua language standard library
|
||||
* `chokidar-cli` - A tool to watch for aqua file changes and compile them on the fly
|
||||
|
||||
The compilation of aqua code is implemented with these scripts:
|
||||
|
||||
```
|
||||
scripts: {
|
||||
...
|
||||
"compile-aqua": "aqua -i ./aqua/ -o ./src/_aqua",
|
||||
"watch-aqua": "chokidar \"**/*.aqua\" -c \"npm run compile-aqua\""
|
||||
}
|
||||
...
|
||||
```
|
||||
|
||||
The interface is pretty straightforward: you just specify the input and output directories for the compiler.
|
||||
|
||||
## Aqua code
|
||||
|
||||
```
|
||||
import "@fluencelabs/aqua-lib/builtin.aqua"
|
||||
|
||||
func getRelayTime(relayPeerId: PeerId) -> u64: (1)
|
||||
on relayPeerId: (2)
|
||||
ts <- Peer.timestamp_ms() (3)
|
||||
<- ts (4)
|
||||
|
||||
```
|
||||
|
||||
The code above defines a function which retrieves the current timestamp from the relay node. The function works as following:
|
||||
|
||||
1. The function definition, specifying arguments and return value types
|
||||
2. Shift the execution to the peer with id equal to `relayPeerId`
|
||||
3. Calls built-in function on the current peer and stores the result into a variable
|
||||
4. Returns the result
|
||||
|
||||
The function gets compiled into typescript and can be called from the application code (see next section)
|
||||
|
||||
## Application code
|
||||
|
||||
Let's take a look at how we can use Fluence from typecript.
|
||||
|
||||
First, we need to import the relevant packages:
|
||||
|
||||
```typescript
|
||||
import { createClient, FluenceClient } from "@fluencelabs/fluence";
|
||||
import { krasnodar } from "@fluencelabs/fluence-network-environment";
|
||||
import { getRelayTime } from "./_aqua/getting-started";
|
||||
```
|
||||
|
||||
Please notice that the function defined in Aqua has been compiled into typescript and can be directly imported. Using the code generated by the compiler is as easy as calling a function. The compiler generates all the boilerplate needed to send a particle into the network and wraps it into a single call. Note that all the type information and therefore type checking and code completion facilities are there!
|
||||
|
||||
Next we initialize the client:
|
||||
|
||||
```typescript
|
||||
const relayNode = krasnodar[0];
|
||||
|
||||
function App() {
|
||||
const [client, setClient] = useState<FluenceClient | null>(null);
|
||||
|
||||
...
|
||||
|
||||
useEffect(() => {
|
||||
createClient(relayNode)
|
||||
.then((client) => setClient(client))
|
||||
.catch((err) => console.log("Client initialization failed", err));
|
||||
}, [client]);
|
||||
```
|
||||
|
||||
Every peer running in the browser must connect to the network through a relay node. We use the first node of the krasnodar network there. In our example we store the client using React `useState` facilities. Feel free to store wherever you store other application state.
|
||||
|
||||
Executing Aqua is as easy as calling a function in typesctipt:
|
||||
|
||||
```typescript
|
||||
const doGetRelayTime = async () => {
|
||||
if (!client) {
|
||||
return;
|
||||
}
|
||||
|
||||
const time = await getRelayTime(client, relayNode.peerId);
|
||||
setRelayTime(new Date(time));
|
||||
};
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
@ -1,52 +0,0 @@
|
||||
import React, { useEffect, useState } from "react";
|
||||
import logo from "./logo.svg";
|
||||
import "./App.scss";
|
||||
|
||||
import { Fluence } from "@fluencelabs/fluence";
|
||||
import { krasnodar } from "@fluencelabs/fluence-network-environment";
|
||||
import { getRelayTime } from "./_aqua/getting-started";
|
||||
|
||||
const relayNode = krasnodar[0];
|
||||
|
||||
function App() {
|
||||
const [relayTime, setRelayTime] = useState<Date | null>(null);
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
Fluence.start({ connectTo: relayNode })
|
||||
.catch((err) => console.log("Client initialization failed", err));
|
||||
}, []);
|
||||
|
||||
const onGetRelayTimeBtnClick = async () => {
|
||||
if (!Fluence.getStatus().isConnected) {
|
||||
return;
|
||||
}
|
||||
|
||||
const time = await getRelayTime(relayNode.peerId);
|
||||
setRelayTime(new Date(time));
|
||||
};
|
||||
|
||||
|
||||
return (
|
||||
<div className="App">
|
||||
<header>
|
||||
<img src={logo} className="logo" alt="logo" />
|
||||
</header>
|
||||
|
||||
<div className="content">
|
||||
<h1>Status: <span id="status">{Fluence.getStatus().isConnected ? "Connected" : "Disconnected"}</span></h1>
|
||||
<button id="btn" className="btn" onClick={onGetRelayTimeBtnClick}>
|
||||
Get relay time
|
||||
</button>
|
||||
{relayTime && (
|
||||
<>
|
||||
<h2>Relay time:</h2>
|
||||
<div id="relayTime">{relayTime?.toLocaleString() || ""}</div>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default App;
|
@ -1,12 +0,0 @@
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import './index.css';
|
||||
import App from './App';
|
||||
|
||||
ReactDOM.render(
|
||||
<React.StrictMode>
|
||||
<App />
|
||||
</React.StrictMode>,
|
||||
document.getElementById('root')
|
||||
);
|
||||
|
@ -1,5 +0,0 @@
|
||||
module.exports = {
|
||||
preset: 'ts-jest',
|
||||
testEnvironment: 'node',
|
||||
testPathIgnorePatterns: ['dist'],
|
||||
};
|
13603
fluence-js-examples/hello-world/package-lock.json
generated
13603
fluence-js-examples/hello-world/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -1,31 +0,0 @@
|
||||
{
|
||||
"name": "hello-world",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"prestart": "npm run compile-aqua",
|
||||
"prebuild": "npm run compile-aqua",
|
||||
"start": "node -r ts-node/register src/index.ts",
|
||||
"build": "tsc",
|
||||
"test": "jest",
|
||||
"compile-aqua": "aqua --import . -i ./aqua/ -o ./src/_aqua",
|
||||
"watch-aqua": "chokidar \"**/*.aqua\" -c \"npm run compile-aqua\""
|
||||
},
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"devDependencies": {
|
||||
"@fluencelabs/aqua": "0.8.0-368",
|
||||
"@fluencelabs/aqua-lib": "0.6.0",
|
||||
"chokidar-cli": "^3.0.0",
|
||||
"ts-node": "^10.6.0",
|
||||
"typescript": "^4.6.3",
|
||||
"@types/jest": "^27.0.3",
|
||||
"jest": "^27.4.0",
|
||||
"ts-jest": "^27.0.7"
|
||||
},
|
||||
"dependencies": {
|
||||
"@fluencelabs/fluence": "^0.27.0",
|
||||
"@fluencelabs/fluence-network-environment": "^1.0.13"
|
||||
}
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
import { main } from './main';
|
||||
|
||||
main();
|
@ -1,25 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"lib": [
|
||||
"es2015",
|
||||
"dom"
|
||||
],
|
||||
"outDir": "./dist/",
|
||||
"target": "es5",
|
||||
"module": "commonjs",
|
||||
"strict": true,
|
||||
"esModuleInterop": true,
|
||||
"skipLibCheck": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"declaration": true,
|
||||
"declarationMap": false,
|
||||
"sourceMap": true,
|
||||
},
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
"dist"
|
||||
],
|
||||
"include": [
|
||||
"src"
|
||||
],
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
module.exports = {
|
||||
preset: 'ts-jest',
|
||||
testEnvironment: 'node',
|
||||
testPathIgnorePatterns: ['dist'],
|
||||
};
|
13602
fluence-js-examples/node-example/package-lock.json
generated
13602
fluence-js-examples/node-example/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -1,30 +0,0 @@
|
||||
{
|
||||
"name": "node-example",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"prestart": "npm run compile-aqua",
|
||||
"prebuild": "npm run compile-aqua",
|
||||
"start": "node -r ts-node/register src/index.ts",
|
||||
"test": "jest",
|
||||
"build": "tsc",
|
||||
"compile-aqua": "aqua --import . -i ./aqua/ -o ./src/_aqua",
|
||||
"watch-aqua": "chokidar \"**/*.aqua\" -c \"npm run compile-aqua\""
|
||||
},
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"devDependencies": {
|
||||
"@fluencelabs/aqua": "0.8.0-368",
|
||||
"@types/jest": "^27.0.3",
|
||||
"chokidar-cli": "^3.0.0",
|
||||
"jest": "^27.4.0",
|
||||
"ts-jest": "^27.0.7",
|
||||
"ts-node": "^10.7.0",
|
||||
"typescript": "^4.6.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@fluencelabs/fluence": "^0.27.0",
|
||||
"@fluencelabs/fluence-network-environment": "^1.0.13"
|
||||
}
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
#! /bin/bash
|
||||
|
||||
npx aqua run --input ./aqua/demo-calculation.aqua --func 'demoCalculation()' --addr /dns4/stage.fluence.dev/tcp/19001/wss/p2p/12D3KooWHCJbJKGDfCgHSoCuK9q4STyRnVveqLoXAPBbXHTZx9Cv
|
@ -1,3 +0,0 @@
|
||||
import { runServer, waitForKeypressAndStop } from './main';
|
||||
|
||||
runServer().then(waitForKeypressAndStop);
|
@ -1,25 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"lib": [
|
||||
"es2015",
|
||||
"dom"
|
||||
],
|
||||
"outDir": "./dist/",
|
||||
"target": "es5",
|
||||
"module": "commonjs",
|
||||
"strict": true,
|
||||
"esModuleInterop": true,
|
||||
"skipLibCheck": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"declaration": true,
|
||||
"declarationMap": false,
|
||||
"sourceMap": true,
|
||||
},
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
"dist"
|
||||
],
|
||||
"include": [
|
||||
"src"
|
||||
],
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user