diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2020-04-30 10:43:38 +0200 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2020-04-30 10:43:38 +0200 |
commit | fd47924ec25359c0e383874cc4cbddaa1d155c29 (patch) | |
tree | 7b8367870ad3ac69e21e014b4c0944570d22c5ac | |
parent | e7449a38caf876165199f0b9ce947dfbc8df6a98 (diff) |
Client: Add resolve() function for translating IPNS hash to IPFS hash
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
-rw-r--r-- | src/repository/client.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/repository/client.rs b/src/repository/client.rs index 98de84e..59542c8 100644 --- a/src/repository/client.rs +++ b/src/repository/client.rs @@ -69,6 +69,15 @@ impl ClientFassade { .map(|res| IPNSHash::from(res.value)) .map_err(Into::into) } + + pub async fn resolve(&self, ipns: IPNSHash) -> Result<IPFSHash, Error> { + self.0 + .clone() + .name_resolve(Some(&ipns), true, false) + .await + .map(|res| IPFSHash::from(res.path)) + .map_err(Into::into) + } } /// Client wrapper for working with types directly on the client |