Showing 600 of 2,050 total issues
Function extractOther
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function extractOther (url: string): State {
const isIpfs = SECTIONS.some((part) => url.includes(part));
const isIpns = url.includes(SECTIONS[1]);
// individual sections, with the index of the ipfs portion
Function _newHeader
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
(header: Header): void => {
// formatted block info
const bn = formatNumber(header.number);
const hash = header.hash.toHex();
const parent = header.parentHash.toHex();
Function sortValidators
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function sortValidators (list: ValidatorInfo[]): ValidatorInfo[] {
const existing: string[] = [];
return list
.filter(({ accountId }): boolean => {
Function sortValidators
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function sortValidators (list: ValidatorInfo[]): ValidatorInfo[] {
const existing: string[] = [];
return list
.filter(({ accountId }): boolean => {
Function NodeInfo
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function NodeInfo (): React.ReactElement {
const { t } = useTranslation();
const { api } = useApi();
const [info, setInfo] = useState<Partial<Info>>({});
const [nextRefresh, setNextRefresh] = useState(() => Date.now());
Function createOptions
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function createOptions (api: ApiPromise, sectionName: string): DropdownOptions {
const section = api.consts[sectionName];
if (!section || Object.keys(section).length === 0) {
return [];
Function extractInfo
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function extractInfo (info: PalletReferendaReferendumInfoConvictionVotingTally | PalletReferendaReferendumInfoRankedCollectiveTally, track?: PalletReferendaTrackInfo): { confirmEnd: BN | null, enactAt: { at: boolean, blocks: BN, end: BN | null } | null, nextAlarm: null | BN, submittedIn: null | BN } {
let confirmEnd: BN | null = null;
let enactAt: { at: boolean, blocks: BN, end: BN | null } | null = null;
let nextAlarm: BN | null = null;
let submittedIn: BN | null = null;
Function usePreimageImpl
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function usePreimageImpl (hashOrBounded?: Hash | HexString | FrameSupportPreimagesBounded | null): Preimage | undefined {
const { api } = useApi();
// retrieve the status using only the hash of the image
const { inlineData, paramsStatus, resultPreimageHash } = useMemo(
Function useTxBatchImpl
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function useTxBatchImpl (txs?: SubmittableExtrinsic<'promise'>[] | null | false, options?: BatchOptions): SubmittableExtrinsic<'promise'>[] | null {
const { api } = useApi();
const { allAccounts } = useAccounts();
const [batchSize, setBatchSize] = useState(() => Math.floor(options?.max || 4));
Function sortAccounts
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function sortAccounts (addresses: string[], favorites: string[]): SortedAccount[] {
const mapped = addresses
.map((address) => keyring.getAccount(address))
.filter((account): account is KeyringAddress => !!account)
.map((account): SortedAccount => ({
Function transform
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
transform: (entries: [{ args: [BlockNumber] }, Option<Scheduled | PalletSchedulerScheduled | PalletSchedulerScheduledV3>[]][], api: ApiPromise): ScheduledExt[] => {
return entries
.filter(([, all]) => all.some((o) => o.isSome))
.reduce((items: ScheduledExt[], [key, all]): ScheduledExt[] => {
const blockNumber = key.args[0];
Function useApiUrlImpl
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function useApiUrlImpl (url?: null | string | string[]): ApiPromise | null {
const providerRef = useRef<ProviderInterface | null>(null);
const mountedRef = useIsMountedRef();
const [state, setState] = useState<ApiPromise | null>(null);
const urls = useMemo(
Function renderRows
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function renderRows (rows: Row[]): React.ReactNode[] {
const lastIndex = rows.length - 1;
let isPrevShort = false;
return rows.map(({ bn, cols }, index): React.ReactNode => {
Function useItemsInfosImpl
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function useItemsInfosImpl (accountItems: AccountItem[]): ItemInfo[] | undefined {
const { api } = useApi();
const [state, setState] = useState<ItemInfo[] | undefined>();
const ids = useMemo(
Function useMultisigApprovalsImpl
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function useMultisigApprovalsImpl (address: string): [H256, Multisig][] | undefined {
const { events } = useBlockEvents();
const { api } = useApi();
const [multiInfos, setMultiInfos] = useState<[H256, Multisig][] | undefined>();
const [trigger, incTrigger] = useIncrement(1);
Function useBagEntriesImpl
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function useBagEntriesImpl (headId: AccountId32 | null, trigger: number): [boolean, AccountId32[]] {
const mod = useQueryModule();
const [[currId, { isCompleted, list }], setCurrent] = useState<[AccountId32 | null, Result]>(EMPTY);
const node = useCall<Option<PalletBagsListListNode>>(!!currId && mod.listNodes, [currId]);
Function dryRun
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async function dryRun () {
if (accountId && value && message.isMutating) {
const dryRunParams: Parameters<typeof api.call.contractsApi.call> =
[
accountId,
Function extractStake
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function extractStake (labels: string[], exposures: DeriveOwnExposure[], divisor: BN): LineData {
const expPagedSet = new Array<number>(labels.length);
const expMetaSet = new Array<number>(labels.length);
const avgSet = new Array<number>(labels.length);
const [total, avgCount] = exposures.reduce(([total, avgCount], { exposureMeta }) => {
Function useBagEntriesImpl
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function useBagEntriesImpl (headId: AccountId32 | null, trigger: number): [boolean, AccountId32[]] {
const mod = useQueryModule();
const [[currId, { isCompleted, list }], setCurrent] = useState<[AccountId32 | null, Result]>(EMPTY);
const node = useCall<Option<PalletBagsListListNode>>(!!currId && mod.listNodes, [currId]);
Function usePolkadotPreclaimsImpl
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function usePolkadotPreclaimsImpl (): string[] {
const { allAccounts } = useAccounts();
const { api } = useApi();
const mountedRef = useIsMountedRef();
const [needsAttest, setNeedsAttest] = useState<string[]>([]);