@chipi-stack/chipi-react 14.8.0 → 14.10.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.
@@ -1,4 +1,6 @@
1
1
  import * as _tanstack_react_query from '@tanstack/react-query';
2
+ import * as react_jsx_runtime from 'react/jsx-runtime';
3
+ import React from 'react';
2
4
 
3
5
  /**
4
6
  * Framework-agnostic action-template engine for SHHH multisig governance.
@@ -71,6 +73,12 @@ interface ActionTemplate<V = Record<string, unknown>> {
71
73
  /** Optional metadata persisted with the proposal so the approver's app
72
74
  * can render business context (e.g. `{ poolId }`). */
73
75
  meta?: (v: V) => Record<string, string | number>;
76
+ /** App-level risk tier (decision §11.4). When the treasury configured the
77
+ * matching quorum, the backend OVERRIDES requiredApprovals at propose
78
+ * (ROUTINE → routineQuorum, SENSITIVE → sensitiveQuorum). App-enforced
79
+ * for human treasuries — the on-chain wallet threshold stays the hard
80
+ * floor at execute. Omit = no tier (the client's value is used). */
81
+ risk?: "ROUTINE" | "SENSITIVE";
74
82
  }
75
83
  /** Starknet felt252 field prime — args must be a non-negative felt below it. */
76
84
  declare const FELT_PRIME: bigint;
@@ -206,6 +214,8 @@ interface TreasuryProposal {
206
214
  title?: string | null;
207
215
  /** Arbitrary integrator context (e.g. `{ poolId }`). */
208
216
  meta?: Record<string, string | number> | null;
217
+ /** App-level risk tier the proposal was filed under (null = none). */
218
+ risk?: "ROUTINE" | "SENSITIVE" | null;
209
219
  oeMessageHash: string;
210
220
  oeNonce: string | null;
211
221
  oeExecuteBefore: string | null;
@@ -227,6 +237,8 @@ interface ProposeBody {
227
237
  calldata: string[];
228
238
  }[];
229
239
  meta?: Record<string, string | number>;
240
+ /** Template risk tier — lets the backend apply the treasury's quorum policy. */
241
+ risk?: "ROUTINE" | "SENSITIVE";
230
242
  oeMessageHash: string;
231
243
  oeNonce: string;
232
244
  oeExecuteBefore: string;
@@ -347,4 +359,124 @@ declare function useTreasuryProposals(config: {
347
359
  }, Error, TreasuryProposal, unknown>;
348
360
  };
349
361
 
350
- export { type ActionProposal, type ActionTemplate, type CallSpec, FELT_PRIME, type FeltLike, type FieldSpec, type MultisigSigner, type MultisigTransport, OE_WINDOW_SECONDS, type OeSigner, type ProposalSignature, type ProposeBody, type ProposeInput, SN_MAIN_CHAIN_ID, type TreasuryProposal, type VoteValues, amountToBase, assembleActionExecuteCalldata, buildActionProposal, buildApproval, buildExecuteCalldata, createProposal, defineActions, deriveExecuteAfter, deserializeEnvelope, newOeNonce, serializeEnvelope, signActionApproval, toFelt, u256, useProposeAction, useTreasuryProposals, voteTemplate };
362
+ /**
363
+ * Theming for the embeddable governance components (design brief §8).
364
+ *
365
+ * One mechanism: every component root carries inline CSS variables derived
366
+ * from a `theme` prop merged over the defaults, and a single namespaced
367
+ * stylesheet (injected once at runtime) styles everything off those vars.
368
+ * Integrators theme by passing tokens — `<Approvals theme={{ accent:
369
+ * "#0f766e", radius: "0.375rem" }} />` — and the components render native
370
+ * to the host app. No Tailwind/CSS-import requirement; SSR-safe (the
371
+ * stylesheet injects in an effect, and first paint is already var-driven).
372
+ *
373
+ * Default skin = the Chipi neobrutalism system: bold borders, hard offset
374
+ * shadow, high-contrast text.
375
+ */
376
+ interface ChipiGovTheme {
377
+ /** Primary action color (buttons, focus, progress). */
378
+ accent?: string;
379
+ /** Text color on the accent. */
380
+ accentText?: string;
381
+ /** Card/dialog background. */
382
+ surface?: string;
383
+ /** Page-muted background (rows, inputs). */
384
+ surfaceMuted?: string;
385
+ /** Primary text. */
386
+ text?: string;
387
+ /** Secondary text. */
388
+ textMuted?: string;
389
+ /** Error/destructive color. */
390
+ danger?: string;
391
+ /** Success color (executed, looks-good). */
392
+ success?: string;
393
+ /** Border color. */
394
+ border?: string;
395
+ /** Corner radius (any CSS length). */
396
+ radius?: string;
397
+ /** Hard offset shadow (set to "none" for flat hosts). */
398
+ shadow?: string;
399
+ /** Font stack. */
400
+ font?: string;
401
+ }
402
+ declare const DEFAULT_THEME: Required<ChipiGovTheme>;
403
+ /** Inline CSS-var style object for a component root. */
404
+ declare function themeVars(theme?: ChipiGovTheme): Record<string, string>;
405
+ /** Idempotently inject the component stylesheet into the document head. */
406
+ declare function injectGovStyles(): void;
407
+
408
+ /** Light per-type syntax check; returns a human error or null. */
409
+ declare function fieldSyntaxError(field: FieldSpec, raw: string): string | null;
410
+ declare function FieldInput(props: {
411
+ field: FieldSpec;
412
+ value: string;
413
+ onChange: (raw: string) => void;
414
+ /** Shown once the user has touched the field. */
415
+ error?: string | null;
416
+ disabled?: boolean;
417
+ }): react_jsx_runtime.JSX.Element;
418
+
419
+ interface ProposeActionProps {
420
+ /** The treasury's SHHH wallet address. */
421
+ walletAddress: string;
422
+ /** Action templates the proposer can pick from (`defineActions(...)`). */
423
+ actions: ActionTemplate<any>[];
424
+ transport: MultisigTransport;
425
+ signer: MultisigSigner;
426
+ /** Read the wallet's current threshold (host-supplied; chain read). */
427
+ getRequiredApprovals: () => Promise<number>;
428
+ /** Preselect a template by key (also hides the tabs when it's the only one). */
429
+ preselect?: string;
430
+ /** Custom trigger; receives the open callback. Defaults to a button. */
431
+ trigger?: (open: () => void) => React.ReactNode;
432
+ theme?: ChipiGovTheme;
433
+ onProposed?: (proposal: TreasuryProposal) => void;
434
+ chainId?: string;
435
+ }
436
+ declare function ProposeAction(props: ProposeActionProps): react_jsx_runtime.JSX.Element;
437
+
438
+ type ApprovalsFilter = "actionable" | "pending" | "all";
439
+ interface ApprovalsProps {
440
+ /** The treasury's SHHH wallet address. */
441
+ walletAddress: string;
442
+ transport: MultisigTransport;
443
+ signer: MultisigSigner;
444
+ /** Inject business context per row (reads `proposal.meta`). */
445
+ renderContext?: (proposal: TreasuryProposal) => React.ReactNode;
446
+ /** actionable = needs me or ready; pending = not terminal; all. Default actionable. */
447
+ filter?: ApprovalsFilter;
448
+ theme?: ChipiGovTheme;
449
+ onExecuted?: (proposal: TreasuryProposal, txHash?: string) => void;
450
+ /** Custom empty state. */
451
+ empty?: React.ReactNode;
452
+ /** Build an explorer URL for an executed tx hash (row link). */
453
+ explorerTxUrl?: (txHash: string) => string;
454
+ /**
455
+ * Mark a proposal as filed by an AI agent (governance §9). When this
456
+ * returns true, the row reads "{agentLabel} wants: {title}" with an
457
+ * Agent chip — the founder-facing "your agent wants…" copy. The host
458
+ * decides agent-ness (it knows which owner index is its agent); the
459
+ * package stays chain-read-free.
460
+ */
461
+ isAgentProposal?: (proposal: TreasuryProposal) => boolean;
462
+ /** Label for agent rows (default "Agent"). */
463
+ agentLabel?: string;
464
+ }
465
+ /** Human fallback title for legacy payment proposals without `title`. */
466
+ declare function proposalTitle(p: TreasuryProposal): string;
467
+ declare function Approvals(props: ApprovalsProps): react_jsx_runtime.JSX.Element;
468
+
469
+ interface InboxTreasury extends Pick<ApprovalsProps, "walletAddress" | "transport" | "signer" | "renderContext" | "explorerTxUrl" | "isAgentProposal" | "agentLabel"> {
470
+ /** Group heading ("Ops treasury", "Acme · Pool fund"). */
471
+ label: string;
472
+ }
473
+ interface ApprovalInboxProps {
474
+ treasuries: InboxTreasury[];
475
+ theme?: ChipiGovTheme;
476
+ /** Shown when every treasury is caught up. */
477
+ onEmpty?: React.ReactNode;
478
+ onExecuted?: (treasury: InboxTreasury, proposal: TreasuryProposal, txHash?: string) => void;
479
+ }
480
+ declare function ApprovalInbox(props: ApprovalInboxProps): react_jsx_runtime.JSX.Element;
481
+
482
+ export { type ActionProposal, type ActionTemplate, ApprovalInbox, type ApprovalInboxProps, Approvals, type ApprovalsFilter, type ApprovalsProps, type CallSpec, type ChipiGovTheme, DEFAULT_THEME, FELT_PRIME, type FeltLike, FieldInput, type FieldSpec, type InboxTreasury, type MultisigSigner, type MultisigTransport, OE_WINDOW_SECONDS, type OeSigner, type ProposalSignature, ProposeAction, type ProposeActionProps, type ProposeBody, type ProposeInput, SN_MAIN_CHAIN_ID, type TreasuryProposal, type VoteValues, amountToBase, assembleActionExecuteCalldata, buildActionProposal, buildApproval, buildExecuteCalldata, createProposal, defineActions, deriveExecuteAfter, deserializeEnvelope, fieldSyntaxError, injectGovStyles, newOeNonce, proposalTitle, serializeEnvelope, signActionApproval, themeVars, toFelt, u256, useProposeAction, useTreasuryProposals, voteTemplate };
@@ -1,4 +1,6 @@
1
1
  import * as _tanstack_react_query from '@tanstack/react-query';
2
+ import * as react_jsx_runtime from 'react/jsx-runtime';
3
+ import React from 'react';
2
4
 
3
5
  /**
4
6
  * Framework-agnostic action-template engine for SHHH multisig governance.
@@ -71,6 +73,12 @@ interface ActionTemplate<V = Record<string, unknown>> {
71
73
  /** Optional metadata persisted with the proposal so the approver's app
72
74
  * can render business context (e.g. `{ poolId }`). */
73
75
  meta?: (v: V) => Record<string, string | number>;
76
+ /** App-level risk tier (decision §11.4). When the treasury configured the
77
+ * matching quorum, the backend OVERRIDES requiredApprovals at propose
78
+ * (ROUTINE → routineQuorum, SENSITIVE → sensitiveQuorum). App-enforced
79
+ * for human treasuries — the on-chain wallet threshold stays the hard
80
+ * floor at execute. Omit = no tier (the client's value is used). */
81
+ risk?: "ROUTINE" | "SENSITIVE";
74
82
  }
75
83
  /** Starknet felt252 field prime — args must be a non-negative felt below it. */
76
84
  declare const FELT_PRIME: bigint;
@@ -206,6 +214,8 @@ interface TreasuryProposal {
206
214
  title?: string | null;
207
215
  /** Arbitrary integrator context (e.g. `{ poolId }`). */
208
216
  meta?: Record<string, string | number> | null;
217
+ /** App-level risk tier the proposal was filed under (null = none). */
218
+ risk?: "ROUTINE" | "SENSITIVE" | null;
209
219
  oeMessageHash: string;
210
220
  oeNonce: string | null;
211
221
  oeExecuteBefore: string | null;
@@ -227,6 +237,8 @@ interface ProposeBody {
227
237
  calldata: string[];
228
238
  }[];
229
239
  meta?: Record<string, string | number>;
240
+ /** Template risk tier — lets the backend apply the treasury's quorum policy. */
241
+ risk?: "ROUTINE" | "SENSITIVE";
230
242
  oeMessageHash: string;
231
243
  oeNonce: string;
232
244
  oeExecuteBefore: string;
@@ -347,4 +359,124 @@ declare function useTreasuryProposals(config: {
347
359
  }, Error, TreasuryProposal, unknown>;
348
360
  };
349
361
 
350
- export { type ActionProposal, type ActionTemplate, type CallSpec, FELT_PRIME, type FeltLike, type FieldSpec, type MultisigSigner, type MultisigTransport, OE_WINDOW_SECONDS, type OeSigner, type ProposalSignature, type ProposeBody, type ProposeInput, SN_MAIN_CHAIN_ID, type TreasuryProposal, type VoteValues, amountToBase, assembleActionExecuteCalldata, buildActionProposal, buildApproval, buildExecuteCalldata, createProposal, defineActions, deriveExecuteAfter, deserializeEnvelope, newOeNonce, serializeEnvelope, signActionApproval, toFelt, u256, useProposeAction, useTreasuryProposals, voteTemplate };
362
+ /**
363
+ * Theming for the embeddable governance components (design brief §8).
364
+ *
365
+ * One mechanism: every component root carries inline CSS variables derived
366
+ * from a `theme` prop merged over the defaults, and a single namespaced
367
+ * stylesheet (injected once at runtime) styles everything off those vars.
368
+ * Integrators theme by passing tokens — `<Approvals theme={{ accent:
369
+ * "#0f766e", radius: "0.375rem" }} />` — and the components render native
370
+ * to the host app. No Tailwind/CSS-import requirement; SSR-safe (the
371
+ * stylesheet injects in an effect, and first paint is already var-driven).
372
+ *
373
+ * Default skin = the Chipi neobrutalism system: bold borders, hard offset
374
+ * shadow, high-contrast text.
375
+ */
376
+ interface ChipiGovTheme {
377
+ /** Primary action color (buttons, focus, progress). */
378
+ accent?: string;
379
+ /** Text color on the accent. */
380
+ accentText?: string;
381
+ /** Card/dialog background. */
382
+ surface?: string;
383
+ /** Page-muted background (rows, inputs). */
384
+ surfaceMuted?: string;
385
+ /** Primary text. */
386
+ text?: string;
387
+ /** Secondary text. */
388
+ textMuted?: string;
389
+ /** Error/destructive color. */
390
+ danger?: string;
391
+ /** Success color (executed, looks-good). */
392
+ success?: string;
393
+ /** Border color. */
394
+ border?: string;
395
+ /** Corner radius (any CSS length). */
396
+ radius?: string;
397
+ /** Hard offset shadow (set to "none" for flat hosts). */
398
+ shadow?: string;
399
+ /** Font stack. */
400
+ font?: string;
401
+ }
402
+ declare const DEFAULT_THEME: Required<ChipiGovTheme>;
403
+ /** Inline CSS-var style object for a component root. */
404
+ declare function themeVars(theme?: ChipiGovTheme): Record<string, string>;
405
+ /** Idempotently inject the component stylesheet into the document head. */
406
+ declare function injectGovStyles(): void;
407
+
408
+ /** Light per-type syntax check; returns a human error or null. */
409
+ declare function fieldSyntaxError(field: FieldSpec, raw: string): string | null;
410
+ declare function FieldInput(props: {
411
+ field: FieldSpec;
412
+ value: string;
413
+ onChange: (raw: string) => void;
414
+ /** Shown once the user has touched the field. */
415
+ error?: string | null;
416
+ disabled?: boolean;
417
+ }): react_jsx_runtime.JSX.Element;
418
+
419
+ interface ProposeActionProps {
420
+ /** The treasury's SHHH wallet address. */
421
+ walletAddress: string;
422
+ /** Action templates the proposer can pick from (`defineActions(...)`). */
423
+ actions: ActionTemplate<any>[];
424
+ transport: MultisigTransport;
425
+ signer: MultisigSigner;
426
+ /** Read the wallet's current threshold (host-supplied; chain read). */
427
+ getRequiredApprovals: () => Promise<number>;
428
+ /** Preselect a template by key (also hides the tabs when it's the only one). */
429
+ preselect?: string;
430
+ /** Custom trigger; receives the open callback. Defaults to a button. */
431
+ trigger?: (open: () => void) => React.ReactNode;
432
+ theme?: ChipiGovTheme;
433
+ onProposed?: (proposal: TreasuryProposal) => void;
434
+ chainId?: string;
435
+ }
436
+ declare function ProposeAction(props: ProposeActionProps): react_jsx_runtime.JSX.Element;
437
+
438
+ type ApprovalsFilter = "actionable" | "pending" | "all";
439
+ interface ApprovalsProps {
440
+ /** The treasury's SHHH wallet address. */
441
+ walletAddress: string;
442
+ transport: MultisigTransport;
443
+ signer: MultisigSigner;
444
+ /** Inject business context per row (reads `proposal.meta`). */
445
+ renderContext?: (proposal: TreasuryProposal) => React.ReactNode;
446
+ /** actionable = needs me or ready; pending = not terminal; all. Default actionable. */
447
+ filter?: ApprovalsFilter;
448
+ theme?: ChipiGovTheme;
449
+ onExecuted?: (proposal: TreasuryProposal, txHash?: string) => void;
450
+ /** Custom empty state. */
451
+ empty?: React.ReactNode;
452
+ /** Build an explorer URL for an executed tx hash (row link). */
453
+ explorerTxUrl?: (txHash: string) => string;
454
+ /**
455
+ * Mark a proposal as filed by an AI agent (governance §9). When this
456
+ * returns true, the row reads "{agentLabel} wants: {title}" with an
457
+ * Agent chip — the founder-facing "your agent wants…" copy. The host
458
+ * decides agent-ness (it knows which owner index is its agent); the
459
+ * package stays chain-read-free.
460
+ */
461
+ isAgentProposal?: (proposal: TreasuryProposal) => boolean;
462
+ /** Label for agent rows (default "Agent"). */
463
+ agentLabel?: string;
464
+ }
465
+ /** Human fallback title for legacy payment proposals without `title`. */
466
+ declare function proposalTitle(p: TreasuryProposal): string;
467
+ declare function Approvals(props: ApprovalsProps): react_jsx_runtime.JSX.Element;
468
+
469
+ interface InboxTreasury extends Pick<ApprovalsProps, "walletAddress" | "transport" | "signer" | "renderContext" | "explorerTxUrl" | "isAgentProposal" | "agentLabel"> {
470
+ /** Group heading ("Ops treasury", "Acme · Pool fund"). */
471
+ label: string;
472
+ }
473
+ interface ApprovalInboxProps {
474
+ treasuries: InboxTreasury[];
475
+ theme?: ChipiGovTheme;
476
+ /** Shown when every treasury is caught up. */
477
+ onEmpty?: React.ReactNode;
478
+ onExecuted?: (treasury: InboxTreasury, proposal: TreasuryProposal, txHash?: string) => void;
479
+ }
480
+ declare function ApprovalInbox(props: ApprovalInboxProps): react_jsx_runtime.JSX.Element;
481
+
482
+ export { type ActionProposal, type ActionTemplate, ApprovalInbox, type ApprovalInboxProps, Approvals, type ApprovalsFilter, type ApprovalsProps, type CallSpec, type ChipiGovTheme, DEFAULT_THEME, FELT_PRIME, type FeltLike, FieldInput, type FieldSpec, type InboxTreasury, type MultisigSigner, type MultisigTransport, OE_WINDOW_SECONDS, type OeSigner, type ProposalSignature, ProposeAction, type ProposeActionProps, type ProposeBody, type ProposeInput, SN_MAIN_CHAIN_ID, type TreasuryProposal, type VoteValues, amountToBase, assembleActionExecuteCalldata, buildActionProposal, buildApproval, buildExecuteCalldata, createProposal, defineActions, deriveExecuteAfter, deserializeEnvelope, fieldSyntaxError, injectGovStyles, newOeNonce, proposalTitle, serializeEnvelope, signActionApproval, themeVars, toFelt, u256, useProposeAction, useTreasuryProposals, voteTemplate };