@b3dotfun/sdk 0.0.40-test.6 → 0.0.41-test.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 (191) hide show
  1. package/dist/cjs/anyspend/constants/index.d.ts +0 -1
  2. package/dist/cjs/anyspend/constants/index.js +1 -2
  3. package/dist/cjs/anyspend/react/components/AnySpend.d.ts +10 -1
  4. package/dist/cjs/anyspend/react/components/AnySpend.js +12 -9
  5. package/dist/cjs/anyspend/react/components/AnySpendCustom.js +8 -9
  6. package/dist/cjs/anyspend/react/components/AnyspendDepositHype.d.ts +8 -0
  7. package/dist/cjs/anyspend/react/components/AnyspendDepositHype.js +10 -8
  8. package/dist/cjs/anyspend/react/components/common/ConnectWalletPayment.d.ts +2 -1
  9. package/dist/cjs/anyspend/react/components/common/ConnectWalletPayment.js +7 -4
  10. package/dist/cjs/anyspend/react/components/common/CryptoPaySection.d.ts +4 -1
  11. package/dist/cjs/anyspend/react/components/common/CryptoPaySection.js +9 -9
  12. package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.js +80 -10
  13. package/dist/cjs/anyspend/react/components/common/CryptoReceiveSection.d.ts +2 -1
  14. package/dist/cjs/anyspend/react/components/common/CryptoReceiveSection.js +39 -37
  15. package/dist/cjs/anyspend/react/components/common/OrderDetails.d.ts +2 -0
  16. package/dist/cjs/anyspend/react/components/common/OrderDetails.js +24 -23
  17. package/dist/cjs/anyspend/react/components/common/OrderDetailsCollapsible.js +9 -8
  18. package/dist/cjs/anyspend/react/components/common/OrderTokenAmount.d.ts +4 -1
  19. package/dist/cjs/anyspend/react/components/common/OrderTokenAmount.js +23 -9
  20. package/dist/cjs/anyspend/react/components/common/PanelOnramp.d.ts +4 -1
  21. package/dist/cjs/anyspend/react/components/common/PanelOnramp.js +7 -6
  22. package/dist/cjs/anyspend/react/components/common/PaymentMethodSwitch.d.ts +7 -0
  23. package/dist/cjs/anyspend/react/components/common/PaymentMethodSwitch.js +24 -0
  24. package/dist/cjs/anyspend/react/components/common/PointsDetailPanel.d.ts +6 -0
  25. package/dist/cjs/anyspend/react/components/common/PointsDetailPanel.js +14 -0
  26. package/dist/cjs/anyspend/react/components/common/TransferCryptoDetails.d.ts +2 -0
  27. package/dist/cjs/anyspend/react/components/common/TransferCryptoDetails.js +6 -4
  28. package/dist/cjs/anyspend/react/contexts/FeatureFlagsContext.d.ts +11 -0
  29. package/dist/cjs/anyspend/react/contexts/FeatureFlagsContext.js +21 -0
  30. package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.d.ts +4 -1
  31. package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.js +13 -5
  32. package/dist/cjs/anyspend/react/providers/AnyspendProvider.d.ts +5 -2
  33. package/dist/cjs/anyspend/react/providers/AnyspendProvider.js +5 -3
  34. package/dist/cjs/anyspend/react/providers/index.d.ts +1 -0
  35. package/dist/cjs/anyspend/react/providers/index.js +3 -0
  36. package/dist/cjs/anyspend/types/api.d.ts +10 -0
  37. package/dist/cjs/anyspend/utils/chain.js +1 -1
  38. package/dist/cjs/bondkit/bondkitToken.d.ts +37 -2
  39. package/dist/cjs/bondkit/bondkitToken.js +268 -2
  40. package/dist/cjs/bondkit/bondkitTokenFactory.d.ts +1 -1
  41. package/dist/cjs/bondkit/bondkitTokenFactory.js +2 -2
  42. package/dist/cjs/bondkit/config.d.ts +1 -1
  43. package/dist/cjs/bondkit/config.js +5 -2
  44. package/dist/cjs/bondkit/constants.d.ts +4 -0
  45. package/dist/cjs/bondkit/constants.js +6 -1
  46. package/dist/cjs/bondkit/index.d.ts +1 -0
  47. package/dist/cjs/bondkit/index.js +4 -1
  48. package/dist/cjs/bondkit/swapService.d.ts +43 -0
  49. package/dist/cjs/bondkit/swapService.js +373 -0
  50. package/dist/cjs/bondkit/types.d.ts +10 -4
  51. package/dist/cjs/bondkit/types.js +4 -5
  52. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.d.ts +2 -1
  53. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +14 -19
  54. package/dist/cjs/global-account/react/components/LinkAccount/LinkAccount.js +63 -3
  55. package/dist/cjs/global-account/react/components/ManageAccount/ManageAccount.js +35 -2
  56. package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStepCustom.js +4 -3
  57. package/dist/cjs/global-account/react/hooks/useAccountWallet.js +0 -12
  58. package/dist/cjs/global-account/react/hooks/useAuthentication.js +1 -2
  59. package/dist/cjs/global-account/react/hooks/useSimBalance.js +2 -2
  60. package/dist/cjs/global-account/react/hooks/useUnifiedChainSwitchAndExecute.js +27 -22
  61. package/dist/esm/anyspend/constants/index.d.ts +0 -1
  62. package/dist/esm/anyspend/constants/index.js +0 -1
  63. package/dist/esm/anyspend/react/components/AnySpend.d.ts +10 -1
  64. package/dist/esm/anyspend/react/components/AnySpend.js +13 -10
  65. package/dist/esm/anyspend/react/components/AnySpendCustom.js +8 -9
  66. package/dist/esm/anyspend/react/components/AnyspendDepositHype.d.ts +8 -0
  67. package/dist/esm/anyspend/react/components/AnyspendDepositHype.js +11 -9
  68. package/dist/esm/anyspend/react/components/common/ConnectWalletPayment.d.ts +2 -1
  69. package/dist/esm/anyspend/react/components/common/ConnectWalletPayment.js +8 -5
  70. package/dist/esm/anyspend/react/components/common/CryptoPaySection.d.ts +4 -1
  71. package/dist/esm/anyspend/react/components/common/CryptoPaySection.js +9 -9
  72. package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.js +80 -10
  73. package/dist/esm/anyspend/react/components/common/CryptoReceiveSection.d.ts +2 -1
  74. package/dist/esm/anyspend/react/components/common/CryptoReceiveSection.js +39 -37
  75. package/dist/esm/anyspend/react/components/common/OrderDetails.d.ts +2 -0
  76. package/dist/esm/anyspend/react/components/common/OrderDetails.js +25 -24
  77. package/dist/esm/anyspend/react/components/common/OrderDetailsCollapsible.js +10 -9
  78. package/dist/esm/anyspend/react/components/common/OrderTokenAmount.d.ts +4 -1
  79. package/dist/esm/anyspend/react/components/common/OrderTokenAmount.js +23 -9
  80. package/dist/esm/anyspend/react/components/common/PanelOnramp.d.ts +4 -1
  81. package/dist/esm/anyspend/react/components/common/PanelOnramp.js +7 -6
  82. package/dist/esm/anyspend/react/components/common/PaymentMethodSwitch.d.ts +7 -0
  83. package/dist/esm/anyspend/react/components/common/PaymentMethodSwitch.js +21 -0
  84. package/dist/esm/anyspend/react/components/common/PointsDetailPanel.d.ts +6 -0
  85. package/dist/esm/anyspend/react/components/common/PointsDetailPanel.js +8 -0
  86. package/dist/esm/anyspend/react/components/common/TransferCryptoDetails.d.ts +2 -0
  87. package/dist/esm/anyspend/react/components/common/TransferCryptoDetails.js +6 -4
  88. package/dist/esm/anyspend/react/contexts/FeatureFlagsContext.d.ts +11 -0
  89. package/dist/esm/anyspend/react/contexts/FeatureFlagsContext.js +17 -0
  90. package/dist/esm/anyspend/react/hooks/useAnyspendFlow.d.ts +4 -1
  91. package/dist/esm/anyspend/react/hooks/useAnyspendFlow.js +13 -5
  92. package/dist/esm/anyspend/react/providers/AnyspendProvider.d.ts +5 -2
  93. package/dist/esm/anyspend/react/providers/AnyspendProvider.js +5 -3
  94. package/dist/esm/anyspend/react/providers/index.d.ts +1 -0
  95. package/dist/esm/anyspend/react/providers/index.js +1 -0
  96. package/dist/esm/anyspend/types/api.d.ts +10 -0
  97. package/dist/esm/anyspend/utils/chain.js +1 -1
  98. package/dist/esm/bondkit/bondkitToken.d.ts +37 -2
  99. package/dist/esm/bondkit/bondkitToken.js +268 -2
  100. package/dist/esm/bondkit/bondkitTokenFactory.d.ts +1 -1
  101. package/dist/esm/bondkit/bondkitTokenFactory.js +2 -2
  102. package/dist/esm/bondkit/config.d.ts +1 -1
  103. package/dist/esm/bondkit/config.js +5 -2
  104. package/dist/esm/bondkit/constants.d.ts +4 -0
  105. package/dist/esm/bondkit/constants.js +5 -0
  106. package/dist/esm/bondkit/index.d.ts +1 -0
  107. package/dist/esm/bondkit/index.js +2 -0
  108. package/dist/esm/bondkit/swapService.d.ts +43 -0
  109. package/dist/esm/bondkit/swapService.js +369 -0
  110. package/dist/esm/bondkit/types.d.ts +10 -4
  111. package/dist/esm/bondkit/types.js +4 -5
  112. package/dist/esm/global-account/react/components/B3Provider/B3Provider.d.ts +2 -1
  113. package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +14 -19
  114. package/dist/esm/global-account/react/components/LinkAccount/LinkAccount.js +65 -5
  115. package/dist/esm/global-account/react/components/ManageAccount/ManageAccount.js +35 -2
  116. package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStepCustom.js +3 -2
  117. package/dist/esm/global-account/react/hooks/useAccountWallet.js +0 -12
  118. package/dist/esm/global-account/react/hooks/useAuthentication.js +1 -2
  119. package/dist/esm/global-account/react/hooks/useSimBalance.js +2 -2
  120. package/dist/esm/global-account/react/hooks/useUnifiedChainSwitchAndExecute.js +27 -22
  121. package/dist/styles/index.css +1 -1
  122. package/dist/types/anyspend/constants/index.d.ts +0 -1
  123. package/dist/types/anyspend/react/components/AnySpend.d.ts +10 -1
  124. package/dist/types/anyspend/react/components/AnyspendDepositHype.d.ts +8 -0
  125. package/dist/types/anyspend/react/components/common/ConnectWalletPayment.d.ts +2 -1
  126. package/dist/types/anyspend/react/components/common/CryptoPaySection.d.ts +4 -1
  127. package/dist/types/anyspend/react/components/common/CryptoReceiveSection.d.ts +2 -1
  128. package/dist/types/anyspend/react/components/common/OrderDetails.d.ts +2 -0
  129. package/dist/types/anyspend/react/components/common/OrderTokenAmount.d.ts +4 -1
  130. package/dist/types/anyspend/react/components/common/PanelOnramp.d.ts +4 -1
  131. package/dist/types/anyspend/react/components/common/PaymentMethodSwitch.d.ts +7 -0
  132. package/dist/types/anyspend/react/components/common/PointsDetailPanel.d.ts +6 -0
  133. package/dist/types/anyspend/react/components/common/TransferCryptoDetails.d.ts +2 -0
  134. package/dist/types/anyspend/react/contexts/FeatureFlagsContext.d.ts +11 -0
  135. package/dist/types/anyspend/react/hooks/useAnyspendFlow.d.ts +4 -1
  136. package/dist/types/anyspend/react/providers/AnyspendProvider.d.ts +5 -2
  137. package/dist/types/anyspend/react/providers/index.d.ts +1 -0
  138. package/dist/types/anyspend/types/api.d.ts +10 -0
  139. package/dist/types/bondkit/bondkitToken.d.ts +37 -2
  140. package/dist/types/bondkit/bondkitTokenFactory.d.ts +1 -1
  141. package/dist/types/bondkit/config.d.ts +1 -1
  142. package/dist/types/bondkit/constants.d.ts +4 -0
  143. package/dist/types/bondkit/index.d.ts +1 -0
  144. package/dist/types/bondkit/swapService.d.ts +43 -0
  145. package/dist/types/bondkit/types.d.ts +10 -4
  146. package/dist/types/global-account/react/components/B3Provider/B3Provider.d.ts +2 -1
  147. package/package.json +2 -1
  148. package/src/anyspend/constants/index.ts +0 -2
  149. package/src/anyspend/react/components/AnySpend.tsx +38 -17
  150. package/src/anyspend/react/components/AnySpendCustom.tsx +19 -21
  151. package/src/anyspend/react/components/AnyspendDepositHype.tsx +38 -18
  152. package/src/anyspend/react/components/common/ConnectWalletPayment.tsx +12 -4
  153. package/src/anyspend/react/components/common/CryptoPaySection.tsx +13 -8
  154. package/src/anyspend/react/components/common/CryptoPaymentMethod.tsx +170 -44
  155. package/src/anyspend/react/components/common/CryptoReceiveSection.tsx +63 -45
  156. package/src/anyspend/react/components/common/OrderDetails.tsx +60 -47
  157. package/src/anyspend/react/components/common/OrderDetailsCollapsible.tsx +62 -41
  158. package/src/anyspend/react/components/common/OrderTokenAmount.tsx +28 -8
  159. package/src/anyspend/react/components/common/PanelOnramp.tsx +28 -15
  160. package/src/anyspend/react/components/common/PaymentMethodSwitch.tsx +38 -0
  161. package/src/anyspend/react/components/common/PointsDetailPanel.tsx +55 -0
  162. package/src/anyspend/react/components/common/TransferCryptoDetails.tsx +65 -43
  163. package/src/anyspend/react/contexts/FeatureFlagsContext.tsx +34 -0
  164. package/src/anyspend/react/hooks/useAnyspendFlow.ts +13 -5
  165. package/src/anyspend/react/providers/AnyspendProvider.tsx +11 -6
  166. package/src/anyspend/react/providers/index.ts +1 -0
  167. package/src/anyspend/types/api.ts +10 -0
  168. package/src/anyspend/types/api_req_res.ts +6 -10
  169. package/src/anyspend/utils/chain.ts +1 -1
  170. package/src/bondkit/bondkitToken.ts +323 -3
  171. package/src/bondkit/bondkitTokenFactory.ts +2 -2
  172. package/src/bondkit/config.ts +5 -2
  173. package/src/bondkit/constants.ts +7 -0
  174. package/src/bondkit/index.ts +3 -0
  175. package/src/bondkit/swapService.ts +461 -0
  176. package/src/bondkit/types.ts +12 -5
  177. package/src/global-account/react/components/B3Provider/B3Provider.tsx +17 -19
  178. package/src/global-account/react/components/LinkAccount/LinkAccount.tsx +106 -32
  179. package/src/global-account/react/components/ManageAccount/ManageAccount.tsx +60 -5
  180. package/src/global-account/react/components/SignInWithB3/steps/LoginStepCustom.tsx +4 -2
  181. package/src/global-account/react/hooks/useAccountWallet.tsx +0 -13
  182. package/src/global-account/react/hooks/useAuthentication.ts +1 -2
  183. package/src/global-account/react/hooks/useSimBalance.ts +2 -2
  184. package/src/global-account/react/hooks/useUnifiedChainSwitchAndExecute.ts +28 -23
  185. package/dist/cjs/global-account/examples/client-selection-example.d.ts +0 -5
  186. package/dist/cjs/global-account/examples/client-selection-example.js +0 -96
  187. package/dist/esm/global-account/examples/client-selection-example.d.ts +0 -5
  188. package/dist/esm/global-account/examples/client-selection-example.js +0 -93
  189. package/dist/types/global-account/examples/client-selection-example.d.ts +0 -5
  190. package/src/global-account/docs/client-selection.md +0 -292
  191. package/src/global-account/examples/client-selection-example.tsx +0 -197
@@ -1,6 +1,8 @@
1
1
  import { ReactNode } from "react";
2
+ import { FeatureFlags } from "../contexts/FeatureFlagsContext";
2
3
  interface AnyspendProviderProps {
3
4
  children: ReactNode;
5
+ featureFlags?: FeatureFlags;
4
6
  }
5
7
  /**
6
8
  * AnyspendProvider is a top-level provider that wraps your application to provide
@@ -12,17 +14,18 @@ interface AnyspendProviderProps {
12
14
  * - Safe to use at the application root
13
15
  * - Configures sensible defaults for query caching
14
16
  * - Handles Stripe payment redirects and modal state
17
+ * - Provides feature flags configuration
15
18
  *
16
19
  * @example
17
20
  * ```tsx
18
21
  * function App() {
19
22
  * return (
20
- * <AnyspendProvider>
23
+ * <AnyspendProvider featureFlags={{ showPoints: true }}>
21
24
  * <YourApp />
22
25
  * </AnyspendProvider>
23
26
  * );
24
27
  * }
25
28
  * ```
26
29
  */
27
- export declare const AnyspendProvider: ({ children }: AnyspendProviderProps) => import("react/jsx-runtime").JSX.Element;
30
+ export declare const AnyspendProvider: ({ children, featureFlags }: AnyspendProviderProps) => import("react/jsx-runtime").JSX.Element;
28
31
  export {};
@@ -1,2 +1,3 @@
1
1
  export * from "./AnyspendProvider";
2
2
  export * from "./StripeRedirectHandler";
3
+ export { useFeatureFlags, type FeatureFlags } from "../contexts/FeatureFlagsContext";
@@ -798,6 +798,16 @@ export interface paths {
798
798
  * @example 0
799
799
  */
800
800
  userBalance?: string;
801
+ /**
802
+ * @description Anyspend points that will be awarded for the order
803
+ * @example 100
804
+ */
805
+ pointsAmount?: number;
806
+ /**
807
+ * @description Multiplier applied to points that will be awarded for the order
808
+ * @example 1.5
809
+ */
810
+ pointsMultiplier?: number;
801
811
  };
802
812
  /** @example 200 */
803
813
  statusCode: number;
@@ -1,6 +1,7 @@
1
1
  import type { Address, EIP1193Provider, GetContractReturnType, Hex, PublicClient, WalletClient } from "viem";
2
2
  import { BondkitTokenABI } from "./abis";
3
- import type { BondkitTokenInitializationConfig, GetTransactionHistoryOptions, TokenDetails, TokenStatus, TransactionResponse } from "./types";
3
+ import type { BondkitTokenInitializationConfig, GetTransactionHistoryOptions, SwapQuote, TokenDetails, TransactionResponse } from "./types";
4
+ import { TokenStatus } from "./types";
4
5
  type ExecuteWriteOptions = {
5
6
  value?: bigint;
6
7
  gas?: bigint;
@@ -18,7 +19,8 @@ export declare class BondkitToken {
18
19
  private walletClientInstance;
19
20
  private connectedProvider?;
20
21
  private tradingToken?;
21
- constructor(contractAddress: string, walletKey?: string);
22
+ private swapService?;
23
+ constructor(contractAddress: string, walletKey?: string, rpcUrl?: string);
22
24
  connect(provider?: EIP1193Provider): boolean;
23
25
  /**
24
26
  * Connects using an EIP-1193 provider and requests accounts, selecting the first one.
@@ -69,5 +71,38 @@ export declare class BondkitToken {
69
71
  migrateToDex(options?: ExecuteWriteOptions): Promise<Hex | undefined>;
70
72
  transferTokenOwnership(newOwner: Address, options?: ExecuteWriteOptions): Promise<Hex | undefined>;
71
73
  renounceTokenOwnership(options?: ExecuteWriteOptions): Promise<Hex | undefined>;
74
+ /**
75
+ * Get the swap service instance (lazy initialization)
76
+ */
77
+ private getSwapService;
78
+ /**
79
+ * Check if DEX swapping is available (token must be in Dex phase)
80
+ */
81
+ isSwapAvailable(): Promise<boolean | undefined>;
82
+ /**
83
+ * Get swap quote for trading token → bondkit token
84
+ */
85
+ getSwapQuoteForBondkitToken(amountTradingTokenIn: string, slippageTolerance?: number): Promise<SwapQuote | undefined>;
86
+ /**
87
+ * Get swap quote for bondkit token → trading token
88
+ */
89
+ getSwapQuoteForTradingToken(amountBondkitTokenIn: string, slippageTolerance?: number): Promise<SwapQuote | undefined>;
90
+ /**
91
+ * Swap trading token for bondkit token
92
+ */
93
+ swapTradingTokenForBondkitToken(amountTradingTokenIn: string, slippageTolerance?: number, options?: ExecuteWriteOptions): Promise<Hex | undefined>;
94
+ /**
95
+ * Swap bondkit token for trading token
96
+ */
97
+ swapBondkitTokenForTradingToken(amountBondkitTokenIn: string, slippageTolerance?: number, options?: ExecuteWriteOptions): Promise<Hex | undefined>;
98
+ /**
99
+ * Helper method to get trading token decimals
100
+ */
101
+ private getTradingTokenDecimals;
102
+ /**
103
+ * Get trading token symbol
104
+ * @param tradingTokenAddress Optional trading token address to avoid fetching it again
105
+ */
106
+ getTradingTokenSymbol(tradingTokenAddress?: Address): Promise<string | undefined>;
72
107
  }
73
108
  export {};
@@ -10,7 +10,7 @@ export declare class BondkitTokenFactory {
10
10
  private rpcUrl;
11
11
  private walletClientInstance;
12
12
  private connectedProvider?;
13
- constructor(chainId: SupportedChainId, walletKey?: string);
13
+ constructor(chainId: SupportedChainId, walletKey?: string, rpcUrl?: string);
14
14
  connect(provider?: EIP1193Provider): boolean;
15
15
  /**
16
16
  * Connects using an EIP-1193 provider and requests accounts, selecting the first one.
@@ -7,4 +7,4 @@ export interface Config {
7
7
  apiEndpoint: string;
8
8
  }
9
9
  export type SupportedChainId = typeof base.id;
10
- export declare const getConfig: (chainId: number) => Config;
10
+ export declare const getConfig: (chainId: number, rpcUrl?: string) => Config;
@@ -1,3 +1,7 @@
1
1
  import type { Address } from "viem";
2
2
  export declare const BaseBondkitTokenFactoryContractAddress: Address;
3
3
  export declare const BaseMainnetRpcUrl = "https://base-rpc.publicnode.com";
4
+ export declare const UniversalRouterAddress: Address;
5
+ export declare const QuoterAddress: Address;
6
+ export declare const Permit2Address: Address;
7
+ export declare const B3TokenAddress: Address;
@@ -4,4 +4,5 @@ export * from "./config";
4
4
  export * from "./constants";
5
5
  export * from "./types";
6
6
  export * from "./abis";
7
+ export { BondkitSwapService } from "./swapService";
7
8
  export { default as TradingView } from "./components/TradingView";
@@ -0,0 +1,43 @@
1
+ import type { Address, WalletClient } from "viem";
2
+ import type { SwapQuote } from "./types";
3
+ interface SwapParams {
4
+ tokenIn: Address;
5
+ tokenOut: Address;
6
+ amountIn: string;
7
+ tokenInDecimals: number;
8
+ tokenOutDecimals: number;
9
+ slippageTolerance: number;
10
+ recipient: Address;
11
+ deadline?: number;
12
+ }
13
+ /**
14
+ * Internal swap service for handling Uniswap V4 swaps between trading token and bondkit token
15
+ */
16
+ export declare class BondkitSwapService {
17
+ private v4Config;
18
+ private configInitialized;
19
+ private readonly bondkitTokenAddress;
20
+ private readonly publicClient;
21
+ constructor(bondkitTokenAddress: Address);
22
+ /**
23
+ * Initialize V4 pool configuration from bondkit token contract
24
+ */
25
+ private initializeV4Config;
26
+ /**
27
+ * Get V4 pool configuration
28
+ */
29
+ private getV4Config;
30
+ /**
31
+ * Handle token approvals for swap
32
+ */
33
+ private handleTokenApprovals;
34
+ /**
35
+ * Get swap quote
36
+ */
37
+ getSwapQuote(params: SwapParams): Promise<SwapQuote | null>;
38
+ /**
39
+ * Execute swap transaction
40
+ */
41
+ executeSwap(params: SwapParams, walletClient: WalletClient): Promise<string | null>;
42
+ }
43
+ export {};
@@ -49,10 +49,9 @@ export type DexMigrationEventArgs = {
49
49
  ethForFeeRecipient: bigint;
50
50
  };
51
51
  export declare enum TokenStatus {
52
- Inactive = 0,// Assuming mapping from ABI, verify actual enum values if specified elsewhere
53
- BondingPhase = 1,
54
- DexPhase = 2,
55
- Migrated = 3
52
+ Uninitialized = 0,
53
+ Bonding = 1,
54
+ Dex = 2
56
55
  }
57
56
  export interface GetTransactionHistoryOptions {
58
57
  userAddress?: Address;
@@ -80,3 +79,10 @@ export interface TransactionResponse {
80
79
  skip: number;
81
80
  data: Transaction[];
82
81
  }
82
+ export interface SwapQuote {
83
+ amountOut: string;
84
+ amountOutMin: string;
85
+ priceImpact: string;
86
+ executionPrice: string;
87
+ fee: string;
88
+ }
@@ -6,7 +6,7 @@ import { B3ContextType } from "./types";
6
6
  /**
7
7
  * Main B3Provider component
8
8
  */
9
- export declare function B3Provider({ theme, children, accountOverride, environment, automaticallySetFirstEoa, simDuneApiKey, toaster, clientType, partnerId, }: {
9
+ export declare function B3Provider({ theme, children, accountOverride, environment, automaticallySetFirstEoa, simDuneApiKey, toaster, clientType, rpcUrls, partnerId, }: {
10
10
  theme: "light" | "dark";
11
11
  children: React.ReactNode;
12
12
  accountOverride?: Account;
@@ -18,6 +18,7 @@ export declare function B3Provider({ theme, children, accountOverride, environme
18
18
  style?: React.CSSProperties;
19
19
  };
20
20
  clientType?: ClientType;
21
+ rpcUrls?: Record<number, string>;
21
22
  partnerId?: string;
22
23
  }): import("react/jsx-runtime").JSX.Element;
23
24
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@b3dotfun/sdk",
3
- "version": "0.0.40-test.6",
3
+ "version": "0.0.41-test.0",
4
4
  "source": "src/index.ts",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "react-native": "./dist/cjs/index.native.js",
@@ -239,6 +239,7 @@
239
239
  "dependencies": {
240
240
  "@b3dotfun/b3-api": "0.0.50",
241
241
  "@b3dotfun/basement-api": "0.0.11",
242
+ "@farcaster/miniapp-wagmi-connector": "^1.0.0",
242
243
  "@feathersjs/authentication-client": "5.0.33",
243
244
  "@feathersjs/feathers": "5.0.33",
244
245
  "@feathersjs/rest-client": "5.0.33",
@@ -96,5 +96,3 @@ export const VENDOR_DISPLAY_NAMES = {
96
96
  stripe: "Stripe",
97
97
  unknown: "Unknown Vendor",
98
98
  } as const;
99
-
100
- export const DEPOSIT_HYPE_ACTION = "deposit_hype";
@@ -38,9 +38,9 @@ import { ErrorSection } from "./common/ErrorSection";
38
38
  import { FiatPaymentMethod, FiatPaymentMethodComponent } from "./common/FiatPaymentMethod";
39
39
  import { OrderDetails, OrderDetailsLoadingView } from "./common/OrderDetails";
40
40
  import { OrderHistory } from "./common/OrderHistory";
41
- import { OrderStatus } from "./common/OrderStatus";
42
41
  import { PanelOnramp } from "./common/PanelOnramp";
43
42
  import { PanelOnrampPayment } from "./common/PanelOnrampPayment";
43
+ import { PointsDetailPanel } from "./common/PointsDetailPanel";
44
44
  import { RecipientSelection } from "./common/RecipientSelection";
45
45
  import { TabSection } from "./common/TabSection";
46
46
 
@@ -60,6 +60,7 @@ export enum PanelView {
60
60
  RECIPIENT_SELECTION,
61
61
  CRYPTO_PAYMENT_METHOD,
62
62
  FIAT_PAYMENT_METHOD,
63
+ POINTS_DETAIL,
63
64
  }
64
65
 
65
66
  const ANYSPEND_RECIPIENTS_KEY = "anyspend_recipients";
@@ -72,6 +73,11 @@ export function AnySpend(props: {
72
73
  recipientAddress?: string;
73
74
  loadOrder?: string;
74
75
  hideTransactionHistoryButton?: boolean;
76
+ /**
77
+ * Called when a token is selected. Call event.preventDefault() to prevent default token selection behavior.
78
+ * Useful for handling special cases like B3 token selection.
79
+ */
80
+ onTokenSelect?: (token: components["schemas"]["Token"], event: { preventDefault: () => void }) => void;
75
81
  }) {
76
82
  const fingerprintConfig = getFingerprintConfig();
77
83
 
@@ -90,6 +96,7 @@ function AnySpendInner({
90
96
  loadOrder,
91
97
  hideTransactionHistoryButton,
92
98
  recipientAddress: recipientAddressFromProps,
99
+ onTokenSelect,
93
100
  }: {
94
101
  destinationTokenAddress?: string;
95
102
  destinationTokenChainId?: number;
@@ -98,6 +105,7 @@ function AnySpendInner({
98
105
  loadOrder?: string;
99
106
  hideTransactionHistoryButton?: boolean;
100
107
  recipientAddress?: string;
108
+ onTokenSelect?: (token: components["schemas"]["Token"], event: { preventDefault: () => void }) => void;
101
109
  }) {
102
110
  const searchParams = useSearchParamsSSR();
103
111
  const router = useRouter();
@@ -807,22 +815,21 @@ function AnySpendInner({
807
815
  <div className={"mx-auto w-[460px] max-w-full"}>
808
816
  <div className="relative flex flex-col gap-4">
809
817
  {oat && (
810
- <>
811
- <OrderStatus order={oat.data.order} selectedCryptoPaymentMethod={selectedCryptoPaymentMethod} />
812
- <OrderDetails
813
- mode={mode}
814
- order={oat.data.order}
815
- depositTxs={oat.data.depositTxs}
816
- relayTxs={oat.data.relayTxs}
817
- executeTx={oat.data.executeTx}
818
- refundTxs={oat.data.refundTxs}
819
- onBack={() => {
820
- setOrderId(undefined);
821
- setActivePanel(PanelView.MAIN);
822
- setSelectedCryptoPaymentMethod(CryptoPaymentMethodType.NONE); // Reset payment method when going back
823
- }}
824
- />
825
- </>
818
+ <OrderDetails
819
+ mode={mode}
820
+ order={oat.data.order}
821
+ depositTxs={oat.data.depositTxs}
822
+ relayTxs={oat.data.relayTxs}
823
+ executeTx={oat.data.executeTx}
824
+ refundTxs={oat.data.refundTxs}
825
+ selectedCryptoPaymentMethod={selectedCryptoPaymentMethod}
826
+ onPaymentMethodChange={setSelectedCryptoPaymentMethod}
827
+ onBack={() => {
828
+ setOrderId(undefined);
829
+ setActivePanel(PanelView.MAIN);
830
+ setSelectedCryptoPaymentMethod(CryptoPaymentMethodType.NONE); // Reset payment method when going back
831
+ }}
832
+ />
826
833
  )}
827
834
  {/* {mode === "page" && <div className="h-12" />} */}
828
835
  </div>
@@ -871,6 +878,7 @@ function AnySpendInner({
871
878
  selectedCryptoPaymentMethod={selectedCryptoPaymentMethod}
872
879
  onSelectCryptoPaymentMethod={() => setActivePanel(PanelView.CRYPTO_PAYMENT_METHOD)}
873
880
  anyspendQuote={anyspendQuote}
881
+ onTokenSelect={onTokenSelect}
874
882
  />
875
883
  ) : (
876
884
  <motion.div
@@ -892,6 +900,8 @@ function AnySpendInner({
892
900
  fiatPaymentMethodIndex={PanelView.FIAT_PAYMENT_METHOD}
893
901
  recipientSelectionPanelIndex={PanelView.RECIPIENT_SELECTION}
894
902
  hideDstToken={isBuyMode}
903
+ anyspendQuote={anyspendQuote}
904
+ onShowPointsDetail={() => setActivePanel(PanelView.POINTS_DETAIL)}
895
905
  />
896
906
  </motion.div>
897
907
  )}
@@ -951,6 +961,7 @@ function AnySpendInner({
951
961
  setDstAmount(value);
952
962
  }}
953
963
  anyspendQuote={anyspendQuote}
964
+ onShowPointsDetail={() => setActivePanel(PanelView.POINTS_DETAIL)}
954
965
  />
955
966
  )}
956
967
  </div>
@@ -1062,6 +1073,13 @@ function AnySpendInner({
1062
1073
  />
1063
1074
  );
1064
1075
 
1076
+ const pointsDetailView = (
1077
+ <PointsDetailPanel
1078
+ pointsAmount={anyspendQuote?.data?.pointsAmount || 0}
1079
+ onBack={() => setActivePanel(PanelView.MAIN)}
1080
+ />
1081
+ );
1082
+
1065
1083
  // Add tabs to the main component when no order is loaded
1066
1084
  return (
1067
1085
  <StyleRoot>
@@ -1117,6 +1135,9 @@ function AnySpendInner({
1117
1135
  <div key="fiat-payment-method-view" className={cn(mode === "page" && "p-6")}>
1118
1136
  {fiatPaymentMethodView}
1119
1137
  </div>,
1138
+ <div key="points-detail-view" className={cn(mode === "page" && "p-6")}>
1139
+ {pointsDetailView}
1140
+ </div>,
1120
1141
  ]}
1121
1142
  </TransitionPanel>
1122
1143
  </div>
@@ -47,7 +47,6 @@ import { CryptoPaymentMethod, CryptoPaymentMethodType } from "./common/CryptoPay
47
47
  import { FiatPaymentMethod, FiatPaymentMethodComponent } from "./common/FiatPaymentMethod";
48
48
  import { OrderDetails } from "./common/OrderDetails";
49
49
  import { OrderHistory } from "./common/OrderHistory";
50
- import { OrderStatus as OrderStatusDisplay } from "./common/OrderStatus";
51
50
  import { OrderToken } from "./common/OrderToken";
52
51
  import { RecipientSelection } from "./common/RecipientSelection";
53
52
 
@@ -648,26 +647,25 @@ function AnySpendCustomInner({
648
647
  )}
649
648
  >
650
649
  {oat && (
651
- <>
652
- <OrderStatusDisplay order={oat.data.order} selectedCryptoPaymentMethod={selectedCryptoPaymentMethod} />
653
- <OrderDetails
654
- mode={mode}
655
- order={oat.data.order}
656
- depositTxs={oat.data.depositTxs}
657
- relayTxs={oat.data.relayTxs}
658
- executeTx={oat.data.executeTx}
659
- refundTxs={oat.data.refundTxs}
660
- cryptoPaymentMethod={activeTab === "fiat" ? CryptoPaymentMethodType.NONE : selectedCryptoPaymentMethod}
661
- onBack={() => {
662
- setOrderId(undefined);
663
- setActivePanel(PanelView.CONFIRM_ORDER);
664
- // Remove orderId from URL when canceling
665
- const params = new URLSearchParams(searchParams.toString());
666
- params.delete("orderId");
667
- router.push(`${window.location.pathname}?${params.toString()}`);
668
- }}
669
- />
670
- </>
650
+ <OrderDetails
651
+ mode={mode}
652
+ order={oat.data.order}
653
+ depositTxs={oat.data.depositTxs}
654
+ relayTxs={oat.data.relayTxs}
655
+ executeTx={oat.data.executeTx}
656
+ refundTxs={oat.data.refundTxs}
657
+ cryptoPaymentMethod={activeTab === "fiat" ? CryptoPaymentMethodType.NONE : selectedCryptoPaymentMethod}
658
+ selectedCryptoPaymentMethod={selectedCryptoPaymentMethod}
659
+ onPaymentMethodChange={setSelectedCryptoPaymentMethod}
660
+ onBack={() => {
661
+ setOrderId(undefined);
662
+ setActivePanel(PanelView.CONFIRM_ORDER);
663
+ // Remove orderId from URL when canceling
664
+ const params = new URLSearchParams(searchParams.toString());
665
+ params.delete("orderId");
666
+ router.push(`${window.location.pathname}?${params.toString()}`);
667
+ }}
668
+ />
671
669
  )}
672
670
  {mode === "page" && <div className="h-12" />}
673
671
  </div>
@@ -1,4 +1,5 @@
1
1
  import { B3_TOKEN } from "@b3dotfun/sdk/anyspend";
2
+ import { components } from "@b3dotfun/sdk/anyspend/types/api";
2
3
  import { Button, ShinyButton, StyleRoot, TransitionPanel } from "@b3dotfun/sdk/global-account/react";
3
4
  import { cn } from "@b3dotfun/sdk/shared/utils/cn";
4
5
  import invariant from "invariant";
@@ -14,7 +15,7 @@ import { CryptoReceiveSection } from "./common/CryptoReceiveSection";
14
15
  import { ErrorSection } from "./common/ErrorSection";
15
16
  import { FiatPaymentMethod, FiatPaymentMethodComponent } from "./common/FiatPaymentMethod";
16
17
  import { OrderDetails } from "./common/OrderDetails";
17
- import { OrderStatus } from "./common/OrderStatus";
18
+ import { PointsDetailPanel } from "./common/PointsDetailPanel";
18
19
  import { RecipientSelection } from "./common/RecipientSelection";
19
20
 
20
21
  import { ArrowDown } from "lucide-react";
@@ -36,6 +37,11 @@ export interface AnySpendDepositHypeProps {
36
37
  sourceTokenChainId?: number;
37
38
  onSuccess?: () => void;
38
39
  mainFooter?: React.ReactNode;
40
+ /**
41
+ * Called when a token is selected. Call event.preventDefault() to prevent default token selection behavior.
42
+ * Useful for handling special cases like B3 token selection.
43
+ */
44
+ onTokenSelect?: (token: components["schemas"]["Token"], event: { preventDefault: () => void }) => void;
39
45
  }
40
46
 
41
47
  export function AnySpendDepositHype(props: AnySpendDepositHypeProps) {
@@ -57,6 +63,7 @@ function AnySpendDepositHypeInner({
57
63
  sourceTokenChainId,
58
64
  onSuccess,
59
65
  mainFooter,
66
+ onTokenSelect,
60
67
  }: AnySpendDepositHypeProps) {
61
68
  // Use shared flow hook
62
69
  const {
@@ -202,6 +209,7 @@ function AnySpendDepositHypeInner({
202
209
  selectedCryptoPaymentMethod={selectedCryptoPaymentMethod}
203
210
  onSelectCryptoPaymentMethod={() => setActivePanel(PanelView.CRYPTO_PAYMENT_METHOD)}
204
211
  anyspendQuote={anyspendQuote}
212
+ onTokenSelect={onTokenSelect}
205
213
  />
206
214
  ) : (
207
215
  <motion.div
@@ -224,6 +232,8 @@ function AnySpendDepositHypeInner({
224
232
  onDestinationChainChange={() => {}}
225
233
  fiatPaymentMethodIndex={PanelView.FIAT_PAYMENT_METHOD}
226
234
  recipientSelectionPanelIndex={PanelView.RECIPIENT_SELECTION}
235
+ anyspendQuote={anyspendQuote}
236
+ onShowPointsDetail={() => setActivePanel(PanelView.POINTS_DETAIL)}
227
237
  />
228
238
  </motion.div>
229
239
  )}
@@ -264,6 +274,7 @@ function AnySpendDepositHypeInner({
264
274
  setSrcAmount(value);
265
275
  }}
266
276
  anyspendQuote={anyspendQuote}
277
+ onShowPointsDetail={() => setActivePanel(PanelView.POINTS_DETAIL)}
267
278
  />
268
279
  )}
269
280
  </div>
@@ -381,23 +392,22 @@ function AnySpendDepositHypeInner({
381
392
  <div className={"mx-auto w-[460px] max-w-full"}>
382
393
  <div className="relative flex flex-col gap-4">
383
394
  {oat && (
384
- <>
385
- <OrderStatus order={oat.data.order} selectedCryptoPaymentMethod={selectedCryptoPaymentMethod} />
386
- <OrderDetails
387
- mode={mode}
388
- order={oat.data.order}
389
- depositTxs={oat.data.depositTxs}
390
- relayTxs={oat.data.relayTxs}
391
- executeTx={oat.data.executeTx}
392
- refundTxs={oat.data.refundTxs}
393
- cryptoPaymentMethod={paymentType === "fiat" ? CryptoPaymentMethodType.NONE : selectedCryptoPaymentMethod}
394
- onBack={() => {
395
- setOrderId(undefined);
396
- setActivePanel(PanelView.MAIN);
397
- }}
398
- disableUrlParamManagement
399
- />
400
- </>
395
+ <OrderDetails
396
+ mode={mode}
397
+ order={oat.data.order}
398
+ depositTxs={oat.data.depositTxs}
399
+ relayTxs={oat.data.relayTxs}
400
+ executeTx={oat.data.executeTx}
401
+ refundTxs={oat.data.refundTxs}
402
+ cryptoPaymentMethod={paymentType === "fiat" ? CryptoPaymentMethodType.NONE : selectedCryptoPaymentMethod}
403
+ selectedCryptoPaymentMethod={selectedCryptoPaymentMethod}
404
+ onPaymentMethodChange={setSelectedCryptoPaymentMethod}
405
+ onBack={() => {
406
+ setOrderId(undefined);
407
+ setActivePanel(PanelView.MAIN);
408
+ }}
409
+ disableUrlParamManagement
410
+ />
401
411
  )}
402
412
  </div>
403
413
  </div>
@@ -450,6 +460,13 @@ function AnySpendDepositHypeInner({
450
460
  />
451
461
  );
452
462
 
463
+ const pointsDetailView = (
464
+ <PointsDetailPanel
465
+ pointsAmount={anyspendQuote?.data?.pointsAmount || 0}
466
+ onBack={() => setActivePanel(PanelView.MAIN)}
467
+ />
468
+ );
469
+
453
470
  // If showing token selection, render with panel transitions
454
471
  return (
455
472
  <StyleRoot>
@@ -499,6 +516,9 @@ function AnySpendDepositHypeInner({
499
516
  <div key="loading-view" className={cn(mode === "page" && "p-6")}>
500
517
  {loadingView}
501
518
  </div>,
519
+ <div key="points-detail-view" className={cn(mode === "page" && "p-6")}>
520
+ {pointsDetailView}
521
+ </div>,
502
522
  ]}
503
523
  </TransitionPanel>
504
524
  </div>
@@ -2,14 +2,14 @@
2
2
 
3
3
  import { RELAY_SOLANA_MAINNET_CHAIN_ID } from "@b3dotfun/sdk/anyspend";
4
4
  import { components } from "@b3dotfun/sdk/anyspend/types/api";
5
- import { ShinyButton, useProfile } from "@b3dotfun/sdk/global-account/react";
5
+ import { ShinyButton, useAccountWallet, useProfile } from "@b3dotfun/sdk/global-account/react";
6
6
  import centerTruncate from "@b3dotfun/sdk/shared/utils/centerTruncate";
7
7
  import { formatTokenAmount } from "@b3dotfun/sdk/shared/utils/number";
8
8
  import { motion } from "framer-motion";
9
9
  import { ChevronRight, Loader2 } from "lucide-react";
10
- import { useAccount } from "wagmi";
11
10
  import { CryptoPaymentMethodType } from "./CryptoPaymentMethod";
12
11
  import { OrderDetailsCollapsible } from "./OrderDetailsCollapsible";
12
+ import { PaymentMethodSwitch } from "./PaymentMethodSwitch";
13
13
 
14
14
  type Tournament = components["schemas"]["Tournament"];
15
15
  type NFT = components["schemas"]["NFT"];
@@ -24,6 +24,7 @@ interface ConnectWalletPaymentProps {
24
24
  tournament?: Tournament;
25
25
  nft?: NFT;
26
26
  cryptoPaymentMethod: CryptoPaymentMethodType;
27
+ onPaymentMethodChange?: (method: CryptoPaymentMethodType) => void;
27
28
  }
28
29
 
29
30
  export default function ConnectWalletPayment({
@@ -35,10 +36,15 @@ export default function ConnectWalletPayment({
35
36
  tournament,
36
37
  nft,
37
38
  cryptoPaymentMethod,
39
+ onPaymentMethodChange,
38
40
  }: ConnectWalletPaymentProps) {
39
41
  const profile = useProfile({ address: order.recipientAddress });
40
42
  const recipientName = profile.data?.name?.replace(/\.b3\.fun/g, "");
41
- const { address: connectedAddress } = useAccount();
43
+ const { connectedEOAWallet, connectedSmartWallet } = useAccountWallet();
44
+ const connectedEvmAddress =
45
+ cryptoPaymentMethod === CryptoPaymentMethodType.GLOBAL_WALLET
46
+ ? connectedSmartWallet?.getAccount()?.address
47
+ : connectedEOAWallet?.getAccount()?.address;
42
48
 
43
49
  const srcToken = order.metadata.srcToken;
44
50
  const dstToken = order.metadata.dstToken;
@@ -94,9 +100,11 @@ export default function ConnectWalletPayment({
94
100
  Connected to:{" "}
95
101
  {order.srcChain === RELAY_SOLANA_MAINNET_CHAIN_ID && phantomWalletAddress
96
102
  ? centerTruncate(phantomWalletAddress, 6)
97
- : centerTruncate(connectedAddress || "")}
103
+ : centerTruncate(connectedEvmAddress || "")}
98
104
  </span>
99
105
 
106
+ <PaymentMethodSwitch currentMethod={cryptoPaymentMethod} onMethodChange={onPaymentMethodChange} />
107
+
100
108
  <div className="mt-4">
101
109
  <OrderDetailsCollapsible
102
110
  order={order}