# Upload gas free orders

### Interface Call Graph

![](https://2491477457-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LUhiTwwiqGj9wzsGZ49%2Fuploads%2F0nc3M9fu7URN3MvHF8Da%2Fimage.png?alt=media\&token=710a6e19-5259-4768-9c05-ee24101a3324)

### Timing Diagram

![](https://2491477457-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LUhiTwwiqGj9wzsGZ49%2Fuploads%2FmdZ1DXLucP8CRbyTkICU%2Fimage.png?alt=media\&token=a454eb19-9326-4020-8cc2-69323838bdae)

### remark

1. Call the "[Get Rate Interface](https://docs.en.omnibridge.pro/cross-chain-swap-api/obtain-exchange-rate-basic-information-port)" to obtain the return value isSupportNoGas, where Y indicates support for gas free exchange
2. Call the "[Create Order Interface](https://docs.en.omnibridge.pro/cross-chain-swap-api/create-order)" and pass the isSupportNoGas field. If successful, the noGasTxInfo field will be returned as the call to be signed\_ Data
3. For call\_ Sign data to obtain signed data such as r, s, v, rawTransaction
4. Call the "[Upload gas free orders](https://docs.en.omnibridge.pro/cross-chain-swap-api/upload-gas-free-orders)", pass r, s, v, rawTransaction, and the orderId returned by the "Create Order Interface" to complete the process

Step 3 Example Code

```
 const privateKey = ''; // private key
 const transactionData = '{
  gasLimit: 100000,
  data: '0xaxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
  chainId: 56,
  to: '0x0000000000000xxxxx',
  nonce: 50,
  gasPrice: '3150000000'
}'
 const account = web3.eth.accounts.privateKeyToAccount(privateKey);
 const signedTx = await account.signTransaction(transactionData);
 const r = signedTx.r;
 const s = signedTx.s;
 const v = signedTx.v;
 const rawTransaction = signedTx.rawTransaction;
```

1.Request Url:

```
https://{host}/gt/swap/v1/noGasSwap
```

2\. Request parameter instance

| parameter      | whether | explain                                 |
| -------------- | ------- | --------------------------------------- |
| orderId        | Yes     | eg：5d3b383f-5b58-4a35-87b6-2de8d23a492e |
| r              | Yes     | eg：0xxxxxxx                             |
| s              | Yes     | eg：0xxxxxxx                             |
| v              | Yes     | eg: 0xxx                                |
| rawTransaction | Yes     | eg: 0xxxxxxx                            |

3\. Example of request parameters

```

{
    //orderId
    "orderId": "5d3b383f-xxxx-xxxx-xxxx-2de8d23a492e",
    "r": "0xxxx",
    "s": "0xxxxx",
    "v": "0xxx",
    "rawTransaction": "0xxxxxxxxx"
}

```

4.Example of returned results

```
{
    "orderId": "5d3b383f-xxxx-xxxx-xxxx-2de8d23a492e",
    "transactionHash": "0xxxxxxxxxxxxxx"
}
```

5.Return Parameter Description

| field name | field           | type   | remark  |
| ---------- | --------------- | ------ | ------- |
| orderId    | orderId         | String | orderId |
| tx hash    | transactionHash | String | tx hash |

### **code** example

**java**

````
```java
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n    \"orderId\": \"5d3b383f-xxx-xxx-87b6-xxx\",\n    \"r\": \"0xxxx\",\n    \"s\": \"0xxxx\",\n    \"v\": \"0xxxx\",\n    \"rawTransaction\": \"0xxxx\"\n}");
Request request = new Request.Builder()
  .url("https://www.swftc.info/gt/swap/v1/noGasSwap")
  .method("POST", body)
  .addHeader("Content-Type", "application/json")
  .build();
Response response = client.newCall(request).execute();
```
````

**curl**

````
```powershell
curl --location 'https://www.swftc.info/gt/swap/v1/noGasSwap' \
--header 'Content-Type: application/json' \
--data '{
    "orderId": "5d3b383f-xxx-xxx-87b6-xxx",
    "r": "0xxxx",
    "s": "0xxxx",
    "v": "0xxxx",
    "rawTransaction": "0xxxx"
}'
```
````

#### Postman

<figure><img src="https://2491477457-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LUhiTwwiqGj9wzsGZ49%2Fuploads%2FpFMVW6YhFCRBd0s7U81q%2Fimage.png?alt=media&#x26;token=e214d688-3081-4a33-b19b-545966e34b62" alt=""><figcaption></figcaption></figure>
