|
19 | 19 | from pydantic import Field, StrictStr
|
20 | 20 | from typing import Optional
|
21 | 21 | from typing_extensions import Annotated
|
| 22 | +from cdp.client.models.compile_smart_contract_request import CompileSmartContractRequest |
| 23 | +from cdp.client.models.compiled_smart_contract import CompiledSmartContract |
22 | 24 | from cdp.client.models.create_smart_contract_request import CreateSmartContractRequest
|
23 | 25 | from cdp.client.models.deploy_smart_contract_request import DeploySmartContractRequest
|
24 | 26 | from cdp.client.models.read_contract_request import ReadContractRequest
|
@@ -46,6 +48,280 @@ def __init__(self, api_client=None) -> None:
|
46 | 48 | self.api_client = api_client
|
47 | 49 |
|
48 | 50 |
|
| 51 | + @validate_call |
| 52 | + def compile_smart_contract( |
| 53 | + self, |
| 54 | + compile_smart_contract_request: CompileSmartContractRequest, |
| 55 | + _request_timeout: Union[ |
| 56 | + None, |
| 57 | + Annotated[StrictFloat, Field(gt=0)], |
| 58 | + Tuple[ |
| 59 | + Annotated[StrictFloat, Field(gt=0)], |
| 60 | + Annotated[StrictFloat, Field(gt=0)] |
| 61 | + ] |
| 62 | + ] = None, |
| 63 | + _request_auth: Optional[Dict[StrictStr, Any]] = None, |
| 64 | + _content_type: Optional[StrictStr] = None, |
| 65 | + _headers: Optional[Dict[StrictStr, Any]] = None, |
| 66 | + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, |
| 67 | + ) -> CompiledSmartContract: |
| 68 | + """Compile a smart contract |
| 69 | +
|
| 70 | + Compile a smart contract |
| 71 | +
|
| 72 | + :param compile_smart_contract_request: (required) |
| 73 | + :type compile_smart_contract_request: CompileSmartContractRequest |
| 74 | + :param _request_timeout: timeout setting for this request. If one |
| 75 | + number provided, it will be total request |
| 76 | + timeout. It can also be a pair (tuple) of |
| 77 | + (connection, read) timeouts. |
| 78 | + :type _request_timeout: int, tuple(int, int), optional |
| 79 | + :param _request_auth: set to override the auth_settings for an a single |
| 80 | + request; this effectively ignores the |
| 81 | + authentication in the spec for a single request. |
| 82 | + :type _request_auth: dict, optional |
| 83 | + :param _content_type: force content-type for the request. |
| 84 | + :type _content_type: str, Optional |
| 85 | + :param _headers: set to override the headers for a single |
| 86 | + request; this effectively ignores the headers |
| 87 | + in the spec for a single request. |
| 88 | + :type _headers: dict, optional |
| 89 | + :param _host_index: set to override the host_index for a single |
| 90 | + request; this effectively ignores the host_index |
| 91 | + in the spec for a single request. |
| 92 | + :type _host_index: int, optional |
| 93 | + :return: Returns the result object. |
| 94 | + """ # noqa: E501 |
| 95 | + |
| 96 | + _param = self._compile_smart_contract_serialize( |
| 97 | + compile_smart_contract_request=compile_smart_contract_request, |
| 98 | + _request_auth=_request_auth, |
| 99 | + _content_type=_content_type, |
| 100 | + _headers=_headers, |
| 101 | + _host_index=_host_index |
| 102 | + ) |
| 103 | + |
| 104 | + _response_types_map: Dict[str, Optional[str]] = { |
| 105 | + '200': "CompiledSmartContract", |
| 106 | + } |
| 107 | + response_data = self.api_client.call_api( |
| 108 | + *_param, |
| 109 | + _request_timeout=_request_timeout |
| 110 | + ) |
| 111 | + response_data.read() |
| 112 | + return self.api_client.response_deserialize( |
| 113 | + response_data=response_data, |
| 114 | + response_types_map=_response_types_map, |
| 115 | + ).data |
| 116 | + |
| 117 | + |
| 118 | + @validate_call |
| 119 | + def compile_smart_contract_with_http_info( |
| 120 | + self, |
| 121 | + compile_smart_contract_request: CompileSmartContractRequest, |
| 122 | + _request_timeout: Union[ |
| 123 | + None, |
| 124 | + Annotated[StrictFloat, Field(gt=0)], |
| 125 | + Tuple[ |
| 126 | + Annotated[StrictFloat, Field(gt=0)], |
| 127 | + Annotated[StrictFloat, Field(gt=0)] |
| 128 | + ] |
| 129 | + ] = None, |
| 130 | + _request_auth: Optional[Dict[StrictStr, Any]] = None, |
| 131 | + _content_type: Optional[StrictStr] = None, |
| 132 | + _headers: Optional[Dict[StrictStr, Any]] = None, |
| 133 | + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, |
| 134 | + ) -> ApiResponse[CompiledSmartContract]: |
| 135 | + """Compile a smart contract |
| 136 | +
|
| 137 | + Compile a smart contract |
| 138 | +
|
| 139 | + :param compile_smart_contract_request: (required) |
| 140 | + :type compile_smart_contract_request: CompileSmartContractRequest |
| 141 | + :param _request_timeout: timeout setting for this request. If one |
| 142 | + number provided, it will be total request |
| 143 | + timeout. It can also be a pair (tuple) of |
| 144 | + (connection, read) timeouts. |
| 145 | + :type _request_timeout: int, tuple(int, int), optional |
| 146 | + :param _request_auth: set to override the auth_settings for an a single |
| 147 | + request; this effectively ignores the |
| 148 | + authentication in the spec for a single request. |
| 149 | + :type _request_auth: dict, optional |
| 150 | + :param _content_type: force content-type for the request. |
| 151 | + :type _content_type: str, Optional |
| 152 | + :param _headers: set to override the headers for a single |
| 153 | + request; this effectively ignores the headers |
| 154 | + in the spec for a single request. |
| 155 | + :type _headers: dict, optional |
| 156 | + :param _host_index: set to override the host_index for a single |
| 157 | + request; this effectively ignores the host_index |
| 158 | + in the spec for a single request. |
| 159 | + :type _host_index: int, optional |
| 160 | + :return: Returns the result object. |
| 161 | + """ # noqa: E501 |
| 162 | + |
| 163 | + _param = self._compile_smart_contract_serialize( |
| 164 | + compile_smart_contract_request=compile_smart_contract_request, |
| 165 | + _request_auth=_request_auth, |
| 166 | + _content_type=_content_type, |
| 167 | + _headers=_headers, |
| 168 | + _host_index=_host_index |
| 169 | + ) |
| 170 | + |
| 171 | + _response_types_map: Dict[str, Optional[str]] = { |
| 172 | + '200': "CompiledSmartContract", |
| 173 | + } |
| 174 | + response_data = self.api_client.call_api( |
| 175 | + *_param, |
| 176 | + _request_timeout=_request_timeout |
| 177 | + ) |
| 178 | + response_data.read() |
| 179 | + return self.api_client.response_deserialize( |
| 180 | + response_data=response_data, |
| 181 | + response_types_map=_response_types_map, |
| 182 | + ) |
| 183 | + |
| 184 | + |
| 185 | + @validate_call |
| 186 | + def compile_smart_contract_without_preload_content( |
| 187 | + self, |
| 188 | + compile_smart_contract_request: CompileSmartContractRequest, |
| 189 | + _request_timeout: Union[ |
| 190 | + None, |
| 191 | + Annotated[StrictFloat, Field(gt=0)], |
| 192 | + Tuple[ |
| 193 | + Annotated[StrictFloat, Field(gt=0)], |
| 194 | + Annotated[StrictFloat, Field(gt=0)] |
| 195 | + ] |
| 196 | + ] = None, |
| 197 | + _request_auth: Optional[Dict[StrictStr, Any]] = None, |
| 198 | + _content_type: Optional[StrictStr] = None, |
| 199 | + _headers: Optional[Dict[StrictStr, Any]] = None, |
| 200 | + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, |
| 201 | + ) -> RESTResponseType: |
| 202 | + """Compile a smart contract |
| 203 | +
|
| 204 | + Compile a smart contract |
| 205 | +
|
| 206 | + :param compile_smart_contract_request: (required) |
| 207 | + :type compile_smart_contract_request: CompileSmartContractRequest |
| 208 | + :param _request_timeout: timeout setting for this request. If one |
| 209 | + number provided, it will be total request |
| 210 | + timeout. It can also be a pair (tuple) of |
| 211 | + (connection, read) timeouts. |
| 212 | + :type _request_timeout: int, tuple(int, int), optional |
| 213 | + :param _request_auth: set to override the auth_settings for an a single |
| 214 | + request; this effectively ignores the |
| 215 | + authentication in the spec for a single request. |
| 216 | + :type _request_auth: dict, optional |
| 217 | + :param _content_type: force content-type for the request. |
| 218 | + :type _content_type: str, Optional |
| 219 | + :param _headers: set to override the headers for a single |
| 220 | + request; this effectively ignores the headers |
| 221 | + in the spec for a single request. |
| 222 | + :type _headers: dict, optional |
| 223 | + :param _host_index: set to override the host_index for a single |
| 224 | + request; this effectively ignores the host_index |
| 225 | + in the spec for a single request. |
| 226 | + :type _host_index: int, optional |
| 227 | + :return: Returns the result object. |
| 228 | + """ # noqa: E501 |
| 229 | + |
| 230 | + _param = self._compile_smart_contract_serialize( |
| 231 | + compile_smart_contract_request=compile_smart_contract_request, |
| 232 | + _request_auth=_request_auth, |
| 233 | + _content_type=_content_type, |
| 234 | + _headers=_headers, |
| 235 | + _host_index=_host_index |
| 236 | + ) |
| 237 | + |
| 238 | + _response_types_map: Dict[str, Optional[str]] = { |
| 239 | + '200': "CompiledSmartContract", |
| 240 | + } |
| 241 | + response_data = self.api_client.call_api( |
| 242 | + *_param, |
| 243 | + _request_timeout=_request_timeout |
| 244 | + ) |
| 245 | + return response_data.response |
| 246 | + |
| 247 | + |
| 248 | + def _compile_smart_contract_serialize( |
| 249 | + self, |
| 250 | + compile_smart_contract_request, |
| 251 | + _request_auth, |
| 252 | + _content_type, |
| 253 | + _headers, |
| 254 | + _host_index, |
| 255 | + ) -> RequestSerialized: |
| 256 | + |
| 257 | + _host = None |
| 258 | + |
| 259 | + _collection_formats: Dict[str, str] = { |
| 260 | + } |
| 261 | + |
| 262 | + _path_params: Dict[str, str] = {} |
| 263 | + _query_params: List[Tuple[str, str]] = [] |
| 264 | + _header_params: Dict[str, Optional[str]] = _headers or {} |
| 265 | + _form_params: List[Tuple[str, str]] = [] |
| 266 | + _files: Dict[ |
| 267 | + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] |
| 268 | + ] = {} |
| 269 | + _body_params: Optional[bytes] = None |
| 270 | + |
| 271 | + # process the path parameters |
| 272 | + # process the query parameters |
| 273 | + # process the header parameters |
| 274 | + # process the form parameters |
| 275 | + # process the body parameter |
| 276 | + if compile_smart_contract_request is not None: |
| 277 | + _body_params = compile_smart_contract_request |
| 278 | + |
| 279 | + |
| 280 | + # set the HTTP header `Accept` |
| 281 | + if 'Accept' not in _header_params: |
| 282 | + _header_params['Accept'] = self.api_client.select_header_accept( |
| 283 | + [ |
| 284 | + 'application/json' |
| 285 | + ] |
| 286 | + ) |
| 287 | + |
| 288 | + # set the HTTP header `Content-Type` |
| 289 | + if _content_type: |
| 290 | + _header_params['Content-Type'] = _content_type |
| 291 | + else: |
| 292 | + _default_content_type = ( |
| 293 | + self.api_client.select_header_content_type( |
| 294 | + [ |
| 295 | + 'application/json' |
| 296 | + ] |
| 297 | + ) |
| 298 | + ) |
| 299 | + if _default_content_type is not None: |
| 300 | + _header_params['Content-Type'] = _default_content_type |
| 301 | + |
| 302 | + # authentication setting |
| 303 | + _auth_settings: List[str] = [ |
| 304 | + 'apiKey' |
| 305 | + ] |
| 306 | + |
| 307 | + return self.api_client.param_serialize( |
| 308 | + method='POST', |
| 309 | + resource_path='/v1/smart_contracts/compile', |
| 310 | + path_params=_path_params, |
| 311 | + query_params=_query_params, |
| 312 | + header_params=_header_params, |
| 313 | + body=_body_params, |
| 314 | + post_params=_form_params, |
| 315 | + files=_files, |
| 316 | + auth_settings=_auth_settings, |
| 317 | + collection_formats=_collection_formats, |
| 318 | + _host=_host, |
| 319 | + _request_auth=_request_auth |
| 320 | + ) |
| 321 | + |
| 322 | + |
| 323 | + |
| 324 | + |
49 | 325 | @validate_call
|
50 | 326 | def create_smart_contract(
|
51 | 327 | self,
|
|
0 commit comments