Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,7 @@ export default class BlockDbRepository implements BlockRepository {
`SELECT COUNT(*) as "totalCount"
FROM "Blocks" b
JOIN "Transactions" t ON t."blockId" = b.id
WHERE b.hash = $1`,
WHERE b.hash = $1 AND t.sender != 'coinbase'`,
[blockHash],
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,10 @@ export default class TransferDbRepository implements TransferRepository {
let query = '';

if (blockHash) {
if (requestKey) {
queryParams.push(requestKey);
conditions += `\nAND t.requestkey = $${queryParams.length}`;
}
queryParams.push(blockHash);
query = `
WITH filtered_block AS (
Expand Down Expand Up @@ -163,6 +167,11 @@ export default class TransferDbRepository implements TransferRepository {
LIMIT $1
`;
} else if (requestKey) {
if (blockHash) {
queryParams.push(blockHash);
conditions += `\nAND b.hash = $${queryParams.length}`;
}

queryParams.push(requestKey);
query = `
WITH filtered_transaction AS (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export const transactionsBlockResolver: BlockResolvers<ResolverContext>['transac
const { first, last, before, after } = args;
const output = await context.transactionRepository.getTransactions({
blockHash: hash,
isCoinbase: false,
first,
last,
before,
Expand Down
80 changes: 80 additions & 0 deletions indexer/tests/integration/api-parity/blocks-from-depth.builder.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
import { gql } from 'graphql-request';

export const blocksFromDepthQueryGql = gql`
query blocksFromDepth($minimumDepth: Int!, $chainIds: [String!]!) {
blocksFromDepth(minimumDepth: $minimumDepth, chainIds: $chainIds, first: 20) {
edges {
node {
chainId
creationTime
difficulty
hash
epoch
events {
totalCount
pageInfo {
hasNextPage
hasPreviousPage
}
edges {
node {
chainId
height
id
moduleName
name
orderIndex
parameters
parameterText
qualifiedName
requestKey
}
}
}
flags
hash
height
id
minerAccount {
accountName
balance
chainId
fungibleName
guard {
... on KeysetGuard {
keys
predicate
raw
}
}
id
}
neighbors {
chainId
hash
}
nonce
parent {
chainId
}
payloadHash
powHash
target
transactions {
totalCount
pageInfo {
hasNextPage
hasPreviousPage
}
edges {
node {
id
}
}
}
weight
}
}
}
}
`;
79 changes: 79 additions & 0 deletions indexer/tests/integration/api-parity/blocks-from-height.builder.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
import { gql } from 'graphql-request';

export const blocksFromHeightQueryGql = gql`
query blocksFromHeight($startHeight: Int!, $endHeight: Int) {
blocksFromHeight(startHeight: $startHeight, endHeight: $endHeight, first: 20) {
edges {
node {
chainId
creationTime
difficulty
epoch
events {
totalCount
pageInfo {
hasNextPage
hasPreviousPage
}
edges {
node {
chainId
height
id
moduleName
name
orderIndex
parameters
parameterText
qualifiedName
requestKey
}
}
}
flags
hash
height
id
minerAccount {
accountName
balance
chainId
fungibleName
guard {
... on KeysetGuard {
keys
predicate
raw
}
}
id
}
neighbors {
chainId
hash
}
nonce
parent {
chainId
}
payloadHash
powHash
target
transactions {
totalCount
pageInfo {
hasNextPage
hasPreviousPage
}
edges {
node {
id
}
}
}
weight
}
}
}
}
`;
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
import { gql } from 'graphql-request';

export const completedBlockHeightsQueryGql = gql`
query completedBlockHeights($completedHeights: Boolean) {
completedBlockHeights(completedHeights: $completedHeights, first: 20) {
edges {
node {
chainId
creationTime
difficulty
hash
epoch
events {
totalCount
pageInfo {
hasNextPage
hasPreviousPage
}
edges {
node {
chainId
height
id
moduleName
name
orderIndex
parameters
parameterText
qualifiedName
requestKey
}
}
}
flags
hash
height
id
minerAccount {
accountName
balance
chainId
fungibleName
guard {
... on KeysetGuard {
keys
predicate
raw
}
}
id
}
neighbors {
chainId
hash
}
nonce
parent {
chainId
}
payloadHash
powHash
target
transactions {
totalCount
pageInfo {
hasNextPage
hasPreviousPage
}
edges {
node {
id
}
}
}
weight
}
}
}
}
`;
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { gql } from 'graphql-request';

export const fungibleAccountsByPublicKeyQueryGql = gql`
query fungibleAccountsByPublicKey($publicKey: String!) {
fungibleAccountsByPublicKey(publicKey: $publicKey) {
fungibleName
accountName
totalBalance
chainAccounts {
id
accountName
balance
chainId
fungibleName
guard {
... on KeysetGuard {
keys
predicate
raw
}
}
}
}
}
`;
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { gql } from 'graphql-request';

export const fungibleChainAccountQueryGql = gql`
query {
fungibleChainAccount(
accountName: "k:1dc186034e79417a93f5cf05a99874c0a3681936faaf3d5963f77b262218fe82"
chainId: "0"
) {
id
accountName
balance
chainId
fungibleName
guard {
... on KeysetGuard {
keys
predicate
raw
}
}
}
}
`;
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { gql } from 'graphql-request';

export const fungibleChainAccountsByPublicKeyQueryGql = gql`
query fungibleChainAccountsByPublicKey($publicKey: String!, $chainId: String!) {
fungibleChainAccountsByPublicKey(publicKey: $publicKey, chainId: $chainId) {
id
accountName
balance
chainId
fungibleName
guard {
... on KeysetGuard {
keys
predicate
raw
}
}
}
}
`;
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { gql } from 'graphql-request';

export const graphConfigurationQueryGql = gql`
query {
graphConfiguration {
minimumBlockHeight
version
}
}
`;
Loading