moneyos 0.2.1 → 0.3.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/README.md +180 -25
- package/dist/cli/index.js +2160 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/index.cjs +720 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +405 -0
- package/dist/index.d.ts +300 -30
- package/dist/index.js +474 -240
- package/dist/index.js.map +1 -1
- package/package.json +30 -10
- package/dist/cli/index.mjs +0 -570
- package/dist/cli/index.mjs.map +0 -1
- package/dist/index.d.mts +0 -135
- package/dist/index.mjs +0 -429
- package/dist/index.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -1,55 +1,210 @@
|
|
|
1
1
|
# MoneyOS
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
MoneyOS is an open source programmable money SDK and CLI for developers and AI
|
|
4
|
+
agents. The repo includes balance, send, swap, runtime-composition, wallet,
|
|
5
|
+
and executor code, with the project currently centered on Arbitrum.
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
The project is still early. Package boundaries and some APIs are still settling,
|
|
8
|
+
but the repo is structured so each major surface can evolve independently.
|
|
9
|
+
|
|
10
|
+
## What lives in this repo
|
|
11
|
+
|
|
12
|
+
- `moneyos`: the root SDK + CLI package
|
|
13
|
+
- `@moneyos/core`: runtime interfaces, shared types, chain/token registries
|
|
14
|
+
- `@moneyos/tool-swap`: swap execution tool and provider surface
|
|
15
|
+
- `@moneyos/executor-particle`: Particle AA smart-account executor
|
|
16
|
+
|
|
17
|
+
## CLI
|
|
18
|
+
|
|
19
|
+
Available commands:
|
|
6
20
|
|
|
7
21
|
```bash
|
|
8
|
-
|
|
22
|
+
moneyos init [--key 0x...] [--force] [--chain 42161] [--rpc https://...]
|
|
23
|
+
moneyos auth unlock
|
|
24
|
+
moneyos auth lock
|
|
25
|
+
moneyos auth status
|
|
26
|
+
moneyos backup export [--out ./wallet-backup.json] [--force]
|
|
27
|
+
moneyos backup restore <path> [--force]
|
|
28
|
+
moneyos backup status
|
|
29
|
+
moneyos keystore status
|
|
30
|
+
moneyos balance <token> [--address 0x...]
|
|
31
|
+
moneyos send <amount> <token> <to>
|
|
32
|
+
moneyos swap <amount> <tokenIn> <tokenOut>
|
|
9
33
|
```
|
|
10
34
|
|
|
11
|
-
|
|
35
|
+
For the full command surface and flag details, run `moneyos --help`.
|
|
36
|
+
|
|
37
|
+
Example:
|
|
12
38
|
|
|
13
39
|
```bash
|
|
14
|
-
|
|
40
|
+
moneyos init
|
|
41
|
+
moneyos auth unlock
|
|
15
42
|
moneyos balance USDC
|
|
16
|
-
moneyos
|
|
17
|
-
|
|
18
|
-
# Send tokens
|
|
19
|
-
moneyos send 10 USDC 0x...
|
|
20
|
-
moneyos send 0.1 ETH 0x...
|
|
43
|
+
moneyos backup status
|
|
21
44
|
```
|
|
22
45
|
|
|
23
46
|
## SDK
|
|
24
47
|
|
|
25
|
-
```
|
|
26
|
-
import {
|
|
48
|
+
```ts
|
|
49
|
+
import { createMoneyOS } from "moneyos";
|
|
27
50
|
|
|
28
|
-
const moneyos =
|
|
51
|
+
const moneyos = createMoneyOS({
|
|
29
52
|
chainId: 42161,
|
|
30
|
-
privateKey: process.env.
|
|
53
|
+
privateKey: process.env.MONEYOS_PRIVATE_KEY as `0x${string}`,
|
|
31
54
|
});
|
|
32
55
|
|
|
33
|
-
// Check balance
|
|
34
56
|
const balance = await moneyos.balance("USDC");
|
|
35
|
-
console.log(balance.amount);
|
|
57
|
+
console.log(balance.amount);
|
|
36
58
|
|
|
37
|
-
// Send tokens
|
|
38
59
|
const tx = await moneyos.send("USDC", "0x...", "10");
|
|
39
60
|
console.log(tx.hash);
|
|
40
61
|
```
|
|
41
62
|
|
|
42
|
-
|
|
63
|
+
The runtime seam is intentionally small. `createMoneyOS` can also take injected
|
|
64
|
+
`execute`, `read`, and `assets` implementations, which is how external packages
|
|
65
|
+
plug in.
|
|
66
|
+
|
|
67
|
+
## Published npm package
|
|
68
|
+
|
|
69
|
+
The current `main` branch is ahead of the published npm package. The encrypted
|
|
70
|
+
wallet flow described below requires cloning this repo and building from
|
|
71
|
+
source. `npm install moneyos` currently gives you an older pre-encrypted-wallet
|
|
72
|
+
release.
|
|
73
|
+
|
|
74
|
+
## Current wallet model
|
|
75
|
+
|
|
76
|
+
What is landed in code today:
|
|
77
|
+
|
|
78
|
+
- The CLI stores the root wallet in an encrypted local wallet file at `~/.moneyos/wallet.json`
|
|
79
|
+
- `~/.moneyos/config.json` now stores only non-secret settings such as chain and RPC configuration
|
|
80
|
+
- `MONEYOS_PRIVATE_KEY` remains an explicit override for ephemeral CI or agent runs
|
|
81
|
+
- `moneyos auth unlock` opens a short-lived local session for write commands
|
|
82
|
+
- `moneyos backup export|restore|status` manages encrypted wallet backups
|
|
83
|
+
- Normal wallet commands resolve their write path through one shared session-aware flow
|
|
84
|
+
- Local EOA signers use viem's nonce manager, so back-to-back live transactions
|
|
85
|
+
use pending-aware nonce sequencing
|
|
86
|
+
|
|
87
|
+
What is intentionally not shipped yet:
|
|
88
|
+
|
|
89
|
+
- password-manager integrations
|
|
90
|
+
- unlock-helper plugins
|
|
91
|
+
- delegated agent spending limits
|
|
92
|
+
- smart-account policy sessions
|
|
93
|
+
|
|
94
|
+
Password managers are not wallet backends in MoneyOS. The current model is:
|
|
95
|
+
local encrypted wallet, local human unlock, short-lived session, and encrypted
|
|
96
|
+
wallet backup files.
|
|
97
|
+
|
|
98
|
+
The design notes for the current and target wallet architecture live in
|
|
99
|
+
[`docs/keystore.md`](docs/keystore.md).
|
|
100
|
+
|
|
101
|
+
## Importing an existing wallet
|
|
102
|
+
|
|
103
|
+
If you already have a raw private key, import it with `init`:
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
moneyos init --key 0x...
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
MoneyOS prompts you for a wallet password, encrypts the key into
|
|
110
|
+
`~/.moneyos/wallet.json`, and writes an initial encrypted backup under
|
|
111
|
+
`~/.moneyos/backups/`. After that, use `moneyos auth unlock` before any
|
|
112
|
+
write command.
|
|
43
113
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
| Polygon | 137 |
|
|
114
|
+
The CLI only supports raw hex private-key import today. Seed phrases,
|
|
115
|
+
keystore v3 JSON files, and hardware-wallet derivation are not implemented.
|
|
116
|
+
If your wallet currently lives in one of those formats, derive the raw hex
|
|
117
|
+
with another tool first.
|
|
49
118
|
|
|
50
|
-
|
|
119
|
+
If you have a legacy `~/.moneyos/config.json` with a plaintext `privateKey`
|
|
120
|
+
field from a pre-encrypted-wallet version of the CLI, `moneyos init` with no
|
|
121
|
+
flags will detect and import that key automatically.
|
|
122
|
+
|
|
123
|
+
## Threat model
|
|
124
|
+
|
|
125
|
+
What this wallet model is meant to protect against:
|
|
126
|
+
|
|
127
|
+
- accidental plaintext private-key storage in `config.json`
|
|
128
|
+
- casual disk access while the wallet is locked
|
|
129
|
+
- copying encrypted wallet backups without also knowing the wallet password
|
|
130
|
+
- sending the wallet password through normal AI chat flows
|
|
131
|
+
|
|
132
|
+
What it does not protect against:
|
|
133
|
+
|
|
134
|
+
- malware already running as your user while the wallet is unlocked
|
|
135
|
+
- a compromised machine that can inspect local process memory
|
|
136
|
+
- someone who knows your wallet password
|
|
137
|
+
- loss of both the encrypted wallet and its password
|
|
138
|
+
|
|
139
|
+
## Known operational limitations
|
|
140
|
+
|
|
141
|
+
- If a session-backed `send` or `swap` returns a timeout or disconnect error,
|
|
142
|
+
do not assume nothing was broadcast. Verify on-chain before retrying.
|
|
143
|
+
- PR #12 fixed the common 750ms false-timeout path, but client-disconnect
|
|
144
|
+
detection and request idempotency are still follow-up work.
|
|
145
|
+
|
|
146
|
+
The intended operating model is simple: keep the wallet encrypted locally,
|
|
147
|
+
unlock it locally when you want to write, keep sessions short, and save the
|
|
148
|
+
wallet password in your password manager of choice yourself.
|
|
149
|
+
|
|
150
|
+
## Supported chains and tokens
|
|
151
|
+
|
|
152
|
+
Default chain: Arbitrum One (`42161`)
|
|
153
|
+
|
|
154
|
+
Built-in chains:
|
|
155
|
+
|
|
156
|
+
- Arbitrum
|
|
157
|
+
- Ethereum
|
|
158
|
+
- Polygon
|
|
159
|
+
|
|
160
|
+
Built-in tokens:
|
|
161
|
+
|
|
162
|
+
- USDC
|
|
163
|
+
- USDT
|
|
164
|
+
- RYZE
|
|
165
|
+
- ETH
|
|
166
|
+
- POL
|
|
167
|
+
|
|
168
|
+
## Current validation status
|
|
169
|
+
|
|
170
|
+
What we have verified locally on the current code:
|
|
171
|
+
|
|
172
|
+
- unit tests pass
|
|
173
|
+
- lint passes
|
|
174
|
+
- typechecks pass
|
|
175
|
+
- workspace builds pass
|
|
176
|
+
- the built CLI runs
|
|
177
|
+
- encrypted wallet creation, unlock/session, backup export, and backup restore protections are covered by tests
|
|
178
|
+
- read-only balance checks work
|
|
179
|
+
- the session-backed send path has a real slow-daemon regression test after PR #12
|
|
180
|
+
- repeated live transactions worked before wallet v1 landed, which validated the
|
|
181
|
+
nonce-manager fix but should not be treated as end-to-end validation of the
|
|
182
|
+
current session-backed wallet flow
|
|
183
|
+
|
|
184
|
+
What still needs more hands-on validation:
|
|
185
|
+
|
|
186
|
+
- live session-backed ETH send
|
|
187
|
+
- live session-backed ERC-20 send
|
|
188
|
+
- live session-backed swap
|
|
189
|
+
- Particle executor against real infrastructure
|
|
190
|
+
- more live usage of the encrypted-wallet/auth/backup flow in a real terminal
|
|
191
|
+
|
|
192
|
+
## Development
|
|
193
|
+
|
|
194
|
+
```bash
|
|
195
|
+
npm install
|
|
196
|
+
npm run build:core
|
|
197
|
+
npm run build:tool-swap
|
|
198
|
+
npm run build:executor-particle
|
|
199
|
+
npm run typecheck
|
|
200
|
+
npm test
|
|
201
|
+
npm run lint
|
|
202
|
+
npm run build
|
|
203
|
+
```
|
|
51
204
|
|
|
52
|
-
|
|
205
|
+
The repo currently uses npm workspaces. Before any npm release, verify the
|
|
206
|
+
packed tarballs with `npm pack --dry-run` and confirm publish-time dependency
|
|
207
|
+
resolution for the extracted workspace packages.
|
|
53
208
|
|
|
54
209
|
## License
|
|
55
210
|
|