Skip to main content
GET
/
swaps
/
activities
import cobo_waas2
from cobo_waas2.models.list_swap_activities200_response import (
    ListSwapActivities200Response,
)
from cobo_waas2.rest import ApiException
from pprint import pprint

# See configuration.py for a list of all supported configurations.
configuration = cobo_waas2.Configuration(
    # Replace `<YOUR_PRIVATE_KEY>` with your private key
    api_private_key="<YOUR_PRIVATE_KEY>",
    # Select the development environment. To use the production environment, change the URL to https://api.cobo.com/v2.
    host="https://api.dev.cobo.com/v2",
)
# Enter a context with an instance of the API client
with cobo_waas2.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = cobo_waas2.SwapsApi(api_client)
    status = "Success"
    min_updated_timestamp = 1635744000000
    max_updated_timestamp = 1635744000000
    initiator = "[email protected]"
    limit = 10
    before = "RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGmk1"
    after = "RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGSAk"
    sort_by = ""
    direction = ""

    try:
        # List Swap Activities
        api_response = api_instance.list_swap_activities(
            status=status,
            min_updated_timestamp=min_updated_timestamp,
            max_updated_timestamp=max_updated_timestamp,
            initiator=initiator,
            limit=limit,
            before=before,
            after=after,
            sort_by=sort_by,
            direction=direction,
        )
        print("The response of SwapsApi->list_swap_activities:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling SwapsApi->list_swap_activities: %s\n" % e)

{
  "data": [
    {
      "activity_id": "123e4567-e89b-12d3-a456-426614174000",
      "swap_type": "Bridge",
      "status": "Success",
      "request_id": "123e4567-e89b-12d3-a456-426614174000",
      "wallet_id": "123e4567-e89b-12d3-a456-426614174001",
      "pay_token_id": "BTC",
      "receive_token_id": "ETH_WBTC",
      "pay_amount": "100",
      "receive_amount": "100",
      "fee_token_id": "BTC",
      "fee_amount": "0.3",
      "initiator": "John Doe",
      "initiator_type": "API",
      "description": "This is a description of the swap activity.",
      "created_timestamp": 1677587333000,
      "updated_timestamp": 1677587393000,
      "network_fee": {
        "fee_type": "EVM_EIP_1559",
        "token_id": "TRON",
        "max_fee_amount": "0.1"
      },
      "destination_address": "19AR6YWEGbSoY8UT9Ksy9WrmrZPD5sL4Ku"
    }
  ],
  "pagination": {
    "before": "RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGmk1",
    "after": "RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGSAk",
    "total_count": 10000
  }
}
import cobo_waas2
from cobo_waas2.models.list_swap_activities200_response import (
    ListSwapActivities200Response,
)
from cobo_waas2.rest import ApiException
from pprint import pprint

# See configuration.py for a list of all supported configurations.
configuration = cobo_waas2.Configuration(
    # Replace `<YOUR_PRIVATE_KEY>` with your private key
    api_private_key="<YOUR_PRIVATE_KEY>",
    # Select the development environment. To use the production environment, change the URL to https://api.cobo.com/v2.
    host="https://api.dev.cobo.com/v2",
)
# Enter a context with an instance of the API client
with cobo_waas2.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = cobo_waas2.SwapsApi(api_client)
    status = "Success"
    min_updated_timestamp = 1635744000000
    max_updated_timestamp = 1635744000000
    initiator = "[email protected]"
    limit = 10
    before = "RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGmk1"
    after = "RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGSAk"
    sort_by = ""
    direction = ""

    try:
        # List Swap Activities
        api_response = api_instance.list_swap_activities(
            status=status,
            min_updated_timestamp=min_updated_timestamp,
            max_updated_timestamp=max_updated_timestamp,
            initiator=initiator,
            limit=limit,
            before=before,
            after=after,
            sort_by=sort_by,
            direction=direction,
        )
        print("The response of SwapsApi->list_swap_activities:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling SwapsApi->list_swap_activities: %s\n" % e)

Authorizations

BIZ-API-KEY
string
header
required

The API key. For more details, refer to API key.

In the API playground, enter your API secret, and your API key will be accordingly calculated.

Query Parameters

request_id
string

The request ID that is used to track a transaction request. The request ID is provided by you and must be unique within your organization.

type
enum<string>

The type of the swap activity. Possible values include:

  • Bridge: The activity involves bridging tokens across chains.
  • Exchange: The activity involves token-to-token exchange (a swap within the same chain).
Available options:
Bridge,
Exchange
Example:

"Bridge"

status
enum<string>

The status of the swap activity. Possible values include:

  • Success: The activity completed successfully.
  • Processing: The activity is being processed.
  • Failed: The activity failed.
Available options:
Success,
Processing,
Failed
Example:

"Success"

min_updated_timestamp
integer<int64>

The start time of the query. All swap activities updated after the specified time will be retrieved. The time is in Unix timestamp format, measured in milliseconds.

max_updated_timestamp
integer<int64>

The end time of the query. All swap activities updated before the specified time will be retrieved. The time is in Unix timestamp format, measured in milliseconds.

initiator
string

The initiator of the swap activity. It is optional when creating the activity and defaults to your API key if not specified.

limit
integer<int32>
default:10

The maximum number of objects to return. For most operations, the value range is [1, 50].

before
string

A cursor indicating the position before the current page. This value is generated by Cobo and returned in the response. If you are paginating forward from the beginning, you do not need to provide it on the first request. When paginating backward (to the previous page), you should pass the before value returned from the last response.

after
string

A cursor indicating the position after the current page. This value is generated by Cobo and returned in the response. You do not need to provide it on the first request. When paginating forward (to the next page), you should pass the after value returned from the last response.

sort_by
enum<string>

The field to sort the results by.

Possible values include:

  • created_timestamp: Sort by the time when the data was created.
  • updated_timestamp: Sort by the time when the data was last updated.
Available options:
created_timestamp,
updated_timestamp
direction
enum<string>
default:ASC

The sort direction. Possible values include:

  • ASC: Sort the results in ascending order.
  • DESC: Sort the results in descending order.
Available options:
ASC,
DESC

Response

A list of swap activities successfully retrieved.

data
object[]
pagination
object

The pagination information of the returned data.