Skip to content

Commit 7c1e794

Browse files
committed
chore: remove logs and comments
1 parent 9e2539d commit 7c1e794

File tree

4 files changed

+41
-44
lines changed

4 files changed

+41
-44
lines changed

src/components/AuthLogin/AuthModal.tsx

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ import {
1414
AUTH_WALLET_SESSION_NAME,
1515
AUTH_WALLET_USER_PLAN,
1616
} from "@site/src/lib/siwsrp/auth";
17-
import { REQUEST_PARAMS } from "@site/src/lib/constants";
17+
import {
18+
REQUEST_PARAMS,
19+
} from "@site/src/lib/constants";
1820
import { MetamaskProviderContext } from "@site/src/theme/Root";
1921

2022
Modal.setAppElement("#__docusaurus");
@@ -37,7 +39,7 @@ export enum AUTH_LOGIN_STEP {
3739
export enum WALLET_LINK_TYPE {
3840
NO = "NO",
3941
ONE = "ONE",
40-
MULTIPLE = "MULTIPLE",
42+
MULTIPLE = "MULTIPLE"
4143
}
4244

4345
const ConnectingModal = () => {
@@ -161,12 +163,9 @@ const AuthModal = ({
161163
const login = async () => {
162164
setStep(AUTH_LOGIN_STEP.CONNECTING);
163165
try {
164-
165-
// This will cause problems on mobile
166-
// check what this value is on mobile. Do we need to do something different?
167-
// if (!sdk.isExtensionActive()) {
168-
// setOpen(false);
169-
// }
166+
if (!sdk.isExtensionActive()) {
167+
setOpen(false);
168+
}
170169

171170
// Try to connect wallet first
172171
const accounts = await sdk.connect();
@@ -187,16 +186,19 @@ const AuthModal = ({
187186
);
188187

189188
const loginResponse = await (
190-
await fetch(`${DASHBOARD_URL}/api/wallet/login`, {
191-
...REQUEST_PARAMS("POST", {
192-
hydra_token: accessToken,
193-
token: "true",
194-
}),
195-
body: JSON.stringify({
196-
profileId: userProfile.profileId,
197-
redirect_to: window.location.href,
198-
}),
199-
})
189+
await fetch(
190+
`${DASHBOARD_URL}/api/wallet/login`,
191+
{
192+
...REQUEST_PARAMS("POST", {
193+
hydra_token: accessToken,
194+
token: "true",
195+
}),
196+
body: JSON.stringify({
197+
profileId: userProfile.profileId,
198+
redirect_to: window.location.href,
199+
}),
200+
},
201+
)
200202
).json();
201203

202204
if (!loginResponse) throw new Error("Something went wrong");
@@ -212,7 +214,7 @@ const AuthModal = ({
212214
mmAuthSession: sessionStorage.getItem(AUTH_WALLET_SESSION_NAME),
213215
walletPairing: data.pairing,
214216
token: true,
215-
})
217+
}),
216218
).toString("base64");
217219

218220
const walletAuthUrl = `${DASHBOARD_URL}/login?mm_auth=${mm_auth}&redirect_to=${session.redirect_to}`;
@@ -235,10 +237,10 @@ const AuthModal = ({
235237
if (data.mfa?.enabled) {
236238
const mm_auth = Buffer.from(
237239
JSON.stringify({
238-
step: "verify",
240+
step: 'verify',
239241
mmAuthSession: sessionStorage.getItem(AUTH_WALLET_SESSION_NAME),
240-
dashboardSessionToken: token,
241-
})
242+
dashboardSessionToken: token
243+
}),
242244
).toString("base64");
243245

244246
const walletAuthUrl = `${DASHBOARD_URL}/login?mm_auth=${mm_auth}&redirect_to=${session.redirect_to}`;
@@ -273,7 +275,7 @@ const AuthModal = ({
273275
`${DASHBOARD_URL}/api/v1/users/${userId}/projects`,
274276
{
275277
...REQUEST_PARAMS("GET", { Authorization: `Bearer ${token}` }),
276-
}
278+
},
277279
);
278280
const {
279281
result: { projects },
@@ -285,7 +287,7 @@ const AuthModal = ({
285287
`${DASHBOARD_URL}/api/v1/users/${userId}`,
286288
{
287289
...REQUEST_PARAMS("GET", { Authorization: `Bearer ${token}` }),
288-
}
290+
},
289291
);
290292
const {
291293
result: {

src/components/Faucet/Hero.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ export default function Hero({
3737
walletAuthUrl,
3838
} = useContext(MetamaskProviderContext);
3939

40-
4140
const isMobile = sdk.platformManager?.isMobile ?? false;
4241
const isExtensionActive = sdk.isExtensionActive();
4342

@@ -98,7 +97,7 @@ export default function Hero({
9897
styles.hero,
9998
network === "linea" && styles.linea,
10099
network === "sepolia" && styles.sepolia,
101-
className
100+
className,
102101
)}
103102
>
104103
{!(!showInstallButton && metaMaskAccount) && <EthIcon />}
@@ -142,7 +141,7 @@ export default function Hero({
142141
)}
143142
<div
144143
className={clsx(
145-
!!Object.keys(projects).length && styles.alignedButtons
144+
!!Object.keys(projects).length && styles.alignedButtons,
146145
)}
147146
>
148147
{showInstallButton ? (

src/lib/siwsrp/auth.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,8 @@ export const authenticateAndAuthorize = async (env: string, customProvider: SDKP
7171
let accessToken: string, userProfile: SDK.UserProfile;
7272
try {
7373
const authInstance = auth(env);
74-
console.log("authInstance", authInstance);
75-
console.log("customProvider", customProvider);
7674
authInstance.setCustomProvider(customProvider);
77-
console.log('about to connectSnap')
7875
await authInstance.connectSnap();
79-
console.log('after connectSnap')
8076
accessToken = await authInstance.getAccessToken();
8177
userProfile = await authInstance.getUserProfile();
8278
} catch (e: any) {

src/theme/Root.tsx

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -72,28 +72,28 @@ interface IMetamaskProviderContext {
7272
export const MetamaskProviderContext = createContext<IMetamaskProviderContext>({
7373
token: undefined,
7474
projects: {},
75-
setProjects: () => { },
76-
metaMaskDisconnect: () => new Promise(() => { }),
77-
metaMaskWalletIdConnectHandler: () => new Promise(() => { }),
75+
setProjects: () => {},
76+
metaMaskDisconnect: () => new Promise(() => {}),
77+
metaMaskWalletIdConnectHandler: () => new Promise(() => {}),
7878
userId: undefined,
7979
metaMaskAccount: undefined,
8080
metaMaskAccountEns: undefined,
81-
setMetaMaskAccount: () => { },
81+
setMetaMaskAccount: () => {},
8282
uksTier: undefined,
8383
metaMaskProvider: undefined,
84-
setMetaMaskProvider: () => { },
84+
setMetaMaskProvider: () => {},
8585
sdk: undefined,
86-
setNeedsMfa: () => { },
86+
setNeedsMfa: () => {},
8787
needsMfa: false,
88-
setWalletLinked: () => { },
88+
setWalletLinked: () => {},
8989
walletLinked: undefined,
90-
setWalletAuthUrl: () => { },
90+
setWalletAuthUrl: () => {},
9191
walletAuthUrl: "",
9292
userAPIKey: "",
93-
setUserAPIKey: () => { },
94-
fetchLineaEns: () => new Promise(() => { }),
93+
setUserAPIKey: () => {},
94+
fetchLineaEns: () => new Promise(() => {}),
9595
userEncPublicKey: undefined,
96-
setUserEncPublicKey: () => { },
96+
setUserEncPublicKey: () => {},
9797
});
9898

9999
const sdk = new MetaMaskSDK({
@@ -105,7 +105,7 @@ const sdk = new MetaMaskSDK({
105105
extensionOnly: true,
106106
checkInstallationImmediately: false,
107107
logging: {
108-
sdk: true,
108+
sdk: false,
109109
},
110110
});
111111

@@ -173,7 +173,7 @@ export const LoginProvider = ({ children }) => {
173173
const provider = sdk.getProvider();
174174
setMetaMaskProvider(provider);
175175
}
176-
} catch (e) { }
176+
} catch (e) {}
177177
};
178178

179179
const metaMaskWalletIdConnectHandler = useCallback(async () => {

0 commit comments

Comments
 (0)