Skip to content

requestWriteContract: envelope type "0x2" included gasPrice #165

@myslajek

Description

@myslajek

SDK Affected

AppKit

Describe the bug
When trying to call write contract functions via appKit and MetaMask, I'm facing an error in the dialog as shown below:

Transaction error Invalid transaction envelope type: specified type "0x2" but included a gasPrice instead of maxFeePerGas and maxPriorityFeePerGas

This error occurs for all write functions in this contract: https://testnet.sonicscan.org/address/0x039e2fB66102314Ce7b64Ce5Ce3E5183bc94aD38#writeContract#F1.

The network I'm using is documented here: https://docs.soniclabs.com/sonic/build-on-sonic/getting-started

I have already tried specifying maxFeePerGas and maxPriorityFeePerGas parameters, as well as using just the gasPrice parameter, but I still encounter the same error dialog.

Reproducible code

    final contract = _createWSContract();

    final chainId = _appKitModal!.selectedChain!.chainId;
    final namespace = NamespaceUtils.getNamespaceFromChain(chainId);
    final address = _appKitModal.session!.getAddress(namespace);
    final from = address == null ? null : EthereumAddress.fromHex(address);

    final spenderParam = EthereumAddress.fromHex(_spender);

    final amountToApprove = double.tryParse(_amountController.text) ?? 0.1;
    final amountInWei = BigInt.from(amountToApprove * 1e18);

    try {
      final result = await _appKitModal.requestWriteContract(
        topic: _appKitModal.session!.topic,
        chainId: chainId,
        deployedContract: contract,
        functionName: 'approve',
        transaction: Transaction(from: from),
        parameters: [spenderParam, amountInWei],
      );
    } catch (e) {
      debugPrint("$e");
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    appkitAppKit related issueinvestigationInvestigation needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions