This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use crate::types::{Invocation, InvocationResponse}; | |
use crate::Result; | |
use actix::prelude::*; | |
/// The trait that must be implemented by all Wasmcloud middleware | |
pub trait Middleware: Send + Sync { | |
fn pre_invoke(&self, inv: Invocation) -> Result<Invocation>; | |
fn post_invoke(&self, response: InvocationResponse) -> Result<InvocationResponse>; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use wasmtime::{Callable, Engine, Extern, FuncType, HostRef, Module, Store, Trap, Val, ValType}; | |
// The goal of this code is that I need a function invoked by the guest wasm module on the | |
// host to be able to access the memory of that instance, and to be able to call additional | |
// functions on that instance in response. | |
// | |
// When I use wasmer, the call signature includes a Ctx, which allows me to manipulate the instance | |
// memory and call functions. | |
struct GuestCallable {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[package] | |
name = "autodidaddict/echo-example" | |
version = "0.0.3" | |
description = "An example echo server built for Waxosuit" | |
license = "Apache-2" | |
readme = "README.md" | |
repository = "https://github.com/waxosuit/echo-example" | |
homepage = "https://waxosuit.io/getstarted" | |
[[module]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extern crate wascap_guest as guest; | |
use serde::Serialize; | |
use guest::prelude::*; | |
use std::collections::HashMap; | |
call_handler!(handle_call); | |
pub fn handle_call(ctx: &CapabilitiesContext, cmd: &Command) -> Result<Event> { | |
match cmd.payload { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extern crate wascap_guest as guest; | |
#[macro_use] | |
extern crate serde_derive; | |
use guest::prelude::*; | |
call_handler!(handle_call); | |
pub fn handle_call(ctx: &CapabilitiesContext, operation: &str, msg: &[u8]) -> CallResult { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ nsc init --name wasmcraft --account-name gamecore --user-name coreuser | |
Project initialization generated NKeys. These keys should be treated | |
as secrets. You can move the directory, and reference them from the | |
`$NKEYS_PATH` environment variable. To remind yourself of current | |
environment configuration type `nsc env` while in a project directory. | |
╭──────────────────────────────────────────────────────────────────────────────────────────────────────╮ | |
│ Generated NKeys Location │ | |
├────────────────────┬────────────┬────────────────────────────────────────────────────────────────────┤ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
operator = ./wasmcraft_operator.jwt | |
system_account = "ACFTXEBWFTAVV5OX4QAXOXJN3AZL54SWNFKTVBK7EXYMYBGP24G3LHDJ" | |
resolver = memory | |
resolver_preload = { | |
# gamecore account | |
"ACFTXEBWFTAVV5OX4QAXOXJN3AZL54SWNFKTVBK7EXYMYBGP24G3LHDJ" : "eyJ0eXAiOiJqd3QiLCJhbGciOiJlZDI1NTE5In0.eyJqdGkiOiJGT1BNNlpaUUZRTlpJRUhDTUZVSkkzMldOWlFJRlRZRkRLMkg2Rks2QVRDM0hGU0RRRE1RIiwiaWF0IjoxNTU1NTk5MDU3LCJpc3MiOiJPQVRBTVpOQ0U1NzVOMktCQ1M3Qjc0SE9OR1ZCRVpGSlBGUkFQTTQ3WFdDQ1pHM0xNU0k2WExBNCIsIm5hbWUiOiJnYW1lY29yZSIsInN1YiI6IkFDRlRYRUJXRlRBVlY1T1g0UUFYT1hKTjNBWkw1NFNXTkZLVFZCSzdFWFlNWUJHUDI0RzNMSERKIiwidHlwZSI6ImFjY291bnQiLCJuYXRzIjp7ImxpbWl0cyI6eyJzdWJzIjotMSwiY29ubiI6LTEsImltcG9ydHMiOi0xLCJleHBvcnRzIjotMSwiZGF0YSI6LTEsInBheWxvYWQiOi0xLCJ3aWxkY2FyZHMiOnRydWV9fX0.nEANl4mr93oxXZiDzZpgqi-CfktGFssv4fsGTwurl9OP7yOK2XDE-0NSVwUjw2uFQmxSA3KEaEJ5koV-ik3UCw" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"attacker" : { | |
"dice": { | |
"d100": 62 | |
}, | |
"weapon_id": "sword" | |
}, | |
"defender": { | |
"dice": { | |
"d100" : 80 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package combat | |
import input.attacker as attacker | |
import input.defender as defender | |
import data.armor.mitigation_matrix as mitmat | |
armor_classes = { k | mitmat[k] } | |
all_weapon_ids = { w | data.weapons.stats[w] } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"stats" : { | |
"sword" : { | |
"damage_class": "slashing", | |
"base_damage": 50 | |
} | |
} | |
} |
NewerOlder