@b3dotfun/sdk 0.0.40-alpha.4 → 0.0.40-alpha.6

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 (38) hide show
  1. package/dist/cjs/bondkit/bondkitToken.d.ts +36 -1
  2. package/dist/cjs/bondkit/bondkitToken.js +266 -0
  3. package/dist/cjs/bondkit/constants.d.ts +4 -0
  4. package/dist/cjs/bondkit/constants.js +6 -1
  5. package/dist/cjs/bondkit/index.d.ts +1 -0
  6. package/dist/cjs/bondkit/index.js +4 -1
  7. package/dist/cjs/bondkit/swapService.d.ts +43 -0
  8. package/dist/cjs/bondkit/swapService.js +373 -0
  9. package/dist/cjs/bondkit/types.d.ts +10 -4
  10. package/dist/cjs/bondkit/types.js +4 -5
  11. package/dist/cjs/global-account/react/components/LinkAccount/LinkAccount.js +63 -3
  12. package/dist/cjs/global-account/react/components/ManageAccount/ManageAccount.js +35 -2
  13. package/dist/esm/bondkit/bondkitToken.d.ts +36 -1
  14. package/dist/esm/bondkit/bondkitToken.js +266 -0
  15. package/dist/esm/bondkit/constants.d.ts +4 -0
  16. package/dist/esm/bondkit/constants.js +5 -0
  17. package/dist/esm/bondkit/index.d.ts +1 -0
  18. package/dist/esm/bondkit/index.js +2 -0
  19. package/dist/esm/bondkit/swapService.d.ts +43 -0
  20. package/dist/esm/bondkit/swapService.js +369 -0
  21. package/dist/esm/bondkit/types.d.ts +10 -4
  22. package/dist/esm/bondkit/types.js +4 -5
  23. package/dist/esm/global-account/react/components/LinkAccount/LinkAccount.js +65 -5
  24. package/dist/esm/global-account/react/components/ManageAccount/ManageAccount.js +35 -2
  25. package/dist/styles/index.css +1 -1
  26. package/dist/types/bondkit/bondkitToken.d.ts +36 -1
  27. package/dist/types/bondkit/constants.d.ts +4 -0
  28. package/dist/types/bondkit/index.d.ts +1 -0
  29. package/dist/types/bondkit/swapService.d.ts +43 -0
  30. package/dist/types/bondkit/types.d.ts +10 -4
  31. package/package.json +1 -1
  32. package/src/bondkit/bondkitToken.ts +321 -1
  33. package/src/bondkit/constants.ts +7 -0
  34. package/src/bondkit/index.ts +3 -0
  35. package/src/bondkit/swapService.ts +461 -0
  36. package/src/bondkit/types.ts +12 -5
  37. package/src/global-account/react/components/LinkAccount/LinkAccount.tsx +106 -32
  38. package/src/global-account/react/components/ManageAccount/ManageAccount.tsx +60 -5
@@ -18,6 +18,7 @@ import {
18
18
  import { SignOutIcon } from "@b3dotfun/sdk/global-account/react/components/icons/SignOutIcon";
19
19
  import { formatNumber } from "@b3dotfun/sdk/shared/utils/formatNumber";
20
20
  import { client } from "@b3dotfun/sdk/shared/utils/thirdweb";
21
+ import { truncateAddress } from "@b3dotfun/sdk/shared/utils/truncateAddress";
21
22
  import { BarChart3, Coins, Copy, Image, LinkIcon, Loader2, Pencil, Settings, UnlinkIcon } from "lucide-react";
22
23
  import { useRef, useState } from "react";
23
24
  import { toast } from "sonner";
@@ -29,6 +30,24 @@ import { getProfileDisplayInfo } from "../../utils/profileDisplay";
29
30
  import { AccountAssets } from "../AccountAssets/AccountAssets";
30
31
  import { ContentTokens } from "./ContentTokens";
31
32
 
33
+ // Helper function to check if a string is a wallet address and format it
34
+ const formatProfileTitle = (title: string): { displayTitle: string; isAddress: boolean } => {
35
+ // Check if title looks like an Ethereum address (0x followed by 40 hex characters)
36
+ const isEthereumAddress = /^0x[a-fA-F0-9]{40}$/.test(title);
37
+
38
+ if (isEthereumAddress) {
39
+ return {
40
+ displayTitle: truncateAddress(title),
41
+ isAddress: true,
42
+ };
43
+ }
44
+
45
+ return {
46
+ displayTitle: title,
47
+ isAddress: false,
48
+ };
49
+ };
50
+
32
51
  import { Referrals, Users } from "@b3dotfun/b3-api";
33
52
  import { BalanceContent } from "./BalanceContent";
34
53
 
@@ -200,7 +219,7 @@ export function ManageAccount({
200
219
  };
201
220
 
202
221
  const profiles = profilesRaw
203
- .filter((profile: any) => !["custom_auth_endpoint", "siwe"].includes(profile.type))
222
+ .filter((profile: any) => !["custom_auth_endpoint"].includes(profile.type))
204
223
  .map((profile: any) => ({
205
224
  ...getProfileDisplayInfo(profile),
206
225
  originalProfile: profile,
@@ -236,6 +255,8 @@ export function ManageAccount({
236
255
  });
237
256
  };
238
257
 
258
+ console.log("@@profiles", profiles);
259
+
239
260
  return (
240
261
  <div className="linked-accounts-settings space-y-8">
241
262
  {/* Linked Accounts Section */}
@@ -269,7 +290,7 @@ export function ManageAccount({
269
290
  {profiles.map(profile => (
270
291
  <div
271
292
  key={profile.title}
272
- className="linked-account-item bg-b3-line flex items-center justify-between rounded-xl p-4"
293
+ className="linked-account-item bg-b3-line group flex items-center justify-between rounded-xl p-4"
273
294
  >
274
295
  <div className="linked-account-info flex items-center gap-3">
275
296
  {profile.imageUrl ? (
@@ -287,9 +308,43 @@ export function ManageAccount({
287
308
  )}
288
309
  <div className="linked-account-details">
289
310
  <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>
311
+ {(() => {
312
+ const { displayTitle, isAddress } = formatProfileTitle(profile.title);
313
+
314
+ const handleCopyAddress = async (e: React.MouseEvent) => {
315
+ e.stopPropagation();
316
+ try {
317
+ await navigator.clipboard.writeText(profile.title);
318
+ toast.success("Address copied to clipboard!");
319
+ } catch (error) {
320
+ toast.error("Failed to copy address");
321
+ }
322
+ };
323
+
324
+ return (
325
+ <div className="flex items-center gap-1">
326
+ <span
327
+ className={`linked-account-title text-b3-grey font-neue-montreal-semibold ${
328
+ isAddress
329
+ ? "font-mono text-sm" // Use monospace font for addresses
330
+ : "break-words" // Use break-words for emails/names (better than break-all)
331
+ }`}
332
+ title={isAddress ? profile.title : undefined} // Show full address on hover
333
+ >
334
+ {displayTitle}
335
+ </span>
336
+ {isAddress && (
337
+ <button
338
+ onClick={handleCopyAddress}
339
+ className="linked-account-copy-button ml-1 rounded p-1 opacity-0 transition-opacity hover:bg-gray-100 group-hover:opacity-100"
340
+ title="Copy full address"
341
+ >
342
+ <Copy size={12} className="text-gray-500 hover:text-gray-700" />
343
+ </button>
344
+ )}
345
+ </div>
346
+ );
347
+ })()}
293
348
  <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">
294
349
  {profile.type.toUpperCase()}
295
350
  </span>