@dorafactory/maci-sdk 0.0.31 → 0.0.33
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/browser.d.mts +136 -120
- package/dist/browser.d.ts +136 -120
- package/dist/browser.js +225 -137
- package/dist/browser.js.map +1 -1
- package/dist/browser.mjs +225 -137
- package/dist/browser.mjs.map +1 -1
- package/dist/index.d.mts +136 -120
- package/dist/index.d.ts +136 -120
- package/dist/index.js +225 -137
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +225 -137
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/libs/maci/maci.ts +29 -12
- package/src/maci.ts +315 -159
package/dist/index.js
CHANGED
|
@@ -5376,13 +5376,21 @@ var MACI = class {
|
|
|
5376
5376
|
}
|
|
5377
5377
|
/**
|
|
5378
5378
|
* Batch grant with bond (for maci)
|
|
5379
|
-
* @param
|
|
5379
|
+
* @param signer
|
|
5380
5380
|
* @param contractAddress
|
|
5381
5381
|
* @param address
|
|
5382
5382
|
* @param amount
|
|
5383
5383
|
* @returns
|
|
5384
5384
|
*/
|
|
5385
|
-
async batchGrantWithBond(
|
|
5385
|
+
async batchGrantWithBond({
|
|
5386
|
+
signer,
|
|
5387
|
+
contractAddress,
|
|
5388
|
+
address,
|
|
5389
|
+
amount
|
|
5390
|
+
}) {
|
|
5391
|
+
const client = await this.contract.contractClient({
|
|
5392
|
+
signer
|
|
5393
|
+
});
|
|
5386
5394
|
const msgs = [
|
|
5387
5395
|
{
|
|
5388
5396
|
typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract",
|
|
@@ -5435,7 +5443,14 @@ var MACI = class {
|
|
|
5435
5443
|
* @param address
|
|
5436
5444
|
* @returns
|
|
5437
5445
|
*/
|
|
5438
|
-
async batchRevokeWithdraw(
|
|
5446
|
+
async batchRevokeWithdraw({
|
|
5447
|
+
signer,
|
|
5448
|
+
contractAddress,
|
|
5449
|
+
address
|
|
5450
|
+
}) {
|
|
5451
|
+
const client = await this.contract.contractClient({
|
|
5452
|
+
signer
|
|
5453
|
+
});
|
|
5439
5454
|
const msgs = [
|
|
5440
5455
|
{
|
|
5441
5456
|
typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract",
|
|
@@ -5573,155 +5588,228 @@ var MaciClient2 = class {
|
|
|
5573
5588
|
async createOracleMaciRound(params) {
|
|
5574
5589
|
return await this.contract.createOracleMaciRound(params);
|
|
5575
5590
|
}
|
|
5576
|
-
|
|
5577
|
-
|
|
5578
|
-
|
|
5579
|
-
|
|
5580
|
-
|
|
5581
|
-
|
|
5582
|
-
|
|
5583
|
-
|
|
5591
|
+
async getStateIdxInc({
|
|
5592
|
+
signer,
|
|
5593
|
+
address,
|
|
5594
|
+
contractAddress
|
|
5595
|
+
}) {
|
|
5596
|
+
return await this.maci.getStateIdxInc({
|
|
5597
|
+
signer,
|
|
5598
|
+
address,
|
|
5599
|
+
contractAddress
|
|
5600
|
+
});
|
|
5584
5601
|
}
|
|
5585
|
-
|
|
5586
|
-
|
|
5587
|
-
|
|
5588
|
-
|
|
5589
|
-
|
|
5590
|
-
|
|
5591
|
-
|
|
5592
|
-
|
|
5602
|
+
async getVoiceCreditBalance({
|
|
5603
|
+
signer,
|
|
5604
|
+
stateIdx,
|
|
5605
|
+
contractAddress
|
|
5606
|
+
}) {
|
|
5607
|
+
return await this.maci.getVoiceCreditBalance({
|
|
5608
|
+
signer,
|
|
5609
|
+
stateIdx,
|
|
5610
|
+
contractAddress
|
|
5611
|
+
});
|
|
5593
5612
|
}
|
|
5594
|
-
|
|
5595
|
-
|
|
5596
|
-
|
|
5597
|
-
|
|
5598
|
-
|
|
5599
|
-
|
|
5600
|
-
|
|
5601
|
-
|
|
5602
|
-
return await this.indexer.round.getRoundWithFields(address, fields);
|
|
5613
|
+
async getStateIdxByPubKey({
|
|
5614
|
+
contractAddress,
|
|
5615
|
+
pubKey
|
|
5616
|
+
}) {
|
|
5617
|
+
return await this.maci.getStateIdxByPubKey({
|
|
5618
|
+
contractAddress,
|
|
5619
|
+
pubKey
|
|
5620
|
+
});
|
|
5603
5621
|
}
|
|
5604
|
-
|
|
5605
|
-
|
|
5606
|
-
|
|
5607
|
-
|
|
5608
|
-
|
|
5609
|
-
|
|
5610
|
-
|
|
5611
|
-
|
|
5612
|
-
return await this.indexer.round.getRounds(after, limit);
|
|
5622
|
+
async feegrantAllowance({
|
|
5623
|
+
address,
|
|
5624
|
+
contractAddress
|
|
5625
|
+
}) {
|
|
5626
|
+
return await this.maci.feegrantAllowance({
|
|
5627
|
+
address,
|
|
5628
|
+
contractAddress
|
|
5629
|
+
});
|
|
5613
5630
|
}
|
|
5614
|
-
|
|
5615
|
-
|
|
5616
|
-
|
|
5617
|
-
|
|
5618
|
-
|
|
5619
|
-
|
|
5620
|
-
|
|
5621
|
-
|
|
5622
|
-
async getRoundsByStatus(status, after, limit) {
|
|
5623
|
-
return await this.indexer.round.getRoundsByStatus(status, after, limit);
|
|
5631
|
+
async hasFeegrant({
|
|
5632
|
+
address,
|
|
5633
|
+
contractAddress
|
|
5634
|
+
}) {
|
|
5635
|
+
return await this.maci.hasFeegrant({
|
|
5636
|
+
address,
|
|
5637
|
+
contractAddress
|
|
5638
|
+
});
|
|
5624
5639
|
}
|
|
5625
|
-
|
|
5626
|
-
|
|
5627
|
-
|
|
5628
|
-
|
|
5629
|
-
|
|
5630
|
-
|
|
5631
|
-
|
|
5632
|
-
|
|
5633
|
-
|
|
5634
|
-
|
|
5640
|
+
async queryWhitelistBalanceOf({
|
|
5641
|
+
signer,
|
|
5642
|
+
address,
|
|
5643
|
+
contractAddress,
|
|
5644
|
+
certificate,
|
|
5645
|
+
mode = "maci"
|
|
5646
|
+
}) {
|
|
5647
|
+
return await this.maci.queryWhitelistBalanceOf({
|
|
5648
|
+
signer,
|
|
5649
|
+
address,
|
|
5650
|
+
contractAddress,
|
|
5651
|
+
certificate,
|
|
5652
|
+
mode
|
|
5653
|
+
});
|
|
5635
5654
|
}
|
|
5636
|
-
|
|
5637
|
-
|
|
5638
|
-
|
|
5639
|
-
|
|
5640
|
-
|
|
5641
|
-
|
|
5642
|
-
|
|
5643
|
-
|
|
5644
|
-
|
|
5645
|
-
|
|
5655
|
+
async isWhitelisted({
|
|
5656
|
+
signer,
|
|
5657
|
+
address,
|
|
5658
|
+
contractAddress
|
|
5659
|
+
}) {
|
|
5660
|
+
return await this.maci.isWhitelisted({
|
|
5661
|
+
signer,
|
|
5662
|
+
address,
|
|
5663
|
+
contractAddress
|
|
5664
|
+
});
|
|
5646
5665
|
}
|
|
5647
|
-
|
|
5648
|
-
|
|
5649
|
-
|
|
5650
|
-
|
|
5651
|
-
|
|
5652
|
-
|
|
5653
|
-
|
|
5654
|
-
|
|
5666
|
+
async getOracleWhitelistConfig({
|
|
5667
|
+
signer,
|
|
5668
|
+
contractAddress
|
|
5669
|
+
}) {
|
|
5670
|
+
return await this.maci.getOracleWhitelistConfig({
|
|
5671
|
+
signer,
|
|
5672
|
+
contractAddress
|
|
5673
|
+
});
|
|
5655
5674
|
}
|
|
5656
|
-
|
|
5657
|
-
|
|
5658
|
-
* @description Get multiple operators.
|
|
5659
|
-
* @param {string} after - The cursor to start after.
|
|
5660
|
-
* @param {number} [limit] - The number of operators to retrieve.
|
|
5661
|
-
* @returns {Promise<OperatorsResponse>} The operators response.
|
|
5662
|
-
*/
|
|
5663
|
-
async getOperators(after, limit) {
|
|
5664
|
-
return await this.indexer.operator.getOperators(after, limit);
|
|
5675
|
+
async getRoundInfo({ contractAddress }) {
|
|
5676
|
+
return await this.maci.getRoundInfo({ contractAddress });
|
|
5665
5677
|
}
|
|
5666
|
-
|
|
5667
|
-
|
|
5668
|
-
* @description Get a circuit by its name.
|
|
5669
|
-
* @param {string} name - The name of the circuit.
|
|
5670
|
-
* @returns {Promise<CircuitResponse>} The circuit response.
|
|
5671
|
-
*/
|
|
5672
|
-
async getCircuitByName(name) {
|
|
5673
|
-
return await this.indexer.circuit.getCircuitByName(name);
|
|
5678
|
+
async getRoundCircuitType({ contractAddress }) {
|
|
5679
|
+
return await this.maci.getRoundCircuitType({ contractAddress });
|
|
5674
5680
|
}
|
|
5675
|
-
|
|
5676
|
-
|
|
5677
|
-
* @description Get all available circuits.
|
|
5678
|
-
* @returns {Promise<CircuitsResponse>} The circuits response.
|
|
5679
|
-
*/
|
|
5680
|
-
async getCircuits() {
|
|
5681
|
-
return await this.indexer.circuit.getCircuits();
|
|
5681
|
+
async queryRoundIsQv({ contractAddress }) {
|
|
5682
|
+
return await this.maci.queryRoundIsQv({ contractAddress });
|
|
5682
5683
|
}
|
|
5683
|
-
|
|
5684
|
-
|
|
5685
|
-
|
|
5686
|
-
|
|
5687
|
-
* @returns {Promise<TransactionResponse>} The transaction response.
|
|
5688
|
-
*/
|
|
5689
|
-
async getTransactionByHash(hash) {
|
|
5690
|
-
return await this.indexer.transaction.getTransactionByHash(hash);
|
|
5684
|
+
async queryRoundClaimable({
|
|
5685
|
+
contractAddress
|
|
5686
|
+
}) {
|
|
5687
|
+
return await this.maci.queryRoundClaimable({ contractAddress });
|
|
5691
5688
|
}
|
|
5692
|
-
|
|
5693
|
-
|
|
5694
|
-
|
|
5695
|
-
|
|
5696
|
-
|
|
5697
|
-
|
|
5698
|
-
|
|
5699
|
-
|
|
5700
|
-
return await this.indexer.transaction.getTransactions(after, limit);
|
|
5689
|
+
async queryAMaciChargeFee({
|
|
5690
|
+
maxVoter,
|
|
5691
|
+
maxOption
|
|
5692
|
+
}) {
|
|
5693
|
+
return await this.maci.queryAMaciChargeFee({
|
|
5694
|
+
maxVoter,
|
|
5695
|
+
maxOption
|
|
5696
|
+
});
|
|
5701
5697
|
}
|
|
5702
|
-
|
|
5703
|
-
|
|
5704
|
-
|
|
5705
|
-
|
|
5706
|
-
|
|
5707
|
-
|
|
5708
|
-
|
|
5709
|
-
|
|
5710
|
-
|
|
5711
|
-
return await this.indexer.transaction.getTransactionsByContractAddress(
|
|
5712
|
-
address,
|
|
5713
|
-
after,
|
|
5714
|
-
limit
|
|
5698
|
+
async queryRoundGasStation({ contractAddress }) {
|
|
5699
|
+
return await this.maci.queryRoundGasStation({ contractAddress });
|
|
5700
|
+
}
|
|
5701
|
+
parseRoundStatus(votingStart, votingEnd, status, currentTime) {
|
|
5702
|
+
return this.maci.parseRoundStatus(
|
|
5703
|
+
votingStart,
|
|
5704
|
+
votingEnd,
|
|
5705
|
+
status,
|
|
5706
|
+
currentTime
|
|
5715
5707
|
);
|
|
5716
5708
|
}
|
|
5717
|
-
|
|
5718
|
-
|
|
5719
|
-
|
|
5720
|
-
|
|
5721
|
-
|
|
5722
|
-
|
|
5723
|
-
|
|
5724
|
-
|
|
5709
|
+
async queryRoundBalance({ contractAddress }) {
|
|
5710
|
+
return await this.maci.queryRoundBalance({ contractAddress });
|
|
5711
|
+
}
|
|
5712
|
+
async requestOracleCertificate({
|
|
5713
|
+
signer,
|
|
5714
|
+
ecosystem,
|
|
5715
|
+
address,
|
|
5716
|
+
contractAddress
|
|
5717
|
+
}) {
|
|
5718
|
+
return await this.maci.requestOracleCertificate({
|
|
5719
|
+
signer,
|
|
5720
|
+
ecosystem,
|
|
5721
|
+
address,
|
|
5722
|
+
contractAddress
|
|
5723
|
+
});
|
|
5724
|
+
}
|
|
5725
|
+
async signup({
|
|
5726
|
+
signer,
|
|
5727
|
+
address,
|
|
5728
|
+
contractAddress,
|
|
5729
|
+
maciAccount,
|
|
5730
|
+
oracleCertificate,
|
|
5731
|
+
gasStation = false
|
|
5732
|
+
}) {
|
|
5733
|
+
return await this.maci.signup({
|
|
5734
|
+
signer,
|
|
5735
|
+
address,
|
|
5736
|
+
contractAddress,
|
|
5737
|
+
maciAccount,
|
|
5738
|
+
oracleCertificate,
|
|
5739
|
+
gasStation
|
|
5740
|
+
});
|
|
5741
|
+
}
|
|
5742
|
+
async vote({
|
|
5743
|
+
signer,
|
|
5744
|
+
address,
|
|
5745
|
+
stateIdx,
|
|
5746
|
+
contractAddress,
|
|
5747
|
+
selectedOptions,
|
|
5748
|
+
operatorCoordPubKey,
|
|
5749
|
+
maciAccount,
|
|
5750
|
+
gasStation = false
|
|
5751
|
+
}) {
|
|
5752
|
+
return await this.maci.vote({
|
|
5753
|
+
signer,
|
|
5754
|
+
address,
|
|
5755
|
+
stateIdx,
|
|
5756
|
+
contractAddress,
|
|
5757
|
+
selectedOptions,
|
|
5758
|
+
operatorCoordPubKey,
|
|
5759
|
+
maciAccount,
|
|
5760
|
+
gasStation
|
|
5761
|
+
});
|
|
5762
|
+
}
|
|
5763
|
+
async publishMessage({
|
|
5764
|
+
client,
|
|
5765
|
+
address,
|
|
5766
|
+
payload,
|
|
5767
|
+
contractAddress,
|
|
5768
|
+
gasStation
|
|
5769
|
+
}) {
|
|
5770
|
+
return await this.maci.publishMessage({
|
|
5771
|
+
client,
|
|
5772
|
+
address,
|
|
5773
|
+
payload,
|
|
5774
|
+
contractAddress,
|
|
5775
|
+
gasStation
|
|
5776
|
+
});
|
|
5777
|
+
}
|
|
5778
|
+
async claimAMaciRound({
|
|
5779
|
+
signer,
|
|
5780
|
+
contractAddress
|
|
5781
|
+
}) {
|
|
5782
|
+
return await this.maci.claimAMaciRound({
|
|
5783
|
+
signer,
|
|
5784
|
+
contractAddress
|
|
5785
|
+
});
|
|
5786
|
+
}
|
|
5787
|
+
async getOracleCertificateConfig() {
|
|
5788
|
+
return await this.maci.getOracleCertificateConfig();
|
|
5789
|
+
}
|
|
5790
|
+
async batchGrantWithBond({
|
|
5791
|
+
signer,
|
|
5792
|
+
contractAddress,
|
|
5793
|
+
address,
|
|
5794
|
+
amount
|
|
5795
|
+
}) {
|
|
5796
|
+
return await this.maci.batchGrantWithBond({
|
|
5797
|
+
signer,
|
|
5798
|
+
contractAddress,
|
|
5799
|
+
address,
|
|
5800
|
+
amount
|
|
5801
|
+
});
|
|
5802
|
+
}
|
|
5803
|
+
async batchRevokeWithdraw({
|
|
5804
|
+
signer,
|
|
5805
|
+
contractAddress,
|
|
5806
|
+
address
|
|
5807
|
+
}) {
|
|
5808
|
+
return await this.maci.batchRevokeWithdraw({
|
|
5809
|
+
signer,
|
|
5810
|
+
contractAddress,
|
|
5811
|
+
address
|
|
5812
|
+
});
|
|
5725
5813
|
}
|
|
5726
5814
|
};
|
|
5727
5815
|
|