@dorafactory/maci-sdk 0.0.7 → 0.0.9

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 (50) hide show
  1. package/README.md +27 -7
  2. package/dist/index.js +751 -187
  3. package/dist/index.js.map +1 -1
  4. package/dist/index.mjs +748 -187
  5. package/dist/index.mjs.map +1 -1
  6. package/dist/libs/circom/tree.d.ts +20 -20
  7. package/dist/libs/contract/ts/AMaci.client.d.ts +1 -1
  8. package/dist/libs/contract/ts/Maci.client.d.ts +21 -47
  9. package/dist/libs/contract/ts/Maci.types.d.ts +40 -31
  10. package/dist/libs/contract/ts/OracleMaci.client.d.ts +52 -52
  11. package/dist/libs/contract/ts/OracleMaci.types.d.ts +17 -7
  12. package/dist/libs/contract/ts/Registry.client.d.ts +2 -2
  13. package/dist/libs/contract/types.d.ts +2 -2
  14. package/dist/libs/errors/types.d.ts +1 -0
  15. package/dist/libs/http/http.d.ts +1 -1
  16. package/dist/libs/index.d.ts +3 -0
  17. package/dist/libs/indexer/indexer.d.ts +11 -2
  18. package/dist/libs/maci/index.d.ts +1 -0
  19. package/dist/libs/maci/maci.d.ts +64 -5
  20. package/dist/libs/oracle-certificate/oracle-certificate.d.ts +1 -21
  21. package/dist/libs/oracle-certificate/types.d.ts +12 -0
  22. package/dist/libs/query/event.d.ts +7 -0
  23. package/dist/libs/query/index.d.ts +1 -0
  24. package/dist/maci.d.ts +7 -5
  25. package/dist/types/index.d.ts +22 -0
  26. package/package.json +1 -1
  27. package/src/libs/const.ts +3 -2
  28. package/src/libs/contract/contract.ts +2 -6
  29. package/src/libs/contract/ts/AMaci.client.ts +868 -874
  30. package/src/libs/contract/ts/AMaci.types.ts +216 -216
  31. package/src/libs/contract/ts/Maci.client.ts +748 -888
  32. package/src/libs/contract/ts/Maci.types.ts +229 -224
  33. package/src/libs/contract/ts/OracleMaci.client.ts +623 -348
  34. package/src/libs/contract/ts/OracleMaci.types.ts +191 -138
  35. package/src/libs/contract/ts/Registry.client.ts +438 -446
  36. package/src/libs/contract/ts/Registry.types.ts +97 -97
  37. package/src/libs/contract/types.ts +6 -2
  38. package/src/libs/contract/utils.ts +9 -0
  39. package/src/libs/errors/types.ts +1 -0
  40. package/src/libs/http/http.ts +3 -7
  41. package/src/libs/index.ts +3 -0
  42. package/src/libs/indexer/indexer.ts +18 -0
  43. package/src/libs/maci/index.ts +1 -0
  44. package/src/libs/maci/maci.ts +302 -10
  45. package/src/libs/oracle-certificate/oracle-certificate.ts +19 -73
  46. package/src/libs/oracle-certificate/types.ts +15 -1
  47. package/src/libs/query/event.ts +78 -0
  48. package/src/libs/query/index.ts +1 -0
  49. package/src/maci.ts +27 -5
  50. package/src/types/index.ts +28 -0
package/README.md CHANGED
@@ -23,11 +23,13 @@ const client = new MaciClient({
23
23
  ### Query Functions
24
24
 
25
25
  #### Query Account Balance
26
+
26
27
  ```typescript
27
28
  const balance = await client.balanceOf('dora1...');
28
29
  ```
29
30
 
30
31
  #### Query Round Information
32
+
31
33
  ```typescript
32
34
  // Query round by ID
33
35
  const round = await client.getRoundById('dora1...');
@@ -39,13 +41,22 @@ const rounds = await client.getRounds('first', 10);
39
41
  const roundsByStatus = await client.getRoundsByStatus('Created', 'first', 10);
40
42
 
41
43
  // Query rounds by circuit name
42
- const roundsByCircuit = await client.getRoundsByCircuitName('amaci-qv', 'first', 10);
44
+ const roundsByCircuit = await client.getRoundsByCircuitName(
45
+ 'amaci-qv',
46
+ 'first',
47
+ 10
48
+ );
43
49
 
44
50
  // Query rounds by operator address
45
- const roundsByOperator = await client.getRoundsByOperator('dora1...', 'first', 10);
51
+ const roundsByOperator = await client.getRoundsByOperator(
52
+ 'dora1...',
53
+ 'first',
54
+ 10
55
+ );
46
56
  ```
47
57
 
48
58
  #### Query Operator Information
59
+
49
60
  ```typescript
50
61
  // Query operator by address
51
62
  const operator = await client.getOperatorByAddress('dora1...');
@@ -55,6 +66,7 @@ const operators = await client.getOperators('first', 10);
55
66
  ```
56
67
 
57
68
  #### Query Circuit Information
69
+
58
70
  ```typescript
59
71
  // Query circuit by name
60
72
  const circuit = await client.getCircuitByName('amaci-qv');
@@ -64,6 +76,7 @@ const circuits = await client.getCircuits();
64
76
  ```
65
77
 
66
78
  #### Query Transaction Information
79
+
67
80
  ```typescript
68
81
  // Query transaction by hash
69
82
  const transaction = await client.getTransactionByHash('HASH...');
@@ -72,10 +85,15 @@ const transaction = await client.getTransactionByHash('HASH...');
72
85
  const transactions = await client.getTransactions('first', 10);
73
86
 
74
87
  // Query transactions by contract address
75
- const txByContract = await client.getTransactionsByContractAddress('dora1...', 'first', 10);
88
+ const txByContract = await client.getTransactionsByContractAddress(
89
+ 'dora1...',
90
+ 'first',
91
+ 10
92
+ );
76
93
  ```
77
94
 
78
95
  #### Query Proof Information
96
+
79
97
  ```typescript
80
98
  const proof = await client.getProofByContractAddress('dora1...');
81
99
  ```
@@ -83,6 +101,7 @@ const proof = await client.getProofByContractAddress('dora1...');
83
101
  ### Contract Interactions
84
102
 
85
103
  #### Create New Oracle Maci Round
104
+
86
105
  ```typescript
87
106
  const wallet = await DirectSecp256k1Wallet.fromKey(
88
107
  Buffer.from(privateKey, 'hex'),
@@ -110,7 +129,8 @@ const newRound = await client.createOracleMaciRound({
110
129
  });
111
130
  ```
112
131
 
113
- **Note:**
132
+ **Note:**
133
+
114
134
  - The `operatorPubkey` is the public key of the operator. It is the compressed public key of the operator's private key.
115
135
  - The `whitelistEcosystem` is the ecosystem of the whitelist (e.g. 'cosmoshub'). Only wallet addresses that have staked tokens in the specified ecosystem before the snapshot block height will be eligible to become voters.
116
136
  - The `whitelistSnapshotHeight` is the snapshot block height for checking voter eligibility. The minimum valid height is 23,342,001. If set to "0", the round will evaluate the voter's stake at the time of signup.
@@ -123,6 +143,6 @@ const newRound = await client.createOracleMaciRound({
123
143
 
124
144
  For example, if a voter stakes 100000000 tokens and the slope value is 2500000, the voter will be assigned 40 voice credits.
125
145
 
126
- > The 1,000,000 reference value here is the precision of cosmoshub, which is 6 bits, and doravota, which is 18 bits, so when you want to pick doravota's staker as a whitelist and ask them to pledge 1DORA to convert 1vote, you need to set the scope to 1000000000000000000 (10**18). Note that currently only cosmoshub and doravota are supported as ecosystem options.
127
- >
128
- > One detail, here the slope is calculated by rounding down.
146
+ > The 1,000,000 reference value here is the precision of cosmoshub, which is 6 bits, and doravota, which is 18 bits, so when you want to pick doravota's staker as a whitelist and ask them to pledge 1DORA to convert 1vote, you need to set the scope to 1000000000000000000 (10\*\*18). Note that currently only cosmoshub and doravota are supported as ecosystem options.
147
+ >
148
+ > One detail, here the slope is calculated by rounding down.