forked from ezedike-evan/stellar-intel
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypeDefs.ts
More file actions
111 lines (99 loc) · 2.74 KB
/
Copy pathtypeDefs.ts
File metadata and controls
111 lines (99 loc) · 2.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
/**
* SDL for the additive GraphQL surface. REST v1 (documented in
* public/openapi.json) stays canonical — this schema covers the same four
* resources (anchors, health, rates, intents) as a convenience surface for
* clients that want a single round trip, and resolves through the exact
* same lib/ data-access functions REST uses (see lib/graphql/resolvers.ts).
*/
export const typeDefs = /* GraphQL */ `
type Query {
"A single anchor by id. Returns null if the id is unknown."
anchor(id: ID!): Anchor
"Anchors serving a corridor, or every known anchor when corridorId is omitted."
anchors(corridorId: ID): [Anchor!]!
"Live rate comparison for a corridor, resolved through the same cache REST's GET /api/rates/[corridor] uses."
rates(corridor: ID!, amount: String, forceRefresh: Boolean): RateComparison!
"Aggregate system health: degraded anchors, publisher liveness, rolling rate-cache counters."
health: HealthStatus!
}
type Mutation {
"Resolves an off-ramp intent to a route and an unsigned Stellar transaction, identical to POST /api/intent/offramp."
submitOfframpIntent(input: OfframpIntentInput!): OfframpIntentResult!
}
type Anchor {
id: ID!
name: String!
homeDomain: String!
corridors: [String!]!
assetCode: String!
assetIssuer: String!
seps: [String!]
"True when the nightly validator has auto-flagged this anchor unhealthy."
degraded: Boolean!
}
type AnchorRate {
anchorId: ID!
anchorName: String!
corridorId: ID!
fee: Float
feeType: String!
exchangeRate: Float
totalReceived: Float
updatedAt: String!
source: String!
expiresAt: String
quoteId: String
quoteStatus: String
}
type AnchorRateError {
anchorId: ID!
anchorName: String!
reason: String!
}
type RateComparison {
corridorId: ID!
rates: [AnchorRate!]!
bestRateId: String!
errors: [AnchorRateError!]
}
type AnchorHealthStatus {
anchorId: ID!
degraded: Boolean!
lastCheckedAt: String
lastStatus: String
}
type PublisherHealth {
lastRun: String
lastBatchSize: Int
lastError: String
staleSinceMs: Int
}
type RatesCacheHealth {
hits: Int!
misses: Int!
}
type HealthStatus {
degradedAnchors: [AnchorHealthStatus!]!
publisher: PublisherHealth!
ratesCache: RatesCacheHealth!
}
input OfframpIntentInput {
sourceAsset: String!
destinationAsset: String!
amount: String!
sender: String!
recipient: String!
}
type OfframpRoute {
anchorId: ID!
anchorDomain: String!
corridorId: ID!
estimatedFee: String!
estimatedReceived: String!
}
type OfframpIntentResult {
route: OfframpRoute!
unsignedTx: String!
quoteId: String!
}
`;