Lock API offers locking NFTs from being traded or releasing them to be traded again.

Deploy Lock Contract

Creates a transaction that deploys the lock contract. A lock contract offers locking NFTs in a wallet from being traded with other accounts or releasing them to be traded again.

Request URL

Live URL https://bc-api.qpyou.cn/core/v1/lock/contract
Sandbox URL https://sandbox-bc-api.qpyou.cn/core/v1/lock/contract
HTTP Method POST
Content-Type application/json

Header Parameters

Field Name Description Type Required
x-network the blockchain networks {ploygon, xpla} string Y

Request Body

Field Name Description Type Required
name the lock contract name string Y
from the wallet address that deploys the lock contract string Y
executer This is the wallet address that can unlock the locked NFT. The default value is the from address. string N
encoded whether the returned transaction is encoded or not

  • true: Receive the encoded raw transaction string (data.rawTx).
  • false: Receive the decoded data.rawTx (JSON).
boolean N

Responses

Field Name Description Type
code api request result code, 0: success number
message the result message String
data API response data json
data.rawTx the transaction data string or json
data.hashedTx This is hashed data.rawTx. This value is only returned when the API header x-network is “polygon” and the Request Body from is an multi sig wallet address. string
data.requestId the unique value that can identify each API request string

Request Sample

Response Sample

Lock NFT

Creates a transaction that the NFT owner account (from) sends the NFT (tokenId) to the lock contract. Once the NFT is sent to the lock contract, the ownership of this NFT is now transferred to the lock contract, and the previous owner can’t send this NFT to another account anymore.

Request URL

Live URL https://bc-api.qpyou.cn/core/v1/nft/contract/{contract}/lock
Sandbox URL https://sandbox-bc-api.qpyou.cn/core/v1/nft/contract/{contract}/lock
HTTP Method POST
Content-Type application/json

Path Parameters

Field Name Description Type Required
contract the NFT contract address string Y

Header Parameters

Field Name Description Type Required
x-network the blockchain networks {ploygon, xpla} string Y

Request Body

Field Name Description Type Required
from the wallet address of the NFT owner string Y
lockContract the address of the NFT lock contract string Y
tokenId NFT ID String Y
encoded whether the returned transaction is encoded or not

  • true: Receive the encoded raw transaction string (data.rawTx).
  • false: Receive the decoded data.rawTx (JSON).
boolean N

Responses

Field Name Description Type
code api request result code, 0: success number
message the result message String
data API response data json
data.rawTx the transaction data string or json
data.hashedTx This is hashed data.rawTx. This value is only returned when the API header x-network is “polygon” and the Request Body from is an multi sig wallet address. string
data.requestId the unique value that can identify each API request string

Request Sample

Response Sample

Unlock NFT

Creates a transaction that the lock contract sends back the NFT (tokenId) to the NFT owner account. Once an NFT is sent back to the NFT owner account, this account can resume trading this NFT.

Request URL

Live URL https://bc-api.qpyou.cn/core/v1/lock/contract/{contract}/unlock
Sandbox URL https://sandbox-bc-api.qpyou.cn/core/v1/lock/contract/{contract}/unlock
HTTP Method POST
Content-Type application/json

Path Parameters

Field Name Description Type Required
contract the address of the NFT lock contract string Y

Header Parameters

Field Name Description Type Required
x-network the blockchain networks {ploygon, xpla} string Y

Request Body

Field Name Description Type Required
nftContract the NFT contract address string Y
from the wallet address of the account (the owner of the lock contract) that deployed the lock contract string Y
tokenId NFT ID String Y
encoded whether the returned transaction is encoded or not

  • true: Receive the encoded raw transaction string (data.rawTx).
  • false: Receive the decoded data.rawTx (JSON).
boolean N

Responses

Field Name Description Type
code api request result code, 0: success number
message the result message String
data API response data json
data.rawTx the transaction data string or json
data.hashedTx This is hashed data.rawTx. This value is only returned when the API header x-network is “polygon” and the Request Body from is an multi sig wallet address. string
data.requestId the unique value that can identify each API request string

Request Sample

Response Sample

Get Owner Information of Locked NFT

Returns the information of the account that owns a locked NFT (tokenId).

Request URL

Live URL https://bc-api.qpyou.cn/core/v1/lock/contract/{contract}/token/{tokenId}/account
Sandbox URL https://sandbox-bc-api.qpyou.cn/core/v1/lock/contract/{contract}/token/{tokenId}/account
HTTP Method GET
Content-Type application/json

Path Parameters

Field Name Description Type Required
contract the address of the NFT lock contract string Y
tokenId NFT ID String Y

Header Parameters

Field Name Description Type Required
x-network the blockchain networks {ploygon, xpla} string Y

Query Parameters

Field Name Description Type Required
nftContract the NFT contract address string Y

Responses

Field Name Description Type
code api request result code, 0: success number
message the result message String
data API response data json
data.owner the address of the NFT owner string

Request Sample

Response Sample

Get Locked NFT Information

Get the information of an owner’s (owner) locked NFT located at a lock contract (contract).

Request URL

Live URL https://bc-api.qpyou.cn/core/v1/lock/contract/{contract}/account/{owner}/tokens
Sandbox URL https://sandbox-bc-api.qpyou.cn/core/v1/lock/contract/{contract}/account/{owner}/tokens
HTTP Method GET
Content-Type application/json

Path Parameters

Field Name Description Type Required
contract the address of the NFT lock contract string Y
owner the address of the NFT owner string Y

Header Parameters

Field Name Description Type Required
x-network the blockchain networks {ploygon, xpla} string Y

Responses

Field Name Description Type
code api request result code, 0: success number
message the result message String
data API response data json
data.tokens the locked NFTs list array
data.tokens.owner the wallet address of the NFT owner string
data.tokens.nftAddress the NFT contract address string
data.tokens.tokenId NFT ID string

Request Sample

Response Sample