@maci-protocol/sdk 0.0.0-ci.00107eb
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/CHANGELOG.md +80 -0
- package/LICENSE +21 -0
- package/README.md +12 -0
- package/build/package.json +65 -0
- package/build/ts/browser/index.d.ts +15 -0
- package/build/ts/browser/index.d.ts.map +1 -0
- package/build/ts/browser/index.js +40 -0
- package/build/ts/browser/index.js.map +1 -0
- package/build/ts/browser/joinPoll.d.ts +10 -0
- package/build/ts/browser/joinPoll.d.ts.map +1 -0
- package/build/ts/browser/joinPoll.js +88 -0
- package/build/ts/browser/joinPoll.js.map +1 -0
- package/build/ts/browser/utils.d.ts +18 -0
- package/build/ts/browser/utils.d.ts.map +1 -0
- package/build/ts/browser/utils.js +37 -0
- package/build/ts/browser/utils.js.map +1 -0
- package/build/ts/deploy/index.d.ts +6 -0
- package/build/ts/deploy/index.d.ts.map +1 -0
- package/build/ts/deploy/index.js +12 -0
- package/build/ts/deploy/index.js.map +1 -0
- package/build/ts/deploy/maci.d.ts +8 -0
- package/build/ts/deploy/maci.d.ts.map +1 -0
- package/build/ts/deploy/maci.js +97 -0
- package/build/ts/deploy/maci.js.map +1 -0
- package/build/ts/deploy/poll.d.ts +8 -0
- package/build/ts/deploy/poll.d.ts.map +1 -0
- package/build/ts/deploy/poll.js +112 -0
- package/build/ts/deploy/poll.js.map +1 -0
- package/build/ts/deploy/types.d.ts +225 -0
- package/build/ts/deploy/types.d.ts.map +1 -0
- package/build/ts/deploy/types.js +3 -0
- package/build/ts/deploy/types.js.map +1 -0
- package/build/ts/deploy/utils.d.ts +11 -0
- package/build/ts/deploy/utils.d.ts.map +1 -0
- package/build/ts/deploy/utils.js +22 -0
- package/build/ts/deploy/utils.js.map +1 -0
- package/build/ts/deploy/verifyingKeysRegistry.d.ts +7 -0
- package/build/ts/deploy/verifyingKeysRegistry.d.ts.map +1 -0
- package/build/ts/deploy/verifyingKeysRegistry.js +14 -0
- package/build/ts/deploy/verifyingKeysRegistry.js.map +1 -0
- package/build/ts/index.d.ts +17 -0
- package/build/ts/index.d.ts.map +1 -0
- package/build/ts/index.js +89 -0
- package/build/ts/index.js.map +1 -0
- package/build/ts/maci/index.d.ts +6 -0
- package/build/ts/maci/index.d.ts.map +1 -0
- package/build/ts/maci/index.js +17 -0
- package/build/ts/maci/index.js.map +1 -0
- package/build/ts/maci/merge.d.ts +9 -0
- package/build/ts/maci/merge.d.ts.map +1 -0
- package/build/ts/maci/merge.js +29 -0
- package/build/ts/maci/merge.js.map +1 -0
- package/build/ts/maci/policy.d.ts +53 -0
- package/build/ts/maci/policy.d.ts.map +1 -0
- package/build/ts/maci/policy.js +166 -0
- package/build/ts/maci/policy.js.map +1 -0
- package/build/ts/maci/state.d.ts +8 -0
- package/build/ts/maci/state.d.ts.map +1 -0
- package/build/ts/maci/state.js +82 -0
- package/build/ts/maci/state.js.map +1 -0
- package/build/ts/maci/types.d.ts +208 -0
- package/build/ts/maci/types.d.ts.map +1 -0
- package/build/ts/maci/types.js +20 -0
- package/build/ts/maci/types.js.map +1 -0
- package/build/ts/maciKeys/__tests__/keypair.test.d.ts +2 -0
- package/build/ts/maciKeys/__tests__/keypair.test.d.ts.map +1 -0
- package/build/ts/maciKeys/__tests__/keypair.test.js +24 -0
- package/build/ts/maciKeys/__tests__/keypair.test.js.map +1 -0
- package/build/ts/maciKeys/__tests__/publicKeys.test.d.ts +2 -0
- package/build/ts/maciKeys/__tests__/publicKeys.test.d.ts.map +1 -0
- package/build/ts/maciKeys/__tests__/publicKeys.test.js +22 -0
- package/build/ts/maciKeys/__tests__/publicKeys.test.js.map +1 -0
- package/build/ts/maciKeys/index.d.ts +4 -0
- package/build/ts/maciKeys/index.d.ts.map +1 -0
- package/build/ts/maciKeys/index.js +8 -0
- package/build/ts/maciKeys/index.js.map +1 -0
- package/build/ts/maciKeys/keypair.d.ts +9 -0
- package/build/ts/maciKeys/keypair.d.ts.map +1 -0
- package/build/ts/maciKeys/keypair.js +21 -0
- package/build/ts/maciKeys/keypair.js.map +1 -0
- package/build/ts/maciKeys/publicKeys.d.ts +8 -0
- package/build/ts/maciKeys/publicKeys.d.ts.map +1 -0
- package/build/ts/maciKeys/publicKeys.js +23 -0
- package/build/ts/maciKeys/publicKeys.js.map +1 -0
- package/build/ts/maciKeys/types.d.ts +28 -0
- package/build/ts/maciKeys/types.d.ts.map +1 -0
- package/build/ts/maciKeys/types.js +3 -0
- package/build/ts/maciKeys/types.js.map +1 -0
- package/build/ts/poll/index.d.ts +4 -0
- package/build/ts/poll/index.d.ts.map +1 -0
- package/build/ts/poll/index.js +9 -0
- package/build/ts/poll/index.js.map +1 -0
- package/build/ts/poll/poll.d.ts +14 -0
- package/build/ts/poll/poll.d.ts.map +1 -0
- package/build/ts/poll/poll.js +62 -0
- package/build/ts/poll/poll.js.map +1 -0
- package/build/ts/poll/types.d.ts +151 -0
- package/build/ts/poll/types.d.ts.map +1 -0
- package/build/ts/poll/types.js +3 -0
- package/build/ts/poll/types.js.map +1 -0
- package/build/ts/poll/utils.d.ts +9 -0
- package/build/ts/poll/utils.d.ts.map +1 -0
- package/build/ts/poll/utils.js +43 -0
- package/build/ts/poll/utils.js.map +1 -0
- package/build/ts/proof/__tests__/download.test.d.ts +2 -0
- package/build/ts/proof/__tests__/download.test.d.ts.map +1 -0
- package/build/ts/proof/__tests__/download.test.js +53 -0
- package/build/ts/proof/__tests__/download.test.js.map +1 -0
- package/build/ts/proof/download.d.ts +9 -0
- package/build/ts/proof/download.d.ts.map +1 -0
- package/build/ts/proof/download.js +47 -0
- package/build/ts/proof/download.js.map +1 -0
- package/build/ts/proof/generate.d.ts +8 -0
- package/build/ts/proof/generate.d.ts.map +1 -0
- package/build/ts/proof/generate.js +133 -0
- package/build/ts/proof/generate.js.map +1 -0
- package/build/ts/proof/index.d.ts +4 -0
- package/build/ts/proof/index.d.ts.map +1 -0
- package/build/ts/proof/index.js +8 -0
- package/build/ts/proof/index.js.map +1 -0
- package/build/ts/proof/prove.d.ts +8 -0
- package/build/ts/proof/prove.d.ts.map +1 -0
- package/build/ts/proof/prove.js +91 -0
- package/build/ts/proof/prove.js.map +1 -0
- package/build/ts/proof/types.d.ts +205 -0
- package/build/ts/proof/types.d.ts.map +1 -0
- package/build/ts/proof/types.js +3 -0
- package/build/ts/proof/types.js.map +1 -0
- package/build/ts/proof/utils.d.ts +10 -0
- package/build/ts/proof/utils.d.ts.map +1 -0
- package/build/ts/proof/utils.js +24 -0
- package/build/ts/proof/utils.js.map +1 -0
- package/build/ts/relayer/__tests__/messages.test.d.ts +2 -0
- package/build/ts/relayer/__tests__/messages.test.d.ts.map +1 -0
- package/build/ts/relayer/__tests__/messages.test.js +76 -0
- package/build/ts/relayer/__tests__/messages.test.js.map +1 -0
- package/build/ts/relayer/__tests__/utils.test.d.ts +2 -0
- package/build/ts/relayer/__tests__/utils.test.d.ts.map +1 -0
- package/build/ts/relayer/__tests__/utils.test.js +73 -0
- package/build/ts/relayer/__tests__/utils.test.js.map +1 -0
- package/build/ts/relayer/index.d.ts +3 -0
- package/build/ts/relayer/index.d.ts.map +1 -0
- package/build/ts/relayer/index.js +8 -0
- package/build/ts/relayer/index.js.map +1 -0
- package/build/ts/relayer/messages.d.ts +23 -0
- package/build/ts/relayer/messages.d.ts.map +1 -0
- package/build/ts/relayer/messages.js +66 -0
- package/build/ts/relayer/messages.js.map +1 -0
- package/build/ts/relayer/types.d.ts +168 -0
- package/build/ts/relayer/types.d.ts.map +1 -0
- package/build/ts/relayer/types.js +3 -0
- package/build/ts/relayer/types.js.map +1 -0
- package/build/ts/relayer/utils.d.ts +12 -0
- package/build/ts/relayer/utils.d.ts.map +1 -0
- package/build/ts/relayer/utils.js +37 -0
- package/build/ts/relayer/utils.js.map +1 -0
- package/build/ts/subgraph/index.d.ts +3 -0
- package/build/ts/subgraph/index.d.ts.map +1 -0
- package/build/ts/subgraph/index.js +18 -0
- package/build/ts/subgraph/index.js.map +1 -0
- package/build/ts/subgraph/maciSubgraph.d.ts +28 -0
- package/build/ts/subgraph/maciSubgraph.d.ts.map +1 -0
- package/build/ts/subgraph/maciSubgraph.js +64 -0
- package/build/ts/subgraph/maciSubgraph.js.map +1 -0
- package/build/ts/subgraph/types.d.ts +20 -0
- package/build/ts/subgraph/types.d.ts.map +1 -0
- package/build/ts/subgraph/types.js +3 -0
- package/build/ts/subgraph/types.js.map +1 -0
- package/build/ts/tally/commitments.d.ts +9 -0
- package/build/ts/tally/commitments.d.ts.map +1 -0
- package/build/ts/tally/commitments.js +43 -0
- package/build/ts/tally/commitments.js.map +1 -0
- package/build/ts/tally/index.d.ts +5 -0
- package/build/ts/tally/index.d.ts.map +1 -0
- package/build/ts/tally/index.js +12 -0
- package/build/ts/tally/index.js.map +1 -0
- package/build/ts/tally/results.d.ts +20 -0
- package/build/ts/tally/results.d.ts.map +1 -0
- package/build/ts/tally/results.js +49 -0
- package/build/ts/tally/results.js.map +1 -0
- package/build/ts/tally/types.d.ts +219 -0
- package/build/ts/tally/types.d.ts.map +1 -0
- package/build/ts/tally/types.js +3 -0
- package/build/ts/tally/types.js.map +1 -0
- package/build/ts/tally/utils.d.ts +24 -0
- package/build/ts/tally/utils.d.ts.map +1 -0
- package/build/ts/tally/utils.js +50 -0
- package/build/ts/tally/utils.js.map +1 -0
- package/build/ts/tally/verification.d.ts +7 -0
- package/build/ts/tally/verification.d.ts.map +1 -0
- package/build/ts/tally/verification.js +62 -0
- package/build/ts/tally/verification.js.map +1 -0
- package/build/ts/trees/index.d.ts +3 -0
- package/build/ts/trees/index.d.ts.map +1 -0
- package/build/ts/trees/index.js +8 -0
- package/build/ts/trees/index.js.map +1 -0
- package/build/ts/trees/stateTree.d.ts +35 -0
- package/build/ts/trees/stateTree.d.ts.map +1 -0
- package/build/ts/trees/stateTree.js +117 -0
- package/build/ts/trees/stateTree.js.map +1 -0
- package/build/ts/trees/types.d.ts +55 -0
- package/build/ts/trees/types.d.ts.map +1 -0
- package/build/ts/trees/types.js +3 -0
- package/build/ts/trees/types.js.map +1 -0
- package/build/ts/user/index.d.ts +5 -0
- package/build/ts/user/index.d.ts.map +1 -0
- package/build/ts/user/index.js +17 -0
- package/build/ts/user/index.js.map +1 -0
- package/build/ts/user/joinPoll.d.ts +8 -0
- package/build/ts/user/joinPoll.d.ts.map +1 -0
- package/build/ts/user/joinPoll.js +84 -0
- package/build/ts/user/joinPoll.js.map +1 -0
- package/build/ts/user/signup.d.ts +20 -0
- package/build/ts/user/signup.d.ts.map +1 -0
- package/build/ts/user/signup.js +84 -0
- package/build/ts/user/signup.js.map +1 -0
- package/build/ts/user/types.d.ts +460 -0
- package/build/ts/user/types.d.ts.map +1 -0
- package/build/ts/user/types.js +3 -0
- package/build/ts/user/types.js.map +1 -0
- package/build/ts/user/utils.d.ts +88 -0
- package/build/ts/user/utils.d.ts.map +1 -0
- package/build/ts/user/utils.js +258 -0
- package/build/ts/user/utils.js.map +1 -0
- package/build/ts/utils/cid.d.ts +23 -0
- package/build/ts/utils/cid.d.ts.map +1 -0
- package/build/ts/utils/cid.js +72 -0
- package/build/ts/utils/cid.js.map +1 -0
- package/build/ts/utils/constants.d.ts +2 -0
- package/build/ts/utils/constants.d.ts.map +1 -0
- package/build/ts/utils/constants.js +5 -0
- package/build/ts/utils/constants.js.map +1 -0
- package/build/ts/utils/contracts.d.ts +15 -0
- package/build/ts/utils/contracts.d.ts.map +1 -0
- package/build/ts/utils/contracts.js +26 -0
- package/build/ts/utils/contracts.js.map +1 -0
- package/build/ts/utils/files.d.ts +9 -0
- package/build/ts/utils/files.d.ts.map +1 -0
- package/build/ts/utils/files.js +20 -0
- package/build/ts/utils/files.js.map +1 -0
- package/build/ts/utils/formatting.d.ts +8 -0
- package/build/ts/utils/formatting.d.ts.map +1 -0
- package/build/ts/utils/formatting.js +11 -0
- package/build/ts/utils/formatting.js.map +1 -0
- package/build/ts/utils/fundWallet.d.ts +7 -0
- package/build/ts/utils/fundWallet.d.ts.map +1 -0
- package/build/ts/utils/fundWallet.js +20 -0
- package/build/ts/utils/fundWallet.js.map +1 -0
- package/build/ts/utils/index.d.ts +12 -0
- package/build/ts/utils/index.d.ts.map +1 -0
- package/build/ts/utils/index.js +29 -0
- package/build/ts/utils/index.js.map +1 -0
- package/build/ts/utils/params.d.ts +7 -0
- package/build/ts/utils/params.d.ts.map +1 -0
- package/build/ts/utils/params.js +19 -0
- package/build/ts/utils/params.js.map +1 -0
- package/build/ts/utils/proofs.d.ts +13 -0
- package/build/ts/utils/proofs.d.ts.map +1 -0
- package/build/ts/utils/proofs.js +41 -0
- package/build/ts/utils/proofs.js.map +1 -0
- package/build/ts/utils/timeTravel.d.ts +7 -0
- package/build/ts/utils/timeTravel.d.ts.map +1 -0
- package/build/ts/utils/timeTravel.js +14 -0
- package/build/ts/utils/timeTravel.js.map +1 -0
- package/build/ts/utils/trees.d.ts +13 -0
- package/build/ts/utils/trees.d.ts.map +1 -0
- package/build/ts/utils/trees.js +30 -0
- package/build/ts/utils/trees.js.map +1 -0
- package/build/ts/utils/types.d.ts +71 -0
- package/build/ts/utils/types.d.ts.map +1 -0
- package/build/ts/utils/types.js +3 -0
- package/build/ts/utils/types.js.map +1 -0
- package/build/ts/utils/utils.d.ts +29 -0
- package/build/ts/utils/utils.d.ts.map +1 -0
- package/build/ts/utils/utils.js +61 -0
- package/build/ts/utils/utils.js.map +1 -0
- package/build/ts/verifyingKeys/checkVerifyingKeys.d.ts +10 -0
- package/build/ts/verifyingKeys/checkVerifyingKeys.d.ts.map +1 -0
- package/build/ts/verifyingKeys/checkVerifyingKeys.js +66 -0
- package/build/ts/verifyingKeys/checkVerifyingKeys.js.map +1 -0
- package/build/ts/verifyingKeys/index.d.ts +5 -0
- package/build/ts/verifyingKeys/index.d.ts.map +1 -0
- package/build/ts/verifyingKeys/index.js +13 -0
- package/build/ts/verifyingKeys/index.js.map +1 -0
- package/build/ts/verifyingKeys/setVerifyingKeys.d.ts +7 -0
- package/build/ts/verifyingKeys/setVerifyingKeys.d.ts.map +1 -0
- package/build/ts/verifyingKeys/setVerifyingKeys.js +108 -0
- package/build/ts/verifyingKeys/setVerifyingKeys.js.map +1 -0
- package/build/ts/verifyingKeys/types.d.ts +239 -0
- package/build/ts/verifyingKeys/types.d.ts.map +1 -0
- package/build/ts/verifyingKeys/types.js +3 -0
- package/build/ts/verifyingKeys/types.js.map +1 -0
- package/build/ts/verifyingKeys/utils.d.ts +29 -0
- package/build/ts/verifyingKeys/utils.d.ts.map +1 -0
- package/build/ts/verifyingKeys/utils.js +118 -0
- package/build/ts/verifyingKeys/utils.js.map +1 -0
- package/build/ts/vote/generate.d.ts +8 -0
- package/build/ts/vote/generate.d.ts.map +1 -0
- package/build/ts/vote/generate.js +46 -0
- package/build/ts/vote/generate.js.map +1 -0
- package/build/ts/vote/index.d.ts +7 -0
- package/build/ts/vote/index.d.ts.map +1 -0
- package/build/ts/vote/index.js +17 -0
- package/build/ts/vote/index.js.map +1 -0
- package/build/ts/vote/invalidate.d.ts +13 -0
- package/build/ts/vote/invalidate.d.ts.map +1 -0
- package/build/ts/vote/invalidate.js +44 -0
- package/build/ts/vote/invalidate.js.map +1 -0
- package/build/ts/vote/publish.d.ts +14 -0
- package/build/ts/vote/publish.d.ts.map +1 -0
- package/build/ts/vote/publish.js +88 -0
- package/build/ts/vote/publish.js.map +1 -0
- package/build/ts/vote/submit.d.ts +13 -0
- package/build/ts/vote/submit.d.ts.map +1 -0
- package/build/ts/vote/submit.js +36 -0
- package/build/ts/vote/submit.js.map +1 -0
- package/build/ts/vote/types.d.ts +238 -0
- package/build/ts/vote/types.d.ts.map +1 -0
- package/build/ts/vote/types.js +3 -0
- package/build/ts/vote/types.js.map +1 -0
- package/build/ts/vote/utils.d.ts +16 -0
- package/build/ts/vote/utils.d.ts.map +1 -0
- package/build/ts/vote/utils.js +26 -0
- package/build/ts/vote/utils.js.map +1 -0
- package/build/tsconfig.build.tsbuildinfo +1 -0
- package/package.json +66 -0
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const contracts_1 = require("@maci-protocol/contracts");
|
|
4
|
+
const domainobjs_1 = require("@maci-protocol/domainobjs");
|
|
5
|
+
const ethers_1 = require("ethers");
|
|
6
|
+
const utils_1 = require("../utils");
|
|
7
|
+
describe("utils", () => {
|
|
8
|
+
let mockPollContract;
|
|
9
|
+
let mockIpfsService;
|
|
10
|
+
const mockProvider = {
|
|
11
|
+
getBlockNumber: () => Promise.resolve(0),
|
|
12
|
+
};
|
|
13
|
+
const keypair = new domainobjs_1.Keypair();
|
|
14
|
+
const defaultMessages = [
|
|
15
|
+
{
|
|
16
|
+
publicKey: keypair.publicKey.asArray().map(String),
|
|
17
|
+
data: new Array(10).fill("0"),
|
|
18
|
+
hash: "hash1",
|
|
19
|
+
maciAddress: ethers_1.ZeroAddress,
|
|
20
|
+
poll: 0,
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
publicKey: new domainobjs_1.Keypair().publicKey.asArray().map(String),
|
|
24
|
+
data: new Array(10).fill("0"),
|
|
25
|
+
hash: "hash2",
|
|
26
|
+
maciAddress: ethers_1.ZeroAddress,
|
|
27
|
+
poll: 0,
|
|
28
|
+
},
|
|
29
|
+
];
|
|
30
|
+
beforeEach(() => {
|
|
31
|
+
mockIpfsService = {
|
|
32
|
+
read: jest.fn().mockResolvedValue(defaultMessages),
|
|
33
|
+
};
|
|
34
|
+
jest.spyOn(contracts_1.IpfsService, "getInstance").mockReturnValue(mockIpfsService);
|
|
35
|
+
mockPollContract = {
|
|
36
|
+
queryFilter: jest.fn().mockResolvedValue([{ args: { _ipfsHash: "hash" } }]),
|
|
37
|
+
filters: {
|
|
38
|
+
IpfsHashAdded: jest.fn(),
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
});
|
|
42
|
+
afterEach(() => {
|
|
43
|
+
jest.clearAllMocks();
|
|
44
|
+
});
|
|
45
|
+
test("should parse IpfsHashAdded events properly", async () => {
|
|
46
|
+
const { messages } = await (0, utils_1.parseIpfsHashAddedEvents)({
|
|
47
|
+
startBlock: 0,
|
|
48
|
+
provider: mockProvider,
|
|
49
|
+
pollContract: mockPollContract,
|
|
50
|
+
publicKeys: [keypair.publicKey.serialize()],
|
|
51
|
+
messageHashes: ["hash1"],
|
|
52
|
+
});
|
|
53
|
+
expect(messages).toStrictEqual([defaultMessages[0]]);
|
|
54
|
+
});
|
|
55
|
+
it("should parse IpfsHashAdded events properly without public keys and message hashes", async () => {
|
|
56
|
+
const { messages } = await (0, utils_1.parseIpfsHashAddedEvents)({
|
|
57
|
+
startBlock: 0,
|
|
58
|
+
provider: mockProvider,
|
|
59
|
+
pollContract: mockPollContract,
|
|
60
|
+
});
|
|
61
|
+
expect(messages).toStrictEqual(defaultMessages);
|
|
62
|
+
});
|
|
63
|
+
it("should return empty array if can't get messages from ipfs", async () => {
|
|
64
|
+
mockIpfsService.read = jest.fn().mockResolvedValue(null);
|
|
65
|
+
const { messages } = await (0, utils_1.parseIpfsHashAddedEvents)({
|
|
66
|
+
startBlock: 0,
|
|
67
|
+
provider: mockProvider,
|
|
68
|
+
pollContract: mockPollContract,
|
|
69
|
+
});
|
|
70
|
+
expect(messages).toHaveLength(0);
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
//# sourceMappingURL=utils.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.test.js","sourceRoot":"","sources":["../../../../ts/relayer/__tests__/utils.test.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { getRelayedMessages, getMessageBatches, relayMessages } from "./messages";
|
|
2
|
+
export type { IGetRelayedMessagesArgs, IGetRelayedMessagesData, IMessageBatch, IGetMessageBatchesArgs, IGetMessageBatchesData, IRelayMessagesArgs, IRelayMessagesData, } from "./types";
|
|
3
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../ts/relayer/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAClF,YAAY,EACV,uBAAuB,EACvB,uBAAuB,EACvB,aAAa,EACb,sBAAsB,EACtB,sBAAsB,EACtB,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.relayMessages = exports.getMessageBatches = exports.getRelayedMessages = void 0;
|
|
4
|
+
var messages_1 = require("./messages");
|
|
5
|
+
Object.defineProperty(exports, "getRelayedMessages", { enumerable: true, get: function () { return messages_1.getRelayedMessages; } });
|
|
6
|
+
Object.defineProperty(exports, "getMessageBatches", { enumerable: true, get: function () { return messages_1.getMessageBatches; } });
|
|
7
|
+
Object.defineProperty(exports, "relayMessages", { enumerable: true, get: function () { return messages_1.relayMessages; } });
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../ts/relayer/index.ts"],"names":[],"mappings":";;;AAAA,uCAAkF;AAAzE,8GAAA,kBAAkB,OAAA;AAAE,6GAAA,iBAAiB,OAAA;AAAE,yGAAA,aAAa,OAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { IGetMessageBatchesArgs, IGetMessageBatchesData, IGetRelayedMessagesArgs, IGetRelayedMessagesData, IRelayMessagesArgs, IRelayMessagesData } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Get relayed messages from Poll contract.
|
|
4
|
+
*
|
|
5
|
+
* @param args get relayed messages arguments
|
|
6
|
+
* @returns relayed messages
|
|
7
|
+
*/
|
|
8
|
+
export declare const getRelayedMessages: ({ maciAddress, pollId, signer, provider, startBlock, publicKeys, messageHashes, }: IGetRelayedMessagesArgs) => Promise<IGetRelayedMessagesData>;
|
|
9
|
+
/**
|
|
10
|
+
* Get message batches from relayer service.
|
|
11
|
+
*
|
|
12
|
+
* @param args get message batches arguments
|
|
13
|
+
* @returns message batches
|
|
14
|
+
*/
|
|
15
|
+
export declare const getMessageBatches: ({ url, limit, skip, ipfsHashes, maciContractAddress, poll, publicKeys, messageHashes, }: IGetMessageBatchesArgs) => Promise<IGetMessageBatchesData>;
|
|
16
|
+
/**
|
|
17
|
+
* Relay IPFS messages to Poll contract.
|
|
18
|
+
*
|
|
19
|
+
* @param args relay messages arguments
|
|
20
|
+
* @returns transaction hash
|
|
21
|
+
*/
|
|
22
|
+
export declare const relayMessages: ({ maciAddress, pollId, ipfsHash, messages, signer, provider, }: IRelayMessagesArgs) => Promise<IRelayMessagesData>;
|
|
23
|
+
//# sourceMappingURL=messages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../../ts/relayer/messages.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,sBAAsB,EACtB,sBAAsB,EACtB,uBAAuB,EACvB,uBAAuB,EAEvB,kBAAkB,EAClB,kBAAkB,EACnB,MAAM,SAAS,CAAC;AAMjB;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,GAAU,mFAQtC,uBAAuB,KAAG,OAAO,CAAC,uBAAuB,CAY3D,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,GAAU,yFASrC,sBAAsB,KAAG,OAAO,CAAC,sBAAsB,CAoBzD,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,aAAa,GAAU,gEAOjC,kBAAkB,KAAG,OAAO,CAAC,kBAAkB,CAcjD,CAAC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.relayMessages = exports.getMessageBatches = exports.getRelayedMessages = void 0;
|
|
4
|
+
const utils_1 = require("../poll/utils");
|
|
5
|
+
const utils_2 = require("./utils");
|
|
6
|
+
/**
|
|
7
|
+
* Get relayed messages from Poll contract.
|
|
8
|
+
*
|
|
9
|
+
* @param args get relayed messages arguments
|
|
10
|
+
* @returns relayed messages
|
|
11
|
+
*/
|
|
12
|
+
const getRelayedMessages = async ({ maciAddress, pollId, signer, provider, startBlock = 0, publicKeys, messageHashes, }) => {
|
|
13
|
+
const { poll: pollContract } = await (0, utils_1.getPollContracts)({ maciAddress, pollId, signer, provider });
|
|
14
|
+
const { messages } = await (0, utils_2.parseIpfsHashAddedEvents)({
|
|
15
|
+
pollContract,
|
|
16
|
+
startBlock,
|
|
17
|
+
publicKeys,
|
|
18
|
+
messageHashes,
|
|
19
|
+
provider,
|
|
20
|
+
});
|
|
21
|
+
return { messages };
|
|
22
|
+
};
|
|
23
|
+
exports.getRelayedMessages = getRelayedMessages;
|
|
24
|
+
/**
|
|
25
|
+
* Get message batches from relayer service.
|
|
26
|
+
*
|
|
27
|
+
* @param args get message batches arguments
|
|
28
|
+
* @returns message batches
|
|
29
|
+
*/
|
|
30
|
+
const getMessageBatches = async ({ url, limit, skip, ipfsHashes, maciContractAddress, poll, publicKeys, messageHashes, }) => {
|
|
31
|
+
const messageBatches = await fetch(`${url}/v1/messageBatches/get`, {
|
|
32
|
+
method: "GET",
|
|
33
|
+
headers: {
|
|
34
|
+
"Content-Type": "application/json",
|
|
35
|
+
},
|
|
36
|
+
body: JSON.stringify({
|
|
37
|
+
limit,
|
|
38
|
+
skip,
|
|
39
|
+
ipfsHashes,
|
|
40
|
+
poll,
|
|
41
|
+
maciContractAddress,
|
|
42
|
+
messageHashes,
|
|
43
|
+
publicKeys,
|
|
44
|
+
}),
|
|
45
|
+
})
|
|
46
|
+
.then((res) => res.json())
|
|
47
|
+
.then((res) => res);
|
|
48
|
+
return { messageBatches };
|
|
49
|
+
};
|
|
50
|
+
exports.getMessageBatches = getMessageBatches;
|
|
51
|
+
/**
|
|
52
|
+
* Relay IPFS messages to Poll contract.
|
|
53
|
+
*
|
|
54
|
+
* @param args relay messages arguments
|
|
55
|
+
* @returns transaction hash
|
|
56
|
+
*/
|
|
57
|
+
const relayMessages = async ({ maciAddress, pollId, ipfsHash, messages, signer, provider, }) => {
|
|
58
|
+
const { poll: pollContract } = await (0, utils_1.getPollContracts)({ maciAddress, pollId, signer, provider });
|
|
59
|
+
const messageHashes = await Promise.all(messages.map(({ data, publicKey }) => pollContract.hashMessageAndPublicKey({ data }, { x: publicKey[0], y: publicKey[1] })));
|
|
60
|
+
const receipt = await pollContract.relayMessagesBatch(messageHashes, ipfsHash).then((tx) => tx.wait());
|
|
61
|
+
return {
|
|
62
|
+
hash: receipt?.hash,
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
exports.relayMessages = relayMessages;
|
|
66
|
+
//# sourceMappingURL=messages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.js","sourceRoot":"","sources":["../../../ts/relayer/messages.ts"],"names":[],"mappings":";;;AAUA,yCAAiD;AAEjD,mCAAmD;AAEnD;;;;;GAKG;AACI,MAAM,kBAAkB,GAAG,KAAK,EAAE,EACvC,WAAW,EACX,MAAM,EACN,MAAM,EACN,QAAQ,EACR,UAAU,GAAG,CAAC,EACd,UAAU,EACV,aAAa,GACW,EAAoC,EAAE;IAC9D,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,GAAG,MAAM,IAAA,wBAAgB,EAAC,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC;IAEjG,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,IAAA,gCAAwB,EAAC;QAClD,YAAY;QACZ,UAAU;QACV,UAAU;QACV,aAAa;QACb,QAAQ;KACT,CAAC,CAAC;IAEH,OAAO,EAAE,QAAQ,EAAE,CAAC;AACtB,CAAC,CAAC;AApBW,QAAA,kBAAkB,sBAoB7B;AAEF;;;;;GAKG;AACI,MAAM,iBAAiB,GAAG,KAAK,EAAE,EACtC,GAAG,EACH,KAAK,EACL,IAAI,EACJ,UAAU,EACV,mBAAmB,EACnB,IAAI,EACJ,UAAU,EACV,aAAa,GACU,EAAmC,EAAE;IAC5D,MAAM,cAAc,GAAG,MAAM,KAAK,CAAC,GAAG,GAAG,wBAAwB,EAAE;QACjE,MAAM,EAAE,KAAK;QACb,OAAO,EAAE;YACP,cAAc,EAAE,kBAAkB;SACnC;QACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;YACnB,KAAK;YACL,IAAI;YACJ,UAAU;YACV,IAAI;YACJ,mBAAmB;YACnB,aAAa;YACb,UAAU;SACX,CAAC;KACH,CAAC;SACC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;SACzB,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAsB,CAAC,CAAC;IAEzC,OAAO,EAAE,cAAc,EAAE,CAAC;AAC5B,CAAC,CAAC;AA7BW,QAAA,iBAAiB,qBA6B5B;AAEF;;;;;GAKG;AACI,MAAM,aAAa,GAAG,KAAK,EAAE,EAClC,WAAW,EACX,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,QAAQ,GACW,EAA+B,EAAE;IACpD,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,GAAG,MAAM,IAAA,wBAAgB,EAAC,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC;IAEjG,MAAM,aAAa,GAAG,MAAM,OAAO,CAAC,GAAG,CACrC,QAAQ,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,CACnC,YAAY,CAAC,uBAAuB,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CACrF,CACF,CAAC;IAEF,MAAM,OAAO,GAAG,MAAM,YAAY,CAAC,kBAAkB,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC;IAEvG,OAAO;QACL,IAAI,EAAE,OAAO,EAAE,IAAI;KACpB,CAAC;AACJ,CAAC,CAAC;AArBW,QAAA,aAAa,iBAqBxB"}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import type { IIpfsMessage } from "@maci-protocol/contracts";
|
|
2
|
+
import type { Poll } from "@maci-protocol/contracts/typechain-types";
|
|
3
|
+
import type { Provider, Signer } from "ethers";
|
|
4
|
+
/**
|
|
5
|
+
* Interface that represents get relayed messages arguments
|
|
6
|
+
*/
|
|
7
|
+
export interface IGetRelayedMessagesArgs {
|
|
8
|
+
/**
|
|
9
|
+
* MACI contract address
|
|
10
|
+
*/
|
|
11
|
+
maciAddress: string;
|
|
12
|
+
/**
|
|
13
|
+
* Poll id
|
|
14
|
+
*/
|
|
15
|
+
pollId: number;
|
|
16
|
+
/**
|
|
17
|
+
* Signer
|
|
18
|
+
*/
|
|
19
|
+
signer: Signer;
|
|
20
|
+
/**
|
|
21
|
+
* Provider
|
|
22
|
+
*/
|
|
23
|
+
provider: Provider;
|
|
24
|
+
/**
|
|
25
|
+
* Start block
|
|
26
|
+
*/
|
|
27
|
+
startBlock?: number;
|
|
28
|
+
/**
|
|
29
|
+
* User public keys (optional)
|
|
30
|
+
*/
|
|
31
|
+
publicKeys?: string[];
|
|
32
|
+
/**
|
|
33
|
+
* Message hashes (optional)
|
|
34
|
+
*/
|
|
35
|
+
messageHashes?: string[];
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Interface that represents get message batches arguments
|
|
39
|
+
*/
|
|
40
|
+
export interface IGetMessageBatchesArgs {
|
|
41
|
+
/**
|
|
42
|
+
* Relayer service url
|
|
43
|
+
*/
|
|
44
|
+
url: string;
|
|
45
|
+
/**
|
|
46
|
+
* Limit
|
|
47
|
+
*/
|
|
48
|
+
limit: number;
|
|
49
|
+
/**
|
|
50
|
+
* Skip
|
|
51
|
+
*/
|
|
52
|
+
skip: number;
|
|
53
|
+
/**
|
|
54
|
+
* Poll id
|
|
55
|
+
*/
|
|
56
|
+
poll: number;
|
|
57
|
+
/**
|
|
58
|
+
* MACI contract address
|
|
59
|
+
*/
|
|
60
|
+
maciContractAddress: string;
|
|
61
|
+
/**
|
|
62
|
+
* IPFS hashes of message batches (optional)
|
|
63
|
+
*/
|
|
64
|
+
ipfsHashes?: string[];
|
|
65
|
+
/**
|
|
66
|
+
* User public keys (optional)
|
|
67
|
+
*/
|
|
68
|
+
publicKeys?: string[];
|
|
69
|
+
/**
|
|
70
|
+
* Message hashes (optional)
|
|
71
|
+
*/
|
|
72
|
+
messageHashes?: string[];
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Interface for the arguments for IpfsHashAdded events parsing
|
|
76
|
+
*/
|
|
77
|
+
export interface IParseIpfsHashAddedEventsArgs {
|
|
78
|
+
/**
|
|
79
|
+
* Poll contract
|
|
80
|
+
*/
|
|
81
|
+
pollContract: Poll;
|
|
82
|
+
/**
|
|
83
|
+
* Start block
|
|
84
|
+
*/
|
|
85
|
+
startBlock: number;
|
|
86
|
+
/**
|
|
87
|
+
* Provider
|
|
88
|
+
*/
|
|
89
|
+
provider: Provider;
|
|
90
|
+
/**
|
|
91
|
+
* User public keys (optional)
|
|
92
|
+
*/
|
|
93
|
+
publicKeys?: string[];
|
|
94
|
+
/**
|
|
95
|
+
* Message hashes (optional)
|
|
96
|
+
*/
|
|
97
|
+
messageHashes?: string[];
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Interface for the return type for getting relayed messages
|
|
101
|
+
*/
|
|
102
|
+
export interface IGetRelayedMessagesData {
|
|
103
|
+
/**
|
|
104
|
+
* Uploaded IPFS messages
|
|
105
|
+
*/
|
|
106
|
+
messages: IIpfsMessage[];
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Interface for the return type for getting message batches from relayer service
|
|
110
|
+
*/
|
|
111
|
+
export interface IGetMessageBatchesData {
|
|
112
|
+
/**
|
|
113
|
+
* Relayer message batches
|
|
114
|
+
*/
|
|
115
|
+
messageBatches: IMessageBatch[];
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Interface that represents message batch
|
|
119
|
+
*/
|
|
120
|
+
export interface IMessageBatch {
|
|
121
|
+
/**
|
|
122
|
+
* Messages
|
|
123
|
+
*/
|
|
124
|
+
messages: IIpfsMessage[];
|
|
125
|
+
/**
|
|
126
|
+
* IPFS hash
|
|
127
|
+
*/
|
|
128
|
+
ipfsHash?: string;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Interface that represents relay messages arguments
|
|
132
|
+
*/
|
|
133
|
+
export interface IRelayMessagesArgs {
|
|
134
|
+
/**
|
|
135
|
+
* Poll id
|
|
136
|
+
*/
|
|
137
|
+
pollId: number;
|
|
138
|
+
/**
|
|
139
|
+
* MACI contract address
|
|
140
|
+
*/
|
|
141
|
+
maciAddress: string;
|
|
142
|
+
/**
|
|
143
|
+
* IPFS hash
|
|
144
|
+
*/
|
|
145
|
+
ipfsHash: string;
|
|
146
|
+
/**
|
|
147
|
+
* IPFS Messages
|
|
148
|
+
*/
|
|
149
|
+
messages: IIpfsMessage[];
|
|
150
|
+
/**
|
|
151
|
+
* Signer
|
|
152
|
+
*/
|
|
153
|
+
signer?: Signer;
|
|
154
|
+
/**
|
|
155
|
+
* Provider
|
|
156
|
+
*/
|
|
157
|
+
provider?: Provider;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Interface that represents return data for relay messages
|
|
161
|
+
*/
|
|
162
|
+
export interface IRelayMessagesData {
|
|
163
|
+
/**
|
|
164
|
+
* Transaction hash
|
|
165
|
+
*/
|
|
166
|
+
hash?: string;
|
|
167
|
+
}
|
|
168
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../ts/relayer/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0CAA0C,CAAC;AACrE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAE/C;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,QAAQ,EAAE,QAAQ,CAAC;IAEnB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IAEtB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IAEZ;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,mBAAmB,EAAE,MAAM,CAAC;IAE5B;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IAEtB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IAEtB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,6BAA6B;IAC5C;;OAEG;IACH,YAAY,EAAE,IAAI,CAAC;IAEnB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,QAAQ,EAAE,QAAQ,CAAC;IAEnB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IAEtB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC;;OAEG;IACH,QAAQ,EAAE,YAAY,EAAE,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC;;OAEG;IACH,cAAc,EAAE,aAAa,EAAE,CAAC;CACjC;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,QAAQ,EAAE,YAAY,EAAE,CAAC;IAEzB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,QAAQ,EAAE,YAAY,EAAE,CAAC;IAEzB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../ts/relayer/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type IIpfsMessage } from "@maci-protocol/contracts";
|
|
2
|
+
import type { IParseIpfsHashAddedEventsArgs } from "./types";
|
|
3
|
+
/**
|
|
4
|
+
* Parse the ipfs hash events from the Poll contract
|
|
5
|
+
*
|
|
6
|
+
* @param args parsing params
|
|
7
|
+
* @returns ipfs messages
|
|
8
|
+
*/
|
|
9
|
+
export declare const parseIpfsHashAddedEvents: ({ pollContract, startBlock, provider, publicKeys, messageHashes, }: IParseIpfsHashAddedEventsArgs) => Promise<{
|
|
10
|
+
messages: IIpfsMessage[];
|
|
11
|
+
}>;
|
|
12
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../ts/relayer/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAe,MAAM,0BAA0B,CAAC;AAG1E,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,SAAS,CAAC;AAI7D;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,GAAU,oEAM5C,6BAA6B,KAAG,OAAO,CAAC;IAAE,QAAQ,EAAE,YAAY,EAAE,CAAA;CAAE,CAwCtE,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseIpfsHashAddedEvents = void 0;
|
|
4
|
+
const contracts_1 = require("@maci-protocol/contracts");
|
|
5
|
+
const domainobjs_1 = require("@maci-protocol/domainobjs");
|
|
6
|
+
const constants_1 = require("../utils/constants");
|
|
7
|
+
/**
|
|
8
|
+
* Parse the ipfs hash events from the Poll contract
|
|
9
|
+
*
|
|
10
|
+
* @param args parsing params
|
|
11
|
+
* @returns ipfs messages
|
|
12
|
+
*/
|
|
13
|
+
const parseIpfsHashAddedEvents = async ({ pollContract, startBlock, provider, publicKeys, messageHashes, }) => {
|
|
14
|
+
const ipfsService = contracts_1.IpfsService.getInstance();
|
|
15
|
+
const currentBlock = await provider.getBlockNumber();
|
|
16
|
+
const ipfsHashes = [];
|
|
17
|
+
for (let block = startBlock; block <= currentBlock; block += constants_1.BLOCKS_STEP) {
|
|
18
|
+
const toBlock = Math.min(block + constants_1.BLOCKS_STEP - 1, currentBlock);
|
|
19
|
+
// eslint-disable-next-line no-await-in-loop
|
|
20
|
+
const events = await pollContract.queryFilter(pollContract.filters.IpfsHashAdded(), block, toBlock);
|
|
21
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
22
|
+
ipfsHashes.push(...events.map((event) => event.args._ipfsHash));
|
|
23
|
+
}
|
|
24
|
+
const messages = await Promise.all(ipfsHashes.map((ipfsHash) => ipfsService.read(ipfsHash))).then((data) => data.reduce((acc, items) => {
|
|
25
|
+
acc?.push(...(items || [])
|
|
26
|
+
.filter((message) => publicKeys && publicKeys.length > 0
|
|
27
|
+
? publicKeys.some((publicKey) => domainobjs_1.PublicKey.deserialize(publicKey).equals(new domainobjs_1.PublicKey([BigInt(message.publicKey[0]), BigInt(message.publicKey[1])])))
|
|
28
|
+
: true)
|
|
29
|
+
.filter((message) => messageHashes && messageHashes.length > 0 ? messageHashes.some((hash) => message.hash === hash) : true));
|
|
30
|
+
return acc ?? [];
|
|
31
|
+
}, []));
|
|
32
|
+
return {
|
|
33
|
+
messages: messages ?? [],
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
exports.parseIpfsHashAddedEvents = parseIpfsHashAddedEvents;
|
|
37
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../ts/relayer/utils.ts"],"names":[],"mappings":";;;AAAA,wDAA0E;AAC1E,0DAAsD;AAItD,kDAAiD;AAEjD;;;;;GAKG;AACI,MAAM,wBAAwB,GAAG,KAAK,EAAE,EAC7C,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,UAAU,EACV,aAAa,GACiB,EAAyC,EAAE;IACzE,MAAM,WAAW,GAAG,uBAAW,CAAC,WAAW,EAAE,CAAC;IAC9C,MAAM,YAAY,GAAG,MAAM,QAAQ,CAAC,cAAc,EAAE,CAAC;IACrD,MAAM,UAAU,GAAa,EAAE,CAAC;IAEhC,KAAK,IAAI,KAAK,GAAG,UAAU,EAAE,KAAK,IAAI,YAAY,EAAE,KAAK,IAAI,uBAAW,EAAE,CAAC;QACzE,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,GAAG,uBAAW,GAAG,CAAC,EAAE,YAAY,CAAC,CAAC;QAChE,4CAA4C;QAC5C,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,WAAW,CAAC,YAAY,CAAC,OAAO,CAAC,aAAa,EAAE,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;QAEpG,gDAAgD;QAChD,UAAU,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;IAClE,CAAC;IAED,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,WAAW,CAAC,IAAI,CAAiB,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAC/G,CAAC,IAAI,EAAE,EAAE,CACP,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE;QACzB,GAAG,EAAE,IAAI,CACP,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC;aACb,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAClB,UAAU,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC;YACjC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAC5B,sBAAS,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,MAAM,CACrC,IAAI,sBAAS,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAC5E,CACF;YACH,CAAC,CAAC,IAAI,CACT;aACA,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAClB,aAAa,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CACvG,CACJ,CAAC;QAEF,OAAO,GAAG,IAAI,EAAE,CAAC;IACnB,CAAC,EAAE,EAAE,CAAC,CACT,CAAC;IAEF,OAAO;QACL,QAAQ,EAAE,QAAQ,IAAI,EAAE;KACzB,CAAC;AACJ,CAAC,CAAC;AA9CW,QAAA,wBAAwB,4BA8CnC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../ts/subgraph/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,YAAY,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./maciSubgraph"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../ts/subgraph/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA+B"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { PublicKey } from "@maci-protocol/domainobjs";
|
|
2
|
+
/**
|
|
3
|
+
* A class that can be used to interact with MACI's subgraph
|
|
4
|
+
* @dev refer to apps/subgraph for subgraph deployment and configuration
|
|
5
|
+
*/
|
|
6
|
+
export declare class MaciSubgraph {
|
|
7
|
+
/**
|
|
8
|
+
* The URL of the subgraph
|
|
9
|
+
*/
|
|
10
|
+
private url;
|
|
11
|
+
/**
|
|
12
|
+
* The query to get all MACIs public keys signed up
|
|
13
|
+
*/
|
|
14
|
+
private userQuery;
|
|
15
|
+
/**
|
|
16
|
+
* Create a new instance of the MaciSubgraph class
|
|
17
|
+
*
|
|
18
|
+
* @param url - The URL of the subgraph
|
|
19
|
+
*/
|
|
20
|
+
constructor(url: string);
|
|
21
|
+
/**
|
|
22
|
+
* Get the public keys of all MACIs signed up
|
|
23
|
+
*
|
|
24
|
+
* @returns Array of public keys including pad key
|
|
25
|
+
*/
|
|
26
|
+
getKeys(): Promise<PublicKey[]>;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=maciSubgraph.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"maciSubgraph.d.ts","sourceRoot":"","sources":["../../../ts/subgraph/maciSubgraph.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAU,MAAM,2BAA2B,CAAC;AAI9D;;;GAGG;AACH,qBAAa,YAAY;IACvB;;OAEG;IACH,OAAO,CAAC,GAAG,CAAS;IAEpB;;OAEG;IACH,OAAO,CAAC,SAAS,CAMb;IAEJ;;;;OAIG;gBACS,GAAG,EAAE,MAAM;IAIvB;;;;OAIG;IACG,OAAO,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;CAmCtC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MaciSubgraph = void 0;
|
|
4
|
+
const domainobjs_1 = require("@maci-protocol/domainobjs");
|
|
5
|
+
/**
|
|
6
|
+
* A class that can be used to interact with MACI's subgraph
|
|
7
|
+
* @dev refer to apps/subgraph for subgraph deployment and configuration
|
|
8
|
+
*/
|
|
9
|
+
class MaciSubgraph {
|
|
10
|
+
/**
|
|
11
|
+
* Create a new instance of the MaciSubgraph class
|
|
12
|
+
*
|
|
13
|
+
* @param url - The URL of the subgraph
|
|
14
|
+
*/
|
|
15
|
+
constructor(url) {
|
|
16
|
+
/**
|
|
17
|
+
* The query to get all MACIs public keys signed up
|
|
18
|
+
*/
|
|
19
|
+
this.userQuery = `
|
|
20
|
+
query {
|
|
21
|
+
users (orderBy: createdAt, orderDirection: asc) {
|
|
22
|
+
id
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
`;
|
|
26
|
+
this.url = url;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Get the public keys of all MACIs signed up
|
|
30
|
+
*
|
|
31
|
+
* @returns Array of public keys including pad key
|
|
32
|
+
*/
|
|
33
|
+
async getKeys() {
|
|
34
|
+
const res = await fetch(this.url, {
|
|
35
|
+
method: "POST",
|
|
36
|
+
body: JSON.stringify({
|
|
37
|
+
query: this.userQuery,
|
|
38
|
+
}),
|
|
39
|
+
headers: {
|
|
40
|
+
"Content-Type": "application/json",
|
|
41
|
+
Accept: "application/json",
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
if (!res.ok) {
|
|
45
|
+
throw new Error(`GraphQL query failed: ${res.statusText}`);
|
|
46
|
+
}
|
|
47
|
+
const json = (await res.json());
|
|
48
|
+
if (json.errors) {
|
|
49
|
+
throw new Error(`GraphQL errors: ${JSON.stringify(json.errors)}`);
|
|
50
|
+
}
|
|
51
|
+
if (!json.data?.users) {
|
|
52
|
+
throw new Error("No users data in response");
|
|
53
|
+
}
|
|
54
|
+
const userKeys = json.data.users.map((user) => {
|
|
55
|
+
// Split the id into x and y coordinates and convert to BigInt
|
|
56
|
+
const [x, y] = user.id.split(" ");
|
|
57
|
+
return new domainobjs_1.PublicKey([BigInt(x), BigInt(y)]);
|
|
58
|
+
});
|
|
59
|
+
userKeys.unshift(domainobjs_1.padKey);
|
|
60
|
+
return userKeys;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
exports.MaciSubgraph = MaciSubgraph;
|
|
64
|
+
//# sourceMappingURL=maciSubgraph.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"maciSubgraph.js","sourceRoot":"","sources":["../../../ts/subgraph/maciSubgraph.ts"],"names":[],"mappings":";;;AAAA,0DAA8D;AAI9D;;;GAGG;AACH,MAAa,YAAY;IAiBvB;;;;OAIG;IACH,YAAY,GAAW;QAhBvB;;WAEG;QACK,cAAS,GAAG;;;;;;KAMjB,CAAC;QAQF,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACjB,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,OAAO;QACX,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE;YAChC,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;gBACnB,KAAK,EAAE,IAAI,CAAC,SAAS;aACtB,CAAC;YACF,OAAO,EAAE;gBACP,cAAc,EAAE,kBAAkB;gBAClC,MAAM,EAAE,kBAAkB;aAC3B;SACF,CAAC,CAAC;QAEH,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;YACZ,MAAM,IAAI,KAAK,CAAC,yBAAyB,GAAG,CAAC,UAAU,EAAE,CAAC,CAAC;QAC7D,CAAC;QAED,MAAM,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAAoB,CAAC;QAEnD,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChB,MAAM,IAAI,KAAK,CAAC,mBAAmB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QACpE,CAAC;QAED,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC;YACtB,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;QAC/C,CAAC;QAED,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;YAC5C,8DAA8D;YAC9D,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAClC,OAAO,IAAI,sBAAS,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC/C,CAAC,CAAC,CAAC;QAEH,QAAQ,CAAC,OAAO,CAAC,mBAAM,CAAC,CAAC;QACzB,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF;AAlED,oCAkEC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The response from the GraphQL query
|
|
3
|
+
*/
|
|
4
|
+
export interface GraphQLResponse {
|
|
5
|
+
/**
|
|
6
|
+
* The data from the query
|
|
7
|
+
*/
|
|
8
|
+
data?: {
|
|
9
|
+
users: {
|
|
10
|
+
id: string;
|
|
11
|
+
}[];
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* The errors from the query
|
|
15
|
+
*/
|
|
16
|
+
errors?: {
|
|
17
|
+
message: string;
|
|
18
|
+
}[];
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../ts/subgraph/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,IAAI,CAAC,EAAE;QACL,KAAK,EAAE;YACL,EAAE,EAAE,MAAM,CAAC;SACZ,EAAE,CAAC;KACL,CAAC;IACF;;OAEG;IACH,MAAM,CAAC,EAAE;QACP,OAAO,EAAE,MAAM,CAAC;KACjB,EAAE,CAAC;CACL"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../ts/subgraph/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { IGenerateTallyCommitmentsArgs, ITallyCommitments } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Generate the tally commitments for this current batch of proving
|
|
4
|
+
* @param tallyData - The tally data
|
|
5
|
+
* @param voteOptionTreeDepth - The vote option tree depth
|
|
6
|
+
* @returns The commitments to the Tally data
|
|
7
|
+
*/
|
|
8
|
+
export declare const generateTallyCommitments: ({ tallyData, voteOptionTreeDepth, }: IGenerateTallyCommitmentsArgs) => ITallyCommitments;
|
|
9
|
+
//# sourceMappingURL=commitments.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commitments.d.ts","sourceRoot":"","sources":["../../../ts/tally/commitments.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,6BAA6B,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEhF;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,GAAI,qCAGtC,6BAA6B,KAAG,iBAyClC,CAAC"}
|