Trade NFT

Settle down an NFT trade which has two matched orders

EndPoint

POST api/v3/nft/trade
Field
Description
Example
X-API-KEY
ApiKey
"HlkcGxbqBeaF76j4rvPaOasyfPwnkQ6B6DQ6THZWbvrAGxzEdulXQvOKLrRWZLnN"
X-API-SIG
"0xccf0a141fce2dc5cbbd4f802c52220e9e2ce260e86704d6258603eb346eefe2d 4a450005c362b223b2842d087f7065ea5eee0314531adf6a580fce64c25dca81c"

Request

Query Param
Description
Example
maker
NFTOrderRequest, NFT maker order
makerFeeBips
maxFeeBips in maker object, should not smaller than royaltyPercentage of the NFT info, value range (in ten thousandths) 1 ~ 5000. the value = royaltyPercentage + extraFee. the extraFee is for nft submitter
100, means 1%
taker
NFTOrderRequest, NFT taker order
takerFeeBips
The taker feeBips, maxFeeBips in takers order. value range (in ten thousandths) 1 ~ 5000. taker fee need cover the trade fee and not smaller than 100. You can get the tradeCost in get NFT order fee, the value = ceiling(tradeCost/buyAmount)
100, means 1%
matchByTaker
use taker price to match the nft trade
true

Response

Field
Description
Example
makerFills
NftTradeFil, The fill status of the maker order
/
takerFills
NftTradeFil, The fill status of the taker order
/
tradeHash
The trade hash which can be queried in loopring scan web.
"0xf7c932351186c3a9053f313eefa16209c018f7f1dba8aa8ca7100400f7c31085"

Model

NftTokenAmountInfo

Wrapper object used to describe a token associated with a certain quantity.
Field
Description
Example
tokenId
The Loopring's NFT token identifier.
32769
amount
The amount of the NFT
token
"2"
nftData
The Loopring's NFT token data identifier which is a hash string of NFT token address and NFT_ID
"0xf7c932351186c3a9053f313eefa16209c018f7f1dba8aa 8ca7100400f7c31085"

NftTradeFill

Nft trade fill status
Field
Description
Example
orderHash
The order hash
sellFilled
The orders sell fill
buyFilled
The orders buy fill
fee
The orders fee

Compute EdDSA hash

const inputs = [
request.taker.accountId,
request.taker.sellToken.tokenId,
request.taker.storageId,
request.maker.accountId,
request.maker.sellToken.tokenId,
request.maker.storageId,
];
const hasher = Poseidon.createHash(7, 6, 52);
const hash = hasher(inputs).toString(10);