From dba2d975853ecfa0c65e2b7e93ddd8d072f806dc Mon Sep 17 00:00:00 2001 From: gomes <17035424+gomesalexandre@users.noreply.github.com> Date: Mon, 8 Dec 2025 20:10:54 +0300 Subject: [PATCH 1/4] feat: add Monad support to Near Intents swapper MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add Monad chain support following the same pattern as ZEC support. Near Intents API now supports Monad blockchain with identifier 'monad'. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- packages/swapper/src/swappers/NearIntentsSwapper/types.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/swapper/src/swappers/NearIntentsSwapper/types.ts b/packages/swapper/src/swappers/NearIntentsSwapper/types.ts index 2a04eaa43ef..975f8a382fd 100644 --- a/packages/swapper/src/swappers/NearIntentsSwapper/types.ts +++ b/packages/swapper/src/swappers/NearIntentsSwapper/types.ts @@ -21,6 +21,7 @@ export const nearIntentsSupportedChainIds = [ KnownChainIds.SolanaMainnet, KnownChainIds.TronMainnet, KnownChainIds.SuiMainnet, + KnownChainIds.MonadMainnet, ] as const export type NearIntentsSupportedChainId = (typeof nearIntentsSupportedChainIds)[number] @@ -40,4 +41,5 @@ export const chainIdToNearIntentsChain: Record Date: Mon, 8 Dec 2025 20:13:28 +0300 Subject: [PATCH 2/4] feat: add Monad to NEP-245 chains for token lookup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add 'monad' to the NEP245_CHAINS list to ensure proper token lookup for Monad tokens. This follows the same pattern as other NEP-245 chains like BSC, Polygon, and Avalanche. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .../src/swappers/NearIntentsSwapper/utils/helpers/helpers.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/swapper/src/swappers/NearIntentsSwapper/utils/helpers/helpers.ts b/packages/swapper/src/swappers/NearIntentsSwapper/utils/helpers/helpers.ts index 60503272030..13a8aea494a 100644 --- a/packages/swapper/src/swappers/NearIntentsSwapper/utils/helpers/helpers.ts +++ b/packages/swapper/src/swappers/NearIntentsSwapper/utils/helpers/helpers.ts @@ -39,7 +39,7 @@ export const getNearIntentsAsset = ({ return `nep141:${nearNetwork}-${contractAddress.toLowerCase()}.omft.near` } -const NEP245_CHAINS = ['bsc', 'pol', 'avax', 'op', 'tron'] as const +const NEP245_CHAINS = ['bsc', 'pol', 'avax', 'op', 'tron', 'monad'] as const const TOKEN_LOOKUP_CHAINS = ['sui'] as const export const assetToNearIntentsAsset = async (asset: Asset): Promise => { From bbb205f52a49569be5262c977d7ac08653b0c686 Mon Sep 17 00:00:00 2001 From: gomes <17035424+gomesalexandre@users.noreply.github.com> Date: Mon, 8 Dec 2025 21:27:56 +0300 Subject: [PATCH 3/4] fix: bypass Tenderly for Monad gas estimation in Near Intents MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Skip Tenderly simulation for Monad chains in getTradeRate - Use adapter.getFeeData() directly for Monad (same as send modal) - Preserves existing behavior for all other EVM chains - getTradeQuote already uses adapter.getFeeData() for all chains Near Intents deposits are simple sends, so we can use the standard adapter gas estimation which works correctly for Monad. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .../swapperApi/getTradeQuote.ts | 1 - .../swapperApi/getTradeRate.ts | 33 +++++++++++++++---- 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/packages/swapper/src/swappers/NearIntentsSwapper/swapperApi/getTradeQuote.ts b/packages/swapper/src/swappers/NearIntentsSwapper/swapperApi/getTradeQuote.ts index b8c5644d2d9..e46267c6f7b 100644 --- a/packages/swapper/src/swappers/NearIntentsSwapper/swapperApi/getTradeQuote.ts +++ b/packages/swapper/src/swappers/NearIntentsSwapper/swapperApi/getTradeQuote.ts @@ -148,7 +148,6 @@ export const getTradeQuote = async ( const sellAdapter = deps.assertGetEvmChainAdapter(sellAsset.chainId) const contractAddress = contractAddressOrUndefined(sellAsset.assetId) const data = evm.getErc20Data(depositAddress, sellAmount, contractAddress) - const feeData = await sellAdapter.getFeeData({ to: contractAddress ?? depositAddress, value: isNativeEvmAsset(sellAsset.assetId) ? sellAmount : '0', diff --git a/packages/swapper/src/swappers/NearIntentsSwapper/swapperApi/getTradeRate.ts b/packages/swapper/src/swappers/NearIntentsSwapper/swapperApi/getTradeRate.ts index 289c00fd88e..28c528d5efd 100644 --- a/packages/swapper/src/swappers/NearIntentsSwapper/swapperApi/getTradeRate.ts +++ b/packages/swapper/src/swappers/NearIntentsSwapper/swapperApi/getTradeRate.ts @@ -1,4 +1,4 @@ -import { CHAIN_NAMESPACE, fromAssetId } from '@shapeshiftoss/caip' +import { CHAIN_NAMESPACE, fromAssetId, monadChainId } from '@shapeshiftoss/caip' import { evm } from '@shapeshiftoss/chain-adapters' import { bn, @@ -125,10 +125,32 @@ export const getTradeRate = async ( const getFeeData = async (): Promise => { switch (chainNamespace) { case CHAIN_NAMESPACE.Evm: { - try { - const contractAddress = contractAddressOrUndefined(sellAsset.assetId) - const data = evm.getErc20Data(depositAddress, sellAmount, contractAddress) + const sellAdapter = deps.assertGetEvmChainAdapter(sellAsset.chainId) + const contractAddress = contractAddressOrUndefined(sellAsset.assetId) + const data = evm.getErc20Data(depositAddress, sellAmount, contractAddress) + + // For Monad, skip Tenderly and use adapter's getFeeData directly + if (sellAsset.chainId === monadChainId) { + try { + const feeData = await sellAdapter.getFeeData({ + to: contractAddress ?? depositAddress, + value: isNativeEvmAsset(sellAsset.assetId) ? sellAmount : '0', + chainSpecific: { + from: sendAddress || depositAddress, + contractAddress, + data: data || '0x', + }, + sendMax: false, + }) + return feeData.fast.txFee + } catch (error) { + console.error('Failed to estimate fees for Monad Near Intents:', error) + return '0' + } + } + // For other EVM chains, use Tenderly simulation + try { const simulationResult = await simulateWithStateOverrides( { chainId: sellAsset.chainId, @@ -150,11 +172,8 @@ export const getTradeRate = async ( } // Calculate network fee using the simulated gas limit - const sellAdapter = deps.assertGetEvmChainAdapter(sellAsset.chainId) const { average } = await sellAdapter.getGasFeeData() - const supportsEIP1559 = 'maxFeePerGas' in average - const networkFeeCryptoBaseUnit = evm.calcNetworkFeeCryptoBaseUnit({ ...average, supportsEIP1559, From be38d5b030d7d28e0476f4de72fb88a4795cd7dd Mon Sep 17 00:00:00 2001 From: gomes <17035424+gomesalexandre@users.noreply.github.com> Date: Mon, 8 Dec 2025 21:28:40 +0300 Subject: [PATCH 4/4] fix: derp --- .../src/swappers/NearIntentsSwapper/swapperApi/getTradeQuote.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/swapper/src/swappers/NearIntentsSwapper/swapperApi/getTradeQuote.ts b/packages/swapper/src/swappers/NearIntentsSwapper/swapperApi/getTradeQuote.ts index e46267c6f7b..b8c5644d2d9 100644 --- a/packages/swapper/src/swappers/NearIntentsSwapper/swapperApi/getTradeQuote.ts +++ b/packages/swapper/src/swappers/NearIntentsSwapper/swapperApi/getTradeQuote.ts @@ -148,6 +148,7 @@ export const getTradeQuote = async ( const sellAdapter = deps.assertGetEvmChainAdapter(sellAsset.chainId) const contractAddress = contractAddressOrUndefined(sellAsset.assetId) const data = evm.getErc20Data(depositAddress, sellAmount, contractAddress) + const feeData = await sellAdapter.getFeeData({ to: contractAddress ?? depositAddress, value: isNativeEvmAsset(sellAsset.assetId) ? sellAmount : '0',