diff --git a/__tests__/tilt/helpers/helpers.ts b/__tests__/tilt/helpers/helpers.ts index 24e7d944fb..962eca2540 100644 --- a/__tests__/tilt/helpers/helpers.ts +++ b/__tests__/tilt/helpers/helpers.ts @@ -1,10 +1,12 @@ import { ChainAddress, + ChainConfig, ChainContext, ChainName, PlatformName, PlatformToChains, Signer, + WormholeConfig, nativeChainAddress, rpcAddress, } from "@wormhole-foundation/connect-sdk"; @@ -94,3 +96,22 @@ export async function getCosmosSigner( return new CosmosSigner(chain.chain, signingClient, acct); } + + + +// const conf = overrideChainSetting(CONFIG[network], { +// "Ethereum": { "rpc": "http://localhost:8545" }, +// "Bsc": { "rpc": "http://localhost:8546" }, +// "Solana": { "rpc": "http://localhost:8899" } +// }) + +export type ConfigOverride = { + [key: string]: Partial +} +export function overrideChainSetting(conf: WormholeConfig, overrides: ConfigOverride): WormholeConfig { + for (const [cn, oride] of Object.entries(overrides)) { + // @ts-ignore + conf.chains[cn] = { ...conf.chains[cn], ...oride } + } + return conf +} diff --git a/__tests__/tilt/tokenbridge.test.ts b/__tests__/tilt/tokenbridge.test.ts index 81055ee6ec..c5e7c555c2 100644 --- a/__tests__/tilt/tokenbridge.test.ts +++ b/__tests__/tilt/tokenbridge.test.ts @@ -1,30 +1,15 @@ import { TokenBridge, CONFIG, ChainConfig, Wormhole, WormholeConfig, isWormholeMessageId, nativeChainAddress, normalizeAmount, NativeAddress, Signer, ChainAddress } from "@wormhole-foundation/connect-sdk"; import { signSendWait } from "@wormhole-foundation/connect-sdk/src"; +import { EvmPlatform } from "@wormhole-foundation/connect-sdk-evm"; import { SolanaAddress, SolanaPlatform } from "@wormhole-foundation/connect-sdk-solana"; -import { EvmAddress, EvmPlatform } from "@wormhole-foundation/connect-sdk-evm"; -import { getEvmSigner, getSolSigner, getStuff } from './helpers'; +import { getStuff } from './helpers'; -type ConfigOverride = { - [key: string]: Partial -} - -function overrideChainSetting(conf: WormholeConfig, overrides: ConfigOverride): WormholeConfig { - for (const [cn, oride] of Object.entries(overrides)) { - // @ts-ignore - conf.chains[cn] = { ...conf.chains[cn], ...oride } - } - return conf -} +jest.setTimeout(10 * 60 * 1000) const network = "Devnet" const allPlatformCtrs = [SolanaPlatform, EvmPlatform]; -const conf = overrideChainSetting(CONFIG[network], { - "Ethereum": { "rpc": "http://localhost:8545" }, - "Bsc": { "rpc": "http://localhost:8546" }, - "Solana": { "rpc": "http://localhost:8899" } -}) +const conf = CONFIG[network] -jest.setTimeout(10 * 60 * 1000) describe("Tilt Token Bridge Tests", () => { const wh = new Wormhole(network, allPlatformCtrs, conf) diff --git a/core/base/src/constants/explorer.ts b/core/base/src/constants/explorer.ts index da63e49a8f..666125ee90 100644 --- a/core/base/src/constants/explorer.ts +++ b/core/base/src/constants/explorer.ts @@ -292,7 +292,7 @@ const explorerConfig = [ ] >; -const explorerConfs = constMap(explorerConfig); +export const explorerConfs = constMap(explorerConfig); export const explorerConfigs = (network: Network, chain: ChainName) => network === "Devnet" diff --git a/core/base/src/constants/rpc.ts b/core/base/src/constants/rpc.ts index 752f54f7b3..3abf5544b7 100644 --- a/core/base/src/constants/rpc.ts +++ b/core/base/src/constants/rpc.ts @@ -55,10 +55,18 @@ const rpcConfig = [ ["Terra2", ""], ], ], + [ + "Devnet", + [ + ["Ethereum", "http://localhost:8545"], + ["Bsc", "http://localhost:8546"], + ["Solana", "http://localhost:8899"], + ] + ] ] as const satisfies RoArray< - readonly ["Mainnet" | "Testnet", RoArray] + readonly [Network, RoArray] >; const rpc = constMap(rpcConfig); export const rpcAddress = (network: Network, chain: ChainName) => - network === "Devnet" ? undefined : rpc.get(network, chain); + rpc.has(network, chain) ? rpc.get(network, chain) : "";