Skip to main content
GET
/
stakings
/
activities
import cobo_waas2
from cobo_waas2.models.activity_status import ActivityStatus
from cobo_waas2.models.activity_type import ActivityType
from cobo_waas2.models.list_staking_activities200_response import (
    ListStakingActivities200Response,
)
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.StakingsApi(api_client)
    pool_id = "babylon_btc"
    staking_id = "f47ac10b-58cc-4372-a567-0e02b2c3d479"
    activity_type = cobo_waas2.ActivityType()
    activity_status = cobo_waas2.ActivityStatus()
    min_modified_timestamp = 1635744000000
    max_modified_timestamp = 1635744000000
    initiator = "steve@example.com"
    request_id = "web_send_by_user_327_1610444045047"
    limit = 10
    before = "RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGmk1"
    after = "RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGSAk"

    try:
        # List staking activities
        api_response = api_instance.list_staking_activities(
            pool_id=pool_id,
            staking_id=staking_id,
            activity_type=activity_type,
            activity_status=activity_status,
            min_modified_timestamp=min_modified_timestamp,
            max_modified_timestamp=max_modified_timestamp,
            initiator=initiator,
            request_id=request_id,
            limit=limit,
            before=before,
            after=after,
        )
        print("The response of StakingsApi->list_staking_activities:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling StakingsApi->list_staking_activities: %s\n" % e)

{
  "data": [
    {
      "id": "0011039d-27fb-49ba-b172-6e0aa80e37ec",
      "initiator": "steve@example.com",
      "initiator_type": "API",
      "type": "Stake",
      "wallet_id": "0111039d-27fb-49ba-b172-6e0aa80e37ec",
      "address": "0xAbCdE123456789aBcDeF123456789aBcDeF12345",
      "pool_id": "babylon_btc_signet",
      "token_id": "BTC",
      "staking_id": "0011039d-27fb-49ba-b172-6e0aa80e37ec",
      "request_ids": [
        "f47ac10b-58cc-4372-a567-0e02b2c3d479"
      ],
      "amount": "100.00",
      "transaction_ids": [
        "0011039d-27fb-49ba-b172-6e0aa80e37ec"
      ],
      "timeline": [
        {
          "action": "Submitted",
          "status": "success",
          "timestamp": 1640995200000,
          "transaction_id": "aff0e1cb-15b2-4e1f-9b9d-a9133715986f"
        }
      ],
      "fee": {
        "fee_type": "EVM_EIP_1559",
        "token_id": "TRON",
        "max_fee_amount": "0.1"
      },
      "status": "Success",
      "extra": {
        "pool_type": "Babylon",
        "finality_provider_public_key": "eca1b104dce16c30705f4147a9c4a373ac88646c5d1bcda6a89c018940cb96a0",
        "stake_block_time": 2000,
        "auto_broadcast": false
      },
      "created_timestamp": 1640995200000,
      "updated_timestamp": 1640995200000
    }
  ],
  "pagination": {
    "before": "RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGmk1",
    "after": "RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGSAk",
    "total_count": 10000
  }
}
import cobo_waas2
from cobo_waas2.models.activity_status import ActivityStatus
from cobo_waas2.models.activity_type import ActivityType
from cobo_waas2.models.list_staking_activities200_response import (
    ListStakingActivities200Response,
)
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.StakingsApi(api_client)
    pool_id = "babylon_btc"
    staking_id = "f47ac10b-58cc-4372-a567-0e02b2c3d479"
    activity_type = cobo_waas2.ActivityType()
    activity_status = cobo_waas2.ActivityStatus()
    min_modified_timestamp = 1635744000000
    max_modified_timestamp = 1635744000000
    initiator = "steve@example.com"
    request_id = "web_send_by_user_327_1610444045047"
    limit = 10
    before = "RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGmk1"
    after = "RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGSAk"

    try:
        # List staking activities
        api_response = api_instance.list_staking_activities(
            pool_id=pool_id,
            staking_id=staking_id,
            activity_type=activity_type,
            activity_status=activity_status,
            min_modified_timestamp=min_modified_timestamp,
            max_modified_timestamp=max_modified_timestamp,
            initiator=initiator,
            request_id=request_id,
            limit=limit,
            before=before,
            after=after,
        )
        print("The response of StakingsApi->list_staking_activities:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling StakingsApi->list_staking_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

pool_id
string

The ID of the staking pool. A staking pool is a pairing of a staking protocol and a specific type of token. You can call List staking pools to retrieve a list of staking pools.

staking_id
string

The ID of the Phase-1 BTC staking position.

activity_type
enum<string>

The type of the staking activity. Possible values include:

  • Stake: Stake tokens.
  • Unstake: Unstake tokens. Unstaked tokens are still in the staking protocol.
  • Withdraw: Withdraw tokens from the staking protocol to your wallet.
  • Claim: Claim rewards from the staking protocol.
Available options:
Stake,
Unstake,
Withdraw,
Claim
Example:

"Stake"

activity_status
enum<string>

The status of the staking activity. Possible values include:

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

"Success"

min_modified_timestamp
integer

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

max_modified_timestamp
integer

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

initiator
string

The activity initiator, which is your API key by default. You can also specify the initiator when creating the activity.

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.

limit
integer
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.

Response

A list of staking activities have been successfully retrieved.

data
object[]
pagination
object

The pagination information of the returned data.