Skip to content

Commit

Permalink
remove unused community owner provider funcs
Browse files Browse the repository at this point in the history
  • Loading branch information
benny-conn committed Aug 22, 2023
1 parent 22e45bf commit 06f0a54
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 60 deletions.
45 changes: 0 additions & 45 deletions service/multichain/poap/poap.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,51 +189,6 @@ func (d *Provider) GetTokensByContractAddressAndOwner(ctx context.Context, owner
return nil, multichain.ChainAgnosticContract{}, fmt.Errorf("poap has no way to retrieve tokens by contract address")
}

func (d *Provider) GetCommunityOwners(ctx context.Context, contractAddress persist.Address, limit, offset int) ([]multichain.ChainAgnosticCommunityOwner, error) {
req, err := http.NewRequestWithContext(ctx, http.MethodGet, fmt.Sprintf("%s/events/%s", d.apiURL, contractAddress), nil)
if err != nil {
return nil, err
}
req.Header.Set("X-API-KEY", d.apiKey)
resp, err := d.httpClient.Do(req)
if err != nil {
return nil, err
}
defer resp.Body.Close()
if resp.StatusCode != http.StatusOK {
return nil, err
}
var event poapEvent
if err := json.NewDecoder(resp.Body).Decode(&event); err != nil {
return nil, err
}
nextReq, err := http.NewRequestWithContext(ctx, http.MethodGet, fmt.Sprintf("%s/events/%d/poaps&limit=%d&offset=%d", d.apiURL, event.ID, limit, offset), nil)
if err != nil {
return nil, err
}
nextReq.Header.Set("X-API-KEY", d.apiKey)
nextReq.Header.Set("Authorization", fmt.Sprintf("Bearer %s", d.authToken))
nextResp, err := d.httpClient.Do(req)
if err != nil {
return nil, err
}
defer nextResp.Body.Close()
if resp.StatusCode != http.StatusOK {
return nil, err
}
var eventPoaps eventPoaps
if err := json.NewDecoder(nextResp.Body).Decode(&eventPoaps); err != nil {
return nil, err
}
var owners []multichain.ChainAgnosticCommunityOwner
for _, token := range eventPoaps.Tokens {
owners = append(owners, multichain.ChainAgnosticCommunityOwner{
Address: persist.Address(token.Owner.ID), // TODO is this the address?
})
}
return owners, nil
}

// GetTokensByTokenIdentifiers retrieves tokens for a token identifiers on the Poap Blockchain
func (d *Provider) GetTokensByTokenIdentifiers(ctx context.Context, tokenIdentifiers multichain.ChainAgnosticIdentifiers, limit, offset int) ([]multichain.ChainAgnosticToken, multichain.ChainAgnosticContract, error) {
tid := tokenIdentifiers.TokenID
Expand Down
15 changes: 0 additions & 15 deletions service/multichain/tezos/tezos.go
Original file line number Diff line number Diff line change
Expand Up @@ -492,21 +492,6 @@ func (d *Provider) GetOwnedTokensByContract(ctx context.Context, contractAddress
return tokens, contract, nil
}

func (d *Provider) GetCommunityOwners(ctx context.Context, contractAddress persist.Address, maxLimit, maxOffset int) ([]multichain.ChainAgnosticCommunityOwner, error) {
tokens, _, err := d.GetTokensByContractAddress(ctx, contractAddress, maxLimit, maxOffset)
if err != nil {
return nil, err
}
owners := make([]multichain.ChainAgnosticCommunityOwner, len(tokens))
for i, token := range tokens {
owners[i] = multichain.ChainAgnosticCommunityOwner{
Address: token.OwnerAddress,
}
}
return owners, nil

}

/*
gql example
{
Expand Down

0 comments on commit 06f0a54

Please sign in to comment.