Skip to content

Commit

Permalink
Merge pull request #270 from privacy-scaling-explorations/feat/voice-…
Browse files Browse the repository at this point in the history
…credits-on-signup

feat(signup): store voice credits from signup call
  • Loading branch information
0xmad authored Aug 20, 2024
2 parents 000ad4b + 3f3db93 commit e72cfbb
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 13 deletions.
4 changes: 2 additions & 2 deletions packages/interface/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
"graphql-request": "^6.1.0",
"lowdb": "^1.0.0",
"lucide-react": "^0.316.0",
"maci-cli": "^2.1.0",
"maci-domainobjs": "^2.0.0",
"maci-cli": "^2.2.0",
"maci-domainobjs": "^2.2.0",
"next": "^14.1.0",
"next-auth": "^4.24.5",
"next-themes": "^0.2.1",
Expand Down
5 changes: 3 additions & 2 deletions packages/interface/src/contexts/Maci.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ export const MaciProvider: React.FC<MaciProviderProps> = ({ children }: MaciProv
setIsLoading(true);

try {
const { stateIndex: index } = await signup({
const { stateIndex: index, voiceCredits } = await signup({
maciPubKey,
maciAddress: config.maciAddress!,
sgDataArg: sgData,
Expand All @@ -230,6 +230,7 @@ export const MaciProvider: React.FC<MaciProviderProps> = ({ children }: MaciProv
if (index) {
setIsRegistered(true);
setStateIndex(index);
setInitialVoiceCredits(voiceCredits);
}
} catch (e) {
onError();
Expand All @@ -238,7 +239,7 @@ export const MaciProvider: React.FC<MaciProviderProps> = ({ children }: MaciProv
setIsLoading(false);
}
},
[maciPubKey, signer, setIsRegistered, setStateIndex, setIsLoading, sgData],
[maciPubKey, signer, setIsRegistered, setStateIndex, setInitialVoiceCredits, setIsLoading, sgData],
);

// function to be used to vote on a poll
Expand Down
76 changes: 67 additions & 9 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e72cfbb

Please sign in to comment.