sendSignedOp method
Implementation
Future<String?> sendSignedOp(
String signature, UserOperation userOp, bool useDefaultPaymaster) async {
//signature is personal sign (Ethereum signed message signature)
try {
// userOp.setNonce = userOp.nonce as BigInt).toRadixString(16);
userOp.setSignature = signature;
if (useDefaultPaymaster) {
switch (this.paymasterConfig.paymasterType) {
case PaymasterType.Allowlist:
// here use class allowlist to check if the current scw is allowlisted
break;
default:
}
}
// var creds = EthPrivateKey.fromHex(
// "6c9196da0036d59015cc1adedfbc9c434bad536bc37ae4d2b0bef40a941e3fe8");
// print(userOp.toJson());
// var z = await entryPointContract.handleOps(
// ops: [
// EthereumAddress.fromHex(userOp.sender as String),
// BigInt.from(userOp.nonce!),
// hex.decode((userOp.initCode as String).substring(2)),
// hex.decode(userOp.callData!.substring(2)),
// BigInt.from(userOp.callGasLimit!),
// BigInt.from(userOp.verificationGasLimit!),
// BigInt.from(userOp.preVerificationGas!),
// BigInt.from(userOp.maxFeePerGas!),
// BigInt.from(userOp.maxPriorityFeePerGas!),
// hex.decode((userOp.paymasterAndData!).substring(2)),
// hex.decode((userOp.signature!).substring(2)),
// ],
// beneficiary: "0x2de11b40602f0ec6d902dc416996909458b5f83c",
// credentials: creds);
// print(z);
RPCModel response = await _makeRpcRequest(
'eth_sendUserOperation',
bundlerURL,
[userOp.toJson(), entryPointAddress],
);
return response.userOpHash!;
} catch (e) {
print(e);
// return e;
}
}