diff --git a/lib/src/4337/userop.dart b/lib/src/4337/userop.dart index 0121441..8c5a7c7 100644 --- a/lib/src/4337/userop.dart +++ b/lib/src/4337/userop.dart @@ -74,9 +74,9 @@ class UserOperation implements UserOperationBase { /// - `sender`: The Ethereum address of the sender. Defaults to the smartwallet address. /// - `nonce`: The nonce value. Defaults to [BigInt.zero]. /// - `initCode`: The initialization code as a [Uint8List]. Defaults to an empty [Uint8List]. - /// - `callGasLimit`: The call gas limit as a [BigInt]. Defaults to [BigInt.from(10000000)]. - /// - `verificationGasLimit`: The verification gas limit as a [BigInt]. Defaults to [BigInt.from(10000000)]. - /// - `preVerificationGas`: The pre-verification gas as a [BigInt]. Defaults to [BigInt.from(21000)]. + /// - `callGasLimit`: The call gas limit as a [BigInt]. Defaults to [BigInt.from(250000)]. + /// - `verificationGasLimit`: The verification gas limit as a [BigInt]. Defaults to [BigInt.from(750000)]. + /// - `preVerificationGas`: The pre-verification gas as a [BigInt]. Defaults to [BigInt.from(51000)]. /// - `maxFeePerGas`: The maximum fee per gas as a [BigInt]. Defaults to [BigInt.one]. /// - `maxPriorityFeePerGas`: The maximum priority fee per gas as a [BigInt]. Defaults to [BigInt.one]. /// @@ -106,9 +106,9 @@ class UserOperation implements UserOperationBase { nonce: nonce ?? BigInt.zero, initCode: initCode ?? Uint8List(0), callData: callData, - callGasLimit: callGasLimit ?? BigInt.from(10000000), - verificationGasLimit: verificationGasLimit ?? BigInt.from(10000000), - preVerificationGas: preVerificationGas ?? BigInt.from(21000), + callGasLimit: callGasLimit ?? BigInt.from(250000), + verificationGasLimit: verificationGasLimit ?? BigInt.from(750000), + preVerificationGas: preVerificationGas ?? BigInt.from(51000), maxFeePerGas: maxFeePerGas ?? BigInt.one, maxPriorityFeePerGas: maxPriorityFeePerGas ?? BigInt.one, signature: "0x", @@ -148,7 +148,7 @@ class UserOperation implements UserOperationBase { map['verificationGasLimit'] = '0x${opGas.verificationGasLimit.toRadixString(16)}'; map['preVerificationGas'] = - '0x${(opGas.preVerificationGas + BigInt.from(35000)).toRadixString(16)}'; + '0x${BigInt.from(opGas.preVerificationGas.toDouble() * 1.2).toRadixString(16)}'; } if (sender != null) map['sender'] = sender.hex; diff --git a/lib/src/common/contract.dart b/lib/src/common/contract.dart index 1132688..f4eec72 100644 --- a/lib/src/common/contract.dart +++ b/lib/src/common/contract.dart @@ -49,8 +49,10 @@ class Contract { : "0x", if (sender != null) 'from': sender.hex, }; - return _provider.send('eth_call', [calldata]).then( - (value) => function.decodeReturnValues(value)); + return _provider.send('eth_call', [ + calldata, + BlockNum.current().toBlockParam() + ]).then((value) => function.decodeReturnValues(value)); } /// Asynchronously checks whether a smart contract is deployed at the specified address. diff --git a/pubspec.yaml b/pubspec.yaml index 1b45a3c..9d97ea7 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -49,5 +49,5 @@ dev_dependencies: topics: - wallets - ethereum - - "4337" + - web3 - account-abstraction