Update polkadot-js deps (#1571)
* Update polkadot-js deps * chore: minor change * chore: updated yarn.lock * fix: tests * fix: lint issues * fix: build issues * fix: replace sleep with waitForRateLimit for better rate limiting in tests * Revert "fix: replace sleep with waitForRateLimit for better rate limiting in tests" * fix: increase sleep duration in tests for better stability * fix: remove sleep function and update State constructor for rate limiting * chore: minor change --------- Co-authored-by: Arjun Porwal <porwalarjun95@gmail.com>
This commit is contained in:
parent
5f569bcc5d
commit
3d37f5918c
@ -9,5 +9,11 @@ export default [
|
||||
rules: {
|
||||
'import/extensions': 'off'
|
||||
}
|
||||
},
|
||||
{
|
||||
files: ['**/*.spec.ts', '**/*.spec.tsx'],
|
||||
rules: {
|
||||
'deprecation/deprecation': 'off'
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
16
package.json
16
package.json
@ -51,14 +51,14 @@
|
||||
"sinon-chrome": "^3.0.1"
|
||||
},
|
||||
"resolutions": {
|
||||
"@polkadot/api": "^16.2.2",
|
||||
"@polkadot/keyring": "^13.5.2",
|
||||
"@polkadot/networks": "^13.5.2",
|
||||
"@polkadot/rpc-provider": "^16.2.2",
|
||||
"@polkadot/types": "^16.2.2",
|
||||
"@polkadot/util": "^13.5.2",
|
||||
"@polkadot/util-crypto": "^13.5.2",
|
||||
"@polkadot/x-fetch": "^13.5.2",
|
||||
"@polkadot/api": "^16.3.1",
|
||||
"@polkadot/keyring": "^13.5.3",
|
||||
"@polkadot/networks": "^13.5.3",
|
||||
"@polkadot/rpc-provider": "^16.3.1",
|
||||
"@polkadot/types": "^16.3.1",
|
||||
"@polkadot/util": "^13.5.3",
|
||||
"@polkadot/util-crypto": "^13.5.3",
|
||||
"@polkadot/x-fetch": "^13.5.3",
|
||||
"safe-buffer": "^5.2.1",
|
||||
"typescript": "^5.5.4"
|
||||
}
|
||||
|
||||
@ -21,19 +21,19 @@
|
||||
"version": "0.61.1",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"@polkadot/api": "^16.2.2",
|
||||
"@polkadot/api": "^16.3.1",
|
||||
"@polkadot/extension-chains": "0.61.1",
|
||||
"@polkadot/extension-dapp": "0.61.1",
|
||||
"@polkadot/extension-inject": "0.61.1",
|
||||
"@polkadot/keyring": "^13.5.2",
|
||||
"@polkadot/networks": "^13.5.2",
|
||||
"@polkadot/phishing": "^0.25.13",
|
||||
"@polkadot/rpc-provider": "^16.2.2",
|
||||
"@polkadot/types": "^16.2.2",
|
||||
"@polkadot/ui-keyring": "^3.15.1",
|
||||
"@polkadot/ui-settings": "^3.15.1",
|
||||
"@polkadot/util": "^13.5.2",
|
||||
"@polkadot/util-crypto": "^13.5.2",
|
||||
"@polkadot/keyring": "^13.5.3",
|
||||
"@polkadot/networks": "^13.5.3",
|
||||
"@polkadot/phishing": "^0.25.14",
|
||||
"@polkadot/rpc-provider": "^16.3.1",
|
||||
"@polkadot/types": "^16.3.1",
|
||||
"@polkadot/ui-keyring": "^3.15.2",
|
||||
"@polkadot/ui-settings": "^3.15.2",
|
||||
"@polkadot/util": "^13.5.3",
|
||||
"@polkadot/util-crypto": "^13.5.3",
|
||||
"eventemitter3": "^5.0.1",
|
||||
"rxjs": "^7.8.1",
|
||||
"tldts": "^7.0.8",
|
||||
|
||||
@ -22,8 +22,6 @@ import Extension from './Extension.js';
|
||||
import State from './State.js';
|
||||
import Tabs from './Tabs.js';
|
||||
|
||||
const sleep = () => new Promise((resolve) => setTimeout(resolve, 3000));
|
||||
|
||||
describe('Extension', () => {
|
||||
let extension: Extension;
|
||||
let state: State;
|
||||
@ -37,7 +35,7 @@ describe('Extension', () => {
|
||||
|
||||
keyring.loadAll({ store: new AccountsStore() });
|
||||
|
||||
state = new State();
|
||||
state = new State({}, 0);
|
||||
await state.init();
|
||||
tabs = new Tabs(state);
|
||||
|
||||
@ -230,24 +228,7 @@ describe('Extension', () => {
|
||||
expect(res).toEqual(true);
|
||||
});
|
||||
|
||||
it('should throw error for rate-limited signing requests', async () => {
|
||||
const registry = new TypeRegistry();
|
||||
|
||||
registry.setSignedExtensions(payload.signedExtensions);
|
||||
|
||||
await expect(
|
||||
tabs.handle(
|
||||
'1615191860871.5',
|
||||
'pub(extrinsic.sign)',
|
||||
payload,
|
||||
'http://localhost:3000',
|
||||
{} as chrome.runtime.Port
|
||||
)
|
||||
).rejects.toThrow('Rate limit exceeded. Try again later.');
|
||||
});
|
||||
|
||||
it('signs with default signed extensions - ethereum', async () => {
|
||||
await sleep();
|
||||
const ethAddress = await createAccount('ethereum');
|
||||
const ethPair = keyring.getPair(ethAddress);
|
||||
|
||||
@ -298,7 +279,6 @@ describe('Extension', () => {
|
||||
});
|
||||
|
||||
it('signs with user extensions, known types', async () => {
|
||||
await sleep();
|
||||
const types = {} as unknown as Record<string, string>;
|
||||
|
||||
const userExtensions = {
|
||||
@ -365,7 +345,6 @@ describe('Extension', () => {
|
||||
});
|
||||
|
||||
it('override default signed extension', async () => {
|
||||
await sleep();
|
||||
const types = {
|
||||
FeeExchangeV1: {
|
||||
assetId: 'Compact<AssetId>',
|
||||
@ -426,7 +405,6 @@ describe('Extension', () => {
|
||||
});
|
||||
|
||||
it('signs with user extensions, additional types', async () => {
|
||||
await sleep();
|
||||
const types = {
|
||||
myCustomType: {
|
||||
feeExchange: 'Compact<AssetId>',
|
||||
|
||||
@ -162,8 +162,10 @@ export default class State {
|
||||
|
||||
public defaultAuthAccountSelection: string[] = [];
|
||||
|
||||
constructor (providers: Providers = {}) {
|
||||
constructor (providers: Providers = {}, rateLimitInterval = 3000) {
|
||||
assert(rateLimitInterval >= 0, 'Expects non-negative number for rateLimitInterval');
|
||||
this.#providers = providers;
|
||||
this.#rateLimitInterval = rateLimitInterval;
|
||||
}
|
||||
|
||||
public async init () {
|
||||
|
||||
@ -22,9 +22,9 @@
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"@polkadot/extension-inject": "0.61.1",
|
||||
"@polkadot/networks": "^13.5.2",
|
||||
"@polkadot/util": "^13.5.2",
|
||||
"@polkadot/util-crypto": "^13.5.2",
|
||||
"@polkadot/networks": "^13.5.3",
|
||||
"@polkadot/util": "^13.5.3",
|
||||
"@polkadot/util-crypto": "^13.5.3",
|
||||
"tslib": "^2.8.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
|
||||
@ -23,8 +23,8 @@
|
||||
"dependencies": {
|
||||
"@metamask/detect-provider": "^2.0.0",
|
||||
"@polkadot/extension-inject": "0.61.1",
|
||||
"@polkadot/types": "^16.2.2",
|
||||
"@polkadot/util": "^13.5.2",
|
||||
"@polkadot/types": "^16.3.1",
|
||||
"@polkadot/util": "^13.5.3",
|
||||
"tslib": "^2.8.1",
|
||||
"web3": "^4.7.0"
|
||||
},
|
||||
|
||||
@ -22,8 +22,8 @@
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"@polkadot/extension-inject": "0.61.1",
|
||||
"@polkadot/util": "^13.5.2",
|
||||
"@polkadot/util-crypto": "^13.5.2",
|
||||
"@polkadot/util": "^13.5.3",
|
||||
"@polkadot/util-crypto": "^13.5.3",
|
||||
"tslib": "^2.8.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@ -18,12 +18,12 @@
|
||||
"version": "0.61.1",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"@polkadot/api": "^16.2.2",
|
||||
"@polkadot/rpc-provider": "^16.2.2",
|
||||
"@polkadot/types": "^16.2.2",
|
||||
"@polkadot/util": "^13.5.2",
|
||||
"@polkadot/util-crypto": "^13.5.2",
|
||||
"@polkadot/x-global": "^13.5.2",
|
||||
"@polkadot/api": "^16.3.1",
|
||||
"@polkadot/rpc-provider": "^16.3.1",
|
||||
"@polkadot/types": "^16.3.1",
|
||||
"@polkadot/util": "^13.5.3",
|
||||
"@polkadot/util-crypto": "^13.5.3",
|
||||
"@polkadot/x-global": "^13.5.3",
|
||||
"tslib": "^2.8.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@ -24,22 +24,22 @@
|
||||
"@fortawesome/react-fontawesome": "^0.2.0",
|
||||
"@paraspell/xcm-analyser": "^1.3.1",
|
||||
"@polkadot-api/merkleize-metadata": "^1.1.18",
|
||||
"@polkadot/api": "^16.2.2",
|
||||
"@polkadot/api": "^16.3.1",
|
||||
"@polkadot/extension-base": "0.61.1",
|
||||
"@polkadot/extension-chains": "0.61.1",
|
||||
"@polkadot/extension-dapp": "0.61.1",
|
||||
"@polkadot/extension-inject": "0.61.1",
|
||||
"@polkadot/hw-ledger": "^13.5.2",
|
||||
"@polkadot/keyring": "^13.5.2",
|
||||
"@polkadot/networks": "^13.5.2",
|
||||
"@polkadot/react-identicon": "^3.15.1",
|
||||
"@polkadot/react-qr": "^3.15.1",
|
||||
"@polkadot/types": "^16.2.2",
|
||||
"@polkadot/types-augment": "^16.2.2",
|
||||
"@polkadot/ui-keyring": "^3.15.1",
|
||||
"@polkadot/ui-settings": "^3.15.1",
|
||||
"@polkadot/util": "^13.5.2",
|
||||
"@polkadot/util-crypto": "^13.5.2",
|
||||
"@polkadot/hw-ledger": "^13.5.3",
|
||||
"@polkadot/keyring": "^13.5.3",
|
||||
"@polkadot/networks": "^13.5.3",
|
||||
"@polkadot/react-identicon": "^3.15.2",
|
||||
"@polkadot/react-qr": "^3.15.2",
|
||||
"@polkadot/types": "^16.3.1",
|
||||
"@polkadot/types-augment": "^16.3.1",
|
||||
"@polkadot/ui-keyring": "^3.15.2",
|
||||
"@polkadot/ui-settings": "^3.15.2",
|
||||
"@polkadot/util": "^13.5.3",
|
||||
"@polkadot/util-crypto": "^13.5.3",
|
||||
"@zxcvbn-ts/core": "^3.0.4",
|
||||
"@zxcvbn-ts/language-common": "^3.0.4",
|
||||
"@zxcvbn-ts/language-en": "^3.0.2",
|
||||
|
||||
@ -157,7 +157,7 @@ function Extrinsic ({ className, payload, request: { blockNumber, genesisHash, m
|
||||
<td className='data'>{formatNumber(payload.tip)}</td>
|
||||
</tr>
|
||||
)}
|
||||
{assetId && (
|
||||
{!!assetId && (
|
||||
<tr>
|
||||
<td className='label'>{t('assetId')}</td>
|
||||
<td className='data'>
|
||||
|
||||
@ -129,6 +129,8 @@ const mountComponent = async (addressComponentProps: AddressComponentProps, cont
|
||||
}}
|
||||
>
|
||||
<Address
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-expect-error
|
||||
actions={actions}
|
||||
{...addressComponentProps}
|
||||
/>
|
||||
|
||||
@ -291,7 +291,7 @@ function Address ({ actions, address, children, className, genesisHash, isExtern
|
||||
{showActionsMenu && (
|
||||
<Menu
|
||||
className={`movableMenu ${moveMenuUp ? 'isMoved' : ''}`}
|
||||
reference={actMenuRef}
|
||||
ref={actMenuRef}
|
||||
>
|
||||
{actions}
|
||||
</Menu>
|
||||
|
||||
@ -17,7 +17,7 @@ interface Props {
|
||||
}
|
||||
|
||||
function InputFilter ({ className, onChange, placeholder, value, withReset = false }: Props) {
|
||||
const inputRef: React.RefObject<HTMLInputElement> | null = useRef(null);
|
||||
const inputRef: React.RefObject<HTMLInputElement | null> = useRef(null);
|
||||
|
||||
const onChangeFilter = useCallback((event: React.ChangeEvent<HTMLInputElement>) => {
|
||||
onChange(event.target.value);
|
||||
@ -25,7 +25,7 @@ function InputFilter ({ className, onChange, placeholder, value, withReset = fal
|
||||
|
||||
const onResetFilter = useCallback(() => {
|
||||
onChange('');
|
||||
inputRef.current && inputRef.current.select();
|
||||
inputRef?.current && inputRef.current.select();
|
||||
}, [onChange]);
|
||||
|
||||
return (
|
||||
|
||||
@ -1,26 +1,27 @@
|
||||
// Copyright 2019-2025 @polkadot/extension-ui authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import React from 'react';
|
||||
import React, { forwardRef } from 'react';
|
||||
|
||||
import { styled } from '../styled.js';
|
||||
|
||||
interface Props {
|
||||
children: React.ReactNode;
|
||||
className?: string;
|
||||
reference: React.RefObject<HTMLDivElement>;
|
||||
}
|
||||
|
||||
function Menu ({ children, className, reference }: Props): React.ReactElement<Props> {
|
||||
const Menu = forwardRef<HTMLDivElement, Props>(({ children, className }, ref) => {
|
||||
return (
|
||||
<div
|
||||
className={className}
|
||||
ref={reference}
|
||||
ref={ref}
|
||||
>
|
||||
{children}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
Menu.displayName = 'Menu';
|
||||
|
||||
export default styled(Menu)<Props>`
|
||||
background: var(--popupBackground);
|
||||
|
||||
@ -6,7 +6,7 @@ import React from 'react';
|
||||
import { styled } from '../../styled.js';
|
||||
|
||||
interface Props {
|
||||
content: React.ReactChild;
|
||||
content: React.ReactNode;
|
||||
className?: string;
|
||||
visible?: boolean;
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@ import type { RefObject } from 'react';
|
||||
|
||||
import { useCallback, useEffect } from 'react';
|
||||
|
||||
export default function useOutsideClick (refs: RefObject<HTMLDivElement>[], callback: () => void): void {
|
||||
export default function useOutsideClick (refs: RefObject<HTMLDivElement|null>[], callback: () => void): void {
|
||||
const handleClick = useCallback((e: MouseEvent): void => {
|
||||
refs.every(({ current }) =>
|
||||
current &&
|
||||
|
||||
@ -7,15 +7,9 @@ import '@polkadot/extension-mocks/chrome';
|
||||
|
||||
import type * as _ from '@polkadot/dev-test/globals.d.ts';
|
||||
|
||||
import Adapter from '@wojtekmaj/enzyme-adapter-react-17';
|
||||
import enzyme from 'enzyme';
|
||||
|
||||
import { wakeUpServiceWorkerWrapper } from '../../extension-base/src/utils/portUtils.js';
|
||||
import { exportAccount } from './messaging.js';
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-call
|
||||
enzyme.configure({ adapter: new Adapter() });
|
||||
|
||||
describe('messaging sends message to background via extension port for', () => {
|
||||
beforeEach(() => {
|
||||
jest.spyOn(wakeUpServiceWorkerWrapper, 'wakeUpServiceWorker').mockImplementation(() => Promise.resolve({ status: 'awake' }));
|
||||
|
||||
@ -36,9 +36,9 @@ function Header ({ children, className = '', onFilter, showAdd, showBackArrow, s
|
||||
const [connectedTabsUrl, setConnectedTabsUrl] = useState<string[]>([]);
|
||||
const { t } = useTranslation();
|
||||
const addIconRef = useRef(null);
|
||||
const addMenuRef = useRef(null);
|
||||
const addMenuRef = useRef<HTMLDivElement>(null);
|
||||
const setIconRef = useRef(null);
|
||||
const setMenuRef = useRef(null);
|
||||
const setMenuRef = useRef<HTMLDivElement>(null);
|
||||
const isConnected = useMemo(() => connectedTabsUrl.length >= 1
|
||||
, [connectedTabsUrl]);
|
||||
const onAction = useContext(ActionContext);
|
||||
|
||||
@ -13,7 +13,7 @@ import { styled } from '../styled.js';
|
||||
|
||||
interface Props {
|
||||
className?: string;
|
||||
reference: React.MutableRefObject<null>;
|
||||
reference: React.RefObject<HTMLDivElement | null>;
|
||||
}
|
||||
|
||||
const jsonPath = '/account/restore-json';
|
||||
@ -41,7 +41,7 @@ function MenuAdd ({ className, reference }: Props): React.ReactElement<Props> {
|
||||
return (
|
||||
<Menu
|
||||
className={className}
|
||||
reference={reference}
|
||||
ref={reference}
|
||||
>
|
||||
<MenuItem className='menuItem'>
|
||||
<Link to={'/account/create'}>
|
||||
|
||||
@ -19,7 +19,7 @@ interface Option {
|
||||
|
||||
interface Props {
|
||||
className?: string;
|
||||
reference: React.MutableRefObject<null>;
|
||||
reference: React.RefObject<HTMLDivElement | null>;
|
||||
}
|
||||
|
||||
const notificationOptions = ['Extension', 'PopUp', 'Window']
|
||||
@ -98,7 +98,7 @@ function MenuSettings ({ className, reference }: Props): React.ReactElement<Prop
|
||||
return (
|
||||
<Menu
|
||||
className={className}
|
||||
reference={reference}
|
||||
ref={reference}
|
||||
>
|
||||
<MenuItem
|
||||
className='setting'
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
"type": "module",
|
||||
"version": "0.61.1",
|
||||
"dependencies": {
|
||||
"@polkadot/api": "^16.2.2",
|
||||
"@polkadot/api": "^16.3.1",
|
||||
"@polkadot/extension-base": "0.61.1",
|
||||
"@polkadot/extension-inject": "0.61.1",
|
||||
"@polkadot/extension-ui": "0.61.1",
|
||||
|
||||
Loading…
Reference in New Issue
Block a user