Skip to content

Commit

Permalink
feat(graph): update schema to represent correct structure in preparat…
Browse files Browse the repository at this point in the history
…ion of transition to kadindexer.io/graphql
  • Loading branch information
alber70g committed Jan 16, 2025
1 parent f56234d commit b1a9166
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 20 deletions.
12 changes: 9 additions & 3 deletions packages/e2e/e2e-graph/queries/getAccount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,23 @@ export function getAccountQuery(accountName: string) {
}
result {
... on TransactionResult {
height
block {
height
}
}
}
}
fragment CoreTransferFields on Transfer {
amount
chainId
senderAccount
height
requestKey
receiverAccount
transaction {
block {
chainId
height
}
}
}`,
variables: { fungibleName: 'coin', accountName: accountName },
operationName: 'getAccount',
Expand Down
16 changes: 12 additions & 4 deletions packages/e2e/e2e-graph/queries/getTransactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,20 +45,28 @@ export function getTransactionsQuery(accountName: string) {
edges {
node {
amount
chainId
id
receiverAccount
requestKey
senderAccount
transaction {
block {
chainId
}
}
crossChainTransfer {
amount
blockHash
chainId
id
moduleName
receiverAccount
requestKey
senderAccount
transaction {
block {
chainId
hash
}
}
}
}
}
Expand Down Expand Up @@ -123,7 +131,7 @@ export function getTransactionsByRequestKeySubscription(
}
...on TransactionResult {
badResult
goodResult
goodResult
}
}
}
Expand Down
6 changes: 4 additions & 2 deletions packages/e2e/e2e-graph/tests/account.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,15 @@ test('Query: getAccount by AccountName', async ({ request }) => {
{
node: {
amount: 100,
chainId: 0,
crossChainTransfer: null,
height: accountCreationResult.metaData?.blockHeight,
receiverAccount: testAccount.account,
requestKey: accountCreationResult.reqKey,
senderAccount: sender00Account.account,
transaction: {
block: {
height: accountCreationResult.metaData?.blockHeight,
chainId: 0,
},
cmd: {
payload: {},
},
Expand Down
53 changes: 42 additions & 11 deletions packages/e2e/e2e-graph/tests/transaction.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,11 @@ test.describe('Query: getTransactions', () => {
{
node: {
amount: 0.00000736,
chainId: 0,
transaction: {
block: {
chainId: 0,
},
},
crossChainTransfer: null,
receiverAccount: devnetMiner.account,
requestKey: transfer.reqKey,
Expand All @@ -158,7 +162,11 @@ test.describe('Query: getTransactions', () => {
{
node: {
amount: 20,
chainId: 0,
transaction: {
block: {
chainId: 0,
},
},
crossChainTransfer: null,
receiverAccount: targetAccount.account,
requestKey: transfer.reqKey,
Expand Down Expand Up @@ -275,7 +283,11 @@ test.describe('Query: getTransactions', () => {
{
node: {
amount: 0.00000478,
chainId: 1,
transaction: {
block: {
chainId: 1,
},
},
receiverAccount: devnetMiner.account,
requestKey: transfer.reqKey,
senderAccount: sourceAccount.account,
Expand All @@ -288,7 +300,11 @@ test.describe('Query: getTransactions', () => {
{
node: {
amount: 20,
chainId: 1,
transaction: {
block: {
chainId: 1,
},
},
receiverAccount: targetAccount.account,
requestKey: transfer.reqKey,
senderAccount: '',
Expand All @@ -297,15 +313,19 @@ test.describe('Query: getTransactions', () => {
),
crossChainTransfer: {
amount: 20,
blockHash: continuationBlockHash,
chainId: 0,
moduleName: 'coin',
receiverAccount: '',
requestKey: transfer.continuation?.pactId,
senderAccount: sourceAccount.account,
id: base64Encode(
`Transfer:["${continuationBlockHash}","0","2","${coinModuleHash}","${transfer.continuation?.pactId}"]`,
),
transaction: {
block: {
blockHash: continuationBlockHash,
chainId: 0,
},
},
},
},
},
Expand Down Expand Up @@ -354,7 +374,11 @@ test.describe('Query: getTransactions', () => {
{
node: {
amount: 0.00000621,
chainId: 0,
transaction: {
block: {
chainId: 0,
},
},
receiverAccount: devnetMiner.account,
requestKey: transfer.continuation?.pactId,
senderAccount: sourceAccount.account,
Expand All @@ -367,24 +391,31 @@ test.describe('Query: getTransactions', () => {
{
node: {
amount: 20,
chainId: 0,
transaction: {
block: {
chainId: 0,
},
},
receiverAccount: '',
requestKey: transfer.continuation?.pactId, // feels like this should be the transfer.reqKey
senderAccount: sourceAccount.account,
id: base64Encode(
`Transfer:["${continuationBlockHash}","0","2","${coinModuleHash}","${transfer.continuation?.pactId}"]`, // feels like this should not be the continuation block has and pactId
),
crossChainTransfer: {
amount: 20,
blockHash: transfer.metaData?.blockHash,
chainId: 1,
moduleName: 'coin',
receiverAccount: targetAccount.account,
requestKey: transfer.reqKey,
senderAccount: '',
id: base64Encode(
`Transfer:["${transfer.metaData?.blockHash}","1","1","${coinModuleHash}","${transfer.reqKey}"]`, // feels like this should be the continuation block has and pactId?
),
transaction: {
block: {
blockHash: transfer.metaData?.blockHash,
chainId: 1,
},
},
},
},
},
Expand Down

0 comments on commit b1a9166

Please sign in to comment.