Get Swap
To check transaction status, you can retrieve created swap.
GET
https://api.layerswap.io/api/swaps/
Get swap by Id or ReferenceId
Path Parameters
Name
Type
Description
id*
String
ID can be either the Swap response data.id received in the create swap endpoint or a partner provided reference_id from the create swap request
Headers
Name
Type
Description
X-LS-APIKEY*
{
"data": {
"id": "28996c7d-ee95-4727-8efe-ba0006aa16d4",
"from_network": {
"name": "IMMUTABLEX_GOERLI",
"display_name": "ImmutableX Goerli",
"logo": "https://devlslayerswapbridgesa.blob.core.windows.net/layerswap/networks/immutablex_goerli.png"
},
"to_network": {
"name": "ARBITRUM_GOERLI",
"display_name": "Arbitrum One Goerli",
"logo": "https://devlslayerswapbridgesa.blob.core.windows.net/layerswap/networks/arbitrum_goerli.png"
},
"from": "Fake CEX (for testing)",
"to": "Arbitrum One Goerli",
"amount": 1,
"fee": 0,
"asset": {
"name": "ETH",
"display_name": "ETH",
"logo": "https://devlslayerswapbridgesa.blob.core.windows.net/layerswap/currencies/eth.png",
"usd_price": 1745.42,
"contract": null,
"decimals": 6,
"precision": 6
},
"to_address": "0xC11c16C421419a11211197B7D4857ff62013a4C3",
"source_address": "0xC11c16C421419a11211197B7D4857ff62013a4C3",
"deposit_address": "0x7393b2a34cc9a40315fb18a33c3bf6307d346733",
"status": "completed",
"reference_id": "1",
"app_name": "MyApp",
"transactions" : [
{
"timestamp": 1691491520123,
"type": "input",
"from": "0xD5c11b416bAa7E1256E209AfaE96d734B5B0A461",
"to": "0xdAC17F958D2ee523a2206206994597C13D831ec7",
"created_date": "2023-01-25T13:18:14.347986+00:00",
"transaction_id": "0xbf521e098e100c94b9ac2203274eff799a2d54fed204bbc19816e77877481307",
"explorer_url": "https://goerli.etherscan.io/tx/0xbf521e098e100c94b9ac2203274eff799a2d54fed204bbc19816e77877481307",
"confirmations": 1,
"max_confirmations": 1,
"amount": 0.005063,
"usd_price": 7.91539294,
"usd_value": 0.04007563445522
},
{
"timestamp": 1691491520123,
"type": "output",
"from": "0xCE0BaBc8398144Aa98D9210d595E3A9714910748",
"to": "0xeBec795c9c8bBD61FFc14A6662944748F299cAcf",
"created_date": "2023-01-25T13:18:32.031303+00:00",
"transaction_id": "0x1e639aaf80069cbd2cbebf0c3fea974146844566e43ddd7074b9b47728e4d2d9",
"explorer_url": "https://explorer.loopring.io/tx/0x1e639aaf80069cbd2cbebf0c3fea974146844566e43ddd7074b9b47728e4d2d9-transfer",
"confirmations": 0,
"max_confirmations": 0,
"amount": 0.005,
"usd_price": 7.8169,
"usd_value": 0.0390845
}
]
},
"error": null
}
A detailed explanation of Swap Object is available here.
Raw Request
curl -X 'GET' \
'https://api.layerswap.io/api/swaps/{ID}' \
--H 'X-LS-APIKEY: {YOUR_APP_APIKEY}'
Raw response
{
"data": {
"id": "12b21e7e-1e1e-46b4-881f-8e1bd10288c4",
"source_network": "ETHEREUM_GOERLI",
"destination_network": "ARBITRUM_GOERLI",
"amount": 0.009,
"fee": 0.000227,
"source_asset": "ETH",
"destination_asset": "ETH",
"destination_address": "0x481b173fe7f9ff503d9182d0b9ad6e62336b7733",
"status": "completed",
"reference_id": null,
"app": "AppForTestingAPI",
"transactions": [
{
"from": "0x481b173fe7f9ff503d9182d0b9ad6e62336b7733",
"to": "0x5da5c2a98e26fd28914b91212b1232d58eb9bbab",
"timestamp": "2023-09-15T15:20:00+00:00",
"transaction_hash": "0x40fa71037f71533051af0c4ff7bc9b3c5f11e58ea2fdf8bb011484e9e1262093",
"confirmations": 3,
"max_confirmations": 3,
"amount": 0.01,
"asset": "ETH",
"type": "input"
},
{
"from": "0x5da5c2a98e26fd28914b91212b1232d58eb9bbab",
"to": "0x481b173fe7f9ff503d9182d0b9ad6e62336b7733",
"timestamp": "2023-09-15T15:20:53+00:00",
"transaction_hash": "0xcbc0ea13cb7748e0a9a9a45cd0c5a7bacb967e789e35d7c15b8d2877d5cf1e70",
"confirmations": 3,
"max_confirmations": 3,
"amount": 0.000062,
"asset": "ETH",
"type": "refuel"
},
{
"from": "0x5da5c2a98e26fd28914b91212b1232d58eb9bbab",
"to": "0x481b173fe7f9ff503d9182d0b9ad6e62336b7733",
"timestamp": "2023-09-15T15:20:53+00:00",
"transaction_hash": "0xd3bb7b528096b149ff9f28158212930ce1a2bf1f674afff04e80c12d1fff435a",
"confirmations": 3,
"max_confirmations": 3,
"amount": 0.009773,
"asset": "ETH",
"type": "output"
}
]
},
"error": null
}
Last updated