Skip to content

Commit

Permalink
asset owner
Browse files Browse the repository at this point in the history
  • Loading branch information
asim committed Jul 15, 2022
1 parent 074150c commit 813a9ed
Show file tree
Hide file tree
Showing 3 changed files with 240 additions and 207 deletions.
10 changes: 9 additions & 1 deletion nft/handler/opensea.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func New() *OpenSea {
// set the api key
api.SetKey("X-API-KEY", key)
// set the cache
api.SetCache(true, time.Minute * 5)
api.SetCache(true, time.Minute*5)

return &OpenSea{
apiKey: key,
Expand Down Expand Up @@ -82,6 +82,10 @@ func (o *OpenSea) Assets(ctx context.Context, req *pb.AssetsRequest, rsp *pb.Ass
params += "&collection=" + req.Collection
}

if len(req.Owner) > 0 {
params += "&owner=" + req.Owner
}

var resp domain.AssetsResponse

if err := api.Get(uri+params, &resp); err != nil {
Expand Down Expand Up @@ -299,6 +303,10 @@ func (o *OpenSea) Collections(ctx context.Context, req *pb.CollectionsRequest, r

params += fmt.Sprintf("limit=%d&offset=%d", limit, offset)

if len(req.Owner) > 0 {
params += "&asset_owner=" + req.Owner
}

var resp domain.CollectionsResponse

if err := api.Get(uri+params, &resp); err != nil {
Expand Down

0 comments on commit 813a9ed

Please sign in to comment.