add FCE examples

This commit is contained in:
boneyard93501
2021-02-25 15:48:56 -06:00
parent e489bf1673
commit ba4a62bd72
42 changed files with 1028 additions and 1 deletions

7
call_parameters/.gitignore vendored Normal file
View File

@ -0,0 +1,7 @@
.DS_Store
.repl_history
/target
**/**.bak
**/**.bk
/artifacts
keypair.json

View File

@ -0,0 +1,13 @@
[package]
name = "call_parameters"
version = "0.1.0"
authors = ["Fluence Labs"]
edition = "2018"
publish = false
[[bin]]
name = "call_parameters"
path = "src/main.rs"
[dependencies]
fluence = "=0.3.2"

View File

@ -0,0 +1,6 @@
modules_dir = "artifacts/"
[[module]]
name = "call_parameters"
mem_pages_count = 1
logger_enabled = false

7
call_parameters/build.sh Executable file
View File

@ -0,0 +1,7 @@
#!/bin/sh
cargo update
fce build --release
rm -f artifacts/*
cp ../../target/wasm32-wasi/release/call_parameters.wasm artifacts/

View File

@ -0,0 +1,35 @@
/*
* Copyright 2020 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.
*/
#[cfg(target_arch = "wasm32")]
use fluence::fce;
pub fn main() {}
#[fce]
#[cfg(target_arch = "wasm32")]
pub fn call_parameters() -> String {
let cp = fluence::get_call_parameters();
format!(
"{}\n{}\n{}\n{}\n{}\n{:?}",
cp.init_peer_id,
cp.service_id,
cp.service_creator_peer_id,
cp.host_id,
cp.particle_id,
cp.tetraplets
)
}