Skip to content
This repository was archived by the owner on Feb 26, 2026. It is now read-only.
This repository was archived by the owner on Feb 26, 2026. It is now read-only.

[Bug]: Invalid transaction envelope type: specified type "0x2" but included a gasPrice instead of maxFeePerGas and maxPriorityFeePerGas #156

@auxtern

Description

@auxtern

Provide environment information

Android 14 on Realme 10

MetaMask Android SDK Version

implementation("io.metamask.androidsdk:metamask-android-sdk:0.6.6")

MetaMask Mobile app Version

7.45.2

Android Version

14

Describe the Bug

When sending transactions using SDK metamask displays error message:
Invalid transaction envelope type: specified type "0x2" but included a gasPrice instead of maxFeePerGas and maxPriorityFeePerGas

Image

Expected Behavior

The transaction should be successful after the user selects the "Confirm" button.

Image

Link to reproduction - Issues with a link to complete (but minimal) reproduction code will be addressed faster

No response

To Reproduce

Sending transactions via metamask SDK, a few weeks ago it still worked. Recently an Invalid transaction envelope type: specified type "0x2" but included a gasPrice instead of maxFeePerGas and maxPriorityFeePerGas error message appeared. I suspect my transaction is not EIP-1559 transaction compliant and previously it worked because it was using legacy EIP.

is EventSinkMetaMask.SendRequest -> {
          val (transactionData) = event

          when (val result = ethereum.sendRequest(
            EthereumRequest(
              method = EthereumMethod.ETH_SEND_TRANSACTION.value,
              params = listOf(
                mapOf(
                  "to" to ConstUtil.ethContractAddress,
                  "from" to ethereum.selectedAddress,
                  "data" to transactionData,
                )
              )
            )
          )) {
            is Result.Success.Item -> {
              _uiState.update {
                it.copy(isTransactionSuccess = true)
              }
              Log.d("MetaMaskViewModel", result.toString())
            }

            else -> {
              Log.d("MetaMaskViewModel", result.toString())
              _uiState.update {
                it.copy(isTransactionSuccess = false)
              }
            }
          }
        }

I read this documentation and changed the code, but still get the error.
https://docs.metamask.io/wallet/reference/json-rpc-methods/eth_sendtransaction/

EthereumRequest(
        method = EthereumMethod.ETH_SEND_TRANSACTION.value,
        params = listOf(
          mapOf(
            "to" to ConstUtil.ethContractAddress,
            "from" to ethereum.selectedAddress,
            "data" to transactionData,
            "maxPriorityFeePerGas" to "0x7530",
            "maxFeePerGas" to "0x7530" // 30.000 gas limit
          )
        )
      )

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions