diff --git a/apps/connector/README.md b/apps/connector/README.md index e7bd73c3e..7569b7173 100644 --- a/apps/connector/README.md +++ b/apps/connector/README.md @@ -6,7 +6,7 @@ Status Desktop Wallet extended to decentralized applications in your browser. Depends on: -- Status Desktop https://github.com/status-im/status-desktop/tree/release/2.30.x +- **[Status Desktop](https://github.com/status-im/status-desktop/releases)** >=2.32.x Tested with these browsers: @@ -87,6 +87,18 @@ Firefox Developer Edition > Tools > Add-ons and Themes > click on gear icon (Too > Note: Does not reload automatically, requires build and load on change. +### Status Desktop + +#### Run + +##### macOS + +```bash +FLAG_CONNECTOR_ENABLED=1 '/Volumes/Status Desktop/Status.app/Contents/MacOS/nim_status_client' +``` + +> Tip: Point to the installer package location without dropping and replacing current app. + ## Testing Download latest build from last merged PR or build from source. To use the extension see the load steps from [Development](#development) section. diff --git a/apps/connector/eslint.config.mjs b/apps/connector/eslint.config.mjs index 221ad6ac3..24a7e5f29 100644 --- a/apps/connector/eslint.config.mjs +++ b/apps/connector/eslint.config.mjs @@ -5,7 +5,7 @@ export default [ ...configs, ...tailwindcssConfigs, { - files: ['*.ts', '*.tsx'], + files: ['**/*.ts', '**/*.tsx'], rules: { 'no-constant-binary-expression': 'error', 'no-restricted-globals': ['error', 'process'], @@ -15,10 +15,11 @@ export default [ img: [], }, ], + 'no-empty': 'warn', }, }, { - files: ['*.mjs'], + files: ['**/*.mjs'], languageOptions: { parserOptions: { ecmaVersion: 'latest', @@ -27,11 +28,14 @@ export default [ }, }, { - files: ['*.js'], + files: ['**/*.js'], languageOptions: { parserOptions: { ecmaVersion: 'latest', }, }, }, + { + ignores: ['.plasmo'], + }, ] diff --git a/apps/connector/package.json b/apps/connector/package.json index 4e603ec80..046be1458 100644 --- a/apps/connector/package.json +++ b/apps/connector/package.json @@ -58,11 +58,14 @@ }, "manifest": { "manifest_version": 3, - "name": "A wallet connector by Status BETA", - "description": "THIS EXTENSION IS FOR BETA TESTING. Status Desktop Wallet extended to decentralised applications in your browser.", + "name": "A wallet connector by Status", + "description": "Status Desktop Wallet extended to decentralised applications in your browser.", + "externally_connectable": { + "ids": [], + "matches": [] + }, "host_permissions": [ - "https://*/*", - "https://chromewebstore.google.com/*" + "https://*/*" ], "permissions": [ "storage" diff --git a/apps/connector/src/contents/provider.ts b/apps/connector/src/contents/provider.ts index 6b0a09b39..20ef00f31 100644 --- a/apps/connector/src/contents/provider.ts +++ b/apps/connector/src/contents/provider.ts @@ -96,15 +96,11 @@ export class Provider { this.#listeners.get('connect')?.({ chainId: '0x1' }) this.#listeners.get('connected')?.({ chainId: '0x1' }) this.connected = true - - console.log('connected::') } if (method === 'wallet_switchEthereumChain') { this.#listeners.get('chainChanged')?.(message.data) this.#listeners.get('networkChanged')?.(message.data) - - console.log('chainChanged::') } resolve(message.data) @@ -112,8 +108,6 @@ export class Provider { return } case 'status:proxy:error': { - console.error(message.error) - // note: for those dApps that make call after having permissions revoked if ( message.error.message === 'dApp is not permitted by user' && @@ -154,21 +148,15 @@ export class Provider { } public on(event: Event, handler: (args: unknown) => void): void { - console.log('on::', event, handler) - this.#listeners.set(event, handler) } /** @deprecated */ - public async close(...args: unknown[]): Promise { - console.log('close::', args) - + public async close(): Promise { this.disconnect() } - public removeListener(event: Event, handler: (args: unknown) => void): void { - console.log('removeListener::', event, handler) - + public removeListener(event: Event): void { // note: not all dapps remove these on disconnect if (event === 'close' || event === 'disconnect') { this.disconnect() @@ -177,6 +165,10 @@ export class Provider { this.#listeners.delete(event) } + public async enable() { + return true + } + private async disconnect() { if (!this.connected) { return @@ -184,8 +176,6 @@ export class Provider { this.connected = false - console.log('disconnect::') - await this.request({ method: 'wallet_revokePermissions', params: [ diff --git a/apps/connector/src/contents/proxy.ts b/apps/connector/src/contents/proxy.ts index 2ebed7341..92c269986 100644 --- a/apps/connector/src/contents/proxy.ts +++ b/apps/connector/src/contents/proxy.ts @@ -39,8 +39,6 @@ const handleMessage = async (event: MessageEvent) => { } try { - console.log('request::', message.data) - const response = await desktopClient.send({ ...message.data, name: window.location.hostname, @@ -48,8 +46,6 @@ const handleMessage = async (event: MessageEvent) => { iconUrl: getFaviconUrl() ?? '', }) - console.log('response::', response) - event.ports[0].postMessage({ type: 'status:proxy:success', data: response, diff --git a/apps/connector/src/hooks/use-local-storage.tsx b/apps/connector/src/hooks/use-local-storage.tsx index 1cef79aab..b3cd0ca79 100644 --- a/apps/connector/src/hooks/use-local-storage.tsx +++ b/apps/connector/src/hooks/use-local-storage.tsx @@ -10,8 +10,7 @@ export function useLocalStorage( try { const item = window.localStorage.getItem(key) setStoredValue(item ? JSON.parse(item) : initialValue) - } catch (error) { - console.log(error) + } catch { setStoredValue(initialValue) } }, []) @@ -40,9 +39,7 @@ export function useLocalStorage( setStoredValue(valueToStore) window.localStorage.setItem(key, JSON.stringify(valueToStore)) window.dispatchEvent(new Event('storage')) - } catch (error) { - console.log(error) - } + } catch {} } return [storedValue, setValue] diff --git a/apps/connector/src/lib/desktop-client.ts b/apps/connector/src/lib/desktop-client.ts index 7549be5b0..8a1b1862b 100644 --- a/apps/connector/src/lib/desktop-client.ts +++ b/apps/connector/src/lib/desktop-client.ts @@ -19,7 +19,6 @@ export class DesktopClient { return } - console.log('stop::') this.#rpcClient?.destroy() this.#rpcClient = null @@ -28,7 +27,6 @@ export class DesktopClient { public async send(args: DesktopRequestArguments) { if (!this.#rpcClient) { - console.log('start::') this.#rpcClient = new WebSocketProvider( config.desktop.rpc.url, 'mainnet', @@ -43,11 +41,6 @@ export class DesktopClient { await waitUntilOpen(this.#rpcClient.websocket) - console.log('client::', { - method: config.desktop.rpc.method, - params: [JSON.stringify(args)], - }) - return await this.#rpcClient.send(config.desktop.rpc.method, [ JSON.stringify(args), ]) @@ -78,10 +71,6 @@ async function waitUntilOpen(websocket: WebSocketLike) { reject(new Error('Timed out to connect to the RPC server')) }, 30 * 1000) - if (websocket.readyState === WebSocket.CONNECTING) { - console.info('Waiting for the RPC server to connect') - } - const onopen = websocket.onopen?.bind(websocket) websocket.onopen = event => { onopen?.(event)