consts.js 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.SOLANA_TEST_WALLET_PUBLIC_KEY = exports.SOLANA_TEST_TOKEN = exports.ETH_TEST_WALLET_PUBLIC_KEY = exports.getSignerForChain = exports.SOLANA_PRIVATE_KEY = exports.ETH_PRIVATE_KEY = exports.BSC_NODE_URL = exports.POLYGON_NODE_URL = exports.ETH_NODE_URL = exports.WORMHOLE_RPC_HOSTS = exports.getTokenBridgeAddressForChain = exports.getNFTBridgeAddressForChain = exports.getBridgeAddressForChain = exports.TERRA_TOKEN_BRIDGE_ADDRESS = exports.TERRA_BRIDGE_ADDRESS = exports.SOL_TOKEN_BRIDGE_ADDRESS = exports.SOL_NFT_BRIDGE_ADDRESS = exports.SOL_BRIDGE_ADDRESS = exports.POLYGON_TOKEN_BRIDGE_ADDRESS = exports.POLYGON_NFT_BRIDGE_ADDRESS = exports.POLYGON_BRIDGE_ADDRESS = exports.BSC_TOKEN_BRIDGE_ADDRESS = exports.BSC_NFT_BRIDGE_ADDRESS = exports.BSC_BRIDGE_ADDRESS = exports.ETH_TOKEN_BRIDGE_ADDRESS = exports.ETH_NFT_BRIDGE_ADDRESS = exports.ETH_BRIDGE_ADDRESS = exports.TERRA_HOST = exports.SOLANA_HOST = exports.CLUSTER = void 0;
  4. var wormhole_sdk_1 = require("@certusone/wormhole-sdk");
  5. var web3_js_1 = require("@solana/web3.js");
  6. var ethers_1 = require("ethers");
  7. var utils_1 = require("ethers/lib/utils");
  8. exports.CLUSTER = "devnet"; //This is the currently selected environment.
  9. exports.SOLANA_HOST = process.env.REACT_APP_SOLANA_API_URL
  10. ? process.env.REACT_APP_SOLANA_API_URL
  11. : exports.CLUSTER === "mainnet"
  12. ? web3_js_1.clusterApiUrl("mainnet-beta")
  13. : exports.CLUSTER === "testnet"
  14. ? web3_js_1.clusterApiUrl("testnet")
  15. : "http://localhost:8899";
  16. exports.TERRA_HOST = exports.CLUSTER === "mainnet"
  17. ? {
  18. URL: "https://lcd.terra.dev",
  19. chainID: "columbus-5",
  20. name: "mainnet",
  21. }
  22. : exports.CLUSTER === "testnet"
  23. ? {
  24. URL: "https://bombay-lcd.terra.dev",
  25. chainID: "bombay-12",
  26. name: "testnet",
  27. }
  28. : {
  29. URL: "http://localhost:1317",
  30. chainID: "columbus-5",
  31. name: "localterra",
  32. };
  33. exports.ETH_BRIDGE_ADDRESS = utils_1.getAddress(exports.CLUSTER === "mainnet"
  34. ? "0x98f3c9e6E3fAce36bAAd05FE09d375Ef1464288B"
  35. : exports.CLUSTER === "testnet"
  36. ? "0x44F3e7c20850B3B5f3031114726A9240911D912a"
  37. : "0xC89Ce4735882C9F0f0FE26686c53074E09B0D550");
  38. exports.ETH_NFT_BRIDGE_ADDRESS = utils_1.getAddress(exports.CLUSTER === "mainnet"
  39. ? "0x6FFd7EdE62328b3Af38FCD61461Bbfc52F5651fE"
  40. : exports.CLUSTER === "testnet"
  41. ? "0x26b4afb60d6c903165150c6f0aa14f8016be4aec" // TODO: test address
  42. : "0x26b4afb60d6c903165150c6f0aa14f8016be4aec");
  43. exports.ETH_TOKEN_BRIDGE_ADDRESS = utils_1.getAddress(exports.CLUSTER === "mainnet"
  44. ? "0x3ee18B2214AFF97000D974cf647E7C347E8fa585"
  45. : exports.CLUSTER === "testnet"
  46. ? "0xa6CDAddA6e4B6704705b065E01E52e2486c0FBf6"
  47. : "0x0290FB167208Af455bB137780163b7B7a9a10C16");
  48. exports.BSC_BRIDGE_ADDRESS = utils_1.getAddress(exports.CLUSTER === "mainnet"
  49. ? "0x98f3c9e6E3fAce36bAAd05FE09d375Ef1464288B"
  50. : exports.CLUSTER === "testnet"
  51. ? "0xC89Ce4735882C9F0f0FE26686c53074E09B0D550" // TODO: test address
  52. : "0xC89Ce4735882C9F0f0FE26686c53074E09B0D550");
  53. exports.BSC_NFT_BRIDGE_ADDRESS = utils_1.getAddress(exports.CLUSTER === "mainnet"
  54. ? "0x5a58505a96D1dbf8dF91cB21B54419FC36e93fdE"
  55. : exports.CLUSTER === "testnet"
  56. ? "0x26b4afb60d6c903165150c6f0aa14f8016be4aec" // TODO: test address
  57. : "0x26b4afb60d6c903165150c6f0aa14f8016be4aec");
  58. exports.BSC_TOKEN_BRIDGE_ADDRESS = utils_1.getAddress(exports.CLUSTER === "mainnet"
  59. ? "0xB6F6D86a8f9879A9c87f643768d9efc38c1Da6E7"
  60. : exports.CLUSTER === "testnet"
  61. ? "0x0290FB167208Af455bB137780163b7B7a9a10C16" // TODO: test address
  62. : "0x0290FB167208Af455bB137780163b7B7a9a10C16");
  63. exports.POLYGON_BRIDGE_ADDRESS = utils_1.getAddress(exports.CLUSTER === "mainnet"
  64. ? "0x7A4B5a56256163F07b2C80A7cA55aBE66c4ec4d7"
  65. : exports.CLUSTER === "testnet"
  66. ? "0xC89Ce4735882C9F0f0FE26686c53074E09B0D550" // TODO: test address
  67. : "0xC89Ce4735882C9F0f0FE26686c53074E09B0D550");
  68. exports.POLYGON_NFT_BRIDGE_ADDRESS = utils_1.getAddress(exports.CLUSTER === "mainnet"
  69. ? "0x90BBd86a6Fe93D3bc3ed6335935447E75fAb7fCf"
  70. : exports.CLUSTER === "testnet"
  71. ? "0x26b4afb60d6c903165150c6f0aa14f8016be4aec" // TODO: test address
  72. : "0x26b4afb60d6c903165150c6f0aa14f8016be4aec");
  73. exports.POLYGON_TOKEN_BRIDGE_ADDRESS = utils_1.getAddress(exports.CLUSTER === "mainnet"
  74. ? "0x5a58505a96D1dbf8dF91cB21B54419FC36e93fdE"
  75. : exports.CLUSTER === "testnet"
  76. ? "0x0290FB167208Af455bB137780163b7B7a9a10C16" // TODO: test address
  77. : "0x0290FB167208Af455bB137780163b7B7a9a10C16");
  78. exports.SOL_BRIDGE_ADDRESS = exports.CLUSTER === "mainnet"
  79. ? "worm2ZoG2kUd4vFXhvjh93UUH596ayRfgQ2MgjNMTth"
  80. : exports.CLUSTER === "testnet"
  81. ? "Brdguy7BmNB4qwEbcqqMbyV5CyJd2sxQNUn6NEpMSsUb"
  82. : "Bridge1p5gheXUvJ6jGWGeCsgPKgnE3YgdGKRVCMY9o";
  83. exports.SOL_NFT_BRIDGE_ADDRESS = exports.CLUSTER === "mainnet"
  84. ? "WnFt12ZrnzZrFZkt2xsNsaNWoQribnuQ5B5FrDbwDhD"
  85. : exports.CLUSTER === "testnet"
  86. ? "NFTWqJR8YnRVqPDvTJrYuLrQDitTG5AScqbeghi4zSA" // TODO: test address
  87. : "NFTWqJR8YnRVqPDvTJrYuLrQDitTG5AScqbeghi4zSA";
  88. exports.SOL_TOKEN_BRIDGE_ADDRESS = exports.CLUSTER === "mainnet"
  89. ? "wormDTUJ6AWPNvk59vGQbDvGJmqbDTdgWgAqcLBCgUb"
  90. : exports.CLUSTER === "testnet"
  91. ? "A4Us8EhCC76XdGAN17L4KpRNEK423nMivVHZzZqFqqBg"
  92. : "B6RHG3mfcckmrYN1UhmJzyS1XX3fZKbkeUcpJe9Sy3FE";
  93. exports.TERRA_BRIDGE_ADDRESS = exports.CLUSTER === "mainnet"
  94. ? "terra1dq03ugtd40zu9hcgdzrsq6z2z4hwhc9tqk2uy5"
  95. : exports.CLUSTER === "testnet"
  96. ? "terra18vd8fpwxzck93qlwghaj6arh4p7c5n896xzem5"
  97. : "terra18vd8fpwxzck93qlwghaj6arh4p7c5n896xzem5";
  98. exports.TERRA_TOKEN_BRIDGE_ADDRESS = exports.CLUSTER === "mainnet"
  99. ? "terra10nmmwe8r3g99a9newtqa7a75xfgs2e8z87r2sf"
  100. : exports.CLUSTER === "testnet"
  101. ? "terra10pyejy66429refv3g35g2t7am0was7ya7kz2a4"
  102. : "terra10pyejy66429refv3g35g2t7am0was7ya7kz2a4";
  103. var getBridgeAddressForChain = function (chainId) {
  104. return chainId === wormhole_sdk_1.CHAIN_ID_SOLANA
  105. ? exports.SOL_BRIDGE_ADDRESS
  106. : chainId === wormhole_sdk_1.CHAIN_ID_ETH
  107. ? exports.ETH_BRIDGE_ADDRESS
  108. : chainId === wormhole_sdk_1.CHAIN_ID_BSC
  109. ? exports.BSC_BRIDGE_ADDRESS
  110. : chainId === wormhole_sdk_1.CHAIN_ID_TERRA
  111. ? exports.TERRA_BRIDGE_ADDRESS
  112. : chainId === wormhole_sdk_1.CHAIN_ID_POLYGON
  113. ? exports.POLYGON_BRIDGE_ADDRESS
  114. : "";
  115. };
  116. exports.getBridgeAddressForChain = getBridgeAddressForChain;
  117. var getNFTBridgeAddressForChain = function (chainId) {
  118. return chainId === wormhole_sdk_1.CHAIN_ID_SOLANA
  119. ? exports.SOL_NFT_BRIDGE_ADDRESS
  120. : chainId === wormhole_sdk_1.CHAIN_ID_ETH
  121. ? exports.ETH_NFT_BRIDGE_ADDRESS
  122. : chainId === wormhole_sdk_1.CHAIN_ID_BSC
  123. ? exports.BSC_NFT_BRIDGE_ADDRESS
  124. : chainId === wormhole_sdk_1.CHAIN_ID_POLYGON
  125. ? exports.POLYGON_NFT_BRIDGE_ADDRESS
  126. : "";
  127. };
  128. exports.getNFTBridgeAddressForChain = getNFTBridgeAddressForChain;
  129. var getTokenBridgeAddressForChain = function (chainId) {
  130. return chainId === wormhole_sdk_1.CHAIN_ID_SOLANA
  131. ? exports.SOL_TOKEN_BRIDGE_ADDRESS
  132. : chainId === wormhole_sdk_1.CHAIN_ID_ETH
  133. ? exports.ETH_TOKEN_BRIDGE_ADDRESS
  134. : chainId === wormhole_sdk_1.CHAIN_ID_BSC
  135. ? exports.BSC_TOKEN_BRIDGE_ADDRESS
  136. : chainId === wormhole_sdk_1.CHAIN_ID_TERRA
  137. ? exports.TERRA_TOKEN_BRIDGE_ADDRESS
  138. : chainId === wormhole_sdk_1.CHAIN_ID_POLYGON
  139. ? exports.POLYGON_TOKEN_BRIDGE_ADDRESS
  140. : "";
  141. };
  142. exports.getTokenBridgeAddressForChain = getTokenBridgeAddressForChain;
  143. exports.WORMHOLE_RPC_HOSTS = exports.CLUSTER === "mainnet"
  144. ? [
  145. "https://wormhole-v2-mainnet-api.certus.one",
  146. "https://wormhole.inotel.ro",
  147. "https://wormhole-v2-mainnet-api.mcf.rocks",
  148. "https://wormhole-v2-mainnet-api.chainlayer.network",
  149. "https://wormhole-v2-mainnet-api.staking.fund",
  150. "https://wormhole-v2-mainnet.01node.com",
  151. ]
  152. : exports.CLUSTER === "testnet"
  153. ? ["https://wormhole-v2-testnet-api.certus.one"]
  154. : ["http://localhost:7071"];
  155. exports.ETH_NODE_URL = "ws://localhost:8545"; //TODO testnet
  156. exports.POLYGON_NODE_URL = "ws:localhost:0000"; //TODO
  157. exports.BSC_NODE_URL = "ws://localhost:8546"; //TODO testnet
  158. exports.ETH_PRIVATE_KEY = "0x4f3edf983ac636a65a842ce7c78d9aa706d3b113bce9c46f30d7d21715b23b1d";
  159. exports.SOLANA_PRIVATE_KEY = new Uint8Array([
  160. 14, 173, 153, 4, 176, 224, 201, 111, 32, 237, 183, 185, 159, 247, 22, 161, 89,
  161. 84, 215, 209, 212, 137, 10, 92, 157, 49, 29, 192, 101, 164, 152, 70, 87, 65,
  162. 8, 174, 214, 157, 175, 126, 98, 90, 54, 24, 100, 177, 247, 77, 19, 112, 47,
  163. 44, 165, 109, 233, 102, 14, 86, 109, 29, 134, 145, 132, 141,
  164. ]);
  165. function getSignerForChain(chainId) {
  166. var provider = new ethers_1.ethers.providers.WebSocketProvider(chainId === wormhole_sdk_1.CHAIN_ID_POLYGON
  167. ? exports.POLYGON_NODE_URL
  168. : chainId === wormhole_sdk_1.CHAIN_ID_BSC
  169. ? exports.BSC_NODE_URL
  170. : exports.ETH_NODE_URL);
  171. var signer = new ethers_1.ethers.Wallet(exports.ETH_PRIVATE_KEY, provider);
  172. return signer;
  173. }
  174. exports.getSignerForChain = getSignerForChain;
  175. exports.ETH_TEST_WALLET_PUBLIC_KEY = "0x90F8bf6A479f320ead074411a4B0e7944Ea8c9C1";
  176. exports.SOLANA_TEST_TOKEN = "2WDq7wSs9zYrpx2kbHDA4RUTRch2CCTP6ZWaH4GNfnQQ"; //SOLT on devnet
  177. exports.SOLANA_TEST_WALLET_PUBLIC_KEY = "6sbzC1eH4FTujJXWj51eQe25cYvr4xfXbJ1vAj7j2k5J";