Loopring Dev Docs
  • Introduction
  • Endpoints
  • SDK
    • SDK Guides
    • Test Mock Data
      • Mock Account
      • Mock provider
      • Mock ERC20 Token Map
      • Mock AMM MAP
      • Mock EIP712 Typed Data
      • Mock Generate eddsaKey
  • Glossary
  • 🗳️Loopring Account
    • Introduction
    • SDK Guides
      • Setup a Loopring Account
      • Unlock Account (Login)
    • API References
      • Get Account info
        • Sample code
      • Update EddsaKey
        • Sample code
      • Get apiKey
        • Sample code
      • Update apiKey
        • Sample code
  • 🎨CounterFactual NFT
    • Introduction
      • Compute NFT Address API
      • When to deploy counterfactual NFT contracts?
    • SDK Guides
      • Deposit NFT
      • Create Collection
      • Mint Counterfactual NFT
      • Transfer NFT
      • Deploy NFT
      • Withdraw NFT
      • Trade NFT
        • Validate NFT Order
      • Meta & IPFS
    • API References
      • NFT Collection
        • Create collection
          • Sample code
        • Edit collection
          • Sample code
        • Delete collection
          • Sample code
        • List owned collections
          • Sample code
        • List user's NFTs under one collection
          • Sample code
        • List user's NFT balances group by Collection ID
          • Sample code
        • List all NFTs of a collection
          • Sample code
        • Get collection by Collection ID
          • Sample code
        • Get collections by contract address
          • Sample code
      • Get NFT Assets
        • Sample code
      • Get NFT Balances
        • Sample code
      • Mint NFT
        • Sample code
      • Transfer NFT
        • Sample code
      • Validate NFT Order
        • Sample code
      • Trade NFT
        • Sample code
      • Deploy NFT TokenAddress
        • Sample code
      • Withdraw NFT
        • Sample code
      • Get NFT Transactions
        • Sample code
      • Get NFT Trade History
        • Sample code
      • Get AvailableBroker
        • Sample code
      • Get NFT Info
        • Sample code
      • Get NFT Data
        • Sample code
      • Get NFT Holders
        • Sample code
  • 🪙ERC20 Tokens
    • Introduction
    • SDK Guides
      • Transfer ERC20
      • Withdraw ERC20
      • Deposit ERC20
      • Order ERC20
    • API References
      • Get Assets
        • Sample code
      • Transfer
        • Sample code
      • Submit Order
        • Sample code
      • Cancel Order
        • Sample code
      • Withdraw
        • Sample code
      • Get Transactions
        • Sample code
      • Get Orders
        • Sample code
      • Get Trade History
        • Sample code
  • 🔬Resources
    • Advanced
      • UpdateAccount with custom seed
      • Pay payee updateAccount fee
      • Common error and solutions
      • Submit erc20 order
    • Common Info
      • Get relayer current time
        • Sample code
      • Get exchange info
        • Sample code
      • Get token info
        • Sample code
      • Get markets info
        • Sample code
    • Error codes
    • Fees
      • GET ERC20 Offchain Fee
        • Sample code
      • GET ERC20 Order Fee
        • Sample code
      • GET NFT Offchain Fee
        • Sample code
      • GET NFT Order Fee
        • Sample code
      • SDK Fees
    • Layer 2 block info
      • Get pending transactions
    • Request signing
      • Special API Request Signatures
      • Off-chain Request Signatures
      • Extra ECDSA authentic in header
    • Signature
      • ECDSA signature
        • ECDSA key generation
        • ECDSA sign
        • ECDSA verify signature
      • EdDSA signature
        • EdDSA key generation
        • EdDSA sign
        • EdDSA verify signature
      • SDK Signature
        • Mock Signature
    • Smart Contracts
    • Storage Id
      • Sample code
    • WebSocket
      • Account Notification
      • Order Notification
      • Orderbook Notification
      • Trade Notification
      • Ticker Notification
      • Candlestick Notification
      • AMM Pool Snapshot Notification
      • Block Generation Notification
    • Loopring Smart Wallet
      • Signature and verification
Powered by GitBook
On this page
  • EndPoint
  • Header
  • Request
  • Response
  • Model
  • NftTokenAmountInfo
  • TokenAmountInfo
  • counterFactualInfo
  • Compute eddsa hash

Was this helpful?

  1. CounterFactual NFT
  2. API References

Mint NFT

mint nft in Loopring layer2, only can mint ERC1155 in layer2 now

EndPoint

POST api/v3/nft/mint

Header

Field
Description
Example

X-API-KEY

ApiKey

"HlkcGxbqBeaF76j4rvPaOasyfPwnkQ6B6DQ6THZWbvrAGxzEdulXQvOKLrRWZLnN"

Request

Query Param
Description
Example

exchange

minterAddress

minter address

"0x2aa52B5fc52c9BD3Bc7555AAB1f565f06baafF5D"

minterId

minter accountID

10110

toAddress

(Optional) to address

toAccountId

to accountId

10111,can set to 0 if dont have

nftType

0 for ERC1155, 1 for ERC721, now only support ERC1155

0

tokenAddress

tokenAddress, computed by

"0x2aa52B5fc52c9BD3Bc7555AAB1f565f06baafF5D"

nftId

nftId, TODO: add link

"0x3b65907396d1259f85e649531a43380aab7cfab61475f129783da7d6a6c257f1"

amount

how many tokens to be mint.

"1"

royaltyPercentage

fee to the creator of each NFT transaction. 1 ~ 10, percentage

1, means 1%

maxFee

storageId

1

validUntil

Timestamp for transfer to become invalid, seconds

normally current time + 2 months

eddsaSignature

royaltyAddress

(Optional) fee to the address, default is minter address

"0x2aa52B5fc52c9BD3Bc7555AAB1f565f06baafF5D"

counterFactualInfo

if it's counterFactual wallet, need pass the info

Response

Field
Description
Example

hash

The hash identifier set by the user at the time of submission, can use this hash to get the transfer info

"0x1d923ca783 4dc90484fa2e b611f0f0bc7e 741bb107007e bea19ba8caea b4f9d3"

status

Whether 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"

isIdempotent

Idempotent of submit transfer response, submit same transfer again idempotent will be true

"false"

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"

TokenAmountInfo

ERC20 token amount info, used for fee here

Field
Description
Example

tokenId

The Loopring's ERC20 token identifier.

0

amount

The amount of the ERC20 token

"10000000000000000"

counterFactualInfo

counterFactual Wallet Info

Field
Description
Example

walletFactory

Counter factual wallet factory contract address

"0xbbbbca6a90 1c926f240b89 eacb641d8aec 7aeafd"

walletOwner

Counter factual wallet owner address, NOT the wallet address

"0xbbbbca6a90 1c926f240b89 eacb641d8aec 7aeafd"

walletSalt

Salt to generate address from owner & other related info

"1"

Compute eddsa hash

export function getNftData(request: NFTMintRequestV3) {
  const hasher = Poseidon.createHash(7, 6, 52);
  const nftIdHi = new BN(request.nftId.substr(2, 32), 16).toString(10);
  const nftIdLo = new BN(request.nftId.substr(2 + 32, 32), 16).toString(10);
  const inputs = [
    request.minterAddress,
    request.nftType,
    request.tokenAddress,
    nftIdLo,
    nftIdHi,
    request.royaltyPercentage,
  ];
  return hasher(inputs).toString(10);
}

const inputs = [
    new BN(ethUtil.toBuffer(request.exchange)).toString(),
    request.minterId,
    request.toAccountId,
    getNftData(request),
    request.amount,
    request.maxFee.tokenId,
    request.maxFee.amount,
    request.validUntil,
    request.storageId,
  ];
  const hasher = Poseidon.createHash(inputs.length + 1, 6, 53);
  const hash = hasher(inputs).toString(10);

PreviousSample codeNextSample code

Last updated 1 year ago

Was this helpful?

exchangeAddress in

, , request type is 9

of fee token

of the

🎨
exchange info
the offchain id
minter fee
TokenAmountInfo
eddsa signature
eddsa hash
(Optional) counterFactual Wallet Info