@dorafactory/maci-sdk 0.0.37 → 0.0.39
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/dist/index.d.mts +2213 -0
- package/dist/index.d.ts +7 -11
- package/dist/index.js +9 -142
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +9 -135
- package/dist/index.mjs.map +1 -1
- package/dist/libs/contract/contract.d.ts +4 -8
- package/dist/maci.d.ts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/package.json +2 -16
- package/src/index.ts +25 -11
- package/src/libs/contract/config.ts +1 -4
- package/src/libs/contract/contract.ts +2 -21
- package/src/maci.ts +8 -2
- package/src/types/index.ts +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
export * from './libs';
|
|
2
|
-
export type * from './types';
|
|
3
|
-
export * from './types';
|
|
4
|
-
export * from './libs/const';
|
|
5
1
|
export { MaciClient } from './maci';
|
|
6
2
|
export { Http } from './libs/http';
|
|
7
|
-
export { Round } from './libs/query';
|
|
8
|
-
export { UserAccount } from './libs/query';
|
|
9
|
-
export { Circuit } from './libs/query';
|
|
10
|
-
export { Operator } from './libs/query';
|
|
11
|
-
export { Proof } from './libs/query';
|
|
12
|
-
export { Transaction } from './libs/query';
|
|
3
|
+
export { Round, UserAccount, Circuit, Operator, Proof, Transaction, } from './libs/query';
|
|
13
4
|
export * from './libs/crypto';
|
|
14
|
-
export * from './
|
|
5
|
+
export * from './types';
|
|
6
|
+
export type * from './types';
|
|
7
|
+
export { circuits, getDefaultParams, type NetworkConfig } from './libs/const';
|
|
8
|
+
export { stringizing, bigInt2Buffer } from './libs/crypto/bigintUtils';
|
|
9
|
+
export { isValidAddress } from './utils';
|
|
10
|
+
export { getAMaciRoundCircuitFee } from './libs/contract/utils';
|
package/dist/index.js
CHANGED
|
@@ -31,20 +31,15 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
31
31
|
var index_exports = {};
|
|
32
32
|
__export(index_exports, {
|
|
33
33
|
Circuit: () => Circuit,
|
|
34
|
-
Contract: () => Contract,
|
|
35
|
-
Event: () => Event,
|
|
36
34
|
G1Point: () => G1Point,
|
|
37
35
|
G2Point: () => G2Point,
|
|
38
36
|
Http: () => Http,
|
|
39
|
-
Indexer: () => Indexer,
|
|
40
|
-
MACI: () => MACI,
|
|
41
37
|
MaciCertSystemType: () => MaciCertSystemType,
|
|
42
38
|
MaciCircuitType: () => MaciCircuitType,
|
|
43
39
|
MaciClient: () => MaciClient2,
|
|
44
40
|
MaciRoundType: () => MaciRoundType,
|
|
45
41
|
NOTHING_UP_MY_SLEEVE: () => NOTHING_UP_MY_SLEEVE,
|
|
46
42
|
Operator: () => Operator,
|
|
47
|
-
OracleCertificate: () => OracleCertificate,
|
|
48
43
|
PAD_KEY_HASH: () => PAD_KEY_HASH,
|
|
49
44
|
Proof: () => Proof,
|
|
50
45
|
Round: () => Round,
|
|
@@ -67,8 +62,6 @@ __export(index_exports, {
|
|
|
67
62
|
genRandomBabyJubValue: () => genRandomBabyJubValue,
|
|
68
63
|
genRandomSalt: () => genRandomSalt,
|
|
69
64
|
getAMaciRoundCircuitFee: () => getAMaciRoundCircuitFee,
|
|
70
|
-
getCircuitType: () => getCircuitType,
|
|
71
|
-
getContractParams: () => getContractParams,
|
|
72
65
|
getDefaultParams: () => getDefaultParams,
|
|
73
66
|
hash12: () => hash12,
|
|
74
67
|
hash2: () => hash2,
|
|
@@ -79,7 +72,6 @@ __export(index_exports, {
|
|
|
79
72
|
hashLeftRight: () => hashLeftRight,
|
|
80
73
|
hashN: () => hashN,
|
|
81
74
|
hashOne: () => hashOne,
|
|
82
|
-
hexToDecimalString: () => hexToDecimalString,
|
|
83
75
|
isValidAddress: () => isValidAddress,
|
|
84
76
|
packPubKey: () => packPubKey,
|
|
85
77
|
poseidon: () => poseidon,
|
|
@@ -91,8 +83,7 @@ __export(index_exports, {
|
|
|
91
83
|
sha256Hash: () => sha256Hash,
|
|
92
84
|
signMessage: () => signMessage2,
|
|
93
85
|
stringizing: () => stringizing,
|
|
94
|
-
unpackPubKey: () => unpackPubKey
|
|
95
|
-
validator_operator_set: () => validator_operator_set
|
|
86
|
+
unpackPubKey: () => unpackPubKey
|
|
96
87
|
});
|
|
97
88
|
module.exports = __toCommonJS(index_exports);
|
|
98
89
|
|
|
@@ -399,107 +390,6 @@ var circuits = {
|
|
|
399
390
|
zipUrl: "https://github.com/DoraFactory/Vota-Circuits/archive/refs/heads/main.zip"
|
|
400
391
|
}
|
|
401
392
|
};
|
|
402
|
-
var validator_operator_set = {
|
|
403
|
-
doravaloper12yk434ut3un4wx0rult2aww89rsrel8nhmp387: {
|
|
404
|
-
operator_address: "",
|
|
405
|
-
account_address: "dora12yk434ut3un4wx0rult2aww89rsrel8nydy83p",
|
|
406
|
-
allocation: "22571615985356796592128",
|
|
407
|
-
allocation_dora: 22571.615985356795,
|
|
408
|
-
moniker: "\u{1D425}\u{1D41E}\u{1D42C}\u{1D427}\u{1D422}\u{1D424} | \u{1D414}\u{1D413}\u{1D412}\u{1D400}",
|
|
409
|
-
program_voting_power: 0.06432895760166438,
|
|
410
|
-
tokens: "200731587709257889972292"
|
|
411
|
-
},
|
|
412
|
-
doravaloper15frh0nn3v4yp3vv6sk4pn6jg9l8rt82f7uqfk5: {
|
|
413
|
-
operator_address: "",
|
|
414
|
-
account_address: "dora15frh0nn3v4yp3vv6sk4pn6jg9l8rt82fd29lqt",
|
|
415
|
-
allocation: "33745159209325474873344",
|
|
416
|
-
allocation_dora: 33745.15920932547,
|
|
417
|
-
moniker: "NomadValidator",
|
|
418
|
-
program_voting_power: 0.09617348254756773,
|
|
419
|
-
tokens: "300099000000000000000000"
|
|
420
|
-
},
|
|
421
|
-
doravaloper1ddewp74vd2w8jhth2p0uazmc8ajgtcuf3ntqgn: {
|
|
422
|
-
operator_address: "",
|
|
423
|
-
account_address: "dora1ddewp74vd2w8jhth2p0uazmc8ajgtcufz9wk7v",
|
|
424
|
-
allocation: "40789397021635754590208",
|
|
425
|
-
allocation_dora: 40789.397021635756,
|
|
426
|
-
moniker: "polkachu.com",
|
|
427
|
-
program_voting_power: 0.11624951413777938,
|
|
428
|
-
tokens: "362744095556470434789338"
|
|
429
|
-
},
|
|
430
|
-
doravaloper1gh8j89jtc2vx6d3y4ehllcdlvluwa49w6xmjsm: {
|
|
431
|
-
operator_address: "",
|
|
432
|
-
account_address: "dora1gh8j89jtc2vx6d3y4ehllcdlvluwa49wfs7yxy",
|
|
433
|
-
allocation: "33743029941764137943040",
|
|
434
|
-
allocation_dora: 33743.029941764136,
|
|
435
|
-
moniker: "ITRocket",
|
|
436
|
-
program_voting_power: 0.09616741414897524,
|
|
437
|
-
tokens: "300080064215405665352721"
|
|
438
|
-
},
|
|
439
|
-
doravaloper1j8ru7p8zctup6grfwuga6ndrjj7v88wzn407x7: {
|
|
440
|
-
operator_address: "",
|
|
441
|
-
account_address: "dora1j8ru7p8zctup6grfwuga6ndrjj7v88wzqr2gsp",
|
|
442
|
-
allocation: "22646525272055477174272",
|
|
443
|
-
allocation_dora: 22646.525272055478,
|
|
444
|
-
moniker: "StakeUs",
|
|
445
|
-
program_voting_power: 0.06454244857772638,
|
|
446
|
-
tokens: "201397763319500000000000"
|
|
447
|
-
},
|
|
448
|
-
doravaloper1l5zz0kkjt2n7nllsrymy96mc2v2gehda0zc85s: {
|
|
449
|
-
operator_address: "",
|
|
450
|
-
account_address: "dora1l5zz0kkjt2n7nllsrymy96mc2v2gehdau5a3z0",
|
|
451
|
-
allocation: "22622846742220005965824",
|
|
452
|
-
allocation_dora: 22622.846742220005,
|
|
453
|
-
moniker: "BlackNodes",
|
|
454
|
-
program_voting_power: 0.06447496492290769,
|
|
455
|
-
tokens: "201187187838702364379121"
|
|
456
|
-
},
|
|
457
|
-
doravaloper1m9v3txhhtadjxpv09gwjhhs344qsxgfscwxjkg: {
|
|
458
|
-
operator_address: "",
|
|
459
|
-
account_address: "dora1m9v3txhhtadjxpv09gwjhhs344qsxgfstcryqh",
|
|
460
|
-
allocation: "22549006983854435598336",
|
|
461
|
-
allocation_dora: 22549.006983854437,
|
|
462
|
-
moniker: "\u{1F44B} 79anvi \u{1F340}",
|
|
463
|
-
program_voting_power: 0.06426452209558432,
|
|
464
|
-
tokens: "200530523648490887200824"
|
|
465
|
-
},
|
|
466
|
-
doravaloper1tu8006g60t62zwgwf5knkaujv0uzhp2a6wh94h: {
|
|
467
|
-
operator_address: "",
|
|
468
|
-
account_address: "dora1tu8006g60t62zwgwf5knkaujv0uzhp2afcjnrg",
|
|
469
|
-
allocation: "39369183740744815345664",
|
|
470
|
-
allocation_dora: 39369.18374074482,
|
|
471
|
-
moniker: "Citadel.one",
|
|
472
|
-
program_voting_power: 0.11220191559671686,
|
|
473
|
-
tokens: "350114000000000000000000"
|
|
474
|
-
},
|
|
475
|
-
doravaloper1x5z0tkafrgyeuqkrwfjr933vghjxchqnqlhcdw: {
|
|
476
|
-
operator_address: "",
|
|
477
|
-
account_address: "dora1x5z0tkafrgyeuqkrwfjr933vghjxchqnnfjwm3",
|
|
478
|
-
allocation: "22611521290904268701696",
|
|
479
|
-
allocation_dora: 22611.521290904268,
|
|
480
|
-
moniker: "1ce",
|
|
481
|
-
program_voting_power: 0.064442687460896,
|
|
482
|
-
tokens: "201086469492900000000000"
|
|
483
|
-
},
|
|
484
|
-
doravaloper1z6kfew2nhuh02szc2hdecw4fqey2d32auucvux: {
|
|
485
|
-
operator_address: "",
|
|
486
|
-
account_address: "dora1z6kfew2nhuh02szc2hdecw4fqey2d32a02a62e",
|
|
487
|
-
allocation: "45246951843662957379584",
|
|
488
|
-
allocation_dora: 45246.95184366296,
|
|
489
|
-
moniker: "Nodes.Guru",
|
|
490
|
-
program_voting_power: 0.12895351616135226,
|
|
491
|
-
tokens: "402385566389000000000006"
|
|
492
|
-
},
|
|
493
|
-
doravaloper1zzne8ufazycklx4j6mgc987t8ykd6wxu63223v: {
|
|
494
|
-
operator_address: "",
|
|
495
|
-
account_address: "dora1zzne8ufazycklx4j6mgc987t8ykd6wxu63223v",
|
|
496
|
-
allocation: "44982761968475888943104",
|
|
497
|
-
allocation_dora: 44982.76196847589,
|
|
498
|
-
moniker: "ZKV",
|
|
499
|
-
program_voting_power: 0.12820057674882976,
|
|
500
|
-
tokens: "400036100000000000000000"
|
|
501
|
-
}
|
|
502
|
-
};
|
|
503
393
|
function getDefaultParams(network = "mainnet") {
|
|
504
394
|
switch (network) {
|
|
505
395
|
case "mainnet":
|
|
@@ -627,10 +517,6 @@ function verifyIsBech32(address) {
|
|
|
627
517
|
function isValidAddress(address) {
|
|
628
518
|
return address.startsWith("dora") && verifyIsBech32(address) === void 0;
|
|
629
519
|
}
|
|
630
|
-
function hexToDecimalString(hexString) {
|
|
631
|
-
const decimalString = BigInt("0x" + hexString).toString(10);
|
|
632
|
-
return decimalString;
|
|
633
|
-
}
|
|
634
520
|
|
|
635
521
|
// src/libs/query/operator.ts
|
|
636
522
|
var Operator = class {
|
|
@@ -4134,22 +4020,6 @@ var QTR_LIB = {
|
|
|
4134
4020
|
};
|
|
4135
4021
|
|
|
4136
4022
|
// src/libs/contract/utils.ts
|
|
4137
|
-
function getCircuitType(circuitType) {
|
|
4138
|
-
let maciVoteType = null;
|
|
4139
|
-
switch (circuitType) {
|
|
4140
|
-
case "0" /* IP1V */:
|
|
4141
|
-
maciVoteType = "0";
|
|
4142
|
-
break;
|
|
4143
|
-
case "1" /* QV */:
|
|
4144
|
-
maciVoteType = "1";
|
|
4145
|
-
break;
|
|
4146
|
-
default:
|
|
4147
|
-
throw new Error(
|
|
4148
|
-
`Invalid circuit type ${circuitType}, only support 1P1V and QV`
|
|
4149
|
-
);
|
|
4150
|
-
}
|
|
4151
|
-
return maciVoteType;
|
|
4152
|
-
}
|
|
4153
4023
|
function getContractParams(type, circuitType, proofSystem, maxVoter, maxOption) {
|
|
4154
4024
|
let parameters;
|
|
4155
4025
|
let groth16ProcessVkey = null;
|
|
@@ -5913,7 +5783,13 @@ var MaciClient2 = class {
|
|
|
5913
5783
|
});
|
|
5914
5784
|
}
|
|
5915
5785
|
getSigner(signer) {
|
|
5916
|
-
|
|
5786
|
+
if (signer) {
|
|
5787
|
+
return signer;
|
|
5788
|
+
}
|
|
5789
|
+
if (this.signer) {
|
|
5790
|
+
return this.signer;
|
|
5791
|
+
}
|
|
5792
|
+
throw new Error("No signer provided, please provide a signer");
|
|
5917
5793
|
}
|
|
5918
5794
|
getMaciKeypair() {
|
|
5919
5795
|
return this.maciKeypair;
|
|
@@ -6221,20 +6097,15 @@ var MaciClient2 = class {
|
|
|
6221
6097
|
// Annotate the CommonJS export names for ESM import in node:
|
|
6222
6098
|
0 && (module.exports = {
|
|
6223
6099
|
Circuit,
|
|
6224
|
-
Contract,
|
|
6225
|
-
Event,
|
|
6226
6100
|
G1Point,
|
|
6227
6101
|
G2Point,
|
|
6228
6102
|
Http,
|
|
6229
|
-
Indexer,
|
|
6230
|
-
MACI,
|
|
6231
6103
|
MaciCertSystemType,
|
|
6232
6104
|
MaciCircuitType,
|
|
6233
6105
|
MaciClient,
|
|
6234
6106
|
MaciRoundType,
|
|
6235
6107
|
NOTHING_UP_MY_SLEEVE,
|
|
6236
6108
|
Operator,
|
|
6237
|
-
OracleCertificate,
|
|
6238
6109
|
PAD_KEY_HASH,
|
|
6239
6110
|
Proof,
|
|
6240
6111
|
Round,
|
|
@@ -6257,8 +6128,6 @@ var MaciClient2 = class {
|
|
|
6257
6128
|
genRandomBabyJubValue,
|
|
6258
6129
|
genRandomSalt,
|
|
6259
6130
|
getAMaciRoundCircuitFee,
|
|
6260
|
-
getCircuitType,
|
|
6261
|
-
getContractParams,
|
|
6262
6131
|
getDefaultParams,
|
|
6263
6132
|
hash12,
|
|
6264
6133
|
hash2,
|
|
@@ -6269,7 +6138,6 @@ var MaciClient2 = class {
|
|
|
6269
6138
|
hashLeftRight,
|
|
6270
6139
|
hashN,
|
|
6271
6140
|
hashOne,
|
|
6272
|
-
hexToDecimalString,
|
|
6273
6141
|
isValidAddress,
|
|
6274
6142
|
packPubKey,
|
|
6275
6143
|
poseidon,
|
|
@@ -6281,7 +6149,6 @@ var MaciClient2 = class {
|
|
|
6281
6149
|
sha256Hash,
|
|
6282
6150
|
signMessage,
|
|
6283
6151
|
stringizing,
|
|
6284
|
-
unpackPubKey
|
|
6285
|
-
validator_operator_set
|
|
6152
|
+
unpackPubKey
|
|
6286
6153
|
});
|
|
6287
6154
|
//# sourceMappingURL=index.js.map
|