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;
{
//订单号
"orderId": "5d3b383f-xxxx-xxxx-xxxx-2de8d23a492e",
"r": "0xxxx",
"s": "0xxxxx",
"v": "0xxx",
"rawTransaction": "0xxxxxxxxx"
}
{
"orderId": "5d3b383f-xxxx-xxxx-xxxx-2de8d23a492e",
"transactionHash": "0xxxxxxxxxxxxxx"
}
```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("{host}/gt/swap/v1/noGasSwap")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
```
```powershell
curl --location '{host}/gt/swap/v1/noGasSwap' \
--header 'Content-Type: application/json' \
--data '{
"orderId": "5d3b383f-xxx-xxx-87b6-xxx",
"r": "0xxxx",
"s": "0xxxx",
"v": "0xxxx",
"rawTransaction": "0xxxx"
}'
```