From 55d40c6c4e87591e658db99549ce493c56b00ed6 Mon Sep 17 00:00:00 2001 From: Ladd Hoffman Date: Thu, 14 Mar 2024 21:26:31 -0500 Subject: [PATCH] Add button to watch rep token in metamask --- client/src/App.jsx | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/client/src/App.jsx b/client/src/App.jsx index e34f67d..1c910d2 100644 --- a/client/src/App.jsx +++ b/client/src/App.jsx @@ -211,6 +211,10 @@ function App() { setWork1(work1Contract); setDAO(DAOContract); + /* -------------------------------------------------------------------------------- */ + /* --------------------------- BEGIN EVENT HANDLERS ------------------------------- */ + /* -------------------------------------------------------------------------------- */ + DAOContract.events.PostAdded({ fromBlock: 'latest' }).on('data', (event) => { console.log('event: post added', event); fetchPost(event.returnValues.postIndex); @@ -281,17 +285,17 @@ function App() { } }, [sdk]); - // const watchReputationToken = useCallback(async () => { - // await provider.request({ - // method: 'wallet_watchAsset', - // params: { - // type: 'ERC20', - // options: { - // address: DAOAddress, - // }, - // }, - // }); - // }, [provider]); + const watchReputationToken = useCallback(async () => { + await provider.request({ + method: 'wallet_watchAsset', + params: { + type: 'ERC20', + options: { + address: contracts[chainId].DAO, + }, + }, + }); + }, [provider, chainId]); const addPost = useCallback(async () => { await DAO.methods.addPost(account).send({ @@ -432,6 +436,7 @@ function App() {
+
@@ -439,7 +444,6 @@ function App() { -
{`Posts count: ${posts.length}`}