@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 +41 -0
- package/dist/hooks.d.mts +6 -2619
- package/dist/hooks.d.ts +6 -2619
- package/dist/hooks.js +18553 -211
- package/dist/hooks.js.map +1 -1
- package/dist/hooks.mjs +18400 -80
- package/dist/hooks.mjs.map +1 -1
- package/dist/index-B8e6TdyG.d.mts +2743 -0
- package/dist/index-B8e6TdyG.d.ts +2743 -0
- package/dist/index.d.mts +60 -2
- package/dist/index.d.ts +60 -2
- package/dist/index.js +18668 -178
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +18651 -185
- package/dist/index.mjs.map +1 -1
- package/dist/multisig.d.mts +482 -0
- package/dist/multisig.d.ts +482 -0
- package/dist/multisig.js +744 -0
- package/dist/multisig.js.map +1 -0
- package/dist/multisig.mjs +714 -0
- package/dist/multisig.mjs.map +1 -0
- package/package.json +16 -4
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)
|