circle-developer-controlled-wallets 0.1.0b1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of circle-developer-controlled-wallets might be problematic. Click here for more details.
- circle/__init__.py +0 -0
- circle/web3/__init__.py +0 -0
- circle/web3/developer_controlled_wallets/__init__.py +108 -0
- circle/web3/developer_controlled_wallets/api/__init__.py +9 -0
- circle/web3/developer_controlled_wallets/api/signing_api.py +356 -0
- circle/web3/developer_controlled_wallets/api/token_lookup_api.py +198 -0
- circle/web3/developer_controlled_wallets/api/transactions_api.py +1527 -0
- circle/web3/developer_controlled_wallets/api/wallet_sets_api.py +691 -0
- circle/web3/developer_controlled_wallets/api/wallets_api.py +1118 -0
- circle/web3/developer_controlled_wallets/api_client.py +789 -0
- circle/web3/developer_controlled_wallets/api_response.py +25 -0
- circle/web3/developer_controlled_wallets/configuration.py +455 -0
- circle/web3/developer_controlled_wallets/exceptions.py +162 -0
- circle/web3/developer_controlled_wallets/models/__init__.py +87 -0
- circle/web3/developer_controlled_wallets/models/abi_parameters_inner.py +168 -0
- circle/web3/developer_controlled_wallets/models/accelerate_transaction_for_developer_request.py +85 -0
- circle/web3/developer_controlled_wallets/models/accelerate_transaction_for_developer_response.py +83 -0
- circle/web3/developer_controlled_wallets/models/account_type.py +36 -0
- circle/web3/developer_controlled_wallets/models/balance.py +91 -0
- circle/web3/developer_controlled_wallets/models/blockchain.py +40 -0
- circle/web3/developer_controlled_wallets/models/cancel_transaction_for_developer_request.py +85 -0
- circle/web3/developer_controlled_wallets/models/cancel_transaction_for_developer_response.py +86 -0
- circle/web3/developer_controlled_wallets/models/create_contract_execution_transaction_for_developer_request.py +118 -0
- circle/web3/developer_controlled_wallets/models/create_contract_execution_transaction_for_developer_response.py +86 -0
- circle/web3/developer_controlled_wallets/models/create_developer_transaction_accelerate200_response.py +87 -0
- circle/web3/developer_controlled_wallets/models/create_developer_transaction_cancel200_response.py +87 -0
- circle/web3/developer_controlled_wallets/models/create_developer_transaction_contract_execution200_response.py +87 -0
- circle/web3/developer_controlled_wallets/models/create_developer_transaction_transfer200_response.py +87 -0
- circle/web3/developer_controlled_wallets/models/create_developer_wallet200_response.py +87 -0
- circle/web3/developer_controlled_wallets/models/create_developer_wallet_request.py +105 -0
- circle/web3/developer_controlled_wallets/models/create_developer_wallet_response.py +91 -0
- circle/web3/developer_controlled_wallets/models/create_developer_wallet_set_request.py +87 -0
- circle/web3/developer_controlled_wallets/models/create_developer_wallet_set_response.py +87 -0
- circle/web3/developer_controlled_wallets/models/create_transfer_estimate_fee200_response.py +87 -0
- circle/web3/developer_controlled_wallets/models/create_transfer_transaction_for_developer_request.py +112 -0
- circle/web3/developer_controlled_wallets/models/create_transfer_transaction_for_developer_response.py +86 -0
- circle/web3/developer_controlled_wallets/models/create_validate_address200_response.py +87 -0
- circle/web3/developer_controlled_wallets/models/create_wallet_set200_response.py +87 -0
- circle/web3/developer_controlled_wallets/models/custody_type.py +36 -0
- circle/web3/developer_controlled_wallets/models/error.py +85 -0
- circle/web3/developer_controlled_wallets/models/estimate_contract_execution_transaction_fee_request.py +106 -0
- circle/web3/developer_controlled_wallets/models/estimate_transaction_fee_response.py +103 -0
- circle/web3/developer_controlled_wallets/models/estimate_transfer_transaction_fee_request.py +97 -0
- circle/web3/developer_controlled_wallets/models/estimated_transaction_fee.py +91 -0
- circle/web3/developer_controlled_wallets/models/ext_get_all_wallets_response.py +91 -0
- circle/web3/developer_controlled_wallets/models/ext_get_wallet_by_id_response.py +87 -0
- circle/web3/developer_controlled_wallets/models/ext_update_wallet_metadata_request.py +85 -0
- circle/web3/developer_controlled_wallets/models/ext_wallet_response.py +87 -0
- circle/web3/developer_controlled_wallets/models/ext_wallet_response_wallet.py +111 -0
- circle/web3/developer_controlled_wallets/models/fee_level.py +37 -0
- circle/web3/developer_controlled_wallets/models/get_balances_response.py +91 -0
- circle/web3/developer_controlled_wallets/models/get_nfts_response.py +91 -0
- circle/web3/developer_controlled_wallets/models/get_token_by_id_response.py +87 -0
- circle/web3/developer_controlled_wallets/models/get_token_id200_response.py +87 -0
- circle/web3/developer_controlled_wallets/models/get_transaction200_response.py +87 -0
- circle/web3/developer_controlled_wallets/models/get_transaction_by_id_response.py +87 -0
- circle/web3/developer_controlled_wallets/models/get_transactions_response.py +91 -0
- circle/web3/developer_controlled_wallets/models/get_wallet200_response.py +87 -0
- circle/web3/developer_controlled_wallets/models/get_wallet_set200_response.py +87 -0
- circle/web3/developer_controlled_wallets/models/get_wallet_set_by_id_response.py +87 -0
- circle/web3/developer_controlled_wallets/models/get_wallet_sets_response.py +91 -0
- circle/web3/developer_controlled_wallets/models/list_transactions200_response.py +87 -0
- circle/web3/developer_controlled_wallets/models/list_wallet_ballance200_response.py +87 -0
- circle/web3/developer_controlled_wallets/models/list_wallet_nfts200_response.py +87 -0
- circle/web3/developer_controlled_wallets/models/list_wallet_sets200_response.py +87 -0
- circle/web3/developer_controlled_wallets/models/list_wallets200_response.py +87 -0
- circle/web3/developer_controlled_wallets/models/nft.py +95 -0
- circle/web3/developer_controlled_wallets/models/operation.py +37 -0
- circle/web3/developer_controlled_wallets/models/sign_developer_message200_response.py +87 -0
- circle/web3/developer_controlled_wallets/models/sign_developer_typed_data200_response.py +87 -0
- circle/web3/developer_controlled_wallets/models/sign_message_for_developer_request.py +91 -0
- circle/web3/developer_controlled_wallets/models/sign_message_for_developer_response.py +83 -0
- circle/web3/developer_controlled_wallets/models/sign_typed_data_for_developer_request.py +89 -0
- circle/web3/developer_controlled_wallets/models/sign_typed_data_for_developer_response.py +83 -0
- circle/web3/developer_controlled_wallets/models/token_response.py +103 -0
- circle/web3/developer_controlled_wallets/models/token_standard.py +37 -0
- circle/web3/developer_controlled_wallets/models/transaction.py +159 -0
- circle/web3/developer_controlled_wallets/models/transaction_state.py +43 -0
- circle/web3/developer_controlled_wallets/models/transaction_type.py +36 -0
- circle/web3/developer_controlled_wallets/models/update_wallet200_response.py +87 -0
- circle/web3/developer_controlled_wallets/models/update_wallet_set200_response.py +87 -0
- circle/web3/developer_controlled_wallets/models/update_wallet_set_metadata_request.py +83 -0
- circle/web3/developer_controlled_wallets/models/update_wallet_set_metadata_response.py +87 -0
- circle/web3/developer_controlled_wallets/models/validate_address_request.py +86 -0
- circle/web3/developer_controlled_wallets/models/validate_address_response.py +83 -0
- circle/web3/developer_controlled_wallets/models/wallet_metadata.py +85 -0
- circle/web3/developer_controlled_wallets/models/wallet_response.py +111 -0
- circle/web3/developer_controlled_wallets/models/wallet_set_response.py +94 -0
- circle/web3/developer_controlled_wallets/models/wallet_state.py +36 -0
- circle/web3/developer_controlled_wallets/py.typed +0 -0
- circle/web3/developer_controlled_wallets/rest.py +299 -0
- circle_developer_controlled_wallets-0.1.0b1.dist-info/METADATA +112 -0
- circle_developer_controlled_wallets-0.1.0b1.dist-info/RECORD +95 -0
- circle_developer_controlled_wallets-0.1.0b1.dist-info/WHEEL +5 -0
- circle_developer_controlled_wallets-0.1.0b1.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
The version of the OpenAPI document: 1.0
|
|
5
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
6
|
+
|
|
7
|
+
Do not edit the class manually.
|
|
8
|
+
""" # noqa: E501
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
from __future__ import annotations
|
|
12
|
+
import pprint
|
|
13
|
+
import re # noqa: F401
|
|
14
|
+
import json
|
|
15
|
+
|
|
16
|
+
from datetime import datetime
|
|
17
|
+
from typing import Optional
|
|
18
|
+
from pydantic import BaseModel, Field, StrictStr, constr
|
|
19
|
+
from circle.web3.developer_controlled_wallets.models.account_type import AccountType
|
|
20
|
+
from circle.web3.developer_controlled_wallets.models.blockchain import Blockchain
|
|
21
|
+
from circle.web3.developer_controlled_wallets.models.custody_type import CustodyType
|
|
22
|
+
from circle.web3.developer_controlled_wallets.models.wallet_state import WalletState
|
|
23
|
+
|
|
24
|
+
class WalletResponse(BaseModel):
|
|
25
|
+
"""
|
|
26
|
+
WalletResponse
|
|
27
|
+
"""
|
|
28
|
+
id: StrictStr = Field(..., description="Unique system generated identifier of the resource.")
|
|
29
|
+
address: StrictStr = Field(..., description="The blockchain address generated upon wallet creation.")
|
|
30
|
+
blockchain: Blockchain = Field(...)
|
|
31
|
+
create_date: datetime = Field(..., alias="createDate", description="Date and time the resource was created. ISO-8601 UTC date/time.")
|
|
32
|
+
custody_type: CustodyType = Field(..., alias="custodyType")
|
|
33
|
+
account_type: AccountType = Field(..., alias="accountType")
|
|
34
|
+
name: Optional[StrictStr] = Field(None, description="Optional name or description associated with the wallet.")
|
|
35
|
+
ref_id: Optional[StrictStr] = Field(None, alias="refId", description="Optional reference or description used to identify the wallet.")
|
|
36
|
+
state: WalletState = Field(...)
|
|
37
|
+
update_date: datetime = Field(..., alias="updateDate", description="Last update date of the resource. ISO-8601 UTC date/time.")
|
|
38
|
+
user_id: Optional[constr(strict=True, max_length=50, min_length=5)] = Field(None, alias="userId", description="Unique system generated identifier for the user.")
|
|
39
|
+
wallet_set_id: StrictStr = Field(..., alias="walletSetId", description="Unique system generated identifier of the wallet's parent wallet set. under.")
|
|
40
|
+
sca_core: Optional[StrictStr] = Field(None, alias="scaCore", description="SCAs can have different versions that have different functionality. SCACore will display the version of the SCA being created. Please refer to developer docs for a list of the versions supported.")
|
|
41
|
+
__properties = ["id", "address", "blockchain", "createDate", "custodyType", "accountType", "name", "refId", "state", "updateDate", "userId", "walletSetId", "scaCore"]
|
|
42
|
+
|
|
43
|
+
def __init__(self, **kwargs):
|
|
44
|
+
if "idempotencyKey" in self.__properties and not kwargs.get("idempotency_key"):
|
|
45
|
+
kwargs["idempotency_key"] = "#REFILL_PLACEHOLDER"
|
|
46
|
+
|
|
47
|
+
if "entitySecretCiphertext" in self.__properties and not kwargs.get("entity_secret_ciphertext"):
|
|
48
|
+
kwargs["entity_secret_ciphertext"] = "#REFILL_PLACEHOLDER"
|
|
49
|
+
super().__init__(**kwargs)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
class Config:
|
|
53
|
+
"""Pydantic configuration"""
|
|
54
|
+
allow_population_by_field_name = True
|
|
55
|
+
validate_assignment = True
|
|
56
|
+
|
|
57
|
+
def to_str(self) -> str:
|
|
58
|
+
"""Returns the string representation of the model using alias"""
|
|
59
|
+
return pprint.pformat(self.dict(by_alias=True))
|
|
60
|
+
|
|
61
|
+
def to_json(self) -> str:
|
|
62
|
+
"""Returns the JSON representation of the model using alias"""
|
|
63
|
+
return json.dumps(self.to_dict())
|
|
64
|
+
|
|
65
|
+
@classmethod
|
|
66
|
+
def from_json(cls, json_str: str) -> WalletResponse:
|
|
67
|
+
"""Create an instance of WalletResponse from a JSON string"""
|
|
68
|
+
return cls.from_dict(json.loads(json_str))
|
|
69
|
+
|
|
70
|
+
def to_dict(self):
|
|
71
|
+
"""Returns the dictionary representation of the model using alias"""
|
|
72
|
+
_dict = self.dict(by_alias=True,
|
|
73
|
+
exclude={
|
|
74
|
+
},
|
|
75
|
+
exclude_none=True)
|
|
76
|
+
return _dict
|
|
77
|
+
|
|
78
|
+
@classmethod
|
|
79
|
+
def from_dict(cls, obj: dict) -> WalletResponse:
|
|
80
|
+
"""Create an instance of WalletResponse from a dict"""
|
|
81
|
+
if obj is None:
|
|
82
|
+
return None
|
|
83
|
+
|
|
84
|
+
if not isinstance(obj, dict):
|
|
85
|
+
return WalletResponse.parse_obj(obj)
|
|
86
|
+
|
|
87
|
+
# fill idempotency_key and ciphertext with placeholder for auto_fill
|
|
88
|
+
if "idempotencyKey" in cls.__properties and not obj.get("idempotencyKey"):
|
|
89
|
+
obj["idempotencyKey"] = "#REFILL_PLACEHOLDER"
|
|
90
|
+
|
|
91
|
+
if "entitySecretCiphertext" in cls.__properties and not obj.get("entitySecretCiphertext"):
|
|
92
|
+
obj["entitySecretCiphertext"] = "#REFILL_PLACEHOLDER"
|
|
93
|
+
|
|
94
|
+
_obj = WalletResponse.parse_obj({
|
|
95
|
+
"id": obj.get("id"),
|
|
96
|
+
"address": obj.get("address"),
|
|
97
|
+
"blockchain": obj.get("blockchain"),
|
|
98
|
+
"create_date": obj.get("createDate"),
|
|
99
|
+
"custody_type": obj.get("custodyType"),
|
|
100
|
+
"account_type": obj.get("accountType"),
|
|
101
|
+
"name": obj.get("name"),
|
|
102
|
+
"ref_id": obj.get("refId"),
|
|
103
|
+
"state": obj.get("state"),
|
|
104
|
+
"update_date": obj.get("updateDate"),
|
|
105
|
+
"user_id": obj.get("userId"),
|
|
106
|
+
"wallet_set_id": obj.get("walletSetId"),
|
|
107
|
+
"sca_core": obj.get("scaCore")
|
|
108
|
+
})
|
|
109
|
+
return _obj
|
|
110
|
+
|
|
111
|
+
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
The version of the OpenAPI document: 1.0
|
|
5
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
6
|
+
|
|
7
|
+
Do not edit the class manually.
|
|
8
|
+
""" # noqa: E501
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
from __future__ import annotations
|
|
12
|
+
import pprint
|
|
13
|
+
import re # noqa: F401
|
|
14
|
+
import json
|
|
15
|
+
|
|
16
|
+
from datetime import datetime
|
|
17
|
+
from typing import Optional
|
|
18
|
+
from pydantic import BaseModel, Field, StrictStr, constr
|
|
19
|
+
from circle.web3.developer_controlled_wallets.models.custody_type import CustodyType
|
|
20
|
+
|
|
21
|
+
class WalletSetResponse(BaseModel):
|
|
22
|
+
"""
|
|
23
|
+
WalletSetResponse
|
|
24
|
+
"""
|
|
25
|
+
id: StrictStr = Field(..., description="Unique system generated identifier of the resource.")
|
|
26
|
+
create_date: datetime = Field(..., alias="createDate", description="Date and time the resource was created. ISO-8601 UTC date/time.")
|
|
27
|
+
custody_type: CustodyType = Field(..., alias="custodyType")
|
|
28
|
+
name: Optional[StrictStr] = Field(None, description="Name or description of the wallet set.")
|
|
29
|
+
update_date: datetime = Field(..., alias="updateDate", description="Last update date of the wallet set. ISO-8601 UTC date/time.")
|
|
30
|
+
user_id: Optional[constr(strict=True, max_length=50, min_length=5)] = Field(None, alias="userId", description="Unique system generated identifier for the user.")
|
|
31
|
+
__properties = ["id", "createDate", "custodyType", "name", "updateDate", "userId"]
|
|
32
|
+
|
|
33
|
+
def __init__(self, **kwargs):
|
|
34
|
+
if "idempotencyKey" in self.__properties and not kwargs.get("idempotency_key"):
|
|
35
|
+
kwargs["idempotency_key"] = "#REFILL_PLACEHOLDER"
|
|
36
|
+
|
|
37
|
+
if "entitySecretCiphertext" in self.__properties and not kwargs.get("entity_secret_ciphertext"):
|
|
38
|
+
kwargs["entity_secret_ciphertext"] = "#REFILL_PLACEHOLDER"
|
|
39
|
+
super().__init__(**kwargs)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
class Config:
|
|
43
|
+
"""Pydantic configuration"""
|
|
44
|
+
allow_population_by_field_name = True
|
|
45
|
+
validate_assignment = True
|
|
46
|
+
|
|
47
|
+
def to_str(self) -> str:
|
|
48
|
+
"""Returns the string representation of the model using alias"""
|
|
49
|
+
return pprint.pformat(self.dict(by_alias=True))
|
|
50
|
+
|
|
51
|
+
def to_json(self) -> str:
|
|
52
|
+
"""Returns the JSON representation of the model using alias"""
|
|
53
|
+
return json.dumps(self.to_dict())
|
|
54
|
+
|
|
55
|
+
@classmethod
|
|
56
|
+
def from_json(cls, json_str: str) -> WalletSetResponse:
|
|
57
|
+
"""Create an instance of WalletSetResponse from a JSON string"""
|
|
58
|
+
return cls.from_dict(json.loads(json_str))
|
|
59
|
+
|
|
60
|
+
def to_dict(self):
|
|
61
|
+
"""Returns the dictionary representation of the model using alias"""
|
|
62
|
+
_dict = self.dict(by_alias=True,
|
|
63
|
+
exclude={
|
|
64
|
+
},
|
|
65
|
+
exclude_none=True)
|
|
66
|
+
return _dict
|
|
67
|
+
|
|
68
|
+
@classmethod
|
|
69
|
+
def from_dict(cls, obj: dict) -> WalletSetResponse:
|
|
70
|
+
"""Create an instance of WalletSetResponse from a dict"""
|
|
71
|
+
if obj is None:
|
|
72
|
+
return None
|
|
73
|
+
|
|
74
|
+
if not isinstance(obj, dict):
|
|
75
|
+
return WalletSetResponse.parse_obj(obj)
|
|
76
|
+
|
|
77
|
+
# fill idempotency_key and ciphertext with placeholder for auto_fill
|
|
78
|
+
if "idempotencyKey" in cls.__properties and not obj.get("idempotencyKey"):
|
|
79
|
+
obj["idempotencyKey"] = "#REFILL_PLACEHOLDER"
|
|
80
|
+
|
|
81
|
+
if "entitySecretCiphertext" in cls.__properties and not obj.get("entitySecretCiphertext"):
|
|
82
|
+
obj["entitySecretCiphertext"] = "#REFILL_PLACEHOLDER"
|
|
83
|
+
|
|
84
|
+
_obj = WalletSetResponse.parse_obj({
|
|
85
|
+
"id": obj.get("id"),
|
|
86
|
+
"create_date": obj.get("createDate"),
|
|
87
|
+
"custody_type": obj.get("custodyType"),
|
|
88
|
+
"name": obj.get("name"),
|
|
89
|
+
"update_date": obj.get("updateDate"),
|
|
90
|
+
"user_id": obj.get("userId")
|
|
91
|
+
})
|
|
92
|
+
return _obj
|
|
93
|
+
|
|
94
|
+
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
The version of the OpenAPI document: 1.0
|
|
5
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
6
|
+
|
|
7
|
+
Do not edit the class manually.
|
|
8
|
+
""" # noqa: E501
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
import json
|
|
12
|
+
import pprint
|
|
13
|
+
import re # noqa: F401
|
|
14
|
+
from aenum import Enum, no_arg
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class WalletState(str, Enum):
|
|
21
|
+
"""
|
|
22
|
+
WalletState
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
"""
|
|
26
|
+
allowed enum values
|
|
27
|
+
"""
|
|
28
|
+
LIVE = 'LIVE'
|
|
29
|
+
FROZEN = 'FROZEN'
|
|
30
|
+
|
|
31
|
+
@classmethod
|
|
32
|
+
def from_json(cls, json_str: str) -> WalletState:
|
|
33
|
+
"""Create an instance of WalletState from a JSON string"""
|
|
34
|
+
return WalletState(json.loads(json_str))
|
|
35
|
+
|
|
36
|
+
|
|
File without changes
|
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
The version of the OpenAPI document: 1.0
|
|
5
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
6
|
+
|
|
7
|
+
Do not edit the class manually.
|
|
8
|
+
""" # noqa: E501
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
import io
|
|
12
|
+
import json
|
|
13
|
+
import logging
|
|
14
|
+
import re
|
|
15
|
+
import ssl
|
|
16
|
+
|
|
17
|
+
from urllib.parse import urlencode, quote_plus
|
|
18
|
+
import urllib3
|
|
19
|
+
|
|
20
|
+
from circle.web3.developer_controlled_wallets.exceptions import ApiException, UnauthorizedException, ForbiddenException, NotFoundException, ServiceException, ApiValueError, BadRequestException
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
logger = logging.getLogger(__name__)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class RESTResponse(io.IOBase):
|
|
27
|
+
|
|
28
|
+
def __init__(self, resp):
|
|
29
|
+
self.urllib3_response = resp
|
|
30
|
+
self.status = resp.status
|
|
31
|
+
self.reason = resp.reason
|
|
32
|
+
self.data = resp.data
|
|
33
|
+
|
|
34
|
+
def getheaders(self):
|
|
35
|
+
"""Returns a dictionary of the response headers."""
|
|
36
|
+
return self.urllib3_response.headers
|
|
37
|
+
|
|
38
|
+
def getheader(self, name, default=None):
|
|
39
|
+
"""Returns a given response header."""
|
|
40
|
+
return self.urllib3_response.headers.get(name, default)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
class RESTClientObject(object):
|
|
44
|
+
|
|
45
|
+
def __init__(self, configuration, pools_size=4, maxsize=None):
|
|
46
|
+
# urllib3.PoolManager will pass all kw parameters to connectionpool
|
|
47
|
+
# https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/poolmanager.py#L75 # noqa: E501
|
|
48
|
+
# https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/connectionpool.py#L680 # noqa: E501
|
|
49
|
+
# maxsize is the number of requests to host that are allowed in parallel # noqa: E501
|
|
50
|
+
# Custom SSL certificates and client certificates: http://urllib3.readthedocs.io/en/latest/advanced-usage.html # noqa: E501
|
|
51
|
+
|
|
52
|
+
# cert_reqs
|
|
53
|
+
if configuration.verify_ssl:
|
|
54
|
+
cert_reqs = ssl.CERT_REQUIRED
|
|
55
|
+
else:
|
|
56
|
+
cert_reqs = ssl.CERT_NONE
|
|
57
|
+
|
|
58
|
+
addition_pool_args = {}
|
|
59
|
+
if configuration.assert_hostname is not None:
|
|
60
|
+
addition_pool_args['assert_hostname'] = configuration.assert_hostname # noqa: E501
|
|
61
|
+
|
|
62
|
+
if configuration.retries is not None:
|
|
63
|
+
addition_pool_args['retries'] = configuration.retries
|
|
64
|
+
|
|
65
|
+
if configuration.tls_server_name:
|
|
66
|
+
addition_pool_args['server_hostname'] = configuration.tls_server_name
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
if configuration.socket_options is not None:
|
|
70
|
+
addition_pool_args['socket_options'] = configuration.socket_options
|
|
71
|
+
|
|
72
|
+
if maxsize is None:
|
|
73
|
+
if configuration.connection_pool_maxsize is not None:
|
|
74
|
+
maxsize = configuration.connection_pool_maxsize
|
|
75
|
+
else:
|
|
76
|
+
maxsize = 4
|
|
77
|
+
|
|
78
|
+
# https pool manager
|
|
79
|
+
if configuration.proxy:
|
|
80
|
+
self.pool_manager = urllib3.ProxyManager(
|
|
81
|
+
num_pools=pools_size,
|
|
82
|
+
maxsize=maxsize,
|
|
83
|
+
cert_reqs=cert_reqs,
|
|
84
|
+
ca_certs=configuration.ssl_ca_cert,
|
|
85
|
+
cert_file=configuration.cert_file,
|
|
86
|
+
key_file=configuration.key_file,
|
|
87
|
+
proxy_url=configuration.proxy,
|
|
88
|
+
proxy_headers=configuration.proxy_headers,
|
|
89
|
+
**addition_pool_args
|
|
90
|
+
)
|
|
91
|
+
else:
|
|
92
|
+
self.pool_manager = urllib3.PoolManager(
|
|
93
|
+
num_pools=pools_size,
|
|
94
|
+
maxsize=maxsize,
|
|
95
|
+
cert_reqs=cert_reqs,
|
|
96
|
+
ca_certs=configuration.ssl_ca_cert,
|
|
97
|
+
cert_file=configuration.cert_file,
|
|
98
|
+
key_file=configuration.key_file,
|
|
99
|
+
**addition_pool_args
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
def request(self, method, url, query_params=None, headers=None,
|
|
103
|
+
body=None, post_params=None, _preload_content=True,
|
|
104
|
+
_request_timeout=None):
|
|
105
|
+
"""Perform requests.
|
|
106
|
+
|
|
107
|
+
:param method: http request method
|
|
108
|
+
:param url: http request url
|
|
109
|
+
:param query_params: query parameters in the url
|
|
110
|
+
:param headers: http request headers
|
|
111
|
+
:param body: request json body, for `application/json`
|
|
112
|
+
:param post_params: request post parameters,
|
|
113
|
+
`application/x-www-form-urlencoded`
|
|
114
|
+
and `multipart/form-data`
|
|
115
|
+
:param _preload_content: if False, the urllib3.HTTPResponse object will
|
|
116
|
+
be returned without reading/decoding response
|
|
117
|
+
data. Default is True.
|
|
118
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
119
|
+
number provided, it will be total request
|
|
120
|
+
timeout. It can also be a pair (tuple) of
|
|
121
|
+
(connection, read) timeouts.
|
|
122
|
+
"""
|
|
123
|
+
method = method.upper()
|
|
124
|
+
assert method in ['GET', 'HEAD', 'DELETE', 'POST', 'PUT',
|
|
125
|
+
'PATCH', 'OPTIONS']
|
|
126
|
+
|
|
127
|
+
if post_params and body:
|
|
128
|
+
raise ApiValueError(
|
|
129
|
+
"body parameter cannot be used with post_params parameter."
|
|
130
|
+
)
|
|
131
|
+
|
|
132
|
+
post_params = post_params or {}
|
|
133
|
+
headers = headers or {}
|
|
134
|
+
# url already contains the URL query string
|
|
135
|
+
# so reset query_params to empty dict
|
|
136
|
+
query_params = {}
|
|
137
|
+
|
|
138
|
+
timeout = None
|
|
139
|
+
if _request_timeout:
|
|
140
|
+
if isinstance(_request_timeout, (int,float)): # noqa: E501,F821
|
|
141
|
+
timeout = urllib3.Timeout(total=_request_timeout)
|
|
142
|
+
elif (isinstance(_request_timeout, tuple) and
|
|
143
|
+
len(_request_timeout) == 2):
|
|
144
|
+
timeout = urllib3.Timeout(
|
|
145
|
+
connect=_request_timeout[0], read=_request_timeout[1])
|
|
146
|
+
|
|
147
|
+
try:
|
|
148
|
+
# For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE`
|
|
149
|
+
if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']:
|
|
150
|
+
|
|
151
|
+
# no content type provided or payload is json
|
|
152
|
+
if not headers.get('Content-Type') or re.search('json', headers['Content-Type'], re.IGNORECASE):
|
|
153
|
+
request_body = None
|
|
154
|
+
if body is not None:
|
|
155
|
+
request_body = json.dumps(body)
|
|
156
|
+
r = self.pool_manager.request(
|
|
157
|
+
method, url,
|
|
158
|
+
body=request_body,
|
|
159
|
+
preload_content=_preload_content,
|
|
160
|
+
timeout=timeout,
|
|
161
|
+
headers=headers)
|
|
162
|
+
elif headers['Content-Type'] == 'application/x-www-form-urlencoded': # noqa: E501
|
|
163
|
+
r = self.pool_manager.request(
|
|
164
|
+
method, url,
|
|
165
|
+
fields=post_params,
|
|
166
|
+
encode_multipart=False,
|
|
167
|
+
preload_content=_preload_content,
|
|
168
|
+
timeout=timeout,
|
|
169
|
+
headers=headers)
|
|
170
|
+
elif headers['Content-Type'] == 'multipart/form-data':
|
|
171
|
+
# must del headers['Content-Type'], or the correct
|
|
172
|
+
# Content-Type which generated by urllib3 will be
|
|
173
|
+
# overwritten.
|
|
174
|
+
del headers['Content-Type']
|
|
175
|
+
r = self.pool_manager.request(
|
|
176
|
+
method, url,
|
|
177
|
+
fields=post_params,
|
|
178
|
+
encode_multipart=True,
|
|
179
|
+
preload_content=_preload_content,
|
|
180
|
+
timeout=timeout,
|
|
181
|
+
headers=headers)
|
|
182
|
+
# Pass a `string` parameter directly in the body to support
|
|
183
|
+
# other content types than Json when `body` argument is
|
|
184
|
+
# provided in serialized form
|
|
185
|
+
elif isinstance(body, str) or isinstance(body, bytes):
|
|
186
|
+
request_body = body
|
|
187
|
+
r = self.pool_manager.request(
|
|
188
|
+
method, url,
|
|
189
|
+
body=request_body,
|
|
190
|
+
preload_content=_preload_content,
|
|
191
|
+
timeout=timeout,
|
|
192
|
+
headers=headers)
|
|
193
|
+
else:
|
|
194
|
+
# Cannot generate the request from given parameters
|
|
195
|
+
msg = """Cannot prepare a request message for provided
|
|
196
|
+
arguments. Please check that your arguments match
|
|
197
|
+
declared content type."""
|
|
198
|
+
raise ApiException(status=0, reason=msg)
|
|
199
|
+
# For `GET`, `HEAD`
|
|
200
|
+
else:
|
|
201
|
+
r = self.pool_manager.request(method, url,
|
|
202
|
+
fields={},
|
|
203
|
+
preload_content=_preload_content,
|
|
204
|
+
timeout=timeout,
|
|
205
|
+
headers=headers)
|
|
206
|
+
except urllib3.exceptions.SSLError as e:
|
|
207
|
+
msg = "{0}\n{1}".format(type(e).__name__, str(e))
|
|
208
|
+
raise ApiException(status=0, reason=msg)
|
|
209
|
+
|
|
210
|
+
if _preload_content:
|
|
211
|
+
r = RESTResponse(r)
|
|
212
|
+
|
|
213
|
+
# log response body
|
|
214
|
+
logger.debug("response body: %s", r.data)
|
|
215
|
+
|
|
216
|
+
if not 200 <= r.status <= 299:
|
|
217
|
+
if r.status == 400:
|
|
218
|
+
raise BadRequestException(http_resp=r)
|
|
219
|
+
|
|
220
|
+
if r.status == 401:
|
|
221
|
+
raise UnauthorizedException(http_resp=r)
|
|
222
|
+
|
|
223
|
+
if r.status == 403:
|
|
224
|
+
raise ForbiddenException(http_resp=r)
|
|
225
|
+
|
|
226
|
+
if r.status == 404:
|
|
227
|
+
raise NotFoundException(http_resp=r)
|
|
228
|
+
|
|
229
|
+
if 500 <= r.status <= 599:
|
|
230
|
+
raise ServiceException(http_resp=r)
|
|
231
|
+
|
|
232
|
+
raise ApiException(http_resp=r)
|
|
233
|
+
|
|
234
|
+
return r
|
|
235
|
+
|
|
236
|
+
def get_request(self, url, headers=None, query_params=None, _preload_content=True,
|
|
237
|
+
_request_timeout=None):
|
|
238
|
+
return self.request("GET", url,
|
|
239
|
+
headers=headers,
|
|
240
|
+
_preload_content=_preload_content,
|
|
241
|
+
_request_timeout=_request_timeout,
|
|
242
|
+
query_params=query_params)
|
|
243
|
+
|
|
244
|
+
def head_request(self, url, headers=None, query_params=None, _preload_content=True,
|
|
245
|
+
_request_timeout=None):
|
|
246
|
+
return self.request("HEAD", url,
|
|
247
|
+
headers=headers,
|
|
248
|
+
_preload_content=_preload_content,
|
|
249
|
+
_request_timeout=_request_timeout,
|
|
250
|
+
query_params=query_params)
|
|
251
|
+
|
|
252
|
+
def options_request(self, url, headers=None, query_params=None, post_params=None,
|
|
253
|
+
body=None, _preload_content=True, _request_timeout=None):
|
|
254
|
+
return self.request("OPTIONS", url,
|
|
255
|
+
headers=headers,
|
|
256
|
+
query_params=query_params,
|
|
257
|
+
post_params=post_params,
|
|
258
|
+
_preload_content=_preload_content,
|
|
259
|
+
_request_timeout=_request_timeout,
|
|
260
|
+
body=body)
|
|
261
|
+
|
|
262
|
+
def delete_request(self, url, headers=None, query_params=None, body=None,
|
|
263
|
+
_preload_content=True, _request_timeout=None):
|
|
264
|
+
return self.request("DELETE", url,
|
|
265
|
+
headers=headers,
|
|
266
|
+
query_params=query_params,
|
|
267
|
+
_preload_content=_preload_content,
|
|
268
|
+
_request_timeout=_request_timeout,
|
|
269
|
+
body=body)
|
|
270
|
+
|
|
271
|
+
def post_request(self, url, headers=None, query_params=None, post_params=None,
|
|
272
|
+
body=None, _preload_content=True, _request_timeout=None):
|
|
273
|
+
return self.request("POST", url,
|
|
274
|
+
headers=headers,
|
|
275
|
+
query_params=query_params,
|
|
276
|
+
post_params=post_params,
|
|
277
|
+
_preload_content=_preload_content,
|
|
278
|
+
_request_timeout=_request_timeout,
|
|
279
|
+
body=body)
|
|
280
|
+
|
|
281
|
+
def put_request(self, url, headers=None, query_params=None, post_params=None,
|
|
282
|
+
body=None, _preload_content=True, _request_timeout=None):
|
|
283
|
+
return self.request("PUT", url,
|
|
284
|
+
headers=headers,
|
|
285
|
+
query_params=query_params,
|
|
286
|
+
post_params=post_params,
|
|
287
|
+
_preload_content=_preload_content,
|
|
288
|
+
_request_timeout=_request_timeout,
|
|
289
|
+
body=body)
|
|
290
|
+
|
|
291
|
+
def patch_request(self, url, headers=None, query_params=None, post_params=None,
|
|
292
|
+
body=None, _preload_content=True, _request_timeout=None):
|
|
293
|
+
return self.request("PATCH", url,
|
|
294
|
+
headers=headers,
|
|
295
|
+
query_params=query_params,
|
|
296
|
+
post_params=post_params,
|
|
297
|
+
_preload_content=_preload_content,
|
|
298
|
+
_request_timeout=_request_timeout,
|
|
299
|
+
body=body)
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: circle-developer-controlled-wallets
|
|
3
|
+
Version: 0.1.0b1
|
|
4
|
+
Summary: Developer-Controlled Wallets
|
|
5
|
+
Home-page:
|
|
6
|
+
Author: OpenAPI Generator community
|
|
7
|
+
Author-email: team@openapitools.org
|
|
8
|
+
Keywords: OpenAPI,OpenAPI-Generator,Developer-Controlled Wallets
|
|
9
|
+
Description-Content-Type: text/markdown
|
|
10
|
+
Requires-Dist: urllib3 <2.1.0,>=1.25.3
|
|
11
|
+
Requires-Dist: python-dateutil
|
|
12
|
+
Requires-Dist: pydantic <2,>=1.10.5
|
|
13
|
+
Requires-Dist: aenum
|
|
14
|
+
Requires-Dist: pycryptodome >=3.20.0
|
|
15
|
+
Requires-Dist: circle-configurations ==0.1.0b1
|
|
16
|
+
Requires-Dist: circle-web3-sdk-util ==0.1.0b1
|
|
17
|
+
|
|
18
|
+
# circle-developer-controlled-wallets
|
|
19
|
+
Developer-Controlled Wallets API documentation.
|
|
20
|
+
|
|
21
|
+
- API version: 1.0
|
|
22
|
+
- Package version: 0.1.0b1
|
|
23
|
+
|
|
24
|
+
## Requirements.
|
|
25
|
+
|
|
26
|
+
Python 3.7+
|
|
27
|
+
|
|
28
|
+
## Installation
|
|
29
|
+
### pip install
|
|
30
|
+
|
|
31
|
+
```sh
|
|
32
|
+
pip install circle-developer-controlled-wallets
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Then import the package:
|
|
36
|
+
```python
|
|
37
|
+
from circle.web3 import developer_controlled_wallets
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
## Usage
|
|
42
|
+
|
|
43
|
+
1. Generate an API key, if you haven't already, in the [Web3 Services Console](https://console.circle.com/). This API key will be used for authentication and authorization when making requests to Circle's APIs. API key can be set by environment variable or function parameter.
|
|
44
|
+
|
|
45
|
+
```sh
|
|
46
|
+
export CIRCLE_WEB3_API_KEY="Your API KEY"
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
2. Register an entity secret following Circle's [Developer-Controlled QuickStart](https://learn.circle.com/quickstarts/dev-controlled-wallets). This step ensures that your account is correctly set up to interact with Circle's APIs. Entity secret can be set by environment variable or function parameter
|
|
50
|
+
|
|
51
|
+
```sh
|
|
52
|
+
export CIRCLE_ENTITY_SECRET="Your entity secret"
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
3. Initiate API client
|
|
56
|
+
|
|
57
|
+
```python
|
|
58
|
+
from circle.web3 import utils
|
|
59
|
+
|
|
60
|
+
client = utils.init_developer_controlled_wallets_client(api_key="Your API KEY", entity_secret="Your entity secret")
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
4. Interact with the client:
|
|
64
|
+
|
|
65
|
+
```python
|
|
66
|
+
from circle.web3 import developer_controlled_wallets
|
|
67
|
+
|
|
68
|
+
api_instance = developer_controlled_wallets.WalletSetsApi(client)
|
|
69
|
+
|
|
70
|
+
# create wallet sets
|
|
71
|
+
try:
|
|
72
|
+
request = developer_controlled_wallets.CreateDeveloperWalletSetRequest.from_dict({
|
|
73
|
+
"name": "my_wallet_set"
|
|
74
|
+
})
|
|
75
|
+
api_instance.create_wallet_set(request)
|
|
76
|
+
except developer_controlled_wallets.ApiException as e:
|
|
77
|
+
print("Exception when calling WalletSetsApi->create_wallet_set: %s\n" % e)
|
|
78
|
+
|
|
79
|
+
# list wallet sets
|
|
80
|
+
try:
|
|
81
|
+
response = api_instance.list_wallet_sets()
|
|
82
|
+
for wallet_set in response.data.wallet_sets:
|
|
83
|
+
print(wallet_set.id)
|
|
84
|
+
except developer_controlled_wallets.ApiException as e:
|
|
85
|
+
print("Exception when calling WalletSetsApi->list_wallet_sets: %s\n" % e)
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
We recommend reading through the official [documentation](https://developers.circle.com/w3s) and [QuickStart guides](https://learn.circle.com/) mentioned above to ensure a smooth setup and usage experience.
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
## Configuration
|
|
92
|
+
|
|
93
|
+
The client accept following configuration parameters:
|
|
94
|
+
|
|
95
|
+
Option | Required | Description
|
|
96
|
+
------------ | ------------- | -------------
|
|
97
|
+
api_key | Yes | Api Key that is used to authenticate against Circle APIs. Must be provided by ether env variable or function parameter
|
|
98
|
+
entity_secret | Yes | Your configured entity secret. Must be provided by ether env variable or function parameter.
|
|
99
|
+
host | No | Optional base URL to override the default: https://api.circle.com/v1/w3s.
|
|
100
|
+
user_agent | No | Optional custom user agent request header. We will prepend it to default user agent header if provided.
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
## Need help or have questions?
|
|
104
|
+
|
|
105
|
+
Here are some helpful links, if you encounter any issues or have questions about this SDK:
|
|
106
|
+
|
|
107
|
+
- 📖 [Getting started](https://learn.circle.com/quickstarts/developer-controlled-wallets): Check out our official Developer-Controlled Wallets QuickStart.
|
|
108
|
+
- 🎮 [Join our Discord Community](https://discord.com/invite/buildoncircle): Engage, learn, and collaborate.
|
|
109
|
+
- 🛎 [Visit our Help-Desk Page](https://support.usdc.circle.com/hc/en-us/p/contactus?_gl=1*1va6vat*_ga*MTAyNTA0NTQ2NC4xNjk5NTYyMjgx*_ga_GJDVPCQNRV*MTcwMDQ5Mzg3Ny4xNC4xLjE3MDA0OTM4ODQuNTMuMC4w): Dive into curated FAQs and guides.
|
|
110
|
+
- 📧 [Direct Email](mailto:customer-support@circle.com): We're always a message away.
|
|
111
|
+
- 📖 [Read docs](https://developers.circle.com/w3s/docs?_gl=1*15ozb5b*_ga*MTAyNTA0NTQ2NC4xNjk5NTYyMjgx*_ga_GJDVPCQNRV*MTcwMDQ5Mzg3Ny4xNC4xLjE3MDA0OTM4ODQuNTMuMC4w): Check out our developer documentation.
|
|
112
|
+
Happy coding!
|