'use strict'; const ofetch = require('ofetch'); var __defProp = Object.defineProperty; var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; var __publicField = (obj, key, value) => { __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value); return value; }; class CriptoYa { constructor() { __publicField(this, "api"); __publicField(this, "fetch"); this.api = "https://criptoya.com/api"; this.fetch = ofetch.ofetch.create({ baseURL: this.api, onResponse({ response }) { if (response._data === "Invalid pair") { throw new Error("Invalid pair"); } } }); } coin(params, options) { const { coin: co, fiat: fi, volume: vo } = params; const path = `/${co}/${fi}/${vo || ""}`; return this.fetch(path, options); } exchange(params, options) { const { coin: co, fiat: fi, volume: vo, exchange: ex } = params; const path = `/${ex}/${co}/${fi}/${vo || ""}`; return this.fetch(path, options); } dollar(options) { return this.fetch("/dolar", options); } fees(options) { return this.fetch("/fees", options); } banks(options) { return this.fetch("/bancostodos", options); } bank(bank, options) { return this.fetch(`/${bank}`, options); } cer(options) { return this.fetch("/cer", options); } uva(options) { return this.fetch("/uva", options); } } const createClient = () => new CriptoYa(); exports.CriptoYa = CriptoYa; exports.createClient = createClient;