Skip to content

Commit

Permalink
add eth_chainId and eth_supportedEntryPoints to bundler class
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewwahid authored and Sednaoui committed Dec 3, 2023
1 parent 23a8690 commit 6ec6821
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions lib/services/bundler.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,32 @@ class Bundler {
return signedOperation;
} // todo: doesn't belong to this file

Future<BigInt?> getChainId() async {
try{
var response = await jsonRpc.call("eth_chainId", []);
return Utils.decodeBigInt(response.result);
} on RPCError catch(e){
print("Error occurred (${e.errorCode}, ${e.message})");
return null;
} on Exception catch(e){
print("Error occurred $e");
return null;
}
}

Future<List<EthereumAddress>?> getSupportedEntryPoints() async {
try{
var response = await jsonRpc.call("eth_supportedEntryPoints", []);
return (response.result as List<dynamic>).map((e) => EthereumAddress.fromHex(e)).toList();
} on RPCError catch(e){
print("Error occurred (${e.errorCode}, ${e.message})");
return null;
} on Exception catch(e){
print("Error occurred $e");
return null;
}
}

Future<RelayResponse?> sendUserOperation(UserOperation userOp) async{
try{
var response = await jsonRpc.call(
Expand Down

0 comments on commit 6ec6821

Please sign in to comment.