Skip to content

Latest commit

 

History

History
43 lines (30 loc) · 1.37 KB

Query-user-NFT-using-Mixin-API.md

File metadata and controls

43 lines (30 loc) · 1.37 KB

Mixin has provided an API for querying NFTs. But it wasn't really clear for a newbie to use. I will try to explain it.

  1. Authorization:Authorized

​ The Bearer token should be signed by the owner of the NFTs. Which means if you wanna query some user's NFT list, you should use the user's token to query instead of your bot's token.

  1. Parameters

​ There are five parameters, three of them are optional. Only "members" and "threshold" is required.

​ When you want to get someone's NFT list, those parameters should be:

# Example of golang
UserID := "44d9717d-8cae-4004-98a1-f9ad544dcfb1"
members := []string{UserID}
threshold := uint8(1)

​ When using fox-one's mixin-sdk-go, the whole thing that prints all NFTs of a user would be like:

# Example of golang
UserID := "44d9717d-8cae-4004-98a1-f9ad544dcfb1"
members := []string{UserID}
threshold := uint8(1)
offset, _ := time.Parse(time.RFC3339Nano,"2018-02-12T12:12:12.999999999Z")
limits := 500

nfts, err := rw.client.ReadCollectibleOutputs(ctx, members, threshold, offset, limits)
if err != nil {
        log.Println(err)
}
for _, i := range nfts{
        log.Printf("%+v", i)
}

Hope it will somehow help you.