Skip to content

Commit

Permalink
Merge pull request #15 from bobanetwork/fix/removed-amount-filter-fro…
Browse files Browse the repository at this point in the history
…m-query-to-fix-data-loss-issue

Fix/removed amount filter from query to fix data loss issue
  • Loading branch information
sk-enya authored Nov 22, 2024
2 parents af364bd + cae9a9a commit 9c44c3d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
18 changes: 6 additions & 12 deletions src/lightbridge/lightbridge.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,16 +83,15 @@ export class LightBridgeGraphQLService extends GraphQLService {
sourceChainId: number | string,
destChainId: number | string,
token: string,
amount: number | string,
depositId: number | string
): Promise<LightBridgeDisbursementSuccessEvent | undefined> {
if (!token) {
return undefined
}
const query =
gql(`query Teleportation($wallet: String!, $sourceChainId: BigInt!, $token: String!, $amount: String!, $depositId: String!) {
gql(`query Teleportation($wallet: String!, $sourceChainId: BigInt!, $token: String!, $depositId: String!) {
disbursementSuccesses(
where: { and: [{ to_contains: $wallet }, { sourceChainId: $sourceChainId }, { token_contains: $token }, { amount: $amount }, { depositId: $depositId }] }
where: { and: [{ to_contains: $wallet }, { sourceChainId: $sourceChainId }, { token_contains: $token }, { depositId: $depositId }] }
) {
depositId
to
Expand All @@ -110,7 +109,6 @@ export class LightBridgeGraphQLService extends GraphQLService {
wallet: walletAddress,
sourceChainId: sourceChainId.toString(),
token,
amount: amount.toString(),
depositId: depositId.toString(),
}
const events = retainOldStructure((
Expand All @@ -133,13 +131,12 @@ export class LightBridgeGraphQLService extends GraphQLService {
walletAddress: string,
sourceChainId: number | string,
destChainId: number | string,
amount: number | string,
depositId: number | string
): Promise<LightBridgeDisbursementFailedEvent | undefined> {
const query =
gql(`query Teleportation($wallet: String!, $sourceChainId: BigInt!, $amount: String!, $depositId: String!) {
gql(`query Teleportation($wallet: String!, $sourceChainId: BigInt!, $depositId: String!) {
disbursementFaileds(
where: { and: [{ to_contains: $wallet }, { sourceChainId: $sourceChainId }, { amount: $amount }, { depositId: $depositId }] }
where: { and: [{ to_contains: $wallet }, { sourceChainId: $sourceChainId }, { depositId: $depositId }] }
) {
depositId
to
Expand All @@ -155,7 +152,6 @@ export class LightBridgeGraphQLService extends GraphQLService {
const variables = {
wallet: walletAddress,
sourceChainId: sourceChainId.toString(),
amount: amount.toString(),
depositId: depositId.toString(),
}
const events = retainOldStructure((
Expand Down Expand Up @@ -184,13 +180,12 @@ export class LightBridgeGraphQLService extends GraphQLService {
walletAddress: string,
sourceChainId: number | string,
destChainId: number | string,
amount: number | string,
depositId: number | string
): Promise<LightBridgeDisbursementRetrySuccessEvent | undefined> {
const query =
gql(`query Teleportation($wallet: String!, $sourceChainId: BigInt!, $amount: String!, $depositId: String!) {
gql(`query Teleportation($wallet: String!, $sourceChainId: BigInt!, $depositId: String!) {
disbursementRetrySuccesses(
where: { and: [{ to_contains: $wallet }, { sourceChainId: $sourceChainId }, { amount: $amount }, { depositId: $depositId }] }
where: { and: [{ to_contains: $wallet }, { sourceChainId: $sourceChainId }, { depositId: $depositId }] }
) {
depositId
to
Expand All @@ -206,7 +201,6 @@ export class LightBridgeGraphQLService extends GraphQLService {
const variables = {
wallet: walletAddress,
sourceChainId: sourceChainId.toString(),
amount: amount.toString(),
depositId: depositId.toString(),
}
const events = retainOldStructure((
Expand Down
1 change: 0 additions & 1 deletion tests/integration/light-bridge.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ describe('LightBridge Integration Test', function () {
28882,
11155111,
'0x0000000000000000000000000000000000000000',
"2000000000000000000",
"3");

expect(res.__typename).toEqual("DisbursementSuccess")
Expand Down

0 comments on commit 9c44c3d

Please sign in to comment.