tollkit-wallet 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.
Files changed (90) hide show
  1. package/README.md +49 -2
  2. package/THIRD_PARTY_NOTICES.md +4 -0
  3. package/dist/actions.d.ts +150 -53
  4. package/dist/actions.js +5 -1
  5. package/dist/actions.js.map +1 -1
  6. package/dist/ai.d.ts +13 -1
  7. package/dist/ai.js +2 -2
  8. package/dist/ai.js.map +1 -1
  9. package/dist/autopilot.d.ts +7 -0
  10. package/dist/autopilot.js +118 -3
  11. package/dist/autopilot.js.map +1 -1
  12. package/dist/bots.d.ts +92 -0
  13. package/dist/bots.js +183 -0
  14. package/dist/bots.js.map +1 -0
  15. package/dist/bridge.d.ts +148 -0
  16. package/dist/bridge.js +461 -0
  17. package/dist/bridge.js.map +1 -0
  18. package/dist/buy.d.ts +17 -0
  19. package/dist/buy.js +23 -0
  20. package/dist/buy.js.map +1 -0
  21. package/dist/cli.js +68 -2
  22. package/dist/cli.js.map +1 -1
  23. package/dist/dapp.d.ts +99 -0
  24. package/dist/dapp.js +572 -0
  25. package/dist/dapp.js.map +1 -0
  26. package/dist/dashboard.d.ts +14 -0
  27. package/dist/dashboard.js +260 -4
  28. package/dist/dashboard.js.map +1 -1
  29. package/dist/data/token-list.d.ts +12 -0
  30. package/dist/data/token-list.js +13 -0
  31. package/dist/data/token-list.js.map +1 -0
  32. package/dist/holdings.d.ts +98 -0
  33. package/dist/holdings.js +233 -0
  34. package/dist/holdings.js.map +1 -0
  35. package/dist/keystore.d.ts +58 -11
  36. package/dist/keystore.js +87 -11
  37. package/dist/keystore.js.map +1 -1
  38. package/dist/ledger.d.ts +1 -1
  39. package/dist/mcp.d.ts +1 -1
  40. package/dist/mcp.js +1 -1
  41. package/dist/netguard.d.ts +8 -0
  42. package/dist/netguard.js +44 -0
  43. package/dist/netguard.js.map +1 -0
  44. package/dist/paths.d.ts +1 -0
  45. package/dist/paths.js +1 -0
  46. package/dist/paths.js.map +1 -1
  47. package/dist/pay.js +1 -1
  48. package/dist/pay.js.map +1 -1
  49. package/dist/policy.d.ts +6 -6
  50. package/dist/rules.d.ts +59 -8
  51. package/dist/rules.js +45 -3
  52. package/dist/rules.js.map +1 -1
  53. package/dist/sell.d.ts +60 -0
  54. package/dist/sell.js +71 -0
  55. package/dist/sell.js.map +1 -0
  56. package/dist/seller.js +15 -4
  57. package/dist/seller.js.map +1 -1
  58. package/dist/send.js +3 -2
  59. package/dist/send.js.map +1 -1
  60. package/dist/solconfirm.d.ts +13 -0
  61. package/dist/solconfirm.js +21 -0
  62. package/dist/solconfirm.js.map +1 -0
  63. package/dist/stake.d.ts +84 -0
  64. package/dist/stake.js +159 -0
  65. package/dist/stake.js.map +1 -0
  66. package/dist/swap.d.ts +27 -4
  67. package/dist/swap.js +202 -9
  68. package/dist/swap.js.map +1 -1
  69. package/dist/tokenlist.d.ts +70 -0
  70. package/dist/tokenlist.js +259 -0
  71. package/dist/tokenlist.js.map +1 -0
  72. package/dist/ui.js +399 -37
  73. package/dist/ui.js.map +1 -1
  74. package/dist/wallet.d.ts +60 -3
  75. package/dist/wallet.js +207 -5
  76. package/dist/wallet.js.map +1 -1
  77. package/extension/PRIVACY.md +19 -0
  78. package/extension/README.md +16 -0
  79. package/extension/background.js +88 -0
  80. package/extension/content.js +34 -0
  81. package/extension/icons/icon.svg +1 -0
  82. package/extension/icons/icon128.png +0 -0
  83. package/extension/icons/icon16.png +0 -0
  84. package/extension/icons/icon32.png +0 -0
  85. package/extension/icons/icon48.png +0 -0
  86. package/extension/inpage.js +129 -0
  87. package/extension/manifest.json +15 -0
  88. package/extension/popup.html +35 -0
  89. package/extension/popup.js +39 -0
  90. package/package.json +3 -2
package/README.md CHANGED
@@ -25,7 +25,7 @@ Swaps cost a flat 0.5%, shown before every trade. On some Base and Ethereum pair
25
25
  ```
26
26
  npm install -g tollkit-wallet
27
27
  tollkit-wallet init # choose a password; prints your Base/Ethereum and Solana addresses
28
- tollkit-wallet budget # see limits; change with e.g. budget per_trade_usd=100
28
+ tollkit-wallet budget # see limits; change with e.g. budget per_trade_usd=100 (or in the dashboard's Settings tab)
29
29
  tollkit-wallet telegram <bot-token> <chat-id> # optional: approvals in Telegram
30
30
  ```
31
31
 
@@ -84,6 +84,14 @@ import { tollkitWalletPlugin } from "tollkit-wallet/elizaos";
84
84
 
85
85
  Set `TOLLKIT_WALLET_PASSWORD` (or `TOLLKIT_WALLET_PASSWORD_FILE`) in the agent's settings or environment. The agent's model reads the request ("swap 25 USDC to SOL"), and the wallet checks it against your limits before anything is signed.
86
86
 
87
+ ## Use with websites (browser extension)
88
+
89
+ The Tollkit extension for Chrome, Brave and Edge lets websites connect to this wallet the way they connect to MetaMask or Phantom: Base and Ethereum apps through the standard Ethereum provider (EIP-1193/EIP-6963), Solana apps through the Wallet Standard.
90
+
91
+ Keys stay in Tollkit. When a site asks to connect, sign or send, the request shows up in the dashboard's Approvals tab with the site's name and the details. Transactions are checked against the network first. Nothing happens until you approve. Read-only calls go straight through.
92
+
93
+ To add it: run `tollkit-wallet extension` for the folder and steps (Developer mode, then Load unpacked), then pair it from **Settings → Pair a browser**. Connected sites are listed in Settings, where you can disconnect them. The dashboard has to be open for sites to use the wallet.
94
+
87
95
  ## Use from code
88
96
 
89
97
  ```ts
@@ -92,6 +100,45 @@ const w = await TollkitWallet.open(process.env.TOLLKIT_WALLET_PASSWORD!);
92
100
  const r = await w.pay("https://api.example.com/paid-endpoint");
93
101
  ```
94
102
 
103
+ ## Backup and recovery
104
+
105
+ New wallets (0.2.2 and later) are made from a 12-word recovery phrase. It's shown once when you create the wallet, and you can see it again with `tollkit-wallet backup` or **Back up** in the dashboard (password needed). The dashboard asks you to confirm three of the words before it counts as backed up.
106
+
107
+ The phrase uses the same derivation paths as MetaMask and Phantom (Base/Ethereum `m/44'/60'/0'/0/0`, Solana `m/44'/501'/0'/0'`), so it restores the same addresses there too.
108
+
109
+ To restore: `tollkit-wallet restore` and type the phrase. Wallets made before 0.2.2 have no phrase; their backup is the two private keys (`tollkit-wallet backup` shows them), restored with `tollkit-wallet restore --keys`. Add `--replace` to restore over an existing wallet; its files are kept, renamed with `.replaced-<time>`.
110
+
111
+ ## Tokens and price charts
112
+
113
+ The dashboard's Home tab lists every token the wallet holds that has a price, with its value and 24-hour change. Tap a token for a price chart (1D, 1W, 1M, 1Y). Prices and charts come from DefiLlama.
114
+
115
+ How tokens are found:
116
+ - Solana: every SPL and Token-2022 token account the address owns.
117
+ - Ethereum: Blockscout's public token list for the address.
118
+ - Base: tokens you've swapped into with this wallet, plus any you add with **Add a token** (paste the contract address). Base has no free public token index that works without a key, so the wallet doesn't scan for others.
119
+
120
+ Tokens with no price (most airdropped spam) are hidden and counted below the list. Added tokens are saved in `tokens.json` in the wallet folder.
121
+
122
+ ## Buy crypto with a card
123
+
124
+ **Buy** on the Home tab opens Coinbase's checkout to buy USDC or ETH on Base or Ethereum, or USDC or SOL on Solana, sent straight to this wallet's address. The wallet asks Tollkit's server for a single-use Coinbase Onramp link; only your public address, the network, the coin and the amount are sent. Coinbase handles the payment and any ID checks, and its own fees and limits apply.
125
+
126
+ ## Cash out to your bank
127
+
128
+ **Sell** on the Home tab sells USDC, ETH or SOL through Coinbase to your bank or PayPal. You need a Coinbase account. The wallet opens Coinbase's sell page; you choose where the money goes and click **Cash out now**. Coinbase then gives an address to send the crypto to, and the dashboard shows it with the amount, Coinbase's fee and what you'll receive. Nothing is sent until you confirm with your password. Coinbase allows 30 minutes for the send. Only your public address, the network, the coin and the amount go to Tollkit's server.
129
+
130
+ ## Move between networks
131
+
132
+ **Move** on the Home tab sends your own USDC between Base, Ethereum and Solana, or ETH between Base and Ethereum, to this wallet's address on the other network.
133
+
134
+ - USDC uses Circle's own transfer (CCTP): it's burned on one network and minted on the other by Circle, usually in 8 to 20 seconds. Circle's forwarding service pays the network fee on arrival, so you don't need gas there.
135
+ - ETH goes through Across, usually in under a minute.
136
+ - Tollkit's fee is 0.25%. Circle's or Across's fee, and the amount you'll receive at least, are shown before you confirm. Moves need your password and don't count against your spending limits.
137
+
138
+ ## Stake SOL
139
+
140
+ **Stake** on the Home tab stakes SOL with a validator you pick from the ones currently voting, listed by how much SOL is staked with them, with their fee. The minimum is set by the network (1 SOL as of October 2026) and read live. Stakes start earning after the current epoch ends (about a day). Unstake any time; once the epoch ends, **Withdraw** returns the SOL to your wallet. The wallet keeps both stake and withdraw authority, and staking needs your password.
141
+
95
142
  ## Where things live
96
143
 
97
144
  `~/.tollkit-wallet/` (or `TOLLKIT_WALLET_HOME`) holds:
@@ -120,7 +167,7 @@ tollkit-wallet rule pause <id> # or: rule on <id>, rule cancel <id>
120
167
  Or use the **Autopilot** tab in the dashboard (`tollkit-wallet ui`). Rule types: limit buy, limit sell, take-profit, stop-loss, trailing stop, and recurring buys (hourly, daily, weekly or a set weekday, with an optional count and maximum price). A take-profit and a stop-loss on the same token are linked: when one fills, the other cancels.
121
168
 
122
169
  - Every fill goes through the same limits, approvals and receipts as any swap, and pays the same 0.5% fee.
123
- - Rules an agent suggests (`autopilot_propose`) wait for you to turn them on, unless you tick "Let agents turn on autopilot rules without asking me" in Limits (or `budget agent_rules=auto`).
170
+ - Rules an agent suggests (`autopilot_propose`) wait for you to turn them on, unless you tick "Let agents turn on autopilot rules without asking me" in Settings (or `budget agent_rules=auto`).
124
171
  - The autopilot runs while the wallet runs: keep the dashboard open, or run `tollkit-wallet autopilot` on a computer or small server that stays on. Only one copy runs rules at a time.
125
172
  - Limit orders fill only at their price or better (within 1% for fees and spread). Stops always sell. When selling all of a chain's coin, a little is kept for network fees.
126
173
 
@@ -15,3 +15,7 @@ The coin and network names and logos are trademarks of their owners and are used
15
15
  ## Simple Icons
16
16
 
17
17
  The Claude, Cursor, GitHub Copilot and Gemini logos in the dashboard's "Connect your AI" picker (`src/ai-icons.ts`) come from Simple Icons (https://simpleicons.org), whose data is released under CC0 1.0. The logos are trademarks of their owners and are shown only to say which apps work with the wallet.
18
+
19
+ ## Wallet Standard (extension/inpage.js)
20
+
21
+ The Solana wallet registration in `extension/inpage.js` follows `registerWallet` from `@wallet-standard/wallet` (https://github.com/wallet-standard/wallet-standard), Apache License 2.0. The feature names and shapes come from `@wallet-standard/features` and `@solana/wallet-standard-features` (Apache License 2.0).
package/dist/actions.d.ts CHANGED
@@ -5,6 +5,7 @@
5
5
  * addresses.
6
6
  */
7
7
  import { z } from "zod";
8
+ export { isLocalUrl } from "./netguard.js";
8
9
  import type { TollkitWallet } from "./wallet.js";
9
10
  export declare const SwapArgs: z.ZodObject<{
10
11
  chain: z.ZodEnum<["base", "ethereum", "solana"]>;
@@ -15,14 +16,14 @@ export declare const SwapArgs: z.ZodObject<{
15
16
  }, "strip", z.ZodTypeAny, {
16
17
  chain: "base" | "ethereum" | "solana";
17
18
  amount: string;
18
- sell: string;
19
19
  buy: string;
20
+ sell: string;
20
21
  slippage_bps?: number | undefined;
21
22
  }, {
22
23
  chain: "base" | "ethereum" | "solana";
23
24
  amount: string;
24
- sell: string;
25
25
  buy: string;
26
+ sell: string;
26
27
  slippage_bps?: number | undefined;
27
28
  }>;
28
29
  export declare const PayArgs: z.ZodObject<{
@@ -32,12 +33,12 @@ export declare const PayArgs: z.ZodObject<{
32
33
  body: z.ZodOptional<z.ZodString>;
33
34
  }, "strip", z.ZodTypeAny, {
34
35
  url: string;
35
- method?: "POST" | "GET" | "PUT" | "PATCH" | "DELETE" | undefined;
36
+ method?: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | undefined;
36
37
  headers?: Record<string, string> | undefined;
37
38
  body?: string | undefined;
38
39
  }, {
39
40
  url: string;
40
- method?: "POST" | "GET" | "PUT" | "PATCH" | "DELETE" | undefined;
41
+ method?: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | undefined;
41
42
  headers?: Record<string, string> | undefined;
42
43
  body?: string | undefined;
43
44
  }>;
@@ -65,7 +66,7 @@ export declare const NoArgs: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
65
66
  export declare const ProposeArgs: z.ZodObject<{
66
67
  text: z.ZodOptional<z.ZodString>;
67
68
  rules: z.ZodOptional<z.ZodArray<z.ZodObject<{
68
- kind: z.ZodEnum<["limit_buy", "limit_sell", "stop_loss", "take_profit", "trailing_stop", "dca"]>;
69
+ kind: z.ZodEnum<["limit_buy", "limit_sell", "stop_loss", "take_profit", "trailing_stop", "dca", "grid"]>;
69
70
  chain: z.ZodEnum<["base", "ethereum", "solana"]>;
70
71
  token: z.ZodString;
71
72
  name: z.ZodOptional<z.ZodString>;
@@ -82,14 +83,22 @@ export declare const ProposeArgs: z.ZodObject<{
82
83
  expires_at: z.ZodOptional<z.ZodString>;
83
84
  reason: z.ZodOptional<z.ZodString>;
84
85
  replaces: z.ZodOptional<z.ZodString>;
86
+ lower_price: z.ZodOptional<z.ZodNumber>;
87
+ upper_price: z.ZodOptional<z.ZodNumber>;
88
+ levels: z.ZodOptional<z.ZodNumber>;
89
+ after: z.ZodOptional<z.ZodString>;
90
+ sell_from: z.ZodOptional<z.ZodString>;
91
+ bot: z.ZodOptional<z.ZodString>;
92
+ bot_name: z.ZodOptional<z.ZodString>;
93
+ template: z.ZodOptional<z.ZodString>;
85
94
  }, "strip", z.ZodTypeAny, {
95
+ kind: "limit_buy" | "limit_sell" | "stop_loss" | "take_profit" | "trailing_stop" | "dca" | "grid";
86
96
  chain: "base" | "ethereum" | "solana";
87
- kind: "limit_buy" | "limit_sell" | "stop_loss" | "take_profit" | "trailing_stop" | "dca";
88
97
  token: string;
98
+ sell_amount?: string | undefined;
99
+ name?: string | undefined;
89
100
  every?: "hour" | "day" | "week" | undefined;
90
101
  reason?: string | undefined;
91
- name?: string | undefined;
92
- sell_amount?: string | undefined;
93
102
  amount_usd?: number | undefined;
94
103
  sell_percent?: number | undefined;
95
104
  trigger_price?: number | undefined;
@@ -100,14 +109,22 @@ export declare const ProposeArgs: z.ZodObject<{
100
109
  group?: string | undefined;
101
110
  expires_at?: string | undefined;
102
111
  replaces?: string | undefined;
112
+ lower_price?: number | undefined;
113
+ upper_price?: number | undefined;
114
+ levels?: number | undefined;
115
+ after?: string | undefined;
116
+ sell_from?: string | undefined;
117
+ bot?: string | undefined;
118
+ bot_name?: string | undefined;
119
+ template?: string | undefined;
103
120
  }, {
121
+ kind: "limit_buy" | "limit_sell" | "stop_loss" | "take_profit" | "trailing_stop" | "dca" | "grid";
104
122
  chain: "base" | "ethereum" | "solana";
105
- kind: "limit_buy" | "limit_sell" | "stop_loss" | "take_profit" | "trailing_stop" | "dca";
106
123
  token: string;
124
+ sell_amount?: string | undefined;
125
+ name?: string | undefined;
107
126
  every?: "hour" | "day" | "week" | undefined;
108
127
  reason?: string | undefined;
109
- name?: string | undefined;
110
- sell_amount?: string | undefined;
111
128
  amount_usd?: number | undefined;
112
129
  sell_percent?: number | undefined;
113
130
  trigger_price?: number | undefined;
@@ -118,16 +135,24 @@ export declare const ProposeArgs: z.ZodObject<{
118
135
  group?: string | undefined;
119
136
  expires_at?: string | undefined;
120
137
  replaces?: string | undefined;
138
+ lower_price?: number | undefined;
139
+ upper_price?: number | undefined;
140
+ levels?: number | undefined;
141
+ after?: string | undefined;
142
+ sell_from?: string | undefined;
143
+ bot?: string | undefined;
144
+ bot_name?: string | undefined;
145
+ template?: string | undefined;
121
146
  }>, "many">>;
122
147
  }, "strip", z.ZodTypeAny, {
123
148
  rules?: {
149
+ kind: "limit_buy" | "limit_sell" | "stop_loss" | "take_profit" | "trailing_stop" | "dca" | "grid";
124
150
  chain: "base" | "ethereum" | "solana";
125
- kind: "limit_buy" | "limit_sell" | "stop_loss" | "take_profit" | "trailing_stop" | "dca";
126
151
  token: string;
152
+ sell_amount?: string | undefined;
153
+ name?: string | undefined;
127
154
  every?: "hour" | "day" | "week" | undefined;
128
155
  reason?: string | undefined;
129
- name?: string | undefined;
130
- sell_amount?: string | undefined;
131
156
  amount_usd?: number | undefined;
132
157
  sell_percent?: number | undefined;
133
158
  trigger_price?: number | undefined;
@@ -138,17 +163,25 @@ export declare const ProposeArgs: z.ZodObject<{
138
163
  group?: string | undefined;
139
164
  expires_at?: string | undefined;
140
165
  replaces?: string | undefined;
166
+ lower_price?: number | undefined;
167
+ upper_price?: number | undefined;
168
+ levels?: number | undefined;
169
+ after?: string | undefined;
170
+ sell_from?: string | undefined;
171
+ bot?: string | undefined;
172
+ bot_name?: string | undefined;
173
+ template?: string | undefined;
141
174
  }[] | undefined;
142
175
  text?: string | undefined;
143
176
  }, {
144
177
  rules?: {
178
+ kind: "limit_buy" | "limit_sell" | "stop_loss" | "take_profit" | "trailing_stop" | "dca" | "grid";
145
179
  chain: "base" | "ethereum" | "solana";
146
- kind: "limit_buy" | "limit_sell" | "stop_loss" | "take_profit" | "trailing_stop" | "dca";
147
180
  token: string;
181
+ sell_amount?: string | undefined;
182
+ name?: string | undefined;
148
183
  every?: "hour" | "day" | "week" | undefined;
149
184
  reason?: string | undefined;
150
- name?: string | undefined;
151
- sell_amount?: string | undefined;
152
185
  amount_usd?: number | undefined;
153
186
  sell_percent?: number | undefined;
154
187
  trigger_price?: number | undefined;
@@ -159,15 +192,23 @@ export declare const ProposeArgs: z.ZodObject<{
159
192
  group?: string | undefined;
160
193
  expires_at?: string | undefined;
161
194
  replaces?: string | undefined;
195
+ lower_price?: number | undefined;
196
+ upper_price?: number | undefined;
197
+ levels?: number | undefined;
198
+ after?: string | undefined;
199
+ sell_from?: string | undefined;
200
+ bot?: string | undefined;
201
+ bot_name?: string | undefined;
202
+ template?: string | undefined;
162
203
  }[] | undefined;
163
204
  text?: string | undefined;
164
205
  }>;
165
206
  export declare const RulesListArgs: z.ZodObject<{
166
207
  status: z.ZodOptional<z.ZodEnum<["proposed", "active", "paused", "done", "cancelled", "expired", "error"]>>;
167
208
  }, "strip", z.ZodTypeAny, {
168
- status?: "done" | "error" | "proposed" | "active" | "paused" | "cancelled" | "expired" | undefined;
209
+ status?: "error" | "done" | "proposed" | "active" | "paused" | "cancelled" | "expired" | undefined;
169
210
  }, {
170
- status?: "done" | "error" | "proposed" | "active" | "paused" | "cancelled" | "expired" | undefined;
211
+ status?: "error" | "done" | "proposed" | "active" | "paused" | "cancelled" | "expired" | undefined;
171
212
  }>;
172
213
  export declare const RuleIdArgs: z.ZodObject<{
173
214
  id: z.ZodString;
@@ -182,12 +223,12 @@ export declare const HistoryArgs: z.ZodObject<{
182
223
  points: z.ZodOptional<z.ZodNumber>;
183
224
  }, "strip", z.ZodTypeAny, {
184
225
  token: "ETH" | "WETH" | "SOL";
185
- interval?: "15m" | "1h" | "6h" | "1d" | undefined;
186
226
  points?: number | undefined;
227
+ interval?: "1h" | "1d" | "15m" | "6h" | undefined;
187
228
  }, {
188
229
  token: "ETH" | "WETH" | "SOL";
189
- interval?: "15m" | "1h" | "6h" | "1d" | undefined;
190
230
  points?: number | undefined;
231
+ interval?: "1h" | "1d" | "15m" | "6h" | undefined;
191
232
  }>;
192
233
  /** Coinbase Exchange public candles: [time, low, high, open, close, volume], newest first, at most 300, no key. */
193
234
  export declare function priceHistory(a: z.infer<typeof HistoryArgs>, f?: typeof fetch): Promise<{
@@ -210,7 +251,7 @@ export declare function priceHistory(a: z.infer<typeof HistoryArgs>, f?: typeof
210
251
  } | {
211
252
  ok: boolean;
212
253
  token: "ETH" | "WETH" | "SOL";
213
- interval: "15m" | "1h" | "6h" | "1d";
254
+ interval: "1h" | "1d" | "15m" | "6h";
214
255
  source: string;
215
256
  from: string;
216
257
  to: string;
@@ -244,14 +285,14 @@ export declare const ACTIONS: readonly [WalletAction<z.ZodObject<{}, "strip", z.
244
285
  }, "strip", z.ZodTypeAny, {
245
286
  chain: "base" | "ethereum" | "solana";
246
287
  amount: string;
247
- sell: string;
248
288
  buy: string;
289
+ sell: string;
249
290
  slippage_bps?: number | undefined;
250
291
  }, {
251
292
  chain: "base" | "ethereum" | "solana";
252
293
  amount: string;
253
- sell: string;
254
294
  buy: string;
295
+ sell: string;
255
296
  slippage_bps?: number | undefined;
256
297
  }>>, WalletAction<z.ZodObject<{
257
298
  chain: z.ZodEnum<["base", "ethereum", "solana"]>;
@@ -262,14 +303,14 @@ export declare const ACTIONS: readonly [WalletAction<z.ZodObject<{}, "strip", z.
262
303
  }, "strip", z.ZodTypeAny, {
263
304
  chain: "base" | "ethereum" | "solana";
264
305
  amount: string;
265
- sell: string;
266
306
  buy: string;
307
+ sell: string;
267
308
  slippage_bps?: number | undefined;
268
309
  }, {
269
310
  chain: "base" | "ethereum" | "solana";
270
311
  amount: string;
271
- sell: string;
272
312
  buy: string;
313
+ sell: string;
273
314
  slippage_bps?: number | undefined;
274
315
  }>>, WalletAction<z.ZodObject<{
275
316
  url: z.ZodString;
@@ -278,12 +319,12 @@ export declare const ACTIONS: readonly [WalletAction<z.ZodObject<{}, "strip", z.
278
319
  body: z.ZodOptional<z.ZodString>;
279
320
  }, "strip", z.ZodTypeAny, {
280
321
  url: string;
281
- method?: "POST" | "GET" | "PUT" | "PATCH" | "DELETE" | undefined;
322
+ method?: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | undefined;
282
323
  headers?: Record<string, string> | undefined;
283
324
  body?: string | undefined;
284
325
  }, {
285
326
  url: string;
286
- method?: "POST" | "GET" | "PUT" | "PATCH" | "DELETE" | undefined;
327
+ method?: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | undefined;
287
328
  headers?: Record<string, string> | undefined;
288
329
  body?: string | undefined;
289
330
  }>>, WalletAction<z.ZodObject<{
@@ -310,16 +351,16 @@ export declare const ACTIONS: readonly [WalletAction<z.ZodObject<{}, "strip", z.
310
351
  points: z.ZodOptional<z.ZodNumber>;
311
352
  }, "strip", z.ZodTypeAny, {
312
353
  token: "ETH" | "WETH" | "SOL";
313
- interval?: "15m" | "1h" | "6h" | "1d" | undefined;
314
354
  points?: number | undefined;
355
+ interval?: "1h" | "1d" | "15m" | "6h" | undefined;
315
356
  }, {
316
357
  token: "ETH" | "WETH" | "SOL";
317
- interval?: "15m" | "1h" | "6h" | "1d" | undefined;
318
358
  points?: number | undefined;
359
+ interval?: "1h" | "1d" | "15m" | "6h" | undefined;
319
360
  }>>, WalletAction<z.ZodObject<{
320
361
  text: z.ZodOptional<z.ZodString>;
321
362
  rules: z.ZodOptional<z.ZodArray<z.ZodObject<{
322
- kind: z.ZodEnum<["limit_buy", "limit_sell", "stop_loss", "take_profit", "trailing_stop", "dca"]>;
363
+ kind: z.ZodEnum<["limit_buy", "limit_sell", "stop_loss", "take_profit", "trailing_stop", "dca", "grid"]>;
323
364
  chain: z.ZodEnum<["base", "ethereum", "solana"]>;
324
365
  token: z.ZodString;
325
366
  name: z.ZodOptional<z.ZodString>;
@@ -336,14 +377,22 @@ export declare const ACTIONS: readonly [WalletAction<z.ZodObject<{}, "strip", z.
336
377
  expires_at: z.ZodOptional<z.ZodString>;
337
378
  reason: z.ZodOptional<z.ZodString>;
338
379
  replaces: z.ZodOptional<z.ZodString>;
380
+ lower_price: z.ZodOptional<z.ZodNumber>;
381
+ upper_price: z.ZodOptional<z.ZodNumber>;
382
+ levels: z.ZodOptional<z.ZodNumber>;
383
+ after: z.ZodOptional<z.ZodString>;
384
+ sell_from: z.ZodOptional<z.ZodString>;
385
+ bot: z.ZodOptional<z.ZodString>;
386
+ bot_name: z.ZodOptional<z.ZodString>;
387
+ template: z.ZodOptional<z.ZodString>;
339
388
  }, "strip", z.ZodTypeAny, {
389
+ kind: "limit_buy" | "limit_sell" | "stop_loss" | "take_profit" | "trailing_stop" | "dca" | "grid";
340
390
  chain: "base" | "ethereum" | "solana";
341
- kind: "limit_buy" | "limit_sell" | "stop_loss" | "take_profit" | "trailing_stop" | "dca";
342
391
  token: string;
392
+ sell_amount?: string | undefined;
393
+ name?: string | undefined;
343
394
  every?: "hour" | "day" | "week" | undefined;
344
395
  reason?: string | undefined;
345
- name?: string | undefined;
346
- sell_amount?: string | undefined;
347
396
  amount_usd?: number | undefined;
348
397
  sell_percent?: number | undefined;
349
398
  trigger_price?: number | undefined;
@@ -354,14 +403,22 @@ export declare const ACTIONS: readonly [WalletAction<z.ZodObject<{}, "strip", z.
354
403
  group?: string | undefined;
355
404
  expires_at?: string | undefined;
356
405
  replaces?: string | undefined;
406
+ lower_price?: number | undefined;
407
+ upper_price?: number | undefined;
408
+ levels?: number | undefined;
409
+ after?: string | undefined;
410
+ sell_from?: string | undefined;
411
+ bot?: string | undefined;
412
+ bot_name?: string | undefined;
413
+ template?: string | undefined;
357
414
  }, {
415
+ kind: "limit_buy" | "limit_sell" | "stop_loss" | "take_profit" | "trailing_stop" | "dca" | "grid";
358
416
  chain: "base" | "ethereum" | "solana";
359
- kind: "limit_buy" | "limit_sell" | "stop_loss" | "take_profit" | "trailing_stop" | "dca";
360
417
  token: string;
418
+ sell_amount?: string | undefined;
419
+ name?: string | undefined;
361
420
  every?: "hour" | "day" | "week" | undefined;
362
421
  reason?: string | undefined;
363
- name?: string | undefined;
364
- sell_amount?: string | undefined;
365
422
  amount_usd?: number | undefined;
366
423
  sell_percent?: number | undefined;
367
424
  trigger_price?: number | undefined;
@@ -372,16 +429,24 @@ export declare const ACTIONS: readonly [WalletAction<z.ZodObject<{}, "strip", z.
372
429
  group?: string | undefined;
373
430
  expires_at?: string | undefined;
374
431
  replaces?: string | undefined;
432
+ lower_price?: number | undefined;
433
+ upper_price?: number | undefined;
434
+ levels?: number | undefined;
435
+ after?: string | undefined;
436
+ sell_from?: string | undefined;
437
+ bot?: string | undefined;
438
+ bot_name?: string | undefined;
439
+ template?: string | undefined;
375
440
  }>, "many">>;
376
441
  }, "strip", z.ZodTypeAny, {
377
442
  rules?: {
443
+ kind: "limit_buy" | "limit_sell" | "stop_loss" | "take_profit" | "trailing_stop" | "dca" | "grid";
378
444
  chain: "base" | "ethereum" | "solana";
379
- kind: "limit_buy" | "limit_sell" | "stop_loss" | "take_profit" | "trailing_stop" | "dca";
380
445
  token: string;
446
+ sell_amount?: string | undefined;
447
+ name?: string | undefined;
381
448
  every?: "hour" | "day" | "week" | undefined;
382
449
  reason?: string | undefined;
383
- name?: string | undefined;
384
- sell_amount?: string | undefined;
385
450
  amount_usd?: number | undefined;
386
451
  sell_percent?: number | undefined;
387
452
  trigger_price?: number | undefined;
@@ -392,17 +457,25 @@ export declare const ACTIONS: readonly [WalletAction<z.ZodObject<{}, "strip", z.
392
457
  group?: string | undefined;
393
458
  expires_at?: string | undefined;
394
459
  replaces?: string | undefined;
460
+ lower_price?: number | undefined;
461
+ upper_price?: number | undefined;
462
+ levels?: number | undefined;
463
+ after?: string | undefined;
464
+ sell_from?: string | undefined;
465
+ bot?: string | undefined;
466
+ bot_name?: string | undefined;
467
+ template?: string | undefined;
395
468
  }[] | undefined;
396
469
  text?: string | undefined;
397
470
  }, {
398
471
  rules?: {
472
+ kind: "limit_buy" | "limit_sell" | "stop_loss" | "take_profit" | "trailing_stop" | "dca" | "grid";
399
473
  chain: "base" | "ethereum" | "solana";
400
- kind: "limit_buy" | "limit_sell" | "stop_loss" | "take_profit" | "trailing_stop" | "dca";
401
474
  token: string;
475
+ sell_amount?: string | undefined;
476
+ name?: string | undefined;
402
477
  every?: "hour" | "day" | "week" | undefined;
403
478
  reason?: string | undefined;
404
- name?: string | undefined;
405
- sell_amount?: string | undefined;
406
479
  amount_usd?: number | undefined;
407
480
  sell_percent?: number | undefined;
408
481
  trigger_price?: number | undefined;
@@ -413,14 +486,22 @@ export declare const ACTIONS: readonly [WalletAction<z.ZodObject<{}, "strip", z.
413
486
  group?: string | undefined;
414
487
  expires_at?: string | undefined;
415
488
  replaces?: string | undefined;
489
+ lower_price?: number | undefined;
490
+ upper_price?: number | undefined;
491
+ levels?: number | undefined;
492
+ after?: string | undefined;
493
+ sell_from?: string | undefined;
494
+ bot?: string | undefined;
495
+ bot_name?: string | undefined;
496
+ template?: string | undefined;
416
497
  }[] | undefined;
417
498
  text?: string | undefined;
418
499
  }>>, WalletAction<z.ZodObject<{
419
500
  status: z.ZodOptional<z.ZodEnum<["proposed", "active", "paused", "done", "cancelled", "expired", "error"]>>;
420
501
  }, "strip", z.ZodTypeAny, {
421
- status?: "done" | "error" | "proposed" | "active" | "paused" | "cancelled" | "expired" | undefined;
502
+ status?: "error" | "done" | "proposed" | "active" | "paused" | "cancelled" | "expired" | undefined;
422
503
  }, {
423
- status?: "done" | "error" | "proposed" | "active" | "paused" | "cancelled" | "expired" | undefined;
504
+ status?: "error" | "done" | "proposed" | "active" | "paused" | "cancelled" | "expired" | undefined;
424
505
  }>>, WalletAction<z.ZodObject<{
425
506
  id: z.ZodString;
426
507
  }, "strip", z.ZodTypeAny, {
@@ -436,14 +517,14 @@ export declare const ACTIONS: readonly [WalletAction<z.ZodObject<{}, "strip", z.
436
517
  }, "strip", z.ZodTypeAny, {
437
518
  chain: "base" | "ethereum" | "solana";
438
519
  amount: string;
439
- sell: string;
440
520
  buy: string;
521
+ sell: string;
441
522
  slippage_bps?: number | undefined;
442
523
  }, {
443
524
  chain: "base" | "ethereum" | "solana";
444
525
  amount: string;
445
- sell: string;
446
526
  buy: string;
527
+ sell: string;
447
528
  slippage_bps?: number | undefined;
448
529
  }>>, WalletAction<z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>>];
449
530
  export declare function proposeRules(w: TollkitWallet, a: z.infer<typeof ProposeArgs>, o?: {
@@ -479,13 +560,13 @@ export declare function proposeRules(w: TollkitWallet, a: z.infer<typeof Propose
479
560
  created_by: "owner" | "agent";
480
561
  created_at: string;
481
562
  activated_at?: string;
563
+ kind: "limit_buy" | "limit_sell" | "stop_loss" | "take_profit" | "trailing_stop" | "dca" | "grid";
482
564
  chain: "base" | "ethereum" | "solana";
483
- kind: "limit_buy" | "limit_sell" | "stop_loss" | "take_profit" | "trailing_stop" | "dca";
484
565
  token: string;
566
+ sell_amount?: string | undefined;
567
+ name?: string | undefined;
485
568
  every?: "hour" | "day" | "week" | undefined;
486
569
  reason?: string | undefined;
487
- name?: string | undefined;
488
- sell_amount?: string | undefined;
489
570
  amount_usd?: number | undefined;
490
571
  sell_percent?: number | undefined;
491
572
  trigger_price?: number | undefined;
@@ -496,6 +577,14 @@ export declare function proposeRules(w: TollkitWallet, a: z.infer<typeof Propose
496
577
  group?: string | undefined;
497
578
  expires_at?: string | undefined;
498
579
  replaces?: string | undefined;
580
+ lower_price?: number | undefined;
581
+ upper_price?: number | undefined;
582
+ levels?: number | undefined;
583
+ after?: string | undefined;
584
+ sell_from?: string | undefined;
585
+ bot?: string | undefined;
586
+ bot_name?: string | undefined;
587
+ template?: string | undefined;
499
588
  };
500
589
  }[];
501
590
  unparsed: string[];
@@ -518,13 +607,13 @@ export declare function proposeRules(w: TollkitWallet, a: z.infer<typeof Propose
518
607
  created_by: "owner" | "agent";
519
608
  created_at: string;
520
609
  activated_at?: string;
610
+ kind: "limit_buy" | "limit_sell" | "stop_loss" | "take_profit" | "trailing_stop" | "dca" | "grid";
521
611
  chain: "base" | "ethereum" | "solana";
522
- kind: "limit_buy" | "limit_sell" | "stop_loss" | "take_profit" | "trailing_stop" | "dca";
523
612
  token: string;
613
+ sell_amount?: string | undefined;
614
+ name?: string | undefined;
524
615
  every?: "hour" | "day" | "week" | undefined;
525
616
  reason?: string | undefined;
526
- name?: string | undefined;
527
- sell_amount?: string | undefined;
528
617
  amount_usd?: number | undefined;
529
618
  sell_percent?: number | undefined;
530
619
  trigger_price?: number | undefined;
@@ -535,6 +624,14 @@ export declare function proposeRules(w: TollkitWallet, a: z.infer<typeof Propose
535
624
  group?: string | undefined;
536
625
  expires_at?: string | undefined;
537
626
  replaces?: string | undefined;
627
+ lower_price?: number | undefined;
628
+ upper_price?: number | undefined;
629
+ levels?: number | undefined;
630
+ after?: string | undefined;
631
+ sell_from?: string | undefined;
632
+ bot?: string | undefined;
633
+ bot_name?: string | undefined;
634
+ template?: string | undefined;
538
635
  };
539
636
  }[];
540
637
  unparsed: string[];
package/dist/actions.js CHANGED
@@ -5,6 +5,8 @@
5
5
  * addresses.
6
6
  */
7
7
  import { z } from "zod";
8
+ import { isLocalUrl } from "./netguard.js";
9
+ export { isLocalUrl } from "./netguard.js";
8
10
  import { resolveToken, toAtomic } from "./tokens.js";
9
11
  import { checkSeller } from "./seller.js";
10
12
  import { RuleInput, describeRule, ruleProblem } from "./rules.js";
@@ -95,7 +97,9 @@ export const ACTIONS = [
95
97
  def({ name: "pay_fetch", spends: true, schema: PayArgs,
96
98
  description: "Fetch a URL and pay for it if it asks (x402 or MPP, USDC/USDT on Base, Ethereum or Solana). Checks the seller, screens the recipient against OFAC, stays within the owner's limits. Returns the response body.",
97
99
  run: async (w, a) => {
98
- const r = await w.pay(a.url, { method: a.method ?? (a.body ? "POST" : "GET"), headers: a.headers, body: a.body });
100
+ if (isLocalUrl(a.url))
101
+ return { paid: false, status: 0, refused: { code: "local_address", reason: "pay_fetch only calls public internet addresses." } };
102
+ const r = await w.pay(a.url, { method: a.method ?? (a.body ? "POST" : "GET"), headers: a.headers, body: a.body }, { publicOnly: true });
99
103
  let body;
100
104
  if (r.response) {
101
105
  const t = await r.response.text();