merge main
This commit is contained in:
commit
581a7a9cb1
|
@ -70,7 +70,7 @@ const TokenList = () => {
|
|||
}
|
||||
|
||||
return (
|
||||
<ContentBox hideBorder hidePadding className="">
|
||||
<ContentBox hideBorder hidePadding>
|
||||
<div className="flex w-full items-center justify-end border-b border-th-bkg-3 py-3 px-6 lg:-mt-[36px] lg:mb-4 lg:w-auto lg:border-0 lg:py-0">
|
||||
<Switch
|
||||
checked={showZeroBalances}
|
||||
|
|
|
@ -94,14 +94,14 @@ const AccountActions = () => {
|
|||
appear={true}
|
||||
show={open}
|
||||
as={Fragment}
|
||||
enter="transition ease-in duration-200"
|
||||
enterFrom="opacity-0 scale-75"
|
||||
enter="transition ease-in duration-75"
|
||||
enterFrom="opacity-0 nice scale-75"
|
||||
enterTo="opacity-100 scale-100"
|
||||
leave="transition ease-out duration-200"
|
||||
leave="transition ease-out duration-100"
|
||||
leaveFrom="opacity-100"
|
||||
leaveTo="opacity-0"
|
||||
>
|
||||
<Popover.Panel className="absolute right-0 top-10 mt-1 space-y-1.5 rounded-md bg-th-bkg-2 px-4 py-2.5">
|
||||
<Popover.Panel className="absolute right-0 top-10 mt-1 space-y-2 rounded-md bg-th-bkg-2 px-4 py-2.5">
|
||||
<ActionsLinkButton
|
||||
mangoAccount={mangoAccount!}
|
||||
onClick={() =>
|
||||
|
|
|
@ -42,6 +42,7 @@ import { breakpoints } from 'utils/theme'
|
|||
import useMangoGroup from 'hooks/useMangoGroup'
|
||||
import PnlHistoryModal from '@components/modals/PnlHistoryModal'
|
||||
import FormatNumericValue from '@components/shared/FormatNumericValue'
|
||||
import HealthBar from './HealthBar'
|
||||
|
||||
const AccountPage = () => {
|
||||
const { t } = useTranslation(['common', 'account'])
|
||||
|
@ -327,7 +328,7 @@ const AccountPage = () => {
|
|||
</div>
|
||||
</div>
|
||||
<div className="grid grid-cols-5 border-b border-th-bkg-3">
|
||||
<div className="col-span-5 flex border-t border-th-bkg-3 py-3 pl-6 lg:col-span-1 lg:border-t-0">
|
||||
<div className="col-span-5 border-t border-th-bkg-3 py-3 px-6 lg:col-span-1 lg:border-t-0">
|
||||
<div id="account-step-four">
|
||||
<Tooltip
|
||||
maxWidth="20rem"
|
||||
|
@ -368,9 +369,10 @@ const AccountPage = () => {
|
|||
{t('health')}
|
||||
</p>
|
||||
</Tooltip>
|
||||
<p className="mt-1 text-2xl font-bold text-th-fgd-1 lg:text-xl xl:text-2xl">
|
||||
<p className="mt-1 mb-2 text-2xl font-bold text-th-fgd-1 lg:text-xl xl:text-2xl">
|
||||
{maintHealth}%
|
||||
</p>
|
||||
<HealthBar health={maintHealth} />
|
||||
</div>
|
||||
</div>
|
||||
<div className="col-span-5 flex border-t border-th-bkg-3 py-3 pl-6 lg:col-span-1 lg:border-l lg:border-t-0">
|
||||
|
|
|
@ -0,0 +1,69 @@
|
|||
import { useMemo } from 'react'
|
||||
|
||||
const HealthBar = ({ health }: { health: number }) => {
|
||||
const [barWidths, fillColor] = useMemo(() => {
|
||||
if (!health) return [[2, 0, 0, 0], 'var(--down)']
|
||||
if (health <= 25) {
|
||||
const fillWidth = (health / 25) * 100
|
||||
return [[fillWidth, 0, 0, 0], 'var(--down)']
|
||||
}
|
||||
if (health <= 50) {
|
||||
const fillWidth = ((health - 25) / 25) * 100
|
||||
return [[100, fillWidth, 0, 0], 'var(--warning)']
|
||||
}
|
||||
if (health <= 75) {
|
||||
const fillWidth = ((health - 50) / 25) * 100
|
||||
return [[100, 100, fillWidth, 0], 'var(--up)']
|
||||
}
|
||||
const fillWidth = ((health - 75) / 25) * 100
|
||||
return [[100, 100, 100, fillWidth], 'var(--up)']
|
||||
}, [health])
|
||||
|
||||
const sharedStyles = {
|
||||
background: fillColor,
|
||||
boxShadow: `0px 0px 8px 0px ${fillColor}`,
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="grid w-full grid-cols-4 gap-1">
|
||||
<div className="col-span-1 flex h-1 rounded-full bg-th-bkg-3">
|
||||
<div
|
||||
style={{
|
||||
...sharedStyles,
|
||||
width: `${barWidths[0]}%`,
|
||||
}}
|
||||
className={`flex rounded-full`}
|
||||
/>
|
||||
</div>
|
||||
<div className="col-span-1 flex h-1 rounded-full bg-th-bkg-3">
|
||||
<div
|
||||
style={{
|
||||
...sharedStyles,
|
||||
width: `${barWidths[1]}%`,
|
||||
}}
|
||||
className={`flex rounded-full`}
|
||||
/>
|
||||
</div>
|
||||
<div className="col-span-1 flex h-1 rounded-full bg-th-bkg-3">
|
||||
<div
|
||||
style={{
|
||||
...sharedStyles,
|
||||
width: `${barWidths[2]}%`,
|
||||
}}
|
||||
className={`flex rounded-full`}
|
||||
/>
|
||||
</div>
|
||||
<div className="col-span-1 flex h-1 rounded-full bg-th-bkg-3">
|
||||
<div
|
||||
style={{
|
||||
...sharedStyles,
|
||||
width: `${barWidths[3]}%`,
|
||||
}}
|
||||
className={`flex rounded-full`}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default HealthBar
|
|
@ -1,3 +1,5 @@
|
|||
import { useMemo } from 'react'
|
||||
|
||||
const HealthHeart = ({
|
||||
health,
|
||||
size,
|
||||
|
@ -5,7 +7,23 @@ const HealthHeart = ({
|
|||
health: number | undefined
|
||||
size: number
|
||||
}) => {
|
||||
const fillColor = useMemo(() => {
|
||||
if (!health) return 'var(--fgd-4)'
|
||||
if (health <= 25) {
|
||||
return 'var(--down)'
|
||||
}
|
||||
if (health <= 50) {
|
||||
return 'var(--warning)'
|
||||
}
|
||||
if (health <= 75) {
|
||||
return 'var(--up)'
|
||||
}
|
||||
return 'var(--up)'
|
||||
}, [health])
|
||||
|
||||
const styles = {
|
||||
color: fillColor,
|
||||
// filter: `drop-shadow(0px 0px 8px ${fillColor})`,
|
||||
height: `${size}px`,
|
||||
width: `${size}px`,
|
||||
}
|
||||
|
@ -14,15 +32,6 @@ const HealthHeart = ({
|
|||
<svg
|
||||
id="account-step-eleven"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
className={
|
||||
health
|
||||
? health > 15 && health < 50
|
||||
? 'text-th-warning'
|
||||
: health >= 50
|
||||
? 'text-th-success'
|
||||
: 'text-th-error'
|
||||
: 'text-th-fgd-4'
|
||||
}
|
||||
style={styles}
|
||||
viewBox="0 0 20 20"
|
||||
fill="currentColor"
|
||||
|
@ -33,7 +42,7 @@ const HealthHeart = ({
|
|||
d="M3.172 5.172a4 4 0 015.656 0L10 6.343l1.172-1.171a4 4 0 115.656 5.656L10 17.657l-6.828-6.829a4 4 0 010-5.656z"
|
||||
clipRule="evenodd"
|
||||
/>
|
||||
<animateTransform
|
||||
{/* <animateTransform
|
||||
attributeName="transform"
|
||||
type="scale"
|
||||
keyTimes="0;0.5;1"
|
||||
|
@ -62,7 +71,7 @@ const HealthHeart = ({
|
|||
: '0s'
|
||||
}
|
||||
repeatCount="indefinite"
|
||||
/>
|
||||
/> */}
|
||||
</g>
|
||||
</svg>
|
||||
)
|
||||
|
|
|
@ -52,10 +52,11 @@ const MangoAccountsListModal = ({
|
|||
if (!group) return mangoAccounts
|
||||
|
||||
return [...mangoAccounts].sort((a, b) => {
|
||||
if (b.publicKey.toString() === mangoAccount?.publicKey.toString())
|
||||
return 1
|
||||
if (a.publicKey.toString() === mangoAccount?.publicKey.toString())
|
||||
return -1
|
||||
// keeps the current selected mango account at the top of the list
|
||||
// if (b.publicKey.toString() === mangoAccount?.publicKey.toString())
|
||||
// return 1
|
||||
// if (a.publicKey.toString() === mangoAccount?.publicKey.toString())
|
||||
// return -1
|
||||
return b.getEquity(group).toNumber() - a.getEquity(group).toNumber()
|
||||
})
|
||||
}, [group, mangoAccounts])
|
||||
|
|
|
@ -26,6 +26,8 @@ export const PRIORITY_FEES = [
|
|||
{ label: 'High', value: 100000 },
|
||||
]
|
||||
|
||||
export const DEFAULT_PRIORITY_FEE = PRIORITY_FEES[1]
|
||||
|
||||
const RpcSettings = () => {
|
||||
const { t } = useTranslation('settings')
|
||||
const actions = mangoStore.getState().actions
|
||||
|
@ -38,7 +40,7 @@ const RpcSettings = () => {
|
|||
)
|
||||
const [storedPriorityFee, setStoredPriorityFee] = useLocalStorageState(
|
||||
PRIORITY_FEE_KEY,
|
||||
PRIORITY_FEES[2].value
|
||||
DEFAULT_PRIORITY_FEE.value
|
||||
)
|
||||
|
||||
const rpcEndpoint = useMemo(() => {
|
||||
|
@ -53,7 +55,7 @@ const RpcSettings = () => {
|
|||
const priorityFee = useMemo(() => {
|
||||
return (
|
||||
PRIORITY_FEES.find((node) => node.value === storedPriorityFee) ||
|
||||
PRIORITY_FEES[2]
|
||||
DEFAULT_PRIORITY_FEE
|
||||
)
|
||||
}, [storedPriorityFee])
|
||||
|
||||
|
|
|
@ -331,12 +331,14 @@ const DetailedAreaChart: FunctionComponent<DetailedAreaChartProps> = ({
|
|||
domain
|
||||
? domain
|
||||
: ([dataMin, dataMax]) => {
|
||||
const absMax = Math.max(
|
||||
Math.abs(dataMin),
|
||||
Math.abs(dataMax)
|
||||
)
|
||||
if (absMax < 1) {
|
||||
const difference =
|
||||
Math.abs(dataMax) - Math.abs(dataMin)
|
||||
if (difference < 0.1) {
|
||||
return [dataMin - 0.01, dataMax + 0.01]
|
||||
} else if (difference < 1) {
|
||||
return [dataMin - 1, dataMax + 1]
|
||||
} else if (difference < 10) {
|
||||
return [dataMin - 10, dataMax + 10]
|
||||
} else {
|
||||
return [dataMin, dataMax]
|
||||
}
|
||||
|
|
|
@ -43,9 +43,13 @@ const SimpleAreaChart = ({
|
|||
<XAxis dataKey={xKey} hide />
|
||||
<YAxis
|
||||
domain={([dataMin, dataMax]) => {
|
||||
const absMax = Math.max(Math.abs(dataMin), Math.abs(dataMax))
|
||||
if (absMax < 1) {
|
||||
const difference = Math.abs(dataMax) - Math.abs(dataMin)
|
||||
if (difference < 0.1) {
|
||||
return [dataMin - 0.01, dataMax + 0.01]
|
||||
} else if (difference < 1) {
|
||||
return [dataMin - 1, dataMax + 1]
|
||||
} else if (difference < 10) {
|
||||
return [dataMin - 10, dataMax + 10]
|
||||
} else {
|
||||
return [dataMin, dataMax]
|
||||
}
|
||||
|
|
|
@ -7,11 +7,7 @@ export const Table = ({
|
|||
}: {
|
||||
children: ReactNode
|
||||
className?: string
|
||||
}) => (
|
||||
<div className="thin-scroll overflow-x-auto">
|
||||
<table className={`m-0 min-w-full p-0 ${className}`}>{children}</table>
|
||||
</div>
|
||||
)
|
||||
}) => <table className={`m-0 min-w-full p-0 ${className}`}>{children}</table>
|
||||
|
||||
export const TrHead = ({
|
||||
children,
|
||||
|
|
|
@ -7,7 +7,7 @@ import FormatNumericValue from '@components/shared/FormatNumericValue'
|
|||
|
||||
type RoutesModalProps = {
|
||||
onClose: () => void
|
||||
setSelectedRoute: Dispatch<SetStateAction<RouteInfo | undefined>>
|
||||
setSelectedRoute: Dispatch<SetStateAction<RouteInfo | undefined | null>>
|
||||
show: boolean
|
||||
routes: RouteInfo[]
|
||||
selectedRoute: RouteInfo
|
||||
|
|
|
@ -47,6 +47,7 @@ import PercentageSelectButtons from './PercentageSelectButtons'
|
|||
import useIpAddress from 'hooks/useIpAddress'
|
||||
import { useEnhancedWallet } from '@components/wallet/EnhancedWalletProvider'
|
||||
import SwapSettings from './SwapSettings'
|
||||
import InlineNotification from '@components/shared/InlineNotification'
|
||||
|
||||
const MAX_DIGITS = 11
|
||||
export const withValueLimit = (values: NumberFormatValues): boolean => {
|
||||
|
@ -59,7 +60,8 @@ const set = mangoStore.getState().set
|
|||
|
||||
const SwapForm = () => {
|
||||
const { t } = useTranslation(['common', 'swap', 'trade'])
|
||||
const [selectedRoute, setSelectedRoute] = useState<RouteInfo>()
|
||||
//initial state is undefined null is returned on error
|
||||
const [selectedRoute, setSelectedRoute] = useState<RouteInfo | null>()
|
||||
const [animateSwitchArrow, setAnimateSwitchArrow] = useState(0)
|
||||
const [showTokenSelect, setShowTokenSelect] = useState('')
|
||||
const [showSettings, setShowSettings] = useState(false)
|
||||
|
@ -132,16 +134,16 @@ const SwapForm = () => {
|
|||
depending on the swapMode and set those values in state
|
||||
*/
|
||||
useEffect(() => {
|
||||
if (bestRoute) {
|
||||
if (typeof bestRoute !== 'undefined') {
|
||||
setSelectedRoute(bestRoute)
|
||||
|
||||
if (inputBank && swapMode === 'ExactOut') {
|
||||
const inAmount = new Decimal(bestRoute.inAmount)
|
||||
if (inputBank && swapMode === 'ExactOut' && bestRoute) {
|
||||
const inAmount = new Decimal(bestRoute!.inAmount)
|
||||
.div(10 ** inputBank.mintDecimals)
|
||||
.toString()
|
||||
setAmountInFormValue(inAmount)
|
||||
} else if (outputBank && swapMode === 'ExactIn') {
|
||||
const outAmount = new Decimal(bestRoute.outAmount)
|
||||
} else if (outputBank && swapMode === 'ExactIn' && bestRoute) {
|
||||
const outAmount = new Decimal(bestRoute!.outAmount)
|
||||
.div(10 ** outputBank.mintDecimals)
|
||||
.toString()
|
||||
setAmountOutFormValue(outAmount)
|
||||
|
@ -263,7 +265,7 @@ const SwapForm = () => {
|
|||
return (
|
||||
!!(amountInAsDecimal.toNumber() || amountOutAsDecimal.toNumber()) &&
|
||||
connected &&
|
||||
!selectedRoute
|
||||
typeof selectedRoute === 'undefined'
|
||||
)
|
||||
}, [amountInAsDecimal, amountOutAsDecimal, connected, selectedRoute])
|
||||
|
||||
|
@ -490,7 +492,7 @@ const SwapFormSubmitButton = ({
|
|||
amountOut: number | undefined
|
||||
inputSymbol: string | undefined
|
||||
loadingSwapDetails: boolean
|
||||
selectedRoute: RouteInfo | undefined
|
||||
selectedRoute: RouteInfo | undefined | null
|
||||
setShowConfirm: (x: boolean) => void
|
||||
useMargin: boolean
|
||||
}) => {
|
||||
|
@ -513,6 +515,7 @@ const SwapFormSubmitButton = ({
|
|||
const onClick = connected ? () => setShowConfirm(true) : handleConnect
|
||||
|
||||
return (
|
||||
<>
|
||||
<Button
|
||||
onClick={onClick}
|
||||
className="mt-6 mb-4 flex w-full items-center justify-center text-base"
|
||||
|
@ -539,5 +542,11 @@ const SwapFormSubmitButton = ({
|
|||
</div>
|
||||
)}
|
||||
</Button>
|
||||
{selectedRoute === null && (
|
||||
<div className="mb-4">
|
||||
<InlineNotification type="error" desc={t('swap:no-swap-found')} />
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
|
|
@ -49,8 +49,8 @@ type JupiterRouteInfoProps = {
|
|||
amountIn: Decimal
|
||||
onClose: () => void
|
||||
routes: RouteInfo[] | undefined
|
||||
selectedRoute: RouteInfo | undefined
|
||||
setSelectedRoute: Dispatch<SetStateAction<RouteInfo | undefined>>
|
||||
selectedRoute: RouteInfo | undefined | null
|
||||
setSelectedRoute: Dispatch<SetStateAction<RouteInfo | undefined | null>>
|
||||
slippage: number
|
||||
}
|
||||
|
||||
|
|
|
@ -112,6 +112,7 @@ const handleGetRoutes = async (
|
|||
feeBps = 0,
|
||||
wallet: string | undefined | null
|
||||
) => {
|
||||
try {
|
||||
wallet ||= PublicKey.default.toBase58()
|
||||
|
||||
const results = await Promise.allSettled([
|
||||
|
@ -145,11 +146,16 @@ const handleGetRoutes = async (
|
|||
).sort(
|
||||
(a, b) => Number(b.bestRoute.outAmount) - Number(a.bestRoute.outAmount)
|
||||
)
|
||||
|
||||
return {
|
||||
routes: sortedByBiggestOutAmount[0].routes,
|
||||
bestRoute: sortedByBiggestOutAmount[0].bestRoute,
|
||||
}
|
||||
} catch (e) {
|
||||
return {
|
||||
routes: [],
|
||||
bestRoute: null,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const useQuoteRoutes = ({
|
||||
|
@ -172,7 +178,10 @@ const useQuoteRoutes = ({
|
|||
? new Decimal(amount).mul(10 ** decimals)
|
||||
: new Decimal(0)
|
||||
|
||||
const res = useQuery<{ routes: RouteInfo[]; bestRoute: RouteInfo }, Error>(
|
||||
const res = useQuery<
|
||||
{ routes: RouteInfo[]; bestRoute: RouteInfo | null },
|
||||
Error
|
||||
>(
|
||||
['swap-routes', inputMint, outputMint, amount, slippage, swapMode, wallet],
|
||||
async () =>
|
||||
handleGetRoutes(
|
||||
|
|
|
@ -21,7 +21,11 @@ const MarketSelectDropdown = () => {
|
|||
const [spotBaseFilter, setSpotBaseFilter] = useState('All')
|
||||
|
||||
const perpMarkets = useMemo(() => {
|
||||
return allPerpMarkets.filter((p) => p.name !== 'MNGO-PERP')
|
||||
return allPerpMarkets.filter(
|
||||
(p) =>
|
||||
p.publicKey.toString() !==
|
||||
'9Y8paZ5wUpzLFfQuHz8j2RtPrKsDtHx9sbgFmWb5abCw'
|
||||
)
|
||||
}, [allPerpMarkets])
|
||||
|
||||
const spotBaseTokens: string[] = useMemo(() => {
|
||||
|
@ -118,9 +122,7 @@ const MarketSelectDropdown = () => {
|
|||
) : null}
|
||||
{activeTab === 'perp'
|
||||
? perpMarkets?.length
|
||||
? perpMarkets
|
||||
.filter((m) => m.name !== 'MNGO-PERP' || isTesting)
|
||||
.map((m) => {
|
||||
? perpMarkets.map((m) => {
|
||||
return (
|
||||
<div
|
||||
className="flex items-center justify-between py-2 px-4"
|
||||
|
|
|
@ -28,7 +28,7 @@ import { ArrowPathIcon } from '@heroicons/react/20/solid'
|
|||
import { sleep } from 'utils'
|
||||
|
||||
export const decodeBookL2 = (book: SpotOrderBook | BookSide): number[][] => {
|
||||
const depth = 40
|
||||
const depth = 300
|
||||
if (book instanceof SpotOrderBook) {
|
||||
return book.getL2(depth).map(([price, size]) => [price, size])
|
||||
} else if (book instanceof BookSide) {
|
||||
|
@ -473,11 +473,7 @@ const Orderbook = () => {
|
|||
</div>
|
||||
{market ? (
|
||||
<div id="trade-step-four">
|
||||
<Tooltip
|
||||
content={t('trade:grouping')}
|
||||
placement="bottom"
|
||||
delay={250}
|
||||
>
|
||||
<Tooltip content={t('trade:grouping')} placement="left" delay={250}>
|
||||
<GroupSize
|
||||
tickSize={market.tickSize}
|
||||
onChange={onGroupSizeChange}
|
||||
|
|
|
@ -26,5 +26,6 @@
|
|||
"tooltip-borrow-balance": "You'll use your {{balance}} {{token}} balance and borrow {{borrowAmount}} {{token}} to execute this swap. The current {{token}} variable borrow rate is {{rate}}%",
|
||||
"tooltip-borrow-no-balance": "You'll borrow {{borrowAmount}} {{token}} to execute this swap. The current {{token}} variable borrow rate is {{rate}}%",
|
||||
"tooltip-max-slippage": "If price slips beyond your maximum slippage your swap will not be executed",
|
||||
"use-margin": "Allow Margin"
|
||||
"use-margin": "Allow Margin",
|
||||
"no-swap-found": "No swap found"
|
||||
}
|
|
@ -26,5 +26,6 @@
|
|||
"tooltip-borrow-balance": "You'll use your {{balance}} {{token}} balance and borrow {{borrowAmount}} {{token}} to execute this swap. The current {{token}} variable borrow rate is {{rate}}%",
|
||||
"tooltip-borrow-no-balance": "You'll borrow {{borrowAmount}} {{token}} to execute this swap. The current {{token}} variable borrow rate is {{rate}}%",
|
||||
"tooltip-max-slippage": "If price slips beyond your maximum slippage your swap will not be executed",
|
||||
"use-margin": "Allow Margin"
|
||||
"use-margin": "Allow Margin",
|
||||
"no-swap-found": "No swap found"
|
||||
}
|
|
@ -26,5 +26,6 @@
|
|||
"tooltip-borrow-balance": "You'll use your {{balance}} {{token}} balance and borrow {{borrowAmount}} {{token}} to execute this swap. The current {{token}} variable borrow rate is {{rate}}%",
|
||||
"tooltip-borrow-no-balance": "You'll borrow {{borrowAmount}} {{token}} to execute this swap. The current {{token}} variable borrow rate is {{rate}}%",
|
||||
"tooltip-max-slippage": "If price slips beyond your maximum slippage your swap will not be executed",
|
||||
"use-margin": "Allow Margin"
|
||||
"use-margin": "Allow Margin",
|
||||
"no-swap-found": "No swap found"
|
||||
}
|
|
@ -26,5 +26,6 @@
|
|||
"tooltip-borrow-balance": "You'll use your {{balance}} {{token}} balance and borrow {{borrowAmount}} {{token}} to execute this swap. The current {{token}} variable borrow rate is {{rate}}%",
|
||||
"tooltip-borrow-no-balance": "You'll borrow {{borrowAmount}} {{token}} to execute this swap. The current {{token}} variable borrow rate is {{rate}}%",
|
||||
"tooltip-max-slippage": "If price slips beyond your maximum slippage your swap will not be executed",
|
||||
"use-margin": "Allow Margin"
|
||||
"use-margin": "Allow Margin",
|
||||
"no-swap-found": "No swap found"
|
||||
}
|
|
@ -26,5 +26,6 @@
|
|||
"tooltip-borrow-balance": "You'll use your {{balance}} {{token}} balance and borrow {{borrowAmount}} {{token}} to execute this swap. The current {{token}} variable borrow rate is {{rate}}%",
|
||||
"tooltip-borrow-no-balance": "You'll borrow {{borrowAmount}} {{token}} to execute this swap. The current {{token}} variable borrow rate is {{rate}}%",
|
||||
"tooltip-max-slippage": "If price slips beyond your maximum slippage your swap will not be executed",
|
||||
"use-margin": "Allow Margin"
|
||||
"use-margin": "Allow Margin",
|
||||
"no-swap-found": "No swap found"
|
||||
}
|
|
@ -48,7 +48,7 @@ import {
|
|||
import spotBalancesUpdater from './spotBalancesUpdater'
|
||||
import { PerpMarket } from '@blockworks-foundation/mango-v4/'
|
||||
import perpPositionsUpdater from './perpPositionsUpdater'
|
||||
import { PRIORITY_FEES } from '@components/settings/RpcSettings'
|
||||
import { DEFAULT_PRIORITY_FEE } from '@components/settings/RpcSettings'
|
||||
|
||||
const GROUP = new PublicKey('78b8f4cGCwmZ9ysPFMWLaLTkkaYnUjwMJYStWe5RTSSX')
|
||||
|
||||
|
@ -78,10 +78,9 @@ const emptyWallet = new EmptyWallet(Keypair.generate())
|
|||
|
||||
const initMangoClient = (
|
||||
provider: AnchorProvider,
|
||||
opts = { prioritizationFee: PRIORITY_FEES[2].value }
|
||||
opts = { prioritizationFee: DEFAULT_PRIORITY_FEE.value }
|
||||
): MangoClient => {
|
||||
return MangoClient.connect(provider, CLUSTER, MANGO_V4_ID[CLUSTER], {
|
||||
// blockhashCommitment: 'confirmed',
|
||||
prioritizationFee: opts.prioritizationFee,
|
||||
idsSource: 'get-program-accounts',
|
||||
postSendTxCallback: ({ txid }: { txid: string }) => {
|
||||
|
@ -660,6 +659,12 @@ const mangoStore = create<MangoStore>()(
|
|||
const { value: reloadedMangoAccount, slot } =
|
||||
await mangoAccount.reloadWithSlot(client)
|
||||
if (slot > lastSlot) {
|
||||
const ma = get().mangoAccounts.find((ma) =>
|
||||
ma.publicKey.equals(reloadedMangoAccount.publicKey)
|
||||
)
|
||||
if (ma) {
|
||||
Object.assign(ma, reloadedMangoAccount)
|
||||
}
|
||||
set((state) => {
|
||||
state.mangoAccount.current = reloadedMangoAccount
|
||||
state.mangoAccount.lastSlot = slot
|
||||
|
@ -941,7 +946,8 @@ const mangoStore = create<MangoStore>()(
|
|||
)
|
||||
provider.opts.skipPreflight = true
|
||||
const prioritizationFee = Number(
|
||||
localStorage.getItem(PRIORITY_FEE_KEY)
|
||||
localStorage.getItem(PRIORITY_FEE_KEY) ??
|
||||
DEFAULT_PRIORITY_FEE.value
|
||||
)
|
||||
const client = initMangoClient(provider, { prioritizationFee })
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ export const OUTPUT_TOKEN_DEFAULT = 'SOL'
|
|||
export const JUPITER_V4_PROGRAM_ID =
|
||||
'JUP4Fb2cqiRUcaTHdrPC8h2gNsA2ETXiPDD33WcGuJB'
|
||||
|
||||
export const ALPHA_DEPOSIT_LIMIT = 1000
|
||||
export const ALPHA_DEPOSIT_LIMIT = 200
|
||||
|
||||
export const CONNECTION_COMMITMENT = 'processed'
|
||||
|
||||
|
|
103
yarn.lock
103
yarn.lock
|
@ -15,16 +15,23 @@
|
|||
core-js-pure "^3.20.2"
|
||||
regenerator-runtime "^0.13.4"
|
||||
|
||||
"@babel/runtime@^7.0.0", "@babel/runtime@^7.1.2", "@babel/runtime@^7.10.2", "@babel/runtime@^7.10.5", "@babel/runtime@^7.12.5", "@babel/runtime@^7.14.5", "@babel/runtime@^7.17.2", "@babel/runtime@^7.17.9", "@babel/runtime@^7.18.6", "@babel/runtime@^7.18.9", "@babel/runtime@^7.6.2":
|
||||
"@babel/runtime@^7.0.0", "@babel/runtime@^7.1.2", "@babel/runtime@^7.10.2", "@babel/runtime@^7.14.5", "@babel/runtime@^7.17.9", "@babel/runtime@^7.18.6", "@babel/runtime@^7.18.9", "@babel/runtime@^7.6.2":
|
||||
version "7.20.7"
|
||||
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.20.7.tgz#fcb41a5a70550e04a7b708037c7c32f7f356d8fd"
|
||||
integrity sha512-UF0tvkUtxwAgZ5W/KrkHf0Rn0fdnLDU9ScxBrEVNUprE/MzirjK4MJUX1/BVDv00Sv8cljtukVK1aky++X1SjQ==
|
||||
dependencies:
|
||||
regenerator-runtime "^0.13.11"
|
||||
|
||||
"@babel/runtime@^7.10.5", "@babel/runtime@^7.12.5", "@babel/runtime@^7.17.2":
|
||||
version "7.20.13"
|
||||
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.20.13.tgz#7055ab8a7cff2b8f6058bf6ae45ff84ad2aded4b"
|
||||
integrity sha512-gt3PKXs0DBoL9xCvOIIZ2NEqAGZqHjAnmVbfQtB620V0uReIQutpel14KcneZuer7UioY8ALKZ7iocavvzTNFA==
|
||||
dependencies:
|
||||
regenerator-runtime "^0.13.11"
|
||||
|
||||
"@blockworks-foundation/mango-v4@https://github.com/blockworks-foundation/mango-v4.git#ts-client":
|
||||
version "0.0.1-beta.6"
|
||||
resolved "https://github.com/blockworks-foundation/mango-v4.git#1ca560c007081127ac31486a96a3729da22f99fb"
|
||||
resolved "https://github.com/blockworks-foundation/mango-v4.git#2f754115d06745282b863e7a905bdb25bf85d309"
|
||||
dependencies:
|
||||
"@project-serum/anchor" "^0.25.0"
|
||||
"@project-serum/serum" "^0.13.65"
|
||||
|
@ -374,9 +381,9 @@
|
|||
integrity sha512-Rk4SkJFaXZiznFyC/t77Q0NKS4FL7TLJJsVG2V2oiEq3kJVeTdxysEe/yRWSpnWMe808XRDJ+VFh5pt/FN5plw==
|
||||
|
||||
"@noble/hashes@^1.1.2":
|
||||
version "1.1.5"
|
||||
resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.1.5.tgz#1a0377f3b9020efe2fae03290bd2a12140c95c11"
|
||||
integrity sha512-LTMZiiLc+V4v1Yi16TD6aX2gmtKszNye0pQgbaLqkvhIqP7nVsSaJsWloGQjJfJ8offaoP5GtX3yY5swbcJxxQ==
|
||||
version "1.2.0"
|
||||
resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.2.0.tgz#a3150eeb09cc7ab207ebf6d7b9ad311a9bdbed12"
|
||||
integrity sha512-FZfhjEDbT5GRswV3C6uvLPHMiVD6lQBmpoX5+eSiPaMTXte/IKqI5dykDxzZB/WBeK/CDuQRBWarPdi3FNY2zQ==
|
||||
|
||||
"@noble/secp256k1@^1.6.3":
|
||||
version "1.7.1"
|
||||
|
@ -1091,7 +1098,29 @@
|
|||
"@wallet-standard/app" "^1.0.0"
|
||||
"@wallet-standard/base" "^1.0.0"
|
||||
|
||||
"@solana/web3.js@^1.17.0", "@solana/web3.js@^1.21.0", "@solana/web3.js@^1.31.0", "@solana/web3.js@^1.32.0", "@solana/web3.js@^1.36.0", "@solana/web3.js@^1.44.3", "@solana/web3.js@^1.63.1":
|
||||
"@solana/web3.js@^1.17.0", "@solana/web3.js@^1.21.0", "@solana/web3.js@^1.32.0", "@solana/web3.js@^1.36.0", "@solana/web3.js@^1.63.1":
|
||||
version "1.73.2"
|
||||
resolved "https://registry.yarnpkg.com/@solana/web3.js/-/web3.js-1.73.2.tgz#4b30cd402b35733dae3a7d0b638be26a7742b395"
|
||||
integrity sha512-9WACF8W4Nstj7xiDw3Oom22QmrhBh0VyZyZ7JvvG3gOxLWLlX3hvm5nPVJOGcCE/9fFavBbCUb5A6CIuvMGdoA==
|
||||
dependencies:
|
||||
"@babel/runtime" "^7.12.5"
|
||||
"@noble/ed25519" "^1.7.0"
|
||||
"@noble/hashes" "^1.1.2"
|
||||
"@noble/secp256k1" "^1.6.3"
|
||||
"@solana/buffer-layout" "^4.0.0"
|
||||
agentkeepalive "^4.2.1"
|
||||
bigint-buffer "^1.1.5"
|
||||
bn.js "^5.0.0"
|
||||
borsh "^0.7.0"
|
||||
bs58 "^4.0.1"
|
||||
buffer "6.0.1"
|
||||
fast-stable-stringify "^1.0.0"
|
||||
jayson "^3.4.4"
|
||||
node-fetch "2"
|
||||
rpc-websockets "^7.5.0"
|
||||
superstruct "^0.14.2"
|
||||
|
||||
"@solana/web3.js@^1.31.0", "@solana/web3.js@^1.44.3":
|
||||
version "1.73.0"
|
||||
resolved "https://registry.yarnpkg.com/@solana/web3.js/-/web3.js-1.73.0.tgz#c65f9f954ac80fca6952765c931dd72e57e1b572"
|
||||
integrity sha512-YrgX3Py7ylh8NYkbanoINUPCj//bWUjYZ5/WPy9nQ9SK3Cl7QWCR+NmbDjmC/fTspZGR+VO9LTQslM++jr5PRw==
|
||||
|
@ -2226,12 +2255,13 @@ axios@^0.21.0, axios@^0.21.4:
|
|||
dependencies:
|
||||
follow-redirects "^1.14.0"
|
||||
|
||||
axios@^0.25.0:
|
||||
version "0.25.0"
|
||||
resolved "https://registry.yarnpkg.com/axios/-/axios-0.25.0.tgz#349cfbb31331a9b4453190791760a8d35b093e0a"
|
||||
integrity sha512-cD8FOb0tRH3uuEe6+evtAbgJtfxr7ly3fQjYcMcuPlgkwVS9xboaVIpcDV+cYQe+yGykgwZCs1pzjntcGa6l5g==
|
||||
axios@^0.27.2:
|
||||
version "0.27.2"
|
||||
resolved "https://registry.yarnpkg.com/axios/-/axios-0.27.2.tgz#207658cc8621606e586c85db4b41a750e756d972"
|
||||
integrity sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==
|
||||
dependencies:
|
||||
follow-redirects "^1.14.7"
|
||||
follow-redirects "^1.14.9"
|
||||
form-data "^4.0.0"
|
||||
|
||||
axobject-query@^2.2.0:
|
||||
version "2.2.0"
|
||||
|
@ -2784,9 +2814,9 @@ crc@^3.8.0:
|
|||
buffer "^5.1.0"
|
||||
|
||||
crc@^4.1.0:
|
||||
version "4.2.0"
|
||||
resolved "https://registry.yarnpkg.com/crc/-/crc-4.2.0.tgz#3017c95b2c5f18e9907e80540e1d0a4ea0c00109"
|
||||
integrity sha512-TpRSRyMXRyVu2LYKgu0uxuYvk026DS7BKAk8hdrJ0deOUxArnUTgsFvbPkQc2i3qHoT0upKPBJ+WoKc6t8kCMg==
|
||||
version "4.3.2"
|
||||
resolved "https://registry.yarnpkg.com/crc/-/crc-4.3.2.tgz#49b7821cbf2cf61dfd079ed93863bbebd5469b9a"
|
||||
integrity sha512-uGDHf4KLLh2zsHa8D8hIQ1H/HtFQhyHrc0uhHBcoKGol/Xnb+MPYfUMw7cvON6ze/GUESTudKayDcJC5HnJv1A==
|
||||
|
||||
create-ecdh@^4.0.0:
|
||||
version "4.0.4"
|
||||
|
@ -3840,7 +3870,7 @@ flatted@^3.1.0:
|
|||
resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.2.5.tgz#76c8584f4fc843db64702a6bd04ab7a8bd666da3"
|
||||
integrity sha512-WIWGi2L3DyTUvUrwRKgGi9TwxQMUEqPOPQBVi71R96jZXJdFskXEmf54BoZaS1kknGODoIGASGEzBUYdyMCBJg==
|
||||
|
||||
follow-redirects@^1.14.0, follow-redirects@^1.14.7, follow-redirects@^1.15.0:
|
||||
follow-redirects@^1.14.0, follow-redirects@^1.14.9, follow-redirects@^1.15.0:
|
||||
version "1.15.2"
|
||||
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.2.tgz#b460864144ba63f2681096f274c4e57026da2c13"
|
||||
integrity sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==
|
||||
|
@ -4553,7 +4583,7 @@ jmespath@^0.15.0:
|
|||
resolved "https://registry.yarnpkg.com/jmespath/-/jmespath-0.15.0.tgz#a3f222a9aae9f966f5d27c796510e28091764217"
|
||||
integrity sha512-+kHj8HXArPfpPEKGLZ+kB5ONRTCiGQXo8RQYL0hH8t6pWXUBBK5KkkQmTNOwKK4LEsd0yTsgtjJVm4UBSZea4w==
|
||||
|
||||
joi@^17.6.0:
|
||||
joi@^17.7.0:
|
||||
version "17.7.0"
|
||||
resolved "https://registry.yarnpkg.com/joi/-/joi-17.7.0.tgz#591a33b1fe1aca2bc27f290bcad9b9c1c570a6b3"
|
||||
integrity sha512-1/ugc8djfn93rTE3WRKdCzGGt/EtiYKxITMO4Wiv6q5JL1gl9ePt4kBsl1S499nbosspfctIQTpYIhSmHA3WAg==
|
||||
|
@ -4902,7 +4932,7 @@ minimatch@^3.0.4, minimatch@^3.1.1, minimatch@^3.1.2:
|
|||
dependencies:
|
||||
brace-expansion "^1.1.7"
|
||||
|
||||
minimist@^1.2.0, minimist@^1.2.5, minimist@^1.2.6:
|
||||
minimist@^1.2.0, minimist@^1.2.6, minimist@^1.2.7:
|
||||
version "1.2.7"
|
||||
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.7.tgz#daa1c4d91f507390437c6a8bc01078e7000c4d18"
|
||||
integrity sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g==
|
||||
|
@ -5037,9 +5067,9 @@ node-addon-api@^2.0.0:
|
|||
integrity sha512-Ntyt4AIXyaLIuMHF6IOoTakB3K+RWxwtsHNRxllEoA6vPwP9o4866g6YWDLUdnucilZhmkxiHwHr11gAENw+QA==
|
||||
|
||||
node-fetch@2, node-fetch@^2.6.1:
|
||||
version "2.6.8"
|
||||
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.8.tgz#a68d30b162bc1d8fd71a367e81b997e1f4d4937e"
|
||||
integrity sha512-RZ6dBYuj8dRSfxpUSu+NsdF1dpPpluJxwOp+6IoDp/sH2QNDSvurYsAa+F1WxY2RjA1iP93xhcsUoYbF2XBqVg==
|
||||
version "2.6.9"
|
||||
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.9.tgz#7c7f744b5cc6eb5fd404e0c7a9fec630a55657e6"
|
||||
integrity sha512-DJm/CJkZkRjKKj4Zi4BsKVZh3ValV5IR5s7LVZnW+6YMh0W1BfNA8XSs6DLMGYlId5F3KnA70uu2qepcR08Qqg==
|
||||
dependencies:
|
||||
whatwg-url "^5.0.0"
|
||||
|
||||
|
@ -6058,7 +6088,7 @@ rxjs@6, rxjs@^6.6.3:
|
|||
dependencies:
|
||||
tslib "^1.9.0"
|
||||
|
||||
rxjs@^7.5.4:
|
||||
rxjs@^7.8.0:
|
||||
version "7.8.0"
|
||||
resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-7.8.0.tgz#90a938862a82888ff4c7359811a595e14e1e09a4"
|
||||
integrity sha512-F2+gxDshqmIub1KdvZkaEfGDwLNpPvk9Fs6LD/MyQxNgMds/WH9OdDDXOmxUZpME+iSK3rQCctkL0DYyytUqMg==
|
||||
|
@ -6285,9 +6315,9 @@ sshpk@^1.7.0:
|
|||
tweetnacl "~0.14.0"
|
||||
|
||||
start-server-and-test@^1.14.0:
|
||||
version "1.15.2"
|
||||
resolved "https://registry.yarnpkg.com/start-server-and-test/-/start-server-and-test-1.15.2.tgz#3c4f9b358a0dc5ae03a96dd7d7ae9e25a3b24165"
|
||||
integrity sha512-t5xJX04Hg7hqxiKHMJBz/n4zIMsE6G7hpAcerFAH+4Vh9le/LeyFcJERJM7WLiPygWF9TOg33oroJF1XOzJtYQ==
|
||||
version "1.15.3"
|
||||
resolved "https://registry.yarnpkg.com/start-server-and-test/-/start-server-and-test-1.15.3.tgz#33bb6465ff4d5e3a476337512a7e0d737a5ef026"
|
||||
integrity sha512-4GqkqghvUR9cJ8buvtgkyT0AHgVwCJ5EN8eDEhe9grTChGwWUxGm2nqfSeE9+0PZkLRdFqcwTwxVHe1y3ViutQ==
|
||||
dependencies:
|
||||
arg "^5.0.2"
|
||||
bluebird "3.7.2"
|
||||
|
@ -6296,7 +6326,7 @@ start-server-and-test@^1.14.0:
|
|||
execa "5.1.1"
|
||||
lazy-ass "1.6.0"
|
||||
ps-tree "1.2.0"
|
||||
wait-on "6.0.1"
|
||||
wait-on "7.0.1"
|
||||
|
||||
stream-browserify@^3.0.0:
|
||||
version "3.0.0"
|
||||
|
@ -6594,7 +6624,12 @@ tslib@^1.8.1, tslib@^1.9.0:
|
|||
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00"
|
||||
integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==
|
||||
|
||||
tslib@^2.0.3, tslib@^2.1.0, tslib@^2.3.0, tslib@^2.3.1, tslib@^2.4.0:
|
||||
tslib@^2.0.3, tslib@^2.1.0:
|
||||
version "2.5.0"
|
||||
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.5.0.tgz#42bfed86f5787aeb41d031866c8f402429e0fddf"
|
||||
integrity sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg==
|
||||
|
||||
tslib@^2.3.0, tslib@^2.3.1, tslib@^2.4.0:
|
||||
version "2.4.1"
|
||||
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.4.1.tgz#0d0bfbaac2880b91e22df0768e55be9753a5b17e"
|
||||
integrity sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==
|
||||
|
@ -7079,16 +7114,16 @@ void-elements@3.1.0:
|
|||
resolved "https://registry.yarnpkg.com/void-elements/-/void-elements-3.1.0.tgz#614f7fbf8d801f0bb5f0661f5b2f5785750e4f09"
|
||||
integrity sha512-Dhxzh5HZuiHQhbvTW9AMetFfBHDMYpo23Uo9btPXgdYP+3T5S+p+jgNy7spra+veYhBP2dCSgxR/i2Y02h5/6w==
|
||||
|
||||
wait-on@6.0.1:
|
||||
version "6.0.1"
|
||||
resolved "https://registry.yarnpkg.com/wait-on/-/wait-on-6.0.1.tgz#16bbc4d1e4ebdd41c5b4e63a2e16dbd1f4e5601e"
|
||||
integrity sha512-zht+KASY3usTY5u2LgaNqn/Cd8MukxLGjdcZxT2ns5QzDmTFc4XoWBgC+C/na+sMRZTuVygQoMYwdcVjHnYIVw==
|
||||
wait-on@7.0.1:
|
||||
version "7.0.1"
|
||||
resolved "https://registry.yarnpkg.com/wait-on/-/wait-on-7.0.1.tgz#5cff9f8427e94f4deacbc2762e6b0a489b19eae9"
|
||||
integrity sha512-9AnJE9qTjRQOlTZIldAaf/da2eW0eSRSgcqq85mXQja/DW3MriHxkpODDSUEg+Gri/rKEcXUZHe+cevvYItaog==
|
||||
dependencies:
|
||||
axios "^0.25.0"
|
||||
joi "^17.6.0"
|
||||
axios "^0.27.2"
|
||||
joi "^17.7.0"
|
||||
lodash "^4.17.21"
|
||||
minimist "^1.2.5"
|
||||
rxjs "^7.5.4"
|
||||
minimist "^1.2.7"
|
||||
rxjs "^7.8.0"
|
||||
|
||||
walktour@5.1.1:
|
||||
version "5.1.1"
|
||||
|
|
Loading…
Reference in New Issue