Compare commits

...

28 Commits

Author SHA1 Message Date
Anatolios Laskaris
b6054cc05b
chore: Update renovate (#169)
* Do not update in nox-distro

* Update renovate
2024-09-04 21:08:36 +03:00
fluencebot
459320d224
chore(master): release aqua-ipfs 0.6.0 (#168)
* chore(master): release aqua-ipfs 0.6.0

* chore: Bump aqua-ipfs version to 0.6.0
2024-02-22 13:29:39 +01:00
Maria Kuklina
e3e89cf4d0
feat!: Support CallParameters and Particle Vault File Format (#165)
* Support the new CallParameters and the new Safe Particle Vault file format
2024-02-22 12:45:27 +01:00
fluencebot
a1781d36cf
chore(master): release aqua-ipfs 0.5.31 (#167)
* chore(master): release aqua-ipfs 0.5.31

* chore: Bump aqua-ipfs version to 0.5.31
2024-02-21 18:36:24 +00:00
Maria Kuklina
41fbc08d11
fix(aqua-lib): update aqua-lib (#166) 2024-02-21 18:06:38 +00:00
fluencebot
cdaefbe536
chore(master): release aqua-ipfs 0.5.30 (#160)
* chore(master): release aqua-ipfs 0.5.30

* chore: Bump aqua-ipfs version to 0.5.30
2024-01-11 10:58:34 +01:00
InversionSpaces
32238f18c2
fix(aqua-ipfs): Update example (#159)
* Use aqua keyword, use FCLI

* Add new line

* Use js-client

* Fix index.ts

* Fix compile

* Remove any

* Use helia, update addr

* Return to ipfs-http-client

* Update README

* Use js-kubo-rpc-client

* Update README and comments

---------

Co-authored-by: Akim Mamedov <akim99999999@gmail.com>
2024-01-11 09:03:39 +00:00
fluencebot
55414f6a2f
chore(master): release aqua-ipfs 0.5.29 (#154)
* chore(master): release aqua-ipfs 0.5.29

* chore: Bump aqua-ipfs version to 0.5.29
2024-01-04 16:36:31 +00:00
InversionSpaces
d9736332dc
feat(aqua-ipfs): Use aqua keyword instead of module (#153)
Use aqua keyword
2024-01-04 16:10:26 +00:00
renovate[bot]
6b152ca2ce
chore(deps): update dependency @fluencelabs/cli to v0.13.1 (#141)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-12-29 01:39:56 +00:00
fluencebot
5e3eab082e
chore(master): release aqua-ipfs 0.5.28 (#138)
* chore(master): release aqua-ipfs 0.5.28

* chore: Bump aqua-ipfs version to 0.5.28
2023-12-27 12:36:24 -03:00
renovate[bot]
b98b9b17e2
fix(deps): update rust crate marine-rs-sdk-test to 0.12.1 (#137)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-12-27 12:27:17 -03:00
renovate[bot]
e5e1e170dd
fix(deps): update dependency @fluencelabs/aqua-lib to v0.9.0 (#139)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-12-27 12:15:04 -03:00
renovate[bot]
b783c291d0
chore(deps): update rust crate built to 0.7.0 (#87)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-12-27 12:09:49 -03:00
renovate[bot]
f184b1fff6
fix(deps): update dependency @fluencelabs/fluence-network-environment to v1.1.2 (#113)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-12-27 12:09:11 -03:00
renovate[bot]
fcc40ebb1b
chore(deps): update rust crate log to 0.4.20 (#121)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-12-27 12:08:49 -03:00
fluencebot
a054a17bfb
chore(master): release aqua-ipfs 0.5.27 (#136)
* chore(master): release aqua-ipfs 0.5.27

* chore: Bump aqua-ipfs version to 0.5.27
2023-12-26 18:45:53 +03:00
Valery Antopol
999406708f
fix: add memory limit into distro config (#135)
* add memory limit

* update crate version

* return old version
2023-12-26 18:32:12 +03:00
fluencebot
5f646664f1
chore(master): release aqua-ipfs 0.5.26 (#133)
* chore(master): release aqua-ipfs 0.5.26

* chore: Bump aqua-ipfs version to 0.5.26
2023-12-25 18:42:34 -03:00
folex
812fa12506
fix(release): use fcli installer (#134) 2023-12-25 18:38:58 -03:00
folex
e6749d1f05
fix(build): fix npm build, add check for that (#132)
* fix(release): maybe fix npm run build on release

* fix(ci): check if 'npm run build' works on every commit

* fix(ci): i've no idea what I'm doing

* fix: I beg you, please run tests

* just break it

* fix: oops wrong file

* fix: fix paths, maybe?

* ci is fun

* actually clone the repo

* enable cache back

* disable npm cache

* run on builder

* use setup-fluence to install fcli

* use stable fcli
2023-12-25 14:48:54 -03:00
Valery Antopol
f096a4efb4
fix(deps): rust toolchain 2023-12-06; cargo-workspaces 0.2.44 (#126)
* update rust toolchain

* use latest cargo-workspaces

* use cargo-workspace 0.2.44

---------

Co-authored-by: folex <0xdxdy@gmail.com>
2023-12-25 12:55:46 -03:00
Valery Antopol
6db2393482
feat: update marine sdk's and configs (#122)
update marine and stupp
2023-12-25 17:41:32 +03:00
fluencebot
e1ee67a80e
chore(master): release aqua-ipfs 0.5.25 (#124)
* chore(master): release aqua-ipfs 0.5.25

* chore: Bump aqua-ipfs version to 0.5.25
2023-12-20 16:18:08 -03:00
shamsartem
1d55067965
fix(tests): update package-lock to fix marine-js not found on fluence run (#123)
fix: tests
2023-12-20 17:27:26 +01:00
renovate[bot]
7592e6e067
chore(deps): update dependency @fluencelabs/cli to v0.13.0 (#118) 2023-12-02 15:09:48 +05:30
fluencebot
2efd569360
chore(master): release aqua-ipfs 0.5.24 (#117) 2023-11-15 21:16:31 +02:00
Aleksey Proshutinskiy
b99d790d71
feat: update toolchain and deps (#116) 2023-11-15 21:11:45 +02:00
37 changed files with 12389 additions and 84243 deletions

View File

@ -1,3 +1,3 @@
{
".": "0.5.23"
".": "0.6.0"
}

39
.github/renovate.json vendored
View File

@ -1,39 +1,8 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:base",
":semanticCommitTypeAll(chore)"
"github>fluencelabs/renovate",
"github>fluencelabs/renovate:npm",
"github>fluencelabs/renovate:cargo"
],
"enabledManagers": ["cargo", "npm", "github-actions", "pip_requirements"],
"rangeStrategy": "pin",
"schedule": "every weekend",
"respectLatest": false,
"packageRules": [
{
"matchManagers": ["cargo", "npm"],
"matchPackagePatterns": [
"@fluencelabs/.*",
"fluence-.*",
"marine-.*"
],
"semanticCommitType": "fix",
"semanticCommitScope": "deps",
"schedule": "at any time"
},
{
"matchDepTypes": ["devDependencies"],
"prPriority": -1,
"semanticCommitType": "chore",
"semanticCommitScope": "deps"
},
{
"matchUpdateTypes": ["major"],
"prConcurrentLimit": 1
},
{
"matchManagers": ["github-actions"],
"groupName": "all github-actions",
"prPriority": -1
}
]
"enabledManagers": ["cargo", "npm", "pip_requirements"]
}

View File

@ -40,6 +40,7 @@ jobs:
- snapshot
uses: fluencelabs/nox/.github/workflows/build.yml@master
with:
ref: new-vault
cargo-dependencies: |
[
{

View File

@ -124,7 +124,7 @@ jobs:
uses: baptiste0928/cargo-install@v2.0.0
with:
crate: cargo-workspaces
version: v0.2.37
version: v0.2.44
- name: Setup marine
uses: fluencelabs/setup-marine@v1
@ -141,7 +141,12 @@ jobs:
cache-dependency-path: "aqua/package-lock.json"
cache: "npm"
- run: npm i
- name: Setup fcli
uses: fluencelabs/setup-fluence@v1
with:
version: stable
- run: npm ci
working-directory: aqua
- run: npm run build

View File

@ -50,6 +50,33 @@ jobs:
command: clippy
args: -Z unstable-options --all --manifest-path service/Cargo.toml
npm-build:
name: "Check if npm run build works"
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: "18"
registry-url: "https://registry.npmjs.org"
# cache-dependency-path: "aqua/package-lock.json"
# cache: "npm"
- name: Setup fcli
uses: fluencelabs/setup-fluence@v1
with:
version: stable
- run: npm ci
working-directory: aqua
- run: npm run build
working-directory: aqua
lints:
name: Lints

View File

@ -117,7 +117,7 @@ jobs:
- name: Install fluence deps
env:
FLUENCE_USER_DIR: "${{ github.workspace }}/tmp/.fluence"
run: npx fluence dependency npm install
run: npx fluence dep install
working-directory: aqua-tests
- name: Install ipfs

View File

@ -1,5 +1,82 @@
# Changelog
## [0.6.0](https://github.com/fluencelabs/aqua-ipfs/compare/aqua-ipfs-v0.5.31...aqua-ipfs-v0.6.0) (2024-02-22)
### ⚠ BREAKING CHANGES
* Support CallParameters and Particle Vault File Format ([#165](https://github.com/fluencelabs/aqua-ipfs/issues/165))
### Features
* Support CallParameters and Particle Vault File Format ([#165](https://github.com/fluencelabs/aqua-ipfs/issues/165)) ([e3e89cf](https://github.com/fluencelabs/aqua-ipfs/commit/e3e89cf4d0855712ad181894c0cf5668f8798ca5))
## [0.5.31](https://github.com/fluencelabs/aqua-ipfs/compare/aqua-ipfs-v0.5.30...aqua-ipfs-v0.5.31) (2024-02-21)
### Bug Fixes
* **aqua-lib:** update aqua-lib ([#166](https://github.com/fluencelabs/aqua-ipfs/issues/166)) ([41fbc08](https://github.com/fluencelabs/aqua-ipfs/commit/41fbc08d11e0974b93a7c27209a493516c4fb8a8))
## [0.5.30](https://github.com/fluencelabs/aqua-ipfs/compare/aqua-ipfs-v0.5.29...aqua-ipfs-v0.5.30) (2024-01-11)
### Bug Fixes
* **aqua-ipfs:** Update example ([#159](https://github.com/fluencelabs/aqua-ipfs/issues/159)) ([32238f1](https://github.com/fluencelabs/aqua-ipfs/commit/32238f18c2df5edfe39a43c051bf4f08d76721f4))
## [0.5.29](https://github.com/fluencelabs/aqua-ipfs/compare/aqua-ipfs-v0.5.28...aqua-ipfs-v0.5.29) (2024-01-04)
### Features
* **aqua-ipfs:** Use `aqua` keyword instead of `module` ([#153](https://github.com/fluencelabs/aqua-ipfs/issues/153)) ([d973633](https://github.com/fluencelabs/aqua-ipfs/commit/d9736332dcbe7b2389c650157d2c8a84b7386939))
## [0.5.28](https://github.com/fluencelabs/aqua-ipfs/compare/aqua-ipfs-v0.5.27...aqua-ipfs-v0.5.28) (2023-12-27)
### Bug Fixes
* **deps:** update dependency @fluencelabs/aqua-lib to v0.9.0 ([#139](https://github.com/fluencelabs/aqua-ipfs/issues/139)) ([e5e1e17](https://github.com/fluencelabs/aqua-ipfs/commit/e5e1e170dd8405cc720998e8522969e9248c73fb))
* **deps:** update dependency @fluencelabs/fluence-network-environment to v1.1.2 ([#113](https://github.com/fluencelabs/aqua-ipfs/issues/113)) ([f184b1f](https://github.com/fluencelabs/aqua-ipfs/commit/f184b1fff68e84a7e987fa0afe56fb231ed62e6d))
* **deps:** update rust crate marine-rs-sdk-test to 0.12.1 ([#137](https://github.com/fluencelabs/aqua-ipfs/issues/137)) ([b98b9b1](https://github.com/fluencelabs/aqua-ipfs/commit/b98b9b17e28ac61578d4abf5cf5489bfe2a17541))
## [0.5.27](https://github.com/fluencelabs/aqua-ipfs/compare/aqua-ipfs-v0.5.26...aqua-ipfs-v0.5.27) (2023-12-26)
### Bug Fixes
* add memory limit into distro config ([#135](https://github.com/fluencelabs/aqua-ipfs/issues/135)) ([9994067](https://github.com/fluencelabs/aqua-ipfs/commit/999406708f958374e6ce43673f550e18bf651d80))
## [0.5.26](https://github.com/fluencelabs/aqua-ipfs/compare/aqua-ipfs-v0.5.25...aqua-ipfs-v0.5.26) (2023-12-25)
### Features
* update marine sdk's and configs ([#122](https://github.com/fluencelabs/aqua-ipfs/issues/122)) ([6db2393](https://github.com/fluencelabs/aqua-ipfs/commit/6db239348299451d5c3f3a2687fe53fae6b922c7))
### Bug Fixes
* **build:** fix npm build, add check for that ([#132](https://github.com/fluencelabs/aqua-ipfs/issues/132)) ([e6749d1](https://github.com/fluencelabs/aqua-ipfs/commit/e6749d1f05b1ad4ebf3aa4c3c166758e3288635e))
* **deps:** rust toolchain 2023-12-06; cargo-workspaces 0.2.44 ([#126](https://github.com/fluencelabs/aqua-ipfs/issues/126)) ([f096a4e](https://github.com/fluencelabs/aqua-ipfs/commit/f096a4efb46d5c24513745c7bea376e88fea9631))
* **release:** use fcli installer ([#134](https://github.com/fluencelabs/aqua-ipfs/issues/134)) ([812fa12](https://github.com/fluencelabs/aqua-ipfs/commit/812fa12506edca84c12a14dc1547c01182297d56))
## [0.5.25](https://github.com/fluencelabs/aqua-ipfs/compare/aqua-ipfs-v0.5.24...aqua-ipfs-v0.5.25) (2023-12-20)
### Bug Fixes
* tests ([1d55067](https://github.com/fluencelabs/aqua-ipfs/commit/1d550679653864d5ea8d5951113f258c415a0527))
* **tests:** update package-lock to fix marine-js not found on fluence run ([#123](https://github.com/fluencelabs/aqua-ipfs/issues/123)) ([1d55067](https://github.com/fluencelabs/aqua-ipfs/commit/1d550679653864d5ea8d5951113f258c415a0527))
## [0.5.24](https://github.com/fluencelabs/aqua-ipfs/compare/aqua-ipfs-v0.5.23...aqua-ipfs-v0.5.24) (2023-11-15)
### Features
* update toolchain and deps ([#116](https://github.com/fluencelabs/aqua-ipfs/issues/116)) ([b99d790](https://github.com/fluencelabs/aqua-ipfs/commit/b99d790d71f452e3eb00eda39ac3d9cada7f7fb8))
## [0.5.23](https://github.com/fluencelabs/aqua-ipfs/compare/aqua-ipfs-v0.5.22...aqua-ipfs-v0.5.23) (2023-11-15)

View File

@ -1,16 +0,0 @@
# yaml-language-server: $schema=schemas/project-secrets.json
# Defines project's secret keys that are used only in the scope of this particular Fluence project. You can manage project's keys using commands from `fluence key` group of commands
# Documentation: https://github.com/fluencelabs/fluence-cli/tree/main/docs/configs/project-secrets.md
version: 0
keyPairs:
[
{
peerId: 12D3KooWAtJ3RXGiW2WzZYUk7XxAEyfwLdqJHsPXmb7xd1dY7uZK,
secretKey: BNidntUryx+hxr7NK2z9nci23sMn3fURB6bTH1K2Ll4=,
publicKey: CAESIA/dWDmfLpI+PmldVAgQblramknRSyfivJ5x/Y0W6EQC,
name: test_put_get_dag
},
]

View File

@ -0,0 +1 @@
BNidntUryx+hxr7NK2z9nci23sMn3fURB6bTH1K2Ll4=

View File

@ -1,7 +1,7 @@
.idea
.DS_Store
.fluence/*
!.fluence/project-secrets.yaml
!.fluence/secrets
**/node_modules
**/target/
.repl_history

View File

@ -4,5 +4,14 @@
# Documentation: https://github.com/fluencelabs/fluence-cli/tree/main/docs/configs/fluence.md
version: 2
aquaInputPath: src/aqua/main.aqua
version: 8
aquaDependencies:
"@fluencelabs/aqua-lib": 0.9.1
"@fluencelabs/spell": 0.6.9
compileAqua:
default:
input: src/aqua/main.aqua
output: src/compiled-aqua
target: ts

File diff suppressed because it is too large Load Diff

View File

@ -3,7 +3,7 @@
"version": "1.0.0",
"description": "Aqua-IPFS tests",
"dependencies": {
"@fluencelabs/aqua-lib": "0.8.1",
"@fluencelabs/aqua-lib": "0.10.1",
"@fluencelabs/aqua-ipfs": "file:../aqua"
},
"scripts": {
@ -28,7 +28,7 @@
},
"homepage": "https://github.com/fluencelabs/aqua-ipfs",
"devDependencies": {
"@fluencelabs/cli": "0.5.4",
"@fluencelabs/fluence-network-environment": "1.0.14"
"@fluencelabs/cli": "0.15.1",
"@fluencelabs/fluence-network-environment": "1.1.2"
}
}

View File

@ -1,10 +1,15 @@
aqua IpfsApi declares *
export get_and_cache
export put, dag_put, dag_get, get_from, dag_get_from, cat_from
export set_timeout, get_external_api_multiaddr
export get_external_swarm_multiaddr, get_local_api_multiaddr
import "@fluencelabs/aqua-lib/builtin.aqua"
import "ipfs.aqua"
alias Multiaddr: string
alias PeerId: string
alias CID: string
alias Path: string
-- Download file from remote IPFS node to Fluence node and then
-- put that file to local IPFS node, effectively caching it on the local IPFS node.

View File

@ -1,4 +1,4 @@
module Ipfs declares *
aqua Ipfs declares *
data IpfsCatResult:
success: bool

35839
aqua/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,12 +1,12 @@
{
"name": "@fluencelabs/aqua-ipfs",
"version": "0.5.21",
"version": "0.6.0",
"description": "Aqua IPFS library",
"files": [
"*.aqua"
],
"dependencies": {
"@fluencelabs/aqua-lib": "0.8.1"
"@fluencelabs/aqua-lib": "0.10.1"
},
"scripts": {
"generate-aqua": "../service/build.sh",
@ -29,8 +29,5 @@
"bugs": {
"url": "https://github.com/fluencelabs/aqua-ipfs/issues"
},
"homepage": "https://github.com/fluencelabs/aqua-ipfs#readme",
"devDependencies": {
"@fluencelabs/cli": "0.5.3"
}
"homepage": "https://github.com/fluencelabs/aqua-ipfs#readme"
}

View File

@ -1,8 +1,8 @@
# Run example on TestNet
While in `example` directory, `npm start` will run `index.ts` against Fluence TestNet
While in `example` directory, `npm run start` will run `index.ts` against Fluence TestNet
# Run example locally
1. Go to `local-network`
2. Run `docker compose up -d` to start Fluence cluster of 3 nodes
3. Go back to `../example`
4. Run `npm run start:local`
To run example locally:
1. Spin up local environment through [Fluence CLI](https://github.com/fluencelabs/cli)'s `local` command
2. Pass local fluence peers multi addresses to `main` in `index.ts`
3. (Optional) Change `IPFS_MULTIADDR` to address of your preferred IPFS node

View File

@ -1,3 +1,4 @@
module Exports
aqua Exports
import put, get_from, set_timeout from "@fluencelabs/aqua-ipfs/ipfs-api.aqua"
export put, get_from, set_timeout

View File

@ -13,94 +13,72 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Fluence, testNet, Relay } from "@fluencelabs/js-client";
import { put, get_from, set_timeout } from "./generated/export";
import { Fluence } from "@fluencelabs/fluence";
import { Node, testNet } from "@fluencelabs/fluence-network-environment";
import { put, get_from, set_timeout } from "./generated/export.js";
const { create, urlSource } = require("ipfs-http-client");
const all = require("it-all");
const uint8ArrayConcat = require("uint8arrays/concat");
import { multiaddr } from "@multiformats/multiaddr";
import { create } from "kubo-rpc-client";
import all from "it-all";
import uint8ArrayConcat from "uint8arrays/concat.js";
let local: Node[] = [
{
peerId: "12D3KooWHBG9oaVx4i3vi6c1rSBUm7MLBmyGmmbHoZ23pmjDCnvK",
multiaddr:
"/ip4/127.0.0.1/tcp/9990/ws/p2p/12D3KooWHBG9oaVx4i3vi6c1rSBUm7MLBmyGmmbHoZ23pmjDCnvK",
},
{
peerId: "12D3KooWRABanQHUn28dxavN9ZS1zZghqoZVAYtFpoN7FdtoGTFv",
multiaddr:
"/ip4/127.0.0.1/tcp/9991/ws/p2p/12D3KooWRABanQHUn28dxavN9ZS1zZghqoZVAYtFpoN7FdtoGTFv",
},
{
peerId: "12D3KooWFpQ7LHxcC9FEBUh3k4nSCC12jBhijJv3gJbi7wsNYzJ5",
multiaddr:
"/ip4/127.0.0.1/tcp/9992/ws/p2p/12D3KooWFpQ7LHxcC9FEBUh3k4nSCC12jBhijJv3gJbi7wsNYzJ5",
},
];
// Multi address of the IPFS node
// we will work with through the Fluence Network
const IPFS_MULTIADDR = multiaddr("/dns4/ipfs.fluence.dev/tcp/5001");
/**
* @param environment - array of fluence network nodes (two are needed)
* @note Pass addresses of local nodes to experiment locally
*/
async function main(environment: Relay[]) {
const relay = environment[0];
const node = environment[1];
const ipfs = await create({ url: IPFS_MULTIADDR });
console.log("📗 Created IPFS HTTP Client");
const content = "Hola, Fluence!";
const encoder = new TextEncoder();
const added = await ipfs.add(encoder.encode(content));
console.log("📗 Uploaded content, got CID:", added.cid.toString());
let stream = await ipfs.cat(added.path);
let data = uint8ArrayConcat(await all(stream));
const decoder = new TextDecoder();
console.log("📗 Retrieved content: ", decoder.decode(data));
await Fluence.connect(relay);
const client = Fluence.getClient();
async function main(environment: Node[]) {
// setLogLevel('DEBUG');
await Fluence.start({ connectTo: environment[1] });
console.log(
"📗 created a fluence peer %s with relay %s",
Fluence.getStatus().peerId,
Fluence.getStatus().relayPeerId
"📗 Created a Fluence Peer %s with Relay %s",
client.getPeerId(),
client.getRelayPeerId()
);
let ipfsAddr = "https://stage.fluence.dev:15001";
let ipfsMultiaddr =
"/ip4/134.209.186.43/tcp/5001/p2p/12D3KooWEhCqQ9NBnmtSfNeXSNfhgccmH86xodkCUxZNEXab6pkw";
const ipfs = create(ipfsAddr);
console.log("📗 created ipfs client");
// default IPFS timeout is 1 sec,
// set to 10 secs to retrieve file from remote node
await set_timeout(node.peerId, 10);
console.log("📘 Ipfs.set_timeout");
await ipfs.id();
console.log("📗 connected to ipfs");
let source = urlSource(
"https://images.adsttc.com/media/images/5ecd/d4ac/b357/65c6/7300/009d/large_jpg/02C.jpg?1590547607"
);
const file = await ipfs.add(source);
console.log("📗 uploaded file:", file);
let files = await ipfs.get(file.cid);
for await (const file of files) {
const content = uint8ArrayConcat(await all(file.content));
console.log("📗 downloaded file of length ", content.length);
}
// default IPFS timeout is 1 sec, set to 10 secs to retrieve file from remote node
await set_timeout(environment[2].peerId, 10);
console.log("📘 file hash: ", file.cid);
let getResult = await get_from(
environment[2].peerId,
file.cid.toString(),
ipfsMultiaddr,
{ ttl: 10000 }
node.peerId,
added.cid.toString(),
IPFS_MULTIADDR.toString(),
{ ttl: 20000 }
);
console.log("📘 Ipfs.get", getResult);
console.log("📘 Ipfs.get_from", getResult);
let putResult = await put(environment[2].peerId, getResult.path, {
ttl: 10000,
let putResult = await put(node.peerId, getResult.path, {
ttl: 20000,
});
console.log("📘 Ipfs.put", putResult);
return;
await ipfs.stop();
}
let args = process.argv.slice(2);
var environment: Node[];
if (args.length >= 1 && args[0] == "local") {
environment = local;
console.log("📘 Will connect to local nodes");
} else {
environment = testNet;
console.log("📘 Will connect to testNet");
}
main(environment)
main(testNet)
.then(() => process.exit(0))
.catch((error) => {
console.error(error);

15830
example/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,10 +1,11 @@
{
"type": "module",
"name": "ipfs-aqua-example",
"version": "1.0.0",
"description": "A simple example of how to use ipfs-aqua in TS",
"main": "index.js",
"scripts": {
"compile-aqua": "aqua -i aqua -o generated",
"compile-aqua": "fluence aqua -i aqua -o generated",
"prebuild": "npm run compile-aqua",
"build": "tsc",
"start": "node dist/index.js",
@ -13,12 +14,11 @@
"author": "Fluence Labs",
"license": "MIT",
"dependencies": {
"@fluencelabs/aqua-ipfs": "file:../aqua",
"@fluencelabs/aqua-lib": "^0.8.1",
"@fluencelabs/aqua": "0.7.4-322",
"@fluencelabs/fluence": "^0.23.0",
"@fluencelabs/fluence-network-environment": "^1.0.13",
"ipfs-http-client": "^50.1.2",
"@fluencelabs/aqua-ipfs": "^0.5.29",
"@fluencelabs/aqua-lib": "^0.9.0",
"@fluencelabs/js-client": "^0.4.2",
"kubo-rpc-client": "^3.0.2",
"@multiformats/multiaddr": "^12.1.1",
"it-all": "^1.0.5",
"uint8arrays": "^2.1.5"
},

View File

@ -5,7 +5,7 @@
/* Basic Options */
// "incremental": true, /* Enable incremental compilation */
"target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */
"module": "ES2020", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */
// "lib": [], /* Specify library files to be included in the compilation. */
// "allowJs": true, /* Allow javascript files to be compiled. */
// "checkJs": true, /* Report errors in .js files. */
@ -41,7 +41,7 @@
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
/* Module Resolution Options */
// "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
"moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */

View File

@ -1,4 +1,4 @@
[toolchain]
channel = "nightly-2022-12-06"
channel = "nightly-2023-12-06"
targets = [ "x86_64-unknown-linux-gnu", "wasm32-wasi", "x86_64-apple-darwin" ]
components = [ "rustfmt", "clippy" ]

1998
service/Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -5,3 +5,6 @@ members = [
"distro",
"types",
]
[workspace.dependencies]
marine-rs-sdk = { version = "0.13.0", features = ["logger"] }
marine-rs-sdk-test = "0.14.0"

View File

@ -1,3 +1,5 @@
total_memory_limit = "Infinity"
[[module]]
name = "ipfs_effector"
mem_pages_count = 100

View File

@ -1,6 +1,6 @@
[package]
name = "aqua-ipfs-distro"
version = "0.5.20"
version = "0.6.0"
description = "distribution of aqua ipfs service"
edition = "2021"
build = "build.rs"
@ -13,4 +13,4 @@ include = [ "/src", "/ipfs-service", "build.rs", "Cargo.toml" ]
maplit = "1.0.2"
[build-dependencies]
built = "0.5.2"
built = "0.7.0"

View File

@ -1,6 +1,6 @@
[package]
name = "ipfs-effector"
version = "0.5.20"
version = "0.6.0"
authors = ["Fluence Labs"]
edition = "2018"
publish = false
@ -10,17 +10,17 @@ name = "ipfs_effector"
path = "src/main.rs"
[dependencies]
marine-rs-sdk = { version = "0.7.1", features = ["logger"] }
marine-rs-sdk = { workspace = true }
multiaddr = { version = "0.11.2", package = "fluence-fork-parity-multiaddr" }
log = "0.4.14"
log = "0.4.20"
eyre = "0.6.8"
serde_json = "1.0.64"
itertools = "0.10.5"
itertools = "0.12.0"
types = { path = "../types" }
[dev-dependencies]
marine-rs-sdk-test = "0.10.0"
marine-rs-sdk-test = { workspace = true }
[build-dependencies]
marine-rs-sdk-test = "0.10.0"
marine-rs-sdk-test = { workspace = true }

View File

@ -185,7 +185,7 @@ pub fn cat(hash: String, api_multiaddr: String, timeout_sec: u64) -> IpfsCatResu
}
#[marine]
#[link(wasm_import_module = "host")]
#[host_import]
extern "C" {
/// Execute provided cmd as a parameters of ipfs cli, return result.
pub fn ipfs(cmd: Vec<String>) -> MountedBinaryResult;

View File

@ -1,4 +1,5 @@
modules_dir = "../../artifacts/"
total_memory_limit = "Infinity"
[[module]]
name = "ipfs_effector"

View File

@ -1,4 +1,5 @@
modules_dir = "../../artifacts/"
total_memory_limit = "Infinity"
[[module]]
name = "ipfs_effector"

View File

@ -1,4 +1,5 @@
modules_dir = "../../artifacts/"
total_memory_limit = "Infinity"
[[module]]
name = "ipfs_effector"

View File

@ -1,6 +1,6 @@
[package]
name = "ipfs-pure"
version = "0.5.20"
version = "0.6.0"
authors = ["Fluence Labs"]
edition = "2018"
publish = false
@ -10,18 +10,18 @@ name = "ipfs_pure"
path = "src/main.rs"
[dependencies]
marine-rs-sdk = { version = "0.7.1", features = ["logger"] }
marine-rs-sdk = { workspace = true }
multiaddr = { version = "0.11.2", package = "fluence-fork-parity-multiaddr" }
log = "0.4.14"
log = "0.4.20"
eyre = "0.6.8"
toml = "0.5.8"
serde = "1.0.152"
bs58 = "0.4.0"
toml = "0.8.8"
serde = "1.0.188"
bs58 = "0.5.0"
types = { path = "../types" }
[dev-dependencies]
marine-rs-sdk-test = "0.10.0"
marine-rs-sdk-test = { workspace = true }
[build-dependencies]
marine-rs-sdk-test = "0.10.0"
marine-rs-sdk-test = { workspace = true }

View File

@ -23,6 +23,7 @@ use types::{
use marine_rs_sdk::marine;
use marine_rs_sdk::module_manifest;
use marine_rs_sdk::ParticleParameters;
use marine_rs_sdk::WasmLoggerBuilder;
use eyre::WrapErr;
@ -110,6 +111,10 @@ pub fn get_peer_id(api_multiaddr: String, timeout: u64) -> eyre::Result<Protocol
))
}
fn vault_path(particle: &ParticleParameters) -> String {
format!("/tmp/vault/{}-{}", particle.id, particle.token)
}
#[marine]
pub fn connect(multiaddr: String) -> IpfsResult {
if Multiaddr::from_str(&multiaddr).is_err() {
@ -167,8 +172,8 @@ pub fn get_from(hash: String, external_multiaddr: String) -> IpfsGetResult {
return Err(eyre::eyre!("invalid multiaddr: {}", external_multiaddr)).into();
}
let particle_id = marine_rs_sdk::get_call_parameters().particle_id;
let particle_vault_path = format!("/tmp/vault/{}", particle_id);
let particle = marine_rs_sdk::get_call_parameters().particle;
let particle_vault_path = vault_path(&particle);
let path = format!("{}/{}", particle_vault_path, hash);
let get_result = ipfs_get(hash, &path, external_multiaddr, timeout);
@ -198,8 +203,8 @@ pub fn dag_get_from(hash: String, external_multiaddr: String) -> IpfsGetResult {
return Err(eyre::eyre!("invalid multiaddr: {}", external_multiaddr)).into();
}
let particle_id = marine_rs_sdk::get_call_parameters().particle_id;
let particle_vault_path = format!("/tmp/vault/{}", particle_id);
let particle = marine_rs_sdk::get_call_parameters().particle;
let particle_vault_path = vault_path(&particle);
let path = format!("{}/{}", particle_vault_path, hash);
let get_result = ipfs_dag_get(hash, &path, external_multiaddr, timeout);
@ -240,7 +245,7 @@ pub fn get_external_api_multiaddr() -> IpfsMultiaddrResult {
#[marine]
pub fn set_external_api_multiaddr(multiaddr: String) -> IpfsResult {
let call_parameters = marine_rs_sdk::get_call_parameters();
if call_parameters.init_peer_id != call_parameters.service_creator_peer_id {
if call_parameters.particle.init_peer_id != call_parameters.service_creator_peer_id {
return eyre::Result::<()>::Err(eyre::eyre!(
"only service creator can set external api multiaddr"
))
@ -291,7 +296,7 @@ pub fn get_local_api_multiaddr() -> IpfsMultiaddrResult {
#[marine]
pub fn set_local_api_multiaddr(multiaddr: String) -> IpfsResult {
let call_parameters = marine_rs_sdk::get_call_parameters();
if call_parameters.init_peer_id != call_parameters.service_creator_peer_id {
if call_parameters.particle.init_peer_id != call_parameters.service_creator_peer_id {
return eyre::Result::<()>::Err(eyre::eyre!(
"only service creator can set local api multiaddr"
))
@ -320,7 +325,7 @@ pub fn get_external_swarm_multiaddr() -> IpfsMultiaddrResult {
#[marine]
pub fn set_external_swarm_multiaddr(multiaddr: String) -> IpfsResult {
let call_parameters = marine_rs_sdk::get_call_parameters();
if call_parameters.init_peer_id != call_parameters.service_creator_peer_id {
if call_parameters.particle.init_peer_id != call_parameters.service_creator_peer_id {
return eyre::Result::<()>::Err(eyre::eyre!(
"only service creator can set external swarm multiaddr"
))
@ -371,7 +376,7 @@ pub fn set_timeout(timeout_sec: u64) {
}
#[marine]
#[link(wasm_import_module = "ipfs_effector")]
#[module_import("ipfs_effector")]
extern "C" {
#[link_name = "connect"]
pub fn ipfs_connect(

View File

@ -1,4 +1,5 @@
modules_dir = "../../artifacts/"
total_memory_limit = "Infinity"
[[module]]
name = "ipfs_effector"

View File

@ -1,11 +1,11 @@
[package]
name = "types"
version = "0.5.17"
version = "0.6.0"
edition = "2018"
publish = false
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
marine-rs-sdk = { version = "0.7.1", features = ["logger"] }
marine-rs-sdk = { workspace = true }
eyre = "0.6.8"