<Swap> Interface

Obtain the swap information, call up the wallet to send the specified amount of the original token to the specified address according to the return content, and complete the dialogue.

Request Address: /api/commonSwap

Request Method: POST

Request Parameters:

Field Name
Field Description
Type
Required or not
Notes

equipmentNo

Device number

string

Y

fromTokenAddress

Original token contract address

string

Y

toTokenAddress

Target token contract address

string

Y

fromAddress

Sender address

string

Y

toAddress

Recerver address

string

Y

amountOutMin

Min receiving amount

integer

Y

routerPath

Swap route, if no specific route, can set as null

array

Y

plarform like o3, and similar to uniswap must upload

amounts

Min amount receiving from all routes, if no specific route, can set as null

array

N

o3 must upload

dex

Swap platform name

string

Y

Use to distinguish usage channel

aggregator

Aggregator name

string

N

o3 must upload, represents the DEX name of original single chain swap

fromTokenChain

Oiginal chain

string

Y

toTokenChain

Target chain

string

Y

fromTokenAmount

Original token amount

integer

Y

slippage

Slippage

decimal

Y

Output parameter:

Field Name
Field Description
Type

from

Call the contract request address

string

to

Called contract address

string

value

Call incoming amount

string

gas

Gas Limit

integer

gasPrice

Gas fee

string

data

Contract call data

string

Input example:

{
    "equipmentNo": "0x76336d2903e8f6d62cc3f5d0528310",
    "fromTokenAddress": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
    "toTokenAddress": "0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c",
    "fromAddress": "0x76336d2903e8f6d62cc3f5d05283108e3d2785e0",
    "toAddress": "0x76336d2903e8f6d62cc3f5d05283108e3d2785e0",
    "amountOutMin": "30427649999999997",
    "routerPath": [
        "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
        "0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c"
    ],
    "amounts": [],
    "dex": "1inchSwap",
    "aggregator": "",
    "fromTokenChain": "BSC",
    "toTokenChain": "BSC",
    "fromTokenAmount": "30735000000000000",
    "slippage": 1
}

Output example:

{
    "resCode": "100",
    "resMsg": "Success",
    "data": {
        "txData": {
            "from": "0x76336d2903e8f6d62cc3f5d05283108e3d2785e0",
            "to": "0x11111112542d85b3ef69ae05771c2dccff4faa26",
            "value": "0x6d3151d52bf000",
            "gas": 0,
            "gasPrice": "15000000000",
            "data": "0x7c025200000000000000000000000000baf9a5d4b0052359326a6cdab54babaa3a3a964300000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000180000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee000000000000000000000000bb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c000000000000000000000000baf9a5d4b0052359326a6cdab54babaa3a3a964300000000000000000000000076336d2903e8f6d62cc3f5d05283108e3d2785e0000000000000000000000000000000000000000000000000006d3151d52bf000000000000000000000000000000000000000000000000000006bfe1cd8548f8000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000180000000000000000000000000000000000000000000000000000000000000024000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000064d1660f99000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee000000000000000000000000a0102b2abb03234204dacba824c027f45aa6ccd700000000000000000000000000000000000000000000000000001bf40cc1d60000000000000000000000000000000000000000000000000000000000800000000000000000000000bb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006d155dc86a1a0000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000004d0e30db00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000064d1660f99000000000000000000000000bb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c00000000000000000000000076336d2903e8f6d62cc3f5d05283108e3d2785e0000000000000000000000000000000000000000000000000006d155dc86a1a0000000000000000000000000000000000000000000000000000000000cfee7c08"
        }
    }
}

Postman Call Example

Last updated