Error: EthersException: INVALID_ARGUMENT invalid ENS name
Describe the bug Calling a state changing contract function with multiple arguments (including a tuple type) ends up with an obscure ethers exception instead of triggering a metamask signature request
To Reproduce Unzip the sample app and run on localhost
Excerpt from main.dart below:
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_web3/flutter_web3.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: const MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({Key? key, required this.title}) : super(key: key);
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
Future<Contract> _getDefaultReadWriteContract() async {
final Interface? defaultInterface = Interface(
await rootBundle.loadString('assets/contracts/Marketplace.json'));
return Contract(
'0xC52d8bB5E4e3b3FDDA63412017b872E88EdE6A38',
defaultInterface,
provider!.getSigner(),
);
}
Future<void> transactWithSignature() async {
const String buyerWalletAddress =
'0xE6d48d4C3e2C4A60B5E9fE0826ee49075dd08A43';
const String sellerWalletAddress =
'0xAcF0A764250288844aE2422986e33f802913990b';
const String nftAddress = '0x691936177FFaa7f35f7D3a84b8C886bc363fFD6A';
final BigNumber tokenId = BigNumber.from('3');
final BigNumber price = BigNumber.from('1');
final BigNumber fees = BigNumber.from('0');
final BigNumber nonce = BigNumber.from('6594093');
final BigNumber timestamp = BigNumber.from('43435093094');
final Contract operatingContract = await _getDefaultReadWriteContract();
final List<dynamic> args = <dynamic>[
<dynamic>[
buyerWalletAddress,
sellerWalletAddress,
nftAddress,
tokenId,
price,
fees,
nonce,
timestamp,
],
BigInt.from(27),
EthUtils.solidityPack(<String>[
'string'
], <dynamic>[
'0x0671384f9f4b748c46156c0f6c3c25143e99cbac311c131456403d4c313470b7'
]),
EthUtils.solidityPack(<String>[
'string'
], <dynamic>[
'0x4c773016fd49680c90a6e3d96822175768c893426187a1dd9a734a7662e9ebb8'
]),
];
print('starting transaction');
final TransactionResponse response = await operatingContract.send(
'transact',
args,
TransactionOverride(value: price.toBigInt),
);
print(response.hash);
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Center(
child: MaterialButton(
onPressed: transactWithSignature,
child: const Text('Transact'),
),
),
// This trailing comma makes auto-formatting nicer for build methods.
);
}
}
Expected behavior It should request a signature from metamask
Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):
- Browser Chrome
If you are looking to replicate please note the contract is on Ropsten (chain id 3)
Hi - let me know if there is anything else you need to look into this issue. If this is a genuine bug then I would be more than happy to try to fix it with a PR. thank you in advance.
I am facing the same problem when sending an instruction with 2 tuples as arguments. @cryptobys-rami , where you able to solve your issue?