fix
This commit is contained in:
parent
2bd8c86061
commit
5817809fa6
|
@ -73,9 +73,20 @@ const fetchMangoRoutes = async (
|
||||||
const response = await fetch(`${MANGO_ROUTER_API_URL}/swap?${paramsString}`)
|
const response = await fetch(`${MANGO_ROUTER_API_URL}/swap?${paramsString}`)
|
||||||
|
|
||||||
const res = await response.json()
|
const res = await response.json()
|
||||||
const data = res
|
const data: RouteInfo[] = res.map((route: any) => ({
|
||||||
|
...route,
|
||||||
|
priceImpactPct: route.priceImpact,
|
||||||
|
slippageBps: slippage,
|
||||||
|
marketInfos: route.marketInfos.map((mInfo: any) => ({
|
||||||
|
...mInfo,
|
||||||
|
lpFee: {
|
||||||
|
...mInfo.fee,
|
||||||
|
pct: mInfo.fee.rate,
|
||||||
|
},
|
||||||
|
})),
|
||||||
|
}))
|
||||||
return {
|
return {
|
||||||
routes: res as RouteInfo[],
|
routes: data,
|
||||||
bestRoute: (data.length ? data[0] : null) as RouteInfo | null,
|
bestRoute: (data.length ? data[0] : null) as RouteInfo | null,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
import { AccountMeta } from '@solana/web3.js'
|
|
||||||
import { AccountInfo } from '@solana/web3.js'
|
import { AccountInfo } from '@solana/web3.js'
|
||||||
import Decimal from 'decimal.js'
|
import Decimal from 'decimal.js'
|
||||||
|
|
||||||
export declare type SideType = typeof Side.Ask | typeof Side.Bid
|
export declare type SideType = typeof Side.Ask | typeof Side.Bid
|
||||||
export declare const Side: {
|
export declare const Side: {
|
||||||
Bid: {
|
Bid: {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||||
bid: {}
|
bid: {}
|
||||||
}
|
}
|
||||||
Ask: {
|
Ask: {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||||
ask: {}
|
ask: {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -57,7 +58,7 @@ export interface ExactOutSwapParams extends SwapParams {
|
||||||
}
|
}
|
||||||
export declare type AccountInfoMap = Map<string, AccountInfo<Buffer> | null>
|
export declare type AccountInfoMap = Map<string, AccountInfo<Buffer> | null>
|
||||||
|
|
||||||
declare type AmmLabel =
|
export declare type AmmLabel =
|
||||||
| 'Aldrin'
|
| 'Aldrin'
|
||||||
| 'Crema'
|
| 'Crema'
|
||||||
| 'Cropper'
|
| 'Cropper'
|
||||||
|
|
Loading…
Reference in New Issue