Zecrey
Search
βŒƒK

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

Golang
Javascript

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
}
}

Example

  • Get account information with the name "Alice"
import { SDK } from "@zecrey/zecrey-legend-js-sdk";
​
const sdk = new SDK();
await sdk.initial();
​
const accountName = "Alice.zec";
const res = await sdk.getAccountByAccountName(accountName);

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

πŸ“šSDK REFERENCE

Golang
Javascript

Example

  • Get asset information with the name "Alice"
package main
​
import (
"fmt"
"github.com/Zecrey-Labs/zecrey-marketplace-go-sdk/sdk"
)
​
​
func main() {
accountName := "Alice"
result, err := sdk.GetAccountAssetsInfoByAccountName(accountName)
if err != nil { panic(err) }
data, _ := json.Marshal(accountInfo)
fmt.Println(string(data))
}

Example result

[{"asset_id":0,"balance":"69516961736982000000","lp_amount":"1141481984833460000","offer_canceled_or_finalized":"170141183617213717799641663991588061916"},{"asset_id":1,"balance":"212085509760300000000","lp_amount":"412765957420000000","offer_canceled_or_finalized":"16438259186243607965933629081649153"},{"asset_id":2,"balance":"244530497503355100600","lp_amount":"5180165258600000000","offer_canceled_or_finalized":"0"}]

Example

  • Get asset information with the name "Alice"
import { SDK } from "@zecrey/zecrey-legend-js-sdk";
​
const sdk = new SDK();
await sdk.initial();
​
const account_name = "alice.zec";
const res = await sdk.getAccountAssetsInfoByName(account_name);
​
console.log(res);

Example result

[{"asset_id":0,"balance":"69516961736982000000","lp_amount":"1141481984833460000","offer_canceled_or_finalized":"170141183617213717799641663991588061916"},{"asset_id":1,"balance":"212085509760300000000","lp_amount":"412765957420000000","offer_canceled_or_finalized":"16438259186243607965933629081649153"},{"asset_id":2,"balance":"244530497503355100600","lp_amount":"5180165258600000000","offer_canceled_or_finalized":"0"}]

Get assets information

  • Query user asset information
  • Token information
    Token
    Token ID
    BNB
    0
    LEG
    1
    REY
    2

πŸ“šSDK REFERENCE

Golang
Javascript

Example

  • Query token information
package main
​
import (
"fmt"
"github.com/Zecrey-Labs/zecrey-marketplace-go-sdk/sdk"
)
​
​
func main() {
result, err := sdk.GetAssetsList()
if err != nil { panic(err) }
data, _ := json.Marshal(accountInfo)
fmt.Println(string(data))
}

Example result

{"assets":[{"asset_id":0,"asset_name":"BNB","asset_decimals":18,"asset_symbol":"BNB","asset_address":"0x00","is_gas_asset":1},{"asset_id":1,"asset_name":"LEG","asset_decimals":18,"asset_symbol":"LEG","asset_address":"0x364Ed72f329f1BD56AE84b941D1c6E4E260cE152","is_gas_asset":0},{"asset_id":2,"asset_name":"REY","asset_decimals":18,"asset_symbol":"REY","asset_address":"0x9f4c0B11D9cAC63351fd002Cd09812138C6055cb","is_gas_asset":0}]}

Example

  • Query token information
import { SDK } from "@zecrey/zecrey-legend-js-sdk";
​
const sdk = new SDK();
await sdk.initial();
​
const res = await sdk.getSupportedAssets();
​
console.log(res);

Example result

[{"asset_id":0,"asset_name":"BNB","asset_decimals":18,"asset_symbol":"BNB","asset_address":"0x00","is_gas_asset":1},{"asset_id":1,"asset_name":"LEG","asset_decimals":18,"asset_symbol":"LEG","asset_address":"0x364Ed72f329f1BD56AE84b941D1c6E4E260cE152","is_gas_asset":0},{"asset_id":2,"asset_name":"REY","asset_decimals":18,"asset_symbol":"REY","asset_address":"0x9f4c0B11D9cAC63351fd002Cd09812138C6055cb","is_gas_asset":0}]

Get account index

  • Query accountIndex

πŸ“šSDK REFERENCE

Golang
Javascript

Example

  • Query the account index of the name "Alice"
package main
​
import (
"fmt"
"github.com/Zecrey-Labs/zecrey-marketplace-go-sdk/sdk"
)
​
​
func main() {
accountName := "Alice"
result, err := sdk.GetAccountIndex(accountName)
if err != nil { panic(err) }
data,_:= json.Marshal(result)
fmt.Println("accountIndex:",result.AccountIndex)
}

Example result

1
accountIndex: 4Example
2
- Query the account index of the name "Alice"
3
import { SDK } from "@zecrey/zecrey-legend-js-sdk";
4
​
5
const sdk = new SDK();
6
await sdk.initial();
7
​
8
const account_name = "Alice.zec";
9
const res = await sdk.getAccountIndex(account_name);
10
​
11
console.log("accountIndex:", res);
12
Example result
13
accountIndex: 4Example
14
- Query the account index of the name "Alice"
15
import { SDK } from "@zecrey/zecrey-legend-js-sdk";
16
​
17
const sdk = new SDK();
18
await sdk.initial();
19
​
20
const account_name = "Alice.zec";
21
const res = await sdk.getAccountIndex(account_name);
22
​
23
console.log("accountIndex:", res);
24
Example result
25
accountIndex: 4
26
​

Example

  • Query the account index of the name "Alice"
import { SDK } from "@zecrey/zecrey-legend-js-sdk";
​
const sdk = new SDK();
await sdk.initial();
​
const account_name = "Alice.zec";
const res = await sdk.getAccountIndex(account_name);
​
console.log("accountIndex:", res);

Example result

accountIndex: 4

Get account registration status

  • Query whether the accountName has been registered

πŸ“šSDK REFERENCE

Golang
Javascript

Example

  • Query if the account name "Alice" is already registered
package main
​
import (
"fmt"
"github.com/Zecrey-Labs/zecrey-marketplace-go-sdk/sdk"
)
​
​
func main() {
accountName := "Alice"
result, err := sdk.IfAccountRegistered(accountName)
if err != nil { panic(err) }
data,_:= json.Marshal(result)
fmt.Println("GetAccountIsRegistered:",string(data))
}

Example result

GetAccountIsRegistered: true

Example

  • Query if the account name "Alice" is already registered
import { SDK } from "@zecrey/zecrey-legend-js-sdk";
​
const sdk = new SDK();
await sdk.initial();
​
const account_name = "Alice.zec";
const res = await sdk.ifAccountRegistered(account_name);
​
console.log("GetAccountIsRegistered:", res);

Example result

GetAccountIsRegistered: true

Category

Get NFT categories

  • Get all NFT categories

πŸ“šSDK REFERENCE

Golang
Javascript

Example

package main
​
import (
"fmt"
"github.com/Zecrey-Labs/zecrey-marketplace-go-sdk/sdk"
)
​
func main() {
result, err := sdk.GetCategories()
if err != nil { panic(err) }
data,_:= json.Marshal(result)
fmt.Println(string(data))
}

Example result

{
"categories":[
{
"id":1,
"name":"Art"
},
{
"id":2,
"name":"Collection"
},
{
"id":3,
"name":"domain name"
},
{
"id":4,
"name":"music"
},
{
"id":5,
"name":"photography"
},
{
"id":6,
"name":"physical education"
},
{
"id":7,
"name":"trading card"
},
{
"id":8,
"name":"Practical"
},
{
"id":9,
"name":"virtual reality"
},
{
"id":10,
"name":"default"
}
]
}on

Example

import { SDK } from "@zecrey/zecrey-legend-js-sdk";
​
const sdk = new SDK();
await sdk.initial();
​
const res = await sdk.getCategories();
​
console.log(res);

Example result

{
"categories":[
{
"id":1,
"name":"Art"
},
{
"id":2,
"name":"Collection"
},
{
"id":3,
"name":"domain name"
},
{
"id":4,
"name":"music"
},
{
"id":5,
"name":"photography"
},
{
"id":6,
"name":"physical education"
},
{
"id":7,
"name":"trading card"
},
{
"id":8,
"name":"Practical"
},
{
"id":9,
"name":"virtual reality"
},
{
"id":10,
"name":"default"
}
]
}

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.

πŸ“šSDK REFERENCE

Golang
Javascript

Example

  • Get collections created by the account name "Alice"
    • Query the accountIndex of Alice
    • Obtain the collections created by this account
package main
​
import (
"fmt"
"github.com/Zecrey-Labs/zecrey-marketplace-go-sdk/sdk"
)
​
​
func main() {
accountName := "Alice"
​
accountIndex,err:= sdk.GetAccountIndex(accountName)
if err != nil { panic(err) }
result, err := sdk.GetCollectionsByAccountIndex(accountIndex)
if err != nil { panic(err) }
data,_:= json.Marshal(result)
fmt.Println(string(data))
​
}

Example result

{
"sdkCollections":[
{
"id": 4,
"l2_collection_id":4,
"account_name":"Alice",
"name":"Alice`s space 4",
"short_name":"Alice`s space 4",
"description":"AliceCollection4 description",
"category_id":1,
"collection_url":"https://res.cloudinary.com/zecrey/image/upload/collection/ahykviwc0suhoyzusb5q.jpg",
"external_link":"https://alice.xyz",
"twitter_link":"https://twitter.com/alice",
"instagram_link":"https://www.instagram.com/alice/",
"telegram_link":"https://tgstat.com/channel/@alice",
"discord_link":"https://discord.com/api/v10/applications/<aliceid>/commands",
"logo_image":"https://res.cloudinary.com/zecrey/image/upload/collection/lc02mjan85horu8650td",
"logo_thumb":"https://res.cloudinary.com/zecrey/image/upload/collection/dekkg5j1ptccq9ttliui",
"featured_image":"https://res.cloudinary.com/zecrey/image/upload/collection/ahykviwc0suhoyzusb5q",
"featured_Thumb":"https://res.cloudinary.com/zecrey/image/upload/collection/ioy2wcqupbgnuqvdtjfx",
"banner_image":"https://res.cloudinary.com/zecrey/image/upload/collection/ljvwvjho9ucs5gpwmlkf",
"banner_thumb":"https://res.cloudinary.com/zecrey/image/upload/collection/lo3vtlrcslcr1n7tgiuh",
"creator_earning_rate":1000,
"status":"PENDING",
"expired_at":1668083576082,
"created_at":1667910776,
"item_count":3,
"browse_count":6,
"floor_price":2,
"one_day_trade_volume":8.7,
"total_trade_volume":58.7
}
]
}

Example

  • Get collections created by the account name "Alice"
    • Query the accountIndex of Alice
    • Obtain the collections created by this account
import { SDK } from "@zecrey/zecrey-legend-js-sdk";
​
const sdk = new SDK();
await sdk.initial();
​
const accountName = "Alice.zec";
const accountIndex = await sdk.getAccountIndex(accountName);
const res = await sdk.getCollectionsByAccountIndex(accountIndex);
​
console.log(res);

Example result

{
"sdkCollections":[
{
"id": 4,
"l2_collection_id":4,
"account_name":"Alice",
"name":"Alice`s space 4",
"short_name":"Alice`s space 4",
"description":"AliceCollection4 description",
"category_id":1,
"collection_url":"https://res.cloudinary.com/zecrey/image/upload/collection/ahykviwc0suhoyzusb5q.jpg",
"external_link":"https://alice.xyz",
"twitter_link":"https://twitter.com/alice",
"instagram_link":"https://www.instagram.com/alice/",
"telegram_link":"https://tgstat.com/channel/@alice",
"discord_link":"https://discord.com/api/v10/applications/<aliceid>/commands",
"logo_image":"https://res.cloudinary.com/zecrey/image/upload/collection/lc02mjan85horu8650td",
"logo_thumb":"https://res.cloudinary.com/zecrey/image/upload/collection/dekkg5j1ptccq9ttliui",
"featured_image":"https://res.cloudinary.com/zecrey/image/upload/collection/ahykviwc0suhoyzusb5q",
"featured_Thumb":"https://res.cloudinary.com/zecrey/image/upload/collection/ioy2wcqupbgnuqvdtjfx",
"banner_image":"https://res.cloudinary.com/zecrey/image/upload/collection/ljvwvjho9ucs5gpwmlkf",
"banner_thumb":"https://res.cloudinary.com/zecrey/image/upload/collection/lo3vtlrcslcr1n7tgiuh",
"creator_earning_rate":1000,
"status":"PENDING",
"expired_at":1668083576082,
"created_at":1667910776,
"item_count":3,
"browse_count":6,
"floor_price":2,
"one_day_trade_volume":8.7,
"total_trade_volume":58.7
}
]
}

Get collection details by ID

  • Get the collection information through collectionID

πŸ“šSDK REFERENCE

Golang
Javascript

Example

  • Get the collection information withcollectionID =3
package main
​
import (
"fmt"
"github.com/Zecrey-Labs/zecrey-marketplace-go-sdk/sdk"
)
​
​
func main() {
var collectionId int64 = 3
result, err := sdk.GetCollectionById(collectionId)
data,_:= json.Marshal(result)
fmt.Println(string(data))
}

Example result

{
"id": 3,
"l2_collection_id":3,
"account_name":"Alice",
"name":"Alice`s space 3",
"short_name":"Alice`s space 3",
"description":"AliceCollection3 description",
"category_id":1,
"collection_url":"https://res.cloudinary.com/zecrey/image/upload/collection/ljvwvjho9ucs5gpwmlkf.jpg",
"external_link":"https://alice.xyz",
"twitter_link":"https://twitter.com/alice",
"instagram_link":"https://www.instagram.com/alice/",
"telegram_link":"https://tgstat.com/channel/@alice",
"discord_link":"https://discord.com/api/v10/applications/<aliceid>/commands",
"logo_image":"https://res.cloudinary.com/zecrey/image/upload/collection/lc02mjan85horu8650td",
"logo_thumb":"https://res.cloudinary.com/zecrey/image/upload/collection/dekkg5j1ptccq9ttliui",
"featured_image":"https://res.cloudinary.com/zecrey/image/upload/collection/ahykviwc0suhoyzusb5q",
"featured_Thumb":"https://res.cloudinary.com/zecrey/image/upload/collection/ioy2wcqupbgnuqvdtjfx",
"banner_image":"https://res.cloudinary.com/zecrey/image/upload/collection/ljvwvjho9ucs5gpwmlkf",
"banner_thumb":"https://res.cloudinary.com/zecrey/image/upload/collection/lo3vtlrcslcr1n7tgiuh",
"creator_earning_rate":0,
"status":"CREATED",
"expired_at":1668083576082,
"created_at":1667910776,
"item_count":3,
"browse_count":6,
"floor_price":2,
"one_day_trade_volume":8.7,
"total_trade_volume":58.7
}

Example

  • Get the collection information withcollectionID =3
import { SDK } from "@zecrey/zecrey-legend-js-sdk";
​
const sdk = new SDK();
await sdk.initial();
​
const collectionId = 3;
const res = await sdk.getCollectionById(collectionId);
​
console.log(res);

Example result

{
"id": 3,
"l2_collection_id":3,
"account_name":"Alice",
"name":"Alice`s space 3",
"short_name":"Alice`s space 3",
"description":"AliceCollection3 description",
"category_id":1,
"collection_url":"https://res.cloudinary.com/zecrey/image/upload/collection/ljvwvjho9ucs5gpwmlkf.jpg",
"external_link":"https://alice.xyz",
"twitter_link":"https://twitter.com/alice",
"instagram_link":"https://www.instagram.com/alice/",
"telegram_link":"https://tgstat.com/channel/@alice",
"discord_link":"https://discord.com/api/v10/applications/<aliceid>/commands",
"logo_image":"https://res.cloudinary.com/zecrey/image/upload/collection/lc02mjan85horu8650td",
"logo_thumb":"https://res.cloudinary.com/zecrey/image/upload/collection/dekkg5j1ptccq9ttliui",
"featured_image":"https://res.cloudinary.com/zecrey/image/upload/collection/ahykviwc0suhoyzusb5q",
"featured_Thumb":"https://res.cloudinary.com/zecrey/image/upload/collection/ioy2wcqupbgnuqvdtjfx",
"banner_image":"https://res.cloudinary.com/zecrey/image/upload/collection/ljvwvjho9ucs5gpwmlkf",
"banner_thumb":"https://res.cloudinary.com/zecrey/image/upload/collection/lo3vtlrcslcr1n7tgiuh",
"creator_earning_rate":0,
"status":"CREATED",
"expired_at":1668083576082,
"created_at":1667910776,
"item_count":3,
"browse_count":6,
"floor_price":2,
"one_day_trade_volume":8.7,
"total_trade_volume":58.7
}

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