mirror of
https://github.com/cerc-io/watcher-ts
synced 2024-11-19 20:36:19 +00:00
2517f110ea
* Update getLogs and getBlockWithTransactions usage to add block number arg * Update getFullTransaction usage to add block number arg
139 lines
2.4 KiB
TypeScript
139 lines
2.4 KiB
TypeScript
//
|
|
// Copyright 2021 Vulcanize, Inc.
|
|
//
|
|
|
|
import { gql } from '@apollo/client/core';
|
|
|
|
export const getStorageAt = gql`
|
|
query getStorageAt($blockHash: Bytes32!, $contract: Address!, $slot: Bytes32!) {
|
|
getStorageAt(blockHash: $blockHash, contract: $contract, slot: $slot) {
|
|
value
|
|
cid
|
|
ipldBlock
|
|
}
|
|
}
|
|
`;
|
|
|
|
export const getLogs = gql`
|
|
query getLogs($blockHash: Bytes32!, $blockNumber: BigInt, $addresses: [Address!]) {
|
|
getLogs(blockHash: $blockHash, blockNumber: $blockNumber, addresses: $addresses) {
|
|
account {
|
|
address
|
|
}
|
|
transaction {
|
|
hash
|
|
}
|
|
topics
|
|
data
|
|
index
|
|
cid
|
|
ipldBlock
|
|
receiptCID
|
|
status
|
|
}
|
|
}
|
|
`;
|
|
|
|
export const getBlockWithTransactions = gql`
|
|
query allEthHeaderCids($blockNumber: BigInt, $blockHash: String) {
|
|
allEthHeaderCids(condition: { blockNumber: $blockNumber, blockHash: $blockHash }) {
|
|
nodes {
|
|
cid
|
|
blockNumber
|
|
blockHash
|
|
parentHash
|
|
timestamp
|
|
ethTransactionCidsByHeaderId {
|
|
nodes {
|
|
cid
|
|
txHash
|
|
index
|
|
src
|
|
dst
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
`;
|
|
|
|
export const getBlocks = gql`
|
|
query allEthHeaderCids($blockNumber: BigInt, $blockHash: String) {
|
|
allEthHeaderCids(condition: { blockNumber: $blockNumber, blockHash: $blockHash }) {
|
|
nodes {
|
|
cid
|
|
blockNumber
|
|
blockHash
|
|
parentHash
|
|
timestamp
|
|
stateRoot
|
|
td
|
|
txRoot
|
|
receiptRoot
|
|
}
|
|
}
|
|
}
|
|
`;
|
|
|
|
export const getFullBlocks = gql`
|
|
query allEthHeaderCids($blockNumber: BigInt, $blockHash: String) {
|
|
allEthHeaderCids(condition: { blockNumber: $blockNumber, blockHash: $blockHash }) {
|
|
nodes {
|
|
cid
|
|
blockNumber
|
|
blockHash
|
|
parentHash
|
|
timestamp
|
|
stateRoot
|
|
td
|
|
txRoot
|
|
receiptRoot
|
|
uncleRoot
|
|
bloom
|
|
blockByMhKey {
|
|
key
|
|
data
|
|
}
|
|
}
|
|
}
|
|
}
|
|
`;
|
|
|
|
export const getFullTransaction = gql`
|
|
query ethTransactionCidByTxHash($txHash: String!, $blockNumber: BigInt) {
|
|
ethTransactionCidByTxHash(txHash: $txHash, blockNumber: $blockNumber) {
|
|
cid
|
|
txHash
|
|
index
|
|
src
|
|
dst
|
|
blockByMhKey {
|
|
data
|
|
}
|
|
}
|
|
}
|
|
`;
|
|
|
|
export const getBlockByHash = gql`
|
|
query block($blockHash: Bytes32) {
|
|
block(hash: $blockHash) {
|
|
number
|
|
hash
|
|
parent {
|
|
hash
|
|
}
|
|
timestamp
|
|
}
|
|
}
|
|
`;
|
|
|
|
export default {
|
|
getStorageAt,
|
|
getLogs,
|
|
getBlockWithTransactions,
|
|
getBlocks,
|
|
getFullBlocks,
|
|
getFullTransaction,
|
|
getBlockByHash
|
|
};
|