diff --git a/src/App.js b/src/App.js
index cf8528c..7282ce8 100644
--- a/src/App.js
+++ b/src/App.js
@@ -10,31 +10,37 @@ const App = function AppWrapper() {
const [balance, setBalance] = useState(0);
const fetchBalance = async (accountAddress) => {
- indexerClient
- .lookupAccountByID(accountAddress)
- .do()
- .then((response) => {
- const _balance = response.account.amount;
- setBalance(_balance);
- })
- .catch((error) => {
- console.log(error);
- });
+ try {
+ const response = await indexerClient
+ .lookupAccountByID(accountAddress)
+ .do()
+
+ if (!response) return
+
+ const _balance = response.account.amount;
+ setBalance(_balance);
+
+ } catch (error) {
+ console.log(error);
+ }
+
};
const connectWallet = async () => {
- myAlgoConnect
- .connect()
- .then((accounts) => {
- const _account = accounts[0];
- setAddress(_account.address);
- setName(_account.name);
- fetchBalance(_account.address);
- })
- .catch((error) => {
- console.log("Could not connect to MyAlgo wallet");
- console.error(error);
- });
+ try {
+ const accounts = await myAlgoConnect
+ .connect()
+
+ const _account = accounts[0];
+ setAddress(_account.address);
+ setName(_account.name);
+ fetchBalance(_account.address);
+
+ } catch (error) {
+ console.log("Could not connect to MyAlgo wallet");
+ console.error(error);
+ }
+
};
const disconnect = () => {
diff --git a/src/components/Home.jsx b/src/components/Home.jsx
index 108015e..047a4c8 100644
--- a/src/components/Home.jsx
+++ b/src/components/Home.jsx
@@ -68,63 +68,67 @@ export default function Home({
}, []);
const createRequest = async () => {
- setLoading(true);
- createRequestAction(address, { ...newRequest, createdAt: Date.now() })
- .then(() => {
- toast(