Skip to content

Commit

Permalink
github: change node version of cli to 20
Browse files Browse the repository at this point in the history
  • Loading branch information
panoel committed May 31, 2024
1 parent e11487f commit ca87cbf
Show file tree
Hide file tree
Showing 15 changed files with 133 additions and 135 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: "16"
node-version: "20"
- run: |
cd clients/js && make test
make docs
Expand Down
64 changes: 27 additions & 37 deletions clients/js/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -248,16 +248,7 @@ Positionals:
Options:
--help Show help [boolean]
--version Show version number [boolean]
-c, --chain chain name
[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", "rootstock", "scroll", "mantle", "blast",
"xlayer", "linea", "berachain", "seievm", "wormchain", "cosmoshub", "evmos",
"kujira", "neutron", "celestia", "stargaze", "seda", "dymension",
"provenance", "sepolia", "arbitrum_sepolia", "base_sepolia",
"optimism_sepolia", "holesky", "polygon_sepolia"]
-c, --chain chain name [string]
-n, --network Network
[required] [choices: "mainnet", "testnet", "devnet"]
-a, --contract-address Contract to submit VAA to (override config) [string]
Expand Down Expand Up @@ -308,25 +299,25 @@ Options:
--help Show help [boolean]
--version Show version number [boolean]
--src-chain source chain
[required] [choices: "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", "rootstock", "scroll", "mantle", "blast",
"xlayer", "linea", "berachain", "seievm", "wormchain", "cosmoshub", "evmos",
"kujira", "neutron", "celestia", "stargaze", "seda", "dymension",
"provenance", "sepolia", "arbitrum_sepolia", "base_sepolia",
"optimism_sepolia", "holesky", "polygon_sepolia"]
[required] [choices: "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", "Rootstock", "Scroll", "Mantle", "Blast",
"Xlayer", "Linea", "Berachain", "Seievm", "Wormchain", "Cosmoshub", "Evmos",
"Kujira", "Neutron", "Celestia", "Stargaze", "Seda", "Dymension",
"Provenance", "Sepolia", "ArbitrumSepolia", "BaseSepolia", "OptimismSepolia",
"Holesky", "PolygonSepolia"]
--dst-chain destination chain
[required] [choices: "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", "rootstock", "scroll", "mantle", "blast",
"xlayer", "linea", "berachain", "seievm", "wormchain", "cosmoshub", "evmos",
"kujira", "neutron", "celestia", "stargaze", "seda", "dymension",
"provenance", "sepolia", "arbitrum_sepolia", "base_sepolia",
"optimism_sepolia", "holesky", "polygon_sepolia"]
[required] [choices: "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", "Rootstock", "Scroll", "Mantle", "Blast",
"Xlayer", "Linea", "Berachain", "Seievm", "Wormchain", "Cosmoshub", "Evmos",
"Kujira", "Neutron", "Celestia", "Stargaze", "Seda", "Dymension",
"Provenance", "Sepolia", "ArbitrumSepolia", "BaseSepolia", "OptimismSepolia",
"Holesky", "PolygonSepolia"]
--dst-addr destination address [string] [required]
--token-addr token address [string] [default: native token]
--amount token amount [string] [required]
Expand Down Expand Up @@ -354,15 +345,14 @@ Options:
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", "rootstock", "scroll", "mantle", "blast",
"xlayer", "linea", "berachain", "seievm", "wormchain", "cosmoshub", "evmos",
"kujira", "neutron", "celestia", "stargaze", "seda", "dymension",
"provenance", "sepolia", "arbitrum_sepolia", "base_sepolia",
"optimism_sepolia", "holesky", "polygon_sepolia"]
[choices: "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",
"Rootstock", "Scroll", "Mantle", "Blast", "Xlayer", "Linea", "Berachain",
"Seievm", "Wormchain", "Cosmoshub", "Evmos", "Kujira", "Neutron", "Celestia",
"Stargaze", "Seda", "Dymension", "Provenance", "Sepolia", "ArbitrumSepolia",
"BaseSepolia", "OptimismSepolia", "Holesky", "PolygonSepolia"]
tx Source transaction hash [string]

Options:
Expand Down
1 change: 0 additions & 1 deletion clients/js/src/algorand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ export async function transferAlgorand(
if (!key) {
throw Error(`No ${network} key defined for Algorand`);
}
// const contracts = CONTRACTS[network].algorand;
const client = getClient(network, rpc);
const wallet: Account = mnemonicToSecretKey(key);
const CORE_ID = BigInt(parseInt(contracts.coreBridge(network, "Algorand")));
Expand Down
1 change: 0 additions & 1 deletion clients/js/src/aptos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,6 @@ export async function queryRegistrationsAptos(
): Promise<Object> {
const n = NETWORKS[network]["Aptos"];
const client = new AptosClient(n.rpc);
// const contracts = CONTRACTS[network]["aptos"];
let stateObjectId: string | undefined;

switch (module) {
Expand Down
1 change: 0 additions & 1 deletion clients/js/src/chains/generic/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ export const getProviderForChain = <T extends Chain>(
network: Network,
options?: { rpc?: string; [opt: string]: any }
): ChainProvider<T> => {
// const chainName = toChain(chain);
const rpc = options?.rpc ?? NETWORKS[network][chain].rpc;
if (!rpc) {
throw new Error(`No ${network} rpc defined for ${chain}`);
Expand Down
2 changes: 0 additions & 2 deletions clients/js/src/chains/sei/submit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ export const submit = async (
network: Network,
rpc?: string
) => {
// const contracts = CONTRACTS[network].Sei;
const networkInfo = NETWORKS[network].Sei;
rpc = rpc || networkInfo.rpc;
const key = networkInfo.key;
Expand All @@ -37,7 +36,6 @@ export const submit = async (
}

target_contract = core;
// sigh...
execute_msg = {
submit_v_a_a: {
vaa: vaa.toString("base64"),
Expand Down
12 changes: 8 additions & 4 deletions clients/js/src/cmds/evm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@ import {
setStorageAt,
} from "../evm";
import { runCommand, VALIDATOR_OPTIONS } from "../startValidator";
import { assertEVMChain, evm_address, getNetwork } from "../utils";
import {
assertEVMChain,
chainToChain,
evm_address,
getNetwork,
} from "../utils";
import {
assertChain,
chains,
Expand Down Expand Up @@ -88,7 +93,7 @@ export const builder = function (y: typeof yargs) {
.option("chain", {
alias: "c",
describe: "Chain to query",
choices: chains,
type: "string",
demandOption: true,
} as const)
.option("module", {
Expand All @@ -112,8 +117,7 @@ export const builder = function (y: typeof yargs) {
demandOption: false,
}),
async (argv) => {
const chain = argv.chain;
assertChain(chain);
const chain = chainToChain(argv.chain);
assertEVMChain(chain);
const network = getNetwork(argv.network);
const module = argv.module;
Expand Down
17 changes: 8 additions & 9 deletions clients/js/src/cmds/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export const builder = function (y: typeof yargs) {
.option("chain", {
alias: "c",
describe: "Chain to register",
choices: chains,
type: "string",
demandOption: true,
} as const)
.option("contract-address", {
Expand Down Expand Up @@ -108,7 +108,7 @@ export const builder = function (y: typeof yargs) {
.option("chain", {
alias: "c",
describe: "Chain to upgrade",
choices: chains,
type: "string",
demandOption: true,
} as const)
.option("contract-address", {
Expand Down Expand Up @@ -149,7 +149,7 @@ export const builder = function (y: typeof yargs) {
.option("emitter-chain", {
alias: "e",
describe: "Emitter chain of the VAA",
choices: chains,
type: "string",
demandOption: true,
} as const)
.option("emitter-address", {
Expand All @@ -161,7 +161,7 @@ export const builder = function (y: typeof yargs) {
.option("chain", {
alias: "c",
describe: "Token's chain",
choices: chains,
type: "string",
demandOption: true,
} as const)
.option("token-address", {
Expand Down Expand Up @@ -189,9 +189,8 @@ export const builder = function (y: typeof yargs) {
demandOption: true,
}),
(argv) => {
const emitter_chain = argv["emitter-chain"];
const emitter_chain = chainToChain(argv["emitter-chain"]);
const chain = chainToChain(argv.chain);
const emitterChain = chainToChain(emitter_chain);
const payload: TokenBridgeAttestMeta = {
module: "TokenBridge",
type: "AttestMeta",
Expand All @@ -203,8 +202,8 @@ export const builder = function (y: typeof yargs) {
name: argv["name"],
};
const vaa = makeVAA(
toChainId(emitterChain),
parseAddress(emitterChain, argv["emitter-address"]),
toChainId(emitter_chain),
parseAddress(emitter_chain, argv["emitter-address"]),
argv["guardian-secret"].split(","),
payload
);
Expand Down Expand Up @@ -260,7 +259,7 @@ export const builder = function (y: typeof yargs) {
.option("chain", {
alias: "c",
describe: "Chain of Wormhole Relayer contract",
choices: chains,
type: "string",
demandOption: true,
} as const)
.option("delivery-provider-address", {
Expand Down
9 changes: 4 additions & 5 deletions clients/js/src/cmds/info/contract.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import yargs from "yargs";
import { impossible } from "../../vaa";
import { assertChain, chains, contracts } from "@wormhole-foundation/sdk-base";
import { getNetwork } from "../../utils";
import { contracts } from "@wormhole-foundation/sdk-base";
import { chainToChain, getNetwork } from "../../utils";

export const command = "contract <network> <chain> <module>";
export const desc = "Print contract address";
Expand All @@ -14,7 +14,7 @@ export const builder = (y: typeof yargs) =>
} as const)
.positional("chain", {
describe: "Chain to query",
choices: chains,
type: "string",
demandOption: true,
} as const)
.positional("module", {
Expand All @@ -26,8 +26,7 @@ export const handler = async (
argv: Awaited<ReturnType<typeof builder>["argv"]>
) => {
const network = getNetwork(argv.network);
const chain = argv.chain;
assertChain(chain);
const chain = chainToChain(argv.chain);
const module = argv["module"];

let addr: string | undefined;
Expand Down
2 changes: 1 addition & 1 deletion clients/js/src/cmds/info/registrations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const builder = (y: typeof yargs) => {
} as const)
.positional("chain", {
describe: "Chain to query",
choices: chains,
type: "string",
demandOption: true,
} as const)
.positional("module", {
Expand Down
8 changes: 3 additions & 5 deletions clients/js/src/cmds/info/rpc.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import yargs from "yargs";
import { NETWORKS } from "../../consts";
import { assertChain, chains } from "@wormhole-foundation/sdk-base";
import { getNetwork } from "../../utils";
import { chainToChain, getNetwork } from "../../utils";

export const command = "rpc <network> <chain>";
export const desc = "Print RPC address";
Expand All @@ -14,13 +13,12 @@ export const builder = (y: typeof yargs) =>
} as const)
.positional("chain", {
describe: "Chain to query",
choices: chains,
type: "string",
demandOption: true,
} as const);
export const handler = async (
argv: Awaited<ReturnType<typeof builder>["argv"]>
) => {
assertChain(argv.chain);
const network = getNetwork(argv.network);
console.log(NETWORKS[network][argv.chain].rpc);
console.log(NETWORKS[network][chainToChain(argv.chain)].rpc);
};
87 changes: 44 additions & 43 deletions clients/js/src/cmds/status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,50 +8,51 @@ import { Chain, assertChain, contracts } from "@wormhole-foundation/sdk-base";
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: CHAIN_NAME_CHOICES,
// 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 = getNetwork(argv.network);
// const chain = argv.chain;
// assertChain(chain);
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: CHAIN_NAME_CHOICES,
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 = getNetwork(argv.network);
const chain = argv.chain;
assertChain(chain);

// const addr = contracts.relayer.get(network, chain);
// if (!addr) {
// throw new Error(`Wormhole Relayer not deployed on ${chain} in ${network}`);
// }
const addr = contracts.relayer.get(network, chain);
if (!addr) {
throw new Error(`Wormhole Relayer not deployed on ${chain} in ${network}`);
}

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

// const info = await relayer.getWormholeRelayerInfo(chain, argv.tx, {
// environment: network,
// sourceChainProvider,
// targetChainProviders,
// });
// const info = await relayer.getWormholeRelayerInfo(chain, argv.tx, {
// environment: network,
// sourceChainProvider,
// targetChainProviders,
// });

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

0 comments on commit ca87cbf

Please sign in to comment.