@xchainjs/xchain-thornode 0.1.0-alpha3 → 0.1.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.
@@ -2,7 +2,7 @@
2
2
  * Thornode API
3
3
  * Thornode REST API.
4
4
  *
5
- * The version of the OpenAPI document: 1.89.0
5
+ * The version of the OpenAPI document: 1.97.2
6
6
  * Contact: devs@thorchain.org
7
7
  *
8
8
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -2,7 +2,7 @@
2
2
  * Thornode API
3
3
  * Thornode REST API.
4
4
  *
5
- * The version of the OpenAPI document: 1.89.0
5
+ * The version of the OpenAPI document: 1.97.2
6
6
  * Contact: devs@thorchain.org
7
7
  *
8
8
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -2,7 +2,7 @@
2
2
  * Thornode API
3
3
  * Thornode REST API.
4
4
  *
5
- * The version of the OpenAPI document: 1.89.0
5
+ * The version of the OpenAPI document: 1.97.2
6
6
  * Contact: devs@thorchain.org
7
7
  *
8
8
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -2,7 +2,7 @@
2
2
  * Thornode API
3
3
  * Thornode REST API.
4
4
  *
5
- * The version of the OpenAPI document: 1.89.0
5
+ * The version of the OpenAPI document: 1.97.2
6
6
  * Contact: devs@thorchain.org
7
7
  *
8
8
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
package/lib/index.esm.js CHANGED
@@ -72,25 +72,31 @@ const assertParamExists = function (functionName, paramName, paramValue) {
72
72
  throw new RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`);
73
73
  }
74
74
  };
75
+ function setFlattenedQueryParams(urlSearchParams, parameter, key = "") {
76
+ if (typeof parameter === "object") {
77
+ if (Array.isArray(parameter)) {
78
+ parameter.forEach(item => setFlattenedQueryParams(urlSearchParams, item, key));
79
+ }
80
+ else {
81
+ Object.keys(parameter).forEach(currentKey => setFlattenedQueryParams(urlSearchParams, parameter[currentKey], `${key}${key !== '' ? '.' : ''}${currentKey}`));
82
+ }
83
+ }
84
+ else {
85
+ if (urlSearchParams.has(key)) {
86
+ urlSearchParams.append(key, parameter);
87
+ }
88
+ else {
89
+ urlSearchParams.set(key, parameter);
90
+ }
91
+ }
92
+ }
75
93
  /**
76
94
  *
77
95
  * @export
78
96
  */
79
97
  const setSearchParams = function (url, ...objects) {
80
98
  const searchParams = new URLSearchParams(url.search);
81
- for (const object of objects) {
82
- for (const key in object) {
83
- if (Array.isArray(object[key])) {
84
- searchParams.delete(key);
85
- for (const item of object[key]) {
86
- searchParams.append(key, item);
87
- }
88
- }
89
- else {
90
- searchParams.set(key, object[key]);
91
- }
92
- }
93
- }
99
+ setFlattenedQueryParams(searchParams, objects);
94
100
  url.search = searchParams.toString();
95
101
  };
96
102
  /**
@@ -126,6 +132,165 @@ const VaultTypeEnum = {
126
132
  AsgardVault: 'AsgardVault',
127
133
  YggdrasilVault: 'YggdrasilVault'
128
134
  };
135
+ /**
136
+ * BucketsApi - axios parameter creator
137
+ * @export
138
+ */
139
+ const BucketsApiAxiosParamCreator = function (configuration) {
140
+ return {
141
+ /**
142
+ * Returns the bucket information for the provided asset.
143
+ * @param {string} asset
144
+ * @param {number} [height] optional block height, defaults to current tip
145
+ * @param {*} [options] Override http request option.
146
+ * @throws {RequiredError}
147
+ */
148
+ bucket: (asset, height, options = {}) => __awaiter(this, void 0, void 0, function* () {
149
+ // verify required parameter 'asset' is not null or undefined
150
+ assertParamExists('bucket', 'asset', asset);
151
+ const localVarPath = `/thorchain/bucket/{asset}`
152
+ .replace(`{${"asset"}}`, encodeURIComponent(String(asset)));
153
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
154
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
155
+ let baseOptions;
156
+ if (configuration) {
157
+ baseOptions = configuration.baseOptions;
158
+ }
159
+ const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
160
+ const localVarHeaderParameter = {};
161
+ const localVarQueryParameter = {};
162
+ if (height !== undefined) {
163
+ localVarQueryParameter['height'] = height;
164
+ }
165
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
166
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
167
+ localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
168
+ return {
169
+ url: toPathString(localVarUrlObj),
170
+ options: localVarRequestOptions,
171
+ };
172
+ }),
173
+ /**
174
+ * Returns the bucket information for all assets.
175
+ * @param {number} [height] optional block height, defaults to current tip
176
+ * @param {*} [options] Override http request option.
177
+ * @throws {RequiredError}
178
+ */
179
+ buckets: (height, options = {}) => __awaiter(this, void 0, void 0, function* () {
180
+ const localVarPath = `/thorchain/buckets`;
181
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
182
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
183
+ let baseOptions;
184
+ if (configuration) {
185
+ baseOptions = configuration.baseOptions;
186
+ }
187
+ const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
188
+ const localVarHeaderParameter = {};
189
+ const localVarQueryParameter = {};
190
+ if (height !== undefined) {
191
+ localVarQueryParameter['height'] = height;
192
+ }
193
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
194
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
195
+ localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
196
+ return {
197
+ url: toPathString(localVarUrlObj),
198
+ options: localVarRequestOptions,
199
+ };
200
+ }),
201
+ };
202
+ };
203
+ /**
204
+ * BucketsApi - functional programming interface
205
+ * @export
206
+ */
207
+ const BucketsApiFp = function (configuration) {
208
+ const localVarAxiosParamCreator = BucketsApiAxiosParamCreator(configuration);
209
+ return {
210
+ /**
211
+ * Returns the bucket information for the provided asset.
212
+ * @param {string} asset
213
+ * @param {number} [height] optional block height, defaults to current tip
214
+ * @param {*} [options] Override http request option.
215
+ * @throws {RequiredError}
216
+ */
217
+ bucket(asset, height, options) {
218
+ return __awaiter(this, void 0, void 0, function* () {
219
+ const localVarAxiosArgs = yield localVarAxiosParamCreator.bucket(asset, height, options);
220
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
221
+ });
222
+ },
223
+ /**
224
+ * Returns the bucket information for all assets.
225
+ * @param {number} [height] optional block height, defaults to current tip
226
+ * @param {*} [options] Override http request option.
227
+ * @throws {RequiredError}
228
+ */
229
+ buckets(height, options) {
230
+ return __awaiter(this, void 0, void 0, function* () {
231
+ const localVarAxiosArgs = yield localVarAxiosParamCreator.buckets(height, options);
232
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
233
+ });
234
+ },
235
+ };
236
+ };
237
+ /**
238
+ * BucketsApi - factory interface
239
+ * @export
240
+ */
241
+ const BucketsApiFactory = function (configuration, basePath, axios) {
242
+ const localVarFp = BucketsApiFp(configuration);
243
+ return {
244
+ /**
245
+ * Returns the bucket information for the provided asset.
246
+ * @param {string} asset
247
+ * @param {number} [height] optional block height, defaults to current tip
248
+ * @param {*} [options] Override http request option.
249
+ * @throws {RequiredError}
250
+ */
251
+ bucket(asset, height, options) {
252
+ return localVarFp.bucket(asset, height, options).then((request) => request(axios, basePath));
253
+ },
254
+ /**
255
+ * Returns the bucket information for all assets.
256
+ * @param {number} [height] optional block height, defaults to current tip
257
+ * @param {*} [options] Override http request option.
258
+ * @throws {RequiredError}
259
+ */
260
+ buckets(height, options) {
261
+ return localVarFp.buckets(height, options).then((request) => request(axios, basePath));
262
+ },
263
+ };
264
+ };
265
+ /**
266
+ * BucketsApi - object-oriented interface
267
+ * @export
268
+ * @class BucketsApi
269
+ * @extends {BaseAPI}
270
+ */
271
+ class BucketsApi extends BaseAPI {
272
+ /**
273
+ * Returns the bucket information for the provided asset.
274
+ * @param {string} asset
275
+ * @param {number} [height] optional block height, defaults to current tip
276
+ * @param {*} [options] Override http request option.
277
+ * @throws {RequiredError}
278
+ * @memberof BucketsApi
279
+ */
280
+ bucket(asset, height, options) {
281
+ return BucketsApiFp(this.configuration).bucket(asset, height, options).then((request) => request(this.axios, this.basePath));
282
+ }
283
+ /**
284
+ * Returns the bucket information for all assets.
285
+ * @param {number} [height] optional block height, defaults to current tip
286
+ * @param {*} [options] Override http request option.
287
+ * @throws {RequiredError}
288
+ * @memberof BucketsApi
289
+ */
290
+ buckets(height, options) {
291
+ return BucketsApiFp(this.configuration).buckets(height, options).then((request) => request(this.axios, this.basePath));
292
+ }
293
+ }
129
294
  /**
130
295
  * HealthApi - axios parameter creator
131
296
  * @export
@@ -1407,6 +1572,99 @@ class NodesApi extends BaseAPI {
1407
1572
  return NodesApiFp(this.configuration).nodes(height, options).then((request) => request(this.axios, this.basePath));
1408
1573
  }
1409
1574
  }
1575
+ /**
1576
+ * POLApi - axios parameter creator
1577
+ * @export
1578
+ */
1579
+ const POLApiAxiosParamCreator = function (configuration) {
1580
+ return {
1581
+ /**
1582
+ * Returns protocol owned liquidity overview statistics.
1583
+ * @param {number} [height] optional block height, defaults to current tip
1584
+ * @param {*} [options] Override http request option.
1585
+ * @throws {RequiredError}
1586
+ */
1587
+ pol: (height, options = {}) => __awaiter(this, void 0, void 0, function* () {
1588
+ const localVarPath = `/thorchain/pol`;
1589
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1590
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1591
+ let baseOptions;
1592
+ if (configuration) {
1593
+ baseOptions = configuration.baseOptions;
1594
+ }
1595
+ const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
1596
+ const localVarHeaderParameter = {};
1597
+ const localVarQueryParameter = {};
1598
+ if (height !== undefined) {
1599
+ localVarQueryParameter['height'] = height;
1600
+ }
1601
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
1602
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1603
+ localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
1604
+ return {
1605
+ url: toPathString(localVarUrlObj),
1606
+ options: localVarRequestOptions,
1607
+ };
1608
+ }),
1609
+ };
1610
+ };
1611
+ /**
1612
+ * POLApi - functional programming interface
1613
+ * @export
1614
+ */
1615
+ const POLApiFp = function (configuration) {
1616
+ const localVarAxiosParamCreator = POLApiAxiosParamCreator(configuration);
1617
+ return {
1618
+ /**
1619
+ * Returns protocol owned liquidity overview statistics.
1620
+ * @param {number} [height] optional block height, defaults to current tip
1621
+ * @param {*} [options] Override http request option.
1622
+ * @throws {RequiredError}
1623
+ */
1624
+ pol(height, options) {
1625
+ return __awaiter(this, void 0, void 0, function* () {
1626
+ const localVarAxiosArgs = yield localVarAxiosParamCreator.pol(height, options);
1627
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1628
+ });
1629
+ },
1630
+ };
1631
+ };
1632
+ /**
1633
+ * POLApi - factory interface
1634
+ * @export
1635
+ */
1636
+ const POLApiFactory = function (configuration, basePath, axios) {
1637
+ const localVarFp = POLApiFp(configuration);
1638
+ return {
1639
+ /**
1640
+ * Returns protocol owned liquidity overview statistics.
1641
+ * @param {number} [height] optional block height, defaults to current tip
1642
+ * @param {*} [options] Override http request option.
1643
+ * @throws {RequiredError}
1644
+ */
1645
+ pol(height, options) {
1646
+ return localVarFp.pol(height, options).then((request) => request(axios, basePath));
1647
+ },
1648
+ };
1649
+ };
1650
+ /**
1651
+ * POLApi - object-oriented interface
1652
+ * @export
1653
+ * @class POLApi
1654
+ * @extends {BaseAPI}
1655
+ */
1656
+ class POLApi extends BaseAPI {
1657
+ /**
1658
+ * Returns protocol owned liquidity overview statistics.
1659
+ * @param {number} [height] optional block height, defaults to current tip
1660
+ * @param {*} [options] Override http request option.
1661
+ * @throws {RequiredError}
1662
+ * @memberof POLApi
1663
+ */
1664
+ pol(height, options) {
1665
+ return POLApiFp(this.configuration).pol(height, options).then((request) => request(this.axios, this.basePath));
1666
+ }
1667
+ }
1410
1668
  /**
1411
1669
  * PoolsApi - axios parameter creator
1412
1670
  * @export
@@ -2611,7 +2869,7 @@ class VaultsApi extends BaseAPI {
2611
2869
  * Thornode API
2612
2870
  * Thornode REST API.
2613
2871
  *
2614
- * The version of the OpenAPI document: 1.89.0
2872
+ * The version of the OpenAPI document: 1.97.2
2615
2873
  * Contact: devs@thorchain.org
2616
2874
  *
2617
2875
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -2646,4 +2904,4 @@ class Configuration {
2646
2904
 
2647
2905
  const THORNODE_API_9R_URL = 'https://thornode.ninerealms.com/';
2648
2906
 
2649
- export { Configuration, HealthApi, HealthApiAxiosParamCreator, HealthApiFactory, HealthApiFp, LiquidityProvidersApi, LiquidityProvidersApiAxiosParamCreator, LiquidityProvidersApiFactory, LiquidityProvidersApiFp, MimirApi, MimirApiAxiosParamCreator, MimirApiFactory, MimirApiFp, NetworkApi, NetworkApiAxiosParamCreator, NetworkApiFactory, NetworkApiFp, NodeStatusEnum, NodesApi, NodesApiAxiosParamCreator, NodesApiFactory, NodesApiFp, ObservedTxStatusEnum, PoolsApi, PoolsApiAxiosParamCreator, PoolsApiFactory, PoolsApiFp, QueueApi, QueueApiAxiosParamCreator, QueueApiFactory, QueueApiFp, THORNODE_API_9R_URL, TSSApi, TSSApiAxiosParamCreator, TSSApiFactory, TSSApiFp, ThornamesApi, ThornamesApiAxiosParamCreator, ThornamesApiFactory, ThornamesApiFp, TransactionsApi, TransactionsApiAxiosParamCreator, TransactionsApiFactory, TransactionsApiFp, VaultTypeEnum, VaultsApi, VaultsApiAxiosParamCreator, VaultsApiFactory, VaultsApiFp };
2907
+ export { BucketsApi, BucketsApiAxiosParamCreator, BucketsApiFactory, BucketsApiFp, Configuration, HealthApi, HealthApiAxiosParamCreator, HealthApiFactory, HealthApiFp, LiquidityProvidersApi, LiquidityProvidersApiAxiosParamCreator, LiquidityProvidersApiFactory, LiquidityProvidersApiFp, MimirApi, MimirApiAxiosParamCreator, MimirApiFactory, MimirApiFp, NetworkApi, NetworkApiAxiosParamCreator, NetworkApiFactory, NetworkApiFp, NodeStatusEnum, NodesApi, NodesApiAxiosParamCreator, NodesApiFactory, NodesApiFp, ObservedTxStatusEnum, POLApi, POLApiAxiosParamCreator, POLApiFactory, POLApiFp, PoolsApi, PoolsApiAxiosParamCreator, PoolsApiFactory, PoolsApiFp, QueueApi, QueueApiAxiosParamCreator, QueueApiFactory, QueueApiFp, THORNODE_API_9R_URL, TSSApi, TSSApiAxiosParamCreator, TSSApiFactory, TSSApiFp, ThornamesApi, ThornamesApiAxiosParamCreator, ThornamesApiFactory, ThornamesApiFp, TransactionsApi, TransactionsApiAxiosParamCreator, TransactionsApiFactory, TransactionsApiFp, VaultTypeEnum, VaultsApi, VaultsApiAxiosParamCreator, VaultsApiFactory, VaultsApiFp };