@shogun-sdk/money-legos
Version:
Shogun Money Legos: clients and types for quotes, memes, prices, balances, fees, validations, etc.
148 lines • 6.22 kB
JavaScript
import { GeneralInfoAPI } from './info/general.js';
import { SpotInfoAPI } from './info/spot.js';
import { PerpetualsInfoAPI } from './info/perpetuals.js';
import { HttpApi } from '../utils/httpApi.js';
import { ENDPOINTS } from '../types/constants.js';
export class InfoAPI {
constructor(baseURL, rateLimiter, symbolConversion, parent) {
Object.defineProperty(this, "spot", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
Object.defineProperty(this, "perpetuals", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
Object.defineProperty(this, "httpApi", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
Object.defineProperty(this, "generalAPI", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
Object.defineProperty(this, "symbolConversion", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
Object.defineProperty(this, "parent", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
this.httpApi = new HttpApi(baseURL, ENDPOINTS.INFO, rateLimiter);
this.symbolConversion = symbolConversion;
this.parent = parent;
this.generalAPI = new GeneralInfoAPI(this.httpApi, this.symbolConversion, this.parent);
this.spot = new SpotInfoAPI(this.httpApi, this.symbolConversion, this.parent);
this.perpetuals = new PerpetualsInfoAPI(this.httpApi, this.symbolConversion, this.parent);
}
async getAssetIndex(assetName) {
await this.parent.ensureInitialized();
return await this.symbolConversion.getAssetIndex(assetName);
}
async getInternalName(exchangeName) {
await this.parent.ensureInitialized();
return await this.symbolConversion.convertSymbol(exchangeName);
}
async getAllAssets() {
await this.parent.ensureInitialized();
return await this.symbolConversion.getAllAssets();
}
async getAllMids(rawResponse = false) {
await this.parent.ensureInitialized();
return this.generalAPI.getAllMids(rawResponse);
}
async getUserOpenOrders(user, rawResponse = false) {
await this.parent.ensureInitialized();
return this.generalAPI.getUserOpenOrders(user, rawResponse);
}
async getFrontendOpenOrders(user, rawResponse = false) {
await this.parent.ensureInitialized();
return this.generalAPI.getFrontendOpenOrders(user, rawResponse);
}
async getUserFills(user, rawResponse = false) {
await this.parent.ensureInitialized();
return this.generalAPI.getUserFills(user, rawResponse);
}
async getUserFillsByTime(user, startTime, endTime, rawResponse = false) {
await this.parent.ensureInitialized();
return this.generalAPI.getUserFillsByTime(user, startTime, endTime, rawResponse);
}
async getUserRateLimit(user, rawResponse = false) {
await this.parent.ensureInitialized();
return this.generalAPI.getUserRateLimit(user, rawResponse);
}
async getOrderStatus(user, oid, rawResponse = false) {
await this.parent.ensureInitialized();
return this.generalAPI.getOrderStatus(user, oid, rawResponse);
}
async getL2Book(coin, rawResponse = false) {
await this.parent.ensureInitialized();
return this.generalAPI.getL2Book(coin, rawResponse);
}
async getCandleSnapshot(coin, interval, startTime, endTime, rawResponse = false) {
await this.parent.ensureInitialized();
return this.generalAPI.getCandleSnapshot(coin, interval, startTime, endTime, rawResponse);
}
async getMaxBuilderFee(user, builder, rawResponse = false) {
await this.parent.ensureInitialized();
return this.generalAPI.getMaxBuilderFee(user, builder, rawResponse);
}
async getHistoricalOrders(user, rawResponse = false) {
await this.parent.ensureInitialized();
return this.generalAPI.getHistoricalOrders(user, rawResponse);
}
async getUserTwapSliceFills(user, rawResponse = false) {
await this.parent.ensureInitialized();
return this.generalAPI.getUserTwapSliceFills(user, rawResponse);
}
async getSubAccounts(user, rawResponse = false) {
await this.parent.ensureInitialized();
return this.generalAPI.getSubAccounts(user, rawResponse);
}
async getVaultDetails(vaultAddress, user, rawResponse = false) {
await this.parent.ensureInitialized();
return this.generalAPI.getVaultDetails(vaultAddress, user, rawResponse);
}
async getUserVaultEquities(user, rawResponse = false) {
await this.parent.ensureInitialized();
return this.generalAPI.getUserVaultEquities(user, rawResponse);
}
async getUserRole(user, rawResponse = false) {
await this.parent.ensureInitialized();
return this.generalAPI.getUserRole(user, rawResponse);
}
async getUserPortfolio(user, rawResponse = false) {
await this.parent.ensureInitialized();
return this.generalAPI.getUserPortfolio(user, rawResponse);
}
async getDelegations(user, rawResponse = false) {
await this.parent.ensureInitialized();
return this.generalAPI.getDelegations(user, rawResponse);
}
async getDelegatorSummary(user, rawResponse = false) {
await this.parent.ensureInitialized();
return this.generalAPI.getDelegatorSummary(user, rawResponse);
}
async getDelegatorHistory(user, rawResponse = false) {
await this.parent.ensureInitialized();
return this.generalAPI.getDelegatorHistory(user, rawResponse);
}
async getDelegatorRewards(user, rawResponse = false) {
await this.parent.ensureInitialized();
return this.generalAPI.getDelegatorRewards(user, rawResponse);
}
}
//# sourceMappingURL=info.js.map