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

rmv deprecated interface #175

Merged
merged 3 commits into from
Jul 15, 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
2 changes: 0 additions & 2 deletions apollo/src/aggregation/aggregation.history.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,6 @@ type Query {
}

type Mutation {
updateConfirmedBlock(id: String, block: String): String
lnBridgeHeartBeat(fromChainId: String, toChainId: String, version: String, relayer: String, tokenAddress: String, softTransferLimit: String): String
signConfirmedBlock(id: String, relayer: String, block: String, timestamp: Int, signature: String): String
signHeartBeat(fromChainId: String, toChainId: String, version: String, relayer: String, tokenAddress: String, softTransferLimit: String, timestamp: Int, signature: String): String
signDynamicFee(fromChainId: String, toChainId: String, version: String, relayer: String, tokenAddress: String, dynamicFee: String, dynamicFeeExpire: String, dynamicFeeSignature: String, timestamp: Int, signature: String): String
Expand Down
54 changes: 1 addition & 53 deletions apollo/src/aggregation/aggregation.resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export class AggregationResolver {
'0x9c02a1a56474247a48f1090070d2817a2a5607d9': '0x0000000cf324fed44fb52e9a519cbb5bd8217f77',
'0x44c224d93b0f5e30b1a930d362e2bcfbb7807078': '0x0000000cf324fed44fb52e9a519cbb5bd8217f77',
'0x3b9e571adecb0c277486036d6097e9c2cccfa9d9': '0x0b425baaf0443275d40ce854734b06e7e976387d',
'0x2fdec62e57e1a77db6984424c01a3c13fbca7cc1': '0x00000c377b096e0c904d7736be14e653e500481c',
};
constructor(private aggregationService: AggregationService) {}

Expand Down Expand Up @@ -175,59 +176,6 @@ export class AggregationResolver {
});
}

/**
* @deprecated instead, please use signConfirmedBlock
**/
@Mutation()
async updateConfirmedBlock(@Args('id') id: string, @Args('block') block: string) {
await this.aggregationService.updateConfirmedBlock({
where: { id: id },
block: block,
});
}

/**
* @deprecated instead, please use signHeartBeat
**/
@Mutation()
async lnBridgeHeartBeat(
@Args('fromChainId') fromChainId: string,
@Args('toChainId') toChainId: string,
@Args('version') version: string,
@Args('relayer') relayer: string,
@Args('tokenAddress') tokenAddress: string,
@Args('softTransferLimit') softTransferLimit: string
) {
const id = `${version}-${fromChainId}-${toChainId}-${relayer.toLowerCase()}-${tokenAddress.toLowerCase()}`;
const now = Math.floor(Date.now() / 1000);

const updateData = {
heartbeatTimestamp: now,
};

if (softTransferLimit !== undefined && softTransferLimit !== '0') {
// the softTransferLimit is on target chain, transfer it to source chain
const transferLimit = this.aggregationService.targetAmountToSourceAmount({
amount: softTransferLimit,
sourceChainId: Number(fromChainId),
targetChainId: Number(toChainId),
sourceToken: tokenAddress,
version,
});
updateData['softTransferLimit'] = transferLimit;
}

try {
await this.aggregationService.updateLnBridgeRelayInfo({
where: { id: id },
data: updateData,
});
} catch (e) {
console.log(`heart beat failed ${id}, exception: ${e}`);
return;
}
}

@Mutation()
async signConfirmedBlock(
@Args('id') id: string,
Expand Down
4 changes: 0 additions & 4 deletions apollo/src/graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,6 @@ export abstract class IQuery {
}

export abstract class IMutation {
abstract updateConfirmedBlock(id?: Nullable<string>, block?: Nullable<string>): Nullable<string> | Promise<Nullable<string>>;

abstract lnBridgeHeartBeat(fromChainId?: Nullable<string>, toChainId?: Nullable<string>, version?: Nullable<string>, relayer?: Nullable<string>, tokenAddress?: Nullable<string>, softTransferLimit?: 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>>;
Expand Down
Loading