@openfort/cli 0.1.8 → 0.1.9

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,51 +23,7 @@ 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
  }
@@ -198,10 +156,10 @@ function waitForCallback(port, state) {
198
156
  }
199
157
  var login = Cli.create("login", {
200
158
  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")
159
+ output: z.object({
160
+ apiKey: z.string().describe("The API key saved to credentials"),
161
+ project: z.string().describe("The project name"),
162
+ credentialsPath: z.string().describe("Path to the credentials file")
205
163
  }),
206
164
  async run(c) {
207
165
  const state = generateState();
@@ -249,7 +207,37 @@ var login = Cli.create("login", {
249
207
  });
250
208
 
251
209
  // src/commands/accounts.ts
252
- import { Cli as Cli2, z as z3, middleware } from "incur";
210
+ import { Cli as Cli2, z as z2, middleware } from "incur";
211
+
212
+ // src/client.ts
213
+ import Openfort from "@openfort/openfort-node";
214
+ var cached;
215
+ function getOpenfort() {
216
+ if (cached) return cached;
217
+ let apiKey = process.env.OPENFORT_API_KEY;
218
+ if (!apiKey) {
219
+ const creds = loadEnvFile(CREDENTIALS_PATH);
220
+ apiKey = creds.get("OPENFORT_API_KEY");
221
+ if (apiKey) {
222
+ process.env.OPENFORT_API_KEY = apiKey;
223
+ const pk = creds.get("OPENFORT_PUBLISHABLE_KEY");
224
+ if (pk && !process.env.OPENFORT_PUBLISHABLE_KEY) process.env.OPENFORT_PUBLISHABLE_KEY = pk;
225
+ const ws = creds.get("OPENFORT_WALLET_SECRET");
226
+ if (ws && !process.env.OPENFORT_WALLET_SECRET) process.env.OPENFORT_WALLET_SECRET = ws;
227
+ }
228
+ }
229
+ if (!apiKey) {
230
+ throw new Error("OPENFORT_API_KEY is required. Run: openfort login");
231
+ }
232
+ cached = new Openfort(apiKey, {
233
+ walletSecret: process.env.OPENFORT_WALLET_SECRET,
234
+ publishableKey: process.env.OPENFORT_PUBLISHABLE_KEY,
235
+ basePath: API_BASE_URL
236
+ });
237
+ return cached;
238
+ }
239
+
240
+ // src/commands/accounts.ts
253
241
  var requireWallet = middleware((c, next) => {
254
242
  const missing = [];
255
243
  if (!process.env.OPENFORT_WALLET_SECRET) missing.push("OPENFORT_WALLET_SECRET");
@@ -267,8 +255,7 @@ var requireWallet = middleware((c, next) => {
267
255
  return next();
268
256
  });
269
257
  var evm = Cli2.create("evm", {
270
- description: "EVM wallet management.",
271
- vars: varsSchema
258
+ description: "EVM wallet management."
272
259
  });
273
260
  evm.command("create", {
274
261
  description: "Create a new EVM backend wallet.",
@@ -277,13 +264,13 @@ evm.command("create", {
277
264
  ],
278
265
  hint: "Requires OPENFORT_WALLET_SECRET and OPENFORT_PUBLISHABLE_KEY.",
279
266
  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")
267
+ output: z2.object({
268
+ id: z2.string().describe("Account ID"),
269
+ address: z2.string().describe("Wallet address"),
270
+ custody: z2.string().describe("Custody type")
284
271
  }),
285
272
  async run(c) {
286
- const account = await c.var.openfort.accounts.evm.backend.create();
273
+ const account = await getOpenfort().accounts.evm.backend.create();
287
274
  return c.ok(
288
275
  { id: account.id, address: account.address, custody: account.custody },
289
276
  {
@@ -300,25 +287,25 @@ evm.command("create", {
300
287
  });
301
288
  evm.command("list", {
302
289
  description: "List EVM backend wallets.",
303
- options: z3.object({
304
- limit: z3.number().optional().describe("Max results"),
305
- skip: z3.number().optional().describe("Offset")
290
+ options: z2.object({
291
+ limit: z2.number().optional().describe("Max results"),
292
+ skip: z2.number().optional().describe("Offset")
306
293
  }),
307
294
  alias: { limit: "l" },
308
295
  examples: [
309
296
  { description: "List all EVM backend wallets" },
310
297
  { options: { limit: 5 }, description: "Show first 5 wallets" }
311
298
  ],
312
- output: z3.object({
313
- accounts: z3.array(z3.object({
314
- id: z3.string(),
315
- address: z3.string(),
316
- custody: z3.string()
299
+ output: z2.object({
300
+ accounts: z2.array(z2.object({
301
+ id: z2.string(),
302
+ address: z2.string(),
303
+ custody: z2.string()
317
304
  })),
318
- total: z3.number().optional()
305
+ total: z2.number().optional()
319
306
  }),
320
307
  async run(c) {
321
- const res = await c.var.openfort.accounts.evm.backend.list({
308
+ const res = await getOpenfort().accounts.evm.backend.list({
322
309
  limit: c.options.limit,
323
310
  skip: c.options.skip
324
311
  });
@@ -334,25 +321,25 @@ evm.command("list", {
334
321
  });
335
322
  evm.command("list-delegated", {
336
323
  description: "List EVM delegated accounts.",
337
- options: z3.object({
338
- limit: z3.number().optional().describe("Max results"),
339
- skip: z3.number().optional().describe("Offset")
324
+ options: z2.object({
325
+ limit: z2.number().optional().describe("Max results"),
326
+ skip: z2.number().optional().describe("Offset")
340
327
  }),
341
328
  alias: { limit: "l" },
342
329
  examples: [
343
330
  { description: "List all EVM delegated accounts" },
344
331
  { options: { limit: 5 }, description: "Show first 5 accounts" }
345
332
  ],
346
- output: z3.object({
347
- accounts: z3.array(z3.object({
348
- id: z3.string(),
349
- address: z3.string(),
350
- custody: z3.string()
333
+ output: z2.object({
334
+ accounts: z2.array(z2.object({
335
+ id: z2.string(),
336
+ address: z2.string(),
337
+ custody: z2.string()
351
338
  })),
352
- total: z3.number().optional()
339
+ total: z2.number().optional()
353
340
  }),
354
341
  async run(c) {
355
- const res = await c.var.openfort.accounts.evm.list({
342
+ const res = await getOpenfort().accounts.evm.list({
356
343
  accountType: "Delegated Account",
357
344
  limit: c.options.limit,
358
345
  skip: c.options.skip
@@ -369,25 +356,25 @@ evm.command("list-delegated", {
369
356
  });
370
357
  evm.command("list-smart", {
371
358
  description: "List EVM smart accounts.",
372
- options: z3.object({
373
- limit: z3.number().optional().describe("Max results"),
374
- skip: z3.number().optional().describe("Offset")
359
+ options: z2.object({
360
+ limit: z2.number().optional().describe("Max results"),
361
+ skip: z2.number().optional().describe("Offset")
375
362
  }),
376
363
  alias: { limit: "l" },
377
364
  examples: [
378
365
  { description: "List all EVM smart accounts" },
379
366
  { options: { limit: 5 }, description: "Show first 5 accounts" }
380
367
  ],
381
- output: z3.object({
382
- accounts: z3.array(z3.object({
383
- id: z3.string(),
384
- address: z3.string(),
385
- custody: z3.string()
368
+ output: z2.object({
369
+ accounts: z2.array(z2.object({
370
+ id: z2.string(),
371
+ address: z2.string(),
372
+ custody: z2.string()
386
373
  })),
387
- total: z3.number().optional()
374
+ total: z2.number().optional()
388
375
  }),
389
376
  async run(c) {
390
- const res = await c.var.openfort.accounts.evm.list({
377
+ const res = await getOpenfort().accounts.evm.list({
391
378
  accountType: "Smart Account",
392
379
  limit: c.options.limit,
393
380
  skip: c.options.skip
@@ -404,19 +391,19 @@ evm.command("list-smart", {
404
391
  });
405
392
  evm.command("get", {
406
393
  description: "Get an EVM backend wallet by ID or address.",
407
- args: z3.object({
408
- id: z3.string().describe("Account ID or address")
394
+ args: z2.object({
395
+ id: z2.string().describe("Account ID or address")
409
396
  }),
410
397
  examples: [
411
398
  { args: { id: "acc_1a2b3c4d" }, description: "Get wallet by ID" }
412
399
  ],
413
- output: z3.object({
414
- id: z3.string(),
415
- address: z3.string(),
416
- custody: z3.string()
400
+ output: z2.object({
401
+ id: z2.string(),
402
+ address: z2.string(),
403
+ custody: z2.string()
417
404
  }),
418
405
  async run(c) {
419
- const a = await c.var.openfort.accounts.evm.backend.get({ id: c.args.id });
406
+ const a = await getOpenfort().accounts.evm.backend.get({ id: c.args.id });
420
407
  return c.ok({
421
408
  id: a.id,
422
409
  address: a.address,
@@ -426,43 +413,43 @@ evm.command("get", {
426
413
  });
427
414
  evm.command("delete", {
428
415
  description: "Delete an EVM backend wallet.",
429
- args: z3.object({
430
- id: z3.string().describe("Account ID (acc_...)")
416
+ args: z2.object({
417
+ id: z2.string().describe("Account ID (acc_...)")
431
418
  }),
432
419
  examples: [
433
420
  { args: { id: "acc_1a2b3c4d" }, description: "Delete a wallet" }
434
421
  ],
435
- output: z3.object({
436
- id: z3.string(),
437
- deleted: z3.boolean()
422
+ output: z2.object({
423
+ id: z2.string(),
424
+ deleted: z2.boolean()
438
425
  }),
439
426
  async run(c) {
440
- const res = await c.var.openfort.accounts.evm.backend.delete(c.args.id);
427
+ const res = await getOpenfort().accounts.evm.backend.delete(c.args.id);
441
428
  return c.ok({ id: res.id, deleted: res.deleted });
442
429
  }
443
430
  });
444
431
  evm.command("update", {
445
432
  description: "Upgrade an EVM backend wallet to a delegated account (EIP-7702).",
446
- args: z3.object({
447
- id: z3.string().describe("Account ID (acc_...)")
433
+ args: z2.object({
434
+ id: z2.string().describe("Account ID (acc_...)")
448
435
  }),
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)")
436
+ options: z2.object({
437
+ chainId: z2.number().describe("Chain ID to deploy on"),
438
+ implementationType: z2.string().describe("Target implementation type (e.g. CaliburV9)")
452
439
  }),
453
440
  examples: [
454
441
  { args: { id: "acc_1a2b3c4d" }, options: { chainId: 8453, implementationType: "CaliburV9" }, description: "Upgrade to delegated account on Base" }
455
442
  ],
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()
443
+ output: z2.object({
444
+ id: z2.string(),
445
+ address: z2.string(),
446
+ accountType: z2.string(),
447
+ chainId: z2.number().optional(),
448
+ chainType: z2.string()
462
449
  }),
463
450
  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({
451
+ const account = await getOpenfort().accounts.evm.backend.get({ id: c.args.id });
452
+ const res = await getOpenfort().accounts.evm.backend.update({
466
453
  walletId: account.walletId,
467
454
  chainId: c.options.chainId,
468
455
  accountId: account.id,
@@ -489,22 +476,22 @@ evm.command("update", {
489
476
  });
490
477
  evm.command("sign", {
491
478
  description: "Sign data with an EVM backend wallet.",
492
- args: z3.object({
493
- id: z3.string().describe("Account ID (acc_...)")
479
+ args: z2.object({
480
+ id: z2.string().describe("Account ID (acc_...)")
494
481
  }),
495
- options: z3.object({
496
- data: z3.string().describe("Hex-encoded data to sign")
482
+ options: z2.object({
483
+ data: z2.string().describe("Hex-encoded data to sign")
497
484
  }),
498
485
  examples: [
499
486
  { args: { id: "acc_1a2b3c4d" }, options: { data: "0xdeadbeef" }, description: "Sign a message hash" }
500
487
  ],
501
488
  hint: "Requires OPENFORT_WALLET_SECRET and OPENFORT_PUBLISHABLE_KEY.",
502
489
  middleware: [requireWallet],
503
- output: z3.object({
504
- signature: z3.string()
490
+ output: z2.object({
491
+ signature: z2.string()
505
492
  }),
506
493
  async run(c) {
507
- const signature = await c.var.openfort.accounts.evm.backend.sign({
494
+ const signature = await getOpenfort().accounts.evm.backend.sign({
508
495
  id: c.args.id,
509
496
  data: c.options.data
510
497
  });
@@ -513,21 +500,21 @@ evm.command("sign", {
513
500
  });
514
501
  evm.command("import", {
515
502
  description: "Import a private key as an EVM backend wallet.",
516
- options: z3.object({
517
- privateKey: z3.string().describe("Private key (hex string)")
503
+ options: z2.object({
504
+ privateKey: z2.string().describe("Private key (hex string)")
518
505
  }),
519
506
  examples: [
520
507
  { options: { privateKey: "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80" }, description: "Import a private key" }
521
508
  ],
522
509
  hint: "Requires OPENFORT_WALLET_SECRET and OPENFORT_PUBLISHABLE_KEY.",
523
510
  middleware: [requireWallet],
524
- output: z3.object({
525
- id: z3.string(),
526
- address: z3.string(),
527
- custody: z3.string()
511
+ output: z2.object({
512
+ id: z2.string(),
513
+ address: z2.string(),
514
+ custody: z2.string()
528
515
  }),
529
516
  async run(c) {
530
- const account = await c.var.openfort.accounts.evm.backend.import({
517
+ const account = await getOpenfort().accounts.evm.backend.import({
531
518
  privateKey: c.options.privateKey
532
519
  });
533
520
  return c.ok({
@@ -539,18 +526,18 @@ evm.command("import", {
539
526
  });
540
527
  evm.command("export", {
541
528
  description: "Export an EVM backend wallet private key.",
542
- args: z3.object({
543
- id: z3.string().describe("Account ID (acc_...)")
529
+ args: z2.object({
530
+ id: z2.string().describe("Account ID (acc_...)")
544
531
  }),
545
532
  examples: [
546
533
  { args: { id: "acc_1a2b3c4d" }, description: "Export private key" }
547
534
  ],
548
535
  middleware: [requireWallet],
549
- output: z3.object({
550
- privateKey: z3.string()
536
+ output: z2.object({
537
+ privateKey: z2.string()
551
538
  }),
552
539
  async run(c) {
553
- const privateKey = await c.var.openfort.accounts.evm.backend.export({
540
+ const privateKey = await getOpenfort().accounts.evm.backend.export({
554
541
  id: c.args.id
555
542
  });
556
543
  return c.ok({ privateKey });
@@ -558,13 +545,13 @@ evm.command("export", {
558
545
  });
559
546
  evm.command("send-transaction", {
560
547
  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_...)")
548
+ args: z2.object({
549
+ id: z2.string().describe("Account ID (acc_...)")
563
550
  }),
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_...)")
551
+ options: z2.object({
552
+ chainId: z2.number().describe("Chain ID"),
553
+ interactions: z2.string().describe('Interactions as JSON: [{"to":"0x...","data":"0x...","value":"0"}]'),
554
+ policy: z2.string().optional().describe("Fee sponsorship ID (pol_...)")
568
555
  }),
569
556
  examples: [
570
557
  {
@@ -577,15 +564,15 @@ evm.command("send-transaction", {
577
564
  }
578
565
  ],
579
566
  middleware: [requireWallet],
580
- output: z3.object({
581
- id: z3.string(),
582
- chainId: z3.number(),
583
- transactionHash: z3.string().optional()
567
+ output: z2.object({
568
+ id: z2.string(),
569
+ chainId: z2.number(),
570
+ transactionHash: z2.string().optional()
584
571
  }),
585
572
  async run(c) {
586
- const account = await c.var.openfort.accounts.evm.backend.get({ id: c.args.id });
573
+ const account = await getOpenfort().accounts.evm.backend.get({ id: c.args.id });
587
574
  const interactions = JSON.parse(c.options.interactions);
588
- const res = await c.var.openfort.accounts.evm.backend.sendTransaction({
575
+ const res = await getOpenfort().accounts.evm.backend.sendTransaction({
589
576
  account,
590
577
  chainId: c.options.chainId,
591
578
  interactions,
@@ -599,8 +586,7 @@ evm.command("send-transaction", {
599
586
  }
600
587
  });
601
588
  var solana = Cli2.create("solana", {
602
- description: "Solana wallet management.",
603
- vars: varsSchema
589
+ description: "Solana wallet management."
604
590
  });
605
591
  solana.command("create", {
606
592
  description: "Create a new Solana backend wallet.",
@@ -609,13 +595,13 @@ solana.command("create", {
609
595
  ],
610
596
  hint: "Requires OPENFORT_WALLET_SECRET and OPENFORT_PUBLISHABLE_KEY.",
611
597
  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")
598
+ output: z2.object({
599
+ id: z2.string().describe("Account ID"),
600
+ address: z2.string().describe("Wallet address"),
601
+ custody: z2.string().describe("Custody type")
616
602
  }),
617
603
  async run(c) {
618
- const account = await c.var.openfort.accounts.solana.backend.create();
604
+ const account = await getOpenfort().accounts.solana.backend.create();
619
605
  return c.ok(
620
606
  { id: account.id, address: account.address, custody: account.custody },
621
607
  {
@@ -631,24 +617,24 @@ solana.command("create", {
631
617
  });
632
618
  solana.command("list", {
633
619
  description: "List Solana backend wallets.",
634
- options: z3.object({
635
- limit: z3.number().optional().describe("Max results"),
636
- skip: z3.number().optional().describe("Offset")
620
+ options: z2.object({
621
+ limit: z2.number().optional().describe("Max results"),
622
+ skip: z2.number().optional().describe("Offset")
637
623
  }),
638
624
  alias: { limit: "l" },
639
625
  examples: [
640
626
  { description: "List all Solana wallets" }
641
627
  ],
642
- output: z3.object({
643
- accounts: z3.array(z3.object({
644
- id: z3.string(),
645
- address: z3.string(),
646
- custody: z3.string()
628
+ output: z2.object({
629
+ accounts: z2.array(z2.object({
630
+ id: z2.string(),
631
+ address: z2.string(),
632
+ custody: z2.string()
647
633
  })),
648
- total: z3.number().optional()
634
+ total: z2.number().optional()
649
635
  }),
650
636
  async run(c) {
651
- const res = await c.var.openfort.accounts.solana.backend.list({
637
+ const res = await getOpenfort().accounts.solana.backend.list({
652
638
  limit: c.options.limit,
653
639
  skip: c.options.skip
654
640
  });
@@ -664,19 +650,19 @@ solana.command("list", {
664
650
  });
665
651
  solana.command("get", {
666
652
  description: "Get a Solana backend wallet by ID or address.",
667
- args: z3.object({
668
- id: z3.string().describe("Account ID or address")
653
+ args: z2.object({
654
+ id: z2.string().describe("Account ID or address")
669
655
  }),
670
656
  examples: [
671
657
  { args: { id: "acc_1a2b3c4d" }, description: "Get wallet by ID" }
672
658
  ],
673
- output: z3.object({
674
- id: z3.string(),
675
- address: z3.string(),
676
- custody: z3.string()
659
+ output: z2.object({
660
+ id: z2.string(),
661
+ address: z2.string(),
662
+ custody: z2.string()
677
663
  }),
678
664
  async run(c) {
679
- const a = await c.var.openfort.accounts.solana.backend.get({ id: c.args.id });
665
+ const a = await getOpenfort().accounts.solana.backend.get({ id: c.args.id });
680
666
  return c.ok({
681
667
  id: a.id,
682
668
  address: a.address,
@@ -686,18 +672,18 @@ solana.command("get", {
686
672
  });
687
673
  solana.command("sign", {
688
674
  description: "Sign data with a Solana backend wallet.",
689
- args: z3.object({
690
- id: z3.string().describe("Account ID (acc_...)")
675
+ args: z2.object({
676
+ id: z2.string().describe("Account ID (acc_...)")
691
677
  }),
692
- options: z3.object({
693
- data: z3.string().describe("Data to sign (base64-encoded)")
678
+ options: z2.object({
679
+ data: z2.string().describe("Data to sign (base64-encoded)")
694
680
  }),
695
681
  alias: { data: "d" },
696
682
  hint: "Requires OPENFORT_WALLET_SECRET and OPENFORT_PUBLISHABLE_KEY.",
697
683
  middleware: [requireWallet],
698
- output: z3.object({
699
- account: z3.string(),
700
- signature: z3.string()
684
+ output: z2.object({
685
+ account: z2.string(),
686
+ signature: z2.string()
701
687
  }),
702
688
  examples: [
703
689
  {
@@ -707,44 +693,44 @@ solana.command("sign", {
707
693
  }
708
694
  ],
709
695
  async run(c) {
710
- const signature = await c.var.openfort.accounts.solana.backend.sign(c.args.id, c.options.data);
696
+ const signature = await getOpenfort().accounts.solana.backend.sign(c.args.id, c.options.data);
711
697
  return c.ok({ account: c.args.id, signature });
712
698
  }
713
699
  });
714
700
  solana.command("delete", {
715
701
  description: "Delete a Solana backend wallet.",
716
- args: z3.object({
717
- id: z3.string().describe("Account ID (acc_...)")
702
+ args: z2.object({
703
+ id: z2.string().describe("Account ID (acc_...)")
718
704
  }),
719
705
  examples: [
720
706
  { args: { id: "acc_1a2b3c4d" }, description: "Delete a wallet" }
721
707
  ],
722
- output: z3.object({
723
- id: z3.string(),
724
- deleted: z3.boolean()
708
+ output: z2.object({
709
+ id: z2.string(),
710
+ deleted: z2.boolean()
725
711
  }),
726
712
  async run(c) {
727
- const res = await c.var.openfort.accounts.solana.backend.delete(c.args.id);
713
+ const res = await getOpenfort().accounts.solana.backend.delete(c.args.id);
728
714
  return c.ok({ id: res.id, deleted: res.deleted });
729
715
  }
730
716
  });
731
717
  solana.command("import", {
732
718
  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)")
719
+ options: z2.object({
720
+ privateKey: z2.string().describe("Private key (hex-encoded 32 bytes or base58)")
735
721
  }),
736
722
  examples: [
737
723
  { options: { privateKey: "abc123..." }, description: "Import a Solana private key" }
738
724
  ],
739
725
  hint: "Requires OPENFORT_WALLET_SECRET and OPENFORT_PUBLISHABLE_KEY.",
740
726
  middleware: [requireWallet],
741
- output: z3.object({
742
- id: z3.string(),
743
- address: z3.string(),
744
- custody: z3.string()
727
+ output: z2.object({
728
+ id: z2.string(),
729
+ address: z2.string(),
730
+ custody: z2.string()
745
731
  }),
746
732
  async run(c) {
747
- const account = await c.var.openfort.accounts.solana.backend.import({
733
+ const account = await getOpenfort().accounts.solana.backend.import({
748
734
  privateKey: c.options.privateKey
749
735
  });
750
736
  return c.ok({
@@ -756,18 +742,18 @@ solana.command("import", {
756
742
  });
757
743
  solana.command("export", {
758
744
  description: "Export a Solana backend wallet private key.",
759
- args: z3.object({
760
- id: z3.string().describe("Account ID (acc_...)")
745
+ args: z2.object({
746
+ id: z2.string().describe("Account ID (acc_...)")
761
747
  }),
762
748
  examples: [
763
749
  { args: { id: "acc_1a2b3c4d" }, description: "Export private key" }
764
750
  ],
765
751
  middleware: [requireWallet],
766
- output: z3.object({
767
- privateKey: z3.string()
752
+ output: z2.object({
753
+ privateKey: z2.string()
768
754
  }),
769
755
  async run(c) {
770
- const privateKey = await c.var.openfort.accounts.solana.backend.export({
756
+ const privateKey = await getOpenfort().accounts.solana.backend.export({
771
757
  id: c.args.id
772
758
  });
773
759
  return c.ok({ privateKey });
@@ -775,14 +761,14 @@ solana.command("export", {
775
761
  });
776
762
  solana.command("transfer", {
777
763
  description: "Transfer SOL or SPL tokens.",
778
- args: z3.object({
779
- id: z3.string().describe("Account ID (acc_...)")
764
+ args: z2.object({
765
+ id: z2.string().describe("Account ID (acc_...)")
780
766
  }),
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")
767
+ options: z2.object({
768
+ to: z2.string().describe("Destination address (base58)"),
769
+ amount: z2.string().describe("Amount in base units (lamports for SOL)"),
770
+ token: z2.string().optional().describe('Token: "sol" (default), "usdc", or mint address'),
771
+ cluster: z2.enum(["devnet", "mainnet-beta"]).default("mainnet-beta").describe("Cluster: devnet or mainnet-beta")
786
772
  }),
787
773
  examples: [
788
774
  {
@@ -797,12 +783,12 @@ solana.command("transfer", {
797
783
  }
798
784
  ],
799
785
  middleware: [requireWallet],
800
- output: z3.object({
801
- signature: z3.string()
786
+ output: z2.object({
787
+ signature: z2.string()
802
788
  }),
803
789
  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({
790
+ const account = await getOpenfort().accounts.solana.backend.get({ id: c.args.id });
791
+ const res = await getOpenfort().accounts.solana.backend.transfer({
806
792
  account,
807
793
  to: c.options.to,
808
794
  amount: BigInt(c.options.amount),
@@ -813,16 +799,15 @@ solana.command("transfer", {
813
799
  }
814
800
  });
815
801
  var accounts = Cli2.create("accounts", {
816
- description: "Manage wallets and accounts.",
817
- vars: varsSchema
802
+ description: "Manage wallets and accounts."
818
803
  });
819
804
  accounts.command("list", {
820
805
  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")
806
+ options: z2.object({
807
+ limit: z2.number().optional().describe("Max results"),
808
+ skip: z2.number().optional().describe("Offset"),
809
+ chainType: z2.enum(["EVM", "SVM"]).optional().describe("Filter by chain type"),
810
+ custody: z2.enum(["Developer", "User"]).optional().describe("Filter by custody")
826
811
  }),
827
812
  alias: { limit: "l" },
828
813
  examples: [
@@ -830,23 +815,23 @@ accounts.command("list", {
830
815
  { options: { chainType: "EVM" }, description: "Filter to EVM accounts only" },
831
816
  { options: { custody: "Developer", limit: 10 }, description: "List developer-custody wallets" }
832
817
  ],
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()
818
+ output: z2.object({
819
+ data: z2.array(z2.object({
820
+ id: z2.string(),
821
+ wallet: z2.string().describe("Wallet ID"),
822
+ accountType: z2.string().describe("Account type"),
823
+ address: z2.string(),
824
+ ownerAddress: z2.string().optional(),
825
+ chainType: z2.string(),
826
+ chainId: z2.number().optional(),
827
+ custody: z2.string(),
828
+ createdAt: z2.number(),
829
+ updatedAt: z2.number()
845
830
  })),
846
- total: z3.number()
831
+ total: z2.number()
847
832
  }),
848
833
  async run(c) {
849
- const res = await c.var.openfort.accounts.list({
834
+ const res = await getOpenfort().accounts.list({
850
835
  limit: c.options.limit,
851
836
  skip: c.options.skip,
852
837
  chainType: c.options.chainType,
@@ -873,38 +858,37 @@ accounts.command(evm);
873
858
  accounts.command(solana);
874
859
 
875
860
  // 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()
861
+ import { Cli as Cli3, z as z3 } from "incur";
862
+ var contractItem = z3.object({
863
+ id: z3.string(),
864
+ createdAt: z3.number(),
865
+ name: z3.string().nullable(),
866
+ chainId: z3.number(),
867
+ address: z3.string(),
868
+ deleted: z3.boolean(),
869
+ abi: z3.array(z3.record(z3.string(), z3.unknown())),
870
+ publicVerification: z3.boolean()
886
871
  });
887
872
  var contracts = Cli3.create("contracts", {
888
- description: "Manage smart contracts.",
889
- vars: varsSchema
873
+ description: "Manage smart contracts."
890
874
  });
891
875
  contracts.command("list", {
892
876
  description: "List registered contracts.",
893
- options: z4.object({
894
- limit: z4.number().optional().describe("Max results"),
895
- skip: z4.number().optional().describe("Offset")
877
+ options: z3.object({
878
+ limit: z3.number().optional().describe("Max results"),
879
+ skip: z3.number().optional().describe("Offset")
896
880
  }),
897
881
  alias: { limit: "l" },
898
882
  examples: [
899
883
  { description: "List all contracts" },
900
884
  { options: { limit: 5 }, description: "List first 5 contracts" }
901
885
  ],
902
- output: z4.object({
903
- data: z4.array(contractItem),
904
- total: z4.number()
886
+ output: z3.object({
887
+ data: z3.array(contractItem),
888
+ total: z3.number()
905
889
  }),
906
890
  async run(c) {
907
- const res = await c.var.openfort.contracts.list({
891
+ const res = await getOpenfort().contracts.list({
908
892
  limit: c.options.limit,
909
893
  skip: c.options.skip
910
894
  });
@@ -925,11 +909,11 @@ contracts.command("list", {
925
909
  });
926
910
  contracts.command("create", {
927
911
  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")
912
+ options: z3.object({
913
+ name: z3.string().describe("Contract name"),
914
+ address: z3.string().describe("Contract address"),
915
+ chainId: z3.number().describe("Chain ID"),
916
+ abi: z3.string().optional().describe("Contract ABI as JSON string")
933
917
  }),
934
918
  output: contractItem,
935
919
  examples: [
@@ -943,7 +927,7 @@ contracts.command("create", {
943
927
  }
944
928
  ],
945
929
  async run(c) {
946
- const res = await c.var.openfort.contracts.create({
930
+ const res = await getOpenfort().contracts.create({
947
931
  name: c.options.name,
948
932
  address: c.options.address,
949
933
  chainId: c.options.chainId,
@@ -974,15 +958,15 @@ contracts.command("create", {
974
958
  });
975
959
  contracts.command("get", {
976
960
  description: "Get a contract by ID.",
977
- args: z4.object({
978
- id: z4.string().describe("Contract ID (con_...)")
961
+ args: z3.object({
962
+ id: z3.string().describe("Contract ID (con_...)")
979
963
  }),
980
964
  examples: [
981
965
  { args: { id: "con_1a2b3c4d" }, description: "Get contract details" }
982
966
  ],
983
967
  output: contractItem,
984
968
  async run(c) {
985
- const ct = await c.var.openfort.contracts.get(c.args.id);
969
+ const ct = await getOpenfort().contracts.get(c.args.id);
986
970
  return c.ok({
987
971
  id: ct.id,
988
972
  createdAt: ct.createdAt,
@@ -997,21 +981,21 @@ contracts.command("get", {
997
981
  });
998
982
  contracts.command("update", {
999
983
  description: "Update a contract.",
1000
- args: z4.object({
1001
- id: z4.string().describe("Contract ID (con_...)")
984
+ args: z3.object({
985
+ id: z3.string().describe("Contract ID (con_...)")
1002
986
  }),
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")
987
+ options: z3.object({
988
+ name: z3.string().optional().describe("New name"),
989
+ address: z3.string().optional().describe("New address"),
990
+ chainId: z3.number().optional().describe("New chain ID"),
991
+ abi: z3.string().optional().describe("New ABI as JSON string")
1008
992
  }),
1009
993
  examples: [
1010
994
  { args: { id: "con_1a2b3c4d" }, options: { name: "USDC v2" }, description: "Rename a contract" }
1011
995
  ],
1012
996
  output: contractItem,
1013
997
  async run(c) {
1014
- const res = await c.var.openfort.contracts.update(c.args.id, {
998
+ const res = await getOpenfort().contracts.update(c.args.id, {
1015
999
  name: c.options.name,
1016
1000
  address: c.options.address,
1017
1001
  chainId: c.options.chainId,
@@ -1031,48 +1015,47 @@ contracts.command("update", {
1031
1015
  });
1032
1016
  contracts.command("delete", {
1033
1017
  description: "Delete a contract.",
1034
- args: z4.object({
1035
- id: z4.string().describe("Contract ID (con_...)")
1018
+ args: z3.object({
1019
+ id: z3.string().describe("Contract ID (con_...)")
1036
1020
  }),
1037
1021
  examples: [
1038
1022
  { args: { id: "con_1a2b3c4d" }, description: "Delete a contract" }
1039
1023
  ],
1040
- output: z4.object({
1041
- id: z4.string(),
1042
- deleted: z4.boolean()
1024
+ output: z3.object({
1025
+ id: z3.string(),
1026
+ deleted: z3.boolean()
1043
1027
  }),
1044
1028
  async run(c) {
1045
- const res = await c.var.openfort.contracts.delete(c.args.id);
1029
+ const res = await getOpenfort().contracts.delete(c.args.id);
1046
1030
  return c.ok({ id: res.id, deleted: res.deleted });
1047
1031
  }
1048
1032
  });
1049
1033
 
1050
1034
  // 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()
1035
+ import { Cli as Cli4, z as z4 } from "incur";
1036
+ var paymasterItem = z4.object({
1037
+ id: z4.string(),
1038
+ createdAt: z4.number(),
1039
+ address: z4.string(),
1040
+ url: z4.string().optional(),
1041
+ context: z4.record(z4.string(), z4.unknown()).optional()
1058
1042
  });
1059
1043
  var paymasters = Cli4.create("paymasters", {
1060
- description: "Manage ERC-4337 paymasters.",
1061
- vars: varsSchema
1044
+ description: "Manage ERC-4337 paymasters."
1062
1045
  });
1063
1046
  paymasters.command("create", {
1064
1047
  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")
1048
+ options: z4.object({
1049
+ address: z4.string().describe("Paymaster contract address"),
1050
+ name: z4.string().optional().describe("Paymaster name"),
1051
+ url: z4.string().optional().describe("Paymaster URL")
1069
1052
  }),
1070
1053
  examples: [
1071
1054
  { options: { address: "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789", name: "EntryPoint v0.6 Paymaster" }, description: "Create a paymaster for ERC-4337 v0.6" }
1072
1055
  ],
1073
1056
  output: paymasterItem,
1074
1057
  async run(c) {
1075
- const res = await c.var.openfort.paymasters.create({
1058
+ const res = await getOpenfort().paymasters.create({
1076
1059
  address: c.options.address,
1077
1060
  name: c.options.name,
1078
1061
  url: c.options.url
@@ -1099,15 +1082,15 @@ paymasters.command("create", {
1099
1082
  });
1100
1083
  paymasters.command("get", {
1101
1084
  description: "Get a paymaster by ID.",
1102
- args: z5.object({
1103
- id: z5.string().describe("Paymaster ID (pay_...)")
1085
+ args: z4.object({
1086
+ id: z4.string().describe("Paymaster ID (pay_...)")
1104
1087
  }),
1105
1088
  examples: [
1106
1089
  { args: { id: "pay_1a2b3c4d" }, description: "Get paymaster details" }
1107
1090
  ],
1108
1091
  output: paymasterItem,
1109
1092
  async run(c) {
1110
- const p = await c.var.openfort.paymasters.get(c.args.id);
1093
+ const p = await getOpenfort().paymasters.get(c.args.id);
1111
1094
  return c.ok({
1112
1095
  id: p.id,
1113
1096
  createdAt: p.createdAt,
@@ -1119,20 +1102,20 @@ paymasters.command("get", {
1119
1102
  });
1120
1103
  paymasters.command("update", {
1121
1104
  description: "Update a paymaster.",
1122
- args: z5.object({
1123
- id: z5.string().describe("Paymaster ID (pay_...)")
1105
+ args: z4.object({
1106
+ id: z4.string().describe("Paymaster ID (pay_...)")
1124
1107
  }),
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")
1108
+ options: z4.object({
1109
+ address: z4.string().describe("Paymaster address"),
1110
+ name: z4.string().optional().describe("New name"),
1111
+ url: z4.string().optional().describe("New URL")
1129
1112
  }),
1130
1113
  examples: [
1131
1114
  { args: { id: "pay_1a2b3c4d" }, options: { address: "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789", name: "Updated Paymaster" }, description: "Update paymaster name" }
1132
1115
  ],
1133
1116
  output: paymasterItem,
1134
1117
  async run(c) {
1135
- const res = await c.var.openfort.paymasters.update(c.args.id, {
1118
+ const res = await getOpenfort().paymasters.update(c.args.id, {
1136
1119
  address: c.options.address,
1137
1120
  name: c.options.name,
1138
1121
  url: c.options.url
@@ -1148,57 +1131,56 @@ paymasters.command("update", {
1148
1131
  });
1149
1132
  paymasters.command("delete", {
1150
1133
  description: "Delete a paymaster.",
1151
- args: z5.object({
1152
- id: z5.string().describe("Paymaster ID (pay_...)")
1134
+ args: z4.object({
1135
+ id: z4.string().describe("Paymaster ID (pay_...)")
1153
1136
  }),
1154
1137
  examples: [
1155
1138
  { args: { id: "pay_1a2b3c4d" }, description: "Delete a paymaster" }
1156
1139
  ],
1157
- output: z5.object({
1158
- id: z5.string(),
1159
- deleted: z5.boolean()
1140
+ output: z4.object({
1141
+ id: z4.string(),
1142
+ deleted: z4.boolean()
1160
1143
  }),
1161
1144
  async run(c) {
1162
- const res = await c.var.openfort.paymasters.delete(c.args.id);
1145
+ const res = await getOpenfort().paymasters.delete(c.args.id);
1163
1146
  return c.ok({ id: res.id, deleted: res.deleted });
1164
1147
  }
1165
1148
  });
1166
1149
 
1167
1150
  // src/commands/policies.ts
1168
- import { Cli as Cli5, z as z6 } from "incur";
1151
+ import { Cli as Cli5, z as z5 } from "incur";
1169
1152
  var policyScopes = ["project", "account", "transaction"];
1170
1153
  var policies = Cli5.create("policies", {
1171
- description: "Manage rules and conditions for backend wallets and fee sponsorship.",
1172
- vars: varsSchema
1154
+ description: "Manage rules and conditions for backend wallets and fee sponsorship."
1173
1155
  });
1174
1156
  policies.command("list", {
1175
1157
  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")
1158
+ options: z5.object({
1159
+ limit: z5.number().optional().describe("Max results"),
1160
+ skip: z5.number().optional().describe("Offset"),
1161
+ scope: z5.enum(policyScopes).optional().describe("Filter by scope"),
1162
+ enabled: z5.boolean().optional().describe("Filter by enabled status")
1181
1163
  }),
1182
1164
  alias: { limit: "l" },
1183
1165
  examples: [
1184
1166
  { description: "List all policies" },
1185
1167
  { options: { scope: "project", enabled: true }, description: "List enabled project-scope policies" }
1186
1168
  ],
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()
1169
+ output: z5.object({
1170
+ data: z5.array(z5.object({
1171
+ id: z5.string(),
1172
+ createdAt: z5.number(),
1173
+ scope: z5.string(),
1174
+ description: z5.string().nullable(),
1175
+ accountId: z5.string().nullable(),
1176
+ enabled: z5.boolean(),
1177
+ priority: z5.number()
1196
1178
  })),
1197
- total: z6.number()
1179
+ total: z5.number()
1198
1180
  }),
1199
1181
  async run(c) {
1200
1182
  const scopeFilter = c.options.scope ? [c.options.scope] : void 0;
1201
- const res = await c.var.openfort.policies.list({
1183
+ const res = await getOpenfort().policies.list({
1202
1184
  limit: c.options.limit,
1203
1185
  skip: c.options.skip,
1204
1186
  scope: scopeFilter,
@@ -1220,19 +1202,19 @@ policies.command("list", {
1220
1202
  });
1221
1203
  policies.command("create", {
1222
1204
  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")
1205
+ options: z5.object({
1206
+ scope: z5.enum(policyScopes).describe("Policy scope"),
1207
+ description: z5.string().optional().describe("Policy description"),
1208
+ priority: z5.number().optional().describe("Priority (higher = evaluated first)"),
1209
+ rules: z5.string().describe("Rules as JSON string")
1228
1210
  }),
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()
1211
+ output: z5.object({
1212
+ id: z5.string(),
1213
+ createdAt: z5.number(),
1214
+ scope: z5.string(),
1215
+ description: z5.string().nullable(),
1216
+ enabled: z5.boolean(),
1217
+ priority: z5.number()
1236
1218
  }),
1237
1219
  examples: [
1238
1220
  {
@@ -1254,7 +1236,7 @@ policies.command("create", {
1254
1236
  async run(c) {
1255
1237
  const rules = JSON.parse(c.options.rules);
1256
1238
  const scope = c.options.scope;
1257
- const res = await c.var.openfort.policies.create({
1239
+ const res = await getOpenfort().policies.create({
1258
1240
  scope,
1259
1241
  description: c.options.description,
1260
1242
  priority: c.options.priority,
@@ -1283,24 +1265,24 @@ policies.command("create", {
1283
1265
  });
1284
1266
  policies.command("get", {
1285
1267
  description: "Get a policy by ID.",
1286
- args: z6.object({
1287
- id: z6.string().describe("Policy ID (ply_...)")
1268
+ args: z5.object({
1269
+ id: z5.string().describe("Policy ID (ply_...)")
1288
1270
  }),
1289
1271
  examples: [
1290
1272
  { args: { id: "ply_1a2b3c4d" }, description: "Get policy details with rules" }
1291
1273
  ],
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()))
1274
+ output: z5.object({
1275
+ id: z5.string(),
1276
+ createdAt: z5.number(),
1277
+ scope: z5.string(),
1278
+ description: z5.string().nullable(),
1279
+ accountId: z5.string().nullable(),
1280
+ enabled: z5.boolean(),
1281
+ priority: z5.number(),
1282
+ rules: z5.array(z5.record(z5.string(), z5.unknown()))
1301
1283
  }),
1302
1284
  async run(c) {
1303
- const p = await c.var.openfort.policies.get(c.args.id);
1285
+ const p = await getOpenfort().policies.get(c.args.id);
1304
1286
  return c.ok({
1305
1287
  id: p.id,
1306
1288
  createdAt: p.createdAt,
@@ -1315,29 +1297,29 @@ policies.command("get", {
1315
1297
  });
1316
1298
  policies.command("update", {
1317
1299
  description: "Update a policy.",
1318
- args: z6.object({
1319
- id: z6.string().describe("Policy ID (ply_...)")
1300
+ args: z5.object({
1301
+ id: z5.string().describe("Policy ID (ply_...)")
1320
1302
  }),
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")
1303
+ options: z5.object({
1304
+ description: z5.string().optional().describe("New description"),
1305
+ enabled: z5.boolean().optional().describe("Enable or disable"),
1306
+ priority: z5.number().optional().describe("New priority"),
1307
+ rules: z5.string().optional().describe("New rules as JSON string")
1326
1308
  }),
1327
1309
  examples: [
1328
1310
  { args: { id: "ply_1a2b3c4d" }, options: { enabled: false }, description: "Disable a policy" },
1329
1311
  { args: { id: "ply_1a2b3c4d" }, options: { priority: 10 }, description: "Change policy priority" }
1330
1312
  ],
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()
1313
+ output: z5.object({
1314
+ id: z5.string(),
1315
+ createdAt: z5.number(),
1316
+ scope: z5.string(),
1317
+ description: z5.string().nullable(),
1318
+ enabled: z5.boolean(),
1319
+ priority: z5.number()
1338
1320
  }),
1339
1321
  async run(c) {
1340
- const res = await c.var.openfort.policies.update(c.args.id, {
1322
+ const res = await getOpenfort().policies.update(c.args.id, {
1341
1323
  description: c.options.description,
1342
1324
  enabled: c.options.enabled,
1343
1325
  priority: c.options.priority,
@@ -1355,41 +1337,41 @@ policies.command("update", {
1355
1337
  });
1356
1338
  policies.command("delete", {
1357
1339
  description: "Delete a policy.",
1358
- args: z6.object({
1359
- id: z6.string().describe("Policy ID (ply_...)")
1340
+ args: z5.object({
1341
+ id: z5.string().describe("Policy ID (ply_...)")
1360
1342
  }),
1361
1343
  examples: [
1362
1344
  { args: { id: "ply_1a2b3c4d" }, description: "Delete a policy" }
1363
1345
  ],
1364
- output: z6.object({
1365
- id: z6.string(),
1366
- deleted: z6.boolean()
1346
+ output: z5.object({
1347
+ id: z5.string(),
1348
+ deleted: z5.boolean()
1367
1349
  }),
1368
1350
  async run(c) {
1369
- const res = await c.var.openfort.policies.delete(c.args.id);
1351
+ const res = await getOpenfort().policies.delete(c.args.id);
1370
1352
  return c.ok({ id: res.id, deleted: res.deleted });
1371
1353
  }
1372
1354
  });
1373
1355
  policies.command("evaluate", {
1374
1356
  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")
1357
+ options: z5.object({
1358
+ operation: z5.string().describe("Operation to evaluate (e.g. signEvmTransaction)"),
1359
+ accountId: z5.string().optional().describe("Account ID")
1378
1360
  }),
1379
1361
  examples: [
1380
1362
  { options: { operation: "signEvmTransaction", accountId: "acc_1a2b3c4d" }, description: "Check if EVM signing is allowed" },
1381
1363
  { options: { operation: "sponsorEvmTransaction" }, description: "Check if gas sponsorship is allowed" }
1382
1364
  ],
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()
1365
+ output: z5.object({
1366
+ allowed: z5.boolean(),
1367
+ reason: z5.string(),
1368
+ operation: z5.string(),
1369
+ accountId: z5.string().optional(),
1370
+ matchedPolicyId: z5.string().optional(),
1371
+ matchedRuleId: z5.string().optional()
1390
1372
  }),
1391
1373
  async run(c) {
1392
- const res = await c.var.openfort.policies.evaluate({
1374
+ const res = await getOpenfort().policies.evaluate({
1393
1375
  operation: c.options.operation,
1394
1376
  accountId: c.options.accountId
1395
1377
  });
@@ -1405,45 +1387,44 @@ policies.command("evaluate", {
1405
1387
  });
1406
1388
 
1407
1389
  // src/commands/sponsorship.ts
1408
- import { Cli as Cli6, z as z7 } from "incur";
1390
+ import { Cli as Cli6, z as z6 } from "incur";
1409
1391
  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()
1392
+ var sponsorshipItem = z6.object({
1393
+ id: z6.string(),
1394
+ createdAt: z6.number(),
1395
+ name: z6.string().nullable(),
1396
+ chainId: z6.number().nullable(),
1397
+ enabled: z6.boolean(),
1398
+ strategy: z6.object({
1399
+ sponsorSchema: z6.string(),
1400
+ tokenContract: z6.string().optional(),
1401
+ tokenContractAmount: z6.string().optional(),
1402
+ dynamicExchangeRate: z6.boolean().optional()
1403
+ }),
1404
+ paymasterId: z6.string().nullable(),
1405
+ policyId: z6.string().nullable()
1424
1406
  });
1425
1407
  var sponsorship = Cli6.create("sponsorship", {
1426
- description: "Manage fee sponsorship strategies linked to policies.",
1427
- vars: varsSchema
1408
+ description: "Manage fee sponsorship strategies linked to policies."
1428
1409
  });
1429
1410
  sponsorship.command("list", {
1430
1411
  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")
1412
+ options: z6.object({
1413
+ limit: z6.number().optional().describe("Max results"),
1414
+ skip: z6.number().optional().describe("Offset"),
1415
+ enabled: z6.boolean().optional().describe("Filter by enabled status")
1435
1416
  }),
1436
1417
  alias: { limit: "l" },
1437
1418
  examples: [
1438
1419
  { description: "List all sponsorships" },
1439
1420
  { options: { enabled: true }, description: "List active sponsorships only" }
1440
1421
  ],
1441
- output: z7.object({
1442
- data: z7.array(sponsorshipItem),
1443
- total: z7.number()
1422
+ output: z6.object({
1423
+ data: z6.array(sponsorshipItem),
1424
+ total: z6.number()
1444
1425
  }),
1445
1426
  async run(c) {
1446
- const res = await c.var.openfort.feeSponsorship.list({
1427
+ const res = await getOpenfort().feeSponsorship.list({
1447
1428
  limit: c.options.limit,
1448
1429
  skip: c.options.skip,
1449
1430
  enabled: c.options.enabled
@@ -1465,11 +1446,11 @@ sponsorship.command("list", {
1465
1446
  });
1466
1447
  sponsorship.command("create", {
1467
1448
  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")
1449
+ options: z6.object({
1450
+ policyId: z6.string().describe("Policy ID to link (ply_...)"),
1451
+ name: z6.string().optional().describe("Sponsorship name"),
1452
+ strategy: z6.enum(sponsorSchemas).default("pay_for_user").describe("Sponsorship strategy"),
1453
+ chainId: z6.number().optional().describe("Chain ID")
1473
1454
  }),
1474
1455
  output: sponsorshipItem,
1475
1456
  examples: [
@@ -1484,7 +1465,7 @@ sponsorship.command("create", {
1484
1465
  ],
1485
1466
  async run(c) {
1486
1467
  const strategy = { sponsorSchema: c.options.strategy };
1487
- const res = await c.var.openfort.feeSponsorship.create({
1468
+ const res = await getOpenfort().feeSponsorship.create({
1488
1469
  policyId: c.options.policyId,
1489
1470
  name: c.options.name,
1490
1471
  strategy,
@@ -1515,15 +1496,15 @@ sponsorship.command("create", {
1515
1496
  });
1516
1497
  sponsorship.command("get", {
1517
1498
  description: "Get a fee sponsorship by ID.",
1518
- args: z7.object({
1519
- id: z7.string().describe("Fee sponsorship ID (pol_...)")
1499
+ args: z6.object({
1500
+ id: z6.string().describe("Fee sponsorship ID (pol_...)")
1520
1501
  }),
1521
1502
  examples: [
1522
1503
  { args: { id: "pol_1a2b3c4d" }, description: "Get sponsorship details" }
1523
1504
  ],
1524
1505
  output: sponsorshipItem,
1525
1506
  async run(c) {
1526
- const s = await c.var.openfort.feeSponsorship.get(c.args.id);
1507
+ const s = await getOpenfort().feeSponsorship.get(c.args.id);
1527
1508
  return c.ok({
1528
1509
  id: s.id,
1529
1510
  createdAt: s.createdAt,
@@ -1538,13 +1519,13 @@ sponsorship.command("get", {
1538
1519
  });
1539
1520
  sponsorship.command("update", {
1540
1521
  description: "Update a fee sponsorship.",
1541
- args: z7.object({
1542
- id: z7.string().describe("Fee sponsorship ID (pol_...)")
1522
+ args: z6.object({
1523
+ id: z6.string().describe("Fee sponsorship ID (pol_...)")
1543
1524
  }),
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")
1525
+ options: z6.object({
1526
+ name: z6.string().optional().describe("New name"),
1527
+ strategy: z6.enum(sponsorSchemas).optional().describe("New strategy"),
1528
+ policyId: z6.string().optional().describe("New policy ID")
1548
1529
  }),
1549
1530
  examples: [
1550
1531
  { args: { id: "pol_1a2b3c4d" }, options: { name: "Mainnet Gas Sponsor" }, description: "Rename a sponsorship" }
@@ -1552,7 +1533,7 @@ sponsorship.command("update", {
1552
1533
  output: sponsorshipItem,
1553
1534
  async run(c) {
1554
1535
  const strategy = c.options.strategy ? { sponsorSchema: c.options.strategy } : void 0;
1555
- const res = await c.var.openfort.feeSponsorship.update(c.args.id, {
1536
+ const res = await getOpenfort().feeSponsorship.update(c.args.id, {
1556
1537
  name: c.options.name,
1557
1538
  strategy,
1558
1539
  policyId: c.options.policyId
@@ -1571,15 +1552,15 @@ sponsorship.command("update", {
1571
1552
  });
1572
1553
  sponsorship.command("enable", {
1573
1554
  description: "Enable a fee sponsorship.",
1574
- args: z7.object({
1575
- id: z7.string().describe("Fee sponsorship ID (pol_...)")
1555
+ args: z6.object({
1556
+ id: z6.string().describe("Fee sponsorship ID (pol_...)")
1576
1557
  }),
1577
1558
  examples: [
1578
1559
  { args: { id: "pol_1a2b3c4d" }, description: "Enable a sponsorship" }
1579
1560
  ],
1580
1561
  output: sponsorshipItem,
1581
1562
  async run(c) {
1582
- const res = await c.var.openfort.feeSponsorship.enable(c.args.id);
1563
+ const res = await getOpenfort().feeSponsorship.enable(c.args.id);
1583
1564
  return c.ok({
1584
1565
  id: res.id,
1585
1566
  createdAt: res.createdAt,
@@ -1594,15 +1575,15 @@ sponsorship.command("enable", {
1594
1575
  });
1595
1576
  sponsorship.command("disable", {
1596
1577
  description: "Disable a fee sponsorship.",
1597
- args: z7.object({
1598
- id: z7.string().describe("Fee sponsorship ID (pol_...)")
1578
+ args: z6.object({
1579
+ id: z6.string().describe("Fee sponsorship ID (pol_...)")
1599
1580
  }),
1600
1581
  examples: [
1601
1582
  { args: { id: "pol_1a2b3c4d" }, description: "Disable a sponsorship" }
1602
1583
  ],
1603
1584
  output: sponsorshipItem,
1604
1585
  async run(c) {
1605
- const res = await c.var.openfort.feeSponsorship.disable(c.args.id);
1586
+ const res = await getOpenfort().feeSponsorship.disable(c.args.id);
1606
1587
  return c.ok({
1607
1588
  id: res.id,
1608
1589
  createdAt: res.createdAt,
@@ -1617,24 +1598,24 @@ sponsorship.command("disable", {
1617
1598
  });
1618
1599
  sponsorship.command("delete", {
1619
1600
  description: "Delete a fee sponsorship.",
1620
- args: z7.object({
1621
- id: z7.string().describe("Fee sponsorship ID (pol_...)")
1601
+ args: z6.object({
1602
+ id: z6.string().describe("Fee sponsorship ID (pol_...)")
1622
1603
  }),
1623
1604
  examples: [
1624
1605
  { args: { id: "pol_1a2b3c4d" }, description: "Delete a sponsorship" }
1625
1606
  ],
1626
- output: z7.object({
1627
- id: z7.string(),
1628
- deleted: z7.boolean()
1607
+ output: z6.object({
1608
+ id: z6.string(),
1609
+ deleted: z6.boolean()
1629
1610
  }),
1630
1611
  async run(c) {
1631
- const res = await c.var.openfort.feeSponsorship.delete(c.args.id);
1612
+ const res = await getOpenfort().feeSponsorship.delete(c.args.id);
1632
1613
  return c.ok({ id: res.id, deleted: res.deleted });
1633
1614
  }
1634
1615
  });
1635
1616
 
1636
1617
  // src/commands/subscriptions.ts
1637
- import { Cli as Cli7, z as z8 } from "incur";
1618
+ import { Cli as Cli7, z as z7 } from "incur";
1638
1619
  var apiTopics = [
1639
1620
  "transaction_intent.broadcast",
1640
1621
  "transaction_intent.successful",
@@ -1651,27 +1632,26 @@ var apiTopics = [
1651
1632
  ];
1652
1633
  var apiTriggerTypes = ["webhook", "email"];
1653
1634
  var triggers = Cli7.create("triggers", {
1654
- description: "Manage subscription triggers.",
1655
- vars: varsSchema
1635
+ description: "Manage subscription triggers."
1656
1636
  });
1657
1637
  triggers.command("list", {
1658
1638
  description: "List triggers for a subscription.",
1659
- args: z8.object({
1660
- subscriptionId: z8.string().describe("Subscription ID (sub_...)")
1639
+ args: z7.object({
1640
+ subscriptionId: z7.string().describe("Subscription ID (sub_...)")
1661
1641
  }),
1662
1642
  examples: [
1663
1643
  { args: { subscriptionId: "sub_1a2b3c4d" }, description: "List triggers" }
1664
1644
  ],
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()
1645
+ output: z7.object({
1646
+ data: z7.array(z7.object({
1647
+ id: z7.string(),
1648
+ createdAt: z7.number(),
1649
+ target: z7.string(),
1650
+ type: z7.string()
1671
1651
  }))
1672
1652
  }),
1673
1653
  async run(c) {
1674
- const res = await c.var.openfort.triggers.list(c.args.subscriptionId);
1654
+ const res = await getOpenfort().triggers.list(c.args.subscriptionId);
1675
1655
  return c.ok({
1676
1656
  data: res.data.map((t) => ({
1677
1657
  id: t.id,
@@ -1684,12 +1664,12 @@ triggers.command("list", {
1684
1664
  });
1685
1665
  triggers.command("create", {
1686
1666
  description: "Create a trigger for a subscription.",
1687
- args: z8.object({
1688
- subscriptionId: z8.string().describe("Subscription ID (sub_...)")
1667
+ args: z7.object({
1668
+ subscriptionId: z7.string().describe("Subscription ID (sub_...)")
1689
1669
  }),
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")
1670
+ options: z7.object({
1671
+ target: z7.string().describe("Webhook URL or email address"),
1672
+ type: z7.enum(apiTriggerTypes).default("webhook").describe("Trigger type: webhook or email")
1693
1673
  }),
1694
1674
  examples: [
1695
1675
  {
@@ -1698,14 +1678,14 @@ triggers.command("create", {
1698
1678
  description: "Create a webhook trigger"
1699
1679
  }
1700
1680
  ],
1701
- output: z8.object({
1702
- id: z8.string(),
1703
- createdAt: z8.number(),
1704
- target: z8.string(),
1705
- type: z8.string()
1681
+ output: z7.object({
1682
+ id: z7.string(),
1683
+ createdAt: z7.number(),
1684
+ target: z7.string(),
1685
+ type: z7.string()
1706
1686
  }),
1707
1687
  async run(c) {
1708
- const res = await c.var.openfort.triggers.create(c.args.subscriptionId, {
1688
+ const res = await getOpenfort().triggers.create(c.args.subscriptionId, {
1709
1689
  target: c.options.target,
1710
1690
  type: c.options.type
1711
1691
  });
@@ -1719,21 +1699,21 @@ triggers.command("create", {
1719
1699
  });
1720
1700
  triggers.command("get", {
1721
1701
  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_...)")
1702
+ args: z7.object({
1703
+ subscriptionId: z7.string().describe("Subscription ID (sub_...)"),
1704
+ triggerId: z7.string().describe("Trigger ID (tri_...)")
1725
1705
  }),
1726
1706
  examples: [
1727
1707
  { args: { subscriptionId: "sub_1a2b3c4d", triggerId: "tri_1a2b3c4d" }, description: "Get trigger details" }
1728
1708
  ],
1729
- output: z8.object({
1730
- id: z8.string(),
1731
- createdAt: z8.number(),
1732
- target: z8.string(),
1733
- type: z8.string()
1709
+ output: z7.object({
1710
+ id: z7.string(),
1711
+ createdAt: z7.number(),
1712
+ target: z7.string(),
1713
+ type: z7.string()
1734
1714
  }),
1735
1715
  async run(c) {
1736
- const t = await c.var.openfort.triggers.get(c.args.subscriptionId, c.args.triggerId);
1716
+ const t = await getOpenfort().triggers.get(c.args.subscriptionId, c.args.triggerId);
1737
1717
  return c.ok({
1738
1718
  id: t.id,
1739
1719
  createdAt: t.createdAt,
@@ -1744,46 +1724,45 @@ triggers.command("get", {
1744
1724
  });
1745
1725
  triggers.command("delete", {
1746
1726
  description: "Delete a trigger.",
1747
- args: z8.object({
1748
- subscriptionId: z8.string().describe("Subscription ID (sub_...)"),
1749
- triggerId: z8.string().describe("Trigger ID (tri_...)")
1727
+ args: z7.object({
1728
+ subscriptionId: z7.string().describe("Subscription ID (sub_...)"),
1729
+ triggerId: z7.string().describe("Trigger ID (tri_...)")
1750
1730
  }),
1751
1731
  examples: [
1752
1732
  { args: { subscriptionId: "sub_1a2b3c4d", triggerId: "tri_1a2b3c4d" }, description: "Delete a trigger" }
1753
1733
  ],
1754
- output: z8.object({
1755
- id: z8.string(),
1756
- deleted: z8.boolean()
1734
+ output: z7.object({
1735
+ id: z7.string(),
1736
+ deleted: z7.boolean()
1757
1737
  }),
1758
1738
  async run(c) {
1759
- const res = await c.var.openfort.triggers.delete(c.args.subscriptionId, c.args.triggerId);
1739
+ const res = await getOpenfort().triggers.delete(c.args.subscriptionId, c.args.triggerId);
1760
1740
  return c.ok({ id: res.id, deleted: res.deleted });
1761
1741
  }
1762
1742
  });
1763
1743
  var subscriptions = Cli7.create("subscriptions", {
1764
- description: "Manage webhook subscriptions.",
1765
- vars: varsSchema
1744
+ description: "Manage webhook subscriptions."
1766
1745
  });
1767
1746
  subscriptions.command("list", {
1768
1747
  description: "List webhook subscriptions.",
1769
1748
  examples: [
1770
1749
  { description: "List all subscriptions" }
1771
1750
  ],
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()
1751
+ output: z7.object({
1752
+ data: z7.array(z7.object({
1753
+ id: z7.string(),
1754
+ createdAt: z7.number(),
1755
+ topic: z7.string(),
1756
+ triggers: z7.array(z7.object({
1757
+ id: z7.string(),
1758
+ target: z7.string(),
1759
+ type: z7.string()
1781
1760
  }))
1782
1761
  })),
1783
- total: z8.number()
1762
+ total: z7.number()
1784
1763
  }),
1785
1764
  async run(c) {
1786
- const res = await c.var.openfort.subscriptions.list();
1765
+ const res = await getOpenfort().subscriptions.list();
1787
1766
  return c.ok({
1788
1767
  data: res.data.map((s) => ({
1789
1768
  id: s.id,
@@ -1797,9 +1776,9 @@ subscriptions.command("list", {
1797
1776
  });
1798
1777
  subscriptions.command("create", {
1799
1778
  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://..."}]')
1779
+ options: z7.object({
1780
+ topic: z7.enum(apiTopics).describe("Event topic (e.g. transaction_intent.successful, user.created)"),
1781
+ triggers: z7.string().describe('Triggers as JSON: [{"type":"webhook","target":"https://..."}]')
1803
1782
  }),
1804
1783
  examples: [
1805
1784
  {
@@ -1810,19 +1789,19 @@ subscriptions.command("create", {
1810
1789
  description: "Get notified when transactions succeed"
1811
1790
  }
1812
1791
  ],
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()
1792
+ output: z7.object({
1793
+ id: z7.string(),
1794
+ createdAt: z7.number(),
1795
+ topic: z7.string(),
1796
+ triggers: z7.array(z7.object({
1797
+ id: z7.string(),
1798
+ target: z7.string(),
1799
+ type: z7.string()
1821
1800
  }))
1822
1801
  }),
1823
1802
  async run(c) {
1824
1803
  const parsedTriggers = JSON.parse(c.options.triggers);
1825
- const res = await c.var.openfort.subscriptions.create({
1804
+ const res = await getOpenfort().subscriptions.create({
1826
1805
  topic: c.options.topic,
1827
1806
  triggers: parsedTriggers
1828
1807
  });
@@ -1847,24 +1826,24 @@ subscriptions.command("create", {
1847
1826
  });
1848
1827
  subscriptions.command("get", {
1849
1828
  description: "Get a subscription by ID.",
1850
- args: z8.object({
1851
- id: z8.string().describe("Subscription ID (sub_...)")
1829
+ args: z7.object({
1830
+ id: z7.string().describe("Subscription ID (sub_...)")
1852
1831
  }),
1853
1832
  examples: [
1854
1833
  { args: { id: "sub_1a2b3c4d" }, description: "Get subscription details" }
1855
1834
  ],
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()
1835
+ output: z7.object({
1836
+ id: z7.string(),
1837
+ createdAt: z7.number(),
1838
+ topic: z7.string(),
1839
+ triggers: z7.array(z7.object({
1840
+ id: z7.string(),
1841
+ target: z7.string(),
1842
+ type: z7.string()
1864
1843
  }))
1865
1844
  }),
1866
1845
  async run(c) {
1867
- const s = await c.var.openfort.subscriptions.get(c.args.id);
1846
+ const s = await getOpenfort().subscriptions.get(c.args.id);
1868
1847
  return c.ok({
1869
1848
  id: s.id,
1870
1849
  createdAt: s.createdAt,
@@ -1875,65 +1854,64 @@ subscriptions.command("get", {
1875
1854
  });
1876
1855
  subscriptions.command("delete", {
1877
1856
  description: "Delete a subscription.",
1878
- args: z8.object({
1879
- id: z8.string().describe("Subscription ID (sub_...)")
1857
+ args: z7.object({
1858
+ id: z7.string().describe("Subscription ID (sub_...)")
1880
1859
  }),
1881
1860
  examples: [
1882
1861
  { args: { id: "sub_1a2b3c4d" }, description: "Delete a subscription" }
1883
1862
  ],
1884
- output: z8.object({
1885
- id: z8.string(),
1886
- deleted: z8.boolean()
1863
+ output: z7.object({
1864
+ id: z7.string(),
1865
+ deleted: z7.boolean()
1887
1866
  }),
1888
1867
  async run(c) {
1889
- const res = await c.var.openfort.subscriptions.delete(c.args.id);
1868
+ const res = await getOpenfort().subscriptions.delete(c.args.id);
1890
1869
  return c.ok({ id: res.id, deleted: res.deleted });
1891
1870
  }
1892
1871
  });
1893
1872
  subscriptions.command(triggers);
1894
1873
 
1895
1874
  // 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()
1875
+ import { Cli as Cli8, z as z8 } from "incur";
1876
+ var sessionItem = z8.object({
1877
+ id: z8.string(),
1878
+ createdAt: z8.number(),
1879
+ updatedAt: z8.number(),
1880
+ address: z8.string(),
1881
+ validAfter: z8.string(),
1882
+ validUntil: z8.string(),
1883
+ whitelist: z8.array(z8.string()).optional(),
1884
+ isActive: z8.boolean(),
1885
+ nextAction: z8.object({
1886
+ type: z8.string(),
1887
+ payload: z8.record(z8.string(), z8.unknown()).optional()
1909
1888
  }).optional()
1910
1889
  });
1911
1890
  var sessions = Cli8.create("sessions", {
1912
- description: "Manage session keys.",
1913
- vars: varsSchema
1891
+ description: "Manage session keys."
1914
1892
  });
1915
1893
  sessions.command("list", {
1916
1894
  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")
1895
+ options: z8.object({
1896
+ player: z8.string().describe("Player ID (pla_...)"),
1897
+ limit: z8.number().optional().describe("Max results"),
1898
+ skip: z8.number().optional().describe("Offset")
1921
1899
  }),
1922
1900
  alias: { limit: "l" },
1923
1901
  examples: [
1924
1902
  { options: { player: "pla_1a2b3c4d" }, description: "List sessions for a player" }
1925
1903
  ],
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()
1904
+ output: z8.object({
1905
+ data: z8.array(z8.object({
1906
+ id: z8.string(),
1907
+ createdAt: z8.number(),
1908
+ address: z8.string(),
1909
+ isActive: z8.boolean()
1932
1910
  })),
1933
- total: z9.number()
1911
+ total: z8.number()
1934
1912
  }),
1935
1913
  async run(c) {
1936
- const res = await c.var.openfort.sessions.list({
1914
+ const res = await getOpenfort().sessions.list({
1937
1915
  player: c.options.player,
1938
1916
  limit: c.options.limit,
1939
1917
  skip: c.options.skip
@@ -1951,16 +1929,16 @@ sessions.command("list", {
1951
1929
  });
1952
1930
  sessions.command("create", {
1953
1931
  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")
1932
+ options: z8.object({
1933
+ address: z8.string().describe("Session key address"),
1934
+ chainId: z8.number().describe("Chain ID"),
1935
+ validAfter: z8.number().describe("Valid after (unix timestamp in seconds)"),
1936
+ validUntil: z8.number().describe("Valid until (unix timestamp in seconds)"),
1937
+ player: z8.string().optional().describe("Player ID (pla_...)"),
1938
+ account: z8.string().optional().describe("Account ID (acc_...)"),
1939
+ limit: z8.number().optional().describe("Max session uses"),
1940
+ policy: z8.string().optional().describe("Fee sponsorship ID (pol_...)"),
1941
+ whitelist: z8.string().optional().describe("Whitelisted contract addresses as JSON array")
1964
1942
  }),
1965
1943
  examples: [
1966
1944
  {
@@ -1976,7 +1954,7 @@ sessions.command("create", {
1976
1954
  ],
1977
1955
  output: sessionItem,
1978
1956
  async run(c) {
1979
- const res = await c.var.openfort.sessions.create({
1957
+ const res = await getOpenfort().sessions.create({
1980
1958
  address: c.options.address,
1981
1959
  chainId: c.options.chainId,
1982
1960
  validAfter: c.options.validAfter,
@@ -2012,15 +1990,15 @@ sessions.command("create", {
2012
1990
  });
2013
1991
  sessions.command("get", {
2014
1992
  description: "Get a session key by ID.",
2015
- args: z9.object({
2016
- id: z9.string().describe("Session ID (ses_...)")
1993
+ args: z8.object({
1994
+ id: z8.string().describe("Session ID (ses_...)")
2017
1995
  }),
2018
1996
  examples: [
2019
1997
  { args: { id: "ses_1a2b3c4d" }, description: "Get session details" }
2020
1998
  ],
2021
1999
  output: sessionItem,
2022
2000
  async run(c) {
2023
- const s = await c.var.openfort.sessions.get(c.args.id);
2001
+ const s = await getOpenfort().sessions.get(c.args.id);
2024
2002
  return c.ok({
2025
2003
  id: s.id,
2026
2004
  createdAt: s.createdAt,
@@ -2036,18 +2014,18 @@ sessions.command("get", {
2036
2014
  });
2037
2015
  sessions.command("revoke", {
2038
2016
  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_...)")
2017
+ options: z8.object({
2018
+ address: z8.string().describe("Session key address to revoke"),
2019
+ chainId: z8.number().describe("Chain ID"),
2020
+ player: z8.string().optional().describe("Player ID (pla_...)"),
2021
+ policy: z8.string().optional().describe("Fee sponsorship ID (pol_...)")
2044
2022
  }),
2045
2023
  examples: [
2046
2024
  { options: { address: "0x1234...", chainId: 137 }, description: "Revoke a session key" }
2047
2025
  ],
2048
2026
  output: sessionItem,
2049
2027
  async run(c) {
2050
- const res = await c.var.openfort.sessions.revoke({
2028
+ const res = await getOpenfort().sessions.revoke({
2051
2029
  address: c.options.address,
2052
2030
  chainId: c.options.chainId,
2053
2031
  player: c.options.player,
@@ -2068,19 +2046,19 @@ sessions.command("revoke", {
2068
2046
  });
2069
2047
  sessions.command("sign", {
2070
2048
  description: "Sign and broadcast a session userOperationHash.",
2071
- args: z9.object({
2072
- id: z9.string().describe("Session ID (ses_...)")
2049
+ args: z8.object({
2050
+ id: z8.string().describe("Session ID (ses_...)")
2073
2051
  }),
2074
- options: z9.object({
2075
- signature: z9.string().describe("Hex signature"),
2076
- optimistic: z9.boolean().optional().describe("Return before on-chain confirmation")
2052
+ options: z8.object({
2053
+ signature: z8.string().describe("Hex signature"),
2054
+ optimistic: z8.boolean().optional().describe("Return before on-chain confirmation")
2077
2055
  }),
2078
2056
  examples: [
2079
2057
  { args: { id: "ses_1a2b3c4d" }, options: { signature: "0xabcd1234..." }, description: "Sign a session" }
2080
2058
  ],
2081
2059
  output: sessionItem,
2082
2060
  async run(c) {
2083
- const res = await c.var.openfort.sessions.signature(c.args.id, {
2061
+ const res = await getOpenfort().sessions.signature(c.args.id, {
2084
2062
  signature: c.options.signature,
2085
2063
  optimistic: c.options.optimistic
2086
2064
  });
@@ -2099,61 +2077,60 @@ sessions.command("sign", {
2099
2077
  });
2100
2078
 
2101
2079
  // 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()
2080
+ import { Cli as Cli9, z as z9 } from "incur";
2081
+ var transactionIntentItem = z9.object({
2082
+ id: z9.string(),
2083
+ createdAt: z9.number(),
2084
+ updatedAt: z9.number(),
2085
+ chainId: z9.number(),
2086
+ abstractionType: z9.string().describe("e.g. accountAbstractionV6, standard"),
2087
+ userOperationHash: z9.string().optional(),
2088
+ response: z9.object({
2089
+ createdAt: z9.number(),
2090
+ blockNumber: z9.number().optional(),
2091
+ transactionHash: z9.string().optional(),
2092
+ gasUsed: z9.string().optional(),
2093
+ gasFee: z9.string().optional(),
2094
+ status: z9.number().optional(),
2095
+ to: z9.string().optional(),
2096
+ error: z9.record(z9.string(), z9.unknown()).optional()
2119
2097
  }).optional(),
2120
- interactions: z10.array(z10.object({
2121
- to: z10.string().optional(),
2122
- data: z10.string().optional(),
2123
- value: z10.string().optional()
2098
+ interactions: z9.array(z9.object({
2099
+ to: z9.string().optional(),
2100
+ data: z9.string().optional(),
2101
+ value: z9.string().optional()
2124
2102
  })).optional(),
2125
- nextAction: z10.object({
2126
- type: z10.string(),
2127
- payload: z10.record(z10.string(), z10.unknown()).optional()
2103
+ nextAction: z9.object({
2104
+ type: z9.string(),
2105
+ payload: z9.record(z9.string(), z9.unknown()).optional()
2128
2106
  }).optional()
2129
2107
  });
2130
2108
  var transactions = Cli9.create("transactions", {
2131
- description: "Manage transaction intents.",
2132
- vars: varsSchema
2109
+ description: "Manage transaction intents."
2133
2110
  });
2134
2111
  transactions.command("list", {
2135
2112
  description: "List transaction intents.",
2136
- options: z10.object({
2137
- limit: z10.number().optional().describe("Max results"),
2138
- skip: z10.number().optional().describe("Offset")
2113
+ options: z9.object({
2114
+ limit: z9.number().optional().describe("Max results"),
2115
+ skip: z9.number().optional().describe("Offset")
2139
2116
  }),
2140
2117
  alias: { limit: "l" },
2141
2118
  examples: [
2142
2119
  { description: "List all transactions" },
2143
2120
  { options: { limit: 10 }, description: "List last 10 transactions" }
2144
2121
  ],
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()
2122
+ output: z9.object({
2123
+ data: z9.array(z9.object({
2124
+ id: z9.string(),
2125
+ createdAt: z9.number(),
2126
+ updatedAt: z9.number(),
2127
+ chainId: z9.number(),
2128
+ abstractionType: z9.string()
2152
2129
  })),
2153
- total: z10.number()
2130
+ total: z9.number()
2154
2131
  }),
2155
2132
  async run(c) {
2156
- const res = await c.var.openfort.transactionIntents.list({
2133
+ const res = await getOpenfort().transactionIntents.list({
2157
2134
  limit: c.options.limit,
2158
2135
  skip: c.options.skip
2159
2136
  });
@@ -2171,12 +2148,12 @@ transactions.command("list", {
2171
2148
  });
2172
2149
  transactions.command("create", {
2173
2150
  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)")
2151
+ options: z9.object({
2152
+ account: z9.string().describe("Account ID (acc_...)"),
2153
+ chainId: z9.number().describe("Chain ID"),
2154
+ interactions: z9.string().describe('Interactions as JSON: [{"to":"0x...","data":"0x...","value":"0"}]'),
2155
+ policy: z9.string().optional().describe("Fee sponsorship ID (pol_...)."),
2156
+ signedAuthorization: z9.string().optional().describe("Signed EIP-7702 authorization hex (for delegated accounts)")
2180
2157
  }),
2181
2158
  output: transactionIntentItem,
2182
2159
  examples: [
@@ -2200,7 +2177,7 @@ transactions.command("create", {
2200
2177
  ],
2201
2178
  async run(c) {
2202
2179
  const interactions = JSON.parse(c.options.interactions);
2203
- const res = await c.var.openfort.transactionIntents.create({
2180
+ const res = await getOpenfort().transactionIntents.create({
2204
2181
  account: c.options.account,
2205
2182
  chainId: c.options.chainId,
2206
2183
  interactions,
@@ -2232,15 +2209,15 @@ transactions.command("create", {
2232
2209
  });
2233
2210
  transactions.command("get", {
2234
2211
  description: "Get a transaction intent by ID.",
2235
- args: z10.object({
2236
- id: z10.string().describe("Transaction intent ID (tin_...)")
2212
+ args: z9.object({
2213
+ id: z9.string().describe("Transaction intent ID (tin_...)")
2237
2214
  }),
2238
2215
  examples: [
2239
2216
  { args: { id: "tin_1a2b3c4d" }, description: "Get transaction status and receipt" }
2240
2217
  ],
2241
2218
  output: transactionIntentItem,
2242
2219
  async run(c) {
2243
- const t = await c.var.openfort.transactionIntents.get(c.args.id);
2220
+ const t = await getOpenfort().transactionIntents.get(c.args.id);
2244
2221
  return c.ok({
2245
2222
  id: t.id,
2246
2223
  createdAt: t.createdAt,
@@ -2256,12 +2233,12 @@ transactions.command("get", {
2256
2233
  });
2257
2234
  transactions.command("sign", {
2258
2235
  description: "Sign and broadcast a transaction intent.",
2259
- args: z10.object({
2260
- id: z10.string().describe("Transaction intent ID (tin_...)")
2236
+ args: z9.object({
2237
+ id: z9.string().describe("Transaction intent ID (tin_...)")
2261
2238
  }),
2262
- options: z10.object({
2263
- signature: z10.string().describe("Hex signature"),
2264
- optimistic: z10.boolean().optional().describe("Return before on-chain confirmation")
2239
+ options: z9.object({
2240
+ signature: z9.string().describe("Hex signature"),
2241
+ optimistic: z9.boolean().optional().describe("Return before on-chain confirmation")
2265
2242
  }),
2266
2243
  examples: [
2267
2244
  { args: { id: "tin_1a2b3c4d" }, options: { signature: "0xabcd1234..." }, description: "Sign and broadcast a transaction" },
@@ -2269,7 +2246,7 @@ transactions.command("sign", {
2269
2246
  ],
2270
2247
  output: transactionIntentItem,
2271
2248
  async run(c) {
2272
- const res = await c.var.openfort.transactionIntents.signature(c.args.id, {
2249
+ const res = await getOpenfort().transactionIntents.signature(c.args.id, {
2273
2250
  signature: c.options.signature,
2274
2251
  optimistic: c.options.optimistic
2275
2252
  });
@@ -2298,11 +2275,11 @@ transactions.command("sign", {
2298
2275
  });
2299
2276
  transactions.command("estimate", {
2300
2277
  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_...)")
2278
+ options: z9.object({
2279
+ account: z9.string().describe("Account ID (acc_...)"),
2280
+ chainId: z9.number().describe("Chain ID"),
2281
+ interactions: z9.string().describe("Interactions as JSON"),
2282
+ policy: z9.string().optional().describe("Fee sponsorship ID (pol_...)")
2306
2283
  }),
2307
2284
  examples: [
2308
2285
  {
@@ -2310,16 +2287,16 @@ transactions.command("estimate", {
2310
2287
  description: "Estimate gas for a USDC transfer on Polygon"
2311
2288
  }
2312
2289
  ],
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()
2290
+ output: z9.object({
2291
+ estimatedTXGas: z9.string(),
2292
+ estimatedTXGasFee: z9.string(),
2293
+ estimatedTXGasFeeUSD: z9.string(),
2294
+ estimatedTXGasFeeToken: z9.string().optional(),
2295
+ gasPrice: z9.string()
2319
2296
  }),
2320
2297
  async run(c) {
2321
2298
  const interactions = JSON.parse(c.options.interactions);
2322
- const res = await c.var.openfort.transactionIntents.estimateCost({
2299
+ const res = await getOpenfort().transactionIntents.estimateCost({
2323
2300
  account: c.options.account,
2324
2301
  chainId: c.options.chainId,
2325
2302
  interactions,
@@ -2336,21 +2313,19 @@ transactions.command("estimate", {
2336
2313
  });
2337
2314
 
2338
2315
  // 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;
2316
+ import { Cli as Cli10, z as z10, Errors } from "incur";
2341
2317
  var embeddedWallet = Cli10.create("embedded-wallet", {
2342
- description: "Configure embedded wallet (Shield) API keys.",
2343
- vars: varsSchema
2318
+ description: "Configure embedded wallet (Shield) API keys."
2344
2319
  });
2345
2320
  embeddedWallet.command("setup", {
2346
2321
  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.")
2322
+ options: z10.object({
2323
+ project: z10.string().optional().describe("Project ID (pro_...). Defaults to OPENFORT_PROJECT_ID env var.")
2349
2324
  }),
2350
2325
  alias: { project: "p" },
2351
- output: z11.object({
2352
- message: z11.string(),
2353
- credentialsPath: z11.string()
2326
+ output: z10.object({
2327
+ message: z10.string(),
2328
+ credentialsPath: z10.string()
2354
2329
  }),
2355
2330
  examples: [
2356
2331
  {
@@ -2362,7 +2337,7 @@ embeddedWallet.command("setup", {
2362
2337
  async run(c) {
2363
2338
  const publishableKey = process.env.OPENFORT_PUBLISHABLE_KEY;
2364
2339
  if (!publishableKey) {
2365
- throw new Errors3.IncurError({
2340
+ throw new Errors.IncurError({
2366
2341
  code: "MISSING_PUBLISHABLE_KEY",
2367
2342
  message: "OPENFORT_PUBLISHABLE_KEY environment variable is required to create Shield keys.",
2368
2343
  hint: "Run: openfort login"
@@ -2372,13 +2347,13 @@ embeddedWallet.command("setup", {
2372
2347
  const environment = apiKey.startsWith("sk_live_") ? "live" : "test";
2373
2348
  const projectId = c.options.project || process.env.OPENFORT_PROJECT_ID;
2374
2349
  if (!projectId) {
2375
- throw new Errors3.IncurError({
2350
+ throw new Errors.IncurError({
2376
2351
  code: "MISSING_PROJECT_ID",
2377
2352
  message: "Project ID is required. Pass --project or set OPENFORT_PROJECT_ID.",
2378
2353
  hint: "Run: openfort login"
2379
2354
  });
2380
2355
  }
2381
- const registerRes = await fetch(`${SHIELD_API_URL}/register`, {
2356
+ const registerRes = await fetch(`${OPENFORT_SHIELD_URL}/register`, {
2382
2357
  method: "POST",
2383
2358
  headers: {
2384
2359
  "Content-Type": "application/json",
@@ -2392,7 +2367,7 @@ embeddedWallet.command("setup", {
2392
2367
  });
2393
2368
  if (!registerRes.ok) {
2394
2369
  const text = await registerRes.text();
2395
- throw new Errors3.IncurError({
2370
+ throw new Errors.IncurError({
2396
2371
  code: "SHIELD_REGISTER_FAILED",
2397
2372
  message: `Shield registration failed: ${text}`,
2398
2373
  retryable: true
@@ -2400,7 +2375,7 @@ embeddedWallet.command("setup", {
2400
2375
  }
2401
2376
  const shieldData = await registerRes.json();
2402
2377
  if (shieldData.error) {
2403
- throw new Errors3.IncurError({
2378
+ throw new Errors.IncurError({
2404
2379
  code: "SHIELD_REGISTER_ERROR",
2405
2380
  message: `Shield registration error: ${shieldData.error}`
2406
2381
  });
@@ -2416,7 +2391,7 @@ embeddedWallet.command("setup", {
2416
2391
  });
2417
2392
  if (!res.ok) {
2418
2393
  const text = await res.text();
2419
- throw new Errors3.IncurError({
2394
+ throw new Errors.IncurError({
2420
2395
  code: "PERSIST_KEY_FAILED",
2421
2396
  message: `Failed to persist ${type} key: ${text}`,
2422
2397
  retryable: true
@@ -2427,7 +2402,7 @@ embeddedWallet.command("setup", {
2427
2402
  persistKey("pk_shield", shieldData.api_key),
2428
2403
  persistKey("sk_shield", shieldData.api_secret)
2429
2404
  ]);
2430
- const linkRes = await fetch(`${SHIELD_API_URL}/project/providers`, {
2405
+ const linkRes = await fetch(`${OPENFORT_SHIELD_URL}/project/providers`, {
2431
2406
  method: "POST",
2432
2407
  headers: {
2433
2408
  "Content-Type": "application/json",
@@ -2444,7 +2419,7 @@ embeddedWallet.command("setup", {
2444
2419
  });
2445
2420
  if (!linkRes.ok) {
2446
2421
  const text = await linkRes.text();
2447
- throw new Errors3.IncurError({
2422
+ throw new Errors.IncurError({
2448
2423
  code: "SHIELD_LINK_FAILED",
2449
2424
  message: `Failed to link Openfort provider to Shield: ${text}`,
2450
2425
  retryable: true
@@ -2471,49 +2446,48 @@ embeddedWallet.command("setup", {
2471
2446
  });
2472
2447
 
2473
2448
  // 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()
2449
+ import { Cli as Cli11, z as z11 } from "incur";
2450
+ var userItem = z11.object({
2451
+ id: z11.string(),
2452
+ createdAt: z11.number(),
2453
+ name: z11.string(),
2454
+ email: z11.string().nullable(),
2455
+ emailVerified: z11.boolean(),
2456
+ phoneNumber: z11.string().nullable(),
2457
+ phoneNumberVerified: z11.boolean(),
2458
+ isAnonymous: z11.boolean().optional(),
2459
+ linkedAccounts: z11.array(z11.object({
2460
+ provider: z11.string(),
2461
+ createdAt: z11.number(),
2462
+ updatedAt: z11.number(),
2463
+ accountId: z11.string().optional(),
2464
+ chainType: z11.string().optional(),
2465
+ connectorType: z11.string().optional(),
2466
+ walletClientType: z11.string().optional()
2492
2467
  }))
2493
2468
  });
2494
2469
  var users = Cli11.create("users", {
2495
- description: "Manage authenticated users.",
2496
- vars: varsSchema
2470
+ description: "Manage authenticated users."
2497
2471
  });
2498
2472
  users.command("list", {
2499
2473
  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")
2474
+ options: z11.object({
2475
+ limit: z11.number().optional().describe("Max results"),
2476
+ skip: z11.number().optional().describe("Offset"),
2477
+ email: z11.string().optional().describe("Filter by email"),
2478
+ name: z11.string().optional().describe("Filter by name")
2505
2479
  }),
2506
2480
  alias: { limit: "l" },
2507
2481
  examples: [
2508
2482
  { description: "List all users" },
2509
2483
  { options: { email: "user@example.com" }, description: "Find user by email" }
2510
2484
  ],
2511
- output: z12.object({
2512
- data: z12.array(userItem),
2513
- total: z12.number()
2485
+ output: z11.object({
2486
+ data: z11.array(userItem),
2487
+ total: z11.number()
2514
2488
  }),
2515
2489
  async run(c) {
2516
- const res = await c.var.openfort.iam.users.list({
2490
+ const res = await getOpenfort().iam.users.list({
2517
2491
  limit: c.options.limit,
2518
2492
  skip: c.options.skip,
2519
2493
  email: c.options.email,
@@ -2537,15 +2511,15 @@ users.command("list", {
2537
2511
  });
2538
2512
  users.command("get", {
2539
2513
  description: "Get a user by ID.",
2540
- args: z12.object({
2541
- id: z12.string().describe("User ID (usr_...)")
2514
+ args: z11.object({
2515
+ id: z11.string().describe("User ID (usr_...)")
2542
2516
  }),
2543
2517
  examples: [
2544
2518
  { args: { id: "usr_1a2b3c4d" }, description: "Get user profile and linked accounts" }
2545
2519
  ],
2546
2520
  output: userItem,
2547
2521
  async run(c) {
2548
- const u = await c.var.openfort.iam.users.get(c.args.id);
2522
+ const u = await getOpenfort().iam.users.get(c.args.id);
2549
2523
  return c.ok({
2550
2524
  id: u.id,
2551
2525
  createdAt: u.createdAt,
@@ -2561,25 +2535,25 @@ users.command("get", {
2561
2535
  });
2562
2536
  users.command("delete", {
2563
2537
  description: "Delete a user.",
2564
- args: z12.object({
2565
- id: z12.string().describe("User ID (usr_...)")
2538
+ args: z11.object({
2539
+ id: z11.string().describe("User ID (usr_...)")
2566
2540
  }),
2567
2541
  examples: [
2568
2542
  { args: { id: "usr_1a2b3c4d" }, description: "Delete a user and their accounts" }
2569
2543
  ],
2570
- output: z12.object({
2571
- id: z12.string(),
2572
- deleted: z12.boolean()
2544
+ output: z11.object({
2545
+ id: z11.string(),
2546
+ deleted: z11.boolean()
2573
2547
  }),
2574
2548
  async run(c) {
2575
- const res = await c.var.openfort.iam.users.delete(c.args.id);
2549
+ const res = await getOpenfort().iam.users.delete(c.args.id);
2576
2550
  return c.ok({ id: res.id, deleted: res.deleted });
2577
2551
  }
2578
2552
  });
2579
2553
 
2580
2554
  // src/commands/backend-wallet.ts
2581
2555
  import { randomBytes as randomBytes2, subtle } from "crypto";
2582
- import { Cli as Cli12, z as z13, Errors as Errors4 } from "incur";
2556
+ import { Cli as Cli12, z as z12, Errors as Errors2 } from "incur";
2583
2557
  function arrayBufferToBase64(buffer) {
2584
2558
  return Buffer.from(buffer).toString("base64");
2585
2559
  }
@@ -2651,14 +2625,13 @@ async function signWalletAuthJwt(privateKey, method, path, body) {
2651
2625
  return `${signingInput}.${arrayBufferToBase64Url(signature)}`;
2652
2626
  }
2653
2627
  var backendWallet = Cli12.create("backend-wallet", {
2654
- description: "Configure backend wallet signing keys.",
2655
- vars: varsSchema
2628
+ description: "Configure backend wallet signing keys."
2656
2629
  });
2657
2630
  backendWallet.command("setup", {
2658
2631
  description: "Generate and register backend wallet signing keys (ECDSA P-256).",
2659
- output: z13.object({
2660
- message: z13.string(),
2661
- credentialsPath: z13.string()
2632
+ output: z12.object({
2633
+ message: z12.string(),
2634
+ credentialsPath: z12.string()
2662
2635
  }),
2663
2636
  examples: [
2664
2637
  {
@@ -2689,7 +2662,7 @@ ${publicKey}
2689
2662
  });
2690
2663
  if (!registerRes.ok) {
2691
2664
  const text = await registerRes.text();
2692
- throw new Errors4.IncurError({
2665
+ throw new Errors2.IncurError({
2693
2666
  code: "REGISTER_SECRET_FAILED",
2694
2667
  message: `Failed to register wallet secret: ${text}`,
2695
2668
  retryable: true
@@ -2705,7 +2678,7 @@ ${publicKey}
2705
2678
  });
2706
2679
  if (!storeRes.ok) {
2707
2680
  const text = await storeRes.text();
2708
- throw new Errors4.IncurError({
2681
+ throw new Errors2.IncurError({
2709
2682
  code: "STORE_KEY_FAILED",
2710
2683
  message: `Failed to store wallet key reference: ${text}`,
2711
2684
  retryable: true
@@ -2730,10 +2703,10 @@ ${publicKey}
2730
2703
  });
2731
2704
  backendWallet.command("revoke", {
2732
2705
  description: "Revoke the current backend wallet signing secret.",
2733
- output: z13.object({
2734
- keyId: z13.string(),
2735
- revoked: z13.boolean(),
2736
- revokedAt: z13.number()
2706
+ output: z12.object({
2707
+ keyId: z12.string(),
2708
+ revoked: z12.boolean(),
2709
+ revokedAt: z12.number()
2737
2710
  }),
2738
2711
  examples: [
2739
2712
  {
@@ -2746,7 +2719,7 @@ backendWallet.command("revoke", {
2746
2719
  const keyId = process.env.OPENFORT_WALLET_KEY_ID;
2747
2720
  const privateKeyBase64 = process.env.OPENFORT_WALLET_SECRET;
2748
2721
  if (!keyId || !privateKeyBase64) {
2749
- throw new Errors4.IncurError({
2722
+ throw new Errors2.IncurError({
2750
2723
  code: "MISSING_WALLET_KEY",
2751
2724
  message: "OPENFORT_WALLET_KEY_ID and OPENFORT_WALLET_SECRET must be set. Run `backend-wallet setup` first.",
2752
2725
  hint: "Run: openfort backend-wallet setup"
@@ -2767,7 +2740,7 @@ backendWallet.command("revoke", {
2767
2740
  });
2768
2741
  if (!res.ok) {
2769
2742
  const text = await res.text();
2770
- throw new Errors4.IncurError({
2743
+ throw new Errors2.IncurError({
2771
2744
  code: "REVOKE_SECRET_FAILED",
2772
2745
  message: `Failed to revoke wallet secret: ${text}`,
2773
2746
  retryable: true
@@ -2779,9 +2752,9 @@ backendWallet.command("revoke", {
2779
2752
  });
2780
2753
  backendWallet.command("rotate", {
2781
2754
  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()
2755
+ output: z12.object({
2756
+ message: z12.string(),
2757
+ credentialsPath: z12.string()
2785
2758
  }),
2786
2759
  examples: [
2787
2760
  {
@@ -2812,7 +2785,7 @@ ${publicKey}
2812
2785
  });
2813
2786
  if (!rotateRes.ok) {
2814
2787
  const text = await rotateRes.text();
2815
- throw new Errors4.IncurError({
2788
+ throw new Errors2.IncurError({
2816
2789
  code: "ROTATE_SECRET_FAILED",
2817
2790
  message: `Failed to rotate wallet secret: ${text}`,
2818
2791
  retryable: true
@@ -2828,7 +2801,7 @@ ${publicKey}
2828
2801
  });
2829
2802
  if (!storeRes.ok) {
2830
2803
  const text = await storeRes.text();
2831
- throw new Errors4.IncurError({
2804
+ throw new Errors2.IncurError({
2832
2805
  code: "STORE_KEY_FAILED",
2833
2806
  message: `Failed to store rotated wallet key reference: ${text}`,
2834
2807
  retryable: true
@@ -2843,22 +2816,21 @@ ${publicKey}
2843
2816
  });
2844
2817
 
2845
2818
  // src/commands/message.ts
2846
- import { Cli as Cli13, z as z14 } from "incur";
2819
+ import { Cli as Cli13, z as z13 } from "incur";
2847
2820
  import { keccak256, toBytes } from "viem";
2848
2821
  var message = Cli13.create("message", {
2849
- description: "Message utilities.",
2850
- vars: varsSchema
2822
+ description: "Message utilities."
2851
2823
  });
2852
2824
  message.command("hash", {
2853
2825
  description: "Hash a message using keccak256.",
2854
- args: z14.object({
2855
- message: z14.string().describe("The message to hash")
2826
+ args: z13.object({
2827
+ message: z13.string().describe("The message to hash")
2856
2828
  }),
2857
2829
  examples: [
2858
2830
  { args: { message: "Hello World" }, description: "Hash a message" }
2859
2831
  ],
2860
- output: z14.object({
2861
- hash: z14.string()
2832
+ output: z13.object({
2833
+ hash: z13.string()
2862
2834
  }),
2863
2835
  async run(c) {
2864
2836
  const hash = keccak256(toBytes(c.args.message));
@@ -2867,16 +2839,15 @@ message.command("hash", {
2867
2839
  });
2868
2840
 
2869
2841
  // src/cli.ts
2870
- var pkg = JSON.parse(readFileSync2(new URL("../package.json", import.meta.url), "utf-8"));
2842
+ var pkg = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf-8"));
2871
2843
  var cli = Cli14.create("openfort", {
2872
2844
  version: pkg.version,
2873
2845
  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")
2846
+ env: z14.object({
2847
+ OPENFORT_API_KEY: z14.string().optional().describe("Openfort secret API key (sk_test_... or sk_live_...)"),
2848
+ OPENFORT_WALLET_SECRET: z14.string().optional().describe("Wallet encryption secret"),
2849
+ OPENFORT_PUBLISHABLE_KEY: z14.string().optional().describe("Publishable key for client-side ops"),
2850
+ OPENFORT_BASE_URL: z14.string().optional().describe("Custom API base URL")
2880
2851
  }),
2881
2852
  sync: {
2882
2853
  depth: 2,
@@ -2894,38 +2865,6 @@ var cli = Cli14.create("openfort", {
2894
2865
  }
2895
2866
  });
2896
2867
  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
2868
  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
2869
  var cli_default = cli;
2931
2870
  export {