signAndSend method

Future<Map> signAndSend(
  1. TxInfoData txInfo,
  2. List params,
  3. String password, {
  4. dynamic onStatusChange(
    1. String
    )?,
  5. String? rawParam,
})

Send tx, params will be ignored if we have rawParam. onStatusChange is a callback when tx status change. @return txHash string if tx finalized success.

Implementation

Future<Map> signAndSend(
  TxInfoData txInfo,
  List params,
  String password, {
  Function(String)? onStatusChange,
  String? rawParam,
}) async {
  final param = rawParam != null ? rawParam : jsonEncode(params);
  final Map tx = txInfo.toJson();
  print(tx);
  print(param);
  final res = await service.signAndSend(
    tx,
    param,
    password,
    onStatusChange ?? (status) => print(status),
  );
  if (res?['error'] != null) {
    throw Exception(res?['error']);
  }
  return res ?? {};
}