add get alias details method

This commit is contained in:
Alexandr 2024-11-05 21:09:05 +03:00
parent 8c4c8b2f63
commit 951971cc31
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;
}