From 8f77279a59394a61bfd1e63fe17a49cdf26a38e7 Mon Sep 17 00:00:00 2001 From: Alexander <69318224+owlsua@users.noreply.github.com> Date: Sun, 29 Sep 2024 21:20:04 +0200 Subject: [PATCH] A-1208039790574731: sign/verify message (#185) * feat: add nested navigation and wallets menu * feat: add Textarea basic component, replace textarea with new component on Restore wallet * feat: add new array helpers * feat: add Sign and Verify message components * feat: add Message page * feat: update MIntlayer lib with new messages functions update Textarea * chore: remove console.log * feat: add message verification * feat: update wasm library (#187) * feat: replace signing/verify function with verifyChallenge and signChallenge * feat: remove steps from signin * feat: remove steps from verify --------- Co-authored-by: Sergey --- src/assets/images/icon-checkmark.svg | 8 + src/assets/images/icon-cross.svg | 8 + src/assets/images/icon-triangle.svg | 5 + src/assets/images/icon-wallet.svg | 4 + .../Textarea/Textarea.css} | 7 +- src/components/basic/Textarea/Textarea.js | 49 + src/components/basic/index.js | 2 + .../composed/Navigation/Navigation.css | 58 +- .../composed/Navigation/Navigation.js | 86 +- .../composed/Navigation/NestedNavigation.css | 75 ++ .../composed/Navigation/NestedNavigation.js | 56 ++ .../RestoreSeedField/RestoreSeedField.js | 28 +- .../Message/SignMessage/SignMessage.css | 32 + .../Message/SignMessage/SignMessage.js | 293 ++++++ .../Message/VerifyMessage/VerifyMessage.css | 49 + .../Message/VerifyMessage/VerifyMessage.js | 195 ++++ src/components/containers/index.js | 9 + src/index.js | 5 + src/pages/MessagePage/MessagePage.css | 27 + src/pages/MessagePage/MessagePage.js | 37 + src/pages/index.js | 4 +- .../@mintlayerlib-js/wasm_wrappers.d.ts | 261 +++++- .../@mintlayerlib-js/wasm_wrappers.js | 836 +++++++++++++----- .../@mintlayerlib-js/wasm_wrappers_bg.wasm | Bin 1911124 -> 2029022 bytes .../wasm_wrappers_bg.wasm.d.ts | 83 +- src/services/Crypto/Mintlayer/Mintlayer.js | 26 + src/utils/Constants/AppInfo/AppInfo.js | 52 ++ src/utils/Helpers/Array/Array.js | 31 +- 28 files changed, 2028 insertions(+), 298 deletions(-) create mode 100644 src/assets/images/icon-checkmark.svg create mode 100644 src/assets/images/icon-cross.svg create mode 100644 src/assets/images/icon-triangle.svg create mode 100644 src/assets/images/icon-wallet.svg rename src/components/{composed/RestoreSeedField/RestoreSeedField.css => basic/Textarea/Textarea.css} (65%) create mode 100644 src/components/basic/Textarea/Textarea.js create mode 100644 src/components/composed/Navigation/NestedNavigation.css create mode 100644 src/components/composed/Navigation/NestedNavigation.js create mode 100644 src/components/containers/Message/SignMessage/SignMessage.css create mode 100644 src/components/containers/Message/SignMessage/SignMessage.js create mode 100644 src/components/containers/Message/VerifyMessage/VerifyMessage.css create mode 100644 src/components/containers/Message/VerifyMessage/VerifyMessage.js create mode 100644 src/pages/MessagePage/MessagePage.css create mode 100644 src/pages/MessagePage/MessagePage.js diff --git a/src/assets/images/icon-checkmark.svg b/src/assets/images/icon-checkmark.svg new file mode 100644 index 00000000..e1a78730 --- /dev/null +++ b/src/assets/images/icon-checkmark.svg @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/src/assets/images/icon-cross.svg b/src/assets/images/icon-cross.svg new file mode 100644 index 00000000..62fa417d --- /dev/null +++ b/src/assets/images/icon-cross.svg @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/src/assets/images/icon-triangle.svg b/src/assets/images/icon-triangle.svg new file mode 100644 index 00000000..449b567b --- /dev/null +++ b/src/assets/images/icon-triangle.svg @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/src/assets/images/icon-wallet.svg b/src/assets/images/icon-wallet.svg new file mode 100644 index 00000000..e8497c3b --- /dev/null +++ b/src/assets/images/icon-wallet.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/src/components/composed/RestoreSeedField/RestoreSeedField.css b/src/components/basic/Textarea/Textarea.css similarity index 65% rename from src/components/composed/RestoreSeedField/RestoreSeedField.css rename to src/components/basic/Textarea/Textarea.css index cb8392b5..662c68ed 100644 --- a/src/components/composed/RestoreSeedField/RestoreSeedField.css +++ b/src/components/basic/Textarea/Textarea.css @@ -1,12 +1,13 @@ -.seed-textarea { +.textarea { + width: 100%; padding: 15px; resize: none; } -.seed-textarea.seed-invalid { +.textaria-invalid { border-bottom: 2px solid rgb(var(--color-red)); } -.seed-textarea.seed-valid { +.textaria-valid { border-bottom: 2px solid rgb(var(--color-green)); } diff --git a/src/components/basic/Textarea/Textarea.js b/src/components/basic/Textarea/Textarea.js new file mode 100644 index 00000000..650ec081 --- /dev/null +++ b/src/components/basic/Textarea/Textarea.js @@ -0,0 +1,49 @@ +import React, { useEffect, useState } from 'react' +import './Textarea.css' + +const Textarea = ({ + value, + onChange, + extraClasses, + id, + size, + validity = true, + disabled, +}) => { + const [textareaVakue, setTextareaValue] = useState(value ? value : '') + + useEffect(() => { + setTextareaValue(value) + }, [value]) + + const getExtraClasses = () => { + if (value && validity) { + return 'textaria-valid' + } else if (value && !validity) { + return 'textaria-invalid' + } else { + return '' + } + } + const onChangeHandler = ({ target }) => { + onChange && onChange({ target }) + setTextareaValue(target.value) + getExtraClasses() + } + + return ( +