mirror of
https://github.com/fluencelabs/examples
synced 2024-12-04 19:20:17 +00:00
init multi services
This commit is contained in:
parent
19d5fd4db6
commit
5f10fb3559
17
multi-service/Config.toml
Normal file
17
multi-service/Config.toml
Normal file
@ -0,0 +1,17 @@
|
||||
modules_dir = "artifacts/"
|
||||
|
||||
[[module]]
|
||||
name = "curl_adapter"
|
||||
|
||||
[module.mounted_binaries]
|
||||
curl = "/usr/bin/curl"
|
||||
|
||||
|
||||
[[module]]
|
||||
name = "block_getter"
|
||||
|
||||
[[module]]
|
||||
name = "hex_converter"
|
||||
|
||||
[[module]]
|
||||
name = "extract_miner_address"
|
13
multi-service/air-scripts/get_latest_block.clj
Normal file
13
multi-service/air-scripts/get_latest_block.clj
Normal file
@ -0,0 +1,13 @@
|
||||
(xor
|
||||
(seq
|
||||
|
||||
(call node_1 (service_1 "get_latest_block") [api_key] hex_result)
|
||||
(call %init_peer_id% (returnService "run") [hex_result])
|
||||
(call node_2 (service_2 "hex_to_int") [hex_result] result)
|
||||
(call %init_peer_id% (returnService "run") [result])
|
||||
)
|
||||
(seq
|
||||
(call relay ("op" "identity") [])
|
||||
(call %init_peer_id% (returnService "run") ["XOR FAILED" %last_error%])
|
||||
)
|
||||
)
|
10
multi-service/air-scripts/get_latest_block_simple.clj
Normal file
10
multi-service/air-scripts/get_latest_block_simple.clj
Normal file
@ -0,0 +1,10 @@
|
||||
(xor
|
||||
(seq
|
||||
(call node_1 (service "get_latest_block") ["MC5H2NK6ZIPMR32U7D4W35AWNNVCQX1ENH"] hex_result)
|
||||
(call %init_peer_id% (returnService "run") [hex_result])
|
||||
)
|
||||
(seq
|
||||
(call relay ("op" "identity") [])
|
||||
(call %init_peer_id% (returnService "run") ["XOR FAILED" %last_error%])
|
||||
)
|
||||
)
|
44
multi-service/air-scripts/multi_block_processor.clj
Normal file
44
multi-service/air-scripts/multi_block_processor.clj
Normal file
@ -0,0 +1,44 @@
|
||||
(xor
|
||||
(seq
|
||||
(call node_1 (service “get_latest_block”) [“api_key”] hex_result)
|
||||
(call %init_peer_id% (returnService “run”) [hex_result])
|
||||
;; result is latest block number as a hex string
|
||||
(call node_4 (service “hex_to_int”) [hex_result] result)
|
||||
(call %init_peer_id% (returnService “run”) [result])
|
||||
;; result is latest block number as a u64
|
||||
|
||||
(par
|
||||
(seq
|
||||
(call node_2 (service “get_block”) [“api_key” result] result_0_0)
|
||||
(call %init_peer_id% (returnService “run”) result_0_0)
|
||||
;; returns a json string for block
|
||||
(call node_3 (service “extract_miner) [result_0_0] result_0_1)
|
||||
(call %init_peer_id% (returnService “run”) [result_0_1])
|
||||
;; returns the miner address as hex string
|
||||
)
|
||||
(seq
|
||||
(call node_2 (service “get_block”) [“api_key” result-1] result_1_0)
|
||||
(call %init_peer_id% (returnService “run”) result_1_0)
|
||||
(call node_3 (service “extract_miner) [result_1_0] result_1_1)
|
||||
(call %init_peer_id% (returnService “run”) [result_1_1])
|
||||
)
|
||||
(seq
|
||||
(call node_2 (service “get_block”) [“api_key” result-2] result_2_0)
|
||||
(call %init_peer_id% (returnService “run”) result_2_0)
|
||||
(call node_3 (service “extract_miner) [result_2_0] result_2_1)
|
||||
(call %init_peer_id% (returnService “run”) [result_2_1])
|
||||
)
|
||||
(seq
|
||||
(call node_2 (service “get_block”) [“api_key” result-3] result_3_0)
|
||||
(call %init_peer_id% (returnService “run”) result_3_0)
|
||||
(call node_3 (service “extract_miner) [result_3_0] result_3_1)
|
||||
(call %init_peer_id% (returnService “run”) [result_3_1])
|
||||
)
|
||||
)
|
||||
|
||||
)
|
||||
(seq
|
||||
(call relay (“op” “identity”) [])
|
||||
(call %init_peer_id% (returnService “run”) [“XOR FAILED” %last_error%])
|
||||
)
|
||||
)
|
1
multi-service/block_getter/.gitignore
vendored
Normal file
1
multi-service/block_getter/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/target
|
208
multi-service/block_getter/Cargo.lock
generated
Normal file
208
multi-service/block_getter/Cargo.lock
generated
Normal file
@ -0,0 +1,208 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
[[package]]
|
||||
name = "block_getter"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"fluence",
|
||||
"fstrings",
|
||||
"log",
|
||||
"serde_json",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||
|
||||
[[package]]
|
||||
name = "fluence"
|
||||
version = "0.2.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "27d9a5e4292d7bbd809a0e968e3c3aacac91cbc5acab3e26ee1e1d726f0aab24"
|
||||
dependencies = [
|
||||
"fluence-sdk-macro",
|
||||
"fluence-sdk-main",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fluence-sdk-macro"
|
||||
version = "0.2.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ea1a7c75a617f827d1ba9a17b4d84e1565ab239915c63f5a85c41f89a9f1d4ba"
|
||||
dependencies = [
|
||||
"fluence-sdk-wit",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fluence-sdk-main"
|
||||
version = "0.2.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6edcc983f9517c1b6bf9f851ef27f2894a3159aaa4a2fb6c9deb2ae8ecb603fa"
|
||||
dependencies = [
|
||||
"fluence-sdk-macro",
|
||||
"log",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fluence-sdk-wit"
|
||||
version = "0.2.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b75dbdd0275160f3818db3218563d791e6c612b616cd3c5d6e66283f207f648d"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"syn",
|
||||
"uuid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fstrings"
|
||||
version = "0.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7845a0f15da505ac36baad0486612dab57f8b8d34e19c5470a265bbcdd572ae6"
|
||||
dependencies = [
|
||||
"fstrings-proc-macro",
|
||||
"proc-macro-hack",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fstrings-proc-macro"
|
||||
version = "0.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "63b58c0e7581dc33478a32299182cbe5ae3b8c028be26728a47fb0a113c92d9d"
|
||||
dependencies = [
|
||||
"proc-macro-hack",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "getrandom"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c9495705279e7140bf035dde1f6e750c162df8b625267cd52cc44e0b156732c8"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"wasi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "itoa"
|
||||
version = "0.4.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736"
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.86"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b7282d924be3275cec7f6756ff4121987bc6481325397dde6ba3e7802b1a8b1c"
|
||||
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.4.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro-hack"
|
||||
version = "0.5.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5"
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.24"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71"
|
||||
dependencies = [
|
||||
"unicode-xid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ryu"
|
||||
version = "1.0.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e"
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.118"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "06c64263859d87aa2eb554587e2d23183398d617427327cf2b3d0ed8c69e4800"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.118"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c84d3526699cd55261af4b941e4e725444df67aa4f9e6a3564f18030d12672df"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_json"
|
||||
version = "1.0.64"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "799e97dc9fdae36a5c8b8f2cae9ce2ee9fdce2058c57a93e6099d919fd982f79"
|
||||
dependencies = [
|
||||
"itoa",
|
||||
"ryu",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "1.0.60"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c700597eca8a5a762beb35753ef6b94df201c81cca676604f547495a0d7f0081"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"unicode-xid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-xid"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564"
|
||||
|
||||
[[package]]
|
||||
name = "uuid"
|
||||
version = "0.8.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7"
|
||||
dependencies = [
|
||||
"getrandom",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasi"
|
||||
version = "0.10.2+wasi-snapshot-preview1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6"
|
13
multi-service/block_getter/Cargo.toml
Normal file
13
multi-service/block_getter/Cargo.toml
Normal file
@ -0,0 +1,13 @@
|
||||
[package]
|
||||
name = "block_getter"
|
||||
version = "0.1.0"
|
||||
authors = ["boneyard93501 <4523011+boneyard93501@users.noreply.github.com>"]
|
||||
edition = "2018"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
fluence = { version = "0.2.18", features = ["logger"]}
|
||||
log = "0.4.8"
|
||||
serde_json = "1.0.64"
|
||||
fstrings = "0.2.3"
|
36
multi-service/block_getter/src/eth_block_getters.rs
Normal file
36
multi-service/block_getter/src/eth_block_getters.rs
Normal file
@ -0,0 +1,36 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
use crate::curl_request;
|
||||
use fluence::fce;
|
||||
|
||||
#[fce]
|
||||
pub fn get_latest_block(api_key: String) -> String {
|
||||
let url =
|
||||
f!("https://api.etherscan.io/api?module=proxy&action=eth_blockNumber&apikey={api_key}");
|
||||
|
||||
let response: String = unsafe { curl_request(url) };
|
||||
response
|
||||
}
|
||||
|
||||
#[fce]
|
||||
pub fn get_block(api_key: String, block_number: u64) -> String {
|
||||
// let block_num = format!("{:X}", block_number);
|
||||
let url = f!("https://api.etherscan.io/api?module=block&action=getblockreward&blockno={block_number}&apikey={api_key}");
|
||||
|
||||
let response: String = unsafe { curl_request(url) };
|
||||
response
|
||||
}
|
31
multi-service/block_getter/src/main.rs
Normal file
31
multi-service/block_getter/src/main.rs
Normal file
@ -0,0 +1,31 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
#[macro_use]
|
||||
extern crate fstrings;
|
||||
|
||||
use fluence::{fce, WasmLoggerBuilder};
|
||||
|
||||
mod eth_block_getters;
|
||||
|
||||
fn main() {
|
||||
WasmLoggerBuilder::new().build().ok();
|
||||
}
|
||||
|
||||
#[fce]
|
||||
#[link(wasm_import_module = "curl_adapter")]
|
||||
extern "C" {
|
||||
pub fn curl_request(url: String) -> String;
|
||||
}
|
3
multi-service/config/block_getter_cfg.json
Normal file
3
multi-service/config/block_getter_cfg.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"name": "EthereumBlockGetter"
|
||||
}
|
6
multi-service/config/curl_cfg.json
Normal file
6
multi-service/config/curl_cfg.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"name": "curl_adapter",
|
||||
"mountedBinaries": {
|
||||
"curl": "/usr/bin/curl"
|
||||
}
|
||||
}
|
3
multi-service/config/extract_miner_address_cfg.json
Normal file
3
multi-service/config/extract_miner_address_cfg.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"name": "ExtractMinerAddress"
|
||||
}
|
3
multi-service/config/hex_converter_cfg.json
Normal file
3
multi-service/config/hex_converter_cfg.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"name": "Hex2Int"
|
||||
}
|
6
multi-service/config/my_keypair.json
Normal file
6
multi-service/config/my_keypair.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
id: '12D3KooWJLm7n3GpZasv5gsAkta8BYBKHHC19PZ6U8kzWNaabjNz',
|
||||
privKey: 'CAESYKG9Z8F1pUj2st8iziQ7ha9a70Fqpa0UK1aY9Y9n6wnkfqbeNr2/LBfAGHJ4ocmIOjia1FYbYuYH6+Eqgssr7aN+pt42vb8sF8AYcnihyYg6OJrUVhti5gfr4SqCyyvtow==',
|
||||
pubKey: 'CAESIH6m3ja9vywXwBhyeKHJiDo4mtRWG2LmB+vhKoLLK+2j',
|
||||
seed: 'BtN9ikmpcSRgBWgwLF9yoSZeyuzmYvc5Czyn8XRy514P'
|
||||
}
|
6
multi-service/curl_adapter/.gitignore
vendored
Normal file
6
multi-service/curl_adapter/.gitignore
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
DS_Store
|
||||
.repl_history
|
||||
/target
|
||||
**/**.bak
|
||||
**/**.bk
|
||||
Cargo.lock
|
15
multi-service/curl_adapter/Cargo.toml
Normal file
15
multi-service/curl_adapter/Cargo.toml
Normal file
@ -0,0 +1,15 @@
|
||||
[package]
|
||||
name = "curl_adapter"
|
||||
version = "0.1.0"
|
||||
authors = ["Fluence Labs"]
|
||||
edition = "2018"
|
||||
publish = false
|
||||
|
||||
[[bin]]
|
||||
path = "src/main.rs"
|
||||
name = "curl_adapter"
|
||||
|
||||
[dependencies]
|
||||
fluence = { version = "=0.2.18", features = ["logger"]}
|
||||
log = "0.4.8"
|
||||
serde_json = "1.0.64"
|
55
multi-service/curl_adapter/src/main.rs
Normal file
55
multi-service/curl_adapter/src/main.rs
Normal file
@ -0,0 +1,55 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
use fluence::fce;
|
||||
use fluence::WasmLoggerBuilder;
|
||||
|
||||
/// Log level can be changed by `RUST_LOG` env as well.
|
||||
pub fn main() {
|
||||
WasmLoggerBuilder::new().build().unwrap();
|
||||
}
|
||||
|
||||
#[fce]
|
||||
pub fn curl_request(url: String) -> String {
|
||||
// log::info!("get called with url {}", url);
|
||||
|
||||
unsafe { curl(url) }
|
||||
}
|
||||
|
||||
/// Permissions in `Config.toml` should exist to use host functions.
|
||||
#[fce]
|
||||
#[link(wasm_import_module = "host")]
|
||||
extern "C" {
|
||||
fn curl(cmd: String) -> String;
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn curl_test() {
|
||||
let args = r#"-X POST --data '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["0x1b4", true],"id":1}'"#;
|
||||
let url = "https://kovan.infura.io/v3//0cc023286cae4ab886598ecd14e256fd";
|
||||
|
||||
let cmd = format!("{} {}", args, url);
|
||||
println!("cmd: {}", cmd);
|
||||
|
||||
let res = curl_request(cmd);
|
||||
println!("res: {}", res);
|
||||
assert!(true);
|
||||
}
|
||||
}
|
64
multi-service/docs/block_getter_params.txt
Normal file
64
multi-service/docs/block_getter_params.txt
Normal file
@ -0,0 +1,64 @@
|
||||
mbp16~/localdev/fluence-examples/multi-service(multi-service|✚3…) % fldist new_service --env testnet -s BtN9ikmpcSRgBWgwLF9yoSZeyuzmYvc5Czyn8XRy514P -n eth_block_getter --ms artifacts/curl_adapter.wasm:config/curl_cfg.json artifacts/block_getter.wasm:config/block_getter_cfg.json --node 12D3KooWEXNUbCXooUwHrHBbrmjsrpHXoEphPwbjQXEGyzbqKnE9
|
||||
client seed: BtN9ikmpcSRgBWgwLF9yoSZeyuzmYvc5Czyn8XRy514P
|
||||
client peerId: 12D3KooWJLm7n3GpZasv5gsAkta8BYBKHHC19PZ6U8kzWNaabjNz
|
||||
node peerId: 12D3KooWEXNUbCXooUwHrHBbrmjsrpHXoEphPwbjQXEGyzbqKnE9
|
||||
uploading blueprint eth_block_getter to node 12D3KooWEXNUbCXooUwHrHBbrmjsrpHXoEphPwbjQXEGyzbqKnE9 via client 12D3KooWJLm7n3GpZasv5gsAkta8BYBKHHC19PZ6U8kzWNaabjNz
|
||||
creating service f653a73d-ad25-47f2-8b38-a400b8122e3e
|
||||
service id: 6e1318e7-836f-4407-b355-e774c3fe1d87
|
||||
service created successfully
|
||||
|
||||
mbp16~/localdev/fluence-examples/multi-service(multi-service|✚3…) % fldist new_service --env testnet -s BtN9ikmpcSRgBWgwLF9yoSZeyuzmYvc5Czyn8XRy514P -n eth_block_getter --ms artifacts/curl_adapter.wasm:config/curl_cfg.json artifacts/block_getter.wasm:config/block_getter_cfg.json --node 12D3KooWHk9BjDQBUqnavciRPhAYFvqKBe4ZiPPvde7vDaqgn5er
|
||||
client seed: BtN9ikmpcSRgBWgwLF9yoSZeyuzmYvc5Czyn8XRy514P
|
||||
client peerId: 12D3KooWJLm7n3GpZasv5gsAkta8BYBKHHC19PZ6U8kzWNaabjNz
|
||||
node peerId: 12D3KooWHk9BjDQBUqnavciRPhAYFvqKBe4ZiPPvde7vDaqgn5er
|
||||
uploading blueprint eth_block_getter to node 12D3KooWHk9BjDQBUqnavciRPhAYFvqKBe4ZiPPvde7vDaqgn5er via client 12D3KooWJLm7n3GpZasv5gsAkta8BYBKHHC19PZ6U8kzWNaabjNz
|
||||
creating service ae43ae17-455c-49c0-8819-f3c081f23b75
|
||||
service id: 5023eb9a-9d2e-45da-9291-68db5fef30ad
|
||||
service created successfully
|
||||
mbp16~/localdev/fluence-examples/multi-service(multi-service|✚3…) %
|
||||
|
||||
|
||||
|
||||
|
||||
mbp16~/localdev/fluence-examples/multi-service(multi-service|✚3…) % fldist new_service --env testnet -s BtN9ikmpcSRgBWgwLF9yoSZeyuzmYvc5Czyn8XRy514P -n hex2int_converter --ms artifacts/hex_converter.wasm:config/hex_converter_cfg.json --node 12D3KooWMhVpgfQxBLkQkJed8VFNvgN4iE6MD7xCybb1ZYWW2Gtz
|
||||
client seed: BtN9ikmpcSRgBWgwLF9yoSZeyuzmYvc5Czyn8XRy514P
|
||||
client peerId: 12D3KooWJLm7n3GpZasv5gsAkta8BYBKHHC19PZ6U8kzWNaabjNz
|
||||
node peerId: 12D3KooWMhVpgfQxBLkQkJed8VFNvgN4iE6MD7xCybb1ZYWW2Gtz
|
||||
uploading blueprint hex2int_converter to node 12D3KooWMhVpgfQxBLkQkJed8VFNvgN4iE6MD7xCybb1ZYWW2Gtz via client 12D3KooWJLm7n3GpZasv5gsAkta8BYBKHHC19PZ6U8kzWNaabjNz
|
||||
creating service e2c2bb33-8b73-4e5c-a1b0-2f8df2bd4bc6
|
||||
service id: 7b162215-6413-4385-a4bb-f7cc64017ebb
|
||||
service created successfully
|
||||
|
||||
mbp16~/localdev/fluence-examples/multi-service(multi-service|✚3…) % fldist new_service --env testnet -s BtN9ikmpcSRgBWgwLF9yoSZeyuzmYvc5Czyn8XRy514P -n hex2int_converter --ms artifacts/hex_converter.wasm:config/hex_converter_cfg.json --node 12D3KooWCKCeqLPSgMnDjyFsJuWqREDtKNHx1JEBiwaMXhCLNTRb
|
||||
client seed: BtN9ikmpcSRgBWgwLF9yoSZeyuzmYvc5Czyn8XRy514P
|
||||
client peerId: 12D3KooWJLm7n3GpZasv5gsAkta8BYBKHHC19PZ6U8kzWNaabjNz
|
||||
node peerId: 12D3KooWCKCeqLPSgMnDjyFsJuWqREDtKNHx1JEBiwaMXhCLNTRb
|
||||
uploading blueprint hex2int_converter to node 12D3KooWCKCeqLPSgMnDjyFsJuWqREDtKNHx1JEBiwaMXhCLNTRb via client 12D3KooWJLm7n3GpZasv5gsAkta8BYBKHHC19PZ6U8kzWNaabjNz
|
||||
creating service d291af92-1f94-41c6-aa8d-a7e8670f0ab2
|
||||
service id: d21b154d-6cf0-4cc7-95be-f95ba35ea528
|
||||
service created successfully
|
||||
mbp16~/localdev/fluence-examples/multi-service(multi-service|✚3…) %
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
mbp16~/localdev/fluence-examples/multi-service(multi-service|✚3…) % fldist new_service --env testnet -s BtN9ikmpcSRgBWgwLF9yoSZeyuzmYvc5Czyn8XRy514P -n extract_miner_address --ms artifacts/extract_miner_address.wasm:config/extract_miner_address_cfg.json --node 12D3KooWBSdm6TkqnEFrgBuSkpVE3dR1kr6952DsWQRNwJZjFZBv
|
||||
client seed: BtN9ikmpcSRgBWgwLF9yoSZeyuzmYvc5Czyn8XRy514P
|
||||
client peerId: 12D3KooWJLm7n3GpZasv5gsAkta8BYBKHHC19PZ6U8kzWNaabjNz
|
||||
node peerId: 12D3KooWBSdm6TkqnEFrgBuSkpVE3dR1kr6952DsWQRNwJZjFZBv
|
||||
uploading blueprint extract_miner_address to node 12D3KooWBSdm6TkqnEFrgBuSkpVE3dR1kr6952DsWQRNwJZjFZBv via client 12D3KooWJLm7n3GpZasv5gsAkta8BYBKHHC19PZ6U8kzWNaabjNz
|
||||
creating service 7697fdf2-e91c-4dd3-bdad-2aab553727ff
|
||||
service id: c49b9e98-8f54-4293-954f-ed35a2f891a4
|
||||
service created successfully
|
||||
|
||||
mbp16~/localdev/fluence-examples/multi-service(multi-service|✚3…) % fldist new_service --env testnet -s BtN9ikmpcSRgBWgwLF9yoSZeyuzmYvc5Czyn8XRy514P -n extract_miner_address --ms artifacts/extract_miner_address.wasm:config/extract_miner_address_cfg.json --node 12D3KooWF7gjXhQ4LaKj6j7ntxsPpGk34psdQicN2KNfBi9bFKXg
|
||||
client seed: BtN9ikmpcSRgBWgwLF9yoSZeyuzmYvc5Czyn8XRy514P
|
||||
client peerId: 12D3KooWJLm7n3GpZasv5gsAkta8BYBKHHC19PZ6U8kzWNaabjNz
|
||||
node peerId: 12D3KooWF7gjXhQ4LaKj6j7ntxsPpGk34psdQicN2KNfBi9bFKXg
|
||||
uploading blueprint extract_miner_address to node 12D3KooWF7gjXhQ4LaKj6j7ntxsPpGk34psdQicN2KNfBi9bFKXg via client 12D3KooWJLm7n3GpZasv5gsAkta8BYBKHHC19PZ6U8kzWNaabjNz
|
||||
creating service 8422a207-5ac6-4be0-81aa-e1035b0d0153
|
||||
service id: c7f959ca-7716-429f-9203-118fc67e420b
|
||||
service created successfully
|
||||
mbp16~/localdev/fluence-examples/multi-service(multi-service|✚3…) %
|
||||
|
60
multi-service/docs/block_getter_params.txt.old
Normal file
60
multi-service/docs/block_getter_params.txt.old
Normal file
@ -0,0 +1,60 @@
|
||||
mbp16~/localdev/fluence-examples/multi-service(multi-service|✚3…) % fldist new_service --env testnet -s BtN9ikmpcSRgBWgwLF9yoSZeyuzmYvc5Czyn8XRy514P -n eth_block_getters --ms artifacts/curl_adapter.wasm:curl_cfg.json artifacts/block_getter.wasm:block_getter_cfg.json --node 12D3KooWEXNUbCXooUwHrHBbrmjsrpHXoEphPwbjQXEGyzbqKnE9
|
||||
client seed: BtN9ikmpcSRgBWgwLF9yoSZeyuzmYvc5Czyn8XRy514P
|
||||
client peerId: 12D3KooWJLm7n3GpZasv5gsAkta8BYBKHHC19PZ6U8kzWNaabjNz
|
||||
node peerId: 12D3KooWEXNUbCXooUwHrHBbrmjsrpHXoEphPwbjQXEGyzbqKnE9
|
||||
uploading blueprint eth_block_getters to node 12D3KooWEXNUbCXooUwHrHBbrmjsrpHXoEphPwbjQXEGyzbqKnE9 via client 12D3KooWJLm7n3GpZasv5gsAkta8BYBKHHC19PZ6U8kzWNaabjNz
|
||||
creating service 05a5b09a-205e-4a33-9d5f-5afb5498749a
|
||||
service id: b7fa9b30-af88-471c-888a-8f4a5a9e7d9d
|
||||
service created successfully
|
||||
|
||||
|
||||
mbp16~/localdev/fluence-examples/multi-service(multi-service|✚3…) % fldist new_service --env testnet -s BtN9ikmpcSRgBWgwLF9yoSZeyuzmYvc5Czyn8XRy514P -n eth_block_getters --ms artifacts/curl_adapter.wasm:curl_cfg.json artifacts/block_getter.wasm:block_getter_cfg.json --node 12D3KooWHk9BjDQBUqnavciRPhAYFvqKBe4ZiPPvde7vDaqgn5er
|
||||
client seed: BtN9ikmpcSRgBWgwLF9yoSZeyuzmYvc5Czyn8XRy514P
|
||||
client peerId: 12D3KooWJLm7n3GpZasv5gsAkta8BYBKHHC19PZ6U8kzWNaabjNz
|
||||
node peerId: 12D3KooWHk9BjDQBUqnavciRPhAYFvqKBe4ZiPPvde7vDaqgn5er
|
||||
uploading blueprint eth_block_getters to node 12D3KooWHk9BjDQBUqnavciRPhAYFvqKBe4ZiPPvde7vDaqgn5er via client 12D3KooWJLm7n3GpZasv5gsAkta8BYBKHHC19PZ6U8kzWNaabjNz
|
||||
creating service 04ad020a-1f1d-447b-b114-84d01752e181
|
||||
service id: 98ebdf65-4153-41d6-b170-1f7a1c5ed2b1
|
||||
service created successfully
|
||||
mbp16~/localdev/fluence-examples/multi-service(multi-service|✚3…) %
|
||||
|
||||
|
||||
|
||||
mbp16~/localdev/fluence-examples/multi-service(multi-service|✚3…) % fldist new_service --env testnet -s BtN9ikmpcSRgBWgwLF9yoSZeyuzmYvc5Czyn8XRy514P -n eth_block_getters --ms artifacts/hex_converter.wasm:hex_converter_cfg.json --node 12D3KooWMhVpgfQxBLkQkJed8VFNvgN4iE6MD7xCybb1ZYWW2Gtz
|
||||
client seed: BtN9ikmpcSRgBWgwLF9yoSZeyuzmYvc5Czyn8XRy514P
|
||||
client peerId: 12D3KooWJLm7n3GpZasv5gsAkta8BYBKHHC19PZ6U8kzWNaabjNz
|
||||
node peerId: 12D3KooWMhVpgfQxBLkQkJed8VFNvgN4iE6MD7xCybb1ZYWW2Gtz
|
||||
uploading blueprint eth_block_getters to node 12D3KooWMhVpgfQxBLkQkJed8VFNvgN4iE6MD7xCybb1ZYWW2Gtz via client 12D3KooWJLm7n3GpZasv5gsAkta8BYBKHHC19PZ6U8kzWNaabjNz
|
||||
creating service 0bcf9eef-25e3-42a9-9efb-8a8462fe1814
|
||||
service id: 29bb30e4-2b01-46fc-845b-1acd983dc690
|
||||
service created successfully
|
||||
|
||||
mbp16~/localdev/fluence-examples/multi-service(multi-service|✚3…) % fldist new_service --env testnet -s BtN9ikmpcSRgBWgwLF9yoSZeyuzmYvc5Czyn8XRy514P -n eth_block_getters --ms artifacts/hex_converter.wasm:hex_converter_cfg.json --node 12D3KooWCKCeqLPSgMnDjyFsJuWqREDtKNHx1JEBiwaMXhCLNTRb
|
||||
client seed: BtN9ikmpcSRgBWgwLF9yoSZeyuzmYvc5Czyn8XRy514P
|
||||
client peerId: 12D3KooWJLm7n3GpZasv5gsAkta8BYBKHHC19PZ6U8kzWNaabjNz
|
||||
node peerId: 12D3KooWCKCeqLPSgMnDjyFsJuWqREDtKNHx1JEBiwaMXhCLNTRb
|
||||
uploading blueprint eth_block_getters to node 12D3KooWCKCeqLPSgMnDjyFsJuWqREDtKNHx1JEBiwaMXhCLNTRb via client 12D3KooWJLm7n3GpZasv5gsAkta8BYBKHHC19PZ6U8kzWNaabjNz
|
||||
creating service dcc2b852-4676-4f3b-b1d4-48bf859440e1
|
||||
service id: 44d82fb1-e6a2-4652-85f4-b1110083f79b
|
||||
service created successfully
|
||||
|
||||
|
||||
mbp16~/localdev/fluence-examples/multi-service(multi-service|✚3…) % fldist new_service --env testnet -s BtN9ikmpcSRgBWgwLF9yoSZeyuzmYvc5Czyn8XRy514P -n eth_block_getters --ms artifacts/extract_miner_address.wasm:extract_miner_address_cfg.json --node 12D3KooWBSdm6TkqnEFrgBuSkpVE3dR1kr6952DsWQRNwJZjFZBv
|
||||
client seed: BtN9ikmpcSRgBWgwLF9yoSZeyuzmYvc5Czyn8XRy514P
|
||||
client peerId: 12D3KooWJLm7n3GpZasv5gsAkta8BYBKHHC19PZ6U8kzWNaabjNz
|
||||
node peerId: 12D3KooWBSdm6TkqnEFrgBuSkpVE3dR1kr6952DsWQRNwJZjFZBv
|
||||
uploading blueprint eth_block_getters to node 12D3KooWBSdm6TkqnEFrgBuSkpVE3dR1kr6952DsWQRNwJZjFZBv via client 12D3KooWJLm7n3GpZasv5gsAkta8BYBKHHC19PZ6U8kzWNaabjNz
|
||||
creating service c146b1d6-7621-474c-9299-55bd0bbc0b55
|
||||
service id: 891a92f6-1c5c-459d-a8f5-d38add381a5f
|
||||
service created successfully
|
||||
|
||||
mbp16~/localdev/fluence-examples/multi-service(multi-service|✚3…) % fldist new_service --env testnet -s BtN9ikmpcSRgBWgwLF9yoSZeyuzmYvc5Czyn8XRy514P -n eth_block_getters --ms artifacts/extract_miner_address.wasm:extract_miner_address_cfg.json --node 12D3KooWF7gjXhQ4LaKj6j7ntxsPpGk34psdQicN2KNfBi9bFKXg
|
||||
client seed: BtN9ikmpcSRgBWgwLF9yoSZeyuzmYvc5Czyn8XRy514P
|
||||
client peerId: 12D3KooWJLm7n3GpZasv5gsAkta8BYBKHHC19PZ6U8kzWNaabjNz
|
||||
node peerId: 12D3KooWF7gjXhQ4LaKj6j7ntxsPpGk34psdQicN2KNfBi9bFKXg
|
||||
uploading blueprint eth_block_getters to node 12D3KooWF7gjXhQ4LaKj6j7ntxsPpGk34psdQicN2KNfBi9bFKXg via client 12D3KooWJLm7n3GpZasv5gsAkta8BYBKHHC19PZ6U8kzWNaabjNz
|
||||
creating service 0c93fe3c-8be2-4466-a1ad-f12aebfee872
|
||||
service id: d60cf6ee-5f2c-4726-8c70-953f7e7519b4
|
||||
service created successfully
|
||||
|
||||
|
179
multi-service/extract_miner_address/Cargo.lock
generated
Normal file
179
multi-service/extract_miner_address/Cargo.lock
generated
Normal file
@ -0,0 +1,179 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||
|
||||
[[package]]
|
||||
name = "extract_miner_address"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"fluence",
|
||||
"log",
|
||||
"serde_json",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fluence"
|
||||
version = "0.2.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "27d9a5e4292d7bbd809a0e968e3c3aacac91cbc5acab3e26ee1e1d726f0aab24"
|
||||
dependencies = [
|
||||
"fluence-sdk-macro",
|
||||
"fluence-sdk-main",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fluence-sdk-macro"
|
||||
version = "0.2.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ea1a7c75a617f827d1ba9a17b4d84e1565ab239915c63f5a85c41f89a9f1d4ba"
|
||||
dependencies = [
|
||||
"fluence-sdk-wit",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fluence-sdk-main"
|
||||
version = "0.2.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6edcc983f9517c1b6bf9f851ef27f2894a3159aaa4a2fb6c9deb2ae8ecb603fa"
|
||||
dependencies = [
|
||||
"fluence-sdk-macro",
|
||||
"log",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fluence-sdk-wit"
|
||||
version = "0.2.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b75dbdd0275160f3818db3218563d791e6c612b616cd3c5d6e66283f207f648d"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"syn",
|
||||
"uuid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "getrandom"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c9495705279e7140bf035dde1f6e750c162df8b625267cd52cc44e0b156732c8"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"wasi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "itoa"
|
||||
version = "0.4.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736"
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.86"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b7282d924be3275cec7f6756ff4121987bc6481325397dde6ba3e7802b1a8b1c"
|
||||
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.4.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.24"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71"
|
||||
dependencies = [
|
||||
"unicode-xid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ryu"
|
||||
version = "1.0.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e"
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.118"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "06c64263859d87aa2eb554587e2d23183398d617427327cf2b3d0ed8c69e4800"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.118"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c84d3526699cd55261af4b941e4e725444df67aa4f9e6a3564f18030d12672df"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_json"
|
||||
version = "1.0.64"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "799e97dc9fdae36a5c8b8f2cae9ce2ee9fdce2058c57a93e6099d919fd982f79"
|
||||
dependencies = [
|
||||
"itoa",
|
||||
"ryu",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "1.0.60"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c700597eca8a5a762beb35753ef6b94df201c81cca676604f547495a0d7f0081"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"unicode-xid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-xid"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564"
|
||||
|
||||
[[package]]
|
||||
name = "uuid"
|
||||
version = "0.8.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7"
|
||||
dependencies = [
|
||||
"getrandom",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasi"
|
||||
version = "0.10.2+wasi-snapshot-preview1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6"
|
12
multi-service/extract_miner_address/Cargo.toml
Normal file
12
multi-service/extract_miner_address/Cargo.toml
Normal file
@ -0,0 +1,12 @@
|
||||
[package]
|
||||
name = "extract_miner_address"
|
||||
version = "0.1.0"
|
||||
authors = ["boneyard93501 <4523011+boneyard93501@users.noreply.github.com>"]
|
||||
edition = "2018"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
fluence = { version = "=0.2.18", features = ["logger"]}
|
||||
log = "0.4.8"
|
||||
serde_json = "1.0.64"
|
17
multi-service/extract_miner_address/src/main.rs
Normal file
17
multi-service/extract_miner_address/src/main.rs
Normal file
@ -0,0 +1,17 @@
|
||||
use fluence::{fce, WasmLoggerBuilder};
|
||||
use serde_json;
|
||||
|
||||
fn main() {
|
||||
WasmLoggerBuilder::new().build().ok();
|
||||
}
|
||||
|
||||
|
||||
#[fce]
|
||||
pub fn extract_miner_address(json_string: String) -> String {
|
||||
let obj = serde_json::from_str::<serde_json::Value>(&json_string);
|
||||
match obj {
|
||||
Ok(x) => x["result"]["blockMiner"].to_string(),
|
||||
// Ok(x) => json_string,
|
||||
Err(_) => String::from("boo yah"),
|
||||
}
|
||||
}
|
1
multi-service/hex_converter/.gitignore
vendored
Normal file
1
multi-service/hex_converter/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/target
|
179
multi-service/hex_converter/Cargo.lock
generated
Normal file
179
multi-service/hex_converter/Cargo.lock
generated
Normal file
@ -0,0 +1,179 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||
|
||||
[[package]]
|
||||
name = "fluence"
|
||||
version = "0.2.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "27d9a5e4292d7bbd809a0e968e3c3aacac91cbc5acab3e26ee1e1d726f0aab24"
|
||||
dependencies = [
|
||||
"fluence-sdk-macro",
|
||||
"fluence-sdk-main",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fluence-sdk-macro"
|
||||
version = "0.2.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ea1a7c75a617f827d1ba9a17b4d84e1565ab239915c63f5a85c41f89a9f1d4ba"
|
||||
dependencies = [
|
||||
"fluence-sdk-wit",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fluence-sdk-main"
|
||||
version = "0.2.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6edcc983f9517c1b6bf9f851ef27f2894a3159aaa4a2fb6c9deb2ae8ecb603fa"
|
||||
dependencies = [
|
||||
"fluence-sdk-macro",
|
||||
"log",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fluence-sdk-wit"
|
||||
version = "0.2.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b75dbdd0275160f3818db3218563d791e6c612b616cd3c5d6e66283f207f648d"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"syn",
|
||||
"uuid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "getrandom"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c9495705279e7140bf035dde1f6e750c162df8b625267cd52cc44e0b156732c8"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"wasi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hex_converter"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"fluence",
|
||||
"log",
|
||||
"serde_json",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "itoa"
|
||||
version = "0.4.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736"
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.86"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b7282d924be3275cec7f6756ff4121987bc6481325397dde6ba3e7802b1a8b1c"
|
||||
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.4.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.24"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71"
|
||||
dependencies = [
|
||||
"unicode-xid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ryu"
|
||||
version = "1.0.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e"
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.118"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "06c64263859d87aa2eb554587e2d23183398d617427327cf2b3d0ed8c69e4800"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.118"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c84d3526699cd55261af4b941e4e725444df67aa4f9e6a3564f18030d12672df"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_json"
|
||||
version = "1.0.64"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "799e97dc9fdae36a5c8b8f2cae9ce2ee9fdce2058c57a93e6099d919fd982f79"
|
||||
dependencies = [
|
||||
"itoa",
|
||||
"ryu",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "1.0.60"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c700597eca8a5a762beb35753ef6b94df201c81cca676604f547495a0d7f0081"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"unicode-xid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-xid"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564"
|
||||
|
||||
[[package]]
|
||||
name = "uuid"
|
||||
version = "0.8.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7"
|
||||
dependencies = [
|
||||
"getrandom",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasi"
|
||||
version = "0.10.2+wasi-snapshot-preview1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6"
|
12
multi-service/hex_converter/Cargo.toml
Normal file
12
multi-service/hex_converter/Cargo.toml
Normal file
@ -0,0 +1,12 @@
|
||||
[package]
|
||||
name = "hex_converter"
|
||||
version = "0.1.0"
|
||||
authors = ["boneyard93501 <4523011+boneyard93501@users.noreply.github.com>"]
|
||||
edition = "2018"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
fluence = { version = "0.2.18", features = ["logger"]}
|
||||
log = "0.4.8"
|
||||
serde_json = "1.0.64"
|
43
multi-service/hex_converter/src/main.rs
Normal file
43
multi-service/hex_converter/src/main.rs
Normal file
@ -0,0 +1,43 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
use fluence::{fce, WasmLoggerBuilder};
|
||||
use serde_json;
|
||||
|
||||
fn main() {
|
||||
WasmLoggerBuilder::new().build().ok();
|
||||
}
|
||||
|
||||
#[fce]
|
||||
pub fn hex_to_int(data: String) -> u64 {
|
||||
if data.starts_with("0x") {
|
||||
let res = u64::from_str_radix(&data[2..], 16);
|
||||
if res.is_ok() {
|
||||
return res.unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
if data.contains("result") {
|
||||
let obj = serde_json::from_str::<serde_json::Value>(&data);
|
||||
let res = match obj {
|
||||
Ok(x) => { let res = x["result"].to_string(); u64::from_str_radix(&res[2..], 16).unwrap()},
|
||||
Err(_) => 0u64,
|
||||
};
|
||||
return res;
|
||||
}
|
||||
|
||||
0u64
|
||||
}
|
25
multi-service/scripts/build.sh
Executable file
25
multi-service/scripts/build.sh
Executable file
@ -0,0 +1,25 @@
|
||||
#!/bin/sh
|
||||
|
||||
mkdir -p artifacts
|
||||
|
||||
cd curl_adapter
|
||||
fce build --release
|
||||
cd ..
|
||||
|
||||
cd hex_converter
|
||||
fce build --release
|
||||
cd ..
|
||||
|
||||
cd block_getter
|
||||
fce build --release
|
||||
cd ..
|
||||
|
||||
cd extract_miner_address
|
||||
fce build --release
|
||||
cd ..
|
||||
|
||||
rm -f artifacts/*
|
||||
cp curl_adapter/target/wasm32-wasi/release/curl_adapter.wasm artifacts/
|
||||
cp hex_converter/target/wasm32-wasi/release/hex_converter.wasm artifacts/
|
||||
cp block_getter/target/wasm32-wasi/release/block_getter.wasm artifacts/
|
||||
cp extract_miner_address/target/wasm32-wasi/release/extract_miner_address.wasm artifacts/
|
20
multi-service/scripts/deploy.sh
Normal file
20
multi-service/scripts/deploy.sh
Normal file
@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# check `fcli` and `fldist` tools are installed or install them
|
||||
(command -v fce || cargo install fcli) >/dev/null
|
||||
(command -v fldist || npm install -g @fluencelabs/fldist) >/dev/null
|
||||
|
||||
# build .wasm
|
||||
(
|
||||
cd backend
|
||||
fce build --release
|
||||
)
|
||||
|
||||
# check it .wasm was built
|
||||
WASM="backend/target/wasm32-wasi/release/curl_template.wasm"
|
||||
test -f "$WASM" || echo >&2 "Couldn't find $WASM"
|
||||
|
||||
# create a service from that .wasm
|
||||
CONFIG="$(pwd)/backend/BackendConfig.json"
|
||||
fldist new_service --modules "$WASM:$CONFIG" --name curl_template
|
178
multi-service/simple_range_func/Cargo.lock
generated
Normal file
178
multi-service/simple_range_func/Cargo.lock
generated
Normal file
@ -0,0 +1,178 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||
|
||||
[[package]]
|
||||
name = "fluence"
|
||||
version = "0.2.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "27d9a5e4292d7bbd809a0e968e3c3aacac91cbc5acab3e26ee1e1d726f0aab24"
|
||||
dependencies = [
|
||||
"fluence-sdk-macro",
|
||||
"fluence-sdk-main",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fluence-sdk-macro"
|
||||
version = "0.2.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ea1a7c75a617f827d1ba9a17b4d84e1565ab239915c63f5a85c41f89a9f1d4ba"
|
||||
dependencies = [
|
||||
"fluence-sdk-wit",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fluence-sdk-main"
|
||||
version = "0.2.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6edcc983f9517c1b6bf9f851ef27f2894a3159aaa4a2fb6c9deb2ae8ecb603fa"
|
||||
dependencies = [
|
||||
"fluence-sdk-macro",
|
||||
"log",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fluence-sdk-wit"
|
||||
version = "0.2.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b75dbdd0275160f3818db3218563d791e6c612b616cd3c5d6e66283f207f648d"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"syn",
|
||||
"uuid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "getrandom"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c9495705279e7140bf035dde1f6e750c162df8b625267cd52cc44e0b156732c8"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"wasi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "itoa"
|
||||
version = "0.4.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736"
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.86"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b7282d924be3275cec7f6756ff4121987bc6481325397dde6ba3e7802b1a8b1c"
|
||||
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.4.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.24"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71"
|
||||
dependencies = [
|
||||
"unicode-xid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ryu"
|
||||
version = "1.0.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e"
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.118"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "06c64263859d87aa2eb554587e2d23183398d617427327cf2b3d0ed8c69e4800"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.118"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c84d3526699cd55261af4b941e4e725444df67aa4f9e6a3564f18030d12672df"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_json"
|
||||
version = "1.0.64"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "799e97dc9fdae36a5c8b8f2cae9ce2ee9fdce2058c57a93e6099d919fd982f79"
|
||||
dependencies = [
|
||||
"itoa",
|
||||
"ryu",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "simple_range_list"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"fluence",
|
||||
"log",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "1.0.60"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c700597eca8a5a762beb35753ef6b94df201c81cca676604f547495a0d7f0081"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"unicode-xid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-xid"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564"
|
||||
|
||||
[[package]]
|
||||
name = "uuid"
|
||||
version = "0.8.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7"
|
||||
dependencies = [
|
||||
"getrandom",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasi"
|
||||
version = "0.10.2+wasi-snapshot-preview1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6"
|
9
multi-service/simple_range_func/Cargo.toml
Normal file
9
multi-service/simple_range_func/Cargo.toml
Normal file
@ -0,0 +1,9 @@
|
||||
[package]
|
||||
name = "simple_range_list"
|
||||
version = "0.1.0"
|
||||
authors = ["Fluence Team"]
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
fluence = { version = "0.2.18", features = ["logger"]}
|
||||
log = "0.4.8"
|
13
multi-service/simple_range_func/src/main.rs
Normal file
13
multi-service/simple_range_func/src/main.rs
Normal file
@ -0,0 +1,13 @@
|
||||
use fluence::fce;
|
||||
|
||||
fn main() {}
|
||||
|
||||
#[fce]
|
||||
fn simple_range_list(start: i64, step: u32, n: u32) -> Vec<i64> {
|
||||
let mut result: Vec<i64> = Vec::new();
|
||||
let stop = start - n as i64;
|
||||
for x in (start..stop).step_by(step as usize) {
|
||||
result.push(x);
|
||||
}
|
||||
result
|
||||
}
|
Loading…
Reference in New Issue
Block a user