-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
isk
committed
Oct 23, 2023
1 parent
80dbb26
commit 02d904d
Showing
28 changed files
with
637 additions
and
732 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,35 @@ | ||
import Box from "@mui/material/Box"; | ||
import Typography from "@mui/material/Typography"; | ||
|
||
import { useGlobalStyles } from "@src/styles"; | ||
|
||
import ActionBox from "../ActionBox"; | ||
|
||
import { GENERATE_MERKLE_TREE_CODE, JOIN_GROUP_CODE } from "./codeExported"; | ||
|
||
interface IBandadaProps { | ||
joinGroup: () => Promise<void>; | ||
generateGroupMerkleProof: () => Promise<void>; | ||
} | ||
|
||
const GENERATE_MERKLE_TREE_CODE = `import { initializeCryptKeeper } from "@cryptkeeperzk/providers"; | ||
const client = initializeCryptKeeper(); | ||
const connect = (async () => { | ||
await client?.request({ | ||
method: RPCExternalAction.GENERATE_GROUP_MERKLE_PROOF, | ||
payload: { | ||
groupId: process.env.TEST_GROUP_ID!, | ||
}, | ||
});`; | ||
|
||
const JOIN_GROUP_CODE = `import { initializeCryptKeeper } from "@cryptkeeperzk/providers"; | ||
const client = initializeCryptKeeper(); | ||
const connect = async () => { | ||
await client?.request({ | ||
method: RPCExternalAction.JOIN_GROUP, | ||
payload: { | ||
groupId: process.env.TEST_GROUP_ID!, | ||
apiKey: process.env.TEST_GROUP_API_KEY, | ||
inviteCode: process.env.TEST_GROUP_INVITE_CODE, | ||
}, | ||
})`; | ||
|
||
export const Bandada = ({ joinGroup, generateGroupMerkleProof }: IBandadaProps): JSX.Element => ( | ||
<Box | ||
className="popup" | ||
sx={{ p: 3, display: "flex", flexDirection: "column", alignItems: "center", justifyContent: "center" }} | ||
> | ||
<Typography variant="h6">Integration with Bandada service</Typography> | ||
|
||
<ActionBox<null, void> | ||
code={GENERATE_MERKLE_TREE_CODE} | ||
onClick={generateGroupMerkleProof} | ||
option={null} | ||
title="Generate Group Merkle Proof" | ||
/> | ||
|
||
<ActionBox<null, void> | ||
code={JOIN_GROUP_CODE} | ||
onClick={joinGroup} | ||
option={null} | ||
title="Join test group" | ||
/> | ||
</Box> | ||
); | ||
export const Bandada = ({ joinGroup, generateGroupMerkleProof }: IBandadaProps): JSX.Element => { | ||
const classes = useGlobalStyles(); | ||
|
||
return ( | ||
<Box | ||
className={classes.popup} | ||
sx={{ p: 3, display: "flex", flexDirection: "column", alignItems: "center", justifyContent: "center" }} | ||
> | ||
<Typography variant="h6">Integration with Bandada service</Typography> | ||
|
||
<ActionBox<null, void> | ||
code={GENERATE_MERKLE_TREE_CODE} | ||
option={null} | ||
title="Generate Group Merkle Proof" | ||
onClick={generateGroupMerkleProof} | ||
/> | ||
|
||
<ActionBox<null, void> code={JOIN_GROUP_CODE} option={null} title="Join test group" onClick={joinGroup} /> | ||
</Box> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { RPCExternalAction, initializeCryptKeeper } from "@cryptkeeperzk/providers"; | ||
|
||
const client = initializeCryptKeeper(); | ||
|
||
const generateGroupMerkleProof = async (): Promise<void> => { | ||
await client?.request({ | ||
method: RPCExternalAction.GENERATE_GROUP_MERKLE_PROOF, | ||
payload: { | ||
groupId: process.env.TEST_GROUP_ID!, | ||
}, | ||
}); | ||
}; | ||
|
||
const joinGroup = async (): Promise<void> => { | ||
await client?.request({ | ||
method: RPCExternalAction.JOIN_GROUP, | ||
payload: { | ||
groupId: process.env.TEST_GROUP_ID!, | ||
apiKey: process.env.TEST_GROUP_API_KEY, | ||
inviteCode: process.env.TEST_GROUP_INVITE_CODE, | ||
}, | ||
}); | ||
}; | ||
|
||
export { generateGroupMerkleProof, joinGroup }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
export const GENERATE_MERKLE_TREE_CODE = `import { RPCExternalAction, initializeCryptKeeper } from "@cryptkeeperzk/providers"; | ||
const client = initializeCryptKeeper(); | ||
const generateGroupMerkleProof = async () => { | ||
await client?.request({ | ||
method: RPCExternalAction.GENERATE_GROUP_MERKLE_PROOF, | ||
payload: { | ||
groupId: process.env.TEST_GROUP_ID!, | ||
}, | ||
}); | ||
}`; | ||
|
||
export const JOIN_GROUP_CODE = `import { RPCExternalAction, initializeCryptKeeper } from "@cryptkeeperzk/providers"; | ||
const client = initializeCryptKeeper(); | ||
const joinGroup = async () => { | ||
await client?.request({ | ||
method: RPCExternalAction.JOIN_GROUP, | ||
payload: { | ||
groupId: process.env.TEST_GROUP_ID!, | ||
apiKey: process.env.TEST_GROUP_API_KEY, | ||
inviteCode: process.env.TEST_GROUP_INVITE_CODE, | ||
}, | ||
}); | ||
}`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.