diff --git a/package.json b/package.json
index 39d7cb4c..df4bdc64 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "zkbob-ui",
- "version": "2.1.0",
+ "version": "2.2.0",
"private": true,
"dependencies": {
"@dicebear/avatars": "^4.10.2",
diff --git a/src/components/AccountSetUpModal/Generate/index.js b/src/components/AccountSetUpModal/Generate/index.js
index e4b6f6c1..6b260494 100644
--- a/src/components/AccountSetUpModal/Generate/index.js
+++ b/src/components/AccountSetUpModal/Generate/index.js
@@ -3,7 +3,7 @@ import styled from 'styled-components';
import WalletConnectors from 'components/WalletConnectors';
-export default ({ generate, isCreation }) => {
+export default ({ next, isCreation }) => {
return (
@@ -12,7 +12,7 @@ export default ({ generate, isCreation }) => {
: 'Select the wallet you used to create your zkAccount'
}
-
+
);
};
diff --git a/src/components/AccountSetUpModal/Sign/index.js b/src/components/AccountSetUpModal/Sign/index.js
index 41599dd1..d953ab84 100644
--- a/src/components/AccountSetUpModal/Sign/index.js
+++ b/src/components/AccountSetUpModal/Sign/index.js
@@ -1,18 +1,32 @@
-import React from 'react';
+import React, { useState, useCallback } from 'react';
import styled from 'styled-components';
import Spinner from 'components/Spinner';
+import Button from 'components/Button';
+
+export default ({ isCreation, sign }) => {
+ const [isLoading, setIsLoading] = useState(false);
+
+ const onClick = useCallback(async () => {
+ setIsLoading(true);
+ try {
+ await sign();
+ } catch (error) {
+ console.error(error);
+ }
+ setIsLoading(false);
+ }, [sign]);
-export default ({ isCreation }) => {
return (
-
+ {isLoading && }
{isCreation
? 'Your zkAccount is being created based on the connected wallet.'
: 'Accessing your zkAccount with your connected wallet.'
}
+ {!isLoading && }
);
};
diff --git a/src/components/AccountSetUpModal/index.js b/src/components/AccountSetUpModal/index.js
index 611a469f..34d89813 100644
--- a/src/components/AccountSetUpModal/index.js
+++ b/src/components/AccountSetUpModal/index.js
@@ -103,20 +103,12 @@ export default ({ isOpen, onClose, saveZkAccountMnemonic, closePasswordModal })
}, []);
const generate = useCallback(async () => {
- const nextStep = step === STEP.CREATE_WITH_WALLET
- ? STEP.SING_MESSAGE_TO_CREATE
- : STEP.SING_MESSAGE_TO_RESTORE;
- setStep(nextStep);
- try {
- const message = 'Access zkBob account.\n\nOnly sign this message for a trusted client!';
- const signedMessage = await signMessageAsync({ message });
- const newMnemonic = ethers.utils.entropyToMnemonic(md5.array(signedMessage));
- setConfirmedMnemonic(newMnemonic);
- setStep(STEP.CREATE_PASSWORD);
- } catch (error) {
- setStep(step);
- }
- }, [signMessageAsync, step]);
+ const message = 'Access zkBob account.\n\nOnly sign this message for a trusted client!';
+ const signedMessage = await signMessageAsync({ message });
+ const newMnemonic = ethers.utils.entropyToMnemonic(md5.array(signedMessage));
+ setConfirmedMnemonic(newMnemonic);
+ setStep(STEP.CREATE_PASSWORD);
+ }, [signMessageAsync]);
const confirmPassword = useCallback(password => {
const isNewAccount = !!newMnemonic;
@@ -148,7 +140,7 @@ export default ({ isOpen, onClose, saveZkAccountMnemonic, closePasswordModal })
break;
case STEP.CREATE_WITH_WALLET:
title = 'Create new zkAccount';
- component = ;
+ component = setStep(STEP.SING_MESSAGE_TO_CREATE)} />;
prevStep = STEP.CREATE_OPTIONS;
break;
case STEP.CREATE_WITH_SECRET:
@@ -158,7 +150,7 @@ export default ({ isOpen, onClose, saveZkAccountMnemonic, closePasswordModal })
break;
case STEP.RESTORE_WITH_WALLET:
title = 'Login to your zkAccount';
- component = ;
+ component = setStep(STEP.SING_MESSAGE_TO_RESTORE)} />;
prevStep = STEP.RESTORE_OPTIONS;
break;
case STEP.RESTORE_WITH_SECRET:
@@ -173,13 +165,13 @@ export default ({ isOpen, onClose, saveZkAccountMnemonic, closePasswordModal })
break;
case STEP.SING_MESSAGE_TO_CREATE:
title = 'Sign the message to create your zkAccount';
- component = ;
- prevStep = null;
+ component = ;
+ prevStep = STEP.CREATE_WITH_WALLET;
break;
case STEP.SING_MESSAGE_TO_RESTORE:
title = 'Sign the message to login to your zkAccount';
- component = ;
- prevStep = null;
+ component = ;
+ prevStep = STEP.RESTORE_WITH_WALLET;
break;
case STEP.CREATE_PASSWORD:
title = 'Create password';
diff --git a/src/components/Button/index.js b/src/components/Button/index.js
index 39eb351a..a2b49a6e 100644
--- a/src/components/Button/index.js
+++ b/src/components/Button/index.js
@@ -4,15 +4,16 @@ import styled from 'styled-components';
import SpinnerDefault from 'components/Spinner';
export default props => {
+ const { loading, ...otherProps } = props;
switch(props.type) {
case 'link':
- return ;
+ return ;
case 'pripary':
default:
return (
-