PaySui.fromJson constructor

PaySui.fromJson(
  1. dynamic data
)

Implementation

factory PaySui.fromJson(dynamic data) {
  final coinsData = data['coins'];
  final coinsList = <SuiObjectRef>[];
  for (var coin in coinsData) {
    coinsList.add(SuiObjectRef.fromJson(coin));
  }

  final recipientsData = data['recipients'];
  final recipientsList = <SuiAddress>[];
  for (var recipient in recipientsData) {
    recipientsList.add(recipient);
  }

  final amountsData = data['amounts'];
  final amountsList = <int>[];
  for (var amount in amountsData) {
    amountsList.add(amount);
  }

  return PaySui(
    coinsList,
    recipientsList,
    amountsList
  );
}