algokit-utils 2.2.2b5__py3-none-any.whl → 2.3.0__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 algokit-utils might be problematic. Click here for more details.
- algokit_utils/_transfer.py +11 -6
- algokit_utils/application_client.py +11 -18
- algokit_utils/beta/account_manager.py +200 -0
- algokit_utils/beta/algorand_client.py +319 -0
- algokit_utils/beta/client_manager.py +78 -0
- algokit_utils/beta/composer.py +716 -0
- algokit_utils/deploy.py +6 -20
- algokit_utils/models.py +5 -107
- algokit_utils/network_clients.py +17 -0
- {algokit_utils-2.2.2b5.dist-info → algokit_utils-2.3.0.dist-info}/METADATA +1 -1
- algokit_utils-2.3.0.dist-info/RECORD +24 -0
- algokit_utils-2.2.2b5.dist-info/RECORD +0 -20
- {algokit_utils-2.2.2b5.dist-info → algokit_utils-2.3.0.dist-info}/LICENSE +0 -0
- {algokit_utils-2.2.2b5.dist-info → algokit_utils-2.3.0.dist-info}/WHEEL +0 -0
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import algosdk
|
|
2
|
+
from algokit_utils.dispenser_api import TestNetDispenserApiClient
|
|
3
|
+
from algokit_utils.network_clients import AlgoClientConfigs, get_algod_client, get_indexer_client, get_kmd_client
|
|
4
|
+
from algosdk.kmd import KMDClient
|
|
5
|
+
from algosdk.v2client.algod import AlgodClient
|
|
6
|
+
from algosdk.v2client.indexer import IndexerClient
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class AlgoSdkClients:
|
|
10
|
+
"""
|
|
11
|
+
Clients from algosdk that interact with the official Algorand APIs.
|
|
12
|
+
|
|
13
|
+
Attributes:
|
|
14
|
+
algod (AlgodClient): Algod client, see https://developer.algorand.org/docs/rest-apis/algod/
|
|
15
|
+
indexer (Optional[IndexerClient]): Optional indexer client, see https://developer.algorand.org/docs/rest-apis/indexer/
|
|
16
|
+
kmd (Optional[KMDClient]): Optional KMD client, see https://developer.algorand.org/docs/rest-apis/kmd/
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
def __init__(
|
|
20
|
+
self,
|
|
21
|
+
algod: algosdk.v2client.algod.AlgodClient,
|
|
22
|
+
indexer: IndexerClient | None = None,
|
|
23
|
+
kmd: KMDClient | None = None,
|
|
24
|
+
):
|
|
25
|
+
self.algod = algod
|
|
26
|
+
self.indexer = indexer
|
|
27
|
+
self.kmd = kmd
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class ClientManager:
|
|
31
|
+
"""
|
|
32
|
+
Exposes access to various API clients.
|
|
33
|
+
|
|
34
|
+
Args:
|
|
35
|
+
clients_or_config (Union[AlgoConfig, AlgoSdkClients]): algosdk clients or config for interacting with the official Algorand APIs.
|
|
36
|
+
"""
|
|
37
|
+
|
|
38
|
+
def __init__(self, clients_or_configs: AlgoClientConfigs | AlgoSdkClients):
|
|
39
|
+
if isinstance(clients_or_configs, AlgoSdkClients):
|
|
40
|
+
_clients = clients_or_configs
|
|
41
|
+
elif isinstance(clients_or_configs, AlgoClientConfigs):
|
|
42
|
+
_clients = AlgoSdkClients(
|
|
43
|
+
algod=get_algod_client(clients_or_configs.algod_config),
|
|
44
|
+
indexer=get_indexer_client(clients_or_configs.indexer_config)
|
|
45
|
+
if clients_or_configs.indexer_config
|
|
46
|
+
else None,
|
|
47
|
+
kmd=get_kmd_client(clients_or_configs.kmd_config) if clients_or_configs.kmd_config else None,
|
|
48
|
+
)
|
|
49
|
+
self._algod = _clients.algod
|
|
50
|
+
self._indexer = _clients.indexer
|
|
51
|
+
self._kmd = _clients.kmd
|
|
52
|
+
|
|
53
|
+
@property
|
|
54
|
+
def algod(self) -> AlgodClient:
|
|
55
|
+
"""Returns an algosdk Algod API client."""
|
|
56
|
+
return self._algod
|
|
57
|
+
|
|
58
|
+
@property
|
|
59
|
+
def indexer(self) -> IndexerClient:
|
|
60
|
+
"""Returns an algosdk Indexer API client or raises an error if it's not been provided."""
|
|
61
|
+
if not self._indexer:
|
|
62
|
+
raise ValueError("Attempt to use Indexer client in AlgoKit instance with no Indexer configured")
|
|
63
|
+
return self._indexer
|
|
64
|
+
|
|
65
|
+
@property
|
|
66
|
+
def kmd(self) -> KMDClient:
|
|
67
|
+
"""Returns an algosdk KMD API client or raises an error if it's not been provided."""
|
|
68
|
+
if not self._kmd:
|
|
69
|
+
raise ValueError("Attempt to use Kmd client in AlgoKit instance with no Kmd configured")
|
|
70
|
+
return self._kmd
|
|
71
|
+
|
|
72
|
+
def get_testnet_dispenser(
|
|
73
|
+
self, auth_token: str | None = None, request_timeout: int | None = None
|
|
74
|
+
) -> TestNetDispenserApiClient:
|
|
75
|
+
if request_timeout:
|
|
76
|
+
return TestNetDispenserApiClient(auth_token=auth_token, request_timeout=request_timeout)
|
|
77
|
+
|
|
78
|
+
return TestNetDispenserApiClient(auth_token=auth_token)
|