Zecrey
  • Introduction
  • Zecrey Onepager
  • Announcements
    • Zecrey Public Testnet Announcement
    • Zecrey Testnet Beta Internal Test Announcement
    • Zecrey Ambassador Program Annoucement
  • Go & JS SDK Basic Guides
    • 1. Install and Initialize
    • 2. Get Data
    • 3. SDK Signature
    • 4. Register Users
    • 5. Mint Assets
    • 6. Creating Orders
    • 7. Match Orders
    • 8. Asset Deposits
    • 9. Asset Transfers
    • 10. Asset Withdrawals
    • 11. Full Exit
    • 12. Demo of SDK Calling
  • Education
    • Zecrey Video Guide
    • Concepts Explained
      • Crypto Knowledge
        • Layer 1 (L1)
        • Layer 2 (L2)
        • ZK-Rollup
        • Gas Fee
        • NFT
      • Zecrey Basics
        • Multi-chain asset management
        • Zecrey L1 wallet
        • Zecrey Legend L2 wallet
        • Zecrey Zero L2 wallet
        • Deposit
        • Withdraw
        • Zecrey DEX
      • The State of Transactions
    • Get Started
      • How to import an account?
      • How to create a new account?
      • How to receive and send assets with QR code?
      • How to export the private key?
      • How to export the recovery phrase?
      • How to use Zecrey NFT Marketplace?
      • How to adjust the gas fee?
      • How to check my transaction record?
      • How to manage my contacts?
      • How to set the language?
      • How to give feedback?
    • FAQs
  • Product Handbook
    • Zecrey Products Introduction
    • Set up your Zecrey Wallet
      • Download and Install Zecrey
      • Create a New Wallet
      • Import an Existing Wallet with Mnemonic
      • Claim Test Tokens for Testnet
      • Testing Requirements
      • Rewards for Phase II Testnet
    • Zecrey L1 Wallet
      • Multi-chain Assets Management
      • L1 Transfer
      • Deposit
      • L1 NFT Management
        • View NFT Assets
        • L1 NFT Transfer
        • NFT Deposit
    • Zecrey Legend L2
      • L2 Account Registration
      • L2 Transfer
      • Withdraw
    • Zecrey NFT Marketplace
      • Explore NFT Marketplace
      • Connect Zecrey Extension to NFT Marketplace
      • Create NFT Collection
      • Mint NFT
      • Buy NFT
      • Sell NFT
      • Transfer NFT
      • Withdraw NFT
      • View NFT Assets
      • Manage NFT Transactions
Powered by GitBook
On this page
  • Overview
  • Get Marketplace SDK package
  • Initialize the client in the correct environment
  • Call the SDK in the correct environment:

Was this helpful?

  1. Go & JS SDK Basic Guides

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
npm i @zecrey/zecrey-legend-js-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) }
 }

Example

import { Client } from "@zecrey/zecrey-legend-js-sdk";

const accountName = "Alice.zec";
const seed = "0x7ea589236ac7e6034a40ad31f27a6ea1bbaeb7746ba5e8d3408a3abb480a8688";
//Using accountName and seed is required to initialize the client
//Please refer to the Register users module for the accountName and seed parameters.
const client = new Client(accountName, seed);

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

Example

import { SDK } from "@zecrey/zecrey-legend-js-sdk";

const sdk = new SDK();
await sdk.initial();

const accountName = "Alice.zec";
const res = await sdk.ifAccountRegistered(accountName);

console.log("GetAccountIsRegistered:", res)

Example result:

GetAccountIsRegistered: true

PreviousGo & JS SDK Basic GuidesNext2. Get Data

Last updated 2 years ago

Was this helpful?

NewClient
IfAccountRegistered