@xchainjs/xchain-thornode 0.1.2 → 0.1.3

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
@@ -27,6 +27,23 @@ Request data from MimirApi
27
27
  const mimirResponse = await mimirApi.mimir()
28
28
  console.log(mimirResponse.data)
29
29
 
30
+ ```
31
+ ## Example - set custom header
32
+
33
+ Request data from MimirApi
34
+
35
+ ```
36
+ // THORNODE_API_9R_URL - default exported URL
37
+ // import { MimirApi, THORNODE_API_9R_URL, Configuration } from '@xchainjs/xchain-thornode'
38
+
39
+ const baseUrl = THORNODE_API_9R_URL
40
+ const headers = {"x-client-id": "my-custom-val"}
41
+ const baseOptions = { headers }
42
+ const apiconfig = new Configuration({ basePath: baseUrl , baseOptions })
43
+ const mimirApi = new MimirApi(apiconfig)
44
+ const mimirResponse = await mimirApi.mimir()
45
+ console.log(mimirResponse.data)
46
+
30
47
  ```
31
48
 
32
49
  ## Documentation
@@ -2,7 +2,7 @@
2
2
  * Thornode API
3
3
  * Thornode REST API.
4
4
  *
5
- * The version of the OpenAPI document: 1.99.0
5
+ * The version of the OpenAPI document: 1.100.0
6
6
  * Contact: devs@thorchain.org
7
7
  *
8
8
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -1234,6 +1234,56 @@ export interface QuoteSwapResponse {
1234
1234
  */
1235
1235
  'slippage_bps': number;
1236
1236
  }
1237
+ /**
1238
+ *
1239
+ * @export
1240
+ * @interface Saver
1241
+ */
1242
+ export interface Saver {
1243
+ /**
1244
+ *
1245
+ * @type {string}
1246
+ * @memberof Saver
1247
+ */
1248
+ 'asset': string;
1249
+ /**
1250
+ *
1251
+ * @type {string}
1252
+ * @memberof Saver
1253
+ */
1254
+ 'asset_address': string;
1255
+ /**
1256
+ *
1257
+ * @type {number}
1258
+ * @memberof Saver
1259
+ */
1260
+ 'last_add_height'?: number;
1261
+ /**
1262
+ *
1263
+ * @type {number}
1264
+ * @memberof Saver
1265
+ */
1266
+ 'last_withdraw_height'?: number;
1267
+ /**
1268
+ *
1269
+ * @type {string}
1270
+ * @memberof Saver
1271
+ */
1272
+ 'units': string;
1273
+ /**
1274
+ *
1275
+ * @type {string}
1276
+ * @memberof Saver
1277
+ */
1278
+ 'asset_deposit_value': string;
1279
+ }
1280
+ /**
1281
+ *
1282
+ * @export
1283
+ * @interface SaverResponse
1284
+ */
1285
+ export interface SaverResponse extends Array<LiquidityProvider> {
1286
+ }
1237
1287
  /**
1238
1288
  *
1239
1289
  * @export
@@ -2875,7 +2925,7 @@ export declare const SaversApiFp: (configuration?: Configuration | undefined) =>
2875
2925
  * @param {*} [options] Override http request option.
2876
2926
  * @throws {RequiredError}
2877
2927
  */
2878
- saver(asset: string, address: string, height?: number | undefined, options?: AxiosRequestConfig<any> | undefined): Promise<(axios?: AxiosInstance | undefined, basePath?: string | undefined) => AxiosPromise<LiquidityProviderResponse>>;
2928
+ saver(asset: string, address: string, height?: number | undefined, options?: AxiosRequestConfig<any> | undefined): Promise<(axios?: AxiosInstance | undefined, basePath?: string | undefined) => AxiosPromise<SaverResponse>>;
2879
2929
  /**
2880
2930
  * Returns all savers for the savers pool.
2881
2931
  * @param {string} asset
@@ -2883,7 +2933,7 @@ export declare const SaversApiFp: (configuration?: Configuration | undefined) =>
2883
2933
  * @param {*} [options] Override http request option.
2884
2934
  * @throws {RequiredError}
2885
2935
  */
2886
- savers(asset: string, height?: number | undefined, options?: AxiosRequestConfig<any> | undefined): Promise<(axios?: AxiosInstance | undefined, basePath?: string | undefined) => AxiosPromise<LiquidityProviderResponse>>;
2936
+ savers(asset: string, height?: number | undefined, options?: AxiosRequestConfig<any> | undefined): Promise<(axios?: AxiosInstance | undefined, basePath?: string | undefined) => AxiosPromise<SaverResponse>>;
2887
2937
  };
2888
2938
  /**
2889
2939
  * SaversApi - factory interface
@@ -2898,7 +2948,7 @@ export declare const SaversApiFactory: (configuration?: Configuration | undefine
2898
2948
  * @param {*} [options] Override http request option.
2899
2949
  * @throws {RequiredError}
2900
2950
  */
2901
- saver(asset: string, address: string, height?: number | undefined, options?: any): AxiosPromise<LiquidityProviderResponse>;
2951
+ saver(asset: string, address: string, height?: number | undefined, options?: any): AxiosPromise<SaverResponse>;
2902
2952
  /**
2903
2953
  * Returns all savers for the savers pool.
2904
2954
  * @param {string} asset
@@ -2906,7 +2956,7 @@ export declare const SaversApiFactory: (configuration?: Configuration | undefine
2906
2956
  * @param {*} [options] Override http request option.
2907
2957
  * @throws {RequiredError}
2908
2958
  */
2909
- savers(asset: string, height?: number | undefined, options?: any): AxiosPromise<LiquidityProviderResponse>;
2959
+ savers(asset: string, height?: number | undefined, options?: any): AxiosPromise<SaverResponse>;
2910
2960
  };
2911
2961
  /**
2912
2962
  * SaversApi - object-oriented interface
@@ -2924,7 +2974,7 @@ export declare class SaversApi extends BaseAPI {
2924
2974
  * @throws {RequiredError}
2925
2975
  * @memberof SaversApi
2926
2976
  */
2927
- saver(asset: string, address: string, height?: number, options?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<LiquidityProviderResponse, any>>;
2977
+ saver(asset: string, address: string, height?: number, options?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<SaverResponse, any>>;
2928
2978
  /**
2929
2979
  * Returns all savers for the savers pool.
2930
2980
  * @param {string} asset
@@ -2933,7 +2983,7 @@ export declare class SaversApi extends BaseAPI {
2933
2983
  * @throws {RequiredError}
2934
2984
  * @memberof SaversApi
2935
2985
  */
2936
- savers(asset: string, height?: number, options?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<LiquidityProviderResponse, any>>;
2986
+ savers(asset: string, height?: number, options?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<SaverResponse, any>>;
2937
2987
  }
2938
2988
  /**
2939
2989
  * TSSApi - axios parameter creator
@@ -2,14 +2,14 @@
2
2
  * Thornode API
3
3
  * Thornode REST API.
4
4
  *
5
- * The version of the OpenAPI document: 1.99.0
5
+ * The version of the OpenAPI document: 1.100.0
6
6
  * Contact: devs@thorchain.org
7
7
  *
8
8
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
9
  * https://openapi-generator.tech
10
10
  * Do not edit the class manually.
11
11
  */
12
- import { Configuration } from "./configuration";
12
+ import { Configuration } from './configuration';
13
13
  import { AxiosInstance, AxiosRequestConfig } from 'axios';
14
14
  export declare const BASE_PATH: string;
15
15
  /**
@@ -50,6 +50,6 @@ export declare class BaseAPI {
50
50
  */
51
51
  export declare class RequiredError extends Error {
52
52
  field: string;
53
- name: "RequiredError";
53
+ name: 'RequiredError';
54
54
  constructor(field: string, msg?: string);
55
55
  }
@@ -2,7 +2,7 @@
2
2
  * Thornode API
3
3
  * Thornode REST API.
4
4
  *
5
- * The version of the OpenAPI document: 1.99.0
5
+ * The version of the OpenAPI document: 1.100.0
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.99.0
5
+ * The version of the OpenAPI document: 1.100.0
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.99.0
5
+ * The version of the OpenAPI document: 1.100.0
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
@@ -26,7 +26,7 @@ function __awaiter(thisArg, _arguments, P, generator) {
26
26
  }
27
27
 
28
28
  /* tslint:disable */
29
- const BASE_PATH = "http://localhost".replace(/\/+$/, "");
29
+ const BASE_PATH = 'http://localhost'.replace(/\/+$/, '');
30
30
  /**
31
31
  *
32
32
  * @export
@@ -39,6 +39,14 @@ class BaseAPI {
39
39
  if (configuration) {
40
40
  this.configuration = configuration;
41
41
  this.basePath = configuration.basePath || this.basePath;
42
+ if (this.basePath.includes('thornode.ninerealms.com')) {
43
+ if (!this.configuration.baseOptions)
44
+ this.configuration.baseOptions = {};
45
+ if (!this.configuration.baseOptions.headers)
46
+ this.configuration.baseOptions.headers = {};
47
+ if (!this.configuration.baseOptions.headers['x-client-id'])
48
+ this.configuration.baseOptions.headers['x-client-id'] = 'xchainjs-client';
49
+ }
42
50
  }
43
51
  }
44
52
  }
@@ -52,7 +60,7 @@ class RequiredError extends Error {
52
60
  constructor(field, msg) {
53
61
  super(msg);
54
62
  this.field = field;
55
- this.name = "RequiredError";
63
+ this.name = 'RequiredError';
56
64
  }
57
65
  }
58
66
 
@@ -3178,7 +3186,7 @@ class VaultsApi extends BaseAPI {
3178
3186
  * Thornode API
3179
3187
  * Thornode REST API.
3180
3188
  *
3181
- * The version of the OpenAPI document: 1.99.0
3189
+ * The version of the OpenAPI document: 1.100.0
3182
3190
  * Contact: devs@thorchain.org
3183
3191
  *
3184
3192
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
package/lib/index.js CHANGED
@@ -34,7 +34,7 @@ function __awaiter(thisArg, _arguments, P, generator) {
34
34
  }
35
35
 
36
36
  /* tslint:disable */
37
- const BASE_PATH = "http://localhost".replace(/\/+$/, "");
37
+ const BASE_PATH = 'http://localhost'.replace(/\/+$/, '');
38
38
  /**
39
39
  *
40
40
  * @export
@@ -47,6 +47,14 @@ class BaseAPI {
47
47
  if (configuration) {
48
48
  this.configuration = configuration;
49
49
  this.basePath = configuration.basePath || this.basePath;
50
+ if (this.basePath.includes('thornode.ninerealms.com')) {
51
+ if (!this.configuration.baseOptions)
52
+ this.configuration.baseOptions = {};
53
+ if (!this.configuration.baseOptions.headers)
54
+ this.configuration.baseOptions.headers = {};
55
+ if (!this.configuration.baseOptions.headers['x-client-id'])
56
+ this.configuration.baseOptions.headers['x-client-id'] = 'xchainjs-client';
57
+ }
50
58
  }
51
59
  }
52
60
  }
@@ -60,7 +68,7 @@ class RequiredError extends Error {
60
68
  constructor(field, msg) {
61
69
  super(msg);
62
70
  this.field = field;
63
- this.name = "RequiredError";
71
+ this.name = 'RequiredError';
64
72
  }
65
73
  }
66
74
 
@@ -3186,7 +3194,7 @@ class VaultsApi extends BaseAPI {
3186
3194
  * Thornode API
3187
3195
  * Thornode REST API.
3188
3196
  *
3189
- * The version of the OpenAPI document: 1.99.0
3197
+ * The version of the OpenAPI document: 1.100.0
3190
3198
  * Contact: devs@thorchain.org
3191
3199
  *
3192
3200
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xchainjs/xchain-thornode",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "license": "MIT",
5
5
  "description": "Thornode module that exposes all thornode functions using openapi-generator-cli",
6
6
  "keywords": [
@@ -29,8 +29,8 @@
29
29
  "lint": "eslint \"{src,__tests__}/**/*.ts\" --fix --max-warnings 0",
30
30
  "prepublishOnly": "yarn run build",
31
31
  "test": "jest --passWithNoTests",
32
- "generate:types": "yarn clean:types:thornode && yarn generate:types:thornode",
33
- "generate:types:thornode": "TS_POST_PROCESS_FILE=./node_modules/.bin/prettier openapi-generator-cli generate -i https://gitlab.com/thorchain/thornode/-/raw/release-1.99.0/openapi/openapi.yaml -g typescript-axios -o ./src/generated/thornodeApi --skip-validate-spec --generate-alias-as-model",
32
+ "generate:types": "yarn clean:types:thornode && yarn generate:types:thornode && scripts/modifyBaseAPI.sh",
33
+ "generate:types:thornode": "TS_POST_PROCESS_FILE=./node_modules/.bin/prettier openapi-generator-cli generate -i https://gitlab.com/thorchain/thornode/-/raw/release-1.100.0/openapi/openapi.yaml -g typescript-axios -o ./src/generated/thornodeApi --skip-validate-spec --generate-alias-as-model",
34
34
  "clean:types:thornode": "rimraf ./src/generated/thornodeApi"
35
35
  },
36
36
  "devDependencies": {