Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: remove active account usage #130

Merged
merged 9 commits into from
Sep 24, 2024

Conversation

iuricmp
Copy link
Contributor

@iuricmp iuricmp commented Sep 9, 2024

No description provided.

@iuricmp iuricmp requested a review from jefft0 September 9, 2024 14:09
@jefft0
Copy link
Contributor

jefft0 commented Sep 10, 2024

Be careful in this use of call. You put the caller address before send.
https://github.com/gnolang/dsocial/blob/925846f2055e9f107cd91ddb776afa3e7be06820/mobile/redux/features/signupSlice.ts#L210

@iuricmp iuricmp marked this pull request as ready for review September 16, 2024 11:41
@jefft0
Copy link
Contributor

jefft0 commented Sep 16, 2024

In dsocial/mobile, I enter npm run ts:check. You may want to do the same. Here are the relevant errors that it prints for me.

app/sign-up.tsx:100:35 - error TS2740: Type 'User' is missing the following properties from type 'KeyInfo': type, pubKey, equals, clone, and 8 more.

100         await dispatch(loggedIn({ keyInfo: newAccount })).unwrap();
                                      ~~~~~~~

  redux/features/accountSlice.ts:16:3
    16   keyInfo: KeyInfo;
         ~~~~~~~
    The expected type comes from property 'keyInfo' which is declared here on type 'LoginParam'

src/hooks/use-user-cache.ts:37:28 - error TS2345: Argument of type '{ name: any; password: string; pubKey: string; address: any; avatar: string; }' is not assignable to parameter of type 'User'.
  Property 'bech32' is missing in type '{ name: any; password: string; pubKey: string; address: any; avatar: string; }' but required in type 'User'.

37     usersCache.set(bech32, user);
                              ~~~~

  types.ts:20:3
    20   bech32: string;
         ~~~~~~
    'bech32' is declared here.

src/hooks/use-user-cache.ts:39:5 - error TS2322: Type '{ name: any; password: string; pubKey: string; address: any; avatar: string; }' is not assignable to type 'User'.

39     return user;
       ~~~~~~

Signed-off-by: Iuri Pereira <689440+iuricmp@users.noreply.github.com>
Signed-off-by: Iuri Pereira <689440+iuricmp@users.noreply.github.com>
Signed-off-by: Iuri Pereira <689440+iuricmp@users.noreply.github.com>
Signed-off-by: Iuri Pereira <689440+iuricmp@users.noreply.github.com>
Signed-off-by: Iuri Pereira <689440+iuricmp@users.noreply.github.com>
Signed-off-by: Iuri Pereira <689440+iuricmp@users.noreply.github.com>
@iuricmp iuricmp force-pushed the remove-get-active-account branch from ea939b8 to 4dc9db7 Compare September 18, 2024 07:28
Signed-off-by: Iuri Pereira <689440+iuricmp@users.noreply.github.com>
Signed-off-by: Iuri Pereira <689440+iuricmp@users.noreply.github.com>
Copy link
Contributor

@jefft0 jefft0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested on Android and iOS simulators.

@iuricmp iuricmp merged commit 1f0b034 into gnoverse:main Sep 24, 2024
1 check failed
@iuricmp iuricmp deleted the remove-get-active-account branch September 24, 2024 09:10
jefft0 added a commit to gnolang/gnonative that referenced this pull request Oct 10, 2024
Similar to PR gnoverse/dsocial#130, we update
gnoboard to use the new Gno Native Kit API which removes `selectAccount`
and requires passing the account address to `setPassword`, etc. This PR
has five commits:

1. The app needs to keep track of the active account, so add
`GnoboardProvider`.
2. Instead of calling Gno Native Kit `selectAccount`, call
`GnoboardProvider` `setAccount` to remember the active account.
3. `setPassword` needs the account address, so in `ReenterPassword` add
param `accountAddress`.
4. In wallet/home: Pass in the account instead of calling
`getActiveAccount`. Use the account address to call `queryAccount`.
5. As in a [similar dsocial
PR](gnoverse/dsocial#134), fix the Makefile to
call ts_check after node_modules.

With this PR, all known apps have been updated to remove `selectAcount`
and to pass the account address to the methods of Gno Native Kit, which
can be updated to remove deprecated functions and to make the address
not optional.

---------

Signed-off-by: Jeff Thompson <jeff@thefirst.org>
Copy link

🎉 This PR is included in version 1.11.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants