@chipi-stack/chipi-react 14.7.0 → 14.9.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.
package/README.md CHANGED
@@ -58,9 +58,50 @@ function Wallet() {
58
58
  - **In-app token transfer UIs** — send and receive USDC with a few lines of React
59
59
  - **Connect-with-passkey flows** — biometric wallet login without seed phrases
60
60
  - **DeFi dashboards and loyalty/rewards redemption interfaces** — display balances, history, and reward claims
61
+ - **Multisig treasury governance** — propose/approve/execute any contract action with N-of-M approvals (see `/multisig` below)
61
62
 
62
63
  Have an idea? [Tell us what you want to build](https://github.com/chipi-pay/build-with-chipi/issues/new)
63
64
 
65
+ ## Multisig governance (`@chipi-stack/chipi-react/multisig`)
66
+
67
+ > Tree-shakeable subpath for SHHH multisig: propose any contract action (or a vote), collect N-of-M approvals, execute. Experimental — the API may change.
68
+
69
+ Describe your actions once as typed templates, then drive them with hooks. The hooks are auth- and chain-agnostic: you pass a `MultisigTransport` (your coordination backend) and a `MultisigSigner` (per-owner OE signer), and own the UI.
70
+
71
+ ```tsx
72
+ import {
73
+ defineActions, voteTemplate, u256, toFelt,
74
+ useProposeAction, useTreasuryProposals,
75
+ type MultisigTransport, type MultisigSigner,
76
+ } from "@chipi-stack/chipi-react/multisig";
77
+
78
+ // 1. Register your action templates (vote ships built-in).
79
+ const ACTIONS = defineActions([
80
+ voteTemplate({ governanceContract: "0x…" }),
81
+ {
82
+ key: "stake",
83
+ label: "Stake",
84
+ fields: [{ name: "amount", label: "Amount", type: "amount", decimals: 18 }],
85
+ toCalls: (v) => [{ to: "0x…", entrypoint: "stake", calldata: u256(v.amount) }],
86
+ title: (v) => `Stake ${v.amount}`,
87
+ },
88
+ ]);
89
+
90
+ // 2. Propose → approve → execute (you supply transport + signer).
91
+ function Governance({ walletAddress, transport, signer }: {
92
+ walletAddress: string; transport: MultisigTransport; signer: MultisigSigner;
93
+ }) {
94
+ const propose = useProposeAction({
95
+ walletAddress, transport, signer,
96
+ getRequiredApprovals: async () => 2, // read your wallet's threshold
97
+ });
98
+ const { proposals, approve, execute } = useTreasuryProposals({ walletAddress, transport, signer });
99
+ // render your own UI on top of these
100
+ }
101
+ ```
102
+
103
+ The pure pieces — `defineActions`, `voteTemplate`, the `toFelt`/`u256`/`amountToBase` encoders, and the OE core (`buildActionProposal`/`signActionApproval`/`assembleActionExecuteCalldata`) — have no React or network dependency, so templates and calldata are unit-testable in isolation.
104
+
64
105
  ## Documentation
65
106
 
66
107
  Full docs at [docs.chipipay.com](https://docs.chipipay.com)