diff --git a/.prettierrc b/.prettierrc index b2095be8..e3b414c7 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,4 +1,5 @@ { "semi": false, - "singleQuote": true + "singleQuote": true, + "trailingComma": "all" } diff --git a/apis/datafeed.ts b/apis/datafeed.ts index 47cafd5c..6e60e89f 100644 --- a/apis/datafeed.ts +++ b/apis/datafeed.ts @@ -102,7 +102,7 @@ let marketType: 'spot' | 'perp' export const queryPerpBars = async ( tokenAddress: string, - resolution: (typeof SUPPORTED_RESOLUTIONS)[number], + resolution: typeof SUPPORTED_RESOLUTIONS[number], periodParams: { firstDataRequest: boolean from: number @@ -150,7 +150,7 @@ export const queryPerpBars = async ( export const queryBirdeyeBars = async ( tokenAddress: string, - resolution: (typeof SUPPORTED_RESOLUTIONS)[number], + resolution: typeof SUPPORTED_RESOLUTIONS[number], periodParams: { firstDataRequest: boolean from: number diff --git a/apis/mngo/datafeed.ts b/apis/mngo/datafeed.ts index dda38d3a..edaf1fed 100644 --- a/apis/mngo/datafeed.ts +++ b/apis/mngo/datafeed.ts @@ -66,7 +66,7 @@ const configurationData = { export const queryBars = async ( tokenAddress: string, - resolution: (typeof SUPPORTED_RESOLUTIONS)[number], + resolution: typeof SUPPORTED_RESOLUTIONS[number], periodParams: { firstDataRequest: boolean from: number diff --git a/components/Layout.tsx b/components/Layout.tsx index 712c6c79..5d8c1662 100644 --- a/components/Layout.tsx +++ b/components/Layout.tsx @@ -52,12 +52,9 @@ const Layout = ({ children }: { children: ReactNode }) => { const animationFrames = 15 for (let x = 1; x <= animationFrames; x++) { - setTimeout( - () => { - window.dispatchEvent(new Event('resize')) - }, - (sideBarAnimationDuration / animationFrames) * x, - ) + setTimeout(() => { + window.dispatchEvent(new Event('resize')) + }, (sideBarAnimationDuration / animationFrames) * x) } }, [isCollapsed]) diff --git a/components/MangoProvider.tsx b/components/MangoProvider.tsx index 36c7f57d..f3ee63b0 100644 --- a/components/MangoProvider.tsx +++ b/components/MangoProvider.tsx @@ -38,23 +38,17 @@ const HydrateStore = () => { actions.fetchGroup() }, [marketName]) - useInterval( - () => { - actions.fetchGroup() - }, - (slowNetwork ? 40 : 20) * SECONDS, - ) + useInterval(() => { + actions.fetchGroup() + }, (slowNetwork ? 40 : 20) * SECONDS) // refetches open orders every 30 seconds // only the selected market's open orders are updated via websocket - useInterval( - () => { - if (mangoAccountAddress) { - actions.fetchOpenOrders() - } - }, - (slowNetwork ? 60 : 30) * SECONDS, - ) + useInterval(() => { + if (mangoAccountAddress) { + actions.fetchOpenOrders() + } + }, (slowNetwork ? 60 : 30) * SECONDS) // refetch trade history and activity feed when switching accounts useEffect(() => { @@ -65,13 +59,10 @@ const HydrateStore = () => { }, [mangoAccountAddress]) // reload and parse market fills from the event queue - useInterval( - async () => { - const actions = mangoStore.getState().actions - actions.loadMarketFills() - }, - (slowNetwork ? 60 : 20) * SECONDS, - ) + useInterval(async () => { + const actions = mangoStore.getState().actions + actions.loadMarketFills() + }, (slowNetwork ? 60 : 20) * SECONDS) // The websocket library solana/web3.js uses closes its websocket connection when the subscription list // is empty after opening its first time, preventing subsequent subscriptions from receiving responses. diff --git a/components/governance/ListToken/ListToken.tsx b/components/governance/ListToken/ListToken.tsx index 35d311ce..992ec1ab 100644 --- a/components/governance/ListToken/ListToken.tsx +++ b/components/governance/ListToken/ListToken.tsx @@ -492,7 +492,7 @@ const ListToken = ({ goBack }: { goBack: () => void }) => { .instruction() proposalTx.push(editIx) } else { - await client!.program.methods + const trustlessIx = await client!.program.methods .tokenRegisterTrustless(Number(advForm.tokenIndex), advForm.name) .accounts({ mint: new PublicKey(advForm.mintPk), @@ -503,6 +503,8 @@ const ListToken = ({ goBack }: { goBack: () => void }) => { group: group!.publicKey, }) .instruction() + + proposalTx.push(trustlessIx) } const registerMarketix = await client!.program.methods diff --git a/hooks/useSelectedMarket.ts b/hooks/useSelectedMarket.ts index c89e2758..34ec53e3 100644 --- a/hooks/useSelectedMarket.ts +++ b/hooks/useSelectedMarket.ts @@ -63,8 +63,8 @@ export default function useSelectedMarket() { mangoTokens.find( (t) => t.symbol.toLowerCase() === lowerCaseBaseSymbol, ) || - mangoTokens.find( - (t) => t.symbol.toLowerCase()?.includes(lowerCaseBaseSymbol), + mangoTokens.find((t) => + t.symbol.toLowerCase()?.includes(lowerCaseBaseSymbol), ) if (token) { return token.logoURI diff --git a/pages/dashboard/index.tsx b/pages/dashboard/index.tsx index 24c8fe10..f3926534 100644 --- a/pages/dashboard/index.tsx +++ b/pages/dashboard/index.tsx @@ -825,11 +825,11 @@ const Dashboard: NextPage = () => { ${ perpMarket.quoteLotSize } quote (tick size: $${perpMarket.priceLotsToUi( - new BN(1), - )}, 1 base lot: $${( - perpMarket.baseLotsToUi(new BN(1)) * - perpMarket.uiPrice - ).toFixed(3)})`} + new BN(1), + )}, 1 base lot: $${( + perpMarket.baseLotsToUi(new BN(1)) * + perpMarket.uiPrice + ).toFixed(3)})`} /> { ${perpMarket.maintBaseLiabWeight.toFixed( 4, )} (maint leverage: ${( - 1 / - (perpMarket.maintBaseLiabWeight.toNumber() - 1) - ).toFixed(2)}x, init leverage: ${( - 1 / - (perpMarket.initBaseLiabWeight.toNumber() - 1) - ).toFixed(2)}x)`} + 1 / + (perpMarket.maintBaseLiabWeight.toNumber() - + 1) + ).toFixed(2)}x, init leverage: ${( + 1 / + (perpMarket.initBaseLiabWeight.toNumber() - + 1) + ).toFixed(2)}x)`} /> typeof isUsed === 'undefined' || x.isUsed === isUsed) const usedDeposits = deposits.filter((x) => x.isUsed) diff --git a/utils/governance/voteStakeRegistryClient.ts b/utils/governance/voteStakeRegistryClient.ts index 972d7cd1..232dfa90 100644 --- a/utils/governance/voteStakeRegistryClient.ts +++ b/utils/governance/voteStakeRegistryClient.ts @@ -7,10 +7,7 @@ export const DEFAULT_VSR_ID = new web3.PublicKey( ) export class VsrClient { - constructor( - public program: Program, - public devnet?: boolean, - ) {} + constructor(public program: Program, public devnet?: boolean) {} static async connect( provider: Provider, diff --git a/utils/kLineChart.ts b/utils/kLineChart.ts index 4b3b7ddb..d435fa3f 100644 --- a/utils/kLineChart.ts +++ b/utils/kLineChart.ts @@ -6,7 +6,7 @@ export const ONE_HOUR_SECONDS = ONE_HOUR_MINS * ONE_MINUTE_SECONDS export const ONE_DAY_SECONDS = ONE_HOUR_SECONDS * 24 export type BASE_CHART_QUERY = { address: string - type: (typeof SUPPORTED_SPOT_RESOLUTIONS)[number] + type: typeof SUPPORTED_SPOT_RESOLUTIONS[number] time_to: number } export type CHART_QUERY = BASE_CHART_QUERY & { @@ -16,7 +16,7 @@ export type CHART_QUERY = BASE_CHART_QUERY & { //Translate values that api accepts to chart seconds export const RES_NAME_TO_RES_VAL: { [key: string]: { - val: (typeof SUPPORTED_SPOT_RESOLUTIONS)[number] + val: typeof SUPPORTED_SPOT_RESOLUTIONS[number] seconds: number } } = {