Skip to content

Latest commit

 

History

History
53 lines (37 loc) · 4.44 KB

File metadata and controls

53 lines (37 loc) · 4.44 KB
description
validate a NFT order

Validate NFT Order

EndPoint

POST api/v3/nft/validateOrder

Header

FieldDescriptionExampleTypeRequired
X-API-KEYApiKey"HlkcGxbqBeaF76j4rvPaOasyfPwnkQ6B6DQ6THZWbvrAGxzEdulXQvOKLrRWZLnN"Y

Request

Query ParamDescriptionExample
exchangeexchangeAddress in exchange info
accountIdaccountId10110
storageIdstorageId of sell tokenId in2
sellTokenNftTokenAmountInfo, NFT token if sell NFT order else erc20 token like USDT
buyTokenNftTokenAmountInfo, NFT token if buy NFT order else erc20 token like USDT
validUntilTimestamp for transfer to become invalid, seconds

normally current time + 2 months

maxFeeBipsMaximum order fee that the user can accept, value range (in ten thousandths) 1 ~ 5000100, means 1%
eddsaSignatureeddsa signature
of the eddsa hash
clientOrderId(Optional) An arbitrary, client-set unique order identifier, max length is 120 bytes"test"
affiliate(Optional) An accountID who will receive a share of the fee of this order at the end of monthly distribution.
Need contact us to add the accountId in whitelist.
10110

Response

FieldDescriptionExampleTypeRequired
hashThe hash identifier set by the user at the time of submission, can use this hash to get the transfer info"0x1d923ca7834dc90484fa2eb611f0f0bc7e741bb107007ebea19ba8caeab4f9d3"stringY
statusWhether the order was successfully submitted or not, please note, user may query after a while to get real process status, as most offchain requests are async processed
Allowable : ['received', 'processing', 'processed', 'failed']
"received"stringY
isIdempotentIdempotent of submit transfer response, submit same transfer again idempotent will be truefalsebooleanY

Model

NftTokenAmountInfo

Wrapper object used to describe a token associated with a certain quantity.

FieldDescriptionExampleTypeRequired
tokenIdThe Loopring's NFT token identifier.32769integerY
amount

The amount of the NFT

token

"2"stringY
nftDataThe Loopring's NFT token data identifier which is a hash string of NFT token address and NFT_ID"0xf7c932351186c3a9053f313eefa16209c018f7f1dba8aa 8ca7100400f7c31085"

Compute eddsa hash

const inputs = [
    new BN(ethUtil.toBuffer(request.exchange)).toString(),
    request.storageId,
    request.accountId,
    request.sellToken.tokenId,
    request.buyToken.tokenId,
    request.sellToken.volume,
    request.buyToken.volume,
    request.validUntil,
    request.maxFeeBips,
    request.fillAmountBOrS ? 1 : 0,
    new BN(ethUtil.toBuffer(request.taker)).toString(),
  ];
  const hasher = Poseidon.createHash(12, 6, 53);
  const hash = hasher(inputs).toString(10)