From 7ca4047f3585978cc8f63bcc0cb9b112c4366a4c Mon Sep 17 00:00:00 2001 From: Sebastian Scatularo Date: Tue, 7 Nov 2023 16:13:08 -0300 Subject: [PATCH 1/2] add fix to allow sending canonical tBTC to non canonical supported network --- .../providers/tbtc/solana/WormholeGateway.v2.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/assets/providers/tbtc/solana/WormholeGateway.v2.ts b/src/assets/providers/tbtc/solana/WormholeGateway.v2.ts index b111b648c..a336ee9de 100644 --- a/src/assets/providers/tbtc/solana/WormholeGateway.v2.ts +++ b/src/assets/providers/tbtc/solana/WormholeGateway.v2.ts @@ -14,7 +14,10 @@ import { THRESHOLD_TBTC_SOLANA_PROGRAM, } from "../../../../utils/consts"; import { - CHAIN_ID_ETH, + CHAIN_ID_ARBITRUM, + CHAIN_ID_BASE, + CHAIN_ID_OPTIMISM, + CHAIN_ID_POLYGON, CHAIN_ID_SOLANA, ChainId, SignedVaa, @@ -176,6 +179,12 @@ function sendTbtcWrapped( return tx; } +const CANNONICAL_CHAINS: number[] = [CHAIN_ID_POLYGON, CHAIN_ID_OPTIMISM, CHAIN_ID_ARBITRUM, CHAIN_ID_BASE, CHAIN_ID_SOLANA]; + +const isCanonical = (chainId: number) => { + return CANNONICAL_CHAINS.includes(chainId); +} + /** * Send tBtc beween gateways allow burn and mint of tBtc */ @@ -347,7 +356,7 @@ export function newThresholdWormholeGateway( new PublicKey(senderToken), new PublicKey(wallet.getAddress()!) ); - if (recipientChain === CHAIN_ID_ETH) { + if (!isCanonical(recipientChain)) { const wrappedAccounts = { custodian, wrappedTbtcToken, From 2e353856561758e2b8eb5ee08c2a6446299f2586 Mon Sep 17 00:00:00 2001 From: Sebastian Scatularo Date: Tue, 7 Nov 2023 16:35:55 -0300 Subject: [PATCH 2/2] run prettier --- src/assets/providers/tbtc/solana/WormholeGateway.v2.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/assets/providers/tbtc/solana/WormholeGateway.v2.ts b/src/assets/providers/tbtc/solana/WormholeGateway.v2.ts index a336ee9de..caba8a1ed 100644 --- a/src/assets/providers/tbtc/solana/WormholeGateway.v2.ts +++ b/src/assets/providers/tbtc/solana/WormholeGateway.v2.ts @@ -179,11 +179,17 @@ function sendTbtcWrapped( return tx; } -const CANNONICAL_CHAINS: number[] = [CHAIN_ID_POLYGON, CHAIN_ID_OPTIMISM, CHAIN_ID_ARBITRUM, CHAIN_ID_BASE, CHAIN_ID_SOLANA]; +const CANNONICAL_CHAINS: number[] = [ + CHAIN_ID_POLYGON, + CHAIN_ID_OPTIMISM, + CHAIN_ID_ARBITRUM, + CHAIN_ID_BASE, + CHAIN_ID_SOLANA, +]; const isCanonical = (chainId: number) => { return CANNONICAL_CHAINS.includes(chainId); -} +}; /** * Send tBtc beween gateways allow burn and mint of tBtc