Merge branch 'main' of github.com:blockworks-foundation/mango-ui-v3 into add-wallet-adapter
This commit is contained in:
commit
0a033e50d8
|
@ -39,7 +39,6 @@ export default function AccountInfo() {
|
|||
const mangoCache = useMangoStore((s) => s.selectedMangoGroup.cache)
|
||||
const { mangoAccount, initialLoad } = useMangoAccount()
|
||||
const marketConfig = useMangoStore((s) => s.selectedMarket.config)
|
||||
const mangoClient = useMangoStore((s) => s.connection.client)
|
||||
const wallet = useMangoStore((s) => s.wallet.current)
|
||||
const actions = useMangoStore((s) => s.actions)
|
||||
const { width } = useViewport()
|
||||
|
@ -77,6 +76,7 @@ export default function AccountInfo() {
|
|||
|
||||
const handleRedeemMngo = async () => {
|
||||
const wallet = useMangoStore.getState().wallet.current
|
||||
const mangoClient = useMangoStore.getState().connection.client
|
||||
const mngoNodeBank =
|
||||
mangoGroup.rootBankAccounts[MNGO_INDEX].nodeBankAccounts[0]
|
||||
|
||||
|
|
|
@ -28,10 +28,10 @@ const AccountNameModal: FunctionComponent<AccountNameModalProps> = ({
|
|||
const [invalidNameMessage, setInvalidNameMessage] = useState('')
|
||||
const mangoGroup = useMangoStore((s) => s.selectedMangoGroup.current)
|
||||
const mangoAccount = useMangoStore((s) => s.selectedMangoAccount.current)
|
||||
const mangoClient = useMangoStore((s) => s.connection.client)
|
||||
const actions = useMangoStore((s) => s.actions)
|
||||
|
||||
const submitName = async () => {
|
||||
const mangoClient = useMangoStore.getState().connection.client
|
||||
const wallet = useMangoStore.getState().wallet.current
|
||||
|
||||
try {
|
||||
|
|
|
@ -45,7 +45,6 @@ const BalancesTable = ({
|
|||
const actions = useMangoStore((s) => s.actions)
|
||||
const mangoGroup = useMangoStore((s) => s.selectedMangoGroup.current)
|
||||
const mangoGroupConfig = useMangoStore((s) => s.selectedMangoGroup.config)
|
||||
const mangoClient = useMangoStore((s) => s.connection.client)
|
||||
const selectedMarket = useMangoStore((s) => s.selectedMarket.current)
|
||||
const marketConfig = useMangoStore((s) => s.selectedMarket.config)
|
||||
const setMangoStore = useMangoStore((s) => s.set)
|
||||
|
@ -107,6 +106,7 @@ const BalancesTable = ({
|
|||
|
||||
async function handleSettleAll() {
|
||||
const markets = useMangoStore.getState().selectedMangoGroup.markets
|
||||
const mangoClient = useMangoStore.getState().connection.client
|
||||
|
||||
try {
|
||||
setSubmitting(true)
|
||||
|
@ -206,10 +206,10 @@ const BalancesTable = ({
|
|||
<TrHead>
|
||||
<Th>
|
||||
<LinkButton
|
||||
className="flex items-center text-left font-normal no-underline"
|
||||
className="flex items-center text-left no-underline"
|
||||
onClick={() => requestSort('symbol')}
|
||||
>
|
||||
{t('asset')}
|
||||
<span className="font-normal">{t('asset')}</span>
|
||||
<ArrowSmDownIcon
|
||||
className={`default-transition ml-1 h-4 w-4 flex-shrink-0 ${
|
||||
sortConfig?.key === 'symbol'
|
||||
|
@ -223,10 +223,10 @@ const BalancesTable = ({
|
|||
</Th>
|
||||
<Th>
|
||||
<LinkButton
|
||||
className="flex items-center text-left font-normal no-underline"
|
||||
className="flex items-center text-left no-underline"
|
||||
onClick={() => requestSort('deposits')}
|
||||
>
|
||||
{t('deposits')}
|
||||
<span className="font-normal">{t('deposits')}</span>
|
||||
<ArrowSmDownIcon
|
||||
className={`default-transition ml-1 h-4 w-4 flex-shrink-0 ${
|
||||
sortConfig?.key === 'deposits'
|
||||
|
@ -240,10 +240,10 @@ const BalancesTable = ({
|
|||
</Th>
|
||||
<Th>
|
||||
<LinkButton
|
||||
className="flex items-center text-left font-normal no-underline"
|
||||
className="flex items-center text-left no-underline"
|
||||
onClick={() => requestSort('borrows')}
|
||||
>
|
||||
{t('borrows')}
|
||||
<span className="font-normal">{t('borrows')}</span>
|
||||
<ArrowSmDownIcon
|
||||
className={`default-transition ml-1 h-4 w-4 flex-shrink-0 ${
|
||||
sortConfig?.key === 'borrows'
|
||||
|
@ -257,10 +257,10 @@ const BalancesTable = ({
|
|||
</Th>
|
||||
<Th>
|
||||
<LinkButton
|
||||
className="flex items-center text-left font-normal no-underline"
|
||||
className="flex items-center text-left no-underline"
|
||||
onClick={() => requestSort('orders')}
|
||||
>
|
||||
{t('in-orders')}
|
||||
<span className="font-normal">{t('in-orders')}</span>
|
||||
<ArrowSmDownIcon
|
||||
className={`default-transition ml-1 h-4 w-4 flex-shrink-0 ${
|
||||
sortConfig?.key === 'orders'
|
||||
|
@ -274,10 +274,10 @@ const BalancesTable = ({
|
|||
</Th>
|
||||
<Th>
|
||||
<LinkButton
|
||||
className="flex items-center text-left font-normal no-underline"
|
||||
className="flex items-center text-left no-underline"
|
||||
onClick={() => requestSort('unsettled')}
|
||||
>
|
||||
{t('unsettled')}
|
||||
<span className="font-normal">{t('unsettled')}</span>
|
||||
<ArrowSmDownIcon
|
||||
className={`default-transition ml-1 h-4 w-4 flex-shrink-0 ${
|
||||
sortConfig?.key === 'unsettled'
|
||||
|
@ -291,10 +291,10 @@ const BalancesTable = ({
|
|||
</Th>
|
||||
<Th>
|
||||
<LinkButton
|
||||
className="flex items-center text-left font-normal no-underline"
|
||||
className="flex items-center text-left no-underline"
|
||||
onClick={() => requestSort('net')}
|
||||
>
|
||||
{t('net-balance')}
|
||||
<span className="font-normal">{t('net-balance')}</span>
|
||||
<ArrowSmDownIcon
|
||||
className={`default-transition ml-1 h-4 w-4 flex-shrink-0 ${
|
||||
sortConfig?.key === 'net'
|
||||
|
@ -308,10 +308,10 @@ const BalancesTable = ({
|
|||
</Th>
|
||||
<Th>
|
||||
<LinkButton
|
||||
className="flex items-center text-left font-normal no-underline"
|
||||
className="flex items-center text-left no-underline"
|
||||
onClick={() => requestSort('value')}
|
||||
>
|
||||
{t('value')}
|
||||
<span className="font-normal">{t('value')}</span>
|
||||
<ArrowSmDownIcon
|
||||
className={`default-transition ml-1 h-4 w-4 flex-shrink-0 ${
|
||||
sortConfig?.key === 'value'
|
||||
|
@ -325,10 +325,10 @@ const BalancesTable = ({
|
|||
</Th>
|
||||
<Th>
|
||||
<LinkButton
|
||||
className="flex items-center text-left font-normal no-underline"
|
||||
className="flex items-center text-left no-underline"
|
||||
onClick={() => requestSort('depositRate')}
|
||||
>
|
||||
{t('deposit-rate')}
|
||||
<span className="font-normal">{t('deposit-rate')}</span>
|
||||
<ArrowSmDownIcon
|
||||
className={`default-transition ml-1 h-4 w-4 flex-shrink-0 ${
|
||||
sortConfig?.key === 'depositRate'
|
||||
|
@ -342,10 +342,10 @@ const BalancesTable = ({
|
|||
</Th>
|
||||
<Th>
|
||||
<LinkButton
|
||||
className="flex items-center text-left font-normal no-underline"
|
||||
className="flex items-center text-left no-underline"
|
||||
onClick={() => requestSort('borrowRate')}
|
||||
>
|
||||
{t('borrow-rate')}
|
||||
<span className="font-normal">{t('borrow-rate')}</span>
|
||||
<ArrowSmDownIcon
|
||||
className={`default-transition ml-1 h-4 w-4 flex-shrink-0 ${
|
||||
sortConfig?.key === 'borrowRate'
|
||||
|
|
|
@ -49,7 +49,6 @@ const CloseAccountModal: FunctionComponent<CloseAccountModalProps> = ({
|
|||
const [totalAccountSOL, setTotalAccountSOL] = useState(0)
|
||||
const actions = useMangoStore((s) => s.actions)
|
||||
const connection = useMangoStore((s) => s.connection.current)
|
||||
const client = useMangoStore((s) => s.connection.client)
|
||||
const openOrders = useMangoStore((s) => s.selectedMangoAccount.openOrders)
|
||||
const setMangoStore = useMangoStore((s) => s.set)
|
||||
|
||||
|
@ -96,8 +95,10 @@ const CloseAccountModal: FunctionComponent<CloseAccountModalProps> = ({
|
|||
|
||||
const closeAccount = async () => {
|
||||
const wallet = useMangoStore.getState().wallet.current
|
||||
const mangoClient = useMangoStore.getState().connection.client
|
||||
|
||||
try {
|
||||
const txids = await client.emptyAndCloseMangoAccount(
|
||||
const txids = await mangoClient.emptyAndCloseMangoAccount(
|
||||
mangoGroup,
|
||||
mangoAccount,
|
||||
mangoCache,
|
||||
|
@ -172,7 +173,7 @@ const CloseAccountModal: FunctionComponent<CloseAccountModalProps> = ({
|
|||
{!mngoAccrued.isZero() ? (
|
||||
<div className="flex items-center text-th-fgd-2">
|
||||
<CheckCircleIcon className="mr-1.5 h-4 w-4 text-th-green" />
|
||||
{t('close-account:claim-x-mngo', {
|
||||
{t('close-account:claim-x-mngo-rewards', {
|
||||
amount: mangoGroup
|
||||
? nativeToUi(
|
||||
mngoAccrued.toNumber(),
|
||||
|
|
|
@ -33,11 +33,11 @@ const DelegateModal: FunctionComponent<DelegateModalProps> = ({
|
|||
const [invalidKeyMessage, setInvalidKeyMessage] = useState('')
|
||||
const mangoGroup = useMangoStore((s) => s.selectedMangoGroup.current)
|
||||
const mangoAccount = useMangoStore((s) => s.selectedMangoAccount.current)
|
||||
const mangoClient = useMangoStore((s) => s.connection.client)
|
||||
const actions = useMangoStore((s) => s.actions)
|
||||
|
||||
const setDelegate = async () => {
|
||||
const wallet = useMangoStore.getState().wallet.current
|
||||
const mangoClient = useMangoStore.getState().connection.client
|
||||
|
||||
try {
|
||||
const key = keyBase58.length
|
||||
|
|
|
@ -11,7 +11,6 @@ const DepositMsrmModal = ({ onClose, isOpen }) => {
|
|||
const { t } = useTranslation('common')
|
||||
const [submitting, setSubmitting] = useState(false)
|
||||
const actions = useMangoStore((s) => s.actions)
|
||||
const mangoClient = useMangoStore((s) => s.connection.client)
|
||||
const mangoAccount = useMangoStore((s) => s.selectedMangoAccount.current)
|
||||
const mangoGroup = useMangoStore((s) => s.selectedMangoGroup.current)
|
||||
const wallet = useMangoStore((s) => s.wallet.current)
|
||||
|
@ -20,6 +19,7 @@ const DepositMsrmModal = ({ onClose, isOpen }) => {
|
|||
|
||||
const handleMsrmDeposit = async () => {
|
||||
setSubmitting(true)
|
||||
const mangoClient = useMangoStore.getState().connection.client
|
||||
const ownerMsrmAccount = walletTokens.find((t) =>
|
||||
t.account.mint.equals(msrmMints[cluster])
|
||||
)
|
||||
|
|
|
@ -24,13 +24,13 @@ const MarketCloseModal: FunctionComponent<MarketCloseModalProps> = ({
|
|||
const { t } = useTranslation('common')
|
||||
const [submitting, setSubmitting] = useState(false)
|
||||
const actions = useMangoStore((s) => s.actions)
|
||||
const mangoClient = useMangoStore((s) => s.connection.client)
|
||||
const config = useMangoStore.getState().selectedMarket.config
|
||||
|
||||
async function handleMarketClose() {
|
||||
const mangoAccount = useMangoStore.getState().selectedMangoAccount.current
|
||||
const mangoGroup = useMangoStore.getState().selectedMangoGroup.current
|
||||
const marketConfig = useMangoStore.getState().selectedMarket.config
|
||||
const mangoClient = useMangoStore.getState().connection.client
|
||||
const askInfo =
|
||||
useMangoStore.getState().accountInfos[marketConfig.asksKey.toString()]
|
||||
const bidInfo =
|
||||
|
|
|
@ -3,7 +3,23 @@ import { useRouter } from 'next/router'
|
|||
import { initialMarket } from './SettingsModal'
|
||||
import { FavoriteMarketButton } from './TradeNavMenu'
|
||||
import useMangoStore from '../stores/useMangoStore'
|
||||
import { getWeights } from '@blockworks-foundation/mango-client'
|
||||
import {
|
||||
getWeights,
|
||||
getMarketIndexBySymbol,
|
||||
} from '@blockworks-foundation/mango-client'
|
||||
|
||||
const getMarketLeverage = (mangoGroup, mangoGroupConfig, market) => {
|
||||
if (!mangoGroup) return 1
|
||||
const marketIndex = getMarketIndexBySymbol(
|
||||
mangoGroupConfig,
|
||||
market.baseSymbol
|
||||
)
|
||||
const ws = getWeights(mangoGroup, marketIndex, 'Init')
|
||||
const w = market.name.includes('PERP')
|
||||
? ws.perpAssetWeight
|
||||
: ws.spotAssetWeight
|
||||
return Math.round((100 * -1) / (w.toNumber() - 1)) / 100
|
||||
}
|
||||
|
||||
interface MarketNavItemProps {
|
||||
market: any
|
||||
|
@ -19,6 +35,7 @@ const MarketNavItem: FunctionComponent<MarketNavItemProps> = ({
|
|||
const { asPath } = useRouter()
|
||||
const router = useRouter()
|
||||
const mangoGroup = useMangoStore((s) => s.selectedMangoGroup.current)
|
||||
const mangoGroupConfig = useMangoStore((s) => s.selectedMangoGroup.config)
|
||||
const marketInfo = useMangoStore((s) => s.marketInfo)
|
||||
|
||||
const mktInfo = marketInfo.find((info) => info.name === market.name)
|
||||
|
@ -31,15 +48,6 @@ const MarketNavItem: FunctionComponent<MarketNavItemProps> = ({
|
|||
}
|
||||
}
|
||||
|
||||
const getMarketLeverage = (market) => {
|
||||
if (!mangoGroup) return 1
|
||||
const ws = getWeights(mangoGroup, market.marketIndex, 'Init')
|
||||
const w = market.name.includes('PERP')
|
||||
? ws.perpAssetWeight
|
||||
: ws.spotAssetWeight
|
||||
return Math.round((100 * -1) / (w.toNumber() - 1)) / 100
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="text-th-fgd-3">
|
||||
<div className="flex items-center">
|
||||
|
@ -59,7 +67,7 @@ const MarketNavItem: FunctionComponent<MarketNavItemProps> = ({
|
|||
>
|
||||
<span className="ml-2">{market.name}</span>
|
||||
<span className="ml-1.5 text-xs text-th-fgd-4">
|
||||
{getMarketLeverage(market)}x
|
||||
{getMarketLeverage(mangoGroup, mangoGroupConfig, market)}x
|
||||
</span>
|
||||
</div>
|
||||
<div
|
||||
|
|
|
@ -87,7 +87,7 @@ const PositionsTable = () => {
|
|||
className="h-8 whitespace-nowrap pt-0 pb-0 pl-3 pr-3 text-xs"
|
||||
onClick={handleSettleAll}
|
||||
>
|
||||
{settling ? <Loading /> : 'Redeem All'}
|
||||
{settling ? <Loading /> : t('redeem-all')}
|
||||
</Button>
|
||||
</div>
|
||||
<div className="grid grid-flow-row grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3">
|
||||
|
|
|
@ -94,13 +94,13 @@ const TradeHistoryTable = ({ numTrades }: { numTrades?: number }) => {
|
|||
<TrHead>
|
||||
<Th>
|
||||
<LinkButton
|
||||
className="flex items-center font-normal no-underline"
|
||||
onClick={() => requestSort('market')}
|
||||
className="flex items-center no-underline"
|
||||
onClick={() => requestSort('marketName')}
|
||||
>
|
||||
{t('market')}
|
||||
<span className="font-normal">{t('market')}</span>
|
||||
<ArrowSmDownIcon
|
||||
className={`default-transition ml-1 h-4 w-4 flex-shrink-0 ${
|
||||
sortConfig?.key === 'market'
|
||||
sortConfig?.key === 'marketName'
|
||||
? sortConfig.direction === 'ascending'
|
||||
? 'rotate-180 transform'
|
||||
: 'rotate-360 transform'
|
||||
|
@ -111,10 +111,10 @@ const TradeHistoryTable = ({ numTrades }: { numTrades?: number }) => {
|
|||
</Th>
|
||||
<Th>
|
||||
<LinkButton
|
||||
className="flex items-center font-normal no-underline"
|
||||
className="flex items-center no-underline"
|
||||
onClick={() => requestSort('side')}
|
||||
>
|
||||
{t('side')}
|
||||
<span className="font-normal">{t('side')}</span>
|
||||
<ArrowSmDownIcon
|
||||
className={`default-transition ml-1 h-4 w-4 flex-shrink-0 ${
|
||||
sortConfig?.key === 'side'
|
||||
|
@ -128,10 +128,10 @@ const TradeHistoryTable = ({ numTrades }: { numTrades?: number }) => {
|
|||
</Th>
|
||||
<Th>
|
||||
<LinkButton
|
||||
className="flex items-center font-normal no-underline"
|
||||
className="flex items-center no-underline"
|
||||
onClick={() => requestSort('size')}
|
||||
>
|
||||
{t('size')}
|
||||
<span className="font-normal">{t('size')}</span>
|
||||
<ArrowSmDownIcon
|
||||
className={`default-transition ml-1 h-4 w-4 flex-shrink-0 ${
|
||||
sortConfig?.key === 'size'
|
||||
|
@ -145,10 +145,10 @@ const TradeHistoryTable = ({ numTrades }: { numTrades?: number }) => {
|
|||
</Th>
|
||||
<Th>
|
||||
<LinkButton
|
||||
className="flex items-center font-normal no-underline"
|
||||
className="flex items-center no-underline"
|
||||
onClick={() => requestSort('price')}
|
||||
>
|
||||
{t('price')}
|
||||
<span className="font-normal">{t('price')}</span>
|
||||
<ArrowSmDownIcon
|
||||
className={`default-transition ml-1 h-4 w-4 flex-shrink-0 ${
|
||||
sortConfig?.key === 'price'
|
||||
|
@ -162,10 +162,10 @@ const TradeHistoryTable = ({ numTrades }: { numTrades?: number }) => {
|
|||
</Th>
|
||||
<Th>
|
||||
<LinkButton
|
||||
className="flex items-center font-normal no-underline"
|
||||
className="flex items-center no-underline"
|
||||
onClick={() => requestSort('value')}
|
||||
>
|
||||
{t('value')}
|
||||
<span className="font-normal">{t('value')}</span>
|
||||
<ArrowSmDownIcon
|
||||
className={`default-transition ml-1 h-4 w-4 flex-shrink-0 ${
|
||||
sortConfig?.key === 'value'
|
||||
|
@ -179,10 +179,10 @@ const TradeHistoryTable = ({ numTrades }: { numTrades?: number }) => {
|
|||
</Th>
|
||||
<Th>
|
||||
<LinkButton
|
||||
className="flex items-center font-normal no-underline"
|
||||
className="flex items-center no-underline"
|
||||
onClick={() => requestSort('liquidity')}
|
||||
>
|
||||
{t('liquidity')}
|
||||
<span className="font-normal">{t('liquidity')}</span>
|
||||
<ArrowSmDownIcon
|
||||
className={`default-transition ml-1 h-4 w-4 flex-shrink-0 ${
|
||||
sortConfig?.key === 'liquidity'
|
||||
|
@ -196,10 +196,10 @@ const TradeHistoryTable = ({ numTrades }: { numTrades?: number }) => {
|
|||
</Th>
|
||||
<Th>
|
||||
<LinkButton
|
||||
className="flex items-center font-normal no-underline"
|
||||
className="flex items-center no-underline"
|
||||
onClick={() => requestSort('feeCost')}
|
||||
>
|
||||
{t('fee')}
|
||||
<span className="font-normal">{t('fee')}</span>
|
||||
<ArrowSmDownIcon
|
||||
className={`default-transition ml-1 h-4 w-4 flex-shrink-0 ${
|
||||
sortConfig?.key === 'feeCost'
|
||||
|
@ -213,10 +213,12 @@ const TradeHistoryTable = ({ numTrades }: { numTrades?: number }) => {
|
|||
</Th>
|
||||
<Th>
|
||||
<LinkButton
|
||||
className="flex items-center font-normal no-underline"
|
||||
className="flex items-center no-underline"
|
||||
onClick={() => requestSort('loadTimestamp')}
|
||||
>
|
||||
{t('approximate-time')}
|
||||
<span className="font-normal">
|
||||
{t('approximate-time')}
|
||||
</span>
|
||||
<ArrowSmDownIcon
|
||||
className={`default-transition ml-1 h-4 w-4 flex-shrink-0 ${
|
||||
sortConfig?.key === 'loadTimestamp'
|
||||
|
@ -228,11 +230,10 @@ const TradeHistoryTable = ({ numTrades }: { numTrades?: number }) => {
|
|||
/>
|
||||
</LinkButton>
|
||||
</Th>
|
||||
<Th> </Th>
|
||||
</TrHead>
|
||||
</thead>
|
||||
<tbody>
|
||||
{paginatedData.map((trade: any) => {
|
||||
{items.map((trade: any) => {
|
||||
return (
|
||||
<TrBody key={`${trade.seqNum}${trade.marketName}`}>
|
||||
<Td className="!py-2 ">
|
||||
|
|
|
@ -11,7 +11,6 @@ const WithdrawMsrmModal = ({ onClose, isOpen }) => {
|
|||
const { t } = useTranslation('common')
|
||||
const [submitting, setSubmitting] = useState(false)
|
||||
const actions = useMangoStore((s) => s.actions)
|
||||
const mangoClient = useMangoStore((s) => s.connection.client)
|
||||
const mangoAccount = useMangoStore((s) => s.selectedMangoAccount.current)
|
||||
const mangoGroup = useMangoStore((s) => s.selectedMangoGroup.current)
|
||||
const wallet = useMangoStore((s) => s.wallet.current)
|
||||
|
@ -20,6 +19,7 @@ const WithdrawMsrmModal = ({ onClose, isOpen }) => {
|
|||
|
||||
const handleMsrmWithdraw = async () => {
|
||||
setSubmitting(true)
|
||||
const mangoClient = useMangoStore.getState().connection.client
|
||||
const ownerMsrmAccount = walletTokens.find((t) =>
|
||||
t.account.mint.equals(msrmMints[cluster])
|
||||
)
|
||||
|
|
|
@ -204,7 +204,7 @@ export default function AccountHistory() {
|
|||
) : (
|
||||
<div className={`flex items-center`}>
|
||||
<SaveIcon className={`mr-1.5 h-4 w-4`} />
|
||||
Export PnL CSV
|
||||
{t('export-pnl-csv')}
|
||||
</div>
|
||||
)}
|
||||
</Button>
|
||||
|
@ -479,7 +479,7 @@ const LiquidationHistoryTable = ({ history, view }) => {
|
|||
</>
|
||||
) : (
|
||||
<div className="w-full rounded-md bg-th-bkg-1 py-6 text-center text-th-fgd-3">
|
||||
History empty
|
||||
{t('history-empty')}
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
|
|
|
@ -140,10 +140,10 @@ const PerformanceChart = ({
|
|||
return t('pnl')
|
||||
}
|
||||
if (!showSpotPnl) {
|
||||
return `${t('perp')} PnL`
|
||||
return `${t('perp')} ${t('pnl')}`
|
||||
}
|
||||
if (!showPerpPnl) {
|
||||
return `${t('spot')} PnL`
|
||||
return `${t('spot')} ${t('pnl')}`
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -247,7 +247,7 @@ const PerformanceChart = ({
|
|||
activeValue={chartToShow}
|
||||
className="pb-2 pt-2 text-sm"
|
||||
onChange={(v) => setChartToShow(v)}
|
||||
values={[t('value'), 'PnL']}
|
||||
values={[t('value'), t('pnl')]}
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -67,7 +67,6 @@ export default function AdvancedTradeForm({
|
|||
const marketConfig = useMangoStore((s) => s.selectedMarket.config)
|
||||
const walletTokens = useMangoStore((s) => s.wallet.tokens)
|
||||
const mangoAccount = useMangoStore((s) => s.selectedMangoAccount.current)
|
||||
const mangoClient = useMangoStore((s) => s.connection.client)
|
||||
const market = useMangoStore((s) => s.selectedMarket.current)
|
||||
const isPerpMarket = market instanceof PerpMarket
|
||||
const [reduceOnly, setReduceOnly] = useState(false)
|
||||
|
@ -568,6 +567,7 @@ export default function AdvancedTradeForm({
|
|||
return
|
||||
}
|
||||
|
||||
const mangoClient = useMangoStore.getState().connection.client
|
||||
const mangoAccount = useMangoStore.getState().selectedMangoAccount.current
|
||||
const mangoGroup = useMangoStore.getState().selectedMangoGroup.current
|
||||
const askInfo =
|
||||
|
|
|
@ -35,7 +35,6 @@ export default function SimpleTradeForm({ initLeverage }) {
|
|||
const walletTokens = useMangoStore((s) => s.wallet.tokens)
|
||||
const mangoAccount = useMangoStore((s) => s.selectedMangoAccount.current)
|
||||
const mangoGroup = useMangoStore((s) => s.selectedMangoGroup.current)
|
||||
const mangoClient = useMangoStore((s) => s.connection.client)
|
||||
const mangoCache = useMangoStore((s) => s.selectedMangoGroup.cache)
|
||||
const marketIndex = getMarketIndexBySymbol(
|
||||
groupConfig,
|
||||
|
@ -272,6 +271,7 @@ export default function SimpleTradeForm({ initLeverage }) {
|
|||
return
|
||||
}
|
||||
|
||||
const mangoClient = useMangoStore.getState().connection.client
|
||||
const mangoAccount = useMangoStore.getState().selectedMangoAccount.current
|
||||
const mangoGroup = useMangoStore.getState().selectedMangoGroup.current
|
||||
const askInfo =
|
||||
|
|
|
@ -242,6 +242,19 @@ const useHydrateStore = () => {
|
|||
actions.loadMarketFills()
|
||||
}, 20 * SECONDS)
|
||||
|
||||
useInterval(() => {
|
||||
const blockhashTimes = useMangoStore.getState().connection.blockhashTimes
|
||||
const blockhashTimesCopy = [...blockhashTimes]
|
||||
const mangoClient = useMangoStore.getState().connection.client
|
||||
|
||||
mangoClient.updateRecentBlockhash(blockhashTimesCopy).then(() => {
|
||||
setMangoStore((state) => {
|
||||
state.connection.client = mangoClient
|
||||
state.connection.blockhashTimes = blockhashTimesCopy
|
||||
})
|
||||
})
|
||||
}, 10 * SECONDS)
|
||||
|
||||
useEffect(() => {
|
||||
actions.loadMarketFills()
|
||||
}, [selectedMarket])
|
||||
|
|
|
@ -8,6 +8,7 @@ import {
|
|||
tradeHistorySelector,
|
||||
} from '../stores/selectors'
|
||||
import useMangoStore from '../stores/useMangoStore'
|
||||
import { getDecimalCount } from '../utils'
|
||||
|
||||
const byTimestamp = (a, b) => {
|
||||
return (
|
||||
|
@ -35,12 +36,23 @@ const parsedPerpEvent = (mangoAccountPk: PublicKey, event) => {
|
|||
const value = event.quantity * event.price
|
||||
const feeRate = maker ? event.makerFee : event.takerFee
|
||||
const side = maker ? reverseSide(event.takerSide) : event.takerSide
|
||||
const allMarkets = useMangoStore.getState().selectedMangoGroup.markets
|
||||
const market = allMarkets[event.address]
|
||||
|
||||
let size = event.quantity
|
||||
if (market) {
|
||||
const sizeDecimalCount = getDecimalCount(market.minOrderSize)
|
||||
const roundedSize = (
|
||||
Math.floor(event.quantity / market.minOrderSize) * market.minOrderSize
|
||||
).toFixed(sizeDecimalCount)
|
||||
size = roundedSize
|
||||
}
|
||||
|
||||
return {
|
||||
...event,
|
||||
key: orderId?.toString(),
|
||||
liquidity: maker ? 'Maker' : 'Taker',
|
||||
size: event.quantity,
|
||||
size: size,
|
||||
price: event.price,
|
||||
value,
|
||||
feeCost: (feeRate * value).toFixed(4),
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"@blockworks-foundation/mango-client": "^3.3.18",
|
||||
"@blockworks-foundation/mango-client": "^3.3.20",
|
||||
"@headlessui/react": "^1.2.0",
|
||||
"@heroicons/react": "^1.0.0",
|
||||
"@jup-ag/react-hook": "^1.0.0-beta.16",
|
||||
|
|
|
@ -19,11 +19,7 @@ import { useOpenOrders } from '../hooks/useOpenOrders'
|
|||
import usePerpPositions from '../hooks/usePerpPositions'
|
||||
import { useEffect } from 'react'
|
||||
import { PublicKey } from '@solana/web3.js'
|
||||
import {
|
||||
connectionSelector,
|
||||
mangoClientSelector,
|
||||
mangoGroupSelector,
|
||||
} from '../stores/selectors'
|
||||
import { connectionSelector, mangoGroupSelector } from '../stores/selectors'
|
||||
import {
|
||||
ReferrerIdRecordLayout,
|
||||
ReferrerIdRecord,
|
||||
|
@ -47,7 +43,6 @@ const PerpPositionsStoreUpdater = () => {
|
|||
|
||||
const FetchReferrer = () => {
|
||||
const setMangoStore = useMangoStore((s) => s.set)
|
||||
const mangoClient = useMangoStore(mangoClientSelector)
|
||||
const mangoGroup = useMangoStore(mangoGroupSelector)
|
||||
const connection = useMangoStore(connectionSelector)
|
||||
const router = useRouter()
|
||||
|
@ -66,6 +61,8 @@ const FetchReferrer = () => {
|
|||
} catch (e) {
|
||||
console.log('Failed to decode referrer link', e)
|
||||
}
|
||||
|
||||
const mangoClient = useMangoStore.getState().connection.client
|
||||
const { referrerPda } = await mangoClient.getReferrerPda(
|
||||
mangoGroup,
|
||||
decodedRefLink
|
||||
|
|
|
@ -78,7 +78,6 @@ export default function Account() {
|
|||
const { connected } = useWallet()
|
||||
const isLoading = useMangoStore((s) => s.selectedMangoAccount.initialLoad)
|
||||
const mangoAccount = useMangoStore(mangoAccountSelector)
|
||||
const mangoClient = useMangoStore((s) => s.connection.client)
|
||||
const mangoGroup = useMangoStore(mangoGroupSelector)
|
||||
const wallet = useMangoStore((s) => s.wallet.current)
|
||||
const actions = useMangoStore(actionsSelector)
|
||||
|
@ -125,6 +124,7 @@ export default function Account() {
|
|||
async function loadUnownedMangoAccount() {
|
||||
try {
|
||||
const unownedMangoAccountPubkey = new PublicKey(pubkey)
|
||||
const mangoClient = useMangoStore.getState().connection.client
|
||||
if (mangoGroup) {
|
||||
const unOwnedMangoAccount = await mangoClient.getMangoAccount(
|
||||
unownedMangoAccountPubkey,
|
||||
|
@ -198,6 +198,7 @@ export default function Account() {
|
|||
|
||||
const handleRedeemMngo = async () => {
|
||||
const wallet = useMangoStore.getState().wallet.current
|
||||
const mangoClient = useMangoStore.getState().connection.client
|
||||
const mngoNodeBank =
|
||||
mangoGroup.rootBankAccounts[MNGO_INDEX].nodeBankAccounts[0]
|
||||
|
||||
|
@ -281,13 +282,15 @@ export default function Account() {
|
|||
<div className="flex items-center whitespace-nowrap">
|
||||
<GiftIcon className="mr-1.5 h-4 w-4 flex-shrink-0" />
|
||||
{!mngoAccrued.eq(ZERO_BN)
|
||||
? `Claim ${nativeToUi(
|
||||
mngoAccrued.toNumber(),
|
||||
mangoGroup.tokens[MNGO_INDEX].decimals
|
||||
).toLocaleString(undefined, {
|
||||
minimumSignificantDigits: 1,
|
||||
})} MNGO`
|
||||
: '0 MNGO Rewards'}
|
||||
? t('claim-x-mngo', {
|
||||
amount: nativeToUi(
|
||||
mngoAccrued.toNumber(),
|
||||
mangoGroup.tokens[MNGO_INDEX].decimals
|
||||
).toLocaleString(undefined, {
|
||||
minimumSignificantDigits: 1,
|
||||
}),
|
||||
})
|
||||
: t('zero-mngo-rewards')}
|
||||
</div>
|
||||
</button>
|
||||
<Menu>
|
||||
|
@ -297,7 +300,7 @@ export default function Account() {
|
|||
id="profile-menu-tip"
|
||||
>
|
||||
<Menu.Button className="flex h-8 w-full items-center justify-center rounded-full bg-th-bkg-button pt-0 pb-0 pl-3 pr-2 text-xs font-bold hover:brightness-[1.1] hover:filter sm:w-auto">
|
||||
More
|
||||
{t('more')}
|
||||
<ChevronDownIcon
|
||||
className={`default-transition h-5 w-5 ${
|
||||
open
|
||||
|
@ -349,7 +352,7 @@ export default function Account() {
|
|||
>
|
||||
<div className="flex items-center">
|
||||
<SwitchHorizontalIcon className="mr-1.5 h-4 w-4" />
|
||||
{t('switch-account')}
|
||||
{t('change-account')}
|
||||
</div>
|
||||
</button>
|
||||
</Menu.Item>
|
||||
|
|
|
@ -44,7 +44,6 @@ const PerpMarket = () => {
|
|||
const setMangoStore = useMangoStore((s) => s.set)
|
||||
const connected = useMangoStore(walletConnectedSelector)
|
||||
const mangoAccount = useMangoStore(mangoAccountSelector)
|
||||
const mangoClient = useMangoStore((s) => s.connection.client)
|
||||
const mangoGroup = useMangoStore((s) => s.selectedMangoGroup.current)
|
||||
const marketConfig = useMangoStore(marketConfigSelector)
|
||||
const actions = useMangoStore(actionsSelector)
|
||||
|
@ -57,6 +56,7 @@ const PerpMarket = () => {
|
|||
async function loadUnownedMangoAccount() {
|
||||
try {
|
||||
const unownedMangoAccountPubkey = new PublicKey(pubkey)
|
||||
const mangoClient = useMangoStore.getState().connection.client
|
||||
if (mangoGroup) {
|
||||
const unOwnedMangoAccount = await mangoClient.getMangoAccount(
|
||||
unownedMangoAccountPubkey,
|
||||
|
@ -81,7 +81,7 @@ const PerpMarket = () => {
|
|||
if (pubkey) {
|
||||
loadUnownedMangoAccount()
|
||||
}
|
||||
}, [pubkey, mangoClient, mangoGroup])
|
||||
}, [pubkey, mangoGroup])
|
||||
|
||||
useEffect(() => {
|
||||
const name = decodeURIComponent(router.asPath).split('name=')[1]
|
||||
|
|
|
@ -5,7 +5,6 @@ import { serverSideTranslations } from 'next-i18next/serverSideTranslations'
|
|||
import useMangoStore from '../stores/useMangoStore'
|
||||
import {
|
||||
mangoCacheSelector,
|
||||
mangoClientSelector,
|
||||
mangoGroupConfigSelector,
|
||||
mangoGroupSelector,
|
||||
walletSelector,
|
||||
|
@ -91,7 +90,6 @@ export default function Referral() {
|
|||
const mangoCache = useMangoStore(mangoCacheSelector)
|
||||
const { mangoAccount } = useMangoAccount()
|
||||
const groupConfig = useMangoStore(mangoGroupConfigSelector)
|
||||
const client = useMangoStore(mangoClientSelector)
|
||||
const wallet = useMangoStore(walletSelector)
|
||||
const connected = useMangoStore((s) => s.wallet.connected)
|
||||
|
||||
|
@ -111,7 +109,10 @@ export default function Referral() {
|
|||
|
||||
const fetchCustomReferralLinks = useCallback(async () => {
|
||||
setLoading(true)
|
||||
const referrerIds = await client.getReferrerIdsForMangoAccount(mangoAccount)
|
||||
const mangoClient = useMangoStore.getState().connection.client
|
||||
const referrerIds = await mangoClient.getReferrerIdsForMangoAccount(
|
||||
mangoAccount
|
||||
)
|
||||
|
||||
setexistingCustomRefLinks(referrerIds)
|
||||
setLoading(false)
|
||||
|
@ -165,7 +166,8 @@ export default function Referral() {
|
|||
|
||||
if (!inputError) {
|
||||
try {
|
||||
const txid = await client.registerReferrerId(
|
||||
const mangoClient = useMangoStore.getState().connection.client
|
||||
const txid = await mangoClient.registerReferrerId(
|
||||
mangoGroup,
|
||||
mangoAccount,
|
||||
wallet,
|
||||
|
|
|
@ -96,7 +96,6 @@ export default function RiskCalculator() {
|
|||
// Get mango account data
|
||||
const mangoGroup = useMangoStore((s) => s.selectedMangoGroup.current)
|
||||
const mangoCache = useMangoStore((s) => s.selectedMangoGroup.cache)
|
||||
const mangoClient = useMangoStore((s) => s.connection.client)
|
||||
const mangoConfig = useMangoStore((s) => s.selectedMangoGroup.config)
|
||||
const mangoAccount = useMangoStore((s) => s.selectedMangoAccount.current)
|
||||
const connected = useMangoStore((s) => s.wallet.connected)
|
||||
|
@ -128,6 +127,7 @@ export default function RiskCalculator() {
|
|||
async function loadUnownedMangoAccount() {
|
||||
try {
|
||||
const unownedMangoAccountPubkey = new PublicKey(pubkey)
|
||||
const mangoClient = useMangoStore.getState().connection.client
|
||||
if (mangoGroup) {
|
||||
const unOwnedMangoAccount = await mangoClient.getMangoAccount(
|
||||
unownedMangoAccountPubkey,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"are-you-sure": "Are you sure?",
|
||||
"before-you-continue": "Before you can continue",
|
||||
"claim-x-mngo": "Claim {{amount}} MNGO rewards",
|
||||
"claim-x-mngo-rewards": "Claim {{amount}} MNGO rewards",
|
||||
"close-account": "Close Account",
|
||||
"close-all-borrows": "Close all borrows",
|
||||
"close-open-orders": "Close all open orders",
|
||||
|
|
|
@ -61,6 +61,7 @@
|
|||
"chinese-traditional": "繁體中文",
|
||||
"claim": "Claim",
|
||||
"claim-reward": "Claim Reward",
|
||||
"claim-x-mngo": "Claim {{amount}} MNGO",
|
||||
"close": "Close",
|
||||
"close-and-long": "Close position and open long",
|
||||
"close-and-short": "Close position and open short",
|
||||
|
@ -133,6 +134,7 @@
|
|||
"export-data": "Export CSV",
|
||||
"export-data-empty": "No data to export",
|
||||
"export-data-success": "CSV exported successfully",
|
||||
"export-pnl-csv": "Export PnL CSV",
|
||||
"favorite": "Favorite",
|
||||
"favorites": "Favorites",
|
||||
"fee": "Fee",
|
||||
|
@ -293,6 +295,7 @@
|
|||
"read-more": "Read More",
|
||||
"recent": "Recent",
|
||||
"recent-trades": "Recent Trades",
|
||||
"redeem-all": "Redeem All",
|
||||
"redeem-failure": "Error redeeming MNGO",
|
||||
"redeem-pnl": "Redeem",
|
||||
"redeem-success": "Successfully redeemed MNGO",
|
||||
|
@ -304,8 +307,8 @@
|
|||
"repay-full": "100% repay borrow",
|
||||
"repay-partial": "Repay {{percentage}}% of borrow",
|
||||
"reposition": "Drag to reposition",
|
||||
"rolling-change" : "24hr Change",
|
||||
"reset": "Reset",
|
||||
"rolling-change": "24hr Change",
|
||||
"rpc-endpoint": "RPC Endpoint",
|
||||
"save": "Save",
|
||||
"save-name": "Save Name",
|
||||
|
@ -342,7 +345,6 @@
|
|||
"summary": "Summary",
|
||||
"supported-assets": "Please fund wallet with one of the supported assets.",
|
||||
"swap": "Swap",
|
||||
"switch-account": "Switch Account",
|
||||
"take-profit": "Take Profit",
|
||||
"take-profit-limit": "Take Profit Limit",
|
||||
"taker": "Taker",
|
||||
|
@ -423,5 +425,6 @@
|
|||
"you-must-leave-enough-sol": "You must leave enough SOL in your wallet to pay for the transaction",
|
||||
"your-account": "Your Account",
|
||||
"your-assets": "Your Assets",
|
||||
"your-borrows": "Your Borrows"
|
||||
}
|
||||
"your-borrows": "Your Borrows",
|
||||
"zero-mngo-rewards": "0 MNGO Rewards"
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"are-you-sure": "Are you sure?",
|
||||
"before-you-continue": "Before you can continue",
|
||||
"claim-x-mngo": "Claim {{amount}} MNGO rewards",
|
||||
"claim-x-mngo-rewards": "Claim {{amount}} MNGO rewards",
|
||||
"close-account": "Close Account",
|
||||
"close-all-borrows": "Close all borrows",
|
||||
"close-open-orders": "Close all open orders",
|
||||
|
|
|
@ -60,6 +60,7 @@
|
|||
"chinese-traditional": "繁體中文",
|
||||
"claim": "Reclamar",
|
||||
"claim-reward": "Reclamar recompensa",
|
||||
"claim-x-mngo": "Claim {{amount}} MNGO",
|
||||
"close": "Cerrar",
|
||||
"close-and-long": "Posición cerrada + Empezar a comprar",
|
||||
"close-and-short": "Posición cerrada + Empezar a vender",
|
||||
|
@ -99,6 +100,7 @@
|
|||
"default-market": "Mercado predeterminado",
|
||||
"default-spot-margin": "Comercia con margen por defecto",
|
||||
"delay-displaying-recent": "Puede haber un retraso en la visualización de la última actividad.",
|
||||
"delayed-info": "Data updates hourly",
|
||||
"deposit": "Depositar",
|
||||
"deposit-before": "Necesita más {{tokenSymbol}} en su billetera para pagar completamente su préstamo",
|
||||
"deposit-failed": "El depósito falló",
|
||||
|
@ -131,6 +133,7 @@
|
|||
"export-data": "Exportar a CSV",
|
||||
"export-data-empty": "No hay datos para exportar",
|
||||
"export-data-success": "CSV exportado con éxito",
|
||||
"export-pnl-csv": "Export PnL CSV",
|
||||
"favorite": "Favorito",
|
||||
"favorites": "Favoritos",
|
||||
"fee": "Tarifa",
|
||||
|
@ -266,6 +269,7 @@
|
|||
"perp-positions-tip-title": "Detalles de la posición de perp",
|
||||
"perpetual-futures": "Futuros perpetuos",
|
||||
"perps": "perpetuos",
|
||||
"pnl": "PnL",
|
||||
"pnl-error": "Solución de errores PNL",
|
||||
"pnl-help": "La liquidación actualizará su saldo en USDC para reflejar el monto de PnL pendiente.",
|
||||
"pnl-success": "PNL resuelto con éxito",
|
||||
|
@ -288,6 +292,7 @@
|
|||
"read-more": "Leer más",
|
||||
"recent": "Reciente",
|
||||
"recent-trades": "Operaciones recientes",
|
||||
"redeem-all": "Redeem All",
|
||||
"redeem-failure": "Error al canjear MNGO",
|
||||
"redeem-pnl": "Resolver",
|
||||
"redeem-success": "MNGO canjeado con éxito",
|
||||
|
@ -333,9 +338,9 @@
|
|||
"stop-loss": "Detener pérdida",
|
||||
"stop-price": "Precio de parada",
|
||||
"successfully-placed": "Comercio colocado con éxito",
|
||||
"summary": "Summary",
|
||||
"supported-assets": "Financie la billetera con uno de los activos admitidos.",
|
||||
"swap": "Intercambio",
|
||||
"switch-account": "Switch Account",
|
||||
"take-profit": "Tomar ganancias",
|
||||
"take-profit-limit": "Tomar el límite de ganancias",
|
||||
"taker": "Receptor",
|
||||
|
@ -344,6 +349,7 @@
|
|||
"themes-tip-desc": "Mango, Oscuro o Claro (si te gusta eso).",
|
||||
"themes-tip-title": "Temas de color",
|
||||
"time": "Tiempo",
|
||||
"timeframe-desc": "Last {{timeframe}}",
|
||||
"token": "Simbólico",
|
||||
"too-large": "Tamaño demasiado grande",
|
||||
"tooltip-account-liquidated": "La cuenta se liquidará si la relación de salud alcanza el 0% y continuará hasta que la salud inicial sea superior a 0.",
|
||||
|
@ -415,5 +421,6 @@
|
|||
"you-must-leave-enough-sol": "You must leave enough SOL in your wallet to pay for the transaction",
|
||||
"your-account": "Su cuenta",
|
||||
"your-assets": "Sus activos",
|
||||
"your-borrows": "Sus préstamos"
|
||||
}
|
||||
"your-borrows": "Sus préstamos",
|
||||
"zero-mngo-rewards": "0 MNGO Rewards"
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"are-you-sure": "您确定吗?",
|
||||
"before-you-continue": "进行之前",
|
||||
"claim-x-mngo": "收获{{amount}}MNGO奖励",
|
||||
"claim-x-mngo-rewards": "收获{{amount}}MNGO奖励",
|
||||
"close-account": "关闭帐户",
|
||||
"close-all-borrows": "归还所有借贷",
|
||||
"close-open-orders": "取消所有挂单",
|
||||
|
|
|
@ -60,6 +60,7 @@
|
|||
"chinese-traditional": "繁體中文",
|
||||
"claim": "收获",
|
||||
"claim-reward": "收获奖励",
|
||||
"claim-x-mngo": "收获{{amount}}MNGO",
|
||||
"close": "关",
|
||||
"close-and-long": "平仓和做多",
|
||||
"close-and-short": "平仓和做空",
|
||||
|
@ -99,6 +100,7 @@
|
|||
"default-market": "预设市场",
|
||||
"default-spot-margin": "预设开启杠杆交易",
|
||||
"delay-displaying-recent": "显示最近状态也许有所延误。",
|
||||
"delayed-info": "资料每小时更新",
|
||||
"deposit": "存款",
|
||||
"deposit-before": "归还全借贷前您得先多存入{{tokenSymbol}}",
|
||||
"deposit-failed": "存款失败",
|
||||
|
@ -131,13 +133,14 @@
|
|||
"export-data": "导出CSV",
|
||||
"export-data-empty": "无资料可导出",
|
||||
"export-data-success": "CSV导出成功",
|
||||
"export-pnl-csv": "导出盈亏CSV",
|
||||
"favorite": "喜爱",
|
||||
"favorites": "喜爱",
|
||||
"fee": "费率",
|
||||
"fee-discount": "费率折扣",
|
||||
"first-deposit-desc": "创建Mango帐户最少需要0.035 SOL。",
|
||||
"funding": "资金费",
|
||||
"funding-chart-title": "资金费",
|
||||
"funding-chart-title": "资金费 – 前30天(图表有点延迟)",
|
||||
"get-started": "开始",
|
||||
"health": "健康度",
|
||||
"health-check": "帐户健康检查",
|
||||
|
@ -159,8 +162,8 @@
|
|||
"insufficient-balance-withdraw": "帐户余额不够。您得以借贷而前往",
|
||||
"insufficient-sol": "创建Mango帐户最少需要0.035 SOL。",
|
||||
"interest": "利息",
|
||||
"interest-chart-title": "{{symbol}} 利息",
|
||||
"interest-chart-value-title": "{{symbol}} 利息价值",
|
||||
"interest-chart-title": "{{symbol}}利息 – 前30天 (图表有点延迟)",
|
||||
"interest-chart-value-title": "{{symbol}} 利息价值 – 前30天 (图表有点延迟)",
|
||||
"interest-earned": "存借利息",
|
||||
"interest-info": "您的存款会持续赚取利息。",
|
||||
"intro-feature-1": "交叉质押的杠杆交易",
|
||||
|
@ -266,6 +269,7 @@
|
|||
"perp-positions-tip-title": "永续合约当前持仓细节",
|
||||
"perpetual-futures": "永续合约",
|
||||
"perps": "永续合约",
|
||||
"pnl": "盈亏",
|
||||
"pnl-error": "结清盈亏出错了",
|
||||
"pnl-help": "结清会更新USDC余额来处理尚未结清的盈亏量。",
|
||||
"pnl-success": "已结清盈亏",
|
||||
|
@ -288,6 +292,7 @@
|
|||
"read-more": "看更多资料",
|
||||
"recent": "最近",
|
||||
"recent-trades": "最近成交",
|
||||
"redeem-all": "现实所有盈亏",
|
||||
"redeem-failure": "收获MNGO奖励出错了",
|
||||
"redeem-pnl": "结清",
|
||||
"redeem-success": "已收获MNGO奖励了",
|
||||
|
@ -325,17 +330,17 @@
|
|||
"size": "数量",
|
||||
"slippage-warning": "此订单也许会遭受大量滑点!使用限价止损或限价止盈可能比较适合。",
|
||||
"spanish": "Español",
|
||||
"spot-desc": "现货市场以USDC报价",
|
||||
"spot": "现货",
|
||||
"spot-desc": "现货市场以USDC报价",
|
||||
"spread": "点差",
|
||||
"stats": "统计",
|
||||
"stop-limit": "限价止损",
|
||||
"stop-loss": "市场止损",
|
||||
"stop-price": "止损价格",
|
||||
"successfully-placed": "已下单了",
|
||||
"summary": "摘要",
|
||||
"supported-assets": "请给钱包存入已被支持的币种。",
|
||||
"swap": "换币",
|
||||
"switch-account": "Switch Account",
|
||||
"take-profit": "止盈",
|
||||
"take-profit-limit": "限价止盈",
|
||||
"taker": "吃单者",
|
||||
|
@ -344,6 +349,7 @@
|
|||
"themes-tip-desc": "Mango,黑暗或明亮(看您偏向)。",
|
||||
"themes-tip-title": "颜色模式",
|
||||
"time": "时间",
|
||||
"timeframe-desc": "前{{timeframe}}",
|
||||
"token": "币种",
|
||||
"too-large": "数量太大",
|
||||
"tooltip-account-liquidated": "若帐户健康度降到0%您的帐户会被清算直到初始健康度达到0以上了。",
|
||||
|
@ -415,5 +421,6 @@
|
|||
"you-must-leave-enough-sol": "您必须在钱包中保留足够的 SOL 来支付交易费用",
|
||||
"your-account": "您的帐户",
|
||||
"your-assets": "您的资产",
|
||||
"your-borrows": "您的借入"
|
||||
"your-borrows": "您的借入",
|
||||
"zero-mngo-rewards": "0 MNGO奖励"
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"are-you-sure": "您確定嗎?",
|
||||
"before-you-continue": "進行之前",
|
||||
"claim-x-mngo": "收穫{{amount}}MNGO獎勵",
|
||||
"claim-x-mngo-rewards": "收穫{{amount}}MNGO獎勵",
|
||||
"close-account": "關閉帳戶",
|
||||
"close-all-borrows": "歸還所有借貸",
|
||||
"close-open-orders": "取消所有掛單",
|
||||
|
|
|
@ -60,6 +60,7 @@
|
|||
"chinese-traditional": "繁體中文",
|
||||
"claim": "收穫",
|
||||
"claim-reward": "收穫獎勵",
|
||||
"claim-x-mngo": "收穫{{amount}}MNGO",
|
||||
"close": "關",
|
||||
"close-and-long": "平倉和做多",
|
||||
"close-and-short": "平倉和做空",
|
||||
|
@ -99,6 +100,7 @@
|
|||
"default-market": "預設市場",
|
||||
"default-spot-margin": "預設開啟槓桿交易",
|
||||
"delay-displaying-recent": "顯示最近狀態也許有所延誤。",
|
||||
"delayed-info": "資料每小時更新",
|
||||
"deposit": "存款",
|
||||
"deposit-before": "歸還全借貸前您得先多存入{{tokenSymbol}}",
|
||||
"deposit-failed": "存款失敗",
|
||||
|
@ -131,13 +133,14 @@
|
|||
"export-data": "導出CSV",
|
||||
"export-data-empty": "無資料可導出",
|
||||
"export-data-success": "CSV導出成功",
|
||||
"export-pnl-csv": "導出盈虧CSV",
|
||||
"favorite": "喜愛",
|
||||
"favorites": "喜愛",
|
||||
"fee": "費率",
|
||||
"fee-discount": "費率折扣",
|
||||
"first-deposit-desc": "創建Mango帳戶最少需要0.035 SOL。",
|
||||
"funding": "資金費",
|
||||
"funding-chart-title": "資金費",
|
||||
"funding-chart-title": "資金費 – 前30天(圖表有點延遲)",
|
||||
"get-started": "開始",
|
||||
"health": "健康度",
|
||||
"health-check": "帳戶健康檢查",
|
||||
|
@ -159,8 +162,8 @@
|
|||
"insufficient-balance-withdraw": "帳戶餘額不夠。您得以借貸而前往",
|
||||
"insufficient-sol": "創建Mango帳戶最少需要0.035 SOL。",
|
||||
"interest": "利息",
|
||||
"interest-chart-title": "{{symbol}} 利息",
|
||||
"interest-chart-value-title": "{{symbol}} 利息價值",
|
||||
"interest-chart-title": "{{symbol}}利息 – 前30天 (圖表有點延遲)",
|
||||
"interest-chart-value-title": "{{symbol}} 利息價值 – 前30天 (圖表有點延遲)",
|
||||
"interest-earned": "存借利息",
|
||||
"interest-info": "您的存款會持續賺取利息。",
|
||||
"intro-feature-1": "交叉質押的槓桿交易",
|
||||
|
@ -266,6 +269,7 @@
|
|||
"perp-positions-tip-title": "永續合約當前持倉細節",
|
||||
"perpetual-futures": "永續合約",
|
||||
"perps": "永續合約",
|
||||
"pnl": "盈虧",
|
||||
"pnl-error": "實現盈虧出錯了",
|
||||
"pnl-help": "實現會更新USDC餘額來處理尚未實現的盈虧。",
|
||||
"pnl-success": "實現盈虧成功",
|
||||
|
@ -288,6 +292,7 @@
|
|||
"read-more": "看更多資料",
|
||||
"recent": "最近",
|
||||
"recent-trades": "最近成交",
|
||||
"redeem-all": "現實所有盈虧",
|
||||
"redeem-failure": "收穫MNGO獎勵出錯了",
|
||||
"redeem-pnl": "實現盈虧",
|
||||
"redeem-success": "已收穫MNGO獎勵了",
|
||||
|
@ -325,17 +330,17 @@
|
|||
"size": "數量",
|
||||
"slippage-warning": "此訂單也許會遭受大量滑點!使用限價止損或限價止盈可能比較適合。",
|
||||
"spanish": "Español",
|
||||
"spot-desc": "現貨市場以USDC報價",
|
||||
"spot": "現貨",
|
||||
"spot-desc": "現貨市場以USDC報價",
|
||||
"spread": "點差",
|
||||
"stats": "統計",
|
||||
"stop-limit": "限價止損",
|
||||
"stop-loss": "市場止損",
|
||||
"stop-price": "止損價格",
|
||||
"successfully-placed": "已下單了",
|
||||
"summary": "摘要",
|
||||
"supported-assets": "請給錢包存入已被支持的幣種。",
|
||||
"swap": "換幣",
|
||||
"switch-account": "Switch Account",
|
||||
"take-profit": "止盈",
|
||||
"take-profit-limit": "限價止盈",
|
||||
"taker": "吃單者",
|
||||
|
@ -344,6 +349,7 @@
|
|||
"themes-tip-desc": "Mango,黑暗或明亮(看您偏向)。",
|
||||
"themes-tip-title": "顏色模式",
|
||||
"time": "時間",
|
||||
"timeframe-desc": "前{{timeframe}}",
|
||||
"token": "幣種",
|
||||
"too-large": "數量太大",
|
||||
"tooltip-account-liquidated": "若帳戶健康度降到0%您的帳戶會被清算直到初始健康度達到0以上了。",
|
||||
|
@ -415,5 +421,6 @@
|
|||
"you-must-leave-enough-sol": "您必須在錢包中保留足夠的 SOL 來支付交易費用",
|
||||
"your-account": "您的帳戶",
|
||||
"your-assets": "您的資產",
|
||||
"your-borrows": "您的借入"
|
||||
"your-borrows": "您的借入",
|
||||
"zero-mngo-rewards": "0 MNGO獎勵"
|
||||
}
|
|
@ -16,9 +16,6 @@ export const mangoGroupConfigSelector = (state: MangoStore) =>
|
|||
export const mangoCacheSelector = (state: MangoStore) =>
|
||||
state.selectedMangoGroup.cache
|
||||
|
||||
export const mangoClientSelector = (state: MangoStore) =>
|
||||
state.connection.client
|
||||
|
||||
export const actionsSelector = (state: MangoStore) => state.actions
|
||||
|
||||
export const marketsSelector = (state: MangoStore) =>
|
||||
|
|
|
@ -3,6 +3,7 @@ import produce from 'immer'
|
|||
import { Market } from '@project-serum/serum'
|
||||
import {
|
||||
IDS,
|
||||
BlockhashTimes,
|
||||
Config,
|
||||
MangoClient,
|
||||
MangoGroup,
|
||||
|
@ -142,6 +143,7 @@ export interface MangoStore extends State {
|
|||
endpoint: string
|
||||
client: MangoClient
|
||||
slot: number
|
||||
blockhashTimes: BlockhashTimes[]
|
||||
}
|
||||
selectedMarket: {
|
||||
config: MarketConfig
|
||||
|
@ -254,6 +256,7 @@ const useMangoStore = create<MangoStore>((set, get) => {
|
|||
}),
|
||||
endpoint: ENDPOINT.url,
|
||||
slot: 0,
|
||||
blockhashTimes: [],
|
||||
},
|
||||
selectedMangoGroup: {
|
||||
config: DEFAULT_MANGO_GROUP_CONFIG,
|
||||
|
@ -624,8 +627,6 @@ const useMangoStore = create<MangoStore>((set, get) => {
|
|||
})
|
||||
)
|
||||
.then((serumTradeHistory) => {
|
||||
console.log('serum Trade History', serumTradeHistory)
|
||||
|
||||
set((state) => {
|
||||
state.tradeHistory.spot = serumTradeHistory
|
||||
})
|
||||
|
@ -651,7 +652,6 @@ const useMangoStore = create<MangoStore>((set, get) => {
|
|||
state.selectedMangoAccount.lastUpdatedAt = new Date().toISOString()
|
||||
state.selectedMangoAccount.lastSlot = lastSlot
|
||||
})
|
||||
console.log('reloaded mango account')
|
||||
}
|
||||
},
|
||||
async reloadOrders() {
|
||||
|
|
|
@ -1020,10 +1020,10 @@
|
|||
resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
|
||||
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==
|
||||
|
||||
"@blockworks-foundation/mango-client@^3.3.18":
|
||||
version "3.3.19"
|
||||
resolved "https://registry.yarnpkg.com/@blockworks-foundation/mango-client/-/mango-client-3.3.19.tgz#6c06eaa04ac848384fda4abb6b1219f9022970ce"
|
||||
integrity sha512-Us/8wYfDjvPwAUvO63Q8vHE+shTqd0BfZRzdHiWGkWh0Pwyj/Z2Kv9usNL0QN8Jk2bME+jkzqefCZSWCPKv8gQ==
|
||||
"@blockworks-foundation/mango-client@^3.3.20":
|
||||
version "3.3.20"
|
||||
resolved "https://registry.yarnpkg.com/@blockworks-foundation/mango-client/-/mango-client-3.3.20.tgz#3deff1f8df9f0231947867065ce7a80eb734e8a0"
|
||||
integrity sha512-/QN3d6fSJw5SZRyn4Fp9nrZHMNdWBfh/ctagNHTPIWpap34U/2Z5E1UM0DP/BX1vbIqtISBtWS23NpmIqxxIxA==
|
||||
dependencies:
|
||||
"@project-serum/anchor" "^0.21.0"
|
||||
"@project-serum/serum" "0.13.55"
|
||||
|
|
Loading…
Reference in New Issue