add test to bootstrap network with random offers and trades

This commit is contained in:
woodser 2025-01-17 09:52:29 -05:00
parent 974362cd23
commit a33c7fd830
2 changed files with 147 additions and 41 deletions

View file

@ -802,12 +802,13 @@ export default class HavenoClient {
* Get the current market price per 1 XMR in the given currency.
*
* @param {string} assetCode - asset code to get the price of
* @return {number} the price of the asset per 1 XMR
* @return {number|undefined} the price of the asset per 1 XMR
*/
async getPrice(assetCode: string): Promise<number> {
async getPrice(assetCode: string): Promise<number|undefined> {
try {
return (await this._priceClient.getMarketPrice(new MarketPriceRequest().setCurrencyCode(assetCode), {password: this._password})).getPrice();
} catch (e: any) {
if (e.message.indexOf("not found") >= 0) return undefined;
throw new HavenoError(e.message, e.code);
}
}