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 31 32 | 19x 19x 19x 19x 19x 19x 4x | import { CreateHttpProviderConfig, createHttpProvider } from '../HttpProvider';
import { HttpProviderConfigPaths, ProviderError, ProviderFailure, RewardsProvider } from '@cardano-sdk/core';
import { apiVersion } from '../version';
import { mapHealthCheckError } from '../mapHealthCheckError';
/** The RewardsProvider endpoint paths. */
const paths: HttpProviderConfigPaths<RewardsProvider> = {
healthCheck: '/health',
rewardAccountBalance: '/account-balance',
rewardsHistory: '/history'
};
/**
* Connect to a Cardano Services HttpServer instance with the service available
*
* @param config The configuration object fot the RewardsProvider Provider.
*/
export const rewardsHttpProvider = (config: CreateHttpProviderConfig<RewardsProvider>): RewardsProvider =>
createHttpProvider<RewardsProvider>({
...config,
apiVersion: config.apiVersion || apiVersion.rewards,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
mapError: (error: any, method) => {
Iif (method === 'healthCheck') {
return mapHealthCheckError(error);
}
throw new ProviderError(ProviderFailure.Unknown, error);
},
paths,
serviceSlug: 'rewards'
});
|