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

Debug mobile faucet #1753

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
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
15 changes: 15 additions & 0 deletions src/components/AuthLogin/AuthModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,9 @@ const AuthModal = ({
const { DASHBOARD_URL, VERCEL_ENV } = siteConfig?.customFields || {};
const {
sdk,
metaMaskAccount,
metaMaskAccountEns,
metaMaskProvider,
setNeedsMfa,
setWalletLinked,
setWalletAuthUrl,
Expand All @@ -162,6 +165,11 @@ const AuthModal = ({

const login = async () => {
setStep(AUTH_LOGIN_STEP.CONNECTING);


console.log('metaMaskAccount', metaMaskAccount);
console.log('metaMaskAccountEns', metaMaskAccountEns);

try {
if (!sdk.isExtensionActive()) {
setOpen(false);
Expand All @@ -170,19 +178,26 @@ const AuthModal = ({
// Try to connect wallet first
const accounts = await sdk.connect();

console.log('accounts', accounts);

if (accounts && accounts.length > 0) {
setMetaMaskAccount(accounts[0]);
fetchLineaEns(accounts[0]);
const provider = sdk.getProvider();
setMetaMaskProvider(provider);
}

console.log('metaMaskProvider', metaMaskProvider);

// Call Profile SDK API to retrieve Hydra Access Token & Wallet userProfile
// Hydra Access Token will be used to fetch Infura API
const { accessToken, userProfile } = await authenticateAndAuthorize(
VERCEL_ENV as string,
);

console.log('accessToken', accessToken);
console.log('userProfile', userProfile);

const loginResponse = await (
await fetch(
`${DASHBOARD_URL}/api/wallet/login`,
Expand Down
1 change: 1 addition & 0 deletions src/lib/siwsrp/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ export const authenticateAndAuthorize = async (env: string) => {
accessToken = await auth(env).getAccessToken();
userProfile = await auth(env).getUserProfile();
} catch (e: any) {
console.log('e', e);
throw new Error(e.message);
}

Expand Down
3 changes: 2 additions & 1 deletion src/theme/Root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ const sdk = new MetaMaskSDK({
name: "Reference pages",
url: "https://docs.metamask.io/",
},
preferDesktop: true,
// preferDesktop: true,
useDeeplink: true,
extensionOnly: true,
checkInstallationImmediately: false,
logging: {
Expand Down
Loading