From 4712a7adf87fbce4a110df3f5a4e9959bf91b699 Mon Sep 17 00:00:00 2001 From: perfogic Date: Tue, 12 Nov 2024 23:59:08 +0700 Subject: [PATCH] update all version --- package.json | 12 +++---- packages/orchestrator/package.json | 6 ---- .../src/apis/services/bitcoin.service.ts | 12 +++---- .../src/apis/services/checkpoint.service.ts | 25 ++++++++----- packages/orchestrator/src/configs/logger.ts | 35 ++++++++++++------- packages/orchestrator/src/utils/cosmos.ts | 2 +- yarn.lock | 18 ++++------ 7 files changed, 58 insertions(+), 52 deletions(-) diff --git a/package.json b/package.json index f36e4aa..6369a54 100644 --- a/package.json +++ b/package.json @@ -29,12 +29,12 @@ "node": ">=18.18.0" }, "dependencies": { - "@cosmjs/amino": "0.31.3", - "@cosmjs/cosmwasm-stargate": "0.31.3", - "@cosmjs/crypto": "0.31.3", - "@cosmjs/proto-signing": "0.31.3", - "@cosmjs/stargate": "0.31.3", - "@cosmjs/tendermint-rpc": "0.31.3", + "@cosmjs/amino": "0.32.1", + "@cosmjs/cosmwasm-stargate": "0.32.4", + "@cosmjs/crypto": "0.32.4", + "@cosmjs/proto-signing": "0.32.1", + "@cosmjs/stargate": "0.32.4", + "@cosmjs/tendermint-rpc": "0.32.4", "@oraichain/oraidex-common": "^1.0.10", "joi": "^17.13.3", "readline-sync": "^1.4.10", diff --git a/packages/orchestrator/package.json b/packages/orchestrator/package.json index a6ffd51..fbc27f8 100644 --- a/packages/orchestrator/package.json +++ b/packages/orchestrator/package.json @@ -12,12 +12,6 @@ }, "license": "MIT", "dependencies": { - "@cosmjs/amino": "0.32.1", - "@cosmjs/cosmwasm-stargate": "0.32.4", - "@cosmjs/crypto": "0.32.4", - "@cosmjs/proto-signing": "0.32.1", - "@cosmjs/stargate": "0.32.4", - "@cosmjs/tendermint-rpc": "0.32.4", "@oraichain/bitcoin-bridge-contracts-build": "workspace:^", "@oraichain/bitcoin-bridge-contracts-sdk": "workspace:^", "@oraichain/bitcoin-bridge-lib-js": "workspace:^", diff --git a/packages/orchestrator/src/apis/services/bitcoin.service.ts b/packages/orchestrator/src/apis/services/bitcoin.service.ts index e649c6e..de5b14a 100644 --- a/packages/orchestrator/src/apis/services/bitcoin.service.ts +++ b/packages/orchestrator/src/apis/services/bitcoin.service.ts @@ -1,6 +1,6 @@ -import { AppBitcoinQueryClient } from '@oraichain/bitcoin-bridge-contracts-sdk'; -import env from '../../configs/env'; -import { initQueryClient } from '../../utils/cosmos'; +import { AppBitcoinQueryClient } from "@oraichain/bitcoin-bridge-contracts-sdk"; +import env from "../../configs/env"; +import { initQueryClient } from "../../utils/cosmos"; const getConfig = async () => { const client = await initQueryClient(env.cosmos.rpcUrl); @@ -30,13 +30,13 @@ const getCheckpointQueue = async () => { return { index: buildingIndex, first_unhandled_confirmed_cp_index: firstUnconfirmedIndex, - confirmed_index: confirmedIndex + confirmed_index: confirmedIndex, }; } catch (err) { return { index: 0, first_unhandled_confirmed_cp_index: 0, - confirmed_index: 0 + confirmed_index: 0, }; } }; @@ -44,5 +44,5 @@ const getCheckpointQueue = async () => { export default { getConfig, getValueLocked, - getCheckpointQueue + getCheckpointQueue, }; diff --git a/packages/orchestrator/src/apis/services/checkpoint.service.ts b/packages/orchestrator/src/apis/services/checkpoint.service.ts index c3e65c8..bb80a16 100644 --- a/packages/orchestrator/src/apis/services/checkpoint.service.ts +++ b/packages/orchestrator/src/apis/services/checkpoint.service.ts @@ -1,7 +1,10 @@ -import { AppBitcoinQueryClient } from '@oraichain/bitcoin-bridge-contracts-sdk'; -import { fromBinaryTransaction, getBitcoinTransactionTxid } from '@oraichain/bitcoin-bridge-wasm-sdk'; -import env from '../../configs/env'; -import { initQueryClient } from '../../utils/cosmos'; +import { AppBitcoinQueryClient } from "@oraichain/bitcoin-bridge-contracts-sdk"; +import { + fromBinaryTransaction, + getBitcoinTransactionTxid, +} from "@oraichain/bitcoin-bridge-wasm-sdk"; +import env from "../../configs/env"; +import { initQueryClient } from "../../utils/cosmos"; const getConfig = async () => { const client = await initQueryClient(env.cosmos.rpcUrl); @@ -12,16 +15,20 @@ const getConfig = async () => { const getCheckpoint = async (index: number | undefined) => { const client = await initQueryClient(env.cosmos.rpcUrl); const queryClient = new AppBitcoinQueryClient(client, env.cosmos.appBitcoin); - const checkpoint = index ? await queryClient.checkpointByIndex({ index }) : await queryClient.buildingCheckpoint(); + const checkpoint = index + ? await queryClient.checkpointByIndex({ index }) + : await queryClient.buildingCheckpoint(); const checkpointTx = await queryClient.checkpointTx({ index }); - let checkpointTransaction = fromBinaryTransaction(Buffer.from(checkpointTx, 'base64')); + let checkpointTransaction = fromBinaryTransaction( + Buffer.from(checkpointTx, "base64") + ); return { ...checkpoint, transaction: { data: checkpointTransaction, - hash: getBitcoinTransactionTxid(checkpointTransaction) - } + hash: getBitcoinTransactionTxid(checkpointTransaction), + }, }; }; @@ -48,5 +55,5 @@ export default { getCheckpoint, getDepositFee, getWithdrawFee, - getCheckpointFee + getCheckpointFee, }; diff --git a/packages/orchestrator/src/configs/logger.ts b/packages/orchestrator/src/configs/logger.ts index ae4602e..1eaab4f 100644 --- a/packages/orchestrator/src/configs/logger.ts +++ b/packages/orchestrator/src/configs/logger.ts @@ -1,23 +1,34 @@ -import { MessageEmbed, WebhookClient } from 'discord.js'; -import env from './env'; +import { EmbedBuilder, WebhookClient } from "discord.js"; +import env from "./env"; const webhookClient = new WebhookClient({ - url: env.logger.webhookUrl as string + url: env.logger.webhookUrl as string, }); export const logger = (label: string, loglevel?: string): any => { return { - info: (text: string) => console.info(`${new Date().toLocaleString()} [INFO] [${label}]: ${text}`), + info: (text: string) => + console.info(`${new Date().toLocaleString()} [INFO] [${label}]: ${text}`), error: (text: string, error: Error) => { - const embed = new MessageEmbed() - .setTitle(text) - .setDescription(error?.stack || error?.message || 'Something went wrong!') - .setColor('#0099ff') - .setImage('https://cdn.discordapp.com/attachments/1263547562120577058/1296729095975211050/demo.jpg?ex=67135894&is=67120714&hm=6020d73a3063554bd1eca81e81b3c378e3b84196d577c087d7311d53e6ee009a&'); + const embed = new EmbedBuilder({ + title: text, + description: error?.stack || error?.message || "Something went wrong!", + }) + .setColor("#0099ff") + .setImage( + "https://cdn.discordapp.com/attachments/1263547562120577058/1296729095975211050/demo.jpg?ex=67135894&is=67120714&hm=6020d73a3063554bd1eca81e81b3c378e3b84196d577c087d7311d53e6ee009a&" + ); + // const embed = new Embed() + // .setTitle(text) + // .setDescription(error?.stack || error?.message || 'Something went wrong!') + // .setColor('#0099ff') + // .setImage('https://cdn.discordapp.com/attachments/1263547562120577058/1296729095975211050/demo.jpg?ex=67135894&is=67120714&hm=6020d73a3063554bd1eca81e81b3c378e3b84196d577c087d7311d53e6ee009a&'); webhookClient.send({ - embeds: [embed] + embeds: [embed], }); - console.error(`${new Date().toLocaleString()} [ERROR] [${label}]: ${text}, ${error}`); - } + console.error( + `${new Date().toLocaleString()} [ERROR] [${label}]: ${text}, ${error}` + ); + }, }; }; diff --git a/packages/orchestrator/src/utils/cosmos.ts b/packages/orchestrator/src/utils/cosmos.ts index 7535280..6206e68 100644 --- a/packages/orchestrator/src/utils/cosmos.ts +++ b/packages/orchestrator/src/utils/cosmos.ts @@ -32,7 +32,7 @@ export const wrappedExecuteTransaction = async ( export const initQueryClient = async (rpcUrl: string) => { const client = await CosmWasmClient.connect(rpcUrl); - return client; + return client as any; }; export const initSignerClient = async ( diff --git a/yarn.lock b/yarn.lock index 2669123..f2ee6a4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3265,12 +3265,6 @@ __metadata: version: 0.0.0-use.local resolution: "@oraichain/bitcoin-bridge-orchestrator@workspace:packages/orchestrator" dependencies: - "@cosmjs/amino": "npm:0.32.1" - "@cosmjs/cosmwasm-stargate": "npm:0.32.4" - "@cosmjs/crypto": "npm:0.32.4" - "@cosmjs/proto-signing": "npm:0.32.1" - "@cosmjs/stargate": "npm:0.32.4" - "@cosmjs/tendermint-rpc": "npm:0.32.4" "@oraichain/bitcoin-bridge-contracts-build": "workspace:^" "@oraichain/bitcoin-bridge-contracts-sdk": "workspace:^" "@oraichain/bitcoin-bridge-lib-js": "workspace:^" @@ -13322,13 +13316,13 @@ __metadata: resolution: "root@workspace:." dependencies: "@babel/traverse": "npm:7.24.1" - "@cosmjs/amino": "npm:0.31.3" - "@cosmjs/cosmwasm-stargate": "npm:0.31.3" - "@cosmjs/crypto": "npm:0.31.3" + "@cosmjs/amino": "npm:0.32.1" + "@cosmjs/cosmwasm-stargate": "npm:0.32.4" + "@cosmjs/crypto": "npm:0.32.4" "@cosmjs/encoding": "npm:0.31.3" - "@cosmjs/proto-signing": "npm:0.31.3" - "@cosmjs/stargate": "npm:0.31.3" - "@cosmjs/tendermint-rpc": "npm:0.31.3" + "@cosmjs/proto-signing": "npm:0.32.1" + "@cosmjs/stargate": "npm:0.32.4" + "@cosmjs/tendermint-rpc": "npm:0.32.4" "@oraichain/cw-simulate": "npm:^2.8.98" "@oraichain/oraidex-common": "npm:^1.0.10" "@swc/core": "npm:^1.4.11"