getRipplePathFound method
Future<RipplePathFound>
getRipplePathFound({
- required String sourceAccount,
- required String destinationAccount,
- required CurrencyAmount destinationAmount,
- CurrencyAmount? sendMax,
- List<
XRPCurrencies> ? currencies,
The ripple_path_find method is a simplified version of the path_find method that provides a single response with a payment path you can use right away. It is available in both the WebSocket and JSON-RPC APIs. However, the results tend to become outdated as time passes. Instead of making multiple calls to stay updated, you should instead use the path_find method to subscribe to continued updates where possible. Although the rippled server tries to find the cheapest path or combination of paths for making a payment, it is not guaranteed that the paths returned by this method are, in fact, the best paths.
Implementation
Future<RipplePathFound> getRipplePathFound(
{required String sourceAccount,
required String destinationAccount,
required CurrencyAmount destinationAmount,
CurrencyAmount? sendMax,
List<XRPCurrencies>? currencies}) async {
final Map<String, dynamic> configParams = {
"source_account": sourceAccount,
"destination_account": destinationAccount,
"destination_amount": destinationAmount.toJson(),
};
_createRpcConfig(configParams, "send_max", sendMax?.toJson());
_createRpcConfig(configParams, "source_currencies",
currencies?.map((e) => e.toJson()).toList());
final response = await makeCustomCall<Map<String, dynamic>>(
"ripple_path_find", [configParams]);
return RipplePathFound.fromJson(response);
}