@reyaxyz/api-sdk 0.35.1 → 0.36.0
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/dist/clients/api-client.js +20 -1
- package/dist/clients/api-client.js.map +1 -1
- package/dist/clients/modules/lp/types.js.map +1 -1
- package/dist/clients/modules/owner/index.js +75 -0
- package/dist/clients/modules/owner/index.js.map +1 -0
- package/dist/clients/modules/owner/types.js +3 -0
- package/dist/clients/modules/owner/types.js.map +1 -0
- package/dist/types/clients/api-client.d.ts +14 -1
- package/dist/types/clients/api-client.d.ts.map +1 -1
- package/dist/types/clients/modules/lp/types.d.ts +2 -2
- package/dist/types/clients/modules/lp/types.d.ts.map +1 -1
- package/dist/types/clients/modules/owner/index.d.ts +6 -0
- package/dist/types/clients/modules/owner/index.d.ts.map +1 -0
- package/dist/types/clients/modules/owner/types.d.ts +8 -0
- package/dist/types/clients/modules/owner/types.d.ts.map +1 -0
- package/package.json +3 -3
- package/src/clients/api-client.ts +18 -1
- package/src/clients/modules/lp/types.ts +2 -1
- package/src/clients/modules/owner/index.ts +11 -0
- package/src/clients/modules/owner/types.ts +8 -0
|
@@ -22,6 +22,7 @@ var trade_simulation_1 = __importDefault(require("./modules/trade.simulation"));
|
|
|
22
22
|
var lp_1 = __importDefault(require("./modules/lp"));
|
|
23
23
|
var tokens_1 = __importDefault(require("./modules/tokens"));
|
|
24
24
|
var common_1 = require("@reyaxyz/common");
|
|
25
|
+
var owner_1 = __importDefault(require("./modules/owner"));
|
|
25
26
|
/**
|
|
26
27
|
* @description Client for API
|
|
27
28
|
*/
|
|
@@ -40,6 +41,7 @@ var ApiClient = /** @class */ (function () {
|
|
|
40
41
|
this._lp = new lp_1.default(this.apiEndpoint);
|
|
41
42
|
this._trade_simulation = new trade_simulation_1.default(this._account);
|
|
42
43
|
this._tokens = new tokens_1.default(this.apiEndpoint);
|
|
44
|
+
this._owner = new owner_1.default(this.apiEndpoint);
|
|
43
45
|
}
|
|
44
46
|
ApiClient.configure = function (config) {
|
|
45
47
|
ApiClient.config = config;
|
|
@@ -130,7 +132,7 @@ var ApiClient = /** @class */ (function () {
|
|
|
130
132
|
/**
|
|
131
133
|
* Gets the current instance of the TokensClient from the ApiClient.
|
|
132
134
|
*
|
|
133
|
-
* This static getter allows access to the
|
|
135
|
+
* This static getter allows access to the TokensClient instance managed within the ApiClient's singleton instance. It is a convenience method for retrieving the TokensClient directly, bypassing the need to manually access the internal `_tokens` property of the ApiClient instance.
|
|
134
136
|
*
|
|
135
137
|
* @returns {TokensClient} The TokensClient instance currently held by the ApiClient.
|
|
136
138
|
* @example
|
|
@@ -143,6 +145,23 @@ var ApiClient = /** @class */ (function () {
|
|
|
143
145
|
enumerable: false,
|
|
144
146
|
configurable: true
|
|
145
147
|
});
|
|
148
|
+
Object.defineProperty(ApiClient, "owner", {
|
|
149
|
+
/**
|
|
150
|
+
* Gets the current instance of the OwnerClient from the ApiClient.
|
|
151
|
+
*
|
|
152
|
+
* This static getter allows access to the OwnerClient instance managed within the ApiClient's singleton instance. It is a convenience method for retrieving the OwnerClient directly, bypassing the need to manually access the internal `_owner` property of the ApiClient instance.
|
|
153
|
+
*
|
|
154
|
+
* @returns {OwnerClient} The OwnerClient instance currently held by the ApiClient.
|
|
155
|
+
* @example
|
|
156
|
+
* // Assuming ApiClient and OwnerClient are properly set up
|
|
157
|
+
* const ownerClient = ApiClient.tokens;
|
|
158
|
+
*/
|
|
159
|
+
get: function () {
|
|
160
|
+
return ApiClient.getInstance()._owner;
|
|
161
|
+
},
|
|
162
|
+
enumerable: false,
|
|
163
|
+
configurable: true
|
|
164
|
+
});
|
|
146
165
|
ApiClient.config = {
|
|
147
166
|
environment: 'test', // default value
|
|
148
167
|
timeout: constants_1.API_TIMEOUT, // default value, e.g., 5000 milliseconds
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-client.js","sourceRoot":"/","sources":["clients/api-client.ts"],"names":[],"mappings":";;;;;;;;;;;;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,EAAE,CAAC,MAAM,CAAC;QACxC,CAAC;;;OAAA;IAlIc,gBAAM,GAAkB;QACrC,WAAW,EAAE,MAAM,EAAE,gBAAgB;QACrC,OAAO,EAAE,uBAAW,EAAE,yCAAyC;KAChE,CAAC;IAgIJ,gBAAC;CAAA,AArID,IAqIC;AArIY,8BAAS","sourcesContent":["import { API_TIMEOUT, API_URLS, ServiceConfig } from './helpers/constants';\nimport MarketsClient from './modules/markets';\nimport AccountClient from './modules/account';\nimport TradeSimulationClient from './modules/trade.simulation';\nimport LpClient from './modules/lp';\nimport TokensClient from './modules/tokens';\nimport { ReyaChainId } from '@reyaxyz/common';\nimport OwnerClient from './modules/owner';\n\n/**\n * @description Client for API\n */\nexport class ApiClient {\n private static instance: ApiClient;\n private static config: ServiceConfig = {\n environment: 'test', // default value\n timeout: API_TIMEOUT, // default value, e.g., 5000 milliseconds\n };\n private readonly apiEndpoint: string;\n private readonly _markets: MarketsClient;\n private readonly _account: AccountClient;\n private readonly _lp: LpClient;\n private readonly _trade_simulation: TradeSimulationClient;\n private readonly _tokens: TokensClient;\n private readonly _owner: OwnerClient;\n private static chain: ReyaChainId;\n\n private constructor(config: ServiceConfig) {\n this.apiEndpoint = config.environment\n ? API_URLS[config.environment]\n : API_URLS['test'];\n ApiClient.chain =\n config.environment === 'production'\n ? ReyaChainId.reyaNetwork\n : ReyaChainId.reyaCronos;\n ApiClient.config = { ...ApiClient.config, ...config };\n this._markets = new MarketsClient(this.apiEndpoint);\n this._account = new AccountClient(this.apiEndpoint);\n this._lp = new LpClient(this.apiEndpoint);\n this._trade_simulation = new TradeSimulationClient(this._account);\n this._tokens = new TokensClient(this.apiEndpoint);\n this._owner = new OwnerClient(this.apiEndpoint);\n }\n\n public static configure(config: ServiceConfig): void {\n ApiClient.config = config;\n ApiClient.instance = new ApiClient(config);\n }\n\n private static getInstance(): ApiClient {\n if (!ApiClient.instance) {\n throw new Error(\n 'ApiClient is not configured. Please configure it before using.',\n );\n }\n return ApiClient.instance;\n }\n public static get network(): ReyaChainId {\n if (!ApiClient.chain) {\n throw new Error('ApiClient is not configured');\n }\n return ApiClient.chain;\n }\n\n /**\n * Provides access to the MarketsClient instance.\n * This getter allows for interacting with market-related API functionalities.\n *\n * @returns {MarketsClient} An instance of MarketsClient for market-related operations.\n * @memberof ApiClient\n */\n public static get markets(): MarketsClient {\n return ApiClient.getInstance()._markets;\n }\n\n /**\n * Provides access to the AccountClient instance.\n * This getter allows for interacting with account-related API functionalities.\n *\n * @returns {AccountClient} An instance of AccountClient for account-related operations.\n * @memberof ApiClient\n */\n public static get account(): AccountClient {\n return ApiClient.getInstance()._account;\n }\n\n /**\n * Provides access to the TradeSimulationClient instance.\n * This getter allows for interacting with trade simulation functionalities.\n * It ensures a singleton pattern by fetching the instance from the ApiClient's\n * private `_trade_simulation` property, ensuring that trade simulation operations\n * use a consistent client configuration and state.\n *\n * @returns {TradeSimulationClient} An instance of TradeSimulationClient for trade simulation operations.\n * @memberof ApiClient\n * @example\n * // Access the trade simulation client from the ApiClient\n * const tradeSimulationClient = ApiClient.tradeSimulation;\n */\n\n public static get tradeSimulation(): TradeSimulationClient {\n return ApiClient.getInstance()._trade_simulation;\n }\n\n /**\n * Gets the current instance of the LpClient from the ApiClient.\n *\n * This static getter allows access to the LpClient instance managed within the ApiClient's singleton instance. It is a convenience method for retrieving the LpClient directly, bypassing the need to manually access the internal `_lp` property of the ApiClient instance.\n *\n * @returns {LpClient} The LpClient instance currently held by the ApiClient.\n * @example\n * // Assuming ApiClient and LpClient are properly set up\n * const lpClient = ApiClient.lp;\n */\n public static get lp(): LpClient {\n return ApiClient.getInstance()._lp;\n }\n\n /**\n * Gets the current instance of the TokensClient from the ApiClient.\n *\n * This static getter allows access to the TokensClient instance managed within the ApiClient's singleton instance. It is a convenience method for retrieving the TokensClient directly, bypassing the need to manually access the internal `_tokens` property of the ApiClient instance.\n *\n * @returns {TokensClient} The TokensClient instance currently held by the ApiClient.\n * @example\n * // Assuming ApiClient and TokensClient are properly set up\n * const tokensClient = ApiClient.tokens;\n */\n public static get tokens(): TokensClient {\n return ApiClient.getInstance()._tokens;\n }\n\n /**\n * Gets the current instance of the OwnerClient from the ApiClient.\n *\n * This static getter allows access to the OwnerClient instance managed within the ApiClient's singleton instance. It is a convenience method for retrieving the OwnerClient directly, bypassing the need to manually access the internal `_owner` property of the ApiClient instance.\n *\n * @returns {OwnerClient} The OwnerClient instance currently held by the ApiClient.\n * @example\n * // Assuming ApiClient and OwnerClient are properly set up\n * const ownerClient = ApiClient.tokens;\n */\n public static get owner(): OwnerClient {\n return ApiClient.getInstance()._owner;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"/","sources":["clients/modules/lp/types.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"/","sources":["clients/modules/lp/types.ts"],"names":[],"mappings":";;;AA8CA,IAAY,sBAOX;AAPD,WAAY,sBAAsB;IAChC,mFAAsB,CAAA;IACtB,iFAAyB,CAAA;IACzB,gFAA6B,CAAA;IAC7B,mFAAkC,CAAA;IAClC,sFAAoC,CAAA;IACpC,qFAAoC,CAAA;AACtC,CAAC,EAPW,sBAAsB,sCAAtB,sBAAsB,QAOjC","sourcesContent":["import {\n LpPoolEntity,\n LpPositionEntity,\n LpTransactionHistoryEntity,\n LpBalanceGranularity,\n LpWithdrawBalanceEntity,\n} from '@reyaxyz/common';\n\nexport type GetLpPoolsResult = LpPoolEntity[];\n\nexport type GetLpPoolResult = LpPoolEntity;\n\nexport type GetLpPoolParams = {\n id: LpPoolEntity['id'];\n};\n\nexport type GetLpPoolTransactionHistoryResult = LpTransactionHistoryEntity[];\n\nexport type GetLpPositionsParams = {\n id: LpPoolEntity['id'];\n address: string; // wallet address\n};\n\nexport type GetLpPositionsResult = LpPositionEntity[];\n\nexport type GetLpPoolWithdrawBalanceParams = {\n id: LpPoolEntity['id'];\n address: string; // wallet address\n};\n\nexport type GetLpPoolWithdrawBalanceResult = LpWithdrawBalanceEntity;\n\nexport type GetLpPoolTransactionHistoryParams = {\n id: LpPoolEntity['id'];\n address: string; // wallet address\n limit?: number;\n};\n\nexport type GetLpPoolBalanceChartDataParams = {\n poolId: LpPoolEntity['id'];\n filters: {\n timeframeMs: number;\n granularity: LpBalanceGranularity;\n };\n};\n\nexport enum PerformanceGranularity {\n ONE_MINUTE = 60 * 1000,\n ONE_HOUR = 60 * 60 * 1000,\n ONE_DAY = 24 * 60 * 60 * 1000,\n ONE_WEEK = 7 * 24 * 60 * 60 * 1000,\n ONE_MONTH = 30 * 24 * 60 * 60 * 1000,\n ONE_YEAR = 365 * 24 * 60 * 60 * 1000,\n}\n\nexport type GetLpPoolPerformanceChartDataParams = {\n poolId: LpPoolEntity['id'];\n address: string; // wallet address\n filters: {\n timeframeMs: number;\n granularity: PerformanceGranularity;\n };\n};\n"]}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
22
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
23
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
27
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
28
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
29
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
30
|
+
function step(op) {
|
|
31
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
32
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
33
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
34
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
35
|
+
switch (op[0]) {
|
|
36
|
+
case 0: case 1: t = op; break;
|
|
37
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
38
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
39
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
40
|
+
default:
|
|
41
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
42
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
43
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
44
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
45
|
+
if (t[2]) _.ops.pop();
|
|
46
|
+
_.trys.pop(); continue;
|
|
47
|
+
}
|
|
48
|
+
op = body.call(thisArg, _);
|
|
49
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
50
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
54
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
55
|
+
};
|
|
56
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
57
|
+
var rest_1 = __importDefault(require("../rest"));
|
|
58
|
+
var OwnerClient = /** @class */ (function (_super) {
|
|
59
|
+
__extends(OwnerClient, _super);
|
|
60
|
+
function OwnerClient() {
|
|
61
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
62
|
+
}
|
|
63
|
+
OwnerClient.prototype.getOwnerMetadata = function (params) {
|
|
64
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
65
|
+
var uri;
|
|
66
|
+
return __generator(this, function (_a) {
|
|
67
|
+
uri = "/api/owner/".concat(params.ownerAddress, "/metadata");
|
|
68
|
+
return [2 /*return*/, this.get(uri)];
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
};
|
|
72
|
+
return OwnerClient;
|
|
73
|
+
}(rest_1.default));
|
|
74
|
+
exports.default = OwnerClient;
|
|
75
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"/","sources":["clients/modules/owner/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,iDAAiC;AAEjC;IAAyC,+BAAU;IAAnD;;IAOA,CAAC;IANO,sCAAgB,GAAtB,UACE,MAA8B;;;;gBAExB,GAAG,GAAG,qBAAc,MAAM,CAAC,YAAY,cAAW,CAAC;gBACzD,sBAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAC;;;KACtB;IACH,kBAAC;AAAD,CAAC,AAPD,CAAyC,cAAU,GAOlD","sourcesContent":["import { GetOwnerMetadataParams, GetOwnerMetadataResult } from './types';\nimport RestClient from '../rest';\n\nexport default class OwnerClient extends RestClient {\n async getOwnerMetadata(\n params: GetOwnerMetadataParams,\n ): Promise<GetOwnerMetadataResult> {\n const uri = `/api/owner/${params.ownerAddress}/metadata`;\n return this.get(uri);\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"/","sources":["clients/modules/owner/types.ts"],"names":[],"mappings":"","sourcesContent":["export type GetOwnerMetadataParams = {\n ownerAddress: string;\n};\n\nexport type GetOwnerMetadataResult = {\n coreSigNonce: number;\n poolSigNonce: number;\n};\n"]}
|
|
@@ -5,6 +5,7 @@ import TradeSimulationClient from './modules/trade.simulation';
|
|
|
5
5
|
import LpClient from './modules/lp';
|
|
6
6
|
import TokensClient from './modules/tokens';
|
|
7
7
|
import { ReyaChainId } from '@reyaxyz/common';
|
|
8
|
+
import OwnerClient from './modules/owner';
|
|
8
9
|
/**
|
|
9
10
|
* @description Client for API
|
|
10
11
|
*/
|
|
@@ -17,6 +18,7 @@ export declare class ApiClient {
|
|
|
17
18
|
private readonly _lp;
|
|
18
19
|
private readonly _trade_simulation;
|
|
19
20
|
private readonly _tokens;
|
|
21
|
+
private readonly _owner;
|
|
20
22
|
private static chain;
|
|
21
23
|
private constructor();
|
|
22
24
|
static configure(config: ServiceConfig): void;
|
|
@@ -66,7 +68,7 @@ export declare class ApiClient {
|
|
|
66
68
|
/**
|
|
67
69
|
* Gets the current instance of the TokensClient from the ApiClient.
|
|
68
70
|
*
|
|
69
|
-
* This static getter allows access to the
|
|
71
|
+
* This static getter allows access to the TokensClient instance managed within the ApiClient's singleton instance. It is a convenience method for retrieving the TokensClient directly, bypassing the need to manually access the internal `_tokens` property of the ApiClient instance.
|
|
70
72
|
*
|
|
71
73
|
* @returns {TokensClient} The TokensClient instance currently held by the ApiClient.
|
|
72
74
|
* @example
|
|
@@ -74,5 +76,16 @@ export declare class ApiClient {
|
|
|
74
76
|
* const tokensClient = ApiClient.tokens;
|
|
75
77
|
*/
|
|
76
78
|
static get tokens(): TokensClient;
|
|
79
|
+
/**
|
|
80
|
+
* Gets the current instance of the OwnerClient from the ApiClient.
|
|
81
|
+
*
|
|
82
|
+
* This static getter allows access to the OwnerClient instance managed within the ApiClient's singleton instance. It is a convenience method for retrieving the OwnerClient directly, bypassing the need to manually access the internal `_owner` property of the ApiClient instance.
|
|
83
|
+
*
|
|
84
|
+
* @returns {OwnerClient} The OwnerClient instance currently held by the ApiClient.
|
|
85
|
+
* @example
|
|
86
|
+
* // Assuming ApiClient and OwnerClient are properly set up
|
|
87
|
+
* const ownerClient = ApiClient.tokens;
|
|
88
|
+
*/
|
|
89
|
+
static get owner(): OwnerClient;
|
|
77
90
|
}
|
|
78
91
|
//# sourceMappingURL=api-client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-client.d.ts","sourceRoot":"/","sources":["clients/api-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAC3E,OAAO,aAAa,MAAM,mBAAmB,CAAC;AAC9C,OAAO,aAAa,MAAM,mBAAmB,CAAC;AAC9C,OAAO,qBAAqB,MAAM,4BAA4B,CAAC;AAC/D,OAAO,QAAQ,MAAM,cAAc,CAAC;AACpC,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"api-client.d.ts","sourceRoot":"/","sources":["clients/api-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,aA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;;;OASG;IACH,WAAkB,KAAK,IAAI,WAAW,CAErC;CACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LpPoolEntity, LpPositionEntity, LpTransactionHistoryEntity, LpBalanceGranularity } from '@reyaxyz/common';
|
|
1
|
+
import { LpPoolEntity, LpPositionEntity, LpTransactionHistoryEntity, LpBalanceGranularity, LpWithdrawBalanceEntity } from '@reyaxyz/common';
|
|
2
2
|
export type GetLpPoolsResult = LpPoolEntity[];
|
|
3
3
|
export type GetLpPoolResult = LpPoolEntity;
|
|
4
4
|
export type GetLpPoolParams = {
|
|
@@ -14,7 +14,7 @@ export type GetLpPoolWithdrawBalanceParams = {
|
|
|
14
14
|
id: LpPoolEntity['id'];
|
|
15
15
|
address: string;
|
|
16
16
|
};
|
|
17
|
-
export type GetLpPoolWithdrawBalanceResult =
|
|
17
|
+
export type GetLpPoolWithdrawBalanceResult = LpWithdrawBalanceEntity;
|
|
18
18
|
export type GetLpPoolTransactionHistoryParams = {
|
|
19
19
|
id: LpPoolEntity['id'];
|
|
20
20
|
address: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"/","sources":["clients/modules/lp/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,0BAA0B,EAC1B,oBAAoB,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"/","sources":["clients/modules/lp/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,0BAA0B,EAC1B,oBAAoB,EACpB,uBAAuB,EACxB,MAAM,iBAAiB,CAAC;AAEzB,MAAM,MAAM,gBAAgB,GAAG,YAAY,EAAE,CAAC;AAE9C,MAAM,MAAM,eAAe,GAAG,YAAY,CAAC;AAE3C,MAAM,MAAM,eAAe,GAAG;IAC5B,EAAE,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,iCAAiC,GAAG,0BAA0B,EAAE,CAAC;AAE7E,MAAM,MAAM,oBAAoB,GAAG;IACjC,EAAE,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,gBAAgB,EAAE,CAAC;AAEtD,MAAM,MAAM,8BAA8B,GAAG;IAC3C,EAAE,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,8BAA8B,GAAG,uBAAuB,CAAC;AAErE,MAAM,MAAM,iCAAiC,GAAG;IAC9C,EAAE,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,+BAA+B,GAAG;IAC5C,MAAM,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC;IAC3B,OAAO,EAAE;QACP,WAAW,EAAE,MAAM,CAAC;QACpB,WAAW,EAAE,oBAAoB,CAAC;KACnC,CAAC;CACH,CAAC;AAEF,oBAAY,sBAAsB;IAChC,UAAU,QAAY;IACtB,QAAQ,UAAiB;IACzB,OAAO,WAAsB;IAC7B,QAAQ,YAA0B;IAClC,SAAS,aAA2B;IACpC,QAAQ,cAA4B;CACrC;AAED,MAAM,MAAM,mCAAmC,GAAG;IAChD,MAAM,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE;QACP,WAAW,EAAE,MAAM,CAAC;QACpB,WAAW,EAAE,sBAAsB,CAAC;KACrC,CAAC;CACH,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { GetOwnerMetadataParams, GetOwnerMetadataResult } from './types';
|
|
2
|
+
import RestClient from '../rest';
|
|
3
|
+
export default class OwnerClient extends RestClient {
|
|
4
|
+
getOwnerMetadata(params: GetOwnerMetadataParams): Promise<GetOwnerMetadataResult>;
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["clients/modules/owner/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AACzE,OAAO,UAAU,MAAM,SAAS,CAAC;AAEjC,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,UAAU;IAC3C,gBAAgB,CACpB,MAAM,EAAE,sBAAsB,GAC7B,OAAO,CAAC,sBAAsB,CAAC;CAInC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"/","sources":["clients/modules/owner/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,sBAAsB,GAAG;IACnC,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reyaxyz/api-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.36.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org"
|
|
@@ -33,10 +33,10 @@
|
|
|
33
33
|
"generate:coverage-badges": "npx istanbul-badges-readme --silent"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@reyaxyz/common": "0.
|
|
36
|
+
"@reyaxyz/common": "0.11.0",
|
|
37
37
|
"axios": "^1.6.2",
|
|
38
38
|
"bignumber.js": "^9.1.2"
|
|
39
39
|
},
|
|
40
40
|
"packageManager": "pnpm@8.10.4",
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "22943658ebc6568b3ee543b5fd213c40fc96574a"
|
|
42
42
|
}
|
|
@@ -5,6 +5,7 @@ import TradeSimulationClient from './modules/trade.simulation';
|
|
|
5
5
|
import LpClient from './modules/lp';
|
|
6
6
|
import TokensClient from './modules/tokens';
|
|
7
7
|
import { ReyaChainId } from '@reyaxyz/common';
|
|
8
|
+
import OwnerClient from './modules/owner';
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* @description Client for API
|
|
@@ -21,6 +22,7 @@ export class ApiClient {
|
|
|
21
22
|
private readonly _lp: LpClient;
|
|
22
23
|
private readonly _trade_simulation: TradeSimulationClient;
|
|
23
24
|
private readonly _tokens: TokensClient;
|
|
25
|
+
private readonly _owner: OwnerClient;
|
|
24
26
|
private static chain: ReyaChainId;
|
|
25
27
|
|
|
26
28
|
private constructor(config: ServiceConfig) {
|
|
@@ -37,6 +39,7 @@ export class ApiClient {
|
|
|
37
39
|
this._lp = new LpClient(this.apiEndpoint);
|
|
38
40
|
this._trade_simulation = new TradeSimulationClient(this._account);
|
|
39
41
|
this._tokens = new TokensClient(this.apiEndpoint);
|
|
42
|
+
this._owner = new OwnerClient(this.apiEndpoint);
|
|
40
43
|
}
|
|
41
44
|
|
|
42
45
|
public static configure(config: ServiceConfig): void {
|
|
@@ -116,7 +119,7 @@ export class ApiClient {
|
|
|
116
119
|
/**
|
|
117
120
|
* Gets the current instance of the TokensClient from the ApiClient.
|
|
118
121
|
*
|
|
119
|
-
* This static getter allows access to the
|
|
122
|
+
* This static getter allows access to the TokensClient instance managed within the ApiClient's singleton instance. It is a convenience method for retrieving the TokensClient directly, bypassing the need to manually access the internal `_tokens` property of the ApiClient instance.
|
|
120
123
|
*
|
|
121
124
|
* @returns {TokensClient} The TokensClient instance currently held by the ApiClient.
|
|
122
125
|
* @example
|
|
@@ -126,4 +129,18 @@ export class ApiClient {
|
|
|
126
129
|
public static get tokens(): TokensClient {
|
|
127
130
|
return ApiClient.getInstance()._tokens;
|
|
128
131
|
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Gets the current instance of the OwnerClient from the ApiClient.
|
|
135
|
+
*
|
|
136
|
+
* This static getter allows access to the OwnerClient instance managed within the ApiClient's singleton instance. It is a convenience method for retrieving the OwnerClient directly, bypassing the need to manually access the internal `_owner` property of the ApiClient instance.
|
|
137
|
+
*
|
|
138
|
+
* @returns {OwnerClient} The OwnerClient instance currently held by the ApiClient.
|
|
139
|
+
* @example
|
|
140
|
+
* // Assuming ApiClient and OwnerClient are properly set up
|
|
141
|
+
* const ownerClient = ApiClient.tokens;
|
|
142
|
+
*/
|
|
143
|
+
public static get owner(): OwnerClient {
|
|
144
|
+
return ApiClient.getInstance()._owner;
|
|
145
|
+
}
|
|
129
146
|
}
|
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
LpPositionEntity,
|
|
4
4
|
LpTransactionHistoryEntity,
|
|
5
5
|
LpBalanceGranularity,
|
|
6
|
+
LpWithdrawBalanceEntity,
|
|
6
7
|
} from '@reyaxyz/common';
|
|
7
8
|
|
|
8
9
|
export type GetLpPoolsResult = LpPoolEntity[];
|
|
@@ -27,7 +28,7 @@ export type GetLpPoolWithdrawBalanceParams = {
|
|
|
27
28
|
address: string; // wallet address
|
|
28
29
|
};
|
|
29
30
|
|
|
30
|
-
export type GetLpPoolWithdrawBalanceResult =
|
|
31
|
+
export type GetLpPoolWithdrawBalanceResult = LpWithdrawBalanceEntity;
|
|
31
32
|
|
|
32
33
|
export type GetLpPoolTransactionHistoryParams = {
|
|
33
34
|
id: LpPoolEntity['id'];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { GetOwnerMetadataParams, GetOwnerMetadataResult } from './types';
|
|
2
|
+
import RestClient from '../rest';
|
|
3
|
+
|
|
4
|
+
export default class OwnerClient extends RestClient {
|
|
5
|
+
async getOwnerMetadata(
|
|
6
|
+
params: GetOwnerMetadataParams,
|
|
7
|
+
): Promise<GetOwnerMetadataResult> {
|
|
8
|
+
const uri = `/api/owner/${params.ownerAddress}/metadata`;
|
|
9
|
+
return this.get(uri);
|
|
10
|
+
}
|
|
11
|
+
}
|