@formo/cli 0.1.0 → 0.2.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 +285 -41
- package/dist/commands/alerts.d.ts +1 -0
- package/dist/commands/alerts.js +10 -29
- package/dist/commands/contracts.d.ts +12 -0
- package/dist/commands/contracts.js +18 -10
- package/dist/commands/import.d.ts +4 -0
- package/dist/commands/import.js +9 -5
- package/dist/commands/profiles.d.ts +22 -2
- package/dist/commands/profiles.js +181 -11
- package/dist/commands/query.d.ts +2 -0
- package/dist/commands/query.js +25 -0
- package/dist/commands/segments.d.ts +4 -0
- package/dist/commands/segments.js +9 -5
- package/dist/index.d.ts +1 -1
- package/dist/index.js +112 -132
- package/dist/lib/client.d.ts +26 -0
- package/dist/lib/client.js +30 -7
- package/package.json +10 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @formo/cli
|
|
2
2
|
|
|
3
|
-
Command-line interface for the Formo API.
|
|
3
|
+
Command-line interface for the Formo API. Manage wallet profiles, alerts, dashboards, charts, contracts, segments, and run analytics SQL — directly from your terminal or via AI agents.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -12,7 +12,7 @@ npx @formo/cli
|
|
|
12
12
|
|
|
13
13
|
## Authentication
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
Save your API key locally:
|
|
16
16
|
|
|
17
17
|
```bash
|
|
18
18
|
formo login <apiKey>
|
|
@@ -24,86 +24,315 @@ Or set the `FORMO_API_KEY` environment variable — it takes precedence over the
|
|
|
24
24
|
export FORMO_API_KEY=formo_abc123
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
Get your API key from `Settings → API Keys` in the [Formo dashboard](https://app.formo.so).
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
---
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
## Auth commands
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
### `formo login [apiKey]`
|
|
34
|
+
|
|
35
|
+
Save your API key to `~/.config/formo/config.json`. Validates the key against the API and stores the workspace context.
|
|
36
36
|
|
|
37
37
|
```bash
|
|
38
38
|
formo login formo_abc123
|
|
39
39
|
```
|
|
40
40
|
|
|
41
|
+
### `formo logout`
|
|
42
|
+
|
|
43
|
+
Remove the saved API key and clear authentication state.
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
formo logout
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### `formo status`
|
|
50
|
+
|
|
51
|
+
Show current authentication state, workspace, and project ID.
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
formo status
|
|
55
|
+
```
|
|
56
|
+
|
|
41
57
|
---
|
|
42
58
|
|
|
43
|
-
|
|
59
|
+
## `formo profiles`
|
|
44
60
|
|
|
45
|
-
|
|
61
|
+
Wallet profile commands.
|
|
46
62
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
63
|
+
### `profiles get <address>`
|
|
64
|
+
|
|
65
|
+
Fetch a single wallet profile by address or ENS name.
|
|
50
66
|
|
|
51
67
|
| Option | Description |
|
|
52
68
|
|---|---|
|
|
53
|
-
| `--expand` | Comma-separated fields
|
|
69
|
+
| `--expand` | Comma-separated fields: `apps`, `chains`, `tokens`, `labels` |
|
|
54
70
|
|
|
55
71
|
```bash
|
|
56
72
|
formo profiles get 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045
|
|
57
73
|
formo profiles get vitalik.eth --expand labels,chains
|
|
58
74
|
```
|
|
59
75
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
### `formo profiles search`
|
|
76
|
+
### `profiles search`
|
|
63
77
|
|
|
64
|
-
Search wallet profiles with
|
|
78
|
+
Search wallet profiles with filters, sorting, and pagination. Returns a `PaginatedResponse<Profile>`.
|
|
65
79
|
|
|
66
80
|
| Option | Description |
|
|
67
81
|
|---|---|
|
|
68
82
|
| `--address` | Filter by wallet address |
|
|
69
|
-
| `--
|
|
70
|
-
| `--
|
|
71
|
-
| `--orderBy` |
|
|
72
|
-
| `--orderDir` |
|
|
83
|
+
| `--page` | Page number (1-indexed, default `1`) |
|
|
84
|
+
| `--size` | Page size (default `100`, max `1000`) |
|
|
85
|
+
| `--orderBy` | `last_onchain`, `first_onchain`, `net_worth_usd`, `updated_at`, `tx_count`, `first_seen`, `last_seen`, `num_sessions`, `revenue`, `volume`, `points` |
|
|
86
|
+
| `--orderDir` | `asc` or `desc` |
|
|
73
87
|
| `--expand` | Comma-separated fields to expand |
|
|
74
88
|
| `--conditions` | JSON array of `FilterCondition` objects (see below) |
|
|
89
|
+
| `--logic` | Combine conditions with `and` (default) or `or` |
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
formo profiles search --size 10
|
|
93
|
+
formo profiles search --orderBy net_worth_usd --orderDir desc --size 5
|
|
94
|
+
formo profiles search --page 2 --size 20
|
|
95
|
+
formo profiles search --conditions '[{"field":"net_worth_usd","op":"gt","value":10000}]' --size 20
|
|
96
|
+
formo profiles search --conditions '[{"field":"net_worth_usd","op":"gt","value":10000},{"field":"tx_count","op":"gt","value":50}]' --logic or --size 20
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### `profiles update <address>`
|
|
100
|
+
|
|
101
|
+
Merge-update identity properties on a wallet profile.
|
|
102
|
+
|
|
103
|
+
| Option | Description |
|
|
104
|
+
|---|---|
|
|
105
|
+
| `--properties` | JSON object of properties to merge |
|
|
106
|
+
|
|
107
|
+
**Allowed property keys:** `user_id`, `display_name`, `email`, `farcaster`, `discord`, `twitter`, `telegram`, `instagram`, `website`, `github`, `linkedin`, `facebook`, `tiktok`, `youtube`, `reddit`, `avatar`, `description`, `location`, `ens`, `lens`, `basenames`, `linea`. Unknown keys are rejected server-side.
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
formo profiles update 0xd8dA... --properties '{"display_name":"Vitalik","twitter":"VitalikButerin"}'
|
|
111
|
+
formo profiles update vitalik.eth --properties '{"email":"alice@example.com"}'
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
> Requires `profiles:write` scope.
|
|
115
|
+
|
|
116
|
+
### `profiles labels create <address>`
|
|
117
|
+
|
|
118
|
+
Upsert one or more labels on a wallet profile. Provide either a single label via `--tagId` or a batch via `--labels`.
|
|
75
119
|
|
|
76
|
-
|
|
120
|
+
| Option | Description |
|
|
121
|
+
|---|---|
|
|
122
|
+
| `--tagId` | Label identifier (e.g. `vip`, `airdrop_eligible`) |
|
|
123
|
+
| `--value` | Optional label value (e.g. tier name, country code) |
|
|
124
|
+
| `--chainId` | Optional chain identifier the label applies to |
|
|
125
|
+
| `--labels` | JSON array of `UserLabelInput` objects for batch upsert |
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
formo profiles labels create 0xd8dA... --tagId vip
|
|
129
|
+
formo profiles labels create 0xd8dA... --tagId tier --value gold --chainId 1
|
|
130
|
+
formo profiles labels create 0xd8dA... --labels '[{"tag_id":"vip"},{"tag_id":"airdrop_eligible","chain_id":"1"}]'
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### `profiles labels delete <address>`
|
|
134
|
+
|
|
135
|
+
Delete a label from a wallet profile.
|
|
136
|
+
|
|
137
|
+
| Option | Description |
|
|
138
|
+
|---|---|
|
|
139
|
+
| `--tagId` | Label identifier to delete (required) |
|
|
140
|
+
| `--chainId` | Optional chain identifier to scope the deletion |
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
formo profiles labels delete 0xd8dA... --tagId vip
|
|
144
|
+
formo profiles labels delete 0xd8dA... --tagId tier --chainId 1
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
> Requires `profiles:write` scope.
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
## `formo alerts`
|
|
152
|
+
|
|
153
|
+
Project alert commands. Requires `alerts:read` (list/get) or `alerts:write` (create/update/delete/toggle).
|
|
154
|
+
|
|
155
|
+
### `alerts list`
|
|
156
|
+
List all alerts for the project.
|
|
157
|
+
|
|
158
|
+
### `alerts get <alertId>`
|
|
159
|
+
Get a single alert by ID.
|
|
160
|
+
|
|
161
|
+
### `alerts create`
|
|
162
|
+
|
|
163
|
+
| Option | Description |
|
|
164
|
+
|---|---|
|
|
165
|
+
| `--name` | Alert name |
|
|
166
|
+
| `--triggerType` | Trigger type (e.g. `event`, `threshold`) |
|
|
167
|
+
| `--triggerFilters` | JSON array of trigger filter objects |
|
|
168
|
+
| `--recipient` | JSON array of recipient objects |
|
|
169
|
+
| `--secret` | Webhook secret |
|
|
77
170
|
|
|
78
171
|
```bash
|
|
79
|
-
|
|
80
|
-
|
|
172
|
+
formo alerts create --name "High value tx" --triggerType event \
|
|
173
|
+
--triggerFilters '[{"name":"event","operator":"equals","value":"transaction"}]' \
|
|
174
|
+
--recipient '[{"type":"email","value":["alerts@myapp.com"]}]'
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### `alerts update <alertId>`
|
|
178
|
+
Same options as `create`. Replaces the alert configuration.
|
|
81
179
|
|
|
82
|
-
|
|
83
|
-
|
|
180
|
+
### `alerts delete <alertId>`
|
|
181
|
+
Delete an alert.
|
|
84
182
|
|
|
85
|
-
|
|
86
|
-
|
|
183
|
+
### `alerts toggle <alertId> --status <active|paused>`
|
|
184
|
+
Toggle an alert between `active` and `paused`.
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
formo alerts toggle alert_abc123 --status paused
|
|
87
188
|
```
|
|
88
189
|
|
|
89
190
|
---
|
|
90
191
|
|
|
91
|
-
|
|
192
|
+
## `formo boards`
|
|
193
|
+
|
|
194
|
+
Dashboard board commands. Requires `boards:read` / `boards:write`.
|
|
195
|
+
|
|
196
|
+
### `boards list`
|
|
197
|
+
List all boards for the project.
|
|
92
198
|
|
|
93
|
-
|
|
199
|
+
### `boards get <boardId>`
|
|
200
|
+
Get a single board by ID.
|
|
201
|
+
|
|
202
|
+
### `boards create`
|
|
203
|
+
|
|
204
|
+
| Option | Description |
|
|
205
|
+
|---|---|
|
|
206
|
+
| `--name` | Board name |
|
|
207
|
+
| `--description` | Optional board description |
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
formo boards create --name "Revenue Metrics" --description "Weekly revenue tracking"
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
### `boards update <boardId>`
|
|
214
|
+
|
|
215
|
+
| Option | Description |
|
|
216
|
+
|---|---|
|
|
217
|
+
| `--name` | New board name |
|
|
218
|
+
| `--description` | New board description |
|
|
219
|
+
|
|
220
|
+
### `boards delete <boardId>`
|
|
221
|
+
Delete a board.
|
|
222
|
+
|
|
223
|
+
---
|
|
224
|
+
|
|
225
|
+
## `formo charts`
|
|
226
|
+
|
|
227
|
+
Chart commands. Charts live inside a board. Requires `charts:read` / `charts:write`.
|
|
228
|
+
|
|
229
|
+
### `charts list --boardId <boardId>`
|
|
230
|
+
List all charts in a board.
|
|
231
|
+
|
|
232
|
+
### `charts get <chartId> --boardId <boardId>`
|
|
233
|
+
Get a single chart by ID.
|
|
234
|
+
|
|
235
|
+
### `charts create --boardId <boardId> --body '<json>'`
|
|
236
|
+
Create a chart from a JSON config string.
|
|
237
|
+
|
|
238
|
+
### `charts update <chartId> --boardId <boardId> --body '<json>'`
|
|
239
|
+
Update a chart.
|
|
240
|
+
|
|
241
|
+
### `charts delete <chartId> --boardId <boardId>`
|
|
242
|
+
Delete a chart.
|
|
243
|
+
|
|
244
|
+
---
|
|
245
|
+
|
|
246
|
+
## `formo contracts`
|
|
247
|
+
|
|
248
|
+
Smart contract commands. Requires `contracts:read` / `contracts:write`.
|
|
249
|
+
|
|
250
|
+
### `contracts list`
|
|
251
|
+
List all tracked contracts. Returns `{ data: Contract[], deploy: { last_deployed_at, diff }, total, page, size, has_more }`.
|
|
252
|
+
|
|
253
|
+
### `contracts create`
|
|
254
|
+
|
|
255
|
+
| Option | Description |
|
|
256
|
+
|---|---|
|
|
257
|
+
| `--address` | Contract address (`0x…`) |
|
|
258
|
+
| `--chain` | Chain ID (e.g. `1`, `137`) |
|
|
259
|
+
| `--name` | Human-readable contract name |
|
|
260
|
+
| `--abi` | Contract ABI as a JSON string |
|
|
261
|
+
| `--events` | Events configuration as a JSON string |
|
|
262
|
+
|
|
263
|
+
```bash
|
|
264
|
+
formo contracts create --address 0x1f9840a85d5af5bf1d1762f925bdaddc4201f984 --chain 1 \
|
|
265
|
+
--name "UNI Token" --abi '[{"type":"event","name":"Transfer","inputs":[]}]' \
|
|
266
|
+
--events '{"Transfer":true}'
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
### `contracts update <chain> <address>`
|
|
270
|
+
|
|
271
|
+
| Option | Description |
|
|
272
|
+
|---|---|
|
|
273
|
+
| `--name` | Updated contract name |
|
|
274
|
+
| `--abi` | Updated ABI |
|
|
275
|
+
| `--events` | Updated events config |
|
|
276
|
+
|
|
277
|
+
### `contracts delete <chain> <address>`
|
|
278
|
+
Remove a tracked contract.
|
|
279
|
+
|
|
280
|
+
---
|
|
281
|
+
|
|
282
|
+
## `formo segments`
|
|
283
|
+
|
|
284
|
+
User segment commands. Requires `segments:read` / `segments:write`.
|
|
285
|
+
|
|
286
|
+
### `segments list`
|
|
287
|
+
List all user segments.
|
|
288
|
+
|
|
289
|
+
### `segments create`
|
|
290
|
+
|
|
291
|
+
| Option | Description |
|
|
292
|
+
|---|---|
|
|
293
|
+
| `--title` | Segment title |
|
|
294
|
+
| `--filterSets` | JSON array of filter set strings defining the segment |
|
|
295
|
+
|
|
296
|
+
### `segments delete <segmentId>`
|
|
297
|
+
Delete a user segment.
|
|
298
|
+
|
|
299
|
+
---
|
|
300
|
+
|
|
301
|
+
## `formo query`
|
|
302
|
+
|
|
303
|
+
### `query run "<sql>"`
|
|
304
|
+
|
|
305
|
+
Run a SQL query against your Formo analytics data. Returns `{ data, total, limit, offset, has_more }`.
|
|
94
306
|
|
|
95
307
|
```bash
|
|
96
308
|
formo query run "SELECT count(*) FROM events"
|
|
97
309
|
formo query run "SELECT address, net_worth_usd FROM wallet_profiles ORDER BY net_worth_usd DESC LIMIT 10"
|
|
98
310
|
```
|
|
99
311
|
|
|
100
|
-
> Requires `query:read` scope
|
|
312
|
+
> Requires `query:read` scope.
|
|
313
|
+
|
|
314
|
+
---
|
|
315
|
+
|
|
316
|
+
## `formo import`
|
|
317
|
+
|
|
318
|
+
### `import wallets`
|
|
319
|
+
|
|
320
|
+
Bulk-import wallet addresses into the project via the events API.
|
|
321
|
+
|
|
322
|
+
| Option | Description |
|
|
323
|
+
|---|---|
|
|
324
|
+
| `--addresses` | JSON array of wallet address strings |
|
|
325
|
+
| `--writeKey` | Project write SDK key |
|
|
326
|
+
|
|
327
|
+
```bash
|
|
328
|
+
formo import wallets --addresses '["0xabc...","0xdef..."]' --writeKey write_key_xyz
|
|
329
|
+
```
|
|
101
330
|
|
|
102
331
|
---
|
|
103
332
|
|
|
104
333
|
## FilterCondition reference
|
|
105
334
|
|
|
106
|
-
|
|
335
|
+
`profiles search --conditions` accepts a JSON array of filter condition objects:
|
|
107
336
|
|
|
108
337
|
```json
|
|
109
338
|
[
|
|
@@ -115,10 +344,25 @@ The `--conditions` option accepts a JSON array of filter condition objects:
|
|
|
115
344
|
| Field | Type | Description |
|
|
116
345
|
|---|---|---|
|
|
117
346
|
| `field` | `string` | Profile field to filter on |
|
|
118
|
-
| `op` | `string` |
|
|
347
|
+
| `op` | `string` | `eq`, `neq`, `gt`, `gte`, `lt`, `lte`, `in`, `nin` |
|
|
119
348
|
| `value` | `any` | Value to compare against |
|
|
120
349
|
|
|
121
|
-
|
|
350
|
+
Combine multiple conditions with `--logic and` (default) or `--logic or`.
|
|
351
|
+
|
|
352
|
+
---
|
|
353
|
+
|
|
354
|
+
## Output formats
|
|
355
|
+
|
|
356
|
+
Every command supports the standard incur output flags:
|
|
357
|
+
|
|
358
|
+
| Flag | Description |
|
|
359
|
+
|---|---|
|
|
360
|
+
| `--format <toon\|json\|yaml\|md\|jsonl>` | Output format (default: `toon`) |
|
|
361
|
+
| `--json` | Shorthand for `--format json` |
|
|
362
|
+
| `--verbose` | Include the full envelope (`ok`, `data`, `meta`) |
|
|
363
|
+
| `--filter-output <keys>` | Filter output by key paths (e.g. `data,meta.duration`) |
|
|
364
|
+
|
|
365
|
+
Every list endpoint returns a `PaginatedResponse<T>` envelope: `{ data: [...], total, page, size, has_more }`. Every error follows: `{ error: { code, message, doc_url, param?, details? } }` — branch on `error.code`, not `message`.
|
|
122
366
|
|
|
123
367
|
---
|
|
124
368
|
|
|
@@ -129,14 +373,14 @@ Multiple conditions are combined with `AND` logic.
|
|
|
129
373
|
pnpm install
|
|
130
374
|
|
|
131
375
|
# Run in development mode
|
|
132
|
-
pnpm
|
|
376
|
+
pnpm dev
|
|
133
377
|
|
|
134
378
|
# Build TypeScript
|
|
135
|
-
pnpm
|
|
379
|
+
pnpm build
|
|
136
380
|
|
|
137
|
-
#
|
|
138
|
-
pnpm
|
|
381
|
+
# Lint
|
|
382
|
+
pnpm lint
|
|
139
383
|
|
|
140
|
-
#
|
|
141
|
-
pnpm
|
|
384
|
+
# Run tests (requires TEST_TOKEN in .env)
|
|
385
|
+
pnpm test
|
|
142
386
|
```
|
|
@@ -9,6 +9,7 @@ export interface CreateAlertOptions {
|
|
|
9
9
|
recipient?: string;
|
|
10
10
|
secret?: string;
|
|
11
11
|
}
|
|
12
|
+
export declare function buildAlertBody(options: CreateAlertOptions | UpdateAlertOptions): Record<string, unknown>;
|
|
12
13
|
export declare function createAlertRun(options: CreateAlertOptions): Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
13
14
|
export interface UpdateAlertOptions {
|
|
14
15
|
name: string;
|
package/dist/commands/alerts.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.alerts = void 0;
|
|
4
4
|
exports.listAlertsRun = listAlertsRun;
|
|
5
5
|
exports.getAlertRun = getAlertRun;
|
|
6
|
+
exports.buildAlertBody = buildAlertBody;
|
|
6
7
|
exports.createAlertRun = createAlertRun;
|
|
7
8
|
exports.updateAlertRun = updateAlertRun;
|
|
8
9
|
exports.deleteAlertRun = deleteAlertRun;
|
|
@@ -45,9 +46,7 @@ exports.alerts.command('get', {
|
|
|
45
46
|
return getAlertRun(args.alertId);
|
|
46
47
|
},
|
|
47
48
|
});
|
|
48
|
-
function
|
|
49
|
-
(0, client_1.requireApiKey)();
|
|
50
|
-
const client = (0, client_1.createClient)();
|
|
49
|
+
function buildAlertBody(options) {
|
|
51
50
|
const body = {
|
|
52
51
|
name: options.name,
|
|
53
52
|
trigger_type: options.triggerType,
|
|
@@ -68,10 +67,15 @@ function createAlertRun(options) {
|
|
|
68
67
|
throw new Error('--recipient must be a valid JSON array');
|
|
69
68
|
}
|
|
70
69
|
}
|
|
71
|
-
if (options.secret) {
|
|
70
|
+
if (options.secret !== undefined) {
|
|
72
71
|
body.secret = options.secret;
|
|
73
72
|
}
|
|
74
|
-
return
|
|
73
|
+
return body;
|
|
74
|
+
}
|
|
75
|
+
function createAlertRun(options) {
|
|
76
|
+
(0, client_1.requireApiKey)();
|
|
77
|
+
const client = (0, client_1.createClient)();
|
|
78
|
+
return client.post('/v0/alerts/', buildAlertBody(options));
|
|
75
79
|
}
|
|
76
80
|
exports.alerts.command('create', {
|
|
77
81
|
description: 'Create a new project alert',
|
|
@@ -102,30 +106,7 @@ exports.alerts.command('create', {
|
|
|
102
106
|
function updateAlertRun(alertId, options) {
|
|
103
107
|
(0, client_1.requireApiKey)();
|
|
104
108
|
const client = (0, client_1.createClient)();
|
|
105
|
-
|
|
106
|
-
name: options.name,
|
|
107
|
-
trigger_type: options.triggerType,
|
|
108
|
-
};
|
|
109
|
-
if (options.triggerFilters) {
|
|
110
|
-
try {
|
|
111
|
-
body.trigger_filters = JSON.parse(options.triggerFilters);
|
|
112
|
-
}
|
|
113
|
-
catch {
|
|
114
|
-
throw new Error('--triggerFilters must be a valid JSON array');
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
if (options.recipient) {
|
|
118
|
-
try {
|
|
119
|
-
body.recipient = JSON.parse(options.recipient);
|
|
120
|
-
}
|
|
121
|
-
catch {
|
|
122
|
-
throw new Error('--recipient must be a valid JSON array');
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
if (options.secret !== undefined) {
|
|
126
|
-
body.secret = options.secret;
|
|
127
|
-
}
|
|
128
|
-
return client.put(`/v0/alerts/${encodeURIComponent(alertId)}`, body);
|
|
109
|
+
return client.put(`/v0/alerts/${encodeURIComponent(alertId)}`, buildAlertBody(options));
|
|
129
110
|
}
|
|
130
111
|
exports.alerts.command('update', {
|
|
131
112
|
description: 'Update an existing alert',
|
|
@@ -8,11 +8,23 @@ export interface CreateContractOptions {
|
|
|
8
8
|
abi: string;
|
|
9
9
|
events: string;
|
|
10
10
|
}
|
|
11
|
+
export declare function buildCreateContractBody(options: CreateContractOptions): {
|
|
12
|
+
address: string;
|
|
13
|
+
chain: number;
|
|
14
|
+
name: string;
|
|
15
|
+
abi: unknown;
|
|
16
|
+
events: unknown;
|
|
17
|
+
};
|
|
11
18
|
export declare function createContractRun(options: CreateContractOptions): Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
12
19
|
export interface UpdateContractOptions {
|
|
13
20
|
name: string;
|
|
14
21
|
abi: string;
|
|
15
22
|
events: string;
|
|
16
23
|
}
|
|
24
|
+
export declare function buildUpdateContractBody(options: UpdateContractOptions): {
|
|
25
|
+
name: string;
|
|
26
|
+
abi: unknown;
|
|
27
|
+
events: unknown;
|
|
28
|
+
};
|
|
17
29
|
export declare function updateContractRun(chain: string, address: string, options: UpdateContractOptions): Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
18
30
|
export declare function deleteContractRun(chain: string, address: string): Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.contracts = void 0;
|
|
4
4
|
exports.listContractsRun = listContractsRun;
|
|
5
|
+
exports.buildCreateContractBody = buildCreateContractBody;
|
|
5
6
|
exports.createContractRun = createContractRun;
|
|
7
|
+
exports.buildUpdateContractBody = buildUpdateContractBody;
|
|
6
8
|
exports.updateContractRun = updateContractRun;
|
|
7
9
|
exports.deleteContractRun = deleteContractRun;
|
|
8
10
|
const incur_1 = require("incur");
|
|
@@ -24,9 +26,7 @@ exports.contracts.command('list', {
|
|
|
24
26
|
return listContractsRun();
|
|
25
27
|
},
|
|
26
28
|
});
|
|
27
|
-
function
|
|
28
|
-
(0, client_1.requireApiKey)();
|
|
29
|
-
const client = (0, client_1.createClient)();
|
|
29
|
+
function buildCreateContractBody(options) {
|
|
30
30
|
let parsedAbi;
|
|
31
31
|
try {
|
|
32
32
|
parsedAbi = JSON.parse(options.abi);
|
|
@@ -41,13 +41,18 @@ function createContractRun(options) {
|
|
|
41
41
|
catch {
|
|
42
42
|
throw new Error('--events must be valid JSON');
|
|
43
43
|
}
|
|
44
|
-
return
|
|
44
|
+
return {
|
|
45
45
|
address: options.address,
|
|
46
46
|
chain: options.chain,
|
|
47
47
|
name: options.name,
|
|
48
48
|
abi: parsedAbi,
|
|
49
49
|
events: parsedEvents,
|
|
50
|
-
}
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
function createContractRun(options) {
|
|
53
|
+
(0, client_1.requireApiKey)();
|
|
54
|
+
const client = (0, client_1.createClient)();
|
|
55
|
+
return client.post('/v0/contracts/', buildCreateContractBody(options));
|
|
51
56
|
}
|
|
52
57
|
exports.contracts.command('create', {
|
|
53
58
|
description: 'Register a new smart contract to track',
|
|
@@ -75,9 +80,7 @@ exports.contracts.command('create', {
|
|
|
75
80
|
return createContractRun(options);
|
|
76
81
|
},
|
|
77
82
|
});
|
|
78
|
-
function
|
|
79
|
-
(0, client_1.requireApiKey)();
|
|
80
|
-
const client = (0, client_1.createClient)();
|
|
83
|
+
function buildUpdateContractBody(options) {
|
|
81
84
|
let parsedAbi;
|
|
82
85
|
try {
|
|
83
86
|
parsedAbi = JSON.parse(options.abi);
|
|
@@ -92,11 +95,16 @@ function updateContractRun(chain, address, options) {
|
|
|
92
95
|
catch {
|
|
93
96
|
throw new Error('--events must be valid JSON');
|
|
94
97
|
}
|
|
95
|
-
return
|
|
98
|
+
return {
|
|
96
99
|
name: options.name,
|
|
97
100
|
abi: parsedAbi,
|
|
98
101
|
events: parsedEvents,
|
|
99
|
-
}
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
function updateContractRun(chain, address, options) {
|
|
105
|
+
(0, client_1.requireApiKey)();
|
|
106
|
+
const client = (0, client_1.createClient)();
|
|
107
|
+
return client.put(`/v0/contracts/${encodeURIComponent(chain)}/${encodeURIComponent(address)}`, buildUpdateContractBody(options));
|
|
100
108
|
}
|
|
101
109
|
exports.contracts.command('update', {
|
|
102
110
|
description: 'Update a tracked contract',
|
|
@@ -4,4 +4,8 @@ export interface ImportWalletsOptions {
|
|
|
4
4
|
addresses: string;
|
|
5
5
|
writeKey: string;
|
|
6
6
|
}
|
|
7
|
+
export declare function buildImportBody(options: ImportWalletsOptions): {
|
|
8
|
+
addresses: any[];
|
|
9
|
+
writeKey: string;
|
|
10
|
+
};
|
|
7
11
|
export declare function importWalletsRun(options: ImportWalletsOptions): Promise<import("axios").AxiosResponse<any, any, {}>>;
|
package/dist/commands/import.js
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.importCmd = void 0;
|
|
4
|
+
exports.buildImportBody = buildImportBody;
|
|
4
5
|
exports.importWalletsRun = importWalletsRun;
|
|
5
6
|
const incur_1 = require("incur");
|
|
6
7
|
const client_1 = require("../lib/client");
|
|
7
8
|
exports.importCmd = incur_1.Cli.create('import', {
|
|
8
9
|
description: 'Import commands — bulk import wallet addresses into your project',
|
|
9
10
|
});
|
|
10
|
-
function
|
|
11
|
-
(0, client_1.requireApiKey)();
|
|
12
|
-
const client = (0, client_1.createClient)();
|
|
11
|
+
function buildImportBody(options) {
|
|
13
12
|
let parsedAddresses;
|
|
14
13
|
try {
|
|
15
14
|
parsedAddresses = JSON.parse(options.addresses);
|
|
@@ -20,10 +19,15 @@ function importWalletsRun(options) {
|
|
|
20
19
|
catch {
|
|
21
20
|
throw new Error('--addresses must be a valid JSON array of wallet address strings');
|
|
22
21
|
}
|
|
23
|
-
return
|
|
22
|
+
return {
|
|
24
23
|
addresses: parsedAddresses,
|
|
25
24
|
writeKey: options.writeKey,
|
|
26
|
-
}
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
function importWalletsRun(options) {
|
|
28
|
+
(0, client_1.requireApiKey)();
|
|
29
|
+
const client = (0, client_1.createClient)();
|
|
30
|
+
return client.post('/v0/import/', buildImportBody(options));
|
|
27
31
|
}
|
|
28
32
|
exports.importCmd.command('wallets', {
|
|
29
33
|
description: 'Bulk import wallet addresses into the project',
|
|
@@ -3,8 +3,8 @@ export declare const profiles: Cli.Cli<{}, undefined, undefined>;
|
|
|
3
3
|
export declare function getProfileRun(address: string, expand?: string): Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
4
4
|
export interface SearchProfilesOptions {
|
|
5
5
|
address?: string;
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
page?: number;
|
|
7
|
+
size?: number;
|
|
8
8
|
orderBy?: string;
|
|
9
9
|
orderDir?: string;
|
|
10
10
|
expand?: string;
|
|
@@ -12,3 +12,23 @@ export interface SearchProfilesOptions {
|
|
|
12
12
|
logic?: 'and' | 'or';
|
|
13
13
|
}
|
|
14
14
|
export declare function searchProfilesRun(options: SearchProfilesOptions): Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
15
|
+
export interface UpdateProfileOptions {
|
|
16
|
+
properties: string;
|
|
17
|
+
}
|
|
18
|
+
export declare function buildUpdateProfileBody(options: UpdateProfileOptions): Record<string, unknown>;
|
|
19
|
+
export declare function updateProfileRun(address: string, options: UpdateProfileOptions): Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
20
|
+
export declare const profilesLabels: Cli.Cli<{}, undefined, undefined>;
|
|
21
|
+
export interface CreateProfileLabelOptions {
|
|
22
|
+
tagId?: string;
|
|
23
|
+
value?: string;
|
|
24
|
+
chainId?: string;
|
|
25
|
+
labels?: string;
|
|
26
|
+
}
|
|
27
|
+
export declare function buildCreateLabelBody(options: CreateProfileLabelOptions): unknown;
|
|
28
|
+
export declare function createProfileLabelRun(address: string, options: CreateProfileLabelOptions): Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
29
|
+
export interface DeleteProfileLabelOptions {
|
|
30
|
+
tagId: string;
|
|
31
|
+
chainId?: string;
|
|
32
|
+
}
|
|
33
|
+
export declare function buildDeleteLabelBody(options: DeleteProfileLabelOptions): Record<string, string>;
|
|
34
|
+
export declare function deleteProfileLabelRun(address: string, options: DeleteProfileLabelOptions): Promise<import("axios").AxiosResponse<any, any, {}>>;
|