├── .github
├── renovate.json
└── workflows
│ ├── ci.yml
│ └── js-projects.yml
├── .gitignore
├── Readme.md
├── aqua-examples
├── aqua-ipfs-integration
│ ├── .gitignore
│ ├── .npmrc
│ ├── .prettierrc.js
│ ├── README.md
│ ├── aqua
│ │ ├── .gitignore
│ │ ├── aqua
│ │ │ ├── exports.aqua
│ │ │ ├── process.aqua
│ │ │ └── process_files.aqua
│ │ ├── package.json
│ │ ├── src
│ │ │ └── index.ts
│ │ └── tsconfig.json
│ ├── local-network
│ │ └── docker-compose.yml
│ ├── nodejs
│ │ ├── .prettierrc.js
│ │ ├── jest.config.js
│ │ ├── package.json
│ │ ├── src
│ │ │ ├── __test__
│ │ │ │ └── test.spec.ts
│ │ │ ├── demo.ts
│ │ │ ├── main.ts
│ │ │ └── provider.ts
│ │ └── tsconfig.json
│ ├── package-lock.json
│ ├── package.json
│ ├── service
│ │ ├── .gitignore
│ │ ├── Cargo.toml
│ │ ├── Config.toml
│ │ ├── scripts
│ │ │ └── build.sh
│ │ └── src
│ │ │ └── main.rs
│ └── web
│ │ ├── .gitignore
│ │ ├── README.md
│ │ ├── images
│ │ ├── ipfs_comp_web_1.png
│ │ ├── ipfs_comp_web_2.png
│ │ ├── ipfs_comp_web_3.png
│ │ └── ipfs_comp_web_4.png
│ │ ├── jest.config.js
│ │ ├── package.json
│ │ ├── public
│ │ ├── favicon.ico
│ │ ├── index.html
│ │ ├── logo192.png
│ │ ├── logo512.png
│ │ ├── manifest.json
│ │ ├── marine-js.web.js
│ │ └── robots.txt
│ │ ├── src
│ │ ├── App.scss
│ │ ├── App.tsx
│ │ ├── Components
│ │ │ ├── ConnectedInfo.tsx
│ │ │ ├── ConnectionForm.tsx
│ │ │ ├── IpfsDeploymentInfo.tsx
│ │ │ ├── IpfsForm.tsx
│ │ │ ├── SizeCalcForm.tsx
│ │ │ ├── SizeCalcResult.tsx
│ │ │ └── TextInput.tsx
│ │ ├── __test__
│ │ │ └── test.spec.ts
│ │ ├── appLogic.ts
│ │ ├── appState.ts
│ │ ├── index.css
│ │ ├── index.tsx
│ │ ├── logo.svg
│ │ ├── react-app-env.d.ts
│ │ └── util.ts
│ │ └── tsconfig.json
├── decentralized-blockchain-gateway
│ ├── .gitignore
│ ├── Cargo.toml
│ ├── README.md
│ ├── aqua
│ │ ├── ipfs_test.aqua
│ │ └── multi_provider_quorum.aqua
│ ├── configs
│ │ ├── Config.toml
│ │ ├── deployment_cfg.json
│ │ └── services
│ │ │ ├── eth-rpc
│ │ │ └── service.yaml
│ │ │ ├── ipfs-package
│ │ │ └── service.yaml
│ │ │ ├── multi-provider-query
│ │ │ └── service.yaml
│ │ │ ├── simple-quorum
│ │ │ └── service.yaml
│ │ │ └── utilities
│ │ │ └── service.yaml
│ ├── fluence-lock.yaml
│ ├── fluence.yaml
│ ├── gateway
│ │ ├── README.md
│ │ ├── aqua-compiled
│ │ │ ├── rpc.d.ts
│ │ │ └── rpc.js
│ │ ├── aqua
│ │ │ └── rpc.aqua
│ │ ├── config.json
│ │ ├── package-lock.json
│ │ ├── package.json
│ │ ├── src
│ │ │ ├── arguments.js
│ │ │ ├── config.js
│ │ │ ├── index.js
│ │ │ └── methods.js
│ │ └── web3run.js
│ ├── parameters
│ │ ├── quorum_addrs.json
│ │ ├── quorum_mixed_params.json
│ │ ├── quorum_params.json
│ │ ├── service_addrs.json
│ │ └── utility_addrs.json
│ ├── scripts
│ │ ├── build.sh
│ │ └── package_services.sh
│ ├── service-packages
│ │ ├── eth_rpc.tar.gz
│ │ ├── ipfs_package.tar.gz
│ │ ├── multi_provider_query_package.tar.gz
│ │ ├── simple_quorum_package.tar.gz
│ │ └── utilities_package.tar.gz
│ └── wasm-modules
│ │ ├── curl-adapter
│ │ ├── Cargo.toml
│ │ ├── module.yaml
│ │ └── src
│ │ │ └── main.rs
│ │ ├── eth-rpc
│ │ ├── Cargo.toml
│ │ ├── README.md
│ │ ├── aqua
│ │ │ ├── common_calls.aqua
│ │ │ └── web3_calls.aqua
│ │ ├── module.yaml
│ │ ├── rust-toolchain.toml
│ │ ├── src
│ │ │ ├── curl_transport.rs
│ │ │ ├── eth_call.rs
│ │ │ ├── main.rs
│ │ │ ├── typed.rs
│ │ │ └── values.rs
│ │ ├── test.sh
│ │ ├── tests_artifacts
│ │ │ ├── Config.toml
│ │ │ └── curl_adapter.wasm
│ │ └── workshop
│ │ │ └── README.md
│ │ ├── ipfs-adapter
│ │ ├── Cargo.toml
│ │ ├── module.yaml
│ │ └── src
│ │ │ └── main.rs
│ │ ├── ipfs-cli
│ │ ├── Cargo.toml
│ │ ├── module.yaml
│ │ └── src
│ │ │ └── main.rs
│ │ ├── multi-provider-query
│ │ ├── Cargo.toml
│ │ ├── module.yaml
│ │ └── src
│ │ │ └── main.rs
│ │ ├── simple-quorum
│ │ ├── Cargo.toml
│ │ ├── module.yaml
│ │ └── src
│ │ │ └── main.rs
│ │ └── utilities
│ │ ├── Cargo.toml
│ │ ├── module.yaml
│ │ └── src
│ │ └── main.rs
├── drand
│ ├── .gitignore
│ ├── README.md
│ ├── aqua
│ │ ├── drand_examples.aqua
│ │ └── drand_lib.aqua
│ └── services
│ │ ├── configs
│ │ ├── Config.toml
│ │ └── deployment_cfg.json
│ │ ├── curl_adapter
│ │ ├── Cargo.toml
│ │ └── src
│ │ │ └── main.rs
│ │ ├── drand
│ │ ├── Cargo.toml
│ │ └── src
│ │ │ └── main.rs
│ │ └── scripts
│ │ └── build.sh
├── echo-greeter
│ ├── Readme.md
│ ├── aqua
│ │ └── echo_greeter.aqua
│ ├── client-peer
│ │ ├── .gitignore
│ │ ├── .prettierrc.js
│ │ ├── jest.config.js
│ │ ├── package-lock.json
│ │ ├── package.json
│ │ ├── src
│ │ │ ├── __test__
│ │ │ │ └── test.spec.ts
│ │ │ ├── index.ts
│ │ │ └── main.ts
│ │ └── tsconfig.json
│ ├── configs
│ │ ├── Config.toml
│ │ ├── echo_greeter_deploy_cfg.json
│ │ ├── echo_service_cfg.json
│ │ ├── greeting_cfg.json
│ │ └── utilities_cfg.json
│ ├── echo-service
│ │ ├── .gitignore
│ │ ├── Cargo.toml
│ │ ├── Config.toml
│ │ ├── build.sh
│ │ └── src
│ │ │ └── main.rs
│ ├── greeting
│ │ ├── .gitignore
│ │ ├── Cargo.toml
│ │ ├── Config.toml
│ │ ├── build.sh
│ │ └── src
│ │ │ └── main.rs
│ ├── scripts
│ │ └── build_all.sh
│ ├── secure-greeter
│ │ ├── .gitignore
│ │ ├── Cargo.toml
│ │ ├── Config.toml
│ │ ├── air-scripts
│ │ │ └── air_greet.clj
│ │ ├── build.sh
│ │ ├── configs
│ │ │ └── secure_greeter_cfg.json
│ │ └── src
│ │ │ ├── auth.rs
│ │ │ └── main.rs
│ └── utilities
│ │ ├── .gitignore
│ │ ├── Cargo.toml
│ │ ├── Config.toml
│ │ ├── aqua-compiled
│ │ ├── utilities.increment_u32.air
│ │ ├── utilities.increment_u64.air
│ │ ├── utilities.splitter.air
│ │ ├── utilities.splitter_u32.air
│ │ └── utilities.splitter_u64.air
│ │ ├── aqua-scripts
│ │ └── utilities.aqua
│ │ ├── scripts
│ │ └── build.sh
│ │ └── src
│ │ └── main.rs
├── near-integration
│ ├── README.md
│ ├── near-signing-node
│ │ ├── .gitignore
│ │ ├── aqua
│ │ │ └── near_signing_node.aqua
│ │ ├── fluence.yaml
│ │ ├── package.json
│ │ ├── src
│ │ │ ├── index.ts
│ │ │ └── interfaces.ts
│ │ └── tsconfig.json
│ └── services
│ │ ├── .gitignore
│ │ ├── fluence.yaml
│ │ ├── near-adapter
│ │ ├── Config.toml
│ │ ├── modules
│ │ │ ├── curl-adapter
│ │ │ │ ├── .gitignore
│ │ │ │ ├── Cargo.toml
│ │ │ │ ├── Config.toml
│ │ │ │ ├── README.md
│ │ │ │ ├── module.yaml
│ │ │ │ └── src
│ │ │ │ │ └── main.rs
│ │ │ └── near-rpc-services
│ │ │ │ ├── .gitignore
│ │ │ │ ├── Cargo.toml
│ │ │ │ ├── Config.toml
│ │ │ │ ├── README.md
│ │ │ │ ├── module.yaml
│ │ │ │ └── src
│ │ │ │ ├── main.rs
│ │ │ │ └── utils.rs
│ │ └── service.yaml
│ │ └── src
│ │ └── aqua
│ │ └── main.aqua
├── price-oracle
│ ├── README.md
│ ├── aqua
│ │ └── get_crypto_prices.aqua
│ ├── client-peer
│ │ ├── .gitignore
│ │ ├── .prettierrc.js
│ │ ├── jest.config.js
│ │ ├── package-lock.json
│ │ ├── package.json
│ │ ├── src
│ │ │ ├── __test__
│ │ │ │ └── test.spec.ts
│ │ │ ├── index.ts
│ │ │ └── main.ts
│ │ └── tsconfig.json
│ ├── configs
│ │ ├── Config.toml
│ │ ├── curl_adapter_cfg.json
│ │ ├── mean_service_cfg.json
│ │ ├── price_getter_service_cfg.json
│ │ └── price_oracle_deploy_cfg.json
│ ├── curl_adapter
│ │ ├── Cargo.toml
│ │ └── src
│ │ │ └── main.rs
│ ├── data
│ │ └── deployed_services.json
│ ├── images
│ │ ├── browser_demo.png
│ │ ├── figure_1.png
│ │ └── figure_2.png
│ ├── mean_service
│ │ ├── Cargo.toml
│ │ └── src
│ │ │ └── main.rs
│ ├── price_getter_service
│ │ ├── Cargo.toml
│ │ └── src
│ │ │ └── main.rs
│ ├── scripts
│ │ └── build.sh
│ └── web
│ │ ├── .gitignore
│ │ ├── .prettierrc.js
│ │ ├── README.md
│ │ ├── jest.config.js
│ │ ├── package-lock.json
│ │ ├── package.json
│ │ ├── public
│ │ ├── favicon.ico
│ │ ├── index.html
│ │ ├── logo192.png
│ │ ├── logo512.png
│ │ ├── manifest.json
│ │ └── robots.txt
│ │ ├── src
│ │ ├── .prettierrc.js
│ │ ├── App.scss
│ │ ├── App.tsx
│ │ ├── __test__
│ │ │ └── test.spec.ts
│ │ ├── index.css
│ │ ├── index.tsx
│ │ ├── logo.svg
│ │ └── react-app-env.d.ts
│ │ └── tsconfig.json
├── ts-oracle
│ ├── Cargo.toml
│ ├── Readme.md
│ ├── aqua
│ │ ├── builtin.aqua
│ │ └── ts_getter.aqua
│ ├── configs
│ │ ├── Config.toml
│ │ ├── ts_oracle_cfg.json
│ │ └── ts_oracle_deploy_cfg.json
│ ├── scripts
│ │ └── build.sh
│ └── src
│ │ ├── main.rs
│ │ └── stats.rs
└── vrfun
│ ├── .gitignore
│ ├── Cargo.lock
│ ├── Cargo.toml
│ ├── LICENSE
│ ├── README.md
│ ├── aqua
│ └── vrf.aqua
│ ├── artifacts
│ └── vrfun.wasm
│ ├── configs
│ ├── Config.toml
│ ├── deployed_services.json
│ └── deployment_cfg.json
│ ├── data
│ ├── proof_data.json
│ └── run_data.json
│ ├── scripts
│ └── build.sh
│ └── src
│ └── main.rs
├── archived
├── aqua-ceramic-integration
│ ├── .gitignore
│ ├── README.md
│ ├── aqua
│ │ └── ceramic_demo.aqua
│ ├── assets
│ │ ├── figure_1.jpg
│ │ └── figure_1_code.md
│ ├── ceramic
│ │ ├── schema_id.txt
│ │ └── snapshot_schema.json
│ ├── configs
│ │ ├── Config.toml
│ │ ├── ceramic_adapter_cfg.json
│ │ ├── ceramic_adapter_deploy_cfg.json
│ │ └── curl_adapter_cfg.json
│ ├── scripts
│ │ └── build.sh
│ └── services
│ │ ├── ceramic-adapter-basic
│ │ ├── .gitignore
│ │ ├── Cargo.toml
│ │ └── src
│ │ │ ├── ceramic_cli.rs
│ │ │ └── main.rs
│ │ ├── ceramic-adapter-custom
│ │ ├── .gitignore
│ │ ├── Cargo.toml
│ │ └── src
│ │ │ ├── ceramic_cli.rs
│ │ │ ├── ceramic_http.rs
│ │ │ └── main.rs
│ │ └── curl-adapter
│ │ ├── Cargo.toml
│ │ └── src
│ │ └── main.rs
├── curl_template
│ ├── .gitignore
│ ├── README.md
│ ├── backend
│ │ ├── BackendConfig.json
│ │ ├── Cargo.toml
│ │ └── src
│ │ │ └── main.rs
│ ├── deploy.sh
│ ├── frontend
│ │ ├── .gitignore
│ │ ├── .prettierrc.js
│ │ ├── README.md
│ │ ├── package-lock.json
│ │ ├── package.json
│ │ ├── public
│ │ │ ├── favicon.ico
│ │ │ ├── index.html
│ │ │ ├── logo192.png
│ │ │ ├── logo512.png
│ │ │ ├── manifest.json
│ │ │ └── robots.txt
│ │ ├── src
│ │ │ ├── components
│ │ │ │ ├── App.scss
│ │ │ │ └── App.tsx
│ │ │ ├── fluence.ts
│ │ │ ├── index.scss
│ │ │ ├── index.tsx
│ │ │ ├── react-app-env.d.ts
│ │ │ └── setupTests.ts
│ │ └── tsconfig.json
│ ├── repl_config.toml
│ ├── request.air
│ └── script.air
├── ether-price-getter
│ ├── .gitignore
│ ├── Config.toml
│ ├── Readme.md
│ ├── air-scripts
│ │ └── get_eth_price.clj
│ ├── build.sh
│ ├── curl_adapter
│ │ ├── .gitignore
│ │ ├── Cargo.toml
│ │ └── src
│ │ │ └── main.rs
│ ├── curl_cfg.json
│ ├── ether_price_getter
│ │ ├── .gitignore
│ │ ├── Cargo.toml
│ │ └── src
│ │ │ ├── eth_price_getter.rs
│ │ │ ├── fce_results.rs
│ │ │ └── main.rs
│ └── ether_price_getter_cfg.json
├── fluence-cuckoo
│ ├── Readme.md
│ └── cuckoo-filter
│ │ ├── .gitignore
│ │ ├── Cargo.toml
│ │ ├── Config.toml
│ │ ├── air-scripts
│ │ ├── cuckoo_create_cf.clj
│ │ └── cuckoo_service_info.clj
│ │ ├── build.sh
│ │ ├── cuckoo_cfg.json
│ │ ├── src
│ │ └── main.rs
│ │ └── test.sh
├── multi-service
│ ├── Block-Getter-Config.toml
│ ├── Block-Getter-with-Converter-Config.toml
│ ├── Config.toml
│ ├── air-scripts
│ │ ├── add_stored_service.clj
│ │ ├── am_i_owner.clj
│ │ ├── curl_req.clj
│ │ ├── ethqlite_block_committer.clj
│ │ ├── ethqlite_init.clj
│ │ ├── ethqlite_owner.clj
│ │ ├── ethqlite_reset.clj
│ │ ├── ethqlite_roundtrip.clj
│ │ ├── get_address.clj
│ │ ├── get_block_simple.clj
│ │ ├── get_latest_block.clj
│ │ ├── get_latest_block_simple.clj
│ │ ├── hex2int.clj
│ │ ├── latest_reward_block.clj
│ │ ├── list_stored_services.clj
│ │ ├── multi_block_processor.clj
│ │ ├── remove_stored_service.clj
│ │ ├── sqlite_tester.clj
│ │ └── test_air.clj
│ ├── block_getter
│ │ ├── .gitignore
│ │ ├── Cargo.toml
│ │ └── src
│ │ │ ├── eth_block_getters.rs
│ │ │ └── main.rs
│ ├── config
│ │ ├── block_getter_cfg.json
│ │ ├── curl_cfg.json
│ │ ├── extract_miner_address_cfg.json
│ │ ├── hex_converter_cfg.json
│ │ └── my_keypair.json
│ ├── curl_adapter
│ │ ├── .gitignore
│ │ ├── Cargo.toml
│ │ └── src
│ │ │ └── main.rs
│ ├── ethqlite
│ │ ├── .gitignore
│ │ ├── Cargo.toml
│ │ ├── Config.toml
│ │ ├── build.sh
│ │ ├── ethqlite_cfg.json
│ │ ├── sqlite3_cfg.json
│ │ └── src
│ │ │ ├── auth.rs
│ │ │ ├── crud.rs
│ │ │ └── main.rs
│ ├── extract_miner_address
│ │ ├── Cargo.toml
│ │ └── src
│ │ │ └── main.rs
│ ├── hex_converter
│ │ ├── .gitignore
│ │ ├── Cargo.toml
│ │ └── src
│ │ │ └── main.rs
│ ├── scripts
│ │ ├── build.sh
│ │ └── deploy.sh
│ └── simple_range_func
│ │ ├── .gitignore
│ │ ├── Cargo.toml
│ │ └── src
│ │ └── main.rs
└── web3-examples
│ ├── web-frontend
│ ├── .gitignore
│ ├── .prettierrc.js
│ ├── README.md
│ ├── package-lock.json
│ ├── package.json
│ ├── public
│ │ ├── favicon.ico
│ │ ├── index.html
│ │ ├── logo192.png
│ │ ├── logo512.png
│ │ ├── manifest.json
│ │ └── robots.txt
│ ├── src
│ │ ├── components
│ │ │ ├── App.scss
│ │ │ └── App.tsx
│ │ ├── fluence.ts
│ │ ├── index.scss
│ │ ├── index.tsx
│ │ ├── react-app-env.d.ts
│ │ └── setupTests.ts
│ └── tsconfig.json
│ └── web3-examples
│ ├── .gitignore
│ ├── Config.toml
│ ├── Readme.md
│ ├── build.sh
│ ├── curl_adapter
│ ├── .gitignore
│ ├── Cargo.toml
│ ├── Config.json
│ └── src
│ │ └── main.rs
│ ├── docs
│ └── Frontend.md
│ └── facade
│ ├── .gitignore
│ ├── Cargo.toml
│ └── src
│ ├── data_processing.rs
│ ├── data_processing_tests.rs
│ ├── eth_calls.rs
│ ├── eth_calls_tests.rs
│ ├── eth_filter_test.rs
│ ├── eth_filters.rs
│ ├── eth_hashers.rs
│ ├── eth_type_test.rs
│ ├── eth_utils.rs
│ ├── fce_results.rs
│ ├── jsonrpc_helpers.rs
│ └── main.rs
├── community
└── README.md
├── js-client-examples
├── browser-example
│ ├── .fluence
│ │ └── schemas
│ │ │ └── fluence.json
│ ├── README.md
│ ├── fluence.yaml
│ └── src
│ │ ├── aqua
│ │ └── getting-started.aqua
│ │ └── frontend
│ │ ├── .gitignore
│ │ ├── .prettierrc.js
│ │ ├── jest.config.js
│ │ ├── package-lock.json
│ │ ├── package.json
│ │ ├── public
│ │ ├── favicon.ico
│ │ ├── index.html
│ │ ├── logo192.png
│ │ ├── logo512.png
│ │ ├── manifest.json
│ │ ├── marine-js.web.js
│ │ └── robots.txt
│ │ ├── src
│ │ ├── App.scss
│ │ ├── App.tsx
│ │ ├── __test__
│ │ │ └── test.spec.ts
│ │ ├── index.css
│ │ ├── index.tsx
│ │ ├── logo.svg
│ │ ├── react-app-env.d.ts
│ │ └── relays.json
│ │ └── tsconfig.json
├── hello-world
│ ├── .fluence
│ │ └── schemas
│ │ │ └── fluence.json
│ ├── README.md
│ ├── fluence.yaml
│ └── src
│ │ ├── aqua
│ │ └── hello-world.aqua
│ │ └── frontend
│ │ ├── .gitignore
│ │ ├── .prettierrc.cjs
│ │ ├── jest.config.cjs
│ │ ├── package-lock.json
│ │ ├── package.json
│ │ ├── src
│ │ ├── __test__
│ │ │ └── test.spec.ts
│ │ ├── index.ts
│ │ ├── main.ts
│ │ └── relays.json
│ │ └── tsconfig.json
├── marine-service
│ ├── .gitignore
│ ├── Cargo.toml
│ ├── README.md
│ ├── fluence.yaml
│ └── src
│ │ ├── aqua
│ │ ├── greeting.aqua
│ │ └── srv.aqua
│ │ └── frontend
│ │ ├── index.html
│ │ ├── package-lock.json
│ │ ├── package.json
│ │ ├── src
│ │ ├── compiled-aqua
│ │ │ ├── greeting.ts
│ │ │ └── main.ts
│ │ ├── index.ts
│ │ └── relays.json
│ │ ├── tsconfig.json
│ │ ├── vite.config.ts
│ │ └── wasm
│ │ └── greeting.wasm
└── node-example
│ ├── .fluence
│ └── schemas
│ │ └── fluence.json
│ ├── README.md
│ ├── fluence.yaml
│ └── src
│ ├── aqua
│ ├── calc.aqua
│ └── demo-calculation.aqua
│ └── frontend
│ ├── .gitignore
│ ├── .prettierrc.cjs
│ ├── jest.config.cjs
│ ├── package-lock.json
│ ├── package.json
│ ├── src
│ ├── __test__
│ │ └── test.spec.ts
│ ├── index.ts
│ ├── main.ts
│ └── relays.json
│ └── tsconfig.json
├── marine-examples
├── README.md
├── build_rs
│ ├── Cargo.toml
│ ├── Config.toml
│ ├── build.rs
│ ├── build.sh
│ └── src
│ │ └── main.rs
├── call_parameters
│ ├── .fluence
│ │ ├── aqua
│ │ │ ├── services.aqua
│ │ │ └── workers.aqua
│ │ ├── project-secrets.yaml
│ │ ├── schemas
│ │ │ ├── fluence.yaml.json
│ │ │ ├── module.yaml.json
│ │ │ ├── project-secrets.yaml.json
│ │ │ └── service.yaml.json
│ │ ├── tmp
│ │ │ └── Config.toml
│ │ └── workers.yaml
│ ├── .gitignore
│ ├── Cargo.toml
│ ├── fluence.yaml
│ ├── service
│ │ ├── modules
│ │ │ └── call_parameters
│ │ │ │ ├── Cargo.toml
│ │ │ │ ├── module.yaml
│ │ │ │ └── src
│ │ │ │ └── main.rs
│ │ └── service.yaml
│ └── src
│ │ └── aqua
│ │ └── main.aqua
├── greeting
│ ├── .gitignore
│ ├── Cargo.toml
│ ├── Config.toml
│ ├── README.md
│ ├── build.sh
│ ├── configs
│ │ ├── greeting_cfg.json
│ │ └── greeting_deploy_cfg.json
│ ├── module-exports
│ │ └── greeting.tar.gz
│ ├── package_modules.sh
│ └── src
│ │ └── main.rs
├── multiservice_marine_test
│ ├── .gitignore
│ ├── Cargo.toml
│ ├── README.md
│ ├── build.sh
│ ├── consumer
│ │ ├── Cargo.toml
│ │ ├── Config.toml
│ │ ├── build.sh
│ │ └── src
│ │ │ └── main.rs
│ ├── producer
│ │ ├── Cargo.toml
│ │ ├── Config.toml
│ │ ├── build.sh
│ │ └── src
│ │ │ └── main.rs
│ └── src
│ │ └── main.rs
├── records
│ ├── .gitignore
│ ├── Config.toml
│ ├── build.sh
│ ├── facade
│ │ ├── Cargo.toml
│ │ └── src
│ │ │ └── main.rs
│ ├── module-exports
│ │ └── records.tar.gz
│ ├── package_modules.sh
│ ├── pure
│ │ ├── Cargo.toml
│ │ └── src
│ │ │ └── main.rs
│ └── test-record
│ │ ├── Cargo.toml
│ │ └── src
│ │ └── test_record.rs
├── sqlite
│ ├── .fluence
│ │ ├── aqua
│ │ │ ├── services.aqua
│ │ │ └── workers.aqua
│ │ ├── modules
│ │ │ └── sqlite3.tar.gz_d35d7a28b1a8a55e87df96578d70ad46
│ │ │ │ ├── module.yaml
│ │ │ │ └── sqlite3.wasm
│ │ ├── project-secrets.yaml
│ │ ├── schemas
│ │ │ ├── fluence.yaml.json
│ │ │ ├── module.yaml.json
│ │ │ ├── project-secrets.yaml.json
│ │ │ └── service.yaml.json
│ │ └── tmp
│ │ │ └── Config.toml
│ ├── .gitignore
│ ├── Cargo.toml
│ ├── README.md
│ ├── cli_048_dependencies.txt
│ ├── fluence.yaml
│ └── service
│ │ ├── modules
│ │ └── sqlite_test
│ │ │ ├── Cargo.toml
│ │ │ ├── module.yaml
│ │ │ └── src
│ │ │ └── main.rs
│ │ └── service.yaml
└── url-downloader
│ ├── .fluence
│ ├── aqua
│ │ ├── services.aqua
│ │ └── workers.aqua
│ ├── project-secrets.yaml
│ ├── schemas
│ │ ├── fluence-lock.yaml.json
│ │ ├── fluence.yaml.json
│ │ ├── module.yaml.json
│ │ ├── project-secrets.yaml.json
│ │ ├── service.yaml.json
│ │ └── workers.yaml.json
│ ├── tmp
│ │ └── Config.toml
│ └── workers.yaml
│ ├── .gitignore
│ ├── Cargo.toml
│ ├── README.md
│ ├── download_url.aqua
│ ├── fluence.yaml
│ ├── module-exports
│ └── url_downloader.tar.gz
│ ├── service
│ ├── modules
│ │ ├── curl_adapter
│ │ │ ├── Cargo.toml
│ │ │ ├── module.yaml
│ │ │ └── src
│ │ │ │ └── main.rs
│ │ ├── local_storage
│ │ │ ├── Cargo.toml
│ │ │ ├── module.yaml
│ │ │ └── src
│ │ │ │ └── main.rs
│ │ └── url_downloader
│ │ │ ├── Cargo.toml
│ │ │ ├── module.yaml
│ │ │ └── src
│ │ │ └── main.rs
│ └── service.yaml
│ └── src
│ ├── aqua
│ └── main.aqua
│ └── package.json
└── quickstart
├── 1-browser-to-browser
├── .fluence
│ └── schemas
│ │ └── fluence.json
├── README.md
├── assets
│ ├── Connection-confirmation-to-network.png
│ ├── Peer-to-peer-communication-between-two-browser-client-peers.png
│ ├── Relay-Selection.png
│ └── getting-started.aqua.png
├── fluence.yaml
└── src
│ ├── aqua
│ └── getting-started.aqua
│ └── frontend
│ ├── .gitignore
│ ├── .prettierrc.js
│ ├── jest.config.js
│ ├── package-lock.json
│ ├── package.json
│ ├── public
│ ├── favicon.ico
│ ├── index.html
│ ├── logo192.png
│ ├── logo512.png
│ ├── manifest.json
│ ├── marine-js.web.js
│ └── robots.txt
│ ├── src
│ ├── App.scss
│ ├── App.tsx
│ ├── __test__
│ │ └── test.spec.ts
│ ├── index.css
│ ├── index.tsx
│ ├── logo.svg
│ ├── react-app-env.d.ts
│ └── relays.json
│ └── tsconfig.json
├── 2-browser-parallel-computation
├── .fluence
│ ├── aqua
│ │ ├── deals.aqua
│ │ ├── hosts.aqua
│ │ └── services.aqua
│ ├── env.yaml
│ ├── schemas
│ │ ├── env.json
│ │ ├── fluence.json
│ │ ├── module.json
│ │ ├── service.json
│ │ └── workers.json
│ └── workers.yaml
├── Cargo.toml
├── README.md
├── assets
│ ├── Browser-Parallel-Computation.png
│ └── Browser-To-Service-Implementation.png
├── fluence.yaml
└── src
│ ├── aqua
│ └── getting-started.aqua
│ ├── frontend
│ ├── .gitignore
│ ├── .prettierrc.js
│ ├── jest.config.js
│ ├── package-lock.json
│ ├── package.json
│ ├── public
│ │ ├── favicon.ico
│ │ ├── index.html
│ │ ├── logo192.png
│ │ ├── logo512.png
│ │ ├── manifest.json
│ │ ├── marine-js.web.js
│ │ └── robots.txt
│ ├── src
│ │ ├── App.scss
│ │ ├── App.tsx
│ │ ├── __test__
│ │ │ └── test.spec.ts
│ │ ├── index.css
│ │ ├── index.tsx
│ │ ├── logo.svg
│ │ ├── react-app-env.d.ts
│ │ └── relays.json
│ └── tsconfig.json
│ └── services
│ └── adder
│ ├── modules
│ └── adder
│ │ ├── Cargo.toml
│ │ ├── module.yaml
│ │ └── src
│ │ └── main.rs
│ └── service.yaml
└── Readme.md
/.github/renovate.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://docs.renovatebot.com/renovate-schema.json",
3 | "extends": [
4 | "config:base"
5 | ],
6 | "ignorePaths": ["archived/**"],
7 | "ignoreUnstable": false,
8 | "packageRules": [
9 | {
10 | "matchPackagePatterns": ["*"],
11 | "enabled": false
12 | },
13 | {
14 | "matchLanguages": ["rust"],
15 | "matchPackageNames": ["marine-rs-sdk","marine-rs-sdk-test"],
16 | "groupName": "Marine Rust SDK",
17 | "enabled": true
18 | },
19 | {
20 | "matchLanguages": ["js"],
21 | "matchPackagePatterns": ["^@fluencelabs/*"],
22 | "groupName": "Fluence JS",
23 | "enabled": true
24 | }
25 | ]
26 | }
27 |
--------------------------------------------------------------------------------
/.github/workflows/ci.yml:
--------------------------------------------------------------------------------
1 | name: ci
2 |
3 | on:
4 | pull_request:
5 | branches:
6 | - "main"
7 | paths:
8 | - "!**.md"
9 |
10 | concurrency:
11 | group: "gitops-${{ github.ref }}"
12 | cancel-in-progress: true
13 |
14 | jobs:
15 | js:
16 | name: "JS projects"
17 | uses: ./.github/workflows/js-projects.yml
18 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | target
2 | node_modules
3 | .idea
4 | .DS_Store
5 | Cargo.lock
6 | .vscode
7 | .repl_history
8 | /target
9 | **/**.bak
10 | **/**.bk
11 | /artifacts
12 | keypair.json
13 | *.wasm
14 |
15 |
--------------------------------------------------------------------------------
/aqua-examples/aqua-ipfs-integration/.gitignore:
--------------------------------------------------------------------------------
1 | # Generated by Cargo
2 | # will have compiled files and executables
3 | **/target/
4 |
5 | # These are backup files generated by rustfmt
6 | **/*.rs.bk
7 |
8 | # Added by cargo
9 | .idea
10 |
11 | **/artifacts/*.wasm
12 |
13 | **/node_modules
14 | **/dist
15 | .DS_store
16 | .bic_cache
17 |
--------------------------------------------------------------------------------
/aqua-examples/aqua-ipfs-integration/.npmrc:
--------------------------------------------------------------------------------
1 | engine-strict = true
--------------------------------------------------------------------------------
/aqua-examples/aqua-ipfs-integration/.prettierrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | semi: true,
3 | trailingComma: 'all',
4 | singleQuote: true,
5 | printWidth: 120,
6 | tabWidth: 4,
7 | useTabs: false,
8 | };
9 |
--------------------------------------------------------------------------------
/aqua-examples/aqua-ipfs-integration/aqua/.gitignore:
--------------------------------------------------------------------------------
1 |
2 | # fluence
3 |
4 | src
5 | !src/index.ts
--------------------------------------------------------------------------------
/aqua-examples/aqua-ipfs-integration/aqua/aqua/exports.aqua:
--------------------------------------------------------------------------------
1 | module Exports
2 |
3 | import "@fluencelabs/aqua-ipfs/ipfs-api.aqua"
4 |
5 | export set_timeout, get_external_swarm_multiaddr, get_external_api_multiaddr
--------------------------------------------------------------------------------
/aqua-examples/aqua-ipfs-integration/aqua/aqua/process_files.aqua:
--------------------------------------------------------------------------------
1 | module ProcessFiles declares *
2 |
3 | data SizeResult:
4 | size: u32
5 | success: bool
6 | error: string
7 |
8 | data WriteResult:
9 | path: string
10 | success: bool
11 | error: string
12 |
13 | service ProcessFiles:
14 | file_size(file_path: string) -> SizeResult
15 | write_file_size(size: u32) -> WriteResult
16 |
--------------------------------------------------------------------------------
/aqua-examples/aqua-ipfs-integration/aqua/src/index.ts:
--------------------------------------------------------------------------------
1 | export * from "./process";
2 | export * from "./exports";
3 |
--------------------------------------------------------------------------------
/aqua-examples/aqua-ipfs-integration/nodejs/.prettierrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | semi: true,
3 | trailingComma: 'all',
4 | singleQuote: true,
5 | printWidth: 120,
6 | tabWidth: 4,
7 | useTabs: false,
8 | };
9 |
--------------------------------------------------------------------------------
/aqua-examples/aqua-ipfs-integration/nodejs/jest.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | preset: 'ts-jest',
3 | testPathIgnorePatterns: ['dist'],
4 | };
5 |
--------------------------------------------------------------------------------
/aqua-examples/aqua-ipfs-integration/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "aqua-ipfs-integration",
3 | "workspaces": [
4 | "aqua",
5 | "nodejs",
6 | "web"
7 | ],
8 | "scripts": {
9 | "build": "check-node-version --npm '>= 7' && npm run build -w aqua -w nodejs -w web"
10 | },
11 | "dependencies": {
12 | "ipfs-http-client": "^56.0.3",
13 | "@fluencelabs/aqua": "0.10.3",
14 | "@fluencelabs/fluence": "0.28.0",
15 | "typescript": "^4.6.3"
16 | },
17 | "engines": {
18 | "npm": ">=7",
19 | "node": ">=15.0.0"
20 | },
21 | "devDependencies": {
22 | "check-node-version": "^4.2.1"
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/aqua-examples/aqua-ipfs-integration/service/.gitignore:
--------------------------------------------------------------------------------
1 | debug/
2 | target/
3 | **/*.bk
4 | **/*.bak
5 |
--------------------------------------------------------------------------------
/aqua-examples/aqua-ipfs-integration/service/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "process_files"
3 | version = "0.1.0"
4 | authors = ["Fluence Labs"]
5 | edition = "2018"
6 | description = "Marine service that processes files in various ways"
7 | license = "Apache-2.0"
8 |
9 | [[bin]]
10 | name = "process_files"
11 | path = "src/main.rs"
12 |
13 | [dependencies]
14 | marine-rs-sdk = { version = "0.10.1", features = ["logger"] }
15 | log = "0.4.14"
16 | rand = "0.8.4"
17 |
18 | [dev-dependencies]
19 | marine-rs-sdk-test = "0.11.0"
20 |
21 | [profile.release]
22 | opt-level = "s"
23 |
--------------------------------------------------------------------------------
/aqua-examples/aqua-ipfs-integration/service/Config.toml:
--------------------------------------------------------------------------------
1 | modules_dir = "artifacts/"
2 |
3 | [[module]]
4 | name = "process_files"
5 | max_heap_size = "10 Kib"
6 | logger_enabled = true
7 |
--------------------------------------------------------------------------------
/aqua-examples/aqua-ipfs-integration/service/scripts/build.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | set -o errexit -o nounset -o pipefail
3 |
4 | # set current working directory to script parent directory to run script from everywhere
5 | cd "$(dirname "$0")"/..
6 |
7 | mkdir -p artifacts
8 | rm -f artifacts/*.wasm
9 | marine build --release
10 | cp target/wasm32-wasi/release/process_files.wasm artifacts/
11 | marine aqua artifacts/process_files.wasm >../aqua/aqua/process_files.aqua
12 |
--------------------------------------------------------------------------------
/aqua-examples/aqua-ipfs-integration/web/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # production
12 | /build
13 |
14 | # misc
15 | .DS_Store
16 | .env.local
17 | .env.development.local
18 | .env.test.local
19 | .env.production.local
20 |
21 | npm-debug.log*
22 | yarn-debug.log*
23 | yarn-error.log*
24 |
25 | # fluence
26 |
27 | src/_aqua/*
28 |
29 | public/*.wasm
30 | public/runnerScript.*
31 |
--------------------------------------------------------------------------------
/aqua-examples/aqua-ipfs-integration/web/images/ipfs_comp_web_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fluencelabs/examples/fbfc344abfca1af2b5466554fec7af9d6f0d5eef/aqua-examples/aqua-ipfs-integration/web/images/ipfs_comp_web_1.png
--------------------------------------------------------------------------------
/aqua-examples/aqua-ipfs-integration/web/images/ipfs_comp_web_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fluencelabs/examples/fbfc344abfca1af2b5466554fec7af9d6f0d5eef/aqua-examples/aqua-ipfs-integration/web/images/ipfs_comp_web_2.png
--------------------------------------------------------------------------------
/aqua-examples/aqua-ipfs-integration/web/images/ipfs_comp_web_3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fluencelabs/examples/fbfc344abfca1af2b5466554fec7af9d6f0d5eef/aqua-examples/aqua-ipfs-integration/web/images/ipfs_comp_web_3.png
--------------------------------------------------------------------------------
/aqua-examples/aqua-ipfs-integration/web/images/ipfs_comp_web_4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fluencelabs/examples/fbfc344abfca1af2b5466554fec7af9d6f0d5eef/aqua-examples/aqua-ipfs-integration/web/images/ipfs_comp_web_4.png
--------------------------------------------------------------------------------
/aqua-examples/aqua-ipfs-integration/web/jest.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | preset: 'jest-puppeteer',
3 | testMatch: ['**/?(*.)+(spec|test).[t]s'],
4 | testPathIgnorePatterns: ['/node_modules/', 'dist'],
5 | transform: {
6 | '^.+\\.ts?$': 'ts-jest',
7 | },
8 | };
9 |
--------------------------------------------------------------------------------
/aqua-examples/aqua-ipfs-integration/web/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fluencelabs/examples/fbfc344abfca1af2b5466554fec7af9d6f0d5eef/aqua-examples/aqua-ipfs-integration/web/public/favicon.ico
--------------------------------------------------------------------------------
/aqua-examples/aqua-ipfs-integration/web/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fluencelabs/examples/fbfc344abfca1af2b5466554fec7af9d6f0d5eef/aqua-examples/aqua-ipfs-integration/web/public/logo192.png
--------------------------------------------------------------------------------
/aqua-examples/aqua-ipfs-integration/web/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fluencelabs/examples/fbfc344abfca1af2b5466554fec7af9d6f0d5eef/aqua-examples/aqua-ipfs-integration/web/public/logo512.png
--------------------------------------------------------------------------------
/aqua-examples/aqua-ipfs-integration/web/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "React App",
3 | "name": "Create React App Sample",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | },
10 | {
11 | "src": "logo192.png",
12 | "type": "image/png",
13 | "sizes": "192x192"
14 | },
15 | {
16 | "src": "logo512.png",
17 | "type": "image/png",
18 | "sizes": "512x512"
19 | }
20 | ],
21 | "start_url": ".",
22 | "display": "standalone",
23 | "theme_color": "#000000",
24 | "background_color": "#ffffff"
25 | }
26 |
--------------------------------------------------------------------------------
/aqua-examples/aqua-ipfs-integration/web/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 | Disallow:
4 |
--------------------------------------------------------------------------------
/aqua-examples/aqua-ipfs-integration/web/src/Components/ConnectedInfo.tsx:
--------------------------------------------------------------------------------
1 | import { useRecoilValue } from "recoil";
2 | import { isConnectedState, selfPeerIdState } from "../appState";
3 | import { TextWithLabel } from "./TextInput";
4 |
5 | export const ConnectedInfo = () => {
6 | const selfPeerId = useRecoilValue(selfPeerIdState);
7 | const client = useRecoilValue(isConnectedState);
8 | if (client === null) {
9 | return <>>;
10 | }
11 |
12 | return (
13 | <>
14 |
Connected
15 |
16 |
17 | >
18 | );
19 | };
20 |
--------------------------------------------------------------------------------
/aqua-examples/aqua-ipfs-integration/web/src/Components/ConnectionForm.tsx:
--------------------------------------------------------------------------------
1 | import { relayNodes, useClientConnect } from "../appLogic";
2 |
3 | export const ConnectionForm = () => {
4 | const connect = useClientConnect();
5 |
6 | return (
7 | <>
8 | Intro 4: IPFS storage + Fluence compute
9 | Pick a relay
10 |
11 | {relayNodes.map((x) => (
12 |
13 | {x.peerId}
14 | connect(x.multiaddr)}>
15 | Connect
16 |
17 |
18 | ))}
19 |
20 | >
21 | );
22 | };
23 |
--------------------------------------------------------------------------------
/aqua-examples/aqua-ipfs-integration/web/src/Components/IpfsDeploymentInfo.tsx:
--------------------------------------------------------------------------------
1 | import { useRecoilValue } from "recoil";
2 | import { useRemoveService } from "../appLogic";
3 | import { serviceIdState, wasmState } from "../appState";
4 | import { TextWithLabel } from "./TextInput";
5 |
6 | export const IpfsDeploymentInfo = () => {
7 | const wasm = useRecoilValue(wasmState);
8 | const serviceId = useRecoilValue(serviceIdState);
9 | const removeService = useRemoveService();
10 |
11 | return (
12 | <>
13 |
14 | Service deployed{" "}
15 |
16 | remove
17 |
18 |
19 |
20 |
21 | >
22 | );
23 | };
24 |
--------------------------------------------------------------------------------
/aqua-examples/aqua-ipfs-integration/web/src/Components/SizeCalcResult.tsx:
--------------------------------------------------------------------------------
1 | import { useRecoilValue } from "recoil";
2 | import { fileSizeCIDState, fileSizeState } from "../appState";
3 | import { TextWithLabel } from "./TextInput";
4 |
5 | export const SizeCalcResult = () => {
6 | const fileSize = useRecoilValue(fileSizeState);
7 | const fileSizeCID = useRecoilValue(fileSizeCIDState);
8 |
9 | return (
10 | <>
11 | Result
12 |
13 |
14 | File size has been calculated and displayed below. Also the result of
15 | the calculation has been uploaded to IPFS and is available under it's
16 | CID
17 |
18 |
19 |
20 |
21 | >
22 | );
23 | };
24 |
--------------------------------------------------------------------------------
/aqua-examples/aqua-ipfs-integration/web/src/index.css:
--------------------------------------------------------------------------------
1 | body {
2 | margin: 0;
3 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
4 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
5 | sans-serif;
6 | -webkit-font-smoothing: antialiased;
7 | -moz-osx-font-smoothing: grayscale;
8 | }
9 |
10 | code {
11 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
12 | monospace;
13 | }
14 |
--------------------------------------------------------------------------------
/aqua-examples/aqua-ipfs-integration/web/src/index.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import ReactDOM from "react-dom";
3 | import "./index.css";
4 | import App from "./App";
5 | import { RecoilRoot } from "recoil";
6 |
7 | ReactDOM.render(
8 |
9 |
10 |
11 |
12 | ,
13 | document.getElementById("root")
14 | );
15 |
--------------------------------------------------------------------------------
/aqua-examples/aqua-ipfs-integration/web/src/react-app-env.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 |
--------------------------------------------------------------------------------
/aqua-examples/aqua-ipfs-integration/web/src/util.ts:
--------------------------------------------------------------------------------
1 | import { Multiaddr, protocols } from "multiaddr";
2 |
3 | export const decapsulateP2P = (rpcAddr: string) => {
4 | return new Multiaddr(rpcAddr)
5 | .decapsulateCode(protocols.names.p2p.code)
6 | .toString();
7 | };
8 |
9 | export const fromOption = (opt: T | T[] | null): T | null => {
10 | if (Array.isArray(opt)) {
11 | if (opt.length === 0) {
12 | return null;
13 | }
14 |
15 | opt = opt[0];
16 | }
17 | if (opt === null) {
18 | return null;
19 | }
20 |
21 | return opt;
22 | };
23 |
--------------------------------------------------------------------------------
/aqua-examples/aqua-ipfs-integration/web/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es5",
4 | "lib": [
5 | "dom",
6 | "dom.iterable",
7 | "esnext"
8 | ],
9 | "allowJs": true,
10 | "skipLibCheck": true,
11 | "esModuleInterop": true,
12 | "allowSyntheticDefaultImports": true,
13 | "strict": true,
14 | "forceConsistentCasingInFileNames": true,
15 | "noFallthroughCasesInSwitch": true,
16 | "module": "esnext",
17 | "moduleResolution": "node",
18 | "resolveJsonModule": true,
19 | "isolatedModules": true,
20 | "noEmit": true,
21 | "jsx": "react-jsx"
22 | },
23 | "include": [
24 | "src"
25 | ]
26 | }
27 |
--------------------------------------------------------------------------------
/aqua-examples/decentralized-blockchain-gateway/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | debug/
3 | target/
4 | Cargo.lock
5 | **/*.bk
6 | **/*.bak
7 |
8 | # recommended by Fluence Labs:
9 | .idea
10 | .fluence
11 | **/node_modules
12 | **/target/
13 | .repl_history
14 | .vscode/settings.json
15 | src/ts/src/aqua
16 | src/js/src/aqua
17 |
--------------------------------------------------------------------------------
/aqua-examples/decentralized-blockchain-gateway/Cargo.toml:
--------------------------------------------------------------------------------
1 | [workspace]
2 | members = [
3 | "wasm-modules/curl-adapter",
4 | "wasm-modules/multi-provider-query",
5 | "wasm-modules/simple-quorum",
6 | "wasm-modules/utilities",
7 | "wasm-modules/eth-rpc",
8 | "wasm-modules/ipfs-adapter",
9 | "wasm-modules/ipfs-cli"
10 | ]
11 |
12 | [profile.release]
13 | opt-level = "s"
14 |
--------------------------------------------------------------------------------
/aqua-examples/decentralized-blockchain-gateway/aqua/ipfs_test.aqua:
--------------------------------------------------------------------------------
1 | -- aqua/ipfs_test.aqua
2 | data FunctionAddress:
3 | peer_id: string
4 | service_id: string
5 |
6 | service IpfsCli("service-is"):
7 | params_from_cid(multiaddr: string, cid: string) -> []FunctionAddress
8 |
9 | func check_utility_addrs(cid: string, multiaddr: string, ipfs_node: string, ipfs_service_id: string) -> []FunctionAddress:
10 | on ipfs_node:
11 | IpfsCli ipfs_service_id
12 | func_addrs <- IpfsCli.params_from_cid(multiaddr, cid)
13 | <- func_addrs
--------------------------------------------------------------------------------
/aqua-examples/decentralized-blockchain-gateway/configs/Config.toml:
--------------------------------------------------------------------------------
1 | modules_dir = "artifacts/"
2 |
3 | [[module]]
4 | name = "curl_adapter"
5 | max_heap_size = "2 MiB"
6 | logger_enabled = true
7 |
8 | [module.mounted_binaries]
9 | curl = "/usr/bin/curl"
10 |
11 | [[module]]
12 | name = "ipfs_adapter"
13 | max_heap_size = "2 MiB"
14 | logger_enabled = true
15 |
16 | [module.mounted_binaries]
17 | ipfs = "/usr/local/bin/ipfs"
18 |
19 | [[module]]
20 | name = "multi_provider_query"
21 | max_heap_size = "2 MiB"
22 | logger_enabled = true
23 |
24 |
25 | [[module]]
26 | name = "simple_quorum"
27 | max_heap_size = "2 MiB"
28 | logger_enabled = true
29 |
30 |
31 | [[module]]
32 | name = "ipfs_cli"
33 | max_heap_size = "2 MiB"
34 | logger_enabled = true
35 |
36 | [[module]]
37 | name = "utilities"
38 | max_heap_size = "2 MiB"
39 | logger_enabled = true
40 |
--------------------------------------------------------------------------------
/aqua-examples/decentralized-blockchain-gateway/configs/services/eth-rpc/service.yaml:
--------------------------------------------------------------------------------
1 | # yaml-language-server: $schema=../../../.fluence/schemas/service.yaml.json
2 |
3 | # 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
4 |
5 | # Documentation: https://github.com/fluencelabs/fluence-cli/tree/main/docs/configs/service.md
6 |
7 | version: 0
8 | name: eth_rpc
9 | modules:
10 | facade:
11 | get: ../../../wasm-modules/eth-rpc
12 | curl-adapter:
13 | get: ../../../wasm-modules/curl-adapter
14 |
--------------------------------------------------------------------------------
/aqua-examples/decentralized-blockchain-gateway/configs/services/ipfs-package/service.yaml:
--------------------------------------------------------------------------------
1 | # yaml-language-server: $schema=../../../.fluence/schemas/service.yaml.json
2 |
3 | # 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
4 |
5 | # Documentation: https://github.com/fluencelabs/fluence-cli/tree/main/docs/configs/service.md
6 |
7 | version: 0
8 | name: ipfs_package
9 | modules:
10 | facade:
11 | get: ../../../wasm-modules/ipfs-cli
12 | ipfs-adapter:
13 | get: ../../../wasm-modules/ipfs-adapter
14 |
--------------------------------------------------------------------------------
/aqua-examples/decentralized-blockchain-gateway/configs/services/multi-provider-query/service.yaml:
--------------------------------------------------------------------------------
1 | # yaml-language-server: $schema=../../../.fluence/schemas/service.yaml.json
2 |
3 | # 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
4 |
5 | # Documentation: https://github.com/fluencelabs/fluence-cli/tree/main/docs/configs/service.md
6 |
7 | version: 0
8 | name: multi_provider_query
9 | modules:
10 | facade:
11 | get: ../../../wasm-modules/multi-provider-query
12 | curl-adapter:
13 | get: ../../../wasm-modules/curl-adapter
14 |
--------------------------------------------------------------------------------
/aqua-examples/decentralized-blockchain-gateway/configs/services/simple-quorum/service.yaml:
--------------------------------------------------------------------------------
1 | # yaml-language-server: $schema=../../../.fluence/schemas/service.yaml.json
2 |
3 | # 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
4 |
5 | # Documentation: https://github.com/fluencelabs/fluence-cli/tree/main/docs/configs/service.md
6 |
7 | version: 0
8 | name: simple_quorum
9 | modules:
10 | facade:
11 | get: ../../../wasm-modules/simple-quorum
12 |
--------------------------------------------------------------------------------
/aqua-examples/decentralized-blockchain-gateway/configs/services/utilities/service.yaml:
--------------------------------------------------------------------------------
1 | # yaml-language-server: $schema=../../../.fluence/schemas/service.yaml.json
2 |
3 | # 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
4 |
5 | # Documentation: https://github.com/fluencelabs/fluence-cli/tree/main/docs/configs/service.md
6 |
7 | version: 0
8 | name: utilities
9 | modules:
10 | facade:
11 | get: ../../../wasm-modules/utilities
12 |
--------------------------------------------------------------------------------
/aqua-examples/decentralized-blockchain-gateway/fluence-lock.yaml:
--------------------------------------------------------------------------------
1 | # yaml-language-server: $schema=.fluence/schemas/fluence-lock.yaml.json
2 |
3 | # Defines a lock file for Fluence Project dependencies. When dependencies are installed - their exact versions are saved here.
4 |
5 | # Documentation: https://github.com/fluencelabs/fluence-cli/tree/main/docs/configs/fluence-lock.md
6 |
7 | version: 0
8 | cargo:
9 | marine: 0.12.5
10 | mrepl: 0.18.8
11 | npm:
12 | "@fluencelabs/aqua": 0.9.4
13 | "@fluencelabs/aqua-lib": 0.6.0
14 | "@fluencelabs/spell": 0.0.1
15 |
--------------------------------------------------------------------------------
/aqua-examples/decentralized-blockchain-gateway/gateway/config.json:
--------------------------------------------------------------------------------
1 | {
2 | "providers": [
3 | "https://goerli.infura.io/v3/77214656b25f4cad9cd2540c6d40c301",
4 | "https://goerli.infura.io/v3/c48f3b538f154204ad53d04aa8990544"
5 | ],
6 | "mode": "quorum",
7 | "relay": "/dns4/kras-02.fluence.dev/tcp/19001/wss/p2p/12D3KooWHLxVhUQyAuZe6AHMB29P7wkvTNMn7eDMcsqimJYLKREf",
8 | "serviceId": "25bf2293-7503-4a01-af00-d1b7d089ca37",
9 | "port": 3000,
10 | "counterServiceId": null,
11 | "counterPeerId": null,
12 | "quorumServiceId": null,
13 | "quorumPeerId": null,
14 | "quorumNumber": 2,
15 | "quorumTimeout": null,
16 | "requestTimeout": null
17 | }
18 |
19 |
--------------------------------------------------------------------------------
/aqua-examples/decentralized-blockchain-gateway/gateway/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@fluencelabs/aqua-eth-gateway",
3 | "version": "0.0.15",
4 | "description": "",
5 | "main": "src/index.js",
6 | "type": "module",
7 | "scripts": {
8 | "run:example": "node src/index.js \"config.json\"",
9 | "run": "node src/index.js",
10 | "req": "node web3run.js"
11 | },
12 | "bin": {
13 | "aqua-eth-gateway": "src/index.js"
14 | },
15 | "files": [
16 | "src/*",
17 | "aqua/*",
18 | "aqua-compiled/*"
19 | ],
20 | "author": "Fluence Labs",
21 | "license": "Apache-2.0",
22 | "dependencies": {
23 | "json-rpc-2.0": "1.4.2",
24 | "web3": "1.8.2",
25 | "@fluencelabs/js-client.node": "0.7.1",
26 | "@fluencelabs/js-client.api": "0.13.1"
27 | },
28 | "devDependencies": {
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/aqua-examples/decentralized-blockchain-gateway/gateway/src/arguments.js:
--------------------------------------------------------------------------------
1 | import {configHelp} from "./config.js";
2 |
3 | export function readArguments(args) {
4 | const configPath = args[0]
5 |
6 | let errors = []
7 |
8 | if (!configPath) {
9 | errors.push("Specify config with uri to ethereum RPC providers")
10 | }
11 |
12 | return {
13 | configPath, errors,
14 | help: "Example: aqua-eth-gateway \n" + configHelp
15 | }
16 | }
--------------------------------------------------------------------------------
/aqua-examples/decentralized-blockchain-gateway/gateway/web3run.js:
--------------------------------------------------------------------------------
1 | import Web3 from 'web3';
2 |
3 | const web3 = new Web3("http://localhost:3000");
4 |
5 | async function main() {
6 | const bn = await web3.eth.getBlockNumber()
7 | await web3.eth.getBlockNumber()
8 | await web3.eth.getBlockNumber()
9 | await web3.eth.getBlockNumber()
10 | await web3.eth.getBlockNumber()
11 | await web3.eth.getBlockNumber()
12 | await web3.eth.getBlockNumber()
13 | console.log(bn)
14 |
15 | const resp = await web3.eth.getTransaction("0x8bad403edde37642e4dab6c91eeca77b979fce1c979c14ca8755f5c3573eaeb4")
16 | console.log(resp)
17 | }
18 |
19 | main();
20 |
21 |
--------------------------------------------------------------------------------
/aqua-examples/decentralized-blockchain-gateway/parameters/quorum_addrs.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "peer_id": "12D3KooWAKNos2KogexTXhrkMZzFYpLHuWJ4PgoAhurSAv7o5CWA",
4 | "service_id": "366e3fdd-0d8d-4f8f-bae6-e2e541a17550"
5 | }
6 | ]
7 |
--------------------------------------------------------------------------------
/aqua-examples/decentralized-blockchain-gateway/parameters/service_addrs.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "peer_id": "12D3KooWJ4bTHirdTFNZpCS72TAzwtdmavTBkkEXtzo6wHL25CtE",
4 | "service_id": "d9124884-3c42-43d6-9a1f-1b645d073c3f"
5 | },
6 | {
7 | "peer_id": "12D3KooWAKNos2KogexTXhrkMZzFYpLHuWJ4PgoAhurSAv7o5CWA",
8 | "service_id": "3c321110-b069-42c6-b5e0-aed73d976a60"
9 | },
10 | {
11 | "peer_id": "12D3KooWMMGdfVEJ1rWe1nH1nehYDzNEHhg5ogdfiGk88AupCMnf",
12 | "service_id": "84d4d018-0c13-4d6d-8c11-599a3919911c"
13 | }
14 | ]
15 |
--------------------------------------------------------------------------------
/aqua-examples/decentralized-blockchain-gateway/parameters/utility_addrs.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "peer_id": "12D3KooWAKNos2KogexTXhrkMZzFYpLHuWJ4PgoAhurSAv7o5CWA",
4 | "service_id": "ea75efe8-52da-4741-9228-605ab78c7092"
5 | }
6 | ]
7 |
--------------------------------------------------------------------------------
/aqua-examples/decentralized-blockchain-gateway/service-packages/eth_rpc.tar.gz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fluencelabs/examples/fbfc344abfca1af2b5466554fec7af9d6f0d5eef/aqua-examples/decentralized-blockchain-gateway/service-packages/eth_rpc.tar.gz
--------------------------------------------------------------------------------
/aqua-examples/decentralized-blockchain-gateway/service-packages/ipfs_package.tar.gz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fluencelabs/examples/fbfc344abfca1af2b5466554fec7af9d6f0d5eef/aqua-examples/decentralized-blockchain-gateway/service-packages/ipfs_package.tar.gz
--------------------------------------------------------------------------------
/aqua-examples/decentralized-blockchain-gateway/service-packages/multi_provider_query_package.tar.gz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fluencelabs/examples/fbfc344abfca1af2b5466554fec7af9d6f0d5eef/aqua-examples/decentralized-blockchain-gateway/service-packages/multi_provider_query_package.tar.gz
--------------------------------------------------------------------------------
/aqua-examples/decentralized-blockchain-gateway/service-packages/simple_quorum_package.tar.gz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fluencelabs/examples/fbfc344abfca1af2b5466554fec7af9d6f0d5eef/aqua-examples/decentralized-blockchain-gateway/service-packages/simple_quorum_package.tar.gz
--------------------------------------------------------------------------------
/aqua-examples/decentralized-blockchain-gateway/service-packages/utilities_package.tar.gz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fluencelabs/examples/fbfc344abfca1af2b5466554fec7af9d6f0d5eef/aqua-examples/decentralized-blockchain-gateway/service-packages/utilities_package.tar.gz
--------------------------------------------------------------------------------
/aqua-examples/decentralized-blockchain-gateway/wasm-modules/curl-adapter/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "curl-adapter"
3 | version = "0.1.0"
4 | authors = ["Fluence Labs"]
5 | edition = "2018"
6 | publish = false
7 |
8 | [[bin]]
9 | path = "src/main.rs"
10 | name = "curl-adapter"
11 |
12 | [dependencies]
13 | marine-rs-sdk = "0.10.1"
14 | log = "0.4.8"
15 |
--------------------------------------------------------------------------------
/aqua-examples/decentralized-blockchain-gateway/wasm-modules/curl-adapter/module.yaml:
--------------------------------------------------------------------------------
1 | # yaml-language-server: $schema=../../.fluence/schemas/module.yaml.json
2 |
3 | # 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
4 |
5 | # Documentation: https://github.com/fluencelabs/fluence-cli/tree/main/docs/configs/module.md
6 |
7 | version: 0
8 | type: rust
9 | name: curl-adapter
10 | mountedBinaries:
11 | curl: /usr/bin/curl
12 |
--------------------------------------------------------------------------------
/aqua-examples/decentralized-blockchain-gateway/wasm-modules/eth-rpc/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "eth-rpc"
3 | version = "0.1.0"
4 | edition = "2021"
5 |
6 | [[bin]]
7 | name = "eth-rpc"
8 | path = "src/main.rs"
9 |
10 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
11 |
12 | [dependencies]
13 | web3 = { version = "0.18.0", features = [], default-features = false }
14 | #async-std = "1.12.0" # async-std does not support wasm32-wasi
15 | serde_json = "1.0.91"
16 | serde = "1.0.152"
17 | jsonrpc-core = "18.0.0"
18 | tokio = { version = "1.24.1", default-features = false, features = ["rt"] }
19 | eyre = "0.6.8"
20 |
21 | marine-rs-sdk = "0.10.1"
22 |
23 | [dev-dependencies]
24 | marine-rs-sdk-test = "0.11.0"
25 |
--------------------------------------------------------------------------------
/aqua-examples/decentralized-blockchain-gateway/wasm-modules/eth-rpc/README.md:
--------------------------------------------------------------------------------
1 | # Build eth-rpc.wasm
2 | ```shell
3 | marine build --release
4 | ```
5 |
6 | # Build curl-adapter.wasm
7 | ```shell
8 | cd ../curl-adapter
9 | marine build --release
10 | ```
11 |
12 | # Run tests
13 | ```shell
14 | ./test.sh
15 | ```
16 | ## It works!~
17 |
--------------------------------------------------------------------------------
/aqua-examples/decentralized-blockchain-gateway/wasm-modules/eth-rpc/module.yaml:
--------------------------------------------------------------------------------
1 | # yaml-language-server: $schema=../../.fluence/schemas/module.yaml.json
2 |
3 | # 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
4 |
5 | # Documentation: https://github.com/fluencelabs/fluence-cli/tree/main/docs/configs/module.md
6 |
7 | version: 0
8 | type: rust
9 | name: eth-rpc
10 |
--------------------------------------------------------------------------------
/aqua-examples/decentralized-blockchain-gateway/wasm-modules/eth-rpc/rust-toolchain.toml:
--------------------------------------------------------------------------------
1 | [toolchain]
2 | channel = "nightly-2022-12-06"
3 | targets = [ "x86_64-unknown-linux-gnu" ]
4 | components = [ "rustfmt" ]
5 |
--------------------------------------------------------------------------------
/aqua-examples/decentralized-blockchain-gateway/wasm-modules/eth-rpc/test.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | set -o nounset
4 | set -o errexit
5 | set -o pipefail
6 |
7 | cd "$(dirname "$0")"
8 |
9 | mkdir -p tests_artifacts
10 |
11 | # build eth-rpc.wasm
12 | marine build --release
13 | cp ./target/wasm32-wasi/release/eth-rpc.wasm tests_artifacts/
14 |
15 | # build curl-adapter.wasm
16 | (cd ../curl-adapter; marine build --release)
17 | cp ../curl-adapter/target/wasm32-wasi/release/curl_adapter.wasm tests_artifacts/
18 |
19 | #if [[ ! -f "tests_artifacts/sqlite3.wasm" ]]; then
20 | # # download SQLite 3
21 | # curl -L https://github.com/fluencelabs/sqlite/releases/download/v0.15.0_w/sqlite3.wasm -o tests_artifacts/sqlite3.wasm
22 | #fi
23 |
24 | # run tests
25 | cargo nextest run --release --no-fail-fast --nocapture
26 |
--------------------------------------------------------------------------------
/aqua-examples/decentralized-blockchain-gateway/wasm-modules/eth-rpc/tests_artifacts/Config.toml:
--------------------------------------------------------------------------------
1 | modules_dir = "."
2 |
3 | #[[module]]
4 | #name = "sqlite3"
5 | #mem_pages_count = 100
6 | #logger_enabled = false
7 |
8 | #[module.wasi]
9 | #preopened_files = ["/tmp"]
10 | #mapped_dirs = { "tmp" = "." }
11 |
12 | [[module]]
13 | name = "curl_adapter"
14 | max_heap_size = "2 MiB"
15 | logger_enabled = true
16 |
17 | [module.mounted_binaries]
18 | curl = "/usr/bin/curl"
19 |
20 | [[module]]
21 | name = "eth_rpc"
22 | logger_enabled = true
23 |
--------------------------------------------------------------------------------
/aqua-examples/decentralized-blockchain-gateway/wasm-modules/eth-rpc/tests_artifacts/curl_adapter.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fluencelabs/examples/fbfc344abfca1af2b5466554fec7af9d6f0d5eef/aqua-examples/decentralized-blockchain-gateway/wasm-modules/eth-rpc/tests_artifacts/curl_adapter.wasm
--------------------------------------------------------------------------------
/aqua-examples/decentralized-blockchain-gateway/wasm-modules/eth-rpc/workshop/README.md:
--------------------------------------------------------------------------------
1 | # Fluence decentralized RPC Workshop
2 |
3 | ETHDenver 2/27/2023
4 |
5 |
6 | ##Outline
7 |
8 | ## Intended bounty user experience
9 |
10 | * embedd a the already created Fluence client peer into your dApp
11 |
12 |
13 |
14 | ## Deployment and code
15 |
16 | * deploy eth-rpc service to each KRAS (?) peer at least once
17 | * create Registry instance for deployed services
18 | * create Aqua scaffold to interct with registry and modules
19 | * create Fluence JS reference client to embed into dApp
20 |
21 |
22 |
23 |
24 | ## Introduction
25 |
26 | Fluence decentralized RPC (fRPC) is a ready to use ???
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/aqua-examples/decentralized-blockchain-gateway/wasm-modules/ipfs-adapter/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "ipfs-adapter"
3 | version = "0.1.5"
4 | authors = ["boneyard93501 <4523011+boneyard93501@users.noreply.github.com>"]
5 | edition = "2018"
6 | description = "ipfs-adapter, a Marine wasi module"
7 | license = "Apache-2.0"
8 |
9 | [[bin]]
10 | name = "ipfs-adapter"
11 | path = "src/main.rs"
12 |
13 | [dependencies]
14 | marine-rs-sdk = { version = "0.10.1", features = ["logger"] }
15 | log = "0.4.14"
16 |
17 | [dev-dependencies]
18 | marine-rs-sdk-test = "0.11.0"
19 |
20 |
--------------------------------------------------------------------------------
/aqua-examples/decentralized-blockchain-gateway/wasm-modules/ipfs-adapter/module.yaml:
--------------------------------------------------------------------------------
1 | # yaml-language-server: $schema=../../.fluence/schemas/module.yaml.json
2 |
3 | # 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
4 |
5 | # Documentation: https://github.com/fluencelabs/fluence-cli/tree/main/docs/configs/module.md
6 |
7 | version: 0
8 | type: rust
9 | name: ipfs-adapter
10 | mountedBinaries:
11 | ipfs: /usr/bin/ipfs
12 |
--------------------------------------------------------------------------------
/aqua-examples/decentralized-blockchain-gateway/wasm-modules/ipfs-cli/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "ipfs-cli"
3 | version = "0.1.5"
4 | authors = ["boneyard93501 <4523011+boneyard93501@users.noreply.github.com>"]
5 | edition = "2018"
6 | description = "ipfs-cli, a Marine wasi module"
7 | license = "Apache-2.0"
8 |
9 | [[bin]]
10 | name = "ipfs-cli"
11 | path = "src/main.rs"
12 |
13 | [dependencies]
14 | marine-rs-sdk = { version = "0.10.1", features = ["logger"] }
15 | log = "0.4.14"
16 | serde_json = "1.0.81"
17 | serde = "1.0.137"
18 |
19 | [dev-dependencies]
20 | marine-rs-sdk-test = "0.11.0"
21 |
--------------------------------------------------------------------------------
/aqua-examples/decentralized-blockchain-gateway/wasm-modules/ipfs-cli/module.yaml:
--------------------------------------------------------------------------------
1 | # yaml-language-server: $schema=../../.fluence/schemas/module.yaml.json
2 |
3 | # 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
4 |
5 | # Documentation: https://github.com/fluencelabs/fluence-cli/tree/main/docs/configs/module.md
6 |
7 | version: 0
8 | type: rust
9 | name: ipfs-cli
10 |
--------------------------------------------------------------------------------
/aqua-examples/decentralized-blockchain-gateway/wasm-modules/multi-provider-query/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "multi-provider-query"
3 | version = "0.1.0"
4 | edition = "2018"
5 |
6 | [[bin]]
7 | name = "multi-provider-query"
8 | path = "src/main.rs"
9 |
10 | [dependencies]
11 | marine-rs-sdk = "0.10.1"
12 | serde = "1.0.152"
13 | serde_json = "1.0.92"
14 |
15 | [dev-dependencies]
16 | marine-rs-sdk-test = "0.11.0"
17 |
--------------------------------------------------------------------------------
/aqua-examples/decentralized-blockchain-gateway/wasm-modules/multi-provider-query/module.yaml:
--------------------------------------------------------------------------------
1 | # yaml-language-server: $schema=../../.fluence/schemas/module.yaml.json
2 |
3 | # 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
4 |
5 | # Documentation: https://github.com/fluencelabs/fluence-cli/tree/main/docs/configs/module.md
6 |
7 | version: 0
8 | type: rust
9 | name: multi-provider-query
10 |
--------------------------------------------------------------------------------
/aqua-examples/decentralized-blockchain-gateway/wasm-modules/simple-quorum/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "simple-quorum"
3 | version = "0.1.0"
4 | authors = ["boneyard93501 <4523011+boneyard93501@users.noreply.github.com>"]
5 | edition = "2018"
6 | description = "simple-quorum, a Marine wasi module"
7 | license = "Apache-2.0"
8 |
9 | [[bin]]
10 | name = "simple-quorum"
11 | path = "src/main.rs"
12 |
13 | [dependencies]
14 | marine-rs-sdk = { version = "0.10.1", features = ["logger"] }
15 | log = "0.4.14"
16 | serde_json = "1.0.81"
17 | serde = "1.0.137"
18 | streaming-stats = "0.2.3"
19 |
20 | [dev-dependencies]
21 | marine-rs-sdk-test = "0.11.0"
22 |
23 |
--------------------------------------------------------------------------------
/aqua-examples/decentralized-blockchain-gateway/wasm-modules/simple-quorum/module.yaml:
--------------------------------------------------------------------------------
1 | # yaml-language-server: $schema=../../.fluence/schemas/module.yaml.json
2 |
3 | # 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
4 |
5 | # Documentation: https://github.com/fluencelabs/fluence-cli/tree/main/docs/configs/module.md
6 |
7 | version: 0
8 | type: rust
9 | name: simple-quorum
10 |
--------------------------------------------------------------------------------
/aqua-examples/decentralized-blockchain-gateway/wasm-modules/utilities/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "utilities"
3 | version = "0.1.0"
4 | authors = ["boneyard93501 <4523011+boneyard93501@users.noreply.github.com>"]
5 | edition = "2018"
6 | description = "utilities, a Marine wasi module"
7 | license = "Apache-2.0"
8 |
9 | [[bin]]
10 | name = "utilities"
11 | path = "src/main.rs"
12 |
13 | [dependencies]
14 | marine-rs-sdk = { version = "0.10.1", features = ["logger"] }
15 | log = "0.4.14"
16 | serde_json = "1.0.81"
17 | serde = "1.0.137"
18 | streaming-stats = "0.2.3"
19 |
20 | [dev-dependencies]
21 | marine-rs-sdk-test = "0.11.0"
22 |
23 |
--------------------------------------------------------------------------------
/aqua-examples/decentralized-blockchain-gateway/wasm-modules/utilities/module.yaml:
--------------------------------------------------------------------------------
1 | # yaml-language-server: $schema=../../.fluence/schemas/module.yaml.json
2 |
3 | # 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
4 |
5 | # Documentation: https://github.com/fluencelabs/fluence-cli/tree/main/docs/configs/module.md
6 |
7 | version: 0
8 | type: rust
9 | name: utilities
10 |
--------------------------------------------------------------------------------
/aqua-examples/drand/.gitignore:
--------------------------------------------------------------------------------
1 | debug/
2 | target/
3 | Cargo.lock
4 | **/*.bk
5 | **/*.bak
6 |
--------------------------------------------------------------------------------
/aqua-examples/drand/services/configs/Config.toml:
--------------------------------------------------------------------------------
1 | modules_dir = "../artifacts/"
2 |
3 |
4 | [[module]]
5 | name = "curl_adapter"
6 | max_heap_size = "512 KiB"
7 | logger_enabled = true
8 |
9 | [module.mounted_binaries]
10 | curl = "/usr/bin/curl"
11 |
12 |
13 | [[module]]
14 | name = "drand"
15 | max_heap_size = "256 KiB"
16 | logger_enabled = true
17 |
--------------------------------------------------------------------------------
/aqua-examples/drand/services/configs/deployment_cfg.json:
--------------------------------------------------------------------------------
1 | {
2 | "drand": {
3 | "name": "drand",
4 | "modules": [
5 | {
6 | "name": "curl_adapter",
7 | "path": "./artifacts/curl_adapter.wasm",
8 | "max_heap_size": "512 KiB",
9 | "mounted_binaries": [["curl", "/usr/bin/curl"]]
10 | },
11 | {
12 | "name": "drand",
13 | "path": "./artifacts/drand.wasm",
14 | "max_heap_size": "1 MiB"
15 | }
16 | ]
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/aqua-examples/drand/services/curl_adapter/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "curl_adapter"
3 | version = "0.1.0"
4 | authors = ["Fluence Labs"]
5 | edition = "2018"
6 | publish = false
7 |
8 | [[bin]]
9 | path = "src/main.rs"
10 | name = "curl_adapter"
11 |
12 | [dependencies]
13 | marine-rs-sdk = "0.10.1"
14 | log = "0.4.8"
15 |
--------------------------------------------------------------------------------
/aqua-examples/drand/services/drand/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "drand"
3 | version = "0.1.0"
4 | authors = ["boneyard93501 <4523011+boneyard93501@users.noreply.github.com>"]
5 | edition = "2018"
6 | description = "Drand, a Marine wasi module"
7 | license = "Apache-2.0"
8 |
9 | [[bin]]
10 | name = "drand"
11 | path = "src/main.rs"
12 |
13 | [dependencies]
14 | marine-rs-sdk = { version = "0.10.1", features = ["logger"] }
15 | drand-verify = { version = "0.3.0", js = false, optional = false }
16 | hex = "0.4.3"
17 | serde = "1.0.148"
18 | serde_json = "1.0.89"
19 | fff = "0.3.1"
20 | groupy = "0.4.1"
21 | wasm-bindgen = "0.2.83"
22 | paired = "0.22.0"
23 | sha2 = "0.9.9"
24 |
25 | [dev-dependencies]
26 | marine-rs-sdk-test = "0.11.0"
27 | hex-literal = "0.3.4"
28 |
29 | [dev]
30 | [profile.release]
31 | opt-level = "s"
32 |
--------------------------------------------------------------------------------
/aqua-examples/drand/services/scripts/build.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash -o errexit -o nounset -o pipefail
2 |
3 | mkdir -p artifacts
4 | rm -f artifacts/*.wasm
5 |
6 | cd curl_adapter
7 | marine build --release
8 | cp target/wasm32-wasi/release/curl_adapter.wasm ../artifacts/
9 |
10 | cd ../drand
11 | marine build --release
12 | cp target/wasm32-wasi/release/drand.wasm ../artifacts/
13 |
14 | cd ..
--------------------------------------------------------------------------------
/aqua-examples/echo-greeter/client-peer/.gitignore:
--------------------------------------------------------------------------------
1 | dist/
2 | src/_aqua
--------------------------------------------------------------------------------
/aqua-examples/echo-greeter/client-peer/.prettierrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | semi: true,
3 | trailingComma: 'all',
4 | singleQuote: true,
5 | printWidth: 120,
6 | tabWidth: 4,
7 | useTabs: false,
8 | };
9 |
--------------------------------------------------------------------------------
/aqua-examples/echo-greeter/client-peer/jest.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | preset: 'ts-jest',
3 | testEnvironment: 'node',
4 | testPathIgnorePatterns: ['dist'],
5 | };
6 |
--------------------------------------------------------------------------------
/aqua-examples/echo-greeter/client-peer/src/index.ts:
--------------------------------------------------------------------------------
1 | import { main } from './main';
2 |
3 | main()
4 | .then(() => process.exit(0))
5 | .catch((error) => {
6 | console.error(error);
7 | process.exit(1);
8 | });
9 |
--------------------------------------------------------------------------------
/aqua-examples/echo-greeter/configs/Config.toml:
--------------------------------------------------------------------------------
1 | modules_dir = "./artifacts"
2 |
3 | [[module]]
4 | name = "echo_service"
5 | logger_enabled = true
6 |
7 | [[module]]
8 | name = "greeting"
9 | logger_enabled = true
10 |
--------------------------------------------------------------------------------
/aqua-examples/echo-greeter/configs/echo_greeter_deploy_cfg.json:
--------------------------------------------------------------------------------
1 | {
2 | "echo-greeter": {
3 | "name": "greeting-service",
4 | "modules": [
5 | {
6 | "name": "greeting-service",
7 | "path": "./artifacts/greeting.wasm"
8 | }
9 | ]
10 | },
11 | "echo-service": {
12 | "name": "echo-service",
13 | "modules": [
14 | {
15 | "name": "echo",
16 | "path": "./artifacts/echo_service.wasm"
17 | }
18 | ]
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/aqua-examples/echo-greeter/configs/echo_service_cfg.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "echo_service",
3 | "WEBSITE": "",
4 | "INTERFACES": ""
5 | }
--------------------------------------------------------------------------------
/aqua-examples/echo-greeter/configs/greeting_cfg.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "greeting",
3 | "WEBSITE": "",
4 | "INTERFACES": ""
5 | }
--------------------------------------------------------------------------------
/aqua-examples/echo-greeter/configs/utilities_cfg.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "greeting",
3 | "WEBSITE": "",
4 | "INTERFACES": ""
5 | }
--------------------------------------------------------------------------------
/aqua-examples/echo-greeter/echo-service/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | .repl_history
3 | /target
4 | **/**.bak
5 | **/**.bk
6 | /artifacts
7 | keypair.json
8 |
--------------------------------------------------------------------------------
/aqua-examples/echo-greeter/echo-service/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "echo-service"
3 | version = "0.1.0"
4 | authors = ["Fluence Team"]
5 | edition = "2018"
6 |
7 |
8 | [[bin]]
9 | name = "echo_service"
10 | path = "src/main.rs"
11 |
12 | [dependencies]
13 | marine-rs-sdk = { version="0.10.1", feature=["log"]}
14 | log = "0.4.14"
15 |
16 |
--------------------------------------------------------------------------------
/aqua-examples/echo-greeter/echo-service/Config.toml:
--------------------------------------------------------------------------------
1 | modules_dir = "artifacts/"
2 |
3 | [[module]]
4 | name = "echo_service"
5 | max_heap_size = "10 KiB"
6 | logger_enabled = false
7 |
--------------------------------------------------------------------------------
/aqua-examples/echo-greeter/echo-service/build.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | set -o errexit -o nounset -o pipefail
3 |
4 | # This script builds all subprojects and puts all created Wasm modules in one dir
5 | mkdir -p artifacts
6 | # cargo update
7 | marine build --release
8 |
9 | rm -f artifacts/*.wasm
10 | cp target/wasm32-wasi/release/echo_service.wasm artifacts/
11 |
--------------------------------------------------------------------------------
/aqua-examples/echo-greeter/echo-service/src/main.rs:
--------------------------------------------------------------------------------
1 | use marine_rs_sdk::marine;
2 | use marine_rs_sdk::module_manifest;
3 |
4 | module_manifest!();
5 |
6 | #[marine]
7 | pub struct Echo {
8 | pub echo: String,
9 | }
10 |
11 | #[marine]
12 | pub fn echo(inputs: Vec) -> Vec {
13 | inputs
14 | .iter()
15 | .map(|s| Echo {
16 | echo: s.to_string(),
17 | })
18 | .collect()
19 | }
20 |
21 | fn main() {}
22 |
--------------------------------------------------------------------------------
/aqua-examples/echo-greeter/greeting/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | .repl_history
3 | /target
4 | **/**.bak
5 | **/**.bk
6 | /artifacts
7 | keypair.json
8 |
--------------------------------------------------------------------------------
/aqua-examples/echo-greeter/greeting/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "wasm-greeting"
3 | version = "0.1.0"
4 | authors = ["Fluence Labs"]
5 | description = "The greeting module for the Fluence network"
6 | repository = "https://github.com/fluencelabs/fce/tree/master/examples/greeting"
7 | edition = "2018"
8 | publish = false
9 |
10 | [[bin]]
11 | name = "greeting"
12 | path = "src/main.rs"
13 |
14 | [dependencies]
15 | marine-rs-sdk = { version="0.10.1", feature=["log"]}
16 |
17 |
18 |
--------------------------------------------------------------------------------
/aqua-examples/echo-greeter/greeting/Config.toml:
--------------------------------------------------------------------------------
1 | modules_dir = "artifacts/"
2 |
3 | [[module]]
4 | name = "greeting"
5 | max_heap_size = "10 KiB"
6 | logger_enabled = false
7 |
--------------------------------------------------------------------------------
/aqua-examples/echo-greeter/greeting/build.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | set -o errexit -o nounset -o pipefail
3 |
4 | mkdir -p artifacts
5 | rm -f artifacts/*.wasm
6 |
7 | cargo update --aggressive
8 | marine build --release
9 |
10 |
11 | cp target/wasm32-wasi/release/greeting.wasm artifacts/
12 |
--------------------------------------------------------------------------------
/aqua-examples/echo-greeter/scripts/build_all.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | mkdir -p artifacts
4 | rm -f artifacts/*.wasm
5 |
6 | cd echo-service
7 | marine build --release
8 | cp target/wasm32-wasi/release/echo_service.wasm ../artifacts/
9 |
10 | cd ../greeting
11 | marine build --release
12 | cp target/wasm32-wasi/release/greeting.wasm ../artifacts/
13 |
14 | cd ..
15 |
--------------------------------------------------------------------------------
/aqua-examples/echo-greeter/secure-greeter/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | .repl_history
3 | /target
4 | **/**.bak
5 | **/**.bk
6 | /artifacts
7 | keypair.json
8 |
--------------------------------------------------------------------------------
/aqua-examples/echo-greeter/secure-greeter/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "secure-greeter"
3 | version = "0.1.0"
4 | authors = ["The Fluence Team"]
5 | edition = "2018"
6 |
7 | [[bin]]
8 | name = "secure_greeter"
9 | path = "src/main.rs"
10 |
11 | [dependencies]
12 | marine-rs-sdk = { version="0.10.1", feature=["log"]}
13 | log = "0.4.14"
14 |
--------------------------------------------------------------------------------
/aqua-examples/echo-greeter/secure-greeter/Config.toml:
--------------------------------------------------------------------------------
1 | modules_dir = "artifacts/"
2 |
3 | [[module]]
4 | name = "secure_greeter"
5 | max_heap_size = "10 KiB"
6 | logger_enabled = false
7 |
--------------------------------------------------------------------------------
/aqua-examples/echo-greeter/secure-greeter/air-scripts/air_greet.clj:
--------------------------------------------------------------------------------
1 | (xor
2 | (seq
3 | (seq
4 | (call relay ("op" "identity") [])
5 | (call node (service "greeting") [name] result)
6 | )
7 | (seq
8 | (call relay ("op" "identity") [])
9 | (call %init_peer_id% (returnService "run") [result])
10 | )
11 | )
12 | (seq
13 | (call relay ("op" "identity") [])
14 | (call %init_peer_id% (returnService "run") ["XOR FAILED" %last_error%])
15 | )
16 | )
--------------------------------------------------------------------------------
/aqua-examples/echo-greeter/secure-greeter/build.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | set -o errexit -o nounset -o pipefail
3 |
4 | cargo update --aggressive
5 | marine build --release
6 |
7 | mkdir -p artifacts
8 | rm -f artifacts/*.wasm
9 | cp target/wasm32-wasi/release/secure_greeter.wasm artifacts/
10 |
--------------------------------------------------------------------------------
/aqua-examples/echo-greeter/secure-greeter/configs/secure_greeter_cfg.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "secure_greeter"
3 | }
--------------------------------------------------------------------------------
/aqua-examples/echo-greeter/utilities/.gitignore:
--------------------------------------------------------------------------------
1 | debug/
2 | target/
3 | Cargo.lock
4 | **/*.bk
5 | **/*.bak
6 |
--------------------------------------------------------------------------------
/aqua-examples/echo-greeter/utilities/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "utilities"
3 | version = "0.1.0"
4 | authors = ["boneyard93501 <4523011+boneyard93501@users.noreply.github.com>"]
5 | edition = "2018"
6 | description = "utilities, a Marine wasi module"
7 | license = "Apache-2.0"
8 |
9 | [[bin]]
10 | name = "utilities"
11 | path = "src/main.rs"
12 |
13 | [dependencies]
14 | marine-rs-sdk = { version = "0.10.1", features = ["logger"] }
15 | log = "0.4.14"
16 |
17 | [dev-dependencies]
18 | marine-rs-sdk-test = "0.11.0"
19 |
20 | [dev]
21 | [profile.release]
22 | opt-level = "s"
23 |
--------------------------------------------------------------------------------
/aqua-examples/echo-greeter/utilities/Config.toml:
--------------------------------------------------------------------------------
1 | modules_dir = "artifacts/"
2 |
3 | [[module]]
4 | name = "utilities"
5 | max_heap_size = "10 KiB"
6 | logger_enabled = true
7 |
--------------------------------------------------------------------------------
/aqua-examples/echo-greeter/utilities/scripts/build.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | set -o errexit -o nounset -o pipefail
4 |
5 | mkdir -p artifacts
6 | rm -f artifacts/*.wasm
7 | marine build --release
8 | cp target/wasm32-wasi/release/utilities.wasm artifacts/
9 |
--------------------------------------------------------------------------------
/aqua-examples/near-integration/near-signing-node/.gitignore:
--------------------------------------------------------------------------------
1 | lib-cov
2 | *.seed
3 | *.log
4 | *.csv
5 | *.dat
6 | *.out
7 | *.pid
8 | *.gz
9 | *.swp
10 |
11 | pids
12 | logs
13 | results
14 | tmp
15 |
16 | # Build
17 | public/css/main.css
18 |
19 | # Coverage reports
20 | coverage
21 |
22 | # API keys and secrets
23 | .env
24 |
25 | # Dependency directory
26 | node_modules
27 | bower_components
28 |
29 | # Editors
30 | .idea
31 | *.iml
32 |
33 | # OS metadata
34 | .DS_Store
35 | Thumbs.db
36 |
37 | # Ignore built ts files
38 | dist/**/*
39 |
40 | # ignore yarn.lock
41 | yarn.lock
42 |
43 | package-lock.json
44 |
45 | .bak
46 | .bk
47 |
48 | # fluence
49 |
50 | src/_aqua/*
51 | # recommended by Fluence Labs:
52 | .fluence
53 | **/node_modules
54 | **/target/
55 | .vscode/settings.json
56 | .repl_history
57 |
--------------------------------------------------------------------------------
/aqua-examples/near-integration/near-signing-node/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "near-signing-node",
3 | "version": "0.1.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "start": "node -r ts-node/register src/index.ts",
8 | "compile-aqua": "fluence aqua -i aqua/ -o src/_aqua",
9 | "watch-aqua": "chokidar \"**/*.aqua\" -c \"npm run compile-aqua\""
10 | },
11 | "author": "",
12 | "license": "ISC",
13 | "devDependencies": {
14 | "@fluencelabs/aqua": "0.10.3",
15 | "@fluencelabs/aqua-lib": "0.7.7",
16 | "chokidar-cli": "^3.0.0",
17 | "ts-node": "^10.7.0",
18 | "typescript": "^4.6.3"
19 | },
20 | "dependencies": {
21 | "@fluencelabs/fluence": "0.28.0",
22 | "@fluencelabs/fluence-network-environment": "1.1.2",
23 | "@types/sqlite3": "^3.1.7",
24 | "near-api-js": "^0.43.1"
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/aqua-examples/near-integration/services/.gitignore:
--------------------------------------------------------------------------------
1 | .idea
2 | .DS_Store
3 | .fluence
4 | **/node_modules
5 | **/target/
6 | .vscode/settings.json
7 | .repl_history
--------------------------------------------------------------------------------
/aqua-examples/near-integration/services/near-adapter/Config.toml:
--------------------------------------------------------------------------------
1 | modules_dir = "artifacts"
2 |
3 | [[module]]
4 | name = "curl_adapter"
5 | max_heap_size = "100 KiB"
6 | logger_enabled = true
7 | [module.mounted_binaries]
8 | curl = "/usr/bin/curl"
9 |
10 | [[module]]
11 | name = "near_rpc_services"
12 | max_heap_size = "10 KiB"
13 | logger_enabled = true
14 |
--------------------------------------------------------------------------------
/aqua-examples/near-integration/services/near-adapter/modules/curl-adapter/.gitignore:
--------------------------------------------------------------------------------
1 | target/
2 | **/*.rs.bk
3 | .idea
4 |
5 | # MacOS misc file
6 | *.DS_Store
7 |
8 | # Wasm files
9 | *.wasm
10 | *.wat
11 |
12 | # REPL history files
13 | *.repl_history
14 |
15 |
--------------------------------------------------------------------------------
/aqua-examples/near-integration/services/near-adapter/modules/curl-adapter/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "curl-adapter"
3 | version = "0.1.0"
4 | authors = ["Fluence Labs"]
5 | edition = "2018"
6 | publish = false
7 |
8 | [[bin]]
9 | path = "src/main.rs"
10 | name = "curl_adapter"
11 |
12 | [dependencies]
13 | marine-rs-sdk = { version = "0.10.1", features = ["logger"] }
14 | log = "0.4.14"
15 |
16 | [dev-dependencies]
17 | marine-rs-sdk-test = "0.11.0"
18 |
19 | [dev]
20 | [profile.release]
21 | opt-level = "s"
22 |
--------------------------------------------------------------------------------
/aqua-examples/near-integration/services/near-adapter/modules/curl-adapter/Config.toml:
--------------------------------------------------------------------------------
1 | modules_dir = "artifacts/"
2 |
3 | [[module]]
4 | name = "curl_adapter"
5 |
--------------------------------------------------------------------------------
/aqua-examples/near-integration/services/near-adapter/modules/near-rpc-services/.gitignore:
--------------------------------------------------------------------------------
1 | target/
2 | **/*.rs.bk
3 | .idea
4 |
5 | # MacOS misc file
6 | *.DS_Store
7 |
8 | # Wasm files
9 | *.wasm
10 | *.wat
11 |
12 | # REPL history files
13 | *.repl_history
14 |
15 |
--------------------------------------------------------------------------------
/aqua-examples/near-integration/services/near-adapter/modules/near-rpc-services/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "near-rpc-services"
3 | version = "0.1.0"
4 | authors = ["boneyard93501 <4523011+boneyard93501@users.noreply.github.com>"]
5 | edition = "2018"
6 | description = "near-services, a Marine wasi module"
7 | license = "Apache-2.0"
8 |
9 | [[bin]]
10 | name = "near_rpc_services"
11 | path = "src/main.rs"
12 |
13 | [dependencies]
14 | marine-rs-sdk = { version = "0.10.1", features = ["logger"] }
15 | log = "0.4.14"
16 | serde = { version = "1.0.132", default-features = false }
17 | serde_json = { version = "1.0.73", default-features = false }
18 |
19 | [dev-dependencies]
20 | marine-rs-sdk-test = "0.11.0"
21 |
22 | [dev]
23 | [profile.release]
24 | opt-level = "s"
25 |
--------------------------------------------------------------------------------
/aqua-examples/near-integration/services/near-adapter/modules/near-rpc-services/Config.toml:
--------------------------------------------------------------------------------
1 | modules_dir = "artifacts/"
2 |
3 | [[module]]
4 | name = "near_rpc_services"
5 |
--------------------------------------------------------------------------------
/aqua-examples/near-integration/services/near-adapter/modules/near-rpc-services/src/utils.rs:
--------------------------------------------------------------------------------
1 | pub const JSON_RPC: &'static str = "2.0";
2 | pub const NONCE: &'static str = "dontcare";
3 |
4 | pub fn rpc_maker(url: String, method: String, params: String) -> Vec {
5 | let data: String = format!(
6 | "-d {{\"jsonrpc\":\"{}\", \"id\":\"{}\", \"method\":\"{}\", \"params\":{} }}",
7 | JSON_RPC, NONCE, method, params
8 | );
9 | let curl_params = vec![
10 | "-X".to_string(),
11 | "POST".to_string(),
12 | url,
13 | data,
14 | "-H".to_string(),
15 | "Content-Type: application/json".to_string(),
16 | ];
17 | curl_params
18 | }
19 |
20 | pub fn url_maker(network_id: String) -> String {
21 | format!("https://rpc.{}.near.org", network_id)
22 | }
23 |
--------------------------------------------------------------------------------
/aqua-examples/price-oracle/client-peer/.gitignore:
--------------------------------------------------------------------------------
1 | dist/
2 |
3 | # fluence
4 |
5 | src/_aqua/*
--------------------------------------------------------------------------------
/aqua-examples/price-oracle/client-peer/.prettierrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | semi: true,
3 | trailingComma: 'all',
4 | singleQuote: true,
5 | printWidth: 120,
6 | tabWidth: 4,
7 | useTabs: false,
8 | };
9 |
--------------------------------------------------------------------------------
/aqua-examples/price-oracle/client-peer/jest.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | preset: 'ts-jest',
3 | testEnvironment: 'node',
4 | testPathIgnorePatterns: ['dist'],
5 | };
6 |
--------------------------------------------------------------------------------
/aqua-examples/price-oracle/client-peer/src/__test__/test.spec.ts:
--------------------------------------------------------------------------------
1 | import { main } from '../main';
2 |
3 | describe('smoke test', () => {
4 | it('should work', async () => {
5 | console.log = jest.fn();
6 |
7 | await main();
8 |
9 | expect(console.log).toBeCalledTimes(4);
10 | expect(console.log).toHaveBeenNthCalledWith(3, 'seq result: ', {
11 | error_msg: '',
12 | result: expect.any(Number),
13 | success: true,
14 | });
15 | expect(console.log).toHaveBeenNthCalledWith(4, 'par result: ', {
16 | error_msg: '',
17 | result: expect.any(Number),
18 | success: true,
19 | });
20 | }, 15000);
21 | });
22 |
--------------------------------------------------------------------------------
/aqua-examples/price-oracle/client-peer/src/index.ts:
--------------------------------------------------------------------------------
1 | import { main } from './main';
2 |
3 | main()
4 | .then(() => process.exit(0))
5 | .catch((error) => {
6 | console.error(error);
7 | process.exit(1);
8 | });
9 |
--------------------------------------------------------------------------------
/aqua-examples/price-oracle/configs/Config.toml:
--------------------------------------------------------------------------------
1 | modules_dir = "artifacts/"
2 |
3 | [[module]]
4 | name = "curl_adapter"
5 | logger_enabled = false
6 | max_heap_size = "10 KiB"
7 |
8 | [module.mounted_binaries]
9 | curl = "/usr/bin/curl"
10 |
11 | [[module]]
12 | name = "price_getter_service"
13 | logger_enabled = false
14 | max_heap_size = "5 KiB"
15 |
16 | [[module]]
17 | name = "mean_service"
18 | logger_enabled = false
19 | max_heap_size = "5 KiB"
20 |
--------------------------------------------------------------------------------
/aqua-examples/price-oracle/configs/curl_adapter_cfg.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "curl_adapter",
3 | "mountedBinaries": {
4 | "curl": "/usr/bin/curl"
5 | },
6 | "mem_page_count": 1,
7 | "logger_enabled": false
8 | }
--------------------------------------------------------------------------------
/aqua-examples/price-oracle/configs/mean_service_cfg.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "mean_service",
3 | "mem_page_count": 1,
4 | "logger_enabled": false
5 | }
--------------------------------------------------------------------------------
/aqua-examples/price-oracle/configs/price_getter_service_cfg.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "price_getter_service",
3 | "mem_page_count": 1,
4 | "logger_enabled": false
5 | }
--------------------------------------------------------------------------------
/aqua-examples/price-oracle/configs/price_oracle_deploy_cfg.json:
--------------------------------------------------------------------------------
1 | {
2 | "price-getter": {
3 | "modules": [
4 | {
5 | "name": "curl_adapter",
6 | "path": "./artifacts/curl_adapter.wasm",
7 | "mounted_binaries": [["curl", "/usr/bin/curl"]],
8 | "logger_enabled": true
9 | },
10 | {
11 | "name": "price_getter_service",
12 | "path": "./artifacts/price_getter_service.wasm",
13 | "logger_enabled": true
14 | }
15 | ]
16 | },
17 | "mean-service": {
18 | "modules": [
19 | {
20 | "name": "mean_service",
21 | "path": "./artifacts/mean_service.wasm",
22 | "logger_enabled": true
23 | }
24 | ]
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/aqua-examples/price-oracle/curl_adapter/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "curl_adapter"
3 | version = "0.1.0"
4 | authors = ["Fluence Labs"]
5 | edition = "2018"
6 | publish = false
7 |
8 | [[bin]]
9 | path = "src/main.rs"
10 | name = "curl_adapter"
11 |
12 | [dependencies]
13 | marine-rs-sdk = "0.10.1"
14 | log = "0.4.8"
15 |
--------------------------------------------------------------------------------
/aqua-examples/price-oracle/data/deployed_services.json:
--------------------------------------------------------------------------------
1 | {
2 | "price_getter": [
3 | {
4 | "node": "12D3KooWCMr9mU894i8JXAFqpgoFtx6qnV1LFPSfVc3Y34N4h4LS",
5 | "service_id": "b67586f7-e96f-49ee-914e-9eabe1a0b83d"
6 | },
7 | {
8 | "node": "12D3KooWFEwNWcHqi9rtsmDhsYcDbRUCDXH84RC4FW6UfsFWaoHi",
9 | "service_id": "f5b456fa-ee18-4df1-b18b-84fe7ebc7ad0"
10 | }
11 | ],
12 | "mean": [
13 | {
14 | "node": "12D3KooWCMr9mU894i8JXAFqpgoFtx6qnV1LFPSfVc3Y34N4h4LS",
15 | "service_id": "79b8ddb9-e2e6-4924-9293-c5d55c94af6b"
16 | },
17 | {
18 | "node": "12D3KooWFEwNWcHqi9rtsmDhsYcDbRUCDXH84RC4FW6UfsFWaoHi",
19 | "service_id": "debecd02-ba7d-40a2-92ab-08a9321da2cf"
20 | }
21 | ]
22 | }
--------------------------------------------------------------------------------
/aqua-examples/price-oracle/images/browser_demo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fluencelabs/examples/fbfc344abfca1af2b5466554fec7af9d6f0d5eef/aqua-examples/price-oracle/images/browser_demo.png
--------------------------------------------------------------------------------
/aqua-examples/price-oracle/images/figure_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fluencelabs/examples/fbfc344abfca1af2b5466554fec7af9d6f0d5eef/aqua-examples/price-oracle/images/figure_1.png
--------------------------------------------------------------------------------
/aqua-examples/price-oracle/images/figure_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fluencelabs/examples/fbfc344abfca1af2b5466554fec7af9d6f0d5eef/aqua-examples/price-oracle/images/figure_2.png
--------------------------------------------------------------------------------
/aqua-examples/price-oracle/mean_service/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "price_getter_service"
3 | version = "0.1.0"
4 | authors = ["boneyard93501 <4523011+boneyard93501@users.noreply.github.com>"]
5 | edition = "2018"
6 | description = "price-getter-service, a Marine wasi module"
7 | license = "Apache-2.0"
8 |
9 | [[bin]]
10 | name = "mean_service"
11 | path = "src/main.rs"
12 |
13 | [dependencies]
14 | marine-rs-sdk = "0.10.1"
15 | log = "0.4.14"
16 |
17 | [dev]
18 | [profile.release]
19 | opt-level = "s"
20 |
--------------------------------------------------------------------------------
/aqua-examples/price-oracle/price_getter_service/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "price_getter_service"
3 | version = "0.1.0"
4 | authors = ["boneyard93501 <4523011+boneyard93501@users.noreply.github.com>"]
5 | edition = "2018"
6 | description = "price-getter-service, a Marine wasi module"
7 | license = "Apache-2.0"
8 |
9 | [[bin]]
10 | name = "price_getter_service"
11 | path = "src/main.rs"
12 |
13 | [dependencies]
14 | marine-rs-sdk = "0.10.1"
15 | log = "0.4.14"
16 | picorand = "0.1.1"
17 | fstrings = "0.2.3"
18 | serde_json = "1.0.57"
19 |
20 | [dev]
21 | [profile.release]
22 | opt-level = "s"
23 |
--------------------------------------------------------------------------------
/aqua-examples/price-oracle/scripts/build.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | set -o errexit -o nounset -o pipefail
4 |
5 | mkdir -p artifacts
6 |
7 | cd curl_adapter
8 | cargo update --aggressive
9 | marine build --release
10 | cd ..
11 |
12 | cd price_getter_service
13 | cargo update --aggressive
14 | marine build --release
15 | cd ..
16 |
17 | cd mean_service
18 | cargo update --aggressive
19 | marine build --release
20 | cd ..
21 |
22 | rm -f artifacts/*.wasm
23 |
24 | cp curl_adapter/target/wasm32-wasi/release/curl_adapter.wasm artifacts/
25 | cp price_getter_service/target/wasm32-wasi/release/price_getter_service.wasm artifacts/
26 | cp mean_service/target/wasm32-wasi/release/mean_service.wasm artifacts/
--------------------------------------------------------------------------------
/aqua-examples/price-oracle/web/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # production
12 | /build
13 |
14 | # misc
15 | .DS_Store
16 | .env.local
17 | .env.development.local
18 | .env.test.local
19 | .env.production.local
20 |
21 | npm-debug.log*
22 | yarn-debug.log*
23 | yarn-error.log*
24 |
25 |
26 | # fluence
27 |
28 | src/_aqua/*
29 |
30 | public/*.wasm
31 | public/runnerScript.*
--------------------------------------------------------------------------------
/aqua-examples/price-oracle/web/.prettierrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | semi: true,
3 | trailingComma: 'all',
4 | singleQuote: true,
5 | printWidth: 120,
6 | tabWidth: 4,
7 | useTabs: false,
8 | };
9 |
--------------------------------------------------------------------------------
/aqua-examples/price-oracle/web/README.md:
--------------------------------------------------------------------------------
1 | # Price oracle
2 |
3 | Web interface for the price oracle application
4 |
5 | ## Getting started
6 |
7 | Run aqua compiler in watch mode:
8 |
9 | ```bash
10 | npm run watch-aqua
11 | ```
12 |
13 | Start the application
14 |
15 | ```bash
16 | npm i
17 | npm start
18 | ```
19 |
20 | The browser window with `localhost:3000` should open
21 |
--------------------------------------------------------------------------------
/aqua-examples/price-oracle/web/jest.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | preset: 'jest-puppeteer',
3 | testMatch: ['**/?(*.)+(spec|test).[t]s'],
4 | testPathIgnorePatterns: ['/node_modules/', 'dist'],
5 | transform: {
6 | '^.+\\.ts?$': 'ts-jest',
7 | },
8 | };
9 |
--------------------------------------------------------------------------------
/aqua-examples/price-oracle/web/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fluencelabs/examples/fbfc344abfca1af2b5466554fec7af9d6f0d5eef/aqua-examples/price-oracle/web/public/favicon.ico
--------------------------------------------------------------------------------
/aqua-examples/price-oracle/web/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fluencelabs/examples/fbfc344abfca1af2b5466554fec7af9d6f0d5eef/aqua-examples/price-oracle/web/public/logo192.png
--------------------------------------------------------------------------------
/aqua-examples/price-oracle/web/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fluencelabs/examples/fbfc344abfca1af2b5466554fec7af9d6f0d5eef/aqua-examples/price-oracle/web/public/logo512.png
--------------------------------------------------------------------------------
/aqua-examples/price-oracle/web/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "Price oracle",
3 | "name": "Fluence price oracle",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | },
10 | {
11 | "src": "logo192.png",
12 | "type": "image/png",
13 | "sizes": "192x192"
14 | },
15 | {
16 | "src": "logo512.png",
17 | "type": "image/png",
18 | "sizes": "512x512"
19 | }
20 | ],
21 | "start_url": ".",
22 | "display": "standalone",
23 | "theme_color": "#000000",
24 | "background_color": "#ffffff"
25 | }
26 |
--------------------------------------------------------------------------------
/aqua-examples/price-oracle/web/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 | Disallow:
4 |
--------------------------------------------------------------------------------
/aqua-examples/price-oracle/web/src/.prettierrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | semi: true,
3 | trailingComma: 'all',
4 | singleQuote: true,
5 | printWidth: 120,
6 | tabWidth: 4,
7 | useTabs: false,
8 | };
9 |
--------------------------------------------------------------------------------
/aqua-examples/price-oracle/web/src/index.css:
--------------------------------------------------------------------------------
1 | body {
2 | margin: 0;
3 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
4 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
5 | sans-serif;
6 | -webkit-font-smoothing: antialiased;
7 | -moz-osx-font-smoothing: grayscale;
8 | }
9 |
10 | code {
11 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
12 | monospace;
13 | }
14 |
--------------------------------------------------------------------------------
/aqua-examples/price-oracle/web/src/index.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import ReactDOM from "react-dom";
3 | import "./index.css";
4 | import App from "./App";
5 |
6 | ReactDOM.render(
7 |
8 |
9 | ,
10 | document.getElementById("root")
11 | );
12 |
--------------------------------------------------------------------------------
/aqua-examples/price-oracle/web/src/react-app-env.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 |
--------------------------------------------------------------------------------
/aqua-examples/price-oracle/web/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es5",
4 | "lib": [
5 | "dom",
6 | "dom.iterable",
7 | "esnext"
8 | ],
9 | "allowJs": true,
10 | "skipLibCheck": true,
11 | "esModuleInterop": true,
12 | "allowSyntheticDefaultImports": true,
13 | "strict": true,
14 | "forceConsistentCasingInFileNames": true,
15 | "noFallthroughCasesInSwitch": true,
16 | "module": "esnext",
17 | "moduleResolution": "node",
18 | "resolveJsonModule": true,
19 | "isolatedModules": true,
20 | "noEmit": true,
21 | "jsx": "react-jsx"
22 | },
23 | "include": [
24 | "src"
25 | ]
26 | }
27 |
--------------------------------------------------------------------------------
/aqua-examples/ts-oracle/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "ts_oracle"
3 | version = "0.1.0"
4 | authors = ["boneyard93501 <4523011+boneyard93501@users.noreply.github.com>"]
5 | edition = "2018"
6 | description = "ts-cons, a Marine wasi module"
7 | license = "Apache-2.0"
8 |
9 | [[bin]]
10 | name = "ts_oracle"
11 | path = "src/main.rs"
12 |
13 | [dependencies]
14 | marine-rs-sdk = { version = "0.10.1", features = ["logger"] }
15 | log = "0.4.14"
16 |
17 | [dev-dependencies]
18 | marine-rs-sdk-test = "0.11.0"
19 |
20 | [dev]
21 | [profile.release]
22 | opt-level = "s"
23 |
--------------------------------------------------------------------------------
/aqua-examples/ts-oracle/configs/Config.toml:
--------------------------------------------------------------------------------
1 | modules_dir = "artifacts/"
2 |
3 | [[module]]
4 | name = "ts_oracle"
5 | max_heap_size = "10 KiB"
6 | logger_enabled = true
7 |
--------------------------------------------------------------------------------
/aqua-examples/ts-oracle/configs/ts_oracle_cfg.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "ts_oracle",
3 | "mem_page_count": 5,
4 | "logger_enabled": false
5 | }
6 |
--------------------------------------------------------------------------------
/aqua-examples/ts-oracle/configs/ts_oracle_deploy_cfg.json:
--------------------------------------------------------------------------------
1 | {
2 | "ts-oracle": {
3 | "modules": [
4 | {
5 | "name": "ts_oracle",
6 | "path": "./artifacts/ts_oracle.wasm",
7 | "logger_enabled": true
8 | }
9 | ]
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/aqua-examples/ts-oracle/scripts/build.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | set -o errexit -o nounset -o pipefail
4 |
5 | mkdir -p artifacts
6 | rm -f artifacts/*.wasm
7 | marine build --release
8 | cp target/wasm32-wasi/release/ts_oracle.wasm artifacts/
9 |
--------------------------------------------------------------------------------
/aqua-examples/ts-oracle/src/stats.rs:
--------------------------------------------------------------------------------
1 | use std::collections::HashMap;
2 |
3 | pub fn mode<'a>(data: impl ExactSizeIterator- ) -> (u32, u64) {
4 | let frequencies = data
5 | .into_iter()
6 | .fold(HashMap::
::new(), |mut freqs, value| {
7 | *freqs.entry(*value).or_insert(0) += 1;
8 | freqs
9 | });
10 |
11 | let mode = frequencies
12 | .iter()
13 | .max_by_key(|&(_, count)| count)
14 | .map(|(value, _)| value)
15 | .unwrap();
16 |
17 | (*frequencies.get(&mode).unwrap(), *mode)
18 | }
19 |
20 | pub fn mean<'a>(data: impl ExactSizeIterator- ) -> Option
{
21 | let n = data.len() as u64;
22 | if n < 1 {
23 | return None;
24 | }
25 | let res = (data.sum::() / n) as f64;
26 | Some(res)
27 | }
28 |
--------------------------------------------------------------------------------
/aqua-examples/vrfun/.gitignore:
--------------------------------------------------------------------------------
1 | debug/
2 | target/
3 | **/*.bk
4 | **/*.bak
5 | .DS_Store
--------------------------------------------------------------------------------
/aqua-examples/vrfun/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "vrfun"
3 | version = "0.1.5"
4 | authors = ["boneyard93501 <4523011+boneyard93501@users.noreply.github.com>"]
5 | edition = "2018"
6 | description = "vrfun, a Marine wasi module"
7 | license = "Apache-2.0"
8 |
9 | [[bin]]
10 | name = "vrfun"
11 | path = "src/main.rs"
12 |
13 | [dependencies]
14 | marine-rs-sdk = { version = "0.10.1", features = ["logger"] }
15 | log = "0.4.14"
16 | ecvrf = "0.4.3"
17 | zeroize = "1.5.7"
18 |
19 | [dev-dependencies]
20 | marine-rs-sdk-test = "0.11.0"
21 |
22 | [dev]
23 | [profile.release]
24 | opt-level = "s"
25 |
--------------------------------------------------------------------------------
/aqua-examples/vrfun/artifacts/vrfun.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fluencelabs/examples/fbfc344abfca1af2b5466554fec7af9d6f0d5eef/aqua-examples/vrfun/artifacts/vrfun.wasm
--------------------------------------------------------------------------------
/aqua-examples/vrfun/configs/Config.toml:
--------------------------------------------------------------------------------
1 | modules_dir = "artifacts/"
2 |
3 | [[module]]
4 | name = "vrfun"
5 | max_heap_size = "10 KiB"
6 | logger_enabled = true
7 |
--------------------------------------------------------------------------------
/aqua-examples/vrfun/configs/deployed_services.json:
--------------------------------------------------------------------------------
1 | {
2 | "services": [
3 | {
4 | "peer_id": "12D3KooWCMr9mU894i8JXAFqpgoFtx6qnV1LFPSfVc3Y34N4h4LS",
5 | "service_id": "83f5250b-22f4-4e43-a83d-652d52aa8bd0"
6 | },
7 |
8 | {
9 | "peer_id": "12D3KooWEFFCZnar1cUJQ3rMWjvPQg6yMV2aXWs2DkJNSRbduBWn",
10 | "service_id": "114809b8-e4f8-4e4e-8b6e-0f8510a5075e"
11 | }
12 | ]
13 | }
14 |
--------------------------------------------------------------------------------
/aqua-examples/vrfun/configs/deployment_cfg.json:
--------------------------------------------------------------------------------
1 | {
2 | "vrfun": {
3 | "name": "vrfun",
4 | "modules": [
5 | {
6 | "name": "vrfun",
7 | "path": "./artifacts/vrfun.wasm"
8 | }
9 | ]
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/aqua-examples/vrfun/scripts/build.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash -o errexit -o nounset -o pipefail
2 | cargo update --aggressive
3 |
4 | mkdir -p artifacts
5 | rm -f artifacts/*.wasm
6 | marine build --release
7 | cp target/wasm32-wasi/release/vrfun.wasm artifacts/
8 |
--------------------------------------------------------------------------------
/archived/aqua-ceramic-integration/.gitignore:
--------------------------------------------------------------------------------
1 | debug/
2 | target/
3 | Cargo.lock
4 | **/*.bk
5 | **/*.bak
6 |
--------------------------------------------------------------------------------
/archived/aqua-ceramic-integration/assets/figure_1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fluencelabs/examples/fbfc344abfca1af2b5466554fec7af9d6f0d5eef/archived/aqua-ceramic-integration/assets/figure_1.jpg
--------------------------------------------------------------------------------
/archived/aqua-ceramic-integration/assets/figure_1_code.md:
--------------------------------------------------------------------------------
1 | ```mermaid
2 | sequenceDiagram
3 | title: Figure 1: Stylized Use of Adapters
4 |
5 | participant C as Fluence Client Peer
6 | participant F as Relay Node
7 | participant S as Peer(s) hosting adapter(s)
8 | participant O as Exogenous API/Runtime
9 |
10 | C ->> F: Launch Aqua script to compose adapter services + other services
11 | F ->> S: Call adapter service(s)
12 | S ->> S: Call host binary
13 | S ->> O: Request to exogenous resource
14 | O ->> S: Response from exogenous service(s)
15 | S ->> S: Update Aqua workflow (Particle)
16 | S ->> F: Return result
17 | F ->> C: Return result
18 | ```
--------------------------------------------------------------------------------
/archived/aqua-ceramic-integration/ceramic/snapshot_schema.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "http://json-schema.org/draft-07/schema#",
3 | "title": "Snapshot",
4 | "type": "object",
5 | "properties": {
6 | "proposal": { "type": "string" },
7 | "proposal_verifications": {
8 | "type": "array",
9 | "items": { "type": "string" }
10 | },
11 | "vote": { "type": "string" },
12 | "vote_verifications": { "type": "array", "items": { "type": "string" } }
13 | },
14 | "required": ["proposal"]
15 | }
16 |
--------------------------------------------------------------------------------
/archived/aqua-ceramic-integration/configs/Config.toml:
--------------------------------------------------------------------------------
1 | modules_dir = "artifacts"
2 |
3 | [[module]]
4 | name = "curl_adapter"
5 | max_heap_size = "100 KiB"
6 | logger_enabled = true
7 |
8 | [module.mounted_binaries]
9 | curl = "/usr/bin/curl"
10 |
11 | [[module]]
12 | name = "ceramic_adapter_custom"
13 | max_heap_size = "50 Kib"
14 | logger_enabled = true
15 |
16 | [module.mounted_binaries]
17 | ceramic = "/Users/bebo/.nvm/versions/node/v14.16.0/bin/ceramic"
18 |
--------------------------------------------------------------------------------
/archived/aqua-ceramic-integration/configs/ceramic_adapter_cfg.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "ceramic_adapter_custom",
3 | "mountedBinaries": {
4 | "ceramic": "/usr/bin/ceramic"
5 | },
6 | "max_heap_size": "100 KiB",
7 | "logger_enabled": true
8 | }
9 |
--------------------------------------------------------------------------------
/archived/aqua-ceramic-integration/configs/ceramic_adapter_deploy_cfg.json:
--------------------------------------------------------------------------------
1 | {
2 | "ceramic-service": {
3 | "name": "ceramic-service",
4 | "modules": [
5 | {
6 | "name": "curl_adapter",
7 | "path": "./artifacts/curl_adapter.wasm",
8 | "mounted_binaries": [["curl", "/usr/bin/curl"]],
9 | "preopened_files": null,
10 | "mapped_dirs": null,
11 | "logger_enabled": true
12 | },
13 | {
14 | "name": "ceramic_adapter_custom",
15 | "path": "./artifacts/ceramic_adapter_custom.wasm",
16 | "mounted_binaries": [["ceramic", "/usr/bin/ceramic"]],
17 | "preopened_files": null,
18 | "mapped_dirs": null,
19 | "logger_enabled": true
20 | }
21 | ]
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/archived/aqua-ceramic-integration/configs/curl_adapter_cfg.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "curl_adapter",
3 | "mountedBinaries": {
4 | "curl": "/usr/bin/curl"
5 | },
6 | "mem_page_count": 100,
7 | "logger_enabled": true
8 | }
9 |
--------------------------------------------------------------------------------
/archived/aqua-ceramic-integration/scripts/build.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | set -o errexit -o nounset -o pipefail
4 |
5 |
6 | mkdir -p artifacts
7 | rm -f artifacts/*.wasm
8 |
9 | cd services/curl-adapter
10 | cargo update --aggressive
11 | marine build --release
12 | cp target/wasm32-wasi/release/curl_adapter.wasm ../../artifacts/
13 |
14 | cd ../ceramic-adapter-custom
15 | cargo update --aggressive
16 | marine build --release
17 | cp target/wasm32-wasi/release/ceramic_adapter_custom.wasm ../../artifacts/
18 |
19 |
--------------------------------------------------------------------------------
/archived/aqua-ceramic-integration/services/ceramic-adapter-basic/.gitignore:
--------------------------------------------------------------------------------
1 | debug/
2 | target/
3 | Cargo.lock
4 | **/*.bk
5 | **/*.bak
6 |
--------------------------------------------------------------------------------
/archived/aqua-ceramic-integration/services/ceramic-adapter-basic/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "ceramic-adapter_raw"
3 | version = "0.1.0"
4 | authors = ["boneyard93501 <4523011+boneyard93501@users.noreply.github.com>"]
5 | edition = "2018"
6 | description = "ceramic-adapter-raw"
7 | license = "Apache-2.0"
8 |
9 | [[bin]]
10 | name = "ceramic_adapter_raw"
11 | path = "src/main.rs"
12 |
13 | [dependencies]
14 | marine-rs-sdk = { version = "0.7.1", features = ["logger"] }
15 | log = "0.4.14"
16 |
17 | [dev-dependencies]
18 | marine-rs-sdk-test = "0.8.2"
19 |
20 | [dev]
21 | [profile.release]
22 | opt-level = "s"
23 |
--------------------------------------------------------------------------------
/archived/aqua-ceramic-integration/services/ceramic-adapter-custom/.gitignore:
--------------------------------------------------------------------------------
1 | debug/
2 | target/
3 | Cargo.lock
4 | **/*.bk
5 | **/*.bak
6 |
--------------------------------------------------------------------------------
/archived/aqua-ceramic-integration/services/ceramic-adapter-custom/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "ceramic-adapter-custom"
3 | version = "0.1.0"
4 | authors = ["boneyard93501 <4523011+boneyard93501@users.noreply.github.com>"]
5 | edition = "2018"
6 | description = "ceramic-adapter-custom"
7 | license = "Apache-2.0"
8 |
9 | [[bin]]
10 | name = "ceramic_adapter_custom"
11 | path = "src/main.rs"
12 |
13 | [dependencies]
14 | marine-rs-sdk = { version = "0.7.1", features = ["logger"] }
15 | log = "0.4.14"
16 |
17 | [dev-dependencies]
18 | marine-rs-sdk-test = "0.8.2"
19 |
20 | [dev]
21 | [profile.release]
22 | opt-level = "s"
23 |
--------------------------------------------------------------------------------
/archived/aqua-ceramic-integration/services/curl-adapter/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "curl-adapter"
3 | version = "0.1.0"
4 | authors = ["Fluence Labs"]
5 | edition = "2018"
6 | publish = false
7 |
8 | [[bin]]
9 | path = "src/main.rs"
10 | name = "curl_adapter"
11 |
12 | [dependencies]
13 | marine-rs-sdk = { version = "0.7.1", features = ["logger"] }
14 | log = "0.4.14"
15 |
16 | [dev-dependencies]
17 | marine-rs-sdk-test = "0.8.2"
18 |
19 | [dev]
20 | [profile.release]
21 | opt-level = "s"
22 |
--------------------------------------------------------------------------------
/archived/curl_template/.gitignore:
--------------------------------------------------------------------------------
1 | target
2 | node_modules
3 | .idea
4 | .DS_Store
5 | .vscode
6 | .repl_history
--------------------------------------------------------------------------------
/archived/curl_template/backend/BackendConfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "backend",
3 | "mountedBinaries":
4 | {
5 | "curl": "/usr/bin/curl"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/archived/curl_template/backend/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "curl_template"
3 | version = "0.1.0"
4 | authors = ["Fluence Labs"]
5 | edition = "2018"
6 |
7 |
8 | [dependencies]
9 | marine-rs-sdk = { version = "=0.7.0" }
10 |
--------------------------------------------------------------------------------
/archived/curl_template/backend/src/main.rs:
--------------------------------------------------------------------------------
1 | #![allow(improper_ctypes)]
2 |
3 | use marine_rs_sdk::marine;
4 | use marine_rs_sdk::module_manifest;
5 | use marine_rs_sdk::MountedBinaryResult;
6 | use marine_rs_sdk::MountedBinaryStringResult;
7 |
8 | module_manifest!();
9 |
10 | fn main() {}
11 |
12 | #[marine]
13 | pub fn request(url: String) -> MountedBinaryStringResult {
14 | curl(vec!["-sS".into(), url]).stringify().unwrap()
15 | }
16 |
17 | // mounted_binaries are available to import like this:
18 | #[marine]
19 | #[link(wasm_import_module = "host")]
20 | extern "C" {
21 | pub fn curl(cmd: Vec) -> MountedBinaryResult;
22 | }
23 |
--------------------------------------------------------------------------------
/archived/curl_template/frontend/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # production
12 | /build
13 |
14 | # misc
15 | .DS_Store
16 | .env.local
17 | .env.development.local
18 | .env.test.local
19 | .env.production.local
20 |
21 | npm-debug.log*
22 | yarn-debug.log*
23 | yarn-error.log*
24 | .eslintcache
25 |
--------------------------------------------------------------------------------
/archived/curl_template/frontend/.prettierrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | semi: true,
3 | trailingComma: "all",
4 | singleQuote: true,
5 | printWidth: 120,
6 | tabWidth: 4,
7 | useTabs: false
8 | };
9 |
--------------------------------------------------------------------------------
/archived/curl_template/frontend/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | ## How to run
4 |
5 | To run app in the development mode use:
6 |
7 | npm start
8 |
9 | To run tests in the interactive watch mode use:
10 |
11 | npm test
12 |
13 | To make a production build use:
14 |
15 | npm run build
16 |
--------------------------------------------------------------------------------
/archived/curl_template/frontend/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fluencelabs/examples/fbfc344abfca1af2b5466554fec7af9d6f0d5eef/archived/curl_template/frontend/public/favicon.ico
--------------------------------------------------------------------------------
/archived/curl_template/frontend/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fluencelabs/examples/fbfc344abfca1af2b5466554fec7af9d6f0d5eef/archived/curl_template/frontend/public/logo192.png
--------------------------------------------------------------------------------
/archived/curl_template/frontend/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fluencelabs/examples/fbfc344abfca1af2b5466554fec7af9d6f0d5eef/archived/curl_template/frontend/public/logo512.png
--------------------------------------------------------------------------------
/archived/curl_template/frontend/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "React App",
3 | "name": "Create React App Sample",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | },
10 | {
11 | "src": "logo192.png",
12 | "type": "image/png",
13 | "sizes": "192x192"
14 | },
15 | {
16 | "src": "logo512.png",
17 | "type": "image/png",
18 | "sizes": "512x512"
19 | }
20 | ],
21 | "start_url": ".",
22 | "display": "standalone",
23 | "theme_color": "#000000",
24 | "background_color": "#ffffff"
25 | }
26 |
--------------------------------------------------------------------------------
/archived/curl_template/frontend/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 | Disallow:
4 |
--------------------------------------------------------------------------------
/archived/curl_template/frontend/src/index.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import './index.scss';
4 | import App from './components/App';
5 | import log from 'loglevel';
6 |
7 | log.setLevel('error');
8 |
9 | ReactDOM.render(
10 |
11 |
12 | ,
13 | document.getElementById('root'),
14 | );
15 |
--------------------------------------------------------------------------------
/archived/curl_template/frontend/src/react-app-env.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 |
--------------------------------------------------------------------------------
/archived/curl_template/frontend/src/setupTests.ts:
--------------------------------------------------------------------------------
1 | // jest-dom adds custom jest matchers for asserting on DOM nodes.
2 | // allows you to do things like:
3 | // expect(element).toHaveTextContent(/react/i)
4 | // learn more: https://github.com/testing-library/jest-dom
5 | import '@testing-library/jest-dom';
6 |
--------------------------------------------------------------------------------
/archived/curl_template/frontend/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es5",
4 | "lib": [
5 | "dom",
6 | "dom.iterable",
7 | "esnext"
8 | ],
9 | "baseUrl": ".",
10 | "noImplicitAny": false,
11 | "experimentalDecorators": true,
12 | "emitDecoratorMetadata": true,
13 | "allowJs": true,
14 | "skipLibCheck": true,
15 | "esModuleInterop": true,
16 | "allowSyntheticDefaultImports": true,
17 | "strict": true,
18 | "forceConsistentCasingInFileNames": true,
19 | "module": "esnext",
20 | "moduleResolution": "node",
21 | "resolveJsonModule": true,
22 | "isolatedModules": true,
23 | "noEmit": true,
24 | "noFallthroughCasesInSwitch": true,
25 | "jsx": "react-jsx"
26 | },
27 | "include": [
28 | "src"
29 | ]
30 | }
31 |
--------------------------------------------------------------------------------
/archived/curl_template/repl_config.toml:
--------------------------------------------------------------------------------
1 | modules_dir = "backend/target/wasm32-wasi/release/"
2 |
3 | [[module]]
4 | name = "curl_template"
5 | logger_enabled = true
6 |
7 | [module.mounted_binaries]
8 | curl = "/usr/bin/curl"
9 |
--------------------------------------------------------------------------------
/archived/curl_template/request.air:
--------------------------------------------------------------------------------
1 | (xor
2 | (seq
3 | (call relay (service "request") ["https://api.duckduckgo.com/?q=homotopy&format=json"] result)
4 | (call %init_peer_id% (returnService "run") [result])
5 | )
6 | (call %init_peer_id% (returnService "run") [%last_error%])
7 | )
8 |
--------------------------------------------------------------------------------
/archived/curl_template/script.air:
--------------------------------------------------------------------------------
1 | (seq
2 | (seq
3 | (call relay (service "request") ["https://api.duckduckgo.com/?q=condensed%20milk&format=json"] milk)
4 | (call relay (service "request") ["https://api.duckduckgo.com/?q=beetroot&format=json"] beetroot)
5 | )
6 | (call %init_peer_id% (returnService "run") [milk.$.stdout beetroot.$.stdout])
7 | )
8 |
--------------------------------------------------------------------------------
/archived/ether-price-getter/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | .repl_history
3 | /target
4 | **/**.bak
5 | **/**.bk
6 | /artifacts
7 | keypair.json
8 |
--------------------------------------------------------------------------------
/archived/ether-price-getter/Config.toml:
--------------------------------------------------------------------------------
1 | modules_dir = "artifacts/"
2 |
3 | [[module]]
4 | name = "curl_adapter"
5 | logger_enabled = true
6 |
7 | [module.mounted_binaries]
8 | curl = "/usr/bin/curl"
9 |
10 | [[module]]
11 | name = "ether_price_getter"
12 | logger_enabled = true
13 |
--------------------------------------------------------------------------------
/archived/ether-price-getter/air-scripts/get_eth_price.clj:
--------------------------------------------------------------------------------
1 | (xor
2 | (seq
3 | (call relay (service "ether_price_getter") ["32fc4c0e-59cf-4245-8f22-d4095de0f738" "EUR"] result)
4 | (call %init_peer_id% (returnService "run") [result])
5 | )
6 | (seq
7 | (call relay ("op" "identity") [])
8 | (call %init_peer_id% (returnService "run") ["XOR FAILED" %last_error%])
9 | )
10 | )
--------------------------------------------------------------------------------
/archived/ether-price-getter/build.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | set -o errexit -o nounset -o pipefail
3 |
4 | cd curl_adapter
5 | marine build --release
6 |
7 | cd ../ether_price_getter
8 | marine build --release
9 | cd ..
10 |
11 | mkdir -p artifacts
12 | rm -f artifacts/*.wasm
13 | cp curl_adapter/target/wasm32-wasi/release/curl_adapter.wasm artifacts/
14 | cp ether_price_getter/target/wasm32-wasi/release/ether_price_getter.wasm artifacts/
15 |
--------------------------------------------------------------------------------
/archived/ether-price-getter/curl_adapter/.gitignore:
--------------------------------------------------------------------------------
1 | DS_Store
2 | .repl_history
3 | /target
4 | **/**.bak
5 | **/**.bk
6 | Cargo.lock
7 |
--------------------------------------------------------------------------------
/archived/ether-price-getter/curl_adapter/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "curl_adapter"
3 | version = "0.1.0"
4 | authors = ["Fluence Labs"]
5 | edition = "2018"
6 | publish = false
7 |
8 | [[bin]]
9 | path = "src/main.rs"
10 | name = "curl_adapter"
11 |
12 | [dependencies]
13 | marine-rs-sdk = { version = "=0.7.0", features = ["logger"]}
14 | log = "0.4.8"
15 |
--------------------------------------------------------------------------------
/archived/ether-price-getter/curl_cfg.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "curl_adapter",
3 | "mountedBinaries": {
4 | "curl": "/usr/bin/curl"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/archived/ether-price-getter/ether_price_getter/.gitignore:
--------------------------------------------------------------------------------
1 | DS_Store
2 | .repl_history
3 | /target
4 | **/**.bak
5 | **/**.bk
6 | Cargo.lock
7 |
--------------------------------------------------------------------------------
/archived/ether-price-getter/ether_price_getter/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "ether_price_getter"
3 | version = "0.1.0"
4 | authors = ["Fluence Labs"]
5 | edition = "2018"
6 | publish = false
7 |
8 | [[bin]]
9 | name = "ether_price_getter"
10 | path = "src/main.rs"
11 |
12 | [dependencies]
13 | marine-rs-sdk = { version = "=0.7.0", features = ["logger"]}
14 | log = "0.4.8"
15 | fstrings = { version="0.2.3" }
16 |
--------------------------------------------------------------------------------
/archived/ether-price-getter/ether_price_getter_cfg.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Ether-Price-Getter"
3 | }
--------------------------------------------------------------------------------
/archived/fluence-cuckoo/cuckoo-filter/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | .repl_history
3 | /target
4 | **/**.bak
5 | **/**.bk
6 | /artifacts
7 | keypair.json
8 |
--------------------------------------------------------------------------------
/archived/fluence-cuckoo/cuckoo-filter/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "cuckoo-filter"
3 | version = "0.1.0"
4 | authors = ["boneyard93501 <4523011+boneyard93501@users.noreply.github.com>"]
5 | edition = "2018"
6 |
7 | [[bin]]
8 | name = "cuckoo_filter"
9 | path = "src/main.rs"
10 |
11 | [dependencies]
12 | serde = {version = "1.0.0" }
13 | serde_json = {version = "1.0.62"}
14 | cuckoofilter = {version="0.5.0", features=["serde_support"] }
15 | log = "0.4"
16 | marine-rs-sdk = { version = "0.7.0", features = ["logger"] }
17 | flate2 = "1.0.20"
--------------------------------------------------------------------------------
/archived/fluence-cuckoo/cuckoo-filter/Config.toml:
--------------------------------------------------------------------------------
1 | modules_dir = "artifacts/"
2 |
3 | [[module]]
4 | name = "cuckoo_filter"
5 | logger_enabled = true
6 |
7 |
--------------------------------------------------------------------------------
/archived/fluence-cuckoo/cuckoo-filter/air-scripts/cuckoo_create_cf.clj:
--------------------------------------------------------------------------------
1 | (xor
2 | (seq
3 | (call relay (service "create_cf") ["0"] result)
4 | (call %init_peer_id% (returnService "run") [result])
5 | )
6 | (seq
7 | (call relay ("op" "identity") [])
8 | (call %init_peer_id% (returnService "run") ["XOR FAILED"])
9 | )
10 | )
11 |
--------------------------------------------------------------------------------
/archived/fluence-cuckoo/cuckoo-filter/air-scripts/cuckoo_service_info.clj:
--------------------------------------------------------------------------------
1 | (seq
2 | (call relay (service "service_info") [] result)
3 | (call %init_peer_id% (returnService "run") [result])
4 | )
5 |
--------------------------------------------------------------------------------
/archived/fluence-cuckoo/cuckoo-filter/build.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | set -o errexit -o nounset -o pipefail
3 |
4 | cargo update --aggressive
5 | marine build --release
6 |
7 | mkdir -p artifacts
8 | rm -f artifacts/*
9 | cp target/wasm32-wasi/release/cuckoo_filter.wasm artifacts/
10 |
--------------------------------------------------------------------------------
/archived/fluence-cuckoo/cuckoo-filter/cuckoo_cfg.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "cuckoo_filter"
3 | }
--------------------------------------------------------------------------------
/archived/fluence-cuckoo/cuckoo-filter/test.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | fldist --env dev upload -p artifacts/fce-cuckoo.wasm --name "hey200"
3 |
--------------------------------------------------------------------------------
/archived/multi-service/Block-Getter-Config.toml:
--------------------------------------------------------------------------------
1 | modules_dir = "artifacts/"
2 |
3 | [[module]]
4 | name = "curl_adapter"
5 |
6 | [module.mounted_binaries]
7 | curl = "/usr/bin/curl"
8 |
9 |
10 | [[module]]
11 | name = "block_getter"
12 |
--------------------------------------------------------------------------------
/archived/multi-service/Block-Getter-with-Converter-Config.toml:
--------------------------------------------------------------------------------
1 | modules_dir = "artifacts/"
2 |
3 | [[module]]
4 | name = "curl_adapter"
5 |
6 | [module.mounted_binaries]
7 | curl = "/usr/bin/curl"
8 |
9 |
10 | [[module]]
11 | name = "block_getter"
12 |
13 | [[module]]
14 | name = "hex_converter"
15 |
--------------------------------------------------------------------------------
/archived/multi-service/Config.toml:
--------------------------------------------------------------------------------
1 | modules_dir = "artifacts/"
2 |
3 | [[module]]
4 | name = "curl_adapter"
5 |
6 | [module.mounted_binaries]
7 | curl = "/usr/bin/curl"
8 |
9 |
10 | [[module]]
11 | name = "block_getter"
12 |
13 | [[module]]
14 | name = "hex_converter"
15 |
16 | [[module]]
17 | name = "extract_miner_address"
--------------------------------------------------------------------------------
/archived/multi-service/air-scripts/add_stored_service.clj:
--------------------------------------------------------------------------------
1 | (xor
2 | (seq
3 | (call node ("script" "add") [script interval] id)
4 | (call %init_peer_id% (returnService "run") [id])
5 | )
6 | (seq
7 | (call relay ("op" "identity") [])
8 | (call %init_peer_id% (returnService "run") ["XOR FAILED" %last_error%])
9 | )
10 | )
11 |
--------------------------------------------------------------------------------
/archived/multi-service/air-scripts/am_i_owner.clj:
--------------------------------------------------------------------------------
1 | (xor
2 | (seq
3 | (seq
4 | (call relay ("op" "identity") [])
5 | (call node (service "am_i_owner") [] result)
6 | )
7 | (seq
8 | (call relay ("op" "identity") [])
9 | (call %init_peer_id% (returnService "run") [result])
10 | )
11 | )
12 | (seq
13 | (call relay ("op" "identity") [])
14 | (call %init_peer_id% (returnService "run") ["XOR FAILED" %last_error%])
15 | )
16 | )
17 |
--------------------------------------------------------------------------------
/archived/multi-service/air-scripts/curl_req.clj:
--------------------------------------------------------------------------------
1 | (xor
2 | (seq
3 | (seq
4 | (call relay ("op" "identity") [])
5 | (call node_1 (service "curl_request") ["https://api.duckduckgo.com/?q=homotopy&format=json"] result)
6 | )
7 | (seq
8 | (call relay ("op" "identity") [])
9 | (call %init_peer_id% (returnService "run") [result])
10 | )
11 | )
12 | (seq
13 | (call relay ("op" "identity") [])
14 | (call %init_peer_id% (returnService "run") [%last_error%])
15 | )
16 | )
17 |
18 |
19 |
--------------------------------------------------------------------------------
/archived/multi-service/air-scripts/ethqlite_init.clj:
--------------------------------------------------------------------------------
1 | (xor
2 | (seq
3 | (seq
4 | (call relay ("op" "identity") [])
5 | (call node (service "init_service") [] result)
6 | )
7 | (seq
8 | (call relay ("op" "identity") [])
9 | (call %init_peer_id% (returnService "run") [result])
10 | )
11 | )
12 | (seq
13 | (call relay ("op" "identity") [])
14 | (call %init_peer_id% (returnService "run") ["XOR FAILED" %last_error%])
15 | )
16 | )
--------------------------------------------------------------------------------
/archived/multi-service/air-scripts/ethqlite_owner.clj:
--------------------------------------------------------------------------------
1 | (xor
2 | (seq
3 | (seq
4 | (call relay ("op" "identity") [])
5 | (call node_1 (service "am_i_owner") [] result)
6 | ; (call node_1 (service "get_tplet") [] result)
7 | )
8 | (seq
9 | (call relay ("op" "identity") [])
10 | (call %init_peer_id% (returnService "run") [result])
11 | )
12 | )
13 | (seq
14 | (call relay ("op" "identity") [])
15 | (call %init_peer_id% (returnService "run") ["XOR FAILED" %last_error%])
16 | )
17 | )
--------------------------------------------------------------------------------
/archived/multi-service/air-scripts/ethqlite_reset.clj:
--------------------------------------------------------------------------------
1 | (xor
2 | (seq
3 | (seq
4 | (call relay ("op" "identity") [])
5 | (call node_1 (service "owner_nuclear_reset") [] result)
6 | )
7 | (seq
8 | (call relay ("op" "identity") [])
9 | (call %init_peer_id% (returnService "run") [result])
10 | )
11 | )
12 | (seq
13 | (call relay ("op" "identity") [])
14 | (call %init_peer_id% (returnService "run") ["XOR FAILED" %last_error%])
15 | )
16 | )
--------------------------------------------------------------------------------
/archived/multi-service/air-scripts/get_address.clj:
--------------------------------------------------------------------------------
1 | (xor
2 | (seq
3 | (seq
4 | (call relay ("op" "identity") [])
5 | (call my_node (service "extract_miner_address") [json_string] result)
6 | )
7 | (seq
8 | (call relay ("op" "identity") [])
9 | (call %init_peer_id% (returnService "run") [result])
10 | )
11 | )
12 | (seq
13 | (call relay ("op" "identity") [])
14 | (call %init_peer_id% (returnService "run") ["XOR FAILED" %last_error%])
15 | )
16 | )
--------------------------------------------------------------------------------
/archived/multi-service/air-scripts/get_block_simple.clj:
--------------------------------------------------------------------------------
1 | (xor
2 | (seq
3 | (seq
4 | (call relay ("op" "identity") [])
5 | (call node_1 (service "get_block") [api_key block_num] result)
6 | )
7 | (seq
8 | (call relay ("op" "identity") [])
9 | (call %init_peer_id% (returnService "run") [result])
10 | )
11 | )
12 | (seq
13 | (call relay ("op" "identity") [])
14 | (call %init_peer_id% (returnService "run") ["XOR FAILED" %last_error%])
15 | )
16 | )
--------------------------------------------------------------------------------
/archived/multi-service/air-scripts/get_latest_block.clj:
--------------------------------------------------------------------------------
1 | (xor
2 | (seq
3 |
4 | (call node_1 (service_1 "get_latest_block") [api_key] hex_result)
5 | (call %init_peer_id% (returnService "run") [hex_result])
6 | (call node_2 (service_2 "hex_to_int") [hex_result] result)
7 | (call %init_peer_id% (returnService "run") [result])
8 | )
9 | (seq
10 | (call relay ("op" "identity") [])
11 | (call %init_peer_id% (returnService "run") ["XOR FAILED" %last_error%])
12 | )
13 | )
--------------------------------------------------------------------------------
/archived/multi-service/air-scripts/get_latest_block_simple.clj:
--------------------------------------------------------------------------------
1 | (xor
2 | (seq
3 | (seq
4 | (call relay ("op" "identity") [])
5 | (call node_1 (service "get_latest_block") [api_key] hex_result)
6 | )
7 | (seq
8 | (call relay ("op" "identity") [])
9 | (call %init_peer_id% (returnService "run") [hex_result])
10 | )
11 | )
12 | (seq
13 | (call relay ("op" "identity") [])
14 | (call %init_peer_id% (returnService "run") ["XOR FAILED" %last_error%])
15 | )
16 | )
--------------------------------------------------------------------------------
/archived/multi-service/air-scripts/hex2int.clj:
--------------------------------------------------------------------------------
1 | (xor
2 | (seq
3 | (seq
4 | (call relay ("op" "identity") [])
5 | (call node_1 (service "hex_to_int") [hex_string] hex_result)
6 | )
7 | (seq
8 | (call relay ("op" "identity") [])
9 | (call %init_peer_id% (returnService "run") [hex_result])
10 | )
11 | )
12 | (seq
13 | (call relay ("op" "identity") [])
14 | (call %init_peer_id% (returnService "run") ["XOR FAILED" %last_error%])
15 | )
16 | )
--------------------------------------------------------------------------------
/archived/multi-service/air-scripts/list_stored_services.clj:
--------------------------------------------------------------------------------
1 | (xor
2 | (seq
3 | (call node ("script" "list") [] list)
4 | (call %init_peer_id% (returnService "run") [list])
5 | )
6 | (seq
7 | (call relay ("op" "identity") [])
8 | (call %init_peer_id% (returnService "run") ["XOR FAILED" %last_error%])
9 | )
10 | )
11 |
--------------------------------------------------------------------------------
/archived/multi-service/air-scripts/remove_stored_service.clj:
--------------------------------------------------------------------------------
1 | (xor
2 | (seq
3 | (call node ("script" "remove") [script_id] result)
4 | (call %init_peer_id% (returnService "run") [result])
5 | )
6 | (seq
7 | (call relay ("op" "identity") [])
8 | (call %init_peer_id% (returnService "run") ["XOR FAILED" %last_error%])
9 | )
10 | )
11 |
--------------------------------------------------------------------------------
/archived/multi-service/air-scripts/test_air.clj:
--------------------------------------------------------------------------------
1 | (xor
2 | (seq
3 | (call relay (service "get_latest_block") [api_key] result)
4 | (call %init_peer_id% (returnService "run") [result])
5 | )
6 | (seq
7 | (call relay ("op" "identity") [])
8 | (call %init_peer_id% (returnService "run") ["XOR FAILED" %last_error%])
9 | )
10 | )
11 |
--------------------------------------------------------------------------------
/archived/multi-service/block_getter/.gitignore:
--------------------------------------------------------------------------------
1 | DS_Store
2 | .repl_history
3 | /target
4 | **/**.bak
5 | **/**.bk
6 | Cargo.lock
7 |
--------------------------------------------------------------------------------
/archived/multi-service/block_getter/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "block_getter"
3 | version = "0.1.0"
4 | authors = ["boneyard93501 <4523011+boneyard93501@users.noreply.github.com>"]
5 | edition = "2018"
6 |
7 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
8 |
9 | [dependencies]
10 | marine-rs-sdk = { version = "=0.7.0", features = ["logger"] }
11 | log = "0.4.14"
12 | serde_json = "1.0.64"
13 | fstrings = "0.2.3"
14 |
--------------------------------------------------------------------------------
/archived/multi-service/config/block_getter_cfg.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Ethereum Block Getter",
3 | "DESCRIPTION": "Provides etherscan.io get_latest_block and get_block data Ethereum getters",
4 | "INTERFACES": [
5 | "fn get_block(api_key: String, block_number: U32) -> String",
6 | "fn get_latest_block(api_key: String) -> String"
7 | ],
8 | "WEBSITE": "https://github.com/fluencelabs/examples/tree/main/multi-service/block_getter",
9 | "INTERFACES": "fn curl_request(curl_cmd: Array) -> Result"
10 | }
--------------------------------------------------------------------------------
/archived/multi-service/config/curl_cfg.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "curl_adapter",
3 | "mountedBinaries": {
4 | "curl": "/usr/bin/curl"
5 | },
6 | "DESCRIPTION": "Adapter for node-level curl call",
7 | "WEBSITE": "https://github.com/fluencelabs/examples/tree/main/multi-service/curl_adapter",
8 | "INTERFACES": "fn curl_request(curl_cmd: Array) -> Result"
9 | }
--------------------------------------------------------------------------------
/archived/multi-service/config/extract_miner_address_cfg.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "ExtractMinerAddress"
3 | }
--------------------------------------------------------------------------------
/archived/multi-service/config/hex_converter_cfg.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Hex Converter",
3 | "WEBSITE": "https://github.com/fluencelabs/examples/tree/main/multi-service/hex_converter",
4 | "INTERFACES": "fn hex_to_int(data: String) -> U64"
5 | }
--------------------------------------------------------------------------------
/archived/multi-service/config/my_keypair.json:
--------------------------------------------------------------------------------
1 | {
2 | id: '12D3KooWJLm7n3GpZasv5gsAkta8BYBKHHC19PZ6U8kzWNaabjNz',
3 | privKey: 'CAESYKG9Z8F1pUj2st8iziQ7ha9a70Fqpa0UK1aY9Y9n6wnkfqbeNr2/LBfAGHJ4ocmIOjia1FYbYuYH6+Eqgssr7aN+pt42vb8sF8AYcnihyYg6OJrUVhti5gfr4SqCyyvtow==',
4 | pubKey: 'CAESIH6m3ja9vywXwBhyeKHJiDo4mtRWG2LmB+vhKoLLK+2j',
5 | seed: 'BtN9ikmpcSRgBWgwLF9yoSZeyuzmYvc5Czyn8XRy514P'
6 | }
7 |
--------------------------------------------------------------------------------
/archived/multi-service/curl_adapter/.gitignore:
--------------------------------------------------------------------------------
1 | DS_Store
2 | .repl_history
3 | /target
4 | **/**.bak
5 | **/**.bk
6 | Cargo.lock
7 |
--------------------------------------------------------------------------------
/archived/multi-service/curl_adapter/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "curl_adapter"
3 | version = "0.1.0"
4 | authors = ["Fluence Labs"]
5 | edition = "2018"
6 | publish = false
7 |
8 | [[bin]]
9 | path = "src/main.rs"
10 | name = "curl_adapter"
11 |
12 | [dependencies]
13 | marine-rs-sdk = { version = "=0.7.0", features = ["logger"] }
14 | log = "0.4.14"
15 | serde_json = "1.0.64"
16 |
--------------------------------------------------------------------------------
/archived/multi-service/ethqlite/.gitignore:
--------------------------------------------------------------------------------
1 | DS_Store
2 | .repl_history
3 | /target
4 | **/**.bak
5 | **/**.bk
6 | Cargo.lock
7 |
--------------------------------------------------------------------------------
/archived/multi-service/ethqlite/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "ethqlite"
3 | version = "0.1.0"
4 | authors = ["boneyard93501 <4523011+boneyard93501@users.noreply.github.com>"]
5 | edition = "2018"
6 |
7 | [[bin]]
8 | name = "ethqlite"
9 | path = "src/main.rs"
10 |
11 | [dependencies]
12 | marine-rs-sdk = { version = "0.7.0", features = ["logger"] }
13 | log = "0.4.8"
14 | marine-sqlite-connector = "0.5.1"
15 | serde = { version = "1.0.118", features = ["derive"] }
16 | serde_json = "1.0.64"
17 | once_cell = "1.4.1"
18 | ed25519-dalek = "1.0.1"
19 | rand = "0.7.3"
20 | uuid = { version = "0.8.2", features = ["serde", "v4"] }
21 |
--------------------------------------------------------------------------------
/archived/multi-service/ethqlite/Config.toml:
--------------------------------------------------------------------------------
1 | modules_dir = "artifacts/"
2 |
3 | [[module]]
4 | name = "sqlite3"
5 | mem_pages_count = 100
6 | logger_enabled = false
7 |
8 | [module.wasi]
9 | preopened_files = ["/tmp"]
10 | mapped_dirs = { "tmp" = "/tmp" }
11 |
12 |
13 |
14 | [[module]]
15 | name = "ethqlite"
16 | mem_pages_count = 1
17 | logger_enabled = false
18 |
19 | [module.wasi]
20 | preopened_files = ["/tmp"]
21 | mapped_dirs = { "tmp" = "/tmp" }
--------------------------------------------------------------------------------
/archived/multi-service/ethqlite/build.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | set -o errexit -o nounset -o pipefail
3 |
4 |
5 | cargo update --aggressive
6 | marine build --release
7 |
8 | rm -f artifacts/*.wasm
9 | cp target/wasm32-wasi/release/ethqlite.wasm artifacts/
10 | wget https://github.com/fluencelabs/sqlite/releases/download/v0.15.0_w/sqlite3.wasm
11 | mv sqlite3.wasm artifacts/
12 |
--------------------------------------------------------------------------------
/archived/multi-service/ethqlite/ethqlite_cfg.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "ethqlite",
3 | "mem_page_count": 1,
4 | "preopened_files": [
5 | "/tmp"
6 | ],
7 | "mapped_dirs": {
8 | "tmp": "./tmp"
9 | }
10 | }
--------------------------------------------------------------------------------
/archived/multi-service/ethqlite/sqlite3_cfg.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "sqlite3",
3 | "mem_pages_count": 100
4 | }
--------------------------------------------------------------------------------
/archived/multi-service/extract_miner_address/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "extract_miner_address"
3 | version = "0.1.0"
4 | authors = ["boneyard93501 <4523011+boneyard93501@users.noreply.github.com>"]
5 | edition = "2018"
6 |
7 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
8 |
9 | [dependencies]
10 | marine-rs-sdk = { version = "=0.7.0", features = ["logger"] }
11 | log = "0.4.8"
12 | serde_json = "1.0.64"
13 |
--------------------------------------------------------------------------------
/archived/multi-service/extract_miner_address/src/main.rs:
--------------------------------------------------------------------------------
1 | use marine_rs_sdk::module_manifest;
2 | use marine_rs_sdk::{marine, WasmLoggerBuilder};
3 | use serde_json;
4 |
5 | module_manifest!();
6 |
7 | fn main() {
8 | WasmLoggerBuilder::new().build().ok();
9 | }
10 |
11 | #[marine]
12 | pub fn extract_miner_address(json_string: String) -> String {
13 | let obj = serde_json::from_str::(&json_string);
14 | match obj {
15 | Ok(x) => x["result"]["blockMiner"].to_string(),
16 | // Ok(x) => json_string,
17 | Err(_) => String::from("boo yah"),
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/archived/multi-service/hex_converter/.gitignore:
--------------------------------------------------------------------------------
1 | /target
2 |
--------------------------------------------------------------------------------
/archived/multi-service/hex_converter/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "hex_converter"
3 | version = "0.1.0"
4 | authors = ["boneyard93501 <4523011+boneyard93501@users.noreply.github.com>"]
5 | edition = "2018"
6 |
7 | [dependencies]
8 | marine-rs-sdk = { version = "=0.7.0", features = ["logger"] }
9 | log = "0.4.8"
10 | serde_json = "1.0.64"
11 |
--------------------------------------------------------------------------------
/archived/multi-service/scripts/build.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | set -o errexit -o nounset -o pipefail
3 |
4 | cd curl_adapter
5 | marine build --release
6 |
7 | cd ../hex_converter
8 | marine build --release
9 |
10 | cd ../block_getter
11 | marine build --release
12 |
13 | cd ../extract_miner_address
14 | marine build --release
15 | cd ..
16 |
17 | mkdir -p artifacts
18 | rm -f artifacts/*.wasm
19 |
20 | cp curl_adapter/target/wasm32-wasi/release/curl_adapter.wasm artifacts/
21 | cp hex_converter/target/wasm32-wasi/release/hex_converter.wasm artifacts/
22 | cp block_getter/target/wasm32-wasi/release/block_getter.wasm artifacts/
23 | cp extract_miner_address/target/wasm32-wasi/release/extract_miner_address.wasm artifacts/
24 |
--------------------------------------------------------------------------------
/archived/multi-service/scripts/deploy.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | set -euo pipefail
3 |
4 | # check `fcli` and `fldist` tools are installed or install them
5 | (command -v marine || cargo install marine) >/dev/null
6 | (command -v fldist || npm install -g @fluencelabs/fldist) >/dev/null
7 |
8 | # build .wasm
9 | (
10 | cd backend
11 | marine build --release
12 | )
13 |
14 | # check it .wasm was built
15 | WASM="backend/target/wasm32-wasi/release/curl_template.wasm"
16 | test -f "$WASM" || echo >&2 "Couldn't find $WASM"
17 |
18 | # create a service from that .wasm
19 | CONFIG="$(pwd)/backend/BackendConfig.json"
20 | fldist new_service --modules "$WASM:$CONFIG" --name curl_template
--------------------------------------------------------------------------------
/archived/multi-service/simple_range_func/.gitignore:
--------------------------------------------------------------------------------
1 | DS_Store
2 | .repl_history
3 | /target
4 | **/**.bak
5 | **/**.bk
6 | Cargo.lock
7 |
--------------------------------------------------------------------------------
/archived/multi-service/simple_range_func/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "simple_range_list"
3 | version = "0.1.0"
4 | authors = ["Fluence Team"]
5 | edition = "2018"
6 |
7 | [dependencies]
8 | marine-rs-sdk = { version = "0.6.2", features = ["logger"]}
9 | log = "0.4.8"
--------------------------------------------------------------------------------
/archived/multi-service/simple_range_func/src/main.rs:
--------------------------------------------------------------------------------
1 | use marine_rs_sdk::marine;
2 | use marine_rs_sdk::module_manifest;
3 |
4 | module_manifest!();
5 |
6 | fn main() {}
7 |
8 | #[marine]
9 | fn simple_range_list(start: i64, step: u32, n: u32) -> Vec {
10 | let mut result: Vec = Vec::new();
11 | let stop = start - n as i64;
12 | for x in (start..stop).step_by(step as usize) {
13 | result.push(x);
14 | }
15 | result
16 | }
17 |
--------------------------------------------------------------------------------
/archived/web3-examples/web-frontend/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # production
12 | /build
13 |
14 | # misc
15 | .DS_Store
16 | .env.local
17 | .env.development.local
18 | .env.test.local
19 | .env.production.local
20 |
21 | npm-debug.log*
22 | yarn-debug.log*
23 | yarn-error.log*
24 | .eslintcache
25 |
--------------------------------------------------------------------------------
/archived/web3-examples/web-frontend/.prettierrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | semi: true,
3 | trailingComma: "all",
4 | singleQuote: true,
5 | printWidth: 120,
6 | tabWidth: 4,
7 | useTabs: false
8 | };
9 |
--------------------------------------------------------------------------------
/archived/web3-examples/web-frontend/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | ## How to run
4 |
5 | To run app in the development mode use:
6 |
7 | npm start
8 |
9 | To run tests in the interactive watch mode use:
10 |
11 | npm test
12 |
13 | To make a production build use:
14 |
15 | npm run build
16 |
--------------------------------------------------------------------------------
/archived/web3-examples/web-frontend/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fluencelabs/examples/fbfc344abfca1af2b5466554fec7af9d6f0d5eef/archived/web3-examples/web-frontend/public/favicon.ico
--------------------------------------------------------------------------------
/archived/web3-examples/web-frontend/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fluencelabs/examples/fbfc344abfca1af2b5466554fec7af9d6f0d5eef/archived/web3-examples/web-frontend/public/logo192.png
--------------------------------------------------------------------------------
/archived/web3-examples/web-frontend/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fluencelabs/examples/fbfc344abfca1af2b5466554fec7af9d6f0d5eef/archived/web3-examples/web-frontend/public/logo512.png
--------------------------------------------------------------------------------
/archived/web3-examples/web-frontend/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "React App",
3 | "name": "Create React App Sample",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | },
10 | {
11 | "src": "logo192.png",
12 | "type": "image/png",
13 | "sizes": "192x192"
14 | },
15 | {
16 | "src": "logo512.png",
17 | "type": "image/png",
18 | "sizes": "512x512"
19 | }
20 | ],
21 | "start_url": ".",
22 | "display": "standalone",
23 | "theme_color": "#000000",
24 | "background_color": "#ffffff"
25 | }
26 |
--------------------------------------------------------------------------------
/archived/web3-examples/web-frontend/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 | Disallow:
4 |
--------------------------------------------------------------------------------
/archived/web3-examples/web-frontend/src/index.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import './index.scss';
4 | import App from './components/App';
5 | import log from 'loglevel';
6 |
7 | log.setLevel('error');
8 |
9 | ReactDOM.render(
10 |
11 |
12 | ,
13 | document.getElementById('root'),
14 | );
15 |
--------------------------------------------------------------------------------
/archived/web3-examples/web-frontend/src/react-app-env.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 |
--------------------------------------------------------------------------------
/archived/web3-examples/web-frontend/src/setupTests.ts:
--------------------------------------------------------------------------------
1 | // jest-dom adds custom jest matchers for asserting on DOM nodes.
2 | // allows you to do things like:
3 | // expect(element).toHaveTextContent(/react/i)
4 | // learn more: https://github.com/testing-library/jest-dom
5 | import '@testing-library/jest-dom';
6 |
--------------------------------------------------------------------------------
/archived/web3-examples/web-frontend/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es5",
4 | "lib": [
5 | "dom",
6 | "dom.iterable",
7 | "esnext"
8 | ],
9 | "baseUrl": ".",
10 | "noImplicitAny": false,
11 | "experimentalDecorators": true,
12 | "emitDecoratorMetadata": true,
13 | "allowJs": true,
14 | "skipLibCheck": true,
15 | "esModuleInterop": true,
16 | "allowSyntheticDefaultImports": true,
17 | "strict": true,
18 | "forceConsistentCasingInFileNames": true,
19 | "module": "esnext",
20 | "moduleResolution": "node",
21 | "resolveJsonModule": true,
22 | "isolatedModules": true,
23 | "noEmit": true,
24 | "noFallthroughCasesInSwitch": true,
25 | "jsx": "react-jsx"
26 | },
27 | "include": [
28 | "src"
29 | ]
30 | }
31 |
--------------------------------------------------------------------------------
/archived/web3-examples/web3-examples/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | .repl_history
3 | /target
4 | **/**.bak
5 | **/**.bk
6 |
7 |
--------------------------------------------------------------------------------
/archived/web3-examples/web3-examples/Config.toml:
--------------------------------------------------------------------------------
1 | modules_dir = "artifacts/"
2 |
3 | [[module]]
4 | name = "curl_adapter"
5 | # logger_enabled = false
6 |
7 | [module.mounted_binaries]
8 | curl = "/usr/bin/curl"
9 |
10 | [[module]]
11 | name = "facade"
12 | # logger_enabled = true
13 |
--------------------------------------------------------------------------------
/archived/web3-examples/web3-examples/build.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | set -o errexit -o nounset -o pipefail
3 |
4 | cd curl_adapter
5 | cargo update --aggressive
6 | marine build --release
7 |
8 | cd ../facade
9 | cargo update --aggressive
10 | marine build --release
11 | cd ..
12 |
13 | mkdir -p artifacts
14 | rm -f artifacts/*.wasm
15 |
16 | cp curl_adapter/target/wasm32-wasi/release/curl_adapter.wasm artifacts/
17 | cp facade/target/wasm32-wasi/release/facade.wasm artifacts/
18 |
--------------------------------------------------------------------------------
/archived/web3-examples/web3-examples/curl_adapter/.gitignore:
--------------------------------------------------------------------------------
1 | DS_Store
2 | .repl_history
3 | /target
4 | **/**.bak
5 | **/**.bk
6 |
--------------------------------------------------------------------------------
/archived/web3-examples/web3-examples/curl_adapter/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "curl_adapter"
3 | version = "0.1.0"
4 | authors = ["Fluence Labs"]
5 | edition = "2018"
6 | publish = false
7 |
8 | [[bin]]
9 | path = "src/main.rs"
10 | name = "curl_adapter"
11 |
12 | [dependencies]
13 | marine-rs-sdk = { version = "=0.7.0", features = ["logger"]}
14 | log = "0.4.8"
15 |
--------------------------------------------------------------------------------
/archived/web3-examples/web3-examples/curl_adapter/Config.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "curl_adapter",
3 | "mountedBinaries":
4 | {
5 | "curl": "/usr/bin/curl"
6 | }
7 | }
--------------------------------------------------------------------------------
/archived/web3-examples/web3-examples/docs/Frontend.md:
--------------------------------------------------------------------------------
1 | ## Idea for frontend
2 |
3 | * Use the eth_get_balance function and do a periodic pull into a sqlite db
4 | * requires : blockchain url, account
5 |
6 | * Graph the account balance from the sqlite data
7 |
8 | For an example implementation, we could use
9 | * Mainnet
10 | * DAI account
11 | *
--------------------------------------------------------------------------------
/archived/web3-examples/web3-examples/facade/.gitignore:
--------------------------------------------------------------------------------
1 | DS_Store
2 | .repl_history
3 | /target
4 | **/**.bak
5 | **/**.bk
6 |
--------------------------------------------------------------------------------
/archived/web3-examples/web3-examples/facade/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "facade"
3 | version = "0.1.0"
4 | authors = ["Fluence Labs"]
5 | edition = "2018"
6 | publish = false
7 |
8 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
9 |
10 | [[bin]]
11 | name = "facade"
12 | path = "src/main.rs"
13 |
14 | [dependencies]
15 | serde = { version = "1.0.118", features = ["derive"] }
16 | serde_json = "1.0.64"
17 | marine-rs-sdk = { version = "=0.7.0", features = ["logger"] }
18 | log = "0.4.8"
19 | chrono = "0.4.19"
20 | ethereum-types = "0.11.0"
21 | hex = "0.4.3"
22 | tiny-keccak = { version = "2.0.2", features = ["keccak", "sha3"] }
23 | marine-sqlite-connector = "0.5.1"
24 |
--------------------------------------------------------------------------------
/js-client-examples/browser-example/fluence.yaml:
--------------------------------------------------------------------------------
1 | # yaml-language-server: $schema=.fluence/schemas/fluence.json
2 |
3 | # 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
4 |
5 | # Documentation: https://github.com/fluencelabs/cli/tree/main/docs/configs/fluence.md
6 |
7 | version: 5
8 |
9 | aquaInputPath: src/aqua
10 |
11 | relaysPath: src/frontend/src
12 |
13 | aquaOutputTSPath: src/frontend/src/compiled-aqua
14 |
--------------------------------------------------------------------------------
/js-client-examples/browser-example/src/aqua/getting-started.aqua:
--------------------------------------------------------------------------------
1 | import "@fluencelabs/aqua-lib/builtin.aqua"
2 |
3 | func getRelayTime(relayPeerId: PeerId) -> u64:
4 | on relayPeerId:
5 | ts <- Peer.timestamp_ms()
6 | <- ts
7 |
--------------------------------------------------------------------------------
/js-client-examples/browser-example/src/frontend/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # production
12 | /build
13 |
14 | # misc
15 | .DS_Store
16 | .env.local
17 | .env.development.local
18 | .env.test.local
19 | .env.production.local
20 |
21 | npm-debug.log*
22 | yarn-debug.log*
23 | yarn-error.log*
24 |
25 | # fluence
26 |
27 | src/compiled-aqua/*
28 |
29 | public/*.wasm
30 | public/runnerScript.*
--------------------------------------------------------------------------------
/js-client-examples/browser-example/src/frontend/.prettierrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | semi: true,
3 | trailingComma: 'all',
4 | singleQuote: true,
5 | printWidth: 120,
6 | tabWidth: 4,
7 | useTabs: false,
8 | };
9 |
--------------------------------------------------------------------------------
/js-client-examples/browser-example/src/frontend/jest.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | preset: 'jest-puppeteer',
3 | testMatch: ['**/?(*.)+(spec|test).[t]s'],
4 | testPathIgnorePatterns: ['/node_modules/', 'dist'],
5 | transform: {
6 | '^.+\\.ts?$': 'ts-jest',
7 | },
8 | };
9 |
--------------------------------------------------------------------------------
/js-client-examples/browser-example/src/frontend/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fluencelabs/examples/fbfc344abfca1af2b5466554fec7af9d6f0d5eef/js-client-examples/browser-example/src/frontend/public/favicon.ico
--------------------------------------------------------------------------------
/js-client-examples/browser-example/src/frontend/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fluencelabs/examples/fbfc344abfca1af2b5466554fec7af9d6f0d5eef/js-client-examples/browser-example/src/frontend/public/logo192.png
--------------------------------------------------------------------------------
/js-client-examples/browser-example/src/frontend/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fluencelabs/examples/fbfc344abfca1af2b5466554fec7af9d6f0d5eef/js-client-examples/browser-example/src/frontend/public/logo512.png
--------------------------------------------------------------------------------
/js-client-examples/browser-example/src/frontend/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "React App",
3 | "name": "Create React App Sample",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | },
10 | {
11 | "src": "logo192.png",
12 | "type": "image/png",
13 | "sizes": "192x192"
14 | },
15 | {
16 | "src": "logo512.png",
17 | "type": "image/png",
18 | "sizes": "512x512"
19 | }
20 | ],
21 | "start_url": ".",
22 | "display": "standalone",
23 | "theme_color": "#000000",
24 | "background_color": "#ffffff"
25 | }
26 |
--------------------------------------------------------------------------------
/js-client-examples/browser-example/src/frontend/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 | Disallow:
4 |
--------------------------------------------------------------------------------
/js-client-examples/browser-example/src/frontend/src/index.css:
--------------------------------------------------------------------------------
1 | body {
2 | margin: 0;
3 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
4 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
5 | sans-serif;
6 | -webkit-font-smoothing: antialiased;
7 | -moz-osx-font-smoothing: grayscale;
8 | }
9 |
10 | code {
11 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
12 | monospace;
13 | }
14 |
--------------------------------------------------------------------------------
/js-client-examples/browser-example/src/frontend/src/index.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import './index.css';
4 | import App from './App';
5 |
6 | ReactDOM.render(
7 |
8 |
9 | ,
10 | document.getElementById('root'),
11 | );
12 |
--------------------------------------------------------------------------------
/js-client-examples/browser-example/src/frontend/src/react-app-env.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 |
--------------------------------------------------------------------------------
/js-client-examples/browser-example/src/frontend/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es5",
4 | "lib": [
5 | "dom",
6 | "dom.iterable",
7 | "esnext"
8 | ],
9 | "allowJs": true,
10 | "skipLibCheck": true,
11 | "esModuleInterop": true,
12 | "noImplicitAny": false,
13 | "allowSyntheticDefaultImports": true,
14 | "strict": true,
15 | "forceConsistentCasingInFileNames": true,
16 | "noFallthroughCasesInSwitch": true,
17 | "module": "esnext",
18 | "moduleResolution": "node",
19 | "resolveJsonModule": true,
20 | "isolatedModules": false,
21 | "noEmit": true,
22 | "jsx": "react-jsx",
23 |
24 | },
25 | "include": [
26 | "src"
27 | ]
28 | }
29 |
--------------------------------------------------------------------------------
/js-client-examples/hello-world/README.md:
--------------------------------------------------------------------------------
1 | # Getting Started with Fluence
2 |
3 | This is a minimalistic Node.js application for Fluence using Fluence JS Client.
4 |
5 | > To run this example you need `@latest` version of Fluence CLI. You can find installation guide [here](https://github.com/fluencelabs/cli).
6 |
7 | ## Getting started
8 |
9 | Go to `src/frontend` folder:
10 |
11 | ```bash
12 | cd ./src/frontend
13 | ```
14 |
15 | Install dependencies:
16 |
17 | ```bash
18 | npm i
19 | ```
20 |
21 | Run aqua compiler:
22 |
23 | ```bash
24 | fluence aqua
25 | ```
26 |
27 | Run the Node.js application:
28 |
29 | ```bash
30 | npm start
31 | ```
32 |
33 | ## Learn more
34 |
35 | To learn more, refer to the
36 | [documentation page](https://fluence.dev//docs/build/js-client/js-client)
37 |
--------------------------------------------------------------------------------
/js-client-examples/hello-world/fluence.yaml:
--------------------------------------------------------------------------------
1 | # yaml-language-server: $schema=.fluence/schemas/fluence.json
2 |
3 | # 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
4 |
5 | # Documentation: https://github.com/fluencelabs/cli/tree/main/docs/configs/fluence.md
6 |
7 | version: 5
8 |
9 | aquaInputPath: src/aqua
10 |
11 | relaysPath: src/frontend/src
12 |
13 | aquaOutputTSPath: src/frontend/src/compiled-aqua
14 |
--------------------------------------------------------------------------------
/js-client-examples/hello-world/src/aqua/hello-world.aqua:
--------------------------------------------------------------------------------
1 | import Peer from "@fluencelabs/aqua-lib/builtin.aqua"
2 |
3 | service HelloWorld("hello-world"):
4 | hello(str: string)
5 | getFortune() -> string
6 |
7 | func sayHello() -> string:
8 | HelloWorld.hello("Hello, world!")
9 | <- "OK"
10 |
11 | func tellFortune() -> string:
12 | res <- HelloWorld.getFortune()
13 | <- res
14 |
15 | func getRelayTime() -> u64:
16 | on HOST_PEER_ID:
17 | ts <- Peer.timestamp_ms()
18 | <- ts
19 |
--------------------------------------------------------------------------------
/js-client-examples/hello-world/src/frontend/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # production
12 | /build
13 |
14 | /dist
15 |
16 | # misc
17 | .DS_Store
18 | .env.local
19 | .env.development.local
20 | .env.test.local
21 | .env.production.local
22 |
23 | npm-debug.log*
24 | yarn-debug.log*
25 | yarn-error.log*
26 |
27 |
28 | # fluence
29 |
30 | src/compiled-aqua/*
31 |
--------------------------------------------------------------------------------
/js-client-examples/hello-world/src/frontend/.prettierrc.cjs:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | semi: true,
3 | trailingComma: 'all',
4 | singleQuote: true,
5 | printWidth: 120,
6 | tabWidth: 4,
7 | useTabs: false,
8 | };
9 |
--------------------------------------------------------------------------------
/js-client-examples/hello-world/src/frontend/jest.config.cjs:
--------------------------------------------------------------------------------
1 | /** @type {import('ts-jest').JestConfigWithTsJest} */
2 | module.exports = {
3 | extensionsToTreatAsEsm: ['.ts'],
4 | moduleNameMapper: {
5 | '^(\\.{1,2}/.*)\\.js$': '$1',
6 | },
7 | testPathIgnorePatterns: ['dist'],
8 | transform: {
9 | '^.+\\.tsx?$': [
10 | 'ts-jest',
11 | {
12 | useESM: true,
13 | },
14 | ],
15 | },
16 | };
17 |
--------------------------------------------------------------------------------
/js-client-examples/hello-world/src/frontend/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "hello-world",
3 | "version": "1.0.0",
4 | "description": "",
5 | "type": "module",
6 | "main": "index.js",
7 | "scripts": {
8 | "start": "node --loader ts-node/esm ./src/index.ts",
9 | "build": "tsc",
10 | "test": "jest"
11 | },
12 | "author": "",
13 | "license": "ISC",
14 | "devDependencies": {
15 | "ts-node": "10.9.1",
16 | "typescript": "^4.6.3",
17 | "@types/jest": "29.4.0",
18 | "jest": "29.4.1",
19 | "ts-jest": "29.0.5"
20 | },
21 | "dependencies": {
22 | "@fluencelabs/js-client": "^0.5.4"
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/js-client-examples/hello-world/src/frontend/src/__test__/test.spec.ts:
--------------------------------------------------------------------------------
1 | import { main } from '../main.js';
2 |
3 | describe('smoke test', () => {
4 | it('should work', async () => {
5 | console.log = jest.fn();
6 |
7 | await main();
8 |
9 | expect(console.log).toBeCalledTimes(3);
10 | expect(console.log).toHaveBeenNthCalledWith(1, 'Hello, world!');
11 | expect(console.log).toHaveBeenNthCalledWith(2, 'Wealth awaits you very soon.');
12 | expect(console.log).toHaveBeenNthCalledWith(3, 'The relay time is: ', expect.anything());
13 | }, 15000);
14 | });
15 |
--------------------------------------------------------------------------------
/js-client-examples/hello-world/src/frontend/src/index.ts:
--------------------------------------------------------------------------------
1 | import { main } from './main.js';
2 |
3 | main().catch((e) => console.error('error: ', e));
4 |
--------------------------------------------------------------------------------
/js-client-examples/hello-world/src/frontend/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "lib": ["es2015", "dom"],
4 | "outDir": "./dist/",
5 | "target": "ESNext",
6 | "module": "ESNext",
7 | "strict": true,
8 | "esModuleInterop": true,
9 | "skipLibCheck": true,
10 | "forceConsistentCasingInFileNames": true,
11 | "declaration": true,
12 | "declarationMap": false,
13 | "sourceMap": true,
14 | "moduleResolution": "node",
15 | "resolveJsonModule": true
16 | },
17 | "exclude": ["node_modules", "dist"],
18 | "include": ["src"]
19 | }
20 |
--------------------------------------------------------------------------------
/js-client-examples/marine-service/.gitignore:
--------------------------------------------------------------------------------
1 | .idea
2 | .DS_Store
3 | /.fluence/secrets
4 | /.fluence/env.yaml
5 | /.fluence/schemas
6 | /.fluence/tmp
7 | **/node_modules
8 | **/target/
9 | .repl_history
10 | /.vscode/settings.json
11 | /src/ts/src/aqua
12 | /src/js/src/aqua
--------------------------------------------------------------------------------
/js-client-examples/marine-service/Cargo.toml:
--------------------------------------------------------------------------------
1 | [workspace]
2 | members = [ "src/services/myService/modules/myService" ]
3 |
--------------------------------------------------------------------------------
/js-client-examples/marine-service/fluence.yaml:
--------------------------------------------------------------------------------
1 | # yaml-language-server: $schema=.fluence/schemas/fluence.json
2 |
3 | # 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
4 |
5 | # Documentation: https://github.com/fluencelabs/cli/tree/main/docs/configs/fluence.md
6 |
7 | version: 5
8 |
9 | aquaInputPath: src/aqua/greeting.aqua
10 |
11 | relaysPath: src/frontend/src
12 |
13 | aquaOutputTSPath: src/frontend/src/compiled-aqua
14 |
--------------------------------------------------------------------------------
/js-client-examples/marine-service/src/aqua/greeting.aqua:
--------------------------------------------------------------------------------
1 | import Srv from "./srv.aqua"
2 |
3 | export hello as my_hello
4 |
5 | service Greeting:
6 | greeting(name: string) -> string
7 |
8 | service Debug("debug"):
9 | stringify(message: string)
10 |
11 | func hello(name: string, wasm_content: string) -> string:
12 | created_service <- Srv.create(wasm_content)
13 | Greeting created_service.service_id!
14 | <- Greeting.greeting(name)
15 |
--------------------------------------------------------------------------------
/js-client-examples/marine-service/src/aqua/srv.aqua:
--------------------------------------------------------------------------------
1 | data ServiceCreationResult:
2 | success: bool
3 | service_id: ?string
4 | error: ?string
5 |
6 | data RemoveResult:
7 | success: bool
8 | error: ?string
9 |
10 | alias ListServiceResult: []string
11 |
12 | service Srv("single_module_srv"):
13 | -- Used to create a service on a certain node
14 | -- Arguments:
15 | -- bytes – a base64 string containing the .wasm module to add.
16 | -- Returns: service_id – the service ID of the created service.
17 | create(wasm_b64_content: string) -> ServiceCreationResult
18 |
19 | -- Used to remove a service from a certain node
20 | -- Arguments:
21 | -- service_id – ID of the service to remove
22 | remove(service_id: string) -> RemoveResult
23 |
24 | -- Returns a list of services ids running on a peer
25 | list() -> ListServiceResult
--------------------------------------------------------------------------------
/js-client-examples/marine-service/src/frontend/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "private": true,
3 | "version": "0.0.0",
4 | "type": "module",
5 | "scripts": {
6 | "dev": "vite",
7 | "build": "tsc && vite build",
8 | "preview": "vite preview"
9 | },
10 | "dependencies": {
11 | "@fluencelabs/js-client": "0.5.4",
12 | "js-base64": "^3.7.5"
13 | },
14 | "devDependencies": {
15 | "typescript": "5.0.2",
16 | "vite": "4.4.5",
17 | "vite-plugin-node-polyfills": "0.16.0"
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/js-client-examples/marine-service/src/frontend/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "ES2020",
4 | "types": ["vite/client"],
5 | "useDefineForClassFields": true,
6 | "module": "ESNext",
7 | "lib": ["ES2020", "DOM", "DOM.Iterable"],
8 | "skipLibCheck": true,
9 |
10 | /* Bundler mode */
11 | "moduleResolution": "bundler",
12 | "allowImportingTsExtensions": true,
13 | "resolveJsonModule": true,
14 | "isolatedModules": true,
15 | "noEmit": true,
16 |
17 | /* Linting */
18 | "strict": true,
19 | "noUnusedLocals": true,
20 | "noUnusedParameters": true,
21 | "noFallthroughCasesInSwitch": true
22 | },
23 | "include": ["src"]
24 | }
25 |
--------------------------------------------------------------------------------
/js-client-examples/marine-service/src/frontend/vite.config.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig } from "vite";
2 | import { nodePolyfills } from "vite-plugin-node-polyfills";
3 |
4 | export default defineConfig({
5 | plugins: [nodePolyfills()],
6 | });
7 |
--------------------------------------------------------------------------------
/js-client-examples/marine-service/src/frontend/wasm/greeting.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fluencelabs/examples/fbfc344abfca1af2b5466554fec7af9d6f0d5eef/js-client-examples/marine-service/src/frontend/wasm/greeting.wasm
--------------------------------------------------------------------------------
/js-client-examples/node-example/fluence.yaml:
--------------------------------------------------------------------------------
1 | # yaml-language-server: $schema=.fluence/schemas/fluence.json
2 |
3 | # 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
4 |
5 | # Documentation: https://github.com/fluencelabs/cli/tree/main/docs/configs/fluence.md
6 |
7 | version: 5
8 |
9 | aquaInputPath: src/aqua
10 |
11 | relaysPath: src/frontend/src
12 |
13 | aquaOutputTSPath: src/frontend/src/compiled-aqua
14 |
--------------------------------------------------------------------------------
/js-client-examples/node-example/src/aqua/calc.aqua:
--------------------------------------------------------------------------------
1 | service Calc("calc"):
2 | add(n: f32)
3 | subtract(n: f32)
4 | multiply(n: f32)
5 | divide(n: f32)
6 | reset()
7 | getResult() -> f32
8 |
9 |
--------------------------------------------------------------------------------
/js-client-examples/node-example/src/aqua/demo-calculation.aqua:
--------------------------------------------------------------------------------
1 | import "./calc.aqua"
2 |
3 | const PEER ?= "12D3KooWKETqJdR26urWDbkRAVRdPQhcYNSJNGMBTn1zuE9kjQmo"
4 | const RELAY ?= "12D3KooWSD5PToNiLQwKDXsu8JSysCwUt8BVUJEqCHcDe7P5h45e"
5 |
6 | func demoCalculation() -> f32:
7 | on PEER via RELAY:
8 | Calc.add(10)
9 | Calc.multiply(5)
10 | Calc.subtract(8)
11 | Calc.divide(6)
12 | res <- Calc.getResult()
13 | <- res
14 |
--------------------------------------------------------------------------------
/js-client-examples/node-example/src/frontend/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # production
12 | /build
13 |
14 | /dist
15 |
16 | # misc
17 | .DS_Store
18 | .env.local
19 | .env.development.local
20 | .env.test.local
21 | .env.production.local
22 |
23 | npm-debug.log*
24 | yarn-debug.log*
25 | yarn-error.log*
26 |
27 |
28 | # fluence
29 |
30 | src/compiled-aqua/*
31 | .fluence/
--------------------------------------------------------------------------------
/js-client-examples/node-example/src/frontend/.prettierrc.cjs:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | semi: true,
3 | trailingComma: 'all',
4 | singleQuote: true,
5 | printWidth: 120,
6 | tabWidth: 4,
7 | useTabs: false,
8 | };
9 |
--------------------------------------------------------------------------------
/js-client-examples/node-example/src/frontend/jest.config.cjs:
--------------------------------------------------------------------------------
1 | /** @type {import('ts-jest').JestConfigWithTsJest} */
2 | module.exports = {
3 | extensionsToTreatAsEsm: ['.ts'],
4 | moduleNameMapper: {
5 | '^(\\.{1,2}/.*)\\.js$': '$1',
6 | },
7 | testPathIgnorePatterns: ['dist'],
8 | transform: {
9 | '^.+\\.tsx?$': [
10 | 'ts-jest',
11 | {
12 | useESM: true,
13 | },
14 | ],
15 | },
16 | };
17 |
--------------------------------------------------------------------------------
/js-client-examples/node-example/src/frontend/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "node-example",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "type": "module",
7 | "scripts": {
8 | "start": "node --loader ts-node/esm ./src/index.ts",
9 | "build": "tsc",
10 | "test": "jest"
11 | },
12 | "author": "",
13 | "license": "ISC",
14 | "devDependencies": {
15 | "ts-node": "10.9.1",
16 | "@types/node": "20.8.10",
17 | "@types/jest": "29.4.0",
18 | "jest": "29.4.1",
19 | "ts-jest": "29.0.5"
20 | },
21 | "dependencies": {
22 | "@fluencelabs/js-client": "^0.5.4"
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/js-client-examples/node-example/src/frontend/src/__test__/test.spec.ts:
--------------------------------------------------------------------------------
1 | import { justStop, runServer } from '../main.js';
2 | import { demoCalculation } from '../compiled-aqua/demo-calculation.js';
3 |
4 | describe('smoke test', () => {
5 | it('should work', async () => {
6 | try {
7 | await runServer();
8 |
9 | const res = await demoCalculation();
10 |
11 | expect(res).toBe(7);
12 | } finally {
13 | await justStop();
14 | }
15 | }, 15000);
16 | });
17 |
--------------------------------------------------------------------------------
/js-client-examples/node-example/src/frontend/src/index.ts:
--------------------------------------------------------------------------------
1 | import { runServer, waitForKeypressAndStop } from './main.js';
2 |
3 | runServer()
4 | .then(waitForKeypressAndStop)
5 | .catch((e) => console.error('error: ', e));
6 |
--------------------------------------------------------------------------------
/js-client-examples/node-example/src/frontend/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "lib": ["es2015", "dom"],
4 | "outDir": "./dist/",
5 | "target": "ESNext",
6 | "module": "ESNext",
7 | "strict": true,
8 | "esModuleInterop": true,
9 | "skipLibCheck": true,
10 | "forceConsistentCasingInFileNames": true,
11 | "declaration": true,
12 | "declarationMap": false,
13 | "sourceMap": true,
14 | "moduleResolution": "nodenext",
15 | "resolveJsonModule": true
16 | },
17 | "exclude": ["node_modules", "dist"],
18 | "include": ["src"]
19 | }
20 |
--------------------------------------------------------------------------------
/marine-examples/build_rs/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "wasm-build-rs"
3 | version = "0.1.0"
4 | authors = ["Fluence Labs"]
5 | description = "The greeting module for the Fluence network"
6 | repository = "https://github.com/fluencelabs/marine/tree/master/examples/build_rs"
7 | edition = "2018"
8 | publish = false
9 |
10 | [[bin]]
11 | name = "build_rs_test"
12 | path = "src/main.rs"
13 |
14 | [dependencies]
15 | marine-rs-sdk = "0.10.1"
16 |
17 | [dev-dependencies]
18 | marine-rs-sdk-test = "0.11.0"
19 |
20 | [build-dependencies]
21 | marine-rs-sdk-test = "0.11.0"
22 |
--------------------------------------------------------------------------------
/marine-examples/build_rs/Config.toml:
--------------------------------------------------------------------------------
1 | modules_dir = "artifacts/"
2 |
3 | [[module]]
4 | name = "build_rs_test"
5 | max_heap_size = "50 KiB"
6 | logger_enabled = false
7 |
--------------------------------------------------------------------------------
/marine-examples/build_rs/build.rs:
--------------------------------------------------------------------------------
1 | use marine_rs_sdk_test::generate_marine_test_env;
2 | use marine_rs_sdk_test::ServiceDescription;
3 | fn main() {
4 | let services = vec![(
5 | "greeting".to_string(),
6 | ServiceDescription {
7 | config_path: "Config.toml".to_string(),
8 | modules_dir: Some("artifacts".to_string()),
9 | },
10 | )];
11 |
12 | let target = std::env::var("CARGO_CFG_TARGET_ARCH").unwrap();
13 | if target != "wasm32" {
14 | generate_marine_test_env(services, "marine_test_env.rs", file!());
15 | }
16 |
17 | println!("cargo:rerun-if-changed=src/main.rs");
18 | }
19 |
--------------------------------------------------------------------------------
/marine-examples/build_rs/build.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | # This script builds all subprojects and puts all created Wasm modules in one dir
4 | cargo update --aggressive
5 | marine build --release
6 |
7 | rm artifacts/* || true
8 | mkdir -p artifacts
9 |
10 | cp target/wasm32-wasi/release/build_rs_test.wasm artifacts/
11 |
--------------------------------------------------------------------------------
/marine-examples/call_parameters/.fluence/aqua/services.aqua:
--------------------------------------------------------------------------------
1 | service CallParameters("call_parameters"):
2 | call_parameters() -> string
3 |
--------------------------------------------------------------------------------
/marine-examples/call_parameters/.fluence/project-secrets.yaml:
--------------------------------------------------------------------------------
1 | # yaml-language-server: $schema=schemas/project-secrets.yaml.json
2 |
3 | # 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
4 |
5 | # Documentation: https://github.com/fluencelabs/fluence-cli/tree/main/docs/configs/project-secrets.md
6 |
7 | version: 0
8 | keyPairs: []
9 |
--------------------------------------------------------------------------------
/marine-examples/call_parameters/.fluence/tmp/Config.toml:
--------------------------------------------------------------------------------
1 | [[module]]
2 | name = "call_parameters"
3 | load_from = "/Users/bebo/localdev/examples/marine-examples/call_parameters/target/wasm32-wasi/release/call_parameters.wasm"
4 |
--------------------------------------------------------------------------------
/marine-examples/call_parameters/.fluence/workers.yaml:
--------------------------------------------------------------------------------
1 | # yaml-language-server: $schema=schemas/workers.yaml.json
2 |
3 | # A result of app deployment. This file is created automatically after successful deployment using `fluence workers deploy` command
4 |
5 | # Documentation: https://github.com/fluencelabs/fluence-cli/tree/main/docs/configs/workers.md
6 |
7 | version: 0
8 | hosts:
9 | defaultWorker:
10 | definition: bafkreiefqniy3e624vwu4ysgjk5yyxlpzz6xvbjnnigscyszpfkmlat35q
11 | installation_spells:
12 | - host_id: 12D3KooWAKNos2KogexTXhrkMZzFYpLHuWJ4PgoAhurSAv7o5CWA
13 | spell_id: db3ff7c8-d3b7-42ef-851a-cd90e5721830
14 | worker_id: 12D3KooWFphE7mXCooFv29DbenruBhCCca52kTAXgXibGtSmRP2u
15 | timestamp: 2023-04-23T05:55:33.752Z
16 | relayId: 12D3KooWAKNos2KogexTXhrkMZzFYpLHuWJ4PgoAhurSAv7o5CWA
17 |
--------------------------------------------------------------------------------
/marine-examples/call_parameters/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | .repl_history
3 | /target
4 | **/**.bak
5 | **/**.bk
6 | /artifacts
7 | keypair.json
8 |
9 | # recommended by Fluence Labs:
10 | .idea
11 | .fluence
12 | **/node_modules
13 | **/target/
14 | .vscode/settings.json
15 | src/ts/src/aqua
16 | src/js/src/aqua
17 |
--------------------------------------------------------------------------------
/marine-examples/call_parameters/Cargo.toml:
--------------------------------------------------------------------------------
1 | [workspace]
2 | members = ["service/modules/call_parameters"]
3 |
--------------------------------------------------------------------------------
/marine-examples/call_parameters/service/modules/call_parameters/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "call_parameters"
3 | version = "0.1.0"
4 | edition = "2018"
5 |
6 | [[bin]]
7 | name = "call_parameters"
8 | path = "src/main.rs"
9 |
10 | [dependencies]
11 | marine-rs-sdk = "0.10.1"
12 |
13 | [dev-dependencies]
14 | marine-rs-sdk-test = "0.11.0"
15 |
--------------------------------------------------------------------------------
/marine-examples/call_parameters/service/modules/call_parameters/module.yaml:
--------------------------------------------------------------------------------
1 | # yaml-language-server: $schema=../../../.fluence/schemas/module.yaml.json
2 |
3 | # Defines [Marine Module](https://fluence.dev/docs/build/concepts/#modules). You can use `fluence module new` command to generate a template for new module
4 |
5 | # Documentation: https://github.com/fluencelabs/fluence-cli/tree/main/docs/configs/module.md
6 |
7 | version: 0
8 | type: rust
9 | name: call_parameters
10 |
--------------------------------------------------------------------------------
/marine-examples/call_parameters/service/service.yaml:
--------------------------------------------------------------------------------
1 | # yaml-language-server: $schema=../.fluence/schemas/service.yaml.json
2 |
3 | # Defines a [Marine service](https://fluence.dev/docs/build/concepts/#services), most importantly the modules that the service consists of. You can use `fluence service new` command to generate a template for new service
4 |
5 | # Documentation: https://github.com/fluencelabs/fluence-cli/tree/main/docs/configs/service.md
6 |
7 | version: 0
8 | name: call_parameters
9 | modules:
10 | facade:
11 | get: modules/call_parameters
12 |
--------------------------------------------------------------------------------
/marine-examples/call_parameters/src/aqua/main.aqua:
--------------------------------------------------------------------------------
1 | aqua Main
2 |
3 | import "@fluencelabs/aqua-lib/builtin.aqua"
4 | import "@fluencelabs/registry/subnetwork.aqua"
5 | import Registry from "@fluencelabs/registry/registry-service.aqua"
6 | import "@fluencelabs/spell/spell_service.aqua"
7 |
8 | import "workers.aqua"
9 | import "services.aqua"
10 |
11 | export call_parameters
12 |
13 | func call_parameters() -> string:
14 | info <- getWorkersInfo()
15 | spell = info.hosts.defaultWorker.installationSpells[0]
16 | on spell.workerId via spell.hostId:
17 | res <- CallParameters.call_parameters()
18 | <- res
19 |
--------------------------------------------------------------------------------
/marine-examples/greeting/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | .repl_history
3 | /target
4 | **/**.bak
5 | **/**.bk
6 | /artifacts
7 | keypair.json
8 |
--------------------------------------------------------------------------------
/marine-examples/greeting/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "wasm-greeting"
3 | version = "0.1.0"
4 | authors = ["Fluence Labs"]
5 | description = "The greeting module for the Fluence network"
6 | repository = "https://github.com/fluencelabs/marine/tree/master/examples/greeting"
7 | edition = "2018"
8 | publish = false
9 |
10 | [[bin]]
11 | name = "greeting"
12 | path = "src/main.rs"
13 |
14 | [dependencies]
15 | marine-rs-sdk = "0.10.1"
16 |
17 | [dev-dependencies]
18 | marine-rs-sdk-test = "0.11.0"
19 |
--------------------------------------------------------------------------------
/marine-examples/greeting/Config.toml:
--------------------------------------------------------------------------------
1 | modules_dir = "artifacts/"
2 |
3 | [[module]]
4 | name = "greeting"
5 | max_heap_size = "10 Kib"
6 | logger_enabled = false
7 |
--------------------------------------------------------------------------------
/marine-examples/greeting/build.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | set -o errexit -o nounset -o pipefail
3 |
4 | # This script builds all subprojects and puts all created Wasm modules in one dir
5 | cargo update --aggressive
6 | marine build --release
7 |
8 | mkdir -p artifacts
9 | rm -f artifacts/*.wasm
10 | cp target/wasm32-wasi/release/greeting.wasm artifacts/
11 |
--------------------------------------------------------------------------------
/marine-examples/greeting/configs/greeting_cfg.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "greeting",
3 | "mem_pages_count": 1,
4 | "logger_enabled": false
5 | }
--------------------------------------------------------------------------------
/marine-examples/greeting/configs/greeting_deploy_cfg.json:
--------------------------------------------------------------------------------
1 | {
2 | "greeting": {
3 | "modules": [
4 | {
5 | "name": "greeting",
6 | "path": "./artifacts/greeting.wasm",
7 | "logger_enabled": true
8 | }
9 | ]
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/marine-examples/greeting/module-exports/greeting.tar.gz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fluencelabs/examples/fbfc344abfca1af2b5466554fec7af9d6f0d5eef/marine-examples/greeting/module-exports/greeting.tar.gz
--------------------------------------------------------------------------------
/marine-examples/greeting/package_modules.sh:
--------------------------------------------------------------------------------
1 | mkdir -p module-exports/modules/greeting
2 | sh ./build.sh
3 |
4 | cd module-exports
5 | cp ../target/wasm32-wasi/release/greeting.wasm modules/greeting/
6 |
7 | file="modules/greeting/module.yaml"
8 | cat > $file <<- EOF
9 | version: 0
10 | name: local_storage
11 | loggerEnabled: true
12 | EOF
13 |
14 |
15 | tar -czvf greeting.tar.gz modules
16 | rm -r modules
17 | cd ../
18 |
19 | cargo clean
20 |
--------------------------------------------------------------------------------
/marine-examples/multiservice_marine_test/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | .repl_history
3 | /target
4 | **/**.bak
5 | **/**.bk
6 | /artifacts
7 | keypair.json
8 |
--------------------------------------------------------------------------------
/marine-examples/multiservice_marine_test/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "multiservice-marine-test"
3 | version = "0.1.0"
4 | authors = ["Fluence Labs"]
5 | edition = "2018"
6 | publish = false
7 |
8 | [dependencies]
9 |
10 | [dev-dependencies]
11 | marine-rs-sdk-test = "0.11.0"
12 |
--------------------------------------------------------------------------------
/marine-examples/multiservice_marine_test/build.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | (cd producer; ./build.sh)
4 | (cd consumer; ./build.sh)
--------------------------------------------------------------------------------
/marine-examples/multiservice_marine_test/consumer/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "consumer"
3 | version = "0.1.0"
4 | authors = ["Fluence Labs"]
5 | edition = "2018"
6 | publish = false
7 |
8 | [[bin]]
9 | name = "consumer"
10 | path = "src/main.rs"
11 |
12 | [dependencies]
13 | marine-rs-sdk = "0.10.1"
14 |
--------------------------------------------------------------------------------
/marine-examples/multiservice_marine_test/consumer/Config.toml:
--------------------------------------------------------------------------------
1 | modules_dir = "artifacts/"
2 |
3 | [[module]]
4 | name = "consumer"
5 | max_heap_size = "50 KiB"
6 | logger_enabled = false
7 |
--------------------------------------------------------------------------------
/marine-examples/multiservice_marine_test/consumer/build.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | # This script builds all subprojects and puts all created Wasm modules in one dir
4 | cargo update --aggressive
5 | marine build --release
6 |
7 | ARTIFACTS="artifacts"
8 |
9 | if [ -d "$ARTIFACTS" ]; then
10 | rm ${ARTIFACTS}/* || true
11 | else
12 | mkdir -p "$ARTIFACTS"
13 | fi
14 |
15 |
16 |
17 | cp target/wasm32-wasi/release/consumer.wasm artifacts/
18 |
--------------------------------------------------------------------------------
/marine-examples/multiservice_marine_test/consumer/src/main.rs:
--------------------------------------------------------------------------------
1 | use marine_rs_sdk::marine;
2 | use marine_rs_sdk::module_manifest;
3 |
4 | module_manifest!();
5 |
6 | pub fn main() {}
7 |
8 | #[marine]
9 | pub struct Data {
10 | pub name: String,
11 | }
12 |
13 | #[marine]
14 | pub fn consume(data: Data) -> String {
15 | data.name
16 | }
17 |
--------------------------------------------------------------------------------
/marine-examples/multiservice_marine_test/producer/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "producer"
3 | version = "0.1.0"
4 | authors = ["Fluence Labs"]
5 | edition = "2018"
6 | publish = false
7 |
8 | [[bin]]
9 | name = "producer"
10 | path = "src/main.rs"
11 |
12 | [dependencies]
13 | marine-rs-sdk = "0.10.1"
14 |
--------------------------------------------------------------------------------
/marine-examples/multiservice_marine_test/producer/Config.toml:
--------------------------------------------------------------------------------
1 | modules_dir = "artifacts/"
2 |
3 | [[module]]
4 | name = "producer"
5 | max_heap_size = "50 KiB"
6 | logger_enabled = false
7 |
--------------------------------------------------------------------------------
/marine-examples/multiservice_marine_test/producer/build.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | # This script builds all subprojects and puts all created Wasm modules in one dir
4 | cargo update --aggressive
5 | marine build --release
6 |
7 | ARTIFACTS="artifacts"
8 |
9 | if [ -d "$ARTIFACTS" ]; then
10 | rm ${ARTIFACTS}/* || true
11 | else
12 | mkdir -p "$ARTIFACTS"
13 | fi
14 |
15 |
16 | cp target/wasm32-wasi/release/producer.wasm artifacts/
17 |
--------------------------------------------------------------------------------
/marine-examples/multiservice_marine_test/producer/src/main.rs:
--------------------------------------------------------------------------------
1 | use marine_rs_sdk::marine;
2 | use marine_rs_sdk::module_manifest;
3 |
4 | module_manifest!();
5 |
6 | pub fn main() {}
7 |
8 | #[marine]
9 | pub struct Data {
10 | pub name: String,
11 | }
12 |
13 | #[marine]
14 | pub struct Input {
15 | pub first_name: String,
16 | pub last_name: String,
17 | }
18 |
19 | #[marine]
20 | pub fn produce(data: Input) -> Data {
21 | Data {
22 | name: format!("{} {}", data.first_name, data.last_name),
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/marine-examples/records/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | .repl_history
3 | /target
4 | **/**.bak
5 | **/**.bk
6 | /artifacts
7 | keypair.json
8 |
--------------------------------------------------------------------------------
/marine-examples/records/Config.toml:
--------------------------------------------------------------------------------
1 | modules_dir = "artifacts/"
2 |
3 | [[module]]
4 | name = "records_pure"
5 | max_heap_size = "10 KiB"
6 | logger_enabled = true
7 |
8 | [[module]]
9 | name = "records_facade"
10 | max_heap_size = "10 KiB"
11 | logger_enabled = true
12 |
--------------------------------------------------------------------------------
/marine-examples/records/build.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | set -o errexit -o nounset -o pipefail
3 |
4 | # This script builds all subprojects and puts all created Wasm modules in one dir
5 | cd pure
6 | marine build --release
7 |
8 | cd ../facade
9 | marine build --release
10 |
11 | cd ..
12 |
13 | mkdir -p artifacts
14 | rm -f artifacts/*.wasm
15 | cp pure/target/wasm32-wasi/release/records_pure.wasm artifacts/
16 | cp facade/target/wasm32-wasi/release/records_facade.wasm artifacts/
17 |
--------------------------------------------------------------------------------
/marine-examples/records/facade/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "record-facade"
3 | version = "0.1.0"
4 | authors = ["Fluence Labs"]
5 | edition = "2018"
6 | publish = false
7 |
8 | [[bin]]
9 | name = "records_facade"
10 | path = "src/main.rs"
11 |
12 | [dependencies]
13 | marine-rs-sdk = "0.10.1"
14 | test-record = { path = "../test-record" }
15 |
--------------------------------------------------------------------------------
/marine-examples/records/module-exports/records.tar.gz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fluencelabs/examples/fbfc344abfca1af2b5466554fec7af9d6f0d5eef/marine-examples/records/module-exports/records.tar.gz
--------------------------------------------------------------------------------
/marine-examples/records/pure/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "record-pure"
3 | version = "0.1.0"
4 | authors = ["Fluence Labs"]
5 | edition = "2018"
6 | publish = false
7 |
8 | [[bin]]
9 | name = "records_pure"
10 | path = "src/main.rs"
11 |
12 | [dependencies]
13 | marine-rs-sdk = "0.10.1"
14 | test-record = { path = "../test-record" }
15 |
--------------------------------------------------------------------------------
/marine-examples/records/test-record/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "test-record"
3 | version = "0.1.0"
4 | authors = ["Fluence Labs"]
5 | edition = "2018"
6 | publish = false
7 |
8 | [lib]
9 | name = "test_record"
10 | path = "src/test_record.rs"
11 |
12 | [dependencies]
13 | marine-rs-sdk = "0.10.1"
14 |
--------------------------------------------------------------------------------
/marine-examples/sqlite/.fluence/aqua/services.aqua:
--------------------------------------------------------------------------------
1 | service SqliteTest("sqlite_test"):
2 | sql_repl()
3 | test1(age: i64)
4 | test2(age: i64)
5 | test3()
6 | test_last_rowid() -> i64
7 |
--------------------------------------------------------------------------------
/marine-examples/sqlite/.fluence/aqua/workers.aqua:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fluencelabs/examples/fbfc344abfca1af2b5466554fec7af9d6f0d5eef/marine-examples/sqlite/.fluence/aqua/workers.aqua
--------------------------------------------------------------------------------
/marine-examples/sqlite/.fluence/modules/sqlite3.tar.gz_d35d7a28b1a8a55e87df96578d70ad46/module.yaml:
--------------------------------------------------------------------------------
1 | # yaml-language-server: $schema=../../schemas/module.yaml.json
2 | version: 0
3 | type: compiled
4 | name: sqlite3
5 | volumes:
6 | sites: ./tmp
7 |
--------------------------------------------------------------------------------
/marine-examples/sqlite/.fluence/modules/sqlite3.tar.gz_d35d7a28b1a8a55e87df96578d70ad46/sqlite3.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fluencelabs/examples/fbfc344abfca1af2b5466554fec7af9d6f0d5eef/marine-examples/sqlite/.fluence/modules/sqlite3.tar.gz_d35d7a28b1a8a55e87df96578d70ad46/sqlite3.wasm
--------------------------------------------------------------------------------
/marine-examples/sqlite/.fluence/project-secrets.yaml:
--------------------------------------------------------------------------------
1 | # yaml-language-server: $schema=schemas/project-secrets.yaml.json
2 |
3 | # 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
4 |
5 | # Documentation: https://github.com/fluencelabs/fluence-cli/tree/main/docs/configs/project-secrets.md
6 |
7 | version: 0
8 | keyPairs: []
9 |
--------------------------------------------------------------------------------
/marine-examples/sqlite/.fluence/tmp/Config.toml:
--------------------------------------------------------------------------------
1 | [[module]]
2 | name = "sqlite3"
3 | load_from = "/Users/bebo/localdev/examples/marine-examples/sqlite/.fluence/modules/sqlite3.tar.gz_d35d7a28b1a8a55e87df96578d70ad46/sqlite3.wasm"
4 |
5 | [module.wasi.mapped_dirs]
6 | sites = "./tmp"
7 |
8 | [[module]]
9 | name = "sqlite_test"
10 | load_from = "/Users/bebo/localdev/examples/marine-examples/sqlite/target/wasm32-wasi/release/sqlite_test.wasm"
11 |
--------------------------------------------------------------------------------
/marine-examples/sqlite/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | .repl_history
3 | /target
4 | **/**.bak
5 | **/**.bk
6 | /artifacts
7 | keypair.json
8 |
9 | # recommended by Fluence Labs:
10 | .idea
11 | .fluence
12 | **/node_modules
13 | **/target/
14 | .vscode/settings.json
15 | src/ts/src/aqua
16 | src/js/src/aqua
17 |
--------------------------------------------------------------------------------
/marine-examples/sqlite/Cargo.toml:
--------------------------------------------------------------------------------
1 | [workspace]
2 | members = [ "service/modules/sqlite_test" ]
3 |
--------------------------------------------------------------------------------
/marine-examples/sqlite/fluence.yaml:
--------------------------------------------------------------------------------
1 | # yaml-language-server: $schema=.fluence/schemas/fluence.yaml.json
2 |
3 | # 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
4 |
5 | # Documentation: https://github.com/fluencelabs/fluence-cli/tree/main/docs/configs/fluence.md
6 |
7 | version: 2
8 | aquaInputPath: src/aqua/main.aqua
9 | workers:
10 | defaultWorker:
11 | services: [ sqlite_test ]
12 | deals:
13 | defaultWorker:
14 | minWorkers: 1
15 | targetWorkers: 3
16 | hosts:
17 | defaultWorker:
18 | peerIds:
19 | - 12D3KooWFtf3rfCDAfWwt6oLZYZbDfn9Vn7bv7g6QjjQxUUEFVBt
20 | relays: kras
21 | dependencies:
22 | cargo:
23 | mrepl: 0.21.3
24 | services:
25 | sqlite_test:
26 | get: service
27 |
--------------------------------------------------------------------------------
/marine-examples/sqlite/service/modules/sqlite_test/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "sqlite_test"
3 | version = "0.1.0"
4 | edition = "2018"
5 |
6 | [[bin]]
7 | name = "sqlite_test"
8 | path = "src/main.rs"
9 |
10 | [dependencies]
11 | marine-rs-sdk = "0.10.1"
12 | marine-sqlite-connector = "0.8.0"
13 |
14 | [dev-dependencies]
15 | marine-rs-sdk-test = "0.11.0"
16 |
--------------------------------------------------------------------------------
/marine-examples/sqlite/service/modules/sqlite_test/module.yaml:
--------------------------------------------------------------------------------
1 | # yaml-language-server: $schema=../../../.fluence/schemas/module.yaml.json
2 |
3 | # Defines [Marine Module](https://fluence.dev/docs/build/concepts/#modules). You can use `fluence module new` command to generate a template for new module
4 |
5 | # Documentation: https://github.com/fluencelabs/fluence-cli/tree/main/docs/configs/module.md
6 |
7 | version: 0
8 | type: rust
9 | name: sqlite_test
10 |
--------------------------------------------------------------------------------
/marine-examples/sqlite/service/service.yaml:
--------------------------------------------------------------------------------
1 | # yaml-language-server: $schema=../.fluence/schemas/service.yaml.json
2 |
3 | # Defines a [Marine service](https://fluence.dev/docs/build/concepts/#services), most importantly the modules that the service consists of. You can use `fluence service new` command to generate a template for new service
4 |
5 | # Documentation: https://github.com/fluencelabs/fluence-cli/tree/main/docs/configs/service.md
6 |
7 | version: 0
8 | name: sqlite_test
9 | modules:
10 | facade:
11 | get: modules/sqlite_test
12 | sqlite3:
13 | get: https://github.com/fluencelabs/sqlite/releases/download/sqlite-wasm-v0.18.1/sqlite3.tar.gz
14 |
--------------------------------------------------------------------------------
/marine-examples/url-downloader/.fluence/aqua/services.aqua:
--------------------------------------------------------------------------------
1 | service UrlDownloader("url_downloader"):
2 | get(file_name: string) -> []u8
3 | get_n_save(url: string, file_name: string) -> string
4 | put(file_name: string, file_content: []u8) -> string
5 |
--------------------------------------------------------------------------------
/marine-examples/url-downloader/.fluence/project-secrets.yaml:
--------------------------------------------------------------------------------
1 | # yaml-language-server: $schema=schemas/project-secrets.yaml.json
2 |
3 | # 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
4 |
5 | # Documentation: https://github.com/fluencelabs/fluence-cli/tree/main/docs/configs/project-secrets.md
6 |
7 | version: 0
8 | keyPairs: []
9 |
--------------------------------------------------------------------------------
/marine-examples/url-downloader/.fluence/tmp/Config.toml:
--------------------------------------------------------------------------------
1 | [[module]]
2 | name = "local_storage"
3 | load_from = "/Users/bebo/localdev/examples/marine-examples/url-downloader/target/wasm32-wasi/release/local_storage.wasm"
4 | logger_enabled = true
5 |
6 | [module.wasi.mapped_dirs]
7 | sites = "./tmp"
8 |
9 | [[module]]
10 | name = "curl_adapter"
11 | load_from = "/Users/bebo/localdev/examples/marine-examples/url-downloader/target/wasm32-wasi/release/curl_adapter.wasm"
12 | logger_enabled = true
13 |
14 | [module.mounted_binaries]
15 | curl = "/usr/bin/curl"
16 |
17 | [[module]]
18 | name = "url_downloader"
19 | load_from = "/Users/bebo/localdev/examples/marine-examples/url-downloader/target/wasm32-wasi/release/url_downloader.wasm"
20 | logger_enabled = true
21 |
--------------------------------------------------------------------------------
/marine-examples/url-downloader/.gitignore:
--------------------------------------------------------------------------------
1 | .idea
2 | .DS_Store
3 | .fluence
4 | **/node_modules
5 | **/target/
6 | .repl_history
7 | .vscode/settings.json
8 | src/ts/src/aqua
9 | src/js/src/aqua
--------------------------------------------------------------------------------
/marine-examples/url-downloader/Cargo.toml:
--------------------------------------------------------------------------------
1 | [workspace]
2 | members = [
3 | "service/modules/url_downloader",
4 | "service/modules/local_storage",
5 | "service/modules/curl_adapter"
6 | ]
7 |
--------------------------------------------------------------------------------
/marine-examples/url-downloader/download_url.aqua:
--------------------------------------------------------------------------------
1 | service UrlDownloader:
2 | get_n_save(url: string, file_name: string) -> string
3 |
4 | func download(target_url: string, fname: string, node:string, service_id:string) -> string:
5 | on node:
6 | UrlDownloader service_id
7 | res <- UrlDownloader.get_n_save(target_url, fname)
8 | <- res
--------------------------------------------------------------------------------
/marine-examples/url-downloader/fluence.yaml:
--------------------------------------------------------------------------------
1 | # yaml-language-server: $schema=.fluence/schemas/fluence.yaml.json
2 |
3 | # 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
4 |
5 | # Documentation: https://github.com/fluencelabs/fluence-cli/tree/main/docs/configs/fluence.md
6 |
7 | version: 2
8 | aquaInputPath: src/aqua/main.aqua
9 | dependencies:
10 | cargo:
11 | mrepl: 0.21.3
12 | workers:
13 | defaultWorker:
14 | services: [ url_downloader ]
15 | deals:
16 | defaultWorker:
17 | minWorkers: 1
18 | targetWorkers: 3
19 | hosts:
20 | defaultWorker:
21 | peerIds:
22 | - 12D3KooWJ4bTHirdTFNZpCS72TAzwtdmavTBkkEXtzo6wHL25CtE #stage
23 | relays: stage
24 | services:
25 | url_downloader:
26 | get: service
27 |
--------------------------------------------------------------------------------
/marine-examples/url-downloader/module-exports/url_downloader.tar.gz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fluencelabs/examples/fbfc344abfca1af2b5466554fec7af9d6f0d5eef/marine-examples/url-downloader/module-exports/url_downloader.tar.gz
--------------------------------------------------------------------------------
/marine-examples/url-downloader/service/modules/curl_adapter/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "curl_adapter"
3 | version = "0.1.0"
4 | edition = "2018"
5 |
6 | [[bin]]
7 | name = "curl_adapter"
8 | path = "src/main.rs"
9 |
10 | [dependencies]
11 | marine-rs-sdk = { version = "0.10.1", features = ["logger"] }
12 | log = "0.4.8"
13 |
14 |
15 | [dev-dependencies]
16 | marine-rs-sdk-test = "0.11.0"
17 |
--------------------------------------------------------------------------------
/marine-examples/url-downloader/service/modules/curl_adapter/module.yaml:
--------------------------------------------------------------------------------
1 | # yaml-language-server: $schema=../../../.fluence/schemas/module.yaml.json
2 |
3 | # Defines [Marine Module](https://fluence.dev/docs/build/concepts/#modules). You can use `fluence module new` command to generate a template for new module
4 |
5 | # Documentation: https://github.com/fluencelabs/fluence-cli/tree/main/docs/configs/module.md
6 | version: 0
7 | type: rust
8 | name: curl_adapter
9 | loggerEnabled: true
10 | mountedBinaries:
11 | curl: /usr/bin/curl
12 |
--------------------------------------------------------------------------------
/marine-examples/url-downloader/service/modules/curl_adapter/src/main.rs:
--------------------------------------------------------------------------------
1 | #![allow(improper_ctypes)]
2 |
3 | use marine_rs_sdk::marine;
4 | use marine_rs_sdk::module_manifest;
5 |
6 | use marine_rs_sdk::MountedBinaryResult;
7 | use marine_rs_sdk::WasmLoggerBuilder;
8 |
9 | module_manifest!();
10 |
11 | /// Log level can be changed by `RUST_LOG` env as well.
12 | pub fn main() {
13 | WasmLoggerBuilder::new().build().unwrap();
14 | }
15 |
16 | #[marine]
17 | pub fn download(url: String) -> String {
18 | log::info!("download called with url {}\n", url);
19 |
20 | let result = curl(vec![url]);
21 |
22 | String::from_utf8(result.stdout).unwrap()
23 | }
24 |
25 | /// Permissions in `Config.toml` should exist to use host functions.
26 | #[marine]
27 | #[link(wasm_import_module = "host")]
28 | extern "C" {
29 | fn curl(cmd: Vec) -> MountedBinaryResult;
30 | }
31 |
--------------------------------------------------------------------------------
/marine-examples/url-downloader/service/modules/local_storage/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "local_storage"
3 | version = "0.1.0"
4 | edition = "2018"
5 |
6 | [[bin]]
7 | name = "local_storage"
8 | path = "src/main.rs"
9 |
10 | [dependencies]
11 | marine-rs-sdk = "0.10.1"
12 | log = "0.4.8"
13 |
14 | [dev-dependencies]
15 | marine-rs-sdk-test = "0.11.0"
16 |
--------------------------------------------------------------------------------
/marine-examples/url-downloader/service/modules/local_storage/module.yaml:
--------------------------------------------------------------------------------
1 | # yaml-language-server: $schema=../../../.fluence/schemas/module.yaml.json
2 |
3 | # Defines [Marine Module](https://fluence.dev/docs/build/concepts/#modules). You can use `fluence module new` command to generate a template for new module
4 |
5 | # Documentation: https://github.com/fluencelabs/fluence-cli/tree/main/docs/configs/module.md
6 |
7 | version: 0
8 | type: rust
9 | name: local_storage
10 | loggerEnabled: true
11 | volumes:
12 | sites: ./tmp
13 |
--------------------------------------------------------------------------------
/marine-examples/url-downloader/service/modules/url_downloader/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "url_downloader"
3 | version = "0.1.0"
4 | edition = "2018"
5 |
6 | [[bin]]
7 | name = "url_downloader"
8 | path = "src/main.rs"
9 |
10 | [dependencies]
11 | marine-rs-sdk = { version = "0.10.1", features = ["logger"] }
12 | anyhow = "1.0.31"
13 | log = "0.4.8"
14 |
15 |
16 | [dev-dependencies]
17 | marine-rs-sdk-test = "0.11.0"
18 |
--------------------------------------------------------------------------------
/marine-examples/url-downloader/service/modules/url_downloader/module.yaml:
--------------------------------------------------------------------------------
1 | # yaml-language-server: $schema=../../../.fluence/schemas/module.yaml.json
2 |
3 | # Defines [Marine Module](https://fluence.dev/docs/build/concepts/#modules). You can use `fluence module new` command to generate a template for new module
4 |
5 | # Documentation: https://github.com/fluencelabs/fluence-cli/tree/main/docs/configs/module.md
6 |
7 | version: 0
8 | type: rust
9 | name: url_downloader
10 | loggerEnabled: true
11 |
--------------------------------------------------------------------------------
/marine-examples/url-downloader/service/service.yaml:
--------------------------------------------------------------------------------
1 | # yaml-language-server: $schema=../.fluence/schemas/service.yaml.json
2 |
3 | # Defines a [Marine service](https://fluence.dev/docs/build/concepts/#services), most importantly the modules that the service consists of. You can use `fluence service new` command to generate a template for new service
4 |
5 | # Documentation: https://github.com/fluencelabs/fluence-cli/tree/main/docs/configs/service.md
6 |
7 | version: 0
8 | name: url_downloader
9 | modules:
10 | facade:
11 | get: modules/url_downloader
12 | local_storage:
13 | get: modules/local_storage
14 | curl_adapter:
15 | get: modules/curl_adapter
16 |
--------------------------------------------------------------------------------
/marine-examples/url-downloader/src/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@fluencelabs/url-downloader",
3 | "version": "0.0.1",
4 | "description": "",
5 | "main": "src/index.js",
6 | "type": "module",
7 | "scripts": {
8 | "compile": "fluence aqua -i aqua/ -o aqua-compiled/ --js"
9 | },
10 | "bin": {},
11 | "files": [
12 | "src/*",
13 | "aqua/*",
14 | "aqua-compiled/*"
15 | ],
16 | "author": "Fluence Labs",
17 | "license": "Apache-2.0",
18 | "dependencies": {}
19 | }
20 |
--------------------------------------------------------------------------------
/quickstart/1-browser-to-browser/assets/Connection-confirmation-to-network.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fluencelabs/examples/fbfc344abfca1af2b5466554fec7af9d6f0d5eef/quickstart/1-browser-to-browser/assets/Connection-confirmation-to-network.png
--------------------------------------------------------------------------------
/quickstart/1-browser-to-browser/assets/Peer-to-peer-communication-between-two-browser-client-peers.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fluencelabs/examples/fbfc344abfca1af2b5466554fec7af9d6f0d5eef/quickstart/1-browser-to-browser/assets/Peer-to-peer-communication-between-two-browser-client-peers.png
--------------------------------------------------------------------------------
/quickstart/1-browser-to-browser/assets/Relay-Selection.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fluencelabs/examples/fbfc344abfca1af2b5466554fec7af9d6f0d5eef/quickstart/1-browser-to-browser/assets/Relay-Selection.png
--------------------------------------------------------------------------------
/quickstart/1-browser-to-browser/assets/getting-started.aqua.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fluencelabs/examples/fbfc344abfca1af2b5466554fec7af9d6f0d5eef/quickstart/1-browser-to-browser/assets/getting-started.aqua.png
--------------------------------------------------------------------------------
/quickstart/1-browser-to-browser/fluence.yaml:
--------------------------------------------------------------------------------
1 | # yaml-language-server: $schema=.fluence/schemas/fluence.json
2 |
3 | # 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
4 |
5 | # Documentation: https://github.com/fluencelabs/cli/tree/main/docs/configs/fluence.md
6 |
7 | version: 5
8 |
9 | aquaInputPath: src/aqua
10 |
11 | relaysPath: src/frontend/src
12 |
13 | aquaOutputTSPath: src/frontend/src/compiled-aqua
14 |
--------------------------------------------------------------------------------
/quickstart/1-browser-to-browser/src/aqua/getting-started.aqua:
--------------------------------------------------------------------------------
1 | import "@fluencelabs/aqua-lib/builtin.aqua"
2 |
3 | -- The service runs inside browser
4 | service HelloPeer("HelloPeer"):
5 | hello(from: PeerId) -> string
6 |
7 | func sayHello(targetPeerId: PeerId, targetRelayPeerId: PeerId) -> string:
8 | on targetPeerId via targetRelayPeerId:
9 | res <- HelloPeer.hello(INIT_PEER_ID)
10 | <- res
11 |
--------------------------------------------------------------------------------
/quickstart/1-browser-to-browser/src/frontend/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # production
12 | /build
13 |
14 | # misc
15 | .DS_Store
16 | .env.local
17 | .env.development.local
18 | .env.test.local
19 | .env.production.local
20 |
21 | npm-debug.log*
22 | yarn-debug.log*
23 | yarn-error.log*
24 |
25 | # fluence
26 |
27 | src/compiled-aqua/*
28 |
29 | public/*.wasm
30 | public/runnerScript.*
31 |
--------------------------------------------------------------------------------
/quickstart/1-browser-to-browser/src/frontend/.prettierrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | semi: true,
3 | trailingComma: 'all',
4 | singleQuote: true,
5 | printWidth: 120,
6 | tabWidth: 4,
7 | useTabs: false,
8 | };
9 |
--------------------------------------------------------------------------------
/quickstart/1-browser-to-browser/src/frontend/jest.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | preset: 'jest-puppeteer',
3 | testMatch: ['**/?(*.)+(spec|test).[t]s'],
4 | testPathIgnorePatterns: ['/node_modules/', 'dist'],
5 | transform: {
6 | '^.+\\.ts?$': 'ts-jest',
7 | },
8 | };
9 |
--------------------------------------------------------------------------------
/quickstart/1-browser-to-browser/src/frontend/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fluencelabs/examples/fbfc344abfca1af2b5466554fec7af9d6f0d5eef/quickstart/1-browser-to-browser/src/frontend/public/favicon.ico
--------------------------------------------------------------------------------
/quickstart/1-browser-to-browser/src/frontend/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fluencelabs/examples/fbfc344abfca1af2b5466554fec7af9d6f0d5eef/quickstart/1-browser-to-browser/src/frontend/public/logo192.png
--------------------------------------------------------------------------------
/quickstart/1-browser-to-browser/src/frontend/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fluencelabs/examples/fbfc344abfca1af2b5466554fec7af9d6f0d5eef/quickstart/1-browser-to-browser/src/frontend/public/logo512.png
--------------------------------------------------------------------------------
/quickstart/1-browser-to-browser/src/frontend/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "React App",
3 | "name": "Create React App Sample",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | },
10 | {
11 | "src": "logo192.png",
12 | "type": "image/png",
13 | "sizes": "192x192"
14 | },
15 | {
16 | "src": "logo512.png",
17 | "type": "image/png",
18 | "sizes": "512x512"
19 | }
20 | ],
21 | "start_url": ".",
22 | "display": "standalone",
23 | "theme_color": "#000000",
24 | "background_color": "#ffffff"
25 | }
26 |
--------------------------------------------------------------------------------
/quickstart/1-browser-to-browser/src/frontend/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 | Disallow:
4 |
--------------------------------------------------------------------------------
/quickstart/1-browser-to-browser/src/frontend/src/index.css:
--------------------------------------------------------------------------------
1 | body {
2 | margin: 0;
3 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
4 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
5 | sans-serif;
6 | -webkit-font-smoothing: antialiased;
7 | -moz-osx-font-smoothing: grayscale;
8 | }
9 |
10 | code {
11 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
12 | monospace;
13 | }
14 |
--------------------------------------------------------------------------------
/quickstart/1-browser-to-browser/src/frontend/src/index.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import './index.css';
4 | import App from './App';
5 |
6 | ReactDOM.render(
7 |
8 |
9 | ,
10 | document.getElementById('root')
11 | );
12 |
13 |
--------------------------------------------------------------------------------
/quickstart/1-browser-to-browser/src/frontend/src/react-app-env.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 |
--------------------------------------------------------------------------------
/quickstart/1-browser-to-browser/src/frontend/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es5",
4 | "lib": [
5 | "dom",
6 | "dom.iterable",
7 | "esnext"
8 | ],
9 | "allowJs": true,
10 | "skipLibCheck": true,
11 | "esModuleInterop": true,
12 | "allowSyntheticDefaultImports": true,
13 | "strict": true,
14 | "forceConsistentCasingInFileNames": true,
15 | "noFallthroughCasesInSwitch": true,
16 | "module": "esnext",
17 | "moduleResolution": "node",
18 | "resolveJsonModule": true,
19 | "isolatedModules": false,
20 | "noEmit": true,
21 | "jsx": "react-jsx"
22 | },
23 | "include": [
24 | "src"
25 | ]
26 | }
27 |
--------------------------------------------------------------------------------
/quickstart/2-browser-parallel-computation/.fluence/aqua/deals.aqua:
--------------------------------------------------------------------------------
1 | aqua Deals declares *
2 |
3 | data Deal:
4 | definition: string
5 | timestamp: string
6 | dealIdOriginal: string
7 | dealId: string
8 | chainNetwork: string
9 | chainNetworkId: u64
10 |
11 | data Deals:
12 | defaultWorker: ?Deal
13 |
14 | func get() -> Deals:
15 | <- Deals(
16 | defaultWorker=?[Deal(
17 | definition="bafkreifzhzgakizgfyyf2cqkmrhj5p73aw3lovhaji6sad54veo5dm4nxi",
18 | timestamp="2023-11-30T23:34:44.833Z",
19 | dealIdOriginal="0x6CA51618eC0C1cc34f6D5ead6AD1BA8e57b950D0",
20 | dealId="6ca51618ec0c1cc34f6d5ead6ad1ba8e57b950d0",
21 | chainNetwork="kras",
22 | chainNetworkId=80001
23 | )]
24 | )
25 |
--------------------------------------------------------------------------------
/quickstart/2-browser-parallel-computation/.fluence/aqua/hosts.aqua:
--------------------------------------------------------------------------------
1 | aqua Hosts declares *
2 |
3 | func get() -> ?u8:
4 | <- nil
5 |
--------------------------------------------------------------------------------
/quickstart/2-browser-parallel-computation/.fluence/aqua/services.aqua:
--------------------------------------------------------------------------------
1 | service Adder("adder"):
2 | add_one(value: u64) -> u64
3 |
--------------------------------------------------------------------------------
/quickstart/2-browser-parallel-computation/.fluence/env.yaml:
--------------------------------------------------------------------------------
1 | # yaml-language-server: $schema=schemas/env.json
2 |
3 | # Defines user project preferences
4 |
5 | # Documentation: https://github.com/fluencelabs/cli/tree/main/docs/configs/env.md
6 |
7 | version: 0
8 |
9 | fluenceEnv: kras
10 |
--------------------------------------------------------------------------------
/quickstart/2-browser-parallel-computation/.fluence/schemas/env.json:
--------------------------------------------------------------------------------
1 | {
2 | "$id": "https://fluence.dev/schemas/env.yaml",
3 | "title": "env.yaml",
4 | "type": "object",
5 | "description": "Defines user project preferences",
6 | "properties": {
7 | "fluenceEnv": {
8 | "title": "Fluence environment",
9 | "description": "Fluence environment to connect to",
10 | "type": "string",
11 | "enum": [
12 | "kras",
13 | "testnet",
14 | "stage",
15 | "local",
16 | "custom"
17 | ],
18 | "nullable": true
19 | },
20 | "version": {
21 | "type": "number",
22 | "const": 0
23 | }
24 | },
25 | "required": [
26 | "version"
27 | ]
28 | }
29 |
--------------------------------------------------------------------------------
/quickstart/2-browser-parallel-computation/.fluence/workers.yaml:
--------------------------------------------------------------------------------
1 | # yaml-language-server: $schema=schemas/workers.json
2 |
3 | # A result of app deployment. This file is created automatically after successful deployment using `fluence workers deploy` command
4 |
5 | # Documentation: https://github.com/fluencelabs/cli/tree/main/docs/configs/workers.md
6 |
7 | version: 0
8 |
9 | deals:
10 | defaultWorker:
11 | definition: bafkreifzhzgakizgfyyf2cqkmrhj5p73aw3lovhaji6sad54veo5dm4nxi
12 | timestamp: 2023-11-30T23:34:44.833Z
13 | dealIdOriginal: "0x6CA51618eC0C1cc34f6D5ead6AD1BA8e57b950D0"
14 | dealId: 6ca51618ec0c1cc34f6d5ead6ad1ba8e57b950d0
15 | chainNetwork: kras
16 | chainNetworkId: 80001
17 |
--------------------------------------------------------------------------------
/quickstart/2-browser-parallel-computation/Cargo.toml:
--------------------------------------------------------------------------------
1 | [workspace]
2 | members = [ "src/services/adder/modules/adder" ]
3 |
--------------------------------------------------------------------------------
/quickstart/2-browser-parallel-computation/assets/Browser-Parallel-Computation.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fluencelabs/examples/fbfc344abfca1af2b5466554fec7af9d6f0d5eef/quickstart/2-browser-parallel-computation/assets/Browser-Parallel-Computation.png
--------------------------------------------------------------------------------
/quickstart/2-browser-parallel-computation/assets/Browser-To-Service-Implementation.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fluencelabs/examples/fbfc344abfca1af2b5466554fec7af9d6f0d5eef/quickstart/2-browser-parallel-computation/assets/Browser-To-Service-Implementation.png
--------------------------------------------------------------------------------
/quickstart/2-browser-parallel-computation/fluence.yaml:
--------------------------------------------------------------------------------
1 | # yaml-language-server: $schema=.fluence/schemas/fluence.json
2 |
3 | # 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
4 |
5 | # Documentation: https://github.com/fluencelabs/cli/tree/main/docs/configs/fluence.md
6 |
7 | version: 5
8 |
9 | aquaInputPath: src/aqua/getting-started.aqua
10 |
11 | deals:
12 | defaultWorker:
13 | targetWorkers: 3
14 | services:
15 | - adder
16 | spells: []
17 |
18 | services:
19 | adder:
20 | get: src/services/adder
21 |
22 | relaysPath: src/frontend/src
23 |
24 | aquaOutputTSPath: src/frontend/src/compiled-aqua
25 |
--------------------------------------------------------------------------------
/quickstart/2-browser-parallel-computation/src/frontend/.gitignore:
--------------------------------------------------------------------------------
1 | .idea
2 | .DS_Store
3 | /.fluence/project-secrets.yaml
4 | /.fluence/schemas
5 | **/node_modules
6 | **/target/
7 | .repl_history
8 | .vscode/settings.json
9 |
10 | src/compiled-aqua/
--------------------------------------------------------------------------------
/quickstart/2-browser-parallel-computation/src/frontend/.prettierrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | semi: true,
3 | trailingComma: 'all',
4 | singleQuote: true,
5 | printWidth: 120,
6 | tabWidth: 4,
7 | useTabs: false,
8 | };
9 |
--------------------------------------------------------------------------------
/quickstart/2-browser-parallel-computation/src/frontend/jest.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | preset: 'jest-puppeteer',
3 | testMatch: ['**/?(*.)+(spec|test).[t]s'],
4 | testPathIgnorePatterns: ['/node_modules/', 'dist'],
5 | transform: {
6 | '^.+\\.ts?$': 'ts-jest',
7 | },
8 | };
9 |
--------------------------------------------------------------------------------
/quickstart/2-browser-parallel-computation/src/frontend/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fluencelabs/examples/fbfc344abfca1af2b5466554fec7af9d6f0d5eef/quickstart/2-browser-parallel-computation/src/frontend/public/favicon.ico
--------------------------------------------------------------------------------
/quickstart/2-browser-parallel-computation/src/frontend/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fluencelabs/examples/fbfc344abfca1af2b5466554fec7af9d6f0d5eef/quickstart/2-browser-parallel-computation/src/frontend/public/logo192.png
--------------------------------------------------------------------------------
/quickstart/2-browser-parallel-computation/src/frontend/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fluencelabs/examples/fbfc344abfca1af2b5466554fec7af9d6f0d5eef/quickstart/2-browser-parallel-computation/src/frontend/public/logo512.png
--------------------------------------------------------------------------------
/quickstart/2-browser-parallel-computation/src/frontend/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "React App",
3 | "name": "Create React App Sample",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | },
10 | {
11 | "src": "logo192.png",
12 | "type": "image/png",
13 | "sizes": "192x192"
14 | },
15 | {
16 | "src": "logo512.png",
17 | "type": "image/png",
18 | "sizes": "512x512"
19 | }
20 | ],
21 | "start_url": ".",
22 | "display": "standalone",
23 | "theme_color": "#000000",
24 | "background_color": "#ffffff"
25 | }
26 |
--------------------------------------------------------------------------------
/quickstart/2-browser-parallel-computation/src/frontend/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 | Disallow:
4 |
--------------------------------------------------------------------------------
/quickstart/2-browser-parallel-computation/src/frontend/src/index.css:
--------------------------------------------------------------------------------
1 | body {
2 | margin: 0;
3 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
4 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
5 | sans-serif;
6 | -webkit-font-smoothing: antialiased;
7 | -moz-osx-font-smoothing: grayscale;
8 | }
9 |
10 | code {
11 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
12 | monospace;
13 | }
14 |
--------------------------------------------------------------------------------
/quickstart/2-browser-parallel-computation/src/frontend/src/index.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import './index.css';
4 | import App from './App';
5 |
6 | ReactDOM.render(
7 |
8 |
9 | ,
10 | document.getElementById('root')
11 | );
12 |
13 |
--------------------------------------------------------------------------------
/quickstart/2-browser-parallel-computation/src/frontend/src/react-app-env.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 |
--------------------------------------------------------------------------------
/quickstart/2-browser-parallel-computation/src/frontend/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es5",
4 | "lib": [
5 | "dom",
6 | "dom.iterable",
7 | "esnext"
8 | ],
9 | "allowJs": true,
10 | "skipLibCheck": true,
11 | "esModuleInterop": true,
12 | "allowSyntheticDefaultImports": true,
13 | "strict": true,
14 | "forceConsistentCasingInFileNames": true,
15 | "noFallthroughCasesInSwitch": true,
16 | "module": "esnext",
17 | "moduleResolution": "node",
18 | "resolveJsonModule": true,
19 | "isolatedModules": false,
20 | "noEmit": true,
21 | "jsx": "react-jsx"
22 | },
23 | "include": [
24 | "src"
25 | ]
26 | }
27 |
--------------------------------------------------------------------------------
/quickstart/2-browser-parallel-computation/src/services/adder/modules/adder/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "adder"
3 | version = "0.1.0"
4 | edition = "2018"
5 |
6 | [[bin]]
7 | name = "adder"
8 | path = "src/main.rs"
9 |
10 | [dependencies]
11 | marine-rs-sdk = "0.10.0"
12 |
13 | [dev-dependencies]
14 | marine-rs-sdk-test = "0.10.0"
15 |
--------------------------------------------------------------------------------
/quickstart/2-browser-parallel-computation/src/services/adder/modules/adder/module.yaml:
--------------------------------------------------------------------------------
1 | # yaml-language-server: $schema=../../../../../.fluence/schemas/module.json
2 |
3 | # Defines [Marine Module](https://fluence.dev/docs/build/concepts/#modules). You can use `fluence module new` command to generate a template for new module
4 |
5 | # Documentation: https://github.com/fluencelabs/cli/tree/main/docs/configs/module.md
6 |
7 | version: 0
8 |
9 | type: rust
10 |
11 | name: adder
12 |
--------------------------------------------------------------------------------
/quickstart/2-browser-parallel-computation/src/services/adder/modules/adder/src/main.rs:
--------------------------------------------------------------------------------
1 | use marine_rs_sdk::marine;
2 |
3 | pub fn main() {}
4 |
5 | #[marine]
6 | pub fn add_one(value: u64) -> u64 {
7 | value + 1
8 | }
9 |
--------------------------------------------------------------------------------
/quickstart/2-browser-parallel-computation/src/services/adder/service.yaml:
--------------------------------------------------------------------------------
1 | # yaml-language-server: $schema=../../../.fluence/schemas/service.json
2 |
3 | # Defines a [Marine service](https://fluence.dev/docs/build/concepts/#services), most importantly the modules that the service consists of. You can use `fluence service new` command to generate a template for new service
4 |
5 | # Documentation: https://github.com/fluencelabs/cli/tree/main/docs/configs/service.md
6 |
7 | version: 0
8 |
9 | name: adder
10 |
11 | modules:
12 | facade:
13 | get: modules/adder
14 |
--------------------------------------------------------------------------------
/quickstart/Readme.md:
--------------------------------------------------------------------------------
1 | # Quick Start
2 |
3 | For the documentation of this tutorial, please see the Fluence [developer documentation](https://fluence.dev/docs/build/quick-start/).
4 | If you have any questions, please contact us in our[discord](https://fluence.chat) channel, raise an issue or open a PR.
5 |
--------------------------------------------------------------------------------