@kyve/sdk-beta
Version:
<p align="center"> <a href="https://kyve.network"> <img src="https://user-images.githubusercontent.com/62398724/137493477-63868209-a19b-4efa-9413-f06d41197d6d.png" style="border-radius: 50%" height="96"> </a> <h3 align="center"><code>@kyve/sdk</
29 lines (25 loc) • 670 B
text/typescript
import axios from "axios";
import qs from "qs";
axios.interceptors.request.use((config) => {
config.paramsSerializer = (params) => {
return qs.stringify(params, {
allowDots: true,
encode: false,
});
};
return config;
});
export class AbstractKyveLCDClient {
private restEndpoint: string;
protected request: (
url: string,
params?: Record<string, any>
) => Promise<any>;
constructor(restEndpoint: string) {
this.restEndpoint = restEndpoint;
this.request = (url: string, params?: Record<string, any>) =>
axios
.get(new URL(url, this.restEndpoint).href, { params })
.then((res) => res.data);
}
}