2. Get Data

Overview

This guide provides information on how to obtain data from the Zecrey NFT Marketplace. In most cases, this data is about the current status of the NFT marketplace (i.e. asset ownership and asset status). Most forms of data available are read-only, so user authentication is not required to update the Zecrey NFT marketplace status. This section describes the method to directly call the SDK package.

Examples of obtained data types commonly include:

  • Detailed information on assets or a specific asset, including obtaining account information, categories, collections, your own NFTs, tradable offers, etc.

  • Information of a specific user in the NFT marketplace

Account

Get account details by account name

  • Get information on the account by accountName

📚SDK REFERENCE

Example

  • Get account information with the name "Alice"

package main

import (
   "fmt"
   "github.com/Zecrey-Labs/zecrey-marketplace-go-sdk/sdk"
)

func main() {
   accountName := "Alice"
   accountInfo, err := sdk.GetAccountByAccountName(accountName)
   if err != nil { panic(err) }
   
   data, _:= json.Marshal(accountInfo)
   fmt.Println(string(data))
}

Example result

{
  account:
    {
        "id":17,
        "account_index":14,
        "account_name":"Alice",    
        "bio":"name:Alice age:18 city:New York ",
        "email":"[email protected]",
        "external_link":"https://alice.xyz",
        "twitter_link":"https://twitter.com/alice",
        "instagram_link":"https://www.instagram.com/alice/",
        "profile_image":"https://res.cloudinary.com/zecrey/image/upload/collection/ahykviwc0suhoyzusb5q.jpg",
        "profile_thumb":"https://res.cloudinary.com/zecrey/image/upload/collection/ioy2wcqupbgnuqvdtjfx.jpg",
        "banner_image":"https://res.cloudinary.com/zecrey/image/upload/collection/ljvwvjho9ucs5gpwmlkf.jpg",
        "banner_thumb":"https://res.cloudinary.com/zecrey/image/upload/collection/lo3vtlrcslcr1n7tgiuh.jpg",
        "created_at":1667835867
    }
}

Get assets by account name

  • Query the user's asset information

    Token

    Token ID

    BNB

    0

    LEG

    1

    REY

    2

Example

  • Get asset information with the name "Alice"

Example result

Get assets information

  • Query user asset information

  • Token information

    Token

    Token ID

    BNB

    0

    LEG

    1

    REY

    2

📚SDK REFERENCE

Example

  • Query token information

Example result

Get account index

  • Query accountIndex

📚SDK REFERENCE

Example

  • Query the account index of the name "Alice"

Example result

Get account registration status

  • Query whether the accountName has been registered

📚SDK REFERENCE

Example

  • Query if the account name "Alice" is already registered

Example result

Category

Get NFT categories

  • Get all NFT categories

📚SDK REFERENCE

Example

Example result

Collections

  • In the returned details about a collection, there will be a status attribute indicating its status (pending, created, expired, invalid, etc.).

  • The status of collections can be one of the following:

Status

CodeNumber

PENDING

0

CREATED

1

EXPIRED

2

INVALID

10

Get collections of an account by account index

  • Get the collections belonging to this account through accountIndex

  • The results returned include:

    • confirmedCollectionIdList: The collections that have been confirmed by Zecrey and exist in the form of an array id. And the details can be obtained through GetCollectionById.

    • pendingCollections: Collections under the pending status are waiting to be confirmed by Zecrey and cannot be used.

Example

  • Get collections created by the account name "Alice"

    • Query the accountIndex of Alice

    • Obtain the collections created by this account

Example result

Get collection details by ID

  • Get the collection information through collectionID

📚SDK REFERENCE

Example

  • Get the collection information withcollectionID =3

Example result

NFT

  • In the returned details about an NFT, there will be a status attribute indicating its status (pending, created, expired, invalid, etc.).

  • The NFT status can be one of the following:

    Status

    CodeNumber

    PENDING

    0

    CREATED

    1

    EXPIRED

    2

    INVALID

    10

Get NFTs of an account

  • Get the NFTs belonging to this account through the accountIndex or accountName

  • The results returned include:

    • ConfirmedAssetIdList: NFTs that have been confirmed by Zecrey and exist in the form of an array id. And the specific NFT information can be obtained through Get NFT by ID

    • PendingAssets: NFTs that are in pending status and waiting to be confirmed by Zecrey, which cannot be used for the following operations: transfer, withdraw, listOffer, makeOffer

📚SDK REFERENCE

Example

  • Get all the NFT information of one's own account

    • Get the accountIndex

    • Get the NFTs of the accountIndex

Example result

Get NFT details by ID

  • Get the NFT information through NftId

📚SDK REFERENCE

Example

  • Get the NFT information with NftId = 14

Example result

Offers

  • In the returned details about an offer, there will be a status attribute indicating its status (pending, created, expired, invalid, etc.).

  • The offer status can be one of the following:

Status

CodeNumber

Pending

0

Offer Created

1

matchOffer to be Verified on L2

2

matchOffer Verified on L2

3

Offer Canceled

4

Expired

6

Invalid

10

Get offers of an account

  • Get the offers of this account through accountIndex

📚SDK REFERENCE

Example

  • Get the offers of this account

    • Get accountIndex

    • Get the offers of this account

Example result

Note: The direction field in the offer information can help identify whether this offer is a buy (0) or a sell (1).

Field

Category

Field Description

direction

int

0 BuyNftOffer, 1 SellNftOffer

Get NFT Offers

  • Get the offers of this NFT through NftId

📚SDK REFERENCE

Example

  • Get the offers of the account with NftId = 14

Example result

Get offer details by ID

  • Get the information about the offer through OfferId

📚SDK REFERENCE

Example

  • Get the offer information with OfferId = 5

Example result

Get details about NFT listings and offers

  • Get the details of the NFT listings and offers and the corresponding NFT information

Field

Category

Field Description

isSell

int64

0 BuyNftOffer, 1 SellNftOffer

📚SDK REFERENCE

Example

  • Get details of the listing and the corresponding NFT information

Example result

Last updated

Was this helpful?