update to marine, marine-test, bump versions

This commit is contained in:
boneyard93501 2021-06-13 15:14:18 -05:00
parent 460fb44e3e
commit 15a811484f
8 changed files with 17 additions and 19 deletions

View File

@ -2,11 +2,11 @@ modules_dir = "artifacts/"
[[module]]
name = "curl_adapter"
# logger_enabled = false
logger_enabled = true
[module.mounted_binaries]
curl = "/usr/bin/curl"
[[module]]
name = "ether_price_getter"
# logger_enabled = true
logger_enabled = true

View File

@ -1,16 +1,14 @@
#!/usr/bin/env bash
set -o errexit -o nounset -o pipefail
mkdir -p artifacts
cd curl_adapter
fce build --release
cd ..
cd ether_price_getter
fce build --release
marine build --release
cd ../ether_price_getter
marine build --release
cd ..
mkdir -p artifacts
rm -f artifacts/*.wasm
cp curl_adapter/target/wasm32-wasi/release/curl_adapter.wasm artifacts/
cp ether_price_getter/target/wasm32-wasi/release/ether_price_getter.wasm artifacts/

View File

@ -10,5 +10,5 @@ path = "src/main.rs"
name = "curl_adapter"
[dependencies]
fluence = { version = "=0.6.2", features = ["logger"]}
fluence = { version = "=0.6.9", features = ["logger"]}
log = "0.4.8"

View File

@ -15,7 +15,7 @@
*/
#![allow(improper_ctypes)]
use fluence::fce;
use fluence::marine;
use fluence::module_manifest;
use fluence::MountedBinaryResult;
use fluence::WasmLoggerBuilder;
@ -26,14 +26,14 @@ fn main() {
WasmLoggerBuilder::new().build().unwrap();
}
#[fce]
#[marine]
pub fn curl_request(curl_cmd: Vec<String>) -> MountedBinaryResult {
let response = curl(curl_cmd);
response
}
// mounted_binaries are available to import like this:
#[fce]
#[marine]
#[link(wasm_import_module = "host")]
extern "C" {
pub fn curl(cmd: Vec<String>) -> MountedBinaryResult;

View File

@ -10,6 +10,6 @@ name = "ether_price_getter"
path = "src/main.rs"
[dependencies]
fluence = { version = "=0.6.2", features = ["logger"]}
fluence = { version = "=0.6.9", features = ["logger"]}
log = "0.4.8"
fstrings = { version="0.2.3" }

View File

@ -15,12 +15,12 @@
*/
use crate::curl_request;
use fluence::fce;
use fluence::marine;
static URL_LATEST: &'static str =
"https://pro-api.coinmarketcap.com/v1/cryptocurrency/quotes/latest";
#[fce]
#[marine]
pub fn ether_price_getter(api_key: String, currency_symbol: String) -> String {
let curl_args = f!(
r#"-H "X-CMC_PRO_API_KEY: {api_key}" -H "Accept: application/json" -d "symbol=ETH&convert={currency_symbol}" -G {URL_LATEST}"#

View File

@ -16,7 +16,7 @@
use crate::jsonrpc_helpers::JSON_RPC;
use crate::Result;
use fluence::fce;
use fluence::marine;
use serde_json::Value;
#[fce]

View File

@ -24,7 +24,7 @@
#[macro_use]
extern crate fstrings;
use fluence::fce;
use fluence::marine;
use fluence::module_manifest;
use fluence::MountedBinaryResult;
use fluence::WasmLoggerBuilder;
@ -40,7 +40,7 @@ pub fn main() {
WasmLoggerBuilder::new().build().ok();
}
#[fce]
#[marine]
#[link(wasm_import_module = "curl_adapter")]
extern "C" {
pub fn curl_request(url: Vec<String>) -> MountedBinaryResult;