autrace 0.0.1 → 0.0.2
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/README.md +74 -0
- package/package.json +1 -1
package/README.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# AUTrace
|
2
|
+
|
3
|
+
A utility package for tracing and visualizing Mina Protocol account updates and transactions. This tool helps developers understand and visualize the flow of transactions and account updates in their zkApps.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
```bash
|
8
|
+
npm install autrace
|
9
|
+
```
|
10
|
+
|
11
|
+
## Features
|
12
|
+
|
13
|
+
- `AUTrace`: Track and analyze transaction states and account updates in Mina Protocol
|
14
|
+
- `AUVisualizer`: Generate visual representations of transaction flows in various formats (Markdown, PNG, SVG)
|
15
|
+
-- Transaction state history tracking
|
16
|
+
-- Contract analysis capabilities
|
17
|
+
|
18
|
+
## Usage
|
19
|
+
|
20
|
+
### Basic Usage
|
21
|
+
|
22
|
+
```typescript
|
23
|
+
import * as trace from 'autrace';
|
24
|
+
|
25
|
+
// Initialize AUTrace
|
26
|
+
const autrace = new trace.AUTrace();
|
27
|
+
```
|
28
|
+
|
29
|
+
### Initialize Contracts
|
30
|
+
|
31
|
+
```typescript
|
32
|
+
// Initialize contracts for tracking
|
33
|
+
autrace.initializeContracts([zkAppContractInstance1, zkAppContractInstance2]);
|
34
|
+
|
35
|
+
// Optional: Get contract analysis
|
36
|
+
const contractAnalysis = autrace.getContractAnalysis();
|
37
|
+
```
|
38
|
+
|
39
|
+
### Transaction Tracking
|
40
|
+
|
41
|
+
```typescript
|
42
|
+
// Clear previous transaction state before new transaction
|
43
|
+
autrace.clearTransactionState();
|
44
|
+
|
45
|
+
// Create and track a transaction
|
46
|
+
const txn = await Mina.transaction(deployerAccount, async () => {
|
47
|
+
// Your transaction logic here
|
48
|
+
});
|
49
|
+
|
50
|
+
// Track different transaction states like so:
|
51
|
+
const sendState = autrace.getTransactionState(await txn.send());
|
52
|
+
|
53
|
+
```
|
54
|
+
|
55
|
+
### Visualization
|
56
|
+
|
57
|
+
```typescript
|
58
|
+
// Get the complete state history
|
59
|
+
const history = autrace.getStateHistory();
|
60
|
+
|
61
|
+
// Initialize visualizer with history
|
62
|
+
const visualizer = new trace.AUVisualizer(history);
|
63
|
+
|
64
|
+
// Generate different visualization formats
|
65
|
+
await visualizer.generateMarkdownFile('output.md');
|
66
|
+
await visualizer.generatePNG('output.png');
|
67
|
+
await visualizer.generateSVG('output.svg');
|
68
|
+
```
|
69
|
+
|
70
|
+
### Important Notes
|
71
|
+
|
72
|
+
- This package uses ES modules. Ensure your project's package.json has `"type": "module"`.
|
73
|
+
- TypeScript projects should have appropriate module settings in tsconfig.json.
|
74
|
+
|