getWallet method

Future<WalletResponse?> getWallet(
  1. String addressOrPublicKey
)

Implementation

Future<WalletResponse?> getWallet(String addressOrPublicKey) async {
  final resp = await _layer1ApiGet('/wallets/$addressOrPublicKey');

  if (resp.statusCode == HttpStatus.ok) {
    final body = json.decode(resp.body);
    return WalletResponse.fromJson(body['data']);
  } else if (resp.statusCode == HttpStatus.notFound) {
    return null;
  }

  return Future.error(HttpResponseError(resp.statusCode, resp.body));
}