createWallet method

Future createWallet({
  1. String? communityAddress,
  2. String? referralAddress,
})

Implementation

Future<dynamic> createWallet({
  String? communityAddress,
  String? referralAddress,
}) async {
  dynamic wallet = await getWallet();
  if (wallet != null && wallet['walletAddress'] != null) {
    print('Wallet already exists - wallet: $wallet');
    return wallet;
  }
  Response response = await _dio.post(
    '/v1/wallets',
    data: {
      'communityAddress': communityAddress,
      'referralAddress': referralAddress,
    },
    options: options,
  );
  if (response.data['job'] != null) {
    return response.data;
  } else {
    throw 'Error! Create wallet request failed';
  }
}