Last active
June 16, 2021 18:11
-
-
Save nginnever/04b5aa0c847d46bf5bcb7a88c7b43c79 to your computer and use it in GitHub Desktop.
voteApi.ts
This file contains hidden or 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
export const vote = ( | |
daoAddress: string, | |
proposalId: number, | |
vote: boolean, | |
provider: Web3Provider, | |
signer: JsonRpcSigner | |
): Promise<number> => | |
new Promise<number>(async (resolve, reject) => { | |
try { | |
const daoContract = new Contract(daoAddress, HouseTokenDAO.abi, signer) | |
const tx = await daoContract.vote(proposalId, vote) | |
provider.once(tx.hash, () => { | |
resolve() | |
}) | |
} catch (e) { | |
reject(e) | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment