From 7bd4ee32884754dd45b7722077c9b946bf8af52a Mon Sep 17 00:00:00 2001 From: Rohan Agarwal Date: Mon, 30 Sep 2024 13:55:24 -0400 Subject: [PATCH 01/27] WIP --- cdp/api_clients.py | 17 + cdp/client/__init__.py | 26 +- cdp/client/api/__init__.py | 2 + cdp/client/api/addresses_api.py | 1670 +++++++++-------- cdp/client/api/assets_api.py | 184 +- cdp/client/api/balance_history_api.py | 242 +-- cdp/client/api/contract_events_api.py | 308 ++- cdp/client/api/contract_invocations_api.py | 782 ++++---- cdp/client/api/external_addresses_api.py | 832 +++----- cdp/client/api/networks_api.py | 161 +- cdp/client/api/server_signers_api.py | 1046 ++++++----- cdp/client/api/smart_contracts_api.py | 728 ++++--- cdp/client/api/stake_api.py | 982 +++++----- cdp/client/api/trades_api.py | 748 ++++---- cdp/client/api/transaction_history_api.py | 346 ++++ cdp/client/api/transfers_api.py | 748 ++++---- cdp/client/api/users_api.py | 157 +- cdp/client/api/validators_api.py | 408 ++-- cdp/client/api/wallet_stake_api.py | 569 +++--- cdp/client/api/wallets_api.py | 805 ++++---- cdp/client/api/webhooks_api.py | 959 +++++++--- cdp/client/api_client.py | 314 ++-- cdp/client/api_response.py | 18 +- cdp/client/configuration.py | 121 +- cdp/client/exceptions.py | 79 +- cdp/client/models/__init__.py | 25 +- cdp/client/models/address.py | 64 +- cdp/client/models/address_balance_list.py | 69 +- .../models/address_historical_balance_list.py | 67 +- cdp/client/models/address_list.py | 69 +- cdp/client/models/address_transaction_list.py | 67 +- cdp/client/models/asset.py | 66 +- cdp/client/models/balance.py | 57 +- .../broadcast_contract_invocation_request.py | 50 +- .../broadcast_staking_operation_request.py | 60 +- cdp/client/models/broadcast_trade_request.py | 56 +- .../models/broadcast_transfer_request.py | 46 +- .../models/build_staking_operation_request.py | 70 +- cdp/client/models/contract_event.py | 102 +- cdp/client/models/contract_event_list.py | 67 +- cdp/client/models/contract_invocation.py | 96 +- cdp/client/models/contract_invocation_list.py | 73 +- cdp/client/models/create_address_request.py | 67 +- .../create_contract_invocation_request.py | 69 +- .../create_payload_signature_request.py | 51 +- .../models/create_server_signer_request.py | 62 +- .../models/create_smart_contract_request.py | 59 +- .../create_staking_operation_request.py | 58 +- cdp/client/models/create_trade_request.py | 54 +- cdp/client/models/create_transfer_request.py | 72 +- cdp/client/models/create_wallet_request.py | 57 +- .../models/create_wallet_request_wallet.py | 54 +- .../models/create_wallet_webhook_request.py | 89 + cdp/client/models/create_webhook_request.py | 96 +- .../models/deploy_smart_contract_request.py | 50 +- cdp/client/models/erc20_transfer_event.py | 155 +- cdp/client/models/erc721_transfer_event.py | 154 +- cdp/client/models/error.py | 68 +- cdp/client/models/ethereum_transaction.py | 180 +- .../models/ethereum_transaction_access.py | 53 +- .../ethereum_transaction_access_list.py | 61 +- .../ethereum_transaction_flattened_trace.py | 144 +- .../models/ethereum_validator_metadata.py | 103 +- cdp/client/models/faucet_transaction.py | 60 +- cdp/client/models/feature_set.py | 67 +- ...historical_staking_balances200_response.py | 67 +- .../fetch_staking_rewards200_response.py | 67 +- .../models/fetch_staking_rewards_request.py | 82 +- .../models/get_staking_context_request.py | 62 +- cdp/client/models/historical_balance.py | 69 +- .../models/multi_token_contract_options.py | 87 + cdp/client/models/network.py | 94 +- cdp/client/models/network_identifier.py | 40 +- cdp/client/models/nft_contract_options.py | 49 +- cdp/client/models/payload_signature.py | 79 +- cdp/client/models/payload_signature_list.py | 73 +- cdp/client/models/seed_creation_event.py | 53 +- .../models/seed_creation_event_result.py | 69 +- cdp/client/models/server_signer.py | 58 +- cdp/client/models/server_signer_event.py | 63 +- .../models/server_signer_event_event.py | 78 +- cdp/client/models/server_signer_event_list.py | 69 +- cdp/client/models/server_signer_list.py | 73 +- cdp/client/models/signature_creation_event.py | 88 +- .../models/signature_creation_event_result.py | 74 +- .../signed_voluntary_exit_message_metadata.py | 62 +- cdp/client/models/smart_contract.py | 95 +- cdp/client/models/smart_contract_list.py | 67 +- cdp/client/models/smart_contract_options.py | 94 +- cdp/client/models/smart_contract_type.py | 29 +- cdp/client/models/sponsored_send.py | 97 +- cdp/client/models/staking_balance.py | 85 +- cdp/client/models/staking_context.py | 57 +- cdp/client/models/staking_context_context.py | 73 +- cdp/client/models/staking_operation.py | 105 +- .../models/staking_operation_metadata.py | 82 +- cdp/client/models/staking_reward.py | 92 +- cdp/client/models/staking_reward_format.py | 28 +- cdp/client/models/staking_reward_usd_value.py | 60 +- cdp/client/models/token_contract_options.py | 58 +- cdp/client/models/trade.py | 108 +- cdp/client/models/trade_list.py | 73 +- cdp/client/models/transaction.py | 133 +- cdp/client/models/transaction_content.py | 76 +- cdp/client/models/transaction_type.py | 26 +- cdp/client/models/transfer.py | 137 +- cdp/client/models/transfer_list.py | 73 +- cdp/client/models/update_webhook_request.py | 74 +- cdp/client/models/user.py | 49 +- cdp/client/models/validator.py | 81 +- cdp/client/models/validator_details.py | 80 +- cdp/client/models/validator_list.py | 67 +- cdp/client/models/validator_status.py | 50 +- cdp/client/models/wallet.py | 87 +- cdp/client/models/wallet_list.py | 69 +- cdp/client/models/webhook.py | 123 +- cdp/client/models/webhook_event_filter.py | 69 +- cdp/client/models/webhook_event_type.py | 32 +- .../models/webhook_event_type_filter.py | 80 +- cdp/client/models/webhook_list.py | 72 +- .../models/webhook_wallet_activity_filter.py | 57 +- cdp/client/rest.py | 111 +- cdp/smart_contract.py | 313 +++ cdp/wallet_address.py | 79 + 124 files changed, 11064 insertions(+), 8772 deletions(-) create mode 100644 cdp/client/api/transaction_history_api.py create mode 100644 cdp/client/models/create_wallet_webhook_request.py create mode 100644 cdp/client/models/multi_token_contract_options.py create mode 100644 cdp/smart_contract.py diff --git a/cdp/api_clients.py b/cdp/api_clients.py index a3615ad..a63b0e1 100644 --- a/cdp/api_clients.py +++ b/cdp/api_clients.py @@ -4,6 +4,7 @@ from cdp.client.api.contract_invocations_api import ContractInvocationsApi from cdp.client.api.external_addresses_api import ExternalAddressesApi from cdp.client.api.networks_api import NetworksApi +from cdp.client.api.smart_contracts_api import SmartContractsApi from cdp.client.api.trades_api import TradesApi from cdp.client.api.transfers_api import TransfersApi from cdp.client.api.wallets_api import WalletsApi @@ -44,6 +45,7 @@ def __init__(self, cdp_client: CdpApiClient) -> None: self._assets: AssetsApi | None = None self._trades: TradesApi | None = None self._contract_invocations: ContractInvocationsApi | None = None + self._smart_contracts: SmartContractsApi | None = None @property def wallets(self) -> WalletsApi: @@ -164,3 +166,18 @@ def contract_invocations(self) -> ContractInvocationsApi: if self._contract_invocations is None: self._contract_invocations = ContractInvocationsApi(api_client=self._cdp_client) return self._contract_invocations + + @property + def smart_contracts(self) -> SmartContractsApi: + """Get the SmartContractsApi client instance. + + Returns: + SmartContractsApi: The SmartContractsApi client instance. + + Note: + This property lazily initializes the SmartContractsApi client on first access. + + """ + if self._smart_contracts is None: + self._smart_contracts = SmartContractsApi(api_client=self._cdp_client) + return self._smart_contracts diff --git a/cdp/client/__init__.py b/cdp/client/__init__.py index 7e20acf..8b003f5 100644 --- a/cdp/client/__init__.py +++ b/cdp/client/__init__.py @@ -3,16 +3,17 @@ # flake8: noqa """ -Coinbase Platform API + Coinbase Platform API -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. + 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) + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -Do not edit the class manually. + Do not edit the class manually. """ # noqa: E501 + __version__ = "1.0.0" # import apis into sdk package @@ -27,6 +28,7 @@ from cdp.client.api.smart_contracts_api import SmartContractsApi from cdp.client.api.stake_api import StakeApi from cdp.client.api.trades_api import TradesApi +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 @@ -53,9 +55,7 @@ from cdp.client.models.address_transaction_list import AddressTransactionList from cdp.client.models.asset import Asset from cdp.client.models.balance import Balance -from cdp.client.models.broadcast_contract_invocation_request import ( - BroadcastContractInvocationRequest, -) +from cdp.client.models.broadcast_contract_invocation_request import BroadcastContractInvocationRequest from cdp.client.models.broadcast_staking_operation_request import BroadcastStakingOperationRequest from cdp.client.models.broadcast_trade_request import BroadcastTradeRequest from cdp.client.models.broadcast_transfer_request import BroadcastTransferRequest @@ -74,6 +74,7 @@ from cdp.client.models.create_transfer_request import CreateTransferRequest from cdp.client.models.create_wallet_request import CreateWalletRequest from cdp.client.models.create_wallet_request_wallet import CreateWalletRequestWallet +from cdp.client.models.create_wallet_webhook_request import CreateWalletWebhookRequest from cdp.client.models.create_webhook_request import CreateWebhookRequest from cdp.client.models.deploy_smart_contract_request import DeploySmartContractRequest from cdp.client.models.erc20_transfer_event import ERC20TransferEvent @@ -86,13 +87,12 @@ from cdp.client.models.ethereum_validator_metadata import EthereumValidatorMetadata from cdp.client.models.faucet_transaction import FaucetTransaction from cdp.client.models.feature_set import FeatureSet -from cdp.client.models.fetch_historical_staking_balances200_response import ( - FetchHistoricalStakingBalances200Response, -) +from cdp.client.models.fetch_historical_staking_balances200_response import FetchHistoricalStakingBalances200Response from cdp.client.models.fetch_staking_rewards200_response import FetchStakingRewards200Response from cdp.client.models.fetch_staking_rewards_request import FetchStakingRewardsRequest from cdp.client.models.get_staking_context_request import GetStakingContextRequest from cdp.client.models.historical_balance import HistoricalBalance +from cdp.client.models.multi_token_contract_options import MultiTokenContractOptions from cdp.client.models.nft_contract_options import NFTContractOptions from cdp.client.models.network import Network from cdp.client.models.network_identifier import NetworkIdentifier @@ -107,9 +107,7 @@ from cdp.client.models.server_signer_list import ServerSignerList from cdp.client.models.signature_creation_event import SignatureCreationEvent from cdp.client.models.signature_creation_event_result import SignatureCreationEventResult -from cdp.client.models.signed_voluntary_exit_message_metadata import ( - SignedVoluntaryExitMessageMetadata, -) +from cdp.client.models.signed_voluntary_exit_message_metadata import SignedVoluntaryExitMessageMetadata from cdp.client.models.smart_contract import SmartContract from cdp.client.models.smart_contract_list import SmartContractList from cdp.client.models.smart_contract_options import SmartContractOptions diff --git a/cdp/client/api/__init__.py b/cdp/client/api/__init__.py index 4ebcc4a..28574b9 100644 --- a/cdp/client/api/__init__.py +++ b/cdp/client/api/__init__.py @@ -12,9 +12,11 @@ from cdp.client.api.smart_contracts_api import SmartContractsApi from cdp.client.api.stake_api import StakeApi from cdp.client.api.trades_api import TradesApi +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 195cb57..3c6fedd 100644 --- a/cdp/client/api/addresses_api.py +++ b/cdp/client/api/addresses_api.py @@ -1,19 +1,24 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from typing import Annotated, Any + Do not edit the class manually. +""" # noqa: E501 -from pydantic import Field, StrictFloat, StrictInt, StrictStr, validate_call +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 cdp.client.api_client import ApiClient, RequestSerialized -from cdp.client.api_response import ApiResponse +from pydantic import Field, StrictInt, StrictStr +from typing import Optional +from typing_extensions import Annotated from cdp.client.models.address import Address from cdp.client.models.address_balance_list import AddressBalanceList from cdp.client.models.address_list import AddressList @@ -23,6 +28,9 @@ from cdp.client.models.faucet_transaction import FaucetTransaction from cdp.client.models.payload_signature import PayloadSignature from cdp.client.models.payload_signature_list import PayloadSignatureList + +from cdp.client.api_client import ApiClient, RequestSerialized +from cdp.client.api_response import ApiResponse from cdp.client.rest import RESTResponseType @@ -38,19 +46,23 @@ def __init__(self, api_client=None) -> None: api_client = ApiClient.get_default() self.api_client = api_client + @validate_call def create_address( self, - wallet_id: Annotated[ - StrictStr, Field(description="The ID of the wallet to create the address in.") - ], - create_address_request: CreateAddressRequest | None = None, - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = None, + wallet_id: Annotated[StrictStr, Field(description="The ID of the wallet to create the address in.")], + create_address_request: Optional[CreateAddressRequest] = 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, ) -> Address: """Create a new address @@ -81,39 +93,47 @@ def create_address( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._create_address_serialize( wallet_id=wallet_id, create_address_request=create_address_request, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "Address", + _response_types_map: Dict[str, Optional[str]] = { + '200': "Address", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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_address_with_http_info( self, - wallet_id: Annotated[ - StrictStr, Field(description="The ID of the wallet to create the address in.") - ], - create_address_request: CreateAddressRequest | None = None, - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = None, + wallet_id: Annotated[StrictStr, Field(description="The ID of the wallet to create the address in.")], + create_address_request: Optional[CreateAddressRequest] = 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[Address]: """Create a new address @@ -144,39 +164,47 @@ def create_address_with_http_info( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._create_address_serialize( wallet_id=wallet_id, create_address_request=create_address_request, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "Address", + _response_types_map: Dict[str, Optional[str]] = { + '200': "Address", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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_address_without_preload_content( self, - wallet_id: Annotated[ - StrictStr, Field(description="The ID of the wallet to create the address in.") - ], - create_address_request: CreateAddressRequest | None = None, - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = None, + wallet_id: Annotated[StrictStr, Field(description="The ID of the wallet to create the address in.")], + create_address_request: Optional[CreateAddressRequest] = 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: """Create a new address @@ -207,22 +235,27 @@ def create_address_without_preload_content( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._create_address_serialize( wallet_id=wallet_id, create_address_request=create_address_request, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "Address", + _response_types_map: Dict[str, Optional[str]] = { + '200': "Address", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) return response_data.response + def _create_address_serialize( self, wallet_id, @@ -232,20 +265,22 @@ def _create_address_serialize( _headers, _host_index, ) -> RequestSerialized: + _host = None - _collection_formats: dict[str, str] = {} + _collection_formats: Dict[str, str] = { + } - _path_params: dict[str, str] = {} - _query_params: list[tuple[str, str]] = [] - _header_params: dict[str, str | None] = _headers or {} - _form_params: list[tuple[str, str]] = [] - _files: dict[str, str | bytes] = {} - _body_params: bytes | None = None + _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]] = {} + _body_params: Optional[bytes] = None # process the path parameters if wallet_id is not None: - _path_params["wallet_id"] = wallet_id + _path_params['wallet_id'] = wallet_id # process the query parameters # process the header parameters # process the form parameters @@ -253,24 +288,36 @@ def _create_address_serialize( if create_address_request is not None: _body_params = create_address_request + # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) + 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 + _header_params['Content-Type'] = _content_type else: - _default_content_type = self.api_client.select_header_content_type(["application/json"]) + _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 + _header_params['Content-Type'] = _default_content_type # authentication setting - _auth_settings: list[str] = [] + _auth_settings: List[str] = [ + ] return self.api_client.param_serialize( - method="POST", - resource_path="/v1/wallets/{wallet_id}/addresses", + method='POST', + resource_path='/v1/wallets/{wallet_id}/addresses', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -280,26 +327,29 @@ def _create_address_serialize( auth_settings=_auth_settings, collection_formats=_collection_formats, _host=_host, - _request_auth=_request_auth, + _request_auth=_request_auth ) + + + @validate_call def create_payload_signature( self, - wallet_id: Annotated[ - StrictStr, Field(description="The ID of the wallet the address belongs to.") - ], - address_id: Annotated[ - StrictStr, - Field(description="The onchain address of the address to sign the payload with."), - ], - create_payload_signature_request: CreatePayloadSignatureRequest | None = None, - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = None, + wallet_id: Annotated[StrictStr, Field(description="The ID of the wallet the address belongs to.")], + address_id: Annotated[StrictStr, Field(description="The onchain address of the address to sign the payload with.")], + create_payload_signature_request: Optional[CreatePayloadSignatureRequest] = 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, ) -> PayloadSignature: """Create a new payload signature. @@ -332,7 +382,8 @@ def create_payload_signature( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._create_payload_signature_serialize( wallet_id=wallet_id, address_id=address_id, @@ -340,36 +391,40 @@ def create_payload_signature( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "PayloadSignature", + _response_types_map: Dict[str, Optional[str]] = { + '200': "PayloadSignature", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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_payload_signature_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 onchain address of the address to sign the payload with."), - ], - create_payload_signature_request: CreatePayloadSignatureRequest | None = None, - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = None, + wallet_id: Annotated[StrictStr, Field(description="The ID of the wallet the address belongs to.")], + address_id: Annotated[StrictStr, Field(description="The onchain address of the address to sign the payload with.")], + create_payload_signature_request: Optional[CreatePayloadSignatureRequest] = 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[PayloadSignature]: """Create a new payload signature. @@ -402,7 +457,8 @@ def create_payload_signature_with_http_info( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._create_payload_signature_serialize( wallet_id=wallet_id, address_id=address_id, @@ -410,36 +466,40 @@ def create_payload_signature_with_http_info( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "PayloadSignature", + _response_types_map: Dict[str, Optional[str]] = { + '200': "PayloadSignature", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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_payload_signature_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 onchain address of the address to sign the payload with."), - ], - create_payload_signature_request: CreatePayloadSignatureRequest | None = None, - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = None, + wallet_id: Annotated[StrictStr, Field(description="The ID of the wallet the address belongs to.")], + address_id: Annotated[StrictStr, Field(description="The onchain address of the address to sign the payload with.")], + create_payload_signature_request: Optional[CreatePayloadSignatureRequest] = 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: """Create a new payload signature. @@ -472,7 +532,8 @@ def create_payload_signature_without_preload_content( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._create_payload_signature_serialize( wallet_id=wallet_id, address_id=address_id, @@ -480,15 +541,19 @@ def create_payload_signature_without_preload_content( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "PayloadSignature", + _response_types_map: Dict[str, Optional[str]] = { + '200': "PayloadSignature", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) return response_data.response + def _create_payload_signature_serialize( self, wallet_id, @@ -499,22 +564,24 @@ def _create_payload_signature_serialize( _headers, _host_index, ) -> RequestSerialized: + _host = None - _collection_formats: dict[str, str] = {} + _collection_formats: Dict[str, str] = { + } - _path_params: dict[str, str] = {} - _query_params: list[tuple[str, str]] = [] - _header_params: dict[str, str | None] = _headers or {} - _form_params: list[tuple[str, str]] = [] - _files: dict[str, str | bytes] = {} - _body_params: bytes | None = None + _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]] = {} + _body_params: Optional[bytes] = None # process the path parameters if wallet_id is not None: - _path_params["wallet_id"] = wallet_id + _path_params['wallet_id'] = wallet_id if address_id is not None: - _path_params["address_id"] = address_id + _path_params['address_id'] = address_id # process the query parameters # process the header parameters # process the form parameters @@ -522,24 +589,36 @@ def _create_payload_signature_serialize( if create_payload_signature_request is not None: _body_params = create_payload_signature_request + # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) + 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 + _header_params['Content-Type'] = _content_type else: - _default_content_type = self.api_client.select_header_content_type(["application/json"]) + _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 + _header_params['Content-Type'] = _default_content_type # authentication setting - _auth_settings: list[str] = [] + _auth_settings: List[str] = [ + ] return self.api_client.param_serialize( - method="POST", - resource_path="/v1/wallets/{wallet_id}/addresses/{address_id}/payload_signatures", + method='POST', + resource_path='/v1/wallets/{wallet_id}/addresses/{address_id}/payload_signatures', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -549,25 +628,28 @@ def _create_payload_signature_serialize( auth_settings=_auth_settings, collection_formats=_collection_formats, _host=_host, - _request_auth=_request_auth, + _request_auth=_request_auth ) + + + @validate_call def get_address( self, - wallet_id: Annotated[ - StrictStr, Field(description="The ID of the wallet the address belongs to.") - ], - address_id: Annotated[ - StrictStr, - Field(description="The onchain address of the address that is being fetched."), - ], - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = None, + wallet_id: Annotated[StrictStr, Field(description="The ID of the wallet the address belongs to.")], + address_id: Annotated[StrictStr, Field(description="The onchain address of the address that is being fetched.")], + _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, ) -> Address: """Get address by onchain address @@ -598,42 +680,47 @@ def get_address( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._get_address_serialize( wallet_id=wallet_id, address_id=address_id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "Address", + _response_types_map: Dict[str, Optional[str]] = { + '200': "Address", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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_address_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 onchain address of the address that is being fetched."), - ], - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = None, + wallet_id: Annotated[StrictStr, Field(description="The ID of the wallet the address belongs to.")], + address_id: Annotated[StrictStr, Field(description="The onchain address of the address that is being fetched.")], + _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[Address]: """Get address by onchain address @@ -664,42 +751,47 @@ def get_address_with_http_info( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._get_address_serialize( wallet_id=wallet_id, address_id=address_id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "Address", + _response_types_map: Dict[str, Optional[str]] = { + '200': "Address", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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_address_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 onchain address of the address that is being fetched."), - ], - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = None, + wallet_id: Annotated[StrictStr, Field(description="The ID of the wallet the address belongs to.")], + address_id: Annotated[StrictStr, Field(description="The onchain address of the address that is being fetched.")], + _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 address by onchain address @@ -730,22 +822,27 @@ def get_address_without_preload_content( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._get_address_serialize( wallet_id=wallet_id, address_id=address_id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "Address", + _response_types_map: Dict[str, Optional[str]] = { + '200': "Address", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) return response_data.response + def _get_address_serialize( self, wallet_id, @@ -755,37 +852,46 @@ def _get_address_serialize( _headers, _host_index, ) -> RequestSerialized: + _host = None - _collection_formats: dict[str, str] = {} + _collection_formats: Dict[str, str] = { + } - _path_params: dict[str, str] = {} - _query_params: list[tuple[str, str]] = [] - _header_params: dict[str, str | None] = _headers or {} - _form_params: list[tuple[str, str]] = [] - _files: dict[str, str | bytes] = {} - _body_params: bytes | None = None + _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]] = {} + _body_params: Optional[bytes] = None # process the path parameters if wallet_id is not None: - _path_params["wallet_id"] = wallet_id + _path_params['wallet_id'] = wallet_id if address_id is not None: - _path_params["address_id"] = address_id + _path_params['address_id'] = address_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"]) + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + # authentication setting - _auth_settings: list[str] = [] + _auth_settings: List[str] = [ + ] return self.api_client.param_serialize( - method="GET", - resource_path="/v1/wallets/{wallet_id}/addresses/{address_id}", + method='GET', + resource_path='/v1/wallets/{wallet_id}/addresses/{address_id}', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -795,28 +901,29 @@ def _get_address_serialize( auth_settings=_auth_settings, collection_formats=_collection_formats, _host=_host, - _request_auth=_request_auth, + _request_auth=_request_auth ) + + + @validate_call def get_address_balance( self, - wallet_id: Annotated[ - StrictStr, Field(description="The ID of the wallet to fetch the balance for") - ], - address_id: Annotated[ - StrictStr, - Field(description="The onchain address of the address that is being fetched."), - ], - asset_id: Annotated[ - StrictStr, Field(description="The symbol of the asset to fetch the balance for") - ], - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = None, + wallet_id: Annotated[StrictStr, Field(description="The ID of the wallet to fetch the balance for")], + address_id: Annotated[StrictStr, Field(description="The onchain address of the address that is being fetched.")], + asset_id: Annotated[StrictStr, Field(description="The symbol of the asset to fetch the balance 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, ) -> Balance: """Get address balance for asset @@ -849,7 +956,8 @@ def get_address_balance( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._get_address_balance_serialize( wallet_id=wallet_id, address_id=address_id, @@ -857,38 +965,40 @@ def get_address_balance( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "Balance", + _response_types_map: Dict[str, Optional[str]] = { + '200': "Balance", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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_address_balance_with_http_info( self, - wallet_id: Annotated[ - StrictStr, Field(description="The ID of the wallet to fetch the balance for") - ], - address_id: Annotated[ - StrictStr, - Field(description="The onchain address of the address that is being fetched."), - ], - asset_id: Annotated[ - StrictStr, Field(description="The symbol of the asset to fetch the balance for") - ], - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = None, + wallet_id: Annotated[StrictStr, Field(description="The ID of the wallet to fetch the balance for")], + address_id: Annotated[StrictStr, Field(description="The onchain address of the address that is being fetched.")], + asset_id: Annotated[StrictStr, Field(description="The symbol of the asset to fetch the balance 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[Balance]: """Get address balance for asset @@ -921,7 +1031,8 @@ def get_address_balance_with_http_info( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._get_address_balance_serialize( wallet_id=wallet_id, address_id=address_id, @@ -929,38 +1040,40 @@ def get_address_balance_with_http_info( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "Balance", + _response_types_map: Dict[str, Optional[str]] = { + '200': "Balance", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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_address_balance_without_preload_content( self, - wallet_id: Annotated[ - StrictStr, Field(description="The ID of the wallet to fetch the balance for") - ], - address_id: Annotated[ - StrictStr, - Field(description="The onchain address of the address that is being fetched."), - ], - asset_id: Annotated[ - StrictStr, Field(description="The symbol of the asset to fetch the balance for") - ], - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = None, + wallet_id: Annotated[StrictStr, Field(description="The ID of the wallet to fetch the balance for")], + address_id: Annotated[StrictStr, Field(description="The onchain address of the address that is being fetched.")], + asset_id: Annotated[StrictStr, Field(description="The symbol of the asset to fetch the balance 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 address balance for asset @@ -993,7 +1106,8 @@ def get_address_balance_without_preload_content( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._get_address_balance_serialize( wallet_id=wallet_id, address_id=address_id, @@ -1001,15 +1115,19 @@ def get_address_balance_without_preload_content( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "Balance", + _response_types_map: Dict[str, Optional[str]] = { + '200': "Balance", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) return response_data.response + def _get_address_balance_serialize( self, wallet_id, @@ -1020,39 +1138,48 @@ def _get_address_balance_serialize( _headers, _host_index, ) -> RequestSerialized: + _host = None - _collection_formats: dict[str, str] = {} + _collection_formats: Dict[str, str] = { + } - _path_params: dict[str, str] = {} - _query_params: list[tuple[str, str]] = [] - _header_params: dict[str, str | None] = _headers or {} - _form_params: list[tuple[str, str]] = [] - _files: dict[str, str | bytes] = {} - _body_params: bytes | None = None + _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]] = {} + _body_params: Optional[bytes] = None # process the path parameters if wallet_id is not None: - _path_params["wallet_id"] = wallet_id + _path_params['wallet_id'] = wallet_id if address_id is not None: - _path_params["address_id"] = address_id + _path_params['address_id'] = address_id if asset_id is not None: - _path_params["asset_id"] = asset_id + _path_params['asset_id'] = asset_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"]) + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + # authentication setting - _auth_settings: list[str] = [] + _auth_settings: List[str] = [ + ] return self.api_client.param_serialize( - method="GET", - resource_path="/v1/wallets/{wallet_id}/addresses/{address_id}/balances/{asset_id}", + method='GET', + resource_path='/v1/wallets/{wallet_id}/addresses/{address_id}/balances/{asset_id}', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -1062,28 +1189,29 @@ def _get_address_balance_serialize( auth_settings=_auth_settings, collection_formats=_collection_formats, _host=_host, - _request_auth=_request_auth, + _request_auth=_request_auth ) + + + @validate_call def get_payload_signature( self, - wallet_id: Annotated[ - StrictStr, Field(description="The ID of the wallet the address belongs to.") - ], - address_id: Annotated[ - StrictStr, - Field(description="The onchain address of the address that signed the payload."), - ], - payload_signature_id: Annotated[ - StrictStr, Field(description="The ID of the payload signature to fetch.") - ], - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = None, + wallet_id: Annotated[StrictStr, Field(description="The ID of the wallet the address belongs to.")], + address_id: Annotated[StrictStr, Field(description="The onchain address of the address that signed the payload.")], + payload_signature_id: Annotated[StrictStr, Field(description="The ID of the payload signature to fetch.")], + _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, ) -> PayloadSignature: """Get payload signature. @@ -1116,7 +1244,8 @@ def get_payload_signature( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._get_payload_signature_serialize( wallet_id=wallet_id, address_id=address_id, @@ -1124,38 +1253,40 @@ def get_payload_signature( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "PayloadSignature", + _response_types_map: Dict[str, Optional[str]] = { + '200': "PayloadSignature", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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_payload_signature_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 onchain address of the address that signed the payload."), - ], - payload_signature_id: Annotated[ - StrictStr, Field(description="The ID of the payload signature to fetch.") - ], - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = None, + wallet_id: Annotated[StrictStr, Field(description="The ID of the wallet the address belongs to.")], + address_id: Annotated[StrictStr, Field(description="The onchain address of the address that signed the payload.")], + payload_signature_id: Annotated[StrictStr, Field(description="The ID of the payload signature to fetch.")], + _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[PayloadSignature]: """Get payload signature. @@ -1188,7 +1319,8 @@ def get_payload_signature_with_http_info( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._get_payload_signature_serialize( wallet_id=wallet_id, address_id=address_id, @@ -1196,38 +1328,40 @@ def get_payload_signature_with_http_info( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "PayloadSignature", + _response_types_map: Dict[str, Optional[str]] = { + '200': "PayloadSignature", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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_payload_signature_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 onchain address of the address that signed the payload."), - ], - payload_signature_id: Annotated[ - StrictStr, Field(description="The ID of the payload signature to fetch.") - ], - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = None, + wallet_id: Annotated[StrictStr, Field(description="The ID of the wallet the address belongs to.")], + address_id: Annotated[StrictStr, Field(description="The onchain address of the address that signed the payload.")], + payload_signature_id: Annotated[StrictStr, Field(description="The ID of the payload signature to fetch.")], + _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 payload signature. @@ -1260,7 +1394,8 @@ def get_payload_signature_without_preload_content( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._get_payload_signature_serialize( wallet_id=wallet_id, address_id=address_id, @@ -1268,15 +1403,19 @@ def get_payload_signature_without_preload_content( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "PayloadSignature", + _response_types_map: Dict[str, Optional[str]] = { + '200': "PayloadSignature", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) return response_data.response + def _get_payload_signature_serialize( self, wallet_id, @@ -1287,39 +1426,48 @@ def _get_payload_signature_serialize( _headers, _host_index, ) -> RequestSerialized: + _host = None - _collection_formats: dict[str, str] = {} + _collection_formats: Dict[str, str] = { + } - _path_params: dict[str, str] = {} - _query_params: list[tuple[str, str]] = [] - _header_params: dict[str, str | None] = _headers or {} - _form_params: list[tuple[str, str]] = [] - _files: dict[str, str | bytes] = {} - _body_params: bytes | None = None + _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]] = {} + _body_params: Optional[bytes] = None # process the path parameters if wallet_id is not None: - _path_params["wallet_id"] = wallet_id + _path_params['wallet_id'] = wallet_id if address_id is not None: - _path_params["address_id"] = address_id + _path_params['address_id'] = address_id if payload_signature_id is not None: - _path_params["payload_signature_id"] = payload_signature_id + _path_params['payload_signature_id'] = payload_signature_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"]) + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + # authentication setting - _auth_settings: list[str] = [] + _auth_settings: List[str] = [ + ] return self.api_client.param_serialize( - method="GET", - resource_path="/v1/wallets/{wallet_id}/addresses/{address_id}/payload_signatures/{payload_signature_id}", + method='GET', + resource_path='/v1/wallets/{wallet_id}/addresses/{address_id}/payload_signatures/{payload_signature_id}', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -1329,31 +1477,29 @@ def _get_payload_signature_serialize( auth_settings=_auth_settings, collection_formats=_collection_formats, _host=_host, - _request_auth=_request_auth, + _request_auth=_request_auth ) + + + @validate_call def list_address_balances( self, - wallet_id: Annotated[ - StrictStr, Field(description="The ID of the wallet to fetch the balances for") - ], - address_id: Annotated[ - StrictStr, - Field(description="The onchain address of the address that is being fetched."), - ], - page: Annotated[ - Annotated[str, Field(strict=True, max_length=5000)] | None, - 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." - ), + wallet_id: Annotated[StrictStr, Field(description="The ID of the wallet to fetch the balances for")], + address_id: Annotated[StrictStr, Field(description="The onchain address of the address that is being fetched.")], + 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_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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, ) -> AddressBalanceList: """Get all balances for address @@ -1386,7 +1532,8 @@ def list_address_balances( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._list_address_balances_serialize( wallet_id=wallet_id, address_id=address_id, @@ -1394,41 +1541,40 @@ def list_address_balances( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "AddressBalanceList", + _response_types_map: Dict[str, Optional[str]] = { + '200': "AddressBalanceList", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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_address_balances_with_http_info( self, - wallet_id: Annotated[ - StrictStr, Field(description="The ID of the wallet to fetch the balances for") - ], - address_id: Annotated[ - StrictStr, - Field(description="The onchain address of the address that is being fetched."), - ], - page: Annotated[ - Annotated[str, Field(strict=True, max_length=5000)] | None, - 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." - ), + wallet_id: Annotated[StrictStr, Field(description="The ID of the wallet to fetch the balances for")], + address_id: Annotated[StrictStr, Field(description="The onchain address of the address that is being fetched.")], + 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_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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[AddressBalanceList]: """Get all balances for address @@ -1461,7 +1607,8 @@ def list_address_balances_with_http_info( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._list_address_balances_serialize( wallet_id=wallet_id, address_id=address_id, @@ -1469,41 +1616,40 @@ def list_address_balances_with_http_info( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "AddressBalanceList", + _response_types_map: Dict[str, Optional[str]] = { + '200': "AddressBalanceList", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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_address_balances_without_preload_content( self, - wallet_id: Annotated[ - StrictStr, Field(description="The ID of the wallet to fetch the balances for") - ], - address_id: Annotated[ - StrictStr, - Field(description="The onchain address of the address that is being fetched."), - ], - page: Annotated[ - Annotated[str, Field(strict=True, max_length=5000)] | None, - 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." - ), + wallet_id: Annotated[StrictStr, Field(description="The ID of the wallet to fetch the balances for")], + address_id: Annotated[StrictStr, Field(description="The onchain address of the address that is being fetched.")], + 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_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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 all balances for address @@ -1536,7 +1682,8 @@ def list_address_balances_without_preload_content( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._list_address_balances_serialize( wallet_id=wallet_id, address_id=address_id, @@ -1544,15 +1691,19 @@ def list_address_balances_without_preload_content( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "AddressBalanceList", + _response_types_map: Dict[str, Optional[str]] = { + '200': "AddressBalanceList", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) return response_data.response + def _list_address_balances_serialize( self, wallet_id, @@ -1563,40 +1714,50 @@ def _list_address_balances_serialize( _headers, _host_index, ) -> RequestSerialized: + _host = None - _collection_formats: dict[str, str] = {} + _collection_formats: Dict[str, str] = { + } - _path_params: dict[str, str] = {} - _query_params: list[tuple[str, str]] = [] - _header_params: dict[str, str | None] = _headers or {} - _form_params: list[tuple[str, str]] = [] - _files: dict[str, str | bytes] = {} - _body_params: bytes | None = None + _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]] = {} + _body_params: Optional[bytes] = None # process the path parameters if wallet_id is not None: - _path_params["wallet_id"] = wallet_id + _path_params['wallet_id'] = wallet_id if address_id is not None: - _path_params["address_id"] = address_id + _path_params['address_id'] = address_id # process the query parameters if page is not None: - _query_params.append(("page", page)) - + + _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"]) + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + # authentication setting - _auth_settings: list[str] = [] + _auth_settings: List[str] = [ + ] return self.api_client.param_serialize( - method="GET", - resource_path="/v1/wallets/{wallet_id}/addresses/{address_id}/balances", + method='GET', + resource_path='/v1/wallets/{wallet_id}/addresses/{address_id}/balances', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -1606,33 +1767,29 @@ def _list_address_balances_serialize( auth_settings=_auth_settings, collection_formats=_collection_formats, _host=_host, - _request_auth=_request_auth, + _request_auth=_request_auth ) + + + @validate_call def list_addresses( self, - wallet_id: Annotated[ - StrictStr, Field(description="The ID of the wallet whose addresses to fetch") - ], - limit: Annotated[ - StrictInt | None, - Field( - description="A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10." - ), - ] = None, - page: Annotated[ - Annotated[str, Field(strict=True, max_length=5000)] | None, - 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." - ), + wallet_id: Annotated[StrictStr, Field(description="The ID of the wallet whose addresses to fetch")], + 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 10.")] = 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_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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, ) -> AddressList: """List addresses in a wallet. @@ -1665,7 +1822,8 @@ def list_addresses( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._list_addresses_serialize( wallet_id=wallet_id, limit=limit, @@ -1673,43 +1831,40 @@ def list_addresses( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "AddressList", + _response_types_map: Dict[str, Optional[str]] = { + '200': "AddressList", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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_addresses_with_http_info( self, - wallet_id: Annotated[ - StrictStr, Field(description="The ID of the wallet whose addresses to fetch") - ], - limit: Annotated[ - StrictInt | None, - Field( - description="A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10." - ), + wallet_id: Annotated[StrictStr, Field(description="The ID of the wallet whose addresses to fetch")], + 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 10.")] = 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, - page: Annotated[ - Annotated[str, Field(strict=True, max_length=5000)] | None, - 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: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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[AddressList]: """List addresses in a wallet. @@ -1742,7 +1897,8 @@ def list_addresses_with_http_info( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._list_addresses_serialize( wallet_id=wallet_id, limit=limit, @@ -1750,43 +1906,40 @@ def list_addresses_with_http_info( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "AddressList", + _response_types_map: Dict[str, Optional[str]] = { + '200': "AddressList", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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_addresses_without_preload_content( self, - wallet_id: Annotated[ - StrictStr, Field(description="The ID of the wallet whose addresses to fetch") - ], - limit: Annotated[ - StrictInt | None, - Field( - description="A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10." - ), - ] = None, - page: Annotated[ - Annotated[str, Field(strict=True, max_length=5000)] | None, - 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." - ), + wallet_id: Annotated[StrictStr, Field(description="The ID of the wallet whose addresses to fetch")], + 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 10.")] = 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_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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 addresses in a wallet. @@ -1819,7 +1972,8 @@ def list_addresses_without_preload_content( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._list_addresses_serialize( wallet_id=wallet_id, limit=limit, @@ -1827,15 +1981,19 @@ def list_addresses_without_preload_content( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "AddressList", + _response_types_map: Dict[str, Optional[str]] = { + '200': "AddressList", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) return response_data.response + def _list_addresses_serialize( self, wallet_id, @@ -1846,41 +2004,52 @@ def _list_addresses_serialize( _headers, _host_index, ) -> RequestSerialized: + _host = None - _collection_formats: dict[str, str] = {} + _collection_formats: Dict[str, str] = { + } - _path_params: dict[str, str] = {} - _query_params: list[tuple[str, str]] = [] - _header_params: dict[str, str | None] = _headers or {} - _form_params: list[tuple[str, str]] = [] - _files: dict[str, str | bytes] = {} - _body_params: bytes | None = None + _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]] = {} + _body_params: Optional[bytes] = None # process the path parameters if wallet_id is not None: - _path_params["wallet_id"] = wallet_id + _path_params['wallet_id'] = wallet_id # process the query parameters if limit is not None: - _query_params.append(("limit", limit)) - + + _query_params.append(('limit', limit)) + if page is not None: - _query_params.append(("page", page)) - + + _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"]) + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + # authentication setting - _auth_settings: list[str] = [] + _auth_settings: List[str] = [ + ] return self.api_client.param_serialize( - method="GET", - resource_path="/v1/wallets/{wallet_id}/addresses", + method='GET', + resource_path='/v1/wallets/{wallet_id}/addresses', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -1890,39 +2059,30 @@ def _list_addresses_serialize( auth_settings=_auth_settings, collection_formats=_collection_formats, _host=_host, - _request_auth=_request_auth, + _request_auth=_request_auth ) + + + @validate_call def list_payload_signatures( self, - wallet_id: Annotated[ - StrictStr, Field(description="The ID of the wallet the address belongs to.") - ], - address_id: Annotated[ - StrictStr, - Field( - description="The onchain address of the address whose payload signatures to fetch." - ), - ], - limit: Annotated[ - StrictInt | None, - Field( - description="A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10." - ), - ] = None, - page: Annotated[ - Annotated[str, Field(strict=True, max_length=5000)] | None, - 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." - ), + wallet_id: Annotated[StrictStr, Field(description="The ID of the wallet the address belongs to.")], + address_id: Annotated[StrictStr, Field(description="The onchain address of the address whose payload signatures to fetch.")], + 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 10.")] = 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_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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, ) -> PayloadSignatureList: """List payload signatures for an address. @@ -1957,7 +2117,8 @@ def list_payload_signatures( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._list_payload_signatures_serialize( wallet_id=wallet_id, address_id=address_id, @@ -1966,49 +2127,41 @@ def list_payload_signatures( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "PayloadSignatureList", + _response_types_map: Dict[str, Optional[str]] = { + '200': "PayloadSignatureList", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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_payload_signatures_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 onchain address of the address whose payload signatures to fetch." - ), - ], - limit: Annotated[ - StrictInt | None, - Field( - description="A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10." - ), - ] = None, - page: Annotated[ - Annotated[str, Field(strict=True, max_length=5000)] | None, - 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." - ), + wallet_id: Annotated[StrictStr, Field(description="The ID of the wallet the address belongs to.")], + address_id: Annotated[StrictStr, Field(description="The onchain address of the address whose payload signatures to fetch.")], + 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 10.")] = 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_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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[PayloadSignatureList]: """List payload signatures for an address. @@ -2043,7 +2196,8 @@ def list_payload_signatures_with_http_info( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._list_payload_signatures_serialize( wallet_id=wallet_id, address_id=address_id, @@ -2052,49 +2206,41 @@ def list_payload_signatures_with_http_info( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "PayloadSignatureList", + _response_types_map: Dict[str, Optional[str]] = { + '200': "PayloadSignatureList", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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_payload_signatures_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 onchain address of the address whose payload signatures to fetch." - ), - ], - limit: Annotated[ - StrictInt | None, - Field( - description="A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10." - ), + wallet_id: Annotated[StrictStr, Field(description="The ID of the wallet the address belongs to.")], + address_id: Annotated[StrictStr, Field(description="The onchain address of the address whose payload signatures to fetch.")], + 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 10.")] = 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, - page: Annotated[ - Annotated[str, Field(strict=True, max_length=5000)] | None, - 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: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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 payload signatures for an address. @@ -2129,7 +2275,8 @@ def list_payload_signatures_without_preload_content( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._list_payload_signatures_serialize( wallet_id=wallet_id, address_id=address_id, @@ -2138,15 +2285,19 @@ def list_payload_signatures_without_preload_content( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "PayloadSignatureList", + _response_types_map: Dict[str, Optional[str]] = { + '200': "PayloadSignatureList", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) return response_data.response + def _list_payload_signatures_serialize( self, wallet_id, @@ -2158,43 +2309,54 @@ def _list_payload_signatures_serialize( _headers, _host_index, ) -> RequestSerialized: + _host = None - _collection_formats: dict[str, str] = {} + _collection_formats: Dict[str, str] = { + } - _path_params: dict[str, str] = {} - _query_params: list[tuple[str, str]] = [] - _header_params: dict[str, str | None] = _headers or {} - _form_params: list[tuple[str, str]] = [] - _files: dict[str, str | bytes] = {} - _body_params: bytes | None = None + _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]] = {} + _body_params: Optional[bytes] = None # process the path parameters if wallet_id is not None: - _path_params["wallet_id"] = wallet_id + _path_params['wallet_id'] = wallet_id if address_id is not None: - _path_params["address_id"] = address_id + _path_params['address_id'] = address_id # process the query parameters if limit is not None: - _query_params.append(("limit", limit)) - + + _query_params.append(('limit', limit)) + if page is not None: - _query_params.append(("page", page)) - + + _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"]) + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + # authentication setting - _auth_settings: list[str] = [] + _auth_settings: List[str] = [ + ] return self.api_client.param_serialize( - method="GET", - resource_path="/v1/wallets/{wallet_id}/addresses/{address_id}/payload_signatures", + method='GET', + resource_path='/v1/wallets/{wallet_id}/addresses/{address_id}/payload_signatures', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -2204,28 +2366,29 @@ def _list_payload_signatures_serialize( auth_settings=_auth_settings, collection_formats=_collection_formats, _host=_host, - _request_auth=_request_auth, + _request_auth=_request_auth ) + + + @validate_call def request_faucet_funds( self, - wallet_id: Annotated[ - StrictStr, Field(description="The ID of the wallet the address belongs to.") - ], - address_id: Annotated[ - StrictStr, - Field(description="The onchain address of the address that is being fetched."), - ], - asset_id: Annotated[ - StrictStr | None, Field(description="The ID of the asset to transfer from the faucet.") + wallet_id: Annotated[StrictStr, Field(description="The ID of the wallet the address belongs to.")], + address_id: Annotated[StrictStr, Field(description="The onchain address of the address that is being fetched.")], + asset_id: Annotated[Optional[StrictStr], Field(description="The ID of the asset to transfer from the faucet.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] ] = None, - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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, ) -> FaucetTransaction: """Request faucet funds for onchain address. @@ -2258,7 +2421,8 @@ def request_faucet_funds( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._request_faucet_funds_serialize( wallet_id=wallet_id, address_id=address_id, @@ -2266,38 +2430,40 @@ def request_faucet_funds( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "FaucetTransaction", + _response_types_map: Dict[str, Optional[str]] = { + '200': "FaucetTransaction", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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 request_faucet_funds_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 onchain address of the address that is being fetched."), - ], - asset_id: Annotated[ - StrictStr | None, Field(description="The ID of the asset to transfer from the faucet.") + wallet_id: Annotated[StrictStr, Field(description="The ID of the wallet the address belongs to.")], + address_id: Annotated[StrictStr, Field(description="The onchain address of the address that is being fetched.")], + asset_id: Annotated[Optional[StrictStr], Field(description="The ID of the asset to transfer from the faucet.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] ] = None, - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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[FaucetTransaction]: """Request faucet funds for onchain address. @@ -2330,7 +2496,8 @@ def request_faucet_funds_with_http_info( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._request_faucet_funds_serialize( wallet_id=wallet_id, address_id=address_id, @@ -2338,38 +2505,40 @@ def request_faucet_funds_with_http_info( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "FaucetTransaction", + _response_types_map: Dict[str, Optional[str]] = { + '200': "FaucetTransaction", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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 request_faucet_funds_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 onchain address of the address that is being fetched."), - ], - asset_id: Annotated[ - StrictStr | None, Field(description="The ID of the asset to transfer from the faucet.") + wallet_id: Annotated[StrictStr, Field(description="The ID of the wallet the address belongs to.")], + address_id: Annotated[StrictStr, Field(description="The onchain address of the address that is being fetched.")], + asset_id: Annotated[Optional[StrictStr], Field(description="The ID of the asset to transfer from the faucet.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] ] = None, - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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: """Request faucet funds for onchain address. @@ -2402,7 +2571,8 @@ def request_faucet_funds_without_preload_content( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._request_faucet_funds_serialize( wallet_id=wallet_id, address_id=address_id, @@ -2410,15 +2580,19 @@ def request_faucet_funds_without_preload_content( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "FaucetTransaction", + _response_types_map: Dict[str, Optional[str]] = { + '200': "FaucetTransaction", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) return response_data.response + def _request_faucet_funds_serialize( self, wallet_id, @@ -2429,40 +2603,50 @@ def _request_faucet_funds_serialize( _headers, _host_index, ) -> RequestSerialized: + _host = None - _collection_formats: dict[str, str] = {} + _collection_formats: Dict[str, str] = { + } - _path_params: dict[str, str] = {} - _query_params: list[tuple[str, str]] = [] - _header_params: dict[str, str | None] = _headers or {} - _form_params: list[tuple[str, str]] = [] - _files: dict[str, str | bytes] = {} - _body_params: bytes | None = None + _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]] = {} + _body_params: Optional[bytes] = None # process the path parameters if wallet_id is not None: - _path_params["wallet_id"] = wallet_id + _path_params['wallet_id'] = wallet_id if address_id is not None: - _path_params["address_id"] = address_id + _path_params['address_id'] = address_id # process the query parameters if asset_id is not None: - _query_params.append(("asset_id", asset_id)) - + + _query_params.append(('asset_id', asset_id)) + # 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"]) + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + # authentication setting - _auth_settings: list[str] = [] + _auth_settings: List[str] = [ + ] return self.api_client.param_serialize( - method="POST", - resource_path="/v1/wallets/{wallet_id}/addresses/{address_id}/faucet", + method='POST', + resource_path='/v1/wallets/{wallet_id}/addresses/{address_id}/faucet', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -2472,5 +2656,7 @@ def _request_faucet_funds_serialize( auth_settings=_auth_settings, collection_formats=_collection_formats, _host=_host, - _request_auth=_request_auth, + _request_auth=_request_auth ) + + diff --git a/cdp/client/api/assets_api.py b/cdp/client/api/assets_api.py index c5fd410..874b2dc 100644 --- a/cdp/client/api/assets_api.py +++ b/cdp/client/api/assets_api.py @@ -1,20 +1,27 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + 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 -from typing import Annotated, Any +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, StrictFloat, StrictInt, StrictStr, validate_call +from pydantic import Field, StrictStr +from typing_extensions import Annotated +from cdp.client.models.asset import Asset from cdp.client.api_client import ApiClient, RequestSerialized from cdp.client.api_response import ApiResponse -from cdp.client.models.asset import Asset from cdp.client.rest import RESTResponseType @@ -30,22 +37,23 @@ def __init__(self, api_client=None) -> None: api_client = ApiClient.get_default() self.api_client = api_client + @validate_call def get_asset( self, network_id: Annotated[StrictStr, Field(description="The ID of the blockchain network")], - asset_id: Annotated[ - StrictStr, - Field( - description="The ID of the asset to fetch. This could be a symbol or an ERC20 contract address." - ), - ], - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = None, + asset_id: Annotated[StrictStr, Field(description="The ID of the asset to fetch. This could be a symbol or an ERC20 contract address.")], + _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, ) -> Asset: """Get the asset for the specified asset ID. @@ -76,42 +84,47 @@ def get_asset( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._get_asset_serialize( network_id=network_id, asset_id=asset_id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "Asset", + _response_types_map: Dict[str, Optional[str]] = { + '200': "Asset", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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_asset_with_http_info( self, network_id: Annotated[StrictStr, Field(description="The ID of the blockchain network")], - asset_id: Annotated[ - StrictStr, - Field( - description="The ID of the asset to fetch. This could be a symbol or an ERC20 contract address." - ), - ], - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = None, + asset_id: Annotated[StrictStr, Field(description="The ID of the asset to fetch. This could be a symbol or an ERC20 contract address.")], + _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[Asset]: """Get the asset for the specified asset ID. @@ -142,42 +155,47 @@ def get_asset_with_http_info( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._get_asset_serialize( network_id=network_id, asset_id=asset_id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "Asset", + _response_types_map: Dict[str, Optional[str]] = { + '200': "Asset", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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_asset_without_preload_content( self, network_id: Annotated[StrictStr, Field(description="The ID of the blockchain network")], - asset_id: Annotated[ - StrictStr, - Field( - description="The ID of the asset to fetch. This could be a symbol or an ERC20 contract address." - ), - ], - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = None, + asset_id: Annotated[StrictStr, Field(description="The ID of the asset to fetch. This could be a symbol or an ERC20 contract address.")], + _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 asset for the specified asset ID. @@ -208,22 +226,27 @@ def get_asset_without_preload_content( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._get_asset_serialize( network_id=network_id, asset_id=asset_id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "Asset", + _response_types_map: Dict[str, Optional[str]] = { + '200': "Asset", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) return response_data.response + def _get_asset_serialize( self, network_id, @@ -233,37 +256,46 @@ def _get_asset_serialize( _headers, _host_index, ) -> RequestSerialized: + _host = None - _collection_formats: dict[str, str] = {} + _collection_formats: Dict[str, str] = { + } - _path_params: dict[str, str] = {} - _query_params: list[tuple[str, str]] = [] - _header_params: dict[str, str | None] = _headers or {} - _form_params: list[tuple[str, str]] = [] - _files: dict[str, str | bytes] = {} - _body_params: bytes | None = None + _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]] = {} + _body_params: Optional[bytes] = None # process the path parameters if network_id is not None: - _path_params["network_id"] = network_id + _path_params['network_id'] = network_id if asset_id is not None: - _path_params["asset_id"] = asset_id + _path_params['asset_id'] = asset_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"]) + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + # authentication setting - _auth_settings: list[str] = [] + _auth_settings: List[str] = [ + ] return self.api_client.param_serialize( - method="GET", - resource_path="/v1/networks/{network_id}/assets/{asset_id}", + method='GET', + resource_path='/v1/networks/{network_id}/assets/{asset_id}', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -273,5 +305,7 @@ def _get_asset_serialize( auth_settings=_auth_settings, collection_formats=_collection_formats, _host=_host, - _request_auth=_request_auth, + _request_auth=_request_auth ) + + diff --git a/cdp/client/api/balance_history_api.py b/cdp/client/api/balance_history_api.py index e4b0691..c0eaf82 100644 --- a/cdp/client/api/balance_history_api.py +++ b/cdp/client/api/balance_history_api.py @@ -1,20 +1,28 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from typing import Annotated, Any + Do not edit the class manually. +""" # noqa: E501 -from pydantic import Field, StrictFloat, StrictInt, StrictStr, validate_call +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, StrictInt, StrictStr +from typing import Optional +from typing_extensions import Annotated +from cdp.client.models.address_historical_balance_list import AddressHistoricalBalanceList from cdp.client.api_client import ApiClient, RequestSerialized from cdp.client.api_response import ApiResponse -from cdp.client.models.address_historical_balance_list import AddressHistoricalBalanceList from cdp.client.rest import RESTResponseType @@ -30,36 +38,26 @@ def __init__(self, api_client=None) -> None: api_client = ApiClient.get_default() self.api_client = api_client + @validate_call def list_address_historical_balance( self, network_id: Annotated[StrictStr, Field(description="The ID of the blockchain network")], - address_id: Annotated[ - StrictStr, - Field(description="The ID of the address to fetch the historical balance for."), - ], - asset_id: Annotated[ - StrictStr, - Field(description="The symbol of the asset to fetch the historical balance for."), - ], - limit: Annotated[ - StrictInt | None, - Field( - description="A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10." - ), + address_id: Annotated[StrictStr, Field(description="The ID of the address to fetch the historical balance for.")], + asset_id: Annotated[StrictStr, Field(description="The symbol of the asset to fetch the historical balance for.")], + 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 10.")] = 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, - page: Annotated[ - Annotated[str, Field(strict=True, max_length=5000)] | None, - 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: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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, ) -> AddressHistoricalBalanceList: """Get address balance history for asset @@ -96,7 +94,8 @@ def list_address_historical_balance( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._list_address_historical_balance_serialize( network_id=network_id, address_id=address_id, @@ -106,49 +105,42 @@ def list_address_historical_balance( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "AddressHistoricalBalanceList", + _response_types_map: Dict[str, Optional[str]] = { + '200': "AddressHistoricalBalanceList", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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_address_historical_balance_with_http_info( self, network_id: Annotated[StrictStr, Field(description="The ID of the blockchain network")], - address_id: Annotated[ - StrictStr, - Field(description="The ID of the address to fetch the historical balance for."), - ], - asset_id: Annotated[ - StrictStr, - Field(description="The symbol of the asset to fetch the historical balance for."), - ], - limit: Annotated[ - StrictInt | None, - Field( - description="A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10." - ), + address_id: Annotated[StrictStr, Field(description="The ID of the address to fetch the historical balance for.")], + asset_id: Annotated[StrictStr, Field(description="The symbol of the asset to fetch the historical balance for.")], + 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 10.")] = 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, - page: Annotated[ - Annotated[str, Field(strict=True, max_length=5000)] | None, - 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: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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[AddressHistoricalBalanceList]: """Get address balance history for asset @@ -185,7 +177,8 @@ def list_address_historical_balance_with_http_info( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._list_address_historical_balance_serialize( network_id=network_id, address_id=address_id, @@ -195,49 +188,42 @@ def list_address_historical_balance_with_http_info( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "AddressHistoricalBalanceList", + _response_types_map: Dict[str, Optional[str]] = { + '200': "AddressHistoricalBalanceList", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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_address_historical_balance_without_preload_content( self, network_id: Annotated[StrictStr, Field(description="The ID of the blockchain network")], - address_id: Annotated[ - StrictStr, - Field(description="The ID of the address to fetch the historical balance for."), - ], - asset_id: Annotated[ - StrictStr, - Field(description="The symbol of the asset to fetch the historical balance for."), - ], - limit: Annotated[ - StrictInt | None, - Field( - description="A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10." - ), - ] = None, - page: Annotated[ - Annotated[str, Field(strict=True, max_length=5000)] | None, - 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." - ), + address_id: Annotated[StrictStr, Field(description="The ID of the address to fetch the historical balance for.")], + asset_id: Annotated[StrictStr, Field(description="The symbol of the asset to fetch the historical balance for.")], + 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 10.")] = 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_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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 address balance history for asset @@ -274,7 +260,8 @@ def list_address_historical_balance_without_preload_content( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._list_address_historical_balance_serialize( network_id=network_id, address_id=address_id, @@ -284,15 +271,19 @@ def list_address_historical_balance_without_preload_content( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "AddressHistoricalBalanceList", + _response_types_map: Dict[str, Optional[str]] = { + '200': "AddressHistoricalBalanceList", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) return response_data.response + def _list_address_historical_balance_serialize( self, network_id, @@ -305,45 +296,56 @@ def _list_address_historical_balance_serialize( _headers, _host_index, ) -> RequestSerialized: + _host = None - _collection_formats: dict[str, str] = {} + _collection_formats: Dict[str, str] = { + } - _path_params: dict[str, str] = {} - _query_params: list[tuple[str, str]] = [] - _header_params: dict[str, str | None] = _headers or {} - _form_params: list[tuple[str, str]] = [] - _files: dict[str, str | bytes] = {} - _body_params: bytes | None = None + _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]] = {} + _body_params: Optional[bytes] = None # process the path parameters if network_id is not None: - _path_params["network_id"] = network_id + _path_params['network_id'] = network_id if address_id is not None: - _path_params["address_id"] = address_id + _path_params['address_id'] = address_id if asset_id is not None: - _path_params["asset_id"] = asset_id + _path_params['asset_id'] = asset_id # process the query parameters if limit is not None: - _query_params.append(("limit", limit)) - + + _query_params.append(('limit', limit)) + if page is not None: - _query_params.append(("page", page)) - + + _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"]) + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + # authentication setting - _auth_settings: list[str] = [] + _auth_settings: List[str] = [ + ] return self.api_client.param_serialize( - method="GET", - resource_path="/v1/networks/{network_id}/addresses/{address_id}/balance_history/{asset_id}", + method='GET', + resource_path='/v1/networks/{network_id}/addresses/{address_id}/balance_history/{asset_id}', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -353,5 +355,7 @@ def _list_address_historical_balance_serialize( auth_settings=_auth_settings, collection_formats=_collection_formats, _host=_host, - _request_auth=_request_auth, + _request_auth=_request_auth ) + + diff --git a/cdp/client/api/contract_events_api.py b/cdp/client/api/contract_events_api.py index fc20a93..a9b88d4 100644 --- a/cdp/client/api/contract_events_api.py +++ b/cdp/client/api/contract_events_api.py @@ -1,20 +1,28 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + 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 -from typing import Annotated, Any +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, StrictFloat, StrictInt, StrictStr, validate_call +from pydantic import Field, StrictInt, StrictStr +from typing import Optional +from typing_extensions import Annotated +from cdp.client.models.contract_event_list import ContractEventList from cdp.client.api_client import ApiClient, RequestSerialized from cdp.client.api_response import ApiResponse -from cdp.client.models.contract_event_list import ContractEventList from cdp.client.rest import RESTResponseType @@ -30,47 +38,29 @@ def __init__(self, api_client=None) -> None: api_client = ApiClient.get_default() self.api_client = api_client + @validate_call def list_contract_events( self, - network_id: Annotated[ - StrictStr, Field(description="Unique identifier for the blockchain network") - ], - protocol_name: Annotated[ - StrictStr, Field(description="Case-sensitive name of the blockchain protocol") - ], - contract_address: Annotated[ - StrictStr, - Field( - description="EVM address of the smart contract (42 characters, including '0x', in lowercase)" - ), - ], - contract_name: Annotated[ - StrictStr, - Field(description="Case-sensitive name of the specific contract within the project"), - ], - event_name: Annotated[ - StrictStr, - Field( - description="Case-sensitive name of the event to filter for in the contract's logs" - ), - ], - from_block_height: Annotated[ - StrictInt, Field(description="Lower bound of the block range to query (inclusive)") - ], - to_block_height: Annotated[ - StrictInt, Field(description="Upper bound of the block range to query (inclusive)") - ], - next_page: Annotated[ - StrictStr | None, - Field(description="Pagination token for retrieving the next set of results"), + network_id: Annotated[StrictStr, Field(description="Unique identifier for the blockchain network")], + protocol_name: Annotated[StrictStr, Field(description="Case-sensitive name of the blockchain protocol")], + contract_address: Annotated[StrictStr, Field(description="EVM address of the smart contract (42 characters, including '0x', in lowercase)")], + contract_name: Annotated[StrictStr, Field(description="Case-sensitive name of the specific contract within the project")], + event_name: Annotated[StrictStr, Field(description="Case-sensitive name of the event to filter for in the contract's logs")], + from_block_height: Annotated[StrictInt, Field(description="Lower bound of the block range to query (inclusive)")], + to_block_height: Annotated[StrictInt, Field(description="Upper bound of the block range to query (inclusive)")], + next_page: Annotated[Optional[StrictStr], Field(description="Pagination token for retrieving the next set of results")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] ] = None, - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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, ) -> ContractEventList: """List contract events @@ -113,7 +103,8 @@ def list_contract_events( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._list_contract_events_serialize( network_id=network_id, protocol_name=protocol_name, @@ -126,60 +117,45 @@ def list_contract_events( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "ContractEventList", + _response_types_map: Dict[str, Optional[str]] = { + '200': "ContractEventList", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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_contract_events_with_http_info( self, - network_id: Annotated[ - StrictStr, Field(description="Unique identifier for the blockchain network") - ], - protocol_name: Annotated[ - StrictStr, Field(description="Case-sensitive name of the blockchain protocol") - ], - contract_address: Annotated[ - StrictStr, - Field( - description="EVM address of the smart contract (42 characters, including '0x', in lowercase)" - ), - ], - contract_name: Annotated[ - StrictStr, - Field(description="Case-sensitive name of the specific contract within the project"), - ], - event_name: Annotated[ - StrictStr, - Field( - description="Case-sensitive name of the event to filter for in the contract's logs" - ), - ], - from_block_height: Annotated[ - StrictInt, Field(description="Lower bound of the block range to query (inclusive)") - ], - to_block_height: Annotated[ - StrictInt, Field(description="Upper bound of the block range to query (inclusive)") - ], - next_page: Annotated[ - StrictStr | None, - Field(description="Pagination token for retrieving the next set of results"), + network_id: Annotated[StrictStr, Field(description="Unique identifier for the blockchain network")], + protocol_name: Annotated[StrictStr, Field(description="Case-sensitive name of the blockchain protocol")], + contract_address: Annotated[StrictStr, Field(description="EVM address of the smart contract (42 characters, including '0x', in lowercase)")], + contract_name: Annotated[StrictStr, Field(description="Case-sensitive name of the specific contract within the project")], + event_name: Annotated[StrictStr, Field(description="Case-sensitive name of the event to filter for in the contract's logs")], + from_block_height: Annotated[StrictInt, Field(description="Lower bound of the block range to query (inclusive)")], + to_block_height: Annotated[StrictInt, Field(description="Upper bound of the block range to query (inclusive)")], + next_page: Annotated[Optional[StrictStr], Field(description="Pagination token for retrieving the next set of results")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] ] = None, - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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[ContractEventList]: """List contract events @@ -222,7 +198,8 @@ def list_contract_events_with_http_info( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._list_contract_events_serialize( network_id=network_id, protocol_name=protocol_name, @@ -235,60 +212,45 @@ def list_contract_events_with_http_info( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "ContractEventList", + _response_types_map: Dict[str, Optional[str]] = { + '200': "ContractEventList", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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_contract_events_without_preload_content( self, - network_id: Annotated[ - StrictStr, Field(description="Unique identifier for the blockchain network") - ], - protocol_name: Annotated[ - StrictStr, Field(description="Case-sensitive name of the blockchain protocol") - ], - contract_address: Annotated[ - StrictStr, - Field( - description="EVM address of the smart contract (42 characters, including '0x', in lowercase)" - ), - ], - contract_name: Annotated[ - StrictStr, - Field(description="Case-sensitive name of the specific contract within the project"), - ], - event_name: Annotated[ - StrictStr, - Field( - description="Case-sensitive name of the event to filter for in the contract's logs" - ), - ], - from_block_height: Annotated[ - StrictInt, Field(description="Lower bound of the block range to query (inclusive)") - ], - to_block_height: Annotated[ - StrictInt, Field(description="Upper bound of the block range to query (inclusive)") - ], - next_page: Annotated[ - StrictStr | None, - Field(description="Pagination token for retrieving the next set of results"), + network_id: Annotated[StrictStr, Field(description="Unique identifier for the blockchain network")], + protocol_name: Annotated[StrictStr, Field(description="Case-sensitive name of the blockchain protocol")], + contract_address: Annotated[StrictStr, Field(description="EVM address of the smart contract (42 characters, including '0x', in lowercase)")], + contract_name: Annotated[StrictStr, Field(description="Case-sensitive name of the specific contract within the project")], + event_name: Annotated[StrictStr, Field(description="Case-sensitive name of the event to filter for in the contract's logs")], + from_block_height: Annotated[StrictInt, Field(description="Lower bound of the block range to query (inclusive)")], + to_block_height: Annotated[StrictInt, Field(description="Upper bound of the block range to query (inclusive)")], + next_page: Annotated[Optional[StrictStr], Field(description="Pagination token for retrieving the next set of results")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] ] = None, - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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 contract events @@ -331,7 +293,8 @@ def list_contract_events_without_preload_content( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._list_contract_events_serialize( network_id=network_id, protocol_name=protocol_name, @@ -344,15 +307,19 @@ def list_contract_events_without_preload_content( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "ContractEventList", + _response_types_map: Dict[str, Optional[str]] = { + '200': "ContractEventList", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) return response_data.response + def _list_contract_events_serialize( self, network_id, @@ -368,55 +335,70 @@ def _list_contract_events_serialize( _headers, _host_index, ) -> RequestSerialized: + _host = None - _collection_formats: dict[str, str] = {} + _collection_formats: Dict[str, str] = { + } - _path_params: dict[str, str] = {} - _query_params: list[tuple[str, str]] = [] - _header_params: dict[str, str | None] = _headers or {} - _form_params: list[tuple[str, str]] = [] - _files: dict[str, str | bytes] = {} - _body_params: bytes | None = None + _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]] = {} + _body_params: Optional[bytes] = None # process the path parameters if network_id is not None: - _path_params["network_id"] = network_id + _path_params['network_id'] = network_id if contract_address is not None: - _path_params["contract_address"] = contract_address + _path_params['contract_address'] = contract_address # process the query parameters if protocol_name is not None: - _query_params.append(("protocol_name", protocol_name)) - + + _query_params.append(('protocol_name', protocol_name)) + if contract_name is not None: - _query_params.append(("contract_name", contract_name)) - + + _query_params.append(('contract_name', contract_name)) + if event_name is not None: - _query_params.append(("event_name", event_name)) - + + _query_params.append(('event_name', event_name)) + if from_block_height is not None: - _query_params.append(("from_block_height", from_block_height)) - + + _query_params.append(('from_block_height', from_block_height)) + if to_block_height is not None: - _query_params.append(("to_block_height", to_block_height)) - + + _query_params.append(('to_block_height', to_block_height)) + if next_page is not None: - _query_params.append(("next_page", next_page)) - + + _query_params.append(('next_page', next_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"]) + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + # authentication setting - _auth_settings: list[str] = [] + _auth_settings: List[str] = [ + ] return self.api_client.param_serialize( - method="GET", - resource_path="/v1/networks/{network_id}/smart_contracts/{contract_address}/events", + method='GET', + resource_path='/v1/networks/{network_id}/smart_contracts/{contract_address}/events', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -426,5 +408,7 @@ def _list_contract_events_serialize( auth_settings=_auth_settings, collection_formats=_collection_formats, _host=_host, - _request_auth=_request_auth, + _request_auth=_request_auth ) + + diff --git a/cdp/client/api/contract_invocations_api.py b/cdp/client/api/contract_invocations_api.py index c77a02c..d4330fa 100644 --- a/cdp/client/api/contract_invocations_api.py +++ b/cdp/client/api/contract_invocations_api.py @@ -1,25 +1,31 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from typing import Annotated, Any + Do not edit the class manually. +""" # noqa: E501 -from pydantic import Field, StrictFloat, StrictInt, StrictStr, validate_call +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 cdp.client.api_client import ApiClient, RequestSerialized -from cdp.client.api_response import ApiResponse -from cdp.client.models.broadcast_contract_invocation_request import ( - BroadcastContractInvocationRequest, -) +from pydantic import Field, StrictInt, StrictStr +from typing import Optional +from typing_extensions import Annotated +from cdp.client.models.broadcast_contract_invocation_request import BroadcastContractInvocationRequest from cdp.client.models.contract_invocation import ContractInvocation from cdp.client.models.contract_invocation_list import ContractInvocationList from cdp.client.models.create_contract_invocation_request import CreateContractInvocationRequest + +from cdp.client.api_client import ApiClient, RequestSerialized +from cdp.client.api_response import ApiResponse from cdp.client.rest import RESTResponseType @@ -35,26 +41,25 @@ def __init__(self, api_client=None) -> None: api_client = ApiClient.get_default() self.api_client = api_client + @validate_call def broadcast_contract_invocation( 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 contract invocation belongs to."), - ], - contract_invocation_id: Annotated[ - StrictStr, Field(description="The ID of the contract invocation to broadcast.") - ], + 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 contract invocation belongs to.")], + contract_invocation_id: Annotated[StrictStr, Field(description="The ID of the contract invocation to broadcast.")], broadcast_contract_invocation_request: BroadcastContractInvocationRequest, - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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, ) -> ContractInvocation: """Broadcast a contract invocation. @@ -89,7 +94,8 @@ def broadcast_contract_invocation( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._broadcast_contract_invocation_serialize( wallet_id=wallet_id, address_id=address_id, @@ -98,39 +104,41 @@ def broadcast_contract_invocation( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "ContractInvocation", + _response_types_map: Dict[str, Optional[str]] = { + '200': "ContractInvocation", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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_contract_invocation_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 contract invocation belongs to."), - ], - contract_invocation_id: Annotated[ - StrictStr, Field(description="The ID of the contract invocation to broadcast.") - ], + 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 contract invocation belongs to.")], + contract_invocation_id: Annotated[StrictStr, Field(description="The ID of the contract invocation to broadcast.")], broadcast_contract_invocation_request: BroadcastContractInvocationRequest, - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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[ContractInvocation]: """Broadcast a contract invocation. @@ -165,7 +173,8 @@ def broadcast_contract_invocation_with_http_info( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._broadcast_contract_invocation_serialize( wallet_id=wallet_id, address_id=address_id, @@ -174,39 +183,41 @@ def broadcast_contract_invocation_with_http_info( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "ContractInvocation", + _response_types_map: Dict[str, Optional[str]] = { + '200': "ContractInvocation", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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_contract_invocation_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 contract invocation belongs to."), - ], - contract_invocation_id: Annotated[ - StrictStr, Field(description="The ID of the contract invocation to broadcast.") - ], + 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 contract invocation belongs to.")], + contract_invocation_id: Annotated[StrictStr, Field(description="The ID of the contract invocation to broadcast.")], broadcast_contract_invocation_request: BroadcastContractInvocationRequest, - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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: """Broadcast a contract invocation. @@ -241,7 +252,8 @@ def broadcast_contract_invocation_without_preload_content( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._broadcast_contract_invocation_serialize( wallet_id=wallet_id, address_id=address_id, @@ -250,15 +262,19 @@ def broadcast_contract_invocation_without_preload_content( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "ContractInvocation", + _response_types_map: Dict[str, Optional[str]] = { + '200': "ContractInvocation", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) return response_data.response + def _broadcast_contract_invocation_serialize( self, wallet_id, @@ -270,24 +286,26 @@ def _broadcast_contract_invocation_serialize( _headers, _host_index, ) -> RequestSerialized: + _host = None - _collection_formats: dict[str, str] = {} + _collection_formats: Dict[str, str] = { + } - _path_params: dict[str, str] = {} - _query_params: list[tuple[str, str]] = [] - _header_params: dict[str, str | None] = _headers or {} - _form_params: list[tuple[str, str]] = [] - _files: dict[str, str | bytes] = {} - _body_params: bytes | None = None + _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]] = {} + _body_params: Optional[bytes] = None # process the path parameters if wallet_id is not None: - _path_params["wallet_id"] = wallet_id + _path_params['wallet_id'] = wallet_id if address_id is not None: - _path_params["address_id"] = address_id + _path_params['address_id'] = address_id if contract_invocation_id is not None: - _path_params["contract_invocation_id"] = contract_invocation_id + _path_params['contract_invocation_id'] = contract_invocation_id # process the query parameters # process the header parameters # process the form parameters @@ -295,24 +313,36 @@ def _broadcast_contract_invocation_serialize( if broadcast_contract_invocation_request is not None: _body_params = broadcast_contract_invocation_request + # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) + 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 + _header_params['Content-Type'] = _content_type else: - _default_content_type = self.api_client.select_header_content_type(["application/json"]) + _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 + _header_params['Content-Type'] = _default_content_type # authentication setting - _auth_settings: list[str] = [] + _auth_settings: List[str] = [ + ] return self.api_client.param_serialize( - method="POST", - resource_path="/v1/wallets/{wallet_id}/addresses/{address_id}/contract_invocations/{contract_invocation_id}/broadcast", + method='POST', + resource_path='/v1/wallets/{wallet_id}/addresses/{address_id}/contract_invocations/{contract_invocation_id}/broadcast', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -322,25 +352,29 @@ def _broadcast_contract_invocation_serialize( auth_settings=_auth_settings, collection_formats=_collection_formats, _host=_host, - _request_auth=_request_auth, + _request_auth=_request_auth ) + + + @validate_call def create_contract_invocation( self, - wallet_id: Annotated[ - StrictStr, Field(description="The ID of the wallet the source address belongs to.") - ], - address_id: Annotated[ - StrictStr, Field(description="The ID of the address to invoke the contract from.") - ], + wallet_id: Annotated[StrictStr, Field(description="The ID of the wallet the source address belongs to.")], + address_id: Annotated[StrictStr, Field(description="The ID of the address to invoke the contract from.")], create_contract_invocation_request: CreateContractInvocationRequest, - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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, ) -> ContractInvocation: """Create a new contract invocation for an address. @@ -373,7 +407,8 @@ def create_contract_invocation( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._create_contract_invocation_serialize( wallet_id=wallet_id, address_id=address_id, @@ -381,35 +416,40 @@ def create_contract_invocation( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "ContractInvocation", + _response_types_map: Dict[str, Optional[str]] = { + '200': "ContractInvocation", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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_contract_invocation_with_http_info( self, - wallet_id: Annotated[ - StrictStr, Field(description="The ID of the wallet the source address belongs to.") - ], - address_id: Annotated[ - StrictStr, Field(description="The ID of the address to invoke the contract from.") - ], + wallet_id: Annotated[StrictStr, Field(description="The ID of the wallet the source address belongs to.")], + address_id: Annotated[StrictStr, Field(description="The ID of the address to invoke the contract from.")], create_contract_invocation_request: CreateContractInvocationRequest, - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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[ContractInvocation]: """Create a new contract invocation for an address. @@ -442,7 +482,8 @@ def create_contract_invocation_with_http_info( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._create_contract_invocation_serialize( wallet_id=wallet_id, address_id=address_id, @@ -450,35 +491,40 @@ def create_contract_invocation_with_http_info( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "ContractInvocation", + _response_types_map: Dict[str, Optional[str]] = { + '200': "ContractInvocation", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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_contract_invocation_without_preload_content( self, - wallet_id: Annotated[ - StrictStr, Field(description="The ID of the wallet the source address belongs to.") - ], - address_id: Annotated[ - StrictStr, Field(description="The ID of the address to invoke the contract from.") - ], + wallet_id: Annotated[StrictStr, Field(description="The ID of the wallet the source address belongs to.")], + address_id: Annotated[StrictStr, Field(description="The ID of the address to invoke the contract from.")], create_contract_invocation_request: CreateContractInvocationRequest, - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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: """Create a new contract invocation for an address. @@ -511,7 +557,8 @@ def create_contract_invocation_without_preload_content( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._create_contract_invocation_serialize( wallet_id=wallet_id, address_id=address_id, @@ -519,15 +566,19 @@ def create_contract_invocation_without_preload_content( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "ContractInvocation", + _response_types_map: Dict[str, Optional[str]] = { + '200': "ContractInvocation", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) return response_data.response + def _create_contract_invocation_serialize( self, wallet_id, @@ -538,22 +589,24 @@ def _create_contract_invocation_serialize( _headers, _host_index, ) -> RequestSerialized: + _host = None - _collection_formats: dict[str, str] = {} + _collection_formats: Dict[str, str] = { + } - _path_params: dict[str, str] = {} - _query_params: list[tuple[str, str]] = [] - _header_params: dict[str, str | None] = _headers or {} - _form_params: list[tuple[str, str]] = [] - _files: dict[str, str | bytes] = {} - _body_params: bytes | None = None + _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]] = {} + _body_params: Optional[bytes] = None # process the path parameters if wallet_id is not None: - _path_params["wallet_id"] = wallet_id + _path_params['wallet_id'] = wallet_id if address_id is not None: - _path_params["address_id"] = address_id + _path_params['address_id'] = address_id # process the query parameters # process the header parameters # process the form parameters @@ -561,24 +614,36 @@ def _create_contract_invocation_serialize( if create_contract_invocation_request is not None: _body_params = create_contract_invocation_request + # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) + 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 + _header_params['Content-Type'] = _content_type else: - _default_content_type = self.api_client.select_header_content_type(["application/json"]) + _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 + _header_params['Content-Type'] = _default_content_type # authentication setting - _auth_settings: list[str] = [] + _auth_settings: List[str] = [ + ] return self.api_client.param_serialize( - method="POST", - resource_path="/v1/wallets/{wallet_id}/addresses/{address_id}/contract_invocations", + method='POST', + resource_path='/v1/wallets/{wallet_id}/addresses/{address_id}/contract_invocations', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -588,28 +653,29 @@ def _create_contract_invocation_serialize( auth_settings=_auth_settings, collection_formats=_collection_formats, _host=_host, - _request_auth=_request_auth, + _request_auth=_request_auth ) + + + @validate_call def get_contract_invocation( 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 contract invocation belongs to."), - ], - contract_invocation_id: Annotated[ - StrictStr, Field(description="The ID of the contract invocation to fetch.") - ], - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = None, + 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 contract invocation belongs to.")], + contract_invocation_id: Annotated[StrictStr, Field(description="The ID of the contract invocation to fetch.")], + _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, ) -> ContractInvocation: """Get a contract invocation by ID. @@ -642,7 +708,8 @@ def get_contract_invocation( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._get_contract_invocation_serialize( wallet_id=wallet_id, address_id=address_id, @@ -650,38 +717,40 @@ def get_contract_invocation( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "ContractInvocation", + _response_types_map: Dict[str, Optional[str]] = { + '200': "ContractInvocation", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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_contract_invocation_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 contract invocation belongs to."), - ], - contract_invocation_id: Annotated[ - StrictStr, Field(description="The ID of the contract invocation to fetch.") - ], - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = None, + 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 contract invocation belongs to.")], + contract_invocation_id: Annotated[StrictStr, Field(description="The ID of the contract invocation to fetch.")], + _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[ContractInvocation]: """Get a contract invocation by ID. @@ -714,7 +783,8 @@ def get_contract_invocation_with_http_info( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._get_contract_invocation_serialize( wallet_id=wallet_id, address_id=address_id, @@ -722,38 +792,40 @@ def get_contract_invocation_with_http_info( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "ContractInvocation", + _response_types_map: Dict[str, Optional[str]] = { + '200': "ContractInvocation", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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_contract_invocation_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 contract invocation belongs to."), - ], - contract_invocation_id: Annotated[ - StrictStr, Field(description="The ID of the contract invocation to fetch.") - ], - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = None, + 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 contract invocation belongs to.")], + contract_invocation_id: Annotated[StrictStr, Field(description="The ID of the contract invocation to fetch.")], + _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 contract invocation by ID. @@ -786,7 +858,8 @@ def get_contract_invocation_without_preload_content( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._get_contract_invocation_serialize( wallet_id=wallet_id, address_id=address_id, @@ -794,15 +867,19 @@ def get_contract_invocation_without_preload_content( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "ContractInvocation", + _response_types_map: Dict[str, Optional[str]] = { + '200': "ContractInvocation", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) return response_data.response + def _get_contract_invocation_serialize( self, wallet_id, @@ -813,39 +890,48 @@ def _get_contract_invocation_serialize( _headers, _host_index, ) -> RequestSerialized: + _host = None - _collection_formats: dict[str, str] = {} + _collection_formats: Dict[str, str] = { + } - _path_params: dict[str, str] = {} - _query_params: list[tuple[str, str]] = [] - _header_params: dict[str, str | None] = _headers or {} - _form_params: list[tuple[str, str]] = [] - _files: dict[str, str | bytes] = {} - _body_params: bytes | None = None + _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]] = {} + _body_params: Optional[bytes] = None # process the path parameters if wallet_id is not None: - _path_params["wallet_id"] = wallet_id + _path_params['wallet_id'] = wallet_id if address_id is not None: - _path_params["address_id"] = address_id + _path_params['address_id'] = address_id if contract_invocation_id is not None: - _path_params["contract_invocation_id"] = contract_invocation_id + _path_params['contract_invocation_id'] = contract_invocation_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"]) + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + # authentication setting - _auth_settings: list[str] = [] + _auth_settings: List[str] = [ + ] return self.api_client.param_serialize( - method="GET", - resource_path="/v1/wallets/{wallet_id}/addresses/{address_id}/contract_invocations/{contract_invocation_id}", + method='GET', + resource_path='/v1/wallets/{wallet_id}/addresses/{address_id}/contract_invocations/{contract_invocation_id}', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -855,36 +941,30 @@ def _get_contract_invocation_serialize( auth_settings=_auth_settings, collection_formats=_collection_formats, _host=_host, - _request_auth=_request_auth, + _request_auth=_request_auth ) + + + @validate_call def list_contract_invocations( 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 list contract invocations for.") - ], - limit: Annotated[ - StrictInt | None, - Field( - description="A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10." - ), - ] = None, - page: Annotated[ - Annotated[str, Field(strict=True, max_length=5000)] | None, - 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." - ), + 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 list contract invocations for.")], + 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 10.")] = 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_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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, ) -> ContractInvocationList: """List contract invocations for an address. @@ -919,7 +999,8 @@ def list_contract_invocations( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._list_contract_invocations_serialize( wallet_id=wallet_id, address_id=address_id, @@ -928,46 +1009,41 @@ def list_contract_invocations( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "ContractInvocationList", + _response_types_map: Dict[str, Optional[str]] = { + '200': "ContractInvocationList", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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_contract_invocations_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 list contract invocations for.") - ], - limit: Annotated[ - StrictInt | None, - Field( - description="A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10." - ), - ] = None, - page: Annotated[ - Annotated[str, Field(strict=True, max_length=5000)] | None, - 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." - ), + 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 list contract invocations for.")], + 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 10.")] = 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_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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[ContractInvocationList]: """List contract invocations for an address. @@ -1002,7 +1078,8 @@ def list_contract_invocations_with_http_info( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._list_contract_invocations_serialize( wallet_id=wallet_id, address_id=address_id, @@ -1011,46 +1088,41 @@ def list_contract_invocations_with_http_info( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "ContractInvocationList", + _response_types_map: Dict[str, Optional[str]] = { + '200': "ContractInvocationList", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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_contract_invocations_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 list contract invocations for.") - ], - limit: Annotated[ - StrictInt | None, - Field( - description="A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10." - ), + 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 list contract invocations for.")], + 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 10.")] = 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, - page: Annotated[ - Annotated[str, Field(strict=True, max_length=5000)] | None, - 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: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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 contract invocations for an address. @@ -1085,7 +1157,8 @@ def list_contract_invocations_without_preload_content( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._list_contract_invocations_serialize( wallet_id=wallet_id, address_id=address_id, @@ -1094,15 +1167,19 @@ def list_contract_invocations_without_preload_content( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "ContractInvocationList", + _response_types_map: Dict[str, Optional[str]] = { + '200': "ContractInvocationList", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) return response_data.response + def _list_contract_invocations_serialize( self, wallet_id, @@ -1114,43 +1191,54 @@ def _list_contract_invocations_serialize( _headers, _host_index, ) -> RequestSerialized: + _host = None - _collection_formats: dict[str, str] = {} + _collection_formats: Dict[str, str] = { + } - _path_params: dict[str, str] = {} - _query_params: list[tuple[str, str]] = [] - _header_params: dict[str, str | None] = _headers or {} - _form_params: list[tuple[str, str]] = [] - _files: dict[str, str | bytes] = {} - _body_params: bytes | None = None + _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]] = {} + _body_params: Optional[bytes] = None # process the path parameters if wallet_id is not None: - _path_params["wallet_id"] = wallet_id + _path_params['wallet_id'] = wallet_id if address_id is not None: - _path_params["address_id"] = address_id + _path_params['address_id'] = address_id # process the query parameters if limit is not None: - _query_params.append(("limit", limit)) - + + _query_params.append(('limit', limit)) + if page is not None: - _query_params.append(("page", page)) - + + _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"]) + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + # authentication setting - _auth_settings: list[str] = [] + _auth_settings: List[str] = [ + ] return self.api_client.param_serialize( - method="GET", - resource_path="/v1/wallets/{wallet_id}/addresses/{address_id}/contract_invocations", + method='GET', + resource_path='/v1/wallets/{wallet_id}/addresses/{address_id}/contract_invocations', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -1160,5 +1248,7 @@ def _list_contract_invocations_serialize( auth_settings=_auth_settings, collection_formats=_collection_formats, _host=_host, - _request_auth=_request_auth, + _request_auth=_request_auth ) + + diff --git a/cdp/client/api/external_addresses_api.py b/cdp/client/api/external_addresses_api.py index 5a8b065..197bf46 100644 --- a/cdp/client/api/external_addresses_api.py +++ b/cdp/client/api/external_addresses_api.py @@ -1,23 +1,30 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from typing import Annotated, Any + Do not edit the class manually. +""" # noqa: E501 -from pydantic import Field, StrictFloat, StrictInt, StrictStr, validate_call +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 cdp.client.api_client import ApiClient, RequestSerialized -from cdp.client.api_response import ApiResponse +from pydantic import Field, StrictStr +from typing import Optional +from typing_extensions import Annotated from cdp.client.models.address_balance_list import AddressBalanceList -from cdp.client.models.address_transaction_list import AddressTransactionList from cdp.client.models.balance import Balance from cdp.client.models.faucet_transaction import FaucetTransaction + +from cdp.client.api_client import ApiClient, RequestSerialized +from cdp.client.api_response import ApiResponse from cdp.client.rest import RESTResponseType @@ -33,22 +40,24 @@ def __init__(self, api_client=None) -> None: api_client = ApiClient.get_default() self.api_client = api_client + @validate_call def get_external_address_balance( self, network_id: Annotated[StrictStr, Field(description="The ID of the blockchain network")], - address_id: Annotated[ - StrictStr, Field(description="The ID of the address to fetch the balance for") - ], - asset_id: Annotated[ - StrictStr, Field(description="The ID of the asset to fetch the balance for") - ], - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = None, + address_id: Annotated[StrictStr, Field(description="The ID of the address to fetch the balance for")], + asset_id: Annotated[StrictStr, Field(description="The ID of the asset to fetch the balance 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, ) -> Balance: """Get the balance of an asset in an external address @@ -81,7 +90,8 @@ def get_external_address_balance( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._get_external_address_balance_serialize( network_id=network_id, address_id=address_id, @@ -89,35 +99,40 @@ def get_external_address_balance( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "Balance", + _response_types_map: Dict[str, Optional[str]] = { + '200': "Balance", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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_external_address_balance_with_http_info( self, network_id: Annotated[StrictStr, Field(description="The ID of the blockchain network")], - address_id: Annotated[ - StrictStr, Field(description="The ID of the address to fetch the balance for") - ], - asset_id: Annotated[ - StrictStr, Field(description="The ID of the asset to fetch the balance for") - ], - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = None, + address_id: Annotated[StrictStr, Field(description="The ID of the address to fetch the balance for")], + asset_id: Annotated[StrictStr, Field(description="The ID of the asset to fetch the balance 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[Balance]: """Get the balance of an asset in an external address @@ -150,7 +165,8 @@ def get_external_address_balance_with_http_info( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._get_external_address_balance_serialize( network_id=network_id, address_id=address_id, @@ -158,35 +174,40 @@ def get_external_address_balance_with_http_info( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "Balance", + _response_types_map: Dict[str, Optional[str]] = { + '200': "Balance", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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_external_address_balance_without_preload_content( self, network_id: Annotated[StrictStr, Field(description="The ID of the blockchain network")], - address_id: Annotated[ - StrictStr, Field(description="The ID of the address to fetch the balance for") - ], - asset_id: Annotated[ - StrictStr, Field(description="The ID of the asset to fetch the balance for") - ], - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = None, + address_id: Annotated[StrictStr, Field(description="The ID of the address to fetch the balance for")], + asset_id: Annotated[StrictStr, Field(description="The ID of the asset to fetch the balance 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 the balance of an asset in an external address @@ -219,7 +240,8 @@ def get_external_address_balance_without_preload_content( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._get_external_address_balance_serialize( network_id=network_id, address_id=address_id, @@ -227,15 +249,19 @@ def get_external_address_balance_without_preload_content( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "Balance", + _response_types_map: Dict[str, Optional[str]] = { + '200': "Balance", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) return response_data.response + def _get_external_address_balance_serialize( self, network_id, @@ -246,39 +272,48 @@ def _get_external_address_balance_serialize( _headers, _host_index, ) -> RequestSerialized: + _host = None - _collection_formats: dict[str, str] = {} + _collection_formats: Dict[str, str] = { + } - _path_params: dict[str, str] = {} - _query_params: list[tuple[str, str]] = [] - _header_params: dict[str, str | None] = _headers or {} - _form_params: list[tuple[str, str]] = [] - _files: dict[str, str | bytes] = {} - _body_params: bytes | None = None + _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]] = {} + _body_params: Optional[bytes] = None # process the path parameters if network_id is not None: - _path_params["network_id"] = network_id + _path_params['network_id'] = network_id if address_id is not None: - _path_params["address_id"] = address_id + _path_params['address_id'] = address_id if asset_id is not None: - _path_params["asset_id"] = asset_id + _path_params['asset_id'] = asset_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"]) + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + # authentication setting - _auth_settings: list[str] = [] + _auth_settings: List[str] = [ + ] return self.api_client.param_serialize( - method="GET", - resource_path="/v1/networks/{network_id}/addresses/{address_id}/balances/{asset_id}", + method='GET', + resource_path='/v1/networks/{network_id}/addresses/{address_id}/balances/{asset_id}', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -288,327 +323,29 @@ def _get_external_address_balance_serialize( auth_settings=_auth_settings, collection_formats=_collection_formats, _host=_host, - _request_auth=_request_auth, - ) - - @validate_call - def list_address_transactions( - self, - network_id: Annotated[StrictStr, Field(description="The ID of the blockchain network")], - address_id: Annotated[ - StrictStr, Field(description="The ID of the address to fetch the transactions for.") - ], - limit: Annotated[ - StrictInt | None, - Field( - description="A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10." - ), - ] = None, - page: Annotated[ - Annotated[str, Field(strict=True, max_length=5000)] | None, - 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: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> AddressTransactionList: - """List transactions for an address. - - List all transactions that interact with the address. - - :param network_id: The ID of the blockchain network (required) - :type network_id: str - :param address_id: The ID of the address to fetch the transactions for. (required) - :type address_id: str - :param limit: A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10. - :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. - """ - _param = self._list_address_transactions_serialize( - network_id=network_id, - address_id=address_id, - limit=limit, - page=page, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index, - ) - - _response_types_map: dict[str, str | None] = { - "200": "AddressTransactionList", - } - 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_address_transactions_with_http_info( - self, - network_id: Annotated[StrictStr, Field(description="The ID of the blockchain network")], - address_id: Annotated[ - StrictStr, Field(description="The ID of the address to fetch the transactions for.") - ], - limit: Annotated[ - StrictInt | None, - Field( - description="A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10." - ), - ] = None, - page: Annotated[ - Annotated[str, Field(strict=True, max_length=5000)] | None, - 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: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[AddressTransactionList]: - """List transactions for an address. - - List all transactions that interact with the address. - - :param network_id: The ID of the blockchain network (required) - :type network_id: str - :param address_id: The ID of the address to fetch the transactions for. (required) - :type address_id: str - :param limit: A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10. - :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. - """ - _param = self._list_address_transactions_serialize( - network_id=network_id, - address_id=address_id, - limit=limit, - page=page, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index, - ) - - _response_types_map: dict[str, str | None] = { - "200": "AddressTransactionList", - } - 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_address_transactions_without_preload_content( - self, - network_id: Annotated[StrictStr, Field(description="The ID of the blockchain network")], - address_id: Annotated[ - StrictStr, Field(description="The ID of the address to fetch the transactions for.") - ], - limit: Annotated[ - StrictInt | None, - Field( - description="A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10." - ), - ] = None, - page: Annotated[ - Annotated[str, Field(strict=True, max_length=5000)] | None, - 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: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> RESTResponseType: - """List transactions for an address. - - List all transactions that interact with the address. - - :param network_id: The ID of the blockchain network (required) - :type network_id: str - :param address_id: The ID of the address to fetch the transactions for. (required) - :type address_id: str - :param limit: A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10. - :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. - """ - _param = self._list_address_transactions_serialize( - network_id=network_id, - address_id=address_id, - limit=limit, - page=page, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index, + _request_auth=_request_auth ) - _response_types_map: dict[str, str | None] = { - "200": "AddressTransactionList", - } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) - return response_data.response - - def _list_address_transactions_serialize( - self, - network_id, - address_id, - 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, str | None] = _headers or {} - _form_params: list[tuple[str, str]] = [] - _files: dict[str, str | bytes] = {} - _body_params: bytes | None = None - - # process the path parameters - if network_id is not None: - _path_params["network_id"] = network_id - if address_id is not None: - _path_params["address_id"] = address_id - # process the query parameters - 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}/addresses/{address_id}/transactions", - 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_external_address_balances( self, network_id: Annotated[StrictStr, Field(description="The ID of the blockchain network")], - address_id: Annotated[ - StrictStr, Field(description="The ID of the address to fetch the balance for") - ], - page: Annotated[ - Annotated[str, Field(strict=True, max_length=5000)] | None, - 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." - ), + address_id: Annotated[StrictStr, Field(description="The ID of the address to fetch the balance for")], + 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_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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, ) -> AddressBalanceList: """Get the balances of an external address @@ -641,7 +378,8 @@ def list_external_address_balances( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._list_external_address_balances_serialize( network_id=network_id, address_id=address_id, @@ -649,38 +387,40 @@ def list_external_address_balances( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "AddressBalanceList", + _response_types_map: Dict[str, Optional[str]] = { + '200': "AddressBalanceList", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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_external_address_balances_with_http_info( self, network_id: Annotated[StrictStr, Field(description="The ID of the blockchain network")], - address_id: Annotated[ - StrictStr, Field(description="The ID of the address to fetch the balance for") - ], - page: Annotated[ - Annotated[str, Field(strict=True, max_length=5000)] | None, - 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." - ), + address_id: Annotated[StrictStr, Field(description="The ID of the address to fetch the balance for")], + 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_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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[AddressBalanceList]: """Get the balances of an external address @@ -713,7 +453,8 @@ def list_external_address_balances_with_http_info( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._list_external_address_balances_serialize( network_id=network_id, address_id=address_id, @@ -721,38 +462,40 @@ def list_external_address_balances_with_http_info( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "AddressBalanceList", + _response_types_map: Dict[str, Optional[str]] = { + '200': "AddressBalanceList", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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_external_address_balances_without_preload_content( self, network_id: Annotated[StrictStr, Field(description="The ID of the blockchain network")], - address_id: Annotated[ - StrictStr, Field(description="The ID of the address to fetch the balance for") - ], - page: Annotated[ - Annotated[str, Field(strict=True, max_length=5000)] | None, - 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." - ), + address_id: Annotated[StrictStr, Field(description="The ID of the address to fetch the balance for")], + 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_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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 balances of an external address @@ -785,7 +528,8 @@ def list_external_address_balances_without_preload_content( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._list_external_address_balances_serialize( network_id=network_id, address_id=address_id, @@ -793,15 +537,19 @@ def list_external_address_balances_without_preload_content( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "AddressBalanceList", + _response_types_map: Dict[str, Optional[str]] = { + '200': "AddressBalanceList", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) return response_data.response + def _list_external_address_balances_serialize( self, network_id, @@ -812,40 +560,50 @@ def _list_external_address_balances_serialize( _headers, _host_index, ) -> RequestSerialized: + _host = None - _collection_formats: dict[str, str] = {} + _collection_formats: Dict[str, str] = { + } - _path_params: dict[str, str] = {} - _query_params: list[tuple[str, str]] = [] - _header_params: dict[str, str | None] = _headers or {} - _form_params: list[tuple[str, str]] = [] - _files: dict[str, str | bytes] = {} - _body_params: bytes | None = None + _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]] = {} + _body_params: Optional[bytes] = None # process the path parameters if network_id is not None: - _path_params["network_id"] = network_id + _path_params['network_id'] = network_id if address_id is not None: - _path_params["address_id"] = address_id + _path_params['address_id'] = address_id # process the query parameters if page is not None: - _query_params.append(("page", page)) - + + _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"]) + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + # authentication setting - _auth_settings: list[str] = [] + _auth_settings: List[str] = [ + ] return self.api_client.param_serialize( - method="GET", - resource_path="/v1/networks/{network_id}/addresses/{address_id}/balances", + method='GET', + resource_path='/v1/networks/{network_id}/addresses/{address_id}/balances', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -855,28 +613,29 @@ def _list_external_address_balances_serialize( auth_settings=_auth_settings, collection_formats=_collection_formats, _host=_host, - _request_auth=_request_auth, + _request_auth=_request_auth ) + + + @validate_call def request_external_faucet_funds( self, - network_id: Annotated[ - StrictStr, Field(description="The ID of the wallet the address belongs to.") - ], - address_id: Annotated[ - StrictStr, - Field(description="The onchain address of the address that is being fetched."), - ], - asset_id: Annotated[ - StrictStr | None, Field(description="The ID of the asset to transfer from the faucet.") + network_id: Annotated[StrictStr, Field(description="The ID of the wallet the address belongs to.")], + address_id: Annotated[StrictStr, Field(description="The onchain address of the address that is being fetched.")], + asset_id: Annotated[Optional[StrictStr], Field(description="The ID of the asset to transfer from the faucet.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] ] = None, - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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, ) -> FaucetTransaction: """Request faucet funds for external address. @@ -909,7 +668,8 @@ def request_external_faucet_funds( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._request_external_faucet_funds_serialize( network_id=network_id, address_id=address_id, @@ -917,38 +677,40 @@ def request_external_faucet_funds( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "FaucetTransaction", + _response_types_map: Dict[str, Optional[str]] = { + '200': "FaucetTransaction", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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 request_external_faucet_funds_with_http_info( self, - network_id: Annotated[ - StrictStr, Field(description="The ID of the wallet the address belongs to.") - ], - address_id: Annotated[ - StrictStr, - Field(description="The onchain address of the address that is being fetched."), - ], - asset_id: Annotated[ - StrictStr | None, Field(description="The ID of the asset to transfer from the faucet.") + network_id: Annotated[StrictStr, Field(description="The ID of the wallet the address belongs to.")], + address_id: Annotated[StrictStr, Field(description="The onchain address of the address that is being fetched.")], + asset_id: Annotated[Optional[StrictStr], Field(description="The ID of the asset to transfer from the faucet.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] ] = None, - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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[FaucetTransaction]: """Request faucet funds for external address. @@ -981,7 +743,8 @@ def request_external_faucet_funds_with_http_info( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._request_external_faucet_funds_serialize( network_id=network_id, address_id=address_id, @@ -989,38 +752,40 @@ def request_external_faucet_funds_with_http_info( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "FaucetTransaction", + _response_types_map: Dict[str, Optional[str]] = { + '200': "FaucetTransaction", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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 request_external_faucet_funds_without_preload_content( self, - network_id: Annotated[ - StrictStr, Field(description="The ID of the wallet the address belongs to.") - ], - address_id: Annotated[ - StrictStr, - Field(description="The onchain address of the address that is being fetched."), - ], - asset_id: Annotated[ - StrictStr | None, Field(description="The ID of the asset to transfer from the faucet.") + network_id: Annotated[StrictStr, Field(description="The ID of the wallet the address belongs to.")], + address_id: Annotated[StrictStr, Field(description="The onchain address of the address that is being fetched.")], + asset_id: Annotated[Optional[StrictStr], Field(description="The ID of the asset to transfer from the faucet.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] ] = None, - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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: """Request faucet funds for external address. @@ -1053,7 +818,8 @@ def request_external_faucet_funds_without_preload_content( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._request_external_faucet_funds_serialize( network_id=network_id, address_id=address_id, @@ -1061,15 +827,19 @@ def request_external_faucet_funds_without_preload_content( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "FaucetTransaction", + _response_types_map: Dict[str, Optional[str]] = { + '200': "FaucetTransaction", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) return response_data.response + def _request_external_faucet_funds_serialize( self, network_id, @@ -1080,40 +850,50 @@ def _request_external_faucet_funds_serialize( _headers, _host_index, ) -> RequestSerialized: + _host = None - _collection_formats: dict[str, str] = {} + _collection_formats: Dict[str, str] = { + } - _path_params: dict[str, str] = {} - _query_params: list[tuple[str, str]] = [] - _header_params: dict[str, str | None] = _headers or {} - _form_params: list[tuple[str, str]] = [] - _files: dict[str, str | bytes] = {} - _body_params: bytes | None = None + _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]] = {} + _body_params: Optional[bytes] = None # process the path parameters if network_id is not None: - _path_params["network_id"] = network_id + _path_params['network_id'] = network_id if address_id is not None: - _path_params["address_id"] = address_id + _path_params['address_id'] = address_id # process the query parameters if asset_id is not None: - _query_params.append(("asset_id", asset_id)) - + + _query_params.append(('asset_id', asset_id)) + # 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"]) + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + # authentication setting - _auth_settings: list[str] = [] + _auth_settings: List[str] = [ + ] return self.api_client.param_serialize( - method="POST", - resource_path="/v1/networks/{network_id}/addresses/{address_id}/faucet", + method='POST', + resource_path='/v1/networks/{network_id}/addresses/{address_id}/faucet', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -1123,5 +903,7 @@ def _request_external_faucet_funds_serialize( auth_settings=_auth_settings, collection_formats=_collection_formats, _host=_host, - _request_auth=_request_auth, + _request_auth=_request_auth ) + + diff --git a/cdp/client/api/networks_api.py b/cdp/client/api/networks_api.py index 2b33d9d..954fc20 100644 --- a/cdp/client/api/networks_api.py +++ b/cdp/client/api/networks_api.py @@ -1,20 +1,27 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + 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 -from typing import Annotated, Any +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, StrictFloat, StrictInt, StrictStr, validate_call +from pydantic import Field, StrictStr +from typing_extensions import Annotated +from cdp.client.models.network import Network from cdp.client.api_client import ApiClient, RequestSerialized from cdp.client.api_response import ApiResponse -from cdp.client.models.network import Network from cdp.client.rest import RESTResponseType @@ -30,16 +37,22 @@ def __init__(self, api_client=None) -> None: api_client = ApiClient.get_default() self.api_client = api_client + @validate_call def get_network( self, network_id: Annotated[StrictStr, Field(description="The ID of the network to fetch.")], - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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, ) -> Network: """Get network by ID @@ -68,35 +81,45 @@ def get_network( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._get_network_serialize( network_id=network_id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "Network", + _response_types_map: Dict[str, Optional[str]] = { + '200': "Network", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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_network_with_http_info( self, network_id: Annotated[StrictStr, Field(description="The ID of the network to fetch.")], - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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[Network]: """Get network by ID @@ -125,35 +148,45 @@ def get_network_with_http_info( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._get_network_serialize( network_id=network_id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "Network", + _response_types_map: Dict[str, Optional[str]] = { + '200': "Network", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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_network_without_preload_content( self, network_id: Annotated[StrictStr, Field(description="The ID of the network to fetch.")], - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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: """Get network by ID @@ -182,21 +215,26 @@ def get_network_without_preload_content( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._get_network_serialize( network_id=network_id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "Network", + _response_types_map: Dict[str, Optional[str]] = { + '200': "Network", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) return response_data.response + def _get_network_serialize( self, network_id, @@ -205,35 +243,44 @@ def _get_network_serialize( _headers, _host_index, ) -> RequestSerialized: + _host = None - _collection_formats: dict[str, str] = {} + _collection_formats: Dict[str, str] = { + } - _path_params: dict[str, str] = {} - _query_params: list[tuple[str, str]] = [] - _header_params: dict[str, str | None] = _headers or {} - _form_params: list[tuple[str, str]] = [] - _files: dict[str, str | bytes] = {} - _body_params: bytes | None = None + _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]] = {} + _body_params: Optional[bytes] = None # process the path parameters if network_id is not None: - _path_params["network_id"] = network_id + _path_params['network_id'] = network_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"]) + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + # authentication setting - _auth_settings: list[str] = [] + _auth_settings: List[str] = [ + ] return self.api_client.param_serialize( - method="GET", - resource_path="/v1/networks/{network_id}", + method='GET', + resource_path='/v1/networks/{network_id}', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -243,5 +290,7 @@ def _get_network_serialize( auth_settings=_auth_settings, collection_formats=_collection_formats, _host=_host, - _request_auth=_request_auth, + _request_auth=_request_auth ) + + diff --git a/cdp/client/api/server_signers_api.py b/cdp/client/api/server_signers_api.py index a101cb8..7c570c2 100644 --- a/cdp/client/api/server_signers_api.py +++ b/cdp/client/api/server_signers_api.py @@ -1,25 +1,33 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from typing import Annotated, Any + Do not edit the class manually. +""" # noqa: E501 -from pydantic import Field, StrictFloat, StrictInt, StrictStr, validate_call +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 cdp.client.api_client import ApiClient, RequestSerialized -from cdp.client.api_response import ApiResponse +from pydantic import Field, StrictInt, StrictStr +from typing import Optional +from typing_extensions import Annotated from cdp.client.models.create_server_signer_request import CreateServerSignerRequest from cdp.client.models.seed_creation_event_result import SeedCreationEventResult from cdp.client.models.server_signer import ServerSigner from cdp.client.models.server_signer_event_list import ServerSignerEventList from cdp.client.models.server_signer_list import ServerSignerList from cdp.client.models.signature_creation_event_result import SignatureCreationEventResult + +from cdp.client.api_client import ApiClient, RequestSerialized +from cdp.client.api_response import ApiResponse from cdp.client.rest import RESTResponseType @@ -35,16 +43,22 @@ def __init__(self, api_client=None) -> None: api_client = ApiClient.get_default() self.api_client = api_client + @validate_call def create_server_signer( self, - create_server_signer_request: CreateServerSignerRequest | None = None, - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = None, + create_server_signer_request: Optional[CreateServerSignerRequest] = 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, ) -> ServerSigner: """Create a new Server-Signer @@ -73,35 +87,45 @@ def create_server_signer( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._create_server_signer_serialize( create_server_signer_request=create_server_signer_request, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "ServerSigner", + _response_types_map: Dict[str, Optional[str]] = { + '200': "ServerSigner", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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_server_signer_with_http_info( self, - create_server_signer_request: CreateServerSignerRequest | None = None, - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = None, + create_server_signer_request: Optional[CreateServerSignerRequest] = 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[ServerSigner]: """Create a new Server-Signer @@ -130,35 +154,45 @@ def create_server_signer_with_http_info( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._create_server_signer_serialize( create_server_signer_request=create_server_signer_request, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "ServerSigner", + _response_types_map: Dict[str, Optional[str]] = { + '200': "ServerSigner", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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_server_signer_without_preload_content( self, - create_server_signer_request: CreateServerSignerRequest | None = None, - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = None, + create_server_signer_request: Optional[CreateServerSignerRequest] = 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: """Create a new Server-Signer @@ -187,21 +221,26 @@ def create_server_signer_without_preload_content( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._create_server_signer_serialize( create_server_signer_request=create_server_signer_request, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "ServerSigner", + _response_types_map: Dict[str, Optional[str]] = { + '200': "ServerSigner", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) return response_data.response + def _create_server_signer_serialize( self, create_server_signer_request, @@ -210,16 +249,18 @@ def _create_server_signer_serialize( _headers, _host_index, ) -> RequestSerialized: + _host = None - _collection_formats: dict[str, str] = {} + _collection_formats: Dict[str, str] = { + } - _path_params: dict[str, str] = {} - _query_params: list[tuple[str, str]] = [] - _header_params: dict[str, str | None] = _headers or {} - _form_params: list[tuple[str, str]] = [] - _files: dict[str, str | bytes] = {} - _body_params: bytes | None = None + _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]] = {} + _body_params: Optional[bytes] = None # process the path parameters # process the query parameters @@ -229,24 +270,36 @@ def _create_server_signer_serialize( if create_server_signer_request is not None: _body_params = create_server_signer_request + # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) + 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 + _header_params['Content-Type'] = _content_type else: - _default_content_type = self.api_client.select_header_content_type(["application/json"]) + _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 + _header_params['Content-Type'] = _default_content_type # authentication setting - _auth_settings: list[str] = [] + _auth_settings: List[str] = [ + ] return self.api_client.param_serialize( - method="POST", - resource_path="/v1/server_signers", + method='POST', + resource_path='/v1/server_signers', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -256,21 +309,27 @@ def _create_server_signer_serialize( auth_settings=_auth_settings, collection_formats=_collection_formats, _host=_host, - _request_auth=_request_auth, + _request_auth=_request_auth ) + + + @validate_call def get_server_signer( self, - server_signer_id: Annotated[ - StrictStr, Field(description="The ID of the server signer to fetch") - ], - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = None, + server_signer_id: Annotated[StrictStr, Field(description="The ID of the server signer to fetch")], + _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, ) -> ServerSigner: """Get a server signer by ID @@ -299,37 +358,45 @@ def get_server_signer( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._get_server_signer_serialize( server_signer_id=server_signer_id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "ServerSigner", + _response_types_map: Dict[str, Optional[str]] = { + '200': "ServerSigner", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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_server_signer_with_http_info( self, - server_signer_id: Annotated[ - StrictStr, Field(description="The ID of the server signer to fetch") - ], - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = None, + server_signer_id: Annotated[StrictStr, Field(description="The ID of the server signer to fetch")], + _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[ServerSigner]: """Get a server signer by ID @@ -358,37 +425,45 @@ def get_server_signer_with_http_info( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._get_server_signer_serialize( server_signer_id=server_signer_id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "ServerSigner", + _response_types_map: Dict[str, Optional[str]] = { + '200': "ServerSigner", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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_server_signer_without_preload_content( self, - server_signer_id: Annotated[ - StrictStr, Field(description="The ID of the server signer to fetch") - ], - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = None, + server_signer_id: Annotated[StrictStr, Field(description="The ID of the server signer to fetch")], + _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 server signer by ID @@ -417,21 +492,26 @@ def get_server_signer_without_preload_content( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._get_server_signer_serialize( server_signer_id=server_signer_id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "ServerSigner", + _response_types_map: Dict[str, Optional[str]] = { + '200': "ServerSigner", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) return response_data.response + def _get_server_signer_serialize( self, server_signer_id, @@ -440,35 +520,44 @@ def _get_server_signer_serialize( _headers, _host_index, ) -> RequestSerialized: + _host = None - _collection_formats: dict[str, str] = {} + _collection_formats: Dict[str, str] = { + } - _path_params: dict[str, str] = {} - _query_params: list[tuple[str, str]] = [] - _header_params: dict[str, str | None] = _headers or {} - _form_params: list[tuple[str, str]] = [] - _files: dict[str, str | bytes] = {} - _body_params: bytes | None = None + _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]] = {} + _body_params: Optional[bytes] = None # process the path parameters if server_signer_id is not None: - _path_params["server_signer_id"] = server_signer_id + _path_params['server_signer_id'] = server_signer_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"]) + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + # authentication setting - _auth_settings: list[str] = [] + _auth_settings: List[str] = [ + ] return self.api_client.param_serialize( - method="GET", - resource_path="/v1/server_signers/{server_signer_id}", + method='GET', + resource_path='/v1/server_signers/{server_signer_id}', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -478,36 +567,32 @@ def _get_server_signer_serialize( auth_settings=_auth_settings, collection_formats=_collection_formats, _host=_host, - _request_auth=_request_auth, + _request_auth=_request_auth ) + + + @validate_call def list_server_signer_events( self, - server_signer_id: Annotated[ - StrictStr, Field(description="The ID of the server signer to fetch events for") - ], - limit: Annotated[ - StrictInt | None, - Field( - description="A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10." - ), - ] = None, - page: Annotated[ - Annotated[str, Field(strict=True, max_length=5000)] | None, - 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." - ), + server_signer_id: Annotated[StrictStr, Field(description="The ID of the server signer to fetch events for")], + 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 10.")] = 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_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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, ) -> ServerSignerEventList: - """List events for a server signer + """(Deprecated) List events for a server signer List events for a server signer @@ -537,7 +622,9 @@ def list_server_signer_events( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + warnings.warn("GET /v1/server_signers/{server_signer_id}/events is deprecated.", DeprecationWarning) + _param = self._list_server_signer_events_serialize( server_signer_id=server_signer_id, limit=limit, @@ -545,46 +632,43 @@ def list_server_signer_events( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "ServerSignerEventList", + _response_types_map: Dict[str, Optional[str]] = { + '200': "ServerSignerEventList", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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_server_signer_events_with_http_info( self, - server_signer_id: Annotated[ - StrictStr, Field(description="The ID of the server signer to fetch events for") - ], - limit: Annotated[ - StrictInt | None, - Field( - description="A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10." - ), - ] = None, - page: Annotated[ - Annotated[str, Field(strict=True, max_length=5000)] | None, - 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." - ), + server_signer_id: Annotated[StrictStr, Field(description="The ID of the server signer to fetch events for")], + 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 10.")] = 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_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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[ServerSignerEventList]: - """List events for a server signer + """(Deprecated) List events for a server signer List events for a server signer @@ -614,7 +698,9 @@ def list_server_signer_events_with_http_info( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + warnings.warn("GET /v1/server_signers/{server_signer_id}/events is deprecated.", DeprecationWarning) + _param = self._list_server_signer_events_serialize( server_signer_id=server_signer_id, limit=limit, @@ -622,46 +708,43 @@ def list_server_signer_events_with_http_info( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "ServerSignerEventList", + _response_types_map: Dict[str, Optional[str]] = { + '200': "ServerSignerEventList", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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_server_signer_events_without_preload_content( self, - server_signer_id: Annotated[ - StrictStr, Field(description="The ID of the server signer to fetch events for") - ], - limit: Annotated[ - StrictInt | None, - Field( - description="A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10." - ), - ] = None, - page: Annotated[ - Annotated[str, Field(strict=True, max_length=5000)] | None, - 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." - ), + server_signer_id: Annotated[StrictStr, Field(description="The ID of the server signer to fetch events for")], + 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 10.")] = 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_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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 events for a server signer + """(Deprecated) List events for a server signer List events for a server signer @@ -691,7 +774,9 @@ def list_server_signer_events_without_preload_content( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + warnings.warn("GET /v1/server_signers/{server_signer_id}/events is deprecated.", DeprecationWarning) + _param = self._list_server_signer_events_serialize( server_signer_id=server_signer_id, limit=limit, @@ -699,15 +784,19 @@ def list_server_signer_events_without_preload_content( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "ServerSignerEventList", + _response_types_map: Dict[str, Optional[str]] = { + '200': "ServerSignerEventList", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) return response_data.response + def _list_server_signer_events_serialize( self, server_signer_id, @@ -718,41 +807,52 @@ def _list_server_signer_events_serialize( _headers, _host_index, ) -> RequestSerialized: + _host = None - _collection_formats: dict[str, str] = {} + _collection_formats: Dict[str, str] = { + } - _path_params: dict[str, str] = {} - _query_params: list[tuple[str, str]] = [] - _header_params: dict[str, str | None] = _headers or {} - _form_params: list[tuple[str, str]] = [] - _files: dict[str, str | bytes] = {} - _body_params: bytes | None = None + _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]] = {} + _body_params: Optional[bytes] = None # process the path parameters if server_signer_id is not None: - _path_params["server_signer_id"] = server_signer_id + _path_params['server_signer_id'] = server_signer_id # process the query parameters if limit is not None: - _query_params.append(("limit", limit)) - + + _query_params.append(('limit', limit)) + if page is not None: - _query_params.append(("page", page)) - + + _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"]) + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + # authentication setting - _auth_settings: list[str] = [] + _auth_settings: List[str] = [ + ] return self.api_client.param_serialize( - method="GET", - resource_path="/v1/server_signers/{server_signer_id}/events", + method='GET', + resource_path='/v1/server_signers/{server_signer_id}/events', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -762,30 +862,28 @@ def _list_server_signer_events_serialize( auth_settings=_auth_settings, collection_formats=_collection_formats, _host=_host, - _request_auth=_request_auth, + _request_auth=_request_auth ) + + + @validate_call def list_server_signers( self, - limit: Annotated[ - StrictInt | None, - Field( - description="A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10." - ), - ] = None, - page: Annotated[ - Annotated[str, Field(strict=True, max_length=5000)] | None, - 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." - ), + 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 10.")] = 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_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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, ) -> ServerSignerList: """List server signers for the current project @@ -816,47 +914,47 @@ def list_server_signers( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._list_server_signers_serialize( limit=limit, page=page, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "ServerSignerList", + _response_types_map: Dict[str, Optional[str]] = { + '200': "ServerSignerList", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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_server_signers_with_http_info( self, - limit: Annotated[ - StrictInt | None, - Field( - description="A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10." - ), - ] = None, - page: Annotated[ - Annotated[str, Field(strict=True, max_length=5000)] | None, - 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." - ), + 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 10.")] = 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_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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[ServerSignerList]: """List server signers for the current project @@ -887,47 +985,47 @@ def list_server_signers_with_http_info( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._list_server_signers_serialize( limit=limit, page=page, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "ServerSignerList", + _response_types_map: Dict[str, Optional[str]] = { + '200': "ServerSignerList", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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_server_signers_without_preload_content( self, - limit: Annotated[ - StrictInt | None, - Field( - description="A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10." - ), - ] = None, - page: Annotated[ - Annotated[str, Field(strict=True, max_length=5000)] | None, - 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." - ), + 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 10.")] = 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_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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 server signers for the current project @@ -958,22 +1056,27 @@ def list_server_signers_without_preload_content( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._list_server_signers_serialize( limit=limit, page=page, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "ServerSignerList", + _response_types_map: Dict[str, Optional[str]] = { + '200': "ServerSignerList", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) return response_data.response + def _list_server_signers_serialize( self, limit, @@ -983,39 +1086,50 @@ def _list_server_signers_serialize( _headers, _host_index, ) -> RequestSerialized: + _host = None - _collection_formats: dict[str, str] = {} + _collection_formats: Dict[str, str] = { + } - _path_params: dict[str, str] = {} - _query_params: list[tuple[str, str]] = [] - _header_params: dict[str, str | None] = _headers or {} - _form_params: list[tuple[str, str]] = [] - _files: dict[str, str | bytes] = {} - _body_params: bytes | None = None + _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]] = {} + _body_params: Optional[bytes] = None # process the path parameters # process the query parameters if limit is not None: - _query_params.append(("limit", limit)) - + + _query_params.append(('limit', limit)) + if page is not None: - _query_params.append(("page", page)) - + + _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"]) + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + # authentication setting - _auth_settings: list[str] = [] + _auth_settings: List[str] = [ + ] return self.api_client.param_serialize( - method="GET", - resource_path="/v1/server_signers", + method='GET', + resource_path='/v1/server_signers', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -1025,23 +1139,28 @@ def _list_server_signers_serialize( auth_settings=_auth_settings, collection_formats=_collection_formats, _host=_host, - _request_auth=_request_auth, + _request_auth=_request_auth ) + + + @validate_call def submit_server_signer_seed_event_result( self, - server_signer_id: Annotated[ - StrictStr, - Field(description="The ID of the server signer to submit the event result for"), - ], - seed_creation_event_result: SeedCreationEventResult | None = None, - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = None, + server_signer_id: Annotated[StrictStr, Field(description="The ID of the server signer to submit the event result for")], + seed_creation_event_result: Optional[SeedCreationEventResult] = 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, ) -> SeedCreationEventResult: """Submit the result of a server signer event @@ -1072,40 +1191,47 @@ def submit_server_signer_seed_event_result( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._submit_server_signer_seed_event_result_serialize( server_signer_id=server_signer_id, seed_creation_event_result=seed_creation_event_result, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "SeedCreationEventResult", + _response_types_map: Dict[str, Optional[str]] = { + '200': "SeedCreationEventResult", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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 submit_server_signer_seed_event_result_with_http_info( self, - server_signer_id: Annotated[ - StrictStr, - Field(description="The ID of the server signer to submit the event result for"), - ], - seed_creation_event_result: SeedCreationEventResult | None = None, - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = None, + server_signer_id: Annotated[StrictStr, Field(description="The ID of the server signer to submit the event result for")], + seed_creation_event_result: Optional[SeedCreationEventResult] = 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[SeedCreationEventResult]: """Submit the result of a server signer event @@ -1136,40 +1262,47 @@ def submit_server_signer_seed_event_result_with_http_info( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._submit_server_signer_seed_event_result_serialize( server_signer_id=server_signer_id, seed_creation_event_result=seed_creation_event_result, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "SeedCreationEventResult", + _response_types_map: Dict[str, Optional[str]] = { + '200': "SeedCreationEventResult", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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 submit_server_signer_seed_event_result_without_preload_content( self, - server_signer_id: Annotated[ - StrictStr, - Field(description="The ID of the server signer to submit the event result for"), - ], - seed_creation_event_result: SeedCreationEventResult | None = None, - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = None, + server_signer_id: Annotated[StrictStr, Field(description="The ID of the server signer to submit the event result for")], + seed_creation_event_result: Optional[SeedCreationEventResult] = 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: """Submit the result of a server signer event @@ -1200,22 +1333,27 @@ def submit_server_signer_seed_event_result_without_preload_content( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._submit_server_signer_seed_event_result_serialize( server_signer_id=server_signer_id, seed_creation_event_result=seed_creation_event_result, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "SeedCreationEventResult", + _response_types_map: Dict[str, Optional[str]] = { + '200': "SeedCreationEventResult", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) return response_data.response + def _submit_server_signer_seed_event_result_serialize( self, server_signer_id, @@ -1225,20 +1363,22 @@ def _submit_server_signer_seed_event_result_serialize( _headers, _host_index, ) -> RequestSerialized: + _host = None - _collection_formats: dict[str, str] = {} + _collection_formats: Dict[str, str] = { + } - _path_params: dict[str, str] = {} - _query_params: list[tuple[str, str]] = [] - _header_params: dict[str, str | None] = _headers or {} - _form_params: list[tuple[str, str]] = [] - _files: dict[str, str | bytes] = {} - _body_params: bytes | None = None + _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]] = {} + _body_params: Optional[bytes] = None # process the path parameters if server_signer_id is not None: - _path_params["server_signer_id"] = server_signer_id + _path_params['server_signer_id'] = server_signer_id # process the query parameters # process the header parameters # process the form parameters @@ -1246,24 +1386,36 @@ def _submit_server_signer_seed_event_result_serialize( if seed_creation_event_result is not None: _body_params = seed_creation_event_result + # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) + 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 + _header_params['Content-Type'] = _content_type else: - _default_content_type = self.api_client.select_header_content_type(["application/json"]) + _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 + _header_params['Content-Type'] = _default_content_type # authentication setting - _auth_settings: list[str] = [] + _auth_settings: List[str] = [ + ] return self.api_client.param_serialize( - method="POST", - resource_path="/v1/server_signers/{server_signer_id}/seed_event_result", + method='POST', + resource_path='/v1/server_signers/{server_signer_id}/seed_event_result', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -1273,23 +1425,28 @@ def _submit_server_signer_seed_event_result_serialize( auth_settings=_auth_settings, collection_formats=_collection_formats, _host=_host, - _request_auth=_request_auth, + _request_auth=_request_auth ) + + + @validate_call def submit_server_signer_signature_event_result( self, - server_signer_id: Annotated[ - StrictStr, - Field(description="The ID of the server signer to submit the event result for"), - ], - signature_creation_event_result: SignatureCreationEventResult | None = None, - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = None, + server_signer_id: Annotated[StrictStr, Field(description="The ID of the server signer to submit the event result for")], + signature_creation_event_result: Optional[SignatureCreationEventResult] = 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, ) -> SignatureCreationEventResult: """Submit the result of a server signer event @@ -1320,40 +1477,47 @@ def submit_server_signer_signature_event_result( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._submit_server_signer_signature_event_result_serialize( server_signer_id=server_signer_id, signature_creation_event_result=signature_creation_event_result, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "SignatureCreationEventResult", + _response_types_map: Dict[str, Optional[str]] = { + '200': "SignatureCreationEventResult", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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 submit_server_signer_signature_event_result_with_http_info( self, - server_signer_id: Annotated[ - StrictStr, - Field(description="The ID of the server signer to submit the event result for"), - ], - signature_creation_event_result: SignatureCreationEventResult | None = None, - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = None, + server_signer_id: Annotated[StrictStr, Field(description="The ID of the server signer to submit the event result for")], + signature_creation_event_result: Optional[SignatureCreationEventResult] = 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[SignatureCreationEventResult]: """Submit the result of a server signer event @@ -1384,40 +1548,47 @@ def submit_server_signer_signature_event_result_with_http_info( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._submit_server_signer_signature_event_result_serialize( server_signer_id=server_signer_id, signature_creation_event_result=signature_creation_event_result, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "SignatureCreationEventResult", + _response_types_map: Dict[str, Optional[str]] = { + '200': "SignatureCreationEventResult", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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 submit_server_signer_signature_event_result_without_preload_content( self, - server_signer_id: Annotated[ - StrictStr, - Field(description="The ID of the server signer to submit the event result for"), - ], - signature_creation_event_result: SignatureCreationEventResult | None = None, - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = None, + server_signer_id: Annotated[StrictStr, Field(description="The ID of the server signer to submit the event result for")], + signature_creation_event_result: Optional[SignatureCreationEventResult] = 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: """Submit the result of a server signer event @@ -1448,22 +1619,27 @@ def submit_server_signer_signature_event_result_without_preload_content( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._submit_server_signer_signature_event_result_serialize( server_signer_id=server_signer_id, signature_creation_event_result=signature_creation_event_result, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "SignatureCreationEventResult", + _response_types_map: Dict[str, Optional[str]] = { + '200': "SignatureCreationEventResult", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) return response_data.response + def _submit_server_signer_signature_event_result_serialize( self, server_signer_id, @@ -1473,20 +1649,22 @@ def _submit_server_signer_signature_event_result_serialize( _headers, _host_index, ) -> RequestSerialized: + _host = None - _collection_formats: dict[str, str] = {} + _collection_formats: Dict[str, str] = { + } - _path_params: dict[str, str] = {} - _query_params: list[tuple[str, str]] = [] - _header_params: dict[str, str | None] = _headers or {} - _form_params: list[tuple[str, str]] = [] - _files: dict[str, str | bytes] = {} - _body_params: bytes | None = None + _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]] = {} + _body_params: Optional[bytes] = None # process the path parameters if server_signer_id is not None: - _path_params["server_signer_id"] = server_signer_id + _path_params['server_signer_id'] = server_signer_id # process the query parameters # process the header parameters # process the form parameters @@ -1494,24 +1672,36 @@ def _submit_server_signer_signature_event_result_serialize( if signature_creation_event_result is not None: _body_params = signature_creation_event_result + # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) + 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 + _header_params['Content-Type'] = _content_type else: - _default_content_type = self.api_client.select_header_content_type(["application/json"]) + _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 + _header_params['Content-Type'] = _default_content_type # authentication setting - _auth_settings: list[str] = [] + _auth_settings: List[str] = [ + ] return self.api_client.param_serialize( - method="POST", - resource_path="/v1/server_signers/{server_signer_id}/signature_event_result", + method='POST', + resource_path='/v1/server_signers/{server_signer_id}/signature_event_result', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -1521,5 +1711,7 @@ def _submit_server_signer_signature_event_result_serialize( auth_settings=_auth_settings, collection_formats=_collection_formats, _host=_host, - _request_auth=_request_auth, + _request_auth=_request_auth ) + + diff --git a/cdp/client/api/smart_contracts_api.py b/cdp/client/api/smart_contracts_api.py index 95d46e7..a507b57 100644 --- a/cdp/client/api/smart_contracts_api.py +++ b/cdp/client/api/smart_contracts_api.py @@ -1,23 +1,30 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from typing import Annotated, Any + Do not edit the class manually. +""" # noqa: E501 -from pydantic import Field, StrictFloat, StrictInt, StrictStr, validate_call +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 cdp.client.api_client import ApiClient, RequestSerialized -from cdp.client.api_response import ApiResponse +from pydantic import Field, StrictStr +from typing_extensions import Annotated from cdp.client.models.create_smart_contract_request import CreateSmartContractRequest from cdp.client.models.deploy_smart_contract_request import DeploySmartContractRequest from cdp.client.models.smart_contract import SmartContract from cdp.client.models.smart_contract_list import SmartContractList + +from cdp.client.api_client import ApiClient, RequestSerialized +from cdp.client.api_response import ApiResponse from cdp.client.rest import RESTResponseType @@ -33,22 +40,24 @@ def __init__(self, api_client=None) -> None: api_client = ApiClient.get_default() self.api_client = api_client + @validate_call def create_smart_contract( 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 deploy the smart contract from.") - ], + 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 deploy the smart contract from.")], create_smart_contract_request: CreateSmartContractRequest, - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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, ) -> SmartContract: """Create a new smart contract @@ -81,7 +90,8 @@ def create_smart_contract( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._create_smart_contract_serialize( wallet_id=wallet_id, address_id=address_id, @@ -89,35 +99,40 @@ def create_smart_contract( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "SmartContract", + _response_types_map: Dict[str, Optional[str]] = { + '200': "SmartContract", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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_smart_contract_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 deploy the smart contract from.") - ], + 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 deploy the smart contract from.")], create_smart_contract_request: CreateSmartContractRequest, - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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[SmartContract]: """Create a new smart contract @@ -150,7 +165,8 @@ def create_smart_contract_with_http_info( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._create_smart_contract_serialize( wallet_id=wallet_id, address_id=address_id, @@ -158,35 +174,40 @@ def create_smart_contract_with_http_info( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "SmartContract", + _response_types_map: Dict[str, Optional[str]] = { + '200': "SmartContract", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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_smart_contract_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 deploy the smart contract from.") - ], + 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 deploy the smart contract from.")], create_smart_contract_request: CreateSmartContractRequest, - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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: """Create a new smart contract @@ -219,7 +240,8 @@ def create_smart_contract_without_preload_content( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._create_smart_contract_serialize( wallet_id=wallet_id, address_id=address_id, @@ -227,15 +249,19 @@ def create_smart_contract_without_preload_content( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "SmartContract", + _response_types_map: Dict[str, Optional[str]] = { + '200': "SmartContract", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) return response_data.response + def _create_smart_contract_serialize( self, wallet_id, @@ -246,22 +272,24 @@ def _create_smart_contract_serialize( _headers, _host_index, ) -> RequestSerialized: + _host = None - _collection_formats: dict[str, str] = {} + _collection_formats: Dict[str, str] = { + } - _path_params: dict[str, str] = {} - _query_params: list[tuple[str, str]] = [] - _header_params: dict[str, str | None] = _headers or {} - _form_params: list[tuple[str, str]] = [] - _files: dict[str, str | bytes] = {} - _body_params: bytes | None = None + _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]] = {} + _body_params: Optional[bytes] = None # process the path parameters if wallet_id is not None: - _path_params["wallet_id"] = wallet_id + _path_params['wallet_id'] = wallet_id if address_id is not None: - _path_params["address_id"] = address_id + _path_params['address_id'] = address_id # process the query parameters # process the header parameters # process the form parameters @@ -269,24 +297,36 @@ def _create_smart_contract_serialize( if create_smart_contract_request is not None: _body_params = create_smart_contract_request + # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) + 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 + _header_params['Content-Type'] = _content_type else: - _default_content_type = self.api_client.select_header_content_type(["application/json"]) + _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 + _header_params['Content-Type'] = _default_content_type # authentication setting - _auth_settings: list[str] = [] + _auth_settings: List[str] = [ + ] return self.api_client.param_serialize( - method="POST", - resource_path="/v1/wallets/{wallet_id}/addresses/{address_id}/smart_contracts", + method='POST', + resource_path='/v1/wallets/{wallet_id}/addresses/{address_id}/smart_contracts', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -296,29 +336,30 @@ def _create_smart_contract_serialize( auth_settings=_auth_settings, collection_formats=_collection_formats, _host=_host, - _request_auth=_request_auth, + _request_auth=_request_auth ) + + + @validate_call def deploy_smart_contract( 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 broadcast the transaction from.") - ], - smart_contract_id: Annotated[ - StrictStr, - Field(description="The UUID of the smart contract to broadcast the transaction to."), - ], + 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 broadcast the transaction from.")], + smart_contract_id: Annotated[StrictStr, Field(description="The UUID of the smart contract to broadcast the transaction to.")], deploy_smart_contract_request: DeploySmartContractRequest, - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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, ) -> SmartContract: """Deploy a smart contract @@ -353,7 +394,8 @@ def deploy_smart_contract( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._deploy_smart_contract_serialize( wallet_id=wallet_id, address_id=address_id, @@ -362,39 +404,41 @@ def deploy_smart_contract( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "SmartContract", + _response_types_map: Dict[str, Optional[str]] = { + '200': "SmartContract", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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 deploy_smart_contract_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 broadcast the transaction from.") - ], - smart_contract_id: Annotated[ - StrictStr, - Field(description="The UUID of the smart contract to broadcast the transaction to."), - ], + 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 broadcast the transaction from.")], + smart_contract_id: Annotated[StrictStr, Field(description="The UUID of the smart contract to broadcast the transaction to.")], deploy_smart_contract_request: DeploySmartContractRequest, - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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[SmartContract]: """Deploy a smart contract @@ -429,7 +473,8 @@ def deploy_smart_contract_with_http_info( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._deploy_smart_contract_serialize( wallet_id=wallet_id, address_id=address_id, @@ -438,39 +483,41 @@ def deploy_smart_contract_with_http_info( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "SmartContract", + _response_types_map: Dict[str, Optional[str]] = { + '200': "SmartContract", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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 deploy_smart_contract_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 broadcast the transaction from.") - ], - smart_contract_id: Annotated[ - StrictStr, - Field(description="The UUID of the smart contract to broadcast the transaction to."), - ], + 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 broadcast the transaction from.")], + smart_contract_id: Annotated[StrictStr, Field(description="The UUID of the smart contract to broadcast the transaction to.")], deploy_smart_contract_request: DeploySmartContractRequest, - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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: """Deploy a smart contract @@ -505,7 +552,8 @@ def deploy_smart_contract_without_preload_content( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._deploy_smart_contract_serialize( wallet_id=wallet_id, address_id=address_id, @@ -514,15 +562,19 @@ def deploy_smart_contract_without_preload_content( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "SmartContract", + _response_types_map: Dict[str, Optional[str]] = { + '200': "SmartContract", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) return response_data.response + def _deploy_smart_contract_serialize( self, wallet_id, @@ -534,24 +586,26 @@ def _deploy_smart_contract_serialize( _headers, _host_index, ) -> RequestSerialized: + _host = None - _collection_formats: dict[str, str] = {} + _collection_formats: Dict[str, str] = { + } - _path_params: dict[str, str] = {} - _query_params: list[tuple[str, str]] = [] - _header_params: dict[str, str | None] = _headers or {} - _form_params: list[tuple[str, str]] = [] - _files: dict[str, str | bytes] = {} - _body_params: bytes | None = None + _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]] = {} + _body_params: Optional[bytes] = None # process the path parameters if wallet_id is not None: - _path_params["wallet_id"] = wallet_id + _path_params['wallet_id'] = wallet_id if address_id is not None: - _path_params["address_id"] = address_id + _path_params['address_id'] = address_id if smart_contract_id is not None: - _path_params["smart_contract_id"] = smart_contract_id + _path_params['smart_contract_id'] = smart_contract_id # process the query parameters # process the header parameters # process the form parameters @@ -559,24 +613,36 @@ def _deploy_smart_contract_serialize( if deploy_smart_contract_request is not None: _body_params = deploy_smart_contract_request + # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) + 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 + _header_params['Content-Type'] = _content_type else: - _default_content_type = self.api_client.select_header_content_type(["application/json"]) + _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 + _header_params['Content-Type'] = _default_content_type # authentication setting - _auth_settings: list[str] = [] + _auth_settings: List[str] = [ + ] return self.api_client.param_serialize( - method="POST", - resource_path="/v1/wallets/{wallet_id}/addresses/{address_id}/smart_contracts/{smart_contract_id}/deploy", + method='POST', + resource_path='/v1/wallets/{wallet_id}/addresses/{address_id}/smart_contracts/{smart_contract_id}/deploy', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -586,27 +652,29 @@ def _deploy_smart_contract_serialize( auth_settings=_auth_settings, collection_formats=_collection_formats, _host=_host, - _request_auth=_request_auth, + _request_auth=_request_auth ) + + + @validate_call def get_smart_contract( 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 smart contract for.") - ], - smart_contract_id: Annotated[ - StrictStr, Field(description="The UUID of the smart contract to fetch.") - ], - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = None, + 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 smart contract for.")], + smart_contract_id: Annotated[StrictStr, Field(description="The UUID of the smart contract to fetch.")], + _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, ) -> SmartContract: """Get a specific smart contract deployed by address @@ -639,7 +707,8 @@ def get_smart_contract( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._get_smart_contract_serialize( wallet_id=wallet_id, address_id=address_id, @@ -647,37 +716,40 @@ def get_smart_contract( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "SmartContract", + _response_types_map: Dict[str, Optional[str]] = { + '200': "SmartContract", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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_smart_contract_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 smart contract for.") - ], - smart_contract_id: Annotated[ - StrictStr, Field(description="The UUID of the smart contract to fetch.") - ], - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = None, + 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 smart contract for.")], + smart_contract_id: Annotated[StrictStr, Field(description="The UUID of the smart contract to fetch.")], + _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[SmartContract]: """Get a specific smart contract deployed by address @@ -710,7 +782,8 @@ def get_smart_contract_with_http_info( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._get_smart_contract_serialize( wallet_id=wallet_id, address_id=address_id, @@ -718,37 +791,40 @@ def get_smart_contract_with_http_info( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "SmartContract", + _response_types_map: Dict[str, Optional[str]] = { + '200': "SmartContract", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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_smart_contract_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 smart contract for.") - ], - smart_contract_id: Annotated[ - StrictStr, Field(description="The UUID of the smart contract to fetch.") - ], - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = None, + 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 smart contract for.")], + smart_contract_id: Annotated[StrictStr, Field(description="The UUID of the smart contract to fetch.")], + _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 specific smart contract deployed by address @@ -781,7 +857,8 @@ def get_smart_contract_without_preload_content( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._get_smart_contract_serialize( wallet_id=wallet_id, address_id=address_id, @@ -789,15 +866,19 @@ def get_smart_contract_without_preload_content( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "SmartContract", + _response_types_map: Dict[str, Optional[str]] = { + '200': "SmartContract", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) return response_data.response + def _get_smart_contract_serialize( self, wallet_id, @@ -808,39 +889,48 @@ def _get_smart_contract_serialize( _headers, _host_index, ) -> RequestSerialized: + _host = None - _collection_formats: dict[str, str] = {} + _collection_formats: Dict[str, str] = { + } - _path_params: dict[str, str] = {} - _query_params: list[tuple[str, str]] = [] - _header_params: dict[str, str | None] = _headers or {} - _form_params: list[tuple[str, str]] = [] - _files: dict[str, str | bytes] = {} - _body_params: bytes | None = None + _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]] = {} + _body_params: Optional[bytes] = None # process the path parameters if wallet_id is not None: - _path_params["wallet_id"] = wallet_id + _path_params['wallet_id'] = wallet_id if address_id is not None: - _path_params["address_id"] = address_id + _path_params['address_id'] = address_id if smart_contract_id is not None: - _path_params["smart_contract_id"] = smart_contract_id + _path_params['smart_contract_id'] = smart_contract_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"]) + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + # authentication setting - _auth_settings: list[str] = [] + _auth_settings: List[str] = [ + ] return self.api_client.param_serialize( - method="GET", - resource_path="/v1/wallets/{wallet_id}/addresses/{address_id}/smart_contracts/{smart_contract_id}", + method='GET', + resource_path='/v1/wallets/{wallet_id}/addresses/{address_id}/smart_contracts/{smart_contract_id}', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -850,24 +940,28 @@ def _get_smart_contract_serialize( auth_settings=_auth_settings, collection_formats=_collection_formats, _host=_host, - _request_auth=_request_auth, + _request_auth=_request_auth ) + + + @validate_call def list_smart_contracts( 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 smart contracts for.") - ], - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = None, + 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 smart contracts 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, ) -> SmartContractList: """List smart contracts deployed by address @@ -898,41 +992,47 @@ def list_smart_contracts( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._list_smart_contracts_serialize( wallet_id=wallet_id, address_id=address_id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "SmartContractList", + _response_types_map: Dict[str, Optional[str]] = { + '200': "SmartContractList", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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_smart_contracts_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 smart contracts for.") - ], - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = None, + 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 smart contracts 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[SmartContractList]: """List smart contracts deployed by address @@ -963,41 +1063,47 @@ def list_smart_contracts_with_http_info( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._list_smart_contracts_serialize( wallet_id=wallet_id, address_id=address_id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "SmartContractList", + _response_types_map: Dict[str, Optional[str]] = { + '200': "SmartContractList", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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_smart_contracts_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 smart contracts for.") - ], - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = None, + 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 smart contracts 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: """List smart contracts deployed by address @@ -1028,22 +1134,27 @@ def list_smart_contracts_without_preload_content( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._list_smart_contracts_serialize( wallet_id=wallet_id, address_id=address_id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "SmartContractList", + _response_types_map: Dict[str, Optional[str]] = { + '200': "SmartContractList", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) return response_data.response + def _list_smart_contracts_serialize( self, wallet_id, @@ -1053,37 +1164,46 @@ def _list_smart_contracts_serialize( _headers, _host_index, ) -> RequestSerialized: + _host = None - _collection_formats: dict[str, str] = {} + _collection_formats: Dict[str, str] = { + } - _path_params: dict[str, str] = {} - _query_params: list[tuple[str, str]] = [] - _header_params: dict[str, str | None] = _headers or {} - _form_params: list[tuple[str, str]] = [] - _files: dict[str, str | bytes] = {} - _body_params: bytes | None = None + _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]] = {} + _body_params: Optional[bytes] = None # process the path parameters if wallet_id is not None: - _path_params["wallet_id"] = wallet_id + _path_params['wallet_id'] = wallet_id if address_id is not None: - _path_params["address_id"] = address_id + _path_params['address_id'] = address_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"]) + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + # authentication setting - _auth_settings: list[str] = [] + _auth_settings: List[str] = [ + ] return self.api_client.param_serialize( - method="GET", - resource_path="/v1/wallets/{wallet_id}/addresses/{address_id}/smart_contracts", + method='GET', + resource_path='/v1/wallets/{wallet_id}/addresses/{address_id}/smart_contracts', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -1093,5 +1213,7 @@ def _list_smart_contracts_serialize( auth_settings=_auth_settings, collection_formats=_collection_formats, _host=_host, - _request_auth=_request_auth, + _request_auth=_request_auth ) + + diff --git a/cdp/client/api/stake_api.py b/cdp/client/api/stake_api.py index 086b404..ff3f4f8 100644 --- a/cdp/client/api/stake_api.py +++ b/cdp/client/api/stake_api.py @@ -1,29 +1,35 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from datetime import datetime -from typing import Annotated, Any + Do not edit the class manually. +""" # noqa: E501 -from pydantic import Field, StrictFloat, StrictInt, StrictStr, validate_call +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 cdp.client.api_client import ApiClient, RequestSerialized -from cdp.client.api_response import ApiResponse +from datetime import datetime +from pydantic import Field, StrictInt, StrictStr +from typing import Optional +from typing_extensions import Annotated from cdp.client.models.build_staking_operation_request import BuildStakingOperationRequest -from cdp.client.models.fetch_historical_staking_balances200_response import ( - FetchHistoricalStakingBalances200Response, -) +from cdp.client.models.fetch_historical_staking_balances200_response import FetchHistoricalStakingBalances200Response from cdp.client.models.fetch_staking_rewards200_response import FetchStakingRewards200Response from cdp.client.models.fetch_staking_rewards_request import FetchStakingRewardsRequest 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.api_client import ApiClient, RequestSerialized +from cdp.client.api_response import ApiResponse from cdp.client.rest import RESTResponseType @@ -39,16 +45,22 @@ def __init__(self, api_client=None) -> None: api_client = ApiClient.get_default() self.api_client = api_client + @validate_call def build_staking_operation( self, build_staking_operation_request: BuildStakingOperationRequest, - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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, ) -> StakingOperation: """Build a new staking operation @@ -77,35 +89,45 @@ def build_staking_operation( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._build_staking_operation_serialize( build_staking_operation_request=build_staking_operation_request, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "StakingOperation", + _response_types_map: Dict[str, Optional[str]] = { + '200': "StakingOperation", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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 build_staking_operation_with_http_info( self, build_staking_operation_request: BuildStakingOperationRequest, - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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[StakingOperation]: """Build a new staking operation @@ -134,35 +156,45 @@ def build_staking_operation_with_http_info( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._build_staking_operation_serialize( build_staking_operation_request=build_staking_operation_request, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "StakingOperation", + _response_types_map: Dict[str, Optional[str]] = { + '200': "StakingOperation", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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 build_staking_operation_without_preload_content( self, build_staking_operation_request: BuildStakingOperationRequest, - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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: """Build a new staking operation @@ -191,21 +223,26 @@ def build_staking_operation_without_preload_content( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._build_staking_operation_serialize( build_staking_operation_request=build_staking_operation_request, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "StakingOperation", + _response_types_map: Dict[str, Optional[str]] = { + '200': "StakingOperation", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) return response_data.response + def _build_staking_operation_serialize( self, build_staking_operation_request, @@ -214,16 +251,18 @@ def _build_staking_operation_serialize( _headers, _host_index, ) -> RequestSerialized: + _host = None - _collection_formats: dict[str, str] = {} + _collection_formats: Dict[str, str] = { + } - _path_params: dict[str, str] = {} - _query_params: list[tuple[str, str]] = [] - _header_params: dict[str, str | None] = _headers or {} - _form_params: list[tuple[str, str]] = [] - _files: dict[str, str | bytes] = {} - _body_params: bytes | None = None + _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]] = {} + _body_params: Optional[bytes] = None # process the path parameters # process the query parameters @@ -233,24 +272,36 @@ def _build_staking_operation_serialize( if build_staking_operation_request is not None: _body_params = build_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"]) + 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 + _header_params['Content-Type'] = _content_type else: - _default_content_type = self.api_client.select_header_content_type(["application/json"]) + _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 + _header_params['Content-Type'] = _default_content_type # authentication setting - _auth_settings: list[str] = [] + _auth_settings: List[str] = [ + ] return self.api_client.param_serialize( - method="POST", - resource_path="/v1/stake/build", + method='POST', + resource_path='/v1/stake/build', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -260,56 +311,33 @@ def _build_staking_operation_serialize( auth_settings=_auth_settings, collection_formats=_collection_formats, _host=_host, - _request_auth=_request_auth, + _request_auth=_request_auth ) + + + @validate_call def fetch_historical_staking_balances( self, - network_id: Annotated[ - str, - Field(strict=True, max_length=5000, description="The ID of the blockchain network."), - ], - asset_id: Annotated[ - str, - Field( - strict=True, - max_length=5000, - description="The ID of the asset for which the historical staking balances are being fetched.", - ), - ], - address_id: Annotated[ - str, - Field( - strict=True, - max_length=5000, - description="The onchain address for which the historical staking balances are being fetched.", - ), - ], - start_time: Annotated[ - datetime, Field(description="The start time of this historical staking balance period.") - ], - end_time: Annotated[ - datetime, Field(description="The end time of this historical staking balance period.") - ], - limit: Annotated[ - StrictInt | None, - 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[ - Annotated[str, Field(strict=True, max_length=5000)] | None, - 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." - ), + network_id: Annotated[str, Field(strict=True, max_length=5000, description="The ID of the blockchain network.")], + asset_id: Annotated[str, Field(strict=True, max_length=5000, description="The ID of the asset for which the historical staking balances are being fetched.")], + address_id: Annotated[str, Field(strict=True, max_length=5000, description="The onchain address for which the historical staking balances are being fetched.")], + start_time: Annotated[datetime, Field(description="The start time of this historical staking balance period.")], + end_time: Annotated[datetime, Field(description="The end time of this historical staking balance period.")], + 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_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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, ) -> FetchHistoricalStakingBalances200Response: """Fetch historical staking balances @@ -350,7 +378,8 @@ def fetch_historical_staking_balances( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._fetch_historical_staking_balances_serialize( network_id=network_id, asset_id=asset_id, @@ -362,66 +391,44 @@ def fetch_historical_staking_balances( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "FetchHistoricalStakingBalances200Response", + _response_types_map: Dict[str, Optional[str]] = { + '200': "FetchHistoricalStakingBalances200Response", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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 fetch_historical_staking_balances_with_http_info( self, - network_id: Annotated[ - str, - Field(strict=True, max_length=5000, description="The ID of the blockchain network."), - ], - asset_id: Annotated[ - str, - Field( - strict=True, - max_length=5000, - description="The ID of the asset for which the historical staking balances are being fetched.", - ), - ], - address_id: Annotated[ - str, - Field( - strict=True, - max_length=5000, - description="The onchain address for which the historical staking balances are being fetched.", - ), - ], - start_time: Annotated[ - datetime, Field(description="The start time of this historical staking balance period.") - ], - end_time: Annotated[ - datetime, Field(description="The end time of this historical staking balance period.") - ], - limit: Annotated[ - StrictInt | None, - 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[ - Annotated[str, Field(strict=True, max_length=5000)] | None, - 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." - ), + network_id: Annotated[str, Field(strict=True, max_length=5000, description="The ID of the blockchain network.")], + asset_id: Annotated[str, Field(strict=True, max_length=5000, description="The ID of the asset for which the historical staking balances are being fetched.")], + address_id: Annotated[str, Field(strict=True, max_length=5000, description="The onchain address for which the historical staking balances are being fetched.")], + start_time: Annotated[datetime, Field(description="The start time of this historical staking balance period.")], + end_time: Annotated[datetime, Field(description="The end time of this historical staking balance period.")], + 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_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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[FetchHistoricalStakingBalances200Response]: """Fetch historical staking balances @@ -462,7 +469,8 @@ def fetch_historical_staking_balances_with_http_info( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._fetch_historical_staking_balances_serialize( network_id=network_id, asset_id=asset_id, @@ -474,66 +482,44 @@ def fetch_historical_staking_balances_with_http_info( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "FetchHistoricalStakingBalances200Response", + _response_types_map: Dict[str, Optional[str]] = { + '200': "FetchHistoricalStakingBalances200Response", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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 fetch_historical_staking_balances_without_preload_content( self, - network_id: Annotated[ - str, - Field(strict=True, max_length=5000, description="The ID of the blockchain network."), - ], - asset_id: Annotated[ - str, - Field( - strict=True, - max_length=5000, - description="The ID of the asset for which the historical staking balances are being fetched.", - ), - ], - address_id: Annotated[ - str, - Field( - strict=True, - max_length=5000, - description="The onchain address for which the historical staking balances are being fetched.", - ), - ], - start_time: Annotated[ - datetime, Field(description="The start time of this historical staking balance period.") - ], - end_time: Annotated[ - datetime, Field(description="The end time of this historical staking balance period.") - ], - limit: Annotated[ - StrictInt | None, - 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[ - Annotated[str, Field(strict=True, max_length=5000)] | None, - 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." - ), + network_id: Annotated[str, Field(strict=True, max_length=5000, description="The ID of the blockchain network.")], + asset_id: Annotated[str, Field(strict=True, max_length=5000, description="The ID of the asset for which the historical staking balances are being fetched.")], + address_id: Annotated[str, Field(strict=True, max_length=5000, description="The onchain address for which the historical staking balances are being fetched.")], + start_time: Annotated[datetime, Field(description="The start time of this historical staking balance period.")], + end_time: Annotated[datetime, Field(description="The end time of this historical staking balance period.")], + 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_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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: """Fetch historical staking balances @@ -574,7 +560,8 @@ def fetch_historical_staking_balances_without_preload_content( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._fetch_historical_staking_balances_serialize( network_id=network_id, asset_id=asset_id, @@ -586,15 +573,19 @@ def fetch_historical_staking_balances_without_preload_content( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "FetchHistoricalStakingBalances200Response", + _response_types_map: Dict[str, Optional[str]] = { + '200': "FetchHistoricalStakingBalances200Response", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) return response_data.response + def _fetch_historical_staking_balances_serialize( self, network_id, @@ -609,65 +600,84 @@ def _fetch_historical_staking_balances_serialize( _headers, _host_index, ) -> RequestSerialized: + _host = None - _collection_formats: dict[str, str] = {} + _collection_formats: Dict[str, str] = { + } - _path_params: dict[str, str] = {} - _query_params: list[tuple[str, str]] = [] - _header_params: dict[str, str | None] = _headers or {} - _form_params: list[tuple[str, str]] = [] - _files: dict[str, str | bytes] = {} - _body_params: bytes | None = None + _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]] = {} + _body_params: Optional[bytes] = None # process the path parameters if network_id is not None: - _path_params["network_id"] = network_id + _path_params['network_id'] = network_id if address_id is not None: - _path_params["address_id"] = address_id + _path_params['address_id'] = address_id # process the query parameters if limit is not None: - _query_params.append(("limit", limit)) - + + _query_params.append(('limit', limit)) + if page is not None: - _query_params.append(("page", page)) - + + _query_params.append(('page', page)) + if asset_id is not None: - _query_params.append(("asset_id", asset_id)) - + + _query_params.append(('asset_id', asset_id)) + if start_time is not None: if isinstance(start_time, datetime): _query_params.append( ( - "start_time", - start_time.strftime(self.api_client.configuration.datetime_format), + 'start_time', + start_time.strftime( + self.api_client.configuration.datetime_format + ) ) ) else: - _query_params.append(("start_time", start_time)) - + _query_params.append(('start_time', start_time)) + if end_time is not None: if isinstance(end_time, datetime): _query_params.append( - ("end_time", end_time.strftime(self.api_client.configuration.datetime_format)) + ( + 'end_time', + end_time.strftime( + self.api_client.configuration.datetime_format + ) + ) ) else: - _query_params.append(("end_time", end_time)) - + _query_params.append(('end_time', end_time)) + # 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"]) + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + # authentication setting - _auth_settings: list[str] = [] + _auth_settings: List[str] = [ + ] return self.api_client.param_serialize( - method="GET", - resource_path="/v1/networks/{network_id}/addresses/{address_id}/stake/balances", + method='GET', + resource_path='/v1/networks/{network_id}/addresses/{address_id}/stake/balances', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -677,31 +687,29 @@ def _fetch_historical_staking_balances_serialize( auth_settings=_auth_settings, collection_formats=_collection_formats, _host=_host, - _request_auth=_request_auth, + _request_auth=_request_auth ) + + + @validate_call def fetch_staking_rewards( self, fetch_staking_rewards_request: FetchStakingRewardsRequest, - limit: Annotated[ - StrictInt | None, - 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[ - Annotated[str, Field(strict=True, max_length=5000)] | None, - 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." - ), + 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_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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, ) -> FetchStakingRewards200Response: """Fetch staking rewards @@ -734,7 +742,8 @@ def fetch_staking_rewards( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._fetch_staking_rewards_serialize( fetch_staking_rewards_request=fetch_staking_rewards_request, limit=limit, @@ -742,41 +751,40 @@ def fetch_staking_rewards( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "FetchStakingRewards200Response", + _response_types_map: Dict[str, Optional[str]] = { + '200': "FetchStakingRewards200Response", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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 fetch_staking_rewards_with_http_info( self, fetch_staking_rewards_request: FetchStakingRewardsRequest, - limit: Annotated[ - StrictInt | None, - Field( - description="A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 50." - ), + 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, - page: Annotated[ - Annotated[str, Field(strict=True, max_length=5000)] | None, - 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: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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[FetchStakingRewards200Response]: """Fetch staking rewards @@ -809,7 +817,8 @@ def fetch_staking_rewards_with_http_info( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._fetch_staking_rewards_serialize( fetch_staking_rewards_request=fetch_staking_rewards_request, limit=limit, @@ -817,41 +826,40 @@ def fetch_staking_rewards_with_http_info( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "FetchStakingRewards200Response", + _response_types_map: Dict[str, Optional[str]] = { + '200': "FetchStakingRewards200Response", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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 fetch_staking_rewards_without_preload_content( self, fetch_staking_rewards_request: FetchStakingRewardsRequest, - limit: Annotated[ - StrictInt | None, - Field( - description="A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 50." - ), + 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, - page: Annotated[ - Annotated[str, Field(strict=True, max_length=5000)] | None, - 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: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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: """Fetch staking rewards @@ -884,7 +892,8 @@ def fetch_staking_rewards_without_preload_content( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._fetch_staking_rewards_serialize( fetch_staking_rewards_request=fetch_staking_rewards_request, limit=limit, @@ -892,15 +901,19 @@ def fetch_staking_rewards_without_preload_content( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "FetchStakingRewards200Response", + _response_types_map: Dict[str, Optional[str]] = { + '200': "FetchStakingRewards200Response", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) return response_data.response + def _fetch_staking_rewards_serialize( self, fetch_staking_rewards_request, @@ -911,49 +924,65 @@ def _fetch_staking_rewards_serialize( _headers, _host_index, ) -> RequestSerialized: + _host = None - _collection_formats: dict[str, str] = {} + _collection_formats: Dict[str, str] = { + } - _path_params: dict[str, str] = {} - _query_params: list[tuple[str, str]] = [] - _header_params: dict[str, str | None] = _headers or {} - _form_params: list[tuple[str, str]] = [] - _files: dict[str, str | bytes] = {} - _body_params: bytes | None = None + _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]] = {} + _body_params: Optional[bytes] = None # process the path parameters # process the query parameters if limit is not None: - _query_params.append(("limit", limit)) - + + _query_params.append(('limit', limit)) + if page is not None: - _query_params.append(("page", page)) - + + _query_params.append(('page', page)) + # process the header parameters # process the form parameters # process the body parameter if fetch_staking_rewards_request is not None: _body_params = fetch_staking_rewards_request + # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) + 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 + _header_params['Content-Type'] = _content_type else: - _default_content_type = self.api_client.select_header_content_type(["application/json"]) + _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 + _header_params['Content-Type'] = _default_content_type # authentication setting - _auth_settings: list[str] = [] + _auth_settings: List[str] = [ + ] return self.api_client.param_serialize( - method="POST", - resource_path="/v1/stake/rewards/search", + method='POST', + resource_path='/v1/stake/rewards/search', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -963,25 +992,29 @@ def _fetch_staking_rewards_serialize( auth_settings=_auth_settings, collection_formats=_collection_formats, _host=_host, - _request_auth=_request_auth, + _request_auth=_request_auth ) + + + @validate_call def get_external_staking_operation( self, network_id: Annotated[StrictStr, Field(description="The ID of the blockchain network")], - 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: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = None, + 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 @@ -1014,7 +1047,8 @@ def get_external_staking_operation( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._get_external_staking_operation_serialize( network_id=network_id, address_id=address_id, @@ -1022,35 +1056,40 @@ def get_external_staking_operation( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "StakingOperation", + _response_types_map: Dict[str, Optional[str]] = { + '200': "StakingOperation", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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_external_staking_operation_with_http_info( self, network_id: Annotated[StrictStr, Field(description="The ID of the blockchain network")], - 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: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = None, + 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 @@ -1083,7 +1122,8 @@ def get_external_staking_operation_with_http_info( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._get_external_staking_operation_serialize( network_id=network_id, address_id=address_id, @@ -1091,35 +1131,40 @@ def get_external_staking_operation_with_http_info( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "StakingOperation", + _response_types_map: Dict[str, Optional[str]] = { + '200': "StakingOperation", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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_external_staking_operation_without_preload_content( self, network_id: Annotated[StrictStr, Field(description="The ID of the blockchain network")], - 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: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = None, + 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 @@ -1152,7 +1197,8 @@ def get_external_staking_operation_without_preload_content( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._get_external_staking_operation_serialize( network_id=network_id, address_id=address_id, @@ -1160,15 +1206,19 @@ def get_external_staking_operation_without_preload_content( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "StakingOperation", + _response_types_map: Dict[str, Optional[str]] = { + '200': "StakingOperation", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) return response_data.response + def _get_external_staking_operation_serialize( self, network_id, @@ -1179,39 +1229,48 @@ def _get_external_staking_operation_serialize( _headers, _host_index, ) -> RequestSerialized: + _host = None - _collection_formats: dict[str, str] = {} + _collection_formats: Dict[str, str] = { + } - _path_params: dict[str, str] = {} - _query_params: list[tuple[str, str]] = [] - _header_params: dict[str, str | None] = _headers or {} - _form_params: list[tuple[str, str]] = [] - _files: dict[str, str | bytes] = {} - _body_params: bytes | None = None + _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]] = {} + _body_params: Optional[bytes] = None # process the path parameters if network_id is not None: - _path_params["network_id"] = network_id + _path_params['network_id'] = network_id if address_id is not None: - _path_params["address_id"] = address_id + _path_params['address_id'] = address_id if staking_operation_id is not None: - _path_params["staking_operation_id"] = staking_operation_id + _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"]) + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + # authentication setting - _auth_settings: list[str] = [] + _auth_settings: List[str] = [ + ] return self.api_client.param_serialize( - method="GET", - resource_path="/v1/networks/{network_id}/addresses/{address_id}/staking_operations/{staking_operation_id}", + method='GET', + resource_path='/v1/networks/{network_id}/addresses/{address_id}/staking_operations/{staking_operation_id}', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -1221,19 +1280,27 @@ def _get_external_staking_operation_serialize( auth_settings=_auth_settings, collection_formats=_collection_formats, _host=_host, - _request_auth=_request_auth, + _request_auth=_request_auth ) + + + @validate_call def get_staking_context( self, get_staking_context_request: GetStakingContextRequest, - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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, ) -> StakingContext: """Get staking context @@ -1262,35 +1329,45 @@ def get_staking_context( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._get_staking_context_serialize( get_staking_context_request=get_staking_context_request, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "StakingContext", + _response_types_map: Dict[str, Optional[str]] = { + '200': "StakingContext", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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_context_with_http_info( self, get_staking_context_request: GetStakingContextRequest, - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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[StakingContext]: """Get staking context @@ -1319,35 +1396,45 @@ def get_staking_context_with_http_info( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._get_staking_context_serialize( get_staking_context_request=get_staking_context_request, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "StakingContext", + _response_types_map: Dict[str, Optional[str]] = { + '200': "StakingContext", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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_context_without_preload_content( self, get_staking_context_request: GetStakingContextRequest, - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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: """Get staking context @@ -1376,21 +1463,26 @@ def get_staking_context_without_preload_content( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._get_staking_context_serialize( get_staking_context_request=get_staking_context_request, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "StakingContext", + _response_types_map: Dict[str, Optional[str]] = { + '200': "StakingContext", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) return response_data.response + def _get_staking_context_serialize( self, get_staking_context_request, @@ -1399,16 +1491,18 @@ def _get_staking_context_serialize( _headers, _host_index, ) -> RequestSerialized: + _host = None - _collection_formats: dict[str, str] = {} + _collection_formats: Dict[str, str] = { + } - _path_params: dict[str, str] = {} - _query_params: list[tuple[str, str]] = [] - _header_params: dict[str, str | None] = _headers or {} - _form_params: list[tuple[str, str]] = [] - _files: dict[str, str | bytes] = {} - _body_params: bytes | None = None + _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]] = {} + _body_params: Optional[bytes] = None # process the path parameters # process the query parameters @@ -1418,24 +1512,36 @@ def _get_staking_context_serialize( if get_staking_context_request is not None: _body_params = get_staking_context_request + # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) + 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 + _header_params['Content-Type'] = _content_type else: - _default_content_type = self.api_client.select_header_content_type(["application/json"]) + _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 + _header_params['Content-Type'] = _default_content_type # authentication setting - _auth_settings: list[str] = [] + _auth_settings: List[str] = [ + ] return self.api_client.param_serialize( - method="POST", - resource_path="/v1/stake/context", + method='POST', + resource_path='/v1/stake/context', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -1445,5 +1551,7 @@ def _get_staking_context_serialize( auth_settings=_auth_settings, collection_formats=_collection_formats, _host=_host, - _request_auth=_request_auth, + _request_auth=_request_auth ) + + diff --git a/cdp/client/api/trades_api.py b/cdp/client/api/trades_api.py index 5829a15..fd58ed4 100644 --- a/cdp/client/api/trades_api.py +++ b/cdp/client/api/trades_api.py @@ -1,23 +1,31 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from typing import Annotated, Any + Do not edit the class manually. +""" # noqa: E501 -from pydantic import Field, StrictFloat, StrictInt, StrictStr, validate_call +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 cdp.client.api_client import ApiClient, RequestSerialized -from cdp.client.api_response import ApiResponse +from pydantic import Field, StrictInt, StrictStr +from typing import Optional +from typing_extensions import Annotated from cdp.client.models.broadcast_trade_request import BroadcastTradeRequest from cdp.client.models.create_trade_request import CreateTradeRequest from cdp.client.models.trade import Trade from cdp.client.models.trade_list import TradeList + +from cdp.client.api_client import ApiClient, RequestSerialized +from cdp.client.api_response import ApiResponse from cdp.client.rest import RESTResponseType @@ -33,23 +41,25 @@ def __init__(self, api_client=None) -> None: api_client = ApiClient.get_default() self.api_client = api_client + @validate_call def broadcast_trade( 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 trade belongs to") - ], + 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 trade belongs to")], trade_id: Annotated[StrictStr, Field(description="The ID of the trade to broadcast")], broadcast_trade_request: BroadcastTradeRequest, - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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, ) -> Trade: """Broadcast a trade @@ -84,7 +94,8 @@ def broadcast_trade( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._broadcast_trade_serialize( wallet_id=wallet_id, address_id=address_id, @@ -93,36 +104,41 @@ def broadcast_trade( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "Trade", + _response_types_map: Dict[str, Optional[str]] = { + '200': "Trade", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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_trade_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 trade belongs to") - ], + 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 trade belongs to")], trade_id: Annotated[StrictStr, Field(description="The ID of the trade to broadcast")], broadcast_trade_request: BroadcastTradeRequest, - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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[Trade]: """Broadcast a trade @@ -157,7 +173,8 @@ def broadcast_trade_with_http_info( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._broadcast_trade_serialize( wallet_id=wallet_id, address_id=address_id, @@ -166,36 +183,41 @@ def broadcast_trade_with_http_info( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "Trade", + _response_types_map: Dict[str, Optional[str]] = { + '200': "Trade", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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_trade_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 trade belongs to") - ], + 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 trade belongs to")], trade_id: Annotated[StrictStr, Field(description="The ID of the trade to broadcast")], broadcast_trade_request: BroadcastTradeRequest, - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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: """Broadcast a trade @@ -230,7 +252,8 @@ def broadcast_trade_without_preload_content( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._broadcast_trade_serialize( wallet_id=wallet_id, address_id=address_id, @@ -239,15 +262,19 @@ def broadcast_trade_without_preload_content( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "Trade", + _response_types_map: Dict[str, Optional[str]] = { + '200': "Trade", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) return response_data.response + def _broadcast_trade_serialize( self, wallet_id, @@ -259,24 +286,26 @@ def _broadcast_trade_serialize( _headers, _host_index, ) -> RequestSerialized: + _host = None - _collection_formats: dict[str, str] = {} + _collection_formats: Dict[str, str] = { + } - _path_params: dict[str, str] = {} - _query_params: list[tuple[str, str]] = [] - _header_params: dict[str, str | None] = _headers or {} - _form_params: list[tuple[str, str]] = [] - _files: dict[str, str | bytes] = {} - _body_params: bytes | None = None + _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]] = {} + _body_params: Optional[bytes] = None # process the path parameters if wallet_id is not None: - _path_params["wallet_id"] = wallet_id + _path_params['wallet_id'] = wallet_id if address_id is not None: - _path_params["address_id"] = address_id + _path_params['address_id'] = address_id if trade_id is not None: - _path_params["trade_id"] = trade_id + _path_params['trade_id'] = trade_id # process the query parameters # process the header parameters # process the form parameters @@ -284,24 +313,36 @@ def _broadcast_trade_serialize( if broadcast_trade_request is not None: _body_params = broadcast_trade_request + # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) + 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 + _header_params['Content-Type'] = _content_type else: - _default_content_type = self.api_client.select_header_content_type(["application/json"]) + _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 + _header_params['Content-Type'] = _default_content_type # authentication setting - _auth_settings: list[str] = [] + _auth_settings: List[str] = [ + ] return self.api_client.param_serialize( - method="POST", - resource_path="/v1/wallets/{wallet_id}/addresses/{address_id}/trades/{trade_id}/broadcast", + method='POST', + resource_path='/v1/wallets/{wallet_id}/addresses/{address_id}/trades/{trade_id}/broadcast', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -311,25 +352,29 @@ def _broadcast_trade_serialize( auth_settings=_auth_settings, collection_formats=_collection_formats, _host=_host, - _request_auth=_request_auth, + _request_auth=_request_auth ) + + + @validate_call def create_trade( self, - wallet_id: Annotated[ - StrictStr, Field(description="The ID of the wallet the source address belongs to") - ], - address_id: Annotated[ - StrictStr, Field(description="The ID of the address to conduct the trade from") - ], + wallet_id: Annotated[StrictStr, Field(description="The ID of the wallet the source address belongs to")], + address_id: Annotated[StrictStr, Field(description="The ID of the address to conduct the trade from")], create_trade_request: CreateTradeRequest, - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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, ) -> Trade: """Create a new trade for an address @@ -362,7 +407,8 @@ def create_trade( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._create_trade_serialize( wallet_id=wallet_id, address_id=address_id, @@ -370,35 +416,40 @@ def create_trade( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "Trade", + _response_types_map: Dict[str, Optional[str]] = { + '200': "Trade", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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_trade_with_http_info( self, - wallet_id: Annotated[ - StrictStr, Field(description="The ID of the wallet the source address belongs to") - ], - address_id: Annotated[ - StrictStr, Field(description="The ID of the address to conduct the trade from") - ], + wallet_id: Annotated[StrictStr, Field(description="The ID of the wallet the source address belongs to")], + address_id: Annotated[StrictStr, Field(description="The ID of the address to conduct the trade from")], create_trade_request: CreateTradeRequest, - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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[Trade]: """Create a new trade for an address @@ -431,7 +482,8 @@ def create_trade_with_http_info( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._create_trade_serialize( wallet_id=wallet_id, address_id=address_id, @@ -439,35 +491,40 @@ def create_trade_with_http_info( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "Trade", + _response_types_map: Dict[str, Optional[str]] = { + '200': "Trade", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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_trade_without_preload_content( self, - wallet_id: Annotated[ - StrictStr, Field(description="The ID of the wallet the source address belongs to") - ], - address_id: Annotated[ - StrictStr, Field(description="The ID of the address to conduct the trade from") - ], + wallet_id: Annotated[StrictStr, Field(description="The ID of the wallet the source address belongs to")], + address_id: Annotated[StrictStr, Field(description="The ID of the address to conduct the trade from")], create_trade_request: CreateTradeRequest, - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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: """Create a new trade for an address @@ -500,7 +557,8 @@ def create_trade_without_preload_content( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._create_trade_serialize( wallet_id=wallet_id, address_id=address_id, @@ -508,15 +566,19 @@ def create_trade_without_preload_content( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "Trade", + _response_types_map: Dict[str, Optional[str]] = { + '200': "Trade", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) return response_data.response + def _create_trade_serialize( self, wallet_id, @@ -527,22 +589,24 @@ def _create_trade_serialize( _headers, _host_index, ) -> RequestSerialized: + _host = None - _collection_formats: dict[str, str] = {} + _collection_formats: Dict[str, str] = { + } - _path_params: dict[str, str] = {} - _query_params: list[tuple[str, str]] = [] - _header_params: dict[str, str | None] = _headers or {} - _form_params: list[tuple[str, str]] = [] - _files: dict[str, str | bytes] = {} - _body_params: bytes | None = None + _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]] = {} + _body_params: Optional[bytes] = None # process the path parameters if wallet_id is not None: - _path_params["wallet_id"] = wallet_id + _path_params['wallet_id'] = wallet_id if address_id is not None: - _path_params["address_id"] = address_id + _path_params['address_id'] = address_id # process the query parameters # process the header parameters # process the form parameters @@ -550,24 +614,36 @@ def _create_trade_serialize( if create_trade_request is not None: _body_params = create_trade_request + # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) + 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 + _header_params['Content-Type'] = _content_type else: - _default_content_type = self.api_client.select_header_content_type(["application/json"]) + _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 + _header_params['Content-Type'] = _default_content_type # authentication setting - _auth_settings: list[str] = [] + _auth_settings: List[str] = [ + ] return self.api_client.param_serialize( - method="POST", - resource_path="/v1/wallets/{wallet_id}/addresses/{address_id}/trades", + method='POST', + resource_path='/v1/wallets/{wallet_id}/addresses/{address_id}/trades', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -577,25 +653,29 @@ def _create_trade_serialize( auth_settings=_auth_settings, collection_formats=_collection_formats, _host=_host, - _request_auth=_request_auth, + _request_auth=_request_auth ) + + + @validate_call def get_trade( 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 trade belongs to") - ], + 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 trade belongs to")], trade_id: Annotated[StrictStr, Field(description="The ID of the trade to fetch")], - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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, ) -> Trade: """Get a trade by ID @@ -628,7 +708,8 @@ def get_trade( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._get_trade_serialize( wallet_id=wallet_id, address_id=address_id, @@ -636,35 +717,40 @@ def get_trade( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "Trade", + _response_types_map: Dict[str, Optional[str]] = { + '200': "Trade", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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_trade_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 trade belongs to") - ], + 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 trade belongs to")], trade_id: Annotated[StrictStr, Field(description="The ID of the trade to fetch")], - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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[Trade]: """Get a trade by ID @@ -697,7 +783,8 @@ def get_trade_with_http_info( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._get_trade_serialize( wallet_id=wallet_id, address_id=address_id, @@ -705,35 +792,40 @@ def get_trade_with_http_info( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "Trade", + _response_types_map: Dict[str, Optional[str]] = { + '200': "Trade", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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_trade_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 trade belongs to") - ], + 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 trade belongs to")], trade_id: Annotated[StrictStr, Field(description="The ID of the trade to fetch")], - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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: """Get a trade by ID @@ -766,7 +858,8 @@ def get_trade_without_preload_content( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._get_trade_serialize( wallet_id=wallet_id, address_id=address_id, @@ -774,15 +867,19 @@ def get_trade_without_preload_content( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "Trade", + _response_types_map: Dict[str, Optional[str]] = { + '200': "Trade", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) return response_data.response + def _get_trade_serialize( self, wallet_id, @@ -793,39 +890,48 @@ def _get_trade_serialize( _headers, _host_index, ) -> RequestSerialized: + _host = None - _collection_formats: dict[str, str] = {} + _collection_formats: Dict[str, str] = { + } - _path_params: dict[str, str] = {} - _query_params: list[tuple[str, str]] = [] - _header_params: dict[str, str | None] = _headers or {} - _form_params: list[tuple[str, str]] = [] - _files: dict[str, str | bytes] = {} - _body_params: bytes | None = None + _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]] = {} + _body_params: Optional[bytes] = None # process the path parameters if wallet_id is not None: - _path_params["wallet_id"] = wallet_id + _path_params['wallet_id'] = wallet_id if address_id is not None: - _path_params["address_id"] = address_id + _path_params['address_id'] = address_id if trade_id is not None: - _path_params["trade_id"] = trade_id + _path_params['trade_id'] = trade_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"]) + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + # authentication setting - _auth_settings: list[str] = [] + _auth_settings: List[str] = [ + ] return self.api_client.param_serialize( - method="GET", - resource_path="/v1/wallets/{wallet_id}/addresses/{address_id}/trades/{trade_id}", + method='GET', + resource_path='/v1/wallets/{wallet_id}/addresses/{address_id}/trades/{trade_id}', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -835,36 +941,30 @@ def _get_trade_serialize( auth_settings=_auth_settings, collection_formats=_collection_formats, _host=_host, - _request_auth=_request_auth, + _request_auth=_request_auth ) + + + @validate_call def list_trades( 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 list trades for") - ], - limit: Annotated[ - StrictInt | None, - Field( - description="A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10." - ), - ] = None, - page: Annotated[ - Annotated[str, Field(strict=True, max_length=5000)] | None, - 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." - ), + 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 list trades for")], + 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 10.")] = 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_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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, ) -> TradeList: """List trades for an address. @@ -899,7 +999,8 @@ def list_trades( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._list_trades_serialize( wallet_id=wallet_id, address_id=address_id, @@ -908,46 +1009,41 @@ def list_trades( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "TradeList", + _response_types_map: Dict[str, Optional[str]] = { + '200': "TradeList", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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_trades_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 list trades for") - ], - limit: Annotated[ - StrictInt | None, - Field( - description="A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10." - ), - ] = None, - page: Annotated[ - Annotated[str, Field(strict=True, max_length=5000)] | None, - 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." - ), + 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 list trades for")], + 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 10.")] = 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_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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[TradeList]: """List trades for an address. @@ -982,7 +1078,8 @@ def list_trades_with_http_info( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._list_trades_serialize( wallet_id=wallet_id, address_id=address_id, @@ -991,46 +1088,41 @@ def list_trades_with_http_info( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "TradeList", + _response_types_map: Dict[str, Optional[str]] = { + '200': "TradeList", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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_trades_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 list trades for") - ], - limit: Annotated[ - StrictInt | None, - Field( - description="A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10." - ), + 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 list trades for")], + 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 10.")] = 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, - page: Annotated[ - Annotated[str, Field(strict=True, max_length=5000)] | None, - 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: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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 trades for an address. @@ -1065,7 +1157,8 @@ def list_trades_without_preload_content( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._list_trades_serialize( wallet_id=wallet_id, address_id=address_id, @@ -1074,15 +1167,19 @@ def list_trades_without_preload_content( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "TradeList", + _response_types_map: Dict[str, Optional[str]] = { + '200': "TradeList", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) return response_data.response + def _list_trades_serialize( self, wallet_id, @@ -1094,43 +1191,54 @@ def _list_trades_serialize( _headers, _host_index, ) -> RequestSerialized: + _host = None - _collection_formats: dict[str, str] = {} + _collection_formats: Dict[str, str] = { + } - _path_params: dict[str, str] = {} - _query_params: list[tuple[str, str]] = [] - _header_params: dict[str, str | None] = _headers or {} - _form_params: list[tuple[str, str]] = [] - _files: dict[str, str | bytes] = {} - _body_params: bytes | None = None + _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]] = {} + _body_params: Optional[bytes] = None # process the path parameters if wallet_id is not None: - _path_params["wallet_id"] = wallet_id + _path_params['wallet_id'] = wallet_id if address_id is not None: - _path_params["address_id"] = address_id + _path_params['address_id'] = address_id # process the query parameters if limit is not None: - _query_params.append(("limit", limit)) - + + _query_params.append(('limit', limit)) + if page is not None: - _query_params.append(("page", page)) - + + _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"]) + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + # authentication setting - _auth_settings: list[str] = [] + _auth_settings: List[str] = [ + ] return self.api_client.param_serialize( - method="GET", - resource_path="/v1/wallets/{wallet_id}/addresses/{address_id}/trades", + method='GET', + resource_path='/v1/wallets/{wallet_id}/addresses/{address_id}/trades', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -1140,5 +1248,7 @@ def _list_trades_serialize( auth_settings=_auth_settings, collection_formats=_collection_formats, _host=_host, - _request_auth=_request_auth, + _request_auth=_request_auth ) + + diff --git a/cdp/client/api/transaction_history_api.py b/cdp/client/api/transaction_history_api.py new file mode 100644 index 0000000..785824a --- /dev/null +++ b/cdp/client/api/transaction_history_api.py @@ -0,0 +1,346 @@ +# 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, StrictInt, StrictStr +from typing import Optional +from typing_extensions import Annotated +from cdp.client.models.address_transaction_list import AddressTransactionList + +from cdp.client.api_client import ApiClient, RequestSerialized +from cdp.client.api_response import ApiResponse +from cdp.client.rest import RESTResponseType + + +class TransactionHistoryApi: + """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 list_address_transactions( + self, + network_id: Annotated[StrictStr, Field(description="The ID of the blockchain network")], + address_id: Annotated[StrictStr, Field(description="The ID of the address to fetch the transactions for.")], + 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 10.")] = 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, + ) -> AddressTransactionList: + """List transactions for an address. + + List all transactions that interact with the address. + + :param network_id: The ID of the blockchain network (required) + :type network_id: str + :param address_id: The ID of the address to fetch the transactions for. (required) + :type address_id: str + :param limit: A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10. + :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_address_transactions_serialize( + network_id=network_id, + address_id=address_id, + 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': "AddressTransactionList", + } + 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_address_transactions_with_http_info( + self, + network_id: Annotated[StrictStr, Field(description="The ID of the blockchain network")], + address_id: Annotated[StrictStr, Field(description="The ID of the address to fetch the transactions for.")], + 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 10.")] = 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[AddressTransactionList]: + """List transactions for an address. + + List all transactions that interact with the address. + + :param network_id: The ID of the blockchain network (required) + :type network_id: str + :param address_id: The ID of the address to fetch the transactions for. (required) + :type address_id: str + :param limit: A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10. + :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_address_transactions_serialize( + network_id=network_id, + address_id=address_id, + 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': "AddressTransactionList", + } + 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_address_transactions_without_preload_content( + self, + network_id: Annotated[StrictStr, Field(description="The ID of the blockchain network")], + address_id: Annotated[StrictStr, Field(description="The ID of the address to fetch the transactions for.")], + 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 10.")] = 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 transactions for an address. + + List all transactions that interact with the address. + + :param network_id: The ID of the blockchain network (required) + :type network_id: str + :param address_id: The ID of the address to fetch the transactions for. (required) + :type address_id: str + :param limit: A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10. + :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_address_transactions_serialize( + network_id=network_id, + address_id=address_id, + 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': "AddressTransactionList", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_address_transactions_serialize( + self, + network_id, + address_id, + 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]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if network_id is not None: + _path_params['network_id'] = network_id + if address_id is not None: + _path_params['address_id'] = address_id + # process the query parameters + 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}/addresses/{address_id}/transactions', + 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/transfers_api.py b/cdp/client/api/transfers_api.py index 6e5e1ad..0ed5523 100644 --- a/cdp/client/api/transfers_api.py +++ b/cdp/client/api/transfers_api.py @@ -1,23 +1,31 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from typing import Annotated, Any + Do not edit the class manually. +""" # noqa: E501 -from pydantic import Field, StrictFloat, StrictInt, StrictStr, validate_call +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 cdp.client.api_client import ApiClient, RequestSerialized -from cdp.client.api_response import ApiResponse +from pydantic import Field, StrictInt, StrictStr +from typing import Optional +from typing_extensions import Annotated from cdp.client.models.broadcast_transfer_request import BroadcastTransferRequest from cdp.client.models.create_transfer_request import CreateTransferRequest from cdp.client.models.transfer import Transfer from cdp.client.models.transfer_list import TransferList + +from cdp.client.api_client import ApiClient, RequestSerialized +from cdp.client.api_response import ApiResponse from cdp.client.rest import RESTResponseType @@ -33,23 +41,25 @@ def __init__(self, api_client=None) -> None: api_client = ApiClient.get_default() self.api_client = api_client + @validate_call def broadcast_transfer( 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 transfer belongs to") - ], + 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 transfer belongs to")], transfer_id: Annotated[StrictStr, Field(description="The ID of the transfer to broadcast")], broadcast_transfer_request: BroadcastTransferRequest, - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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, ) -> Transfer: """Broadcast a transfer @@ -84,7 +94,8 @@ def broadcast_transfer( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._broadcast_transfer_serialize( wallet_id=wallet_id, address_id=address_id, @@ -93,36 +104,41 @@ def broadcast_transfer( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "Transfer", + _response_types_map: Dict[str, Optional[str]] = { + '200': "Transfer", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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_transfer_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 transfer belongs to") - ], + 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 transfer belongs to")], transfer_id: Annotated[StrictStr, Field(description="The ID of the transfer to broadcast")], broadcast_transfer_request: BroadcastTransferRequest, - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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[Transfer]: """Broadcast a transfer @@ -157,7 +173,8 @@ def broadcast_transfer_with_http_info( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._broadcast_transfer_serialize( wallet_id=wallet_id, address_id=address_id, @@ -166,36 +183,41 @@ def broadcast_transfer_with_http_info( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "Transfer", + _response_types_map: Dict[str, Optional[str]] = { + '200': "Transfer", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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_transfer_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 transfer belongs to") - ], + 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 transfer belongs to")], transfer_id: Annotated[StrictStr, Field(description="The ID of the transfer to broadcast")], broadcast_transfer_request: BroadcastTransferRequest, - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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: """Broadcast a transfer @@ -230,7 +252,8 @@ def broadcast_transfer_without_preload_content( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._broadcast_transfer_serialize( wallet_id=wallet_id, address_id=address_id, @@ -239,15 +262,19 @@ def broadcast_transfer_without_preload_content( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "Transfer", + _response_types_map: Dict[str, Optional[str]] = { + '200': "Transfer", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) return response_data.response + def _broadcast_transfer_serialize( self, wallet_id, @@ -259,24 +286,26 @@ def _broadcast_transfer_serialize( _headers, _host_index, ) -> RequestSerialized: + _host = None - _collection_formats: dict[str, str] = {} + _collection_formats: Dict[str, str] = { + } - _path_params: dict[str, str] = {} - _query_params: list[tuple[str, str]] = [] - _header_params: dict[str, str | None] = _headers or {} - _form_params: list[tuple[str, str]] = [] - _files: dict[str, str | bytes] = {} - _body_params: bytes | None = None + _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]] = {} + _body_params: Optional[bytes] = None # process the path parameters if wallet_id is not None: - _path_params["wallet_id"] = wallet_id + _path_params['wallet_id'] = wallet_id if address_id is not None: - _path_params["address_id"] = address_id + _path_params['address_id'] = address_id if transfer_id is not None: - _path_params["transfer_id"] = transfer_id + _path_params['transfer_id'] = transfer_id # process the query parameters # process the header parameters # process the form parameters @@ -284,24 +313,36 @@ def _broadcast_transfer_serialize( if broadcast_transfer_request is not None: _body_params = broadcast_transfer_request + # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) + 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 + _header_params['Content-Type'] = _content_type else: - _default_content_type = self.api_client.select_header_content_type(["application/json"]) + _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 + _header_params['Content-Type'] = _default_content_type # authentication setting - _auth_settings: list[str] = [] + _auth_settings: List[str] = [ + ] return self.api_client.param_serialize( - method="POST", - resource_path="/v1/wallets/{wallet_id}/addresses/{address_id}/transfers/{transfer_id}/broadcast", + method='POST', + resource_path='/v1/wallets/{wallet_id}/addresses/{address_id}/transfers/{transfer_id}/broadcast', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -311,25 +352,29 @@ def _broadcast_transfer_serialize( auth_settings=_auth_settings, collection_formats=_collection_formats, _host=_host, - _request_auth=_request_auth, + _request_auth=_request_auth ) + + + @validate_call def create_transfer( self, - wallet_id: Annotated[ - StrictStr, Field(description="The ID of the wallet the source address belongs to") - ], - address_id: Annotated[ - StrictStr, Field(description="The ID of the address to transfer from") - ], + wallet_id: Annotated[StrictStr, Field(description="The ID of the wallet the source address belongs to")], + address_id: Annotated[StrictStr, Field(description="The ID of the address to transfer from")], create_transfer_request: CreateTransferRequest, - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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, ) -> Transfer: """Create a new transfer for an address @@ -362,7 +407,8 @@ def create_transfer( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._create_transfer_serialize( wallet_id=wallet_id, address_id=address_id, @@ -370,35 +416,40 @@ def create_transfer( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "Transfer", + _response_types_map: Dict[str, Optional[str]] = { + '200': "Transfer", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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_transfer_with_http_info( self, - wallet_id: Annotated[ - StrictStr, Field(description="The ID of the wallet the source address belongs to") - ], - address_id: Annotated[ - StrictStr, Field(description="The ID of the address to transfer from") - ], + wallet_id: Annotated[StrictStr, Field(description="The ID of the wallet the source address belongs to")], + address_id: Annotated[StrictStr, Field(description="The ID of the address to transfer from")], create_transfer_request: CreateTransferRequest, - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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[Transfer]: """Create a new transfer for an address @@ -431,7 +482,8 @@ def create_transfer_with_http_info( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._create_transfer_serialize( wallet_id=wallet_id, address_id=address_id, @@ -439,35 +491,40 @@ def create_transfer_with_http_info( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "Transfer", + _response_types_map: Dict[str, Optional[str]] = { + '200': "Transfer", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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_transfer_without_preload_content( self, - wallet_id: Annotated[ - StrictStr, Field(description="The ID of the wallet the source address belongs to") - ], - address_id: Annotated[ - StrictStr, Field(description="The ID of the address to transfer from") - ], + wallet_id: Annotated[StrictStr, Field(description="The ID of the wallet the source address belongs to")], + address_id: Annotated[StrictStr, Field(description="The ID of the address to transfer from")], create_transfer_request: CreateTransferRequest, - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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: """Create a new transfer for an address @@ -500,7 +557,8 @@ def create_transfer_without_preload_content( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._create_transfer_serialize( wallet_id=wallet_id, address_id=address_id, @@ -508,15 +566,19 @@ def create_transfer_without_preload_content( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "Transfer", + _response_types_map: Dict[str, Optional[str]] = { + '200': "Transfer", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) return response_data.response + def _create_transfer_serialize( self, wallet_id, @@ -527,22 +589,24 @@ def _create_transfer_serialize( _headers, _host_index, ) -> RequestSerialized: + _host = None - _collection_formats: dict[str, str] = {} + _collection_formats: Dict[str, str] = { + } - _path_params: dict[str, str] = {} - _query_params: list[tuple[str, str]] = [] - _header_params: dict[str, str | None] = _headers or {} - _form_params: list[tuple[str, str]] = [] - _files: dict[str, str | bytes] = {} - _body_params: bytes | None = None + _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]] = {} + _body_params: Optional[bytes] = None # process the path parameters if wallet_id is not None: - _path_params["wallet_id"] = wallet_id + _path_params['wallet_id'] = wallet_id if address_id is not None: - _path_params["address_id"] = address_id + _path_params['address_id'] = address_id # process the query parameters # process the header parameters # process the form parameters @@ -550,24 +614,36 @@ def _create_transfer_serialize( if create_transfer_request is not None: _body_params = create_transfer_request + # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) + 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 + _header_params['Content-Type'] = _content_type else: - _default_content_type = self.api_client.select_header_content_type(["application/json"]) + _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 + _header_params['Content-Type'] = _default_content_type # authentication setting - _auth_settings: list[str] = [] + _auth_settings: List[str] = [ + ] return self.api_client.param_serialize( - method="POST", - resource_path="/v1/wallets/{wallet_id}/addresses/{address_id}/transfers", + method='POST', + resource_path='/v1/wallets/{wallet_id}/addresses/{address_id}/transfers', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -577,25 +653,29 @@ def _create_transfer_serialize( auth_settings=_auth_settings, collection_formats=_collection_formats, _host=_host, - _request_auth=_request_auth, + _request_auth=_request_auth ) + + + @validate_call def get_transfer( 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 transfer belongs to") - ], + 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 transfer belongs to")], transfer_id: Annotated[StrictStr, Field(description="The ID of the transfer to fetch")], - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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, ) -> Transfer: """Get a transfer by ID @@ -628,7 +708,8 @@ def get_transfer( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._get_transfer_serialize( wallet_id=wallet_id, address_id=address_id, @@ -636,35 +717,40 @@ def get_transfer( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "Transfer", + _response_types_map: Dict[str, Optional[str]] = { + '200': "Transfer", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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_transfer_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 transfer belongs to") - ], + 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 transfer belongs to")], transfer_id: Annotated[StrictStr, Field(description="The ID of the transfer to fetch")], - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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[Transfer]: """Get a transfer by ID @@ -697,7 +783,8 @@ def get_transfer_with_http_info( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._get_transfer_serialize( wallet_id=wallet_id, address_id=address_id, @@ -705,35 +792,40 @@ def get_transfer_with_http_info( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "Transfer", + _response_types_map: Dict[str, Optional[str]] = { + '200': "Transfer", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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_transfer_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 transfer belongs to") - ], + 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 transfer belongs to")], transfer_id: Annotated[StrictStr, Field(description="The ID of the transfer to fetch")], - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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: """Get a transfer by ID @@ -766,7 +858,8 @@ def get_transfer_without_preload_content( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._get_transfer_serialize( wallet_id=wallet_id, address_id=address_id, @@ -774,15 +867,19 @@ def get_transfer_without_preload_content( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "Transfer", + _response_types_map: Dict[str, Optional[str]] = { + '200': "Transfer", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) return response_data.response + def _get_transfer_serialize( self, wallet_id, @@ -793,39 +890,48 @@ def _get_transfer_serialize( _headers, _host_index, ) -> RequestSerialized: + _host = None - _collection_formats: dict[str, str] = {} + _collection_formats: Dict[str, str] = { + } - _path_params: dict[str, str] = {} - _query_params: list[tuple[str, str]] = [] - _header_params: dict[str, str | None] = _headers or {} - _form_params: list[tuple[str, str]] = [] - _files: dict[str, str | bytes] = {} - _body_params: bytes | None = None + _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]] = {} + _body_params: Optional[bytes] = None # process the path parameters if wallet_id is not None: - _path_params["wallet_id"] = wallet_id + _path_params['wallet_id'] = wallet_id if address_id is not None: - _path_params["address_id"] = address_id + _path_params['address_id'] = address_id if transfer_id is not None: - _path_params["transfer_id"] = transfer_id + _path_params['transfer_id'] = transfer_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"]) + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + # authentication setting - _auth_settings: list[str] = [] + _auth_settings: List[str] = [ + ] return self.api_client.param_serialize( - method="GET", - resource_path="/v1/wallets/{wallet_id}/addresses/{address_id}/transfers/{transfer_id}", + method='GET', + resource_path='/v1/wallets/{wallet_id}/addresses/{address_id}/transfers/{transfer_id}', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -835,36 +941,30 @@ def _get_transfer_serialize( auth_settings=_auth_settings, collection_formats=_collection_formats, _host=_host, - _request_auth=_request_auth, + _request_auth=_request_auth ) + + + @validate_call def list_transfers( 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 list transfers for") - ], - limit: Annotated[ - StrictInt | None, - Field( - description="A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10." - ), - ] = None, - page: Annotated[ - Annotated[str, Field(strict=True, max_length=5000)] | None, - 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." - ), + 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 list transfers for")], + 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 10.")] = 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_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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, ) -> TransferList: """List transfers for an address. @@ -899,7 +999,8 @@ def list_transfers( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._list_transfers_serialize( wallet_id=wallet_id, address_id=address_id, @@ -908,46 +1009,41 @@ def list_transfers( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "TransferList", + _response_types_map: Dict[str, Optional[str]] = { + '200': "TransferList", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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_transfers_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 list transfers for") - ], - limit: Annotated[ - StrictInt | None, - Field( - description="A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10." - ), - ] = None, - page: Annotated[ - Annotated[str, Field(strict=True, max_length=5000)] | None, - 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." - ), + 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 list transfers for")], + 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 10.")] = 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_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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[TransferList]: """List transfers for an address. @@ -982,7 +1078,8 @@ def list_transfers_with_http_info( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._list_transfers_serialize( wallet_id=wallet_id, address_id=address_id, @@ -991,46 +1088,41 @@ def list_transfers_with_http_info( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "TransferList", + _response_types_map: Dict[str, Optional[str]] = { + '200': "TransferList", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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_transfers_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 list transfers for") - ], - limit: Annotated[ - StrictInt | None, - Field( - description="A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10." - ), + 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 list transfers for")], + 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 10.")] = 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, - page: Annotated[ - Annotated[str, Field(strict=True, max_length=5000)] | None, - 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: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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 transfers for an address. @@ -1065,7 +1157,8 @@ def list_transfers_without_preload_content( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._list_transfers_serialize( wallet_id=wallet_id, address_id=address_id, @@ -1074,15 +1167,19 @@ def list_transfers_without_preload_content( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "TransferList", + _response_types_map: Dict[str, Optional[str]] = { + '200': "TransferList", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) return response_data.response + def _list_transfers_serialize( self, wallet_id, @@ -1094,43 +1191,54 @@ def _list_transfers_serialize( _headers, _host_index, ) -> RequestSerialized: + _host = None - _collection_formats: dict[str, str] = {} + _collection_formats: Dict[str, str] = { + } - _path_params: dict[str, str] = {} - _query_params: list[tuple[str, str]] = [] - _header_params: dict[str, str | None] = _headers or {} - _form_params: list[tuple[str, str]] = [] - _files: dict[str, str | bytes] = {} - _body_params: bytes | None = None + _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]] = {} + _body_params: Optional[bytes] = None # process the path parameters if wallet_id is not None: - _path_params["wallet_id"] = wallet_id + _path_params['wallet_id'] = wallet_id if address_id is not None: - _path_params["address_id"] = address_id + _path_params['address_id'] = address_id # process the query parameters if limit is not None: - _query_params.append(("limit", limit)) - + + _query_params.append(('limit', limit)) + if page is not None: - _query_params.append(("page", page)) - + + _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"]) + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + # authentication setting - _auth_settings: list[str] = [] + _auth_settings: List[str] = [ + ] return self.api_client.param_serialize( - method="GET", - resource_path="/v1/wallets/{wallet_id}/addresses/{address_id}/transfers", + method='GET', + resource_path='/v1/wallets/{wallet_id}/addresses/{address_id}/transfers', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -1140,5 +1248,7 @@ def _list_transfers_serialize( auth_settings=_auth_settings, collection_formats=_collection_formats, _host=_host, - _request_auth=_request_auth, + _request_auth=_request_auth ) + + diff --git a/cdp/client/api/users_api.py b/cdp/client/api/users_api.py index 584ac8f..8afc9b9 100644 --- a/cdp/client/api/users_api.py +++ b/cdp/client/api/users_api.py @@ -1,20 +1,25 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + 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 -from typing import Annotated, Any +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, StrictFloat, StrictInt, StrictStr, validate_call +from cdp.client.models.user import User from cdp.client.api_client import ApiClient, RequestSerialized from cdp.client.api_response import ApiResponse -from cdp.client.models.user import User from cdp.client.rest import RESTResponseType @@ -30,15 +35,21 @@ def __init__(self, api_client=None) -> None: api_client = ApiClient.get_default() self.api_client = api_client + @validate_call def get_current_user( self, - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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, ) -> User: """Get current user @@ -65,33 +76,43 @@ def get_current_user( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._get_current_user_serialize( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "User", + _response_types_map: Dict[str, Optional[str]] = { + '200': "User", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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_current_user_with_http_info( self, - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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[User]: """Get current user @@ -118,33 +139,43 @@ def get_current_user_with_http_info( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._get_current_user_serialize( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "User", + _response_types_map: Dict[str, Optional[str]] = { + '200': "User", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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_current_user_without_preload_content( self, - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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: """Get current user @@ -171,20 +202,25 @@ def get_current_user_without_preload_content( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._get_current_user_serialize( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "User", + _response_types_map: Dict[str, Optional[str]] = { + '200': "User", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) return response_data.response + def _get_current_user_serialize( self, _request_auth, @@ -192,16 +228,18 @@ def _get_current_user_serialize( _headers, _host_index, ) -> RequestSerialized: + _host = None - _collection_formats: dict[str, str] = {} + _collection_formats: Dict[str, str] = { + } - _path_params: dict[str, str] = {} - _query_params: list[tuple[str, str]] = [] - _header_params: dict[str, str | None] = _headers or {} - _form_params: list[tuple[str, str]] = [] - _files: dict[str, str | bytes] = {} - _body_params: bytes | None = None + _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]] = {} + _body_params: Optional[bytes] = None # process the path parameters # process the query parameters @@ -209,16 +247,23 @@ def _get_current_user_serialize( # 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"]) + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + # authentication setting - _auth_settings: list[str] = [] + _auth_settings: List[str] = [ + ] return self.api_client.param_serialize( - method="GET", - resource_path="/v1/users/me", + method='GET', + resource_path='/v1/users/me', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -228,5 +273,7 @@ def _get_current_user_serialize( auth_settings=_auth_settings, collection_formats=_collection_formats, _host=_host, - _request_auth=_request_auth, + _request_auth=_request_auth ) + + diff --git a/cdp/client/api/validators_api.py b/cdp/client/api/validators_api.py index 01cde90..66e62b8 100644 --- a/cdp/client/api/validators_api.py +++ b/cdp/client/api/validators_api.py @@ -1,22 +1,30 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from typing import Annotated, Any + Do not edit the class manually. +""" # noqa: E501 -from pydantic import Field, StrictFloat, StrictInt, StrictStr, validate_call +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 cdp.client.api_client import ApiClient, RequestSerialized -from cdp.client.api_response import ApiResponse +from pydantic import Field, StrictInt, StrictStr +from typing import Optional +from typing_extensions import Annotated 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 from cdp.client.rest import RESTResponseType @@ -32,22 +40,24 @@ def __init__(self, api_client=None) -> None: api_client = ApiClient.get_default() self.api_client = api_client + @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: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = None, + 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 @@ -80,7 +90,8 @@ def get_validator( 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, @@ -88,35 +99,40 @@ def get_validator( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "Validator", + _response_types_map: Dict[str, Optional[str]] = { + '200': "Validator", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = None, + 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 @@ -149,7 +165,8 @@ def get_validator_with_http_info( 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, @@ -157,35 +174,40 @@ def get_validator_with_http_info( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "Validator", + _response_types_map: Dict[str, Optional[str]] = { + '200': "Validator", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = None, + 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 @@ -218,7 +240,8 @@ def get_validator_without_preload_content( 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, @@ -226,15 +249,19 @@ def get_validator_without_preload_content( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "Validator", + _response_types_map: Dict[str, Optional[str]] = { + '200': "Validator", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) return response_data.response + def _get_validator_serialize( self, network_id, @@ -245,39 +272,48 @@ def _get_validator_serialize( _headers, _host_index, ) -> RequestSerialized: + _host = None - _collection_formats: dict[str, str] = {} + _collection_formats: Dict[str, str] = { + } - _path_params: dict[str, str] = {} - _query_params: list[tuple[str, str]] = [] - _header_params: dict[str, str | None] = _headers or {} - _form_params: list[tuple[str, str]] = [] - _files: dict[str, str | bytes] = {} - _body_params: bytes | None = None + _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]] = {} + _body_params: Optional[bytes] = None # process the path parameters if network_id is not None: - _path_params["network_id"] = network_id + _path_params['network_id'] = network_id if asset_id is not None: - _path_params["asset_id"] = asset_id + _path_params['asset_id'] = asset_id if validator_id is not None: - _path_params["validator_id"] = validator_id + _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"]) + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + # authentication setting - _auth_settings: list[str] = [] + _auth_settings: List[str] = [ + ] return self.api_client.param_serialize( - method="GET", - resource_path="/v1/networks/{network_id}/assets/{asset_id}/validators/{validator_id}", + 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, @@ -287,38 +323,31 @@ def _get_validator_serialize( auth_settings=_auth_settings, collection_formats=_collection_formats, _host=_host, - _request_auth=_request_auth, + _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[ - ValidatorStatus | None, - Field(description="A filter to list validators based on a status."), - ] = None, - limit: Annotated[ - StrictInt | None, - 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[ - Annotated[str, Field(strict=True, max_length=5000)] | None, - 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." - ), + 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_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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 @@ -355,7 +384,8 @@ def list_validators( 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, @@ -365,48 +395,42 @@ def list_validators( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "ValidatorList", + _response_types_map: Dict[str, Optional[str]] = { + '200': "ValidatorList", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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[ - ValidatorStatus | None, - Field(description="A filter to list validators based on a status."), + 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, - limit: Annotated[ - StrictInt | None, - 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[ - Annotated[str, Field(strict=True, max_length=5000)] | None, - 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: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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 @@ -443,7 +467,8 @@ def list_validators_with_http_info( 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, @@ -453,48 +478,42 @@ def list_validators_with_http_info( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "ValidatorList", + _response_types_map: Dict[str, Optional[str]] = { + '200': "ValidatorList", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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[ - ValidatorStatus | None, - Field(description="A filter to list validators based on a status."), - ] = None, - limit: Annotated[ - StrictInt | None, - 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[ - Annotated[str, Field(strict=True, max_length=5000)] | None, - 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." - ), + 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_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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 @@ -531,7 +550,8 @@ def list_validators_without_preload_content( 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, @@ -541,15 +561,19 @@ def list_validators_without_preload_content( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "ValidatorList", + _response_types_map: Dict[str, Optional[str]] = { + '200': "ValidatorList", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) return response_data.response + def _list_validators_serialize( self, network_id, @@ -562,46 +586,58 @@ def _list_validators_serialize( _headers, _host_index, ) -> RequestSerialized: + _host = None - _collection_formats: dict[str, str] = {} + _collection_formats: Dict[str, str] = { + } - _path_params: dict[str, str] = {} - _query_params: list[tuple[str, str]] = [] - _header_params: dict[str, str | None] = _headers or {} - _form_params: list[tuple[str, str]] = [] - _files: dict[str, str | bytes] = {} - _body_params: bytes | None = None + _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]] = {} + _body_params: Optional[bytes] = None # process the path parameters if network_id is not None: - _path_params["network_id"] = network_id + _path_params['network_id'] = network_id if asset_id is not None: - _path_params["asset_id"] = asset_id + _path_params['asset_id'] = asset_id # process the query parameters if status is not None: - _query_params.append(("status", status.value)) - + + _query_params.append(('status', status.value)) + if limit is not None: - _query_params.append(("limit", limit)) - + + _query_params.append(('limit', limit)) + if page is not None: - _query_params.append(("page", page)) - + + _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"]) + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + # authentication setting - _auth_settings: list[str] = [] + _auth_settings: List[str] = [ + ] return self.api_client.param_serialize( - method="GET", - resource_path="/v1/networks/{network_id}/assets/{asset_id}/validators", + method='GET', + resource_path='/v1/networks/{network_id}/assets/{asset_id}/validators', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -611,5 +647,7 @@ def _list_validators_serialize( auth_settings=_auth_settings, collection_formats=_collection_formats, _host=_host, - _request_auth=_request_auth, + _request_auth=_request_auth ) + + diff --git a/cdp/client/api/wallet_stake_api.py b/cdp/client/api/wallet_stake_api.py index e9d8a89..1e51cbd 100644 --- a/cdp/client/api/wallet_stake_api.py +++ b/cdp/client/api/wallet_stake_api.py @@ -1,22 +1,29 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from typing import Annotated, Any + Do not edit the class manually. +""" # noqa: E501 -from pydantic import Field, StrictFloat, StrictInt, StrictStr, validate_call +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 cdp.client.api_client import ApiClient, RequestSerialized -from cdp.client.api_response import ApiResponse +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 @@ -32,25 +39,25 @@ def __init__(self, api_client=None) -> 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.") - ], + 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: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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, ) -> StakingOperation: """Broadcast a staking operation @@ -85,7 +92,8 @@ def broadcast_staking_operation( 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, @@ -94,38 +102,41 @@ def broadcast_staking_operation( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "StakingOperation", + _response_types_map: Dict[str, Optional[str]] = { + '200': "StakingOperation", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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.") - ], + 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: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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[StakingOperation]: """Broadcast a staking operation @@ -160,7 +171,8 @@ def broadcast_staking_operation_with_http_info( 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, @@ -169,38 +181,41 @@ def broadcast_staking_operation_with_http_info( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "StakingOperation", + _response_types_map: Dict[str, Optional[str]] = { + '200': "StakingOperation", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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.") - ], + 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: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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: """Broadcast a staking operation @@ -235,7 +250,8 @@ def broadcast_staking_operation_without_preload_content( 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, @@ -244,15 +260,19 @@ def broadcast_staking_operation_without_preload_content( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "StakingOperation", + _response_types_map: Dict[str, Optional[str]] = { + '200': "StakingOperation", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) return response_data.response + def _broadcast_staking_operation_serialize( self, wallet_id, @@ -264,24 +284,26 @@ def _broadcast_staking_operation_serialize( _headers, _host_index, ) -> RequestSerialized: + _host = None - _collection_formats: dict[str, str] = {} + _collection_formats: Dict[str, str] = { + } - _path_params: dict[str, str] = {} - _query_params: list[tuple[str, str]] = [] - _header_params: dict[str, str | None] = _headers or {} - _form_params: list[tuple[str, str]] = [] - _files: dict[str, str | bytes] = {} - _body_params: bytes | None = None + _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]] = {} + _body_params: Optional[bytes] = None # process the path parameters if wallet_id is not None: - _path_params["wallet_id"] = wallet_id + _path_params['wallet_id'] = wallet_id if address_id is not None: - _path_params["address_id"] = address_id + _path_params['address_id'] = address_id if staking_operation_id is not None: - _path_params["staking_operation_id"] = staking_operation_id + _path_params['staking_operation_id'] = staking_operation_id # process the query parameters # process the header parameters # process the form parameters @@ -289,24 +311,36 @@ def _broadcast_staking_operation_serialize( 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"]) + 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 + _header_params['Content-Type'] = _content_type else: - _default_content_type = self.api_client.select_header_content_type(["application/json"]) + _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 + _header_params['Content-Type'] = _default_content_type # authentication setting - _auth_settings: list[str] = [] + _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", + 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, @@ -316,26 +350,29 @@ def _broadcast_staking_operation_serialize( auth_settings=_auth_settings, collection_formats=_collection_formats, _host=_host, - _request_auth=_request_auth, + _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."), - ], + 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: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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, ) -> StakingOperation: """Create a new staking operation for an address @@ -368,7 +405,8 @@ def create_staking_operation( 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, @@ -376,36 +414,40 @@ def create_staking_operation( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "StakingOperation", + _response_types_map: Dict[str, Optional[str]] = { + '200': "StakingOperation", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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."), - ], + 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: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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[StakingOperation]: """Create a new staking operation for an address @@ -438,7 +480,8 @@ def create_staking_operation_with_http_info( 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, @@ -446,36 +489,40 @@ def create_staking_operation_with_http_info( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "StakingOperation", + _response_types_map: Dict[str, Optional[str]] = { + '200': "StakingOperation", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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."), - ], + 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: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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: """Create a new staking operation for an address @@ -508,7 +555,8 @@ def create_staking_operation_without_preload_content( 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, @@ -516,15 +564,19 @@ def create_staking_operation_without_preload_content( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "StakingOperation", + _response_types_map: Dict[str, Optional[str]] = { + '200': "StakingOperation", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) return response_data.response + def _create_staking_operation_serialize( self, wallet_id, @@ -535,22 +587,24 @@ def _create_staking_operation_serialize( _headers, _host_index, ) -> RequestSerialized: + _host = None - _collection_formats: dict[str, str] = {} + _collection_formats: Dict[str, str] = { + } - _path_params: dict[str, str] = {} - _query_params: list[tuple[str, str]] = [] - _header_params: dict[str, str | None] = _headers or {} - _form_params: list[tuple[str, str]] = [] - _files: dict[str, str | bytes] = {} - _body_params: bytes | None = None + _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]] = {} + _body_params: Optional[bytes] = None # process the path parameters if wallet_id is not None: - _path_params["wallet_id"] = wallet_id + _path_params['wallet_id'] = wallet_id if address_id is not None: - _path_params["address_id"] = address_id + _path_params['address_id'] = address_id # process the query parameters # process the header parameters # process the form parameters @@ -558,24 +612,36 @@ def _create_staking_operation_serialize( 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"]) + 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 + _header_params['Content-Type'] = _content_type else: - _default_content_type = self.api_client.select_header_content_type(["application/json"]) + _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 + _header_params['Content-Type'] = _default_content_type # authentication setting - _auth_settings: list[str] = [] + _auth_settings: List[str] = [ + ] return self.api_client.param_serialize( - method="POST", - resource_path="/v1/wallets/{wallet_id}/addresses/{address_id}/staking_operations", + 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, @@ -585,28 +651,29 @@ def _create_staking_operation_serialize( auth_settings=_auth_settings, collection_formats=_collection_formats, _host=_host, - _request_auth=_request_auth, + _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: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = None, + 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 @@ -639,7 +706,8 @@ def get_staking_operation( 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, @@ -647,38 +715,40 @@ def get_staking_operation( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "StakingOperation", + _response_types_map: Dict[str, Optional[str]] = { + '200': "StakingOperation", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = None, + 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 @@ -711,7 +781,8 @@ def get_staking_operation_with_http_info( 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, @@ -719,38 +790,40 @@ def get_staking_operation_with_http_info( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "StakingOperation", + _response_types_map: Dict[str, Optional[str]] = { + '200': "StakingOperation", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = None, + 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 @@ -783,7 +856,8 @@ def get_staking_operation_without_preload_content( 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, @@ -791,15 +865,19 @@ def get_staking_operation_without_preload_content( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "StakingOperation", + _response_types_map: Dict[str, Optional[str]] = { + '200': "StakingOperation", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) return response_data.response + def _get_staking_operation_serialize( self, wallet_id, @@ -810,39 +888,48 @@ def _get_staking_operation_serialize( _headers, _host_index, ) -> RequestSerialized: + _host = None - _collection_formats: dict[str, str] = {} + _collection_formats: Dict[str, str] = { + } - _path_params: dict[str, str] = {} - _query_params: list[tuple[str, str]] = [] - _header_params: dict[str, str | None] = _headers or {} - _form_params: list[tuple[str, str]] = [] - _files: dict[str, str | bytes] = {} - _body_params: bytes | None = None + _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]] = {} + _body_params: Optional[bytes] = None # process the path parameters if wallet_id is not None: - _path_params["wallet_id"] = wallet_id + _path_params['wallet_id'] = wallet_id if address_id is not None: - _path_params["address_id"] = address_id + _path_params['address_id'] = address_id if staking_operation_id is not None: - _path_params["staking_operation_id"] = staking_operation_id + _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"]) + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + # authentication setting - _auth_settings: list[str] = [] + _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}", + 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, @@ -852,5 +939,7 @@ def _get_staking_operation_serialize( auth_settings=_auth_settings, collection_formats=_collection_formats, _host=_host, - _request_auth=_request_auth, + _request_auth=_request_auth ) + + diff --git a/cdp/client/api/wallets_api.py b/cdp/client/api/wallets_api.py index bec76ef..86cd94b 100644 --- a/cdp/client/api/wallets_api.py +++ b/cdp/client/api/wallets_api.py @@ -1,24 +1,32 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from typing import Annotated, Any + Do not edit the class manually. +""" # noqa: E501 -from pydantic import Field, StrictFloat, StrictInt, StrictStr, validate_call +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 cdp.client.api_client import ApiClient, RequestSerialized -from cdp.client.api_response import ApiResponse +from pydantic import Field, StrictInt, StrictStr +from typing import Optional +from typing_extensions import Annotated from cdp.client.models.address_balance_list import AddressBalanceList from cdp.client.models.balance import Balance from cdp.client.models.create_wallet_request import CreateWalletRequest from cdp.client.models.wallet import Wallet from cdp.client.models.wallet_list import WalletList + +from cdp.client.api_client import ApiClient, RequestSerialized +from cdp.client.api_response import ApiResponse from cdp.client.rest import RESTResponseType @@ -34,16 +42,22 @@ def __init__(self, api_client=None) -> None: api_client = ApiClient.get_default() self.api_client = api_client + @validate_call def create_wallet( self, - create_wallet_request: CreateWalletRequest | None = None, - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = None, + create_wallet_request: Optional[CreateWalletRequest] = 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, ) -> Wallet: """Create a new wallet @@ -72,35 +86,45 @@ def create_wallet( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._create_wallet_serialize( create_wallet_request=create_wallet_request, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "Wallet", + _response_types_map: Dict[str, Optional[str]] = { + '200': "Wallet", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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_wallet_with_http_info( self, - create_wallet_request: CreateWalletRequest | None = None, - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = None, + create_wallet_request: Optional[CreateWalletRequest] = 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[Wallet]: """Create a new wallet @@ -129,35 +153,45 @@ def create_wallet_with_http_info( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._create_wallet_serialize( create_wallet_request=create_wallet_request, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "Wallet", + _response_types_map: Dict[str, Optional[str]] = { + '200': "Wallet", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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_wallet_without_preload_content( self, - create_wallet_request: CreateWalletRequest | None = None, - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = None, + create_wallet_request: Optional[CreateWalletRequest] = 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: """Create a new wallet @@ -186,21 +220,26 @@ def create_wallet_without_preload_content( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._create_wallet_serialize( create_wallet_request=create_wallet_request, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "Wallet", + _response_types_map: Dict[str, Optional[str]] = { + '200': "Wallet", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) return response_data.response + def _create_wallet_serialize( self, create_wallet_request, @@ -209,16 +248,18 @@ def _create_wallet_serialize( _headers, _host_index, ) -> RequestSerialized: + _host = None - _collection_formats: dict[str, str] = {} + _collection_formats: Dict[str, str] = { + } - _path_params: dict[str, str] = {} - _query_params: list[tuple[str, str]] = [] - _header_params: dict[str, str | None] = _headers or {} - _form_params: list[tuple[str, str]] = [] - _files: dict[str, str | bytes] = {} - _body_params: bytes | None = None + _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]] = {} + _body_params: Optional[bytes] = None # process the path parameters # process the query parameters @@ -228,24 +269,36 @@ def _create_wallet_serialize( if create_wallet_request is not None: _body_params = create_wallet_request + # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) + 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 + _header_params['Content-Type'] = _content_type else: - _default_content_type = self.api_client.select_header_content_type(["application/json"]) + _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 + _header_params['Content-Type'] = _default_content_type # authentication setting - _auth_settings: list[str] = [] + _auth_settings: List[str] = [ + ] return self.api_client.param_serialize( - method="POST", - resource_path="/v1/wallets", + method='POST', + resource_path='/v1/wallets', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -255,19 +308,27 @@ def _create_wallet_serialize( auth_settings=_auth_settings, collection_formats=_collection_formats, _host=_host, - _request_auth=_request_auth, + _request_auth=_request_auth ) + + + @validate_call def get_wallet( self, wallet_id: Annotated[StrictStr, Field(description="The ID of the wallet to fetch")], - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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, ) -> Wallet: """Get wallet by ID @@ -296,35 +357,45 @@ def get_wallet( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._get_wallet_serialize( wallet_id=wallet_id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "Wallet", + _response_types_map: Dict[str, Optional[str]] = { + '200': "Wallet", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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_wallet_with_http_info( self, wallet_id: Annotated[StrictStr, Field(description="The ID of the wallet to fetch")], - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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[Wallet]: """Get wallet by ID @@ -353,35 +424,45 @@ def get_wallet_with_http_info( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._get_wallet_serialize( wallet_id=wallet_id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "Wallet", + _response_types_map: Dict[str, Optional[str]] = { + '200': "Wallet", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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_wallet_without_preload_content( self, wallet_id: Annotated[StrictStr, Field(description="The ID of the wallet to fetch")], - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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: """Get wallet by ID @@ -410,21 +491,26 @@ def get_wallet_without_preload_content( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._get_wallet_serialize( wallet_id=wallet_id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "Wallet", + _response_types_map: Dict[str, Optional[str]] = { + '200': "Wallet", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) return response_data.response + def _get_wallet_serialize( self, wallet_id, @@ -433,35 +519,44 @@ def _get_wallet_serialize( _headers, _host_index, ) -> RequestSerialized: + _host = None - _collection_formats: dict[str, str] = {} + _collection_formats: Dict[str, str] = { + } - _path_params: dict[str, str] = {} - _query_params: list[tuple[str, str]] = [] - _header_params: dict[str, str | None] = _headers or {} - _form_params: list[tuple[str, str]] = [] - _files: dict[str, str | bytes] = {} - _body_params: bytes | None = None + _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]] = {} + _body_params: Optional[bytes] = None # process the path parameters if wallet_id is not None: - _path_params["wallet_id"] = wallet_id + _path_params['wallet_id'] = wallet_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"]) + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + # authentication setting - _auth_settings: list[str] = [] + _auth_settings: List[str] = [ + ] return self.api_client.param_serialize( - method="GET", - resource_path="/v1/wallets/{wallet_id}", + method='GET', + resource_path='/v1/wallets/{wallet_id}', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -471,24 +566,28 @@ def _get_wallet_serialize( auth_settings=_auth_settings, collection_formats=_collection_formats, _host=_host, - _request_auth=_request_auth, + _request_auth=_request_auth ) + + + @validate_call def get_wallet_balance( self, - wallet_id: Annotated[ - StrictStr, Field(description="The ID of the wallet to fetch the balance for") - ], - asset_id: Annotated[ - StrictStr, Field(description="The symbol of the asset to fetch the balance for") - ], - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = None, + wallet_id: Annotated[StrictStr, Field(description="The ID of the wallet to fetch the balance for")], + asset_id: Annotated[StrictStr, Field(description="The symbol of the asset to fetch the balance 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, ) -> Balance: """Get the balance of an asset in the wallet @@ -519,41 +618,47 @@ def get_wallet_balance( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._get_wallet_balance_serialize( wallet_id=wallet_id, asset_id=asset_id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "Balance", + _response_types_map: Dict[str, Optional[str]] = { + '200': "Balance", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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_wallet_balance_with_http_info( self, - wallet_id: Annotated[ - StrictStr, Field(description="The ID of the wallet to fetch the balance for") - ], - asset_id: Annotated[ - StrictStr, Field(description="The symbol of the asset to fetch the balance for") - ], - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = None, + wallet_id: Annotated[StrictStr, Field(description="The ID of the wallet to fetch the balance for")], + asset_id: Annotated[StrictStr, Field(description="The symbol of the asset to fetch the balance 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[Balance]: """Get the balance of an asset in the wallet @@ -584,41 +689,47 @@ def get_wallet_balance_with_http_info( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._get_wallet_balance_serialize( wallet_id=wallet_id, asset_id=asset_id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "Balance", + _response_types_map: Dict[str, Optional[str]] = { + '200': "Balance", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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_wallet_balance_without_preload_content( self, - wallet_id: Annotated[ - StrictStr, Field(description="The ID of the wallet to fetch the balance for") - ], - asset_id: Annotated[ - StrictStr, Field(description="The symbol of the asset to fetch the balance for") - ], - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = None, + wallet_id: Annotated[StrictStr, Field(description="The ID of the wallet to fetch the balance for")], + asset_id: Annotated[StrictStr, Field(description="The symbol of the asset to fetch the balance 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 the balance of an asset in the wallet @@ -649,22 +760,27 @@ def get_wallet_balance_without_preload_content( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._get_wallet_balance_serialize( wallet_id=wallet_id, asset_id=asset_id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "Balance", + _response_types_map: Dict[str, Optional[str]] = { + '200': "Balance", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) return response_data.response + def _get_wallet_balance_serialize( self, wallet_id, @@ -674,37 +790,46 @@ def _get_wallet_balance_serialize( _headers, _host_index, ) -> RequestSerialized: + _host = None - _collection_formats: dict[str, str] = {} + _collection_formats: Dict[str, str] = { + } - _path_params: dict[str, str] = {} - _query_params: list[tuple[str, str]] = [] - _header_params: dict[str, str | None] = _headers or {} - _form_params: list[tuple[str, str]] = [] - _files: dict[str, str | bytes] = {} - _body_params: bytes | None = None + _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]] = {} + _body_params: Optional[bytes] = None # process the path parameters if wallet_id is not None: - _path_params["wallet_id"] = wallet_id + _path_params['wallet_id'] = wallet_id if asset_id is not None: - _path_params["asset_id"] = asset_id + _path_params['asset_id'] = asset_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"]) + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + # authentication setting - _auth_settings: list[str] = [] + _auth_settings: List[str] = [ + ] return self.api_client.param_serialize( - method="GET", - resource_path="/v1/wallets/{wallet_id}/balances/{asset_id}", + method='GET', + resource_path='/v1/wallets/{wallet_id}/balances/{asset_id}', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -714,21 +839,27 @@ def _get_wallet_balance_serialize( auth_settings=_auth_settings, collection_formats=_collection_formats, _host=_host, - _request_auth=_request_auth, + _request_auth=_request_auth ) + + + @validate_call def list_wallet_balances( self, - wallet_id: Annotated[ - StrictStr, Field(description="The ID of the wallet to fetch the balances for") - ], - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = None, + wallet_id: Annotated[StrictStr, Field(description="The ID of the wallet to fetch the balances 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, ) -> AddressBalanceList: """List wallet balances @@ -757,37 +888,45 @@ def list_wallet_balances( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._list_wallet_balances_serialize( wallet_id=wallet_id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "AddressBalanceList", + _response_types_map: Dict[str, Optional[str]] = { + '200': "AddressBalanceList", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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_wallet_balances_with_http_info( self, - wallet_id: Annotated[ - StrictStr, Field(description="The ID of the wallet to fetch the balances for") - ], - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = None, + wallet_id: Annotated[StrictStr, Field(description="The ID of the wallet to fetch the balances 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[AddressBalanceList]: """List wallet balances @@ -816,37 +955,45 @@ def list_wallet_balances_with_http_info( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._list_wallet_balances_serialize( wallet_id=wallet_id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "AddressBalanceList", + _response_types_map: Dict[str, Optional[str]] = { + '200': "AddressBalanceList", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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_wallet_balances_without_preload_content( self, - wallet_id: Annotated[ - StrictStr, Field(description="The ID of the wallet to fetch the balances for") - ], - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = None, + wallet_id: Annotated[StrictStr, Field(description="The ID of the wallet to fetch the balances 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: """List wallet balances @@ -875,21 +1022,26 @@ def list_wallet_balances_without_preload_content( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._list_wallet_balances_serialize( wallet_id=wallet_id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "AddressBalanceList", + _response_types_map: Dict[str, Optional[str]] = { + '200': "AddressBalanceList", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) return response_data.response + def _list_wallet_balances_serialize( self, wallet_id, @@ -898,35 +1050,44 @@ def _list_wallet_balances_serialize( _headers, _host_index, ) -> RequestSerialized: + _host = None - _collection_formats: dict[str, str] = {} + _collection_formats: Dict[str, str] = { + } - _path_params: dict[str, str] = {} - _query_params: list[tuple[str, str]] = [] - _header_params: dict[str, str | None] = _headers or {} - _form_params: list[tuple[str, str]] = [] - _files: dict[str, str | bytes] = {} - _body_params: bytes | None = None + _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]] = {} + _body_params: Optional[bytes] = None # process the path parameters if wallet_id is not None: - _path_params["wallet_id"] = wallet_id + _path_params['wallet_id'] = wallet_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"]) + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + # authentication setting - _auth_settings: list[str] = [] + _auth_settings: List[str] = [ + ] return self.api_client.param_serialize( - method="GET", - resource_path="/v1/wallets/{wallet_id}/balances", + method='GET', + resource_path='/v1/wallets/{wallet_id}/balances', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -936,30 +1097,28 @@ def _list_wallet_balances_serialize( auth_settings=_auth_settings, collection_formats=_collection_formats, _host=_host, - _request_auth=_request_auth, + _request_auth=_request_auth ) + + + @validate_call def list_wallets( self, - limit: Annotated[ - StrictInt | None, - Field( - description="A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10." - ), - ] = None, - page: Annotated[ - Annotated[str, Field(strict=True, max_length=5000)] | None, - 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." - ), + 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 10.")] = 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_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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, ) -> WalletList: """List wallets @@ -990,47 +1149,47 @@ def list_wallets( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._list_wallets_serialize( limit=limit, page=page, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "WalletList", + _response_types_map: Dict[str, Optional[str]] = { + '200': "WalletList", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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_wallets_with_http_info( self, - limit: Annotated[ - StrictInt | None, - Field( - description="A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10." - ), - ] = None, - page: Annotated[ - Annotated[str, Field(strict=True, max_length=5000)] | None, - 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." - ), + 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 10.")] = 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_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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[WalletList]: """List wallets @@ -1061,47 +1220,47 @@ def list_wallets_with_http_info( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._list_wallets_serialize( limit=limit, page=page, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "WalletList", + _response_types_map: Dict[str, Optional[str]] = { + '200': "WalletList", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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_wallets_without_preload_content( self, - limit: Annotated[ - StrictInt | None, - Field( - description="A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10." - ), + 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 10.")] = 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, - page: Annotated[ - Annotated[str, Field(strict=True, max_length=5000)] | None, - 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: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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 wallets @@ -1132,22 +1291,27 @@ def list_wallets_without_preload_content( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._list_wallets_serialize( limit=limit, page=page, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "WalletList", + _response_types_map: Dict[str, Optional[str]] = { + '200': "WalletList", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) return response_data.response + def _list_wallets_serialize( self, limit, @@ -1157,39 +1321,50 @@ def _list_wallets_serialize( _headers, _host_index, ) -> RequestSerialized: + _host = None - _collection_formats: dict[str, str] = {} + _collection_formats: Dict[str, str] = { + } - _path_params: dict[str, str] = {} - _query_params: list[tuple[str, str]] = [] - _header_params: dict[str, str | None] = _headers or {} - _form_params: list[tuple[str, str]] = [] - _files: dict[str, str | bytes] = {} - _body_params: bytes | None = None + _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]] = {} + _body_params: Optional[bytes] = None # process the path parameters # process the query parameters if limit is not None: - _query_params.append(("limit", limit)) - + + _query_params.append(('limit', limit)) + if page is not None: - _query_params.append(("page", page)) - + + _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"]) + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + # authentication setting - _auth_settings: list[str] = [] + _auth_settings: List[str] = [ + ] return self.api_client.param_serialize( - method="GET", - resource_path="/v1/wallets", + method='GET', + resource_path='/v1/wallets', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -1199,5 +1374,7 @@ def _list_wallets_serialize( auth_settings=_auth_settings, collection_formats=_collection_formats, _host=_host, - _request_auth=_request_auth, + _request_auth=_request_auth ) + + diff --git a/cdp/client/api/webhooks_api.py b/cdp/client/api/webhooks_api.py index d17fa49..7e0f4c7 100644 --- a/cdp/client/api/webhooks_api.py +++ b/cdp/client/api/webhooks_api.py @@ -1,23 +1,32 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from typing import Annotated, Any + Do not edit the class manually. +""" # noqa: E501 -from pydantic import Field, StrictFloat, StrictInt, StrictStr, validate_call +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 cdp.client.api_client import ApiClient, RequestSerialized -from cdp.client.api_response import ApiResponse +from pydantic import Field, StrictInt, StrictStr +from typing import Optional +from typing_extensions import Annotated +from cdp.client.models.create_wallet_webhook_request import CreateWalletWebhookRequest from cdp.client.models.create_webhook_request import CreateWebhookRequest from cdp.client.models.update_webhook_request import UpdateWebhookRequest from cdp.client.models.webhook import Webhook from cdp.client.models.webhook_list import WebhookList + +from cdp.client.api_client import ApiClient, RequestSerialized +from cdp.client.api_response import ApiResponse from cdp.client.rest import RESTResponseType @@ -33,16 +42,308 @@ def __init__(self, api_client=None) -> None: api_client = ApiClient.get_default() self.api_client = api_client + + @validate_call + def create_wallet_webhook( + self, + wallet_id: Annotated[StrictStr, Field(description="The ID of the wallet to create the webhook for.")], + create_wallet_webhook_request: Optional[CreateWalletWebhookRequest] = 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, + ) -> Webhook: + """Create a new webhook scoped to a wallet + + Create a new webhook scoped to a wallet + + :param wallet_id: The ID of the wallet to create the webhook for. (required) + :type wallet_id: str + :param create_wallet_webhook_request: + :type create_wallet_webhook_request: CreateWalletWebhookRequest + :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_wallet_webhook_serialize( + wallet_id=wallet_id, + create_wallet_webhook_request=create_wallet_webhook_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Webhook", + } + 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_wallet_webhook_with_http_info( + self, + wallet_id: Annotated[StrictStr, Field(description="The ID of the wallet to create the webhook for.")], + create_wallet_webhook_request: Optional[CreateWalletWebhookRequest] = 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[Webhook]: + """Create a new webhook scoped to a wallet + + Create a new webhook scoped to a wallet + + :param wallet_id: The ID of the wallet to create the webhook for. (required) + :type wallet_id: str + :param create_wallet_webhook_request: + :type create_wallet_webhook_request: CreateWalletWebhookRequest + :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_wallet_webhook_serialize( + wallet_id=wallet_id, + create_wallet_webhook_request=create_wallet_webhook_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Webhook", + } + 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_wallet_webhook_without_preload_content( + self, + wallet_id: Annotated[StrictStr, Field(description="The ID of the wallet to create the webhook for.")], + create_wallet_webhook_request: Optional[CreateWalletWebhookRequest] = 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: + """Create a new webhook scoped to a wallet + + Create a new webhook scoped to a wallet + + :param wallet_id: The ID of the wallet to create the webhook for. (required) + :type wallet_id: str + :param create_wallet_webhook_request: + :type create_wallet_webhook_request: CreateWalletWebhookRequest + :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_wallet_webhook_serialize( + wallet_id=wallet_id, + create_wallet_webhook_request=create_wallet_webhook_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Webhook", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_wallet_webhook_serialize( + self, + wallet_id, + create_wallet_webhook_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]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if wallet_id is not None: + _path_params['wallet_id'] = wallet_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if create_wallet_webhook_request is not None: + _body_params = create_wallet_webhook_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}/webhooks', + 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_webhook( self, - create_webhook_request: CreateWebhookRequest | None = None, - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = None, + create_webhook_request: Optional[CreateWebhookRequest] = 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, ) -> Webhook: """Create a new webhook @@ -71,35 +372,45 @@ def create_webhook( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._create_webhook_serialize( create_webhook_request=create_webhook_request, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "Webhook", + _response_types_map: Dict[str, Optional[str]] = { + '200': "Webhook", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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_webhook_with_http_info( self, - create_webhook_request: CreateWebhookRequest | None = None, - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = None, + create_webhook_request: Optional[CreateWebhookRequest] = 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[Webhook]: """Create a new webhook @@ -128,35 +439,45 @@ def create_webhook_with_http_info( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._create_webhook_serialize( create_webhook_request=create_webhook_request, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "Webhook", + _response_types_map: Dict[str, Optional[str]] = { + '200': "Webhook", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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_webhook_without_preload_content( self, - create_webhook_request: CreateWebhookRequest | None = None, - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = None, + create_webhook_request: Optional[CreateWebhookRequest] = 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: """Create a new webhook @@ -185,21 +506,26 @@ def create_webhook_without_preload_content( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._create_webhook_serialize( create_webhook_request=create_webhook_request, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "Webhook", + _response_types_map: Dict[str, Optional[str]] = { + '200': "Webhook", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) return response_data.response + def _create_webhook_serialize( self, create_webhook_request, @@ -208,16 +534,18 @@ def _create_webhook_serialize( _headers, _host_index, ) -> RequestSerialized: + _host = None - _collection_formats: dict[str, str] = {} + _collection_formats: Dict[str, str] = { + } - _path_params: dict[str, str] = {} - _query_params: list[tuple[str, str]] = [] - _header_params: dict[str, str | None] = _headers or {} - _form_params: list[tuple[str, str]] = [] - _files: dict[str, str | bytes] = {} - _body_params: bytes | None = None + _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]] = {} + _body_params: Optional[bytes] = None # process the path parameters # process the query parameters @@ -227,24 +555,36 @@ def _create_webhook_serialize( if create_webhook_request is not None: _body_params = create_webhook_request + # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) + 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 + _header_params['Content-Type'] = _content_type else: - _default_content_type = self.api_client.select_header_content_type(["application/json"]) + _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 + _header_params['Content-Type'] = _default_content_type # authentication setting - _auth_settings: list[str] = [] + _auth_settings: List[str] = [ + ] return self.api_client.param_serialize( - method="POST", - resource_path="/v1/webhooks", + method='POST', + resource_path='/v1/webhooks', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -254,21 +594,27 @@ def _create_webhook_serialize( auth_settings=_auth_settings, collection_formats=_collection_formats, _host=_host, - _request_auth=_request_auth, + _request_auth=_request_auth ) + + + @validate_call def delete_webhook( self, - webhook_id: Annotated[ - StrictStr, Field(description="The Webhook uuid that needs to be deleted") - ], - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = None, + webhook_id: Annotated[StrictStr, Field(description="The Webhook uuid that needs to be deleted")], + _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, ) -> None: """Delete a webhook @@ -297,37 +643,45 @@ def delete_webhook( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._delete_webhook_serialize( webhook_id=webhook_id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": None, + _response_types_map: Dict[str, Optional[str]] = { + '200': None, } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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 delete_webhook_with_http_info( self, - webhook_id: Annotated[ - StrictStr, Field(description="The Webhook uuid that needs to be deleted") - ], - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = None, + webhook_id: Annotated[StrictStr, Field(description="The Webhook uuid that needs to be deleted")], + _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[None]: """Delete a webhook @@ -356,37 +710,45 @@ def delete_webhook_with_http_info( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._delete_webhook_serialize( webhook_id=webhook_id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": None, + _response_types_map: Dict[str, Optional[str]] = { + '200': None, } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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 delete_webhook_without_preload_content( self, - webhook_id: Annotated[ - StrictStr, Field(description="The Webhook uuid that needs to be deleted") - ], - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = None, + webhook_id: Annotated[StrictStr, Field(description="The Webhook uuid that needs to be deleted")], + _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: """Delete a webhook @@ -415,21 +777,26 @@ def delete_webhook_without_preload_content( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._delete_webhook_serialize( webhook_id=webhook_id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": None, + _response_types_map: Dict[str, Optional[str]] = { + '200': None, } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) return response_data.response + def _delete_webhook_serialize( self, webhook_id, @@ -438,35 +805,44 @@ def _delete_webhook_serialize( _headers, _host_index, ) -> RequestSerialized: + _host = None - _collection_formats: dict[str, str] = {} + _collection_formats: Dict[str, str] = { + } - _path_params: dict[str, str] = {} - _query_params: list[tuple[str, str]] = [] - _header_params: dict[str, str | None] = _headers or {} - _form_params: list[tuple[str, str]] = [] - _files: dict[str, str | bytes] = {} - _body_params: bytes | None = None + _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]] = {} + _body_params: Optional[bytes] = None # process the path parameters if webhook_id is not None: - _path_params["webhook_id"] = webhook_id + _path_params['webhook_id'] = webhook_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"]) + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + # authentication setting - _auth_settings: list[str] = [] + _auth_settings: List[str] = [ + ] return self.api_client.param_serialize( - method="DELETE", - resource_path="/v1/webhooks/{webhook_id}", + method='DELETE', + resource_path='/v1/webhooks/{webhook_id}', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -476,30 +852,28 @@ def _delete_webhook_serialize( auth_settings=_auth_settings, collection_formats=_collection_formats, _host=_host, - _request_auth=_request_auth, + _request_auth=_request_auth ) + + + @validate_call def list_webhooks( self, - limit: Annotated[ - StrictInt | None, - Field( - description="A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10." - ), - ] = None, - page: Annotated[ - Annotated[str, Field(strict=True, max_length=5000)] | None, - 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." - ), + 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 10.")] = 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_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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, ) -> WebhookList: """List webhooks @@ -530,47 +904,47 @@ def list_webhooks( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._list_webhooks_serialize( limit=limit, page=page, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "WebhookList", + _response_types_map: Dict[str, Optional[str]] = { + '200': "WebhookList", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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_webhooks_with_http_info( self, - limit: Annotated[ - StrictInt | None, - Field( - description="A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10." - ), - ] = None, - page: Annotated[ - Annotated[str, Field(strict=True, max_length=5000)] | None, - 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." - ), + 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 10.")] = 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_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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[WebhookList]: """List webhooks @@ -601,47 +975,47 @@ def list_webhooks_with_http_info( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._list_webhooks_serialize( limit=limit, page=page, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "WebhookList", + _response_types_map: Dict[str, Optional[str]] = { + '200': "WebhookList", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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_webhooks_without_preload_content( self, - limit: Annotated[ - StrictInt | None, - Field( - description="A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10." - ), - ] = None, - page: Annotated[ - Annotated[str, Field(strict=True, max_length=5000)] | None, - 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." - ), + 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 10.")] = 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_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = 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 webhooks @@ -672,22 +1046,27 @@ def list_webhooks_without_preload_content( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._list_webhooks_serialize( limit=limit, page=page, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "WebhookList", + _response_types_map: Dict[str, Optional[str]] = { + '200': "WebhookList", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) return response_data.response + def _list_webhooks_serialize( self, limit, @@ -697,39 +1076,50 @@ def _list_webhooks_serialize( _headers, _host_index, ) -> RequestSerialized: + _host = None - _collection_formats: dict[str, str] = {} + _collection_formats: Dict[str, str] = { + } - _path_params: dict[str, str] = {} - _query_params: list[tuple[str, str]] = [] - _header_params: dict[str, str | None] = _headers or {} - _form_params: list[tuple[str, str]] = [] - _files: dict[str, str | bytes] = {} - _body_params: bytes | None = None + _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]] = {} + _body_params: Optional[bytes] = None # process the path parameters # process the query parameters if limit is not None: - _query_params.append(("limit", limit)) - + + _query_params.append(('limit', limit)) + if page is not None: - _query_params.append(("page", page)) - + + _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"]) + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + # authentication setting - _auth_settings: list[str] = [] + _auth_settings: List[str] = [ + ] return self.api_client.param_serialize( - method="GET", - resource_path="/v1/webhooks", + method='GET', + resource_path='/v1/webhooks', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -739,22 +1129,28 @@ def _list_webhooks_serialize( auth_settings=_auth_settings, collection_formats=_collection_formats, _host=_host, - _request_auth=_request_auth, + _request_auth=_request_auth ) + + + @validate_call def update_webhook( self, - webhook_id: Annotated[ - StrictStr, Field(description="The Webhook id that needs to be updated") - ], - update_webhook_request: UpdateWebhookRequest | None = None, - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = None, + webhook_id: Annotated[StrictStr, Field(description="The Webhook id that needs to be updated")], + update_webhook_request: Optional[UpdateWebhookRequest] = 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, ) -> Webhook: """Update a webhook @@ -785,39 +1181,47 @@ def update_webhook( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._update_webhook_serialize( webhook_id=webhook_id, update_webhook_request=update_webhook_request, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "Webhook", + _response_types_map: Dict[str, Optional[str]] = { + '200': "Webhook", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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 update_webhook_with_http_info( self, - webhook_id: Annotated[ - StrictStr, Field(description="The Webhook id that needs to be updated") - ], - update_webhook_request: UpdateWebhookRequest | None = None, - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = None, + webhook_id: Annotated[StrictStr, Field(description="The Webhook id that needs to be updated")], + update_webhook_request: Optional[UpdateWebhookRequest] = 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[Webhook]: """Update a webhook @@ -848,39 +1252,47 @@ def update_webhook_with_http_info( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._update_webhook_serialize( webhook_id=webhook_id, update_webhook_request=update_webhook_request, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "Webhook", + _response_types_map: Dict[str, Optional[str]] = { + '200': "Webhook", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + 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 update_webhook_without_preload_content( self, - webhook_id: Annotated[ - StrictStr, Field(description="The Webhook id that needs to be updated") - ], - update_webhook_request: UpdateWebhookRequest | None = None, - _request_timeout: None - | Annotated[StrictFloat, Field(gt=0)] - | tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]] = None, - _request_auth: dict[StrictStr, Any] | None = None, - _content_type: StrictStr | None = None, - _headers: dict[StrictStr, Any] | None = None, + webhook_id: Annotated[StrictStr, Field(description="The Webhook id that needs to be updated")], + update_webhook_request: Optional[UpdateWebhookRequest] = 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: """Update a webhook @@ -911,22 +1323,27 @@ def update_webhook_without_preload_content( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ + """ # noqa: E501 + _param = self._update_webhook_serialize( webhook_id=webhook_id, update_webhook_request=update_webhook_request, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, - _host_index=_host_index, + _host_index=_host_index ) - _response_types_map: dict[str, str | None] = { - "200": "Webhook", + _response_types_map: Dict[str, Optional[str]] = { + '200': "Webhook", } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) return response_data.response + def _update_webhook_serialize( self, webhook_id, @@ -936,20 +1353,22 @@ def _update_webhook_serialize( _headers, _host_index, ) -> RequestSerialized: + _host = None - _collection_formats: dict[str, str] = {} + _collection_formats: Dict[str, str] = { + } - _path_params: dict[str, str] = {} - _query_params: list[tuple[str, str]] = [] - _header_params: dict[str, str | None] = _headers or {} - _form_params: list[tuple[str, str]] = [] - _files: dict[str, str | bytes] = {} - _body_params: bytes | None = None + _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]] = {} + _body_params: Optional[bytes] = None # process the path parameters if webhook_id is not None: - _path_params["webhook_id"] = webhook_id + _path_params['webhook_id'] = webhook_id # process the query parameters # process the header parameters # process the form parameters @@ -957,24 +1376,36 @@ def _update_webhook_serialize( if update_webhook_request is not None: _body_params = update_webhook_request + # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) + 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 + _header_params['Content-Type'] = _content_type else: - _default_content_type = self.api_client.select_header_content_type(["application/json"]) + _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 + _header_params['Content-Type'] = _default_content_type # authentication setting - _auth_settings: list[str] = [] + _auth_settings: List[str] = [ + ] return self.api_client.param_serialize( - method="PUT", - resource_path="/v1/webhooks/{webhook_id}", + method='PUT', + resource_path='/v1/webhooks/{webhook_id}', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -984,5 +1415,7 @@ def _update_webhook_serialize( auth_settings=_auth_settings, collection_formats=_collection_formats, _host=_host, - _request_auth=_request_auth, + _request_auth=_request_auth ) + + diff --git a/cdp/client/api_client.py b/cdp/client/api_client.py index 7e29fa1..52369de 100644 --- a/cdp/client/api_client.py +++ b/cdp/client/api_client.py @@ -1,38 +1,46 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + 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 -Do not edit the class manually. -""" import datetime +from dateutil.parser import parse +from enum import Enum import decimal import json import mimetypes import os import re import tempfile -from enum import Enum -from urllib.parse import quote -from dateutil.parser import parse +from urllib.parse import quote +from typing import Tuple, Optional, List, Dict, Union from pydantic import SecretStr +from cdp.client.configuration import Configuration +from cdp.client.api_response import ApiResponse, T as ApiResponseT import cdp.client.models from cdp.client import rest -from cdp.client.api_response import ApiResponse -from cdp.client.api_response import T as ApiResponseT -from cdp.client.configuration import Configuration from cdp.client.exceptions import ( - ApiException, ApiValueError, + ApiException, + BadRequestException, + UnauthorizedException, + ForbiddenException, + NotFoundException, + ServiceException ) -RequestSerialized = tuple[str, str, dict[str, str], str | None, list[str]] - +RequestSerialized = Tuple[str, str, Dict[str, str], Optional[str], List[str]] class ApiClient: """Generic API client for OpenAPI client library builds. @@ -52,20 +60,24 @@ class ApiClient: PRIMITIVE_TYPES = (float, bool, bytes, str, int) NATIVE_TYPES_MAPPING = { - "int": int, - "long": int, # TODO remove as only py3 is supported? - "float": float, - "str": str, - "bool": bool, - "date": datetime.date, - "datetime": datetime.datetime, - "decimal": decimal.Decimal, - "object": object, + 'int': int, + 'long': int, # TODO remove as only py3 is supported? + 'float': float, + 'str': str, + 'bool': bool, + 'date': datetime.date, + 'datetime': datetime.datetime, + 'decimal': decimal.Decimal, + 'object': object, } _pool = None def __init__( - self, configuration=None, header_name=None, header_value=None, cookie=None + self, + configuration=None, + header_name=None, + header_value=None, + cookie=None ) -> None: # use default configuration if none is provided if configuration is None: @@ -78,7 +90,7 @@ def __init__( self.default_headers[header_name] = header_value self.cookie = cookie # Set default User-Agent. - self.user_agent = "OpenAPI-Generator/1.0.0/python" + self.user_agent = 'OpenAPI-Generator/1.0.0/python' self.client_side_validation = configuration.client_side_validation def __enter__(self): @@ -90,15 +102,16 @@ def __exit__(self, exc_type, exc_value, traceback): @property def user_agent(self): """User agent for this API client""" - return self.default_headers["User-Agent"] + return self.default_headers['User-Agent'] @user_agent.setter def user_agent(self, value): - self.default_headers["User-Agent"] = value + self.default_headers['User-Agent'] = value def set_default_header(self, header_name, header_value): self.default_headers[header_name] = header_value + _default = None @classmethod @@ -134,12 +147,12 @@ def param_serialize( header_params=None, body=None, post_params=None, - files=None, - auth_settings=None, + files=None, auth_settings=None, collection_formats=None, _host=None, - _request_auth=None, + _request_auth=None ) -> RequestSerialized: + """Builds the HTTP request params needed by the request. :param method: Method to call. :param resource_path: Path to method endpoint. @@ -161,32 +174,42 @@ def param_serialize( :return: tuple of form (path, http_method, query_params, header_params, body, post_params, files) """ + config = self.configuration # header parameters header_params = header_params or {} header_params.update(self.default_headers) if self.cookie: - header_params["Cookie"] = self.cookie + header_params['Cookie'] = self.cookie if header_params: header_params = self.sanitize_for_serialization(header_params) - header_params = dict(self.parameters_to_tuples(header_params, collection_formats)) + header_params = dict( + self.parameters_to_tuples(header_params,collection_formats) + ) # path parameters if path_params: path_params = self.sanitize_for_serialization(path_params) - path_params = self.parameters_to_tuples(path_params, collection_formats) + path_params = self.parameters_to_tuples( + path_params, + collection_formats + ) for k, v in path_params: # specified safe chars, encode everything resource_path = resource_path.replace( - "{%s}" % k, quote(str(v), safe=config.safe_chars_for_path_param) + '{%s}' % k, + quote(str(v), safe=config.safe_chars_for_path_param) ) # post parameters if post_params or files: post_params = post_params if post_params else [] post_params = self.sanitize_for_serialization(post_params) - post_params = self.parameters_to_tuples(post_params, collection_formats) + post_params = self.parameters_to_tuples( + post_params, + collection_formats + ) if files: post_params.extend(self.files_parameters(files)) @@ -198,7 +221,7 @@ def param_serialize( resource_path, method, body, - request_auth=_request_auth, + request_auth=_request_auth ) # body @@ -215,13 +238,23 @@ def param_serialize( # query parameters if query_params: query_params = self.sanitize_for_serialization(query_params) - url_query = self.parameters_to_url_query(query_params, collection_formats) + url_query = self.parameters_to_url_query( + query_params, + collection_formats + ) url += "?" + url_query return method, url, header_params, body, post_params + def call_api( - self, method, url, header_params=None, body=None, post_params=None, _request_timeout=None + self, + method, + url, + header_params=None, + body=None, + post_params=None, + _request_timeout=None ) -> rest.RESTResponse: """Makes the HTTP request (synchronous) :param method: Method to call. @@ -234,15 +267,14 @@ def call_api( :param _request_timeout: timeout setting for this request. :return: RESTResponse """ + try: # perform request and return response response_data = self.rest_client.request( - method, - url, + method, url, headers=header_params, - body=body, - post_params=post_params, - _request_timeout=_request_timeout, + body=body, post_params=post_params, + _request_timeout=_request_timeout ) except ApiException as e: @@ -253,22 +285,19 @@ def call_api( def response_deserialize( self, response_data: rest.RESTResponse, - response_types_map: dict[str, ApiResponseT] | None = None, + response_types_map: Optional[Dict[str, ApiResponseT]]=None ) -> ApiResponse[ApiResponseT]: """Deserializes response into an object. :param response_data: RESTResponse object to be deserialized. :param response_types_map: dict of response types. :return: ApiResponse """ + msg = "RESTResponse.read() must be called before passing it to response_deserialize()" assert response_data.data is not None, msg response_type = response_types_map.get(str(response_data.status), None) - if ( - not response_type - and isinstance(response_data.status, int) - and 100 <= response_data.status <= 599 - ): + if not response_type and isinstance(response_data.status, int) and 100 <= response_data.status <= 599: # if not found, look for '1XX', '2XX', etc. response_type = response_types_map.get(str(response_data.status)[0] + "XX", None) @@ -282,7 +311,7 @@ def response_deserialize( return_data = self.__deserialize_file(response_data) elif response_type is not None: match = None - content_type = response_data.getheader("content-type") + content_type = response_data.getheader('content-type') if content_type is not None: match = re.search(r"charset=([a-zA-Z\-\d]+)[\s;]?", content_type) encoding = match.group(1) if match else "utf-8" @@ -297,10 +326,10 @@ def response_deserialize( ) return ApiResponse( - status_code=response_data.status, - data=return_data, - headers=response_data.getheaders(), - raw_data=response_data.data, + status_code = response_data.status, + data = return_data, + headers = response_data.getheaders(), + raw_data = response_data.data ) def sanitize_for_serialization(self, obj): @@ -328,9 +357,13 @@ def sanitize_for_serialization(self, obj): elif isinstance(obj, self.PRIMITIVE_TYPES): return obj elif isinstance(obj, list): - return [self.sanitize_for_serialization(sub_obj) for sub_obj in obj] + return [ + self.sanitize_for_serialization(sub_obj) for sub_obj in obj + ] elif isinstance(obj, tuple): - return tuple(self.sanitize_for_serialization(sub_obj) for sub_obj in obj) + return tuple( + self.sanitize_for_serialization(sub_obj) for sub_obj in obj + ) elif isinstance(obj, (datetime.datetime, datetime.date)): return obj.isoformat() elif isinstance(obj, decimal.Decimal): @@ -344,14 +377,17 @@ def sanitize_for_serialization(self, obj): # and attributes which value is not None. # Convert attribute name to json key in # model definition for request. - if hasattr(obj, "to_dict") and callable(obj.to_dict): + if hasattr(obj, 'to_dict') and callable(getattr(obj, 'to_dict')): obj_dict = obj.to_dict() else: obj_dict = obj.__dict__ - return {key: self.sanitize_for_serialization(val) for key, val in obj_dict.items()} + return { + key: self.sanitize_for_serialization(val) + for key, val in obj_dict.items() + } - def deserialize(self, response_text: str, response_type: str, content_type: str | None): + def deserialize(self, response_text: str, response_type: str, content_type: Optional[str]): """Deserializes response into an object. :param response: RESTResponse object to be deserialized. @@ -361,6 +397,7 @@ def deserialize(self, response_text: str, response_type: str, content_type: str :return: deserialized object. """ + # fetch data from response object if content_type is None: try: @@ -375,7 +412,10 @@ def deserialize(self, response_text: str, response_type: str, content_type: str elif content_type.startswith("text/plain"): data = response_text else: - raise ApiException(status=0, reason=f"Unsupported content type: {content_type}") + raise ApiException( + status=0, + reason="Unsupported content type: {0}".format(content_type) + ) return self.__deserialize(data, response_type) @@ -391,17 +431,19 @@ def __deserialize(self, data, klass): return None if isinstance(klass, str): - if klass.startswith("List["): - m = re.match(r"List\[(.*)]", klass) + if klass.startswith('List['): + m = re.match(r'List\[(.*)]', klass) assert m is not None, "Malformed List type definition" sub_kls = m.group(1) - return [self.__deserialize(sub_data, sub_kls) for sub_data in data] + return [self.__deserialize(sub_data, sub_kls) + for sub_data in data] - if klass.startswith("Dict["): - m = re.match(r"Dict\[([^,]*), (.*)]", klass) + if klass.startswith('Dict['): + m = re.match(r'Dict\[([^,]*), (.*)]', klass) assert m is not None, "Malformed Dict type definition" sub_kls = m.group(2) - return {k: self.__deserialize(v, sub_kls) for k, v in data.items()} + return {k: self.__deserialize(v, sub_kls) + for k, v in data.items()} # convert str to class if klass in self.NATIVE_TYPES_MAPPING: @@ -431,24 +473,25 @@ def parameters_to_tuples(self, params, collection_formats): :param dict collection_formats: Parameter collection formats :return: Parameters as list of tuples, collections formatted """ - new_params: list[tuple[str, str]] = [] + new_params: List[Tuple[str, str]] = [] if collection_formats is None: collection_formats = {} for k, v in params.items() if isinstance(params, dict) else params: if k in collection_formats: collection_format = collection_formats[k] - if collection_format == "multi": + if collection_format == 'multi': new_params.extend((k, value) for value in v) else: - if collection_format == "ssv": - delimiter = " " - elif collection_format == "tsv": - delimiter = "\t" - elif collection_format == "pipes": - delimiter = "|" + if collection_format == 'ssv': + delimiter = ' ' + elif collection_format == 'tsv': + delimiter = '\t' + elif collection_format == 'pipes': + delimiter = '|' else: # csv is the default - delimiter = "," - new_params.append((k, delimiter.join(str(value) for value in v))) + delimiter = ',' + new_params.append( + (k, delimiter.join(str(value) for value in v))) else: new_params.append((k, v)) return new_params @@ -460,7 +503,7 @@ def parameters_to_url_query(self, params, collection_formats): :param dict collection_formats: Parameter collection formats :return: URL query string (e.g. a=Hello%20World&b=123) """ - new_params: list[tuple[str, str]] = [] + new_params: List[Tuple[str, str]] = [] if collection_formats is None: collection_formats = {} for k, v in params.items() if isinstance(params, dict) else params: @@ -473,24 +516,26 @@ def parameters_to_url_query(self, params, collection_formats): if k in collection_formats: collection_format = collection_formats[k] - if collection_format == "multi": + if collection_format == 'multi': new_params.extend((k, str(value)) for value in v) else: - if collection_format == "ssv": - delimiter = " " - elif collection_format == "tsv": - delimiter = "\t" - elif collection_format == "pipes": - delimiter = "|" + if collection_format == 'ssv': + delimiter = ' ' + elif collection_format == 'tsv': + delimiter = '\t' + elif collection_format == 'pipes': + delimiter = '|' else: # csv is the default - delimiter = "," - new_params.append((k, delimiter.join(quote(str(value)) for value in v))) + delimiter = ',' + new_params.append( + (k, delimiter.join(quote(str(value)) for value in v)) + ) else: new_params.append((k, quote(str(v)))) return "&".join(["=".join(map(str, item)) for item in new_params]) - def files_parameters(self, files: dict[str, str | bytes]): + def files_parameters(self, files: Dict[str, Union[str, bytes]]): """Builds form parameters. :param files: File parameters. @@ -499,7 +544,7 @@ def files_parameters(self, files: dict[str, str | bytes]): params = [] for k, v in files.items(): if isinstance(v, str): - with open(v, "rb") as f: + with open(v, 'rb') as f: filename = os.path.basename(f.name) filedata = f.read() elif isinstance(v, bytes): @@ -507,11 +552,16 @@ def files_parameters(self, files: dict[str, str | bytes]): filedata = v else: raise ValueError("Unsupported file value") - mimetype = mimetypes.guess_type(filename)[0] or "application/octet-stream" - params.append(tuple([k, tuple([filename, filedata, mimetype])])) + mimetype = ( + mimetypes.guess_type(filename)[0] + or 'application/octet-stream' + ) + params.append( + tuple([k, tuple([filename, filedata, mimetype])]) + ) return params - def select_header_accept(self, accepts: list[str]) -> str | None: + def select_header_accept(self, accepts: List[str]) -> Optional[str]: """Returns `Accept` based on an array of accepts provided. :param accepts: List of headers. @@ -521,7 +571,7 @@ def select_header_accept(self, accepts: list[str]) -> str | None: return None for accept in accepts: - if re.search("json", accept, re.IGNORECASE): + if re.search('json', accept, re.IGNORECASE): return accept return accepts[0] @@ -536,13 +586,20 @@ def select_header_content_type(self, content_types): return None for content_type in content_types: - if re.search("json", content_type, re.IGNORECASE): + if re.search('json', content_type, re.IGNORECASE): return content_type return content_types[0] def update_params_for_auth( - self, headers, queries, auth_settings, resource_path, method, body, request_auth=None + self, + headers, + queries, + auth_settings, + resource_path, + method, + body, + request_auth=None ) -> None: """Updates header and query params based on authentication setting. @@ -560,17 +617,35 @@ def update_params_for_auth( return if request_auth: - self._apply_auth_params(headers, queries, resource_path, method, body, request_auth) + self._apply_auth_params( + headers, + queries, + resource_path, + method, + body, + request_auth + ) else: for auth in auth_settings: auth_setting = self.configuration.auth_settings().get(auth) if auth_setting: self._apply_auth_params( - headers, queries, resource_path, method, body, auth_setting + headers, + queries, + resource_path, + method, + body, + auth_setting ) def _apply_auth_params( - self, headers, queries, resource_path, method, body, auth_setting + self, + headers, + queries, + resource_path, + method, + body, + auth_setting ) -> None: """Updates the request parameters based on a single auth_setting @@ -582,15 +657,17 @@ def _apply_auth_params( The object type is the return value of sanitize_for_serialization(). :param auth_setting: auth settings for the endpoint """ - if auth_setting["in"] == "cookie": - headers["Cookie"] = auth_setting["value"] - elif auth_setting["in"] == "header": - if auth_setting["type"] != "http-signature": - headers[auth_setting["key"]] = auth_setting["value"] - elif auth_setting["in"] == "query": - queries.append((auth_setting["key"], auth_setting["value"])) + if auth_setting['in'] == 'cookie': + headers['Cookie'] = auth_setting['value'] + elif auth_setting['in'] == 'header': + if auth_setting['type'] != 'http-signature': + headers[auth_setting['key']] = auth_setting['value'] + elif auth_setting['in'] == 'query': + queries.append((auth_setting['key'], auth_setting['value'])) else: - raise ApiValueError("Authentication token must be in `query` or `header`") + raise ApiValueError( + 'Authentication token must be in `query` or `header`' + ) def __deserialize_file(self, response): """Deserializes body to file @@ -610,7 +687,10 @@ def __deserialize_file(self, response): content_disposition = response.getheader("Content-Disposition") if content_disposition: - m = re.search(r'filename=[\'"]?([^\'"\s]+)[\'"]?', content_disposition) + m = re.search( + r'filename=[\'"]?([^\'"\s]+)[\'"]?', + content_disposition + ) assert m is not None, "Unexpected 'content-disposition' header value" filename = m.group(1) path = os.path.join(os.path.dirname(path), filename) @@ -653,7 +733,10 @@ def __deserialize_date(self, string): except ImportError: return string except ValueError: - raise rest.ApiException(status=0, reason=f"Failed to parse `{string}` as date object") + raise rest.ApiException( + status=0, + reason="Failed to parse `{0}` as date object".format(string) + ) def __deserialize_datetime(self, string): """Deserializes string to datetime. @@ -669,7 +752,11 @@ def __deserialize_datetime(self, string): return string except ValueError: raise rest.ApiException( - status=0, reason=(f"Failed to parse `{string}` as datetime object") + status=0, + reason=( + "Failed to parse `{0}` as datetime object" + .format(string) + ) ) def __deserialize_enum(self, data, klass): @@ -682,7 +769,13 @@ def __deserialize_enum(self, data, klass): try: return klass(data) except ValueError: - raise rest.ApiException(status=0, reason=(f"Failed to parse `{data}` as `{klass}`")) + raise rest.ApiException( + status=0, + reason=( + "Failed to parse `{0}` as `{1}`" + .format(data, klass) + ) + ) def __deserialize_model(self, data, klass): """Deserializes list or dict to model. @@ -691,4 +784,5 @@ def __deserialize_model(self, data, klass): :param klass: class literal. :return: model object. """ + return klass.from_dict(data) diff --git a/cdp/client/api_response.py b/cdp/client/api_response.py index 384e379..9bc7c11 100644 --- a/cdp/client/api_response.py +++ b/cdp/client/api_response.py @@ -1,21 +1,21 @@ """API response object.""" from __future__ import annotations - -from collections.abc import Mapping -from typing import Generic, TypeVar - -from pydantic import BaseModel, Field, StrictBytes, StrictInt +from typing import Optional, Generic, Mapping, TypeVar +from pydantic import Field, StrictInt, StrictBytes, BaseModel T = TypeVar("T") - class ApiResponse(BaseModel, Generic[T]): - """API response object""" + """ + API response object + """ status_code: StrictInt = Field(description="HTTP status code") - headers: Mapping[str, str] | None = Field(None, description="HTTP headers") + headers: Optional[Mapping[str, str]] = Field(None, description="HTTP headers") data: T = Field(description="Deserialized data given the data type") raw_data: StrictBytes = Field(description="Raw data (HTTP response body)") - model_config = {"arbitrary_types_allowed": True} + model_config = { + "arbitrary_types_allowed": True + } diff --git a/cdp/client/configuration.py b/cdp/client/configuration.py index 6e7f477..e995c53 100644 --- a/cdp/client/configuration.py +++ b/cdp/client/configuration.py @@ -1,36 +1,33 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + 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 -Do not edit the class manually. -""" import copy -import http.client as httplib import logging +from logging import FileHandler import multiprocessing import sys -from logging import FileHandler - +from typing import Optional import urllib3 +import http.client as httplib + JSON_SCHEMA_VALIDATION_KEYWORDS = { - "multipleOf", - "maximum", - "exclusiveMaximum", - "minimum", - "exclusiveMinimum", - "maxLength", - "minLength", - "pattern", - "maxItems", - "minItems", + 'multipleOf', 'maximum', 'exclusiveMaximum', + 'minimum', 'exclusiveMinimum', 'maxLength', + 'minLength', 'pattern', 'maxItems', 'minItems' } - class Configuration: """This class contains various settings of the API client. @@ -66,25 +63,20 @@ class Configuration: _default = None - def __init__( - self, - host=None, - api_key=None, - api_key_prefix=None, - username=None, - password=None, - access_token=None, - server_index=None, - server_variables=None, - server_operation_index=None, - server_operation_variables=None, - ignore_operation_servers=False, - ssl_ca_cert=None, - retries=None, - *, - debug: bool | None = None, - ) -> None: - """Constructor""" + def __init__(self, host=None, + api_key=None, api_key_prefix=None, + username=None, password=None, + access_token=None, + server_index=None, server_variables=None, + server_operation_index=None, server_operation_variables=None, + ignore_operation_servers=False, + ssl_ca_cert=None, + retries=None, + *, + debug: Optional[bool] = None + ) -> None: + """Constructor + """ self._base_path = "https://api.cdp.coinbase.com/platform" if host is None else host """Default Base url """ @@ -130,13 +122,13 @@ def __init__( """ self.logger["package_logger"] = logging.getLogger("cdp.client") self.logger["urllib3_logger"] = logging.getLogger("urllib3") - self.logger_format = "%(asctime)s %(levelname)s %(message)s" + self.logger_format = '%(asctime)s %(levelname)s %(message)s' """Log format """ self.logger_stream_handler = None """Log stream handler """ - self.logger_file_handler: FileHandler | None = None + self.logger_file_handler: Optional[FileHandler] = None """Log file handler """ self.logger_file = None @@ -179,13 +171,13 @@ def __init__( cpu_count * 5 is used as default value to increase performance. """ - self.proxy: str | None = None + self.proxy: Optional[str] = None """Proxy URL """ self.proxy_headers = None """Proxy headers """ - self.safe_chars_for_path_param = "" + self.safe_chars_for_path_param = '' """Safe chars for path_param """ self.retries = retries @@ -211,7 +203,7 @@ def __deepcopy__(self, memo): result = cls.__new__(cls) memo[id(self)] = result for k, v in self.__dict__.items(): - if k not in ("logger", "logger_file_handler"): + if k not in ('logger', 'logger_file_handler'): setattr(result, k, copy.deepcopy(v, memo)) # shallow copy of loggers result.logger = copy.copy(self.logger) @@ -371,7 +363,9 @@ def get_basic_auth_token(self): password = "" if self.password is not None: password = self.password - return urllib3.util.make_headers(basic_auth=username + ":" + password).get("authorization") + return urllib3.util.make_headers( + basic_auth=username + ':' + password + ).get('authorization') def auth_settings(self): """Gets Auth Settings dict for api client. @@ -386,13 +380,12 @@ def to_debug_report(self): :return: The report for debugging. """ - return ( - "Python SDK Debug Report:\n" - f"OS: {sys.platform}\n" - f"Python Version: {sys.version}\n" - "Version of the API: 0.0.1-alpha\n" - "SDK Package Version: 1.0.0" - ) + return "Python SDK Debug Report:\n"\ + "OS: {env}\n"\ + "Python Version: {pyversion}\n"\ + "Version of the API: 0.0.1-alpha\n"\ + "SDK Package Version: 1.0.0".\ + format(env=sys.platform, pyversion=sys.version) def get_host_settings(self): """Gets an array of host settings @@ -401,8 +394,8 @@ def get_host_settings(self): """ return [ { - "url": "https://api.cdp.coinbase.com/platform", - "description": "No description provided", + 'url': "https://api.cdp.coinbase.com/platform", + 'description': "No description provided", } ] @@ -423,23 +416,23 @@ def get_host_from_settings(self, index, variables=None, servers=None): server = servers[index] except IndexError: raise ValueError( - f"Invalid index {index} when selecting the host settings. " - f"Must be less than {len(servers)}" - ) + "Invalid index {0} when selecting the host settings. " + "Must be less than {1}".format(index, len(servers))) - url = server["url"] + url = server['url'] # go through variables and replace placeholders - for variable_name, variable in server.get("variables", {}).items(): - used_value = variables.get(variable_name, variable["default_value"]) + for variable_name, variable in server.get('variables', {}).items(): + used_value = variables.get( + variable_name, variable['default_value']) - if "enum_values" in variable and used_value not in variable["enum_values"]: + if 'enum_values' in variable \ + and used_value not in variable['enum_values']: raise ValueError( "The variable `{0}` in the host URL has invalid value " "{1}. Must be {2}.".format( - variable_name, variables[variable_name], variable["enum_values"] - ) - ) + variable_name, variables[variable_name], + variable['enum_values'])) url = url.replace("{" + variable_name + "}", used_value) diff --git a/cdp/client/exceptions.py b/cdp/client/exceptions.py index fe26188..a126d9f 100644 --- a/cdp/client/exceptions.py +++ b/cdp/client/exceptions.py @@ -1,25 +1,27 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from typing import Any + Do not edit the class manually. +""" # noqa: E501 +from typing import Any, Optional from typing_extensions import Self - class OpenApiException(Exception): """The base exception class for all OpenAPIExceptions""" class ApiTypeError(OpenApiException, TypeError): - def __init__(self, msg, path_to_item=None, valid_classes=None, key_type=None) -> None: - """Raises an exception for TypeErrors + def __init__(self, msg, path_to_item=None, valid_classes=None, + key_type=None) -> None: + """ Raises an exception for TypeErrors Args: msg (str): the exception message @@ -35,37 +37,38 @@ def __init__(self, msg, path_to_item=None, valid_classes=None, key_type=None) -> True if it is a key in a dict False if our item is an item in a list None if unset - """ self.path_to_item = path_to_item self.valid_classes = valid_classes self.key_type = key_type full_msg = msg if path_to_item: - full_msg = f"{msg} at {render_path(path_to_item)}" + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) super(ApiTypeError, self).__init__(full_msg) class ApiValueError(OpenApiException, ValueError): def __init__(self, msg, path_to_item=None) -> None: - """Args: + """ + Args: msg (str): the exception message Keyword Args: path_to_item (list) the path to the exception in the received_data dict. None if unset - """ + self.path_to_item = path_to_item full_msg = msg if path_to_item: - full_msg = f"{msg} at {render_path(path_to_item)}" + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) super(ApiValueError, self).__init__(full_msg) class ApiAttributeError(OpenApiException, AttributeError): def __init__(self, msg, path_to_item=None) -> None: - """Raised when an attribute reference or assignment fails. + """ + Raised when an attribute reference or assignment fails. Args: msg (str): the exception message @@ -73,41 +76,41 @@ def __init__(self, msg, path_to_item=None) -> None: Keyword Args: path_to_item (None/list) the path to the exception in the received_data dict - """ self.path_to_item = path_to_item full_msg = msg if path_to_item: - full_msg = f"{msg} at {render_path(path_to_item)}" + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) super(ApiAttributeError, self).__init__(full_msg) class ApiKeyError(OpenApiException, KeyError): def __init__(self, msg, path_to_item=None) -> None: - """Args: + """ + Args: msg (str): the exception message Keyword Args: path_to_item (None/list) the path to the exception in the received_data dict - """ self.path_to_item = path_to_item full_msg = msg if path_to_item: - full_msg = f"{msg} at {render_path(path_to_item)}" + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) super(ApiKeyError, self).__init__(full_msg) class ApiException(OpenApiException): + def __init__( - self, - status=None, - reason=None, + self, + status=None, + reason=None, http_resp=None, *, - body: str | None = None, - data: Any | None = None, + body: Optional[str] = None, + data: Optional[Any] = None, ) -> None: self.status = status self.reason = reason @@ -122,18 +125,18 @@ def __init__( self.reason = http_resp.reason if self.body is None: try: - self.body = http_resp.data.decode("utf-8") + self.body = http_resp.data.decode('utf-8') except Exception: pass self.headers = http_resp.getheaders() @classmethod def from_response( - cls, - *, - http_resp, - body: str | None, - data: Any | None, + cls, + *, + http_resp, + body: Optional[str], + data: Optional[Any], ) -> Self: if http_resp.status == 400: raise BadRequestException(http_resp=http_resp, body=body, data=data) @@ -153,12 +156,14 @@ def from_response( def __str__(self): """Custom error messages for exception""" - error_message = f"({self.status})\n" f"Reason: {self.reason}\n" + error_message = "({0})\n"\ + "Reason: {1}\n".format(self.status, self.reason) if self.headers: - error_message += f"HTTP response headers: {self.headers}\n" + error_message += "HTTP response headers: {0}\n".format( + self.headers) if self.data or self.body: - error_message += f"HTTP response body: {self.data or self.body}\n" + error_message += "HTTP response body: {0}\n".format(self.data or self.body) return error_message @@ -188,7 +193,7 @@ def render_path(path_to_item): result = "" for pth in path_to_item: if isinstance(pth, int): - result += f"[{pth}]" + result += "[{0}]".format(pth) else: - result += f"['{pth}']" + result += "['{0}']".format(pth) return result diff --git a/cdp/client/models/__init__.py b/cdp/client/models/__init__.py index 4039ed0..679d3cb 100644 --- a/cdp/client/models/__init__.py +++ b/cdp/client/models/__init__.py @@ -2,16 +2,17 @@ # flake8: noqa """ -Coinbase Platform API + Coinbase Platform API -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. + 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) + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -Do not edit the class manually. + Do not edit the class manually. """ # noqa: E501 + # import models into model package from cdp.client.models.address import Address from cdp.client.models.address_balance_list import AddressBalanceList @@ -20,9 +21,7 @@ from cdp.client.models.address_transaction_list import AddressTransactionList from cdp.client.models.asset import Asset from cdp.client.models.balance import Balance -from cdp.client.models.broadcast_contract_invocation_request import ( - BroadcastContractInvocationRequest, -) +from cdp.client.models.broadcast_contract_invocation_request import BroadcastContractInvocationRequest from cdp.client.models.broadcast_staking_operation_request import BroadcastStakingOperationRequest from cdp.client.models.broadcast_trade_request import BroadcastTradeRequest from cdp.client.models.broadcast_transfer_request import BroadcastTransferRequest @@ -41,6 +40,7 @@ from cdp.client.models.create_transfer_request import CreateTransferRequest from cdp.client.models.create_wallet_request import CreateWalletRequest from cdp.client.models.create_wallet_request_wallet import CreateWalletRequestWallet +from cdp.client.models.create_wallet_webhook_request import CreateWalletWebhookRequest from cdp.client.models.create_webhook_request import CreateWebhookRequest from cdp.client.models.deploy_smart_contract_request import DeploySmartContractRequest from cdp.client.models.erc20_transfer_event import ERC20TransferEvent @@ -53,13 +53,12 @@ from cdp.client.models.ethereum_validator_metadata import EthereumValidatorMetadata from cdp.client.models.faucet_transaction import FaucetTransaction from cdp.client.models.feature_set import FeatureSet -from cdp.client.models.fetch_historical_staking_balances200_response import ( - FetchHistoricalStakingBalances200Response, -) +from cdp.client.models.fetch_historical_staking_balances200_response import FetchHistoricalStakingBalances200Response from cdp.client.models.fetch_staking_rewards200_response import FetchStakingRewards200Response from cdp.client.models.fetch_staking_rewards_request import FetchStakingRewardsRequest from cdp.client.models.get_staking_context_request import GetStakingContextRequest from cdp.client.models.historical_balance import HistoricalBalance +from cdp.client.models.multi_token_contract_options import MultiTokenContractOptions from cdp.client.models.nft_contract_options import NFTContractOptions from cdp.client.models.network import Network from cdp.client.models.network_identifier import NetworkIdentifier @@ -74,9 +73,7 @@ from cdp.client.models.server_signer_list import ServerSignerList from cdp.client.models.signature_creation_event import SignatureCreationEvent from cdp.client.models.signature_creation_event_result import SignatureCreationEventResult -from cdp.client.models.signed_voluntary_exit_message_metadata import ( - SignedVoluntaryExitMessageMetadata, -) +from cdp.client.models.signed_voluntary_exit_message_metadata import SignedVoluntaryExitMessageMetadata from cdp.client.models.smart_contract import SmartContract from cdp.client.models.smart_contract_list import SmartContractList from cdp.client.models.smart_contract_options import SmartContractOptions diff --git a/cdp/client/models/address.py b/cdp/client/models/address.py index 1b2d739..61e1124 100644 --- a/cdp/client/models/address.py +++ b/cdp/client/models/address.py @@ -1,39 +1,37 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 -import json + +from __future__ import annotations import pprint import re # noqa: F401 -from typing import Any, ClassVar +import json from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set from typing_extensions import Self - class Address(BaseModel): - """Address""" - + """ + Address + """ # noqa: E501 wallet_id: StrictStr = Field(description="The ID of the wallet that owns the address") network_id: StrictStr = Field(description="The ID of the blockchain network") public_key: StrictStr = Field(description="The public key from which the address is derived.") address_id: StrictStr = Field(description="The onchain address derived on the server-side.") index: StrictInt = Field(description="The index of the address in the wallet.") - __properties: ClassVar[list[str]] = [ - "wallet_id", - "network_id", - "public_key", - "address_id", - "index", - ] + __properties: ClassVar[List[str]] = ["wallet_id", "network_id", "public_key", "address_id", "index"] model_config = ConfigDict( populate_by_name=True, @@ -41,6 +39,7 @@ class Address(BaseModel): protected_namespaces=(), ) + def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True)) @@ -51,11 +50,11 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self | None: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Address from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self) -> dict[str, Any]: + def to_dict(self) -> Dict[str, Any]: """Return the dictionary representation of the model using alias. This has the following differences from calling pydantic's @@ -65,7 +64,8 @@ def to_dict(self) -> dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ - excluded_fields: set[str] = set([]) + excluded_fields: Set[str] = set([ + ]) _dict = self.model_dump( by_alias=True, @@ -75,7 +75,7 @@ def to_dict(self) -> dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of Address from a dict""" if obj is None: return None @@ -83,13 +83,13 @@ def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate( - { - "wallet_id": obj.get("wallet_id"), - "network_id": obj.get("network_id"), - "public_key": obj.get("public_key"), - "address_id": obj.get("address_id"), - "index": obj.get("index"), - } - ) + _obj = cls.model_validate({ + "wallet_id": obj.get("wallet_id"), + "network_id": obj.get("network_id"), + "public_key": obj.get("public_key"), + "address_id": obj.get("address_id"), + "index": obj.get("index") + }) return _obj + + diff --git a/cdp/client/models/address_balance_list.py b/cdp/client/models/address_balance_list.py index 21905a2..b786d80 100644 --- a/cdp/client/models/address_balance_list.py +++ b/cdp/client/models/address_balance_list.py @@ -1,36 +1,37 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 -import json + +from __future__ import annotations import pprint import re # noqa: F401 -from typing import Any, ClassVar +import json from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr -from typing_extensions import Self - +from typing import Any, ClassVar, Dict, List from cdp.client.models.balance import Balance - +from typing import Optional, Set +from typing_extensions import Self class AddressBalanceList(BaseModel): - """ """ - - data: list[Balance] - has_more: StrictBool = Field( - description="True if this list has another page of items after this one that can be fetched." - ) + """ + + """ # noqa: E501 + data: List[Balance] + has_more: StrictBool = Field(description="True if this list has another page of items after this one that can be fetched.") next_page: StrictStr = Field(description="The page token to be used to fetch the next page.") total_count: StrictInt = Field(description="The total number of balances for the wallet.") - __properties: ClassVar[list[str]] = ["data", "has_more", "next_page", "total_count"] + __properties: ClassVar[List[str]] = ["data", "has_more", "next_page", "total_count"] model_config = ConfigDict( populate_by_name=True, @@ -38,6 +39,7 @@ class AddressBalanceList(BaseModel): protected_namespaces=(), ) + def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True)) @@ -48,11 +50,11 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self | None: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of AddressBalanceList from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self) -> dict[str, Any]: + def to_dict(self) -> Dict[str, Any]: """Return the dictionary representation of the model using alias. This has the following differences from calling pydantic's @@ -62,7 +64,8 @@ def to_dict(self) -> dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ - excluded_fields: set[str] = set([]) + excluded_fields: Set[str] = set([ + ]) _dict = self.model_dump( by_alias=True, @@ -75,11 +78,11 @@ def to_dict(self) -> dict[str, Any]: for _item_data in self.data: if _item_data: _items.append(_item_data.to_dict()) - _dict["data"] = _items + _dict['data'] = _items return _dict @classmethod - def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of AddressBalanceList from a dict""" if obj is None: return None @@ -87,14 +90,12 @@ def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate( - { - "data": [Balance.from_dict(_item) for _item in obj["data"]] - if obj.get("data") is not None - else None, - "has_more": obj.get("has_more"), - "next_page": obj.get("next_page"), - "total_count": obj.get("total_count"), - } - ) + _obj = cls.model_validate({ + "data": [Balance.from_dict(_item) for _item in obj["data"]] if obj.get("data") is not None else None, + "has_more": obj.get("has_more"), + "next_page": obj.get("next_page"), + "total_count": obj.get("total_count") + }) return _obj + + diff --git a/cdp/client/models/address_historical_balance_list.py b/cdp/client/models/address_historical_balance_list.py index 3d1e030..3256b70 100644 --- a/cdp/client/models/address_historical_balance_list.py +++ b/cdp/client/models/address_historical_balance_list.py @@ -1,35 +1,36 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 -import json + +from __future__ import annotations import pprint import re # noqa: F401 -from typing import Any, ClassVar +import json from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr -from typing_extensions import Self - +from typing import Any, ClassVar, Dict, List from cdp.client.models.historical_balance import HistoricalBalance - +from typing import Optional, Set +from typing_extensions import Self class AddressHistoricalBalanceList(BaseModel): - """ """ - - data: list[HistoricalBalance] - has_more: StrictBool = Field( - description="True if this list has another page of items after this one that can be fetched." - ) + """ + + """ # noqa: E501 + data: List[HistoricalBalance] + has_more: StrictBool = Field(description="True if this list has another page of items after this one that can be fetched.") next_page: StrictStr = Field(description="The page token to be used to fetch the next page.") - __properties: ClassVar[list[str]] = ["data", "has_more", "next_page"] + __properties: ClassVar[List[str]] = ["data", "has_more", "next_page"] model_config = ConfigDict( populate_by_name=True, @@ -37,6 +38,7 @@ class AddressHistoricalBalanceList(BaseModel): protected_namespaces=(), ) + def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True)) @@ -47,11 +49,11 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self | None: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of AddressHistoricalBalanceList from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self) -> dict[str, Any]: + def to_dict(self) -> Dict[str, Any]: """Return the dictionary representation of the model using alias. This has the following differences from calling pydantic's @@ -61,7 +63,8 @@ def to_dict(self) -> dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ - excluded_fields: set[str] = set([]) + excluded_fields: Set[str] = set([ + ]) _dict = self.model_dump( by_alias=True, @@ -74,11 +77,11 @@ def to_dict(self) -> dict[str, Any]: for _item_data in self.data: if _item_data: _items.append(_item_data.to_dict()) - _dict["data"] = _items + _dict['data'] = _items return _dict @classmethod - def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of AddressHistoricalBalanceList from a dict""" if obj is None: return None @@ -86,13 +89,11 @@ def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate( - { - "data": [HistoricalBalance.from_dict(_item) for _item in obj["data"]] - if obj.get("data") is not None - else None, - "has_more": obj.get("has_more"), - "next_page": obj.get("next_page"), - } - ) + _obj = cls.model_validate({ + "data": [HistoricalBalance.from_dict(_item) for _item in obj["data"]] if obj.get("data") is not None else None, + "has_more": obj.get("has_more"), + "next_page": obj.get("next_page") + }) return _obj + + diff --git a/cdp/client/models/address_list.py b/cdp/client/models/address_list.py index 63398e4..5211d3b 100644 --- a/cdp/client/models/address_list.py +++ b/cdp/client/models/address_list.py @@ -1,36 +1,37 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 -import json + +from __future__ import annotations import pprint import re # noqa: F401 -from typing import Any, ClassVar +import json from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr -from typing_extensions import Self - +from typing import Any, ClassVar, Dict, List from cdp.client.models.address import Address - +from typing import Optional, Set +from typing_extensions import Self class AddressList(BaseModel): - """ """ - - data: list[Address] - has_more: StrictBool = Field( - description="True if this list has another page of items after this one that can be fetched." - ) + """ + + """ # noqa: E501 + data: List[Address] + has_more: StrictBool = Field(description="True if this list has another page of items after this one that can be fetched.") next_page: StrictStr = Field(description="The page token to be used to fetch the next page.") total_count: StrictInt = Field(description="The total number of addresses for the wallet.") - __properties: ClassVar[list[str]] = ["data", "has_more", "next_page", "total_count"] + __properties: ClassVar[List[str]] = ["data", "has_more", "next_page", "total_count"] model_config = ConfigDict( populate_by_name=True, @@ -38,6 +39,7 @@ class AddressList(BaseModel): protected_namespaces=(), ) + def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True)) @@ -48,11 +50,11 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self | None: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of AddressList from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self) -> dict[str, Any]: + def to_dict(self) -> Dict[str, Any]: """Return the dictionary representation of the model using alias. This has the following differences from calling pydantic's @@ -62,7 +64,8 @@ def to_dict(self) -> dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ - excluded_fields: set[str] = set([]) + excluded_fields: Set[str] = set([ + ]) _dict = self.model_dump( by_alias=True, @@ -75,11 +78,11 @@ def to_dict(self) -> dict[str, Any]: for _item_data in self.data: if _item_data: _items.append(_item_data.to_dict()) - _dict["data"] = _items + _dict['data'] = _items return _dict @classmethod - def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of AddressList from a dict""" if obj is None: return None @@ -87,14 +90,12 @@ def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate( - { - "data": [Address.from_dict(_item) for _item in obj["data"]] - if obj.get("data") is not None - else None, - "has_more": obj.get("has_more"), - "next_page": obj.get("next_page"), - "total_count": obj.get("total_count"), - } - ) + _obj = cls.model_validate({ + "data": [Address.from_dict(_item) for _item in obj["data"]] if obj.get("data") is not None else None, + "has_more": obj.get("has_more"), + "next_page": obj.get("next_page"), + "total_count": obj.get("total_count") + }) return _obj + + diff --git a/cdp/client/models/address_transaction_list.py b/cdp/client/models/address_transaction_list.py index 556f414..4249fa0 100644 --- a/cdp/client/models/address_transaction_list.py +++ b/cdp/client/models/address_transaction_list.py @@ -1,35 +1,36 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 -import json + +from __future__ import annotations import pprint import re # noqa: F401 -from typing import Any, ClassVar +import json from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr -from typing_extensions import Self - +from typing import Any, ClassVar, Dict, List from cdp.client.models.transaction import Transaction - +from typing import Optional, Set +from typing_extensions import Self class AddressTransactionList(BaseModel): - """ """ - - data: list[Transaction] - has_more: StrictBool = Field( - description="True if this list has another page of items after this one that can be fetched." - ) + """ + + """ # noqa: E501 + data: List[Transaction] + has_more: StrictBool = Field(description="True if this list has another page of items after this one that can be fetched.") next_page: StrictStr = Field(description="The page token to be used to fetch the next page.") - __properties: ClassVar[list[str]] = ["data", "has_more", "next_page"] + __properties: ClassVar[List[str]] = ["data", "has_more", "next_page"] model_config = ConfigDict( populate_by_name=True, @@ -37,6 +38,7 @@ class AddressTransactionList(BaseModel): protected_namespaces=(), ) + def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True)) @@ -47,11 +49,11 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self | None: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of AddressTransactionList from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self) -> dict[str, Any]: + def to_dict(self) -> Dict[str, Any]: """Return the dictionary representation of the model using alias. This has the following differences from calling pydantic's @@ -61,7 +63,8 @@ def to_dict(self) -> dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ - excluded_fields: set[str] = set([]) + excluded_fields: Set[str] = set([ + ]) _dict = self.model_dump( by_alias=True, @@ -74,11 +77,11 @@ def to_dict(self) -> dict[str, Any]: for _item_data in self.data: if _item_data: _items.append(_item_data.to_dict()) - _dict["data"] = _items + _dict['data'] = _items return _dict @classmethod - def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of AddressTransactionList from a dict""" if obj is None: return None @@ -86,13 +89,11 @@ def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate( - { - "data": [Transaction.from_dict(_item) for _item in obj["data"]] - if obj.get("data") is not None - else None, - "has_more": obj.get("has_more"), - "next_page": obj.get("next_page"), - } - ) + _obj = cls.model_validate({ + "data": [Transaction.from_dict(_item) for _item in obj["data"]] if obj.get("data") is not None else None, + "has_more": obj.get("has_more"), + "next_page": obj.get("next_page") + }) return _obj + + diff --git a/cdp/client/models/asset.py b/cdp/client/models/asset.py index bd90287..bca3da5 100644 --- a/cdp/client/models/asset.py +++ b/cdp/client/models/asset.py @@ -1,38 +1,36 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 -import json + +from __future__ import annotations import pprint import re # noqa: F401 -from typing import Any, ClassVar +import json from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set from typing_extensions import Self - class Asset(BaseModel): - """An asset onchain scoped to a particular network, e.g. ETH on base-sepolia, or the USDC ERC20 Token on ethereum-mainnet.""" - + """ + An asset onchain scoped to a particular network, e.g. ETH on base-sepolia, or the USDC ERC20 Token on ethereum-mainnet. + """ # noqa: E501 network_id: StrictStr = Field(description="The ID of the blockchain network") asset_id: StrictStr = Field(description="The ID for the asset on the network") - decimals: StrictInt | None = Field( - default=None, - description="The number of decimals the asset supports. This is used to convert from atomic units to base units.", - ) - contract_address: StrictStr | None = Field( - default=None, - description="The optional contract address for the asset. This will be specified for smart contract-based assets, for example ERC20s.", - ) - __properties: ClassVar[list[str]] = ["network_id", "asset_id", "decimals", "contract_address"] + decimals: Optional[StrictInt] = Field(default=None, description="The number of decimals the asset supports. This is used to convert from atomic units to base units.") + contract_address: Optional[StrictStr] = Field(default=None, description="The optional contract address for the asset. This will be specified for smart contract-based assets, for example ERC20s.") + __properties: ClassVar[List[str]] = ["network_id", "asset_id", "decimals", "contract_address"] model_config = ConfigDict( populate_by_name=True, @@ -40,6 +38,7 @@ class Asset(BaseModel): protected_namespaces=(), ) + def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True)) @@ -50,11 +49,11 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self | None: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Asset from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self) -> dict[str, Any]: + def to_dict(self) -> Dict[str, Any]: """Return the dictionary representation of the model using alias. This has the following differences from calling pydantic's @@ -64,7 +63,8 @@ def to_dict(self) -> dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ - excluded_fields: set[str] = set([]) + excluded_fields: Set[str] = set([ + ]) _dict = self.model_dump( by_alias=True, @@ -74,7 +74,7 @@ def to_dict(self) -> dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of Asset from a dict""" if obj is None: return None @@ -82,12 +82,12 @@ def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate( - { - "network_id": obj.get("network_id"), - "asset_id": obj.get("asset_id"), - "decimals": obj.get("decimals"), - "contract_address": obj.get("contract_address"), - } - ) + _obj = cls.model_validate({ + "network_id": obj.get("network_id"), + "asset_id": obj.get("asset_id"), + "decimals": obj.get("decimals"), + "contract_address": obj.get("contract_address") + }) return _obj + + diff --git a/cdp/client/models/balance.py b/cdp/client/models/balance.py index 787a72f..7f3fe66 100644 --- a/cdp/client/models/balance.py +++ b/cdp/client/models/balance.py @@ -1,32 +1,35 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 -import json + +from __future__ import annotations import pprint import re # noqa: F401 -from typing import Any, ClassVar +import json from pydantic import BaseModel, ConfigDict, Field, StrictStr -from typing_extensions import Self - +from typing import Any, ClassVar, Dict, List from cdp.client.models.asset import Asset - +from typing import Optional, Set +from typing_extensions import Self class Balance(BaseModel): - """The balance of an asset onchain""" - + """ + The balance of an asset onchain + """ # noqa: E501 amount: StrictStr = Field(description="The amount in the atomic units of the asset") asset: Asset - __properties: ClassVar[list[str]] = ["amount", "asset"] + __properties: ClassVar[List[str]] = ["amount", "asset"] model_config = ConfigDict( populate_by_name=True, @@ -34,6 +37,7 @@ class Balance(BaseModel): protected_namespaces=(), ) + def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True)) @@ -44,11 +48,11 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self | None: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Balance from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self) -> dict[str, Any]: + def to_dict(self) -> Dict[str, Any]: """Return the dictionary representation of the model using alias. This has the following differences from calling pydantic's @@ -58,7 +62,8 @@ def to_dict(self) -> dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ - excluded_fields: set[str] = set([]) + excluded_fields: Set[str] = set([ + ]) _dict = self.model_dump( by_alias=True, @@ -67,11 +72,11 @@ def to_dict(self) -> dict[str, Any]: ) # override the default output from pydantic by calling `to_dict()` of asset if self.asset: - _dict["asset"] = self.asset.to_dict() + _dict['asset'] = self.asset.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of Balance from a dict""" if obj is None: return None @@ -79,10 +84,10 @@ def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate( - { - "amount": obj.get("amount"), - "asset": Asset.from_dict(obj["asset"]) if obj.get("asset") is not None else None, - } - ) + _obj = cls.model_validate({ + "amount": obj.get("amount"), + "asset": Asset.from_dict(obj["asset"]) if obj.get("asset") is not None else None + }) return _obj + + diff --git a/cdp/client/models/broadcast_contract_invocation_request.py b/cdp/client/models/broadcast_contract_invocation_request.py index b071099..f7dab98 100644 --- a/cdp/client/models/broadcast_contract_invocation_request.py +++ b/cdp/client/models/broadcast_contract_invocation_request.py @@ -1,31 +1,33 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 -import json + +from __future__ import annotations import pprint import re # noqa: F401 -from typing import Any, ClassVar +import json from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set from typing_extensions import Self - class BroadcastContractInvocationRequest(BaseModel): - """BroadcastContractInvocationRequest""" - - signed_payload: StrictStr = Field( - description="The hex-encoded signed payload of the contract invocation" - ) - __properties: ClassVar[list[str]] = ["signed_payload"] + """ + BroadcastContractInvocationRequest + """ # noqa: E501 + signed_payload: StrictStr = Field(description="The hex-encoded signed payload of the contract invocation") + __properties: ClassVar[List[str]] = ["signed_payload"] model_config = ConfigDict( populate_by_name=True, @@ -33,6 +35,7 @@ class BroadcastContractInvocationRequest(BaseModel): protected_namespaces=(), ) + def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True)) @@ -43,11 +46,11 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self | None: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of BroadcastContractInvocationRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self) -> dict[str, Any]: + def to_dict(self) -> Dict[str, Any]: """Return the dictionary representation of the model using alias. This has the following differences from calling pydantic's @@ -57,7 +60,8 @@ def to_dict(self) -> dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ - excluded_fields: set[str] = set([]) + excluded_fields: Set[str] = set([ + ]) _dict = self.model_dump( by_alias=True, @@ -67,7 +71,7 @@ def to_dict(self) -> dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of BroadcastContractInvocationRequest from a dict""" if obj is None: return None @@ -75,5 +79,9 @@ def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate({"signed_payload": obj.get("signed_payload")}) + _obj = cls.model_validate({ + "signed_payload": obj.get("signed_payload") + }) return _obj + + diff --git a/cdp/client/models/broadcast_staking_operation_request.py b/cdp/client/models/broadcast_staking_operation_request.py index be948fb..40dc326 100644 --- a/cdp/client/models/broadcast_staking_operation_request.py +++ b/cdp/client/models/broadcast_staking_operation_request.py @@ -1,34 +1,34 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 -import json + +from __future__ import annotations import pprint import re # noqa: F401 -from typing import Any, ClassVar +import json from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set from typing_extensions import Self - class BroadcastStakingOperationRequest(BaseModel): - """BroadcastStakingOperationRequest""" - - signed_payload: StrictStr = Field( - description="The hex-encoded signed payload of the staking operation." - ) - transaction_index: StrictInt = Field( - description="The index in the transaction array of the staking operation." - ) - __properties: ClassVar[list[str]] = ["signed_payload", "transaction_index"] + """ + BroadcastStakingOperationRequest + """ # noqa: E501 + signed_payload: StrictStr = Field(description="The hex-encoded signed payload of the staking operation.") + transaction_index: StrictInt = Field(description="The index in the transaction array of the staking operation.") + __properties: ClassVar[List[str]] = ["signed_payload", "transaction_index"] model_config = ConfigDict( populate_by_name=True, @@ -36,6 +36,7 @@ class BroadcastStakingOperationRequest(BaseModel): protected_namespaces=(), ) + def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True)) @@ -46,11 +47,11 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self | None: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of BroadcastStakingOperationRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self) -> dict[str, Any]: + def to_dict(self) -> Dict[str, Any]: """Return the dictionary representation of the model using alias. This has the following differences from calling pydantic's @@ -60,7 +61,8 @@ def to_dict(self) -> dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ - excluded_fields: set[str] = set([]) + excluded_fields: Set[str] = set([ + ]) _dict = self.model_dump( by_alias=True, @@ -70,7 +72,7 @@ def to_dict(self) -> dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of BroadcastStakingOperationRequest from a dict""" if obj is None: return None @@ -78,10 +80,10 @@ def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate( - { - "signed_payload": obj.get("signed_payload"), - "transaction_index": obj.get("transaction_index"), - } - ) + _obj = cls.model_validate({ + "signed_payload": obj.get("signed_payload"), + "transaction_index": obj.get("transaction_index") + }) return _obj + + diff --git a/cdp/client/models/broadcast_trade_request.py b/cdp/client/models/broadcast_trade_request.py index e2521e7..5a5a2d2 100644 --- a/cdp/client/models/broadcast_trade_request.py +++ b/cdp/client/models/broadcast_trade_request.py @@ -1,32 +1,34 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 -import json + +from __future__ import annotations import pprint import re # noqa: F401 -from typing import Any, ClassVar +import json from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set from typing_extensions import Self - class BroadcastTradeRequest(BaseModel): - """BroadcastTradeRequest""" - + """ + BroadcastTradeRequest + """ # noqa: E501 signed_payload: StrictStr = Field(description="The hex-encoded signed payload of the trade") - approve_transaction_signed_payload: StrictStr | None = Field( - default=None, description="The hex-encoded signed payload of the approval transaction" - ) - __properties: ClassVar[list[str]] = ["signed_payload", "approve_transaction_signed_payload"] + approve_transaction_signed_payload: Optional[StrictStr] = Field(default=None, description="The hex-encoded signed payload of the approval transaction") + __properties: ClassVar[List[str]] = ["signed_payload", "approve_transaction_signed_payload"] model_config = ConfigDict( populate_by_name=True, @@ -34,6 +36,7 @@ class BroadcastTradeRequest(BaseModel): protected_namespaces=(), ) + def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True)) @@ -44,11 +47,11 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self | None: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of BroadcastTradeRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self) -> dict[str, Any]: + def to_dict(self) -> Dict[str, Any]: """Return the dictionary representation of the model using alias. This has the following differences from calling pydantic's @@ -58,7 +61,8 @@ def to_dict(self) -> dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ - excluded_fields: set[str] = set([]) + excluded_fields: Set[str] = set([ + ]) _dict = self.model_dump( by_alias=True, @@ -68,7 +72,7 @@ def to_dict(self) -> dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of BroadcastTradeRequest from a dict""" if obj is None: return None @@ -76,10 +80,10 @@ def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate( - { - "signed_payload": obj.get("signed_payload"), - "approve_transaction_signed_payload": obj.get("approve_transaction_signed_payload"), - } - ) + _obj = cls.model_validate({ + "signed_payload": obj.get("signed_payload"), + "approve_transaction_signed_payload": obj.get("approve_transaction_signed_payload") + }) return _obj + + diff --git a/cdp/client/models/broadcast_transfer_request.py b/cdp/client/models/broadcast_transfer_request.py index 11ab3da..414e304 100644 --- a/cdp/client/models/broadcast_transfer_request.py +++ b/cdp/client/models/broadcast_transfer_request.py @@ -1,29 +1,33 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 -import json + +from __future__ import annotations import pprint import re # noqa: F401 -from typing import Any, ClassVar +import json from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set from typing_extensions import Self - class BroadcastTransferRequest(BaseModel): - """BroadcastTransferRequest""" - + """ + BroadcastTransferRequest + """ # noqa: E501 signed_payload: StrictStr = Field(description="The hex-encoded signed payload of the transfer") - __properties: ClassVar[list[str]] = ["signed_payload"] + __properties: ClassVar[List[str]] = ["signed_payload"] model_config = ConfigDict( populate_by_name=True, @@ -31,6 +35,7 @@ class BroadcastTransferRequest(BaseModel): protected_namespaces=(), ) + def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True)) @@ -41,11 +46,11 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self | None: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of BroadcastTransferRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self) -> dict[str, Any]: + def to_dict(self) -> Dict[str, Any]: """Return the dictionary representation of the model using alias. This has the following differences from calling pydantic's @@ -55,7 +60,8 @@ def to_dict(self) -> dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ - excluded_fields: set[str] = set([]) + excluded_fields: Set[str] = set([ + ]) _dict = self.model_dump( by_alias=True, @@ -65,7 +71,7 @@ def to_dict(self) -> dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of BroadcastTransferRequest from a dict""" if obj is None: return None @@ -73,5 +79,9 @@ def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate({"signed_payload": obj.get("signed_payload")}) + _obj = cls.model_validate({ + "signed_payload": obj.get("signed_payload") + }) return _obj + + diff --git a/cdp/client/models/build_staking_operation_request.py b/cdp/client/models/build_staking_operation_request.py index c9c4743..7238168 100644 --- a/cdp/client/models/build_staking_operation_request.py +++ b/cdp/client/models/build_staking_operation_request.py @@ -1,41 +1,37 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 -import json + +from __future__ import annotations import pprint import re # noqa: F401 -from typing import Any, ClassVar +import json from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set from typing_extensions import Self - class BuildStakingOperationRequest(BaseModel): - """BuildStakingOperationRequest""" - + """ + BuildStakingOperationRequest + """ # noqa: E501 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 from which the staking transaction originates and is responsible for signing the transaction." - ) + 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] - __properties: ClassVar[list[str]] = [ - "network_id", - "asset_id", - "address_id", - "action", - "options", - ] + options: Dict[str, StrictStr] + __properties: ClassVar[List[str]] = ["network_id", "asset_id", "address_id", "action", "options"] model_config = ConfigDict( populate_by_name=True, @@ -43,6 +39,7 @@ class BuildStakingOperationRequest(BaseModel): protected_namespaces=(), ) + def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True)) @@ -53,11 +50,11 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self | None: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of BuildStakingOperationRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self) -> dict[str, Any]: + def to_dict(self) -> Dict[str, Any]: """Return the dictionary representation of the model using alias. This has the following differences from calling pydantic's @@ -67,7 +64,8 @@ def to_dict(self) -> dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ - excluded_fields: set[str] = set([]) + excluded_fields: Set[str] = set([ + ]) _dict = self.model_dump( by_alias=True, @@ -77,7 +75,7 @@ def to_dict(self) -> dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of BuildStakingOperationRequest from a dict""" if obj is None: return None @@ -85,13 +83,13 @@ def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate( - { - "network_id": obj.get("network_id"), - "asset_id": obj.get("asset_id"), - "address_id": obj.get("address_id"), - "action": obj.get("action"), - "options": obj.get("options"), - } - ) + _obj = cls.model_validate({ + "network_id": obj.get("network_id"), + "asset_id": obj.get("asset_id"), + "address_id": obj.get("address_id"), + "action": obj.get("action"), + "options": obj.get("options") + }) return _obj + + diff --git a/cdp/client/models/contract_event.py b/cdp/client/models/contract_event.py index 2a409cc..9e06e9a 100644 --- a/cdp/client/models/contract_event.py +++ b/cdp/client/models/contract_event.py @@ -1,62 +1,46 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 -import json + +from __future__ import annotations import pprint import re # noqa: F401 -from datetime import datetime -from typing import Any, ClassVar +import json +from datetime import datetime from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set from typing_extensions import Self - class ContractEvent(BaseModel): - """Represents a single decoded event emitted by a smart contract""" - + """ + Represents a single decoded event emitted by a smart contract + """ # noqa: E501 network_id: StrictStr = Field(description="The name of the blockchain network") protocol_name: StrictStr = Field(description="The name of the blockchain project or protocol") - contract_name: StrictStr = Field( - description="The name of the specific contract within the project" - ) + contract_name: StrictStr = Field(description="The name of the specific contract within the project") event_name: StrictStr = Field(description="The name of the event emitted by the contract") sig: StrictStr = Field(description="The signature of the event, including parameter types") - four_bytes: StrictStr = Field( - description="The first four bytes of the Keccak hash of the event signature" - ) + four_bytes: StrictStr = Field(description="The first four bytes of the Keccak hash of the event signature") contract_address: StrictStr = Field(description="The EVM address of the smart contract") - block_time: datetime = Field( - description="The timestamp of the block in which the event was emitted" - ) + block_time: datetime = Field(description="The timestamp of the block in which the event was emitted") block_height: StrictInt = Field(description="The block number in which the event was emitted") tx_hash: StrictStr = Field(description="The transaction hash in which the event was emitted") tx_index: StrictInt = Field(description="The index of the transaction within the block") event_index: StrictInt = Field(description="The index of the event within the transaction") data: StrictStr = Field(description="The event data in a stringified format") - __properties: ClassVar[list[str]] = [ - "network_id", - "protocol_name", - "contract_name", - "event_name", - "sig", - "four_bytes", - "contract_address", - "block_time", - "block_height", - "tx_hash", - "tx_index", - "event_index", - "data", - ] + __properties: ClassVar[List[str]] = ["network_id", "protocol_name", "contract_name", "event_name", "sig", "four_bytes", "contract_address", "block_time", "block_height", "tx_hash", "tx_index", "event_index", "data"] model_config = ConfigDict( populate_by_name=True, @@ -64,6 +48,7 @@ class ContractEvent(BaseModel): protected_namespaces=(), ) + def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True)) @@ -74,11 +59,11 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self | None: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of ContractEvent from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self) -> dict[str, Any]: + def to_dict(self) -> Dict[str, Any]: """Return the dictionary representation of the model using alias. This has the following differences from calling pydantic's @@ -88,7 +73,8 @@ def to_dict(self) -> dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ - excluded_fields: set[str] = set([]) + excluded_fields: Set[str] = set([ + ]) _dict = self.model_dump( by_alias=True, @@ -98,7 +84,7 @@ def to_dict(self) -> dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of ContractEvent from a dict""" if obj is None: return None @@ -106,21 +92,21 @@ def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate( - { - "network_id": obj.get("network_id"), - "protocol_name": obj.get("protocol_name"), - "contract_name": obj.get("contract_name"), - "event_name": obj.get("event_name"), - "sig": obj.get("sig"), - "four_bytes": obj.get("four_bytes"), - "contract_address": obj.get("contract_address"), - "block_time": obj.get("block_time"), - "block_height": obj.get("block_height"), - "tx_hash": obj.get("tx_hash"), - "tx_index": obj.get("tx_index"), - "event_index": obj.get("event_index"), - "data": obj.get("data"), - } - ) + _obj = cls.model_validate({ + "network_id": obj.get("network_id"), + "protocol_name": obj.get("protocol_name"), + "contract_name": obj.get("contract_name"), + "event_name": obj.get("event_name"), + "sig": obj.get("sig"), + "four_bytes": obj.get("four_bytes"), + "contract_address": obj.get("contract_address"), + "block_time": obj.get("block_time"), + "block_height": obj.get("block_height"), + "tx_hash": obj.get("tx_hash"), + "tx_index": obj.get("tx_index"), + "event_index": obj.get("event_index"), + "data": obj.get("data") + }) return _obj + + diff --git a/cdp/client/models/contract_event_list.py b/cdp/client/models/contract_event_list.py index f0dfff2..28505ae 100644 --- a/cdp/client/models/contract_event_list.py +++ b/cdp/client/models/contract_event_list.py @@ -1,35 +1,36 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 -import json + +from __future__ import annotations import pprint import re # noqa: F401 -from typing import Any, ClassVar +import json from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr -from typing_extensions import Self - +from typing import Any, ClassVar, Dict, List from cdp.client.models.contract_event import ContractEvent - +from typing import Optional, Set +from typing_extensions import Self class ContractEventList(BaseModel): - """A list of contract events with pagination information""" - - data: list[ContractEvent] = Field(description="An array of ContractEvent objects") + """ + A list of contract events with pagination information + """ # noqa: E501 + data: List[ContractEvent] = Field(description="An array of ContractEvent objects") next_page: StrictStr = Field(description="The page token to be used to fetch the next page") - has_more: StrictBool = Field( - description="True if this list has another page of items after this one that can be fetched" - ) - __properties: ClassVar[list[str]] = ["data", "next_page", "has_more"] + has_more: StrictBool = Field(description="True if this list has another page of items after this one that can be fetched") + __properties: ClassVar[List[str]] = ["data", "next_page", "has_more"] model_config = ConfigDict( populate_by_name=True, @@ -37,6 +38,7 @@ class ContractEventList(BaseModel): protected_namespaces=(), ) + def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True)) @@ -47,11 +49,11 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self | None: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of ContractEventList from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self) -> dict[str, Any]: + def to_dict(self) -> Dict[str, Any]: """Return the dictionary representation of the model using alias. This has the following differences from calling pydantic's @@ -61,7 +63,8 @@ def to_dict(self) -> dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ - excluded_fields: set[str] = set([]) + excluded_fields: Set[str] = set([ + ]) _dict = self.model_dump( by_alias=True, @@ -74,11 +77,11 @@ def to_dict(self) -> dict[str, Any]: for _item_data in self.data: if _item_data: _items.append(_item_data.to_dict()) - _dict["data"] = _items + _dict['data'] = _items return _dict @classmethod - def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of ContractEventList from a dict""" if obj is None: return None @@ -86,13 +89,11 @@ def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate( - { - "data": [ContractEvent.from_dict(_item) for _item in obj["data"]] - if obj.get("data") is not None - else None, - "next_page": obj.get("next_page"), - "has_more": obj.get("has_more"), - } - ) + _obj = cls.model_validate({ + "data": [ContractEvent.from_dict(_item) for _item in obj["data"]] if obj.get("data") is not None else None, + "next_page": obj.get("next_page"), + "has_more": obj.get("has_more") + }) return _obj + + diff --git a/cdp/client/models/contract_invocation.py b/cdp/client/models/contract_invocation.py index 81c0a88..82713a2 100644 --- a/cdp/client/models/contract_invocation.py +++ b/cdp/client/models/contract_invocation.py @@ -1,55 +1,43 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 -import json + +from __future__ import annotations import pprint import re # noqa: F401 -from typing import Any, ClassVar +import json from pydantic import BaseModel, ConfigDict, Field, StrictStr -from typing_extensions import Self - +from typing import Any, ClassVar, Dict, List, Optional from cdp.client.models.transaction import Transaction - +from typing import Optional, Set +from typing_extensions import Self class ContractInvocation(BaseModel): - """A contract invocation onchain.""" - + """ + A contract invocation onchain. + """ # noqa: E501 network_id: StrictStr = Field(description="The ID of the blockchain network.") wallet_id: StrictStr = Field(description="The ID of the wallet that owns the address.") - address_id: StrictStr = Field( - description="The onchain address of the address invoking the contract." - ) + address_id: StrictStr = Field(description="The onchain address of the address invoking the contract.") contract_invocation_id: StrictStr = Field(description="The ID of the contract invocation.") contract_address: StrictStr = Field(description="The onchain address of the contract.") method: StrictStr = Field(description="The method to be invoked on the contract.") - args: StrictStr = Field( - description="The JSON-encoded arguments to pass to the contract method. The keys should be the argument names and the values should be the argument values." - ) - abi: StrictStr | None = Field(default=None, description="The JSON-encoded ABI of the contract.") + args: StrictStr = Field(description="The JSON-encoded arguments to pass to the contract method. The keys should be the argument names and the values should be the argument values.") + abi: Optional[StrictStr] = Field(default=None, description="The JSON-encoded ABI of the contract.") amount: StrictStr = Field(description="The amount to send to the contract for a payable method") transaction: Transaction - __properties: ClassVar[list[str]] = [ - "network_id", - "wallet_id", - "address_id", - "contract_invocation_id", - "contract_address", - "method", - "args", - "abi", - "amount", - "transaction", - ] + __properties: ClassVar[List[str]] = ["network_id", "wallet_id", "address_id", "contract_invocation_id", "contract_address", "method", "args", "abi", "amount", "transaction"] model_config = ConfigDict( populate_by_name=True, @@ -57,6 +45,7 @@ class ContractInvocation(BaseModel): protected_namespaces=(), ) + def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True)) @@ -67,11 +56,11 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self | None: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of ContractInvocation from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self) -> dict[str, Any]: + def to_dict(self) -> Dict[str, Any]: """Return the dictionary representation of the model using alias. This has the following differences from calling pydantic's @@ -81,7 +70,8 @@ def to_dict(self) -> dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ - excluded_fields: set[str] = set([]) + excluded_fields: Set[str] = set([ + ]) _dict = self.model_dump( by_alias=True, @@ -90,11 +80,11 @@ def to_dict(self) -> dict[str, Any]: ) # override the default output from pydantic by calling `to_dict()` of transaction if self.transaction: - _dict["transaction"] = self.transaction.to_dict() + _dict['transaction'] = self.transaction.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of ContractInvocation from a dict""" if obj is None: return None @@ -102,20 +92,18 @@ def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate( - { - "network_id": obj.get("network_id"), - "wallet_id": obj.get("wallet_id"), - "address_id": obj.get("address_id"), - "contract_invocation_id": obj.get("contract_invocation_id"), - "contract_address": obj.get("contract_address"), - "method": obj.get("method"), - "args": obj.get("args"), - "abi": obj.get("abi"), - "amount": obj.get("amount"), - "transaction": Transaction.from_dict(obj["transaction"]) - if obj.get("transaction") is not None - else None, - } - ) + _obj = cls.model_validate({ + "network_id": obj.get("network_id"), + "wallet_id": obj.get("wallet_id"), + "address_id": obj.get("address_id"), + "contract_invocation_id": obj.get("contract_invocation_id"), + "contract_address": obj.get("contract_address"), + "method": obj.get("method"), + "args": obj.get("args"), + "abi": obj.get("abi"), + "amount": obj.get("amount"), + "transaction": Transaction.from_dict(obj["transaction"]) if obj.get("transaction") is not None else None + }) return _obj + + diff --git a/cdp/client/models/contract_invocation_list.py b/cdp/client/models/contract_invocation_list.py index 395f43c..c5b7b1e 100644 --- a/cdp/client/models/contract_invocation_list.py +++ b/cdp/client/models/contract_invocation_list.py @@ -1,38 +1,37 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 -import json + +from __future__ import annotations import pprint import re # noqa: F401 -from typing import Any, ClassVar +import json from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr -from typing_extensions import Self - +from typing import Any, ClassVar, Dict, List from cdp.client.models.contract_invocation import ContractInvocation - +from typing import Optional, Set +from typing_extensions import Self class ContractInvocationList(BaseModel): - """ContractInvocationList""" - - data: list[ContractInvocation] - has_more: StrictBool = Field( - description="True if this list has another page of items after this one that can be fetched." - ) + """ + ContractInvocationList + """ # noqa: E501 + data: List[ContractInvocation] + has_more: StrictBool = Field(description="True if this list has another page of items after this one that can be fetched.") next_page: StrictStr = Field(description="The page token to be used to fetch the next page.") - total_count: StrictInt = Field( - description="The total number of contract invocations for the address in the wallet." - ) - __properties: ClassVar[list[str]] = ["data", "has_more", "next_page", "total_count"] + total_count: StrictInt = Field(description="The total number of contract invocations for the address in the wallet.") + __properties: ClassVar[List[str]] = ["data", "has_more", "next_page", "total_count"] model_config = ConfigDict( populate_by_name=True, @@ -40,6 +39,7 @@ class ContractInvocationList(BaseModel): protected_namespaces=(), ) + def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True)) @@ -50,11 +50,11 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self | None: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of ContractInvocationList from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self) -> dict[str, Any]: + def to_dict(self) -> Dict[str, Any]: """Return the dictionary representation of the model using alias. This has the following differences from calling pydantic's @@ -64,7 +64,8 @@ def to_dict(self) -> dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ - excluded_fields: set[str] = set([]) + excluded_fields: Set[str] = set([ + ]) _dict = self.model_dump( by_alias=True, @@ -77,11 +78,11 @@ def to_dict(self) -> dict[str, Any]: for _item_data in self.data: if _item_data: _items.append(_item_data.to_dict()) - _dict["data"] = _items + _dict['data'] = _items return _dict @classmethod - def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of ContractInvocationList from a dict""" if obj is None: return None @@ -89,14 +90,12 @@ def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate( - { - "data": [ContractInvocation.from_dict(_item) for _item in obj["data"]] - if obj.get("data") is not None - else None, - "has_more": obj.get("has_more"), - "next_page": obj.get("next_page"), - "total_count": obj.get("total_count"), - } - ) + _obj = cls.model_validate({ + "data": [ContractInvocation.from_dict(_item) for _item in obj["data"]] if obj.get("data") is not None else None, + "has_more": obj.get("has_more"), + "next_page": obj.get("next_page"), + "total_count": obj.get("total_count") + }) return _obj + + diff --git a/cdp/client/models/create_address_request.py b/cdp/client/models/create_address_request.py index 024733a..f9da470 100644 --- a/cdp/client/models/create_address_request.py +++ b/cdp/client/models/create_address_request.py @@ -1,38 +1,35 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 -import json + +from __future__ import annotations import pprint import re # noqa: F401 -from typing import Any, ClassVar +import json from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set from typing_extensions import Self - class CreateAddressRequest(BaseModel): - """CreateAddressRequest""" - - public_key: StrictStr | None = Field( - default=None, description="The public key from which the address will be derived." - ) - attestation: StrictStr | None = Field( - default=None, - description="An attestation signed by the private key that is associated with the wallet. The attestation will be a hex-encoded signature of a json payload with fields `wallet_id` and `public_key`, signed by the private key associated with the public_key set in the request.", - ) - address_index: StrictInt | None = Field( - default=None, description="The index of the address within the wallet." - ) - __properties: ClassVar[list[str]] = ["public_key", "attestation", "address_index"] + """ + CreateAddressRequest + """ # noqa: E501 + public_key: Optional[StrictStr] = Field(default=None, description="The public key from which the address will be derived.") + attestation: Optional[StrictStr] = Field(default=None, description="An attestation signed by the private key that is associated with the wallet. The attestation will be a hex-encoded signature of a json payload with fields `wallet_id` and `public_key`, signed by the private key associated with the public_key set in the request.") + address_index: Optional[StrictInt] = Field(default=None, description="The index of the address within the wallet.") + __properties: ClassVar[List[str]] = ["public_key", "attestation", "address_index"] model_config = ConfigDict( populate_by_name=True, @@ -40,6 +37,7 @@ class CreateAddressRequest(BaseModel): protected_namespaces=(), ) + def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True)) @@ -50,11 +48,11 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self | None: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of CreateAddressRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self) -> dict[str, Any]: + def to_dict(self) -> Dict[str, Any]: """Return the dictionary representation of the model using alias. This has the following differences from calling pydantic's @@ -64,7 +62,8 @@ def to_dict(self) -> dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ - excluded_fields: set[str] = set([]) + excluded_fields: Set[str] = set([ + ]) _dict = self.model_dump( by_alias=True, @@ -74,7 +73,7 @@ def to_dict(self) -> dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of CreateAddressRequest from a dict""" if obj is None: return None @@ -82,11 +81,11 @@ def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate( - { - "public_key": obj.get("public_key"), - "attestation": obj.get("attestation"), - "address_index": obj.get("address_index"), - } - ) + _obj = cls.model_validate({ + "public_key": obj.get("public_key"), + "attestation": obj.get("attestation"), + "address_index": obj.get("address_index") + }) return _obj + + diff --git a/cdp/client/models/create_contract_invocation_request.py b/cdp/client/models/create_contract_invocation_request.py index a9ec15b..4265c5a 100644 --- a/cdp/client/models/create_contract_invocation_request.py +++ b/cdp/client/models/create_contract_invocation_request.py @@ -1,38 +1,37 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 -import json + +from __future__ import annotations import pprint import re # noqa: F401 -from typing import Any, ClassVar +import json from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set from typing_extensions import Self - class CreateContractInvocationRequest(BaseModel): - """CreateContractInvocationRequest""" - + """ + CreateContractInvocationRequest + """ # noqa: E501 contract_address: StrictStr = Field(description="The address of the contract to invoke.") method: StrictStr = Field(description="The method to invoke on the contract.") - args: StrictStr = Field( - description="The JSON-encoded arguments to pass to the contract method. The keys should be the argument names and the values should be the argument values." - ) - abi: StrictStr | None = Field(default=None, description="The JSON-encoded ABI of the contract.") - amount: StrictStr | None = Field( - default=None, - description="The amount in atomic units of the native asset to send to the contract for a payable method", - ) - __properties: ClassVar[list[str]] = ["contract_address", "method", "args", "abi", "amount"] + args: StrictStr = Field(description="The JSON-encoded arguments to pass to the contract method. The keys should be the argument names and the values should be the argument values.") + abi: Optional[StrictStr] = Field(default=None, description="The JSON-encoded ABI of the contract.") + amount: Optional[StrictStr] = Field(default=None, description="The amount in atomic units of the native asset to send to the contract for a payable method") + __properties: ClassVar[List[str]] = ["contract_address", "method", "args", "abi", "amount"] model_config = ConfigDict( populate_by_name=True, @@ -40,6 +39,7 @@ class CreateContractInvocationRequest(BaseModel): protected_namespaces=(), ) + def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True)) @@ -50,11 +50,11 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self | None: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of CreateContractInvocationRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self) -> dict[str, Any]: + def to_dict(self) -> Dict[str, Any]: """Return the dictionary representation of the model using alias. This has the following differences from calling pydantic's @@ -64,7 +64,8 @@ def to_dict(self) -> dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ - excluded_fields: set[str] = set([]) + excluded_fields: Set[str] = set([ + ]) _dict = self.model_dump( by_alias=True, @@ -74,7 +75,7 @@ def to_dict(self) -> dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of CreateContractInvocationRequest from a dict""" if obj is None: return None @@ -82,13 +83,13 @@ def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate( - { - "contract_address": obj.get("contract_address"), - "method": obj.get("method"), - "args": obj.get("args"), - "abi": obj.get("abi"), - "amount": obj.get("amount"), - } - ) + _obj = cls.model_validate({ + "contract_address": obj.get("contract_address"), + "method": obj.get("method"), + "args": obj.get("args"), + "abi": obj.get("abi"), + "amount": obj.get("amount") + }) return _obj + + diff --git a/cdp/client/models/create_payload_signature_request.py b/cdp/client/models/create_payload_signature_request.py index fa717bb..21ae68c 100644 --- a/cdp/client/models/create_payload_signature_request.py +++ b/cdp/client/models/create_payload_signature_request.py @@ -1,30 +1,34 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 -import json + +from __future__ import annotations import pprint import re # noqa: F401 -from typing import Any, ClassVar +import json from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set from typing_extensions import Self - class CreatePayloadSignatureRequest(BaseModel): - """CreatePayloadSignatureRequest""" - + """ + CreatePayloadSignatureRequest + """ # noqa: E501 unsigned_payload: StrictStr = Field(description="The unsigned payload.") - signature: StrictStr | None = Field(default=None, description="The signature of the payload.") - __properties: ClassVar[list[str]] = ["unsigned_payload", "signature"] + signature: Optional[StrictStr] = Field(default=None, description="The signature of the payload.") + __properties: ClassVar[List[str]] = ["unsigned_payload", "signature"] model_config = ConfigDict( populate_by_name=True, @@ -32,6 +36,7 @@ class CreatePayloadSignatureRequest(BaseModel): protected_namespaces=(), ) + def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True)) @@ -42,11 +47,11 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self | None: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of CreatePayloadSignatureRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self) -> dict[str, Any]: + def to_dict(self) -> Dict[str, Any]: """Return the dictionary representation of the model using alias. This has the following differences from calling pydantic's @@ -56,7 +61,8 @@ def to_dict(self) -> dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ - excluded_fields: set[str] = set([]) + excluded_fields: Set[str] = set([ + ]) _dict = self.model_dump( by_alias=True, @@ -66,7 +72,7 @@ def to_dict(self) -> dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of CreatePayloadSignatureRequest from a dict""" if obj is None: return None @@ -74,7 +80,10 @@ def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate( - {"unsigned_payload": obj.get("unsigned_payload"), "signature": obj.get("signature")} - ) + _obj = cls.model_validate({ + "unsigned_payload": obj.get("unsigned_payload"), + "signature": obj.get("signature") + }) return _obj + + diff --git a/cdp/client/models/create_server_signer_request.py b/cdp/client/models/create_server_signer_request.py index 20c6dd5..d50dac7 100644 --- a/cdp/client/models/create_server_signer_request.py +++ b/cdp/client/models/create_server_signer_request.py @@ -1,35 +1,35 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 -import json + +from __future__ import annotations import pprint import re # noqa: F401 -from typing import Any, ClassVar +import json from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set from typing_extensions import Self - class CreateServerSignerRequest(BaseModel): - """CreateServerSignerRequest""" - - server_signer_id: StrictStr | None = Field( - default=None, description="The ID of the server signer for the 1 of 1 server signer." - ) - enrollment_data: StrictStr = Field( - description="The enrollment data of the server signer. This will be the base64 encoded server-signer-id for the 1 of 1 server signer." - ) + """ + CreateServerSignerRequest + """ # noqa: E501 + server_signer_id: Optional[StrictStr] = Field(default=None, description="The ID of the server signer for the 1 of 1 server signer.") + enrollment_data: StrictStr = Field(description="The enrollment data of the server signer. This will be the base64 encoded server-signer-id for the 1 of 1 server signer.") is_mpc: StrictBool = Field(description="Whether the Server-Signer uses MPC.") - __properties: ClassVar[list[str]] = ["server_signer_id", "enrollment_data", "is_mpc"] + __properties: ClassVar[List[str]] = ["server_signer_id", "enrollment_data", "is_mpc"] model_config = ConfigDict( populate_by_name=True, @@ -37,6 +37,7 @@ class CreateServerSignerRequest(BaseModel): protected_namespaces=(), ) + def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True)) @@ -47,11 +48,11 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self | None: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of CreateServerSignerRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self) -> dict[str, Any]: + def to_dict(self) -> Dict[str, Any]: """Return the dictionary representation of the model using alias. This has the following differences from calling pydantic's @@ -61,7 +62,8 @@ def to_dict(self) -> dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ - excluded_fields: set[str] = set([]) + excluded_fields: Set[str] = set([ + ]) _dict = self.model_dump( by_alias=True, @@ -71,7 +73,7 @@ def to_dict(self) -> dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of CreateServerSignerRequest from a dict""" if obj is None: return None @@ -79,11 +81,11 @@ def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate( - { - "server_signer_id": obj.get("server_signer_id"), - "enrollment_data": obj.get("enrollment_data"), - "is_mpc": obj.get("is_mpc"), - } - ) + _obj = cls.model_validate({ + "server_signer_id": obj.get("server_signer_id"), + "enrollment_data": obj.get("enrollment_data"), + "is_mpc": obj.get("is_mpc") + }) return _obj + + diff --git a/cdp/client/models/create_smart_contract_request.py b/cdp/client/models/create_smart_contract_request.py index 7edf0b5..6bb98e4 100644 --- a/cdp/client/models/create_smart_contract_request.py +++ b/cdp/client/models/create_smart_contract_request.py @@ -1,33 +1,36 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 -import json + +from __future__ import annotations import pprint import re # noqa: F401 -from typing import Any, ClassVar +import json from pydantic import BaseModel, ConfigDict -from typing_extensions import Self - +from typing import Any, ClassVar, Dict, List from cdp.client.models.smart_contract_options import SmartContractOptions from cdp.client.models.smart_contract_type import SmartContractType - +from typing import Optional, Set +from typing_extensions import Self class CreateSmartContractRequest(BaseModel): - """CreateSmartContractRequest""" - + """ + CreateSmartContractRequest + """ # noqa: E501 type: SmartContractType options: SmartContractOptions - __properties: ClassVar[list[str]] = ["type", "options"] + __properties: ClassVar[List[str]] = ["type", "options"] model_config = ConfigDict( populate_by_name=True, @@ -35,6 +38,7 @@ class CreateSmartContractRequest(BaseModel): protected_namespaces=(), ) + def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True)) @@ -45,11 +49,11 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self | None: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of CreateSmartContractRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self) -> dict[str, Any]: + def to_dict(self) -> Dict[str, Any]: """Return the dictionary representation of the model using alias. This has the following differences from calling pydantic's @@ -59,7 +63,8 @@ def to_dict(self) -> dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ - excluded_fields: set[str] = set([]) + excluded_fields: Set[str] = set([ + ]) _dict = self.model_dump( by_alias=True, @@ -68,11 +73,11 @@ def to_dict(self) -> dict[str, Any]: ) # override the default output from pydantic by calling `to_dict()` of options if self.options: - _dict["options"] = self.options.to_dict() + _dict['options'] = self.options.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of CreateSmartContractRequest from a dict""" if obj is None: return None @@ -80,12 +85,10 @@ def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate( - { - "type": obj.get("type"), - "options": SmartContractOptions.from_dict(obj["options"]) - if obj.get("options") is not None - else None, - } - ) + _obj = cls.model_validate({ + "type": obj.get("type"), + "options": SmartContractOptions.from_dict(obj["options"]) if obj.get("options") is not None else None + }) return _obj + + diff --git a/cdp/client/models/create_staking_operation_request.py b/cdp/client/models/create_staking_operation_request.py index febb434..677206b 100644 --- a/cdp/client/models/create_staking_operation_request.py +++ b/cdp/client/models/create_staking_operation_request.py @@ -1,32 +1,36 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 -import json + +from __future__ import annotations import pprint import re # noqa: F401 -from typing import Any, ClassVar +import json from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set from typing_extensions import Self - class CreateStakingOperationRequest(BaseModel): - """CreateStakingOperationRequest""" - + """ + CreateStakingOperationRequest + """ # noqa: E501 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] - __properties: ClassVar[list[str]] = ["network_id", "asset_id", "action", "options"] + options: Dict[str, StrictStr] + __properties: ClassVar[List[str]] = ["network_id", "asset_id", "action", "options"] model_config = ConfigDict( populate_by_name=True, @@ -34,6 +38,7 @@ class CreateStakingOperationRequest(BaseModel): protected_namespaces=(), ) + def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True)) @@ -44,11 +49,11 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self | None: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of CreateStakingOperationRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self) -> dict[str, Any]: + def to_dict(self) -> Dict[str, Any]: """Return the dictionary representation of the model using alias. This has the following differences from calling pydantic's @@ -58,7 +63,8 @@ def to_dict(self) -> dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ - excluded_fields: set[str] = set([]) + excluded_fields: Set[str] = set([ + ]) _dict = self.model_dump( by_alias=True, @@ -68,7 +74,7 @@ def to_dict(self) -> dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of CreateStakingOperationRequest from a dict""" if obj is None: return None @@ -76,12 +82,12 @@ def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate( - { - "network_id": obj.get("network_id"), - "asset_id": obj.get("asset_id"), - "action": obj.get("action"), - "options": obj.get("options"), - } - ) + _obj = cls.model_validate({ + "network_id": obj.get("network_id"), + "asset_id": obj.get("asset_id"), + "action": obj.get("action"), + "options": obj.get("options") + }) return _obj + + diff --git a/cdp/client/models/create_trade_request.py b/cdp/client/models/create_trade_request.py index 10c602b..3089020 100644 --- a/cdp/client/models/create_trade_request.py +++ b/cdp/client/models/create_trade_request.py @@ -1,31 +1,35 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 -import json + +from __future__ import annotations import pprint import re # noqa: F401 -from typing import Any, ClassVar +import json from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set from typing_extensions import Self - class CreateTradeRequest(BaseModel): - """CreateTradeRequest""" - + """ + CreateTradeRequest + """ # noqa: E501 amount: StrictStr = Field(description="The amount to trade") from_asset_id: StrictStr = Field(description="The ID of the asset to trade") to_asset_id: StrictStr = Field(description="The ID of the asset to receive from the trade") - __properties: ClassVar[list[str]] = ["amount", "from_asset_id", "to_asset_id"] + __properties: ClassVar[List[str]] = ["amount", "from_asset_id", "to_asset_id"] model_config = ConfigDict( populate_by_name=True, @@ -33,6 +37,7 @@ class CreateTradeRequest(BaseModel): protected_namespaces=(), ) + def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True)) @@ -43,11 +48,11 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self | None: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of CreateTradeRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self) -> dict[str, Any]: + def to_dict(self) -> Dict[str, Any]: """Return the dictionary representation of the model using alias. This has the following differences from calling pydantic's @@ -57,7 +62,8 @@ def to_dict(self) -> dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ - excluded_fields: set[str] = set([]) + excluded_fields: Set[str] = set([ + ]) _dict = self.model_dump( by_alias=True, @@ -67,7 +73,7 @@ def to_dict(self) -> dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of CreateTradeRequest from a dict""" if obj is None: return None @@ -75,11 +81,11 @@ def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate( - { - "amount": obj.get("amount"), - "from_asset_id": obj.get("from_asset_id"), - "to_asset_id": obj.get("to_asset_id"), - } - ) + _obj = cls.model_validate({ + "amount": obj.get("amount"), + "from_asset_id": obj.get("from_asset_id"), + "to_asset_id": obj.get("to_asset_id") + }) return _obj + + diff --git a/cdp/client/models/create_transfer_request.py b/cdp/client/models/create_transfer_request.py index f943498..a180aa5 100644 --- a/cdp/client/models/create_transfer_request.py +++ b/cdp/client/models/create_transfer_request.py @@ -1,43 +1,37 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 -import json + +from __future__ import annotations import pprint import re # noqa: F401 -from typing import Any, ClassVar +import json from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set from typing_extensions import Self - class CreateTransferRequest(BaseModel): - """CreateTransferRequest""" - + """ + CreateTransferRequest + """ # noqa: E501 amount: StrictStr = Field(description="The amount to transfer") network_id: StrictStr = Field(description="The ID of the blockchain network") asset_id: StrictStr = Field(description="The ID of the asset to transfer") - destination: StrictStr = Field( - description="The destination address, which can be a 0x address, Basename, or ENS name" - ) - gasless: StrictBool | None = Field( - default=None, description="Whether the transfer uses sponsored gas" - ) - __properties: ClassVar[list[str]] = [ - "amount", - "network_id", - "asset_id", - "destination", - "gasless", - ] + destination: StrictStr = Field(description="The destination address, which can be a 0x address, Basename, or ENS name") + gasless: Optional[StrictBool] = Field(default=None, description="Whether the transfer uses sponsored gas") + __properties: ClassVar[List[str]] = ["amount", "network_id", "asset_id", "destination", "gasless"] model_config = ConfigDict( populate_by_name=True, @@ -45,6 +39,7 @@ class CreateTransferRequest(BaseModel): protected_namespaces=(), ) + def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True)) @@ -55,11 +50,11 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self | None: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of CreateTransferRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self) -> dict[str, Any]: + def to_dict(self) -> Dict[str, Any]: """Return the dictionary representation of the model using alias. This has the following differences from calling pydantic's @@ -69,7 +64,8 @@ def to_dict(self) -> dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ - excluded_fields: set[str] = set([]) + excluded_fields: Set[str] = set([ + ]) _dict = self.model_dump( by_alias=True, @@ -79,7 +75,7 @@ def to_dict(self) -> dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of CreateTransferRequest from a dict""" if obj is None: return None @@ -87,13 +83,13 @@ def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate( - { - "amount": obj.get("amount"), - "network_id": obj.get("network_id"), - "asset_id": obj.get("asset_id"), - "destination": obj.get("destination"), - "gasless": obj.get("gasless"), - } - ) + _obj = cls.model_validate({ + "amount": obj.get("amount"), + "network_id": obj.get("network_id"), + "asset_id": obj.get("asset_id"), + "destination": obj.get("destination"), + "gasless": obj.get("gasless") + }) return _obj + + diff --git a/cdp/client/models/create_wallet_request.py b/cdp/client/models/create_wallet_request.py index 12d784b..cff8e88 100644 --- a/cdp/client/models/create_wallet_request.py +++ b/cdp/client/models/create_wallet_request.py @@ -1,31 +1,34 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 -import json + +from __future__ import annotations import pprint import re # noqa: F401 -from typing import Any, ClassVar +import json from pydantic import BaseModel, ConfigDict -from typing_extensions import Self - +from typing import Any, ClassVar, Dict, List from cdp.client.models.create_wallet_request_wallet import CreateWalletRequestWallet - +from typing import Optional, Set +from typing_extensions import Self class CreateWalletRequest(BaseModel): - """CreateWalletRequest""" - + """ + CreateWalletRequest + """ # noqa: E501 wallet: CreateWalletRequestWallet - __properties: ClassVar[list[str]] = ["wallet"] + __properties: ClassVar[List[str]] = ["wallet"] model_config = ConfigDict( populate_by_name=True, @@ -33,6 +36,7 @@ class CreateWalletRequest(BaseModel): protected_namespaces=(), ) + def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True)) @@ -43,11 +47,11 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self | None: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of CreateWalletRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self) -> dict[str, Any]: + def to_dict(self) -> Dict[str, Any]: """Return the dictionary representation of the model using alias. This has the following differences from calling pydantic's @@ -57,7 +61,8 @@ def to_dict(self) -> dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ - excluded_fields: set[str] = set([]) + excluded_fields: Set[str] = set([ + ]) _dict = self.model_dump( by_alias=True, @@ -66,11 +71,11 @@ def to_dict(self) -> dict[str, Any]: ) # override the default output from pydantic by calling `to_dict()` of wallet if self.wallet: - _dict["wallet"] = self.wallet.to_dict() + _dict['wallet'] = self.wallet.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of CreateWalletRequest from a dict""" if obj is None: return None @@ -78,11 +83,9 @@ def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate( - { - "wallet": CreateWalletRequestWallet.from_dict(obj["wallet"]) - if obj.get("wallet") is not None - else None - } - ) + _obj = cls.model_validate({ + "wallet": CreateWalletRequestWallet.from_dict(obj["wallet"]) if obj.get("wallet") is not None else None + }) return _obj + + diff --git a/cdp/client/models/create_wallet_request_wallet.py b/cdp/client/models/create_wallet_request_wallet.py index 931d52b..88c5fce 100644 --- a/cdp/client/models/create_wallet_request_wallet.py +++ b/cdp/client/models/create_wallet_request_wallet.py @@ -1,33 +1,34 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 -import json + +from __future__ import annotations import pprint import re # noqa: F401 -from typing import Any, ClassVar +import json from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set from typing_extensions import Self - class CreateWalletRequestWallet(BaseModel): - """Parameters for configuring a wallet""" - + """ + Parameters for configuring a wallet + """ # noqa: E501 network_id: StrictStr = Field(description="The ID of the blockchain network") - use_server_signer: StrictBool | None = Field( - default=None, - description="Whether the wallet should use the project's server signer or if the addresses in the wallets will belong to a private key the developer manages. Defaults to false.", - ) - __properties: ClassVar[list[str]] = ["network_id", "use_server_signer"] + use_server_signer: Optional[StrictBool] = Field(default=None, description="Whether the wallet should use the project's server signer or if the addresses in the wallets will belong to a private key the developer manages. Defaults to false.") + __properties: ClassVar[List[str]] = ["network_id", "use_server_signer"] model_config = ConfigDict( populate_by_name=True, @@ -35,6 +36,7 @@ class CreateWalletRequestWallet(BaseModel): protected_namespaces=(), ) + def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True)) @@ -45,11 +47,11 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self | None: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of CreateWalletRequestWallet from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self) -> dict[str, Any]: + def to_dict(self) -> Dict[str, Any]: """Return the dictionary representation of the model using alias. This has the following differences from calling pydantic's @@ -59,7 +61,8 @@ def to_dict(self) -> dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ - excluded_fields: set[str] = set([]) + excluded_fields: Set[str] = set([ + ]) _dict = self.model_dump( by_alias=True, @@ -69,7 +72,7 @@ def to_dict(self) -> dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of CreateWalletRequestWallet from a dict""" if obj is None: return None @@ -77,7 +80,10 @@ def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate( - {"network_id": obj.get("network_id"), "use_server_signer": obj.get("use_server_signer")} - ) + _obj = cls.model_validate({ + "network_id": obj.get("network_id"), + "use_server_signer": obj.get("use_server_signer") + }) return _obj + + diff --git a/cdp/client/models/create_wallet_webhook_request.py b/cdp/client/models/create_wallet_webhook_request.py new file mode 100644 index 0000000..76996e6 --- /dev/null +++ b/cdp/client/models/create_wallet_webhook_request.py @@ -0,0 +1,89 @@ +# 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 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class CreateWalletWebhookRequest(BaseModel): + """ + CreateWalletWebhookRequest + """ # noqa: E501 + notification_uri: StrictStr = Field(description="The URL to which the notifications will be sent.") + signature_header: Optional[StrictStr] = Field(default=None, description="The custom header to be used for x-webhook-signature header on callbacks, so developers can verify the requests are coming from Coinbase.") + __properties: ClassVar[List[str]] = ["notification_uri", "signature_header"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CreateWalletWebhookRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CreateWalletWebhookRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "notification_uri": obj.get("notification_uri"), + "signature_header": obj.get("signature_header") + }) + return _obj + + diff --git a/cdp/client/models/create_webhook_request.py b/cdp/client/models/create_webhook_request.py index 24228be..7125ef7 100644 --- a/cdp/client/models/create_webhook_request.py +++ b/cdp/client/models/create_webhook_request.py @@ -1,53 +1,41 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 -import json + +from __future__ import annotations import pprint import re # noqa: F401 -from typing import Any, ClassVar +import json from pydantic import BaseModel, ConfigDict, Field, StrictStr -from typing_extensions import Self - +from typing import Any, ClassVar, Dict, List, Optional from cdp.client.models.webhook_event_filter import WebhookEventFilter from cdp.client.models.webhook_event_type import WebhookEventType from cdp.client.models.webhook_event_type_filter import WebhookEventTypeFilter - +from typing import Optional, Set +from typing_extensions import Self class CreateWebhookRequest(BaseModel): - """CreateWebhookRequest""" - + """ + CreateWebhookRequest + """ # noqa: E501 network_id: StrictStr = Field(description="The ID of the blockchain network") event_type: WebhookEventType - event_type_filter: WebhookEventTypeFilter | None = None - event_filters: list[WebhookEventFilter] | None = Field( - default=None, - description="Webhook will monitor all events that matches any one of the event filters.", - ) - notification_uri: StrictStr = Field( - description="The URL to which the notifications will be sent" - ) - signature_header: StrictStr | None = Field( - default=None, - description="The custom header to be used for x-webhook-signature header on callbacks, so developers can verify the requests are coming from Coinbase.", - ) - __properties: ClassVar[list[str]] = [ - "network_id", - "event_type", - "event_type_filter", - "event_filters", - "notification_uri", - "signature_header", - ] + event_type_filter: Optional[WebhookEventTypeFilter] = None + event_filters: Optional[List[WebhookEventFilter]] = Field(default=None, description="Webhook will monitor all events that matches any one of the event filters.") + notification_uri: StrictStr = Field(description="The URL to which the notifications will be sent") + signature_header: Optional[StrictStr] = Field(default=None, description="The custom header to be used for x-webhook-signature header on callbacks, so developers can verify the requests are coming from Coinbase.") + __properties: ClassVar[List[str]] = ["network_id", "event_type", "event_type_filter", "event_filters", "notification_uri", "signature_header"] model_config = ConfigDict( populate_by_name=True, @@ -55,6 +43,7 @@ class CreateWebhookRequest(BaseModel): protected_namespaces=(), ) + def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True)) @@ -65,11 +54,11 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self | None: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of CreateWebhookRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self) -> dict[str, Any]: + def to_dict(self) -> Dict[str, Any]: """Return the dictionary representation of the model using alias. This has the following differences from calling pydantic's @@ -79,7 +68,8 @@ def to_dict(self) -> dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ - excluded_fields: set[str] = set([]) + excluded_fields: Set[str] = set([ + ]) _dict = self.model_dump( by_alias=True, @@ -88,18 +78,18 @@ def to_dict(self) -> dict[str, Any]: ) # override the default output from pydantic by calling `to_dict()` of event_type_filter if self.event_type_filter: - _dict["event_type_filter"] = self.event_type_filter.to_dict() + _dict['event_type_filter'] = self.event_type_filter.to_dict() # override the default output from pydantic by calling `to_dict()` of each item in event_filters (list) _items = [] if self.event_filters: for _item_event_filters in self.event_filters: if _item_event_filters: _items.append(_item_event_filters.to_dict()) - _dict["event_filters"] = _items + _dict['event_filters'] = _items return _dict @classmethod - def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of CreateWebhookRequest from a dict""" if obj is None: return None @@ -107,20 +97,14 @@ def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate( - { - "network_id": obj.get("network_id"), - "event_type": obj.get("event_type"), - "event_type_filter": WebhookEventTypeFilter.from_dict(obj["event_type_filter"]) - if obj.get("event_type_filter") is not None - else None, - "event_filters": [ - WebhookEventFilter.from_dict(_item) for _item in obj["event_filters"] - ] - if obj.get("event_filters") is not None - else None, - "notification_uri": obj.get("notification_uri"), - "signature_header": obj.get("signature_header"), - } - ) + _obj = cls.model_validate({ + "network_id": obj.get("network_id"), + "event_type": obj.get("event_type"), + "event_type_filter": WebhookEventTypeFilter.from_dict(obj["event_type_filter"]) if obj.get("event_type_filter") is not None else None, + "event_filters": [WebhookEventFilter.from_dict(_item) for _item in obj["event_filters"]] if obj.get("event_filters") is not None else None, + "notification_uri": obj.get("notification_uri"), + "signature_header": obj.get("signature_header") + }) return _obj + + diff --git a/cdp/client/models/deploy_smart_contract_request.py b/cdp/client/models/deploy_smart_contract_request.py index 37aa2cf..cdf37a4 100644 --- a/cdp/client/models/deploy_smart_contract_request.py +++ b/cdp/client/models/deploy_smart_contract_request.py @@ -1,31 +1,33 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 -import json + +from __future__ import annotations import pprint import re # noqa: F401 -from typing import Any, ClassVar +import json from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set from typing_extensions import Self - class DeploySmartContractRequest(BaseModel): - """DeploySmartContractRequest""" - - signed_payload: StrictStr = Field( - description="The hex-encoded signed payload of the contract deployment transaction." - ) - __properties: ClassVar[list[str]] = ["signed_payload"] + """ + DeploySmartContractRequest + """ # noqa: E501 + signed_payload: StrictStr = Field(description="The hex-encoded signed payload of the contract deployment transaction.") + __properties: ClassVar[List[str]] = ["signed_payload"] model_config = ConfigDict( populate_by_name=True, @@ -33,6 +35,7 @@ class DeploySmartContractRequest(BaseModel): protected_namespaces=(), ) + def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True)) @@ -43,11 +46,11 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self | None: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of DeploySmartContractRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self) -> dict[str, Any]: + def to_dict(self) -> Dict[str, Any]: """Return the dictionary representation of the model using alias. This has the following differences from calling pydantic's @@ -57,7 +60,8 @@ def to_dict(self) -> dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ - excluded_fields: set[str] = set([]) + excluded_fields: Set[str] = set([ + ]) _dict = self.model_dump( by_alias=True, @@ -67,7 +71,7 @@ def to_dict(self) -> dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of DeploySmartContractRequest from a dict""" if obj is None: return None @@ -75,5 +79,9 @@ def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate({"signed_payload": obj.get("signed_payload")}) + _obj = cls.model_validate({ + "signed_payload": obj.get("signed_payload") + }) return _obj + + diff --git a/cdp/client/models/erc20_transfer_event.py b/cdp/client/models/erc20_transfer_event.py index 4a48eb9..403febd 100644 --- a/cdp/client/models/erc20_transfer_event.py +++ b/cdp/client/models/erc20_transfer_event.py @@ -1,95 +1,46 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 -import json + +from __future__ import annotations import pprint import re # noqa: F401 -from datetime import datetime -from typing import Any, ClassVar +import json +from datetime import datetime from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set from typing_extensions import Self - class ERC20TransferEvent(BaseModel): - """Represents an event triggered by an ERC-20 token transfer on the blockchain. Contains information about the transaction, block, and involved addresses.""" - - webhook_id: StrictStr | None = Field( - default=None, - description="Unique identifier for the webhook that triggered this event.", - alias="webhookId", - ) - event_type: StrictStr | None = Field( - default=None, - description="Type of event, in this case, an ERC-20 token transfer.", - alias="eventType", - ) - network: StrictStr | None = Field( - default=None, description="Blockchain network where the event occurred." - ) - block_hash: StrictStr | None = Field( - default=None, description="Hash of the block containing the transaction.", alias="blockHash" - ) - block_number: StrictInt | None = Field( - default=None, - description="Number of the block containing the transaction.", - alias="blockNumber", - ) - block_time: datetime | None = Field( - default=None, description="Timestamp when the block was mined.", alias="blockTime" - ) - transaction_hash: StrictStr | None = Field( - default=None, - description="Hash of the transaction that triggered the event.", - alias="transactionHash", - ) - transaction_index: StrictInt | None = Field( - default=None, - description="Position of the transaction within the block.", - alias="transactionIndex", - ) - log_index: StrictInt | None = Field( - default=None, - description="Position of the event log within the transaction.", - alias="logIndex", - ) - contract_address: StrictStr | None = Field( - default=None, description="Address of the ERC-20 token contract.", alias="contractAddress" - ) - var_from: StrictStr | None = Field( - default=None, description="Address of the sender in the token transfer.", alias="from" - ) - to: StrictStr | None = Field( - default=None, description="Address of the recipient in the token transfer." - ) - value: StrictStr | None = Field( - default=None, - description="Amount of tokens transferred, typically in the smallest unit (e.g., wei for Ethereum).", - ) - __properties: ClassVar[list[str]] = [ - "webhookId", - "eventType", - "network", - "blockHash", - "blockNumber", - "blockTime", - "transactionHash", - "transactionIndex", - "logIndex", - "contractAddress", - "from", - "to", - "value", - ] + """ + Represents an event triggered by an ERC-20 token transfer on the blockchain. Contains information about the transaction, block, and involved addresses. + """ # noqa: E501 + webhook_id: Optional[StrictStr] = Field(default=None, description="Unique identifier for the webhook that triggered this event.", alias="webhookId") + event_type: Optional[StrictStr] = Field(default=None, description="Type of event, in this case, an ERC-20 token transfer.", alias="eventType") + network: Optional[StrictStr] = Field(default=None, description="Blockchain network where the event occurred.") + block_hash: Optional[StrictStr] = Field(default=None, description="Hash of the block containing the transaction.", alias="blockHash") + block_number: Optional[StrictInt] = Field(default=None, description="Number of the block containing the transaction.", alias="blockNumber") + block_time: Optional[datetime] = Field(default=None, description="Timestamp when the block was mined.", alias="blockTime") + transaction_hash: Optional[StrictStr] = Field(default=None, description="Hash of the transaction that triggered the event.", alias="transactionHash") + transaction_index: Optional[StrictInt] = Field(default=None, description="Position of the transaction within the block.", alias="transactionIndex") + log_index: Optional[StrictInt] = Field(default=None, description="Position of the event log within the transaction.", alias="logIndex") + contract_address: Optional[StrictStr] = Field(default=None, description="Address of the ERC-20 token contract.", alias="contractAddress") + var_from: Optional[StrictStr] = Field(default=None, description="Address of the sender in the token transfer.", alias="from") + to: Optional[StrictStr] = Field(default=None, description="Address of the recipient in the token transfer.") + value: Optional[StrictStr] = Field(default=None, description="Amount of tokens transferred, typically in the smallest unit (e.g., wei for Ethereum).") + __properties: ClassVar[List[str]] = ["webhookId", "eventType", "network", "blockHash", "blockNumber", "blockTime", "transactionHash", "transactionIndex", "logIndex", "contractAddress", "from", "to", "value"] model_config = ConfigDict( populate_by_name=True, @@ -97,6 +48,7 @@ class ERC20TransferEvent(BaseModel): protected_namespaces=(), ) + def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True)) @@ -107,11 +59,11 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self | None: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of ERC20TransferEvent from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self) -> dict[str, Any]: + def to_dict(self) -> Dict[str, Any]: """Return the dictionary representation of the model using alias. This has the following differences from calling pydantic's @@ -121,7 +73,8 @@ def to_dict(self) -> dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ - excluded_fields: set[str] = set([]) + excluded_fields: Set[str] = set([ + ]) _dict = self.model_dump( by_alias=True, @@ -131,7 +84,7 @@ def to_dict(self) -> dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of ERC20TransferEvent from a dict""" if obj is None: return None @@ -139,21 +92,21 @@ def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate( - { - "webhookId": obj.get("webhookId"), - "eventType": obj.get("eventType"), - "network": obj.get("network"), - "blockHash": obj.get("blockHash"), - "blockNumber": obj.get("blockNumber"), - "blockTime": obj.get("blockTime"), - "transactionHash": obj.get("transactionHash"), - "transactionIndex": obj.get("transactionIndex"), - "logIndex": obj.get("logIndex"), - "contractAddress": obj.get("contractAddress"), - "from": obj.get("from"), - "to": obj.get("to"), - "value": obj.get("value"), - } - ) + _obj = cls.model_validate({ + "webhookId": obj.get("webhookId"), + "eventType": obj.get("eventType"), + "network": obj.get("network"), + "blockHash": obj.get("blockHash"), + "blockNumber": obj.get("blockNumber"), + "blockTime": obj.get("blockTime"), + "transactionHash": obj.get("transactionHash"), + "transactionIndex": obj.get("transactionIndex"), + "logIndex": obj.get("logIndex"), + "contractAddress": obj.get("contractAddress"), + "from": obj.get("from"), + "to": obj.get("to"), + "value": obj.get("value") + }) return _obj + + diff --git a/cdp/client/models/erc721_transfer_event.py b/cdp/client/models/erc721_transfer_event.py index 3273027..b3a8d14 100644 --- a/cdp/client/models/erc721_transfer_event.py +++ b/cdp/client/models/erc721_transfer_event.py @@ -1,94 +1,46 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 -import json + +from __future__ import annotations import pprint import re # noqa: F401 -from datetime import datetime -from typing import Any, ClassVar +import json +from datetime import datetime from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set from typing_extensions import Self - class ERC721TransferEvent(BaseModel): - """Represents an event triggered by an ERC-721 token transfer on the blockchain. Contains information about the transaction, block, and involved addresses.""" - - webhook_id: StrictStr | None = Field( - default=None, - description="Unique identifier for the webhook that triggered this event.", - alias="webhookId", - ) - event_type: StrictStr | None = Field( - default=None, - description="Type of event, in this case, an ERC-721 token transfer.", - alias="eventType", - ) - network: StrictStr | None = Field( - default=None, description="Blockchain network where the event occurred." - ) - block_hash: StrictStr | None = Field( - default=None, description="Hash of the block containing the transaction.", alias="blockHash" - ) - block_number: StrictInt | None = Field( - default=None, - description="Number of the block containing the transaction.", - alias="blockNumber", - ) - block_time: datetime | None = Field( - default=None, description="Timestamp when the block was mined.", alias="blockTime" - ) - transaction_hash: StrictStr | None = Field( - default=None, - description="Hash of the transaction that triggered the event.", - alias="transactionHash", - ) - transaction_index: StrictInt | None = Field( - default=None, - description="Position of the transaction within the block.", - alias="transactionIndex", - ) - log_index: StrictInt | None = Field( - default=None, - description="Position of the event log within the transaction.", - alias="logIndex", - ) - contract_address: StrictStr | None = Field( - default=None, description="Address of the ERC-721 token contract.", alias="contractAddress" - ) - var_from: StrictStr | None = Field( - default=None, description="Address of the sender in the token transfer.", alias="from" - ) - to: StrictStr | None = Field( - default=None, description="Address of the recipient in the token transfer." - ) - token_id: StrictStr | None = Field( - default=None, description="Unique identifier of the NFT being transferred.", alias="tokenId" - ) - __properties: ClassVar[list[str]] = [ - "webhookId", - "eventType", - "network", - "blockHash", - "blockNumber", - "blockTime", - "transactionHash", - "transactionIndex", - "logIndex", - "contractAddress", - "from", - "to", - "tokenId", - ] + """ + Represents an event triggered by an ERC-721 token transfer on the blockchain. Contains information about the transaction, block, and involved addresses. + """ # noqa: E501 + webhook_id: Optional[StrictStr] = Field(default=None, description="Unique identifier for the webhook that triggered this event.", alias="webhookId") + event_type: Optional[StrictStr] = Field(default=None, description="Type of event, in this case, an ERC-721 token transfer.", alias="eventType") + network: Optional[StrictStr] = Field(default=None, description="Blockchain network where the event occurred.") + block_hash: Optional[StrictStr] = Field(default=None, description="Hash of the block containing the transaction.", alias="blockHash") + block_number: Optional[StrictInt] = Field(default=None, description="Number of the block containing the transaction.", alias="blockNumber") + block_time: Optional[datetime] = Field(default=None, description="Timestamp when the block was mined.", alias="blockTime") + transaction_hash: Optional[StrictStr] = Field(default=None, description="Hash of the transaction that triggered the event.", alias="transactionHash") + transaction_index: Optional[StrictInt] = Field(default=None, description="Position of the transaction within the block.", alias="transactionIndex") + log_index: Optional[StrictInt] = Field(default=None, description="Position of the event log within the transaction.", alias="logIndex") + contract_address: Optional[StrictStr] = Field(default=None, description="Address of the ERC-721 token contract.", alias="contractAddress") + var_from: Optional[StrictStr] = Field(default=None, description="Address of the sender in the token transfer.", alias="from") + to: Optional[StrictStr] = Field(default=None, description="Address of the recipient in the token transfer.") + token_id: Optional[StrictStr] = Field(default=None, description="Unique identifier of the NFT being transferred.", alias="tokenId") + __properties: ClassVar[List[str]] = ["webhookId", "eventType", "network", "blockHash", "blockNumber", "blockTime", "transactionHash", "transactionIndex", "logIndex", "contractAddress", "from", "to", "tokenId"] model_config = ConfigDict( populate_by_name=True, @@ -96,6 +48,7 @@ class ERC721TransferEvent(BaseModel): protected_namespaces=(), ) + def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True)) @@ -106,11 +59,11 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self | None: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of ERC721TransferEvent from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self) -> dict[str, Any]: + def to_dict(self) -> Dict[str, Any]: """Return the dictionary representation of the model using alias. This has the following differences from calling pydantic's @@ -120,7 +73,8 @@ def to_dict(self) -> dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ - excluded_fields: set[str] = set([]) + excluded_fields: Set[str] = set([ + ]) _dict = self.model_dump( by_alias=True, @@ -130,7 +84,7 @@ def to_dict(self) -> dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of ERC721TransferEvent from a dict""" if obj is None: return None @@ -138,21 +92,21 @@ def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate( - { - "webhookId": obj.get("webhookId"), - "eventType": obj.get("eventType"), - "network": obj.get("network"), - "blockHash": obj.get("blockHash"), - "blockNumber": obj.get("blockNumber"), - "blockTime": obj.get("blockTime"), - "transactionHash": obj.get("transactionHash"), - "transactionIndex": obj.get("transactionIndex"), - "logIndex": obj.get("logIndex"), - "contractAddress": obj.get("contractAddress"), - "from": obj.get("from"), - "to": obj.get("to"), - "tokenId": obj.get("tokenId"), - } - ) + _obj = cls.model_validate({ + "webhookId": obj.get("webhookId"), + "eventType": obj.get("eventType"), + "network": obj.get("network"), + "blockHash": obj.get("blockHash"), + "blockNumber": obj.get("blockNumber"), + "blockTime": obj.get("blockTime"), + "transactionHash": obj.get("transactionHash"), + "transactionIndex": obj.get("transactionIndex"), + "logIndex": obj.get("logIndex"), + "contractAddress": obj.get("contractAddress"), + "from": obj.get("from"), + "to": obj.get("to"), + "tokenId": obj.get("tokenId") + }) return _obj + + diff --git a/cdp/client/models/error.py b/cdp/client/models/error.py index 19c3c9c..6d47e8a 100644 --- a/cdp/client/models/error.py +++ b/cdp/client/models/error.py @@ -1,38 +1,36 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 -import json + +from __future__ import annotations import pprint import re # noqa: F401 -from typing import Annotated, Any, ClassVar +import json from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set from typing_extensions import Self - class Error(BaseModel): - """An error response from the Coinbase Developer Platform API""" - - code: Annotated[str, Field(strict=True, max_length=5000)] = Field( - description="A short string representing the reported error. Can be use to handle errors programmatically." - ) - message: Annotated[str, Field(strict=True, max_length=5000)] = Field( - description="A human-readable message providing more details about the error." - ) - correlation_id: StrictStr | None = Field( - default=None, - description="A unique identifier for the request that generated the error. This can be used to help debug issues with the API.", - ) - __properties: ClassVar[list[str]] = ["code", "message", "correlation_id"] + """ + An error response from the Coinbase Developer Platform API + """ # noqa: E501 + code: Annotated[str, Field(strict=True, max_length=5000)] = Field(description="A short string representing the reported error. Can be use to handle errors programmatically.") + message: Annotated[str, Field(strict=True, max_length=5000)] = Field(description="A human-readable message providing more details about the error.") + correlation_id: Optional[StrictStr] = Field(default=None, description="A unique identifier for the request that generated the error. This can be used to help debug issues with the API.") + __properties: ClassVar[List[str]] = ["code", "message", "correlation_id"] model_config = ConfigDict( populate_by_name=True, @@ -40,6 +38,7 @@ class Error(BaseModel): protected_namespaces=(), ) + def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True)) @@ -50,11 +49,11 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self | None: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Error from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self) -> dict[str, Any]: + def to_dict(self) -> Dict[str, Any]: """Return the dictionary representation of the model using alias. This has the following differences from calling pydantic's @@ -64,7 +63,8 @@ def to_dict(self) -> dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ - excluded_fields: set[str] = set([]) + excluded_fields: Set[str] = set([ + ]) _dict = self.model_dump( by_alias=True, @@ -74,7 +74,7 @@ def to_dict(self) -> dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of Error from a dict""" if obj is None: return None @@ -82,11 +82,11 @@ def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate( - { - "code": obj.get("code"), - "message": obj.get("message"), - "correlation_id": obj.get("correlation_id"), - } - ) + _obj = cls.model_validate({ + "code": obj.get("code"), + "message": obj.get("message"), + "correlation_id": obj.get("correlation_id") + }) return _obj + + diff --git a/cdp/client/models/ethereum_transaction.py b/cdp/client/models/ethereum_transaction.py index 9167e45..c81e8f8 100644 --- a/cdp/client/models/ethereum_transaction.py +++ b/cdp/client/models/ethereum_transaction.py @@ -1,99 +1,52 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 -import json + +from __future__ import annotations import pprint import re # noqa: F401 -from datetime import datetime -from typing import Any, ClassVar +import json +from datetime import datetime from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr -from typing_extensions import Self - +from typing import Any, ClassVar, Dict, List, Optional from cdp.client.models.ethereum_transaction_access_list import EthereumTransactionAccessList from cdp.client.models.ethereum_transaction_flattened_trace import EthereumTransactionFlattenedTrace - +from typing import Optional, Set +from typing_extensions import Self class EthereumTransaction(BaseModel): - """EthereumTransaction""" - + """ + EthereumTransaction + """ # noqa: E501 var_from: StrictStr = Field(description="The onchain address of the sender.", alias="from") - gas: StrictInt | None = Field( - default=None, description="The amount of gas spent in the transaction." - ) - gas_price: StrictInt | None = Field( - default=None, - description="The price per gas spent in the transaction in atomic units of the native asset.", - ) - hash: StrictStr | None = Field( - default=None, - description="The hash of the transaction as a hexadecimal string, prefixed with 0x.", - ) - input: StrictStr | None = Field(default=None, description="The input data of the transaction.") - nonce: StrictInt | None = Field( - default=None, description="The nonce of the transaction in the source address." - ) + gas: Optional[StrictInt] = Field(default=None, description="The amount of gas spent in the transaction.") + gas_price: Optional[StrictInt] = Field(default=None, description="The price per gas spent in the transaction in atomic units of the native asset.") + hash: Optional[StrictStr] = Field(default=None, description="The hash of the transaction as a hexadecimal string, prefixed with 0x.") + input: Optional[StrictStr] = Field(default=None, description="The input data of the transaction.") + nonce: Optional[StrictInt] = Field(default=None, description="The nonce of the transaction in the source address.") to: StrictStr = Field(description="The onchain address of the receiver.") - index: StrictInt | None = Field( - default=None, description="The index of the transaction in the block." - ) - value: StrictStr | None = Field( - default=None, - description="The value of the transaction in atomic units of the native asset.", - ) - type: StrictInt | None = Field( - default=None, - description="The EIP-2718 transaction type. See https://eips.ethereum.org/EIPS/eip-2718 for more details.", - ) - max_fee_per_gas: StrictInt | None = Field( - default=None, - description="The max fee per gas as defined in EIP-1559. https://eips.ethereum.org/EIPS/eip-1559 for more details.", - ) - max_priority_fee_per_gas: StrictInt | None = Field( - default=None, - description="The max priority fee per gas as defined in EIP-1559. https://eips.ethereum.org/EIPS/eip-1559 for more details.", - ) - priority_fee_per_gas: StrictInt | None = Field( - default=None, - description="The confirmed priority fee per gas as defined in EIP-1559. https://eips.ethereum.org/EIPS/eip-1559 for more details.", - ) - transaction_access_list: EthereumTransactionAccessList | None = None - flattened_traces: list[EthereumTransactionFlattenedTrace] | None = None - block_timestamp: datetime | None = Field( - default=None, description="The timestamp of the block in which the event was emitted" - ) - mint: StrictStr | None = Field( - default=None, - description="This is for handling optimism rollup specific EIP-2718 transaction type field.", - ) - __properties: ClassVar[list[str]] = [ - "from", - "gas", - "gas_price", - "hash", - "input", - "nonce", - "to", - "index", - "value", - "type", - "max_fee_per_gas", - "max_priority_fee_per_gas", - "priority_fee_per_gas", - "transaction_access_list", - "flattened_traces", - "block_timestamp", - "mint", - ] + index: Optional[StrictInt] = Field(default=None, description="The index of the transaction in the block.") + value: Optional[StrictStr] = Field(default=None, description="The value of the transaction in atomic units of the native asset.") + type: Optional[StrictInt] = Field(default=None, description="The EIP-2718 transaction type. See https://eips.ethereum.org/EIPS/eip-2718 for more details.") + max_fee_per_gas: Optional[StrictInt] = Field(default=None, description="The max fee per gas as defined in EIP-1559. https://eips.ethereum.org/EIPS/eip-1559 for more details.") + max_priority_fee_per_gas: Optional[StrictInt] = Field(default=None, description="The max priority fee per gas as defined in EIP-1559. https://eips.ethereum.org/EIPS/eip-1559 for more details.") + priority_fee_per_gas: Optional[StrictInt] = Field(default=None, description="The confirmed priority fee per gas as defined in EIP-1559. https://eips.ethereum.org/EIPS/eip-1559 for more details.") + transaction_access_list: Optional[EthereumTransactionAccessList] = None + flattened_traces: Optional[List[EthereumTransactionFlattenedTrace]] = None + block_timestamp: Optional[datetime] = Field(default=None, description="The timestamp of the block in which the event was emitted") + mint: Optional[StrictStr] = Field(default=None, description="This is for handling optimism rollup specific EIP-2718 transaction type field.") + __properties: ClassVar[List[str]] = ["from", "gas", "gas_price", "hash", "input", "nonce", "to", "index", "value", "type", "max_fee_per_gas", "max_priority_fee_per_gas", "priority_fee_per_gas", "transaction_access_list", "flattened_traces", "block_timestamp", "mint"] model_config = ConfigDict( populate_by_name=True, @@ -101,6 +54,7 @@ class EthereumTransaction(BaseModel): protected_namespaces=(), ) + def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True)) @@ -111,11 +65,11 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self | None: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of EthereumTransaction from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self) -> dict[str, Any]: + def to_dict(self) -> Dict[str, Any]: """Return the dictionary representation of the model using alias. This has the following differences from calling pydantic's @@ -125,7 +79,8 @@ def to_dict(self) -> dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ - excluded_fields: set[str] = set([]) + excluded_fields: Set[str] = set([ + ]) _dict = self.model_dump( by_alias=True, @@ -134,18 +89,18 @@ def to_dict(self) -> dict[str, Any]: ) # override the default output from pydantic by calling `to_dict()` of transaction_access_list if self.transaction_access_list: - _dict["transaction_access_list"] = self.transaction_access_list.to_dict() + _dict['transaction_access_list'] = self.transaction_access_list.to_dict() # override the default output from pydantic by calling `to_dict()` of each item in flattened_traces (list) _items = [] if self.flattened_traces: for _item_flattened_traces in self.flattened_traces: if _item_flattened_traces: _items.append(_item_flattened_traces.to_dict()) - _dict["flattened_traces"] = _items + _dict['flattened_traces'] = _items return _dict @classmethod - def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of EthereumTransaction from a dict""" if obj is None: return None @@ -153,34 +108,25 @@ def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate( - { - "from": obj.get("from"), - "gas": obj.get("gas"), - "gas_price": obj.get("gas_price"), - "hash": obj.get("hash"), - "input": obj.get("input"), - "nonce": obj.get("nonce"), - "to": obj.get("to"), - "index": obj.get("index"), - "value": obj.get("value"), - "type": obj.get("type"), - "max_fee_per_gas": obj.get("max_fee_per_gas"), - "max_priority_fee_per_gas": obj.get("max_priority_fee_per_gas"), - "priority_fee_per_gas": obj.get("priority_fee_per_gas"), - "transaction_access_list": EthereumTransactionAccessList.from_dict( - obj["transaction_access_list"] - ) - if obj.get("transaction_access_list") is not None - else None, - "flattened_traces": [ - EthereumTransactionFlattenedTrace.from_dict(_item) - for _item in obj["flattened_traces"] - ] - if obj.get("flattened_traces") is not None - else None, - "block_timestamp": obj.get("block_timestamp"), - "mint": obj.get("mint"), - } - ) + _obj = cls.model_validate({ + "from": obj.get("from"), + "gas": obj.get("gas"), + "gas_price": obj.get("gas_price"), + "hash": obj.get("hash"), + "input": obj.get("input"), + "nonce": obj.get("nonce"), + "to": obj.get("to"), + "index": obj.get("index"), + "value": obj.get("value"), + "type": obj.get("type"), + "max_fee_per_gas": obj.get("max_fee_per_gas"), + "max_priority_fee_per_gas": obj.get("max_priority_fee_per_gas"), + "priority_fee_per_gas": obj.get("priority_fee_per_gas"), + "transaction_access_list": EthereumTransactionAccessList.from_dict(obj["transaction_access_list"]) if obj.get("transaction_access_list") is not None else None, + "flattened_traces": [EthereumTransactionFlattenedTrace.from_dict(_item) for _item in obj["flattened_traces"]] if obj.get("flattened_traces") is not None else None, + "block_timestamp": obj.get("block_timestamp"), + "mint": obj.get("mint") + }) return _obj + + diff --git a/cdp/client/models/ethereum_transaction_access.py b/cdp/client/models/ethereum_transaction_access.py index 203781a..2b9afab 100644 --- a/cdp/client/models/ethereum_transaction_access.py +++ b/cdp/client/models/ethereum_transaction_access.py @@ -1,30 +1,34 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 -import json + +from __future__ import annotations import pprint import re # noqa: F401 -from typing import Any, ClassVar +import json from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set from typing_extensions import Self - class EthereumTransactionAccess(BaseModel): - """EthereumTransactionAccess""" - - address: StrictStr | None = None - storage_keys: list[StrictStr] | None = None - __properties: ClassVar[list[str]] = ["address", "storage_keys"] + """ + EthereumTransactionAccess + """ # noqa: E501 + address: Optional[StrictStr] = None + storage_keys: Optional[List[StrictStr]] = None + __properties: ClassVar[List[str]] = ["address", "storage_keys"] model_config = ConfigDict( populate_by_name=True, @@ -32,6 +36,7 @@ class EthereumTransactionAccess(BaseModel): protected_namespaces=(), ) + def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True)) @@ -42,11 +47,11 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self | None: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of EthereumTransactionAccess from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self) -> dict[str, Any]: + def to_dict(self) -> Dict[str, Any]: """Return the dictionary representation of the model using alias. This has the following differences from calling pydantic's @@ -56,7 +61,8 @@ def to_dict(self) -> dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ - excluded_fields: set[str] = set([]) + excluded_fields: Set[str] = set([ + ]) _dict = self.model_dump( by_alias=True, @@ -66,7 +72,7 @@ def to_dict(self) -> dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of EthereumTransactionAccess from a dict""" if obj is None: return None @@ -74,7 +80,10 @@ def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate( - {"address": obj.get("address"), "storage_keys": obj.get("storage_keys")} - ) + _obj = cls.model_validate({ + "address": obj.get("address"), + "storage_keys": obj.get("storage_keys") + }) return _obj + + diff --git a/cdp/client/models/ethereum_transaction_access_list.py b/cdp/client/models/ethereum_transaction_access_list.py index e643de8..46a176b 100644 --- a/cdp/client/models/ethereum_transaction_access_list.py +++ b/cdp/client/models/ethereum_transaction_access_list.py @@ -1,31 +1,34 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 -import json + +from __future__ import annotations import pprint import re # noqa: F401 -from typing import Any, ClassVar +import json from pydantic import BaseModel, ConfigDict -from typing_extensions import Self - +from typing import Any, ClassVar, Dict, List, Optional from cdp.client.models.ethereum_transaction_access import EthereumTransactionAccess - +from typing import Optional, Set +from typing_extensions import Self class EthereumTransactionAccessList(BaseModel): - """EthereumTransactionAccessList""" - - access_list: list[EthereumTransactionAccess] | None = None - __properties: ClassVar[list[str]] = ["access_list"] + """ + EthereumTransactionAccessList + """ # noqa: E501 + access_list: Optional[List[EthereumTransactionAccess]] = None + __properties: ClassVar[List[str]] = ["access_list"] model_config = ConfigDict( populate_by_name=True, @@ -33,6 +36,7 @@ class EthereumTransactionAccessList(BaseModel): protected_namespaces=(), ) + def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True)) @@ -43,11 +47,11 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self | None: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of EthereumTransactionAccessList from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self) -> dict[str, Any]: + def to_dict(self) -> Dict[str, Any]: """Return the dictionary representation of the model using alias. This has the following differences from calling pydantic's @@ -57,7 +61,8 @@ def to_dict(self) -> dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ - excluded_fields: set[str] = set([]) + excluded_fields: Set[str] = set([ + ]) _dict = self.model_dump( by_alias=True, @@ -70,11 +75,11 @@ def to_dict(self) -> dict[str, Any]: for _item_access_list in self.access_list: if _item_access_list: _items.append(_item_access_list.to_dict()) - _dict["access_list"] = _items + _dict['access_list'] = _items return _dict @classmethod - def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of EthereumTransactionAccessList from a dict""" if obj is None: return None @@ -82,13 +87,9 @@ def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate( - { - "access_list": [ - EthereumTransactionAccess.from_dict(_item) for _item in obj["access_list"] - ] - if obj.get("access_list") is not None - else None - } - ) + _obj = cls.model_validate({ + "access_list": [EthereumTransactionAccess.from_dict(_item) for _item in obj["access_list"]] if obj.get("access_list") is not None else None + }) return _obj + + diff --git a/cdp/client/models/ethereum_transaction_flattened_trace.py b/cdp/client/models/ethereum_transaction_flattened_trace.py index fb7c8fe..0d1b9a5 100644 --- a/cdp/client/models/ethereum_transaction_flattened_trace.py +++ b/cdp/client/models/ethereum_transaction_flattened_trace.py @@ -1,67 +1,51 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 -import json + +from __future__ import annotations import pprint import re # noqa: F401 -from typing import Any, ClassVar +import json from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set from typing_extensions import Self - class EthereumTransactionFlattenedTrace(BaseModel): - """EthereumTransactionFlattenedTrace""" - - error: StrictStr | None = None - type: StrictStr | None = None - var_from: StrictStr | None = Field(default=None, alias="from") - to: StrictStr | None = None - value: StrictStr | None = None - gas: StrictInt | None = None - gas_used: StrictInt | None = None - input: StrictStr | None = None - output: StrictStr | None = None - sub_traces: StrictInt | None = None - trace_address: list[StrictInt] | None = None - trace_type: StrictStr | None = None - call_type: StrictStr | None = None - trace_id: StrictStr | None = None - status: StrictInt | None = None - block_hash: StrictStr | None = None - block_number: StrictInt | None = None - transaction_hash: StrictStr | None = None - transaction_index: StrictInt | None = None - __properties: ClassVar[list[str]] = [ - "error", - "type", - "from", - "to", - "value", - "gas", - "gas_used", - "input", - "output", - "sub_traces", - "trace_address", - "trace_type", - "call_type", - "trace_id", - "status", - "block_hash", - "block_number", - "transaction_hash", - "transaction_index", - ] + """ + EthereumTransactionFlattenedTrace + """ # noqa: E501 + error: Optional[StrictStr] = None + type: Optional[StrictStr] = None + var_from: Optional[StrictStr] = Field(default=None, alias="from") + to: Optional[StrictStr] = None + value: Optional[StrictStr] = None + gas: Optional[StrictInt] = None + gas_used: Optional[StrictInt] = None + input: Optional[StrictStr] = None + output: Optional[StrictStr] = None + sub_traces: Optional[StrictInt] = None + trace_address: Optional[List[StrictInt]] = None + trace_type: Optional[StrictStr] = None + call_type: Optional[StrictStr] = None + trace_id: Optional[StrictStr] = None + status: Optional[StrictInt] = None + block_hash: Optional[StrictStr] = None + block_number: Optional[StrictInt] = None + transaction_hash: Optional[StrictStr] = None + transaction_index: Optional[StrictInt] = None + __properties: ClassVar[List[str]] = ["error", "type", "from", "to", "value", "gas", "gas_used", "input", "output", "sub_traces", "trace_address", "trace_type", "call_type", "trace_id", "status", "block_hash", "block_number", "transaction_hash", "transaction_index"] model_config = ConfigDict( populate_by_name=True, @@ -69,6 +53,7 @@ class EthereumTransactionFlattenedTrace(BaseModel): protected_namespaces=(), ) + def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True)) @@ -79,11 +64,11 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self | None: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of EthereumTransactionFlattenedTrace from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self) -> dict[str, Any]: + def to_dict(self) -> Dict[str, Any]: """Return the dictionary representation of the model using alias. This has the following differences from calling pydantic's @@ -93,7 +78,8 @@ def to_dict(self) -> dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ - excluded_fields: set[str] = set([]) + excluded_fields: Set[str] = set([ + ]) _dict = self.model_dump( by_alias=True, @@ -103,7 +89,7 @@ def to_dict(self) -> dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of EthereumTransactionFlattenedTrace from a dict""" if obj is None: return None @@ -111,27 +97,27 @@ def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate( - { - "error": obj.get("error"), - "type": obj.get("type"), - "from": obj.get("from"), - "to": obj.get("to"), - "value": obj.get("value"), - "gas": obj.get("gas"), - "gas_used": obj.get("gas_used"), - "input": obj.get("input"), - "output": obj.get("output"), - "sub_traces": obj.get("sub_traces"), - "trace_address": obj.get("trace_address"), - "trace_type": obj.get("trace_type"), - "call_type": obj.get("call_type"), - "trace_id": obj.get("trace_id"), - "status": obj.get("status"), - "block_hash": obj.get("block_hash"), - "block_number": obj.get("block_number"), - "transaction_hash": obj.get("transaction_hash"), - "transaction_index": obj.get("transaction_index"), - } - ) + _obj = cls.model_validate({ + "error": obj.get("error"), + "type": obj.get("type"), + "from": obj.get("from"), + "to": obj.get("to"), + "value": obj.get("value"), + "gas": obj.get("gas"), + "gas_used": obj.get("gas_used"), + "input": obj.get("input"), + "output": obj.get("output"), + "sub_traces": obj.get("sub_traces"), + "trace_address": obj.get("trace_address"), + "trace_type": obj.get("trace_type"), + "call_type": obj.get("call_type"), + "trace_id": obj.get("trace_id"), + "status": obj.get("status"), + "block_hash": obj.get("block_hash"), + "block_number": obj.get("block_number"), + "transaction_hash": obj.get("transaction_hash"), + "transaction_index": obj.get("transaction_index") + }) return _obj + + diff --git a/cdp/client/models/ethereum_validator_metadata.py b/cdp/client/models/ethereum_validator_metadata.py index bd4a238..43d72ec 100644 --- a/cdp/client/models/ethereum_validator_metadata.py +++ b/cdp/client/models/ethereum_validator_metadata.py @@ -1,57 +1,42 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 -import json + +from __future__ import annotations import pprint import re # noqa: F401 -from typing import Any, ClassVar +import json from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr -from typing_extensions import Self - +from typing import Any, ClassVar, Dict, List from cdp.client.models.balance import Balance - +from typing import Optional, Set +from typing_extensions import Self class EthereumValidatorMetadata(BaseModel): - """An Ethereum validator.""" - + """ + An Ethereum validator. + """ # noqa: E501 index: StrictStr = Field(description="The index of the validator in the validator set.") public_key: StrictStr = Field(description="The public key of the validator.") - withdrawal_address: StrictStr = Field( - description="The address to which the validator's rewards are sent." - ) + withdrawal_address: StrictStr = Field(description="The address to which the validator's rewards are sent.") slashed: StrictBool = Field(description="Whether the validator has been slashed.") - activation_epoch: StrictStr = Field( - description="The epoch at which the validator was activated.", alias="activationEpoch" - ) - exit_epoch: StrictStr = Field( - description="The epoch at which the validator exited.", alias="exitEpoch" - ) - withdrawable_epoch: StrictStr = Field( - description="The epoch at which the validator can withdraw.", alias="withdrawableEpoch" - ) + activation_epoch: StrictStr = Field(description="The epoch at which the validator was activated.", alias="activationEpoch") + exit_epoch: StrictStr = Field(description="The epoch at which the validator exited.", alias="exitEpoch") + withdrawable_epoch: StrictStr = Field(description="The epoch at which the validator can withdraw.", alias="withdrawableEpoch") balance: Balance effective_balance: Balance - __properties: ClassVar[list[str]] = [ - "index", - "public_key", - "withdrawal_address", - "slashed", - "activationEpoch", - "exitEpoch", - "withdrawableEpoch", - "balance", - "effective_balance", - ] + __properties: ClassVar[List[str]] = ["index", "public_key", "withdrawal_address", "slashed", "activationEpoch", "exitEpoch", "withdrawableEpoch", "balance", "effective_balance"] model_config = ConfigDict( populate_by_name=True, @@ -59,6 +44,7 @@ class EthereumValidatorMetadata(BaseModel): protected_namespaces=(), ) + def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True)) @@ -69,11 +55,11 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self | None: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of EthereumValidatorMetadata from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self) -> dict[str, Any]: + def to_dict(self) -> Dict[str, Any]: """Return the dictionary representation of the model using alias. This has the following differences from calling pydantic's @@ -83,7 +69,8 @@ def to_dict(self) -> dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ - excluded_fields: set[str] = set([]) + excluded_fields: Set[str] = set([ + ]) _dict = self.model_dump( by_alias=True, @@ -92,14 +79,14 @@ def to_dict(self) -> dict[str, Any]: ) # override the default output from pydantic by calling `to_dict()` of balance if self.balance: - _dict["balance"] = self.balance.to_dict() + _dict['balance'] = self.balance.to_dict() # override the default output from pydantic by calling `to_dict()` of effective_balance if self.effective_balance: - _dict["effective_balance"] = self.effective_balance.to_dict() + _dict['effective_balance'] = self.effective_balance.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of EthereumValidatorMetadata from a dict""" if obj is None: return None @@ -107,21 +94,17 @@ def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate( - { - "index": obj.get("index"), - "public_key": obj.get("public_key"), - "withdrawal_address": obj.get("withdrawal_address"), - "slashed": obj.get("slashed"), - "activationEpoch": obj.get("activationEpoch"), - "exitEpoch": obj.get("exitEpoch"), - "withdrawableEpoch": obj.get("withdrawableEpoch"), - "balance": Balance.from_dict(obj["balance"]) - if obj.get("balance") is not None - else None, - "effective_balance": Balance.from_dict(obj["effective_balance"]) - if obj.get("effective_balance") is not None - else None, - } - ) + _obj = cls.model_validate({ + "index": obj.get("index"), + "public_key": obj.get("public_key"), + "withdrawal_address": obj.get("withdrawal_address"), + "slashed": obj.get("slashed"), + "activationEpoch": obj.get("activationEpoch"), + "exitEpoch": obj.get("exitEpoch"), + "withdrawableEpoch": obj.get("withdrawableEpoch"), + "balance": Balance.from_dict(obj["balance"]) if obj.get("balance") is not None else None, + "effective_balance": Balance.from_dict(obj["effective_balance"]) if obj.get("effective_balance") is not None else None + }) return _obj + + diff --git a/cdp/client/models/faucet_transaction.py b/cdp/client/models/faucet_transaction.py index 1f83dd4..cfad1a9 100644 --- a/cdp/client/models/faucet_transaction.py +++ b/cdp/client/models/faucet_transaction.py @@ -1,34 +1,34 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 -import json + +from __future__ import annotations import pprint import re # noqa: F401 -from typing import Any, ClassVar +import json from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set from typing_extensions import Self - class FaucetTransaction(BaseModel): - """The faucet transaction""" - - transaction_hash: StrictStr = Field( - description="The transaction hash of the transaction the faucet created." - ) - transaction_link: StrictStr = Field( - description="Link to the transaction on the blockchain explorer." - ) - __properties: ClassVar[list[str]] = ["transaction_hash", "transaction_link"] + """ + The faucet transaction + """ # noqa: E501 + transaction_hash: StrictStr = Field(description="The transaction hash of the transaction the faucet created.") + transaction_link: StrictStr = Field(description="Link to the transaction on the blockchain explorer.") + __properties: ClassVar[List[str]] = ["transaction_hash", "transaction_link"] model_config = ConfigDict( populate_by_name=True, @@ -36,6 +36,7 @@ class FaucetTransaction(BaseModel): protected_namespaces=(), ) + def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True)) @@ -46,11 +47,11 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self | None: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of FaucetTransaction from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self) -> dict[str, Any]: + def to_dict(self) -> Dict[str, Any]: """Return the dictionary representation of the model using alias. This has the following differences from calling pydantic's @@ -60,7 +61,8 @@ def to_dict(self) -> dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ - excluded_fields: set[str] = set([]) + excluded_fields: Set[str] = set([ + ]) _dict = self.model_dump( by_alias=True, @@ -70,7 +72,7 @@ def to_dict(self) -> dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of FaucetTransaction from a dict""" if obj is None: return None @@ -78,10 +80,10 @@ def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate( - { - "transaction_hash": obj.get("transaction_hash"), - "transaction_link": obj.get("transaction_link"), - } - ) + _obj = cls.model_validate({ + "transaction_hash": obj.get("transaction_hash"), + "transaction_link": obj.get("transaction_link") + }) return _obj + + diff --git a/cdp/client/models/feature_set.py b/cdp/client/models/feature_set.py index 38b5593..0c159a1 100644 --- a/cdp/client/models/feature_set.py +++ b/cdp/client/models/feature_set.py @@ -1,41 +1,38 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 -import json + +from __future__ import annotations import pprint import re # noqa: F401 -from typing import Any, ClassVar +import json from pydantic import BaseModel, ConfigDict, Field, StrictBool +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set from typing_extensions import Self - class FeatureSet(BaseModel): - """FeatureSet""" - + """ + FeatureSet + """ # noqa: E501 faucet: StrictBool = Field(description="Whether the network supports a faucet") server_signer: StrictBool = Field(description="Whether the network supports Server-Signers") transfer: StrictBool = Field(description="Whether the network supports transfers") trade: StrictBool = Field(description="Whether the network supports trading") stake: StrictBool = Field(description="Whether the network supports staking") gasless_send: StrictBool = Field(description="Whether the network supports gasless sends") - __properties: ClassVar[list[str]] = [ - "faucet", - "server_signer", - "transfer", - "trade", - "stake", - "gasless_send", - ] + __properties: ClassVar[List[str]] = ["faucet", "server_signer", "transfer", "trade", "stake", "gasless_send"] model_config = ConfigDict( populate_by_name=True, @@ -43,6 +40,7 @@ class FeatureSet(BaseModel): protected_namespaces=(), ) + def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True)) @@ -53,11 +51,11 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self | None: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of FeatureSet from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self) -> dict[str, Any]: + def to_dict(self) -> Dict[str, Any]: """Return the dictionary representation of the model using alias. This has the following differences from calling pydantic's @@ -67,7 +65,8 @@ def to_dict(self) -> dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ - excluded_fields: set[str] = set([]) + excluded_fields: Set[str] = set([ + ]) _dict = self.model_dump( by_alias=True, @@ -77,7 +76,7 @@ def to_dict(self) -> dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of FeatureSet from a dict""" if obj is None: return None @@ -85,14 +84,14 @@ def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate( - { - "faucet": obj.get("faucet"), - "server_signer": obj.get("server_signer"), - "transfer": obj.get("transfer"), - "trade": obj.get("trade"), - "stake": obj.get("stake"), - "gasless_send": obj.get("gasless_send"), - } - ) + _obj = cls.model_validate({ + "faucet": obj.get("faucet"), + "server_signer": obj.get("server_signer"), + "transfer": obj.get("transfer"), + "trade": obj.get("trade"), + "stake": obj.get("stake"), + "gasless_send": obj.get("gasless_send") + }) return _obj + + diff --git a/cdp/client/models/fetch_historical_staking_balances200_response.py b/cdp/client/models/fetch_historical_staking_balances200_response.py index 0bcb86a..8fef137 100644 --- a/cdp/client/models/fetch_historical_staking_balances200_response.py +++ b/cdp/client/models/fetch_historical_staking_balances200_response.py @@ -1,35 +1,36 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 -import json + +from __future__ import annotations import pprint import re # noqa: F401 -from typing import Any, ClassVar +import json from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr -from typing_extensions import Self - +from typing import Any, ClassVar, Dict, List from cdp.client.models.staking_balance import StakingBalance - +from typing import Optional, Set +from typing_extensions import Self class FetchHistoricalStakingBalances200Response(BaseModel): - """ """ - - data: list[StakingBalance] - has_more: StrictBool = Field( - description="True if this list has another page of items after this one that can be fetched." - ) + """ + + """ # noqa: E501 + data: List[StakingBalance] + has_more: StrictBool = Field(description="True if this list has another page of items after this one that can be fetched.") next_page: StrictStr = Field(description="The page token to be used to fetch the next page.") - __properties: ClassVar[list[str]] = ["data", "has_more", "next_page"] + __properties: ClassVar[List[str]] = ["data", "has_more", "next_page"] model_config = ConfigDict( populate_by_name=True, @@ -37,6 +38,7 @@ class FetchHistoricalStakingBalances200Response(BaseModel): protected_namespaces=(), ) + def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True)) @@ -47,11 +49,11 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self | None: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of FetchHistoricalStakingBalances200Response from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self) -> dict[str, Any]: + def to_dict(self) -> Dict[str, Any]: """Return the dictionary representation of the model using alias. This has the following differences from calling pydantic's @@ -61,7 +63,8 @@ def to_dict(self) -> dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ - excluded_fields: set[str] = set([]) + excluded_fields: Set[str] = set([ + ]) _dict = self.model_dump( by_alias=True, @@ -74,11 +77,11 @@ def to_dict(self) -> dict[str, Any]: for _item_data in self.data: if _item_data: _items.append(_item_data.to_dict()) - _dict["data"] = _items + _dict['data'] = _items return _dict @classmethod - def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of FetchHistoricalStakingBalances200Response from a dict""" if obj is None: return None @@ -86,13 +89,11 @@ def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate( - { - "data": [StakingBalance.from_dict(_item) for _item in obj["data"]] - if obj.get("data") is not None - else None, - "has_more": obj.get("has_more"), - "next_page": obj.get("next_page"), - } - ) + _obj = cls.model_validate({ + "data": [StakingBalance.from_dict(_item) for _item in obj["data"]] if obj.get("data") is not None else None, + "has_more": obj.get("has_more"), + "next_page": obj.get("next_page") + }) return _obj + + diff --git a/cdp/client/models/fetch_staking_rewards200_response.py b/cdp/client/models/fetch_staking_rewards200_response.py index a395b5f..53feb0c 100644 --- a/cdp/client/models/fetch_staking_rewards200_response.py +++ b/cdp/client/models/fetch_staking_rewards200_response.py @@ -1,35 +1,36 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 -import json + +from __future__ import annotations import pprint import re # noqa: F401 -from typing import Any, ClassVar +import json from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr -from typing_extensions import Self - +from typing import Any, ClassVar, Dict, List from cdp.client.models.staking_reward import StakingReward - +from typing import Optional, Set +from typing_extensions import Self class FetchStakingRewards200Response(BaseModel): - """ """ - - data: list[StakingReward] - has_more: StrictBool = Field( - description="True if this list has another page of items after this one that can be fetched." - ) + """ + + """ # noqa: E501 + data: List[StakingReward] + has_more: StrictBool = Field(description="True if this list has another page of items after this one that can be fetched.") next_page: StrictStr = Field(description="The page token to be used to fetch the next page.") - __properties: ClassVar[list[str]] = ["data", "has_more", "next_page"] + __properties: ClassVar[List[str]] = ["data", "has_more", "next_page"] model_config = ConfigDict( populate_by_name=True, @@ -37,6 +38,7 @@ class FetchStakingRewards200Response(BaseModel): protected_namespaces=(), ) + def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True)) @@ -47,11 +49,11 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self | None: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of FetchStakingRewards200Response from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self) -> dict[str, Any]: + def to_dict(self) -> Dict[str, Any]: """Return the dictionary representation of the model using alias. This has the following differences from calling pydantic's @@ -61,7 +63,8 @@ def to_dict(self) -> dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ - excluded_fields: set[str] = set([]) + excluded_fields: Set[str] = set([ + ]) _dict = self.model_dump( by_alias=True, @@ -74,11 +77,11 @@ def to_dict(self) -> dict[str, Any]: for _item_data in self.data: if _item_data: _items.append(_item_data.to_dict()) - _dict["data"] = _items + _dict['data'] = _items return _dict @classmethod - def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of FetchStakingRewards200Response from a dict""" if obj is None: return None @@ -86,13 +89,11 @@ def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate( - { - "data": [StakingReward.from_dict(_item) for _item in obj["data"]] - if obj.get("data") is not None - else None, - "has_more": obj.get("has_more"), - "next_page": obj.get("next_page"), - } - ) + _obj = cls.model_validate({ + "data": [StakingReward.from_dict(_item) for _item in obj["data"]] if obj.get("data") is not None else None, + "has_more": obj.get("has_more"), + "next_page": obj.get("next_page") + }) return _obj + + diff --git a/cdp/client/models/fetch_staking_rewards_request.py b/cdp/client/models/fetch_staking_rewards_request.py index e8738e3..04b47a7 100644 --- a/cdp/client/models/fetch_staking_rewards_request.py +++ b/cdp/client/models/fetch_staking_rewards_request.py @@ -1,48 +1,40 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 -import json + +from __future__ import annotations import pprint import re # noqa: F401 -from datetime import datetime -from typing import Any, ClassVar +import json +from datetime import datetime from pydantic import BaseModel, ConfigDict, Field, StrictStr -from typing_extensions import Self - +from typing import Any, ClassVar, Dict, List from cdp.client.models.staking_reward_format import StakingRewardFormat - +from typing import Optional, Set +from typing_extensions import Self class FetchStakingRewardsRequest(BaseModel): - """FetchStakingRewardsRequest""" - + """ + FetchStakingRewardsRequest + """ # noqa: E501 network_id: StrictStr = Field(description="The ID of the blockchain network") - asset_id: StrictStr = Field( - description="The ID of the asset for which the staking rewards are being fetched" - ) - address_ids: list[StrictStr] = Field( - description="The onchain addresses for which the staking rewards are being fetched" - ) + asset_id: StrictStr = Field(description="The ID of the asset for which the staking rewards are being fetched") + address_ids: List[StrictStr] = Field(description="The onchain addresses for which the staking rewards are being fetched") start_time: datetime = Field(description="The start time of this reward period") end_time: datetime = Field(description="The end time of this reward period") format: StakingRewardFormat - __properties: ClassVar[list[str]] = [ - "network_id", - "asset_id", - "address_ids", - "start_time", - "end_time", - "format", - ] + __properties: ClassVar[List[str]] = ["network_id", "asset_id", "address_ids", "start_time", "end_time", "format"] model_config = ConfigDict( populate_by_name=True, @@ -50,6 +42,7 @@ class FetchStakingRewardsRequest(BaseModel): protected_namespaces=(), ) + def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True)) @@ -60,11 +53,11 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self | None: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of FetchStakingRewardsRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self) -> dict[str, Any]: + def to_dict(self) -> Dict[str, Any]: """Return the dictionary representation of the model using alias. This has the following differences from calling pydantic's @@ -74,7 +67,8 @@ def to_dict(self) -> dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ - excluded_fields: set[str] = set([]) + excluded_fields: Set[str] = set([ + ]) _dict = self.model_dump( by_alias=True, @@ -84,7 +78,7 @@ def to_dict(self) -> dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of FetchStakingRewardsRequest from a dict""" if obj is None: return None @@ -92,16 +86,14 @@ def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate( - { - "network_id": obj.get("network_id"), - "asset_id": obj.get("asset_id"), - "address_ids": obj.get("address_ids"), - "start_time": obj.get("start_time"), - "end_time": obj.get("end_time"), - "format": obj.get("format") - if obj.get("format") is not None - else StakingRewardFormat.USD, - } - ) + _obj = cls.model_validate({ + "network_id": obj.get("network_id"), + "asset_id": obj.get("asset_id"), + "address_ids": obj.get("address_ids"), + "start_time": obj.get("start_time"), + "end_time": obj.get("end_time"), + "format": obj.get("format") if obj.get("format") is not None else StakingRewardFormat.USD + }) return _obj + + diff --git a/cdp/client/models/get_staking_context_request.py b/cdp/client/models/get_staking_context_request.py index aeaf0bd..c2918e6 100644 --- a/cdp/client/models/get_staking_context_request.py +++ b/cdp/client/models/get_staking_context_request.py @@ -1,34 +1,36 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 -import json + +from __future__ import annotations import pprint import re # noqa: F401 -from typing import Any, ClassVar +import json from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set from typing_extensions import Self - class GetStakingContextRequest(BaseModel): - """GetStakingContextRequest""" - + """ + GetStakingContextRequest + """ # noqa: E501 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] - __properties: ClassVar[list[str]] = ["network_id", "asset_id", "address_id", "options"] + address_id: StrictStr = Field(description="The onchain address for which the staking context is being fetched") + options: Dict[str, StrictStr] + __properties: ClassVar[List[str]] = ["network_id", "asset_id", "address_id", "options"] model_config = ConfigDict( populate_by_name=True, @@ -36,6 +38,7 @@ class GetStakingContextRequest(BaseModel): protected_namespaces=(), ) + def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True)) @@ -46,11 +49,11 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self | None: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of GetStakingContextRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self) -> dict[str, Any]: + def to_dict(self) -> Dict[str, Any]: """Return the dictionary representation of the model using alias. This has the following differences from calling pydantic's @@ -60,7 +63,8 @@ def to_dict(self) -> dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ - excluded_fields: set[str] = set([]) + excluded_fields: Set[str] = set([ + ]) _dict = self.model_dump( by_alias=True, @@ -70,7 +74,7 @@ def to_dict(self) -> dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of GetStakingContextRequest from a dict""" if obj is None: return None @@ -78,12 +82,12 @@ def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate( - { - "network_id": obj.get("network_id"), - "asset_id": obj.get("asset_id"), - "address_id": obj.get("address_id"), - "options": obj.get("options"), - } - ) + _obj = cls.model_validate({ + "network_id": obj.get("network_id"), + "asset_id": obj.get("asset_id"), + "address_id": obj.get("address_id"), + "options": obj.get("options") + }) return _obj + + diff --git a/cdp/client/models/historical_balance.py b/cdp/client/models/historical_balance.py index f15c35c..48c43f5 100644 --- a/cdp/client/models/historical_balance.py +++ b/cdp/client/models/historical_balance.py @@ -1,38 +1,37 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 -import json + +from __future__ import annotations import pprint import re # noqa: F401 -from typing import Any, ClassVar +import json from pydantic import BaseModel, ConfigDict, Field, StrictStr -from typing_extensions import Self - +from typing import Any, ClassVar, Dict, List from cdp.client.models.asset import Asset - +from typing import Optional, Set +from typing_extensions import Self class HistoricalBalance(BaseModel): - """The balance of an asset onchain at a particular block""" - + """ + The balance of an asset onchain at a particular block + """ # noqa: E501 amount: StrictStr = Field(description="The amount in the atomic units of the asset") - block_hash: StrictStr = Field( - description="The hash of the block at which the balance was recorded" - ) - block_height: StrictStr = Field( - description="The block height at which the balance was recorded" - ) + block_hash: StrictStr = Field(description="The hash of the block at which the balance was recorded") + block_height: StrictStr = Field(description="The block height at which the balance was recorded") asset: Asset - __properties: ClassVar[list[str]] = ["amount", "block_hash", "block_height", "asset"] + __properties: ClassVar[List[str]] = ["amount", "block_hash", "block_height", "asset"] model_config = ConfigDict( populate_by_name=True, @@ -40,6 +39,7 @@ class HistoricalBalance(BaseModel): protected_namespaces=(), ) + def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True)) @@ -50,11 +50,11 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self | None: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of HistoricalBalance from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self) -> dict[str, Any]: + def to_dict(self) -> Dict[str, Any]: """Return the dictionary representation of the model using alias. This has the following differences from calling pydantic's @@ -64,7 +64,8 @@ def to_dict(self) -> dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ - excluded_fields: set[str] = set([]) + excluded_fields: Set[str] = set([ + ]) _dict = self.model_dump( by_alias=True, @@ -73,11 +74,11 @@ def to_dict(self) -> dict[str, Any]: ) # override the default output from pydantic by calling `to_dict()` of asset if self.asset: - _dict["asset"] = self.asset.to_dict() + _dict['asset'] = self.asset.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of HistoricalBalance from a dict""" if obj is None: return None @@ -85,12 +86,12 @@ def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate( - { - "amount": obj.get("amount"), - "block_hash": obj.get("block_hash"), - "block_height": obj.get("block_height"), - "asset": Asset.from_dict(obj["asset"]) if obj.get("asset") is not None else None, - } - ) + _obj = cls.model_validate({ + "amount": obj.get("amount"), + "block_hash": obj.get("block_hash"), + "block_height": obj.get("block_height"), + "asset": Asset.from_dict(obj["asset"]) if obj.get("asset") is not None else None + }) return _obj + + diff --git a/cdp/client/models/multi_token_contract_options.py b/cdp/client/models/multi_token_contract_options.py new file mode 100644 index 0000000..de9dff7 --- /dev/null +++ b/cdp/client/models/multi_token_contract_options.py @@ -0,0 +1,87 @@ +# 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 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class MultiTokenContractOptions(BaseModel): + """ + Options for multi-token contract creation + """ # noqa: E501 + uri: StrictStr = Field(description="The URI for all token metadata") + __properties: ClassVar[List[str]] = ["uri"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MultiTokenContractOptions from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MultiTokenContractOptions from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "uri": obj.get("uri") + }) + return _obj + + diff --git a/cdp/client/models/network.py b/cdp/client/models/network.py index 550bab9..5b5e4d4 100644 --- a/cdp/client/models/network.py +++ b/cdp/client/models/network.py @@ -1,31 +1,34 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 -import json + +from __future__ import annotations import pprint import re # noqa: F401 -from typing import Any, ClassVar +import json from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr, field_validator -from typing_extensions import Self - +from typing import Any, ClassVar, Dict, List, Optional from cdp.client.models.asset import Asset from cdp.client.models.feature_set import FeatureSet from cdp.client.models.network_identifier import NetworkIdentifier - +from typing import Optional, Set +from typing_extensions import Self class Network(BaseModel): - """Network""" - + """ + Network + """ # noqa: E501 id: NetworkIdentifier display_name: StrictStr = Field(description="The human-readable name of the blockchain network") chain_id: StrictInt = Field(description="The chain ID of the blockchain network") @@ -33,24 +36,13 @@ class Network(BaseModel): is_testnet: StrictBool = Field(description="Whether the network is a testnet or not") native_asset: Asset feature_set: FeatureSet - address_path_prefix: StrictStr | None = Field( - default=None, description="The BIP44 path prefix for the network" - ) - __properties: ClassVar[list[str]] = [ - "id", - "display_name", - "chain_id", - "protocol_family", - "is_testnet", - "native_asset", - "feature_set", - "address_path_prefix", - ] - - @field_validator("protocol_family") + address_path_prefix: Optional[StrictStr] = Field(default=None, description="The BIP44 path prefix for the network") + __properties: ClassVar[List[str]] = ["id", "display_name", "chain_id", "protocol_family", "is_testnet", "native_asset", "feature_set", "address_path_prefix"] + + @field_validator('protocol_family') def protocol_family_validate_enum(cls, value): """Validates the enum""" - if value not in set(["evm", "solana"]): + if value not in set(['evm', 'solana']): raise ValueError("must be one of enum values ('evm', 'solana')") return value @@ -60,6 +52,7 @@ def protocol_family_validate_enum(cls, value): protected_namespaces=(), ) + def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True)) @@ -70,11 +63,11 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self | None: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Network from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self) -> dict[str, Any]: + def to_dict(self) -> Dict[str, Any]: """Return the dictionary representation of the model using alias. This has the following differences from calling pydantic's @@ -84,7 +77,8 @@ def to_dict(self) -> dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ - excluded_fields: set[str] = set([]) + excluded_fields: Set[str] = set([ + ]) _dict = self.model_dump( by_alias=True, @@ -93,14 +87,14 @@ def to_dict(self) -> dict[str, Any]: ) # override the default output from pydantic by calling `to_dict()` of native_asset if self.native_asset: - _dict["native_asset"] = self.native_asset.to_dict() + _dict['native_asset'] = self.native_asset.to_dict() # override the default output from pydantic by calling `to_dict()` of feature_set if self.feature_set: - _dict["feature_set"] = self.feature_set.to_dict() + _dict['feature_set'] = self.feature_set.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of Network from a dict""" if obj is None: return None @@ -108,20 +102,16 @@ def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate( - { - "id": obj.get("id"), - "display_name": obj.get("display_name"), - "chain_id": obj.get("chain_id"), - "protocol_family": obj.get("protocol_family"), - "is_testnet": obj.get("is_testnet"), - "native_asset": Asset.from_dict(obj["native_asset"]) - if obj.get("native_asset") is not None - else None, - "feature_set": FeatureSet.from_dict(obj["feature_set"]) - if obj.get("feature_set") is not None - else None, - "address_path_prefix": obj.get("address_path_prefix"), - } - ) + _obj = cls.model_validate({ + "id": obj.get("id"), + "display_name": obj.get("display_name"), + "chain_id": obj.get("chain_id"), + "protocol_family": obj.get("protocol_family"), + "is_testnet": obj.get("is_testnet"), + "native_asset": Asset.from_dict(obj["native_asset"]) if obj.get("native_asset") is not None else None, + "feature_set": FeatureSet.from_dict(obj["feature_set"]) if obj.get("feature_set") is not None else None, + "address_path_prefix": obj.get("address_path_prefix") + }) return _obj + + diff --git a/cdp/client/models/network_identifier.py b/cdp/client/models/network_identifier.py index 51b106e..7d3a547 100644 --- a/cdp/client/models/network_identifier.py +++ b/cdp/client/models/network_identifier.py @@ -1,37 +1,43 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 + +from __future__ import annotations import json from enum import Enum - from typing_extensions import Self class NetworkIdentifier(str, Enum): - """The ID of the blockchain network. This is unique across all networks, and takes the form of `-`.""" + """ + The ID of the blockchain network. This is unique across all networks, and takes the form of `-`. + """ """ allowed enum values """ - BASE_MINUS_SEPOLIA = "base-sepolia" - BASE_MINUS_MAINNET = "base-mainnet" - ETHEREUM_MINUS_HOLESKY = "ethereum-holesky" - ETHEREUM_MINUS_MAINNET = "ethereum-mainnet" - POLYGON_MINUS_MAINNET = "polygon-mainnet" - SOLANA_MINUS_DEVNET = "solana-devnet" - SOLANA_MINUS_MAINNET = "solana-mainnet" - ARBITRUM_MINUS_MAINNET = "arbitrum-mainnet" + BASE_MINUS_SEPOLIA = 'base-sepolia' + BASE_MINUS_MAINNET = 'base-mainnet' + ETHEREUM_MINUS_HOLESKY = 'ethereum-holesky' + ETHEREUM_MINUS_MAINNET = 'ethereum-mainnet' + POLYGON_MINUS_MAINNET = 'polygon-mainnet' + SOLANA_MINUS_DEVNET = 'solana-devnet' + SOLANA_MINUS_MAINNET = 'solana-mainnet' + ARBITRUM_MINUS_MAINNET = 'arbitrum-mainnet' @classmethod def from_json(cls, json_str: str) -> Self: """Create an instance of NetworkIdentifier from a JSON string""" return cls(json.loads(json_str)) + + diff --git a/cdp/client/models/nft_contract_options.py b/cdp/client/models/nft_contract_options.py index 38f0252..7f1e350 100644 --- a/cdp/client/models/nft_contract_options.py +++ b/cdp/client/models/nft_contract_options.py @@ -1,30 +1,35 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 -import json + +from __future__ import annotations import pprint import re # noqa: F401 -from typing import Any, ClassVar +import json from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set from typing_extensions import Self - class NFTContractOptions(BaseModel): - """Options for NFT contract creation""" - + """ + Options for NFT contract creation + """ # noqa: E501 name: StrictStr = Field(description="The name of the NFT") symbol: StrictStr = Field(description="The symbol of the NFT") - __properties: ClassVar[list[str]] = ["name", "symbol"] + base_uri: StrictStr = Field(description="The base URI for the NFT metadata") + __properties: ClassVar[List[str]] = ["name", "symbol", "base_uri"] model_config = ConfigDict( populate_by_name=True, @@ -32,6 +37,7 @@ class NFTContractOptions(BaseModel): protected_namespaces=(), ) + def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True)) @@ -42,11 +48,11 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self | None: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of NFTContractOptions from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self) -> dict[str, Any]: + def to_dict(self) -> Dict[str, Any]: """Return the dictionary representation of the model using alias. This has the following differences from calling pydantic's @@ -56,7 +62,8 @@ def to_dict(self) -> dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ - excluded_fields: set[str] = set([]) + excluded_fields: Set[str] = set([ + ]) _dict = self.model_dump( by_alias=True, @@ -66,7 +73,7 @@ def to_dict(self) -> dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of NFTContractOptions from a dict""" if obj is None: return None @@ -74,5 +81,11 @@ def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate({"name": obj.get("name"), "symbol": obj.get("symbol")}) + _obj = cls.model_validate({ + "name": obj.get("name"), + "symbol": obj.get("symbol"), + "base_uri": obj.get("base_uri") + }) return _obj + + diff --git a/cdp/client/models/payload_signature.py b/cdp/client/models/payload_signature.py index 34764b5..a1c9880 100644 --- a/cdp/client/models/payload_signature.py +++ b/cdp/client/models/payload_signature.py @@ -1,48 +1,43 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 -import json + +from __future__ import annotations import pprint import re # noqa: F401 -from typing import Any, ClassVar +import json from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set from typing_extensions import Self - class PayloadSignature(BaseModel): - """A payload signed by an address.""" - + """ + A payload signed by an address. + """ # noqa: E501 payload_signature_id: StrictStr = Field(description="The ID of the payload signature.") wallet_id: StrictStr = Field(description="The ID of the wallet that owns the address.") address_id: StrictStr = Field(description="The onchain address of the signer.") - unsigned_payload: StrictStr = Field( - description="The unsigned payload. This is the payload that needs to be signed by the signer address." - ) - signature: StrictStr | None = Field(default=None, description="The signature of the payload.") + unsigned_payload: StrictStr = Field(description="The unsigned payload. This is the payload that needs to be signed by the signer address.") + signature: Optional[StrictStr] = Field(default=None, description="The signature of the payload.") status: StrictStr = Field(description="The status of the payload signature.") - __properties: ClassVar[list[str]] = [ - "payload_signature_id", - "wallet_id", - "address_id", - "unsigned_payload", - "signature", - "status", - ] - - @field_validator("status") + __properties: ClassVar[List[str]] = ["payload_signature_id", "wallet_id", "address_id", "unsigned_payload", "signature", "status"] + + @field_validator('status') def status_validate_enum(cls, value): """Validates the enum""" - if value not in set(["pending", "signed", "failed"]): + if value not in set(['pending', 'signed', 'failed']): raise ValueError("must be one of enum values ('pending', 'signed', 'failed')") return value @@ -52,6 +47,7 @@ def status_validate_enum(cls, value): protected_namespaces=(), ) + def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True)) @@ -62,11 +58,11 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self | None: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of PayloadSignature from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self) -> dict[str, Any]: + def to_dict(self) -> Dict[str, Any]: """Return the dictionary representation of the model using alias. This has the following differences from calling pydantic's @@ -76,7 +72,8 @@ def to_dict(self) -> dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ - excluded_fields: set[str] = set([]) + excluded_fields: Set[str] = set([ + ]) _dict = self.model_dump( by_alias=True, @@ -86,7 +83,7 @@ def to_dict(self) -> dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of PayloadSignature from a dict""" if obj is None: return None @@ -94,14 +91,14 @@ def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate( - { - "payload_signature_id": obj.get("payload_signature_id"), - "wallet_id": obj.get("wallet_id"), - "address_id": obj.get("address_id"), - "unsigned_payload": obj.get("unsigned_payload"), - "signature": obj.get("signature"), - "status": obj.get("status"), - } - ) + _obj = cls.model_validate({ + "payload_signature_id": obj.get("payload_signature_id"), + "wallet_id": obj.get("wallet_id"), + "address_id": obj.get("address_id"), + "unsigned_payload": obj.get("unsigned_payload"), + "signature": obj.get("signature"), + "status": obj.get("status") + }) return _obj + + diff --git a/cdp/client/models/payload_signature_list.py b/cdp/client/models/payload_signature_list.py index 260cdaa..e9a50d1 100644 --- a/cdp/client/models/payload_signature_list.py +++ b/cdp/client/models/payload_signature_list.py @@ -1,38 +1,37 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 -import json + +from __future__ import annotations import pprint import re # noqa: F401 -from typing import Any, ClassVar +import json from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr -from typing_extensions import Self - +from typing import Any, ClassVar, Dict, List from cdp.client.models.payload_signature import PayloadSignature - +from typing import Optional, Set +from typing_extensions import Self class PayloadSignatureList(BaseModel): - """ """ - - data: list[PayloadSignature] - has_more: StrictBool = Field( - description="True if this list has another page of items after this one that can be fetched." - ) + """ + + """ # noqa: E501 + data: List[PayloadSignature] + has_more: StrictBool = Field(description="True if this list has another page of items after this one that can be fetched.") next_page: StrictStr = Field(description="The page token to be used to fetch the next page.") - total_count: StrictInt = Field( - description="The total number of payload signatures for the address." - ) - __properties: ClassVar[list[str]] = ["data", "has_more", "next_page", "total_count"] + total_count: StrictInt = Field(description="The total number of payload signatures for the address.") + __properties: ClassVar[List[str]] = ["data", "has_more", "next_page", "total_count"] model_config = ConfigDict( populate_by_name=True, @@ -40,6 +39,7 @@ class PayloadSignatureList(BaseModel): protected_namespaces=(), ) + def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True)) @@ -50,11 +50,11 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self | None: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of PayloadSignatureList from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self) -> dict[str, Any]: + def to_dict(self) -> Dict[str, Any]: """Return the dictionary representation of the model using alias. This has the following differences from calling pydantic's @@ -64,7 +64,8 @@ def to_dict(self) -> dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ - excluded_fields: set[str] = set([]) + excluded_fields: Set[str] = set([ + ]) _dict = self.model_dump( by_alias=True, @@ -77,11 +78,11 @@ def to_dict(self) -> dict[str, Any]: for _item_data in self.data: if _item_data: _items.append(_item_data.to_dict()) - _dict["data"] = _items + _dict['data'] = _items return _dict @classmethod - def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of PayloadSignatureList from a dict""" if obj is None: return None @@ -89,14 +90,12 @@ def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate( - { - "data": [PayloadSignature.from_dict(_item) for _item in obj["data"]] - if obj.get("data") is not None - else None, - "has_more": obj.get("has_more"), - "next_page": obj.get("next_page"), - "total_count": obj.get("total_count"), - } - ) + _obj = cls.model_validate({ + "data": [PayloadSignature.from_dict(_item) for _item in obj["data"]] if obj.get("data") is not None else None, + "has_more": obj.get("has_more"), + "next_page": obj.get("next_page"), + "total_count": obj.get("total_count") + }) return _obj + + diff --git a/cdp/client/models/seed_creation_event.py b/cdp/client/models/seed_creation_event.py index cf79f64..6b47e39 100644 --- a/cdp/client/models/seed_creation_event.py +++ b/cdp/client/models/seed_creation_event.py @@ -1,32 +1,34 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 -import json + +from __future__ import annotations import pprint import re # noqa: F401 -from typing import Any, ClassVar +import json from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set from typing_extensions import Self - class SeedCreationEvent(BaseModel): - """An event representing a seed creation.""" - - wallet_id: StrictStr = Field( - description="The ID of the wallet that the server-signer should create the seed for" - ) + """ + An event representing a seed creation. + """ # noqa: E501 + wallet_id: StrictStr = Field(description="The ID of the wallet that the server-signer should create the seed for") wallet_user_id: StrictStr = Field(description="The ID of the user that the wallet belongs to") - __properties: ClassVar[list[str]] = ["wallet_id", "wallet_user_id"] + __properties: ClassVar[List[str]] = ["wallet_id", "wallet_user_id"] model_config = ConfigDict( populate_by_name=True, @@ -34,6 +36,7 @@ class SeedCreationEvent(BaseModel): protected_namespaces=(), ) + def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True)) @@ -44,11 +47,11 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self | None: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of SeedCreationEvent from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self) -> dict[str, Any]: + def to_dict(self) -> Dict[str, Any]: """Return the dictionary representation of the model using alias. This has the following differences from calling pydantic's @@ -58,7 +61,8 @@ def to_dict(self) -> dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ - excluded_fields: set[str] = set([]) + excluded_fields: Set[str] = set([ + ]) _dict = self.model_dump( by_alias=True, @@ -68,7 +72,7 @@ def to_dict(self) -> dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of SeedCreationEvent from a dict""" if obj is None: return None @@ -76,7 +80,10 @@ def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate( - {"wallet_id": obj.get("wallet_id"), "wallet_user_id": obj.get("wallet_user_id")} - ) + _obj = cls.model_validate({ + "wallet_id": obj.get("wallet_id"), + "wallet_user_id": obj.get("wallet_user_id") + }) return _obj + + diff --git a/cdp/client/models/seed_creation_event_result.py b/cdp/client/models/seed_creation_event_result.py index 497a8e0..1939bd6 100644 --- a/cdp/client/models/seed_creation_event_result.py +++ b/cdp/client/models/seed_creation_event_result.py @@ -1,41 +1,36 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 -import json + +from __future__ import annotations import pprint import re # noqa: F401 -from typing import Any, ClassVar +import json from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set from typing_extensions import Self - class SeedCreationEventResult(BaseModel): - """The result to a SeedCreationEvent.""" - + """ + The result to a SeedCreationEvent. + """ # noqa: E501 wallet_id: StrictStr = Field(description="The ID of the wallet that the seed was created for") wallet_user_id: StrictStr = Field(description="The ID of the user that the wallet belongs to") - extended_public_key: StrictStr = Field( - description="The extended public key for the first master key derived from seed." - ) - seed_id: StrictStr = Field( - description="The ID of the seed in Server-Signer used to generate the extended public key." - ) - __properties: ClassVar[list[str]] = [ - "wallet_id", - "wallet_user_id", - "extended_public_key", - "seed_id", - ] + extended_public_key: StrictStr = Field(description="The extended public key for the first master key derived from seed.") + seed_id: StrictStr = Field(description="The ID of the seed in Server-Signer used to generate the extended public key.") + __properties: ClassVar[List[str]] = ["wallet_id", "wallet_user_id", "extended_public_key", "seed_id"] model_config = ConfigDict( populate_by_name=True, @@ -43,6 +38,7 @@ class SeedCreationEventResult(BaseModel): protected_namespaces=(), ) + def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True)) @@ -53,11 +49,11 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self | None: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of SeedCreationEventResult from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self) -> dict[str, Any]: + def to_dict(self) -> Dict[str, Any]: """Return the dictionary representation of the model using alias. This has the following differences from calling pydantic's @@ -67,7 +63,8 @@ def to_dict(self) -> dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ - excluded_fields: set[str] = set([]) + excluded_fields: Set[str] = set([ + ]) _dict = self.model_dump( by_alias=True, @@ -77,7 +74,7 @@ def to_dict(self) -> dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of SeedCreationEventResult from a dict""" if obj is None: return None @@ -85,12 +82,12 @@ def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate( - { - "wallet_id": obj.get("wallet_id"), - "wallet_user_id": obj.get("wallet_user_id"), - "extended_public_key": obj.get("extended_public_key"), - "seed_id": obj.get("seed_id"), - } - ) + _obj = cls.model_validate({ + "wallet_id": obj.get("wallet_id"), + "wallet_user_id": obj.get("wallet_user_id"), + "extended_public_key": obj.get("extended_public_key"), + "seed_id": obj.get("seed_id") + }) return _obj + + diff --git a/cdp/client/models/server_signer.py b/cdp/client/models/server_signer.py index bbdcbb8..ef9ce70 100644 --- a/cdp/client/models/server_signer.py +++ b/cdp/client/models/server_signer.py @@ -1,33 +1,35 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 -import json + +from __future__ import annotations import pprint import re # noqa: F401 -from typing import Any, ClassVar +import json from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set from typing_extensions import Self - class ServerSigner(BaseModel): - """A Server-Signer assigned to sign transactions in a wallet.""" - + """ + A Server-Signer assigned to sign transactions in a wallet. + """ # noqa: E501 server_signer_id: StrictStr = Field(description="The ID of the server-signer") - wallets: list[StrictStr] | None = Field( - default=None, description="The IDs of the wallets that the server-signer can sign for" - ) + wallets: Optional[List[StrictStr]] = Field(default=None, description="The IDs of the wallets that the server-signer can sign for") is_mpc: StrictBool = Field(description="Whether the Server-Signer uses MPC.") - __properties: ClassVar[list[str]] = ["server_signer_id", "wallets", "is_mpc"] + __properties: ClassVar[List[str]] = ["server_signer_id", "wallets", "is_mpc"] model_config = ConfigDict( populate_by_name=True, @@ -35,6 +37,7 @@ class ServerSigner(BaseModel): protected_namespaces=(), ) + def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True)) @@ -45,11 +48,11 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self | None: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of ServerSigner from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self) -> dict[str, Any]: + def to_dict(self) -> Dict[str, Any]: """Return the dictionary representation of the model using alias. This has the following differences from calling pydantic's @@ -59,7 +62,8 @@ def to_dict(self) -> dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ - excluded_fields: set[str] = set([]) + excluded_fields: Set[str] = set([ + ]) _dict = self.model_dump( by_alias=True, @@ -69,7 +73,7 @@ def to_dict(self) -> dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of ServerSigner from a dict""" if obj is None: return None @@ -77,11 +81,11 @@ def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate( - { - "server_signer_id": obj.get("server_signer_id"), - "wallets": obj.get("wallets"), - "is_mpc": obj.get("is_mpc"), - } - ) + _obj = cls.model_validate({ + "server_signer_id": obj.get("server_signer_id"), + "wallets": obj.get("wallets"), + "is_mpc": obj.get("is_mpc") + }) return _obj + + diff --git a/cdp/client/models/server_signer_event.py b/cdp/client/models/server_signer_event.py index cedd991..a347b27 100644 --- a/cdp/client/models/server_signer_event.py +++ b/cdp/client/models/server_signer_event.py @@ -1,34 +1,35 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 -import json + +from __future__ import annotations import pprint import re # noqa: F401 -from typing import Any, ClassVar +import json from pydantic import BaseModel, ConfigDict, Field, StrictStr -from typing_extensions import Self - +from typing import Any, ClassVar, Dict, List from cdp.client.models.server_signer_event_event import ServerSignerEventEvent - +from typing import Optional, Set +from typing_extensions import Self class ServerSignerEvent(BaseModel): - """An event that is waiting to be processed by a Server-Signer.""" - - server_signer_id: StrictStr = Field( - description="The ID of the server-signer that the event is for" - ) + """ + An event that is waiting to be processed by a Server-Signer. + """ # noqa: E501 + server_signer_id: StrictStr = Field(description="The ID of the server-signer that the event is for") event: ServerSignerEventEvent - __properties: ClassVar[list[str]] = ["server_signer_id", "event"] + __properties: ClassVar[List[str]] = ["server_signer_id", "event"] model_config = ConfigDict( populate_by_name=True, @@ -36,6 +37,7 @@ class ServerSignerEvent(BaseModel): protected_namespaces=(), ) + def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True)) @@ -46,11 +48,11 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self | None: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of ServerSignerEvent from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self) -> dict[str, Any]: + def to_dict(self) -> Dict[str, Any]: """Return the dictionary representation of the model using alias. This has the following differences from calling pydantic's @@ -60,7 +62,8 @@ def to_dict(self) -> dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ - excluded_fields: set[str] = set([]) + excluded_fields: Set[str] = set([ + ]) _dict = self.model_dump( by_alias=True, @@ -69,11 +72,11 @@ def to_dict(self) -> dict[str, Any]: ) # override the default output from pydantic by calling `to_dict()` of event if self.event: - _dict["event"] = self.event.to_dict() + _dict['event'] = self.event.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of ServerSignerEvent from a dict""" if obj is None: return None @@ -81,12 +84,10 @@ def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate( - { - "server_signer_id": obj.get("server_signer_id"), - "event": ServerSignerEventEvent.from_dict(obj["event"]) - if obj.get("event") is not None - else None, - } - ) + _obj = cls.model_validate({ + "server_signer_id": obj.get("server_signer_id"), + "event": ServerSignerEventEvent.from_dict(obj["event"]) if obj.get("event") is not None else None + }) return _obj + + diff --git a/cdp/client/models/server_signer_event_event.py b/cdp/client/models/server_signer_event_event.py index 9f22102..17908e0 100644 --- a/cdp/client/models/server_signer_event_event.py +++ b/cdp/client/models/server_signer_event_event.py @@ -1,58 +1,58 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 + +from __future__ import annotations import json import pprint -from typing import Any - -from pydantic import BaseModel, ConfigDict, ValidationError, field_validator -from typing_extensions import Self - +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Any, List, Optional from cdp.client.models.seed_creation_event import SeedCreationEvent from cdp.client.models.signature_creation_event import SignatureCreationEvent +from pydantic import StrictStr, Field +from typing import Union, List, Set, Optional, Dict +from typing_extensions import Literal, Self SERVERSIGNEREVENTEVENT_ONE_OF_SCHEMAS = ["SeedCreationEvent", "SignatureCreationEvent"] - class ServerSignerEventEvent(BaseModel): - """ServerSignerEventEvent""" - + """ + ServerSignerEventEvent + """ # data type: SeedCreationEvent - oneof_schema_1_validator: SeedCreationEvent | None = None + oneof_schema_1_validator: Optional[SeedCreationEvent] = None # data type: SignatureCreationEvent - oneof_schema_2_validator: SignatureCreationEvent | None = None - actual_instance: SeedCreationEvent | SignatureCreationEvent | None = None - one_of_schemas: set[str] = {"SeedCreationEvent", "SignatureCreationEvent"} + oneof_schema_2_validator: Optional[SignatureCreationEvent] = None + actual_instance: Optional[Union[SeedCreationEvent, SignatureCreationEvent]] = None + one_of_schemas: Set[str] = { "SeedCreationEvent", "SignatureCreationEvent" } model_config = ConfigDict( validate_assignment=True, protected_namespaces=(), ) + def __init__(self, *args, **kwargs) -> None: if args: if len(args) > 1: - raise ValueError( - "If a position argument is used, only 1 is allowed to set `actual_instance`" - ) + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") if kwargs: - raise ValueError( - "If a position argument is used, keyword arguments cannot be used." - ) + raise ValueError("If a position argument is used, keyword arguments cannot be used.") super().__init__(actual_instance=args[0]) else: super().__init__(**kwargs) - @field_validator("actual_instance") + @field_validator('actual_instance') def actual_instance_must_validate_oneof(cls, v): instance = ServerSignerEventEvent.model_construct() error_messages = [] @@ -69,21 +69,15 @@ def actual_instance_must_validate_oneof(cls, v): match += 1 if match > 1: # more than 1 match - raise ValueError( - "Multiple matches found when setting `actual_instance` in ServerSignerEventEvent with oneOf schemas: SeedCreationEvent, SignatureCreationEvent. Details: " - + ", ".join(error_messages) - ) + raise ValueError("Multiple matches found when setting `actual_instance` in ServerSignerEventEvent with oneOf schemas: SeedCreationEvent, SignatureCreationEvent. Details: " + ", ".join(error_messages)) elif match == 0: # no match - raise ValueError( - "No match found when setting `actual_instance` in ServerSignerEventEvent with oneOf schemas: SeedCreationEvent, SignatureCreationEvent. Details: " - + ", ".join(error_messages) - ) + raise ValueError("No match found when setting `actual_instance` in ServerSignerEventEvent with oneOf schemas: SeedCreationEvent, SignatureCreationEvent. Details: " + ", ".join(error_messages)) else: return v @classmethod - def from_dict(cls, obj: str | dict[str, Any]) -> Self: + def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self: return cls.from_json(json.dumps(obj)) @classmethod @@ -108,16 +102,10 @@ def from_json(cls, json_str: str) -> Self: if match > 1: # more than 1 match - raise ValueError( - "Multiple matches found when deserializing the JSON string into ServerSignerEventEvent with oneOf schemas: SeedCreationEvent, SignatureCreationEvent. Details: " - + ", ".join(error_messages) - ) + raise ValueError("Multiple matches found when deserializing the JSON string into ServerSignerEventEvent with oneOf schemas: SeedCreationEvent, SignatureCreationEvent. Details: " + ", ".join(error_messages)) elif match == 0: # no match - raise ValueError( - "No match found when deserializing the JSON string into ServerSignerEventEvent with oneOf schemas: SeedCreationEvent, SignatureCreationEvent. Details: " - + ", ".join(error_messages) - ) + raise ValueError("No match found when deserializing the JSON string into ServerSignerEventEvent with oneOf schemas: SeedCreationEvent, SignatureCreationEvent. Details: " + ", ".join(error_messages)) else: return instance @@ -131,7 +119,7 @@ def to_json(self) -> str: else: return json.dumps(self.actual_instance) - def to_dict(self) -> dict[str, Any] | SeedCreationEvent | SignatureCreationEvent | None: + def to_dict(self) -> Optional[Union[Dict[str, Any], SeedCreationEvent, SignatureCreationEvent]]: """Returns the dict representation of the actual instance""" if self.actual_instance is None: return None @@ -145,3 +133,5 @@ def to_dict(self) -> dict[str, Any] | SeedCreationEvent | SignatureCreationEvent def to_str(self) -> str: """Returns the string representation of the actual instance""" return pprint.pformat(self.model_dump()) + + diff --git a/cdp/client/models/server_signer_event_list.py b/cdp/client/models/server_signer_event_list.py index e076686..b963b3f 100644 --- a/cdp/client/models/server_signer_event_list.py +++ b/cdp/client/models/server_signer_event_list.py @@ -1,36 +1,37 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 -import json + +from __future__ import annotations import pprint import re # noqa: F401 -from typing import Any, ClassVar +import json from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr -from typing_extensions import Self - +from typing import Any, ClassVar, Dict, List from cdp.client.models.server_signer_event import ServerSignerEvent - +from typing import Optional, Set +from typing_extensions import Self class ServerSignerEventList(BaseModel): - """ """ - - data: list[ServerSignerEvent] - has_more: StrictBool = Field( - description="True if this list has another page of items after this one that can be fetched." - ) + """ + + """ # noqa: E501 + data: List[ServerSignerEvent] + has_more: StrictBool = Field(description="True if this list has another page of items after this one that can be fetched.") next_page: StrictStr = Field(description="The page token to be used to fetch the next page.") total_count: StrictInt = Field(description="The total number of events for the server signer.") - __properties: ClassVar[list[str]] = ["data", "has_more", "next_page", "total_count"] + __properties: ClassVar[List[str]] = ["data", "has_more", "next_page", "total_count"] model_config = ConfigDict( populate_by_name=True, @@ -38,6 +39,7 @@ class ServerSignerEventList(BaseModel): protected_namespaces=(), ) + def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True)) @@ -48,11 +50,11 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self | None: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of ServerSignerEventList from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self) -> dict[str, Any]: + def to_dict(self) -> Dict[str, Any]: """Return the dictionary representation of the model using alias. This has the following differences from calling pydantic's @@ -62,7 +64,8 @@ def to_dict(self) -> dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ - excluded_fields: set[str] = set([]) + excluded_fields: Set[str] = set([ + ]) _dict = self.model_dump( by_alias=True, @@ -75,11 +78,11 @@ def to_dict(self) -> dict[str, Any]: for _item_data in self.data: if _item_data: _items.append(_item_data.to_dict()) - _dict["data"] = _items + _dict['data'] = _items return _dict @classmethod - def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of ServerSignerEventList from a dict""" if obj is None: return None @@ -87,14 +90,12 @@ def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate( - { - "data": [ServerSignerEvent.from_dict(_item) for _item in obj["data"]] - if obj.get("data") is not None - else None, - "has_more": obj.get("has_more"), - "next_page": obj.get("next_page"), - "total_count": obj.get("total_count"), - } - ) + _obj = cls.model_validate({ + "data": [ServerSignerEvent.from_dict(_item) for _item in obj["data"]] if obj.get("data") is not None else None, + "has_more": obj.get("has_more"), + "next_page": obj.get("next_page"), + "total_count": obj.get("total_count") + }) return _obj + + diff --git a/cdp/client/models/server_signer_list.py b/cdp/client/models/server_signer_list.py index aa53db2..cccd8fc 100644 --- a/cdp/client/models/server_signer_list.py +++ b/cdp/client/models/server_signer_list.py @@ -1,38 +1,37 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 -import json + +from __future__ import annotations import pprint import re # noqa: F401 -from typing import Any, ClassVar +import json from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr -from typing_extensions import Self - +from typing import Any, ClassVar, Dict, List from cdp.client.models.server_signer import ServerSigner - +from typing import Optional, Set +from typing_extensions import Self class ServerSignerList(BaseModel): - """ """ - - data: list[ServerSigner] - has_more: StrictBool = Field( - description="True if this list has another page of items after this one that can be fetched." - ) + """ + + """ # noqa: E501 + data: List[ServerSigner] + has_more: StrictBool = Field(description="True if this list has another page of items after this one that can be fetched.") next_page: StrictStr = Field(description="The page token to be used to fetch the next page.") - total_count: StrictInt = Field( - description="The total number of server-signers for the project." - ) - __properties: ClassVar[list[str]] = ["data", "has_more", "next_page", "total_count"] + total_count: StrictInt = Field(description="The total number of server-signers for the project.") + __properties: ClassVar[List[str]] = ["data", "has_more", "next_page", "total_count"] model_config = ConfigDict( populate_by_name=True, @@ -40,6 +39,7 @@ class ServerSignerList(BaseModel): protected_namespaces=(), ) + def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True)) @@ -50,11 +50,11 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self | None: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of ServerSignerList from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self) -> dict[str, Any]: + def to_dict(self) -> Dict[str, Any]: """Return the dictionary representation of the model using alias. This has the following differences from calling pydantic's @@ -64,7 +64,8 @@ def to_dict(self) -> dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ - excluded_fields: set[str] = set([]) + excluded_fields: Set[str] = set([ + ]) _dict = self.model_dump( by_alias=True, @@ -77,11 +78,11 @@ def to_dict(self) -> dict[str, Any]: for _item_data in self.data: if _item_data: _items.append(_item_data.to_dict()) - _dict["data"] = _items + _dict['data'] = _items return _dict @classmethod - def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of ServerSignerList from a dict""" if obj is None: return None @@ -89,14 +90,12 @@ def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate( - { - "data": [ServerSigner.from_dict(_item) for _item in obj["data"]] - if obj.get("data") is not None - else None, - "has_more": obj.get("has_more"), - "next_page": obj.get("next_page"), - "total_count": obj.get("total_count"), - } - ) + _obj = cls.model_validate({ + "data": [ServerSigner.from_dict(_item) for _item in obj["data"]] if obj.get("data") is not None else None, + "has_more": obj.get("has_more"), + "next_page": obj.get("next_page"), + "total_count": obj.get("total_count") + }) return _obj + + diff --git a/cdp/client/models/signature_creation_event.py b/cdp/client/models/signature_creation_event.py index afeb0ac..af1aecc 100644 --- a/cdp/client/models/signature_creation_event.py +++ b/cdp/client/models/signature_creation_event.py @@ -1,53 +1,41 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 -import json + +from __future__ import annotations import pprint import re # noqa: F401 -from typing import Any, ClassVar +import json from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr -from typing_extensions import Self - +from typing import Any, ClassVar, Dict, List from cdp.client.models.transaction_type import TransactionType - +from typing import Optional, Set +from typing_extensions import Self class SignatureCreationEvent(BaseModel): - """An event representing a signature creation.""" - - seed_id: StrictStr = Field( - description="The ID of the seed that the server-signer should create the signature for" - ) + """ + An event representing a signature creation. + """ # noqa: E501 + seed_id: StrictStr = Field(description="The ID of the seed that the server-signer should create the signature for") wallet_id: StrictStr = Field(description="The ID of the wallet the signature is for") wallet_user_id: StrictStr = Field(description="The ID of the user that the wallet belongs to") address_id: StrictStr = Field(description="The ID of the address the transfer belongs to") - address_index: StrictInt = Field( - description="The index of the address that the server-signer should sign with" - ) + address_index: StrictInt = Field(description="The index of the address that the server-signer should sign with") signing_payload: StrictStr = Field(description="The payload that the server-signer should sign") transaction_type: TransactionType - transaction_id: StrictStr = Field( - description="The ID of the transaction that the server-signer should sign" - ) - __properties: ClassVar[list[str]] = [ - "seed_id", - "wallet_id", - "wallet_user_id", - "address_id", - "address_index", - "signing_payload", - "transaction_type", - "transaction_id", - ] + transaction_id: StrictStr = Field(description="The ID of the transaction that the server-signer should sign") + __properties: ClassVar[List[str]] = ["seed_id", "wallet_id", "wallet_user_id", "address_id", "address_index", "signing_payload", "transaction_type", "transaction_id"] model_config = ConfigDict( populate_by_name=True, @@ -55,6 +43,7 @@ class SignatureCreationEvent(BaseModel): protected_namespaces=(), ) + def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True)) @@ -65,11 +54,11 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self | None: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of SignatureCreationEvent from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self) -> dict[str, Any]: + def to_dict(self) -> Dict[str, Any]: """Return the dictionary representation of the model using alias. This has the following differences from calling pydantic's @@ -79,7 +68,8 @@ def to_dict(self) -> dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ - excluded_fields: set[str] = set([]) + excluded_fields: Set[str] = set([ + ]) _dict = self.model_dump( by_alias=True, @@ -89,7 +79,7 @@ def to_dict(self) -> dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of SignatureCreationEvent from a dict""" if obj is None: return None @@ -97,16 +87,16 @@ def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate( - { - "seed_id": obj.get("seed_id"), - "wallet_id": obj.get("wallet_id"), - "wallet_user_id": obj.get("wallet_user_id"), - "address_id": obj.get("address_id"), - "address_index": obj.get("address_index"), - "signing_payload": obj.get("signing_payload"), - "transaction_type": obj.get("transaction_type"), - "transaction_id": obj.get("transaction_id"), - } - ) + _obj = cls.model_validate({ + "seed_id": obj.get("seed_id"), + "wallet_id": obj.get("wallet_id"), + "wallet_user_id": obj.get("wallet_user_id"), + "address_id": obj.get("address_id"), + "address_index": obj.get("address_index"), + "signing_payload": obj.get("signing_payload"), + "transaction_type": obj.get("transaction_type"), + "transaction_id": obj.get("transaction_id") + }) return _obj + + diff --git a/cdp/client/models/signature_creation_event_result.py b/cdp/client/models/signature_creation_event_result.py index ccd3678..2059017 100644 --- a/cdp/client/models/signature_creation_event_result.py +++ b/cdp/client/models/signature_creation_event_result.py @@ -1,45 +1,39 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 -import json + +from __future__ import annotations import pprint import re # noqa: F401 -from typing import Any, ClassVar +import json from pydantic import BaseModel, ConfigDict, Field, StrictStr -from typing_extensions import Self - +from typing import Any, ClassVar, Dict, List from cdp.client.models.transaction_type import TransactionType - +from typing import Optional, Set +from typing_extensions import Self class SignatureCreationEventResult(BaseModel): - """The result to a SignatureCreationEvent.""" - + """ + The result to a SignatureCreationEvent. + """ # noqa: E501 wallet_id: StrictStr = Field(description="The ID of the wallet that the event was created for.") wallet_user_id: StrictStr = Field(description="The ID of the user that the wallet belongs to") address_id: StrictStr = Field(description="The ID of the address the transfer belongs to") transaction_type: TransactionType - transaction_id: StrictStr = Field( - description="The ID of the transaction that the Server-Signer has signed for" - ) + transaction_id: StrictStr = Field(description="The ID of the transaction that the Server-Signer has signed for") signature: StrictStr = Field(description="The signature created by the server-signer.") - __properties: ClassVar[list[str]] = [ - "wallet_id", - "wallet_user_id", - "address_id", - "transaction_type", - "transaction_id", - "signature", - ] + __properties: ClassVar[List[str]] = ["wallet_id", "wallet_user_id", "address_id", "transaction_type", "transaction_id", "signature"] model_config = ConfigDict( populate_by_name=True, @@ -47,6 +41,7 @@ class SignatureCreationEventResult(BaseModel): protected_namespaces=(), ) + def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True)) @@ -57,11 +52,11 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self | None: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of SignatureCreationEventResult from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self) -> dict[str, Any]: + def to_dict(self) -> Dict[str, Any]: """Return the dictionary representation of the model using alias. This has the following differences from calling pydantic's @@ -71,7 +66,8 @@ def to_dict(self) -> dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ - excluded_fields: set[str] = set([]) + excluded_fields: Set[str] = set([ + ]) _dict = self.model_dump( by_alias=True, @@ -81,7 +77,7 @@ def to_dict(self) -> dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of SignatureCreationEventResult from a dict""" if obj is None: return None @@ -89,14 +85,14 @@ def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate( - { - "wallet_id": obj.get("wallet_id"), - "wallet_user_id": obj.get("wallet_user_id"), - "address_id": obj.get("address_id"), - "transaction_type": obj.get("transaction_type"), - "transaction_id": obj.get("transaction_id"), - "signature": obj.get("signature"), - } - ) + _obj = cls.model_validate({ + "wallet_id": obj.get("wallet_id"), + "wallet_user_id": obj.get("wallet_user_id"), + "address_id": obj.get("address_id"), + "transaction_type": obj.get("transaction_type"), + "transaction_id": obj.get("transaction_id"), + "signature": obj.get("signature") + }) return _obj + + diff --git a/cdp/client/models/signed_voluntary_exit_message_metadata.py b/cdp/client/models/signed_voluntary_exit_message_metadata.py index d0e9f43..69b0c4b 100644 --- a/cdp/client/models/signed_voluntary_exit_message_metadata.py +++ b/cdp/client/models/signed_voluntary_exit_message_metadata.py @@ -1,35 +1,35 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 -import json + +from __future__ import annotations import pprint import re # noqa: F401 -from typing import Any, ClassVar +import json from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set from typing_extensions import Self - class SignedVoluntaryExitMessageMetadata(BaseModel): - """Signed voluntary exit message metadata to be provided to beacon chain to exit a validator.""" - - validator_pub_key: StrictStr = Field( - description="The public key of the validator associated with the exit message." - ) + """ + Signed voluntary exit message metadata to be provided to beacon chain to exit a validator. + """ # noqa: E501 + validator_pub_key: StrictStr = Field(description="The public key of the validator associated with the exit message.") fork: StrictStr = Field(description="The current fork version of the Ethereum beacon chain.") - signed_voluntary_exit: StrictStr = Field( - description="A base64 encoded version of a json string representing a voluntary exit message." - ) - __properties: ClassVar[list[str]] = ["validator_pub_key", "fork", "signed_voluntary_exit"] + signed_voluntary_exit: StrictStr = Field(description="A base64 encoded version of a json string representing a voluntary exit message.") + __properties: ClassVar[List[str]] = ["validator_pub_key", "fork", "signed_voluntary_exit"] model_config = ConfigDict( populate_by_name=True, @@ -37,6 +37,7 @@ class SignedVoluntaryExitMessageMetadata(BaseModel): protected_namespaces=(), ) + def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True)) @@ -47,11 +48,11 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self | None: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of SignedVoluntaryExitMessageMetadata from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self) -> dict[str, Any]: + def to_dict(self) -> Dict[str, Any]: """Return the dictionary representation of the model using alias. This has the following differences from calling pydantic's @@ -61,7 +62,8 @@ def to_dict(self) -> dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ - excluded_fields: set[str] = set([]) + excluded_fields: Set[str] = set([ + ]) _dict = self.model_dump( by_alias=True, @@ -71,7 +73,7 @@ def to_dict(self) -> dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of SignedVoluntaryExitMessageMetadata from a dict""" if obj is None: return None @@ -79,11 +81,11 @@ def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate( - { - "validator_pub_key": obj.get("validator_pub_key"), - "fork": obj.get("fork"), - "signed_voluntary_exit": obj.get("signed_voluntary_exit"), - } - ) + _obj = cls.model_validate({ + "validator_pub_key": obj.get("validator_pub_key"), + "fork": obj.get("fork"), + "signed_voluntary_exit": obj.get("signed_voluntary_exit") + }) return _obj + + diff --git a/cdp/client/models/smart_contract.py b/cdp/client/models/smart_contract.py index cf0bbd4..884ca0c 100644 --- a/cdp/client/models/smart_contract.py +++ b/cdp/client/models/smart_contract.py @@ -1,55 +1,44 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 -import json + +from __future__ import annotations import pprint import re # noqa: F401 -from typing import Any, ClassVar +import json from pydantic import BaseModel, ConfigDict, Field, StrictStr -from typing_extensions import Self - +from typing import Any, ClassVar, Dict, List from cdp.client.models.smart_contract_options import SmartContractOptions from cdp.client.models.smart_contract_type import SmartContractType from cdp.client.models.transaction import Transaction - +from typing import Optional, Set +from typing_extensions import Self class SmartContract(BaseModel): - """Represents a smart contract on the blockchain""" - + """ + Represents a smart contract on the blockchain + """ # noqa: E501 smart_contract_id: StrictStr = Field(description="The unique identifier of the smart contract") network_id: StrictStr = Field(description="The name of the blockchain network") - wallet_id: StrictStr = Field( - description="The ID of the wallet that deployed the smart contract" - ) + wallet_id: StrictStr = Field(description="The ID of the wallet that deployed the smart contract") contract_address: StrictStr = Field(description="The EVM address of the smart contract") - deployer_address: StrictStr = Field( - description="The EVM address of the account that deployed the smart contract" - ) + deployer_address: StrictStr = Field(description="The EVM address of the account that deployed the smart contract") type: SmartContractType options: SmartContractOptions abi: StrictStr = Field(description="The JSON-encoded ABI of the contract") transaction: Transaction - __properties: ClassVar[list[str]] = [ - "smart_contract_id", - "network_id", - "wallet_id", - "contract_address", - "deployer_address", - "type", - "options", - "abi", - "transaction", - ] + __properties: ClassVar[List[str]] = ["smart_contract_id", "network_id", "wallet_id", "contract_address", "deployer_address", "type", "options", "abi", "transaction"] model_config = ConfigDict( populate_by_name=True, @@ -57,6 +46,7 @@ class SmartContract(BaseModel): protected_namespaces=(), ) + def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True)) @@ -67,11 +57,11 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self | None: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of SmartContract from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self) -> dict[str, Any]: + def to_dict(self) -> Dict[str, Any]: """Return the dictionary representation of the model using alias. This has the following differences from calling pydantic's @@ -81,7 +71,8 @@ def to_dict(self) -> dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ - excluded_fields: set[str] = set([]) + excluded_fields: Set[str] = set([ + ]) _dict = self.model_dump( by_alias=True, @@ -90,14 +81,14 @@ def to_dict(self) -> dict[str, Any]: ) # override the default output from pydantic by calling `to_dict()` of options if self.options: - _dict["options"] = self.options.to_dict() + _dict['options'] = self.options.to_dict() # override the default output from pydantic by calling `to_dict()` of transaction if self.transaction: - _dict["transaction"] = self.transaction.to_dict() + _dict['transaction'] = self.transaction.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of SmartContract from a dict""" if obj is None: return None @@ -105,21 +96,17 @@ def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate( - { - "smart_contract_id": obj.get("smart_contract_id"), - "network_id": obj.get("network_id"), - "wallet_id": obj.get("wallet_id"), - "contract_address": obj.get("contract_address"), - "deployer_address": obj.get("deployer_address"), - "type": obj.get("type"), - "options": SmartContractOptions.from_dict(obj["options"]) - if obj.get("options") is not None - else None, - "abi": obj.get("abi"), - "transaction": Transaction.from_dict(obj["transaction"]) - if obj.get("transaction") is not None - else None, - } - ) + _obj = cls.model_validate({ + "smart_contract_id": obj.get("smart_contract_id"), + "network_id": obj.get("network_id"), + "wallet_id": obj.get("wallet_id"), + "contract_address": obj.get("contract_address"), + "deployer_address": obj.get("deployer_address"), + "type": obj.get("type"), + "options": SmartContractOptions.from_dict(obj["options"]) if obj.get("options") is not None else None, + "abi": obj.get("abi"), + "transaction": Transaction.from_dict(obj["transaction"]) if obj.get("transaction") is not None else None + }) return _obj + + diff --git a/cdp/client/models/smart_contract_list.py b/cdp/client/models/smart_contract_list.py index 7e42b71..d99869e 100644 --- a/cdp/client/models/smart_contract_list.py +++ b/cdp/client/models/smart_contract_list.py @@ -1,35 +1,36 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 -import json + +from __future__ import annotations import pprint import re # noqa: F401 -from typing import Any, ClassVar +import json from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr -from typing_extensions import Self - +from typing import Any, ClassVar, Dict, List from cdp.client.models.smart_contract import SmartContract - +from typing import Optional, Set +from typing_extensions import Self class SmartContractList(BaseModel): - """SmartContractList""" - - data: list[SmartContract] - has_more: StrictBool = Field( - description="True if this list has another page of items after this one that can be fetched." - ) + """ + SmartContractList + """ # noqa: E501 + data: List[SmartContract] + has_more: StrictBool = Field(description="True if this list has another page of items after this one that can be fetched.") next_page: StrictStr = Field(description="The page token to be used to fetch the next page.") - __properties: ClassVar[list[str]] = ["data", "has_more", "next_page"] + __properties: ClassVar[List[str]] = ["data", "has_more", "next_page"] model_config = ConfigDict( populate_by_name=True, @@ -37,6 +38,7 @@ class SmartContractList(BaseModel): protected_namespaces=(), ) + def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True)) @@ -47,11 +49,11 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self | None: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of SmartContractList from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self) -> dict[str, Any]: + def to_dict(self) -> Dict[str, Any]: """Return the dictionary representation of the model using alias. This has the following differences from calling pydantic's @@ -61,7 +63,8 @@ def to_dict(self) -> dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ - excluded_fields: set[str] = set([]) + excluded_fields: Set[str] = set([ + ]) _dict = self.model_dump( by_alias=True, @@ -74,11 +77,11 @@ def to_dict(self) -> dict[str, Any]: for _item_data in self.data: if _item_data: _items.append(_item_data.to_dict()) - _dict["data"] = _items + _dict['data'] = _items return _dict @classmethod - def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of SmartContractList from a dict""" if obj is None: return None @@ -86,13 +89,11 @@ def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate( - { - "data": [SmartContract.from_dict(_item) for _item in obj["data"]] - if obj.get("data") is not None - else None, - "has_more": obj.get("has_more"), - "next_page": obj.get("next_page"), - } - ) + _obj = cls.model_validate({ + "data": [SmartContract.from_dict(_item) for _item in obj["data"]] if obj.get("data") is not None else None, + "has_more": obj.get("has_more"), + "next_page": obj.get("next_page") + }) return _obj + + diff --git a/cdp/client/models/smart_contract_options.py b/cdp/client/models/smart_contract_options.py index 6da1d8e..caff948 100644 --- a/cdp/client/models/smart_contract_options.py +++ b/cdp/client/models/smart_contract_options.py @@ -1,58 +1,61 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 + +from __future__ import annotations import json import pprint -from typing import Any - -from pydantic import BaseModel, ConfigDict, ValidationError, field_validator -from typing_extensions import Self - +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Any, List, Optional +from cdp.client.models.multi_token_contract_options import MultiTokenContractOptions from cdp.client.models.nft_contract_options import NFTContractOptions from cdp.client.models.token_contract_options import TokenContractOptions +from pydantic import StrictStr, Field +from typing import Union, List, Set, Optional, Dict +from typing_extensions import Literal, Self -SMARTCONTRACTOPTIONS_ONE_OF_SCHEMAS = ["NFTContractOptions", "TokenContractOptions"] - +SMARTCONTRACTOPTIONS_ONE_OF_SCHEMAS = ["MultiTokenContractOptions", "NFTContractOptions", "TokenContractOptions"] class SmartContractOptions(BaseModel): - """Options for smart contract creation""" - + """ + Options for smart contract creation + """ # data type: TokenContractOptions - oneof_schema_1_validator: TokenContractOptions | None = None + oneof_schema_1_validator: Optional[TokenContractOptions] = None # data type: NFTContractOptions - oneof_schema_2_validator: NFTContractOptions | None = None - actual_instance: NFTContractOptions | TokenContractOptions | None = None - one_of_schemas: set[str] = {"NFTContractOptions", "TokenContractOptions"} + oneof_schema_2_validator: Optional[NFTContractOptions] = None + # data type: MultiTokenContractOptions + oneof_schema_3_validator: Optional[MultiTokenContractOptions] = None + actual_instance: Optional[Union[MultiTokenContractOptions, NFTContractOptions, TokenContractOptions]] = None + one_of_schemas: Set[str] = { "MultiTokenContractOptions", "NFTContractOptions", "TokenContractOptions" } model_config = ConfigDict( validate_assignment=True, protected_namespaces=(), ) + def __init__(self, *args, **kwargs) -> None: if args: if len(args) > 1: - raise ValueError( - "If a position argument is used, only 1 is allowed to set `actual_instance`" - ) + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") if kwargs: - raise ValueError( - "If a position argument is used, keyword arguments cannot be used." - ) + raise ValueError("If a position argument is used, keyword arguments cannot be used.") super().__init__(actual_instance=args[0]) else: super().__init__(**kwargs) - @field_validator("actual_instance") + @field_validator('actual_instance') def actual_instance_must_validate_oneof(cls, v): instance = SmartContractOptions.model_construct() error_messages = [] @@ -67,23 +70,22 @@ def actual_instance_must_validate_oneof(cls, v): error_messages.append(f"Error! Input type `{type(v)}` is not `NFTContractOptions`") else: match += 1 + # validate data type: MultiTokenContractOptions + if not isinstance(v, MultiTokenContractOptions): + error_messages.append(f"Error! Input type `{type(v)}` is not `MultiTokenContractOptions`") + else: + match += 1 if match > 1: # more than 1 match - raise ValueError( - "Multiple matches found when setting `actual_instance` in SmartContractOptions with oneOf schemas: NFTContractOptions, TokenContractOptions. Details: " - + ", ".join(error_messages) - ) + raise ValueError("Multiple matches found when setting `actual_instance` in SmartContractOptions with oneOf schemas: MultiTokenContractOptions, NFTContractOptions, TokenContractOptions. Details: " + ", ".join(error_messages)) elif match == 0: # no match - raise ValueError( - "No match found when setting `actual_instance` in SmartContractOptions with oneOf schemas: NFTContractOptions, TokenContractOptions. Details: " - + ", ".join(error_messages) - ) + raise ValueError("No match found when setting `actual_instance` in SmartContractOptions with oneOf schemas: MultiTokenContractOptions, NFTContractOptions, TokenContractOptions. Details: " + ", ".join(error_messages)) else: return v @classmethod - def from_dict(cls, obj: str | dict[str, Any]) -> Self: + def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self: return cls.from_json(json.dumps(obj)) @classmethod @@ -105,19 +107,19 @@ def from_json(cls, json_str: str) -> Self: match += 1 except (ValidationError, ValueError) as e: error_messages.append(str(e)) + # deserialize data into MultiTokenContractOptions + try: + instance.actual_instance = MultiTokenContractOptions.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) if match > 1: # more than 1 match - raise ValueError( - "Multiple matches found when deserializing the JSON string into SmartContractOptions with oneOf schemas: NFTContractOptions, TokenContractOptions. Details: " - + ", ".join(error_messages) - ) + raise ValueError("Multiple matches found when deserializing the JSON string into SmartContractOptions with oneOf schemas: MultiTokenContractOptions, NFTContractOptions, TokenContractOptions. Details: " + ", ".join(error_messages)) elif match == 0: # no match - raise ValueError( - "No match found when deserializing the JSON string into SmartContractOptions with oneOf schemas: NFTContractOptions, TokenContractOptions. Details: " - + ", ".join(error_messages) - ) + raise ValueError("No match found when deserializing the JSON string into SmartContractOptions with oneOf schemas: MultiTokenContractOptions, NFTContractOptions, TokenContractOptions. Details: " + ", ".join(error_messages)) else: return instance @@ -131,7 +133,7 @@ def to_json(self) -> str: else: return json.dumps(self.actual_instance) - def to_dict(self) -> dict[str, Any] | NFTContractOptions | TokenContractOptions | None: + def to_dict(self) -> Optional[Union[Dict[str, Any], MultiTokenContractOptions, NFTContractOptions, TokenContractOptions]]: """Returns the dict representation of the actual instance""" if self.actual_instance is None: return None @@ -145,3 +147,5 @@ def to_dict(self) -> dict[str, Any] | NFTContractOptions | TokenContractOptions def to_str(self) -> str: """Returns the string representation of the actual instance""" return pprint.pformat(self.model_dump()) + + diff --git a/cdp/client/models/smart_contract_type.py b/cdp/client/models/smart_contract_type.py index 7a815e3..7399f69 100644 --- a/cdp/client/models/smart_contract_type.py +++ b/cdp/client/models/smart_contract_type.py @@ -1,31 +1,38 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 + +from __future__ import annotations import json from enum import Enum - from typing_extensions import Self class SmartContractType(str, Enum): - """The type of the smart contract""" + """ + The type of the smart contract. + """ """ allowed enum values """ - ERC20 = "erc20" - ERC721 = "erc721" + ERC20 = 'erc20' + ERC721 = 'erc721' + ERC1155 = 'erc1155' @classmethod def from_json(cls, json_str: str) -> Self: """Create an instance of SmartContractType from a JSON string""" return cls(json.loads(json_str)) + + diff --git a/cdp/client/models/sponsored_send.py b/cdp/client/models/sponsored_send.py index adc397d..64af14a 100644 --- a/cdp/client/models/sponsored_send.py +++ b/cdp/client/models/sponsored_send.py @@ -1,60 +1,45 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 -import json + +from __future__ import annotations import pprint import re # noqa: F401 -from typing import Any, ClassVar +import json from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set from typing_extensions import Self - class SponsoredSend(BaseModel): - """An onchain sponsored gasless send.""" - + """ + An onchain sponsored gasless send. + """ # noqa: E501 to_address_id: StrictStr = Field(description="The onchain address of the recipient") raw_typed_data: StrictStr = Field(description="The raw typed data for the sponsored send") - typed_data_hash: StrictStr = Field( - description="The typed data hash for the sponsored send. This is the typed data hash that needs to be signed by the sender." - ) - signature: StrictStr | None = Field( - default=None, description="The signed hash of the sponsored send typed data." - ) - transaction_hash: StrictStr | None = Field( - default=None, description="The hash of the onchain sponsored send transaction" - ) - transaction_link: StrictStr | None = Field( - default=None, - description="The link to view the transaction on a block explorer. This is optional and may not be present for all transactions.", - ) + typed_data_hash: StrictStr = Field(description="The typed data hash for the sponsored send. This is the typed data hash that needs to be signed by the sender.") + signature: Optional[StrictStr] = Field(default=None, description="The signed hash of the sponsored send typed data.") + transaction_hash: Optional[StrictStr] = Field(default=None, description="The hash of the onchain sponsored send transaction") + transaction_link: Optional[StrictStr] = Field(default=None, description="The link to view the transaction on a block explorer. This is optional and may not be present for all transactions.") status: StrictStr = Field(description="The status of the sponsored send") - __properties: ClassVar[list[str]] = [ - "to_address_id", - "raw_typed_data", - "typed_data_hash", - "signature", - "transaction_hash", - "transaction_link", - "status", - ] - - @field_validator("status") + __properties: ClassVar[List[str]] = ["to_address_id", "raw_typed_data", "typed_data_hash", "signature", "transaction_hash", "transaction_link", "status"] + + @field_validator('status') def status_validate_enum(cls, value): """Validates the enum""" - if value not in set(["pending", "signed", "submitted", "complete", "failed"]): - raise ValueError( - "must be one of enum values ('pending', 'signed', 'submitted', 'complete', 'failed')" - ) + if value not in set(['pending', 'signed', 'submitted', 'complete', 'failed']): + raise ValueError("must be one of enum values ('pending', 'signed', 'submitted', 'complete', 'failed')") return value model_config = ConfigDict( @@ -63,6 +48,7 @@ def status_validate_enum(cls, value): protected_namespaces=(), ) + def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True)) @@ -73,11 +59,11 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self | None: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of SponsoredSend from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self) -> dict[str, Any]: + def to_dict(self) -> Dict[str, Any]: """Return the dictionary representation of the model using alias. This has the following differences from calling pydantic's @@ -87,7 +73,8 @@ def to_dict(self) -> dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ - excluded_fields: set[str] = set([]) + excluded_fields: Set[str] = set([ + ]) _dict = self.model_dump( by_alias=True, @@ -97,7 +84,7 @@ def to_dict(self) -> dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of SponsoredSend from a dict""" if obj is None: return None @@ -105,15 +92,15 @@ def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate( - { - "to_address_id": obj.get("to_address_id"), - "raw_typed_data": obj.get("raw_typed_data"), - "typed_data_hash": obj.get("typed_data_hash"), - "signature": obj.get("signature"), - "transaction_hash": obj.get("transaction_hash"), - "transaction_link": obj.get("transaction_link"), - "status": obj.get("status"), - } - ) + _obj = cls.model_validate({ + "to_address_id": obj.get("to_address_id"), + "raw_typed_data": obj.get("raw_typed_data"), + "typed_data_hash": obj.get("typed_data_hash"), + "signature": obj.get("signature"), + "transaction_hash": obj.get("transaction_hash"), + "transaction_link": obj.get("transaction_link"), + "status": obj.get("status") + }) return _obj + + diff --git a/cdp/client/models/staking_balance.py b/cdp/client/models/staking_balance.py index d763dce..25556bc 100644 --- a/cdp/client/models/staking_balance.py +++ b/cdp/client/models/staking_balance.py @@ -1,46 +1,39 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 -import json + +from __future__ import annotations import pprint import re # noqa: F401 -from datetime import datetime -from typing import Any, ClassVar +import json +from datetime import datetime from pydantic import BaseModel, ConfigDict, Field, StrictStr -from typing_extensions import Self - +from typing import Any, ClassVar, Dict, List from cdp.client.models.balance import Balance - +from typing import Optional, Set +from typing_extensions import Self class StakingBalance(BaseModel): - """The staking balances for an address.""" - - address: StrictStr = Field( - description="The onchain address for which the staking balances are being fetched." - ) - var_date: datetime = Field( - description="The timestamp of the staking balance in UTC.", alias="date" - ) + """ + The staking balances for an address. + """ # noqa: E501 + address: StrictStr = Field(description="The onchain address for which the staking balances are being fetched.") + var_date: datetime = Field(description="The timestamp of the staking balance in UTC.", alias="date") bonded_stake: Balance unbonded_balance: Balance participant_type: StrictStr = Field(description="The type of staking participation.") - __properties: ClassVar[list[str]] = [ - "address", - "date", - "bonded_stake", - "unbonded_balance", - "participant_type", - ] + __properties: ClassVar[List[str]] = ["address", "date", "bonded_stake", "unbonded_balance", "participant_type"] model_config = ConfigDict( populate_by_name=True, @@ -48,6 +41,7 @@ class StakingBalance(BaseModel): protected_namespaces=(), ) + def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True)) @@ -58,11 +52,11 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self | None: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of StakingBalance from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self) -> dict[str, Any]: + def to_dict(self) -> Dict[str, Any]: """Return the dictionary representation of the model using alias. This has the following differences from calling pydantic's @@ -72,7 +66,8 @@ def to_dict(self) -> dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ - excluded_fields: set[str] = set([]) + excluded_fields: Set[str] = set([ + ]) _dict = self.model_dump( by_alias=True, @@ -81,14 +76,14 @@ def to_dict(self) -> dict[str, Any]: ) # override the default output from pydantic by calling `to_dict()` of bonded_stake if self.bonded_stake: - _dict["bonded_stake"] = self.bonded_stake.to_dict() + _dict['bonded_stake'] = self.bonded_stake.to_dict() # override the default output from pydantic by calling `to_dict()` of unbonded_balance if self.unbonded_balance: - _dict["unbonded_balance"] = self.unbonded_balance.to_dict() + _dict['unbonded_balance'] = self.unbonded_balance.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of StakingBalance from a dict""" if obj is None: return None @@ -96,17 +91,13 @@ def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate( - { - "address": obj.get("address"), - "date": obj.get("date"), - "bonded_stake": Balance.from_dict(obj["bonded_stake"]) - if obj.get("bonded_stake") is not None - else None, - "unbonded_balance": Balance.from_dict(obj["unbonded_balance"]) - if obj.get("unbonded_balance") is not None - else None, - "participant_type": obj.get("participant_type"), - } - ) + _obj = cls.model_validate({ + "address": obj.get("address"), + "date": obj.get("date"), + "bonded_stake": Balance.from_dict(obj["bonded_stake"]) if obj.get("bonded_stake") is not None else None, + "unbonded_balance": Balance.from_dict(obj["unbonded_balance"]) if obj.get("unbonded_balance") is not None else None, + "participant_type": obj.get("participant_type") + }) return _obj + + diff --git a/cdp/client/models/staking_context.py b/cdp/client/models/staking_context.py index e7ccd9b..8fca6b5 100644 --- a/cdp/client/models/staking_context.py +++ b/cdp/client/models/staking_context.py @@ -1,31 +1,34 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 -import json + +from __future__ import annotations import pprint import re # noqa: F401 -from typing import Any, ClassVar +import json from pydantic import BaseModel, ConfigDict -from typing_extensions import Self - +from typing import Any, ClassVar, Dict, List from cdp.client.models.staking_context_context import StakingContextContext - +from typing import Optional, Set +from typing_extensions import Self class StakingContext(BaseModel): - """Context needed to perform a staking operation""" - + """ + Context needed to perform a staking operation + """ # noqa: E501 context: StakingContextContext - __properties: ClassVar[list[str]] = ["context"] + __properties: ClassVar[List[str]] = ["context"] model_config = ConfigDict( populate_by_name=True, @@ -33,6 +36,7 @@ class StakingContext(BaseModel): protected_namespaces=(), ) + def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True)) @@ -43,11 +47,11 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self | None: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of StakingContext from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self) -> dict[str, Any]: + def to_dict(self) -> Dict[str, Any]: """Return the dictionary representation of the model using alias. This has the following differences from calling pydantic's @@ -57,7 +61,8 @@ def to_dict(self) -> dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ - excluded_fields: set[str] = set([]) + excluded_fields: Set[str] = set([ + ]) _dict = self.model_dump( by_alias=True, @@ -66,11 +71,11 @@ def to_dict(self) -> dict[str, Any]: ) # override the default output from pydantic by calling `to_dict()` of context if self.context: - _dict["context"] = self.context.to_dict() + _dict['context'] = self.context.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of StakingContext from a dict""" if obj is None: return None @@ -78,11 +83,9 @@ def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate( - { - "context": StakingContextContext.from_dict(obj["context"]) - if obj.get("context") is not None - else None - } - ) + _obj = cls.model_validate({ + "context": StakingContextContext.from_dict(obj["context"]) if obj.get("context") is not None else None + }) return _obj + + diff --git a/cdp/client/models/staking_context_context.py b/cdp/client/models/staking_context_context.py index 07d1f34..239cd8b 100644 --- a/cdp/client/models/staking_context_context.py +++ b/cdp/client/models/staking_context_context.py @@ -1,37 +1,36 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 -import json + +from __future__ import annotations import pprint import re # noqa: F401 -from typing import Any, ClassVar +import json from pydantic import BaseModel, ConfigDict -from typing_extensions import Self - +from typing import Any, ClassVar, Dict, List from cdp.client.models.balance import Balance - +from typing import Optional, Set +from typing_extensions import Self class StakingContextContext(BaseModel): - """StakingContextContext""" - + """ + StakingContextContext + """ # noqa: E501 stakeable_balance: Balance unstakeable_balance: Balance claimable_balance: Balance - __properties: ClassVar[list[str]] = [ - "stakeable_balance", - "unstakeable_balance", - "claimable_balance", - ] + __properties: ClassVar[List[str]] = ["stakeable_balance", "unstakeable_balance", "claimable_balance"] model_config = ConfigDict( populate_by_name=True, @@ -39,6 +38,7 @@ class StakingContextContext(BaseModel): protected_namespaces=(), ) + def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True)) @@ -49,11 +49,11 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self | None: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of StakingContextContext from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self) -> dict[str, Any]: + def to_dict(self) -> Dict[str, Any]: """Return the dictionary representation of the model using alias. This has the following differences from calling pydantic's @@ -63,7 +63,8 @@ def to_dict(self) -> dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ - excluded_fields: set[str] = set([]) + excluded_fields: Set[str] = set([ + ]) _dict = self.model_dump( by_alias=True, @@ -72,17 +73,17 @@ def to_dict(self) -> dict[str, Any]: ) # override the default output from pydantic by calling `to_dict()` of stakeable_balance if self.stakeable_balance: - _dict["stakeable_balance"] = self.stakeable_balance.to_dict() + _dict['stakeable_balance'] = self.stakeable_balance.to_dict() # override the default output from pydantic by calling `to_dict()` of unstakeable_balance if self.unstakeable_balance: - _dict["unstakeable_balance"] = self.unstakeable_balance.to_dict() + _dict['unstakeable_balance'] = self.unstakeable_balance.to_dict() # override the default output from pydantic by calling `to_dict()` of claimable_balance if self.claimable_balance: - _dict["claimable_balance"] = self.claimable_balance.to_dict() + _dict['claimable_balance'] = self.claimable_balance.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of StakingContextContext from a dict""" if obj is None: return None @@ -90,17 +91,11 @@ def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate( - { - "stakeable_balance": Balance.from_dict(obj["stakeable_balance"]) - if obj.get("stakeable_balance") is not None - else None, - "unstakeable_balance": Balance.from_dict(obj["unstakeable_balance"]) - if obj.get("unstakeable_balance") is not None - else None, - "claimable_balance": Balance.from_dict(obj["claimable_balance"]) - if obj.get("claimable_balance") is not None - else None, - } - ) + _obj = cls.model_validate({ + "stakeable_balance": Balance.from_dict(obj["stakeable_balance"]) if obj.get("stakeable_balance") is not None else None, + "unstakeable_balance": Balance.from_dict(obj["unstakeable_balance"]) if obj.get("unstakeable_balance") is not None else None, + "claimable_balance": Balance.from_dict(obj["claimable_balance"]) if obj.get("claimable_balance") is not None else None + }) return _obj + + diff --git a/cdp/client/models/staking_operation.py b/cdp/client/models/staking_operation.py index 675c1c3..da71bec 100644 --- a/cdp/client/models/staking_operation.py +++ b/cdp/client/models/staking_operation.py @@ -1,60 +1,47 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 -import json + +from __future__ import annotations import pprint import re # noqa: F401 -from typing import Any, ClassVar +import json from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator -from typing_extensions import Self - +from typing import Any, ClassVar, Dict, List, Optional from cdp.client.models.staking_operation_metadata import StakingOperationMetadata from cdp.client.models.transaction import Transaction - +from typing import Optional, Set +from typing_extensions import Self class StakingOperation(BaseModel): - """A list of onchain transactions to help realize a staking action.""" - + """ + A list of onchain transactions to help realize a staking action. + """ # noqa: E501 id: StrictStr = Field(description="The unique ID of the staking operation.") - wallet_id: StrictStr | None = Field( - default=None, description="The ID of the wallet that owns the address." - ) + wallet_id: Optional[StrictStr] = Field(default=None, description="The ID of the wallet that owns the address.") network_id: StrictStr = Field(description="The ID of the blockchain network.") - address_id: StrictStr = Field( - description="The onchain address orchestrating the staking operation." - ) + address_id: StrictStr = Field(description="The onchain address orchestrating the staking operation.") status: StrictStr = Field(description="The status of the staking operation.") - transactions: list[Transaction] = Field( - description="The transaction(s) that will execute the staking operation onchain." - ) - metadata: StakingOperationMetadata | None = None - __properties: ClassVar[list[str]] = [ - "id", - "wallet_id", - "network_id", - "address_id", - "status", - "transactions", - "metadata", - ] - - @field_validator("status") + transactions: List[Transaction] = Field(description="The transaction(s) that will execute the staking operation onchain.") + metadata: Optional[StakingOperationMetadata] = None + __properties: ClassVar[List[str]] = ["id", "wallet_id", "network_id", "address_id", "status", "transactions", "metadata"] + + @field_validator('status') def status_validate_enum(cls, value): """Validates the enum""" - if value not in set(["initialized", "complete", "failed", "unspecified"]): - raise ValueError( - "must be one of enum values ('initialized', 'complete', 'failed', 'unspecified')" - ) + if value not in set(['initialized', 'complete', 'failed', 'unspecified']): + raise ValueError("must be one of enum values ('initialized', 'complete', 'failed', 'unspecified')") return value model_config = ConfigDict( @@ -63,6 +50,7 @@ def status_validate_enum(cls, value): protected_namespaces=(), ) + def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True)) @@ -73,11 +61,11 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self | None: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of StakingOperation from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self) -> dict[str, Any]: + def to_dict(self) -> Dict[str, Any]: """Return the dictionary representation of the model using alias. This has the following differences from calling pydantic's @@ -87,7 +75,8 @@ def to_dict(self) -> dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ - excluded_fields: set[str] = set([]) + excluded_fields: Set[str] = set([ + ]) _dict = self.model_dump( by_alias=True, @@ -100,14 +89,14 @@ def to_dict(self) -> dict[str, Any]: for _item_transactions in self.transactions: if _item_transactions: _items.append(_item_transactions.to_dict()) - _dict["transactions"] = _items + _dict['transactions'] = _items # override the default output from pydantic by calling `to_dict()` of metadata if self.metadata: - _dict["metadata"] = self.metadata.to_dict() + _dict['metadata'] = self.metadata.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of StakingOperation from a dict""" if obj is None: return None @@ -115,19 +104,15 @@ def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate( - { - "id": obj.get("id"), - "wallet_id": obj.get("wallet_id"), - "network_id": obj.get("network_id"), - "address_id": obj.get("address_id"), - "status": obj.get("status"), - "transactions": [Transaction.from_dict(_item) for _item in obj["transactions"]] - if obj.get("transactions") is not None - else None, - "metadata": StakingOperationMetadata.from_dict(obj["metadata"]) - if obj.get("metadata") is not None - else None, - } - ) + _obj = cls.model_validate({ + "id": obj.get("id"), + "wallet_id": obj.get("wallet_id"), + "network_id": obj.get("network_id"), + "address_id": obj.get("address_id"), + "status": obj.get("status"), + "transactions": [Transaction.from_dict(_item) for _item in obj["transactions"]] if obj.get("transactions") is not None else None, + "metadata": StakingOperationMetadata.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None + }) return _obj + + diff --git a/cdp/client/models/staking_operation_metadata.py b/cdp/client/models/staking_operation_metadata.py index ce17613..c694574 100644 --- a/cdp/client/models/staking_operation_metadata.py +++ b/cdp/client/models/staking_operation_metadata.py @@ -1,59 +1,55 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + 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 -from __future__ import annotations +from __future__ import annotations import json import pprint -from typing import Any - -from pydantic import BaseModel, ConfigDict, Field, ValidationError, field_validator -from typing_extensions import Self - -from cdp.client.models.signed_voluntary_exit_message_metadata import ( - SignedVoluntaryExitMessageMetadata, -) +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Any, List, Optional +from cdp.client.models.signed_voluntary_exit_message_metadata import SignedVoluntaryExitMessageMetadata +from pydantic import StrictStr, Field +from typing import Union, List, Set, Optional, Dict +from typing_extensions import Literal, Self STAKINGOPERATIONMETADATA_ONE_OF_SCHEMAS = ["List[SignedVoluntaryExitMessageMetadata]"] - class StakingOperationMetadata(BaseModel): - """StakingOperationMetadata""" - + """ + StakingOperationMetadata + """ # data type: List[SignedVoluntaryExitMessageMetadata] - oneof_schema_1_validator: list[SignedVoluntaryExitMessageMetadata] | None = Field( - default=None, description="Additional metadata needed to power native eth unstaking." - ) - actual_instance: list[SignedVoluntaryExitMessageMetadata] | None = None - one_of_schemas: set[str] = {"List[SignedVoluntaryExitMessageMetadata]"} + oneof_schema_1_validator: Optional[List[SignedVoluntaryExitMessageMetadata]] = Field(default=None, description="Additional metadata needed to power native eth unstaking.") + actual_instance: Optional[Union[List[SignedVoluntaryExitMessageMetadata]]] = None + one_of_schemas: Set[str] = { "List[SignedVoluntaryExitMessageMetadata]" } model_config = ConfigDict( validate_assignment=True, protected_namespaces=(), ) + def __init__(self, *args, **kwargs) -> None: if args: if len(args) > 1: - raise ValueError( - "If a position argument is used, only 1 is allowed to set `actual_instance`" - ) + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") if kwargs: - raise ValueError( - "If a position argument is used, keyword arguments cannot be used." - ) + raise ValueError("If a position argument is used, keyword arguments cannot be used.") super().__init__(actual_instance=args[0]) else: super().__init__(**kwargs) - @field_validator("actual_instance") + @field_validator('actual_instance') def actual_instance_must_validate_oneof(cls, v): instance = StakingOperationMetadata.model_construct() error_messages = [] @@ -66,21 +62,15 @@ def actual_instance_must_validate_oneof(cls, v): error_messages.append(str(e)) if match > 1: # more than 1 match - raise ValueError( - "Multiple matches found when setting `actual_instance` in StakingOperationMetadata with oneOf schemas: List[SignedVoluntaryExitMessageMetadata]. Details: " - + ", ".join(error_messages) - ) + raise ValueError("Multiple matches found when setting `actual_instance` in StakingOperationMetadata with oneOf schemas: List[SignedVoluntaryExitMessageMetadata]. Details: " + ", ".join(error_messages)) elif match == 0: # no match - raise ValueError( - "No match found when setting `actual_instance` in StakingOperationMetadata with oneOf schemas: List[SignedVoluntaryExitMessageMetadata]. Details: " - + ", ".join(error_messages) - ) + raise ValueError("No match found when setting `actual_instance` in StakingOperationMetadata with oneOf schemas: List[SignedVoluntaryExitMessageMetadata]. Details: " + ", ".join(error_messages)) else: return v @classmethod - def from_dict(cls, obj: str | dict[str, Any]) -> Self: + def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self: return cls.from_json(json.dumps(obj)) @classmethod @@ -102,16 +92,10 @@ def from_json(cls, json_str: str) -> Self: if match > 1: # more than 1 match - raise ValueError( - "Multiple matches found when deserializing the JSON string into StakingOperationMetadata with oneOf schemas: List[SignedVoluntaryExitMessageMetadata]. Details: " - + ", ".join(error_messages) - ) + raise ValueError("Multiple matches found when deserializing the JSON string into StakingOperationMetadata with oneOf schemas: List[SignedVoluntaryExitMessageMetadata]. Details: " + ", ".join(error_messages)) elif match == 0: # no match - raise ValueError( - "No match found when deserializing the JSON string into StakingOperationMetadata with oneOf schemas: List[SignedVoluntaryExitMessageMetadata]. Details: " - + ", ".join(error_messages) - ) + raise ValueError("No match found when deserializing the JSON string into StakingOperationMetadata with oneOf schemas: List[SignedVoluntaryExitMessageMetadata]. Details: " + ", ".join(error_messages)) else: return instance @@ -125,7 +109,7 @@ def to_json(self) -> str: else: return json.dumps(self.actual_instance) - def to_dict(self) -> dict[str, Any] | list[SignedVoluntaryExitMessageMetadata] | None: + def to_dict(self) -> Optional[Union[Dict[str, Any], List[SignedVoluntaryExitMessageMetadata]]]: """Returns the dict representation of the actual instance""" if self.actual_instance is None: return None @@ -139,3 +123,5 @@ def to_dict(self) -> dict[str, Any] | list[SignedVoluntaryExitMessageMetadata] | def to_str(self) -> str: """Returns the string representation of the actual instance""" return pprint.pformat(self.model_dump()) + + diff --git a/cdp/client/models/staking_reward.py b/cdp/client/models/staking_reward.py index 90ae5eb..0dd6649 100644 --- a/cdp/client/models/staking_reward.py +++ b/cdp/client/models/staking_reward.py @@ -1,54 +1,46 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 -import json + +from __future__ import annotations import pprint import re # noqa: F401 -from datetime import datetime -from typing import Any, ClassVar +import json +from datetime import datetime from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator -from typing_extensions import Self - +from typing import Any, ClassVar, Dict, List from cdp.client.models.staking_reward_format import StakingRewardFormat from cdp.client.models.staking_reward_usd_value import StakingRewardUSDValue - +from typing import Optional, Set +from typing_extensions import Self class StakingReward(BaseModel): - """The staking rewards for an address.""" - - address_id: StrictStr = Field( - description="The onchain address for which the staking rewards are being fetched." - ) + """ + The staking rewards for an address. + """ # noqa: E501 + address_id: StrictStr = Field(description="The onchain address for which the staking rewards are being fetched.") var_date: datetime = Field(description="The timestamp of the reward in UTC.", alias="date") - amount: StrictStr = Field( - description='The reward amount in requested "format". Default is USD.' - ) + amount: StrictStr = Field(description="The reward amount in requested \"format\". Default is USD.") state: StrictStr = Field(description="The state of the reward.") format: StakingRewardFormat usd_value: StakingRewardUSDValue - __properties: ClassVar[list[str]] = [ - "address_id", - "date", - "amount", - "state", - "format", - "usd_value", - ] - - @field_validator("state") + __properties: ClassVar[List[str]] = ["address_id", "date", "amount", "state", "format", "usd_value"] + + @field_validator('state') def state_validate_enum(cls, value): """Validates the enum""" - if value not in set(["pending", "distributed"]): + if value not in set(['pending', 'distributed']): raise ValueError("must be one of enum values ('pending', 'distributed')") return value @@ -58,6 +50,7 @@ def state_validate_enum(cls, value): protected_namespaces=(), ) + def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True)) @@ -68,11 +61,11 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self | None: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of StakingReward from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self) -> dict[str, Any]: + def to_dict(self) -> Dict[str, Any]: """Return the dictionary representation of the model using alias. This has the following differences from calling pydantic's @@ -82,7 +75,8 @@ def to_dict(self) -> dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ - excluded_fields: set[str] = set([]) + excluded_fields: Set[str] = set([ + ]) _dict = self.model_dump( by_alias=True, @@ -91,11 +85,11 @@ def to_dict(self) -> dict[str, Any]: ) # override the default output from pydantic by calling `to_dict()` of usd_value if self.usd_value: - _dict["usd_value"] = self.usd_value.to_dict() + _dict['usd_value'] = self.usd_value.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of StakingReward from a dict""" if obj is None: return None @@ -103,18 +97,14 @@ def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate( - { - "address_id": obj.get("address_id"), - "date": obj.get("date"), - "amount": obj.get("amount"), - "state": obj.get("state"), - "format": obj.get("format") - if obj.get("format") is not None - else StakingRewardFormat.USD, - "usd_value": StakingRewardUSDValue.from_dict(obj["usd_value"]) - if obj.get("usd_value") is not None - else None, - } - ) + _obj = cls.model_validate({ + "address_id": obj.get("address_id"), + "date": obj.get("date"), + "amount": obj.get("amount"), + "state": obj.get("state"), + "format": obj.get("format") if obj.get("format") is not None else StakingRewardFormat.USD, + "usd_value": StakingRewardUSDValue.from_dict(obj["usd_value"]) if obj.get("usd_value") is not None else None + }) return _obj + + diff --git a/cdp/client/models/staking_reward_format.py b/cdp/client/models/staking_reward_format.py index e3c5b5a..018c9df 100644 --- a/cdp/client/models/staking_reward_format.py +++ b/cdp/client/models/staking_reward_format.py @@ -1,31 +1,37 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 + +from __future__ import annotations import json from enum import Enum - from typing_extensions import Self class StakingRewardFormat(str, Enum): - """The format in which the rewards are to be fetched i.e native or in equivalent USD""" + """ + The format in which the rewards are to be fetched i.e native or in equivalent USD + """ """ allowed enum values """ - USD = "usd" - NATIVE = "native" + USD = 'usd' + NATIVE = 'native' @classmethod def from_json(cls, json_str: str) -> Self: """Create an instance of StakingRewardFormat from a JSON string""" return cls(json.loads(json_str)) + + diff --git a/cdp/client/models/staking_reward_usd_value.py b/cdp/client/models/staking_reward_usd_value.py index 6000cd4..0ac8f1c 100644 --- a/cdp/client/models/staking_reward_usd_value.py +++ b/cdp/client/models/staking_reward_usd_value.py @@ -1,34 +1,36 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 -import json + +from __future__ import annotations import pprint import re # noqa: F401 -from datetime import datetime -from typing import Any, ClassVar +import json +from datetime import datetime from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set from typing_extensions import Self - class StakingRewardUSDValue(BaseModel): - """The USD value of the reward""" - + """ + The USD value of the reward + """ # noqa: E501 amount: StrictStr = Field(description="The value of the reward in USD") - conversion_price: StrictStr = Field( - description="The conversion price from native currency to USD" - ) + conversion_price: StrictStr = Field(description="The conversion price from native currency to USD") conversion_time: datetime = Field(description="The time of the conversion in UTC.") - __properties: ClassVar[list[str]] = ["amount", "conversion_price", "conversion_time"] + __properties: ClassVar[List[str]] = ["amount", "conversion_price", "conversion_time"] model_config = ConfigDict( populate_by_name=True, @@ -36,6 +38,7 @@ class StakingRewardUSDValue(BaseModel): protected_namespaces=(), ) + def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True)) @@ -46,11 +49,11 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self | None: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of StakingRewardUSDValue from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self) -> dict[str, Any]: + def to_dict(self) -> Dict[str, Any]: """Return the dictionary representation of the model using alias. This has the following differences from calling pydantic's @@ -60,7 +63,8 @@ def to_dict(self) -> dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ - excluded_fields: set[str] = set([]) + excluded_fields: Set[str] = set([ + ]) _dict = self.model_dump( by_alias=True, @@ -70,7 +74,7 @@ def to_dict(self) -> dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of StakingRewardUSDValue from a dict""" if obj is None: return None @@ -78,11 +82,11 @@ def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate( - { - "amount": obj.get("amount"), - "conversion_price": obj.get("conversion_price"), - "conversion_time": obj.get("conversion_time"), - } - ) + _obj = cls.model_validate({ + "amount": obj.get("amount"), + "conversion_price": obj.get("conversion_price"), + "conversion_time": obj.get("conversion_time") + }) return _obj + + diff --git a/cdp/client/models/token_contract_options.py b/cdp/client/models/token_contract_options.py index 309aa36..e1b9676 100644 --- a/cdp/client/models/token_contract_options.py +++ b/cdp/client/models/token_contract_options.py @@ -1,33 +1,35 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 -import json + +from __future__ import annotations import pprint import re # noqa: F401 -from typing import Any, ClassVar +import json from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set from typing_extensions import Self - class TokenContractOptions(BaseModel): - """Options for token contract creation""" - + """ + Options for token contract creation + """ # noqa: E501 name: StrictStr = Field(description="The name of the token") symbol: StrictStr = Field(description="The symbol of the token") - total_supply: StrictStr = Field( - description="The total supply of the token denominated in the whole amount of the token." - ) - __properties: ClassVar[list[str]] = ["name", "symbol", "total_supply"] + total_supply: StrictStr = Field(description="The total supply of the token denominated in the whole amount of the token.") + __properties: ClassVar[List[str]] = ["name", "symbol", "total_supply"] model_config = ConfigDict( populate_by_name=True, @@ -35,6 +37,7 @@ class TokenContractOptions(BaseModel): protected_namespaces=(), ) + def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True)) @@ -45,11 +48,11 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self | None: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of TokenContractOptions from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self) -> dict[str, Any]: + def to_dict(self) -> Dict[str, Any]: """Return the dictionary representation of the model using alias. This has the following differences from calling pydantic's @@ -59,7 +62,8 @@ def to_dict(self) -> dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ - excluded_fields: set[str] = set([]) + excluded_fields: Set[str] = set([ + ]) _dict = self.model_dump( by_alias=True, @@ -69,7 +73,7 @@ def to_dict(self) -> dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of TokenContractOptions from a dict""" if obj is None: return None @@ -77,11 +81,11 @@ def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate( - { - "name": obj.get("name"), - "symbol": obj.get("symbol"), - "total_supply": obj.get("total_supply"), - } - ) + _obj = cls.model_validate({ + "name": obj.get("name"), + "symbol": obj.get("symbol"), + "total_supply": obj.get("total_supply") + }) return _obj + + diff --git a/cdp/client/models/trade.py b/cdp/client/models/trade.py index 946a475..701a787 100644 --- a/cdp/client/models/trade.py +++ b/cdp/client/models/trade.py @@ -1,56 +1,44 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 -import json + +from __future__ import annotations import pprint import re # noqa: F401 -from typing import Any, ClassVar +import json from pydantic import BaseModel, ConfigDict, Field, StrictStr -from typing_extensions import Self - +from typing import Any, ClassVar, Dict, List, Optional from cdp.client.models.asset import Asset from cdp.client.models.transaction import Transaction - +from typing import Optional, Set +from typing_extensions import Self class Trade(BaseModel): - """A trade of an asset to another asset""" - + """ + A trade of an asset to another asset + """ # noqa: E501 network_id: StrictStr = Field(description="The ID of the blockchain network") wallet_id: StrictStr = Field(description="The ID of the wallet that owns the from address") address_id: StrictStr = Field(description="The onchain address of the sender") trade_id: StrictStr = Field(description="The ID of the trade") - from_amount: StrictStr = Field( - description="The amount of the from asset to be traded (in atomic units of the from asset)" - ) + from_amount: StrictStr = Field(description="The amount of the from asset to be traded (in atomic units of the from asset)") from_asset: Asset - to_amount: StrictStr = Field( - description="The amount of the to asset that will be received (in atomic units of the to asset)" - ) + to_amount: StrictStr = Field(description="The amount of the to asset that will be received (in atomic units of the to asset)") to_asset: Asset transaction: Transaction - approve_transaction: Transaction | None = None - __properties: ClassVar[list[str]] = [ - "network_id", - "wallet_id", - "address_id", - "trade_id", - "from_amount", - "from_asset", - "to_amount", - "to_asset", - "transaction", - "approve_transaction", - ] + approve_transaction: Optional[Transaction] = None + __properties: ClassVar[List[str]] = ["network_id", "wallet_id", "address_id", "trade_id", "from_amount", "from_asset", "to_amount", "to_asset", "transaction", "approve_transaction"] model_config = ConfigDict( populate_by_name=True, @@ -58,6 +46,7 @@ class Trade(BaseModel): protected_namespaces=(), ) + def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True)) @@ -68,11 +57,11 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self | None: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Trade from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self) -> dict[str, Any]: + def to_dict(self) -> Dict[str, Any]: """Return the dictionary representation of the model using alias. This has the following differences from calling pydantic's @@ -82,7 +71,8 @@ def to_dict(self) -> dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ - excluded_fields: set[str] = set([]) + excluded_fields: Set[str] = set([ + ]) _dict = self.model_dump( by_alias=True, @@ -91,20 +81,20 @@ def to_dict(self) -> dict[str, Any]: ) # override the default output from pydantic by calling `to_dict()` of from_asset if self.from_asset: - _dict["from_asset"] = self.from_asset.to_dict() + _dict['from_asset'] = self.from_asset.to_dict() # override the default output from pydantic by calling `to_dict()` of to_asset if self.to_asset: - _dict["to_asset"] = self.to_asset.to_dict() + _dict['to_asset'] = self.to_asset.to_dict() # override the default output from pydantic by calling `to_dict()` of transaction if self.transaction: - _dict["transaction"] = self.transaction.to_dict() + _dict['transaction'] = self.transaction.to_dict() # override the default output from pydantic by calling `to_dict()` of approve_transaction if self.approve_transaction: - _dict["approve_transaction"] = self.approve_transaction.to_dict() + _dict['approve_transaction'] = self.approve_transaction.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of Trade from a dict""" if obj is None: return None @@ -112,26 +102,18 @@ def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate( - { - "network_id": obj.get("network_id"), - "wallet_id": obj.get("wallet_id"), - "address_id": obj.get("address_id"), - "trade_id": obj.get("trade_id"), - "from_amount": obj.get("from_amount"), - "from_asset": Asset.from_dict(obj["from_asset"]) - if obj.get("from_asset") is not None - else None, - "to_amount": obj.get("to_amount"), - "to_asset": Asset.from_dict(obj["to_asset"]) - if obj.get("to_asset") is not None - else None, - "transaction": Transaction.from_dict(obj["transaction"]) - if obj.get("transaction") is not None - else None, - "approve_transaction": Transaction.from_dict(obj["approve_transaction"]) - if obj.get("approve_transaction") is not None - else None, - } - ) + _obj = cls.model_validate({ + "network_id": obj.get("network_id"), + "wallet_id": obj.get("wallet_id"), + "address_id": obj.get("address_id"), + "trade_id": obj.get("trade_id"), + "from_amount": obj.get("from_amount"), + "from_asset": Asset.from_dict(obj["from_asset"]) if obj.get("from_asset") is not None else None, + "to_amount": obj.get("to_amount"), + "to_asset": Asset.from_dict(obj["to_asset"]) if obj.get("to_asset") is not None else None, + "transaction": Transaction.from_dict(obj["transaction"]) if obj.get("transaction") is not None else None, + "approve_transaction": Transaction.from_dict(obj["approve_transaction"]) if obj.get("approve_transaction") is not None else None + }) return _obj + + diff --git a/cdp/client/models/trade_list.py b/cdp/client/models/trade_list.py index ad699a9..3d4667f 100644 --- a/cdp/client/models/trade_list.py +++ b/cdp/client/models/trade_list.py @@ -1,38 +1,37 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 -import json + +from __future__ import annotations import pprint import re # noqa: F401 -from typing import Any, ClassVar +import json from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr -from typing_extensions import Self - +from typing import Any, ClassVar, Dict, List from cdp.client.models.trade import Trade - +from typing import Optional, Set +from typing_extensions import Self class TradeList(BaseModel): - """ """ - - data: list[Trade] - has_more: StrictBool = Field( - description="True if this list has another page of items after this one that can be fetched." - ) + """ + + """ # noqa: E501 + data: List[Trade] + has_more: StrictBool = Field(description="True if this list has another page of items after this one that can be fetched.") next_page: StrictStr = Field(description="The page token to be used to fetch the next page.") - total_count: StrictInt = Field( - description="The total number of trades for the address in the wallet." - ) - __properties: ClassVar[list[str]] = ["data", "has_more", "next_page", "total_count"] + total_count: StrictInt = Field(description="The total number of trades for the address in the wallet.") + __properties: ClassVar[List[str]] = ["data", "has_more", "next_page", "total_count"] model_config = ConfigDict( populate_by_name=True, @@ -40,6 +39,7 @@ class TradeList(BaseModel): protected_namespaces=(), ) + def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True)) @@ -50,11 +50,11 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self | None: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of TradeList from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self) -> dict[str, Any]: + def to_dict(self) -> Dict[str, Any]: """Return the dictionary representation of the model using alias. This has the following differences from calling pydantic's @@ -64,7 +64,8 @@ def to_dict(self) -> dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ - excluded_fields: set[str] = set([]) + excluded_fields: Set[str] = set([ + ]) _dict = self.model_dump( by_alias=True, @@ -77,11 +78,11 @@ def to_dict(self) -> dict[str, Any]: for _item_data in self.data: if _item_data: _items.append(_item_data.to_dict()) - _dict["data"] = _items + _dict['data'] = _items return _dict @classmethod - def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of TradeList from a dict""" if obj is None: return None @@ -89,14 +90,12 @@ def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate( - { - "data": [Trade.from_dict(_item) for _item in obj["data"]] - if obj.get("data") is not None - else None, - "has_more": obj.get("has_more"), - "next_page": obj.get("next_page"), - "total_count": obj.get("total_count"), - } - ) + _obj = cls.model_validate({ + "data": [Trade.from_dict(_item) for _item in obj["data"]] if obj.get("data") is not None else None, + "has_more": obj.get("has_more"), + "next_page": obj.get("next_page"), + "total_count": obj.get("total_count") + }) return _obj + + diff --git a/cdp/client/models/transaction.py b/cdp/client/models/transaction.py index 9bcf60b..594a1ff 100644 --- a/cdp/client/models/transaction.py +++ b/cdp/client/models/transaction.py @@ -1,79 +1,50 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 -import json + +from __future__ import annotations import pprint import re # noqa: F401 -from typing import Any, ClassVar +import json from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator -from typing_extensions import Self - +from typing import Any, ClassVar, Dict, List, Optional from cdp.client.models.transaction_content import TransactionContent - +from typing import Optional, Set +from typing_extensions import Self class Transaction(BaseModel): - """An onchain transaction.""" - + """ + An onchain transaction. + """ # noqa: E501 network_id: StrictStr = Field(description="The ID of the blockchain network.") - block_hash: StrictStr | None = Field( - default=None, description="The hash of the block at which the transaction was recorded." - ) - block_height: StrictStr | None = Field( - default=None, description="The block height at which the transaction was recorded." - ) + block_hash: Optional[StrictStr] = Field(default=None, description="The hash of the block at which the transaction was recorded.") + block_height: Optional[StrictStr] = Field(default=None, description="The block height at which the transaction was recorded.") from_address_id: StrictStr = Field(description="The onchain address of the sender.") - to_address_id: StrictStr | None = Field( - default=None, description="The onchain address of the recipient." - ) - unsigned_payload: StrictStr = Field( - description="The unsigned payload of the transaction. This is the payload that needs to be signed by the sender." - ) - signed_payload: StrictStr | None = Field( - default=None, - description="The signed payload of the transaction. This is the payload that has been signed by the sender.", - ) - transaction_hash: StrictStr | None = Field( - default=None, description="The hash of the transaction." - ) - transaction_link: StrictStr | None = Field( - default=None, - description="The link to view the transaction on a block explorer. This is optional and may not be present for all transactions.", - ) + to_address_id: Optional[StrictStr] = Field(default=None, description="The onchain address of the recipient.") + unsigned_payload: StrictStr = Field(description="The unsigned payload of the transaction. This is the payload that needs to be signed by the sender.") + signed_payload: Optional[StrictStr] = Field(default=None, description="The signed payload of the transaction. This is the payload that has been signed by the sender.") + transaction_hash: Optional[StrictStr] = Field(default=None, description="The hash of the transaction.") + transaction_link: Optional[StrictStr] = Field(default=None, description="The link to view the transaction on a block explorer. This is optional and may not be present for all transactions.") status: StrictStr = Field(description="The status of the transaction.") - content: TransactionContent | None = None - __properties: ClassVar[list[str]] = [ - "network_id", - "block_hash", - "block_height", - "from_address_id", - "to_address_id", - "unsigned_payload", - "signed_payload", - "transaction_hash", - "transaction_link", - "status", - "content", - ] - - @field_validator("status") + content: Optional[TransactionContent] = None + __properties: ClassVar[List[str]] = ["network_id", "block_hash", "block_height", "from_address_id", "to_address_id", "unsigned_payload", "signed_payload", "transaction_hash", "transaction_link", "status", "content"] + + @field_validator('status') def status_validate_enum(cls, value): """Validates the enum""" - if value not in set( - ["pending", "signed", "broadcast", "complete", "failed", "unspecified"] - ): - raise ValueError( - "must be one of enum values ('pending', 'signed', 'broadcast', 'complete', 'failed', 'unspecified')" - ) + if value not in set(['pending', 'signed', 'broadcast', 'complete', 'failed', 'unspecified']): + raise ValueError("must be one of enum values ('pending', 'signed', 'broadcast', 'complete', 'failed', 'unspecified')") return value model_config = ConfigDict( @@ -82,6 +53,7 @@ def status_validate_enum(cls, value): protected_namespaces=(), ) + def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True)) @@ -92,11 +64,11 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self | None: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Transaction from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self) -> dict[str, Any]: + def to_dict(self) -> Dict[str, Any]: """Return the dictionary representation of the model using alias. This has the following differences from calling pydantic's @@ -106,7 +78,8 @@ def to_dict(self) -> dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ - excluded_fields: set[str] = set([]) + excluded_fields: Set[str] = set([ + ]) _dict = self.model_dump( by_alias=True, @@ -115,11 +88,11 @@ def to_dict(self) -> dict[str, Any]: ) # override the default output from pydantic by calling `to_dict()` of content if self.content: - _dict["content"] = self.content.to_dict() + _dict['content'] = self.content.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of Transaction from a dict""" if obj is None: return None @@ -127,21 +100,19 @@ def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate( - { - "network_id": obj.get("network_id"), - "block_hash": obj.get("block_hash"), - "block_height": obj.get("block_height"), - "from_address_id": obj.get("from_address_id"), - "to_address_id": obj.get("to_address_id"), - "unsigned_payload": obj.get("unsigned_payload"), - "signed_payload": obj.get("signed_payload"), - "transaction_hash": obj.get("transaction_hash"), - "transaction_link": obj.get("transaction_link"), - "status": obj.get("status"), - "content": TransactionContent.from_dict(obj["content"]) - if obj.get("content") is not None - else None, - } - ) + _obj = cls.model_validate({ + "network_id": obj.get("network_id"), + "block_hash": obj.get("block_hash"), + "block_height": obj.get("block_height"), + "from_address_id": obj.get("from_address_id"), + "to_address_id": obj.get("to_address_id"), + "unsigned_payload": obj.get("unsigned_payload"), + "signed_payload": obj.get("signed_payload"), + "transaction_hash": obj.get("transaction_hash"), + "transaction_link": obj.get("transaction_link"), + "status": obj.get("status"), + "content": TransactionContent.from_dict(obj["content"]) if obj.get("content") is not None else None + }) return _obj + + diff --git a/cdp/client/models/transaction_content.py b/cdp/client/models/transaction_content.py index d4cb21a..32208ab 100644 --- a/cdp/client/models/transaction_content.py +++ b/cdp/client/models/transaction_content.py @@ -1,55 +1,55 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 + +from __future__ import annotations import json import pprint -from typing import Any - -from pydantic import BaseModel, ConfigDict, ValidationError, field_validator -from typing_extensions import Self - +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Any, List, Optional from cdp.client.models.ethereum_transaction import EthereumTransaction +from pydantic import StrictStr, Field +from typing import Union, List, Set, Optional, Dict +from typing_extensions import Literal, Self TRANSACTIONCONTENT_ONE_OF_SCHEMAS = ["EthereumTransaction"] - class TransactionContent(BaseModel): - """TransactionContent""" - + """ + TransactionContent + """ # data type: EthereumTransaction - oneof_schema_1_validator: EthereumTransaction | None = None - actual_instance: EthereumTransaction | None = None - one_of_schemas: set[str] = {"EthereumTransaction"} + oneof_schema_1_validator: Optional[EthereumTransaction] = None + actual_instance: Optional[Union[EthereumTransaction]] = None + one_of_schemas: Set[str] = { "EthereumTransaction" } model_config = ConfigDict( validate_assignment=True, protected_namespaces=(), ) + def __init__(self, *args, **kwargs) -> None: if args: if len(args) > 1: - raise ValueError( - "If a position argument is used, only 1 is allowed to set `actual_instance`" - ) + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") if kwargs: - raise ValueError( - "If a position argument is used, keyword arguments cannot be used." - ) + raise ValueError("If a position argument is used, keyword arguments cannot be used.") super().__init__(actual_instance=args[0]) else: super().__init__(**kwargs) - @field_validator("actual_instance") + @field_validator('actual_instance') def actual_instance_must_validate_oneof(cls, v): instance = TransactionContent.model_construct() error_messages = [] @@ -61,21 +61,15 @@ def actual_instance_must_validate_oneof(cls, v): match += 1 if match > 1: # more than 1 match - raise ValueError( - "Multiple matches found when setting `actual_instance` in TransactionContent with oneOf schemas: EthereumTransaction. Details: " - + ", ".join(error_messages) - ) + raise ValueError("Multiple matches found when setting `actual_instance` in TransactionContent with oneOf schemas: EthereumTransaction. Details: " + ", ".join(error_messages)) elif match == 0: # no match - raise ValueError( - "No match found when setting `actual_instance` in TransactionContent with oneOf schemas: EthereumTransaction. Details: " - + ", ".join(error_messages) - ) + raise ValueError("No match found when setting `actual_instance` in TransactionContent with oneOf schemas: EthereumTransaction. Details: " + ", ".join(error_messages)) else: return v @classmethod - def from_dict(cls, obj: str | dict[str, Any]) -> Self: + def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self: return cls.from_json(json.dumps(obj)) @classmethod @@ -94,16 +88,10 @@ def from_json(cls, json_str: str) -> Self: if match > 1: # more than 1 match - raise ValueError( - "Multiple matches found when deserializing the JSON string into TransactionContent with oneOf schemas: EthereumTransaction. Details: " - + ", ".join(error_messages) - ) + raise ValueError("Multiple matches found when deserializing the JSON string into TransactionContent with oneOf schemas: EthereumTransaction. Details: " + ", ".join(error_messages)) elif match == 0: # no match - raise ValueError( - "No match found when deserializing the JSON string into TransactionContent with oneOf schemas: EthereumTransaction. Details: " - + ", ".join(error_messages) - ) + raise ValueError("No match found when deserializing the JSON string into TransactionContent with oneOf schemas: EthereumTransaction. Details: " + ", ".join(error_messages)) else: return instance @@ -117,7 +105,7 @@ def to_json(self) -> str: else: return json.dumps(self.actual_instance) - def to_dict(self) -> dict[str, Any] | EthereumTransaction | None: + def to_dict(self) -> Optional[Union[Dict[str, Any], EthereumTransaction]]: """Returns the dict representation of the actual instance""" if self.actual_instance is None: return None @@ -131,3 +119,5 @@ def to_dict(self) -> dict[str, Any] | EthereumTransaction | None: def to_str(self) -> str: """Returns the string representation of the actual instance""" return pprint.pformat(self.model_dump()) + + diff --git a/cdp/client/models/transaction_type.py b/cdp/client/models/transaction_type.py index dca5e24..ea0092e 100644 --- a/cdp/client/models/transaction_type.py +++ b/cdp/client/models/transaction_type.py @@ -1,30 +1,36 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 + +from __future__ import annotations import json from enum import Enum - from typing_extensions import Self class TransactionType(str, Enum): - """TransactionType""" + """ + TransactionType + """ """ allowed enum values """ - TRANSFER = "transfer" + TRANSFER = 'transfer' @classmethod def from_json(cls, json_str: str) -> Self: """Create an instance of TransactionType from a JSON string""" return cls(json.loads(json_str)) + + diff --git a/cdp/client/models/transfer.py b/cdp/client/models/transfer.py index 6f7bcbf..2b6fb1a 100644 --- a/cdp/client/models/transfer.py +++ b/cdp/client/models/transfer.py @@ -1,31 +1,34 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 -import json + +from __future__ import annotations import pprint import re # noqa: F401 -from typing import Any, ClassVar +import json from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator -from typing_extensions import Self - +from typing import Any, ClassVar, Dict, List, Optional from cdp.client.models.asset import Asset from cdp.client.models.sponsored_send import SponsoredSend from cdp.client.models.transaction import Transaction - +from typing import Optional, Set +from typing_extensions import Self class Transfer(BaseModel): - """A transfer of an asset from one address to another""" - + """ + A transfer of an asset from one address to another + """ # noqa: E501 network_id: StrictStr = Field(description="The ID of the blockchain network") wallet_id: StrictStr = Field(description="The ID of the wallet that owns the from address") address_id: StrictStr = Field(description="The onchain address of the sender") @@ -34,49 +37,23 @@ class Transfer(BaseModel): asset_id: StrictStr = Field(description="The ID of the asset being transferred") asset: Asset transfer_id: StrictStr = Field(description="The ID of the transfer") - transaction: Transaction | None = None - sponsored_send: SponsoredSend | None = None - unsigned_payload: StrictStr | None = Field( - default=None, - description="The unsigned payload of the transfer. This is the payload that needs to be signed by the sender.", - ) - signed_payload: StrictStr | None = Field( - default=None, - description="The signed payload of the transfer. This is the payload that has been signed by the sender.", - ) - transaction_hash: StrictStr | None = Field( - default=None, description="The hash of the transfer transaction" - ) - status: StrictStr | None = Field(default=None, description="The status of the transfer") + transaction: Optional[Transaction] = None + sponsored_send: Optional[SponsoredSend] = None + unsigned_payload: Optional[StrictStr] = Field(default=None, description="The unsigned payload of the transfer. This is the payload that needs to be signed by the sender.") + signed_payload: Optional[StrictStr] = Field(default=None, description="The signed payload of the transfer. This is the payload that has been signed by the sender.") + transaction_hash: Optional[StrictStr] = Field(default=None, description="The hash of the transfer transaction") + status: Optional[StrictStr] = Field(default=None, description="The status of the transfer") gasless: StrictBool = Field(description="Whether the transfer uses sponsored gas") - __properties: ClassVar[list[str]] = [ - "network_id", - "wallet_id", - "address_id", - "destination", - "amount", - "asset_id", - "asset", - "transfer_id", - "transaction", - "sponsored_send", - "unsigned_payload", - "signed_payload", - "transaction_hash", - "status", - "gasless", - ] - - @field_validator("status") + __properties: ClassVar[List[str]] = ["network_id", "wallet_id", "address_id", "destination", "amount", "asset_id", "asset", "transfer_id", "transaction", "sponsored_send", "unsigned_payload", "signed_payload", "transaction_hash", "status", "gasless"] + + @field_validator('status') def status_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in set(["pending", "broadcast", "complete", "failed"]): - raise ValueError( - "must be one of enum values ('pending', 'broadcast', 'complete', 'failed')" - ) + if value not in set(['pending', 'broadcast', 'complete', 'failed']): + raise ValueError("must be one of enum values ('pending', 'broadcast', 'complete', 'failed')") return value model_config = ConfigDict( @@ -85,6 +62,7 @@ def status_validate_enum(cls, value): protected_namespaces=(), ) + def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True)) @@ -95,11 +73,11 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self | None: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Transfer from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self) -> dict[str, Any]: + def to_dict(self) -> Dict[str, Any]: """Return the dictionary representation of the model using alias. This has the following differences from calling pydantic's @@ -109,7 +87,8 @@ def to_dict(self) -> dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ - excluded_fields: set[str] = set([]) + excluded_fields: Set[str] = set([ + ]) _dict = self.model_dump( by_alias=True, @@ -118,17 +97,17 @@ def to_dict(self) -> dict[str, Any]: ) # override the default output from pydantic by calling `to_dict()` of asset if self.asset: - _dict["asset"] = self.asset.to_dict() + _dict['asset'] = self.asset.to_dict() # override the default output from pydantic by calling `to_dict()` of transaction if self.transaction: - _dict["transaction"] = self.transaction.to_dict() + _dict['transaction'] = self.transaction.to_dict() # override the default output from pydantic by calling `to_dict()` of sponsored_send if self.sponsored_send: - _dict["sponsored_send"] = self.sponsored_send.to_dict() + _dict['sponsored_send'] = self.sponsored_send.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of Transfer from a dict""" if obj is None: return None @@ -136,27 +115,23 @@ def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate( - { - "network_id": obj.get("network_id"), - "wallet_id": obj.get("wallet_id"), - "address_id": obj.get("address_id"), - "destination": obj.get("destination"), - "amount": obj.get("amount"), - "asset_id": obj.get("asset_id"), - "asset": Asset.from_dict(obj["asset"]) if obj.get("asset") is not None else None, - "transfer_id": obj.get("transfer_id"), - "transaction": Transaction.from_dict(obj["transaction"]) - if obj.get("transaction") is not None - else None, - "sponsored_send": SponsoredSend.from_dict(obj["sponsored_send"]) - if obj.get("sponsored_send") is not None - else None, - "unsigned_payload": obj.get("unsigned_payload"), - "signed_payload": obj.get("signed_payload"), - "transaction_hash": obj.get("transaction_hash"), - "status": obj.get("status"), - "gasless": obj.get("gasless"), - } - ) + _obj = cls.model_validate({ + "network_id": obj.get("network_id"), + "wallet_id": obj.get("wallet_id"), + "address_id": obj.get("address_id"), + "destination": obj.get("destination"), + "amount": obj.get("amount"), + "asset_id": obj.get("asset_id"), + "asset": Asset.from_dict(obj["asset"]) if obj.get("asset") is not None else None, + "transfer_id": obj.get("transfer_id"), + "transaction": Transaction.from_dict(obj["transaction"]) if obj.get("transaction") is not None else None, + "sponsored_send": SponsoredSend.from_dict(obj["sponsored_send"]) if obj.get("sponsored_send") is not None else None, + "unsigned_payload": obj.get("unsigned_payload"), + "signed_payload": obj.get("signed_payload"), + "transaction_hash": obj.get("transaction_hash"), + "status": obj.get("status"), + "gasless": obj.get("gasless") + }) return _obj + + diff --git a/cdp/client/models/transfer_list.py b/cdp/client/models/transfer_list.py index 99b9332..d202f9e 100644 --- a/cdp/client/models/transfer_list.py +++ b/cdp/client/models/transfer_list.py @@ -1,38 +1,37 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 -import json + +from __future__ import annotations import pprint import re # noqa: F401 -from typing import Any, ClassVar +import json from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr -from typing_extensions import Self - +from typing import Any, ClassVar, Dict, List from cdp.client.models.transfer import Transfer - +from typing import Optional, Set +from typing_extensions import Self class TransferList(BaseModel): - """ """ - - data: list[Transfer] - has_more: StrictBool = Field( - description="True if this list has another page of items after this one that can be fetched." - ) + """ + + """ # noqa: E501 + data: List[Transfer] + has_more: StrictBool = Field(description="True if this list has another page of items after this one that can be fetched.") next_page: StrictStr = Field(description="The page token to be used to fetch the next page.") - total_count: StrictInt = Field( - description="The total number of transfers for the address in the wallet." - ) - __properties: ClassVar[list[str]] = ["data", "has_more", "next_page", "total_count"] + total_count: StrictInt = Field(description="The total number of transfers for the address in the wallet.") + __properties: ClassVar[List[str]] = ["data", "has_more", "next_page", "total_count"] model_config = ConfigDict( populate_by_name=True, @@ -40,6 +39,7 @@ class TransferList(BaseModel): protected_namespaces=(), ) + def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True)) @@ -50,11 +50,11 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self | None: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of TransferList from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self) -> dict[str, Any]: + def to_dict(self) -> Dict[str, Any]: """Return the dictionary representation of the model using alias. This has the following differences from calling pydantic's @@ -64,7 +64,8 @@ def to_dict(self) -> dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ - excluded_fields: set[str] = set([]) + excluded_fields: Set[str] = set([ + ]) _dict = self.model_dump( by_alias=True, @@ -77,11 +78,11 @@ def to_dict(self) -> dict[str, Any]: for _item_data in self.data: if _item_data: _items.append(_item_data.to_dict()) - _dict["data"] = _items + _dict['data'] = _items return _dict @classmethod - def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of TransferList from a dict""" if obj is None: return None @@ -89,14 +90,12 @@ def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate( - { - "data": [Transfer.from_dict(_item) for _item in obj["data"]] - if obj.get("data") is not None - else None, - "has_more": obj.get("has_more"), - "next_page": obj.get("next_page"), - "total_count": obj.get("total_count"), - } - ) + _obj = cls.model_validate({ + "data": [Transfer.from_dict(_item) for _item in obj["data"]] if obj.get("data") is not None else None, + "has_more": obj.get("has_more"), + "next_page": obj.get("next_page"), + "total_count": obj.get("total_count") + }) return _obj + + diff --git a/cdp/client/models/update_webhook_request.py b/cdp/client/models/update_webhook_request.py index af0182e..968bb1e 100644 --- a/cdp/client/models/update_webhook_request.py +++ b/cdp/client/models/update_webhook_request.py @@ -1,37 +1,37 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 -import json + +from __future__ import annotations import pprint import re # noqa: F401 -from typing import Any, ClassVar +import json from pydantic import BaseModel, ConfigDict, Field, StrictStr -from typing_extensions import Self - +from typing import Any, ClassVar, Dict, List, Optional from cdp.client.models.webhook_event_filter import WebhookEventFilter from cdp.client.models.webhook_event_type_filter import WebhookEventTypeFilter - +from typing import Optional, Set +from typing_extensions import Self class UpdateWebhookRequest(BaseModel): - """UpdateWebhookRequest""" - - event_type_filter: WebhookEventTypeFilter | None = None - event_filters: list[WebhookEventFilter] | None = Field( - default=None, - description="Webhook will monitor all events that matches any one of the event filters.", - ) + """ + UpdateWebhookRequest + """ # noqa: E501 + event_type_filter: Optional[WebhookEventTypeFilter] = None + event_filters: Optional[List[WebhookEventFilter]] = Field(default=None, description="Webhook will monitor all events that matches any one of the event filters.") notification_uri: StrictStr = Field(description="The Webhook uri that updates to") - __properties: ClassVar[list[str]] = ["event_type_filter", "event_filters", "notification_uri"] + __properties: ClassVar[List[str]] = ["event_type_filter", "event_filters", "notification_uri"] model_config = ConfigDict( populate_by_name=True, @@ -39,6 +39,7 @@ class UpdateWebhookRequest(BaseModel): protected_namespaces=(), ) + def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True)) @@ -49,11 +50,11 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self | None: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of UpdateWebhookRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self) -> dict[str, Any]: + def to_dict(self) -> Dict[str, Any]: """Return the dictionary representation of the model using alias. This has the following differences from calling pydantic's @@ -63,7 +64,8 @@ def to_dict(self) -> dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ - excluded_fields: set[str] = set([]) + excluded_fields: Set[str] = set([ + ]) _dict = self.model_dump( by_alias=True, @@ -72,18 +74,18 @@ def to_dict(self) -> dict[str, Any]: ) # override the default output from pydantic by calling `to_dict()` of event_type_filter if self.event_type_filter: - _dict["event_type_filter"] = self.event_type_filter.to_dict() + _dict['event_type_filter'] = self.event_type_filter.to_dict() # override the default output from pydantic by calling `to_dict()` of each item in event_filters (list) _items = [] if self.event_filters: for _item_event_filters in self.event_filters: if _item_event_filters: _items.append(_item_event_filters.to_dict()) - _dict["event_filters"] = _items + _dict['event_filters'] = _items return _dict @classmethod - def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of UpdateWebhookRequest from a dict""" if obj is None: return None @@ -91,17 +93,11 @@ def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate( - { - "event_type_filter": WebhookEventTypeFilter.from_dict(obj["event_type_filter"]) - if obj.get("event_type_filter") is not None - else None, - "event_filters": [ - WebhookEventFilter.from_dict(_item) for _item in obj["event_filters"] - ] - if obj.get("event_filters") is not None - else None, - "notification_uri": obj.get("notification_uri"), - } - ) + _obj = cls.model_validate({ + "event_type_filter": WebhookEventTypeFilter.from_dict(obj["event_type_filter"]) if obj.get("event_type_filter") is not None else None, + "event_filters": [WebhookEventFilter.from_dict(_item) for _item in obj["event_filters"]] if obj.get("event_filters") is not None else None, + "notification_uri": obj.get("notification_uri") + }) return _obj + + diff --git a/cdp/client/models/user.py b/cdp/client/models/user.py index d431c00..1ccb4f1 100644 --- a/cdp/client/models/user.py +++ b/cdp/client/models/user.py @@ -1,30 +1,34 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 -import json + +from __future__ import annotations import pprint import re # noqa: F401 -from typing import Any, ClassVar +import json from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set from typing_extensions import Self - class User(BaseModel): - """User""" - + """ + User + """ # noqa: E501 id: StrictStr = Field(description="The ID of the user") - display_name: StrictStr | None = None - __properties: ClassVar[list[str]] = ["id", "display_name"] + display_name: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["id", "display_name"] model_config = ConfigDict( populate_by_name=True, @@ -32,6 +36,7 @@ class User(BaseModel): protected_namespaces=(), ) + def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True)) @@ -42,11 +47,11 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self | None: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of User from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self) -> dict[str, Any]: + def to_dict(self) -> Dict[str, Any]: """Return the dictionary representation of the model using alias. This has the following differences from calling pydantic's @@ -56,7 +61,8 @@ def to_dict(self) -> dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ - excluded_fields: set[str] = set([]) + excluded_fields: Set[str] = set([ + ]) _dict = self.model_dump( by_alias=True, @@ -66,7 +72,7 @@ def to_dict(self) -> dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of User from a dict""" if obj is None: return None @@ -74,5 +80,10 @@ def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate({"id": obj.get("id"), "display_name": obj.get("display_name")}) + _obj = cls.model_validate({ + "id": obj.get("id"), + "display_name": obj.get("display_name") + }) return _obj + + diff --git a/cdp/client/models/validator.py b/cdp/client/models/validator.py index ad123bd..312e9e5 100644 --- a/cdp/client/models/validator.py +++ b/cdp/client/models/validator.py @@ -1,46 +1,39 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 -import json + +from __future__ import annotations import pprint import re # noqa: F401 -from typing import Any, ClassVar +import json from pydantic import BaseModel, ConfigDict, Field, StrictStr -from typing_extensions import Self - +from typing import Any, ClassVar, Dict, List, Optional from cdp.client.models.validator_details import ValidatorDetails from cdp.client.models.validator_status import ValidatorStatus - +from typing import Optional, Set +from typing_extensions import Self class Validator(BaseModel): - """A validator onchain.""" - - validator_id: StrictStr = Field( - description="The publicly identifiable unique id of the validator. This can be the public key for Ethereum validators and maybe an address for some other network." - ) - network_id: StrictStr = Field( - description="The ID of the blockchain network to which the Validator belongs." - ) + """ + A validator onchain. + """ # noqa: E501 + validator_id: StrictStr = Field(description="The publicly identifiable unique id of the validator. This can be the public key for Ethereum validators and maybe an address for some other network.") + network_id: StrictStr = Field(description="The ID of the blockchain network to which the Validator belongs.") asset_id: StrictStr = Field(description="The ID of the asset that the validator helps stake.") status: ValidatorStatus - details: ValidatorDetails | None = None - __properties: ClassVar[list[str]] = [ - "validator_id", - "network_id", - "asset_id", - "status", - "details", - ] + details: Optional[ValidatorDetails] = None + __properties: ClassVar[List[str]] = ["validator_id", "network_id", "asset_id", "status", "details"] model_config = ConfigDict( populate_by_name=True, @@ -48,6 +41,7 @@ class Validator(BaseModel): protected_namespaces=(), ) + def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True)) @@ -58,11 +52,11 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self | None: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Validator from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self) -> dict[str, Any]: + def to_dict(self) -> Dict[str, Any]: """Return the dictionary representation of the model using alias. This has the following differences from calling pydantic's @@ -72,7 +66,8 @@ def to_dict(self) -> dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ - excluded_fields: set[str] = set([]) + excluded_fields: Set[str] = set([ + ]) _dict = self.model_dump( by_alias=True, @@ -81,11 +76,11 @@ def to_dict(self) -> dict[str, Any]: ) # override the default output from pydantic by calling `to_dict()` of details if self.details: - _dict["details"] = self.details.to_dict() + _dict['details'] = self.details.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of Validator from a dict""" if obj is None: return None @@ -93,15 +88,13 @@ def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate( - { - "validator_id": obj.get("validator_id"), - "network_id": obj.get("network_id"), - "asset_id": obj.get("asset_id"), - "status": obj.get("status"), - "details": ValidatorDetails.from_dict(obj["details"]) - if obj.get("details") is not None - else None, - } - ) + _obj = cls.model_validate({ + "validator_id": obj.get("validator_id"), + "network_id": obj.get("network_id"), + "asset_id": obj.get("asset_id"), + "status": obj.get("status"), + "details": ValidatorDetails.from_dict(obj["details"]) if obj.get("details") is not None else None + }) return _obj + + diff --git a/cdp/client/models/validator_details.py b/cdp/client/models/validator_details.py index 9b00932..0159b71 100644 --- a/cdp/client/models/validator_details.py +++ b/cdp/client/models/validator_details.py @@ -1,83 +1,75 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 + +from __future__ import annotations import json import pprint -from typing import Any - -from pydantic import BaseModel, ConfigDict, ValidationError, field_validator -from typing_extensions import Self - +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Any, List, Optional from cdp.client.models.ethereum_validator_metadata import EthereumValidatorMetadata +from pydantic import StrictStr, Field +from typing import Union, List, Set, Optional, Dict +from typing_extensions import Literal, Self VALIDATORDETAILS_ONE_OF_SCHEMAS = ["EthereumValidatorMetadata"] - class ValidatorDetails(BaseModel): - """ValidatorDetails""" - + """ + ValidatorDetails + """ # data type: EthereumValidatorMetadata - oneof_schema_1_validator: EthereumValidatorMetadata | None = None - actual_instance: EthereumValidatorMetadata | None = None - one_of_schemas: set[str] = {"EthereumValidatorMetadata"} + oneof_schema_1_validator: Optional[EthereumValidatorMetadata] = None + actual_instance: Optional[Union[EthereumValidatorMetadata]] = None + one_of_schemas: Set[str] = { "EthereumValidatorMetadata" } model_config = ConfigDict( validate_assignment=True, protected_namespaces=(), ) + def __init__(self, *args, **kwargs) -> None: if args: if len(args) > 1: - raise ValueError( - "If a position argument is used, only 1 is allowed to set `actual_instance`" - ) + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") if kwargs: - raise ValueError( - "If a position argument is used, keyword arguments cannot be used." - ) + raise ValueError("If a position argument is used, keyword arguments cannot be used.") super().__init__(actual_instance=args[0]) else: super().__init__(**kwargs) - @field_validator("actual_instance") + @field_validator('actual_instance') def actual_instance_must_validate_oneof(cls, v): instance = ValidatorDetails.model_construct() error_messages = [] match = 0 # validate data type: EthereumValidatorMetadata if not isinstance(v, EthereumValidatorMetadata): - error_messages.append( - f"Error! Input type `{type(v)}` is not `EthereumValidatorMetadata`" - ) + error_messages.append(f"Error! Input type `{type(v)}` is not `EthereumValidatorMetadata`") else: match += 1 if match > 1: # more than 1 match - raise ValueError( - "Multiple matches found when setting `actual_instance` in ValidatorDetails with oneOf schemas: EthereumValidatorMetadata. Details: " - + ", ".join(error_messages) - ) + raise ValueError("Multiple matches found when setting `actual_instance` in ValidatorDetails with oneOf schemas: EthereumValidatorMetadata. Details: " + ", ".join(error_messages)) elif match == 0: # no match - raise ValueError( - "No match found when setting `actual_instance` in ValidatorDetails with oneOf schemas: EthereumValidatorMetadata. Details: " - + ", ".join(error_messages) - ) + raise ValueError("No match found when setting `actual_instance` in ValidatorDetails with oneOf schemas: EthereumValidatorMetadata. Details: " + ", ".join(error_messages)) else: return v @classmethod - def from_dict(cls, obj: str | dict[str, Any]) -> Self: + def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self: return cls.from_json(json.dumps(obj)) @classmethod @@ -96,16 +88,10 @@ def from_json(cls, json_str: str) -> Self: if match > 1: # more than 1 match - raise ValueError( - "Multiple matches found when deserializing the JSON string into ValidatorDetails with oneOf schemas: EthereumValidatorMetadata. Details: " - + ", ".join(error_messages) - ) + raise ValueError("Multiple matches found when deserializing the JSON string into ValidatorDetails with oneOf schemas: EthereumValidatorMetadata. Details: " + ", ".join(error_messages)) elif match == 0: # no match - raise ValueError( - "No match found when deserializing the JSON string into ValidatorDetails with oneOf schemas: EthereumValidatorMetadata. Details: " - + ", ".join(error_messages) - ) + raise ValueError("No match found when deserializing the JSON string into ValidatorDetails with oneOf schemas: EthereumValidatorMetadata. Details: " + ", ".join(error_messages)) else: return instance @@ -119,7 +105,7 @@ def to_json(self) -> str: else: return json.dumps(self.actual_instance) - def to_dict(self) -> dict[str, Any] | EthereumValidatorMetadata | None: + def to_dict(self) -> Optional[Union[Dict[str, Any], EthereumValidatorMetadata]]: """Returns the dict representation of the actual instance""" if self.actual_instance is None: return None @@ -133,3 +119,5 @@ def to_dict(self) -> dict[str, Any] | EthereumValidatorMetadata | None: def to_str(self) -> str: """Returns the string representation of the actual instance""" return pprint.pformat(self.model_dump()) + + diff --git a/cdp/client/models/validator_list.py b/cdp/client/models/validator_list.py index 7f72c37..41903bc 100644 --- a/cdp/client/models/validator_list.py +++ b/cdp/client/models/validator_list.py @@ -1,35 +1,36 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 -import json + +from __future__ import annotations import pprint import re # noqa: F401 -from typing import Any, ClassVar +import json from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr -from typing_extensions import Self - +from typing import Any, ClassVar, Dict, List from cdp.client.models.validator import Validator - +from typing import Optional, Set +from typing_extensions import Self class ValidatorList(BaseModel): - """ """ - - data: list[Validator] - has_more: StrictBool = Field( - description="True if this list has another page of items after this one that can be fetched." - ) + """ + + """ # noqa: E501 + data: List[Validator] + has_more: StrictBool = Field(description="True if this list has another page of items after this one that can be fetched.") next_page: StrictStr = Field(description="The page token to be used to fetch the next page.") - __properties: ClassVar[list[str]] = ["data", "has_more", "next_page"] + __properties: ClassVar[List[str]] = ["data", "has_more", "next_page"] model_config = ConfigDict( populate_by_name=True, @@ -37,6 +38,7 @@ class ValidatorList(BaseModel): protected_namespaces=(), ) + def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True)) @@ -47,11 +49,11 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self | None: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of ValidatorList from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self) -> dict[str, Any]: + def to_dict(self) -> Dict[str, Any]: """Return the dictionary representation of the model using alias. This has the following differences from calling pydantic's @@ -61,7 +63,8 @@ def to_dict(self) -> dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ - excluded_fields: set[str] = set([]) + excluded_fields: Set[str] = set([ + ]) _dict = self.model_dump( by_alias=True, @@ -74,11 +77,11 @@ def to_dict(self) -> dict[str, Any]: for _item_data in self.data: if _item_data: _items.append(_item_data.to_dict()) - _dict["data"] = _items + _dict['data'] = _items return _dict @classmethod - def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of ValidatorList from a dict""" if obj is None: return None @@ -86,13 +89,11 @@ def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate( - { - "data": [Validator.from_dict(_item) for _item in obj["data"]] - if obj.get("data") is not None - else None, - "has_more": obj.get("has_more"), - "next_page": obj.get("next_page"), - } - ) + _obj = cls.model_validate({ + "data": [Validator.from_dict(_item) for _item in obj["data"]] if obj.get("data") is not None else None, + "has_more": obj.get("has_more"), + "next_page": obj.get("next_page") + }) return _obj + + diff --git a/cdp/client/models/validator_status.py b/cdp/client/models/validator_status.py index b37435f..7fb324a 100644 --- a/cdp/client/models/validator_status.py +++ b/cdp/client/models/validator_status.py @@ -1,42 +1,48 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 + +from __future__ import annotations import json from enum import Enum - from typing_extensions import Self class ValidatorStatus(str, Enum): - """The status of the validator.""" + """ + The status of the validator. + """ """ allowed enum values """ - UNKNOWN = "unknown" - PROVISIONING = "provisioning" - PROVISIONED = "provisioned" - DEPOSITED = "deposited" - PENDING_ACTIVATION = "pending_activation" - ACTIVE = "active" - EXITING = "exiting" - EXITED = "exited" - WITHDRAWAL_AVAILABLE = "withdrawal_available" - WITHDRAWAL_COMPLETE = "withdrawal_complete" - ACTIVE_SLASHED = "active_slashed" - EXITED_SLASHED = "exited_slashed" - REAPED = "reaped" + UNKNOWN = 'unknown' + PROVISIONING = 'provisioning' + PROVISIONED = 'provisioned' + DEPOSITED = 'deposited' + PENDING_ACTIVATION = 'pending_activation' + ACTIVE = 'active' + EXITING = 'exiting' + EXITED = 'exited' + WITHDRAWAL_AVAILABLE = 'withdrawal_available' + WITHDRAWAL_COMPLETE = 'withdrawal_complete' + ACTIVE_SLASHED = 'active_slashed' + EXITED_SLASHED = 'exited_slashed' + REAPED = 'reaped' @classmethod def from_json(cls, json_str: str) -> Self: """Create an instance of ValidatorStatus from a JSON string""" return cls(json.loads(json_str)) + + diff --git a/cdp/client/models/wallet.py b/cdp/client/models/wallet.py index 626d05d..2952845 100644 --- a/cdp/client/models/wallet.py +++ b/cdp/client/models/wallet.py @@ -1,52 +1,47 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 -import json + +from __future__ import annotations import pprint import re # noqa: F401 -from typing import Any, ClassVar +import json from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator -from typing_extensions import Self - +from typing import Any, ClassVar, Dict, List, Optional from cdp.client.models.address import Address from cdp.client.models.feature_set import FeatureSet - +from typing import Optional, Set +from typing_extensions import Self class Wallet(BaseModel): - """Wallet""" - + """ + Wallet + """ # noqa: E501 id: StrictStr = Field(description="The server-assigned ID for the wallet.") network_id: StrictStr = Field(description="The ID of the blockchain network") - default_address: Address | None = None + default_address: Optional[Address] = None feature_set: FeatureSet - server_signer_status: StrictStr | None = Field( - default=None, description="The status of the Server-Signer for the wallet if present." - ) - __properties: ClassVar[list[str]] = [ - "id", - "network_id", - "default_address", - "feature_set", - "server_signer_status", - ] - - @field_validator("server_signer_status") + server_signer_status: Optional[StrictStr] = Field(default=None, description="The status of the Server-Signer for the wallet if present.") + __properties: ClassVar[List[str]] = ["id", "network_id", "default_address", "feature_set", "server_signer_status"] + + @field_validator('server_signer_status') def server_signer_status_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in set(["pending_seed_creation", "active_seed"]): + if value not in set(['pending_seed_creation', 'active_seed']): raise ValueError("must be one of enum values ('pending_seed_creation', 'active_seed')") return value @@ -56,6 +51,7 @@ def server_signer_status_validate_enum(cls, value): protected_namespaces=(), ) + def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True)) @@ -66,11 +62,11 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self | None: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Wallet from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self) -> dict[str, Any]: + def to_dict(self) -> Dict[str, Any]: """Return the dictionary representation of the model using alias. This has the following differences from calling pydantic's @@ -80,7 +76,8 @@ def to_dict(self) -> dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ - excluded_fields: set[str] = set([]) + excluded_fields: Set[str] = set([ + ]) _dict = self.model_dump( by_alias=True, @@ -89,14 +86,14 @@ def to_dict(self) -> dict[str, Any]: ) # override the default output from pydantic by calling `to_dict()` of default_address if self.default_address: - _dict["default_address"] = self.default_address.to_dict() + _dict['default_address'] = self.default_address.to_dict() # override the default output from pydantic by calling `to_dict()` of feature_set if self.feature_set: - _dict["feature_set"] = self.feature_set.to_dict() + _dict['feature_set'] = self.feature_set.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of Wallet from a dict""" if obj is None: return None @@ -104,17 +101,13 @@ def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate( - { - "id": obj.get("id"), - "network_id": obj.get("network_id"), - "default_address": Address.from_dict(obj["default_address"]) - if obj.get("default_address") is not None - else None, - "feature_set": FeatureSet.from_dict(obj["feature_set"]) - if obj.get("feature_set") is not None - else None, - "server_signer_status": obj.get("server_signer_status"), - } - ) + _obj = cls.model_validate({ + "id": obj.get("id"), + "network_id": obj.get("network_id"), + "default_address": Address.from_dict(obj["default_address"]) if obj.get("default_address") is not None else None, + "feature_set": FeatureSet.from_dict(obj["feature_set"]) if obj.get("feature_set") is not None else None, + "server_signer_status": obj.get("server_signer_status") + }) return _obj + + diff --git a/cdp/client/models/wallet_list.py b/cdp/client/models/wallet_list.py index eea2d56..6fe9466 100644 --- a/cdp/client/models/wallet_list.py +++ b/cdp/client/models/wallet_list.py @@ -1,36 +1,37 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 -import json + +from __future__ import annotations import pprint import re # noqa: F401 -from typing import Any, ClassVar +import json from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr -from typing_extensions import Self - +from typing import Any, ClassVar, Dict, List from cdp.client.models.wallet import Wallet - +from typing import Optional, Set +from typing_extensions import Self class WalletList(BaseModel): - """Paginated list of wallets""" - - data: list[Wallet] - has_more: StrictBool = Field( - description="True if this list has another page of items after this one that can be fetched." - ) + """ + Paginated list of wallets + """ # noqa: E501 + data: List[Wallet] + has_more: StrictBool = Field(description="True if this list has another page of items after this one that can be fetched.") next_page: StrictStr = Field(description="The page token to be used to fetch the next page.") total_count: StrictInt = Field(description="The total number of wallets") - __properties: ClassVar[list[str]] = ["data", "has_more", "next_page", "total_count"] + __properties: ClassVar[List[str]] = ["data", "has_more", "next_page", "total_count"] model_config = ConfigDict( populate_by_name=True, @@ -38,6 +39,7 @@ class WalletList(BaseModel): protected_namespaces=(), ) + def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True)) @@ -48,11 +50,11 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self | None: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of WalletList from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self) -> dict[str, Any]: + def to_dict(self) -> Dict[str, Any]: """Return the dictionary representation of the model using alias. This has the following differences from calling pydantic's @@ -62,7 +64,8 @@ def to_dict(self) -> dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ - excluded_fields: set[str] = set([]) + excluded_fields: Set[str] = set([ + ]) _dict = self.model_dump( by_alias=True, @@ -75,11 +78,11 @@ def to_dict(self) -> dict[str, Any]: for _item_data in self.data: if _item_data: _items.append(_item_data.to_dict()) - _dict["data"] = _items + _dict['data'] = _items return _dict @classmethod - def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of WalletList from a dict""" if obj is None: return None @@ -87,14 +90,12 @@ def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate( - { - "data": [Wallet.from_dict(_item) for _item in obj["data"]] - if obj.get("data") is not None - else None, - "has_more": obj.get("has_more"), - "next_page": obj.get("next_page"), - "total_count": obj.get("total_count"), - } - ) + _obj = cls.model_validate({ + "data": [Wallet.from_dict(_item) for _item in obj["data"]] if obj.get("data") is not None else None, + "has_more": obj.get("has_more"), + "next_page": obj.get("next_page"), + "total_count": obj.get("total_count") + }) return _obj + + diff --git a/cdp/client/models/webhook.py b/cdp/client/models/webhook.py index 60cdfb7..e71b31c 100644 --- a/cdp/client/models/webhook.py +++ b/cdp/client/models/webhook.py @@ -1,66 +1,45 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 -import json + +from __future__ import annotations import pprint import re # noqa: F401 -from datetime import datetime -from typing import Any, ClassVar +import json +from datetime import datetime from pydantic import BaseModel, ConfigDict, Field, StrictStr -from typing_extensions import Self - +from typing import Any, ClassVar, Dict, List, Optional from cdp.client.models.webhook_event_filter import WebhookEventFilter from cdp.client.models.webhook_event_type import WebhookEventType from cdp.client.models.webhook_event_type_filter import WebhookEventTypeFilter - +from typing import Optional, Set +from typing_extensions import Self class Webhook(BaseModel): - """Webhook that is used for getting notifications when monitored events occur.""" - - id: StrictStr | None = Field(default=None, description="Identifier of the webhook.") - network_id: StrictStr | None = Field( - default=None, description="The ID of the blockchain network" - ) - event_type: WebhookEventType | None = None - event_type_filter: WebhookEventTypeFilter | None = None - event_filters: list[WebhookEventFilter] | None = Field( - default=None, - description="Webhook will monitor all events that matches any one of the event filters.", - ) - notification_uri: StrictStr | None = Field( - default=None, description="The URL to which the notifications will be sent." - ) - created_at: datetime | None = Field( - default=None, description="The date and time the webhook was created." - ) - updated_at: datetime | None = Field( - default=None, description="The date and time the webhook was last updated." - ) - signature_header: StrictStr | None = Field( - default=None, - description="The header that will contain the signature of the webhook payload.", - ) - __properties: ClassVar[list[str]] = [ - "id", - "network_id", - "event_type", - "event_type_filter", - "event_filters", - "notification_uri", - "created_at", - "updated_at", - "signature_header", - ] + """ + Webhook that is used for getting notifications when monitored events occur. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Identifier of the webhook.") + network_id: Optional[StrictStr] = Field(default=None, description="The ID of the blockchain network") + event_type: Optional[WebhookEventType] = None + event_type_filter: Optional[WebhookEventTypeFilter] = None + event_filters: Optional[List[WebhookEventFilter]] = Field(default=None, description="Webhook will monitor all events that matches any one of the event filters.") + notification_uri: Optional[StrictStr] = Field(default=None, description="The URL to which the notifications will be sent.") + created_at: Optional[datetime] = Field(default=None, description="The date and time the webhook was created.") + updated_at: Optional[datetime] = Field(default=None, description="The date and time the webhook was last updated.") + signature_header: Optional[StrictStr] = Field(default=None, description="The header that will contain the signature of the webhook payload.") + __properties: ClassVar[List[str]] = ["id", "network_id", "event_type", "event_type_filter", "event_filters", "notification_uri", "created_at", "updated_at", "signature_header"] model_config = ConfigDict( populate_by_name=True, @@ -68,6 +47,7 @@ class Webhook(BaseModel): protected_namespaces=(), ) + def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True)) @@ -78,11 +58,11 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self | None: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Webhook from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self) -> dict[str, Any]: + def to_dict(self) -> Dict[str, Any]: """Return the dictionary representation of the model using alias. This has the following differences from calling pydantic's @@ -92,7 +72,8 @@ def to_dict(self) -> dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ - excluded_fields: set[str] = set([]) + excluded_fields: Set[str] = set([ + ]) _dict = self.model_dump( by_alias=True, @@ -101,18 +82,18 @@ def to_dict(self) -> dict[str, Any]: ) # override the default output from pydantic by calling `to_dict()` of event_type_filter if self.event_type_filter: - _dict["event_type_filter"] = self.event_type_filter.to_dict() + _dict['event_type_filter'] = self.event_type_filter.to_dict() # override the default output from pydantic by calling `to_dict()` of each item in event_filters (list) _items = [] if self.event_filters: for _item_event_filters in self.event_filters: if _item_event_filters: _items.append(_item_event_filters.to_dict()) - _dict["event_filters"] = _items + _dict['event_filters'] = _items return _dict @classmethod - def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of Webhook from a dict""" if obj is None: return None @@ -120,23 +101,17 @@ def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate( - { - "id": obj.get("id"), - "network_id": obj.get("network_id"), - "event_type": obj.get("event_type"), - "event_type_filter": WebhookEventTypeFilter.from_dict(obj["event_type_filter"]) - if obj.get("event_type_filter") is not None - else None, - "event_filters": [ - WebhookEventFilter.from_dict(_item) for _item in obj["event_filters"] - ] - if obj.get("event_filters") is not None - else None, - "notification_uri": obj.get("notification_uri"), - "created_at": obj.get("created_at"), - "updated_at": obj.get("updated_at"), - "signature_header": obj.get("signature_header"), - } - ) + _obj = cls.model_validate({ + "id": obj.get("id"), + "network_id": obj.get("network_id"), + "event_type": obj.get("event_type"), + "event_type_filter": WebhookEventTypeFilter.from_dict(obj["event_type_filter"]) if obj.get("event_type_filter") is not None else None, + "event_filters": [WebhookEventFilter.from_dict(_item) for _item in obj["event_filters"]] if obj.get("event_filters") is not None else None, + "notification_uri": obj.get("notification_uri"), + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "signature_header": obj.get("signature_header") + }) return _obj + + diff --git a/cdp/client/models/webhook_event_filter.py b/cdp/client/models/webhook_event_filter.py index 0a5f762..6e160ca 100644 --- a/cdp/client/models/webhook_event_filter.py +++ b/cdp/client/models/webhook_event_filter.py @@ -1,40 +1,35 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 -import json + +from __future__ import annotations import pprint import re # noqa: F401 -from typing import Any, ClassVar +import json from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set from typing_extensions import Self - class WebhookEventFilter(BaseModel): - """The event_filter parameter specifies the criteria to filter events from the blockchain. It allows filtering events by contract address, sender address and receiver address. For a single event filter, not all of the properties need to be presented.""" - - contract_address: StrictStr | None = Field( - default=None, - description="The onchain contract address of the token for which the events should be tracked.", - ) - from_address: StrictStr | None = Field( - default=None, - description="The onchain address of the sender. Set this filter to track all transfer events originating from your address.", - ) - to_address: StrictStr | None = Field( - default=None, - description="The onchain address of the receiver. Set this filter to track all transfer events sent to your address.", - ) - __properties: ClassVar[list[str]] = ["contract_address", "from_address", "to_address"] + """ + The event_filter parameter specifies the criteria to filter events from the blockchain. It allows filtering events by contract address, sender address and receiver address. For a single event filter, not all of the properties need to be presented. + """ # noqa: E501 + contract_address: Optional[StrictStr] = Field(default=None, description="The onchain contract address of the token for which the events should be tracked.") + from_address: Optional[StrictStr] = Field(default=None, description="The onchain address of the sender. Set this filter to track all transfer events originating from your address.") + to_address: Optional[StrictStr] = Field(default=None, description="The onchain address of the receiver. Set this filter to track all transfer events sent to your address.") + __properties: ClassVar[List[str]] = ["contract_address", "from_address", "to_address"] model_config = ConfigDict( populate_by_name=True, @@ -42,6 +37,7 @@ class WebhookEventFilter(BaseModel): protected_namespaces=(), ) + def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True)) @@ -52,11 +48,11 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self | None: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of WebhookEventFilter from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self) -> dict[str, Any]: + def to_dict(self) -> Dict[str, Any]: """Return the dictionary representation of the model using alias. This has the following differences from calling pydantic's @@ -66,7 +62,8 @@ def to_dict(self) -> dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ - excluded_fields: set[str] = set([]) + excluded_fields: Set[str] = set([ + ]) _dict = self.model_dump( by_alias=True, @@ -76,7 +73,7 @@ def to_dict(self) -> dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of WebhookEventFilter from a dict""" if obj is None: return None @@ -84,11 +81,11 @@ def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate( - { - "contract_address": obj.get("contract_address"), - "from_address": obj.get("from_address"), - "to_address": obj.get("to_address"), - } - ) + _obj = cls.model_validate({ + "contract_address": obj.get("contract_address"), + "from_address": obj.get("from_address"), + "to_address": obj.get("to_address") + }) return _obj + + diff --git a/cdp/client/models/webhook_event_type.py b/cdp/client/models/webhook_event_type.py index 08fab35..d2438b7 100644 --- a/cdp/client/models/webhook_event_type.py +++ b/cdp/client/models/webhook_event_type.py @@ -1,33 +1,39 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 + +from __future__ import annotations import json from enum import Enum - from typing_extensions import Self class WebhookEventType(str, Enum): - """WebhookEventType""" + """ + WebhookEventType + """ """ allowed enum values """ - UNSPECIFIED = "unspecified" - ERC20_TRANSFER = "erc20_transfer" - ERC721_TRANSFER = "erc721_transfer" - WALLET_ACTIVITY = "wallet_activity" + UNSPECIFIED = 'unspecified' + ERC20_TRANSFER = 'erc20_transfer' + ERC721_TRANSFER = 'erc721_transfer' + WALLET_ACTIVITY = 'wallet_activity' @classmethod def from_json(cls, json_str: str) -> Self: """Create an instance of WebhookEventType from a JSON string""" return cls(json.loads(json_str)) + + diff --git a/cdp/client/models/webhook_event_type_filter.py b/cdp/client/models/webhook_event_type_filter.py index 51ee554..6344979 100644 --- a/cdp/client/models/webhook_event_type_filter.py +++ b/cdp/client/models/webhook_event_type_filter.py @@ -1,83 +1,75 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 + +from __future__ import annotations import json import pprint -from typing import Any - -from pydantic import BaseModel, ConfigDict, ValidationError, field_validator -from typing_extensions import Self - +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Any, List, Optional from cdp.client.models.webhook_wallet_activity_filter import WebhookWalletActivityFilter +from pydantic import StrictStr, Field +from typing import Union, List, Set, Optional, Dict +from typing_extensions import Literal, Self WEBHOOKEVENTTYPEFILTER_ONE_OF_SCHEMAS = ["WebhookWalletActivityFilter"] - class WebhookEventTypeFilter(BaseModel): - """The event_type_filter parameter specifies the criteria to filter events based on event type.""" - + """ + The event_type_filter parameter specifies the criteria to filter events based on event type. + """ # data type: WebhookWalletActivityFilter - oneof_schema_1_validator: WebhookWalletActivityFilter | None = None - actual_instance: WebhookWalletActivityFilter | None = None - one_of_schemas: set[str] = {"WebhookWalletActivityFilter"} + oneof_schema_1_validator: Optional[WebhookWalletActivityFilter] = None + actual_instance: Optional[Union[WebhookWalletActivityFilter]] = None + one_of_schemas: Set[str] = { "WebhookWalletActivityFilter" } model_config = ConfigDict( validate_assignment=True, protected_namespaces=(), ) + def __init__(self, *args, **kwargs) -> None: if args: if len(args) > 1: - raise ValueError( - "If a position argument is used, only 1 is allowed to set `actual_instance`" - ) + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") if kwargs: - raise ValueError( - "If a position argument is used, keyword arguments cannot be used." - ) + raise ValueError("If a position argument is used, keyword arguments cannot be used.") super().__init__(actual_instance=args[0]) else: super().__init__(**kwargs) - @field_validator("actual_instance") + @field_validator('actual_instance') def actual_instance_must_validate_oneof(cls, v): instance = WebhookEventTypeFilter.model_construct() error_messages = [] match = 0 # validate data type: WebhookWalletActivityFilter if not isinstance(v, WebhookWalletActivityFilter): - error_messages.append( - f"Error! Input type `{type(v)}` is not `WebhookWalletActivityFilter`" - ) + error_messages.append(f"Error! Input type `{type(v)}` is not `WebhookWalletActivityFilter`") else: match += 1 if match > 1: # more than 1 match - raise ValueError( - "Multiple matches found when setting `actual_instance` in WebhookEventTypeFilter with oneOf schemas: WebhookWalletActivityFilter. Details: " - + ", ".join(error_messages) - ) + raise ValueError("Multiple matches found when setting `actual_instance` in WebhookEventTypeFilter with oneOf schemas: WebhookWalletActivityFilter. Details: " + ", ".join(error_messages)) elif match == 0: # no match - raise ValueError( - "No match found when setting `actual_instance` in WebhookEventTypeFilter with oneOf schemas: WebhookWalletActivityFilter. Details: " - + ", ".join(error_messages) - ) + raise ValueError("No match found when setting `actual_instance` in WebhookEventTypeFilter with oneOf schemas: WebhookWalletActivityFilter. Details: " + ", ".join(error_messages)) else: return v @classmethod - def from_dict(cls, obj: str | dict[str, Any]) -> Self: + def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self: return cls.from_json(json.dumps(obj)) @classmethod @@ -96,16 +88,10 @@ def from_json(cls, json_str: str) -> Self: if match > 1: # more than 1 match - raise ValueError( - "Multiple matches found when deserializing the JSON string into WebhookEventTypeFilter with oneOf schemas: WebhookWalletActivityFilter. Details: " - + ", ".join(error_messages) - ) + raise ValueError("Multiple matches found when deserializing the JSON string into WebhookEventTypeFilter with oneOf schemas: WebhookWalletActivityFilter. Details: " + ", ".join(error_messages)) elif match == 0: # no match - raise ValueError( - "No match found when deserializing the JSON string into WebhookEventTypeFilter with oneOf schemas: WebhookWalletActivityFilter. Details: " - + ", ".join(error_messages) - ) + raise ValueError("No match found when deserializing the JSON string into WebhookEventTypeFilter with oneOf schemas: WebhookWalletActivityFilter. Details: " + ", ".join(error_messages)) else: return instance @@ -119,7 +105,7 @@ def to_json(self) -> str: else: return json.dumps(self.actual_instance) - def to_dict(self) -> dict[str, Any] | WebhookWalletActivityFilter | None: + def to_dict(self) -> Optional[Union[Dict[str, Any], WebhookWalletActivityFilter]]: """Returns the dict representation of the actual instance""" if self.actual_instance is None: return None @@ -133,3 +119,5 @@ def to_dict(self) -> dict[str, Any] | WebhookWalletActivityFilter | None: def to_str(self) -> str: """Returns the string representation of the actual instance""" return pprint.pformat(self.model_dump()) + + diff --git a/cdp/client/models/webhook_list.py b/cdp/client/models/webhook_list.py index e949a74..b97f900 100644 --- a/cdp/client/models/webhook_list.py +++ b/cdp/client/models/webhook_list.py @@ -1,38 +1,36 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 -import json + +from __future__ import annotations import pprint import re # noqa: F401 -from typing import Any, ClassVar +import json from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr -from typing_extensions import Self - +from typing import Any, ClassVar, Dict, List, Optional from cdp.client.models.webhook import Webhook - +from typing import Optional, Set +from typing_extensions import Self class WebhookList(BaseModel): - """ """ - - data: list[Webhook] - has_more: StrictBool | None = Field( - default=None, - description="True if this list has another page of items after this one that can be fetched.", - ) - next_page: StrictStr | None = Field( - default=None, description="The page token to be used to fetch the next page." - ) - __properties: ClassVar[list[str]] = ["data", "has_more", "next_page"] + """ + + """ # noqa: E501 + data: List[Webhook] + has_more: Optional[StrictBool] = Field(default=None, description="True if this list has another page of items after this one that can be fetched.") + next_page: Optional[StrictStr] = Field(default=None, description="The page token to be used to fetch the next page.") + __properties: ClassVar[List[str]] = ["data", "has_more", "next_page"] model_config = ConfigDict( populate_by_name=True, @@ -40,6 +38,7 @@ class WebhookList(BaseModel): protected_namespaces=(), ) + def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True)) @@ -50,11 +49,11 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self | None: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of WebhookList from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self) -> dict[str, Any]: + def to_dict(self) -> Dict[str, Any]: """Return the dictionary representation of the model using alias. This has the following differences from calling pydantic's @@ -64,7 +63,8 @@ def to_dict(self) -> dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ - excluded_fields: set[str] = set([]) + excluded_fields: Set[str] = set([ + ]) _dict = self.model_dump( by_alias=True, @@ -77,11 +77,11 @@ def to_dict(self) -> dict[str, Any]: for _item_data in self.data: if _item_data: _items.append(_item_data.to_dict()) - _dict["data"] = _items + _dict['data'] = _items return _dict @classmethod - def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of WebhookList from a dict""" if obj is None: return None @@ -89,13 +89,11 @@ def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate( - { - "data": [Webhook.from_dict(_item) for _item in obj["data"]] - if obj.get("data") is not None - else None, - "has_more": obj.get("has_more"), - "next_page": obj.get("next_page"), - } - ) + _obj = cls.model_validate({ + "data": [Webhook.from_dict(_item) for _item in obj["data"]] if obj.get("data") is not None else None, + "has_more": obj.get("has_more"), + "next_page": obj.get("next_page") + }) return _obj + + diff --git a/cdp/client/models/webhook_wallet_activity_filter.py b/cdp/client/models/webhook_wallet_activity_filter.py index 5c7777e..30356d4 100644 --- a/cdp/client/models/webhook_wallet_activity_filter.py +++ b/cdp/client/models/webhook_wallet_activity_filter.py @@ -1,34 +1,34 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. -Do not edit the class manually. -""" + The version of the OpenAPI document: 0.0.1-alpha + Generated by OpenAPI Generator (https://openapi-generator.tech) -from __future__ import annotations + Do not edit the class manually. +""" # noqa: E501 -import json + +from __future__ import annotations import pprint import re # noqa: F401 -from typing import Any, ClassVar +import json from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set from typing_extensions import Self - class WebhookWalletActivityFilter(BaseModel): - """Filter for wallet activity events. This filter allows the client to specify one or more wallet addresses to monitor for activities such as transactions, transfers, or other types of events that are associated with the specified addresses.""" - - addresses: list[StrictStr] | None = Field( - default=None, description="A list of wallet addresses to filter on." - ) - wallet_id: StrictStr | None = Field( - default=None, description="The ID of the wallet that owns the webhook." - ) - __properties: ClassVar[list[str]] = ["addresses", "wallet_id"] + """ + Filter for wallet activity events. This filter allows the client to specify one or more wallet addresses to monitor for activities such as transactions, transfers, or other types of events that are associated with the specified addresses. + """ # noqa: E501 + addresses: Optional[List[StrictStr]] = Field(default=None, description="A list of wallet addresses to filter on.") + wallet_id: Optional[StrictStr] = Field(default=None, description="The ID of the wallet that owns the webhook.") + __properties: ClassVar[List[str]] = ["addresses", "wallet_id"] model_config = ConfigDict( populate_by_name=True, @@ -36,6 +36,7 @@ class WebhookWalletActivityFilter(BaseModel): protected_namespaces=(), ) + def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True)) @@ -46,11 +47,11 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self | None: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of WebhookWalletActivityFilter from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self) -> dict[str, Any]: + def to_dict(self) -> Dict[str, Any]: """Return the dictionary representation of the model using alias. This has the following differences from calling pydantic's @@ -60,7 +61,8 @@ def to_dict(self) -> dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ - excluded_fields: set[str] = set([]) + excluded_fields: Set[str] = set([ + ]) _dict = self.model_dump( by_alias=True, @@ -70,7 +72,7 @@ def to_dict(self) -> dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of WebhookWalletActivityFilter from a dict""" if obj is None: return None @@ -78,7 +80,10 @@ def from_dict(cls, obj: dict[str, Any] | None) -> Self | None: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate( - {"addresses": obj.get("addresses"), "wallet_id": obj.get("wallet_id")} - ) + _obj = cls.model_validate({ + "addresses": obj.get("addresses"), + "wallet_id": obj.get("wallet_id") + }) return _obj + + diff --git a/cdp/client/rest.py b/cdp/client/rest.py index ff864c2..78c1966 100644 --- a/cdp/client/rest.py +++ b/cdp/client/rest.py @@ -1,12 +1,16 @@ -"""Coinbase Platform API +# coding: utf-8 -This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. +""" + Coinbase Platform API -The version of the OpenAPI document: 0.0.1-alpha -Generated by OpenAPI Generator (https://openapi-generator.tech) + 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 -Do not edit the class manually. -""" import io import json @@ -32,6 +36,7 @@ def is_socks_proxy_url(url): class RESTResponse(io.IOBase): + def __init__(self, resp) -> None: self.response = resp self.status = resp.status @@ -53,11 +58,12 @@ def getheader(self, name, default=None): class RESTClientObject: + def __init__(self, configuration) -> None: # urllib3.PoolManager will pass all kw parameters to connectionpool - # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/poolmanager.py#L75 - # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/connectionpool.py#L680 - # Custom SSL certificates and client certificates: http://urllib3.readthedocs.io/en/latest/advanced-usage.html + # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/poolmanager.py#L75 # noqa: E501 + # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/connectionpool.py#L680 # noqa: E501 + # Custom SSL certificates and client certificates: http://urllib3.readthedocs.io/en/latest/advanced-usage.html # noqa: E501 # cert_reqs if configuration.verify_ssl: @@ -72,19 +78,22 @@ def __init__(self, configuration) -> None: "key_file": configuration.key_file, } if configuration.assert_hostname is not None: - pool_args["assert_hostname"] = configuration.assert_hostname + pool_args['assert_hostname'] = ( + configuration.assert_hostname + ) if configuration.retries is not None: - pool_args["retries"] = configuration.retries + pool_args['retries'] = configuration.retries if configuration.tls_server_name: - pool_args["server_hostname"] = configuration.tls_server_name + pool_args['server_hostname'] = configuration.tls_server_name + if configuration.socket_options is not None: - pool_args["socket_options"] = configuration.socket_options + pool_args['socket_options'] = configuration.socket_options if configuration.connection_pool_maxsize is not None: - pool_args["maxsize"] = configuration.connection_pool_maxsize + pool_args['maxsize'] = configuration.connection_pool_maxsize # https pool manager self.pool_manager: urllib3.PoolManager @@ -92,7 +101,6 @@ def __init__(self, configuration) -> None: if configuration.proxy: if is_socks_proxy_url(configuration.proxy): from urllib3.contrib.socks import SOCKSProxyManager - pool_args["proxy_url"] = configuration.proxy pool_args["headers"] = configuration.proxy_headers self.pool_manager = SOCKSProxyManager(**pool_args) @@ -104,7 +112,13 @@ def __init__(self, configuration) -> None: self.pool_manager = urllib3.PoolManager(**pool_args) def request( - self, method, url, headers=None, body=None, post_params=None, _request_timeout=None + self, + method, + url, + headers=None, + body=None, + post_params=None, + _request_timeout=None ): """Perform requests. @@ -121,10 +135,20 @@ def request( (connection, read) timeouts. """ method = method.upper() - assert method in ["GET", "HEAD", "DELETE", "POST", "PUT", "PATCH", "OPTIONS"] + assert method in [ + 'GET', + 'HEAD', + 'DELETE', + 'POST', + 'PUT', + 'PATCH', + 'OPTIONS' + ] if post_params and body: - raise ApiValueError("body parameter cannot be used with post_params parameter.") + raise ApiValueError( + "body parameter cannot be used with post_params parameter." + ) post_params = post_params or {} headers = headers or {} @@ -133,15 +157,25 @@ def request( if _request_timeout: if isinstance(_request_timeout, (int, float)): timeout = urllib3.Timeout(total=_request_timeout) - elif isinstance(_request_timeout, tuple) and len(_request_timeout) == 2: - timeout = urllib3.Timeout(connect=_request_timeout[0], read=_request_timeout[1]) + elif ( + isinstance(_request_timeout, tuple) + and len(_request_timeout) == 2 + ): + timeout = urllib3.Timeout( + connect=_request_timeout[0], + read=_request_timeout[1] + ) try: # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE` - if method in ["POST", "PUT", "PATCH", "OPTIONS", "DELETE"]: + if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']: + # no content type provided or payload is json - content_type = headers.get("Content-Type") - if not content_type or re.search("json", content_type, re.IGNORECASE): + content_type = headers.get('Content-Type') + if ( + not content_type + or re.search('json', content_type, re.IGNORECASE) + ): request_body = None if body is not None: request_body = json.dumps(body) @@ -151,9 +185,9 @@ def request( body=request_body, timeout=timeout, headers=headers, - preload_content=False, + preload_content=False ) - elif content_type == "application/x-www-form-urlencoded": + elif content_type == 'application/x-www-form-urlencoded': r = self.pool_manager.request( method, url, @@ -161,18 +195,15 @@ def request( encode_multipart=False, timeout=timeout, headers=headers, - preload_content=False, + preload_content=False ) - elif content_type == "multipart/form-data": + elif content_type == 'multipart/form-data': # must del headers['Content-Type'], or the correct # Content-Type which generated by urllib3 will be # overwritten. - del headers["Content-Type"] + del headers['Content-Type'] # Ensures that dict objects are serialized - post_params = [ - (a, json.dumps(b)) if isinstance(b, dict) else (a, b) - for a, b in post_params - ] + post_params = [(a, json.dumps(b)) if isinstance(b, dict) else (a,b) for a, b in post_params] r = self.pool_manager.request( method, url, @@ -180,7 +211,7 @@ def request( encode_multipart=True, timeout=timeout, headers=headers, - preload_content=False, + preload_content=False ) # Pass a `string` parameter directly in the body to support # other content types than JSON when `body` argument is @@ -192,9 +223,9 @@ def request( body=body, timeout=timeout, headers=headers, - preload_content=False, + preload_content=False ) - elif headers["Content-Type"] == "text/plain" and isinstance(body, bool): + elif headers['Content-Type'] == 'text/plain' and isinstance(body, bool): request_body = "true" if body else "false" r = self.pool_manager.request( method, @@ -202,8 +233,7 @@ def request( body=request_body, preload_content=False, timeout=timeout, - headers=headers, - ) + headers=headers) else: # Cannot generate the request from given parameters msg = """Cannot prepare a request message for provided @@ -213,7 +243,12 @@ def request( # For `GET`, `HEAD` else: r = self.pool_manager.request( - method, url, fields={}, timeout=timeout, headers=headers, preload_content=False + method, + url, + fields={}, + timeout=timeout, + headers=headers, + preload_content=False ) except urllib3.exceptions.SSLError as e: msg = "\n".join([type(e).__name__, str(e)]) diff --git a/cdp/smart_contract.py b/cdp/smart_contract.py new file mode 100644 index 0000000..58d80a2 --- /dev/null +++ b/cdp/smart_contract.py @@ -0,0 +1,313 @@ +import json +import time +from decimal import Decimal +from typing import Any, Dict, List, Optional, Union + +from eth_account.signers.local import LocalAccount + +from cdp.asset import Asset +from cdp.cdp import Cdp +from cdp.client.models.create_smart_contract_request import CreateSmartContractRequest +from cdp.client.models.deploy_smart_contract_request import DeploySmartContractRequest +from cdp.client.models.smart_contract import SmartContract as SmartContractModel +from cdp.client.models.smart_contract_type import SmartContractType as SmartContractTypeModel +from cdp.contract_invocation import ContractInvocation +from cdp.errors import TimeoutError +from cdp.transaction import Transaction + + +class SmartContract: + """A representation of a SmartContract on the blockchain.""" + + class Type: + """Enumeration of SmartContract types.""" + + ERC20 = "ERC20" + ERC721 = "ERC721" + ERC1155 = "ERC1155" + + def __str__(self) -> str: + """Return a string representation of the Type.""" + return self.value + + def __repr__(self) -> str: + """Return a string representation of the Type.""" + return str(self) + + class TokenOptions: + """Options for ERC20 token contracts.""" + + def __init__(self, name: str, symbol: str, total_supply: Union[int, Decimal, str]): + self.name = name + self.symbol = symbol + self.total_supply = total_supply + + class NFTOptions: + """Options for ERC721 NFT contracts.""" + + def __init__(self, name: str, symbol: str, base_uri: str): + self.name = name + self.symbol = symbol + self.base_uri = base_uri + + class MultiTokenOptions: + """Options for ERC1155 multi-token contracts.""" + + def __init__(self, uri: str): + self.uri = uri + + def __init__(self, model: SmartContractModel) -> None: + """Initialize the SmartContract class. + + Args: + model (SmartContractModel): The model representing the smart contract. + + Raises: + ValueError: If the smart contract model is empty. + """ + if not model: + raise ValueError("SmartContract model cannot be empty") + self._model = model + self._transaction = None + + @property + def smart_contract_id(self) -> str: + """Get the smart contract ID. + + Returns: + str: The smart contract ID. + """ + return self._model.smart_contract_id + + @property + def network_id(self) -> str: + """Get the network ID of the smart contract. + + Returns: + str: The network ID. + """ + return self._model.network_id + + @property + def wallet_id(self) -> str: + """Get the wallet ID that deployed the smart contract. + + Returns: + str: The wallet ID. + """ + return self._model.wallet_id + + @property + def contract_address(self) -> str: + """Get the contract address of the smart contract. + + Returns: + str: The contract address. + """ + return self._model.contract_address + + @property + def deployer_address(self) -> str: + """Get the deployer address of the smart contract. + + Returns: + str: The deployer address. + """ + return self._model.deployer_address + + @property + def type(self) -> str: + """Get the type of the smart contract. + + Returns: + str: The smart contract type. + + Raises: + ValueError: If the smart contract type is unknown. + """ + if self._model.type == SmartContractTypeModel.ERC20: + return self.Type.ERC20 + elif self._model.type == SmartContractTypeModel.ERC721: + return self.Type.ERC721 + elif self._model.type == SmartContractTypeModel.ERC1155: + return self.Type.ERC1155 + else: + raise ValueError(f"Unknown smart contract type: {self._model.type}") + + @property + def options(self) -> Union[TokenOptions, NFTOptions, MultiTokenOptions]: + """Get the options of the smart contract. + + Returns: + Union[TokenOptions, NFTOptions, MultiTokenOptions]: The smart contract options. + """ + if self.type == self.Type.ERC20: + return self.TokenOptions( + name=self._model.options.name, + symbol=self._model.options.symbol, + total_supply=self._model.options.total_supply, + ) + elif self.type == self.Type.ERC721: + return self.NFTOptions( + name=self._model.options.name, + symbol=self._model.options.symbol, + base_uri=self._model.options.base_uri, + ) + else: + return self.MultiTokenOptions(uri=self._model.options.uri) + + @property + def abi(self) -> Dict[str, Any]: + """Get the ABI of the smart contract. + + Returns: + Dict[str, Any]: The ABI as a JSON object. + """ + return json.loads(self._model.abi) + + @property + def transaction(self) -> Transaction: + """Get the transaction associated with the smart contract deployment. + + Returns: + Transaction: The transaction. + """ + if self._transaction is None and self._model.transaction is not None: + self._update_transaction(self._model) + return self._transaction + + def sign(self, key: LocalAccount) -> "SmartContract": + """Sign the smart contract deployment with the given key. + + Args: + key (LocalAccount): The key to sign the smart contract deployment with. + + Returns: + SmartContract: The signed SmartContract object. + + Raises: + ValueError: If the key is not a LocalAccount. + """ + if not isinstance(key, LocalAccount): + raise ValueError("key must be a LocalAccount") + + self.transaction.sign(key) + return self + + def broadcast(self) -> "SmartContract": + """Broadcast the smart contract deployment to the network. + + Returns: + SmartContract: The broadcasted SmartContract object. + + Raises: + ValueError: If the smart contract deployment is not signed. + """ + if not self.transaction.signed: + raise ValueError("Cannot broadcast unsigned SmartContract deployment") + + deploy_smart_contract_request = DeploySmartContractRequest( + signed_payload=self.transaction.signature + ) + + model = Cdp.api_clients.smart_contracts.deploy_smart_contract( + wallet_id=self.wallet_id, + deployer_address=self.deployer_address, + smart_contract_id=self.smart_contract_id, + deploy_smart_contract_request=deploy_smart_contract_request, + ) + self._model = model + return self + + def reload(self) -> "SmartContract": + """Reload the SmartContract model with the latest data from the server. + + Returns: + SmartContract: The updated SmartContract object. + """ + model = Cdp.api_clients.smart_contracts.get_smart_contract( + wallet_id=self.wallet_id, + deployer_address=self.deployer_address, + smart_contract_id=self.smart_contract_id, + ) + self._model = model + self._transaction = None + return self + + def wait(self, interval_seconds: float = 0.2, timeout_seconds: float = 10) -> "SmartContract": + """Wait until the smart contract deployment is confirmed on the network or fails on chain. + + Args: + interval_seconds (float): The interval to check the status of the smart contract deployment. + timeout_seconds (float): The maximum time to wait for the smart contract deployment to be confirmed. + + Returns: + SmartContract: The SmartContract object in a terminal state. + + Raises: + TimeoutError: If the smart contract deployment times out. + """ + start_time = time.time() + while not self.transaction.terminal_state: + self.reload() + + if time.time() - start_time > timeout_seconds: + raise TimeoutError("SmartContract deployment timed out") + + time.sleep(interval_seconds) + + return self + + @classmethod + def create( + cls, + wallet_id: str, + address_id: str, + options: Union[TokenOptions, NFTOptions, MultiTokenOptions], + ) -> "SmartContract": + """Create a new SmartContract object. + + Args: + wallet_id (str): The ID of the wallet that will deploy the smart contract. + address_id (str): The ID of the address that will deploy the smart contract. + type (str): The type of the smart contract. + options (Union[TokenOptions, NFTOptions, MultiTokenOptions]): The options of the smart contract. + """ + + if isinstance(options, cls.TokenOptions): + type = "erc20" + elif isinstance(options, cls.NFTOptions): + type = "erc721" + elif isinstance(options, cls.MultiTokenOptions): + type = "erc1155" + else: + raise ValueError("Invalid options type provided") + smart_contract_request = CreateSmartContractRequest( + type=type, + options=options, + ) + + model = Cdp.api_clients.smart_contracts.create_smart_contract( + wallet_id=wallet_id, + address_id=address_id, + smart_contract_request=smart_contract_request, + ) + + return cls(model) + + def _update_transaction(self, model: SmartContractModel) -> None: + """Update the transaction with the new model.""" + if model.transaction is not None: + self._transaction = Transaction(model.transaction) + + def __str__(self) -> str: + """Return a string representation of the smart contract.""" + return ( + f"SmartContract: (smart_contract_id: {self.smart_contract_id}, network_id: {self.network_id}, " + f"contract_address: {self.contract_address}, deployer_address: {self.deployer_address}, " + f"type: {self.type})" + ) + + def __repr__(self) -> str: + """Return a string representation of the smart contract.""" + return str(self) diff --git a/cdp/wallet_address.py b/cdp/wallet_address.py index c530781..a90e52a 100644 --- a/cdp/wallet_address.py +++ b/cdp/wallet_address.py @@ -12,6 +12,7 @@ from cdp.contract_invocation import ContractInvocation from cdp.errors import InsufficientFundsError from cdp.payload_signature import PayloadSignature +from cdp.smart_contract import SmartContract from cdp.trade import Trade from cdp.transfer import Transfer @@ -221,6 +222,84 @@ def sign_payload(self, unsigned_payload: str) -> PayloadSignature: signature=signature, ) + def deploy_token( + self, name: str, symbol: str, total_supply: Union[int, float, Decimal, str] + ) -> SmartContract: + """Deploy a token smart contract. + + Args: + name (str): The name of the token. + symbol (str): The symbol of the token. + totalSupply (Union[Number, Decimal, str]): The total supply of the token. + + Returns: + SmartContract: The deployed smart contract. + + """ + smart_contract = SmartContract.create( + wallet_id=self.wallet_id, + address_id=self.address_id, + options=SmartContract.TokenOptions(name=name, symbol=symbol, total_supply=total_supply), + ) + + if Cdp.use_server_signer: + return smart_contract + + smart_contract.sign(self.key) + smart_contract.broadcast() + + return smart_contract + + def deploy_nft(self, name: str, symbol: str, base_uri: str) -> SmartContract: + """Deploy an NFT smart contract. + + Args: + name (str): The name of the NFT. + symbol (str): The symbol of the NFT. + base_uri (str): The base URI for the NFT. + + Returns: + SmartContract: The deployed smart contract. + + """ + smart_contract = SmartContract.create( + wallet_id=self.wallet_id, + address_id=self.address_id, + options=SmartContract.NFTOptions(name=name, symbol=symbol, base_uri=base_uri), + ) + + if Cdp.use_server_signer: + return smart_contract + + smart_contract.sign(self.key) + smart_contract.broadcast() + + return smart_contract + + def deploy_multi_token(self, uri: str) -> SmartContract: + """Deploy a multi-token smart contract. + + Args: + uri (str): The URI for the multi-token contract. + + Returns: + SmartContract: The deployed smart contract. + + """ + smart_contract = SmartContract.create( + wallet_id=self.wallet_id, + address_id=self.address_id, + options=SmartContract.MultiTokenOptions(uri=uri), + ) + + if Cdp.use_server_signer: + return smart_contract + + smart_contract.sign(self.key) + smart_contract.broadcast() + + return smart_contract + def transfers(self) -> Iterator[Transfer]: """List transfers for this wallet address. From d67d616c17222545f287aa6632ee42d0f49d78ef Mon Sep 17 00:00:00 2001 From: Rohan Agarwal Date: Mon, 30 Sep 2024 14:04:38 -0400 Subject: [PATCH 02/27] WIP --- CONTRIBUTING.md | 38 +++++++++++++++++++++++++++++++++++++- cdp/smart_contract.py | 28 ++++++++++++++++++++-------- cdp/wallet_address.py | 2 +- 3 files changed, 58 insertions(+), 10 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c4b5e13..ade2f55 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -20,6 +20,7 @@ To install all dependencies, run: make install-deps ``` +<<<<<<< HEAD ### Formatting To format the code, run: @@ -36,13 +37,34 @@ To detect all lint errors, run: make lint ``` +======= +### Linting + +>>>>>>> cf3f5f1 (WIP) To autocorrect all lint errors, run: ```bash make lint-fix ``` +<<<<<<< HEAD +### Testing +======= +To detect all lint errors, run: + +```bash +make lint +``` + ### Testing + +Install the `pytest` and `pytest-cov` packages to run tests: + +```bash +pip install pytest pytest-cov +``` + +>>>>>>> cf3f5f1 (WIP) To run all tests, run: ```bash @@ -51,8 +73,22 @@ make test ### Generating Documentation +<<<<<<< HEAD To build and view the documentation locally, run: ```bash make local-docs -``` \ No newline at end of file +``` +======= +To generate documentation from the Python docstrings, run: + +```bash +make docs +``` + +To view the documentation, run: + +```bash +make local-docs +``` +>>>>>>> cf3f5f1 (WIP) diff --git a/cdp/smart_contract.py b/cdp/smart_contract.py index 58d80a2..0813e0b 100644 --- a/cdp/smart_contract.py +++ b/cdp/smart_contract.py @@ -1,17 +1,15 @@ import json import time from decimal import Decimal -from typing import Any, Dict, List, Optional, Union +from typing import Any from eth_account.signers.local import LocalAccount -from cdp.asset import Asset from cdp.cdp import Cdp from cdp.client.models.create_smart_contract_request import CreateSmartContractRequest from cdp.client.models.deploy_smart_contract_request import DeploySmartContractRequest from cdp.client.models.smart_contract import SmartContract as SmartContractModel from cdp.client.models.smart_contract_type import SmartContractType as SmartContractTypeModel -from cdp.contract_invocation import ContractInvocation from cdp.errors import TimeoutError from cdp.transaction import Transaction @@ -37,7 +35,7 @@ def __repr__(self) -> str: class TokenOptions: """Options for ERC20 token contracts.""" - def __init__(self, name: str, symbol: str, total_supply: Union[int, Decimal, str]): + def __init__(self, name: str, symbol: str, total_supply: int | Decimal | str): self.name = name self.symbol = symbol self.total_supply = total_supply @@ -64,6 +62,7 @@ def __init__(self, model: SmartContractModel) -> None: Raises: ValueError: If the smart contract model is empty. + """ if not model: raise ValueError("SmartContract model cannot be empty") @@ -76,6 +75,7 @@ def smart_contract_id(self) -> str: Returns: str: The smart contract ID. + """ return self._model.smart_contract_id @@ -85,6 +85,7 @@ def network_id(self) -> str: Returns: str: The network ID. + """ return self._model.network_id @@ -94,6 +95,7 @@ def wallet_id(self) -> str: Returns: str: The wallet ID. + """ return self._model.wallet_id @@ -103,6 +105,7 @@ def contract_address(self) -> str: Returns: str: The contract address. + """ return self._model.contract_address @@ -112,6 +115,7 @@ def deployer_address(self) -> str: Returns: str: The deployer address. + """ return self._model.deployer_address @@ -124,6 +128,7 @@ def type(self) -> str: Raises: ValueError: If the smart contract type is unknown. + """ if self._model.type == SmartContractTypeModel.ERC20: return self.Type.ERC20 @@ -135,11 +140,12 @@ def type(self) -> str: raise ValueError(f"Unknown smart contract type: {self._model.type}") @property - def options(self) -> Union[TokenOptions, NFTOptions, MultiTokenOptions]: + def options(self) -> TokenOptions | NFTOptions | MultiTokenOptions: """Get the options of the smart contract. Returns: Union[TokenOptions, NFTOptions, MultiTokenOptions]: The smart contract options. + """ if self.type == self.Type.ERC20: return self.TokenOptions( @@ -157,11 +163,12 @@ def options(self) -> Union[TokenOptions, NFTOptions, MultiTokenOptions]: return self.MultiTokenOptions(uri=self._model.options.uri) @property - def abi(self) -> Dict[str, Any]: + def abi(self) -> dict[str, Any]: """Get the ABI of the smart contract. Returns: Dict[str, Any]: The ABI as a JSON object. + """ return json.loads(self._model.abi) @@ -171,6 +178,7 @@ def transaction(self) -> Transaction: Returns: Transaction: The transaction. + """ if self._transaction is None and self._model.transaction is not None: self._update_transaction(self._model) @@ -187,6 +195,7 @@ def sign(self, key: LocalAccount) -> "SmartContract": Raises: ValueError: If the key is not a LocalAccount. + """ if not isinstance(key, LocalAccount): raise ValueError("key must be a LocalAccount") @@ -202,6 +211,7 @@ def broadcast(self) -> "SmartContract": Raises: ValueError: If the smart contract deployment is not signed. + """ if not self.transaction.signed: raise ValueError("Cannot broadcast unsigned SmartContract deployment") @@ -224,6 +234,7 @@ def reload(self) -> "SmartContract": Returns: SmartContract: The updated SmartContract object. + """ model = Cdp.api_clients.smart_contracts.get_smart_contract( wallet_id=self.wallet_id, @@ -246,6 +257,7 @@ def wait(self, interval_seconds: float = 0.2, timeout_seconds: float = 10) -> "S Raises: TimeoutError: If the smart contract deployment times out. + """ start_time = time.time() while not self.transaction.terminal_state: @@ -263,7 +275,7 @@ def create( cls, wallet_id: str, address_id: str, - options: Union[TokenOptions, NFTOptions, MultiTokenOptions], + options: TokenOptions | NFTOptions | MultiTokenOptions, ) -> "SmartContract": """Create a new SmartContract object. @@ -272,8 +284,8 @@ def create( address_id (str): The ID of the address that will deploy the smart contract. type (str): The type of the smart contract. options (Union[TokenOptions, NFTOptions, MultiTokenOptions]): The options of the smart contract. - """ + """ if isinstance(options, cls.TokenOptions): type = "erc20" elif isinstance(options, cls.NFTOptions): diff --git a/cdp/wallet_address.py b/cdp/wallet_address.py index a90e52a..2371a8c 100644 --- a/cdp/wallet_address.py +++ b/cdp/wallet_address.py @@ -223,7 +223,7 @@ def sign_payload(self, unsigned_payload: str) -> PayloadSignature: ) def deploy_token( - self, name: str, symbol: str, total_supply: Union[int, float, Decimal, str] + self, name: str, symbol: str, total_supply: int | float | Decimal | str ) -> SmartContract: """Deploy a token smart contract. From ea20d549abbe9613bc1d3189294e3152169c804e Mon Sep 17 00:00:00 2001 From: Rohan Agarwal Date: Mon, 30 Sep 2024 14:06:51 -0400 Subject: [PATCH 03/27] Fix --- cdp/wallet_address.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cdp/wallet_address.py b/cdp/wallet_address.py index 2371a8c..7c675a3 100644 --- a/cdp/wallet_address.py +++ b/cdp/wallet_address.py @@ -230,7 +230,7 @@ def deploy_token( Args: name (str): The name of the token. symbol (str): The symbol of the token. - totalSupply (Union[Number, Decimal, str]): The total supply of the token. + total_supply (Union[int, float, Decimal, str]): The total supply of the token. Returns: SmartContract: The deployed smart contract. From f34ff6d0af4472a07404366cca2a3b296efdf46b Mon Sep 17 00:00:00 2001 From: Rohan Agarwal Date: Mon, 30 Sep 2024 14:10:24 -0400 Subject: [PATCH 04/27] Fix --- cdp/smart_contract.py | 1 - 1 file changed, 1 deletion(-) diff --git a/cdp/smart_contract.py b/cdp/smart_contract.py index 0813e0b..a014171 100644 --- a/cdp/smart_contract.py +++ b/cdp/smart_contract.py @@ -10,7 +10,6 @@ from cdp.client.models.deploy_smart_contract_request import DeploySmartContractRequest from cdp.client.models.smart_contract import SmartContract as SmartContractModel from cdp.client.models.smart_contract_type import SmartContractType as SmartContractTypeModel -from cdp.errors import TimeoutError from cdp.transaction import Transaction From 963144adc269f9ba7daef922820a0ffeb7a561d1 Mon Sep 17 00:00:00 2001 From: Rohan Agarwal Date: Mon, 30 Sep 2024 14:22:39 -0400 Subject: [PATCH 05/27] fix --- cdp/smart_contract.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/cdp/smart_contract.py b/cdp/smart_contract.py index a014171..7a31de4 100644 --- a/cdp/smart_contract.py +++ b/cdp/smart_contract.py @@ -1,6 +1,5 @@ import json import time -from decimal import Decimal from typing import Any from eth_account.signers.local import LocalAccount @@ -129,11 +128,11 @@ def type(self) -> str: ValueError: If the smart contract type is unknown. """ - if self._model.type == SmartContractTypeModel.ERC20: + if self._model.type == SmartContractTypeModel.ERC20.value: return self.Type.ERC20 - elif self._model.type == SmartContractTypeModel.ERC721: + elif self._model.type == SmartContractTypeModel.ERC721.value: return self.Type.ERC721 - elif self._model.type == SmartContractTypeModel.ERC1155: + elif self._model.type == SmartContractTypeModel.ERC1155.value: return self.Type.ERC1155 else: raise ValueError(f"Unknown smart contract type: {self._model.type}") @@ -259,7 +258,7 @@ def wait(self, interval_seconds: float = 0.2, timeout_seconds: float = 10) -> "S """ start_time = time.time() - while not self.transaction.terminal_state: + while self.transaction is not None and not self.transaction.terminal_state: self.reload() if time.time() - start_time > timeout_seconds: @@ -281,7 +280,6 @@ def create( Args: wallet_id (str): The ID of the wallet that will deploy the smart contract. address_id (str): The ID of the address that will deploy the smart contract. - type (str): The type of the smart contract. options (Union[TokenOptions, NFTOptions, MultiTokenOptions]): The options of the smart contract. """ From f0a7b47e853aca85dbdb85b7ef4414027a4310a3 Mon Sep 17 00:00:00 2001 From: Rohan Agarwal Date: Mon, 30 Sep 2024 14:24:07 -0400 Subject: [PATCH 06/27] fix --- cdp/smart_contract.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cdp/smart_contract.py b/cdp/smart_contract.py index 7a31de4..94c7593 100644 --- a/cdp/smart_contract.py +++ b/cdp/smart_contract.py @@ -33,7 +33,7 @@ def __repr__(self) -> str: class TokenOptions: """Options for ERC20 token contracts.""" - def __init__(self, name: str, symbol: str, total_supply: int | Decimal | str): + def __init__(self, name: str, symbol: str, total_supply: int | str): self.name = name self.symbol = symbol self.total_supply = total_supply From 9638dabc65421e285a10ae71fb213c875325d67d Mon Sep 17 00:00:00 2001 From: Rohan Agarwal Date: Mon, 30 Sep 2024 14:43:34 -0400 Subject: [PATCH 07/27] Initial comments --- CONTRIBUTING.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ade2f55..371e4b6 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -56,6 +56,7 @@ To detect all lint errors, run: make lint ``` +<<<<<<< HEAD ### Testing Install the `pytest` and `pytest-cov` packages to run tests: @@ -65,6 +66,8 @@ pip install pytest pytest-cov ``` >>>>>>> cf3f5f1 (WIP) +======= +>>>>>>> 257ddef (Initial comments) To run all tests, run: ```bash @@ -73,6 +76,7 @@ make test ### Generating Documentation +<<<<<<< HEAD <<<<<<< HEAD To build and view the documentation locally, run: @@ -87,6 +91,9 @@ make docs ``` To view the documentation, run: +======= +To build and view the documentation, run: +>>>>>>> 257ddef (Initial comments) ```bash make local-docs From fdc8ec4748a0afe82e69b80bad9c6b5cb02753d5 Mon Sep 17 00:00:00 2001 From: Rohan Agarwal Date: Mon, 30 Sep 2024 14:57:11 -0400 Subject: [PATCH 08/27] Address feedback --- cdp/smart_contract.py | 79 ++++++++++--------------------------------- cdp/wallet_address.py | 3 ++ 2 files changed, 20 insertions(+), 62 deletions(-) diff --git a/cdp/smart_contract.py b/cdp/smart_contract.py index 94c7593..c161206 100644 --- a/cdp/smart_contract.py +++ b/cdp/smart_contract.py @@ -1,6 +1,7 @@ import json import time from typing import Any +from enum import Enum from eth_account.signers.local import LocalAccount @@ -8,14 +9,13 @@ from cdp.client.models.create_smart_contract_request import CreateSmartContractRequest from cdp.client.models.deploy_smart_contract_request import DeploySmartContractRequest from cdp.client.models.smart_contract import SmartContract as SmartContractModel -from cdp.client.models.smart_contract_type import SmartContractType as SmartContractTypeModel from cdp.transaction import Transaction class SmartContract: """A representation of a SmartContract on the blockchain.""" - class Type: + class Type(Enum): """Enumeration of SmartContract types.""" ERC20 = "ERC20" @@ -30,28 +30,6 @@ def __repr__(self) -> str: """Return a string representation of the Type.""" return str(self) - class TokenOptions: - """Options for ERC20 token contracts.""" - - def __init__(self, name: str, symbol: str, total_supply: int | str): - self.name = name - self.symbol = symbol - self.total_supply = total_supply - - class NFTOptions: - """Options for ERC721 NFT contracts.""" - - def __init__(self, name: str, symbol: str, base_uri: str): - self.name = name - self.symbol = symbol - self.base_uri = base_uri - - class MultiTokenOptions: - """Options for ERC1155 multi-token contracts.""" - - def __init__(self, uri: str): - self.uri = uri - def __init__(self, model: SmartContractModel) -> None: """Initialize the SmartContract class. @@ -118,47 +96,30 @@ def deployer_address(self) -> str: return self._model.deployer_address @property - def type(self) -> str: + def type(self) -> Type: """Get the type of the smart contract. Returns: - str: The smart contract type. + Type: The smart contract type. Raises: ValueError: If the smart contract type is unknown. """ - if self._model.type == SmartContractTypeModel.ERC20.value: - return self.Type.ERC20 - elif self._model.type == SmartContractTypeModel.ERC721.value: - return self.Type.ERC721 - elif self._model.type == SmartContractTypeModel.ERC1155.value: - return self.Type.ERC1155 - else: + try: + return self.Type(self._model.type) + except ValueError: raise ValueError(f"Unknown smart contract type: {self._model.type}") @property - def options(self) -> TokenOptions | NFTOptions | MultiTokenOptions: + def options(self) -> dict[str, Any]: """Get the options of the smart contract. Returns: - Union[TokenOptions, NFTOptions, MultiTokenOptions]: The smart contract options. + dict[str, Any]: The smart contract options. """ - if self.type == self.Type.ERC20: - return self.TokenOptions( - name=self._model.options.name, - symbol=self._model.options.symbol, - total_supply=self._model.options.total_supply, - ) - elif self.type == self.Type.ERC721: - return self.NFTOptions( - name=self._model.options.name, - symbol=self._model.options.symbol, - base_uri=self._model.options.base_uri, - ) - else: - return self.MultiTokenOptions(uri=self._model.options.uri) + return self._model.options.__dict__ @property def abi(self) -> dict[str, Any]: @@ -240,11 +201,11 @@ def reload(self) -> "SmartContract": smart_contract_id=self.smart_contract_id, ) self._model = model - self._transaction = None + self._update_transaction(model) return self def wait(self, interval_seconds: float = 0.2, timeout_seconds: float = 10) -> "SmartContract": - """Wait until the smart contract deployment is confirmed on the network or fails on chain. + """Wait until the smart contract deployment is confirmed on the network or fails onchain. Args: interval_seconds (float): The interval to check the status of the smart contract deployment. @@ -273,26 +234,20 @@ def create( cls, wallet_id: str, address_id: str, - options: TokenOptions | NFTOptions | MultiTokenOptions, + type: Type, + options: dict[str, Any], ) -> "SmartContract": """Create a new SmartContract object. Args: wallet_id (str): The ID of the wallet that will deploy the smart contract. address_id (str): The ID of the address that will deploy the smart contract. - options (Union[TokenOptions, NFTOptions, MultiTokenOptions]): The options of the smart contract. + type (Type): The type of the smart contract (ERC20, ERC721, or ERC1155). + options (dict[str, Any]): The options of the smart contract. """ - if isinstance(options, cls.TokenOptions): - type = "erc20" - elif isinstance(options, cls.NFTOptions): - type = "erc721" - elif isinstance(options, cls.MultiTokenOptions): - type = "erc1155" - else: - raise ValueError("Invalid options type provided") smart_contract_request = CreateSmartContractRequest( - type=type, + type=type.value, options=options, ) diff --git a/cdp/wallet_address.py b/cdp/wallet_address.py index 7c675a3..cb5a4a7 100644 --- a/cdp/wallet_address.py +++ b/cdp/wallet_address.py @@ -239,6 +239,7 @@ def deploy_token( smart_contract = SmartContract.create( wallet_id=self.wallet_id, address_id=self.address_id, + type=SmartContract.Type.ERC20, options=SmartContract.TokenOptions(name=name, symbol=symbol, total_supply=total_supply), ) @@ -265,6 +266,7 @@ def deploy_nft(self, name: str, symbol: str, base_uri: str) -> SmartContract: smart_contract = SmartContract.create( wallet_id=self.wallet_id, address_id=self.address_id, + type=SmartContract.Type.ERC721, options=SmartContract.NFTOptions(name=name, symbol=symbol, base_uri=base_uri), ) @@ -289,6 +291,7 @@ def deploy_multi_token(self, uri: str) -> SmartContract: smart_contract = SmartContract.create( wallet_id=self.wallet_id, address_id=self.address_id, + type=SmartContract.Type.ERC1155, options=SmartContract.MultiTokenOptions(uri=uri), ) From 9f75fb9663621b3250e804cfced704657ecd57d0 Mon Sep 17 00:00:00 2001 From: Rohan Agarwal Date: Mon, 30 Sep 2024 17:00:01 -0400 Subject: [PATCH 09/27] Feedback --- cdp/smart_contract.py | 132 +++++++++++++++++++++++++++++++++--------- 1 file changed, 106 insertions(+), 26 deletions(-) diff --git a/cdp/smart_contract.py b/cdp/smart_contract.py index c161206..7189058 100644 --- a/cdp/smart_contract.py +++ b/cdp/smart_contract.py @@ -1,14 +1,18 @@ import json import time -from typing import Any from enum import Enum +from typing import Any from eth_account.signers.local import LocalAccount from cdp.cdp import Cdp from cdp.client.models.create_smart_contract_request import CreateSmartContractRequest from cdp.client.models.deploy_smart_contract_request import DeploySmartContractRequest +from cdp.client.models.multi_token_contract_options import MultiTokenContractOptions +from cdp.client.models.nft_contract_options import NFTContractOptions from cdp.client.models.smart_contract import SmartContract as SmartContractModel +from cdp.client.models.smart_contract_options import SmartContractOptions +from cdp.client.models.token_contract_options import TokenContractOptions from cdp.transaction import Transaction @@ -30,11 +34,70 @@ def __repr__(self) -> str: """Return a string representation of the Type.""" return str(self) + class ContractOptions: + """Base class for contract options.""" + + def __init__(self, name: str, symbol: str): + """Initialize the ContractOptions. + + Args: + name: The name of the contract. + symbol: The symbol of the contract. + + """ + self.name = name + self.symbol = symbol + + class TokenContractOptions(ContractOptions): + """Options for token contracts (ERC20).""" + + def __init__(self, name: str, symbol: str, total_supply: int): + """Initialize the TokenContractOptions. + + Args: + name: The name of the token. + symbol: The symbol of the token. + total_supply: The total supply of the token. + + """ + super().__init__(name, symbol) + self.total_supply = total_supply + + class NFTContractOptions(ContractOptions): + """Options for NFT contracts (ERC721).""" + + def __init__(self, name: str, symbol: str, base_uri: str): + """Initialize the NFTContractOptions. + + Args: + name: The name of the NFT collection. + symbol: The symbol of the NFT collection. + base_uri: The base URI for the NFT metadata. + + """ + super().__init__(name, symbol) + self.base_uri = base_uri + + class MultiTokenContractOptions(ContractOptions): + """Options for multi-token contracts (ERC1155).""" + + def __init__(self, name: str, symbol: str, uri: str): + """Initialize the MultiTokenContractOptions. + + Args: + name: The name of the multi-token collection. + symbol: The symbol of the multi-token collection. + uri: The URI for all token metadata. + + """ + super().__init__(name, symbol) + self.uri = uri + def __init__(self, model: SmartContractModel) -> None: """Initialize the SmartContract class. Args: - model (SmartContractModel): The model representing the smart contract. + model: The model representing the smart contract. Raises: ValueError: If the smart contract model is empty. @@ -50,7 +113,7 @@ def smart_contract_id(self) -> str: """Get the smart contract ID. Returns: - str: The smart contract ID. + The smart contract ID. """ return self._model.smart_contract_id @@ -60,7 +123,7 @@ def network_id(self) -> str: """Get the network ID of the smart contract. Returns: - str: The network ID. + The network ID. """ return self._model.network_id @@ -70,7 +133,7 @@ def wallet_id(self) -> str: """Get the wallet ID that deployed the smart contract. Returns: - str: The wallet ID. + The wallet ID. """ return self._model.wallet_id @@ -80,7 +143,7 @@ def contract_address(self) -> str: """Get the contract address of the smart contract. Returns: - str: The contract address. + The contract address. """ return self._model.contract_address @@ -90,7 +153,7 @@ def deployer_address(self) -> str: """Get the deployer address of the smart contract. Returns: - str: The deployer address. + The deployer address. """ return self._model.deployer_address @@ -100,7 +163,7 @@ def type(self) -> Type: """Get the type of the smart contract. Returns: - Type: The smart contract type. + The smart contract type. Raises: ValueError: If the smart contract type is unknown. @@ -108,15 +171,15 @@ def type(self) -> Type: """ try: return self.Type(self._model.type) - except ValueError: - raise ValueError(f"Unknown smart contract type: {self._model.type}") + except ValueError as err: + raise ValueError(f"Unknown smart contract type: {self._model.type}") from err @property def options(self) -> dict[str, Any]: """Get the options of the smart contract. Returns: - dict[str, Any]: The smart contract options. + The smart contract options. """ return self._model.options.__dict__ @@ -126,7 +189,7 @@ def abi(self) -> dict[str, Any]: """Get the ABI of the smart contract. Returns: - Dict[str, Any]: The ABI as a JSON object. + The ABI as a JSON object. """ return json.loads(self._model.abi) @@ -136,7 +199,7 @@ def transaction(self) -> Transaction: """Get the transaction associated with the smart contract deployment. Returns: - Transaction: The transaction. + The transaction. """ if self._transaction is None and self._model.transaction is not None: @@ -147,10 +210,10 @@ def sign(self, key: LocalAccount) -> "SmartContract": """Sign the smart contract deployment with the given key. Args: - key (LocalAccount): The key to sign the smart contract deployment with. + key: The key to sign the smart contract deployment with. Returns: - SmartContract: The signed SmartContract object. + The signed SmartContract object. Raises: ValueError: If the key is not a LocalAccount. @@ -166,7 +229,7 @@ def broadcast(self) -> "SmartContract": """Broadcast the smart contract deployment to the network. Returns: - SmartContract: The broadcasted SmartContract object. + The broadcasted SmartContract object. Raises: ValueError: If the smart contract deployment is not signed. @@ -192,7 +255,7 @@ def reload(self) -> "SmartContract": """Reload the SmartContract model with the latest data from the server. Returns: - SmartContract: The updated SmartContract object. + The updated SmartContract object. """ model = Cdp.api_clients.smart_contracts.get_smart_contract( @@ -208,11 +271,11 @@ def wait(self, interval_seconds: float = 0.2, timeout_seconds: float = 10) -> "S """Wait until the smart contract deployment is confirmed on the network or fails onchain. Args: - interval_seconds (float): The interval to check the status of the smart contract deployment. - timeout_seconds (float): The maximum time to wait for the smart contract deployment to be confirmed. + interval_seconds: The interval to check the status of the smart contract deployment. + timeout_seconds: The maximum time to wait for the smart contract deployment to be confirmed. Returns: - SmartContract: The SmartContract object in a terminal state. + The SmartContract object in a terminal state. Raises: TimeoutError: If the smart contract deployment times out. @@ -235,20 +298,37 @@ def create( wallet_id: str, address_id: str, type: Type, - options: dict[str, Any], + options: TokenContractOptions | NFTContractOptions | MultiTokenContractOptions, ) -> "SmartContract": """Create a new SmartContract object. Args: - wallet_id (str): The ID of the wallet that will deploy the smart contract. - address_id (str): The ID of the address that will deploy the smart contract. - type (Type): The type of the smart contract (ERC20, ERC721, or ERC1155). - options (dict[str, Any]): The options of the smart contract. + wallet_id: The ID of the wallet that will deploy the smart contract. + address_id: The ID of the address that will deploy the smart contract. + type: The type of the smart contract (ERC20, ERC721, or ERC1155). + options: The options of the smart contract. + + Returns: + The created smart contract. + + Raises: + ValueError: If the options type is unsupported. """ + if isinstance(options, cls.TokenContractOptions): + openapi_options = TokenContractOptions(**options.__dict__) + elif isinstance(options, cls.NFTContractOptions): + openapi_options = NFTContractOptions(**options.__dict__) + elif isinstance(options, cls.MultiTokenContractOptions): + openapi_options = MultiTokenContractOptions(**options.__dict__) + else: + raise ValueError(f"Unsupported options type: {type(options)}") + + smart_contract_options = SmartContractOptions(actual_instance=openapi_options) + smart_contract_request = CreateSmartContractRequest( type=type.value, - options=options, + options=smart_contract_options, ) model = Cdp.api_clients.smart_contracts.create_smart_contract( From 3c3c470480333c35c7b4dcfa1a0d1620d7533593 Mon Sep 17 00:00:00 2001 From: Rohan Agarwal Date: Mon, 30 Sep 2024 17:05:57 -0400 Subject: [PATCH 10/27] Changes --- cdp/__init__.py | 1 + cdp/smart_contract.py | 29 ++++++++++------------------- 2 files changed, 11 insertions(+), 19 deletions(-) diff --git a/cdp/__init__.py b/cdp/__init__.py index 57e82e1..075a3ea 100644 --- a/cdp/__init__.py +++ b/cdp/__init__.py @@ -32,4 +32,5 @@ "Trade", "SponsoredSend", "PayloadSignature", + "SmartContract", ] diff --git a/cdp/smart_contract.py b/cdp/smart_contract.py index 7189058..7f2ea80 100644 --- a/cdp/smart_contract.py +++ b/cdp/smart_contract.py @@ -48,7 +48,7 @@ def __init__(self, name: str, symbol: str): self.name = name self.symbol = symbol - class TokenContractOptions(ContractOptions): + class TokenContractOptions(dict[str, Any]): """Options for token contracts (ERC20).""" def __init__(self, name: str, symbol: str, total_supply: int): @@ -58,12 +58,10 @@ def __init__(self, name: str, symbol: str, total_supply: int): name: The name of the token. symbol: The symbol of the token. total_supply: The total supply of the token. - """ - super().__init__(name, symbol) - self.total_supply = total_supply + super().__init__(name=name, symbol=symbol, total_supply=total_supply) - class NFTContractOptions(ContractOptions): + class NFTContractOptions(dict[str, Any]): """Options for NFT contracts (ERC721).""" def __init__(self, name: str, symbol: str, base_uri: str): @@ -73,25 +71,19 @@ def __init__(self, name: str, symbol: str, base_uri: str): name: The name of the NFT collection. symbol: The symbol of the NFT collection. base_uri: The base URI for the NFT metadata. - """ - super().__init__(name, symbol) - self.base_uri = base_uri + super().__init__(name=name, symbol=symbol, base_uri=base_uri) - class MultiTokenContractOptions(ContractOptions): + class MultiTokenContractOptions(dict[str, Any]): """Options for multi-token contracts (ERC1155).""" - def __init__(self, name: str, symbol: str, uri: str): + def __init__(self, uri: str): """Initialize the MultiTokenContractOptions. Args: - name: The name of the multi-token collection. - symbol: The symbol of the multi-token collection. uri: The URI for all token metadata. - """ - super().__init__(name, symbol) - self.uri = uri + super().__init__(uri=uri) def __init__(self, model: SmartContractModel) -> None: """Initialize the SmartContract class. @@ -313,14 +305,13 @@ def create( Raises: ValueError: If the options type is unsupported. - """ if isinstance(options, cls.TokenContractOptions): - openapi_options = TokenContractOptions(**options.__dict__) + openapi_options = TokenContractOptions(**options) elif isinstance(options, cls.NFTContractOptions): - openapi_options = NFTContractOptions(**options.__dict__) + openapi_options = NFTContractOptions(**options) elif isinstance(options, cls.MultiTokenContractOptions): - openapi_options = MultiTokenContractOptions(**options.__dict__) + openapi_options = MultiTokenContractOptions(**options) else: raise ValueError(f"Unsupported options type: {type(options)}") From 1b96c3a1afd7514ab4c5144e937666281b4616c6 Mon Sep 17 00:00:00 2001 From: Rohan Agarwal Date: Mon, 30 Sep 2024 17:32:58 -0400 Subject: [PATCH 11/27] WIP --- cdp/__init__.py | 1 + cdp/smart_contract.py | 36 +++++++++++++----------------------- cdp/wallet_address.py | 12 ++++++------ 3 files changed, 20 insertions(+), 29 deletions(-) diff --git a/cdp/__init__.py b/cdp/__init__.py index 075a3ea..0c2f049 100644 --- a/cdp/__init__.py +++ b/cdp/__init__.py @@ -7,6 +7,7 @@ from cdp.contract_invocation import ContractInvocation from cdp.faucet_transaction import FaucetTransaction from cdp.payload_signature import PayloadSignature +from cdp.smart_contract import SmartContract from cdp.sponsored_send import SponsoredSend from cdp.trade import Trade from cdp.transaction import Transaction diff --git a/cdp/smart_contract.py b/cdp/smart_contract.py index 7f2ea80..b592b55 100644 --- a/cdp/smart_contract.py +++ b/cdp/smart_contract.py @@ -22,9 +22,9 @@ class SmartContract: class Type(Enum): """Enumeration of SmartContract types.""" - ERC20 = "ERC20" - ERC721 = "ERC721" - ERC1155 = "ERC1155" + ERC20 = "erc20" + ERC721 = "erc721" + ERC1155 = "erc1155" def __str__(self) -> str: """Return a string representation of the Type.""" @@ -34,30 +34,17 @@ def __repr__(self) -> str: """Return a string representation of the Type.""" return str(self) - class ContractOptions: - """Base class for contract options.""" - - def __init__(self, name: str, symbol: str): - """Initialize the ContractOptions. - - Args: - name: The name of the contract. - symbol: The symbol of the contract. - - """ - self.name = name - self.symbol = symbol - class TokenContractOptions(dict[str, Any]): """Options for token contracts (ERC20).""" - def __init__(self, name: str, symbol: str, total_supply: int): + def __init__(self, name: str, symbol: str, total_supply: str): """Initialize the TokenContractOptions. Args: name: The name of the token. symbol: The symbol of the token. total_supply: The total supply of the token. + """ super().__init__(name=name, symbol=symbol, total_supply=total_supply) @@ -71,6 +58,7 @@ def __init__(self, name: str, symbol: str, base_uri: str): name: The name of the NFT collection. symbol: The symbol of the NFT collection. base_uri: The base URI for the NFT metadata. + """ super().__init__(name=name, symbol=symbol, base_uri=base_uri) @@ -82,6 +70,7 @@ def __init__(self, uri: str): Args: uri: The URI for all token metadata. + """ super().__init__(uri=uri) @@ -187,11 +176,11 @@ def abi(self) -> dict[str, Any]: return json.loads(self._model.abi) @property - def transaction(self) -> Transaction: - """Get the transaction associated with the smart contract deployment. + def transaction(self) -> Transaction | None: + """Get the transaction associated with the contract invocation. Returns: - The transaction. + Transaction: The transaction. """ if self._transaction is None and self._model.transaction is not None: @@ -305,6 +294,7 @@ def create( Raises: ValueError: If the options type is unsupported. + """ if isinstance(options, cls.TokenContractOptions): openapi_options = TokenContractOptions(**options) @@ -317,7 +307,7 @@ def create( smart_contract_options = SmartContractOptions(actual_instance=openapi_options) - smart_contract_request = CreateSmartContractRequest( + create_smart_contract_request = CreateSmartContractRequest( type=type.value, options=smart_contract_options, ) @@ -325,7 +315,7 @@ def create( model = Cdp.api_clients.smart_contracts.create_smart_contract( wallet_id=wallet_id, address_id=address_id, - smart_contract_request=smart_contract_request, + create_smart_contract_request=create_smart_contract_request, ) return cls(model) diff --git a/cdp/wallet_address.py b/cdp/wallet_address.py index cb5a4a7..cb5a492 100644 --- a/cdp/wallet_address.py +++ b/cdp/wallet_address.py @@ -222,9 +222,7 @@ def sign_payload(self, unsigned_payload: str) -> PayloadSignature: signature=signature, ) - def deploy_token( - self, name: str, symbol: str, total_supply: int | float | Decimal | str - ) -> SmartContract: + def deploy_token(self, name: str, symbol: str, total_supply: str) -> SmartContract: """Deploy a token smart contract. Args: @@ -240,7 +238,9 @@ def deploy_token( wallet_id=self.wallet_id, address_id=self.address_id, type=SmartContract.Type.ERC20, - options=SmartContract.TokenOptions(name=name, symbol=symbol, total_supply=total_supply), + options=SmartContract.TokenContractOptions( + name=name, symbol=symbol, total_supply=total_supply + ), ) if Cdp.use_server_signer: @@ -267,7 +267,7 @@ def deploy_nft(self, name: str, symbol: str, base_uri: str) -> SmartContract: wallet_id=self.wallet_id, address_id=self.address_id, type=SmartContract.Type.ERC721, - options=SmartContract.NFTOptions(name=name, symbol=symbol, base_uri=base_uri), + options=SmartContract.NFTContractOptions(name=name, symbol=symbol, base_uri=base_uri), ) if Cdp.use_server_signer: @@ -292,7 +292,7 @@ def deploy_multi_token(self, uri: str) -> SmartContract: wallet_id=self.wallet_id, address_id=self.address_id, type=SmartContract.Type.ERC1155, - options=SmartContract.MultiTokenOptions(uri=uri), + options=SmartContract.MultiTokenContractOptions(uri=uri), ) if Cdp.use_server_signer: From 0edc4fd13fd6b7cab09ed8a730b4cbdab73c1b1f Mon Sep 17 00:00:00 2001 From: Rohan Agarwal Date: Mon, 30 Sep 2024 18:02:36 -0400 Subject: [PATCH 12/27] latest --- cdp/smart_contract.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cdp/smart_contract.py b/cdp/smart_contract.py index b592b55..aa34679 100644 --- a/cdp/smart_contract.py +++ b/cdp/smart_contract.py @@ -177,7 +177,7 @@ def abi(self) -> dict[str, Any]: @property def transaction(self) -> Transaction | None: - """Get the transaction associated with the contract invocation. + """Get the transaction associated with the smart contract deployment. Returns: Transaction: The transaction. From 55bf36675040c2ce1e61135856352c740981287a Mon Sep 17 00:00:00 2001 From: Rohan Agarwal Date: Mon, 30 Sep 2024 18:17:10 -0400 Subject: [PATCH 13/27] works --- cdp/smart_contract.py | 2 +- cdp/transaction.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/cdp/smart_contract.py b/cdp/smart_contract.py index aa34679..b82a258 100644 --- a/cdp/smart_contract.py +++ b/cdp/smart_contract.py @@ -225,7 +225,7 @@ def broadcast(self) -> "SmartContract": model = Cdp.api_clients.smart_contracts.deploy_smart_contract( wallet_id=self.wallet_id, - deployer_address=self.deployer_address, + address_id=self.deployer_address, smart_contract_id=self.smart_contract_id, deploy_smart_contract_request=deploy_smart_contract_request, ) diff --git a/cdp/transaction.py b/cdp/transaction.py index 14f078b..e314838 100644 --- a/cdp/transaction.py +++ b/cdp/transaction.py @@ -125,12 +125,16 @@ def raw(self) -> DynamicFeeTransaction: "maxPriorityFeePerGas": int(parsed_payload["maxPriorityFeePerGas"], 16), "maxFeePerGas": int(parsed_payload["maxFeePerGas"], 16), "gas": int(parsed_payload["gas"], 16), - "to": Web3.to_bytes(hexstr=parsed_payload["to"]), "value": int(parsed_payload["value"], 16), "data": parsed_payload.get("input", ""), "type": "0x2", # EIP-1559 transaction type } + # Handle the 'to' field separately + if parsed_payload["to"]: + transaction_dict["to"] = Web3.to_bytes(hexstr=parsed_payload["to"]) + else: + transaction_dict["to"] = b"" # Empty bytes for contract deployment self._raw = DynamicFeeTransaction(transaction_dict) return self._raw From ebc9c0804260abaf77c0d1519eac9191140244db Mon Sep 17 00:00:00 2001 From: Rohan Agarwal Date: Mon, 30 Sep 2024 18:38:57 -0400 Subject: [PATCH 14/27] Address feedback --- cdp/smart_contract.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/cdp/smart_contract.py b/cdp/smart_contract.py index b82a258..41e5ef4 100644 --- a/cdp/smart_contract.py +++ b/cdp/smart_contract.py @@ -34,7 +34,7 @@ def __repr__(self) -> str: """Return a string representation of the Type.""" return str(self) - class TokenContractOptions(dict[str, Any]): + class TokenContractOptions(dict): """Options for token contracts (ERC20).""" def __init__(self, name: str, symbol: str, total_supply: str): @@ -48,7 +48,7 @@ def __init__(self, name: str, symbol: str, total_supply: str): """ super().__init__(name=name, symbol=symbol, total_supply=total_supply) - class NFTContractOptions(dict[str, Any]): + class NFTContractOptions(dict): """Options for NFT contracts (ERC721).""" def __init__(self, name: str, symbol: str, base_uri: str): @@ -62,7 +62,7 @@ def __init__(self, name: str, symbol: str, base_uri: str): """ super().__init__(name=name, symbol=symbol, base_uri=base_uri) - class MultiTokenContractOptions(dict[str, Any]): + class MultiTokenContractOptions(dict): """Options for multi-token contracts (ERC1155).""" def __init__(self, uri: str): @@ -150,10 +150,7 @@ def type(self) -> Type: ValueError: If the smart contract type is unknown. """ - try: - return self.Type(self._model.type) - except ValueError as err: - raise ValueError(f"Unknown smart contract type: {self._model.type}") from err + return self.Type(self._model.type) @property def options(self) -> dict[str, Any]: From 39689b7734af974dcc15eff2527f05c78b05d284 Mon Sep 17 00:00:00 2001 From: Rohan Agarwal Date: Mon, 30 Sep 2024 18:44:55 -0400 Subject: [PATCH 15/27] Fix contributing --- CONTRIBUTING.md | 45 +-------------------------------------------- 1 file changed, 1 insertion(+), 44 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 371e4b6..c4b5e13 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -20,7 +20,6 @@ To install all dependencies, run: make install-deps ``` -<<<<<<< HEAD ### Formatting To format the code, run: @@ -37,37 +36,13 @@ To detect all lint errors, run: make lint ``` -======= -### Linting - ->>>>>>> cf3f5f1 (WIP) To autocorrect all lint errors, run: ```bash make lint-fix ``` -<<<<<<< HEAD -### Testing -======= -To detect all lint errors, run: - -```bash -make lint -``` - -<<<<<<< HEAD ### Testing - -Install the `pytest` and `pytest-cov` packages to run tests: - -```bash -pip install pytest pytest-cov -``` - ->>>>>>> cf3f5f1 (WIP) -======= ->>>>>>> 257ddef (Initial comments) To run all tests, run: ```bash @@ -76,26 +51,8 @@ make test ### Generating Documentation -<<<<<<< HEAD -<<<<<<< HEAD To build and view the documentation locally, run: ```bash make local-docs -``` -======= -To generate documentation from the Python docstrings, run: - -```bash -make docs -``` - -To view the documentation, run: -======= -To build and view the documentation, run: ->>>>>>> 257ddef (Initial comments) - -```bash -make local-docs -``` ->>>>>>> cf3f5f1 (WIP) +``` \ No newline at end of file From 4c0a5cab9648ea5a27c96177671875fc6a347c5d Mon Sep 17 00:00:00 2001 From: Rohan Agarwal Date: Mon, 30 Sep 2024 19:51:38 -0400 Subject: [PATCH 16/27] Tests pass --- cdp/smart_contract.py | 29 ++++- cdp/wallet.py | 59 +++++++++ tests/test_smart_contract.py | 237 +++++++++++++++++++++++++++++++++++ 3 files changed, 319 insertions(+), 6 deletions(-) create mode 100644 tests/test_smart_contract.py diff --git a/cdp/smart_contract.py b/cdp/smart_contract.py index 41e5ef4..1e2b741 100644 --- a/cdp/smart_contract.py +++ b/cdp/smart_contract.py @@ -153,14 +153,28 @@ def type(self) -> Type: return self.Type(self._model.type) @property - def options(self) -> dict[str, Any]: + def options(self) -> TokenContractOptions | NFTContractOptions | MultiTokenContractOptions: """Get the options of the smart contract. Returns: - The smart contract options. + The smart contract options as a higher-level options class. + + Raises: + ValueError: If the smart contract type is unknown or if options are not set. """ - return self._model.options.__dict__ + if self._model.options is None or self._model.options.actual_instance is None: + raise ValueError("Smart contract options are not set") + + options_dict = self._model.options.actual_instance.__dict__ + if self.type == self.Type.ERC20: + return self.TokenContractOptions(**options_dict) + elif self.type == self.Type.ERC721: + return self.NFTContractOptions(**options_dict) + elif self.type == self.Type.ERC1155: + return self.MultiTokenContractOptions(**options_dict) + else: + raise ValueError(f"Unknown smart contract type: {self.type}") @property def abi(self) -> dict[str, Any]: @@ -325,9 +339,12 @@ def _update_transaction(self, model: SmartContractModel) -> None: def __str__(self) -> str: """Return a string representation of the smart contract.""" return ( - f"SmartContract: (smart_contract_id: {self.smart_contract_id}, network_id: {self.network_id}, " - f"contract_address: {self.contract_address}, deployer_address: {self.deployer_address}, " - f"type: {self.type})" + f"SmartContract: (smart_contract_id: {self.smart_contract_id}, " + f"wallet_id: {self.wallet_id}, network_id: {self.network_id}, " + f"contract_address: {self.contract_address}, type: {self.type}, " + f"transaction_hash: {self.transaction.transaction_hash if self.transaction else None}, " + f"transaction_link: {self.transaction.transaction_link if self.transaction else None}, " + f"status: {self.transaction.status if self.transaction else None})" ) def __repr__(self) -> str: diff --git a/cdp/wallet.py b/cdp/wallet.py index c117641..d19f465 100644 --- a/cdp/wallet.py +++ b/cdp/wallet.py @@ -29,6 +29,7 @@ from cdp.contract_invocation import ContractInvocation from cdp.faucet_transaction import FaucetTransaction from cdp.payload_signature import PayloadSignature +from cdp.smart_contract import SmartContract from cdp.trade import Trade from cdp.wallet_address import WalletAddress from cdp.wallet_data import WalletData @@ -716,3 +717,61 @@ def __repr__(self) -> str: """ return str(self) + + def deploy_token(self, name: str, symbol: str, total_supply: str) -> SmartContract: + """Deploy a token smart contract. + + Args: + name (str): The name of the token. + symbol (str): The symbol of the token. + total_supply (str): The total supply of the token. + + Returns: + SmartContract: The deployed smart contract. + + Raises: + ValueError: If the default address does not exist. + + """ + if self.default_address is None: + raise ValueError("Default address does not exist") + + return self.default_address.deploy_token(name, symbol, total_supply) + + def deploy_nft(self, name: str, symbol: str, base_uri: str) -> SmartContract: + """Deploy an NFT smart contract. + + Args: + name (str): The name of the NFT. + symbol (str): The symbol of the NFT. + base_uri (str): The base URI for the NFT. + + Returns: + SmartContract: The deployed smart contract. + + Raises: + ValueError: If the default address does not exist. + + """ + if self.default_address is None: + raise ValueError("Default address does not exist") + + return self.default_address.deploy_nft(name, symbol, base_uri) + + def deploy_multi_token(self, uri: str) -> SmartContract: + """Deploy a multi-token smart contract. + + Args: + uri (str): The URI for the multi-token contract. + + Returns: + SmartContract: The deployed smart contract. + + Raises: + ValueError: If the default address does not exist. + + """ + if self.default_address is None: + raise ValueError("Default address does not exist") + + return self.default_address.deploy_multi_token(uri) diff --git a/tests/test_smart_contract.py b/tests/test_smart_contract.py new file mode 100644 index 0000000..54032d4 --- /dev/null +++ b/tests/test_smart_contract.py @@ -0,0 +1,237 @@ +from unittest.mock import ANY, Mock, call, patch + +import pytest + +from cdp.client.models.smart_contract import SmartContract as SmartContractModel +from cdp.client.models.smart_contract_options import SmartContractOptions +from cdp.client.models.token_contract_options import TokenContractOptions +from cdp.client.models.transaction import Transaction as TransactionModel +from cdp.smart_contract import SmartContract + + +@pytest.fixture +def transaction_model_factory(): + """Create and return a factory for creating TransactionModel fixtures.""" + + def _create_transaction_model(status="complete"): + return TransactionModel( + network_id="base-sepolia", + transaction_hash="0xtransactionhash", + from_address_id="0xaddressid", + to_address_id="0xdestination", + unsigned_payload="0xunsignedpayload", + signed_payload="0xsignedpayload" + if status in ["signed", "broadcast", "complete"] + else None, + status=status, + transaction_link="https://sepolia.basescan.org/tx/0xtransactionlink" + if status == "complete" + else None, + ) + + return _create_transaction_model + + +@pytest.fixture +def smart_contract_model_factory(transaction_model_factory): + """Create and return a factory for creating SmartContractModel fixtures.""" + + def _create_smart_contract_model(status="complete"): + token_options = TokenContractOptions(name="TestToken", symbol="TT", total_supply="1000000") + smart_contract_options = SmartContractOptions(actual_instance=token_options) + + return SmartContractModel( + smart_contract_id="test-contract-id", + network_id="base-sepolia", + wallet_id="test-wallet-id", + contract_address="0xcontractaddress", + deployer_address="0xdeployeraddress", + type="erc20", + options=smart_contract_options, + abi='{"abi": "data"}', + transaction=transaction_model_factory(status), + ) + + return _create_smart_contract_model + + +@pytest.fixture +def smart_contract_factory(smart_contract_model_factory): + """Create and return a factory for creating SmartContract fixtures.""" + + def _create_smart_contract(status="complete"): + smart_contract_model = smart_contract_model_factory(status) + return SmartContract(smart_contract_model) + + return _create_smart_contract + + +def test_smart_contract_initialization(smart_contract_factory): + """Test the initialization of a SmartContract object.""" + smart_contract = smart_contract_factory() + assert isinstance(smart_contract, SmartContract) + + +def test_smart_contract_properties(smart_contract_factory): + """Test the properties of a SmartContract object.""" + smart_contract = smart_contract_factory() + assert smart_contract.smart_contract_id == "test-contract-id" + assert smart_contract.wallet_id == "test-wallet-id" + assert smart_contract.network_id == "base-sepolia" + assert smart_contract.contract_address == "0xcontractaddress" + assert smart_contract.deployer_address == "0xdeployeraddress" + assert smart_contract.type.value == SmartContract.Type.ERC20.value + assert smart_contract.options == { + "name": "TestToken", + "symbol": "TT", + "total_supply": "1000000", + } + assert smart_contract.abi == {"abi": "data"} + assert smart_contract.transaction.status.value == "complete" + assert ( + smart_contract.transaction.transaction_link + == "https://sepolia.basescan.org/tx/0xtransactionlink" + ) + assert smart_contract.transaction.transaction_hash == "0xtransactionhash" + + +@patch("cdp.Cdp.api_clients") +def test_create_smart_contract(mock_api_clients, smart_contract_factory): + """Test the creation of a SmartContract object.""" + mock_create_contract = Mock() + mock_create_contract.return_value = smart_contract_factory()._model + mock_api_clients.smart_contracts.create_smart_contract = mock_create_contract + + smart_contract = SmartContract.create( + wallet_id="test-wallet-id", + address_id="0xaddressid", + type=SmartContract.Type.ERC20, + options=SmartContract.TokenContractOptions( + name="TestToken", symbol="TT", total_supply="1000000" + ), + ) + + assert isinstance(smart_contract, SmartContract) + mock_create_contract.assert_called_once_with( + wallet_id="test-wallet-id", + address_id="0xaddressid", + create_smart_contract_request=ANY, + ) + + +@patch("cdp.Cdp.api_clients") +def test_broadcast_smart_contract(mock_api_clients, smart_contract_factory): + """Test the broadcasting of a SmartContract object.""" + smart_contract = smart_contract_factory(status="signed") + mock_broadcast = Mock(return_value=smart_contract_factory(status="broadcast")._model) + mock_api_clients.smart_contracts.deploy_smart_contract = mock_broadcast + + response = smart_contract.broadcast() + + assert isinstance(response, SmartContract) + mock_broadcast.assert_called_once_with( + wallet_id=smart_contract.wallet_id, + address_id=smart_contract.deployer_address, + smart_contract_id=smart_contract.smart_contract_id, + deploy_smart_contract_request=ANY, + ) + + +def test_broadcast_unsigned_smart_contract(smart_contract_factory): + """Test the broadcasting of an unsigned SmartContract object.""" + smart_contract = smart_contract_factory(status="pending") + with pytest.raises(ValueError, match="Cannot broadcast unsigned SmartContract deployment"): + smart_contract.broadcast() + + +@patch("cdp.Cdp.api_clients") +def test_reload_smart_contract(mock_api_clients, smart_contract_factory): + """Test the reloading of a SmartContract object.""" + smart_contract = smart_contract_factory(status="pending") + complete_contract = smart_contract_factory(status="complete") + mock_get_contract = Mock() + mock_api_clients.smart_contracts.get_smart_contract = mock_get_contract + mock_get_contract.return_value = complete_contract._model + + smart_contract.reload() + + mock_get_contract.assert_called_once_with( + wallet_id=smart_contract.wallet_id, + deployer_address=smart_contract.deployer_address, + smart_contract_id=smart_contract.smart_contract_id, + ) + assert smart_contract.transaction.status.value == "complete" + + +@patch("cdp.Cdp.api_clients") +@patch("cdp.smart_contract.time.sleep") +@patch("cdp.smart_contract.time.time") +def test_wait_for_smart_contract(mock_time, mock_sleep, mock_api_clients, smart_contract_factory): + """Test the waiting for a SmartContract object to complete.""" + pending_contract = smart_contract_factory(status="pending") + complete_contract = smart_contract_factory(status="complete") + mock_get_contract = Mock() + mock_api_clients.smart_contracts.get_smart_contract = mock_get_contract + mock_get_contract.side_effect = [pending_contract._model, complete_contract._model] + + mock_time.side_effect = [0, 0.2, 0.4] + + result = pending_contract.wait(interval_seconds=0.2, timeout_seconds=1) + + assert result.transaction.status.value == "complete" + mock_get_contract.assert_called_with( + wallet_id=pending_contract.wallet_id, + deployer_address=pending_contract.deployer_address, + smart_contract_id=pending_contract.smart_contract_id, + ) + assert mock_get_contract.call_count == 2 + mock_sleep.assert_has_calls([call(0.2)] * 2) + assert mock_time.call_count == 3 + + +@patch("cdp.Cdp.api_clients") +@patch("cdp.smart_contract.time.sleep") +@patch("cdp.smart_contract.time.time") +def test_wait_for_smart_contract_timeout( + mock_time, mock_sleep, mock_api_clients, smart_contract_factory +): + """Test the waiting for a SmartContract object to complete with a timeout.""" + pending_contract = smart_contract_factory(status="pending") + mock_get_contract = Mock(return_value=pending_contract._model) + mock_api_clients.smart_contracts.get_smart_contract = mock_get_contract + + mock_time.side_effect = [0, 0.5, 1.0, 1.5, 2.0, 2.5] + + with pytest.raises(TimeoutError, match="SmartContract deployment timed out"): + pending_contract.wait(interval_seconds=0.5, timeout_seconds=2) + + assert mock_get_contract.call_count == 5 + mock_sleep.assert_has_calls([call(0.5)] * 4) + assert mock_time.call_count == 6 + + +def test_sign_smart_contract_invalid_key(smart_contract_factory): + """Test the signing of a SmartContract object with an invalid key.""" + smart_contract = smart_contract_factory() + with pytest.raises(ValueError, match="key must be a LocalAccount"): + smart_contract.sign("invalid_key") + + +def test_smart_contract_str_representation(smart_contract_factory): + """Test the string representation of a SmartContract object.""" + smart_contract = smart_contract_factory() + expected_str = ( + f"SmartContract: (smart_contract_id: {smart_contract.smart_contract_id}, " + f"wallet_id: {smart_contract.wallet_id}, network_id: {smart_contract.network_id}, " + f"contract_address: {smart_contract.contract_address}, type: {smart_contract.type}, " + f"transaction_hash: {smart_contract.transaction.transaction_hash}, " + f"transaction_link: {smart_contract.transaction.transaction_link}, " + f"status: {smart_contract.transaction.status})" + ) + assert str(smart_contract) == expected_str + + +def test_smart_contract_repr(smart_contract_factory): + """Test the representation of a SmartContract object.""" + smart_contract = smart_contract_factory() + assert repr(smart_contract) == str(smart_contract) From 2890e414177cfbaf85c416688aa5e4f1a46e9cf2 Mon Sep 17 00:00:00 2001 From: Rohan Agarwal Date: Mon, 30 Sep 2024 20:03:15 -0400 Subject: [PATCH 17/27] Fix --- tests/test_wallet.py | 170 +++++++++++++++++++++++++++++++++++ tests/test_wallet_address.py | 126 +++++++++++++++++++++++++- 2 files changed, 295 insertions(+), 1 deletion(-) diff --git a/tests/test_wallet.py b/tests/test_wallet.py index 60cb9db..3b29ab1 100644 --- a/tests/test_wallet.py +++ b/tests/test_wallet.py @@ -12,6 +12,7 @@ from cdp.client.models.wallet import Wallet as WalletModel from cdp.contract_invocation import ContractInvocation from cdp.payload_signature import PayloadSignature +from cdp.smart_contract import SmartContract from cdp.trade import Trade from cdp.transfer import Transfer from cdp.wallet import Wallet @@ -535,3 +536,172 @@ def test_wallet_fetch(mock_api_clients, wallet_factory): assert isinstance(fetched_wallet, Wallet) assert fetched_wallet.id == "fetched-wallet-id" mock_get_wallet.assert_called_once_with("fetched-wallet-id") + + +@patch("cdp.Cdp.use_server_signer", True) +def test_wallet_deploy_token(wallet_factory): + """Test the deploy_token method of a Wallet.""" + wallet = wallet_factory() + mock_default_address = Mock(spec=WalletAddress) + mock_smart_contract = Mock(spec=SmartContract) + mock_default_address.deploy_token.return_value = mock_smart_contract + + with patch.object( + Wallet, "default_address", new_callable=PropertyMock + ) as mock_default_address_prop: + mock_default_address_prop.return_value = mock_default_address + + smart_contract = wallet.deploy_token(name="TestToken", symbol="TT", total_supply="1000000") + + assert isinstance(smart_contract, SmartContract) + mock_default_address.deploy_token.assert_called_once_with("TestToken", "TT", "1000000") + + +@patch("cdp.Cdp.use_server_signer", True) +def test_wallet_deploy_nft(wallet_factory): + """Test the deploy_nft method of a Wallet.""" + wallet = wallet_factory() + mock_default_address = Mock(spec=WalletAddress) + mock_smart_contract = Mock(spec=SmartContract) + mock_default_address.deploy_nft.return_value = mock_smart_contract + + with patch.object( + Wallet, "default_address", new_callable=PropertyMock + ) as mock_default_address_prop: + mock_default_address_prop.return_value = mock_default_address + + smart_contract = wallet.deploy_nft( + name="TestNFT", symbol="TNFT", base_uri="https://example.com/nft/" + ) + + assert isinstance(smart_contract, SmartContract) + mock_default_address.deploy_nft.assert_called_once_with( + "TestNFT", "TNFT", "https://example.com/nft/" + ) + + +@patch("cdp.Cdp.use_server_signer", True) +def test_wallet_deploy_multi_token(wallet_factory): + """Test the deploy_multi_token method of a Wallet.""" + wallet = wallet_factory() + mock_default_address = Mock(spec=WalletAddress) + mock_smart_contract = Mock(spec=SmartContract) + mock_default_address.deploy_multi_token.return_value = mock_smart_contract + + with patch.object( + Wallet, "default_address", new_callable=PropertyMock + ) as mock_default_address_prop: + mock_default_address_prop.return_value = mock_default_address + + smart_contract = wallet.deploy_multi_token(uri="https://example.com/multi-token/{id}.json") + + assert isinstance(smart_contract, SmartContract) + mock_default_address.deploy_multi_token.assert_called_once_with( + "https://example.com/multi-token/{id}.json" + ) + + +@patch("cdp.Cdp.use_server_signer", True) +def test_wallet_deploy_token_no_default_address(wallet_factory): + """Test the deploy_token method of a Wallet with no default address.""" + wallet = wallet_factory() + + with patch.object( + Wallet, "default_address", new_callable=PropertyMock + ) as mock_default_address_prop: + mock_default_address_prop.return_value = None + + with pytest.raises(ValueError, match="Default address does not exist"): + wallet.deploy_token(name="TestToken", symbol="TT", total_supply="1000000") + + +# Add similar tests for deploy_nft and deploy_multi_token with no default address +@patch("cdp.Cdp.use_server_signer", True) +def test_wallet_deploy_nft_no_default_address(wallet_factory): + """Test the deploy_nft method of a Wallet with no default address.""" + wallet = wallet_factory() + + with patch.object( + Wallet, "default_address", new_callable=PropertyMock + ) as mock_default_address_prop: + mock_default_address_prop.return_value = None + + with pytest.raises(ValueError, match="Default address does not exist"): + wallet.deploy_nft(name="TestNFT", symbol="TNFT", base_uri="https://example.com/nft/") + + +@patch("cdp.Cdp.use_server_signer", True) +def test_wallet_deploy_multi_token_no_default_address(wallet_factory): + """Test the deploy_multi_token method of a Wallet with no default address.""" + wallet = wallet_factory() + + with patch.object( + Wallet, "default_address", new_callable=PropertyMock + ) as mock_default_address_prop: + mock_default_address_prop.return_value = None + + with pytest.raises(ValueError, match="Default address does not exist"): + wallet.deploy_multi_token(uri="https://example.com/multi-token/{id}.json") + + +@patch("cdp.Cdp.use_server_signer", True) +def test_wallet_deploy_token_with_server_signer(wallet_factory): + """Test the deploy_token method of a Wallet with server-signer.""" + wallet = wallet_factory() + mock_default_address = Mock(spec=WalletAddress) + mock_smart_contract = Mock(spec=SmartContract) + mock_default_address.deploy_token.return_value = mock_smart_contract + + with patch.object( + Wallet, "default_address", new_callable=PropertyMock + ) as mock_default_address_prop: + mock_default_address_prop.return_value = mock_default_address + + smart_contract = wallet.deploy_token(name="TestToken", symbol="TT", total_supply="1000000") + + assert isinstance(smart_contract, SmartContract) + mock_default_address.deploy_token.assert_called_once_with("TestToken", "TT", "1000000") + + +@patch("cdp.Cdp.use_server_signer", True) +def test_wallet_deploy_nft_with_server_signer(wallet_factory): + """Test the deploy_nft method of a Wallet with server-signer.""" + wallet = wallet_factory() + mock_default_address = Mock(spec=WalletAddress) + mock_smart_contract = Mock(spec=SmartContract) + mock_default_address.deploy_nft.return_value = mock_smart_contract + + with patch.object( + Wallet, "default_address", new_callable=PropertyMock + ) as mock_default_address_prop: + mock_default_address_prop.return_value = mock_default_address + + smart_contract = wallet.deploy_nft( + name="TestNFT", symbol="TNFT", base_uri="https://example.com/nft/" + ) + + assert isinstance(smart_contract, SmartContract) + mock_default_address.deploy_nft.assert_called_once_with( + "TestNFT", "TNFT", "https://example.com/nft/" + ) + + +@patch("cdp.Cdp.use_server_signer", True) +def test_wallet_deploy_multi_token_with_server_signer(wallet_factory): + """Test the deploy_multi_token method of a Wallet with server-signer.""" + wallet = wallet_factory() + mock_default_address = Mock(spec=WalletAddress) + mock_smart_contract = Mock(spec=SmartContract) + mock_default_address.deploy_multi_token.return_value = mock_smart_contract + + with patch.object( + Wallet, "default_address", new_callable=PropertyMock + ) as mock_default_address_prop: + mock_default_address_prop.return_value = mock_default_address + + smart_contract = wallet.deploy_multi_token(uri="https://example.com/multi-token/{id}.json") + + assert isinstance(smart_contract, SmartContract) + mock_default_address.deploy_multi_token.assert_called_once_with( + "https://example.com/multi-token/{id}.json" + ) diff --git a/tests/test_wallet_address.py b/tests/test_wallet_address.py index 9772714..47758b7 100644 --- a/tests/test_wallet_address.py +++ b/tests/test_wallet_address.py @@ -1,5 +1,5 @@ from decimal import Decimal -from unittest.mock import Mock, patch +from unittest.mock import ANY, Mock, patch import pytest from eth_account.datastructures import SignedMessage @@ -14,6 +14,7 @@ from cdp.contract_invocation import ContractInvocation from cdp.errors import InsufficientFundsError from cdp.payload_signature import PayloadSignature +from cdp.smart_contract import SmartContract from cdp.trade import Trade from cdp.transfer import Transfer from cdp.wallet_address import WalletAddress @@ -629,3 +630,126 @@ def test_repr(wallet_address): """Test the repr representation of a WalletAddress.""" expected_repr = "WalletAddress: (address_id: 0x1234567890123456789012345678901234567890, wallet_id: test-wallet-id-1, network_id: base-sepolia)" assert repr(wallet_address) == expected_repr + + +@patch("cdp.Cdp.api_clients") +@patch("cdp.Cdp.use_server_signer", True) +def test_wallet_address_deploy_token(mock_api_clients, wallet_address): + """Test the deploy_token method of a WalletAddress.""" + mock_smart_contract = Mock(spec=SmartContract) + mock_api_clients.smart_contracts.create_smart_contract.return_value = mock_smart_contract + + smart_contract = wallet_address.deploy_token( + name="TestToken", symbol="TT", total_supply="1000000" + ) + + assert isinstance(smart_contract, SmartContract) + mock_api_clients.smart_contracts.create_smart_contract.assert_called_once_with( + wallet_id=wallet_address.wallet_id, + address_id=wallet_address.address_id, + create_smart_contract_request=ANY, + ) + + +@patch("cdp.Cdp.api_clients") +@patch("cdp.Cdp.use_server_signer", True) +def test_wallet_address_deploy_nft(mock_api_clients, wallet_address): + """Test the deploy_nft method of a WalletAddress.""" + mock_smart_contract = Mock(spec=SmartContract) + mock_api_clients.smart_contracts.create_smart_contract.return_value = mock_smart_contract + + smart_contract = wallet_address.deploy_nft( + name="TestNFT", symbol="TNFT", base_uri="https://example.com/nft/" + ) + + assert isinstance(smart_contract, SmartContract) + mock_api_clients.smart_contracts.create_smart_contract.assert_called_once_with( + wallet_id=wallet_address.wallet_id, + address_id=wallet_address.address_id, + create_smart_contract_request=ANY, + ) + + +@patch("cdp.Cdp.api_clients") +@patch("cdp.Cdp.use_server_signer", True) +def test_wallet_address_deploy_multi_token(mock_api_clients, wallet_address): + """Test the deploy_multi_token method of a WalletAddress.""" + mock_smart_contract = Mock(spec=SmartContract) + mock_api_clients.smart_contracts.create_smart_contract.return_value = mock_smart_contract + + smart_contract = wallet_address.deploy_multi_token( + uri="https://example.com/multi-token/{id}.json" + ) + + assert isinstance(smart_contract, SmartContract) + mock_api_clients.smart_contracts.create_smart_contract.assert_called_once_with( + wallet_id=wallet_address.wallet_id, + address_id=wallet_address.address_id, + create_smart_contract_request=ANY, + ) + + +@patch("cdp.Cdp.api_clients") +@patch("cdp.Cdp.use_server_signer", True) +def test_wallet_address_deploy_token_with_server_signer(mock_api_clients, wallet_address): + """Test the deploy_token method of a WalletAddress with server signer.""" + mock_smart_contract = Mock(spec=SmartContract) + mock_api_clients.smart_contracts.create_smart_contract.return_value = mock_smart_contract + + smart_contract = wallet_address.deploy_token( + name="TestToken", symbol="TT", total_supply="1000000" + ) + + assert isinstance(smart_contract, SmartContract) + mock_api_clients.smart_contracts.create_smart_contract.assert_called_once_with( + wallet_id=wallet_address.wallet_id, + address_id=wallet_address.address_id, + create_smart_contract_request=ANY, + ) + # Verify that sign and broadcast methods are not called when using server signer + mock_smart_contract.sign.assert_not_called() + mock_smart_contract.broadcast.assert_not_called() + + +@patch("cdp.Cdp.api_clients") +@patch("cdp.Cdp.use_server_signer", True) +def test_wallet_address_deploy_nft_with_server_signer(mock_api_clients, wallet_address): + """Test the deploy_nft method of a WalletAddress with server signer.""" + mock_smart_contract = Mock(spec=SmartContract) + mock_api_clients.smart_contracts.create_smart_contract.return_value = mock_smart_contract + + smart_contract = wallet_address.deploy_nft( + name="TestNFT", symbol="TNFT", base_uri="https://example.com/nft/" + ) + + assert isinstance(smart_contract, SmartContract) + mock_api_clients.smart_contracts.create_smart_contract.assert_called_once_with( + wallet_id=wallet_address.wallet_id, + address_id=wallet_address.address_id, + create_smart_contract_request=ANY, + ) + # Verify that sign and broadcast methods are not called when using server signer + mock_smart_contract.sign.assert_not_called() + mock_smart_contract.broadcast.assert_not_called() + + +@patch("cdp.Cdp.api_clients") +@patch("cdp.Cdp.use_server_signer", True) +def test_wallet_address_deploy_multi_token_with_server_signer(mock_api_clients, wallet_address): + """Test the deploy_multi_token method of a WalletAddress with server signer.""" + mock_smart_contract = Mock(spec=SmartContract) + mock_api_clients.smart_contracts.create_smart_contract.return_value = mock_smart_contract + + smart_contract = wallet_address.deploy_multi_token( + uri="https://example.com/multi-token/{id}.json" + ) + + assert isinstance(smart_contract, SmartContract) + mock_api_clients.smart_contracts.create_smart_contract.assert_called_once_with( + wallet_id=wallet_address.wallet_id, + address_id=wallet_address.address_id, + create_smart_contract_request=ANY, + ) + # Verify that sign and broadcast methods are not called when using server signer + mock_smart_contract.sign.assert_not_called() + mock_smart_contract.broadcast.assert_not_called() From 80c4e01f40760804f85258c15eb566de63e3917c Mon Sep 17 00:00:00 2001 From: Rohan Agarwal Date: Mon, 30 Sep 2024 21:27:00 -0400 Subject: [PATCH 18/27] Fix --- cdp/transaction.py | 2 +- tests/test_wallet.py | 1 - tests/test_wallet_address.py | 102 +++++++++++++++++++++++++++++++++++ 3 files changed, 103 insertions(+), 2 deletions(-) diff --git a/cdp/transaction.py b/cdp/transaction.py index e314838..816ad1a 100644 --- a/cdp/transaction.py +++ b/cdp/transaction.py @@ -130,7 +130,7 @@ def raw(self) -> DynamicFeeTransaction: "type": "0x2", # EIP-1559 transaction type } - # Handle the 'to' field separately + # Handle 'to' field separately since smart contract deployments have an empty 'to' field if parsed_payload["to"]: transaction_dict["to"] = Web3.to_bytes(hexstr=parsed_payload["to"]) else: diff --git a/tests/test_wallet.py b/tests/test_wallet.py index 3b29ab1..d7b4133 100644 --- a/tests/test_wallet.py +++ b/tests/test_wallet.py @@ -615,7 +615,6 @@ def test_wallet_deploy_token_no_default_address(wallet_factory): wallet.deploy_token(name="TestToken", symbol="TT", total_supply="1000000") -# Add similar tests for deploy_nft and deploy_multi_token with no default address @patch("cdp.Cdp.use_server_signer", True) def test_wallet_deploy_nft_no_default_address(wallet_factory): """Test the deploy_nft method of a Wallet with no default address.""" diff --git a/tests/test_wallet_address.py b/tests/test_wallet_address.py index 47758b7..ff0fd36 100644 --- a/tests/test_wallet_address.py +++ b/tests/test_wallet_address.py @@ -753,3 +753,105 @@ def test_wallet_address_deploy_multi_token_with_server_signer(mock_api_clients, # Verify that sign and broadcast methods are not called when using server signer mock_smart_contract.sign.assert_not_called() mock_smart_contract.broadcast.assert_not_called() + + +@patch("cdp.wallet_address.SmartContract") +@patch("cdp.Cdp.api_clients") +@patch("cdp.Cdp.use_server_signer", False) +def test_deploy_token_api_error(mock_api_clients, mock_smart_contract, wallet_address_with_key): + """Test the deploy_token method raises an error when the create API call fails.""" + mock_smart_contract.create.side_effect = Exception("API Error") + + with pytest.raises(Exception, match="API Error"): + wallet_address_with_key.deploy_token(name="TestToken", symbol="TT", total_supply="1000000") + + mock_smart_contract.create.assert_called_once() + + +@patch("cdp.wallet_address.SmartContract") +@patch("cdp.Cdp.api_clients") +@patch("cdp.Cdp.use_server_signer", False) +def test_deploy_token_broadcast_api_error( + mock_api_clients, mock_smart_contract, wallet_address_with_key +): + """Test the deploy_token method raises an error when the broadcast API call fails.""" + mock_smart_contract_instance = Mock(spec=SmartContract) + mock_smart_contract.create.return_value = mock_smart_contract_instance + mock_smart_contract_instance.broadcast.side_effect = Exception("API Error") + + with pytest.raises(Exception, match="API Error"): + wallet_address_with_key.deploy_token(name="TestToken", symbol="TT", total_supply="1000000") + + mock_smart_contract.create.assert_called_once() + mock_smart_contract_instance.sign.assert_called_once_with(wallet_address_with_key.key) + mock_smart_contract_instance.broadcast.assert_called_once() + + +@patch("cdp.wallet_address.SmartContract") +@patch("cdp.Cdp.api_clients") +@patch("cdp.Cdp.use_server_signer", False) +def test_deploy_nft_api_error(mock_api_clients, mock_smart_contract, wallet_address_with_key): + """Test the deploy_nft method raises an error when the create API call fails.""" + mock_smart_contract.create.side_effect = Exception("API Error") + + with pytest.raises(Exception, match="API Error"): + wallet_address_with_key.deploy_nft( + name="TestNFT", symbol="TNFT", base_uri="https://example.com/nft/" + ) + + mock_smart_contract.create.assert_called_once() + + +@patch("cdp.wallet_address.SmartContract") +@patch("cdp.Cdp.api_clients") +@patch("cdp.Cdp.use_server_signer", False) +def test_deploy_nft_broadcast_api_error( + mock_api_clients, mock_smart_contract, wallet_address_with_key +): + """Test the deploy_nft method raises an error when the broadcast API call fails.""" + mock_smart_contract_instance = Mock(spec=SmartContract) + mock_smart_contract.create.return_value = mock_smart_contract_instance + mock_smart_contract_instance.broadcast.side_effect = Exception("API Error") + + with pytest.raises(Exception, match="API Error"): + wallet_address_with_key.deploy_nft( + name="TestNFT", symbol="TNFT", base_uri="https://example.com/nft/" + ) + + mock_smart_contract.create.assert_called_once() + mock_smart_contract_instance.sign.assert_called_once_with(wallet_address_with_key.key) + mock_smart_contract_instance.broadcast.assert_called_once() + + +@patch("cdp.wallet_address.SmartContract") +@patch("cdp.Cdp.api_clients") +@patch("cdp.Cdp.use_server_signer", False) +def test_deploy_multi_token_api_error( + mock_api_clients, mock_smart_contract, wallet_address_with_key +): + """Test the deploy_multi_token method raises an error when the create API call fails.""" + mock_smart_contract.create.side_effect = Exception("API Error") + + with pytest.raises(Exception, match="API Error"): + wallet_address_with_key.deploy_multi_token(uri="https://example.com/multi-token/{id}.json") + + mock_smart_contract.create.assert_called_once() + + +@patch("cdp.wallet_address.SmartContract") +@patch("cdp.Cdp.api_clients") +@patch("cdp.Cdp.use_server_signer", False) +def test_deploy_multi_token_broadcast_api_error( + mock_api_clients, mock_smart_contract, wallet_address_with_key +): + """Test the deploy_multi_token method raises an error when the broadcast API call fails.""" + mock_smart_contract_instance = Mock(spec=SmartContract) + mock_smart_contract.create.return_value = mock_smart_contract_instance + mock_smart_contract_instance.broadcast.side_effect = Exception("API Error") + + with pytest.raises(Exception, match="API Error"): + wallet_address_with_key.deploy_multi_token(uri="https://example.com/multi-token/{id}.json") + + mock_smart_contract.create.assert_called_once() + mock_smart_contract_instance.sign.assert_called_once_with(wallet_address_with_key.key) + mock_smart_contract_instance.broadcast.assert_called_once() From 6372bf2aa1f4646db5d14ccf786a468429e7b009 Mon Sep 17 00:00:00 2001 From: Rohan Agarwal Date: Mon, 30 Sep 2024 21:32:30 -0400 Subject: [PATCH 19/27] Fix --- tests/test_wallet_address.py | 43 +++++++++--------------------------- 1 file changed, 10 insertions(+), 33 deletions(-) diff --git a/tests/test_wallet_address.py b/tests/test_wallet_address.py index ff0fd36..82bf6da 100644 --- a/tests/test_wallet_address.py +++ b/tests/test_wallet_address.py @@ -229,7 +229,7 @@ def test_transfer_broadcast_api_error( address_id=wallet_address_with_key.address_id, asset_id="eth", ) - mock_transfer.createassert_called_once_with( + mock_transfer.create.assert_called_once_with( address_id=wallet_address_with_key.address_id, amount=Decimal("1.0"), asset_id="eth", @@ -514,9 +514,8 @@ def test_invoke_contract_broadcast_api_error( @patch("cdp.wallet_address.PayloadSignature") -@patch("cdp.Cdp.api_clients") @patch("cdp.Cdp.use_server_signer", True) -def test_sign_payload_with_server_signer(mock_api_clients, mock_payload_signature, wallet_address): +def test_sign_payload_with_server_signer(mock_payload_signature, wallet_address): """Test the sign_payload method with a server signer.""" mock_payload_signature_instance = Mock(spec=PayloadSignature) mock_payload_signature.create.return_value = mock_payload_signature_instance @@ -534,9 +533,8 @@ def test_sign_payload_with_server_signer(mock_api_clients, mock_payload_signatur @patch("cdp.wallet_address.to_hex", Mock(return_value="0xsignature")) @patch("cdp.wallet_address.PayloadSignature") -@patch("cdp.Cdp.api_clients") @patch("cdp.Cdp.use_server_signer", False) -def test_sign_payload(mock_api_clients, mock_payload_signature, wallet_address_with_key): +def test_sign_payload(mock_payload_signature, wallet_address_with_key): """Test the sign_payload method.""" mock_payload_signature_instance = Mock(spec=PayloadSignature) mock_payload_signature.create.return_value = mock_payload_signature_instance @@ -564,9 +562,8 @@ def test_sign_payload(mock_api_clients, mock_payload_signature, wallet_address_w @patch("cdp.wallet_address.to_hex", Mock(return_value="0xsignature")) @patch("cdp.wallet_address.PayloadSignature") -@patch("cdp.Cdp.api_clients") @patch("cdp.Cdp.use_server_signer", False) -def test_sign_payload_api_error(mock_api_clients, mock_payload_signature, wallet_address_with_key): +def test_sign_payload_api_error(mock_payload_signature, wallet_address_with_key): """Test the sign_payload method.""" mock_signature = Mock(spec=SignedMessage) mock_signature.signature = "0xsignature" @@ -756,9 +753,7 @@ def test_wallet_address_deploy_multi_token_with_server_signer(mock_api_clients, @patch("cdp.wallet_address.SmartContract") -@patch("cdp.Cdp.api_clients") -@patch("cdp.Cdp.use_server_signer", False) -def test_deploy_token_api_error(mock_api_clients, mock_smart_contract, wallet_address_with_key): +def test_deploy_token_api_error(mock_smart_contract, wallet_address_with_key): """Test the deploy_token method raises an error when the create API call fails.""" mock_smart_contract.create.side_effect = Exception("API Error") @@ -769,11 +764,7 @@ def test_deploy_token_api_error(mock_api_clients, mock_smart_contract, wallet_ad @patch("cdp.wallet_address.SmartContract") -@patch("cdp.Cdp.api_clients") -@patch("cdp.Cdp.use_server_signer", False) -def test_deploy_token_broadcast_api_error( - mock_api_clients, mock_smart_contract, wallet_address_with_key -): +def test_deploy_token_broadcast_api_error(mock_smart_contract, wallet_address_with_key): """Test the deploy_token method raises an error when the broadcast API call fails.""" mock_smart_contract_instance = Mock(spec=SmartContract) mock_smart_contract.create.return_value = mock_smart_contract_instance @@ -788,9 +779,7 @@ def test_deploy_token_broadcast_api_error( @patch("cdp.wallet_address.SmartContract") -@patch("cdp.Cdp.api_clients") -@patch("cdp.Cdp.use_server_signer", False) -def test_deploy_nft_api_error(mock_api_clients, mock_smart_contract, wallet_address_with_key): +def test_deploy_nft_api_error(mock_smart_contract, wallet_address_with_key): """Test the deploy_nft method raises an error when the create API call fails.""" mock_smart_contract.create.side_effect = Exception("API Error") @@ -803,11 +792,7 @@ def test_deploy_nft_api_error(mock_api_clients, mock_smart_contract, wallet_addr @patch("cdp.wallet_address.SmartContract") -@patch("cdp.Cdp.api_clients") -@patch("cdp.Cdp.use_server_signer", False) -def test_deploy_nft_broadcast_api_error( - mock_api_clients, mock_smart_contract, wallet_address_with_key -): +def test_deploy_nft_broadcast_api_error(mock_smart_contract, wallet_address_with_key): """Test the deploy_nft method raises an error when the broadcast API call fails.""" mock_smart_contract_instance = Mock(spec=SmartContract) mock_smart_contract.create.return_value = mock_smart_contract_instance @@ -824,11 +809,7 @@ def test_deploy_nft_broadcast_api_error( @patch("cdp.wallet_address.SmartContract") -@patch("cdp.Cdp.api_clients") -@patch("cdp.Cdp.use_server_signer", False) -def test_deploy_multi_token_api_error( - mock_api_clients, mock_smart_contract, wallet_address_with_key -): +def test_deploy_multi_token_api_error(mock_smart_contract, wallet_address_with_key): """Test the deploy_multi_token method raises an error when the create API call fails.""" mock_smart_contract.create.side_effect = Exception("API Error") @@ -839,11 +820,7 @@ def test_deploy_multi_token_api_error( @patch("cdp.wallet_address.SmartContract") -@patch("cdp.Cdp.api_clients") -@patch("cdp.Cdp.use_server_signer", False) -def test_deploy_multi_token_broadcast_api_error( - mock_api_clients, mock_smart_contract, wallet_address_with_key -): +def test_deploy_multi_token_broadcast_api_error(mock_smart_contract, wallet_address_with_key): """Test the deploy_multi_token method raises an error when the broadcast API call fails.""" mock_smart_contract_instance = Mock(spec=SmartContract) mock_smart_contract.create.return_value = mock_smart_contract_instance From 266e51b6ed63e717160d87ede611939397026e68 Mon Sep 17 00:00:00 2001 From: Rohan Agarwal Date: Mon, 30 Sep 2024 22:02:20 -0400 Subject: [PATCH 20/27] Fix tests --- tests/test_smart_contract.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_smart_contract.py b/tests/test_smart_contract.py index 54032d4..18cdad1 100644 --- a/tests/test_smart_contract.py +++ b/tests/test_smart_contract.py @@ -157,7 +157,7 @@ def test_reload_smart_contract(mock_api_clients, smart_contract_factory): mock_get_contract.assert_called_once_with( wallet_id=smart_contract.wallet_id, - deployer_address=smart_contract.deployer_address, + address_id=smart_contract.deployer_address, smart_contract_id=smart_contract.smart_contract_id, ) assert smart_contract.transaction.status.value == "complete" @@ -181,7 +181,7 @@ def test_wait_for_smart_contract(mock_time, mock_sleep, mock_api_clients, smart_ assert result.transaction.status.value == "complete" mock_get_contract.assert_called_with( wallet_id=pending_contract.wallet_id, - deployer_address=pending_contract.deployer_address, + address_id=pending_contract.deployer_address, smart_contract_id=pending_contract.smart_contract_id, ) assert mock_get_contract.call_count == 2 From cfe036bfb35211969a49f5bb782ce52742d5b06e Mon Sep 17 00:00:00 2001 From: Rohan Agarwal Date: Mon, 30 Sep 2024 22:06:29 -0400 Subject: [PATCH 21/27] Fix test --- cdp/smart_contract.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cdp/smart_contract.py b/cdp/smart_contract.py index 1e2b741..809793c 100644 --- a/cdp/smart_contract.py +++ b/cdp/smart_contract.py @@ -252,7 +252,7 @@ def reload(self) -> "SmartContract": """ model = Cdp.api_clients.smart_contracts.get_smart_contract( wallet_id=self.wallet_id, - deployer_address=self.deployer_address, + address_id=self.deployer_address, smart_contract_id=self.smart_contract_id, ) self._model = model From 061123f4b6821d17ab629df8ca00ee7c74b900f2 Mon Sep 17 00:00:00 2001 From: Rohan Agarwal Date: Mon, 30 Sep 2024 22:15:08 -0400 Subject: [PATCH 22/27] Changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 079f926..585a06a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - Contract invocation support. - Arbitrary message signing support. +- Deploy ERC20, ERC721, and ERC1155 smart contracts. ### Fixed From bbb74071ca79ac3011021fef3fd32f4db4fe9500 Mon Sep 17 00:00:00 2001 From: Rohan Agarwal Date: Tue, 1 Oct 2024 10:05:47 -0400 Subject: [PATCH 23/27] Feedback --- cdp/wallet_address.py | 2 +- tests/test_wallet_address.py | 32 +++++++++++++++++++++++++++++--- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/cdp/wallet_address.py b/cdp/wallet_address.py index cb5a492..48bfa1a 100644 --- a/cdp/wallet_address.py +++ b/cdp/wallet_address.py @@ -228,7 +228,7 @@ def deploy_token(self, name: str, symbol: str, total_supply: str) -> SmartContra Args: name (str): The name of the token. symbol (str): The symbol of the token. - total_supply (Union[int, float, Decimal, str]): The total supply of the token. + total_supply (str): The total supply of the token as a string. Returns: SmartContract: The deployed smart contract. diff --git a/tests/test_wallet_address.py b/tests/test_wallet_address.py index 82bf6da..e8b8142 100644 --- a/tests/test_wallet_address.py +++ b/tests/test_wallet_address.py @@ -11,6 +11,11 @@ from cdp.client.models.address import Address as AddressModel from cdp.client.models.asset import Asset as AssetModel from cdp.client.models.balance import Balance as BalanceModel +from cdp.client.models.create_smart_contract_request import CreateSmartContractRequest +from cdp.client.models.multi_token_contract_options import MultiTokenContractOptions +from cdp.client.models.nft_contract_options import NFTContractOptions +from cdp.client.models.smart_contract_options import SmartContractOptions +from cdp.client.models.token_contract_options import TokenContractOptions from cdp.contract_invocation import ContractInvocation from cdp.errors import InsufficientFundsError from cdp.payload_signature import PayloadSignature @@ -701,7 +706,14 @@ def test_wallet_address_deploy_token_with_server_signer(mock_api_clients, wallet mock_api_clients.smart_contracts.create_smart_contract.assert_called_once_with( wallet_id=wallet_address.wallet_id, address_id=wallet_address.address_id, - create_smart_contract_request=ANY, + create_smart_contract_request=CreateSmartContractRequest( + type="erc20", + options=SmartContractOptions( + actual_instance=TokenContractOptions( + name="TestToken", symbol="TT", total_supply="1000000" + ) + ), + ), ) # Verify that sign and broadcast methods are not called when using server signer mock_smart_contract.sign.assert_not_called() @@ -723,7 +735,14 @@ def test_wallet_address_deploy_nft_with_server_signer(mock_api_clients, wallet_a mock_api_clients.smart_contracts.create_smart_contract.assert_called_once_with( wallet_id=wallet_address.wallet_id, address_id=wallet_address.address_id, - create_smart_contract_request=ANY, + create_smart_contract_request=CreateSmartContractRequest( + type="erc721", + options=SmartContractOptions( + actual_instance=NFTContractOptions( + name="TestNFT", symbol="TNFT", base_uri="https://example.com/nft/" + ) + ), + ), ) # Verify that sign and broadcast methods are not called when using server signer mock_smart_contract.sign.assert_not_called() @@ -745,7 +764,14 @@ def test_wallet_address_deploy_multi_token_with_server_signer(mock_api_clients, mock_api_clients.smart_contracts.create_smart_contract.assert_called_once_with( wallet_id=wallet_address.wallet_id, address_id=wallet_address.address_id, - create_smart_contract_request=ANY, + create_smart_contract_request=CreateSmartContractRequest( + type="erc1155", + options=SmartContractOptions( + actual_instance=MultiTokenContractOptions( + uri="https://example.com/multi-token/{id}.json" + ) + ), + ), ) # Verify that sign and broadcast methods are not called when using server signer mock_smart_contract.sign.assert_not_called() From 2ce20b125fd3807fe858e03d38dfb131417b013e Mon Sep 17 00:00:00 2001 From: Rohan Agarwal Date: Tue, 1 Oct 2024 10:06:51 -0400 Subject: [PATCH 24/27] MORE --- tests/test_wallet_address.py | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/tests/test_wallet_address.py b/tests/test_wallet_address.py index e8b8142..e9ea651 100644 --- a/tests/test_wallet_address.py +++ b/tests/test_wallet_address.py @@ -649,7 +649,14 @@ def test_wallet_address_deploy_token(mock_api_clients, wallet_address): mock_api_clients.smart_contracts.create_smart_contract.assert_called_once_with( wallet_id=wallet_address.wallet_id, address_id=wallet_address.address_id, - create_smart_contract_request=ANY, + create_smart_contract_request=CreateSmartContractRequest( + type="erc20", + options=SmartContractOptions( + actual_instance=TokenContractOptions( + name="TestToken", symbol="TT", total_supply="1000000" + ) + ), + ), ) @@ -668,7 +675,14 @@ def test_wallet_address_deploy_nft(mock_api_clients, wallet_address): mock_api_clients.smart_contracts.create_smart_contract.assert_called_once_with( wallet_id=wallet_address.wallet_id, address_id=wallet_address.address_id, - create_smart_contract_request=ANY, + create_smart_contract_request=CreateSmartContractRequest( + type="erc721", + options=SmartContractOptions( + actual_instance=NFTContractOptions( + name="TestNFT", symbol="TNFT", base_uri="https://example.com/nft/" + ) + ), + ), ) @@ -687,7 +701,14 @@ def test_wallet_address_deploy_multi_token(mock_api_clients, wallet_address): mock_api_clients.smart_contracts.create_smart_contract.assert_called_once_with( wallet_id=wallet_address.wallet_id, address_id=wallet_address.address_id, - create_smart_contract_request=ANY, + create_smart_contract_request=CreateSmartContractRequest( + type="erc1155", + options=SmartContractOptions( + actual_instance=MultiTokenContractOptions( + uri="https://example.com/multi-token/{id}.json" + ) + ), + ), ) From 401d02203f6cf41b23432e036b3ff5c45b6263e7 Mon Sep 17 00:00:00 2001 From: Rohan Agarwal Date: Tue, 1 Oct 2024 10:09:50 -0400 Subject: [PATCH 25/27] lint --- tests/test_wallet_address.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_wallet_address.py b/tests/test_wallet_address.py index e9ea651..b9e2374 100644 --- a/tests/test_wallet_address.py +++ b/tests/test_wallet_address.py @@ -1,5 +1,5 @@ from decimal import Decimal -from unittest.mock import ANY, Mock, patch +from unittest.mock import Mock, patch import pytest from eth_account.datastructures import SignedMessage From 81c15212418f33ac4be44f494de8f811732b2128 Mon Sep 17 00:00:00 2001 From: Rohan Agarwal Date: Tue, 1 Oct 2024 12:15:49 -0400 Subject: [PATCH 26/27] Feedback --- cdp/wallet_address.py | 8 ++++-- tests/test_wallet_address.py | 56 ++++++++++++++++++++++++++++++++++-- 2 files changed, 59 insertions(+), 5 deletions(-) diff --git a/cdp/wallet_address.py b/cdp/wallet_address.py index 48bfa1a..389012f 100644 --- a/cdp/wallet_address.py +++ b/cdp/wallet_address.py @@ -222,13 +222,15 @@ def sign_payload(self, unsigned_payload: str) -> PayloadSignature: signature=signature, ) - def deploy_token(self, name: str, symbol: str, total_supply: str) -> SmartContract: + def deploy_token( + self, name: str, symbol: str, total_supply: Number | Decimal | str + ) -> SmartContract: """Deploy a token smart contract. Args: name (str): The name of the token. symbol (str): The symbol of the token. - total_supply (str): The total supply of the token as a string. + total_supply (Union[Number, Decimal, str]): The total supply of the token. Returns: SmartContract: The deployed smart contract. @@ -239,7 +241,7 @@ def deploy_token(self, name: str, symbol: str, total_supply: str) -> SmartContra address_id=self.address_id, type=SmartContract.Type.ERC20, options=SmartContract.TokenContractOptions( - name=name, symbol=symbol, total_supply=total_supply + name=name, symbol=symbol, total_supply=str(total_supply) ), ) diff --git a/tests/test_wallet_address.py b/tests/test_wallet_address.py index b9e2374..49835d0 100644 --- a/tests/test_wallet_address.py +++ b/tests/test_wallet_address.py @@ -636,8 +636,8 @@ def test_repr(wallet_address): @patch("cdp.Cdp.api_clients") @patch("cdp.Cdp.use_server_signer", True) -def test_wallet_address_deploy_token(mock_api_clients, wallet_address): - """Test the deploy_token method of a WalletAddress.""" +def test_wallet_address_deploy_token_total_supply_string(mock_api_clients, wallet_address): + """Test the deploy_token method of a WalletAddress with a string total_supply.""" mock_smart_contract = Mock(spec=SmartContract) mock_api_clients.smart_contracts.create_smart_contract.return_value = mock_smart_contract @@ -660,6 +660,58 @@ def test_wallet_address_deploy_token(mock_api_clients, wallet_address): ) +@patch("cdp.Cdp.api_clients") +@patch("cdp.Cdp.use_server_signer", True) +def test_wallet_address_deploy_token_total_supply_number(mock_api_clients, wallet_address): + """Test the deploy_token method of a WalletAddress with a number total_supply.""" + mock_smart_contract = Mock(spec=SmartContract) + mock_api_clients.smart_contracts.create_smart_contract.return_value = mock_smart_contract + + smart_contract = wallet_address.deploy_token( + name="TestToken", symbol="TT", total_supply=1000000 + ) + + assert isinstance(smart_contract, SmartContract) + mock_api_clients.smart_contracts.create_smart_contract.assert_called_once_with( + wallet_id=wallet_address.wallet_id, + address_id=wallet_address.address_id, + create_smart_contract_request=CreateSmartContractRequest( + type="erc20", + options=SmartContractOptions( + actual_instance=TokenContractOptions( + name="TestToken", symbol="TT", total_supply="1000000" + ) + ), + ), + ) + + +@patch("cdp.Cdp.api_clients") +@patch("cdp.Cdp.use_server_signer", True) +def test_wallet_address_deploy_token_total_supply_decimal(mock_api_clients, wallet_address): + """Test the deploy_token method of a WalletAddress with a Decimal total_supply.""" + mock_smart_contract = Mock(spec=SmartContract) + mock_api_clients.smart_contracts.create_smart_contract.return_value = mock_smart_contract + + smart_contract = wallet_address.deploy_token( + name="TestToken", symbol="TT", total_supply=Decimal("1000000.5") + ) + + assert isinstance(smart_contract, SmartContract) + mock_api_clients.smart_contracts.create_smart_contract.assert_called_once_with( + wallet_id=wallet_address.wallet_id, + address_id=wallet_address.address_id, + create_smart_contract_request=CreateSmartContractRequest( + type="erc20", + options=SmartContractOptions( + actual_instance=TokenContractOptions( + name="TestToken", symbol="TT", total_supply="1000000.5" + ) + ), + ), + ) + + @patch("cdp.Cdp.api_clients") @patch("cdp.Cdp.use_server_signer", True) def test_wallet_address_deploy_nft(mock_api_clients, wallet_address): From c2af73c51527eb4a35744ce1b040103925892248 Mon Sep 17 00:00:00 2001 From: Rohan Agarwal Date: Tue, 1 Oct 2024 12:18:22 -0400 Subject: [PATCH 27/27] Fix --- cdp/wallet.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cdp/wallet.py b/cdp/wallet.py index d19f465..4f37ba1 100644 --- a/cdp/wallet.py +++ b/cdp/wallet.py @@ -718,13 +718,15 @@ def __repr__(self) -> str: """ return str(self) - def deploy_token(self, name: str, symbol: str, total_supply: str) -> SmartContract: + def deploy_token( + self, name: str, symbol: str, total_supply: Number | Decimal | str + ) -> SmartContract: """Deploy a token smart contract. Args: name (str): The name of the token. symbol (str): The symbol of the token. - total_supply (str): The total supply of the token. + total_supply (Union[Number, Decimal, str]): The total supply of the token. Returns: SmartContract: The deployed smart contract. @@ -736,7 +738,7 @@ def deploy_token(self, name: str, symbol: str, total_supply: str) -> SmartContra if self.default_address is None: raise ValueError("Default address does not exist") - return self.default_address.deploy_token(name, symbol, total_supply) + return self.default_address.deploy_token(name, symbol, str(total_supply)) def deploy_nft(self, name: str, symbol: str, base_uri: str) -> SmartContract: """Deploy an NFT smart contract.