Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(api) merge test programs #1670

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 11 additions & 43 deletions api/programs/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 2 additions & 7 deletions api/programs/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
[workspace]
resolver = "2"

members = ["test-gas", "test-waitlist", "test-meta", "empty"]

[profile.release]
lto = true
opt-level = 's'
members = ["test-meta-union", 'test-union']
Zewasik marked this conversation as resolved.
Show resolved Hide resolved

[workspace.dependencies]
gmeta = { git = "https://github.com/gear-tech/gear.git" }
gstd = { git = "https://github.com/gear-tech/gear.git" }
scale-info = { version = "2.11.0", default-features = false, features = [
"derive",
Expand All @@ -19,5 +16,3 @@ codec = { package = "parity-scale-codec", version = "3.6.9", default-features =
gear-wasm-builder = { git = "https://github.com/gear-tech/gear.git", features = [
"metawasm",
] }
gmeta = { git = "https://github.com/gear-tech/gear.git" }
primitive-types = { version = "0.12.2", default-features = false }
8 changes: 0 additions & 8 deletions api/programs/empty/src/lib.rs

This file was deleted.

15 changes: 0 additions & 15 deletions api/programs/test-gas/Cargo.toml

This file was deleted.

10 changes: 0 additions & 10 deletions api/programs/test-gas/io/Cargo.toml

This file was deleted.

25 changes: 0 additions & 25 deletions api/programs/test-gas/io/src/lib.rs

This file was deleted.

30 changes: 0 additions & 30 deletions api/programs/test-gas/src/lib.rs

This file was deleted.

30 changes: 0 additions & 30 deletions api/programs/test-gas/src/wasm.rs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
[package]
name = "test-meta"
name = "test-meta-union"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
gstd.workspace = true
scale-info.workspace = true
codec.workspace = true
test-meta-io = { path = "io" }
test-union-io = { path = "io" }
test-meta-state-v1 = { path = "state-v1", default-features = false, optional = true }
test-meta-state-v2 = { path = "state-v2", default-features = false, optional = true }

[build-dependencies]
test-meta-io = { path = "io" }
gear-wasm-builder.workspace = true
test-union-io = { path = "io" }

[features]
default = ["std"]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use test_gas_io::ProgramMetadata;
use test_union_io::ProgramMetadata;

fn main() {
gear_wasm_builder::build_with_metadata::<ProgramMetadata>();
}
}
11 changes: 11 additions & 0 deletions api/programs/test-meta-union/io/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[package]
name = "test-union-io"
version = "0.1.0"
edition = "2021"

[dependencies]
primitive-types = { version = "0.12.2", default-features = false }
gmeta = { workspace = true, features = ["codegen"] }
gstd.workspace = true
scale-info.workspace = true
codec.workspace = true
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

extern crate alloc;

use alloc::string::String;
use alloc::{string::String, vec::Vec};
use codec::{Decode, Encode};
use gmeta::{InOut, Metadata};
use gstd::{
Expand All @@ -18,8 +18,8 @@ pub struct ProgramMetadata;
impl Metadata for ProgramMetadata {
type Init = InOut<BTreeSet<u8>, BTreeMap<String, u8>>;
type Handle = InOut<Action, String>;
type Reply = ReplyType;
type Others = InOut<(), ()>;
type Reply = String;
type Signal = H256;
type State = InOut<Option<u32>, Vec<Wallet>>;
}
Expand All @@ -40,8 +40,7 @@ pub enum Action {
Two(Vec<X>),
Three { field1: Result<(u8, String), i32> },
Four(SomeStruct<u128, u8>),
Five(SomeStruct<String, X>),
Six(ActorId, EmptyStruct),
Input(String),
}

#[derive(TypeInfo, Encode, Decode, Clone)]
Expand Down Expand Up @@ -72,3 +71,14 @@ pub enum State {
DappMeta(String),
Data(Vec<Wallet>),
}

#[derive(TypeInfo, Decode, Encode)]
pub struct InputStruct {
pub input: String,
}

#[derive(TypeInfo, Decode, Encode)]
pub enum ReplyType {
TextReply(String),
StructReply(InputStruct),
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#![no_std]

// Reexport of types
pub use test_meta_io::*;
pub use test_union_io::*;

// For wasm compilation
#[cfg(not(feature = "std"))]
Expand Down
Loading
Loading