mirror of
https://github.com/fluencelabs/examples
synced 2025-06-26 00:01:33 +00:00
add FCE examples
This commit is contained in:
7
call_parameters/.gitignore
vendored
Normal file
7
call_parameters/.gitignore
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
.DS_Store
|
||||
.repl_history
|
||||
/target
|
||||
**/**.bak
|
||||
**/**.bk
|
||||
/artifacts
|
||||
keypair.json
|
13
call_parameters/Cargo.toml
Normal file
13
call_parameters/Cargo.toml
Normal 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"
|
6
call_parameters/Config.toml
Normal file
6
call_parameters/Config.toml
Normal 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
7
call_parameters/build.sh
Executable file
@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
cargo update
|
||||
fce build --release
|
||||
|
||||
rm -f artifacts/*
|
||||
cp ../../target/wasm32-wasi/release/call_parameters.wasm artifacts/
|
35
call_parameters/src/main.rs
Normal file
35
call_parameters/src/main.rs
Normal 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
|
||||
)
|
||||
}
|
Reference in New Issue
Block a user