deploy_cosmwasm.ts 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. import yargs from "yargs";
  2. import { hideBin } from "yargs/helpers";
  3. import { CosmWasmChain } from "../src/chains";
  4. import { CosmWasmContract } from "../src/contracts/cosmwasm";
  5. import { DefaultStore } from "../src/store";
  6. const parser = yargs(hideBin(process.argv))
  7. .scriptName("deploy_cosmwasm.ts")
  8. .usage(
  9. "Usage: $0 --code <path/to/artifact.wasm> --private-key <private-key> --chain <chain>"
  10. )
  11. .options({
  12. code: {
  13. type: "string",
  14. demandOption: true,
  15. desc: "Path to the artifact .wasm file",
  16. },
  17. "private-key": {
  18. type: "string",
  19. demandOption: true,
  20. desc: "Private key to use for the deployment",
  21. },
  22. chain: {
  23. type: "string",
  24. demandOption: true,
  25. desc: "Chain to upload the code on. Can be one of the chains available in the store",
  26. },
  27. wormholeContract: {
  28. type: "string",
  29. demandOption: true,
  30. desc: "Wormhole contract address deployed on this chain",
  31. },
  32. });
  33. async function main() {
  34. const argv = await parser.argv;
  35. const { code, wormholeContract } = argv;
  36. console.log(
  37. await CosmWasmContract.deploy(
  38. DefaultStore.chains[argv.chain] as CosmWasmChain,
  39. wormholeContract,
  40. argv["private-key"],
  41. code
  42. )
  43. );
  44. }
  45. main();