@goplausible/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 +41 -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,430 @@
|
|
|
1
|
+
# Transaction & Account Errors (Python)
|
|
2
|
+
|
|
3
|
+
Python-focused fixes for common Algorand transaction and account errors.
|
|
4
|
+
|
|
5
|
+
## Table of Contents
|
|
6
|
+
|
|
7
|
+
- [Transaction Errors](#transaction-errors)
|
|
8
|
+
- [Overspend](#overspend)
|
|
9
|
+
- [Transaction Already in Ledger](#transaction-already-in-ledger)
|
|
10
|
+
- [Transaction Pool Full](#transaction-pool-full)
|
|
11
|
+
- [Fee Too Low](#fee-too-low)
|
|
12
|
+
- [Round Out of Range](#round-out-of-range)
|
|
13
|
+
- [Invalid Group](#invalid-group)
|
|
14
|
+
- [Group Size Limit](#group-size-limit)
|
|
15
|
+
- [Asset Errors](#asset-errors)
|
|
16
|
+
- [Asset Not Found](#asset-not-found)
|
|
17
|
+
- [Asset Not Opted In](#asset-not-opted-in)
|
|
18
|
+
- [Asset Frozen](#asset-frozen)
|
|
19
|
+
- [Clawback Not Authorized](#clawback-not-authorized)
|
|
20
|
+
- [Cannot Close Asset](#cannot-close-asset)
|
|
21
|
+
- [Account Errors](#account-errors)
|
|
22
|
+
- [Account Not Found](#account-not-found)
|
|
23
|
+
- [Invalid Address](#invalid-address)
|
|
24
|
+
- [Wrong Network](#wrong-network)
|
|
25
|
+
- [SDK Errors](#sdk-errors)
|
|
26
|
+
- [Application Errors](#application-errors)
|
|
27
|
+
- [Debugging Tips](#debugging-tips)
|
|
28
|
+
|
|
29
|
+
## Transaction Errors
|
|
30
|
+
|
|
31
|
+
### Overspend
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
TransactionPool.Remember: transaction TXID: overspend (account ADDRESS, data {_struct:{} Status:Offline MicroAlgos:{Raw:1000} ...})
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
**Cause:** Sender account has insufficient balance for amount + fee + minimum balance.
|
|
38
|
+
|
|
39
|
+
**Minimum balance requirements:**
|
|
40
|
+
| Item | MBR |
|
|
41
|
+
|------|-----|
|
|
42
|
+
| Base account | 100,000 microAlgo |
|
|
43
|
+
| Each opted-in asset | +100,000 microAlgo |
|
|
44
|
+
| Each created asset | +100,000 microAlgo |
|
|
45
|
+
| Each opted-in app | +100,000 microAlgo |
|
|
46
|
+
| Each created app | +100,000 microAlgo |
|
|
47
|
+
| App local state per schema | Varies |
|
|
48
|
+
| Box storage | 2,500 + 400 * size |
|
|
49
|
+
|
|
50
|
+
**Fix:**
|
|
51
|
+
```python
|
|
52
|
+
# Calculate available balance
|
|
53
|
+
account_info = algorand.account.get_information(address)
|
|
54
|
+
available = account_info.amount - account_info.min_balance
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Transaction Already in Ledger
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
TransactionPool.Remember: transaction already in ledger: TXID
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
**Cause:** Duplicate transaction submitted (same txn ID).
|
|
64
|
+
|
|
65
|
+
**Common causes:**
|
|
66
|
+
- Retrying a transaction that already succeeded
|
|
67
|
+
- Using same lease within validity window
|
|
68
|
+
- Network latency causing duplicate submission
|
|
69
|
+
|
|
70
|
+
**Fix:** Check if transaction exists before retrying:
|
|
71
|
+
```python
|
|
72
|
+
try:
|
|
73
|
+
result = algorand.client.algod.pending_transaction_info(tx_id)
|
|
74
|
+
# Transaction exists
|
|
75
|
+
except Exception:
|
|
76
|
+
# Safe to retry
|
|
77
|
+
pass
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Transaction Pool Full
|
|
81
|
+
|
|
82
|
+
```
|
|
83
|
+
TransactionPool.Remember: transaction pool is full
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
**Cause:** Node's transaction pool at capacity.
|
|
87
|
+
|
|
88
|
+
**Fix:**
|
|
89
|
+
1. Wait and retry with exponential backoff
|
|
90
|
+
2. Increase fee to prioritize transaction
|
|
91
|
+
3. Try a different node
|
|
92
|
+
|
|
93
|
+
### Fee Too Low
|
|
94
|
+
|
|
95
|
+
```
|
|
96
|
+
TransactionPool.Remember: transaction TXID: fee X below threshold Y
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
**Cause:** Transaction fee below minimum (usually 1000 microAlgo).
|
|
100
|
+
|
|
101
|
+
**Fix:**
|
|
102
|
+
```python
|
|
103
|
+
algorand.send.payment(PaymentParams(
|
|
104
|
+
sender=sender,
|
|
105
|
+
receiver=receiver,
|
|
106
|
+
amount=AlgoAmount(algo=1),
|
|
107
|
+
static_fee=AlgoAmount(micro_algo=1000), # Minimum fee
|
|
108
|
+
))
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### Round Out of Range
|
|
112
|
+
|
|
113
|
+
```
|
|
114
|
+
TransactionPool.Remember: transaction TXID: round X outside of Y-Z range
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
**Cause:** Transaction's validity window expired or is in the future.
|
|
118
|
+
|
|
119
|
+
**Fix:**
|
|
120
|
+
```python
|
|
121
|
+
algorand.send.payment(PaymentParams(
|
|
122
|
+
sender=sender,
|
|
123
|
+
receiver=receiver,
|
|
124
|
+
amount=AlgoAmount(algo=1),
|
|
125
|
+
validity_window=1000, # Valid for 1000 rounds (~1 hour)
|
|
126
|
+
))
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### Invalid Group
|
|
130
|
+
|
|
131
|
+
```
|
|
132
|
+
TransactionPool.Remember: transaction TXID: bad group assignment
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
**Cause:** Transaction claims to be part of a group but has wrong group ID.
|
|
136
|
+
|
|
137
|
+
**Fix:** Use AlgoKit Utils for proper grouping:
|
|
138
|
+
```python
|
|
139
|
+
algorand.new_group()
|
|
140
|
+
.add_payment(PaymentParams(sender=sender, receiver=receiver, amount=AlgoAmount(algo=1)))
|
|
141
|
+
.add_asset_opt_in(AssetOptInParams(sender=sender, asset_id=12345))
|
|
142
|
+
.send()
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### Group Size Limit
|
|
146
|
+
|
|
147
|
+
```
|
|
148
|
+
cannot send transaction group with more than 16 transactions
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
**Cause:** Transaction group exceeds 16 transaction limit.
|
|
152
|
+
|
|
153
|
+
**Fix:** Split into multiple groups or optimize to fewer transactions.
|
|
154
|
+
|
|
155
|
+
## Asset Errors
|
|
156
|
+
|
|
157
|
+
### Asset Not Found
|
|
158
|
+
|
|
159
|
+
```
|
|
160
|
+
asset ASSET_ID does not exist
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
**Cause:** Asset ID doesn't exist on the network.
|
|
164
|
+
|
|
165
|
+
**Common causes:**
|
|
166
|
+
- Wrong network (TestNet vs MainNet)
|
|
167
|
+
- Asset was deleted
|
|
168
|
+
- Typo in asset ID
|
|
169
|
+
|
|
170
|
+
**Fix:** Verify asset exists:
|
|
171
|
+
```python
|
|
172
|
+
asset_info = algorand.client.algod.asset_info(asset_id)
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
### Asset Not Opted In
|
|
176
|
+
|
|
177
|
+
```
|
|
178
|
+
asset ASSET_ID missing from ACCOUNT_ADDRESS
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
**Cause:** Receiving account hasn't opted into the asset.
|
|
182
|
+
|
|
183
|
+
**Fix:**
|
|
184
|
+
```python
|
|
185
|
+
algorand.send.asset_opt_in(AssetOptInParams(
|
|
186
|
+
sender=receiver_address,
|
|
187
|
+
asset_id=asset_id,
|
|
188
|
+
))
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
### Asset Frozen
|
|
192
|
+
|
|
193
|
+
```
|
|
194
|
+
asset ASSET_ID frozen in ACCOUNT_ADDRESS
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
**Cause:** Account's holding of this asset is frozen.
|
|
198
|
+
|
|
199
|
+
**Fix:** Asset freeze manager must unfreeze the account.
|
|
200
|
+
|
|
201
|
+
### Clawback Not Authorized
|
|
202
|
+
|
|
203
|
+
```
|
|
204
|
+
only clawback address can clawback
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
**Cause:** Attempting clawback without being the clawback address.
|
|
208
|
+
|
|
209
|
+
**Fix:** Only the designated clawback address can perform clawbacks.
|
|
210
|
+
|
|
211
|
+
### Cannot Close Asset
|
|
212
|
+
|
|
213
|
+
```
|
|
214
|
+
cannot close asset: ACCOUNT_ADDRESS still has X units
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
**Cause:** Trying to opt out while still holding units.
|
|
218
|
+
|
|
219
|
+
**Fix:** Transfer all units before opting out:
|
|
220
|
+
```python
|
|
221
|
+
# First transfer all units
|
|
222
|
+
algorand.send.asset_transfer(AssetTransferParams(
|
|
223
|
+
sender=account,
|
|
224
|
+
receiver=creator_or_other,
|
|
225
|
+
asset_id=asset_id,
|
|
226
|
+
amount=balance, # All remaining
|
|
227
|
+
))
|
|
228
|
+
|
|
229
|
+
# Then opt out
|
|
230
|
+
algorand.send.asset_opt_out(AssetOptOutParams(
|
|
231
|
+
sender=account,
|
|
232
|
+
asset_id=asset_id,
|
|
233
|
+
creator=creator_address,
|
|
234
|
+
))
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
## Account Errors
|
|
238
|
+
|
|
239
|
+
### Account Not Found
|
|
240
|
+
|
|
241
|
+
```
|
|
242
|
+
account ADDRESS not found
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
**Cause:** Account doesn't exist (never funded).
|
|
246
|
+
|
|
247
|
+
**Note:** Algorand accounts must receive at least minimum balance to exist.
|
|
248
|
+
|
|
249
|
+
**Fix:**
|
|
250
|
+
```python
|
|
251
|
+
algorand.send.payment(PaymentParams(
|
|
252
|
+
sender=funder.address,
|
|
253
|
+
receiver=new_account.address,
|
|
254
|
+
amount=AlgoAmount(micro_algo=100_000), # Minimum
|
|
255
|
+
))
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
### Invalid Address
|
|
259
|
+
|
|
260
|
+
```
|
|
261
|
+
invalid address: ADDRESS
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
**Cause:** Malformed Algorand address.
|
|
265
|
+
|
|
266
|
+
**Valid address format:**
|
|
267
|
+
- 58 characters
|
|
268
|
+
- Base32 encoded
|
|
269
|
+
- Includes checksum
|
|
270
|
+
|
|
271
|
+
**Verify address:**
|
|
272
|
+
```python
|
|
273
|
+
from algosdk import encoding
|
|
274
|
+
if not encoding.is_valid_address(address):
|
|
275
|
+
raise ValueError("Invalid address")
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
### Wrong Network
|
|
279
|
+
|
|
280
|
+
```
|
|
281
|
+
genesis hash mismatch
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
**Cause:** Transaction built for different network than target.
|
|
285
|
+
|
|
286
|
+
**Fix:**
|
|
287
|
+
```python
|
|
288
|
+
# For TestNet
|
|
289
|
+
algorand = AlgorandClient.test_net()
|
|
290
|
+
|
|
291
|
+
# For MainNet
|
|
292
|
+
algorand = AlgorandClient.main_net()
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
## SDK Errors
|
|
296
|
+
|
|
297
|
+
### AlgodHTTPError
|
|
298
|
+
|
|
299
|
+
```
|
|
300
|
+
AlgodHTTPError: Network request error. Received status 401
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
**Common status codes:**
|
|
304
|
+
| Status | Meaning | Fix |
|
|
305
|
+
|--------|---------|-----|
|
|
306
|
+
| 401 | Unauthorized | Check API token |
|
|
307
|
+
| 404 | Not found | Check server URL |
|
|
308
|
+
| 500 | Server error | Node issue, retry |
|
|
309
|
+
| 503 | Unavailable | Node overloaded, retry |
|
|
310
|
+
|
|
311
|
+
**Fix for 401:**
|
|
312
|
+
```python
|
|
313
|
+
algorand = AlgorandClient.from_config(
|
|
314
|
+
algod_config=AlgoClientNetworkConfig(
|
|
315
|
+
server="https://testnet-api.algonode.cloud",
|
|
316
|
+
port="443",
|
|
317
|
+
token="", # AlgoNode doesn't require token
|
|
318
|
+
)
|
|
319
|
+
)
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
### Timeout Waiting for Confirmation
|
|
323
|
+
|
|
324
|
+
```
|
|
325
|
+
Timeout waiting for transaction TXID to be confirmed
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
**Cause:** Transaction not confirmed within wait rounds.
|
|
329
|
+
|
|
330
|
+
**Fix:**
|
|
331
|
+
```python
|
|
332
|
+
result = algorand.send.payment(PaymentParams(
|
|
333
|
+
sender=sender,
|
|
334
|
+
receiver=receiver,
|
|
335
|
+
amount=AlgoAmount(algo=1),
|
|
336
|
+
max_rounds_to_wait_for_confirmation=10, # Wait longer
|
|
337
|
+
))
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
### Connection Refused
|
|
341
|
+
|
|
342
|
+
```
|
|
343
|
+
fetch failed: ECONNREFUSED
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
**Cause:** Cannot connect to Algorand node.
|
|
347
|
+
|
|
348
|
+
**Fix:**
|
|
349
|
+
1. For LocalNet: Ensure AlgoKit LocalNet is running (`algokit localnet start`)
|
|
350
|
+
2. For public networks: Check internet connection
|
|
351
|
+
3. Verify server URL is correct
|
|
352
|
+
|
|
353
|
+
## Application Errors
|
|
354
|
+
|
|
355
|
+
### Application Not Found
|
|
356
|
+
|
|
357
|
+
```
|
|
358
|
+
application APPID does not exist
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
**Cause:** App ID doesn't exist on the network.
|
|
362
|
+
|
|
363
|
+
**Fix:**
|
|
364
|
+
```python
|
|
365
|
+
app_info = algorand.client.algod.application_info(app_id)
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
### Not Opted Into Application
|
|
369
|
+
|
|
370
|
+
```
|
|
371
|
+
address ADDRESS has not opted in to application APPID
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
**Cause:** Account trying to access local state without opt-in.
|
|
375
|
+
|
|
376
|
+
**Fix:**
|
|
377
|
+
```python
|
|
378
|
+
algorand.send.app_call(AppCallParams(
|
|
379
|
+
sender=user_address,
|
|
380
|
+
app_id=app_id,
|
|
381
|
+
on_complete=OnComplete.OptIn,
|
|
382
|
+
))
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
### Application Creator Only
|
|
386
|
+
|
|
387
|
+
```
|
|
388
|
+
cannot update or delete application: only creator can modify
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
**Cause:** Attempting to modify app without being creator.
|
|
392
|
+
|
|
393
|
+
**Fix:**
|
|
394
|
+
```python
|
|
395
|
+
app_info = algorand.app.get_by_id(app_id)
|
|
396
|
+
if sender != app_info.creator:
|
|
397
|
+
raise Error("Only creator can modify")
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
## Debugging Tips
|
|
401
|
+
|
|
402
|
+
### Enable Verbose Logging
|
|
403
|
+
|
|
404
|
+
```python
|
|
405
|
+
import logging
|
|
406
|
+
logging.getLogger("algokit").setLevel(logging.DEBUG)
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
### Check Transaction Status
|
|
410
|
+
|
|
411
|
+
```python
|
|
412
|
+
# Check pending transaction
|
|
413
|
+
pending = algorand.client.algod.pending_transaction_info(tx_id)
|
|
414
|
+
print("Pool error:", pending.get("pool-error", ""))
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
### Simulate Before Sending
|
|
418
|
+
|
|
419
|
+
```python
|
|
420
|
+
result = algorand.new_group() \
|
|
421
|
+
.add_payment(PaymentParams(sender=sender, receiver=receiver, amount=AlgoAmount(algo=1))) \
|
|
422
|
+
.simulate()
|
|
423
|
+
```
|
|
424
|
+
|
|
425
|
+
## References
|
|
426
|
+
|
|
427
|
+
- [Transaction Structure](https://dev.algorand.co/concepts/transactions/structure/)
|
|
428
|
+
- [Account Management](https://dev.algorand.co/concepts/accounts/)
|
|
429
|
+
- [Asset Overview](https://dev.algorand.co/concepts/assets/)
|
|
430
|
+
- [AlgoKit Utils Debugging](https://dev.algorand.co/algokit/utils/typescript/debugging/)
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Troubleshoot Errors (Python)
|
|
2
|
+
|
|
3
|
+
Diagnose and resolve common Algorand development errors when working with Python and AlgoKit Utils Python.
|
|
4
|
+
|
|
5
|
+
## Error References
|
|
6
|
+
|
|
7
|
+
| Category | Description | Reference |
|
|
8
|
+
|----------|-------------|-----------|
|
|
9
|
+
| Contract Errors | Assert failures, opcode budget, ABI issues, state errors | [troubleshoot-errors-contract.md](./troubleshoot-errors-contract.md) |
|
|
10
|
+
| Transaction Errors | Overspend, invalid params, group issues, asset/account errors | [troubleshoot-errors-transaction.md](./troubleshoot-errors-transaction.md) |
|
|
11
|
+
|
|
12
|
+
## Python Debugging Quick Start
|
|
13
|
+
|
|
14
|
+
### Enable Debug Logging
|
|
15
|
+
|
|
16
|
+
```python
|
|
17
|
+
import logging
|
|
18
|
+
logging.getLogger("algokit").setLevel(logging.DEBUG)
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### Catch and Inspect LogicError
|
|
22
|
+
|
|
23
|
+
```python
|
|
24
|
+
from algokit_utils import LogicError
|
|
25
|
+
|
|
26
|
+
try:
|
|
27
|
+
app_client.send.my_method(value=0)
|
|
28
|
+
except LogicError as e:
|
|
29
|
+
print(e) # Shows: assert failed at contracts/my_contract.py:45
|
|
30
|
+
print(e.pc) # Program counter: 123
|
|
31
|
+
print(e.line) # Source line number
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Check Transaction Status
|
|
35
|
+
|
|
36
|
+
```python
|
|
37
|
+
# Check pending transaction
|
|
38
|
+
pending = algorand.client.algod.pending_transaction_info(tx_id)
|
|
39
|
+
print("Pool error:", pending.get("pool-error", ""))
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## How to Proceed
|
|
43
|
+
|
|
44
|
+
1. **Find your error** in the contract or transaction error references
|
|
45
|
+
2. **Understand the cause** from the explanation
|
|
46
|
+
3. **Apply the Python fix** from the code examples
|