diff --git a/packages/connect/src/connectors/wagmiConnectors/sequenceV3Connector.ts b/packages/connect/src/connectors/wagmiConnectors/sequenceV3Connector.ts index 2ab7ab144..592e5c32d 100644 --- a/packages/connect/src/connectors/wagmiConnectors/sequenceV3Connector.ts +++ b/packages/connect/src/connectors/wagmiConnectors/sequenceV3Connector.ts @@ -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 } ] }) @@ -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) @@ -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) => {