openclaw-algorand-plugin 0.5.0
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.
- package/LICENSE +21 -0
- package/README.md +112 -0
- package/index.ts +361 -0
- package/lib/mcp-servers.ts +14 -0
- package/lib/x402-fetch.ts +213 -0
- package/memory/algorand-plugin.md +82 -0
- package/openclaw.plugin.json +30 -0
- package/package.json +38 -0
- package/setup.ts +80 -0
- package/skills/algorand-development/SKILL.md +90 -0
- package/skills/algorand-development/references/build-smart-contracts-reference.md +79 -0
- package/skills/algorand-development/references/build-smart-contracts.md +52 -0
- package/skills/algorand-development/references/create-project-reference.md +86 -0
- package/skills/algorand-development/references/create-project.md +89 -0
- package/skills/algorand-development/references/implement-arc-standards-arc32-arc56.md +396 -0
- package/skills/algorand-development/references/implement-arc-standards-arc4.md +265 -0
- package/skills/algorand-development/references/implement-arc-standards.md +92 -0
- package/skills/algorand-development/references/search-algorand-examples-reference.md +119 -0
- package/skills/algorand-development/references/search-algorand-examples.md +89 -0
- package/skills/algorand-development/references/troubleshoot-errors-contract.md +373 -0
- package/skills/algorand-development/references/troubleshoot-errors-transaction.md +599 -0
- package/skills/algorand-development/references/troubleshoot-errors.md +105 -0
- package/skills/algorand-development/references/use-algokit-cli-reference.md +228 -0
- package/skills/algorand-development/references/use-algokit-cli.md +64 -0
- package/skills/algorand-interaction/SKILL.md +223 -0
- package/skills/algorand-interaction/references/algorand-mcp.md +743 -0
- package/skills/algorand-interaction/references/examples-algorand-mcp.md +647 -0
- package/skills/algorand-python/SKILL.md +95 -0
- package/skills/algorand-python/references/build-smart-contracts-decorators.md +413 -0
- package/skills/algorand-python/references/build-smart-contracts-reference.md +55 -0
- package/skills/algorand-python/references/build-smart-contracts-storage.md +452 -0
- package/skills/algorand-python/references/build-smart-contracts-transactions.md +445 -0
- package/skills/algorand-python/references/build-smart-contracts-types.md +438 -0
- package/skills/algorand-python/references/build-smart-contracts.md +82 -0
- package/skills/algorand-python/references/create-project-reference.md +55 -0
- package/skills/algorand-python/references/create-project.md +75 -0
- package/skills/algorand-python/references/implement-arc-standards-arc32-arc56.md +101 -0
- package/skills/algorand-python/references/implement-arc-standards-arc4.md +154 -0
- package/skills/algorand-python/references/implement-arc-standards.md +39 -0
- package/skills/algorand-python/references/troubleshoot-errors-contract.md +355 -0
- package/skills/algorand-python/references/troubleshoot-errors-transaction.md +430 -0
- package/skills/algorand-python/references/troubleshoot-errors.md +46 -0
- package/skills/algorand-python/references/use-algokit-utils-reference.md +350 -0
- package/skills/algorand-python/references/use-algokit-utils.md +76 -0
- package/skills/algorand-typescript/SKILL.md +131 -0
- package/skills/algorand-typescript/references/algorand-ts-migration-from-beta.md +448 -0
- package/skills/algorand-typescript/references/algorand-ts-migration-from-tealscript.md +487 -0
- package/skills/algorand-typescript/references/algorand-ts-migration.md +102 -0
- package/skills/algorand-typescript/references/algorand-typescript-syntax-methods-and-abi.md +134 -0
- package/skills/algorand-typescript/references/algorand-typescript-syntax-reference.md +58 -0
- package/skills/algorand-typescript/references/algorand-typescript-syntax-storage.md +154 -0
- package/skills/algorand-typescript/references/algorand-typescript-syntax-transactions.md +187 -0
- package/skills/algorand-typescript/references/algorand-typescript-syntax-types-and-values.md +150 -0
- package/skills/algorand-typescript/references/algorand-typescript-syntax.md +84 -0
- package/skills/algorand-typescript/references/build-smart-contracts-reference.md +52 -0
- package/skills/algorand-typescript/references/build-smart-contracts.md +74 -0
- package/skills/algorand-typescript/references/call-smart-contracts-reference.md +237 -0
- package/skills/algorand-typescript/references/call-smart-contracts.md +183 -0
- package/skills/algorand-typescript/references/create-project-reference.md +53 -0
- package/skills/algorand-typescript/references/create-project.md +86 -0
- package/skills/algorand-typescript/references/deploy-react-frontend-examples.md +527 -0
- package/skills/algorand-typescript/references/deploy-react-frontend-reference.md +412 -0
- package/skills/algorand-typescript/references/deploy-react-frontend.md +239 -0
- package/skills/algorand-typescript/references/implement-arc-standards-arc32-arc56.md +73 -0
- package/skills/algorand-typescript/references/implement-arc-standards-arc4.md +126 -0
- package/skills/algorand-typescript/references/implement-arc-standards.md +44 -0
- package/skills/algorand-typescript/references/test-smart-contracts-examples.md +245 -0
- package/skills/algorand-typescript/references/test-smart-contracts-unit-tests.md +147 -0
- package/skills/algorand-typescript/references/test-smart-contracts.md +127 -0
- package/skills/algorand-typescript/references/troubleshoot-errors-contract.md +296 -0
- package/skills/algorand-typescript/references/troubleshoot-errors-transaction.md +438 -0
- package/skills/algorand-typescript/references/troubleshoot-errors.md +56 -0
- package/skills/algorand-typescript/references/use-algokit-utils-reference.md +342 -0
- package/skills/algorand-typescript/references/use-algokit-utils.md +74 -0
- package/skills/algorand-x402-python/SKILL.md +113 -0
- package/skills/algorand-x402-python/references/create-python-x402-client-examples.md +469 -0
- package/skills/algorand-x402-python/references/create-python-x402-client-reference.md +313 -0
- package/skills/algorand-x402-python/references/create-python-x402-client.md +207 -0
- package/skills/algorand-x402-python/references/create-python-x402-facilitator-examples.md +924 -0
- package/skills/algorand-x402-python/references/create-python-x402-facilitator-reference.md +629 -0
- package/skills/algorand-x402-python/references/create-python-x402-facilitator.md +408 -0
- package/skills/algorand-x402-python/references/create-python-x402-server-examples.md +703 -0
- package/skills/algorand-x402-python/references/create-python-x402-server-reference.md +303 -0
- package/skills/algorand-x402-python/references/create-python-x402-server.md +221 -0
- package/skills/algorand-x402-python/references/explain-algorand-x402-python-examples.md +605 -0
- package/skills/algorand-x402-python/references/explain-algorand-x402-python-reference.md +315 -0
- package/skills/algorand-x402-python/references/explain-algorand-x402-python.md +167 -0
- package/skills/algorand-x402-python/references/use-python-x402-core-avm-examples.md +554 -0
- package/skills/algorand-x402-python/references/use-python-x402-core-avm-reference.md +278 -0
- package/skills/algorand-x402-python/references/use-python-x402-core-avm.md +166 -0
- package/skills/algorand-x402-typescript/SKILL.md +129 -0
- package/skills/algorand-x402-typescript/references/create-typescript-x402-client-examples.md +879 -0
- package/skills/algorand-x402-typescript/references/create-typescript-x402-client-reference.md +371 -0
- package/skills/algorand-x402-typescript/references/create-typescript-x402-client.md +236 -0
- package/skills/algorand-x402-typescript/references/create-typescript-x402-facilitator-examples.md +875 -0
- package/skills/algorand-x402-typescript/references/create-typescript-x402-facilitator-reference.md +461 -0
- package/skills/algorand-x402-typescript/references/create-typescript-x402-facilitator.md +270 -0
- package/skills/algorand-x402-typescript/references/create-typescript-x402-nextjs-examples.md +1181 -0
- package/skills/algorand-x402-typescript/references/create-typescript-x402-nextjs-reference.md +360 -0
- package/skills/algorand-x402-typescript/references/create-typescript-x402-nextjs.md +251 -0
- package/skills/algorand-x402-typescript/references/create-typescript-x402-paywall-examples.md +870 -0
- package/skills/algorand-x402-typescript/references/create-typescript-x402-paywall-reference.md +323 -0
- package/skills/algorand-x402-typescript/references/create-typescript-x402-paywall.md +281 -0
- package/skills/algorand-x402-typescript/references/create-typescript-x402-server-examples.md +1135 -0
- package/skills/algorand-x402-typescript/references/create-typescript-x402-server-reference.md +382 -0
- package/skills/algorand-x402-typescript/references/create-typescript-x402-server.md +216 -0
- package/skills/algorand-x402-typescript/references/explain-algorand-x402-typescript-examples.md +616 -0
- package/skills/algorand-x402-typescript/references/explain-algorand-x402-typescript-reference.md +323 -0
- package/skills/algorand-x402-typescript/references/explain-algorand-x402-typescript.md +232 -0
- package/skills/algorand-x402-typescript/references/use-typescript-x402-core-avm-examples.md +1417 -0
- package/skills/algorand-x402-typescript/references/use-typescript-x402-core-avm-reference.md +504 -0
- package/skills/algorand-x402-typescript/references/use-typescript-x402-core-avm.md +158 -0
|
@@ -0,0 +1,350 @@
|
|
|
1
|
+
# AlgorandClient (Python)
|
|
2
|
+
|
|
3
|
+
The main entry point for interacting with Algorand in Python applications.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install algokit-utils
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Creating an AlgorandClient
|
|
12
|
+
|
|
13
|
+
```python
|
|
14
|
+
from algokit_utils import AlgorandClient
|
|
15
|
+
|
|
16
|
+
# From environment variables (recommended for production)
|
|
17
|
+
algorand = AlgorandClient.from_environment()
|
|
18
|
+
|
|
19
|
+
# Default LocalNet configuration
|
|
20
|
+
algorand = AlgorandClient.default_localnet()
|
|
21
|
+
|
|
22
|
+
# TestNet using AlgoNode free tier
|
|
23
|
+
algorand = AlgorandClient.testnet()
|
|
24
|
+
|
|
25
|
+
# MainNet using AlgoNode free tier
|
|
26
|
+
algorand = AlgorandClient.mainnet()
|
|
27
|
+
|
|
28
|
+
# From existing clients
|
|
29
|
+
algorand = AlgorandClient.from_clients(algod=algod, indexer=indexer, kmd=kmd)
|
|
30
|
+
|
|
31
|
+
# From custom configuration
|
|
32
|
+
from algokit_utils import AlgoClientNetworkConfig
|
|
33
|
+
|
|
34
|
+
algorand = AlgorandClient.from_config(
|
|
35
|
+
algod_config=AlgoClientNetworkConfig(
|
|
36
|
+
server="http://localhost",
|
|
37
|
+
port="4001",
|
|
38
|
+
token="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
|
39
|
+
)
|
|
40
|
+
)
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Accessing SDK Clients
|
|
44
|
+
|
|
45
|
+
```python
|
|
46
|
+
algod_client = algorand.client.algod
|
|
47
|
+
indexer_client = algorand.client.indexer
|
|
48
|
+
kmd_client = algorand.client.kmd
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Account Management
|
|
52
|
+
|
|
53
|
+
### Getting Accounts
|
|
54
|
+
|
|
55
|
+
```python
|
|
56
|
+
# From environment variable (DEPLOYER_MNEMONIC)
|
|
57
|
+
deployer = algorand.account.from_environment("DEPLOYER")
|
|
58
|
+
|
|
59
|
+
# Random account (for testing)
|
|
60
|
+
random_account = algorand.account.random()
|
|
61
|
+
|
|
62
|
+
# From mnemonic
|
|
63
|
+
account = algorand.account.from_mnemonic("abandon abandon...")
|
|
64
|
+
|
|
65
|
+
# From KMD (LocalNet)
|
|
66
|
+
kmd_account = algorand.account.from_kmd("wallet-name", "password")
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Registering Signers
|
|
70
|
+
|
|
71
|
+
```python
|
|
72
|
+
# Register a signer for automatic signing
|
|
73
|
+
algorand.set_signer_from_account(account)
|
|
74
|
+
|
|
75
|
+
# Set default signer for all transactions
|
|
76
|
+
algorand.set_default_signer(account.signer)
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Sending Transactions
|
|
80
|
+
|
|
81
|
+
### Single Transactions
|
|
82
|
+
|
|
83
|
+
```python
|
|
84
|
+
from algokit_utils import AlgoAmount, PaymentParams, AssetTransferParams
|
|
85
|
+
from algokit_utils import AssetOptInParams, AssetCreateParams
|
|
86
|
+
|
|
87
|
+
# Payment
|
|
88
|
+
result = algorand.send.payment(
|
|
89
|
+
PaymentParams(
|
|
90
|
+
sender="SENDERADDRESS",
|
|
91
|
+
receiver="RECEIVERADDRESS",
|
|
92
|
+
amount=AlgoAmount(algo=1),
|
|
93
|
+
)
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
# Asset transfer
|
|
97
|
+
algorand.send.asset_transfer(
|
|
98
|
+
AssetTransferParams(
|
|
99
|
+
sender="SENDERADDRESS",
|
|
100
|
+
receiver="RECEIVERADDRESS",
|
|
101
|
+
asset_id=12345,
|
|
102
|
+
amount=100,
|
|
103
|
+
)
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
# Asset opt-in
|
|
107
|
+
algorand.send.asset_opt_in(
|
|
108
|
+
AssetOptInParams(
|
|
109
|
+
sender="SENDERADDRESS",
|
|
110
|
+
asset_id=12345,
|
|
111
|
+
)
|
|
112
|
+
)
|
|
113
|
+
|
|
114
|
+
# Asset create
|
|
115
|
+
create_result = algorand.send.asset_create(
|
|
116
|
+
AssetCreateParams(
|
|
117
|
+
sender="SENDERADDRESS",
|
|
118
|
+
total=1_000_000,
|
|
119
|
+
decimals=6,
|
|
120
|
+
asset_name="My Token",
|
|
121
|
+
unit_name="MTK",
|
|
122
|
+
)
|
|
123
|
+
)
|
|
124
|
+
asset_id = create_result.asset_id
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Transaction Groups
|
|
128
|
+
|
|
129
|
+
```python
|
|
130
|
+
result = (
|
|
131
|
+
algorand
|
|
132
|
+
.new_group()
|
|
133
|
+
.add_payment(
|
|
134
|
+
PaymentParams(
|
|
135
|
+
sender="SENDERADDRESS",
|
|
136
|
+
receiver="RECEIVERADDRESS",
|
|
137
|
+
amount=AlgoAmount(algo=1),
|
|
138
|
+
)
|
|
139
|
+
)
|
|
140
|
+
.add_asset_opt_in(
|
|
141
|
+
AssetOptInParams(
|
|
142
|
+
sender="SENDERADDRESS",
|
|
143
|
+
asset_id=12345,
|
|
144
|
+
)
|
|
145
|
+
)
|
|
146
|
+
.send()
|
|
147
|
+
)
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Creating Transactions (Without Sending)
|
|
151
|
+
|
|
152
|
+
```python
|
|
153
|
+
payment = algorand.create_transaction.payment(
|
|
154
|
+
PaymentParams(
|
|
155
|
+
sender="SENDERADDRESS",
|
|
156
|
+
receiver="RECEIVERADDRESS",
|
|
157
|
+
amount=AlgoAmount(algo=1),
|
|
158
|
+
)
|
|
159
|
+
)
|
|
160
|
+
# payment is an unsigned algosdk.Transaction
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
## Common Transaction Parameters
|
|
164
|
+
|
|
165
|
+
All transactions support these common parameters:
|
|
166
|
+
|
|
167
|
+
```python
|
|
168
|
+
algorand.send.payment(
|
|
169
|
+
PaymentParams(
|
|
170
|
+
sender="SENDERADDRESS",
|
|
171
|
+
receiver="RECEIVERADDRESS",
|
|
172
|
+
amount=AlgoAmount(algo=1),
|
|
173
|
+
|
|
174
|
+
# Optional parameters
|
|
175
|
+
note=b"My note",
|
|
176
|
+
lease="unique-lease-id",
|
|
177
|
+
rekey_to="NEWADDRESS",
|
|
178
|
+
|
|
179
|
+
# Fee management
|
|
180
|
+
static_fee=AlgoAmount(micro_algo=1000),
|
|
181
|
+
extra_fee=AlgoAmount(micro_algo=1000), # For covering inner txn fees
|
|
182
|
+
max_fee=AlgoAmount(micro_algo=10000),
|
|
183
|
+
|
|
184
|
+
# Validity
|
|
185
|
+
validity_window=1000,
|
|
186
|
+
first_valid_round=12345,
|
|
187
|
+
)
|
|
188
|
+
)
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
## App Calls
|
|
192
|
+
|
|
193
|
+
### Using Typed App Clients (Recommended)
|
|
194
|
+
|
|
195
|
+
```python
|
|
196
|
+
# Get typed factory from generated client
|
|
197
|
+
factory = algorand.client.get_typed_app_factory(MyContractFactory)
|
|
198
|
+
|
|
199
|
+
# Deploy
|
|
200
|
+
result = factory.deploy(sender=deployer.address)
|
|
201
|
+
app_client = result.app_client
|
|
202
|
+
|
|
203
|
+
# Call methods
|
|
204
|
+
response = app_client.send.my_method(
|
|
205
|
+
sender=deployer.address,
|
|
206
|
+
args={"param1": "value"},
|
|
207
|
+
)
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
### Generic App Calls
|
|
211
|
+
|
|
212
|
+
```python
|
|
213
|
+
from algokit_utils import AppCallMethodCallParams
|
|
214
|
+
from algosdk.abi import Method
|
|
215
|
+
|
|
216
|
+
algorand.send.app_call_method_call(
|
|
217
|
+
AppCallMethodCallParams(
|
|
218
|
+
sender="SENDERADDRESS",
|
|
219
|
+
app_id=12345,
|
|
220
|
+
method=Method.from_signature("hello(string)string"),
|
|
221
|
+
args=["World"],
|
|
222
|
+
)
|
|
223
|
+
)
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
## Send Parameters
|
|
227
|
+
|
|
228
|
+
Control execution behavior when sending:
|
|
229
|
+
|
|
230
|
+
```python
|
|
231
|
+
from algokit_utils import SendParams
|
|
232
|
+
|
|
233
|
+
algorand.send.payment(
|
|
234
|
+
PaymentParams(
|
|
235
|
+
sender="SENDERADDRESS",
|
|
236
|
+
receiver="RECEIVERADDRESS",
|
|
237
|
+
amount=AlgoAmount(algo=1),
|
|
238
|
+
),
|
|
239
|
+
send_params=SendParams(
|
|
240
|
+
# Wait for confirmation
|
|
241
|
+
max_rounds_to_wait_for_confirmation=5,
|
|
242
|
+
|
|
243
|
+
# Suppress logging
|
|
244
|
+
suppress_log=True,
|
|
245
|
+
|
|
246
|
+
# Auto-populate app call resources
|
|
247
|
+
populate_app_call_resources=True,
|
|
248
|
+
|
|
249
|
+
# Auto-calculate inner txn fees
|
|
250
|
+
cover_app_call_inner_transaction_fees=True,
|
|
251
|
+
)
|
|
252
|
+
)
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
## Amount Helpers
|
|
256
|
+
|
|
257
|
+
```python
|
|
258
|
+
from algokit_utils import AlgoAmount
|
|
259
|
+
|
|
260
|
+
AlgoAmount(algo=1) # 1 Algo = 1,000,000 microAlgo
|
|
261
|
+
AlgoAmount(algo=0.5) # 0.5 Algo = 500,000 microAlgo
|
|
262
|
+
AlgoAmount(micro_algo=1000) # 1000 microAlgo
|
|
263
|
+
|
|
264
|
+
# Access values
|
|
265
|
+
amount = AlgoAmount(algo=1)
|
|
266
|
+
amount.algo # 1.0
|
|
267
|
+
amount.micro_algo # 1000000
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
## Common Patterns
|
|
271
|
+
|
|
272
|
+
### Fund an Account
|
|
273
|
+
|
|
274
|
+
```python
|
|
275
|
+
algorand.send.payment(
|
|
276
|
+
PaymentParams(
|
|
277
|
+
sender=funder_account.address,
|
|
278
|
+
receiver=new_account.address,
|
|
279
|
+
amount=AlgoAmount(algo=10),
|
|
280
|
+
)
|
|
281
|
+
)
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
### Create and Fund in One Group
|
|
285
|
+
|
|
286
|
+
```python
|
|
287
|
+
new_account = algorand.account.random()
|
|
288
|
+
|
|
289
|
+
(
|
|
290
|
+
algorand
|
|
291
|
+
.new_group()
|
|
292
|
+
.add_payment(
|
|
293
|
+
PaymentParams(
|
|
294
|
+
sender=funder.address,
|
|
295
|
+
receiver=new_account.address,
|
|
296
|
+
amount=AlgoAmount(algo=1),
|
|
297
|
+
)
|
|
298
|
+
)
|
|
299
|
+
.add_asset_opt_in(
|
|
300
|
+
AssetOptInParams(
|
|
301
|
+
sender=new_account.address,
|
|
302
|
+
asset_id=12345,
|
|
303
|
+
)
|
|
304
|
+
)
|
|
305
|
+
.send()
|
|
306
|
+
)
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
### Deploy and Fund Contract
|
|
310
|
+
|
|
311
|
+
```python
|
|
312
|
+
factory = algorand.client.get_typed_app_factory(MyContractFactory)
|
|
313
|
+
result = factory.deploy(sender=deployer.address)
|
|
314
|
+
app_client = result.app_client
|
|
315
|
+
|
|
316
|
+
# Fund the app account for box storage
|
|
317
|
+
algorand.send.payment(
|
|
318
|
+
PaymentParams(
|
|
319
|
+
sender=deployer.address,
|
|
320
|
+
receiver=app_client.app_address,
|
|
321
|
+
amount=AlgoAmount(algo=1),
|
|
322
|
+
)
|
|
323
|
+
)
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
### Using Environment-Based Accounts
|
|
327
|
+
|
|
328
|
+
```python
|
|
329
|
+
# Set environment variables:
|
|
330
|
+
# DEPLOYER_MNEMONIC="word1 word2 ... word25"
|
|
331
|
+
|
|
332
|
+
algorand = AlgorandClient.from_environment()
|
|
333
|
+
deployer = algorand.account.from_environment("DEPLOYER")
|
|
334
|
+
|
|
335
|
+
# Now use deployer for transactions
|
|
336
|
+
algorand.send.payment(
|
|
337
|
+
PaymentParams(
|
|
338
|
+
sender=deployer.address,
|
|
339
|
+
receiver="RECEIVERADDRESS",
|
|
340
|
+
amount=AlgoAmount(algo=1),
|
|
341
|
+
)
|
|
342
|
+
)
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
## References
|
|
346
|
+
|
|
347
|
+
- [AlgoKit Utils Python Overview](https://dev.algorand.co/algokit/utils/python/overview/)
|
|
348
|
+
- [AlgorandClient API](https://dev.algorand.co/reference/algokit-utils-py/api/algorand/)
|
|
349
|
+
- [Transaction Composer](https://dev.algorand.co/algokit/utils/python/transaction-composer/)
|
|
350
|
+
- [Account Management](https://dev.algorand.co/algokit/utils/python/account/)
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# AlgoKit Utils (Python)
|
|
2
|
+
|
|
3
|
+
AlgoKit Utils for Python is the primary library for building Algorand applications in Python. It provides a high-level, ergonomic interface via the `AlgorandClient` class, which is the single entry point for interacting with the Algorand network -- sending transactions, managing accounts, deploying smart contracts, and more.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install algokit-utils
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
### 1. Create an AlgorandClient
|
|
14
|
+
|
|
15
|
+
```python
|
|
16
|
+
from algokit_utils import AlgorandClient
|
|
17
|
+
|
|
18
|
+
# Connect to LocalNet (development)
|
|
19
|
+
algorand = AlgorandClient.default_localnet()
|
|
20
|
+
|
|
21
|
+
# Connect to TestNet
|
|
22
|
+
algorand = AlgorandClient.testnet()
|
|
23
|
+
|
|
24
|
+
# Connect to MainNet
|
|
25
|
+
algorand = AlgorandClient.mainnet()
|
|
26
|
+
|
|
27
|
+
# From environment variables (recommended for production)
|
|
28
|
+
algorand = AlgorandClient.from_environment()
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### 2. Get and Register an Account
|
|
32
|
+
|
|
33
|
+
```python
|
|
34
|
+
# Get a random account (testing)
|
|
35
|
+
account = algorand.account.random()
|
|
36
|
+
|
|
37
|
+
# From environment variable (e.g. DEPLOYER_MNEMONIC)
|
|
38
|
+
deployer = algorand.account.from_environment("DEPLOYER")
|
|
39
|
+
|
|
40
|
+
# Register the signer so transactions are automatically signed
|
|
41
|
+
algorand.set_signer_from_account(account)
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### 3. Send a Transaction
|
|
45
|
+
|
|
46
|
+
```python
|
|
47
|
+
from algokit_utils import AlgoAmount, PaymentParams
|
|
48
|
+
|
|
49
|
+
result = algorand.send.payment(
|
|
50
|
+
PaymentParams(
|
|
51
|
+
sender=account.address,
|
|
52
|
+
receiver="RECEIVERADDRESS",
|
|
53
|
+
amount=AlgoAmount(algo=1),
|
|
54
|
+
)
|
|
55
|
+
)
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Key Rules
|
|
59
|
+
|
|
60
|
+
1. **Always use `AlgorandClient`** as the single entry point. Do not instantiate lower-level SDK clients directly.
|
|
61
|
+
2. **Use `AlgorandClient.from_environment()`** for production deployments and CI/CD pipelines.
|
|
62
|
+
3. **Register signers** with `algorand.set_signer_from_account(account)` before sending transactions so signing is handled automatically.
|
|
63
|
+
4. **Use `AlgoAmount`** for all amounts (e.g. `AlgoAmount(algo=1)`, `AlgoAmount(micro_algo=1000)`) instead of raw numbers to avoid unit conversion errors.
|
|
64
|
+
|
|
65
|
+
## Reference
|
|
66
|
+
|
|
67
|
+
For the full AlgorandClient API covering client creation, account management, transaction sending, app calls, transaction groups, amount helpers, and common patterns:
|
|
68
|
+
|
|
69
|
+
[AlgorandClient Reference](./use-algokit-utils-reference.md)
|
|
70
|
+
|
|
71
|
+
## External Links
|
|
72
|
+
|
|
73
|
+
- [AlgoKit Utils Python Overview](https://dev.algorand.co/algokit/utils/python/overview/)
|
|
74
|
+
- [AlgorandClient API Reference](https://dev.algorand.co/reference/algokit-utils-py/api/algorand/)
|
|
75
|
+
- [Transaction Composer](https://dev.algorand.co/algokit/utils/python/transaction-composer/)
|
|
76
|
+
- [Account Management](https://dev.algorand.co/algokit/utils/python/account/)
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: algorand-typescript
|
|
3
|
+
description: Comprehensive guide for Algorand TypeScript (PuyaTs) smart contract development — syntax rules, migration, testing, deployment, React frontends, AlgoKit Utils, ARC standards, and troubleshooting. This is the parent skill for all TypeScript-specific Algorand content. Use when writing TypeScript contract code, encountering Puya compiler errors, migrating from TEALScript or beta, testing contracts with Vitest, deploying with typed clients, building React frontends, or using AlgoKit Utils in TypeScript. Strong triggers include "Puya compiler error", "uint64", "clone()", "BoxMap", ".algo.ts", "migrate from TEALScript", "algorandFixture", "vitest", "deploy contract", "call method", "React frontend", "use-wallet", "AlgorandClient TypeScript", "npm install algokit-utils".
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Algorand TypeScript
|
|
7
|
+
|
|
8
|
+
This is the aggregated parent skill for all TypeScript-specific Algorand development. Use the reference files below to find detailed guidance for each topic.
|
|
9
|
+
|
|
10
|
+
## Quick Start
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
# Create TypeScript project
|
|
14
|
+
algokit init -n my-project -t typescript --answer preset_name production --defaults
|
|
15
|
+
|
|
16
|
+
# Install AlgoKit Utils
|
|
17
|
+
npm install @algorandfoundation/algokit-utils
|
|
18
|
+
|
|
19
|
+
# Development cycle
|
|
20
|
+
algokit project run build # Compile .algo.ts contracts
|
|
21
|
+
algokit project run test # Run Vitest tests
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### Key TypeScript Rule
|
|
25
|
+
|
|
26
|
+
Contract files must use `.algo.ts` extension. Use AVM types (`uint64`, `bytes`), never JavaScript `number`. Always `clone()` complex types.
|
|
27
|
+
|
|
28
|
+
## Reference Guide
|
|
29
|
+
|
|
30
|
+
Navigate to the appropriate reference based on your task. Each topic has one or more files.
|
|
31
|
+
|
|
32
|
+
### Algorand TypeScript Syntax
|
|
33
|
+
|
|
34
|
+
Critical syntax rules for Algorand TypeScript (PuyaTs) that prevent compiler errors.
|
|
35
|
+
|
|
36
|
+
- [algorand-typescript-syntax.md](./references/algorand-typescript-syntax.md) — Core syntax rules overview
|
|
37
|
+
- [algorand-typescript-syntax-reference.md](./references/algorand-typescript-syntax-reference.md) — Full reference index
|
|
38
|
+
- [algorand-typescript-syntax-types-and-values.md](./references/algorand-typescript-syntax-types-and-values.md) — AVM types, numbers, clone(), value semantics
|
|
39
|
+
- [algorand-typescript-syntax-storage.md](./references/algorand-typescript-syntax-storage.md) — GlobalState, LocalState, BoxMap, MBR funding
|
|
40
|
+
- [algorand-typescript-syntax-methods-and-abi.md](./references/algorand-typescript-syntax-methods-and-abi.md) — Decorators, lifecycle methods, visibility
|
|
41
|
+
- [algorand-typescript-syntax-transactions.md](./references/algorand-typescript-syntax-transactions.md) — Group transactions (gtxn), inner transactions (itxn)
|
|
42
|
+
|
|
43
|
+
### Migration to Algorand TypeScript 1.0
|
|
44
|
+
|
|
45
|
+
Migrate from TEALScript or Algorand TypeScript Beta to 1.0.
|
|
46
|
+
|
|
47
|
+
- [algorand-ts-migration.md](./references/algorand-ts-migration.md) — Migration workflow and quick reference
|
|
48
|
+
- [algorand-ts-migration-from-tealscript.md](./references/algorand-ts-migration-from-tealscript.md) — TEALScript migration guide
|
|
49
|
+
- [algorand-ts-migration-from-beta.md](./references/algorand-ts-migration-from-beta.md) — Beta migration guide
|
|
50
|
+
|
|
51
|
+
### Testing Smart Contracts
|
|
52
|
+
|
|
53
|
+
Write integration and unit tests using algorandFixture and Vitest.
|
|
54
|
+
|
|
55
|
+
- [test-smart-contracts.md](./references/test-smart-contracts.md) — Testing patterns and canonical examples
|
|
56
|
+
- [test-smart-contracts-examples.md](./references/test-smart-contracts-examples.md) — Complete test examples
|
|
57
|
+
- [test-smart-contracts-unit-tests.md](./references/test-smart-contracts-unit-tests.md) — Unit testing guide
|
|
58
|
+
|
|
59
|
+
### Calling Smart Contracts
|
|
60
|
+
|
|
61
|
+
Deploy and interact with contracts using generated TypeScript clients.
|
|
62
|
+
|
|
63
|
+
- [call-smart-contracts.md](./references/call-smart-contracts.md) — Deployment and interaction workflow
|
|
64
|
+
- [call-smart-contracts-reference.md](./references/call-smart-contracts-reference.md) — CLI commands reference
|
|
65
|
+
|
|
66
|
+
### React Frontends
|
|
67
|
+
|
|
68
|
+
Build React frontends with wallet integration and typed contract clients.
|
|
69
|
+
|
|
70
|
+
- [deploy-react-frontend.md](./references/deploy-react-frontend.md) — Frontend workflow and signer pattern
|
|
71
|
+
- [deploy-react-frontend-reference.md](./references/deploy-react-frontend-reference.md) — API reference
|
|
72
|
+
- [deploy-react-frontend-examples.md](./references/deploy-react-frontend-examples.md) — Complete code examples
|
|
73
|
+
|
|
74
|
+
### Creating TypeScript Projects
|
|
75
|
+
|
|
76
|
+
Initialize TypeScript AlgoKit projects with proper templates and presets.
|
|
77
|
+
|
|
78
|
+
- [create-project.md](./references/create-project.md) — TypeScript project creation
|
|
79
|
+
- [create-project-reference.md](./references/create-project-reference.md) — TypeScript presets and templates
|
|
80
|
+
|
|
81
|
+
### Building Smart Contracts (TypeScript)
|
|
82
|
+
|
|
83
|
+
TypeScript-specific contract building with PuyaTs.
|
|
84
|
+
|
|
85
|
+
- [build-smart-contracts.md](./references/build-smart-contracts.md) — TypeScript contract building guide
|
|
86
|
+
- [build-smart-contracts-reference.md](./references/build-smart-contracts-reference.md) — TypeScript repos and patterns
|
|
87
|
+
|
|
88
|
+
### AlgoKit Utils (TypeScript)
|
|
89
|
+
|
|
90
|
+
Interact with Algorand from TypeScript applications.
|
|
91
|
+
|
|
92
|
+
- [use-algokit-utils.md](./references/use-algokit-utils.md) — TypeScript AlgoKit Utils overview
|
|
93
|
+
- [use-algokit-utils-reference.md](./references/use-algokit-utils-reference.md) — AlgorandClient TypeScript API reference
|
|
94
|
+
|
|
95
|
+
### Implementing ARC Standards (TypeScript)
|
|
96
|
+
|
|
97
|
+
TypeScript implementations of ARC-4, ARC-32, and ARC-56.
|
|
98
|
+
|
|
99
|
+
- [implement-arc-standards.md](./references/implement-arc-standards.md) — TypeScript ARC overview
|
|
100
|
+
- [implement-arc-standards-arc4.md](./references/implement-arc-standards-arc4.md) — TypeScript ARC-4 implementations
|
|
101
|
+
- [implement-arc-standards-arc32-arc56.md](./references/implement-arc-standards-arc32-arc56.md) — TypeScript typed client usage
|
|
102
|
+
|
|
103
|
+
### Troubleshooting Errors (TypeScript)
|
|
104
|
+
|
|
105
|
+
TypeScript-specific error diagnosis and fixes.
|
|
106
|
+
|
|
107
|
+
- [troubleshoot-errors.md](./references/troubleshoot-errors.md) — TypeScript error overview
|
|
108
|
+
- [troubleshoot-errors-contract.md](./references/troubleshoot-errors-contract.md) — Contract errors with TypeScript fixes
|
|
109
|
+
- [troubleshoot-errors-transaction.md](./references/troubleshoot-errors-transaction.md) — Transaction errors with TypeScript fixes
|
|
110
|
+
|
|
111
|
+
## Topic Quick Reference
|
|
112
|
+
|
|
113
|
+
| Topic | Files | Description |
|
|
114
|
+
| ----- | ----- | ----------- |
|
|
115
|
+
| Syntax Rules | 6 | PuyaTs types, storage, methods, transactions |
|
|
116
|
+
| Migration | 3 | TEALScript and beta migration guides |
|
|
117
|
+
| Testing | 3 | Vitest integration and unit tests |
|
|
118
|
+
| Calling Contracts | 2 | Deployment and typed client interaction |
|
|
119
|
+
| React Frontends | 3 | Wallet integration and dApp UI |
|
|
120
|
+
| Create Project | 2 | TypeScript template initialization |
|
|
121
|
+
| Build Contracts | 2 | TypeScript-focused contract building |
|
|
122
|
+
| AlgoKit Utils | 2 | AlgorandClient TypeScript API |
|
|
123
|
+
| ARC Standards | 3 | TypeScript ARC implementations |
|
|
124
|
+
| Troubleshoot | 3 | TypeScript error fixes |
|
|
125
|
+
|
|
126
|
+
## How to Use This Skill
|
|
127
|
+
|
|
128
|
+
1. **Start here** to understand which reference you need
|
|
129
|
+
2. **Read the topic `.md`** file for step-by-step guidance
|
|
130
|
+
3. **Consult detail files** for specific subtopics (syntax, examples, reference)
|
|
131
|
+
4. **For language-agnostic content** (CLI, ARC specs, general workflows), see the `algorand-development` parent skill
|