@b3dotfun/sdk 0.0.30 → 0.0.31

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 (150) hide show
  1. package/dist/cjs/anyspend/react/components/AnySpend.js +1 -1
  2. package/dist/cjs/anyspend/react/components/AnySpendBuySpin.js +2 -1
  3. package/dist/cjs/anyspend/react/components/AnySpendStakeB3.js +2 -1
  4. package/dist/cjs/anyspend/react/components/AnyspendDepositHype.d.ts +4 -0
  5. package/dist/cjs/anyspend/react/components/AnyspendDepositHype.js +6 -1
  6. package/dist/cjs/anyspend/react/components/common/ChainTokenIcon.d.ts +1 -1
  7. package/dist/cjs/anyspend/react/components/common/ChainTokenIcon.js +2 -1
  8. package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.js +23 -28
  9. package/dist/cjs/anyspend/react/components/common/CryptoReceiveSection.d.ts +3 -1
  10. package/dist/cjs/anyspend/react/components/common/CryptoReceiveSection.js +2 -2
  11. package/dist/cjs/anyspend/react/components/common/OrderDetails.js +5 -5
  12. package/dist/cjs/anyspend/react/components/common/OrderTokenAmount.js +1 -1
  13. package/dist/cjs/anyspend/react/components/common/PanelOnramp.d.ts +4 -1
  14. package/dist/cjs/anyspend/react/components/common/PanelOnramp.js +3 -3
  15. package/dist/cjs/anyspend/react/components/common/PaySection.js +1 -1
  16. package/dist/cjs/global-account/react/components/B3DynamicModal.js +2 -5
  17. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +5 -0
  18. package/dist/cjs/global-account/react/components/LinkAccount/LinkAccount.js +1 -0
  19. package/dist/cjs/global-account/react/components/ManageAccount/BalanceContent.d.ts +6 -0
  20. package/dist/cjs/global-account/react/components/ManageAccount/BalanceContent.js +94 -0
  21. package/dist/cjs/global-account/react/components/ManageAccount/ContentTokens.d.ts +14 -0
  22. package/dist/cjs/global-account/react/components/ManageAccount/ContentTokens.js +272 -0
  23. package/dist/cjs/global-account/react/components/ManageAccount/ManageAccount.js +9 -51
  24. package/dist/cjs/global-account/react/components/ManageAccount/TokenBalanceRow.d.ts +10 -0
  25. package/dist/cjs/global-account/react/components/ManageAccount/TokenBalanceRow.js +8 -0
  26. package/dist/cjs/global-account/react/components/TokenIcon.d.ts +11 -0
  27. package/dist/cjs/global-account/react/components/TokenIcon.js +43 -0
  28. package/dist/cjs/global-account/react/components/ui/accordion.d.ts +7 -0
  29. package/dist/cjs/global-account/react/components/ui/accordion.js +53 -0
  30. package/dist/cjs/global-account/react/components/ui/dialog.js +1 -1
  31. package/dist/cjs/global-account/react/hooks/index.d.ts +2 -0
  32. package/dist/cjs/global-account/react/hooks/index.js +5 -1
  33. package/dist/cjs/global-account/react/hooks/useAnalytics.d.ts +7 -0
  34. package/dist/cjs/global-account/react/hooks/useAnalytics.js +29 -0
  35. package/dist/cjs/global-account/react/hooks/useB3BalanceFromAddresses.js +2 -1
  36. package/dist/cjs/global-account/react/hooks/useNativeBalance.js +2 -1
  37. package/dist/cjs/global-account/react/hooks/useSimBalance.d.ts +24 -0
  38. package/dist/cjs/global-account/react/hooks/useSimBalance.js +29 -0
  39. package/dist/cjs/global-account/react/hooks/useUnifiedChainSwitchAndExecute.js +2 -1
  40. package/dist/cjs/global-account/react/stores/useModalStore.d.ts +2 -2
  41. package/dist/cjs/global-account/react/utils/profileDisplay.js +9 -0
  42. package/dist/cjs/global-account/utils/analytics.d.ts +16 -0
  43. package/dist/cjs/global-account/utils/analytics.js +55 -0
  44. package/dist/cjs/shared/constants/index.d.ts +1 -0
  45. package/dist/cjs/shared/constants/index.js +2 -1
  46. package/dist/cjs/shared/generated/chain-networks.json +185 -17
  47. package/dist/esm/anyspend/react/components/AnySpend.js +1 -1
  48. package/dist/esm/anyspend/react/components/AnySpendBuySpin.js +2 -1
  49. package/dist/esm/anyspend/react/components/AnySpendStakeB3.js +2 -1
  50. package/dist/esm/anyspend/react/components/AnyspendDepositHype.d.ts +4 -0
  51. package/dist/esm/anyspend/react/components/AnyspendDepositHype.js +5 -1
  52. package/dist/esm/anyspend/react/components/common/ChainTokenIcon.d.ts +1 -1
  53. package/dist/esm/anyspend/react/components/common/ChainTokenIcon.js +2 -1
  54. package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.js +22 -27
  55. package/dist/esm/anyspend/react/components/common/CryptoReceiveSection.d.ts +3 -1
  56. package/dist/esm/anyspend/react/components/common/CryptoReceiveSection.js +2 -2
  57. package/dist/esm/anyspend/react/components/common/OrderDetails.js +5 -5
  58. package/dist/esm/anyspend/react/components/common/OrderTokenAmount.js +1 -1
  59. package/dist/esm/anyspend/react/components/common/PanelOnramp.d.ts +4 -1
  60. package/dist/esm/anyspend/react/components/common/PanelOnramp.js +4 -4
  61. package/dist/esm/anyspend/react/components/common/PaySection.js +1 -1
  62. package/dist/esm/global-account/react/components/B3DynamicModal.js +2 -5
  63. package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +5 -0
  64. package/dist/esm/global-account/react/components/LinkAccount/LinkAccount.js +1 -0
  65. package/dist/esm/global-account/react/components/ManageAccount/BalanceContent.d.ts +6 -0
  66. package/dist/esm/global-account/react/components/ManageAccount/BalanceContent.js +88 -0
  67. package/dist/esm/global-account/react/components/ManageAccount/ContentTokens.d.ts +14 -0
  68. package/dist/esm/global-account/react/components/ManageAccount/ContentTokens.js +266 -0
  69. package/dist/esm/global-account/react/components/ManageAccount/ManageAccount.js +12 -51
  70. package/dist/esm/global-account/react/components/ManageAccount/TokenBalanceRow.d.ts +10 -0
  71. package/dist/esm/global-account/react/components/ManageAccount/TokenBalanceRow.js +5 -0
  72. package/dist/esm/global-account/react/components/TokenIcon.d.ts +11 -0
  73. package/dist/esm/global-account/react/components/TokenIcon.js +37 -0
  74. package/dist/esm/global-account/react/components/ui/accordion.d.ts +7 -0
  75. package/dist/esm/global-account/react/components/ui/accordion.js +14 -0
  76. package/dist/esm/global-account/react/components/ui/dialog.js +1 -1
  77. package/dist/esm/global-account/react/hooks/index.d.ts +2 -0
  78. package/dist/esm/global-account/react/hooks/index.js +2 -0
  79. package/dist/esm/global-account/react/hooks/useAnalytics.d.ts +7 -0
  80. package/dist/esm/global-account/react/hooks/useAnalytics.js +26 -0
  81. package/dist/esm/global-account/react/hooks/useB3BalanceFromAddresses.js +2 -1
  82. package/dist/esm/global-account/react/hooks/useNativeBalance.js +2 -1
  83. package/dist/esm/global-account/react/hooks/useSimBalance.d.ts +24 -0
  84. package/dist/esm/global-account/react/hooks/useSimBalance.js +26 -0
  85. package/dist/esm/global-account/react/hooks/useUnifiedChainSwitchAndExecute.js +2 -1
  86. package/dist/esm/global-account/react/stores/useModalStore.d.ts +2 -2
  87. package/dist/esm/global-account/react/utils/profileDisplay.js +9 -0
  88. package/dist/esm/global-account/utils/analytics.d.ts +16 -0
  89. package/dist/esm/global-account/utils/analytics.js +50 -0
  90. package/dist/esm/shared/constants/index.d.ts +1 -0
  91. package/dist/esm/shared/constants/index.js +1 -0
  92. package/dist/esm/shared/generated/chain-networks.json +185 -17
  93. package/dist/styles/index.css +1 -1
  94. package/dist/types/anyspend/react/components/AnyspendDepositHype.d.ts +4 -0
  95. package/dist/types/anyspend/react/components/common/ChainTokenIcon.d.ts +1 -1
  96. package/dist/types/anyspend/react/components/common/CryptoReceiveSection.d.ts +3 -1
  97. package/dist/types/anyspend/react/components/common/PanelOnramp.d.ts +4 -1
  98. package/dist/types/global-account/react/components/ManageAccount/BalanceContent.d.ts +6 -0
  99. package/dist/types/global-account/react/components/ManageAccount/ContentTokens.d.ts +14 -0
  100. package/dist/types/global-account/react/components/ManageAccount/TokenBalanceRow.d.ts +10 -0
  101. package/dist/types/global-account/react/components/TokenIcon.d.ts +11 -0
  102. package/dist/types/global-account/react/components/ui/accordion.d.ts +7 -0
  103. package/dist/types/global-account/react/hooks/index.d.ts +2 -0
  104. package/dist/types/global-account/react/hooks/useAnalytics.d.ts +7 -0
  105. package/dist/types/global-account/react/hooks/useSimBalance.d.ts +24 -0
  106. package/dist/types/global-account/react/stores/useModalStore.d.ts +2 -2
  107. package/dist/types/global-account/utils/analytics.d.ts +16 -0
  108. package/dist/types/shared/constants/index.d.ts +1 -0
  109. package/package.json +10 -18
  110. package/src/anyspend/react/components/AnySpend.tsx +1 -0
  111. package/src/anyspend/react/components/AnySpendBuySpin.tsx +2 -1
  112. package/src/anyspend/react/components/AnySpendStakeB3.tsx +3 -2
  113. package/src/anyspend/react/components/AnyspendDepositHype.tsx +10 -0
  114. package/src/anyspend/react/components/AnyspendSignatureMint.tsx +4 -4
  115. package/src/anyspend/react/components/common/ChainTokenIcon.tsx +8 -2
  116. package/src/anyspend/react/components/common/CryptoPaymentMethod.tsx +56 -107
  117. package/src/anyspend/react/components/common/CryptoReceiveSection.tsx +12 -3
  118. package/src/anyspend/react/components/common/OrderDetails.tsx +5 -5
  119. package/src/anyspend/react/components/common/OrderTokenAmount.tsx +2 -2
  120. package/src/anyspend/react/components/common/PanelOnramp.tsx +11 -5
  121. package/src/anyspend/react/components/common/PaySection.tsx +1 -1
  122. package/src/global-account/react/components/B3DynamicModal.tsx +8 -7
  123. package/src/global-account/react/components/B3Provider/B3Provider.tsx +6 -0
  124. package/src/global-account/react/components/LinkAccount/LinkAccount.tsx +2 -1
  125. package/src/global-account/react/components/ManageAccount/BalanceContent.tsx +228 -0
  126. package/src/global-account/react/components/ManageAccount/ContentTokens.tsx +568 -0
  127. package/src/global-account/react/components/ManageAccount/ManageAccount.tsx +86 -341
  128. package/src/global-account/react/components/ManageAccount/TokenBalanceRow.tsx +46 -0
  129. package/src/global-account/react/components/TokenIcon.tsx +87 -0
  130. package/src/global-account/react/components/ui/accordion.tsx +53 -0
  131. package/src/global-account/react/components/ui/dialog.tsx +1 -1
  132. package/src/global-account/react/hooks/index.ts +2 -0
  133. package/src/global-account/react/hooks/useAccountAssets.ts +1 -0
  134. package/src/global-account/react/hooks/useAnalytics.tsx +30 -0
  135. package/src/global-account/react/hooks/useB3BalanceFromAddresses.ts +3 -2
  136. package/src/global-account/react/hooks/useNativeBalance.tsx +2 -1
  137. package/src/global-account/react/hooks/useSimBalance.ts +56 -0
  138. package/src/global-account/react/hooks/useUnifiedChainSwitchAndExecute.ts +3 -1
  139. package/src/global-account/react/stores/useModalStore.ts +2 -2
  140. package/src/global-account/react/utils/profileDisplay.ts +9 -0
  141. package/src/global-account/utils/analytics.ts +64 -0
  142. package/src/shared/constants/index.ts +2 -0
  143. package/src/shared/generated/chain-networks.json +185 -17
  144. package/src/{anyspend/types → types}/window.d.ts +5 -1
  145. package/dist/cjs/index.d.ts +0 -0
  146. package/dist/cjs/index.js +0 -2
  147. package/dist/esm/index.d.ts +0 -0
  148. package/dist/esm/index.js +0 -2
  149. package/dist/types/index.d.ts +0 -0
  150. package/src/index.ts +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@b3dotfun/sdk",
3
- "version": "0.0.30",
3
+ "version": "0.0.31",
4
4
  "source": "src/index.ts",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "react-native": "./dist/cjs/index.native.js",
@@ -237,8 +237,7 @@
237
237
  "constants"
238
238
  ],
239
239
  "dependencies": {
240
- "@amplitude/analytics-browser": "2.14.0",
241
- "@b3dotfun/b3-api": "0.0.42",
240
+ "@b3dotfun/b3-api": "0.0.43",
242
241
  "@b3dotfun/basement-api": "0.0.11",
243
242
  "@chakra-ui/react": "2.10.7",
244
243
  "@feathersjs/authentication-client": "5.0.33",
@@ -258,7 +257,6 @@
258
257
  "@radix-ui/react-tooltip": "1.1.8",
259
258
  "@reservoir0x/relay-kit-ui": "2.15.11",
260
259
  "@reservoir0x/relay-sdk": "2.3.1",
261
- "@reservoir0x/reservoir-kit-ui": "2.8.7",
262
260
  "@solana/spl-token": "^0.4.13",
263
261
  "@solana/web3.js": "^1.98.2",
264
262
  "@stripe/react-stripe-js": "^3.7.0",
@@ -270,26 +268,20 @@
270
268
  "clsx": "2.0.0",
271
269
  "cmdk": "1.0.0",
272
270
  "cssnano": "^7.0.7",
271
+ "debug": "^4.4.1",
273
272
  "invariant": "2.2.4",
274
273
  "js-cookie": "3.0.5",
275
- "lodash": "4.17.21",
276
274
  "lucide-react": "0.424.0",
277
275
  "motion": "^12.23.11",
278
- "motion-number": "0.1.7",
279
276
  "qrcode.react": "4.2.0",
280
277
  "react-intersection-observer": "9.16.0",
281
278
  "react-number-format": "5.4.3",
282
279
  "react-timeago": "8.2.0",
283
280
  "socket.io-client": "4.7.5",
284
281
  "sonner": "1.7.4",
285
- "stripe": "18.2.1",
286
282
  "tailwind-merge": "2.6.0",
287
- "thirdweb": "5.105.20",
288
283
  "typescript": "5.8.2",
289
284
  "vaul": "^1.1.2",
290
- "viem": "2.28.1",
291
- "wagmi": "2.14.15",
292
- "zod": "3.25.51",
293
285
  "zustand": "4.5.6"
294
286
  },
295
287
  "devDependencies": {
@@ -300,7 +292,6 @@
300
292
  "@types/big.js": "^6.2.2",
301
293
  "@types/invariant": "2.2.37",
302
294
  "@types/js-cookie": "3.0.6",
303
- "@types/lodash": "4",
304
295
  "@types/node": "22.14.0",
305
296
  "@types/react": "19.1.0",
306
297
  "@types/react-dom": "19.1.1",
@@ -313,7 +304,6 @@
313
304
  "eslint-plugin-import": "2.x.x",
314
305
  "eslint-plugin-react-hooks": "4.6.2",
315
306
  "eslint-plugin-tailwindcss": "3.18.0",
316
- "openapi-typescript": "7.4.2",
317
307
  "postcss": "8.5.3",
318
308
  "postcss-cli": "11.0.1",
319
309
  "postcss-nesting": "^13.0.2",
@@ -333,14 +323,16 @@
333
323
  "peerDependencies": {
334
324
  "@fingerprintjs/fingerprintjs-pro-react": "^2.7.0",
335
325
  "@privy-io/react-auth": "^2.8.0",
336
- "@react-three/postprocessing": "2.16.6",
337
- "@readyplayerme/visage": "6.10.0",
338
- "@tanstack/react-query": "5.55.0",
326
+ "@react-three/postprocessing": "^2.16.6",
327
+ "@readyplayerme/visage": "^6.10.0",
328
+ "@tanstack/react-query": ">=5.55.0",
339
329
  "react": "^18.0.0 || ^19.0.0",
340
330
  "react-dom": "^18.0.0 || ^19.0.0",
341
331
  "react-native-mmkv": "^3.2.0",
342
- "thirdweb": "5.105.20",
343
- "three": "0.175.0"
332
+ "thirdweb": "^5.105.20",
333
+ "three": "^0.175.0",
334
+ "wagmi": "^2.14.15",
335
+ "viem": "^2.28.1"
344
336
  },
345
337
  "peerDependenciesMeta": {
346
338
  "@react-three/postprocessing": {
@@ -889,6 +889,7 @@ function AnySpendInner({
889
889
  onDestinationTokenChange={setSelectedDstToken}
890
890
  onDestinationChainChange={setSelectedDstChainId}
891
891
  fiatPaymentMethodIndex={PanelView.FIAT_PAYMENT_METHOD}
892
+ recipientSelectionPanelIndex={PanelView.RECIPIENT_SELECTION}
892
893
  />
893
894
  </motion.div>
894
895
  )}
@@ -10,6 +10,7 @@ import {
10
10
  useTokenBalance,
11
11
  useUnifiedChainSwitchAndExecute,
12
12
  } from "@b3dotfun/sdk/global-account/react";
13
+ import { PUBLIC_BASE_RPC_URL } from "@b3dotfun/sdk/shared/constants";
13
14
  import { baseMainnet } from "@b3dotfun/sdk/shared/constants/chains/supported";
14
15
  import invariant from "invariant";
15
16
  import { ArrowRight, Loader2 } from "lucide-react";
@@ -117,7 +118,7 @@ function generateEncodedDataForBuyEntriesAndSpin(user: string, quantity: string)
117
118
 
118
119
  const basePublicClient = createPublicClient({
119
120
  chain: baseMainnet,
120
- transport: http(),
121
+ transport: http(PUBLIC_BASE_RPC_URL),
121
122
  });
122
123
 
123
124
  export function AnySpendBuySpin({
@@ -10,6 +10,7 @@ import {
10
10
  useTokenBalance,
11
11
  useUnifiedChainSwitchAndExecute,
12
12
  } from "@b3dotfun/sdk/global-account/react";
13
+ import { PUBLIC_BASE_RPC_URL } from "@b3dotfun/sdk/shared/constants";
13
14
  import { formatTokenAmount } from "@b3dotfun/sdk/shared/utils/number";
14
15
  import invariant from "invariant";
15
16
  import { ArrowRight, Loader2 } from "lucide-react";
@@ -26,7 +27,7 @@ import { UsdcIcon } from "./icons/USDCIcon";
26
27
 
27
28
  const basePublicClient = createPublicClient({
28
29
  chain: base,
29
- transport: http(),
30
+ transport: http(PUBLIC_BASE_RPC_URL),
30
31
  });
31
32
 
32
33
  const ERC20Staking = "0xbf04200be3cbf371467a539706393c81c470f523";
@@ -36,7 +37,7 @@ function generateEncodedDataForStakingB3(amount: string, beneficiary: string): s
36
37
  const encodedData = encodeFunctionData({
37
38
  abi: ABI_ERC20_STAKING,
38
39
  functionName: "stake",
39
- args: [BigInt(amount), beneficiary],
40
+ args: [BigInt(amount), beneficiary as `0x${string}`],
40
41
  });
41
42
  return encodedData;
42
43
  }
@@ -24,6 +24,11 @@ import { PanelOnramp } from "./common/PanelOnramp";
24
24
 
25
25
  const SLIPPAGE_PERCENT = 3;
26
26
 
27
+ export const HYPE_TOKEN_DETAILS = {
28
+ SYMBOL: "HYPE",
29
+ LOGO_URI: "https://cdn.hypeduel.com/hypes-coin.svg",
30
+ };
31
+
27
32
  function generateEncodedDataForDepositHype(amount: string, beneficiary: string): string {
28
33
  invariant(BigInt(amount) > 0, "Amount must be greater than zero");
29
34
  const encodedData = encodeFunctionData({
@@ -228,10 +233,13 @@ function AnySpendDepositHypeInner({
228
233
  _recipientAddress={recipientAddress}
229
234
  destinationToken={B3_TOKEN}
230
235
  destinationChainId={base.id}
236
+ dstTokenSymbol={HYPE_TOKEN_DETAILS.SYMBOL}
237
+ hideDstToken
231
238
  destinationAmount={dstAmount}
232
239
  onDestinationTokenChange={() => {}}
233
240
  onDestinationChainChange={() => {}}
234
241
  fiatPaymentMethodIndex={PanelView.FIAT_PAYMENT_METHOD}
242
+ recipientSelectionPanelIndex={PanelView.RECIPIENT_SELECTION}
235
243
  />
236
244
  </motion.div>
237
245
  )}
@@ -262,6 +270,8 @@ function AnySpendDepositHypeInner({
262
270
  onSelectRecipient={() => setActivePanel(PanelView.RECIPIENT_SELECTION)}
263
271
  dstAmount={dstAmount}
264
272
  dstToken={B3_TOKEN}
273
+ dstTokenSymbol={HYPE_TOKEN_DETAILS.SYMBOL}
274
+ dstTokenLogoURI={HYPE_TOKEN_DETAILS.LOGO_URI}
265
275
  selectedDstChainId={base.id}
266
276
  setSelectedDstChainId={() => {}}
267
277
  setSelectedDstToken={() => {}}
@@ -18,15 +18,15 @@ function generateEncodedDataForSignatureMint(signatureData: GenerateSigMintRespo
18
18
  invariant(payload, "Payload is required");
19
19
 
20
20
  const mintRequest = {
21
- to: payload.to,
22
- royaltyRecipient: payload.royaltyRecipient,
21
+ to: payload.to as `0x${string}`,
22
+ royaltyRecipient: payload.royaltyRecipient as `0x${string}`,
23
23
  royaltyBps: BigInt(payload.royaltyBps || 0),
24
- primarySaleRecipient: payload.primarySaleRecipient,
24
+ primarySaleRecipient: payload.primarySaleRecipient as `0x${string}`,
25
25
  tokenId: BigInt(payload.tokenId || 0),
26
26
  uri: payload.uri,
27
27
  quantity: BigInt(payload.quantity || 1),
28
28
  pricePerToken: parseEther(payload.price?.toString() || "0"),
29
- currency: payload.currencyAddress,
29
+ currency: payload.currencyAddress as `0x${string}`,
30
30
  validityStartTimestamp: BigInt(payload.mintStartTime || 0),
31
31
  validityEndTimestamp: BigInt(payload.mintEndTime || 0),
32
32
  uid: payload.uid as `0x${string}`,
@@ -1,15 +1,21 @@
1
+ import { HelpCircle } from "lucide-react";
2
+
1
3
  export function ChainTokenIcon({
2
4
  chainUrl,
3
5
  tokenUrl,
4
6
  className = "",
5
7
  }: {
6
8
  chainUrl: string;
7
- tokenUrl: string;
9
+ tokenUrl?: string;
8
10
  className?: string;
9
11
  }) {
10
12
  return (
11
13
  <div className={`relative ${className}`}>
12
- <img src={tokenUrl} alt="Token" className="h-full w-full rounded-full" />
14
+ {tokenUrl ? (
15
+ <img src={tokenUrl} alt="Token" className="h-full w-full rounded-full" />
16
+ ) : (
17
+ <HelpCircle className="text-b3-react-foreground h-full w-full" />
18
+ )}
13
19
  <div className="bg-as-on-surface-1 border-as-stroke absolute bottom-0 right-0 h-[45%] w-[45%] rounded border">
14
20
  <img src={chainUrl} alt="Chain" className="h-full w-full rounded" />
15
21
  </div>
@@ -3,6 +3,7 @@
3
3
  import { useAccountWallet } from "@b3dotfun/sdk/global-account/react";
4
4
  import { cn } from "@b3dotfun/sdk/shared/utils/cn";
5
5
  import { shortenAddress } from "@b3dotfun/sdk/shared/utils/formatAddress";
6
+ import { WalletCoinbase, WalletMetamask, WalletPhantom, WalletRainbow, WalletWalletConnect } from "@web3icons/react";
6
7
  import { ChevronLeft, ChevronRightCircle, Wallet, X, ZapIcon } from "lucide-react";
7
8
  import { useState } from "react";
8
9
  import { createPortal } from "react-dom";
@@ -42,12 +43,10 @@ export function CryptoPaymentMethod({
42
43
  const { disconnect } = useDisconnect();
43
44
  const { data: walletClient } = useWalletClient();
44
45
  const [showWalletModal, setShowWalletModal] = useState(false);
45
- const [selectedWalletConnector, setSelectedWalletConnector] = useState<any>(null);
46
- const [modalStep, setModalStep] = useState<"wallet-selection" | "account-selection">("wallet-selection");
47
46
 
48
47
  // Define available wallet connectors
49
48
  const availableConnectors = connectors.filter(connector =>
50
- ["MetaMask", "WalletConnect", "Coinbase Wallet", "Rainbow"].includes(connector.name),
49
+ ["MetaMask", "WalletConnect", "Coinbase Wallet", "Rainbow", "Phantom"].includes(connector.name),
51
50
  );
52
51
 
53
52
  // Define wallet options with icons and info
@@ -55,38 +54,43 @@ export function CryptoPaymentMethod({
55
54
  {
56
55
  id: "metamask",
57
56
  name: "MetaMask",
58
- icon: "🦊",
57
+ icon: <WalletMetamask size={48} />,
59
58
  description: "Connect using MetaMask browser extension",
60
59
  connector: availableConnectors.find(c => c.name === "MetaMask"),
61
60
  },
62
61
  {
63
62
  id: "coinbase",
64
63
  name: "Coinbase Wallet",
65
- icon: "🔵",
64
+ icon: <WalletCoinbase size={48} />,
66
65
  description: "Connect using Coinbase Wallet",
67
66
  connector: availableConnectors.find(c => c.name === "Coinbase Wallet"),
68
67
  },
69
68
  {
70
69
  id: "rainbow",
71
70
  name: "Rainbow",
72
- icon: "🌈",
71
+ icon: <WalletRainbow size={48} />,
73
72
  description: "Connect using Rainbow wallet",
74
73
  connector: availableConnectors.find(c => c.name === "Rainbow"),
75
74
  },
76
75
  {
77
76
  id: "walletconnect",
78
77
  name: "WalletConnect",
79
- icon: "🔗",
78
+ icon: <WalletWalletConnect size={48} />,
80
79
  description: "Connect using WalletConnect protocol",
81
80
  connector: availableConnectors.find(c => c.name === "WalletConnect"),
82
81
  },
82
+ {
83
+ id: "phantom",
84
+ name: "Phantom",
85
+ icon: <WalletPhantom size={48} />,
86
+ description: "Connect using Phantom wallet",
87
+ connector: availableConnectors.find(c => c.name === "Phantom"),
88
+ },
83
89
  ].filter(wallet => wallet.connector); // Only show wallets that have available connectors
84
90
 
85
91
  // Reset modal state when closing
86
92
  const handleCloseModal = () => {
87
93
  setShowWalletModal(false);
88
- setModalStep("wallet-selection");
89
- setSelectedWalletConnector(null);
90
94
  };
91
95
 
92
96
  // Function to request wallet permissions for specific wallet
@@ -258,24 +262,12 @@ export function CryptoPaymentMethod({
258
262
  {/* Wallet Connection Modal */}
259
263
  {showWalletModal &&
260
264
  createPortal(
261
- <div className="pointer-events-auto fixed inset-0 z-[9999] flex items-center justify-center bg-black/50">
265
+ <div className="wallet-connection-modal pointer-events-auto fixed inset-0 z-[9999] flex items-center justify-center bg-black/50">
262
266
  <div className="max-h-[80vh] w-[400px] max-w-[90vw] overflow-auto rounded-xl bg-white p-6 dark:bg-gray-900">
263
267
  <div className="mb-4 flex items-center justify-between">
264
- <div className="flex items-center gap-2">
265
- {modalStep === "account-selection" && (
266
- <button
267
- onClick={() => setModalStep("wallet-selection")}
268
- className="text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200"
269
- >
270
- <ChevronLeft className="h-5 w-5" />
271
- </button>
272
- )}
273
- <h3 className="text-lg font-semibold text-gray-900 dark:text-white">
274
- {modalStep === "wallet-selection"
275
- ? "Select a payment method"
276
- : `Connect ${selectedWalletConnector?.name}`}
277
- </h3>
278
- </div>
268
+ <h3 className="text-lg font-semibold text-gray-900 dark:text-white">
269
+ {isConnected ? "Switch wallet or account" : "Choose wallet to connect"}
270
+ </h3>
279
271
  <button
280
272
  onClick={handleCloseModal}
281
273
  className="text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200"
@@ -285,94 +277,51 @@ export function CryptoPaymentMethod({
285
277
  </div>
286
278
 
287
279
  <div className="space-y-4">
288
- {modalStep === "wallet-selection" ? (
289
- <>
290
- {/* Custom wallet options */}
291
- <div className="space-y-3">
292
- <h4 className="text-sm font-medium text-gray-700 dark:text-gray-300">
293
- {isConnected ? "Switch wallet or account" : "Choose wallet to connect"}
294
- </h4>
295
- {walletOptions.map(walletOption => {
296
- const isCurrentWallet = isConnected && connector?.name === walletOption.connector?.name;
280
+ {/* Custom wallet options */}
281
+ <div className="space-y-3">
282
+ {walletOptions.map(walletOption => {
283
+ const isCurrentWallet = isConnected && connector?.name === walletOption.connector?.name;
297
284
 
298
- return (
299
- <button
300
- key={walletOption.id}
301
- onClick={async () => {
302
- setSelectedWalletConnector(walletOption.connector);
303
- setModalStep("account-selection");
304
- }}
305
- disabled={isPending}
306
- className={`w-full rounded-xl border p-4 text-left transition-all hover:shadow-md disabled:opacity-50 ${
307
- isCurrentWallet
308
- ? "border-blue-500 bg-blue-50 dark:bg-blue-900/20"
309
- : "border-gray-200 bg-white hover:border-gray-300 dark:border-gray-600 dark:bg-gray-800 dark:hover:border-gray-500"
310
- }`}
311
- >
312
- <div className="flex items-center justify-between">
313
- <div className="flex items-center gap-3">
314
- <div
315
- className={`flex h-12 w-12 items-center justify-center rounded-xl text-xl ${
316
- isCurrentWallet ? "bg-blue-100 dark:bg-blue-800" : "bg-gray-100 dark:bg-gray-700"
317
- }`}
318
- >
319
- {walletOption.icon}
320
- </div>
321
- <div>
322
- <div className="flex items-center gap-2">
323
- <div className="text-sm font-semibold text-gray-900 dark:text-white">
324
- {walletOption.name}
325
- </div>
326
- {isCurrentWallet && (
327
- <span className="rounded-full bg-blue-100 px-2 py-0.5 text-xs font-medium text-blue-700 dark:bg-blue-800 dark:text-blue-200">
328
- Connected
329
- </span>
330
- )}
331
- </div>
332
- <div className="text-xs text-gray-500 dark:text-gray-400">
333
- {isCurrentWallet ? "Switch account or reconnect" : walletOption.description}
334
- </div>
285
+ return (
286
+ <button
287
+ key={walletOption.id}
288
+ onClick={async () => {
289
+ handleCloseModal();
290
+ await requestWalletPermissions(walletOption.connector);
291
+ }}
292
+ disabled={isPending}
293
+ className={`wallet-option w-full rounded-xl border p-4 text-left transition-all hover:shadow-md disabled:opacity-50 ${
294
+ isCurrentWallet
295
+ ? "wallet-option--active border-blue-500 bg-blue-50 dark:bg-blue-900/20"
296
+ : "border-gray-200 bg-white hover:border-gray-300 dark:border-gray-600 dark:bg-gray-800 dark:hover:border-gray-500"
297
+ }`}
298
+ >
299
+ <div className="flex items-center justify-between">
300
+ <div className="flex items-center gap-3">
301
+ {walletOption.icon}
302
+
303
+ <div>
304
+ <div className="wallet-option-name flex items-center gap-2">
305
+ <div className="text-sm font-semibold text-gray-900 dark:text-white">
306
+ {walletOption.name}
335
307
  </div>
308
+ {isCurrentWallet && (
309
+ <span className="rounded-full bg-blue-100 px-2 py-0.5 text-xs font-medium text-blue-700 dark:bg-blue-800 dark:text-blue-200">
310
+ Connected
311
+ </span>
312
+ )}
313
+ </div>
314
+ <div className="text-xs text-gray-500 dark:text-gray-400">
315
+ {isCurrentWallet ? "Switch account or reconnect" : walletOption.description}
336
316
  </div>
337
- <ChevronRightCircle className="h-5 w-5 text-gray-400" />
338
317
  </div>
339
- </button>
340
- );
341
- })}
342
- </div>
343
- </>
344
- ) : (
345
- /* Account Selection Step */
346
- <div className="space-y-4">
347
- <p className="text-sm text-gray-600 dark:text-gray-400">
348
- Connect to {selectedWalletConnector?.name} to view available accounts
349
- </p>
350
- <button
351
- onClick={async () => {
352
- handleCloseModal();
353
- await requestWalletPermissions(selectedWalletConnector);
354
- }}
355
- disabled={isPending}
356
- className="w-full rounded-lg border border-gray-200 bg-white p-4 text-center transition-all hover:border-gray-300 hover:shadow-md disabled:opacity-50 dark:border-gray-600 dark:bg-gray-800 dark:hover:border-gray-500"
357
- >
358
- <div className="flex items-center justify-center gap-3">
359
- <div className="flex h-10 w-10 items-center justify-center rounded-lg bg-gray-100 dark:bg-gray-700">
360
- <Wallet className="h-5 w-5 text-gray-600 dark:text-gray-400" />
361
- </div>
362
- <div>
363
- <div className="text-sm font-medium text-gray-900 dark:text-white">
364
- {isPending
365
- ? `Connecting to ${selectedWalletConnector?.name}...`
366
- : `Connect ${selectedWalletConnector?.name}`}
367
- </div>
368
- <div className="text-xs text-gray-500 dark:text-gray-400">
369
- {isPending ? "Please check your wallet" : "Click to connect and select account"}
370
318
  </div>
319
+ <ChevronRightCircle className="h-5 w-5 text-gray-400" />
371
320
  </div>
372
- </div>
373
- </button>
374
- </div>
375
- )}
321
+ </button>
322
+ );
323
+ })}
324
+ </div>
376
325
  </div>
377
326
  </div>
378
327
  </div>,
@@ -24,6 +24,9 @@ interface CryptoReceiveSectionProps {
24
24
  onChangeDstAmount?: (value: string) => void;
25
25
  // Quote data
26
26
  anyspendQuote?: any;
27
+ // custom dst token data
28
+ dstTokenSymbol?: string;
29
+ dstTokenLogoURI?: string;
27
30
  }
28
31
 
29
32
  export function CryptoReceiveSection({
@@ -39,6 +42,8 @@ export function CryptoReceiveSection({
39
42
  setSelectedDstToken,
40
43
  onChangeDstAmount,
41
44
  anyspendQuote,
45
+ dstTokenSymbol,
46
+ dstTokenLogoURI,
42
47
  }: CryptoReceiveSectionProps) {
43
48
  return (
44
49
  <motion.div
@@ -72,10 +77,14 @@ export function CryptoReceiveSection({
72
77
  <div className="flex items-center justify-between">
73
78
  <div className="text-as-primary text-2xl font-bold">{dstAmount || "0"}</div>
74
79
  <div className="bg-as-brand/10 border-as-brand/30 flex items-center gap-3 rounded-xl border px-4 py-3">
75
- {dstToken.metadata?.logoURI && (
76
- <img src={dstToken.metadata.logoURI} alt={dstToken.symbol} className="h-8 w-8 rounded-full" />
80
+ {(dstTokenLogoURI || dstToken.metadata?.logoURI) && (
81
+ <img
82
+ src={dstTokenLogoURI || dstToken.metadata?.logoURI}
83
+ alt={dstTokenSymbol || dstToken.symbol}
84
+ className="h-8 w-8 rounded-full"
85
+ />
77
86
  )}
78
- <span className="text-as-brand text-lg font-bold">{dstToken.symbol}</span>
87
+ <span className="text-as-brand text-lg font-bold">{dstTokenSymbol || dstToken.symbol}</span>
79
88
  </div>
80
89
  </div>
81
90
  ) : (
@@ -595,7 +595,7 @@ export const OrderDetails = memo(function OrderDetails({
595
595
  </div>
596
596
  )}
597
597
  <button
598
- className="bg-as-brand flex w-full items-center justify-center gap-2 rounded-lg p-2 font-semibold text-white"
598
+ className="order-close-button bg-as-brand flex w-full items-center justify-center gap-2 rounded-lg p-2 font-semibold text-white"
599
599
  onClick={mode === "page" ? handleBack : handleCloseModal}
600
600
  >
601
601
  {mode === "page" ? (
@@ -682,7 +682,7 @@ export const OrderDetails = memo(function OrderDetails({
682
682
  <a
683
683
  href={getExplorerTxUrl(order.dstChain, executeTx.txHash)}
684
684
  target="_blank"
685
- className="text-as-primary/70 hover:text-as-primary"
685
+ className="order-success-text text-as-primary/70 hover:text-as-primary"
686
686
  style={{ whiteSpace: "normal" }} // Don't know why but class can't override.
687
687
  >
688
688
  {getOrderSuccessText({
@@ -713,7 +713,7 @@ export const OrderDetails = memo(function OrderDetails({
713
713
 
714
714
  {order.status === "executed" && (
715
715
  <button
716
- className="bg-as-brand flex w-full items-center justify-center gap-2 rounded-lg p-2 font-semibold text-white"
716
+ className="order-close-button bg-as-brand flex w-full items-center justify-center gap-2 rounded-lg p-2 font-semibold text-white"
717
717
  onClick={mode === "page" ? handleBack : handleCloseModal}
718
718
  >
719
719
  {mode === "page" ? (
@@ -825,7 +825,7 @@ export const OrderDetails = memo(function OrderDetails({
825
825
  <a
826
826
  href={getExplorerTxUrl(order.dstChain, relayTx.txHash)}
827
827
  target="_blank"
828
- className="text-as-primary/70 hover:text-as-primary"
828
+ className="order-success-text text-as-primary/70 hover:text-as-primary"
829
829
  style={{ whiteSpace: "normal" }}
830
830
  >
831
831
  {getOrderSuccessText({
@@ -856,7 +856,7 @@ export const OrderDetails = memo(function OrderDetails({
856
856
 
857
857
  {order.status === "executed" && (
858
858
  <button
859
- className="bg-as-brand flex w-full items-center justify-center gap-2 rounded-lg p-2 font-semibold text-white"
859
+ className="order-close-button bg-as-brand flex w-full items-center justify-center gap-2 rounded-lg p-2 font-semibold text-white"
860
860
  onClick={mode === "page" ? handleBack : handleCloseModal}
861
861
  >
862
862
  {mode === "page" ? (
@@ -5,11 +5,11 @@ import { useEffect, useRef } from "react";
5
5
  import { NumericFormat } from "react-number-format";
6
6
 
7
7
  import { ALL_CHAINS, RELAY_SOLANA_MAINNET_CHAIN_ID } from "@b3dotfun/sdk/anyspend";
8
+ import { components } from "@b3dotfun/sdk/anyspend/types/api";
8
9
  import { Button } from "@b3dotfun/sdk/global-account/react";
9
10
  import { cn } from "@b3dotfun/sdk/shared/utils";
10
11
  import { TokenSelector } from "@reservoir0x/relay-kit-ui";
11
12
  import { ChainTokenIcon } from "./ChainTokenIcon";
12
- import { components } from "@b3dotfun/sdk/anyspend/types/api";
13
13
 
14
14
  export function OrderTokenAmount({
15
15
  disabled,
@@ -140,7 +140,7 @@ export function OrderTokenAmount({
140
140
  variant="outline"
141
141
  role="combobox"
142
142
  className={cn(
143
- "bg-b3-react-background border-as-stroke flex h-auto w-fit shrink-0 items-center justify-center gap-2 rounded-xl border-2 px-2 py-1 pr-2 text-center",
143
+ "token-selector-button bg-b3-react-background border-as-stroke flex h-auto w-fit shrink-0 items-center justify-center gap-2 rounded-xl border-2 px-2 py-1 pr-2 text-center",
144
144
  tokenSelectClassName,
145
145
  )}
146
146
  >
@@ -2,7 +2,7 @@ import { useCoinbaseOnrampOptions, useGeoOnrampOptions } from "@b3dotfun/sdk/any
2
2
  import { components } from "@b3dotfun/sdk/anyspend/types/api";
3
3
  import { ALL_CHAINS } from "@b3dotfun/sdk/anyspend/utils/chain";
4
4
  import { Input, useGetGeo, useProfile } from "@b3dotfun/sdk/global-account/react";
5
- import { formatUsername } from "@b3dotfun/sdk/shared/utils";
5
+ import { cn, formatUsername } from "@b3dotfun/sdk/shared/utils";
6
6
  import { formatAddress } from "@b3dotfun/sdk/shared/utils/formatAddress";
7
7
  import { ChevronRight, Wallet } from "lucide-react";
8
8
  import { useRef } from "react";
@@ -22,6 +22,9 @@ export function PanelOnramp({
22
22
  onDestinationTokenChange,
23
23
  onDestinationChainChange,
24
24
  fiatPaymentMethodIndex,
25
+ recipientSelectionPanelIndex,
26
+ dstTokenSymbol,
27
+ hideDstToken = false,
25
28
  }: {
26
29
  srcAmountOnRamp: string;
27
30
  setSrcAmountOnRamp: (amount: string) => void;
@@ -34,6 +37,9 @@ export function PanelOnramp({
34
37
  onDestinationTokenChange?: (token: components["schemas"]["Token"]) => void;
35
38
  onDestinationChainChange?: (chainId: number) => void;
36
39
  fiatPaymentMethodIndex: number;
40
+ recipientSelectionPanelIndex: number;
41
+ dstTokenSymbol?: string;
42
+ hideDstToken?: boolean;
37
43
  }) {
38
44
  // Get geo-based onramp options to access fee information
39
45
  const { stripeWeb2Support } = useGeoOnrampOptions(srcAmountOnRamp);
@@ -161,7 +167,7 @@ export function PanelOnramp({
161
167
  </div>
162
168
 
163
169
  {/* Quick Amount Buttons */}
164
- <div className="mx-auto mb-6 inline-grid grid-cols-4 gap-2">
170
+ <div className={cn("mx-auto mb-6 inline-grid grid-cols-4 gap-2", hideDstToken && "mb-0")}>
165
171
  {["5", "10", "20", "25"].map(value => (
166
172
  <button
167
173
  key={value}
@@ -178,7 +184,7 @@ export function PanelOnramp({
178
184
  </div>
179
185
 
180
186
  {/* Token Display */}
181
- {destinationToken && destinationChainId && (
187
+ {destinationToken && destinationChainId && !hideDstToken && (
182
188
  <OrderTokenAmountFiat
183
189
  address={_recipientAddress}
184
190
  context="to"
@@ -199,7 +205,7 @@ export function PanelOnramp({
199
205
  {_recipientAddress ? (
200
206
  <button
201
207
  className="text-as-tertiarry flex h-7 items-center gap-1 text-sm transition-colors hover:text-blue-700"
202
- onClick={() => setActivePanel(5)} // Recipient selection panel
208
+ onClick={() => setActivePanel(recipientSelectionPanelIndex)} // Recipient selection panel
203
209
  >
204
210
  <span className="text-sm">
205
211
  {recipientName ? formatUsername(recipientName) : formatAddress(_recipientAddress)}
@@ -224,7 +230,7 @@ export function PanelOnramp({
224
230
  <span className="text-as-tertiarry text-sm">Expected to receive</span>
225
231
  <div className="flex items-center gap-2">
226
232
  <span className="text-as-primary font-semibold">
227
- {destinationAmount || "0"} {destinationToken?.symbol || ""}
233
+ {destinationAmount || "0"} {dstTokenSymbol || destinationToken?.symbol || ""}
228
234
  </span>
229
235
  <span className="text-as-tertiarry text-sm">
230
236
  on {destinationChainId ? ALL_CHAINS[destinationChainId]?.name : ""}
@@ -84,7 +84,7 @@ export function PaySection({
84
84
  initial={{ opacity: 0, y: 20, filter: "blur(10px)" }}
85
85
  animate={{ opacity: 1, y: 0, filter: "blur(0px)" }}
86
86
  transition={{ duration: 0.3, delay: 0, ease: "easeInOut" }}
87
- className="bg-as-surface-secondary border-as-border-secondary relative flex w-full flex-col gap-2 rounded-2xl border p-4 sm:p-6"
87
+ 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"
88
88
  >
89
89
  <div className="flex items-center justify-between">
90
90
  <div className="text-as-primary/50 flex h-7 items-center text-sm">Pay</div>