clients/js: Worm CLI update for seeing status for automatic relay requests (#3155)
* Worm CLI update for seeing status for automatic relay requests * docs update
This commit is contained in:
parent
9b9c5eac5a
commit
2262ac4202
|
@ -309,6 +309,26 @@ Options:
|
|||
-n, --network Network [required] [choices: "mainnet", "testnet", "devnet"]
|
||||
```
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary> status <network> <chain> <tx> </summary>
|
||||
|
||||
```sh
|
||||
Positionals:
|
||||
network Network [choices: "mainnet", "testnet", "devnet"]
|
||||
chain Source chain
|
||||
[choices: "unset", "solana", "ethereum", "terra", "bsc", "polygon",
|
||||
"avalanche", "oasis", "algorand", "aurora", "fantom", "karura", "acala",
|
||||
"klaytn", "celo", "near", "moonbeam", "neon", "terra2", "injective",
|
||||
"osmosis", "sui", "aptos", "arbitrum", "optimism", "gnosis", "pythnet",
|
||||
"xpla", "btc", "base", "sei", "wormchain", "sepolia"]
|
||||
tx Source transaction hash [string]
|
||||
|
||||
Options:
|
||||
--help Show help [boolean]
|
||||
--version Show version number [boolean]
|
||||
```
|
||||
</details>
|
||||
<!--CLI_USAGE-->
|
||||
|
||||
## Examples
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@celo-tools/celo-ethers-wrapper": "^0.1.0",
|
||||
"@certusone/wormhole-sdk": "^0.9.19-beta.0",
|
||||
"@certusone/wormhole-sdk": "^0.9.20",
|
||||
"@cosmjs/encoding": "^0.26.2",
|
||||
"@improbable-eng/grpc-web-node-http-transport": "^0.15.0",
|
||||
"@injectivelabs/networks": "^1.10.7",
|
||||
|
@ -494,9 +494,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@certusone/wormhole-sdk": {
|
||||
"version": "0.9.19-beta.0",
|
||||
"resolved": "https://registry.npmjs.org/@certusone/wormhole-sdk/-/wormhole-sdk-0.9.19-beta.0.tgz",
|
||||
"integrity": "sha512-kON/RWR/LJK9/oUerZ0NYY2CYptwHoQTjC2RAHpDzaM57hQBDOOsKGNVzlwcXdUv8lVSBymijW9+4VXMAQiZqw==",
|
||||
"version": "0.9.20",
|
||||
"resolved": "https://registry.npmjs.org/@certusone/wormhole-sdk/-/wormhole-sdk-0.9.20.tgz",
|
||||
"integrity": "sha512-sHmvqK0FYUa+NCO+kqPQ7CkPrFnl40pGQ8pmp3KW/xn3ECz7ECA3M1/07UvMNzcifbHwM1nmO0QhkEAjREB8wg==",
|
||||
"dependencies": {
|
||||
"@certusone/wormhole-sdk-proto-web": "0.0.6",
|
||||
"@certusone/wormhole-sdk-wasm": "^0.0.1",
|
||||
|
@ -505,7 +505,7 @@
|
|||
"@project-serum/anchor": "^0.25.0",
|
||||
"@solana/spl-token": "^0.3.5",
|
||||
"@solana/web3.js": "^1.66.2",
|
||||
"@terra-money/terra.js": "^3.1.3",
|
||||
"@terra-money/terra.js": "3.1.9",
|
||||
"@xpla/xpla.js": "^0.2.1",
|
||||
"algosdk": "^1.15.0",
|
||||
"aptos": "1.5.0",
|
||||
|
@ -8517,9 +8517,9 @@
|
|||
"requires": {}
|
||||
},
|
||||
"@certusone/wormhole-sdk": {
|
||||
"version": "0.9.19-beta.0",
|
||||
"resolved": "https://registry.npmjs.org/@certusone/wormhole-sdk/-/wormhole-sdk-0.9.19-beta.0.tgz",
|
||||
"integrity": "sha512-kON/RWR/LJK9/oUerZ0NYY2CYptwHoQTjC2RAHpDzaM57hQBDOOsKGNVzlwcXdUv8lVSBymijW9+4VXMAQiZqw==",
|
||||
"version": "0.9.20",
|
||||
"resolved": "https://registry.npmjs.org/@certusone/wormhole-sdk/-/wormhole-sdk-0.9.20.tgz",
|
||||
"integrity": "sha512-sHmvqK0FYUa+NCO+kqPQ7CkPrFnl40pGQ8pmp3KW/xn3ECz7ECA3M1/07UvMNzcifbHwM1nmO0QhkEAjREB8wg==",
|
||||
"requires": {
|
||||
"@certusone/wormhole-sdk-proto-web": "0.0.6",
|
||||
"@certusone/wormhole-sdk-wasm": "^0.0.1",
|
||||
|
@ -8531,7 +8531,7 @@
|
|||
"@project-serum/anchor": "^0.25.0",
|
||||
"@solana/spl-token": "^0.3.5",
|
||||
"@solana/web3.js": "^1.66.2",
|
||||
"@terra-money/terra.js": "^3.1.3",
|
||||
"@terra-money/terra.js": "3.1.9",
|
||||
"@xpla/xpla.js": "^0.2.1",
|
||||
"algosdk": "^1.15.0",
|
||||
"aptos": "1.5.0",
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
],
|
||||
"dependencies": {
|
||||
"@celo-tools/celo-ethers-wrapper": "^0.1.0",
|
||||
"@certusone/wormhole-sdk": "^0.9.19-beta.0",
|
||||
"@certusone/wormhole-sdk": "^0.9.20",
|
||||
"@cosmjs/encoding": "^0.26.2",
|
||||
"@improbable-eng/grpc-web-node-http-transport": "^0.15.0",
|
||||
"@injectivelabs/networks": "^1.10.7",
|
||||
|
|
|
@ -0,0 +1,59 @@
|
|||
import {
|
||||
CHAINS,
|
||||
ChainName,
|
||||
assertChain,
|
||||
|
||||
} from "@certusone/wormhole-sdk/lib/esm/utils/consts";
|
||||
import {
|
||||
relayer,
|
||||
Network
|
||||
} from "@certusone/wormhole-sdk"
|
||||
import yargs from "yargs";
|
||||
import { CONTRACTS, NETWORKS } from "../consts";
|
||||
import { assertNetwork } from "../utils";
|
||||
import { impossible } from "../vaa";
|
||||
import { ethers } from "ethers";
|
||||
|
||||
export const command = "status <network> <chain> <tx>";
|
||||
export const desc = "Prints information about the automatic delivery initiated on the specified network, chain, and tx";
|
||||
export const builder = (y: typeof yargs) =>
|
||||
y
|
||||
.positional("network", {
|
||||
describe: "Network",
|
||||
choices: ["mainnet", "testnet", "devnet"],
|
||||
demandOption: true,
|
||||
} as const)
|
||||
.positional("chain", {
|
||||
describe: "Source chain",
|
||||
choices: Object.keys(CHAINS) as ChainName[],
|
||||
demandOption: true,
|
||||
} as const)
|
||||
.positional("tx", {
|
||||
describe: "Source transaction hash",
|
||||
type: "string",
|
||||
demandOption: true,
|
||||
} as const);
|
||||
export const handler = async (
|
||||
argv: Awaited<ReturnType<typeof builder>["argv"]>
|
||||
) => {
|
||||
const network = argv.network.toUpperCase();
|
||||
assertNetwork(network);
|
||||
const chain = argv.chain;
|
||||
assertChain(chain);
|
||||
|
||||
const addr = relayer.RELAYER_CONTRACTS[network][chain]?.wormholeRelayerAddress;
|
||||
if (!addr) {
|
||||
throw new Error(`Wormhole Relayer not deployed on ${chain} in ${network}`);
|
||||
}
|
||||
|
||||
const sourceRPC = NETWORKS[network as Network][chain as ChainName].rpc;
|
||||
const sourceChainProvider = new ethers.providers.JsonRpcProvider(sourceRPC);
|
||||
const targetChainProviders = new Map<ChainName, ethers.providers.Provider>();
|
||||
for(const key in NETWORKS[network]) {
|
||||
targetChainProviders.set(key as ChainName, new ethers.providers.JsonRpcProvider(NETWORKS[network][key as ChainName].rpc));
|
||||
}
|
||||
|
||||
const info = await relayer.getWormholeRelayerInfo(chain, argv.tx, {environment: network, sourceChainProvider, targetChainProviders});
|
||||
|
||||
console.log(relayer.stringifyWormholeRelayerInfo(info));
|
||||
};
|
|
@ -16,6 +16,7 @@ import * as recover from "./cmds/recover";
|
|||
import * as submit from "./cmds/submit";
|
||||
import * as sui from "./cmds/sui";
|
||||
import * as verifyVaa from "./cmds/verifyVaa";
|
||||
import * as status from "./cmds/status";
|
||||
|
||||
|
||||
const MD_TAG = "<!--CLI_USAGE-->";
|
||||
|
@ -40,6 +41,7 @@ async function getHelpText(cmd: any): Promise<string> {
|
|||
submit,
|
||||
sui,
|
||||
verifyVaa,
|
||||
status
|
||||
];
|
||||
|
||||
const helpOutputs: Buffer[] = [];
|
||||
|
|
|
@ -17,6 +17,7 @@ import * as submit from "./cmds/submit";
|
|||
import * as sui from "./cmds/sui";
|
||||
import * as transfer from "./cmds/transfer";
|
||||
import * as verifyVaa from "./cmds/verifyVaa";
|
||||
import * as status from "./cmds/status";
|
||||
|
||||
// Note: When adding another subcommand here, please be sure to also include it
|
||||
// in the `cmds` array in `docs.ts` so it is properly documented.
|
||||
|
@ -35,5 +36,6 @@ yargs(hideBin(process.argv))
|
|||
.command(sui)
|
||||
.command(transfer)
|
||||
.command(verifyVaa)
|
||||
.command(status)
|
||||
.strict()
|
||||
.demandCommand().argv;
|
||||
|
|
Loading…
Reference in New Issue