准备购买及 Permit2 签名数据
curl --request POST \
--url https://api.renaiss.xyz/v2/gacha/pull/prepare \
--header 'Content-Type: application/json' \
--header 'x-builder-api-key: <api-key>' \
--data '
{
"buyerWalletAddress": "<string>",
"packId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
'const options = {
method: 'POST',
headers: {'x-builder-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({buyerWalletAddress: '<string>', packId: '3c90c3cc-0d44-4b50-8888-8dd25736052a'})
};
fetch('https://api.renaiss.xyz/v2/gacha/pull/prepare', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.renaiss.xyz/v2/gacha/pull/prepare"
payload = {
"buyerWalletAddress": "<string>",
"packId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
headers = {
"x-builder-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"chainId": 123,
"buyerWalletAddress": "<string>",
"pack": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"onChainPackId": "<string>",
"priceInUsdt": "<string>",
"vendingMachineAddress": "<string>"
},
"permit2TypedData": {
"domain": {
"name": "Permit2",
"chainId": 123,
"verifyingContract": "<string>"
},
"types": {},
"primaryType": "PermitWitnessTransferFrom",
"message": {
"permitted": {
"token": "<string>",
"amount": "<string>"
},
"spender": "<string>",
"nonce": "<string>",
"deadline": "<string>",
"witness": {
"packId": "<string>",
"builder": "<string>",
"numOfTokens": "<string>"
}
}
},
"unsignedPullPayload": {
"packId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"builderCode": "<string>",
"numOfTokens": 5,
"amountPerToken": "<string>",
"nonce": "<string>",
"deadline": 123
},
"approval": {
"token": "<string>",
"spender": "<string>",
"requiredAmount": "<string>"
}
}Malformed JSON in request body{
"error": "Required authentication credential is missing",
"code": "API_AUTH_MISSING_CREDENTIAL"
}{
"error": "Credential is not allowed by this policy",
"code": "API_AUTH_CREDENTIAL_NOT_ALLOWED"
}{
"error": "VRF card pack not found",
"code": "CARD_PACK_NOT_FOUND"
}{
"error": "Authentication rate limit exceeded",
"code": "API_AUTH_RATE_LIMITED"
}{
"error": "Internal server error",
"code": "FUNCTION_ERROR"
}抽卡与回购
准备抽卡
按买家选定的卡包和数量,获取购买明细及需要签署的 Permit2 数据。
POST
/
v2
/
gacha
/
pull
/
prepare
准备购买及 Permit2 签名数据
curl --request POST \
--url https://api.renaiss.xyz/v2/gacha/pull/prepare \
--header 'Content-Type: application/json' \
--header 'x-builder-api-key: <api-key>' \
--data '
{
"buyerWalletAddress": "<string>",
"packId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
'const options = {
method: 'POST',
headers: {'x-builder-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({buyerWalletAddress: '<string>', packId: '3c90c3cc-0d44-4b50-8888-8dd25736052a'})
};
fetch('https://api.renaiss.xyz/v2/gacha/pull/prepare', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.renaiss.xyz/v2/gacha/pull/prepare"
payload = {
"buyerWalletAddress": "<string>",
"packId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
headers = {
"x-builder-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"chainId": 123,
"buyerWalletAddress": "<string>",
"pack": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"onChainPackId": "<string>",
"priceInUsdt": "<string>",
"vendingMachineAddress": "<string>"
},
"permit2TypedData": {
"domain": {
"name": "Permit2",
"chainId": 123,
"verifyingContract": "<string>"
},
"types": {},
"primaryType": "PermitWitnessTransferFrom",
"message": {
"permitted": {
"token": "<string>",
"amount": "<string>"
},
"spender": "<string>",
"nonce": "<string>",
"deadline": "<string>",
"witness": {
"packId": "<string>",
"builder": "<string>",
"numOfTokens": "<string>"
}
}
},
"unsignedPullPayload": {
"packId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"builderCode": "<string>",
"numOfTokens": 5,
"amountPerToken": "<string>",
"nonce": "<string>",
"deadline": 123
},
"approval": {
"token": "<string>",
"spender": "<string>",
"requiredAmount": "<string>"
}
}Malformed JSON in request body{
"error": "Required authentication credential is missing",
"code": "API_AUTH_MISSING_CREDENTIAL"
}{
"error": "Credential is not allowed by this policy",
"code": "API_AUTH_CREDENTIAL_NOT_ALLOWED"
}{
"error": "VRF card pack not found",
"code": "CARD_PACK_NOT_FOUND"
}{
"error": "Authentication rate limit exceeded",
"code": "API_AUTH_RATE_LIMITED"
}{
"error": "Internal server error",
"code": "FUNCTION_ERROR"
}approval.token 上授予 approval.spender 的额度。若低于 approval.requiredAmount,请授权所需金额并等待确认。请求
需要开发者密钥
响应
错误码
在下表中查找接口返回的 HTTP 状态码和响应原文。有关各接口通用的处理建议,请参阅错误码含义与处理方式。
| HTTP | 错误码 | 文本字段 | 响应文本与处理方式 |
|---|---|---|---|
400 | API_AUTH_INVALID_INPUT | error | Request body is too large请求体超过 16 KiB。请缩小请求体。 |
400 | CARD_PACK_NOT_ACTIVE | error | Card pack is not active卡包未在售,标记为不可购买,无需重试。 |
400 | CONTRACT_WALLET_CANNOT_RECEIVE_NFT | error | The contract wallet does not accept ERC-721 transfers from the NFT contract合约钱包无法接收藏品。请使用能够接收藏品的钱包。 |
400 | WRONG_REQUEST_PARAMS | error | Delegated wallets are not supported by the v2 EOA contract字段缺失或格式错误,修正后重发。常规不支持的委托账户返回 { error, code },请更换钱包。 |
400 | WRONG_REQUEST_PARAMS | message | Bad request - invalid parameters |
400 | 无错误码 | text/plain | Malformed JSON in request body |
401 | API_AUTH_INVALID_CREDENTIAL | error | Invalid authentication credential开发者密钥格式错误、未知、已过期或已撤销。请核对并更换密钥。 |
401 | API_AUTH_MISSING_CREDENTIAL | error | Required authentication credential is missing请在 x-builder-api-key 请求头中提供开发者密钥。 |
403 | API_AUTH_CREDENTIAL_NOT_ALLOWED | error | Credential is not allowed by this policy此路由只接受开发者密钥。移除 Authorization 请求头及其他凭据,再重新发送。 |
403 | GACHA_V3_BUILDER_NOT_ACCEPTED_ON_PUBLIC_API | error | This builder checks out on its own surface, not on the public API此密钥无法用于当前 API。请联系 Renaiss,无需重试。 |
404 | CARD_PACK_NOT_FOUND | error | VRF card pack not found卡包 ID 未知或卡包未公开。请通过 GET /v2/gacha/packs 查询可用 ID,不要用相同 ID 重试。 |
429 | API_AUTH_RATE_LIMITED | error | Authentication rate limit exceeded已达到密钥的请求频率上限。稍候再以较低频率重试。 |
500 | API_AUTH_ERROR | error | Internal server error |
500 | FUNCTION_ERROR | error | Internal server error |
500 | CARD_PACKS_QUERY_FAILEDGACHA_V3_ON_CHAIN_PACK_ID_NOT_SETGACHA_V3_VENDING_MACHINE_ADDRESS_NOT_FOUNDGACHA_V3_OPEN_PACK_CHECKOUT_BUDGET_ERRORGACHA_V3_SUB_PACK_LINEUP_LOAD_FAILED | error | Internal server error若问题持续出现,请将 x-request-id 提供给 Renaiss。 |
500 | 其他错误码 | error | Internal server error |
授权
请求体
application/json