pub struct FindPath { /* fields omitted */ }This endpoint represents a search for a series of assets through which to route a payment,
from source asset (debited from payer) to destination asset (credited to payee).
The endpoint will return any payment paths using assets available to a source account to the
desired destination asset.
https://www.stellar.org/developers/horizon/reference/endpoints/path-finding.html
use stellar_client::sync::Client;
use stellar_client::endpoint::{payment, Limit};
use stellar_client::resources::{Amount, AssetIdentifier, OperationKind};
let client = Client::horizon_test().unwrap();
let operations = client.request(payment::All::default().with_limit(20)).unwrap();
let account_ids = &operations
.records()
.iter()
.filter_map(|op| {
match op.kind() {
&OperationKind::CreateAccount(ref acct) => Some(acct.account()),
_ => None
}
})
.take(2)
.collect::<Vec<&str>>();
let endpoint = payment::FindPath::new(
&account_ids[0],
&account_ids[1],
AssetIdentifier::Native,
Amount::new(1)
);
let records = client.request(endpoint).unwrap();
assert!(records.records().len() > 0);
Creates a new payment::FindPath endpoint struct. Hand this to the client
in order to request series of assets through which to route a desired
payment.
use stellar_client::endpoint::payment;
use stellar_client::resources::{Amount, AssetIdentifier};
let paths = payment::FindPath::new(
"source_account",
"destination_account",
AssetIdentifier::new(
"credit_alphanum4",
Some("code".to_string()),
Some("issuer".to_string())
).unwrap(),
Amount::new(8675309)
);
Formats the value using the given formatter. Read more
Performs copy-assignment from source. Read more
The deserializable type that is expected to come back from the stellar server.
The request body to be sent to stellar. Generally this is just a () unit. Converts the implementing struct into an http request. Read more