Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | 42x 42x 42x 1x 7x 7x 3x 5x | import { CustomError } from 'ts-custom-error'; import { SmashDelistedResponse } from './types'; import { SmashStakePoolDelistedService } from '../types'; import { SmashStakePoolDelistedServiceError } from './errors'; import axios, { AxiosInstance } from 'axios'; export const createSmashStakePoolDelistedService = ( smashUrl: string, axiosClient: AxiosInstance = axios.create({ maxContentLength: 5000, timeout: 2 * 1000 }) ): SmashStakePoolDelistedService => ({ async getDelistedStakePoolIds(): Promise<Array<string> | CustomError> { const smashDelistedUrl = `${smashUrl}/delisted`; return axiosClient .get<Array<SmashDelistedResponse>>(smashDelistedUrl) .then((response) => response.data.map((d) => d.poolId)) .catch( (error) => new SmashStakePoolDelistedServiceError( error, `SmashStakePoolDelistedService failed to fetch delisted pool ids from ${smashDelistedUrl} due to ${ error ? error.message : 'unknown error' }` ) ); } }); |