signAndSend method
Future<Map>
signAndSend(
- TxInfoData txInfo,
- List params,
- String password, {
- dynamic onStatusChange()?,
- 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 ?? {};
}