@zebec-network/exchange-card-sdk
Version:
An sdk for purchasing silver card in zebec
25 lines (24 loc) • 713 B
JavaScript
import axios from "axios";
import { CARD_API_URL } from "../constants";
export class ZebecCardAPIService {
apiUrl;
api;
constructor(sandbox) {
this.apiUrl = sandbox ? CARD_API_URL.Sandbox : CARD_API_URL.Production;
this.api = axios.create({ baseURL: this.apiUrl });
}
// Ping API status
async ping() {
try {
await this.api.get("/health");
return true;
}
catch (error) {
throw new Error("Card service is down. Please try again later.");
}
}
async fetchVault(symbol) {
const { data } = await this.api.get(`/tokens/deposit-address`, { params: { symbol } });
return data.data;
}
}