@volare.finance/volare.js
Version:
The SDK for Volare Protocol
34 lines • 1.04 kB
JavaScript
;
/**
* @file price.ts
* @author astra <astra@volare.finance>
* @date 2022
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.Price = void 0;
const tslib_1 = require("tslib");
const utils_js_1 = require("@volare.finance/utils.js");
const url_1 = require("./url");
class Price {
constructor(instance) {
this.instance = instance;
}
prices(symbols, source) {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
const response = yield this.instance.get((0, url_1.PricesUrl)(), {
params: {
symbols: symbols.join(','),
source,
},
});
const prices = {};
const prices2 = response.data;
for (let i = 0; i < symbols.length; i++) {
prices[symbols[i]] = new utils_js_1.BigNumber(prices2[symbols[i]] || 0);
}
return prices;
});
}
}
exports.Price = Price;
//# sourceMappingURL=price.js.map