@nevermined-io/cli 1.12.0 → 1.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -12,6 +12,9 @@ export default class GetX402AccessToken extends BaseCommand {
12
12
  'spending-limit-cents': import("@oclif/core/lib/interfaces/parser.js").OptionFlag<number, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
13
13
  'delegation-duration-secs': import("@oclif/core/lib/interfaces/parser.js").OptionFlag<number, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
14
14
  'auto-resolve-scheme': import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
15
+ 'resource-url': import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
16
+ 'http-verb': import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
17
+ 'token-version': import("@oclif/core/lib/interfaces/parser.js").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
15
18
  profile: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
16
19
  format: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
17
20
  verbose: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
@@ -21,6 +24,14 @@ export default class GetX402AccessToken extends BaseCommand {
21
24
  };
22
25
  run(): Promise<void>;
23
26
  private buildCryptoTokenOptions;
27
+ /**
28
+ * Resource/verb/version options shared by the crypto and fiat paths.
29
+ *
30
+ * Omitted rather than sent empty when the flag is absent: a field absent at
31
+ * mint is signed as the empty string and must stay absent from the envelope,
32
+ * so `--resource-url ''` and no flag at all must not produce different bodies.
33
+ */
34
+ private buildTokenBinding;
24
35
  private buildFiatTokenOptions;
25
36
  }
26
37
  //# sourceMappingURL=get-x402-access-token.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"get-x402-access-token.d.ts","sourceRoot":"","sources":["../../../src/commands/x402token/get-x402-access-token.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAInD;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,WAAW;IACzD,OAAgB,WAAW,SAAoJ;IAE/K,OAAgB,QAAQ,WAMvB;IAED,OAAgB,KAAK;;;;;;;;;;MA4BpB;IAED,OAAgB,IAAI;;MAKnB;IAEY,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;IAiCjC,OAAO,CAAC,uBAAuB;YASjB,qBAAqB;CAsBpC"}
1
+ {"version":3,"file":"get-x402-access-token.d.ts","sourceRoot":"","sources":["../../../src/commands/x402token/get-x402-access-token.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAInD;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,WAAW;IACzD,OAAgB,WAAW,SAAoJ;IAE/K,OAAgB,QAAQ,WAOvB;IAED,OAAgB,KAAK;;;;;;;;;;;;;MA0CpB;IAED,OAAgB,IAAI;;MAKnB;IAEY,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;IAqCjC,OAAO,CAAC,uBAAuB;IAU/B;;;;;;OAMG;IACH,OAAO,CAAC,iBAAiB;YAyBX,qBAAqB;CAuBpC"}
@@ -12,6 +12,7 @@ export default class GetX402AccessToken extends BaseCommand {
12
12
  '$ nevermined x402token get-x402-access-token <planId> --payment-type fiat --payment-method-id pm_1AbCdEfGhIjKlM --spending-limit-cents 5000',
13
13
  '$ nevermined x402token get-x402-access-token <planId> --spending-limit-cents 100000 --delegation-duration-secs 604800',
14
14
  '$ nevermined x402token get-x402-access-token <planId> --auto-resolve-scheme',
15
+ '$ nevermined x402token get-x402-access-token <planId> --resource-url /api/v1/tasks --http-verb POST --token-version 3',
15
16
  ];
16
17
  static flags = {
17
18
  ...BaseCommand.baseFlags,
@@ -41,6 +42,20 @@ export default class GetX402AccessToken extends BaseCommand {
41
42
  default: false,
42
43
  required: false,
43
44
  }),
45
+ 'resource-url': Flags.string({
46
+ description: 'Protected resource, EXACTLY as the seller advertises it in its 402 (a paymentMiddleware seller advertises a relative path such as /ask). Signed into a v3 token, which then settles only against it; a mismatch fails verification with BCK.X402.0013.',
47
+ required: false,
48
+ }),
49
+ 'http-verb': Flags.string({
50
+ description: 'HTTP verb of the protected resource (e.g. POST). Signed into a v3 token alongside --resource-url.',
51
+ required: false,
52
+ }),
53
+ 'token-version': Flags.integer({
54
+ description: 'EIP-712 token version to request: 2 (default, reusable) or 3 (single-use, bound to --resource-url/--http-verb). A backend without v3 support silently returns 2 — check the tokenVersion field in the output.',
55
+ min: 2,
56
+ max: 3,
57
+ required: false,
58
+ }),
44
59
  };
45
60
  static args = {
46
61
  plan: Args.string({
@@ -69,6 +84,9 @@ export default class GetX402AccessToken extends BaseCommand {
69
84
  tokenOptions = this.buildCryptoTokenOptions(flags);
70
85
  }
71
86
  const result = await payments.x402.getX402AccessToken(args.plan, flags['agent-id'], tokenOptions);
87
+ // The printed tokenVersion is detected from the returned token, not echoed
88
+ // from --token-version: a backend that predates v3 drops the request field
89
+ // without an error and mints v2.
72
90
  this.formatter.output(result);
73
91
  }
74
92
  catch (error) {
@@ -81,6 +99,33 @@ export default class GetX402AccessToken extends BaseCommand {
81
99
  spendingLimitCents: flags['spending-limit-cents'],
82
100
  durationSecs: flags['delegation-duration-secs'],
83
101
  },
102
+ ...this.buildTokenBinding(flags),
103
+ };
104
+ }
105
+ /**
106
+ * Resource/verb/version options shared by the crypto and fiat paths.
107
+ *
108
+ * Omitted rather than sent empty when the flag is absent: a field absent at
109
+ * mint is signed as the empty string and must stay absent from the envelope,
110
+ * so `--resource-url ''` and no flag at all must not produce different bodies.
111
+ */
112
+ buildTokenBinding(flags) {
113
+ const resourceUrl = flags['resource-url'];
114
+ const httpVerb = flags['http-verb'];
115
+ const tokenVersion = flags['token-version'];
116
+ // The three flags are one set. A resource on a v2 token is not inert — the
117
+ // backend compares it with the URL the seller advertises and rejects a
118
+ // mismatch with BCK.X402.0013 — so binding without asking for v3 can only
119
+ // cost the caller a failed verification. Refuse the combination instead of
120
+ // minting a token that will not verify.
121
+ if ((resourceUrl || httpVerb) && tokenVersion !== 3) {
122
+ this.error('--resource-url / --http-verb bind the token to one seller endpoint, which only ' +
123
+ 'takes effect with --token-version 3. Add --token-version 3, or drop the binding flags.', { exit: 1 });
124
+ }
125
+ return {
126
+ ...(resourceUrl && { resource: { url: resourceUrl } }),
127
+ ...(httpVerb && { httpVerb: String(httpVerb).toUpperCase() }),
128
+ ...(tokenVersion === 3 && { tokenVersion: 3 }),
84
129
  };
85
130
  }
86
131
  async buildFiatTokenOptions(payments, flags) {
@@ -101,6 +146,7 @@ export default class GetX402AccessToken extends BaseCommand {
101
146
  spendingLimitCents: flags['spending-limit-cents'],
102
147
  durationSecs: flags['delegation-duration-secs'],
103
148
  },
149
+ ...this.buildTokenBinding(flags),
104
150
  };
105
151
  }
106
152
  }
@@ -1 +1 @@
1
- {"version":3,"file":"get-x402-access-token.js","sourceRoot":"","sources":["../../../src/commands/x402token/get-x402-access-token.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAEnD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AAEvD;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,WAAW;IACzD,MAAM,CAAU,WAAW,GAAG,iJAAiJ,CAAA;IAE/K,MAAM,CAAU,QAAQ,GAAG;QACzB,uDAAuD;QACvD,2EAA2E;QAC3E,6IAA6I;QAC7I,uHAAuH;QACvH,6EAA6E;KAC9E,CAAA;IAED,MAAM,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AAC;YACrB,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,UAAU,CAAC,kBAAkB,EAAE,CAAA;YAC9D,MAAM,IAAI,GAAG,OAAO,EAAE,IAAI,CAAC,CAAC,CAAM,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,MAAM,CAAC,CAAA;YACzD,IAAI,CAAC,IAAI,EAAE,CAAC;gBACV,IAAI,CAAC,KAAK,CAAC,oEAAoE,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,CAAA;YAC/F,CAAC;YACD,eAAe,GAAG,IAAI,CAAC,EAAE,CAAA;YACzB,OAAO,CAAC,KAAK,CAAC,uBAAuB,IAAI,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,EAAE,CAAC,CAAA;QACtE,CAAC;QAED,OAAO;YACL,MAAM,EAAE,qBAAqB;YAC7B,gBAAgB,EAAE;gBAChB,uBAAuB,EAAE,eAAe;gBACxC,kBAAkB,EAAE,KAAK,CAAC,sBAAsB,CAAC;gBACjD,YAAY,EAAE,KAAK,CAAC,0BAA0B,CAAC;aAChD;SACF,CAAA;IACH,CAAC"}
1
+ {"version":3,"file":"get-x402-access-token.js","sourceRoot":"","sources":["../../../src/commands/x402token/get-x402-access-token.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAEnD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AAEvD;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,WAAW;IACzD,MAAM,CAAU,WAAW,GAAG,iJAAiJ,CAAA;IAE/K,MAAM,CAAU,QAAQ,GAAG;QACzB,uDAAuD;QACvD,2EAA2E;QAC3E,6IAA6I;QAC7I,uHAAuH;QACvH,6EAA6E;QAC7E,uHAAuH;KACxH,CAAA;IAED,MAAM,CAAU,KAAK,GAAG;QACtB,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B,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,UAAU,CAAC,kBAAkB,EAAE,CAAA;YAC9D,MAAM,IAAI,GAAG,OAAO,EAAE,IAAI,CAAC,CAAC,CAAM,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,MAAM,CAAC,CAAA;YACzD,IAAI,CAAC,IAAI,EAAE,CAAC;gBACV,IAAI,CAAC,KAAK,CAAC,oEAAoE,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,CAAA;YAC/F,CAAC;YACD,eAAe,GAAG,IAAI,CAAC,EAAE,CAAA;YACzB,OAAO,CAAC,KAAK,CAAC,uBAAuB,IAAI,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,EAAE,CAAC,CAAA;QACtE,CAAC;QAED,OAAO;YACL,MAAM,EAAE,qBAAqB;YAC7B,gBAAgB,EAAE;gBAChB,uBAAuB,EAAE,eAAe;gBACxC,kBAAkB,EAAE,KAAK,CAAC,sBAAsB,CAAC;gBACjD,YAAY,EAAE,KAAK,CAAC,0BAA0B,CAAC;aAChD;YACD,GAAG,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC;SACjC,CAAA;IACH,CAAC"}
@@ -993,62 +993,6 @@
993
993
  "setup.js"
994
994
  ]
995
995
  },
996
- "delegation:list-payment-methods": {
997
- "aliases": [],
998
- "args": {},
999
- "description": "List enrolled credit/debit cards available for card-delegation (fiat) payments.",
1000
- "examples": [
1001
- "$ nevermined delegation list-payment-methods",
1002
- "$ nevermined delegation list-payment-methods --format json"
1003
- ],
1004
- "flags": {
1005
- "profile": {
1006
- "char": "p",
1007
- "description": "Configuration profile to use",
1008
- "name": "profile",
1009
- "required": false,
1010
- "hasDynamicHelp": false,
1011
- "multiple": false,
1012
- "type": "option"
1013
- },
1014
- "format": {
1015
- "char": "f",
1016
- "description": "Output format",
1017
- "name": "format",
1018
- "default": "table",
1019
- "hasDynamicHelp": false,
1020
- "multiple": false,
1021
- "options": [
1022
- "table",
1023
- "json",
1024
- "quiet"
1025
- ],
1026
- "type": "option"
1027
- },
1028
- "verbose": {
1029
- "char": "v",
1030
- "description": "Verbose output",
1031
- "name": "verbose",
1032
- "allowNo": false,
1033
- "type": "boolean"
1034
- }
1035
- },
1036
- "hasDynamicHelp": false,
1037
- "hiddenAliases": [],
1038
- "id": "delegation:list-payment-methods",
1039
- "pluginAlias": "@nevermined-io/cli",
1040
- "pluginName": "@nevermined-io/cli",
1041
- "pluginType": "core",
1042
- "strict": true,
1043
- "enableJsonFlag": false,
1044
- "isESM": true,
1045
- "relativePath": [
1046
- "dist",
1047
- "commands",
1048
- "delegation",
1049
- "list-payment-methods.js"
1050
- ]
1051
- },
1052
996
  "config:init": {
1053
997
  "aliases": [],
1054
998
  "args": {},
@@ -1270,6 +1214,62 @@
1270
1214
  "show.js"
1271
1215
  ]
1272
1216
  },
1217
+ "delegation:list-payment-methods": {
1218
+ "aliases": [],
1219
+ "args": {},
1220
+ "description": "List enrolled credit/debit cards available for card-delegation (fiat) payments.",
1221
+ "examples": [
1222
+ "$ nevermined delegation list-payment-methods",
1223
+ "$ nevermined delegation list-payment-methods --format json"
1224
+ ],
1225
+ "flags": {
1226
+ "profile": {
1227
+ "char": "p",
1228
+ "description": "Configuration profile to use",
1229
+ "name": "profile",
1230
+ "required": false,
1231
+ "hasDynamicHelp": false,
1232
+ "multiple": false,
1233
+ "type": "option"
1234
+ },
1235
+ "format": {
1236
+ "char": "f",
1237
+ "description": "Output format",
1238
+ "name": "format",
1239
+ "default": "table",
1240
+ "hasDynamicHelp": false,
1241
+ "multiple": false,
1242
+ "options": [
1243
+ "table",
1244
+ "json",
1245
+ "quiet"
1246
+ ],
1247
+ "type": "option"
1248
+ },
1249
+ "verbose": {
1250
+ "char": "v",
1251
+ "description": "Verbose output",
1252
+ "name": "verbose",
1253
+ "allowNo": false,
1254
+ "type": "boolean"
1255
+ }
1256
+ },
1257
+ "hasDynamicHelp": false,
1258
+ "hiddenAliases": [],
1259
+ "id": "delegation:list-payment-methods",
1260
+ "pluginAlias": "@nevermined-io/cli",
1261
+ "pluginName": "@nevermined-io/cli",
1262
+ "pluginType": "core",
1263
+ "strict": true,
1264
+ "enableJsonFlag": false,
1265
+ "isESM": true,
1266
+ "relativePath": [
1267
+ "dist",
1268
+ "commands",
1269
+ "delegation",
1270
+ "list-payment-methods.js"
1271
+ ]
1272
+ },
1273
1273
  "facilitator:settle-permissions": {
1274
1274
  "aliases": [],
1275
1275
  "args": {},
@@ -1396,6 +1396,149 @@
1396
1396
  "verify-permissions.js"
1397
1397
  ]
1398
1398
  },
1399
+ "x402token:get-x402-access-token": {
1400
+ "aliases": [],
1401
+ "args": {
1402
+ "plan": {
1403
+ "description": "plan identifier",
1404
+ "name": "plan",
1405
+ "required": true
1406
+ }
1407
+ },
1408
+ "description": "Create a delegation and get an X402 access token for the given plan. Supports both crypto (erc4337) and fiat (card-delegation) payment schemes.",
1409
+ "examples": [
1410
+ "$ nevermined x402token get-x402-access-token <planId>",
1411
+ "$ nevermined x402token get-x402-access-token <planId> --payment-type fiat",
1412
+ "$ nevermined x402token get-x402-access-token <planId> --payment-type fiat --payment-method-id pm_1AbCdEfGhIjKlM --spending-limit-cents 5000",
1413
+ "$ nevermined x402token get-x402-access-token <planId> --spending-limit-cents 100000 --delegation-duration-secs 604800",
1414
+ "$ nevermined x402token get-x402-access-token <planId> --auto-resolve-scheme",
1415
+ "$ nevermined x402token get-x402-access-token <planId> --resource-url /api/v1/tasks --http-verb POST --token-version 3"
1416
+ ],
1417
+ "flags": {
1418
+ "profile": {
1419
+ "char": "p",
1420
+ "description": "Configuration profile to use",
1421
+ "name": "profile",
1422
+ "required": false,
1423
+ "hasDynamicHelp": false,
1424
+ "multiple": false,
1425
+ "type": "option"
1426
+ },
1427
+ "format": {
1428
+ "char": "f",
1429
+ "description": "Output format",
1430
+ "name": "format",
1431
+ "default": "table",
1432
+ "hasDynamicHelp": false,
1433
+ "multiple": false,
1434
+ "options": [
1435
+ "table",
1436
+ "json",
1437
+ "quiet"
1438
+ ],
1439
+ "type": "option"
1440
+ },
1441
+ "verbose": {
1442
+ "char": "v",
1443
+ "description": "Verbose output",
1444
+ "name": "verbose",
1445
+ "allowNo": false,
1446
+ "type": "boolean"
1447
+ },
1448
+ "agent-id": {
1449
+ "name": "agent-id",
1450
+ "required": false,
1451
+ "hasDynamicHelp": false,
1452
+ "multiple": false,
1453
+ "type": "option"
1454
+ },
1455
+ "payment-type": {
1456
+ "description": "Payment type: \"crypto\" (default) or \"fiat\" (card-delegation)",
1457
+ "name": "payment-type",
1458
+ "required": false,
1459
+ "default": "crypto",
1460
+ "hasDynamicHelp": false,
1461
+ "multiple": false,
1462
+ "options": [
1463
+ "crypto",
1464
+ "fiat"
1465
+ ],
1466
+ "type": "option"
1467
+ },
1468
+ "payment-method-id": {
1469
+ "description": "Stripe payment method ID (pm_...). Only for fiat. If omitted, auto-selects first enrolled card.",
1470
+ "name": "payment-method-id",
1471
+ "required": false,
1472
+ "hasDynamicHelp": false,
1473
+ "multiple": false,
1474
+ "type": "option"
1475
+ },
1476
+ "spending-limit-cents": {
1477
+ "description": "Max spending limit in cents (default: 1000)",
1478
+ "name": "spending-limit-cents",
1479
+ "required": false,
1480
+ "default": 1000,
1481
+ "hasDynamicHelp": false,
1482
+ "multiple": false,
1483
+ "type": "option"
1484
+ },
1485
+ "delegation-duration-secs": {
1486
+ "description": "Delegation duration in seconds (default: 3600)",
1487
+ "name": "delegation-duration-secs",
1488
+ "required": false,
1489
+ "default": 3600,
1490
+ "hasDynamicHelp": false,
1491
+ "multiple": false,
1492
+ "type": "option"
1493
+ },
1494
+ "auto-resolve-scheme": {
1495
+ "description": "Auto-detect crypto vs fiat from plan metadata (overrides --payment-type)",
1496
+ "name": "auto-resolve-scheme",
1497
+ "required": false,
1498
+ "allowNo": false,
1499
+ "type": "boolean"
1500
+ },
1501
+ "resource-url": {
1502
+ "description": "Protected resource, EXACTLY as the seller advertises it in its 402 (a paymentMiddleware seller advertises a relative path such as /ask). Signed into a v3 token, which then settles only against it; a mismatch fails verification with BCK.X402.0013.",
1503
+ "name": "resource-url",
1504
+ "required": false,
1505
+ "hasDynamicHelp": false,
1506
+ "multiple": false,
1507
+ "type": "option"
1508
+ },
1509
+ "http-verb": {
1510
+ "description": "HTTP verb of the protected resource (e.g. POST). Signed into a v3 token alongside --resource-url.",
1511
+ "name": "http-verb",
1512
+ "required": false,
1513
+ "hasDynamicHelp": false,
1514
+ "multiple": false,
1515
+ "type": "option"
1516
+ },
1517
+ "token-version": {
1518
+ "description": "EIP-712 token version to request: 2 (default, reusable) or 3 (single-use, bound to --resource-url/--http-verb). A backend without v3 support silently returns 2 — check the tokenVersion field in the output.",
1519
+ "name": "token-version",
1520
+ "required": false,
1521
+ "hasDynamicHelp": false,
1522
+ "multiple": false,
1523
+ "type": "option"
1524
+ }
1525
+ },
1526
+ "hasDynamicHelp": false,
1527
+ "hiddenAliases": [],
1528
+ "id": "x402token:get-x402-access-token",
1529
+ "pluginAlias": "@nevermined-io/cli",
1530
+ "pluginName": "@nevermined-io/cli",
1531
+ "pluginType": "core",
1532
+ "strict": true,
1533
+ "enableJsonFlag": false,
1534
+ "isESM": true,
1535
+ "relativePath": [
1536
+ "dist",
1537
+ "commands",
1538
+ "x402token",
1539
+ "get-x402-access-token.js"
1540
+ ]
1541
+ },
1399
1542
  "organizations:connect-stripe-account": {
1400
1543
  "aliases": [],
1401
1544
  "args": {},
@@ -1808,124 +1951,6 @@
1808
1951
  "onboard-customer.js"
1809
1952
  ]
1810
1953
  },
1811
- "x402token:get-x402-access-token": {
1812
- "aliases": [],
1813
- "args": {
1814
- "plan": {
1815
- "description": "plan identifier",
1816
- "name": "plan",
1817
- "required": true
1818
- }
1819
- },
1820
- "description": "Create a delegation and get an X402 access token for the given plan. Supports both crypto (erc4337) and fiat (card-delegation) payment schemes.",
1821
- "examples": [
1822
- "$ nevermined x402token get-x402-access-token <planId>",
1823
- "$ nevermined x402token get-x402-access-token <planId> --payment-type fiat",
1824
- "$ nevermined x402token get-x402-access-token <planId> --payment-type fiat --payment-method-id pm_1AbCdEfGhIjKlM --spending-limit-cents 5000",
1825
- "$ nevermined x402token get-x402-access-token <planId> --spending-limit-cents 100000 --delegation-duration-secs 604800",
1826
- "$ nevermined x402token get-x402-access-token <planId> --auto-resolve-scheme"
1827
- ],
1828
- "flags": {
1829
- "profile": {
1830
- "char": "p",
1831
- "description": "Configuration profile to use",
1832
- "name": "profile",
1833
- "required": false,
1834
- "hasDynamicHelp": false,
1835
- "multiple": false,
1836
- "type": "option"
1837
- },
1838
- "format": {
1839
- "char": "f",
1840
- "description": "Output format",
1841
- "name": "format",
1842
- "default": "table",
1843
- "hasDynamicHelp": false,
1844
- "multiple": false,
1845
- "options": [
1846
- "table",
1847
- "json",
1848
- "quiet"
1849
- ],
1850
- "type": "option"
1851
- },
1852
- "verbose": {
1853
- "char": "v",
1854
- "description": "Verbose output",
1855
- "name": "verbose",
1856
- "allowNo": false,
1857
- "type": "boolean"
1858
- },
1859
- "agent-id": {
1860
- "name": "agent-id",
1861
- "required": false,
1862
- "hasDynamicHelp": false,
1863
- "multiple": false,
1864
- "type": "option"
1865
- },
1866
- "payment-type": {
1867
- "description": "Payment type: \"crypto\" (default) or \"fiat\" (card-delegation)",
1868
- "name": "payment-type",
1869
- "required": false,
1870
- "default": "crypto",
1871
- "hasDynamicHelp": false,
1872
- "multiple": false,
1873
- "options": [
1874
- "crypto",
1875
- "fiat"
1876
- ],
1877
- "type": "option"
1878
- },
1879
- "payment-method-id": {
1880
- "description": "Stripe payment method ID (pm_...). Only for fiat. If omitted, auto-selects first enrolled card.",
1881
- "name": "payment-method-id",
1882
- "required": false,
1883
- "hasDynamicHelp": false,
1884
- "multiple": false,
1885
- "type": "option"
1886
- },
1887
- "spending-limit-cents": {
1888
- "description": "Max spending limit in cents (default: 1000)",
1889
- "name": "spending-limit-cents",
1890
- "required": false,
1891
- "default": 1000,
1892
- "hasDynamicHelp": false,
1893
- "multiple": false,
1894
- "type": "option"
1895
- },
1896
- "delegation-duration-secs": {
1897
- "description": "Delegation duration in seconds (default: 3600)",
1898
- "name": "delegation-duration-secs",
1899
- "required": false,
1900
- "default": 3600,
1901
- "hasDynamicHelp": false,
1902
- "multiple": false,
1903
- "type": "option"
1904
- },
1905
- "auto-resolve-scheme": {
1906
- "description": "Auto-detect crypto vs fiat from plan metadata (overrides --payment-type)",
1907
- "name": "auto-resolve-scheme",
1908
- "required": false,
1909
- "allowNo": false,
1910
- "type": "boolean"
1911
- }
1912
- },
1913
- "hasDynamicHelp": false,
1914
- "hiddenAliases": [],
1915
- "id": "x402token:get-x402-access-token",
1916
- "pluginAlias": "@nevermined-io/cli",
1917
- "pluginName": "@nevermined-io/cli",
1918
- "pluginType": "core",
1919
- "strict": true,
1920
- "enableJsonFlag": false,
1921
- "isESM": true,
1922
- "relativePath": [
1923
- "dist",
1924
- "commands",
1925
- "x402token",
1926
- "get-x402-access-token.js"
1927
- ]
1928
- },
1929
1954
  "plans:get-agents-associated-to-a-plan": {
1930
1955
  "aliases": [],
1931
1956
  "args": {
@@ -3855,5 +3880,5 @@
3855
3880
  ]
3856
3881
  }
3857
3882
  },
3858
- "version": "1.12.0"
3883
+ "version": "1.13.0"
3859
3884
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nevermined-io/cli",
3
- "version": "1.12.0",
3
+ "version": "1.13.0",
4
4
  "description": "CLI for Nevermined Payments SDK",
5
5
  "author": "Nevermined AG",
6
6
  "license": "Apache-2.0",
@@ -21,7 +21,7 @@
21
21
  "generate": "tsx src/generator/generate.ts",
22
22
  "sync-check": "tsx src/generator/sync-check.ts",
23
23
  "test": "pnpm test:unit && pnpm test:integration",
24
- "test:unit": "jest test/unit/simple.test.ts test/unit/output-formatter-basic.test.ts",
24
+ "test:unit": "jest test/unit/simple.test.ts test/unit/output-formatter-basic.test.ts test/unit/x402.test.ts",
25
25
  "test:unit:all": "jest --testPathPattern=test/unit",
26
26
  "test:integration": "jest test/integration/cli-basic.test.ts test/integration/generated-commands.test.ts",
27
27
  "test:integration:config": "jest test/integration/config-workflow.test.ts",