RPCCall.fromMethod constructor

RPCCall.fromMethod({
  1. required String contractAddress,
  2. required AbiFunctionFragment function,
  3. required List params,
  4. String? from,
  5. BlockTagOrNumber? blockNumber = BlockTagOrNumber.latest,
})

Implementation

factory RPCCall.fromMethod(
    {required String contractAddress,
    required AbiFunctionFragment function,
    required List<dynamic> params,
    String? from,
    BlockTagOrNumber? blockNumber = BlockTagOrNumber.latest}) {
  final rawBytes = function.encode(params);

  return RPCCall._(
    contractAddress,
    BytesUtils.toHexString(rawBytes, prefix: "0x"),
    from,
    function,
    blockNumber,
  );
}