Overview
info
Giant Squid Main is an open-source project. You can find the source code here
"Main" part of the Giant Squid API handles accounts, identities, transfers and staking.
API schema
Account
type Account @entity {
id: ID!
publicKey: ID! @index
transfers: [Transfer!] @derivedFrom(field: "account")
rewards: [StakingReward!] @derivedFrom(field: "account")
identity: Identity @derivedFrom(field: "account")
sub: IdentitySub @derivedFrom(field: "account")
}
Transfer
enum TransferDirection {
From
To
}
# entity for linking account and transfer
type Transfer @entity {
id: ID!
transfer: NativeTransfer
account: Account!
direction: TransferDirection
}
type NativeTransfer @entity {
id: ID!
blockNumber: Int! @index
timestamp: DateTime! @index
extrinsicHash: String @index
from: Account!
to: Account!
amount: BigInt! @index
success: Boolean!
}
StakingReward
See Substrate docs about Staking for more information.
type StakingReward @entity {
id: ID!
timestamp: DateTime!
blockNumber: Int! @index
extrinsicHash: String @index
account: Account!
amount: BigInt!
era: Int
validatorId: ID
}
Identity and IdentitySub
type IdentityAdditionalField {
name: String
value: String
}
enum Judgement {
Unknown
FeePaid
Reasonable
KnownGood
OutOfDate
LowQuality
Erroneous
}
type Identity @entity {
id: ID!
account: Account! @unique
judgement: Judgement!
subs: [IdentitySub!] @derivedFrom(field: "super")
additional: [IdentityAdditionalField!]
display: String
legal: String
web: String
riot: String
email: String
pgpFingerprint: String
image: String
twitter: String
isKilled: Boolean!
}
type IdentitySub @entity {
id: ID!
super: Identity
account: Account! @unique
name: String
}
Examples
Tested on the Kusama GS-main endpoint.
Find three accounts that received staking rewards
Query
query MyQuery {
accounts(limit: 3, where: {rewards_some: {amount_gt: "0"}}) {
id
identity {
email
isKilled
id
pgpFingerprint
}
}
}
Response sample
{
"data": {
"accounts": [
{
"id": "Fgqjkry96qFLpRqPZstNzgaqKXiVyrpzTqD55neMdW8PK6g",
"identity": {
"email": null,
"isKilled": false,
"id": "Fgqjkry96qFLpRqPZstNzgaqKXiVyrpzTqD55neMdW8PK6g",
"pgpFingerprint": null
}
},
{
"id": "DcNNc4LAwFLZwRpejQyQNZfLqggkJPLF8H37Ariwe2s3dXE",
"identity": null
},
{
"id": "F8PTaGuZQo5fgRBFuhNnhd5euFiR3KLQNMVhYD5BduPKpHr",
"identity": {
"email": null,
"isKilled": false,
"id": "F8PTaGuZQo5fgRBFuhNnhd5euFiR3KLQNMVhYD5BduPKpHr",
"pgpFingerprint": null
}
}
]
}
}