diff --git a/.changeset/sour-items-enjoy.md b/.changeset/sour-items-enjoy.md new file mode 100644 index 0000000000..679b75861b --- /dev/null +++ b/.changeset/sour-items-enjoy.md @@ -0,0 +1,5 @@ +--- +"@exactly/mobile": patch +--- + +🐛 avoid chain mismatch on bridge transfer diff --git a/src/components/add-funds/Bridge.tsx b/src/components/add-funds/Bridge.tsx index 00dc280a34..6667397fc9 100644 --- a/src/components/add-funds/Bridge.tsx +++ b/src/components/add-funds/Bridge.tsx @@ -421,6 +421,7 @@ export default function Bridge() { mutationFn: async () => { if (!senderAddress || !source || !account) throw new Error("missing transfer context"); if (!isSameChain) throw new Error("transfer mutation invoked for different chains"); + await switchChain(senderConfig, { chainId: source.chain }); setBridgeStatus(t("Submitting transfer transaction...")); const recipient = getAddress(account); let hash: Hex; @@ -428,9 +429,9 @@ export default function Bridge() { hash = await sendTx({ chainId: source.chain, to: recipient, value: sourceAmount }); } else { if (!transferSimulation) throw new Error("missing transfer simulation"); - hash = await transfer(transferSimulation.request); + hash = await transfer({ ...transferSimulation.request, chainId: source.chain }); } - await waitForTransactionReceipt(senderConfig, { hash }); + await waitForTransactionReceipt(senderConfig, { hash, chainId: source.chain }); setBridgeStatus(t("Transfer transaction submitted")); }, onSuccess: async () => {