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
exchangeAddress in exchange info​
​
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
​TokenAmountInfo, minter fee, request type is 9
​
storageId
​the offchain id of fee token
1
validUntil
Timestamp for transfer to become invalid, seconds
​
normally current time + 2 months
eddsaSignature
​eddsa signature of the eddsa hash​
​
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);

Example

Header

X-API-KEY = l4hd4CGLLGuZ9nEultG4sfhQZDjPp9sv0kMy13cyGgkJyIWDodVSM4S4ucb5WFKN
X-API-SIG = 0x6c5a6278358b80a4e1ea4aafabe798723b501576457203c92b8c84bd0e426ea67083a79ae7bb07d99f56cffc102d514ebad4397ff13ea9a7660369ca994a8de21b02

Request

POST api/v3/nft/mint
{
"amount": "12",
"ecdsaSignature": "0x6c5a6278358b80a4e1ea4aafabe798723b501576457203c92b8c84bd0e426ea67083a79ae7bb07d99f56cffc102d514ebad4397ff13ea9a7660369ca994a8de21b02",
"eddsaSignature": "0x1e6a1876c82b7887d6713f4af73c2c663df350c0356b1aba63bc007342e371f50012082ae7cefa9c0402c41ac66445e6f66d10f6f68c6a85891d55c55d23e2ea1132034085593d5b8b057c2ba6f814b0cc5654baeec8d871e0625d05785cc030",
"exchange": "0x2e76EBd1c7c0C8e7c2B875b6d505a260C525d25e",
"forceToMint": false,
"maxFee": {
"tokenId": 2,
"amount": "21400000"
},
"minterAddress": "0x6b1029c9ae8aa5eea9e045e8ba3c93d380d5bdda",
"minterId": 10010,
"nftId": "0x407294a8f36d3bdc4d04a6fce57afe0f8d49da56e04db83eb146c39ca24102e1",
"nftType": 0,
"royaltyPercentage": 0,
"storageId": 1059,
"toAccountId": 10010,
"toAddress": "0x6b1029c9ae8aa5eea9e045e8ba3c93d380d5bdda",
"tokenAddress": "0xc30e4cb0853470e6a412ca7f21363cd0d26428e8",
"validUntil": 1655873983
}

Response

{
"hash": "0x019242e2b67e16862d0191ca9a5013599f33856b91f47aed8025d44fb85ed946",
"nftTokenId": 32789,
"nftData": "0x2d4a0fc05056c1cd0e2a059b28d2072dc16cd5d083f77b48ea7d397d05e3627a",
"status": "processing",
"isIdempotent": false,
"accountId": 10010,
"storageId": 1059
}
​
Copy link
On this page
EndPoint
Header
Request
Response
Model
NftTokenAmountInfo
TokenAmountInfo
counterFactualInfo
Compute eddsa hash
Example
Header
Request
Response