arc-devkit 0.4.3__tar.gz → 0.4.5__tar.gz
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.
- {arc_devkit-0.4.3 → arc_devkit-0.4.5}/PKG-INFO +73 -47
- {arc_devkit-0.4.3 → arc_devkit-0.4.5}/README.md +72 -46
- {arc_devkit-0.4.3 → arc_devkit-0.4.5}/arc_devkit/__init__.py +2 -1
- {arc_devkit-0.4.3 → arc_devkit-0.4.5}/arc_devkit/agents/async_monitor.py +2 -2
- {arc_devkit-0.4.3 → arc_devkit-0.4.5}/arc_devkit/agents/payment_agent.py +1 -1
- {arc_devkit-0.4.3 → arc_devkit-0.4.5}/arc_devkit/analytics/portfolio.py +2 -2
- {arc_devkit-0.4.3 → arc_devkit-0.4.5}/arc_devkit/api/routes/agents.py +1 -1
- {arc_devkit-0.4.3 → arc_devkit-0.4.5}/arc_devkit/cli/commands/debug.py +21 -0
- {arc_devkit-0.4.3 → arc_devkit-0.4.5}/arc_devkit/cli/main.py +27 -0
- {arc_devkit-0.4.3 → arc_devkit-0.4.5}/arc_devkit/deploy/deployer.py +1 -1
- {arc_devkit-0.4.3 → arc_devkit-0.4.5}/arc_devkit.egg-info/PKG-INFO +73 -47
- {arc_devkit-0.4.3 → arc_devkit-0.4.5}/pyproject.toml +1 -1
- {arc_devkit-0.4.3 → arc_devkit-0.4.5}/tests/test_agents.py +0 -1
- {arc_devkit-0.4.3 → arc_devkit-0.4.5}/tests/test_analytics.py +2 -5
- {arc_devkit-0.4.3 → arc_devkit-0.4.5}/tests/test_async_agents.py +4 -5
- {arc_devkit-0.4.3 → arc_devkit-0.4.5}/tests/test_cli.py +1 -5
- {arc_devkit-0.4.3 → arc_devkit-0.4.5}/tests/test_contracts.py +3 -3
- {arc_devkit-0.4.3 → arc_devkit-0.4.5}/tests/test_debugger.py +2 -5
- {arc_devkit-0.4.3 → arc_devkit-0.4.5}/tests/test_deploy.py +0 -1
- {arc_devkit-0.4.3 → arc_devkit-0.4.5}/tests/test_events.py +3 -2
- {arc_devkit-0.4.3 → arc_devkit-0.4.5}/tests/test_usdc.py +4 -3
- {arc_devkit-0.4.3 → arc_devkit-0.4.5}/arc_devkit/agents/__init__.py +0 -0
- {arc_devkit-0.4.3 → arc_devkit-0.4.5}/arc_devkit/agents/async_base.py +0 -0
- {arc_devkit-0.4.3 → arc_devkit-0.4.5}/arc_devkit/agents/base_agent.py +0 -0
- {arc_devkit-0.4.3 → arc_devkit-0.4.5}/arc_devkit/agents/monitor_agent.py +0 -0
- {arc_devkit-0.4.3 → arc_devkit-0.4.5}/arc_devkit/analytics/__init__.py +0 -0
- {arc_devkit-0.4.3 → arc_devkit-0.4.5}/arc_devkit/api/__init__.py +0 -0
- {arc_devkit-0.4.3 → arc_devkit-0.4.5}/arc_devkit/api/main.py +0 -0
- {arc_devkit-0.4.3 → arc_devkit-0.4.5}/arc_devkit/api/routes/__init__.py +0 -0
- {arc_devkit-0.4.3 → arc_devkit-0.4.5}/arc_devkit/api/routes/copilot.py +0 -0
- {arc_devkit-0.4.3 → arc_devkit-0.4.5}/arc_devkit/api/routes/debugger.py +0 -0
- {arc_devkit-0.4.3 → arc_devkit-0.4.5}/arc_devkit/cli/__init__.py +0 -0
- {arc_devkit-0.4.3 → arc_devkit-0.4.5}/arc_devkit/cli/commands/__init__.py +0 -0
- {arc_devkit-0.4.3 → arc_devkit-0.4.5}/arc_devkit/cli/commands/agent.py +0 -0
- {arc_devkit-0.4.3 → arc_devkit-0.4.5}/arc_devkit/cli/commands/copilot.py +0 -0
- {arc_devkit-0.4.3 → arc_devkit-0.4.5}/arc_devkit/cli/flat.py +0 -0
- {arc_devkit-0.4.3 → arc_devkit-0.4.5}/arc_devkit/config.py +0 -0
- {arc_devkit-0.4.3 → arc_devkit-0.4.5}/arc_devkit/contracts/__init__.py +0 -0
- {arc_devkit-0.4.3 → arc_devkit-0.4.5}/arc_devkit/contracts/loader.py +0 -0
- {arc_devkit-0.4.3 → arc_devkit-0.4.5}/arc_devkit/copilot/__init__.py +0 -0
- {arc_devkit-0.4.3 → arc_devkit-0.4.5}/arc_devkit/copilot/agent.py +0 -0
- {arc_devkit-0.4.3 → arc_devkit-0.4.5}/arc_devkit/core/__init__.py +0 -0
- {arc_devkit-0.4.3 → arc_devkit-0.4.5}/arc_devkit/core/connection.py +0 -0
- {arc_devkit-0.4.3 → arc_devkit-0.4.5}/arc_devkit/core/gas.py +0 -0
- {arc_devkit-0.4.3 → arc_devkit-0.4.5}/arc_devkit/core/wallet.py +0 -0
- {arc_devkit-0.4.3 → arc_devkit-0.4.5}/arc_devkit/debugger/__init__.py +0 -0
- {arc_devkit-0.4.3 → arc_devkit-0.4.5}/arc_devkit/debugger/tx_analyzer.py +0 -0
- {arc_devkit-0.4.3 → arc_devkit-0.4.5}/arc_devkit/deploy/__init__.py +0 -0
- {arc_devkit-0.4.3 → arc_devkit-0.4.5}/arc_devkit/events/__init__.py +0 -0
- {arc_devkit-0.4.3 → arc_devkit-0.4.5}/arc_devkit/events/listener.py +0 -0
- {arc_devkit-0.4.3 → arc_devkit-0.4.5}/arc_devkit/usdc/__init__.py +0 -0
- {arc_devkit-0.4.3 → arc_devkit-0.4.5}/arc_devkit/usdc/token.py +0 -0
- {arc_devkit-0.4.3 → arc_devkit-0.4.5}/arc_devkit.egg-info/SOURCES.txt +0 -0
- {arc_devkit-0.4.3 → arc_devkit-0.4.5}/arc_devkit.egg-info/dependency_links.txt +0 -0
- {arc_devkit-0.4.3 → arc_devkit-0.4.5}/arc_devkit.egg-info/entry_points.txt +0 -0
- {arc_devkit-0.4.3 → arc_devkit-0.4.5}/arc_devkit.egg-info/requires.txt +0 -0
- {arc_devkit-0.4.3 → arc_devkit-0.4.5}/arc_devkit.egg-info/top_level.txt +0 -0
- {arc_devkit-0.4.3 → arc_devkit-0.4.5}/setup.cfg +0 -0
- {arc_devkit-0.4.3 → arc_devkit-0.4.5}/tests/test_api.py +0 -0
- {arc_devkit-0.4.3 → arc_devkit-0.4.5}/tests/test_connection.py +0 -0
- {arc_devkit-0.4.3 → arc_devkit-0.4.5}/tests/test_copilot.py +0 -0
- {arc_devkit-0.4.3 → arc_devkit-0.4.5}/tests/test_integration.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: arc-devkit
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.5
|
|
4
4
|
Summary: Plataforma open source de ferramentas para desenvolvedores da Arc blockchain (Circle)
|
|
5
5
|
Author-email: Jeielsantosdev <jeielsantos.ti@gmail.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -88,10 +88,10 @@ cp .env.example .env
|
|
|
88
88
|
# ARC_PRIVATE_KEY — optional; needed to send transactions
|
|
89
89
|
|
|
90
90
|
# 3. Guided interactive setup (creates .env from scratch)
|
|
91
|
-
|
|
91
|
+
arcdevkit init
|
|
92
92
|
|
|
93
93
|
# 4. Verify connection
|
|
94
|
-
|
|
94
|
+
arcdevkit status
|
|
95
95
|
```
|
|
96
96
|
|
|
97
97
|
```
|
|
@@ -130,10 +130,10 @@ AI assistant powered by Claude Sonnet, with Arc blockchain context embedded in t
|
|
|
130
130
|
|
|
131
131
|
```bash
|
|
132
132
|
# Ask a question
|
|
133
|
-
|
|
133
|
+
arcdevkit copilot ask "How do I deploy an ERC-20 contract on Arc testnet?"
|
|
134
134
|
|
|
135
135
|
# Streaming output (token by token)
|
|
136
|
-
|
|
136
|
+
arcdevkit copilot ask "Write a USDC payment contract in Solidity" --stream
|
|
137
137
|
```
|
|
138
138
|
|
|
139
139
|
### Python
|
|
@@ -349,16 +349,16 @@ Fetches transaction data via RPC, decodes the error/result, and uses the Dev Cop
|
|
|
349
349
|
|
|
350
350
|
```bash
|
|
351
351
|
# Analyze a transaction
|
|
352
|
-
|
|
352
|
+
arcdevkit debug tx 0xYourTxHashHere
|
|
353
353
|
|
|
354
354
|
# Load an ABI to decode input data
|
|
355
|
-
|
|
355
|
+
arcdevkit debug tx 0xYourTxHash --abi ./MyContract.abi.json
|
|
356
356
|
|
|
357
357
|
# Batch — analyze a file of hashes (one per line)
|
|
358
|
-
|
|
358
|
+
arcdevkit debug batch hashes.txt
|
|
359
359
|
|
|
360
|
-
# View recent
|
|
361
|
-
|
|
360
|
+
# View recent operation history
|
|
361
|
+
arcdevkit history
|
|
362
362
|
```
|
|
363
363
|
|
|
364
364
|
```python
|
|
@@ -395,10 +395,13 @@ Snapshot a wallet's complete state and activity on Arc, with AI commentary.
|
|
|
395
395
|
|
|
396
396
|
```bash
|
|
397
397
|
# Analyze a single wallet
|
|
398
|
-
|
|
398
|
+
arcdevkit portfolio analyze 0xYourWalletAddress
|
|
399
|
+
|
|
400
|
+
# Show saved balance history
|
|
401
|
+
arcdevkit portfolio history 0xYourWalletAddress
|
|
399
402
|
|
|
400
403
|
# Generate a consolidated report for multiple wallets
|
|
401
|
-
|
|
404
|
+
arcdevkit portfolio report wallets.json
|
|
402
405
|
```
|
|
403
406
|
|
|
404
407
|
```python
|
|
@@ -593,54 +596,77 @@ The `docker-compose.yml` mounts your `.env` and runs the API on port 8000 with a
|
|
|
593
596
|
|
|
594
597
|
## CLI Reference
|
|
595
598
|
|
|
596
|
-
|
|
599
|
+
The primary entry point is `arcdevkit`, with commands grouped by domain.
|
|
597
600
|
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
601
|
+
### Setup
|
|
602
|
+
|
|
603
|
+
```bash
|
|
604
|
+
arcdevkit init # interactive .env wizard
|
|
605
|
+
arcdevkit status # check testnet connection + block info
|
|
606
|
+
```
|
|
607
|
+
|
|
608
|
+
### Config — manage `.env`
|
|
609
|
+
|
|
610
|
+
```bash
|
|
611
|
+
arcdevkit config list # show all variables
|
|
612
|
+
arcdevkit config get ANTHROPIC_API_KEY # read a specific variable
|
|
613
|
+
arcdevkit config set ARC_RPC_URL https://...# write a variable
|
|
614
|
+
```
|
|
615
|
+
|
|
616
|
+
### Copilot — AI assistant
|
|
602
617
|
|
|
603
|
-
|
|
618
|
+
```bash
|
|
619
|
+
arcdevkit copilot ask "What is Malachite consensus?"
|
|
620
|
+
arcdevkit copilot ask "Write a USDC vault" --stream # token-by-token streaming
|
|
621
|
+
arcdevkit copilot ask "..." --json # output as JSON
|
|
622
|
+
```
|
|
623
|
+
|
|
624
|
+
### Agent — wallet & payments
|
|
604
625
|
|
|
605
626
|
```bash
|
|
606
|
-
#
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
627
|
+
arcdevkit agent create-wallet # generate new EVM wallet
|
|
628
|
+
arcdevkit agent balance 0xAddress... # check wallet balance
|
|
629
|
+
arcdevkit agent status # network info (block, chain ID, gas)
|
|
630
|
+
arcdevkit agent pay 0xDest... 5.0 # sign-only (safe default)
|
|
631
|
+
arcdevkit agent pay 0xDest... 5.0 --send # sign and broadcast
|
|
632
|
+
arcdevkit agent pay 0xDest... 5.0 --send --key 0xPrivKey...
|
|
633
|
+
arcdevkit agent monitor 0xWallet... # watch balance changes
|
|
634
|
+
arcdevkit agent monitor 0xWallet... --interval 5 --max 50
|
|
635
|
+
```
|
|
612
636
|
|
|
613
|
-
|
|
614
|
-
arc wallet create # generate new wallet
|
|
615
|
-
arc wallet balance --address 0x... # check balance
|
|
637
|
+
### Debug — transaction analysis
|
|
616
638
|
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
639
|
+
```bash
|
|
640
|
+
arcdevkit debug tx 0xHash... # analyze a transaction with AI
|
|
641
|
+
arcdevkit debug tx 0xHash... --json
|
|
642
|
+
arcdevkit debug estimate 0xDest... 10.0 # estimate gas cost
|
|
643
|
+
arcdevkit debug estimate 0xDest... 10.0 --from 0xSender...
|
|
644
|
+
arcdevkit debug batch hashes.txt # analyze multiple txs from a file
|
|
645
|
+
arcdevkit debug batch hashes.txt --abi MyContract.json
|
|
646
|
+
```
|
|
621
647
|
|
|
622
|
-
|
|
623
|
-
arc debug tx 0xHash
|
|
624
|
-
arc debug tx 0xHash --abi Contract.json
|
|
625
|
-
arc history # list recent debug sessions
|
|
648
|
+
### Portfolio — wallet analytics
|
|
626
649
|
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
650
|
+
```bash
|
|
651
|
+
arcdevkit portfolio analyze 0xWallet... # balances, txs, AI insights
|
|
652
|
+
arcdevkit portfolio analyze 0xWallet... --no-ai --blocks 500
|
|
653
|
+
arcdevkit portfolio history 0xWallet... # saved balance snapshots
|
|
654
|
+
arcdevkit portfolio report wallets.json # consolidated multi-wallet report
|
|
655
|
+
```
|
|
656
|
+
|
|
657
|
+
### Codegen — script generation
|
|
630
658
|
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
659
|
+
```bash
|
|
660
|
+
arcdevkit codegen "monitor a wallet and alert when balance drops"
|
|
661
|
+
arcdevkit codegen "deploy an ERC-20 with a mint function" --out ./scripts
|
|
662
|
+
arcdevkit codegen "..." --no-save # print only, don't save to disk
|
|
634
663
|
```
|
|
635
664
|
|
|
636
|
-
###
|
|
665
|
+
### History — operation log
|
|
637
666
|
|
|
638
667
|
```bash
|
|
639
|
-
arcdevkit
|
|
640
|
-
arcdevkit
|
|
641
|
-
arcdevkit agent wallet create
|
|
642
|
-
arcdevkit agent pay --to 0x... --amount 10
|
|
643
|
-
arcdevkit debug tx 0xHash
|
|
668
|
+
arcdevkit history # last 10 CLI operations
|
|
669
|
+
arcdevkit history --limit 25 --json
|
|
644
670
|
```
|
|
645
671
|
|
|
646
672
|
---
|
|
@@ -49,10 +49,10 @@ cp .env.example .env
|
|
|
49
49
|
# ARC_PRIVATE_KEY — optional; needed to send transactions
|
|
50
50
|
|
|
51
51
|
# 3. Guided interactive setup (creates .env from scratch)
|
|
52
|
-
|
|
52
|
+
arcdevkit init
|
|
53
53
|
|
|
54
54
|
# 4. Verify connection
|
|
55
|
-
|
|
55
|
+
arcdevkit status
|
|
56
56
|
```
|
|
57
57
|
|
|
58
58
|
```
|
|
@@ -91,10 +91,10 @@ AI assistant powered by Claude Sonnet, with Arc blockchain context embedded in t
|
|
|
91
91
|
|
|
92
92
|
```bash
|
|
93
93
|
# Ask a question
|
|
94
|
-
|
|
94
|
+
arcdevkit copilot ask "How do I deploy an ERC-20 contract on Arc testnet?"
|
|
95
95
|
|
|
96
96
|
# Streaming output (token by token)
|
|
97
|
-
|
|
97
|
+
arcdevkit copilot ask "Write a USDC payment contract in Solidity" --stream
|
|
98
98
|
```
|
|
99
99
|
|
|
100
100
|
### Python
|
|
@@ -310,16 +310,16 @@ Fetches transaction data via RPC, decodes the error/result, and uses the Dev Cop
|
|
|
310
310
|
|
|
311
311
|
```bash
|
|
312
312
|
# Analyze a transaction
|
|
313
|
-
|
|
313
|
+
arcdevkit debug tx 0xYourTxHashHere
|
|
314
314
|
|
|
315
315
|
# Load an ABI to decode input data
|
|
316
|
-
|
|
316
|
+
arcdevkit debug tx 0xYourTxHash --abi ./MyContract.abi.json
|
|
317
317
|
|
|
318
318
|
# Batch — analyze a file of hashes (one per line)
|
|
319
|
-
|
|
319
|
+
arcdevkit debug batch hashes.txt
|
|
320
320
|
|
|
321
|
-
# View recent
|
|
322
|
-
|
|
321
|
+
# View recent operation history
|
|
322
|
+
arcdevkit history
|
|
323
323
|
```
|
|
324
324
|
|
|
325
325
|
```python
|
|
@@ -356,10 +356,13 @@ Snapshot a wallet's complete state and activity on Arc, with AI commentary.
|
|
|
356
356
|
|
|
357
357
|
```bash
|
|
358
358
|
# Analyze a single wallet
|
|
359
|
-
|
|
359
|
+
arcdevkit portfolio analyze 0xYourWalletAddress
|
|
360
|
+
|
|
361
|
+
# Show saved balance history
|
|
362
|
+
arcdevkit portfolio history 0xYourWalletAddress
|
|
360
363
|
|
|
361
364
|
# Generate a consolidated report for multiple wallets
|
|
362
|
-
|
|
365
|
+
arcdevkit portfolio report wallets.json
|
|
363
366
|
```
|
|
364
367
|
|
|
365
368
|
```python
|
|
@@ -554,54 +557,77 @@ The `docker-compose.yml` mounts your `.env` and runs the API on port 8000 with a
|
|
|
554
557
|
|
|
555
558
|
## CLI Reference
|
|
556
559
|
|
|
557
|
-
|
|
560
|
+
The primary entry point is `arcdevkit`, with commands grouped by domain.
|
|
558
561
|
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
562
|
+
### Setup
|
|
563
|
+
|
|
564
|
+
```bash
|
|
565
|
+
arcdevkit init # interactive .env wizard
|
|
566
|
+
arcdevkit status # check testnet connection + block info
|
|
567
|
+
```
|
|
568
|
+
|
|
569
|
+
### Config — manage `.env`
|
|
570
|
+
|
|
571
|
+
```bash
|
|
572
|
+
arcdevkit config list # show all variables
|
|
573
|
+
arcdevkit config get ANTHROPIC_API_KEY # read a specific variable
|
|
574
|
+
arcdevkit config set ARC_RPC_URL https://...# write a variable
|
|
575
|
+
```
|
|
576
|
+
|
|
577
|
+
### Copilot — AI assistant
|
|
563
578
|
|
|
564
|
-
|
|
579
|
+
```bash
|
|
580
|
+
arcdevkit copilot ask "What is Malachite consensus?"
|
|
581
|
+
arcdevkit copilot ask "Write a USDC vault" --stream # token-by-token streaming
|
|
582
|
+
arcdevkit copilot ask "..." --json # output as JSON
|
|
583
|
+
```
|
|
584
|
+
|
|
585
|
+
### Agent — wallet & payments
|
|
565
586
|
|
|
566
587
|
```bash
|
|
567
|
-
#
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
588
|
+
arcdevkit agent create-wallet # generate new EVM wallet
|
|
589
|
+
arcdevkit agent balance 0xAddress... # check wallet balance
|
|
590
|
+
arcdevkit agent status # network info (block, chain ID, gas)
|
|
591
|
+
arcdevkit agent pay 0xDest... 5.0 # sign-only (safe default)
|
|
592
|
+
arcdevkit agent pay 0xDest... 5.0 --send # sign and broadcast
|
|
593
|
+
arcdevkit agent pay 0xDest... 5.0 --send --key 0xPrivKey...
|
|
594
|
+
arcdevkit agent monitor 0xWallet... # watch balance changes
|
|
595
|
+
arcdevkit agent monitor 0xWallet... --interval 5 --max 50
|
|
596
|
+
```
|
|
573
597
|
|
|
574
|
-
|
|
575
|
-
arc wallet create # generate new wallet
|
|
576
|
-
arc wallet balance --address 0x... # check balance
|
|
598
|
+
### Debug — transaction analysis
|
|
577
599
|
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
600
|
+
```bash
|
|
601
|
+
arcdevkit debug tx 0xHash... # analyze a transaction with AI
|
|
602
|
+
arcdevkit debug tx 0xHash... --json
|
|
603
|
+
arcdevkit debug estimate 0xDest... 10.0 # estimate gas cost
|
|
604
|
+
arcdevkit debug estimate 0xDest... 10.0 --from 0xSender...
|
|
605
|
+
arcdevkit debug batch hashes.txt # analyze multiple txs from a file
|
|
606
|
+
arcdevkit debug batch hashes.txt --abi MyContract.json
|
|
607
|
+
```
|
|
582
608
|
|
|
583
|
-
|
|
584
|
-
arc debug tx 0xHash
|
|
585
|
-
arc debug tx 0xHash --abi Contract.json
|
|
586
|
-
arc history # list recent debug sessions
|
|
609
|
+
### Portfolio — wallet analytics
|
|
587
610
|
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
611
|
+
```bash
|
|
612
|
+
arcdevkit portfolio analyze 0xWallet... # balances, txs, AI insights
|
|
613
|
+
arcdevkit portfolio analyze 0xWallet... --no-ai --blocks 500
|
|
614
|
+
arcdevkit portfolio history 0xWallet... # saved balance snapshots
|
|
615
|
+
arcdevkit portfolio report wallets.json # consolidated multi-wallet report
|
|
616
|
+
```
|
|
617
|
+
|
|
618
|
+
### Codegen — script generation
|
|
591
619
|
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
620
|
+
```bash
|
|
621
|
+
arcdevkit codegen "monitor a wallet and alert when balance drops"
|
|
622
|
+
arcdevkit codegen "deploy an ERC-20 with a mint function" --out ./scripts
|
|
623
|
+
arcdevkit codegen "..." --no-save # print only, don't save to disk
|
|
595
624
|
```
|
|
596
625
|
|
|
597
|
-
###
|
|
626
|
+
### History — operation log
|
|
598
627
|
|
|
599
628
|
```bash
|
|
600
|
-
arcdevkit
|
|
601
|
-
arcdevkit
|
|
602
|
-
arcdevkit agent wallet create
|
|
603
|
-
arcdevkit agent pay --to 0x... --amount 10
|
|
604
|
-
arcdevkit debug tx 0xHash
|
|
629
|
+
arcdevkit history # last 10 CLI operations
|
|
630
|
+
arcdevkit history --limit 25 --json
|
|
605
631
|
```
|
|
606
632
|
|
|
607
633
|
---
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"""Arc DevKit — Developer tools for the Arc blockchain by Circle."""
|
|
2
2
|
|
|
3
|
-
from importlib.metadata import PackageNotFoundError
|
|
3
|
+
from importlib.metadata import PackageNotFoundError
|
|
4
|
+
from importlib.metadata import version as _version
|
|
4
5
|
|
|
5
6
|
try:
|
|
6
7
|
__version__ = _version("arc-devkit")
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import asyncio
|
|
4
4
|
import json
|
|
5
5
|
import logging
|
|
6
|
-
from collections.abc import AsyncIterator, Callable
|
|
6
|
+
from collections.abc import AsyncIterator, Callable
|
|
7
7
|
from pathlib import Path
|
|
8
8
|
from typing import Any, cast
|
|
9
9
|
|
|
@@ -295,7 +295,7 @@ class AsyncMonitorAgent(AsyncBaseAgent):
|
|
|
295
295
|
break
|
|
296
296
|
try:
|
|
297
297
|
event = await asyncio.wait_for(queue.get(), timeout=1.0)
|
|
298
|
-
except
|
|
298
|
+
except TimeoutError:
|
|
299
299
|
continue # re-check task.done() on next iteration
|
|
300
300
|
yield event
|
|
301
301
|
count += 1
|
|
@@ -77,7 +77,7 @@ class PaymentAgent(BaseAgent):
|
|
|
77
77
|
|
|
78
78
|
def _build_usdc_signed_tx(self, to: str, amount: Decimal) -> tuple:
|
|
79
79
|
"""Build and sign a USDC ERC-20 transfer tx; return (signed, gas_limit)."""
|
|
80
|
-
from arc_devkit.usdc.token import _ERC20_ABI,
|
|
80
|
+
from arc_devkit.usdc.token import _ERC20_ABI, USDC_ARC_TESTNET_ADDRESS, USDC_MULTIPLIER
|
|
81
81
|
|
|
82
82
|
usdc_address = Web3.to_checksum_address(USDC_ARC_TESTNET_ADDRESS)
|
|
83
83
|
contract = self._w3.eth.contract(address=usdc_address, abi=_ERC20_ABI)
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import json
|
|
4
4
|
import logging
|
|
5
5
|
from dataclasses import dataclass
|
|
6
|
-
from datetime import
|
|
6
|
+
from datetime import UTC, datetime
|
|
7
7
|
from decimal import Decimal
|
|
8
8
|
from pathlib import Path
|
|
9
9
|
from typing import Any, Literal
|
|
@@ -151,7 +151,7 @@ class PortfolioAnalyzer:
|
|
|
151
151
|
history_file = store / f"{safe_addr}.jsonl"
|
|
152
152
|
|
|
153
153
|
record = self.to_dict(snapshot)
|
|
154
|
-
record["timestamp"] = datetime.now(tz=
|
|
154
|
+
record["timestamp"] = datetime.now(tz=UTC).isoformat()
|
|
155
155
|
|
|
156
156
|
with history_file.open("a", encoding="utf-8") as f:
|
|
157
157
|
f.write(json.dumps(record) + "\n")
|
|
@@ -180,7 +180,7 @@ async def monitor_ws(
|
|
|
180
180
|
try:
|
|
181
181
|
event = await asyncio.wait_for(queue.get(), timeout=1.0)
|
|
182
182
|
await websocket.send_json(event)
|
|
183
|
-
except
|
|
183
|
+
except TimeoutError:
|
|
184
184
|
# Send a heartbeat ping to detect dead connections
|
|
185
185
|
try:
|
|
186
186
|
await websocket.send_json({"event_type": "ping"})
|
|
@@ -74,6 +74,27 @@ def tx(
|
|
|
74
74
|
)
|
|
75
75
|
|
|
76
76
|
|
|
77
|
+
@app.command()
|
|
78
|
+
def batch(
|
|
79
|
+
hashes_file: str = typer.Argument(
|
|
80
|
+
..., help="Text file with one tx hash per line (or JSON array)."
|
|
81
|
+
),
|
|
82
|
+
abi_path: str = typer.Option(
|
|
83
|
+
"", "--abi", "-a", help="Path to ABI JSON file applied to all transactions."
|
|
84
|
+
),
|
|
85
|
+
json_output: bool = typer.Option(False, "--json", help="Output as JSON."),
|
|
86
|
+
) -> None:
|
|
87
|
+
"""Analyze multiple transactions from a file (one hash per line or JSON array).
|
|
88
|
+
|
|
89
|
+
Examples:
|
|
90
|
+
arcdevkit debug batch hashes.txt
|
|
91
|
+
arcdevkit debug batch hashes.txt --abi MyContract.json --json
|
|
92
|
+
"""
|
|
93
|
+
from arc_devkit.cli.flat import debug_batch as _run_batch
|
|
94
|
+
|
|
95
|
+
_run_batch(hashes_file=hashes_file, abi_path=abi_path, json_output=json_output, verbose=False)
|
|
96
|
+
|
|
97
|
+
|
|
77
98
|
@app.command()
|
|
78
99
|
def estimate(
|
|
79
100
|
to: str = typer.Argument(..., help="Recipient EVM address."),
|
|
@@ -6,6 +6,7 @@ from rich.panel import Panel
|
|
|
6
6
|
|
|
7
7
|
from arc_devkit import __version__
|
|
8
8
|
from arc_devkit.cli.commands import agent, copilot, debug
|
|
9
|
+
from arc_devkit.cli.flat import config_app, portfolio_app
|
|
9
10
|
|
|
10
11
|
# Main Typer application
|
|
11
12
|
app = typer.Typer(
|
|
@@ -20,6 +21,8 @@ app = typer.Typer(
|
|
|
20
21
|
app.add_typer(copilot.app, name="copilot", help="AI assistant for Arc development.")
|
|
21
22
|
app.add_typer(agent.app, name="agent", help="Wallet and agent management.")
|
|
22
23
|
app.add_typer(debug.app, name="debug", help="Transaction analysis and debugging.")
|
|
24
|
+
app.add_typer(config_app, name="config", help="Manage Arc DevKit settings via .env.")
|
|
25
|
+
app.add_typer(portfolio_app, name="portfolio", help="Wallet portfolio analysis on Arc.")
|
|
23
26
|
|
|
24
27
|
console = Console()
|
|
25
28
|
|
|
@@ -56,6 +59,30 @@ def init() -> None:
|
|
|
56
59
|
_run_init()
|
|
57
60
|
|
|
58
61
|
|
|
62
|
+
@app.command()
|
|
63
|
+
def history(
|
|
64
|
+
limit: int = typer.Option(10, "--limit", "-n", help="Number of records to display."),
|
|
65
|
+
json_output: bool = typer.Option(False, "--json", help="Output as JSON."),
|
|
66
|
+
) -> None:
|
|
67
|
+
"""List recent CLI operations saved in ~/.arc_devkit/history.json."""
|
|
68
|
+
from arc_devkit.cli.flat import history as _run_history
|
|
69
|
+
|
|
70
|
+
_run_history(limit=limit, json_output=json_output)
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
@app.command()
|
|
74
|
+
def codegen(
|
|
75
|
+
topic: str = typer.Argument(..., help="Describe what the script should do."),
|
|
76
|
+
save: bool = typer.Option(True, "--save/--no-save", help="Save to generated/<timestamp>.py"),
|
|
77
|
+
output_dir: str = typer.Option(".", "--out", "-o", help="Output directory (default: current)."),
|
|
78
|
+
verbose: bool = typer.Option(False, "-v", "--verbose", help="Enable debug logs."),
|
|
79
|
+
) -> None:
|
|
80
|
+
"""Generate a Python script for Arc from a natural language description."""
|
|
81
|
+
from arc_devkit.cli.flat import codegen as _run_codegen
|
|
82
|
+
|
|
83
|
+
_run_codegen(topic=topic, save=save, output_dir=output_dir, verbose=verbose)
|
|
84
|
+
|
|
85
|
+
|
|
59
86
|
@app.command()
|
|
60
87
|
def status() -> None:
|
|
61
88
|
"""Check the connection to Arc testnet and display network information."""
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: arc-devkit
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.5
|
|
4
4
|
Summary: Plataforma open source de ferramentas para desenvolvedores da Arc blockchain (Circle)
|
|
5
5
|
Author-email: Jeielsantosdev <jeielsantos.ti@gmail.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -88,10 +88,10 @@ cp .env.example .env
|
|
|
88
88
|
# ARC_PRIVATE_KEY — optional; needed to send transactions
|
|
89
89
|
|
|
90
90
|
# 3. Guided interactive setup (creates .env from scratch)
|
|
91
|
-
|
|
91
|
+
arcdevkit init
|
|
92
92
|
|
|
93
93
|
# 4. Verify connection
|
|
94
|
-
|
|
94
|
+
arcdevkit status
|
|
95
95
|
```
|
|
96
96
|
|
|
97
97
|
```
|
|
@@ -130,10 +130,10 @@ AI assistant powered by Claude Sonnet, with Arc blockchain context embedded in t
|
|
|
130
130
|
|
|
131
131
|
```bash
|
|
132
132
|
# Ask a question
|
|
133
|
-
|
|
133
|
+
arcdevkit copilot ask "How do I deploy an ERC-20 contract on Arc testnet?"
|
|
134
134
|
|
|
135
135
|
# Streaming output (token by token)
|
|
136
|
-
|
|
136
|
+
arcdevkit copilot ask "Write a USDC payment contract in Solidity" --stream
|
|
137
137
|
```
|
|
138
138
|
|
|
139
139
|
### Python
|
|
@@ -349,16 +349,16 @@ Fetches transaction data via RPC, decodes the error/result, and uses the Dev Cop
|
|
|
349
349
|
|
|
350
350
|
```bash
|
|
351
351
|
# Analyze a transaction
|
|
352
|
-
|
|
352
|
+
arcdevkit debug tx 0xYourTxHashHere
|
|
353
353
|
|
|
354
354
|
# Load an ABI to decode input data
|
|
355
|
-
|
|
355
|
+
arcdevkit debug tx 0xYourTxHash --abi ./MyContract.abi.json
|
|
356
356
|
|
|
357
357
|
# Batch — analyze a file of hashes (one per line)
|
|
358
|
-
|
|
358
|
+
arcdevkit debug batch hashes.txt
|
|
359
359
|
|
|
360
|
-
# View recent
|
|
361
|
-
|
|
360
|
+
# View recent operation history
|
|
361
|
+
arcdevkit history
|
|
362
362
|
```
|
|
363
363
|
|
|
364
364
|
```python
|
|
@@ -395,10 +395,13 @@ Snapshot a wallet's complete state and activity on Arc, with AI commentary.
|
|
|
395
395
|
|
|
396
396
|
```bash
|
|
397
397
|
# Analyze a single wallet
|
|
398
|
-
|
|
398
|
+
arcdevkit portfolio analyze 0xYourWalletAddress
|
|
399
|
+
|
|
400
|
+
# Show saved balance history
|
|
401
|
+
arcdevkit portfolio history 0xYourWalletAddress
|
|
399
402
|
|
|
400
403
|
# Generate a consolidated report for multiple wallets
|
|
401
|
-
|
|
404
|
+
arcdevkit portfolio report wallets.json
|
|
402
405
|
```
|
|
403
406
|
|
|
404
407
|
```python
|
|
@@ -593,54 +596,77 @@ The `docker-compose.yml` mounts your `.env` and runs the API on port 8000 with a
|
|
|
593
596
|
|
|
594
597
|
## CLI Reference
|
|
595
598
|
|
|
596
|
-
|
|
599
|
+
The primary entry point is `arcdevkit`, with commands grouped by domain.
|
|
597
600
|
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
601
|
+
### Setup
|
|
602
|
+
|
|
603
|
+
```bash
|
|
604
|
+
arcdevkit init # interactive .env wizard
|
|
605
|
+
arcdevkit status # check testnet connection + block info
|
|
606
|
+
```
|
|
607
|
+
|
|
608
|
+
### Config — manage `.env`
|
|
609
|
+
|
|
610
|
+
```bash
|
|
611
|
+
arcdevkit config list # show all variables
|
|
612
|
+
arcdevkit config get ANTHROPIC_API_KEY # read a specific variable
|
|
613
|
+
arcdevkit config set ARC_RPC_URL https://...# write a variable
|
|
614
|
+
```
|
|
615
|
+
|
|
616
|
+
### Copilot — AI assistant
|
|
602
617
|
|
|
603
|
-
|
|
618
|
+
```bash
|
|
619
|
+
arcdevkit copilot ask "What is Malachite consensus?"
|
|
620
|
+
arcdevkit copilot ask "Write a USDC vault" --stream # token-by-token streaming
|
|
621
|
+
arcdevkit copilot ask "..." --json # output as JSON
|
|
622
|
+
```
|
|
623
|
+
|
|
624
|
+
### Agent — wallet & payments
|
|
604
625
|
|
|
605
626
|
```bash
|
|
606
|
-
#
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
627
|
+
arcdevkit agent create-wallet # generate new EVM wallet
|
|
628
|
+
arcdevkit agent balance 0xAddress... # check wallet balance
|
|
629
|
+
arcdevkit agent status # network info (block, chain ID, gas)
|
|
630
|
+
arcdevkit agent pay 0xDest... 5.0 # sign-only (safe default)
|
|
631
|
+
arcdevkit agent pay 0xDest... 5.0 --send # sign and broadcast
|
|
632
|
+
arcdevkit agent pay 0xDest... 5.0 --send --key 0xPrivKey...
|
|
633
|
+
arcdevkit agent monitor 0xWallet... # watch balance changes
|
|
634
|
+
arcdevkit agent monitor 0xWallet... --interval 5 --max 50
|
|
635
|
+
```
|
|
612
636
|
|
|
613
|
-
|
|
614
|
-
arc wallet create # generate new wallet
|
|
615
|
-
arc wallet balance --address 0x... # check balance
|
|
637
|
+
### Debug — transaction analysis
|
|
616
638
|
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
639
|
+
```bash
|
|
640
|
+
arcdevkit debug tx 0xHash... # analyze a transaction with AI
|
|
641
|
+
arcdevkit debug tx 0xHash... --json
|
|
642
|
+
arcdevkit debug estimate 0xDest... 10.0 # estimate gas cost
|
|
643
|
+
arcdevkit debug estimate 0xDest... 10.0 --from 0xSender...
|
|
644
|
+
arcdevkit debug batch hashes.txt # analyze multiple txs from a file
|
|
645
|
+
arcdevkit debug batch hashes.txt --abi MyContract.json
|
|
646
|
+
```
|
|
621
647
|
|
|
622
|
-
|
|
623
|
-
arc debug tx 0xHash
|
|
624
|
-
arc debug tx 0xHash --abi Contract.json
|
|
625
|
-
arc history # list recent debug sessions
|
|
648
|
+
### Portfolio — wallet analytics
|
|
626
649
|
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
650
|
+
```bash
|
|
651
|
+
arcdevkit portfolio analyze 0xWallet... # balances, txs, AI insights
|
|
652
|
+
arcdevkit portfolio analyze 0xWallet... --no-ai --blocks 500
|
|
653
|
+
arcdevkit portfolio history 0xWallet... # saved balance snapshots
|
|
654
|
+
arcdevkit portfolio report wallets.json # consolidated multi-wallet report
|
|
655
|
+
```
|
|
656
|
+
|
|
657
|
+
### Codegen — script generation
|
|
630
658
|
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
659
|
+
```bash
|
|
660
|
+
arcdevkit codegen "monitor a wallet and alert when balance drops"
|
|
661
|
+
arcdevkit codegen "deploy an ERC-20 with a mint function" --out ./scripts
|
|
662
|
+
arcdevkit codegen "..." --no-save # print only, don't save to disk
|
|
634
663
|
```
|
|
635
664
|
|
|
636
|
-
###
|
|
665
|
+
### History — operation log
|
|
637
666
|
|
|
638
667
|
```bash
|
|
639
|
-
arcdevkit
|
|
640
|
-
arcdevkit
|
|
641
|
-
arcdevkit agent wallet create
|
|
642
|
-
arcdevkit agent pay --to 0x... --amount 10
|
|
643
|
-
arcdevkit debug tx 0xHash
|
|
668
|
+
arcdevkit history # last 10 CLI operations
|
|
669
|
+
arcdevkit history --limit 25 --json
|
|
644
670
|
```
|
|
645
671
|
|
|
646
672
|
---
|
|
@@ -4,9 +4,6 @@ import json
|
|
|
4
4
|
from decimal import Decimal
|
|
5
5
|
from unittest.mock import MagicMock, patch
|
|
6
6
|
|
|
7
|
-
import pytest
|
|
8
|
-
|
|
9
|
-
|
|
10
7
|
# ---------------------------------------------------------------------------
|
|
11
8
|
# Helpers
|
|
12
9
|
# ---------------------------------------------------------------------------
|
|
@@ -358,7 +355,7 @@ class TestPortfolioCLI:
|
|
|
358
355
|
|
|
359
356
|
class TestBalanceHistory:
|
|
360
357
|
def _make_snapshot(self, address="0x" + "a" * 40, tx_count=3):
|
|
361
|
-
from arc_devkit.analytics.portfolio import
|
|
358
|
+
from arc_devkit.analytics.portfolio import PortfolioSnapshot
|
|
362
359
|
|
|
363
360
|
return PortfolioSnapshot(
|
|
364
361
|
address=address,
|
|
@@ -390,7 +387,7 @@ class TestBalanceHistory:
|
|
|
390
387
|
analyzer.save_snapshot(snap, history_dir=tmp_path)
|
|
391
388
|
analyzer.save_snapshot(snap, history_dir=tmp_path)
|
|
392
389
|
path = tmp_path / f"{snap.address.lower()}.jsonl"
|
|
393
|
-
lines = [
|
|
390
|
+
lines = [line for line in path.read_text().splitlines() if line.strip()]
|
|
394
391
|
assert len(lines) == 2
|
|
395
392
|
|
|
396
393
|
def test_save_snapshot_includes_timestamp(self, tmp_path):
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
"""Tests for AsyncBaseAgent, AsyncMonitorAgent, and WebSocket endpoint."""
|
|
2
2
|
|
|
3
|
-
import asyncio
|
|
4
3
|
from unittest.mock import AsyncMock, MagicMock, patch
|
|
5
4
|
|
|
6
5
|
import pytest
|
|
7
6
|
|
|
8
|
-
|
|
9
7
|
# ---------------------------------------------------------------------------
|
|
10
8
|
# Helpers
|
|
11
9
|
# ---------------------------------------------------------------------------
|
|
@@ -235,9 +233,10 @@ async def test_async_monitor_event_stream_yields():
|
|
|
235
233
|
|
|
236
234
|
def test_websocket_monitor_accepts_connection():
|
|
237
235
|
"""WebSocket /agents/monitor/{address} must accept and send heartbeat pings."""
|
|
238
|
-
from arc_devkit.api.main import app
|
|
239
236
|
from fastapi.testclient import TestClient
|
|
240
237
|
|
|
238
|
+
from arc_devkit.api.main import app
|
|
239
|
+
|
|
241
240
|
with patch("arc_devkit.core.connection.get_web3", return_value=_mock_w3()), \
|
|
242
241
|
patch("arc_devkit.agents.async_monitor.AsyncMonitorAgent.execute", new_callable=AsyncMock) as mock_exec:
|
|
243
242
|
mock_exec.return_value = {"status": "done", "iterations": 0}
|
|
@@ -345,7 +344,7 @@ async def test_async_monitor_webhook_called(tmp_path, respx_mock=None):
|
|
|
345
344
|
|
|
346
345
|
|
|
347
346
|
def test_copilot_offline_ask_returns_mock(mock_anthropic):
|
|
348
|
-
from arc_devkit.copilot.agent import
|
|
347
|
+
from arc_devkit.copilot.agent import _OFFLINE_RESPONSE, DevCopilot
|
|
349
348
|
|
|
350
349
|
copilot = DevCopilot(offline=True)
|
|
351
350
|
assert copilot.ask("What is Arc?") == _OFFLINE_RESPONSE
|
|
@@ -353,7 +352,7 @@ def test_copilot_offline_ask_returns_mock(mock_anthropic):
|
|
|
353
352
|
|
|
354
353
|
|
|
355
354
|
def test_copilot_offline_stream_returns_mock(mock_anthropic):
|
|
356
|
-
from arc_devkit.copilot.agent import
|
|
355
|
+
from arc_devkit.copilot.agent import _OFFLINE_RESPONSE, DevCopilot
|
|
357
356
|
|
|
358
357
|
copilot = DevCopilot(offline=True)
|
|
359
358
|
result = "".join(copilot.ask_stream("What is Arc?"))
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
"""Unit tests for arc_devkit.cli.flat — arc CLI commands."""
|
|
2
2
|
|
|
3
3
|
import json
|
|
4
|
-
import tempfile
|
|
5
4
|
from decimal import Decimal
|
|
6
|
-
from
|
|
7
|
-
from unittest.mock import MagicMock, patch
|
|
5
|
+
from unittest.mock import patch
|
|
8
6
|
|
|
9
|
-
import pytest
|
|
10
7
|
from typer.testing import CliRunner
|
|
11
8
|
|
|
12
9
|
from arc_devkit.cli.flat import app
|
|
@@ -172,7 +169,6 @@ class TestWallet:
|
|
|
172
169
|
|
|
173
170
|
class TestConfig:
|
|
174
171
|
def test_config_set_and_get(self, tmp_path, monkeypatch):
|
|
175
|
-
env_file = tmp_path / ".env"
|
|
176
172
|
monkeypatch.chdir(tmp_path)
|
|
177
173
|
|
|
178
174
|
# set
|
|
@@ -3,11 +3,10 @@
|
|
|
3
3
|
import json
|
|
4
4
|
import tempfile
|
|
5
5
|
from pathlib import Path
|
|
6
|
-
from unittest.mock import MagicMock
|
|
6
|
+
from unittest.mock import MagicMock
|
|
7
7
|
|
|
8
8
|
import pytest
|
|
9
9
|
|
|
10
|
-
|
|
11
10
|
# ---------------------------------------------------------------------------
|
|
12
11
|
# load_abi
|
|
13
12
|
# ---------------------------------------------------------------------------
|
|
@@ -79,9 +78,10 @@ class TestCallView:
|
|
|
79
78
|
assert result == "USDC"
|
|
80
79
|
|
|
81
80
|
def test_checksum_applied_to_address(self):
|
|
82
|
-
from arc_devkit.contracts.loader import call_view
|
|
83
81
|
from web3 import Web3
|
|
84
82
|
|
|
83
|
+
from arc_devkit.contracts.loader import call_view
|
|
84
|
+
|
|
85
85
|
w3 = self._w3_with_result(0)
|
|
86
86
|
abi: list = []
|
|
87
87
|
call_view(abi, "0x" + "a" * 40, "balanceOf", w3=w3)
|
|
@@ -2,12 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
import json
|
|
4
4
|
import tempfile
|
|
5
|
-
from decimal import Decimal
|
|
6
5
|
from unittest.mock import MagicMock, patch
|
|
7
6
|
|
|
8
|
-
import pytest
|
|
9
|
-
|
|
10
|
-
|
|
11
7
|
# ---------------------------------------------------------------------------
|
|
12
8
|
# Helpers
|
|
13
9
|
# ---------------------------------------------------------------------------
|
|
@@ -115,9 +111,10 @@ class TestDecodeRevertBytes:
|
|
|
115
111
|
assert "42" in result
|
|
116
112
|
|
|
117
113
|
def test_custom_error_no_args(self):
|
|
118
|
-
from arc_devkit.debugger.tx_analyzer import decode_revert_bytes
|
|
119
114
|
from web3 import Web3
|
|
120
115
|
|
|
116
|
+
from arc_devkit.debugger.tx_analyzer import decode_revert_bytes
|
|
117
|
+
|
|
121
118
|
abi = [{"type": "error", "name": "Unauthorized", "inputs": []}]
|
|
122
119
|
selector = Web3.keccak(text="Unauthorized()")[:4]
|
|
123
120
|
result = decode_revert_bytes(selector, abi=abi)
|
|
@@ -100,7 +100,7 @@ class TestEventListenerPoll:
|
|
|
100
100
|
log = _make_log(block_number=101)
|
|
101
101
|
w3 = _make_w3(current_block=101, logs=[log])
|
|
102
102
|
el = EventListener(w3=w3, from_block=100)
|
|
103
|
-
|
|
103
|
+
el.poll()
|
|
104
104
|
w3.eth.get_logs.assert_called_once()
|
|
105
105
|
call_params = w3.eth.get_logs.call_args[0][0]
|
|
106
106
|
assert call_params["fromBlock"] == 100
|
|
@@ -182,7 +182,8 @@ class TestEventListenerPoll:
|
|
|
182
182
|
|
|
183
183
|
received: list = []
|
|
184
184
|
bad_cb = MagicMock(side_effect=RuntimeError("boom"))
|
|
185
|
-
good_cb
|
|
185
|
+
def good_cb(e):
|
|
186
|
+
received.append(e)
|
|
186
187
|
|
|
187
188
|
fake_event = {"event": "Transfer", "address": "0x", "args": {}, "block_number": 1, "tx_hash": None, "log_index": 0}
|
|
188
189
|
with patch.object(EventListener, "_decode_log", return_value=fake_event):
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"""Unit tests for arc_devkit.usdc.token.USDCToken."""
|
|
2
2
|
|
|
3
3
|
from decimal import Decimal
|
|
4
|
-
from unittest.mock import MagicMock
|
|
4
|
+
from unittest.mock import MagicMock
|
|
5
5
|
|
|
6
6
|
# Standard Hardhat test private key — valid secp256k1 key safe for tests
|
|
7
7
|
_PRIVKEY = "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"
|
|
@@ -34,7 +34,7 @@ def _make_contract_w3(balance_atomic: int = 0) -> MagicMock:
|
|
|
34
34
|
|
|
35
35
|
class TestUSDCToken:
|
|
36
36
|
def _token(self, w3=None, balance_atomic: int = 0, contract_address: str | None = None):
|
|
37
|
-
from arc_devkit.usdc.token import
|
|
37
|
+
from arc_devkit.usdc.token import USDCToken
|
|
38
38
|
|
|
39
39
|
addr = contract_address or "0x" + "c" * 40
|
|
40
40
|
w3 = w3 or _make_contract_w3(balance_atomic)
|
|
@@ -128,9 +128,10 @@ class TestUSDCToken:
|
|
|
128
128
|
# --- contract_address property ---
|
|
129
129
|
|
|
130
130
|
def test_contract_address_property(self):
|
|
131
|
-
from arc_devkit.usdc.token import USDCToken
|
|
132
131
|
from web3 import Web3
|
|
133
132
|
|
|
133
|
+
from arc_devkit.usdc.token import USDCToken
|
|
134
|
+
|
|
134
135
|
addr = "0x" + "d" * 40
|
|
135
136
|
token = USDCToken(contract_address=addr, w3=_make_contract_w3())
|
|
136
137
|
assert token.contract_address == Web3.to_checksum_address(addr)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|