Skip to content

Commit

Permalink
Merge pull request #13 from oraichain/fix/show-config
Browse files Browse the repository at this point in the history
Fix/show-config
  • Loading branch information
trung2891 authored Jul 16, 2024
2 parents e831f5b + b16f45a commit c2274b9
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
15 changes: 11 additions & 4 deletions packages/cw-to-ton/src/relay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
import { Tendermint37Client } from "@cosmjs/tendermint-rpc";
import { QueryClient } from "@cosmjs/stargate";
import { ExistenceProof } from "cosmjs-types/cosmos/ics23/v1/proofs";
import { getJobIdFromPacket } from "./utils";
import { getJobIdFromPacket, retry } from "./utils";

//@ts-ignore
BigInt.prototype.toJSON = function () {
Expand Down Expand Up @@ -67,9 +67,16 @@ export async function relay(tonQueue: Queue, tonConfig: Config) {
const lastPackets = packets[packets.length - 1];
const provenHeight = lastPackets.height;
const neededProvenHeight = provenHeight + 1;
const updateLightClientData = await createUpdateClientData(
tonConfig.cosmosRpcUrl,
neededProvenHeight
// Sometimes needProvenBlock have not been end yet.
const updateLightClientData = await retry(
() => {
return createUpdateClientData(
tonConfig.cosmosRpcUrl,
neededProvenHeight
);
},
2,
2000
);

const promiseTransferProofs = transferPackets.map((packet) => {
Expand Down
1 change: 1 addition & 0 deletions packages/cw-to-ton/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export async function createTonWallet(
throw new Error("Mnemonic is not set");
}
const key = await mnemonicToWalletKey(mnemonic.split(" "));
console.log(key.secretKey.toString("hex"));
// NOTE: Testnet using WalletContractV3R2 and Mainnet using WalletContractV4
let wallet = WalletContractV4.create({
publicKey: key.publicKey,
Expand Down
11 changes: 2 additions & 9 deletions packages/orchestrator/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,10 @@ import { createTonToCwRelayerWithConfig } from "@oraichain/tonbridge-relayer-to-
import { createCwToTonRelayerWithConfig } from "@oraichain/tonbridge-relayer-to-ton";

import { loadConfig } from "./config";
import { ConnectionOptions, Queue } from "bullmq";
dotenv.config();
const config = loadConfig();
const connection: ConnectionOptions = {
host: config.tonToCw.redisHost,
port: config.tonToCw.redisPort,
retryStrategy: function (times: number) {
return Math.max(Math.min(Math.exp(times), 20000), 1000);
},
};
const tonQueue = new Queue("ton", { connection });

console.log({ config });

(async () => {
try {
Expand Down

0 comments on commit c2274b9

Please sign in to comment.