Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/core/EVM/EVMStepExecutor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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 =
Expand Down
14 changes: 13 additions & 1 deletion src/core/utils.ts
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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('₮')
}
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down