clients/js: refactor worm info
This commit is contained in:
parent
7bc96a1ebc
commit
4f13263089
|
@ -36,9 +36,9 @@ else
|
|||
usage
|
||||
fi
|
||||
|
||||
WORMHOLE_ADDR=$(worm contract "$NETWORK" aptos Core)
|
||||
TOKEN_BRIDGE_ADDR=$(worm contract "$NETWORK" aptos TokenBridge)
|
||||
NFT_BRIDGE_ADDR=$(worm contract "$NETWORK" aptos NFTBridge)
|
||||
WORMHOLE_ADDR=$(worm info contract "$NETWORK" aptos Core)
|
||||
TOKEN_BRIDGE_ADDR=$(worm info contract "$NETWORK" aptos TokenBridge)
|
||||
NFT_BRIDGE_ADDR=$(worm info contract "$NETWORK" aptos NFTBridge)
|
||||
|
||||
NAMED_ADDRS="wormhole=$WORMHOLE_ADDR,deployer=$DEPLOYER_ADDR,token_bridge=$TOKEN_BRIDGE_ADDR,nft_bridge=$NFT_BRIDGE_ADDR"
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ done
|
|||
VAAS=$(set | grep "REGISTER_.*_NFT_BRIDGE_VAA" | grep -v APTOS | cut -d '=' -f1)
|
||||
|
||||
# TODO: this will not be needed when the sdk is published
|
||||
NFT_BRIDGE_ADDR=$(worm contract devnet aptos NFTBridge)
|
||||
NFT_BRIDGE_ADDR=$(worm info contract devnet aptos NFTBridge)
|
||||
|
||||
# 5. use 'worm' to submit each registration VAA
|
||||
for VAA in $VAAS
|
||||
|
|
|
@ -28,9 +28,9 @@ else
|
|||
usage
|
||||
fi
|
||||
|
||||
WORMHOLE_ADDR=$(worm contract "$NETWORK" aptos Core)
|
||||
TOKEN_BRIDGE_ADDR=$(worm contract "$NETWORK" aptos TokenBridge)
|
||||
NFT_BRIDGE_ADDR=$(worm contract "$NETWORK" aptos NFTBridge)
|
||||
WORMHOLE_ADDR=$(worm info contract "$NETWORK" aptos Core)
|
||||
TOKEN_BRIDGE_ADDR=$(worm info contract "$NETWORK" aptos TokenBridge)
|
||||
NFT_BRIDGE_ADDR=$(worm info contract "$NETWORK" aptos NFTBridge)
|
||||
|
||||
NAMED_ADDRS="wormhole=$WORMHOLE_ADDR,deployer=$DEPLOYER_ADDR,token_bridge=$TOKEN_BRIDGE_ADDR,nft_bridge=$NFT_BRIDGE_ADDR"
|
||||
|
||||
|
@ -55,7 +55,7 @@ VAA=$(worm generate upgrade -c aptos -a "$HASH" -m "$MODULE" -g $GUARDIAN_SECRET
|
|||
echo "Submitting VAA: $VAA"
|
||||
|
||||
# TODO: --contract-address should not be neded after the sdk has these addresses
|
||||
CONTRACT_ADDR=$(worm contract "$NETWORK" aptos "$MODULE")
|
||||
CONTRACT_ADDR=$(worm info contract "$NETWORK" aptos "$MODULE")
|
||||
worm submit --network "$NETWORK" "$VAA" --contract-address "$CONTRACT_ADDR"
|
||||
worm aptos upgrade $DIR --network "$NETWORK" --contract-address "$CONTRACT_ADDR" --named-addresses "$NAMED_ADDRS"
|
||||
worm aptos migrate --network "$NETWORK" --contract-address "$CONTRACT_ADDR"
|
||||
|
|
|
@ -38,7 +38,13 @@ export async function execute_algorand(
|
|||
|
||||
let target_contract: string;
|
||||
switch (payload.module) {
|
||||
case "Core":
|
||||
case "Core": {
|
||||
if (!contracts.core) {
|
||||
throw new Error(
|
||||
`Core bridge address not defined for Algorand ${network}`
|
||||
);
|
||||
}
|
||||
|
||||
target_contract = contracts.core;
|
||||
switch (payload.type) {
|
||||
case "GuardianSetUpgrade":
|
||||
|
@ -52,14 +58,17 @@ export async function execute_algorand(
|
|||
default:
|
||||
impossible(payload);
|
||||
}
|
||||
|
||||
break;
|
||||
case "NFTBridge":
|
||||
if (contracts.nft_bridge === undefined) {
|
||||
}
|
||||
case "NFTBridge": {
|
||||
if (!contracts.nft_bridge) {
|
||||
// NOTE: this code can safely be removed once the algorand NFT bridge is
|
||||
// released, but it's fine for it to stay, as the condition will just be
|
||||
// skipped once 'contracts.nft_bridge' is defined
|
||||
throw new Error("NFT bridge not supported yet for algorand");
|
||||
throw new Error("NFT bridge not supported yet for Algorand");
|
||||
}
|
||||
|
||||
target_contract = contracts.nft_bridge;
|
||||
switch (payload.type) {
|
||||
case "ContractUpgrade":
|
||||
|
@ -76,11 +85,16 @@ export async function execute_algorand(
|
|||
default:
|
||||
impossible(payload);
|
||||
}
|
||||
|
||||
break;
|
||||
case "TokenBridge":
|
||||
if (contracts.token_bridge === undefined) {
|
||||
throw new Error("contracts.token_bridge is undefined");
|
||||
}
|
||||
case "TokenBridge": {
|
||||
if (!contracts.token_bridge) {
|
||||
throw new Error(
|
||||
`Token bridge address not defined for Algorand ${network}`
|
||||
);
|
||||
}
|
||||
|
||||
target_contract = contracts.token_bridge;
|
||||
switch (payload.type) {
|
||||
case "ContractUpgrade":
|
||||
|
@ -102,7 +116,9 @@ export async function execute_algorand(
|
|||
default:
|
||||
impossible(payload);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
target_contract = impossible(payload);
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ import {
|
|||
RPC_OPTIONS,
|
||||
} from "../consts";
|
||||
import { NETWORKS } from "../networks";
|
||||
import { runCommand, VALIDATOR_OPTIONS } from "../start-validator";
|
||||
import { runCommand, VALIDATOR_OPTIONS } from "../startValidator";
|
||||
import { assertNetwork, checkBinary, evm_address, hex } from "../utils";
|
||||
|
||||
const APTOS_NODE_URL = "http://0.0.0.0:8080/v1";
|
||||
|
|
|
@ -22,6 +22,7 @@ import { Other } from "@certusone/wormhole-sdk/lib/esm/vaa";
|
|||
import axios from "axios";
|
||||
import { ethers } from "ethers";
|
||||
import yargs from "yargs";
|
||||
import { NETWORK_OPTIONS } from "../consts";
|
||||
import { NETWORKS } from "../networks";
|
||||
import { assertNetwork, Network } from "../utils";
|
||||
import { parse, Payload, serialiseVAA, sign, Signature, VAA } from "../vaa";
|
||||
|
@ -36,12 +37,7 @@ export const builder = (y: typeof yargs) =>
|
|||
type: "string",
|
||||
demandOption: true,
|
||||
})
|
||||
.option("network", {
|
||||
alias: "n",
|
||||
describe: "network",
|
||||
choices: ["mainnet", "testnet", "devnet"],
|
||||
demandOption: true,
|
||||
} as const)
|
||||
.option("network", NETWORK_OPTIONS)
|
||||
.option("guardian-set-index", {
|
||||
alias: "gsi",
|
||||
describe: "guardian set index",
|
|
@ -9,6 +9,7 @@ import {
|
|||
import { ethers } from "ethers";
|
||||
import { homedir } from "os";
|
||||
import yargs from "yargs";
|
||||
import { NETWORK_OPTIONS } from "../consts";
|
||||
import {
|
||||
getImplementation,
|
||||
hijack_evm,
|
||||
|
@ -16,7 +17,7 @@ import {
|
|||
setStorageAt,
|
||||
} from "../evm";
|
||||
import { NETWORKS } from "../networks";
|
||||
import { runCommand, VALIDATOR_OPTIONS } from "../start-validator";
|
||||
import { runCommand, VALIDATOR_OPTIONS } from "../startValidator";
|
||||
import { assertNetwork, evm_address } from "../utils";
|
||||
|
||||
export const command = "evm";
|
||||
|
@ -95,24 +96,16 @@ export const builder = function (y: typeof yargs) {
|
|||
.option("chain", {
|
||||
alias: "c",
|
||||
describe: "Chain to query",
|
||||
type: "string",
|
||||
choices: Object.keys(CHAINS),
|
||||
choices: Object.keys(CHAINS) as (keyof typeof CHAINS)[],
|
||||
demandOption: true,
|
||||
})
|
||||
} as const)
|
||||
.option("module", {
|
||||
alias: "m",
|
||||
describe: "Module to query",
|
||||
type: "string",
|
||||
choices: ["Core", "NFTBridge", "TokenBridge"],
|
||||
demandOption: true,
|
||||
})
|
||||
.option("network", {
|
||||
alias: "n",
|
||||
describe: "network",
|
||||
type: "string",
|
||||
choices: ["mainnet", "testnet", "devnet"],
|
||||
demandOption: true,
|
||||
})
|
||||
} as const)
|
||||
.option("network", NETWORK_OPTIONS)
|
||||
.option("contract-address", {
|
||||
alias: "a",
|
||||
describe: "Contract to query (override config)",
|
||||
|
@ -127,17 +120,18 @@ export const builder = function (y: typeof yargs) {
|
|||
demandOption: false,
|
||||
}),
|
||||
async (argv) => {
|
||||
assertChain(argv["chain"]);
|
||||
assertEVMChain(argv["chain"]);
|
||||
const chain = argv.chain;
|
||||
assertChain(chain);
|
||||
assertEVMChain(chain);
|
||||
const network = argv.network.toUpperCase();
|
||||
assertNetwork(network);
|
||||
const module = argv["module"] as "Core" | "NFTBridge" | "TokenBridge";
|
||||
const rpc = argv["rpc"] ?? NETWORKS[network][argv["chain"]].rpc;
|
||||
const module = argv.module;
|
||||
const rpc = argv.rpc ?? NETWORKS[network][chain].rpc;
|
||||
if (argv["implementation-only"]) {
|
||||
console.log(
|
||||
await getImplementation(
|
||||
network,
|
||||
argv["chain"],
|
||||
chain,
|
||||
module,
|
||||
argv["contract-address"],
|
||||
rpc
|
||||
|
@ -148,7 +142,7 @@ export const builder = function (y: typeof yargs) {
|
|||
JSON.stringify(
|
||||
await query_contract_evm(
|
||||
network,
|
||||
argv["chain"],
|
||||
chain,
|
||||
module,
|
||||
argv["contract-address"],
|
||||
rpc
|
||||
|
@ -186,7 +180,7 @@ export const builder = function (y: typeof yargs) {
|
|||
}),
|
||||
async (argv) => {
|
||||
const guardian_addresses = argv["guardian-address"].split(",");
|
||||
let rpc = argv["rpc"] ?? NETWORKS.DEVNET.ethereum.rpc;
|
||||
let rpc = argv.rpc ?? NETWORKS.DEVNET.ethereum.rpc;
|
||||
await hijack_evm(
|
||||
rpc,
|
||||
argv["core-contract-address"],
|
||||
|
|
|
@ -67,7 +67,7 @@ export const builder = function (y: typeof yargs) {
|
|||
.option("chain", {
|
||||
alias: "c",
|
||||
describe: "Chain to register",
|
||||
choices: Object.keys(CHAINS),
|
||||
choices: Object.keys(CHAINS) as (keyof typeof CHAINS)[],
|
||||
demandOption: true,
|
||||
} as const)
|
||||
.option("contract-address", {
|
||||
|
@ -113,7 +113,7 @@ export const builder = function (y: typeof yargs) {
|
|||
.option("chain", {
|
||||
alias: "c",
|
||||
describe: "Chain to upgrade",
|
||||
choices: Object.keys(CHAINS),
|
||||
choices: Object.keys(CHAINS) as (keyof typeof CHAINS)[],
|
||||
demandOption: true,
|
||||
} as const)
|
||||
.option("contract-address", {
|
||||
|
@ -154,7 +154,7 @@ export const builder = function (y: typeof yargs) {
|
|||
.option("emitter-chain", {
|
||||
alias: "e",
|
||||
describe: "Emitter chain of the VAA",
|
||||
choices: Object.keys(CHAINS),
|
||||
choices: Object.keys(CHAINS) as (keyof typeof CHAINS)[],
|
||||
demandOption: true,
|
||||
} as const)
|
||||
.option("emitter-address", {
|
||||
|
@ -166,10 +166,9 @@ export const builder = function (y: typeof yargs) {
|
|||
.option("chain", {
|
||||
alias: "c",
|
||||
describe: "Token's chain",
|
||||
type: "string",
|
||||
choices: Object.keys(CHAINS),
|
||||
choices: Object.keys(CHAINS) as (keyof typeof CHAINS)[],
|
||||
demandOption: true,
|
||||
})
|
||||
} as const)
|
||||
.option("token-address", {
|
||||
alias: "a",
|
||||
describe: "Token's address",
|
||||
|
|
|
@ -12,7 +12,7 @@ export const builder = (y: typeof yargs) => {
|
|||
return y.positional("chain", {
|
||||
describe: "Chain to query",
|
||||
type: "string",
|
||||
choices: Object.keys(CHAINS),
|
||||
choices: Object.keys(CHAINS) as (keyof typeof CHAINS)[],
|
||||
demandOption: true,
|
||||
} as const);
|
||||
};
|
|
@ -3,10 +3,9 @@ import {
|
|||
assertChain,
|
||||
} from "@certusone/wormhole-sdk/lib/esm/utils/consts";
|
||||
import yargs from "yargs";
|
||||
import { CONTRACTS } from "../consts";
|
||||
import { getEmitterAddress } from "../emitter";
|
||||
import { assertNetwork } from "../utils";
|
||||
import { impossible } from "../vaa";
|
||||
import { CONTRACTS } from "../../consts";
|
||||
import { assertNetwork } from "../../utils";
|
||||
import { impossible } from "../../vaa";
|
||||
|
||||
export const command = "contract <network> <chain> <module>";
|
||||
export const desc = "Print contract address";
|
||||
|
@ -19,29 +18,23 @@ export const builder = (y: typeof yargs) =>
|
|||
} as const)
|
||||
.positional("chain", {
|
||||
describe: "Chain to query",
|
||||
choices: Object.keys(CHAINS),
|
||||
choices: Object.keys(CHAINS) as (keyof typeof CHAINS)[],
|
||||
demandOption: true,
|
||||
} as const)
|
||||
.positional("module", {
|
||||
describe: "Module to query",
|
||||
choices: ["Core", "NFTBridge", "TokenBridge"],
|
||||
demandOption: true,
|
||||
} as const)
|
||||
.option("emitter", {
|
||||
alias: "e",
|
||||
describe: "Print in emitter address format",
|
||||
type: "boolean",
|
||||
default: false,
|
||||
demandOption: false,
|
||||
});
|
||||
} as const);
|
||||
export const handler = async (
|
||||
argv: Awaited<ReturnType<typeof builder>["argv"]>
|
||||
) => {
|
||||
assertChain(argv["chain"]);
|
||||
const network = argv.network.toUpperCase();
|
||||
assertNetwork(network);
|
||||
const chain = argv["chain"];
|
||||
assertChain(chain);
|
||||
const module = argv["module"];
|
||||
|
||||
let addr: string | undefined;
|
||||
switch (module) {
|
||||
case "Core":
|
||||
|
@ -66,9 +59,5 @@ export const handler = async (
|
|||
throw new Error(`${module} not deployed on ${chain}`);
|
||||
}
|
||||
|
||||
if (argv["emitter"]) {
|
||||
addr = await getEmitterAddress(chain, addr);
|
||||
}
|
||||
|
||||
console.log(addr);
|
||||
};
|
|
@ -3,19 +3,19 @@ import {
|
|||
assertChain,
|
||||
} from "@certusone/wormhole-sdk/lib/esm/utils/consts";
|
||||
import yargs from "yargs";
|
||||
import { getEmitterAddress } from "../emitter";
|
||||
import { getEmitterAddress } from "../../emitter";
|
||||
|
||||
export const command = "convert-to-emitter <chain> <address-to-convert>";
|
||||
export const command = "emitter <chain> <address>";
|
||||
export const desc = "Print address in emitter address format";
|
||||
export const builder = (y: typeof yargs) =>
|
||||
y
|
||||
.positional("chain", {
|
||||
describe: "Chain to query",
|
||||
type: "string",
|
||||
choices: Object.keys(CHAINS),
|
||||
choices: Object.keys(CHAINS) as (keyof typeof CHAINS)[],
|
||||
demandOption: true,
|
||||
} as const)
|
||||
.positional("address-to-convert", {
|
||||
.positional("address", {
|
||||
describe: "Address to be converted to emitter address format",
|
||||
type: "string",
|
||||
demandOption: true,
|
||||
|
@ -23,8 +23,6 @@ export const builder = (y: typeof yargs) =>
|
|||
export const handler = async (
|
||||
argv: Awaited<ReturnType<typeof builder>["argv"]>
|
||||
) => {
|
||||
assertChain(argv["chain"]);
|
||||
console.log(
|
||||
await getEmitterAddress(argv["chain"], argv["address-to-convert"])
|
||||
);
|
||||
assertChain(argv.chain);
|
||||
console.log(await getEmitterAddress(argv.chain, argv.address));
|
||||
};
|
|
@ -1,16 +1,12 @@
|
|||
import yargs from "yargs";
|
||||
import * as chainId from "./chainId";
|
||||
import * as contractAddress from "./contractAddress";
|
||||
import * as convertToEmitter from "./convert-to-emitter";
|
||||
import * as contract from "./contract";
|
||||
import * as emitter from "./emitter";
|
||||
import * as rpc from "./rpc";
|
||||
|
||||
export const command = "info";
|
||||
export const desc = "Contract, chain, rpc and address information utilities";
|
||||
// Imports modules logic from root commands, more info here -> https://github.com/yargs/yargs/blob/main/docs/advanced.md#providing-a-command-module
|
||||
export const builder = (y: typeof yargs) =>
|
||||
y
|
||||
.command(chainId)
|
||||
.command(contractAddress)
|
||||
.command(convertToEmitter)
|
||||
.command(rpc);
|
||||
y.command(chainId).command(contract).command(emitter).command(rpc);
|
||||
export const handler = () => {};
|
|
@ -3,8 +3,8 @@ import {
|
|||
assertChain,
|
||||
} from "@certusone/wormhole-sdk/lib/esm/utils/consts";
|
||||
import yargs from "yargs";
|
||||
import { NETWORKS } from "../networks";
|
||||
import { assertNetwork } from "../utils";
|
||||
import { NETWORKS } from "../../networks";
|
||||
import { assertNetwork } from "../../utils";
|
||||
|
||||
export const command = "rpc <network> <chain>";
|
||||
export const desc = "Print RPC address";
|
||||
|
@ -17,7 +17,7 @@ export const builder = (y: typeof yargs) =>
|
|||
} as const)
|
||||
.positional("chain", {
|
||||
describe: "Chain to query",
|
||||
choices: Object.keys(CHAINS),
|
||||
choices: Object.keys(CHAINS) as (keyof typeof CHAINS)[],
|
||||
demandOption: true,
|
||||
} as const);
|
||||
export const handler = async (
|
|
@ -97,7 +97,7 @@ export const builder = function (y: typeof yargs) {
|
|||
|
||||
const masterKey = KeyPair.fromString(key);
|
||||
const keyStore = new InMemoryKeyStore();
|
||||
keyStore.setKey(networkId, argv["account"], masterKey);
|
||||
keyStore.setKey(networkId, argv.account, masterKey);
|
||||
const near = await connect({
|
||||
deps: {
|
||||
keyStore,
|
||||
|
@ -107,7 +107,7 @@ export const builder = function (y: typeof yargs) {
|
|||
headers: {},
|
||||
});
|
||||
|
||||
const masterAccount = new Account(near.connection, argv["account"]);
|
||||
const masterAccount = new Account(near.connection, argv.account);
|
||||
const result = await masterAccount.functionCall({
|
||||
contractId: target,
|
||||
methodName: "update_contract",
|
||||
|
@ -169,7 +169,7 @@ export const builder = function (y: typeof yargs) {
|
|||
|
||||
const masterKey = KeyPair.fromString(key);
|
||||
const keyStore = new InMemoryKeyStore();
|
||||
keyStore.setKey(networkId, argv["account"], masterKey);
|
||||
keyStore.setKey(networkId, argv.account, masterKey);
|
||||
keyStore.setKey(networkId, target, masterKey);
|
||||
|
||||
const near = await connect({
|
||||
|
@ -180,13 +180,13 @@ export const builder = function (y: typeof yargs) {
|
|||
nodeUrl: rpc,
|
||||
headers: {},
|
||||
});
|
||||
const masterAccount = new Account(near.connection, argv["account"]);
|
||||
const masterAccount = new Account(near.connection, argv.account);
|
||||
const targetAccount = new Account(near.connection, target);
|
||||
console.log({ ...argv, key, rpc, target });
|
||||
|
||||
if (argv.attach) {
|
||||
console.log(
|
||||
`Sending money: ${target} from ${argv["account"]} being sent ${argv["attach"]}`
|
||||
`Sending money: ${target} from ${argv.account} being sent ${argv.attach}`
|
||||
);
|
||||
console.log(
|
||||
await masterAccount.sendMoney(target, new BN(argv.attach))
|
||||
|
@ -195,7 +195,7 @@ export const builder = function (y: typeof yargs) {
|
|||
|
||||
console.log("deploying contract");
|
||||
console.log(
|
||||
await targetAccount.deployContract(readFileSync(argv["file"]))
|
||||
await targetAccount.deployContract(readFileSync(argv.file))
|
||||
);
|
||||
}
|
||||
);
|
||||
|
|
|
@ -21,6 +21,6 @@ export const handler = async (
|
|||
argv: Awaited<ReturnType<typeof builder>["argv"]>
|
||||
) => {
|
||||
console.log(
|
||||
ethers.utils.recoverAddress(hex(argv["digest"]), hex(argv["signature"]))
|
||||
ethers.utils.recoverAddress(hex(argv.digest), hex(argv.signature))
|
||||
);
|
||||
};
|
||||
|
|
|
@ -10,6 +10,7 @@ import {
|
|||
import yargs from "yargs";
|
||||
import { execute_algorand } from "../algorand";
|
||||
import { execute_aptos } from "../aptos";
|
||||
import { NETWORK_OPTIONS } from "../consts";
|
||||
import { execute_evm } from "../evm";
|
||||
import { execute_injective } from "../injective";
|
||||
import { execute_near } from "../near";
|
||||
|
@ -33,15 +34,10 @@ export const builder = (y: typeof yargs) =>
|
|||
.option("chain", {
|
||||
alias: "c",
|
||||
describe: "chain name",
|
||||
choices: Object.keys(CHAINS),
|
||||
choices: Object.keys(CHAINS) as (keyof typeof CHAINS)[],
|
||||
demandOption: false,
|
||||
} as const)
|
||||
.option("network", {
|
||||
alias: "n",
|
||||
describe: "network",
|
||||
choices: ["mainnet", "testnet", "devnet"],
|
||||
demandOption: true,
|
||||
} as const)
|
||||
.option("network", NETWORK_OPTIONS)
|
||||
.option("contract-address", {
|
||||
alias: "a",
|
||||
describe: "Contract to submit VAA to (override config)",
|
||||
|
@ -61,7 +57,6 @@ export const handler = async (
|
|||
const parsed_vaa = parse(buf);
|
||||
|
||||
assertKnownPayload(parsed_vaa);
|
||||
|
||||
console.log(parsed_vaa.payload);
|
||||
|
||||
const network = argv.network.toUpperCase();
|
||||
|
@ -87,7 +82,7 @@ export const handler = async (
|
|||
const vaa_chain = toChainName(vaa_chain_id);
|
||||
|
||||
// get chain from command line arg
|
||||
const cli_chain = argv["chain"];
|
||||
const cli_chain = argv.chain;
|
||||
|
||||
let chain: ChainName;
|
||||
if (cli_chain !== undefined) {
|
||||
|
@ -113,7 +108,7 @@ export const handler = async (
|
|||
network,
|
||||
chain,
|
||||
argv["contract-address"],
|
||||
argv["rpc"]
|
||||
argv.rpc
|
||||
);
|
||||
} else if (isTerraChain(chain)) {
|
||||
await execute_terra(parsed_vaa.payload, buf, network, chain);
|
||||
|
@ -136,14 +131,14 @@ export const handler = async (
|
|||
} else if (chain === "osmosis") {
|
||||
throw Error("OSMOSIS is not supported yet");
|
||||
} else if (chain === "sui") {
|
||||
await submitSui(parsed_vaa.payload, buf, network, argv["rpc"]);
|
||||
await submitSui(parsed_vaa.payload, buf, network, argv.rpc);
|
||||
} else if (chain === "aptos") {
|
||||
await execute_aptos(
|
||||
parsed_vaa.payload,
|
||||
buf,
|
||||
network,
|
||||
argv["contract-address"],
|
||||
argv["rpc"]
|
||||
argv.rpc
|
||||
);
|
||||
} else if (chain === "wormchain") {
|
||||
throw Error("Wormchain is not supported yet");
|
||||
|
|
|
@ -3,7 +3,7 @@ import { Yargs } from "../Yargs";
|
|||
import { addBuildCommands } from "./build";
|
||||
import { addDeployCommands } from "./deploy";
|
||||
import { addInitCommands } from "./init";
|
||||
import { addPublishMessageCommands } from "./publish_message";
|
||||
import { addPublishMessageCommands } from "./publishMessage";
|
||||
import { addSetupCommands } from "./setup";
|
||||
import { addUtilsCommands } from "./utils";
|
||||
|
||||
|
|
|
@ -61,9 +61,9 @@ export const addPublishMessageCommands: YargsAddCommandsFn = (
|
|||
const network = argv.network.toUpperCase();
|
||||
assertNetwork(network);
|
||||
const packageId = argv["package-id"];
|
||||
const stateObjectId = argv["state"];
|
||||
const stateObjectId = argv.state;
|
||||
const wormholeStateObjectId = argv["wormhole-state"];
|
||||
const message = argv["message"];
|
||||
const message = argv.message;
|
||||
const privateKey = argv["private-key"];
|
||||
const rpc = argv.rpc ?? NETWORKS[network].sui.rpc;
|
||||
|
|
@ -84,11 +84,10 @@ export const addUtilsCommands: YargsAddCommandsFn = (y: typeof yargs) =>
|
|||
.option("network", {
|
||||
alias: "n",
|
||||
describe: "Network",
|
||||
type: "string",
|
||||
choices: ["mainnet", "testnet", "devnet"],
|
||||
default: "devnet",
|
||||
demandOption: false,
|
||||
})
|
||||
} as const)
|
||||
.option("rpc", RPC_OPTIONS),
|
||||
async (argv) => {
|
||||
const network = argv.network.toUpperCase();
|
||||
|
|
|
@ -4,6 +4,7 @@ import { Implementation__factory } from "@certusone/wormhole-sdk/lib/esm/ethers-
|
|||
import { CONTRACTS } from "@certusone/wormhole-sdk/lib/esm/utils/consts";
|
||||
import { ethers } from "ethers";
|
||||
import yargs from "yargs";
|
||||
import { NETWORK_OPTIONS } from "../consts";
|
||||
import { NETWORKS } from "../networks";
|
||||
import { assertNetwork } from "../utils";
|
||||
|
||||
|
@ -17,12 +18,7 @@ export const builder = (y: typeof yargs) =>
|
|||
type: "string",
|
||||
demandOption: true,
|
||||
})
|
||||
.option("network", {
|
||||
alias: "n",
|
||||
describe: "network",
|
||||
choices: ["mainnet", "testnet", "devnet"],
|
||||
demandOption: true,
|
||||
} as const);
|
||||
.option("network", NETWORK_OPTIONS);
|
||||
export const handler = async (
|
||||
argv: Awaited<ReturnType<typeof builder>["argv"]>
|
||||
) => {
|
|
@ -6,26 +6,21 @@ import { hideBin } from "yargs/helpers";
|
|||
import "./side-effects";
|
||||
// https://github.com/yargs/yargs/blob/main/docs/advanced.md#example-command-hierarchy-using-indexmjs
|
||||
import * as aptos from "./cmds/aptos";
|
||||
import * as chainId from "./cmds/chainId";
|
||||
import * as contractAddress from "./cmds/contractAddress";
|
||||
import * as editVaa from "./cmds/edit-vaa";
|
||||
import * as editVaa from "./cmds/editVaa";
|
||||
import * as evm from "./cmds/evm";
|
||||
import * as generate from "./cmds/generate";
|
||||
import * as info from "./cmds/info";
|
||||
import * as near from "./cmds/near";
|
||||
import * as parse from "./cmds/parse";
|
||||
import * as recover from "./cmds/recover";
|
||||
import * as rpc from "./cmds/rpc";
|
||||
import * as submit from "./cmds/submit";
|
||||
import * as sui from "./cmds/sui";
|
||||
import * as verifyVaa from "./cmds/verify-vaa";
|
||||
import * as verifyVaa from "./cmds/verifyVaa";
|
||||
|
||||
yargs(hideBin(process.argv))
|
||||
// https://github.com/yargs/yargs/blob/main/docs/advanced.md#commanddirdirectory-opts
|
||||
// can't use `.commandDir` because bundling + tree-shaking
|
||||
.command(aptos)
|
||||
.command(chainId)
|
||||
.command(contractAddress)
|
||||
.command(editVaa)
|
||||
.command(evm)
|
||||
.command(generate)
|
||||
|
@ -33,7 +28,6 @@ yargs(hideBin(process.argv))
|
|||
.command(near)
|
||||
.command(parse)
|
||||
.command(recover)
|
||||
.command(rpc)
|
||||
.command(submit)
|
||||
.command(sui)
|
||||
.command(verifyVaa)
|
||||
|
|
|
@ -9,5 +9,5 @@
|
|||
"forceConsistentCasingInFileNames": true,
|
||||
"strict": true
|
||||
},
|
||||
"include": ["src"]
|
||||
"include": ["src", "types"]
|
||||
}
|
||||
|
|
|
@ -12,4 +12,4 @@ fi
|
|||
|
||||
CHAIN_NAME="$1"
|
||||
|
||||
DOCKER_ARGS="-p 8545:8545" ./foundry anvil --host 0.0.0.0 --base-fee 0 --fork-url $(worm rpc mainnet $CHAIN_NAME) --mnemonic "myth like bonus scare over problem client lizard pioneer submit female collect"
|
||||
DOCKER_ARGS="-p 8545:8545" ./foundry anvil --host 0.0.0.0 --base-fee 0 --fork-url $(worm info rpc mainnet $CHAIN_NAME) --mnemonic "myth like bonus scare over problem client lizard pioneer submit female collect"
|
||||
|
|
|
@ -10,7 +10,7 @@ import "../contracts/bridge/BridgeStructs.sol";
|
|||
|
||||
contract BridgeTest is Bridge, Script {
|
||||
|
||||
// forge script scripts/TokenABI.s.sol -s "token_constructor_args(bytes, address)" 0x01000000020d00b7ba3819d44da891c74c583e29eb2222dd37dabbe7929bdbf4f2186bbcc721085d85d9906bbd8ca5ae62cdf30c7555dc4c57fd15f84a0161c27e91846203439c0102736caa697f6c17c2e6b0526291b0e6b4dec760a8494df7f69c93be3df1956224637ef962be9a28ef2dbeebe6bdb30311d9f2394966a1bb170634bd69913abfb200038c598c6e7c288c5dbb0f0008c38168d3f00ac8da7b3ad5420f30c8808c94a8a972c090d25da27558f1b8f8d30f894850d3139f4df92c8e8736be7803d397f33e0006649e6aca07694046fd94b5851ff3711783d4f4c8e0319f9de9431232cb153bce2ff2ac0f7bfad6f3db461571cd6ecffc99d7740a7b653d2f6a25908d821d9ca70107b31051fda4062585f80b291978a480cae6c9191d37a67bc2e1e61db8e97907fa71b5064d2ada48b4cd2f8c4def7fd50484004d1ceb3438a8f67ea071a31a6a88000af4842bbcd0fad425bd3b82bc3b1acefd72555fd1fbb49b71700ec2b41ac6309f20222e24c557f4ad6af35d96f1d4c38fb25177e027a22d2d071956d5d45985ba000bc0ebb4202aae662de331bce75d5e49ea97ac9a74df65006250c96ca9d82a16be6e78c577004a6059169aa7640436e1e5deef5d80bfa52784cf82f67bb368e066010d14586fa1f6f37d2c4d0eae78c42ecc3c9fc6bf17b3a57406382165d615cfb4a1651b979419c42e40a3f62fbe05eb3ff4bafac0af30c15a060e39d935776e54cc000e98d02eb76745301cb5fb12e6b0c7e3e9be347460ed51be360828c46be3bc40ef622f9234fb443b431db9e98980a7165b36eda10bd37abf6998156ebbdf96c4b6010fda503c3deb9c937709ab5742c4a44ed29f04664585c4c73568cd3b4863e1e2326b9cab4d1b139d9698585bb8abcbdc4072b3f98fdfe1b50fa35656c1451f862400106644b7697f41052d4d7c1685d342df4828c7ba7231f86c04476805271c58b4e30614ee43988072decec39f0400a48583f7b6d0fb109516385f73a64ce2a2b16501111cc03c23da18a3ed794cb944aa6d131306c243d13f207796c9ea9430a6c7da063b0ffbc75416c924b588ecc24c3d1c6136ea8e181a4f3d8c1d3d1831c7d4ae7301120b48f7b0c43cb43b4541d179f4bdfe6b9c83289b5b7cd494f6ea33eec062b36408606f4ad406365539d6b3a6b59b2eeae70baf0266c341fb476c8092d64ebd620062cb923534d80000000e000000000000000000000000796dff6d74f3e27060b71255fe517bfb23c93eed00000000000000560102000000000000000000000000765de816845861e75a25fca122bb6898b8b1282a000e12635553440000000000000000000000000000000000000000000000000000000043656c6f20446f6c6c6172000000000000000000000000000000000000000000 $(worm contract mainnet ethereum TokenBridge)
|
||||
// forge script scripts/TokenABI.s.sol -s "token_constructor_args(bytes, address)" 0x01000000020d00b7ba3819d44da891c74c583e29eb2222dd37dabbe7929bdbf4f2186bbcc721085d85d9906bbd8ca5ae62cdf30c7555dc4c57fd15f84a0161c27e91846203439c0102736caa697f6c17c2e6b0526291b0e6b4dec760a8494df7f69c93be3df1956224637ef962be9a28ef2dbeebe6bdb30311d9f2394966a1bb170634bd69913abfb200038c598c6e7c288c5dbb0f0008c38168d3f00ac8da7b3ad5420f30c8808c94a8a972c090d25da27558f1b8f8d30f894850d3139f4df92c8e8736be7803d397f33e0006649e6aca07694046fd94b5851ff3711783d4f4c8e0319f9de9431232cb153bce2ff2ac0f7bfad6f3db461571cd6ecffc99d7740a7b653d2f6a25908d821d9ca70107b31051fda4062585f80b291978a480cae6c9191d37a67bc2e1e61db8e97907fa71b5064d2ada48b4cd2f8c4def7fd50484004d1ceb3438a8f67ea071a31a6a88000af4842bbcd0fad425bd3b82bc3b1acefd72555fd1fbb49b71700ec2b41ac6309f20222e24c557f4ad6af35d96f1d4c38fb25177e027a22d2d071956d5d45985ba000bc0ebb4202aae662de331bce75d5e49ea97ac9a74df65006250c96ca9d82a16be6e78c577004a6059169aa7640436e1e5deef5d80bfa52784cf82f67bb368e066010d14586fa1f6f37d2c4d0eae78c42ecc3c9fc6bf17b3a57406382165d615cfb4a1651b979419c42e40a3f62fbe05eb3ff4bafac0af30c15a060e39d935776e54cc000e98d02eb76745301cb5fb12e6b0c7e3e9be347460ed51be360828c46be3bc40ef622f9234fb443b431db9e98980a7165b36eda10bd37abf6998156ebbdf96c4b6010fda503c3deb9c937709ab5742c4a44ed29f04664585c4c73568cd3b4863e1e2326b9cab4d1b139d9698585bb8abcbdc4072b3f98fdfe1b50fa35656c1451f862400106644b7697f41052d4d7c1685d342df4828c7ba7231f86c04476805271c58b4e30614ee43988072decec39f0400a48583f7b6d0fb109516385f73a64ce2a2b16501111cc03c23da18a3ed794cb944aa6d131306c243d13f207796c9ea9430a6c7da063b0ffbc75416c924b588ecc24c3d1c6136ea8e181a4f3d8c1d3d1831c7d4ae7301120b48f7b0c43cb43b4541d179f4bdfe6b9c83289b5b7cd494f6ea33eec062b36408606f4ad406365539d6b3a6b59b2eeae70baf0266c341fb476c8092d64ebd620062cb923534d80000000e000000000000000000000000796dff6d74f3e27060b71255fe517bfb23c93eed00000000000000560102000000000000000000000000765de816845861e75a25fca122bb6898b8b1282a000e12635553440000000000000000000000000000000000000000000000000000000043656c6f20446f6c6c6172000000000000000000000000000000000000000000 $(worm info contract mainnet ethereum TokenBridge)
|
||||
function token_constructor_args(bytes calldata encodedVM, address tokenBridge) public {
|
||||
Messages m = new Messages();
|
||||
Structs.VM memory vm = m.parseVM(encodedVM);
|
||||
|
|
|
@ -79,7 +79,7 @@ shift $((OPTIND - 1))
|
|||
[ -z "$module" ] && usage
|
||||
|
||||
# Get core contract address
|
||||
CORE=$(worm contract mainnet "$chain_name" Core)
|
||||
CORE=$(worm info contract mainnet "$chain_name" Core)
|
||||
echo "core: $CORE"
|
||||
|
||||
# Use the local devnet guardian key (this is not a production key)
|
||||
|
@ -142,7 +142,7 @@ case "$module" in
|
|||
;;
|
||||
esac
|
||||
|
||||
CONTRACT=$(worm contract mainnet "$chain_name" "$MODULE")
|
||||
CONTRACT=$(worm info contract mainnet "$chain_name" "$MODULE")
|
||||
|
||||
# Step 1) Figure out the contract address depending on the flags -- either use
|
||||
# an address passed in as an argument, or use the most recent contract in the repo.
|
||||
|
|
|
@ -59,7 +59,7 @@ if [[ -n $network ]]; then
|
|||
echo "worm binary could not be found. See installation instructions in clients/js/README.md"
|
||||
exit 1
|
||||
fi
|
||||
rpc=$(worm rpc "$network" "$chain")
|
||||
rpc=$(worm info rpc "$network" "$chain")
|
||||
fi
|
||||
|
||||
if [[ -z $rpc ]]; then
|
||||
|
|
|
@ -407,7 +407,7 @@ if [ "$evm" = true ]; then
|
|||
Next, use the \`verify\` script to verify that the deployed bytecodes we are upgrading to match the build artifacts:
|
||||
|
||||
\`\`\`shell
|
||||
wormhole/ethereum $ ./verify -r $(worm rpc mainnet $chain_name) -c $chain_name $(evm_artifact) $address
|
||||
wormhole/ethereum $ ./verify -r $(worm info rpc mainnet $chain_name) -c $chain_name $(evm_artifact) $address
|
||||
\`\`\`
|
||||
|
||||
EOF
|
||||
|
|
|
@ -90,10 +90,10 @@ shift $((OPTIND - 1))
|
|||
[ -z "$module" ] && usage
|
||||
|
||||
# Use the worm client to get the emitter address and wormhole chain ID.
|
||||
[ -z "$address" ] && address=`worm contract --emitter mainnet $chain_name $module`
|
||||
[ -z "$address" ] && address=`worm info contract --emitter mainnet $chain_name $module`
|
||||
[ -z "$address" ] && usage
|
||||
|
||||
chain=`worm chain-id $chain_name`
|
||||
chain=`worm info chain-id $chain_name`
|
||||
[ -z "$chain" ] && usage
|
||||
|
||||
### The script constructs the governance proposal in two different steps. First,
|
||||
|
|
Loading…
Reference in New Issue