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 | 11x 11x 11x 11x 11x 11x 4x 1x 1x | import { CreateHttpProviderConfig, createHttpProvider } from '../HttpProvider';
import { HttpProviderConfigPaths, ProviderError, ProviderFailure, UtxoProvider } from '@cardano-sdk/core';
import { apiVersion } from '../version';
import { mapHealthCheckError } from '../mapHealthCheckError';
/** The UtxoProvider endpoint paths. */
const paths: HttpProviderConfigPaths<UtxoProvider> = {
healthCheck: '/health',
utxoByAddresses: '/utxo-by-addresses'
};
/**
* Connect to a Cardano Services HttpServer instance with the service available
*
* @param config The configuration object fot the Utxo Provider.
*/
export const utxoHttpProvider = (config: CreateHttpProviderConfig<UtxoProvider>): UtxoProvider =>
createHttpProvider<UtxoProvider>({
...config,
apiVersion: config.apiVersion || apiVersion.utxo,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
mapError: (error: any, method) => {
if (method === 'healthCheck') {
return mapHealthCheckError(error);
}
throw new ProviderError(ProviderFailure.Unknown, error);
},
paths,
serviceSlug: 'utxo'
});
|