diff --git a/packages/cw-to-ton/src/relay.ts b/packages/cw-to-ton/src/relay.ts index ac0c0f1..6b175e4 100644 --- a/packages/cw-to-ton/src/relay.ts +++ b/packages/cw-to-ton/src/relay.ts @@ -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 () { @@ -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) => { diff --git a/packages/cw-to-ton/src/utils.ts b/packages/cw-to-ton/src/utils.ts index 0a3857f..6560274 100644 --- a/packages/cw-to-ton/src/utils.ts +++ b/packages/cw-to-ton/src/utils.ts @@ -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, diff --git a/packages/orchestrator/src/index.ts b/packages/orchestrator/src/index.ts index eaa1719..32adbda 100644 --- a/packages/orchestrator/src/index.ts +++ b/packages/orchestrator/src/index.ts @@ -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 {