Skip to content

Commit

Permalink
Fix cross chain transfers counterpart find (#2241)
Browse files Browse the repository at this point in the history
  • Loading branch information
nil-amrutlal-dept committed Jun 6, 2024
1 parent 872a0f1 commit f4a18fa
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/popular-items-rush.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@kadena/graph": patch
---

Fixed issue when finding cross chain transfer when original transfer is the starting one
13 changes: 8 additions & 5 deletions packages/apps/graph/src/graph/objects/transfer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,14 @@ export default builder.prismaNode(Prisma.ModelName.Transfer, {
// Filter the transactions to find the counterTransaction
let counterTransaction = transactions.find(
(transaction) =>
transaction.pactId === parent.requestKey ||
(transaction.blockHash === parent.blockHash &&
transaction.requestKey === parent.requestKey &&
transaction.pactId !== null &&
transaction.pactId !== undefined),
(transaction.pactId === parent.requestKey ||
(transaction.blockHash === parent.blockHash &&
transaction.requestKey === parent.requestKey &&
transaction.pactId !== null &&
transaction.pactId !== undefined)) &&
transaction.transfers.find((transfer) =>
transfer.amount.equals(new Decimal(parent.amount)),
),
);

if (!counterTransaction) {
Expand Down

0 comments on commit f4a18fa

Please sign in to comment.