Use testnet-onboarding-api to generate sumsub access token #3
@ -1,5 +1,5 @@
|
||||
import React, { useEffect } from "react";
|
||||
import { useLocation, useNavigate } from "react-router-dom";
|
||||
import {useNavigate } from "react-router-dom";
|
||||
|
||||
import { Button, Box, Container } from "@mui/material";
|
||||
|
||||
@ -10,21 +10,13 @@ const ConnectWallet = () => {
|
||||
|
||||
const navigate = useNavigate();
|
||||
|
||||
const location = useLocation();
|
||||
const { kycId } = location.state as {
|
||||
kycId: string
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
if (session) {
|
||||
navigate("/sign-with-nitro-key", {
|
||||
state: {
|
||||
kycId
|
||||
},
|
||||
});
|
||||
navigate("/sign-with-nitro-key");
|
||||
}
|
||||
}, [session, navigate, kycId]);
|
||||
}, [session, navigate,]);
|
||||
|
||||
const handler = async () => {
|
||||
await connect();
|
||||
|
@ -1,5 +1,5 @@
|
||||
import React, { useState, useMemo, useEffect } from "react";
|
||||
import { useLocation, useNavigate } from "react-router-dom";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { SnackbarProvider, enqueueSnackbar } from "notistack";
|
||||
import canonicalStringify from "canonical-json";
|
||||
|
||||
@ -15,10 +15,6 @@ import { utf8ToHex } from "@walletconnect/encoding";
|
||||
import { useWalletConnectContext } from "../context/WalletConnectContext";
|
||||
|
||||
const SignWithNitroKey = () => {
|
||||
const location = useLocation();
|
||||
const { kycId } = location.state as {
|
||||
kycId: string
|
||||
}
|
||||
|
||||
const { session, signClient, checkPersistedState } =
|
||||
useWalletConnectContext();
|
||||
@ -60,12 +56,11 @@ const SignWithNitroKey = () => {
|
||||
});
|
||||
setIsLoading(false)
|
||||
setEthSignature(ethSignature);
|
||||
navigate("/sign-with-cosmos", {
|
||||
navigate("/user-verification", {
|
||||
state: {
|
||||
message,
|
||||
cosmosAddress,
|
||||
receivedEthSig,
|
||||
kycId
|
||||
},
|
||||
});
|
||||
} catch (error) {
|
||||
|
@ -9,7 +9,7 @@ const TermsAndConditions = () => {
|
||||
const navigate = useNavigate();
|
||||
|
||||
const handleAccept = () => {
|
||||
navigate('/user-verification');
|
||||
navigate('/connect-wallet');
|
||||
};
|
||||
|
||||
return (
|
||||
|
@ -1,6 +1,6 @@
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { Box, Typography } from '@mui/material';
|
||||
import { useLocation, useNavigate } from 'react-router-dom';
|
||||
import { Box, Button, Typography } from '@mui/material';
|
||||
import SumsubWebSdk from '@sumsub/websdk-react';
|
||||
|
||||
import { fetchToken } from '../utils/getToken';
|
||||
@ -21,8 +21,11 @@ const UserVerification = () => {
|
||||
const [token, setToken] = useState<string>('');
|
||||
const [loading, setLoading] = useState<boolean>(true);
|
||||
|
||||
const location = useLocation();
|
||||
const navigate = useNavigate();
|
||||
|
||||
const {message, cosmosAddress, receivedEthSig} = location.state;
|
||||
|
||||
useEffect(() => {
|
||||
const getToken = async (kycId: string) => {
|
||||
console.log(kycId);
|
||||
@ -88,6 +91,15 @@ const UserVerification = () => {
|
||||
<Typography variant="h5">User verification</Typography>
|
||||
<div id="sumsub-websdk-container"></div>
|
||||
</Box>
|
||||
<Button onClick={()=>{
|
||||
navigate("/sign-with-cosmos", {
|
||||
state: {
|
||||
message,
|
||||
cosmosAddress,
|
||||
receivedEthSig,
|
||||
kycId: 'unknown-kyc-id',
|
||||
}})
|
||||
}}>Sign with cosmos key</Button>
|
||||
{!loading && token && (
|
||||
<SumsubWebSdk
|
||||
accessToken={token}
|
||||
|
Loading…
Reference in New Issue
Block a user