diff --git a/cdp/address.py b/cdp/address.py index e8a24a9..abe7002 100644 --- a/cdp/address.py +++ b/cdp/address.py @@ -68,7 +68,7 @@ def faucet(self, asset_id=None) -> FaucetTransaction: network_id=self.network_id, address_id=self.address_id, asset_id=asset_id, - skip_wait=True + skip_wait=True, ) return FaucetTransaction(model) diff --git a/cdp/client/__init__.py b/cdp/client/__init__.py index 317f584..b0a5107 100644 --- a/cdp/client/__init__.py +++ b/cdp/client/__init__.py @@ -24,6 +24,7 @@ from cdp.client.api.contract_invocations_api import ContractInvocationsApi from cdp.client.api.external_addresses_api import ExternalAddressesApi from cdp.client.api.fund_api import FundApi +from cdp.client.api.mpc_wallet_stake_api import MPCWalletStakeApi from cdp.client.api.networks_api import NetworksApi from cdp.client.api.onchain_identity_api import OnchainIdentityApi from cdp.client.api.server_signers_api import ServerSignersApi @@ -33,8 +34,6 @@ from cdp.client.api.transaction_history_api import TransactionHistoryApi from cdp.client.api.transfers_api import TransfersApi from cdp.client.api.users_api import UsersApi -from cdp.client.api.validators_api import ValidatorsApi -from cdp.client.api.wallet_stake_api import WalletStakeApi from cdp.client.api.wallets_api import WalletsApi from cdp.client.api.webhooks_api import WebhooksApi diff --git a/cdp/client/api/__init__.py b/cdp/client/api/__init__.py index ce5dea3..f70084c 100644 --- a/cdp/client/api/__init__.py +++ b/cdp/client/api/__init__.py @@ -8,6 +8,7 @@ from cdp.client.api.contract_invocations_api import ContractInvocationsApi from cdp.client.api.external_addresses_api import ExternalAddressesApi from cdp.client.api.fund_api import FundApi +from cdp.client.api.mpc_wallet_stake_api import MPCWalletStakeApi from cdp.client.api.networks_api import NetworksApi from cdp.client.api.onchain_identity_api import OnchainIdentityApi from cdp.client.api.server_signers_api import ServerSignersApi @@ -17,8 +18,6 @@ from cdp.client.api.transaction_history_api import TransactionHistoryApi from cdp.client.api.transfers_api import TransfersApi from cdp.client.api.users_api import UsersApi -from cdp.client.api.validators_api import ValidatorsApi -from cdp.client.api.wallet_stake_api import WalletStakeApi from cdp.client.api.wallets_api import WalletsApi from cdp.client.api.webhooks_api import WebhooksApi diff --git a/cdp/client/api/addresses_api.py b/cdp/client/api/addresses_api.py index dca4fb9..4ec0209 100644 --- a/cdp/client/api/addresses_api.py +++ b/cdp/client/api/addresses_api.py @@ -275,7 +275,9 @@ def _create_address_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -574,7 +576,9 @@ def _create_payload_signature_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -862,7 +866,9 @@ def _get_address_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -1148,7 +1154,9 @@ def _get_address_balance_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -1436,7 +1444,9 @@ def _get_payload_signature_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -1724,7 +1734,9 @@ def _list_address_balances_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -2014,7 +2026,9 @@ def _list_addresses_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -2319,7 +2333,9 @@ def _list_payload_signatures_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -2616,7 +2632,9 @@ def _request_faucet_funds_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters diff --git a/cdp/client/api/assets_api.py b/cdp/client/api/assets_api.py index 874b2dc..8d82e45 100644 --- a/cdp/client/api/assets_api.py +++ b/cdp/client/api/assets_api.py @@ -266,7 +266,9 @@ def _get_asset_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters diff --git a/cdp/client/api/balance_history_api.py b/cdp/client/api/balance_history_api.py index c0eaf82..9bd47f5 100644 --- a/cdp/client/api/balance_history_api.py +++ b/cdp/client/api/balance_history_api.py @@ -306,7 +306,9 @@ def _list_address_historical_balance_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters diff --git a/cdp/client/api/contract_events_api.py b/cdp/client/api/contract_events_api.py index a9b88d4..c425a7b 100644 --- a/cdp/client/api/contract_events_api.py +++ b/cdp/client/api/contract_events_api.py @@ -345,7 +345,9 @@ def _list_contract_events_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters diff --git a/cdp/client/api/contract_invocations_api.py b/cdp/client/api/contract_invocations_api.py index d4330fa..8082d7b 100644 --- a/cdp/client/api/contract_invocations_api.py +++ b/cdp/client/api/contract_invocations_api.py @@ -296,7 +296,9 @@ def _broadcast_contract_invocation_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -599,7 +601,9 @@ def _create_contract_invocation_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -900,7 +904,9 @@ def _get_contract_invocation_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -1201,7 +1207,9 @@ def _list_contract_invocations_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters diff --git a/cdp/client/api/external_addresses_api.py b/cdp/client/api/external_addresses_api.py index 1975530..6fd201f 100644 --- a/cdp/client/api/external_addresses_api.py +++ b/cdp/client/api/external_addresses_api.py @@ -282,7 +282,9 @@ def _get_external_address_balance_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -570,7 +572,9 @@ def _get_faucet_transaction_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -858,7 +862,9 @@ def _list_external_address_balances_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -1161,7 +1167,9 @@ def _request_external_faucet_funds_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters diff --git a/cdp/client/api/fund_api.py b/cdp/client/api/fund_api.py index 1c62f38..9dd56c1 100644 --- a/cdp/client/api/fund_api.py +++ b/cdp/client/api/fund_api.py @@ -284,7 +284,9 @@ def _create_fund_operation_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -585,7 +587,9 @@ def _create_fund_quote_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -886,7 +890,9 @@ def _get_fund_operation_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -1187,7 +1193,9 @@ def _list_fund_operations_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters diff --git a/cdp/client/api/mpc_wallet_stake_api.py b/cdp/client/api/mpc_wallet_stake_api.py new file mode 100644 index 0000000..1d309e2 --- /dev/null +++ b/cdp/client/api/mpc_wallet_stake_api.py @@ -0,0 +1,951 @@ +# coding: utf-8 + +""" + Coinbase Platform API + + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. + + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictStr +from typing_extensions import Annotated +from cdp.client.models.broadcast_staking_operation_request import BroadcastStakingOperationRequest +from cdp.client.models.create_staking_operation_request import CreateStakingOperationRequest +from cdp.client.models.staking_operation import StakingOperation + +from cdp.client.api_client import ApiClient, RequestSerialized +from cdp.client.api_response import ApiResponse +from cdp.client.rest import RESTResponseType + + +class MPCWalletStakeApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + def broadcast_staking_operation( + self, + wallet_id: Annotated[StrictStr, Field(description="The ID of the wallet the address belongs to.")], + address_id: Annotated[StrictStr, Field(description="The ID of the address the staking operation belongs to.")], + staking_operation_id: Annotated[StrictStr, Field(description="The ID of the staking operation to broadcast.")], + broadcast_staking_operation_request: BroadcastStakingOperationRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> StakingOperation: + """Broadcast a staking operation + + Broadcast a staking operation. + + :param wallet_id: The ID of the wallet the address belongs to. (required) + :type wallet_id: str + :param address_id: The ID of the address the staking operation belongs to. (required) + :type address_id: str + :param staking_operation_id: The ID of the staking operation to broadcast. (required) + :type staking_operation_id: str + :param broadcast_staking_operation_request: (required) + :type broadcast_staking_operation_request: BroadcastStakingOperationRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._broadcast_staking_operation_serialize( + wallet_id=wallet_id, + address_id=address_id, + staking_operation_id=staking_operation_id, + broadcast_staking_operation_request=broadcast_staking_operation_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "StakingOperation", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def broadcast_staking_operation_with_http_info( + self, + wallet_id: Annotated[StrictStr, Field(description="The ID of the wallet the address belongs to.")], + address_id: Annotated[StrictStr, Field(description="The ID of the address the staking operation belongs to.")], + staking_operation_id: Annotated[StrictStr, Field(description="The ID of the staking operation to broadcast.")], + broadcast_staking_operation_request: BroadcastStakingOperationRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[StakingOperation]: + """Broadcast a staking operation + + Broadcast a staking operation. + + :param wallet_id: The ID of the wallet the address belongs to. (required) + :type wallet_id: str + :param address_id: The ID of the address the staking operation belongs to. (required) + :type address_id: str + :param staking_operation_id: The ID of the staking operation to broadcast. (required) + :type staking_operation_id: str + :param broadcast_staking_operation_request: (required) + :type broadcast_staking_operation_request: BroadcastStakingOperationRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._broadcast_staking_operation_serialize( + wallet_id=wallet_id, + address_id=address_id, + staking_operation_id=staking_operation_id, + broadcast_staking_operation_request=broadcast_staking_operation_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "StakingOperation", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def broadcast_staking_operation_without_preload_content( + self, + wallet_id: Annotated[StrictStr, Field(description="The ID of the wallet the address belongs to.")], + address_id: Annotated[StrictStr, Field(description="The ID of the address the staking operation belongs to.")], + staking_operation_id: Annotated[StrictStr, Field(description="The ID of the staking operation to broadcast.")], + broadcast_staking_operation_request: BroadcastStakingOperationRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Broadcast a staking operation + + Broadcast a staking operation. + + :param wallet_id: The ID of the wallet the address belongs to. (required) + :type wallet_id: str + :param address_id: The ID of the address the staking operation belongs to. (required) + :type address_id: str + :param staking_operation_id: The ID of the staking operation to broadcast. (required) + :type staking_operation_id: str + :param broadcast_staking_operation_request: (required) + :type broadcast_staking_operation_request: BroadcastStakingOperationRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._broadcast_staking_operation_serialize( + wallet_id=wallet_id, + address_id=address_id, + staking_operation_id=staking_operation_id, + broadcast_staking_operation_request=broadcast_staking_operation_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "StakingOperation", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _broadcast_staking_operation_serialize( + self, + wallet_id, + address_id, + staking_operation_id, + broadcast_staking_operation_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if wallet_id is not None: + _path_params['wallet_id'] = wallet_id + if address_id is not None: + _path_params['address_id'] = address_id + if staking_operation_id is not None: + _path_params['staking_operation_id'] = staking_operation_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if broadcast_staking_operation_request is not None: + _body_params = broadcast_staking_operation_request + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/wallets/{wallet_id}/addresses/{address_id}/staking_operations/{staking_operation_id}/broadcast', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def create_staking_operation( + self, + wallet_id: Annotated[StrictStr, Field(description="The ID of the wallet the address belongs to.")], + address_id: Annotated[StrictStr, Field(description="The ID of the address to create the staking operation for.")], + create_staking_operation_request: CreateStakingOperationRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> StakingOperation: + """Create a new staking operation for an address + + Create a new staking operation. + + :param wallet_id: The ID of the wallet the address belongs to. (required) + :type wallet_id: str + :param address_id: The ID of the address to create the staking operation for. (required) + :type address_id: str + :param create_staking_operation_request: (required) + :type create_staking_operation_request: CreateStakingOperationRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_staking_operation_serialize( + wallet_id=wallet_id, + address_id=address_id, + create_staking_operation_request=create_staking_operation_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "StakingOperation", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_staking_operation_with_http_info( + self, + wallet_id: Annotated[StrictStr, Field(description="The ID of the wallet the address belongs to.")], + address_id: Annotated[StrictStr, Field(description="The ID of the address to create the staking operation for.")], + create_staking_operation_request: CreateStakingOperationRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[StakingOperation]: + """Create a new staking operation for an address + + Create a new staking operation. + + :param wallet_id: The ID of the wallet the address belongs to. (required) + :type wallet_id: str + :param address_id: The ID of the address to create the staking operation for. (required) + :type address_id: str + :param create_staking_operation_request: (required) + :type create_staking_operation_request: CreateStakingOperationRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_staking_operation_serialize( + wallet_id=wallet_id, + address_id=address_id, + create_staking_operation_request=create_staking_operation_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "StakingOperation", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def create_staking_operation_without_preload_content( + self, + wallet_id: Annotated[StrictStr, Field(description="The ID of the wallet the address belongs to.")], + address_id: Annotated[StrictStr, Field(description="The ID of the address to create the staking operation for.")], + create_staking_operation_request: CreateStakingOperationRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create a new staking operation for an address + + Create a new staking operation. + + :param wallet_id: The ID of the wallet the address belongs to. (required) + :type wallet_id: str + :param address_id: The ID of the address to create the staking operation for. (required) + :type address_id: str + :param create_staking_operation_request: (required) + :type create_staking_operation_request: CreateStakingOperationRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_staking_operation_serialize( + wallet_id=wallet_id, + address_id=address_id, + create_staking_operation_request=create_staking_operation_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "StakingOperation", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_staking_operation_serialize( + self, + wallet_id, + address_id, + create_staking_operation_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if wallet_id is not None: + _path_params['wallet_id'] = wallet_id + if address_id is not None: + _path_params['address_id'] = address_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if create_staking_operation_request is not None: + _body_params = create_staking_operation_request + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/wallets/{wallet_id}/addresses/{address_id}/staking_operations', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_staking_operation( + self, + wallet_id: Annotated[StrictStr, Field(description="The ID of the wallet the address belongs to")], + address_id: Annotated[StrictStr, Field(description="The ID of the address to fetch the staking operation for.")], + staking_operation_id: Annotated[StrictStr, Field(description="The ID of the staking operation.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> StakingOperation: + """Get the latest state of a staking operation + + Get the latest state of a staking operation. + + :param wallet_id: The ID of the wallet the address belongs to (required) + :type wallet_id: str + :param address_id: The ID of the address to fetch the staking operation for. (required) + :type address_id: str + :param staking_operation_id: The ID of the staking operation. (required) + :type staking_operation_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_staking_operation_serialize( + wallet_id=wallet_id, + address_id=address_id, + staking_operation_id=staking_operation_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "StakingOperation", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_staking_operation_with_http_info( + self, + wallet_id: Annotated[StrictStr, Field(description="The ID of the wallet the address belongs to")], + address_id: Annotated[StrictStr, Field(description="The ID of the address to fetch the staking operation for.")], + staking_operation_id: Annotated[StrictStr, Field(description="The ID of the staking operation.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[StakingOperation]: + """Get the latest state of a staking operation + + Get the latest state of a staking operation. + + :param wallet_id: The ID of the wallet the address belongs to (required) + :type wallet_id: str + :param address_id: The ID of the address to fetch the staking operation for. (required) + :type address_id: str + :param staking_operation_id: The ID of the staking operation. (required) + :type staking_operation_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_staking_operation_serialize( + wallet_id=wallet_id, + address_id=address_id, + staking_operation_id=staking_operation_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "StakingOperation", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_staking_operation_without_preload_content( + self, + wallet_id: Annotated[StrictStr, Field(description="The ID of the wallet the address belongs to")], + address_id: Annotated[StrictStr, Field(description="The ID of the address to fetch the staking operation for.")], + staking_operation_id: Annotated[StrictStr, Field(description="The ID of the staking operation.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get the latest state of a staking operation + + Get the latest state of a staking operation. + + :param wallet_id: The ID of the wallet the address belongs to (required) + :type wallet_id: str + :param address_id: The ID of the address to fetch the staking operation for. (required) + :type address_id: str + :param staking_operation_id: The ID of the staking operation. (required) + :type staking_operation_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_staking_operation_serialize( + wallet_id=wallet_id, + address_id=address_id, + staking_operation_id=staking_operation_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "StakingOperation", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_staking_operation_serialize( + self, + wallet_id, + address_id, + staking_operation_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if wallet_id is not None: + _path_params['wallet_id'] = wallet_id + if address_id is not None: + _path_params['address_id'] = address_id + if staking_operation_id is not None: + _path_params['staking_operation_id'] = staking_operation_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/wallets/{wallet_id}/addresses/{address_id}/staking_operations/{staking_operation_id}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/cdp/client/api/networks_api.py b/cdp/client/api/networks_api.py index 954fc20..de7dd00 100644 --- a/cdp/client/api/networks_api.py +++ b/cdp/client/api/networks_api.py @@ -253,7 +253,9 @@ def _get_network_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters diff --git a/cdp/client/api/onchain_identity_api.py b/cdp/client/api/onchain_identity_api.py index 757d351..e09fdf8 100644 --- a/cdp/client/api/onchain_identity_api.py +++ b/cdp/client/api/onchain_identity_api.py @@ -307,7 +307,9 @@ def _resolve_identity_by_address_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters diff --git a/cdp/client/api/server_signers_api.py b/cdp/client/api/server_signers_api.py index 7c570c2..84e3e82 100644 --- a/cdp/client/api/server_signers_api.py +++ b/cdp/client/api/server_signers_api.py @@ -259,7 +259,9 @@ def _create_server_signer_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -530,7 +532,9 @@ def _get_server_signer_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -817,7 +821,9 @@ def _list_server_signer_events_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -1096,7 +1102,9 @@ def _list_server_signers_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -1373,7 +1381,9 @@ def _submit_server_signer_seed_event_result_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -1659,7 +1669,9 @@ def _submit_server_signer_signature_event_result_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters diff --git a/cdp/client/api/smart_contracts_api.py b/cdp/client/api/smart_contracts_api.py index db0c90f..6d59210 100644 --- a/cdp/client/api/smart_contracts_api.py +++ b/cdp/client/api/smart_contracts_api.py @@ -284,7 +284,9 @@ def _create_smart_contract_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -598,7 +600,9 @@ def _deploy_smart_contract_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -901,7 +905,9 @@ def _get_smart_contract_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -1176,7 +1182,9 @@ def _list_smart_contracts_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -1462,7 +1470,9 @@ def _read_contract_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters diff --git a/cdp/client/api/stake_api.py b/cdp/client/api/stake_api.py index ff3f4f8..f2790f3 100644 --- a/cdp/client/api/stake_api.py +++ b/cdp/client/api/stake_api.py @@ -27,6 +27,9 @@ from cdp.client.models.get_staking_context_request import GetStakingContextRequest from cdp.client.models.staking_context import StakingContext from cdp.client.models.staking_operation import StakingOperation +from cdp.client.models.validator import Validator +from cdp.client.models.validator_list import ValidatorList +from cdp.client.models.validator_status import ValidatorStatus from cdp.client.api_client import ApiClient, RequestSerialized from cdp.client.api_response import ApiResponse @@ -261,7 +264,9 @@ def _build_staking_operation_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -610,7 +615,9 @@ def _fetch_historical_staking_balances_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -934,7 +941,9 @@ def _fetch_staking_rewards_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -1239,7 +1248,9 @@ def _get_external_staking_operation_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -1501,7 +1512,9 @@ def _get_staking_context_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -1555,3 +1568,619 @@ def _get_staking_context_serialize( ) + + + @validate_call + def get_validator( + self, + network_id: Annotated[StrictStr, Field(description="The ID of the blockchain network.")], + asset_id: Annotated[StrictStr, Field(description="The symbol of the asset to get the validator for.")], + validator_id: Annotated[StrictStr, Field(description="The unique id of the validator to fetch details for.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Validator: + """Get a validator belonging to the CDP project + + Get a validator belonging to the user for a given network, asset and id. + + :param network_id: The ID of the blockchain network. (required) + :type network_id: str + :param asset_id: The symbol of the asset to get the validator for. (required) + :type asset_id: str + :param validator_id: The unique id of the validator to fetch details for. (required) + :type validator_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_validator_serialize( + network_id=network_id, + asset_id=asset_id, + validator_id=validator_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Validator", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_validator_with_http_info( + self, + network_id: Annotated[StrictStr, Field(description="The ID of the blockchain network.")], + asset_id: Annotated[StrictStr, Field(description="The symbol of the asset to get the validator for.")], + validator_id: Annotated[StrictStr, Field(description="The unique id of the validator to fetch details for.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Validator]: + """Get a validator belonging to the CDP project + + Get a validator belonging to the user for a given network, asset and id. + + :param network_id: The ID of the blockchain network. (required) + :type network_id: str + :param asset_id: The symbol of the asset to get the validator for. (required) + :type asset_id: str + :param validator_id: The unique id of the validator to fetch details for. (required) + :type validator_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_validator_serialize( + network_id=network_id, + asset_id=asset_id, + validator_id=validator_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Validator", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_validator_without_preload_content( + self, + network_id: Annotated[StrictStr, Field(description="The ID of the blockchain network.")], + asset_id: Annotated[StrictStr, Field(description="The symbol of the asset to get the validator for.")], + validator_id: Annotated[StrictStr, Field(description="The unique id of the validator to fetch details for.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get a validator belonging to the CDP project + + Get a validator belonging to the user for a given network, asset and id. + + :param network_id: The ID of the blockchain network. (required) + :type network_id: str + :param asset_id: The symbol of the asset to get the validator for. (required) + :type asset_id: str + :param validator_id: The unique id of the validator to fetch details for. (required) + :type validator_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_validator_serialize( + network_id=network_id, + asset_id=asset_id, + validator_id=validator_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Validator", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_validator_serialize( + self, + network_id, + asset_id, + validator_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if network_id is not None: + _path_params['network_id'] = network_id + if asset_id is not None: + _path_params['asset_id'] = asset_id + if validator_id is not None: + _path_params['validator_id'] = validator_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/networks/{network_id}/assets/{asset_id}/validators/{validator_id}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def list_validators( + self, + network_id: Annotated[StrictStr, Field(description="The ID of the blockchain network.")], + asset_id: Annotated[StrictStr, Field(description="The symbol of the asset to get the validators for.")], + status: Annotated[Optional[ValidatorStatus], Field(description="A filter to list validators based on a status.")] = None, + limit: Annotated[Optional[StrictInt], Field(description="A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 50.")] = None, + page: Annotated[Optional[Annotated[str, Field(strict=True, max_length=5000)]], Field(description="A cursor for pagination across multiple pages of results. Don't include this parameter on the first call. Use the next_page value returned in a previous response to request subsequent results.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ValidatorList: + """List validators belonging to the CDP project + + List validators belonging to the user for a given network and asset. + + :param network_id: The ID of the blockchain network. (required) + :type network_id: str + :param asset_id: The symbol of the asset to get the validators for. (required) + :type asset_id: str + :param status: A filter to list validators based on a status. + :type status: ValidatorStatus + :param limit: A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 50. + :type limit: int + :param page: A cursor for pagination across multiple pages of results. Don't include this parameter on the first call. Use the next_page value returned in a previous response to request subsequent results. + :type page: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_validators_serialize( + network_id=network_id, + asset_id=asset_id, + status=status, + limit=limit, + page=page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ValidatorList", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def list_validators_with_http_info( + self, + network_id: Annotated[StrictStr, Field(description="The ID of the blockchain network.")], + asset_id: Annotated[StrictStr, Field(description="The symbol of the asset to get the validators for.")], + status: Annotated[Optional[ValidatorStatus], Field(description="A filter to list validators based on a status.")] = None, + limit: Annotated[Optional[StrictInt], Field(description="A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 50.")] = None, + page: Annotated[Optional[Annotated[str, Field(strict=True, max_length=5000)]], Field(description="A cursor for pagination across multiple pages of results. Don't include this parameter on the first call. Use the next_page value returned in a previous response to request subsequent results.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ValidatorList]: + """List validators belonging to the CDP project + + List validators belonging to the user for a given network and asset. + + :param network_id: The ID of the blockchain network. (required) + :type network_id: str + :param asset_id: The symbol of the asset to get the validators for. (required) + :type asset_id: str + :param status: A filter to list validators based on a status. + :type status: ValidatorStatus + :param limit: A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 50. + :type limit: int + :param page: A cursor for pagination across multiple pages of results. Don't include this parameter on the first call. Use the next_page value returned in a previous response to request subsequent results. + :type page: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_validators_serialize( + network_id=network_id, + asset_id=asset_id, + status=status, + limit=limit, + page=page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ValidatorList", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def list_validators_without_preload_content( + self, + network_id: Annotated[StrictStr, Field(description="The ID of the blockchain network.")], + asset_id: Annotated[StrictStr, Field(description="The symbol of the asset to get the validators for.")], + status: Annotated[Optional[ValidatorStatus], Field(description="A filter to list validators based on a status.")] = None, + limit: Annotated[Optional[StrictInt], Field(description="A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 50.")] = None, + page: Annotated[Optional[Annotated[str, Field(strict=True, max_length=5000)]], Field(description="A cursor for pagination across multiple pages of results. Don't include this parameter on the first call. Use the next_page value returned in a previous response to request subsequent results.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List validators belonging to the CDP project + + List validators belonging to the user for a given network and asset. + + :param network_id: The ID of the blockchain network. (required) + :type network_id: str + :param asset_id: The symbol of the asset to get the validators for. (required) + :type asset_id: str + :param status: A filter to list validators based on a status. + :type status: ValidatorStatus + :param limit: A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 50. + :type limit: int + :param page: A cursor for pagination across multiple pages of results. Don't include this parameter on the first call. Use the next_page value returned in a previous response to request subsequent results. + :type page: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_validators_serialize( + network_id=network_id, + asset_id=asset_id, + status=status, + limit=limit, + page=page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ValidatorList", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_validators_serialize( + self, + network_id, + asset_id, + status, + limit, + page, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if network_id is not None: + _path_params['network_id'] = network_id + if asset_id is not None: + _path_params['asset_id'] = asset_id + # process the query parameters + if status is not None: + + _query_params.append(('status', status.value)) + + if limit is not None: + + _query_params.append(('limit', limit)) + + if page is not None: + + _query_params.append(('page', page)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/networks/{network_id}/assets/{asset_id}/validators', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/cdp/client/api/trades_api.py b/cdp/client/api/trades_api.py index fd58ed4..1e010cb 100644 --- a/cdp/client/api/trades_api.py +++ b/cdp/client/api/trades_api.py @@ -296,7 +296,9 @@ def _broadcast_trade_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -599,7 +601,9 @@ def _create_trade_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -900,7 +904,9 @@ def _get_trade_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -1201,7 +1207,9 @@ def _list_trades_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters diff --git a/cdp/client/api/transaction_history_api.py b/cdp/client/api/transaction_history_api.py index 785824a..02b6ea7 100644 --- a/cdp/client/api/transaction_history_api.py +++ b/cdp/client/api/transaction_history_api.py @@ -293,7 +293,9 @@ def _list_address_transactions_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters diff --git a/cdp/client/api/transfers_api.py b/cdp/client/api/transfers_api.py index 0ed5523..a7be92c 100644 --- a/cdp/client/api/transfers_api.py +++ b/cdp/client/api/transfers_api.py @@ -296,7 +296,9 @@ def _broadcast_transfer_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -599,7 +601,9 @@ def _create_transfer_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -900,7 +904,9 @@ def _get_transfer_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -1201,7 +1207,9 @@ def _list_transfers_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters diff --git a/cdp/client/api/users_api.py b/cdp/client/api/users_api.py index 8afc9b9..0d59f56 100644 --- a/cdp/client/api/users_api.py +++ b/cdp/client/api/users_api.py @@ -238,7 +238,9 @@ def _get_current_user_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters diff --git a/cdp/client/api/wallets_api.py b/cdp/client/api/wallets_api.py index 86cd94b..66eaa59 100644 --- a/cdp/client/api/wallets_api.py +++ b/cdp/client/api/wallets_api.py @@ -258,7 +258,9 @@ def _create_wallet_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -529,7 +531,9 @@ def _get_wallet_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -800,7 +804,9 @@ def _get_wallet_balance_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -1060,7 +1066,9 @@ def _list_wallet_balances_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -1331,7 +1339,9 @@ def _list_wallets_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters diff --git a/cdp/client/api/webhooks_api.py b/cdp/client/api/webhooks_api.py index 7e0f4c7..ba2844a 100644 --- a/cdp/client/api/webhooks_api.py +++ b/cdp/client/api/webhooks_api.py @@ -271,7 +271,9 @@ def _create_wallet_webhook_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -544,7 +546,9 @@ def _create_webhook_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -815,7 +819,9 @@ def _delete_webhook_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -1086,7 +1092,9 @@ def _list_webhooks_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -1363,7 +1371,9 @@ def _update_webhook_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters diff --git a/cdp/client/api_client.py b/cdp/client/api_client.py index 52369de..82d3c54 100644 --- a/cdp/client/api_client.py +++ b/cdp/client/api_client.py @@ -404,12 +404,12 @@ def deserialize(self, response_text: str, response_type: str, content_type: Opti data = json.loads(response_text) except ValueError: data = response_text - elif content_type.startswith("application/json"): + elif re.match(r'^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)', content_type, re.IGNORECASE): if response_text == "": data = "" else: data = json.loads(response_text) - elif content_type.startswith("text/plain"): + elif re.match(r'^text\/[a-z.+-]+\s*(;|$)', content_type, re.IGNORECASE): data = response_text else: raise ApiException( @@ -535,7 +535,10 @@ def parameters_to_url_query(self, params, collection_formats): return "&".join(["=".join(map(str, item)) for item in new_params]) - def files_parameters(self, files: Dict[str, Union[str, bytes]]): + def files_parameters( + self, + files: Dict[str, Union[str, bytes, List[str], List[bytes], Tuple[str, bytes]]], + ): """Builds form parameters. :param files: File parameters. @@ -550,6 +553,12 @@ def files_parameters(self, files: Dict[str, Union[str, bytes]]): elif isinstance(v, bytes): filename = k filedata = v + elif isinstance(v, tuple): + filename, filedata = v + elif isinstance(v, list): + for file_param in v: + params.extend(self.files_parameters({k: file_param})) + continue else: raise ValueError("Unsupported file value") mimetype = ( diff --git a/cdp/client/models/build_staking_operation_request.py b/cdp/client/models/build_staking_operation_request.py index 7238168..b36fbb5 100644 --- a/cdp/client/models/build_staking_operation_request.py +++ b/cdp/client/models/build_staking_operation_request.py @@ -30,7 +30,7 @@ class BuildStakingOperationRequest(BaseModel): asset_id: StrictStr = Field(description="The ID of the asset being staked") address_id: StrictStr = Field(description="The onchain address from which the staking transaction originates and is responsible for signing the transaction.") action: StrictStr = Field(description="The type of staking operation") - options: Dict[str, StrictStr] + options: Dict[str, StrictStr] = Field(description="Additional options for the staking operation.") __properties: ClassVar[List[str]] = ["network_id", "asset_id", "address_id", "action", "options"] model_config = ConfigDict( diff --git a/cdp/client/models/create_staking_operation_request.py b/cdp/client/models/create_staking_operation_request.py index 677206b..a89b998 100644 --- a/cdp/client/models/create_staking_operation_request.py +++ b/cdp/client/models/create_staking_operation_request.py @@ -29,7 +29,7 @@ class CreateStakingOperationRequest(BaseModel): network_id: StrictStr = Field(description="The ID of the blockchain network.") asset_id: StrictStr = Field(description="The ID of the asset being staked.") action: StrictStr = Field(description="The type of staking operation.") - options: Dict[str, StrictStr] + options: Dict[str, StrictStr] = Field(description="Additional options for the staking operation.") __properties: ClassVar[List[str]] = ["network_id", "asset_id", "action", "options"] model_config = ConfigDict( diff --git a/cdp/client/models/get_staking_context_request.py b/cdp/client/models/get_staking_context_request.py index c2918e6..d755995 100644 --- a/cdp/client/models/get_staking_context_request.py +++ b/cdp/client/models/get_staking_context_request.py @@ -29,7 +29,7 @@ class GetStakingContextRequest(BaseModel): network_id: StrictStr = Field(description="The ID of the blockchain network") asset_id: StrictStr = Field(description="The ID of the asset being staked") address_id: StrictStr = Field(description="The onchain address for which the staking context is being fetched") - options: Dict[str, StrictStr] + options: Dict[str, StrictStr] = Field(description="Additional options for getting the staking context. This typically includes network specific fields.") __properties: ClassVar[List[str]] = ["network_id", "asset_id", "address_id", "options"] model_config = ConfigDict( diff --git a/cdp/client/models/solidity_value.py b/cdp/client/models/solidity_value.py index 0efcf21..54e4ea9 100644 --- a/cdp/client/models/solidity_value.py +++ b/cdp/client/models/solidity_value.py @@ -35,8 +35,8 @@ class SolidityValue(BaseModel): @field_validator('type') def type_validate_enum(cls, value): """Validates the enum""" - if value not in set(['uint8', 'uint16', 'uint32', 'uint64', 'uint128', 'uint256', 'int8', 'int16', 'int32', 'int64', 'int128', 'int256', 'address', 'bool', 'string', 'bytes', 'bytes1', 'bytes2', 'bytes3', 'bytes4', 'bytes5', 'bytes6', 'bytes7', 'bytes8', 'bytes9', 'bytes10', 'bytes11', 'bytes12', 'bytes13', 'bytes14', 'bytes15', 'bytes16', 'bytes17', 'bytes18', 'bytes19', 'bytes20', 'bytes21', 'bytes22', 'bytes23', 'bytes24', 'bytes25', 'bytes26', 'bytes27', 'bytes28', 'bytes29', 'bytes30', 'bytes31', 'bytes32', 'array', 'tuple']): - raise ValueError("must be one of enum values ('uint8', 'uint16', 'uint32', 'uint64', 'uint128', 'uint256', 'int8', 'int16', 'int32', 'int64', 'int128', 'int256', 'address', 'bool', 'string', 'bytes', 'bytes1', 'bytes2', 'bytes3', 'bytes4', 'bytes5', 'bytes6', 'bytes7', 'bytes8', 'bytes9', 'bytes10', 'bytes11', 'bytes12', 'bytes13', 'bytes14', 'bytes15', 'bytes16', 'bytes17', 'bytes18', 'bytes19', 'bytes20', 'bytes21', 'bytes22', 'bytes23', 'bytes24', 'bytes25', 'bytes26', 'bytes27', 'bytes28', 'bytes29', 'bytes30', 'bytes31', 'bytes32', 'array', 'tuple')") + if value not in set(['uint8', 'uint16', 'uint32', 'uint64', 'uint128', 'uint160', 'uint256', 'int8', 'int16', 'int24', 'int32', 'int56', 'int64', 'int128', 'int256', 'address', 'bool', 'string', 'bytes', 'bytes1', 'bytes2', 'bytes3', 'bytes4', 'bytes5', 'bytes6', 'bytes7', 'bytes8', 'bytes9', 'bytes10', 'bytes11', 'bytes12', 'bytes13', 'bytes14', 'bytes15', 'bytes16', 'bytes17', 'bytes18', 'bytes19', 'bytes20', 'bytes21', 'bytes22', 'bytes23', 'bytes24', 'bytes25', 'bytes26', 'bytes27', 'bytes28', 'bytes29', 'bytes30', 'bytes31', 'bytes32', 'array', 'tuple']): + raise ValueError("must be one of enum values ('uint8', 'uint16', 'uint32', 'uint64', 'uint128', 'uint160', 'uint256', 'int8', 'int16', 'int24', 'int32', 'int56', 'int64', 'int128', 'int256', 'address', 'bool', 'string', 'bytes', 'bytes1', 'bytes2', 'bytes3', 'bytes4', 'bytes5', 'bytes6', 'bytes7', 'bytes8', 'bytes9', 'bytes10', 'bytes11', 'bytes12', 'bytes13', 'bytes14', 'bytes15', 'bytes16', 'bytes17', 'bytes18', 'bytes19', 'bytes20', 'bytes21', 'bytes22', 'bytes23', 'bytes24', 'bytes25', 'bytes26', 'bytes27', 'bytes28', 'bytes29', 'bytes30', 'bytes31', 'bytes32', 'array', 'tuple')") return value model_config = ConfigDict( diff --git a/cdp/client/rest.py b/cdp/client/rest.py index 78c1966..77874d5 100644 --- a/cdp/client/rest.py +++ b/cdp/client/rest.py @@ -225,7 +225,7 @@ def request( headers=headers, preload_content=False ) - elif headers['Content-Type'] == 'text/plain' and isinstance(body, bool): + elif headers['Content-Type'].startswith('text/') and isinstance(body, bool): request_body = "true" if body else "false" r = self.pool_manager.request( method, diff --git a/cdp/faucet_transaction.py b/cdp/faucet_transaction.py index c93e1fa..d4a9e57 100644 --- a/cdp/faucet_transaction.py +++ b/cdp/faucet_transaction.py @@ -79,7 +79,9 @@ def status(self) -> str: """ return self.transaction.status - def wait(self, interval_seconds: float = 0.2, timeout_seconds: float = 20) -> "FaucetTransaction": + def wait( + self, interval_seconds: float = 0.2, timeout_seconds: float = 20 + ) -> "FaucetTransaction": """Wait for the faucet transaction to complete. Args: @@ -102,7 +104,6 @@ def wait(self, interval_seconds: float = 0.2, timeout_seconds: float = 20) -> "F return self - def reload(self) -> "FaucetTransaction": """Reload the faucet transaction. @@ -111,9 +112,7 @@ def reload(self) -> "FaucetTransaction": """ model = Cdp.api_clients.external_addresses.get_faucet_transaction( - self.network_id, - self.address_id, - self.transaction_hash + self.network_id, self.address_id, self.transaction_hash ) self._model = model diff --git a/cdp/smart_contract.py b/cdp/smart_contract.py index 58b6e96..a1b919c 100644 --- a/cdp/smart_contract.py +++ b/cdp/smart_contract.py @@ -385,10 +385,13 @@ def _convert_solidity_value(cls, solidity_value: SolidityValue) -> Any: "uint32", "uint64", "uint128", + "uint160", "uint256", "int8", "int16", + "int24", "int32", + "int56", "int64", "int128", "int256", diff --git a/tests/factories/smart_contract_factory.py b/tests/factories/smart_contract_factory.py index 99bc4da..e8d16d4 100644 --- a/tests/factories/smart_contract_factory.py +++ b/tests/factories/smart_contract_factory.py @@ -141,6 +141,19 @@ def all_read_types_abi(): ], "stateMutability": "pure", }, + { + "type": "function", + "name": "pureInt24", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "int24", + "internalType": "int24", + }, + ], + "stateMutability": "pure", + }, { "type": "function", "name": "pureInt256", @@ -167,6 +180,19 @@ def all_read_types_abi(): ], "stateMutability": "pure", }, + { + "type": "function", + "name": "pureInt56", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "int56", + "internalType": "int56", + }, + ], + "stateMutability": "pure", + }, { "type": "function", "name": "pureInt64", @@ -304,6 +330,19 @@ def all_read_types_abi(): ], "stateMutability": "pure", }, + { + "type": "function", + "name": "pureUint160", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint160", + "internalType": "uint160", + }, + ], + "stateMutability": "pure", + }, { "type": "function", "name": "pureUint16", diff --git a/tests/test_address.py b/tests/test_address.py index a6241f8..4c255cd 100644 --- a/tests/test_address.py +++ b/tests/test_address.py @@ -41,15 +41,14 @@ def test_address_faucet(mock_api_clients, address_factory, faucet_transaction_mo assert isinstance(faucet_tx, FaucetTransaction) mock_request_faucet.assert_called_once_with( - network_id=address.network_id, - address_id=address.address_id, - asset_id=None, - skip_wait=True + network_id=address.network_id, address_id=address.address_id, asset_id=None, skip_wait=True ) @patch("cdp.Cdp.api_clients") -def test_address_faucet_with_asset_id(mock_api_clients, address_factory, faucet_transaction_model_factory): +def test_address_faucet_with_asset_id( + mock_api_clients, address_factory, faucet_transaction_model_factory +): """Test the faucet method of an Address with an asset_id.""" address = address_factory() @@ -64,7 +63,7 @@ def test_address_faucet_with_asset_id(mock_api_clients, address_factory, faucet_ network_id=address.network_id, address_id=address.address_id, asset_id="usdc", - skip_wait=True + skip_wait=True, ) diff --git a/tests/test_faucet_transaction.py b/tests/test_faucet_transaction.py index 4cab5d7..b8afdb8 100644 --- a/tests/test_faucet_transaction.py +++ b/tests/test_faucet_transaction.py @@ -11,11 +11,14 @@ def test_faucet_tx_initialization(faucet_transaction_factory): assert isinstance(faucet_transaction, FaucetTransaction) assert faucet_transaction.transaction_hash == "0xtransactionhash" - assert faucet_transaction.transaction_link == "https://sepolia.basescan.org/tx/0xtransactionlink" + assert ( + faucet_transaction.transaction_link == "https://sepolia.basescan.org/tx/0xtransactionlink" + ) assert faucet_transaction.network_id == "base-sepolia" assert faucet_transaction.address_id == "0xdestination" assert faucet_transaction.status.value == "complete" + @patch("cdp.Cdp.api_clients") def test_reload_faucet_tx(mock_api_clients, faucet_transaction_factory): """Test the reloading of a FaucetTransaction object.""" @@ -29,11 +32,7 @@ def test_reload_faucet_tx(mock_api_clients, faucet_transaction_factory): reloaded_faucet_tx = faucet_tx.reload() - mock_get_faucet_tx.assert_called_once_with( - "base-sepolia", - "0xdestination", - "0xtransactionhash" - ) + mock_get_faucet_tx.assert_called_once_with("base-sepolia", "0xdestination", "0xtransactionhash") assert faucet_tx.status.value == "complete" assert reloaded_faucet_tx.status.value == "complete" @@ -42,10 +41,7 @@ def test_reload_faucet_tx(mock_api_clients, faucet_transaction_factory): @patch("cdp.faucet_transaction.time.sleep") @patch("cdp.faucet_transaction.time.time") def test_wait_for_faucet_transaction( - mock_time, - mock_sleep, - mock_api_clients, - faucet_transaction_factory + mock_time, mock_sleep, mock_api_clients, faucet_transaction_factory ): """Test the waiting for a FaucetTransaction object to complete.""" faucet_tx = faucet_transaction_factory(status="broadcast") @@ -63,11 +59,7 @@ def test_wait_for_faucet_transaction( assert result.status.value == "complete" - mock_get_faucet_tx.assert_called_with( - "base-sepolia", - "0xdestination", - "0xtransactionhash" - ) + mock_get_faucet_tx.assert_called_with("base-sepolia", "0xdestination", "0xtransactionhash") assert mock_get_faucet_tx.call_count == 2 mock_sleep.assert_has_calls([call(0.2)] * 2) assert mock_time.call_count == 3 @@ -77,10 +69,7 @@ def test_wait_for_faucet_transaction( @patch("cdp.faucet_transaction.time.sleep") @patch("cdp.faucet_transaction.time.time") def test_wait_for_faucet_transaction_timeout( - mock_time, - mock_sleep, - mock_api_clients, - faucet_transaction_factory + mock_time, mock_sleep, mock_api_clients, faucet_transaction_factory ): """Test the waiting for a FaucetTransaction object to complete with a timeout.""" faucet_tx = faucet_transaction_factory(status="broadcast") @@ -91,16 +80,13 @@ def test_wait_for_faucet_transaction_timeout( mock_time.side_effect = [0, 0.5, 1.0, 1.5, 2.0, 2.5] - with pytest.raises(TimeoutError, match="Timed out waiting for FaucetTransaction to land onchain"): + with pytest.raises( + TimeoutError, match="Timed out waiting for FaucetTransaction to land onchain" + ): faucet_tx.wait(interval_seconds=0.5, timeout_seconds=2) - mock_get_faucet_tx.assert_called_with( - "base-sepolia", - "0xdestination", - "0xtransactionhash" - ) + mock_get_faucet_tx.assert_called_with("base-sepolia", "0xdestination", "0xtransactionhash") assert mock_get_faucet_tx.call_count == 5 mock_sleep.assert_has_calls([call(0.5)] * 4) assert mock_time.call_count == 6 - diff --git a/tests/test_smart_contract.py b/tests/test_smart_contract.py index 591aa42..f07d5d4 100644 --- a/tests/test_smart_contract.py +++ b/tests/test_smart_contract.py @@ -1093,6 +1093,31 @@ def test_read_pure_uint128(mock_api_clients, all_read_types_abi): ) +@patch("cdp.Cdp.api_clients") +def test_read_pure_uint160(mock_api_clients, all_read_types_abi): + """Test reading a uint160 value from a pure function.""" + mock_read_contract = Mock() + mock_read_contract.return_value = SolidityValue( + type="uint160", + value="115792089237316195423570985008687907853269984665640564039457584007913129639935", + ) + mock_api_clients.smart_contracts.read_contract = mock_read_contract + + result = SmartContract.read( + network_id="1", + contract_address="0x1234567890123456789012345678901234567890", + method="pureUint160", + abi=all_read_types_abi, + ) + + assert result == 115792089237316195423570985008687907853269984665640564039457584007913129639935 + mock_read_contract.assert_called_once_with( + network_id="1", + contract_address="0x1234567890123456789012345678901234567890", + read_contract_request=ANY, + ) + + @patch("cdp.Cdp.api_clients") def test_read_pure_uint256(mock_api_clients, all_read_types_abi): """Test reading a uint256 value from a pure function.""" @@ -1162,6 +1187,28 @@ def test_read_pure_int16(mock_api_clients, all_read_types_abi): ) +@patch("cdp.Cdp.api_clients") +def test_read_pure_int24(mock_api_clients, all_read_types_abi): + """Test reading an int24 value from a pure function.""" + mock_read_contract = Mock() + mock_read_contract.return_value = SolidityValue(type="int24", value="-8388608") + mock_api_clients.smart_contracts.read_contract = mock_read_contract + + result = SmartContract.read( + network_id="1", + contract_address="0x1234567890123456789012345678901234567890", + method="pureInt24", + abi=all_read_types_abi, + ) + + assert result == -8388608 + mock_read_contract.assert_called_once_with( + network_id="1", + contract_address="0x1234567890123456789012345678901234567890", + read_contract_request=ANY, + ) + + @patch("cdp.Cdp.api_clients") def test_read_pure_int32(mock_api_clients, all_read_types_abi): """Test reading an int32 value from a pure function.""" @@ -1184,6 +1231,28 @@ def test_read_pure_int32(mock_api_clients, all_read_types_abi): ) +@patch("cdp.Cdp.api_clients") +def test_read_pure_int56(mock_api_clients, all_read_types_abi): + """Test reading an int56 value from a pure function.""" + mock_read_contract = Mock() + mock_read_contract.return_value = SolidityValue(type="int56", value="-72057594037927936") + mock_api_clients.smart_contracts.read_contract = mock_read_contract + + result = SmartContract.read( + network_id="1", + contract_address="0x1234567890123456789012345678901234567890", + method="pureInt56", + abi=all_read_types_abi, + ) + + assert result == -72057594037927936 + mock_read_contract.assert_called_once_with( + network_id="1", + contract_address="0x1234567890123456789012345678901234567890", + read_contract_request=ANY, + ) + + @patch("cdp.Cdp.api_clients") def test_read_pure_int64(mock_api_clients, all_read_types_abi): """Test reading an int64 value from a pure function."""