From ff275097b3f8592c9864781811a72d6bbf573457 Mon Sep 17 00:00:00 2001 From: xiaoch05 Date: Mon, 22 Jul 2024 17:21:57 +0800 Subject: [PATCH] support interface of query by nonce --- .../src/aggregation/aggregation.history.graphql | 1 + apollo/src/aggregation/aggregation.resolver.ts | 15 +++++++++++++++ apollo/src/graphql.ts | 2 ++ 3 files changed, 18 insertions(+) diff --git a/apollo/src/aggregation/aggregation.history.graphql b/apollo/src/aggregation/aggregation.history.graphql index a56d81b..38f9868 100644 --- a/apollo/src/aggregation/aggregation.history.graphql +++ b/apollo/src/aggregation/aggregation.history.graphql @@ -94,6 +94,7 @@ type HealthInfo { type Query { historyRecordById(id: String): HistoryRecord + historyRecordByNonce(fromChain: String, toChain: String, bridge: String, nonce: Int): HistoryRecord historyRecordByTxHash(txHash: String): HistoryRecord firstHistoryRecord(fromChain: String, toChain: String, bridge: String, results: [Int], relayer: String, token: String, order: String, notsubmited: Boolean): HistoryRecord historyRecords(sender: String, recipient: String, relayer: String, needWithdrawLiquidity: Boolean, fromChains: [String], toChains: [String], bridges: [String], row: Int, page: Int, results: [Int], recvTokenAddress: String, order: String): HistoryRecords diff --git a/apollo/src/aggregation/aggregation.resolver.ts b/apollo/src/aggregation/aggregation.resolver.ts index 2190a6b..0339d8a 100644 --- a/apollo/src/aggregation/aggregation.resolver.ts +++ b/apollo/src/aggregation/aggregation.resolver.ts @@ -67,6 +67,21 @@ export class AggregationResolver { }); } + @Query() + async historyRecordByNonce( + @Args('fromChain') fromChain: string, + @Args('toChain') toChain: string, + @Args('bridge') bridge: string, + @Args('nonce') nonce: number + ) { + return this.aggregationService.queryHistoryRecordFirst({ + fromChain, + toChain, + bridge, + nonce + }); + } + // query by source tx hash @Query() async historyRecordByTxHash(@Args('txHash') txHash: string) { diff --git a/apollo/src/graphql.ts b/apollo/src/graphql.ts index 4ad13e9..a3e04cc 100644 --- a/apollo/src/graphql.ts +++ b/apollo/src/graphql.ts @@ -102,6 +102,8 @@ export class HealthInfo { export abstract class IQuery { abstract historyRecordById(id?: Nullable): Nullable | Promise>; + abstract historyRecordByNonce(fromChain?: Nullable, toChain?: Nullable, bridge?: Nullable, nonce?: Nullable): Nullable | Promise>; + abstract historyRecordByTxHash(txHash?: Nullable): Nullable | Promise>; abstract firstHistoryRecord(fromChain?: Nullable, toChain?: Nullable, bridge?: Nullable, results?: Nullable[]>, relayer?: Nullable, token?: Nullable, order?: Nullable, notsubmited?: Nullable): Nullable | Promise>;