get static method

Future<Profile?> get()

Retrieves the current state of the profile on chain, or null if no profile exists.

Implementation

static Future<Profile?> get () async {
  var ll = await PylonsWallet.instance.getProfile();
  if (ll.success) {
    final b = <String, Int64>{};
    ll.data!.coins.forEach((element) {
      // this is hacky, I don't love the shuffle but if we're not supporting fractional values there's no reason to support decimal, right?
      b[element.denom] = Int64.parseInt(element.amount.value.toString());
    });
    final i = <Item>[];
    ll.data!.items.forEach((element) {
      i.add(Item.fromItem(element));
    });
    return Profile(ll.data!.address, ll.data!.username, Map.unmodifiable(b), List.unmodifiable(i), ll.data!.stripeExists);
  } else {
    return null;
  }
}