Skip to content
Open
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
20 changes: 11 additions & 9 deletions src/components/core/utils/nonceHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -284,13 +284,15 @@ async function verifySignatureForConsumer(
// Continue to smart account check
}

// Try ERC-1271 (smart account) validation
try {
const targetChainId = chainId || Object.keys(config?.supportedNetworks || {})[0]
if (targetChainId && config?.supportedNetworks?.[targetChainId]) {
const provider = new ethers.JsonRpcProvider(
config.supportedNetworks[targetChainId].rpc
)
// An explicit chain restricts validation; otherwise try every configured network.
const targetChainIds = chainId
? [chainId]
: Object.keys(config?.supportedNetworks || {})
for (const targetChainId of targetChainIds) {
const network = config?.supportedNetworks?.[targetChainId]
if (!network) continue
try {
const provider = new ethers.JsonRpcProvider(network.rpc)

// Try custom hash format (for backward compatibility)
if (await isERC1271Valid(consumer, consumerMessage, signature, provider)) {
Expand All @@ -302,9 +304,9 @@ async function verifySignatureForConsumer(
if (await isERC1271Valid(consumer, eip191Hash, signature, provider)) {
return true
}
} catch (error) {
CORE_LOGGER.error(`ERC-1271 signature validation error: ${error?.message}`)
}
} catch (error) {
CORE_LOGGER.error(`ERC-1271 signature validation error: ${error?.message}`)
}

return false
Expand Down
Loading