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