From 048e63cdc86c3fb2b11a34f99667bbf31f39ffab Mon Sep 17 00:00:00 2001
From: Benjamin A <97291322+Baoufa@users.noreply.github.com>
Date: Fri, 17 Nov 2023 16:18:58 +0100
Subject: [PATCH] feat: wallet connect qr-reader done (#42)
---
front/package.json | 1 +
front/pnpm-lock.yaml | 21 +++-
front/src/components/HomePage/index.tsx | 5 +-
front/src/components/NavBar/index.tsx | 8 +-
front/src/components/QrReaderModal/index.tsx | 108 ++++++++++++++++++
front/src/components/SettingsPage/index.tsx | 7 +-
front/src/components/WCInput/index.tsx | 30 -----
.../hook/useWalletConnectHook.tsx | 71 ++++++------
.../wallet-connect/service/wallet-connect.ts | 60 ++++------
front/src/providers/MeProvider/index.tsx | 3 +
front/src/providers/ModalProvider/index.tsx | 50 ++++++--
11 files changed, 243 insertions(+), 121 deletions(-)
create mode 100644 front/src/components/QrReaderModal/index.tsx
delete mode 100644 front/src/components/WCInput/index.tsx
diff --git a/front/package.json b/front/package.json
index 5da60e7..8ce38fa 100644
--- a/front/package.json
+++ b/front/package.json
@@ -28,6 +28,7 @@
"next-themes": "^0.2.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
+ "react-qr-reader-es6": "2.2.1-2",
"viem": "^1.18.0",
"wagmi": "^1.0.6"
},
diff --git a/front/pnpm-lock.yaml b/front/pnpm-lock.yaml
index cb7dc12..f8448f9 100644
--- a/front/pnpm-lock.yaml
+++ b/front/pnpm-lock.yaml
@@ -62,6 +62,9 @@ dependencies:
react-dom:
specifier: ^18.2.0
version: 18.2.0(react@18.2.0)
+ react-qr-reader-es6:
+ specifier: 2.2.1-2
+ version: 2.2.1-2(react-dom@18.2.0)(react@18.2.0)
viem:
specifier: ^1.18.0
version: 1.18.0(typescript@5.2.2)
@@ -4796,6 +4799,10 @@ packages:
engines: {'0': node >= 0.2.0}
dev: false
+ /jsqr-es6@1.4.0-1:
+ resolution: {integrity: sha512-LPWZJLI+3LLOy9k3/s/MeXlkfNOs3bYBX5O+fp4N0XuxbgO8H7Uc/nYZeNwo13nSZXRW9xWFKmZdy9591+PyAg==}
+ dev: false
+
/jsx-ast-utils@3.3.5:
resolution: {integrity: sha512-ZZow9HBI5O6EPgSJLUb8n2NKgmVWTwCvHGwFuJlMjvLFqlGG6pjirPhtdsseaLZjSibD8eegzmYpUZwoIlj2cQ==}
engines: {node: '>=4.0'}
@@ -5070,7 +5077,6 @@ packages:
/object-assign@4.1.1:
resolution: {integrity: sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==}
engines: {node: '>=0.10.0'}
- dev: true
/object-inspect@1.13.1:
resolution: {integrity: sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==}
@@ -5314,7 +5320,6 @@ packages:
loose-envify: 1.4.0
object-assign: 4.1.1
react-is: 16.13.1
- dev: true
/proxy-compare@2.5.1:
resolution: {integrity: sha512-oyfc0Tx87Cpwva5ZXezSp5V9vht1c7dZBhvuV/y3ctkgMVUmiAGDVeeB0dKhGSyT0v1ZTEQYpe/RXlBVBNuCLA==}
@@ -5412,6 +5417,18 @@ packages:
/react-is@16.13.1:
resolution: {integrity: sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==}
+ /react-qr-reader-es6@2.2.1-2(react-dom@18.2.0)(react@18.2.0):
+ resolution: {integrity: sha512-pDNH8FoR3fOBBCgh4ImKHlX+pv/D3P8JmE+vjjcw3+YTEUgBqUAZbIkD/WUE3HzhVhN2zx7ZLBhO9vJngnjJxw==}
+ peerDependencies:
+ react: '>=16'
+ react-dom: '>=16'
+ dependencies:
+ jsqr-es6: 1.4.0-1
+ prop-types: 15.8.1
+ react: 18.2.0
+ react-dom: 18.2.0(react@18.2.0)
+ dev: false
+
/react-remove-scroll-bar@2.3.4(@types/react@18.2.31)(react@18.2.0):
resolution: {integrity: sha512-63C4YQBUt0m6ALadE9XV56hV8BgJWDmmTPY758iIJjfQKt2nYwoUrPk0LXRXcB/yIj82T1/Ixfdpdk68LwIB0A==}
engines: {node: '>=10'}
diff --git a/front/src/components/HomePage/index.tsx b/front/src/components/HomePage/index.tsx
index e7217b3..0fb8c59 100644
--- a/front/src/components/HomePage/index.tsx
+++ b/front/src/components/HomePage/index.tsx
@@ -2,14 +2,14 @@
import OnBoarding from "@/components/OnBoarding";
import { useMe } from "@/providers/MeProvider";
-import { Button, Flex } from "@radix-ui/themes";
+import { Flex } from "@radix-ui/themes";
import Balance from "../Balance";
import NavBar from "../NavBar";
import History from "../History";
import TopBar from "../TopBar";
export default function Home() {
- const { me, disconnect, isMounted } = useMe();
+ const { me, isMounted } = useMe();
if (!isMounted) return null;
@@ -20,7 +20,6 @@ export default function Home() {
-
);
} else {
diff --git a/front/src/components/NavBar/index.tsx b/front/src/components/NavBar/index.tsx
index 81b6d26..74d427e 100644
--- a/front/src/components/NavBar/index.tsx
+++ b/front/src/components/NavBar/index.tsx
@@ -5,6 +5,7 @@ import { useModal } from "@/providers/ModalProvider";
import { PaperPlaneIcon, CornersIcon } from "@radix-ui/react-icons";
import { SendTransaction } from "@/components/SendTransaction";
import { useEffect } from "react";
+import QrReaderModal from "../QrReaderModal";
export default function NavBar() {
const { open } = useModal();
@@ -19,7 +20,12 @@ export default function NavBar() {
>
-