@b3dotfun/sdk 0.0.83-test.0 → 0.0.84-alpha.0

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 (176) hide show
  1. package/dist/cjs/anyspend/constants/index.d.ts +1 -1
  2. package/dist/cjs/anyspend/constants/index.js +2 -2
  3. package/dist/cjs/anyspend/react/components/AnySpend.js +21 -12
  4. package/dist/cjs/anyspend/react/components/AnySpendCollectorClubPurchase.js +1 -1
  5. package/dist/cjs/anyspend/react/components/AnySpendCustom.js +4 -6
  6. package/dist/cjs/anyspend/react/components/common/CryptoPaySection.js +2 -4
  7. package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.js +47 -177
  8. package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethodDisplay.d.ts +15 -0
  9. package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethodDisplay.js +28 -0
  10. package/dist/cjs/anyspend/react/components/common/InsufficientDepositPayment.js +1 -1
  11. package/dist/cjs/anyspend/react/components/common/OrderDetails.js +5 -4
  12. package/dist/cjs/anyspend/react/components/common/OrderToken.js +2 -2
  13. package/dist/cjs/anyspend/react/components/common/OrderTokenAmount.js +1 -1
  14. package/dist/cjs/anyspend/react/components/common/OrderTokenAmountFiat.js +1 -1
  15. package/dist/cjs/anyspend/react/components/common/OrderTokenAmountNew.js +2 -2
  16. package/dist/cjs/anyspend/react/components/common/PaymentStripeWeb2.js +4 -6
  17. package/dist/cjs/anyspend/react/components/common/PaymentVendorUI.js +41 -2
  18. package/dist/cjs/anyspend/react/components/common/TransferCryptoDetails.js +1 -1
  19. package/dist/cjs/anyspend/react/components/webview/WebviewOnrampPayment.js +2 -3
  20. package/dist/cjs/anyspend/react/hooks/index.d.ts +1 -0
  21. package/dist/cjs/anyspend/react/hooks/index.js +1 -0
  22. package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.js +0 -3
  23. package/dist/cjs/anyspend/react/hooks/useConnectedUserProfile.d.ts +2 -1
  24. package/dist/cjs/anyspend/react/hooks/useConnectedUserProfile.js +5 -8
  25. package/dist/cjs/anyspend/react/hooks/useConnectedWalletDisplay.d.ts +0 -2
  26. package/dist/cjs/anyspend/react/hooks/useConnectedWalletDisplay.js +2 -12
  27. package/dist/cjs/anyspend/react/hooks/useHyperliquidTransfer.d.ts +37 -0
  28. package/dist/cjs/anyspend/react/hooks/useHyperliquidTransfer.js +133 -0
  29. package/dist/cjs/anyspend/react/providers/AnyspendProvider.js +1 -13
  30. package/dist/cjs/anyspend/types/chain.d.ts +10 -2
  31. package/dist/cjs/anyspend/types/chain.js +1 -0
  32. package/dist/cjs/anyspend/utils/address.d.ts +11 -0
  33. package/dist/cjs/anyspend/utils/address.js +15 -0
  34. package/dist/cjs/anyspend/utils/chain.d.ts +58 -1
  35. package/dist/cjs/anyspend/utils/chain.js +94 -4
  36. package/dist/cjs/anyspend/utils/token.d.ts +4 -0
  37. package/dist/cjs/anyspend/utils/token.js +35 -6
  38. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +1 -1
  39. package/dist/cjs/global-account/react/components/SignInWithB3/SignIn.js +3 -4
  40. package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +12 -57
  41. package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStep.js +1 -1
  42. package/dist/cjs/global-account/react/hooks/index.d.ts +0 -2
  43. package/dist/cjs/global-account/react/hooks/index.js +1 -5
  44. package/dist/cjs/global-account/react/hooks/useAccountWallet.js +11 -10
  45. package/dist/cjs/global-account/react/hooks/useAuthentication.d.ts +2 -2
  46. package/dist/cjs/global-account/react/hooks/useAuthentication.js +63 -72
  47. package/dist/cjs/global-account/react/hooks/useTWAuth.d.ts +0 -3
  48. package/dist/cjs/global-account/react/hooks/useTWAuth.js +0 -8
  49. package/dist/cjs/global-account/react/hooks/useTurnkeyAuth.js +24 -54
  50. package/dist/cjs/global-account/react/hooks/useUserQuery.d.ts +1 -1
  51. package/dist/cjs/shared/utils/payment.utils.d.ts +1 -0
  52. package/dist/cjs/shared/utils/payment.utils.js +9 -0
  53. package/dist/esm/anyspend/constants/index.d.ts +1 -1
  54. package/dist/esm/anyspend/constants/index.js +1 -1
  55. package/dist/esm/anyspend/react/components/AnySpend.js +22 -13
  56. package/dist/esm/anyspend/react/components/AnySpendCollectorClubPurchase.js +1 -1
  57. package/dist/esm/anyspend/react/components/AnySpendCustom.js +5 -7
  58. package/dist/esm/anyspend/react/components/common/CryptoPaySection.js +4 -6
  59. package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.js +45 -175
  60. package/dist/esm/anyspend/react/components/common/CryptoPaymentMethodDisplay.d.ts +15 -0
  61. package/dist/esm/anyspend/react/components/common/CryptoPaymentMethodDisplay.js +25 -0
  62. package/dist/esm/anyspend/react/components/common/InsufficientDepositPayment.js +2 -2
  63. package/dist/esm/anyspend/react/components/common/OrderDetails.js +6 -5
  64. package/dist/esm/anyspend/react/components/common/OrderToken.js +3 -3
  65. package/dist/esm/anyspend/react/components/common/OrderTokenAmount.js +2 -2
  66. package/dist/esm/anyspend/react/components/common/OrderTokenAmountFiat.js +2 -2
  67. package/dist/esm/anyspend/react/components/common/OrderTokenAmountNew.js +3 -3
  68. package/dist/esm/anyspend/react/components/common/PaymentStripeWeb2.js +2 -4
  69. package/dist/esm/anyspend/react/components/common/PaymentVendorUI.js +9 -3
  70. package/dist/esm/anyspend/react/components/common/TransferCryptoDetails.js +2 -2
  71. package/dist/esm/anyspend/react/components/webview/WebviewOnrampPayment.js +3 -4
  72. package/dist/esm/anyspend/react/hooks/index.d.ts +1 -0
  73. package/dist/esm/anyspend/react/hooks/index.js +1 -0
  74. package/dist/esm/anyspend/react/hooks/useAnyspendFlow.js +0 -3
  75. package/dist/esm/anyspend/react/hooks/useConnectedUserProfile.d.ts +2 -1
  76. package/dist/esm/anyspend/react/hooks/useConnectedUserProfile.js +6 -9
  77. package/dist/esm/anyspend/react/hooks/useConnectedWalletDisplay.d.ts +0 -2
  78. package/dist/esm/anyspend/react/hooks/useConnectedWalletDisplay.js +2 -12
  79. package/dist/esm/anyspend/react/hooks/useHyperliquidTransfer.d.ts +37 -0
  80. package/dist/esm/anyspend/react/hooks/useHyperliquidTransfer.js +127 -0
  81. package/dist/esm/anyspend/react/providers/AnyspendProvider.js +1 -13
  82. package/dist/esm/anyspend/types/chain.d.ts +10 -2
  83. package/dist/esm/anyspend/types/chain.js +1 -0
  84. package/dist/esm/anyspend/utils/address.d.ts +11 -0
  85. package/dist/esm/anyspend/utils/address.js +14 -0
  86. package/dist/esm/anyspend/utils/chain.d.ts +58 -1
  87. package/dist/esm/anyspend/utils/chain.js +91 -4
  88. package/dist/esm/anyspend/utils/token.d.ts +4 -0
  89. package/dist/esm/anyspend/utils/token.js +32 -6
  90. package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +2 -2
  91. package/dist/esm/global-account/react/components/SignInWithB3/SignIn.js +4 -5
  92. package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +12 -57
  93. package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStep.js +1 -1
  94. package/dist/esm/global-account/react/hooks/index.d.ts +0 -2
  95. package/dist/esm/global-account/react/hooks/index.js +0 -2
  96. package/dist/esm/global-account/react/hooks/useAccountWallet.js +11 -10
  97. package/dist/esm/global-account/react/hooks/useAuthentication.d.ts +2 -2
  98. package/dist/esm/global-account/react/hooks/useAuthentication.js +63 -72
  99. package/dist/esm/global-account/react/hooks/useTWAuth.d.ts +0 -3
  100. package/dist/esm/global-account/react/hooks/useTWAuth.js +0 -8
  101. package/dist/esm/global-account/react/hooks/useTurnkeyAuth.js +24 -54
  102. package/dist/esm/global-account/react/hooks/useUserQuery.d.ts +1 -1
  103. package/dist/esm/shared/utils/payment.utils.d.ts +1 -0
  104. package/dist/esm/shared/utils/payment.utils.js +9 -1
  105. package/dist/styles/index.css +1 -1
  106. package/dist/types/anyspend/constants/index.d.ts +1 -1
  107. package/dist/types/anyspend/react/components/common/CryptoPaymentMethodDisplay.d.ts +15 -0
  108. package/dist/types/anyspend/react/hooks/index.d.ts +1 -0
  109. package/dist/types/anyspend/react/hooks/useConnectedUserProfile.d.ts +2 -1
  110. package/dist/types/anyspend/react/hooks/useConnectedWalletDisplay.d.ts +0 -2
  111. package/dist/types/anyspend/react/hooks/useHyperliquidTransfer.d.ts +37 -0
  112. package/dist/types/anyspend/types/chain.d.ts +10 -2
  113. package/dist/types/anyspend/utils/address.d.ts +11 -0
  114. package/dist/types/anyspend/utils/chain.d.ts +58 -1
  115. package/dist/types/anyspend/utils/token.d.ts +4 -0
  116. package/dist/types/global-account/react/hooks/index.d.ts +0 -2
  117. package/dist/types/global-account/react/hooks/useAuthentication.d.ts +2 -2
  118. package/dist/types/global-account/react/hooks/useTWAuth.d.ts +0 -3
  119. package/dist/types/global-account/react/hooks/useUserQuery.d.ts +1 -1
  120. package/dist/types/shared/utils/payment.utils.d.ts +1 -0
  121. package/package.json +1 -1
  122. package/src/anyspend/constants/index.ts +1 -1
  123. package/src/anyspend/react/components/AnySpend.tsx +31 -13
  124. package/src/anyspend/react/components/AnySpendCollectorClubPurchase.tsx +1 -1
  125. package/src/anyspend/react/components/AnySpendCustom.tsx +9 -29
  126. package/src/anyspend/react/components/common/CryptoPaySection.tsx +7 -30
  127. package/src/anyspend/react/components/common/CryptoPaymentMethod.tsx +22 -253
  128. package/src/anyspend/react/components/common/CryptoPaymentMethodDisplay.tsx +64 -0
  129. package/src/anyspend/react/components/common/InsufficientDepositPayment.tsx +2 -2
  130. package/src/anyspend/react/components/common/OrderDetails.tsx +6 -5
  131. package/src/anyspend/react/components/common/OrderToken.tsx +5 -5
  132. package/src/anyspend/react/components/common/OrderTokenAmount.tsx +3 -3
  133. package/src/anyspend/react/components/common/OrderTokenAmountFiat.tsx +3 -3
  134. package/src/anyspend/react/components/common/OrderTokenAmountNew.tsx +6 -6
  135. package/src/anyspend/react/components/common/PaymentStripeWeb2.tsx +3 -5
  136. package/src/anyspend/react/components/common/PaymentVendorUI.tsx +26 -2
  137. package/src/anyspend/react/components/common/TransferCryptoDetails.tsx +2 -2
  138. package/src/anyspend/react/components/webview/WebviewOnrampPayment.tsx +3 -5
  139. package/src/anyspend/react/hooks/index.ts +1 -0
  140. package/src/anyspend/react/hooks/useAnyspendFlow.ts +0 -4
  141. package/src/anyspend/react/hooks/useConnectedUserProfile.ts +7 -10
  142. package/src/anyspend/react/hooks/useConnectedWalletDisplay.ts +2 -15
  143. package/src/anyspend/react/hooks/useHyperliquidTransfer.ts +152 -0
  144. package/src/anyspend/react/providers/AnyspendProvider.tsx +7 -22
  145. package/src/anyspend/types/chain.ts +10 -1
  146. package/src/anyspend/utils/address.ts +15 -0
  147. package/src/anyspend/utils/chain.ts +115 -5
  148. package/src/anyspend/utils/token.ts +36 -7
  149. package/src/global-account/react/components/B3Provider/B3Provider.tsx +6 -2
  150. package/src/global-account/react/components/SignInWithB3/SignIn.tsx +4 -6
  151. package/src/global-account/react/components/SignInWithB3/SignInWithB3Flow.tsx +22 -77
  152. package/src/global-account/react/components/SignInWithB3/steps/LoginStep.tsx +1 -1
  153. package/src/global-account/react/hooks/index.ts +0 -2
  154. package/src/global-account/react/hooks/useAccountWallet.tsx +12 -11
  155. package/src/global-account/react/hooks/useAuthentication.ts +85 -88
  156. package/src/global-account/react/hooks/useTWAuth.tsx +0 -10
  157. package/src/global-account/react/hooks/useTurnkeyAuth.ts +26 -59
  158. package/src/shared/utils/payment.utils.ts +10 -1
  159. package/dist/cjs/anyspend/react/hooks/useAutoSetActiveWalletFromWagmi.d.ts +0 -10
  160. package/dist/cjs/anyspend/react/hooks/useAutoSetActiveWalletFromWagmi.js +0 -73
  161. package/dist/cjs/global-account/react/hooks/useAuth.d.ts +0 -76
  162. package/dist/cjs/global-account/react/hooks/useAuth.js +0 -338
  163. package/dist/cjs/global-account/react/hooks/useBestTransactionPath.d.ts +0 -41
  164. package/dist/cjs/global-account/react/hooks/useBestTransactionPath.js +0 -148
  165. package/dist/esm/anyspend/react/hooks/useAutoSetActiveWalletFromWagmi.d.ts +0 -10
  166. package/dist/esm/anyspend/react/hooks/useAutoSetActiveWalletFromWagmi.js +0 -70
  167. package/dist/esm/global-account/react/hooks/useAuth.d.ts +0 -76
  168. package/dist/esm/global-account/react/hooks/useAuth.js +0 -332
  169. package/dist/esm/global-account/react/hooks/useBestTransactionPath.d.ts +0 -41
  170. package/dist/esm/global-account/react/hooks/useBestTransactionPath.js +0 -145
  171. package/dist/types/anyspend/react/hooks/useAutoSetActiveWalletFromWagmi.d.ts +0 -10
  172. package/dist/types/global-account/react/hooks/useAuth.d.ts +0 -76
  173. package/dist/types/global-account/react/hooks/useBestTransactionPath.d.ts +0 -41
  174. package/src/anyspend/react/hooks/useAutoSetActiveWalletFromWagmi.ts +0 -80
  175. package/src/global-account/react/hooks/useAuth.ts +0 -380
  176. package/src/global-account/react/hooks/useBestTransactionPath.tsx +0 -201
@@ -4,19 +4,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.AnyspendProvider = void 0;
5
5
  const jsx_runtime_1 = require("react/jsx-runtime");
6
6
  const react_1 = require("../../../global-account/react");
7
- const react_query_1 = require("@tanstack/react-query");
8
- const react_2 = require("react");
9
7
  const FeatureFlagsContext_1 = require("../contexts/FeatureFlagsContext");
10
8
  const StripeRedirectHandler_1 = require("./StripeRedirectHandler");
11
- const defaultQueryClientConfig = {
12
- defaultOptions: {
13
- queries: {
14
- refetchOnWindowFocus: false,
15
- retry: false,
16
- staleTime: 30000,
17
- },
18
- },
19
- };
20
9
  /**
21
10
  * AnyspendProvider is a top-level provider that wraps your application to provide
22
11
  * query caching and state management for all Anyspend hooks.
@@ -41,7 +30,6 @@ const defaultQueryClientConfig = {
41
30
  * ```
42
31
  */
43
32
  const AnyspendProvider = function AnyspendProvider({ children, featureFlags }) {
44
- const [queryClient] = (0, react_2.useState)(() => new react_query_1.QueryClient(defaultQueryClientConfig));
45
- return ((0, jsx_runtime_1.jsx)(react_query_1.QueryClientProvider, { client: queryClient, children: (0, jsx_runtime_1.jsx)(FeatureFlagsContext_1.FeatureFlagsProvider, { featureFlags: featureFlags, children: (0, jsx_runtime_1.jsxs)(react_1.TooltipProvider, { children: [(0, jsx_runtime_1.jsx)(StripeRedirectHandler_1.StripeRedirectHandler, {}), children] }) }) }));
33
+ return ((0, jsx_runtime_1.jsx)(FeatureFlagsContext_1.FeatureFlagsProvider, { featureFlags: featureFlags, children: (0, jsx_runtime_1.jsxs)(react_1.TooltipProvider, { children: [(0, jsx_runtime_1.jsx)(StripeRedirectHandler_1.StripeRedirectHandler, {}), children] }) }));
46
34
  };
47
35
  exports.AnyspendProvider = AnyspendProvider;
@@ -1,8 +1,9 @@
1
- import { Chain } from "viem";
2
1
  import { components } from "../../anyspend/types/api";
2
+ import { Chain } from "viem";
3
3
  export declare enum ChainType {
4
4
  EVM = "evm",
5
- SOLANA = "solana"
5
+ SOLANA = "solana",
6
+ HYPERLIQUID = "hyperliquid"
6
7
  }
7
8
  export interface IBaseChain {
8
9
  id: number;
@@ -25,3 +26,10 @@ export interface IEVMChain extends IBaseChain {
25
26
  export interface ISolanaChain extends IBaseChain {
26
27
  type: ChainType.SOLANA;
27
28
  }
29
+ export interface IHyperliquidChain extends IBaseChain {
30
+ type: ChainType.HYPERLIQUID;
31
+ apiUrl: string;
32
+ blockExplorer: {
33
+ url: string;
34
+ };
35
+ }
@@ -5,4 +5,5 @@ var ChainType;
5
5
  (function (ChainType) {
6
6
  ChainType["EVM"] = "evm";
7
7
  ChainType["SOLANA"] = "solana";
8
+ ChainType["HYPERLIQUID"] = "hyperliquid";
8
9
  })(ChainType || (exports.ChainType = ChainType = {}));
@@ -1,4 +1,15 @@
1
1
  export declare function isSolanaAddress(address: string): boolean;
2
2
  export declare function isEvmOrSolanaAddress(address: string): boolean;
3
+ /**
4
+ * Check if an address is Hyperliquid's special USDC address.
5
+ * Hyperliquid USDC uses a special 34-character format (0x + 32 hex digits)
6
+ * instead of the standard 42-character Ethereum address format.
7
+ * This is required by Relay SDK for Hyperliquid integration.
8
+ *
9
+ * @param chainId - The chain ID to check
10
+ * @param address - The token address to validate
11
+ * @returns true if the address is Hyperliquid USDC's special format
12
+ */
13
+ export declare function isHyperliquidUSDC(chainId: number, address: string): boolean;
3
14
  export declare function normalizeAddress(address: string): string;
4
15
  export declare function eqci(a: string | null | undefined, b: string | null | undefined): boolean;
@@ -2,9 +2,11 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isSolanaAddress = isSolanaAddress;
4
4
  exports.isEvmOrSolanaAddress = isEvmOrSolanaAddress;
5
+ exports.isHyperliquidUSDC = isHyperliquidUSDC;
5
6
  exports.normalizeAddress = normalizeAddress;
6
7
  exports.eqci = eqci;
7
8
  const viem_1 = require("viem");
9
+ const token_1 = require("./token");
8
10
  function isSolanaAddress(address) {
9
11
  // Solana addresses are 32-byte base58 strings (usually 32-44 characters)
10
12
  const solanaAddressRegex = /^[1-9A-HJ-NP-Za-km-z]{32,44}$/;
@@ -13,6 +15,19 @@ function isSolanaAddress(address) {
13
15
  function isEvmOrSolanaAddress(address) {
14
16
  return (0, viem_1.isAddress)(address) || isSolanaAddress(address);
15
17
  }
18
+ /**
19
+ * Check if an address is Hyperliquid's special USDC address.
20
+ * Hyperliquid USDC uses a special 34-character format (0x + 32 hex digits)
21
+ * instead of the standard 42-character Ethereum address format.
22
+ * This is required by Relay SDK for Hyperliquid integration.
23
+ *
24
+ * @param chainId - The chain ID to check
25
+ * @param address - The token address to validate
26
+ * @returns true if the address is Hyperliquid USDC's special format
27
+ */
28
+ function isHyperliquidUSDC(chainId, address) {
29
+ return chainId === token_1.HYPERLIQUID_CHAIN_ID && address.toLowerCase() === "0x00000000000000000000000000000000";
30
+ }
16
31
  function normalizeAddress(address) {
17
32
  if (isSolanaAddress(address)) {
18
33
  return address;
@@ -1,11 +1,51 @@
1
1
  import { components } from "../../anyspend/types/api";
2
2
  import { Account, Chain, PublicClient, Transport, WalletClient } from "viem";
3
- import { ChainType, IBaseChain, IEVMChain, ISolanaChain } from "../types/chain";
3
+ import { ChainType, IBaseChain, IEVMChain, IHyperliquidChain, ISolanaChain } from "../types/chain";
4
+ export declare const hyperEVM: {
5
+ blockExplorers: {
6
+ readonly default: {
7
+ readonly name: "HyperEVM Explorer";
8
+ readonly url: "https://hyperevmscan.io/";
9
+ };
10
+ };
11
+ blockTime?: number | undefined | undefined;
12
+ contracts?: {
13
+ [x: string]: import("viem").ChainContract | {
14
+ [sourceId: number]: import("viem").ChainContract | undefined;
15
+ } | undefined;
16
+ ensRegistry?: import("viem").ChainContract | undefined;
17
+ ensUniversalResolver?: import("viem").ChainContract | undefined;
18
+ multicall3?: import("viem").ChainContract | undefined;
19
+ erc6492Verifier?: import("viem").ChainContract | undefined;
20
+ } | undefined;
21
+ ensTlds?: readonly string[] | undefined;
22
+ id: 999;
23
+ name: "HyperEVM";
24
+ nativeCurrency: {
25
+ readonly name: "HyperEVM";
26
+ readonly symbol: "HYPE";
27
+ readonly decimals: 18;
28
+ };
29
+ experimental_preconfirmationTime?: number | undefined | undefined;
30
+ rpcUrls: {
31
+ readonly default: {
32
+ readonly http: readonly ["https://rpc.hyperliquid.xyz/evm"];
33
+ };
34
+ };
35
+ sourceId?: number | undefined | undefined;
36
+ testnet?: boolean | undefined | undefined;
37
+ custom?: Record<string, unknown> | undefined;
38
+ fees?: import("viem").ChainFees<undefined> | undefined;
39
+ formatters?: undefined;
40
+ serializers?: import("viem").ChainSerializers<undefined, import("viem").TransactionSerializable> | undefined;
41
+ };
4
42
  export declare const EVM_MAINNET: Record<number, IEVMChain>;
5
43
  export declare const EVM_TESTNET: Record<number, IEVMChain>;
6
44
  export declare const SOLANA_MAINNET: ISolanaChain;
45
+ export declare const HYPERLIQUID_MAINNET: IHyperliquidChain;
7
46
  export declare const EVM_CHAINS: Record<number, IEVMChain>;
8
47
  export declare const SOLANA_CHAINS: Record<number, ISolanaChain>;
48
+ export declare const HYPERLIQUID_CHAINS: Record<number, IHyperliquidChain>;
9
49
  export declare const ALL_CHAINS: Record<number, IBaseChain>;
10
50
  export declare function getSolanaChains(network: "mainnet" | "testnet"): ISolanaChain;
11
51
  export declare function getAllEvmChains(network: "mainnet" | "testnet"): Record<number, IEVMChain>;
@@ -25,3 +65,20 @@ export declare function getExplorerAddressUrl(chainId: number, address: string):
25
65
  export declare function getMulticall3Address(chainId: number): string;
26
66
  export declare function getNativeToken(chainId: number): components["schemas"]["Token"];
27
67
  export declare function isEvmChain(chainId: number): boolean;
68
+ export declare function isHyperliquidChain(chainId: number): boolean;
69
+ export declare function getHyperliquidChain(chainId: number): IHyperliquidChain;
70
+ /**
71
+ * Get available chain IDs for AnySpend based on context (source or destination).
72
+ * Filters out chains that shouldn't be available for the given context.
73
+ *
74
+ * @param context - "from" for source chains, "to" for destination chains
75
+ * @returns Array of available chain IDs
76
+ *
77
+ * @example
78
+ * // Get source chains (excludes Hyperliquid)
79
+ * const sourceChains = getAvailableChainIds("from") // [1, 8453, 137, ...]
80
+ *
81
+ * // Get destination chains (includes Hyperliquid)
82
+ * const destChains = getAvailableChainIds("to") // [1, 8453, 137, ..., 1337]
83
+ */
84
+ export declare function getAvailableChainIds(context: "from" | "to"): number[];
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.ALL_CHAINS = exports.SOLANA_CHAINS = exports.EVM_CHAINS = exports.SOLANA_MAINNET = exports.EVM_TESTNET = exports.EVM_MAINNET = void 0;
6
+ exports.ALL_CHAINS = exports.HYPERLIQUID_CHAINS = exports.SOLANA_CHAINS = exports.EVM_CHAINS = exports.HYPERLIQUID_MAINNET = exports.SOLANA_MAINNET = exports.EVM_TESTNET = exports.EVM_MAINNET = exports.hyperEVM = void 0;
7
7
  exports.getSolanaChains = getSolanaChains;
8
8
  exports.getAllEvmChains = getAllEvmChains;
9
9
  exports.getChainType = getChainType;
@@ -22,6 +22,9 @@ exports.getExplorerAddressUrl = getExplorerAddressUrl;
22
22
  exports.getMulticall3Address = getMulticall3Address;
23
23
  exports.getNativeToken = getNativeToken;
24
24
  exports.isEvmChain = isEvmChain;
25
+ exports.isHyperliquidChain = isHyperliquidChain;
26
+ exports.getHyperliquidChain = getHyperliquidChain;
27
+ exports.getAvailableChainIds = getAvailableChainIds;
25
28
  const constants_1 = require("../../anyspend/constants");
26
29
  const invariant_1 = __importDefault(require("invariant"));
27
30
  const viem_1 = require("viem");
@@ -31,6 +34,13 @@ const token_1 = require("./token");
31
34
  function getCustomEvmChain(chain, rpcUrl) {
32
35
  return (0, viem_1.defineChain)({ ...chain, rpcUrls: { default: { http: [rpcUrl] } } });
33
36
  }
37
+ exports.hyperEVM = (0, viem_1.defineChain)({
38
+ id: token_1.HYPEREVM_CHAIN_ID,
39
+ name: "HyperEVM",
40
+ nativeCurrency: { name: "HyperEVM", symbol: "HYPE", decimals: 18 },
41
+ rpcUrls: { default: { http: ["https://rpc.hyperliquid.xyz/evm"] } },
42
+ blockExplorers: { default: { name: "HyperEVM Explorer", url: "https://hyperevmscan.io/" } },
43
+ });
34
44
  // export const b4testnet = defineChain({
35
45
  // id: 19934,
36
46
  // name: "B4 Testnet",
@@ -174,6 +184,20 @@ exports.EVM_MAINNET = {
174
184
  coingeckoName: "abstract",
175
185
  wethAddress: "0x3439153eb7af838ad19d56e1571fbd09333c2809",
176
186
  },
187
+ [exports.hyperEVM.id]: {
188
+ id: exports.hyperEVM.id,
189
+ name: exports.hyperEVM.name,
190
+ logoUrl: "https://s2.coinmarketcap.com/static/img/coins/64x64/32196.png",
191
+ type: chain_1.ChainType.EVM,
192
+ nativeRequired: (0, viem_1.parseEther)("0.01"),
193
+ canDepositNative: true,
194
+ defaultToken: (0, token_1.getHyperEVMNativeToken)(),
195
+ nativeToken: (0, token_1.getHyperEVMNativeToken)(),
196
+ viem: exports.hyperEVM,
197
+ pollingInterval: 1000, // 1 second for Hyperliquid
198
+ coingeckoName: "hyperevm",
199
+ wethAddress: "0x5555555555555555555555555555555555555555",
200
+ },
177
201
  };
178
202
  exports.EVM_TESTNET = {
179
203
  // [sepolia.id]: {
@@ -235,9 +259,27 @@ exports.SOLANA_MAINNET = {
235
259
  nativeToken: (0, token_1.getSolanaToken)(),
236
260
  coingeckoName: "solana",
237
261
  };
262
+ exports.HYPERLIQUID_MAINNET = {
263
+ id: token_1.HYPERLIQUID_CHAIN_ID,
264
+ name: "Hyperliquid",
265
+ type: chain_1.ChainType.HYPERLIQUID,
266
+ logoUrl: "https://s2.coinmarketcap.com/static/img/coins/64x64/32196.png",
267
+ nativeRequired: BigInt(0), // No native transfer needed - using Relay's useDepositAddress flow (USDC is native)
268
+ canDepositNative: true, // Can deposit USDC (native token)
269
+ defaultToken: (0, token_1.getHyperliquidUSDCToken)(),
270
+ nativeToken: (0, token_1.getHyperliquidUSDCToken)(),
271
+ coingeckoName: null,
272
+ apiUrl: "https://api.hyperliquid.xyz",
273
+ blockExplorer: {
274
+ url: "https://app.hyperliquid.xyz/explorer",
275
+ },
276
+ };
238
277
  exports.EVM_CHAINS = { ...exports.EVM_MAINNET, ...exports.EVM_TESTNET };
239
278
  exports.SOLANA_CHAINS = { [constants_1.RELAY_SOLANA_MAINNET_CHAIN_ID]: exports.SOLANA_MAINNET };
240
- exports.ALL_CHAINS = { ...exports.EVM_CHAINS, ...exports.SOLANA_CHAINS };
279
+ exports.HYPERLIQUID_CHAINS = {
280
+ [token_1.HYPERLIQUID_CHAIN_ID]: exports.HYPERLIQUID_MAINNET,
281
+ };
282
+ exports.ALL_CHAINS = { ...exports.EVM_CHAINS, ...exports.SOLANA_CHAINS, ...exports.HYPERLIQUID_CHAINS };
241
283
  function getSolanaChains(network) {
242
284
  (0, invariant_1.default)(network === "mainnet", "Solana chain is only supported on mainnet");
243
285
  return exports.SOLANA_MAINNET;
@@ -275,7 +317,7 @@ function canDepositNative(chainId) {
275
317
  return exports.ALL_CHAINS[chainId].canDepositNative;
276
318
  }
277
319
  function isMainnet(chainId) {
278
- return exports.EVM_MAINNET[chainId] !== undefined || constants_1.RELAY_SOLANA_MAINNET_CHAIN_ID === chainId;
320
+ return (exports.EVM_MAINNET[chainId] !== undefined || constants_1.RELAY_SOLANA_MAINNET_CHAIN_ID === chainId || token_1.HYPERLIQUID_CHAIN_ID === chainId);
279
321
  }
280
322
  function isTestnet(chainId) {
281
323
  return exports.EVM_TESTNET[chainId] !== undefined;
@@ -286,7 +328,11 @@ function getDefaultToken(chainId) {
286
328
  }
287
329
  function getChainName(chainId) {
288
330
  (0, invariant_1.default)(exports.ALL_CHAINS[chainId], `Chain ${chainId} is not supported`);
289
- return exports.EVM_CHAINS[chainId] ? exports.EVM_CHAINS[chainId].viem.name : "Solana";
331
+ const chain = exports.ALL_CHAINS[chainId];
332
+ if (isEvmChain(chainId)) {
333
+ return chain.viem.name;
334
+ }
335
+ return chain.name;
290
336
  }
291
337
  function getCoingeckoName(chainId) {
292
338
  (0, invariant_1.default)(exports.ALL_CHAINS[chainId], `Chain ${chainId} is not supported`);
@@ -435,6 +481,12 @@ function getPaymentUrl(address, amount, currency, chainId, decimals) {
435
481
  console.log("Solana URL (isNativeSOL:", isNativeSOL, "):", url);
436
482
  return url;
437
483
  }
484
+ case chain_1.ChainType.HYPERLIQUID: {
485
+ // NOTE: Hyperliquid is only supported as destination chain (not source chain).
486
+ // Payment URLs are not needed since users cannot send FROM Hyperliquid in our flow.
487
+ // Return address as placeholder (this code path should not be reached).
488
+ return address;
489
+ }
438
490
  default:
439
491
  // Fallback to just the address if chain type is unknown
440
492
  return address;
@@ -447,12 +499,20 @@ function getExplorerTxUrl(chainId, txHash) {
447
499
  if (exports.EVM_CHAINS[chainId]) {
448
500
  return exports.EVM_CHAINS[chainId].viem.blockExplorers?.default.url + "/tx/" + txHash;
449
501
  }
502
+ if (exports.HYPERLIQUID_CHAINS[chainId]) {
503
+ return exports.HYPERLIQUID_CHAINS[chainId].blockExplorer.url + "/tx/" + txHash;
504
+ }
505
+ // Default to Solscan for Solana transactions
450
506
  return "https://solscan.io/tx/" + txHash;
451
507
  }
452
508
  function getExplorerAddressUrl(chainId, address) {
453
509
  if (exports.EVM_CHAINS[chainId]) {
454
510
  return exports.EVM_CHAINS[chainId].viem.blockExplorers?.default.url + "/address/" + address;
455
511
  }
512
+ if (exports.HYPERLIQUID_CHAINS[chainId]) {
513
+ return exports.HYPERLIQUID_CHAINS[chainId].blockExplorer.url + "/address/" + address;
514
+ }
515
+ // Default to Solscan for Solana addresses
456
516
  return "https://solscan.io/account/" + address;
457
517
  }
458
518
  function getMulticall3Address(chainId) {
@@ -469,3 +529,33 @@ function getNativeToken(chainId) {
469
529
  function isEvmChain(chainId) {
470
530
  return Boolean(exports.EVM_CHAINS[chainId]);
471
531
  }
532
+ function isHyperliquidChain(chainId) {
533
+ return exports.HYPERLIQUID_CHAINS[chainId] !== undefined;
534
+ }
535
+ function getHyperliquidChain(chainId) {
536
+ (0, invariant_1.default)(exports.HYPERLIQUID_CHAINS[chainId], `Chain ${chainId} is not a Hyperliquid chain`);
537
+ return exports.HYPERLIQUID_CHAINS[chainId];
538
+ }
539
+ /**
540
+ * Get available chain IDs for AnySpend based on context (source or destination).
541
+ * Filters out chains that shouldn't be available for the given context.
542
+ *
543
+ * @param context - "from" for source chains, "to" for destination chains
544
+ * @returns Array of available chain IDs
545
+ *
546
+ * @example
547
+ * // Get source chains (excludes Hyperliquid)
548
+ * const sourceChains = getAvailableChainIds("from") // [1, 8453, 137, ...]
549
+ *
550
+ * // Get destination chains (includes Hyperliquid)
551
+ * const destChains = getAvailableChainIds("to") // [1, 8453, 137, ..., 1337]
552
+ */
553
+ function getAvailableChainIds(context) {
554
+ const allChainIds = Object.values(exports.ALL_CHAINS).map(chain => chain.id);
555
+ if (context === "from") {
556
+ // Hyperliquid is only supported as destination chain, not source chain
557
+ return allChainIds.filter(chainId => chainId !== token_1.HYPERLIQUID_CHAIN_ID);
558
+ }
559
+ // For destination ("to"), all chains are available including Hyperliquid
560
+ return allChainIds;
561
+ }
@@ -1,7 +1,11 @@
1
1
  import { components } from "../../anyspend/types/api";
2
+ export declare const HYPERLIQUID_CHAIN_ID = 1337;
3
+ export declare const HYPEREVM_CHAIN_ID = 999;
2
4
  export declare function isNativeToken(address: string): boolean;
3
5
  export declare function getSolanaToken(): components["schemas"]["Token"];
4
6
  export declare function getEthToken(chainId: number): components["schemas"]["Token"];
5
7
  export declare function getPolToken(): components["schemas"]["Token"];
6
8
  export declare function getBnbToken(): components["schemas"]["Token"];
7
9
  export declare function getAvaxToken(): components["schemas"]["Token"];
10
+ export declare function getHyperEVMNativeToken(): components["schemas"]["Token"];
11
+ export declare function getHyperliquidUSDCToken(): components["schemas"]["Token"];
@@ -1,15 +1,20 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HYPEREVM_CHAIN_ID = exports.HYPERLIQUID_CHAIN_ID = void 0;
3
4
  exports.isNativeToken = isNativeToken;
4
5
  exports.getSolanaToken = getSolanaToken;
5
6
  exports.getEthToken = getEthToken;
6
7
  exports.getPolToken = getPolToken;
7
8
  exports.getBnbToken = getBnbToken;
8
9
  exports.getAvaxToken = getAvaxToken;
9
- const chains_1 = require("viem/chains");
10
+ exports.getHyperEVMNativeToken = getHyperEVMNativeToken;
11
+ exports.getHyperliquidUSDCToken = getHyperliquidUSDCToken;
10
12
  const constants_1 = require("../../anyspend/constants");
13
+ const chains_1 = require("viem/chains");
14
+ exports.HYPERLIQUID_CHAIN_ID = 1337;
15
+ exports.HYPEREVM_CHAIN_ID = 999;
11
16
  function isNativeToken(address) {
12
- return address.toLowerCase() === constants_1.RELAY_ETH_ADDRESS || address.toLowerCase() === constants_1.RELAY_SOL_ADDRESS;
17
+ return address.toLowerCase() === constants_1.ZERO_ADDRESS || address.toLowerCase() === constants_1.RELAY_SOL_ADDRESS;
13
18
  }
14
19
  function getSolanaToken() {
15
20
  return {
@@ -26,7 +31,7 @@ function getSolanaToken() {
26
31
  function getEthToken(chainId) {
27
32
  return {
28
33
  chainId: chainId,
29
- address: constants_1.RELAY_ETH_ADDRESS,
34
+ address: constants_1.ZERO_ADDRESS,
30
35
  symbol: "ETH",
31
36
  name: "Ethereum",
32
37
  decimals: 18,
@@ -38,7 +43,7 @@ function getEthToken(chainId) {
38
43
  function getPolToken() {
39
44
  return {
40
45
  chainId: chains_1.polygon.id,
41
- address: constants_1.RELAY_ETH_ADDRESS,
46
+ address: constants_1.ZERO_ADDRESS,
42
47
  symbol: "POL",
43
48
  name: "Polygon",
44
49
  decimals: 18,
@@ -50,7 +55,7 @@ function getPolToken() {
50
55
  function getBnbToken() {
51
56
  return {
52
57
  chainId: chains_1.bsc.id,
53
- address: constants_1.RELAY_ETH_ADDRESS,
58
+ address: constants_1.ZERO_ADDRESS,
54
59
  symbol: "BNB",
55
60
  name: "BNB",
56
61
  decimals: 18,
@@ -62,7 +67,7 @@ function getBnbToken() {
62
67
  function getAvaxToken() {
63
68
  return {
64
69
  chainId: chains_1.avalanche.id,
65
- address: constants_1.RELAY_ETH_ADDRESS,
70
+ address: constants_1.ZERO_ADDRESS,
66
71
  symbol: "AVAX",
67
72
  name: "AVAX",
68
73
  decimals: 18,
@@ -71,3 +76,27 @@ function getAvaxToken() {
71
76
  },
72
77
  };
73
78
  }
79
+ function getHyperEVMNativeToken() {
80
+ return {
81
+ chainId: exports.HYPEREVM_CHAIN_ID,
82
+ address: constants_1.ZERO_ADDRESS,
83
+ symbol: "HYPE",
84
+ name: "HYPE",
85
+ decimals: 18,
86
+ metadata: {
87
+ logoURI: "https://s2.coinmarketcap.com/static/img/coins/64x64/32196.png",
88
+ },
89
+ };
90
+ }
91
+ function getHyperliquidUSDCToken() {
92
+ return {
93
+ chainId: exports.HYPERLIQUID_CHAIN_ID,
94
+ address: constants_1.ZERO_ADDRESS,
95
+ symbol: "USDC",
96
+ name: "USD Coin",
97
+ decimals: 6,
98
+ metadata: {
99
+ logoURI: "https://ethereum-optimism.github.io/data/USDC/logo.png",
100
+ },
101
+ };
102
+ }
@@ -43,7 +43,7 @@ toaster: _toaster, clientType = "rest", rpcUrls, partnerId, onConnect, connector
43
43
  (0, react_2.useEffect)(() => {
44
44
  (0, client_manager_1.setClientType)(clientType);
45
45
  }, [clientType]);
46
- const wagmiConfig = (0, createWagmiConfig_1.createWagmiConfig)({ partnerId, rpcUrls, connectors, overrideDefaultConnectors });
46
+ const wagmiConfig = (0, react_2.useMemo)(() => (0, createWagmiConfig_1.createWagmiConfig)({ partnerId, rpcUrls, connectors, overrideDefaultConnectors }), [partnerId, rpcUrls, connectors, overrideDefaultConnectors]);
47
47
  return ((0, jsx_runtime_1.jsx)(react_3.ThirdwebProvider, { children: (0, jsx_runtime_1.jsx)(wagmi_1.WagmiProvider, { config: wagmiConfig, reconnectOnMount: false, children: (0, jsx_runtime_1.jsx)(react_query_1.QueryClientProvider, { client: queryClient, children: (0, jsx_runtime_1.jsx)(react_1.TooltipProvider, { children: (0, jsx_runtime_1.jsx)(index_1.ToastProvider, { children: (0, jsx_runtime_1.jsx)(LocalSDKProvider_1.LocalSDKProvider, { onConnectCallback: onConnect, children: (0, jsx_runtime_1.jsxs)(InnerProvider, { accountOverride: accountOverride, environment: environment, theme: theme, automaticallySetFirstEoa: !!automaticallySetFirstEoa, clientType: clientType, partnerId: partnerId, createClientReferenceId: createClientReferenceId, enableTurnkey: enableTurnkey, children: [(0, jsx_runtime_1.jsx)(ToastContextConnector, {}), (0, jsx_runtime_1.jsxs)(react_1.RelayKitProviderWrapper, { simDuneApiKey: simDuneApiKey, children: [children, (0, jsx_runtime_1.jsx)(StyleRoot_1.StyleRoot, { id: "b3-root" })] })] }) }) }) }) }) }) }));
48
48
  }
49
49
  /**
@@ -12,12 +12,12 @@ const utils_1 = require("../../../../shared/utils");
12
12
  const react_2 = require("@headlessui/react");
13
13
  const react_3 = require("react");
14
14
  const react_4 = require("thirdweb/react");
15
- const useAccountWallet_1 = require("../../hooks/useAccountWallet");
16
15
  const ManageAccountButton_1 = require("../custom/ManageAccountButton");
17
16
  function SignIn(props) {
18
17
  const { className } = props;
19
18
  const { automaticallySetFirstEoa, partnerId } = (0, react_1.useB3)();
20
- const { address: globalAddress, ensName, connectedSmartWallet, connectedEOAWallet, isActiveSmartWallet, isActiveEOAWallet, smartWalletIcon, eoaWalletIcon, } = (0, react_1.useAccountWallet)();
19
+ const { address: globalAddress, ensName, connectedSmartWallet, connectedEOAWallet, isActiveSmartWallet, isActiveEOAWallet, smartWalletIcon, } = (0, react_1.useAccountWallet)();
20
+ const { data: walletImage } = (0, react_4.useWalletImage)(connectedEOAWallet?.id);
21
21
  const isMobile = (0, react_1.useIsMobile)();
22
22
  const { logout } = (0, react_1.useAuthentication)(partnerId);
23
23
  const onDisconnect = async () => {
@@ -40,11 +40,10 @@ function SignIn(props) {
40
40
  setActiveWallet(connectedEOAWallet);
41
41
  }
42
42
  }, [connectedEOAWallet, isActiveEOAWallet, setActiveWallet, automaticallySetFirstEoa]);
43
- const walletImage = (0, useAccountWallet_1.useAccountWalletImage)();
44
43
  // Desktop version - original dropdown menu
45
44
  return ((0, jsx_runtime_1.jsx)(react_1.StyleRoot, { children: (0, jsx_runtime_1.jsx)(react_2.Menu, { className: `relative flex items-center ${className || ""}`, as: "div", children: globalAddress ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(react_2.MenuButton, { className: "bg-b3-react-background group flex h-10 items-center gap-1 rounded-xl px-3 focus:outline-none", children: [!!walletImage && ((0, jsx_runtime_1.jsx)(react_1.IPFSMediaRenderer, { src: walletImage, alt: "Wallet Image", className: "bg-b3-react-primary h-6 w-6 rounded-full object-cover opacity-100" })), (0, jsx_runtime_1.jsx)("div", { className: "text-as-primary", children: ensName ? ensName : (0, utils_1.truncateAddress)(globalAddress) })] }), (0, jsx_runtime_1.jsx)(react_2.Transition, { enter: "duration-200 ease-out", enterFrom: "scale-95 opacity-0", enterTo: "scale-100 opacity-100", leave: "duration-300 ease-out", leaveFrom: "scale-100 opacity-100", leaveTo: "scale-95 opacity-0", children: (0, jsx_runtime_1.jsx)(react_2.MenuItems, { className: "b3-root absolute -right-4 top-full min-w-64 rounded-2xl border focus:outline-none lg:right-0", modal: false,
46
45
  // TODO: Figure out why setting anchor on mobile causes z-index issues where it appears under elements
47
- anchor: isMobile ? "top end" : undefined, children: (0, jsx_runtime_1.jsxs)("div", { className: "bg-b3-react-background", children: [connectedEOAWallet ? ((0, jsx_runtime_1.jsxs)("div", { className: (0, utils_1.cn)("border-b3-react-subtle bg-b3-react-background flex cursor-pointer items-center justify-between rounded-xl p-3"), onClick: () => handleSetActiveAccount(connectedEOAWallet?.id), children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center", children: [(0, jsx_runtime_1.jsx)("img", { className: "bg-b3-react-primary h-16 w-16 rounded-full opacity-100", src: eoaWalletIcon, alt: connectedEOAWallet?.id }), (0, jsx_runtime_1.jsxs)("div", { className: "ml-4 grow", children: [ensName && (0, jsx_runtime_1.jsx)("div", { children: ensName }), (0, jsx_runtime_1.jsx)("div", { children: (0, utils_1.truncateAddress)(globalAddress) })] })] }), isActiveEOAWallet && (0, jsx_runtime_1.jsx)(Icon_1.default, { className: "fill-b3-react-primary", name: "check" })] })) : (connectedSmartWallet && ((0, jsx_runtime_1.jsxs)("div", { className: (0, utils_1.cn)("mb-2 flex cursor-pointer items-center justify-between rounded-xl p-3", isActiveSmartWallet
46
+ anchor: isMobile ? "top end" : undefined, children: (0, jsx_runtime_1.jsxs)("div", { className: "bg-b3-react-background", children: [connectedEOAWallet ? ((0, jsx_runtime_1.jsxs)("div", { className: (0, utils_1.cn)("border-b3-react-subtle bg-b3-react-background flex cursor-pointer items-center justify-between rounded-xl p-3"), onClick: () => handleSetActiveAccount(connectedEOAWallet?.id), children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center", children: [(0, jsx_runtime_1.jsx)("img", { className: "bg-b3-react-primary h-16 w-16 rounded-full opacity-100", src: walletImage, alt: connectedEOAWallet?.id }), (0, jsx_runtime_1.jsxs)("div", { className: "ml-4 grow", children: [ensName && (0, jsx_runtime_1.jsx)("div", { children: ensName }), (0, jsx_runtime_1.jsx)("div", { children: (0, utils_1.truncateAddress)(globalAddress) })] })] }), isActiveEOAWallet && (0, jsx_runtime_1.jsx)(Icon_1.default, { className: "fill-b3-react-primary", name: "check" })] })) : (connectedSmartWallet && ((0, jsx_runtime_1.jsxs)("div", { className: (0, utils_1.cn)("mb-2 flex cursor-pointer items-center justify-between rounded-xl p-3", isActiveSmartWallet
48
47
  ? "bg-b3-react-background"
49
48
  : "bg-b3-react-background hover:bg-b3-react-background"), onClick: () => handleSetActiveAccount(connectedSmartWallet?.id), children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center", children: [(0, jsx_runtime_1.jsx)("img", { className: "bg-b3-react-primary h-16 w-16 rounded-full opacity-100", src: smartWalletIcon, alt: connectedSmartWallet?.id }), (0, jsx_runtime_1.jsxs)("div", { className: "grow pl-4", children: [ensName && (0, jsx_runtime_1.jsx)("div", { children: ensName }), (0, jsx_runtime_1.jsx)("div", { children: (0, utils_1.truncateAddress)(globalAddress) }), (0, jsx_runtime_1.jsx)("div", { children: "Smart wallet" })] })] }), isActiveSmartWallet && (0, jsx_runtime_1.jsx)(Icon_1.default, { className: "fill-b3-react-primary", name: "check" })] }))), (0, jsx_runtime_1.jsx)("div", { className: "ml-3", children: (0, jsx_runtime_1.jsx)(ManageAccountButton_1.ManageAccountButton, { ...props, className: "w-[calc(100%-12px)]" }) }), (0, jsx_runtime_1.jsx)("button", { className: "mb-2 w-full space-y-1", onClick: onDisconnect, children: (0, jsx_runtime_1.jsxs)("div", { className: "hover:bg-b3-react-background group flex h-12 items-center rounded-xl px-4 transition-colors", children: [(0, jsx_runtime_1.jsx)(Icon_1.default, { className: "fill-b3-react-primary mr-4 shrink-0 transition-colors", name: "logout" }), (0, jsx_runtime_1.jsx)("div", { className: "text-b3-react-primary mr-auto transition-colors", children: "Disconnect" })] }) })] }) }) })] })) : ((0, jsx_runtime_1.jsx)(react_1.SignInWithB3, { closeAfterLogin: true, onLoginSuccess: async (globalAccount) => {
50
49
  console.log("User authenticated with Global Account!", globalAccount);
@@ -6,7 +6,6 @@ const react_1 = require("../../../../global-account/react");
6
6
  const debug_1 = require("../../../../shared/utils/debug");
7
7
  const react_2 = require("react");
8
8
  const react_3 = require("thirdweb/react");
9
- const TurnkeyAuthModal_1 = require("../TurnkeyAuthModal");
10
9
  const SignInWithB3Privy_1 = require("./SignInWithB3Privy");
11
10
  const LoginStep_1 = require("./steps/LoginStep");
12
11
  const LoginStepCustom_1 = require("./steps/LoginStepCustom");
@@ -24,9 +23,7 @@ function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onE
24
23
  const account = (0, react_3.useActiveAccount)();
25
24
  const isAuthenticating = (0, react_1.useAuthStore)(state => state.isAuthenticating);
26
25
  const isAuthenticated = (0, react_1.useAuthStore)(state => state.isAuthenticated);
27
- const setIsAuthenticated = (0, react_1.useAuthStore)(state => state.setIsAuthenticated);
28
26
  const isConnected = (0, react_1.useAuthStore)(state => state.isConnected);
29
- const setIsConnected = (0, react_1.useAuthStore)(state => state.setIsConnected);
30
27
  const setJustCompletedLogin = (0, react_1.useAuthStore)(state => state.setJustCompletedLogin);
31
28
  const [refetchCount, setRefetchCount] = (0, react_2.useState)(0);
32
29
  const [refetchError, setRefetchError] = (0, react_2.useState)(null);
@@ -128,10 +125,6 @@ function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onE
128
125
  debug("Refetching user after Turnkey success...");
129
126
  await refetchUser();
130
127
  debug("User refetched successfully");
131
- // Set authentication and connection state so UI updates properly
132
- setIsAuthenticated(true);
133
- setIsConnected(true);
134
- setJustCompletedLogin(true);
135
128
  // After user data is refreshed, close Turnkey modal and go back to sign-in flow
136
129
  debug("Switching back to signInWithB3 modal");
137
130
  setB3ModalContentType({
@@ -161,9 +154,6 @@ function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onE
161
154
  closeAfterLogin,
162
155
  source,
163
156
  signersEnabled,
164
- setIsAuthenticated,
165
- setIsConnected,
166
- setJustCompletedLogin,
167
157
  ]);
168
158
  // Handle post-login flow after signers are loaded
169
159
  (0, react_2.useEffect)(() => {
@@ -299,56 +289,21 @@ function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onE
299
289
  if (refetchError) {
300
290
  content = ((0, jsx_runtime_1.jsx)(LoginStep_1.LoginStepContainer, { partnerId: partnerId, children: (0, jsx_runtime_1.jsx)("div", { className: "p-4 text-center text-red-500", children: refetchError }) }));
301
291
  }
292
+ else if (isAuthenticating || (isFetchingSigners && step === "login") || source === "requestPermissions") {
293
+ content = ((0, jsx_runtime_1.jsx)(LoginStep_1.LoginStepContainer, { partnerId: partnerId, children: (0, jsx_runtime_1.jsx)("div", { className: "my-8 flex min-h-[350px] items-center justify-center", children: (0, jsx_runtime_1.jsx)(react_1.Loading, { variant: "white", size: "lg" }) }) }));
294
+ }
302
295
  else if (step === "login") {
303
- // PRIORITY: If Turnkey is enabled, show Turnkey modal FIRST as the primary authentication option
304
- // Show Turnkey when enabled and not already completed in this session
305
- const shouldShowTurnkeyFirst = enableTurnkey && !turnkeyAuthCompleted;
306
- if (shouldShowTurnkeyFirst) {
307
- // Don't show loading spinner for Turnkey - let the modal handle its own loading state
308
- // This prevents the infinite loop where isAuthenticating causes the modal to be replaced
309
- debug("Showing Turnkey as primary authentication option", {
310
- enableTurnkey,
311
- turnkeyAuthCompleted,
312
- isAuthenticated,
313
- });
314
- // Show Turnkey authentication as primary option
315
- content = ((0, jsx_runtime_1.jsx)(LoginStep_1.LoginStepContainer, { partnerId: partnerId, children: (0, jsx_runtime_1.jsx)(TurnkeyAuthModal_1.TurnkeyAuthModal, { onSuccess: async (authenticatedUser) => {
316
- debug("Turnkey authentication successful in primary flow", { authenticatedUser });
317
- setTurnkeyAuthCompleted(true);
318
- // After Turnkey auth, refetch user to get the full user object
319
- await refetchUser();
320
- // User is now authenticated via Turnkey
321
- // Set both isAuthenticated and isConnected to true so UI updates properly
322
- // Wallet connection is optional and can happen later for signing transactions
323
- setIsAuthenticated(true);
324
- setIsConnected(true);
325
- setJustCompletedLogin(true);
326
- // Call the login success callback
327
- onLoginSuccess?.({});
328
- }, onClose: () => {
329
- // If user closes Turnkey modal, they can still use wallet connection as fallback
330
- setTurnkeyAuthCompleted(true);
331
- }, initialEmail: "", skipToOtp: false }) }));
296
+ // Custom strategy
297
+ if (strategies?.[0] === "privy") {
298
+ content = (0, jsx_runtime_1.jsx)(SignInWithB3Privy_1.SignInWithB3Privy, { onSuccess: handleLoginSuccess, chain: chain });
299
+ }
300
+ else if (strategies) {
301
+ // Strategies are explicitly provided
302
+ content = ((0, jsx_runtime_1.jsx)(LoginStepCustom_1.LoginStepCustom, { strategies: strategies, chain: chain, onSuccess: handleLoginSuccess, onError: onError, automaticallySetFirstEoa: !!automaticallySetFirstEoa }));
332
303
  }
333
304
  else {
334
- // Show loading spinner only if not in Turnkey flow
335
- if (isAuthenticating || (isFetchingSigners && step === "login") || source === "requestPermissions") {
336
- content = ((0, jsx_runtime_1.jsx)(LoginStep_1.LoginStepContainer, { partnerId: partnerId, children: (0, jsx_runtime_1.jsx)("div", { className: "my-8 flex min-h-[350px] items-center justify-center", children: (0, jsx_runtime_1.jsx)(react_1.Loading, { variant: "white", size: "lg" }) }) }));
337
- }
338
- else {
339
- // Custom strategy
340
- if (strategies?.[0] === "privy") {
341
- content = (0, jsx_runtime_1.jsx)(SignInWithB3Privy_1.SignInWithB3Privy, { onSuccess: handleLoginSuccess, chain: chain });
342
- }
343
- else if (strategies) {
344
- // Strategies are explicitly provided
345
- content = ((0, jsx_runtime_1.jsx)(LoginStepCustom_1.LoginStepCustom, { strategies: strategies, chain: chain, onSuccess: handleLoginSuccess, onError: onError, automaticallySetFirstEoa: !!automaticallySetFirstEoa }));
346
- }
347
- else {
348
- // Default to handle all strategies we support
349
- content = (0, jsx_runtime_1.jsx)(LoginStep_1.LoginStep, { chain: chain, onSuccess: handleLoginSuccess, onError: onError });
350
- }
351
- }
305
+ // Default to handle all strategies we support
306
+ content = (0, jsx_runtime_1.jsx)(LoginStep_1.LoginStep, { chain: chain, onSuccess: handleLoginSuccess, onError: onError });
352
307
  }
353
308
  }
354
309
  return content;
@@ -16,7 +16,7 @@ function LoginStepContainer({ children, partnerId }) {
16
16
  },
17
17
  }, !!partnerId);
18
18
  const partnerLogo = partner?.data?.[0]?.loginCustomization?.logoUrl;
19
- return ((0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col items-center justify-center pt-6", children: [partnerLogo && ((0, jsx_runtime_1.jsx)("img", { src: partnerLogo, alt: "Partner Logo", className: "partner-logo mb-6 h-12 w-auto object-contain" })), children] }));
19
+ return ((0, jsx_runtime_1.jsxs)("div", { className: "bg-b3-react-background flex flex-col items-center justify-center pt-6", children: [partnerLogo && ((0, jsx_runtime_1.jsx)("img", { src: partnerLogo, alt: "Partner Logo", className: "partner-logo mb-6 h-12 w-auto object-contain" })), children] }));
20
20
  }
21
21
  function LoginStep({ onSuccess, chain }) {
22
22
  const { partnerId, theme } = (0, react_1.useB3)();
@@ -3,11 +3,9 @@ export { useAccountAssets } from "./useAccountAssets";
3
3
  export { useAccountWallet } from "./useAccountWallet";
4
4
  export { useAddTWSessionKey } from "./useAddTWSessionKey";
5
5
  export { useAnalytics } from "./useAnalytics";
6
- export { useAuth } from "./useAuth";
7
6
  export { useAuthentication } from "./useAuthentication";
8
7
  export { useB3BalanceFromAddresses } from "./useB3BalanceFromAddresses";
9
8
  export { useB3EnsName } from "./useB3EnsName";
10
- export { useBestTransactionPath } from "./useBestTransactionPath";
11
9
  export { useChainSwitchWithAction } from "./useChainSwitchWithAction";
12
10
  export * from "./useClaim";
13
11
  export { useClient } from "./useClient";