创建订单
1. 接口调用:
https://{host}/api/v2/accountExchange
2. 请求参数实例
3.请求参数示例
{
"depositCoinCode": "ETHF",
"receiveCoinCode": "USDT(BSC)",
"depositCoinAmt": "42.207403",
"receiveCoinAmt": "46.367529",
"destinationAddr": "0x19b9918f...f85ad08ba0",
"refundAddr": "0x19b9918f...f85ad08ba0",
"equipmentNo":"zfgryh918f93a19fdg6918a68cf5",
"sourceType": "H5",
"sourceFlag":"widget",
"isNoGas":true,
"slippage": "0.02"
}
4.返回结果示例
{
"data": {
"chainFee": "0.001",//兑换完成后发币旷工费
"changeType": "advanced",//去中心化兑换
"choiseFeeType": "3",
"createTime": "2022-03-10 18:44:21",
"dealFinishTime": null,
"depositCoinAmt": "2",
"depositCoinCode": "ETH",
"depositCoinFeeAmt": "0.004",//兑换手续费
"depositCoinFeeRate": "0.002",//兑换手续费率
"depositCoinState": "wait_send",
"depositFeeRate": "0.002",
"depositTxid": "",
"destinationAddr": "0xAE93FA34f728855cE663cf9FcF8e32148F079071",//用户接收币种地址
"detailState": "wait_deposit_send",//订单状态(详见高级兑换接口)
"developerId": "",
"instantRate": "6.856554564172",//汇率
"isDiscount": "N",
"kycUrl": "",//超过当日限额的kyc路径(详见高级兑换接口)
"orderId": "f94e631b-d99b-4dd5-98f7-09bf99d16d94",//订单号
"orderState": "wait_deposits",
"platformAddr": "0x3181af4f7cc7251a6a4eda75526c8abe10106db8",//存币地址(用户创建订单后需向此地址转币,转币币种depositCoinCode,转币数量depositCoinAmt)
"receiveCoinAmt": "13.713109",
"receiveCoinCode": "BNB(BSC)",
"receiveSwftAmt": "2416.89",
"refundAddr": "0xAE93FA34f728855cE663cf9FcF8e32148F079071",//退币地址(兑换失败退回存币币种到此地址)
"refundCoinAmt": "",//兑换失败时的退币数量
"refundCoinMinerFee": "",
"refundDepositTxid": "",//兑换失败时的退币哈希
"refundSwftAmt": "",
"swftCoinFeeRate": "0.001",
"swftCoinState": "",
"swftReceiveAddr": "",
"swftRefundAddr": "",
"transactionId": "",//发币哈希
"xrpInfo": "",
//开启免 gas 后返回的代签名交易数据
"noGasTxInfo": "{\"gasLimit\":37920,\"data\":\"0xxxxx\",\"chainId\":56,\"to\":\"0xxxxx\",\"nonce\":51,\"gasPrice\":\"3150000000\"}",
},
"resCode": "800",
"resMsg": "成功",
"resMsgEn": ""
}
5.返回参数说明
代码示例
java代码示例
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"equipmentNo\":\"Zsda352943090468518\",\"sessionUuid\":\"\",\"sourceType\":\"ANDROID\",\"userNo\":\"\",\"depositCoinCode\":\"BTC\",\"receiveCoinCode\":\"ETH\",\"depositCoinAmt\":\"0.01\",\"receiveCoinAmt\":\"0.336585\",\"receiveSwftAmt\":\"0\",\"destinationAddr\":\"0x364397e2fc9929f11ba0c03826ef282dd64a829f\",\"refundAddr\":\"18orDLFMp3fGoy5Uk93LDGTGbxWEm7b7FY\",\"sourceFlag\":\"LendChain\",\"developerId\":\"\"}");
Request request = new Request.Builder()
.url("https://{host}/api/v2/accountExchange")
.post(body)
.addHeader("Content-Type", "application/json")
.addHeader("cache-control", "no-cache")
.build();
Response response = client.newCall(request).execute();
C# 代码示例
var client = new RestClient("${host}/api/v2/accountExchange");
var request = new RestRequest(Method.POST);
request.AddHeader("cache-control", "no-cache");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("undefined", "{\"equipmentNo\":\"352943090468518\",\"sessionUuid\":\"\",\"sourceType\":\"ANDROID\",\"userNo\":\"\",\"depositCoinCode\":\"BTC\",\"receiveCoinCode\":\"ETH\",\"depositCoinAmt\":\"0.01\",\"receiveCoinAmt\":\"0.336585\",\"receiveSwftAmt\":\"0\",\"destinationAddr\":\"0x364397e2fc9929f11ba0c03826ef282dd64a829f\",\"refundAddr\":\"18orDLFMp3fGoy5Uk93LDGTGbxWEm7b7FY\",\"sourceFlag\":\"LendChain\",\"developerId\":\"\"}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Objective-C 代码示例
#import <Foundation/Foundation.h>
NSDictionary *headers = @{ @"Content-Type": @"application/json",
@"cache-control": @"no-cache" };
NSDictionary *parameters = @{ @"equipmentNo": @"Zsda352943090468518",
@"sessionUuid": @"",
@"sourceType": @"ANDROID",
@"userNo": @"",
@"depositCoinCode": @"BTC",
@"receiveCoinCode": @"ETH",
@"depositCoinAmt": @"0.01",
@"receiveCoinAmt": @"0.336585",
@"receiveSwftAmt": @"0",
@"destinationAddr": @"0x364397e2fc9929f11ba0c03826ef282dd64a829f",
@"refundAddr": @"18orDLFMp3fGoy5Uk93LDGTGbxWEm7b7FY",
@"sourceFlag": @"LendChain",
@"developerId": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://{host}/api/v2/accountExchange"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
Nodejs代码示例
//getToken example
import axios from 'axios'
const params = {
equipmentNo: "zfgryh918f93a19fdg6918a68cf5",
sourceType: "H5",
userNo: "",
sessionUuid: "",
orderId: "",
sourceFlag: "widget",
depositCoinCode: "ETHF",
receiveCoinCode: "USDT(BSC)",
depositCoinAmt: "42.207403",
receiveCoinAmt: "46.367529",
destinationAddr: "0x19b9918f...f85ad08ba0",
refundAddr: "0x19b9918f...f85ad08ba0"
}
const res = await axios.post('https://{host}/api/v2/accountExchange', params )
console.log(res)
Postman示例
返回结果示例
{
"data": {
"chainFee": "0.001",//兑换完成后发币旷工费
"changeType": "advanced",//去中心化兑换
"choiseFeeType": "3",
"createTime": "2022-03-10 18:44:21",
"dealFinishTime": null,
"depositCoinAmt": "2",
"depositCoinCode": "ETH",
"depositCoinFeeAmt": "0.004",//兑换手续费
"depositCoinFeeRate": "0.002",//兑换手续费率
"depositCoinState": "wait_send",
"depositFeeRate": "0.002",
"depositTxid": "",
"destinationAddr": "0xAE93FA34f728855cE663cf9FcF8e32148F079071",//用户接收币种地址
"detailState": "wait_deposit_send",//订单状态(详见高级兑换接口)
"developerId": "",
"instantRate": "6.856554564172",//汇率
"isDiscount": "N",
"kycUrl": "",//超过当日限额的kyc路径(详见高级兑换接口)
"orderId": "f94e631b-d99b-4dd5-98f7-09bf99d16d94",//订单号
"orderState": "wait_deposits",
"platformAddr": "0x3181af4f7cc7251a6a4eda75526c8abe10106db8",//存币地址(用户创建订单后需向此地址转币,转币币种depositCoinCode,转币数量depositCoinAmt)
"receiveCoinAmt": "13.713109",
"receiveCoinCode": "BNB(BSC)",
"receiveSwftAmt": "2416.89",
"refundAddr": "0xAE93FA34f728855cE663cf9FcF8e32148F079071",//退币地址(兑换失败退回存币币种到此地址)
"refundCoinAmt": "",//兑换失败时的退币数量
"refundCoinMinerFee": "",
"refundDepositTxid": "",//兑换失败时的退币哈希
"refundSwftAmt": "",
"swftCoinFeeRate": "0.001",
"swftCoinState": "",
"swftReceiveAddr": "",
"swftRefundAddr": "",
"transactionId": "",//发币哈希
"xrpInfo": "",
//开启免 gas 后返回的代签名交易数据
"noGasTxInfo": "{\"gasLimit\":37920,\"data\":\"0xxxxx\",\"chainId\":56,\"to\":\"0xxxxx\",\"nonce\":51,\"gasPrice\":\"3150000000\"}"
},
"resCode": "800",
"resMsg": "成功",
"resMsgEn": ""
}
响应数据
参数参见API接口文档 闪兑接口
业务参考图
Last updated