diff --git a/Cargo.lock b/Cargo.lock index 6c0858f3f07..ffccfffea12 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1214,7 +1214,7 @@ dependencies = [ [[package]] name = "fuel-core" -version = "0.1.1" +version = "0.1.2" dependencies = [ "async-graphql", "axum", @@ -1254,7 +1254,7 @@ dependencies = [ [[package]] name = "fuel-gql-client" -version = "0.1.1" +version = "0.1.2" dependencies = [ "chrono", "cynic", diff --git a/fuel-client/Cargo.toml b/fuel-client/Cargo.toml index 5dde238dd47..ad6efb86595 100644 --- a/fuel-client/Cargo.toml +++ b/fuel-client/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "fuel-gql-client" -version = "0.1.1" +version = "0.1.2" authors = ["Fuel Labs "] categories = ["concurrency", "cryptography::cryptocurrencies", "emulators"] edition = "2021" diff --git a/assets/schema.sdl b/fuel-client/assets/schema.sdl similarity index 100% rename from assets/schema.sdl rename to fuel-client/assets/schema.sdl diff --git a/fuel-client/build.rs b/fuel-client/build.rs index d14f094c222..168a5b39637 100644 --- a/fuel-client/build.rs +++ b/fuel-client/build.rs @@ -5,15 +5,11 @@ use std::io::prelude::*; use std::path::PathBuf; fn main() { - println!("cargo:rerun-if-changed=../fuel-core/src/schema"); + println!("cargo:rerun-if-changed=./assets/debugAdapterProtocol.json"); let path = env::var("CARGO_MANIFEST_DIR") .map(PathBuf::from) - .map(|p| { - p.parent() - .expect("Failed to uproot") - .join("fuel-client/assets/debugAdapterProtocol.json") - }) + .map(|p| p.join("assets/debugAdapterProtocol.json")) .expect("Failed to fetch JSON schema"); let json = fs::read_to_string(&path).expect("Failed to parse JSON from schema"); diff --git a/fuel-client/src/client/schema.rs b/fuel-client/src/client/schema.rs index a62f357c777..4ad4f5618ea 100644 --- a/fuel-client/src/client/schema.rs +++ b/fuel-client/src/client/schema.rs @@ -1,7 +1,7 @@ // this is the format cynic expects #[allow(clippy::module_inception)] pub mod schema { - cynic::use_schema!("../assets/schema.sdl"); + cynic::use_schema!("./assets/schema.sdl"); } use hex::FromHexError; @@ -19,13 +19,13 @@ pub mod primitives; pub mod tx; #[derive(cynic::QueryFragment, Debug)] -#[cynic(schema_path = "../assets/schema.sdl", graphql_type = "Query")] +#[cynic(schema_path = "./assets/schema.sdl", graphql_type = "Query")] pub struct Health { pub health: bool, } #[derive(cynic::QueryFragment, Debug)] -#[cynic(schema_path = "../assets/schema.sdl", graphql_type = "Mutation")] +#[cynic(schema_path = "./assets/schema.sdl", graphql_type = "Mutation")] pub struct StartSession { pub start_session: cynic::Id, } @@ -37,7 +37,7 @@ pub struct IdArg { #[derive(cynic::QueryFragment, Debug)] #[cynic( - schema_path = "../assets/schema.sdl", + schema_path = "./assets/schema.sdl", graphql_type = "Mutation", argument_struct = "IdArg" )] @@ -48,7 +48,7 @@ pub struct EndSession { #[derive(cynic::QueryFragment, Debug)] #[cynic( - schema_path = "../assets/schema.sdl", + schema_path = "./assets/schema.sdl", graphql_type = "Mutation", argument_struct = "IdArg" )] @@ -65,7 +65,7 @@ pub struct ExecuteArgs { #[derive(cynic::QueryFragment, Debug)] #[cynic( - schema_path = "../assets/schema.sdl", + schema_path = "./assets/schema.sdl", graphql_type = "Mutation", argument_struct = "ExecuteArgs" )] @@ -82,7 +82,7 @@ pub struct RegisterArgs { #[derive(cynic::QueryFragment, Debug)] #[cynic( - schema_path = "../assets/schema.sdl", + schema_path = "./assets/schema.sdl", graphql_type = "Query", argument_struct = "RegisterArgs" )] @@ -100,7 +100,7 @@ pub struct MemoryArgs { #[derive(cynic::QueryFragment, Debug)] #[cynic( - schema_path = "../assets/schema.sdl", + schema_path = "./assets/schema.sdl", graphql_type = "Query", argument_struct = "MemoryArgs" )] @@ -124,7 +124,7 @@ pub struct ConnectionArgs { } #[derive(cynic::QueryFragment, Debug)] -#[cynic(schema_path = "../assets/schema.sdl")] +#[cynic(schema_path = "./assets/schema.sdl")] pub struct PageInfo { pub end_cursor: Option, pub has_next_page: bool, diff --git a/fuel-client/src/client/schema/block.rs b/fuel-client/src/client/schema/block.rs index bea73a5c791..4f23ca9f076 100644 --- a/fuel-client/src/client/schema/block.rs +++ b/fuel-client/src/client/schema/block.rs @@ -11,7 +11,7 @@ pub struct BlockByIdArgs { #[derive(cynic::QueryFragment, Debug)] #[cynic( - schema_path = "../assets/schema.sdl", + schema_path = "./assets/schema.sdl", graphql_type = "Query", argument_struct = "BlockByIdArgs" )] @@ -22,7 +22,7 @@ pub struct BlockByIdQuery { #[derive(cynic::QueryFragment, Debug)] #[cynic( - schema_path = "../assets/schema.sdl", + schema_path = "./assets/schema.sdl", graphql_type = "Query", argument_struct = "ConnectionArgs" )] @@ -32,7 +32,7 @@ pub struct BlocksQuery { } #[derive(cynic::QueryFragment, Debug)] -#[cynic(schema_path = "../assets/schema.sdl")] +#[cynic(schema_path = "./assets/schema.sdl")] pub struct BlockConnection { pub edges: Option>>, pub page_info: PageInfo, @@ -53,14 +53,14 @@ impl From for PaginatedResult { } #[derive(cynic::QueryFragment, Debug)] -#[cynic(schema_path = "../assets/schema.sdl")] +#[cynic(schema_path = "./assets/schema.sdl")] pub struct BlockEdge { pub cursor: String, pub node: Block, } #[derive(cynic::QueryFragment, Debug)] -#[cynic(schema_path = "../assets/schema.sdl")] +#[cynic(schema_path = "./assets/schema.sdl")] pub struct Block { pub height: U64, pub id: HexString256, diff --git a/fuel-client/src/client/schema/chain.rs b/fuel-client/src/client/schema/chain.rs index 25dd647475c..f02e2fedaac 100644 --- a/fuel-client/src/client/schema/chain.rs +++ b/fuel-client/src/client/schema/chain.rs @@ -1,13 +1,13 @@ use crate::client::schema::{block::Block, schema, U64}; #[derive(cynic::QueryFragment, Debug)] -#[cynic(schema_path = "../assets/schema.sdl", graphql_type = "Query")] +#[cynic(schema_path = "./assets/schema.sdl", graphql_type = "Query")] pub struct ChainQuery { pub chain: ChainInfo, } #[derive(cynic::QueryFragment, Debug)] -#[cynic(schema_path = "../assets/schema.sdl")] +#[cynic(schema_path = "./assets/schema.sdl")] pub struct ChainInfo { pub base_chain_height: U64, pub name: String, diff --git a/fuel-client/src/client/schema/coin.rs b/fuel-client/src/client/schema/coin.rs index b5227ff0d74..9e0e2154920 100644 --- a/fuel-client/src/client/schema/coin.rs +++ b/fuel-client/src/client/schema/coin.rs @@ -8,7 +8,7 @@ pub struct CoinByIdArgs { #[derive(cynic::QueryFragment, Debug)] #[cynic( - schema_path = "../assets/schema.sdl", + schema_path = "./assets/schema.sdl", graphql_type = "Query", argument_struct = "CoinByIdArgs" )] @@ -55,7 +55,7 @@ impl From<(HexString256, PaginationRequest)> for CoinsByOwnerConnectionA #[derive(cynic::QueryFragment, Debug)] #[cynic( - schema_path = "../assets/schema.sdl", + schema_path = "./assets/schema.sdl", graphql_type = "Query", argument_struct = "CoinsByOwnerConnectionArgs" )] @@ -65,7 +65,7 @@ pub struct CoinsQuery { } #[derive(cynic::QueryFragment, Debug)] -#[cynic(schema_path = "../assets/schema.sdl")] +#[cynic(schema_path = "./assets/schema.sdl")] pub struct CoinConnection { pub edges: Option>>, pub page_info: PageInfo, @@ -86,14 +86,14 @@ impl From for PaginatedResult { } #[derive(cynic::QueryFragment, Debug)] -#[cynic(schema_path = "../assets/schema.sdl")] +#[cynic(schema_path = "./assets/schema.sdl")] pub struct CoinEdge { pub cursor: String, pub node: Coin, } #[derive(cynic::QueryFragment, Debug)] -#[cynic(schema_path = "../assets/schema.sdl")] +#[cynic(schema_path = "./assets/schema.sdl")] pub struct Coin { pub amount: U64, pub block_created: U64, @@ -105,7 +105,7 @@ pub struct Coin { } #[derive(cynic::Enum, Clone, Copy, Debug)] -#[cynic(schema_path = "../assets/schema.sdl")] +#[cynic(schema_path = "./assets/schema.sdl")] pub enum CoinStatus { Unspent, Spent, diff --git a/fuel-client/src/client/schema/tx.rs b/fuel-client/src/client/schema/tx.rs index 37b4ebeba2e..17ccef981e4 100644 --- a/fuel-client/src/client/schema/tx.rs +++ b/fuel-client/src/client/schema/tx.rs @@ -13,7 +13,7 @@ pub struct TxIdArgs { /// Retrieves the transaction in opaque form #[derive(cynic::QueryFragment, Debug)] #[cynic( - schema_path = "../assets/schema.sdl", + schema_path = "./assets/schema.sdl", graphql_type = "Query", argument_struct = "TxIdArgs" )] @@ -24,7 +24,7 @@ pub struct TransactionQuery { #[derive(cynic::QueryFragment, Debug)] #[cynic( - schema_path = "../assets/schema.sdl", + schema_path = "./assets/schema.sdl", graphql_type = "Query", argument_struct = "ConnectionArgs" )] @@ -34,7 +34,7 @@ pub struct TransactionsQuery { } #[derive(cynic::QueryFragment, Debug)] -#[cynic(schema_path = "../assets/schema.sdl")] +#[cynic(schema_path = "./assets/schema.sdl")] pub struct TransactionConnection { pub edges: Option>>, pub page_info: PageInfo, @@ -59,14 +59,14 @@ impl TryFrom for PaginatedResult>, @@ -83,7 +83,7 @@ impl TryFrom for fuel_tx::Transaction { } #[derive(cynic::QueryFragment, Debug)] -#[cynic(graphql_type = "Receipt", schema_path = "../assets/schema.sdl")] +#[cynic(graphql_type = "Receipt", schema_path = "./assets/schema.sdl")] pub struct OpaqueReceipt { pub raw_payload: HexString, } @@ -100,7 +100,7 @@ impl TryFrom for fuel_tx::Receipt { #[allow(clippy::enum_variant_names)] #[derive(cynic::InlineFragments, Debug)] -#[cynic(schema_path = "../assets/schema.sdl")] +#[cynic(schema_path = "./assets/schema.sdl")] pub enum TransactionStatus { SubmittedStatus(SubmittedStatus), SuccessStatus(SuccessStatus), @@ -108,13 +108,13 @@ pub enum TransactionStatus { } #[derive(cynic::QueryFragment, Debug)] -#[cynic(schema_path = "../assets/schema.sdl")] +#[cynic(schema_path = "./assets/schema.sdl")] pub struct SubmittedStatus { pub time: super::DateTime, } #[derive(cynic::QueryFragment, Debug)] -#[cynic(schema_path = "../assets/schema.sdl")] +#[cynic(schema_path = "./assets/schema.sdl")] pub struct SuccessStatus { pub block_id: HexString256, pub time: super::DateTime, @@ -122,7 +122,7 @@ pub struct SuccessStatus { } #[derive(cynic::QueryFragment, Debug)] -#[cynic(schema_path = "../assets/schema.sdl")] +#[cynic(schema_path = "./assets/schema.sdl")] pub struct FailureStatus { pub block_id: HexString256, pub time: super::DateTime, @@ -167,7 +167,7 @@ impl From<(HexString256, PaginationRequest)> for TransactionsByOwnerConn #[derive(cynic::QueryFragment, Debug)] #[cynic( - schema_path = "../assets/schema.sdl", + schema_path = "./assets/schema.sdl", graphql_type = "Query", argument_struct = "TransactionsByOwnerConnectionArgs" )] @@ -185,7 +185,7 @@ pub struct TxArg { #[derive(cynic::QueryFragment, Debug)] #[cynic( - schema_path = "../assets/schema.sdl", + schema_path = "./assets/schema.sdl", graphql_type = "Mutation", argument_struct = "TxArg" )] @@ -196,7 +196,7 @@ pub struct DryRun { #[derive(cynic::QueryFragment, Debug)] #[cynic( - schema_path = "../assets/schema.sdl", + schema_path = "./assets/schema.sdl", graphql_type = "Mutation", argument_struct = "TxArg" )] diff --git a/fuel-client/src/client/schema/tx/tests/transparent_receipt.rs b/fuel-client/src/client/schema/tx/tests/transparent_receipt.rs index e987eb1de5c..52dfaeb9a5b 100644 --- a/fuel-client/src/client/schema/tx/tests/transparent_receipt.rs +++ b/fuel-client/src/client/schema/tx/tests/transparent_receipt.rs @@ -4,7 +4,7 @@ use crate::client::schema::{ use fuel_types::Word; #[derive(cynic::QueryFragment, Debug)] -#[cynic(schema_path = "../assets/schema.sdl")] +#[cynic(schema_path = "./assets/schema.sdl")] pub struct Receipt { pub a: Option, pub b: Option, @@ -32,7 +32,7 @@ pub struct Receipt { } #[derive(cynic::Enum, Clone, Copy, Debug)] -#[cynic(schema_path = "../assets/schema.sdl")] +#[cynic(schema_path = "./assets/schema.sdl")] pub enum ReceiptType { Call, Return, diff --git a/fuel-client/src/client/schema/tx/tests/transparent_tx.rs b/fuel-client/src/client/schema/tx/tests/transparent_tx.rs index 0c294f32707..4603be06ae8 100644 --- a/fuel-client/src/client/schema/tx/tests/transparent_tx.rs +++ b/fuel-client/src/client/schema/tx/tests/transparent_tx.rs @@ -8,7 +8,7 @@ use core::convert::{TryFrom, TryInto}; /// Retrieves the transaction in opaque form #[derive(cynic::QueryFragment, Debug)] #[cynic( - schema_path = "../assets/schema.sdl", + schema_path = "./assets/schema.sdl", graphql_type = "Query", argument_struct = "TxIdArgs" )] @@ -19,7 +19,7 @@ pub struct TransactionQuery { #[derive(cynic::QueryFragment, Debug)] #[cynic( - schema_path = "../assets/schema.sdl", + schema_path = "./assets/schema.sdl", graphql_type = "Query", argument_struct = "ConnectionArgs" )] @@ -29,21 +29,21 @@ pub struct TransactionsQuery { } #[derive(cynic::QueryFragment, Debug)] -#[cynic(schema_path = "../assets/schema.sdl")] +#[cynic(schema_path = "./assets/schema.sdl")] pub struct TransactionConnection { pub edges: Option>>, pub page_info: PageInfo, } #[derive(cynic::QueryFragment, Debug)] -#[cynic(schema_path = "../assets/schema.sdl")] +#[cynic(schema_path = "./assets/schema.sdl")] pub struct TransactionEdge { pub cursor: String, pub node: Transaction, } #[derive(cynic::QueryFragment, Debug)] -#[cynic(schema_path = "../assets/schema.sdl")] +#[cynic(schema_path = "./assets/schema.sdl")] pub struct Transaction { pub gas_limit: i32, pub gas_price: i32, @@ -137,14 +137,14 @@ impl TryFrom for fuel_vm::prelude::Transaction { } #[derive(cynic::InlineFragments, Debug)] -#[cynic(schema_path = "../assets/schema.sdl")] +#[cynic(schema_path = "./assets/schema.sdl")] pub enum Input { InputCoin(InputCoin), InputContract(InputContract), } #[derive(cynic::QueryFragment, Debug)] -#[cynic(schema_path = "../assets/schema.sdl")] +#[cynic(schema_path = "./assets/schema.sdl")] pub struct InputCoin { pub utxo_id: HexString256, pub owner: HexString256, @@ -157,7 +157,7 @@ pub struct InputCoin { } #[derive(cynic::QueryFragment, Debug)] -#[cynic(schema_path = "../assets/schema.sdl")] +#[cynic(schema_path = "./assets/schema.sdl")] pub struct InputContract { pub utxo_id: HexString256, pub balance_root: HexString256, @@ -191,7 +191,7 @@ impl TryFrom for fuel_tx::Input { } #[derive(cynic::InlineFragments, Debug)] -#[cynic(schema_path = "../assets/schema.sdl")] +#[cynic(schema_path = "./assets/schema.sdl")] pub enum Output { CoinOutput(CoinOutput), ContractOutput(ContractOutput), @@ -202,7 +202,7 @@ pub enum Output { } #[derive(cynic::QueryFragment, Debug)] -#[cynic(schema_path = "../assets/schema.sdl")] +#[cynic(schema_path = "./assets/schema.sdl")] pub struct CoinOutput { pub to: HexString256, pub amount: i32, @@ -210,7 +210,7 @@ pub struct CoinOutput { } #[derive(cynic::QueryFragment, Debug)] -#[cynic(schema_path = "../assets/schema.sdl")] +#[cynic(schema_path = "./assets/schema.sdl")] pub struct WithdrawalOutput { pub to: HexString256, pub amount: i32, @@ -218,7 +218,7 @@ pub struct WithdrawalOutput { } #[derive(cynic::QueryFragment, Debug)] -#[cynic(schema_path = "../assets/schema.sdl")] +#[cynic(schema_path = "./assets/schema.sdl")] pub struct ChangeOutput { pub to: HexString256, pub amount: i32, @@ -226,7 +226,7 @@ pub struct ChangeOutput { } #[derive(cynic::QueryFragment, Debug)] -#[cynic(schema_path = "../assets/schema.sdl")] +#[cynic(schema_path = "./assets/schema.sdl")] pub struct VariableOutput { pub to: HexString256, pub amount: i32, @@ -234,7 +234,7 @@ pub struct VariableOutput { } #[derive(cynic::QueryFragment, Debug)] -#[cynic(schema_path = "../assets/schema.sdl")] +#[cynic(schema_path = "./assets/schema.sdl")] pub struct ContractOutput { pub input_index: i32, pub balance_root: HexString256, @@ -242,7 +242,7 @@ pub struct ContractOutput { } #[derive(cynic::QueryFragment, Debug)] -#[cynic(schema_path = "../assets/schema.sdl")] +#[cynic(schema_path = "./assets/schema.sdl")] pub struct ContractCreated { contract_id: HexString256, } diff --git a/fuel-core/Cargo.toml b/fuel-core/Cargo.toml index f589bf19b0b..564618247d6 100644 --- a/fuel-core/Cargo.toml +++ b/fuel-core/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "fuel-core" -version = "0.1.1" +version = "0.1.2" authors = ["Fuel Labs "] categories = ["concurrency", "cryptography::cryptocurrencies", "emulators"] edition = "2021" diff --git a/xtask/src/commands/dump.rs b/xtask/src/commands/dump.rs index eef617771d6..e75427e1602 100644 --- a/xtask/src/commands/dump.rs +++ b/xtask/src/commands/dump.rs @@ -8,7 +8,7 @@ use std::{ use structopt::StructOpt; // stored in the root of the workspace -const SCHEMA_URL: &str = "../assets/schema.sdl"; +const SCHEMA_URL: &str = "../fuel-client/assets/schema.sdl"; #[derive(Debug, StructOpt)] pub struct DumpCommand {}