按展示的挂牌价准备购买
curl --request POST \
--url https://dev-api.renaiss.xyz/v2/marketplace/buy/prepare \
--header 'Content-Type: application/json' \
--header 'x-builder-api-key: <api-key>' \
--data '
{
"tokenId": "9007199254740993",
"walletAddress": "0x1111111111111111111111111111111111111111",
"expiresAt": null,
"expectedTotalPriceInUsdt": "102000000000000000000"
}
'const options = {
method: 'POST',
headers: {'x-builder-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
tokenId: '9007199254740993',
walletAddress: '0x1111111111111111111111111111111111111111',
expiresAt: null,
expectedTotalPriceInUsdt: '102000000000000000000'
})
};
fetch('https://dev-api.renaiss.xyz/v2/marketplace/buy/prepare', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://dev-api.renaiss.xyz/v2/marketplace/buy/prepare"
payload = {
"tokenId": "9007199254740993",
"walletAddress": "0x1111111111111111111111111111111111111111",
"expiresAt": None,
"expectedTotalPriceInUsdt": "102000000000000000000"
}
headers = {
"x-builder-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"operation": "bid",
"tokenId": "<string>",
"buyerWalletAddress": "<string>",
"quote": {
"amountInUsdt": "<string>",
"expiresAt": "2023-11-07T05:31:56Z"
},
"typedData": {
"domain": {},
"types": {},
"primaryType": "<string>",
"message": {}
},
"payload": {
"collectibleId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"bidData": {
"bidder": "<string>",
"feeBps": "<string>",
"tokenId": "<string>",
"amount": "<string>",
"nonce": "<string>",
"deadline": "<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": "Collectible not found",
"code": "COLLECTIBLE_NOT_FOUND"
}{
"error": "Ask price changed",
"code": "WRONG_REQUEST_PARAMS"
}Payload Too Large{
"error": "Authentication rate limit exceeded",
"code": "API_AUTH_RATE_LIMITED"
}Internal Server Error订单
准备购买卡牌
按买家已确认的卖价准备购买,获取待买家签名的订单。 调试面板使用测试网请求格式。当前主网字段见本页说明。
POST
/
v2
/
marketplace
/
buy
/
prepare
按展示的挂牌价准备购买
curl --request POST \
--url https://dev-api.renaiss.xyz/v2/marketplace/buy/prepare \
--header 'Content-Type: application/json' \
--header 'x-builder-api-key: <api-key>' \
--data '
{
"tokenId": "9007199254740993",
"walletAddress": "0x1111111111111111111111111111111111111111",
"expiresAt": null,
"expectedTotalPriceInUsdt": "102000000000000000000"
}
'const options = {
method: 'POST',
headers: {'x-builder-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
tokenId: '9007199254740993',
walletAddress: '0x1111111111111111111111111111111111111111',
expiresAt: null,
expectedTotalPriceInUsdt: '102000000000000000000'
})
};
fetch('https://dev-api.renaiss.xyz/v2/marketplace/buy/prepare', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://dev-api.renaiss.xyz/v2/marketplace/buy/prepare"
payload = {
"tokenId": "9007199254740993",
"walletAddress": "0x1111111111111111111111111111111111111111",
"expiresAt": None,
"expectedTotalPriceInUsdt": "102000000000000000000"
}
headers = {
"x-builder-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"operation": "bid",
"tokenId": "<string>",
"buyerWalletAddress": "<string>",
"quote": {
"amountInUsdt": "<string>",
"expiresAt": "2023-11-07T05:31:56Z"
},
"typedData": {
"domain": {},
"types": {},
"primaryType": "<string>",
"message": {}
},
"payload": {
"collectibleId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"bidData": {
"bidder": "<string>",
"feeBps": "<string>",
"tokenId": "<string>",
"amount": "<string>",
"nonce": "<string>",
"deadline": "<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": "Collectible not found",
"code": "COLLECTIBLE_NOT_FOUND"
}{
"error": "Ask price changed",
"code": "WRONG_REQUEST_PARAMS"
}Payload Too Large{
"error": "Authentication rate limit exceeded",
"code": "API_AUTH_RATE_LIMITED"
}Internal Server ErrorexpiresAt: null 可使用默认到期时间。主网更新前,请同时省略 expiresAt 和 expiresInSeconds 以使用主网默认值。提交购买请求时,买家授予 Permit2 的 USDT 额度必须足以支付订单金额。请求
需要开发者密钥
响应
错误码
在下表中查找接口返回的 HTTP 状态码和响应原文。有关各接口通用的处理建议,请参阅错误码含义与处理方式。
| HTTP | 错误码 | 文本字段 | 响应文本与处理方式 |
|---|---|---|---|
400 | MATCHING_ASK_NOT_FOUND | error | Ask is no longer available藏品没有有效挂牌。请刷新挂牌列表,不要重复发送原请求。 |
400 | MATCHING_ASK_PERMIT_NOT_FOUND | error | Stored ask payload is invalid该挂牌无法购买。请刷新挂牌列表,不要重复发送原请求。 |
400 | WRONG_REQUEST_PARAMS | error | Invalid marketplace request: tokenId: RequiredInvalid marketplace request: expiresAt: RequiredexpiresAt must be null or a future UTC timestamp within 180 days检查报错中提到的字段。要使用默认有效期,请传入 "expiresAt": null。 |
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 | COLLECTIBLE_NOT_FOUND | error | Collectible not found代币 ID 未知或藏品在该 API 中不可用。请核对 ID,不要用同一 ID 重试。 |
409 | WRONG_REQUEST_PARAMS | error | Ask price changed传入价格与当前挂牌价不同。请刷新价格并重新准备购买。 |
413 | 无错误码 | text/plain | Payload Too Large |
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 | 无错误码 | text/plain | Internal Server Error |
500 | COLLECTIBLE_GET_FAILED | error | Internal server error若问题持续出现,请将 x-request-id 提供给 Renaiss。 |
授权
请求体
application/json