Skip to content

Commit

Permalink
Fix zeroAddress and null case for native token fee option
Browse files Browse the repository at this point in the history
  • Loading branch information
tolgahan-arikan committed Dec 17, 2024
1 parent a63adc1 commit fbc23e1
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import {
ProviderDisconnectedError,
TransactionRejectedRpcError,
UserRejectedRequestError,
getAddress
getAddress,
zeroAddress
} from 'viem'
import { createConnector } from 'wagmi'

Expand Down Expand Up @@ -322,7 +323,13 @@ export class SequenceWaasProvider extends ethers.AbstractProvider implements EIP
throw new UserRejectedRequestError(new Error('User confirmation ids do not match'))
}

selectedFeeOption = feeOptions.find(feeOption => feeOption.token.contractAddress === confirmation.feeTokenAddress)
selectedFeeOption = feeOptions.find(feeOption => {
// Handle the case where feeTokenAddress is ZeroAddress and contractAddress is null
if (confirmation.feeTokenAddress === zeroAddress && feeOption.token.contractAddress === null) {
return true
}
return feeOption.token.contractAddress === confirmation.feeTokenAddress
})
}

if (this.requestConfirmationHandler && this.showConfirmation) {
Expand Down

0 comments on commit fbc23e1

Please sign in to comment.