@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.
Files changed (112) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +112 -0
  3. package/index.ts +361 -0
  4. package/lib/mcp-servers.ts +14 -0
  5. package/lib/x402-fetch.ts +213 -0
  6. package/memory/algorand-plugin.md +82 -0
  7. package/openclaw.plugin.json +30 -0
  8. package/package.json +41 -0
  9. package/setup.ts +80 -0
  10. package/skills/algorand-development/SKILL.md +90 -0
  11. package/skills/algorand-development/references/build-smart-contracts-reference.md +79 -0
  12. package/skills/algorand-development/references/build-smart-contracts.md +52 -0
  13. package/skills/algorand-development/references/create-project-reference.md +86 -0
  14. package/skills/algorand-development/references/create-project.md +89 -0
  15. package/skills/algorand-development/references/implement-arc-standards-arc32-arc56.md +396 -0
  16. package/skills/algorand-development/references/implement-arc-standards-arc4.md +265 -0
  17. package/skills/algorand-development/references/implement-arc-standards.md +92 -0
  18. package/skills/algorand-development/references/search-algorand-examples-reference.md +119 -0
  19. package/skills/algorand-development/references/search-algorand-examples.md +89 -0
  20. package/skills/algorand-development/references/troubleshoot-errors-contract.md +373 -0
  21. package/skills/algorand-development/references/troubleshoot-errors-transaction.md +599 -0
  22. package/skills/algorand-development/references/troubleshoot-errors.md +105 -0
  23. package/skills/algorand-development/references/use-algokit-cli-reference.md +228 -0
  24. package/skills/algorand-development/references/use-algokit-cli.md +64 -0
  25. package/skills/algorand-interaction/SKILL.md +223 -0
  26. package/skills/algorand-interaction/references/algorand-mcp.md +743 -0
  27. package/skills/algorand-interaction/references/examples-algorand-mcp.md +647 -0
  28. package/skills/algorand-python/SKILL.md +95 -0
  29. package/skills/algorand-python/references/build-smart-contracts-decorators.md +413 -0
  30. package/skills/algorand-python/references/build-smart-contracts-reference.md +55 -0
  31. package/skills/algorand-python/references/build-smart-contracts-storage.md +452 -0
  32. package/skills/algorand-python/references/build-smart-contracts-transactions.md +445 -0
  33. package/skills/algorand-python/references/build-smart-contracts-types.md +438 -0
  34. package/skills/algorand-python/references/build-smart-contracts.md +82 -0
  35. package/skills/algorand-python/references/create-project-reference.md +55 -0
  36. package/skills/algorand-python/references/create-project.md +75 -0
  37. package/skills/algorand-python/references/implement-arc-standards-arc32-arc56.md +101 -0
  38. package/skills/algorand-python/references/implement-arc-standards-arc4.md +154 -0
  39. package/skills/algorand-python/references/implement-arc-standards.md +39 -0
  40. package/skills/algorand-python/references/troubleshoot-errors-contract.md +355 -0
  41. package/skills/algorand-python/references/troubleshoot-errors-transaction.md +430 -0
  42. package/skills/algorand-python/references/troubleshoot-errors.md +46 -0
  43. package/skills/algorand-python/references/use-algokit-utils-reference.md +350 -0
  44. package/skills/algorand-python/references/use-algokit-utils.md +76 -0
  45. package/skills/algorand-typescript/SKILL.md +131 -0
  46. package/skills/algorand-typescript/references/algorand-ts-migration-from-beta.md +448 -0
  47. package/skills/algorand-typescript/references/algorand-ts-migration-from-tealscript.md +487 -0
  48. package/skills/algorand-typescript/references/algorand-ts-migration.md +102 -0
  49. package/skills/algorand-typescript/references/algorand-typescript-syntax-methods-and-abi.md +134 -0
  50. package/skills/algorand-typescript/references/algorand-typescript-syntax-reference.md +58 -0
  51. package/skills/algorand-typescript/references/algorand-typescript-syntax-storage.md +154 -0
  52. package/skills/algorand-typescript/references/algorand-typescript-syntax-transactions.md +187 -0
  53. package/skills/algorand-typescript/references/algorand-typescript-syntax-types-and-values.md +150 -0
  54. package/skills/algorand-typescript/references/algorand-typescript-syntax.md +84 -0
  55. package/skills/algorand-typescript/references/build-smart-contracts-reference.md +52 -0
  56. package/skills/algorand-typescript/references/build-smart-contracts.md +74 -0
  57. package/skills/algorand-typescript/references/call-smart-contracts-reference.md +237 -0
  58. package/skills/algorand-typescript/references/call-smart-contracts.md +183 -0
  59. package/skills/algorand-typescript/references/create-project-reference.md +53 -0
  60. package/skills/algorand-typescript/references/create-project.md +86 -0
  61. package/skills/algorand-typescript/references/deploy-react-frontend-examples.md +527 -0
  62. package/skills/algorand-typescript/references/deploy-react-frontend-reference.md +412 -0
  63. package/skills/algorand-typescript/references/deploy-react-frontend.md +239 -0
  64. package/skills/algorand-typescript/references/implement-arc-standards-arc32-arc56.md +73 -0
  65. package/skills/algorand-typescript/references/implement-arc-standards-arc4.md +126 -0
  66. package/skills/algorand-typescript/references/implement-arc-standards.md +44 -0
  67. package/skills/algorand-typescript/references/test-smart-contracts-examples.md +245 -0
  68. package/skills/algorand-typescript/references/test-smart-contracts-unit-tests.md +147 -0
  69. package/skills/algorand-typescript/references/test-smart-contracts.md +127 -0
  70. package/skills/algorand-typescript/references/troubleshoot-errors-contract.md +296 -0
  71. package/skills/algorand-typescript/references/troubleshoot-errors-transaction.md +438 -0
  72. package/skills/algorand-typescript/references/troubleshoot-errors.md +56 -0
  73. package/skills/algorand-typescript/references/use-algokit-utils-reference.md +342 -0
  74. package/skills/algorand-typescript/references/use-algokit-utils.md +74 -0
  75. package/skills/algorand-x402-python/SKILL.md +113 -0
  76. package/skills/algorand-x402-python/references/create-python-x402-client-examples.md +469 -0
  77. package/skills/algorand-x402-python/references/create-python-x402-client-reference.md +313 -0
  78. package/skills/algorand-x402-python/references/create-python-x402-client.md +207 -0
  79. package/skills/algorand-x402-python/references/create-python-x402-facilitator-examples.md +924 -0
  80. package/skills/algorand-x402-python/references/create-python-x402-facilitator-reference.md +629 -0
  81. package/skills/algorand-x402-python/references/create-python-x402-facilitator.md +408 -0
  82. package/skills/algorand-x402-python/references/create-python-x402-server-examples.md +703 -0
  83. package/skills/algorand-x402-python/references/create-python-x402-server-reference.md +303 -0
  84. package/skills/algorand-x402-python/references/create-python-x402-server.md +221 -0
  85. package/skills/algorand-x402-python/references/explain-algorand-x402-python-examples.md +605 -0
  86. package/skills/algorand-x402-python/references/explain-algorand-x402-python-reference.md +315 -0
  87. package/skills/algorand-x402-python/references/explain-algorand-x402-python.md +167 -0
  88. package/skills/algorand-x402-python/references/use-python-x402-core-avm-examples.md +554 -0
  89. package/skills/algorand-x402-python/references/use-python-x402-core-avm-reference.md +278 -0
  90. package/skills/algorand-x402-python/references/use-python-x402-core-avm.md +166 -0
  91. package/skills/algorand-x402-typescript/SKILL.md +129 -0
  92. package/skills/algorand-x402-typescript/references/create-typescript-x402-client-examples.md +879 -0
  93. package/skills/algorand-x402-typescript/references/create-typescript-x402-client-reference.md +371 -0
  94. package/skills/algorand-x402-typescript/references/create-typescript-x402-client.md +236 -0
  95. package/skills/algorand-x402-typescript/references/create-typescript-x402-facilitator-examples.md +875 -0
  96. package/skills/algorand-x402-typescript/references/create-typescript-x402-facilitator-reference.md +461 -0
  97. package/skills/algorand-x402-typescript/references/create-typescript-x402-facilitator.md +270 -0
  98. package/skills/algorand-x402-typescript/references/create-typescript-x402-nextjs-examples.md +1181 -0
  99. package/skills/algorand-x402-typescript/references/create-typescript-x402-nextjs-reference.md +360 -0
  100. package/skills/algorand-x402-typescript/references/create-typescript-x402-nextjs.md +251 -0
  101. package/skills/algorand-x402-typescript/references/create-typescript-x402-paywall-examples.md +870 -0
  102. package/skills/algorand-x402-typescript/references/create-typescript-x402-paywall-reference.md +323 -0
  103. package/skills/algorand-x402-typescript/references/create-typescript-x402-paywall.md +281 -0
  104. package/skills/algorand-x402-typescript/references/create-typescript-x402-server-examples.md +1135 -0
  105. package/skills/algorand-x402-typescript/references/create-typescript-x402-server-reference.md +382 -0
  106. package/skills/algorand-x402-typescript/references/create-typescript-x402-server.md +216 -0
  107. package/skills/algorand-x402-typescript/references/explain-algorand-x402-typescript-examples.md +616 -0
  108. package/skills/algorand-x402-typescript/references/explain-algorand-x402-typescript-reference.md +323 -0
  109. package/skills/algorand-x402-typescript/references/explain-algorand-x402-typescript.md +232 -0
  110. package/skills/algorand-x402-typescript/references/use-typescript-x402-core-avm-examples.md +1417 -0
  111. package/skills/algorand-x402-typescript/references/use-typescript-x402-core-avm-reference.md +504 -0
  112. package/skills/algorand-x402-typescript/references/use-typescript-x402-core-avm.md +158 -0
@@ -0,0 +1,599 @@
1
+ # Transaction & Account Errors
2
+
3
+ Common errors when sending transactions and managing accounts on Algorand.
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
+ 1. Fund the sender account
52
+ 2. Reduce transaction amount
53
+ 3. Account for MBR when calculating available balance:
54
+
55
+ ```python
56
+ # Calculate available balance
57
+ account_info = algorand.account.get_information(address)
58
+ available = account_info.amount - account_info.min_balance
59
+ ```
60
+
61
+ ```typescript
62
+ // Calculate available balance
63
+ const accountInfo = await algorand.account.getInformation(address)
64
+ const available = accountInfo.amount - accountInfo.minBalance
65
+ ```
66
+
67
+ ### Transaction Already in Ledger
68
+
69
+ ```
70
+ TransactionPool.Remember: transaction already in ledger: TXID
71
+ ```
72
+
73
+ **Cause:** Duplicate transaction submitted (same txn ID).
74
+
75
+ **Common causes:**
76
+ - Retrying a transaction that already succeeded
77
+ - Using same lease within validity window
78
+ - Network latency causing duplicate submission
79
+
80
+ **Fix:** Check if transaction exists before retrying:
81
+ ```typescript
82
+ try {
83
+ const result = await algorand.client.algod.pendingTransactionInformation(txId).do()
84
+ // Transaction exists
85
+ } catch {
86
+ // Safe to retry
87
+ }
88
+ ```
89
+
90
+ ```python
91
+ try:
92
+ result = algorand.client.algod.pending_transaction_info(tx_id)
93
+ # Transaction exists
94
+ except Exception:
95
+ # Safe to retry
96
+ pass
97
+ ```
98
+
99
+ ### Transaction Pool Full
100
+
101
+ ```
102
+ TransactionPool.Remember: transaction pool is full
103
+ ```
104
+
105
+ **Cause:** Node's transaction pool at capacity.
106
+
107
+ **Fix:**
108
+ 1. Wait and retry with exponential backoff
109
+ 2. Increase fee to prioritize transaction
110
+ 3. Try a different node
111
+
112
+ ### Fee Too Low
113
+
114
+ ```
115
+ TransactionPool.Remember: transaction TXID: fee X below threshold Y
116
+ ```
117
+
118
+ **Cause:** Transaction fee below minimum (usually 1000 microAlgo).
119
+
120
+ **Fix:**
121
+ ```python
122
+ algorand.send.payment(PaymentParams(
123
+ sender=sender,
124
+ receiver=receiver,
125
+ amount=AlgoAmount(algo=1),
126
+ static_fee=AlgoAmount(micro_algo=1000), # Minimum fee
127
+ ))
128
+ ```
129
+
130
+ ```typescript
131
+ await algorand.send.payment({
132
+ sender: sender,
133
+ receiver: receiver,
134
+ amount: algo(1),
135
+ staticFee: microAlgo(1000), // Minimum fee
136
+ })
137
+ ```
138
+
139
+ ### Round Out of Range
140
+
141
+ ```
142
+ TransactionPool.Remember: transaction TXID: round X outside of Y-Z range
143
+ ```
144
+
145
+ **Cause:** Transaction's validity window expired or is in the future.
146
+
147
+ **Fix:**
148
+ ```typescript
149
+ // Set appropriate validity window
150
+ await algorand.send.payment({
151
+ sender: sender,
152
+ receiver: receiver,
153
+ amount: algo(1),
154
+ validityWindow: 1000, // Valid for 1000 rounds (~1 hour)
155
+ })
156
+ ```
157
+
158
+ ```python
159
+ algorand.send.payment(PaymentParams(
160
+ sender=sender,
161
+ receiver=receiver,
162
+ amount=AlgoAmount(algo=1),
163
+ validity_window=1000, # Valid for 1000 rounds (~1 hour)
164
+ ))
165
+ ```
166
+
167
+ ### Invalid Group
168
+
169
+ ```
170
+ TransactionPool.Remember: transaction TXID: bad group assignment
171
+ ```
172
+
173
+ **Cause:** Transaction claims to be part of a group but has wrong group ID.
174
+
175
+ **Fix:** Use AlgoKit Utils for proper grouping:
176
+ ```typescript
177
+ // Correct grouping
178
+ await algorand
179
+ .newGroup()
180
+ .addPayment({ sender, receiver, amount: algo(1) })
181
+ .addAssetOptIn({ sender, assetId: 12345n })
182
+ .send()
183
+ ```
184
+
185
+ ```python
186
+ # Correct grouping
187
+ algorand.new_group()
188
+ .add_payment(PaymentParams(sender=sender, receiver=receiver, amount=AlgoAmount(algo=1)))
189
+ .add_asset_opt_in(AssetOptInParams(sender=sender, asset_id=12345))
190
+ .send()
191
+ ```
192
+
193
+ ### Group Size Limit
194
+
195
+ ```
196
+ cannot send transaction group with more than 16 transactions
197
+ ```
198
+
199
+ **Cause:** Transaction group exceeds 16 transaction limit.
200
+
201
+ **Fix:** Split into multiple groups or optimize to fewer transactions.
202
+
203
+ ## Asset Errors
204
+
205
+ ### Asset Not Found
206
+
207
+ ```
208
+ asset ASSET_ID does not exist
209
+ ```
210
+
211
+ **Cause:** Asset ID doesn't exist on the network.
212
+
213
+ **Common causes:**
214
+ - Wrong network (TestNet vs MainNet)
215
+ - Asset was deleted
216
+ - Typo in asset ID
217
+
218
+ **Fix:** Verify asset exists:
219
+ ```typescript
220
+ const assetInfo = await algorand.client.algod.getAssetByID(assetId).do()
221
+ ```
222
+
223
+ ```python
224
+ asset_info = algorand.client.algod.asset_info(asset_id)
225
+ ```
226
+
227
+ ### Asset Not Opted In
228
+
229
+ ```
230
+ asset ASSET_ID missing from ACCOUNT_ADDRESS
231
+ ```
232
+
233
+ **Cause:** Receiving account hasn't opted into the asset.
234
+
235
+ **Fix:** Opt in before transfer:
236
+ ```python
237
+ algorand.send.asset_opt_in(AssetOptInParams(
238
+ sender=receiver_address,
239
+ asset_id=asset_id,
240
+ ))
241
+ ```
242
+
243
+ ```typescript
244
+ await algorand.send.assetOptIn({
245
+ sender: receiverAddress,
246
+ assetId: assetId,
247
+ })
248
+ ```
249
+
250
+ ### Asset Frozen
251
+
252
+ ```
253
+ asset ASSET_ID frozen in ACCOUNT_ADDRESS
254
+ ```
255
+
256
+ **Cause:** Account's holding of this asset is frozen.
257
+
258
+ **Fix:** Asset freeze manager must unfreeze the account.
259
+
260
+ ### Clawback Not Authorized
261
+
262
+ ```
263
+ only clawback address can clawback
264
+ ```
265
+
266
+ **Cause:** Attempting clawback without being the clawback address.
267
+
268
+ **Fix:** Only the designated clawback address can perform clawbacks.
269
+
270
+ ### Cannot Close Asset
271
+
272
+ ```
273
+ cannot close asset: ACCOUNT_ADDRESS still has X units
274
+ ```
275
+
276
+ **Cause:** Trying to opt out while still holding units.
277
+
278
+ **Fix:** Transfer all units before opting out:
279
+ ```python
280
+ # First transfer all units
281
+ algorand.send.asset_transfer(AssetTransferParams(
282
+ sender=account,
283
+ receiver=creator_or_other,
284
+ asset_id=asset_id,
285
+ amount=balance, # All remaining
286
+ ))
287
+
288
+ # Then opt out
289
+ algorand.send.asset_opt_out(AssetOptOutParams(
290
+ sender=account,
291
+ asset_id=asset_id,
292
+ creator=creator_address,
293
+ ))
294
+ ```
295
+
296
+ ```typescript
297
+ // First transfer all units
298
+ await algorand.send.assetTransfer({
299
+ sender: account,
300
+ receiver: creatorOrOther,
301
+ assetId: assetId,
302
+ amount: balance, // All remaining
303
+ })
304
+
305
+ // Then opt out
306
+ await algorand.send.assetOptOut({
307
+ sender: account,
308
+ assetId: assetId,
309
+ creator: creatorAddress,
310
+ })
311
+ ```
312
+
313
+ ## Account Errors
314
+
315
+ ### Account Not Found
316
+
317
+ ```
318
+ account ADDRESS not found
319
+ ```
320
+
321
+ **Cause:** Account doesn't exist (never funded).
322
+
323
+ **Note:** Algorand accounts must receive at least minimum balance to exist.
324
+
325
+ **Fix:** Fund the account:
326
+ ```python
327
+ algorand.send.payment(PaymentParams(
328
+ sender=funder.address,
329
+ receiver=new_account.address,
330
+ amount=AlgoAmount(micro_algo=100_000), # Minimum
331
+ ))
332
+ ```
333
+
334
+ ```typescript
335
+ await algorand.send.payment({
336
+ sender: funder.address,
337
+ receiver: newAccount.address,
338
+ amount: microAlgo(100_000), // Minimum
339
+ })
340
+ ```
341
+
342
+ ### Invalid Address
343
+
344
+ ```
345
+ invalid address: ADDRESS
346
+ ```
347
+
348
+ **Cause:** Malformed Algorand address.
349
+
350
+ **Valid address format:**
351
+ - 58 characters
352
+ - Base32 encoded
353
+ - Includes checksum
354
+
355
+ **Verify address:**
356
+ ```typescript
357
+ import { isValidAddress } from 'algosdk'
358
+ if (!isValidAddress(address)) {
359
+ throw new Error('Invalid address')
360
+ }
361
+ ```
362
+
363
+ ```python
364
+ from algosdk import encoding
365
+ if not encoding.is_valid_address(address):
366
+ raise ValueError("Invalid address")
367
+ ```
368
+
369
+ ### Wrong Network
370
+
371
+ ```
372
+ genesis hash mismatch
373
+ ```
374
+
375
+ **Cause:** Transaction built for different network than target.
376
+
377
+ **Fix:** Ensure AlgorandClient connects to correct network:
378
+ ```typescript
379
+ // For TestNet
380
+ const algorand = AlgorandClient.testNet()
381
+
382
+ // For MainNet
383
+ const algorand = AlgorandClient.mainNet()
384
+
385
+ // Check network
386
+ const params = await algorand.client.algod.getTransactionParams().do()
387
+ console.log('Network:', params.genesisID) // testnet-v1.0, mainnet-v1.0
388
+ ```
389
+
390
+ ```python
391
+ # For TestNet
392
+ algorand = AlgorandClient.test_net()
393
+
394
+ # For MainNet
395
+ algorand = AlgorandClient.main_net()
396
+ ```
397
+
398
+ ## SDK Errors
399
+
400
+ ### AlgodHTTPError
401
+
402
+ ```
403
+ AlgodHTTPError: Network request error. Received status 401
404
+ ```
405
+
406
+ **Common status codes:**
407
+ | Status | Meaning | Fix |
408
+ |--------|---------|-----|
409
+ | 401 | Unauthorized | Check API token |
410
+ | 404 | Not found | Check server URL |
411
+ | 500 | Server error | Node issue, retry |
412
+ | 503 | Unavailable | Node overloaded, retry |
413
+
414
+ **Fix for 401:**
415
+ ```python
416
+ algorand = AlgorandClient.from_config(
417
+ algod_config=AlgoClientNetworkConfig(
418
+ server="https://testnet-api.algonode.cloud",
419
+ port="443",
420
+ token="", # AlgoNode doesn't require token
421
+ )
422
+ )
423
+ ```
424
+
425
+ ```typescript
426
+ const algorand = AlgorandClient.fromConfig({
427
+ algodConfig: {
428
+ server: 'https://testnet-api.algonode.cloud',
429
+ port: '443',
430
+ token: '', // AlgoNode doesn't require token
431
+ }
432
+ })
433
+ ```
434
+
435
+ ### Timeout Waiting for Confirmation
436
+
437
+ ```
438
+ Timeout waiting for transaction TXID to be confirmed
439
+ ```
440
+
441
+ **Cause:** Transaction not confirmed within wait rounds.
442
+
443
+ **Possible reasons:**
444
+ - Transaction rejected (check node logs)
445
+ - Fee too low during congestion
446
+ - Network issues
447
+
448
+ **Fix:** Increase wait time or check status:
449
+ ```typescript
450
+ const result = await algorand.send.payment(
451
+ { sender, receiver, amount: algo(1) },
452
+ { maxRoundsToWaitForConfirmation: 10 } // Wait longer
453
+ )
454
+ ```
455
+
456
+ ```python
457
+ result = algorand.send.payment(PaymentParams(
458
+ sender=sender,
459
+ receiver=receiver,
460
+ amount=AlgoAmount(algo=1),
461
+ max_rounds_to_wait_for_confirmation=10, # Wait longer
462
+ ))
463
+ ```
464
+
465
+ ### Connection Refused
466
+
467
+ ```
468
+ fetch failed: ECONNREFUSED
469
+ ```
470
+
471
+ **Cause:** Cannot connect to Algorand node.
472
+
473
+ **Fix:**
474
+ 1. For LocalNet: Ensure AlgoKit LocalNet is running (`algokit localnet start`)
475
+ 2. For public networks: Check internet connection
476
+ 3. Verify server URL is correct
477
+
478
+ ## Application Errors
479
+
480
+ ### Application Not Found
481
+
482
+ ```
483
+ application APPID does not exist
484
+ ```
485
+
486
+ **Cause:** App ID doesn't exist on the network.
487
+
488
+ **Fix:** Verify app exists or deploy it:
489
+ ```typescript
490
+ const appInfo = await algorand.client.algod.getApplicationByID(appId).do()
491
+ ```
492
+
493
+ ```python
494
+ app_info = algorand.client.algod.application_info(app_id)
495
+ ```
496
+
497
+ ### Not Opted Into Application
498
+
499
+ ```
500
+ address ADDRESS has not opted in to application APPID
501
+ ```
502
+
503
+ **Cause:** Account trying to access local state without opt-in.
504
+
505
+ **Fix:**
506
+ ```python
507
+ algorand.send.app_call(AppCallParams(
508
+ sender=user_address,
509
+ app_id=app_id,
510
+ on_complete=OnComplete.OptIn,
511
+ ))
512
+ ```
513
+
514
+ ```typescript
515
+ await algorand.send.appCall({
516
+ sender: userAddress,
517
+ appId: appId,
518
+ onComplete: OnComplete.OptIn,
519
+ })
520
+ ```
521
+
522
+ ### Application Creator Only
523
+
524
+ ```
525
+ cannot update or delete application: only creator can modify
526
+ ```
527
+
528
+ **Cause:** Attempting to modify app without being creator.
529
+
530
+ **Fix:** Only the app creator can update/delete. Check creator:
531
+ ```python
532
+ app_info = algorand.app.get_by_id(app_id)
533
+ if sender != app_info.creator:
534
+ raise Error("Only creator can modify")
535
+ ```
536
+
537
+ ```typescript
538
+ const appInfo = await algorand.app.getById(appId)
539
+ if (sender !== appInfo.creator) {
540
+ throw new Error('Only creator can modify')
541
+ }
542
+ ```
543
+
544
+ ## Debugging Tips
545
+
546
+ ### Enable Verbose Logging
547
+
548
+ ```typescript
549
+ import { Config } from '@algorandfoundation/algokit-utils'
550
+ Config.configure({ debug: true })
551
+ ```
552
+
553
+ ```python
554
+ import logging
555
+ logging.getLogger("algokit").setLevel(logging.DEBUG)
556
+ ```
557
+
558
+ ### Check Transaction Status
559
+
560
+ ```typescript
561
+ // Check pending transaction
562
+ const pending = await algorand.client.algod.pendingTransactionInformation(txId).do()
563
+ console.log('Pool error:', pending.poolError)
564
+
565
+ // Check confirmed transaction
566
+ const confirmed = await algorand.client.indexer.lookupTransactionByID(txId).do()
567
+ ```
568
+
569
+ ```python
570
+ # Check pending transaction
571
+ pending = algorand.client.algod.pending_transaction_info(tx_id)
572
+ print("Pool error:", pending.get("pool-error", ""))
573
+ ```
574
+
575
+ ### Simulate Before Sending
576
+
577
+ ```typescript
578
+ const result = await algorand
579
+ .newGroup()
580
+ .addPayment({ sender, receiver, amount: algo(1) })
581
+ .simulate()
582
+
583
+ if (result.simulateResponse.txnGroups[0].failureMessage) {
584
+ console.error('Would fail:', result.simulateResponse.txnGroups[0].failureMessage)
585
+ }
586
+ ```
587
+
588
+ ```python
589
+ result = algorand.new_group() \
590
+ .add_payment(PaymentParams(sender=sender, receiver=receiver, amount=AlgoAmount(algo=1))) \
591
+ .simulate()
592
+ ```
593
+
594
+ ## References
595
+
596
+ - [Transaction Structure](https://dev.algorand.co/concepts/transactions/structure/)
597
+ - [Account Management](https://dev.algorand.co/concepts/accounts/)
598
+ - [Asset Overview](https://dev.algorand.co/concepts/assets/)
599
+ - [AlgoKit Utils Debugging](https://dev.algorand.co/algokit/utils/typescript/debugging/)
@@ -0,0 +1,105 @@
1
+ # Troubleshoot Errors
2
+
3
+ Diagnose and resolve common Algorand development errors.
4
+
5
+ ## Error Categories
6
+
7
+ | Category | Common Causes | Reference |
8
+ |----------|---------------|-----------|
9
+ | Contract Errors | Assert failures, opcode budget, invalid operations, ABI issues, state errors | [troubleshoot-errors-contract.md](./troubleshoot-errors-contract.md) |
10
+ | Transaction Errors | Overspend, invalid params, group issues, asset errors, SDK errors | [troubleshoot-errors-transaction.md](./troubleshoot-errors-transaction.md) |
11
+
12
+ ## Quick Diagnosis Flow
13
+
14
+ 1. **Identify the error type** from the message
15
+ 2. **Check the error code** if present (e.g., `pc=123`)
16
+ 3. **Find the root cause** using the reference docs
17
+ 4. **Apply the fix** from the common solutions
18
+
19
+ ## Common Error Patterns
20
+
21
+ ### Logic Eval Error (Contract Failure)
22
+
23
+ ```
24
+ logic eval error: assert failed pc=123
25
+ ```
26
+
27
+ **Cause:** An `assert` statement in the smart contract evaluated to false.
28
+
29
+ **Debug steps:**
30
+ 1. The `pc=123` indicates the program counter where failure occurred
31
+ 2. Use source maps to find the exact line in your code
32
+ 3. Check the assertion condition and input values
33
+ 4. Use AlgoKit Utils LogicError for automatic source mapping
34
+
35
+ ### Transaction Rejected (Overspend)
36
+
37
+ ```
38
+ TransactionPool.Remember: transaction TXID: overspend
39
+ ```
40
+
41
+ **Cause:** Sender account has insufficient balance for amount + fee + minimum balance requirement.
42
+
43
+ **Debug steps:**
44
+ 1. Check the sender's account balance
45
+ 2. Calculate the minimum balance requirement (base 100,000 microAlgo + opted-in assets/apps)
46
+ 3. Ensure `available balance = total balance - minimum balance` covers the transaction amount + fee
47
+
48
+ ### Opcode Budget Exceeded
49
+
50
+ ```
51
+ logic eval error: dynamic cost budget exceeded
52
+ ```
53
+
54
+ **Cause:** Contract exceeded the 700 opcode budget per app call.
55
+
56
+ **Solutions:**
57
+ - Add more app calls to the group for additional budget (pooled up to 11,200 with 16 calls)
58
+ - Optimize contract logic to reduce operations
59
+ - Split complex operations across multiple calls
60
+
61
+ ### Asset Not Opted In
62
+
63
+ ```
64
+ asset ASSET_ID missing from ACCOUNT_ADDRESS
65
+ ```
66
+
67
+ **Cause:** The receiving account has not opted into the asset.
68
+
69
+ **Solution:** Have the receiver send a 0-amount asset transfer to themselves before any transfers are attempted.
70
+
71
+ ### Application Not Opted In
72
+
73
+ ```
74
+ address ADDRESS has not opted in to application APPID
75
+ ```
76
+
77
+ **Cause:** Account trying to access local state without opting in to the application.
78
+
79
+ **Solution:** The account must send an opt-in transaction (OnComplete.OptIn) before local state can be accessed.
80
+
81
+ ### SDK Connection Errors
82
+
83
+ ```
84
+ AlgodHTTPError: Network request error. Received status 401
85
+ ```
86
+
87
+ **Cause:** Authentication or connectivity issue with the Algorand node.
88
+
89
+ **Debug steps:**
90
+ 1. Check the API token configuration
91
+ 2. Verify the server URL is correct
92
+ 3. Ensure the node is running (for LocalNet: `algokit localnet start`)
93
+
94
+ ## How to Proceed
95
+
96
+ 1. **Find your error** in the category references above
97
+ 2. **Understand the cause** from the explanation
98
+ 3. **Apply the solution** from the code examples
99
+
100
+ ## References
101
+
102
+ - [Contract Errors Reference](./troubleshoot-errors-contract.md) - Smart contract and logic errors
103
+ - [Transaction Errors Reference](./troubleshoot-errors-transaction.md) - Transaction and account errors
104
+ - [Debugging Guide](https://dev.algorand.co/concepts/smart-contracts/debugging/)
105
+ - [Error Handling in AlgoKit Utils](https://dev.algorand.co/algokit/utils/typescript/debugging/)