Schema Structure
Full schema of the Fantom GraphQL API is:
1
# Hash is a 32 byte binary string, represented by 0x prefixed hexadecimal.
2
scalar Hash
3
4
# Address is a 20 byte Opera address, represented as 0x prefixed hexadecimal number.
5
scalar Address
6
7
# BigInt is a large integer value. Input is accepted as either a JSON number,
8
# or a hexadecimal string alternatively prefixed with 0x. Output is 0x prefixed hexadecimal.
9
scalar BigInt
10
11
# Long is a 64 bit unsigned integer value.
12
scalar Long
13
14
# Bytes is an arbitrary length binary string, represented as 0x-prefixed hexadecimal.
15
# An empty byte string is represented as '0x'.
16
scalar Bytes
17
18
# Cursor is a string representing position in a sequential list of edges.
19
scalar Cursor
20
21
# Root schema definition
22
schema {
23
query: Query
24
mutation: Mutation
25
subscription: Subscription
26
}
27
28
# Entry points for querying the API
29
type Query {
30
"Total number of accounts active on the Opera blockchain."
31
accountsActive:Long!
32
33
"Get an Account information by hash address."
34
account(address:Address!):Account!
35
36
"""
37
Get list of Contracts with at most <count> edges.
38
If <count> is positive, return edges after the cursor,
39
if negative, return edges before the cursor.
40
For undefined cursor, positive <count> starts the list from top,
41
negative <count> starts the list from bottom.
42
ValidatedOnly specifies if the list should contain all the Contracts,
43
or just contracts with validated byte code and available source/ABI.
44
"""
45
contracts(validatedOnly: Boolean = false, cursor:Cursor, count:Int!):ContractList!
46
47
"""
48
Get block information by number or by hash.
49
If neither is provided, the most recent block is given.
50
"""
51
block(number:Long, hash: Hash):Block
52
53
"Get transaction information for given transaction hash."
54
transaction(hash:Hash!):Transaction
55
56
"""
57
Get list of Blocks with at most <count> edges.
58
If <count> is positive, return edges after the cursor,
59
if negative, return edges before the cursor.
60
For undefined cursor, positive <count> starts the list from top,
61
negative <count> starts the list from bottom.
62
"""
63
blocks(cursor:Cursor, count:Int!):BlockList!
64
65
"""
66
Get list of Transactions with at most <count> edges.
67
If <count> is positive, return edges after the cursor,
68
if negative, return edges before the cursor.
69
For undefined cursor, positive <count> starts the list from top,
70
negative <count> starts the list from bottom.
71
"""
72
transactions(cursor:Cursor, count:Int!):TransactionList!
73
74
"Get the id of the current epoch of the Opera blockchain."
75
currentEpoch:Long!
76
77
"""
78
Get information about specified epoch. Returns current epoch information
79
if id is not provided.
80
"""
81
epoch(id: Long!): Epoch!
82
83
"The last staker id in Opera blockchain."
84
lastStakerId: Long!
85
86
"The number of stakers in Opera blockchain."
87
stakersNum: Long!
88
89
"""
90
Staker information. The staker is loaded either by numeric ID,
91
or by address. null if none is provided.
92
"""
93
staker(id: Long, address: Address): Staker
94
95
"List of staker information from SFC smart contract."
96
stakers: [Staker!]!
97
98
"""
99
The list of delegations for the given staker ID.
100
Cursor is used to obtain specific slice of the staker's delegations.
101
The most recent delegations are provided if cursor is omitted.
102
"""
103
delegationsOf(staker:Long!, cursor: Cursor, count: Int = 25): DelegatorList!
104
105
"Get the details of a delegator by it's address."
106
delegation(address:Address!): Delegator
107
108
"Returns the current price per gas in WEI units."
109
gasPrice: Long!
110
111
"Get price details of the Opera blockchain token for the given target symbols."
112
price(to:String!):Price!
113
114
"""
115
Get calculated staking rewards for an account or given
116
staking amount in FTM tokens.
117
At least one of the address and amount parameters must be provided.
118
If you provide both, the address takes precedence and the amount is ignored.
119
"""
120
estimateRewards(address:Address, amount:Long):EstimatedRewards!
121
}
122
123
# Mutation endpoints for modifying the data
124
type Mutation {
125
"""
126
SendTransaction submits a raw signed transaction into the block chain.
127
The tx parameter represents raw signed and RLP encoded transaction data.
128
"""
129
sendTransaction(tx: Bytes!):Transaction
130
131
"""
132
Validate a deployed contract byte code with the provided source code
133
so potential users can check the contract source code, access contract ABI
134
to be able to interact with the contract and get the right metadata.
135
Returns updated contract information. If the contract can not be validated,
136
it raises a GraphQL error.
137
"""
138
validateContract(contract: ContractValidationInput!): Contract!
139
}
140
141
# Subscriptions to live events broadcasting
142
type Subscription {
143
"Subscribe to receive information about new blocks in the blockchain."
144
onBlock: Block!
145
146
"Subscribe to receive information about new transactions in the blockchain."
147
onTransaction: Transaction!
148
}
149
150
151
# StakerInfo represents extended staker information from smart contract.
152
type StakerInfo {
153
"Name represents the name of the staker."
154
name: String
155
156
"LogoUrl represents staker logo URL."
157
logoUrl: String
158
159
"Website represents a link to stakers website."
160
website: String
161
162
"Contact represents a link to contact to the staker."
163
contact: String
164
}
165
166
# DelegatorList is a list of delegations edges provided by sequential access request.
167
type DelegatorList {
168
"Edges contains provided edges of the sequential list."
169
edges: [DelegatorListEdge!]!
170
171
"""
172
TotalCount is the maximum number of delegations
173
available for sequential access.
174
"""
175
totalCount: BigInt!
176
177
"PageInfo is an information about the current page of delegation edges."
178
pageInfo: ListPageInfo!
179
}
180
181
# BlockListEdge is a single edge in a sequential list of blocks.
182
type DelegatorListEdge {
183
"Cursor defines a scroll key to this edge."
184
cursor: Cursor!
185
186
"Delegator represents the delegator provided by this list edge."
187
delegator: Delegator!
188
}
189
190
# Delegator represents a delegation on Opera blockchain.
191
type Delegator {
192
"Address of the delegator account."
193
address: Address!
194
195
"Identifier of the staker the delegation belongs to."
196
toStakerId: Long!
197
198
"Epoch in which the delegation was made."
199
createdEpoch: Long!
200
201
"Timestamp of the delegation creation."
202
createdTime: Long!
203
204
"Epoch in which the delegation was deactivated."
205
deactivatedEpoch: Long
206
207
"Timestamp of the deactivation of the delegation."
208
deactivatedTime: Long
209
210
"Amount delegated. It includes all the pending un-delegations."
211
amount: BigInt!
212
213
"""
214
Amount delegated. The current amount still registered
215
by SFC contract as delegated amount. It does include pending
216
deactivation, but does not include partial un-delegations.
217
"""
218
amountDelegated: BigInt
219
220
"Amount locked in pending un-delegations and withdrawals."
221
amountInWithdraw: BigInt!
222
223
"Amount of rewards claimed."
224
claimedReward: BigInt
225
226
"Pending rewards for the delegation."
227
pendingRewards: PendingRewards!
228
229
"List of withdraw requests of the delegation."
230
withdrawRequests: [WithdrawRequest!]!
231
232
"List of full delegation deactivation."
233
deactivation: [DeactivatedDelegation!]!
234
}
235
236
# Account defines block-chain account information container
237
type Account {
238
"Address is the address of the account."
239
address: Address!
240
241
"Balance is the current balance of the Account in WEI."
242
balance: BigInt!
243
244
"""
245
TotalValue is the current total value fo the account in WEI.
246
It includes available balance,
247
delegated amount and pending staking rewards.
248
"""
249
totalValue: BigInt!
250
251
"txCount represents number of transaction sent from the account."
252
txCount: Long!
253
254
"""
255
txList represents list of transactions of the account
256
in form of TransactionList.
257
"""
258
txList (cursor:Cursor, count:Int!): TransactionList!
259
260
"Details of a staker, if the account is a staker."
261
staker: Staker
262
263
"Details of delegation, if the account is a delegator."
264
delegation: Delegator
265
266
"Details about smart contract, if the account is a smart contract."
267
contract: Contract
268
}
269
270
# EstimatedRewards represents a calculated rewards estimation for an account or amount staked
271
type EstimatedRewards {
272
"Amount of FTM tokens expected to be staked for the calculation."
273
staked: Long!
274
275
"""
276
dailyReward represents amount of FTM tokens estimated
277
to be rewarded for staked amount in average per day.
278
"""
279
dailyReward: BigInt!
280
281
"""
282
weeklyReward represents amount of FTM tokens estimated
283
to be rewarded for staked amount in average per week.
284
"""
285
weeklyReward: BigInt!
286
287
"""
288
monthlyReward represents amount of FTM tokens estimated
289
to be rewarded for staked amount in average per month.
290
"""
291
monthlyReward: BigInt!
292
293
"""
294
yearlyReward represents amount of FTM tokens estimated
295
to be rewarded for staked amount in average per year.
296
"""
297
yearlyReward: BigInt!
298
299
"""
300
currentRewardYearRate represents average reward rate
301
for any staked amount in average per year.
302
The value is calculated as linear gross proceeds for staked amount
303
of tokens yearly.
304
"""
305
currentRewardRateYearly: Int!
306
307
"""
308
Total amount of staked FTM tokens used for the calculation in WEI units.
309
The estimation uses total staked amount, not the effective amount provided
310
by the last epoch. The effective amount does include current
311
un-delegations and also skips offline self-staking and flagged staking.
312
"""
313
totalStaked: BigInt!
314
315
"""
316
Information about the last sealed epoch of the Opera blockchain.
317
The epoch provides useful information about total FTM supply,
318
total amount staked, rewards rate and weight, fee, etc.
319
"""
320
lastEpoch: Epoch!
321
}
322
323
# TransactionList is a list of transaction edges provided by sequential access request.
324
type TransactionList {
325
# Edges contains provided edges of the sequential list.
326
edges: [TransactionListEdge!]!
327
328
# TotalCount is the maximum number of transactions available for sequential access.
329
totalCount: BigInt!
330
331
# PageInfo is an information about the current page of transaction edges.
332
pageInfo: ListPageInfo!
333
}
334
335
# TransactionListEdge is a single edge in a sequential list of transactions.
336
type TransactionListEdge {
337
cursor: Cursor!
338
transaction: Transaction!
339
}
340
341
# Transaction is an Opera block chain transaction.
342
type Transaction {
343
# Hash is the unique hash of this transaction.
344
hash: Hash!
345
346
# Nonce is the number of transactions sent by the account prior to this transaction.
347
nonce: Long!
348
349
# Index is the index of this transaction in the block. This will
350
# be null if the transaction is in a pending pool.
351
index: Long
352
353
# From is the address of the account that sent this transaction
354
from: Address!
355
356
# Sender is the account that sent this transaction
357
sender: Account!
358
359
# To is the account the transaction was sent to.
360
# This is null for contract creating transactions.
361
to: Address
362
363
# contractAddress represents the address of smart contract deployed by this transaction;
364
# null if the transaction is not contract creation
365
contractAddress: Address
366
367
# Recipient is the account that received this transaction.
368
# Null for contract creating transaction.
369
recipient: Account
370
371
# Value is the value sent along with this transaction in WEI.
372
value: BigInt!
373
374
# GasPrice is the price of gas per unit in WEI.
375
gasPrice: BigInt!
376
377
# Gas represents gas provided by the sender.
378
gas: Long!
379
380
# GasUsed is the amount of gas that was used on processing this transaction.
381
# If the transaction is pending, this field will be null.
382
gasUsed: Long
383
384
# InputData is the data supplied to the target of the transaction.
385
# Contains smart contract byte code if this is contract creation.
386
# Contains encoded contract state mutating function call if recipient
387
# is a contract address.
388
inputData: Bytes!
389
390
# BlockHash is the hash of the block this transaction was assigned to.
391
# Null if the transaction is pending.
392
blockHash: Hash
393
394
# BlockHash is the hash of the block this transaction was assigned to.
395
# Null if the transaction is pending.
396
blockNumber: Long
397
398
# Block is the block this transaction was assigned to. This will be null if
399
# the transaction is pending.
400
block: Block
401
402
# Status is the return status of the transaction. This will be 1 if the
403
# transaction succeeded, or 0 if it failed (due to a revert, or due to
404
# running out of gas). If the transaction has not yet been processed, this
405
# field will be null.
406
status: Long
407
}
408
409
# Represents epoch information.
410
type Epoch {
411
"Number the epoch end."
412
id: Long!
413
414
"Timestamp of the epoch end."
415
endTime: BigInt!
416
417
"Epoch duration in seconds."
418
duration: BigInt!
419
420
"Fee at the epoch."
421
epochFee: BigInt!
422
423
"Total base reward weight on epoch."
424
totalBaseRewardWeight: BigInt!
425
426
"Total transaction reward weight on epoch."
427
totalTxRewardWeight: BigInt!
428
429
"Base reward per second of epoch."
430
baseRewardPerSecond: BigInt!
431
432
"Total amount staked."
433
stakeTotalAmount: BigInt!
434
435
"Total amount delegated."
436
delegationsTotalAmount: BigInt!
437
438
"Total supply amount."
439
totalSupply: BigInt!
440
}
441
442
# ContractList is a list of smart contract edges provided by sequential access request.
443
type ContractList {
444
# Edges contains provided edges of the sequential list.
445
edges: [ContractListEdge!]!
446
447
# TotalCount is the maximum number of contracts available for sequential access.
448
totalCount: BigInt!
449
450
# PageInfo is an information about the current page of contract edges.
451
pageInfo: ListPageInfo!
452
}
453
454
# TransactionListEdge is a single edge in a sequential list of transactions.
455
type ContractListEdge {
456
cursor: Cursor!
457
contract: Contract!
458
}
459
460
# Price represents price information of core Opera token
461
type Price {
462
"Source unit symbol."
463
fromSymbol: String!
464
465
"Target unit symbol."
466
toSymbol: String!
467
468
"Price of the source symbol unit in target symbol unit."
469
price: Float!
470
471
"Price change in last 24h."
472
change24: Float!
473
474
"Price change in percent in last 24h."
475
changePct24: Float!
476
477
"Open 24h price."
478
open24: Float!
479
480
"Highest 24h price."
481
high24: Float!
482
483
"Lowest 24h price."
484
low24: Float!
485
486
"Volume exchanged in last 24h price."
487
volume24: Float!
488
489
"Market cap of the source unit."
490
marketCap: Float!
491
492
"Timestamp of the last update of this price value."
493
lastUpdate: Long!
494
}
495
496
# Represents staker information.
497
type Staker {
498
"Id number the staker."
499
id: Long!
500
501
"Staker address."
502
stakerAddress: Address!
503
504
"Amount of total staked tokens in WEI."
505
totalStake: BigInt
506
507
"Amount of own staked tokens in WEI."
508
stake: BigInt
509
510
"Amount of tokens delegated to the staker in WEI."
511
delegatedMe: BigInt
512
513
"""
514
Maximum total amount of tokens allowed to be delegated
515
to the staker in WEI.
516
This value depends on the amount of self staked tokens.
517
"""
518
totalDelegatedLimit: BigInt!
519
520
"""
521
Maximum amount of tokens allowed to be delegated to the staker
522
on a new delegation in WEI.
523
This value depends on the amount of self staked tokens.
524
"""
525
delegatedLimit: BigInt!
526
527
"Is this a validator record."
528
isValidator: Boolean!
529
530
"Is the staker active."
531
isActive: Boolean!
532
533
"Is the staker considered to be cheater."
534
isCheater: Boolean!
535
536
"Is the staker offline."
537
isOffline: Boolean!
538
539
"Epoch in which the staker was created."
540
createdEpoch: Long!
541
542
"Timestamp of the staker creation."
543
createdTime: Long!
544
545
"Epoch in which the staker was deactivated."
546
deactivatedEpoch: Long!
547
548
"Timestamp of the staker deactivation."
549
deactivatedTime: Long!
550
551
"How many blocks the staker missed."
552
missedBlocks: Long!
553
554
"Number of seconds the staker is offline."
555
downtime: Long!
556
557
"Proof of importance score."
558
poi: BigInt
559
560
"Base weight for rewards distribution."
561
baseRewardWeight: BigInt
562
563
"Weight for transaction rewards distribution."
564
txRewardWeight: BigInt
565
566
"Validation score."
567
validationScore: BigInt
568
569
"Origination score."
570
originationScore: BigInt
571
572
"Amount of rewards claimed in WEI."
573
claimedRewards: BigInt
574
575
"Amount of rewards claimed by delegators in WEI."
576
delegationClaimedRewards: BigInt
577
578
"""
579
List of delegations of this staker. Cursor is used to obtain specific slice
580
of the staker's delegations. The most recent delegations
581
are provided if cursor is omitted.
582
"""
583
delegations(cursor: Cursor, count: Int = 25):DelegatorList!
584
585
"""
586
Status is a binary encoded status of the staker.
587
Ok = 0, bin 1 = Fork Detected, bin 256 = Validator Offline
588
"""
589
status: Long!
590
591
"StakerInfo represents extended staker information from smart contract."
592
stakerInfo: StakerInfo
593
594
"""
595
List of withdraw requests of the stake.
596
Contains only withdrawal requests of the staking account,
597
not the requests of the stake delegators.
598
"""
599
withdrawRequests: [WithdrawRequest!]!
600
}
601
602
# PendingRewards represents a detail of pending rewards for staking and delegations
603
type PendingRewards {
604
"Pending rewards amount."
605
amount: BigInt!
606
607
"The first unpaid epoch."
608
fromEpoch: Long!
609
610
"The last unpaid epoch."
611
toEpoch: Long!
612
}
613
614
# WithdrawRequest represents a request for partial stake withdraw.
615
type WithdrawRequest {
616
"Address of the authorized request."
617
address: Address!
618
619
"Address of the receiving account."
620
receiver: Address!
621
622
"Account receiving the withdraw request."
623
account: Account!
624
625
"Staker Id of the staker involved in the withdraw request."
626
stakerID: Long!
627
628
"Details of the staker involved in the withdraw request."
629
staker: Staker!
630
631
"Unique withdraw request identifier."
632
withdrawRequestID: BigInt!
633
634
"Is this a partial delegation withdraw, or staker withdraw?"
635
isDelegation: Boolean!
636
637
"Amount of WEI requested to be withdrawn."
638
amount: BigInt!
639
640
"Block in which the withdraw request was registered."
641
requestBlock: Block!
642
643
"""
644
Block in which the withdraw request was finalized.
645
The value is NULL for pending request.
646
"""
647
withdrawBlock: Block
648
649
"""
650
Amount of WEI slashed as a penalty for cheating.
651
The penalty is applied not only to staker withdraw,
652
but also to delegations of a cheating staker.
653
The value is NULL for pending requests.
654
"""
655
withdrawPenalty: BigInt
656
}
657
658
# DeactivatedDelegation represents a prepared delegation full withdraw.
659
# Fully withdrawn delegations must be prepared first and finalized
660
# only after the lock down period passes.
661
type DeactivatedDelegation {
662
"Address of the delegator."
663
address: Address!
664
665
"Staker Id of the staker involved in the withdraw request."
666
stakerID: Long!
667
668
"Details of the staker involved in the withdraw request."
669
staker: Staker!
670
671
"Block in which the delegation deactivation was registered."
672
requestBlock: Block!
673
674
"""
675
Block in which the delegation was withdrawn.
676
The value is NULL for pending request.
677
"""
678
withdrawBlock: Block
679
680
"""
681
Amount of WEI slashed as a penalty for cheating.
682
The penalty is applied to delegators' rewards
683
in case their staker is flagged.
684
The value is NULL for pending requests.
685
"""
686
withdrawPenalty: BigInt
687
}
688
689
# Block is an Opera block chain block.
690
type Block {
691
# Number is the number of this block, starting at 0 for the genesis block.
692
number: Long!
693
694
# Hash is the unique block hash of this block.
695
hash: Hash!
696
697
# Parent is the parent block of this block.
698
parent: Block
699
700
# TransactionCount is the number of transactions in this block.
701
transactionCount: Int
702
703
# Timestamp is the unix timestamp at which this block was mined.
704
timestamp: Long!
705
706
# txHashList is the list of unique hash values of transaction
707
# assigned to the block.
708
txHashList: [Hash!]!
709
710
# txList is a list of transactions assigned to the block.
711
txList: [Transaction!]!
712
}
713
714
# Contract defines block-chain smart contract information container
715
type Contract {
716
"Address represents the contract address."
717
address: Address!
718
719
"DeployedBy represents the smart contract deployment transaction reference."
720
deployedBy: Transaction!
721
722
"transactionHash represents the smart contract deployment transaction hash."
723
transactionHash: Hash!
724
725
"Smart contract name. Empty if not available."
726
name: String!
727
728
"Smart contract version identifier. Empty if not available."
729
version: String!
730
731
"""
732
License specifies an open source license the contract was published with.
733
Empty if not specified.
734
"""
735
license: String!
736
737
"Smart contract author contact. Empty if not available."
738
supportContact: String!
739
740
"Smart contract compiler identifier. Empty if not available."
741
compiler: String!
742
743
"Smart contract source code. Empty if not available."
744
sourceCode: String!
745
746
"Smart contract ABI definition. Empty if not available."
747
abi: String!
748
749
"""
750
Validated is the unix timestamp at which the source code was validated
751
against the deployed byte code. Null if not validated yet.
752
"""
753
validated: Long
754
755
"Timestamp is the unix timestamp at which this smart contract was deployed."
756
timestamp: Long!
757
}
758
759
# ContractValidationInput represents a set of data sent from client
760
# to validate deployed contract with the provided source code.
761
input ContractValidationInput {
762
"Address of the contract being validated."
763
address: Address!
764
765
"Optional smart contract name. Maximum allowed length is 64 characters."
766
name: String
767
768
"Optional smart contract version identifier. Maximum allowed length is 14 characters."
769
version: String
770
771
"Optional smart contract author contact. Maximum allowed length is 64 characters."
772
supportContact: String
773
774
"""
775
License specifies an open source license the contract was published with.
776
Empty if not specified.
777
"""
778
license: String
779
780
"Optimized specifies if the compiler was set to optimize the byte code."
781
optimized: Boolean = true
782
783
"""
784
OptimizeRuns specifies number of optimization runs the compiler was set
785
to execute during the byte code optimizing.
786
"""
787
optimizeRuns: Int = 200
788
789
"Smart contract source code."
790
sourceCode: String!
791
}
792
793
# BlockList is a list of block edges provided by sequential access request.
794
type BlockList {
795
# Edges contains provided edges of the sequential list.
796
edges: [BlockListEdge!]!
797
798
# TotalCount is the maximum number of blocks available for sequential access.
799
totalCount: BigInt!
800
801
# PageInfo is an information about the current page of block edges.
802
pageInfo: ListPageInfo!
803
}
804
805
# BlockListEdge is a single edge in a sequential list of blocks.
806
type BlockListEdge {
807
cursor: Cursor!
808
block: Block!
809
}
810
811
# ListPageInfo contains information about a sequential access list page.
812
type ListPageInfo {
813
# First is the cursor of the first edge of the edges list. null for empty list.
814
first: Cursor
815
816
# Last if the cursor of the last edge of the edges list. null for empty list.
817
last: Cursor
818
819
# HasNext specifies if there is another edge after the last one.
820
hasNext: Boolean!
821
822
# HasNext specifies if there is another edge before the first one.
823
hasPrevious: Boolean!
824
}
Copied!
Last modified 1yr ago
Copy link