Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions lib/src/4337/userop.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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].
///
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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;
Expand Down
6 changes: 4 additions & 2 deletions lib/src/common/contract.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,10 @@ class Contract {
: "0x",
if (sender != null) 'from': sender.hex,
};
return _provider.send<String>('eth_call', [calldata]).then(
(value) => function.decodeReturnValues(value));
return _provider.send<String>('eth_call', [
calldata,
BlockNum.current().toBlockParam()
]).then((value) => function.decodeReturnValues(value));
}

/// Asynchronously checks whether a smart contract is deployed at the specified address.
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,5 @@ dev_dependencies:
topics:
- wallets
- ethereum
- "4337"
- web3
- account-abstraction