generateCryptoAddress method

Future<CryptoAddress> generateCryptoAddress({
  1. required String accountId,
})

Generate crypto address

Generates a one-time crypto address for depositing crypto.

https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_postcoinbaseaccountaddresses

Implementation

Future<CryptoAddress> generateCryptoAddress({
  required String accountId,
}) async {
  var response = await _coinbaseAccountsRestClient.generateCryptoAddress(
      accountId: accountId);

  if (response.statusCode != 200) throw response;

  return CryptoAddress.fromJson(mapDecode(response.body));
}