@manifest-network/manifest-mcp-browser 0.1.6 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/CLAUDE.md +4 -2
  2. package/dist/modules.d.ts.map +1 -1
  3. package/dist/modules.js +42 -0
  4. package/dist/modules.js.map +1 -1
  5. package/dist/modules.test.js +2 -0
  6. package/dist/modules.test.js.map +1 -1
  7. package/dist/queries/group.d.ts +12 -0
  8. package/dist/queries/group.d.ts.map +1 -0
  9. package/dist/queries/group.js +107 -0
  10. package/dist/queries/group.js.map +1 -0
  11. package/dist/queries/index.d.ts +1 -0
  12. package/dist/queries/index.d.ts.map +1 -1
  13. package/dist/queries/index.js +1 -0
  14. package/dist/queries/index.js.map +1 -1
  15. package/dist/queries/utils.d.ts +3 -18
  16. package/dist/queries/utils.d.ts.map +1 -1
  17. package/dist/queries/utils.js +2 -17
  18. package/dist/queries/utils.js.map +1 -1
  19. package/dist/transactions/gov.d.ts.map +1 -1
  20. package/dist/transactions/gov.js +3 -26
  21. package/dist/transactions/gov.js.map +1 -1
  22. package/dist/transactions/group.d.ts +7 -0
  23. package/dist/transactions/group.d.ts.map +1 -0
  24. package/dist/transactions/group.js +339 -0
  25. package/dist/transactions/group.js.map +1 -0
  26. package/dist/transactions/index.d.ts +1 -0
  27. package/dist/transactions/index.d.ts.map +1 -1
  28. package/dist/transactions/index.js +1 -0
  29. package/dist/transactions/index.js.map +1 -1
  30. package/dist/transactions/utils.d.ts +37 -0
  31. package/dist/transactions/utils.d.ts.map +1 -1
  32. package/dist/transactions/utils.js +43 -0
  33. package/dist/transactions/utils.js.map +1 -1
  34. package/dist/transactions/utils.test.js +97 -1
  35. package/dist/transactions/utils.test.js.map +1 -1
  36. package/dist/types.d.ts +31 -1
  37. package/dist/types.d.ts.map +1 -1
  38. package/package.json +1 -1
  39. package/src/modules.test.ts +2 -0
  40. package/src/modules.ts +42 -0
  41. package/src/queries/group.ts +146 -0
  42. package/src/queries/index.ts +1 -0
  43. package/src/queries/utils.ts +3 -27
  44. package/src/transactions/gov.ts +3 -30
  45. package/src/transactions/group.ts +458 -0
  46. package/src/transactions/index.ts +1 -0
  47. package/src/transactions/utils.test.ts +109 -1
  48. package/src/transactions/utils.ts +69 -0
  49. package/src/types.ts +52 -1
@@ -48,6 +48,33 @@ export function extractFlag(
48
48
  return { value, consumedIndices: [flagIndex, flagIndex + 1] };
49
49
  }
50
50
 
51
+ /**
52
+ * Result from extracting a boolean (valueless) flag from args
53
+ */
54
+ export interface ExtractedBooleanFlag {
55
+ /** Whether the flag was present */
56
+ value: boolean;
57
+ /** Args with the flag removed */
58
+ remainingArgs: string[];
59
+ }
60
+
61
+ /**
62
+ * Extract a valueless boolean flag from args array.
63
+ * Returns { value: true, remainingArgs } if flag is present, { value: false, remainingArgs: args } otherwise.
64
+ *
65
+ * @param args - The arguments array to search
66
+ * @param flagName - The flag to look for (e.g., '--active-only')
67
+ * @returns Object with boolean value and filtered args
68
+ */
69
+ export function extractBooleanFlag(args: string[], flagName: string): ExtractedBooleanFlag {
70
+ const flagIndex = args.indexOf(flagName);
71
+ if (flagIndex === -1) {
72
+ return { value: false, remainingArgs: args };
73
+ }
74
+ const remainingArgs = args.filter((_, index) => index !== flagIndex);
75
+ return { value: true, remainingArgs };
76
+ }
77
+
51
78
  /**
52
79
  * Filter args to remove consumed flag indices
53
80
  */
@@ -287,6 +314,48 @@ export function parseBigInt(value: string, fieldName: string): bigint {
287
314
  return parseBigIntWithCode(value, fieldName, ManifestMCPErrorCode.TX_FAILED);
288
315
  }
289
316
 
317
+ /**
318
+ * Interface for VoteOption-like enums from cosmos protobuf modules.
319
+ * Both cosmos.gov.v1.VoteOption and cosmos.group.v1.VoteOption share this shape.
320
+ */
321
+ interface VoteOptionEnum {
322
+ VOTE_OPTION_YES: number;
323
+ VOTE_OPTION_ABSTAIN: number;
324
+ VOTE_OPTION_NO: number;
325
+ VOTE_OPTION_NO_WITH_VETO: number;
326
+ }
327
+
328
+ /**
329
+ * Parse a vote option string to its numeric enum value.
330
+ * Accepts case-insensitive strings or numeric identifiers.
331
+ *
332
+ * @param optionStr - Vote option string (yes, no, abstain, no_with_veto, or 1-4)
333
+ * @param voteOptionEnum - The VoteOption enum object from the relevant cosmos module
334
+ */
335
+ export function parseVoteOption(optionStr: string, voteOptionEnum: VoteOptionEnum): number {
336
+ const option = optionStr.toLowerCase();
337
+ switch (option) {
338
+ case 'yes':
339
+ case '1':
340
+ return voteOptionEnum.VOTE_OPTION_YES;
341
+ case 'abstain':
342
+ case '2':
343
+ return voteOptionEnum.VOTE_OPTION_ABSTAIN;
344
+ case 'no':
345
+ case '3':
346
+ return voteOptionEnum.VOTE_OPTION_NO;
347
+ case 'no_with_veto':
348
+ case 'nowithveto':
349
+ case '4':
350
+ return voteOptionEnum.VOTE_OPTION_NO_WITH_VETO;
351
+ default:
352
+ throw new ManifestMCPError(
353
+ ManifestMCPErrorCode.TX_FAILED,
354
+ `Invalid vote option: ${optionStr}. Expected: yes, no, abstain, or no_with_veto`
355
+ );
356
+ }
357
+ }
358
+
290
359
  /**
291
360
  * Parse amount string into coin (e.g., "1000umfx" -> { amount: "1000", denom: "umfx" })
292
361
  * Supports simple denoms (umfx), IBC denoms (ibc/...), and factory denoms (factory/creator/subdenom)
package/src/types.ts CHANGED
@@ -405,6 +405,47 @@ export interface CreditEstimateResult {
405
405
  readonly estimate: unknown;
406
406
  }
407
407
 
408
+ // Group query results
409
+ export interface GroupInfoResult {
410
+ readonly info?: unknown;
411
+ }
412
+
413
+ export interface GroupPolicyInfoResult {
414
+ readonly info?: unknown;
415
+ }
416
+
417
+ export interface GroupMembersResult extends PaginatedResult {
418
+ readonly members: readonly unknown[];
419
+ }
420
+
421
+ export interface GroupsResult extends PaginatedResult {
422
+ readonly groups: readonly unknown[];
423
+ }
424
+
425
+ export interface GroupPoliciesResult extends PaginatedResult {
426
+ readonly groupPolicies: readonly unknown[];
427
+ }
428
+
429
+ export interface GroupProposalResult {
430
+ readonly proposal?: unknown;
431
+ }
432
+
433
+ export interface GroupProposalsResult extends PaginatedResult {
434
+ readonly proposals: readonly unknown[];
435
+ }
436
+
437
+ export interface GroupVoteResult {
438
+ readonly vote?: unknown;
439
+ }
440
+
441
+ export interface GroupVotesResult extends PaginatedResult {
442
+ readonly votes: readonly unknown[];
443
+ }
444
+
445
+ export interface GroupTallyResult {
446
+ readonly tally?: unknown;
447
+ }
448
+
408
449
  // SKU query results
409
450
  export interface SkuParamsResult {
410
451
  readonly params?: unknown;
@@ -485,7 +526,17 @@ export type QueryResult =
485
526
  | ProviderResult
486
527
  | ProvidersResult
487
528
  | SkuResult
488
- | SkusResult;
529
+ | SkusResult
530
+ | GroupInfoResult
531
+ | GroupPolicyInfoResult
532
+ | GroupMembersResult
533
+ | GroupsResult
534
+ | GroupPoliciesResult
535
+ | GroupProposalResult
536
+ | GroupProposalsResult
537
+ | GroupVoteResult
538
+ | GroupVotesResult
539
+ | GroupTallyResult;
489
540
 
490
541
  /**
491
542
  * Result from a Cosmos query