@reyaxyz/api-sdk 0.6.3 → 0.6.4

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/README.md CHANGED
@@ -1,12 +1,4 @@
1
- # @reya-network/api-sdk
2
-
3
- <p align="center">
4
- <a href="https://app.voltz.xyz/">
5
- <picture>
6
- <img src="./assets/voltz-background.jpeg" alt="Voltz" width="512" />
7
- </picture>
8
- </a>
9
- </p>
1
+ # @reyaxyz/api-sdk
10
2
 
11
3
  <p align="center"> API sdk for the Reya Network </p>
12
4
 
@@ -66,8 +66,8 @@ var MarketsClient = /** @class */ (function (_super) {
66
66
  * This method makes a request to the API to fetch data for markets. If a specific market is provided as a parameter,
67
67
  * it fetches data for that particular market; otherwise, it fetches data for all available markets.
68
68
  *
69
- * @param {string} [market] - The specific market ticker identifier for which data is requested. This parameter is optional.
70
- * @returns {Promise<MarketListResponse>} A promise that resolves to the response containing market data.
69
+ * @param {GetMarketsParams} [getMarketsParams] - The specific market ticker identifier for which data is requested. This parameter is optional.
70
+ * @returns {Promise<MarketEntity[]>} A promise that resolves to the response containing market data.
71
71
  * @memberof MarketsClient
72
72
  *
73
73
  * @example
@@ -78,12 +78,12 @@ var MarketsClient = /** @class */ (function (_super) {
78
78
  * // Fetch data for a specific market
79
79
  * const specificMarketData = await market.getMarkets('ETH-USDC');
80
80
  */
81
- MarketsClient.prototype.getMarkets = function (market) {
81
+ MarketsClient.prototype.getMarkets = function (getMarketsParams) {
82
82
  return __awaiter(this, void 0, void 0, function () {
83
83
  var uri;
84
84
  return __generator(this, function (_a) {
85
85
  uri = '/api/markets';
86
- return [2 /*return*/, this.get(uri, { ticker: market })];
86
+ return [2 /*return*/, this.get(uri, { id: getMarketsParams.id })];
87
87
  });
88
88
  });
89
89
  };
@@ -93,7 +93,7 @@ var MarketsClient = /** @class */ (function (_super) {
93
93
  * This method fetches historical candlestick (or OHLC - Open, High, Low, Close) data for a given market.
94
94
  * The data can be filtered by time range (fromISO and toISO) and resolution.
95
95
  *
96
- * @param {string} market - The market identifier for which candlestick data is to be retrieved.
96
+ * @param {number} marketId - The market identifier for which candlestick data is to be retrieved.
97
97
  * @param {CandlesResolution} resolution - The granularity of the candlestick data (e.g., '1MIN', '5MIN', '1HR').
98
98
  * @param {string|null} [fromISO] - The start time for the range of candlestick data in ISO 8601 format. Optional.
99
99
  * @param {string|null} [toISO] - The end time for the range of candlestick data in ISO 8601 format. Optional.
@@ -104,11 +104,11 @@ var MarketsClient = /** @class */ (function (_super) {
104
104
  * @example
105
105
  * const marketCandles = await market.getMarketCandles('BTC-USD', '1HR', '2023-01-01T00:00:00Z', '2023-01-02T00:00:00Z');
106
106
  */
107
- MarketsClient.prototype.getMarketCandles = function (market, resolution, fromISO, toISO, limit) {
107
+ MarketsClient.prototype.getMarketCandles = function (marketId, resolution, fromISO, toISO, limit) {
108
108
  return __awaiter(this, void 0, void 0, function () {
109
109
  var uri;
110
110
  return __generator(this, function (_a) {
111
- uri = "/api/markets/candles/".concat(market);
111
+ uri = "/api/markets/candles/".concat(marketId);
112
112
  return [2 /*return*/, this.get(uri, {
113
113
  resolution: resolution,
114
114
  fromISO: fromISO,
@@ -118,11 +118,11 @@ var MarketsClient = /** @class */ (function (_super) {
118
118
  });
119
119
  });
120
120
  };
121
- MarketsClient.prototype.getPerpetualMarketTrades = function (market, limit) {
121
+ MarketsClient.prototype.getPerpetualMarketTrades = function (marketId, limit) {
122
122
  return __awaiter(this, void 0, void 0, function () {
123
123
  var uri;
124
124
  return __generator(this, function (_a) {
125
- uri = "/api/trades/".concat(market);
125
+ uri = "/api/trades/".concat(marketId);
126
126
  return [2 /*return*/, this.get(uri, {
127
127
  limit: limit,
128
128
  })];
@@ -1 +1 @@
1
- {"version":3,"file":"markets.js","sourceRoot":"/","sources":["clients/modules/markets.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,gDAAgC;AAEhC;IAA2C,iCAAU;IAArD;;IAoEA,CAAC;IAnEC;;;;;;;;;;;;;;;;;OAiBG;IAEG,kCAAU,GAAhB,UAAiB,MAAe;;;;gBACxB,GAAG,GAAG,cAAc,CAAC;gBAC3B,sBAAO,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,EAAC;;;KAC1C;IAED;;;;;;;;;;;;;;;;OAgBG;IAEG,wCAAgB,GAAtB,UACE,MAAc,EACd,UAA6B,EAC7B,OAAuB,EACvB,KAAqB,EACrB,KAAqB;;;;gBAEf,GAAG,GAAG,+BAAwB,MAAM,CAAE,CAAC;gBAC7C,sBAAO,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE;wBACnB,UAAU,YAAA;wBACV,OAAO,SAAA;wBACP,KAAK,OAAA;wBACL,KAAK,OAAA;qBACN,CAAC,EAAC;;;KACJ;IAEK,gDAAwB,GAA9B,UACE,MAAc,EACd,KAAqB;;;;gBAEf,GAAG,GAAG,sBAAe,MAAM,CAAE,CAAC;gBACpC,sBAAO,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE;wBACnB,KAAK,OAAA;qBACN,CAAC,EAAC;;;KACJ;IACH,oBAAC;AAAD,CAAC,AApED,CAA2C,cAAU,GAoEpD","sourcesContent":["import {\n CandlesResolution,\n MarketCandlesResponse,\n MarketListResponse,\n TradesResponse,\n} from '../types';\nimport RestClient from './rest';\n\nexport default class MarketsClient extends RestClient {\n /**\n * Asynchronously retrieves market data from the API.\n *\n * This method makes a request to the API to fetch data for markets. If a specific market is provided as a parameter,\n * it fetches data for that particular market; otherwise, it fetches data for all available markets.\n *\n * @param {string} [market] - The specific market ticker identifier for which data is requested. This parameter is optional.\n * @returns {Promise<MarketListResponse>} A promise that resolves to the response containing market data.\n * @memberof MarketsClient\n *\n * @example\n * // Fetch data for all markets\n * const allMarketsData = await market.getMarkets();\n *\n * @example\n * // Fetch data for a specific market\n * const specificMarketData = await market.getMarkets('ETH-USDC');\n */\n\n async getMarkets(market?: string): Promise<MarketListResponse> {\n const uri = '/api/markets';\n return this.get(uri, { ticker: market });\n }\n\n /**\n * Retrieves candlestick data for a specified market.\n *\n * This method fetches historical candlestick (or OHLC - Open, High, Low, Close) data for a given market.\n * The data can be filtered by time range (fromISO and toISO) and resolution.\n *\n * @param {string} market - The market identifier for which candlestick data is to be retrieved.\n * @param {CandlesResolution} resolution - The granularity of the candlestick data (e.g., '1MIN', '5MIN', '1HR').\n * @param {string|null} [fromISO] - The start time for the range of candlestick data in ISO 8601 format. Optional.\n * @param {string|null} [toISO] - The end time for the range of candlestick data in ISO 8601 format. Optional.\n * @param {number|null} [limit] - The maximum number of candlestick data points to retrieve. Optional.\n * @returns {Promise<MarketCandlesResponse>} A promise that resolves to the market candlestick data.\n * @memberof MarketsClient\n *\n * @example\n * const marketCandles = await market.getMarketCandles('BTC-USD', '1HR', '2023-01-01T00:00:00Z', '2023-01-02T00:00:00Z');\n */\n\n async getMarketCandles(\n market: string,\n resolution: CandlesResolution,\n fromISO?: string | null,\n toISO?: string | null,\n limit?: number | null,\n ): Promise<MarketCandlesResponse> {\n const uri = `/api/markets/candles/${market}`;\n return this.get(uri, {\n resolution,\n fromISO,\n toISO,\n limit,\n });\n }\n\n async getPerpetualMarketTrades(\n market: string,\n limit?: number | null,\n ): Promise<TradesResponse> {\n const uri = `/api/trades/${market}`;\n return this.get(uri, {\n limit,\n });\n }\n}\n"]}
1
+ {"version":3,"file":"markets.js","sourceRoot":"/","sources":["clients/modules/markets.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,gDAAgC;AAEhC;IAA2C,iCAAU;IAArD;;IAsEA,CAAC;IArEC;;;;;;;;;;;;;;;;;OAiBG;IAEG,kCAAU,GAAhB,UACE,gBAAkC;;;;gBAE5B,GAAG,GAAG,cAAc,CAAC;gBAC3B,sBAAO,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,EAAE,EAAE,gBAAgB,CAAC,EAAE,EAAE,CAAC,EAAC;;;KACnD;IAED;;;;;;;;;;;;;;;;OAgBG;IAEG,wCAAgB,GAAtB,UACE,QAA4B,EAC5B,UAA6B,EAC7B,OAAuB,EACvB,KAAqB,EACrB,KAAqB;;;;gBAEf,GAAG,GAAG,+BAAwB,QAAQ,CAAE,CAAC;gBAC/C,sBAAO,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE;wBACnB,UAAU,YAAA;wBACV,OAAO,SAAA;wBACP,KAAK,OAAA;wBACL,KAAK,OAAA;qBACN,CAAC,EAAC;;;KACJ;IAEK,gDAAwB,GAA9B,UACE,QAAgB,EAChB,KAAqB;;;;gBAEf,GAAG,GAAG,sBAAe,QAAQ,CAAE,CAAC;gBACtC,sBAAO,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE;wBACnB,KAAK,OAAA;qBACN,CAAC,EAAC;;;KACJ;IACH,oBAAC;AAAD,CAAC,AAtED,CAA2C,cAAU,GAsEpD","sourcesContent":["import {\n CandlesResolution,\n GetMarketsParams,\n MarketCandlesResponse,\n MarketEntity,\n TradesResponse,\n} from '../types';\nimport RestClient from './rest';\n\nexport default class MarketsClient extends RestClient {\n /**\n * Asynchronously retrieves market data from the API.\n *\n * This method makes a request to the API to fetch data for markets. If a specific market is provided as a parameter,\n * it fetches data for that particular market; otherwise, it fetches data for all available markets.\n *\n * @param {GetMarketsParams} [getMarketsParams] - The specific market ticker identifier for which data is requested. This parameter is optional.\n * @returns {Promise<MarketEntity[]>} A promise that resolves to the response containing market data.\n * @memberof MarketsClient\n *\n * @example\n * // Fetch data for all markets\n * const allMarketsData = await market.getMarkets();\n *\n * @example\n * // Fetch data for a specific market\n * const specificMarketData = await market.getMarkets('ETH-USDC');\n */\n\n async getMarkets(\n getMarketsParams: GetMarketsParams,\n ): Promise<MarketEntity[]> {\n const uri = '/api/markets';\n return this.get(uri, { id: getMarketsParams.id });\n }\n\n /**\n * Retrieves candlestick data for a specified market.\n *\n * This method fetches historical candlestick (or OHLC - Open, High, Low, Close) data for a given market.\n * The data can be filtered by time range (fromISO and toISO) and resolution.\n *\n * @param {number} marketId - The market identifier for which candlestick data is to be retrieved.\n * @param {CandlesResolution} resolution - The granularity of the candlestick data (e.g., '1MIN', '5MIN', '1HR').\n * @param {string|null} [fromISO] - The start time for the range of candlestick data in ISO 8601 format. Optional.\n * @param {string|null} [toISO] - The end time for the range of candlestick data in ISO 8601 format. Optional.\n * @param {number|null} [limit] - The maximum number of candlestick data points to retrieve. Optional.\n * @returns {Promise<MarketCandlesResponse>} A promise that resolves to the market candlestick data.\n * @memberof MarketsClient\n *\n * @example\n * const marketCandles = await market.getMarketCandles('BTC-USD', '1HR', '2023-01-01T00:00:00Z', '2023-01-02T00:00:00Z');\n */\n\n async getMarketCandles(\n marketId: MarketEntity['id'],\n resolution: CandlesResolution,\n fromISO?: string | null,\n toISO?: string | null,\n limit?: number | null,\n ): Promise<MarketCandlesResponse> {\n const uri = `/api/markets/candles/${marketId}`;\n return this.get(uri, {\n resolution,\n fromISO,\n toISO,\n limit,\n });\n }\n\n async getPerpetualMarketTrades(\n marketId: number,\n limit?: number | null,\n ): Promise<TradesResponse> {\n const uri = `/api/trades/${marketId}`;\n return this.get(uri, {\n limit,\n });\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"/","sources":["clients/types.ts"],"names":[],"mappings":";;;AAAA,IAAY,iBAQX;AARD,WAAY,iBAAiB;IAC3B,wCAAmB,CAAA;IACnB,2CAAsB,CAAA;IACtB,+CAA0B,CAAA;IAC1B,8CAAyB,CAAA;IACzB,uCAAkB,CAAA;IAClB,0CAAqB,CAAA;IACrB,qCAAgB,CAAA;AAClB,CAAC,EARW,iBAAiB,iCAAjB,iBAAiB,QAQ5B","sourcesContent":["export enum CandlesResolution {\n ONE_MINUTE = '1MIN',\n FIVE_MINUTES = '5MINS',\n FIFTEEN_MINUTES = '15MINS',\n THIRTY_MINUTES = '30MINS',\n ONE_HOUR = '1HOUR',\n FOUR_HOURS = '4HOURS',\n ONE_DAY = '1DAY',\n}\n\n// -- Candles --\nexport interface Candle {\n startedAt: string;\n ticker: string;\n resolution: CandlesResolution;\n low: string;\n high: string;\n open: string;\n close: string;\n baseTokenVolume: string;\n usdVolume: string;\n trades: number;\n startingOpenInterest: string;\n id: string;\n}\n\nexport interface MarketCandlesResponse {\n candles: Candle[];\n}\n\n// -- Markets --\n\nexport interface MarketEntry {\n id: number;\n ticker: string;\n instrumentName: string;\n instrumentType: string;\n underlyingAsset: string;\n quoteAsset: string;\n markPrice: number;\n indexPrice: number;\n isActive: boolean;\n maxLeverage: number;\n volume24H: number;\n priceChange24H: number;\n priceChange24HPercentage: string;\n openInterest: string;\n fundingRate: string;\n priceStep: number;\n amountStep: number;\n minOrderValue: number;\n}\n\nexport interface MarketListResponse {\n [key: string]: MarketEntry;\n}\n\n// -- Account --\n\nexport interface CollateralAccount {\n id: number;\n name: string;\n equity: number;\n balance: number;\n marginRatio: string;\n collaterals: Collateral[];\n positions: Position[];\n}\n\nexport interface Collateral {\n collateralAsset: string;\n balance: number;\n availableBalance: number;\n withdrawableBalance: number;\n collateralValue: number;\n}\n\nexport type Status = 'OPEN' | 'CLOSED' | 'LIQUIDATED' | 'FILLED';\nexport type Side = 'LONG' | 'SHORT';\n\nexport interface Position {\n id: number;\n symbol: string;\n side: Side;\n size: number;\n price: number;\n orderStatus: Status;\n markPrice: number;\n unrealisedPnl: number;\n realisedPnl: number;\n liquidationPrice: number;\n fundingRate: string;\n date: string;\n}\n\nexport interface CollateralAccountListResponse {\n address: string;\n collateralAccounts: CollateralAccount[];\n}\n\nexport interface CollateralAccountResponse {\n address: string;\n id: number;\n name: string;\n equity: number;\n balance: number;\n marginRatio: string;\n collaterals: Collateral[];\n positions: Position[];\n}\n\nexport type Trade = {\n id: number;\n side: Side;\n size: string;\n price: number;\n date: string;\n};\n\nexport type TradesResponse = {\n trades: Trade[];\n};\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"/","sources":["clients/types.ts"],"names":[],"mappings":";;;AAAA,IAAY,iBAQX;AARD,WAAY,iBAAiB;IAC3B,wCAAmB,CAAA;IACnB,2CAAsB,CAAA;IACtB,+CAA0B,CAAA;IAC1B,8CAAyB,CAAA;IACzB,uCAAkB,CAAA;IAClB,0CAAqB,CAAA;IACrB,qCAAgB,CAAA;AAClB,CAAC,EARW,iBAAiB,iCAAjB,iBAAiB,QAQ5B","sourcesContent":["export enum CandlesResolution {\n ONE_MINUTE = '1MIN',\n FIVE_MINUTES = '5MINS',\n FIFTEEN_MINUTES = '15MINS',\n THIRTY_MINUTES = '30MINS',\n ONE_HOUR = '1HOUR',\n FOUR_HOURS = '4HOURS',\n ONE_DAY = '1DAY',\n}\n\n// -- Candles --\nexport interface Candle {\n startedAt: string;\n ticker: string;\n resolution: CandlesResolution;\n low: string;\n high: string;\n open: string;\n close: string;\n baseTokenVolume: string;\n usdVolume: string;\n trades: number;\n startingOpenInterest: string;\n id: string;\n}\n\nexport interface MarketCandlesResponse {\n candles: Candle[];\n}\n\n// -- Markets --\n\nexport type MarketEntity = {\n id: number;\n ticker: string;\n underlyingAsset: string;\n quoteToken: string;\n markPrice: number;\n isActive: boolean;\n maxLeverage: number;\n volume24H: number;\n priceChange24H: number;\n priceChange24HPercentage: number;\n openInterest: number;\n fundingRate: number;\n description: string;\n tickSizeDecimals: number;\n};\n\nexport type GetMarketsParams = {\n id?: number;\n};\n// -- Account --\n\nexport interface CollateralAccount {\n id: number;\n name: string;\n equity: number;\n balance: number;\n marginRatio: string;\n collaterals: Collateral[];\n positions: Position[];\n}\n\nexport interface Collateral {\n collateralAsset: string;\n balance: number;\n availableBalance: number;\n withdrawableBalance: number;\n collateralValue: number;\n}\n\nexport type Status = 'OPEN' | 'CLOSED' | 'LIQUIDATED' | 'FILLED';\nexport type Side = 'LONG' | 'SHORT';\n\nexport interface Position {\n id: number;\n symbol: string;\n side: Side;\n size: number;\n price: number;\n orderStatus: Status;\n markPrice: number;\n unrealisedPnl: number;\n realisedPnl: number;\n liquidationPrice: number;\n fundingRate: string;\n date: string;\n}\n\nexport interface CollateralAccountListResponse {\n address: string;\n collateralAccounts: CollateralAccount[];\n}\n\nexport interface CollateralAccountResponse {\n address: string;\n id: number;\n name: string;\n equity: number;\n balance: number;\n marginRatio: string;\n collaterals: Collateral[];\n positions: Position[];\n}\n\nexport type Trade = {\n id: number;\n side: Side;\n size: string;\n price: number;\n date: string;\n txId: string;\n};\n\nexport type TradesResponse = {\n trades: Trade[];\n};\n"]}
@@ -1,4 +1,4 @@
1
- import { CandlesResolution, MarketCandlesResponse, MarketListResponse, TradesResponse } from '../types';
1
+ import { CandlesResolution, GetMarketsParams, MarketCandlesResponse, MarketEntity, TradesResponse } from '../types';
2
2
  import RestClient from './rest';
3
3
  export default class MarketsClient extends RestClient {
4
4
  /**
@@ -7,8 +7,8 @@ export default class MarketsClient extends RestClient {
7
7
  * This method makes a request to the API to fetch data for markets. If a specific market is provided as a parameter,
8
8
  * it fetches data for that particular market; otherwise, it fetches data for all available markets.
9
9
  *
10
- * @param {string} [market] - The specific market ticker identifier for which data is requested. This parameter is optional.
11
- * @returns {Promise<MarketListResponse>} A promise that resolves to the response containing market data.
10
+ * @param {GetMarketsParams} [getMarketsParams] - The specific market ticker identifier for which data is requested. This parameter is optional.
11
+ * @returns {Promise<MarketEntity[]>} A promise that resolves to the response containing market data.
12
12
  * @memberof MarketsClient
13
13
  *
14
14
  * @example
@@ -19,14 +19,14 @@ export default class MarketsClient extends RestClient {
19
19
  * // Fetch data for a specific market
20
20
  * const specificMarketData = await market.getMarkets('ETH-USDC');
21
21
  */
22
- getMarkets(market?: string): Promise<MarketListResponse>;
22
+ getMarkets(getMarketsParams: GetMarketsParams): Promise<MarketEntity[]>;
23
23
  /**
24
24
  * Retrieves candlestick data for a specified market.
25
25
  *
26
26
  * This method fetches historical candlestick (or OHLC - Open, High, Low, Close) data for a given market.
27
27
  * The data can be filtered by time range (fromISO and toISO) and resolution.
28
28
  *
29
- * @param {string} market - The market identifier for which candlestick data is to be retrieved.
29
+ * @param {number} marketId - The market identifier for which candlestick data is to be retrieved.
30
30
  * @param {CandlesResolution} resolution - The granularity of the candlestick data (e.g., '1MIN', '5MIN', '1HR').
31
31
  * @param {string|null} [fromISO] - The start time for the range of candlestick data in ISO 8601 format. Optional.
32
32
  * @param {string|null} [toISO] - The end time for the range of candlestick data in ISO 8601 format. Optional.
@@ -37,7 +37,7 @@ export default class MarketsClient extends RestClient {
37
37
  * @example
38
38
  * const marketCandles = await market.getMarketCandles('BTC-USD', '1HR', '2023-01-01T00:00:00Z', '2023-01-02T00:00:00Z');
39
39
  */
40
- getMarketCandles(market: string, resolution: CandlesResolution, fromISO?: string | null, toISO?: string | null, limit?: number | null): Promise<MarketCandlesResponse>;
41
- getPerpetualMarketTrades(market: string, limit?: number | null): Promise<TradesResponse>;
40
+ getMarketCandles(marketId: MarketEntity['id'], resolution: CandlesResolution, fromISO?: string | null, toISO?: string | null, limit?: number | null): Promise<MarketCandlesResponse>;
41
+ getPerpetualMarketTrades(marketId: number, limit?: number | null): Promise<TradesResponse>;
42
42
  }
43
43
  //# sourceMappingURL=markets.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"markets.d.ts","sourceRoot":"/","sources":["clients/modules/markets.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,kBAAkB,EAClB,cAAc,EACf,MAAM,UAAU,CAAC;AAClB,OAAO,UAAU,MAAM,QAAQ,CAAC;AAEhC,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,UAAU;IACnD;;;;;;;;;;;;;;;;;OAiBG;IAEG,UAAU,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAK9D;;;;;;;;;;;;;;;;OAgBG;IAEG,gBAAgB,CACpB,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,iBAAiB,EAC7B,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,EACvB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,EACrB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,GACpB,OAAO,CAAC,qBAAqB,CAAC;IAU3B,wBAAwB,CAC5B,MAAM,EAAE,MAAM,EACd,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,GACpB,OAAO,CAAC,cAAc,CAAC;CAM3B"}
1
+ {"version":3,"file":"markets.d.ts","sourceRoot":"/","sources":["clients/modules/markets.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,qBAAqB,EACrB,YAAY,EACZ,cAAc,EACf,MAAM,UAAU,CAAC;AAClB,OAAO,UAAU,MAAM,QAAQ,CAAC;AAEhC,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,UAAU;IACnD;;;;;;;;;;;;;;;;;OAiBG;IAEG,UAAU,CACd,gBAAgB,EAAE,gBAAgB,GACjC,OAAO,CAAC,YAAY,EAAE,CAAC;IAK1B;;;;;;;;;;;;;;;;OAgBG;IAEG,gBAAgB,CACpB,QAAQ,EAAE,YAAY,CAAC,IAAI,CAAC,EAC5B,UAAU,EAAE,iBAAiB,EAC7B,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,EACvB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,EACrB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,GACpB,OAAO,CAAC,qBAAqB,CAAC;IAU3B,wBAAwB,CAC5B,QAAQ,EAAE,MAAM,EAChB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,GACpB,OAAO,CAAC,cAAc,CAAC;CAM3B"}
@@ -24,29 +24,25 @@ export interface Candle {
24
24
  export interface MarketCandlesResponse {
25
25
  candles: Candle[];
26
26
  }
27
- export interface MarketEntry {
27
+ export type MarketEntity = {
28
28
  id: number;
29
29
  ticker: string;
30
- instrumentName: string;
31
- instrumentType: string;
32
30
  underlyingAsset: string;
33
- quoteAsset: string;
31
+ quoteToken: string;
34
32
  markPrice: number;
35
- indexPrice: number;
36
33
  isActive: boolean;
37
34
  maxLeverage: number;
38
35
  volume24H: number;
39
36
  priceChange24H: number;
40
- priceChange24HPercentage: string;
41
- openInterest: string;
42
- fundingRate: string;
43
- priceStep: number;
44
- amountStep: number;
45
- minOrderValue: number;
46
- }
47
- export interface MarketListResponse {
48
- [key: string]: MarketEntry;
49
- }
37
+ priceChange24HPercentage: number;
38
+ openInterest: number;
39
+ fundingRate: number;
40
+ description: string;
41
+ tickSizeDecimals: number;
42
+ };
43
+ export type GetMarketsParams = {
44
+ id?: number;
45
+ };
50
46
  export interface CollateralAccount {
51
47
  id: number;
52
48
  name: string;
@@ -99,6 +95,7 @@ export type Trade = {
99
95
  size: string;
100
96
  price: number;
101
97
  date: string;
98
+ txId: string;
102
99
  };
103
100
  export type TradesResponse = {
104
101
  trades: Trade[];
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"/","sources":["clients/types.ts"],"names":[],"mappings":"AAAA,oBAAY,iBAAiB;IAC3B,UAAU,SAAS;IACnB,YAAY,UAAU;IACtB,eAAe,WAAW;IAC1B,cAAc,WAAW;IACzB,QAAQ,UAAU;IAClB,UAAU,WAAW;IACrB,OAAO,SAAS;CACjB;AAGD,MAAM,WAAW,MAAM;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,iBAAiB,CAAC;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,eAAe,EAAE,MAAM,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,oBAAoB,EAAE,MAAM,CAAC;IAC7B,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,MAAM,WAAW,qBAAqB;IACpC,O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AAM,CAAC;IACX,IAAI,EAAE,IAAI,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,MAAM,EAAE,KAAK,EAAE,CAAC;CACjB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reyaxyz/api-sdk",
3
- "version": "0.6.3",
3
+ "version": "0.6.4",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -36,5 +36,5 @@
36
36
  "axios": "^1.6.2"
37
37
  },
38
38
  "packageManager": "pnpm@8.10.4",
39
- "gitHead": "12b257e116bed35f8bb69fcd44e5619715228906"
39
+ "gitHead": "dba265659591bc135dc84f4c799fb8e9d19af3b4"
40
40
  }
@@ -1,7 +1,8 @@
1
1
  import {
2
2
  CandlesResolution,
3
+ GetMarketsParams,
3
4
  MarketCandlesResponse,
4
- MarketListResponse,
5
+ MarketEntity,
5
6
  TradesResponse,
6
7
  } from '../types';
7
8
  import RestClient from './rest';
@@ -13,8 +14,8 @@ export default class MarketsClient extends RestClient {
13
14
  * This method makes a request to the API to fetch data for markets. If a specific market is provided as a parameter,
14
15
  * it fetches data for that particular market; otherwise, it fetches data for all available markets.
15
16
  *
16
- * @param {string} [market] - The specific market ticker identifier for which data is requested. This parameter is optional.
17
- * @returns {Promise<MarketListResponse>} A promise that resolves to the response containing market data.
17
+ * @param {GetMarketsParams} [getMarketsParams] - The specific market ticker identifier for which data is requested. This parameter is optional.
18
+ * @returns {Promise<MarketEntity[]>} A promise that resolves to the response containing market data.
18
19
  * @memberof MarketsClient
19
20
  *
20
21
  * @example
@@ -26,9 +27,11 @@ export default class MarketsClient extends RestClient {
26
27
  * const specificMarketData = await market.getMarkets('ETH-USDC');
27
28
  */
28
29
 
29
- async getMarkets(market?: string): Promise<MarketListResponse> {
30
+ async getMarkets(
31
+ getMarketsParams: GetMarketsParams,
32
+ ): Promise<MarketEntity[]> {
30
33
  const uri = '/api/markets';
31
- return this.get(uri, { ticker: market });
34
+ return this.get(uri, { id: getMarketsParams.id });
32
35
  }
33
36
 
34
37
  /**
@@ -37,7 +40,7 @@ export default class MarketsClient extends RestClient {
37
40
  * This method fetches historical candlestick (or OHLC - Open, High, Low, Close) data for a given market.
38
41
  * The data can be filtered by time range (fromISO and toISO) and resolution.
39
42
  *
40
- * @param {string} market - The market identifier for which candlestick data is to be retrieved.
43
+ * @param {number} marketId - The market identifier for which candlestick data is to be retrieved.
41
44
  * @param {CandlesResolution} resolution - The granularity of the candlestick data (e.g., '1MIN', '5MIN', '1HR').
42
45
  * @param {string|null} [fromISO] - The start time for the range of candlestick data in ISO 8601 format. Optional.
43
46
  * @param {string|null} [toISO] - The end time for the range of candlestick data in ISO 8601 format. Optional.
@@ -50,13 +53,13 @@ export default class MarketsClient extends RestClient {
50
53
  */
51
54
 
52
55
  async getMarketCandles(
53
- market: string,
56
+ marketId: MarketEntity['id'],
54
57
  resolution: CandlesResolution,
55
58
  fromISO?: string | null,
56
59
  toISO?: string | null,
57
60
  limit?: number | null,
58
61
  ): Promise<MarketCandlesResponse> {
59
- const uri = `/api/markets/candles/${market}`;
62
+ const uri = `/api/markets/candles/${marketId}`;
60
63
  return this.get(uri, {
61
64
  resolution,
62
65
  fromISO,
@@ -66,10 +69,10 @@ export default class MarketsClient extends RestClient {
66
69
  }
67
70
 
68
71
  async getPerpetualMarketTrades(
69
- market: string,
72
+ marketId: number,
70
73
  limit?: number | null,
71
74
  ): Promise<TradesResponse> {
72
- const uri = `/api/trades/${market}`;
75
+ const uri = `/api/trades/${marketId}`;
73
76
  return this.get(uri, {
74
77
  limit,
75
78
  });
@@ -30,31 +30,26 @@ export interface MarketCandlesResponse {
30
30
 
31
31
  // -- Markets --
32
32
 
33
- export interface MarketEntry {
33
+ export type MarketEntity = {
34
34
  id: number;
35
35
  ticker: string;
36
- instrumentName: string;
37
- instrumentType: string;
38
36
  underlyingAsset: string;
39
- quoteAsset: string;
37
+ quoteToken: string;
40
38
  markPrice: number;
41
- indexPrice: number;
42
39
  isActive: boolean;
43
40
  maxLeverage: number;
44
41
  volume24H: number;
45
42
  priceChange24H: number;
46
- priceChange24HPercentage: string;
47
- openInterest: string;
48
- fundingRate: string;
49
- priceStep: number;
50
- amountStep: number;
51
- minOrderValue: number;
52
- }
53
-
54
- export interface MarketListResponse {
55
- [key: string]: MarketEntry;
56
- }
43
+ priceChange24HPercentage: number;
44
+ openInterest: number;
45
+ fundingRate: number;
46
+ description: string;
47
+ tickSizeDecimals: number;
48
+ };
57
49
 
50
+ export type GetMarketsParams = {
51
+ id?: number;
52
+ };
58
53
  // -- Account --
59
54
 
60
55
  export interface CollateralAccount {
@@ -115,6 +110,7 @@ export type Trade = {
115
110
  size: string;
116
111
  price: number;
117
112
  date: string;
113
+ txId: string;
118
114
  };
119
115
 
120
116
  export type TradesResponse = {