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

1
OkHttpClient client = new OkHttpClient();
2
3
MediaType mediaType = MediaType.parse("application/json");
4
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\":\"\"}");
5
Request request = new Request.Builder()
6
.url("https://{host}/api/v2/accountExchange")
7
.post(body)
8
.addHeader("Content-Type", "application/json")
9
.addHeader("cache-control", "no-cache")
10
.build();
11
12
Response response = client.newCall(request).execute();
Copied!

C# code example

1
var client = new RestClient("https://{host}/api/v2/accountExchange");
2
var request = new RestRequest(Method.POST);
3
request.AddHeader("cache-control", "no-cache");
4
request.AddHeader("Content-Type", "application/json");
5
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);
6
IRestResponse response = client.Execute(request);
Copied!

Objective-C code example

1
#import <Foundation/Foundation.h>
2
3
NSDictionary *headers = @{ @"Content-Type": @"application/json",
4
@"cache-control": @"no-cache" };
5
NSDictionary *parameters = @{ @"equipmentNo": @"Zsda352943090468518",
6
@"sessionUuid": @"",
7
@"sourceType": @"ANDROID",
8
@"userNo": @"",
9
@"orderId": @"de752da3-0ff7-4682-8038-d8e1f20cad95",
10
@"depositCoinCode": @"BTC",
11
@"receiveCoinCode": @"ETH",
12
@"depositCoinAmt": @"0.01",
13
@"receiveCoinAmt": @"0.336585",
14
@"receiveSwftAmt": @"18.06",
15
@"destinationAddr": @"0x364397e2fc9929f11ba0c03826ef282dd64a829f",
16
@"refundAddr": @"18orDLFMp3fGoy5Uk93LDGTGbxWEm7b7FY",
17
@"sourceFlag": @"LendChain",
18
@"developerId": @"" };
19
20
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
21
22
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://{host}/api/v2/accountExchange"]
23
cachePolicy:NSURLRequestUseProtocolCachePolicy
24
timeoutInterval:10.0];
25
[request setHTTPMethod:@"POST"];
26
[request setAllHTTPHeaderFields:headers];
27
[request setHTTPBody:postData];
28
29
NSURLSession *session = [NSURLSession sharedSession];
30
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
31
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
32
if (error) {
33
NSLog(@"%@", error);
34
} else {
35
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
36
NSLog(@"%@", httpResponse);
37
}
38
}];
39
[dataTask resume];
Copied!

Nodejs code example

1
var http = require("https");
2
3
var options = {
4
"method": "POST",
5
"hostname": [
6
"transfer",
7
"swft",
8
"pro"
9
],
10
"path": [
11
"api",
12
"v2",
13
"accountExchange"
14
],
15
"headers": {
16
"Content-Type": "application/json",
17
"cache-control": "no-cache"
18
}
19
};
20
21
var req = http.request(options, function (res) {
22
var chunks = [];
23
24
res.on("data", function (chunk) {
25
chunks.push(chunk);
26
});
27
28
res.on("end", function () {
29
var body = Buffer.concat(chunks);
30
console.log(body.toString());
31
});
32
});
33
34
req.write(JSON.stringify({ equipmentNo: 'Zsda3529430s90468518',
35
sessionUuid: '',
36
sourceType: 'ANDROID',
37
userNo: '',
38
orderId: 'de752da3-0ff7-4682-8038-d8e1f20cad95',
39
depositCoinCode: 'BTC',
40
receiveCoinCode: 'ETH',
41
depositCoinAmt: '0.01',
42
receiveCoinAmt: '0.336585',
43
receiveSwftAmt: '18.06',
44
destinationAddr: '0x364397e2fc9929f11ba0c03826ef282dd64a829f',
45
refundAddr: '18orDLFMp3fGoy5Uk93LDGTGbxWEm7b7FY',
46
sourceFlag: 'LendChain',
47
developerId: '' }));
48
req.end();
Copied!

5.Response result example

1
{
2
"data": {
3
"changeType": "advanced",
4
"choiseFeeType": "3",
5
"depositCoinAmt": "0.01",
6
"depositCoinCode": "BTC",
7
"depositCoinFeeAmt": "0.00001",
8
"depositCoinFeeRate": "0.001",
9
"depositCoinState": "wait_send",
10
"destinationAddr": "0x364397e2fc9929f11ba0c03826ef282dd64a829f",
11
"detailState": "wait_deposit_send",
12
"developerId": "",
13
"orderId": "60a31323-0507-446b-866c-973a91856e8c",
14
"orderState": "wait_deposits",
15
"platformAddr": "3HKL2rwot5YezHGdc5yAabZo74TJeTkVqb",
16
"receiveCoinAmt": "0.33642",
17
"receiveCoinCode": "ETH",
18
"receiveSwftAmt": "18.06",
19
"refundAddr": "18orDLFMp3fGoy5Uk93LDGTGbxWEm7b7FY",
20
"refundCoinAmt": "",
21
"refundCoinMinerFee": "",
22
"refundDepositTxid": "",
23
"refundSwftAmt": "",
24
"swftCoinFeeRate": "0.0005",
25
"swftCoinState": "",
26
"swftReceiveAddr": "",
27
"swftRefundAddr": "",
28
"transactionId": ""
29
},
30
"resCode": "800",
31
"resMsg": "成功"
32
}
Copied!
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
Last modified 1yr ago