UNPKG

@stratosphere-network/wallet

Version:

Wallet module for StratoSphere SDK

75 lines 2.12 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.AssetsService = void 0; const base_service_1 = require("../base-service"); class AssetsService extends base_service_1.BaseService { /** * Get supported chains * @param active - If true, returns only chains where the user has active balances (requires authentication) */ async getSupportedChains(active) { if (active) { // This requires authentication return this.authenticatedRequest({ method: "GET", url: "/assets/supported-chains", params: { active: "true" }, }); } else { // Public endpoint return this.publicRequest({ method: "GET", url: "/assets/supported-chains", }); } } /** * Get all available tokens */ async getAllTokens() { return this.publicRequest({ method: "GET", url: "/assets/tokens", }); } /** * Get tokens owned by the authenticated user */ async getUserTokens() { return this.authenticatedRequest({ method: "GET", url: "/assets/tokens/user", }); } /** * Get tokens for a specific chain by chain ID */ async getTokensByChainId(chainId) { return this.publicRequest({ method: "GET", url: `/assets/tokens/chain/${chainId}`, }); } /** * Get a single token by token ID * @param tokenId - Token ID in format: CHAINNAME-SYMBOL (e.g., "ETHEREUM-USDC") */ async getTokenById(tokenId) { return this.publicRequest({ method: "GET", url: `/assets/tokens/${tokenId}`, }); } /** * Get a single chain by chain ID */ async getChainById(chainId) { return this.publicRequest({ method: "GET", url: `/assets/chains/${chainId}`, }); } } exports.AssetsService = AssetsService; //# sourceMappingURL=assets.js.map