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: introduce SaveCommunityToken() and change AddCommunityToken() #3798

Merged
merged 1 commit into from
Jul 26, 2023

Conversation

0x-r4bbit
Copy link
Member

@0x-r4bbit 0x-r4bbit commented Jul 25, 2023

This is a breaking change!

Prior to this commit we had AddCommunityToken(token *communities, croppedImage CroppedImage) that we used to

  1. add a CommunityToken to the user's database and
  2. to create a CommunityTokenMetadata from it which is then added to the community's CommunityDescription and published to its members

However, I've then discovered that we need to separate these two things, such that we can deploy a community token, then add it to the database only for tracking purposes, then add it to the community description (and propagate to members) once we know that the deploy tx indeed went through.

To implement this, this commit introduces a new API SaveCommunityToken(token *communities.CommunityToken, croppedImage CroppedImage) which adds the token to the database only and doesn't touch the community description.

The AddCommunityToken API is then changed that it's exclusively used for adding an already saved CommunityToken to the community description so it can be published to members. Hence, the signature is now AddCommunityToken(communityID string, chainID int, address string), which makes this a breaking change.

Clients that used AddCommunityToken() before now need to ensure that they first call SaveCommunityToken() as AddCommunityToken() will fail otherwise.

@status-im-auto
Copy link
Member

status-im-auto commented Jul 25, 2023

Jenkins Builds

Click to see older builds (12)
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ 9e63bc8 #1 2023-07-25 11:46:34 ~3 min linux 📦zip
✔️ 9e63bc8 #1 2023-07-25 11:47:47 ~4 min ios 📦zip
✔️ 9e63bc8 #1 2023-07-25 11:48:43 ~5 min android 📦aar
✖️ 9e63bc8 #1 2023-07-25 12:00:37 ~17 min tests 📄log
✖️ 9e63bc8 #3 2023-07-25 13:14:08 ~20 min tests 📄log
✖️ 9e63bc8 #4 2023-07-26 10:42:25 ~45 sec tests 📄log
✖️ 1bbbcab #5 2023-07-26 10:47:47 ~40 sec tests 📄log
✔️ 1bbbcab #2 2023-07-26 10:50:11 ~3 min linux 📦zip
✔️ 1bbbcab #2 2023-07-26 10:51:47 ~4 min android 📦aar
✔️ 1bbbcab #2 2023-07-26 10:52:10 ~5 min ios 📦zip
✖️ 1bbbcab #6 2023-07-26 10:56:42 ~35 sec tests 📄log
✖️ 1bbbcab #7 2023-07-26 11:05:04 ~35 sec tests 📄log
Commit #️⃣ Finished (UTC) Duration Platform Result
✖️ f91fbe4 #8 2023-07-26 11:12:28 ~35 sec tests 📄log
✔️ f91fbe4 #3 2023-07-26 11:13:23 ~1 min linux 📦zip
✔️ f91fbe4 #3 2023-07-26 11:13:58 ~2 min android 📦aar
✔️ f91fbe4 #3 2023-07-26 11:14:39 ~2 min ios 📦zip
✖️ f91fbe4 #9 2023-07-26 11:24:45 ~35 sec tests 📄log
✖️ f91fbe4 #10 2023-07-26 12:17:10 ~7.8 sec tests 📄log
✔️ 0bd4c55 #4 2023-07-26 12:22:06 ~3 min linux 📦zip
✔️ 0bd4c55 #4 2023-07-26 12:22:09 ~3 min ios 📦zip
✔️ 0bd4c55 #4 2023-07-26 12:23:53 ~5 min android 📦aar
✔️ 0bd4c55 #11 2023-07-26 12:42:15 ~23 min tests 📄log

0x-r4bbit added a commit to status-im/status-desktop that referenced this pull request Jul 25, 2023
As discussed in status-im/status-go#3798, there
was a need to separate the logic in `AddCommunityToken()` into two API.

This commit adjust the client to these changes such that:

1. After community token deployment tx was sent, we create
   a `CommunityToken` and add it to the database for tracking purposes
2. Once the tx is mined or dropped, we add the community token to the
   community description and publish it, or we update the deployment
   state in the database

Needs: status-im/status-go#3798
@0x-r4bbit 0x-r4bbit force-pushed the refactor/add-community-token branch 2 times, most recently from 1bbbcab to f91fbe4 Compare July 26, 2023 11:11
…oken()`

**This is a breaking change!**

Prior to this commit we had `AddCommunityToken(token *communities,
croppedImage CroppedImage)` that we used to

1. add a `CommunityToken` to the user's database and
2. to create a `CommunityTokenMetadata` from it which is then added to
   the community's `CommunityDescription` and published to its members

However, I've then discovered that we need to separate these two things,
such that we can deploy a community token, then add it to the database
only for tracking purposes, **then** add it to the community description
(and propagate to members) once we know that the deploy tx indeed went
through.

To implement this, this commit introduces a new API
`SaveCommunityToken(token *communities.CommunityToken, croppedImage
CroppedImage)` which adds the token to the database only and doesn't
touch the community description.

The `AddCommunityToken` API is then changed that it's exclusively used
for adding an already saved `CommunityToken` to the community
description so it can be published to members. Hence, the signature is
now `AddCommunityToken(communityID string, chainID int, address
string)`, which makes this a breaking change.

Clients that used `AddCommunityToken()` before now need to ensure that
they first call `SaveCommunityToken()` as `AddCommunityToken()` will
fail otherwise.
@0x-r4bbit 0x-r4bbit force-pushed the refactor/add-community-token branch from f91fbe4 to 0bd4c55 Compare July 26, 2023 12:18
@0x-r4bbit 0x-r4bbit merged commit e8bac91 into develop Jul 26, 2023
7 checks passed
@0x-r4bbit 0x-r4bbit deleted the refactor/add-community-token branch July 26, 2023 12:45
0x-r4bbit added a commit to status-im/status-desktop that referenced this pull request Jul 26, 2023
As discussed in status-im/status-go#3798, there
was a need to separate the logic in `AddCommunityToken()` into two API.

This commit adjust the client to these changes such that:

1. After community token deployment tx was sent, we create
   a `CommunityToken` and add it to the database for tracking purposes
2. Once the tx is mined or dropped, we add the community token to the
   community description and publish it, or we update the deployment
   state in the database

Needs: status-im/status-go#3798
0x-r4bbit added a commit to status-im/status-desktop that referenced this pull request Jul 26, 2023
As discussed in status-im/status-go#3798, there
was a need to separate the logic in `AddCommunityToken()` into two API.

This commit adjust the client to these changes such that:

1. After community token deployment tx was sent, we create
   a `CommunityToken` and add it to the database for tracking purposes
2. Once the tx is mined or dropped, we add the community token to the
   community description and publish it, or we update the deployment
   state in the database

Needs: status-im/status-go#3798
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants