@gearbox-protocol/sdk 3.0.0-next.82 → 3.0.0-next.83
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/core/endpoint.d.ts +10 -0
- package/lib/core/endpoint.js +26 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const GEARBOX_RPC_CHAIN_ID = 7878;
|
|
2
|
+
type ChartsPriceSource = "chainlink" | "spot";
|
|
3
|
+
interface Options {
|
|
4
|
+
params?: Record<string, string | number>;
|
|
5
|
+
}
|
|
6
|
+
export declare class ChartsApi {
|
|
7
|
+
static getUrl: (url: string, chainId: number, options?: Options, priceSource?: ChartsPriceSource) => string;
|
|
8
|
+
private static getRelativeUrl;
|
|
9
|
+
}
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ChartsApi = exports.GEARBOX_RPC_CHAIN_ID = void 0;
|
|
4
|
+
const sdk_gov_1 = require("@gearbox-protocol/sdk-gov");
|
|
5
|
+
exports.GEARBOX_RPC_CHAIN_ID = 7878;
|
|
6
|
+
const CHARTS_BACKEND_ADDRESSES = {
|
|
7
|
+
[sdk_gov_1.CHAINS.Mainnet]: "https://mainnet.gearbox.foundation",
|
|
8
|
+
[sdk_gov_1.CHAINS.Local]: "https://mainnet.gearbox.foundation/v2",
|
|
9
|
+
[exports.GEARBOX_RPC_CHAIN_ID]: "https://testnet.gearbox.foundation",
|
|
10
|
+
};
|
|
11
|
+
class ChartsApi {
|
|
12
|
+
static getUrl = (url, chainId, options, priceSource) => [
|
|
13
|
+
CHARTS_BACKEND_ADDRESSES[chainId],
|
|
14
|
+
"api",
|
|
15
|
+
...(priceSource ? [priceSource] : []),
|
|
16
|
+
this.getRelativeUrl(url, options),
|
|
17
|
+
].join("/");
|
|
18
|
+
static getRelativeUrl = (url, options) => {
|
|
19
|
+
const { params = {} } = options || {};
|
|
20
|
+
const paramsString = Object.entries(params)
|
|
21
|
+
.map(([key, value]) => `${key}=${value}`)
|
|
22
|
+
.join("&");
|
|
23
|
+
return [url, ...(paramsString ? [paramsString] : [])].join("?");
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
exports.ChartsApi = ChartsApi;
|
package/lib/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export * from "./core/assets";
|
|
|
4
4
|
export * from "./core/creditAccount";
|
|
5
5
|
export * from "./core/creditManager";
|
|
6
6
|
export * from "./core/creditSession";
|
|
7
|
+
export * from "./core/endpoint";
|
|
7
8
|
export * from "./core/errors";
|
|
8
9
|
export * from "./core/eventOrTx";
|
|
9
10
|
export * from "./core/events";
|
package/lib/index.js
CHANGED
|
@@ -21,6 +21,7 @@ __exportStar(require("./core/assets"), exports);
|
|
|
21
21
|
__exportStar(require("./core/creditAccount"), exports);
|
|
22
22
|
__exportStar(require("./core/creditManager"), exports);
|
|
23
23
|
__exportStar(require("./core/creditSession"), exports);
|
|
24
|
+
__exportStar(require("./core/endpoint"), exports);
|
|
24
25
|
__exportStar(require("./core/errors"), exports);
|
|
25
26
|
__exportStar(require("./core/eventOrTx"), exports);
|
|
26
27
|
__exportStar(require("./core/events"), exports);
|