swap.v1.SwapService
GetSwap
GetSwap returns one of the caller's Swaps by swap_id or idempotency key. Errors: - INVALID_ARGUMENT: malformed selector. - NOT_FOUND: SWAP_NOT_FOUND. - PERMISSION_DENIED: SWAP_NOT_PERMITTED. - UNAVAILABLE: SERVICE_UNAVAILABLE; retry later. - UNAUTHENTICATED: missing or invalid credentials.
Request
curl --request POST \ \
--url 'https://api.testnet.polyester.com/swap.v1.SwapService/GetSwap' \
--header 'Content-Type: application/json' \
--header 'Connect-Protocol-Version: 1' \
--data '{
"swapId": "1"
}'Responses
{
"swap": {
"amountE18": {
"hi": "1",
"lo": "1"
},
"createdAt": "2025-01-01T00:00:00Z",
"destinationAssetId": 100,
"executedAmountE18": {
"hi": "1",
"lo": "1"
},
"feeE18": {
"hi": "1",
"lo": "1"
},
"idempotencyKey": "idem_01J5EXAMPLE0000000000000",
"isTerminal": false,
"minAmountOutE18": {
"hi": "1",
"lo": "1"
},
"orders": [
{
"feeE18": {
"hi": "1",
"lo": "1"
},
"leg": 1,
"limitPriceTicks": "61000250000000",
"orderId": "9876543210123",
"receivedE18": {
"hi": "1",
"lo": "1"
},
"side": "BUY",
"spentE18": {
"hi": "1",
"lo": "1"
},
"status": "PLACING",
"symbolId": 1
}
],
"reason": "INSUFFICIENT_BALANCE",
"receivedAmountE18": {
"hi": "1",
"lo": "1"
},
"sourceAssetId": 100,
"status": "EXECUTING",
"subaccountId": "6789012345678",
"swapId": "1",
"unspentAmountE18": {
"hi": "1",
"lo": "1"
}
}
}swap.v1.GetSwapRequestswap.v1.GetSwapResponseSwap ID.
Idempotency key the Swap was created with.
Swap ID.
Idempotency key the Swap was created with.
Sub-account public ID funding the Swap; 0 for the root account.
Asset spent.
Asset received.
Most significant 64 bits.
Least significant 64 bits.
Most significant 64 bits.
Least significant 64 bits.
Current status.
Why the Swap did not trade its whole amount; set with PARTIALLY_COMPLETED and FAILED.
True once the status is final: COMPLETED, PARTIALLY_COMPLETED or FAILED.
Most significant 64 bits.
Least significant 64 bits.
Most significant 64 bits.
Least significant 64 bits.
Most significant 64 bits.
Least significant 64 bits.
Most significant 64 bits.
Least significant 64 bits.
Spot order ID, once the market accepted the order; 0 before.
Stable numeric pair ID from GetSpotConfig.
Side of the order.
Zero-based position of the order's market in the Swap's route.
State of the order.
Limit price in quote-asset price ticks (1e-9 quote units per base unit): the worst price at which the order nets the Swap's minimum rate after fees.
Most significant 64 bits.
Least significant 64 bits.
Most significant 64 bits.
Least significant 64 bits.
Most significant 64 bits.
Least significant 64 bits.
When the Swap was created.
| Key | HTTP status | Connect code | Error | When |
|---|---|---|---|---|
| unauthenticated | 401 | unauthenticated | Unauthenticated | Authentication required. |
| permission-denied | 403 | permission_denied | Permission Denied | Permission denied. |
| invalid-argument | 400 | invalid_argument | Invalid Argument | Invalid argument. |
| not-found | 404 | not_found | Not Found | Not found. |
| unavailable | 503 | unavailable | Unavailable | Service unavailable. |