Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Gateway] enable metamask desktop and mobile support #1697

Merged
merged 8 commits into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add logs to test
  • Loading branch information
Jennievon committed Dec 14, 2023
commit 86683917736090898ad31ba9aed550d9b38400f6
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const Connected = () => {
</TableRow>
) : (
accounts.map((account: Account, i: number) => (
<TableRow key={i}>
<TableRow key={account.name}>
<TableCell className="font-medium">
<TruncatedAddress address={account.name} />
</TableCell>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,23 +136,30 @@ export const WalletConnectionProvider = ({

try {
const accounts = await ethService.getAccounts(provider);
showToast(ToastType.SUCCESS, "Accounts fetched!");
const token = await getToken(provider);
showToast(ToastType.SUCCESS, "Token fetched!");
setToken(token);
let updatedAccounts: Account[] = [];

updatedAccounts = await Promise.all(
accounts!.map(async (account) => {
await ethService.authenticateWithGateway(token, account.name);
showToast(ToastType.SUCCESS, "Account authenticated with gateway!");
const { status } = await accountIsAuthenticated(token, account.name);
showToast(ToastType.SUCCESS, "Account authenticated!");
return {
...account,
connected: status,
};
})
);
setAccounts(updatedAccounts || null);
} catch (error) {
showToast(ToastType.DESTRUCTIVE, "Error fetching user accounts.");
} catch (error: any) {
showToast(
ToastType.DESTRUCTIVE,
`Error fetching user accounts: ${error?.message}`
);
} finally {
setWalletConnected(true);
setLoading(false);
Expand Down
Loading