sdk: Rootstock readonly (#3235)

This commit is contained in:
bruce-riley 2023-08-14 12:17:47 -05:00 committed by GitHub
parent 86e905e1e8
commit 1cabbe8a2d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 77 additions and 0 deletions

View File

@ -59,6 +59,7 @@ export const getOriginalAsset = async (
case "oasis":
case "optimism":
case "polygon":
// case "rootstock":
case "sepolia": {
const provider = getProviderForChain(chainName, network, { rpc });
return getOriginalAssetEth(

View File

@ -69,6 +69,7 @@ export const getWrappedAssetAddress = async (
case "oasis":
case "optimism":
case "polygon":
// case "rootstock":
case "sepolia": {
const provider = getProviderForChain(chainName, network, { rpc });
return getForeignAssetEth(

View File

@ -96,6 +96,7 @@ export const getProviderForChain = <T extends ChainId | ChainName>(
case "oasis":
case "optimism":
case "polygon":
// case "rootstock":
case "sepolia":
return new ethers.providers.JsonRpcProvider(rpc) as ChainProvider<T>;
case "terra":

View File

@ -168,6 +168,11 @@ const MAINNET = {
rpc: undefined,
key: undefined,
},
rootstock: {
rpc: "https://public-node.rsk.co",
key: getEnvVar("ETH_KEY"),
chain_id: 30,
},
sepolia: {
rpc: undefined,
key: undefined,
@ -333,6 +338,11 @@ const TESTNET = {
key: getEnvVar("ETH_KEY_TESTNET"),
chain_id: 84531,
},
rootstock: {
rpc: "https://public-node.testnet.rsk.co",
key: getEnvVar("ETH_KEY_TESTNET"),
chain_id: 31,
},
};
const DEVNET = {
@ -474,6 +484,10 @@ const DEVNET = {
rpc: undefined,
key: undefined,
},
rootstock: {
rpc: undefined,
key: undefined,
},
};
/**

View File

@ -0,0 +1,9 @@
# Rootstock mainnet read only env
# Rename to .env to use with truffle migrations
# Wormhole Core Migrations
INIT_SIGNERS=["0x58CC3AE5C097b213cE3c81979e1B9f9570746AA5"]
INIT_CHAIN_ID=33
INIT_GOV_CHAIN_ID=0x1
INIT_GOV_CONTRACT=0x0000000000000000000000000000000000000000000000000000000000000004
INIT_EVM_CHAIN_ID=30

View File

@ -0,0 +1,9 @@
# Rootstock testnet read only env
# Rename to .env to use with truffle migrations
# Wormhole Core Migrations
INIT_SIGNERS=["0x13947Bd48b18E53fdAeEe77F3473391aC727C638"]
INIT_CHAIN_ID=33
INIT_GOV_CHAIN_ID=0x1
INIT_GOV_CONTRACT=0x0000000000000000000000000000000000000000000000000000000000000004
INIT_EVM_CHAIN_ID=31

View File

@ -366,6 +366,24 @@ module.exports = {
},
network_id: 84531,
},
rootstock: {
provider: () => {
return new HDWalletProvider(
process.env.MNEMONIC,
"https://public-node.rsk.co"
);
},
network_id: 30,
},
rootstock_testnet: {
provider: () => {
return new HDWalletProvider(
process.env.MNEMONIC,
"https://public-node.testnet.rsk.co"
);
},
network_id: 31,
},
sepolia_testnet: {
provider: () => {
return new HDWalletProvider(

View File

@ -190,6 +190,7 @@ export const RPCS_BY_CHAIN: {
arbitrum: "https://goerli-rollup.arbitrum.io/rpc",
optimism: "https://goerli.optimism.io",
gnosis: "https://sokol.poa.network/",
rootstock: "https://public-node.rsk.co",
},
DEVNET: {
ethereum: "http://localhost:8545",

View File

@ -30,6 +30,7 @@ export const CHAINS = {
btc: 29,
base: 30,
sei: 32,
rootstock: 33,
wormchain: 3104,
sepolia: 10002,
} as const;
@ -59,6 +60,7 @@ export const EVMChainNames = [
"optimism",
"gnosis",
"base",
"rootstock",
"sepolia",
] as const;
export type EVMChainName = typeof EVMChainNames[number];
@ -257,6 +259,11 @@ const MAINNET = {
"sei1smzlm9t79kur392nu9egl8p8je9j92q4gzguewj56a05kyxxra0qy0nuf3",
nft_bridge: undefined,
},
rootstock: {
core: "0xbebdb6C8ddC678FfA9f8748f85C815C556Dd8ac6",
token_bridge: undefined,
nft_bridge: undefined,
},
wormchain: {
core: "wormhole1ufs3tlq4umljk0qfe8k5ya0x6hpavn897u2cnf9k0en9jr7qarqqaqfk2j",
token_bridge:
@ -432,6 +439,11 @@ const TESTNET = {
"sei1jv5xw094mclanxt5emammy875qelf3v62u4tl4lp5nhte3w3s9ts9w9az2",
nft_bridge: undefined,
},
rootstock: {
core: "0xbebdb6C8ddC678FfA9f8748f85C815C556Dd8ac6",
token_bridge: undefined,
nft_bridge: undefined,
},
wormchain: {
core: undefined,
token_bridge: undefined,
@ -604,6 +616,11 @@ const DEVNET = {
token_bridge: undefined,
nft_bridge: undefined,
},
rootstock: {
core: undefined,
token_bridge: undefined,
nft_bridge: undefined,
},
wormchain: {
core: "wormhole17p9rzwnnfxcjp32un9ug7yhhzgtkhvl9jfksztgw5uh69wac2pgshdnj3k",
token_bridge:
@ -686,6 +703,7 @@ export const CHAIN_ID_XPLA = CHAINS["xpla"];
export const CHAIN_ID_BTC = CHAINS["btc"];
export const CHAIN_ID_BASE = CHAINS["base"];
export const CHAIN_ID_SEI = CHAINS["sei"];
export const CHAIN_ID_ROOTSTOCK = CHAINS["rootstock"];
export const CHAIN_ID_WORMCHAIN = CHAINS["wormchain"];
export const CHAIN_ID_SEPOLIA = CHAINS["sepolia"];

View File

@ -42,6 +42,7 @@ pub enum Chain {
Btc,
Base,
Sei,
Rootstock,
Wormchain,
Sepolia,
@ -83,6 +84,7 @@ impl From<u16> for Chain {
29 => Chain::Btc,
30 => Chain::Base,
32 => Chain::Sei,
33 => Chain::Rootstock,
3104 => Chain::Wormchain,
10002 => Chain::Sepolia,
c => Chain::Unknown(c),
@ -124,6 +126,7 @@ impl From<Chain> for u16 {
Chain::Btc => 29,
Chain::Base => 30,
Chain::Sei => 32,
Chain::Rootstock => 33,
Chain::Wormchain => 3104,
Chain::Sepolia => 10002,
Chain::Unknown(c) => c,
@ -165,6 +168,7 @@ impl fmt::Display for Chain {
Self::Btc => f.write_str("Btc"),
Self::Base => f.write_str("Base"),
Self::Sei => f.write_str("Sei"),
Self::Rootstock => f.write_str("Rootstock"),
Self::Sepolia => f.write_str("Sepolia"),
Self::Wormchain => f.write_str("Wormchain"),
Self::Unknown(v) => write!(f, "Unknown({v})"),
@ -212,6 +216,7 @@ impl FromStr for Chain {
"Btc" | "btc" | "BTC" => Ok(Chain::Btc),
"Base" | "base" | "BASE" => Ok(Chain::Base),
"Sei" | "sei" | "SEI" => Ok(Chain::Sei),
"Rootstock" | "rootstock" | "ROOTSTOCK" => Ok(Chain::Rootstock),
"Sepolia" | "sepolia" | "SEPOLIA" => Ok(Chain::Sepolia),
"Wormchain" | "wormchain" | "WORMCHAIN" => Ok(Chain::Wormchain),
_ => {