Skip to content

Commit

Permalink
remover opensearchMigrationClient
Browse files Browse the repository at this point in the history
  • Loading branch information
carolk-dev committed Jan 2, 2025
1 parent a449a05 commit 51b662b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 54 deletions.
13 changes: 2 additions & 11 deletions bridge/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,7 @@ process.on("uncaughtException", console.error);
const SLACK_WEB_TOKEN: string = Configuration.get("SLACK_WEB_TOKEN");
const FAILURE_SUBSCRIBERS: string = Configuration.get("FAILURE_SUBSCRIBERS");
const OPENSEARCH_ENDPOINT: string = Configuration.get("OPENSEARCH_ENDPOINT");
const OPENSEARCH_ENDPOINT_MIGRATION: string = Configuration.get(
"OPENSEARCH_ENDPOINT_MIGRATION"
);

const OPENSEARCH_AUTH: string = Configuration.get("OPENSEARCH_AUTH");
const OPENSEARCH_INDEX: string =
Configuration.get("OPENSEARCH_INDEX", false) || "9c-eth-bridge";
Expand Down Expand Up @@ -241,12 +239,6 @@ process.on("uncaughtException", console.error);
OPENSEARCH_INDEX
);

const opensearchMigrationClient = new OpenSearchClient(
OPENSEARCH_ENDPOINT_MIGRATION,
OPENSEARCH_AUTH,
OPENSEARCH_INDEX
);

const GRAPHQL_REQUEST_RETRY = 5;
const JWT_SECRET_KEY = Configuration.get("JWT_SECRET_KEY");
const headlessGraphQLCLient = new HeadlessGraphQLClient(
Expand Down Expand Up @@ -352,8 +344,7 @@ process.on("uncaughtException", console.error);
BSCSCAN_ROOT_URL,
integration,
multiPlanetary,
FAILURE_SUBSCRIBERS,
opensearchMigrationClient
FAILURE_SUBSCRIBERS
);
const ethereumBurnEventMonitor = new BscBurnEventMonitor(
provider,
Expand Down
34 changes: 1 addition & 33 deletions bridge/src/observers/burn-event-observer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ export class BscBurnEventObserver
private readonly _integration: Integration;
private readonly _multiPlanetary: MultiPlanetary;
private readonly _failureSubscribers: string;
private readonly _opensearchMigrationClient: OpenSearchClient;

constructor(
ncgTransfer: INCGTransfer,
Expand All @@ -52,8 +51,7 @@ export class BscBurnEventObserver
etherscanUrl: string,
integration: Integration,
multiPlanetary: MultiPlanetary,
failureSubscribers: string,
opensearchMigrationClient: OpenSearchClient
failureSubscribers: string
) {
this._ncgTransfer = ncgTransfer;
this._slackMessageSender = slackMessageSender;
Expand All @@ -68,7 +66,6 @@ export class BscBurnEventObserver
this._integration = integration;
this._multiPlanetary = multiPlanetary;
this._failureSubscribers = failureSubscribers;
this._opensearchMigrationClient = opensearchMigrationClient;
}

async notify(data: {
Expand Down Expand Up @@ -120,15 +117,6 @@ export class BscBurnEventObserver
amount: amountString,
network: "BSC",
});
this._opensearchMigrationClient.to_opensearch("error", {
content: "wNCG -> NCG request failure",
cause: "Exchange history exist",
ethereumTxId: transactionHash,
sender: sender,
recipient: user9cAddress,
amount: amountString,
network: "BSC",
});
continue;
}

Expand Down Expand Up @@ -207,16 +195,6 @@ export class BscBurnEventObserver
planetName: requestPlanetName,
network: "BSC",
});
await this._opensearchMigrationClient.to_opensearch("info", {
content: "wNCG -> NCG request success",
libplanetTxId: nineChroniclesTxId,
ethereumTxId: transactionHash,
sender: sender,
recipient: user9cAddress,
amount: amount.toNumber(),
planetName: requestPlanetName,
network: "BSC",
});
console.log("Transferred", nineChroniclesTxId);
} catch (e) {
const slackMsgRes = await this._slackMessageSender.sendMessage(
Expand Down Expand Up @@ -261,16 +239,6 @@ export class BscBurnEventObserver
planetName: requestPlanetName,
network: "BSC",
});
await this._opensearchMigrationClient.to_opensearch("error", {
content: "wNCG -> NCG request failure",
cause: String(e),
ethereumTxId: transactionHash,
sender: sender,
recipient: user9cAddress,
amount: amount.toNumber(),
planetName: requestPlanetName,
network: "BSC",
});
await this._integration.error(
"Unexpected error during unwrapping NCG",
{
Expand Down
11 changes: 1 addition & 10 deletions bridge/test/observers/burn-event-observer.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,6 @@ describe(BscBurnEventObserver.name, () => {
to_opensearch: ReturnType<typeof jest.fn>;
};

const mockOpenSearchMigrationClient = new OpenSearchClient(
"https://www.random-url.com",
"auth",
"9c-eth-bridge"
) as OpenSearchClient & {
to_opensearch: ReturnType<typeof jest.fn>;
};

const mockMonitorStateStore: jest.Mocked<IMonitorStateStore> = {
load: jest.fn(),
store: jest.fn(),
Expand Down Expand Up @@ -158,8 +150,7 @@ describe(BscBurnEventObserver.name, () => {
"https://ropsten.etherscan.io",
mockIntegration,
multiPlanetary,
failureSubscribers,
mockOpenSearchMigrationClient
failureSubscribers
);

describe(BscBurnEventObserver.prototype.notify.name, () => {
Expand Down

0 comments on commit 51b662b

Please sign in to comment.