Skip to content

Commit

Permalink
update all version
Browse files Browse the repository at this point in the history
  • Loading branch information
perfogic committed Nov 12, 2024
1 parent b64754a commit 4712a7a
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 52 deletions.
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 0 additions & 6 deletions packages/orchestrator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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:^",
Expand Down
12 changes: 6 additions & 6 deletions packages/orchestrator/src/apis/services/bitcoin.service.ts
Original file line number Diff line number Diff line change
@@ -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);
Expand Down Expand Up @@ -30,19 +30,19 @@ 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,
};
}
};

export default {
getConfig,
getValueLocked,
getCheckpointQueue
getCheckpointQueue,
};
25 changes: 16 additions & 9 deletions packages/orchestrator/src/apis/services/checkpoint.service.ts
Original file line number Diff line number Diff line change
@@ -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);
Expand All @@ -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),
},
};
};

Expand All @@ -48,5 +55,5 @@ export default {
getCheckpoint,
getDepositFee,
getWithdrawFee,
getCheckpointFee
getCheckpointFee,
};
35 changes: 23 additions & 12 deletions packages/orchestrator/src/configs/logger.ts
Original file line number Diff line number Diff line change
@@ -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}`
);
},
};
};
2 changes: 1 addition & 1 deletion packages/orchestrator/src/utils/cosmos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
18 changes: 6 additions & 12 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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:^"
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit 4712a7a

Please sign in to comment.