diff --git a/src/context/Web3.tsx b/src/context/Web3.tsx index d6a3a2d8..9c2cd25f 100644 --- a/src/context/Web3.tsx +++ b/src/context/Web3.tsx @@ -326,13 +326,18 @@ const Web3SignerProvider = (props: { const useWeb3Signer = () => useContext(Web3SignerContext); -const etherSwapCodeHash = () => { +const etherSwapCodeHashes = () => { switch (config.network) { case "mainnet": - return "0x4d6894da95269c76528b81c6d25425a2f6bba70156cfaf7725064f919647d955"; + return [ + "0x4d6894da95269c76528b81c6d25425a2f6bba70156cfaf7725064f919647d955", + ]; case "testnet": - return "0xd9a282305f30590b3df70c3c1f9338b042a97dff12736794e9de2cdabf8542c1"; + return [ + "0xd9a282305f30590b3df70c3c1f9338b042a97dff12736794e9de2cdabf8542c1", + "0xb8f6205d7fecc5b7a577519c7ec40af594f929d150c05bf84e1f94b7472dd783", + ]; default: return undefined; @@ -340,9 +345,9 @@ const etherSwapCodeHash = () => { }; export { + EtherSwapAbi, useWeb3Signer, - etherSwapCodeHash, Web3SignerProvider, - EtherSwapAbi, + etherSwapCodeHashes, customDerivationPathRdns, }; diff --git a/src/utils/validation.ts b/src/utils/validation.ts index d9de91c8..51d744df 100644 --- a/src/utils/validation.ts +++ b/src/utils/validation.ts @@ -15,7 +15,7 @@ import log from "loglevel"; import { LBTC, RBTC } from "../consts/Assets"; import { Denomination, Side, SwapType } from "../consts/Enums"; -import { etherSwapCodeHash } from "../context/Web3"; +import { etherSwapCodeHashes } from "../context/Web3"; import { ChainSwapDetails } from "./boltzClient"; import { decodeAddress } from "./compat"; import { formatAmountDenomination } from "./denomination"; @@ -30,13 +30,13 @@ import { createMusig, tweakMusig } from "./taproot/musig"; type ContractGetter = () => BaseContract; const validateContract = async (getEtherSwap: ContractGetter) => { - const codeHash = etherSwapCodeHash(); - if (codeHash === undefined) { + const codeHashes = etherSwapCodeHashes(); + if (codeHashes === undefined) { return true; } const code = await getEtherSwap().getDeployedCode(); - return codeHash === ethers.keccak256(code); + return codeHashes.includes(ethers.keccak256(code)); }; const validateAddress = async (