From d393905549cb33e8ce23735464a7cb0156218247 Mon Sep 17 00:00:00 2001 From: boneyard93501 <4523011+boneyard93501@users.noreply.github.com> Date: Mon, 11 Jul 2022 13:35:18 -0500 Subject: [PATCH] rm old service dirs --- .../aqua/all.aqua | 73 -------- .../aqua/iterative_try.aqua | 25 --- .../aqua/quorum_params.json | 31 ---- .../configs/quorum_deployment_cfg.json | 12 -- .../curl-adapter/Cargo.toml | 14 -- .../curl-adapter/src/main.rs | 37 ---- .../multi-provider-query/Cargo.toml | 24 --- .../multi-provider-query/src/main.rs | 159 ------------------ .../simple-quorum/Cargo.toml | 25 --- .../simple-quorum/src/main.rs | 117 ------------- .../struct-counter/Cargo.toml | 24 --- .../struct-counter/src/main.rs | 40 ----- .../utilities/.gitignore | 5 - .../utilities/Cargo.toml | 22 --- .../utilities/Config.toml | 6 - .../utilities/README.md | 18 -- .../utilities/configs/deployment_cfg.json | 11 -- .../utilities/scripts/build.sh | 7 - .../utilities/src/main.rs | 34 ---- 19 files changed, 684 deletions(-) delete mode 100644 aqua-examples/decentralized-blockchain-gateway/aqua/all.aqua delete mode 100644 aqua-examples/decentralized-blockchain-gateway/aqua/iterative_try.aqua delete mode 100644 aqua-examples/decentralized-blockchain-gateway/aqua/quorum_params.json delete mode 100644 aqua-examples/decentralized-blockchain-gateway/configs/quorum_deployment_cfg.json delete mode 100644 aqua-examples/decentralized-blockchain-gateway/curl-adapter/Cargo.toml delete mode 100644 aqua-examples/decentralized-blockchain-gateway/curl-adapter/src/main.rs delete mode 100644 aqua-examples/decentralized-blockchain-gateway/multi-provider-query/Cargo.toml delete mode 100644 aqua-examples/decentralized-blockchain-gateway/multi-provider-query/src/main.rs delete mode 100644 aqua-examples/decentralized-blockchain-gateway/simple-quorum/Cargo.toml delete mode 100644 aqua-examples/decentralized-blockchain-gateway/simple-quorum/src/main.rs delete mode 100644 aqua-examples/decentralized-blockchain-gateway/struct-counter/Cargo.toml delete mode 100644 aqua-examples/decentralized-blockchain-gateway/struct-counter/src/main.rs delete mode 100644 aqua-examples/decentralized-blockchain-gateway/utilities/.gitignore delete mode 100644 aqua-examples/decentralized-blockchain-gateway/utilities/Cargo.toml delete mode 100644 aqua-examples/decentralized-blockchain-gateway/utilities/Config.toml delete mode 100644 aqua-examples/decentralized-blockchain-gateway/utilities/README.md delete mode 100644 aqua-examples/decentralized-blockchain-gateway/utilities/configs/deployment_cfg.json delete mode 100755 aqua-examples/decentralized-blockchain-gateway/utilities/scripts/build.sh delete mode 100644 aqua-examples/decentralized-blockchain-gateway/utilities/src/main.rs diff --git a/aqua-examples/decentralized-blockchain-gateway/aqua/all.aqua b/aqua-examples/decentralized-blockchain-gateway/aqua/all.aqua deleted file mode 100644 index a6003e5..0000000 --- a/aqua-examples/decentralized-blockchain-gateway/aqua/all.aqua +++ /dev/null @@ -1,73 +0,0 @@ -data FunctionAddress: - peer_id: string - service_id: string - -data Provider: - name: string - url: string - -data EVMResult: - stdout: string - stderr: string - -service MyOp("op"): - -- identity(x:string) -> string - array_length(providers: []Provider) -> i64 - -- array_length(nodes: []string) -> i64 - -service MultiProviderQuery("service-id"): - get_block_number(provider: Provider) -> EVMResult - -func get_service_id_no_try(node: string, services: []FunctionAddress) -> string: - res: *string - for service <- services: - if service.peer_id == node: - res <<- service.service_id - <- res[0] - ---func custom_result(out_string: string, err_string: string) -> EVMResult: --- r: *EVMResult --- r.stdout <- out_string --- r.stderr <- err_string --- <- r - ---func custom_num(number: i64) -> i64: --- num: *i64 --- num <<- number --- <- num[0] - - -func get_service_id_try(node: string, services: []FunctionAddress) -> string: - res: *string - for service <- services try: - if service.peer_id == node: - res <<- service.service_id - <- res[0] - -func get_service_id_par(node: string, services: []FunctionAddress) -> string: - res: *string - for service <- services par: - if service.peer_id == node: - res <<- service.service_id - <- res[0] - --- func get_block_number(providers: []Provider, nodes: []string, services: []FunctionAddress) -> []string: -func get_block_number(providers: []Provider, nodes: []string, services: []FunctionAddress) -> []EVMResult: - -- result: *string - result: *EVMResult - for node <- nodes par: - for provider <- providers par: - on node: - service_id <- get_service_id_no_try(node, services) - MultiProviderQuery service_id - try: - -- res <- get_block_number(provider.url) - -- result <<- (provider.name, node, res) - result <- MultiProviderQuery.get_block_number(provider) - -- catch e: - -- result <- custom_result(e) - <- result - - - - \ No newline at end of file diff --git a/aqua-examples/decentralized-blockchain-gateway/aqua/iterative_try.aqua b/aqua-examples/decentralized-blockchain-gateway/aqua/iterative_try.aqua deleted file mode 100644 index d8757fb..0000000 --- a/aqua-examples/decentralized-blockchain-gateway/aqua/iterative_try.aqua +++ /dev/null @@ -1,25 +0,0 @@ -data FunctionAddress: - peer_id: string - service_id: string - -func get_service_id_no_try(node: string, services: []FunctionAddress) -> string: - res: *string - for service <- services: - if service.peer_id == node: - res <<- service.service_id - <- res[0] - -func get_service_id_try(node: string, services: []FunctionAddress) -> string: - res: *string - for service <- services try: - if service.peer_id == node: - res <<- service.service_id - <- res[0] - -func get_service_id_par(node: string, services: []FunctionAddress) -> string: - res: *string - for service <- services par: - if service.peer_id == node: - res <<- service.service_id - <- res[0] - \ No newline at end of file diff --git a/aqua-examples/decentralized-blockchain-gateway/aqua/quorum_params.json b/aqua-examples/decentralized-blockchain-gateway/aqua/quorum_params.json deleted file mode 100644 index bb54d42..0000000 --- a/aqua-examples/decentralized-blockchain-gateway/aqua/quorum_params.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "arg1": [ - { - "name": "infura", - "url": "https://mainnet.infura.io/v3/" - }, - { - "name": "alchemy", - "url": "https://eth-mainnet.alchemyapi.io/v2/" - }, - { "name": "link", "url": "https://main-light.eth.linkpool.io" } - ], - "arg2": [ - { - "peer_id": "12D3KooWJ4bTHirdTFNZpCS72TAzwtdmavTBkkEXtzo6wHL25CtE", - "service_id": "d9124884-3c42-43d6-9a1f-1b645d073c3f" - }, - { - "peer_id": "12D3KooWAKNos2KogexTXhrkMZzFYpLHuWJ4PgoAhurSAv7o5CWA", - "service_id": "3c321110-b069-42c6-b5e0-aed73d976a60" - }, - { - "peer_id": "12D3KooWMMGdfVEJ1rWe1nH1nehYDzNEHhg5ogdfiGk88AupCMnf", - "service_id": "84d4d018-0c13-4d6d-8c11-599a3919911c" - } - ], - "arg3": { - "peer_id": "12D3KooWAKNos2KogexTXhrkMZzFYpLHuWJ4PgoAhurSAv7o5CWA", - "service_id": "366e3fdd-0d8d-4f8f-bae6-e2e541a17550" - } -} diff --git a/aqua-examples/decentralized-blockchain-gateway/configs/quorum_deployment_cfg.json b/aqua-examples/decentralized-blockchain-gateway/configs/quorum_deployment_cfg.json deleted file mode 100644 index 53a476a..0000000 --- a/aqua-examples/decentralized-blockchain-gateway/configs/quorum_deployment_cfg.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "multi-provider-query": { - "modules": [ - { - "name": "simple-quorum", - "path": "./artifacts/simple_quorum.wasm", - "max_heap_size": "128 MiB", - "logger_enabled": [true] - } - ] - } -} diff --git a/aqua-examples/decentralized-blockchain-gateway/curl-adapter/Cargo.toml b/aqua-examples/decentralized-blockchain-gateway/curl-adapter/Cargo.toml deleted file mode 100644 index b443c8a..0000000 --- a/aqua-examples/decentralized-blockchain-gateway/curl-adapter/Cargo.toml +++ /dev/null @@ -1,14 +0,0 @@ -[package] -name = "curl_adapter" -version = "0.1.0" -authors = ["Fluence Labs"] -edition = "2018" -publish = false - -[[bin]] -path = "src/main.rs" -name = "curl_adapter" - -[dependencies] -marine-rs-sdk = "0.6.14" -log = "0.4.8" diff --git a/aqua-examples/decentralized-blockchain-gateway/curl-adapter/src/main.rs b/aqua-examples/decentralized-blockchain-gateway/curl-adapter/src/main.rs deleted file mode 100644 index 861cbf8..0000000 --- a/aqua-examples/decentralized-blockchain-gateway/curl-adapter/src/main.rs +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2021 Fluence Labs Limited - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#![allow(improper_ctypes)] - -use marine_rs_sdk::marine; -use marine_rs_sdk::module_manifest; - -use marine_rs_sdk::MountedBinaryResult; - -module_manifest!(); - -pub fn main() {} - -#[marine] -pub fn curl_request(cmd: Vec) -> MountedBinaryResult { - curl(cmd) -} - -#[marine] -#[link(wasm_import_module = "host")] -extern "C" { - fn curl(cmd: Vec) -> MountedBinaryResult; -} diff --git a/aqua-examples/decentralized-blockchain-gateway/multi-provider-query/Cargo.toml b/aqua-examples/decentralized-blockchain-gateway/multi-provider-query/Cargo.toml deleted file mode 100644 index 8841672..0000000 --- a/aqua-examples/decentralized-blockchain-gateway/multi-provider-query/Cargo.toml +++ /dev/null @@ -1,24 +0,0 @@ -[package] -name = "multi_provider_query" -version = "0.1.5" -authors = ["boneyard93501 <4523011+boneyard93501@users.noreply.github.com>"] -edition = "2018" -description = "multi-provider-query, a Marine wasi module" -license = "Apache-2.0" - -[[bin]] -name = "multi_provider_query" -path = "src/main.rs" - -[dependencies] -marine-rs-sdk = { version = "0.6.15", features = ["logger"] } -log = "0.4.14" -serde_json = "1.0.81" -serde = "1.0.137" - -[dev-dependencies] -marine-rs-sdk-test = "0.6.0" - -[dev] -[profile.release] -opt-level = "s" diff --git a/aqua-examples/decentralized-blockchain-gateway/multi-provider-query/src/main.rs b/aqua-examples/decentralized-blockchain-gateway/multi-provider-query/src/main.rs deleted file mode 100644 index 7a2362b..0000000 --- a/aqua-examples/decentralized-blockchain-gateway/multi-provider-query/src/main.rs +++ /dev/null @@ -1,159 +0,0 @@ -/* - * Copyright 2022 Fluence Labs Limited - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -use marine_rs_sdk::{marine, module_manifest, MountedBinaryResult}; -use serde::{Deserialize, Serialize}; -use serde_json; -use std::sync::atomic::{AtomicUsize, Ordering}; - -pub static NONCE_COUNTER: AtomicUsize = AtomicUsize::new(1); - -module_manifest!(); - -fn main() {} - -fn get_nonce() -> u64 { - NONCE_COUNTER.fetch_add(1, Ordering::SeqCst) as u64 -} - -#[marine] -pub struct ProviderInfo { - pub url: String, - pub name: String, -} - -#[marine] -pub struct EVMResult { - pub provider: String, - pub stdout: String, - pub stderr: String, -} - -#[derive(Serialize, Deserialize)] -struct RpcData { - jsonrpc: String, - method: String, - params: Vec, - id: u64, -} - -#[derive(Serialize, Deserialize, Debug)] -struct RpcResponseError { - code: i32, - message: String, -} -#[derive(Serialize, Deserialize, Debug)] -struct RpcResponse { - jsonrpc: String, - error: Option, - result: Option, -} - -impl RpcData { - fn new(method: String, params: Vec) -> Self { - let nonce = get_nonce(); - RpcData { - jsonrpc: "2.0".to_owned(), - method: method, - params: params, - id: nonce, - } - } -} - -fn curl_cmd_builder(url: String, data: String) -> Vec { - let curl_cmd: Vec = vec![ - url, - "-X".to_string(), - "POST".to_string(), - "-H".to_string(), - "Accept: application/json".to_string(), - "-H".to_string(), - "Content-Type: application/json".to_string(), - "-d".to_string(), - data, - ]; - - curl_cmd -} - -fn get_curl_response(curl_cmd: Vec) -> RpcResponse { - let response = curl_request(curl_cmd); - let response = String::from_utf8(response.stdout).unwrap(); - let response: Result = serde_json::from_str(&response); - match response { - Ok(r) => r, - Err(e) => RpcResponse { - jsonrpc: "".to_owned(), - error: Some(RpcResponseError { - code: -1, - message: e.to_string(), - }), - result: None, - }, - } -} - -#[marine] -// see https://eth.wiki/json-rpc/API#eth_blocknumbers -fn get_block_number(provider: ProviderInfo) -> EVMResult { - let method = "eth_blockNumber"; - let params: Vec = vec![]; - let url = provider.url; - - let data = RpcData::new(method.to_owned(), params); - let data = serde_json::to_string(&data).unwrap(); - - let curl_cmd = curl_cmd_builder(url, data); - let response = get_curl_response(curl_cmd); - - if response.error.is_none() { - let raw_response = response.result.unwrap(); - let block_height = u64::from_str_radix(raw_response.trim_start_matches("0x"), 16); - - let result = match block_height { - Ok(r) => { - let j_res = serde_json::json!({ "block-height": r }); - EVMResult { - provider: provider.name, - stdout: j_res.to_string(), - stderr: "".to_owned(), - } - } - Err(e) => { - let err = format!("unable to convert {} to u64 with error {}", raw_response, e); - EVMResult { - provider: provider.name, - stdout: "".to_owned(), - stderr: err, - } - } - }; - return result; - } - - EVMResult { - provider: provider.name, - stdout: "".to_owned(), - stderr: serde_json::to_string(&response.error).unwrap(), - } -} - -#[marine] -#[link(wasm_import_module = "curl_adapter")] -extern "C" { - pub fn curl_request(cmd: Vec) -> MountedBinaryResult; -} diff --git a/aqua-examples/decentralized-blockchain-gateway/simple-quorum/Cargo.toml b/aqua-examples/decentralized-blockchain-gateway/simple-quorum/Cargo.toml deleted file mode 100644 index f03f982..0000000 --- a/aqua-examples/decentralized-blockchain-gateway/simple-quorum/Cargo.toml +++ /dev/null @@ -1,25 +0,0 @@ -[package] -name = "simple-quorum" -version = "0.1.0" -authors = ["boneyard93501 <4523011+boneyard93501@users.noreply.github.com>"] -edition = "2018" -description = "simple-quorum, a Marine wasi module" -license = "Apache-2.0" - -[[bin]] -name = "simple_quorum" -path = "src/main.rs" - -[dependencies] -marine-rs-sdk = { version = "0.6.15", features = ["logger"] } -log = "0.4.14" -serde_json = "1.0.81" -serde = "1.0.137" -streaming-stats = "0.2.3" - -[dev-dependencies] -marine-rs-sdk-test = "0.6.0" - -[dev] -[profile.release] -opt-level = "s" diff --git a/aqua-examples/decentralized-blockchain-gateway/simple-quorum/src/main.rs b/aqua-examples/decentralized-blockchain-gateway/simple-quorum/src/main.rs deleted file mode 100644 index 7b2b69c..0000000 --- a/aqua-examples/decentralized-blockchain-gateway/simple-quorum/src/main.rs +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright 2022 Fluence Labs Limited - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -use marine_rs_sdk::{marine, module_manifest}; -use std::collections::HashMap; - -module_manifest!(); - -fn main() {} - -// very simple mode calculator with much room for improvement -// see https://github.com/BurntSushi/rust-stats for inspiration -fn mode<'a>(data: impl ExactSizeIterator) -> (u32, u64) { - let frequencies = data - .into_iter() - .fold(HashMap::::new(), |mut freqs, value| { - *freqs - .entry( - match serde_json::from_str::(&value.stdout) { - Ok(r) => r["block-height"].as_u64().unwrap(), - Err(_e) => 0 as u64, - }, - ) - .or_insert(0) += 1; - freqs - }); - - let mode = frequencies - .iter() - .max_by_key(|&(_, count)| count) - .map(|(value, _)| value) - .unwrap(); - - (*frequencies.get(&mode).unwrap(), *mode) -} - -fn mean<'a>(data: impl ExactSizeIterator) -> Option { - let n = data.len() as u64; - if n < 1 { - return None; - } - let res = (data.sum::() / n) as f64; - Some(res) -} - -#[marine] -pub struct EVMResult { - pub provider: String, - pub stdout: String, - pub stderr: String, -} - -#[marine] -#[derive(Default, Debug)] -pub struct Quorum { - pub n: u32, - pub mode: u64, - pub freq: u32, - pub err_str: String, -} - -#[marine] -pub fn point_estimate(data: Vec, min_points: u32) -> Quorum { - if data.len() < min_points as usize { - return Quorum { - err_str: format!( - "Expected at least {} points but only got {}.", - min_points, - data.len() - ), - ..<_>::default() - }; - } - - if data.len() < 1 { - return Quorum { - err_str: format!("Expected at least one timestamp."), - ..<_>::default() - }; - } - - let (freq, mode) = mode(data.iter()); - - Quorum { - n: data.len() as u32, - mode, - freq, - ..<_>::default() - } -} - -#[marine] -pub fn int_div(nom: u64, denom: u64) -> f64 { - nom as f64 / denom as f64 -} - -#[marine] -pub fn is_quorum(nom: u64, denom: u64, threshold: f64) -> bool { - let div = nom as f64 / denom as f64; - if div >= threshold { - return true; - } - false -} diff --git a/aqua-examples/decentralized-blockchain-gateway/struct-counter/Cargo.toml b/aqua-examples/decentralized-blockchain-gateway/struct-counter/Cargo.toml deleted file mode 100644 index 8841672..0000000 --- a/aqua-examples/decentralized-blockchain-gateway/struct-counter/Cargo.toml +++ /dev/null @@ -1,24 +0,0 @@ -[package] -name = "multi_provider_query" -version = "0.1.5" -authors = ["boneyard93501 <4523011+boneyard93501@users.noreply.github.com>"] -edition = "2018" -description = "multi-provider-query, a Marine wasi module" -license = "Apache-2.0" - -[[bin]] -name = "multi_provider_query" -path = "src/main.rs" - -[dependencies] -marine-rs-sdk = { version = "0.6.15", features = ["logger"] } -log = "0.4.14" -serde_json = "1.0.81" -serde = "1.0.137" - -[dev-dependencies] -marine-rs-sdk-test = "0.6.0" - -[dev] -[profile.release] -opt-level = "s" diff --git a/aqua-examples/decentralized-blockchain-gateway/struct-counter/src/main.rs b/aqua-examples/decentralized-blockchain-gateway/struct-counter/src/main.rs deleted file mode 100644 index 622ce40..0000000 --- a/aqua-examples/decentralized-blockchain-gateway/struct-counter/src/main.rs +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 2022 Fluence Labs Limited - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -use marine_rs_sdk::{marine, module_manifest, MountedBinaryResult}; - -module_manifest!(); - -fn main() {} - -#[marine] -pub struct ProviderInfo { - pub url: String, -} - -#[marine] -pub struct EVMResult { - pub stdout: String, - pub stderr: String, -} - -#[marine] -fn count_providers(providers: Vec) -> u64 { - providers.len() as u64 -} - -#[marine] -fn provider_results(results: Vec) {} diff --git a/aqua-examples/decentralized-blockchain-gateway/utilities/.gitignore b/aqua-examples/decentralized-blockchain-gateway/utilities/.gitignore deleted file mode 100644 index bbccc88..0000000 --- a/aqua-examples/decentralized-blockchain-gateway/utilities/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -debug/ -target/ -Cargo.lock -**/*.bk -**/*.bak diff --git a/aqua-examples/decentralized-blockchain-gateway/utilities/Cargo.toml b/aqua-examples/decentralized-blockchain-gateway/utilities/Cargo.toml deleted file mode 100644 index 0914ed8..0000000 --- a/aqua-examples/decentralized-blockchain-gateway/utilities/Cargo.toml +++ /dev/null @@ -1,22 +0,0 @@ -[package] -name = "utilities" -version = "0.1.5" -authors = ["boneyard93501 <4523011+boneyard93501@users.noreply.github.com>"] -edition = "2018" -description = "utilities, a Marine wasi module" -license = "Apache-2.0" - -[[bin]] -name = "utilities" -path = "src/main.rs" - -[dependencies] -marine-rs-sdk = { version = "0.6.15", features = ["logger"] } -log = "0.4.14" - -[dev-dependencies] -marine-rs-sdk-test = "0.6.0" - -[dev] -[profile.release] -opt-level = "s" diff --git a/aqua-examples/decentralized-blockchain-gateway/utilities/Config.toml b/aqua-examples/decentralized-blockchain-gateway/utilities/Config.toml deleted file mode 100644 index 8a6cb41..0000000 --- a/aqua-examples/decentralized-blockchain-gateway/utilities/Config.toml +++ /dev/null @@ -1,6 +0,0 @@ -modules_dir = "artifacts/" - -[[module]] -name = "utilities" -max_heap_size = "10 KiB" -logger_enabled = true diff --git a/aqua-examples/decentralized-blockchain-gateway/utilities/README.md b/aqua-examples/decentralized-blockchain-gateway/utilities/README.md deleted file mode 100644 index 9771b01..0000000 --- a/aqua-examples/decentralized-blockchain-gateway/utilities/README.md +++ /dev/null @@ -1,18 +0,0 @@ -# Marine Starter Template - -Get started quickly with your Wasm project with this template. -To use this template you should have the following components available: - -* Rust [installation instructions](https://www.rust-lang.org/tools/install) -* Cargo Generate [installation instructions](https://github.com/cargo-generate/cargo-generate#installation) -* Marine [installation instructions](https://github.com/cargo-generate/cargo-generate#installation) - -Use the template with `cargo generate`: - -```bash -cargo generate cargo generate --git https://github.com/boneyard93501/fluence-template.git -``` - -Which will prompt you for the project name and then generate the project, which will be your directory name. `cd` into your new directory and run `./scripts/build.sh` to compile the supplied __greeting__ function to a Wasm file ready for deployment. - -Check out the [Fluence documentation](https://doc.fluence.dev/docs/) for more details on Marine and Aqua. diff --git a/aqua-examples/decentralized-blockchain-gateway/utilities/configs/deployment_cfg.json b/aqua-examples/decentralized-blockchain-gateway/utilities/configs/deployment_cfg.json deleted file mode 100644 index b74c23a..0000000 --- a/aqua-examples/decentralized-blockchain-gateway/utilities/configs/deployment_cfg.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "utilities": { - "name": "utilities", - "modules": [ - { - "name": "utilities", - "path": "./artifacts/utilities.wasm" - } - ] - } -} diff --git a/aqua-examples/decentralized-blockchain-gateway/utilities/scripts/build.sh b/aqua-examples/decentralized-blockchain-gateway/utilities/scripts/build.sh deleted file mode 100755 index 2222d00..0000000 --- a/aqua-examples/decentralized-blockchain-gateway/utilities/scripts/build.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env bash -o errexit -o nounset -o pipefail -cargo update --aggressive - -mkdir -p artifacts -rm -f artifacts/*.wasm -marine build --release -cp target/wasm32-wasi/release/utilities.wasm artifacts/ diff --git a/aqua-examples/decentralized-blockchain-gateway/utilities/src/main.rs b/aqua-examples/decentralized-blockchain-gateway/utilities/src/main.rs deleted file mode 100644 index 976ee3b..0000000 --- a/aqua-examples/decentralized-blockchain-gateway/utilities/src/main.rs +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2022 Fluence Labs Limited - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -use marine_rs_sdk::{marine, module_manifest, WasmLoggerBuilder}; - -module_manifest!(); - -pub fn main() { - WasmLoggerBuilder::new().build().unwrap(); -} - -#[marine] -pub struct CustomResult { - stdout: String, - stderr: String, - provider_name: String, - error: bool, -} - -#[marine] -pub fn to_struct(name: String, stdout: String, stderr: String) -> String {}