转账到其他mixin 账户

开发者可以使用这个 API 来为用户实现给其他mixin 账户转账\

// cURL Example
curl -i -H "Content-Type: application/json" -H "Authorization: Bearer eyJhbGciOiJSUzUxMiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1MzMxMTgwODIsImlhdCI6MTUyNTM0MjA4MiwianRpIjoiMmQ5YjI2YTUtMDc4Ny00OGIyLWExN2MtNWM5ZGQ5Mjc5MDI2Iiwic2lkIjoiYTM0YzA3YTktNzU1ZC00YjU0LTk0YzUtZTQ1ZTlhMmRkNDNlIiwic2lnIjoiMTUzMjIwNDlkNWFlMzNhNjYyMjAwOWQ1YTk4N2ZjYmRlNDQ4OTkxMmUxZmE2ZTAwODk0YjlhYzM2MTRiZTE4MiIsInVpZCI6IjA2YWVkMWUzLWJkNzctNGE1OS05OTFhLTViYjVhZTZmYmIwOSJ9.RVR6ejUZkAGeRG9M9C5Jk4llmJvFHTXAx3f3yxwTiiglFbfiNrt2fI9ZHNYCp7XbJJh4w9ECyX1K8Obgq7ep2RcGzjMkKWlXWuECLwgUA4FRFrewvPcH2Edplo61B9I6M89Ohi1_V6owkee08bDR2k0se2MdWTxnHca8BzOFckc" "https://api.mixin.one/transfers" -XPOST --data '{"amount":"10","asset_id":"43d61dcd-e413-450d-80b8-101d5e903357","opponent_id":"a465ffdb-4441-4cb9-8b45-00cf79dfbc46","memo":"hello","pin":"F39IsJmUaZW03VMV/01lHyY2RCoZ7/X764akX+EmthIc4uVsWAWQTM/IxX5Z9C1y","trace_id":"7c67e8e8-b142-488b-80a3-61d4d29c90bf"}'

服务器的响应如下

// Sample Response
{
"data":{
"type":"transfer",
"snapshot_id":"ab56be4c-5b20-41c6-a9c3-244f9a433f35",
"opponent_id":"a465ffdb-4441-4cb9-8b45-00cf79dfbc46",
"asset_id":"43d61dcd-e413-450d-80b8-101d5e903357",
"amount":"-10",
"trace_id":"7c67e8e8-b142-488b-80a3-61d4d29c90bf",
"memo":"hello",
"created_at":"2018-05-03T10:08:34.859542588Z"
}
}

python代码片段来自例子

def transferToFromPub(robot, config, to_user_id, to_asset_id,to_asset_amount,memo, trace_uuid=""):
encrypted_pin = robot.genEncrypedPin_extConfig(config)
if trace_uuid == "":
body = {'asset_id': to_asset_id, 'counter_user_id':to_user_id, 'amount':str(to_asset_amount), 'pin':encrypted_pin, 'trace_id':str(uuid.uuid1())}
else:
body = {'asset_id': to_asset_id, 'counter_user_id':to_user_id, 'amount':str(to_asset_amount), 'pin':encrypted_pin, 'trace_id':trace_uuid}
body_in_json = json.dumps(body)
encoded = robot.genPOSTJwtToken_extConfig('/transfers', body_in_json, config)
r = requests.post('https://api.mixin.one/transfers', json = body, headers = {"Authorization":"Bearer " + encoded})
result_obj = r.json()
print(result_obj)
return result_obj