Skip to content

Commit

Permalink
more explicit types
Browse files Browse the repository at this point in the history
  • Loading branch information
malerba118 committed Feb 11, 2022
1 parent 8effc1c commit 11e5f09
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions hooks/useCommentsContract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ const useCommentsContract = () => {
signerOrProvider: signer.data || provider,
});

const getComments = (topic: string): Comment[] => {
const getComments = async (topic: string): Promise<Comment[]> => {
return contract.getComments(topic).then((comments) => {
return comments.map((c) => ({ ...c }));
});
};

const addComment = async (topic: string, message: string) => {
const addComment = async (topic: string, message: string): Promise<void> => {
const tx = await contract.addComment(topic, message);
await tx.wait();
};
Expand All @@ -43,7 +43,6 @@ const useCommentsContract = () => {
subscriber: Subscriber
): Unsubscriber => {
contract.on(eventType, (data) => {
console.log(data);
subscriber(data);
});
return () => {
Expand Down

0 comments on commit 11e5f09

Please sign in to comment.