mirror of
https://github.com/status-im/status-go.git
synced 2025-01-09 14:16:21 +00:00
e8bac916ec
**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.