forked from FuelLabs/fuel-core
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Client primitives (FuelLabs#1144)
Related issues: - FuelLabs#1121 This PR introduces a module of Rust types used by the `Client` in the `fuel-core-client` crate. These types are referred to as client types and they are used to compose the `Client` interface. All function signatures in the Client interface now use only client types and Rust primitives. All references to GraphQL schema types are removed from the interface's function signatures. Specifically, this PR introduces the following client types: - `Balance` - `Block` (as well as its constituent parts `Header`, `Consensus`, `Genesis`, and `PoAConsensus`) - `ChainInfo` - `Coin`, `MessageCoin`, and `CoinType` - `ConsensusParameters` - `Contract` and `ContractBalance` - `MerkleProof` - `Message` and `MessageProof` - `NodeInfo` While GraphQL types are used inside the client methods, all types returned by the GraphQL server are transformed back into client types so that the `Client` returns only these client types. This is enabled by defining a number of `From` traits, that transform the GraphQL schema type into the client type. --------- Co-authored-by: green <xgreenx9999@gmail.com>
- Loading branch information
Showing
35 changed files
with
883 additions
and
303 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/// Specifies the direction of a paginated query | ||
#[derive(Copy, Clone, Debug, PartialEq, Eq)] | ||
pub enum PageDirection { | ||
Forward, | ||
Backward, | ||
} | ||
|
||
/// Used to parameterize paginated queries | ||
#[derive(Clone, Debug)] | ||
pub struct PaginationRequest<T> { | ||
/// The cursor returned from a previous query to indicate an offset | ||
pub cursor: Option<T>, | ||
/// The number of results to take | ||
pub results: usize, | ||
/// The direction of the query (e.g. asc, desc order). | ||
pub direction: PageDirection, | ||
} | ||
|
||
pub struct PaginatedResult<T, C> { | ||
pub cursor: Option<C>, | ||
pub results: Vec<T>, | ||
pub has_next_page: bool, | ||
pub has_previous_page: bool, | ||
} |
Oops, something went wrong.