Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

previousHistoryRecord interface #177

Merged
merged 2 commits into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
previousHistoryRecord(fromChain: String, toChain: String, bridge: String, relayer: String, token: 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
27 changes: 27 additions & 0 deletions apollo/src/aggregation/aggregation.resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,33 @@ export class AggregationResolver {
});
}

@Query()
async previousHistoryRecord(
@Args('fromChain') fromChain: string,
@Args('toChain') toChain: string,
@Args('bridge') bridge: string,
@Args('relayer') relayer: string,
@Args('token') token: string,
@Args('nonce') nonce: number
) {
const orderBy = { nonce: Prisma.SortOrder.desc };
return this.aggregationService.queryHistoryRecordFirst(
{
AND: {
fromChain: fromChain,
toChain: toChain,
bridge: bridge,
relayer: relayer,
sendTokenAddress: token,
nonce: {
lt: nonce,
},
},
},
orderBy
);
}

// query by source tx hash
@Query()
async historyRecordByTxHash(@Args('txHash') txHash: string) {
Expand Down
293 changes: 196 additions & 97 deletions apollo/src/graphql.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

/*
* -------------------------------------------------------
* THIS FILE WAS AUTOMATICALLY GENERATED (DO NOT MODIFY)
Expand All @@ -9,126 +8,226 @@
/* eslint-disable */

export class HistoryRecord {
id: string;
fromChain: string;
toChain: string;
bridge: string;
reason?: Nullable<string>;
nonce: BigInt;
requestTxHash: string;
responseTxHash?: Nullable<string>;
sender: string;
recipient: string;
sendToken: string;
recvToken: string;
sendAmount: string;
recvAmount?: Nullable<string>;
startTime: number;
endTime?: Nullable<number>;
result: number;
fee: string;
feeToken: string;
messageNonce?: Nullable<string>;
sendTokenAddress?: Nullable<string>;
recvTokenAddress?: Nullable<string>;
sendOuterTokenAddress?: Nullable<string>;
recvOuterTokenAddress?: Nullable<string>;
guardSignatures?: Nullable<string>;
relayer?: Nullable<string>;
endTxHash?: Nullable<string>;
confirmedBlocks?: Nullable<string>;
needWithdrawLiquidity?: Nullable<boolean>;
lastRequestWithdraw?: Nullable<BigInt>;
extData?: Nullable<string>;
id: string;
fromChain: string;
toChain: string;
bridge: string;
reason?: Nullable<string>;
nonce: BigInt;
requestTxHash: string;
responseTxHash?: Nullable<string>;
sender: string;
recipient: string;
sendToken: string;
recvToken: string;
sendAmount: string;
recvAmount?: Nullable<string>;
startTime: number;
endTime?: Nullable<number>;
result: number;
fee: string;
feeToken: string;
messageNonce?: Nullable<string>;
sendTokenAddress?: Nullable<string>;
recvTokenAddress?: Nullable<string>;
sendOuterTokenAddress?: Nullable<string>;
recvOuterTokenAddress?: Nullable<string>;
guardSignatures?: Nullable<string>;
relayer?: Nullable<string>;
endTxHash?: Nullable<string>;
confirmedBlocks?: Nullable<string>;
needWithdrawLiquidity?: Nullable<boolean>;
lastRequestWithdraw?: Nullable<BigInt>;
extData?: Nullable<string>;
}

export class HistoryRecords {
total: number;
records?: Nullable<Nullable<HistoryRecord>[]>;
total: number;
records?: Nullable<Nullable<HistoryRecord>[]>;
}

export class LnBridgeRelayInfo {
id: string;
version: string;
nonce: BigInt;
targetNonce?: Nullable<BigInt>;
fromChain: string;
toChain: string;
bridge: string;
relayer: string;
sendToken?: Nullable<string>;
tokenKey?: Nullable<string>;
transactionHash: string;
timestamp: number;
margin?: Nullable<string>;
protocolFee?: Nullable<string>;
baseFee?: Nullable<string>;
liquidityFeeRate?: Nullable<number>;
slashCount?: Nullable<number>;
withdrawNonce?: Nullable<BigInt>;
lastTransferId?: Nullable<string>;
cost?: Nullable<string>;
profit?: Nullable<string>;
heartbeatTimestamp?: Nullable<number>;
messageChannel?: Nullable<string>;
transferLimit?: Nullable<string>;
softTransferLimit?: Nullable<string>;
paused?: Nullable<boolean>;
dynamicFee?: Nullable<string>;
dynamicFeeExpire?: Nullable<string>;
dynamicFeeSignature?: Nullable<string>;
id: string;
version: string;
nonce: BigInt;
targetNonce?: Nullable<BigInt>;
fromChain: string;
toChain: string;
bridge: string;
relayer: string;
sendToken?: Nullable<string>;
tokenKey?: Nullable<string>;
transactionHash: string;
timestamp: number;
margin?: Nullable<string>;
protocolFee?: Nullable<string>;
baseFee?: Nullable<string>;
liquidityFeeRate?: Nullable<number>;
slashCount?: Nullable<number>;
withdrawNonce?: Nullable<BigInt>;
lastTransferId?: Nullable<string>;
cost?: Nullable<string>;
profit?: Nullable<string>;
heartbeatTimestamp?: Nullable<number>;
messageChannel?: Nullable<string>;
transferLimit?: Nullable<string>;
softTransferLimit?: Nullable<string>;
paused?: Nullable<boolean>;
dynamicFee?: Nullable<string>;
dynamicFeeExpire?: Nullable<string>;
dynamicFeeSignature?: Nullable<string>;
}

export class LnBridgeRelayInfos {
total: number;
records?: Nullable<Nullable<LnBridgeRelayInfo>[]>;
total: number;
records?: Nullable<Nullable<LnBridgeRelayInfo>[]>;
}

export class SortedLnBridgeRelayInfos {
transferLimit: BigInt;
records?: Nullable<Nullable<LnBridgeRelayInfo>[]>;
transferLimit: BigInt;
records?: Nullable<Nullable<LnBridgeRelayInfo>[]>;
}

export class SupportChains {
fromChain: string;
toChains?: Nullable<Nullable<string>[]>;
fromChain: string;
toChains?: Nullable<Nullable<string>[]>;
}

export class HealthInfo {
name?: Nullable<string>;
callTimes?: Nullable<number>;
name?: Nullable<string>;
callTimes?: Nullable<number>;
}

export abstract class IQuery {
abstract historyRecordById(id?: Nullable<string>): 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>>;

abstract historyRecords(sender?: Nullable<string>, recipient?: Nullable<string>, relayer?: Nullable<string>, needWithdrawLiquidity?: Nullable<boolean>, fromChains?: Nullable<Nullable<string>[]>, toChains?: Nullable<Nullable<string>[]>, bridges?: Nullable<Nullable<string>[]>, row?: Nullable<number>, page?: Nullable<number>, results?: Nullable<Nullable<number>[]>, recvTokenAddress?: Nullable<string>, order?: Nullable<string>): Nullable<HistoryRecords> | Promise<Nullable<HistoryRecords>>;

abstract checkLnBridgeExist(fromChainId?: Nullable<number>, toChainId?: Nullable<number>, fromToken?: Nullable<string>, toToken?: Nullable<string>, version?: Nullable<string>): Nullable<boolean> | Promise<Nullable<boolean>>;

abstract tasksHealthCheck(name?: Nullable<string>): Nullable<Nullable<HealthInfo>[]> | Promise<Nullable<Nullable<HealthInfo>[]>>;

abstract queryRelayRecords(fromChain?: Nullable<string>, toChain?: Nullable<string>, bridge?: Nullable<string>, relayer?: Nullable<string>, row?: Nullable<number>): Nullable<HistoryRecords> | Promise<Nullable<HistoryRecords>>;

abstract queryLnBridgeRelayInfos(fromChain?: Nullable<string>, toChain?: Nullable<string>, version?: Nullable<string>, bridge?: Nullable<string>, relayer?: Nullable<string>, row?: Nullable<number>, page?: Nullable<number>): Nullable<LnBridgeRelayInfos> | Promise<Nullable<LnBridgeRelayInfos>>;

abstract sortedLnBridgeRelayInfos(fromChain?: Nullable<string>, toChain?: Nullable<string>, version?: Nullable<string>, bridge?: Nullable<string>, token?: Nullable<string>, row?: Nullable<number>, amount?: Nullable<string>, decimals?: Nullable<number>): Nullable<SortedLnBridgeRelayInfos> | Promise<Nullable<SortedLnBridgeRelayInfos>>;

abstract queryLnBridgeSupportChains(tokenKey?: Nullable<string>): Nullable<Nullable<SupportChains>[]> | Promise<Nullable<Nullable<SupportChains>[]>>;

abstract queryMaxTransfer(fromChain?: Nullable<string>, toChain?: Nullable<string>, bridge?: Nullable<string>, token?: Nullable<string>, balance?: Nullable<string>): Nullable<BigInt> | Promise<Nullable<BigInt>>;
abstract historyRecordById(
id?: Nullable<string>
): Nullable<HistoryRecord> | Promise<Nullable<HistoryRecord>>;

abstract previousHistoryRecord(
fromChain?: Nullable<string>,
toChain?: Nullable<string>,
bridge?: Nullable<string>,
relayer?: Nullable<string>,
token?: 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>>;

abstract historyRecords(
sender?: Nullable<string>,
recipient?: Nullable<string>,
relayer?: Nullable<string>,
needWithdrawLiquidity?: Nullable<boolean>,
fromChains?: Nullable<Nullable<string>[]>,
toChains?: Nullable<Nullable<string>[]>,
bridges?: Nullable<Nullable<string>[]>,
row?: Nullable<number>,
page?: Nullable<number>,
results?: Nullable<Nullable<number>[]>,
recvTokenAddress?: Nullable<string>,
order?: Nullable<string>
): Nullable<HistoryRecords> | Promise<Nullable<HistoryRecords>>;

abstract checkLnBridgeExist(
fromChainId?: Nullable<number>,
toChainId?: Nullable<number>,
fromToken?: Nullable<string>,
toToken?: Nullable<string>,
version?: Nullable<string>
): Nullable<boolean> | Promise<Nullable<boolean>>;

abstract tasksHealthCheck(
name?: Nullable<string>
): Nullable<Nullable<HealthInfo>[]> | Promise<Nullable<Nullable<HealthInfo>[]>>;

abstract queryRelayRecords(
fromChain?: Nullable<string>,
toChain?: Nullable<string>,
bridge?: Nullable<string>,
relayer?: Nullable<string>,
row?: Nullable<number>
): Nullable<HistoryRecords> | Promise<Nullable<HistoryRecords>>;

abstract queryLnBridgeRelayInfos(
fromChain?: Nullable<string>,
toChain?: Nullable<string>,
version?: Nullable<string>,
bridge?: Nullable<string>,
relayer?: Nullable<string>,
row?: Nullable<number>,
page?: Nullable<number>
): Nullable<LnBridgeRelayInfos> | Promise<Nullable<LnBridgeRelayInfos>>;

abstract sortedLnBridgeRelayInfos(
fromChain?: Nullable<string>,
toChain?: Nullable<string>,
version?: Nullable<string>,
bridge?: Nullable<string>,
token?: Nullable<string>,
row?: Nullable<number>,
amount?: Nullable<string>,
decimals?: Nullable<number>
): Nullable<SortedLnBridgeRelayInfos> | Promise<Nullable<SortedLnBridgeRelayInfos>>;

abstract queryLnBridgeSupportChains(
tokenKey?: Nullable<string>
): Nullable<Nullable<SupportChains>[]> | Promise<Nullable<Nullable<SupportChains>[]>>;

abstract queryMaxTransfer(
fromChain?: Nullable<string>,
toChain?: Nullable<string>,
bridge?: Nullable<string>,
token?: Nullable<string>,
balance?: Nullable<string>
): Nullable<BigInt> | Promise<Nullable<BigInt>>;
}

export abstract class IMutation {
abstract signConfirmedBlock(id?: Nullable<string>, relayer?: Nullable<string>, block?: Nullable<string>, timestamp?: Nullable<number>, signature?: Nullable<string>): Nullable<string> | Promise<Nullable<string>>;

abstract signHeartBeat(fromChainId?: Nullable<string>, toChainId?: Nullable<string>, version?: Nullable<string>, relayer?: Nullable<string>, tokenAddress?: Nullable<string>, softTransferLimit?: Nullable<string>, timestamp?: Nullable<number>, signature?: Nullable<string>): Nullable<string> | Promise<Nullable<string>>;

abstract signDynamicFee(fromChainId?: Nullable<string>, toChainId?: Nullable<string>, version?: Nullable<string>, relayer?: Nullable<string>, tokenAddress?: Nullable<string>, dynamicFee?: Nullable<string>, dynamicFeeExpire?: Nullable<string>, dynamicFeeSignature?: Nullable<string>, timestamp?: Nullable<number>, signature?: Nullable<string>): Nullable<string> | Promise<Nullable<string>>;
abstract signConfirmedBlock(
id?: Nullable<string>,
relayer?: Nullable<string>,
block?: Nullable<string>,
timestamp?: Nullable<number>,
signature?: Nullable<string>
): Nullable<string> | Promise<Nullable<string>>;

abstract signHeartBeat(
fromChainId?: Nullable<string>,
toChainId?: Nullable<string>,
version?: Nullable<string>,
relayer?: Nullable<string>,
tokenAddress?: Nullable<string>,
softTransferLimit?: Nullable<string>,
timestamp?: Nullable<number>,
signature?: Nullable<string>
): Nullable<string> | Promise<Nullable<string>>;

abstract signDynamicFee(
fromChainId?: Nullable<string>,
toChainId?: Nullable<string>,
version?: Nullable<string>,
relayer?: Nullable<string>,
tokenAddress?: Nullable<string>,
dynamicFee?: Nullable<string>,
dynamicFeeExpire?: Nullable<string>,
dynamicFeeSignature?: Nullable<string>,
timestamp?: Nullable<number>,
signature?: Nullable<string>
): Nullable<string> | Promise<Nullable<string>>;
}

export type BigInt = any;
Expand Down
Loading