直达内容

转让 NFT

转让 NFT 的请求

POST /collectibles/requests

生成一个转让 NFT 的请求。

API 端点 URL

 https://api.mixin.one/collectibles/requests

授权和其他选项

授权
Authorized
限制No limitation

请求体

{
"action": "请求操作: 'sign' 或者 'unlock'",
"raw": "这个交易的签名后数据"
}
信息

raw 是按照主网要求生成的一个交易的 hash 值。可以参考 Go 跟 JS 的代码 code

请求示例

curl -i -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $TOKEN" https://api.mixin.one/collectibles/requests --data '{"action": "sign", "raw": "298281....4952f95768b7d1a925c4189b912c343dbb000180e"}'

请求的数据结构

{
"data": {
"type": "non_fungible_request",
"request_id": "ab56be4c-5b20-41c6-a9c3-244f9a433f35",
"user_id": "ab56be4c-5b20-41c6-a9c3-244f9a433f35",
"token_id": "43d61dcd-e413-450d-80b8-101d5e903357",
"amount": "10",
"senders_threshold": 2,
"senders": [
"ab56be4c-5b20-41c6-a9c3-244f9a433f35",
"ab56be4c-5b20-41c6-a9c3-244f9a433f35",
"ab56be4c-5b20-41c6-a9c3-244f9a433f35"
],
"receivers_threshold": 2,
"receivers": [
"ab56be4c-5b20-41c6-a9c3-244f9a433f35",
"ab56be4c-5b20-41c6-a9c3-244f9a433f35",
"ab56be4c-5b20-41c6-a9c3-244f9a433f35"
],
"signers": [
"ab56be4c-5b20-41c6-a9c3-244f9a433f35",
"ab56be4c-5b20-41c6-a9c3-244f9a433f35",
"ab56be4c-5b20-41c6-a9c3-244f9a433f35"
],
"action": "sign",
"state": "spent",
"transaction_hash": "298281....4952f95768b7d1a925c4189b912c343dbb000180e",
"raw_transaction": "298281....4952f95768b7d1a925c4189b912c343dbb000180e",
"created_at": "2018-05-03T10:08:34.859542588Z",
"code_id": "ab56be4c-5b20-41c6-a9c3-244f9a433f35"
}
}

对请求进行操作

POST /collectibles/requests/:id/:action

API 端点 URL

 https://api.mixin.one/collectibles/requests/:id/:action

授权和其他选项

授权
Authorized
限制No limitation

参数

action
*必须
操作有: `sign`, `cancel` 跟 `unlock`
pin_base64加密后的 PIN.
pin
*必须

TIP Pin 结构

"TIP:COLLECTIBLE:REQUEST:SIGN:" + request_id

sign 多签的 pin_base64 是上面值的 sha256-256 的结果

"TIP:COLLECTIBLE:REQUEST:UNLOCK:" + request_id

unlock 多签的 pin_base64 是上面值的 sha256-256 的结果

请求示例

curl -i -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $TOKEN" https://api.mixin.one/collectibles/requests/:id/:action --data '{"pin": "YOUR_PIN"}'

请求的数据结构

{
"data": {
"type": "non_fungible_request",
"request_id": "ab56be4c-5b20-41c6-a9c3-244f9a433f35",
"user_id": "ab56be4c-5b20-41c6-a9c3-244f9a433f35",
"token_id": "43d61dcd-e413-450d-80b8-101d5e903357",
"amount": "10",
"senders_threshold": 2,
"senders": [
"ab56be4c-5b20-41c6-a9c3-244f9a433f35",
"ab56be4c-5b20-41c6-a9c3-244f9a433f35",
"ab56be4c-5b20-41c6-a9c3-244f9a433f35"
],
"receivers_threshold": 2,
"receivers": [
"ab56be4c-5b20-41c6-a9c3-244f9a433f35",
"ab56be4c-5b20-41c6-a9c3-244f9a433f35",
"ab56be4c-5b20-41c6-a9c3-244f9a433f35"
],
"signers": [
"ab56be4c-5b20-41c6-a9c3-244f9a433f35",
"ab56be4c-5b20-41c6-a9c3-244f9a433f35",
"ab56be4c-5b20-41c6-a9c3-244f9a433f35"
],
"action": "sign",
"state": "spent",
"transaction_hash": "298281....4952f95768b7d1a925c4189b912c343dbb000180e",
"raw_transaction": "298281....4952f95768b7d1a925c4189b912c343dbb000180e",
"created_at": "2018-05-03T10:08:34.859542588Z",
"code_id": "ab56be4c-5b20-41c6-a9c3-244f9a433f35"
}
}

主要的操作

签名

// Generate collectible request.
POST /collectibles/requests
{
"action": "sign",
"raw": "298281....000180e"
}

// Sign collectible request.
POST /collectibles/requests/:id/sign

未签名时,取消签名请求

// Generate collectible request.
POST /collectibles/requests
{
"action": "cancel",
"raw": "298281....000180e"
}

// Send collectible cancelling request.
POST /collectibles/requests/:id/cancel

签名后取消签名,需要未达到签名数

// Generate collectible request.
POST /collectibles/requests
{
"action": "unlock",
"raw": "298281....000180e"
}

// Send collectible unlocking request.
POST /collectibles/requests/:id/unlock