@@ -19,7 +19,6 @@ import {
19
19
ToolsResponse ,
20
20
} from '@lifinance/types'
21
21
import { GetStatusRequest } from '@lifinance/types/dist/api'
22
- import axios from 'axios'
23
22
import { Signer } from 'ethers'
24
23
import {
25
24
approveToken ,
@@ -35,7 +34,7 @@ import { StepExecutor } from './execution/StepExecutor'
35
34
import ApiService from './services/ApiService'
36
35
import ChainsService from './services/ChainsService'
37
36
import ConfigService from './services/ConfigService'
38
- import { isRoutesRequest , isToken } from './typeguards'
37
+ import { isToken } from './typeguards'
39
38
import {
40
39
ActiveRouteDictionary ,
41
40
Config ,
@@ -45,7 +44,6 @@ import {
45
44
RevokeTokenData ,
46
45
} from './types'
47
46
import { ValidationError } from './utils/errors'
48
- import { parseBackendError } from './utils/parseError'
49
47
import { deepClone } from './utils/utils'
50
48
51
49
export default class LIFI {
@@ -168,29 +166,8 @@ export default class LIFI {
168
166
* @return {Promise<RoutesResponse> } The resulting routes that can be used to realize the described transfer of tokens.
169
167
* @throws {LifiError } Throws a LifiError if request fails.
170
168
*/
171
- getRoutes = async ( routesRequest : RoutesRequest ) : Promise < RoutesResponse > => {
172
- if ( ! isRoutesRequest ( routesRequest ) ) {
173
- throw new ValidationError ( 'Invalid routes request.' )
174
- }
175
-
176
- const config = this . configService . getConfig ( )
177
-
178
- // apply defaults
179
- routesRequest . options = {
180
- ...config . defaultRouteOptions ,
181
- ...routesRequest . options ,
182
- }
183
-
184
- // send request
185
- try {
186
- const result = await axios . post < RoutesResponse > (
187
- config . apiUrl + 'advanced/routes' ,
188
- routesRequest
189
- )
190
- return result . data
191
- } catch ( e ) {
192
- throw parseBackendError ( e )
193
- }
169
+ getRoutes = async ( request : RoutesRequest ) : Promise < RoutesResponse > => {
170
+ return ApiService . getRoutes ( request )
194
171
}
195
172
196
173
/**
0 commit comments