Skip to content

Commit

Permalink
clients/js: let relayer info use v1
Browse files Browse the repository at this point in the history
  • Loading branch information
panoel committed Jul 31, 2024
1 parent d6d2f9c commit c3e5880
Showing 1 changed file with 21 additions and 11 deletions.
32 changes: 21 additions & 11 deletions clients/js/src/cmds/status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,13 @@ import yargs from "yargs";
import { ethers } from "ethers";
import { NETWORKS } from "../consts";
import { chainToChain, getNetwork } from "../utils";
import { Chain, assertChain, contracts } from "@wormhole-foundation/sdk-base";
import { relayer } from "@certusone/wormhole-sdk";
import {
Chain,
assertChain,
chainToChainId,
contracts,
} from "@wormhole-foundation/sdk-base";
import { ChainName, relayer, toChainName } from "@certusone/wormhole-sdk";

export const command = "status <network> <chain> <tx>";
export const desc =
Expand Down Expand Up @@ -40,21 +45,26 @@ export const handler = async (

const sourceRPC = NETWORKS[network][chain].rpc;
const sourceChainProvider = new ethers.providers.JsonRpcProvider(sourceRPC);
const targetChainProviders = new Map<Chain, ethers.providers.Provider>();
const targetChainProviders = new Map<ChainName, ethers.providers.Provider>();
for (const key in NETWORKS[network]) {
targetChainProviders.set(
key as Chain,
toChainName(chainToChainId(key as Chain)),
new ethers.providers.JsonRpcProvider(NETWORKS[network][key as Chain].rpc)
);
}

// TODO: Convert this over to sdkv2
// const info = await relayer.getWormholeRelayerInfo(chain, argv.tx, {
// environment: network,
// sourceChainProvider,
// targetChainProviders,
// });
// console.log(relayer.stringifyWormholeRelayerInfo(info));
const v1ChainName = toChainName(chainToChainId(chain));
const info = await relayer.getWormholeRelayerInfo(v1ChainName, argv.tx, {
environment:
network === "Devnet"
? "DEVNET"
: network === "Testnet"
? "TESTNET"
: "MAINNET",
sourceChainProvider,
targetChainProviders,
});

console.log("Not implemented");
console.log(relayer.stringifyWormholeRelayerInfo(info));
};

0 comments on commit c3e5880

Please sign in to comment.