@dorafactory/maci-sdk 0.0.40 → 0.0.50
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 +5 -1
- package/dist/index.js +3875 -3618
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3249 -2993
- package/dist/index.mjs.map +1 -1
- package/dist/libs/crypto/keys.d.ts +4 -3
- package/dist/libs/http/http.d.ts +1 -0
- package/dist/libs/indexer/indexer.d.ts +2 -1
- package/dist/libs/maci/maci.d.ts +12 -2
- package/dist/libs/query/event.d.ts +1 -0
- package/dist/maci.d.ts +10 -3
- package/dist/types/index.d.ts +9 -0
- package/dist/utils/index.d.ts +17 -0
- package/package.json +3 -1
- package/src/libs/contract/ts/Maci.types.ts +1 -1
- package/src/libs/contract/ts/OracleMaci.types.ts +1 -1
- package/src/libs/crypto/babyjub.ts +22 -13
- package/src/libs/crypto/keys.ts +29 -4
- package/src/libs/errors/index.ts +5 -1
- package/src/libs/http/http.ts +30 -0
- package/src/libs/indexer/indexer.ts +7 -0
- package/src/libs/maci/maci.ts +220 -36
- package/src/libs/query/event.ts +44 -1
- package/src/maci.ts +30 -8
- package/src/types/index.ts +10 -0
- package/src/utils/index.ts +43 -22
- package/dist/index.d.mts +0 -2213
package/README.md
CHANGED
|
@@ -217,10 +217,12 @@ const voteResponse = await client.maci.vote({
|
|
|
217
217
|
**Voting Rules:**
|
|
218
218
|
|
|
219
219
|
MACI supports two voting rules:
|
|
220
|
+
|
|
220
221
|
1. 1P1V (One Person One Vote): Each voting weight (vc) directly counts as votes
|
|
221
222
|
2. QV (Quadratic Voting): The sum of squares of voting weights (vc) is consumed as total voting power
|
|
222
223
|
|
|
223
224
|
Vote options format:
|
|
225
|
+
|
|
224
226
|
```typescript
|
|
225
227
|
selectedOptions: [
|
|
226
228
|
{ idx: number, vc: number }, // idx: option index, vc: voting weight
|
|
@@ -229,13 +231,14 @@ selectedOptions: [
|
|
|
229
231
|
```
|
|
230
232
|
|
|
231
233
|
Examples:
|
|
234
|
+
|
|
232
235
|
```typescript
|
|
233
236
|
// 1P1V mode example (total voting power: 4)
|
|
234
237
|
const options1p1v = [
|
|
235
238
|
{ idx: 0, vc: 2 }, // 2 votes for option 0
|
|
236
239
|
{ idx: 1, vc: 1 }, // 1 vote for option 1
|
|
237
240
|
{ idx: 4, vc: 1 }, // 1 vote for option 4
|
|
238
|
-
];
|
|
241
|
+
];
|
|
239
242
|
// Total voting power consumed = 2 + 1 + 1 = 4
|
|
240
243
|
|
|
241
244
|
// QV mode example (total voting power: 6)
|
|
@@ -248,6 +251,7 @@ const optionsQv = [
|
|
|
248
251
|
```
|
|
249
252
|
|
|
250
253
|
**Important Notes:**
|
|
254
|
+
|
|
251
255
|
- Option indices (idx) must be unique
|
|
252
256
|
- Voting weights (vc) must be positive integers
|
|
253
257
|
- In QV mode, total voting power consumed is the sum of squares of voting weights
|