Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions packages/extension-polkagate/src/class/subscanQueue.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
// Copyright 2019-2026 @polkadot/extension-polkagate authors & contributors
// SPDX-License-Identifier: Apache-2.0

const MAX_REQUESTS_PER_SECOND = 3;
import { SUBSCAN_FREE_REQUESTS_PER_SECOND } from '../util/subscanLimits';

const MAX_REQUESTS_PER_SECOND = SUBSCAN_FREE_REQUESTS_PER_SECOND;

interface QueueTask<T> {
fn: () => Promise<T>;
Expand Down Expand Up @@ -58,5 +60,4 @@ class SubscanRequestQueue {
}
}

// Subscan free tier: 5 req/sec
export const subscanQueue = new SubscanRequestQueue(MAX_REQUESTS_PER_SECOND);
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
// Copyright 2019-2026 @polkadot/extension-polkagate authors & contributors
// SPDX-License-Identifier: Apache-2.0

export const TRANSFERS_PAGE_SIZE = 50;
export const EXTRINSICS_PAGE_SIZE = 60;
import { SUBSCAN_FREE_PAGE_SIZE } from '../../../util/subscanLimits';

export const TRANSFERS_PAGE_SIZE = SUBSCAN_FREE_PAGE_SIZE;
export const EXTRINSICS_PAGE_SIZE = SUBSCAN_FREE_PAGE_SIZE;
export const MAX_LOCAL_HISTORY_ITEMS = 20; // Maximum number of items to store locally
export const DEBUG = false; // Toggle for enabling/disabling logs

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@
import type { NotificationsType } from './types';

import { KUSAMA_GENESIS_HASH, PASEO_GENESIS_HASH, POLKADOT_GENESIS_HASH, WESTEND_GENESIS_HASH } from '../../util/constants';
import { SUBSCAN_FREE_PAGE_SIZE } from '../../util/subscanLimits';

export const NOTIFICATION_GOVERNANCE_CHAINS = ['kusama', 'polkadot'];

export const RECEIVED_FUNDS_THRESHOLD = 15;
export const RECEIVED_REWARDS_THRESHOLD = 10;
export const REFERENDA_COUNT_TO_TRACK_DOT = 50;
export const REFERENDA_COUNT_TO_TRACK_DOT = SUBSCAN_FREE_PAGE_SIZE;
export const REFERENDA_COUNT_TO_TRACK_KSM = 10;

export const NOT_READ_BGCOLOR = '#ECF6FE';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import type { TransferRequest } from '../types';

import { getLink } from '@polkadot/extension-polkagate/src/popup/history/explorer';

import { SUBSCAN_FREE_PAGE_SIZE } from '../subscanLimits';
import { fetchFromSubscan } from '..';

export function getNominationPoolsClaimedRewards(chainName: string, address: string, pageSize: number): Promise<TransferRequest> {
Expand All @@ -25,6 +26,6 @@ export function getNominationPoolsClaimedRewards(chainName: string, address: str
return fetchFromSubscan(link,
{
address,
row: pageSize
row: Math.min(pageSize, SUBSCAN_FREE_PAGE_SIZE)
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import type { TransferRequest } from '../types';

import { getLink } from '@polkadot/extension-polkagate/src/popup/history/explorer';

import { SUBSCAN_FREE_PAGE_SIZE } from '../subscanLimits';
import { fetchFromSubscan } from '..';

export default function getRewardsSlashes(chainName: string, address: string, filter: 'unclaimed' | 'claimed'): Promise<TransferRequest> {
Expand All @@ -27,6 +28,6 @@ export default function getRewardsSlashes(chainName: string, address: string, fi
category: 'Reward',
claimed_filter: filter,
is_stash: true,
row: 100
row: SUBSCAN_FREE_PAGE_SIZE
});
}
3 changes: 2 additions & 1 deletion packages/extension-polkagate/src/util/api/getTransfers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { getLink } from '@polkadot/extension-polkagate/src/popup/history/explore
import { keyMaker } from '@polkadot/extension-polkagate/src/popup/history/hookUtils/utils';

import getChainName from '../getChainName';
import { SUBSCAN_FREE_PAGE_SIZE } from '../subscanLimits';
import { fetchFromSubscan } from '..';

function nullifier(requested: string) {
Expand Down Expand Up @@ -51,7 +52,7 @@ export async function getTxTransfers(address: string, genesisHash: string, pageN
address,
direction: 'received',
page: pageNum,
row: pageSize
row: Math.min(pageSize, SUBSCAN_FREE_PAGE_SIZE)
});

if (!transferRequest.data.transfers) {
Expand Down
5 changes: 5 additions & 0 deletions packages/extension-polkagate/src/util/subscanLimits.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// Copyright 2019-2026 @polkadot/extension-polkagate authors & contributors
// SPDX-License-Identifier: Apache-2.0

export const SUBSCAN_FREE_PAGE_SIZE = 25;
export const SUBSCAN_FREE_REQUESTS_PER_SECOND = 2;
Loading