@shogun-sdk/money-legos
Version:
Shogun Money Legos: clients and types for quotes, memes, prices, balances, fees, validations, etc.
62 lines • 2.56 kB
JavaScript
import { InfoType } from '../../types/constants.js';
export class SpotInfoAPI {
constructor(httpApi, symbolConversion, parent) {
Object.defineProperty(this, "httpApi", {
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 = httpApi;
this.symbolConversion = symbolConversion;
this.parent = parent;
}
async getMeta(rawResponse = false) {
await this.parent.ensureInitialized();
const response = await this.httpApi.makeRequest({ type: InfoType.SPOT_META });
return rawResponse
? response
: await this.symbolConversion.convertResponse(response, ['name', 'coin', 'symbol'], 'SPOT');
}
async getSpotClearinghouseState(user, rawResponse = false) {
await this.parent.ensureInitialized();
const response = await this.httpApi.makeRequest({ type: InfoType.SPOT_CLEARINGHOUSE_STATE, user: user });
return rawResponse
? response
: await this.symbolConversion.convertResponse(response, ['name', 'coin', 'symbol'], 'SPOT');
}
async getSpotMetaAndAssetCtxs(rawResponse = false) {
await this.parent.ensureInitialized();
const response = await this.httpApi.makeRequest({ type: InfoType.SPOT_META_AND_ASSET_CTXS });
return rawResponse ? response : await this.symbolConversion.convertResponse(response);
}
async getTokenDetails(tokenId, rawResponse = false) {
await this.parent.ensureInitialized();
const response = await this.httpApi.makeRequest({
type: InfoType.TOKEN_DETAILS,
tokenId: tokenId,
}, 20);
return rawResponse ? response : await this.symbolConversion.convertResponse(response);
}
async getSpotDeployState(user, rawResponse = false) {
await this.parent.ensureInitialized();
const response = await this.httpApi.makeRequest({
type: InfoType.SPOT_DEPLOY_STATE,
user: user,
}, 20);
return rawResponse ? response : await this.symbolConversion.convertResponse(response);
}
}
//# sourceMappingURL=spot.js.map