Skip to content
Snippets Groups Projects
Commit c43f6d28 authored by Éloïs's avatar Éloïs
Browse files

build: autogenerate schema from GVA code

parent a0c494c7
No related branches found
No related tags found
No related merge requests found
# GVA schema (autogenerated)
gql/gva_schema.gql
# rust temporary binaries
/target
This diff is collapsed.
[package]
name = "gva-rust-client"
name = "gcli"
version = "0.1.0"
authors = ["librelois <c@elo.tf>"]
edition = "2018"
license = "AGPL-3.0"
keywords = ["duniter", "gva", "client"]
description = "Duniter GVA client"
description = "A command line client written in Rust that use Duniter GVA API."
[dependencies]
anyhow = "1.0.32"
......@@ -16,3 +16,7 @@ structopt = "0.3.18"
[dev-dependencies]
mockall = "0.8.0"
[build-dependencies]
duniter-gva-gql = { git = "https://git.duniter.org/nodes/typescript/duniter", branch = "dev" }
#duniter-gva-gql = { path = "../duniter/rust-libs/modules/gva/gql" }
fn main() {
let schema_sdl = duniter_gva_gql::build_schema(false).sdl();
std::fs::write("gql/gva_schema.gql", schema_sdl.as_bytes())
.expect("Fail to write gva schema in file");
println!("cargo:rerun-if-changed=build.rs");
}
schema {
query: QueryRoot
mutation: MutationRoot
subscription: SubscriptionRoot
}
# Directs the executor to query only when the field exists.
directive @ifdef on FIELD
type AmountWithBase {
amount: Int!
base: Int!
}
type CurrentUdGva {
# Ud amount
amount: Int!
# Ud base
base: Int!
}
type MutationRoot {
# Process a transaction
# Return the transaction if it successfully inserted
tx(rawTx: String!): TxGva!
# Process several transactions
# Return an array of successfully inserted transactions
txs(rawTxs: [String!]!): [TxGva!]!
}
type Node {
# Peer card
peer: PeerCard
# Software
software: String!
# Software version
version: String!
}
enum Order {
# Ascending order
ASC
# Decreasing order
DESC
}
# Information about pagination in a connection
type PageInfo {
# When paginating backwards, are there more items?
hasPreviousPage: Boolean!
# When paginating forwards, are there more items?
hasNextPage: Boolean!
# When paginating backwards, the cursor to continue.
startCursor: String
# When paginating forwards, the cursor to continue.
endCursor: String
}
input Pagination {
# Identifier of the 1st desired element (of the last one in descending order)
cursor: String
ord: Order!
pageSize: Int
}
type PeerCard {
version: Int!
currency: String!
pubkey: String!
blockstamp: String!
endpoints: [String!]!
status: String!
signature: String!
}
type QueryRoot {
# Transactions history
utxosOfScript(
# DUBP wallet script
script: String!
# pagination
pagination: Pagination! = { cursor: null, ord: ASC, pageSize: null }
# Amount needed
amount: Int
): UtxoGvaConnection!
# Current universal dividends amount
currentUd: CurrentUdGva
# Universal dividends issued by a public key
udsOfPubkey(
# Ed25519 public key on base 58 representation
pubkey: String!
filter: UdsFilter! = ALL
# pagination
pagination: Pagination! = { cursor: null, ord: ASC, pageSize: null }
# Amount needed
amount: Int
): UdGvaConnection!
# Universal dividends revaluations
udsReval: [RevalUdGva!]!
# Transactions history
transactionsHistory(
# Ed25519 public key on base 58 representation
pubkey: String!
): TxsHistoryGva!
# Generate simple transaction document
genTx(
# Transaction amount
amount: Int!
# Transaction comment
comment: String
# Ed25519 public key on base 58 representation
issuer: String!
# Ed25519 public key on base 58 representation
recipient: String!
# Use mempool sources
useMempoolSources: Boolean! = false
): [String!]!
# Generate complex transaction document
genComplexTx(
# Transaction issuers
issuers: [TxIssuer!]!
# Transaction issuers
recipients: [TxRecipient!]!
# Transaction comment
comment: String
# Use mempool sources
useMempoolSources: Boolean! = false
): RawTxOrChanges!
# Account balance
balance(
# Account script or public key
script: String!
): AmountWithBase!
node: Node!
}
type RawTxOrChanges {
# Intermediate transactions documents for compacting sources (`null` if not needed)
changes: [String!]
# Transaction document that carries out the requested transfer (`null` if the amount to be sent requires too many sources)
tx: String
}
type RevalUdGva {
# Ud amount
amount: Int!
# Ud base
base: Int!
# Number of the block that revaluate ud amount
blockNumber: Int!
}
type SubscriptionRoot {
receivePendingTxs: [TxGva!]!
}
type TxGva {
# Version.
version: Int!
# Currency.
currency: String!
# Blockstamp
blockstamp: String!
# Locktime
locktime: Int!
# Document issuers.
issuers: [String!]!
# Transaction inputs.
inputs: [String!]!
# Inputs unlocks.
unlocks: [String!]!
# Transaction outputs.
outputs: [String!]!
# Transaction comment
comment: String!
# Document signatures
signatures: [String!]!
# Transaction hash
hash: String!
# Written block
writtenBlock: String
# Written Time
writtenTime: Int
}
input TxIssuer {
# Account script (default is a script needed all provided signers)
script: String
# Signers
signers: [String!]!
# XHX codes needed to unlock funds
codes: [String!]
# Amount
amount: Int!
}
input TxRecipient {
# Amount
amount: Int!
# Account script
script: String!
}
type TxsHistoryGva {
# Transactions sent
sent: [TxGva!]!
# Transactions sending
sending: [TxGva!]!
# Transactions received
received: [TxGva!]!
# Transactions receiving
receiving: [TxGva!]!
}
type UdGva {
# Ud amount
amount: Int!
# Ud base
base: Int!
# Issuer of this universal dividend
issuer: String!
# Number of the block that created this UD
blockNumber: Int!
# Blockchain time of the block that created this UD
blockchainTime: Int!
}
type UdGvaConnection {
# Information to aid in pagination.
pageInfo: PageInfo!
# A list of edges.
edges: [UdGvaEdge]
sum: AmountWithBase!
}
# An edge in a connection.
type UdGvaEdge {
# The item at the end of the edge
node: UdGva!
# A cursor for use in pagination
cursor: String!
}
enum UdsFilter {
ALL
UNSPENT
}
type UtxoGva {
# Source amount
amount: Int!
# Source base
base: Int!
# Hash of origin transaction
txHash: String!
# Index of output in origin transaction
outputIndex: Int!
# Written block
writtenBlock: Int!
# Written time
writtenTime: Int!
}
type UtxoGvaConnection {
# Information to aid in pagination.
pageInfo: PageInfo!
# A list of edges.
edges: [UtxoGvaEdge]
sum: AmountWithBase!
}
# An edge in a connection.
type UtxoGvaEdge {
# The item at the end of the edge
node: UtxoGva!
# A cursor for use in pagination
cursor: String!
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment