Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -307,13 +307,15 @@ export class SequenceV3Provider implements EIP1193Provider {
param: 'value',
type: 'uint256',
condition: 'LESS_THAN_OR_EQUAL',
value: token.decimals === 18 ? parseEther('0.1') : parseUnits('50', token.decimals || 6)
value: token.decimals === 18 ? parseEther('0.1') : parseUnits('50', token.decimals || 6),
cumulative: true
},
{
param: 'to',
type: 'address',
condition: 'EQUAL',
value: feeTokens.paymentAddress as Address
value: feeTokens.paymentAddress as Address,
cumulative: false
}
]
})
Expand Down Expand Up @@ -456,11 +458,13 @@ export class SequenceV3Provider implements EIP1193Provider {
const hasPermission = await this.client.hasPermission(this.currentChainId, transactions)

if (hasPermission) {
const feeOptions = await this.client.getFeeOptions(this.currentChainId, transactions)
let selectedFeeOption: Relayer.FeeOption | undefined
// @note feeConfirmationHandler will only be defined if the useFeeOptions hook is used anywhere in the app
// if it is not used, we do not query fee options at all
if (this.feeConfirmationHandler) {
const feeOptions = await this.client.getFeeOptions(this.currentChainId, transactions)
let selectedFeeOption: Relayer.FeeOption | undefined

if (feeOptions && feeOptions.length > 0) {
if (this.feeConfirmationHandler) {
if (feeOptions && feeOptions.length > 0) {
const id = uuidv4()
const confirmation = await this.feeConfirmationHandler.confirmFeeOption(id, feeOptions, [tx], this.currentChainId)

Expand All @@ -479,9 +483,13 @@ export class SequenceV3Provider implements EIP1193Provider {
}
selectedFeeOption = confirmation.feeOption
}
// @note if dApp has permission and there is a confirmation handler
// if there is no selectedFeeOption, dapp should sponsor the transaction or network used should be testnet
return this.client.sendTransaction(this.currentChainId, transactions, selectedFeeOption)
} else {
// @note if dApp has permission but there is no confirmation handler, in this case dapp should sponsor the transaction
return this.client.sendTransaction(this.currentChainId, transactions)
}
// @note no fee option selected, in this case dapp should sponsor the transaction
return this.client.sendTransaction(this.currentChainId, transactions, selectedFeeOption)
} else {
return new Promise((resolve, reject) => {
const unsubscribe = this.client.on('walletActionResponse', (data: any) => {
Expand Down