Create Order

1.Call frequency limit

Create order that has ip frequency limits, can't have more than 5 attempts within 2 seconds

2. Port Change

Detailed paramaters see API port document, advanced trading port api/v2/accountExchange,

request method is POST application/json

3. Request Parameter Precautions

Parameter

Explanation

depositCoinAmt

After users create an order, must send depositCoinAmt to the order address.

receiveCoinAmt

receiveCoinAmt = depositCoinAmt * instantRate the rate is obtained through the getBaseInfo port, this value is used to record the market price when the order is submitted, precision is maintained to 6 decimal places

equipmentNo

Environment number, this can be used to check numbers associted with all of the order's information, please do not disclose

sourceFlag

Used to indicate which platform's order, the paramater isn't necesary the same sources originally indicated after the project's product comes online

developerId

Used to record the project's related order data, the project can use this paramater to express what the order is part of a particular user or is used to record its own system's order number, or another record number serial number; after the order is created, the parameter value will be returned (SWFT does not support checking order information through this paramater)

4.Code Exmple

java code example

OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"equipmentNo\":\"Zsda352943090468518\",\"sessionUuid\":\"\",\"sourceType\":\"ANDROID\",\"userNo\":\"\",\"orderId\":\"de752da3-0ff7-4682-8038-d8e1f20cad95\",\"depositCoinCode\":\"BTC\",\"receiveCoinCode\":\"ETH\",\"depositCoinAmt\":\"0.01\",\"receiveCoinAmt\":\"0.336585\",\"receiveSwftAmt\":\"18.06\",\"destinationAddr\":\"0x364397e2fc9929f11ba0c03826ef282dd64a829f\",\"refundAddr\":\"18orDLFMp3fGoy5Uk93LDGTGbxWEm7b7FY\",\"sourceFlag\":\"LendChain\",\"developerId\":\"\"}");
Request request = new Request.Builder()
.url("https://transfer.swft.pro/api/v2/accountExchange")
.post(body)
.addHeader("Content-Type", "application/json")
.addHeader("cache-control", "no-cache")
.build();
Response response = client.newCall(request).execute();

C# code example

var client = new RestClient("https://transfer.swft.pro/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\":\"\",\"orderId\":\"de752da3-0ff7-4682-8038-d8e1f20cad95\",\"depositCoinCode\":\"BTC\",\"receiveCoinCode\":\"ETH\",\"depositCoinAmt\":\"0.01\",\"receiveCoinAmt\":\"0.336585\",\"receiveSwftAmt\":\"18.06\",\"destinationAddr\":\"0x364397e2fc9929f11ba0c03826ef282dd64a829f\",\"refundAddr\":\"18orDLFMp3fGoy5Uk93LDGTGbxWEm7b7FY\",\"sourceFlag\":\"LendChain\",\"developerId\":\"\"}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);

Objective-C code example

#import <Foundation/Foundation.h>
NSDictionary *headers = @{ @"Content-Type": @"application/json",
@"cache-control": @"no-cache" };
NSDictionary *parameters = @{ @"equipmentNo": @"Zsda352943090468518",
@"sessionUuid": @"",
@"sourceType": @"ANDROID",
@"userNo": @"",
@"orderId": @"de752da3-0ff7-4682-8038-d8e1f20cad95",
@"depositCoinCode": @"BTC",
@"receiveCoinCode": @"ETH",
@"depositCoinAmt": @"0.01",
@"receiveCoinAmt": @"0.336585",
@"receiveSwftAmt": @"18.06",
@"destinationAddr": @"0x364397e2fc9929f11ba0c03826ef282dd64a829f",
@"refundAddr": @"18orDLFMp3fGoy5Uk93LDGTGbxWEm7b7FY",
@"sourceFlag": @"LendChain",
@"developerId": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://transfer.swft.pro/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 code example

var http = require("https");
var options = {
"method": "POST",
"hostname": [
"transfer",
"swft",
"pro"
],
"path": [
"api",
"v2",
"accountExchange"
],
"headers": {
"Content-Type": "application/json",
"cache-control": "no-cache"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({ equipmentNo: 'Zsda3529430s90468518',
sessionUuid: '',
sourceType: 'ANDROID',
userNo: '',
orderId: 'de752da3-0ff7-4682-8038-d8e1f20cad95',
depositCoinCode: 'BTC',
receiveCoinCode: 'ETH',
depositCoinAmt: '0.01',
receiveCoinAmt: '0.336585',
receiveSwftAmt: '18.06',
destinationAddr: '0x364397e2fc9929f11ba0c03826ef282dd64a829f',
refundAddr: '18orDLFMp3fGoy5Uk93LDGTGbxWEm7b7FY',
sourceFlag: 'LendChain',
developerId: '' }));
req.end();

5.Response result example

{
"data": {
"changeType": "advanced",
"choiseFeeType": "3",
"depositCoinAmt": "0.01",
"depositCoinCode": "BTC",
"depositCoinFeeAmt": "0.00001",
"depositCoinFeeRate": "0.001",
"depositCoinState": "wait_send",
"destinationAddr": "0x364397e2fc9929f11ba0c03826ef282dd64a829f",
"detailState": "wait_deposit_send",
"developerId": "",
"orderId": "60a31323-0507-446b-866c-973a91856e8c",
"orderState": "wait_deposits",
"platformAddr": "3HKL2rwot5YezHGdc5yAabZo74TJeTkVqb",
"receiveCoinAmt": "0.33642",
"receiveCoinCode": "ETH",
"receiveSwftAmt": "18.06",
"refundAddr": "18orDLFMp3fGoy5Uk93LDGTGbxWEm7b7FY",
"refundCoinAmt": "",
"refundCoinMinerFee": "",
"refundDepositTxid": "",
"refundSwftAmt": "",
"swftCoinFeeRate": "0.0005",
"swftCoinState": "",
"swftReceiveAddr": "",
"swftRefundAddr": "",
"transactionId": ""
},
"resCode": "800",
"resMsg": "成功"
}

For a detailed explanation of returned values, please see the Google document

Business Reference Graph

Create the order confirmation page
After order creation is complete, create an order