From 961a0e57572956a1f9d4950a6654de865bf6f600 Mon Sep 17 00:00:00 2001 From: brusher_ru Date: Tue, 11 Jun 2024 14:26:27 +0300 Subject: [PATCH 1/8] chore: update roadmap --- Roadmap.md | 37 ++++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/Roadmap.md b/Roadmap.md index 5c35ad4..8887884 100644 --- a/Roadmap.md +++ b/Roadmap.md @@ -3,6 +3,7 @@ 1. [X] Create wallet 1. [X] Show mnemonics 2. [X] Ask to confirm + - [X] Click on tag to place a word 3. [X] Ask display name and password 2. [X] Recover from mnemonics @@ -74,23 +75,33 @@ -- -Z. [X] Lock wallet when idle for some time +Features -Y. [X] Update wallet format to allow adding other account types, view-only accounts, etc +- [X] Lock wallet when idle for some time -X. [X] Publish changed @spacemesh/ed25519-bip32 - 0. [X] Make it work well for smapp-lite - 1. [X] Make it works without breaking change... - 2. [ ] Open PR (to sdk repo) - 3. [X] Publish to NPM - 4. [X] Update smapp-lite/package.json +- [X] Update wallet format to allow adding other account types, view-only accounts, etc -W. [X] Add VirtualScroll on WalletScreen +- [X] Publish changed @spacemesh/ed25519-bip32 + 0. [X] Make it work well for smapp-lite + 1. [X] Make it works without breaking change... + 2. [ ] Open PR (to sdk repo) + 3. [X] Publish to NPM + 4. [X] Update smapp-lite/package.json -V. [X] Auto-fetch data on switching account / network +- [X] Add VirtualScroll on WalletScreen -U. [ ] Add cache (service worker) for static resources (to allow working offline) +- [X] Auto-fetch data on switching account / network -T. [ ] Add cache for API requests (if possible to replace POST with GET on API side) +- [ ] Add cache (service worker) for static resources (to allow working offline) -S. [X] Auto-fetch transactions and rewards periodically +- [ ] Add cache for API requests (if possible to replace POST with GET on API side) + +- [X] Auto-fetch transactions and rewards periodically + +- [ ] Add SMH/Smidge Inputs + +- [ ] Add QR Code scanner + +- [ ] Load more transactions / rewards (now it is limited to latest 1000) + +- [ ] Session stickiness \ No newline at end of file From a7dc676e4b10b11ee93b43a0e8530f0633405672 Mon Sep 17 00:00:00 2001 From: brusher_ru Date: Wed, 12 Jun 2024 19:41:42 +0300 Subject: [PATCH 2/8] tweak: verify mnemonics by clicking on words --- .../createWallet/VerifyMnemonicScreen.tsx | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/screens/createWallet/VerifyMnemonicScreen.tsx b/src/screens/createWallet/VerifyMnemonicScreen.tsx index 498a1a6..eeaa94f 100644 --- a/src/screens/createWallet/VerifyMnemonicScreen.tsx +++ b/src/screens/createWallet/VerifyMnemonicScreen.tsx @@ -78,6 +78,21 @@ function VerifyMnemonicScreen(): JSX.Element { } }; + const placeWord = (wordIndex: number, from: SlotIndex) => { + if (from === 'bank') { + const occupiedSlots = Object.keys(slots); + const freeSlots = indexesToCheck + .sort((a, b) => a - b) + .filter((k) => !occupiedSlots.includes(String(k))); + const nextFreeSlot = freeSlots[0]; + if (!nextFreeSlot) { + throw new Error('Cannot find next empty slot'); + } + return moveWord(wordIndex, nextFreeSlot, from); + } + return moveWord(wordIndex, 'bank', from); + }; + const allWordsPlaced = wordsInBank.length === 0 && Object.entries(slots).every(([k, v]) => parseInt(k, 10) === v); @@ -100,6 +115,7 @@ function VerifyMnemonicScreen(): JSX.Element { index={wordIndex} from="bank" moveWord={moveWord} + placeWord={placeWord} /> ))} @@ -125,6 +141,7 @@ function VerifyMnemonicScreen(): JSX.Element { index={placedWord} from={idx} moveWord={moveWord} + placeWord={placeWord} full /> ) : ( @@ -173,6 +190,7 @@ function VerifyMnemonicScreen(): JSX.Element { type DraggableTagProps = { moveWord: (wordIndex: number, slot: SlotIndex, from: SlotIndex) => void; + placeWord: (wordIndex: number, from: SlotIndex) => void; from: SlotIndex; full?: boolean; } & DraggableItem; @@ -182,6 +200,7 @@ function DraggableTag({ word, index, moveWord, + placeWord, from, full, }: DraggableTagProps): JSX.Element { @@ -219,7 +238,7 @@ function DraggableTag({ opacity={isDragging ? 0.5 : 1} userSelect="none" fontSize="md" - onDoubleClick={() => moveWord(index, 'bank', from)} + onClick={() => placeWord(index, from)} {...fullStyles} > {full && typeof from === 'number' && ( From 8b946dbb17d4a5bccbabf07c993c5a501798b63b Mon Sep 17 00:00:00 2001 From: brusher_ru Date: Wed, 12 Jun 2024 19:42:16 +0300 Subject: [PATCH 3/8] tweak: update TransactionService/List request argument --- src/api/requests/tx.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api/requests/tx.ts b/src/api/requests/tx.ts index e01882a..7f4f0d7 100644 --- a/src/api/requests/tx.ts +++ b/src/api/requests/tx.ts @@ -30,7 +30,7 @@ export const fetchTransactionsChunk = async ( fetch(`${rpc}/spacemesh.v2alpha1.TransactionService/List`, { method: 'POST', body: JSON.stringify({ - principal: address, + address, include_state: true, include_result: true, limit, From aeef18278cbcc4aabbaca4b60cedc09eb81f76f5 Mon Sep 17 00:00:00 2001 From: brusher_ru Date: Wed, 12 Jun 2024 20:49:52 +0300 Subject: [PATCH 4/8] chore: fix deprecated defaultProps --- .eslintrc.json | 6 ++++++ package.json | 2 +- src/components/BackButton.tsx | 12 ++++-------- src/components/ExplorerButton.tsx | 15 ++++----------- src/components/FormAddressSelect.tsx | 12 +++--------- src/components/FormInput.tsx | 14 ++++---------- src/components/FormInputViewOnly.tsx | 11 +++-------- src/components/FormKeySelect.tsx | 12 +++--------- src/components/FormMultiKeySelect.tsx | 6 +----- src/components/FormSelect.tsx | 14 ++++---------- src/components/FormTextarea.tsx | 11 +++-------- src/components/PasswordInput.tsx | 8 +------- src/components/PreviewDataRow.tsx | 8 ++------ src/components/TxDetails.tsx | 5 ----- src/screens/createWallet/VerifyMnemonicScreen.tsx | 8 ++------ yarn.lock | 2 +- 16 files changed, 42 insertions(+), 104 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index c4713ac..7401342 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -39,6 +39,12 @@ "react/react-in-jsx-scope": "off", "react/jsx-filename-extension": ["warn", { "extensions": [".tsx"] }], "react/jsx-props-no-spreading": "off", + "react/require-default-props": [ + "error", + { + "functions": "defaultArguments" + } + ], "linebreak-style": "off", "eol-last": "off", "max-len": ["warn", { "code": 80 }], diff --git a/package.json b/package.json index a8516a0..240c71d 100644 --- a/package.json +++ b/package.json @@ -75,7 +75,7 @@ "eslint-plugin-import": "^2.25.4", "eslint-plugin-jsx-a11y": "^6.5.1", "eslint-plugin-prettier": "^4.0.0", - "eslint-plugin-react": "^7.28.0", + "eslint-plugin-react": "^7.30.0", "eslint-plugin-react-hooks": "^4.3.0", "eslint-plugin-simple-import-sort": "^9.0.0", "husky": "^8.0.3", diff --git a/src/components/BackButton.tsx b/src/components/BackButton.tsx index 38766c7..aca4fc2 100644 --- a/src/components/BackButton.tsx +++ b/src/components/BackButton.tsx @@ -3,20 +3,20 @@ import { useNavigate } from 'react-router-dom'; import { Button } from '@chakra-ui/react'; import { IconArrowNarrowLeft } from '@tabler/icons-react'; +import { noop } from '../utils/func'; + type Props = { onClick?: () => void; }; -function BackButton({ onClick }: Props): JSX.Element { +function BackButton({ onClick = noop }: Props): JSX.Element { const navigate = useNavigate(); return (