@b3dotfun/sdk 0.0.35-alpha.2 → 0.0.35-alpha.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/dist/cjs/global-account/bsmnt.d.ts +2 -0
  2. package/dist/cjs/global-account/bsmnt.js +42 -1
  3. package/dist/cjs/global-account/react/components/AvatarCreator/AvatarCreator.d.ts +6 -0
  4. package/dist/cjs/global-account/react/components/AvatarCreator/AvatarCreator.js +55 -0
  5. package/dist/cjs/global-account/react/components/AvatarEditor/AvatarEditor.d.ts +6 -0
  6. package/dist/cjs/global-account/react/components/AvatarEditor/AvatarEditor.js +108 -0
  7. package/dist/cjs/global-account/react/components/B3DynamicModal.js +9 -1
  8. package/dist/cjs/global-account/react/components/ManageAccount/BalanceContent.d.ts +3 -1
  9. package/dist/cjs/global-account/react/components/ManageAccount/BalanceContent.js +19 -5
  10. package/dist/cjs/global-account/react/components/ManageAccount/ManageAccount.d.ts +3 -1
  11. package/dist/cjs/global-account/react/components/ManageAccount/ManageAccount.js +6 -6
  12. package/dist/cjs/global-account/react/hooks/useAccountWallet.js +3 -2
  13. package/dist/cjs/global-account/react/hooks/useAuthentication.js +7 -0
  14. package/dist/cjs/global-account/react/hooks/useProfile.d.ts +1 -1
  15. package/dist/cjs/global-account/react/hooks/useRPMToken.d.ts +7 -0
  16. package/dist/cjs/global-account/react/hooks/useRPMToken.js +11 -0
  17. package/dist/cjs/global-account/react/stores/useModalStore.d.ts +11 -1
  18. package/dist/cjs/global-account/react/utils/updateAvatar.d.ts +4 -0
  19. package/dist/cjs/global-account/react/utils/updateAvatar.js +54 -0
  20. package/dist/esm/global-account/bsmnt.d.ts +2 -0
  21. package/dist/esm/global-account/bsmnt.js +39 -0
  22. package/dist/esm/global-account/react/components/AvatarCreator/AvatarCreator.d.ts +6 -0
  23. package/dist/esm/global-account/react/components/AvatarCreator/AvatarCreator.js +52 -0
  24. package/dist/esm/global-account/react/components/AvatarEditor/AvatarEditor.d.ts +6 -0
  25. package/dist/esm/global-account/react/components/AvatarEditor/AvatarEditor.js +102 -0
  26. package/dist/esm/global-account/react/components/B3DynamicModal.js +9 -1
  27. package/dist/esm/global-account/react/components/ManageAccount/BalanceContent.d.ts +3 -1
  28. package/dist/esm/global-account/react/components/ManageAccount/BalanceContent.js +20 -6
  29. package/dist/esm/global-account/react/components/ManageAccount/ManageAccount.d.ts +3 -1
  30. package/dist/esm/global-account/react/components/ManageAccount/ManageAccount.js +6 -6
  31. package/dist/esm/global-account/react/hooks/useAccountWallet.js +3 -2
  32. package/dist/esm/global-account/react/hooks/useAuthentication.js +7 -0
  33. package/dist/esm/global-account/react/hooks/useProfile.d.ts +1 -1
  34. package/dist/esm/global-account/react/hooks/useRPMToken.d.ts +7 -0
  35. package/dist/esm/global-account/react/hooks/useRPMToken.js +8 -0
  36. package/dist/esm/global-account/react/stores/useModalStore.d.ts +11 -1
  37. package/dist/esm/global-account/react/utils/updateAvatar.d.ts +4 -0
  38. package/dist/esm/global-account/react/utils/updateAvatar.js +18 -0
  39. package/dist/styles/index.css +1 -1
  40. package/dist/types/global-account/bsmnt.d.ts +2 -0
  41. package/dist/types/global-account/react/components/AvatarCreator/AvatarCreator.d.ts +6 -0
  42. package/dist/types/global-account/react/components/AvatarEditor/AvatarEditor.d.ts +6 -0
  43. package/dist/types/global-account/react/components/ManageAccount/BalanceContent.d.ts +3 -1
  44. package/dist/types/global-account/react/components/ManageAccount/ManageAccount.d.ts +3 -1
  45. package/dist/types/global-account/react/hooks/useProfile.d.ts +1 -1
  46. package/dist/types/global-account/react/hooks/useRPMToken.d.ts +7 -0
  47. package/dist/types/global-account/react/stores/useModalStore.d.ts +11 -1
  48. package/dist/types/global-account/react/utils/updateAvatar.d.ts +4 -0
  49. package/package.json +6 -5
  50. package/src/global-account/bsmnt.ts +47 -0
  51. package/src/global-account/react/components/AvatarCreator/AvatarCreator.tsx +90 -0
  52. package/src/global-account/react/components/AvatarEditor/AvatarEditor.tsx +233 -0
  53. package/src/global-account/react/components/B3DynamicModal.tsx +27 -2
  54. package/src/global-account/react/components/ManageAccount/BalanceContent.tsx +63 -35
  55. package/src/global-account/react/components/ManageAccount/ManageAccount.tsx +106 -78
  56. package/src/global-account/react/hooks/useAccountWallet.tsx +3 -2
  57. package/src/global-account/react/hooks/useAuthentication.ts +9 -0
  58. package/src/global-account/react/hooks/useProfile.ts +1 -1
  59. package/src/global-account/react/hooks/useRPMToken.ts +17 -0
  60. package/src/global-account/react/stores/useModalStore.ts +13 -1
  61. package/src/global-account/react/utils/updateAvatar.ts +21 -0
@@ -42,6 +42,8 @@ interface ManageAccountProps {
42
42
  chain: Chain;
43
43
  partnerId: string;
44
44
  containerClassName?: string;
45
+ showSwap?: boolean;
46
+ showDeposit?: boolean;
45
47
  }
46
48
 
47
49
  export function ManageAccount({
@@ -50,6 +52,8 @@ export function ManageAccount({
50
52
  onDeposit: _onDeposit,
51
53
  chain,
52
54
  partnerId,
55
+ showSwap,
56
+ showDeposit,
53
57
  }: ManageAccountProps) {
54
58
  const [revokingSignerId, setRevokingSignerId] = useState<string | null>(null);
55
59
  const account = useActiveAccount();
@@ -89,7 +93,6 @@ export function ManageAccount({
89
93
  setB3ModalOpen(false);
90
94
  setLogoutLoading(false);
91
95
  };
92
-
93
96
  const AppsContent = () => (
94
97
  <div className="space-y-4">
95
98
  {signers?.map((signer: TWSignerWithMetadata) => (
@@ -234,53 +237,64 @@ export function ManageAccount({
234
237
  };
235
238
 
236
239
  return (
237
- <div className="space-y-8">
240
+ <div className="linked-accounts-settings space-y-8">
238
241
  {/* Linked Accounts Section */}
239
- <div className="space-y-4">
240
- <div className="flex items-center justify-between">
241
- <h3 className="text-b3-grey font-neue-montreal-semibold text-xl">Linked Accounts</h3>
242
+ <div className="linked-accounts-section space-y-4">
243
+ <div className="linked-accounts-header flex items-center justify-between">
244
+ <h3 className="text-b3-grey font-neue-montreal-semibold linked-accounts-settings-title text-xl">
245
+ Linked Accounts
246
+ </h3>
242
247
  <Button
243
- className="bg-b3-primary-wash hover:bg-b3-primary-wash/70 flex items-center gap-2 rounded-full px-4 py-2"
248
+ className="linked-accounts-settings-button linked-accounts-link-button bg-b3-primary-wash hover:bg-b3-primary-wash/70 flex items-center gap-2 rounded-full px-4 py-2"
244
249
  onClick={handleOpenLinkModal}
245
250
  disabled={isLinking}
246
251
  >
247
252
  {isLinking ? (
248
- <Loader2 className="text-b3-primary-blue animate-spin" size={16} />
253
+ <Loader2 className="linked-accounts-link-loading text-b3-primary-blue animate-spin" size={16} />
249
254
  ) : (
250
- <LinkIcon size={16} className="text-b3-primary-blue" />
255
+ <LinkIcon size={16} className="linked-accounts-link-icon text-b3-primary-blue" />
251
256
  )}
252
- <span className="text-b3-grey font-neue-montreal-semibold">
257
+ <span className="linked-accounts-link-text text-b3-grey font-neue-montreal-semibold">
253
258
  {isLinking ? "Linking..." : "Link New Account"}
254
259
  </span>
255
260
  </Button>
256
261
  </div>
257
262
 
258
263
  {isLoadingProfiles ? (
259
- <div className="flex justify-center py-8">
264
+ <div className="linked-accounts-loading flex justify-center py-8">
260
265
  <Loader2 className="text-b3-grey animate-spin" />
261
266
  </div>
262
267
  ) : profiles.length > 0 ? (
263
- <div className="space-y-4">
268
+ <div className="linked-accounts-list space-y-4">
264
269
  {profiles.map(profile => (
265
- <div key={profile.title} className="bg-b3-line flex items-center justify-between rounded-xl p-4">
266
- <div className="flex items-center gap-3">
270
+ <div
271
+ key={profile.title}
272
+ className="linked-account-item bg-b3-line flex items-center justify-between rounded-xl p-4"
273
+ >
274
+ <div className="linked-account-info flex items-center gap-3">
267
275
  {profile.imageUrl ? (
268
- <img src={profile.imageUrl} alt={profile.title} className="size-10 rounded-full" />
276
+ <img
277
+ src={profile.imageUrl}
278
+ alt={profile.title}
279
+ className="linked-account-avatar linked-account-avatar-image size-10 rounded-full"
280
+ />
269
281
  ) : (
270
- <div className="bg-b3-primary-wash flex h-10 w-10 items-center justify-center rounded-full">
271
- <span className="text-b3-grey font-neue-montreal-semibold text-sm uppercase">
282
+ <div className="linked-account-avatar linked-account-avatar-placeholder bg-b3-primary-wash flex h-10 w-10 items-center justify-center rounded-full">
283
+ <span className="linked-account-initial text-b3-grey font-neue-montreal-semibold text-sm uppercase">
272
284
  {profile.initial}
273
285
  </span>
274
286
  </div>
275
287
  )}
276
- <div>
277
- <div className="flex items-center gap-2">
278
- <span className="text-b3-grey font-neue-montreal-semibold">{profile.title}</span>
279
- <span className="text-b3-foreground-muted font-neue-montreal-medium bg-b3-primary-wash rounded px-2 py-0.5 text-xs">
288
+ <div className="linked-account-details">
289
+ <div className="linked-account-title-row flex items-center gap-2">
290
+ <span className="linked-account-title text-b3-grey font-neue-montreal-semibold">
291
+ {profile.title}
292
+ </span>
293
+ <span className="linked-account-type text-b3-foreground-muted font-neue-montreal-medium bg-b3-primary-wash rounded px-2 py-0.5 text-xs">
280
294
  {profile.type.toUpperCase()}
281
295
  </span>
282
296
  </div>
283
- <div className="text-b3-foreground-muted font-neue-montreal-medium text-sm">
297
+ <div className="linked-account-subtitle text-b3-foreground-muted font-neue-montreal-medium text-sm">
284
298
  {profile.subtitle}
285
299
  </div>
286
300
  </div>
@@ -288,69 +302,79 @@ export function ManageAccount({
288
302
  <Button
289
303
  variant="ghost"
290
304
  size="icon"
291
- className="text-b3-grey hover:text-b3-negative"
305
+ className="linked-account-unlink-button text-b3-grey hover:text-b3-negative"
292
306
  onClick={() => handleUnlink(profile)}
293
307
  disabled={unlinkingAccountId === profile.title || isUnlinking}
294
308
  >
295
309
  {unlinkingAccountId === profile.title || isUnlinking ? (
296
- <Loader2 className="animate-spin" />
310
+ <Loader2 className="linked-account-unlink-loading animate-spin" />
297
311
  ) : (
298
- <UnlinkIcon size={16} />
312
+ <UnlinkIcon size={16} className="linked-account-unlink-icon" />
299
313
  )}
300
314
  </Button>
301
315
  </div>
302
316
  ))}
303
317
  </div>
304
318
  ) : (
305
- <div className="text-b3-foreground-muted py-8 text-center">No linked accounts found</div>
319
+ <div className="linked-accounts-empty text-b3-foreground-muted py-8 text-center">
320
+ No linked accounts found
321
+ </div>
306
322
  )}
307
323
  </div>
308
324
 
309
325
  {showReferralInfo && (
310
326
  /* Referral Section */
311
- <div className="space-y-4">
312
- <h3 className="text-b3-grey font-neue-montreal-semibold text-xl">Referrals</h3>
327
+ <div className="referrals-section space-y-4">
328
+ <h3 className="referrals-title text-b3-grey font-neue-montreal-semibold text-xl">Referrals</h3>
313
329
 
314
330
  {/* Referral Code */}
315
- <div className="bg-b3-line rounded-xl p-4">
331
+ <div className="referral-code-container bg-b3-line rounded-xl p-4">
316
332
  {isEditingCode && (
317
- <div>
318
- <div className="text-b3-grey font-neue-montreal-semibold">Your Referral Code</div>
319
- <div className="text-b3-foreground-muted font-neue-montreal-medium text-sm">
333
+ <div className="referral-code-header-editing">
334
+ <div className="referral-code-title text-b3-grey font-neue-montreal-semibold">Your Referral Code</div>
335
+ <div className="referral-code-description text-b3-foreground-muted font-neue-montreal-medium text-sm">
320
336
  Share this code with friends to earn rewards
321
337
  </div>
322
338
  </div>
323
339
  )}
324
- <div className="flex items-center justify-between">
340
+ <div className="referral-code-content flex items-center justify-between">
325
341
  {!isEditingCode && (
326
- <div>
327
- <div className="text-b3-grey font-neue-montreal-semibold">Your Referral Code</div>
328
- <div className="text-b3-foreground-muted font-neue-montreal-medium text-sm">
342
+ <div className="referral-code-header">
343
+ <div className="referral-code-title text-b3-grey font-neue-montreal-semibold">
344
+ Your Referral Code
345
+ </div>
346
+ <div className="referral-code-description text-b3-foreground-muted font-neue-montreal-medium text-sm">
329
347
  Share this code with friends to earn rewards
330
348
  </div>
331
349
  </div>
332
350
  )}
333
- <div className="flex items-center gap-2">
351
+ <div className="referral-code-actions flex items-center gap-2">
334
352
  {isEditingCode ? (
335
- <div className="flex items-center gap-2">
353
+ <div className="referral-code-edit-form flex items-center gap-2">
336
354
  <input
337
355
  type="text"
338
356
  value={newReferralCode}
339
357
  onChange={e => setNewReferralCode(e.target.value)}
340
- className="rounded-lg border border-gray-200 bg-white px-3 py-1.5 text-sm"
358
+ className="referral-code-input rounded-lg border border-gray-200 bg-white px-3 py-1.5 text-sm"
341
359
  placeholder="Enter new code"
342
360
  ref={referallCodeRef}
343
361
  />
344
362
  <Button
345
363
  size="sm"
364
+ className="referral-code-save-button"
346
365
  onClick={handleUpdateReferralCode}
347
366
  disabled={isUpdatingCode || !newReferralCode}
348
367
  >
349
- {isUpdatingCode ? <Loader2 className="h-4 w-4 animate-spin" /> : "Save"}
368
+ {isUpdatingCode ? (
369
+ <Loader2 className="referral-code-save-loading h-4 w-4 animate-spin" />
370
+ ) : (
371
+ "Save"
372
+ )}
350
373
  </Button>
351
374
  <Button
352
375
  size="sm"
353
376
  variant="ghost"
377
+ className="referral-code-cancel-button"
354
378
  onClick={() => {
355
379
  setIsEditingCode(false);
356
380
  setNewReferralCode("");
@@ -361,15 +385,21 @@ export function ManageAccount({
361
385
  </div>
362
386
  ) : (
363
387
  <>
364
- <div className="rounded-lg border border-gray-200 bg-white px-3 py-1.5 text-sm">
388
+ <div className="referral-code-display rounded-lg border border-gray-200 bg-white px-3 py-1.5 text-sm">
365
389
  {currentReferralCode}
366
390
  </div>
367
- <Button size="icon" variant="ghost" onClick={handleCopyCode}>
368
- <Copy className="h-4 w-4" />
391
+ <Button
392
+ size="icon"
393
+ variant="ghost"
394
+ className="referral-code-copy-button"
395
+ onClick={handleCopyCode}
396
+ >
397
+ <Copy className="referral-code-copy-icon h-4 w-4" />
369
398
  </Button>
370
399
  <Button
371
400
  size="icon"
372
401
  variant="ghost"
402
+ className="referral-code-edit-button"
373
403
  onClick={() => {
374
404
  setIsEditingCode(true);
375
405
  setTimeout(() => {
@@ -377,7 +407,7 @@ export function ManageAccount({
377
407
  }, 100);
378
408
  }}
379
409
  >
380
- <Pencil className="h-4 w-4" />
410
+ <Pencil className="referral-code-edit-icon h-4 w-4" />
381
411
  </Button>
382
412
  </>
383
413
  )}
@@ -386,67 +416,65 @@ export function ManageAccount({
386
416
  </div>
387
417
 
388
418
  {/* Referred Users */}
389
- <div className="bg-b3-line rounded-xl p-4">
390
- <div className="text-b3-grey font-neue-montreal-semibold mb-4">Referred Users</div>
419
+ <div className="referred-users-container bg-b3-line rounded-xl p-4">
420
+ <div className="referred-users-title text-b3-grey font-neue-montreal-semibold mb-4">Referred Users</div>
391
421
  {isLoadingReferrals ? (
392
- <div className="flex justify-center py-4">
422
+ <div className="referred-users-loading flex justify-center py-4">
393
423
  <Loader2 className="h-6 w-6 animate-spin text-gray-400" />
394
424
  </div>
395
425
  ) : referrals?.data?.length ? (
396
- <div className="space-y-3">
426
+ <div className="referred-users-list space-y-3">
397
427
  {referrals.data.map((referral: Referrals) => (
398
428
  <div
399
429
  key={String(referral._id)}
400
- className="flex items-center justify-between rounded-lg bg-white p-3"
430
+ className="referred-user-item flex items-center justify-between rounded-lg bg-white p-3"
401
431
  >
402
- <div className="text-sm font-medium">{referral.referreeId}</div>
403
- <div className="text-sm text-gray-500">{new Date(referral.createdAt).toLocaleDateString()}</div>
432
+ <div className="referred-user-id text-sm font-medium">{referral.referreeId}</div>
433
+ <div className="referred-user-date text-sm text-gray-500">
434
+ {new Date(referral.createdAt).toLocaleDateString()}
435
+ </div>
404
436
  </div>
405
437
  ))}
406
438
  </div>
407
439
  ) : (
408
- <div className="py-4 text-center text-gray-500">No referred users yet</div>
440
+ <div className="referred-users-empty py-4 text-center text-gray-500">No referred users yet</div>
409
441
  )}
410
442
  </div>
411
443
  </div>
412
444
  )}
413
445
 
414
446
  {/* Additional Settings Sections */}
415
- <div className="space-y-4">
416
- <h3 className="text-b3-grey font-neue-montreal-semibold text-xl">Account Preferences</h3>
417
- <div className="bg-b3-line rounded-xl p-4">
418
- <div className="flex items-center justify-between">
419
- <div>
420
- <div className="text-b3-grey font-neue-montreal-semibold">Dark Mode</div>
421
- <div className="text-b3-foreground-muted font-neue-montreal-medium text-sm">
447
+ <div className="account-preferences-section space-y-4">
448
+ <h3 className="account-preferences-title text-b3-grey font-neue-montreal-semibold text-xl">
449
+ Account Preferences
450
+ </h3>
451
+ <div className="account-preferences-container bg-b3-line rounded-xl p-4">
452
+ <div className="account-preference-item flex items-center justify-between">
453
+ <div className="account-preference-info">
454
+ <div className="account-preference-title text-b3-grey font-neue-montreal-semibold">Dark Mode</div>
455
+ <div className="account-preference-description text-b3-foreground-muted font-neue-montreal-medium text-sm">
422
456
  Switch between light and dark theme
423
457
  </div>
424
458
  </div>
425
459
  {/* Theme toggle placeholder - can be implemented later */}
426
- <div className="bg-b3-primary-wash h-6 w-12 rounded-full"></div>
460
+ <div className="account-preference-toggle theme-toggle-placeholder bg-b3-primary-wash h-6 w-12 rounded-full"></div>
427
461
  </div>
428
462
  </div>
429
463
  </div>
430
464
 
431
- {/* Global Account Info */}
432
- <div className="border-b3-line flex items-center justify-between rounded-2xl border p-4">
433
- <div>
434
- <div className="flex items-center gap-2">
435
- <img src="https://cdn.b3.fun/b3_logo.svg" alt="B3" className="h-4" />
436
- <h3 className="font-neue-montreal-semibold text-b3-grey">Global Account</h3>
437
- </div>
438
-
439
- <p className="text-b3-foreground-muted font-neue-montreal-medium mt-2 text-sm">
440
- Your universal account for all B3 apps
441
- </p>
465
+ <button
466
+ className="logout-button logout-section border-b3-line hover:bg-b3-line relative flex w-full items-center justify-center rounded-2xl border p-4 transition-colors"
467
+ onClick={onLogoutEnhanced}
468
+ >
469
+ <span className="logout-text font-neue-montreal-semibold text-b3-grey">Sign out</span>
470
+ <div className="logout-icon-container absolute right-4">
471
+ {logoutLoading ? (
472
+ <Loader2 className="logout-loading animate-spin" size={16} />
473
+ ) : (
474
+ <SignOutIcon size={16} className="logout-icon text-b3-grey" />
475
+ )}
442
476
  </div>
443
- <button
444
- className="text-b3-grey hover:text-b3-grey/80 hover:bg-b3-line border-b3-line flex size-12 items-center justify-center rounded-full border"
445
- onClick={onLogoutEnhanced}
446
- >
447
- {logoutLoading ? <Loader2 className="animate-spin" /> : <SignOutIcon size={16} className="text-b3-grey" />}
448
- </button>
449
- </div>
477
+ </button>
450
478
  </div>
451
479
  );
452
480
  };
@@ -521,7 +549,7 @@ export function ManageAccount({
521
549
  </div>
522
550
 
523
551
  <TabsContentPrimitive value="overview" className="px-4 pb-4 pt-2">
524
- <BalanceContent onLogout={onLogout} partnerId={partnerId} />
552
+ <BalanceContent onLogout={onLogout} partnerId={partnerId} showDeposit={showDeposit} showSwap={showSwap} />
525
553
  </TabsContentPrimitive>
526
554
 
527
555
  <TabsContentPrimitive value="tokens" className="px-4 pb-4 pt-2">
@@ -1,6 +1,7 @@
1
1
  import { useB3, useProfile } from "@b3dotfun/sdk/global-account/react";
2
2
  import { ecosystemWalletId } from "@b3dotfun/sdk/shared/constants";
3
3
  import { debugB3React } from "@b3dotfun/sdk/shared/utils/debug";
4
+ import { getIpfsUrl } from "@b3dotfun/sdk/shared/utils/ipfs";
4
5
  import { useEffect, useMemo, useState } from "react";
5
6
  import { getLastAuthProvider, useActiveWallet, useConnectedWallets, useWalletImage } from "thirdweb/react";
6
7
  import { Account, Wallet } from "thirdweb/wallets";
@@ -43,7 +44,7 @@ export function useAccountWallet(): {
43
44
  eoaWalletIcon?: string;
44
45
  smartWalletIcon?: string;
45
46
  } {
46
- const { account } = useB3();
47
+ const { account, user } = useB3();
47
48
 
48
49
  const activeWallet = useActiveWallet();
49
50
  const connectedWallets = useConnectedWallets();
@@ -72,7 +73,7 @@ export function useAccountWallet(): {
72
73
 
73
74
  const { data: profileData } = useProfile({ address: account?.address });
74
75
  const ensName = profileData?.displayName?.replace(/\.b3\.fun/g, "");
75
- const avatarUrl = profileData?.avatar;
76
+ const avatarUrl = user?.avatar ? getIpfsUrl(user?.avatar) : profileData?.avatar;
76
77
 
77
78
  const res = useMemo(
78
79
  () => ({
@@ -1,4 +1,5 @@
1
1
  import app from "@b3dotfun/sdk/global-account/app";
2
+ import { authenticateWithB3JWT } from "@b3dotfun/sdk/global-account/bsmnt";
2
3
  import { useAuthStore, useB3 } from "@b3dotfun/sdk/global-account/react";
3
4
  import { ecosystemWalletId } from "@b3dotfun/sdk/shared/constants";
4
5
  import { b3MainnetThirdWeb } from "@b3dotfun/sdk/shared/constants/chains/supported";
@@ -67,6 +68,10 @@ export function useAuthentication(partnerId: string, loginWithSiwe?: boolean) {
67
68
  setIsAuthenticated(true);
68
69
  setIsAuthenticatingV2(false);
69
70
  debug("Re-authenticated successfully", { userAuth });
71
+
72
+ // Authenticate on BSMNT with B3 JWT
73
+ const b3Jwt = await authenticateWithB3JWT(userAuth.accessToken);
74
+ console.log("@@b3Jwt", b3Jwt);
70
75
  } catch (error) {
71
76
  // If re-authentication fails, try fresh authentication
72
77
  debug("Re-authentication failed, attempting fresh authentication");
@@ -75,6 +80,10 @@ export function useAuthentication(partnerId: string, loginWithSiwe?: boolean) {
75
80
  setIsAuthenticated(true);
76
81
  setIsAuthenticatingV2(false);
77
82
  debug("Fresh authentication successful", { userAuth });
83
+
84
+ // Authenticate on BSMNT with B3 JWT
85
+ const b3Jwt = await authenticateWithB3JWT(userAuth.accessToken);
86
+ console.log("@@b3Jwt", b3Jwt);
78
87
  }
79
88
  } catch (error) {
80
89
  debug("Auto-connect authentication failed", { error });
@@ -13,7 +13,7 @@ export interface Profile {
13
13
  export interface CombinedProfile {
14
14
  name: string | null;
15
15
  address: string | null;
16
- avatar: string | null;
16
+ avatar: string | undefined;
17
17
  bio: string | null;
18
18
  displayName: string | null;
19
19
  profiles: Profile[];
@@ -0,0 +1,17 @@
1
+ "use client";
2
+
3
+ import { useQueryBSMNT } from "@b3dotfun/sdk/global-account/react/hooks/useQueryBSMNT";
4
+
5
+ export function useRPMToken() {
6
+ const {
7
+ data,
8
+ runQuery: refetch,
9
+ isLoading,
10
+ error: isError,
11
+ } = useQueryBSMNT("profiles", "getReadyPlayerMeToken", undefined, true);
12
+
13
+ const token = data?.token || "";
14
+ const accountId = data?.accountId || "";
15
+
16
+ return { token, accountId, refetch, isLoading, isError };
17
+ }
@@ -89,6 +89,10 @@ export interface ManageAccountModalProps extends BaseModalProps {
89
89
  setActiveTab?: (tab: "overview" | "tokens" | "nfts" | "apps" | "settings") => void;
90
90
  /** Whether to show the referral information */
91
91
  showReferralInfo?: boolean;
92
+ /** Whether to show the swap button */
93
+ showSwap?: boolean;
94
+ /** Whether to show the deposit button */
95
+ showDeposit?: boolean;
92
96
  }
93
97
 
94
98
  /**
@@ -305,6 +309,13 @@ export interface AnySpendDepositHypeProps extends BaseModalProps {
305
309
  onSuccess?: (amount?: string) => void;
306
310
  }
307
311
 
312
+ export interface AvatarEditorModalProps extends BaseModalProps {
313
+ /** Modal type identifier */
314
+ type: "avatarEditor";
315
+ /** Callback function called when avatar is successfully set */
316
+ onSuccess?: () => void;
317
+ }
318
+
308
319
  /**
309
320
  * Union type of all possible modal content types
310
321
  */
@@ -323,7 +334,8 @@ export type ModalContentType =
323
334
  | AnySpendSignatureMintProps
324
335
  | AnySpendBondKitProps
325
336
  | LinkAccountModalProps
326
- | AnySpendDepositHypeProps;
337
+ | AnySpendDepositHypeProps
338
+ | AvatarEditorModalProps;
327
339
  // Add other modal types here like: | OtherModalProps | AnotherModalProps
328
340
 
329
341
  /**
@@ -0,0 +1,21 @@
1
+ import app, { extractAvatarIdFromUrl } from "@b3dotfun/sdk/global-account/bsmnt";
2
+ import { debugB3React } from "@b3dotfun/sdk/shared/utils/debug";
3
+
4
+ const debug = debugB3React("updateAvatar");
5
+
6
+ export async function updateAvatar(avatar: string) {
7
+ try {
8
+ // Extract avatar ID from URL
9
+ const avatarID = extractAvatarIdFromUrl(avatar);
10
+
11
+ if (!avatarID) {
12
+ throw new Error("Invalid avatar URL");
13
+ }
14
+
15
+ // Set the avatar in the profiles service
16
+ return await app.service("profiles").setAvatar({ avatarUrl: String(avatar), avatarID: String(avatarID) }, {});
17
+ } catch (error) {
18
+ debug("Failed to update avatar:", error);
19
+ throw error; // Re-throw to handle in component
20
+ }
21
+ }