Merge branch 'main' into saml33/follow-accounts

This commit is contained in:
saml33 2023-11-15 22:26:31 +11:00
commit a45bc1787c
9 changed files with 31 additions and 35 deletions

View File

@ -495,7 +495,7 @@ const ListToken = ({ goBack }: { goBack: () => void }) => {
Number(tierPreset.reduceOnly),
Number(tierPreset.tokenConditionalSwapTakerFeeRate),
Number(tierPreset.tokenConditionalSwapMakerFeeRate),
Number(tierPreset.flashLoanDepositFeeRate),
Number(tierPreset.flashLoanSwapFeeRate),
)
.accounts({
admin: MANGO_DAO_WALLET,

View File

@ -61,13 +61,16 @@ const RateCurveChart = ({ bank }: { bank: Bank | undefined }) => {
{ util: 0, rate: 0 },
{
util: bank.util0.toNumber() * 100,
rate: bank.rate0.toNumber() * 100,
rate: (bank.rate0.toNumber() + bank.loanFeeRate.toNumber()) * 100,
},
{
util: bank.util1.toNumber() * 100,
rate: bank.rate1.toNumber() * 100,
rate: (bank.rate1.toNumber() + bank.loanFeeRate.toNumber()) * 100,
},
{
util: 100,
rate: (bank.maxRate.toNumber() + bank.loanFeeRate.toNumber()) * 100,
},
{ util: 100, rate: bank.maxRate.toNumber() * 100 },
]
if (currentRate && currentUtil) {
defaults.push({ util: currentUtil, rate: currentRate })

View File

@ -90,7 +90,6 @@ const TradingViewChart = () => {
const { theme } = useThemeWrapper()
const { isMobile } = useViewport()
const [chartReady, setChartReady] = useState(false)
const [headerReady, setHeaderReady] = useState(false)
const [orderToModify, setOrderToModify] = useState<Order | PerpOrder | null>(
null,
)
@ -614,7 +613,8 @@ const TradingViewChart = () => {
)
const createOLButton = useCallback(() => {
const button = tvWidgetRef?.current?.createButton()
if (!tvWidgetRef?.current) return
const button = tvWidgetRef.current.createButton()
if (!button) {
return
}
@ -627,10 +627,11 @@ const TradingViewChart = () => {
button.style.color = COLORS.FGD4[theme]
}
orderLinesButtonRef.current = button
}, [t, toggleOrderLines, showOrderLinesLocalStorage, theme])
}, [t, toggleOrderLines, tvWidgetRef, showTradeExecutions, theme])
const createTEButton = useCallback(() => {
const button = tvWidgetRef?.current?.createButton()
if (!tvWidgetRef?.current) return
const button = tvWidgetRef.current.createButton()
if (!button) {
return
}
@ -642,10 +643,11 @@ const TradingViewChart = () => {
} else {
button.style.color = COLORS.FGD4[theme]
}
}, [t, toggleTradeExecutions, showTradeExecutions, theme])
}, [t, toggleTradeExecutions, tvWidgetRef, showTradeExecutions, theme])
const createEasterEggButton = useCallback(() => {
const button = tvWidgetRef?.current?.createButton()
if (!tvWidgetRef?.current) return
const button = tvWidgetRef.current.createButton()
if (!button) {
return
}
@ -656,7 +658,7 @@ const TradingViewChart = () => {
} else {
button.style.color = COLORS.FGD4[theme]
}
}, [toggleThemeEasterEgg, showTradeExecutions, theme])
}, [toggleThemeEasterEgg, tvWidgetRef, showThemeEasterEgg, theme])
useEffect(() => {
if (window) {
@ -770,9 +772,13 @@ const TradingViewChart = () => {
tvWidget.onChartReady(() => {
tvWidgetRef.current = tvWidget
setChartReady(true)
})
tvWidget.headerReady().then(() => {
setHeaderReady(true)
tvWidget.headerReady().then(() => {
createOLButton()
createTEButton()
if (themeData.tvImagePath) {
createEasterEggButton()
}
})
})
}
}, [theme, themeData, defaultProps, isMobile, userId])
@ -804,17 +810,6 @@ const TradingViewChart = () => {
}
}, [chartReady, tvWidgetRef])
// draw custom buttons when chart is ready
useEffect(() => {
if (chartReady && headerReady && !orderLinesButtonRef.current) {
createOLButton()
createTEButton()
if (themeData.tvImagePath) {
createEasterEggButton()
}
}
}, [createOLButton, createTEButton, chartReady, headerReady, themeData])
// update order lines if a user's open orders change
useEffect(() => {
let subscription

View File

@ -24,7 +24,7 @@
"@blockworks-foundation/mango-feeds": "0.1.7",
"@blockworks-foundation/mango-mints-redemption": "^0.0.10",
"@blockworks-foundation/mango-v4": "0.19.49",
"@blockworks-foundation/mango-v4-settings": "0.2.17",
"@blockworks-foundation/mango-v4-settings": "0.2.18",
"@blockworks-foundation/mangolana": "0.0.1-beta.15",
"@headlessui/react": "1.6.6",
"@heroicons/react": "2.0.18",

View File

@ -8,6 +8,7 @@ export async function getStaticProps({ locale }: { locale: string }) {
...(await serverSideTranslations(locale, [
'common',
'notifications',
'onboarding',
'profile',
'search',
'settings',

View File

@ -10,6 +10,7 @@ export async function getStaticProps({ locale }: { locale: string }) {
'common',
'leaderboard',
'notifications',
'onboarding',
'profile',
'search',
'settings',

View File

@ -8,6 +8,7 @@ export async function getStaticProps({ locale }: { locale: string }) {
...(await serverSideTranslations(locale, [
'common',
'notifications',
'onboarding',
'profile',
'search',
'settings',

View File

@ -631,11 +631,6 @@ table p {
/* Chart */
.TVChartContainer {
height: 100%;
width: 100%;
}
.tradingview-chart {
display: contents;
}

View File

@ -42,10 +42,10 @@
keccak256 "^1.0.6"
merkletreejs "^0.3.11"
"@blockworks-foundation/mango-v4-settings@0.2.17", "@blockworks-foundation/mango-v4-settings@^0.2.16":
version "0.2.17"
resolved "https://registry.yarnpkg.com/@blockworks-foundation/mango-v4-settings/-/mango-v4-settings-0.2.17.tgz#ebc64eb037137bdd16df93cdb63badc7f178542b"
integrity sha512-k4Hi0Rjq3XbWnN4Hvdd2aDrm24Ob+8+WDCz7hzR+XKCQ0HcYQXVrZn2Yz7e9IA4M3zQEP9n5HHnQopLQb8UgMw==
"@blockworks-foundation/mango-v4-settings@0.2.18", "@blockworks-foundation/mango-v4-settings@^0.2.16":
version "0.2.18"
resolved "https://registry.yarnpkg.com/@blockworks-foundation/mango-v4-settings/-/mango-v4-settings-0.2.18.tgz#d984617fd44d7ba0d56b7f4a751f8b3b4d95cc35"
integrity sha512-hdU75eED5YzUWg4EJcUIJZsEvfeLVwUj3yfEykyj/OMVR/H83cbX5KuTnfh6ri0Iwd+K8cqNNFdParLKigoUxQ==
dependencies:
bn.js "^5.2.1"
eslint-config-prettier "^9.0.0"