diff --git a/src/core/EVM/EVMStepExecutor.ts b/src/core/EVM/EVMStepExecutor.ts index be6f7a07..19e71392 100644 --- a/src/core/EVM/EVMStepExecutor.ts +++ b/src/core/EVM/EVMStepExecutor.ts @@ -35,6 +35,7 @@ import type { TransactionMethodType, TransactionParameters, } from '../types.js' +import { isTokenMessageSigningAllowed } from '../utils.js' import { waitForDestinationChainTransaction } from '../waitForDestinationChainTransaction.js' import { checkAllowance } from './checkAllowance.js' import { getActionWithFallback } from './getActionWithFallback.js' @@ -423,7 +424,10 @@ export class EVMStepExecutor extends BaseStepExecutor { // Check if message signing is disabled - useful for smart contract wallets // We also disable message signing for custom steps const disableMessageSigning = - this.executionOptions?.disableMessageSigning || step.type !== 'lifi' + this.executionOptions?.disableMessageSigning || + step.type !== 'lifi' || + // We disable message signing for tokens with '₮' symbol + !isTokenMessageSigningAllowed(step.action.fromToken) // Check if chain has Permit2 contract deployed. Permit2 should not be available for atomic batch. const permit2Supported = diff --git a/src/core/utils.ts b/src/core/utils.ts index c9b5f5a4..19153cfb 100644 --- a/src/core/utils.ts +++ b/src/core/utils.ts @@ -1,4 +1,4 @@ -import type { LiFiStep } from '@lifi/types' +import type { LiFiStep, Token } from '@lifi/types' // Standard threshold for destination amount difference (0.5%) const standardThreshold = 0.005 @@ -28,3 +28,15 @@ export function checkStepSlippageThreshold( } return actualSlippage <= setSlippage } + +/** + * Checks whether a given token is eligible for message signing. + * Tokens with '₮' symbol in their name are disallowed, + * since such tokens may have non-standard signing requirements or compatibility issues with hardware wallets. + * + * @param token - The token object to check. + * @returns true if the token is allowed for message signing, false otherwise. + */ +export const isTokenMessageSigningAllowed = (token: Token): boolean => { + return !token.name?.includes('₮') && !token.symbol?.includes('₮') +} diff --git a/src/index.ts b/src/index.ts index 2d23255e..2fd7e96c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -83,6 +83,7 @@ export type { export type { UTXOProvider, UTXOProviderOptions } from './core/UTXO/types.js' export { isUTXO } from './core/UTXO/types.js' export { UTXO } from './core/UTXO/UTXO.js' +export { isTokenMessageSigningAllowed as isTokenAllowedForMessageSigning } from './core/utils.js' export { createConfig } from './createConfig.js' export { BaseError } from './errors/baseError.js' export type { ErrorCode } from './errors/constants.js'