From d64014d59644fc333a3de9431b114398f83f4eec Mon Sep 17 00:00:00 2001 From: Maximilian Schneider Date: Mon, 5 Jul 2021 14:46:02 +0200 Subject: [PATCH] fix all eslint warnings --- .eslintrc.json | 8 ++------ components/Balances.tsx | 34 ---------------------------------- stores/useWalletStore.tsx | 1 - utils/send.tsx | 5 ----- 4 files changed, 2 insertions(+), 46 deletions(-) delete mode 100644 components/Balances.tsx diff --git a/.eslintrc.json b/.eslintrc.json index 6dd5286..ad00946 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -25,9 +25,11 @@ "react/display-name": 0, "react/prop-types": 0, "@typescript-eslint/explicit-function-return-type": 0, + "@typescript-eslint/explicit-module-boundary-types": 0, "@typescript-eslint/explicit-member-accessibility": 0, "@typescript-eslint/indent": 0, "@typescript-eslint/member-delimiter-style": 0, + "@typescript-eslint/ban-ts-comment": 0, "@typescript-eslint/no-explicit-any": 0, "@typescript-eslint/no-var-requires": 0, "@typescript-eslint/no-use-before-define": 0, @@ -36,12 +38,6 @@ { "argsIgnorePattern": "^_" } - ], - "no-console": [ - 2, - { - "allow": ["warn", "error"] - } ] } } diff --git a/components/Balances.tsx b/components/Balances.tsx deleted file mode 100644 index f84c842..0000000 --- a/components/Balances.tsx +++ /dev/null @@ -1,34 +0,0 @@ -import BN from 'bn.js' -import useWalletStore from '../stores/useWalletStore' - -const Balances = () => { - const { tokenAccounts, mints } = useWalletStore((state) => state) - - function fixedPointToNumber(value: BN, decimals: number) { - const divisor = new BN(10).pow(new BN(decimals)) - const quotient = value.div(divisor) - const remainder = value.mod(divisor) - return quotient.toNumber() + remainder.toNumber() / divisor.toNumber() - } - - function calculateBalance(a) { - const mint = mints[a.account?.mint?.toBase58()] - return mint ? fixedPointToNumber(a.account.amount, mint.decimals) : 0 - } - - const displayedBalances = tokenAccounts - .map((a) => ({ id: a.publicKey.toBase58(), balance: calculateBalance(a) })) - .sort((a, b) => (a.id > b.id ? 1 : -1)) - - return ( - - ) -} - -export default Balances diff --git a/stores/useWalletStore.tsx b/stores/useWalletStore.tsx index be7a2ec..b51a88a 100644 --- a/stores/useWalletStore.tsx +++ b/stores/useWalletStore.tsx @@ -18,7 +18,6 @@ import { } from '../utils/tokens' import { findLargestBalanceAccountForMint } from '../hooks/useLargestAccounts' import { TOKEN_PROGRAM_ID } from '@solana/spl-token' -import { token } from '@project-serum/anchor/dist/utils' import { createAssociatedTokenAccount } from '../utils/associated' import { sendTransaction } from '../utils/send' diff --git a/utils/send.tsx b/utils/send.tsx index 826bb36..f049054 100644 --- a/utils/send.tsx +++ b/utils/send.tsx @@ -1,19 +1,14 @@ import { notify } from './notifications' import { Account, - AccountInfo, Commitment, Connection, - PublicKey, RpcResponseAndContext, SimulatedTransactionResponse, Transaction, TransactionSignature, } from '@solana/web3.js' import Wallet from '@project-serum/sol-wallet-adapter' -import { Buffer } from 'buffer' -import assert from 'assert' -import { struct } from 'superstruct' class TransactionError extends Error { public txid: string