From 79fafd897d19839129b9ab9f38c0ca12e92bd64f Mon Sep 17 00:00:00 2001 From: mucahit Date: Thu, 7 Apr 2022 17:19:40 +0300 Subject: [PATCH] fix: Remove unnecessary dependendices --- package-lock.json | 176 ++------------------------- package.json | 9 +- src/PeraWalletConnect.tsx | 12 +- src/modal/PeraWalletConnectModal.tsx | 19 ++- 4 files changed, 33 insertions(+), 183 deletions(-) diff --git a/package-lock.json b/package-lock.json index fd1455a..6fda173 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,21 +1,18 @@ { "name": "@perawallet/connect", - "version": "0.0.2", + "version": "0.0.3", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@perawallet/connect", - "version": "0.0.2", + "version": "0.0.3", "license": "ISC", "dependencies": { - "@hipo/react-ui-toolkit": "^1.0.0-beta", "@json-rpc-tools/utils": "^1.7.6", "@walletconnect/client": "^1.7.7", "algosdk": "^1.15.0", "buffer": "^6.0.3", - "react": "^17.0.2", - "react-dom": "^17.0.2", "react-qr-code": "^2.0.5" }, "devDependencies": { @@ -38,6 +35,10 @@ "rollup-plugin-typescript2": "^0.31.2", "sass": "^1.49.11", "typescript": "^4.6.3" + }, + "peerDependencies": { + "react": "^17.0.2", + "react-dom": "^17.0.2" } }, "node_modules/@ampproject/remapping": { @@ -517,17 +518,6 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/runtime": { - "version": "7.17.8", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.17.8.tgz", - "integrity": "sha512-dQpEpK0O9o6lj6oPu0gRDbbnk+4LeHlNcBpspf6Olzt3GIX4P1lWF1gS+pHLDFlaJvbR6q7jCfQ08zA4QJBnmA==", - "dependencies": { - "regenerator-runtime": "^0.13.4" - }, - "engines": { - "node": ">=6.9.0" - } - }, "node_modules/@babel/template": { "version": "7.16.7", "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.16.7.tgz", @@ -642,20 +632,6 @@ "@typescript-eslint/parser": "^5.9.1" } }, - "node_modules/@hipo/react-ui-toolkit": { - "version": "1.0.0-beta", - "resolved": "https://registry.npmjs.org/@hipo/react-ui-toolkit/-/react-ui-toolkit-1.0.0-beta.tgz", - "integrity": "sha512-TrvumyubqeYZp2sZw0TJlG/ZWx61EWW23ChUengeR2JGcCwQqnR4AsFzuua4V/r8f38CyzqfMOMlZ/V5rABz7A==", - "dependencies": { - "classnames": "2.3.1", - "react-textarea-autosize": "8.3.2", - "uuid": "8.3.2" - }, - "peerDependencies": { - "react": "17.0.2", - "react-dom": "17.0.2" - } - }, "node_modules/@humanwhocodes/config-array": { "version": "0.9.5", "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.9.5.tgz", @@ -1876,11 +1852,6 @@ "node": ">=10" } }, - "node_modules/classnames": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/classnames/-/classnames-2.3.1.tgz", - "integrity": "sha512-OlQdbZ7gLfGarSqxesMesDa5uz7KFbID8Kpq/SxIoNGDqY8lSYs0D+hhtBXhcdB3rcbXArFr7vlHheLk1voeNA==" - }, "node_modules/clean-stack": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", @@ -6316,6 +6287,7 @@ "version": "17.0.2", "resolved": "https://registry.npmjs.org/react/-/react-17.0.2.tgz", "integrity": "sha512-gnhPt75i/dq/z3/6q/0asP78D0u592D5L1pd7M8P+dck6Fu/jJeL6iVVK23fptSUZj8Vjf++7wXA8UNclGQcbA==", + "peer": true, "dependencies": { "loose-envify": "^1.1.0", "object-assign": "^4.1.1" @@ -6328,6 +6300,7 @@ "version": "17.0.2", "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-17.0.2.tgz", "integrity": "sha512-s4h96KtLDUQlsENhMn1ar8t2bEa+q/YAtj8pPPdIjPDGBDIVNsrD9aXNWqspUe6AzKCIG0C1HZZLqLV7qpOBGA==", + "peer": true, "dependencies": { "loose-envify": "^1.1.0", "object-assign": "^4.1.1", @@ -6589,22 +6562,6 @@ "node": ">=4.0.0" } }, - "node_modules/react-textarea-autosize": { - "version": "8.3.2", - "resolved": "https://registry.npmjs.org/react-textarea-autosize/-/react-textarea-autosize-8.3.2.tgz", - "integrity": "sha512-JrMWVgQSaExQByP3ggI1eA8zF4mF0+ddVuX7acUeK2V7bmrpjVOY72vmLz2IXFJSAXoY3D80nEzrn0GWajWK3Q==", - "dependencies": { - "@babel/runtime": "^7.10.2", - "use-composed-ref": "^1.0.0", - "use-latest": "^1.0.0" - }, - "engines": { - "node": ">=10" - }, - "peerDependencies": { - "react": "^16.8.0 || ^17.0.0" - } - }, "node_modules/read-pkg": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-5.2.0.tgz", @@ -6790,11 +6747,6 @@ "node": ">=8" } }, - "node_modules/regenerator-runtime": { - "version": "0.13.9", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.9.tgz", - "integrity": "sha512-p3VT+cOEgxFsRRA9X4lkI1E+k2/CtnKtU4gcxyaCUreilL/vqI6CdZ3wxVUx3UOUg+gnUOQQcRI7BmSI656MYA==" - }, "node_modules/regexp.prototype.flags": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.4.1.tgz", @@ -7657,6 +7609,7 @@ "version": "0.20.2", "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.20.2.tgz", "integrity": "sha512-2eWfGgAqqWFGqtdMmcL5zCMK1U8KlXv8SQFGglL3CEtd0aDVDWgeF/YoCmvln55m5zSk3J/20hTaSBeSObsQDQ==", + "peer": true, "dependencies": { "loose-envify": "^1.1.0", "object-assign": "^4.1.1" @@ -8634,43 +8587,6 @@ "requires-port": "^1.0.0" } }, - "node_modules/use-composed-ref": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/use-composed-ref/-/use-composed-ref-1.2.1.tgz", - "integrity": "sha512-6+X1FLlIcjvFMAeAD/hcxDT8tmyrWnbSPMU0EnxQuDLIxokuFzWliXBiYZuGIx+mrAMLBw0WFfCkaPw8ebzAhw==", - "peerDependencies": { - "react": "^16.8.0 || ^17.0.0" - } - }, - "node_modules/use-isomorphic-layout-effect": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/use-isomorphic-layout-effect/-/use-isomorphic-layout-effect-1.1.2.tgz", - "integrity": "sha512-49L8yCO3iGT/ZF9QttjwLF/ZD9Iwto5LnH5LmEdk/6cFmXddqi2ulF0edxTwjj+7mqvpVVGQWvbXZdn32wRSHA==", - "peerDependencies": { - "react": "^16.8.0 || ^17.0.0 || ^18.0.0" - }, - "peerDependenciesMeta": { - "@types/react": { - "optional": true - } - } - }, - "node_modules/use-latest": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/use-latest/-/use-latest-1.2.0.tgz", - "integrity": "sha512-d2TEuG6nSLKQLAfW3By8mKr8HurOlTkul0sOpxbClIv4SQ4iOd7BYr7VIzdbktUCnv7dua/60xzd8igMU6jmyw==", - "dependencies": { - "use-isomorphic-layout-effect": "^1.0.0" - }, - "peerDependencies": { - "react": "^16.8.0 || ^17.0.0" - }, - "peerDependenciesMeta": { - "@types/react": { - "optional": true - } - } - }, "node_modules/util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", @@ -8691,14 +8607,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/uuid": { - "version": "8.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", - "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", - "bin": { - "uuid": "dist/bin/uuid" - } - }, "node_modules/v8-compile-cache": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz", @@ -9270,14 +9178,6 @@ "@babel/plugin-transform-react-pure-annotations": "^7.16.7" } }, - "@babel/runtime": { - "version": "7.17.8", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.17.8.tgz", - "integrity": "sha512-dQpEpK0O9o6lj6oPu0gRDbbnk+4LeHlNcBpspf6Olzt3GIX4P1lWF1gS+pHLDFlaJvbR6q7jCfQ08zA4QJBnmA==", - "requires": { - "regenerator-runtime": "^0.13.4" - } - }, "@babel/template": { "version": "7.16.7", "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.16.7.tgz", @@ -9369,16 +9269,6 @@ "dev": true, "requires": {} }, - "@hipo/react-ui-toolkit": { - "version": "1.0.0-beta", - "resolved": "https://registry.npmjs.org/@hipo/react-ui-toolkit/-/react-ui-toolkit-1.0.0-beta.tgz", - "integrity": "sha512-TrvumyubqeYZp2sZw0TJlG/ZWx61EWW23ChUengeR2JGcCwQqnR4AsFzuua4V/r8f38CyzqfMOMlZ/V5rABz7A==", - "requires": { - "classnames": "2.3.1", - "react-textarea-autosize": "8.3.2", - "uuid": "8.3.2" - } - }, "@humanwhocodes/config-array": { "version": "0.9.5", "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.9.5.tgz", @@ -10296,11 +10186,6 @@ "integrity": "sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==", "dev": true }, - "classnames": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/classnames/-/classnames-2.3.1.tgz", - "integrity": "sha512-OlQdbZ7gLfGarSqxesMesDa5uz7KFbID8Kpq/SxIoNGDqY8lSYs0D+hhtBXhcdB3rcbXArFr7vlHheLk1voeNA==" - }, "clean-stack": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", @@ -13588,6 +13473,7 @@ "version": "17.0.2", "resolved": "https://registry.npmjs.org/react/-/react-17.0.2.tgz", "integrity": "sha512-gnhPt75i/dq/z3/6q/0asP78D0u592D5L1pd7M8P+dck6Fu/jJeL6iVVK23fptSUZj8Vjf++7wXA8UNclGQcbA==", + "peer": true, "requires": { "loose-envify": "^1.1.0", "object-assign": "^4.1.1" @@ -13597,6 +13483,7 @@ "version": "17.0.2", "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-17.0.2.tgz", "integrity": "sha512-s4h96KtLDUQlsENhMn1ar8t2bEa+q/YAtj8pPPdIjPDGBDIVNsrD9aXNWqspUe6AzKCIG0C1HZZLqLV7qpOBGA==", + "peer": true, "requires": { "loose-envify": "^1.1.0", "object-assign": "^4.1.1", @@ -13810,16 +13697,6 @@ } } }, - "react-textarea-autosize": { - "version": "8.3.2", - "resolved": "https://registry.npmjs.org/react-textarea-autosize/-/react-textarea-autosize-8.3.2.tgz", - "integrity": "sha512-JrMWVgQSaExQByP3ggI1eA8zF4mF0+ddVuX7acUeK2V7bmrpjVOY72vmLz2IXFJSAXoY3D80nEzrn0GWajWK3Q==", - "requires": { - "@babel/runtime": "^7.10.2", - "use-composed-ref": "^1.0.0", - "use-latest": "^1.0.0" - } - }, "read-pkg": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-5.2.0.tgz", @@ -13961,11 +13838,6 @@ "strip-indent": "^3.0.0" } }, - "regenerator-runtime": { - "version": "0.13.9", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.9.tgz", - "integrity": "sha512-p3VT+cOEgxFsRRA9X4lkI1E+k2/CtnKtU4gcxyaCUreilL/vqI6CdZ3wxVUx3UOUg+gnUOQQcRI7BmSI656MYA==" - }, "regexp.prototype.flags": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.4.1.tgz", @@ -14610,6 +14482,7 @@ "version": "0.20.2", "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.20.2.tgz", "integrity": "sha512-2eWfGgAqqWFGqtdMmcL5zCMK1U8KlXv8SQFGglL3CEtd0aDVDWgeF/YoCmvln55m5zSk3J/20hTaSBeSObsQDQ==", + "peer": true, "requires": { "loose-envify": "^1.1.0", "object-assign": "^4.1.1" @@ -15399,26 +15272,6 @@ "requires-port": "^1.0.0" } }, - "use-composed-ref": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/use-composed-ref/-/use-composed-ref-1.2.1.tgz", - "integrity": "sha512-6+X1FLlIcjvFMAeAD/hcxDT8tmyrWnbSPMU0EnxQuDLIxokuFzWliXBiYZuGIx+mrAMLBw0WFfCkaPw8ebzAhw==", - "requires": {} - }, - "use-isomorphic-layout-effect": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/use-isomorphic-layout-effect/-/use-isomorphic-layout-effect-1.1.2.tgz", - "integrity": "sha512-49L8yCO3iGT/ZF9QttjwLF/ZD9Iwto5LnH5LmEdk/6cFmXddqi2ulF0edxTwjj+7mqvpVVGQWvbXZdn32wRSHA==", - "requires": {} - }, - "use-latest": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/use-latest/-/use-latest-1.2.0.tgz", - "integrity": "sha512-d2TEuG6nSLKQLAfW3By8mKr8HurOlTkul0sOpxbClIv4SQ4iOd7BYr7VIzdbktUCnv7dua/60xzd8igMU6jmyw==", - "requires": { - "use-isomorphic-layout-effect": "^1.0.0" - } - }, "util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", @@ -15436,11 +15289,6 @@ "object.getownpropertydescriptors": "^2.1.0" } }, - "uuid": { - "version": "8.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", - "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==" - }, "v8-compile-cache": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz", diff --git a/package.json b/package.json index ee493af..c6ae12e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@perawallet/connect", - "version": "0.0.2", + "version": "0.0.3", "description": "JavaScript SDK for integrating Pera Wallet to web applications.", "main": "dist/index.js", "scripts": { @@ -32,15 +32,16 @@ "typescript": "^4.6.3" }, "dependencies": { - "@hipo/react-ui-toolkit": "^1.0.0-beta", "@json-rpc-tools/utils": "^1.7.6", "@walletconnect/client": "^1.7.7", "algosdk": "^1.15.0", "buffer": "^6.0.3", - "react": "^17.0.2", - "react-dom": "^17.0.2", "react-qr-code": "^2.0.5" }, + "peerDependencies": { + "react": "^17.0.2", + "react-dom": "^17.0.2" + }, "types": "./dist/index.d.ts", "repository": { "type": "git", diff --git a/src/PeraWalletConnect.tsx b/src/PeraWalletConnect.tsx index a6aa7d0..1a6d394 100644 --- a/src/PeraWalletConnect.tsx +++ b/src/PeraWalletConnect.tsx @@ -29,10 +29,6 @@ const peraWalletConnectModalActions = { close: closePeraWalletConnectModal }; -(async function () { - await assignBridgeURL(); -})(); - class PeraWalletConnect { bridge: string; connector: WalletConnect | null; @@ -55,9 +51,15 @@ class PeraWalletConnect { await this.connector.killSession(); } + let bridgeURL = ""; + + if (!this.bridge) { + bridgeURL = await assignBridgeURL(); + } + // Create Connector instance this.connector = new WalletConnect({ - bridge: this.bridge, + bridge: this.bridge || bridgeURL, qrcodeModal: peraWalletConnectModalActions }); diff --git a/src/modal/PeraWalletConnectModal.tsx b/src/modal/PeraWalletConnectModal.tsx index d22e623..d7981d0 100644 --- a/src/modal/PeraWalletConnectModal.tsx +++ b/src/modal/PeraWalletConnectModal.tsx @@ -4,7 +4,6 @@ import PeraWalletLogo from "../asset/icon/PeraWallet.svg"; import "./_pera-wallet-connect-modal.scss"; import React, {useState} from "react"; -import {Button} from "@hipo/react-ui-toolkit"; import QRCode from "react-qr-code"; import {isLargeScreen} from "../util/screen/screenSizeUtils"; @@ -28,25 +27,25 @@ function PeraWalletConnectModal({uri, onClose}: PeraWalletConnectModalProps) { - + {isSpinnerVisible ? renderPendingMessage() : renderActionButtons()} {isSpinnerVisible && ( - + )} @@ -69,13 +68,13 @@ function PeraWalletConnectModal({uri, onClose}: PeraWalletConnectModalProps) { {isQRCodeVisible && renderQRCode()} {!isQRCodeVisible && ( - + )} );