diff --git a/.eslintrc.json b/.eslintrc.json index 4ad317502..cee1fc90f 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -29,6 +29,7 @@ "@typescript-eslint/no-non-null-assertion": 0, "@typescript-eslint/ban-ts-comment": 0, "@typescript-eslint/no-explicit-any": 0, - "@typescript-eslint/explicit-function-return-type": "warn" + "@typescript-eslint/explicit-function-return-type": "warn", + "@typescript-eslint/no-unused-vars": "warn" } } \ No newline at end of file diff --git a/ts/client/scripts/archive/mb-admin.ts b/ts/client/scripts/archive/mb-admin.ts index a1523f907..53979e8ad 100644 --- a/ts/client/scripts/archive/mb-admin.ts +++ b/ts/client/scripts/archive/mb-admin.ts @@ -748,9 +748,8 @@ async function createAndPopulateAlt() { client.program.provider as AnchorProvider, [extendIx], ); - const sig = await client.program.provider.connection.sendTransaction( - extendTx, - ); + const sig = + await client.program.provider.connection.sendTransaction(extendTx); console.log(`https://explorer.solana.com/tx/${sig}`); } diff --git a/ts/client/scripts/governanceInstructions/voteStakeRegistryClient.ts b/ts/client/scripts/governanceInstructions/voteStakeRegistryClient.ts index 924bbcd90..8ec7dedaa 100644 --- a/ts/client/scripts/governanceInstructions/voteStakeRegistryClient.ts +++ b/ts/client/scripts/governanceInstructions/voteStakeRegistryClient.ts @@ -7,7 +7,10 @@ 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/ts/client/scripts/governanceInstructions/vsrAccounts.ts b/ts/client/scripts/governanceInstructions/vsrAccounts.ts index 1bf76489e..ba950bdb5 100644 --- a/ts/client/scripts/governanceInstructions/vsrAccounts.ts +++ b/ts/client/scripts/governanceInstructions/vsrAccounts.ts @@ -131,9 +131,8 @@ export const tryGetRegistrar = async ( client: VsrClient, ) => { try { - const existingRegistrar = await client.program.account.registrar.fetch( - registrarPk, - ); + const existingRegistrar = + await client.program.account.registrar.fetch(registrarPk); return existingRegistrar as unknown as Registrar; } catch (e) { return null; diff --git a/ts/client/scripts/mainnet-no-margin-group.ts b/ts/client/scripts/mainnet-no-margin-group.ts index 513a37836..a2edcd212 100644 --- a/ts/client/scripts/mainnet-no-margin-group.ts +++ b/ts/client/scripts/mainnet-no-margin-group.ts @@ -284,9 +284,8 @@ async function createAndPopulateAlt() { client.program.provider as AnchorProvider, [extendIx], ); - const sig = await client.program.provider.connection.sendTransaction( - extendTx, - ); + const sig = + await client.program.provider.connection.sendTransaction(extendTx); console.log(`https://explorer.solana.com/tx/${sig}`); } diff --git a/ts/client/scripts/maintain-alts.ts b/ts/client/scripts/maintain-alts.ts index 8ced8a441..1d00d4e7a 100644 --- a/ts/client/scripts/maintain-alts.ts +++ b/ts/client/scripts/maintain-alts.ts @@ -41,9 +41,8 @@ async function extendTable( let addressesAlreadyIndexed: PublicKey[] = []; for (const altAddr of altAddresses) { - const alt = await client.program.provider.connection.getAddressLookupTable( - altAddr, - ); + const alt = + await client.program.provider.connection.getAddressLookupTable(altAddr); if (alt.value?.state.addresses) { addressesAlreadyIndexed = addressesAlreadyIndexed.concat( alt.value?.state.addresses, @@ -106,9 +105,8 @@ async function extendTable( if (DRY_RUN) { continue; } - const sig = await client.program.provider.connection.sendTransaction( - extendTx, - ); + const sig = + await client.program.provider.connection.sendTransaction(extendTx); console.log(`https://explorer.solana.com/tx/${sig}`); } } diff --git a/ts/client/scripts/sb-on-demand-crank.ts b/ts/client/scripts/sb-on-demand-crank.ts index 23c01d984..41849a03a 100644 --- a/ts/client/scripts/sb-on-demand-crank.ts +++ b/ts/client/scripts/sb-on-demand-crank.ts @@ -55,9 +55,8 @@ interface OracleInterface { (async function main(): Promise { const { group, client, connection, user, userProvider } = await setupMango(); - const { sbOnDemandProgram, crossbarClient, queue } = await setupSwitchboard( - client, - ); + const { sbOnDemandProgram, crossbarClient, queue } = + await setupSwitchboard(client); // eslint-disable-next-line no-constant-condition while (true) { diff --git a/ts/client/scripts/sb-on-demand-lut.ts b/ts/client/scripts/sb-on-demand-lut.ts index 812f13627..f2b06c488 100644 --- a/ts/client/scripts/sb-on-demand-lut.ts +++ b/ts/client/scripts/sb-on-demand-lut.ts @@ -47,9 +47,8 @@ async function extendTable( let addressesAlreadyIndexed: PublicKey[] = []; for (const altAddr of altAddresses) { - const alt = await client.program.provider.connection.getAddressLookupTable( - altAddr, - ); + const alt = + await client.program.provider.connection.getAddressLookupTable(altAddr); if (alt.value?.state.addresses) { addressesAlreadyIndexed = addressesAlreadyIndexed.concat( alt.value?.state.addresses, @@ -112,9 +111,8 @@ async function extendTable( if (DRY_RUN) { continue; } - const sig = await client.program.provider.connection.sendTransaction( - extendTx, - ); + const sig = + await client.program.provider.connection.sendTransaction(extendTx); console.log(`https://explorer.solana.com/tx/${sig}`); } } diff --git a/ts/client/scripts/switchboard-logs.ts b/ts/client/scripts/switchboard-logs.ts index 158db1016..399c8b901 100644 --- a/ts/client/scripts/switchboard-logs.ts +++ b/ts/client/scripts/switchboard-logs.ts @@ -38,9 +38,8 @@ async function main(): Promise { ); const oracles = oracles1.concat(oracles2); - const ais = await client.program.provider.connection.getMultipleAccountsInfo( - oracles, - ); + const ais = + await client.program.provider.connection.getMultipleAccountsInfo(oracles); const switcboardOracles: PublicKey[] = ais .map((ai, i) => [isSwitchboardOracle(ai!), oracles[i]]) diff --git a/ts/client/scripts/template.ts b/ts/client/scripts/template.ts index 77724939c..3ee792d81 100644 --- a/ts/client/scripts/template.ts +++ b/ts/client/scripts/template.ts @@ -23,9 +23,10 @@ async function main(): Promise { ); const oraclePublicKeys = allOracles.map((item) => item[1] as PublicKey); - const ais = await client.program.provider.connection.getMultipleAccountsInfo( - oraclePublicKeys, - ); + const ais = + await client.program.provider.connection.getMultipleAccountsInfo( + oraclePublicKeys, + ); const result = ais .map((ai, idx) => { diff --git a/ts/client/src/accounts/healthCache.ts b/ts/client/src/accounts/healthCache.ts index f242b4498..54c774676 100644 --- a/ts/client/src/accounts/healthCache.ts +++ b/ts/client/src/accounts/healthCache.ts @@ -17,7 +17,7 @@ import { PerpPosition, Serum3Orders, } from './mangoAccount'; -import { PerpMarket, PerpMarketIndex, PerpOrder, PerpOrderSide } from './perp'; +import { PerpMarket, PerpMarketIndex, PerpOrderSide } from './perp'; import { MarketIndex, Serum3Market, Serum3Side } from './serum3'; // ░░░░ @@ -1401,7 +1401,10 @@ export class HealthCache { } export class Prices { - constructor(public oracle: I80F48, public stable: I80F48) {} + constructor( + public oracle: I80F48, + public stable: I80F48, + ) {} public liab(healthType: HealthType | undefined): I80F48 { if ( @@ -1797,8 +1800,8 @@ export class PerpInfo { healthType == HealthType.init ? settleToken.initScaledAssetWeight : healthType == HealthType.liquidationEnd - ? settleToken.initAssetWeight - : settleToken.maintLiabWeight + ? settleToken.initAssetWeight + : settleToken.maintLiabWeight ) .mul(unweighted) .mul(settleToken.prices.asset(healthType)); @@ -1807,8 +1810,8 @@ export class PerpInfo { healthType == HealthType.init ? settleToken.initScaledLiabWeight : healthType == HealthType.liquidationEnd - ? settleToken.initLiabWeight - : settleToken.maintLiabWeight + ? settleToken.initLiabWeight + : settleToken.maintLiabWeight ) .mul(unweighted) .mul(settleToken.prices.liab(healthType)); diff --git a/ts/client/src/accounts/oracle.spec.ts b/ts/client/src/accounts/oracle.spec.ts index bfa1a90a0..fe55d93b1 100644 --- a/ts/client/src/accounts/oracle.spec.ts +++ b/ts/client/src/accounts/oracle.spec.ts @@ -71,9 +71,8 @@ describe.only('Oracle', () => { }, ); // SOL - const groupAccount = await client.program.account.group.fetch( - MANGO_V4_MAIN_GROUP, - ); + const groupAccount = + await client.program.account.group.fetch(MANGO_V4_MAIN_GROUP); const GROUP = Group.from(MANGO_V4_MAIN_GROUP, groupAccount); await GROUP.reloadBanks(client); const fbs = await client.deriveFallbackOracleContexts(GROUP); @@ -89,9 +88,8 @@ describe.only('Oracle', () => { { fallbackOracleConfig: 'all' }, ); - const groupAccount = await client.program.account.group.fetch( - MANGO_V4_MAIN_GROUP, - ); + const groupAccount = + await client.program.account.group.fetch(MANGO_V4_MAIN_GROUP); const GROUP = Group.from(MANGO_V4_MAIN_GROUP, groupAccount); await GROUP.reloadBanks(client); const fbs = await client.deriveFallbackOracleContexts(GROUP); @@ -107,9 +105,8 @@ describe.only('Oracle', () => { { fallbackOracleConfig: 'dynamic' }, ); - const groupAccount = await client.program.account.group.fetch( - MANGO_V4_MAIN_GROUP, - ); + const groupAccount = + await client.program.account.group.fetch(MANGO_V4_MAIN_GROUP); const GROUP = Group.from(MANGO_V4_MAIN_GROUP, groupAccount); await GROUP.reloadBanks(client); const fbs = await client.deriveFallbackOracleContexts(GROUP); diff --git a/ts/client/src/accounts/perp.ts b/ts/client/src/accounts/perp.ts index a3c8217a0..9a4933fe9 100644 --- a/ts/client/src/accounts/perp.ts +++ b/ts/client/src/accounts/perp.ts @@ -675,8 +675,8 @@ export class BookSide { return a.priceLots.eq(b.priceLots) ? a.seqNum.lt(b.seqNum) // if prices are equal prefer perp orders in the order they are placed : type === BookSideType.bids // else compare the actual prices - ? a.priceLots.gt(b.priceLots) - : b.priceLots.gt(a.priceLots); + ? a.priceLots.gt(b.priceLots) + : b.priceLots.gt(a.priceLots); } const fGen = this.fixedItems(); diff --git a/ts/client/src/client.ts b/ts/client/src/client.ts index 42f8603b3..c7f9f1517 100644 --- a/ts/client/src/client.ts +++ b/ts/client/src/client.ts @@ -637,7 +637,7 @@ export class MangoClient { ? true : false, isSigner: false, - } as AccountMeta), + }) as AccountMeta, ); const ix = await this.program.methods .tokenForceCloseBorrowsWithToken( @@ -758,9 +758,8 @@ export class MangoClient { const adminPk = (this.program.provider as AnchorProvider).wallet.publicKey; const dustVaultPk = await getAssociatedTokenAddress(bank.mint, adminPk); - const ai = await this.program.provider.connection.getAccountInfo( - dustVaultPk, - ); + const ai = + await this.program.provider.connection.getAccountInfo(dustVaultPk); const preInstructions: TransactionInstruction[] = []; if (!ai) { preInstructions.push( @@ -786,7 +785,7 @@ export class MangoClient { .remainingAccounts( [bank.publicKey, bank.vault].map( (pk) => - ({ pubkey: pk, isWritable: true, isSigner: false } as AccountMeta), + ({ pubkey: pk, isWritable: true, isSigner: false }) as AccountMeta, ), ) .instruction(); @@ -1109,7 +1108,7 @@ export class MangoClient { .remainingAccounts( healthRemainingAccounts.map( (pk) => - ({ pubkey: pk, isWritable: false, isSigner: false } as AccountMeta), + ({ pubkey: pk, isWritable: false, isSigner: false }) as AccountMeta, ), ) .instruction(); @@ -1608,7 +1607,7 @@ export class MangoClient { .remainingAccounts( healthRemainingAccounts.map( (pk) => - ({ pubkey: pk, isWritable: false, isSigner: false } as AccountMeta), + ({ pubkey: pk, isWritable: false, isSigner: false }) as AccountMeta, ), ) .instruction(); @@ -1760,7 +1759,7 @@ export class MangoClient { pubkey: pk, isWritable: false, isSigner: false, - } as AccountMeta), + }) as AccountMeta, ), ) .instruction(); @@ -2103,7 +2102,7 @@ export class MangoClient { .remainingAccounts( healthRemainingAccounts.map( (pk) => - ({ pubkey: pk, isWritable: false, isSigner: false } as AccountMeta), + ({ pubkey: pk, isWritable: false, isSigner: false }) as AccountMeta, ), ) .instruction(); @@ -2251,7 +2250,7 @@ export class MangoClient { .remainingAccounts( healthRemainingAccounts.map( (pk) => - ({ pubkey: pk, isWritable: false, isSigner: false } as AccountMeta), + ({ pubkey: pk, isWritable: false, isSigner: false }) as AccountMeta, ), ) .instruction(); @@ -2388,7 +2387,7 @@ export class MangoClient { pubkey: pk, isWritable: receiverBank.publicKey.equals(pk) ? true : false, isSigner: false, - } as AccountMeta), + }) as AccountMeta, ), ) .instruction(); @@ -2951,7 +2950,7 @@ export class MangoClient { .remainingAccounts( healthRemainingAccounts.map( (pk) => - ({ pubkey: pk, isWritable: false, isSigner: false } as AccountMeta), + ({ pubkey: pk, isWritable: false, isSigner: false }) as AccountMeta, ), ) .instruction(); @@ -3106,7 +3105,7 @@ export class MangoClient { .remainingAccounts( healthRemainingAccounts.map( (pk) => - ({ pubkey: pk, isWritable: false, isSigner: false } as AccountMeta), + ({ pubkey: pk, isWritable: false, isSigner: false }) as AccountMeta, ), ) .instruction(); @@ -3164,7 +3163,7 @@ export class MangoClient { .remainingAccounts( healthRemainingAccounts.map( (pk) => - ({ pubkey: pk, isWritable: false, isSigner: false } as AccountMeta), + ({ pubkey: pk, isWritable: false, isSigner: false }) as AccountMeta, ), ) .instruction(); @@ -3258,7 +3257,7 @@ export class MangoClient { .remainingAccounts( healthRemainingAccounts.map( (pk) => - ({ pubkey: pk, isWritable: false, isSigner: false } as AccountMeta), + ({ pubkey: pk, isWritable: false, isSigner: false }) as AccountMeta, ), ) .instruction(); @@ -3319,7 +3318,7 @@ export class MangoClient { .remainingAccounts( healthRemainingAccounts.map( (pk) => - ({ pubkey: pk, isWritable: false, isSigner: false } as AccountMeta), + ({ pubkey: pk, isWritable: false, isSigner: false }) as AccountMeta, ), ) .instruction(); @@ -3588,7 +3587,7 @@ export class MangoClient { .remainingAccounts( healthRemainingAccounts.map( (pk) => - ({ pubkey: pk, isWritable: false, isSigner: false } as AccountMeta), + ({ pubkey: pk, isWritable: false, isSigner: false }) as AccountMeta, ), ) .instruction(); @@ -3640,7 +3639,7 @@ export class MangoClient { .remainingAccounts( healthRemainingAccounts.map( (pk) => - ({ pubkey: pk, isWritable: false, isSigner: false } as AccountMeta), + ({ pubkey: pk, isWritable: false, isSigner: false }) as AccountMeta, ), ) .instruction(); @@ -3674,7 +3673,7 @@ export class MangoClient { .remainingAccounts( accounts.map( (pk) => - ({ pubkey: pk, isWritable: true, isSigner: false } as AccountMeta), + ({ pubkey: pk, isWritable: true, isSigner: false }) as AccountMeta, ), ) .instruction(); @@ -3775,7 +3774,7 @@ export class MangoClient { pubkey: pk, isWritable: false, isSigner: false, - } as AccountMeta), + }) as AccountMeta, ); /* @@ -3978,7 +3977,7 @@ export class MangoClient { ? true : false, isSigner: false, - } as AccountMeta), + }) as AccountMeta, ); const ix = await this.program.methods @@ -4972,7 +4971,7 @@ export class MangoClient { ? true : false, isSigner: false, - } as AccountMeta), + }) as AccountMeta, ); return this.program.methods @@ -5047,7 +5046,7 @@ export class MangoClient { pubkey: pk, isWritable: false, isSigner: false, - } as AccountMeta), + }) as AccountMeta, ); return await this.program.methods @@ -5080,7 +5079,7 @@ export class MangoClient { pubkey: pk, isWritable: false, isSigner: false, - } as AccountMeta), + }) as AccountMeta, ); return await this.program.methods diff --git a/ts/client/src/utils/rpc.ts b/ts/client/src/utils/rpc.ts index 789ea13c0..5e0d276d1 100644 --- a/ts/client/src/utils/rpc.ts +++ b/ts/client/src/utils/rpc.ts @@ -238,8 +238,8 @@ const confirmTransaction = async ( stringifiedError ? stringifiedError : individualError - ? individualError - : 'Unknown error' + ? individualError + : 'Unknown error' }`, }); }