Skip to content
Merged

v2.11.0 #1593

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
142 commits
Select commit Hold shift + click to select a range
a75520e
feature: enhance order creation with dynamic comparison type and intr…
StefChatz Apr 2, 2025
c01841a
fix: failing build
StefChatz Apr 2, 2025
53151b2
feat: update types to include InterestRateModel and enhance order par…
StefChatz Apr 3, 2025
1b4d2a3
feat: add support for child orders with parent order ID in limit orde…
StefChatz Apr 3, 2025
e796ba4
feat: enhance ReduceOnlySwitch component with improved layout and add…
StefChatz Apr 3, 2025
05f6514
feat: update stablecoin references in Pion1 chain configuration
StefChatz Apr 9, 2025
e79a7a0
feat: refactor PerpsSlTpModal to accept parentPosition as a prop and …
StefChatz Apr 9, 2025
2cc87af
feat: rename isReduceOnly to reduceOnly in PerpsSummary component for…
StefChatz Apr 9, 2025
0a4ed66
feat: enhance PerpsSlTpModal to support canceling existing SL/TP orde…
StefChatz Apr 9, 2025
a7a3922
feat: add conditional triggers modal and integrate with ReduceOnlySwi…
StefChatz Apr 9, 2025
10d568c
feat: add executeParentOrderWithConditionalTriggers method and integr…
StefChatz Apr 16, 2025
4937cde
feat: add PerpsTriggerOrdersModal and integrate with existing modals;…
StefChatz Apr 17, 2025
37927eb
refactor: cleanup
StefChatz Apr 17, 2025
edae1b1
feat: simplify amount handling in AssetAmountInput and NumberInput co…
StefChatz Apr 17, 2025
d7ddf65
feat: update PerpsOrderOptions to use Text component for conditional …
StefChatz Apr 17, 2025
1b64a0c
feat: enhance PerpsSlTpModal and NumberInput components; improve orde…
StefChatz Apr 17, 2025
c0cdeaa
feat: add assetSwitch prop to AssetAmountInput; integrate SwitchWithT…
StefChatz Apr 17, 2025
e39cc47
feat: adjust maxDecimals for USD input in AssetAmountInput; refine am…
StefChatz Apr 17, 2025
5ca9370
feat: refactor components to use nullish coalescing operator; improve…
StefChatz Apr 17, 2025
264d2e2
feat: refactor TradeChart component to use nullish coalescing operato…
StefChatz Apr 17, 2025
f0532a0
fix: failing build
StefChatz Apr 17, 2025
ef9f3da
fix: update conditional checks in TradeChart for correct logic and im…
StefChatz Apr 17, 2025
a4caef1
fix: fix failing import
StefChatz Apr 17, 2025
667c233
refactor: adjusted look and feel of the USD input
linkielink Apr 18, 2025
e03f45a
refactor: adjusted the display of USD values
linkielink Apr 18, 2025
faa137c
refactor: adjust conditional trigger look
linkielink Apr 18, 2025
034e774
fix: fixed the formater
linkielink Apr 18, 2025
6dee6da
refactor: correctly handle short sl./tp orders in PerpsSlTpModal and …
StefChatz Apr 18, 2025
d8e28e9
refactor: update colors in PerpsTriggerOrdersModal
StefChatz Apr 18, 2025
e705b4a
refactor: swap stop loss and take profit labels and functionality in …
StefChatz Apr 18, 2025
1dee7de
refactor: add perpsTradeDirection state and update SL/TP modal text f…
StefChatz Apr 18, 2025
d172d2a
refactor: refactor usePerpsCallbakcs to remove duplicate code, also a…
StefChatz Apr 21, 2025
592276d
fix: type crashing deployment
StefChatz Apr 21, 2025
a274f54
fix: deductFee function
linkielink Apr 22, 2025
cb57bca
fix: update keeperFee logic
linkielink Apr 22, 2025
1142113
fix: ensure keeperFee is calculated and passed correctly in order sub…
StefChatz Apr 22, 2025
fd1ffcf
fix: order matching logic by simplifying trigger condition checks
StefChatz Apr 22, 2025
d221cdf
fix: align text in PerpsSlTpModal for improved readability
StefChatz Apr 22, 2025
b78947d
fix: remove redundant price validation logic in PerpsConditionalTrigg…
StefChatz Apr 22, 2025
1c408e7
fix: update PerpsSlTpModal to accept parentPosition from modal state
StefChatz Apr 22, 2025
2a82f91
fix: update text color in PerpsOrderOptions for consistency
StefChatz Apr 22, 2025
e8c7b3c
fix: refactor price validation logic to consolidate stop loss and tak…
StefChatz Apr 22, 2025
54d53b7
fix: implement useChildOrders hook to check for existing SL/TP orders…
StefChatz Apr 22, 2025
40df447
fix: remove background color from PerpsTriggerOrdersModal for improve…
StefChatz Apr 22, 2025
a22dd64
fix: normalize trigger prices in Perps modals and update AssetAmountI…
StefChatz Apr 23, 2025
df707ac
fix: simplify asset amount input handling in PerpsSlTpModal
StefChatz Apr 24, 2025
61f013d
feat: add PercentageButtons and PerpsPriceHeader components to PerpsC…
StefChatz Apr 24, 2025
1c5afdc
refactor: remove unused assetPrice prop and related calculations in P…
StefChatz Apr 24, 2025
73c7cb8
feat: implement TriggerSection component with asset amount input and …
StefChatz Apr 25, 2025
9f6d858
feat: implement swap/repay feature with swap route
StefChatz May 7, 2025
86bcfcb
feat: enhance repayment functionality with improved asset selection a…
StefChatz May 12, 2025
11f1b0e
feat: first step
linkielink Jun 27, 2025
b66c0ce
env: updated types
linkielink Jun 27, 2025
f0e7c35
feat: make the skipRouter chain agnostic
linkielink Jun 27, 2025
962425e
feat: finished skip router implementation
linkielink Jun 28, 2025
6f53b1e
env: update entrypoint.sh
linkielink Jun 28, 2025
23c20b3
env: simplify docker
linkielink Jun 28, 2025
d8f43c8
feat: added allow unsafe flag
linkielink Jun 30, 2025
9f585a3
feat: added priceImpact fallback based on usdAmountIn and usdAmountOut
linkielink Jun 30, 2025
ae3a160
fix: api routing
linkielink Jul 2, 2025
42b631c
fix: reduce the cache control of the vault og images
linkielink Jul 2, 2025
80e8b45
fix: refactor and replace the useAlertDialog hook
linkielink Jul 3, 2025
4afc69a
env: bump version
linkielink Jul 3, 2025
4e28d96
Merge branch 'develop' of https://github.com/mars-protocol/mars-v2-fr…
linkielink Jul 8, 2025
22b6689
Merge branch 'develop' of https://github.com/mars-protocol/mars-v2-fr…
linkielink Jul 8, 2025
79e1dc1
Merge pull request #1554 from mars-protocol/duality-swapper
linkielink Jul 8, 2025
43d4072
fix: build fixes
linkielink Jul 8, 2025
0711844
Merge branch 'develop' of https://github.com/mars-protocol/mars-v2-fr…
linkielink Jul 8, 2025
c6164e2
fix: applied decimalFix
linkielink Jul 8, 2025
f5277fe
Merge branch 'develop' into advanced-limit-orders-with-reference
linkielink Jul 8, 2025
ad1834f
fix: numberInput
linkielink Jul 8, 2025
d9c5cc6
Merge pull request #1431 from mars-protocol/advanced-limit-orders-wit…
linkielink Jul 8, 2025
26cc9ee
Merge branch 'develop' of https://github.com/mars-protocol/mars-v2-fr…
linkielink Jul 8, 2025
1786c73
fix: added type
linkielink Jul 8, 2025
19bda69
fix: typing
linkielink Jul 8, 2025
018611c
fix: new route logic
linkielink Jul 8, 2025
9b5a861
fix: broadcast
linkielink Jul 8, 2025
6ad44a9
Merge pull request #1565 from mars-protocol/swap-to-repay
linkielink Jul 8, 2025
eaf6c2f
env: update dependencies
linkielink Jul 8, 2025
716cc15
Merge branch 'main' of https://github.com/mars-protocol/mars-v2-front…
linkielink Jul 8, 2025
7cf53e3
env: update HC and types
linkielink Jul 9, 2025
867b596
fix: show dialog when navigating via deeplink to vaults
Patricie29 Jul 9, 2025
ac23964
tidy: cleanup
Patricie29 Jul 9, 2025
7655b53
Merge pull request #1566 from mars-protocol/dialog-fix
linkielink Jul 9, 2025
fadf419
refactor: resize img
Patricie29 Jul 10, 2025
e2fa47b
env: update caching time to 10min
Patricie29 Jul 10, 2025
d54709a
Merge pull request #1567 from mars-protocol/resize-og-image
linkielink Jul 11, 2025
a191771
fix: set close_factor, reserve_factor and interest_rate_model if not set
linkielink Jul 14, 2025
4d2b400
fix: conditionally render modals
linkielink Jul 14, 2025
22c98b2
fix: lend more
linkielink Jul 14, 2025
e5ad264
fix: close modals on confirm
linkielink Jul 14, 2025
6c505d8
fix: duality route
linkielink Jul 14, 2025
9dea51a
fix: update: lock user selections and populate BorrowModal accordingly
StefChatz Jul 14, 2025
d6ed346
feat: add duality swaps to the broatcast.ts
linkielink Jul 15, 2025
43ebe20
Merge branch 'develop' into hot-fix-swapRepay-asset-selection
StefChatz Jul 15, 2025
f79f4f6
feat: first logic for reverse swaps
linkielink Jul 15, 2025
940290f
fix: added modal classes
linkielink Jul 15, 2025
b5d2e05
fix: minamountout
linkielink Jul 15, 2025
684375d
feat: added itteration fetching
linkielink Jul 15, 2025
2534853
fix: adjust tolrance and target amounts
linkielink Jul 15, 2025
6217ced
fix: improve error messages
linkielink Jul 15, 2025
b79063f
fix: use slippage buffer
linkielink Jul 15, 2025
ac23bf2
Merge pull request #1573 from mars-protocol/hot-fix-swapRepay-asset-s…
linkielink Jul 15, 2025
2e93968
Merge branch 'develop' into hls-closing-upgrades
linkielink Jul 15, 2025
d843227
fix: remove swap and repay if no debt
linkielink Jul 15, 2025
99c155e
Merge branch 'hls-closing-upgrades' of https://github.com/mars-protoc…
linkielink Jul 15, 2025
b15386e
Merge pull request #1574 from mars-protocol/hls-closing-upgrades
linkielink Jul 15, 2025
6a9ae1f
env: update dependencies
linkielink Jul 15, 2025
61f7221
fix: prioritize deposits first, lends after for swap&repay feature
StefChatz Jul 15, 2025
bea6d2c
format: dollar values
linkielink Jul 15, 2025
c535b51
Merge pull request #1575 from mars-protocol/swap-repay-deposits-lends…
linkielink Jul 15, 2025
b147a8d
env: update HC wasm
linkielink Jul 16, 2025
246ed1d
fix: https://github.com/mars-protocol/mars-v2-frontend/issues/1528
linkielink Jul 16, 2025
f04a64a
fix: modal width
linkielink Jul 17, 2025
9867ac4
fix: repay selected amount not full debt
Patricie29 Jul 17, 2025
f8f6ee7
fix: remove dust when simulating repay tx
Patricie29 Jul 17, 2025
976f78b
fix: repay selected amount in borrow modal
Patricie29 Jul 17, 2025
c01633e
Merge branch 'main' of https://github.com/mars-protocol/mars-v2-front…
linkielink Jul 18, 2025
40d791f
Merge branch 'develop' into auto-repay-fix
StefChatz Jul 21, 2025
caa13f7
Merge pull request #1576 from mars-protocol/auto-repay-fix
Patricie29 Jul 21, 2025
4374005
fix: combined assets repay simulation
Patricie29 Jul 21, 2025
d1b9c1d
fix: max amount of debt and swap asset
Patricie29 Jul 21, 2025
882ec20
fix: wording on vaults page
Patricie29 Jul 21, 2025
3df46bf
Merge pull request #1583 from mars-protocol/update-wording
linkielink Jul 21, 2025
002b88e
tidy: naming
Patricie29 Jul 22, 2025
e971d1d
Merge branch 'develop' into fix-simulation
Patricie29 Jul 22, 2025
9a11446
refactor: cleanup
Patricie29 Jul 22, 2025
7556162
refactor: enhance SL/TP handling in perps module and related components
StefChatz Jul 23, 2025
7b65c42
refactor: update Size component to include type prop in account and b…
StefChatz Jul 23, 2025
944c76b
Merge pull request #1586 from mars-protocol/dix-advancedSlTp-scalling
linkielink Jul 23, 2025
f67245a
Merge branch 'develop' into fix-simulation
Patricie29 Jul 23, 2025
8fbacbf
Merge pull request #1585 from mars-protocol/fix-simulation
Patricie29 Jul 23, 2025
078591f
refactor: delete yarn.lock
StefChatz Jul 23, 2025
6a4fb8f
chore: add yarn.lock to .gitignore
StefChatz Jul 23, 2025
7b8386b
Merge pull request #1588 from mars-protocol/delete-yarn-lock
linkielink Jul 23, 2025
d51f0dd
refactor: adjust limit price calculations in PerpsSlTpModal
StefChatz Jul 25, 2025
62bb462
Merge pull request #1589 from mars-protocol/fix-SlTp-modal
Patricie29 Jul 25, 2025
ff79faf
fix: vaults age
Patricie29 Jul 26, 2025
fe71113
Merge pull request #1590 from mars-protocol/vaults-age-fix
linkielink Jul 27, 2025
74c573c
env: version increase
linkielink Jul 29, 2025
b4e08d2
env: update dependencies
linkielink Jul 29, 2025
6e2d69d
fix: active TV elements
linkielink Jul 29, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

# dependencies
/node_modules
yarn.lock
/.pnp
.pnp.js

Expand Down Expand Up @@ -46,4 +47,5 @@ next-env.d.ts
.env.local.mainnet

# IDE
.idea
.idea
certificates
2 changes: 1 addition & 1 deletion eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export default tseslint.config(
'@typescript-eslint/no-empty-object-type': 'off',
'@typescript-eslint/no-unused-expressions': 'off',
'@typescript-eslint/no-unsafe-function-type': 'off',
'linebreak-style': ['warn', 'unix'],
'linebreak-style': 'off',
'no-undef': 'off',
'prettier/prettier': 0,
'sort-imports': [
Expand Down
4 changes: 2 additions & 2 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ const nextConfig = {
},
{
key: 'Cache-Control',
value: 'public, max-age=86400, s-maxage=86400, must-revalidate',
value: 'public, max-age=600, s-maxage=600, must-revalidate',
},
{
key: 'CDN-Cache-Control',
value: 'public, max-age=86400, s-maxage=86400, must-revalidate',
value: 'public, max-age=600, s-maxage=600, must-revalidate',
},
{
key: 'Expires',
Expand Down
72 changes: 36 additions & 36 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mars-v2-frontend",
"version": "2.10.4",
"version": "2.11.0",
"homepage": "./",
"private": false,
"license": "SEE LICENSE IN LICENSE FILE",
Expand All @@ -20,20 +20,20 @@
]
},
"dependencies": {
"@cosmjs/cosmwasm-stargate": "^0.33.1",
"@cosmjs/cosmwasm-stargate": "^0.34.0",
"@delphi-labs/shuttle-react": "^4.3.0",
"@keplr-wallet/cosmos": "^0.12.243",
"@next/eslint-plugin-next": "^15.3.4",
"@skip-go/client": "^1.3.2",
"@keplr-wallet/cosmos": "^0.12.254",
"@next/eslint-plugin-next": "^15.4.4",
"@skip-go/client": "^1.4.0",
"@solana/web3.js": "^1.98.2",
"@tanstack/react-query": "^5.81.2",
"@tanstack/react-query": "^5.83.0",
"@tanstack/react-table": "^8.21.3",
"@tippyjs/react": "^4.2.6",
"@vercel/analytics": "^1.5.0",
"@vercel/og": "^0.6.8",
"@vercel/og": "^0.8.5",
"@web3modal/wagmi": "^5.1.11",
"axios": "^1.10.0",
"bignumber.js": "^9.3.0",
"axios": "^1.11.0",
"bignumber.js": "^9.3.1",
"bitcoinjs-lib": "^6.1.7",
"classnames": "^2.5.1",
"debounce-promise": "^3.1.2",
Expand All @@ -45,60 +45,60 @@
"lodash.throttle": "^4.1.1",
"mobx": "^6.13.7",
"moment": "^2.30.1",
"next": "^15.3.4",
"react": "19.1.0",
"next": "^15.4.4",
"react": "19.1.1",
"react-device-detect": "^2.2.3",
"react-dom": "^19.1.0",
"react-draggable": "^4.4.6",
"react-dom": "^19.1.1",
"react-draggable": "^4.5.0",
"react-helmet-async": "^2.0.5",
"react-qr-code": "^2.0.16",
"react-router-dom": "^7.6.2",
"react-qr-code": "^2.0.18",
"react-router-dom": "^7.7.1",
"react-spring": "^10.0.1",
"react-toastify": "^11.0.5",
"react-use-clipboard": "^1.0.9",
"recharts": "^3.0.0",
"sharp": "^0.34.2",
"starknet": "^7.5.1",
"swr": "^2.3.3",
"viem": "^2.31.4",
"wagmi": "^2.15.6",
"zustand": "5.0.5"
"recharts": "^3.1.0",
"sharp": "^0.34.3",
"starknet": "^7.6.4",
"swr": "^2.3.4",
"viem": "^2.33.1",
"wagmi": "^2.16.0",
"zustand": "5.0.6"
},
"devDependencies": {
"@babel/eslint-parser": "^7.27.5",
"@eslint/compat": "^1.3.0",
"@babel/eslint-parser": "^7.28.0",
"@eslint/compat": "^1.3.1",
"@svgr/webpack": "^8.1.0",
"@tailwindcss/container-queries": "^0.1.1",
"@tailwindcss/postcss": "^4.1.10",
"@tailwindcss/postcss": "^4.1.11",
"@types/debounce-promise": "^3.1.9",
"@types/lodash.debounce": "^4.0.9",
"@types/lodash.throttle": "^4.1.9",
"@types/node": "^24.0.3",
"@types/node": "^24.1.0",
"@types/react": "19.1.8",
"@types/react-dom": "19.1.6",
"@types/react-helmet": "^6.1.11",
"@typescript-eslint/eslint-plugin": "^8.34.1",
"@typescript-eslint/parser": "^8.34.1",
"@typescript-eslint/eslint-plugin": "^8.38.0",
"@typescript-eslint/parser": "^8.38.0",
"autoprefixer": "^10.4.21",
"dotenv": "^16.5.0",
"dotenv-cli": "^8.0.0",
"eslint": "^9.29.0",
"eslint-config-prettier": "^10.1.5",
"dotenv": "^17.2.1",
"dotenv-cli": "^9.0.0",
"eslint": "^9.32.0",
"eslint-config-prettier": "^10.1.8",
"eslint-plugin-functional": "^9.0.2",
"eslint-plugin-import": "^2.32.0",
"eslint-plugin-prettier": "^5.5.0",
"eslint-plugin-prettier": "^5.5.3",
"eslint-plugin-react": "^7.37.5",
"eslint-plugin-react-hooks": "^5.2.0",
"husky": "^9.1.7",
"identity-obj-proxy": "^3.0.0",
"lint-staged": "^16.1.2",
"prettier": "^3.6.0",
"prettier-plugin-tailwindcss": "^0.6.13",
"prettier": "^3.6.2",
"prettier-plugin-tailwindcss": "^0.6.14",
"shelljs": "^0.10.0",
"tailwind-scrollbar-hide": "^4.0.0",
"tailwindcss": "^3.4.1",
"typescript": "^5.8.3",
"typescript-eslint": "^8.34.1"
"typescript-eslint": "^8.38.0"
},
"engines": {
"npm": "please-use-yarn",
Expand Down
9 changes: 6 additions & 3 deletions public/tradingview.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.theme-dark:root {
--tv-background: #000;
--tv-background: #220e1d;
--tv-form-background: #7f78e8;
--tv-button-background: linear-gradient(180deg, #7f78e8 0%, #926ac8 100%);
--tv-button-background-hover: linear-gradient(180deg, #926ac8 0%, #7f78e8 100%);
Expand All @@ -25,9 +25,12 @@
--ui-lib-button-default-color-content: #fff;
--ui-lib-button-default-color-border: var(--tv-form-background);
--ui-lib-button-default-color-bg: var(--tv-button-background);
--tv-color-popup-element-text-active: #fff;
--themed-color-content-primary-inverse: #fff;
--tv-color-popup-element-toolbox-text-active-hover: #fff;
--themed-color-content-secondary-inverse: #fff;
}


/* Favorited menus */
.tv-floating-toolbar__widget-wrapper > div {
background: var(--tv-menu-background) !important;
Expand Down Expand Up @@ -333,7 +336,7 @@ button[class^='button-'][class*='secondary-']:hover {
}

[class^='noWrapWrapper-'] * {
pointer-events: none !important;
pointer-events: none !important;
background: transparent !important;
}

Expand Down
7 changes: 5 additions & 2 deletions public/tradingview_default.css
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,12 @@
--ui-lib-button-default-color-content: #fff;
--ui-lib-button-default-color-border: var(--tv-form-background);
--ui-lib-button-default-color-bg: var(--tv-button-background);
--tv-color-popup-element-text-active: #fff;
--themed-color-content-primary-inverse: #fff;
--tv-color-popup-element-toolbox-text-active-hover: #fff;
--themed-color-content-secondary-inverse: #fff;
}


/* Favorited menus */
.tv-floating-toolbar__widget-wrapper > div {
background: var(--tv-menu-background) !important;
Expand Down Expand Up @@ -333,7 +336,7 @@ button[class^='button-'][class*='secondary-']:hover {
}

[class^='noWrapWrapper-'] * {
pointer-events: none !important;
pointer-events: none !important;
background: transparent !important;
}

Expand Down
Binary file added public/vaults_banner.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed public/vaults_banner.png
Binary file not shown.
6 changes: 2 additions & 4 deletions src/api/managedVaults/getHistoricalManagedVaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { getUrl } from 'utils/url'

export default async function getHistoricalManagedVaults(
chainConfig: ChainConfig,
duration: number | 'all',
duration: number,
vaultAddress: string,
) {
const defaultReturn: HistoricalManagedVaultsResponse = { data: [], page: 1, limit: 0, total: 0 }
Expand All @@ -14,9 +14,7 @@ export default async function getHistoricalManagedVaults(

try {
const url = getUrl(
duration === 'all'
? `${chainConfig.endpoints.historicalManagedVaults}&address=${vaultAddress}`
: `${chainConfig.endpoints.historicalManagedVaults}&duration=${duration}&address=${vaultAddress}`,
`${chainConfig.endpoints.historicalManagedVaults}&duration=${duration}&address=${vaultAddress}`,
)
const response = await fetchWithTimeout(url, FETCH_TIMEOUT)

Expand Down
39 changes: 39 additions & 0 deletions src/api/swap/getAstroportRouteInfo.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { FETCH_TIMEOUT } from 'constants/query'
import { byDenom } from 'utils/array'
import { fetchWithTimeout } from 'utils/fetch'
import { BN } from 'utils/helpers'

export default async function getRouteInfo(
denomIn: string,
denomOut: string,
amount: BigNumber,
assets: Asset[],
chainConfig: ChainConfig,
): Promise<SwapRouteInfo | null> {
const astroportUrl = `${chainConfig.endpoints.routes}?start=${denomIn}&end=${denomOut}&amount=${amount.toString()}&chainId=${chainConfig.id}&limit=1`

try {
const resp = await fetchWithTimeout(astroportUrl, FETCH_TIMEOUT)
const route = (await resp.json())[0] as AstroportRouteResponse

return {
amountOut: BN(route.amount_out),
priceImpact: BN(route.price_impact),
fee: BN(0), // TODO: Fees are not implemented yet on Astroport endpoint
description: [
assets.find(byDenom(denomIn))?.symbol,
...route.swaps.map((swap) => assets.find(byDenom(swap.to))?.symbol),
].join(' -> '),
route: {
astro: {
swaps: route.swaps.map((swap) => ({
from: swap.from,
to: swap.to,
})),
},
},
}
} catch (e) {
return null
}
}
Loading