CLI changes for klatyn, celo and moonbeam (#1159)

* CLI changes for klatyn, celo and moonbeam

* Replacing SDK dependency

* Same for the lock file

* More package file stuff

* Pick up new SDK version
This commit is contained in:
bruce-riley 2022-05-10 12:05:43 -05:00 committed by GitHub
parent c7ba459de8
commit 87e2e4cf64
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 53 additions and 11 deletions

View File

@ -4,6 +4,7 @@ import { NETWORKS } from "./networks"
import { impossible, Payload } from "./vaa"
import { Contracts, CONTRACTS, EVMChainName } from "@certusone/wormhole-sdk"
import axios from "axios";
import * as celo from "@celo-tools/celo-ethers-wrapper";
export async function execute_governance_evm(
payload: Payload,
@ -23,8 +24,16 @@ export async function execute_governance_evm(
let contracts: Contracts = CONTRACTS[network][chain]
let provider = new ethers.providers.JsonRpcProvider(rpc)
let signer = new ethers.Wallet(key, provider)
let provider = undefined
let signer = undefined
if (chain === "celo") {
provider = new celo.CeloProvider(rpc)
await provider.ready
signer = new celo.CeloWallet(key, provider)
} else {
provider = new ethers.providers.JsonRpcProvider(rpc)
signer = new ethers.Wallet(key, provider)
}
// Here we apply a set of chain-specific overrides.
// NOTE: some of these might have only been tested on mainnet. If it fails in
@ -38,6 +47,8 @@ export async function execute_governance_evm(
maxFeePerGas: feeData.maxFeePerGas?.mul(50) || undefined,
maxPriorityFeePerGas: feeData.maxPriorityFeePerGas?.mul(50) || undefined,
};
} else if (chain === "klaytn") {
overrides = { gasPrice: (await signer.getGasPrice()).toString() }
}
switch (payload.module) {

View File

@ -82,6 +82,10 @@ const MAINNET = {
rpc: undefined,
key: undefined,
},
moonbeam: {
rpc: undefined,
key: undefined,
},
ropsten: {
rpc: `https://ropsten.infura.io/v3/${get_env_var("INFURA_KEY")}`,
key: get_env_var("ETH_KEY"),
@ -147,13 +151,17 @@ const TESTNET = {
key: get_env_var("ETH_KEY"),
},
celo: {
rpc: undefined,
rpc: "https://alfajores-forno.celo-testnet.org",
key: get_env_var("ETH_KEY"),
},
near: {
rpc: undefined,
key: undefined,
},
moonbeam: {
rpc: "https://rpc.api.moonbase.moonbeam.network",
key: get_env_var("ETH_KEY"),
},
ropsten: {
rpc: `https://ropsten.infura.io/v3/${get_env_var("INFURA_KEY")}`,
key: get_env_var("ETH_KEY"),
@ -226,6 +234,10 @@ const DEVNET = {
rpc: undefined,
key: undefined,
},
moonbeam: {
rpc: undefined,
key: undefined,
},
ropsten: {
rpc: undefined,
key: undefined,

View File

@ -8,7 +8,8 @@
"name": "wormhole-client",
"version": "1.0.0",
"dependencies": {
"@certusone/wormhole-sdk": "^0.3.0",
"@celo-tools/celo-ethers-wrapper": "^0.1.0",
"@certusone/wormhole-sdk": "^0.3.1",
"@solana/web3.js": "^1.22.0",
"@terra-money/terra.js": "^1.8.9",
"axios": "^0.24.0",
@ -529,10 +530,21 @@
"node": ">=6.9.0"
}
},
"node_modules/@celo-tools/celo-ethers-wrapper": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/@celo-tools/celo-ethers-wrapper/-/celo-ethers-wrapper-0.1.0.tgz",
"integrity": "sha512-kBpFi7viIRlysiVKfIIywuAGykO0l3w+lBZ+NFaEgw9GsVQl0NYj0e4/UhbglfU5XS6M8HCCordUuC8gVwCw7w==",
"engines": {
"node": ">=10"
},
"peerDependencies": {
"ethers": "^5"
}
},
"node_modules/@certusone/wormhole-sdk": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/@certusone/wormhole-sdk/-/wormhole-sdk-0.3.0.tgz",
"integrity": "sha512-jLZ5x8oIwBpFwVK4zYOf8ejZD7dFIkEc0P2/k7yazM+4G+CY2fKBlZnQ06OFjqbj8BvI0q/kshZcLqJx2iwObw==",
"version": "0.3.1",
"resolved": "https://registry.npmjs.org/@certusone/wormhole-sdk/-/wormhole-sdk-0.3.1.tgz",
"integrity": "sha512-uQPuGUrDC72vwtNMxdxd2iSiu3RRx36Pvbpz3NNvaBeLz+d08oOcmJZwEAq05doRrPWB5fIWxZVCdbCF0yGucA==",
"dependencies": {
"@improbable-eng/grpc-web": "^0.14.0",
"@solana/spl-token": "^0.1.8",
@ -10931,10 +10943,16 @@
"to-fast-properties": "^2.0.0"
}
},
"@celo-tools/celo-ethers-wrapper": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/@celo-tools/celo-ethers-wrapper/-/celo-ethers-wrapper-0.1.0.tgz",
"integrity": "sha512-kBpFi7viIRlysiVKfIIywuAGykO0l3w+lBZ+NFaEgw9GsVQl0NYj0e4/UhbglfU5XS6M8HCCordUuC8gVwCw7w==",
"requires": {}
},
"@certusone/wormhole-sdk": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/@certusone/wormhole-sdk/-/wormhole-sdk-0.3.0.tgz",
"integrity": "sha512-jLZ5x8oIwBpFwVK4zYOf8ejZD7dFIkEc0P2/k7yazM+4G+CY2fKBlZnQ06OFjqbj8BvI0q/kshZcLqJx2iwObw==",
"version": "0.3.1",
"resolved": "https://registry.npmjs.org/@certusone/wormhole-sdk/-/wormhole-sdk-0.3.1.tgz",
"integrity": "sha512-uQPuGUrDC72vwtNMxdxd2iSiu3RRx36Pvbpz3NNvaBeLz+d08oOcmJZwEAq05doRrPWB5fIWxZVCdbCF0yGucA==",
"requires": {
"@improbable-eng/grpc-web": "^0.14.0",
"@solana/spl-token": "^0.1.8",

View File

@ -2,7 +2,8 @@
"name": "wormhole-client",
"version": "1.0.0",
"dependencies": {
"@certusone/wormhole-sdk": "^0.3.0",
"@celo-tools/celo-ethers-wrapper": "^0.1.0",
"@certusone/wormhole-sdk": "^0.3.1",
"@solana/web3.js": "^1.22.0",
"@terra-money/terra.js": "^1.8.9",
"axios": "^0.24.0",