fix(GetAllCommunityTokens): Add GetAllCommunityTokens function
Issue #10254
This commit is contained in:
parent
83998272dd
commit
4935848287
|
@ -3251,6 +3251,10 @@ func (m *Manager) GetCommunityTokens(communityID string) ([]*CommunityToken, err
|
||||||
return m.persistence.GetCommunityTokens(communityID)
|
return m.persistence.GetCommunityTokens(communityID)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *Manager) GetAllCommunityTokens() ([]*CommunityToken, error) {
|
||||||
|
return m.persistence.GetAllCommunityTokens()
|
||||||
|
}
|
||||||
|
|
||||||
func (m *Manager) ImageToBase64(uri string) string {
|
func (m *Manager) ImageToBase64(uri string) string {
|
||||||
file, err := os.Open(uri)
|
file, err := os.Open(uri)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -909,6 +909,18 @@ func (p *Persistence) GetCommunityChatIDs(communityID types.HexBytes) ([]string,
|
||||||
return ids, nil
|
return ids, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (p *Persistence) GetAllCommunityTokens() ([]*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`)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
defer rows.Close()
|
||||||
|
|
||||||
|
return p.getCommunityTokensInternal(rows)
|
||||||
|
}
|
||||||
|
|
||||||
func (p *Persistence) GetCommunityTokens(communityID string) ([]*CommunityToken, error) {
|
func (p *Persistence) GetCommunityTokens(communityID string) ([]*CommunityToken, error) {
|
||||||
rows, err := p.db.Query(`SELECT community_id, address, type, name, symbol, description, supply,
|
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
|
infinite_supply, transferable, remote_self_destruct, chain_id, deploy_state, image_base64
|
||||||
|
@ -918,6 +930,10 @@ func (p *Persistence) GetCommunityTokens(communityID string) ([]*CommunityToken,
|
||||||
}
|
}
|
||||||
defer rows.Close()
|
defer rows.Close()
|
||||||
|
|
||||||
|
return p.getCommunityTokensInternal(rows)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *Persistence) getCommunityTokensInternal(rows *sql.Rows) ([]*CommunityToken, error) {
|
||||||
tokens := []*CommunityToken{}
|
tokens := []*CommunityToken{}
|
||||||
|
|
||||||
for rows.Next() {
|
for rows.Next() {
|
||||||
|
|
|
@ -3540,6 +3540,10 @@ func (m *Messenger) GetCommunityTokens(communityID string) ([]*communities.Commu
|
||||||
return m.communitiesManager.GetCommunityTokens(communityID)
|
return m.communitiesManager.GetCommunityTokens(communityID)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *Messenger) GetAllCommunityTokens() ([]*communities.CommunityToken, error) {
|
||||||
|
return m.communitiesManager.GetAllCommunityTokens()
|
||||||
|
}
|
||||||
|
|
||||||
func (m *Messenger) AddCommunityToken(token *communities.CommunityToken) (*communities.CommunityToken, error) {
|
func (m *Messenger) AddCommunityToken(token *communities.CommunityToken) (*communities.CommunityToken, error) {
|
||||||
return m.communitiesManager.AddCommunityToken(token)
|
return m.communitiesManager.AddCommunityToken(token)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1278,6 +1278,10 @@ func (api *PublicAPI) GetCommunityTokens(communityID string) ([]*communities.Com
|
||||||
return api.service.messenger.GetCommunityTokens(communityID)
|
return api.service.messenger.GetCommunityTokens(communityID)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (api *PublicAPI) GetAllCommunityTokens() ([]*communities.CommunityToken, error) {
|
||||||
|
return api.service.messenger.GetAllCommunityTokens()
|
||||||
|
}
|
||||||
|
|
||||||
func (api *PublicAPI) AddCommunityToken(token *communities.CommunityToken) (*communities.CommunityToken, error) {
|
func (api *PublicAPI) AddCommunityToken(token *communities.CommunityToken) (*communities.CommunityToken, error) {
|
||||||
return api.service.messenger.AddCommunityToken(token)
|
return api.service.messenger.AddCommunityToken(token)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue