@xchainjs/xchain-thornode 0.1.1 → 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/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
 
@@ -1884,6 +1892,301 @@ class QueueApi extends BaseAPI {
1884
1892
  return QueueApiFp(this.configuration).queueScheduled(height, options).then((request) => request(this.axios, this.basePath));
1885
1893
  }
1886
1894
  }
1895
+ /**
1896
+ * QuoteApi - axios parameter creator
1897
+ * @export
1898
+ */
1899
+ const QuoteApiAxiosParamCreator = function (configuration) {
1900
+ return {
1901
+ /**
1902
+ * Provide a quote estimate for the provided saver deposit.
1903
+ * @param {number} [height] optional block height, defaults to current tip
1904
+ * @param {string} [asset] the asset to deposit
1905
+ * @param {number} [amount] the source asset amount in 1e8 decimals
1906
+ * @param {*} [options] Override http request option.
1907
+ * @throws {RequiredError}
1908
+ */
1909
+ quotesaverdeposit: (height, asset, amount, options = {}) => __awaiter(this, void 0, void 0, function* () {
1910
+ const localVarPath = `/thorchain/quote/saver/deposit`;
1911
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1912
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1913
+ let baseOptions;
1914
+ if (configuration) {
1915
+ baseOptions = configuration.baseOptions;
1916
+ }
1917
+ const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
1918
+ const localVarHeaderParameter = {};
1919
+ const localVarQueryParameter = {};
1920
+ if (height !== undefined) {
1921
+ localVarQueryParameter['height'] = height;
1922
+ }
1923
+ if (asset !== undefined) {
1924
+ localVarQueryParameter['asset'] = asset;
1925
+ }
1926
+ if (amount !== undefined) {
1927
+ localVarQueryParameter['amount'] = amount;
1928
+ }
1929
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
1930
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1931
+ localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
1932
+ return {
1933
+ url: toPathString(localVarUrlObj),
1934
+ options: localVarRequestOptions,
1935
+ };
1936
+ }),
1937
+ /**
1938
+ * Provide a quote estimate for the provided saver withdraw.
1939
+ * @param {number} [height] optional block height, defaults to current tip
1940
+ * @param {string} [asset] the asset to withdraw
1941
+ * @param {string} [address] the address for the position
1942
+ * @param {number} [withdrawBps] the basis points of the existing position to withdraw
1943
+ * @param {*} [options] Override http request option.
1944
+ * @throws {RequiredError}
1945
+ */
1946
+ quotesaverwithdraw: (height, asset, address, withdrawBps, options = {}) => __awaiter(this, void 0, void 0, function* () {
1947
+ const localVarPath = `/thorchain/quote/saver/withdraw`;
1948
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1949
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1950
+ let baseOptions;
1951
+ if (configuration) {
1952
+ baseOptions = configuration.baseOptions;
1953
+ }
1954
+ const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
1955
+ const localVarHeaderParameter = {};
1956
+ const localVarQueryParameter = {};
1957
+ if (height !== undefined) {
1958
+ localVarQueryParameter['height'] = height;
1959
+ }
1960
+ if (asset !== undefined) {
1961
+ localVarQueryParameter['asset'] = asset;
1962
+ }
1963
+ if (address !== undefined) {
1964
+ localVarQueryParameter['address'] = address;
1965
+ }
1966
+ if (withdrawBps !== undefined) {
1967
+ localVarQueryParameter['withdraw_bps'] = withdrawBps;
1968
+ }
1969
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
1970
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1971
+ localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
1972
+ return {
1973
+ url: toPathString(localVarUrlObj),
1974
+ options: localVarRequestOptions,
1975
+ };
1976
+ }),
1977
+ /**
1978
+ * Provide a quote estimate for the provided swap.
1979
+ * @param {number} [height] optional block height, defaults to current tip
1980
+ * @param {string} [fromAsset] the source asset
1981
+ * @param {string} [toAsset] the target asset
1982
+ * @param {number} [amount] the source asset amount in 1e8 decimals
1983
+ * @param {string} [destination] the destination address, required to generate memo
1984
+ * @param {number} [toleranceBps] the maximum basis points from the current feeless swap price to set the limit in the generated memo
1985
+ * @param {number} [affiliateBps] the affiliate fee in basis points
1986
+ * @param {string} [affiliate] the affiliate (address or thorname)
1987
+ * @param {*} [options] Override http request option.
1988
+ * @throws {RequiredError}
1989
+ */
1990
+ quoteswap: (height, fromAsset, toAsset, amount, destination, toleranceBps, affiliateBps, affiliate, options = {}) => __awaiter(this, void 0, void 0, function* () {
1991
+ const localVarPath = `/thorchain/quote/swap`;
1992
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1993
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1994
+ let baseOptions;
1995
+ if (configuration) {
1996
+ baseOptions = configuration.baseOptions;
1997
+ }
1998
+ const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
1999
+ const localVarHeaderParameter = {};
2000
+ const localVarQueryParameter = {};
2001
+ if (height !== undefined) {
2002
+ localVarQueryParameter['height'] = height;
2003
+ }
2004
+ if (fromAsset !== undefined) {
2005
+ localVarQueryParameter['from_asset'] = fromAsset;
2006
+ }
2007
+ if (toAsset !== undefined) {
2008
+ localVarQueryParameter['to_asset'] = toAsset;
2009
+ }
2010
+ if (amount !== undefined) {
2011
+ localVarQueryParameter['amount'] = amount;
2012
+ }
2013
+ if (destination !== undefined) {
2014
+ localVarQueryParameter['destination'] = destination;
2015
+ }
2016
+ if (toleranceBps !== undefined) {
2017
+ localVarQueryParameter['tolerance_bps'] = toleranceBps;
2018
+ }
2019
+ if (affiliateBps !== undefined) {
2020
+ localVarQueryParameter['affiliate_bps'] = affiliateBps;
2021
+ }
2022
+ if (affiliate !== undefined) {
2023
+ localVarQueryParameter['affiliate'] = affiliate;
2024
+ }
2025
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
2026
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
2027
+ localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
2028
+ return {
2029
+ url: toPathString(localVarUrlObj),
2030
+ options: localVarRequestOptions,
2031
+ };
2032
+ }),
2033
+ };
2034
+ };
2035
+ /**
2036
+ * QuoteApi - functional programming interface
2037
+ * @export
2038
+ */
2039
+ const QuoteApiFp = function (configuration) {
2040
+ const localVarAxiosParamCreator = QuoteApiAxiosParamCreator(configuration);
2041
+ return {
2042
+ /**
2043
+ * Provide a quote estimate for the provided saver deposit.
2044
+ * @param {number} [height] optional block height, defaults to current tip
2045
+ * @param {string} [asset] the asset to deposit
2046
+ * @param {number} [amount] the source asset amount in 1e8 decimals
2047
+ * @param {*} [options] Override http request option.
2048
+ * @throws {RequiredError}
2049
+ */
2050
+ quotesaverdeposit(height, asset, amount, options) {
2051
+ return __awaiter(this, void 0, void 0, function* () {
2052
+ const localVarAxiosArgs = yield localVarAxiosParamCreator.quotesaverdeposit(height, asset, amount, options);
2053
+ return createRequestFunction(localVarAxiosArgs, globalAxios__default['default'], BASE_PATH, configuration);
2054
+ });
2055
+ },
2056
+ /**
2057
+ * Provide a quote estimate for the provided saver withdraw.
2058
+ * @param {number} [height] optional block height, defaults to current tip
2059
+ * @param {string} [asset] the asset to withdraw
2060
+ * @param {string} [address] the address for the position
2061
+ * @param {number} [withdrawBps] the basis points of the existing position to withdraw
2062
+ * @param {*} [options] Override http request option.
2063
+ * @throws {RequiredError}
2064
+ */
2065
+ quotesaverwithdraw(height, asset, address, withdrawBps, options) {
2066
+ return __awaiter(this, void 0, void 0, function* () {
2067
+ const localVarAxiosArgs = yield localVarAxiosParamCreator.quotesaverwithdraw(height, asset, address, withdrawBps, options);
2068
+ return createRequestFunction(localVarAxiosArgs, globalAxios__default['default'], BASE_PATH, configuration);
2069
+ });
2070
+ },
2071
+ /**
2072
+ * Provide a quote estimate for the provided swap.
2073
+ * @param {number} [height] optional block height, defaults to current tip
2074
+ * @param {string} [fromAsset] the source asset
2075
+ * @param {string} [toAsset] the target asset
2076
+ * @param {number} [amount] the source asset amount in 1e8 decimals
2077
+ * @param {string} [destination] the destination address, required to generate memo
2078
+ * @param {number} [toleranceBps] the maximum basis points from the current feeless swap price to set the limit in the generated memo
2079
+ * @param {number} [affiliateBps] the affiliate fee in basis points
2080
+ * @param {string} [affiliate] the affiliate (address or thorname)
2081
+ * @param {*} [options] Override http request option.
2082
+ * @throws {RequiredError}
2083
+ */
2084
+ quoteswap(height, fromAsset, toAsset, amount, destination, toleranceBps, affiliateBps, affiliate, options) {
2085
+ return __awaiter(this, void 0, void 0, function* () {
2086
+ const localVarAxiosArgs = yield localVarAxiosParamCreator.quoteswap(height, fromAsset, toAsset, amount, destination, toleranceBps, affiliateBps, affiliate, options);
2087
+ return createRequestFunction(localVarAxiosArgs, globalAxios__default['default'], BASE_PATH, configuration);
2088
+ });
2089
+ },
2090
+ };
2091
+ };
2092
+ /**
2093
+ * QuoteApi - factory interface
2094
+ * @export
2095
+ */
2096
+ const QuoteApiFactory = function (configuration, basePath, axios) {
2097
+ const localVarFp = QuoteApiFp(configuration);
2098
+ return {
2099
+ /**
2100
+ * Provide a quote estimate for the provided saver deposit.
2101
+ * @param {number} [height] optional block height, defaults to current tip
2102
+ * @param {string} [asset] the asset to deposit
2103
+ * @param {number} [amount] the source asset amount in 1e8 decimals
2104
+ * @param {*} [options] Override http request option.
2105
+ * @throws {RequiredError}
2106
+ */
2107
+ quotesaverdeposit(height, asset, amount, options) {
2108
+ return localVarFp.quotesaverdeposit(height, asset, amount, options).then((request) => request(axios, basePath));
2109
+ },
2110
+ /**
2111
+ * Provide a quote estimate for the provided saver withdraw.
2112
+ * @param {number} [height] optional block height, defaults to current tip
2113
+ * @param {string} [asset] the asset to withdraw
2114
+ * @param {string} [address] the address for the position
2115
+ * @param {number} [withdrawBps] the basis points of the existing position to withdraw
2116
+ * @param {*} [options] Override http request option.
2117
+ * @throws {RequiredError}
2118
+ */
2119
+ quotesaverwithdraw(height, asset, address, withdrawBps, options) {
2120
+ return localVarFp.quotesaverwithdraw(height, asset, address, withdrawBps, options).then((request) => request(axios, basePath));
2121
+ },
2122
+ /**
2123
+ * Provide a quote estimate for the provided swap.
2124
+ * @param {number} [height] optional block height, defaults to current tip
2125
+ * @param {string} [fromAsset] the source asset
2126
+ * @param {string} [toAsset] the target asset
2127
+ * @param {number} [amount] the source asset amount in 1e8 decimals
2128
+ * @param {string} [destination] the destination address, required to generate memo
2129
+ * @param {number} [toleranceBps] the maximum basis points from the current feeless swap price to set the limit in the generated memo
2130
+ * @param {number} [affiliateBps] the affiliate fee in basis points
2131
+ * @param {string} [affiliate] the affiliate (address or thorname)
2132
+ * @param {*} [options] Override http request option.
2133
+ * @throws {RequiredError}
2134
+ */
2135
+ quoteswap(height, fromAsset, toAsset, amount, destination, toleranceBps, affiliateBps, affiliate, options) {
2136
+ return localVarFp.quoteswap(height, fromAsset, toAsset, amount, destination, toleranceBps, affiliateBps, affiliate, options).then((request) => request(axios, basePath));
2137
+ },
2138
+ };
2139
+ };
2140
+ /**
2141
+ * QuoteApi - object-oriented interface
2142
+ * @export
2143
+ * @class QuoteApi
2144
+ * @extends {BaseAPI}
2145
+ */
2146
+ class QuoteApi extends BaseAPI {
2147
+ /**
2148
+ * Provide a quote estimate for the provided saver deposit.
2149
+ * @param {number} [height] optional block height, defaults to current tip
2150
+ * @param {string} [asset] the asset to deposit
2151
+ * @param {number} [amount] the source asset amount in 1e8 decimals
2152
+ * @param {*} [options] Override http request option.
2153
+ * @throws {RequiredError}
2154
+ * @memberof QuoteApi
2155
+ */
2156
+ quotesaverdeposit(height, asset, amount, options) {
2157
+ return QuoteApiFp(this.configuration).quotesaverdeposit(height, asset, amount, options).then((request) => request(this.axios, this.basePath));
2158
+ }
2159
+ /**
2160
+ * Provide a quote estimate for the provided saver withdraw.
2161
+ * @param {number} [height] optional block height, defaults to current tip
2162
+ * @param {string} [asset] the asset to withdraw
2163
+ * @param {string} [address] the address for the position
2164
+ * @param {number} [withdrawBps] the basis points of the existing position to withdraw
2165
+ * @param {*} [options] Override http request option.
2166
+ * @throws {RequiredError}
2167
+ * @memberof QuoteApi
2168
+ */
2169
+ quotesaverwithdraw(height, asset, address, withdrawBps, options) {
2170
+ return QuoteApiFp(this.configuration).quotesaverwithdraw(height, asset, address, withdrawBps, options).then((request) => request(this.axios, this.basePath));
2171
+ }
2172
+ /**
2173
+ * Provide a quote estimate for the provided swap.
2174
+ * @param {number} [height] optional block height, defaults to current tip
2175
+ * @param {string} [fromAsset] the source asset
2176
+ * @param {string} [toAsset] the target asset
2177
+ * @param {number} [amount] the source asset amount in 1e8 decimals
2178
+ * @param {string} [destination] the destination address, required to generate memo
2179
+ * @param {number} [toleranceBps] the maximum basis points from the current feeless swap price to set the limit in the generated memo
2180
+ * @param {number} [affiliateBps] the affiliate fee in basis points
2181
+ * @param {string} [affiliate] the affiliate (address or thorname)
2182
+ * @param {*} [options] Override http request option.
2183
+ * @throws {RequiredError}
2184
+ * @memberof QuoteApi
2185
+ */
2186
+ quoteswap(height, fromAsset, toAsset, amount, destination, toleranceBps, affiliateBps, affiliate, options) {
2187
+ return QuoteApiFp(this.configuration).quoteswap(height, fromAsset, toAsset, amount, destination, toleranceBps, affiliateBps, affiliate, options).then((request) => request(this.axios, this.basePath));
2188
+ }
2189
+ }
1887
2190
  /**
1888
2191
  * SaversApi - axios parameter creator
1889
2192
  * @export
@@ -2891,7 +3194,7 @@ class VaultsApi extends BaseAPI {
2891
3194
  * Thornode API
2892
3195
  * Thornode REST API.
2893
3196
  *
2894
- * The version of the OpenAPI document: 1.98.0
3197
+ * The version of the OpenAPI document: 1.100.0
2895
3198
  * Contact: devs@thorchain.org
2896
3199
  *
2897
3200
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -2961,6 +3264,10 @@ exports.QueueApi = QueueApi;
2961
3264
  exports.QueueApiAxiosParamCreator = QueueApiAxiosParamCreator;
2962
3265
  exports.QueueApiFactory = QueueApiFactory;
2963
3266
  exports.QueueApiFp = QueueApiFp;
3267
+ exports.QuoteApi = QuoteApi;
3268
+ exports.QuoteApiAxiosParamCreator = QuoteApiAxiosParamCreator;
3269
+ exports.QuoteApiFactory = QuoteApiFactory;
3270
+ exports.QuoteApiFp = QuoteApiFp;
2964
3271
  exports.SaversApi = SaversApi;
2965
3272
  exports.SaversApiAxiosParamCreator = SaversApiAxiosParamCreator;
2966
3273
  exports.SaversApiFactory = SaversApiFactory;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xchainjs/xchain-thornode",
3
- "version": "0.1.1",
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.98.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": {