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

Expose schema.sdl add some helper types and traits #1731

Merged
merged 5 commits into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]

### Added

- [#1731](https://github.com/FuelLabs/fuel-core/pull/1731): Expose `schema.sdl` from `fuel-core-client`.

## [Version 0.23.0]

### Added
Expand Down
1 change: 1 addition & 0 deletions crates/client/src/client/pagination.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ pub struct PaginationRequest<T> {
pub direction: PageDirection,
}

#[derive(Clone, Debug)]
pub struct PaginatedResult<T, C> {
pub cursor: Option<C>,
pub results: Vec<T>,
Expand Down
28 changes: 14 additions & 14 deletions crates/client/src/client/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ pub mod gas_price;
pub mod primitives;
pub mod tx;

#[derive(cynic::QueryFragment, Debug)]
#[derive(cynic::QueryFragment, Clone, Debug)]
#[cynic(schema_path = "./assets/schema.sdl", graphql_type = "Query")]
pub struct Health {
pub health: bool,
}

#[derive(cynic::QueryFragment, Debug)]
#[derive(cynic::QueryFragment, Clone, Debug)]
#[cynic(schema_path = "./assets/schema.sdl", graphql_type = "Mutation")]
pub struct StartSession {
pub start_session: cynic::Id,
Expand All @@ -55,7 +55,7 @@ pub struct IdArg {
pub id: cynic::Id,
}

#[derive(cynic::QueryFragment, Debug)]
#[derive(cynic::QueryFragment, Clone, Debug)]
#[cynic(
schema_path = "./assets/schema.sdl",
graphql_type = "Mutation",
Expand All @@ -66,7 +66,7 @@ pub struct EndSession {
pub end_session: bool,
}

#[derive(cynic::QueryFragment, Debug)]
#[derive(cynic::QueryFragment, Clone, Debug)]
#[cynic(
schema_path = "./assets/schema.sdl",
graphql_type = "Mutation",
Expand All @@ -83,7 +83,7 @@ pub struct ExecuteArgs {
pub op: String,
}

#[derive(cynic::QueryFragment, Debug)]
#[derive(cynic::QueryFragment, Clone, Debug)]
#[cynic(
schema_path = "./assets/schema.sdl",
graphql_type = "Mutation",
Expand All @@ -100,7 +100,7 @@ pub struct RegisterArgs {
pub register: U32,
}

#[derive(cynic::QueryFragment, Debug)]
#[derive(cynic::QueryFragment, Clone, Debug)]
#[cynic(
schema_path = "./assets/schema.sdl",
graphql_type = "Query",
Expand All @@ -118,7 +118,7 @@ pub struct MemoryArgs {
pub size: U32,
}

#[derive(cynic::QueryFragment, Debug)]
#[derive(cynic::QueryFragment, Clone, Debug)]
#[cynic(
schema_path = "./assets/schema.sdl",
graphql_type = "Query",
Expand All @@ -135,7 +135,7 @@ pub struct SetBreakpointArgs {
pub bp: Breakpoint,
}

#[derive(cynic::QueryFragment, Debug)]
#[derive(cynic::QueryFragment, Clone, Debug)]
#[cynic(
schema_path = "./assets/schema.sdl",
graphql_type = "Mutation",
Expand All @@ -159,7 +159,7 @@ pub struct SetSingleSteppingArgs {
pub enable: bool,
}

#[derive(cynic::QueryFragment, Debug)]
#[derive(cynic::QueryFragment, Clone, Debug)]
#[cynic(
schema_path = "./assets/schema.sdl",
graphql_type = "Mutation",
Expand All @@ -176,7 +176,7 @@ pub struct StartTxArgs {
pub tx: String,
}

#[derive(cynic::QueryFragment, Debug)]
#[derive(cynic::QueryFragment, Clone, Debug)]
#[cynic(
schema_path = "./assets/schema.sdl",
graphql_type = "Mutation",
Expand All @@ -192,7 +192,7 @@ pub struct ContinueTxArgs {
pub id: cynic::Id,
}

#[derive(cynic::QueryFragment, Debug)]
#[derive(cynic::QueryFragment, Clone, Debug)]
#[cynic(
schema_path = "./assets/schema.sdl",
graphql_type = "Mutation",
Expand All @@ -203,7 +203,7 @@ pub struct ContinueTx {
pub continue_tx: RunResult,
}

#[derive(cynic::QueryFragment, Debug)]
#[derive(cynic::QueryFragment, Clone, Debug)]
#[cynic(schema_path = "./assets/schema.sdl")]
pub struct RunResult {
pub breakpoint: Option<OutputBreakpoint>,
Expand All @@ -229,7 +229,7 @@ impl fmt::Display for RunResult {
}
}

#[derive(cynic::QueryFragment, Debug)]
#[derive(cynic::QueryFragment, Clone, Debug)]
#[cynic(schema_path = "./assets/schema.sdl")]
pub struct OutputBreakpoint {
pub contract: ContractId,
Expand All @@ -250,7 +250,7 @@ pub struct ConnectionArgs {
pub last: Option<i32>,
}

#[derive(cynic::QueryFragment, Debug)]
#[derive(cynic::QueryFragment, Clone, Debug)]
#[cynic(schema_path = "./assets/schema.sdl")]
pub struct PageInfo {
pub end_cursor: Option<String>,
Expand Down
10 changes: 5 additions & 5 deletions crates/client/src/client/schema/balance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub struct BalanceArgs {
pub asset_id: AssetId,
}

#[derive(cynic::QueryFragment, Debug)]
#[derive(cynic::QueryFragment, Clone, Debug)]
#[cynic(
schema_path = "./assets/schema.sdl",
graphql_type = "Query",
Expand Down Expand Up @@ -70,7 +70,7 @@ impl From<(Address, PaginationRequest<String>)> for BalancesConnectionArgs {
}
}

#[derive(cynic::QueryFragment, Debug)]
#[derive(cynic::QueryFragment, Clone, Debug)]
#[cynic(
schema_path = "./assets/schema.sdl",
graphql_type = "Query",
Expand All @@ -81,21 +81,21 @@ pub struct BalancesQuery {
pub balances: BalanceConnection,
}

#[derive(cynic::QueryFragment, Debug)]
#[derive(cynic::QueryFragment, Clone, Debug)]
#[cynic(schema_path = "./assets/schema.sdl")]
pub struct BalanceConnection {
pub edges: Vec<BalanceEdge>,
pub page_info: PageInfo,
}

#[derive(cynic::QueryFragment, Debug)]
#[derive(cynic::QueryFragment, Clone, Debug)]
#[cynic(schema_path = "./assets/schema.sdl")]
pub struct BalanceEdge {
pub cursor: String,
pub node: Balance,
}

#[derive(cynic::QueryFragment, Debug)]
#[derive(cynic::QueryFragment, Clone, Debug)]
#[cynic(schema_path = "./assets/schema.sdl")]
pub struct Balance {
pub owner: Address,
Expand Down
27 changes: 14 additions & 13 deletions crates/client/src/client/schema/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub struct BlockByIdArgs {
pub id: Option<BlockId>,
}

#[derive(cynic::QueryFragment, Debug)]
#[derive(cynic::QueryFragment, Clone, Debug)]
#[cynic(
schema_path = "./assets/schema.sdl",
graphql_type = "Query",
Expand All @@ -39,7 +39,7 @@ pub struct BlockByHeightArgs {
pub height: Option<U32>,
}

#[derive(cynic::QueryFragment, Debug)]
#[derive(cynic::QueryFragment, Clone, Debug)]
#[cynic(
schema_path = "./assets/schema.sdl",
graphql_type = "Query",
Expand All @@ -50,7 +50,7 @@ pub struct BlockByHeightQuery {
pub block: Option<Block>,
}

#[derive(cynic::QueryFragment, Debug)]
#[derive(cynic::QueryFragment, Clone, Debug)]
#[cynic(
schema_path = "./assets/schema.sdl",
graphql_type = "Query",
Expand All @@ -61,21 +61,22 @@ pub struct BlocksQuery {
pub blocks: BlockConnection,
}

#[derive(cynic::QueryFragment, Debug)]
#[derive(cynic::QueryFragment, Clone, Debug)]
#[cynic(schema_path = "./assets/schema.sdl")]
pub struct BlockConnection {
pub edges: Vec<BlockEdge>,
pub page_info: PageInfo,
}

#[derive(cynic::QueryFragment, Debug)]
#[derive(cynic::QueryFragment, Clone, Debug)]
#[cynic(schema_path = "./assets/schema.sdl")]
pub struct BlockEdge {
pub cursor: String,
pub node: Block,
}

#[derive(cynic::QueryFragment, Debug)]
/// Block with transactiuon ids
#[derive(cynic::QueryFragment, Clone, Debug)]
#[cynic(schema_path = "./assets/schema.sdl")]
pub struct Block {
pub id: BlockId,
Expand All @@ -84,13 +85,13 @@ pub struct Block {
pub transactions: Vec<TransactionIdFragment>,
}

#[derive(cynic::QueryFragment, Debug)]
#[derive(cynic::QueryFragment, Clone, Debug)]
#[cynic(schema_path = "./assets/schema.sdl", graphql_type = "Block")]
pub struct BlockIdFragment {
pub id: BlockId,
}

#[derive(cynic::QueryFragment, Debug)]
#[derive(cynic::QueryFragment, Clone, Debug)]
#[cynic(schema_path = "./assets/schema.sdl", graphql_type = "Block")]
pub struct BlockHeightFragment {
pub height: U32,
Expand All @@ -102,7 +103,7 @@ pub struct ProduceBlockArgs {
pub blocks_to_produce: U32,
}

#[derive(cynic::QueryFragment, Debug)]
#[derive(cynic::QueryFragment, Clone, Debug)]
#[cynic(
schema_path = "./assets/schema.sdl",
variables = "ProduceBlockArgs",
Expand All @@ -113,7 +114,7 @@ pub struct BlockMutation {
pub produce_blocks: U32,
}

#[derive(cynic::QueryFragment, Debug)]
#[derive(cynic::QueryFragment, Clone, Debug)]
#[cynic(schema_path = "./assets/schema.sdl")]
pub struct Header {
pub id: BlockId,
Expand All @@ -128,7 +129,7 @@ pub struct Header {
pub application_hash: Bytes32,
}

#[derive(cynic::InlineFragments, Debug)]
#[derive(cynic::InlineFragments, Clone, Debug)]
#[cynic(schema_path = "./assets/schema.sdl")]
pub enum Consensus {
Genesis(Genesis),
Expand All @@ -137,7 +138,7 @@ pub enum Consensus {
Unknown,
}

#[derive(cynic::QueryFragment, Debug)]
#[derive(cynic::QueryFragment, Clone, Debug)]
#[cynic(schema_path = "./assets/schema.sdl")]
pub struct Genesis {
pub chain_config_hash: Bytes32,
Expand All @@ -146,7 +147,7 @@ pub struct Genesis {
pub messages_root: Bytes32,
}

#[derive(cynic::QueryFragment, Debug)]
#[derive(cynic::QueryFragment, Clone, Debug)]
#[cynic(schema_path = "./assets/schema.sdl")]
pub struct PoAConsensus {
pub signature: Signature,
Expand Down
Loading
Loading