Commit Graph

2 Commits

Author SHA1 Message Date
Pascal Precht 25b0641cc2 feat: introduce first JoinCommunityView for token-gated communities
This does a few things:

- It integrates with the latest `CommunityTokensMetadata` to access
  community specific ERC721 token
- It changes `ChatLayout` such that it conditionally loads either
  `ChatView` or `JoinCommunityView`. `JoinCommunityView` has been
  specifically designed for token-gated communities

Here's what works (in terms of token permissions):

1. If a community has token permissions and the the current users is not
   a member of that community, we show `JoinCommunityView` instead of
   `ChatView`
2. Any community token permissions of type "Become member" are listed in
   the `JoinCommunityView`
3. There are different types of token critera a permission can have:
   ERC20 token, ERC721 token, or ENS (which is also ERC721 but we have
   a type for that nonetheless)

   Only ERC20 token balances are checked for the known wallet accounts.
   This happens every time the known token list has been updated (every
   10 min atm).

   We still need to add balance checks for any ERC721 tokens and ENS.
4. If token permissions are created, updated or deleted by the community
   owner, the `JoinCommunityView` will update in real-time.

You'll also notice that the `Reveal my address and request access`
button will be enabled if any of the token permissions are fulfilled
(only ERC20 at the time being). Clicking that button will not yet send
a request.

This will be done in the next step as part of https://github.com/status-im/status-desktop/issues/9761
2023-03-09 16:35:06 +01:00
Michał Cieślak d813cc12b8 chore(CommunityPermissions): refactor access to stores in CP components
So far CP components (views, panels) were accessing stores directly.
Now `CommunitySettingsView` is a single place where stores are accessed.
Other components no longer depend on stores.

Moreover:
- dedicated store `PermissionsStore` created for handling permissions
  in a single, separated place
- storybook pages fixed

Closes: #9784
2023-03-08 12:02:55 +01:00