fix all eslint warnings
This commit is contained in:
parent
9104bdf632
commit
d64014d596
|
@ -25,9 +25,11 @@
|
||||||
"react/display-name": 0,
|
"react/display-name": 0,
|
||||||
"react/prop-types": 0,
|
"react/prop-types": 0,
|
||||||
"@typescript-eslint/explicit-function-return-type": 0,
|
"@typescript-eslint/explicit-function-return-type": 0,
|
||||||
|
"@typescript-eslint/explicit-module-boundary-types": 0,
|
||||||
"@typescript-eslint/explicit-member-accessibility": 0,
|
"@typescript-eslint/explicit-member-accessibility": 0,
|
||||||
"@typescript-eslint/indent": 0,
|
"@typescript-eslint/indent": 0,
|
||||||
"@typescript-eslint/member-delimiter-style": 0,
|
"@typescript-eslint/member-delimiter-style": 0,
|
||||||
|
"@typescript-eslint/ban-ts-comment": 0,
|
||||||
"@typescript-eslint/no-explicit-any": 0,
|
"@typescript-eslint/no-explicit-any": 0,
|
||||||
"@typescript-eslint/no-var-requires": 0,
|
"@typescript-eslint/no-var-requires": 0,
|
||||||
"@typescript-eslint/no-use-before-define": 0,
|
"@typescript-eslint/no-use-before-define": 0,
|
||||||
|
@ -36,12 +38,6 @@
|
||||||
{
|
{
|
||||||
"argsIgnorePattern": "^_"
|
"argsIgnorePattern": "^_"
|
||||||
}
|
}
|
||||||
],
|
|
||||||
"no-console": [
|
|
||||||
2,
|
|
||||||
{
|
|
||||||
"allow": ["warn", "error"]
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 (
|
|
||||||
<ul>
|
|
||||||
{displayedBalances.map((b) => (
|
|
||||||
<li key={b.id}>
|
|
||||||
{b.id}: {b.balance}
|
|
||||||
</li>
|
|
||||||
))}
|
|
||||||
</ul>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
export default Balances
|
|
|
@ -18,7 +18,6 @@ import {
|
||||||
} from '../utils/tokens'
|
} from '../utils/tokens'
|
||||||
import { findLargestBalanceAccountForMint } from '../hooks/useLargestAccounts'
|
import { findLargestBalanceAccountForMint } from '../hooks/useLargestAccounts'
|
||||||
import { TOKEN_PROGRAM_ID } from '@solana/spl-token'
|
import { TOKEN_PROGRAM_ID } from '@solana/spl-token'
|
||||||
import { token } from '@project-serum/anchor/dist/utils'
|
|
||||||
import { createAssociatedTokenAccount } from '../utils/associated'
|
import { createAssociatedTokenAccount } from '../utils/associated'
|
||||||
import { sendTransaction } from '../utils/send'
|
import { sendTransaction } from '../utils/send'
|
||||||
|
|
||||||
|
|
|
@ -1,19 +1,14 @@
|
||||||
import { notify } from './notifications'
|
import { notify } from './notifications'
|
||||||
import {
|
import {
|
||||||
Account,
|
Account,
|
||||||
AccountInfo,
|
|
||||||
Commitment,
|
Commitment,
|
||||||
Connection,
|
Connection,
|
||||||
PublicKey,
|
|
||||||
RpcResponseAndContext,
|
RpcResponseAndContext,
|
||||||
SimulatedTransactionResponse,
|
SimulatedTransactionResponse,
|
||||||
Transaction,
|
Transaction,
|
||||||
TransactionSignature,
|
TransactionSignature,
|
||||||
} from '@solana/web3.js'
|
} from '@solana/web3.js'
|
||||||
import Wallet from '@project-serum/sol-wallet-adapter'
|
import Wallet from '@project-serum/sol-wallet-adapter'
|
||||||
import { Buffer } from 'buffer'
|
|
||||||
import assert from 'assert'
|
|
||||||
import { struct } from 'superstruct'
|
|
||||||
|
|
||||||
class TransactionError extends Error {
|
class TransactionError extends Error {
|
||||||
public txid: string
|
public txid: string
|
||||||
|
|
Loading…
Reference in New Issue