From fcf93ac6b7af7b5f7d51b70175012370da6014ba Mon Sep 17 00:00:00 2001 From: IshaVenikar Date: Wed, 31 Jul 2024 12:23:19 +0530 Subject: [PATCH 1/4] Use global snackbar provider --- src/context/WalletConnectContext.tsx | 3 +-- src/index.tsx | 21 ++++++++++++++++++++- src/pages/OnboardingSuccess.tsx | 3 +-- src/pages/SignWithCosmos.tsx | 3 +-- src/pages/SignWithNitroKey.tsx | 3 +-- 5 files changed, 24 insertions(+), 9 deletions(-) diff --git a/src/context/WalletConnectContext.tsx b/src/context/WalletConnectContext.tsx index 6b2cd59..b2d4fec 100644 --- a/src/context/WalletConnectContext.tsx +++ b/src/context/WalletConnectContext.tsx @@ -8,7 +8,7 @@ import React, { useCallback, useRef, } from "react"; -import { SnackbarProvider, enqueueSnackbar } from "notistack"; +import { enqueueSnackbar } from "notistack"; import { useNavigate } from "react-router-dom"; import SignClient from "@walletconnect/sign-client"; @@ -160,7 +160,6 @@ export const WalletConnectProvider = ({ > {children} - ); }; diff --git a/src/index.tsx b/src/index.tsx index f8fdf20..88fb39f 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -1,6 +1,11 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import { Buffer } from "buffer"; +import { closeSnackbar, SnackbarProvider } from 'notistack'; + +import CloseIcon from '@mui/icons-material/Close'; +import { IconButton } from '@mui/material'; + import './index.css'; import App from './App'; import reportWebVitals from './reportWebVitals'; @@ -8,11 +13,25 @@ import reportWebVitals from './reportWebVitals'; const root = ReactDOM.createRoot( document.getElementById('root') as HTMLElement ); + +function SnackbarCloseButton({ key } : any) { + + return ( + closeSnackbar(key)}> + + + ); +} + // Reference: https://github.com/vitejs/vite/discussions/2785#discussion-3298776 globalThis.Buffer = Buffer; root.render( - + } + > + + ); diff --git a/src/pages/OnboardingSuccess.tsx b/src/pages/OnboardingSuccess.tsx index 4249e83..a180a52 100644 --- a/src/pages/OnboardingSuccess.tsx +++ b/src/pages/OnboardingSuccess.tsx @@ -1,5 +1,5 @@ import React, { useEffect, useState } from "react"; -import { SnackbarProvider, enqueueSnackbar } from "notistack"; +import { enqueueSnackbar } from "notistack"; import { useLocation } from "react-router-dom"; import { Box, Typography } from "@mui/material"; @@ -114,7 +114,6 @@ const OnboardingSuccess = () => { onMessage={messageHandler} /> )} - ); }; diff --git a/src/pages/SignWithCosmos.tsx b/src/pages/SignWithCosmos.tsx index 431af88..d8ea671 100644 --- a/src/pages/SignWithCosmos.tsx +++ b/src/pages/SignWithCosmos.tsx @@ -1,6 +1,6 @@ import React, { useCallback, useEffect, useMemo, useState } from "react"; import { useLocation, useNavigate } from "react-router-dom"; -import { SnackbarProvider, enqueueSnackbar } from "notistack"; +import { enqueueSnackbar } from "notistack"; import { Box, Card, CardContent, Grid, Typography } from "@mui/material"; import LoadingButton from "@mui/lab/LoadingButton/LoadingButton"; @@ -205,7 +205,6 @@ const SignWithCosmos = () => { Send transaction - ); }; diff --git a/src/pages/SignWithNitroKey.tsx b/src/pages/SignWithNitroKey.tsx index 5626fb3..e2c9134 100644 --- a/src/pages/SignWithNitroKey.tsx +++ b/src/pages/SignWithNitroKey.tsx @@ -1,6 +1,6 @@ import React, { useState, useMemo, useEffect } from "react"; import { useNavigate } from "react-router-dom"; -import { SnackbarProvider, enqueueSnackbar } from "notistack"; +import { enqueueSnackbar } from "notistack"; import canonicalStringify from "canonical-json"; import { @@ -136,7 +136,6 @@ const SignWithNitroKey = () => { Sign using Nitro key - ) : ( <>Loading... -- 2.45.2 From 3c11f1db66d4f2906967acc3acc0451170b2e0c8 Mon Sep 17 00:00:00 2001 From: IshaVenikar Date: Wed, 31 Jul 2024 14:02:34 +0530 Subject: [PATCH 2/4] Store hash value of KYC Id --- package.json | 1 + src/pages/UserVerification.tsx | 4 +- yarn.lock | 82 ++++++++++++++++++++++++++++++++-- 3 files changed, 82 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index ea02bca..78a1d5d 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "camelcase": "^6.2.1", "canonical-json": "^0.0.4", "crypto-browserify": "^3.12.0", + "ethers": "^6.13.2", "https-browserify": "^1.0.0", "notistack": "^3.0.1", "react": "^18.2.0", diff --git a/src/pages/UserVerification.tsx b/src/pages/UserVerification.tsx index 7d3400d..0ce12e5 100644 --- a/src/pages/UserVerification.tsx +++ b/src/pages/UserVerification.tsx @@ -1,5 +1,6 @@ import React, { useEffect, useState } from 'react'; import { useLocation, useNavigate } from 'react-router-dom'; +import { ethers } from "ethers"; import { Box, Typography } from '@mui/material'; import SumsubWebSdk from '@sumsub/websdk-react'; @@ -44,12 +45,13 @@ const UserVerification = () => { useEffect(() => { if (applicationSubmitted && kycId !== '') { + const kycIdHash = ethers.sha256(ethers.toUtf8Bytes(kycId)); navigate("/sign-with-cosmos", { state: { message, cosmosAddress, receivedEthSig, - kycId, + kycIdHash, }}) } }, [applicationSubmitted, kycId, navigate, cosmosAddress, message, receivedEthSig]); diff --git a/yarn.lock b/yarn.lock index 75b75a1..472f322 100644 --- a/yarn.lock +++ b/yarn.lock @@ -12,6 +12,11 @@ resolved "https://registry.yarnpkg.com/@adobe/css-tools/-/css-tools-4.3.3.tgz#90749bde8b89cd41764224f5aac29cd4138f75ff" integrity sha512-rE0Pygv0sEZ4vBWHlAgJLGDU7Pm8xoO6p3wsEceb7GYAjScrOHpEo8KK/eVkAcnSM+slAEtXjA2JpdjLp4fJQQ== +"@adraffy/ens-normalize@1.10.1": + version "1.10.1" + resolved "https://registry.yarnpkg.com/@adraffy/ens-normalize/-/ens-normalize-1.10.1.tgz#63430d04bd8c5e74f8d7d049338f1cd9d4f02069" + integrity sha512-96Z2IP3mYmF1Xg2cDm8f1gWGf/HUVedQ3FMifV4kG/PQ4yEP51xDtRAEfhVNt5f/uzpNkZHwWQuUcu6D6K+Ekw== + "@alloc/quick-lru@^5.2.0": version "5.2.0" resolved "https://registry.yarnpkg.com/@alloc/quick-lru/-/quick-lru-5.2.0.tgz#7bf68b20c0a350f936915fcae06f58e32007ce30" @@ -2609,6 +2614,18 @@ dependencies: eslint-scope "5.1.1" +"@noble/curves@1.2.0": + version "1.2.0" + resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-1.2.0.tgz#92d7e12e4e49b23105a2555c6984d41733d65c35" + integrity sha512-oYclrNgRaM9SsBUBVbb8M6DTV7ZHRTKugureoYEncY5c65HOmRzvSiTE3y5CYaPYJA/GVkrhXEoF0M3Ya9PMnw== + dependencies: + "@noble/hashes" "1.3.2" + +"@noble/hashes@1.3.2": + version "1.3.2" + resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.3.2.tgz#6f26dbc8fbc7205873ce3cee2f690eba0d421b39" + integrity sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ== + "@noble/hashes@^1", "@noble/hashes@^1.0.0", "@noble/hashes@^1.2.0": version "1.4.0" resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.4.0.tgz#45814aa329f30e4fe0ba49426f49dfccdd066426" @@ -3472,6 +3489,11 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-10.12.18.tgz#1d3ca764718915584fcd9f6344621b7672665c67" integrity sha512-fh+pAqt4xRzPfqA6eh3Z2y6fyZavRIumvjhaCL753+TVkGKGhpPeyrJG2JftD0T9q4GF00KjefsQ+PQNDdWQaQ== +"@types/node@18.15.13": + version "18.15.13" + resolved "https://registry.yarnpkg.com/@types/node/-/node-18.15.13.tgz#f64277c341150c979e42b00e4ac289290c9df469" + integrity sha512-N+0kuo9KgrUQ1Sn/ifDXsvg0TTleP7rIy4zOBGECxAljqvqfqpTfzx0Q1NUedOixRMBfe2Whhb056a42cWs26Q== + "@types/node@>=13.7.0": version "20.14.9" resolved "https://registry.yarnpkg.com/@types/node/-/node-20.14.9.tgz#12e8e765ab27f8c421a1820c99f5f313a933b420" @@ -4259,6 +4281,11 @@ aes-js@3.0.0: resolved "https://registry.yarnpkg.com/aes-js/-/aes-js-3.0.0.tgz#e21df10ad6c2053295bcbb8dab40b09dbea87e4d" integrity sha512-H7wUZRn8WpTq9jocdxQ2c8x2sKo9ZVmzfRE13GiNJXfp7NcKYEdvl3vspKjXox6RIG2VtaRe4JFvxG4rqp2Zuw== +aes-js@4.0.0-beta.5: + version "4.0.0-beta.5" + resolved "https://registry.yarnpkg.com/aes-js/-/aes-js-4.0.0-beta.5.tgz#8d2452c52adedebc3a3e28465d858c11ca315873" + integrity sha512-G965FqalsNyrPqgEGON7nIx1e/OVENSgiEIzyC63haUMuvNnwIgIjMs52hlTCKhkBny7A2ORNlfY9Zu+jmGk1Q== + agent-base@6: version "6.0.2" resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-6.0.2.tgz#49fff58577cfee3f37176feab4c22e00f86d7f77" @@ -6826,6 +6853,19 @@ ethers@^5.6.2: "@ethersproject/web" "5.7.1" "@ethersproject/wordlists" "5.7.0" +ethers@^6.13.2: + version "6.13.2" + resolved "https://registry.yarnpkg.com/ethers/-/ethers-6.13.2.tgz#4b67d4b49e69b59893931a032560999e5e4419fe" + integrity sha512-9VkriTTed+/27BGuY1s0hf441kqwHJ1wtN2edksEtiRvXx+soxRX3iSXTfFqq2+YwrOqbDoTHjIhQnjJRlzKmg== + dependencies: + "@adraffy/ens-normalize" "1.10.1" + "@noble/curves" "1.2.0" + "@noble/hashes" "1.3.2" + "@types/node" "18.15.13" + aes-js "4.0.0-beta.5" + tslib "2.4.0" + ws "8.17.1" + ethjs-util@0.1.6, ethjs-util@^0.1.6: version "0.1.6" resolved "https://registry.yarnpkg.com/ethjs-util/-/ethjs-util-0.1.6.tgz#f308b62f185f9fe6237132fb2a9818866a5cd536" @@ -11776,7 +11816,16 @@ string-natural-compare@^3.0.1: resolved "https://registry.yarnpkg.com/string-natural-compare/-/string-natural-compare-3.0.1.tgz#7a42d58474454963759e8e8b7ae63d71c1e7fdf4" integrity sha512-n3sPwynL1nwKi3WJ6AIsClwBMa0zTi54fn2oLU6ndfTSIO05xaznjSf15PcBZU6FNWbmN5Q6cxT4V5hGvB4taw== -"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0, string-width@^4.2.0: +"string-width-cjs@npm:string-width@^4.2.0": + version "4.2.3" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" + integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.1" + +string-width@^4.1.0, string-width@^4.2.0: version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -11860,7 +11909,14 @@ stringify-object@^3.3.0: is-obj "^1.0.1" is-regexp "^1.0.0" -"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1: +"strip-ansi-cjs@npm:strip-ansi@^6.0.1": + version "6.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" + integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== + dependencies: + ansi-regex "^5.0.1" + +strip-ansi@^6.0.0, strip-ansi@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== @@ -12254,6 +12310,11 @@ tslib@1.14.1, tslib@^1.8.1: resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== +tslib@2.4.0: + version "2.4.0" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.4.0.tgz#7cecaa7f073ce680a05847aa77be941098f36dc3" + integrity sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ== + tslib@^2.0.3, tslib@^2.3.1: version "2.6.2" resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.2.tgz#703ac29425e7b37cd6fd456e92404d46d1f3e4ae" @@ -13082,8 +13143,7 @@ workbox-window@6.6.1: "@types/trusted-types" "^2.0.2" workbox-core "6.6.1" -"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0: - name wrap-ansi-cjs +"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0": version "7.0.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== @@ -13101,6 +13161,15 @@ wrap-ansi@^6.2.0: string-width "^4.1.0" strip-ansi "^6.0.0" +wrap-ansi@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" + integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== + dependencies: + ansi-styles "^4.0.0" + string-width "^4.1.0" + strip-ansi "^6.0.0" + wrap-ansi@^8.1.0: version "8.1.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214" @@ -13130,6 +13199,11 @@ ws@7.4.6: resolved "https://registry.yarnpkg.com/ws/-/ws-7.4.6.tgz#5654ca8ecdeee47c33a9a4bf6d28e2be2980377c" integrity sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A== +ws@8.17.1: + version "8.17.1" + resolved "https://registry.yarnpkg.com/ws/-/ws-8.17.1.tgz#9293da530bb548febc95371d90f9c878727d919b" + integrity sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ== + ws@^7: version "7.5.10" resolved "https://registry.yarnpkg.com/ws/-/ws-7.5.10.tgz#58b5c20dc281633f6c19113f39b349bd8bd558d9" -- 2.45.2 From 70ad4f3c1ebfb3155cf49f846ee1b80ca3452b6f Mon Sep 17 00:00:00 2001 From: IshaVenikar Date: Wed, 31 Jul 2024 14:49:38 +0530 Subject: [PATCH 3/4] Add wallet disclaimer message --- src/constants.ts | 2 ++ src/pages/ConnectWallet.tsx | 24 +++++++++++++++++++++--- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/src/constants.ts b/src/constants.ts index 99003b8..1f998ac 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -27,3 +27,5 @@ export const TNC_PARTICIPANT_CONTENT = `Lorem ipsum dolor sit amet, consectetur Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.`; + +export const WALLET_DISCLAIMER_MSG = 'You are connecting to an experimental wallet! It is not secure. Do not use it elsewhere and/or for managing real assets.' diff --git a/src/pages/ConnectWallet.tsx b/src/pages/ConnectWallet.tsx index 776621f..aaa90f9 100644 --- a/src/pages/ConnectWallet.tsx +++ b/src/pages/ConnectWallet.tsx @@ -1,9 +1,10 @@ import React, { useEffect } from "react"; import {useNavigate } from "react-router-dom"; -import { Button, Box, Container } from "@mui/material"; +import { Button, Box, Container, Typography, colors } from "@mui/material"; import { useWalletConnectContext } from "../context/WalletConnectContext"; +import { WALLET_DISCLAIMER_MSG } from "../constants"; const ConnectWallet = () => { const { connect, session } = useWalletConnectContext(); @@ -28,14 +29,31 @@ const ConnectWallet = () => { display="flex" flexDirection="column" alignItems="center" - height="50vh" justifyContent="center" + marginTop={10} + sx={{ + border: 1, + borderColor: 'grey.500', + }} padding={5} + > + + Disclaimer + + + {WALLET_DISCLAIMER_MSG} + + + -- 2.45.2 From 0eaa2c784a8b5c8d26dde06b5cd5851afc95ef28 Mon Sep 17 00:00:00 2001 From: IshaVenikar Date: Wed, 31 Jul 2024 18:01:16 +0530 Subject: [PATCH 4/4] Use ethers v5 --- package.json | 2 +- src/context/WalletConnectContext.tsx | 24 ++++++------- src/index.tsx | 1 - src/pages/SignWithCosmos.tsx | 8 ++--- src/pages/UserVerification.tsx | 3 +- yarn.lock | 52 +--------------------------- 6 files changed, 18 insertions(+), 72 deletions(-) diff --git a/package.json b/package.json index 78a1d5d..7fb041e 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "camelcase": "^6.2.1", "canonical-json": "^0.0.4", "crypto-browserify": "^3.12.0", - "ethers": "^6.13.2", + "ethers": "5.7.2", "https-browserify": "^1.0.0", "notistack": "^3.0.1", "react": "^18.2.0", diff --git a/src/context/WalletConnectContext.tsx b/src/context/WalletConnectContext.tsx index b2d4fec..18b21ba 100644 --- a/src/context/WalletConnectContext.tsx +++ b/src/context/WalletConnectContext.tsx @@ -148,19 +148,17 @@ export const WalletConnectProvider = ({ }, [signClient, createClient]); return ( - <> - - {children} - - + + {children} + ); }; diff --git a/src/index.tsx b/src/index.tsx index 88fb39f..1a6c082 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -15,7 +15,6 @@ const root = ReactDOM.createRoot( ); function SnackbarCloseButton({ key } : any) { - return ( closeSnackbar(key)}> diff --git a/src/pages/SignWithCosmos.tsx b/src/pages/SignWithCosmos.tsx index d8ea671..50f0ddf 100644 --- a/src/pages/SignWithCosmos.tsx +++ b/src/pages/SignWithCosmos.tsx @@ -25,14 +25,14 @@ const SignWithCosmos = () => { const navigate = useNavigate(); - const {message: innerMessage, cosmosAddress, receivedEthSig: ethSignature, kycId} = location.state as { + const {message: innerMessage, cosmosAddress, receivedEthSig: ethSignature, kycIdHash} = location.state as { message?: { msg: string; address: string; }; cosmosAddress?: string; receivedEthSig?: string; - kycId?: string; + kycIdHash?: string; }; const ethAddress = innerMessage!.address; @@ -49,11 +49,11 @@ const SignWithCosmos = () => { participant: cosmosAddress!, ethPayload: innerMessage, ethSignature: ethSignature!, - kycId: kycId!, + kycId: kycIdHash!, role }, }; - }, [cosmosAddress, innerMessage, ethSignature, kycId, role]); + }, [cosmosAddress, innerMessage, ethSignature, kycIdHash, role]); const handleTokenRequest = async () => { try { diff --git a/src/pages/UserVerification.tsx b/src/pages/UserVerification.tsx index 0ce12e5..659824f 100644 --- a/src/pages/UserVerification.tsx +++ b/src/pages/UserVerification.tsx @@ -28,7 +28,6 @@ const UserVerification = () => { useEffect(() => { const getToken = async (userId: string) => { - console.log(userId); const newToken = await fetchAccessToken(userId); setToken(newToken); @@ -45,7 +44,7 @@ const UserVerification = () => { useEffect(() => { if (applicationSubmitted && kycId !== '') { - const kycIdHash = ethers.sha256(ethers.toUtf8Bytes(kycId)); + const kycIdHash = ethers.utils.sha256(ethers.utils.toUtf8Bytes(kycId)); navigate("/sign-with-cosmos", { state: { message, diff --git a/yarn.lock b/yarn.lock index 472f322..7add92a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -12,11 +12,6 @@ resolved "https://registry.yarnpkg.com/@adobe/css-tools/-/css-tools-4.3.3.tgz#90749bde8b89cd41764224f5aac29cd4138f75ff" integrity sha512-rE0Pygv0sEZ4vBWHlAgJLGDU7Pm8xoO6p3wsEceb7GYAjScrOHpEo8KK/eVkAcnSM+slAEtXjA2JpdjLp4fJQQ== -"@adraffy/ens-normalize@1.10.1": - version "1.10.1" - resolved "https://registry.yarnpkg.com/@adraffy/ens-normalize/-/ens-normalize-1.10.1.tgz#63430d04bd8c5e74f8d7d049338f1cd9d4f02069" - integrity sha512-96Z2IP3mYmF1Xg2cDm8f1gWGf/HUVedQ3FMifV4kG/PQ4yEP51xDtRAEfhVNt5f/uzpNkZHwWQuUcu6D6K+Ekw== - "@alloc/quick-lru@^5.2.0": version "5.2.0" resolved "https://registry.yarnpkg.com/@alloc/quick-lru/-/quick-lru-5.2.0.tgz#7bf68b20c0a350f936915fcae06f58e32007ce30" @@ -2614,18 +2609,6 @@ dependencies: eslint-scope "5.1.1" -"@noble/curves@1.2.0": - version "1.2.0" - resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-1.2.0.tgz#92d7e12e4e49b23105a2555c6984d41733d65c35" - integrity sha512-oYclrNgRaM9SsBUBVbb8M6DTV7ZHRTKugureoYEncY5c65HOmRzvSiTE3y5CYaPYJA/GVkrhXEoF0M3Ya9PMnw== - dependencies: - "@noble/hashes" "1.3.2" - -"@noble/hashes@1.3.2": - version "1.3.2" - resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.3.2.tgz#6f26dbc8fbc7205873ce3cee2f690eba0d421b39" - integrity sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ== - "@noble/hashes@^1", "@noble/hashes@^1.0.0", "@noble/hashes@^1.2.0": version "1.4.0" resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.4.0.tgz#45814aa329f30e4fe0ba49426f49dfccdd066426" @@ -3489,11 +3472,6 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-10.12.18.tgz#1d3ca764718915584fcd9f6344621b7672665c67" integrity sha512-fh+pAqt4xRzPfqA6eh3Z2y6fyZavRIumvjhaCL753+TVkGKGhpPeyrJG2JftD0T9q4GF00KjefsQ+PQNDdWQaQ== -"@types/node@18.15.13": - version "18.15.13" - resolved "https://registry.yarnpkg.com/@types/node/-/node-18.15.13.tgz#f64277c341150c979e42b00e4ac289290c9df469" - integrity sha512-N+0kuo9KgrUQ1Sn/ifDXsvg0TTleP7rIy4zOBGECxAljqvqfqpTfzx0Q1NUedOixRMBfe2Whhb056a42cWs26Q== - "@types/node@>=13.7.0": version "20.14.9" resolved "https://registry.yarnpkg.com/@types/node/-/node-20.14.9.tgz#12e8e765ab27f8c421a1820c99f5f313a933b420" @@ -4281,11 +4259,6 @@ aes-js@3.0.0: resolved "https://registry.yarnpkg.com/aes-js/-/aes-js-3.0.0.tgz#e21df10ad6c2053295bcbb8dab40b09dbea87e4d" integrity sha512-H7wUZRn8WpTq9jocdxQ2c8x2sKo9ZVmzfRE13GiNJXfp7NcKYEdvl3vspKjXox6RIG2VtaRe4JFvxG4rqp2Zuw== -aes-js@4.0.0-beta.5: - version "4.0.0-beta.5" - resolved "https://registry.yarnpkg.com/aes-js/-/aes-js-4.0.0-beta.5.tgz#8d2452c52adedebc3a3e28465d858c11ca315873" - integrity sha512-G965FqalsNyrPqgEGON7nIx1e/OVENSgiEIzyC63haUMuvNnwIgIjMs52hlTCKhkBny7A2ORNlfY9Zu+jmGk1Q== - agent-base@6: version "6.0.2" resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-6.0.2.tgz#49fff58577cfee3f37176feab4c22e00f86d7f77" @@ -6817,7 +6790,7 @@ ethereumjs-util@^6.0.0, ethereumjs-util@^6.2.1: ethjs-util "0.1.6" rlp "^2.2.3" -ethers@^5.6.2: +ethers@5.7.2, ethers@^5.6.2: version "5.7.2" resolved "https://registry.yarnpkg.com/ethers/-/ethers-5.7.2.tgz#3a7deeabbb8c030d4126b24f84e525466145872e" integrity sha512-wswUsmWo1aOK8rR7DIKiWSw9DbLWe6x98Jrn8wcTflTVvaXhAMaB5zGAXy0GYQEQp9iO1iSHWVyARQm11zUtyg== @@ -6853,19 +6826,6 @@ ethers@^5.6.2: "@ethersproject/web" "5.7.1" "@ethersproject/wordlists" "5.7.0" -ethers@^6.13.2: - version "6.13.2" - resolved "https://registry.yarnpkg.com/ethers/-/ethers-6.13.2.tgz#4b67d4b49e69b59893931a032560999e5e4419fe" - integrity sha512-9VkriTTed+/27BGuY1s0hf441kqwHJ1wtN2edksEtiRvXx+soxRX3iSXTfFqq2+YwrOqbDoTHjIhQnjJRlzKmg== - dependencies: - "@adraffy/ens-normalize" "1.10.1" - "@noble/curves" "1.2.0" - "@noble/hashes" "1.3.2" - "@types/node" "18.15.13" - aes-js "4.0.0-beta.5" - tslib "2.4.0" - ws "8.17.1" - ethjs-util@0.1.6, ethjs-util@^0.1.6: version "0.1.6" resolved "https://registry.yarnpkg.com/ethjs-util/-/ethjs-util-0.1.6.tgz#f308b62f185f9fe6237132fb2a9818866a5cd536" @@ -12310,11 +12270,6 @@ tslib@1.14.1, tslib@^1.8.1: resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== -tslib@2.4.0: - version "2.4.0" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.4.0.tgz#7cecaa7f073ce680a05847aa77be941098f36dc3" - integrity sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ== - tslib@^2.0.3, tslib@^2.3.1: version "2.6.2" resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.2.tgz#703ac29425e7b37cd6fd456e92404d46d1f3e4ae" @@ -13199,11 +13154,6 @@ ws@7.4.6: resolved "https://registry.yarnpkg.com/ws/-/ws-7.4.6.tgz#5654ca8ecdeee47c33a9a4bf6d28e2be2980377c" integrity sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A== -ws@8.17.1: - version "8.17.1" - resolved "https://registry.yarnpkg.com/ws/-/ws-8.17.1.tgz#9293da530bb548febc95371d90f9c878727d919b" - integrity sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ== - ws@^7: version "7.5.10" resolved "https://registry.yarnpkg.com/ws/-/ws-7.5.10.tgz#58b5c20dc281633f6c19113f39b349bd8bd558d9" -- 2.45.2