hack-a-chain-software / indexer-kadena

0 stars 2 forks source link

[Test] Test new graphQL endpoint #97

Open rafaeldkb opened 13 hours ago

rafaeldkb commented 13 hours ago

Test API as a user

rafaeldkb commented 13 hours ago

@mschead I'm trying to retrieve information from a transaction using a requestkey and it says it doesn't find the request key.

Query:

query Transaction($requestKey: String!) { transaction(requestKey: $requestKey) { cmd { transactionId } } } }

Response: "errors": [ { "message": "Transfer with id 89nwsbqyqg9XwrTOnHWtAb-KTpdKTYg0Q5LTpLK5X7M not found", "locations": [ { "line": 2, "column": 3 } ], "path": [ "transaction" ], "extensions": { "code": "INTERNAL_SERVER_ERROR", "exception": { "stacktrace": [ "Error: Transfer with id 89nwsbqyqg9XwrTOnHWtAb-KTpdKTYg0Q5LTpLK5X7M not found", " at TransactionDbRepository.getTransactionByRequestKey (/app/dist/kadena-server/repository/infra/repository/transaction-db-repository.js:147:19)", " at process.processTicksAndRejections (node:internal/process/task_queues:95:5)", " at async Object.transactionQueryResolver [as transaction] (/app/dist/kadena-server/resolvers/query/transaction-query-resolver.js:8:20)" ] } } } ], "data": { "transaction": null } }

rafaeldkb commented 13 hours ago

@mschead i'm trying to retrieve "id" and "hash" from transactions query, using the "edge" field, and its not returning any value.

Query query Transactions($requestKey: String) { transactions(requestKey: $requestKey) { edges { node { id hash } } } }

Response { "data": { "transactions": { "edges": [] } } }

the same return happens if I query using the AccountName:

query Transactions($accountName: String) { transactions(accountName: $accountName) { edges { node { id hash } } } } }

And again, when trying to retrieve data from with "edge" it doesn't return anything, see query below with blocks: query Block($hash: String!) { block(hash: $hash) { events { edges { node { requestkey qualifiedName parameters } } } } }

returned: { "data": { "block": { "events": { "edges": [] } } } }

rafaeldkb commented 12 hours ago

When I try to retrieve "Parent" from the block query it doesn't show any data option

query Block($hash: String!) { block(hash: $hash) { parent {

}

} }

like, what should I add in the line below? i thought it was supposed to show some data options, and there's not really a variable

rafaeldkb commented 12 hours ago

Making queries for total count of events inside blocks is returning 0 events, even though I know there were several transactions on the block (hash used: "Mm4o2NTaln9yEpZAIuMvbg-9yMuc3B49xwJgCiJv7Y8")

Query query Block($hash: String!) { block(hash: $hash) { events { totalCount } } } }

Return { "data": { "block": { "events": { "totalCount": 0 } } } }

rafaeldkb commented 12 hours ago

I don't really know what are the options to add for the variable "qualifiedEventName", and it seems its a requirement to query events, could you explain?

Query query Events($qualifiedEventName: String!) { events(qualifiedEventName: $qualifiedEventName) { blockHash } }

rafaeldkb commented 11 hours ago

the query "CompletedBlockHeights" is returning null, with error.

Query query CompletedBlockHeights { completedBlockHeights { edges { node { chainId } } } }

Return { "errors": [ { "message": "Cannot return null for non-nullable field Query.completedBlockHeights.", "locations": [ { "line": 2, "column": 3 } ], "path": [ "completedBlockHeights" ], "extensions": { "code": "INTERNAL_SERVER_ERROR", "exception": { "stacktrace": [ "Error: Cannot return null for non-nullable field Query.completedBlockHeights.", " at completeValue (/app/node_modules/graphql/execution/execute.js:559:13)", " at resolveField (/app/node_modules/graphql/execution/execute.js:472:19)", " at executeFields (/app/node_modules/graphql/execution/execute.js:292:18)", " at executeOperation (/app/node_modules/graphql/execution/execute.js:236:122)", " at executeImpl (/app/node_modules/graphql/execution/execute.js:116:14)", " at execute (/app/node_modules/graphql/execution/execute.js:60:35)", " at execute (/app/node_modules/apollo-server-core/dist/requestPipeline.js:207:48)", " at processGraphQLRequest (/app/node_modules/apollo-server-core/dist/requestPipeline.js:150:34)", " at process.processTicksAndRejections (node:internal/process/task_queues:95:5)", " at async processHTTPRequest (/app/node_modules/apollo-server-core/dist/runHttpQuery.js:222:30)" ] } } } ], "data": null }

mschead commented 6 hours ago

Issue 1

Image

Make sure to use query like this. This baselineTransaction is something new that I added yesterday.

mschead commented 6 hours ago

Issue 2

Image

mschead commented 6 hours ago

Issue 3

Image

mschead commented 6 hours ago

Issue 4

Image

mschead commented 6 hours ago

Issue 5

Image

The parent is the block parent of the current block you're fetching. You should be able to get all the fields of a block, as you can see on this list. I'm not sure if you're using mac or windows, but if you click CMD + space or CTRL + space, the list will open.

mschead commented 6 hours ago

Issue 6

I found that it was missing the implementation of the total count for transactions and events of a block. I will fix it. However, I did the query on the kadscan using the hash (Mm4o2NTaln9yEpZAIuMvbg-9yMuc3B49xwJgCiJv7Y8) you mentioned and it returned no results. I did on the database as well and I got the same thing.

Image

mschead commented 6 hours ago

Issue 7

It's the combination of module and name columns. An example is coin.TRANSFER.

Image Image

mschead commented 6 hours ago

Issue 8

I will finish the completedBlockHeights query. This one is pending.