@b3dotfun/sdk 0.0.40 → 0.0.41

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 (151) hide show
  1. package/dist/cjs/anyspend/react/components/AnySpend.d.ts +10 -1
  2. package/dist/cjs/anyspend/react/components/AnySpend.js +7 -3
  3. package/dist/cjs/anyspend/react/components/AnyspendDepositHype.d.ts +8 -0
  4. package/dist/cjs/anyspend/react/components/AnyspendDepositHype.js +6 -3
  5. package/dist/cjs/anyspend/react/components/common/ConnectWalletPayment.js +5 -3
  6. package/dist/cjs/anyspend/react/components/common/CryptoPaySection.d.ts +4 -1
  7. package/dist/cjs/anyspend/react/components/common/CryptoPaySection.js +9 -9
  8. package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.js +80 -10
  9. package/dist/cjs/anyspend/react/components/common/CryptoReceiveSection.d.ts +2 -1
  10. package/dist/cjs/anyspend/react/components/common/CryptoReceiveSection.js +39 -37
  11. package/dist/cjs/anyspend/react/components/common/OrderDetails.js +8 -11
  12. package/dist/cjs/anyspend/react/components/common/OrderTokenAmount.d.ts +4 -1
  13. package/dist/cjs/anyspend/react/components/common/OrderTokenAmount.js +23 -9
  14. package/dist/cjs/anyspend/react/components/common/PanelOnramp.d.ts +4 -1
  15. package/dist/cjs/anyspend/react/components/common/PanelOnramp.js +7 -6
  16. package/dist/cjs/anyspend/react/components/common/PointsDetailPanel.d.ts +6 -0
  17. package/dist/cjs/anyspend/react/components/common/PointsDetailPanel.js +14 -0
  18. package/dist/cjs/anyspend/react/contexts/FeatureFlagsContext.d.ts +11 -0
  19. package/dist/cjs/anyspend/react/contexts/FeatureFlagsContext.js +21 -0
  20. package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.d.ts +4 -1
  21. package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.js +13 -5
  22. package/dist/cjs/anyspend/react/providers/AnyspendProvider.d.ts +5 -2
  23. package/dist/cjs/anyspend/react/providers/AnyspendProvider.js +5 -3
  24. package/dist/cjs/anyspend/react/providers/index.d.ts +1 -0
  25. package/dist/cjs/anyspend/react/providers/index.js +3 -0
  26. package/dist/cjs/anyspend/types/api.d.ts +10 -0
  27. package/dist/cjs/anyspend/utils/chain.js +1 -1
  28. package/dist/cjs/bondkit/bondkitToken.d.ts +37 -2
  29. package/dist/cjs/bondkit/bondkitToken.js +268 -2
  30. package/dist/cjs/bondkit/bondkitTokenFactory.d.ts +1 -1
  31. package/dist/cjs/bondkit/bondkitTokenFactory.js +2 -2
  32. package/dist/cjs/bondkit/config.d.ts +1 -1
  33. package/dist/cjs/bondkit/config.js +5 -2
  34. package/dist/cjs/bondkit/constants.d.ts +4 -0
  35. package/dist/cjs/bondkit/constants.js +6 -1
  36. package/dist/cjs/bondkit/index.d.ts +1 -0
  37. package/dist/cjs/bondkit/index.js +4 -1
  38. package/dist/cjs/bondkit/swapService.d.ts +43 -0
  39. package/dist/cjs/bondkit/swapService.js +373 -0
  40. package/dist/cjs/bondkit/types.d.ts +10 -4
  41. package/dist/cjs/bondkit/types.js +4 -5
  42. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.d.ts +4 -3
  43. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +35 -9
  44. package/dist/cjs/global-account/react/components/LinkAccount/LinkAccount.js +63 -3
  45. package/dist/cjs/global-account/react/components/ManageAccount/ManageAccount.js +35 -2
  46. package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStepCustom.js +4 -3
  47. package/dist/cjs/global-account/react/hooks/useAuthentication.js +1 -2
  48. package/dist/cjs/global-account/react/hooks/useSimBalance.js +2 -2
  49. package/dist/cjs/global-account/react/hooks/useUnifiedChainSwitchAndExecute.js +27 -22
  50. package/dist/esm/anyspend/react/components/AnySpend.d.ts +10 -1
  51. package/dist/esm/anyspend/react/components/AnySpend.js +7 -3
  52. package/dist/esm/anyspend/react/components/AnyspendDepositHype.d.ts +8 -0
  53. package/dist/esm/anyspend/react/components/AnyspendDepositHype.js +6 -3
  54. package/dist/esm/anyspend/react/components/common/ConnectWalletPayment.js +6 -4
  55. package/dist/esm/anyspend/react/components/common/CryptoPaySection.d.ts +4 -1
  56. package/dist/esm/anyspend/react/components/common/CryptoPaySection.js +9 -9
  57. package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.js +80 -10
  58. package/dist/esm/anyspend/react/components/common/CryptoReceiveSection.d.ts +2 -1
  59. package/dist/esm/anyspend/react/components/common/CryptoReceiveSection.js +39 -37
  60. package/dist/esm/anyspend/react/components/common/OrderDetails.js +8 -11
  61. package/dist/esm/anyspend/react/components/common/OrderTokenAmount.d.ts +4 -1
  62. package/dist/esm/anyspend/react/components/common/OrderTokenAmount.js +23 -9
  63. package/dist/esm/anyspend/react/components/common/PanelOnramp.d.ts +4 -1
  64. package/dist/esm/anyspend/react/components/common/PanelOnramp.js +7 -6
  65. package/dist/esm/anyspend/react/components/common/PointsDetailPanel.d.ts +6 -0
  66. package/dist/esm/anyspend/react/components/common/PointsDetailPanel.js +8 -0
  67. package/dist/esm/anyspend/react/contexts/FeatureFlagsContext.d.ts +11 -0
  68. package/dist/esm/anyspend/react/contexts/FeatureFlagsContext.js +17 -0
  69. package/dist/esm/anyspend/react/hooks/useAnyspendFlow.d.ts +4 -1
  70. package/dist/esm/anyspend/react/hooks/useAnyspendFlow.js +13 -5
  71. package/dist/esm/anyspend/react/providers/AnyspendProvider.d.ts +5 -2
  72. package/dist/esm/anyspend/react/providers/AnyspendProvider.js +5 -3
  73. package/dist/esm/anyspend/react/providers/index.d.ts +1 -0
  74. package/dist/esm/anyspend/react/providers/index.js +1 -0
  75. package/dist/esm/anyspend/types/api.d.ts +10 -0
  76. package/dist/esm/anyspend/utils/chain.js +1 -1
  77. package/dist/esm/bondkit/bondkitToken.d.ts +37 -2
  78. package/dist/esm/bondkit/bondkitToken.js +268 -2
  79. package/dist/esm/bondkit/bondkitTokenFactory.d.ts +1 -1
  80. package/dist/esm/bondkit/bondkitTokenFactory.js +2 -2
  81. package/dist/esm/bondkit/config.d.ts +1 -1
  82. package/dist/esm/bondkit/config.js +5 -2
  83. package/dist/esm/bondkit/constants.d.ts +4 -0
  84. package/dist/esm/bondkit/constants.js +5 -0
  85. package/dist/esm/bondkit/index.d.ts +1 -0
  86. package/dist/esm/bondkit/index.js +2 -0
  87. package/dist/esm/bondkit/swapService.d.ts +43 -0
  88. package/dist/esm/bondkit/swapService.js +369 -0
  89. package/dist/esm/bondkit/types.d.ts +10 -4
  90. package/dist/esm/bondkit/types.js +4 -5
  91. package/dist/esm/global-account/react/components/B3Provider/B3Provider.d.ts +4 -3
  92. package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +36 -9
  93. package/dist/esm/global-account/react/components/LinkAccount/LinkAccount.js +65 -5
  94. package/dist/esm/global-account/react/components/ManageAccount/ManageAccount.js +35 -2
  95. package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStepCustom.js +3 -2
  96. package/dist/esm/global-account/react/hooks/useAuthentication.js +1 -2
  97. package/dist/esm/global-account/react/hooks/useSimBalance.js +2 -2
  98. package/dist/esm/global-account/react/hooks/useUnifiedChainSwitchAndExecute.js +27 -22
  99. package/dist/styles/index.css +1 -1
  100. package/dist/types/anyspend/react/components/AnySpend.d.ts +10 -1
  101. package/dist/types/anyspend/react/components/AnyspendDepositHype.d.ts +8 -0
  102. package/dist/types/anyspend/react/components/common/CryptoPaySection.d.ts +4 -1
  103. package/dist/types/anyspend/react/components/common/CryptoReceiveSection.d.ts +2 -1
  104. package/dist/types/anyspend/react/components/common/OrderTokenAmount.d.ts +4 -1
  105. package/dist/types/anyspend/react/components/common/PanelOnramp.d.ts +4 -1
  106. package/dist/types/anyspend/react/components/common/PointsDetailPanel.d.ts +6 -0
  107. package/dist/types/anyspend/react/contexts/FeatureFlagsContext.d.ts +11 -0
  108. package/dist/types/anyspend/react/hooks/useAnyspendFlow.d.ts +4 -1
  109. package/dist/types/anyspend/react/providers/AnyspendProvider.d.ts +5 -2
  110. package/dist/types/anyspend/react/providers/index.d.ts +1 -0
  111. package/dist/types/anyspend/types/api.d.ts +10 -0
  112. package/dist/types/bondkit/bondkitToken.d.ts +37 -2
  113. package/dist/types/bondkit/bondkitTokenFactory.d.ts +1 -1
  114. package/dist/types/bondkit/config.d.ts +1 -1
  115. package/dist/types/bondkit/constants.d.ts +4 -0
  116. package/dist/types/bondkit/index.d.ts +1 -0
  117. package/dist/types/bondkit/swapService.d.ts +43 -0
  118. package/dist/types/bondkit/types.d.ts +10 -4
  119. package/dist/types/global-account/react/components/B3Provider/B3Provider.d.ts +4 -3
  120. package/package.json +28 -26
  121. package/src/anyspend/react/components/AnySpend.tsx +23 -0
  122. package/src/anyspend/react/components/AnyspendDepositHype.tsx +22 -0
  123. package/src/anyspend/react/components/common/ConnectWalletPayment.tsx +7 -4
  124. package/src/anyspend/react/components/common/CryptoPaySection.tsx +13 -8
  125. package/src/anyspend/react/components/common/CryptoPaymentMethod.tsx +170 -44
  126. package/src/anyspend/react/components/common/CryptoReceiveSection.tsx +63 -45
  127. package/src/anyspend/react/components/common/OrderDetails.tsx +10 -14
  128. package/src/anyspend/react/components/common/OrderTokenAmount.tsx +28 -8
  129. package/src/anyspend/react/components/common/PanelOnramp.tsx +28 -15
  130. package/src/anyspend/react/components/common/PointsDetailPanel.tsx +55 -0
  131. package/src/anyspend/react/contexts/FeatureFlagsContext.tsx +34 -0
  132. package/src/anyspend/react/hooks/useAnyspendFlow.ts +13 -5
  133. package/src/anyspend/react/providers/AnyspendProvider.tsx +11 -6
  134. package/src/anyspend/react/providers/index.ts +1 -0
  135. package/src/anyspend/types/api.ts +10 -0
  136. package/src/anyspend/types/api_req_res.ts +6 -10
  137. package/src/anyspend/utils/chain.ts +1 -1
  138. package/src/bondkit/bondkitToken.ts +323 -3
  139. package/src/bondkit/bondkitTokenFactory.ts +2 -2
  140. package/src/bondkit/config.ts +5 -2
  141. package/src/bondkit/constants.ts +7 -0
  142. package/src/bondkit/index.ts +3 -0
  143. package/src/bondkit/swapService.ts +461 -0
  144. package/src/bondkit/types.ts +12 -5
  145. package/src/global-account/react/components/B3Provider/B3Provider.tsx +51 -15
  146. package/src/global-account/react/components/LinkAccount/LinkAccount.tsx +106 -32
  147. package/src/global-account/react/components/ManageAccount/ManageAccount.tsx +60 -5
  148. package/src/global-account/react/components/SignInWithB3/steps/LoginStepCustom.tsx +4 -2
  149. package/src/global-account/react/hooks/useAuthentication.ts +1 -2
  150. package/src/global-account/react/hooks/useSimBalance.ts +2 -2
  151. package/src/global-account/react/hooks/useUnifiedChainSwitchAndExecute.ts +28 -23
@@ -10,6 +10,7 @@ const react_1 = require("../../../../global-account/react");
10
10
  const SignOutIcon_1 = require("../../../../global-account/react/components/icons/SignOutIcon");
11
11
  const formatNumber_1 = require("../../../../shared/utils/formatNumber");
12
12
  const thirdweb_1 = require("../../../../shared/utils/thirdweb");
13
+ const truncateAddress_1 = require("../../../../shared/utils/truncateAddress");
13
14
  const lucide_react_1 = require("lucide-react");
14
15
  const react_2 = require("react");
15
16
  const sonner_1 = require("sonner");
@@ -18,6 +19,21 @@ const viem_1 = require("viem");
18
19
  const profileDisplay_1 = require("../../utils/profileDisplay");
19
20
  const AccountAssets_1 = require("../AccountAssets/AccountAssets");
20
21
  const ContentTokens_1 = require("./ContentTokens");
22
+ // Helper function to check if a string is a wallet address and format it
23
+ const formatProfileTitle = (title) => {
24
+ // Check if title looks like an Ethereum address (0x followed by 40 hex characters)
25
+ const isEthereumAddress = /^0x[a-fA-F0-9]{40}$/.test(title);
26
+ if (isEthereumAddress) {
27
+ return {
28
+ displayTitle: (0, truncateAddress_1.truncateAddress)(title),
29
+ isAddress: true,
30
+ };
31
+ }
32
+ return {
33
+ displayTitle: title,
34
+ isAddress: false,
35
+ };
36
+ };
21
37
  const BalanceContent_1 = require("./BalanceContent");
22
38
  function ManageAccount({ onLogout, onSwap: _onSwap, onDeposit: _onDeposit, chain, partnerId, showSwap, showDeposit, }) {
23
39
  const [revokingSignerId, setRevokingSignerId] = (0, react_2.useState)(null);
@@ -117,7 +133,7 @@ function ManageAccount({ onLogout, onSwap: _onSwap, onDeposit: _onDeposit, chain
117
133
  }
118
134
  };
119
135
  const profiles = profilesRaw
120
- .filter((profile) => !["custom_auth_endpoint", "siwe"].includes(profile.type))
136
+ .filter((profile) => !["custom_auth_endpoint"].includes(profile.type))
121
137
  .map((profile) => ({
122
138
  ...(0, profileDisplay_1.getProfileDisplayInfo)(profile),
123
139
  originalProfile: profile,
@@ -152,7 +168,24 @@ function ManageAccount({ onLogout, onSwap: _onSwap, onDeposit: _onDeposit, chain
152
168
  },
153
169
  });
154
170
  };
155
- return ((0, jsx_runtime_1.jsxs)("div", { className: "linked-accounts-settings space-y-8", children: [(0, jsx_runtime_1.jsxs)("div", { className: "linked-accounts-section space-y-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "linked-accounts-header flex items-center justify-between", children: [(0, jsx_runtime_1.jsx)("h3", { className: "text-b3-grey font-neue-montreal-semibold linked-accounts-settings-title text-xl", children: "Linked Accounts" }), (0, jsx_runtime_1.jsxs)(react_1.Button, { 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", onClick: handleOpenLinkModal, disabled: isLinking, children: [isLinking ? ((0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "linked-accounts-link-loading text-b3-primary-blue animate-spin", size: 16 })) : ((0, jsx_runtime_1.jsx)(lucide_react_1.LinkIcon, { size: 16, className: "linked-accounts-link-icon text-b3-primary-blue" })), (0, jsx_runtime_1.jsx)("span", { className: "linked-accounts-link-text text-b3-grey font-neue-montreal-semibold", children: isLinking ? "Linking..." : "Link New Account" })] })] }), isLoadingProfiles ? ((0, jsx_runtime_1.jsx)("div", { className: "linked-accounts-loading flex justify-center py-8", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "text-b3-grey animate-spin" }) })) : profiles.length > 0 ? ((0, jsx_runtime_1.jsx)("div", { className: "linked-accounts-list space-y-4", children: profiles.map(profile => ((0, jsx_runtime_1.jsxs)("div", { className: "linked-account-item bg-b3-line flex items-center justify-between rounded-xl p-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "linked-account-info flex items-center gap-3", children: [profile.imageUrl ? ((0, jsx_runtime_1.jsx)("img", { src: profile.imageUrl, alt: profile.title, className: "linked-account-avatar linked-account-avatar-image size-10 rounded-full" })) : ((0, jsx_runtime_1.jsx)("div", { className: "linked-account-avatar linked-account-avatar-placeholder bg-b3-primary-wash flex h-10 w-10 items-center justify-center rounded-full", children: (0, jsx_runtime_1.jsx)("span", { className: "linked-account-initial text-b3-grey font-neue-montreal-semibold text-sm uppercase", children: profile.initial }) })), (0, jsx_runtime_1.jsxs)("div", { className: "linked-account-details", children: [(0, jsx_runtime_1.jsxs)("div", { className: "linked-account-title-row flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)("span", { className: "linked-account-title text-b3-grey font-neue-montreal-semibold", children: profile.title }), (0, jsx_runtime_1.jsx)("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", children: profile.type.toUpperCase() })] }), (0, jsx_runtime_1.jsx)("div", { className: "linked-account-subtitle text-b3-foreground-muted font-neue-montreal-medium text-sm", children: profile.subtitle })] })] }), (0, jsx_runtime_1.jsx)(react_1.Button, { variant: "ghost", size: "icon", className: "linked-account-unlink-button text-b3-grey hover:text-b3-negative", onClick: () => handleUnlink(profile), disabled: unlinkingAccountId === profile.title || isUnlinking, children: unlinkingAccountId === profile.title || isUnlinking ? ((0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "linked-account-unlink-loading animate-spin" })) : ((0, jsx_runtime_1.jsx)(lucide_react_1.UnlinkIcon, { size: 16, className: "linked-account-unlink-icon" })) })] }, profile.title))) })) : ((0, jsx_runtime_1.jsx)("div", { className: "linked-accounts-empty text-b3-foreground-muted py-8 text-center", children: "No linked accounts found" }))] }), showReferralInfo && (
171
+ console.log("@@profiles", profiles);
172
+ return ((0, jsx_runtime_1.jsxs)("div", { className: "linked-accounts-settings space-y-8", children: [(0, jsx_runtime_1.jsxs)("div", { className: "linked-accounts-section space-y-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "linked-accounts-header flex items-center justify-between", children: [(0, jsx_runtime_1.jsx)("h3", { className: "text-b3-grey font-neue-montreal-semibold linked-accounts-settings-title text-xl", children: "Linked Accounts" }), (0, jsx_runtime_1.jsxs)(react_1.Button, { 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", onClick: handleOpenLinkModal, disabled: isLinking, children: [isLinking ? ((0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "linked-accounts-link-loading text-b3-primary-blue animate-spin", size: 16 })) : ((0, jsx_runtime_1.jsx)(lucide_react_1.LinkIcon, { size: 16, className: "linked-accounts-link-icon text-b3-primary-blue" })), (0, jsx_runtime_1.jsx)("span", { className: "linked-accounts-link-text text-b3-grey font-neue-montreal-semibold", children: isLinking ? "Linking..." : "Link New Account" })] })] }), isLoadingProfiles ? ((0, jsx_runtime_1.jsx)("div", { className: "linked-accounts-loading flex justify-center py-8", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "text-b3-grey animate-spin" }) })) : profiles.length > 0 ? ((0, jsx_runtime_1.jsx)("div", { className: "linked-accounts-list space-y-4", children: profiles.map(profile => ((0, jsx_runtime_1.jsxs)("div", { className: "linked-account-item bg-b3-line group flex items-center justify-between rounded-xl p-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "linked-account-info flex items-center gap-3", children: [profile.imageUrl ? ((0, jsx_runtime_1.jsx)("img", { src: profile.imageUrl, alt: profile.title, className: "linked-account-avatar linked-account-avatar-image size-10 rounded-full" })) : ((0, jsx_runtime_1.jsx)("div", { className: "linked-account-avatar linked-account-avatar-placeholder bg-b3-primary-wash flex h-10 w-10 items-center justify-center rounded-full", children: (0, jsx_runtime_1.jsx)("span", { className: "linked-account-initial text-b3-grey font-neue-montreal-semibold text-sm uppercase", children: profile.initial }) })), (0, jsx_runtime_1.jsxs)("div", { className: "linked-account-details", children: [(0, jsx_runtime_1.jsxs)("div", { className: "linked-account-title-row flex items-center gap-2", children: [(() => {
173
+ const { displayTitle, isAddress } = formatProfileTitle(profile.title);
174
+ const handleCopyAddress = async (e) => {
175
+ e.stopPropagation();
176
+ try {
177
+ await navigator.clipboard.writeText(profile.title);
178
+ sonner_1.toast.success("Address copied to clipboard!");
179
+ }
180
+ catch (error) {
181
+ sonner_1.toast.error("Failed to copy address");
182
+ }
183
+ };
184
+ return ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-1", children: [(0, jsx_runtime_1.jsx)("span", { className: `linked-account-title text-b3-grey font-neue-montreal-semibold ${isAddress
185
+ ? "font-mono text-sm" // Use monospace font for addresses
186
+ : "break-words" // Use break-words for emails/names (better than break-all)
187
+ }`, title: isAddress ? profile.title : undefined, children: displayTitle }), isAddress && ((0, jsx_runtime_1.jsx)("button", { onClick: handleCopyAddress, className: "linked-account-copy-button ml-1 rounded p-1 opacity-0 transition-opacity hover:bg-gray-100 group-hover:opacity-100", title: "Copy full address", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Copy, { size: 12, className: "text-gray-500 hover:text-gray-700" }) }))] }));
188
+ })(), (0, jsx_runtime_1.jsx)("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", children: profile.type.toUpperCase() })] }), (0, jsx_runtime_1.jsx)("div", { className: "linked-account-subtitle text-b3-foreground-muted font-neue-montreal-medium text-sm", children: profile.subtitle })] })] }), (0, jsx_runtime_1.jsx)(react_1.Button, { variant: "ghost", size: "icon", className: "linked-account-unlink-button text-b3-grey hover:text-b3-negative", onClick: () => handleUnlink(profile), disabled: unlinkingAccountId === profile.title || isUnlinking, children: unlinkingAccountId === profile.title || isUnlinking ? ((0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "linked-account-unlink-loading animate-spin" })) : ((0, jsx_runtime_1.jsx)(lucide_react_1.UnlinkIcon, { size: 16, className: "linked-account-unlink-icon" })) })] }, profile.title))) })) : ((0, jsx_runtime_1.jsx)("div", { className: "linked-accounts-empty text-b3-foreground-muted py-8 text-center", children: "No linked accounts found" }))] }), showReferralInfo && (
156
189
  /* Referral Section */
157
190
  (0, jsx_runtime_1.jsxs)("div", { className: "referrals-section space-y-4", children: [(0, jsx_runtime_1.jsx)("h3", { className: "referrals-title text-b3-grey font-neue-montreal-semibold text-xl", children: "Referrals" }), (0, jsx_runtime_1.jsxs)("div", { className: "referral-code-container bg-b3-line rounded-xl p-4", children: [isEditingCode && ((0, jsx_runtime_1.jsxs)("div", { className: "referral-code-header-editing", children: [(0, jsx_runtime_1.jsx)("div", { className: "referral-code-title text-b3-grey font-neue-montreal-semibold", children: "Your Referral Code" }), (0, jsx_runtime_1.jsx)("div", { className: "referral-code-description text-b3-foreground-muted font-neue-montreal-medium text-sm", children: "Share this code with friends to earn rewards" })] })), (0, jsx_runtime_1.jsxs)("div", { className: "referral-code-content flex items-center justify-between", children: [!isEditingCode && ((0, jsx_runtime_1.jsxs)("div", { className: "referral-code-header", children: [(0, jsx_runtime_1.jsx)("div", { className: "referral-code-title text-b3-grey font-neue-montreal-semibold", children: "Your Referral Code" }), (0, jsx_runtime_1.jsx)("div", { className: "referral-code-description text-b3-foreground-muted font-neue-montreal-medium text-sm", children: "Share this code with friends to earn rewards" })] })), (0, jsx_runtime_1.jsx)("div", { className: "referral-code-actions flex items-center gap-2", children: isEditingCode ? ((0, jsx_runtime_1.jsxs)("div", { className: "referral-code-edit-form flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)("input", { type: "text", value: newReferralCode, onChange: e => setNewReferralCode(e.target.value), className: "referral-code-input rounded-lg border border-gray-200 bg-white px-3 py-1.5 text-sm", placeholder: "Enter new code", ref: referallCodeRef }), (0, jsx_runtime_1.jsx)(react_1.Button, { size: "sm", className: "referral-code-save-button", onClick: handleUpdateReferralCode, disabled: isUpdatingCode || !newReferralCode, children: isUpdatingCode ? ((0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "referral-code-save-loading h-4 w-4 animate-spin" })) : ("Save") }), (0, jsx_runtime_1.jsx)(react_1.Button, { size: "sm", variant: "ghost", className: "referral-code-cancel-button", onClick: () => {
158
191
  setIsEditingCode(false);
@@ -8,6 +8,7 @@ const thirdweb_1 = require("../../../../../shared/utils/thirdweb");
8
8
  const react_2 = require("react");
9
9
  const react_3 = require("thirdweb/react");
10
10
  const wallets_1 = require("thirdweb/wallets");
11
+ const debug = (0, debug_1.debugB3React)("LoginStepCustom");
11
12
  function LoginStepCustom({ onSuccess, onError, partnerId, chain, strategies, maxInitialWallets = 2, automaticallySetFirstEoa, }) {
12
13
  const [isLoading, setIsLoading] = (0, react_2.useState)(false);
13
14
  const [showAllWallets, setShowAllWallets] = (0, react_2.useState)(false);
@@ -24,7 +25,7 @@ function LoginStepCustom({ onSuccess, onError, partnerId, chain, strategies, max
24
25
  const handleConnect = async (strategy) => {
25
26
  try {
26
27
  setIsLoading(true);
27
- (0, debug_1.debug)("setIsAuthenticating:true:3");
28
+ debug("setIsAuthenticating:true:3");
28
29
  setIsAuthenticating(true);
29
30
  const options = (0, react_1.getConnectOptionsFromStrategy)(strategy);
30
31
  let connectResult;
@@ -45,7 +46,7 @@ function LoginStepCustom({ onSuccess, onError, partnerId, chain, strategies, max
45
46
  connectResult = await connect(options);
46
47
  }
47
48
  const account = connectResult?.getAccount();
48
- console.log("@@gio:connectResult", { connectResult, account, options });
49
+ debug("@@connectResult", { connectResult, account, options });
49
50
  if (!account)
50
51
  throw new Error("Failed to connect");
51
52
  await onSuccess(account);
@@ -58,7 +59,7 @@ function LoginStepCustom({ onSuccess, onError, partnerId, chain, strategies, max
58
59
  }
59
60
  finally {
60
61
  setIsLoading(false);
61
- (0, debug_1.debug)("setIsAuthenticating:false:3");
62
+ debug("setIsAuthenticating:false:3");
62
63
  setIsAuthenticating(false);
63
64
  }
64
65
  };
@@ -122,8 +122,7 @@ function useAuthentication(partnerId, loginWithSiwe) {
122
122
  if (activeWallet) {
123
123
  debug("@@logout:activeWallet", activeWallet);
124
124
  disconnect(activeWallet);
125
- debug("@@logout:disconnected");
126
- console.log("@@gio:logout:activeWallet", activeWallet);
125
+ debug("@@logout:activeWallet", activeWallet);
127
126
  }
128
127
  // Log out of each wallet
129
128
  wallets.forEach(wallet => {
@@ -6,8 +6,8 @@ async function fetchSimBalance(address) {
6
6
  if (!address)
7
7
  throw new Error("Address is required");
8
8
  let url = `https://simdune-api.sean-430.workers.dev/?url=https://api.sim.dune.com/v1/evm/balances/${address}?metadata=logo&chain_ids=mainnet`;
9
- if (process.env.PUBLIC_LOCAL_KEY) {
10
- url += `&localkey=${process.env.PUBLIC_LOCAL_KEY}`;
9
+ if (process.env.NEXT_PUBLIC_LOCAL_KEY) {
10
+ url += `&localkey=${process.env.NEXT_PUBLIC_LOCAL_KEY}`;
11
11
  }
12
12
  const response = await fetch(url);
13
13
  if (!response.ok) {
@@ -12,10 +12,11 @@ const invariant_1 = __importDefault(require("invariant"));
12
12
  const react_1 = require("react");
13
13
  const sonner_1 = require("sonner");
14
14
  const thirdweb_2 = require("thirdweb");
15
+ const react_2 = require("thirdweb/react");
16
+ const viem_1 = require("viem");
15
17
  const wagmi_1 = require("wagmi");
16
18
  const components_1 = require("../components");
17
19
  const useAccountWallet_1 = require("./useAccountWallet");
18
- const viem_1 = require("viem");
19
20
  const partnerId = String(process.env.PUBLIC_THIRDWEB_PARTNER_ID ||
20
21
  process.env.NEXT_PUBLIC_THIRDWEB_PARTNER_ID ||
21
22
  process.env.PUBLIC_GLOBAL_ACCOUNTS_PARTNER_ID ||
@@ -25,37 +26,43 @@ function useUnifiedChainSwitchAndExecute() {
25
26
  const { data: walletClient } = (0, wagmi_1.useWalletClient)();
26
27
  const { switchChainAsync } = (0, wagmi_1.useSwitchChain)();
27
28
  const [isSwitchingOrExecuting, setIsSwitchingOrExecuting] = (0, react_1.useState)(false);
28
- const { isActiveSmartWallet, isActiveEOAWallet } = (0, useAccountWallet_1.useAccountWallet)();
29
+ const activeWallet = (0, react_2.useActiveWallet)();
30
+ const { isActiveSmartWallet, isActiveEOAWallet, connectedEOAWallet } = (0, useAccountWallet_1.useAccountWallet)();
29
31
  const { account: aaAccount } = (0, components_1.useB3)();
30
32
  // Handle EOA wallet chain switch and execute transaction
31
33
  const handleEOASwitchChainAndSendTransaction = (0, react_1.useCallback)(async (targetChainId, params) => {
32
- if (!walletClient) {
34
+ if (!connectedEOAWallet) {
33
35
  sonner_1.toast.error("Please connect your wallet");
34
36
  return;
35
37
  }
36
- const providerId = walletClient.chain.id;
37
- const onCorrectChain = providerId === targetChainId;
38
+ // Get target chain configuration once
39
+ const targetChain = supported_1.supportedChains.find(chain => chain.id === targetChainId);
40
+ if (!targetChain) {
41
+ sonner_1.toast.error(`Chain ${targetChainId} is not supported`);
42
+ return;
43
+ }
44
+ const currentChainId = activeWallet?.getChain()?.id;
45
+ const onCorrectChain = currentChainId === targetChainId;
38
46
  // Helper function to execute the transaction
39
47
  const executeTransaction = async () => {
40
- const signer = walletClient.account;
48
+ const signer = activeWallet?.getAccount();
41
49
  if (!signer) {
42
50
  throw new Error("No account connected");
43
51
  }
44
- // Get the target chain configuration instead of using potentially stale walletClient.chain
45
- const targetChain = supported_1.supportedChains.find(chain => chain.id === targetChainId);
46
- if (!targetChain) {
47
- throw new Error(`Chain ${targetChainId} is not supported`);
52
+ // Coinbase Smart Wallet specific chain switching (different behavior from other wallets)
53
+ const walletChain = connectedEOAWallet.getChain();
54
+ if (walletChain?.id !== targetChainId) {
55
+ activeWallet?.switchChain((0, supported_1.getThirdwebChain)(targetChainId));
48
56
  }
49
57
  (0, invariant_1.default)((0, viem_1.isAddress)(params.to), "params.to is not a valid address");
50
- const hash = await walletClient.sendTransaction({
51
- account: signer,
52
- chain: targetChain,
58
+ const result = await signer.sendTransaction({
59
+ chainId: targetChainId,
53
60
  to: params.to,
54
61
  data: params.data,
55
62
  value: params.value,
56
63
  });
57
- sonner_1.toast.success(`Transaction sent: ${hash.slice(0, 10)}...`);
58
- return hash;
64
+ sonner_1.toast.success(`Transaction sent: ${result.transactionHash.slice(0, 10)}...`);
65
+ return result.transactionHash;
59
66
  };
60
67
  try {
61
68
  setIsSwitchingOrExecuting(true);
@@ -63,11 +70,6 @@ function useUnifiedChainSwitchAndExecute() {
63
70
  return await executeTransaction();
64
71
  }
65
72
  const switchingToastId = sonner_1.toast.info(`Switching to ${(0, anyspend_1.getChainName)(targetChainId)}…`);
66
- const targetChain = supported_1.supportedChains.find(chain => chain.id === targetChainId);
67
- if (!targetChain) {
68
- sonner_1.toast.error(`Chain ${targetChainId} is not supported`);
69
- return;
70
- }
71
73
  const blockExplorerUrl = targetChain.blockExplorers?.default.url;
72
74
  (0, invariant_1.default)(blockExplorerUrl, "Block explorer URL is required");
73
75
  const nativeCurrency = (0, anyspend_1.getNativeToken)(targetChainId);
@@ -130,18 +132,21 @@ function useUnifiedChainSwitchAndExecute() {
130
132
  });
131
133
  }
132
134
  catch (err) {
133
- console.error(err);
135
+ console.error("Create global-accounts-intents error", err);
134
136
  }
135
137
  sonner_1.toast.info("Sending transaction…");
138
+ const start = performance.now();
136
139
  const sendTxResponse = await (0, thirdweb_2.sendTransaction)({
137
140
  account: aaAccount,
138
141
  transaction,
139
142
  });
143
+ const end = performance.now();
144
+ console.log("Time taken to send transaction", end - start);
140
145
  sonner_1.toast.success("Transaction sent successfully");
141
146
  return sendTxResponse.transactionHash;
142
147
  }
143
148
  catch (err) {
144
- console.error(err);
149
+ console.error("Send transaction error", err);
145
150
  sonner_1.toast.error(err?.message ?? "Transaction failed");
146
151
  return undefined;
147
152
  }
@@ -1,3 +1,4 @@
1
+ import { components } from "../../types/api";
1
2
  export interface RecipientOption {
2
3
  address: string;
3
4
  icon?: string;
@@ -12,7 +13,8 @@ export declare enum PanelView {
12
13
  FIAT_PAYMENT = 4,
13
14
  RECIPIENT_SELECTION = 5,
14
15
  CRYPTO_PAYMENT_METHOD = 6,
15
- FIAT_PAYMENT_METHOD = 7
16
+ FIAT_PAYMENT_METHOD = 7,
17
+ POINTS_DETAIL = 8
16
18
  }
17
19
  export declare function AnySpend(props: {
18
20
  mode?: "page" | "modal";
@@ -22,4 +24,11 @@ export declare function AnySpend(props: {
22
24
  recipientAddress?: string;
23
25
  loadOrder?: string;
24
26
  hideTransactionHistoryButton?: boolean;
27
+ /**
28
+ * Called when a token is selected. Call event.preventDefault() to prevent default token selection behavior.
29
+ * Useful for handling special cases like B3 token selection.
30
+ */
31
+ onTokenSelect?: (token: components["schemas"]["Token"], event: {
32
+ preventDefault: () => void;
33
+ }) => void;
25
34
  }): import("react/jsx-runtime").JSX.Element;
@@ -22,6 +22,7 @@ import { OrderDetails, OrderDetailsLoadingView } from "./common/OrderDetails.js"
22
22
  import { OrderHistory } from "./common/OrderHistory.js";
23
23
  import { PanelOnramp } from "./common/PanelOnramp.js";
24
24
  import { PanelOnrampPayment } from "./common/PanelOnrampPayment.js";
25
+ import { PointsDetailPanel } from "./common/PointsDetailPanel.js";
25
26
  import { RecipientSelection } from "./common/RecipientSelection.js";
26
27
  import { TabSection } from "./common/TabSection.js";
27
28
  export var PanelView;
@@ -34,13 +35,14 @@ export var PanelView;
34
35
  PanelView[PanelView["RECIPIENT_SELECTION"] = 5] = "RECIPIENT_SELECTION";
35
36
  PanelView[PanelView["CRYPTO_PAYMENT_METHOD"] = 6] = "CRYPTO_PAYMENT_METHOD";
36
37
  PanelView[PanelView["FIAT_PAYMENT_METHOD"] = 7] = "FIAT_PAYMENT_METHOD";
38
+ PanelView[PanelView["POINTS_DETAIL"] = 8] = "POINTS_DETAIL";
37
39
  })(PanelView || (PanelView = {}));
38
40
  const ANYSPEND_RECIPIENTS_KEY = "anyspend_recipients";
39
41
  export function AnySpend(props) {
40
42
  const fingerprintConfig = getFingerprintConfig();
41
43
  return (_jsx(AnySpendFingerprintWrapper, { fingerprint: fingerprintConfig, children: _jsx(AnySpendInner, { ...props }) }));
42
44
  }
43
- function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode = "modal", defaultActiveTab = "crypto", loadOrder, hideTransactionHistoryButton, recipientAddress: recipientAddressFromProps, }) {
45
+ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode = "modal", defaultActiveTab = "crypto", loadOrder, hideTransactionHistoryButton, recipientAddress: recipientAddressFromProps, onTokenSelect, }) {
44
46
  const searchParams = useSearchParamsSSR();
45
47
  const router = useRouter();
46
48
  // Determine if we're in "buy mode" based on whether destination token props are provided
@@ -656,7 +658,7 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode
656
658
  setActivePanel(PanelView.MAIN);
657
659
  setSelectedCryptoPaymentMethod(CryptoPaymentMethodType.NONE); // Reset payment method when going back
658
660
  } })) }) }));
659
- const mainView = (_jsxs("div", { className: "mx-auto flex w-[460px] max-w-full flex-col items-center gap-2", children: [isBuyMode && (_jsxs("div", { className: "mb-4 flex flex-col items-center gap-3 text-center", children: [selectedDstToken.metadata?.logoURI && (_jsx("div", { className: "relative", children: _jsx("img", { src: selectedDstToken.metadata.logoURI, alt: selectedDstToken.symbol, className: "border-as-stroke h-12 w-12 rounded-full border-2 shadow-md" }) })), _jsx("div", { children: _jsxs("h1", { className: "text-as-primary text-xl font-bold", children: ["Buy ", selectedDstToken.symbol] }) })] })), _jsx(TabSection, { activeTab: activeTab, setActiveTab: setActiveTab, setSelectedCryptoPaymentMethod: setSelectedCryptoPaymentMethod, setSelectedFiatPaymentMethod: setSelectedFiatPaymentMethod }), _jsxs("div", { className: "relative flex w-full max-w-[calc(100vw-32px)] flex-col gap-2", children: [activeTab === "crypto" ? (_jsx(CryptoPaySection, { selectedSrcChainId: selectedSrcChainId, setSelectedSrcChainId: setSelectedSrcChainId, selectedSrcToken: selectedSrcToken, setSelectedSrcToken: setSelectedSrcToken, srcAmount: srcAmount, setSrcAmount: setSrcAmount, setIsSrcInputDirty: setIsSrcInputDirty, selectedCryptoPaymentMethod: selectedCryptoPaymentMethod, onSelectCryptoPaymentMethod: () => setActivePanel(PanelView.CRYPTO_PAYMENT_METHOD), anyspendQuote: anyspendQuote })) : (_jsx(motion.div, { initial: { opacity: 0, y: 20, filter: "blur(10px)" }, animate: { opacity: 1, y: 0, filter: "blur(0px)" }, transition: { duration: 0.3, delay: 0, ease: "easeInOut" }, children: _jsx(PanelOnramp, { srcAmountOnRamp: srcAmountOnRamp, setSrcAmountOnRamp: setSrcAmountOnRamp, selectedPaymentMethod: selectedFiatPaymentMethod, setActivePanel: setActivePanel, _recipientAddress: recipientAddress, destinationToken: selectedDstToken, destinationChainId: selectedDstChainId, destinationAmount: dstAmount, onDestinationTokenChange: setSelectedDstToken, onDestinationChainChange: setSelectedDstChainId, fiatPaymentMethodIndex: PanelView.FIAT_PAYMENT_METHOD, recipientSelectionPanelIndex: PanelView.RECIPIENT_SELECTION, hideDstToken: isBuyMode }) })), _jsx(Button, { variant: "ghost", className: cn("border-as-stroke bg-as-surface-primary absolute left-1/2 top-1/2 z-10 h-10 w-10 -translate-x-1/2 -translate-y-1/2 rounded-xl border-2 sm:h-8 sm:w-8 sm:rounded-xl", isBuyMode && "top-[calc(50%+56px)] cursor-default", activeTab === "fiat" && "hidden"), onClick: () => {
661
+ const mainView = (_jsxs("div", { className: "mx-auto flex w-[460px] max-w-full flex-col items-center gap-2", children: [isBuyMode && (_jsxs("div", { className: "mb-4 flex flex-col items-center gap-3 text-center", children: [selectedDstToken.metadata?.logoURI && (_jsx("div", { className: "relative", children: _jsx("img", { src: selectedDstToken.metadata.logoURI, alt: selectedDstToken.symbol, className: "border-as-stroke h-12 w-12 rounded-full border-2 shadow-md" }) })), _jsx("div", { children: _jsxs("h1", { className: "text-as-primary text-xl font-bold", children: ["Buy ", selectedDstToken.symbol] }) })] })), _jsx(TabSection, { activeTab: activeTab, setActiveTab: setActiveTab, setSelectedCryptoPaymentMethod: setSelectedCryptoPaymentMethod, setSelectedFiatPaymentMethod: setSelectedFiatPaymentMethod }), _jsxs("div", { className: "relative flex w-full max-w-[calc(100vw-32px)] flex-col gap-2", children: [activeTab === "crypto" ? (_jsx(CryptoPaySection, { selectedSrcChainId: selectedSrcChainId, setSelectedSrcChainId: setSelectedSrcChainId, selectedSrcToken: selectedSrcToken, setSelectedSrcToken: setSelectedSrcToken, srcAmount: srcAmount, setSrcAmount: setSrcAmount, setIsSrcInputDirty: setIsSrcInputDirty, selectedCryptoPaymentMethod: selectedCryptoPaymentMethod, onSelectCryptoPaymentMethod: () => setActivePanel(PanelView.CRYPTO_PAYMENT_METHOD), anyspendQuote: anyspendQuote, onTokenSelect: onTokenSelect })) : (_jsx(motion.div, { initial: { opacity: 0, y: 20, filter: "blur(10px)" }, animate: { opacity: 1, y: 0, filter: "blur(0px)" }, transition: { duration: 0.3, delay: 0, ease: "easeInOut" }, children: _jsx(PanelOnramp, { srcAmountOnRamp: srcAmountOnRamp, setSrcAmountOnRamp: setSrcAmountOnRamp, selectedPaymentMethod: selectedFiatPaymentMethod, setActivePanel: setActivePanel, _recipientAddress: recipientAddress, destinationToken: selectedDstToken, destinationChainId: selectedDstChainId, destinationAmount: dstAmount, onDestinationTokenChange: setSelectedDstToken, onDestinationChainChange: setSelectedDstChainId, fiatPaymentMethodIndex: PanelView.FIAT_PAYMENT_METHOD, recipientSelectionPanelIndex: PanelView.RECIPIENT_SELECTION, hideDstToken: isBuyMode, anyspendQuote: anyspendQuote, onShowPointsDetail: () => setActivePanel(PanelView.POINTS_DETAIL) }) })), _jsx(Button, { variant: "ghost", className: cn("border-as-stroke bg-as-surface-primary absolute left-1/2 top-1/2 z-10 h-10 w-10 -translate-x-1/2 -translate-y-1/2 rounded-xl border-2 sm:h-8 sm:w-8 sm:rounded-xl", isBuyMode && "top-[calc(50%+56px)] cursor-default", activeTab === "fiat" && "hidden"), onClick: () => {
660
662
  if (activeTab === "fiat" || isBuyMode) {
661
663
  return;
662
664
  }
@@ -678,7 +680,7 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode
678
680
  }, children: _jsx("div", { className: "relative flex items-center justify-center transition-opacity", children: _jsx(ArrowDown, { className: "text-as-primary/50 h-5 w-5" }) }) }), activeTab === "crypto" && (_jsx(CryptoReceiveSection, { isDepositMode: false, isBuyMode: isBuyMode, selectedRecipientAddress: recipientAddress, recipientName: recipientName || undefined, onSelectRecipient: () => setActivePanel(PanelView.RECIPIENT_SELECTION), dstAmount: dstAmount, dstToken: selectedDstToken, selectedDstChainId: selectedDstChainId, setSelectedDstChainId: setSelectedDstChainId, setSelectedDstToken: setSelectedDstToken, onChangeDstAmount: value => {
679
681
  setIsSrcInputDirty(false);
680
682
  setDstAmount(value);
681
- }, anyspendQuote: anyspendQuote }))] }), _jsx(ErrorSection, { error: getAnyspendQuoteError }), _jsxs(motion.div, { initial: { opacity: 0, y: 20, filter: "blur(10px)" }, animate: { opacity: 1, y: 0, filter: "blur(0px)" }, transition: { duration: 0.3, delay: 0.2, ease: "easeInOut" }, className: cn("mt-4 flex w-full max-w-[460px] flex-col gap-2", getAnyspendQuoteError && "mt-0"), children: [_jsx(ShinyButton, { accentColor: "hsl(var(--as-brand))", disabled: btnInfo.disable, onClick: onMainButtonClick, className: cn("as-main-button relative w-full", btnInfo.error ? "!bg-as-red" : btnInfo.disable ? "!bg-as-on-surface-2" : "!bg-as-brand"), textClassName: cn(btnInfo.error ? "text-white" : btnInfo.disable ? "text-as-secondary" : "text-white"), children: btnInfo.text }), !hideTransactionHistoryButton && (globalAddress || recipientAddress) ? (_jsxs(Button, { variant: "link", onClick: onClickHistory, className: "text-as-primary/50 hover:text-as-primary flex items-center gap-1 transition-colors", children: [_jsx(HistoryIcon, { className: "h-4 w-4" }), " ", _jsx("span", { className: "pr-4", children: "Transaction History" })] })) : null] })] }));
683
+ }, anyspendQuote: anyspendQuote, onShowPointsDetail: () => setActivePanel(PanelView.POINTS_DETAIL) }))] }), _jsx(ErrorSection, { error: getAnyspendQuoteError }), _jsxs(motion.div, { initial: { opacity: 0, y: 20, filter: "blur(10px)" }, animate: { opacity: 1, y: 0, filter: "blur(0px)" }, transition: { duration: 0.3, delay: 0.2, ease: "easeInOut" }, className: cn("mt-4 flex w-full max-w-[460px] flex-col gap-2", getAnyspendQuoteError && "mt-0"), children: [_jsx(ShinyButton, { accentColor: "hsl(var(--as-brand))", disabled: btnInfo.disable, onClick: onMainButtonClick, className: cn("as-main-button relative w-full", btnInfo.error ? "!bg-as-red" : btnInfo.disable ? "!bg-as-on-surface-2" : "!bg-as-brand"), textClassName: cn(btnInfo.error ? "text-white" : btnInfo.disable ? "text-as-secondary" : "text-white"), children: btnInfo.text }), !hideTransactionHistoryButton && (globalAddress || recipientAddress) ? (_jsxs(Button, { variant: "link", onClick: onClickHistory, className: "text-as-primary/50 hover:text-as-primary flex items-center gap-1 transition-colors", children: [_jsx(HistoryIcon, { className: "h-4 w-4" }), " ", _jsx("span", { className: "pr-4", children: "Transaction History" })] })) : null] })] }));
682
684
  const onrampPaymentView = (_jsx(PanelOnrampPayment, { srcAmountOnRamp: srcAmountOnRamp, recipientName: recipientName || undefined, recipientAddress: recipientAddress, isBuyMode: isBuyMode, destinationTokenChainId: destinationTokenChainId, destinationTokenAddress: destinationTokenAddress, selectedDstChainId: selectedDstChainId, selectedDstToken: selectedDstToken, orderType: "swap", anyspendQuote: anyspendQuote, globalAddress: globalAddress, onOrderCreated: orderId => {
683
685
  setOrderId(orderId);
684
686
  setActivePanel(PanelView.ORDER_DETAILS);
@@ -706,6 +708,7 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode
706
708
  setSelectedFiatPaymentMethod(method);
707
709
  setActivePanel(PanelView.MAIN); // Go back to main panel to show updated pricing
708
710
  }, srcAmountOnRamp: srcAmountOnRamp }));
711
+ const pointsDetailView = (_jsx(PointsDetailPanel, { pointsAmount: anyspendQuote?.data?.pointsAmount || 0, onBack: () => setActivePanel(PanelView.MAIN) }));
709
712
  // Add tabs to the main component when no order is loaded
710
713
  return (_jsx(StyleRoot, { children: _jsx("div", { className: cn("anyspend-container font-inter mx-auto w-full max-w-[460px]", mode === "page" &&
711
714
  "bg-as-surface-primary border-as-border-secondary overflow-hidden rounded-2xl border shadow-xl"), children: _jsx(TransitionPanel, { activeIndex: orderId
@@ -729,5 +732,6 @@ function AnySpendInner({ destinationTokenAddress, destinationTokenChainId, mode
729
732
  _jsx("div", { className: cn(mode === "page" && "p-6"), children: recipientSelectionView }, "recipient-selection-view"),
730
733
  _jsx("div", { className: cn(mode === "page" && "p-6"), children: cryptoPaymentMethodView }, "crypto-payment-method-view"),
731
734
  _jsx("div", { className: cn(mode === "page" && "p-6"), children: fiatPaymentMethodView }, "fiat-payment-method-view"),
735
+ _jsx("div", { className: cn(mode === "page" && "p-6"), children: pointsDetailView }, "points-detail-view"),
732
736
  ] }) }) }));
733
737
  }
@@ -1,3 +1,4 @@
1
+ import { components } from "../../../anyspend/types/api";
1
2
  export declare const HYPE_TOKEN_DETAILS: {
2
3
  SYMBOL: string;
3
4
  LOGO_URI: string;
@@ -11,5 +12,12 @@ export interface AnySpendDepositHypeProps {
11
12
  sourceTokenChainId?: number;
12
13
  onSuccess?: () => void;
13
14
  mainFooter?: React.ReactNode;
15
+ /**
16
+ * Called when a token is selected. Call event.preventDefault() to prevent default token selection behavior.
17
+ * Useful for handling special cases like B3 token selection.
18
+ */
19
+ onTokenSelect?: (token: components["schemas"]["Token"], event: {
20
+ preventDefault: () => void;
21
+ }) => void;
14
22
  }
15
23
  export declare function AnySpendDepositHype(props: AnySpendDepositHypeProps): import("react/jsx-runtime").JSX.Element;
@@ -15,6 +15,7 @@ import { CryptoReceiveSection } from "./common/CryptoReceiveSection.js";
15
15
  import { ErrorSection } from "./common/ErrorSection.js";
16
16
  import { FiatPaymentMethod, FiatPaymentMethodComponent } from "./common/FiatPaymentMethod.js";
17
17
  import { OrderDetails } from "./common/OrderDetails.js";
18
+ import { PointsDetailPanel } from "./common/PointsDetailPanel.js";
18
19
  import { RecipientSelection } from "./common/RecipientSelection.js";
19
20
  import { ArrowDown } from "lucide-react";
20
21
  import { PanelOnramp } from "./common/PanelOnramp.js";
@@ -27,7 +28,7 @@ export function AnySpendDepositHype(props) {
27
28
  const fingerprintConfig = getFingerprintConfig();
28
29
  return (_jsx(AnySpendFingerprintWrapper, { fingerprint: fingerprintConfig, children: _jsx(AnySpendDepositHypeInner, { ...props }) }));
29
30
  }
30
- function AnySpendDepositHypeInner({ loadOrder, mode = "modal", recipientAddress, paymentType = "crypto", sourceTokenAddress, sourceTokenChainId, onSuccess, mainFooter, }) {
31
+ function AnySpendDepositHypeInner({ loadOrder, mode = "modal", recipientAddress, paymentType = "crypto", sourceTokenAddress, sourceTokenChainId, onSuccess, mainFooter, onTokenSelect, }) {
31
32
  // Use shared flow hook
32
33
  const { activePanel, setActivePanel, orderId, setOrderId, oat, selectedSrcChainId, setSelectedSrcChainId, selectedSrcToken, setSelectedSrcToken, srcAmount, setSrcAmount, dstAmount, setIsSrcInputDirty, selectedCryptoPaymentMethod, setSelectedCryptoPaymentMethod, selectedFiatPaymentMethod, setSelectedFiatPaymentMethod, selectedRecipientAddress, setSelectedRecipientAddress, recipientName, globalAddress, anyspendQuote, isLoadingAnyspendQuote, getAnyspendQuoteError, activeInputAmountInWei, geoData, coinbaseAvailablePaymentMethods, stripeWeb2Support, createOrder, isCreatingOrder, createOnrampOrder, isCreatingOnrampOrder, } = useAnyspendFlow({
33
34
  paymentType,
@@ -111,10 +112,10 @@ function AnySpendDepositHypeInner({ loadOrder, mode = "modal", recipientAddress,
111
112
  await handleFiatOrder();
112
113
  }
113
114
  };
114
- const mainView = (_jsxs("div", { className: "mx-auto flex w-[460px] max-w-full flex-col items-center gap-2", children: [_jsx("div", { className: "mb-4 flex flex-col items-center gap-3 text-center", children: _jsx("div", { children: _jsx("h1", { className: "text-as-primary text-xl font-bold", children: paymentType === "crypto" ? "Deposit Crypto" : "Fund with Fiat" }) }) }), _jsx("div", { className: "relative flex w-full max-w-[calc(100vw-32px)] flex-col gap-2", children: _jsxs("div", { className: "relative flex w-full max-w-[calc(100vw-32px)] flex-col gap-2", children: [paymentType === "crypto" ? (_jsx(CryptoPaySection, { selectedSrcChainId: selectedSrcChainId, setSelectedSrcChainId: setSelectedSrcChainId, selectedSrcToken: selectedSrcToken, setSelectedSrcToken: setSelectedSrcToken, srcAmount: srcAmount, setSrcAmount: setSrcAmount, setIsSrcInputDirty: setIsSrcInputDirty, selectedCryptoPaymentMethod: selectedCryptoPaymentMethod, onSelectCryptoPaymentMethod: () => setActivePanel(PanelView.CRYPTO_PAYMENT_METHOD), anyspendQuote: anyspendQuote })) : (_jsx(motion.div, { initial: { opacity: 0, y: 20, filter: "blur(10px)" }, animate: { opacity: 1, y: 0, filter: "blur(0px)" }, transition: { duration: 0.3, delay: 0, ease: "easeInOut" }, children: _jsx(PanelOnramp, { srcAmountOnRamp: srcAmount, setSrcAmountOnRamp: setSrcAmount, selectedPaymentMethod: selectedFiatPaymentMethod, setActivePanel: setActivePanel, _recipientAddress: recipientAddress, destinationToken: B3_TOKEN, destinationChainId: base.id, dstTokenSymbol: HYPE_TOKEN_DETAILS.SYMBOL, hideDstToken: true, destinationAmount: dstAmount, onDestinationTokenChange: () => { }, onDestinationChainChange: () => { }, fiatPaymentMethodIndex: PanelView.FIAT_PAYMENT_METHOD, recipientSelectionPanelIndex: PanelView.RECIPIENT_SELECTION }) })), _jsx("div", { className: cn("relative -my-1 flex h-0 items-center justify-center", paymentType === "fiat" && "hidden"), children: _jsx(Button, { variant: "ghost", className: cn("swap-direction-button border-as-stroke bg-as-surface-primary z-10 h-10 w-10 cursor-default rounded-xl border-2 sm:h-8 sm:w-8 sm:rounded-xl"), children: _jsx("div", { className: "relative flex items-center justify-center transition-opacity", children: _jsx(ArrowDown, { className: "text-as-primary/50 h-5 w-5" }) }) }) }), paymentType === "crypto" && (_jsx(CryptoReceiveSection, { isDepositMode: false, isBuyMode: true, selectedRecipientAddress: recipientAddress, recipientName: recipientName || undefined, onSelectRecipient: () => setActivePanel(PanelView.RECIPIENT_SELECTION), dstAmount: dstAmount, dstToken: B3_TOKEN, dstTokenSymbol: HYPE_TOKEN_DETAILS.SYMBOL, dstTokenLogoURI: HYPE_TOKEN_DETAILS.LOGO_URI, selectedDstChainId: base.id, setSelectedDstChainId: () => { }, setSelectedDstToken: () => { }, onChangeDstAmount: value => {
115
+ const mainView = (_jsxs("div", { className: "mx-auto flex w-[460px] max-w-full flex-col items-center gap-2", children: [_jsx("div", { className: "mb-4 flex flex-col items-center gap-3 text-center", children: _jsx("div", { children: _jsx("h1", { className: "text-as-primary text-xl font-bold", children: paymentType === "crypto" ? "Deposit Crypto" : "Fund with Fiat" }) }) }), _jsx("div", { className: "relative flex w-full max-w-[calc(100vw-32px)] flex-col gap-2", children: _jsxs("div", { className: "relative flex w-full max-w-[calc(100vw-32px)] flex-col gap-2", children: [paymentType === "crypto" ? (_jsx(CryptoPaySection, { selectedSrcChainId: selectedSrcChainId, setSelectedSrcChainId: setSelectedSrcChainId, selectedSrcToken: selectedSrcToken, setSelectedSrcToken: setSelectedSrcToken, srcAmount: srcAmount, setSrcAmount: setSrcAmount, setIsSrcInputDirty: setIsSrcInputDirty, selectedCryptoPaymentMethod: selectedCryptoPaymentMethod, onSelectCryptoPaymentMethod: () => setActivePanel(PanelView.CRYPTO_PAYMENT_METHOD), anyspendQuote: anyspendQuote, onTokenSelect: onTokenSelect })) : (_jsx(motion.div, { initial: { opacity: 0, y: 20, filter: "blur(10px)" }, animate: { opacity: 1, y: 0, filter: "blur(0px)" }, transition: { duration: 0.3, delay: 0, ease: "easeInOut" }, children: _jsx(PanelOnramp, { srcAmountOnRamp: srcAmount, setSrcAmountOnRamp: setSrcAmount, selectedPaymentMethod: selectedFiatPaymentMethod, setActivePanel: setActivePanel, _recipientAddress: recipientAddress, destinationToken: B3_TOKEN, destinationChainId: base.id, dstTokenSymbol: HYPE_TOKEN_DETAILS.SYMBOL, hideDstToken: true, destinationAmount: dstAmount, onDestinationTokenChange: () => { }, onDestinationChainChange: () => { }, fiatPaymentMethodIndex: PanelView.FIAT_PAYMENT_METHOD, recipientSelectionPanelIndex: PanelView.RECIPIENT_SELECTION, anyspendQuote: anyspendQuote, onShowPointsDetail: () => setActivePanel(PanelView.POINTS_DETAIL) }) })), _jsx("div", { className: cn("relative -my-1 flex h-0 items-center justify-center", paymentType === "fiat" && "hidden"), children: _jsx(Button, { variant: "ghost", className: cn("swap-direction-button border-as-stroke bg-as-surface-primary z-10 h-10 w-10 cursor-default rounded-xl border-2 sm:h-8 sm:w-8 sm:rounded-xl"), children: _jsx("div", { className: "relative flex items-center justify-center transition-opacity", children: _jsx(ArrowDown, { className: "text-as-primary/50 h-5 w-5" }) }) }) }), paymentType === "crypto" && (_jsx(CryptoReceiveSection, { isDepositMode: false, isBuyMode: true, selectedRecipientAddress: recipientAddress, recipientName: recipientName || undefined, onSelectRecipient: () => setActivePanel(PanelView.RECIPIENT_SELECTION), dstAmount: dstAmount, dstToken: B3_TOKEN, dstTokenSymbol: HYPE_TOKEN_DETAILS.SYMBOL, dstTokenLogoURI: HYPE_TOKEN_DETAILS.LOGO_URI, selectedDstChainId: base.id, setSelectedDstChainId: () => { }, setSelectedDstToken: () => { }, onChangeDstAmount: value => {
115
116
  setIsSrcInputDirty(false);
116
117
  setSrcAmount(value);
117
- }, anyspendQuote: anyspendQuote }))] }) }), _jsx(ErrorSection, { error: getAnyspendQuoteError }), _jsx(motion.div, { initial: { opacity: 0, y: 20, filter: "blur(10px)" }, animate: { opacity: 1, y: 0, filter: "blur(0px)" }, transition: { duration: 0.3, delay: 0.2, ease: "easeInOut" }, className: cn("mt-4 flex w-full max-w-[460px] flex-col gap-2", getAnyspendQuoteError && "mt-0"), children: _jsx(ShinyButton, { accentColor: "hsl(var(--as-brand))", disabled: btnInfo.disable, onClick: onMainButtonClick, className: cn("as-main-button relative w-full", btnInfo.error ? "!bg-as-red" : btnInfo.disable ? "!bg-as-on-surface-2" : "!bg-as-brand"), textClassName: cn(btnInfo.error ? "text-white" : btnInfo.disable ? "text-as-secondary" : "text-white"), children: btnInfo.text }) }), mainFooter ? mainFooter : null] }));
118
+ }, anyspendQuote: anyspendQuote, onShowPointsDetail: () => setActivePanel(PanelView.POINTS_DETAIL) }))] }) }), _jsx(ErrorSection, { error: getAnyspendQuoteError }), _jsx(motion.div, { initial: { opacity: 0, y: 20, filter: "blur(10px)" }, animate: { opacity: 1, y: 0, filter: "blur(0px)" }, transition: { duration: 0.3, delay: 0.2, ease: "easeInOut" }, className: cn("mt-4 flex w-full max-w-[460px] flex-col gap-2", getAnyspendQuoteError && "mt-0"), children: _jsx(ShinyButton, { accentColor: "hsl(var(--as-brand))", disabled: btnInfo.disable, onClick: onMainButtonClick, className: cn("as-main-button relative w-full", btnInfo.error ? "!bg-as-red" : btnInfo.disable ? "!bg-as-on-surface-2" : "!bg-as-brand"), textClassName: cn(btnInfo.error ? "text-white" : btnInfo.disable ? "text-as-secondary" : "text-white"), children: btnInfo.text }) }), mainFooter ? mainFooter : null] }));
118
119
  // Handle crypto order creation
119
120
  const handleCryptoOrder = async () => {
120
121
  try {
@@ -211,6 +212,7 @@ function AnySpendDepositHypeInner({ loadOrder, mode = "modal", recipientAddress,
211
212
  setSelectedFiatPaymentMethod(method);
212
213
  setActivePanel(PanelView.MAIN);
213
214
  }, srcAmountOnRamp: srcAmount }));
215
+ const pointsDetailView = (_jsx(PointsDetailPanel, { pointsAmount: anyspendQuote?.data?.pointsAmount || 0, onBack: () => setActivePanel(PanelView.MAIN) }));
214
216
  // If showing token selection, render with panel transitions
215
217
  return (_jsx(StyleRoot, { children: _jsx("div", { className: cn("anyspend-container font-inter mx-auto w-full max-w-[460px]", mode === "page" &&
216
218
  "bg-as-surface-primary border-as-border-secondary overflow-hidden rounded-2xl border shadow-xl"), children: _jsx(TransitionPanel, { activeIndex: orderId
@@ -232,5 +234,6 @@ function AnySpendDepositHypeInner({ loadOrder, mode = "modal", recipientAddress,
232
234
  _jsx("div", { className: cn(mode === "page" && "p-6"), children: recipientSelectionView }, "recipient-selection-view"),
233
235
  _jsx("div", { className: cn(mode === "page" && "p-6"), children: orderDetailsView }, "order-details-view"),
234
236
  _jsx("div", { className: cn(mode === "page" && "p-6"), children: loadingView }, "loading-view"),
237
+ _jsx("div", { className: cn(mode === "page" && "p-6"), children: pointsDetailView }, "points-detail-view"),
235
238
  ] }) }) }));
236
239
  }
@@ -1,19 +1,21 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { RELAY_SOLANA_MAINNET_CHAIN_ID } from "../../../../anyspend/index.js";
4
- import { ShinyButton, useProfile } from "../../../../global-account/react/index.js";
4
+ import { ShinyButton, useAccountWallet, useProfile } from "../../../../global-account/react/index.js";
5
5
  import centerTruncate from "../../../../shared/utils/centerTruncate.js";
6
6
  import { formatTokenAmount } from "../../../../shared/utils/number.js";
7
7
  import { motion } from "framer-motion";
8
8
  import { ChevronRight, Loader2 } from "lucide-react";
9
- import { useAccount } from "wagmi";
10
9
  import { CryptoPaymentMethodType } from "./CryptoPaymentMethod.js";
11
10
  import { OrderDetailsCollapsible } from "./OrderDetailsCollapsible.js";
12
11
  import { PaymentMethodSwitch } from "./PaymentMethodSwitch.js";
13
12
  export default function ConnectWalletPayment({ order, onPayment, txLoading, isSwitchingOrExecuting, phantomWalletAddress, tournament, nft, cryptoPaymentMethod, onPaymentMethodChange, }) {
14
13
  const profile = useProfile({ address: order.recipientAddress });
15
14
  const recipientName = profile.data?.name?.replace(/\.b3\.fun/g, "");
16
- const { address: connectedAddress } = useAccount();
15
+ const { connectedEOAWallet, connectedSmartWallet } = useAccountWallet();
16
+ const connectedEvmAddress = cryptoPaymentMethod === CryptoPaymentMethodType.GLOBAL_WALLET
17
+ ? connectedSmartWallet?.getAccount()?.address
18
+ : connectedEOAWallet?.getAccount()?.address;
17
19
  const srcToken = order.metadata.srcToken;
18
20
  const dstToken = order.metadata.dstToken;
19
21
  const expectedDstAmount = order.type === "mint_nft" ||
@@ -32,5 +34,5 @@ export default function ConnectWalletPayment({ order, onPayment, txLoading, isSw
32
34
  ? "Pay from Global Account"
33
35
  : "Pay from Connected Wallet" }), _jsx(ChevronRight, { className: "h-4 w-4" })] })) }), _jsxs("span", { className: "label-style text-as-primary/50 text-xs", children: ["Connected to:", " ", order.srcChain === RELAY_SOLANA_MAINNET_CHAIN_ID && phantomWalletAddress
34
36
  ? centerTruncate(phantomWalletAddress, 6)
35
- : centerTruncate(connectedAddress || "")] }), _jsx(PaymentMethodSwitch, { currentMethod: cryptoPaymentMethod, onMethodChange: onPaymentMethodChange }), _jsx("div", { className: "mt-4", children: _jsx(OrderDetailsCollapsible, { order: order, dstToken: dstToken, tournament: tournament, nft: nft, recipientName: recipientName, formattedExpectedDstAmount: formattedExpectedDstAmount }) })] }) }));
37
+ : centerTruncate(connectedEvmAddress || "")] }), _jsx(PaymentMethodSwitch, { currentMethod: cryptoPaymentMethod, onMethodChange: onPaymentMethodChange }), _jsx("div", { className: "mt-4", children: _jsx(OrderDetailsCollapsible, { order: order, dstToken: dstToken, tournament: tournament, nft: nft, recipientName: recipientName, formattedExpectedDstAmount: formattedExpectedDstAmount }) })] }) }));
36
38
  }
@@ -11,6 +11,9 @@ interface CryptoPaySectionProps {
11
11
  selectedCryptoPaymentMethod: CryptoPaymentMethodType;
12
12
  onSelectCryptoPaymentMethod: () => void;
13
13
  anyspendQuote?: any;
14
+ onTokenSelect?: (token: components["schemas"]["Token"], event: {
15
+ preventDefault: () => void;
16
+ }) => void;
14
17
  }
15
- export declare function CryptoPaySection({ selectedSrcChainId, setSelectedSrcChainId, selectedSrcToken, setSelectedSrcToken, srcAmount, setSrcAmount, setIsSrcInputDirty, selectedCryptoPaymentMethod, onSelectCryptoPaymentMethod, anyspendQuote, }: CryptoPaySectionProps): import("react/jsx-runtime").JSX.Element;
18
+ export declare function CryptoPaySection({ selectedSrcChainId, setSelectedSrcChainId, selectedSrcToken, setSelectedSrcToken, srcAmount, setSrcAmount, setIsSrcInputDirty, selectedCryptoPaymentMethod, onSelectCryptoPaymentMethod, anyspendQuote, onTokenSelect, }: CryptoPaySectionProps): import("react/jsx-runtime").JSX.Element;
16
19
  export {};
@@ -6,18 +6,18 @@ import { formatDisplayNumber } from "../../../../shared/utils/number.js";
6
6
  import { ChevronRight } from "lucide-react";
7
7
  import { motion } from "motion/react";
8
8
  import { useEffect, useRef } from "react";
9
- import { useAccount } from "wagmi";
10
9
  import { CryptoPaymentMethodType } from "./CryptoPaymentMethod.js";
11
10
  import { OrderTokenAmount } from "./OrderTokenAmount.js";
12
11
  import { TokenBalance } from "./TokenBalance.js";
13
- export function CryptoPaySection({ selectedSrcChainId, setSelectedSrcChainId, selectedSrcToken, setSelectedSrcToken, srcAmount, setSrcAmount, setIsSrcInputDirty, selectedCryptoPaymentMethod, onSelectCryptoPaymentMethod, anyspendQuote, }) {
14
- const { address: connectedAddress, isConnected } = useAccount();
15
- const { data: profileData } = useProfile({ address: connectedAddress });
16
- const connectedName = profileData?.displayName;
17
- const { address: globalAddress } = useAccountWallet();
12
+ export function CryptoPaySection({ selectedSrcChainId, setSelectedSrcChainId, selectedSrcToken, setSelectedSrcToken, srcAmount, setSrcAmount, setIsSrcInputDirty, selectedCryptoPaymentMethod, onSelectCryptoPaymentMethod, anyspendQuote, onTokenSelect, }) {
13
+ const { connectedSmartWallet, connectedEOAWallet } = useAccountWallet();
18
14
  const { data: srcTokenMetadata } = useTokenData(selectedSrcToken?.chainId, selectedSrcToken?.address);
19
15
  // Determine which address to use based on payment method
20
- const walletAddress = selectedCryptoPaymentMethod === CryptoPaymentMethodType.GLOBAL_WALLET ? globalAddress : connectedAddress;
16
+ const walletAddress = selectedCryptoPaymentMethod === CryptoPaymentMethodType.GLOBAL_WALLET
17
+ ? connectedSmartWallet?.getAccount()?.address
18
+ : connectedEOAWallet?.getAccount()?.address || connectedSmartWallet?.getAccount()?.address;
19
+ const { data: profileData } = useProfile({ address: walletAddress });
20
+ const connectedName = profileData?.displayName;
21
21
  // Add ref to track if we've applied metadata
22
22
  const appliedSrcMetadataRef = useRef(false);
23
23
  // Update source token with metadata
@@ -42,10 +42,10 @@ export function CryptoPaySection({ selectedSrcChainId, setSelectedSrcChainId, se
42
42
  useEffect(() => {
43
43
  appliedSrcMetadataRef.current = false;
44
44
  }, [selectedSrcToken.address, selectedSrcToken.chainId]);
45
- return (_jsxs(motion.div, { initial: { opacity: 0, y: 20, filter: "blur(10px)" }, animate: { opacity: 1, y: 0, filter: "blur(0px)" }, transition: { duration: 0.3, delay: 0, ease: "easeInOut" }, className: "pay-section bg-as-surface-secondary border-as-border-secondary relative flex w-full flex-col gap-2 rounded-2xl border p-4 sm:p-6", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("div", { className: "text-as-primary/50 flex h-7 items-center text-sm", children: "Pay" }), _jsx("button", { className: "text-as-tertiarry flex h-7 items-center gap-2 text-sm transition-colors focus:!outline-none", onClick: onSelectCryptoPaymentMethod, children: selectedCryptoPaymentMethod === CryptoPaymentMethodType.CONNECT_WALLET ? (_jsxs(_Fragment, { children: [isConnected ? (_jsx("div", { className: "flex items-center gap-1", children: connectedName ? formatUsername(connectedName) : shortenAddress(connectedAddress || "") })) : ("Connect wallet"), _jsx(ChevronRight, { className: "h-4 w-4" })] })) : selectedCryptoPaymentMethod === CryptoPaymentMethodType.GLOBAL_WALLET ? (_jsxs(_Fragment, { children: ["Global Account", _jsx(ChevronRight, { className: "h-4 w-4" })] })) : selectedCryptoPaymentMethod === CryptoPaymentMethodType.TRANSFER_CRYPTO ? (_jsxs(_Fragment, { children: ["Transfer crypto", _jsx(ChevronRight, { className: "h-4 w-4" })] })) : (_jsxs(_Fragment, { children: ["Select payment method", _jsx(ChevronRight, { className: "h-4 w-4" })] })) })] }), _jsx(OrderTokenAmount, { address: walletAddress, context: "from", inputValue: srcAmount, onChangeInput: value => {
45
+ return (_jsxs(motion.div, { initial: { opacity: 0, y: 20, filter: "blur(10px)" }, animate: { opacity: 1, y: 0, filter: "blur(0px)" }, transition: { duration: 0.3, delay: 0, ease: "easeInOut" }, className: "pay-section bg-as-surface-secondary border-as-border-secondary relative flex w-full flex-col gap-2 rounded-2xl border p-4 sm:p-6", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("div", { className: "text-as-primary/50 flex h-7 items-center text-sm", children: "Pay" }), _jsx("button", { className: "text-as-tertiarry flex h-7 items-center gap-2 text-sm transition-colors focus:!outline-none", onClick: onSelectCryptoPaymentMethod, children: selectedCryptoPaymentMethod === CryptoPaymentMethodType.CONNECT_WALLET ? (_jsxs(_Fragment, { children: [walletAddress ? (_jsx("div", { className: "flex items-center gap-1", children: connectedName ? formatUsername(connectedName) : shortenAddress(walletAddress || "") })) : ("Connect wallet"), _jsx(ChevronRight, { className: "h-4 w-4" })] })) : selectedCryptoPaymentMethod === CryptoPaymentMethodType.GLOBAL_WALLET ? (_jsxs(_Fragment, { children: ["Global Account", _jsx(ChevronRight, { className: "h-4 w-4" })] })) : selectedCryptoPaymentMethod === CryptoPaymentMethodType.TRANSFER_CRYPTO ? (_jsxs(_Fragment, { children: ["Transfer crypto", _jsx(ChevronRight, { className: "h-4 w-4" })] })) : (_jsxs(_Fragment, { children: ["Select payment method", _jsx(ChevronRight, { className: "h-4 w-4" })] })) })] }), _jsx(OrderTokenAmount, { address: walletAddress, context: "from", inputValue: srcAmount, onChangeInput: value => {
46
46
  setIsSrcInputDirty(true);
47
47
  setSrcAmount(value);
48
- }, chainId: selectedSrcChainId, setChainId: setSelectedSrcChainId, token: selectedSrcToken, setToken: setSelectedSrcToken }), _jsxs("div", { className: "flex items-center justify-between", children: [_jsx("div", { className: "text-as-primary/50 flex h-5 items-center text-sm", children: formatDisplayNumber(anyspendQuote?.data?.currencyIn?.amountUsd, {
48
+ }, chainId: selectedSrcChainId, setChainId: setSelectedSrcChainId, token: selectedSrcToken, setToken: setSelectedSrcToken, onTokenSelect: onTokenSelect }), _jsxs("div", { className: "flex items-center justify-between", children: [_jsx("div", { className: "text-as-primary/50 flex h-5 items-center text-sm", children: formatDisplayNumber(anyspendQuote?.data?.currencyIn?.amountUsd, {
49
49
  style: "currency",
50
50
  fallback: "",
51
51
  }) }), _jsx(TokenBalance, { token: selectedSrcToken, walletAddress: walletAddress, onChangeInput: value => {