Skip to content

Commit

Permalink
sdk: Rootstock readonly (#3235)
Browse files Browse the repository at this point in the history
  • Loading branch information
bruce-riley authored Aug 14, 2023
1 parent 86e905e commit 1cabbe8
Show file tree
Hide file tree
Showing 10 changed files with 77 additions and 0 deletions.
1 change: 1 addition & 0 deletions clients/js/src/chains/generic/getOriginalAsset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
1 change: 1 addition & 0 deletions clients/js/src/chains/generic/getWrappedAssetAddress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
1 change: 1 addition & 0 deletions clients/js/src/chains/generic/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand Down
14 changes: 14 additions & 0 deletions clients/js/src/consts/networks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 = {
Expand Down Expand Up @@ -474,6 +484,10 @@ const DEVNET = {
rpc: undefined,
key: undefined,
},
rootstock: {
rpc: undefined,
key: undefined,
},
};

/**
Expand Down
9 changes: 9 additions & 0 deletions ethereum/.env.rootstock.mainnet
Original file line number Diff line number Diff line change
@@ -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
9 changes: 9 additions & 0 deletions ethereum/.env.rootstock.testnet
Original file line number Diff line number Diff line change
@@ -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
18 changes: 18 additions & 0 deletions ethereum/truffle-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
1 change: 1 addition & 0 deletions sdk/js/src/relayer/consts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
18 changes: 18 additions & 0 deletions sdk/js/src/utils/consts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export const CHAINS = {
btc: 29,
base: 30,
sei: 32,
rootstock: 33,
wormchain: 3104,
sepolia: 10002,
} as const;
Expand Down Expand Up @@ -59,6 +60,7 @@ export const EVMChainNames = [
"optimism",
"gnosis",
"base",
"rootstock",
"sepolia",
] as const;
export type EVMChainName = typeof EVMChainNames[number];
Expand Down Expand Up @@ -257,6 +259,11 @@ const MAINNET = {
"sei1smzlm9t79kur392nu9egl8p8je9j92q4gzguewj56a05kyxxra0qy0nuf3",
nft_bridge: undefined,
},
rootstock: {
core: "0xbebdb6C8ddC678FfA9f8748f85C815C556Dd8ac6",
token_bridge: undefined,
nft_bridge: undefined,
},
wormchain: {
core: "wormhole1ufs3tlq4umljk0qfe8k5ya0x6hpavn897u2cnf9k0en9jr7qarqqaqfk2j",
token_bridge:
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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"];

Expand Down
5 changes: 5 additions & 0 deletions sdk/rust/core/src/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ pub enum Chain {
Btc,
Base,
Sei,
Rootstock,
Wormchain,
Sepolia,

Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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})"),
Expand Down Expand Up @@ -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),
_ => {
Expand Down

0 comments on commit 1cabbe8

Please sign in to comment.