subscribeBalance method

Future<String> subscribeBalance(
  1. String? address,
  2. dynamic onUpdate(
    1. BalanceData
    )
)

subscribe balance @return String msgChannel, call unsubscribeMessage(msgChannel) to unsub.

Implementation

Future<String> subscribeBalance(
  String? address,
  Function(BalanceData) onUpdate,
) async {
  final msgChannel = 'Balance';
  final code = 'account.getBalance(api, "$address", "$msgChannel")';
  await apiRoot.service.webView!.subscribeMessage(
      code, msgChannel, (data) => onUpdate(BalanceData.fromJson(data)));
  return msgChannel;
}