Skip to content

Commit 8f94436

Browse files
committed
debuggin/remove unused privy stuff
1 parent 4d0b42d commit 8f94436

24 files changed

+251
-733
lines changed

App.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ LogBox.ignoreLogs([
6868
"sync worker error storage error: Pool needs to reconnect before use",
6969
"[Converse.debug.dylib] sync worker error storage error: Pool needs to reconnect before use",
7070
"Falling back to file-based resolution. Consider updating the call site or asking the package maintainer(s) to expose this API.",
71+
/Require cycle/,
7172
]);
7273

7374
// This is the default configuration
@@ -169,12 +170,19 @@ export default function AppWithProviders() {
169170
const { themeScheme, setThemeContextOverride, ThemeProvider } =
170171
useThemeProvider();
171172

173+
logger.debug("[privy info]", {
174+
appId: config.privy.appId,
175+
clientId: config.privy.clientId,
176+
storage: privySecureStorage,
177+
supportedChains: [base],
178+
});
179+
172180
return (
173181
<QueryClientProvider client={queryClient}>
174182
<PrivyProvider
175183
appId={config.privy.appId}
176184
clientId={config.privy.clientId}
177-
storage={privySecureStorage}
185+
// storage={privySecureStorage}
178186
supportedChains={[base]}
179187
>
180188
<SmartWalletsProvider>

app.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ export default (): ExpoConfig => {
100100
config: {
101101
usesNonExemptEncryption: false,
102102
},
103+
associatedDomains: ["webcredentials:dev.converse.xyz"],
103104
},
104105
extra: {
105106
expoEnv,

components/Onboarding/InviteCode.tsx

Lines changed: 0 additions & 71 deletions
This file was deleted.

components/Onboarding/init-xmtp-client.ts

Lines changed: 55 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,27 +27,34 @@ export async function initXmtpClient(args: {
2727
pkPath?: string;
2828
}) {
2929
const { signer, address, ...restArgs } = args;
30+
logger.debug(
31+
`[initXmtpClient] Starting with args: ${JSON.stringify({ address, ...restArgs }, null, 2)}`
32+
);
3033

3134
if (!signer || !address) {
35+
logger.error("[initXmtpClient] Missing required params");
3236
throw new Error("No signer or address");
3337
}
3438

3539
try {
40+
logger.debug("[initXmtpClient] Creating XMTP client from signer");
3641
await createXmtpClientFromSigner(signer, async () => {
42+
logger.debug("[initXmtpClient] Installation revoked, showing alert");
3743
await awaitableAlert(
3844
translate("current_installation_revoked"),
3945
translate("current_installation_revoked_description")
4046
);
4147
throw new Error("Current installation revoked");
4248
});
4349

50+
logger.debug("[initXmtpClient] Connecting with address");
4451
await connectWithAddress({
4552
address,
4653
...restArgs,
4754
});
4855
} catch (e) {
56+
logger.error(`[initXmtpClient] Error: ${JSON.stringify(e, null, 2)}`);
4957
await logoutAccount({ account: address });
50-
logger.error(e);
5158
throw e;
5259
}
5360
}
@@ -59,33 +66,47 @@ export async function initXmtpClientFromViemAccount(args: {
5966
pkPath?: string;
6067
}) {
6168
const { account, ...restArgs } = args;
69+
logger.debug(
70+
`[initXmtpClientFromViemAccount] Starting with args: ${JSON.stringify({ account: account.address, ...restArgs }, null, 2)}`
71+
);
6272

6373
if (!account) {
74+
logger.error("[initXmtpClientFromViemAccount] No account provided");
6475
throw new Error("No signer");
6576
}
6677

6778
const { address } = account;
6879

6980
if (!address) {
81+
logger.error("[initXmtpClientFromViemAccount] No address in account");
7082
throw new Error("No address");
7183
}
7284

7385
try {
86+
logger.debug(
87+
"[initXmtpClientFromViemAccount] Creating XMTP client from Viem account"
88+
);
7489
await createXmtpClientFromViemAccount(account, async () => {
90+
logger.debug(
91+
"[initXmtpClientFromViemAccount] Installation revoked, showing alert"
92+
);
7593
await awaitableAlert(
7694
translate("current_installation_revoked"),
7795
translate("current_installation_revoked_description")
7896
);
7997
throw new Error("Current installation revoked");
8098
});
8199

100+
logger.debug("[initXmtpClientFromViemAccount] Connecting with address");
82101
await connectWithAddress({
83102
address,
84103
...restArgs,
85104
});
86105
} catch (e) {
106+
logger.error(
107+
`[initXmtpClientFromViemAccount] Error: ${JSON.stringify(e, null, 2)}`
108+
);
87109
await logoutAccount({ account: address });
88-
logger.error(e);
89110
throw e;
90111
}
91112
}
@@ -116,52 +137,73 @@ type IConnectWithAddressKeyArgs =
116137

117138
export async function connectWithAddress(args: IConnectWithAddressKeyArgs) {
118139
const { address } = args;
119-
120-
logger.debug("In connectWithAddress");
140+
logger.debug(
141+
`[connectWithAddress] Starting with args: ${JSON.stringify(args, null, 2)}`
142+
);
121143

122144
if (!address) {
145+
logger.error("[connectWithAddress] No address provided");
123146
sentryTrackMessage("Could not connect because no address");
124147
return;
125148
}
126149

127150
try {
151+
logger.debug("[connectWithAddress] Performing logout and saving key");
128152
await performLogoutAndSaveKey(address);
129153

154+
logger.debug("[connectWithAddress] Setting current account");
130155
useAccountsStore.getState().setCurrentAccount(address, true);
156+
157+
logger.debug("[connectWithAddress] Finalizing account setup");
131158
await finalizeAccountSetup(args);
159+
160+
logger.debug("[connectWithAddress] Connection completed successfully");
132161
sentryTrackMessage("Connecting done!");
133162
} catch (e) {
134-
logger.error(e, { context: "Onboarding - connectWithAddress" });
163+
logger.error(`[connectWithAddress] Error: ${JSON.stringify(e, null, 2)}`, {
164+
context: "Onboarding - connectWithAddress",
165+
});
135166
Alert.alert(translate("onboarding_error"));
136167
throw e;
137168
}
138169
}
139170

140171
async function performLogoutAndSaveKey(address: string) {
141-
logger.debug("Waiting for logout tasks");
172+
logger.debug(`[performLogoutAndSaveKey] Starting for address: ${address}`);
173+
logger.debug("[performLogoutAndSaveKey] Waiting for logout tasks");
142174
await waitForLogoutTasksDone(500);
143-
logger.debug("Logout tasks done, saving xmtp key");
144-
logger.debug("XMTP Key saved");
175+
logger.debug("[performLogoutAndSaveKey] Logout tasks completed");
176+
logger.debug("[performLogoutAndSaveKey] XMTP Key saved");
145177
}
146178

147179
async function finalizeAccountSetup(args: IConnectWithAddressKeyArgs) {
148-
logger.debug("Finalizing account setup");
180+
logger.debug(
181+
`[finalizeAccountSetup] Starting with args: ${JSON.stringify(args, null, 2)}`
182+
);
149183

150184
const { address } = args;
151185

186+
logger.debug(`[finalizeAccountSetup] Setting current account: ${address}`);
152187
useAccountsStore.getState().setCurrentAccount(address, false);
153188

154-
getSettingsStore(address)
155-
.getState()
156-
.setEphemeralAccount("isEphemeral" in args && args.isEphemeral);
189+
const isEphemeral = "isEphemeral" in args && args.isEphemeral;
190+
logger.debug(
191+
`[finalizeAccountSetup] Setting ephemeral account status: ${isEphemeral}`
192+
);
193+
getSettingsStore(address).getState().setEphemeralAccount(isEphemeral);
157194

158195
if ("pkPath" in args) {
196+
logger.debug(
197+
`[finalizeAccountSetup] Setting private key path: ${args.pkPath}`
198+
);
159199
getWalletStore(address).getState().setPrivateKeyPath(args.pkPath);
160200
}
161201

202+
logger.debug("[finalizeAccountSetup] Prefetching inbox ID");
162203
await prefetchInboxIdQuery({ account: address });
163204

205+
logger.debug("[finalizeAccountSetup] Getting XMTP client");
164206
getXmtpClient({ address });
165207

166-
logger.debug("Account setup finalized");
208+
logger.debug("[finalizeAccountSetup] Account setup completed");
167209
}

containers/GroupScreenImage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ type GroupScreenImageProps = {
2222
};
2323

2424
export const GroupScreenImage: FC<GroupScreenImageProps> = ({ topic }) => {
25-
const currentAccount = useCurrentAccount() as string;
25+
const currentAccount = useCurrentAccount()!;
2626
const { groupPhoto, setGroupPhoto } = useGroupPhoto(topic);
2727
const { permissions } = useGroupPermissions(topic);
2828
const { members } = useGroupMembers(topic);

0 commit comments

Comments
 (0)