Merge pull request #5 from aiprivet/feature_add_get_alias_details

add get alias details method
This commit is contained in:
Ravaga 2024-11-05 23:55:42 +04:00 committed by GitHub
commit ab060df82a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 25 additions and 0 deletions

View file

@ -7,6 +7,7 @@ import {
ValidationParams,
BalanceInfo,
TxInfo,
AliasDetails,
} from "./types";
import { ZANO_ASSET_ID, ZanoError } from "./utils";
@ -292,6 +293,24 @@ class ServerWallet {
return txs.data.result as TxInfo;
}
async getAliasDetails(alias: string) {
try {
const response = await this.fetchDaemon("get_alias_details", {
alias,
});
if (response.data.result) {
return response.data.result as AliasDetails;
} else {
throw new ZanoError(
`Error fetching alias ${alias}`,
"ALIAS_FETCH_ERROR"
);
}
} catch {
throw new ZanoError("Failed to fetch alias", "ALIAS_FETCH_ERROR");
}
}
}
export default ServerWallet;

View file

@ -100,4 +100,10 @@ export interface TxInfo {
};
total_transfers: number;
transfers: Transfer[];
}
export interface AliasDetails {
address: string;
comment: string;
tracking_key: string;
}