- Run graph node locally using
docker-compore up
or point tohttps://graph.t.hmny.io:8020/
as described in docs.harmony.one yarn codegen
yarn build
yarn create-local
ornpm run create-local
yarn deploy-local
ornpm run deploy-local
This subgraph dynamically tracks assets and events
- aggregated data across managers, assets and wallets
- data on individual assets
- data on transactions
- data on managers
- data on wallets
Below are a few ways to show how to query the horizon-bridge-subgraph for data. The queries show most of the information that is queryable, but there are many other filtering options that can be used, just check out the querying api. These queries can be used locally or in The Graph Explorer playground.
interface Asset {
id: ID!
network: Network!
manager: Manager
symbol: String!
name: String!
address: Bytes!
mappedAddress: Bytes
events: [Event!]! @derivedFrom(field: "asset")
eventsCount: BigInt!
}
enum EventType {
LOCK
UNLOCK
MINT
BURN
NFT_MINT
NFT_BURN
SUBMISSION
CONFIRMATION
EXECUTION
EXECUTION_FAILED
WITHDRAW
}
interface Event {
id: ID!
type: EventType!
manager: Manager
asset: Asset
user: User
timestamp: BigInt!
blockNumber: BigInt!
txIndex: BigInt!
txHash: Bytes!
}
type Manager @entity {
id: ID!
wallet: Wallet!
assets: [Asset!]! @derivedFrom(field: "manager")
events: [Event!]! @derivedFrom(field: "manager")
eventsCount: BigInt!
locks: [Lock!]! @derivedFrom(field: "manager")
locksCount: BigInt!
unlocks: [Unlock!]! @derivedFrom(field: "manager")
unlocksCount: BigInt!
mints: [Mint!]! @derivedFrom(field: "manager")
mintsCount: BigInt!
burns: [Burn!]! @derivedFrom(field: "manager")
burnsCount: BigInt!
nftMints: [NFTMint!]! @derivedFrom(field: "manager")
nftMintsCount: BigInt!
nftBurns: [NFTBurn!]! @derivedFrom(field: "manager")
nftBurnsCount: BigInt!
}
type Wallet @entity {
id: ID!
managers: [Manager!]! @derivedFrom(field: "wallet")
transactions: [Transaction!]! @derivedFrom(field: "wallet")
transactionsCount: BigInt!
transactionsConfirmedCount: BigInt!
transactionsExecutedCount: BigInt!
events: [WalletEvent!]! @derivedFrom(field: "wallet")
}
type Transaction @entity {
id: ID!
wallet: Wallet!
destination: String!
value: BigInt!
data: Bytes!
submittedBy: String!
events: [WalletEvent!]! @derivedFrom(field: "transaction")
confirmations: [Confirmation!]! @derivedFrom(field: "transaction")
confirmationsCount: BigInt!
confirmationsRequired: BigInt!
confirmed: Boolean!
executed: Boolean!
execution: Execution
executions: [Execution!]! @derivedFrom(field: "transaction")
timestamp: BigInt!
blockNumber: BigInt!
txIndex: BigInt!
txHash: String!
manager: Manager
}
type Confirmation @entity {
id: ID!
transaction: Transaction!
sender: String!
timestamp: BigInt!
blockNumber: BigInt!
txIndex: BigInt!
txHash: String!
}
enum ExecutionStatus {
SUCCESS
FAILURE
}
type Execution @entity {
id: ID!
status: ExecutionStatus!
sender: String!
transaction: Transaction!
timestamp: BigInt!
blockNumber: BigInt!
txIndex: BigInt!
txHash: String!
}
type WalletEvent implements Event @entity {
id: ID!
type: EventType!
manager: Manager
asset: Asset
user: User
timestamp: BigInt!
blockNumber: BigInt!
txIndex: BigInt!
txHash: Bytes!
wallet: Wallet!
transaction: Transaction!
}
ONE and HRC20 Tokens
type Token implements Asset @entity {
id: ID!
network: Network!
manager: Manager
symbol: String!
name: String!
address: Bytes!
mappedAddress: Bytes
events: [Event!]! @derivedFrom(field: "asset")
eventsCount: BigInt!
decimals: BigInt!
locks: [Lock!]! @derivedFrom(field: "token")
locksCount: BigInt!
unlocks: [Unlock!]! @derivedFrom(field: "token")
unlocksCount: BigInt!
totalLocked: BigInt!
}
type Lock implements Event @entity {
id: ID!
type: EventType!
manager: Manager
asset: Asset
user: User
timestamp: BigInt!
blockNumber: BigInt!
txIndex: BigInt!
txHash: Bytes!
token: Token!
sender: Bytes!
recipient: Bytes!
amount: BigInt!
}
type Unlock implements Event @entity {
id: ID!
type: EventType!
manager: Manager
asset: Asset
user: User
timestamp: BigInt!
blockNumber: BigInt!
txIndex: BigInt!
txHash: Bytes!
token: Token!
recipient: Bytes!
receiptId: Bytes!
amount: BigInt!
}
ERC20, BEP20, LINK, BUSD Tokens
type BridgedToken implements Asset @entity {
id: ID!
network: Network!
manager: Manager
symbol: String!
name: String!
address: Bytes!
mappedAddress: Bytes
events: [Event!]! @derivedFrom(field: "asset")
eventsCount: BigInt!
decimals: BigInt!
mints: [Mint!]! @derivedFrom(field: "token")
mintsCount: BigInt!
burns: [Burn!]! @derivedFrom(field: "token")
burnsCount: BigInt!
totalLocked: BigInt!
}
type Mint implements Event @entity {
id: ID!
type: EventType!
manager: Manager
asset: Asset
user: User
timestamp: BigInt!
blockNumber: BigInt!
txIndex: BigInt!
txHash: Bytes!
token: BridgedToken!
recipient: Bytes!
receiptId: Bytes!
amount: BigInt!
}
type Burn implements Event @entity {
id: ID!
type: EventType!
manager: Manager
asset: Asset
user: User
timestamp: BigInt!
blockNumber: BigInt!
txIndex: BigInt!
txHash: Bytes!
token: BridgedToken!
sender: Bytes!
recipient: Bytes!
amount: BigInt!
}
ERC721
type BridgedNFT implements Asset @entity {
id: ID!
network: Network!
manager: Manager
symbol: String!
name: String!
address: Bytes!
mappedAddress: Bytes
events: [Event!]! @derivedFrom(field: "asset")
eventsCount: BigInt!
mints: [NFTMint!]! @derivedFrom(field: "token")
mintsCount: BigInt!
burns: [NFTBurn!]! @derivedFrom(field: "token")
burnsCount: BigInt!
inventory: [BigInt!]!
}
type NFTMint implements Event @entity {
id: ID!
type: EventType!
manager: Manager
asset: Asset
user: User
timestamp: BigInt!
blockNumber: BigInt!
txIndex: BigInt!
txHash: Bytes!
token: BridgedNFT!
recipient: Bytes!
receiptId: Bytes!
tokenId: BigInt!
}
type NFTBurn implements Event @entity {
id: ID!
type: EventType!
manager: Manager
asset: Asset
user: User
timestamp: BigInt!
blockNumber: BigInt!
txIndex: BigInt!
txHash: Bytes!
token: BridgedNFT!
sender: Bytes!
recipient: Bytes!
tokenId: BigInt!
}
{
assets(orderBy: eventsCount, orderDirection: desc) {
id
symbol
network
address
mappedAddress
eventsCount
... on Token {
locksCount
unlocksCount
totalLocked
}
... on BridgedToken {
mintsCount
burnsCount
totalLocked
}
... on BridgedNFT {
mintsCount
burnsCount
inventory
}
}
}
{
events(orderBy: timestamp, orderDirection: desc) {
id
type
asset {
address
symbol
}
... on WalletEvent {
transaction {
destination
value
data
}
}
... on Lock {
amount
recipient
sender
}
... on Unlock {
amount
recipient
receiptId
}
... on Mint {
amount
recipient
receiptId
}
... on Burn {
amount
recipient
sender
}
... on NFTMint {
tokenId
recipient
receiptId
}
... on NFTBurn {
tokenId
recipient
sender
}
}
}