Skip to content

Commit 62a1105

Browse files
authored
chore: Remove PolkaGate snap (#216)
1 parent c762365 commit 62a1105

File tree

6 files changed

+21
-1166
lines changed

6 files changed

+21
-1166
lines changed

library/extension-assets/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@w3ux/extension-assets-source",
33
"license": "GPL-3.0-only",
4-
"version": "2.0.0",
4+
"version": "2.1.0",
55
"type": "module",
66
"scripts": {
77
"clear": "rm -rf node_modules dist tsconfig.tsbuildinfo",

library/extension-assets/src/PolkaGateSnap/icon.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.

library/extension-assets/src/PolkaGateSnap/info.json

Lines changed: 0 additions & 11 deletions
This file was deleted.

library/react-connect-kit/package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
{
22
"name": "@w3ux/react-connect-kit-source",
33
"license": "GPL-3.0-only",
4-
"version": "3.0.4",
4+
"version": "3.0.5",
55
"type": "module",
66
"scripts": {
77
"clear": "rm -rf node_modules dist tsconfig.tsbuildinfo",
88
"build": "gulp --silent"
99
},
1010
"dependencies": {
11-
"@polkagate/extension-dapp": "^0.48.2",
12-
"@w3ux/extension-assets": "^2.0.0",
11+
"@w3ux/extension-assets": "^2.1.0",
1312
"@w3ux/hooks": "^2.0.4",
1413
"@w3ux/utils": "^2.0.6"
1514
},

library/react-connect-kit/src/ExtensionsProvider/index.tsx

Lines changed: 10 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,18 @@
11
/* @license Copyright 2024 w3ux authors & contributors
22
SPDX-License-Identifier: GPL-3.0-only */
33

4-
import { web3Enable } from '@polkagate/extension-dapp'
54
import extensions from '@w3ux/extension-assets'
65
import { createSafeContext } from '@w3ux/hooks'
76
import type { ExtensionStatus } from '@w3ux/types'
8-
import { setStateWithRef, withTimeout } from '@w3ux/utils'
7+
import { setStateWithRef } from '@w3ux/utils'
98
import type { ReactNode } from 'react'
109
import { useEffect, useRef, useState } from 'react'
1110
import type { ExtensionsContextInterface } from './types'
1211

1312
export const [ExtensionsContext, useExtensions] =
1413
createSafeContext<ExtensionsContextInterface>()
1514

16-
export const ExtensionsProvider = ({
17-
children,
18-
options,
19-
}: {
20-
children: ReactNode
21-
options?: {
22-
chainSafeSnapEnabled?: boolean
23-
polkagateSnapEnabled?: boolean
24-
}
25-
}) => {
15+
export const ExtensionsProvider = ({ children }: { children: ReactNode }) => {
2616
// Store whether initial `injectedWeb3` checking is underway.
2717
//
2818
// Injecting `injectedWeb3` is an asynchronous process, so we need to check for its existence for
@@ -40,11 +30,6 @@ export const ExtensionsProvider = ({
4030
>({})
4131
const extensionsStatusRef = useRef(extensionsStatus)
4232

43-
// Store whether Metamask Snaps are enabled.
44-
const [polkaGateSnapEnabled] = useState<boolean>(
45-
options?.polkagateSnapEnabled || false
46-
)
47-
4833
// Listen for window.injectedWeb3 with an interval.
4934
let injectedWeb3Interval: ReturnType<typeof setInterval>
5035
const injectCounter = useRef<number>(0)
@@ -54,18 +39,12 @@ export const ExtensionsProvider = ({
5439
// Clear interval and move on to checking for Metamask Polkadot Snap.
5540
const handleClearInterval = async (hasInjectedWeb3: boolean) => {
5641
clearInterval(injectedWeb3Interval)
57-
58-
// Check if Metamask PolkaGate Snap is available.
59-
if (polkaGateSnapEnabled) {
60-
await withTimeout(500, web3Enable('snap_only'))
61-
62-
if (hasInjectedWeb3) {
63-
setStateWithRef(
64-
getExtensionsStatus(),
65-
setExtensionsStatus,
66-
extensionsStatusRef
67-
)
68-
}
42+
if (hasInjectedWeb3) {
43+
setStateWithRef(
44+
getExtensionsStatus(),
45+
setExtensionsStatus,
46+
extensionsStatusRef
47+
)
6948
}
7049
setStateWithRef(false, setCheckingInjectedWeb3, checkingInjectedWeb3Ref)
7150
}
@@ -134,9 +113,8 @@ export const ExtensionsProvider = ({
134113
}
135114
}
136115

137-
// Check for `injectedWeb3` and Metamask Snap on mount. To trigger interval on soft page
138-
// refreshes, no empty dependency array is provided to this `useEffect`. Checks for `injectedWeb3`
139-
// for a total of 3 seconds before giving up.
116+
// To trigger interval on soft page refreshes, no empty dependency array is provided to this
117+
// `useEffect`. Checks for `injectedWeb3` for a total of 3 seconds before giving up.
140118
//
141119
// Interval duration.
142120
const checkEveryMs = 300

0 commit comments

Comments
 (0)