Skip to content

Commit

Permalink
feat: store wallet pk as custom prop
Browse files Browse the repository at this point in the history
  • Loading branch information
chambaz committed Sep 10, 2024
1 parent 1083822 commit 7bdd91f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
8 changes: 7 additions & 1 deletion apps/marginfi-v2-trading/src/context/TradeProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,14 @@ export const TradePovider: React.FC<{
trackReferral(referralCode, wallet.publicKey.toBase58());

if (!isLoggedIn && wallet.publicKey) {
const walletAddress = wallet.publicKey.toBase58();
setIsLoggedIn(true);
identify(wallet.publicKey.toBase58());

if (!walletAddress) return;

identify(walletAddress, {
wallet: walletAddress,
});
}
}, [router.asPath, wallet, connected, isLoggedIn]);

Expand Down
6 changes: 5 additions & 1 deletion apps/marginfi-v2-ui/src/context/MrgnlendProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ export const MrgnlendProvider: React.FC<{

// identify user if logged in
React.useEffect(() => {
identify(wallet.publicKey.toBase58());
const walletAddress = wallet.publicKey?.toBase58();
if (!walletAddress) return;
identify(walletAddress, {
wallet: walletAddress,
});
}, [wallet.publicKey]);

// if account set in query param then store inn local storage and remove from url
Expand Down

0 comments on commit 7bdd91f

Please sign in to comment.