From 197fd35120e20150d16cb993929e5c96f737c0d1 Mon Sep 17 00:00:00 2001 From: Ben Guidarelli Date: Fri, 5 Jan 2024 09:44:25 -0500 Subject: [PATCH] disallow same chain token transfers --- connect/src/protocols/tokenTransfer.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/connect/src/protocols/tokenTransfer.ts b/connect/src/protocols/tokenTransfer.ts index 355638c87..c512955e3 100644 --- a/connect/src/protocols/tokenTransfer.ts +++ b/connect/src/protocols/tokenTransfer.ts @@ -395,6 +395,9 @@ export class TokenTransfer wh: Wormhole, transfer: TokenTransferDetails, ): Promise { + if (transfer.from.chain === transfer.to.chain) + throw new Error("Cannot transfer to the same chain"); + if (transfer.payload && transfer.automatic) throw new Error("Payload with automatic delivery is not supported");