fix(GetCommunityTokens): Change API call - use only communityId param

Fix #9725
This commit is contained in:
Michal Iskierko 2023-03-02 18:33:30 +01:00 committed by Michał Iskierko
parent 9fbc4d51ee
commit 8a296407f3
6 changed files with 12 additions and 12 deletions

View File

@ -1 +1 @@
0.136.1
0.136.2

View File

@ -2696,8 +2696,8 @@ func findIndexFile(files []*torrent.File) (index int, ok bool) {
return 0, false
}
func (m *Manager) GetCommunityTokens(communityID string, chainID int) ([]*CommunityToken, error) {
return m.persistence.GetCommunityTokens(communityID, chainID)
func (m *Manager) GetCommunityTokens(communityID string) ([]*CommunityToken, error) {
return m.persistence.GetCommunityTokens(communityID)
}
func (m *Manager) AddCommunityToken(token *CommunityToken) error {

View File

@ -828,10 +828,10 @@ func (p *Persistence) GetCommunityChatIDs(communityID types.HexBytes) ([]string,
return ids, nil
}
func (p *Persistence) GetCommunityTokens(communityID string, chainID int) ([]*CommunityToken, error) {
func (p *Persistence) GetCommunityTokens(communityID string) ([]*CommunityToken, error) {
rows, err := p.db.Query(`SELECT community_id, address, type, name, symbol, description, supply,
infinite_supply, transferable, remote_self_destruct, chain_id, deploy_state, image_base64
FROM community_tokens WHERE community_id = ? AND chain_id = ?`, communityID, chainID)
FROM community_tokens WHERE community_id = ?`, communityID)
if err != nil {
return nil, err
}

View File

@ -371,7 +371,7 @@ func (s *PersistenceSuite) TestUpdateCommunitySettings() {
}
func (s *PersistenceSuite) TestGetCommunityTokens() {
tokens, err := s.db.GetCommunityTokens("123", 1)
tokens, err := s.db.GetCommunityTokens("123")
s.Require().NoError(err)
s.Require().Len(tokens, 0)
@ -412,14 +412,14 @@ func (s *PersistenceSuite) TestGetCommunityTokens() {
err = s.db.AddCommunityToken(&token2)
s.Require().NoError(err)
tokens, err = s.db.GetCommunityTokens("123", 1)
tokens, err = s.db.GetCommunityTokens("123")
s.Require().NoError(err)
s.Require().Len(tokens, 1)
s.Require().Equal(token, *tokens[0])
err = s.db.UpdateCommunityTokenState("0x123", Deployed)
s.Require().NoError(err)
tokens, err = s.db.GetCommunityTokens("123", 1)
tokens, err = s.db.GetCommunityTokens("123")
s.Require().NoError(err)
s.Require().Len(tokens, 1)
s.Require().Equal(Deployed, tokens[0].DeployState)

View File

@ -3334,8 +3334,8 @@ func (m *Messenger) chatMessagesToWakuMessages(chatMessages []*common.Message, c
return wakuMessages, nil
}
func (m *Messenger) GetCommunityTokens(communityID string, chainID int) ([]*communities.CommunityToken, error) {
return m.communitiesManager.GetCommunityTokens(communityID, chainID)
func (m *Messenger) GetCommunityTokens(communityID string) ([]*communities.CommunityToken, error) {
return m.communitiesManager.GetCommunityTokens(communityID)
}
func (m *Messenger) AddCommunityToken(token *communities.CommunityToken) error {

View File

@ -1260,8 +1260,8 @@ func (api *PublicAPI) BuildContact(publicKey string) (*protocol.Contact, error)
return api.service.messenger.BuildContact(publicKey)
}
func (api *PublicAPI) GetCommunityTokens(communityID string, chainID int) ([]*communities.CommunityToken, error) {
return api.service.messenger.GetCommunityTokens(communityID, chainID)
func (api *PublicAPI) GetCommunityTokens(communityID string) ([]*communities.CommunityToken, error) {
return api.service.messenger.GetCommunityTokens(communityID)
}
func (api *PublicAPI) AddCommunityToken(token *communities.CommunityToken) error {