getFucent method

Future<Map<String, dynamic>> getFucent(
  1. String address
)

Implementation

Future<Map<String, dynamic>> getFucent(String address) async {
  final client = http.Client();
  try {
    final fucentUrl = getFaucetUrl(rpc.url);
    final requestPayload = {'destination': address, 'userAgent': "xrpl-dart"};

    final response = await client
        .post(Uri.parse(fucentUrl),
            headers: {'Content-Type': 'application/json'},
            body: json.encode(requestPayload))
        .timeout(const Duration(seconds: 30));
    return json.decode(response.body);
  } finally {
    client.close();
  }
}