@b3dotfun/sdk 0.0.46 → 0.0.47-test.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (174) hide show
  1. package/README.md +6 -225
  2. package/dist/cjs/anyspend/react/components/AnySpend.js +13 -14
  3. package/dist/cjs/anyspend/react/components/AnyspendDepositHype.js +14 -15
  4. package/dist/cjs/anyspend/react/components/common/OrderHistory.js +2 -2
  5. package/dist/cjs/anyspend/react/components/common/OrderHistoryItem.js +6 -3
  6. package/dist/cjs/anyspend/types/api.d.ts +176 -0
  7. package/dist/cjs/anyspend/utils/chain.js +1 -1
  8. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.d.ts +3 -2
  9. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +15 -64
  10. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.native.d.ts +6 -2
  11. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.native.js +26 -21
  12. package/dist/cjs/global-account/react/components/B3Provider/types.d.ts +2 -0
  13. package/dist/cjs/global-account/react/components/B3Provider/types.js +2 -0
  14. package/dist/cjs/global-account/react/components/ManageAccount/BalanceContent.d.ts +1 -2
  15. package/dist/cjs/global-account/react/components/ManageAccount/BalanceContent.js +2 -2
  16. package/dist/cjs/global-account/react/components/ManageAccount/ManageAccount.js +1 -1
  17. package/dist/cjs/global-account/react/components/SignInWithB3/SignIn.js +2 -2
  18. package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3.js +1 -1
  19. package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Flow.d.ts +1 -1
  20. package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +6 -22
  21. package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Privy.d.ts +1 -2
  22. package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Privy.js +3 -2
  23. package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStep.d.ts +1 -2
  24. package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStep.js +10 -45
  25. package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStepCustom.d.ts +1 -2
  26. package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStepCustom.js +2 -1
  27. package/dist/cjs/global-account/react/components/custom/ManageAccountButton.js +2 -1
  28. package/dist/cjs/global-account/react/hooks/useAuthentication.d.ts +51 -2
  29. package/dist/cjs/global-account/react/hooks/useAuthentication.js +134 -84
  30. package/dist/cjs/global-account/react/hooks/useHandleConnectWithPrivy.d.ts +1 -1
  31. package/dist/cjs/global-account/react/hooks/useHandleConnectWithPrivy.js +2 -1
  32. package/dist/cjs/global-account/react/hooks/useUserQuery.d.ts +58 -0
  33. package/dist/cjs/global-account/react/hooks/useUserQuery.js +86 -0
  34. package/dist/cjs/global-account/react/hooks/useWagmiConfig.d.ts +13 -0
  35. package/dist/cjs/global-account/react/hooks/useWagmiConfig.js +42 -0
  36. package/dist/cjs/global-account/react/stores/useModalStore.d.ts +0 -2
  37. package/dist/cjs/shared/react/hooks/__tests__/useCurrencyConversion.test.js +245 -0
  38. package/dist/cjs/shared/utils/index.d.ts +0 -1
  39. package/dist/cjs/shared/utils/index.js +0 -1
  40. package/dist/esm/anyspend/react/components/AnySpend.js +14 -15
  41. package/dist/esm/anyspend/react/components/AnyspendDepositHype.js +15 -16
  42. package/dist/esm/anyspend/react/components/common/OrderHistory.js +2 -2
  43. package/dist/esm/anyspend/react/components/common/OrderHistoryItem.js +8 -5
  44. package/dist/esm/anyspend/types/api.d.ts +176 -0
  45. package/dist/esm/anyspend/utils/chain.js +1 -1
  46. package/dist/esm/global-account/react/components/B3Provider/B3Provider.d.ts +3 -2
  47. package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +19 -68
  48. package/dist/esm/global-account/react/components/B3Provider/B3Provider.native.d.ts +6 -2
  49. package/dist/esm/global-account/react/components/B3Provider/B3Provider.native.js +24 -19
  50. package/dist/esm/global-account/react/components/B3Provider/types.d.ts +2 -0
  51. package/dist/esm/global-account/react/components/B3Provider/types.js +2 -0
  52. package/dist/esm/global-account/react/components/ManageAccount/BalanceContent.d.ts +1 -2
  53. package/dist/esm/global-account/react/components/ManageAccount/BalanceContent.js +2 -2
  54. package/dist/esm/global-account/react/components/ManageAccount/ManageAccount.js +1 -1
  55. package/dist/esm/global-account/react/components/SignInWithB3/SignIn.js +2 -2
  56. package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3.js +2 -2
  57. package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Flow.d.ts +1 -1
  58. package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +7 -23
  59. package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Privy.d.ts +1 -2
  60. package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Privy.js +4 -3
  61. package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStep.d.ts +1 -2
  62. package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStep.js +11 -46
  63. package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStepCustom.d.ts +1 -2
  64. package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStepCustom.js +3 -2
  65. package/dist/esm/global-account/react/components/custom/ManageAccountButton.js +3 -2
  66. package/dist/esm/global-account/react/hooks/useAuthentication.d.ts +51 -2
  67. package/dist/esm/global-account/react/hooks/useAuthentication.js +137 -87
  68. package/dist/esm/global-account/react/hooks/useHandleConnectWithPrivy.d.ts +1 -1
  69. package/dist/esm/global-account/react/hooks/useHandleConnectWithPrivy.js +3 -2
  70. package/dist/esm/global-account/react/hooks/useUserQuery.d.ts +58 -0
  71. package/dist/esm/global-account/react/hooks/useUserQuery.js +83 -0
  72. package/dist/esm/global-account/react/hooks/useWagmiConfig.d.ts +13 -0
  73. package/dist/esm/global-account/react/hooks/useWagmiConfig.js +39 -0
  74. package/dist/esm/global-account/react/stores/useModalStore.d.ts +0 -2
  75. package/dist/esm/shared/react/hooks/__tests__/useCurrencyConversion.test.d.ts +1 -0
  76. package/dist/esm/shared/react/hooks/__tests__/useCurrencyConversion.test.js +243 -0
  77. package/dist/esm/shared/utils/index.d.ts +0 -1
  78. package/dist/esm/shared/utils/index.js +0 -1
  79. package/dist/styles/index.css +1 -1
  80. package/dist/types/anyspend/types/api.d.ts +176 -0
  81. package/dist/types/global-account/react/components/B3Provider/B3Provider.d.ts +3 -2
  82. package/dist/types/global-account/react/components/B3Provider/B3Provider.native.d.ts +6 -2
  83. package/dist/types/global-account/react/components/B3Provider/types.d.ts +2 -0
  84. package/dist/types/global-account/react/components/ManageAccount/BalanceContent.d.ts +1 -2
  85. package/dist/types/global-account/react/components/SignInWithB3/SignInWithB3Flow.d.ts +1 -1
  86. package/dist/types/global-account/react/components/SignInWithB3/SignInWithB3Privy.d.ts +1 -2
  87. package/dist/types/global-account/react/components/SignInWithB3/steps/LoginStep.d.ts +1 -2
  88. package/dist/types/global-account/react/components/SignInWithB3/steps/LoginStepCustom.d.ts +1 -2
  89. package/dist/types/global-account/react/hooks/useAuthentication.d.ts +51 -2
  90. package/dist/types/global-account/react/hooks/useHandleConnectWithPrivy.d.ts +1 -1
  91. package/dist/types/global-account/react/hooks/useUserQuery.d.ts +58 -0
  92. package/dist/types/global-account/react/hooks/useWagmiConfig.d.ts +13 -0
  93. package/dist/types/global-account/react/stores/useModalStore.d.ts +0 -2
  94. package/dist/types/shared/react/hooks/__tests__/useCurrencyConversion.test.d.ts +1 -0
  95. package/dist/types/shared/utils/index.d.ts +0 -1
  96. package/package.json +4 -23
  97. package/src/anyspend/react/components/AnySpend.tsx +21 -19
  98. package/src/anyspend/react/components/AnyspendDepositHype.tsx +21 -21
  99. package/src/anyspend/react/components/common/OrderHistory.tsx +11 -11
  100. package/src/anyspend/react/components/common/OrderHistoryItem.tsx +124 -129
  101. package/src/anyspend/types/api.ts +176 -0
  102. package/src/anyspend/utils/chain.ts +1 -4
  103. package/src/global-account/react/components/B3Provider/B3Provider.native.tsx +51 -35
  104. package/src/global-account/react/components/B3Provider/B3Provider.tsx +28 -72
  105. package/src/global-account/react/components/B3Provider/types.ts +4 -0
  106. package/src/global-account/react/components/ManageAccount/BalanceContent.tsx +2 -3
  107. package/src/global-account/react/components/ManageAccount/ManageAccount.tsx +1 -1
  108. package/src/global-account/react/components/SignInWithB3/SignIn.tsx +2 -2
  109. package/src/global-account/react/components/SignInWithB3/SignInWithB3.tsx +2 -2
  110. package/src/global-account/react/components/SignInWithB3/SignInWithB3Flow.tsx +4 -23
  111. package/src/global-account/react/components/SignInWithB3/SignInWithB3Privy.tsx +4 -3
  112. package/src/global-account/react/components/SignInWithB3/steps/LoginStep.tsx +8 -46
  113. package/src/global-account/react/components/SignInWithB3/steps/LoginStepCustom.tsx +2 -2
  114. package/src/global-account/react/components/custom/ManageAccountButton.tsx +3 -2
  115. package/src/global-account/react/hooks/useAuthentication.ts +159 -90
  116. package/src/global-account/react/hooks/useHandleConnectWithPrivy.tsx +3 -2
  117. package/src/global-account/react/hooks/useUserQuery.ts +95 -0
  118. package/src/global-account/react/hooks/useWagmiConfig.tsx +44 -0
  119. package/src/global-account/react/stores/useModalStore.ts +0 -2
  120. package/src/shared/utils/index.ts +0 -1
  121. package/dist/cjs/anyspend/react/components/common/ErrorSection.d.ts +0 -6
  122. package/dist/cjs/anyspend/react/components/common/ErrorSection.js +0 -12
  123. package/dist/cjs/notifications/index.d.ts +0 -3
  124. package/dist/cjs/notifications/index.js +0 -25
  125. package/dist/cjs/notifications/react/hooks/index.d.ts +0 -1
  126. package/dist/cjs/notifications/react/hooks/index.js +0 -17
  127. package/dist/cjs/notifications/react/hooks/useNotifications.d.ts +0 -42
  128. package/dist/cjs/notifications/react/hooks/useNotifications.js +0 -148
  129. package/dist/cjs/notifications/react/index.d.ts +0 -1
  130. package/dist/cjs/notifications/react/index.js +0 -17
  131. package/dist/cjs/notifications/services/api.d.ts +0 -67
  132. package/dist/cjs/notifications/services/api.js +0 -184
  133. package/dist/cjs/notifications/services/index.d.ts +0 -1
  134. package/dist/cjs/notifications/services/index.js +0 -17
  135. package/dist/cjs/notifications/types/index.d.ts +0 -51
  136. package/dist/cjs/notifications/types/index.js +0 -2
  137. package/dist/cjs/shared/utils/auth-token.d.ts +0 -7
  138. package/dist/cjs/shared/utils/auth-token.js +0 -17
  139. package/dist/esm/anyspend/react/components/common/ErrorSection.d.ts +0 -6
  140. package/dist/esm/anyspend/react/components/common/ErrorSection.js +0 -9
  141. package/dist/esm/notifications/index.d.ts +0 -3
  142. package/dist/esm/notifications/index.js +0 -7
  143. package/dist/esm/notifications/react/hooks/index.d.ts +0 -1
  144. package/dist/esm/notifications/react/hooks/index.js +0 -1
  145. package/dist/esm/notifications/react/hooks/useNotifications.d.ts +0 -42
  146. package/dist/esm/notifications/react/hooks/useNotifications.js +0 -145
  147. package/dist/esm/notifications/react/index.d.ts +0 -1
  148. package/dist/esm/notifications/react/index.js +0 -1
  149. package/dist/esm/notifications/services/api.d.ts +0 -67
  150. package/dist/esm/notifications/services/api.js +0 -179
  151. package/dist/esm/notifications/services/index.d.ts +0 -1
  152. package/dist/esm/notifications/services/index.js +0 -1
  153. package/dist/esm/notifications/types/index.d.ts +0 -51
  154. package/dist/esm/shared/utils/auth-token.d.ts +0 -7
  155. package/dist/esm/shared/utils/auth-token.js +0 -11
  156. package/dist/types/anyspend/react/components/common/ErrorSection.d.ts +0 -6
  157. package/dist/types/notifications/index.d.ts +0 -3
  158. package/dist/types/notifications/react/hooks/index.d.ts +0 -1
  159. package/dist/types/notifications/react/hooks/useNotifications.d.ts +0 -42
  160. package/dist/types/notifications/react/index.d.ts +0 -1
  161. package/dist/types/notifications/services/api.d.ts +0 -67
  162. package/dist/types/notifications/services/index.d.ts +0 -1
  163. package/dist/types/notifications/types/index.d.ts +0 -51
  164. package/dist/types/shared/utils/auth-token.d.ts +0 -7
  165. package/src/anyspend/react/components/common/ErrorSection.tsx +0 -21
  166. package/src/notifications/index.ts +0 -9
  167. package/src/notifications/react/hooks/index.ts +0 -1
  168. package/src/notifications/react/hooks/useNotifications.ts +0 -153
  169. package/src/notifications/react/index.ts +0 -1
  170. package/src/notifications/services/api.ts +0 -217
  171. package/src/notifications/services/index.ts +0 -1
  172. package/src/notifications/types/index.ts +0 -58
  173. package/src/shared/utils/auth-token.ts +0 -13
  174. /package/dist/{esm/notifications/types/index.js → cjs/shared/react/hooks/__tests__/useCurrencyConversion.test.d.ts} +0 -0
@@ -32,8 +32,6 @@ export interface SignInWithB3ModalProps extends BaseModalProps {
32
32
  sessionKeyAddress?: Address;
33
33
  /** Unique identifier for the partner application */
34
34
  partnerId: string;
35
- /** Whether to authenticate with Sign In With Ethereum */
36
- loginWithSiwe?: boolean;
37
35
  /** Whether to close the modal after successful login */
38
36
  closeAfterLogin?: boolean;
39
37
  /** Source of the sign-in request */
@@ -1,4 +1,3 @@
1
- export * from "./auth-token";
2
1
  export * from "./cn";
3
2
  export * from "./formatNumber";
4
3
  export * from "./formatUsername";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@b3dotfun/sdk",
3
- "version": "0.0.46",
3
+ "version": "0.0.47-test.4",
4
4
  "source": "src/index.ts",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "react-native": "./dist/cjs/index.native.js",
@@ -170,26 +170,6 @@
170
170
  "import": "./dist/esm/global-account/server.js",
171
171
  "require": "./dist/cjs/global-account/server.js"
172
172
  },
173
- "./notifications": {
174
- "types": "./dist/types/notifications/index.d.ts",
175
- "import": "./dist/esm/notifications/index.js",
176
- "require": "./dist/cjs/notifications/index.js"
177
- },
178
- "./notifications/react": {
179
- "types": "./dist/types/notifications/react/index.d.ts",
180
- "import": "./dist/esm/notifications/react/index.js",
181
- "require": "./dist/cjs/notifications/react/index.js"
182
- },
183
- "./notifications/services": {
184
- "types": "./dist/types/notifications/services/index.d.ts",
185
- "import": "./dist/esm/notifications/services/index.js",
186
- "require": "./dist/cjs/notifications/services/index.js"
187
- },
188
- "./notifications/types": {
189
- "types": "./dist/types/notifications/types/index.d.ts",
190
- "import": "./dist/esm/notifications/types/index.js",
191
- "require": "./dist/cjs/notifications/types/index.js"
192
- },
193
173
  "./shared/utils": {
194
174
  "types": "./dist/types/shared/utils/index.d.ts",
195
175
  "import": "./dist/esm/shared/utils/index.js",
@@ -301,7 +281,7 @@
301
281
  "@solana/web3.js": "^1.98.2",
302
282
  "@stripe/react-stripe-js": "^3.7.0",
303
283
  "@stripe/stripe-js": "^7.3.1",
304
- "@thirdweb-dev/wagmi-adapter": "^0.2.141",
284
+ "@thirdweb-dev/wagmi-adapter": "0.2.159",
305
285
  "@web3icons/react": "3.16.0",
306
286
  "big.js": "^7.0.1",
307
287
  "class-variance-authority": "0.7.0",
@@ -374,7 +354,7 @@
374
354
  "react": "^18.0.0 || ^19.0.0",
375
355
  "react-dom": "^18.0.0 || ^19.0.0",
376
356
  "react-native-mmkv": "^3.2.0",
377
- "thirdweb": "5.106.0",
357
+ "thirdweb": "5.108.9",
378
358
  "three": "^0.175.0",
379
359
  "viem": "^2.28.1",
380
360
  "wagmi": "^2.14.15"
@@ -410,6 +390,7 @@
410
390
  "release:alpha": "pnpm version prerelease --preid alpha && git push --follow-tags && pnpm publish --tag alpha --no-git-checks",
411
391
  "typecheck": "tsc --noEmit",
412
392
  "generate:thirdweb": "npx @hey-api/openapi-ts --file src/thirdweb/openapi-ts.config.ts --input src/thirdweb/insight-service.json",
393
+ "generate:anyspend": "npx openapi-typescript https://mainnet.anyspend.com/openapi.json -o src/anyspend/types/api.ts",
413
394
  "lint": "eslint 'src/**/*.{ts,tsx}'",
414
395
  "lint:fix": "eslint 'src/**/*.{ts,tsx}' --fix",
415
396
  "test": "vitest run",
@@ -23,7 +23,7 @@ import {
23
23
  import { cn } from "@b3dotfun/sdk/shared/utils/cn";
24
24
  import { formatTokenAmount } from "@b3dotfun/sdk/shared/utils/number";
25
25
  import invariant from "invariant";
26
- import { ArrowDown, HistoryIcon } from "lucide-react";
26
+ import { ArrowDown, HistoryIcon, Loader2 } from "lucide-react";
27
27
  import { motion } from "motion/react";
28
28
  import { useCallback, useEffect, useMemo, useRef, useState } from "react";
29
29
  import { toast } from "sonner";
@@ -34,7 +34,6 @@ import { AnySpendFingerprintWrapper, getFingerprintConfig } from "./AnySpendFing
34
34
  import { CryptoPaymentMethod, CryptoPaymentMethodType } from "./common/CryptoPaymentMethod";
35
35
  import { CryptoPaySection } from "./common/CryptoPaySection";
36
36
  import { CryptoReceiveSection } from "./common/CryptoReceiveSection";
37
- import { ErrorSection } from "./common/ErrorSection";
38
37
  import { FiatPaymentMethod, FiatPaymentMethodComponent } from "./common/FiatPaymentMethod";
39
38
  import { OrderDetails, OrderDetailsLoadingView } from "./common/OrderDetails";
40
39
  import { OrderHistory } from "./common/OrderHistory";
@@ -469,7 +468,7 @@ function AnySpendInner({
469
468
  ? parseUnits(srcAmount.replace(/,/g, ""), selectedSrcToken.decimals).toString()
470
469
  : parseUnits(dstAmount.replace(/,/g, ""), selectedDstToken.decimals).toString();
471
470
  const srcAmountOnrampInWei = parseUnits(srcAmountOnRamp.replace(/,/g, ""), USDC_BASE.decimals).toString();
472
- const { anyspendQuote, isLoadingAnyspendQuote, getAnyspendQuoteError } = useAnyspendQuote(
471
+ const { anyspendQuote, isLoadingAnyspendQuote } = useAnyspendQuote(
473
472
  activeTab === "crypto"
474
473
  ? {
475
474
  srcChain: selectedSrcChainId,
@@ -609,40 +608,42 @@ function AnySpendInner({
609
608
  });
610
609
 
611
610
  // Determine button state and text
612
- const btnInfo: { text: string; disable: boolean; error: boolean } = useMemo(() => {
613
- if (activeInputAmountInWei === "0") return { text: "Enter an amount", disable: true, error: false };
614
- if (isLoadingAnyspendQuote) return { text: "Loading...", disable: true, error: false };
615
- if (!recipientAddress) return { text: "Select recipient", disable: false, error: false };
616
- if (isCreatingOrder || isCreatingOnrampOrder) return { text: "Creating order...", disable: true, error: false };
617
- if (!anyspendQuote || !anyspendQuote.success) return { text: "Get rate error", disable: true, error: true };
611
+ const btnInfo: { text: string; disable: boolean; error: boolean; loading: boolean } = useMemo(() => {
612
+ if (activeInputAmountInWei === "0") return { text: "Enter an amount", disable: true, error: false, loading: false };
613
+ if (isLoadingAnyspendQuote) return { text: "Loading quote...", disable: true, error: false, loading: true };
614
+ if (!recipientAddress) return { text: "Select recipient", disable: false, error: false, loading: false };
615
+ if (isCreatingOrder || isCreatingOnrampOrder)
616
+ return { text: "Creating order...", disable: true, error: false, loading: true };
617
+ if (!anyspendQuote || !anyspendQuote.success)
618
+ return { text: "No quote found", disable: true, error: false, loading: false };
618
619
 
619
620
  if (activeTab === "crypto") {
620
621
  // If no payment method selected, show "Choose payment method"
621
622
  if (selectedCryptoPaymentMethod === CryptoPaymentMethodType.NONE) {
622
- return { text: "Choose payment method", disable: false, error: false };
623
+ return { text: "Choose payment method", disable: false, error: false, loading: false };
623
624
  }
624
625
  // If payment method selected, show appropriate action
625
626
  if (
626
627
  selectedCryptoPaymentMethod === CryptoPaymentMethodType.CONNECT_WALLET ||
627
628
  selectedCryptoPaymentMethod === CryptoPaymentMethodType.GLOBAL_WALLET
628
629
  ) {
629
- return { text: "Swap", disable: false, error: false };
630
+ return { text: "Swap", disable: false, error: false, loading: false };
630
631
  }
631
632
  if (selectedCryptoPaymentMethod === CryptoPaymentMethodType.TRANSFER_CRYPTO) {
632
- return { text: "Continue to payment", disable: false, error: false };
633
+ return { text: "Continue to payment", disable: false, error: false, loading: false };
633
634
  }
634
635
  }
635
636
 
636
637
  if (activeTab === "fiat") {
637
638
  // If no fiat payment method selected, show "Select payment method"
638
639
  if (selectedFiatPaymentMethod === FiatPaymentMethod.NONE) {
639
- return { text: "Select payment method", disable: false, error: false };
640
+ return { text: "Select payment method", disable: false, error: false, loading: false };
640
641
  }
641
642
  // If payment method is selected, show "Buy"
642
- return { text: "Buy", disable: false, error: false };
643
+ return { text: "Buy", disable: false, error: false, loading: false };
643
644
  }
644
645
 
645
- return { text: "Buy", disable: false, error: false };
646
+ return { text: "Buy", disable: false, error: false, loading: false };
646
647
  }, [
647
648
  activeInputAmountInWei,
648
649
  isLoadingAnyspendQuote,
@@ -1052,15 +1053,13 @@ function AnySpendInner({
1052
1053
  />
1053
1054
  )}
1054
1055
  </div>
1055
- {/* Error message section */}
1056
- <ErrorSection error={getAnyspendQuoteError} />
1057
1056
 
1058
1057
  {/* Main button section */}
1059
1058
  <motion.div
1060
1059
  initial={{ opacity: 0, y: 20, filter: "blur(10px)" }}
1061
1060
  animate={{ opacity: 1, y: 0, filter: "blur(0px)" }}
1062
1061
  transition={{ duration: 0.3, delay: 0.2, ease: "easeInOut" }}
1063
- className={cn("mt-4 flex w-full max-w-[460px] flex-col gap-2", getAnyspendQuoteError && "mt-0")}
1062
+ className={cn("mt-4 flex w-full max-w-[460px] flex-col gap-2")}
1064
1063
  >
1065
1064
  <ShinyButton
1066
1065
  accentColor={"hsl(var(--as-brand))"}
@@ -1072,7 +1071,10 @@ function AnySpendInner({
1072
1071
  )}
1073
1072
  textClassName={cn(btnInfo.error ? "text-white" : btnInfo.disable ? "text-as-secondary" : "text-white")}
1074
1073
  >
1075
- {btnInfo.text}
1074
+ <div className="flex items-center justify-center gap-2">
1075
+ {btnInfo.loading && <Loader2 className="h-4 w-4 animate-spin" />}
1076
+ {btnInfo.text}
1077
+ </div>
1076
1078
  </ShinyButton>
1077
1079
 
1078
1080
  {!hideTransactionHistoryButton && (globalAddress || recipientAddress) ? (
@@ -12,13 +12,12 @@ import { AnySpendFingerprintWrapper, getFingerprintConfig } from "./AnySpendFing
12
12
  import { CryptoPaySection } from "./common/CryptoPaySection";
13
13
  import { CryptoPaymentMethod, CryptoPaymentMethodType } from "./common/CryptoPaymentMethod";
14
14
  import { CryptoReceiveSection } from "./common/CryptoReceiveSection";
15
- import { ErrorSection } from "./common/ErrorSection";
16
15
  import { FiatPaymentMethod, FiatPaymentMethodComponent } from "./common/FiatPaymentMethod";
17
16
  import { OrderDetails } from "./common/OrderDetails";
18
17
  import { PointsDetailPanel } from "./common/PointsDetailPanel";
19
18
  import { RecipientSelection } from "./common/RecipientSelection";
20
19
 
21
- import { ArrowDown } from "lucide-react";
20
+ import { ArrowDown, Loader2 } from "lucide-react";
22
21
  import { PanelOnramp } from "./common/PanelOnramp";
23
22
 
24
23
  const SLIPPAGE_PERCENT = 3;
@@ -92,7 +91,6 @@ function AnySpendDepositHypeInner({
92
91
  globalAddress,
93
92
  anyspendQuote,
94
93
  isLoadingAnyspendQuote,
95
- getAnyspendQuoteError,
96
94
  activeInputAmountInWei,
97
95
  geoData,
98
96
  coinbaseAvailablePaymentMethods,
@@ -114,13 +112,15 @@ function AnySpendDepositHypeInner({
114
112
  });
115
113
 
116
114
  // Button state logic
117
- const btnInfo: { text: string; disable: boolean; error: boolean } = useMemo(() => {
118
- if (activeInputAmountInWei === "0") return { text: "Enter an amount", disable: true, error: false };
119
- if (isLoadingAnyspendQuote) return { text: "Loading quote...", disable: true, error: false };
120
- if (isCreatingOrder || isCreatingOnrampOrder) return { text: "Creating order...", disable: true, error: false };
121
- if (!selectedRecipientAddress) return { text: "Select recipient", disable: false, error: false };
122
- if (!anyspendQuote || !anyspendQuote.success) return { text: "Get quote error", disable: true, error: true };
123
- if (!dstAmount) return { text: "No quote available", disable: true, error: true };
115
+ const btnInfo: { text: string; disable: boolean; error: boolean; loading: boolean } = useMemo(() => {
116
+ if (activeInputAmountInWei === "0") return { text: "Enter an amount", disable: true, error: false, loading: false };
117
+ if (isLoadingAnyspendQuote) return { text: "Loading quote...", disable: true, error: false, loading: true };
118
+ if (isCreatingOrder || isCreatingOnrampOrder)
119
+ return { text: "Creating order...", disable: true, error: false, loading: true };
120
+ if (!selectedRecipientAddress) return { text: "Select recipient", disable: false, error: false, loading: false };
121
+ if (!anyspendQuote || !anyspendQuote.success)
122
+ return { text: "Get quote error", disable: true, error: true, loading: false };
123
+ if (!dstAmount) return { text: "No quote available", disable: true, error: true, loading: false };
124
124
 
125
125
  // Check minimum deposit amount (10 HYPE)
126
126
  // Use the raw amount from the quote instead of the formatted display string
@@ -130,25 +130,25 @@ function AnySpendDepositHypeInner({
130
130
  const actualAmount = parseFloat(rawAmountInWei) / Math.pow(10, decimals);
131
131
 
132
132
  if (actualAmount < 10) {
133
- return { text: "Minimum 10 HYPE deposit", disable: true, error: true };
133
+ return { text: "Minimum 10 HYPE deposit", disable: true, error: true, loading: false };
134
134
  }
135
135
  }
136
136
 
137
137
  if (paymentType === "crypto") {
138
138
  if (selectedCryptoPaymentMethod === CryptoPaymentMethodType.NONE) {
139
- return { text: "Choose payment method", disable: false, error: false };
139
+ return { text: "Choose payment method", disable: false, error: false, loading: false };
140
140
  }
141
- return { text: "Continue to deposit", disable: false, error: false };
141
+ return { text: "Continue to deposit", disable: false, error: false, loading: false };
142
142
  }
143
143
 
144
144
  if (paymentType === "fiat") {
145
145
  if (selectedFiatPaymentMethod === FiatPaymentMethod.NONE) {
146
- return { text: "Select payment method", disable: false, error: false };
146
+ return { text: "Select payment method", disable: false, error: false, loading: false };
147
147
  }
148
- return { text: "Buy", disable: false, error: false };
148
+ return { text: "Buy", disable: false, error: false, loading: false };
149
149
  }
150
150
 
151
- return { text: "Continue to deposit", disable: false, error: false };
151
+ return { text: "Continue to deposit", disable: false, error: false, loading: false };
152
152
  }, [
153
153
  activeInputAmountInWei,
154
154
  isLoadingAnyspendQuote,
@@ -283,15 +283,12 @@ function AnySpendDepositHypeInner({
283
283
  </div>
284
284
  </div>
285
285
 
286
- {/* Error message section */}
287
- <ErrorSection error={getAnyspendQuoteError} />
288
-
289
286
  {/* Main button section */}
290
287
  <motion.div
291
288
  initial={{ opacity: 0, y: 20, filter: "blur(10px)" }}
292
289
  animate={{ opacity: 1, y: 0, filter: "blur(0px)" }}
293
290
  transition={{ duration: 0.3, delay: 0.2, ease: "easeInOut" }}
294
- className={cn("mt-4 flex w-full max-w-[460px] flex-col gap-2", getAnyspendQuoteError && "mt-0")}
291
+ className={cn("mt-4 flex w-full max-w-[460px] flex-col gap-2")}
295
292
  >
296
293
  <ShinyButton
297
294
  accentColor={"hsl(var(--as-brand))"}
@@ -303,7 +300,10 @@ function AnySpendDepositHypeInner({
303
300
  )}
304
301
  textClassName={cn(btnInfo.error ? "text-white" : btnInfo.disable ? "text-as-secondary" : "text-white")}
305
302
  >
306
- {btnInfo.text}
303
+ <div className="flex items-center justify-center gap-2">
304
+ {btnInfo.loading && <Loader2 className="h-4 w-4 animate-spin" />}
305
+ {btnInfo.text}
306
+ </div>
307
307
  </ShinyButton>
308
308
  </motion.div>
309
309
 
@@ -17,37 +17,37 @@ export function OrderHistory({ mode, onBack, onSelectOrder }: OrderHistoryProps)
17
17
 
18
18
  return (
19
19
  <>
20
- <div className="mb-6 flex w-full items-center gap-4">
21
- <Button onClick={onBack} variant="ghost" size="icon">
22
- <ArrowLeft className="h-4 w-4" />
20
+ <div className="mb-8 flex w-full items-center gap-3">
21
+ <Button onClick={onBack} variant="ghost" size="icon" className="hover:bg-as-surface-secondary">
22
+ <ArrowLeft className="h-5 w-5" />
23
23
  </Button>
24
24
  <div className="flex-1">
25
- <h3 className="text-xl font-semibold">Order History</h3>
26
- <p className="text-as-primary/30 text-sm">View your past transactions</p>
25
+ <h3 className="text-as-primary text-2xl font-bold">Order History</h3>
27
26
  </div>
28
27
  <Button
29
28
  variant="ghost"
30
29
  size="icon"
30
+ className="hover:bg-as-surface-secondary"
31
31
  onClick={() => {
32
32
  refetchOrderHistory();
33
33
  }}
34
34
  >
35
- <RefreshCcw className="text-as-primary/30 hover:text-as-primary h-4 w-4 cursor-pointer transition-all hover:rotate-180" />
35
+ <RefreshCcw className="text-as-secondary hover:text-as-primary h-5 w-5 cursor-pointer transition-all hover:rotate-180" />
36
36
  </Button>
37
37
  </div>
38
38
 
39
39
  {isLoadingOrderHistory ? (
40
- <div className="w-full space-y-4">
40
+ <div className="w-full space-y-3">
41
41
  {[1, 2, 3].map(i => (
42
- <Skeleton key={i} className="h-[160px] w-full rounded-lg" />
42
+ <Skeleton key={i} className="h-[180px] w-full rounded-2xl" />
43
43
  ))}
44
44
  </div>
45
45
  ) : !orderHistory?.length ? (
46
- <div className="bg-as-light-brand w-full rounded-lg border p-8 text-center">
47
- <p className="text-b3-react-muted-foreground">No order history found</p>
46
+ <div className="bg-as-surface-secondary w-full rounded-2xl p-12 text-center">
47
+ <p className="text-as-secondary text-sm">No order history found</p>
48
48
  </div>
49
49
  ) : (
50
- <div className="mb-12 w-full space-y-4">
50
+ <div className="mb-12 w-full space-y-3">
51
51
  {[...orderHistory]
52
52
  .sort((a, b) => b.createdAt - a.createdAt)
53
53
  .map(order => (
@@ -1,10 +1,10 @@
1
1
  import { ALL_CHAINS, getChainName, getStatusDisplay } from "@b3dotfun/sdk/anyspend";
2
- import { Badge, Button, useIsMobile } from "@b3dotfun/sdk/global-account/react";
2
+ import { Badge, useIsMobile } from "@b3dotfun/sdk/global-account/react";
3
3
  import { cn } from "@b3dotfun/sdk/shared/utils";
4
4
  import { formatTokenAmount } from "@b3dotfun/sdk/shared/utils/number";
5
- import { ArrowRight, ChevronDown } from "lucide-react";
5
+ import { getVendorDisplayName } from "@b3dotfun/sdk/shared/utils/payment.utils";
6
+ import { ArrowRight } from "lucide-react";
6
7
  import TimeAgo from "react-timeago";
7
- import { b3 } from "viem/chains";
8
8
  import { components } from "@b3dotfun/sdk/anyspend/types/api";
9
9
 
10
10
  interface OrderHistoryItemProps {
@@ -31,153 +31,148 @@ export function OrderHistoryItem({ order, onSelectOrder, mode }: OrderHistoryIte
31
31
 
32
32
  const isSmallView = useIsMobile() || mode === "modal";
33
33
 
34
+ // Check if this is a one-click payment order
35
+ const isOneClickPayment = !!order.oneClickBuyUrl;
36
+ const vendorName = order.onrampMetadata?.vendor ? getVendorDisplayName(order.onrampMetadata.vendor) : null;
37
+
34
38
  return (
35
39
  <div
36
40
  key={`anyspend-${order.id}`}
37
41
  className={cn(
38
- "bg-as-light-brand/20 rounded-lg border p-4",
39
- onSelectOrder && "hover:bg-as-light-brand/30 hover:border-as-brand cursor-pointer transition-colors",
42
+ "bg-as-surface-secondary hover:bg-as-surface-tertiary rounded-xl p-4 transition-all",
43
+ onSelectOrder && "cursor-pointer",
40
44
  )}
41
45
  onClick={() => onSelectOrder?.(order.id)}
42
46
  >
43
- <div className="flex items-center justify-between">
44
- <Badge
45
- className={cn(
46
- "px-3 py-1 text-xs",
47
- orderDisplayStatus === "processing" && "bg-yellow-500/10 text-yellow-500",
48
- orderDisplayStatus === "success" && "bg-green-500/10 text-green-500",
49
- orderDisplayStatus === "failure" && "bg-red-500/10 text-red-500",
50
- )}
51
- >
52
- {orderStatusText}
53
- </Badge>
54
-
47
+ {/* Header: Status and Time */}
48
+ <div className="mb-3 flex items-center justify-between">
55
49
  <div className="flex items-center gap-2">
56
- <span className="text-nano label-style text-as-primary/30">
57
- <TimeAgo date={new Date(order.createdAt)} />
58
- </span>
50
+ <div
51
+ className={cn(
52
+ "text-xs font-semibold",
53
+ orderDisplayStatus === "processing" && "text-yellow-600",
54
+ orderDisplayStatus === "success" && "text-green-600",
55
+ orderDisplayStatus === "failure" && "text-red-600",
56
+ )}
57
+ >
58
+ {orderStatusText}
59
+ </div>
60
+ {isOneClickPayment && vendorName && (
61
+ <Badge variant="outline" className="text-as-secondary px-2 py-0.5 text-[10px]">
62
+ {vendorName}
63
+ </Badge>
64
+ )}
65
+ </div>
66
+ <div className="text-as-secondary text-[10px] font-medium uppercase tracking-wide">
67
+ <TimeAgo date={new Date(order.createdAt)} />
59
68
  </div>
60
69
  </div>
61
70
 
62
- {order.oneClickBuyUrl ? (
63
- <div className="mb-3 mt-4 flex items-center gap-1">
64
- <div className="bg-b3-react-background flex flex-1 flex-col gap-1 rounded-lg border p-4 px-5">
65
- <h3 className="text-as-primary/50 flex items-center gap-2 text-xl font-semibold">
66
- <span>
67
- {"Buy "}
68
- <span className="text-as-primary">
69
- ${formatTokenAmount(BigInt(order.srcAmount), order.metadata.srcToken.decimals)}
70
- </span>
71
- {` of`}
72
- </span>
73
-
74
- <span className="text-as-primary flex items-center gap-2">
75
- {nft ? (
76
- <img src={nft.imageUrl} alt={nft.name} className="h-6 w-6" />
77
- ) : tournament ? (
78
- <img src={tournament.imageUrl} alt={tournament.name} className="h-6 w-6" />
79
- ) : (
80
- <img src={dstToken.metadata.logoURI} alt={dstToken.symbol} className="h-6 w-6" />
81
- )}
82
- {nft ? nft.name : tournament ? tournament.name : dstToken.symbol}
83
- </span>
84
-
85
- <span className="flex items-center gap-2">
86
- {` on `}
87
- <span className="text-as-primary flex items-center gap-2">
88
- <img src={ALL_CHAINS[order.dstChain]?.logoUrl} alt={getChainName(order.dstChain)} className="h-4" />
89
- {order.dstChain !== b3.id && getChainName(order.dstChain)}
90
- </span>
91
- </span>
92
- </h3>
93
-
94
- <p className="label-style text-as-primary/30 mt-1 flex items-center gap-2 text-xs">
95
- Paying via{" "}
96
- <img src="https://cdn.b3.fun/coinbase-wordmark-blue.svg" alt="Coinbase" className="-mt-1 h-3" />
97
- </p>
71
+ {/* Main Content: From -> To */}
72
+ <div className={cn("flex items-center", isSmallView ? "gap-2" : "gap-4")}>
73
+ {/* From Section */}
74
+ <div className={cn("flex min-w-0 flex-1 items-center", isSmallView ? "gap-1.5" : "gap-2")}>
75
+ <img
76
+ src={order.metadata.srcToken.metadata.logoURI}
77
+ alt={order.metadata.srcToken.symbol}
78
+ className={cn("shrink-0 rounded-full", isSmallView ? "h-7 w-7" : "h-8 w-8")}
79
+ />
80
+ <div className="min-w-0 flex-1">
81
+ <div className={cn("text-as-primary truncate font-bold", isSmallView ? "text-xs" : "text-sm")}>
82
+ {formatTokenAmount(BigInt(order.srcAmount), order.metadata.srcToken.decimals)}{" "}
83
+ {order.metadata.srcToken.symbol}
84
+ </div>
85
+ <div className={cn("text-as-secondary flex items-center gap-1", isSmallView ? "text-[10px]" : "text-xs")}>
86
+ <img src={ALL_CHAINS[order.srcChain]?.logoUrl} alt={getChainName(order.srcChain)} className="h-3 w-3" />
87
+ <span className="truncate">{getChainName(order.srcChain)}</span>
88
+ </div>
98
89
  </div>
99
90
  </div>
100
- ) : (
101
- <div className={cn("mb-3 mt-4 flex items-center gap-1", isSmallView && "flex-col")}>
102
- <div className="bg-b3-react-background flex w-full flex-1 flex-col gap-1 overflow-hidden rounded-lg border p-4 px-5">
103
- <div className="flex items-center gap-2">
91
+
92
+ {/* Arrow */}
93
+ <ArrowRight className={cn("text-as-secondary shrink-0 opacity-30", isSmallView ? "h-4 w-4" : "h-5 w-5")} />
94
+
95
+ {/* To Section */}
96
+ <div className={cn("flex min-w-0 flex-1 items-center", isSmallView ? "gap-1.5" : "gap-2")}>
97
+ {nft ? (
98
+ <>
104
99
  <img
105
- src={order.metadata.srcToken.metadata.logoURI}
106
- alt={order.metadata.srcToken.symbol}
107
- className="h-6 w-6 rounded-full"
100
+ src={nft.imageUrl}
101
+ alt={nft.name}
102
+ className={cn("shrink-0 rounded-full", isSmallView ? "h-7 w-7" : "h-8 w-8")}
108
103
  />
109
- <div className="text-as-primary flex items-center gap-2 overflow-hidden text-ellipsis whitespace-nowrap text-xl font-semibold">
110
- {formatTokenAmount(BigInt(order.srcAmount), order.metadata.srcToken.decimals)}{" "}
111
- {order.metadata.srcToken.symbol}
104
+ <div className="min-w-0 flex-1">
105
+ <div className={cn("text-as-primary truncate font-bold", isSmallView ? "text-xs" : "text-sm")}>
106
+ {nft.name}
107
+ </div>
108
+ <div
109
+ className={cn("text-as-secondary flex items-center gap-1", isSmallView ? "text-[10px]" : "text-xs")}
110
+ >
111
+ <img
112
+ src={ALL_CHAINS[order.dstChain]?.logoUrl}
113
+ alt={getChainName(order.dstChain)}
114
+ className="h-3 w-3"
115
+ />
116
+ <span className="truncate">{getChainName(order.dstChain)}</span>
117
+ </div>
112
118
  </div>
113
- </div>
114
-
115
- <div className="label-style text-as-primary/50 flex items-center gap-2 text-sm">
116
- from
119
+ </>
120
+ ) : tournament ? (
121
+ <>
117
122
  <img
118
- src={ALL_CHAINS[order.srcChain]?.logoUrl}
119
- alt={getChainName(order.srcChain)}
120
- className={cn("h-4", order.srcChain !== b3.id && "w-4 rounded-full", order.srcChain === b3.id && "h-3")}
123
+ src={tournament.imageUrl}
124
+ alt={tournament.name}
125
+ className={cn("shrink-0 rounded-full", isSmallView ? "h-7 w-7" : "h-8 w-8")}
121
126
  />
122
- {getChainName(order.srcChain)}
123
- </div>
124
- </div>
125
-
126
- <div className={cn("h-8 w-8 shrink-0 -rotate-90 opacity-30", isSmallView && "rotate-0")}>
127
- <ChevronDown className="h-8 w-8" />
128
- </div>
129
-
130
- <div className="bg-b3-react-background flex w-full flex-1 flex-col gap-1 overflow-hidden rounded-lg border p-4 px-5">
131
- <div className="flex items-center gap-2">
132
- {nft ? (
133
- <>
134
- <img src={nft.imageUrl} alt={nft.name} className="h-6 w-6 rounded-full" />
135
- <div className="text-as-primary overflow-hidden text-ellipsis whitespace-nowrap text-xl font-semibold">
136
- {nft.name}
137
- </div>
138
- </>
139
- ) : tournament ? (
140
- <>
141
- <img src={tournament.imageUrl} alt={tournament.name} className="h-6 w-6 rounded-full" />
142
- <div className="text-as-primary overflow-hidden text-ellipsis whitespace-nowrap text-xl font-semibold">
143
- {tournament.name}
144
- </div>
145
- </>
146
- ) : (
147
- <>
148
- <img src={dstToken.metadata.logoURI} alt={dstToken.symbol} className="h-6 w-6 rounded-full" />
149
- <div className="text-as-primary overflow-hidden text-ellipsis whitespace-nowrap text-xl font-semibold">
150
- {formatTokenAmount(
151
- actualDstAmount
152
- ? BigInt(actualDstAmount)
153
- : expectedDstAmount
154
- ? BigInt(expectedDstAmount)
155
- : BigInt(0),
156
- dstToken.decimals,
157
- )}{" "}
158
- {dstToken.symbol}
159
- </div>
160
- </>
161
- )}
162
- </div>
163
- <div className="label-style text-as-primary/50 flex items-center gap-2 text-sm">
164
- to
127
+ <div className="min-w-0 flex-1">
128
+ <div className={cn("text-as-primary truncate font-bold", isSmallView ? "text-xs" : "text-sm")}>
129
+ {tournament.name}
130
+ </div>
131
+ <div
132
+ className={cn("text-as-secondary flex items-center gap-1", isSmallView ? "text-[10px]" : "text-xs")}
133
+ >
134
+ <img
135
+ src={ALL_CHAINS[order.dstChain]?.logoUrl}
136
+ alt={getChainName(order.dstChain)}
137
+ className="h-3 w-3"
138
+ />
139
+ <span className="truncate">{getChainName(order.dstChain)}</span>
140
+ </div>
141
+ </div>
142
+ </>
143
+ ) : (
144
+ <>
165
145
  <img
166
- src={ALL_CHAINS[order.dstChain]?.logoUrl}
167
- alt={getChainName(order.dstChain)}
168
- className={cn("h-4", order.dstChain !== b3.id && "w-4 rounded-full", order.dstChain === b3.id && "h-3")}
146
+ src={dstToken.metadata.logoURI}
147
+ alt={dstToken.symbol}
148
+ className={cn("shrink-0 rounded-full", isSmallView ? "h-7 w-7" : "h-8 w-8")}
169
149
  />
170
- {getChainName(order.dstChain)}
171
- </div>
172
- </div>
150
+ <div className="min-w-0 flex-1">
151
+ <div className={cn("text-as-primary truncate font-bold", isSmallView ? "text-xs" : "text-sm")}>
152
+ {formatTokenAmount(
153
+ actualDstAmount
154
+ ? BigInt(actualDstAmount)
155
+ : expectedDstAmount
156
+ ? BigInt(expectedDstAmount)
157
+ : BigInt(0),
158
+ dstToken.decimals,
159
+ )}{" "}
160
+ {dstToken.symbol}
161
+ </div>
162
+ <div
163
+ className={cn("text-as-secondary flex items-center gap-1", isSmallView ? "text-[10px]" : "text-xs")}
164
+ >
165
+ <img
166
+ src={ALL_CHAINS[order.dstChain]?.logoUrl}
167
+ alt={getChainName(order.dstChain)}
168
+ className="h-3 w-3"
169
+ />
170
+ <span className="truncate">{getChainName(order.dstChain)}</span>
171
+ </div>
172
+ </div>
173
+ </>
174
+ )}
173
175
  </div>
174
- )}
175
-
176
- <div className="flex items-center justify-end">
177
- <Button variant="link" size="sm" className="h-auto" onClick={() => onSelectOrder?.(order.id)}>
178
- {orderDisplayStatus === "processing" ? "Proceed with payment" : "Details"}{" "}
179
- <ArrowRight className="ml-2 h-3 w-3" />
180
- </Button>
181
176
  </div>
182
177
  </div>
183
178
  );