@openfort/cli 0.1.8 → 0.1.10

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/dist/cli.js CHANGED
@@ -1,19 +1,21 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  CREDENTIALS_PATH,
4
- ensureConfigDir
5
- } from "./chunk-QJGHQ7ID.js";
4
+ ensureConfigDir,
5
+ loadEnvFile,
6
+ requireApiKey,
7
+ writeEnvKey
8
+ } from "./chunk-SVNLXGFY.js";
6
9
 
7
10
  // src/cli.ts
8
- import { readFileSync as readFileSync2 } from "fs";
9
- import { Cli as Cli14, z as z15, Errors as Errors5 } from "incur";
10
- import Openfort from "@openfort/openfort-node";
11
+ import { readFileSync } from "fs";
12
+ import { Cli as Cli14, z as z14 } from "incur";
11
13
 
12
- // src/vars.ts
13
- import { z } from "incur";
14
- var varsSchema = z.object({
15
- openfort: z.custom()
16
- });
14
+ // src/commands/login.ts
15
+ import { randomBytes } from "crypto";
16
+ import { createServer } from "http";
17
+ import open from "open";
18
+ import { Cli, z } from "incur";
17
19
 
18
20
  // src/constants.ts
19
21
  var API_BASE_URL = process.env.OPENFORT_BASE_URL || "https://api.openfort.io";
@@ -21,58 +23,14 @@ var OPENFORT_SHIELD_URL = process.env.OPENFORT_SHIELD_URL || "https://shield.ope
21
23
  var AUTH_PAGE_URL = process.env.OPENFORT_AUTH_PAGE_URL || "https://dashboard.openfort.io";
22
24
  var CLI_CALLBACK_PORT = Number(process.env.OPENFORT_CLI_CALLBACK_PORT) || 8271;
23
25
 
24
- // src/env.ts
25
- import { readFileSync, writeFileSync, existsSync } from "fs";
26
- import { Errors } from "incur";
27
- function loadEnvFile(envPath) {
28
- const entries = /* @__PURE__ */ new Map();
29
- if (!existsSync(envPath)) return entries;
30
- const content = readFileSync(envPath, "utf-8");
31
- for (const line of content.split("\n")) {
32
- const trimmed = line.trim();
33
- if (!trimmed || trimmed.startsWith("#")) continue;
34
- const eqIndex = trimmed.indexOf("=");
35
- if (eqIndex === -1) continue;
36
- const key = trimmed.slice(0, eqIndex).trim();
37
- const value = trimmed.slice(eqIndex + 1).trim();
38
- entries.set(key, value);
39
- }
40
- return entries;
41
- }
42
- function writeEnvKey(envPath, key, value) {
43
- const entries = loadEnvFile(envPath);
44
- entries.set(key, value);
45
- const lines = [];
46
- for (const [k, v] of entries) {
47
- lines.push(`${k}=${v}`);
48
- }
49
- writeFileSync(envPath, `${lines.join("\n")}
50
- `);
51
- }
52
- function requireApiKey() {
53
- const apiKey = process.env.OPENFORT_API_KEY;
54
- if (!apiKey) {
55
- throw new Errors.IncurError({
56
- code: "MISSING_API_KEY",
57
- message: "OPENFORT_API_KEY is required.",
58
- hint: "Run: openfort login"
59
- });
60
- }
61
- return apiKey;
62
- }
63
-
64
26
  // src/commands/login.ts
65
- import { randomBytes } from "crypto";
66
- import { createServer } from "http";
67
- import open from "open";
68
- import { Cli, z as z2 } from "incur";
69
27
  function base64url(buffer) {
70
28
  return buffer.toString("base64").replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
71
29
  }
72
30
  function generateState() {
73
31
  return base64url(randomBytes(16));
74
32
  }
75
- function callbackPage(title, description, variant = "success") {
33
+ function callbackPage(title, description, variant = "success", extraHtml = "") {
76
34
  const iconColor = variant === "success" ? "hsl(142 71% 45%)" : "hsl(0 84% 60%)";
77
35
  const icon = variant === "success" ? `<svg width="48" height="48" viewBox="0 0 24 24" fill="none" stroke="${iconColor}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"/><polyline points="22 4 12 14.01 9 11.01"/></svg>` : `<svg width="48" height="48" viewBox="0 0 24 24" fill="none" stroke="${iconColor}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="15" y1="9" x2="9" y2="15"/><line x1="9" y1="9" x2="15" y2="15"/></svg>`;
78
36
  return `<!DOCTYPE html>
@@ -118,7 +76,7 @@ function callbackPage(title, description, variant = "success") {
118
76
  border: 1px solid var(--border);
119
77
  border-radius: var(--radius);
120
78
  width: 100%;
121
- max-width: 28rem;
79
+ max-width: 33rem;
122
80
  box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
123
81
  }
124
82
  .card-header {
@@ -141,6 +99,57 @@ function callbackPage(title, description, variant = "success") {
141
99
  color: var(--muted-foreground);
142
100
  line-height: 1.5;
143
101
  }
102
+ .card-extra {
103
+ padding: 0 1.5rem 1.5rem;
104
+ border-top: 1px solid var(--border);
105
+ margin-top: 0;
106
+ }
107
+ .card-extra-title {
108
+ font-size: 0.875rem;
109
+ font-weight: 500;
110
+ margin-top: 1rem;
111
+ margin-bottom: 0.5rem;
112
+ }
113
+ .code-block {
114
+ display: flex;
115
+ align-items: center;
116
+ gap: 0.5rem;
117
+ background-color: var(--border);
118
+ border-radius: var(--radius);
119
+ padding: 0.5rem 0.75rem;
120
+ font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
121
+ font-size: 0.75rem;
122
+ line-height: 1.5;
123
+ overflow-x: auto;
124
+ }
125
+ .code-block code {
126
+ flex: 1;
127
+ word-break: break-all;
128
+ }
129
+ .code-block button {
130
+ flex-shrink: 0;
131
+ background: none;
132
+ border: none;
133
+ color: var(--muted-foreground);
134
+ cursor: pointer;
135
+ padding: 0.25rem;
136
+ display: flex;
137
+ align-items: center;
138
+ }
139
+ .code-block button:hover {
140
+ color: var(--foreground);
141
+ }
142
+ .card-extra-link {
143
+ display: inline-block;
144
+ margin-top: 0.75rem;
145
+ font-size: 0.8rem;
146
+ color: var(--muted-foreground);
147
+ text-decoration: underline;
148
+ text-underline-offset: 2px;
149
+ }
150
+ .card-extra-link:hover {
151
+ color: var(--foreground);
152
+ }
144
153
  </style>
145
154
  </head>
146
155
  <body>
@@ -149,7 +158,7 @@ function callbackPage(title, description, variant = "success") {
149
158
  <div class="card-icon">${icon}</div>
150
159
  <h1 class="card-title">${title}</h1>
151
160
  <p class="card-description">${description}</p>
152
- </div>
161
+ </div>${extraHtml}
153
162
  </div>
154
163
  </body>
155
164
  </html>`;
@@ -184,7 +193,17 @@ function waitForCallback(port, state) {
184
193
  return;
185
194
  }
186
195
  res.writeHead(200, { "Content-Type": "text/html" });
187
- res.end(callbackPage("Login successful!", "You can close this window and return to your terminal."));
196
+ const skillCommand = "npx skills add openfort-xyz/agent-skills --skill openfort";
197
+ const agentSkillHtml = `
198
+ <div class="card-extra">
199
+ <p class="card-extra-title">Build with AI? Add the Openfort skill:</p>
200
+ <div class="code-block">
201
+ <code>${skillCommand}</code>
202
+ <button onclick="navigator.clipboard.writeText('${skillCommand}');this.innerHTML='<svg width=&quot;14&quot; height=&quot;14&quot; viewBox=&quot;0 0 24 24&quot; fill=&quot;none&quot; stroke=&quot;currentColor&quot; stroke-width=&quot;2&quot; stroke-linecap=&quot;round&quot; stroke-linejoin=&quot;round&quot;><polyline points=&quot;20 6 9 17 4 12&quot;/></svg>';setTimeout(()=>this.innerHTML='<svg width=&quot;14&quot; height=&quot;14&quot; viewBox=&quot;0 0 24 24&quot; fill=&quot;none&quot; stroke=&quot;currentColor&quot; stroke-width=&quot;2&quot; stroke-linecap=&quot;round&quot; stroke-linejoin=&quot;round&quot;><rect x=&quot;9&quot; y=&quot;9&quot; width=&quot;13&quot; height=&quot;13&quot; rx=&quot;2&quot; ry=&quot;2&quot;/><path d=&quot;M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1&quot;/></svg>',2000)"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg></button>
203
+ </div>
204
+ <a class="card-extra-link" href="https://www.openfort.io/docs/overview/building-with-cli" target="_blank" rel="noopener noreferrer">Learn more about building with the CLI</a>
205
+ </div>`;
206
+ res.end(callbackPage("Login successful!", "You can close this window and return to your terminal.", "success", agentSkillHtml));
188
207
  clearTimeout(timeout);
189
208
  server.close();
190
209
  resolve({ apiKey, publishableKey: publishableKey || void 0, projectId: projectId || void 0, project: project || "unknown" });
@@ -198,10 +217,10 @@ function waitForCallback(port, state) {
198
217
  }
199
218
  var login = Cli.create("login", {
200
219
  description: "Log in to Openfort via browser and save your API key.",
201
- output: z2.object({
202
- apiKey: z2.string().describe("The API key saved to credentials"),
203
- project: z2.string().describe("The project name"),
204
- credentialsPath: z2.string().describe("Path to the credentials file")
220
+ output: z.object({
221
+ apiKey: z.string().describe("The API key saved to credentials"),
222
+ project: z.string().describe("The project name"),
223
+ credentialsPath: z.string().describe("Path to the credentials file")
205
224
  }),
206
225
  async run(c) {
207
226
  const state = generateState();
@@ -249,7 +268,37 @@ var login = Cli.create("login", {
249
268
  });
250
269
 
251
270
  // src/commands/accounts.ts
252
- import { Cli as Cli2, z as z3, middleware } from "incur";
271
+ import { Cli as Cli2, z as z2, middleware } from "incur";
272
+
273
+ // src/client.ts
274
+ import Openfort from "@openfort/openfort-node";
275
+ var cached;
276
+ function getOpenfort() {
277
+ if (cached) return cached;
278
+ let apiKey = process.env.OPENFORT_API_KEY;
279
+ if (!apiKey) {
280
+ const creds = loadEnvFile(CREDENTIALS_PATH);
281
+ apiKey = creds.get("OPENFORT_API_KEY");
282
+ if (apiKey) {
283
+ process.env.OPENFORT_API_KEY = apiKey;
284
+ const pk = creds.get("OPENFORT_PUBLISHABLE_KEY");
285
+ if (pk && !process.env.OPENFORT_PUBLISHABLE_KEY) process.env.OPENFORT_PUBLISHABLE_KEY = pk;
286
+ const ws = creds.get("OPENFORT_WALLET_SECRET");
287
+ if (ws && !process.env.OPENFORT_WALLET_SECRET) process.env.OPENFORT_WALLET_SECRET = ws;
288
+ }
289
+ }
290
+ if (!apiKey) {
291
+ throw new Error("OPENFORT_API_KEY is required. Run: openfort login");
292
+ }
293
+ cached = new Openfort(apiKey, {
294
+ walletSecret: process.env.OPENFORT_WALLET_SECRET,
295
+ publishableKey: process.env.OPENFORT_PUBLISHABLE_KEY,
296
+ basePath: API_BASE_URL
297
+ });
298
+ return cached;
299
+ }
300
+
301
+ // src/commands/accounts.ts
253
302
  var requireWallet = middleware((c, next) => {
254
303
  const missing = [];
255
304
  if (!process.env.OPENFORT_WALLET_SECRET) missing.push("OPENFORT_WALLET_SECRET");
@@ -267,8 +316,7 @@ var requireWallet = middleware((c, next) => {
267
316
  return next();
268
317
  });
269
318
  var evm = Cli2.create("evm", {
270
- description: "EVM wallet management.",
271
- vars: varsSchema
319
+ description: "EVM wallet management."
272
320
  });
273
321
  evm.command("create", {
274
322
  description: "Create a new EVM backend wallet.",
@@ -277,13 +325,13 @@ evm.command("create", {
277
325
  ],
278
326
  hint: "Requires OPENFORT_WALLET_SECRET and OPENFORT_PUBLISHABLE_KEY.",
279
327
  middleware: [requireWallet],
280
- output: z3.object({
281
- id: z3.string().describe("Account ID"),
282
- address: z3.string().describe("Wallet address"),
283
- custody: z3.string().describe("Custody type")
328
+ output: z2.object({
329
+ id: z2.string().describe("Account ID"),
330
+ address: z2.string().describe("Wallet address"),
331
+ custody: z2.string().describe("Custody type")
284
332
  }),
285
333
  async run(c) {
286
- const account = await c.var.openfort.accounts.evm.backend.create();
334
+ const account = await getOpenfort().accounts.evm.backend.create();
287
335
  return c.ok(
288
336
  { id: account.id, address: account.address, custody: account.custody },
289
337
  {
@@ -300,25 +348,25 @@ evm.command("create", {
300
348
  });
301
349
  evm.command("list", {
302
350
  description: "List EVM backend wallets.",
303
- options: z3.object({
304
- limit: z3.number().optional().describe("Max results"),
305
- skip: z3.number().optional().describe("Offset")
351
+ options: z2.object({
352
+ limit: z2.number().optional().describe("Max results"),
353
+ skip: z2.number().optional().describe("Offset")
306
354
  }),
307
355
  alias: { limit: "l" },
308
356
  examples: [
309
357
  { description: "List all EVM backend wallets" },
310
358
  { options: { limit: 5 }, description: "Show first 5 wallets" }
311
359
  ],
312
- output: z3.object({
313
- accounts: z3.array(z3.object({
314
- id: z3.string(),
315
- address: z3.string(),
316
- custody: z3.string()
360
+ output: z2.object({
361
+ accounts: z2.array(z2.object({
362
+ id: z2.string(),
363
+ address: z2.string(),
364
+ custody: z2.string()
317
365
  })),
318
- total: z3.number().optional()
366
+ total: z2.number().optional()
319
367
  }),
320
368
  async run(c) {
321
- const res = await c.var.openfort.accounts.evm.backend.list({
369
+ const res = await getOpenfort().accounts.evm.backend.list({
322
370
  limit: c.options.limit,
323
371
  skip: c.options.skip
324
372
  });
@@ -334,25 +382,25 @@ evm.command("list", {
334
382
  });
335
383
  evm.command("list-delegated", {
336
384
  description: "List EVM delegated accounts.",
337
- options: z3.object({
338
- limit: z3.number().optional().describe("Max results"),
339
- skip: z3.number().optional().describe("Offset")
385
+ options: z2.object({
386
+ limit: z2.number().optional().describe("Max results"),
387
+ skip: z2.number().optional().describe("Offset")
340
388
  }),
341
389
  alias: { limit: "l" },
342
390
  examples: [
343
391
  { description: "List all EVM delegated accounts" },
344
392
  { options: { limit: 5 }, description: "Show first 5 accounts" }
345
393
  ],
346
- output: z3.object({
347
- accounts: z3.array(z3.object({
348
- id: z3.string(),
349
- address: z3.string(),
350
- custody: z3.string()
394
+ output: z2.object({
395
+ accounts: z2.array(z2.object({
396
+ id: z2.string(),
397
+ address: z2.string(),
398
+ custody: z2.string()
351
399
  })),
352
- total: z3.number().optional()
400
+ total: z2.number().optional()
353
401
  }),
354
402
  async run(c) {
355
- const res = await c.var.openfort.accounts.evm.list({
403
+ const res = await getOpenfort().accounts.evm.list({
356
404
  accountType: "Delegated Account",
357
405
  limit: c.options.limit,
358
406
  skip: c.options.skip
@@ -369,25 +417,25 @@ evm.command("list-delegated", {
369
417
  });
370
418
  evm.command("list-smart", {
371
419
  description: "List EVM smart accounts.",
372
- options: z3.object({
373
- limit: z3.number().optional().describe("Max results"),
374
- skip: z3.number().optional().describe("Offset")
420
+ options: z2.object({
421
+ limit: z2.number().optional().describe("Max results"),
422
+ skip: z2.number().optional().describe("Offset")
375
423
  }),
376
424
  alias: { limit: "l" },
377
425
  examples: [
378
426
  { description: "List all EVM smart accounts" },
379
427
  { options: { limit: 5 }, description: "Show first 5 accounts" }
380
428
  ],
381
- output: z3.object({
382
- accounts: z3.array(z3.object({
383
- id: z3.string(),
384
- address: z3.string(),
385
- custody: z3.string()
429
+ output: z2.object({
430
+ accounts: z2.array(z2.object({
431
+ id: z2.string(),
432
+ address: z2.string(),
433
+ custody: z2.string()
386
434
  })),
387
- total: z3.number().optional()
435
+ total: z2.number().optional()
388
436
  }),
389
437
  async run(c) {
390
- const res = await c.var.openfort.accounts.evm.list({
438
+ const res = await getOpenfort().accounts.evm.list({
391
439
  accountType: "Smart Account",
392
440
  limit: c.options.limit,
393
441
  skip: c.options.skip
@@ -404,19 +452,19 @@ evm.command("list-smart", {
404
452
  });
405
453
  evm.command("get", {
406
454
  description: "Get an EVM backend wallet by ID or address.",
407
- args: z3.object({
408
- id: z3.string().describe("Account ID or address")
455
+ args: z2.object({
456
+ id: z2.string().describe("Account ID or address")
409
457
  }),
410
458
  examples: [
411
459
  { args: { id: "acc_1a2b3c4d" }, description: "Get wallet by ID" }
412
460
  ],
413
- output: z3.object({
414
- id: z3.string(),
415
- address: z3.string(),
416
- custody: z3.string()
461
+ output: z2.object({
462
+ id: z2.string(),
463
+ address: z2.string(),
464
+ custody: z2.string()
417
465
  }),
418
466
  async run(c) {
419
- const a = await c.var.openfort.accounts.evm.backend.get({ id: c.args.id });
467
+ const a = await getOpenfort().accounts.evm.backend.get({ id: c.args.id });
420
468
  return c.ok({
421
469
  id: a.id,
422
470
  address: a.address,
@@ -426,43 +474,43 @@ evm.command("get", {
426
474
  });
427
475
  evm.command("delete", {
428
476
  description: "Delete an EVM backend wallet.",
429
- args: z3.object({
430
- id: z3.string().describe("Account ID (acc_...)")
477
+ args: z2.object({
478
+ id: z2.string().describe("Account ID (acc_...)")
431
479
  }),
432
480
  examples: [
433
481
  { args: { id: "acc_1a2b3c4d" }, description: "Delete a wallet" }
434
482
  ],
435
- output: z3.object({
436
- id: z3.string(),
437
- deleted: z3.boolean()
483
+ output: z2.object({
484
+ id: z2.string(),
485
+ deleted: z2.boolean()
438
486
  }),
439
487
  async run(c) {
440
- const res = await c.var.openfort.accounts.evm.backend.delete(c.args.id);
488
+ const res = await getOpenfort().accounts.evm.backend.delete(c.args.id);
441
489
  return c.ok({ id: res.id, deleted: res.deleted });
442
490
  }
443
491
  });
444
492
  evm.command("update", {
445
493
  description: "Upgrade an EVM backend wallet to a delegated account (EIP-7702).",
446
- args: z3.object({
447
- id: z3.string().describe("Account ID (acc_...)")
494
+ args: z2.object({
495
+ id: z2.string().describe("Account ID (acc_...)")
448
496
  }),
449
- options: z3.object({
450
- chainId: z3.number().describe("Chain ID to deploy on"),
451
- implementationType: z3.string().describe("Target implementation type (e.g. CaliburV9)")
497
+ options: z2.object({
498
+ chainId: z2.number().describe("Chain ID to deploy on"),
499
+ implementationType: z2.string().describe("Target implementation type (e.g. CaliburV9)")
452
500
  }),
453
501
  examples: [
454
502
  { args: { id: "acc_1a2b3c4d" }, options: { chainId: 8453, implementationType: "CaliburV9" }, description: "Upgrade to delegated account on Base" }
455
503
  ],
456
- output: z3.object({
457
- id: z3.string(),
458
- address: z3.string(),
459
- accountType: z3.string(),
460
- chainId: z3.number().optional(),
461
- chainType: z3.string()
504
+ output: z2.object({
505
+ id: z2.string(),
506
+ address: z2.string(),
507
+ accountType: z2.string(),
508
+ chainId: z2.number().optional(),
509
+ chainType: z2.string()
462
510
  }),
463
511
  async run(c) {
464
- const account = await c.var.openfort.accounts.evm.backend.get({ id: c.args.id });
465
- const res = await c.var.openfort.accounts.evm.backend.update({
512
+ const account = await getOpenfort().accounts.evm.backend.get({ id: c.args.id });
513
+ const res = await getOpenfort().accounts.evm.backend.update({
466
514
  walletId: account.walletId,
467
515
  chainId: c.options.chainId,
468
516
  accountId: account.id,
@@ -489,22 +537,22 @@ evm.command("update", {
489
537
  });
490
538
  evm.command("sign", {
491
539
  description: "Sign data with an EVM backend wallet.",
492
- args: z3.object({
493
- id: z3.string().describe("Account ID (acc_...)")
540
+ args: z2.object({
541
+ id: z2.string().describe("Account ID (acc_...)")
494
542
  }),
495
- options: z3.object({
496
- data: z3.string().describe("Hex-encoded data to sign")
543
+ options: z2.object({
544
+ data: z2.string().describe("Hex-encoded data to sign")
497
545
  }),
498
546
  examples: [
499
547
  { args: { id: "acc_1a2b3c4d" }, options: { data: "0xdeadbeef" }, description: "Sign a message hash" }
500
548
  ],
501
549
  hint: "Requires OPENFORT_WALLET_SECRET and OPENFORT_PUBLISHABLE_KEY.",
502
550
  middleware: [requireWallet],
503
- output: z3.object({
504
- signature: z3.string()
551
+ output: z2.object({
552
+ signature: z2.string()
505
553
  }),
506
554
  async run(c) {
507
- const signature = await c.var.openfort.accounts.evm.backend.sign({
555
+ const signature = await getOpenfort().accounts.evm.backend.sign({
508
556
  id: c.args.id,
509
557
  data: c.options.data
510
558
  });
@@ -513,21 +561,21 @@ evm.command("sign", {
513
561
  });
514
562
  evm.command("import", {
515
563
  description: "Import a private key as an EVM backend wallet.",
516
- options: z3.object({
517
- privateKey: z3.string().describe("Private key (hex string)")
564
+ options: z2.object({
565
+ privateKey: z2.string().describe("Private key (hex string)")
518
566
  }),
519
567
  examples: [
520
568
  { options: { privateKey: "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80" }, description: "Import a private key" }
521
569
  ],
522
570
  hint: "Requires OPENFORT_WALLET_SECRET and OPENFORT_PUBLISHABLE_KEY.",
523
571
  middleware: [requireWallet],
524
- output: z3.object({
525
- id: z3.string(),
526
- address: z3.string(),
527
- custody: z3.string()
572
+ output: z2.object({
573
+ id: z2.string(),
574
+ address: z2.string(),
575
+ custody: z2.string()
528
576
  }),
529
577
  async run(c) {
530
- const account = await c.var.openfort.accounts.evm.backend.import({
578
+ const account = await getOpenfort().accounts.evm.backend.import({
531
579
  privateKey: c.options.privateKey
532
580
  });
533
581
  return c.ok({
@@ -539,18 +587,18 @@ evm.command("import", {
539
587
  });
540
588
  evm.command("export", {
541
589
  description: "Export an EVM backend wallet private key.",
542
- args: z3.object({
543
- id: z3.string().describe("Account ID (acc_...)")
590
+ args: z2.object({
591
+ id: z2.string().describe("Account ID (acc_...)")
544
592
  }),
545
593
  examples: [
546
594
  { args: { id: "acc_1a2b3c4d" }, description: "Export private key" }
547
595
  ],
548
596
  middleware: [requireWallet],
549
- output: z3.object({
550
- privateKey: z3.string()
597
+ output: z2.object({
598
+ privateKey: z2.string()
551
599
  }),
552
600
  async run(c) {
553
- const privateKey = await c.var.openfort.accounts.evm.backend.export({
601
+ const privateKey = await getOpenfort().accounts.evm.backend.export({
554
602
  id: c.args.id
555
603
  });
556
604
  return c.ok({ privateKey });
@@ -558,13 +606,13 @@ evm.command("export", {
558
606
  });
559
607
  evm.command("send-transaction", {
560
608
  description: "Send a gasless EVM transaction (auto-delegates via EIP-7702 if needed).",
561
- args: z3.object({
562
- id: z3.string().describe("Account ID (acc_...)")
609
+ args: z2.object({
610
+ id: z2.string().describe("Account ID (acc_...)")
563
611
  }),
564
- options: z3.object({
565
- chainId: z3.number().describe("Chain ID"),
566
- interactions: z3.string().describe('Interactions as JSON: [{"to":"0x...","data":"0x...","value":"0"}]'),
567
- policy: z3.string().optional().describe("Fee sponsorship ID (pol_...)")
612
+ options: z2.object({
613
+ chainId: z2.number().describe("Chain ID"),
614
+ interactions: z2.string().describe('Interactions as JSON: [{"to":"0x...","data":"0x...","value":"0"}]'),
615
+ policy: z2.string().optional().describe("Fee sponsorship ID (pol_...)")
568
616
  }),
569
617
  examples: [
570
618
  {
@@ -577,15 +625,15 @@ evm.command("send-transaction", {
577
625
  }
578
626
  ],
579
627
  middleware: [requireWallet],
580
- output: z3.object({
581
- id: z3.string(),
582
- chainId: z3.number(),
583
- transactionHash: z3.string().optional()
628
+ output: z2.object({
629
+ id: z2.string(),
630
+ chainId: z2.number(),
631
+ transactionHash: z2.string().optional()
584
632
  }),
585
633
  async run(c) {
586
- const account = await c.var.openfort.accounts.evm.backend.get({ id: c.args.id });
634
+ const account = await getOpenfort().accounts.evm.backend.get({ id: c.args.id });
587
635
  const interactions = JSON.parse(c.options.interactions);
588
- const res = await c.var.openfort.accounts.evm.backend.sendTransaction({
636
+ const res = await getOpenfort().accounts.evm.backend.sendTransaction({
589
637
  account,
590
638
  chainId: c.options.chainId,
591
639
  interactions,
@@ -599,8 +647,7 @@ evm.command("send-transaction", {
599
647
  }
600
648
  });
601
649
  var solana = Cli2.create("solana", {
602
- description: "Solana wallet management.",
603
- vars: varsSchema
650
+ description: "Solana wallet management."
604
651
  });
605
652
  solana.command("create", {
606
653
  description: "Create a new Solana backend wallet.",
@@ -609,13 +656,13 @@ solana.command("create", {
609
656
  ],
610
657
  hint: "Requires OPENFORT_WALLET_SECRET and OPENFORT_PUBLISHABLE_KEY.",
611
658
  middleware: [requireWallet],
612
- output: z3.object({
613
- id: z3.string().describe("Account ID"),
614
- address: z3.string().describe("Wallet address"),
615
- custody: z3.string().describe("Custody type")
659
+ output: z2.object({
660
+ id: z2.string().describe("Account ID"),
661
+ address: z2.string().describe("Wallet address"),
662
+ custody: z2.string().describe("Custody type")
616
663
  }),
617
664
  async run(c) {
618
- const account = await c.var.openfort.accounts.solana.backend.create();
665
+ const account = await getOpenfort().accounts.solana.backend.create();
619
666
  return c.ok(
620
667
  { id: account.id, address: account.address, custody: account.custody },
621
668
  {
@@ -631,24 +678,24 @@ solana.command("create", {
631
678
  });
632
679
  solana.command("list", {
633
680
  description: "List Solana backend wallets.",
634
- options: z3.object({
635
- limit: z3.number().optional().describe("Max results"),
636
- skip: z3.number().optional().describe("Offset")
681
+ options: z2.object({
682
+ limit: z2.number().optional().describe("Max results"),
683
+ skip: z2.number().optional().describe("Offset")
637
684
  }),
638
685
  alias: { limit: "l" },
639
686
  examples: [
640
687
  { description: "List all Solana wallets" }
641
688
  ],
642
- output: z3.object({
643
- accounts: z3.array(z3.object({
644
- id: z3.string(),
645
- address: z3.string(),
646
- custody: z3.string()
689
+ output: z2.object({
690
+ accounts: z2.array(z2.object({
691
+ id: z2.string(),
692
+ address: z2.string(),
693
+ custody: z2.string()
647
694
  })),
648
- total: z3.number().optional()
695
+ total: z2.number().optional()
649
696
  }),
650
697
  async run(c) {
651
- const res = await c.var.openfort.accounts.solana.backend.list({
698
+ const res = await getOpenfort().accounts.solana.backend.list({
652
699
  limit: c.options.limit,
653
700
  skip: c.options.skip
654
701
  });
@@ -664,19 +711,19 @@ solana.command("list", {
664
711
  });
665
712
  solana.command("get", {
666
713
  description: "Get a Solana backend wallet by ID or address.",
667
- args: z3.object({
668
- id: z3.string().describe("Account ID or address")
714
+ args: z2.object({
715
+ id: z2.string().describe("Account ID or address")
669
716
  }),
670
717
  examples: [
671
718
  { args: { id: "acc_1a2b3c4d" }, description: "Get wallet by ID" }
672
719
  ],
673
- output: z3.object({
674
- id: z3.string(),
675
- address: z3.string(),
676
- custody: z3.string()
720
+ output: z2.object({
721
+ id: z2.string(),
722
+ address: z2.string(),
723
+ custody: z2.string()
677
724
  }),
678
725
  async run(c) {
679
- const a = await c.var.openfort.accounts.solana.backend.get({ id: c.args.id });
726
+ const a = await getOpenfort().accounts.solana.backend.get({ id: c.args.id });
680
727
  return c.ok({
681
728
  id: a.id,
682
729
  address: a.address,
@@ -686,18 +733,18 @@ solana.command("get", {
686
733
  });
687
734
  solana.command("sign", {
688
735
  description: "Sign data with a Solana backend wallet.",
689
- args: z3.object({
690
- id: z3.string().describe("Account ID (acc_...)")
736
+ args: z2.object({
737
+ id: z2.string().describe("Account ID (acc_...)")
691
738
  }),
692
- options: z3.object({
693
- data: z3.string().describe("Data to sign (base64-encoded)")
739
+ options: z2.object({
740
+ data: z2.string().describe("Data to sign (base64-encoded)")
694
741
  }),
695
742
  alias: { data: "d" },
696
743
  hint: "Requires OPENFORT_WALLET_SECRET and OPENFORT_PUBLISHABLE_KEY.",
697
744
  middleware: [requireWallet],
698
- output: z3.object({
699
- account: z3.string(),
700
- signature: z3.string()
745
+ output: z2.object({
746
+ account: z2.string(),
747
+ signature: z2.string()
701
748
  }),
702
749
  examples: [
703
750
  {
@@ -707,44 +754,44 @@ solana.command("sign", {
707
754
  }
708
755
  ],
709
756
  async run(c) {
710
- const signature = await c.var.openfort.accounts.solana.backend.sign(c.args.id, c.options.data);
757
+ const signature = await getOpenfort().accounts.solana.backend.sign(c.args.id, c.options.data);
711
758
  return c.ok({ account: c.args.id, signature });
712
759
  }
713
760
  });
714
761
  solana.command("delete", {
715
762
  description: "Delete a Solana backend wallet.",
716
- args: z3.object({
717
- id: z3.string().describe("Account ID (acc_...)")
763
+ args: z2.object({
764
+ id: z2.string().describe("Account ID (acc_...)")
718
765
  }),
719
766
  examples: [
720
767
  { args: { id: "acc_1a2b3c4d" }, description: "Delete a wallet" }
721
768
  ],
722
- output: z3.object({
723
- id: z3.string(),
724
- deleted: z3.boolean()
769
+ output: z2.object({
770
+ id: z2.string(),
771
+ deleted: z2.boolean()
725
772
  }),
726
773
  async run(c) {
727
- const res = await c.var.openfort.accounts.solana.backend.delete(c.args.id);
774
+ const res = await getOpenfort().accounts.solana.backend.delete(c.args.id);
728
775
  return c.ok({ id: res.id, deleted: res.deleted });
729
776
  }
730
777
  });
731
778
  solana.command("import", {
732
779
  description: "Import a private key as a Solana backend wallet.",
733
- options: z3.object({
734
- privateKey: z3.string().describe("Private key (hex-encoded 32 bytes or base58)")
780
+ options: z2.object({
781
+ privateKey: z2.string().describe("Private key (hex-encoded 32 bytes or base58)")
735
782
  }),
736
783
  examples: [
737
784
  { options: { privateKey: "abc123..." }, description: "Import a Solana private key" }
738
785
  ],
739
786
  hint: "Requires OPENFORT_WALLET_SECRET and OPENFORT_PUBLISHABLE_KEY.",
740
787
  middleware: [requireWallet],
741
- output: z3.object({
742
- id: z3.string(),
743
- address: z3.string(),
744
- custody: z3.string()
788
+ output: z2.object({
789
+ id: z2.string(),
790
+ address: z2.string(),
791
+ custody: z2.string()
745
792
  }),
746
793
  async run(c) {
747
- const account = await c.var.openfort.accounts.solana.backend.import({
794
+ const account = await getOpenfort().accounts.solana.backend.import({
748
795
  privateKey: c.options.privateKey
749
796
  });
750
797
  return c.ok({
@@ -756,18 +803,18 @@ solana.command("import", {
756
803
  });
757
804
  solana.command("export", {
758
805
  description: "Export a Solana backend wallet private key.",
759
- args: z3.object({
760
- id: z3.string().describe("Account ID (acc_...)")
806
+ args: z2.object({
807
+ id: z2.string().describe("Account ID (acc_...)")
761
808
  }),
762
809
  examples: [
763
810
  { args: { id: "acc_1a2b3c4d" }, description: "Export private key" }
764
811
  ],
765
812
  middleware: [requireWallet],
766
- output: z3.object({
767
- privateKey: z3.string()
813
+ output: z2.object({
814
+ privateKey: z2.string()
768
815
  }),
769
816
  async run(c) {
770
- const privateKey = await c.var.openfort.accounts.solana.backend.export({
817
+ const privateKey = await getOpenfort().accounts.solana.backend.export({
771
818
  id: c.args.id
772
819
  });
773
820
  return c.ok({ privateKey });
@@ -775,14 +822,14 @@ solana.command("export", {
775
822
  });
776
823
  solana.command("transfer", {
777
824
  description: "Transfer SOL or SPL tokens.",
778
- args: z3.object({
779
- id: z3.string().describe("Account ID (acc_...)")
825
+ args: z2.object({
826
+ id: z2.string().describe("Account ID (acc_...)")
780
827
  }),
781
- options: z3.object({
782
- to: z3.string().describe("Destination address (base58)"),
783
- amount: z3.string().describe("Amount in base units (lamports for SOL)"),
784
- token: z3.string().optional().describe('Token: "sol" (default), "usdc", or mint address'),
785
- cluster: z3.enum(["devnet", "mainnet-beta"]).default("mainnet-beta").describe("Cluster: devnet or mainnet-beta")
828
+ options: z2.object({
829
+ to: z2.string().describe("Destination address (base58)"),
830
+ amount: z2.string().describe("Amount in base units (lamports for SOL)"),
831
+ token: z2.string().optional().describe('Token: "sol" (default), "usdc", or mint address'),
832
+ cluster: z2.enum(["devnet", "mainnet-beta"]).default("mainnet-beta").describe("Cluster: devnet or mainnet-beta")
786
833
  }),
787
834
  examples: [
788
835
  {
@@ -797,12 +844,12 @@ solana.command("transfer", {
797
844
  }
798
845
  ],
799
846
  middleware: [requireWallet],
800
- output: z3.object({
801
- signature: z3.string()
847
+ output: z2.object({
848
+ signature: z2.string()
802
849
  }),
803
850
  async run(c) {
804
- const account = await c.var.openfort.accounts.solana.backend.get({ id: c.args.id });
805
- const res = await c.var.openfort.accounts.solana.backend.transfer({
851
+ const account = await getOpenfort().accounts.solana.backend.get({ id: c.args.id });
852
+ const res = await getOpenfort().accounts.solana.backend.transfer({
806
853
  account,
807
854
  to: c.options.to,
808
855
  amount: BigInt(c.options.amount),
@@ -813,16 +860,15 @@ solana.command("transfer", {
813
860
  }
814
861
  });
815
862
  var accounts = Cli2.create("accounts", {
816
- description: "Manage wallets and accounts.",
817
- vars: varsSchema
863
+ description: "Manage wallets and accounts."
818
864
  });
819
865
  accounts.command("list", {
820
866
  description: "List all accounts across chains.",
821
- options: z3.object({
822
- limit: z3.number().optional().describe("Max results"),
823
- skip: z3.number().optional().describe("Offset"),
824
- chainType: z3.enum(["EVM", "SVM"]).optional().describe("Filter by chain type"),
825
- custody: z3.enum(["Developer", "User"]).optional().describe("Filter by custody")
867
+ options: z2.object({
868
+ limit: z2.number().optional().describe("Max results"),
869
+ skip: z2.number().optional().describe("Offset"),
870
+ chainType: z2.enum(["EVM", "SVM"]).optional().describe("Filter by chain type"),
871
+ custody: z2.enum(["Developer", "User"]).optional().describe("Filter by custody")
826
872
  }),
827
873
  alias: { limit: "l" },
828
874
  examples: [
@@ -830,23 +876,23 @@ accounts.command("list", {
830
876
  { options: { chainType: "EVM" }, description: "Filter to EVM accounts only" },
831
877
  { options: { custody: "Developer", limit: 10 }, description: "List developer-custody wallets" }
832
878
  ],
833
- output: z3.object({
834
- data: z3.array(z3.object({
835
- id: z3.string(),
836
- wallet: z3.string().describe("Wallet ID"),
837
- accountType: z3.string().describe("Account type"),
838
- address: z3.string(),
839
- ownerAddress: z3.string().optional(),
840
- chainType: z3.string(),
841
- chainId: z3.number().optional(),
842
- custody: z3.string(),
843
- createdAt: z3.number(),
844
- updatedAt: z3.number()
879
+ output: z2.object({
880
+ data: z2.array(z2.object({
881
+ id: z2.string(),
882
+ wallet: z2.string().describe("Wallet ID"),
883
+ accountType: z2.string().describe("Account type"),
884
+ address: z2.string(),
885
+ ownerAddress: z2.string().optional(),
886
+ chainType: z2.string(),
887
+ chainId: z2.number().optional(),
888
+ custody: z2.string(),
889
+ createdAt: z2.number(),
890
+ updatedAt: z2.number()
845
891
  })),
846
- total: z3.number()
892
+ total: z2.number()
847
893
  }),
848
894
  async run(c) {
849
- const res = await c.var.openfort.accounts.list({
895
+ const res = await getOpenfort().accounts.list({
850
896
  limit: c.options.limit,
851
897
  skip: c.options.skip,
852
898
  chainType: c.options.chainType,
@@ -873,38 +919,37 @@ accounts.command(evm);
873
919
  accounts.command(solana);
874
920
 
875
921
  // src/commands/contracts.ts
876
- import { Cli as Cli3, z as z4 } from "incur";
877
- var contractItem = z4.object({
878
- id: z4.string(),
879
- createdAt: z4.number(),
880
- name: z4.string().nullable(),
881
- chainId: z4.number(),
882
- address: z4.string(),
883
- deleted: z4.boolean(),
884
- abi: z4.array(z4.record(z4.string(), z4.unknown())),
885
- publicVerification: z4.boolean()
922
+ import { Cli as Cli3, z as z3 } from "incur";
923
+ var contractItem = z3.object({
924
+ id: z3.string(),
925
+ createdAt: z3.number(),
926
+ name: z3.string().nullable(),
927
+ chainId: z3.number(),
928
+ address: z3.string(),
929
+ deleted: z3.boolean(),
930
+ abi: z3.array(z3.record(z3.string(), z3.unknown())),
931
+ publicVerification: z3.boolean()
886
932
  });
887
933
  var contracts = Cli3.create("contracts", {
888
- description: "Manage smart contracts.",
889
- vars: varsSchema
934
+ description: "Manage smart contracts."
890
935
  });
891
936
  contracts.command("list", {
892
937
  description: "List registered contracts.",
893
- options: z4.object({
894
- limit: z4.number().optional().describe("Max results"),
895
- skip: z4.number().optional().describe("Offset")
938
+ options: z3.object({
939
+ limit: z3.number().optional().describe("Max results"),
940
+ skip: z3.number().optional().describe("Offset")
896
941
  }),
897
942
  alias: { limit: "l" },
898
943
  examples: [
899
944
  { description: "List all contracts" },
900
945
  { options: { limit: 5 }, description: "List first 5 contracts" }
901
946
  ],
902
- output: z4.object({
903
- data: z4.array(contractItem),
904
- total: z4.number()
947
+ output: z3.object({
948
+ data: z3.array(contractItem),
949
+ total: z3.number()
905
950
  }),
906
951
  async run(c) {
907
- const res = await c.var.openfort.contracts.list({
952
+ const res = await getOpenfort().contracts.list({
908
953
  limit: c.options.limit,
909
954
  skip: c.options.skip
910
955
  });
@@ -925,11 +970,11 @@ contracts.command("list", {
925
970
  });
926
971
  contracts.command("create", {
927
972
  description: "Register a smart contract.",
928
- options: z4.object({
929
- name: z4.string().describe("Contract name"),
930
- address: z4.string().describe("Contract address"),
931
- chainId: z4.number().describe("Chain ID"),
932
- abi: z4.string().optional().describe("Contract ABI as JSON string")
973
+ options: z3.object({
974
+ name: z3.string().describe("Contract name"),
975
+ address: z3.string().describe("Contract address"),
976
+ chainId: z3.number().describe("Chain ID"),
977
+ abi: z3.string().optional().describe("Contract ABI as JSON string")
933
978
  }),
934
979
  output: contractItem,
935
980
  examples: [
@@ -943,7 +988,7 @@ contracts.command("create", {
943
988
  }
944
989
  ],
945
990
  async run(c) {
946
- const res = await c.var.openfort.contracts.create({
991
+ const res = await getOpenfort().contracts.create({
947
992
  name: c.options.name,
948
993
  address: c.options.address,
949
994
  chainId: c.options.chainId,
@@ -974,15 +1019,15 @@ contracts.command("create", {
974
1019
  });
975
1020
  contracts.command("get", {
976
1021
  description: "Get a contract by ID.",
977
- args: z4.object({
978
- id: z4.string().describe("Contract ID (con_...)")
1022
+ args: z3.object({
1023
+ id: z3.string().describe("Contract ID (con_...)")
979
1024
  }),
980
1025
  examples: [
981
1026
  { args: { id: "con_1a2b3c4d" }, description: "Get contract details" }
982
1027
  ],
983
1028
  output: contractItem,
984
1029
  async run(c) {
985
- const ct = await c.var.openfort.contracts.get(c.args.id);
1030
+ const ct = await getOpenfort().contracts.get(c.args.id);
986
1031
  return c.ok({
987
1032
  id: ct.id,
988
1033
  createdAt: ct.createdAt,
@@ -997,21 +1042,21 @@ contracts.command("get", {
997
1042
  });
998
1043
  contracts.command("update", {
999
1044
  description: "Update a contract.",
1000
- args: z4.object({
1001
- id: z4.string().describe("Contract ID (con_...)")
1045
+ args: z3.object({
1046
+ id: z3.string().describe("Contract ID (con_...)")
1002
1047
  }),
1003
- options: z4.object({
1004
- name: z4.string().optional().describe("New name"),
1005
- address: z4.string().optional().describe("New address"),
1006
- chainId: z4.number().optional().describe("New chain ID"),
1007
- abi: z4.string().optional().describe("New ABI as JSON string")
1048
+ options: z3.object({
1049
+ name: z3.string().optional().describe("New name"),
1050
+ address: z3.string().optional().describe("New address"),
1051
+ chainId: z3.number().optional().describe("New chain ID"),
1052
+ abi: z3.string().optional().describe("New ABI as JSON string")
1008
1053
  }),
1009
1054
  examples: [
1010
1055
  { args: { id: "con_1a2b3c4d" }, options: { name: "USDC v2" }, description: "Rename a contract" }
1011
1056
  ],
1012
1057
  output: contractItem,
1013
1058
  async run(c) {
1014
- const res = await c.var.openfort.contracts.update(c.args.id, {
1059
+ const res = await getOpenfort().contracts.update(c.args.id, {
1015
1060
  name: c.options.name,
1016
1061
  address: c.options.address,
1017
1062
  chainId: c.options.chainId,
@@ -1031,48 +1076,47 @@ contracts.command("update", {
1031
1076
  });
1032
1077
  contracts.command("delete", {
1033
1078
  description: "Delete a contract.",
1034
- args: z4.object({
1035
- id: z4.string().describe("Contract ID (con_...)")
1079
+ args: z3.object({
1080
+ id: z3.string().describe("Contract ID (con_...)")
1036
1081
  }),
1037
1082
  examples: [
1038
1083
  { args: { id: "con_1a2b3c4d" }, description: "Delete a contract" }
1039
1084
  ],
1040
- output: z4.object({
1041
- id: z4.string(),
1042
- deleted: z4.boolean()
1085
+ output: z3.object({
1086
+ id: z3.string(),
1087
+ deleted: z3.boolean()
1043
1088
  }),
1044
1089
  async run(c) {
1045
- const res = await c.var.openfort.contracts.delete(c.args.id);
1090
+ const res = await getOpenfort().contracts.delete(c.args.id);
1046
1091
  return c.ok({ id: res.id, deleted: res.deleted });
1047
1092
  }
1048
1093
  });
1049
1094
 
1050
1095
  // src/commands/paymasters.ts
1051
- import { Cli as Cli4, z as z5 } from "incur";
1052
- var paymasterItem = z5.object({
1053
- id: z5.string(),
1054
- createdAt: z5.number(),
1055
- address: z5.string(),
1056
- url: z5.string().optional(),
1057
- context: z5.record(z5.string(), z5.unknown()).optional()
1096
+ import { Cli as Cli4, z as z4 } from "incur";
1097
+ var paymasterItem = z4.object({
1098
+ id: z4.string(),
1099
+ createdAt: z4.number(),
1100
+ address: z4.string(),
1101
+ url: z4.string().optional(),
1102
+ context: z4.record(z4.string(), z4.unknown()).optional()
1058
1103
  });
1059
1104
  var paymasters = Cli4.create("paymasters", {
1060
- description: "Manage ERC-4337 paymasters.",
1061
- vars: varsSchema
1105
+ description: "Manage ERC-4337 paymasters."
1062
1106
  });
1063
1107
  paymasters.command("create", {
1064
1108
  description: "Create a paymaster.",
1065
- options: z5.object({
1066
- address: z5.string().describe("Paymaster contract address"),
1067
- name: z5.string().optional().describe("Paymaster name"),
1068
- url: z5.string().optional().describe("Paymaster URL")
1109
+ options: z4.object({
1110
+ address: z4.string().describe("Paymaster contract address"),
1111
+ name: z4.string().optional().describe("Paymaster name"),
1112
+ url: z4.string().optional().describe("Paymaster URL")
1069
1113
  }),
1070
1114
  examples: [
1071
1115
  { options: { address: "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789", name: "EntryPoint v0.6 Paymaster" }, description: "Create a paymaster for ERC-4337 v0.6" }
1072
1116
  ],
1073
1117
  output: paymasterItem,
1074
1118
  async run(c) {
1075
- const res = await c.var.openfort.paymasters.create({
1119
+ const res = await getOpenfort().paymasters.create({
1076
1120
  address: c.options.address,
1077
1121
  name: c.options.name,
1078
1122
  url: c.options.url
@@ -1099,15 +1143,15 @@ paymasters.command("create", {
1099
1143
  });
1100
1144
  paymasters.command("get", {
1101
1145
  description: "Get a paymaster by ID.",
1102
- args: z5.object({
1103
- id: z5.string().describe("Paymaster ID (pay_...)")
1146
+ args: z4.object({
1147
+ id: z4.string().describe("Paymaster ID (pay_...)")
1104
1148
  }),
1105
1149
  examples: [
1106
1150
  { args: { id: "pay_1a2b3c4d" }, description: "Get paymaster details" }
1107
1151
  ],
1108
1152
  output: paymasterItem,
1109
1153
  async run(c) {
1110
- const p = await c.var.openfort.paymasters.get(c.args.id);
1154
+ const p = await getOpenfort().paymasters.get(c.args.id);
1111
1155
  return c.ok({
1112
1156
  id: p.id,
1113
1157
  createdAt: p.createdAt,
@@ -1119,20 +1163,20 @@ paymasters.command("get", {
1119
1163
  });
1120
1164
  paymasters.command("update", {
1121
1165
  description: "Update a paymaster.",
1122
- args: z5.object({
1123
- id: z5.string().describe("Paymaster ID (pay_...)")
1166
+ args: z4.object({
1167
+ id: z4.string().describe("Paymaster ID (pay_...)")
1124
1168
  }),
1125
- options: z5.object({
1126
- address: z5.string().describe("Paymaster address"),
1127
- name: z5.string().optional().describe("New name"),
1128
- url: z5.string().optional().describe("New URL")
1169
+ options: z4.object({
1170
+ address: z4.string().describe("Paymaster address"),
1171
+ name: z4.string().optional().describe("New name"),
1172
+ url: z4.string().optional().describe("New URL")
1129
1173
  }),
1130
1174
  examples: [
1131
1175
  { args: { id: "pay_1a2b3c4d" }, options: { address: "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789", name: "Updated Paymaster" }, description: "Update paymaster name" }
1132
1176
  ],
1133
1177
  output: paymasterItem,
1134
1178
  async run(c) {
1135
- const res = await c.var.openfort.paymasters.update(c.args.id, {
1179
+ const res = await getOpenfort().paymasters.update(c.args.id, {
1136
1180
  address: c.options.address,
1137
1181
  name: c.options.name,
1138
1182
  url: c.options.url
@@ -1148,57 +1192,56 @@ paymasters.command("update", {
1148
1192
  });
1149
1193
  paymasters.command("delete", {
1150
1194
  description: "Delete a paymaster.",
1151
- args: z5.object({
1152
- id: z5.string().describe("Paymaster ID (pay_...)")
1195
+ args: z4.object({
1196
+ id: z4.string().describe("Paymaster ID (pay_...)")
1153
1197
  }),
1154
1198
  examples: [
1155
1199
  { args: { id: "pay_1a2b3c4d" }, description: "Delete a paymaster" }
1156
1200
  ],
1157
- output: z5.object({
1158
- id: z5.string(),
1159
- deleted: z5.boolean()
1201
+ output: z4.object({
1202
+ id: z4.string(),
1203
+ deleted: z4.boolean()
1160
1204
  }),
1161
1205
  async run(c) {
1162
- const res = await c.var.openfort.paymasters.delete(c.args.id);
1206
+ const res = await getOpenfort().paymasters.delete(c.args.id);
1163
1207
  return c.ok({ id: res.id, deleted: res.deleted });
1164
1208
  }
1165
1209
  });
1166
1210
 
1167
1211
  // src/commands/policies.ts
1168
- import { Cli as Cli5, z as z6 } from "incur";
1212
+ import { Cli as Cli5, z as z5 } from "incur";
1169
1213
  var policyScopes = ["project", "account", "transaction"];
1170
1214
  var policies = Cli5.create("policies", {
1171
- description: "Manage rules and conditions for backend wallets and fee sponsorship.",
1172
- vars: varsSchema
1215
+ description: "Manage rules and conditions for backend wallets and fee sponsorship."
1173
1216
  });
1174
1217
  policies.command("list", {
1175
1218
  description: "List policies.",
1176
- options: z6.object({
1177
- limit: z6.number().optional().describe("Max results"),
1178
- skip: z6.number().optional().describe("Offset"),
1179
- scope: z6.enum(policyScopes).optional().describe("Filter by scope"),
1180
- enabled: z6.boolean().optional().describe("Filter by enabled status")
1219
+ options: z5.object({
1220
+ limit: z5.number().optional().describe("Max results"),
1221
+ skip: z5.number().optional().describe("Offset"),
1222
+ scope: z5.enum(policyScopes).optional().describe("Filter by scope"),
1223
+ enabled: z5.boolean().optional().describe("Filter by enabled status")
1181
1224
  }),
1182
1225
  alias: { limit: "l" },
1183
1226
  examples: [
1184
1227
  { description: "List all policies" },
1185
1228
  { options: { scope: "project", enabled: true }, description: "List enabled project-scope policies" }
1186
1229
  ],
1187
- output: z6.object({
1188
- data: z6.array(z6.object({
1189
- id: z6.string(),
1190
- createdAt: z6.number(),
1191
- scope: z6.string(),
1192
- description: z6.string().nullable(),
1193
- accountId: z6.string().nullable(),
1194
- enabled: z6.boolean(),
1195
- priority: z6.number()
1230
+ output: z5.object({
1231
+ data: z5.array(z5.object({
1232
+ id: z5.string(),
1233
+ createdAt: z5.number(),
1234
+ scope: z5.string(),
1235
+ description: z5.string().nullable(),
1236
+ accountId: z5.string().nullable(),
1237
+ enabled: z5.boolean(),
1238
+ priority: z5.number()
1196
1239
  })),
1197
- total: z6.number()
1240
+ total: z5.number()
1198
1241
  }),
1199
1242
  async run(c) {
1200
1243
  const scopeFilter = c.options.scope ? [c.options.scope] : void 0;
1201
- const res = await c.var.openfort.policies.list({
1244
+ const res = await getOpenfort().policies.list({
1202
1245
  limit: c.options.limit,
1203
1246
  skip: c.options.skip,
1204
1247
  scope: scopeFilter,
@@ -1220,19 +1263,19 @@ policies.command("list", {
1220
1263
  });
1221
1264
  policies.command("create", {
1222
1265
  description: "Create a policy with criteria-based rules.",
1223
- options: z6.object({
1224
- scope: z6.enum(policyScopes).describe("Policy scope"),
1225
- description: z6.string().optional().describe("Policy description"),
1226
- priority: z6.number().optional().describe("Priority (higher = evaluated first)"),
1227
- rules: z6.string().describe("Rules as JSON string")
1266
+ options: z5.object({
1267
+ scope: z5.enum(policyScopes).describe("Policy scope"),
1268
+ description: z5.string().optional().describe("Policy description"),
1269
+ priority: z5.number().optional().describe("Priority (higher = evaluated first)"),
1270
+ rules: z5.string().describe("Rules as JSON string")
1228
1271
  }),
1229
- output: z6.object({
1230
- id: z6.string(),
1231
- createdAt: z6.number(),
1232
- scope: z6.string(),
1233
- description: z6.string().nullable(),
1234
- enabled: z6.boolean(),
1235
- priority: z6.number()
1272
+ output: z5.object({
1273
+ id: z5.string(),
1274
+ createdAt: z5.number(),
1275
+ scope: z5.string(),
1276
+ description: z5.string().nullable(),
1277
+ enabled: z5.boolean(),
1278
+ priority: z5.number()
1236
1279
  }),
1237
1280
  examples: [
1238
1281
  {
@@ -1254,7 +1297,7 @@ policies.command("create", {
1254
1297
  async run(c) {
1255
1298
  const rules = JSON.parse(c.options.rules);
1256
1299
  const scope = c.options.scope;
1257
- const res = await c.var.openfort.policies.create({
1300
+ const res = await getOpenfort().policies.create({
1258
1301
  scope,
1259
1302
  description: c.options.description,
1260
1303
  priority: c.options.priority,
@@ -1283,24 +1326,24 @@ policies.command("create", {
1283
1326
  });
1284
1327
  policies.command("get", {
1285
1328
  description: "Get a policy by ID.",
1286
- args: z6.object({
1287
- id: z6.string().describe("Policy ID (ply_...)")
1329
+ args: z5.object({
1330
+ id: z5.string().describe("Policy ID (ply_...)")
1288
1331
  }),
1289
1332
  examples: [
1290
1333
  { args: { id: "ply_1a2b3c4d" }, description: "Get policy details with rules" }
1291
1334
  ],
1292
- output: z6.object({
1293
- id: z6.string(),
1294
- createdAt: z6.number(),
1295
- scope: z6.string(),
1296
- description: z6.string().nullable(),
1297
- accountId: z6.string().nullable(),
1298
- enabled: z6.boolean(),
1299
- priority: z6.number(),
1300
- rules: z6.array(z6.record(z6.string(), z6.unknown()))
1335
+ output: z5.object({
1336
+ id: z5.string(),
1337
+ createdAt: z5.number(),
1338
+ scope: z5.string(),
1339
+ description: z5.string().nullable(),
1340
+ accountId: z5.string().nullable(),
1341
+ enabled: z5.boolean(),
1342
+ priority: z5.number(),
1343
+ rules: z5.array(z5.record(z5.string(), z5.unknown()))
1301
1344
  }),
1302
1345
  async run(c) {
1303
- const p = await c.var.openfort.policies.get(c.args.id);
1346
+ const p = await getOpenfort().policies.get(c.args.id);
1304
1347
  return c.ok({
1305
1348
  id: p.id,
1306
1349
  createdAt: p.createdAt,
@@ -1315,29 +1358,29 @@ policies.command("get", {
1315
1358
  });
1316
1359
  policies.command("update", {
1317
1360
  description: "Update a policy.",
1318
- args: z6.object({
1319
- id: z6.string().describe("Policy ID (ply_...)")
1361
+ args: z5.object({
1362
+ id: z5.string().describe("Policy ID (ply_...)")
1320
1363
  }),
1321
- options: z6.object({
1322
- description: z6.string().optional().describe("New description"),
1323
- enabled: z6.boolean().optional().describe("Enable or disable"),
1324
- priority: z6.number().optional().describe("New priority"),
1325
- rules: z6.string().optional().describe("New rules as JSON string")
1364
+ options: z5.object({
1365
+ description: z5.string().optional().describe("New description"),
1366
+ enabled: z5.boolean().optional().describe("Enable or disable"),
1367
+ priority: z5.number().optional().describe("New priority"),
1368
+ rules: z5.string().optional().describe("New rules as JSON string")
1326
1369
  }),
1327
1370
  examples: [
1328
1371
  { args: { id: "ply_1a2b3c4d" }, options: { enabled: false }, description: "Disable a policy" },
1329
1372
  { args: { id: "ply_1a2b3c4d" }, options: { priority: 10 }, description: "Change policy priority" }
1330
1373
  ],
1331
- output: z6.object({
1332
- id: z6.string(),
1333
- createdAt: z6.number(),
1334
- scope: z6.string(),
1335
- description: z6.string().nullable(),
1336
- enabled: z6.boolean(),
1337
- priority: z6.number()
1374
+ output: z5.object({
1375
+ id: z5.string(),
1376
+ createdAt: z5.number(),
1377
+ scope: z5.string(),
1378
+ description: z5.string().nullable(),
1379
+ enabled: z5.boolean(),
1380
+ priority: z5.number()
1338
1381
  }),
1339
1382
  async run(c) {
1340
- const res = await c.var.openfort.policies.update(c.args.id, {
1383
+ const res = await getOpenfort().policies.update(c.args.id, {
1341
1384
  description: c.options.description,
1342
1385
  enabled: c.options.enabled,
1343
1386
  priority: c.options.priority,
@@ -1355,41 +1398,41 @@ policies.command("update", {
1355
1398
  });
1356
1399
  policies.command("delete", {
1357
1400
  description: "Delete a policy.",
1358
- args: z6.object({
1359
- id: z6.string().describe("Policy ID (ply_...)")
1401
+ args: z5.object({
1402
+ id: z5.string().describe("Policy ID (ply_...)")
1360
1403
  }),
1361
1404
  examples: [
1362
1405
  { args: { id: "ply_1a2b3c4d" }, description: "Delete a policy" }
1363
1406
  ],
1364
- output: z6.object({
1365
- id: z6.string(),
1366
- deleted: z6.boolean()
1407
+ output: z5.object({
1408
+ id: z5.string(),
1409
+ deleted: z5.boolean()
1367
1410
  }),
1368
1411
  async run(c) {
1369
- const res = await c.var.openfort.policies.delete(c.args.id);
1412
+ const res = await getOpenfort().policies.delete(c.args.id);
1370
1413
  return c.ok({ id: res.id, deleted: res.deleted });
1371
1414
  }
1372
1415
  });
1373
1416
  policies.command("evaluate", {
1374
1417
  description: "Pre-flight check if an operation would be allowed.",
1375
- options: z6.object({
1376
- operation: z6.string().describe("Operation to evaluate (e.g. signEvmTransaction)"),
1377
- accountId: z6.string().optional().describe("Account ID")
1418
+ options: z5.object({
1419
+ operation: z5.string().describe("Operation to evaluate (e.g. signEvmTransaction)"),
1420
+ accountId: z5.string().optional().describe("Account ID")
1378
1421
  }),
1379
1422
  examples: [
1380
1423
  { options: { operation: "signEvmTransaction", accountId: "acc_1a2b3c4d" }, description: "Check if EVM signing is allowed" },
1381
1424
  { options: { operation: "sponsorEvmTransaction" }, description: "Check if gas sponsorship is allowed" }
1382
1425
  ],
1383
- output: z6.object({
1384
- allowed: z6.boolean(),
1385
- reason: z6.string(),
1386
- operation: z6.string(),
1387
- accountId: z6.string().optional(),
1388
- matchedPolicyId: z6.string().optional(),
1389
- matchedRuleId: z6.string().optional()
1426
+ output: z5.object({
1427
+ allowed: z5.boolean(),
1428
+ reason: z5.string(),
1429
+ operation: z5.string(),
1430
+ accountId: z5.string().optional(),
1431
+ matchedPolicyId: z5.string().optional(),
1432
+ matchedRuleId: z5.string().optional()
1390
1433
  }),
1391
1434
  async run(c) {
1392
- const res = await c.var.openfort.policies.evaluate({
1435
+ const res = await getOpenfort().policies.evaluate({
1393
1436
  operation: c.options.operation,
1394
1437
  accountId: c.options.accountId
1395
1438
  });
@@ -1405,45 +1448,44 @@ policies.command("evaluate", {
1405
1448
  });
1406
1449
 
1407
1450
  // src/commands/sponsorship.ts
1408
- import { Cli as Cli6, z as z7 } from "incur";
1451
+ import { Cli as Cli6, z as z6 } from "incur";
1409
1452
  var sponsorSchemas = ["pay_for_user", "charge_custom_tokens", "fixed_rate"];
1410
- var sponsorshipItem = z7.object({
1411
- id: z7.string(),
1412
- createdAt: z7.number(),
1413
- name: z7.string().nullable(),
1414
- chainId: z7.number().nullable(),
1415
- enabled: z7.boolean(),
1416
- strategy: z7.object({
1417
- sponsorSchema: z7.string(),
1418
- tokenContract: z7.string().optional(),
1419
- tokenContractAmount: z7.string().optional(),
1420
- dynamicExchangeRate: z7.boolean().optional()
1421
- }),
1422
- paymasterId: z7.string().nullable(),
1423
- policyId: z7.string().nullable()
1453
+ var sponsorshipItem = z6.object({
1454
+ id: z6.string(),
1455
+ createdAt: z6.number(),
1456
+ name: z6.string().nullable(),
1457
+ chainId: z6.number().nullable(),
1458
+ enabled: z6.boolean(),
1459
+ strategy: z6.object({
1460
+ sponsorSchema: z6.string(),
1461
+ tokenContract: z6.string().optional(),
1462
+ tokenContractAmount: z6.string().optional(),
1463
+ dynamicExchangeRate: z6.boolean().optional()
1464
+ }),
1465
+ paymasterId: z6.string().nullable(),
1466
+ policyId: z6.string().nullable()
1424
1467
  });
1425
1468
  var sponsorship = Cli6.create("sponsorship", {
1426
- description: "Manage fee sponsorship strategies linked to policies.",
1427
- vars: varsSchema
1469
+ description: "Manage fee sponsorship strategies linked to policies."
1428
1470
  });
1429
1471
  sponsorship.command("list", {
1430
1472
  description: "List fee sponsorships.",
1431
- options: z7.object({
1432
- limit: z7.number().optional().describe("Max results"),
1433
- skip: z7.number().optional().describe("Offset"),
1434
- enabled: z7.boolean().optional().describe("Filter by enabled status")
1473
+ options: z6.object({
1474
+ limit: z6.number().optional().describe("Max results"),
1475
+ skip: z6.number().optional().describe("Offset"),
1476
+ enabled: z6.boolean().optional().describe("Filter by enabled status")
1435
1477
  }),
1436
1478
  alias: { limit: "l" },
1437
1479
  examples: [
1438
1480
  { description: "List all sponsorships" },
1439
1481
  { options: { enabled: true }, description: "List active sponsorships only" }
1440
1482
  ],
1441
- output: z7.object({
1442
- data: z7.array(sponsorshipItem),
1443
- total: z7.number()
1483
+ output: z6.object({
1484
+ data: z6.array(sponsorshipItem),
1485
+ total: z6.number()
1444
1486
  }),
1445
1487
  async run(c) {
1446
- const res = await c.var.openfort.feeSponsorship.list({
1488
+ const res = await getOpenfort().feeSponsorship.list({
1447
1489
  limit: c.options.limit,
1448
1490
  skip: c.options.skip,
1449
1491
  enabled: c.options.enabled
@@ -1465,11 +1507,11 @@ sponsorship.command("list", {
1465
1507
  });
1466
1508
  sponsorship.command("create", {
1467
1509
  description: "Create a fee sponsorship linked to a policy.",
1468
- options: z7.object({
1469
- policyId: z7.string().describe("Policy ID to link (ply_...)"),
1470
- name: z7.string().optional().describe("Sponsorship name"),
1471
- strategy: z7.enum(sponsorSchemas).default("pay_for_user").describe("Sponsorship strategy"),
1472
- chainId: z7.number().optional().describe("Chain ID")
1510
+ options: z6.object({
1511
+ policyId: z6.string().describe("Policy ID to link (ply_...)"),
1512
+ name: z6.string().optional().describe("Sponsorship name"),
1513
+ strategy: z6.enum(sponsorSchemas).default("pay_for_user").describe("Sponsorship strategy"),
1514
+ chainId: z6.number().optional().describe("Chain ID")
1473
1515
  }),
1474
1516
  output: sponsorshipItem,
1475
1517
  examples: [
@@ -1484,7 +1526,7 @@ sponsorship.command("create", {
1484
1526
  ],
1485
1527
  async run(c) {
1486
1528
  const strategy = { sponsorSchema: c.options.strategy };
1487
- const res = await c.var.openfort.feeSponsorship.create({
1529
+ const res = await getOpenfort().feeSponsorship.create({
1488
1530
  policyId: c.options.policyId,
1489
1531
  name: c.options.name,
1490
1532
  strategy,
@@ -1515,15 +1557,15 @@ sponsorship.command("create", {
1515
1557
  });
1516
1558
  sponsorship.command("get", {
1517
1559
  description: "Get a fee sponsorship by ID.",
1518
- args: z7.object({
1519
- id: z7.string().describe("Fee sponsorship ID (pol_...)")
1560
+ args: z6.object({
1561
+ id: z6.string().describe("Fee sponsorship ID (pol_...)")
1520
1562
  }),
1521
1563
  examples: [
1522
1564
  { args: { id: "pol_1a2b3c4d" }, description: "Get sponsorship details" }
1523
1565
  ],
1524
1566
  output: sponsorshipItem,
1525
1567
  async run(c) {
1526
- const s = await c.var.openfort.feeSponsorship.get(c.args.id);
1568
+ const s = await getOpenfort().feeSponsorship.get(c.args.id);
1527
1569
  return c.ok({
1528
1570
  id: s.id,
1529
1571
  createdAt: s.createdAt,
@@ -1538,13 +1580,13 @@ sponsorship.command("get", {
1538
1580
  });
1539
1581
  sponsorship.command("update", {
1540
1582
  description: "Update a fee sponsorship.",
1541
- args: z7.object({
1542
- id: z7.string().describe("Fee sponsorship ID (pol_...)")
1583
+ args: z6.object({
1584
+ id: z6.string().describe("Fee sponsorship ID (pol_...)")
1543
1585
  }),
1544
- options: z7.object({
1545
- name: z7.string().optional().describe("New name"),
1546
- strategy: z7.enum(sponsorSchemas).optional().describe("New strategy"),
1547
- policyId: z7.string().optional().describe("New policy ID")
1586
+ options: z6.object({
1587
+ name: z6.string().optional().describe("New name"),
1588
+ strategy: z6.enum(sponsorSchemas).optional().describe("New strategy"),
1589
+ policyId: z6.string().optional().describe("New policy ID")
1548
1590
  }),
1549
1591
  examples: [
1550
1592
  { args: { id: "pol_1a2b3c4d" }, options: { name: "Mainnet Gas Sponsor" }, description: "Rename a sponsorship" }
@@ -1552,7 +1594,7 @@ sponsorship.command("update", {
1552
1594
  output: sponsorshipItem,
1553
1595
  async run(c) {
1554
1596
  const strategy = c.options.strategy ? { sponsorSchema: c.options.strategy } : void 0;
1555
- const res = await c.var.openfort.feeSponsorship.update(c.args.id, {
1597
+ const res = await getOpenfort().feeSponsorship.update(c.args.id, {
1556
1598
  name: c.options.name,
1557
1599
  strategy,
1558
1600
  policyId: c.options.policyId
@@ -1571,15 +1613,15 @@ sponsorship.command("update", {
1571
1613
  });
1572
1614
  sponsorship.command("enable", {
1573
1615
  description: "Enable a fee sponsorship.",
1574
- args: z7.object({
1575
- id: z7.string().describe("Fee sponsorship ID (pol_...)")
1616
+ args: z6.object({
1617
+ id: z6.string().describe("Fee sponsorship ID (pol_...)")
1576
1618
  }),
1577
1619
  examples: [
1578
1620
  { args: { id: "pol_1a2b3c4d" }, description: "Enable a sponsorship" }
1579
1621
  ],
1580
1622
  output: sponsorshipItem,
1581
1623
  async run(c) {
1582
- const res = await c.var.openfort.feeSponsorship.enable(c.args.id);
1624
+ const res = await getOpenfort().feeSponsorship.enable(c.args.id);
1583
1625
  return c.ok({
1584
1626
  id: res.id,
1585
1627
  createdAt: res.createdAt,
@@ -1594,15 +1636,15 @@ sponsorship.command("enable", {
1594
1636
  });
1595
1637
  sponsorship.command("disable", {
1596
1638
  description: "Disable a fee sponsorship.",
1597
- args: z7.object({
1598
- id: z7.string().describe("Fee sponsorship ID (pol_...)")
1639
+ args: z6.object({
1640
+ id: z6.string().describe("Fee sponsorship ID (pol_...)")
1599
1641
  }),
1600
1642
  examples: [
1601
1643
  { args: { id: "pol_1a2b3c4d" }, description: "Disable a sponsorship" }
1602
1644
  ],
1603
1645
  output: sponsorshipItem,
1604
1646
  async run(c) {
1605
- const res = await c.var.openfort.feeSponsorship.disable(c.args.id);
1647
+ const res = await getOpenfort().feeSponsorship.disable(c.args.id);
1606
1648
  return c.ok({
1607
1649
  id: res.id,
1608
1650
  createdAt: res.createdAt,
@@ -1617,24 +1659,24 @@ sponsorship.command("disable", {
1617
1659
  });
1618
1660
  sponsorship.command("delete", {
1619
1661
  description: "Delete a fee sponsorship.",
1620
- args: z7.object({
1621
- id: z7.string().describe("Fee sponsorship ID (pol_...)")
1662
+ args: z6.object({
1663
+ id: z6.string().describe("Fee sponsorship ID (pol_...)")
1622
1664
  }),
1623
1665
  examples: [
1624
1666
  { args: { id: "pol_1a2b3c4d" }, description: "Delete a sponsorship" }
1625
1667
  ],
1626
- output: z7.object({
1627
- id: z7.string(),
1628
- deleted: z7.boolean()
1668
+ output: z6.object({
1669
+ id: z6.string(),
1670
+ deleted: z6.boolean()
1629
1671
  }),
1630
1672
  async run(c) {
1631
- const res = await c.var.openfort.feeSponsorship.delete(c.args.id);
1673
+ const res = await getOpenfort().feeSponsorship.delete(c.args.id);
1632
1674
  return c.ok({ id: res.id, deleted: res.deleted });
1633
1675
  }
1634
1676
  });
1635
1677
 
1636
1678
  // src/commands/subscriptions.ts
1637
- import { Cli as Cli7, z as z8 } from "incur";
1679
+ import { Cli as Cli7, z as z7 } from "incur";
1638
1680
  var apiTopics = [
1639
1681
  "transaction_intent.broadcast",
1640
1682
  "transaction_intent.successful",
@@ -1651,27 +1693,26 @@ var apiTopics = [
1651
1693
  ];
1652
1694
  var apiTriggerTypes = ["webhook", "email"];
1653
1695
  var triggers = Cli7.create("triggers", {
1654
- description: "Manage subscription triggers.",
1655
- vars: varsSchema
1696
+ description: "Manage subscription triggers."
1656
1697
  });
1657
1698
  triggers.command("list", {
1658
1699
  description: "List triggers for a subscription.",
1659
- args: z8.object({
1660
- subscriptionId: z8.string().describe("Subscription ID (sub_...)")
1700
+ args: z7.object({
1701
+ subscriptionId: z7.string().describe("Subscription ID (sub_...)")
1661
1702
  }),
1662
1703
  examples: [
1663
1704
  { args: { subscriptionId: "sub_1a2b3c4d" }, description: "List triggers" }
1664
1705
  ],
1665
- output: z8.object({
1666
- data: z8.array(z8.object({
1667
- id: z8.string(),
1668
- createdAt: z8.number(),
1669
- target: z8.string(),
1670
- type: z8.string()
1706
+ output: z7.object({
1707
+ data: z7.array(z7.object({
1708
+ id: z7.string(),
1709
+ createdAt: z7.number(),
1710
+ target: z7.string(),
1711
+ type: z7.string()
1671
1712
  }))
1672
1713
  }),
1673
1714
  async run(c) {
1674
- const res = await c.var.openfort.triggers.list(c.args.subscriptionId);
1715
+ const res = await getOpenfort().triggers.list(c.args.subscriptionId);
1675
1716
  return c.ok({
1676
1717
  data: res.data.map((t) => ({
1677
1718
  id: t.id,
@@ -1684,12 +1725,12 @@ triggers.command("list", {
1684
1725
  });
1685
1726
  triggers.command("create", {
1686
1727
  description: "Create a trigger for a subscription.",
1687
- args: z8.object({
1688
- subscriptionId: z8.string().describe("Subscription ID (sub_...)")
1728
+ args: z7.object({
1729
+ subscriptionId: z7.string().describe("Subscription ID (sub_...)")
1689
1730
  }),
1690
- options: z8.object({
1691
- target: z8.string().describe("Webhook URL or email address"),
1692
- type: z8.enum(apiTriggerTypes).default("webhook").describe("Trigger type: webhook or email")
1731
+ options: z7.object({
1732
+ target: z7.string().describe("Webhook URL or email address"),
1733
+ type: z7.enum(apiTriggerTypes).default("webhook").describe("Trigger type: webhook or email")
1693
1734
  }),
1694
1735
  examples: [
1695
1736
  {
@@ -1698,14 +1739,14 @@ triggers.command("create", {
1698
1739
  description: "Create a webhook trigger"
1699
1740
  }
1700
1741
  ],
1701
- output: z8.object({
1702
- id: z8.string(),
1703
- createdAt: z8.number(),
1704
- target: z8.string(),
1705
- type: z8.string()
1742
+ output: z7.object({
1743
+ id: z7.string(),
1744
+ createdAt: z7.number(),
1745
+ target: z7.string(),
1746
+ type: z7.string()
1706
1747
  }),
1707
1748
  async run(c) {
1708
- const res = await c.var.openfort.triggers.create(c.args.subscriptionId, {
1749
+ const res = await getOpenfort().triggers.create(c.args.subscriptionId, {
1709
1750
  target: c.options.target,
1710
1751
  type: c.options.type
1711
1752
  });
@@ -1719,21 +1760,21 @@ triggers.command("create", {
1719
1760
  });
1720
1761
  triggers.command("get", {
1721
1762
  description: "Get a trigger by ID.",
1722
- args: z8.object({
1723
- subscriptionId: z8.string().describe("Subscription ID (sub_...)"),
1724
- triggerId: z8.string().describe("Trigger ID (tri_...)")
1763
+ args: z7.object({
1764
+ subscriptionId: z7.string().describe("Subscription ID (sub_...)"),
1765
+ triggerId: z7.string().describe("Trigger ID (tri_...)")
1725
1766
  }),
1726
1767
  examples: [
1727
1768
  { args: { subscriptionId: "sub_1a2b3c4d", triggerId: "tri_1a2b3c4d" }, description: "Get trigger details" }
1728
1769
  ],
1729
- output: z8.object({
1730
- id: z8.string(),
1731
- createdAt: z8.number(),
1732
- target: z8.string(),
1733
- type: z8.string()
1770
+ output: z7.object({
1771
+ id: z7.string(),
1772
+ createdAt: z7.number(),
1773
+ target: z7.string(),
1774
+ type: z7.string()
1734
1775
  }),
1735
1776
  async run(c) {
1736
- const t = await c.var.openfort.triggers.get(c.args.subscriptionId, c.args.triggerId);
1777
+ const t = await getOpenfort().triggers.get(c.args.subscriptionId, c.args.triggerId);
1737
1778
  return c.ok({
1738
1779
  id: t.id,
1739
1780
  createdAt: t.createdAt,
@@ -1744,46 +1785,45 @@ triggers.command("get", {
1744
1785
  });
1745
1786
  triggers.command("delete", {
1746
1787
  description: "Delete a trigger.",
1747
- args: z8.object({
1748
- subscriptionId: z8.string().describe("Subscription ID (sub_...)"),
1749
- triggerId: z8.string().describe("Trigger ID (tri_...)")
1788
+ args: z7.object({
1789
+ subscriptionId: z7.string().describe("Subscription ID (sub_...)"),
1790
+ triggerId: z7.string().describe("Trigger ID (tri_...)")
1750
1791
  }),
1751
1792
  examples: [
1752
1793
  { args: { subscriptionId: "sub_1a2b3c4d", triggerId: "tri_1a2b3c4d" }, description: "Delete a trigger" }
1753
1794
  ],
1754
- output: z8.object({
1755
- id: z8.string(),
1756
- deleted: z8.boolean()
1795
+ output: z7.object({
1796
+ id: z7.string(),
1797
+ deleted: z7.boolean()
1757
1798
  }),
1758
1799
  async run(c) {
1759
- const res = await c.var.openfort.triggers.delete(c.args.subscriptionId, c.args.triggerId);
1800
+ const res = await getOpenfort().triggers.delete(c.args.subscriptionId, c.args.triggerId);
1760
1801
  return c.ok({ id: res.id, deleted: res.deleted });
1761
1802
  }
1762
1803
  });
1763
1804
  var subscriptions = Cli7.create("subscriptions", {
1764
- description: "Manage webhook subscriptions.",
1765
- vars: varsSchema
1805
+ description: "Manage webhook subscriptions."
1766
1806
  });
1767
1807
  subscriptions.command("list", {
1768
1808
  description: "List webhook subscriptions.",
1769
1809
  examples: [
1770
1810
  { description: "List all subscriptions" }
1771
1811
  ],
1772
- output: z8.object({
1773
- data: z8.array(z8.object({
1774
- id: z8.string(),
1775
- createdAt: z8.number(),
1776
- topic: z8.string(),
1777
- triggers: z8.array(z8.object({
1778
- id: z8.string(),
1779
- target: z8.string(),
1780
- type: z8.string()
1812
+ output: z7.object({
1813
+ data: z7.array(z7.object({
1814
+ id: z7.string(),
1815
+ createdAt: z7.number(),
1816
+ topic: z7.string(),
1817
+ triggers: z7.array(z7.object({
1818
+ id: z7.string(),
1819
+ target: z7.string(),
1820
+ type: z7.string()
1781
1821
  }))
1782
1822
  })),
1783
- total: z8.number()
1823
+ total: z7.number()
1784
1824
  }),
1785
1825
  async run(c) {
1786
- const res = await c.var.openfort.subscriptions.list();
1826
+ const res = await getOpenfort().subscriptions.list();
1787
1827
  return c.ok({
1788
1828
  data: res.data.map((s) => ({
1789
1829
  id: s.id,
@@ -1797,9 +1837,9 @@ subscriptions.command("list", {
1797
1837
  });
1798
1838
  subscriptions.command("create", {
1799
1839
  description: "Create a webhook subscription.",
1800
- options: z8.object({
1801
- topic: z8.enum(apiTopics).describe("Event topic (e.g. transaction_intent.successful, user.created)"),
1802
- triggers: z8.string().describe('Triggers as JSON: [{"type":"webhook","target":"https://..."}]')
1840
+ options: z7.object({
1841
+ topic: z7.enum(apiTopics).describe("Event topic (e.g. transaction_intent.successful, user.created)"),
1842
+ triggers: z7.string().describe('Triggers as JSON: [{"type":"webhook","target":"https://..."}]')
1803
1843
  }),
1804
1844
  examples: [
1805
1845
  {
@@ -1810,19 +1850,19 @@ subscriptions.command("create", {
1810
1850
  description: "Get notified when transactions succeed"
1811
1851
  }
1812
1852
  ],
1813
- output: z8.object({
1814
- id: z8.string(),
1815
- createdAt: z8.number(),
1816
- topic: z8.string(),
1817
- triggers: z8.array(z8.object({
1818
- id: z8.string(),
1819
- target: z8.string(),
1820
- type: z8.string()
1853
+ output: z7.object({
1854
+ id: z7.string(),
1855
+ createdAt: z7.number(),
1856
+ topic: z7.string(),
1857
+ triggers: z7.array(z7.object({
1858
+ id: z7.string(),
1859
+ target: z7.string(),
1860
+ type: z7.string()
1821
1861
  }))
1822
1862
  }),
1823
1863
  async run(c) {
1824
1864
  const parsedTriggers = JSON.parse(c.options.triggers);
1825
- const res = await c.var.openfort.subscriptions.create({
1865
+ const res = await getOpenfort().subscriptions.create({
1826
1866
  topic: c.options.topic,
1827
1867
  triggers: parsedTriggers
1828
1868
  });
@@ -1847,24 +1887,24 @@ subscriptions.command("create", {
1847
1887
  });
1848
1888
  subscriptions.command("get", {
1849
1889
  description: "Get a subscription by ID.",
1850
- args: z8.object({
1851
- id: z8.string().describe("Subscription ID (sub_...)")
1890
+ args: z7.object({
1891
+ id: z7.string().describe("Subscription ID (sub_...)")
1852
1892
  }),
1853
1893
  examples: [
1854
1894
  { args: { id: "sub_1a2b3c4d" }, description: "Get subscription details" }
1855
1895
  ],
1856
- output: z8.object({
1857
- id: z8.string(),
1858
- createdAt: z8.number(),
1859
- topic: z8.string(),
1860
- triggers: z8.array(z8.object({
1861
- id: z8.string(),
1862
- target: z8.string(),
1863
- type: z8.string()
1896
+ output: z7.object({
1897
+ id: z7.string(),
1898
+ createdAt: z7.number(),
1899
+ topic: z7.string(),
1900
+ triggers: z7.array(z7.object({
1901
+ id: z7.string(),
1902
+ target: z7.string(),
1903
+ type: z7.string()
1864
1904
  }))
1865
1905
  }),
1866
1906
  async run(c) {
1867
- const s = await c.var.openfort.subscriptions.get(c.args.id);
1907
+ const s = await getOpenfort().subscriptions.get(c.args.id);
1868
1908
  return c.ok({
1869
1909
  id: s.id,
1870
1910
  createdAt: s.createdAt,
@@ -1875,65 +1915,64 @@ subscriptions.command("get", {
1875
1915
  });
1876
1916
  subscriptions.command("delete", {
1877
1917
  description: "Delete a subscription.",
1878
- args: z8.object({
1879
- id: z8.string().describe("Subscription ID (sub_...)")
1918
+ args: z7.object({
1919
+ id: z7.string().describe("Subscription ID (sub_...)")
1880
1920
  }),
1881
1921
  examples: [
1882
1922
  { args: { id: "sub_1a2b3c4d" }, description: "Delete a subscription" }
1883
1923
  ],
1884
- output: z8.object({
1885
- id: z8.string(),
1886
- deleted: z8.boolean()
1924
+ output: z7.object({
1925
+ id: z7.string(),
1926
+ deleted: z7.boolean()
1887
1927
  }),
1888
1928
  async run(c) {
1889
- const res = await c.var.openfort.subscriptions.delete(c.args.id);
1929
+ const res = await getOpenfort().subscriptions.delete(c.args.id);
1890
1930
  return c.ok({ id: res.id, deleted: res.deleted });
1891
1931
  }
1892
1932
  });
1893
1933
  subscriptions.command(triggers);
1894
1934
 
1895
1935
  // src/commands/sessions.ts
1896
- import { Cli as Cli8, z as z9 } from "incur";
1897
- var sessionItem = z9.object({
1898
- id: z9.string(),
1899
- createdAt: z9.number(),
1900
- updatedAt: z9.number(),
1901
- address: z9.string(),
1902
- validAfter: z9.string(),
1903
- validUntil: z9.string(),
1904
- whitelist: z9.array(z9.string()).optional(),
1905
- isActive: z9.boolean(),
1906
- nextAction: z9.object({
1907
- type: z9.string(),
1908
- payload: z9.record(z9.string(), z9.unknown()).optional()
1936
+ import { Cli as Cli8, z as z8 } from "incur";
1937
+ var sessionItem = z8.object({
1938
+ id: z8.string(),
1939
+ createdAt: z8.number(),
1940
+ updatedAt: z8.number(),
1941
+ address: z8.string(),
1942
+ validAfter: z8.string(),
1943
+ validUntil: z8.string(),
1944
+ whitelist: z8.array(z8.string()).optional(),
1945
+ isActive: z8.boolean(),
1946
+ nextAction: z8.object({
1947
+ type: z8.string(),
1948
+ payload: z8.record(z8.string(), z8.unknown()).optional()
1909
1949
  }).optional()
1910
1950
  });
1911
1951
  var sessions = Cli8.create("sessions", {
1912
- description: "Manage session keys.",
1913
- vars: varsSchema
1952
+ description: "Manage session keys."
1914
1953
  });
1915
1954
  sessions.command("list", {
1916
1955
  description: "List session keys for a player.",
1917
- options: z9.object({
1918
- player: z9.string().describe("Player ID (pla_...)"),
1919
- limit: z9.number().optional().describe("Max results"),
1920
- skip: z9.number().optional().describe("Offset")
1956
+ options: z8.object({
1957
+ player: z8.string().describe("Player ID (pla_...)"),
1958
+ limit: z8.number().optional().describe("Max results"),
1959
+ skip: z8.number().optional().describe("Offset")
1921
1960
  }),
1922
1961
  alias: { limit: "l" },
1923
1962
  examples: [
1924
1963
  { options: { player: "pla_1a2b3c4d" }, description: "List sessions for a player" }
1925
1964
  ],
1926
- output: z9.object({
1927
- data: z9.array(z9.object({
1928
- id: z9.string(),
1929
- createdAt: z9.number(),
1930
- address: z9.string(),
1931
- isActive: z9.boolean()
1965
+ output: z8.object({
1966
+ data: z8.array(z8.object({
1967
+ id: z8.string(),
1968
+ createdAt: z8.number(),
1969
+ address: z8.string(),
1970
+ isActive: z8.boolean()
1932
1971
  })),
1933
- total: z9.number()
1972
+ total: z8.number()
1934
1973
  }),
1935
1974
  async run(c) {
1936
- const res = await c.var.openfort.sessions.list({
1975
+ const res = await getOpenfort().sessions.list({
1937
1976
  player: c.options.player,
1938
1977
  limit: c.options.limit,
1939
1978
  skip: c.options.skip
@@ -1951,16 +1990,16 @@ sessions.command("list", {
1951
1990
  });
1952
1991
  sessions.command("create", {
1953
1992
  description: "Create a session key.",
1954
- options: z9.object({
1955
- address: z9.string().describe("Session key address"),
1956
- chainId: z9.number().describe("Chain ID"),
1957
- validAfter: z9.number().describe("Valid after (unix timestamp in seconds)"),
1958
- validUntil: z9.number().describe("Valid until (unix timestamp in seconds)"),
1959
- player: z9.string().optional().describe("Player ID (pla_...)"),
1960
- account: z9.string().optional().describe("Account ID (acc_...)"),
1961
- limit: z9.number().optional().describe("Max session uses"),
1962
- policy: z9.string().optional().describe("Fee sponsorship ID (pol_...)"),
1963
- whitelist: z9.string().optional().describe("Whitelisted contract addresses as JSON array")
1993
+ options: z8.object({
1994
+ address: z8.string().describe("Session key address"),
1995
+ chainId: z8.number().describe("Chain ID"),
1996
+ validAfter: z8.number().describe("Valid after (unix timestamp in seconds)"),
1997
+ validUntil: z8.number().describe("Valid until (unix timestamp in seconds)"),
1998
+ player: z8.string().optional().describe("Player ID (pla_...)"),
1999
+ account: z8.string().optional().describe("Account ID (acc_...)"),
2000
+ limit: z8.number().optional().describe("Max session uses"),
2001
+ policy: z8.string().optional().describe("Fee sponsorship ID (pol_...)"),
2002
+ whitelist: z8.string().optional().describe("Whitelisted contract addresses as JSON array")
1964
2003
  }),
1965
2004
  examples: [
1966
2005
  {
@@ -1976,7 +2015,7 @@ sessions.command("create", {
1976
2015
  ],
1977
2016
  output: sessionItem,
1978
2017
  async run(c) {
1979
- const res = await c.var.openfort.sessions.create({
2018
+ const res = await getOpenfort().sessions.create({
1980
2019
  address: c.options.address,
1981
2020
  chainId: c.options.chainId,
1982
2021
  validAfter: c.options.validAfter,
@@ -2012,15 +2051,15 @@ sessions.command("create", {
2012
2051
  });
2013
2052
  sessions.command("get", {
2014
2053
  description: "Get a session key by ID.",
2015
- args: z9.object({
2016
- id: z9.string().describe("Session ID (ses_...)")
2054
+ args: z8.object({
2055
+ id: z8.string().describe("Session ID (ses_...)")
2017
2056
  }),
2018
2057
  examples: [
2019
2058
  { args: { id: "ses_1a2b3c4d" }, description: "Get session details" }
2020
2059
  ],
2021
2060
  output: sessionItem,
2022
2061
  async run(c) {
2023
- const s = await c.var.openfort.sessions.get(c.args.id);
2062
+ const s = await getOpenfort().sessions.get(c.args.id);
2024
2063
  return c.ok({
2025
2064
  id: s.id,
2026
2065
  createdAt: s.createdAt,
@@ -2036,18 +2075,18 @@ sessions.command("get", {
2036
2075
  });
2037
2076
  sessions.command("revoke", {
2038
2077
  description: "Revoke a session key.",
2039
- options: z9.object({
2040
- address: z9.string().describe("Session key address to revoke"),
2041
- chainId: z9.number().describe("Chain ID"),
2042
- player: z9.string().optional().describe("Player ID (pla_...)"),
2043
- policy: z9.string().optional().describe("Fee sponsorship ID (pol_...)")
2078
+ options: z8.object({
2079
+ address: z8.string().describe("Session key address to revoke"),
2080
+ chainId: z8.number().describe("Chain ID"),
2081
+ player: z8.string().optional().describe("Player ID (pla_...)"),
2082
+ policy: z8.string().optional().describe("Fee sponsorship ID (pol_...)")
2044
2083
  }),
2045
2084
  examples: [
2046
2085
  { options: { address: "0x1234...", chainId: 137 }, description: "Revoke a session key" }
2047
2086
  ],
2048
2087
  output: sessionItem,
2049
2088
  async run(c) {
2050
- const res = await c.var.openfort.sessions.revoke({
2089
+ const res = await getOpenfort().sessions.revoke({
2051
2090
  address: c.options.address,
2052
2091
  chainId: c.options.chainId,
2053
2092
  player: c.options.player,
@@ -2068,19 +2107,19 @@ sessions.command("revoke", {
2068
2107
  });
2069
2108
  sessions.command("sign", {
2070
2109
  description: "Sign and broadcast a session userOperationHash.",
2071
- args: z9.object({
2072
- id: z9.string().describe("Session ID (ses_...)")
2110
+ args: z8.object({
2111
+ id: z8.string().describe("Session ID (ses_...)")
2073
2112
  }),
2074
- options: z9.object({
2075
- signature: z9.string().describe("Hex signature"),
2076
- optimistic: z9.boolean().optional().describe("Return before on-chain confirmation")
2113
+ options: z8.object({
2114
+ signature: z8.string().describe("Hex signature"),
2115
+ optimistic: z8.boolean().optional().describe("Return before on-chain confirmation")
2077
2116
  }),
2078
2117
  examples: [
2079
2118
  { args: { id: "ses_1a2b3c4d" }, options: { signature: "0xabcd1234..." }, description: "Sign a session" }
2080
2119
  ],
2081
2120
  output: sessionItem,
2082
2121
  async run(c) {
2083
- const res = await c.var.openfort.sessions.signature(c.args.id, {
2122
+ const res = await getOpenfort().sessions.signature(c.args.id, {
2084
2123
  signature: c.options.signature,
2085
2124
  optimistic: c.options.optimistic
2086
2125
  });
@@ -2099,61 +2138,60 @@ sessions.command("sign", {
2099
2138
  });
2100
2139
 
2101
2140
  // src/commands/transactions.ts
2102
- import { Cli as Cli9, z as z10 } from "incur";
2103
- var transactionIntentItem = z10.object({
2104
- id: z10.string(),
2105
- createdAt: z10.number(),
2106
- updatedAt: z10.number(),
2107
- chainId: z10.number(),
2108
- abstractionType: z10.string().describe("e.g. accountAbstractionV6, standard"),
2109
- userOperationHash: z10.string().optional(),
2110
- response: z10.object({
2111
- createdAt: z10.number(),
2112
- blockNumber: z10.number().optional(),
2113
- transactionHash: z10.string().optional(),
2114
- gasUsed: z10.string().optional(),
2115
- gasFee: z10.string().optional(),
2116
- status: z10.number().optional(),
2117
- to: z10.string().optional(),
2118
- error: z10.record(z10.string(), z10.unknown()).optional()
2141
+ import { Cli as Cli9, z as z9 } from "incur";
2142
+ var transactionIntentItem = z9.object({
2143
+ id: z9.string(),
2144
+ createdAt: z9.number(),
2145
+ updatedAt: z9.number(),
2146
+ chainId: z9.number(),
2147
+ abstractionType: z9.string().describe("e.g. accountAbstractionV6, standard"),
2148
+ userOperationHash: z9.string().optional(),
2149
+ response: z9.object({
2150
+ createdAt: z9.number(),
2151
+ blockNumber: z9.number().optional(),
2152
+ transactionHash: z9.string().optional(),
2153
+ gasUsed: z9.string().optional(),
2154
+ gasFee: z9.string().optional(),
2155
+ status: z9.number().optional(),
2156
+ to: z9.string().optional(),
2157
+ error: z9.record(z9.string(), z9.unknown()).optional()
2119
2158
  }).optional(),
2120
- interactions: z10.array(z10.object({
2121
- to: z10.string().optional(),
2122
- data: z10.string().optional(),
2123
- value: z10.string().optional()
2159
+ interactions: z9.array(z9.object({
2160
+ to: z9.string().optional(),
2161
+ data: z9.string().optional(),
2162
+ value: z9.string().optional()
2124
2163
  })).optional(),
2125
- nextAction: z10.object({
2126
- type: z10.string(),
2127
- payload: z10.record(z10.string(), z10.unknown()).optional()
2164
+ nextAction: z9.object({
2165
+ type: z9.string(),
2166
+ payload: z9.record(z9.string(), z9.unknown()).optional()
2128
2167
  }).optional()
2129
2168
  });
2130
2169
  var transactions = Cli9.create("transactions", {
2131
- description: "Manage transaction intents.",
2132
- vars: varsSchema
2170
+ description: "Manage transaction intents."
2133
2171
  });
2134
2172
  transactions.command("list", {
2135
2173
  description: "List transaction intents.",
2136
- options: z10.object({
2137
- limit: z10.number().optional().describe("Max results"),
2138
- skip: z10.number().optional().describe("Offset")
2174
+ options: z9.object({
2175
+ limit: z9.number().optional().describe("Max results"),
2176
+ skip: z9.number().optional().describe("Offset")
2139
2177
  }),
2140
2178
  alias: { limit: "l" },
2141
2179
  examples: [
2142
2180
  { description: "List all transactions" },
2143
2181
  { options: { limit: 10 }, description: "List last 10 transactions" }
2144
2182
  ],
2145
- output: z10.object({
2146
- data: z10.array(z10.object({
2147
- id: z10.string(),
2148
- createdAt: z10.number(),
2149
- updatedAt: z10.number(),
2150
- chainId: z10.number(),
2151
- abstractionType: z10.string()
2183
+ output: z9.object({
2184
+ data: z9.array(z9.object({
2185
+ id: z9.string(),
2186
+ createdAt: z9.number(),
2187
+ updatedAt: z9.number(),
2188
+ chainId: z9.number(),
2189
+ abstractionType: z9.string()
2152
2190
  })),
2153
- total: z10.number()
2191
+ total: z9.number()
2154
2192
  }),
2155
2193
  async run(c) {
2156
- const res = await c.var.openfort.transactionIntents.list({
2194
+ const res = await getOpenfort().transactionIntents.list({
2157
2195
  limit: c.options.limit,
2158
2196
  skip: c.options.skip
2159
2197
  });
@@ -2171,12 +2209,12 @@ transactions.command("list", {
2171
2209
  });
2172
2210
  transactions.command("create", {
2173
2211
  description: "Create a transaction intent.",
2174
- options: z10.object({
2175
- account: z10.string().describe("Account ID (acc_...)"),
2176
- chainId: z10.number().describe("Chain ID"),
2177
- interactions: z10.string().describe('Interactions as JSON: [{"to":"0x...","data":"0x...","value":"0"}]'),
2178
- policy: z10.string().optional().describe("Fee sponsorship ID (pol_...)."),
2179
- signedAuthorization: z10.string().optional().describe("Signed EIP-7702 authorization hex (for delegated accounts)")
2212
+ options: z9.object({
2213
+ account: z9.string().describe("Account ID (acc_...)"),
2214
+ chainId: z9.number().describe("Chain ID"),
2215
+ interactions: z9.string().describe('Interactions as JSON: [{"to":"0x...","data":"0x...","value":"0"}]'),
2216
+ policy: z9.string().optional().describe("Fee sponsorship ID (pol_...)."),
2217
+ signedAuthorization: z9.string().optional().describe("Signed EIP-7702 authorization hex (for delegated accounts)")
2180
2218
  }),
2181
2219
  output: transactionIntentItem,
2182
2220
  examples: [
@@ -2200,7 +2238,7 @@ transactions.command("create", {
2200
2238
  ],
2201
2239
  async run(c) {
2202
2240
  const interactions = JSON.parse(c.options.interactions);
2203
- const res = await c.var.openfort.transactionIntents.create({
2241
+ const res = await getOpenfort().transactionIntents.create({
2204
2242
  account: c.options.account,
2205
2243
  chainId: c.options.chainId,
2206
2244
  interactions,
@@ -2232,15 +2270,15 @@ transactions.command("create", {
2232
2270
  });
2233
2271
  transactions.command("get", {
2234
2272
  description: "Get a transaction intent by ID.",
2235
- args: z10.object({
2236
- id: z10.string().describe("Transaction intent ID (tin_...)")
2273
+ args: z9.object({
2274
+ id: z9.string().describe("Transaction intent ID (tin_...)")
2237
2275
  }),
2238
2276
  examples: [
2239
2277
  { args: { id: "tin_1a2b3c4d" }, description: "Get transaction status and receipt" }
2240
2278
  ],
2241
2279
  output: transactionIntentItem,
2242
2280
  async run(c) {
2243
- const t = await c.var.openfort.transactionIntents.get(c.args.id);
2281
+ const t = await getOpenfort().transactionIntents.get(c.args.id);
2244
2282
  return c.ok({
2245
2283
  id: t.id,
2246
2284
  createdAt: t.createdAt,
@@ -2256,12 +2294,12 @@ transactions.command("get", {
2256
2294
  });
2257
2295
  transactions.command("sign", {
2258
2296
  description: "Sign and broadcast a transaction intent.",
2259
- args: z10.object({
2260
- id: z10.string().describe("Transaction intent ID (tin_...)")
2297
+ args: z9.object({
2298
+ id: z9.string().describe("Transaction intent ID (tin_...)")
2261
2299
  }),
2262
- options: z10.object({
2263
- signature: z10.string().describe("Hex signature"),
2264
- optimistic: z10.boolean().optional().describe("Return before on-chain confirmation")
2300
+ options: z9.object({
2301
+ signature: z9.string().describe("Hex signature"),
2302
+ optimistic: z9.boolean().optional().describe("Return before on-chain confirmation")
2265
2303
  }),
2266
2304
  examples: [
2267
2305
  { args: { id: "tin_1a2b3c4d" }, options: { signature: "0xabcd1234..." }, description: "Sign and broadcast a transaction" },
@@ -2269,7 +2307,7 @@ transactions.command("sign", {
2269
2307
  ],
2270
2308
  output: transactionIntentItem,
2271
2309
  async run(c) {
2272
- const res = await c.var.openfort.transactionIntents.signature(c.args.id, {
2310
+ const res = await getOpenfort().transactionIntents.signature(c.args.id, {
2273
2311
  signature: c.options.signature,
2274
2312
  optimistic: c.options.optimistic
2275
2313
  });
@@ -2298,11 +2336,11 @@ transactions.command("sign", {
2298
2336
  });
2299
2337
  transactions.command("estimate", {
2300
2338
  description: "Estimate gas cost for a transaction.",
2301
- options: z10.object({
2302
- account: z10.string().describe("Account ID (acc_...)"),
2303
- chainId: z10.number().describe("Chain ID"),
2304
- interactions: z10.string().describe("Interactions as JSON"),
2305
- policy: z10.string().optional().describe("Fee sponsorship ID (pol_...)")
2339
+ options: z9.object({
2340
+ account: z9.string().describe("Account ID (acc_...)"),
2341
+ chainId: z9.number().describe("Chain ID"),
2342
+ interactions: z9.string().describe("Interactions as JSON"),
2343
+ policy: z9.string().optional().describe("Fee sponsorship ID (pol_...)")
2306
2344
  }),
2307
2345
  examples: [
2308
2346
  {
@@ -2310,16 +2348,16 @@ transactions.command("estimate", {
2310
2348
  description: "Estimate gas for a USDC transfer on Polygon"
2311
2349
  }
2312
2350
  ],
2313
- output: z10.object({
2314
- estimatedTXGas: z10.string(),
2315
- estimatedTXGasFee: z10.string(),
2316
- estimatedTXGasFeeUSD: z10.string(),
2317
- estimatedTXGasFeeToken: z10.string().optional(),
2318
- gasPrice: z10.string()
2351
+ output: z9.object({
2352
+ estimatedTXGas: z9.string(),
2353
+ estimatedTXGasFee: z9.string(),
2354
+ estimatedTXGasFeeUSD: z9.string(),
2355
+ estimatedTXGasFeeToken: z9.string().optional(),
2356
+ gasPrice: z9.string()
2319
2357
  }),
2320
2358
  async run(c) {
2321
2359
  const interactions = JSON.parse(c.options.interactions);
2322
- const res = await c.var.openfort.transactionIntents.estimateCost({
2360
+ const res = await getOpenfort().transactionIntents.estimateCost({
2323
2361
  account: c.options.account,
2324
2362
  chainId: c.options.chainId,
2325
2363
  interactions,
@@ -2336,21 +2374,19 @@ transactions.command("estimate", {
2336
2374
  });
2337
2375
 
2338
2376
  // src/commands/embedded-wallet.ts
2339
- import { Cli as Cli10, z as z11, Errors as Errors3 } from "incur";
2340
- var SHIELD_API_URL = OPENFORT_SHIELD_URL;
2377
+ import { Cli as Cli10, z as z10, Errors } from "incur";
2341
2378
  var embeddedWallet = Cli10.create("embedded-wallet", {
2342
- description: "Configure embedded wallet (Shield) API keys.",
2343
- vars: varsSchema
2379
+ description: "Configure embedded wallet (Shield) API keys."
2344
2380
  });
2345
2381
  embeddedWallet.command("setup", {
2346
2382
  description: "Generate and register embedded wallet (Shield) API keys.",
2347
- options: z11.object({
2348
- project: z11.string().optional().describe("Project ID (pro_...). Defaults to OPENFORT_PROJECT_ID env var.")
2383
+ options: z10.object({
2384
+ project: z10.string().optional().describe("Project ID (pro_...). Defaults to OPENFORT_PROJECT_ID env var.")
2349
2385
  }),
2350
2386
  alias: { project: "p" },
2351
- output: z11.object({
2352
- message: z11.string(),
2353
- credentialsPath: z11.string()
2387
+ output: z10.object({
2388
+ message: z10.string(),
2389
+ credentialsPath: z10.string()
2354
2390
  }),
2355
2391
  examples: [
2356
2392
  {
@@ -2362,7 +2398,7 @@ embeddedWallet.command("setup", {
2362
2398
  async run(c) {
2363
2399
  const publishableKey = process.env.OPENFORT_PUBLISHABLE_KEY;
2364
2400
  if (!publishableKey) {
2365
- throw new Errors3.IncurError({
2401
+ throw new Errors.IncurError({
2366
2402
  code: "MISSING_PUBLISHABLE_KEY",
2367
2403
  message: "OPENFORT_PUBLISHABLE_KEY environment variable is required to create Shield keys.",
2368
2404
  hint: "Run: openfort login"
@@ -2372,13 +2408,13 @@ embeddedWallet.command("setup", {
2372
2408
  const environment = apiKey.startsWith("sk_live_") ? "live" : "test";
2373
2409
  const projectId = c.options.project || process.env.OPENFORT_PROJECT_ID;
2374
2410
  if (!projectId) {
2375
- throw new Errors3.IncurError({
2411
+ throw new Errors.IncurError({
2376
2412
  code: "MISSING_PROJECT_ID",
2377
2413
  message: "Project ID is required. Pass --project or set OPENFORT_PROJECT_ID.",
2378
2414
  hint: "Run: openfort login"
2379
2415
  });
2380
2416
  }
2381
- const registerRes = await fetch(`${SHIELD_API_URL}/register`, {
2417
+ const registerRes = await fetch(`${OPENFORT_SHIELD_URL}/register`, {
2382
2418
  method: "POST",
2383
2419
  headers: {
2384
2420
  "Content-Type": "application/json",
@@ -2392,7 +2428,7 @@ embeddedWallet.command("setup", {
2392
2428
  });
2393
2429
  if (!registerRes.ok) {
2394
2430
  const text = await registerRes.text();
2395
- throw new Errors3.IncurError({
2431
+ throw new Errors.IncurError({
2396
2432
  code: "SHIELD_REGISTER_FAILED",
2397
2433
  message: `Shield registration failed: ${text}`,
2398
2434
  retryable: true
@@ -2400,7 +2436,7 @@ embeddedWallet.command("setup", {
2400
2436
  }
2401
2437
  const shieldData = await registerRes.json();
2402
2438
  if (shieldData.error) {
2403
- throw new Errors3.IncurError({
2439
+ throw new Errors.IncurError({
2404
2440
  code: "SHIELD_REGISTER_ERROR",
2405
2441
  message: `Shield registration error: ${shieldData.error}`
2406
2442
  });
@@ -2416,7 +2452,7 @@ embeddedWallet.command("setup", {
2416
2452
  });
2417
2453
  if (!res.ok) {
2418
2454
  const text = await res.text();
2419
- throw new Errors3.IncurError({
2455
+ throw new Errors.IncurError({
2420
2456
  code: "PERSIST_KEY_FAILED",
2421
2457
  message: `Failed to persist ${type} key: ${text}`,
2422
2458
  retryable: true
@@ -2427,7 +2463,7 @@ embeddedWallet.command("setup", {
2427
2463
  persistKey("pk_shield", shieldData.api_key),
2428
2464
  persistKey("sk_shield", shieldData.api_secret)
2429
2465
  ]);
2430
- const linkRes = await fetch(`${SHIELD_API_URL}/project/providers`, {
2466
+ const linkRes = await fetch(`${OPENFORT_SHIELD_URL}/project/providers`, {
2431
2467
  method: "POST",
2432
2468
  headers: {
2433
2469
  "Content-Type": "application/json",
@@ -2444,7 +2480,7 @@ embeddedWallet.command("setup", {
2444
2480
  });
2445
2481
  if (!linkRes.ok) {
2446
2482
  const text = await linkRes.text();
2447
- throw new Errors3.IncurError({
2483
+ throw new Errors.IncurError({
2448
2484
  code: "SHIELD_LINK_FAILED",
2449
2485
  message: `Failed to link Openfort provider to Shield: ${text}`,
2450
2486
  retryable: true
@@ -2471,49 +2507,48 @@ embeddedWallet.command("setup", {
2471
2507
  });
2472
2508
 
2473
2509
  // src/commands/users.ts
2474
- import { Cli as Cli11, z as z12 } from "incur";
2475
- var userItem = z12.object({
2476
- id: z12.string(),
2477
- createdAt: z12.number(),
2478
- name: z12.string(),
2479
- email: z12.string().nullable(),
2480
- emailVerified: z12.boolean(),
2481
- phoneNumber: z12.string().nullable(),
2482
- phoneNumberVerified: z12.boolean(),
2483
- isAnonymous: z12.boolean().optional(),
2484
- linkedAccounts: z12.array(z12.object({
2485
- provider: z12.string(),
2486
- createdAt: z12.number(),
2487
- updatedAt: z12.number(),
2488
- accountId: z12.string().optional(),
2489
- chainType: z12.string().optional(),
2490
- connectorType: z12.string().optional(),
2491
- walletClientType: z12.string().optional()
2510
+ import { Cli as Cli11, z as z11 } from "incur";
2511
+ var userItem = z11.object({
2512
+ id: z11.string(),
2513
+ createdAt: z11.number(),
2514
+ name: z11.string(),
2515
+ email: z11.string().nullable(),
2516
+ emailVerified: z11.boolean(),
2517
+ phoneNumber: z11.string().nullable(),
2518
+ phoneNumberVerified: z11.boolean(),
2519
+ isAnonymous: z11.boolean().optional(),
2520
+ linkedAccounts: z11.array(z11.object({
2521
+ provider: z11.string(),
2522
+ createdAt: z11.number(),
2523
+ updatedAt: z11.number(),
2524
+ accountId: z11.string().optional(),
2525
+ chainType: z11.string().optional(),
2526
+ connectorType: z11.string().optional(),
2527
+ walletClientType: z11.string().optional()
2492
2528
  }))
2493
2529
  });
2494
2530
  var users = Cli11.create("users", {
2495
- description: "Manage authenticated users.",
2496
- vars: varsSchema
2531
+ description: "Manage authenticated users."
2497
2532
  });
2498
2533
  users.command("list", {
2499
2534
  description: "List users.",
2500
- options: z12.object({
2501
- limit: z12.number().optional().describe("Max results"),
2502
- skip: z12.number().optional().describe("Offset"),
2503
- email: z12.string().optional().describe("Filter by email"),
2504
- name: z12.string().optional().describe("Filter by name")
2535
+ options: z11.object({
2536
+ limit: z11.number().optional().describe("Max results"),
2537
+ skip: z11.number().optional().describe("Offset"),
2538
+ email: z11.string().optional().describe("Filter by email"),
2539
+ name: z11.string().optional().describe("Filter by name")
2505
2540
  }),
2506
2541
  alias: { limit: "l" },
2507
2542
  examples: [
2508
2543
  { description: "List all users" },
2509
2544
  { options: { email: "user@example.com" }, description: "Find user by email" }
2510
2545
  ],
2511
- output: z12.object({
2512
- data: z12.array(userItem),
2513
- total: z12.number()
2546
+ output: z11.object({
2547
+ data: z11.array(userItem),
2548
+ total: z11.number()
2514
2549
  }),
2515
2550
  async run(c) {
2516
- const res = await c.var.openfort.iam.users.list({
2551
+ const res = await getOpenfort().iam.users.list({
2517
2552
  limit: c.options.limit,
2518
2553
  skip: c.options.skip,
2519
2554
  email: c.options.email,
@@ -2537,15 +2572,15 @@ users.command("list", {
2537
2572
  });
2538
2573
  users.command("get", {
2539
2574
  description: "Get a user by ID.",
2540
- args: z12.object({
2541
- id: z12.string().describe("User ID (usr_...)")
2575
+ args: z11.object({
2576
+ id: z11.string().describe("User ID (usr_...)")
2542
2577
  }),
2543
2578
  examples: [
2544
2579
  { args: { id: "usr_1a2b3c4d" }, description: "Get user profile and linked accounts" }
2545
2580
  ],
2546
2581
  output: userItem,
2547
2582
  async run(c) {
2548
- const u = await c.var.openfort.iam.users.get(c.args.id);
2583
+ const u = await getOpenfort().iam.users.get(c.args.id);
2549
2584
  return c.ok({
2550
2585
  id: u.id,
2551
2586
  createdAt: u.createdAt,
@@ -2561,25 +2596,25 @@ users.command("get", {
2561
2596
  });
2562
2597
  users.command("delete", {
2563
2598
  description: "Delete a user.",
2564
- args: z12.object({
2565
- id: z12.string().describe("User ID (usr_...)")
2599
+ args: z11.object({
2600
+ id: z11.string().describe("User ID (usr_...)")
2566
2601
  }),
2567
2602
  examples: [
2568
2603
  { args: { id: "usr_1a2b3c4d" }, description: "Delete a user and their accounts" }
2569
2604
  ],
2570
- output: z12.object({
2571
- id: z12.string(),
2572
- deleted: z12.boolean()
2605
+ output: z11.object({
2606
+ id: z11.string(),
2607
+ deleted: z11.boolean()
2573
2608
  }),
2574
2609
  async run(c) {
2575
- const res = await c.var.openfort.iam.users.delete(c.args.id);
2610
+ const res = await getOpenfort().iam.users.delete(c.args.id);
2576
2611
  return c.ok({ id: res.id, deleted: res.deleted });
2577
2612
  }
2578
2613
  });
2579
2614
 
2580
2615
  // src/commands/backend-wallet.ts
2581
2616
  import { randomBytes as randomBytes2, subtle } from "crypto";
2582
- import { Cli as Cli12, z as z13, Errors as Errors4 } from "incur";
2617
+ import { Cli as Cli12, z as z12, Errors as Errors2 } from "incur";
2583
2618
  function arrayBufferToBase64(buffer) {
2584
2619
  return Buffer.from(buffer).toString("base64");
2585
2620
  }
@@ -2651,14 +2686,13 @@ async function signWalletAuthJwt(privateKey, method, path, body) {
2651
2686
  return `${signingInput}.${arrayBufferToBase64Url(signature)}`;
2652
2687
  }
2653
2688
  var backendWallet = Cli12.create("backend-wallet", {
2654
- description: "Configure backend wallet signing keys.",
2655
- vars: varsSchema
2689
+ description: "Configure backend wallet signing keys."
2656
2690
  });
2657
2691
  backendWallet.command("setup", {
2658
2692
  description: "Generate and register backend wallet signing keys (ECDSA P-256).",
2659
- output: z13.object({
2660
- message: z13.string(),
2661
- credentialsPath: z13.string()
2693
+ output: z12.object({
2694
+ message: z12.string(),
2695
+ credentialsPath: z12.string()
2662
2696
  }),
2663
2697
  examples: [
2664
2698
  {
@@ -2689,7 +2723,7 @@ ${publicKey}
2689
2723
  });
2690
2724
  if (!registerRes.ok) {
2691
2725
  const text = await registerRes.text();
2692
- throw new Errors4.IncurError({
2726
+ throw new Errors2.IncurError({
2693
2727
  code: "REGISTER_SECRET_FAILED",
2694
2728
  message: `Failed to register wallet secret: ${text}`,
2695
2729
  retryable: true
@@ -2705,7 +2739,7 @@ ${publicKey}
2705
2739
  });
2706
2740
  if (!storeRes.ok) {
2707
2741
  const text = await storeRes.text();
2708
- throw new Errors4.IncurError({
2742
+ throw new Errors2.IncurError({
2709
2743
  code: "STORE_KEY_FAILED",
2710
2744
  message: `Failed to store wallet key reference: ${text}`,
2711
2745
  retryable: true
@@ -2730,10 +2764,10 @@ ${publicKey}
2730
2764
  });
2731
2765
  backendWallet.command("revoke", {
2732
2766
  description: "Revoke the current backend wallet signing secret.",
2733
- output: z13.object({
2734
- keyId: z13.string(),
2735
- revoked: z13.boolean(),
2736
- revokedAt: z13.number()
2767
+ output: z12.object({
2768
+ keyId: z12.string(),
2769
+ revoked: z12.boolean(),
2770
+ revokedAt: z12.number()
2737
2771
  }),
2738
2772
  examples: [
2739
2773
  {
@@ -2746,7 +2780,7 @@ backendWallet.command("revoke", {
2746
2780
  const keyId = process.env.OPENFORT_WALLET_KEY_ID;
2747
2781
  const privateKeyBase64 = process.env.OPENFORT_WALLET_SECRET;
2748
2782
  if (!keyId || !privateKeyBase64) {
2749
- throw new Errors4.IncurError({
2783
+ throw new Errors2.IncurError({
2750
2784
  code: "MISSING_WALLET_KEY",
2751
2785
  message: "OPENFORT_WALLET_KEY_ID and OPENFORT_WALLET_SECRET must be set. Run `backend-wallet setup` first.",
2752
2786
  hint: "Run: openfort backend-wallet setup"
@@ -2767,7 +2801,7 @@ backendWallet.command("revoke", {
2767
2801
  });
2768
2802
  if (!res.ok) {
2769
2803
  const text = await res.text();
2770
- throw new Errors4.IncurError({
2804
+ throw new Errors2.IncurError({
2771
2805
  code: "REVOKE_SECRET_FAILED",
2772
2806
  message: `Failed to revoke wallet secret: ${text}`,
2773
2807
  retryable: true
@@ -2779,9 +2813,9 @@ backendWallet.command("revoke", {
2779
2813
  });
2780
2814
  backendWallet.command("rotate", {
2781
2815
  description: "Rotate backend wallet signing secret (generates new ECDSA P-256 key pair).",
2782
- output: z13.object({
2783
- message: z13.string(),
2784
- credentialsPath: z13.string()
2816
+ output: z12.object({
2817
+ message: z12.string(),
2818
+ credentialsPath: z12.string()
2785
2819
  }),
2786
2820
  examples: [
2787
2821
  {
@@ -2812,7 +2846,7 @@ ${publicKey}
2812
2846
  });
2813
2847
  if (!rotateRes.ok) {
2814
2848
  const text = await rotateRes.text();
2815
- throw new Errors4.IncurError({
2849
+ throw new Errors2.IncurError({
2816
2850
  code: "ROTATE_SECRET_FAILED",
2817
2851
  message: `Failed to rotate wallet secret: ${text}`,
2818
2852
  retryable: true
@@ -2828,7 +2862,7 @@ ${publicKey}
2828
2862
  });
2829
2863
  if (!storeRes.ok) {
2830
2864
  const text = await storeRes.text();
2831
- throw new Errors4.IncurError({
2865
+ throw new Errors2.IncurError({
2832
2866
  code: "STORE_KEY_FAILED",
2833
2867
  message: `Failed to store rotated wallet key reference: ${text}`,
2834
2868
  retryable: true
@@ -2843,22 +2877,21 @@ ${publicKey}
2843
2877
  });
2844
2878
 
2845
2879
  // src/commands/message.ts
2846
- import { Cli as Cli13, z as z14 } from "incur";
2880
+ import { Cli as Cli13, z as z13 } from "incur";
2847
2881
  import { keccak256, toBytes } from "viem";
2848
2882
  var message = Cli13.create("message", {
2849
- description: "Message utilities.",
2850
- vars: varsSchema
2883
+ description: "Message utilities."
2851
2884
  });
2852
2885
  message.command("hash", {
2853
2886
  description: "Hash a message using keccak256.",
2854
- args: z14.object({
2855
- message: z14.string().describe("The message to hash")
2887
+ args: z13.object({
2888
+ message: z13.string().describe("The message to hash")
2856
2889
  }),
2857
2890
  examples: [
2858
2891
  { args: { message: "Hello World" }, description: "Hash a message" }
2859
2892
  ],
2860
- output: z14.object({
2861
- hash: z14.string()
2893
+ output: z13.object({
2894
+ hash: z13.string()
2862
2895
  }),
2863
2896
  async run(c) {
2864
2897
  const hash = keccak256(toBytes(c.args.message));
@@ -2867,16 +2900,15 @@ message.command("hash", {
2867
2900
  });
2868
2901
 
2869
2902
  // src/cli.ts
2870
- var pkg = JSON.parse(readFileSync2(new URL("../package.json", import.meta.url), "utf-8"));
2903
+ var pkg = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf-8"));
2871
2904
  var cli = Cli14.create("openfort", {
2872
2905
  version: pkg.version,
2873
2906
  description: "Openfort CLI \u2014 manage wallets, policies, and transactions from the terminal.",
2874
- vars: varsSchema,
2875
- env: z15.object({
2876
- OPENFORT_API_KEY: z15.string().optional().describe("Openfort secret API key (sk_test_... or sk_live_...)"),
2877
- OPENFORT_WALLET_SECRET: z15.string().optional().describe("Wallet encryption secret"),
2878
- OPENFORT_PUBLISHABLE_KEY: z15.string().optional().describe("Publishable key for client-side ops"),
2879
- OPENFORT_BASE_URL: z15.string().optional().describe("Custom API base URL")
2907
+ env: z14.object({
2908
+ OPENFORT_API_KEY: z14.string().optional().describe("Openfort secret API key (sk_test_... or sk_live_...)"),
2909
+ OPENFORT_WALLET_SECRET: z14.string().optional().describe("Wallet encryption secret"),
2910
+ OPENFORT_PUBLISHABLE_KEY: z14.string().optional().describe("Publishable key for client-side ops"),
2911
+ OPENFORT_BASE_URL: z14.string().optional().describe("Custom API base URL")
2880
2912
  }),
2881
2913
  sync: {
2882
2914
  depth: 2,
@@ -2894,38 +2926,6 @@ var cli = Cli14.create("openfort", {
2894
2926
  }
2895
2927
  });
2896
2928
  cli.command(login);
2897
- cli.use(async (c, next) => {
2898
- const isLoginCommand = process.argv.slice(2).some((arg) => arg === "login");
2899
- if (isLoginCommand) {
2900
- await next();
2901
- return;
2902
- }
2903
- let apiKey = process.env.OPENFORT_API_KEY;
2904
- if (!apiKey) {
2905
- const creds = loadEnvFile(CREDENTIALS_PATH);
2906
- apiKey = creds.get("OPENFORT_API_KEY");
2907
- if (apiKey) {
2908
- process.env.OPENFORT_API_KEY = apiKey;
2909
- const pk = creds.get("OPENFORT_PUBLISHABLE_KEY");
2910
- if (pk && !process.env.OPENFORT_PUBLISHABLE_KEY) process.env.OPENFORT_PUBLISHABLE_KEY = pk;
2911
- const ws = creds.get("OPENFORT_WALLET_SECRET");
2912
- if (ws && !process.env.OPENFORT_WALLET_SECRET) process.env.OPENFORT_WALLET_SECRET = ws;
2913
- }
2914
- }
2915
- if (!apiKey) {
2916
- throw new Errors5.IncurError({
2917
- code: "MISSING_API_KEY",
2918
- message: "OPENFORT_API_KEY environment variable is required.",
2919
- hint: "Run: openfort login"
2920
- });
2921
- }
2922
- c.set("openfort", new Openfort(apiKey, {
2923
- walletSecret: process.env.OPENFORT_WALLET_SECRET,
2924
- publishableKey: process.env.OPENFORT_PUBLISHABLE_KEY,
2925
- basePath: API_BASE_URL
2926
- }));
2927
- await next();
2928
- });
2929
2929
  cli.command(accounts).command(contracts).command(paymasters).command(policies).command(embeddedWallet).command(sponsorship).command(sessions).command(subscriptions).command(transactions).command(users).command(backendWallet).command(message);
2930
2930
  var cli_default = cli;
2931
2931
  export {