Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/feat/sort-add-from-current-seed'…
Browse files Browse the repository at this point in the history
… into tmp/20241018
  • Loading branch information
dmy147 committed Oct 17, 2024
2 parents a147e0c + f7ae6a1 commit b774141
Showing 1 changed file with 3 additions and 13 deletions.
16 changes: 3 additions & 13 deletions src/ui/views/AddFromCurrentSeedPhrase/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,8 @@ export const UseSeedPhrase = () => {
[invokeEnterPassphrase, wallet?.getMnemonicKeyRingIdFromPublicKey]
);

const { value: timeStores } = useAsync(() =>
wallet.getHDKeyRingLastAddAddrTimeStore()
);

const seedPhraseList = useMemo(() => {
if (accountGroup && value && timeStores) {
if (accountGroup && value) {
const publicKeys = value.map((e) => e.publicKey!);
const pbMappings = Object.values(accountGroup[0]).reduce((pre, cur) => {
if (cur.type === KEYRING_TYPE['HdKeyring']) {
Expand All @@ -55,16 +51,10 @@ export const UseSeedPhrase = () => {
return publicKeys
.map((e) => pbMappings[e])
.filter((e) => !!e)
.map((e, index) => ({ ...e, index: index }))
.sort((a, b) => {
const aTime = timeStores?.[a.publicKey!] || 0;
const bTime = timeStores?.[b.publicKey!] || 0;

return bTime - aTime;
}) as TypeKeyringGroup[];
.map((e, index) => ({ ...e, index: index })) as TypeKeyringGroup[];
}
return [];
}, [accountGroup, value, timeStores]);
}, [accountGroup, value]);

return {
seedPhraseList,
Expand Down

0 comments on commit b774141

Please sign in to comment.