Cleanup compat deps (#812)

* Cleanup compat deps

* yarn.lock
This commit is contained in:
Jaco 2021-09-06 11:04:39 +03:00 committed by GitHub
parent 56d7619166
commit d0f64a591e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 55 additions and 59 deletions

View File

@ -8,10 +8,10 @@
"packages/*"
],
"resolutions": {
"@polkadot/api": "^5.7.2-7",
"@polkadot/api": "^5.7.2-8",
"@polkadot/keyring": "^7.3.1",
"@polkadot/networks": "^7.3.1",
"@polkadot/types": "^5.7.2-7",
"@polkadot/types": "^5.7.2-8",
"@polkadot/util": "^7.3.1",
"@polkadot/util-crypto": "^7.3.1",
"@polkadot/x-fetch": "^7.3.1",

View File

@ -9,7 +9,7 @@
"sideEffects": false,
"dependencies": {
"@babel/runtime": "^7.15.3",
"@polkadot/api": "^5.7.2-7",
"@polkadot/api": "^5.7.2-8",
"@polkadot/extension-dapp": "^0.39.4-9",
"@polkadot/extension-inject": "^0.39.4-9",
"@polkadot/keyring": "^7.3.1",

View File

@ -12,11 +12,9 @@
"@metamask/detect-provider": "^1.2.0",
"@polkadot/extension-inject": "^0.39.4-9",
"@polkadot/util": "^7.3.1",
"@polkadot/util-crypto": "^7.3.1",
"web3": "^1.5.2"
},
"peerDependencies": {
"@polkadot/util": "*",
"@polkadot/util-crypto": "*"
"@polkadot/util": "*"
}
}

View File

@ -2,11 +2,11 @@
// SPDX-License-Identifier: Apache-2.0
import type { Injected, InjectedAccount, InjectedWindow } from '@polkadot/extension-inject/types';
import type { SignerPayloadRaw, SignerResult } from '@polkadot/types/types';
import detectEthereumProvider from '@metamask/detect-provider';
import Web3 from 'web3';
import { SignerPayloadRaw, SignerResult } from '@polkadot/types/types';
import { assert } from '@polkadot/util';
interface RequestArguments {
@ -49,17 +49,17 @@ function injectMetaMaskWeb3 (win: Web3Window): void {
// decorate the compat interface
win.injectedWeb3.Web3Source = {
enable: async (): Promise<Injected> => {
const providerRaw: unknown = await detectEthereumProvider({ mustBeMetaMask: true });
const provider: EthereumProvider = isMetaMaskProvider(providerRaw);
const providerRaw = await detectEthereumProvider({ mustBeMetaMask: true });
const provider = isMetaMaskProvider(providerRaw);
await provider.request({ method: 'eth_requestAccounts' });
return {
accounts: {
get: async (): Promise<InjectedAccount[]> => {
const response = await provider.request({ method: 'eth_requestAccounts' });
const response = (await provider.request({ method: 'eth_requestAccounts' })) as string[];
return transformAccounts(response as string[]);
return transformAccounts(response);
},
subscribe: (cb: (accounts: InjectedAccount[]) => void): (() => void) => {
const sub = provider.on('accountsChanged', (accounts): void => {
@ -74,9 +74,9 @@ function injectMetaMaskWeb3 (win: Web3Window): void {
},
signer: {
signRaw: async (raw: SignerPayloadRaw): Promise<SignerResult> => {
const signature = await provider.request({ method: 'eth_sign', params: [raw.address, Web3.utils.sha3(raw.data)] });
const signature = (await provider.request({ method: 'eth_sign', params: [raw.address, Web3.utils.sha3(raw.data)] })) as string;
return { id: 0, signature: signature as string };
return { id: 0, signature };
}
}
};

View File

@ -69,7 +69,7 @@ export function web3Enable (originName: string, compatInits: (() => Promise<bool
}
const initCompat = compatInits.length
? Promise.all(compatInits.map((c) => c()))
? Promise.all(compatInits.map((c) => c().catch(() => false)))
: Promise.resolve([true]);
web3EnablePromise = documentReadyPromise(

View File

@ -2295,37 +2295,37 @@ __metadata:
languageName: node
linkType: hard
"@polkadot/api-derive@npm:5.7.2-7":
version: 5.7.2-7
resolution: "@polkadot/api-derive@npm:5.7.2-7"
"@polkadot/api-derive@npm:5.7.2-8":
version: 5.7.2-8
resolution: "@polkadot/api-derive@npm:5.7.2-8"
dependencies:
"@babel/runtime": ^7.15.3
"@polkadot/api": 5.7.2-7
"@polkadot/rpc-core": 5.7.2-7
"@polkadot/types": 5.7.2-7
"@babel/runtime": ^7.15.4
"@polkadot/api": 5.7.2-8
"@polkadot/rpc-core": 5.7.2-8
"@polkadot/types": 5.7.2-8
"@polkadot/util": ^7.3.1
"@polkadot/util-crypto": ^7.3.1
rxjs: ^7.3.0
checksum: 0ce0c10bb86fe5d4084a0fa6daaec50b62103492efc2602996d1eee8898c2849e35610801a0330fdfe6aee20149d5c222ba76577749a1add6b2c61cdbed08db8
checksum: c729710326fb31bf40ec90ff8a8f262b657d531f33b314b1a8cda2cbf1d14f2eb9821c38c6a769f2348f486d9a3b0d8118fa01adf55851e6272007405d7c8c0e
languageName: node
linkType: hard
"@polkadot/api@npm:^5.7.2-7":
version: 5.7.2-7
resolution: "@polkadot/api@npm:5.7.2-7"
"@polkadot/api@npm:^5.7.2-8":
version: 5.7.2-8
resolution: "@polkadot/api@npm:5.7.2-8"
dependencies:
"@babel/runtime": ^7.15.3
"@polkadot/api-derive": 5.7.2-7
"@babel/runtime": ^7.15.4
"@polkadot/api-derive": 5.7.2-8
"@polkadot/keyring": ^7.3.1
"@polkadot/rpc-core": 5.7.2-7
"@polkadot/rpc-provider": 5.7.2-7
"@polkadot/types": 5.7.2-7
"@polkadot/types-known": 5.7.2-7
"@polkadot/rpc-core": 5.7.2-8
"@polkadot/rpc-provider": 5.7.2-8
"@polkadot/types": 5.7.2-8
"@polkadot/types-known": 5.7.2-8
"@polkadot/util": ^7.3.1
"@polkadot/util-crypto": ^7.3.1
eventemitter3: ^4.0.7
rxjs: ^7.3.0
checksum: d7a169b9e26eff25c021b02f685afe3ab00b06de18b0d480fd4402b489232af9929fe65fb11ab3c079c31d0180b3dd085b21168e5f2809c78de2867ce48c03a7
checksum: 975b97b7bbb2273e9043b41328f2f1db7c27056f2ae9f097dd14a6f06b67579d83492f8f43c13ae0542852b4f73a4c1f5a5857fff000ee9cb1b87eb0e77a5bf5
languageName: node
linkType: hard
@ -2428,7 +2428,7 @@ __metadata:
resolution: "@polkadot/extension-base@workspace:packages/extension-base"
dependencies:
"@babel/runtime": ^7.15.3
"@polkadot/api": ^5.7.2-7
"@polkadot/api": ^5.7.2-8
"@polkadot/extension-dapp": ^0.39.4-9
"@polkadot/extension-inject": ^0.39.4-9
"@polkadot/keyring": ^7.3.1
@ -2456,11 +2456,9 @@ __metadata:
"@metamask/detect-provider": ^1.2.0
"@polkadot/extension-inject": ^0.39.4-9
"@polkadot/util": ^7.3.1
"@polkadot/util-crypto": ^7.3.1
web3: ^1.5.2
peerDependencies:
"@polkadot/util": "*"
"@polkadot/util-crypto": "*"
languageName: unknown
linkType: soft
@ -2676,56 +2674,56 @@ __metadata:
languageName: node
linkType: hard
"@polkadot/rpc-core@npm:5.7.2-7":
version: 5.7.2-7
resolution: "@polkadot/rpc-core@npm:5.7.2-7"
"@polkadot/rpc-core@npm:5.7.2-8":
version: 5.7.2-8
resolution: "@polkadot/rpc-core@npm:5.7.2-8"
dependencies:
"@babel/runtime": ^7.15.3
"@polkadot/rpc-provider": 5.7.2-7
"@polkadot/types": 5.7.2-7
"@babel/runtime": ^7.15.4
"@polkadot/rpc-provider": 5.7.2-8
"@polkadot/types": 5.7.2-8
"@polkadot/util": ^7.3.1
rxjs: ^7.3.0
checksum: d0d015cd48221ba8b935bd8f616aa82fc881e81fe684a72ae849d546934557bba81ff025f0738b8f244a2d8970d12a17268d165dc2ec311d6e75b3043372138c
checksum: c85115454da6035351cdbf9fdb80fed349b0830108d7a115be1f708ba2eab9e302824880cf619fd2edf7a7df8860a50e91618d74cbe440b5c86bda12b5c6e96a
languageName: node
linkType: hard
"@polkadot/rpc-provider@npm:5.7.2-7":
version: 5.7.2-7
resolution: "@polkadot/rpc-provider@npm:5.7.2-7"
"@polkadot/rpc-provider@npm:5.7.2-8":
version: 5.7.2-8
resolution: "@polkadot/rpc-provider@npm:5.7.2-8"
dependencies:
"@babel/runtime": ^7.15.3
"@polkadot/types": 5.7.2-7
"@babel/runtime": ^7.15.4
"@polkadot/types": 5.7.2-8
"@polkadot/util": ^7.3.1
"@polkadot/util-crypto": ^7.3.1
"@polkadot/x-fetch": ^7.3.1
"@polkadot/x-global": ^7.3.1
"@polkadot/x-ws": ^7.3.1
eventemitter3: ^4.0.7
checksum: 48db174daf4863a6918b9ab73f4657ef34b125a8c5e92e23e17ab8a9d5501dca961ca1c976aa56846731d9328c4d6844a25fbd844f0ee55230b90f83138da007
checksum: 2bdcb1388007f67992a2f8aecfc7e99398d75b9954d418ff0632c9b797b0fe65457d91a9d0c6f8b513f3a4e90c5803c7e42a13820b23ce9a341cdac62f374695
languageName: node
linkType: hard
"@polkadot/types-known@npm:5.7.2-7":
version: 5.7.2-7
resolution: "@polkadot/types-known@npm:5.7.2-7"
"@polkadot/types-known@npm:5.7.2-8":
version: 5.7.2-8
resolution: "@polkadot/types-known@npm:5.7.2-8"
dependencies:
"@babel/runtime": ^7.15.3
"@babel/runtime": ^7.15.4
"@polkadot/networks": ^7.3.1
"@polkadot/types": 5.7.2-7
"@polkadot/types": 5.7.2-8
"@polkadot/util": ^7.3.1
checksum: 08e6a9a0cb38e99aeb783e69533c68393d2eb1e7f961d0e7e0fc7bce89b1419a447d181b0383171055c5dad66e986bc7f51c9f2633c15e42f0257d509d6b5f89
checksum: 7d26b0be050755403fd19dc801c63e3395d67ec6372e656ef2caf1ef67fbcb3dcc90ab902eba7f7db4534d45d7de64d16074ec744ae4c1f4aab76c92797f3929
languageName: node
linkType: hard
"@polkadot/types@npm:^5.7.2-7":
version: 5.7.2-7
resolution: "@polkadot/types@npm:5.7.2-7"
"@polkadot/types@npm:^5.7.2-8":
version: 5.7.2-8
resolution: "@polkadot/types@npm:5.7.2-8"
dependencies:
"@babel/runtime": ^7.15.3
"@babel/runtime": ^7.15.4
"@polkadot/util": ^7.3.1
"@polkadot/util-crypto": ^7.3.1
rxjs: ^7.3.0
checksum: a5f7a0e40b3b5925c7a4aa4748c872add6d860c0d72903a8db7912e3bf424e628829fa874efba615c6e42f7dd7ff9fdf5b5aa48ae275cdb77e9fd5e78e999687
checksum: ca0c8615bf946438e47b30491510476526d1431049ff608970a81beb8234984c5fe9451812efe4f7675ad781539e938a5c4122d52c2e19ad68bfeac691554527
languageName: node
linkType: hard