1. Install and Initialize

Overview

We provide the Golang and Javascript versions of Zecrey Marketplace SDK so that developers can easily access Zecrey's NFT marketplace service. It is an API wrapper for Zecrey that provides most of the functionality for the Zecrey platform. Before starting to use the SDK, developers must initialize the client.

Get Marketplace SDK package

go get github.com/zecrey-Labs/zecrey-marketplace-go-sdk
  • Most forms of the data available are read-only, so user authentication is not required when querying to update the status of Zecrey NFT Marketplace. Therefore, we designed two ways for calling of the client and SDK for Zecrey NFT Marketplace.

    • When signing data to change the status of Zecrey NFT marketplace, you need to initialize the client to call.

    • When you only need to query data or generate a new signer, you can directly call the method in the SDK package.

  • In the following, we list the circumstances under which the client should be initialized and when the SDK should be called directly.

Client

SDK

Register Account

Apply Register-Host

Create Collection

Mint NFT

Create Sell Offer

Create Buy Offer

Cancel Offer

Match Offer

Transfer NFT

Withdraw NFT

Get Account Information

Get Categories Information

Get Collections Information

Get NFT Information

Get Offer Information

Create L1 Account

Generate Seed And L2 Public Key

Upload Media

Initialize the client in the correct environment

📚SDK REFERENCE

Example

package main

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

var (
   accountName = "Alice"
   seed = "0x7ea589236ac7e6034a40ad31f27a6ea1bbaeb7746ba5e8d3408a3abb480a8688"
)

func main() {
   //Initializing the client needs to access accountName and seed
   //Refer to the module of Register users to get parameters of accountName and seed
   client, err := sdk.NewClient(accountName, seed) 	 
   if err != nil { panic(err) }
 }

Call the SDK in the correct environment:

📚SDK REFERENCE

Example

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,err:= json.Marshal(result)
   if err != nil { panic(err) }
    
   fmt.Println("GetAccountIsRegistered:",string(data))
}

Example result:

GetAccountIsRegistered: true

Last updated