arc402-cli 0.7.5 → 0.9.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/INK6-UX-SPEC.md +446 -0
- package/MIGRATION-SPEC.md +108 -0
- package/dist/abis.js +14 -17
- package/dist/abis.js.map +1 -1
- package/dist/bundler.d.ts +1 -1
- package/dist/bundler.d.ts.map +1 -1
- package/dist/bundler.js +27 -61
- package/dist/bundler.js.map +1 -1
- package/dist/client.d.ts +1 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +5 -9
- package/dist/client.js.map +1 -1
- package/dist/coinbase-smart-wallet.js +1 -4
- package/dist/coinbase-smart-wallet.js.map +1 -1
- package/dist/commands/accept.js +25 -28
- package/dist/commands/accept.js.map +1 -1
- package/dist/commands/agent-handshake.js +15 -18
- package/dist/commands/agent-handshake.js.map +1 -1
- package/dist/commands/agent.js +98 -104
- package/dist/commands/agent.js.map +1 -1
- package/dist/commands/agreements.js +62 -98
- package/dist/commands/agreements.js.map +1 -1
- package/dist/commands/arbitrator.js +45 -81
- package/dist/commands/arbitrator.js.map +1 -1
- package/dist/commands/arena-handshake.js +27 -30
- package/dist/commands/arena-handshake.js.map +1 -1
- package/dist/commands/arena.js +12 -18
- package/dist/commands/arena.js.map +1 -1
- package/dist/commands/backup.js +30 -36
- package/dist/commands/backup.js.map +1 -1
- package/dist/commands/cancel.js +15 -18
- package/dist/commands/cancel.js.map +1 -1
- package/dist/commands/channel.js +45 -81
- package/dist/commands/channel.js.map +1 -1
- package/dist/commands/coldstart.js +31 -34
- package/dist/commands/coldstart.js.map +1 -1
- package/dist/commands/config.js +23 -29
- package/dist/commands/config.js.map +1 -1
- package/dist/commands/contract-interaction.js +12 -15
- package/dist/commands/contract-interaction.js.map +1 -1
- package/dist/commands/daemon.d.ts.map +1 -1
- package/dist/commands/daemon.js +98 -135
- package/dist/commands/daemon.js.map +1 -1
- package/dist/commands/deliver.js +37 -76
- package/dist/commands/deliver.js.map +1 -1
- package/dist/commands/discover.js +24 -27
- package/dist/commands/discover.js.map +1 -1
- package/dist/commands/dispute.js +104 -110
- package/dist/commands/dispute.js.map +1 -1
- package/dist/commands/doctor.js +16 -55
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/endpoint.js +56 -95
- package/dist/commands/endpoint.js.map +1 -1
- package/dist/commands/feed.js +11 -18
- package/dist/commands/feed.js.map +1 -1
- package/dist/commands/hire.js +37 -40
- package/dist/commands/hire.js.map +1 -1
- package/dist/commands/migrate.js +30 -33
- package/dist/commands/migrate.js.map +1 -1
- package/dist/commands/negotiate.d.ts.map +1 -1
- package/dist/commands/negotiate.js +34 -36
- package/dist/commands/negotiate.js.map +1 -1
- package/dist/commands/openshell.js +68 -104
- package/dist/commands/openshell.js.map +1 -1
- package/dist/commands/owner.js +17 -20
- package/dist/commands/owner.js.map +1 -1
- package/dist/commands/policy.js +41 -43
- package/dist/commands/policy.js.map +1 -1
- package/dist/commands/relay.d.ts.map +1 -1
- package/dist/commands/relay.js +18 -51
- package/dist/commands/relay.js.map +1 -1
- package/dist/commands/remediate.js +20 -23
- package/dist/commands/remediate.js.map +1 -1
- package/dist/commands/reputation.js +25 -27
- package/dist/commands/reputation.js.map +1 -1
- package/dist/commands/setup.js +65 -104
- package/dist/commands/setup.js.map +1 -1
- package/dist/commands/trust.js +17 -20
- package/dist/commands/trust.js.map +1 -1
- package/dist/commands/verify.js +18 -21
- package/dist/commands/verify.js.map +1 -1
- package/dist/commands/wallet.js +619 -625
- package/dist/commands/wallet.js.map +1 -1
- package/dist/commands/watch.js +33 -36
- package/dist/commands/watch.js.map +1 -1
- package/dist/commands/watchtower.js +37 -73
- package/dist/commands/watchtower.js.map +1 -1
- package/dist/commands/workroom.d.ts.map +1 -1
- package/dist/commands/workroom.js +138 -171
- package/dist/commands/workroom.js.map +1 -1
- package/dist/config.js +21 -65
- package/dist/config.js.map +1 -1
- package/dist/daemon/config.d.ts.map +1 -1
- package/dist/daemon/config.js +16 -53
- package/dist/daemon/config.js.map +1 -1
- package/dist/daemon/hire-listener.d.ts +3 -3
- package/dist/daemon/hire-listener.d.ts.map +1 -1
- package/dist/daemon/hire-listener.js +13 -47
- package/dist/daemon/hire-listener.js.map +1 -1
- package/dist/daemon/index.d.ts +1 -1
- package/dist/daemon/index.d.ts.map +1 -1
- package/dist/daemon/index.js +50 -88
- package/dist/daemon/index.js.map +1 -1
- package/dist/daemon/job-lifecycle.d.ts +1 -1
- package/dist/daemon/job-lifecycle.d.ts.map +1 -1
- package/dist/daemon/job-lifecycle.js +11 -51
- package/dist/daemon/job-lifecycle.js.map +1 -1
- package/dist/daemon/notify.d.ts +1 -1
- package/dist/daemon/notify.d.ts.map +1 -1
- package/dist/daemon/notify.js +19 -53
- package/dist/daemon/notify.js.map +1 -1
- package/dist/daemon/token-metering.js +8 -47
- package/dist/daemon/token-metering.js.map +1 -1
- package/dist/daemon/userops.d.ts +2 -2
- package/dist/daemon/userops.d.ts.map +1 -1
- package/dist/daemon/userops.js +23 -27
- package/dist/daemon/userops.js.map +1 -1
- package/dist/daemon/wallet-monitor.d.ts +1 -1
- package/dist/daemon/wallet-monitor.d.ts.map +1 -1
- package/dist/daemon/wallet-monitor.js +8 -12
- package/dist/daemon/wallet-monitor.js.map +1 -1
- package/dist/drain-v4.js +26 -64
- package/dist/drain-v4.js.map +1 -1
- package/dist/endpoint-config.js +20 -63
- package/dist/endpoint-config.js.map +1 -1
- package/dist/endpoint-notify.js +9 -48
- package/dist/endpoint-notify.js.map +1 -1
- package/dist/index.js +16 -50
- package/dist/index.js.map +1 -1
- package/dist/openshell-runtime.d.ts.map +1 -1
- package/dist/openshell-runtime.js +38 -82
- package/dist/openshell-runtime.js.map +1 -1
- package/dist/program.d.ts.map +1 -1
- package/dist/program.js +77 -83
- package/dist/program.js.map +1 -1
- package/dist/repl.js +25 -31
- package/dist/repl.js.map +1 -1
- package/dist/signing.js +3 -6
- package/dist/signing.js.map +1 -1
- package/dist/telegram-notify.js +3 -40
- package/dist/telegram-notify.js.map +1 -1
- package/dist/tui/App.d.ts +1 -9
- package/dist/tui/App.d.ts.map +1 -1
- package/dist/tui/App.js +87 -65
- package/dist/tui/App.js.map +1 -1
- package/dist/tui/Footer.js +4 -7
- package/dist/tui/Footer.js.map +1 -1
- package/dist/tui/Header.d.ts +1 -2
- package/dist/tui/Header.d.ts.map +1 -1
- package/dist/tui/Header.js +9 -14
- package/dist/tui/Header.js.map +1 -1
- package/dist/tui/InputLine.d.ts +1 -2
- package/dist/tui/InputLine.d.ts.map +1 -1
- package/dist/tui/InputLine.js +92 -46
- package/dist/tui/InputLine.js.map +1 -1
- package/dist/tui/Viewport.d.ts +5 -4
- package/dist/tui/Viewport.d.ts.map +1 -1
- package/dist/tui/Viewport.js +20 -13
- package/dist/tui/Viewport.js.map +1 -1
- package/dist/tui/WalletConnectPairing.d.ts +23 -0
- package/dist/tui/WalletConnectPairing.d.ts.map +1 -0
- package/dist/tui/WalletConnectPairing.js +75 -0
- package/dist/tui/WalletConnectPairing.js.map +1 -0
- package/dist/tui/components/Button.d.ts +7 -0
- package/dist/tui/components/Button.d.ts.map +1 -0
- package/dist/tui/components/Button.js +18 -0
- package/dist/tui/components/Button.js.map +1 -0
- package/dist/tui/components/CeremonyView.d.ts +13 -0
- package/dist/tui/components/CeremonyView.d.ts.map +1 -0
- package/dist/tui/components/CeremonyView.js +7 -0
- package/dist/tui/components/CeremonyView.js.map +1 -0
- package/dist/tui/components/CompletionDropdown.d.ts +7 -0
- package/dist/tui/components/CompletionDropdown.d.ts.map +1 -0
- package/dist/tui/components/CompletionDropdown.js +20 -0
- package/dist/tui/components/CompletionDropdown.js.map +1 -0
- package/dist/tui/components/ConfirmPrompt.d.ts +9 -0
- package/dist/tui/components/ConfirmPrompt.d.ts.map +1 -0
- package/dist/tui/components/ConfirmPrompt.js +7 -0
- package/dist/tui/components/ConfirmPrompt.js.map +1 -0
- package/dist/tui/components/InteractiveTable.d.ts +14 -0
- package/dist/tui/components/InteractiveTable.d.ts.map +1 -0
- package/dist/tui/components/InteractiveTable.js +58 -0
- package/dist/tui/components/InteractiveTable.js.map +1 -0
- package/dist/tui/components/StepSpinner.d.ts +11 -0
- package/dist/tui/components/StepSpinner.d.ts.map +1 -0
- package/dist/tui/components/StepSpinner.js +29 -0
- package/dist/tui/components/StepSpinner.js.map +1 -0
- package/dist/tui/components/Toast.d.ts +18 -0
- package/dist/tui/components/Toast.d.ts.map +1 -0
- package/dist/tui/components/Toast.js +25 -0
- package/dist/tui/components/Toast.js.map +1 -0
- package/dist/tui/index.d.ts.map +1 -1
- package/dist/tui/index.js +28 -21
- package/dist/tui/index.js.map +1 -1
- package/dist/tui/useChat.js +13 -19
- package/dist/tui/useChat.js.map +1 -1
- package/dist/tui/useCommand.d.ts +2 -7
- package/dist/tui/useCommand.d.ts.map +1 -1
- package/dist/tui/useCommand.js +77 -165
- package/dist/tui/useCommand.js.map +1 -1
- package/dist/tui/useNotifications.d.ts +9 -0
- package/dist/tui/useNotifications.d.ts.map +1 -0
- package/dist/tui/useNotifications.js +14 -0
- package/dist/tui/useNotifications.js.map +1 -0
- package/dist/tui/useScroll.js +9 -12
- package/dist/tui/useScroll.js.map +1 -1
- package/dist/ui/banner.d.ts +12 -0
- package/dist/ui/banner.d.ts.map +1 -1
- package/dist/ui/banner.js +35 -19
- package/dist/ui/banner.js.map +1 -1
- package/dist/ui/colors.js +13 -19
- package/dist/ui/colors.js.map +1 -1
- package/dist/ui/format.js +6 -14
- package/dist/ui/format.js.map +1 -1
- package/dist/ui/spinner.js +6 -12
- package/dist/ui/spinner.js.map +1 -1
- package/dist/ui/tree.js +3 -6
- package/dist/ui/tree.js.map +1 -1
- package/dist/utils/format.js +27 -41
- package/dist/utils/format.js.map +1 -1
- package/dist/utils/hash.js +4 -42
- package/dist/utils/hash.js.map +1 -1
- package/dist/utils/time.js +2 -6
- package/dist/utils/time.js.map +1 -1
- package/dist/wallet-router.d.ts +1 -1
- package/dist/wallet-router.d.ts.map +1 -1
- package/dist/wallet-router.js +12 -19
- package/dist/wallet-router.js.map +1 -1
- package/dist/walletconnect-session.d.ts +1 -1
- package/dist/walletconnect-session.d.ts.map +1 -1
- package/dist/walletconnect-session.js +6 -11
- package/dist/walletconnect-session.js.map +1 -1
- package/dist/walletconnect.d.ts +6 -1
- package/dist/walletconnect.d.ts.map +1 -1
- package/dist/walletconnect.js +32 -35
- package/dist/walletconnect.js.map +1 -1
- package/package.json +7 -6
- package/src/bundler.ts +1 -1
- package/src/client.ts +1 -1
- package/src/commands/accept.ts +7 -7
- package/src/commands/agent-handshake.ts +4 -4
- package/src/commands/agent.ts +9 -9
- package/src/commands/agreements.ts +8 -8
- package/src/commands/arbitrator.ts +5 -5
- package/src/commands/arena-handshake.ts +6 -6
- package/src/commands/arena.ts +2 -2
- package/src/commands/backup.ts +1 -1
- package/src/commands/cancel.ts +6 -6
- package/src/commands/channel.ts +6 -6
- package/src/commands/coldstart.ts +5 -5
- package/src/commands/config.ts +2 -2
- package/src/commands/contract-interaction.ts +2 -2
- package/src/commands/daemon.ts +14 -11
- package/src/commands/deliver.ts +9 -9
- package/src/commands/discover.ts +5 -5
- package/src/commands/dispute.ts +7 -7
- package/src/commands/doctor.ts +2 -2
- package/src/commands/endpoint.ts +6 -6
- package/src/commands/feed.ts +1 -1
- package/src/commands/hire.ts +10 -10
- package/src/commands/migrate.ts +7 -7
- package/src/commands/negotiate.ts +6 -5
- package/src/commands/openshell.ts +4 -4
- package/src/commands/owner.ts +5 -5
- package/src/commands/policy.ts +5 -5
- package/src/commands/relay.ts +5 -1
- package/src/commands/remediate.ts +5 -5
- package/src/commands/reputation.ts +6 -6
- package/src/commands/setup.ts +1 -1
- package/src/commands/trust.ts +6 -6
- package/src/commands/verify.ts +6 -6
- package/src/commands/wallet.ts +15 -15
- package/src/commands/watch.ts +3 -3
- package/src/commands/watchtower.ts +6 -6
- package/src/commands/workroom.ts +14 -10
- package/src/daemon/config.ts +2 -1
- package/src/daemon/hire-listener.ts +3 -3
- package/src/daemon/index.ts +10 -9
- package/src/daemon/job-lifecycle.ts +1 -1
- package/src/daemon/notify.ts +4 -4
- package/src/daemon/userops.ts +4 -4
- package/src/daemon/wallet-monitor.ts +2 -2
- package/src/endpoint-notify.ts +1 -1
- package/src/index.ts +8 -7
- package/src/openshell-runtime.ts +5 -1
- package/src/program.ts +36 -36
- package/src/repl.ts +3 -3
- package/src/tui/App.tsx +75 -52
- package/src/tui/Header.tsx +26 -12
- package/src/tui/InputLine.tsx +108 -33
- package/src/tui/Viewport.tsx +22 -18
- package/src/tui/WalletConnectPairing.tsx +131 -0
- package/src/tui/components/Button.tsx +38 -0
- package/src/tui/components/CeremonyView.tsx +39 -0
- package/src/tui/components/CompletionDropdown.tsx +59 -0
- package/src/tui/components/ConfirmPrompt.tsx +36 -0
- package/src/tui/components/InteractiveTable.tsx +112 -0
- package/src/tui/components/StepSpinner.tsx +84 -0
- package/src/tui/components/Toast.tsx +59 -0
- package/src/tui/index.tsx +27 -9
- package/src/tui/useChat.ts +1 -1
- package/src/tui/useCommand.ts +86 -183
- package/src/tui/useNotifications.ts +28 -0
- package/src/ui/banner.ts +29 -2
- package/src/ui/tree.ts +1 -1
- package/src/wallet-router.ts +2 -2
- package/src/walletconnect-session.ts +1 -1
- package/src/walletconnect.ts +20 -5
- package/tsconfig.json +16 -7
package/INK6-UX-SPEC.md
ADDED
|
@@ -0,0 +1,446 @@
|
|
|
1
|
+
# Ink 6 UX Enhancement Spec
|
|
2
|
+
|
|
3
|
+
## Context
|
|
4
|
+
CLI is now on Ink 6 + React 19 + ESM. The WalletConnect native component exists.
|
|
5
|
+
This spec covers ALL remaining Ink 6 UX capabilities to build before the article demo.
|
|
6
|
+
|
|
7
|
+
## Current TUI Architecture
|
|
8
|
+
```
|
|
9
|
+
src/tui/
|
|
10
|
+
├── App.tsx — Root component, layout, command dispatch
|
|
11
|
+
├── Header.tsx — ASCII banner + network/wallet/balance
|
|
12
|
+
├── Viewport.tsx — Scrollable output buffer
|
|
13
|
+
├── InputLine.tsx — Text input with history + tab completion
|
|
14
|
+
├── Footer.tsx — Footer wrapper
|
|
15
|
+
├── WalletConnectPairing.tsx — Native WC QR + status (new from Phase 3)
|
|
16
|
+
├── index.tsx — TUI launcher
|
|
17
|
+
├── useCommand.ts — Command dispatch (in-process + child process)
|
|
18
|
+
├── useChat.ts — Chat gateway integration
|
|
19
|
+
└── useScroll.ts — Viewport scroll state
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## Feature 1: Full-Screen Mode
|
|
25
|
+
|
|
26
|
+
### What
|
|
27
|
+
Use Ink 6's `fullScreen` option on `render()` to use the alternate screen buffer.
|
|
28
|
+
|
|
29
|
+
### Why
|
|
30
|
+
- Clean entry: terminal history preserved, TUI gets a blank canvas
|
|
31
|
+
- Clean exit: original terminal content restored
|
|
32
|
+
- Proper resize: Ink reflows on SIGWINCH in full-screen mode
|
|
33
|
+
- No visual artifacts from previous commands bleeding into the TUI
|
|
34
|
+
|
|
35
|
+
### Implementation
|
|
36
|
+
In `src/tui/index.tsx`, change the render call:
|
|
37
|
+
```tsx
|
|
38
|
+
const { waitUntilExit } = render(<App ... />, {
|
|
39
|
+
exitOnCtrlC: true,
|
|
40
|
+
});
|
|
41
|
+
```
|
|
42
|
+
Ink 6's `render()` supports a second options argument. Check if `fullScreen` is a boolean option or if it's handled via `<Box height="100%">` with the alternate buffer.
|
|
43
|
+
|
|
44
|
+
If Ink 6 doesn't have a built-in fullScreen option, implement manually:
|
|
45
|
+
```tsx
|
|
46
|
+
// Enter alternate buffer
|
|
47
|
+
process.stdout.write('\x1b[?1049h');
|
|
48
|
+
// ... render ...
|
|
49
|
+
// On exit, restore
|
|
50
|
+
process.stdout.write('\x1b[?1049l');
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Files to change
|
|
54
|
+
- `src/tui/index.tsx` — add alternate screen buffer enter/exit
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## Feature 2: Static Banner with `<Static>`
|
|
59
|
+
|
|
60
|
+
### What
|
|
61
|
+
Wrap the ASCII art banner in Ink's `<Static>` component so it renders once and never re-renders.
|
|
62
|
+
|
|
63
|
+
### Why
|
|
64
|
+
- The banner is ~12 lines of ASCII art that NEVER changes after launch
|
|
65
|
+
- Currently re-renders on every state change (output buffer update, scroll, input change)
|
|
66
|
+
- `<Static>` renders items once above the dynamic area — perfect for the banner
|
|
67
|
+
|
|
68
|
+
### Implementation
|
|
69
|
+
In `App.tsx`, replace the `<Header>` component with a `<Static>` block:
|
|
70
|
+
```tsx
|
|
71
|
+
import { Static } from "ink";
|
|
72
|
+
|
|
73
|
+
// Banner lines computed once
|
|
74
|
+
const [bannerItems] = useState(() => getBannerLines({ network, wallet, balance }));
|
|
75
|
+
|
|
76
|
+
return (
|
|
77
|
+
<Box flexDirection="column" height="100%">
|
|
78
|
+
<Static items={bannerItems}>
|
|
79
|
+
{(line, i) => <Text key={i}>{line}</Text>}
|
|
80
|
+
</Static>
|
|
81
|
+
<Text>{separator}</Text>
|
|
82
|
+
<Viewport ... />
|
|
83
|
+
<Text>{separator}</Text>
|
|
84
|
+
<InputLine ... />
|
|
85
|
+
</Box>
|
|
86
|
+
);
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Files to change
|
|
90
|
+
- `src/tui/App.tsx` — use `<Static>` for banner
|
|
91
|
+
- `src/tui/Header.tsx` — may become unnecessary (inline into App)
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## Feature 3: Spinner Components for Deploy Ceremony
|
|
96
|
+
|
|
97
|
+
### What
|
|
98
|
+
Create reusable `<StepSpinner>` and `<StepComplete>` components for multi-step flows.
|
|
99
|
+
|
|
100
|
+
### Why
|
|
101
|
+
The deploy + onboarding ceremony has 8+ sequential steps. Each should show:
|
|
102
|
+
- `◈ Step 3/8 — Setting guardian...` (spinning) while in progress
|
|
103
|
+
- `✓ Step 3/8 — Guardian set` (static) when done
|
|
104
|
+
- `✗ Step 3/8 — Failed: reason` (static) on error
|
|
105
|
+
|
|
106
|
+
### Implementation
|
|
107
|
+
Create `src/tui/components/StepSpinner.tsx`:
|
|
108
|
+
```tsx
|
|
109
|
+
interface StepSpinnerProps {
|
|
110
|
+
step: number;
|
|
111
|
+
total: number;
|
|
112
|
+
label: string;
|
|
113
|
+
status: "pending" | "running" | "done" | "error";
|
|
114
|
+
detail?: string; // e.g. tx hash, address
|
|
115
|
+
error?: string;
|
|
116
|
+
}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Uses Ink's built-in spinner frames (or a simple `◈ ◇ ◆ ◈` cycle):
|
|
120
|
+
```
|
|
121
|
+
◈ Step 1/8 — Deploying wallet...
|
|
122
|
+
✓ Step 1/8 — Wallet deployed
|
|
123
|
+
└ 0xA34B...a5dc
|
|
124
|
+
◈ Step 2/8 — Authorizing machine key...
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Create `src/tui/components/CeremonyView.tsx`:
|
|
128
|
+
A container that manages the step list and renders each StepSpinner.
|
|
129
|
+
```tsx
|
|
130
|
+
interface CeremonyStep {
|
|
131
|
+
label: string;
|
|
132
|
+
status: "pending" | "running" | "done" | "error";
|
|
133
|
+
detail?: string;
|
|
134
|
+
error?: string;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
interface CeremonyViewProps {
|
|
138
|
+
title: string;
|
|
139
|
+
steps: CeremonyStep[];
|
|
140
|
+
}
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### Files to create
|
|
144
|
+
- `src/tui/components/StepSpinner.tsx`
|
|
145
|
+
- `src/tui/components/CeremonyView.tsx`
|
|
146
|
+
|
|
147
|
+
### Integration
|
|
148
|
+
Wire into `useCommand.ts` — when `wallet deploy` runs, instead of spawning a child process, render `<CeremonyView>` in the viewport with steps updating via React state.
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## Feature 4: Focus Management (`useFocus` / `useFocusManager`)
|
|
153
|
+
|
|
154
|
+
### What
|
|
155
|
+
Tab-navigable interactive elements in the TUI.
|
|
156
|
+
|
|
157
|
+
### Why
|
|
158
|
+
- Deploy wizard: Tab between "Confirm" / "Cancel" / "Change settings"
|
|
159
|
+
- WalletConnect: Tab between QR display and wallet link list
|
|
160
|
+
- Any confirmation prompt: focus on Yes/No buttons
|
|
161
|
+
|
|
162
|
+
### Implementation
|
|
163
|
+
Create `src/tui/components/Button.tsx`:
|
|
164
|
+
```tsx
|
|
165
|
+
interface ButtonProps {
|
|
166
|
+
label: string;
|
|
167
|
+
onPress: () => void;
|
|
168
|
+
variant?: "primary" | "danger" | "dim";
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
function Button({ label, onPress, variant = "primary" }: ButtonProps) {
|
|
172
|
+
const { isFocused } = useFocus();
|
|
173
|
+
return (
|
|
174
|
+
<Box>
|
|
175
|
+
<Text
|
|
176
|
+
color={isFocused ? "cyan" : "white"}
|
|
177
|
+
bold={isFocused}
|
|
178
|
+
>
|
|
179
|
+
{isFocused ? "▸ " : " "}{label}
|
|
180
|
+
</Text>
|
|
181
|
+
</Box>
|
|
182
|
+
);
|
|
183
|
+
}
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
Create `src/tui/components/ConfirmPrompt.tsx`:
|
|
187
|
+
```tsx
|
|
188
|
+
interface ConfirmPromptProps {
|
|
189
|
+
message: string;
|
|
190
|
+
onConfirm: () => void;
|
|
191
|
+
onCancel: () => void;
|
|
192
|
+
}
|
|
193
|
+
```
|
|
194
|
+
Renders two focusable buttons. Enter on focused button triggers action.
|
|
195
|
+
|
|
196
|
+
### Files to create
|
|
197
|
+
- `src/tui/components/Button.tsx`
|
|
198
|
+
- `src/tui/components/ConfirmPrompt.tsx`
|
|
199
|
+
|
|
200
|
+
---
|
|
201
|
+
|
|
202
|
+
## Feature 5: Enhanced Input (useInput)
|
|
203
|
+
|
|
204
|
+
### What
|
|
205
|
+
Better keyboard handling in the TUI.
|
|
206
|
+
|
|
207
|
+
### Why
|
|
208
|
+
- Ctrl+C: graceful shutdown (cleanup WC sessions, save state)
|
|
209
|
+
- Ctrl+L: clear viewport (like terminal clear)
|
|
210
|
+
- Page Up/Down: fast viewport scrolling
|
|
211
|
+
- Escape: cancel current operation / close prompts
|
|
212
|
+
|
|
213
|
+
### Implementation
|
|
214
|
+
In `App.tsx`, add a top-level `useInput` handler:
|
|
215
|
+
```tsx
|
|
216
|
+
useInput((input, key) => {
|
|
217
|
+
if (key.ctrl && input === 'l') {
|
|
218
|
+
setOutputBuffer([]);
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
221
|
+
if (key.pageUp) {
|
|
222
|
+
scrollUp(viewportHeight);
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
if (key.pageDown) {
|
|
226
|
+
scrollDown(viewportHeight);
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
if (key.escape) {
|
|
230
|
+
// Cancel current operation if any
|
|
231
|
+
return;
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
### Files to change
|
|
237
|
+
- `src/tui/App.tsx` — add useInput handler
|
|
238
|
+
- `src/tui/useScroll.ts` — expose page-size scroll functions
|
|
239
|
+
|
|
240
|
+
---
|
|
241
|
+
|
|
242
|
+
## Feature 6: FlexWrap for Status Bar
|
|
243
|
+
|
|
244
|
+
### What
|
|
245
|
+
Use `flexWrap="wrap"` on the header status info so it wraps on narrow terminals.
|
|
246
|
+
|
|
247
|
+
### Why
|
|
248
|
+
`Network Base Mainnet Wallet 0xa9e0...83bE Balance 0.0042 ETH`
|
|
249
|
+
On a narrow terminal this truncates. With flexWrap it becomes:
|
|
250
|
+
```
|
|
251
|
+
Network Base Mainnet
|
|
252
|
+
Wallet 0xa9e0...83bE
|
|
253
|
+
Balance 0.0042 ETH
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
### Implementation
|
|
257
|
+
In the banner/header, wrap status items in a `<Box flexWrap="wrap">`:
|
|
258
|
+
```tsx
|
|
259
|
+
<Box flexWrap="wrap" columnGap={2}>
|
|
260
|
+
<Box><Text dimColor>Network</Text><Text> {network}</Text></Box>
|
|
261
|
+
<Box><Text dimColor>Wallet</Text><Text> {wallet}</Text></Box>
|
|
262
|
+
<Box><Text dimColor>Balance</Text><Text> {balance}</Text></Box>
|
|
263
|
+
</Box>
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
### Files to change
|
|
267
|
+
- `src/ui/banner.ts` — return structured data instead of pre-formatted strings
|
|
268
|
+
- `src/tui/Header.tsx` — use flexWrap Box layout
|
|
269
|
+
|
|
270
|
+
---
|
|
271
|
+
|
|
272
|
+
## Feature 7: Notification Toasts
|
|
273
|
+
|
|
274
|
+
### What
|
|
275
|
+
Non-blocking notifications that appear briefly in the TUI when background events occur.
|
|
276
|
+
|
|
277
|
+
### Why
|
|
278
|
+
When the daemon is running and receives a hire request, dispute, or payment — show it.
|
|
279
|
+
|
|
280
|
+
### Implementation
|
|
281
|
+
Create `src/tui/components/Toast.tsx`:
|
|
282
|
+
```tsx
|
|
283
|
+
interface ToastProps {
|
|
284
|
+
message: string;
|
|
285
|
+
variant: "info" | "success" | "warning" | "error";
|
|
286
|
+
duration?: number; // ms, default 5000
|
|
287
|
+
}
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
Create `src/tui/useNotifications.ts`:
|
|
291
|
+
```tsx
|
|
292
|
+
function useNotifications() {
|
|
293
|
+
const [toasts, setToasts] = useState<Toast[]>([]);
|
|
294
|
+
const push = (toast: Omit<Toast, "id">) => { ... };
|
|
295
|
+
const dismiss = (id: string) => { ... };
|
|
296
|
+
return { toasts, push, dismiss };
|
|
297
|
+
}
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
Toasts render in a fixed position above the input line, auto-dismiss after duration.
|
|
301
|
+
|
|
302
|
+
### Files to create
|
|
303
|
+
- `src/tui/components/Toast.tsx`
|
|
304
|
+
- `src/tui/useNotifications.ts`
|
|
305
|
+
|
|
306
|
+
### Integration
|
|
307
|
+
The daemon WebSocket connection (if running) emits events → push toast.
|
|
308
|
+
|
|
309
|
+
---
|
|
310
|
+
|
|
311
|
+
## Feature 8: Tab-Completion Dropdown
|
|
312
|
+
|
|
313
|
+
### What
|
|
314
|
+
Show a dropdown list of completion candidates when Tab is pressed.
|
|
315
|
+
|
|
316
|
+
### Why
|
|
317
|
+
Current tab completion silently completes in the input. Users don't know what's available.
|
|
318
|
+
|
|
319
|
+
### Implementation
|
|
320
|
+
Create `src/tui/components/CompletionDropdown.tsx`:
|
|
321
|
+
```tsx
|
|
322
|
+
interface CompletionDropdownProps {
|
|
323
|
+
candidates: string[];
|
|
324
|
+
selectedIndex: number;
|
|
325
|
+
visible: boolean;
|
|
326
|
+
}
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
Renders a floating box above the input line showing matching commands:
|
|
330
|
+
```
|
|
331
|
+
wallet deploy
|
|
332
|
+
wallet status
|
|
333
|
+
wallet balance
|
|
334
|
+
wallet freeze
|
|
335
|
+
◈ arc402 > wallet d_
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
Arrow keys navigate, Tab/Enter selects, Escape dismisses.
|
|
339
|
+
|
|
340
|
+
### Files to create
|
|
341
|
+
- `src/tui/components/CompletionDropdown.tsx`
|
|
342
|
+
|
|
343
|
+
### Files to change
|
|
344
|
+
- `src/tui/InputLine.tsx` — manage dropdown state, render above input
|
|
345
|
+
|
|
346
|
+
---
|
|
347
|
+
|
|
348
|
+
## Feature 9: Interactive Tables
|
|
349
|
+
|
|
350
|
+
### What
|
|
351
|
+
Scrollable, selectable table component for list views.
|
|
352
|
+
|
|
353
|
+
### Why
|
|
354
|
+
`discover`, `agreements list`, `wallet list`, `list-machine-keys` all return tabular data.
|
|
355
|
+
Currently rendered as plain text. Should be interactive: arrow keys to navigate rows, Enter to drill in.
|
|
356
|
+
|
|
357
|
+
### Implementation
|
|
358
|
+
Create `src/tui/components/InteractiveTable.tsx`:
|
|
359
|
+
```tsx
|
|
360
|
+
interface Column {
|
|
361
|
+
header: string;
|
|
362
|
+
key: string;
|
|
363
|
+
width?: number;
|
|
364
|
+
align?: "left" | "right";
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
interface InteractiveTableProps {
|
|
368
|
+
columns: Column[];
|
|
369
|
+
rows: Record<string, string>[];
|
|
370
|
+
onSelect?: (row: Record<string, string>, index: number) => void;
|
|
371
|
+
selectedIndex?: number;
|
|
372
|
+
}
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
Renders with box-drawing borders for the header row:
|
|
376
|
+
```
|
|
377
|
+
Agent Service Trust Endpoint
|
|
378
|
+
─────────────────────────────────────────────────
|
|
379
|
+
▸ GigaBrain intelligence 850 gigabrain.arc402.xyz
|
|
380
|
+
CodeReviewer code.review 720 reviewer.arc402.xyz
|
|
381
|
+
DataOracle data.feed 690 oracle.arc402.xyz
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
### Files to create
|
|
385
|
+
- `src/tui/components/InteractiveTable.tsx`
|
|
386
|
+
|
|
387
|
+
---
|
|
388
|
+
|
|
389
|
+
## Feature 10: Split Pane (Future — Post-Launch)
|
|
390
|
+
|
|
391
|
+
### What
|
|
392
|
+
Side-by-side panes: command output left, daemon logs right.
|
|
393
|
+
|
|
394
|
+
### Why
|
|
395
|
+
Power users running the daemon want to see live events while issuing commands.
|
|
396
|
+
|
|
397
|
+
### Implementation (design only — build post-launch)
|
|
398
|
+
Create `src/tui/components/SplitPane.tsx`:
|
|
399
|
+
```tsx
|
|
400
|
+
interface SplitPaneProps {
|
|
401
|
+
left: React.ReactNode;
|
|
402
|
+
right: React.ReactNode;
|
|
403
|
+
ratio?: number; // 0.0-1.0, default 0.6
|
|
404
|
+
}
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
Uses Ink 6's `<Box width="60%">` + `<Box width="40%">` for the split.
|
|
408
|
+
|
|
409
|
+
### Files to create (post-launch)
|
|
410
|
+
- `src/tui/components/SplitPane.tsx`
|
|
411
|
+
|
|
412
|
+
---
|
|
413
|
+
|
|
414
|
+
## Build Order
|
|
415
|
+
|
|
416
|
+
1. Full-screen mode (Feature 1) — foundational
|
|
417
|
+
2. Static banner (Feature 2) — performance
|
|
418
|
+
3. Enhanced input / keyboard (Feature 5) — UX basics
|
|
419
|
+
4. Spinner components (Feature 3) — deploy ceremony visual
|
|
420
|
+
5. Focus management + buttons (Feature 4) — interactive deploy wizard
|
|
421
|
+
6. FlexWrap status bar (Feature 6) — responsive layout
|
|
422
|
+
7. Tab-completion dropdown (Feature 8) — discoverability
|
|
423
|
+
8. Interactive tables (Feature 9) — list views
|
|
424
|
+
9. Notification toasts (Feature 7) — daemon integration
|
|
425
|
+
10. Split pane (Feature 10) — post-launch
|
|
426
|
+
|
|
427
|
+
Features 1-8 are for the article demo. Feature 9 is nice-to-have. Feature 10 is post-launch.
|
|
428
|
+
|
|
429
|
+
---
|
|
430
|
+
|
|
431
|
+
## Testing Checklist
|
|
432
|
+
|
|
433
|
+
After build:
|
|
434
|
+
- [ ] `arc402` launches in full-screen mode, clean entry
|
|
435
|
+
- [ ] Ctrl+C exits cleanly, original terminal restored
|
|
436
|
+
- [ ] Ctrl+L clears viewport
|
|
437
|
+
- [ ] Page Up/Down scrolls viewport
|
|
438
|
+
- [ ] Tab shows completion dropdown
|
|
439
|
+
- [ ] `wallet deploy` shows QR inside viewport
|
|
440
|
+
- [ ] Deploy ceremony shows step spinners
|
|
441
|
+
- [ ] Confirmation prompts are focusable (Tab between buttons)
|
|
442
|
+
- [ ] `discover` renders interactive table
|
|
443
|
+
- [ ] Narrow terminal: status bar wraps correctly
|
|
444
|
+
- [ ] `exit` / `quit` restores terminal cleanly
|
|
445
|
+
- [ ] `arc402 wallet status` (one-shot mode) still works outside TUI
|
|
446
|
+
- [ ] `arc402 --help` still works
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# Ink 6 + ESM Migration Spec
|
|
2
|
+
|
|
3
|
+
## Goal
|
|
4
|
+
Migrate ARC-402 CLI from Ink 3 (CommonJS) to Ink 6 (ESM + React 19).
|
|
5
|
+
Also build a native WalletConnect Ink component so QR codes render inside the TUI viewport.
|
|
6
|
+
|
|
7
|
+
## Current State
|
|
8
|
+
- ink@3.2.0, react@18.3.1, ink-text-input@4.0.3
|
|
9
|
+
- tsconfig: module=commonjs, target=ES2020
|
|
10
|
+
- ~33k lines of TypeScript across 53+ source files
|
|
11
|
+
- All source uses `import/export` syntax, compiled to CJS by tsc
|
|
12
|
+
- Some files use `require()` for package.json reads
|
|
13
|
+
- TUI files: src/tui/ (App.tsx, Header.tsx, Viewport.tsx, InputLine.tsx, Footer.tsx, index.tsx, useChat.ts, useCommand.ts, useScroll.ts)
|
|
14
|
+
|
|
15
|
+
## Phase 1: ESM + Ink 6 Migration
|
|
16
|
+
|
|
17
|
+
### Step 1: Update package.json
|
|
18
|
+
- Add `"type": "module"`
|
|
19
|
+
- Update deps: `ink@^6.8.0`, `react@^19.0.0`, `@types/react@^19.0.0`, `ink-text-input@^6.0.0`
|
|
20
|
+
- Add `react-devtools-core` as optional peer dep if needed
|
|
21
|
+
- Run `npm install`
|
|
22
|
+
|
|
23
|
+
### Step 2: Update tsconfig.json
|
|
24
|
+
- Change `"module": "NodeNext"` and add `"moduleResolution": "NodeNext"`
|
|
25
|
+
- Change `"target": "ES2022"` and `"lib": ["ES2022"]`
|
|
26
|
+
- Remove the `paths` entries for ink/ink-text-input (Ink 6 has proper types)
|
|
27
|
+
- Add ethers path mapping if needed: `"ethers": ["./node_modules/ethers/lib.commonjs/index.d.ts"]`
|
|
28
|
+
|
|
29
|
+
### Step 3: Fix ALL relative imports
|
|
30
|
+
Every `import ... from "./foo"` must become `import ... from "./foo.js"`.
|
|
31
|
+
Every `import ... from "../foo"` must become `import ... from "../foo.js"`.
|
|
32
|
+
TSX files: `import ... from "./App"` → `import ... from "./App.js"` (tsc compiles .tsx to .js)
|
|
33
|
+
|
|
34
|
+
### Step 4: Convert require() calls to import
|
|
35
|
+
- `require("../../package.json")` → use `createRequire(import.meta.url)` from `"node:module"`
|
|
36
|
+
- `require("ethers")` etc → already using `import`, should be fine
|
|
37
|
+
- Dynamic requires → convert to dynamic `import()`
|
|
38
|
+
|
|
39
|
+
### Step 5: Fix Ink 6 API changes
|
|
40
|
+
- Check if `useStdout`, `useInput`, `useApp` signatures changed
|
|
41
|
+
- `ink-text-input@6` may have different import path or component API
|
|
42
|
+
- `<Static>` component may have changed
|
|
43
|
+
- Verify `render()` function signature
|
|
44
|
+
|
|
45
|
+
### Step 6: Build & fix errors iteratively
|
|
46
|
+
- Run `npx tsc --noEmit` after each batch of changes
|
|
47
|
+
- Fix type errors in batches by file category (TUI files first, then commands, then daemon)
|
|
48
|
+
|
|
49
|
+
## Phase 2: TUI Design Improvements
|
|
50
|
+
|
|
51
|
+
### Step 7: Remove vertical box borders
|
|
52
|
+
The TUI should use horizontal separator lines only (no │ borders — they break on resize):
|
|
53
|
+
```
|
|
54
|
+
██████╗ ██████╗ ██████╗ ...
|
|
55
|
+
agent-to-agent arcing · v0.7.5
|
|
56
|
+
◈ ──────────────────────────────────────
|
|
57
|
+
Network Base Mainnet Wallet 0xa9e0..
|
|
58
|
+
─────────────────────────────────────────────
|
|
59
|
+
scrollable output area
|
|
60
|
+
─────────────────────────────────────────────
|
|
61
|
+
◈ arc402 > _
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Step 8: ARC402_NO_TUI env guard
|
|
65
|
+
In src/index.ts, the TTY TUI launch condition must check `!process.env.ARC402_NO_TUI`:
|
|
66
|
+
```ts
|
|
67
|
+
} else if (process.stdout.isTTY && !hasSubcommand && process.argv.length <= 2 && !process.env.ARC402_NO_TUI) {
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Phase 3: Native WalletConnect Component
|
|
71
|
+
|
|
72
|
+
### Step 9: Create WalletConnect Ink component
|
|
73
|
+
Create `src/tui/WalletConnectPairing.tsx`:
|
|
74
|
+
- Renders QR code as ASCII text inside the viewport
|
|
75
|
+
- Shows wallet deep links (MetaMask, Rainbow, Trust)
|
|
76
|
+
- Shows "Waiting for approval..." status
|
|
77
|
+
- Handles connection success/failure as React state transitions
|
|
78
|
+
|
|
79
|
+
This requires refactoring `src/walletconnect.ts`:
|
|
80
|
+
- Extract the pairing logic into an event-emitter or callback-based API
|
|
81
|
+
- The current `connectPhoneWallet()` does console.log for QR — change it to accept
|
|
82
|
+
an `onUri` callback and an `onStatus` callback instead
|
|
83
|
+
- Keep the existing console.log behavior as the default (for one-shot CLI mode)
|
|
84
|
+
|
|
85
|
+
### Step 10: Wire WalletConnect component into useCommand
|
|
86
|
+
Instead of spawning a child process for interactive commands, render the
|
|
87
|
+
WalletConnect pairing component inside the viewport when `wallet deploy` runs.
|
|
88
|
+
|
|
89
|
+
The multi-step deploy wizard becomes a state machine:
|
|
90
|
+
1. CONNECTING → show QR + links
|
|
91
|
+
2. CONNECTED → show account, deploy tx
|
|
92
|
+
3. DEPLOYING → show spinner
|
|
93
|
+
4. ONBOARDING → show each ceremony step
|
|
94
|
+
5. COMPLETE → show summary tree
|
|
95
|
+
|
|
96
|
+
## Rules
|
|
97
|
+
- Do NOT change any business logic in command handlers
|
|
98
|
+
- Do NOT change contract addresses, ABIs, or deployment logic
|
|
99
|
+
- Keep all existing CLI one-shot behavior working (`arc402 wallet deploy` outside TUI)
|
|
100
|
+
- Test with `npx tsc --noEmit` frequently
|
|
101
|
+
- After build succeeds, test `node dist/index.js --help` to verify one-shot mode works
|
|
102
|
+
|
|
103
|
+
## Build & verify
|
|
104
|
+
```bash
|
|
105
|
+
npm run build
|
|
106
|
+
node dist/index.js --help # one-shot mode
|
|
107
|
+
node dist/index.js # TUI mode (if TTY)
|
|
108
|
+
```
|
package/dist/abis.js
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* ABIs extracted from the ARC-402 contract sources.
|
|
4
3
|
* Source: /products/arc-402/reference/contracts/
|
|
5
4
|
*/
|
|
6
|
-
|
|
7
|
-
exports.ARC402_WALLET_PASSKEY_ABI = exports.ARC402_WALLET_MACHINE_KEY_ABI = exports.ARC402_WALLET_OWNER_ABI = exports.ARC402_WALLET_REGISTRY_ABI = exports.ARC402_WALLET_GUARDIAN_ABI = exports.ARC402_WALLET_PROTOCOL_ABI = exports.ARC402_WALLET_EXECUTE_ABI = exports.POLICY_ENGINE_GOVERNANCE_ABI = exports.POLICY_ENGINE_LIMITS_ABI = exports.WALLET_FACTORY_ABI = exports.ERC20_ABI = exports.TRUST_REGISTRY_ABI = exports.SERVICE_AGREEMENT_ABI = exports.AGENT_REGISTRY_ABI = void 0;
|
|
8
|
-
exports.AGENT_REGISTRY_ABI = [
|
|
5
|
+
export const AGENT_REGISTRY_ABI = [
|
|
9
6
|
// Registration
|
|
10
7
|
"function register(string name, string[] capabilities, string serviceType, string endpoint, string metadataURI) external",
|
|
11
8
|
"function update(string name, string[] capabilities, string serviceType, string endpoint, string metadataURI) external",
|
|
@@ -24,7 +21,7 @@ exports.AGENT_REGISTRY_ABI = [
|
|
|
24
21
|
"event AgentUpdated(address indexed wallet, string name, string serviceType)",
|
|
25
22
|
"event AgentDeactivated(address indexed wallet)",
|
|
26
23
|
];
|
|
27
|
-
|
|
24
|
+
export const SERVICE_AGREEMENT_ABI = [
|
|
28
25
|
"function propose(address provider, string serviceType, string description, uint256 price, address token, uint256 deadline, bytes32 deliverablesHash) external payable returns (uint256 agreementId)",
|
|
29
26
|
"function accept(uint256 agreementId) external",
|
|
30
27
|
"function fulfill(uint256 agreementId, bytes32 actualDeliverablesHash) external",
|
|
@@ -69,7 +66,7 @@ exports.SERVICE_AGREEMENT_ABI = [
|
|
|
69
66
|
"event AgreementDisputed(uint256 indexed id, address indexed initiator, string reason)",
|
|
70
67
|
"event AgreementCancelled(uint256 indexed id, address indexed client)",
|
|
71
68
|
];
|
|
72
|
-
|
|
69
|
+
export const TRUST_REGISTRY_ABI = [
|
|
73
70
|
"function getScore(address wallet) external view returns (uint256)",
|
|
74
71
|
"function getTrustLevel(address wallet) external view returns (string)",
|
|
75
72
|
"function initWallet(address wallet) external",
|
|
@@ -77,20 +74,20 @@ exports.TRUST_REGISTRY_ABI = [
|
|
|
77
74
|
"function recordAnomaly(address wallet) external",
|
|
78
75
|
"function owner() external view returns (address)",
|
|
79
76
|
];
|
|
80
|
-
|
|
77
|
+
export const ERC20_ABI = [
|
|
81
78
|
"function approve(address spender, uint256 amount) external returns (bool)",
|
|
82
79
|
"function allowance(address owner, address spender) external view returns (uint256)",
|
|
83
80
|
"function balanceOf(address owner) external view returns (uint256)",
|
|
84
81
|
"function decimals() external view returns (uint8)",
|
|
85
82
|
"function symbol() external view returns (string)",
|
|
86
83
|
];
|
|
87
|
-
|
|
84
|
+
export const WALLET_FACTORY_ABI = [
|
|
88
85
|
"function createWallet(address _entryPoint) external returns (address)",
|
|
89
86
|
"function getWallets(address owner) external view returns (address[] memory)",
|
|
90
87
|
"function totalWallets() external view returns (uint256)",
|
|
91
88
|
"event WalletCreated(address indexed owner, address indexed walletAddress)",
|
|
92
89
|
];
|
|
93
|
-
|
|
90
|
+
export const POLICY_ENGINE_LIMITS_ABI = [
|
|
94
91
|
// Auto-getters from public mappings (actual on-chain function names)
|
|
95
92
|
"function categoryLimits(address wallet, string category) external view returns (uint256)",
|
|
96
93
|
"function dailyCategoryLimit(address wallet, string category) external view returns (uint256)",
|
|
@@ -99,7 +96,7 @@ exports.POLICY_ENGINE_LIMITS_ABI = [
|
|
|
99
96
|
"function setDailyLimitFor(address wallet, string category, uint256 limit) external",
|
|
100
97
|
];
|
|
101
98
|
// PolicyEngine governance functions — for onboarding ceremony
|
|
102
|
-
|
|
99
|
+
export const POLICY_ENGINE_GOVERNANCE_ABI = [
|
|
103
100
|
// registerWallet requires msg.sender == wallet — route through wallet's executeContractCall
|
|
104
101
|
"function registerWallet(address wallet, address owner) external",
|
|
105
102
|
// enableDefiAccess: onlyWalletOwnerOrWallet — owner can call directly on PolicyEngine
|
|
@@ -108,11 +105,11 @@ exports.POLICY_ENGINE_GOVERNANCE_ABI = [
|
|
|
108
105
|
"function walletOwners(address wallet) external view returns (address)",
|
|
109
106
|
"function defiAccessEnabled(address wallet) external view returns (bool)",
|
|
110
107
|
];
|
|
111
|
-
|
|
108
|
+
export const ARC402_WALLET_EXECUTE_ABI = [
|
|
112
109
|
"function executeContractCall((address target, bytes data, uint256 value, uint256 minReturnValue, uint256 maxApprovalAmount, address approvalToken) params) external returns (bytes memory)",
|
|
113
110
|
];
|
|
114
111
|
// Direct protocol functions — all onlyOwnerOrMachineKey, never route through executeContractCall
|
|
115
|
-
|
|
112
|
+
export const ARC402_WALLET_PROTOCOL_ABI = [
|
|
116
113
|
"function openContext(bytes32 contextId, string calldata taskType) external",
|
|
117
114
|
"function closeContext() external",
|
|
118
115
|
"function contextOpen() external view returns (bool)",
|
|
@@ -120,7 +117,7 @@ exports.ARC402_WALLET_PROTOCOL_ABI = [
|
|
|
120
117
|
"function executeSpend(address payable recipient, uint256 amount, string calldata category, bytes32 attestationId) external",
|
|
121
118
|
"function executeTokenSpend(address recipient, uint256 amount, address token, string calldata category, bytes32 attestationId) external",
|
|
122
119
|
];
|
|
123
|
-
|
|
120
|
+
export const ARC402_WALLET_GUARDIAN_ABI = [
|
|
124
121
|
// Guardian management (owner only)
|
|
125
122
|
"function setGuardian(address _guardian) external",
|
|
126
123
|
// Guardian freeze functions (guardian key only)
|
|
@@ -141,7 +138,7 @@ exports.ARC402_WALLET_GUARDIAN_ABI = [
|
|
|
141
138
|
"event WalletUnfrozen(address indexed by, uint256 timestamp)",
|
|
142
139
|
"event GuardianUpdated(address indexed newGuardian)",
|
|
143
140
|
];
|
|
144
|
-
|
|
141
|
+
export const ARC402_WALLET_REGISTRY_ABI = [
|
|
145
142
|
"function proposeRegistryUpdate(address newRegistry) external",
|
|
146
143
|
"function executeRegistryUpdate() external",
|
|
147
144
|
"function cancelRegistryUpdate() external",
|
|
@@ -149,7 +146,7 @@ exports.ARC402_WALLET_REGISTRY_ABI = [
|
|
|
149
146
|
"function registryUpdateUnlockAt() external view returns (uint256)",
|
|
150
147
|
"function registry() external view returns (address)",
|
|
151
148
|
];
|
|
152
|
-
|
|
149
|
+
export const ARC402_WALLET_OWNER_ABI = [
|
|
153
150
|
// Owner-only setters
|
|
154
151
|
"function setAuthorizedInterceptor(address interceptor) external",
|
|
155
152
|
"function setVelocityLimit(uint256 limit) external",
|
|
@@ -161,12 +158,12 @@ exports.ARC402_WALLET_OWNER_ABI = [
|
|
|
161
158
|
"function cumulativeSpend() external view returns (uint256)",
|
|
162
159
|
"function activePolicyId() external view returns (bytes32)",
|
|
163
160
|
];
|
|
164
|
-
|
|
161
|
+
export const ARC402_WALLET_MACHINE_KEY_ABI = [
|
|
165
162
|
"function authorizeMachineKey(address key) external",
|
|
166
163
|
"function revokeMachineKey(address key) external",
|
|
167
164
|
"function authorizedMachineKeys(address key) external view returns (bool)",
|
|
168
165
|
];
|
|
169
|
-
|
|
166
|
+
export const ARC402_WALLET_PASSKEY_ABI = [
|
|
170
167
|
"function setPasskey(bytes32 pubKeyX, bytes32 pubKeyY) external",
|
|
171
168
|
"function clearPasskey() external",
|
|
172
169
|
"function emergencyOwnerOverride(bytes32 newPubKeyX, bytes32 newPubKeyY) external",
|
package/dist/abis.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"abis.js","sourceRoot":"","sources":["../src/abis.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"abis.js","sourceRoot":"","sources":["../src/abis.ts"],"names":[],"mappings":"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"}
|
package/dist/bundler.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Arc402Config } from "./config";
|
|
1
|
+
import type { Arc402Config } from "./config.js";
|
|
2
2
|
export declare const DEFAULT_ENTRY_POINT = "0x0000000071727De22E5E9d8BAf0edAc6f37da032";
|
|
3
3
|
export declare const DEFAULT_BUNDLER_URL = "https://api.pimlico.io/v2/base/rpc";
|
|
4
4
|
export type UserOperation = {
|