networks.ts 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419
  1. import { ChainName } from "@certusone/wormhole-sdk";
  2. require("dotenv").config({ path: `${process.env.HOME}/.wormhole/.env` });
  3. function get_env_var(env: string): string | undefined {
  4. const v = process.env[env];
  5. return v;
  6. }
  7. export type Connection = {
  8. rpc: string | undefined;
  9. key: string | undefined;
  10. };
  11. export type ChainConnections = {
  12. [chain in ChainName]: Connection;
  13. };
  14. const MAINNET = {
  15. unset: {
  16. rpc: undefined,
  17. key: undefined,
  18. },
  19. solana: {
  20. rpc: "https://api.mainnet-beta.solana.com",
  21. key: get_env_var("SOLANA_KEY"),
  22. },
  23. terra: {
  24. rpc: "https://lcd.terra.dev",
  25. chain_id: "columbus-5",
  26. key: get_env_var("TERRA_MNEMONIC"),
  27. },
  28. ethereum: {
  29. rpc: `https://rpc.ankr.com/eth`,
  30. key: get_env_var("ETH_KEY"),
  31. },
  32. bsc: {
  33. rpc: "https://bsc-dataseed.binance.org/",
  34. key: get_env_var("ETH_KEY"),
  35. },
  36. polygon: {
  37. rpc: "https://rpc.ankr.com/polygon",
  38. key: get_env_var("ETH_KEY"),
  39. },
  40. avalanche: {
  41. rpc: "https://rpc.ankr.com/avalanche",
  42. key: get_env_var("ETH_KEY"),
  43. },
  44. algorand: {
  45. rpc: "https://mainnet-api.algonode.cloud",
  46. key: get_env_var("ALGORAND_KEY"),
  47. },
  48. oasis: {
  49. rpc: "https://emerald.oasis.dev/",
  50. key: get_env_var("ETH_KEY"),
  51. },
  52. fantom: {
  53. rpc: "https://rpc.ftm.tools/",
  54. key: get_env_var("ETH_KEY"),
  55. },
  56. aurora: {
  57. rpc: "https://mainnet.aurora.dev",
  58. key: get_env_var("ETH_KEY"),
  59. },
  60. karura: {
  61. rpc: "https://eth-rpc-karura.aca-api.network/",
  62. key: get_env_var("ETH_KEY"),
  63. },
  64. acala: {
  65. rpc: "https://eth-rpc-acala.aca-api.network/",
  66. key: get_env_var("ETH_KEY"),
  67. },
  68. klaytn: {
  69. rpc: "https://public-node-api.klaytnapi.com/v1/cypress",
  70. key: get_env_var("ETH_KEY"),
  71. },
  72. celo: {
  73. rpc: "https://forno.celo.org",
  74. key: get_env_var("ETH_KEY"),
  75. },
  76. near: {
  77. rpc: "https://rpc.mainnet.near.org",
  78. key: get_env_var("NEAR_KEY"),
  79. networkId: "mainnet",
  80. deployerAccount: "85957f38de1768d6db9eab29bee9dd2a01462aff9c8d83daefb9bcd2506c32d2",
  81. },
  82. injective: {
  83. rpc: undefined,
  84. key: undefined,
  85. },
  86. osmosis: {
  87. rpc: undefined,
  88. key: undefined,
  89. },
  90. aptos: {
  91. rpc: undefined,
  92. key: undefined,
  93. },
  94. sui: {
  95. rpc: undefined,
  96. key: undefined,
  97. },
  98. pythnet: {
  99. rpc: "http://api.pythnet.pyth.network:8899/",
  100. key: get_env_var("SOLANA_KEY"),
  101. },
  102. wormholechain: {
  103. rpc: undefined,
  104. key: undefined,
  105. },
  106. moonbeam: {
  107. rpc: "https://rpc.api.moonbeam.network",
  108. key: get_env_var("ETH_KEY"),
  109. },
  110. neon: {
  111. rpc: undefined,
  112. key: undefined,
  113. },
  114. terra2: {
  115. rpc: "https://phoenix-lcd.terra.dev",
  116. chain_id: "phoenix-1",
  117. key: get_env_var("TERRA_MNEMONIC"),
  118. },
  119. arbitrum: {
  120. rpc: "https://arb1.arbitrum.io/rpc",
  121. key: get_env_var("ETH_KEY"),
  122. },
  123. optimism: {
  124. rpc: "https://mainnet.optimism.io",
  125. key: get_env_var("ETH_KEY"),
  126. },
  127. gnosis: {
  128. rpc: "https://rpc.gnosischain.com/",
  129. key: get_env_var("ETH_KEY"),
  130. },
  131. ropsten: {
  132. rpc: `https://rpc.ankr.com/eth_ropsten`,
  133. key: get_env_var("ETH_KEY"),
  134. },
  135. };
  136. const TESTNET = {
  137. unset: {
  138. rpc: undefined,
  139. key: undefined,
  140. },
  141. solana: {
  142. rpc: "https://api.devnet.solana.com",
  143. key: get_env_var("SOLANA_KEY_TESTNET"),
  144. },
  145. terra: {
  146. rpc: "https://bombay-lcd.terra.dev",
  147. chain_id: "bombay-12",
  148. key: get_env_var("TERRA_MNEMONIC"),
  149. },
  150. ethereum: {
  151. rpc: `https://rpc.ankr.com/eth_goerli`,
  152. key: get_env_var("ETH_KEY_TESTNET"),
  153. },
  154. bsc: {
  155. rpc: "https://data-seed-prebsc-1-s1.binance.org:8545",
  156. key: get_env_var("ETH_KEY_TESTNET"),
  157. },
  158. polygon: {
  159. rpc: `https://rpc.ankr.com/polygon_mumbai`,
  160. key: get_env_var("ETH_KEY_TESTNET"),
  161. },
  162. avalanche: {
  163. rpc: "https://rpc.ankr.com/avalanche_fuji",
  164. key: get_env_var("ETH_KEY_TESTNET"),
  165. },
  166. oasis: {
  167. rpc: "https://testnet.emerald.oasis.dev",
  168. key: get_env_var("ETH_KEY_TESTNET"),
  169. },
  170. algorand: {
  171. rpc: "https://testnet-api.algonode.cloud",
  172. key: get_env_var("ALGORAND_KEY_TESTNET"),
  173. },
  174. fantom: {
  175. rpc: "https://rpc.testnet.fantom.network",
  176. key: get_env_var("ETH_KEY_TESTNET"),
  177. },
  178. aurora: {
  179. rpc: "https://testnet.aurora.dev",
  180. key: get_env_var("ETH_KEY_TESTNET"),
  181. },
  182. karura: {
  183. rpc: "https://karura-dev.aca-dev.network/eth/http",
  184. key: get_env_var("ETH_KEY_TESTNET"),
  185. },
  186. acala: {
  187. rpc: "https://acala-dev.aca-dev.network/eth/http",
  188. key: get_env_var("ETH_KEY_TESTNET"),
  189. },
  190. klaytn: {
  191. rpc: "https://api.baobab.klaytn.net:8651",
  192. key: get_env_var("ETH_KEY_TESTNET"),
  193. },
  194. celo: {
  195. rpc: "https://alfajores-forno.celo-testnet.org",
  196. key: get_env_var("ETH_KEY_TESTNET"),
  197. },
  198. near: {
  199. rpc: "https://rpc.testnet.near.org",
  200. key: get_env_var("NEAR_KEY_TESTNET"),
  201. networkId: "testnet",
  202. deployerAccount: undefined,
  203. },
  204. injective: {
  205. rpc: "https://k8s.testnet.tm.injective.network:443",
  206. chain_id: "injective-888",
  207. key: get_env_var("ETH_KEY_TESTNET"),
  208. },
  209. osmosis: {
  210. rpc: undefined,
  211. chain_id: "osmo-test-4",
  212. key: get_env_var("ETH_KEY_TESTNET"),
  213. },
  214. aptos: {
  215. rpc: undefined,
  216. key: undefined,
  217. },
  218. sui: {
  219. rpc: undefined,
  220. key: undefined,
  221. },
  222. pythnet: {
  223. rpc: "https://api.pythtest.pyth.network/",
  224. key: get_env_var("SOLANA_KEY_TESTNET"),
  225. },
  226. wormholechain: {
  227. rpc: undefined,
  228. key: undefined,
  229. },
  230. moonbeam: {
  231. rpc: "https://rpc.api.moonbase.moonbeam.network",
  232. key: get_env_var("ETH_KEY_TESTNET"),
  233. },
  234. neon: {
  235. rpc: "https://proxy.devnet.neonlabs.org/solana",
  236. key: get_env_var("ETH_KEY_TESTNET"),
  237. },
  238. terra2: {
  239. rpc: "https://pisco-lcd.terra.dev",
  240. chain_id: "pisco-1",
  241. key: get_env_var("TERRA_MNEMONIC"),
  242. },
  243. arbitrum: {
  244. rpc: "https://goerli-rollup.arbitrum.io/rpc",
  245. key: get_env_var("ETH_KEY_TESTNET"),
  246. },
  247. optimism: {
  248. rpc: "https://goerli.optimism.io",
  249. key: get_env_var("ETH_KEY_TESTNET"),
  250. },
  251. gnosis: {
  252. rpc: "https://sokol.poa.network/",
  253. key: get_env_var("ETH_KEY_TESTNET"),
  254. },
  255. ropsten: {
  256. rpc: `https://rpc.ankr.com/eth_ropsten`,
  257. key: get_env_var("ETH_KEY_TESTNET"),
  258. },
  259. };
  260. const DEVNET = {
  261. unset: {
  262. rpc: undefined,
  263. key: undefined,
  264. },
  265. solana: {
  266. rpc: "http://localhost:8899",
  267. key: "J2D4pwDred8P9ioyPEZVLPht885AeYpifsFGUyuzVmiKQosAvmZP4EegaKFrSprBC5vVP1xTvu61vYDWsxBNsYx",
  268. },
  269. terra: {
  270. rpc: "http://localhost:1317",
  271. chain_id: "columbus-5",
  272. key: "notice oak worry limit wrap speak medal online prefer cluster roof addict wrist behave treat actual wasp year salad speed social layer crew genius",
  273. },
  274. ethereum: {
  275. rpc: "http://localhost:8545",
  276. key: "0x4f3edf983ac636a65a842ce7c78d9aa706d3b113bce9c46f30d7d21715b23b1d",
  277. },
  278. bsc: {
  279. rpc: "http://localhost:8546",
  280. key: "0x4f3edf983ac636a65a842ce7c78d9aa706d3b113bce9c46f30d7d21715b23b1d",
  281. },
  282. polygon: {
  283. rpc: undefined,
  284. key: "0x4f3edf983ac636a65a842ce7c78d9aa706d3b113bce9c46f30d7d21715b23b1d",
  285. },
  286. avalanche: {
  287. rpc: undefined,
  288. key: "0x4f3edf983ac636a65a842ce7c78d9aa706d3b113bce9c46f30d7d21715b23b1d",
  289. },
  290. oasis: {
  291. rpc: undefined,
  292. key: "0x4f3edf983ac636a65a842ce7c78d9aa706d3b113bce9c46f30d7d21715b23b1d",
  293. },
  294. algorand: {
  295. rpc: "http://localhost",
  296. key: get_env_var("ALGORAND_KEY_DEVNET"),
  297. },
  298. fantom: {
  299. rpc: undefined,
  300. key: "0x4f3edf983ac636a65a842ce7c78d9aa706d3b113bce9c46f30d7d21715b23b1d",
  301. },
  302. aurora: {
  303. rpc: undefined,
  304. key: "0x4f3edf983ac636a65a842ce7c78d9aa706d3b113bce9c46f30d7d21715b23b1d",
  305. },
  306. karura: {
  307. rpc: undefined,
  308. key: "0x4f3edf983ac636a65a842ce7c78d9aa706d3b113bce9c46f30d7d21715b23b1d",
  309. },
  310. acala: {
  311. rpc: undefined,
  312. key: "0x4f3edf983ac636a65a842ce7c78d9aa706d3b113bce9c46f30d7d21715b23b1d",
  313. },
  314. klaytn: {
  315. rpc: undefined,
  316. key: "0x4f3edf983ac636a65a842ce7c78d9aa706d3b113bce9c46f30d7d21715b23b1d",
  317. },
  318. celo: {
  319. rpc: undefined,
  320. key: "0x4f3edf983ac636a65a842ce7c78d9aa706d3b113bce9c46f30d7d21715b23b1d",
  321. },
  322. near: {
  323. rpc: undefined,
  324. key: undefined,
  325. networkId: "sandbox",
  326. deployerAccount: "test.near",
  327. },
  328. injective: {
  329. rpc: undefined,
  330. key: undefined,
  331. },
  332. osmosis: {
  333. rpc: undefined,
  334. key: undefined,
  335. },
  336. pythnet: {
  337. rpc: undefined,
  338. key: undefined,
  339. },
  340. wormholechain: {
  341. rpc: "http://localhost:1319",
  342. chain_id: "wormholechain",
  343. key: undefined,
  344. },
  345. aptos: {
  346. rpc: undefined,
  347. key: undefined,
  348. },
  349. sui: {
  350. rpc: undefined,
  351. key: undefined,
  352. },
  353. moonbeam: {
  354. rpc: undefined,
  355. key: "0x4f3edf983ac636a65a842ce7c78d9aa706d3b113bce9c46f30d7d21715b23b1d",
  356. },
  357. neon: {
  358. rpc: undefined,
  359. key: "0x4f3edf983ac636a65a842ce7c78d9aa706d3b113bce9c46f30d7d21715b23b1d",
  360. },
  361. terra2: {
  362. rpc: "http://localhost:1318",
  363. chain_id: "phoenix-1",
  364. key: "notice oak worry limit wrap speak medal online prefer cluster roof addict wrist behave treat actual wasp year salad speed social layer crew genius",
  365. },
  366. arbitrum: {
  367. rpc: undefined,
  368. key: undefined,
  369. },
  370. optimism: {
  371. rpc: undefined,
  372. key: undefined,
  373. },
  374. gnosis: {
  375. rpc: undefined,
  376. key: undefined,
  377. },
  378. ropsten: {
  379. rpc: undefined,
  380. key: "0x4f3edf983ac636a65a842ce7c78d9aa706d3b113bce9c46f30d7d21715b23b1d",
  381. },
  382. };
  383. /**
  384. *
  385. * If you get a type error here, it means that a chain you just added does not
  386. * have an entry in TESTNET.
  387. * This is implemented as an ad-hoc type assertion instead of a type annotation
  388. * on TESTNET so that e.g.
  389. *
  390. * ```typescript
  391. * TESTNET['solana'].rpc
  392. * ```
  393. * has type 'string' instead of 'string | undefined'.
  394. *
  395. * (Do not delete this declaration!)
  396. */
  397. const isTestnetConnections: ChainConnections = TESTNET;
  398. /**
  399. *
  400. * See [[isTestnetContracts]]
  401. */
  402. const isMainnetConnections: ChainConnections = MAINNET;
  403. /**
  404. *
  405. * See [[isTestnetContracts]]
  406. */
  407. const isDevnetConnections: ChainConnections = DEVNET;
  408. export const NETWORKS = { MAINNET, TESTNET, DEVNET };