@dorafactory/maci-sdk 0.0.55 → 0.0.56
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.js +21 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +21 -5
- package/dist/index.mjs.map +1 -1
- package/dist/libs/contract/contract.d.ts +2 -1
- package/dist/libs/contract/utils.d.ts +1 -1
- package/dist/libs/maci/maci.d.ts +1 -0
- package/dist/types/index.d.ts +1 -0
- package/package.json +1 -1
- package/src/libs/contract/contract.ts +8 -1
- package/src/libs/contract/utils.ts +15 -3
- package/src/libs/maci/maci.ts +3 -1
- package/src/maci.ts +1 -0
- package/src/types/index.ts +1 -0
package/dist/index.js
CHANGED
|
@@ -4801,15 +4801,23 @@ function getContractParams(type, circuitType, proofSystem, maxVoter, maxOption)
|
|
|
4801
4801
|
};
|
|
4802
4802
|
}
|
|
4803
4803
|
}
|
|
4804
|
-
function getAMaciRoundCircuitFee(maxVoter, maxOption) {
|
|
4804
|
+
function getAMaciRoundCircuitFee(network, maxVoter, maxOption) {
|
|
4805
4805
|
let requiredFee = {
|
|
4806
4806
|
denom: "peaka",
|
|
4807
4807
|
amount: "0"
|
|
4808
4808
|
};
|
|
4809
4809
|
if (maxVoter <= 25 && maxOption <= 5) {
|
|
4810
|
-
|
|
4810
|
+
if (network === "mainnet") {
|
|
4811
|
+
requiredFee.amount = "20000000000000000000";
|
|
4812
|
+
} else {
|
|
4813
|
+
requiredFee.amount = "50000000000000000000";
|
|
4814
|
+
}
|
|
4811
4815
|
} else if (maxVoter <= 625 && maxOption <= 25) {
|
|
4812
|
-
|
|
4816
|
+
if (network === "mainnet") {
|
|
4817
|
+
requiredFee.amount = "750000000000000000000";
|
|
4818
|
+
} else {
|
|
4819
|
+
requiredFee.amount = "100000000000000000000";
|
|
4820
|
+
}
|
|
4813
4821
|
} else {
|
|
4814
4822
|
throw new Error("Number of voters or options is too large.");
|
|
4815
4823
|
}
|
|
@@ -4819,6 +4827,7 @@ function getAMaciRoundCircuitFee(maxVoter, maxOption) {
|
|
|
4819
4827
|
// src/libs/contract/contract.ts
|
|
4820
4828
|
var Contract = class {
|
|
4821
4829
|
constructor({
|
|
4830
|
+
network,
|
|
4822
4831
|
rpcEndpoint,
|
|
4823
4832
|
registryAddress,
|
|
4824
4833
|
maciCodeId,
|
|
@@ -4826,6 +4835,7 @@ var Contract = class {
|
|
|
4826
4835
|
feegrantOperator,
|
|
4827
4836
|
whitelistBackendPubkey
|
|
4828
4837
|
}) {
|
|
4838
|
+
this.network = network;
|
|
4829
4839
|
this.rpcEndpoint = rpcEndpoint;
|
|
4830
4840
|
this.registryAddress = registryAddress;
|
|
4831
4841
|
this.maciCodeId = maciCodeId;
|
|
@@ -4856,7 +4866,11 @@ var Contract = class {
|
|
|
4856
4866
|
wallet: signer,
|
|
4857
4867
|
contractAddress: this.registryAddress
|
|
4858
4868
|
});
|
|
4859
|
-
const requiredFee = getAMaciRoundCircuitFee(
|
|
4869
|
+
const requiredFee = getAMaciRoundCircuitFee(
|
|
4870
|
+
this.network,
|
|
4871
|
+
maxVoter,
|
|
4872
|
+
maxOption
|
|
4873
|
+
);
|
|
4860
4874
|
preDeactivateRoot = preDeactivateRoot || "0";
|
|
4861
4875
|
const res = await client.createRound(
|
|
4862
4876
|
{
|
|
@@ -5140,6 +5154,7 @@ var MACI = class {
|
|
|
5140
5154
|
oracleCertificate,
|
|
5141
5155
|
maciKeypair
|
|
5142
5156
|
}) {
|
|
5157
|
+
this.network = contract.network;
|
|
5143
5158
|
this.contract = contract;
|
|
5144
5159
|
this.indexer = indexer;
|
|
5145
5160
|
this.oracleCertificate = oracleCertificate;
|
|
@@ -5378,7 +5393,7 @@ var MACI = class {
|
|
|
5378
5393
|
maxVoter,
|
|
5379
5394
|
maxOption
|
|
5380
5395
|
}) {
|
|
5381
|
-
const fee = getAMaciRoundCircuitFee(maxVoter, maxOption);
|
|
5396
|
+
const fee = getAMaciRoundCircuitFee(this.network, maxVoter, maxOption);
|
|
5382
5397
|
return fee;
|
|
5383
5398
|
}
|
|
5384
5399
|
async queryRoundGasStation({ contractAddress }) {
|
|
@@ -6015,6 +6030,7 @@ var MaciClient2 = class {
|
|
|
6015
6030
|
http: this.http
|
|
6016
6031
|
});
|
|
6017
6032
|
this.contract = new Contract({
|
|
6033
|
+
network: this.network,
|
|
6018
6034
|
rpcEndpoint: this.rpcEndpoint,
|
|
6019
6035
|
registryAddress: this.registryAddress,
|
|
6020
6036
|
maciCodeId: this.maciCodeId,
|