dfns-sdk 0.0.0.dev0__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.
- dfns_sdk/__init__.py +24 -0
- dfns_sdk/_internal/__init__.py +5 -0
- dfns_sdk/_internal/http_client.py +395 -0
- dfns_sdk/auth.py +137 -0
- dfns_sdk/base_auth_api.py +129 -0
- dfns_sdk/client.py +81 -0
- dfns_sdk/delegated_client.py +97 -0
- dfns_sdk/generated/__init__.py +47 -0
- dfns_sdk/generated/agreements/__init__.py +7 -0
- dfns_sdk/generated/agreements/client.py +55 -0
- dfns_sdk/generated/agreements/delegated_client.py +95 -0
- dfns_sdk/generated/agreements/types.py +20 -0
- dfns_sdk/generated/allocations/__init__.py +7 -0
- dfns_sdk/generated/allocations/client.py +118 -0
- dfns_sdk/generated/allocations/delegated_client.py +187 -0
- dfns_sdk/generated/allocations/types.py +69 -0
- dfns_sdk/generated/auth/__init__.py +7 -0
- dfns_sdk/generated/auth/client.py +1215 -0
- dfns_sdk/generated/auth/delegated_client.py +1825 -0
- dfns_sdk/generated/auth/types.py +702 -0
- dfns_sdk/generated/exchanges/__init__.py +7 -0
- dfns_sdk/generated/exchanges/client.py +209 -0
- dfns_sdk/generated/exchanges/delegated_client.py +341 -0
- dfns_sdk/generated/exchanges/types.py +96 -0
- dfns_sdk/generated/fee_sponsors/__init__.py +7 -0
- dfns_sdk/generated/fee_sponsors/client.py +161 -0
- dfns_sdk/generated/fee_sponsors/delegated_client.py +287 -0
- dfns_sdk/generated/fee_sponsors/types.py +89 -0
- dfns_sdk/generated/keys/__init__.py +7 -0
- dfns_sdk/generated/keys/client.py +310 -0
- dfns_sdk/generated/keys/delegated_client.py +518 -0
- dfns_sdk/generated/keys/types.py +229 -0
- dfns_sdk/generated/networks/__init__.py +7 -0
- dfns_sdk/generated/networks/client.py +176 -0
- dfns_sdk/generated/networks/delegated_client.py +274 -0
- dfns_sdk/generated/networks/types.py +77 -0
- dfns_sdk/generated/permissions/__init__.py +7 -0
- dfns_sdk/generated/permissions/client.py +185 -0
- dfns_sdk/generated/permissions/delegated_client.py +344 -0
- dfns_sdk/generated/permissions/types.py +107 -0
- dfns_sdk/generated/policies/__init__.py +7 -0
- dfns_sdk/generated/policies/client.py +187 -0
- dfns_sdk/generated/policies/delegated_client.py +311 -0
- dfns_sdk/generated/policies/types.py +70 -0
- dfns_sdk/generated/signers/__init__.py +7 -0
- dfns_sdk/generated/signers/client.py +45 -0
- dfns_sdk/generated/signers/delegated_client.py +56 -0
- dfns_sdk/generated/signers/types.py +13 -0
- dfns_sdk/generated/staking/__init__.py +7 -0
- dfns_sdk/generated/staking/client.py +142 -0
- dfns_sdk/generated/staking/delegated_client.py +211 -0
- dfns_sdk/generated/staking/types.py +64 -0
- dfns_sdk/generated/swaps/__init__.py +7 -0
- dfns_sdk/generated/swaps/client.py +118 -0
- dfns_sdk/generated/swaps/delegated_client.py +157 -0
- dfns_sdk/generated/swaps/types.py +99 -0
- dfns_sdk/generated/wallets/__init__.py +7 -0
- dfns_sdk/generated/wallets/client.py +805 -0
- dfns_sdk/generated/wallets/delegated_client.py +1231 -0
- dfns_sdk/generated/wallets/types.py +534 -0
- dfns_sdk/generated/webhooks/__init__.py +7 -0
- dfns_sdk/generated/webhooks/client.py +193 -0
- dfns_sdk/generated/webhooks/delegated_client.py +320 -0
- dfns_sdk/generated/webhooks/types.py +101 -0
- dfns_sdk/types.py +72 -0
- dfns_sdk-0.0.0.dev0.dist-info/METADATA +191 -0
- dfns_sdk-0.0.0.dev0.dist-info/RECORD +69 -0
- dfns_sdk-0.0.0.dev0.dist-info/WHEEL +4 -0
- dfns_sdk-0.0.0.dev0.dist-info/licenses/LICENSE +21 -0
dfns_sdk/client.py
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"""Main Dfns client."""
|
|
2
|
+
|
|
3
|
+
from .types import DfnsClientConfig
|
|
4
|
+
from ._internal import HttpClient
|
|
5
|
+
from .generated.auth import AuthClient
|
|
6
|
+
from .generated.exchanges import ExchangesClient
|
|
7
|
+
from .generated.fee_sponsors import FeeSponsorsClient
|
|
8
|
+
from .generated.keys import KeysClient
|
|
9
|
+
from .generated.networks import NetworksClient
|
|
10
|
+
from .generated.permissions import PermissionsClient
|
|
11
|
+
from .generated.policies import PoliciesClient
|
|
12
|
+
from .generated.signers import SignersClient
|
|
13
|
+
from .generated.staking import StakingClient
|
|
14
|
+
from .generated.wallets import WalletsClient
|
|
15
|
+
from .generated.webhooks import WebhooksClient
|
|
16
|
+
from .generated.swaps import SwapsClient
|
|
17
|
+
from .generated.agreements import AgreementsClient
|
|
18
|
+
from .generated.allocations import AllocationsClient
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class DfnsClient:
|
|
22
|
+
"""
|
|
23
|
+
Main client for the Dfns API.
|
|
24
|
+
|
|
25
|
+
This client provides access to all Dfns API domains through typed sub-clients.
|
|
26
|
+
|
|
27
|
+
Example:
|
|
28
|
+
>>> from dfns_sdk import DfnsClient, DfnsClientConfig
|
|
29
|
+
>>> config = DfnsClientConfig(auth_token="your-token")
|
|
30
|
+
>>> client = DfnsClient(config)
|
|
31
|
+
>>> wallets = client.wallets.list_wallets()
|
|
32
|
+
"""
|
|
33
|
+
|
|
34
|
+
auth: AuthClient
|
|
35
|
+
exchanges: ExchangesClient
|
|
36
|
+
fee_sponsors: FeeSponsorsClient
|
|
37
|
+
keys: KeysClient
|
|
38
|
+
networks: NetworksClient
|
|
39
|
+
permissions: PermissionsClient
|
|
40
|
+
policies: PoliciesClient
|
|
41
|
+
signers: SignersClient
|
|
42
|
+
staking: StakingClient
|
|
43
|
+
wallets: WalletsClient
|
|
44
|
+
webhooks: WebhooksClient
|
|
45
|
+
swaps: SwapsClient
|
|
46
|
+
agreements: AgreementsClient
|
|
47
|
+
allocations: AllocationsClient
|
|
48
|
+
|
|
49
|
+
def __init__(self, config: DfnsClientConfig):
|
|
50
|
+
"""
|
|
51
|
+
Initialize the Dfns client.
|
|
52
|
+
|
|
53
|
+
Args:
|
|
54
|
+
config: Client configuration.
|
|
55
|
+
"""
|
|
56
|
+
self._config = config
|
|
57
|
+
self._http = HttpClient(config)
|
|
58
|
+
self.auth = AuthClient(self._http)
|
|
59
|
+
self.exchanges = ExchangesClient(self._http)
|
|
60
|
+
self.fee_sponsors = FeeSponsorsClient(self._http)
|
|
61
|
+
self.keys = KeysClient(self._http)
|
|
62
|
+
self.networks = NetworksClient(self._http)
|
|
63
|
+
self.permissions = PermissionsClient(self._http)
|
|
64
|
+
self.policies = PoliciesClient(self._http)
|
|
65
|
+
self.signers = SignersClient(self._http)
|
|
66
|
+
self.staking = StakingClient(self._http)
|
|
67
|
+
self.wallets = WalletsClient(self._http)
|
|
68
|
+
self.webhooks = WebhooksClient(self._http)
|
|
69
|
+
self.swaps = SwapsClient(self._http)
|
|
70
|
+
self.agreements = AgreementsClient(self._http)
|
|
71
|
+
self.allocations = AllocationsClient(self._http)
|
|
72
|
+
|
|
73
|
+
def close(self) -> None:
|
|
74
|
+
"""Close the client and release resources."""
|
|
75
|
+
self._http.close()
|
|
76
|
+
|
|
77
|
+
def __enter__(self) -> "DfnsClient":
|
|
78
|
+
return self
|
|
79
|
+
|
|
80
|
+
def __exit__(self, *args) -> None:
|
|
81
|
+
self.close()
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"""Delegated Dfns client for external signing orchestration."""
|
|
2
|
+
|
|
3
|
+
from .types import DfnsDelegatedClientConfig
|
|
4
|
+
from ._internal import HttpClient
|
|
5
|
+
from .generated.auth import DelegatedAuthClient
|
|
6
|
+
from .generated.exchanges import DelegatedExchangesClient
|
|
7
|
+
from .generated.fee_sponsors import DelegatedFeeSponsorsClient
|
|
8
|
+
from .generated.keys import DelegatedKeysClient
|
|
9
|
+
from .generated.networks import DelegatedNetworksClient
|
|
10
|
+
from .generated.permissions import DelegatedPermissionsClient
|
|
11
|
+
from .generated.policies import DelegatedPoliciesClient
|
|
12
|
+
from .generated.signers import DelegatedSignersClient
|
|
13
|
+
from .generated.staking import DelegatedStakingClient
|
|
14
|
+
from .generated.wallets import DelegatedWalletsClient
|
|
15
|
+
from .generated.webhooks import DelegatedWebhooksClient
|
|
16
|
+
from .generated.swaps import DelegatedSwapsClient
|
|
17
|
+
from .generated.agreements import DelegatedAgreementsClient
|
|
18
|
+
from .generated.allocations import DelegatedAllocationsClient
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class DfnsDelegatedClient:
|
|
22
|
+
"""
|
|
23
|
+
Delegated client for the Dfns API.
|
|
24
|
+
|
|
25
|
+
This client is designed for service accounts that orchestrate signing externally.
|
|
26
|
+
Operations requiring user action signing are split into *_init() and *_complete()
|
|
27
|
+
method pairs, allowing external systems to handle the signing process.
|
|
28
|
+
|
|
29
|
+
Example:
|
|
30
|
+
>>> from dfns_sdk import DfnsDelegatedClient, DfnsDelegatedClientConfig
|
|
31
|
+
>>> config = DfnsDelegatedClientConfig(auth_token="service-account-token")
|
|
32
|
+
>>> client = DfnsDelegatedClient(config)
|
|
33
|
+
>>>
|
|
34
|
+
>>> # Step 1: Initialize action (get challenge)
|
|
35
|
+
>>> challenge = client.wallets.create_wallet_init(body={"network": "EthereumSepolia"})
|
|
36
|
+
>>>
|
|
37
|
+
>>> # Step 2: Sign externally (your signing system)
|
|
38
|
+
>>> signed = your_external_signer.sign(challenge)
|
|
39
|
+
>>>
|
|
40
|
+
>>> # Step 3: Complete action with signed challenge
|
|
41
|
+
>>> wallet = client.wallets.create_wallet_complete(
|
|
42
|
+
... body={"network": "EthereumSepolia"},
|
|
43
|
+
... signed_challenge={
|
|
44
|
+
... "challengeIdentifier": challenge["challengeIdentifier"],
|
|
45
|
+
... "firstFactor": signed,
|
|
46
|
+
... },
|
|
47
|
+
... )
|
|
48
|
+
"""
|
|
49
|
+
|
|
50
|
+
auth: DelegatedAuthClient
|
|
51
|
+
exchanges: DelegatedExchangesClient
|
|
52
|
+
fee_sponsors: DelegatedFeeSponsorsClient
|
|
53
|
+
keys: DelegatedKeysClient
|
|
54
|
+
networks: DelegatedNetworksClient
|
|
55
|
+
permissions: DelegatedPermissionsClient
|
|
56
|
+
policies: DelegatedPoliciesClient
|
|
57
|
+
signers: DelegatedSignersClient
|
|
58
|
+
staking: DelegatedStakingClient
|
|
59
|
+
wallets: DelegatedWalletsClient
|
|
60
|
+
webhooks: DelegatedWebhooksClient
|
|
61
|
+
swaps: DelegatedSwapsClient
|
|
62
|
+
agreements: DelegatedAgreementsClient
|
|
63
|
+
allocations: DelegatedAllocationsClient
|
|
64
|
+
|
|
65
|
+
def __init__(self, config: DfnsDelegatedClientConfig):
|
|
66
|
+
"""
|
|
67
|
+
Initialize the delegated Dfns client.
|
|
68
|
+
|
|
69
|
+
Args:
|
|
70
|
+
config: Client configuration (no signer required).
|
|
71
|
+
"""
|
|
72
|
+
self._config = config
|
|
73
|
+
self._http = HttpClient(config)
|
|
74
|
+
self.auth = DelegatedAuthClient(self._http)
|
|
75
|
+
self.exchanges = DelegatedExchangesClient(self._http)
|
|
76
|
+
self.fee_sponsors = DelegatedFeeSponsorsClient(self._http)
|
|
77
|
+
self.keys = DelegatedKeysClient(self._http)
|
|
78
|
+
self.networks = DelegatedNetworksClient(self._http)
|
|
79
|
+
self.permissions = DelegatedPermissionsClient(self._http)
|
|
80
|
+
self.policies = DelegatedPoliciesClient(self._http)
|
|
81
|
+
self.signers = DelegatedSignersClient(self._http)
|
|
82
|
+
self.staking = DelegatedStakingClient(self._http)
|
|
83
|
+
self.wallets = DelegatedWalletsClient(self._http)
|
|
84
|
+
self.webhooks = DelegatedWebhooksClient(self._http)
|
|
85
|
+
self.swaps = DelegatedSwapsClient(self._http)
|
|
86
|
+
self.agreements = DelegatedAgreementsClient(self._http)
|
|
87
|
+
self.allocations = DelegatedAllocationsClient(self._http)
|
|
88
|
+
|
|
89
|
+
def close(self) -> None:
|
|
90
|
+
"""Close the client and release resources."""
|
|
91
|
+
self._http.close()
|
|
92
|
+
|
|
93
|
+
def __enter__(self) -> "DfnsDelegatedClient":
|
|
94
|
+
return self
|
|
95
|
+
|
|
96
|
+
def __exit__(self, *args) -> None:
|
|
97
|
+
self.close()
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"""Generated domain clients."""
|
|
2
|
+
|
|
3
|
+
from .auth import AuthClient, DelegatedAuthClient
|
|
4
|
+
from .exchanges import ExchangesClient, DelegatedExchangesClient
|
|
5
|
+
from .fee_sponsors import FeeSponsorsClient, DelegatedFeeSponsorsClient
|
|
6
|
+
from .keys import KeysClient, DelegatedKeysClient
|
|
7
|
+
from .networks import NetworksClient, DelegatedNetworksClient
|
|
8
|
+
from .permissions import PermissionsClient, DelegatedPermissionsClient
|
|
9
|
+
from .policies import PoliciesClient, DelegatedPoliciesClient
|
|
10
|
+
from .signers import SignersClient, DelegatedSignersClient
|
|
11
|
+
from .staking import StakingClient, DelegatedStakingClient
|
|
12
|
+
from .wallets import WalletsClient, DelegatedWalletsClient
|
|
13
|
+
from .webhooks import WebhooksClient, DelegatedWebhooksClient
|
|
14
|
+
from .swaps import SwapsClient, DelegatedSwapsClient
|
|
15
|
+
from .agreements import AgreementsClient, DelegatedAgreementsClient
|
|
16
|
+
from .allocations import AllocationsClient, DelegatedAllocationsClient
|
|
17
|
+
|
|
18
|
+
__all__ = [
|
|
19
|
+
"AuthClient",
|
|
20
|
+
"DelegatedAuthClient",
|
|
21
|
+
"ExchangesClient",
|
|
22
|
+
"DelegatedExchangesClient",
|
|
23
|
+
"FeeSponsorsClient",
|
|
24
|
+
"DelegatedFeeSponsorsClient",
|
|
25
|
+
"KeysClient",
|
|
26
|
+
"DelegatedKeysClient",
|
|
27
|
+
"NetworksClient",
|
|
28
|
+
"DelegatedNetworksClient",
|
|
29
|
+
"PermissionsClient",
|
|
30
|
+
"DelegatedPermissionsClient",
|
|
31
|
+
"PoliciesClient",
|
|
32
|
+
"DelegatedPoliciesClient",
|
|
33
|
+
"SignersClient",
|
|
34
|
+
"DelegatedSignersClient",
|
|
35
|
+
"StakingClient",
|
|
36
|
+
"DelegatedStakingClient",
|
|
37
|
+
"WalletsClient",
|
|
38
|
+
"DelegatedWalletsClient",
|
|
39
|
+
"WebhooksClient",
|
|
40
|
+
"DelegatedWebhooksClient",
|
|
41
|
+
"SwapsClient",
|
|
42
|
+
"DelegatedSwapsClient",
|
|
43
|
+
"AgreementsClient",
|
|
44
|
+
"DelegatedAgreementsClient",
|
|
45
|
+
"AllocationsClient",
|
|
46
|
+
"DelegatedAllocationsClient",
|
|
47
|
+
]
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"""Client for the agreements domain."""
|
|
2
|
+
|
|
3
|
+
from typing import Any, Literal, Optional, TypedDict, Union
|
|
4
|
+
|
|
5
|
+
from ..._internal import HttpClient
|
|
6
|
+
from . import types as T
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class AgreementsClient:
|
|
10
|
+
"""Client for agreements operations."""
|
|
11
|
+
|
|
12
|
+
def __init__(self, http_client: HttpClient):
|
|
13
|
+
self._http = http_client
|
|
14
|
+
|
|
15
|
+
def get_latest_unaccepted_agreement(self, query: T.GetLatestUnacceptedAgreementQuery) -> T.GetLatestUnacceptedAgreementResponse:
|
|
16
|
+
"""
|
|
17
|
+
Get Latest Unaccepted Agreement.
|
|
18
|
+
|
|
19
|
+
Get the latest unaccepted agreement for a specific agreement type
|
|
20
|
+
|
|
21
|
+
Args:
|
|
22
|
+
query: Query parameters.
|
|
23
|
+
|
|
24
|
+
Returns:
|
|
25
|
+
T.GetLatestUnacceptedAgreementResponse: The API response.
|
|
26
|
+
"""
|
|
27
|
+
return self._http.request(
|
|
28
|
+
method="GET",
|
|
29
|
+
path="/agreements/latest-unaccepted",
|
|
30
|
+
path_params={},
|
|
31
|
+
query_params=query,
|
|
32
|
+
body=None,
|
|
33
|
+
requires_signature=False,
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
def record_agreement_acceptance(self, agreement_id: str) -> T.RecordAgreementAcceptanceResponse:
|
|
37
|
+
"""
|
|
38
|
+
Record Agreement Acceptance.
|
|
39
|
+
|
|
40
|
+
Record the acceptance of a specific agreement by its ID
|
|
41
|
+
|
|
42
|
+
Args:
|
|
43
|
+
agreement_id: Path parameter.
|
|
44
|
+
|
|
45
|
+
Returns:
|
|
46
|
+
T.RecordAgreementAcceptanceResponse: The API response.
|
|
47
|
+
"""
|
|
48
|
+
return self._http.request(
|
|
49
|
+
method="POST",
|
|
50
|
+
path="/agreements/{agreementId}/accept",
|
|
51
|
+
path_params={"agreementId": agreement_id},
|
|
52
|
+
query_params=None,
|
|
53
|
+
body=None,
|
|
54
|
+
requires_signature=True,
|
|
55
|
+
)
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"""Delegated client for the agreements domain."""
|
|
2
|
+
|
|
3
|
+
import json
|
|
4
|
+
from typing import Any, Literal, Optional, TypedDict, Union
|
|
5
|
+
|
|
6
|
+
from ..._internal import HttpClient
|
|
7
|
+
from ...base_auth_api import (
|
|
8
|
+
BaseAuthApi,
|
|
9
|
+
SignUserActionChallengeRequest,
|
|
10
|
+
UserActionChallengeResponse,
|
|
11
|
+
)
|
|
12
|
+
from . import types as T
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class DelegatedAgreementsClient:
|
|
16
|
+
"""
|
|
17
|
+
Delegated client for agreements operations.
|
|
18
|
+
|
|
19
|
+
This client separates user action signing into _init() and _complete() method pairs,
|
|
20
|
+
allowing external systems to handle the signing process.
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
def __init__(self, http_client: HttpClient):
|
|
24
|
+
self._http = http_client
|
|
25
|
+
|
|
26
|
+
def get_latest_unaccepted_agreement(self, query: T.GetLatestUnacceptedAgreementQuery) -> T.GetLatestUnacceptedAgreementResponse:
|
|
27
|
+
"""
|
|
28
|
+
Get Latest Unaccepted Agreement.
|
|
29
|
+
|
|
30
|
+
Get the latest unaccepted agreement for a specific agreement type
|
|
31
|
+
|
|
32
|
+
Args:
|
|
33
|
+
query: Query parameters.
|
|
34
|
+
|
|
35
|
+
Returns:
|
|
36
|
+
T.GetLatestUnacceptedAgreementResponse: The API response.
|
|
37
|
+
"""
|
|
38
|
+
return self._http.request(
|
|
39
|
+
method="GET",
|
|
40
|
+
path="/agreements/latest-unaccepted",
|
|
41
|
+
path_params={},
|
|
42
|
+
query_params=query,
|
|
43
|
+
body=None,
|
|
44
|
+
requires_signature=False,
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
def record_agreement_acceptance_init(self, agreement_id: str) -> UserActionChallengeResponse:
|
|
48
|
+
"""
|
|
49
|
+
Initialize Record Agreement Acceptance.
|
|
50
|
+
|
|
51
|
+
Creates a user action challenge for external signing.
|
|
52
|
+
|
|
53
|
+
Args:
|
|
54
|
+
agreement_id: Path parameter.
|
|
55
|
+
|
|
56
|
+
Returns:
|
|
57
|
+
UserActionChallengeResponse: The challenge to sign externally.
|
|
58
|
+
"""
|
|
59
|
+
path = "/agreements/{agreementId}/accept"
|
|
60
|
+
path = path.replace("{agreementId}", str(agreement_id))
|
|
61
|
+
payload = ""
|
|
62
|
+
|
|
63
|
+
return BaseAuthApi.create_user_action_challenge(
|
|
64
|
+
self._http,
|
|
65
|
+
user_action_http_method="POST",
|
|
66
|
+
user_action_http_path=path,
|
|
67
|
+
user_action_payload=payload,
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
def record_agreement_acceptance_complete(self, agreement_id: str, signed_challenge: SignUserActionChallengeRequest) -> T.RecordAgreementAcceptanceResponse:
|
|
71
|
+
"""
|
|
72
|
+
Complete Record Agreement Acceptance.
|
|
73
|
+
|
|
74
|
+
Submits the signed challenge and makes the API request.
|
|
75
|
+
|
|
76
|
+
Args:
|
|
77
|
+
agreement_id: Path parameter.
|
|
78
|
+
signed_challenge: The signed challenge from external signing.
|
|
79
|
+
|
|
80
|
+
Returns:
|
|
81
|
+
T.RecordAgreementAcceptanceResponse: The API response.
|
|
82
|
+
"""
|
|
83
|
+
user_action_result = BaseAuthApi.sign_user_action_challenge(
|
|
84
|
+
self._http, signed_challenge
|
|
85
|
+
)
|
|
86
|
+
user_action_token = user_action_result["userAction"]
|
|
87
|
+
|
|
88
|
+
return self._http.request_with_user_action(
|
|
89
|
+
method="POST",
|
|
90
|
+
path="/agreements/{agreementId}/accept",
|
|
91
|
+
path_params={"agreementId": agreement_id},
|
|
92
|
+
query_params=None,
|
|
93
|
+
body=None,
|
|
94
|
+
user_action=user_action_token,
|
|
95
|
+
)
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"""Types for the agreements domain."""
|
|
2
|
+
|
|
3
|
+
from typing import Any, Literal, NotRequired, Optional, TypedDict, Union
|
|
4
|
+
|
|
5
|
+
class GetLatestUnacceptedAgreementResponse(TypedDict, total=False):
|
|
6
|
+
"""getLatestUnacceptedAgreement response."""
|
|
7
|
+
|
|
8
|
+
latest_agreement: Any
|
|
9
|
+
|
|
10
|
+
class GetLatestUnacceptedAgreementQuery(TypedDict, total=False):
|
|
11
|
+
"""getLatestUnacceptedAgreement query parameters."""
|
|
12
|
+
|
|
13
|
+
agreement_type: Literal["PrivacyPolicy", "TermsAndConditions", "UniswapTermsOfService", "UniswapPrivacyPolicy"]
|
|
14
|
+
|
|
15
|
+
class RecordAgreementAcceptanceResponse(TypedDict, total=False):
|
|
16
|
+
"""recordAgreementAcceptance response."""
|
|
17
|
+
|
|
18
|
+
agreement_id: str
|
|
19
|
+
user_id: str
|
|
20
|
+
date_accepted: str
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"""Client for the allocations domain."""
|
|
2
|
+
|
|
3
|
+
from typing import Any, Literal, Optional, TypedDict, Union
|
|
4
|
+
|
|
5
|
+
from ..._internal import HttpClient
|
|
6
|
+
from . import types as T
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class AllocationsClient:
|
|
10
|
+
"""Client for allocations operations."""
|
|
11
|
+
|
|
12
|
+
def __init__(self, http_client: HttpClient):
|
|
13
|
+
self._http = http_client
|
|
14
|
+
|
|
15
|
+
def list_allocations(self, query: Optional[T.ListAllocationsQuery] = None) -> T.ListAllocationsResponse:
|
|
16
|
+
"""
|
|
17
|
+
List Allocations.
|
|
18
|
+
|
|
19
|
+
Args:
|
|
20
|
+
query: Query parameters.
|
|
21
|
+
|
|
22
|
+
Returns:
|
|
23
|
+
T.ListAllocationsResponse: The API response.
|
|
24
|
+
"""
|
|
25
|
+
return self._http.request(
|
|
26
|
+
method="GET",
|
|
27
|
+
path="/allocations",
|
|
28
|
+
path_params={},
|
|
29
|
+
query_params=query,
|
|
30
|
+
body=None,
|
|
31
|
+
requires_signature=False,
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
def create_allocation(self, body: dict[str, Any]) -> T.CreateAllocationResponse:
|
|
35
|
+
"""
|
|
36
|
+
Create Allocation.
|
|
37
|
+
|
|
38
|
+
Create a new allocation.
|
|
39
|
+
|
|
40
|
+
Args:
|
|
41
|
+
body: Request body.
|
|
42
|
+
|
|
43
|
+
Returns:
|
|
44
|
+
T.CreateAllocationResponse: The API response.
|
|
45
|
+
"""
|
|
46
|
+
return self._http.request(
|
|
47
|
+
method="POST",
|
|
48
|
+
path="/allocations",
|
|
49
|
+
path_params={},
|
|
50
|
+
query_params=None,
|
|
51
|
+
body=body,
|
|
52
|
+
requires_signature=True,
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
def list_allocation_actions(self, allocation_id: str, query: Optional[T.ListAllocationActionsQuery] = None) -> T.ListAllocationActionsResponse:
|
|
56
|
+
"""
|
|
57
|
+
List Allocation Actions.
|
|
58
|
+
|
|
59
|
+
Retrieve the list of actions for a specific allocation.
|
|
60
|
+
|
|
61
|
+
Args:
|
|
62
|
+
allocation_id: Unique identifier for the allocation investment.
|
|
63
|
+
query: Query parameters.
|
|
64
|
+
|
|
65
|
+
Returns:
|
|
66
|
+
T.ListAllocationActionsResponse: The API response.
|
|
67
|
+
"""
|
|
68
|
+
return self._http.request(
|
|
69
|
+
method="GET",
|
|
70
|
+
path="/allocations/{allocationId}/actions",
|
|
71
|
+
path_params={"allocationId": allocation_id},
|
|
72
|
+
query_params=query,
|
|
73
|
+
body=None,
|
|
74
|
+
requires_signature=False,
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
def create_allocation_action(self, allocation_id: str, body: T.CreateAllocationActionRequest) -> T.CreateAllocationActionResponse:
|
|
78
|
+
"""
|
|
79
|
+
Create Allocation Action.
|
|
80
|
+
|
|
81
|
+
Create a new action for an existing allocation.
|
|
82
|
+
|
|
83
|
+
Args:
|
|
84
|
+
allocation_id: Unique identifier for the allocation investment.
|
|
85
|
+
body: Request body.
|
|
86
|
+
|
|
87
|
+
Returns:
|
|
88
|
+
T.CreateAllocationActionResponse: The API response.
|
|
89
|
+
"""
|
|
90
|
+
return self._http.request(
|
|
91
|
+
method="POST",
|
|
92
|
+
path="/allocations/{allocationId}/actions",
|
|
93
|
+
path_params={"allocationId": allocation_id},
|
|
94
|
+
query_params=None,
|
|
95
|
+
body=body,
|
|
96
|
+
requires_signature=True,
|
|
97
|
+
)
|
|
98
|
+
|
|
99
|
+
def get_allocation(self, allocation_id: str) -> T.GetAllocationResponse:
|
|
100
|
+
"""
|
|
101
|
+
Get Allocation.
|
|
102
|
+
|
|
103
|
+
Retrieve the details of a specific allocation.
|
|
104
|
+
|
|
105
|
+
Args:
|
|
106
|
+
allocation_id: Unique identifier for the allocation investment.
|
|
107
|
+
|
|
108
|
+
Returns:
|
|
109
|
+
T.GetAllocationResponse: The API response.
|
|
110
|
+
"""
|
|
111
|
+
return self._http.request(
|
|
112
|
+
method="GET",
|
|
113
|
+
path="/allocations/{allocationId}",
|
|
114
|
+
path_params={"allocationId": allocation_id},
|
|
115
|
+
query_params=None,
|
|
116
|
+
body=None,
|
|
117
|
+
requires_signature=False,
|
|
118
|
+
)
|