Skip to content

Commit

Permalink
fix: ensure wallet creation completes before creating alias (#1640)
Browse files Browse the repository at this point in the history
* fix: ensure wallet creation completes before sending analytics

* test: e2e - re-enable test after fix

---------

Co-authored-by: Lukasz Jagiela <[email protected]>
  • Loading branch information
greatertomi and ljagiela authored Jan 15, 2025
1 parent f936835 commit 278d413
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export const RestoreWalletProvider = ({ children }: Props): React.ReactElement =
const finalizeWalletRestoration = useCallback(
async (params: Partial<CreateWalletParams>) => {
const { source, wallet } = await createWallet(params);
void sendPostWalletAddAnalytics({
await sendPostWalletAddAnalytics({
extendedAccountPublicKey: source.account.extendedAccountPublicKey,
postHogActionHdWallet: postHogActions.restore.HD_WALLET,
postHogActionWalletAdded: postHogActions.restore.WALLET_ADDED,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ export const useHotWalletCreation = ({ initialMnemonic }: UseSoftwareWalletCreat
})();
}, [createWalletData.name, walletManager.walletRepository, setCreateWalletData]);

const createWallet = (newData: Partial<CreateWalletParams>) =>
walletManager.createWallet({
const createWallet = async (newData: Partial<CreateWalletParams>) =>
await walletManager.createWallet({
...createWalletData,
...newData
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ Feature: Analytics - Posthog - Onboarding - Extended View
And I validate latest analytics single event "onboarding | restore wallet revamp | enter your recovery phrase | next | click"
When I enter wallet name: "ValidName", password: "N_8J@bne87A" and password confirmation: "N_8J@bne87A"
And I click "Enter wallet" button
Then I validate latest analytics single event "onboarding | restore wallet revamp | let's set up your new wallet | enter wallet | click"
# And "$create_alias" PostHog event was sent // TODO: uncomment when LW-12025 is fixed
# And I validate that alias event has assigned same user id "5b3ca1f1f7a14aad1e79f46213e2777d" in posthog
Then I validate latest analytics single event "onboarding | restore wallet revamp | added"
And "$create_alias" PostHog event was sent
And I validate that alias event has assigned same user id "9646a33207b90ae60ae83770aaa82597" in posthog

@LW-7365
Scenario: Analytics - Onboarding new wallet events
Expand Down

0 comments on commit 278d413

Please sign in to comment.