Skip to content

Commit

Permalink
support interface of query by nonce
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoch05 committed Jul 22, 2024
1 parent 61a39ae commit ff27509
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions apollo/src/aggregation/aggregation.history.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 15 additions & 0 deletions apollo/src/aggregation/aggregation.resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 2 additions & 0 deletions apollo/src/graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ export class HealthInfo {
export abstract class IQuery {
abstract historyRecordById(id?: Nullable<string>): Nullable<HistoryRecord> | Promise<Nullable<HistoryRecord>>;

abstract historyRecordByNonce(fromChain?: Nullable<string>, toChain?: Nullable<string>, bridge?: Nullable<string>, nonce?: Nullable<number>): Nullable<HistoryRecord> | Promise<Nullable<HistoryRecord>>;

abstract historyRecordByTxHash(txHash?: Nullable<string>): Nullable<HistoryRecord> | Promise<Nullable<HistoryRecord>>;

abstract firstHistoryRecord(fromChain?: Nullable<string>, toChain?: Nullable<string>, bridge?: Nullable<string>, results?: Nullable<Nullable<number>[]>, relayer?: Nullable<string>, token?: Nullable<string>, order?: Nullable<string>, notsubmited?: Nullable<boolean>): Nullable<HistoryRecord> | Promise<Nullable<HistoryRecord>>;
Expand Down

0 comments on commit ff27509

Please sign in to comment.